@cjhyy/code-shell-core 0.5.0-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +162 -0
- package/dist/agent/coordinator.d.ts +49 -0
- package/dist/agent/coordinator.js +77 -0
- package/dist/arena/arena.d.ts +43 -0
- package/dist/arena/arena.js +334 -0
- package/dist/arena/context/context-tools.d.ts +16 -0
- package/dist/arena/context/context-tools.js +231 -0
- package/dist/arena/detect-mode.d.ts +20 -0
- package/dist/arena/detect-mode.js +78 -0
- package/dist/arena/digest-builder.d.ts +25 -0
- package/dist/arena/digest-builder.js +120 -0
- package/dist/arena/index.d.ts +29 -0
- package/dist/arena/index.js +29 -0
- package/dist/arena/iterate/convergence.d.ts +25 -0
- package/dist/arena/iterate/convergence.js +103 -0
- package/dist/arena/iterate/formats/index.d.ts +22 -0
- package/dist/arena/iterate/formats/index.js +283 -0
- package/dist/arena/iterate/index.d.ts +11 -0
- package/dist/arena/iterate/index.js +9 -0
- package/dist/arena/iterate/iterative-arena.d.ts +23 -0
- package/dist/arena/iterate/iterative-arena.js +237 -0
- package/dist/arena/iterate/parse.d.ts +42 -0
- package/dist/arena/iterate/parse.js +123 -0
- package/dist/arena/iterate/phases/argue.d.ts +22 -0
- package/dist/arena/iterate/phases/argue.js +159 -0
- package/dist/arena/iterate/phases/revise.d.ts +16 -0
- package/dist/arena/iterate/phases/revise.js +62 -0
- package/dist/arena/iterate/phases/tournament.d.ts +34 -0
- package/dist/arena/iterate/phases/tournament.js +113 -0
- package/dist/arena/iterate/tools/web-tools.d.ts +13 -0
- package/dist/arena/iterate/tools/web-tools.js +54 -0
- package/dist/arena/iterate/types.d.ts +152 -0
- package/dist/arena/iterate/types.js +8 -0
- package/dist/arena/ledger.d.ts +47 -0
- package/dist/arena/ledger.js +151 -0
- package/dist/arena/lenses/architecture.d.ts +5 -0
- package/dist/arena/lenses/architecture.js +22 -0
- package/dist/arena/lenses/engineering.d.ts +5 -0
- package/dist/arena/lenses/engineering.js +22 -0
- package/dist/arena/lenses/general.d.ts +5 -0
- package/dist/arena/lenses/general.js +20 -0
- package/dist/arena/lenses/index.d.ts +16 -0
- package/dist/arena/lenses/index.js +47 -0
- package/dist/arena/lenses/product.d.ts +5 -0
- package/dist/arena/lenses/product.js +22 -0
- package/dist/arena/model-presets.d.ts +23 -0
- package/dist/arena/model-presets.js +44 -0
- package/dist/arena/phases/adjudication.d.ts +24 -0
- package/dist/arena/phases/adjudication.js +144 -0
- package/dist/arena/phases/build-consensus.d.ts +29 -0
- package/dist/arena/phases/build-consensus.js +86 -0
- package/dist/arena/phases/claim-registry.d.ts +26 -0
- package/dist/arena/phases/claim-registry.js +60 -0
- package/dist/arena/phases/cross-review.d.ts +45 -0
- package/dist/arena/phases/cross-review.js +224 -0
- package/dist/arena/phases/debate-rounds.d.ts +27 -0
- package/dist/arena/phases/debate-rounds.js +162 -0
- package/dist/arena/phases/participant-research.d.ts +38 -0
- package/dist/arena/phases/participant-research.js +317 -0
- package/dist/arena/phases/planning-detail-expansion.d.ts +38 -0
- package/dist/arena/phases/planning-detail-expansion.js +121 -0
- package/dist/arena/planner.d.ts +27 -0
- package/dist/arena/planner.js +312 -0
- package/dist/arena/providers/docs.d.ts +6 -0
- package/dist/arena/providers/docs.js +108 -0
- package/dist/arena/providers/git.d.ts +8 -0
- package/dist/arena/providers/git.js +174 -0
- package/dist/arena/providers/index.d.ts +32 -0
- package/dist/arena/providers/index.js +132 -0
- package/dist/arena/providers/none.d.ts +7 -0
- package/dist/arena/providers/none.js +11 -0
- package/dist/arena/providers/repo.d.ts +6 -0
- package/dist/arena/providers/repo.js +255 -0
- package/dist/arena/render/session.d.ts +17 -0
- package/dist/arena/render/session.js +190 -0
- package/dist/arena/render/terminal.d.ts +34 -0
- package/dist/arena/render/terminal.js +286 -0
- package/dist/arena/strategies/discussion.d.ts +25 -0
- package/dist/arena/strategies/discussion.js +143 -0
- package/dist/arena/strategies/index.d.ts +15 -0
- package/dist/arena/strategies/index.js +28 -0
- package/dist/arena/strategies/language-wrapper.d.ts +17 -0
- package/dist/arena/strategies/language-wrapper.js +102 -0
- package/dist/arena/strategies/lens-wrapper.d.ts +16 -0
- package/dist/arena/strategies/lens-wrapper.js +236 -0
- package/dist/arena/strategies/planning.d.ts +30 -0
- package/dist/arena/strategies/planning.js +225 -0
- package/dist/arena/strategies/review.d.ts +26 -0
- package/dist/arena/strategies/review.js +168 -0
- package/dist/arena/strategies/utils.d.ts +39 -0
- package/dist/arena/strategies/utils.js +647 -0
- package/dist/arena/tools/selector.d.ts +17 -0
- package/dist/arena/tools/selector.js +61 -0
- package/dist/arena/transitions.d.ts +48 -0
- package/dist/arena/transitions.js +92 -0
- package/dist/arena/types.d.ts +508 -0
- package/dist/arena/types.js +27 -0
- package/dist/cli/agent-server-stdio.d.ts +32 -0
- package/dist/cli/agent-server-stdio.js +116 -0
- package/dist/colorizer.d.ts +23 -0
- package/dist/colorizer.js +12 -0
- package/dist/context/compaction.d.ts +116 -0
- package/dist/context/compaction.js +534 -0
- package/dist/context/manager.d.ts +145 -0
- package/dist/context/manager.js +423 -0
- package/dist/context/token-counter.d.ts +27 -0
- package/dist/context/token-counter.js +91 -0
- package/dist/context/tool-result-storage.d.ts +96 -0
- package/dist/context/tool-result-storage.js +296 -0
- package/dist/cost-tracker.d.ts +64 -0
- package/dist/cost-tracker.js +314 -0
- package/dist/cron/scheduler.d.ts +34 -0
- package/dist/cron/scheduler.js +115 -0
- package/dist/data/deepseek-models.json +46 -0
- package/dist/data/gemini-models.json +67 -0
- package/dist/data/openai-models.json +175 -0
- package/dist/data/openrouter-models.d.ts +35 -0
- package/dist/data/openrouter-models.js +36 -0
- package/dist/data/openrouter-models.json +4626 -0
- package/dist/data/openrouter-sync.d.ts +16 -0
- package/dist/data/openrouter-sync.js +53 -0
- package/dist/data/static-catalogs.d.ts +25 -0
- package/dist/data/static-catalogs.js +26 -0
- package/dist/data/zai-models.json +56 -0
- package/dist/engine/cost-store.d.ts +22 -0
- package/dist/engine/cost-store.js +15 -0
- package/dist/engine/engine.d.ts +295 -0
- package/dist/engine/engine.js +1467 -0
- package/dist/engine/model-facade.d.ts +24 -0
- package/dist/engine/model-facade.js +194 -0
- package/dist/engine/parse-task.d.ts +59 -0
- package/dist/engine/parse-task.js +135 -0
- package/dist/engine/patch-orphaned-tools.d.ts +52 -0
- package/dist/engine/patch-orphaned-tools.js +95 -0
- package/dist/engine/query.d.ts +50 -0
- package/dist/engine/query.js +107 -0
- package/dist/engine/runtime.d.ts +50 -0
- package/dist/engine/runtime.js +59 -0
- package/dist/engine/streaming-tool-queue.d.ts +34 -0
- package/dist/engine/streaming-tool-queue.js +61 -0
- package/dist/engine/token-budget.d.ts +22 -0
- package/dist/engine/token-budget.js +40 -0
- package/dist/engine/tool-summary.d.ts +13 -0
- package/dist/engine/tool-summary.js +35 -0
- package/dist/engine/turn-loop.d.ts +122 -0
- package/dist/engine/turn-loop.js +602 -0
- package/dist/engine/turn-state.d.ts +20 -0
- package/dist/engine/turn-state.js +17 -0
- package/dist/exceptions.d.ts +61 -0
- package/dist/exceptions.js +116 -0
- package/dist/git/utils.d.ts +35 -0
- package/dist/git/utils.js +98 -0
- package/dist/git/worktree.d.ts +36 -0
- package/dist/git/worktree.js +139 -0
- package/dist/hooks/events.d.ts +114 -0
- package/dist/hooks/events.js +4 -0
- package/dist/hooks/inject.d.ts +19 -0
- package/dist/hooks/inject.js +29 -0
- package/dist/hooks/registry.d.ts +15 -0
- package/dist/hooks/registry.js +84 -0
- package/dist/hooks/shell-runner.d.ts +45 -0
- package/dist/hooks/shell-runner.js +173 -0
- package/dist/index.d.ts +117 -0
- package/dist/index.js +145 -0
- package/dist/llm/api-key-sanitize.d.ts +22 -0
- package/dist/llm/api-key-sanitize.js +81 -0
- package/dist/llm/capabilities/index.d.ts +20 -0
- package/dist/llm/capabilities/index.js +39 -0
- package/dist/llm/capabilities/rules.d.ts +26 -0
- package/dist/llm/capabilities/rules.js +215 -0
- package/dist/llm/capabilities/types.d.ts +114 -0
- package/dist/llm/capabilities/types.js +24 -0
- package/dist/llm/client-base.d.ts +29 -0
- package/dist/llm/client-base.js +137 -0
- package/dist/llm/client-factory.d.ts +10 -0
- package/dist/llm/client-factory.js +29 -0
- package/dist/llm/model-cache.d.ts +21 -0
- package/dist/llm/model-cache.js +46 -0
- package/dist/llm/model-fetcher.d.ts +29 -0
- package/dist/llm/model-fetcher.js +282 -0
- package/dist/llm/model-pool.d.ts +95 -0
- package/dist/llm/model-pool.js +246 -0
- package/dist/llm/provider-catalog.d.ts +32 -0
- package/dist/llm/provider-catalog.js +50 -0
- package/dist/llm/provider-kinds.d.ts +21 -0
- package/dist/llm/provider-kinds.js +132 -0
- package/dist/llm/providers/anthropic.d.ts +19 -0
- package/dist/llm/providers/anthropic.js +267 -0
- package/dist/llm/providers/openai.d.ts +64 -0
- package/dist/llm/providers/openai.js +606 -0
- package/dist/llm/retry.d.ts +12 -0
- package/dist/llm/retry.js +17 -0
- package/dist/llm/stream-watchdog.d.ts +42 -0
- package/dist/llm/stream-watchdog.js +70 -0
- package/dist/llm/token-counter.d.ts +17 -0
- package/dist/llm/token-counter.js +36 -0
- package/dist/llm/types.d.ts +37 -0
- package/dist/llm/types.js +4 -0
- package/dist/logging/logger.d.ts +109 -0
- package/dist/logging/logger.js +390 -0
- package/dist/logging/sanitize-messages.d.ts +42 -0
- package/dist/logging/sanitize-messages.js +150 -0
- package/dist/logging/session-recorder.d.ts +90 -0
- package/dist/logging/session-recorder.js +304 -0
- package/dist/lsp/client.d.ts +41 -0
- package/dist/lsp/client.js +166 -0
- package/dist/lsp/manager.d.ts +40 -0
- package/dist/lsp/manager.js +124 -0
- package/dist/lsp/servers.d.ts +16 -0
- package/dist/lsp/servers.js +60 -0
- package/dist/migrate-models.d.ts +45 -0
- package/dist/migrate-models.js +179 -0
- package/dist/onboarding.d.ts +189 -0
- package/dist/onboarding.js +625 -0
- package/dist/plugins/gitOps.d.ts +32 -0
- package/dist/plugins/gitOps.js +62 -0
- package/dist/plugins/installedPlugins.d.ts +15 -0
- package/dist/plugins/installedPlugins.js +56 -0
- package/dist/plugins/knownMarketplaces.d.ts +10 -0
- package/dist/plugins/knownMarketplaces.js +46 -0
- package/dist/plugins/loadPluginHooks.d.ts +52 -0
- package/dist/plugins/loadPluginHooks.js +162 -0
- package/dist/plugins/marketplaceManager.d.ts +49 -0
- package/dist/plugins/marketplaceManager.js +142 -0
- package/dist/plugins/parseMarketplaceInput.d.ts +16 -0
- package/dist/plugins/parseMarketplaceInput.js +73 -0
- package/dist/plugins/pluginCommandHook.d.ts +54 -0
- package/dist/plugins/pluginCommandHook.js +180 -0
- package/dist/plugins/pluginCommandsLoader.d.ts +25 -0
- package/dist/plugins/pluginCommandsLoader.js +114 -0
- package/dist/plugins/pluginInstaller.d.ts +36 -0
- package/dist/plugins/pluginInstaller.js +228 -0
- package/dist/plugins/schemas.d.ts +9 -0
- package/dist/plugins/schemas.js +136 -0
- package/dist/plugins/types.d.ts +75 -0
- package/dist/plugins/types.js +7 -0
- package/dist/plugins/varRewrite.d.ts +42 -0
- package/dist/plugins/varRewrite.js +129 -0
- package/dist/preset/index.d.ts +60 -0
- package/dist/preset/index.js +159 -0
- package/dist/product/define.d.ts +60 -0
- package/dist/product/define.js +123 -0
- package/dist/product/index.d.ts +5 -0
- package/dist/product/index.js +4 -0
- package/dist/product/types.d.ts +111 -0
- package/dist/product/types.js +21 -0
- package/dist/prompt/composer.d.ts +49 -0
- package/dist/prompt/composer.js +168 -0
- package/dist/prompt/instruction-scanner.d.ts +54 -0
- package/dist/prompt/instruction-scanner.js +187 -0
- package/dist/prompt/section-cache.d.ts +15 -0
- package/dist/prompt/section-cache.js +31 -0
- package/dist/prompt/section-loader.d.ts +26 -0
- package/dist/prompt/section-loader.js +53 -0
- package/dist/prompt/sections/base.md +35 -0
- package/dist/prompt/sections/coding.md +31 -0
- package/dist/prompt/sections/orchestration.md +16 -0
- package/dist/prompt/sections/tone.md +9 -0
- package/dist/protocol/chat-session-manager.d.ts +33 -0
- package/dist/protocol/chat-session-manager.js +65 -0
- package/dist/protocol/chat-session.d.ts +49 -0
- package/dist/protocol/chat-session.js +86 -0
- package/dist/protocol/client.d.ts +104 -0
- package/dist/protocol/client.js +260 -0
- package/dist/protocol/factories.d.ts +93 -0
- package/dist/protocol/factories.js +64 -0
- package/dist/protocol/helpers.d.ts +42 -0
- package/dist/protocol/helpers.js +55 -0
- package/dist/protocol/index.d.ts +4 -0
- package/dist/protocol/index.js +4 -0
- package/dist/protocol/server.d.ts +80 -0
- package/dist/protocol/server.js +855 -0
- package/dist/protocol/transport.d.ts +37 -0
- package/dist/protocol/transport.js +85 -0
- package/dist/protocol/types.d.ts +221 -0
- package/dist/protocol/types.js +61 -0
- package/dist/remote/bridge.d.ts +37 -0
- package/dist/remote/bridge.js +103 -0
- package/dist/run/ArtifactTracker.d.ts +38 -0
- package/dist/run/ArtifactTracker.js +132 -0
- package/dist/run/CheckpointWriter.d.ts +53 -0
- package/dist/run/CheckpointWriter.js +135 -0
- package/dist/run/EngineRunner.d.ts +72 -0
- package/dist/run/EngineRunner.js +119 -0
- package/dist/run/Evaluator.d.ts +56 -0
- package/dist/run/Evaluator.js +62 -0
- package/dist/run/FileRunStore.d.ts +39 -0
- package/dist/run/FileRunStore.js +176 -0
- package/dist/run/Heartbeat.d.ts +54 -0
- package/dist/run/Heartbeat.js +123 -0
- package/dist/run/RunApprovalBackend.d.ts +53 -0
- package/dist/run/RunApprovalBackend.js +85 -0
- package/dist/run/RunLock.d.ts +40 -0
- package/dist/run/RunLock.js +98 -0
- package/dist/run/RunManager.d.ts +82 -0
- package/dist/run/RunManager.js +587 -0
- package/dist/run/RunQueue.d.ts +27 -0
- package/dist/run/RunQueue.js +73 -0
- package/dist/run/RunStore.d.ts +25 -0
- package/dist/run/RunStore.js +9 -0
- package/dist/run/factory.d.ts +63 -0
- package/dist/run/factory.js +51 -0
- package/dist/run/index.d.ts +17 -0
- package/dist/run/index.js +23 -0
- package/dist/run/types.d.ts +136 -0
- package/dist/run/types.js +28 -0
- package/dist/runtime/safe-spawn.d.ts +118 -0
- package/dist/runtime/safe-spawn.js +268 -0
- package/dist/services/analytics.d.ts +29 -0
- package/dist/services/analytics.js +84 -0
- package/dist/services/auto-dream.d.ts +49 -0
- package/dist/services/auto-dream.js +124 -0
- package/dist/services/diagnostics.d.ts +41 -0
- package/dist/services/diagnostics.js +99 -0
- package/dist/services/extract-memories.d.ts +31 -0
- package/dist/services/extract-memories.js +71 -0
- package/dist/services/index.d.ts +11 -0
- package/dist/services/index.js +17 -0
- package/dist/services/memory-orchestrator.d.ts +60 -0
- package/dist/services/memory-orchestrator.js +133 -0
- package/dist/services/notifier.d.ts +25 -0
- package/dist/services/notifier.js +69 -0
- package/dist/services/oauth.d.ts +27 -0
- package/dist/services/oauth.js +153 -0
- package/dist/services/session-memory.d.ts +37 -0
- package/dist/services/session-memory.js +81 -0
- package/dist/session/file-history.d.ts +41 -0
- package/dist/session/file-history.js +115 -0
- package/dist/session/memory.d.ts +104 -0
- package/dist/session/memory.js +310 -0
- package/dist/session/session-manager.d.ts +41 -0
- package/dist/session/session-manager.js +261 -0
- package/dist/session/transcript.d.ts +39 -0
- package/dist/session/transcript.js +186 -0
- package/dist/settings/manager.d.ts +36 -0
- package/dist/settings/manager.js +187 -0
- package/dist/settings/schema.d.ts +1219 -0
- package/dist/settings/schema.js +246 -0
- package/dist/skills/frontmatter.d.ts +13 -0
- package/dist/skills/frontmatter.js +70 -0
- package/dist/skills/index.d.ts +7 -0
- package/dist/skills/index.js +6 -0
- package/dist/skills/scanner.d.ts +31 -0
- package/dist/skills/scanner.js +171 -0
- package/dist/state.d.ts +160 -0
- package/dist/state.js +267 -0
- package/dist/tool-system/builtin/agent-notifications.d.ts +84 -0
- package/dist/tool-system/builtin/agent-notifications.js +197 -0
- package/dist/tool-system/builtin/agent-registry.d.ts +67 -0
- package/dist/tool-system/builtin/agent-registry.js +126 -0
- package/dist/tool-system/builtin/agent-transcript-translator.d.ts +22 -0
- package/dist/tool-system/builtin/agent-transcript-translator.js +160 -0
- package/dist/tool-system/builtin/agent.d.ts +16 -0
- package/dist/tool-system/builtin/agent.js +364 -0
- package/dist/tool-system/builtin/apply-patch/applier.d.ts +26 -0
- package/dist/tool-system/builtin/apply-patch/applier.js +250 -0
- package/dist/tool-system/builtin/apply-patch/index.d.ts +20 -0
- package/dist/tool-system/builtin/apply-patch/index.js +101 -0
- package/dist/tool-system/builtin/apply-patch/parser.d.ts +17 -0
- package/dist/tool-system/builtin/apply-patch/parser.js +212 -0
- package/dist/tool-system/builtin/apply-patch/seek-sequence.d.ts +18 -0
- package/dist/tool-system/builtin/apply-patch/seek-sequence.js +123 -0
- package/dist/tool-system/builtin/apply-patch/types.d.ts +49 -0
- package/dist/tool-system/builtin/apply-patch/types.js +13 -0
- package/dist/tool-system/builtin/arena.d.ts +31 -0
- package/dist/tool-system/builtin/arena.js +416 -0
- package/dist/tool-system/builtin/ask-user.d.ts +20 -0
- package/dist/tool-system/builtin/ask-user.js +99 -0
- package/dist/tool-system/builtin/bash.d.ts +21 -0
- package/dist/tool-system/builtin/bash.js +149 -0
- package/dist/tool-system/builtin/brief.d.ts +6 -0
- package/dist/tool-system/builtin/brief.js +41 -0
- package/dist/tool-system/builtin/config.d.ts +6 -0
- package/dist/tool-system/builtin/config.js +67 -0
- package/dist/tool-system/builtin/cron.d.ts +10 -0
- package/dist/tool-system/builtin/cron.js +61 -0
- package/dist/tool-system/builtin/edit.d.ts +6 -0
- package/dist/tool-system/builtin/edit.js +100 -0
- package/dist/tool-system/builtin/file-cache.d.ts +11 -0
- package/dist/tool-system/builtin/file-cache.js +39 -0
- package/dist/tool-system/builtin/glob.d.ts +7 -0
- package/dist/tool-system/builtin/glob.js +76 -0
- package/dist/tool-system/builtin/grep.d.ts +7 -0
- package/dist/tool-system/builtin/grep.js +150 -0
- package/dist/tool-system/builtin/index.d.ts +20 -0
- package/dist/tool-system/builtin/index.js +449 -0
- package/dist/tool-system/builtin/lsp.d.ts +6 -0
- package/dist/tool-system/builtin/lsp.js +141 -0
- package/dist/tool-system/builtin/mcp-tools.d.ts +10 -0
- package/dist/tool-system/builtin/mcp-tools.js +102 -0
- package/dist/tool-system/builtin/memory.d.ts +26 -0
- package/dist/tool-system/builtin/memory.js +226 -0
- package/dist/tool-system/builtin/notebook-edit.d.ts +6 -0
- package/dist/tool-system/builtin/notebook-edit.js +124 -0
- package/dist/tool-system/builtin/plan.d.ts +15 -0
- package/dist/tool-system/builtin/plan.js +55 -0
- package/dist/tool-system/builtin/powershell.d.ts +11 -0
- package/dist/tool-system/builtin/powershell.js +64 -0
- package/dist/tool-system/builtin/read.d.ts +6 -0
- package/dist/tool-system/builtin/read.js +70 -0
- package/dist/tool-system/builtin/remote-trigger.d.ts +6 -0
- package/dist/tool-system/builtin/remote-trigger.js +54 -0
- package/dist/tool-system/builtin/repl.d.ts +11 -0
- package/dist/tool-system/builtin/repl.js +82 -0
- package/dist/tool-system/builtin/send-message.d.ts +6 -0
- package/dist/tool-system/builtin/send-message.js +47 -0
- package/dist/tool-system/builtin/skill-prompt.d.ts +20 -0
- package/dist/tool-system/builtin/skill-prompt.js +52 -0
- package/dist/tool-system/builtin/skill.d.ts +9 -0
- package/dist/tool-system/builtin/skill.js +55 -0
- package/dist/tool-system/builtin/sleep.d.ts +6 -0
- package/dist/tool-system/builtin/sleep.js +33 -0
- package/dist/tool-system/builtin/task.d.ts +48 -0
- package/dist/tool-system/builtin/task.js +139 -0
- package/dist/tool-system/builtin/tool-search.d.ts +11 -0
- package/dist/tool-system/builtin/tool-search.js +90 -0
- package/dist/tool-system/builtin/web-fetch.d.ts +10 -0
- package/dist/tool-system/builtin/web-fetch.js +328 -0
- package/dist/tool-system/builtin/web-search.d.ts +25 -0
- package/dist/tool-system/builtin/web-search.js +174 -0
- package/dist/tool-system/builtin/worktree.d.ts +10 -0
- package/dist/tool-system/builtin/worktree.js +95 -0
- package/dist/tool-system/builtin/write.d.ts +6 -0
- package/dist/tool-system/builtin/write.js +36 -0
- package/dist/tool-system/context.d.ts +165 -0
- package/dist/tool-system/context.js +18 -0
- package/dist/tool-system/executor.d.ts +49 -0
- package/dist/tool-system/executor.js +495 -0
- package/dist/tool-system/investigation-guard.d.ts +46 -0
- package/dist/tool-system/investigation-guard.js +155 -0
- package/dist/tool-system/mcp-manager.d.ts +67 -0
- package/dist/tool-system/mcp-manager.js +249 -0
- package/dist/tool-system/permission.d.ts +111 -0
- package/dist/tool-system/permission.js +774 -0
- package/dist/tool-system/registry.d.ts +32 -0
- package/dist/tool-system/registry.js +131 -0
- package/dist/tool-system/sandbox/bwrap.d.ts +13 -0
- package/dist/tool-system/sandbox/bwrap.js +63 -0
- package/dist/tool-system/sandbox/index.d.ts +78 -0
- package/dist/tool-system/sandbox/index.js +222 -0
- package/dist/tool-system/sandbox/off.d.ts +2 -0
- package/dist/tool-system/sandbox/off.js +8 -0
- package/dist/tool-system/sandbox/seatbelt.d.ts +18 -0
- package/dist/tool-system/sandbox/seatbelt.js +109 -0
- package/dist/tool-system/task-guard.d.ts +29 -0
- package/dist/tool-system/task-guard.js +70 -0
- package/dist/tool-system/validation.d.ts +5 -0
- package/dist/tool-system/validation.js +39 -0
- package/dist/types.d.ts +376 -0
- package/dist/types.js +4 -0
- package/dist/updater.d.ts +65 -0
- package/dist/updater.js +405 -0
- package/dist/utils/debug.d.ts +41 -0
- package/dist/utils/debug.js +110 -0
- package/dist/utils/earlyInput.d.ts +43 -0
- package/dist/utils/earlyInput.js +166 -0
- package/dist/utils/env.d.ts +24 -0
- package/dist/utils/env.js +104 -0
- package/dist/utils/envUtils.d.ts +51 -0
- package/dist/utils/envUtils.js +135 -0
- package/dist/utils/execFileNoThrow.d.ts +39 -0
- package/dist/utils/execFileNoThrow.js +74 -0
- package/dist/utils/format.d.ts +44 -0
- package/dist/utils/format.js +236 -0
- package/dist/utils/intl.d.ts +22 -0
- package/dist/utils/intl.js +83 -0
- package/dist/utils/lockfile.d.ts +15 -0
- package/dist/utils/lockfile.js +30 -0
- package/dist/utils/memoize.d.ts +19 -0
- package/dist/utils/memoize.js +14 -0
- package/dist/utils/semver.d.ts +6 -0
- package/dist/utils/semver.js +13 -0
- package/dist/utils/sliceAnsi.d.ts +12 -0
- package/dist/utils/sliceAnsi.js +62 -0
- package/dist/utils/systemTheme.d.ts +40 -0
- package/dist/utils/systemTheme.js +108 -0
- package/dist/utils/task-sanitizer.d.ts +6 -0
- package/dist/utils/task-sanitizer.js +24 -0
- package/dist/utils/theme.d.ts +93 -0
- package/dist/utils/theme.js +544 -0
- package/dist/utils/toolDisplay.d.ts +31 -0
- package/dist/utils/toolDisplay.js +188 -0
- package/package.json +72 -0
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Built-in Grep content search tool.
|
|
3
|
+
*/
|
|
4
|
+
import { execFile } from "node:child_process";
|
|
5
|
+
import { promisify } from "node:util";
|
|
6
|
+
import { resolve, sep, isAbsolute } from "node:path";
|
|
7
|
+
const execFileAsync = promisify(execFile);
|
|
8
|
+
/**
|
|
9
|
+
* Strip the cwd prefix from each line so results display as relative
|
|
10
|
+
* paths (e.g. "src/ui/App.tsx" instead of an absolute path). Lines that
|
|
11
|
+
* don't start with the cwd are left untouched.
|
|
12
|
+
*/
|
|
13
|
+
function relativizeOutput(stdout, cwd) {
|
|
14
|
+
const root = resolve(cwd);
|
|
15
|
+
const prefix = root.endsWith(sep) ? root : root + sep;
|
|
16
|
+
return stdout
|
|
17
|
+
.split("\n")
|
|
18
|
+
.map((line) => (line.startsWith(prefix) ? line.slice(prefix.length) : line))
|
|
19
|
+
.join("\n");
|
|
20
|
+
}
|
|
21
|
+
/** rg and grep exit with code 1 when no matches found — that's not an error */
|
|
22
|
+
function isNoMatchExit(err) {
|
|
23
|
+
const e = err;
|
|
24
|
+
return e?.code === 1 && (!e.stdout || e.stdout.trim() === "");
|
|
25
|
+
}
|
|
26
|
+
export const grepToolDef = {
|
|
27
|
+
name: "Grep",
|
|
28
|
+
description: "Search file contents using regex patterns. Uses ripgrep (rg) if available, falls back to grep. " +
|
|
29
|
+
"Default output_mode is 'files_with_matches' which only returns file paths — use this for broad searches. " +
|
|
30
|
+
"Use output_mode 'content' to see matching lines with context.",
|
|
31
|
+
inputSchema: {
|
|
32
|
+
type: "object",
|
|
33
|
+
properties: {
|
|
34
|
+
pattern: { type: "string", description: "Regular expression pattern to search for" },
|
|
35
|
+
path: { type: "string", description: "File or directory to search in (default: cwd)" },
|
|
36
|
+
glob: { type: "string", description: 'Glob pattern to filter files (e.g. "*.ts")' },
|
|
37
|
+
context: { type: "number", description: "Lines of context around matches (only with output_mode content)" },
|
|
38
|
+
max_results: { type: "number", description: "Maximum number of results (default: 50)" },
|
|
39
|
+
output_mode: {
|
|
40
|
+
type: "string",
|
|
41
|
+
description: 'Output mode: "files_with_matches" (default, just file paths), "content" (matching lines), "count" (match counts per file)',
|
|
42
|
+
},
|
|
43
|
+
case_insensitive: { type: "boolean", description: "Case-insensitive search" },
|
|
44
|
+
},
|
|
45
|
+
required: ["pattern"],
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
export async function grepTool(args, ctx) {
|
|
49
|
+
const pattern = args.pattern;
|
|
50
|
+
if (!pattern)
|
|
51
|
+
return "Error: pattern is required";
|
|
52
|
+
// A4: resolve search path against ctx.cwd. Relative args.path is
|
|
53
|
+
// resolved against ctx.cwd; absolute args.path is used as-is.
|
|
54
|
+
const baseDir = ctx?.cwd ?? process.cwd();
|
|
55
|
+
const argPath = args.path;
|
|
56
|
+
const searchPath = argPath
|
|
57
|
+
? isAbsolute(argPath)
|
|
58
|
+
? argPath
|
|
59
|
+
: resolve(baseDir, argPath)
|
|
60
|
+
: baseDir;
|
|
61
|
+
const fileGlob = args.glob;
|
|
62
|
+
const context = args.context || 0;
|
|
63
|
+
const maxResults = args.max_results || 50;
|
|
64
|
+
const outputMode = args.output_mode || "files_with_matches";
|
|
65
|
+
const caseInsensitive = args.case_insensitive || false;
|
|
66
|
+
try {
|
|
67
|
+
return await runRipgrep(pattern, searchPath, fileGlob, context, maxResults, outputMode, caseInsensitive);
|
|
68
|
+
}
|
|
69
|
+
catch (rgErr) {
|
|
70
|
+
// rg/grep exit code 1 = no matches (not an error)
|
|
71
|
+
if (isNoMatchExit(rgErr))
|
|
72
|
+
return "No matches found.";
|
|
73
|
+
try {
|
|
74
|
+
return await runGrep(pattern, searchPath, context, maxResults, outputMode, caseInsensitive);
|
|
75
|
+
}
|
|
76
|
+
catch (grepErr) {
|
|
77
|
+
if (isNoMatchExit(grepErr))
|
|
78
|
+
return "No matches found.";
|
|
79
|
+
return `Error in search: ${grepErr.message}`;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
async function runRipgrep(pattern, path, fileGlob, context, maxResults, outputMode, caseInsensitive) {
|
|
84
|
+
const args = ["--color=never"];
|
|
85
|
+
if (caseInsensitive)
|
|
86
|
+
args.push("-i");
|
|
87
|
+
if (outputMode === "files_with_matches") {
|
|
88
|
+
args.push("--files-with-matches");
|
|
89
|
+
}
|
|
90
|
+
else if (outputMode === "count") {
|
|
91
|
+
args.push("--count");
|
|
92
|
+
}
|
|
93
|
+
else {
|
|
94
|
+
// content mode
|
|
95
|
+
args.push("--line-number", "--no-heading");
|
|
96
|
+
if (context > 0)
|
|
97
|
+
args.push("-C", String(context));
|
|
98
|
+
}
|
|
99
|
+
args.push("-m", String(maxResults));
|
|
100
|
+
if (fileGlob)
|
|
101
|
+
args.push("--glob", fileGlob);
|
|
102
|
+
// Ignore common non-source dirs
|
|
103
|
+
args.push("--glob", "!node_modules", "--glob", "!.git", "--glob", "!dist", "--glob", "!coverage");
|
|
104
|
+
args.push("--", pattern, path);
|
|
105
|
+
const { stdout } = await execFileAsync("rg", args, {
|
|
106
|
+
maxBuffer: 10 * 1024 * 1024,
|
|
107
|
+
timeout: 30_000,
|
|
108
|
+
});
|
|
109
|
+
const result = relativizeOutput(stdout, path).trim();
|
|
110
|
+
if (!result)
|
|
111
|
+
return "No matches found.";
|
|
112
|
+
// Limit output lines
|
|
113
|
+
const lines = result.split("\n");
|
|
114
|
+
if (lines.length > 200) {
|
|
115
|
+
return lines.slice(0, 200).join("\n") + `\n\n... ${lines.length - 200} more results`;
|
|
116
|
+
}
|
|
117
|
+
return result;
|
|
118
|
+
}
|
|
119
|
+
async function runGrep(pattern, path, context, maxResults, outputMode, caseInsensitive) {
|
|
120
|
+
const args = ["-r", "--color=never"];
|
|
121
|
+
if (caseInsensitive)
|
|
122
|
+
args.push("-i");
|
|
123
|
+
if (outputMode === "files_with_matches") {
|
|
124
|
+
args.push("-l");
|
|
125
|
+
}
|
|
126
|
+
else if (outputMode === "count") {
|
|
127
|
+
args.push("-c");
|
|
128
|
+
}
|
|
129
|
+
else {
|
|
130
|
+
args.push("-n");
|
|
131
|
+
if (context > 0)
|
|
132
|
+
args.push("-C", String(context));
|
|
133
|
+
}
|
|
134
|
+
args.push("-m", String(maxResults));
|
|
135
|
+
args.push("-E", pattern);
|
|
136
|
+
args.push("--exclude-dir=node_modules", "--exclude-dir=.git", "--exclude-dir=dist");
|
|
137
|
+
args.push(path);
|
|
138
|
+
const { stdout } = await execFileAsync("grep", args, {
|
|
139
|
+
maxBuffer: 10 * 1024 * 1024,
|
|
140
|
+
timeout: 30_000,
|
|
141
|
+
});
|
|
142
|
+
const result = relativizeOutput(stdout, path).trim();
|
|
143
|
+
if (!result)
|
|
144
|
+
return "No matches found.";
|
|
145
|
+
const lines = result.split("\n");
|
|
146
|
+
if (lines.length > 200) {
|
|
147
|
+
return lines.slice(0, 200).join("\n") + `\n\n... ${lines.length - 200} more results`;
|
|
148
|
+
}
|
|
149
|
+
return result;
|
|
150
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Built-in tool registration.
|
|
3
|
+
*/
|
|
4
|
+
import type { RegisteredTool } from "../../types.js";
|
|
5
|
+
/**
|
|
6
|
+
* Tool executor signature.
|
|
7
|
+
*
|
|
8
|
+
* Tools may inspect ctx for runtime services (askUser, llmConfig, modelPool,
|
|
9
|
+
* toolRegistry, subAgentSpawner). Tools that don't need any of these — Read,
|
|
10
|
+
* Write, Bash, Edit, Glob, Grep, etc. — may simply ignore the second arg.
|
|
11
|
+
*
|
|
12
|
+
* ctx is optional in the signature so legacy call sites (and tests) that
|
|
13
|
+
* pass only args still type-check; ToolRegistry always passes ctx at runtime.
|
|
14
|
+
*/
|
|
15
|
+
export type BuiltinToolFn = (args: Record<string, unknown>, ctx?: import("../context.js").ToolContext) => Promise<string>;
|
|
16
|
+
export interface BuiltinTool {
|
|
17
|
+
definition: RegisteredTool;
|
|
18
|
+
execute: BuiltinToolFn;
|
|
19
|
+
}
|
|
20
|
+
export declare const BUILTIN_TOOLS: BuiltinTool[];
|
|
@@ -0,0 +1,449 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Built-in tool registration.
|
|
3
|
+
*/
|
|
4
|
+
import { readToolDef, readTool } from "./read.js";
|
|
5
|
+
import { writeToolDef, writeTool } from "./write.js";
|
|
6
|
+
import { editToolDef, editTool } from "./edit.js";
|
|
7
|
+
import { applyPatchToolDef, applyPatchTool } from "./apply-patch/index.js";
|
|
8
|
+
import { globToolDef, globTool } from "./glob.js";
|
|
9
|
+
import { grepToolDef, grepTool } from "./grep.js";
|
|
10
|
+
import { bashToolDef, bashTool } from "./bash.js";
|
|
11
|
+
import { webSearchToolDef, webSearchTool } from "./web-search.js";
|
|
12
|
+
import { webFetchToolDef, webFetchTool } from "./web-fetch.js";
|
|
13
|
+
import { askUserToolDef, askUserTool } from "./ask-user.js";
|
|
14
|
+
import { agentToolDef, agentTool, agentStatusToolDef, agentStatusTool, agentCancelToolDef, agentCancelTool, } from "./agent.js";
|
|
15
|
+
import { enterPlanModeToolDef, enterPlanModeTool, exitPlanModeToolDef, exitPlanModeTool } from "./plan.js";
|
|
16
|
+
import { toolSearchToolDef, toolSearchTool } from "./tool-search.js";
|
|
17
|
+
import { todoWriteToolDef, todoWriteTool } from "./task.js";
|
|
18
|
+
import { enterWorktreeToolDef, enterWorktreeTool, exitWorktreeToolDef, exitWorktreeTool } from "./worktree.js";
|
|
19
|
+
import { sendMessageToolDef, sendMessageTool } from "./send-message.js";
|
|
20
|
+
import { sleepToolDef, sleepTool } from "./sleep.js";
|
|
21
|
+
import { configToolDef, configTool } from "./config.js";
|
|
22
|
+
import { notebookEditToolDef, notebookEditTool } from "./notebook-edit.js";
|
|
23
|
+
import { lspToolDef, lspTool } from "./lsp.js";
|
|
24
|
+
import { cronCreateToolDef, cronCreateTool, cronDeleteToolDef, cronDeleteTool, cronListToolDef, cronListTool } from "./cron.js";
|
|
25
|
+
import { skillToolDef, skillTool } from "./skill.js";
|
|
26
|
+
import { mcpToolDef, mcpToolExecute, listMcpResourcesToolDef, listMcpResourcesTool, readMcpResourceToolDef, readMcpResourceTool } from "./mcp-tools.js";
|
|
27
|
+
import { remoteTriggerToolDef, remoteTriggerTool } from "./remote-trigger.js";
|
|
28
|
+
import { replToolDef, replTool } from "./repl.js";
|
|
29
|
+
import { briefToolDef, briefTool } from "./brief.js";
|
|
30
|
+
import { powershellToolDef, powershellTool } from "./powershell.js";
|
|
31
|
+
import { arenaToolDef, arenaTool } from "./arena.js";
|
|
32
|
+
import { memoryListToolDef, memoryListTool, memoryReadToolDef, memoryReadTool, memorySaveToolDef, memorySaveTool, memoryDeleteToolDef, memoryDeleteTool, } from "./memory.js";
|
|
33
|
+
export const BUILTIN_TOOLS = [
|
|
34
|
+
{
|
|
35
|
+
definition: {
|
|
36
|
+
...readToolDef,
|
|
37
|
+
source: "builtin",
|
|
38
|
+
permissionDefault: "allow",
|
|
39
|
+
isReadOnly: true,
|
|
40
|
+
isConcurrencySafe: true,
|
|
41
|
+
},
|
|
42
|
+
execute: readTool,
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
definition: {
|
|
46
|
+
...writeToolDef,
|
|
47
|
+
source: "builtin",
|
|
48
|
+
permissionDefault: "ask",
|
|
49
|
+
isReadOnly: false,
|
|
50
|
+
isConcurrencySafe: false,
|
|
51
|
+
},
|
|
52
|
+
execute: writeTool,
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
definition: {
|
|
56
|
+
...editToolDef,
|
|
57
|
+
source: "builtin",
|
|
58
|
+
permissionDefault: "ask",
|
|
59
|
+
isReadOnly: false,
|
|
60
|
+
isConcurrencySafe: false,
|
|
61
|
+
},
|
|
62
|
+
execute: editTool,
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
definition: {
|
|
66
|
+
...applyPatchToolDef,
|
|
67
|
+
source: "builtin",
|
|
68
|
+
permissionDefault: "ask",
|
|
69
|
+
isReadOnly: false,
|
|
70
|
+
isConcurrencySafe: false,
|
|
71
|
+
},
|
|
72
|
+
execute: applyPatchTool,
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
definition: {
|
|
76
|
+
...globToolDef,
|
|
77
|
+
source: "builtin",
|
|
78
|
+
permissionDefault: "allow",
|
|
79
|
+
isReadOnly: true,
|
|
80
|
+
isConcurrencySafe: true,
|
|
81
|
+
},
|
|
82
|
+
execute: globTool,
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
definition: {
|
|
86
|
+
...grepToolDef,
|
|
87
|
+
source: "builtin",
|
|
88
|
+
permissionDefault: "allow",
|
|
89
|
+
isReadOnly: true,
|
|
90
|
+
isConcurrencySafe: true,
|
|
91
|
+
},
|
|
92
|
+
execute: grepTool,
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
definition: {
|
|
96
|
+
...bashToolDef,
|
|
97
|
+
source: "builtin",
|
|
98
|
+
permissionDefault: "ask",
|
|
99
|
+
isReadOnly: false,
|
|
100
|
+
isConcurrencySafe: false,
|
|
101
|
+
timeoutMs: 3_600_000, // 1h — supports long-running shell loops (e.g. `until` polling)
|
|
102
|
+
},
|
|
103
|
+
execute: bashTool,
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
definition: {
|
|
107
|
+
...webSearchToolDef,
|
|
108
|
+
source: "builtin",
|
|
109
|
+
permissionDefault: "allow",
|
|
110
|
+
isReadOnly: true,
|
|
111
|
+
isConcurrencySafe: true,
|
|
112
|
+
},
|
|
113
|
+
execute: webSearchTool,
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
definition: {
|
|
117
|
+
...webFetchToolDef,
|
|
118
|
+
source: "builtin",
|
|
119
|
+
permissionDefault: "allow",
|
|
120
|
+
isReadOnly: true,
|
|
121
|
+
isConcurrencySafe: true,
|
|
122
|
+
},
|
|
123
|
+
execute: webFetchTool,
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
definition: {
|
|
127
|
+
...askUserToolDef,
|
|
128
|
+
source: "builtin",
|
|
129
|
+
permissionDefault: "allow",
|
|
130
|
+
isReadOnly: true,
|
|
131
|
+
isConcurrencySafe: false,
|
|
132
|
+
timeoutMs: 0, // 纯等待用户操作 — 不设超时,由用户 Esc/取消
|
|
133
|
+
},
|
|
134
|
+
execute: askUserTool,
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
definition: {
|
|
138
|
+
...agentToolDef,
|
|
139
|
+
source: "builtin",
|
|
140
|
+
permissionDefault: "allow",
|
|
141
|
+
isReadOnly: true,
|
|
142
|
+
isConcurrencySafe: true,
|
|
143
|
+
timeoutMs: 1_800_000, // 30min — sub-agent runs may execute many tool calls
|
|
144
|
+
},
|
|
145
|
+
execute: agentTool,
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
definition: {
|
|
149
|
+
...agentStatusToolDef,
|
|
150
|
+
source: "builtin",
|
|
151
|
+
permissionDefault: "allow",
|
|
152
|
+
isReadOnly: true,
|
|
153
|
+
isConcurrencySafe: true,
|
|
154
|
+
},
|
|
155
|
+
execute: agentStatusTool,
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
definition: {
|
|
159
|
+
...agentCancelToolDef,
|
|
160
|
+
source: "builtin",
|
|
161
|
+
permissionDefault: "allow",
|
|
162
|
+
isReadOnly: false,
|
|
163
|
+
isConcurrencySafe: false,
|
|
164
|
+
},
|
|
165
|
+
execute: agentCancelTool,
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
definition: {
|
|
169
|
+
...enterPlanModeToolDef,
|
|
170
|
+
source: "builtin",
|
|
171
|
+
permissionDefault: "allow",
|
|
172
|
+
isReadOnly: true,
|
|
173
|
+
isConcurrencySafe: false,
|
|
174
|
+
},
|
|
175
|
+
execute: enterPlanModeTool,
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
definition: {
|
|
179
|
+
...exitPlanModeToolDef,
|
|
180
|
+
source: "builtin",
|
|
181
|
+
permissionDefault: "allow",
|
|
182
|
+
isReadOnly: true,
|
|
183
|
+
isConcurrencySafe: false,
|
|
184
|
+
},
|
|
185
|
+
execute: exitPlanModeTool,
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
definition: {
|
|
189
|
+
...toolSearchToolDef,
|
|
190
|
+
source: "builtin",
|
|
191
|
+
permissionDefault: "allow",
|
|
192
|
+
isReadOnly: true,
|
|
193
|
+
isConcurrencySafe: true,
|
|
194
|
+
},
|
|
195
|
+
execute: toolSearchTool,
|
|
196
|
+
},
|
|
197
|
+
{
|
|
198
|
+
definition: {
|
|
199
|
+
...todoWriteToolDef,
|
|
200
|
+
source: "builtin",
|
|
201
|
+
permissionDefault: "allow",
|
|
202
|
+
isReadOnly: false,
|
|
203
|
+
isConcurrencySafe: false,
|
|
204
|
+
},
|
|
205
|
+
execute: todoWriteTool,
|
|
206
|
+
},
|
|
207
|
+
// ─── Phase 4: Multi-Agent + Worktree ───────────────────────────
|
|
208
|
+
{
|
|
209
|
+
definition: {
|
|
210
|
+
...enterWorktreeToolDef,
|
|
211
|
+
source: "builtin",
|
|
212
|
+
permissionDefault: "ask",
|
|
213
|
+
isReadOnly: false,
|
|
214
|
+
isConcurrencySafe: false,
|
|
215
|
+
},
|
|
216
|
+
execute: enterWorktreeTool,
|
|
217
|
+
},
|
|
218
|
+
{
|
|
219
|
+
definition: {
|
|
220
|
+
...exitWorktreeToolDef,
|
|
221
|
+
source: "builtin",
|
|
222
|
+
permissionDefault: "ask",
|
|
223
|
+
isReadOnly: false,
|
|
224
|
+
isConcurrencySafe: false,
|
|
225
|
+
},
|
|
226
|
+
execute: exitWorktreeTool,
|
|
227
|
+
},
|
|
228
|
+
{
|
|
229
|
+
definition: {
|
|
230
|
+
...sendMessageToolDef,
|
|
231
|
+
source: "builtin",
|
|
232
|
+
permissionDefault: "allow",
|
|
233
|
+
isReadOnly: false,
|
|
234
|
+
isConcurrencySafe: true,
|
|
235
|
+
},
|
|
236
|
+
execute: sendMessageTool,
|
|
237
|
+
},
|
|
238
|
+
// ─── Phase 5: Utility Tools ────────────────────────────────────
|
|
239
|
+
{
|
|
240
|
+
definition: {
|
|
241
|
+
...sleepToolDef,
|
|
242
|
+
source: "builtin",
|
|
243
|
+
permissionDefault: "allow",
|
|
244
|
+
isReadOnly: true,
|
|
245
|
+
isConcurrencySafe: true,
|
|
246
|
+
},
|
|
247
|
+
execute: sleepTool,
|
|
248
|
+
},
|
|
249
|
+
{
|
|
250
|
+
definition: {
|
|
251
|
+
...configToolDef,
|
|
252
|
+
source: "builtin",
|
|
253
|
+
permissionDefault: "ask",
|
|
254
|
+
isReadOnly: false,
|
|
255
|
+
isConcurrencySafe: false,
|
|
256
|
+
},
|
|
257
|
+
execute: configTool,
|
|
258
|
+
},
|
|
259
|
+
{
|
|
260
|
+
definition: {
|
|
261
|
+
...notebookEditToolDef,
|
|
262
|
+
source: "builtin",
|
|
263
|
+
permissionDefault: "ask",
|
|
264
|
+
isReadOnly: false,
|
|
265
|
+
isConcurrencySafe: false,
|
|
266
|
+
},
|
|
267
|
+
execute: notebookEditTool,
|
|
268
|
+
},
|
|
269
|
+
// ─── Phase 6: LSP ─────────────────────────────────────────────
|
|
270
|
+
{
|
|
271
|
+
definition: {
|
|
272
|
+
...lspToolDef,
|
|
273
|
+
source: "builtin",
|
|
274
|
+
permissionDefault: "allow",
|
|
275
|
+
isReadOnly: true,
|
|
276
|
+
isConcurrencySafe: true,
|
|
277
|
+
},
|
|
278
|
+
execute: lspTool,
|
|
279
|
+
},
|
|
280
|
+
// ─── Cron Tools ────────────────────────────────────────────────
|
|
281
|
+
{
|
|
282
|
+
definition: {
|
|
283
|
+
...cronCreateToolDef,
|
|
284
|
+
source: "builtin",
|
|
285
|
+
permissionDefault: "ask",
|
|
286
|
+
isReadOnly: false,
|
|
287
|
+
isConcurrencySafe: false,
|
|
288
|
+
},
|
|
289
|
+
execute: cronCreateTool,
|
|
290
|
+
},
|
|
291
|
+
{
|
|
292
|
+
definition: {
|
|
293
|
+
...cronDeleteToolDef,
|
|
294
|
+
source: "builtin",
|
|
295
|
+
permissionDefault: "ask",
|
|
296
|
+
isReadOnly: false,
|
|
297
|
+
isConcurrencySafe: false,
|
|
298
|
+
},
|
|
299
|
+
execute: cronDeleteTool,
|
|
300
|
+
},
|
|
301
|
+
{
|
|
302
|
+
definition: {
|
|
303
|
+
...cronListToolDef,
|
|
304
|
+
source: "builtin",
|
|
305
|
+
permissionDefault: "allow",
|
|
306
|
+
isReadOnly: true,
|
|
307
|
+
isConcurrencySafe: true,
|
|
308
|
+
},
|
|
309
|
+
execute: cronListTool,
|
|
310
|
+
},
|
|
311
|
+
// ─── Phase 7: Missing tools from restored-src ─────────────────
|
|
312
|
+
{
|
|
313
|
+
definition: {
|
|
314
|
+
...skillToolDef,
|
|
315
|
+
source: "builtin",
|
|
316
|
+
permissionDefault: "allow",
|
|
317
|
+
isReadOnly: true,
|
|
318
|
+
isConcurrencySafe: true,
|
|
319
|
+
},
|
|
320
|
+
execute: skillTool,
|
|
321
|
+
},
|
|
322
|
+
{
|
|
323
|
+
definition: {
|
|
324
|
+
...mcpToolDef,
|
|
325
|
+
source: "builtin",
|
|
326
|
+
permissionDefault: "ask",
|
|
327
|
+
isReadOnly: false,
|
|
328
|
+
isConcurrencySafe: true,
|
|
329
|
+
},
|
|
330
|
+
execute: mcpToolExecute,
|
|
331
|
+
},
|
|
332
|
+
{
|
|
333
|
+
definition: {
|
|
334
|
+
...listMcpResourcesToolDef,
|
|
335
|
+
source: "builtin",
|
|
336
|
+
permissionDefault: "allow",
|
|
337
|
+
isReadOnly: true,
|
|
338
|
+
isConcurrencySafe: true,
|
|
339
|
+
},
|
|
340
|
+
execute: listMcpResourcesTool,
|
|
341
|
+
},
|
|
342
|
+
{
|
|
343
|
+
definition: {
|
|
344
|
+
...readMcpResourceToolDef,
|
|
345
|
+
source: "builtin",
|
|
346
|
+
permissionDefault: "allow",
|
|
347
|
+
isReadOnly: true,
|
|
348
|
+
isConcurrencySafe: true,
|
|
349
|
+
},
|
|
350
|
+
execute: readMcpResourceTool,
|
|
351
|
+
},
|
|
352
|
+
{
|
|
353
|
+
definition: {
|
|
354
|
+
...remoteTriggerToolDef,
|
|
355
|
+
source: "builtin",
|
|
356
|
+
permissionDefault: "ask",
|
|
357
|
+
isReadOnly: false,
|
|
358
|
+
isConcurrencySafe: false,
|
|
359
|
+
},
|
|
360
|
+
execute: remoteTriggerTool,
|
|
361
|
+
},
|
|
362
|
+
{
|
|
363
|
+
definition: {
|
|
364
|
+
...replToolDef,
|
|
365
|
+
source: "builtin",
|
|
366
|
+
permissionDefault: "ask",
|
|
367
|
+
isReadOnly: false,
|
|
368
|
+
isConcurrencySafe: false,
|
|
369
|
+
},
|
|
370
|
+
execute: replTool,
|
|
371
|
+
},
|
|
372
|
+
{
|
|
373
|
+
definition: {
|
|
374
|
+
...briefToolDef,
|
|
375
|
+
source: "builtin",
|
|
376
|
+
permissionDefault: "allow",
|
|
377
|
+
isReadOnly: true,
|
|
378
|
+
isConcurrencySafe: true,
|
|
379
|
+
},
|
|
380
|
+
execute: briefTool,
|
|
381
|
+
},
|
|
382
|
+
{
|
|
383
|
+
definition: {
|
|
384
|
+
...powershellToolDef,
|
|
385
|
+
source: "builtin",
|
|
386
|
+
permissionDefault: "ask",
|
|
387
|
+
isReadOnly: false,
|
|
388
|
+
isConcurrencySafe: false,
|
|
389
|
+
},
|
|
390
|
+
execute: powershellTool,
|
|
391
|
+
},
|
|
392
|
+
// ─── Arena: Multi-Model Collaborative Analysis ────────────────
|
|
393
|
+
{
|
|
394
|
+
definition: {
|
|
395
|
+
...arenaToolDef,
|
|
396
|
+
source: "builtin",
|
|
397
|
+
permissionDefault: "ask",
|
|
398
|
+
isReadOnly: true,
|
|
399
|
+
isConcurrencySafe: false,
|
|
400
|
+
timeoutMs: 1_800_000, // 30min — multi-model debate rounds take time
|
|
401
|
+
},
|
|
402
|
+
execute: arenaTool,
|
|
403
|
+
},
|
|
404
|
+
// ─── Memory tools (persistent cross-session memory) ────────────
|
|
405
|
+
// Save/Delete default to "ask" so user-scope modifications go through a
|
|
406
|
+
// permission prompt; dream-scope is whitelisted via a PermissionRule in
|
|
407
|
+
// Engine.buildPermissionConfig so the LLM can freely manage its own
|
|
408
|
+
// workspace without prompting.
|
|
409
|
+
{
|
|
410
|
+
definition: {
|
|
411
|
+
...memoryListToolDef,
|
|
412
|
+
source: "builtin",
|
|
413
|
+
permissionDefault: "allow",
|
|
414
|
+
isReadOnly: true,
|
|
415
|
+
isConcurrencySafe: true,
|
|
416
|
+
},
|
|
417
|
+
execute: memoryListTool,
|
|
418
|
+
},
|
|
419
|
+
{
|
|
420
|
+
definition: {
|
|
421
|
+
...memoryReadToolDef,
|
|
422
|
+
source: "builtin",
|
|
423
|
+
permissionDefault: "allow",
|
|
424
|
+
isReadOnly: true,
|
|
425
|
+
isConcurrencySafe: true,
|
|
426
|
+
},
|
|
427
|
+
execute: memoryReadTool,
|
|
428
|
+
},
|
|
429
|
+
{
|
|
430
|
+
definition: {
|
|
431
|
+
...memorySaveToolDef,
|
|
432
|
+
source: "builtin",
|
|
433
|
+
permissionDefault: "ask",
|
|
434
|
+
isReadOnly: false,
|
|
435
|
+
isConcurrencySafe: false,
|
|
436
|
+
},
|
|
437
|
+
execute: memorySaveTool,
|
|
438
|
+
},
|
|
439
|
+
{
|
|
440
|
+
definition: {
|
|
441
|
+
...memoryDeleteToolDef,
|
|
442
|
+
source: "builtin",
|
|
443
|
+
permissionDefault: "ask",
|
|
444
|
+
isReadOnly: false,
|
|
445
|
+
isConcurrencySafe: false,
|
|
446
|
+
},
|
|
447
|
+
execute: memoryDeleteTool,
|
|
448
|
+
},
|
|
449
|
+
];
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LSPTool — language server protocol operations for code intelligence.
|
|
3
|
+
*/
|
|
4
|
+
import type { ToolDefinition } from "../../types.js";
|
|
5
|
+
export declare const lspToolDef: ToolDefinition;
|
|
6
|
+
export declare function lspTool(args: Record<string, unknown>): Promise<string>;
|