@sayknow-cli/coding-agent 0.7.11 → 0.7.12
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/CHANGELOG.md +10 -0
- package/dist/types/async/result-formatting.d.ts +2 -0
- package/dist/types/capability/fs.d.ts +22 -3
- package/dist/types/capability/mcp.d.ts +2 -0
- package/dist/types/cli/append-system-prompt.d.ts +6 -0
- package/dist/types/cli/update-cli.d.ts +3 -0
- package/dist/types/commands/contribution-prep.d.ts +0 -3
- package/dist/types/commands/migrate.d.ts +1 -1
- package/dist/types/commands/sdk.d.ts +9 -0
- package/dist/types/commit/changelog/index.d.ts +1 -0
- package/dist/types/config/settings-schema.d.ts +14 -0
- package/dist/types/config/settings.d.ts +7 -1
- package/dist/types/coordinator-mcp/session-reaper.d.ts +5 -0
- package/dist/types/cursor-delete-path.d.ts +1 -0
- package/dist/types/cursor-mcp-name.d.ts +8 -0
- package/dist/types/dap/config.d.ts +8 -4
- package/dist/types/dap/session.d.ts +11 -2
- package/dist/types/debug/report-bundle-parent.d.ts +2 -0
- package/dist/types/debug/system-info.d.ts +6 -1
- package/dist/types/discovery/helpers.d.ts +11 -3
- package/dist/types/discovery/mcp-json.d.ts +1 -0
- package/dist/types/edit/file-read-cache.d.ts +4 -0
- package/dist/types/edit/modes/patch.d.ts +14 -0
- package/dist/types/edit/modes/replace.d.ts +8 -0
- package/dist/types/eval/py/runtime.d.ts +9 -0
- package/dist/types/exa/mcp-client.d.ts +11 -6
- package/dist/types/exec/bash-executor.d.ts +18 -1
- package/dist/types/export/html/css-color.d.ts +2 -0
- package/dist/types/export/html/html-export-destination.d.ts +2 -0
- package/dist/types/export/html/template.generated.d.ts +1 -1
- package/dist/types/extensibility/custom-tools/loader.d.ts +3 -2
- package/dist/types/extensibility/custom-tools/types.d.ts +3 -1
- package/dist/types/extensibility/plugins/marketplace/cache.d.ts +2 -0
- package/dist/types/extensibility/plugins/plugin-link-path.d.ts +2 -0
- package/dist/types/goals/runtime.d.ts +6 -0
- package/dist/types/harness-control-plane/receipt-spool.d.ts +4 -0
- package/dist/types/hindsight/content.d.ts +5 -6
- package/dist/types/internal-urls/skill-path.d.ts +1 -0
- package/dist/types/internal-urls/types.d.ts +2 -0
- package/dist/types/lsp/clients/swiftlint-client.d.ts +0 -4
- package/dist/types/lsp/config.d.ts +8 -5
- package/dist/types/lsp/workspace-path.d.ts +1 -0
- package/dist/types/migrate/adapters/codex.d.ts +2 -1
- package/dist/types/migrate/adapters/index.d.ts +10 -1
- package/dist/types/migrate/executor.d.ts +3 -1
- package/dist/types/migrate/types.d.ts +15 -3
- package/dist/types/modes/components/custom-editor.d.ts +6 -0
- package/dist/types/modes/components/extensions/state-manager.d.ts +4 -3
- package/dist/types/modes/components/model-selector.d.ts +46 -0
- package/dist/types/modes/controllers/input-controller.d.ts +9 -0
- package/dist/types/modes/interactive-mode.d.ts +1 -0
- package/dist/types/modes/utils/macos-option-forwarding.d.ts +17 -0
- package/dist/types/runtime-mcp/content-limits.d.ts +4 -0
- package/dist/types/runtime-mcp/manager.d.ts +9 -1
- package/dist/types/runtime-mcp/mcp-redirect.d.ts +9 -0
- package/dist/types/runtime-mcp/oauth-public-url.d.ts +1 -0
- package/dist/types/runtime-mcp/plugin-mcp-name-filter.d.ts +22 -0
- package/dist/types/runtime-mcp/plugin-network-boundary.d.ts +1 -0
- package/dist/types/runtime-mcp/project-host-values.d.ts +33 -0
- package/dist/types/runtime-mcp/smithery-registry.d.ts +24 -0
- package/dist/types/runtime-mcp/tool-bridge.d.ts +4 -0
- package/dist/types/runtime-mcp/types.d.ts +6 -0
- package/dist/types/sdk/broker/ensure.d.ts +2 -0
- package/dist/types/sdk/broker/lifecycle-ledger.d.ts +5 -1
- package/dist/types/sdk/broker/runtime.d.ts +1 -1
- package/dist/types/sdk/bus/chat-daemon-control.d.ts +3 -1
- package/dist/types/sdk/bus/telegram-daemon-contract.d.ts +3 -1
- package/dist/types/sdk/bus/telegram-daemon.d.ts +1 -0
- package/dist/types/sdk/host/events.d.ts +4 -0
- package/dist/types/session/agent-session.d.ts +20 -1
- package/dist/types/session/messages.d.ts +5 -1
- package/dist/types/session/session-manager.d.ts +13 -0
- package/dist/types/session/session-storage.d.ts +8 -0
- package/dist/types/session/streaming-output.d.ts +11 -0
- package/dist/types/session-import/redact.d.ts +1 -1
- package/dist/types/skc-runtime/managed-owner-admission.d.ts +3 -0
- package/dist/types/skc-runtime/psmux-detect.d.ts +5 -4
- package/dist/types/skc-runtime/ralplan-runtime.d.ts +5 -0
- package/dist/types/skc-runtime/sidecar-bootstrap-env.d.ts +6 -0
- package/dist/types/skc-runtime/state-writer.d.ts +4 -1
- package/dist/types/skc-runtime/tmux-sessions.d.ts +24 -0
- package/dist/types/skc-runtime/ultragoal-runtime.d.ts +4 -0
- package/dist/types/skill-state/workflow-mutation-guard.d.ts +20 -1
- package/dist/types/slash-commands/helpers/mcp.d.ts +5 -0
- package/dist/types/ssh/ssh-executor.d.ts +3 -1
- package/dist/types/system-prompt.d.ts +5 -2
- package/dist/types/task/executor.d.ts +17 -3
- package/dist/types/task/isolation-dir.d.ts +26 -0
- package/dist/types/task/role-body.d.ts +11 -0
- package/dist/types/task/token-log-mode.test.d.ts +1 -0
- package/dist/types/tools/ask.d.ts +77 -254
- package/dist/types/tools/ast-edit-write-path.d.ts +23 -0
- package/dist/types/tools/atomic-file-write.d.ts +74 -0
- package/dist/types/tools/auto-generated-guard.d.ts +5 -2
- package/dist/types/tools/bash-allowed-prefixes.d.ts +16 -0
- package/dist/types/tools/bash-interactive.d.ts +2 -0
- package/dist/types/tools/bash-skill-urls.d.ts +5 -1
- package/dist/types/tools/bash.d.ts +1 -0
- package/dist/types/tools/browser/cdp-url.d.ts +2 -0
- package/dist/types/tools/browser/tab-worker.d.ts +2 -0
- package/dist/types/tools/debug.d.ts +2 -2
- package/dist/types/tools/explicit-artifact.d.ts +8 -0
- package/dist/types/tools/fetch.d.ts +7 -4
- package/dist/types/tools/github-side-effect.d.ts +22 -0
- package/dist/types/tools/index.d.ts +3 -0
- package/dist/types/tools/monitor-mutation.d.ts +9 -0
- package/dist/types/tools/recipe/index.d.ts +2 -0
- package/dist/types/tools/recipe/recipe-guard.d.ts +7 -0
- package/dist/types/tools/restricted-cwd.d.ts +1 -0
- package/dist/types/tools/reverse-engineer.d.ts +81 -0
- package/dist/types/tools/search-tool-bm25.d.ts +2 -0
- package/dist/types/tools/tmux-self-injection-guard.d.ts +17 -0
- package/dist/types/tools/untrusted-content.d.ts +12 -0
- package/dist/types/utils/file-mentions.d.ts +5 -0
- package/dist/types/utils/open.d.ts +0 -1
- package/dist/types/utils/shell-snapshot.d.ts +2 -0
- package/dist/types/utils/title-generator.d.ts +12 -2
- package/dist/types/utils/tools-checksum.d.ts +7 -0
- package/dist/types/utils/xml-escape.d.ts +2 -0
- package/dist/types/web/scrapers/types.d.ts +8 -1
- package/dist/types/web/search/providers/codex.d.ts +6 -7
- package/dist/types/web/search/providers/insane.d.ts +7 -1
- package/dist/types/web/search/providers/kimi.d.ts +2 -0
- package/dist/types/web/search/providers/searxng.d.ts +7 -0
- package/dist/types/web/search/providers/xai.d.ts +2 -0
- package/package.json +7 -7
- package/scripts/generate-sdk-operation-inventory.ts +4 -0
- package/src/async/job-manager.ts +23 -9
- package/src/async/result-formatting.ts +40 -0
- package/src/capability/fs.ts +78 -11
- package/src/capability/mcp.ts +2 -0
- package/src/cli/append-system-prompt.ts +12 -0
- package/src/cli/auth-broker-cli.ts +22 -12
- package/src/cli/config-cli.ts +8 -18
- package/src/cli/migrate-cli.ts +7 -5
- package/src/cli/ssh-cli.ts +6 -3
- package/src/cli/stats-cli.ts +9 -4
- package/src/cli/update-cli.ts +42 -0
- package/src/cli/web-search-cli.ts +9 -3
- package/src/cli.ts +5 -9
- package/src/commands/commit.ts +2 -2
- package/src/commands/contribution-prep.ts +1 -3
- package/src/commands/harness.ts +25 -15
- package/src/commands/launch.ts +1 -1
- package/src/commands/migrate.ts +3 -3
- package/src/commands/sdk.ts +115 -14
- package/src/commands/ultragoal.ts +14 -8
- package/src/commit/agentic/agent.ts +6 -6
- package/src/commit/analysis/conventional.ts +14 -5
- package/src/commit/changelog/index.ts +39 -1
- package/src/commit/message.ts +10 -3
- package/src/config/config-file.ts +106 -3
- package/src/config/keybindings.ts +154 -7
- package/src/config/mcp-schema.json +4 -0
- package/src/config/model-registry.ts +10 -2
- package/src/config/settings-schema.ts +18 -0
- package/src/config/settings.ts +32 -4
- package/src/coordinator-mcp/policy.ts +14 -4
- package/src/coordinator-mcp/server.ts +44 -4
- package/src/coordinator-mcp/session-reaper.ts +9 -1
- package/src/cursor-delete-path.ts +10 -0
- package/src/cursor-mcp-name.ts +15 -0
- package/src/cursor.ts +13 -2
- package/src/dap/client.ts +9 -2
- package/src/dap/config.ts +33 -13
- package/src/dap/defaults.json +1 -1
- package/src/dap/session.ts +161 -36
- package/src/debug/crash-diagnostics.ts +89 -6
- package/src/debug/report-bundle-parent.ts +22 -0
- package/src/debug/report-bundle.ts +100 -3
- package/src/debug/system-info.ts +21 -4
- package/src/defaults/skc/extensions/grok-cli-vendor/src/shared/base-url.ts +21 -7
- package/src/defaults/skc/skills/deep-interview/SKILL.md +1 -1
- package/src/discovery/agents-md.ts +3 -2
- package/src/discovery/agents.ts +3 -2
- package/src/discovery/builtin.ts +21 -11
- package/src/discovery/claude.ts +5 -4
- package/src/discovery/cline.ts +2 -2
- package/src/discovery/codex.ts +6 -5
- package/src/discovery/cursor.ts +11 -2
- package/src/discovery/gemini.ts +4 -3
- package/src/discovery/github.ts +2 -2
- package/src/discovery/helpers.ts +51 -11
- package/src/discovery/mcp-json.ts +28 -12
- package/src/discovery/opencode.ts +2 -1
- package/src/discovery/ssh.ts +11 -6
- package/src/discovery/substitute-plugin-root.ts +3 -1
- package/src/discovery/vscode.ts +3 -3
- package/src/edit/apply-patch/index.ts +12 -1
- package/src/edit/file-read-cache.ts +24 -6
- package/src/edit/index.ts +90 -20
- package/src/edit/modes/patch.ts +215 -9
- package/src/edit/modes/replace.ts +141 -0
- package/src/eval/js/context-manager.ts +29 -3
- package/src/eval/js/worker-entry.ts +51 -18
- package/src/eval/py/runner.py +144 -5
- package/src/eval/py/runtime.ts +44 -4
- package/src/eval/py/tool-bridge.ts +4 -0
- package/src/exa/mcp-client.ts +53 -11
- package/src/exec/bash-executor.ts +87 -4
- package/src/exec/non-interactive-env.ts +0 -1
- package/src/export/html/css-color.ts +9 -0
- package/src/export/html/html-export-destination.ts +16 -0
- package/src/export/html/index.ts +102 -8
- package/src/export/html/template.generated.ts +1 -1
- package/src/extensibility/custom-tools/loader.ts +13 -3
- package/src/extensibility/custom-tools/types.ts +3 -1
- package/src/extensibility/custom-tools/wrapper.ts +3 -1
- package/src/extensibility/plugins/manager.ts +3 -2
- package/src/extensibility/plugins/marketplace/cache.ts +15 -0
- package/src/extensibility/plugins/marketplace/fetcher.ts +2 -2
- package/src/extensibility/plugins/marketplace/manager.ts +5 -3
- package/src/extensibility/plugins/plugin-link-path.ts +12 -0
- package/src/extensibility/skc-plugins/mcp-policy.ts +2 -1
- package/src/goals/runtime.ts +30 -8
- package/src/harness-control-plane/finalize.ts +10 -0
- package/src/harness-control-plane/operate.ts +12 -4
- package/src/harness-control-plane/owner.ts +8 -1
- package/src/harness-control-plane/receipt-spool.ts +105 -28
- package/src/harness-control-plane/storage.ts +124 -6
- package/src/hashline/execute.ts +3 -3
- package/src/hashline/recovery.ts +85 -2
- package/src/hindsight/config.ts +9 -3
- package/src/hindsight/content.ts +116 -16
- package/src/hindsight/mental-models.ts +22 -10
- package/src/hindsight/state.ts +7 -4
- package/src/hooks/native-skill-hook.ts +17 -12
- package/src/i18n/messages/de.settings.ts +3 -0
- package/src/i18n/messages/es.settings.ts +3 -0
- package/src/i18n/messages/fr.settings.ts +3 -0
- package/src/i18n/messages/ja.settings.ts +3 -0
- package/src/i18n/messages/ko.settings.ts +3 -0
- package/src/i18n/messages/zh.settings.ts +3 -0
- package/src/internal-urls/artifact-protocol.ts +3 -1
- package/src/internal-urls/docs-index.generated.ts +10 -10
- package/src/internal-urls/local-protocol.ts +167 -8
- package/src/internal-urls/skill-path.ts +18 -0
- package/src/internal-urls/skill-protocol.ts +2 -0
- package/src/internal-urls/types.ts +2 -0
- package/src/lsp/client.ts +2 -1
- package/src/lsp/clients/biome-client.ts +2 -0
- package/src/lsp/clients/swiftlint-client.ts +2 -0
- package/src/lsp/config.ts +18 -62
- package/src/lsp/edits.ts +6 -0
- package/src/lsp/index.ts +29 -0
- package/src/lsp/workspace-path.ts +75 -0
- package/src/main.ts +33 -11
- package/src/memories/index.ts +141 -9
- package/src/migrate/action-planner.ts +57 -0
- package/src/migrate/adapters/claude-code.ts +23 -4
- package/src/migrate/adapters/codex.ts +22 -4
- package/src/migrate/adapters/index.ts +22 -4
- package/src/migrate/adapters/opencode.ts +6 -1
- package/src/migrate/executor.ts +84 -7
- package/src/migrate/report.ts +19 -2
- package/src/migrate/types.ts +14 -4
- package/src/modes/DESIGN.md +5 -0
- package/src/modes/acp/acp-agent.ts +35 -2
- package/src/modes/acp/permission-mode.ts +18 -1
- package/src/modes/components/custom-editor.ts +14 -0
- package/src/modes/components/extensions/extension-dashboard.ts +2 -2
- package/src/modes/components/extensions/inspector-panel.ts +9 -5
- package/src/modes/components/extensions/state-manager.ts +15 -5
- package/src/modes/components/model-selector.ts +144 -94
- package/src/modes/components/welcome.ts +3 -2
- package/src/modes/controllers/command-controller.ts +300 -9
- package/src/modes/controllers/event-controller.ts +1 -1
- package/src/modes/controllers/extension-ui-controller.ts +32 -19
- package/src/modes/controllers/input-controller.ts +62 -26
- package/src/modes/controllers/plan-mode-controller.ts +17 -7
- package/src/modes/controllers/runtime-mcp-command-controller.ts +25 -20
- package/src/modes/controllers/ssh-command-controller.ts +3 -1
- package/src/modes/interactive-mode.ts +10 -0
- package/src/modes/utils/macos-option-forwarding.ts +80 -0
- package/src/prompts/system/irc-incoming.md +3 -1
- package/src/prompts/system/project-prompt.md +19 -0
- package/src/prompts/system/system-prompt.md +3 -0
- package/src/prompts/tools/ask.md +2 -0
- package/src/prompts/tools/debug.md +1 -1
- package/src/prompts/tools/monitor.md +7 -5
- package/src/prompts/tools/reverse-engineer.md +29 -0
- package/src/runtime-credential-selector.ts +2 -2
- package/src/runtime-mcp/config-writer.ts +10 -6
- package/src/runtime-mcp/config.ts +1 -0
- package/src/runtime-mcp/content-limits.ts +7 -0
- package/src/runtime-mcp/json-rpc.ts +2 -1
- package/src/runtime-mcp/manager.ts +57 -9
- package/src/runtime-mcp/mcp-redirect.ts +73 -0
- package/src/runtime-mcp/oauth-flow.ts +43 -5
- package/src/runtime-mcp/oauth-public-url.ts +8 -0
- package/src/runtime-mcp/plugin-mcp-name-filter.ts +62 -0
- package/src/runtime-mcp/plugin-network-boundary.ts +4 -0
- package/src/runtime-mcp/project-host-values.ts +50 -0
- package/src/runtime-mcp/render.ts +16 -1
- package/src/runtime-mcp/smithery-registry.ts +22 -3
- package/src/runtime-mcp/tool-bridge.ts +194 -21
- package/src/runtime-mcp/transports/http.ts +4 -3
- package/src/runtime-mcp/transports/stdio.ts +2 -1
- package/src/runtime-mcp/types.ts +6 -0
- package/src/sdk/broker/broker.ts +11 -2
- package/src/sdk/broker/ensure.ts +131 -10
- package/src/sdk/broker/lifecycle-ledger.ts +18 -3
- package/src/sdk/broker/lifecycle.ts +21 -19
- package/src/sdk/broker/runtime.ts +1 -1
- package/src/sdk/bus/chat-daemon-cli.ts +38 -1
- package/src/sdk/bus/chat-daemon-control.ts +5 -3
- package/src/sdk/bus/index.ts +5 -3
- package/src/sdk/bus/lifecycle-control-runtime.ts +9 -2
- package/src/sdk/bus/session-control.ts +2 -0
- package/src/sdk/bus/slack-daemon.ts +8 -1
- package/src/sdk/bus/slack-live-provider.ts +3 -1
- package/src/sdk/bus/telegram-daemon-contract.ts +3 -1
- package/src/sdk/bus/telegram-daemon-control.ts +17 -12
- package/src/sdk/bus/telegram-daemon.ts +41 -1
- package/src/sdk/host/events.ts +67 -4
- package/src/sdk/mcp/server.ts +16 -3
- package/src/sdk/protocol/operation-inventory.generated.json +22 -0
- package/src/sdk/session.ts +18 -25
- package/src/secrets/obfuscator.ts +92 -12
- package/src/session/agent-session.ts +395 -79
- package/src/session/artifacts.ts +3 -1
- package/src/session/history-storage.ts +172 -8
- package/src/session/internal/managed-session-scope.ts +130 -52
- package/src/session/messages.ts +47 -6
- package/src/session/session-manager.ts +116 -8
- package/src/session/session-storage.ts +31 -1
- package/src/session/streaming-output.ts +263 -4
- package/src/session-import/redact.ts +76 -3
- package/src/setup/hermes-setup.ts +4 -1
- package/src/skc-runtime/gc-runtime.ts +26 -4
- package/src/skc-runtime/launch-tmux.ts +21 -11
- package/src/skc-runtime/launch-worktree.ts +42 -3
- package/src/skc-runtime/managed-owner-admission.ts +46 -2
- package/src/skc-runtime/psmux-detect.ts +29 -5
- package/src/skc-runtime/ralplan-runtime.ts +14 -1
- package/src/skc-runtime/session-resolution.ts +38 -6
- package/src/skc-runtime/sidecar-bootstrap-env.ts +19 -0
- package/src/skc-runtime/state-writer.ts +134 -16
- package/src/skc-runtime/tmux-sessions.ts +85 -4
- package/src/skc-runtime/ultragoal-change-set.ts +18 -2
- package/src/skc-runtime/ultragoal-guard.ts +9 -1
- package/src/skc-runtime/ultragoal-runtime.ts +26 -9
- package/src/skill-state/active-state.ts +13 -0
- package/src/skill-state/workflow-mutation-guard.ts +3297 -180
- package/src/slash-commands/builtin-registry.ts +14 -8
- package/src/slash-commands/helpers/mcp.ts +20 -7
- package/src/ssh/ssh-executor.ts +3 -1
- package/src/stt/recorder.ts +26 -9
- package/src/system-prompt.ts +65 -16
- package/src/task/commands.ts +3 -1
- package/src/task/executor.ts +52 -7
- package/src/task/index.ts +28 -0
- package/src/task/isolation-dir.ts +143 -0
- package/src/task/role-body.ts +84 -0
- package/src/task/token-log-mode.test.ts +162 -0
- package/src/task/token-log.ts +91 -2
- package/src/task/worktree.ts +16 -7
- package/src/tools/archive-reader.ts +653 -31
- package/src/tools/ask.ts +86 -14
- package/src/tools/ast-edit-write-path.ts +133 -0
- package/src/tools/ast-edit.ts +27 -1
- package/src/tools/ast-grep.ts +7 -2
- package/src/tools/atomic-file-write.ts +625 -0
- package/src/tools/auto-generated-guard.ts +28 -8
- package/src/tools/bash-allowed-prefixes.ts +225 -6
- package/src/tools/bash-interactive.ts +12 -0
- package/src/tools/bash-skill-urls.ts +113 -7
- package/src/tools/bash.ts +152 -20
- package/src/tools/browser/cdp-url.ts +18 -0
- package/src/tools/browser/tab-worker.ts +49 -14
- package/src/tools/browser.ts +25 -8
- package/src/tools/cron.ts +10 -1
- package/src/tools/debug.ts +16 -8
- package/src/tools/eval.ts +71 -34
- package/src/tools/explicit-artifact.ts +89 -0
- package/src/tools/fetch.ts +26 -17
- package/src/tools/gh.ts +40 -12
- package/src/tools/github-side-effect.ts +112 -0
- package/src/tools/image-gen.ts +24 -10
- package/src/tools/index.ts +6 -0
- package/src/tools/monitor-mutation.ts +27 -0
- package/src/tools/monitor.ts +28 -1
- package/src/tools/output-meta.ts +74 -5
- package/src/tools/read.ts +24 -36
- package/src/tools/recipe/index.ts +12 -0
- package/src/tools/recipe/recipe-guard.ts +19 -0
- package/src/tools/recipe/runner.ts +23 -12
- package/src/tools/render-utils.ts +2 -2
- package/src/tools/restricted-cwd.ts +10 -0
- package/src/tools/reverse-engineer.ts +497 -0
- package/src/tools/search-tool-bm25.ts +14 -3
- package/src/tools/search.ts +3 -2
- package/src/tools/ssh.ts +235 -8
- package/src/tools/subagent-render.ts +43 -7
- package/src/tools/subagent.ts +7 -3
- package/src/tools/tmux-self-injection-guard.ts +3538 -0
- package/src/tools/todo-write.ts +41 -3
- package/src/tools/untrusted-content.ts +23 -0
- package/src/tools/vim.ts +2 -2
- package/src/tools/write.ts +37 -4
- package/src/tui/tree-list.ts +15 -1
- package/src/utils/commit-message-generator.ts +9 -2
- package/src/utils/external-editor.ts +21 -7
- package/src/utils/file-mentions.ts +75 -7
- package/src/utils/git.ts +38 -7
- package/src/utils/open.ts +73 -4
- package/src/utils/shell-snapshot.ts +9 -1
- package/src/utils/title-generator.ts +61 -16
- package/src/utils/tools-checksum.ts +34 -0
- package/src/utils/tools-manager.ts +24 -6
- package/src/utils/xml-escape.ts +14 -0
- package/src/web/insane/url-guard.ts +2 -1
- package/src/web/scrapers/types.ts +8 -0
- package/src/web/scrapers/youtube.ts +3 -2
- package/src/web/search/index.ts +4 -3
- package/src/web/search/providers/anthropic.ts +4 -4
- package/src/web/search/providers/codex.ts +31 -34
- package/src/web/search/providers/insane.ts +145 -28
- package/src/web/search/providers/kimi.ts +15 -5
- package/src/web/search/providers/searxng.ts +47 -4
- package/src/web/search/providers/xai.ts +7 -2
- package/dist/types/cli/shell-cli.d.ts +0 -8
- package/dist/types/commands/shell.d.ts +0 -21
- package/src/cli/shell-cli.ts +0 -176
- package/src/commands/shell.ts +0 -29
|
@@ -57,7 +57,7 @@ import {
|
|
|
57
57
|
invalidateSessionTitleGeneration,
|
|
58
58
|
isSessionTitleGenerationCurrent,
|
|
59
59
|
} from "../utils/session-title-generation";
|
|
60
|
-
import { buildConversationTitleInput, generateSessionTitle } from "../utils/title-generator";
|
|
60
|
+
import { buildConversationTitleInput, generateSessionTitle, titleInputObfuscator } from "../utils/title-generator";
|
|
61
61
|
import { buildContextReportText } from "./helpers/context-report";
|
|
62
62
|
import { buildFastStatusReport } from "./helpers/fast-status-report";
|
|
63
63
|
import { formatDuration } from "./helpers/format";
|
|
@@ -123,7 +123,9 @@ function fastStatusRoleTargets(): Array<{ id: SkcModelAssignmentTargetId; label:
|
|
|
123
123
|
async function regenerateSessionTitle(runtime: SlashCommandRuntime): Promise<SlashCommandResult> {
|
|
124
124
|
try {
|
|
125
125
|
const generation = beginSessionTitleGeneration(runtime.sessionManager);
|
|
126
|
-
const
|
|
126
|
+
const activeCwd = runtime.sessionManager.getCwd();
|
|
127
|
+
const obfuscateText = await titleInputObfuscator(runtime.settings, activeCwd);
|
|
128
|
+
const input = buildConversationTitleInput(runtime.session.messages, obfuscateText);
|
|
127
129
|
if (!input) {
|
|
128
130
|
return usage("Nothing to summarize yet — pass a title: /rename <title>", runtime);
|
|
129
131
|
}
|
|
@@ -135,11 +137,12 @@ async function regenerateSessionTitle(runtime: SlashCommandRuntime): Promise<Sla
|
|
|
135
137
|
runtime.session.sessionId,
|
|
136
138
|
runtime.session.model,
|
|
137
139
|
provider => runtime.session.agent.metadataForProvider(provider),
|
|
140
|
+
activeCwd,
|
|
138
141
|
);
|
|
139
142
|
// A newer prompt, message, or explicit rename landed while the model ran: drop this result.
|
|
140
143
|
if (
|
|
141
144
|
!isSessionTitleGenerationCurrent(runtime.sessionManager, generation) ||
|
|
142
|
-
buildConversationTitleInput(runtime.session.messages) !== input
|
|
145
|
+
buildConversationTitleInput(runtime.session.messages, obfuscateText) !== input
|
|
143
146
|
)
|
|
144
147
|
return commandConsumed();
|
|
145
148
|
if (!generated) {
|
|
@@ -1776,19 +1779,22 @@ const BUILTIN_SLASH_COMMAND_REGISTRY: ReadonlyArray<SlashCommandSpec> = [
|
|
|
1776
1779
|
{
|
|
1777
1780
|
name: "contribute-pr",
|
|
1778
1781
|
aliases: ["contribution-prep"],
|
|
1779
|
-
description: "Dump redacted session context and
|
|
1782
|
+
description: "Dump redacted session context and write a worker prompt for a separate terminal",
|
|
1780
1783
|
inlineHint: "[focus instructions]",
|
|
1781
1784
|
allowArgs: true,
|
|
1782
1785
|
handle: async (command, runtime) => {
|
|
1783
|
-
const
|
|
1786
|
+
const prepared = await runtime.session.prepareContributionPrep({
|
|
1784
1787
|
customInstructions: command.args || undefined,
|
|
1785
|
-
|
|
1788
|
+
// The interactive session owns the terminal; don't detach a second SKC
|
|
1789
|
+
// process that can later be adopted by zsh when this session exits.
|
|
1790
|
+
spawnWorker: false,
|
|
1786
1791
|
});
|
|
1787
1792
|
await runtime.output(
|
|
1788
1793
|
[
|
|
1789
1794
|
"Contribution prep artifacts written.",
|
|
1790
|
-
`Manifest: ${
|
|
1791
|
-
`Worker prompt: ${
|
|
1795
|
+
`Manifest: ${prepared.manifestPath}`,
|
|
1796
|
+
`Worker prompt: ${prepared.workerPromptPath}`,
|
|
1797
|
+
"Run the worker prompt from a separate terminal when ready.",
|
|
1792
1798
|
].join("\n"),
|
|
1793
1799
|
);
|
|
1794
1800
|
return commandConsumed();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getMCPConfigPath, logger } from "@sayknow-cli/utils";
|
|
1
|
+
import { getMCPConfigPath, logger, sanitizeDisplayLine } from "@sayknow-cli/utils";
|
|
2
2
|
import { connectToServer, disconnectServer, listPrompts, listResources, listTools } from "../../runtime-mcp/client";
|
|
3
3
|
import {
|
|
4
4
|
addMCPServer,
|
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
updateMCPServer,
|
|
10
10
|
} from "../../runtime-mcp/config-writer";
|
|
11
11
|
import { MCPManager } from "../../runtime-mcp/manager";
|
|
12
|
+
import { nativeMcpSource } from "../../runtime-mcp/project-host-values";
|
|
12
13
|
import { getSmitheryApiKey } from "../../runtime-mcp/smithery-auth";
|
|
13
14
|
import { searchSmitheryRegistry } from "../../runtime-mcp/smithery-registry";
|
|
14
15
|
import type { MCPServerConfig, MCPServerConnection } from "../../runtime-mcp/types";
|
|
@@ -195,10 +196,19 @@ function parseMcpSearchArgs(rest: string): ParsedMcpSearchArgs {
|
|
|
195
196
|
return { keyword, scope, limit, semantic };
|
|
196
197
|
}
|
|
197
198
|
|
|
199
|
+
/**
|
|
200
|
+
* One terminal row for an untrusted MCP server or tool name.
|
|
201
|
+
* Ordinary names are unchanged. Controls, OSC, and line breaks are not.
|
|
202
|
+
*/
|
|
203
|
+
export function mcpTerminalLabel(value: string): string {
|
|
204
|
+
return sanitizeDisplayLine(value);
|
|
205
|
+
}
|
|
206
|
+
|
|
198
207
|
async function withPreparedMcpConnection<T>(
|
|
199
208
|
runtime: SlashCommandRuntime,
|
|
200
209
|
name: string,
|
|
201
210
|
config: MCPServerConfig,
|
|
211
|
+
scope: AcpMcpScope,
|
|
202
212
|
fn: (connection: MCPServerConnection) => Promise<T>,
|
|
203
213
|
): Promise<T> {
|
|
204
214
|
let connection: MCPServerConnection | undefined;
|
|
@@ -209,7 +219,10 @@ async function withPreparedMcpConnection<T>(
|
|
|
209
219
|
// Without this, `/mcp test|resources|prompts` silently fails for any
|
|
210
220
|
// server saved by the TUI/reauth path.
|
|
211
221
|
manager.setAuthStorage(runtime.session.modelRegistry.authStorage);
|
|
212
|
-
const resolvedConfig = await manager.prepareConfig(
|
|
222
|
+
const resolvedConfig = await manager.prepareConfig(
|
|
223
|
+
config,
|
|
224
|
+
nativeMcpSource(scope, getMCPConfigPath(scope, runtime.cwd)),
|
|
225
|
+
);
|
|
213
226
|
connection = await connectToServer(name, resolvedConfig);
|
|
214
227
|
return await fn(connection);
|
|
215
228
|
} finally {
|
|
@@ -235,9 +248,9 @@ async function collectConnectedMcpLines(
|
|
|
235
248
|
if (servers.length === 0) return undefined;
|
|
236
249
|
|
|
237
250
|
const lines: string[] = [];
|
|
238
|
-
for (const { name, config } of servers) {
|
|
251
|
+
for (const { name, config, scope } of servers) {
|
|
239
252
|
try {
|
|
240
|
-
const collected = await withPreparedMcpConnection(runtime, name, config, connection =>
|
|
253
|
+
const collected = await withPreparedMcpConnection(runtime, name, config, scope, connection =>
|
|
241
254
|
collect(name, connection),
|
|
242
255
|
);
|
|
243
256
|
lines.push(...collected);
|
|
@@ -282,10 +295,10 @@ async function handleTestCommand(rest: string, runtime: SlashCommandRuntime): Pr
|
|
|
282
295
|
if (!server) return usage(`Server "${name}" not found. Run /mcp list to see configured servers.`, runtime);
|
|
283
296
|
|
|
284
297
|
try {
|
|
285
|
-
return await withPreparedMcpConnection(runtime, name, server.config, async connection => {
|
|
298
|
+
return await withPreparedMcpConnection(runtime, name, server.config, server.scope, async connection => {
|
|
286
299
|
const tools = await listTools(connection);
|
|
287
300
|
const lines = [`Server "${name}" connected (${tools.length} tools).`];
|
|
288
|
-
for (const tool of tools) lines.push(` - ${tool.name}`);
|
|
301
|
+
for (const tool of tools) lines.push(` - ${mcpTerminalLabel(tool.name)}`);
|
|
289
302
|
await runtime.output(lines.join("\n"));
|
|
290
303
|
return commandConsumed();
|
|
291
304
|
});
|
|
@@ -405,7 +418,7 @@ async function handleListCommand(runtime: SlashCommandRuntime): Promise<SlashCom
|
|
|
405
418
|
} else {
|
|
406
419
|
location = (config as { command: string }).command;
|
|
407
420
|
}
|
|
408
|
-
return `${name} | ${type} | ${enabled} | ${location ?? "(unknown)"} [${scope}]`;
|
|
421
|
+
return `${mcpTerminalLabel(name)} | ${type} | ${enabled} | ${location ?? "(unknown)"} [${scope}]`;
|
|
409
422
|
})
|
|
410
423
|
.join("\n"),
|
|
411
424
|
);
|
package/src/ssh/ssh-executor.ts
CHANGED
|
@@ -38,8 +38,10 @@ export interface SSHResult {
|
|
|
38
38
|
outputLines: number;
|
|
39
39
|
/** Number of bytes included in the output text */
|
|
40
40
|
outputBytes: number;
|
|
41
|
-
/** Artifact ID if
|
|
41
|
+
/** Artifact ID if output was saved to artifact storage. */
|
|
42
42
|
artifactId?: string;
|
|
43
|
+
/** Bytes omitted from artifact storage after its hard cap was reached. */
|
|
44
|
+
artifactTruncatedBytes?: number;
|
|
43
45
|
}
|
|
44
46
|
|
|
45
47
|
function quoteForCompatShell(command: string): string {
|
package/src/stt/recorder.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as fs from "node:fs/promises";
|
|
2
2
|
import * as os from "node:os";
|
|
3
3
|
import * as path from "node:path";
|
|
4
|
-
import { $which, logger
|
|
4
|
+
import { $which, logger } from "@sayknow-cli/utils";
|
|
5
5
|
import { $ } from "bun";
|
|
6
6
|
|
|
7
7
|
export interface RecordingHandle {
|
|
@@ -212,10 +212,29 @@ if (Test-Path $outPath) {
|
|
|
212
212
|
}
|
|
213
213
|
`;
|
|
214
214
|
|
|
215
|
+
async function writePowerShellRecordingScript(): Promise<{ tempDir: string; scriptPath: string }> {
|
|
216
|
+
// Random directory plus an exclusive create: a preexisting symlink under the
|
|
217
|
+
// shared temp directory is not opened, and the script is not left world-readable.
|
|
218
|
+
const tempDir = await fs.mkdtemp(path.join(os.tmpdir(), "skc-stt-record-"));
|
|
219
|
+
try {
|
|
220
|
+
if (process.platform !== "win32") await fs.chmod(tempDir, 0o700);
|
|
221
|
+
const scriptPath = path.join(tempDir, "record.ps1");
|
|
222
|
+
const handle = await fs.open(scriptPath, "wx", 0o600);
|
|
223
|
+
try {
|
|
224
|
+
await handle.writeFile(PS_RECORD_SCRIPT);
|
|
225
|
+
} finally {
|
|
226
|
+
await handle.close();
|
|
227
|
+
}
|
|
228
|
+
if (process.platform !== "win32") await fs.chmod(scriptPath, 0o600);
|
|
229
|
+
return { tempDir, scriptPath };
|
|
230
|
+
} catch (error) {
|
|
231
|
+
await fs.rm(tempDir, { recursive: true, force: true });
|
|
232
|
+
throw error;
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
|
|
215
236
|
async function startPowerShellRecording(outputPath: string): Promise<RecordingHandle> {
|
|
216
|
-
|
|
217
|
-
const scriptPath = path.join(os.tmpdir(), `skc-stt-record-${Snowflake.next()}.ps1`);
|
|
218
|
-
await Bun.write(scriptPath, PS_RECORD_SCRIPT);
|
|
237
|
+
const { tempDir, scriptPath } = await writePowerShellRecordingScript();
|
|
219
238
|
|
|
220
239
|
const proc = Bun.spawn(["powershell", "-NoProfile", "-ExecutionPolicy", "Bypass", "-File", scriptPath, outputPath], {
|
|
221
240
|
stdin: "pipe",
|
|
@@ -224,7 +243,7 @@ async function startPowerShellRecording(outputPath: string): Promise<RecordingHa
|
|
|
224
243
|
});
|
|
225
244
|
|
|
226
245
|
proc.exited.then(() => {
|
|
227
|
-
fs.
|
|
246
|
+
fs.rm(tempDir, { recursive: true, force: true }).catch(() => {});
|
|
228
247
|
});
|
|
229
248
|
|
|
230
249
|
// Wait for "RECORDING" on stdout to confirm it started
|
|
@@ -250,8 +269,7 @@ async function startPowerShellRecording(outputPath: string): Promise<RecordingHa
|
|
|
250
269
|
if (proc.stderr && typeof proc.stderr !== "number") {
|
|
251
270
|
stderrText = await new Response(proc.stderr as ReadableStream).text();
|
|
252
271
|
}
|
|
253
|
-
|
|
254
|
-
fs.unlink(scriptPath).catch(() => {});
|
|
272
|
+
fs.rm(tempDir, { recursive: true, force: true }).catch(() => {});
|
|
255
273
|
throw new Error(
|
|
256
274
|
`PowerShell audio recording failed to start: ${stderrText.trim() || output.trim() || "(no output)"}`,
|
|
257
275
|
);
|
|
@@ -269,8 +287,7 @@ async function startPowerShellRecording(outputPath: string): Promise<RecordingHa
|
|
|
269
287
|
const killTimer = setTimeout(() => proc.kill(), 8000);
|
|
270
288
|
await proc.exited;
|
|
271
289
|
clearTimeout(killTimer);
|
|
272
|
-
|
|
273
|
-
fs.unlink(scriptPath).catch(() => {});
|
|
290
|
+
fs.rm(tempDir, { recursive: true, force: true }).catch(() => {});
|
|
274
291
|
},
|
|
275
292
|
};
|
|
276
293
|
}
|
package/src/system-prompt.ts
CHANGED
|
@@ -75,6 +75,31 @@ function sanitizeEmbeddedPromptContent(content: string): string {
|
|
|
75
75
|
return escapePromptMetadata(content, { preserveNewlines: true });
|
|
76
76
|
}
|
|
77
77
|
|
|
78
|
+
const UNTRUSTED_CONTENT_OPEN_LINE = "<untrusted-content>\n";
|
|
79
|
+
const UNTRUSTED_CONTENT_CLOSE_LINE = "\n</untrusted-content>";
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Encode an inventory description. MCP descriptions already include a host-owned
|
|
83
|
+
* untrusted-content fence; keep those delimiters and encode only the body.
|
|
84
|
+
* A body that still contains a closing fence is not that wrapper, so encode the whole value.
|
|
85
|
+
*/
|
|
86
|
+
function escapeInventoryDescription(description: string): string {
|
|
87
|
+
const openLength = UNTRUSTED_CONTENT_OPEN_LINE.length;
|
|
88
|
+
const closeLength = UNTRUSTED_CONTENT_CLOSE_LINE.length;
|
|
89
|
+
if (
|
|
90
|
+
description.startsWith(UNTRUSTED_CONTENT_OPEN_LINE) &&
|
|
91
|
+
description.endsWith(UNTRUSTED_CONTENT_CLOSE_LINE) &&
|
|
92
|
+
description.length >= openLength + closeLength
|
|
93
|
+
) {
|
|
94
|
+
const body = description.slice(openLength, -closeLength);
|
|
95
|
+
if (!/<\/untrusted-content>/i.test(body)) {
|
|
96
|
+
const encodedBody = escapePromptMetadata(body, { preserveNewlines: true });
|
|
97
|
+
return `${UNTRUSTED_CONTENT_OPEN_LINE}${encodedBody}${UNTRUSTED_CONTENT_CLOSE_LINE}`;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
return escapePromptMetadata(description, { preserveNewlines: true });
|
|
101
|
+
}
|
|
102
|
+
|
|
78
103
|
function firstNonEmpty(...values: (string | undefined | null)[]): string | null {
|
|
79
104
|
for (const value of values) {
|
|
80
105
|
const trimmed = value?.trim();
|
|
@@ -292,8 +317,9 @@ export async function loadProjectContextFiles(
|
|
|
292
317
|
}
|
|
293
318
|
|
|
294
319
|
/**
|
|
295
|
-
* Load the
|
|
296
|
-
*
|
|
320
|
+
* Load the user system prompt customization from SYSTEM.md.
|
|
321
|
+
* A repository SYSTEM.md is untrusted project text. It must not replace the
|
|
322
|
+
* user file or become the customization block.
|
|
297
323
|
*/
|
|
298
324
|
export async function loadSystemPromptFiles(options: LoadContextFilesOptions = {}): Promise<string | null> {
|
|
299
325
|
const resolvedCwd = options.cwd ?? getProjectDir();
|
|
@@ -302,11 +328,6 @@ export async function loadSystemPromptFiles(options: LoadContextFilesOptions = {
|
|
|
302
328
|
|
|
303
329
|
if (result.items.length === 0) return null;
|
|
304
330
|
|
|
305
|
-
const projectLevel = result.items.find(item => item.level === "project");
|
|
306
|
-
if (projectLevel) {
|
|
307
|
-
return projectLevel.content;
|
|
308
|
-
}
|
|
309
|
-
|
|
310
331
|
const userLevel = result.items.find(item => item.level === "user");
|
|
311
332
|
return userLevel?.content ?? null;
|
|
312
333
|
}
|
|
@@ -369,6 +390,8 @@ export interface BuildSystemPromptOptions {
|
|
|
369
390
|
intentField?: string;
|
|
370
391
|
/** Whether built-in tool discovery is active; enables the tool-discovery prompt block. */
|
|
371
392
|
toolDiscoveryActive?: boolean;
|
|
393
|
+
/** Whether the discoverable `reverse_engineer` tool is registered; enables its routing hint. */
|
|
394
|
+
reverseEngineerAvailable?: boolean;
|
|
372
395
|
/** Encourage the agent to delegate via tasks unless changes are trivial. */
|
|
373
396
|
eagerTasks?: boolean;
|
|
374
397
|
/** Rules with alwaysApply=true — their full content is injected into the prompt. */
|
|
@@ -442,6 +465,7 @@ export async function buildSystemPrompt(options: BuildSystemPromptOptions = {}):
|
|
|
442
465
|
alwaysApplyRules,
|
|
443
466
|
intentField,
|
|
444
467
|
toolDiscoveryActive = false,
|
|
468
|
+
reverseEngineerAvailable = false,
|
|
445
469
|
eagerTasks = false,
|
|
446
470
|
secretsEnabled = false,
|
|
447
471
|
reasoningLanguage = "off",
|
|
@@ -571,18 +595,31 @@ export async function buildSystemPrompt(options: BuildSystemPromptOptions = {}):
|
|
|
571
595
|
const toolPromptNames = new Map<string, string>(toolNames.map(name => [name, tools?.get(name)?.wireName ?? name]));
|
|
572
596
|
const toolRefs = Object.fromEntries(toolPromptNames.entries());
|
|
573
597
|
const hasHiddenToolDiscoveryTool = Object.hasOwn(toolRefs, "search_tool_bm25");
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
598
|
+
// The inventory template is compiled with noEscape. Encode tool metadata here so a
|
|
599
|
+
// tools/list label or description cannot close <inventory> or insert a system block.
|
|
600
|
+
// Repeated MCP descriptions keep the host <untrusted-content> fence; only the body is encoded.
|
|
601
|
+
// The `tools` list stays raw so {{#has}} still matches the call name.
|
|
602
|
+
const toolInfo = toolNames.map(name => {
|
|
603
|
+
const meta = tools?.get(name);
|
|
604
|
+
return {
|
|
605
|
+
name: escapePromptMetadata(toolPromptNames.get(name) ?? name),
|
|
606
|
+
internalName: escapePromptMetadata(name),
|
|
607
|
+
label: escapePromptMetadata(meta?.label ?? ""),
|
|
608
|
+
description: escapeInventoryDescription(meta?.description ?? ""),
|
|
609
|
+
};
|
|
610
|
+
});
|
|
580
611
|
|
|
581
|
-
const
|
|
612
|
+
const rawSystemPromptCustomization = dedupePromptSource(systemPromptCustomization, [
|
|
582
613
|
resolvedCustomPrompt,
|
|
583
614
|
resolvedAppendPrompt,
|
|
584
615
|
]);
|
|
585
|
-
|
|
616
|
+
// Encode after dedupe so rule matching still sees the file text. The customization
|
|
617
|
+
// template is noEscape; the same encoder used for context files keeps a file from
|
|
618
|
+
// closing <system-prompt-customization> or forging a sibling marker.
|
|
619
|
+
const effectiveSystemPromptCustomization = rawSystemPromptCustomization
|
|
620
|
+
? sanitizeEmbeddedPromptContent(rawSystemPromptCustomization)
|
|
621
|
+
: "";
|
|
622
|
+
const promptSources = [rawSystemPromptCustomization, resolvedCustomPrompt, resolvedAppendPrompt];
|
|
586
623
|
const injectedAlwaysApplyRules = dedupeAlwaysApplyRules(alwaysApplyRules, promptSources);
|
|
587
624
|
|
|
588
625
|
const environment = await logger.time("getEnvironmentInfo", getEnvironmentInfo);
|
|
@@ -597,6 +634,17 @@ export async function buildSystemPrompt(options: BuildSystemPromptOptions = {}):
|
|
|
597
634
|
path: escapePromptMetadata(rule.path),
|
|
598
635
|
content: sanitizeEmbeddedPromptContent(rule.content),
|
|
599
636
|
}));
|
|
637
|
+
// Both rulebook templates compile with noEscape. Encode the fields they interpolate
|
|
638
|
+
// so repository frontmatter cannot close <rules> or the name attribute.
|
|
639
|
+
const sanitizedRulebookRules = (rules ?? []).map(rule => ({
|
|
640
|
+
...rule,
|
|
641
|
+
name: escapePromptMetadata(rule.name),
|
|
642
|
+
description:
|
|
643
|
+
rule.description === undefined
|
|
644
|
+
? undefined
|
|
645
|
+
: escapePromptMetadata(rule.description, { preserveNewlines: true }),
|
|
646
|
+
globs: rule.globs?.map(glob => escapePromptMetadata(glob)),
|
|
647
|
+
}));
|
|
600
648
|
const data = {
|
|
601
649
|
systemPromptCustomization: effectiveSystemPromptCustomization,
|
|
602
650
|
customPrompt: resolvedCustomPrompt,
|
|
@@ -609,7 +657,7 @@ export async function buildSystemPrompt(options: BuildSystemPromptOptions = {}):
|
|
|
609
657
|
contextFiles: sanitizedContextFiles,
|
|
610
658
|
agentsMdSearch: { files: agentsMdFiles.map(file => escapePromptMetadata(file)) },
|
|
611
659
|
workspaceTree,
|
|
612
|
-
rules:
|
|
660
|
+
rules: sanitizedRulebookRules,
|
|
613
661
|
alwaysApplyRules: sanitizedAlwaysApplyRules,
|
|
614
662
|
date,
|
|
615
663
|
dateTime,
|
|
@@ -617,6 +665,7 @@ export async function buildSystemPrompt(options: BuildSystemPromptOptions = {}):
|
|
|
617
665
|
intentTracing: !!intentField,
|
|
618
666
|
intentField: intentField ?? "",
|
|
619
667
|
toolDiscoveryActive: toolDiscoveryActive && hasHiddenToolDiscoveryTool,
|
|
668
|
+
reverseEngineerAvailable,
|
|
620
669
|
eagerTasks,
|
|
621
670
|
secretsEnabled,
|
|
622
671
|
reasoningLanguageEnglish: reasoningLanguage === "english",
|
package/src/task/commands.ts
CHANGED
|
@@ -120,7 +120,9 @@ export function getCommand(commands: WorkflowCommand[], name: string): WorkflowC
|
|
|
120
120
|
* Replaces $@ with the provided input.
|
|
121
121
|
*/
|
|
122
122
|
export function expandCommand(command: WorkflowCommand, input: string): string {
|
|
123
|
-
|
|
123
|
+
// Function replacer: `input` is user text and must be inserted verbatim, not
|
|
124
|
+
// parsed for `$&`, `$$`, `` $` `` or `$'` replacement patterns.
|
|
125
|
+
return command.instructions.replace(/\$@/g, () => input);
|
|
124
126
|
}
|
|
125
127
|
|
|
126
128
|
/**
|
package/src/task/executor.ts
CHANGED
|
@@ -30,6 +30,7 @@ import { buildAgentSubskillInjection, renderAgentPromptAdditions } from "../exte
|
|
|
30
30
|
import { buildSkillPromptMessage, type Skill } from "../extensibility/skills";
|
|
31
31
|
import type { HindsightSessionState } from "../hindsight/state";
|
|
32
32
|
import type { LocalProtocolOptions } from "../internal-urls";
|
|
33
|
+
import type { PlanModeState } from "../plan-mode/state";
|
|
33
34
|
import subagentSystemPromptTemplate from "../prompts/system/subagent-system-prompt.md" with { type: "text" };
|
|
34
35
|
import subagentUserPromptTemplate from "../prompts/system/subagent-user-prompt.md" with { type: "text" };
|
|
35
36
|
import submitReminderTemplate from "../prompts/system/subagent-yield-reminder.md" with { type: "text" };
|
|
@@ -38,6 +39,7 @@ import { createAgentSession, discoverAuthStorage } from "../sdk";
|
|
|
38
39
|
import type { AgentSession, AgentSessionEvent, ForkContextSeed } from "../session/agent-session";
|
|
39
40
|
import type { ArtifactManager } from "../session/artifacts";
|
|
40
41
|
import type { AuthStorage } from "../session/auth-storage";
|
|
42
|
+
import type { ClientBridge } from "../session/client-bridge";
|
|
41
43
|
import { SKILL_PROMPT_MESSAGE_TYPE } from "../session/messages";
|
|
42
44
|
import type { DetectedLanguage } from "../session/response-language";
|
|
43
45
|
import { SessionManager } from "../session/session-manager";
|
|
@@ -52,6 +54,7 @@ import { buildNamedToolChoiceResult } from "../utils/tool-choice";
|
|
|
52
54
|
import type { WorkspaceTree } from "../workspace-tree";
|
|
53
55
|
import { validateAllocatedTaskId } from "./id";
|
|
54
56
|
import { classifyProviderRetry, providerNameFromModel } from "./provider-retry-status";
|
|
57
|
+
import { containSubagentRoleBody } from "./role-body";
|
|
55
58
|
import { subprocessToolRegistry } from "./subprocess-tool-registry";
|
|
56
59
|
import { persistTaskTokenLog, taskTokenLogFromUsage } from "./token-log";
|
|
57
60
|
import {
|
|
@@ -242,6 +245,21 @@ export interface ExecutorOptions {
|
|
|
242
245
|
* subagents, and a main-model fast-mode auto-disable does not clobber it.
|
|
243
246
|
*/
|
|
244
247
|
inheritedServiceTier?: ServiceTier;
|
|
248
|
+
/**
|
|
249
|
+
* Parent ACP/SDK approval mode. `deny` and `prompt` replace the child
|
|
250
|
+
* default (`allow`) before the first prompt. `allow` is that default.
|
|
251
|
+
*/
|
|
252
|
+
sdkPermissionMode?: "prompt" | "allow" | "deny";
|
|
253
|
+
/**
|
|
254
|
+
* Parent plan-mode state. Copied onto the child before the first prompt so
|
|
255
|
+
* `enforcePlanModeWrite` still refuses product-file writes.
|
|
256
|
+
*/
|
|
257
|
+
planModeState?: PlanModeState;
|
|
258
|
+
/**
|
|
259
|
+
* Parent client bridge. Only `requestPermission` is copied onto the child.
|
|
260
|
+
* Terminal, filesystem, and deferAgentInitiatedTurns stay on the parent.
|
|
261
|
+
*/
|
|
262
|
+
clientBridge?: ClientBridge;
|
|
245
263
|
/** Override local:// protocol options so subagent shares parent's local:// root */
|
|
246
264
|
localProtocolOptions?: LocalProtocolOptions;
|
|
247
265
|
/**
|
|
@@ -736,6 +754,16 @@ export function createSubagentSettings(baseSettings: Settings, inheritedServiceT
|
|
|
736
754
|
/**
|
|
737
755
|
* Run a single agent in-process.
|
|
738
756
|
*/
|
|
757
|
+
/** Permission callback only. Terminal, filesystem, and defer flags stay on the parent. */
|
|
758
|
+
function permissionOnlyBridge(bridge: ClientBridge | undefined): ClientBridge | undefined {
|
|
759
|
+
if (!bridge?.requestPermission || bridge.capabilities.requestPermission !== true) return undefined;
|
|
760
|
+
const requestPermission = bridge.requestPermission.bind(bridge);
|
|
761
|
+
return {
|
|
762
|
+
capabilities: { requestPermission: true },
|
|
763
|
+
requestPermission: (toolCall, options, signal) => requestPermission(toolCall, options, signal),
|
|
764
|
+
};
|
|
765
|
+
}
|
|
766
|
+
|
|
739
767
|
export async function runSubprocess(options: ExecutorOptions): Promise<SingleResult> {
|
|
740
768
|
const {
|
|
741
769
|
cwd,
|
|
@@ -1611,14 +1639,15 @@ export async function runSubprocess(options: ExecutorOptions): Promise<SingleRes
|
|
|
1611
1639
|
promptTemplates: options.promptTemplates,
|
|
1612
1640
|
workspaceTree: options.workspaceTree,
|
|
1613
1641
|
systemPrompt: defaultPrompt => {
|
|
1614
|
-
const
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
assignment: options.assignment ?? task,
|
|
1620
|
-
}),
|
|
1642
|
+
const renderedRole = prompt.render(agent.systemPrompt, {
|
|
1643
|
+
// Typed executionMode wins; assignment text is compatibility-only (#2698 / #2456).
|
|
1644
|
+
ultragoalRedTeam: resolveUltragoalRedTeamActivation({
|
|
1645
|
+
executionMode: options.executionMode,
|
|
1646
|
+
assignment: options.assignment ?? task,
|
|
1621
1647
|
}),
|
|
1648
|
+
});
|
|
1649
|
+
const subagentPrompt = prompt.render(subagentSystemPromptTemplate, {
|
|
1650
|
+
agent: containSubagentRoleBody(renderedRole),
|
|
1622
1651
|
context: options.context?.trim() ?? "",
|
|
1623
1652
|
worktree: worktree ?? "",
|
|
1624
1653
|
outputSchema: normalizedOutputSchema,
|
|
@@ -1667,6 +1696,22 @@ export async function runSubprocess(options: ExecutorOptions): Promise<SingleRes
|
|
|
1667
1696
|
);
|
|
1668
1697
|
|
|
1669
1698
|
activeSession = session;
|
|
1699
|
+
// Plan mode is session state, not a tool-list filter. Copy it before the
|
|
1700
|
+
// first prompt so product writes hit the same read-only guard as the parent.
|
|
1701
|
+
if (options.planModeState?.enabled) {
|
|
1702
|
+
session.setPlanModeState({
|
|
1703
|
+
enabled: true,
|
|
1704
|
+
planFilePath: options.planModeState.planFilePath,
|
|
1705
|
+
...(options.planModeState.workflow ? { workflow: options.planModeState.workflow } : {}),
|
|
1706
|
+
...(options.planModeState.reentry !== undefined ? { reentry: options.planModeState.reentry } : {}),
|
|
1707
|
+
});
|
|
1708
|
+
}
|
|
1709
|
+
// `allow` is the child default. deny/prompt must be copied before the first prompt.
|
|
1710
|
+
if (options.sdkPermissionMode === "deny" || options.sdkPermissionMode === "prompt") {
|
|
1711
|
+
session.setSdkPermissionMode(options.sdkPermissionMode);
|
|
1712
|
+
}
|
|
1713
|
+
const approvalBridge = permissionOnlyBridge(options.clientBridge);
|
|
1714
|
+
if (approvalBridge) session.setClientBridge(approvalBridge);
|
|
1670
1715
|
// Each subagent invocation owns a fresh controller; its configured chain
|
|
1671
1716
|
// is scoped to this child session and never shares parent sticky state.
|
|
1672
1717
|
// Auth-aware resolution can substitute the parent model only after every
|
package/src/task/index.ts
CHANGED
|
@@ -25,6 +25,7 @@ import { normalizeModelSelectorValue } from "../config/model-selector-value";
|
|
|
25
25
|
import type { TaskModelSpecialty } from "../config/task-model-specialties";
|
|
26
26
|
import type { TaskRoutingResult } from "../decisions/task-routing";
|
|
27
27
|
import type { Theme } from "../modes/theme/theme";
|
|
28
|
+
import type { PlanModeState } from "../plan-mode/state";
|
|
28
29
|
import planModeSubagentPrompt from "../prompts/system/plan-mode-subagent.md" with { type: "text" };
|
|
29
30
|
import taskDescriptionTemplate from "../prompts/tools/task.md" with { type: "text" };
|
|
30
31
|
import taskSummaryTemplate from "../prompts/tools/task-summary.md" with { type: "text" };
|
|
@@ -99,6 +100,29 @@ interface TaskResumeDescriptor {
|
|
|
99
100
|
function isTaskResumeDescriptor(value: unknown): value is TaskResumeDescriptor {
|
|
100
101
|
return typeof value === "object" && value !== null && "task" in value && "params" in value;
|
|
101
102
|
}
|
|
103
|
+
/** Approval policy copied into a task child. A missing mode stays `allow`, the child default. */
|
|
104
|
+
function inheritedSubagentApproval(session: ToolSession) {
|
|
105
|
+
const mode = session.getSdkPermissionMode?.();
|
|
106
|
+
return {
|
|
107
|
+
sdkPermissionMode: mode === "deny" || mode === "prompt" ? mode : ("allow" as const),
|
|
108
|
+
clientBridge: session.getClientBridge?.(),
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/** Enabled plan mode only. A missing or disabled state leaves the child writable. */
|
|
113
|
+
function inheritedPlanMode(session: ToolSession): { planModeState?: PlanModeState } {
|
|
114
|
+
const state = session.getPlanModeState?.();
|
|
115
|
+
if (!state?.enabled || !state.planFilePath) return {};
|
|
116
|
+
return {
|
|
117
|
+
planModeState: {
|
|
118
|
+
enabled: true,
|
|
119
|
+
planFilePath: state.planFilePath,
|
|
120
|
+
...(state.workflow ? { workflow: state.workflow } : {}),
|
|
121
|
+
...(state.reentry !== undefined ? { reentry: state.reentry } : {}),
|
|
122
|
+
},
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
|
|
102
126
|
function renderTaskAssignment(assignment: string, simpleMode: TaskSimpleMode): string {
|
|
103
127
|
return renderSubagentUserPrompt(assignment, simpleMode === "independent");
|
|
104
128
|
}
|
|
@@ -1596,6 +1620,8 @@ export class TaskTool implements AgentTool<TaskToolSchemaInstance, TaskToolDetai
|
|
|
1596
1620
|
agentRegistry: this.session.agentRegistry,
|
|
1597
1621
|
settings: this.session.settings,
|
|
1598
1622
|
inheritedServiceTier: this.session.serviceTier,
|
|
1623
|
+
...inheritedSubagentApproval(this.session),
|
|
1624
|
+
...inheritedPlanMode(this.session),
|
|
1599
1625
|
contextFiles,
|
|
1600
1626
|
skills: availableSkills,
|
|
1601
1627
|
autoloadSkills: resolvedAutoloadSkills,
|
|
@@ -1672,6 +1698,8 @@ export class TaskTool implements AgentTool<TaskToolSchemaInstance, TaskToolDetai
|
|
|
1672
1698
|
agentRegistry: this.session.agentRegistry,
|
|
1673
1699
|
settings: this.session.settings,
|
|
1674
1700
|
inheritedServiceTier: this.session.serviceTier,
|
|
1701
|
+
...inheritedSubagentApproval(this.session),
|
|
1702
|
+
...inheritedPlanMode(this.session),
|
|
1675
1703
|
contextFiles,
|
|
1676
1704
|
skills: availableSkills,
|
|
1677
1705
|
autoloadSkills: resolvedAutoloadSkills,
|