@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,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared formatting utilities for tool call display.
|
|
3
|
+
*
|
|
4
|
+
* Used by both:
|
|
5
|
+
* - ui/components/ToolCall.tsx (Ink REPL)
|
|
6
|
+
* - cli/output/renderer.ts (headless text output)
|
|
7
|
+
*/
|
|
8
|
+
/** Maximum preview lines for tool output. */
|
|
9
|
+
export declare const MAX_PREVIEW_LINES = 4;
|
|
10
|
+
export declare const MAX_LINE_WIDTH = 88;
|
|
11
|
+
/** Tool name → display color for the dot indicator. */
|
|
12
|
+
export declare const TOOL_DOT_COLORS: Record<string, string>;
|
|
13
|
+
/**
|
|
14
|
+
* Format tool arguments into a compact one-line summary.
|
|
15
|
+
*/
|
|
16
|
+
export declare function formatToolArgs(toolName: string, args: Record<string, unknown>): string;
|
|
17
|
+
/** Truncate a string to max length with ellipsis. */
|
|
18
|
+
export declare function truncate(s: string, max: number): string;
|
|
19
|
+
/** Collapse multiline text to a single line. */
|
|
20
|
+
export declare function singleLine(s: string): string;
|
|
21
|
+
/** Format byte count in human-readable form. */
|
|
22
|
+
export declare function formatBytes(n: number): string;
|
|
23
|
+
export interface CompactResult {
|
|
24
|
+
summary: string;
|
|
25
|
+
preview: string[];
|
|
26
|
+
moreLines: number;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Produce a compact summary of tool output for display.
|
|
30
|
+
*/
|
|
31
|
+
export declare function compactOutput(toolName: string, content: string): CompactResult;
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared formatting utilities for tool call display.
|
|
3
|
+
*
|
|
4
|
+
* Used by both:
|
|
5
|
+
* - ui/components/ToolCall.tsx (Ink REPL)
|
|
6
|
+
* - cli/output/renderer.ts (headless text output)
|
|
7
|
+
*/
|
|
8
|
+
import { sep } from "node:path";
|
|
9
|
+
/** Maximum preview lines for tool output. */
|
|
10
|
+
export const MAX_PREVIEW_LINES = 4;
|
|
11
|
+
export const MAX_LINE_WIDTH = 88;
|
|
12
|
+
/**
|
|
13
|
+
* Argument keys that carry filesystem paths. Values for these keys are
|
|
14
|
+
* relativized against process.cwd() before display so users see
|
|
15
|
+
* "src/ui/App.tsx" instead of "/Users/.../codeshell/src/ui/App.tsx".
|
|
16
|
+
*/
|
|
17
|
+
const PATH_ARG_KEYS = new Set(["file_path", "path", "directory", "cwd"]);
|
|
18
|
+
/**
|
|
19
|
+
* Strip the cwd prefix from a path string for display. Paths outside
|
|
20
|
+
* cwd, relative paths, and non-string values are returned unchanged.
|
|
21
|
+
*/
|
|
22
|
+
function relativizePath(value) {
|
|
23
|
+
if (!value || !value.startsWith("/"))
|
|
24
|
+
return value;
|
|
25
|
+
const cwd = process.cwd();
|
|
26
|
+
const prefix = cwd.endsWith(sep) ? cwd : cwd + sep;
|
|
27
|
+
if (value === cwd)
|
|
28
|
+
return ".";
|
|
29
|
+
if (value.startsWith(prefix))
|
|
30
|
+
return value.slice(prefix.length);
|
|
31
|
+
return value;
|
|
32
|
+
}
|
|
33
|
+
/** Tool name → display color for the dot indicator. */
|
|
34
|
+
export const TOOL_DOT_COLORS = {
|
|
35
|
+
Read: "ansi:blue",
|
|
36
|
+
Write: "ansi:green",
|
|
37
|
+
Edit: "ansi:yellow",
|
|
38
|
+
Bash: "ansi:magenta",
|
|
39
|
+
Glob: "ansi:blue",
|
|
40
|
+
Grep: "ansi:blue",
|
|
41
|
+
Agent: "ansi:cyan",
|
|
42
|
+
WebSearch: "ansi:blue",
|
|
43
|
+
WebFetch: "ansi:blue",
|
|
44
|
+
LSP: "ansi:cyan",
|
|
45
|
+
TodoWrite: "ansi:cyan",
|
|
46
|
+
};
|
|
47
|
+
/** Mapping of tool names to their most informative argument keys. */
|
|
48
|
+
const TOOL_ARG_KEYS = {
|
|
49
|
+
Read: ["file_path"],
|
|
50
|
+
Write: ["file_path"],
|
|
51
|
+
Edit: ["file_path"],
|
|
52
|
+
Glob: ["pattern"],
|
|
53
|
+
Grep: ["pattern", "path"],
|
|
54
|
+
Bash: ["command"],
|
|
55
|
+
WebSearch: ["query"],
|
|
56
|
+
WebFetch: ["url"],
|
|
57
|
+
Agent: ["description"],
|
|
58
|
+
TodoWrite: ["todos"],
|
|
59
|
+
Sleep: ["seconds"],
|
|
60
|
+
EnterWorktree: ["slug"],
|
|
61
|
+
SendMessage: ["to"],
|
|
62
|
+
CronCreate: ["name", "schedule"],
|
|
63
|
+
LSP: ["action", "file_path"],
|
|
64
|
+
NotebookEdit: ["action", "file_path"],
|
|
65
|
+
Config: ["action", "key"],
|
|
66
|
+
};
|
|
67
|
+
/**
|
|
68
|
+
* Strip a leading `cd <dir> && ` (or `; `) so the visible command is the
|
|
69
|
+
* thing the user actually cares about. The cwd prefix is mechanical noise
|
|
70
|
+
* that otherwise eats the entire truncation budget on long absolute paths.
|
|
71
|
+
*/
|
|
72
|
+
function stripCdPrefix(cmd) {
|
|
73
|
+
// Matches: cd <path> && rest | cd "<path with spaces>" && rest | cd '...'; rest
|
|
74
|
+
const m = cmd.match(/^\s*cd\s+(?:"[^"]*"|'[^']*'|\S+)\s*(?:&&|;)\s*(.+)$/s);
|
|
75
|
+
return m ? m[1].trim() : cmd;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Format tool arguments into a compact one-line summary.
|
|
79
|
+
*/
|
|
80
|
+
export function formatToolArgs(toolName, args) {
|
|
81
|
+
const keys = TOOL_ARG_KEYS[toolName] ?? Object.keys(args).slice(0, 2);
|
|
82
|
+
const parts = [];
|
|
83
|
+
for (const k of keys) {
|
|
84
|
+
let v = args[k];
|
|
85
|
+
if (v !== undefined && !k.startsWith("__")) {
|
|
86
|
+
let s = String(v);
|
|
87
|
+
if (toolName === "Bash" && k === "command")
|
|
88
|
+
s = stripCdPrefix(s);
|
|
89
|
+
else if (PATH_ARG_KEYS.has(k))
|
|
90
|
+
s = relativizePath(s);
|
|
91
|
+
// Bash commands deserve more room than other args — the truncation
|
|
92
|
+
// budget here used to swallow `git diff …` after a long cd prefix.
|
|
93
|
+
const max = toolName === "Bash" && k === "command" ? MAX_LINE_WIDTH : 60;
|
|
94
|
+
parts.push(truncate(s, max));
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
// Read often pages large files via offset/limit — show a range suffix so
|
|
98
|
+
// back-to-back reads of the same file are visually distinguishable.
|
|
99
|
+
if (toolName === "Read") {
|
|
100
|
+
const offset = typeof args.offset === "number" ? args.offset : undefined;
|
|
101
|
+
const limit = typeof args.limit === "number" ? args.limit : undefined;
|
|
102
|
+
if (offset !== undefined || limit !== undefined) {
|
|
103
|
+
const start = offset ?? 1;
|
|
104
|
+
const end = limit !== undefined ? start + limit - 1 : undefined;
|
|
105
|
+
parts.push(end !== undefined ? `:${start}-${end}` : `:${start}-`);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
return parts.length > 0 ? parts.join(" ") : truncate(JSON.stringify(args), 80);
|
|
109
|
+
}
|
|
110
|
+
/** Truncate a string to max length with ellipsis. */
|
|
111
|
+
export function truncate(s, max) {
|
|
112
|
+
return s.length > max ? s.slice(0, max - 1) + "…" : s;
|
|
113
|
+
}
|
|
114
|
+
/** Collapse multiline text to a single line. */
|
|
115
|
+
export function singleLine(s) {
|
|
116
|
+
return s.replace(/\n/g, " ").replace(/\s+/g, " ").trim();
|
|
117
|
+
}
|
|
118
|
+
/** Format byte count in human-readable form. */
|
|
119
|
+
export function formatBytes(n) {
|
|
120
|
+
if (n >= 1024 * 1024)
|
|
121
|
+
return (n / (1024 * 1024)).toFixed(1) + "MB";
|
|
122
|
+
if (n >= 1024)
|
|
123
|
+
return (n / 1024).toFixed(1) + "KB";
|
|
124
|
+
return n + "B";
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Produce a compact summary of tool output for display.
|
|
128
|
+
*/
|
|
129
|
+
export function compactOutput(toolName, content) {
|
|
130
|
+
const lines = content.split("\n");
|
|
131
|
+
const totalLines = lines.length;
|
|
132
|
+
switch (toolName) {
|
|
133
|
+
case "Read":
|
|
134
|
+
return {
|
|
135
|
+
summary: `${totalLines} lines, ${formatBytes(content.length)}`,
|
|
136
|
+
preview: [],
|
|
137
|
+
moreLines: 0,
|
|
138
|
+
};
|
|
139
|
+
case "Bash": {
|
|
140
|
+
if (totalLines <= MAX_PREVIEW_LINES) {
|
|
141
|
+
return {
|
|
142
|
+
summary: "",
|
|
143
|
+
preview: lines.map((l) => truncate(l, MAX_LINE_WIDTH)),
|
|
144
|
+
moreLines: 0,
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
return {
|
|
148
|
+
summary: `${totalLines} lines output`,
|
|
149
|
+
preview: lines.slice(0, MAX_PREVIEW_LINES).map((l) => truncate(l, MAX_LINE_WIDTH)),
|
|
150
|
+
moreLines: totalLines - MAX_PREVIEW_LINES,
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
case "Glob": {
|
|
154
|
+
const fileCount = lines.filter((l) => l.trim()).length;
|
|
155
|
+
return {
|
|
156
|
+
summary: `${fileCount} files found`,
|
|
157
|
+
preview: lines.slice(0, 5).map((l) => truncate(l, MAX_LINE_WIDTH)),
|
|
158
|
+
moreLines: Math.max(0, fileCount - 5),
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
case "Grep": {
|
|
162
|
+
const matchCount = lines.filter((l) => l.trim()).length;
|
|
163
|
+
return {
|
|
164
|
+
summary: `${matchCount} matches`,
|
|
165
|
+
preview: lines.slice(0, MAX_PREVIEW_LINES).map((l) => truncate(l, MAX_LINE_WIDTH)),
|
|
166
|
+
moreLines: Math.max(0, matchCount - MAX_PREVIEW_LINES),
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
case "Write":
|
|
170
|
+
return { summary: singleLine(content).slice(0, 60), preview: [], moreLines: 0 };
|
|
171
|
+
case "Edit":
|
|
172
|
+
return { summary: singleLine(content).slice(0, 70), preview: [], moreLines: 0 };
|
|
173
|
+
case "Agent":
|
|
174
|
+
return { summary: truncate(singleLine(content), 80), preview: [], moreLines: 0 };
|
|
175
|
+
case "TodoWrite":
|
|
176
|
+
return { summary: singleLine(content), preview: [], moreLines: 0 };
|
|
177
|
+
default: {
|
|
178
|
+
if (totalLines <= 1) {
|
|
179
|
+
return { summary: truncate(content, 80), preview: [], moreLines: 0 };
|
|
180
|
+
}
|
|
181
|
+
return {
|
|
182
|
+
summary: `${totalLines} lines`,
|
|
183
|
+
preview: lines.slice(0, MAX_PREVIEW_LINES).map((l) => truncate(l, MAX_LINE_WIDTH)),
|
|
184
|
+
moreLines: Math.max(0, totalLines - MAX_PREVIEW_LINES),
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@cjhyy/code-shell-core",
|
|
3
|
+
"version": "0.5.0-rc.0",
|
|
4
|
+
"description": "Core engine for code-shell — agent orchestration, tool execution, hooks, protocol. UI-agnostic.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"import": "./dist/index.js"
|
|
12
|
+
},
|
|
13
|
+
"./bin/agent-server-stdio": "./dist/cli/agent-server-stdio.js"
|
|
14
|
+
},
|
|
15
|
+
"sideEffects": [
|
|
16
|
+
"./dist/data/*.json",
|
|
17
|
+
"./dist/prompt/sections/*.md"
|
|
18
|
+
],
|
|
19
|
+
"files": [
|
|
20
|
+
"dist",
|
|
21
|
+
"README.md",
|
|
22
|
+
"LICENSE"
|
|
23
|
+
],
|
|
24
|
+
"scripts": {
|
|
25
|
+
"build": "tsc -p tsconfig.json && mkdir -p dist/prompt/sections dist/data && cp src/prompt/sections/*.md dist/prompt/sections/ && cp src/data/*.json dist/data/",
|
|
26
|
+
"clean": "rm -rf dist"
|
|
27
|
+
},
|
|
28
|
+
"dependencies": {
|
|
29
|
+
"@anthropic-ai/sdk": "^0.39.0",
|
|
30
|
+
"@modelcontextprotocol/sdk": "^1.12.1",
|
|
31
|
+
"glob": "^11.0.0",
|
|
32
|
+
"gpt-tokenizer": "^3.4.0",
|
|
33
|
+
"nanoid": "^5.1.2",
|
|
34
|
+
"openai": "^4.82.0",
|
|
35
|
+
"proper-lockfile": "^4.1.2",
|
|
36
|
+
"semver": "^7.7.4",
|
|
37
|
+
"strip-ansi": "^7.2.0",
|
|
38
|
+
"yaml": "^2.7.0",
|
|
39
|
+
"zod": "^3.24.2"
|
|
40
|
+
},
|
|
41
|
+
"engines": {
|
|
42
|
+
"node": ">=20.10"
|
|
43
|
+
},
|
|
44
|
+
"repository": {
|
|
45
|
+
"type": "git",
|
|
46
|
+
"url": "git+https://github.com/cjhyy/codeshell.git",
|
|
47
|
+
"directory": "packages/core"
|
|
48
|
+
},
|
|
49
|
+
"homepage": "https://github.com/cjhyy/codeshell/tree/main/packages/core#readme",
|
|
50
|
+
"bugs": {
|
|
51
|
+
"url": "https://github.com/cjhyy/codeshell/issues"
|
|
52
|
+
},
|
|
53
|
+
"license": "MIT",
|
|
54
|
+
"keywords": [
|
|
55
|
+
"ai",
|
|
56
|
+
"agent",
|
|
57
|
+
"orchestration",
|
|
58
|
+
"agent-framework",
|
|
59
|
+
"claude-code",
|
|
60
|
+
"claude",
|
|
61
|
+
"openai",
|
|
62
|
+
"anthropic",
|
|
63
|
+
"mcp",
|
|
64
|
+
"llm",
|
|
65
|
+
"tool-use",
|
|
66
|
+
"function-calling",
|
|
67
|
+
"headless"
|
|
68
|
+
],
|
|
69
|
+
"publishConfig": {
|
|
70
|
+
"access": "public"
|
|
71
|
+
}
|
|
72
|
+
}
|