@sayknow-cli/coding-agent 0.4.6 → 0.5.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/CHANGELOG.md +112 -0
- package/dist/types/capability/index.d.ts +10 -20
- package/dist/types/capability/types.d.ts +3 -0
- package/dist/types/cli/args.d.ts +0 -2
- package/dist/types/cli/read-cli.d.ts +1 -0
- package/dist/types/cli.d.ts +9 -1
- package/dist/types/commands/daemon.d.ts +2 -2
- package/dist/types/commands/deep-interview.d.ts +9 -0
- package/dist/types/commands/harness.d.ts +22 -0
- package/dist/types/commands/read.d.ts +6 -0
- package/dist/types/commands/sdk.d.ts +20 -2
- package/dist/types/config/keybindings.d.ts +34 -4
- package/dist/types/config/model-profile-contract.d.ts +40 -0
- package/dist/types/config/model-profiles.d.ts +2 -3
- package/dist/types/config/model-registry.d.ts +5 -0
- package/dist/types/config/provider-auth-health.d.ts +14 -0
- package/dist/types/config/provider-ranking.d.ts +59 -0
- package/dist/types/config/settings-schema.d.ts +156 -10
- package/dist/types/config/settings.d.ts +3 -0
- package/dist/types/edit/modes/patch.d.ts +13 -0
- package/dist/types/edit/path-mutation-lock.d.ts +15 -0
- package/dist/types/eval/py/executor.d.ts +1 -1
- package/dist/types/eval/py/runner-artifact.d.ts +8 -0
- package/dist/types/eval/py/tool-bridge.d.ts +1 -2
- package/dist/types/extensibility/extensions/types.d.ts +43 -2
- package/dist/types/extensibility/shared-events.d.ts +6 -0
- package/dist/types/internal-urls/local-root-gc.d.ts +2 -0
- package/dist/types/main.d.ts +33 -2
- package/dist/types/memories/index.d.ts +2 -0
- package/dist/types/modes/acp/acp-agent.d.ts +22 -9
- package/dist/types/modes/components/assistant-message.d.ts +3 -1
- package/dist/types/modes/components/btw-panel.d.ts +1 -0
- package/dist/types/modes/components/irc-sidebar.d.ts +41 -0
- package/dist/types/modes/components/queue-pane.d.ts +8 -0
- package/dist/types/modes/components/queued-message-selector.d.ts +6 -0
- package/dist/types/modes/components/read-tool-group.d.ts +4 -4
- package/dist/types/modes/components/runtime-mcp-add-wizard.d.ts +2 -1
- package/dist/types/modes/components/session-observer-overlay.d.ts +4 -0
- package/dist/types/modes/components/settings-selector.d.ts +2 -0
- package/dist/types/modes/components/tool-execution.d.ts +8 -0
- package/dist/types/modes/components/tool-status-header.d.ts +4 -2
- package/dist/types/modes/components/welcome.d.ts +5 -0
- package/dist/types/modes/controllers/btw-controller.d.ts +5 -0
- package/dist/types/modes/controllers/command-controller.d.ts +2 -0
- package/dist/types/modes/controllers/event-controller.d.ts +3 -0
- package/dist/types/modes/interactive-mode.d.ts +13 -2
- package/dist/types/modes/irc-observation-ledger.d.ts +17 -1
- package/dist/types/modes/prompt-action-autocomplete.d.ts +6 -1
- package/dist/types/modes/prompt-suggestion-controller.d.ts +35 -0
- package/dist/types/modes/shared/agent-wire/workflow-gate-broker.d.ts +2 -2
- package/dist/types/modes/types.d.ts +6 -0
- package/dist/types/modes/utils/hotkeys-markdown.d.ts +2 -1
- package/dist/types/modes/utils/ui-helpers.d.ts +16 -0
- package/dist/types/runtime/memory-domain.d.ts +9 -0
- package/dist/types/runtime/memory-guard-contract.d.ts +71 -0
- package/dist/types/runtime/memory-guard.d.ts +39 -0
- package/dist/types/runtime/memory-limit.d.ts +11 -0
- package/dist/types/runtime-mcp/content-limits.d.ts +7 -0
- package/dist/types/runtime-mcp/discoverable-tool-metadata.d.ts +1 -1
- package/dist/types/runtime-mcp/manager.d.ts +9 -1
- package/dist/types/runtime-mcp/oauth-flow.d.ts +0 -5
- package/dist/types/runtime-mcp/plugin-network-boundary.d.ts +14 -0
- package/dist/types/runtime-mcp/redaction.d.ts +2 -0
- package/dist/types/runtime-mcp/smithery-auth.d.ts +5 -0
- package/dist/types/sdk/acp/final-text.d.ts +19 -0
- package/dist/types/sdk/acp/mcp.d.ts +23 -0
- package/dist/types/sdk/broker/broker.d.ts +2 -0
- package/dist/types/sdk/broker/lifecycle.d.ts +13 -0
- package/dist/types/sdk/bus/chat-daemon-control.d.ts +9 -1
- package/dist/types/sdk/bus/config-commands.d.ts +2 -2
- package/dist/types/sdk/bus/config.d.ts +2 -0
- package/dist/types/sdk/bus/control-drain-lease.d.ts +52 -0
- package/dist/types/sdk/bus/conversation-store.d.ts +1 -0
- package/dist/types/sdk/bus/daemon-paths.d.ts +1 -0
- package/dist/types/sdk/bus/index.d.ts +52 -4
- package/dist/types/sdk/bus/kind-aware-reconciliation.d.ts +37 -0
- package/dist/types/sdk/bus/lifecycle-commands.d.ts +5 -4
- package/dist/types/sdk/bus/notification-orchestration.d.ts +1 -0
- package/dist/types/sdk/bus/notification-service.d.ts +34 -0
- package/dist/types/sdk/bus/operator-runtime.d.ts +1 -0
- package/dist/types/sdk/bus/prompt-reconciliation.d.ts +106 -0
- package/dist/types/sdk/bus/rate-limit-pool.d.ts +2 -0
- package/dist/types/sdk/bus/reconciliation-store.d.ts +65 -0
- package/dist/types/sdk/bus/telegram-daemon-contract.d.ts +33 -9
- package/dist/types/sdk/bus/telegram-daemon-control.d.ts +5 -1
- package/dist/types/sdk/bus/telegram-daemon.d.ts +286 -12
- package/dist/types/sdk/bus/telegram-reference.d.ts +2 -0
- package/dist/types/sdk/bus/topic-registry.d.ts +88 -2
- package/dist/types/sdk/client/discovery.d.ts +2 -0
- package/dist/types/sdk/client/liveness.d.ts +7 -0
- package/dist/types/sdk/host/control/operations.d.ts +3 -2
- package/dist/types/sdk/host/host.d.ts +3 -1
- package/dist/types/sdk/host/query/handlers.d.ts +14 -0
- package/dist/types/sdk/index.d.ts +2 -0
- package/dist/types/sdk/lifecycle-session.d.ts +10 -1
- package/dist/types/sdk/prompt-status.d.ts +88 -0
- package/dist/types/sdk/session-directory.d.ts +1 -1
- package/dist/types/sdk/session.d.ts +7 -0
- package/dist/types/sdk/startup-capability.d.ts +9 -0
- package/dist/types/sdk/transport/auth-preface.d.ts +9 -0
- package/dist/types/sdk/transport/index.d.ts +12 -0
- package/dist/types/sdk/transport/relay.d.ts +43 -0
- package/dist/types/sdk/transport/serve-cli.d.ts +4 -0
- package/dist/types/sdk/transport/socket.d.ts +7 -0
- package/dist/types/sdk/transport/stdio.d.ts +3 -0
- package/dist/types/session/agent-session.d.ts +83 -24
- package/dist/types/session/btw-contract.d.ts +16 -0
- package/dist/types/session/fallback-chain-controller.d.ts +18 -2
- package/dist/types/session/internal/managed-session-scope.d.ts +70 -10
- package/dist/types/session/internal/managed-session-storage.d.ts +34 -12
- package/dist/types/session/internal/native-publish-outcome.d.ts +48 -0
- package/dist/types/session/memory-guard-checkpoint-participant.d.ts +69 -0
- package/dist/types/session/session-manager.d.ts +89 -18
- package/dist/types/session/session-storage.d.ts +31 -0
- package/dist/types/session/streaming-output.d.ts +60 -5
- package/dist/types/setup/credential-import.d.ts +5 -1
- package/dist/types/setup/provider-onboarding.d.ts +2 -0
- package/dist/types/skc-runtime/deep-interview-runtime.d.ts +1 -1
- package/dist/types/skc-runtime/deep-interview-stage.d.ts +37 -0
- package/dist/types/skc-runtime/gc-runtime.d.ts +1 -1
- package/dist/types/skc-runtime/linux-proc.d.ts +22 -14
- package/dist/types/skc-runtime/memory-guard-owner-claims.d.ts +47 -0
- package/dist/types/skc-runtime/ralplan-runtime.d.ts +112 -1
- package/dist/types/skc-runtime/repository-binding.d.ts +63 -0
- package/dist/types/skc-runtime/state-runtime.d.ts +3 -1
- package/dist/types/skc-runtime/state-writer.d.ts +5 -1
- package/dist/types/skc-runtime/team-launch.d.ts +1 -1
- package/dist/types/skc-runtime/team-runtime.d.ts +9 -2
- package/dist/types/skc-runtime/team-store.d.ts +12 -0
- package/dist/types/skc-runtime/team-worker-memory-guard.d.ts +92 -0
- package/dist/types/skc-runtime/tmux-owner-isolation.d.ts +7 -0
- package/dist/types/skc-runtime/ultragoal-guard.d.ts +6 -5
- package/dist/types/skc-runtime/ultragoal-receipt-freshness.d.ts +28 -0
- package/dist/types/skc-runtime/ultragoal-runtime.d.ts +43 -5
- package/dist/types/skill-state/workflow-hud.d.ts +3 -0
- package/dist/types/ssh/utils.d.ts +1 -0
- package/dist/types/task/discovery.d.ts +3 -1
- package/dist/types/task/executor.d.ts +6 -0
- package/dist/types/task/index.d.ts +3 -1
- package/dist/types/task/provider-retry-status.d.ts +13 -0
- package/dist/types/task/receipt.d.ts +2 -0
- package/dist/types/task/types.d.ts +133 -0
- package/dist/types/task/ultragoal-redteam-activation.d.ts +33 -0
- package/dist/types/tools/browser/launch.d.ts +7 -0
- package/dist/types/tools/fetch.d.ts +22 -9
- package/dist/types/tools/image-gen.d.ts +63 -1
- package/dist/types/tools/index.d.ts +7 -1
- package/dist/types/tools/output-meta.d.ts +21 -1
- package/dist/types/tools/read-internals.d.ts +12 -0
- package/dist/types/tools/read.d.ts +45 -1
- package/dist/types/tools/resource-gc.d.ts +23 -0
- package/dist/types/tools/skill-discovery.d.ts +7 -0
- package/dist/types/tools/sqlite-reader.d.ts +7 -0
- package/dist/types/tools/tool-result.d.ts +7 -1
- package/dist/types/utils/prompt-suggestion.d.ts +33 -0
- package/dist/types/utils/shell-snapshot.d.ts +12 -0
- package/dist/types/web/insane/bridge.d.ts +1 -0
- package/dist/types/web/insane/url-guard.d.ts +17 -0
- package/package.json +8 -12
- package/scripts/benchmark-sticky-viewport-pr1.ts +239 -0
- package/scripts/capture-platform-shortcut-labels-showcase.ts +342 -0
- package/scripts/capture-sticky-viewport-showcase.ts +292 -0
- package/scripts/compile-args.ts +0 -1
- package/scripts/dogfood-repository-binding.ts +209 -0
- package/scripts/generate-docs-index.ts +4 -1
- package/scripts/generate-sdk-operation-inventory.ts +9 -0
- package/scripts/run-test-manifest.ts +6 -4
- package/scripts/verify-skc-sdk-canonicalization.ts +122 -18
- package/scripts/verify-sticky-viewport-showcase.ts +611 -0
- package/src/capability/index.ts +58 -42
- package/src/capability/types.ts +3 -0
- package/src/cli/args.ts +16 -100
- package/src/cli/fast-help.ts +1 -1
- package/src/cli/mcp-cli.ts +4 -21
- package/src/cli/notify-cli.ts +6 -38
- package/src/cli/read-cli.ts +2 -1
- package/src/cli/setup-cli.ts +10 -4
- package/src/cli.ts +133 -11
- package/src/commands/daemon.ts +22 -5
- package/src/commands/deep-interview.ts +26 -1
- package/src/commands/harness.ts +35 -12
- package/src/commands/read.ts +11 -2
- package/src/commands/sdk.ts +134 -17
- package/src/commands/team.ts +1 -1
- package/src/commit/agentic/index.ts +3 -3
- package/src/commit/map-reduce/index.ts +2 -2
- package/src/config/keybindings.ts +158 -25
- package/src/config/model-profile-contract.ts +174 -0
- package/src/config/model-profiles.ts +51 -10
- package/src/config/model-registry.ts +24 -4
- package/src/config/model-resolver.ts +2 -2
- package/src/config/provider-auth-health.ts +42 -0
- package/src/config/provider-ranking.ts +119 -0
- package/src/config/settings-schema.ts +157 -10
- package/src/config/settings.ts +254 -108
- package/src/coordinator-mcp/model-preset.ts +21 -74
- package/src/defaults/skc/skills/deep-interview/SKILL.md +147 -24
- package/src/defaults/skc/skills/ralplan/SKILL.md +91 -34
- package/src/defaults/skc/skills/team/SKILL.md +1 -1
- package/src/defaults/skc/skills/ultragoal/SKILL.md +68 -17
- package/src/discovery/ssh.ts +12 -1
- package/src/edit/index.ts +3 -6
- package/src/edit/modes/patch.ts +38 -1
- package/src/edit/modes/replace.ts +42 -0
- package/src/edit/path-mutation-lock.ts +112 -0
- package/src/eval/js/tool-bridge.ts +1 -1
- package/src/eval/py/executor.ts +37 -13
- package/src/eval/py/kernel.ts +1 -21
- package/src/eval/py/prelude.py +2 -2
- package/src/eval/py/runner-artifact.ts +84 -0
- package/src/eval/py/tool-bridge.ts +34 -18
- package/src/extensibility/extensions/runner.ts +4 -0
- package/src/extensibility/extensions/types.ts +42 -4
- package/src/extensibility/plugins/marketplace/fetcher.ts +191 -7
- package/src/extensibility/shared-events.ts +5 -0
- package/src/extensibility/skc-plugins/runtime-adapters.ts +2 -1
- package/src/hooks/native-skill-hook.ts +17 -4
- package/src/internal-urls/docs-index.generated.ts +17 -16
- package/src/internal-urls/local-protocol.ts +87 -25
- package/src/internal-urls/local-root-gc.ts +127 -0
- package/src/internal-urls/mcp-protocol.ts +73 -11
- package/src/main.ts +120 -42
- package/src/memories/index.ts +10 -0
- package/src/modes/DESIGN.md +52 -0
- package/src/modes/acp/acp-agent.ts +647 -83
- package/src/modes/acp/acp-event-mapper.ts +106 -12
- package/src/modes/acp/acp-mode.ts +39 -3
- package/src/modes/action-registry.ts +1 -1
- package/src/modes/components/assistant-message.ts +123 -22
- package/src/modes/components/btw-panel.ts +82 -16
- package/src/modes/components/irc-sidebar.ts +176 -62
- package/src/modes/components/model-selector.ts +61 -4
- package/src/modes/components/notifications-settings-editor.ts +1 -1
- package/src/modes/components/oauth-selector.ts +42 -12
- package/src/modes/components/plan-preview-overlay.ts +1 -1
- package/src/modes/components/queue-pane.ts +55 -9
- package/src/modes/components/queued-message-selector.ts +53 -10
- package/src/modes/components/read-tool-group.ts +82 -14
- package/src/modes/components/runtime-mcp-add-wizard.ts +5 -0
- package/src/modes/components/sayknow-pet-widget.ts +27 -8
- package/src/modes/components/session-observer-overlay.ts +187 -32
- package/src/modes/components/settings-selector.ts +60 -18
- package/src/modes/components/tool-execution.ts +138 -27
- package/src/modes/components/tool-status-header.ts +26 -8
- package/src/modes/components/welcome.ts +50 -23
- package/src/modes/controllers/btw-controller.ts +119 -36
- package/src/modes/controllers/command-controller.ts +101 -54
- package/src/modes/controllers/event-controller.ts +119 -27
- package/src/modes/controllers/extension-ui-controller.ts +23 -12
- package/src/modes/controllers/input-controller.ts +100 -8
- package/src/modes/controllers/runtime-mcp-command-controller.ts +29 -6
- package/src/modes/controllers/selector-controller.ts +4 -1
- package/src/modes/interactive-mode.ts +201 -60
- package/src/modes/irc-observation-ledger.ts +71 -15
- package/src/modes/prompt-action-autocomplete.ts +32 -13
- package/src/modes/prompt-suggestion-controller.ts +96 -0
- package/src/modes/runtime-init.ts +20 -2
- package/src/modes/shared/agent-wire/command-dispatch.ts +3 -3
- package/src/modes/shared/agent-wire/workflow-gate-broker.ts +2 -2
- package/src/modes/types.ts +6 -0
- package/src/modes/utils/hotkeys-markdown.ts +64 -36
- package/src/modes/utils/ui-helpers.ts +99 -4
- package/src/prompts/agent-fragments/restricted-bash.md +1 -1
- package/src/prompts/agents/architect.md +17 -3
- package/src/prompts/agents/critic.md +17 -2
- package/src/prompts/agents/executor.md +1 -1
- package/src/prompts/agents/planner.md +8 -1
- package/src/prompts/system/btw-user.md +3 -8
- package/src/prompts/system/prompt-suggestion-system.md +32 -0
- package/src/prompts/system/system-prompt.md +6 -3
- package/src/prompts/tools/cron.md +3 -1
- package/src/prompts/tools/read.md +4 -2
- package/src/prompts/tools/skill-discovery.md +1 -0
- package/src/runtime/memory-domain.ts +66 -0
- package/src/runtime/memory-guard-contract.ts +73 -0
- package/src/runtime/memory-guard.ts +292 -0
- package/src/runtime/memory-limit.ts +50 -0
- package/src/runtime-mcp/client.ts +41 -55
- package/src/runtime-mcp/content-limits.ts +71 -0
- package/src/runtime-mcp/discoverable-tool-metadata.ts +1 -1
- package/src/runtime-mcp/json-rpc.ts +28 -11
- package/src/runtime-mcp/manager.ts +77 -59
- package/src/runtime-mcp/oauth-flow.ts +0 -72
- package/src/runtime-mcp/plugin-network-boundary.ts +101 -0
- package/src/runtime-mcp/redaction.ts +30 -0
- package/src/runtime-mcp/smithery-auth.ts +17 -2
- package/src/runtime-mcp/smithery-connect.ts +11 -1
- package/src/runtime-mcp/transports/http.ts +63 -22
- package/src/sdk/acp/adapter.ts +8 -1
- package/src/sdk/acp/final-text.ts +40 -0
- package/src/sdk/acp/mcp.ts +26 -0
- package/src/sdk/broker/broker.ts +34 -20
- package/src/sdk/broker/identity.ts +22 -12
- package/src/sdk/broker/lifecycle.ts +293 -43
- package/src/sdk/broker/session-index.ts +11 -1
- package/src/sdk/bus/chat-daemon-cli.ts +2 -2
- package/src/sdk/bus/chat-daemon-control.ts +22 -5
- package/src/sdk/bus/config-commands.ts +2 -2
- package/src/sdk/bus/config.ts +10 -2
- package/src/sdk/bus/control-drain-lease.ts +104 -0
- package/src/sdk/bus/conversation-store.ts +40 -6
- package/src/sdk/bus/daemon-paths.ts +2 -0
- package/src/sdk/bus/index.ts +793 -121
- package/src/sdk/bus/kind-aware-reconciliation.ts +242 -0
- package/src/sdk/bus/lifecycle-commands.ts +63 -10
- package/src/sdk/bus/lifecycle-control-runtime.ts +11 -2
- package/src/sdk/bus/lifecycle-orchestrator.ts +32 -1
- package/src/sdk/bus/notification-orchestration.ts +12 -0
- package/src/sdk/bus/notification-service.ts +87 -25
- package/src/sdk/bus/operator-runtime.ts +31 -5
- package/src/sdk/bus/prompt-reconciliation.ts +240 -0
- package/src/sdk/bus/rate-limit-pool.ts +8 -0
- package/src/sdk/bus/recent-activity.ts +90 -26
- package/src/sdk/bus/reconciliation-store.ts +224 -0
- package/src/sdk/bus/telegram-cli.ts +6 -13
- package/src/sdk/bus/telegram-daemon-cli.ts +8 -3
- package/src/sdk/bus/telegram-daemon-contract.ts +34 -9
- package/src/sdk/bus/telegram-daemon-control.ts +161 -40
- package/src/sdk/bus/telegram-daemon.ts +3649 -593
- package/src/sdk/bus/telegram-reference.ts +20 -2
- package/src/sdk/bus/topic-registry.ts +451 -12
- package/src/sdk/cli/session-cli.ts +15 -2
- package/src/sdk/client/discovery.ts +19 -3
- package/src/sdk/client/liveness.ts +49 -0
- package/src/sdk/host/control/dispatch.ts +8 -2
- package/src/sdk/host/control/operations.ts +3 -2
- package/src/sdk/host/host.ts +27 -9
- package/src/sdk/host/query/handlers.ts +125 -5
- package/src/sdk/index.ts +12 -0
- package/src/sdk/lifecycle-session.ts +19 -3
- package/src/sdk/mcp/server.ts +46 -18
- package/src/sdk/prompt-status.ts +97 -0
- package/src/sdk/protocol/operation-inventory.generated.json +145 -0
- package/src/sdk/protocol/operation-registry.ts +24 -4
- package/src/sdk/session-directory.ts +5 -1
- package/src/sdk/session.ts +69 -8
- package/src/sdk/startup-capability.ts +15 -1
- package/src/sdk/transport/auth-preface.ts +82 -0
- package/src/sdk/transport/index.ts +18 -0
- package/src/sdk/transport/relay.ts +252 -0
- package/src/sdk/transport/serve-cli.ts +105 -0
- package/src/sdk/transport/socket.ts +197 -0
- package/src/sdk/transport/stdio.ts +17 -0
- package/src/session/agent-session.ts +1112 -314
- package/src/session/blob-store.ts +25 -7
- package/src/session/btw-contract.ts +59 -0
- package/src/session/fallback-chain-controller.ts +47 -8
- package/src/session/internal/managed-session-scope.ts +1426 -259
- package/src/session/internal/managed-session-storage.ts +414 -238
- package/src/session/internal/native-publish-outcome.ts +271 -0
- package/src/session/memory-guard-checkpoint-participant.ts +131 -0
- package/src/session/session-manager.ts +2079 -469
- package/src/session/session-storage.ts +151 -11
- package/src/session/streaming-output.ts +262 -43
- package/src/setup/credential-import.ts +28 -3
- package/src/setup/provider-onboarding.ts +49 -5
- package/src/setup/provider-presets.json +2 -1
- package/src/skc-runtime/deep-interview-runtime.ts +303 -36
- package/src/skc-runtime/deep-interview-stage.ts +1016 -0
- package/src/skc-runtime/deep-interview-state.ts +8 -5
- package/src/skc-runtime/gc-render.ts +1 -0
- package/src/skc-runtime/gc-runtime.ts +11 -1
- package/src/skc-runtime/linux-proc.ts +70 -36
- package/src/skc-runtime/managed-owner-supervisor.ts +83 -4
- package/src/skc-runtime/memory-guard-owner-claims.ts +389 -0
- package/src/skc-runtime/ralplan-runtime.ts +1057 -75
- package/src/skc-runtime/repository-binding.ts +267 -0
- package/src/skc-runtime/session-state-sidecar.ts +25 -9
- package/src/skc-runtime/state-runtime.ts +50 -12
- package/src/skc-runtime/state-writer.ts +68 -56
- package/src/skc-runtime/team-launch.ts +34 -5
- package/src/skc-runtime/team-runtime.ts +41 -1
- package/src/skc-runtime/team-store.ts +32 -0
- package/src/skc-runtime/team-worker-memory-guard.ts +363 -0
- package/src/skc-runtime/team-workers.ts +1 -0
- package/src/skc-runtime/tmux-common.ts +13 -2
- package/src/skc-runtime/tmux-owner-isolation.ts +20 -1
- package/src/skc-runtime/tmux-sessions.ts +45 -6
- package/src/skc-runtime/ultragoal-guard.ts +93 -15
- package/src/skc-runtime/ultragoal-receipt-freshness.ts +123 -0
- package/src/skc-runtime/ultragoal-runtime.ts +469 -38
- package/src/skc-runtime/workflow-manifest.generated.json +195 -5
- package/src/skc-runtime/workflow-manifest.ts +67 -3
- package/src/skill-state/workflow-hud.ts +25 -2
- package/src/skill-state/workflow-mutation-guard.ts +104 -12
- package/src/slash-commands/builtin-registry.ts +1 -1
- package/src/ssh/utils.ts +14 -0
- package/src/task/discovery.ts +8 -2
- package/src/task/executor.ts +165 -47
- package/src/task/index.ts +123 -15
- package/src/task/provider-retry-status.ts +88 -0
- package/src/task/receipt.ts +3 -0
- package/src/task/render.ts +45 -26
- package/src/task/skc-command.ts +2 -2
- package/src/task/types.ts +55 -10
- package/src/task/ultragoal-redteam-activation.ts +75 -0
- package/src/tools/ask.ts +1 -1
- package/src/tools/ast-edit.ts +2 -2
- package/src/tools/bash-allowed-prefixes.ts +45 -1
- package/src/tools/bash-pty-selection.ts +2 -2
- package/src/tools/browser/launch.ts +41 -6
- package/src/tools/browser/screenshot-format.ts +6 -1
- package/src/tools/cron.ts +1 -1
- package/src/tools/fetch.ts +127 -154
- package/src/tools/image-gen.ts +476 -23
- package/src/tools/index.ts +7 -1
- package/src/tools/output-meta.ts +176 -9
- package/src/tools/path-utils.ts +5 -1
- package/src/tools/read-internals.ts +44 -0
- package/src/tools/read.ts +1544 -310
- package/src/tools/resource-gc.ts +665 -125
- package/src/tools/skill-discovery.ts +39 -3
- package/src/tools/sqlite-reader.ts +63 -5
- package/src/tools/subagent-render.ts +74 -16
- package/src/tools/subagent.ts +2 -0
- package/src/tools/tool-result.ts +14 -1
- package/src/utils/edit-mode.ts +2 -2
- package/src/utils/pasted-image-path.ts +15 -6
- package/src/utils/prompt-suggestion.ts +265 -0
- package/src/utils/shell-snapshot.ts +173 -63
- package/src/utils/sixel.ts +3 -3
- package/src/web/insane/bridge.ts +5 -1
- package/src/web/insane/url-guard.ts +140 -27
- package/src/web/scrapers/docs-rs.ts +30 -5
- package/src/web/scrapers/types.ts +19 -49
- package/src/web/scrapers/utils.ts +12 -26
- package/src/web/search/providers/codex.ts +1 -1
- package/src/workflow/workflow-intent-diff.ts +4 -1
|
@@ -935,6 +935,24 @@
|
|
|
935
935
|
"packages/coding-agent/test/sdk-operation-inventory.test.ts"
|
|
936
936
|
]
|
|
937
937
|
},
|
|
938
|
+
{
|
|
939
|
+
"sourceId": "registry:C53",
|
|
940
|
+
"sourceFile": "packages/coding-agent/src/sdk/protocol/operation-registry.ts",
|
|
941
|
+
"sourceKind": "registry",
|
|
942
|
+
"decision": "include",
|
|
943
|
+
"sdkId": "model.profile.set",
|
|
944
|
+
"adapterMappings": {
|
|
945
|
+
"telegram": "generic_safe",
|
|
946
|
+
"discord": "generic_safe",
|
|
947
|
+
"slack": "generic_safe",
|
|
948
|
+
"mcp": "generic_safe",
|
|
949
|
+
"acp": "generic_safe",
|
|
950
|
+
"daemonCli": "generic_safe"
|
|
951
|
+
},
|
|
952
|
+
"testIds": [
|
|
953
|
+
"packages/coding-agent/test/sdk-operation-inventory.test.ts"
|
|
954
|
+
]
|
|
955
|
+
},
|
|
938
956
|
{
|
|
939
957
|
"sourceId": "registry:G01",
|
|
940
958
|
"sourceFile": "packages/coding-agent/src/sdk/protocol/operation-registry.ts",
|
|
@@ -1511,6 +1529,60 @@
|
|
|
1511
1529
|
"packages/coding-agent/test/sdk-operation-inventory.test.ts"
|
|
1512
1530
|
]
|
|
1513
1531
|
},
|
|
1532
|
+
{
|
|
1533
|
+
"sourceId": "registry:Q26",
|
|
1534
|
+
"sourceFile": "packages/coding-agent/src/sdk/protocol/operation-registry.ts",
|
|
1535
|
+
"sourceKind": "registry",
|
|
1536
|
+
"decision": "include",
|
|
1537
|
+
"sdkId": "turn.prompt_status",
|
|
1538
|
+
"adapterMappings": {
|
|
1539
|
+
"telegram": "prohibited",
|
|
1540
|
+
"discord": "prohibited",
|
|
1541
|
+
"slack": "prohibited",
|
|
1542
|
+
"mcp": "generic_safe",
|
|
1543
|
+
"acp": "generic_safe",
|
|
1544
|
+
"daemonCli": "generic_safe"
|
|
1545
|
+
},
|
|
1546
|
+
"testIds": [
|
|
1547
|
+
"packages/coding-agent/test/sdk-operation-inventory.test.ts"
|
|
1548
|
+
]
|
|
1549
|
+
},
|
|
1550
|
+
{
|
|
1551
|
+
"sourceId": "registry:Q27",
|
|
1552
|
+
"sourceFile": "packages/coding-agent/src/sdk/protocol/operation-registry.ts",
|
|
1553
|
+
"sourceKind": "registry",
|
|
1554
|
+
"decision": "include",
|
|
1555
|
+
"sdkId": "models.profiles.list",
|
|
1556
|
+
"adapterMappings": {
|
|
1557
|
+
"telegram": "prohibited",
|
|
1558
|
+
"discord": "prohibited",
|
|
1559
|
+
"slack": "prohibited",
|
|
1560
|
+
"mcp": "generic_safe",
|
|
1561
|
+
"acp": "generic_safe",
|
|
1562
|
+
"daemonCli": "generic_safe"
|
|
1563
|
+
},
|
|
1564
|
+
"testIds": [
|
|
1565
|
+
"packages/coding-agent/test/sdk-operation-inventory.test.ts"
|
|
1566
|
+
]
|
|
1567
|
+
},
|
|
1568
|
+
{
|
|
1569
|
+
"sourceId": "registry:Q28",
|
|
1570
|
+
"sourceFile": "packages/coding-agent/src/sdk/protocol/operation-registry.ts",
|
|
1571
|
+
"sourceKind": "registry",
|
|
1572
|
+
"decision": "include",
|
|
1573
|
+
"sdkId": "skill.invoke_status",
|
|
1574
|
+
"adapterMappings": {
|
|
1575
|
+
"telegram": "prohibited",
|
|
1576
|
+
"discord": "prohibited",
|
|
1577
|
+
"slack": "prohibited",
|
|
1578
|
+
"mcp": "generic_safe",
|
|
1579
|
+
"acp": "generic_safe",
|
|
1580
|
+
"daemonCli": "generic_safe"
|
|
1581
|
+
},
|
|
1582
|
+
"testIds": [
|
|
1583
|
+
"packages/coding-agent/test/sdk-operation-inventory.test.ts"
|
|
1584
|
+
]
|
|
1585
|
+
},
|
|
1514
1586
|
{
|
|
1515
1587
|
"sourceId": "registry:R01",
|
|
1516
1588
|
"sourceFile": "packages/coding-agent/src/sdk/protocol/operation-registry.ts",
|
|
@@ -2294,6 +2366,17 @@
|
|
|
2294
2366
|
"testIds": "not_applicable"
|
|
2295
2367
|
}
|
|
2296
2368
|
},
|
|
2369
|
+
{
|
|
2370
|
+
"sourceId": "agent_session:getDeepInterviewAskStage",
|
|
2371
|
+
"sourceFile": "packages/coding-agent/src/session/agent-session.ts",
|
|
2372
|
+
"sourceKind": "agent_session",
|
|
2373
|
+
"decision": "exclude",
|
|
2374
|
+
"rationale": "internal AskTool schema-selection accessor, not a user-facing SDK control seam",
|
|
2375
|
+
"exclusionMetadata": {
|
|
2376
|
+
"adapterMappings": "not_applicable",
|
|
2377
|
+
"testIds": "not_applicable"
|
|
2378
|
+
}
|
|
2379
|
+
},
|
|
2297
2380
|
{
|
|
2298
2381
|
"sourceId": "agent_session:peekQueueInvoker",
|
|
2299
2382
|
"sourceFile": "packages/coding-agent/src/session/agent-session.ts",
|
|
@@ -2612,6 +2695,17 @@
|
|
|
2612
2695
|
"testIds": "not_applicable"
|
|
2613
2696
|
}
|
|
2614
2697
|
},
|
|
2698
|
+
{
|
|
2699
|
+
"sourceId": "agent_session:getToolForExecution",
|
|
2700
|
+
"sourceFile": "packages/coding-agent/src/session/agent-session.ts",
|
|
2701
|
+
"sourceKind": "agent_session",
|
|
2702
|
+
"decision": "exclude",
|
|
2703
|
+
"rationale": "internal accessor/plumbing, not a user-facing control seam",
|
|
2704
|
+
"exclusionMetadata": {
|
|
2705
|
+
"adapterMappings": "not_applicable",
|
|
2706
|
+
"testIds": "not_applicable"
|
|
2707
|
+
}
|
|
2708
|
+
},
|
|
2615
2709
|
{
|
|
2616
2710
|
"sourceId": "agent_session:registerForegroundBashBackgroundRequestHandler",
|
|
2617
2711
|
"sourceFile": "packages/coding-agent/src/session/agent-session.ts",
|
|
@@ -2827,6 +2921,17 @@
|
|
|
2827
2921
|
"testIds": "not_applicable"
|
|
2828
2922
|
}
|
|
2829
2923
|
},
|
|
2924
|
+
{
|
|
2925
|
+
"sourceId": "agent_session:restoreFromMemoryGuardCheckpoint",
|
|
2926
|
+
"sourceFile": "packages/coding-agent/src/session/agent-session.ts",
|
|
2927
|
+
"sourceKind": "agent_session",
|
|
2928
|
+
"decision": "exclude",
|
|
2929
|
+
"rationale": "internal owner-recovery staged restore builder after durable claims/fencing, never a user-facing SDK operation",
|
|
2930
|
+
"exclusionMetadata": {
|
|
2931
|
+
"adapterMappings": "not_applicable",
|
|
2932
|
+
"testIds": "not_applicable"
|
|
2933
|
+
}
|
|
2934
|
+
},
|
|
2830
2935
|
{
|
|
2831
2936
|
"sourceId": "agent_session:promoteRecoveryHydrationAfterOwnershipReadyFence",
|
|
2832
2937
|
"sourceFile": "packages/coding-agent/src/session/agent-session.ts",
|
|
@@ -2860,6 +2965,17 @@
|
|
|
2860
2965
|
"testIds": "not_applicable"
|
|
2861
2966
|
}
|
|
2862
2967
|
},
|
|
2968
|
+
{
|
|
2969
|
+
"sourceId": "agent_session:buildPreparedDisplaySessionContext",
|
|
2970
|
+
"sourceFile": "packages/coding-agent/src/session/agent-session.ts",
|
|
2971
|
+
"sourceKind": "agent_session",
|
|
2972
|
+
"decision": "exclude",
|
|
2973
|
+
"rationale": "internal accessor/plumbing, not a user-facing control seam",
|
|
2974
|
+
"exclusionMetadata": {
|
|
2975
|
+
"adapterMappings": "not_applicable",
|
|
2976
|
+
"testIds": "not_applicable"
|
|
2977
|
+
}
|
|
2978
|
+
},
|
|
2863
2979
|
{
|
|
2864
2980
|
"sourceId": "agent_session:convertMessagesToLlm",
|
|
2865
2981
|
"sourceFile": "packages/coding-agent/src/session/agent-session.ts",
|
|
@@ -3663,6 +3779,24 @@
|
|
|
3663
3779
|
"testIds": "not_applicable"
|
|
3664
3780
|
}
|
|
3665
3781
|
},
|
|
3782
|
+
{
|
|
3783
|
+
"sourceId": "agent_session:activateModelProfileForControl",
|
|
3784
|
+
"sourceFile": "packages/coding-agent/src/session/agent-session.ts",
|
|
3785
|
+
"sourceKind": "agent_session",
|
|
3786
|
+
"decision": "include",
|
|
3787
|
+
"sdkId": "model.profile.set",
|
|
3788
|
+
"adapterMappings": {
|
|
3789
|
+
"telegram": "generic_safe",
|
|
3790
|
+
"discord": "generic_safe",
|
|
3791
|
+
"slack": "generic_safe",
|
|
3792
|
+
"mcp": "generic_safe",
|
|
3793
|
+
"acp": "generic_safe",
|
|
3794
|
+
"daemonCli": "generic_safe"
|
|
3795
|
+
},
|
|
3796
|
+
"testIds": [
|
|
3797
|
+
"packages/coding-agent/test/sdk-operation-inventory.test.ts"
|
|
3798
|
+
]
|
|
3799
|
+
},
|
|
3666
3800
|
{
|
|
3667
3801
|
"sourceId": "agent_session:getConfiguredModelChain",
|
|
3668
3802
|
"sourceFile": "packages/coding-agent/src/session/agent-session.ts",
|
|
@@ -4430,6 +4564,17 @@
|
|
|
4430
4564
|
"testIds": "not_applicable"
|
|
4431
4565
|
}
|
|
4432
4566
|
},
|
|
4567
|
+
{
|
|
4568
|
+
"sourceId": "agent_session:createBtwConversationScope",
|
|
4569
|
+
"sourceFile": "packages/coding-agent/src/session/agent-session.ts",
|
|
4570
|
+
"sourceKind": "agent_session",
|
|
4571
|
+
"decision": "exclude",
|
|
4572
|
+
"rationale": "internal privacy-scoped side-chat snapshot factory, not a user-facing SDK control seam",
|
|
4573
|
+
"exclusionMetadata": {
|
|
4574
|
+
"adapterMappings": "not_applicable",
|
|
4575
|
+
"testIds": "not_applicable"
|
|
4576
|
+
}
|
|
4577
|
+
},
|
|
4433
4578
|
{
|
|
4434
4579
|
"sourceId": "agent_session:runEphemeralTurn",
|
|
4435
4580
|
"sourceFile": "packages/coding-agent/src/session/agent-session.ts",
|
|
@@ -116,6 +116,7 @@ const controls = [
|
|
|
116
116
|
["retry.last", "Retry the last interrupted or failed turn."],
|
|
117
117
|
["retry.now", "Immediately retry pending backoff."],
|
|
118
118
|
["bash.background", "Move active managed bash to the background."],
|
|
119
|
+
["model.profile.set", "Activate a model profile for the current session."],
|
|
119
120
|
] as const;
|
|
120
121
|
|
|
121
122
|
const globals = [
|
|
@@ -154,6 +155,15 @@ const queries = [
|
|
|
154
155
|
["resource.body", "Read a bounded resource continuation."],
|
|
155
156
|
["artifact.read", "Read a bounded artifact range."],
|
|
156
157
|
["runtime.jobs.list", "List managed jobs."],
|
|
158
|
+
[
|
|
159
|
+
"turn.prompt_status",
|
|
160
|
+
"Read the authoritative reconciliation status of a submitted prompt by command/turn IDs or clientRef.",
|
|
161
|
+
],
|
|
162
|
+
["models.profiles.list", "List the effective built-in and configured model profiles for this session."],
|
|
163
|
+
[
|
|
164
|
+
"skill.invoke_status",
|
|
165
|
+
"Read the authoritative reconciliation status of a skill.invoke by command/turn IDs or clientRef.",
|
|
166
|
+
],
|
|
157
167
|
] as const;
|
|
158
168
|
|
|
159
169
|
const reverse = [
|
|
@@ -191,6 +201,8 @@ function controlDisposition(id: string): Record<Adapter, AdapterDisposition> {
|
|
|
191
201
|
|
|
192
202
|
function controlErrors(id: string): string[] {
|
|
193
203
|
const errors: Record<string, string[]> = {
|
|
204
|
+
C01: ["client_ref_conflict", "reconciliation_capacity", "reconciliation_persist_failed"],
|
|
205
|
+
C09: ["client_ref_conflict", "reconciliation_capacity", "reconciliation_persist_failed"],
|
|
194
206
|
C06: ["action_claimed"],
|
|
195
207
|
C07: ["action_claimed", "terminal_uncertain"],
|
|
196
208
|
C08: ["action_claimed", "terminal_uncertain"],
|
|
@@ -224,14 +236,14 @@ function revision(id: string): string | undefined {
|
|
|
224
236
|
}
|
|
225
237
|
function queryContinuityClass(id: string): QueryContinuityClass {
|
|
226
238
|
if (["Q01", "Q02"].includes(id)) return "stable_prefix";
|
|
227
|
-
if (["Q04", "Q05", "Q06", "Q07", "Q08", "Q11", "Q12", "Q13", "Q20", "Q21", "Q22", "Q23"].includes(id))
|
|
239
|
+
if (["Q04", "Q05", "Q06", "Q07", "Q08", "Q11", "Q12", "Q13", "Q20", "Q21", "Q22", "Q23", "Q27"].includes(id))
|
|
228
240
|
return "retained_revision";
|
|
229
241
|
if (id === "Q24") return "content_addressed";
|
|
230
242
|
return "scalar_snapshot";
|
|
231
243
|
}
|
|
232
244
|
|
|
233
245
|
function queryDisposition(id: string): Record<Adapter, AdapterDisposition> {
|
|
234
|
-
if (["Q23", "Q24", "Q25"].includes(id))
|
|
246
|
+
if (["Q23", "Q24", "Q25", "Q26", "Q27", "Q28"].includes(id))
|
|
235
247
|
return dispositions({ telegram: "prohibited", discord: "prohibited", slack: "prohibited" });
|
|
236
248
|
return dispositions();
|
|
237
249
|
}
|
|
@@ -263,7 +275,12 @@ export const OPERATIONS: readonly Operation[] = [
|
|
|
263
275
|
kind: "global" as const,
|
|
264
276
|
description,
|
|
265
277
|
idempotency: "idempotent" as const,
|
|
266
|
-
errorCodes:
|
|
278
|
+
errorCodes:
|
|
279
|
+
id === "G02"
|
|
280
|
+
? ["endpoint_credential_forbidden"]
|
|
281
|
+
: ["G03", "G04", "G05"].includes(id)
|
|
282
|
+
? ["invalid_request", "unknown_model_profile", "model_profile_registry_error"]
|
|
283
|
+
: ["invalid_request"],
|
|
267
284
|
adapterDispositions:
|
|
268
285
|
id === "G02"
|
|
269
286
|
? dispositions({
|
|
@@ -286,7 +303,10 @@ export const OPERATIONS: readonly Operation[] = [
|
|
|
286
303
|
kind: "query" as const,
|
|
287
304
|
description,
|
|
288
305
|
idempotency: "idempotent" as const,
|
|
289
|
-
errorCodes:
|
|
306
|
+
errorCodes:
|
|
307
|
+
id === "Q27"
|
|
308
|
+
? ["invalid_request", "resource_gone", "model_profile_registry_error"]
|
|
309
|
+
: ["invalid_request", "resource_gone"],
|
|
290
310
|
continuityClass: queryContinuityClass(id),
|
|
291
311
|
adapterDispositions: queryDisposition(id),
|
|
292
312
|
testIds: ["packages/coding-agent/test/sdk-operation-inventory.test.ts"],
|
|
@@ -38,7 +38,11 @@ export type ResolveManagedSessionScopeResult =
|
|
|
38
38
|
| "network_unsupported"
|
|
39
39
|
| "sessions_root_unavailable"
|
|
40
40
|
| "binding_conflict"
|
|
41
|
-
| "binding_invalid"
|
|
41
|
+
| "binding_invalid"
|
|
42
|
+
| "atomic_unavailable"
|
|
43
|
+
| "durability_not_provable"
|
|
44
|
+
| "durability_failed"
|
|
45
|
+
| "invalid_request";
|
|
42
46
|
message: string;
|
|
43
47
|
};
|
|
44
48
|
|
package/src/sdk/session.ts
CHANGED
|
@@ -22,6 +22,7 @@ import {
|
|
|
22
22
|
type ToolResultMessage,
|
|
23
23
|
} from "@sayknow-cli/ai";
|
|
24
24
|
import {
|
|
25
|
+
codexToolWireName,
|
|
25
26
|
getOpenAICodexTransportDetails,
|
|
26
27
|
prewarmOpenAICodexResponses,
|
|
27
28
|
} from "@sayknow-cli/ai/providers/openai-codex-responses";
|
|
@@ -46,8 +47,8 @@ import { loadCapability } from "../capability";
|
|
|
46
47
|
import { type Rule, ruleCapability, setActiveRules } from "../capability/rule";
|
|
47
48
|
import { kNoAuth, ModelRegistry } from "../config/model-registry";
|
|
48
49
|
import {
|
|
49
|
-
formatModelString,
|
|
50
50
|
defaultModelPerProvider,
|
|
51
|
+
formatModelString,
|
|
51
52
|
parseModelPattern,
|
|
52
53
|
resolveAllowedModels,
|
|
53
54
|
resolveModelChainWithAuth,
|
|
@@ -94,6 +95,7 @@ import type { FileSlashCommand } from "../extensibility/slash-commands";
|
|
|
94
95
|
import type { HindsightSessionState } from "../hindsight/state";
|
|
95
96
|
import { initializeLocalRoot, LocalProtocolHandler, type LocalProtocolOptions } from "../internal-urls";
|
|
96
97
|
import { resolveMemoryBackend } from "../memory-backend";
|
|
98
|
+
import btwUserPrompt from "../prompts/system/btw-user.md" with { type: "text" };
|
|
97
99
|
import asyncResultTemplate from "../prompts/tools/async-result.md" with { type: "text" };
|
|
98
100
|
import { AgentRegistry, MAIN_AGENT_ID } from "../registry/agent-registry";
|
|
99
101
|
import { MCPManager } from "../runtime-mcp";
|
|
@@ -151,6 +153,7 @@ import {
|
|
|
151
153
|
ReadTool,
|
|
152
154
|
ResolveTool,
|
|
153
155
|
SearchTool,
|
|
156
|
+
setConfiguredImageModel,
|
|
154
157
|
setPreferredImageProvider,
|
|
155
158
|
setPreferredSearchProvider,
|
|
156
159
|
setSearchFallbackProviders,
|
|
@@ -168,6 +171,7 @@ import { buildNamedToolChoice, buildNamedToolChoiceResult } from "../utils/tool-
|
|
|
168
171
|
import { buildWorkspaceTree, type WorkspaceTree } from "../workspace-tree";
|
|
169
172
|
import {
|
|
170
173
|
attachLifecycleStartupCapability,
|
|
174
|
+
lifecycleMcpStartupTimeoutOption,
|
|
171
175
|
lifecycleStartupCapabilityOption,
|
|
172
176
|
type SdkStartupCapability,
|
|
173
177
|
} from "./startup-capability";
|
|
@@ -428,6 +432,13 @@ export interface CreateAgentSessionOptions {
|
|
|
428
432
|
goalToolAllowedOps?: readonly ("create" | "get" | "complete" | "resume" | "drop" | "pause")[];
|
|
429
433
|
/** Optional per-session allowlist for tools exposed through search_tool_bm25. */
|
|
430
434
|
discoverableToolAllowedNames?: readonly string[];
|
|
435
|
+
/**
|
|
436
|
+
* Discoverable built-in tools that must stay in the initial active set even when
|
|
437
|
+
* `tools.discoveryMode === "all"` would otherwise hide them behind `search_tool_bm25`.
|
|
438
|
+
* Used for coordination tools (e.g. `irc`) that a subagent must be able to use
|
|
439
|
+
* immediately without first spending a discovery round-trip to find them.
|
|
440
|
+
*/
|
|
441
|
+
alwaysActiveToolNames?: readonly string[];
|
|
431
442
|
/** Optional shared agent registry for IRC routing. Default: AgentRegistry.global(). */
|
|
432
443
|
agentRegistry?: AgentRegistry;
|
|
433
444
|
/** Parent task ID prefix for nested artifact naming (e.g., "6-Extensions") */
|
|
@@ -1021,6 +1032,11 @@ export async function createAgentSession(options: CreateAgentSessionOptions = {}
|
|
|
1021
1032
|
const lifecycleStartupCapability = (
|
|
1022
1033
|
options as CreateAgentSessionOptions & { [lifecycleStartupCapabilityOption]?: SdkStartupCapability }
|
|
1023
1034
|
)[lifecycleStartupCapabilityOption];
|
|
1035
|
+
// ACP lifecycle launches carry their own MCP startup budget; every other
|
|
1036
|
+
// consumer keeps the manager's short default ceiling.
|
|
1037
|
+
const lifecycleMcpStartupTimeoutMs = (
|
|
1038
|
+
options as CreateAgentSessionOptions & { [lifecycleMcpStartupTimeoutOption]?: number }
|
|
1039
|
+
)[lifecycleMcpStartupTimeoutOption];
|
|
1024
1040
|
const isCanonicalSubSession =
|
|
1025
1041
|
(options.taskDepth ?? 0) > 0 || Boolean(options.parentTaskPrefix) || Boolean(options.currentAgentType);
|
|
1026
1042
|
if (isCanonicalSubSession && options.mcpConfigPath !== undefined) {
|
|
@@ -1160,14 +1176,27 @@ export async function createAgentSession(options: CreateAgentSessionOptions = {}
|
|
|
1160
1176
|
applyConfiguredSearchTimeout(settings);
|
|
1161
1177
|
|
|
1162
1178
|
const imageProvider = settings.get("providers.image");
|
|
1179
|
+
const imageModel = settings.get("providers.imageModel");
|
|
1180
|
+
const imageCustomUrl = settings.get("providers.imageCustomUrl");
|
|
1181
|
+
const imageCustomKey = settings.get("providers.imageCustomKey");
|
|
1182
|
+
const imageCustomKeyEnv = settings.get("providers.imageCustomKeyEnv");
|
|
1163
1183
|
if (
|
|
1164
1184
|
imageProvider === "auto" ||
|
|
1165
1185
|
imageProvider === "openai" ||
|
|
1166
1186
|
imageProvider === "gemini" ||
|
|
1167
1187
|
imageProvider === "openrouter" ||
|
|
1168
|
-
imageProvider === "antigravity"
|
|
1188
|
+
imageProvider === "antigravity" ||
|
|
1189
|
+
imageProvider === "alibaba" ||
|
|
1190
|
+
imageProvider === "custom"
|
|
1169
1191
|
) {
|
|
1170
|
-
setPreferredImageProvider(imageProvider);
|
|
1192
|
+
setPreferredImageProvider(imageProvider === "custom" ? "auto" : imageProvider);
|
|
1193
|
+
setConfiguredImageModel({
|
|
1194
|
+
provider: imageProvider,
|
|
1195
|
+
model: imageModel ?? null,
|
|
1196
|
+
customUrl: imageCustomUrl,
|
|
1197
|
+
customKey: imageCustomKey,
|
|
1198
|
+
customKeyEnv: imageCustomKeyEnv,
|
|
1199
|
+
});
|
|
1171
1200
|
}
|
|
1172
1201
|
|
|
1173
1202
|
const sessionManager =
|
|
@@ -1511,6 +1540,7 @@ export async function createAgentSession(options: CreateAgentSessionOptions = {}
|
|
|
1511
1540
|
isManagedSessionDestination: () => sessionManager.isManagedDestination(),
|
|
1512
1541
|
getActiveSkillState: () => session?.getActiveSkillState(),
|
|
1513
1542
|
getActiveSkillPhase: () => session?.getActiveSkillPhase(),
|
|
1543
|
+
getDeepInterviewAskStage: () => session?.getDeepInterviewAskStage(),
|
|
1514
1544
|
getHindsightSessionState: () => session?.getHindsightSessionState(),
|
|
1515
1545
|
get model() {
|
|
1516
1546
|
return agent?.state.model ?? model;
|
|
@@ -1528,6 +1558,7 @@ export async function createAgentSession(options: CreateAgentSessionOptions = {}
|
|
|
1528
1558
|
goalToolAllowedOps: options.goalToolAllowedOps,
|
|
1529
1559
|
discoverableToolAllowedNames: options.discoverableToolAllowedNames,
|
|
1530
1560
|
getToolByName: name => session?.getToolByName(name),
|
|
1561
|
+
getToolForExecution: name => session?.getToolForExecution(name),
|
|
1531
1562
|
agentRegistry,
|
|
1532
1563
|
getSessionSpawns: () => options.spawns ?? "*",
|
|
1533
1564
|
getModelString: () => (hasExplicitModel && model ? formatModelString(model) : undefined),
|
|
@@ -1592,13 +1623,19 @@ export async function createAgentSession(options: CreateAgentSessionOptions = {}
|
|
|
1592
1623
|
// which collapses to the parent's dir for subagents (they adopt the
|
|
1593
1624
|
// parent's ArtifactManager) so one lookup hits everything.
|
|
1594
1625
|
const getArtifactsDir = () => sessionManager.getArtifactsDir();
|
|
1626
|
+
const localProtocolOptions = options.localProtocolOptions ?? {
|
|
1627
|
+
getArtifactsDir,
|
|
1628
|
+
isManagedDestination: () => sessionManager.isManagedDestination(),
|
|
1629
|
+
getManagedLegacyLocalMigrationSource: () => sessionManager.getManagedLegacyLocalMigrationSource(),
|
|
1630
|
+
getSessionId: () => sessionManager.getSessionId(),
|
|
1631
|
+
};
|
|
1595
1632
|
if (!options.parentTaskPrefix) {
|
|
1596
1633
|
setActiveSkills(skills);
|
|
1597
1634
|
setActiveRules([...rulebookRules, ...alwaysApplyRules]);
|
|
1598
1635
|
if (asyncJobManager) AsyncJobManager.setInstance(asyncJobManager);
|
|
1599
1636
|
}
|
|
1637
|
+
await initializeLocalRoot(localProtocolOptions);
|
|
1600
1638
|
if (options.localProtocolOptions) {
|
|
1601
|
-
await initializeLocalRoot(options.localProtocolOptions);
|
|
1602
1639
|
disposeLocalProtocolOverride = LocalProtocolHandler.installOverride(options.localProtocolOptions);
|
|
1603
1640
|
}
|
|
1604
1641
|
toolSession.getArtifactsDir = getArtifactsDir;
|
|
@@ -1692,7 +1729,12 @@ export async function createAgentSession(options: CreateAgentSessionOptions = {}
|
|
|
1692
1729
|
|
|
1693
1730
|
const preExactCustomToolNames = customTools.map(tool => tool.name);
|
|
1694
1731
|
if (explicitMcpConfigPath !== undefined) {
|
|
1695
|
-
const owned = new MCPManager(cwd, null, {
|
|
1732
|
+
const owned = new MCPManager(cwd, null, {
|
|
1733
|
+
toolsOnly: true,
|
|
1734
|
+
...(lifecycleMcpStartupTimeoutMs !== undefined
|
|
1735
|
+
? { maxStartupTimeoutMs: lifecycleMcpStartupTimeoutMs }
|
|
1736
|
+
: {}),
|
|
1737
|
+
});
|
|
1696
1738
|
owned.setAuthStorage(authStorage);
|
|
1697
1739
|
mcpManager = owned;
|
|
1698
1740
|
ownsMcpManager = true;
|
|
@@ -1851,9 +1893,13 @@ export async function createAgentSession(options: CreateAgentSessionOptions = {}
|
|
|
1851
1893
|
spawnedBySkc,
|
|
1852
1894
|
sdkHostModeSupported: options.sdkHostModeSupported,
|
|
1853
1895
|
ensureProviderDaemon: options.ensureNotificationProviderDaemon,
|
|
1854
|
-
|
|
1896
|
+
runBtwTurn: async (question, signal) => {
|
|
1855
1897
|
if (!session) throw new Error("Ephemeral turns are unavailable.");
|
|
1856
|
-
const { replyText } = await session.runEphemeralTurn({
|
|
1898
|
+
const { replyText } = await session.runEphemeralTurn({
|
|
1899
|
+
purpose: "btw",
|
|
1900
|
+
turn: { question, scope: session.createBtwConversationScope(btwUserPrompt) },
|
|
1901
|
+
signal,
|
|
1902
|
+
});
|
|
1857
1903
|
return { replyText };
|
|
1858
1904
|
},
|
|
1859
1905
|
});
|
|
@@ -2166,7 +2212,18 @@ export async function createAgentSession(options: CreateAgentSessionOptions = {}
|
|
|
2166
2212
|
const previousPromptMetadataModel = promptMetadataModel;
|
|
2167
2213
|
promptMetadataModel = candidateModel;
|
|
2168
2214
|
try {
|
|
2169
|
-
|
|
2215
|
+
const activeModel = candidateModel ?? agent?.state.model ?? model;
|
|
2216
|
+
// Codex renames reserved tool names on the wire; the prompt must
|
|
2217
|
+
// refer to the tools by the names the model actually receives.
|
|
2218
|
+
const overrides =
|
|
2219
|
+
activeModel?.api === "openai-codex-responses"
|
|
2220
|
+
? Object.fromEntries(
|
|
2221
|
+
Array.from(tools.keys())
|
|
2222
|
+
.filter(name => codexToolWireName(name) !== name)
|
|
2223
|
+
.map(name => [name, { wireName: codexToolWireName(name) }]),
|
|
2224
|
+
)
|
|
2225
|
+
: {};
|
|
2226
|
+
return buildSystemPromptToolMetadata(tools, overrides);
|
|
2170
2227
|
} finally {
|
|
2171
2228
|
promptMetadataModel = previousPromptMetadataModel;
|
|
2172
2229
|
}
|
|
@@ -2326,6 +2383,9 @@ export async function createAgentSession(options: CreateAgentSessionOptions = {}
|
|
|
2326
2383
|
// from the initial set unless they were explicitly requested or restored from persistence.
|
|
2327
2384
|
// The model finds them via search_tool_bm25 and activates them on demand.
|
|
2328
2385
|
if (effectiveDiscoveryMode === "all") {
|
|
2386
|
+
const alwaysActiveDiscoveredBuiltinNames = new Set(
|
|
2387
|
+
(options.alwaysActiveToolNames ?? []).map(name => name.toLowerCase()),
|
|
2388
|
+
);
|
|
2329
2389
|
const essentialBuiltinNames = new Set(computeEssentialBuiltinNames(settings));
|
|
2330
2390
|
const allowedDiscoveredBuiltinNames = options.discoverableToolAllowedNames
|
|
2331
2391
|
? new Set(options.discoverableToolAllowedNames.map(name => name.toLowerCase()))
|
|
@@ -2334,6 +2394,7 @@ export async function createAgentSession(options: CreateAgentSessionOptions = {}
|
|
|
2334
2394
|
const tool = toolRegistry.get(name);
|
|
2335
2395
|
if (!tool?.loadMode) return true; // not a built-in — leave MCP/custom/extension to existing logic
|
|
2336
2396
|
if (tool.loadMode === "essential") return true;
|
|
2397
|
+
if (alwaysActiveDiscoveredBuiltinNames.has(name)) return true;
|
|
2337
2398
|
return essentialBuiltinNames.has(name);
|
|
2338
2399
|
});
|
|
2339
2400
|
explicitlyRequestedDiscoveredBuiltinToolNames = selectRestorableDiscoveredBuiltinToolNames(
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
import {
|
|
2
|
+
isModelProfileError,
|
|
3
|
+
type ModelProfileErrorCode,
|
|
4
|
+
type ModelProfileErrorDetails,
|
|
5
|
+
} from "../config/model-profile-contract";
|
|
1
6
|
export type SdkStartupPhase = "registration" | "startup";
|
|
2
7
|
|
|
3
8
|
export type SdkStartupReason = "disabled" | "ineligible" | "factory_absent" | "runner_absent" | "pending" | "failed";
|
|
@@ -6,6 +11,8 @@ export interface SdkStartupFailure {
|
|
|
6
11
|
phase: SdkStartupPhase;
|
|
7
12
|
reason: SdkStartupReason;
|
|
8
13
|
message: string;
|
|
14
|
+
code?: ModelProfileErrorCode;
|
|
15
|
+
details?: ModelProfileErrorDetails;
|
|
9
16
|
}
|
|
10
17
|
|
|
11
18
|
export type SdkStartupResult = { status: "started" } | { status: "failed"; failure: SdkStartupFailure };
|
|
@@ -15,6 +22,12 @@ const MAX_MESSAGE_BYTES = 512;
|
|
|
15
22
|
|
|
16
23
|
/** Internal symbols for lifecycle-only SDK startup construction and bus wiring. */
|
|
17
24
|
export const lifecycleStartupCapabilityOption: unique symbol = Symbol("lifecycleStartupCapability");
|
|
25
|
+
/**
|
|
26
|
+
* Internal option carrying the startup budget for ACP lifecycle MCP launches.
|
|
27
|
+
* Only set when the lifecycle request actually supplies `mcpServers`, so the
|
|
28
|
+
* longer ceiling never leaks to ordinary CLI/SDK `mcpConfigPath` consumers.
|
|
29
|
+
*/
|
|
30
|
+
export const lifecycleMcpStartupTimeoutOption: unique symbol = Symbol("lifecycleMcpStartupTimeout");
|
|
18
31
|
const lifecycleStartupCapabilityOnApi: unique symbol = Symbol("lifecycleStartupCapabilityOnApi");
|
|
19
32
|
|
|
20
33
|
export function attachLifecycleStartupCapability(api: object, capability: SdkStartupCapability): void {
|
|
@@ -134,7 +147,8 @@ export function normalizeSdkStartupFailure(
|
|
|
134
147
|
? "SDK startup did not complete before readiness cutoff."
|
|
135
148
|
: FALLBACK_MESSAGE;
|
|
136
149
|
const message = sanitizeSdkStartupMessage(error, knownSecrets);
|
|
137
|
-
|
|
150
|
+
const profileError = isModelProfileError(error) ? { code: error.code, details: error.details } : {};
|
|
151
|
+
return { phase, reason, message: message === FALLBACK_MESSAGE ? fallback : message, ...profileError };
|
|
138
152
|
}
|
|
139
153
|
|
|
140
154
|
/** Collect process-scoped credentials without exposing a raw-secret API. */
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { createHash, timingSafeEqual } from "node:crypto";
|
|
2
|
+
import type * as net from "node:net";
|
|
3
|
+
|
|
4
|
+
const PREFACE_LIMIT_BYTES = 4 * 1024;
|
|
5
|
+
const PREFACE_TIMEOUT_MS = 1_000;
|
|
6
|
+
const VERSION = "skc-sdk-transport/1";
|
|
7
|
+
|
|
8
|
+
type AuthFailureCode =
|
|
9
|
+
| "auth_missing"
|
|
10
|
+
| "auth_malformed"
|
|
11
|
+
| "auth_invalid"
|
|
12
|
+
| "auth_oversize"
|
|
13
|
+
| "auth_timeout"
|
|
14
|
+
| "unsupported_version";
|
|
15
|
+
|
|
16
|
+
export class AuthPrefaceError extends Error {
|
|
17
|
+
constructor(readonly code: AuthFailureCode) {
|
|
18
|
+
super(code);
|
|
19
|
+
this.name = "AuthPrefaceError";
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function digest(token: string): Buffer {
|
|
24
|
+
return createHash("sha256").update(token).digest();
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function validToken(received: string, expected: string): boolean {
|
|
28
|
+
return timingSafeEqual(digest(received), digest(expected));
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function failureFrame(): string {
|
|
32
|
+
return `${JSON.stringify({ type: "transport_error", code: "auth_failed" })}\n`;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/** Consumes the one-shot socket authentication preface and leaves later bytes readable. */
|
|
36
|
+
export async function authenticatePreface(socket: net.Socket, token: string): Promise<Buffer> {
|
|
37
|
+
return await new Promise<Buffer>((resolve, reject) => {
|
|
38
|
+
let buffer = Buffer.alloc(0);
|
|
39
|
+
let settled = false;
|
|
40
|
+
const finish = (error?: AuthPrefaceError, remainder = Buffer.alloc(0)): void => {
|
|
41
|
+
if (settled) return;
|
|
42
|
+
settled = true;
|
|
43
|
+
clearTimeout(timeout);
|
|
44
|
+
socket.removeListener("data", onData);
|
|
45
|
+
socket.removeListener("end", onEnd);
|
|
46
|
+
socket.removeListener("error", onSocketError);
|
|
47
|
+
if (error) {
|
|
48
|
+
socket.end(failureFrame(), () => reject(error));
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
socket.pause();
|
|
52
|
+
resolve(remainder);
|
|
53
|
+
};
|
|
54
|
+
const fail = (code: AuthFailureCode): void => finish(new AuthPrefaceError(code));
|
|
55
|
+
const onSocketError = (): void => fail("auth_missing");
|
|
56
|
+
const onEnd = (): void => fail(buffer.length === 0 ? "auth_missing" : "auth_malformed");
|
|
57
|
+
const onData = (chunk: Buffer): void => {
|
|
58
|
+
buffer = Buffer.concat([buffer, chunk]);
|
|
59
|
+
const newline = buffer.indexOf(0x0a);
|
|
60
|
+
if (newline < 0) {
|
|
61
|
+
if (buffer.length > PREFACE_LIMIT_BYTES) fail("auth_oversize");
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
if (newline > PREFACE_LIMIT_BYTES) return fail("auth_oversize");
|
|
65
|
+
const line = buffer.subarray(0, newline).toString("utf8");
|
|
66
|
+
const remainder = buffer.subarray(newline + 1);
|
|
67
|
+
const prefix = `${VERSION} token=`;
|
|
68
|
+
if (!line.startsWith(prefix)) {
|
|
69
|
+
return fail(line.startsWith("skc-sdk-transport/") ? "unsupported_version" : "auth_malformed");
|
|
70
|
+
}
|
|
71
|
+
const received = line.slice(prefix.length);
|
|
72
|
+
if (received.length === 0 || /\s/.test(received)) return fail("auth_malformed");
|
|
73
|
+
if (!validToken(received, token)) return fail("auth_invalid");
|
|
74
|
+
finish(undefined, remainder);
|
|
75
|
+
};
|
|
76
|
+
const timeout = setTimeout(() => fail("auth_timeout"), PREFACE_TIMEOUT_MS);
|
|
77
|
+
socket.on("data", onData);
|
|
78
|
+
socket.once("end", onEnd);
|
|
79
|
+
socket.once("error", onSocketError);
|
|
80
|
+
socket.resume();
|
|
81
|
+
});
|
|
82
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export {
|
|
2
|
+
DEFAULT_PENDING_CEILING_BYTES,
|
|
3
|
+
MIN_PENDING_CEILING_BYTES,
|
|
4
|
+
REQUEST_FRAME_BYTES,
|
|
5
|
+
} from "./relay";
|
|
6
|
+
export { startSocketServe } from "./socket";
|
|
7
|
+
export { startStdioServe } from "./stdio";
|
|
8
|
+
|
|
9
|
+
export type ServeOptions = {
|
|
10
|
+
url: string;
|
|
11
|
+
token: string;
|
|
12
|
+
pendingCeilingBytes: number;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export type ServeHandle = {
|
|
16
|
+
close(): Promise<void>;
|
|
17
|
+
readonly done: Promise<void>;
|
|
18
|
+
};
|