@cjhyy/code-shell-core 0.5.0-rc.2 → 0.6.0-rc.2
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/README.md +13 -10
- package/dist/agent/agent-definition-registry.d.ts +3 -0
- package/dist/agent/agent-definition-registry.js +3 -1
- package/dist/agent/agent-definition.d.ts +15 -0
- package/dist/agent/agent-definition.js +27 -3
- package/dist/arena/context/context-tools.js +47 -4
- package/dist/arena/ledger.js +9 -1
- package/dist/arena/strategies/utils.d.ts +1 -4
- package/dist/arena/strategies/utils.js +7 -84
- package/dist/automation/cron-expr.d.ts +10 -0
- package/dist/automation/cron-expr.js +23 -5
- package/dist/automation/runner.d.ts +21 -4
- package/dist/automation/runner.js +48 -12
- package/dist/automation/scheduler.d.ts +38 -0
- package/dist/automation/scheduler.js +89 -12
- package/dist/automation/store.js +5 -2
- package/dist/capability-control/disabled-lists.d.ts +25 -0
- package/dist/capability-control/disabled-lists.js +57 -0
- package/dist/capability-control/overlay.d.ts +15 -0
- package/dist/capability-control/overlay.js +27 -0
- package/dist/cc-orchestrator/agent-adapter.d.ts +50 -0
- package/dist/cc-orchestrator/agent-adapter.js +133 -0
- package/dist/cc-orchestrator/cc-capability.d.ts +19 -0
- package/dist/cc-orchestrator/cc-capability.js +53 -0
- package/dist/cc-orchestrator/codex-session-discovery.d.ts +24 -0
- package/dist/cc-orchestrator/codex-session-discovery.js +191 -0
- package/dist/cc-orchestrator/codex-session-history.d.ts +25 -0
- package/dist/cc-orchestrator/codex-session-history.js +187 -0
- package/dist/cc-orchestrator/external-agent-changes.d.ts +19 -0
- package/dist/cc-orchestrator/external-agent-changes.js +214 -0
- package/dist/cc-orchestrator/external-agent-driver.d.ts +18 -0
- package/dist/cc-orchestrator/external-agent-driver.js +69 -0
- package/dist/cc-orchestrator/index.d.ts +8 -0
- package/dist/cc-orchestrator/index.js +8 -0
- package/dist/cc-orchestrator/relevance-judge.d.ts +15 -0
- package/dist/cc-orchestrator/relevance-judge.js +29 -0
- package/dist/cc-orchestrator/session-discovery.d.ts +46 -0
- package/dist/cc-orchestrator/session-discovery.js +125 -0
- package/dist/cc-orchestrator/session-history.d.ts +19 -0
- package/dist/cc-orchestrator/session-history.js +67 -0
- package/dist/cli/agent-server-stdio.d.ts +15 -1
- package/dist/cli/agent-server-stdio.js +115 -17
- package/dist/cli/agent-server-tcp.js +40 -26
- package/dist/context/compaction.d.ts +56 -0
- package/dist/context/compaction.js +186 -0
- package/dist/context/manager.js +25 -4
- package/dist/cost-tracker.js +5 -61
- package/dist/credentials/cipher.d.ts +49 -0
- package/dist/credentials/cipher.js +45 -0
- package/dist/credentials/cookie-jar.d.ts +24 -0
- package/dist/credentials/cookie-jar.js +40 -0
- package/dist/credentials/index.d.ts +7 -0
- package/dist/credentials/index.js +5 -0
- package/dist/credentials/inject-credential-tool.d.ts +20 -0
- package/dist/credentials/inject-credential-tool.js +130 -0
- package/dist/credentials/store.d.ts +72 -0
- package/dist/credentials/store.js +184 -0
- package/dist/credentials/types.d.ts +56 -0
- package/dist/credentials/use-credential-tool.d.ts +29 -0
- package/dist/credentials/use-credential-tool.js +205 -0
- package/dist/credentials/use-gate.d.ts +56 -0
- package/dist/credentials/use-gate.js +52 -0
- package/dist/data/model-metadata.d.ts +77 -0
- package/dist/data/model-metadata.js +56 -0
- package/dist/data/model-metadata.json +216 -0
- package/dist/data/openrouter-models.d.ts +18 -7
- package/dist/data/openrouter-models.js +35 -8
- package/dist/engine/aux-key.d.ts +10 -0
- package/dist/engine/aux-key.js +11 -0
- package/dist/engine/dynamic-tool-defs.d.ts +19 -0
- package/dist/engine/dynamic-tool-defs.js +36 -0
- package/dist/engine/engine.d.ts +267 -138
- package/dist/engine/engine.js +957 -191
- package/dist/engine/friendly-error.d.ts +18 -0
- package/dist/engine/friendly-error.js +63 -0
- package/dist/engine/goal.d.ts +145 -0
- package/dist/engine/goal.js +144 -0
- package/dist/engine/image-policy.d.ts +13 -0
- package/dist/engine/image-policy.js +24 -0
- package/dist/engine/model-connections-pool.d.ts +17 -0
- package/dist/engine/model-connections-pool.js +66 -0
- package/dist/engine/model-facade.d.ts +10 -0
- package/dist/engine/model-facade.js +25 -0
- package/dist/engine/patch-orphaned-tools.js +3 -0
- package/dist/engine/resolve-llm-config.d.ts +16 -0
- package/dist/engine/resolve-llm-config.js +44 -0
- package/dist/engine/runtime.js +2 -1
- package/dist/engine/sandbox-cache-key.d.ts +10 -0
- package/dist/engine/sandbox-cache-key.js +9 -0
- package/dist/engine/sandbox-config.d.ts +31 -0
- package/dist/engine/sandbox-config.js +38 -0
- package/dist/engine/session-usage.d.ts +19 -0
- package/dist/engine/session-usage.js +25 -0
- package/dist/engine/steer-queue.d.ts +32 -0
- package/dist/engine/steer-queue.js +26 -0
- package/dist/engine/streaming-tool-queue.d.ts +12 -0
- package/dist/engine/streaming-tool-queue.js +50 -10
- package/dist/engine/turn-loop.d.ts +67 -3
- package/dist/engine/turn-loop.js +292 -41
- package/dist/engine/types.d.ts +175 -0
- package/dist/engine/types.js +13 -0
- package/dist/external-agents/config.d.ts +2 -0
- package/dist/external-agents/config.js +15 -0
- package/dist/external-agents/types.d.ts +31 -0
- package/dist/external-agents/types.js +1 -0
- package/dist/git/utils.js +11 -6
- package/dist/git/worktree.d.ts +48 -0
- package/dist/git/worktree.js +86 -10
- package/dist/hooks/goal-stop-hook.d.ts +28 -0
- package/dist/hooks/goal-stop-hook.js +186 -9
- package/dist/hooks/registry.d.ts +8 -0
- package/dist/hooks/registry.js +19 -0
- package/dist/hooks/shell-runner.js +10 -21
- package/dist/index.d.ts +49 -6
- package/dist/index.js +60 -4
- package/dist/llm/capabilities/param-specs.d.ts +14 -0
- package/dist/llm/capabilities/param-specs.js +62 -0
- package/dist/llm/capabilities/rules.js +4 -0
- package/dist/llm/capabilities/types.d.ts +10 -0
- package/dist/llm/client-base.d.ts +28 -1
- package/dist/llm/client-base.js +119 -13
- package/dist/llm/model-cache.js +4 -2
- package/dist/llm/model-pool.d.ts +14 -0
- package/dist/llm/model-pool.js +13 -0
- package/dist/llm/provider-auth.d.ts +41 -0
- package/dist/llm/provider-auth.js +76 -0
- package/dist/llm/provider-catalog.d.ts +4 -0
- package/dist/llm/providers/anthropic.js +64 -14
- package/dist/llm/providers/openai.d.ts +36 -0
- package/dist/llm/providers/openai.js +257 -51
- package/dist/llm/reasoning-setting.d.ts +3 -3
- package/dist/llm/reasoning-setting.js +9 -1
- package/dist/llm/stream-watchdog.js +5 -1
- package/dist/llm/token-counter.js +9 -2
- package/dist/llm/types.d.ts +4 -0
- package/dist/logging/sanitize-messages.js +22 -0
- package/dist/lsp/manager.d.ts +1 -1
- package/dist/lsp/manager.js +40 -10
- package/dist/model-catalog/builtin.d.ts +12 -0
- package/dist/model-catalog/builtin.js +407 -0
- package/dist/model-catalog/gen-connections.d.ts +20 -0
- package/dist/model-catalog/gen-connections.js +28 -0
- package/dist/model-catalog/index.d.ts +41 -0
- package/dist/model-catalog/index.js +90 -0
- package/dist/model-catalog/params.d.ts +20 -0
- package/dist/model-catalog/params.js +45 -0
- package/dist/model-catalog/resolve.d.ts +48 -0
- package/dist/model-catalog/resolve.js +33 -0
- package/dist/model-catalog/save-entry.d.ts +32 -0
- package/dist/model-catalog/save-entry.js +104 -0
- package/dist/model-catalog/types.d.ts +561 -0
- package/dist/model-catalog/types.js +93 -0
- package/dist/model-catalog/upsert.d.ts +9 -0
- package/dist/model-catalog/upsert.js +8 -0
- package/dist/onboarding.d.ts +12 -82
- package/dist/onboarding.js +61 -326
- package/dist/plugins/gitOps.d.ts +19 -0
- package/dist/plugins/gitOps.js +73 -4
- package/dist/plugins/installer/checkUpdate.d.ts +16 -0
- package/dist/plugins/installer/checkUpdate.js +32 -0
- package/dist/plugins/installer/codex/convertCommands.d.ts +19 -0
- package/dist/plugins/installer/codex/convertCommands.js +46 -0
- package/dist/plugins/installer/codex/convertMcp.d.ts +5 -2
- package/dist/plugins/installer/codex/convertMcp.js +45 -5
- package/dist/plugins/installer/install.js +25 -1
- package/dist/plugins/installer/installFromArchive.d.ts +43 -0
- package/dist/plugins/installer/installFromArchive.js +134 -0
- package/dist/plugins/installer/installFromSource.js +8 -2
- package/dist/plugins/installer/loadPluginAgents.js +6 -2
- package/dist/plugins/installer/loadPluginMcp.d.ts +9 -2
- package/dist/plugins/installer/loadPluginMcp.js +35 -2
- package/dist/plugins/installer/pruneDisabled.d.ts +24 -0
- package/dist/plugins/installer/pruneDisabled.js +73 -0
- package/dist/plugins/installer/types.d.ts +5 -2
- package/dist/plugins/installer/types.js +1 -0
- package/dist/plugins/installer/uninstall.js +4 -0
- package/dist/plugins/installer/unzip.d.ts +14 -0
- package/dist/plugins/installer/unzip.js +82 -0
- package/dist/plugins/installer/update.d.ts +14 -0
- package/dist/plugins/installer/update.js +53 -21
- package/dist/plugins/loadPluginHooks.d.ts +47 -1
- package/dist/plugins/loadPluginHooks.js +73 -1
- package/dist/plugins/marketplaceManager.d.ts +7 -0
- package/dist/plugins/marketplaceManager.js +20 -0
- package/dist/plugins/pluginCommandHook.js +4 -18
- package/dist/plugins/pluginContent.d.ts +30 -0
- package/dist/plugins/pluginContent.js +83 -0
- package/dist/plugins/pluginInstaller.d.ts +13 -0
- package/dist/plugins/pluginInstaller.js +42 -8
- package/dist/plugins/schemas.js +1 -0
- package/dist/plugins/types.d.ts +6 -0
- package/dist/preset/index.d.ts +7 -1
- package/dist/preset/index.js +96 -6
- package/dist/product/types.d.ts +1 -1
- package/dist/prompt/composer.d.ts +27 -0
- package/dist/prompt/composer.js +67 -21
- package/dist/prompt/instruction-scanner.js +5 -3
- package/dist/prompt/section-loader.js +1 -0
- package/dist/prompt/sections/base.md +1 -0
- package/dist/prompt/sections/browser.md +10 -0
- package/dist/prompt/sections/coding.md +4 -0
- package/dist/protocol/chat-session-manager.d.ts +8 -2
- package/dist/protocol/chat-session-manager.js +36 -0
- package/dist/protocol/chat-session.d.ts +65 -0
- package/dist/protocol/chat-session.js +94 -2
- package/dist/protocol/client.d.ts +27 -0
- package/dist/protocol/client.js +38 -0
- package/dist/protocol/server.d.ts +112 -0
- package/dist/protocol/server.js +586 -16
- package/dist/protocol/transport.js +3 -2
- package/dist/protocol/types.d.ts +46 -0
- package/dist/protocol/types.js +16 -0
- package/dist/quota/credentials.d.ts +3 -0
- package/dist/quota/credentials.js +80 -0
- package/dist/quota/index.d.ts +36 -0
- package/dist/quota/index.js +155 -0
- package/dist/quota/types.d.ts +48 -0
- package/dist/quota/types.js +13 -0
- package/dist/review/review-prompt.d.ts +28 -0
- package/dist/review/review-prompt.js +81 -0
- package/dist/run/FileRunStore.js +8 -3
- package/dist/run/RunApprovalBackend.js +25 -5
- package/dist/run/RunManager.d.ts +12 -0
- package/dist/run/RunManager.js +35 -0
- package/dist/run/factory.d.ts +1 -1
- package/dist/runtime/background-shell.d.ts +139 -0
- package/dist/runtime/background-shell.js +495 -0
- package/dist/runtime/output-clean.d.ts +24 -0
- package/dist/runtime/output-clean.js +41 -0
- package/dist/runtime/ring-file.d.ts +64 -0
- package/dist/runtime/ring-file.js +174 -0
- package/dist/runtime/safe-spawn.js +15 -34
- package/dist/runtime/spawn-common.d.ts +148 -0
- package/dist/runtime/spawn-common.js +303 -0
- package/dist/runtime/truncate-output.d.ts +22 -0
- package/dist/runtime/truncate-output.js +49 -0
- package/dist/runtime/utf8-cut.d.ts +11 -0
- package/dist/runtime/utf8-cut.js +23 -0
- package/dist/services/auto-dream.d.ts +4 -0
- package/dist/services/auto-dream.js +26 -26
- package/dist/services/diagnostics.d.ts +1 -2
- package/dist/services/diagnostics.js +12 -7
- package/dist/services/extract-memories.d.ts +14 -1
- package/dist/services/extract-memories.js +45 -6
- package/dist/services/memory-orchestrator.d.ts +21 -0
- package/dist/services/memory-orchestrator.js +125 -50
- package/dist/services/session-memory.js +24 -12
- package/dist/session/file-history.d.ts +124 -1
- package/dist/session/file-history.js +222 -6
- package/dist/session/memory.d.ts +116 -2
- package/dist/session/memory.js +250 -28
- package/dist/session/session-manager.d.ts +40 -0
- package/dist/session/session-manager.js +113 -3
- package/dist/session/simple-diff.d.ts +23 -0
- package/dist/session/simple-diff.js +84 -0
- package/dist/session/transcript.d.ts +25 -1
- package/dist/session/transcript.js +35 -2
- package/dist/session/undo-target.d.ts +67 -0
- package/dist/session/undo-target.js +144 -0
- package/dist/settings/disk-defaults.d.ts +9 -2
- package/dist/settings/disk-defaults.js +11 -2
- package/dist/settings/feature-flags.d.ts +64 -0
- package/dist/settings/feature-flags.js +61 -0
- package/dist/settings/manager.d.ts +68 -1
- package/dist/settings/manager.js +266 -29
- package/dist/settings/migrate-config.d.ts +45 -0
- package/dist/settings/migrate-config.js +125 -0
- package/dist/settings/schema-export.d.ts +25 -0
- package/dist/settings/schema-export.js +38 -0
- package/dist/settings/schema.d.ts +1186 -771
- package/dist/settings/schema.js +268 -97
- package/dist/skills/scanner.d.ts +9 -0
- package/dist/skills/scanner.js +30 -2
- package/dist/stt/resolve-transcribe.d.ts +31 -0
- package/dist/stt/resolve-transcribe.js +108 -0
- package/dist/stt/transcribe.d.ts +51 -0
- package/dist/stt/transcribe.js +65 -0
- package/dist/tool-system/browser-bridge.d.ts +226 -0
- package/dist/tool-system/browser-bridge.js +163 -0
- package/dist/tool-system/builtin/agent-heartbeat.d.ts +49 -0
- package/dist/tool-system/builtin/agent-heartbeat.js +89 -0
- package/dist/tool-system/builtin/agent-notifications.d.ts +12 -3
- package/dist/tool-system/builtin/agent-notifications.js +9 -3
- package/dist/tool-system/builtin/agent-output-file.d.ts +38 -0
- package/dist/tool-system/builtin/agent-output-file.js +72 -0
- package/dist/tool-system/builtin/agent-registry.d.ts +12 -0
- package/dist/tool-system/builtin/agent-registry.js +8 -0
- package/dist/tool-system/builtin/agent.d.ts +21 -1
- package/dist/tool-system/builtin/agent.js +489 -42
- package/dist/tool-system/builtin/apply-patch/applier.js +66 -8
- package/dist/tool-system/builtin/apply-patch/backup-targets.d.ts +10 -0
- package/dist/tool-system/builtin/apply-patch/backup-targets.js +30 -0
- package/dist/tool-system/builtin/apply-patch/index.js +0 -15
- package/dist/tool-system/builtin/background-jobs.d.ts +76 -0
- package/dist/tool-system/builtin/background-jobs.js +124 -0
- package/dist/tool-system/builtin/background-shell-tools.d.ts +20 -0
- package/dist/tool-system/builtin/background-shell-tools.js +108 -0
- package/dist/tool-system/builtin/background-work.d.ts +67 -0
- package/dist/tool-system/builtin/background-work.js +86 -0
- package/dist/tool-system/builtin/bash-output-style.d.ts +32 -0
- package/dist/tool-system/builtin/bash-output-style.js +40 -0
- package/dist/tool-system/builtin/bash.d.ts +5 -2
- package/dist/tool-system/builtin/bash.js +98 -62
- package/dist/tool-system/builtin/browser-tools.d.ts +33 -0
- package/dist/tool-system/builtin/browser-tools.js +312 -0
- package/dist/tool-system/builtin/cancel-goal.d.ts +31 -0
- package/dist/tool-system/builtin/cancel-goal.js +64 -0
- package/dist/tool-system/builtin/check-quota.d.ts +15 -0
- package/dist/tool-system/builtin/check-quota.js +34 -0
- package/dist/tool-system/builtin/config.js +7 -0
- package/dist/tool-system/builtin/cron.d.ts +7 -0
- package/dist/tool-system/builtin/cron.js +55 -3
- package/dist/tool-system/builtin/drive-claude-code.d.ts +30 -0
- package/dist/tool-system/builtin/drive-claude-code.js +157 -0
- package/dist/tool-system/builtin/edit-model-catalog.d.ts +3 -0
- package/dist/tool-system/builtin/edit-model-catalog.js +94 -0
- package/dist/tool-system/builtin/edit.js +20 -16
- package/dist/tool-system/builtin/eol.d.ts +29 -0
- package/dist/tool-system/builtin/eol.js +37 -0
- package/dist/tool-system/builtin/file-cache.d.ts +6 -0
- package/dist/tool-system/builtin/file-cache.js +8 -0
- package/dist/tool-system/builtin/generate-image.d.ts +35 -0
- package/dist/tool-system/builtin/generate-image.js +278 -50
- package/dist/tool-system/builtin/generate-video.d.ts +55 -0
- package/dist/tool-system/builtin/generate-video.js +361 -0
- package/dist/tool-system/builtin/glob.js +0 -7
- package/dist/tool-system/builtin/grep.js +6 -8
- package/dist/tool-system/builtin/image-providers.d.ts +86 -0
- package/dist/tool-system/builtin/image-providers.js +190 -0
- package/dist/tool-system/builtin/image-uploader.d.ts +33 -0
- package/dist/tool-system/builtin/image-uploader.js +74 -0
- package/dist/tool-system/builtin/index.d.ts +7 -1
- package/dist/tool-system/builtin/index.js +249 -25
- package/dist/tool-system/builtin/mcp-tools.js +23 -3
- package/dist/tool-system/builtin/memory.js +45 -7
- package/dist/tool-system/builtin/notebook-edit.js +0 -7
- package/dist/tool-system/builtin/powershell.js +4 -1
- package/dist/tool-system/builtin/read.js +10 -10
- package/dist/tool-system/builtin/repl.js +4 -1
- package/dist/tool-system/builtin/skill.js +9 -0
- package/dist/tool-system/builtin/sleep.js +3 -2
- package/dist/tool-system/builtin/tool-search.js +25 -7
- package/dist/tool-system/builtin/video-providers.d.ts +154 -0
- package/dist/tool-system/builtin/video-providers.js +235 -0
- package/dist/tool-system/builtin/web-fetch.js +12 -2
- package/dist/tool-system/builtin/web-search.js +21 -7
- package/dist/tool-system/builtin/worktree.d.ts +2 -1
- package/dist/tool-system/builtin/worktree.js +31 -4
- package/dist/tool-system/builtin/write.js +0 -6
- package/dist/tool-system/context.d.ts +154 -6
- package/dist/tool-system/executor.d.ts +3 -1
- package/dist/tool-system/executor.js +172 -88
- package/dist/tool-system/investigation-guard.js +1 -1
- package/dist/tool-system/mcp-manager.d.ts +42 -4
- package/dist/tool-system/mcp-manager.js +186 -20
- package/dist/tool-system/path-policy.d.ts +5 -0
- package/dist/tool-system/path-policy.js +307 -8
- package/dist/tool-system/permission.d.ts +36 -1
- package/dist/tool-system/permission.js +281 -69
- package/dist/tool-system/plan-mode-allowlist.d.ts +13 -2
- package/dist/tool-system/plan-mode-allowlist.js +24 -2
- package/dist/tool-system/registry.d.ts +1 -0
- package/dist/tool-system/registry.js +16 -2
- package/dist/tool-system/sandbox/index.d.ts +8 -0
- package/dist/tool-system/sandbox/index.js +7 -2
- package/dist/tool-system/validate-tool-metadata.d.ts +36 -0
- package/dist/tool-system/validate-tool-metadata.js +63 -0
- package/dist/types.d.ts +217 -6
- package/dist/updater.js +20 -9
- package/dist/utils/envUtils.d.ts +0 -9
- package/dist/utils/envUtils.js +3 -28
- package/dist/utils/exec.d.ts +40 -0
- package/dist/utils/exec.js +144 -0
- package/dist/utils/json.d.ts +12 -0
- package/dist/utils/json.js +92 -0
- package/dist/utils/theme.d.ts +1 -1
- package/dist/utils/theme.js +1 -1
- package/dist/utils/toolDisplay.js +0 -1
- package/package.json +13 -7
- package/dist/agent/coordinator.d.ts +0 -49
- package/dist/agent/coordinator.js +0 -77
- package/dist/settings/manager.test.js +0 -73
- package/dist/tool-system/builtin/remote-trigger.d.ts +0 -6
- package/dist/tool-system/builtin/remote-trigger.js +0 -54
- package/dist/tool-system/builtin/send-message.d.ts +0 -6
- package/dist/tool-system/builtin/send-message.js +0 -47
- /package/dist/{settings/manager.test.d.ts → credentials/types.js} +0 -0
|
@@ -94,8 +94,7 @@ class AgentNotificationBus {
|
|
|
94
94
|
// Mirrors NotificationQueue.enqueue — refuse undefined / "" so the
|
|
95
95
|
// server-side subscriber never has to defend against it.
|
|
96
96
|
logger.warn("agent_notification_bus.invalid_session_id", {
|
|
97
|
-
|
|
98
|
-
status: event.status,
|
|
97
|
+
eventType: event.type,
|
|
99
98
|
sessionIdType: typeof sessionId,
|
|
100
99
|
});
|
|
101
100
|
return;
|
|
@@ -132,6 +131,10 @@ export function notificationItemToStreamEvent(item) {
|
|
|
132
131
|
};
|
|
133
132
|
if (item.name !== undefined)
|
|
134
133
|
event.name = item.name;
|
|
134
|
+
if (item.workKind !== undefined)
|
|
135
|
+
event.workKind = item.workKind;
|
|
136
|
+
if (item.command !== undefined)
|
|
137
|
+
event.command = item.command;
|
|
135
138
|
if (item.finalText !== undefined)
|
|
136
139
|
event.finalText = item.finalText;
|
|
137
140
|
if (item.error !== undefined)
|
|
@@ -163,7 +166,10 @@ export function buildNotificationMessage(items) {
|
|
|
163
166
|
const agents = items
|
|
164
167
|
.map((item) => {
|
|
165
168
|
const nameAttr = item.name ? ` name="${escapeXmlAttr(item.name)}"` : "";
|
|
166
|
-
|
|
169
|
+
// For DriveClaudeCode jobs, expose the real claude session id so the model
|
|
170
|
+
// can cite it / recover the full result from disk if needed.
|
|
171
|
+
const ccAttr = item.ccSessionId ? ` ccSessionId="${escapeXmlAttr(item.ccSessionId)}"` : "";
|
|
172
|
+
const opening = ` <agent id="${escapeXmlAttr(item.agentId)}"${nameAttr} status="${item.status}"${ccAttr}>`;
|
|
167
173
|
const desc = ` <description>${escapeXmlText(item.description)}</description>`;
|
|
168
174
|
const body = item.status === "completed"
|
|
169
175
|
? ` <result>\n${escapeXmlText(item.finalText ?? "")}\n </result>`
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Background-agent output files. When an async (run_in_background) agent
|
|
3
|
+
* finishes, we mirror its final text to `~/.code-shell/agents/<agentId>.txt`
|
|
4
|
+
* so it can be tailed from outside the process or read back in a later session
|
|
5
|
+
* — the notificationQueue re-injection remains the PRIMARY path that feeds the
|
|
6
|
+
* result to the parent agent; this file is just an external-readable copy.
|
|
7
|
+
*
|
|
8
|
+
* All writes are best-effort: a failure here must never break the agent
|
|
9
|
+
* completion path, so callers fire-and-forget and we swallow errors (logging
|
|
10
|
+
* via the provided logger when present).
|
|
11
|
+
*/
|
|
12
|
+
/** Directory holding per-agent output files. */
|
|
13
|
+
export declare function agentOutputDir(): string;
|
|
14
|
+
/** Absolute path of a given agent's output file. */
|
|
15
|
+
export declare function agentOutputPath(agentId: string): string;
|
|
16
|
+
interface WriteOpts {
|
|
17
|
+
status: "completed" | "failed";
|
|
18
|
+
/** Final text (completed) or error message (failed). */
|
|
19
|
+
body: string;
|
|
20
|
+
description?: string;
|
|
21
|
+
name?: string;
|
|
22
|
+
/** Optional logger.warn for swallowed errors. */
|
|
23
|
+
onError?: (msg: string, meta: Record<string, unknown>) => void;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Write (overwrite) an agent's output file. Best-effort: resolves even on
|
|
27
|
+
* failure. The body is prefixed with a small header so a human tailing the
|
|
28
|
+
* file sees what it is.
|
|
29
|
+
*/
|
|
30
|
+
export declare function writeAgentOutputFile(agentId: string, opts: WriteOpts): Promise<void>;
|
|
31
|
+
/** Delete a single agent's output file (best-effort). */
|
|
32
|
+
export declare function removeAgentOutputFile(agentId: string): Promise<void>;
|
|
33
|
+
/**
|
|
34
|
+
* Remove every agent output file. Called on app exit / full registry reset so
|
|
35
|
+
* the directory doesn't accumulate stale files across runs.
|
|
36
|
+
*/
|
|
37
|
+
export declare function clearAgentOutputFiles(): Promise<void>;
|
|
38
|
+
export {};
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Background-agent output files. When an async (run_in_background) agent
|
|
3
|
+
* finishes, we mirror its final text to `~/.code-shell/agents/<agentId>.txt`
|
|
4
|
+
* so it can be tailed from outside the process or read back in a later session
|
|
5
|
+
* — the notificationQueue re-injection remains the PRIMARY path that feeds the
|
|
6
|
+
* result to the parent agent; this file is just an external-readable copy.
|
|
7
|
+
*
|
|
8
|
+
* All writes are best-effort: a failure here must never break the agent
|
|
9
|
+
* completion path, so callers fire-and-forget and we swallow errors (logging
|
|
10
|
+
* via the provided logger when present).
|
|
11
|
+
*/
|
|
12
|
+
import { join } from "node:path";
|
|
13
|
+
import { mkdir, writeFile, rm, readdir } from "node:fs/promises";
|
|
14
|
+
import { userHome } from "../../settings/manager.js";
|
|
15
|
+
/** Directory holding per-agent output files. */
|
|
16
|
+
export function agentOutputDir() {
|
|
17
|
+
return join(userHome(), ".code-shell", "agents");
|
|
18
|
+
}
|
|
19
|
+
/** Absolute path of a given agent's output file. */
|
|
20
|
+
export function agentOutputPath(agentId) {
|
|
21
|
+
// agentId is internally generated (`agent-<n>` / uuid-ish) — no separators —
|
|
22
|
+
// but guard anyway so a hostile id can't escape the directory.
|
|
23
|
+
const safe = agentId.replace(/[^A-Za-z0-9._-]/g, "_");
|
|
24
|
+
return join(agentOutputDir(), `${safe}.txt`);
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Write (overwrite) an agent's output file. Best-effort: resolves even on
|
|
28
|
+
* failure. The body is prefixed with a small header so a human tailing the
|
|
29
|
+
* file sees what it is.
|
|
30
|
+
*/
|
|
31
|
+
export async function writeAgentOutputFile(agentId, opts) {
|
|
32
|
+
try {
|
|
33
|
+
await mkdir(agentOutputDir(), { recursive: true });
|
|
34
|
+
const header = `# agent ${agentId}` +
|
|
35
|
+
(opts.name ? ` (${opts.name})` : "") +
|
|
36
|
+
`\n# status: ${opts.status}` +
|
|
37
|
+
(opts.description ? `\n# task: ${opts.description}` : "") +
|
|
38
|
+
`\n\n`;
|
|
39
|
+
await writeFile(agentOutputPath(agentId), header + (opts.body ?? ""), "utf8");
|
|
40
|
+
}
|
|
41
|
+
catch (e) {
|
|
42
|
+
opts.onError?.("agent_output_file_write_failed", {
|
|
43
|
+
agentId,
|
|
44
|
+
error: String(e instanceof Error ? e.message : e),
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
/** Delete a single agent's output file (best-effort). */
|
|
49
|
+
export async function removeAgentOutputFile(agentId) {
|
|
50
|
+
try {
|
|
51
|
+
await rm(agentOutputPath(agentId), { force: true });
|
|
52
|
+
}
|
|
53
|
+
catch {
|
|
54
|
+
// best-effort
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Remove every agent output file. Called on app exit / full registry reset so
|
|
59
|
+
* the directory doesn't accumulate stale files across runs.
|
|
60
|
+
*/
|
|
61
|
+
export async function clearAgentOutputFiles() {
|
|
62
|
+
try {
|
|
63
|
+
const dir = agentOutputDir();
|
|
64
|
+
const names = await readdir(dir);
|
|
65
|
+
await Promise.all(names
|
|
66
|
+
.filter((n) => n.endsWith(".txt"))
|
|
67
|
+
.map((n) => rm(join(dir, n), { force: true })));
|
|
68
|
+
}
|
|
69
|
+
catch {
|
|
70
|
+
// dir may not exist yet — fine
|
|
71
|
+
}
|
|
72
|
+
}
|
|
@@ -38,6 +38,12 @@ export interface AsyncAgentEntry {
|
|
|
38
38
|
* not every concurrent session's. Undefined only for legacy/ad-hoc callers
|
|
39
39
|
* outside Engine.run. */
|
|
40
40
|
sessionId?: string;
|
|
41
|
+
/** The sub-agent's OWN child session id (distinct from the parent
|
|
42
|
+
* `sessionId` above). AgentSendInput resumes this to continue the agent
|
|
43
|
+
* with full transcript replay. With the agent_id===childSid convention
|
|
44
|
+
* this equals `agentId`, but it is stored explicitly so the contract is
|
|
45
|
+
* not coupled to that identity. Undefined for legacy entries. */
|
|
46
|
+
childSessionId?: string;
|
|
41
47
|
status: AsyncAgentStatus;
|
|
42
48
|
startedAt: number;
|
|
43
49
|
finishedAt?: number;
|
|
@@ -71,6 +77,12 @@ declare class AsyncAgentRegistry {
|
|
|
71
77
|
touchTranscript(agentId: string): void;
|
|
72
78
|
get(agentId: string): AsyncAgentEntry | undefined;
|
|
73
79
|
list(): AsyncAgentEntry[];
|
|
80
|
+
/**
|
|
81
|
+
* Agents spawned by a given session. Drives AgentStatus's default view so a
|
|
82
|
+
* background-agent listing doesn't surface every concurrent session's agents.
|
|
83
|
+
* Legacy entries with no sessionId are excluded from a session-scoped query.
|
|
84
|
+
*/
|
|
85
|
+
listForSession(sessionId: string): AsyncAgentEntry[];
|
|
74
86
|
private markFinished;
|
|
75
87
|
markCompleted(agentId: string): void;
|
|
76
88
|
markFailed(agentId: string): void;
|
|
@@ -81,6 +81,14 @@ class AsyncAgentRegistry {
|
|
|
81
81
|
list() {
|
|
82
82
|
return [...this.agents.values()];
|
|
83
83
|
}
|
|
84
|
+
/**
|
|
85
|
+
* Agents spawned by a given session. Drives AgentStatus's default view so a
|
|
86
|
+
* background-agent listing doesn't surface every concurrent session's agents.
|
|
87
|
+
* Legacy entries with no sessionId are excluded from a session-scoped query.
|
|
88
|
+
*/
|
|
89
|
+
listForSession(sessionId) {
|
|
90
|
+
return [...this.agents.values()].filter((e) => e.sessionId === sessionId);
|
|
91
|
+
}
|
|
84
92
|
markFinished(agentId, status) {
|
|
85
93
|
const e = this.agents.get(agentId);
|
|
86
94
|
if (!e)
|
|
@@ -9,12 +9,14 @@
|
|
|
9
9
|
import type { ToolDefinition } from "../../types.js";
|
|
10
10
|
import type { ToolContext } from "../context.js";
|
|
11
11
|
import type { AgentDefinitionRegistry } from "../../agent/agent-definition-registry.js";
|
|
12
|
+
import type { AgentDefinition } from "../../agent/agent-definition.js";
|
|
12
13
|
import type { HookRegistry } from "../../hooks/registry.js";
|
|
13
14
|
export interface AgentTypeOverrides {
|
|
14
15
|
resolvedType?: string;
|
|
15
16
|
model?: string;
|
|
16
17
|
maxTurns?: number;
|
|
17
18
|
toolAllowlist?: string[];
|
|
19
|
+
skillAllowlist?: string[];
|
|
18
20
|
appendSystemPrompt?: string;
|
|
19
21
|
}
|
|
20
22
|
/**
|
|
@@ -32,6 +34,22 @@ export interface AgentTypeOverrides {
|
|
|
32
34
|
* than silently running a generic agent.
|
|
33
35
|
*/
|
|
34
36
|
export declare function resolveAgentTypeOverrides(agentType: string | undefined, registry: AgentDefinitionRegistry | undefined): AgentTypeOverrides;
|
|
37
|
+
/**
|
|
38
|
+
* A plugin-bundled agent's frontmatter lists its own skills by BARE name
|
|
39
|
+
* (`skills: director-skill`), matching Claude Code's convention where a
|
|
40
|
+
* plugin agent references same-plugin skills unqualified. But the skill
|
|
41
|
+
* scanner registers plugin skills under their NAMESPACED name
|
|
42
|
+
* (`mimi-video:director-skill`), and the allowlist filter is an exact match —
|
|
43
|
+
* so a bare entry never matches and the sub-agent reports the skill "not
|
|
44
|
+
* found", forcing it to fall back to reading SKILL.md by hand.
|
|
45
|
+
*
|
|
46
|
+
* Bridge the two conventions: for a plugin-source agent, rewrite each bare
|
|
47
|
+
* skill name to `<pluginName>:<skill>`. Names that already carry a namespace
|
|
48
|
+
* (contain ":") are left untouched, so an agent may still reference another
|
|
49
|
+
* plugin's skill explicitly. undefined (inherit full pool) and [] (no skills)
|
|
50
|
+
* pass through unchanged. Non-plugin agents are never rewritten.
|
|
51
|
+
*/
|
|
52
|
+
export declare function namespacePluginSkills(skills: string[] | undefined, source: AgentDefinition["source"], pluginName: string | undefined): string[] | undefined;
|
|
35
53
|
/**
|
|
36
54
|
* Render the "Available agent types" block injected into the Agent tool's
|
|
37
55
|
* description, listing the roles defined in .code-shell/agents/*.md so the
|
|
@@ -65,7 +83,9 @@ export declare function emitSubAgentHook(hooks: HookRegistry | undefined, kind:
|
|
|
65
83
|
export declare const agentToolDef: ToolDefinition;
|
|
66
84
|
export declare function agentTool(args: Record<string, unknown>, ctx?: ToolContext): Promise<string>;
|
|
67
85
|
export declare const agentStatusToolDef: ToolDefinition;
|
|
68
|
-
export declare function agentStatusTool(args: Record<string, unknown
|
|
86
|
+
export declare function agentStatusTool(args: Record<string, unknown>, ctx?: ToolContext): Promise<string>;
|
|
69
87
|
export declare const agentCancelToolDef: ToolDefinition;
|
|
70
88
|
export declare function agentCancelTool(args: Record<string, unknown>): Promise<string>;
|
|
89
|
+
export declare const agentSendInputToolDef: ToolDefinition;
|
|
90
|
+
export declare function agentSendInputTool(args: Record<string, unknown>, ctx?: ToolContext): Promise<string>;
|
|
71
91
|
export {};
|