diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e661693..a6201a5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -24,8 +24,5 @@ jobs: - name: Install dependencies run: npm ci - - name: Check types - run: npm run check-types - - name: Compile - run: npm run compile \ No newline at end of file + run: npm run compile diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 49c2205..6048c00 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -21,9 +21,6 @@ jobs: - name: Install dependencies run: npm ci - - name: Check types - run: npm run check-types - - name: Compile run: npm run compile @@ -211,4 +208,4 @@ jobs: artifacts/mutsumi-darwin-arm64/*.vsix artifacts/mutsumi-linux-x64/*.vsix artifacts/mutsumi-linux-arm64/*.vsix - artifacts/mutsumi-universal/*.vsix \ No newline at end of file + artifacts/mutsumi-universal/*.vsix diff --git a/README.md b/README.md index 7acfe61..7c11663 100644 --- a/README.md +++ b/README.md @@ -382,10 +382,8 @@ This project uses the following open source projects and their license declarati | [uuid](https://github.com/uuidjs/uuid) | ^9.0.1 | MIT | UUID generation | | [web-tree-sitter](https://github.com/tree-sitter/tree-sitter) | ^0.22.2 | MIT | Syntax tree parsing | | [node-notifier](https://github.com/mikaelbr/node-notifier) | ^10.0.1 | MIT | Native desktop notifications | -| [partial-json](https://github.com/promplate/partial-json-parser-js) | ^0.1.7 | MIT | Parse partial JSON generated by LLM | | [iconv-lite](https://github.com/ashtuchkov/iconv-lite) | ^0.6.3 | MIT | Character encoding conversion | | [express](https://github.com/expressjs/express) | ^5.2.1 | MIT | HTTP server framework | -| [body-parser](https://github.com/expressjs/body-parser) | ^2.2.2 | MIT | HTTP request body parsing | | [micromark](https://github.com/micromark/micromark) | ^4.0.0 | MIT | CommonMark-compliant Markdown parser for custom notebook renderer | | [micromark-extension-gfm](https://github.com/micromark/micromark-extension-gfm) | ^2.0.0 | MIT | GFM extensions (tables, strikethrough, etc.) for micromark | | [@modelcontextprotocol/sdk](https://github.com/modelcontextprotocol/typescript-sdk) | ^1.30.0 | MIT | MCP protocol client (stdio / Streamable HTTP) | diff --git a/README_zh.md b/README_zh.md index 4ff9af1..7db08ec 100644 --- a/README_zh.md +++ b/README_zh.md @@ -382,10 +382,8 @@ Mutsumi 采用六阶段动态上下文管理架构: | [uuid](https://github.com/uuidjs/uuid) | ^9.0.1 | MIT | UUID 生成 | | [web-tree-sitter](https://github.com/tree-sitter/tree-sitter) | ^0.22.2 | MIT | 语法树解析 | | [node-notifier](https://github.com/mikaelbr/node-notifier) | ^10.0.1 | MIT | 原生桌面通知 | -| [partial-json](https://github.com/promplate/partial-json-parser-js) | ^0.1.7 | MIT | 解析 LLM 生成的部分 JSON | | [iconv-lite](https://github.com/ashtuchkov/iconv-lite) | ^0.6.3 | MIT | 字符编码转换 | | [express](https://github.com/expressjs/express) | ^5.2.1 | MIT | HTTP 服务器框架 | -| [body-parser](https://github.com/expressjs/body-parser) | ^2.2.2 | MIT | HTTP 请求体解析 | | [micromark](https://github.com/micromark/micromark) | ^4.0.0 | MIT | CommonMark 兼容的 Markdown 解析器,用于自定义 Notebook 渲染器 | | [micromark-extension-gfm](https://github.com/micromark/micromark-extension-gfm) | ^2.0.0 | MIT | micromark 的 GFM 扩展(表格、删除线等) | | [@modelcontextprotocol/sdk](https://github.com/modelcontextprotocol/typescript-sdk) | ^1.30.0 | MIT | MCP 协议客户端(stdio / Streamable HTTP) | diff --git a/docs/.multi-provider-final-target.md b/docs/.multi-provider-final-target.md deleted file mode 100644 index 14acb11..0000000 --- a/docs/.multi-provider-final-target.md +++ /dev/null @@ -1,96 +0,0 @@ -# Multi-Provider Configuration: Final Target State (v2) - -## Purpose - -Complete the multi-provider refactor as a strict breaking change. A model selection is an explicit model/provider pair throughout configuration, persistence, and execution. The system must never infer a provider from ordering when more than one provider declares the same model. No legacy compatibility: prior string-valued model settings and persisted agents missing an explicit provider are unsupported and must fail with migration/configuration errors. - -## Domain Ownership - -- `src/config/` is reserved exclusively for the AgentConfig / AgentType domain (`.mutsumi/config.json`). -- Root `src/types.ts` owns general VS Code settings-domain types and built-in settings defaults. -- `src/utils.ts` owns settings reading, model/provider resolution, and credential validation behavior (no private constants/types). - -## Core Contract - -### `ModelSelection` (single shared type, defined in `src/types.ts`) - -```text -ModelSelection = { model: string; provider: string } -``` - -Also exported from `src/types.ts`: -- `Provider` interface (snake_case: `name`, `baseurl`, `api_key`) -- `DEFAULT_PROVIDERS`, `DEFAULT_MODELS`, `DEFAULT_MODEL_SELECTION` (model `kimi-for-coding`, provider `kimi-for-coding`) - -### Expression by domain - -| Domain | Shape | Rule | -|---|---|---| -| VS Code settings `mutsumi.defaultModel` / `titleGeneratorModel` / `compressModel` | `ModelSelection` object; schema `required: [model, provider]`; default `{ model: "kimi-for-coding", provider: "kimi-for-coding" }` | Legacy string values rejected by schema AND by runtime type guard | -| AgentConfig `AgentTypeConfig.defaultModel` | Optional `ModelSelection` (was required `string`) | Omitted → fall back to global default selection; provided → must be a complete pair | -| Persisted `AgentMetadata` | Flat `model?: string; provider?: string` (shape unchanged) | New agents persist both; legacy files missing provider → migration error at execution | -| Execution `AgentRunOptions` / `AgentSessionConfig` | Unchanged | Runner receives resolved model + credentials only; no provider field added | - -## Resolution and Validation - -- Single validation gate `resolveModelSelection(selection): ModelSelection` in `src/utils.ts`: trim names → provider exists → provider declares the model → return canonical pair; any failure throws a descriptive error. No first-match, no inference, no fallback. -- `getModelCredentials(model, provider)`: provider becomes REQUIRED (was optional hint); internally uses the same gate, then validates non-empty `baseurl` and `api_key`. -- Runtime type guards when reading the three settings: a non-object value (e.g. legacy string) throws a configuration error. -- Agent default resolution chain (in `src/config/resolver.ts`): - `explicit dispatch override (complete pair) > AgentType.defaultModel (complete pair) > mutsumi.defaultModel (complete pair) > configuration error`. - All hardcoded model fallbacks (`gpt-3.5-turbo`, `moonshotai/kimi-k2.5`) are removed. -- `AgentTypeConfig.defaultModel` validation: optional; when present must be an object with non-empty string `model` and `provider`. -- Built-in `DEFAULT_MUTSUMI_CONFIG` agent types use `{ model: "kimi-for-coding", provider: "kimi-for-coding" }`. - -## Persistence - -- `AgentMetadata.model` + `AgentMetadata.provider` are the persistent selection pair. New agents always persist both. -- Single write point: `AgentFileOperations.updateAgentModelSelection(fileUri, selection)`: if the notebook is open in memory, apply `NotebookEdit.updateNotebookMetadata`; otherwise read/write the `.mtm` file. HTTP mutation paths use this write point exclusively. -- After an HTTP mutation, the cached `HeadlessAdapter` session config.metadata must be synchronized so a later `session.save()` cannot roll the selection back. -- `HeadlessAdapter` history rehydration must preserve complete metadata (not just top-level `model`). - -## Creation Paths (three factories) - -1. Root/entry agents — `MutsumiSerializer.createDefaultContent()` resolves the complete pair internally and persists both fields. `src/extension.ts` and `src/httpServer/agents.ts` remain thin and unchanged in their call shape. -2. Dispatch-created children — `AgentFileOperations.createAgentFile()` signature changes from `model?: string` to `modelSelection?: ModelSelection`; resolves through the resolver chain and the validation gate. `AgentOrchestrator.requestDispatch` / `createAndOpenAgent` signatures follow. The dispatch tool schema (`agent_control.ts`) gains no model field; children use AgentType defaults. -3. Compression output — `compressConversation.ts` validates the source metadata pair through the gate BEFORE producing a new `.mtm`; invalid source → migration/configuration error, no file created. The new file inherits the validated pair. Compression model selection follows `compressModel` → `titleGeneratorModel` → `defaultModel` (all objects), resolved through the gate. - -## HTTP Contract - -- `PUT /agent/:uuid/model`: body must contain complete `{ model, provider }`; missing either → 400. Pair validated through the gate → 400 on invalid. Persisted atomically via the single write point, then adapter session synced. -- `POST /agent/:uuid/chat`: body `model`/`provider` all-or-nothing. - - Both present → validate through gate (400 on invalid), use for this request AND persist as the agent's new selection. - - Neither present → use persisted pair. Persisted pair missing `model` → fall back to global default selection. Persisted pair has `model` but no `provider` → 400 migration error (legacy artifact). - - Exactly one present → 400. -- No first-match substitution anywhere in HTTP. - -## Execution Paths - -- `src/controller.ts`: remove `gpt-3.5-turbo` fallback. Notebook metadata pair rules identical to HTTP chat: complete pair → use; missing model → global default selection; model without provider → migration error. -- `src/agent/agentRunner.ts` title generation: read `titleGeneratorModel` selection (object) → fall back to session metadata pair → skip if none. -- `src/agent/titleGenerator.ts`: `TitleGeneratorConfig` becomes `{ modelSelection: ModelSelection }`; `getTitleGeneratorConfig()` reads the object setting with type guard; both title entry points resolve credentials with `getModelCredentials(model, provider)`. -- Display: `extension.ts` QuickPick detail and `agent_control.ts` `get_agent_types` output format the selection as model + provider (e.g. `kimi-for-coding (kimi-for-coding)`). - -## Schema and Docs - -- `package.json`: three model settings become objects with `required` and object defaults; `mutsumi.models` regains value validation via `additionalProperties: { type: "array", items: { type: "string" } }`. -- `package.nls.json` / `package.nls.zh-cn.json`: update the three setting descriptions and the models description to the object/provider-to-models semantics. -- `docs/multi-provider-refactor.md`: rewritten as an implemented design document (not a future plan): object settings, required explicit provider, no legacy compatibility, default empty-key behavior, runtime validation, creation paths, HTTP contract, same-name model support only through explicit pairs. -- `docs/AGENT_TYPES_DESIGN.md` and `docs/AGENT_TYPES_DESIGN_CN.md`: AgentType examples use `{ model: "kimi-for-coding", provider: "kimi-for-coding" }`; document the optional `defaultModel` and fallback rule. - -## Out of Scope - -- No migration layer, parsing fallback, or automatic upgrade for legacy string settings or pre-provider metadata. -- No provider field in `AgentRunOptions` or duplicate provider state in `AgentSessionConfig`. -- No changes to dispatch tool schema. - -## Acceptance Criteria - -1. Package schemas reject string-valued default/title/compress settings; runtime type guards throw on them. -2. New root agents, HTTP-created agents, dispatched children, and compression outputs persist valid `model` + `provider`. -3. Same model names across providers resolve strictly: selection uses the requested explicit provider; ambiguous AgentType-only defaults produce a configuration error. -4. Missing/invalid provider in metadata, settings, or HTTP pair requests yields a descriptive error — never first-match. -5. Empty built-in default `api_key` remains storable and yields actionable configuration guidance only at runtime credential use. -6. HTTP mutations cannot be rolled back by cached Headless sessions or a subsequent notebook save. -7. Title generation and compression use complete selection objects end to end. -8. `tsc --noEmit` and the extension build pass; manual verification covers all three creation paths, HTTP set-model and chat override, legacy-file error behavior, and notebook-open vs file-only mutation. diff --git a/docs/AGENT_TYPES_DESIGN.md b/docs/AGENT_TYPES_DESIGN.md index 622c6ec..381c7b6 100644 --- a/docs/AGENT_TYPES_DESIGN.md +++ b/docs/AGENT_TYPES_DESIGN.md @@ -313,7 +313,7 @@ HTTP path: Both paths: - reject agents with missing `agentType` -- call `createToolSetForAgent(agentType, uuid, parent_agent_id)` +- call `createToolSetForAgent({ agentType, agentId: uuid, parentAgentId: parent_agent_id, enabledMcpTools })` - resolve role tool sets through registries - inject `task_finish` only when the session is a child agent diff --git a/docs/AGENT_TYPES_DESIGN_CN.md b/docs/AGENT_TYPES_DESIGN_CN.md index 6abc178..9d78a5d 100644 --- a/docs/AGENT_TYPES_DESIGN_CN.md +++ b/docs/AGENT_TYPES_DESIGN_CN.md @@ -313,7 +313,7 @@ HTTP 路径: 这两条路径都会: - 拒绝 `agentType` 缺失的 agent -- 调用 `createToolSetForAgent(agentType, uuid, parent_agent_id)` +- 调用 `createToolSetForAgent({ agentType, agentId: uuid, parentAgentId: parent_agent_id, enabledMcpTools })` - 通过 registry 解析角色的 tool sets - 仅在 child agent 的情况下运行时注入 `task_finish` diff --git a/docs/tool-rename-plan.md b/docs/tool-rename-plan.md deleted file mode 100644 index c3b57fd..0000000 --- a/docs/tool-rename-plan.md +++ /dev/null @@ -1,146 +0,0 @@ -# 工具改名与合并实施计划 - -> 本文档是工具改名/合并工程的**唯一权威设计依据**。所有参与实施的子 agent 必须以本文档为准。 -> 本文档只描述**目标状态、行为契约、影响范围、验收标准**,不规定具体实现方式——实现细节由实施者自主设计。 - -## 1. 背景与动机 - -当前工具命名存在三类问题: - -1. **冗长且动词错位**:`read_file`/`create_or_replace`/`edit_file_search_replace` 等名字冗长;`read_partial_around_keyword` 名字描述的是实现机制(read partial)而非调用者意图(search in file),已导致多次模型误调度。 -2. **人为制造决策点**:`search_file_contains_keyword`(仅目录)与 `read_partial_around_keyword`(仅文件)的能力本是一体(grep 对文件和目录通吃),拆成两个工具凭空制造了"文件还是目录"的分类决策,且错误处理存在缺陷(裸 catch 将参数错误谎报为"用户终止",Phase 0 已修复 `search_fs.ts` 中的两处)。 -3. **能力割裂**:`ls` 与 `get_file_size` 同属文件系统元信息查询,拆开导致模型需要两次调用才能获得目录项的大小信息。 - -本项目为单人使用,**不做 alias 兼容层**,旧 API 直接废弃。 - -## 2. 目标命名总表 - -| 旧名 | 新名 | 变更类型 | -|---|---|---| -| `read_file` | `read` | 纯改名 | -| `create_or_replace` | `write` | 纯改名 | -| `edit_file_search_replace` | `edit` | 纯改名 | -| `ls` + `get_file_size` | `glob` | **合并**(语义扩展) | -| `search_file_contains_keyword` + `read_partial_around_keyword` | `grep` | **合并**(语义扩展) | -| `search_file_name_includes` | `find_filename` | 纯改名 | -| `get_warning_error` | `diagnostics` | 纯改名 | -| `read_partial_by_range` | `read_partial` | 纯改名 | - -**未列入上表的工具一律不改名**(`shell`, `get_env_var`, `system_info`, `mkdir`, `project_outline`, `inspect_shell_task`, `kill_shell_task`, `dispatch_subagents`, `task_finish`, `get_agent_types`, `query_codebase`)。 - -> 命名说明:`glob` 一词在此处的语义是"文件系统条目枚举与元信息查询"(文件则报大小,目录则列条目),不是"按模式匹配"(那是 `find_filename` 的职责)。实施者若认为实现后有更贴切的命名,可提出但需在交付说明中显式声明并全量一致替换。 - -## 3. 合并工具的行为契约 - -### 3.1 `grep`(合并 `search_file_contains_keyword` + `read_partial_around_keyword`) - -**核心语义**:在文件或目录中搜索关键词。`uri` 参数同时接受文件和目录,由工具内部自行区分,调用方无需关心。 - -**必须满足的行为要求**: - -1. **路径类型自适配**:对 `uri` 做 stat(或等价判断),目录走递归搜索,文件走单文件搜索。路径不存在时返回明确的错误消息(不得谎报为"用户终止")。 -2. **目录模式**:保持现有 `search_file_contains_keyword` 的能力与防护——忽略 `COMMON_IGNORE_GLOBS`、结果文件数上限、跳过二进制文件、超长行截断。输出格式为 `path:line:content`。 -3. **文件模式**:保持现有 `read_partial_around_keyword` 的能力——支持上下文行(`lines_before`/`lines_after`),合并重叠上下文区域,不相交区域之间用 `...` 分隔。两个上下文参数改为**可选,默认 0**(现状是必填,迫使模型每次传 `0,0`,属于 schema 缺陷)。建议输出同样带 `path:line:content` 前缀以与目录模式统一(实施者可自行权衡)。 -4. **错误诚实**:仅在 `abortSignal` 真实中止时返回 `[Interrupted]` 类消息;其他任何异常(路径错误、权限错误、编码错误等)必须返回真实错误信息。`search_fs.ts` 中 Phase 0 建立的模式(catch 中先判 `abortSignal.aborted`)是必须保持的底线。 -5. **参数命名**:`uri` 与 `keyword` 保持不变(全项目工具参数风格一致)。 -6. **description 文本**:必须明确写出"同时接受文件和目录"以及输出格式,这是防止误调度的关键文案。 - -### 3.2 `glob`(合并 `ls` + `get_file_size`) - -**核心语义**:查询文件系统条目的元信息。`uri` 参数同时接受文件和目录。 - -**必须满足的行为要求**: - -1. **路径类型自适配**:文件返回大小信息;目录返回条目列表。 -2. **目录模式**:保持现有 `ls` 的排序与类型标注能力,并**为每个条目附加大小信息**;在 POSIX 系统上再追加权限标志位(如 `drwxr-xr-x`)。Windows 上不显示权限位。 -3. **文件模式**:保持现有 `get_file_size` 的输出语义(KB + bytes)。 -4. **目录不存在或为空**:返回明确、友好的消息。 -5. **description 文本**:明确写出"文件则返回大小,目录则列出条目(含大小,POSIX 含权限位)",并保留原 `get_file_size` 中"读/写文件前先查大小以决定读取策略"的提示语义。 - -### 3.3 纯改名工具的要求 - -`read` / `write` / `edit` / `find_filename` / `diagnostics` / `read_partial`: - -- `ITool.name` 与 `definition.function.name` 同时改为新名,二者必须始终一致(LLM 看到的是 `definition.function.name`)。 -- `execute` 行为**完全不变**。 -- `prettyPrint` 文案保持不变(文案中不含工具名,无需改)。 -- 错误消息、中断消息中硬编码的旧工具名(若有)必须同步更新。 - -## 4. 影响范围清单(必须全部覆盖) - -以下位置经全仓库逐一排查确认,**每一处都必须改到**。实施完成后须按第 5 节的验证方法复查。 - -### 4.1 工具定义与注册(TypeScript 源码) - -| 文件 | 需要改的内容 | -|---|---| -| `src/tools.d/tools/read_file.ts` | `name` ×2(`ITool.name` + `definition.function.name`) | -| `src/tools.d/tools/create_or_replace.ts` | `name` ×2;`handleEdit(..., 'create_or_replace')` 内部调用中的工具名字符串(该字符串会进入编辑事务状态与中断消息) | -| `src/tools.d/tools/edit_file_search_replace.ts` | `name` ×2;`handleEdit(..., 'edit_file_search_replace')` 内部调用中的工具名字符串 | -| `src/tools.d/tools/ls.ts` | 整个工具并入 `glob`(文件可重命名或合并到 `system_info.ts`,由实施者决定) | -| `src/tools.d/tools/system_info.ts` | `getFileSizeTool` 并入 `glob`;**`systemInfoTool` 与 `getEnvVarTool` 保留不动** | -| `src/tools.d/tools/search_fs.ts` | 整个文件重构为 `grep`(文件可重命名为 `grep.ts`,由实施者决定);`searchFileNameIncludesTool` 改名为 `find_filename`(保留在原文件或独立成文件均可) | -| `src/tools.d/tools/read_partial.ts` | `readPartialByRangeTool` 改名为 `read_partial`;`readPartialAroundKeywordTool` 并入 `grep` 后从此文件移除 | -| `src/tools.d/tools/get_warning_error.ts` | `name` ×2 | -| `src/tools.d/toolManager.ts` | `TOOL_NAME_MAPPING` 中所有旧名键替换为新名;被合并移除的工具(`readPartialAroundKeywordTool`、`searchFileContainsKeywordTool`、`lsTool`、`getFileSizeTool`)的 import、`TOOL_NAME_MAPPING` 条目、`commonTools` 数组条目全部移除或替换;`getWarningErrorTool` 等 import 保持不变 | -| `src/tools.d/edit_file.ts` | `handleEdit`/`requestEdit` 的 `toolName` 默认值 `"edit_file"` —— 评估是否随新名更新(该默认值仅在调用方未传名时使用;目前两个调用方都显式传名) | - -### 4.2 默认配置 - -| 文件 | 需要改的内容 | -|---|---| -| `src/config/types.ts` | `DEFAULT_MUTSUMI_CONFIG.toolSets` 中所有旧名替换为新名(`read` 工具集 11 处、`deliver` 工具集 2 处) | - -### 4.3 LLM 提示词与规则资产 - -| 文件 | 需要改的内容 | -|---|---| -| `assets/default/write_file.md` | 第 3 行 `edit_file_search_replace` → `edit`;第 5 行 `create_or_replace` → `write`。**此文件还会被 `assets/default/implementer.md` 通过 `@[...]` 引用,内容会直接进入 implementer agent 的系统提示** | -| `src/contextManagement/skillManager.ts` | 第 297 行与第 323 行的指令文本 `"Immediately read_file the skill's SKILL.md ..."` 中的 `read_file` → `read`(JSDoc 注释与运行时字符串各一处) | - -### 4.4 面向用户的文档与配置示例 - -| 文件 | 需要改的内容 | -|---|---| -| `package.json` | `mutsumi.agentConfig` 的 `markdownDescription` 内嵌示例 JSON 中的 `"read": ["read_file", "ls"]` 与 `"deliver": ["shell", "create_or_replace"]` | -| `README.md` | 第 277–281 行内置工具清单:改为新名。**注意现有清单中 `edit_file`、`create_file`、`get_available_models` 三个名字本来就不存在,属于历史遗留错误,本次顺手修正为真实工具名** | -| `README_zh.md` | 同上(第 277–281 行) | -| `docs/AGENT_TYPES_DESIGN.md` | 第 165–188 行 toolSets 示例中全部旧名 | -| `docs/AGENT_TYPES_DESIGN_CN.md` | 同上 | - -### 4.5 代码注释 - -| 文件 | 需要改的内容 | -|---|---| -| `src/tools.d/tools/rag.ts` | 第 16–18 行注释中的 `read_file` → `read`、`ls` → `glob`、`search_file_contains_keyword` → `grep` | -| `src/notebook/renderTypes.ts` | 第 26 行注释 `/** Tool name (e.g. 'read_file') */` 中的示例名 | - -### 4.6 历史文档(明确保留不改) - -- `docs/CHANGES_IN_TOOL_SYSTEM_CN.md`:其中的 `edit_file_*` 是历史描述,属于当时状态的记录,不改。 -- 旧的 `.mtm` 会话文件:重开时旧工具名的 `prettyPrint` 会退化为 `"Tool Call: <旧名>"`、`renderingConfig` 缺失导致代码块降级为列表。**已知且可接受**(单人项目),不做迁移。 - -## 5. 验收标准 - -实施完成后必须逐项验证: - -1. **编译通过**:`npm run compile`(含 `tsc --noEmit`、`tsc --noEmit -p tsconfig.renderer.json`、esbuild)全部退出码 0。 -2. **旧名清零**:用全仓库搜索确认以下字符串在**除 `docs/CHANGES_IN_TOOL_SYSTEM_CN.md` 与本文档之外**的任何文件中不再出现: - `read_file`、`create_or_replace`、`edit_file_search_replace`、`read_partial_around_keyword`、`read_partial_by_range`、`search_file_contains_keyword`、`search_file_name_includes`、`get_file_size`、`get_warning_error` - (`read_file` 需注意排除 `handleEdit`/`edit_file.ts` 中的 `edit_file` 子串误判;搜索时用语义判断而非机械匹配。) -3. **新名全量出现**:`read`、`write`、`edit`、`grep`、`glob`、`find_filename`、`diagnostics`、`read_partial` 在工具定义、注册表、默认配置三处同时存在且拼写一致。 -4. **行为抽查**:`grep` 对文件和目录各搜一次;`glob` 对文件和目录各查一次;`edit`/`write`/`read` 各调用一次。 -5. **无 alias 残留**:不存在任何旧名→新名的映射代码。 - -## 6. 分工 - -| 子任务 | 负责范围 | 允许修改的 URI | -|---|---|---| -| **A:核心工具层** | 第 4.1 节全部 + 第 4.2 节 | `src/tools.d/`、`src/config/types.ts` | -| **B:提示词与文档层** | 第 4.3、4.4、4.5 节 | `assets/default/write_file.md`、`src/contextManagement/skillManager.ts`、`package.json`、`README.md`、`README_zh.md`、`docs/AGENT_TYPES_DESIGN.md`、`docs/AGENT_TYPES_DESIGN_CN.md`、`src/notebook/renderTypes.ts` | - -两个子任务**文件集合互不重叠**,可并行执行。两边都以第 2 节的命名总表为唯一命名依据,不得自行发明新名。 - -## 7. 已完成的前置工作(Phase 0) - -`src/tools.d/tools/search_fs.ts` 中两处裸 `catch` 已修复:异常时先检查 `abortSignal.aborted`,仅在真实中止时返回 `[Interrupted]` 消息,否则返回真实错误信息。实施 `grep` 合并时必须保留这一模式。 diff --git a/package-lock.json b/package-lock.json index 2f43267..e839e5c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -24,10 +24,8 @@ "@types/node-notifier": "^8.0.5", "@types/uuid": "^9.0.8", "@types/vscode": "^1.108.1", - "body-parser": "^2.2.2", "diff": "^8.0.3", "electron": "^39.0.0", - "electron-rebuild": "^3.2.9", "esbuild": "^0.25.0", "express": "^5.2.1", "gray-matter": "^4.0.3", @@ -37,7 +35,6 @@ "micromark": "^4.0.0", "micromark-extension-gfm": "^2.0.0", "npm-run-all": "^4.1.5", - "partial-json": "^0.1.7", "preprocess": "^3.2.0", "typescript": "^5.9.3", "uuid": "^9.0.1", @@ -1514,12 +1511,6 @@ "node": ">=18" } }, - "node_modules/@gar/promisify": { - "version": "1.1.3", - "integrity": "sha512-k2Ty1JcVojjJFwrg/ThKi2ujJ7XNLYaFGNB/bWT9wGR+oSMJHMa5w+CUq6p/pVrKeNNgA7pCqEcjSnHVoqJQFw==", - "dev": true, - "license": "MIT" - }, "node_modules/@google/genai": { "version": "1.52.0", "integrity": "sha512-gwSvbpiN/17O9TbsqSsE/OzZcpv5Fo4RQjdngGgogtuB9RsyJ8ZHhX5KjHj1bp5N9snN2eK8LDGXSaWW2hof8Q==", @@ -1803,33 +1794,6 @@ "node": ">= 14" } }, - "node_modules/@npmcli/fs": { - "version": "2.1.2", - "integrity": "sha512-yOJKRvohFOaLqipNtwYB9WugyZKhC/DZC4VYPmpaCzDBrA8YpK3qHZ8/HGscMnE4GqbkLNuVcCnxkeQEdGt6LQ==", - "dev": true, - "license": "ISC", - "dependencies": { - "@gar/promisify": "^1.1.3", - "semver": "^7.3.5" - }, - "engines": { - "node": "^12.13.0 || ^14.15.0 || >=16.0.0" - } - }, - "node_modules/@npmcli/move-file": { - "version": "2.0.1", - "integrity": "sha512-mJd2Z5TjYWq/ttPLLGqArdtnC74J6bOzg4rMDnN+p1xTacZ2yPRCk2y0oSWQtygLR9YVQXgOcONrwtnk3JupxQ==", - "deprecated": "This functionality has been moved to @npmcli/fs", - "dev": true, - "license": "MIT", - "dependencies": { - "mkdirp": "^1.0.4", - "rimraf": "^3.0.2" - }, - "engines": { - "node": "^12.13.0 || ^14.15.0 || >=16.0.0" - } - }, "node_modules/@opentelemetry/api": { "version": "1.9.0", "integrity": "sha512-3giAOQvZiH5F9bMlMiv8+GSPMeqg0dbaeo58/0SlA9sxSqZhnUtxzX9/2FzyhS9sWQf5S0GJE0AKBrFqjpeYcg==", @@ -2422,15 +2386,6 @@ "node": ">=10" } }, - "node_modules/@tootallnate/once": { - "version": "2.0.0", - "integrity": "sha512-XCuKFP5PS55gnMVu3dty8KPatLqUoy/ZYzDzAGCQ8JNFCkLXzmI7vNHCR+XpbZaMWQK/vQubr7PkYq8g470J/A==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 10" - } - }, "node_modules/@types/better-sqlite3": { "version": "7.6.13", "integrity": "sha512-NMv9ASNARoKksWtsq/SHakpYAYnhBrQgGD8zkLYk/jaK8jUGn08CfEdTRgYhMypUQAfzSP8W6gNLe0q19/t4VA==", @@ -2760,12 +2715,6 @@ "url": "https://opencollective.com/vitest" } }, - "node_modules/abbrev": { - "version": "1.1.1", - "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==", - "dev": true, - "license": "ISC" - }, "node_modules/accepts": { "version": "2.0.0", "integrity": "sha512-5cvg6CtKwfgdmVqY1WIiXKc3Q1bkRqGLi+2W/6ao+6Y7gu/RCwRuAhGEzh5B4KlszSuTLgZYuqFqo5bImjNKng==", @@ -2779,43 +2728,6 @@ "node": ">= 0.6" } }, - "node_modules/agent-base": { - "version": "6.0.2", - "integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "debug": "4" - }, - "engines": { - "node": ">= 6.0.0" - } - }, - "node_modules/agentkeepalive": { - "version": "4.6.0", - "integrity": "sha512-kja8j7PjmncONqaTsB8fQ+wE2mSU2DJ9D4XKoJ5PFWIdRMa6SLSN1ff4mOr4jCbfRSsxR4keIiySJU0N9T5hIQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "humanize-ms": "^1.2.1" - }, - "engines": { - "node": ">= 8.0.0" - } - }, - "node_modules/aggregate-error": { - "version": "3.1.0", - "integrity": "sha512-4I7Td01quW/RpocfNayFdFVk1qSuoh0E7JrbRJ16nH01HhKFQ88INq9Sd+nd72zqRySlr9BmDA8xlEJ6vJMrYA==", - "dev": true, - "license": "MIT", - "dependencies": { - "clean-stack": "^2.0.0", - "indent-string": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, "node_modules/ajv": { "version": "8.20.0", "integrity": "sha512-Thbli+OlOj+iMPYFBVBfJ3OmCAnaSyNn4M1vz9T6Gka5Jt9ba/HIR56joy65tY6kx/FCF5VXNB819Y7/GUrBGA==", @@ -2873,26 +2785,6 @@ "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, - "node_modules/aproba": { - "version": "2.1.0", - "integrity": "sha512-tLIEcj5GuR2RSTnxNKdkK0dJ/GrC7P38sUkiDmDuHfsHmbagTFAxDVIBltoklXEVIQ/f14IL8IMJ5pn9Hez1Ew==", - "dev": true, - "license": "ISC" - }, - "node_modules/are-we-there-yet": { - "version": "3.0.1", - "integrity": "sha512-QZW4EDmGwlYur0Yyf/b2uGucHQMa8aFUP7eu9ddR73vvhFyt4V0Vl3QHPcTNJ8l6qYOBdxgXdnBXQrHilfRQBg==", - "deprecated": "This package is no longer supported.", - "dev": true, - "license": "ISC", - "dependencies": { - "delegates": "^1.0.0", - "readable-stream": "^3.6.0" - }, - "engines": { - "node": "^12.13.0 || ^14.15.0 || >=16.0.0" - } - }, "node_modules/argparse": { "version": "1.0.10", "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", @@ -3157,142 +3049,6 @@ "node": ">=8" } }, - "node_modules/cacache": { - "version": "16.1.3", - "integrity": "sha512-/+Emcj9DAXxX4cwlLmRI9c166RuL3w30zp4R7Joiv2cQTtTtA+jeuCAjH3ZlGnYS3tKENSrKhAzVVP9GVyzeYQ==", - "dev": true, - "license": "ISC", - "dependencies": { - "@npmcli/fs": "^2.1.0", - "@npmcli/move-file": "^2.0.0", - "chownr": "^2.0.0", - "fs-minipass": "^2.1.0", - "glob": "^8.0.1", - "infer-owner": "^1.0.4", - "lru-cache": "^7.7.1", - "minipass": "^3.1.6", - "minipass-collect": "^1.0.2", - "minipass-flush": "^1.0.5", - "minipass-pipeline": "^1.2.4", - "mkdirp": "^1.0.4", - "p-map": "^4.0.0", - "promise-inflight": "^1.0.1", - "rimraf": "^3.0.2", - "ssri": "^9.0.0", - "tar": "^6.1.11", - "unique-filename": "^2.0.0" - }, - "engines": { - "node": "^12.13.0 || ^14.15.0 || >=16.0.0" - } - }, - "node_modules/cacache/node_modules/brace-expansion": { - "version": "2.0.2", - "integrity": "sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "balanced-match": "^1.0.0" - } - }, - "node_modules/cacache/node_modules/chownr": { - "version": "2.0.0", - "integrity": "sha512-bIomtDF5KGpdogkLd9VspvFzk9KfpyyGlS8YFVZl7TGPBHL5snIOnxeshwVgPteQ9b4Eydl+pVbIyE1DcvCWgQ==", - "dev": true, - "license": "ISC", - "engines": { - "node": ">=10" - } - }, - "node_modules/cacache/node_modules/glob": { - "version": "8.1.0", - "integrity": "sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ==", - "deprecated": "Glob versions prior to v9 are no longer supported", - "dev": true, - "license": "ISC", - "dependencies": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^5.0.1", - "once": "^1.3.0" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/cacache/node_modules/minimatch": { - "version": "5.1.9", - "integrity": "sha512-7o1wEA2RyMP7Iu7GNba9vc0RWWGACJOCZBJX2GJWip0ikV+wcOsgVuY9uE8CPiyQhkGFSlhuSkZPavN7u1c2Fw==", - "dev": true, - "license": "ISC", - "dependencies": { - "brace-expansion": "^2.0.1" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/cacache/node_modules/minipass": { - "version": "3.3.6", - "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==", - "dev": true, - "license": "ISC", - "dependencies": { - "yallist": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/cacache/node_modules/minizlib": { - "version": "2.1.2", - "integrity": "sha512-bAxsR8BVfj60DWXHE3u30oHzfl4G7khkSuPW+qvpd7jFRHm7dLxOjUk1EHACJ/hxLY8phGJ0YhYHZo7jil7Qdg==", - "dev": true, - "license": "MIT", - "dependencies": { - "minipass": "^3.0.0", - "yallist": "^4.0.0" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/cacache/node_modules/tar": { - "version": "6.2.1", - "integrity": "sha512-DZ4yORTwrbTj/7MZYq2w+/ZFdI6OZ/f9SFHR+71gIVUZhOQPHzVCLpvRnPgyaMpfWxxk/4ONva3GQSyNIKRv6A==", - "dev": true, - "license": "ISC", - "dependencies": { - "chownr": "^2.0.0", - "fs-minipass": "^2.0.0", - "minipass": "^5.0.0", - "minizlib": "^2.1.1", - "mkdirp": "^1.0.3", - "yallist": "^4.0.0" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/cacache/node_modules/tar/node_modules/minipass": { - "version": "5.0.0", - "integrity": "sha512-3FnjYuehv9k6ovOEbyOswadCDPX1piCfhV8ncmYtHOjuPwylVWsghTLo7rabjC3Rx5xD4HDx8Wm1xnMF7S5qFQ==", - "dev": true, - "license": "ISC", - "engines": { - "node": ">=8" - } - }, - "node_modules/cacache/node_modules/yallist": { - "version": "4.0.0", - "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", - "dev": true, - "license": "ISC" - }, "node_modules/cacheable-lookup": { "version": "5.0.4", "integrity": "sha512-2/kNscPhpcxrOigMZzbiWF7dz8ilhb/nIHU3EyZiXWXpeq/au8qJ8VhdftMkty3n7Gj6HIGalQG8oiBNB3AJgA==", @@ -3512,15 +3268,6 @@ "node": ">=18" } }, - "node_modules/clean-stack": { - "version": "2.2.0", - "integrity": "sha512-4diC9HaTE+KRAMWhDhrGOECgWZxoevMc5TlkObMqNSsVU62PYzXZ/SMTjzyGAFF1YusgxGcSWTEXBhp0CPwQ1A==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6" - } - }, "node_modules/cli-spinners": { "version": "2.9.2", "integrity": "sha512-ywqV+5MmyL4E7ybXgKys4DugZbX0FC6LnwrhjuykIjnK9k8OQacQ7axGKnjDXWNhns0xot3bZI5h55H8yo9cJg==", @@ -3639,15 +3386,6 @@ "dev": true, "license": "MIT" }, - "node_modules/color-support": { - "version": "1.1.3", - "integrity": "sha512-qiBjkpbMLO/HL68y+lh4q0/O1MZFj2RX6X/KmMa3+gJD3z+WwI1ZzDHysvqHGS3mP6mznPckpXmw1nI9cJjyRg==", - "dev": true, - "license": "ISC", - "bin": { - "color-support": "bin.js" - } - }, "node_modules/comma-separated-tokens": { "version": "2.0.3", "integrity": "sha512-Fu4hJdvzeylCfQPp9SGWidpzrMs7tTrlu6Vb8XGaRGck8QSNZJJp538Wrb60Lax4fPwR64ViY468OIUTbRlGZg==", @@ -3664,12 +3402,6 @@ "dev": true, "license": "MIT" }, - "node_modules/console-control-strings": { - "version": "1.1.0", - "integrity": "sha512-ty/fTekppD2fIwRvnZAVdeOiGd1c7YXEixbgJTNzqcxJWKQnjJ/V1bNEEE6hygpM3WjwHFUVK6HTjWSzV4a8sQ==", - "dev": true, - "license": "ISC" - }, "node_modules/content-disposition": { "version": "1.0.1", "integrity": "sha512-oIXISMynqSqm241k6kcQ5UwttDILMK4BiurCfGEREw6+X9jkkpEe5T9FZaApyLGGOnFuyMWZpdolTXMtvEJ08Q==", @@ -3932,12 +3664,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/delegates": { - "version": "1.0.0", - "integrity": "sha512-bd2L678uiWATM6m5Z1VzNCErI3jiGzt6HGY8OVICs40JQq/HALfbyNJmp0UDakEY4pMMaN0Ly5om/B1VI/+xfQ==", - "dev": true, - "license": "MIT" - }, "node_modules/depd": { "version": "2.0.0", "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==", @@ -4046,267 +3772,6 @@ "node": ">= 12.20.55" } }, - "node_modules/electron-rebuild": { - "version": "3.2.9", - "integrity": "sha512-FkEZNFViUem3P0RLYbZkUjC8LUFIK+wKq09GHoOITSJjfDAVQv964hwaNseTTWt58sITQX3/5fHNYcTefqaCWw==", - "deprecated": "Please use @electron/rebuild moving forward. There is no API change, just a package name change", - "dev": true, - "license": "MIT", - "dependencies": { - "@malept/cross-spawn-promise": "^2.0.0", - "chalk": "^4.0.0", - "debug": "^4.1.1", - "detect-libc": "^2.0.1", - "fs-extra": "^10.0.0", - "got": "^11.7.0", - "lzma-native": "^8.0.5", - "node-abi": "^3.0.0", - "node-api-version": "^0.1.4", - "node-gyp": "^9.0.0", - "ora": "^5.1.0", - "semver": "^7.3.5", - "tar": "^6.0.5", - "yargs": "^17.0.1" - }, - "bin": { - "electron-rebuild": "lib/src/cli.js" - }, - "engines": { - "node": ">=12.13.0" - } - }, - "node_modules/electron-rebuild/node_modules/ansi-regex": { - "version": "5.0.1", - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/electron-rebuild/node_modules/ansi-styles": { - "version": "4.3.0", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "license": "MIT", - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/electron-rebuild/node_modules/chalk": { - "version": "4.1.2", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" - } - }, - "node_modules/electron-rebuild/node_modules/chownr": { - "version": "2.0.0", - "integrity": "sha512-bIomtDF5KGpdogkLd9VspvFzk9KfpyyGlS8YFVZl7TGPBHL5snIOnxeshwVgPteQ9b4Eydl+pVbIyE1DcvCWgQ==", - "dev": true, - "license": "ISC", - "engines": { - "node": ">=10" - } - }, - "node_modules/electron-rebuild/node_modules/cli-cursor": { - "version": "3.1.0", - "integrity": "sha512-I/zHAwsKf9FqGoXM4WWRACob9+SNukZTd94DWF57E4toouRulbCxcUh6RKUEOQlYTHJnzkPMySvPNaaSLNfLZw==", - "dev": true, - "license": "MIT", - "dependencies": { - "restore-cursor": "^3.1.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/electron-rebuild/node_modules/fs-extra": { - "version": "10.1.0", - "integrity": "sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "graceful-fs": "^4.2.0", - "jsonfile": "^6.0.1", - "universalify": "^2.0.0" - }, - "engines": { - "node": ">=12" - } - }, - "node_modules/electron-rebuild/node_modules/is-interactive": { - "version": "1.0.0", - "integrity": "sha512-2HvIEKRoqS62guEC+qBjpvRubdX910WCMuJTZ+I9yvqKU2/12eSL549HMwtabb4oupdj2sMP50k+XJfB/8JE6w==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/electron-rebuild/node_modules/is-unicode-supported": { - "version": "0.1.0", - "integrity": "sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/electron-rebuild/node_modules/log-symbols": { - "version": "4.1.0", - "integrity": "sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg==", - "dev": true, - "license": "MIT", - "dependencies": { - "chalk": "^4.1.0", - "is-unicode-supported": "^0.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/electron-rebuild/node_modules/minipass": { - "version": "5.0.0", - "integrity": "sha512-3FnjYuehv9k6ovOEbyOswadCDPX1piCfhV8ncmYtHOjuPwylVWsghTLo7rabjC3Rx5xD4HDx8Wm1xnMF7S5qFQ==", - "dev": true, - "license": "ISC", - "engines": { - "node": ">=8" - } - }, - "node_modules/electron-rebuild/node_modules/minizlib": { - "version": "2.1.2", - "integrity": "sha512-bAxsR8BVfj60DWXHE3u30oHzfl4G7khkSuPW+qvpd7jFRHm7dLxOjUk1EHACJ/hxLY8phGJ0YhYHZo7jil7Qdg==", - "dev": true, - "license": "MIT", - "dependencies": { - "minipass": "^3.0.0", - "yallist": "^4.0.0" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/electron-rebuild/node_modules/minizlib/node_modules/minipass": { - "version": "3.3.6", - "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==", - "dev": true, - "license": "ISC", - "dependencies": { - "yallist": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/electron-rebuild/node_modules/onetime": { - "version": "5.1.2", - "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", - "dev": true, - "license": "MIT", - "dependencies": { - "mimic-fn": "^2.1.0" - }, - "engines": { - "node": ">=6" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/electron-rebuild/node_modules/ora": { - "version": "5.4.1", - "integrity": "sha512-5b6Y85tPxZZ7QytO+BQzysW31HJku27cRIlkbAXaNx+BdcVi+LlRFmVXzeF6a7JCwJpyw5c4b+YSVImQIrBpuQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "bl": "^4.1.0", - "chalk": "^4.1.0", - "cli-cursor": "^3.1.0", - "cli-spinners": "^2.5.0", - "is-interactive": "^1.0.0", - "is-unicode-supported": "^0.1.0", - "log-symbols": "^4.1.0", - "strip-ansi": "^6.0.0", - "wcwidth": "^1.0.1" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/electron-rebuild/node_modules/restore-cursor": { - "version": "3.1.0", - "integrity": "sha512-l+sSefzHpj5qimhFSE5a8nufZYAM3sBSVMAPtYkmC+4EH2anSGaEMXSD0izRQbu9nfyQ9y5JrVmp7E8oZrUjvA==", - "dev": true, - "license": "MIT", - "dependencies": { - "onetime": "^5.1.0", - "signal-exit": "^3.0.2" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/electron-rebuild/node_modules/strip-ansi": { - "version": "6.0.1", - "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-regex": "^5.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/electron-rebuild/node_modules/tar": { - "version": "6.2.1", - "integrity": "sha512-DZ4yORTwrbTj/7MZYq2w+/ZFdI6OZ/f9SFHR+71gIVUZhOQPHzVCLpvRnPgyaMpfWxxk/4ONva3GQSyNIKRv6A==", - "dev": true, - "license": "ISC", - "dependencies": { - "chownr": "^2.0.0", - "fs-minipass": "^2.0.0", - "minipass": "^5.0.0", - "minizlib": "^2.1.1", - "mkdirp": "^1.0.3", - "yallist": "^4.0.0" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/electron-rebuild/node_modules/yallist": { - "version": "4.0.0", - "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", - "dev": true, - "license": "ISC" - }, "node_modules/emoji-regex": { "version": "8.0.0", "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", @@ -4907,60 +4372,24 @@ "version": "0.2.0", "integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==", "dev": true, - "license": "MIT", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/fresh": { - "version": "2.0.0", - "integrity": "sha512-Rx/WycZ60HOaqLKAi6cHRKKI7zxWbJ31MhntmtwMoaTeF7XFH9hhBp8vITaMidfljRQ6eYWCKkaTK+ykVJHP2A==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/fs-constants": { - "version": "1.0.0", - "integrity": "sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==", - "license": "MIT" - }, - "node_modules/fs-minipass": { - "version": "2.1.0", - "integrity": "sha512-V/JgOLFCS+R6Vcq0slCuaeWEdNC3ouDlJMNIsacH2VtALiu9mV4LPrHc5cDl8k5aw6J8jwgWWpiTo5RYhmIzvg==", - "dev": true, - "license": "ISC", - "dependencies": { - "minipass": "^3.0.0" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/fs-minipass/node_modules/minipass": { - "version": "3.3.6", - "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==", - "dev": true, - "license": "ISC", - "dependencies": { - "yallist": "^4.0.0" - }, + "license": "MIT", "engines": { - "node": ">=8" + "node": ">= 0.6" } }, - "node_modules/fs-minipass/node_modules/yallist": { - "version": "4.0.0", - "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "node_modules/fresh": { + "version": "2.0.0", + "integrity": "sha512-Rx/WycZ60HOaqLKAi6cHRKKI7zxWbJ31MhntmtwMoaTeF7XFH9hhBp8vITaMidfljRQ6eYWCKkaTK+ykVJHP2A==", "dev": true, - "license": "ISC" + "license": "MIT", + "engines": { + "node": ">= 0.8" + } }, - "node_modules/fs.realpath": { + "node_modules/fs-constants": { "version": "1.0.0", - "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", - "dev": true, - "license": "ISC" + "integrity": "sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==", + "license": "MIT" }, "node_modules/fsevents": { "version": "2.3.3", @@ -5014,70 +4443,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/gauge": { - "version": "4.0.4", - "integrity": "sha512-f9m+BEN5jkg6a0fZjleidjN51VE1X+mPFQ2DJ0uv1V39oCLCbsGe6yjbBnp7eK7z/+GAon99a3nHuqbuuthyPg==", - "deprecated": "This package is no longer supported.", - "dev": true, - "license": "ISC", - "dependencies": { - "aproba": "^1.0.3 || ^2.0.0", - "color-support": "^1.1.3", - "console-control-strings": "^1.1.0", - "has-unicode": "^2.0.1", - "signal-exit": "^3.0.7", - "string-width": "^4.2.3", - "strip-ansi": "^6.0.1", - "wide-align": "^1.1.5" - }, - "engines": { - "node": "^12.13.0 || ^14.15.0 || >=16.0.0" - } - }, - "node_modules/gauge/node_modules/ansi-regex": { - "version": "5.0.1", - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/gauge/node_modules/is-fullwidth-code-point": { - "version": "3.0.0", - "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/gauge/node_modules/string-width": { - "version": "4.2.3", - "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", - "dev": true, - "license": "MIT", - "dependencies": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/gauge/node_modules/strip-ansi": { - "version": "6.0.1", - "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-regex": "^5.0.1" - }, - "engines": { - "node": ">=8" - } - }, "node_modules/gaxios": { "version": "7.3.1", "integrity": "sha512-kB3rzJV7d9juLZh8/56QTXCwQfxyhdOMdyYk1HdQKFtF8TJTDTZQJtixWIwXdE9Jji91mC41DUNpjleo4L4eAQ==", @@ -5220,27 +4585,6 @@ "integrity": "sha512-SyHy3T1v2NUXn29OsWdxmK6RwHD+vkj3v8en8AOBZ1wBQ/hCAQ5bAQTD02kW4W9tUp/3Qh6J8r9EvntiyCmOOw==", "license": "MIT" }, - "node_modules/glob": { - "version": "7.2.3", - "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", - "deprecated": "Glob versions prior to v9 are no longer supported", - "dev": true, - "license": "ISC", - "dependencies": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.1.1", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - }, - "engines": { - "node": "*" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, "node_modules/global-agent": { "version": "3.0.0", "integrity": "sha512-PT6XReJ+D07JvGoxQMkT6qji/jVNfX/h364XHZOWeRzy64sSFr+xJ5OX7LI3b4MPQzdL4H8Y8M0xzPpsVMwA8Q==", @@ -5439,12 +4783,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/has-unicode": { - "version": "2.0.1", - "integrity": "sha512-8Rf9Y83NBReMnx0gFzA8JImQACstCYWUplepDa9xprwwtmgEZUF0h/i5xSA625zB/I37EtrswSST6OXxwaaIJQ==", - "dev": true, - "license": "ISC" - }, "node_modules/hasown": { "version": "2.0.2", "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==", @@ -5553,20 +4891,6 @@ "url": "https://opencollective.com/express" } }, - "node_modules/http-proxy-agent": { - "version": "5.0.0", - "integrity": "sha512-n2hY8YdoRE1i7r6M0w9DIw5GgZN0G25P8zLCRQ8rjXtTU3vsNFBI/vWK/UIeE6g5MUUz6avwAPXmL6Fy9D/90w==", - "dev": true, - "license": "MIT", - "dependencies": { - "@tootallnate/once": "2", - "agent-base": "6", - "debug": "4" - }, - "engines": { - "node": ">= 6" - } - }, "node_modules/http2-wrapper": { "version": "1.0.3", "integrity": "sha512-V+23sDMr12Wnz7iTcDeJr3O6AIxlnvT/bmaAAAP/Xda35C90p9599p0F1eHR/N1KILWSoWVAiOMFjBBXaXSMxg==", @@ -5580,28 +4904,6 @@ "node": ">=10.19.0" } }, - "node_modules/https-proxy-agent": { - "version": "5.0.1", - "integrity": "sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==", - "dev": true, - "license": "MIT", - "dependencies": { - "agent-base": "6", - "debug": "4" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/humanize-ms": { - "version": "1.2.1", - "integrity": "sha512-Fl70vYtsAFb/C06PTS9dZBo7ihau+Tu/DNCk/OyHhea07S+aeMWpFFkUaXRa8fI+ScZbEI8dfSxwY7gxZ9SAVQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "ms": "^2.0.0" - } - }, "node_modules/iconv-lite": { "version": "0.6.3", "integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==", @@ -5642,32 +4944,6 @@ "node": ">=0.8.19" } }, - "node_modules/indent-string": { - "version": "4.0.0", - "integrity": "sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/infer-owner": { - "version": "1.0.4", - "integrity": "sha512-IClj+Xz94+d7irH5qRyfJonOdfTzuDaifE6ZPWfx0N0+/ATZCbuTPq2prFl526urkQd90WyUKIh1DfBQ2hMz9A==", - "dev": true, - "license": "ISC" - }, - "node_modules/inflight": { - "version": "1.0.6", - "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", - "deprecated": "This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.", - "dev": true, - "license": "ISC", - "dependencies": { - "once": "^1.3.0", - "wrappy": "1" - } - }, "node_modules/inherits": { "version": "2.0.4", "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", @@ -5900,12 +5176,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/is-lambda": { - "version": "1.0.1", - "integrity": "sha512-z7CMFGNrENq5iFB9Bqo64Xk6Y9sg+epq1myIcdHaGnbMTYOxvzsEtdYqQUylB7LxfkvgrrjP32T6Ywciio9UIQ==", - "dev": true, - "license": "MIT" - }, "node_modules/is-map": { "version": "2.0.3", "integrity": "sha512-1Qed0/Hr2m+YqxnM09CjA2d/i6YZNfF6R2oRAOj36eUdS6qIV/huPJNSEpKbupewFs+ZsJlxsjjPbc0/afW6Lw==", @@ -6206,18 +5476,6 @@ "license": "ISC", "optional": true }, - "node_modules/jsonfile": { - "version": "6.2.0", - "integrity": "sha512-FGuPw30AdOIUTRMC2OMRtQV+jkVj2cfPqSeWXv1NEAJ1qZ5zb1X6z1mFhbfOB/iy3ssJCD+3KuZ8r8C3uVFlAg==", - "dev": true, - "license": "MIT", - "dependencies": { - "universalify": "^2.0.0" - }, - "optionalDependencies": { - "graceful-fs": "^4.1.6" - } - }, "node_modules/jwa": { "version": "2.0.1", "integrity": "sha512-hRF04fqJIP8Abbkq5NKGN0Bbr3JxlQ+qhZufXVr0DvujKy93ZCbXZMHDL4EOtodSbCWxOqR8MS1tXA5hwqCXDg==", @@ -6317,39 +5575,6 @@ "url": "https://github.com/sponsors/wooorm" } }, - "node_modules/lru-cache": { - "version": "7.18.3", - "integrity": "sha512-jumlc0BIUrS3qJGgIkWZsyfAM7NCWiBcCDhnd+3NNM5KbBmLTgHVfWBcg6W+rLUsIpzpERPsvwUP7CckAQSOoA==", - "dev": true, - "license": "ISC", - "engines": { - "node": ">=12" - } - }, - "node_modules/lzma-native": { - "version": "8.0.6", - "integrity": "sha512-09xfg67mkL2Lz20PrrDeNYZxzeW7ADtpYFbwSQh9U8+76RIzx5QsJBMy8qikv3hbUPfpy6hqwxt6FcGK81g9AA==", - "dev": true, - "hasInstallScript": true, - "license": "MIT", - "dependencies": { - "node-addon-api": "^3.1.0", - "node-gyp-build": "^4.2.1", - "readable-stream": "^3.6.0" - }, - "bin": { - "lzmajs": "bin/lzmajs" - }, - "engines": { - "node": ">=10.0.0" - } - }, - "node_modules/lzma-native/node_modules/node-addon-api": { - "version": "3.2.1", - "integrity": "sha512-mmcei9JghVNDYydghQmeDX8KoAm0FAiYyIcUt/N4nhyAipB17pllZQDOJD2fotxABnt4Mdz+dKTO7eftLg4d0A==", - "dev": true, - "license": "MIT" - }, "node_modules/magic-string": { "version": "0.30.21", "integrity": "sha512-vd2F4YUyEXKGcLHoq+TEyCjxueSeHnFxyyjNp80yg0XV4vUhnDer/lvvlqM/arB5bXQN5K2/3oinyCRyx8T2CQ==", @@ -6359,60 +5584,6 @@ "@jridgewell/sourcemap-codec": "^1.5.5" } }, - "node_modules/make-fetch-happen": { - "version": "10.2.1", - "integrity": "sha512-NgOPbRiaQM10DYXvN3/hhGVI2M5MtITFryzBGxHM5p4wnFxsVCbxkrBrDsk+EZ5OB4jEOT7AjDxtdF+KVEFT7w==", - "dev": true, - "license": "ISC", - "dependencies": { - "agentkeepalive": "^4.2.1", - "cacache": "^16.1.0", - "http-cache-semantics": "^4.1.0", - "http-proxy-agent": "^5.0.0", - "https-proxy-agent": "^5.0.0", - "is-lambda": "^1.0.1", - "lru-cache": "^7.7.1", - "minipass": "^3.1.6", - "minipass-collect": "^1.0.2", - "minipass-fetch": "^2.0.3", - "minipass-flush": "^1.0.5", - "minipass-pipeline": "^1.2.4", - "negotiator": "^0.6.3", - "promise-retry": "^2.0.1", - "socks-proxy-agent": "^7.0.0", - "ssri": "^9.0.0" - }, - "engines": { - "node": "^12.13.0 || ^14.15.0 || >=16.0.0" - } - }, - "node_modules/make-fetch-happen/node_modules/minipass": { - "version": "3.3.6", - "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==", - "dev": true, - "license": "ISC", - "dependencies": { - "yallist": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/make-fetch-happen/node_modules/negotiator": { - "version": "0.6.4", - "integrity": "sha512-myRT3DiWPHqho5PrJaIRyaMv2kgYf0mUVgBNOYMuCH5Ki1yEiQaf/ZJuQ62nvpc44wL5WDbTX7yGJi1Neevw8w==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/make-fetch-happen/node_modules/yallist": { - "version": "4.0.0", - "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", - "dev": true, - "license": "ISC" - }, "node_modules/matcher": { "version": "3.0.0", "integrity": "sha512-OkeDaAZ/bQCxeFAozM55PKcKU0yJMPGifLwV4Qgjitu+5MoAfSQN4lsLJeXZ1b8w0x+/Emda6MZgXS1jvsapng==", @@ -7877,84 +7048,6 @@ "node": ">=16 || 14 >=14.17" } }, - "node_modules/minipass-collect": { - "version": "1.0.2", - "integrity": "sha512-6T6lH0H8OG9kITm/Jm6tdooIbogG9e0tLgpY6mphXSm/A9u8Nq1ryBG+Qspiub9LjWlBPsPS3tWQ/Botq4FdxA==", - "dev": true, - "license": "ISC", - "dependencies": { - "minipass": "^3.0.0" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/minipass-collect/node_modules/minipass": { - "version": "3.3.6", - "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==", - "dev": true, - "license": "ISC", - "dependencies": { - "yallist": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/minipass-collect/node_modules/yallist": { - "version": "4.0.0", - "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", - "dev": true, - "license": "ISC" - }, - "node_modules/minipass-fetch": { - "version": "2.1.2", - "integrity": "sha512-LT49Zi2/WMROHYoqGgdlQIZh8mLPZmOrN2NdJjMXxYe4nkN6FUyuPuOAOedNJDrx0IRGg9+4guZewtp8hE6TxA==", - "dev": true, - "license": "MIT", - "dependencies": { - "minipass": "^3.1.6", - "minipass-sized": "^1.0.3", - "minizlib": "^2.1.2" - }, - "engines": { - "node": "^12.13.0 || ^14.15.0 || >=16.0.0" - }, - "optionalDependencies": { - "encoding": "^0.1.13" - } - }, - "node_modules/minipass-fetch/node_modules/minipass": { - "version": "3.3.6", - "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==", - "dev": true, - "license": "ISC", - "dependencies": { - "yallist": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/minipass-fetch/node_modules/minizlib": { - "version": "2.1.2", - "integrity": "sha512-bAxsR8BVfj60DWXHE3u30oHzfl4G7khkSuPW+qvpd7jFRHm7dLxOjUk1EHACJ/hxLY8phGJ0YhYHZo7jil7Qdg==", - "dev": true, - "license": "MIT", - "dependencies": { - "minipass": "^3.0.0", - "yallist": "^4.0.0" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/minipass-fetch/node_modules/yallist": { - "version": "4.0.0", - "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", - "dev": true, - "license": "ISC" - }, "node_modules/minipass-flush": { "version": "1.0.5", "integrity": "sha512-JmQSYYpPUqX5Jyn1mXaRwOda1uQ8HP5KAT/oDSLCzt1BYRhQU0/hDtsB1ufZfEEzMZ9aAVmsBw8+FWsIXlClWw==", @@ -8057,18 +7150,6 @@ "node": ">= 18" } }, - "node_modules/mkdirp": { - "version": "1.0.4", - "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==", - "dev": true, - "license": "MIT", - "bin": { - "mkdirp": "bin/cmd.js" - }, - "engines": { - "node": ">=10" - } - }, "node_modules/mkdirp-classic": { "version": "0.5.3", "integrity": "sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A==", @@ -8138,15 +7219,6 @@ "node": ">=10" } }, - "node_modules/node-api-version": { - "version": "0.1.4", - "integrity": "sha512-KGXihXdUChwJAOHO53bv9/vXcLmdUsZ6jIptbvYvkpKfth+r7jw44JkVxQFA3kX5nQjzjmGu1uAu/xNNLNlI5g==", - "dev": true, - "license": "MIT", - "dependencies": { - "semver": "^7.3.5" - } - }, "node_modules/node-domexception": { "version": "1.0.0", "integrity": "sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ==", @@ -8185,123 +7257,6 @@ "url": "https://opencollective.com/node-fetch" } }, - "node_modules/node-gyp": { - "version": "9.4.1", - "integrity": "sha512-OQkWKbjQKbGkMf/xqI1jjy3oCTgMKJac58G2+bjZb3fza6gW2YrCSdMQYaoTb70crvE//Gngr4f0AgVHmqHvBQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "env-paths": "^2.2.0", - "exponential-backoff": "^3.1.1", - "glob": "^7.1.4", - "graceful-fs": "^4.2.6", - "make-fetch-happen": "^10.0.3", - "nopt": "^6.0.0", - "npmlog": "^6.0.0", - "rimraf": "^3.0.2", - "semver": "^7.3.5", - "tar": "^6.1.2", - "which": "^2.0.2" - }, - "bin": { - "node-gyp": "bin/node-gyp.js" - }, - "engines": { - "node": "^12.13 || ^14.13 || >=16" - } - }, - "node_modules/node-gyp-build": { - "version": "4.8.4", - "integrity": "sha512-LA4ZjwlnUblHVgq0oBF3Jl/6h/Nvs5fzBLwdEF4nuxnFdsfajde4WfxtJr3CaiH+F6ewcIB/q4jQ4UzPyid+CQ==", - "dev": true, - "license": "MIT", - "bin": { - "node-gyp-build": "bin.js", - "node-gyp-build-optional": "optional.js", - "node-gyp-build-test": "build-test.js" - } - }, - "node_modules/node-gyp/node_modules/chownr": { - "version": "2.0.0", - "integrity": "sha512-bIomtDF5KGpdogkLd9VspvFzk9KfpyyGlS8YFVZl7TGPBHL5snIOnxeshwVgPteQ9b4Eydl+pVbIyE1DcvCWgQ==", - "dev": true, - "license": "ISC", - "engines": { - "node": ">=10" - } - }, - "node_modules/node-gyp/node_modules/minipass": { - "version": "5.0.0", - "integrity": "sha512-3FnjYuehv9k6ovOEbyOswadCDPX1piCfhV8ncmYtHOjuPwylVWsghTLo7rabjC3Rx5xD4HDx8Wm1xnMF7S5qFQ==", - "dev": true, - "license": "ISC", - "engines": { - "node": ">=8" - } - }, - "node_modules/node-gyp/node_modules/minizlib": { - "version": "2.1.2", - "integrity": "sha512-bAxsR8BVfj60DWXHE3u30oHzfl4G7khkSuPW+qvpd7jFRHm7dLxOjUk1EHACJ/hxLY8phGJ0YhYHZo7jil7Qdg==", - "dev": true, - "license": "MIT", - "dependencies": { - "minipass": "^3.0.0", - "yallist": "^4.0.0" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/node-gyp/node_modules/minizlib/node_modules/minipass": { - "version": "3.3.6", - "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==", - "dev": true, - "license": "ISC", - "dependencies": { - "yallist": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/node-gyp/node_modules/tar": { - "version": "6.2.1", - "integrity": "sha512-DZ4yORTwrbTj/7MZYq2w+/ZFdI6OZ/f9SFHR+71gIVUZhOQPHzVCLpvRnPgyaMpfWxxk/4ONva3GQSyNIKRv6A==", - "dev": true, - "license": "ISC", - "dependencies": { - "chownr": "^2.0.0", - "fs-minipass": "^2.0.0", - "minipass": "^5.0.0", - "minizlib": "^2.1.1", - "mkdirp": "^1.0.3", - "yallist": "^4.0.0" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/node-gyp/node_modules/which": { - "version": "2.0.2", - "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", - "dev": true, - "license": "ISC", - "dependencies": { - "isexe": "^2.0.0" - }, - "bin": { - "node-which": "bin/node-which" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/node-gyp/node_modules/yallist": { - "version": "4.0.0", - "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", - "dev": true, - "license": "ISC" - }, "node_modules/node-notifier": { "version": "10.0.1", "integrity": "sha512-YX7TSyDukOZ0g+gmzjB6abKu+hTGvO8+8+gIFDsRCU2t8fLV/P2unmt+LGFaIa4y64aX98Qksa97rgz4vMNeLQ==", @@ -8338,21 +7293,6 @@ "node": ">= 8" } }, - "node_modules/nopt": { - "version": "6.0.0", - "integrity": "sha512-ZwLpbTgdhuZUnZzjd7nb1ZV+4DoiC6/sfiVKok72ym/4Tlf+DFdlHYmT2JPmcNNWV6Pi3SDf1kT+A4r9RTuT9g==", - "dev": true, - "license": "ISC", - "dependencies": { - "abbrev": "^1.0.0" - }, - "bin": { - "nopt": "bin/nopt.js" - }, - "engines": { - "node": "^12.13.0 || ^14.15.0 || >=16.0.0" - } - }, "node_modules/normalize-package-data": { "version": "2.5.0", "integrity": "sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA==", @@ -8493,22 +7433,6 @@ "node": ">=0.10.0" } }, - "node_modules/npmlog": { - "version": "6.0.2", - "integrity": "sha512-/vBvz5Jfr9dT/aFWd0FIRf+T/Q2WBsLENygUaFUqstqsycmZAP/t5BvFJTK0viFmSUxiUKTUplWy5vt+rvKIxg==", - "deprecated": "This package is no longer supported.", - "dev": true, - "license": "ISC", - "dependencies": { - "are-we-there-yet": "^3.0.0", - "console-control-strings": "^1.1.0", - "gauge": "^4.0.3", - "set-blocking": "^2.0.0" - }, - "engines": { - "node": "^12.13.0 || ^14.15.0 || >=16.0.0" - } - }, "node_modules/object-assign": { "version": "4.1.1", "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==", @@ -8626,21 +7550,6 @@ "node": ">=8" } }, - "node_modules/p-map": { - "version": "4.0.0", - "integrity": "sha512-/bjOqmgETBYB5BoEeGVea8dmvHb2m9GLy1E9W43yeyfP6QQCZGFNa+XRceJEuDB6zqr+gKpIAmlLebMpykw/MQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "aggregate-error": "^3.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/p-retry": { "version": "4.6.2", "integrity": "sha512-312Id396EbJdvRONlngUx0NydfrIQ5lsYu0znKVUzVvArzEIt08V1qhtyESbGVd1FGX7UKtiFp5uwKZdM8wIuQ==", @@ -8688,15 +7597,6 @@ "dev": true, "license": "MIT" }, - "node_modules/path-is-absolute": { - "version": "1.0.1", - "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/path-key": { "version": "3.1.1", "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", @@ -8917,12 +7817,6 @@ "node": ">=0.4.0" } }, - "node_modules/promise-inflight": { - "version": "1.0.1", - "integrity": "sha512-6zWPyEOFaQBJYcGMHBKTKJ3u6TBsnMFOIZSa6ce1e/ZrrsOlnHRHbabMjLiBYKp+n44X9eUI6VUPaukCXHuG4g==", - "dev": true, - "license": "ISC" - }, "node_modules/promise-retry": { "version": "2.0.1", "integrity": "sha512-y+WKFlBR8BGXnsNlIHFGPZmyDf3DFMoLhaflAnyZgV6rG6xu+JwesTo2Q9R6XwYmtmwAFCkAk3e35jEdoeh/3g==", @@ -9227,22 +8121,6 @@ "node": ">= 4" } }, - "node_modules/rimraf": { - "version": "3.0.2", - "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", - "deprecated": "Rimraf versions prior to v4 are no longer supported", - "dev": true, - "license": "ISC", - "dependencies": { - "glob": "^7.1.3" - }, - "bin": { - "rimraf": "bin.js" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, "node_modules/roarr": { "version": "2.15.4", "integrity": "sha512-CHhPh+UNHD2GTXNYhPWLnU8ONHdI+5DI+4EYIAOaiD63rHeYlZvyh8P+in5999TTSFgUYuKUAjzRI4mdh/p+2A==", @@ -9510,12 +8388,6 @@ "url": "https://opencollective.com/express" } }, - "node_modules/set-blocking": { - "version": "2.0.0", - "integrity": "sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw==", - "dev": true, - "license": "ISC" - }, "node_modules/set-function-length": { "version": "1.2.2", "integrity": "sha512-pgRc4hJ4/sNjWCSS9AmnS40x3bNMDTknHgL5UaMBTMyJnU90EgWh1Rz+MC9eFu4BuN/UwZjKQuY/1v3rM7HMfg==", @@ -9757,20 +8629,6 @@ "npm": ">= 3.0.0" } }, - "node_modules/socks-proxy-agent": { - "version": "7.0.0", - "integrity": "sha512-Fgl0YPZ902wEsAyiQ+idGd1A7rSFx/ayC1CQVMw5P+EQx2V0SgpGtf6OKFhVjPflPUl9YMmEOnmfjCdMUsygww==", - "dev": true, - "license": "MIT", - "dependencies": { - "agent-base": "^6.0.2", - "debug": "^4.3.3", - "socks": "^2.6.2" - }, - "engines": { - "node": ">= 10" - } - }, "node_modules/source-map-js": { "version": "1.2.1", "integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==", @@ -9900,36 +8758,6 @@ "win32" ] }, - "node_modules/ssri": { - "version": "9.0.1", - "integrity": "sha512-o57Wcn66jMQvfHG1FlYbWeZWW/dHZhJXjpIcTfXldXEk5nz5lStPo3mK0OJQfGR3RbZUlbISexbljkJzuEj/8Q==", - "dev": true, - "license": "ISC", - "dependencies": { - "minipass": "^3.1.1" - }, - "engines": { - "node": "^12.13.0 || ^14.15.0 || >=16.0.0" - } - }, - "node_modules/ssri/node_modules/minipass": { - "version": "3.3.6", - "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==", - "dev": true, - "license": "ISC", - "dependencies": { - "yallist": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/ssri/node_modules/yallist": { - "version": "4.0.0", - "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", - "dev": true, - "license": "ISC" - }, "node_modules/stackback": { "version": "0.0.2", "integrity": "sha512-1XMJE5fQo1jGH6Y/7ebnwPOBEkIEnT4QF32d5R1+VXdXveM0IBMJt8zfaxX1P3QhVwrYe+576+jkANtSS2mBbw==", @@ -10504,30 +9332,6 @@ "dev": true, "license": "MIT" }, - "node_modules/unique-filename": { - "version": "2.0.1", - "integrity": "sha512-ODWHtkkdx3IAR+veKxFV+VBkUMcN+FaqzUUd7IZzt+0zhDZFPFxhlqwPF3YQvMHx1TD0tdgYl+kuPnJ8E6ql7A==", - "dev": true, - "license": "ISC", - "dependencies": { - "unique-slug": "^3.0.0" - }, - "engines": { - "node": "^12.13.0 || ^14.15.0 || >=16.0.0" - } - }, - "node_modules/unique-slug": { - "version": "3.0.0", - "integrity": "sha512-8EyMynh679x/0gqE9fT9oilG+qEt+ibFyqjuVTsZn1+CMxH+XLlpvr2UZx4nVcCwTpx81nICr2JQFkM+HPLq4w==", - "dev": true, - "license": "ISC", - "dependencies": { - "imurmurhash": "^0.1.4" - }, - "engines": { - "node": "^12.13.0 || ^14.15.0 || >=16.0.0" - } - }, "node_modules/unist-util-is": { "version": "6.0.1", "integrity": "sha512-LsiILbtBETkDz8I9p1dQ0uyRUWuaQzd/cuEeS1hoRSyW5E5XGmTzlwY1OrNzzakGowI9Dr/I8HVaw4hTtnxy8g==", @@ -10596,15 +9400,6 @@ "url": "https://opencollective.com/unified" } }, - "node_modules/universalify": { - "version": "2.0.1", - "integrity": "sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 10.0.0" - } - }, "node_modules/unpipe": { "version": "1.0.0", "integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==", @@ -12024,59 +10819,6 @@ "node": ">=8" } }, - "node_modules/wide-align": { - "version": "1.1.5", - "integrity": "sha512-eDMORYaPNZ4sQIuuYPDHdQvf4gyCF9rEEV/yPxGfwPkRodwEgiMUUXTx/dex+Me0wxx53S+NgUHaP7y3MGlDmg==", - "dev": true, - "license": "ISC", - "dependencies": { - "string-width": "^1.0.2 || 2 || 3 || 4" - } - }, - "node_modules/wide-align/node_modules/ansi-regex": { - "version": "5.0.1", - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/wide-align/node_modules/is-fullwidth-code-point": { - "version": "3.0.0", - "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/wide-align/node_modules/string-width": { - "version": "4.2.3", - "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", - "dev": true, - "license": "MIT", - "dependencies": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/wide-align/node_modules/strip-ansi": { - "version": "6.0.1", - "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-regex": "^5.0.1" - }, - "engines": { - "node": ">=8" - } - }, "node_modules/wrap-ansi": { "version": "7.0.0", "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", diff --git a/package.json b/package.json index 04e814a..aeb4b0e 100644 --- a/package.json +++ b/package.json @@ -709,10 +709,8 @@ "@types/node-notifier": "^8.0.5", "@types/uuid": "^9.0.8", "@types/vscode": "^1.108.1", - "body-parser": "^2.2.2", "diff": "^8.0.3", "electron": "^39.0.0", - "electron-rebuild": "^3.2.9", "esbuild": "^0.25.0", "express": "^5.2.1", "gray-matter": "^4.0.3", @@ -722,7 +720,6 @@ "micromark": "^4.0.0", "micromark-extension-gfm": "^2.0.0", "npm-run-all": "^4.1.5", - "partial-json": "^0.1.7", "preprocess": "^3.2.0", "typescript": "^5.9.3", "uuid": "^9.0.1", diff --git a/src/adapters/interfaces.ts b/src/adapters/interfaces.ts index 1030823..ced329b 100644 --- a/src/adapters/interfaces.ts +++ b/src/adapters/interfaces.ts @@ -162,21 +162,3 @@ export interface IAgentSession { */ updateContextItems?(items: ContextItem[]): Promise; } - -/** - * Cell-level metadata for notebook-style adapters. - * Used to persist per-cell state like ghost blocks. - */ -export interface CellMetadata { - /** - * Persisted structured ghost block from this cell's context. - * Raw notebook metadata is untrusted and must be decoded before use. - */ - last_ghost_block?: GhostBlock; - /** Message role (user/assistant) */ - role?: string; - /** Assistant/tool interaction rendered as output of a user cell */ - mutsumi_interaction?: PersistedAgentMessage[]; - /** Other arbitrary metadata */ - [key: string]: any; -} diff --git a/src/adapters/types.ts b/src/adapters/types.ts deleted file mode 100644 index a4d7339..0000000 --- a/src/adapters/types.ts +++ /dev/null @@ -1,70 +0,0 @@ -/** - * @fileoverview Adapter layer type definitions for Mutsumi. - * Contains types specific to different adapter implementations (Notebook, Headless). - * @module adapters/types - */ - -import type { - AgentMetadata, - AgentMessage, - AgentContext, - ToolRequest, - ToolResult, - AgentRuntimeStatus, - AgentStateInfo, - MessageContent, - ContentPartText, - ContentPartImage, - ContextItem, -} from '../types'; - -// Re-export common types for convenience -export { - AgentMetadata, - AgentMessage, - AgentContext, - ToolRequest, - ToolResult, - AgentRuntimeStatus, - AgentStateInfo, - MessageContent, - ContentPartText, - ContentPartImage, - ContextItem, -}; - -/** - * Adapter type identifier. - * - 'notebook': UI-based adapter using VSCode Notebook API - * - 'headless': API-based adapter for HTTP/ programmatic access - */ -export type AdapterType = 'notebook' | 'headless' | 'lite'; - -// Re-export LiteAdapter types for convenience -export { LiteAgentSessionConfig } from './liteAdapter'; - -// ============================================================================ -// Headless Adapter HTTP API Types -// ============================================================================ - -/** - * Chat request payload for Headless Adapter HTTP API. - * @interface ChatRequest - */ -export interface ChatRequest { - /** User prompt text */ - prompt: string; - /** Optional model identifier to use for this request */ - model?: string; -} - -/** - * Chat response payload from Headless Adapter HTTP API. - * @interface ChatResponse - */ -export interface ChatResponse { - /** Generated response content */ - content: string; - /** Response status indicator */ - status: string; -} diff --git a/src/agent/agentOrchestrator.ts b/src/agent/agentOrchestrator.ts index e6e5dcb..325ee5a 100644 --- a/src/agent/agentOrchestrator.ts +++ b/src/agent/agentOrchestrator.ts @@ -6,13 +6,11 @@ import * as vscode from 'vscode'; import { v4 as uuidv4 } from 'uuid'; import { AgentSidebarProvider } from '../sidebar/agentSidebar'; -import { AgentController } from '../controller'; import { AgentStateInfo, AgentRuntimeStatus, ContextItem, ModelSelection } from '../types'; import { AgentRegistry } from './registry'; import { DispatchSessionManager } from './dispatch'; import { AgentFileOperations } from './fileOps'; import { AgentTreeUtils } from './treeUtils'; -import { AgentTypeRegistry } from '../registry/agentTypeRegistry'; /** * Orchestrates agent lifecycle, state management, and dispatch operations. @@ -25,8 +23,6 @@ export class AgentOrchestrator { private static instance: AgentOrchestrator; /** Sidebar provider for UI updates */ private sidebar?: AgentSidebarProvider; - /** Agent controller reference */ - private agentController?: AgentController; /** Notebook controller reference */ private notebookController?: vscode.NotebookController; @@ -81,15 +77,12 @@ export class AgentOrchestrator { } /** - * Registers the agent and notebook controllers. - * @param {AgentController} agentController - The agent controller + * Registers the notebook controller. * @param {vscode.NotebookController} notebookController - The notebook controller */ public registerController( - agentController: AgentController, notebookController: vscode.NotebookController ): void { - this.agentController = agentController; this.notebookController = notebookController; } diff --git a/src/agent/agentRunner.ts b/src/agent/agentRunner.ts index 382d01d..2e6fdfc 100644 --- a/src/agent/agentRunner.ts +++ b/src/agent/agentRunner.ts @@ -57,7 +57,7 @@ export class AgentRunner { * @param {IAgentSession} session - The agent session */ constructor( - private options: AgentRunOptions, + options: AgentRunOptions, toolSet: ToolSet, session: IAgentSession ) { diff --git a/src/agent/dispatch.ts b/src/agent/dispatch.ts index 6c09284..a0a4d10 100644 --- a/src/agent/dispatch.ts +++ b/src/agent/dispatch.ts @@ -265,7 +265,7 @@ export class DispatchSessionManager { * manager.clearAllSessions(); */ public clearAllSessions(): void { - for (const [parentId, session] of this.activeDispatches) { + for (const session of this.activeDispatches.values()) { session.reject(new Error('Session manager cleared')); } this.activeDispatches.clear(); diff --git a/src/agent/titleGenerator.ts b/src/agent/titleGenerator.ts index fe86958..5e6cd0c 100644 --- a/src/agent/titleGenerator.ts +++ b/src/agent/titleGenerator.ts @@ -5,7 +5,7 @@ import * as vscode from 'vscode'; import { AgentMessage, AgentMetadata, ModelSelection } from '../types'; -import { LLMClient, LLMClientConfig } from './llmClient'; +import { LLMClientConfig } from './llmClient'; import { AgentOrchestrator } from './agentOrchestrator'; import { IAgentSession } from '../adapters/interfaces'; import { LiteAdapter } from '../adapters/liteAdapter'; diff --git a/src/agent/toolExecutor.ts b/src/agent/toolExecutor.ts index 8a0c3ed..5a75ce4 100644 --- a/src/agent/toolExecutor.ts +++ b/src/agent/toolExecutor.ts @@ -10,7 +10,7 @@ import type { AgentMessage } from "../types"; import type { UIRenderer } from "./uiRenderer"; import type { RenderBlock } from "../notebook/renderTypes"; import type { IAgentSession } from "../adapters/interfaces"; -import { getCachedResult, setCachedResult } from "../tools.d/cache"; +import { executeWithToolCache } from "../tools.d/cache"; import type { ToolCall } from '@earendil-works/pi-ai'; /** Race a thenable against an abort signal; rejects when the signal fires. */ @@ -32,9 +32,6 @@ function raceAbort(signal: AbortSignal, p: Thenable): Promise { }); } -// Re-export for statusBar -export { clearToolCache, getToolCacheSize } from "../tools.d/cache"; - /** * Callbacks for UI updates and termination signaling. * @interface ToolExecutorCallbacks @@ -124,8 +121,6 @@ export class ToolExecutor { const context: ToolContext = { allowedUris: this.allowedUris, - notebook: undefined, - execution: undefined, session: this.session, toolSession, abortSignal: toolSession.abortSignal, @@ -140,28 +135,18 @@ export class ToolExecutor { }, }; - const shouldCache = this.toolSet.getShouldCache(toolName); - let toolResult = ""; let isError = false; try { - if (shouldCache) { - const cached = getCachedResult(toolName, toolArgs); - if (cached !== undefined) { - toolResult = cached; - } else { - toolResult = await raceAbort( - toolSession.abortSignal, - this.toolSet.execute(toolName, toolArgs, context), - ); - setCachedResult(toolName, toolArgs, toolResult); - } - } else { - toolResult = await raceAbort( + toolResult = await executeWithToolCache( + toolName, + toolArgs, + this.toolSet.getShouldCache(toolName), + () => raceAbort( toolSession.abortSignal, this.toolSet.execute(toolName, toolArgs, context), - ); - } + ), + ); } catch (err: any) { if (toolSession.isAborted) { toolResult = `[Interrupted] The ${toolName} tool execution was forcibly stopped by the user.`; diff --git a/src/agent/types.ts b/src/agent/types.ts index aa13439..b1ab94b 100644 --- a/src/agent/types.ts +++ b/src/agent/types.ts @@ -57,25 +57,6 @@ export interface AgentRunOptions { reasoningEffort?: string; } -/** - * Dispatch session information for managing sub-agent lifecycle. - * @interface DispatchSession - */ -export interface DispatchSession { - /** Parent agent UUID that created this dispatch session */ - parentId: string; - /** Resolve function to complete the dispatch session */ - resolve: (value: string[]) => void; - /** Reject function to fail the dispatch session */ - reject: (reason?: any) => void; - /** Set of child agent UUIDs created in this session */ - childUuids: Set; - /** Map of child agent UUID to their results */ - results: Map; - /** Set of child agent UUIDs that have been deleted */ - deletedChildren: Set; -} - /** Provider-ready conversation state; system instructions are not persisted as messages. */ export interface AgentRunContext { systemPrompt?: string; diff --git a/src/agent/utils.ts b/src/agent/utils.ts deleted file mode 100644 index 7ac5f0a..0000000 --- a/src/agent/utils.ts +++ /dev/null @@ -1,40 +0,0 @@ -/** - * @fileoverview Utility helper functions for the agent. - * @module agent/utils - */ - -import { parse, Allow } from "partial-json"; - -/** Allow partial strings/numbers (scalar streaming) and objects (nested). */ -const PARTIAL_ALLOW = Allow.STR | Allow.NUM | Allow.OBJ; - -/** - * Best-effort parse of a potentially incomplete JSON string. - * - * Used to render tool-call arguments while streaming. Returns a partial object - * that grows monotonically instead of collapsing back, so the rendered output - * does not flicker as characters arrive. - * - * @param {string} input - The raw JSON string - * @returns {any} The parsed value, or a best-effort partial object - */ -export function tryParsePartialJson(input: string): any { - if (!input) { - return {}; - } - - // Fast path: the JSON is already complete and valid. - try { - return JSON.parse(input); - } catch (e) { - // Fall through to best-effort partial parsing. - } - - try { - return parse(input, PARTIAL_ALLOW); - } catch (e) { - // Malformed or empty: degrade to an empty object so the tool name can - // still be rendered. - return {}; - } -} diff --git a/src/codebase/rag/service.ts b/src/codebase/rag/service.ts index 6ec7438..4322793 100644 --- a/src/codebase/rag/service.ts +++ b/src/codebase/rag/service.ts @@ -1,6 +1,4 @@ import * as vscode from "vscode"; -import * as path from "path"; -import * as fs from "fs"; import { ChunkResult, ChunkInfo, @@ -587,8 +585,6 @@ export class RagService implements vscode.Disposable { INSERT INTO chunks (file_id, chunk_hash, chunk_text, symbol_name, start_line, end_line) VALUES (?,?,?,?,?,?) `); - const insertVec = db.prepare('INSERT INTO vec_chunks(rowid, embedding) VALUES (?,?)'); - db.transaction(() => { for (const { chunk, vec } of embeddings) { let chunkId: number; diff --git a/src/codebase/rag/utils.ts b/src/codebase/rag/utils.ts index b508e01..aaed44b 100644 --- a/src/codebase/rag/utils.ts +++ b/src/codebase/rag/utils.ts @@ -31,15 +31,6 @@ export function mkChunk( return { text, hash: sha256(text), symbolName, startLine, endLine }; } -export function isDocumentSymbolArray( - arr: vscode.DocumentSymbol[] | vscode.SymbolInformation[] | undefined -): arr is vscode.DocumentSymbol[] { - if (!arr || arr.length === 0) { - return false; - } - return "children" in arr[0]; -} - // ════════════════════════════════════════════════════════════════════════════ // Chunking strategies // ════════════════════════════════════════════════════════════════════════════ diff --git a/src/config/loader.ts b/src/config/loader.ts index cdb5299..2dd85fd 100644 --- a/src/config/loader.ts +++ b/src/config/loader.ts @@ -9,7 +9,6 @@ import { type AgentTypeConfig, DEFAULT_MUTSUMI_CONFIG, validateMutsumiConfig, - ConfigValidationError, } from "./types"; /** diff --git a/src/config/types.ts b/src/config/types.ts index 6d3764e..a4fc51b 100644 --- a/src/config/types.ts +++ b/src/config/types.ts @@ -10,11 +10,7 @@ * @module config/types */ -import { - type MutsumiConfig, - AgentTypeConfig, - ToolSetsConfig, -} from "./interfaces"; +import type { MutsumiConfig } from "./interfaces"; // Re-export all interfaces export { diff --git a/src/contextManagement/skillManager.ts b/src/contextManagement/skillManager.ts index d94e623..8b2d256 100644 --- a/src/contextManagement/skillManager.ts +++ b/src/contextManagement/skillManager.ts @@ -4,7 +4,6 @@ */ import * as vscode from 'vscode'; -import * as path from 'path'; import * as os from 'os'; const matter = require('gray-matter'); import { TextDecoder } from 'util'; diff --git a/src/contextManagement/utils.ts b/src/contextManagement/utils.ts index 4f461fe..2c686e1 100644 --- a/src/contextManagement/utils.ts +++ b/src/contextManagement/utils.ts @@ -1,7 +1,6 @@ import * as vscode from "vscode"; import * as path from "path"; import * as crypto from "crypto"; -import { AgentMessage } from "../types"; import { TextDecoder } from "util"; import { ToolManager } from "../tools.d/toolManager"; import type { ToolContext } from "../tools.d/interface"; @@ -9,7 +8,6 @@ import { type MessageContent, type ContentPartText, type ContentPartImage, - ContextItem, } from "../types"; import { LiteAdapter } from "../adapters/liteAdapter"; import { ToolSession } from "../tools.d/toolSession"; @@ -76,7 +74,7 @@ export async function parseUserMessageWithImages( let lastIndex = 0; for (const match of matches) { - const [fullMatch, altText, uriStr] = match; + const [fullMatch, , uriStr] = match; const index = match.index!; if (index > lastIndex) { @@ -246,14 +244,6 @@ export async function readResource( } } -/** - * Check if URI points to a Markdown file - */ -export function isMarkdownFile(uri: vscode.Uri): boolean { - const ext = path.extname(uri.path).toLowerCase(); - return ext === ".md"; -} - /** * Check if file should be recursively parsed for references */ diff --git a/src/controller.ts b/src/controller.ts index 6b6ae07..a5537df 100644 --- a/src/controller.ts +++ b/src/controller.ts @@ -4,7 +4,7 @@ */ import * as vscode from 'vscode'; -import { ToolSet, ToolRegistry, createToolSetForAgent } from './tools.d/toolManager'; +import { createToolSetForAgent } from './tools.d/toolManager'; import { AgentRunner } from './agent/agentRunner'; import { AgentOrchestrator } from './agent/agentOrchestrator'; import { NotebookAdapter } from './adapters/notebookAdapter'; @@ -24,9 +24,6 @@ import { t } from './i18n'; * await controller.execute(cells, notebook, notebookController); */ export class AgentController { - /** Execution order counter for tracking cell execution sequence */ - private executionOrder = 0; - /** * Creates a new AgentController instance. * @constructor diff --git a/src/extension.ts b/src/extension.ts index a6271b7..0715d65 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -344,7 +344,7 @@ export async function activate( ); // 2. Sidebar - sidebarProvider = new AgentSidebarProvider(context.extensionUri, mcpRegistry); + sidebarProvider = new AgentSidebarProvider(mcpRegistry); sidebarProvider.registerTreeView(context); AgentOrchestrator.getInstance().setSidebar(sidebarProvider); @@ -363,7 +363,6 @@ export async function activate( context.subscriptions.push(controller); AgentOrchestrator.getInstance().registerController( - agentController, controller, ); diff --git a/src/httpServer/agents.ts b/src/httpServer/agents.ts index 9d23a44..2196cfd 100644 --- a/src/httpServer/agents.ts +++ b/src/httpServer/agents.ts @@ -7,7 +7,6 @@ import { initializeRules } from '../contextManagement/prompts'; import { getAvailableRules } from './utils'; import { MutsumiSerializer } from '../notebook/serializer'; import { resolveAgentDefaults, validateEntryAgentType } from '../config/resolver'; -import type { AgentContext, AgentMetadata } from '../types'; import { McpRegistry } from '../mcp/registry'; import { decodeAgentContext } from '../mtmFormat'; diff --git a/src/httpServer/chat.ts b/src/httpServer/chat.ts index 0ddfbea..7c966e6 100644 --- a/src/httpServer/chat.ts +++ b/src/httpServer/chat.ts @@ -3,7 +3,7 @@ import express = require('express'); import { AgentRunner } from '../agent/agentRunner'; import { MutsumiSerializer } from '../notebook/serializer'; import { RenderData, RenderBlock, MUTSUMI_AGENT_CHAT_MIME } from '../notebook/renderTypes'; -import { ToolSet, ToolRegistry, createToolSetForAgent } from '../tools.d/toolManager'; +import { ToolSet, createToolSetForAgent } from '../tools.d/toolManager'; import { getAgentFromRegistry } from './utils'; import { AgentFileOperations } from '../agent/fileOps'; import { getDefaultModelSelection, resolveModelSelection } from '../utils'; diff --git a/src/httpServer/index.ts b/src/httpServer/index.ts index 87d3cfb..eb878c0 100644 --- a/src/httpServer/index.ts +++ b/src/httpServer/index.ts @@ -2,7 +2,6 @@ import * as vscode from 'vscode'; import * as net from 'net'; import * as crypto from 'crypto'; import express = require('express'); -import bodyParser = require('body-parser'); import { HeadlessAdapter } from '../adapters/headlessAdapter'; import { HttpServerOptions } from './types'; import { debugLogger } from '../debugLogger'; @@ -148,7 +147,7 @@ export class HttpServer { next(); }); - this.app.use(bodyParser.json({ limit: '2mb' })); + this.app.use(express.json({ limit: '2mb' })); // Agents endpoints this.app.post('/agents', createCreateAgentHandler({ extensionUri: this.extensionUri })); diff --git a/src/httpServer/stop.ts b/src/httpServer/stop.ts index 37be221..46e687c 100644 --- a/src/httpServer/stop.ts +++ b/src/httpServer/stop.ts @@ -1,6 +1,4 @@ -import * as vscode from 'vscode'; import type * as express from 'express'; -import { AgentRegistry } from '../agent/registry'; import type { HeadlessAdapter } from '../adapters/headlessAdapter'; export interface StopAgentHandlerOptions { diff --git a/src/httpServer/types.ts b/src/httpServer/types.ts index 55786b6..0241116 100644 --- a/src/httpServer/types.ts +++ b/src/httpServer/types.ts @@ -1,18 +1,4 @@ -import * as vscode from 'vscode'; -import express = require('express'); -import { HeadlessAdapter } from '../adapters/headlessAdapter'; - export interface HttpServerOptions { host?: string; port?: number; } - -/** - * Context object passed to endpoint handler functions. - */ -export interface EndpointContext { - app: express.Application; - adapter: HeadlessAdapter; - extensionUri: vscode.Uri; - abortControllers: Map; -} diff --git a/src/llm/providerService.ts b/src/llm/providerService.ts index d5602c6..9b44a66 100644 --- a/src/llm/providerService.ts +++ b/src/llm/providerService.ts @@ -7,7 +7,6 @@ import { import type { Api, AuthInteraction, - Credential, Model, Models, MutableModels, @@ -52,7 +51,6 @@ export class LlmProviderService { private snapshot: Snapshot | undefined; private credentialStore: VsCodeCredentialStore | undefined; private modelsStore: VsCodeModelsStore | undefined; - private context: vscode.ExtensionContext | undefined; static getInstance(): LlmProviderService { LlmProviderService.instance ??= new LlmProviderService(); @@ -60,7 +58,6 @@ export class LlmProviderService { } async initialize(context: vscode.ExtensionContext): Promise { - this.context = context; this.credentialStore = new VsCodeCredentialStore(context.secrets, context.globalState); this.modelsStore = new VsCodeModelsStore(context.globalState); await this.reload(); diff --git a/src/mcp/registry.ts b/src/mcp/registry.ts index cd86582..a5ade87 100644 --- a/src/mcp/registry.ts +++ b/src/mcp/registry.ts @@ -35,9 +35,6 @@ export class McpRegistry implements McpToolCaller, Disposable { return [...this.records.values()].map(record => ({ ...record, tools: [...record.tools] })); } - /** @deprecated Use getRecords. */ - getServers(): readonly McpServerRecord[] { return this.getRecords(); } - getServer(serverId: string): McpServerRecord | undefined { const record = this.records.get(serverId); return record && { ...record, tools: [...record.tools] }; diff --git a/src/notebook/completionProvider.ts b/src/notebook/completionProvider.ts index 4bf4a84..f22041f 100644 --- a/src/notebook/completionProvider.ts +++ b/src/notebook/completionProvider.ts @@ -1,5 +1,4 @@ import * as vscode from 'vscode'; -import * as path from 'path'; import { isCommonIgnored } from '../tools.d/utils'; import { ToolManager } from '../tools.d/toolManager'; import { t } from '../i18n'; diff --git a/src/notebook/serializer.ts b/src/notebook/serializer.ts index 8242d81..b352da4 100644 --- a/src/notebook/serializer.ts +++ b/src/notebook/serializer.ts @@ -1,5 +1,4 @@ import * as vscode from 'vscode'; -import { TextDecoder, TextEncoder } from 'util'; import { AgentContext, AgentMessage, @@ -50,13 +49,6 @@ export interface GenericCellData { }; } -/** - * Result of converting persisted messages to cells. - */ -export interface MessageToCellsResult { - cells: GenericCellData[]; -} - /** * Convert persisted messages and notes to generic cells (message grouping logic). * This is the core algorithm shared between Notebook and Headless adapters. diff --git a/src/registry/agentTypeRegistry.ts b/src/registry/agentTypeRegistry.ts index 0ae2b96..14a6ca6 100644 --- a/src/registry/agentTypeRegistry.ts +++ b/src/registry/agentTypeRegistry.ts @@ -4,7 +4,6 @@ */ import type { AgentTypeConfig, AgentTypeConfigMap } from "../config/interfaces"; -import { DEFAULT_MUTSUMI_CONFIG } from "../config/types"; /** * Stores agent type configurations, validates toolSets/child types, provides entry type queries. diff --git a/src/registry/toolSetRegistry.ts b/src/registry/toolSetRegistry.ts index 66766bb..ee75bca 100644 --- a/src/registry/toolSetRegistry.ts +++ b/src/registry/toolSetRegistry.ts @@ -6,8 +6,7 @@ import * as vscode from "vscode"; import type { ITool } from "../tools.d/interface"; import { ToolRegistry } from "../tools.d/toolManager"; -import { type ToolSetsConfig, ToolSetDefinition } from "../config/interfaces"; -import { DEFAULT_MUTSUMI_CONFIG } from "../config/types"; +import type { ToolSetsConfig } from "../config/interfaces"; /** * ToolSetRegistry manages named collections of tools. diff --git a/src/sidebar/agentSidebar.ts b/src/sidebar/agentSidebar.ts index 53fd6cc..4bf3dc3 100644 --- a/src/sidebar/agentSidebar.ts +++ b/src/sidebar/agentSidebar.ts @@ -49,12 +49,11 @@ export class AgentSidebarProvider { /** * @description Creates an Agent sidebar provider instance - * @param {vscode.Uri} _extensionUri - The root URI of the extension */ - constructor(private readonly _extensionUri: vscode.Uri, private readonly _mcpRegistry?: McpRegistryView) { + constructor(private readonly _mcpRegistry?: McpRegistryView) { this._agentTreeDataProvider = new AgentTreeDataProvider(); this._approvalTreeDataProvider = new ApprovalTreeDataProvider(); - this._contextTreeDataProvider = new ContextTreeDataProvider(_extensionUri, _mcpRegistry); + this._contextTreeDataProvider = new ContextTreeDataProvider(_mcpRegistry); this._shellTaskTreeDataProvider = new ShellTaskTreeDataProvider(); } diff --git a/src/sidebar/agentTreeProvider.ts b/src/sidebar/agentTreeProvider.ts index 0a69b73..c78ac40 100644 --- a/src/sidebar/agentTreeProvider.ts +++ b/src/sidebar/agentTreeProvider.ts @@ -1,5 +1,5 @@ import * as vscode from 'vscode'; -import { AgentTreeItem, AgentNodeData } from './agentTreeItem'; +import { AgentTreeItem } from './agentTreeItem'; import { AgentOrchestrator } from '../agent/agentOrchestrator'; /** @@ -126,4 +126,4 @@ export class AgentTreeDataProvider implements vscode.TreeDataProvider} * @example - * const provider = new ContextTreeDataProvider(extensionUri); + * const provider = new ContextTreeDataProvider(mcpRegistry); * vscode.window.createTreeView('mutsumi.contextSidebar', { treeDataProvider: provider }); */ export class ContextTreeDataProvider implements vscode.TreeDataProvider { @@ -51,15 +51,11 @@ export class ContextTreeDataProvider implements vscode.TreeDataProvider(name: string, value: T): void { ); } -/** - * Check if a generic tool variable is cached. - * @param name - Variable name - * @returns True if the variable is cached - */ -export function hasToolVar(name: string): boolean { - return toolVariableCache.has(name); -} - /** * Clear all cached tool variables and results. */ -export function clearToolVars(): void { +export function clearToolCache(): void { cacheLog(`Clearing cache. Previous size: ${toolVariableCache.size}`); toolVariableCache.clear(); } @@ -76,81 +67,36 @@ export function clearToolVars(): void { * @param args - Tool arguments * @returns Cache key string */ -export function generateCacheKey(toolName: string, args: any): string { +function generateCacheKey(toolName: string, args: unknown): string { const key = `${toolName}:${JSON.stringify(args)}`; cacheLog(`Generated key: ${key}`); return key; } /** - * Clear all cached tool results. - * @deprecated Use {@link clearToolVars} instead. + * Execute a tool through the shared cache policy used by both runtime and + * user-authored pre-execution paths. The caller retains ownership of approval, + * cancellation, and tool-session lifecycle inside the supplied operation. */ -export function clearToolCache(): void { - clearToolVars(); -} - -/** - * Get the number of cached tool variables/results. - * @returns Cache size - */ -export function getToolCacheSize(): number { - return toolVariableCache.size; -} - -/** - * Log current cache contents for debugging. - */ -export function logCacheContents(): void { - cacheLog(`Current cache entries (${toolVariableCache.size}):`); - for (const [key, value] of toolVariableCache.entries()) { - let length: number; - if (typeof value === "string") { - length = value.length; - } else if (Buffer.isBuffer(value)) { - length = value.length; - } else { - length = JSON.stringify(value).length; - } - cacheLog(` Key: "${key}" -> Value length: ${length}`); +export async function executeWithToolCache( + toolName: string, + args: unknown, + shouldCache: boolean, + operation: () => Promise, +): Promise { + if (!shouldCache) { + return operation(); } -} -/** - * Check if a result is cached for the given tool and arguments. - * @param toolName - Tool name - * @param args - Tool arguments - * @returns True if result is cached - */ -export function hasCachedResult(toolName: string, args: any): boolean { - return hasToolVar(generateCacheKey(toolName, args)); -} - -/** - * Get cached tool result. - * @param toolName - Tool name - * @param args - Tool arguments - * @returns Cached result, or undefined if not found - */ -export function getCachedResult( - toolName: string, - args: any, -): string | undefined { - return getToolVar(generateCacheKey(toolName, args)); -} + const key = generateCacheKey(toolName, args); + const cached = getToolVar(key); + if (cached !== undefined) { + return cached; + } -/** - * Store tool result in cache. - * @param toolName - Tool name - * @param args - Tool arguments - * @param result - Tool execution result - */ -export function setCachedResult( - toolName: string, - args: any, - result: string, -): void { - setToolVar(generateCacheKey(toolName, args), result); + const result = await operation(); + setToolVar(key, result); + return result; } /** diff --git a/src/tools.d/interface.ts b/src/tools.d/interface.ts index b485b03..376ac45 100644 --- a/src/tools.d/interface.ts +++ b/src/tools.d/interface.ts @@ -1,13 +1,8 @@ -import type * as vscode from 'vscode'; import type { IAgentSession } from '../adapters/interfaces'; import type { ToolSession } from './toolSession'; export interface ToolContext { allowedUris: string[]; - /** @deprecated Use `session` instead. Will be removed in future versions. */ - notebook?: vscode.NotebookDocument; - /** @deprecated Use `session` instead. Will be removed in future versions. */ - execution?: vscode.NotebookCellExecution; session: IAgentSession; /** Per-tool-call execution session; abort this to stop a running tool. */ toolSession: ToolSession; diff --git a/src/tools.d/permission.ts b/src/tools.d/permission.ts index 2a6c05b..b885bcb 100644 --- a/src/tools.d/permission.ts +++ b/src/tools.d/permission.ts @@ -224,22 +224,6 @@ class ApprovalRequestManager { return { id, promise }; } - // Deprecated wrapper for backward compatibility if any direct calls exist - public addRequest( - actionDescription: string, - targetUri: string, - details?: string, - autoApproved: boolean = false, - ): Promise { - const { promise } = this.createStandardRequest( - actionDescription, - targetUri, - details, - autoApproved, - ); - return promise; - } - public async approveRequest(id: string): Promise { const request = this.requests.get(id); if (request && request.status === "pending") { diff --git a/src/tools.d/toolManager.ts b/src/tools.d/toolManager.ts index 3ee6fc6..9a1c3c6 100644 --- a/src/tools.d/toolManager.ts +++ b/src/tools.d/toolManager.ts @@ -29,15 +29,12 @@ import { queryCodebaseTool } from "./tools/rag"; import { AgentTypeRegistry } from "../registry/agentTypeRegistry"; import { ToolSetRegistry } from "../registry/toolSetRegistry"; import * as vscode from "vscode"; -import { getCachedResult, setCachedResult } from "./cache"; +import { executeWithToolCache } from "./cache"; import { McpRegistry } from "../mcp/registry"; import { McpToolAdapter } from "../mcp/tool"; import type { McpToolSelection } from "../mcp/interfaces"; import { normalizeMcpToolSelections } from "../mcp/utils"; -// Re-export cache functions for convenience -export { getToolCacheSize, clearToolCache } from "./cache"; - /** * Tool set configuration for different agent types. * @interface ToolSetConfig @@ -442,22 +439,12 @@ export class ToolManager { ): Promise { const toolSet = this.getUserToolSet(isSubAgent); - const shouldCache = toolSet.getShouldCache(name); - - if (shouldCache) { - const cached = getCachedResult(name, args); - if (cached !== undefined) { - return cached; - } - } - - const result = await toolSet.execute(name, args, context); - - if (shouldCache) { - setCachedResult(name, args, result); - } - - return result; + return executeWithToolCache( + name, + args, + toolSet.getShouldCache(name), + () => toolSet.execute(name, args, context), + ); } /** @@ -540,21 +527,9 @@ export interface CreateToolSetForAgentOptions { * persisted session snapshot; only tools that remain available in the registry * are added to this run. */ -export function createToolSetForAgent(options: CreateToolSetForAgentOptions): ToolSet; -/** @deprecated Use the options overload. */ -export function createToolSetForAgent(agentType: string, uuid?: string, parentAgentId?: string | null): ToolSet; export function createToolSetForAgent( - optionsOrAgentType: CreateToolSetForAgentOptions | string, - legacyAgentId?: string, - legacyParentAgentId?: string | null, + options: CreateToolSetForAgentOptions, ): ToolSet { - const options: CreateToolSetForAgentOptions = typeof optionsOrAgentType === "string" - ? { - agentType: optionsOrAgentType, - agentId: legacyAgentId, - parentAgentId: legacyParentAgentId, - } - : optionsOrAgentType; const { agentType, agentId, parentAgentId, enabledMcpTools = [] } = options; const agentTypeConfig = AgentTypeRegistry.getInstance().getAgentType(agentType); diff --git a/src/tools.d/tools/agent_control.ts b/src/tools.d/tools/agent_control.ts index 0d8e44a..fa4ea0f 100644 --- a/src/tools.d/tools/agent_control.ts +++ b/src/tools.d/tools/agent_control.ts @@ -1,4 +1,3 @@ -import * as vscode from 'vscode'; import { ITool, ToolContext } from '../interface'; import { AgentOrchestrator } from '../../agent/agentOrchestrator'; import { AgentTypeRegistry } from '../../registry/agentTypeRegistry'; diff --git a/src/tools.d/tools/diagnostics.ts b/src/tools.d/tools/diagnostics.ts index 4476dd8..61cbd6f 100644 --- a/src/tools.d/tools/diagnostics.ts +++ b/src/tools.d/tools/diagnostics.ts @@ -1,7 +1,6 @@ import { ITool, ToolContext } from '../interface'; import { resolveUri } from '../utils'; import * as vscode from 'vscode'; -import * as path from 'path'; export const getWarningErrorTool: ITool = { name: 'diagnostics', @@ -121,4 +120,4 @@ export const getWarningErrorTool: ITool = { } return `⚠️ Mutsumi checked workspace diagnostics`; } -}; \ No newline at end of file +}; diff --git a/src/tools.d/tools/system_info.ts b/src/tools.d/tools/system_info.ts index 96d4a00..cf4deaa 100644 --- a/src/tools.d/tools/system_info.ts +++ b/src/tools.d/tools/system_info.ts @@ -1,12 +1,10 @@ import { ITool, ToolContext } from '../interface'; -import { resolveUri } from '../utils'; import { codepageToEncoding, detectWindowsCodepage, getToolVar, setToolVar, } from '../cache'; -import * as vscode from 'vscode'; import * as os from 'os'; import * as fs from 'fs'; import * as cp from 'child_process'; diff --git a/src/utils.ts b/src/utils.ts index 706959c..a03d0d3 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -123,30 +123,6 @@ export function sanitizeFileName(name: string): string { .trim(); } -/** - * Ensures a file name is unique by appending a numeric suffix if needed. - * @description Checks against existing names and generates a unique variant - * by adding "-1", "-2", etc. as needed. - * @param {string} baseName - Base file name without extension - * @param {string[]} existingNames - Array of existing file names to check against - * @returns {string} Unique file name - */ -export function ensureUniqueFileName(baseName: string, existingNames: string[]): string { - if (!existingNames.includes(baseName)) { - return baseName; - } - - let counter = 1; - let newName = `${baseName}-${counter}`; - - while (existingNames.includes(newName)) { - counter++; - newName = `${baseName}-${counter}`; - } - - return newName; -} - /** * Get language identifier for Markdown code block based on file extension */ diff --git a/tests/toolCache.test.ts b/tests/toolCache.test.ts new file mode 100644 index 0000000..89b0545 --- /dev/null +++ b/tests/toolCache.test.ts @@ -0,0 +1,39 @@ +import { beforeEach, describe, expect, it, vi } from 'vitest'; + +vi.mock('vscode', () => ({ + l10n: { t: (message: string) => message }, +})); + +import { clearToolCache, executeWithToolCache } from '../src/tools.d/cache'; + +describe('executeWithToolCache', () => { + beforeEach(() => clearToolCache()); + + it('executes every time when caching is disabled', async () => { + const operation = vi.fn() + .mockResolvedValueOnce('first') + .mockResolvedValueOnce('second'); + + await expect(executeWithToolCache('read', { uri: 'a' }, false, operation)).resolves.toBe('first'); + await expect(executeWithToolCache('read', { uri: 'a' }, false, operation)).resolves.toBe('second'); + expect(operation).toHaveBeenCalledTimes(2); + }); + + it('reuses a completed result when caching is enabled', async () => { + const operation = vi.fn().mockResolvedValue('result'); + + await expect(executeWithToolCache('system_info', {}, true, operation)).resolves.toBe('result'); + await expect(executeWithToolCache('system_info', {}, true, operation)).resolves.toBe('result'); + expect(operation).toHaveBeenCalledTimes(1); + }); + + it('does not cache a rejected operation', async () => { + const operation = vi.fn() + .mockRejectedValueOnce(new Error('cancelled')) + .mockResolvedValueOnce('recovered'); + + await expect(executeWithToolCache('system_info', {}, true, operation)).rejects.toThrow('cancelled'); + await expect(executeWithToolCache('system_info', {}, true, operation)).resolves.toBe('recovered'); + expect(operation).toHaveBeenCalledTimes(2); + }); +}); diff --git a/tsconfig.json b/tsconfig.json index 0592294..c1d4bec 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -8,6 +8,7 @@ "rootDir": "src", "strict": true, "noImplicitAny": true, + "noUnusedLocals": true, "skipLibCheck": true, "moduleResolution": "NodeNext", "esModuleInterop": true,