@namzu/sdk 65.2.0 → 67.0.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 +161 -0
- package/dist/account/lock.d.ts +4 -12
- package/dist/account/lock.d.ts.map +1 -1
- package/dist/account/lock.js +5 -140
- package/dist/account/lock.js.map +1 -1
- package/dist/account/registry.d.ts.map +1 -1
- package/dist/account/registry.js +50 -6
- package/dist/account/registry.js.map +1 -1
- package/dist/account/types.d.ts +7 -5
- package/dist/account/types.d.ts.map +1 -1
- package/dist/account/types.js +6 -7
- package/dist/account/types.js.map +1 -1
- package/dist/authorization/dangerous-commands.d.ts +64 -0
- package/dist/authorization/dangerous-commands.d.ts.map +1 -0
- package/dist/authorization/dangerous-commands.js +479 -0
- package/dist/authorization/dangerous-commands.js.map +1 -0
- package/dist/authorization/gate.d.ts.map +1 -1
- package/dist/authorization/gate.js +19 -5
- package/dist/authorization/gate.js.map +1 -1
- package/dist/authorization/protected-paths.d.ts +11 -6
- package/dist/authorization/protected-paths.d.ts.map +1 -1
- package/dist/authorization/protected-paths.js +13 -8
- package/dist/authorization/protected-paths.js.map +1 -1
- package/dist/authorization/readonly-commands.d.ts +6 -1
- package/dist/authorization/readonly-commands.d.ts.map +1 -1
- package/dist/authorization/readonly-commands.js +35 -1
- package/dist/authorization/readonly-commands.js.map +1 -1
- package/dist/authorization/removal.d.ts +10 -0
- package/dist/authorization/removal.d.ts.map +1 -1
- package/dist/authorization/removal.js +7 -7
- package/dist/authorization/removal.js.map +1 -1
- package/dist/authorization/rules.d.ts +10 -0
- package/dist/authorization/rules.d.ts.map +1 -1
- package/dist/authorization/rules.js +60 -14
- package/dist/authorization/rules.js.map +1 -1
- package/dist/authorization/shell-lexer.d.ts +10 -0
- package/dist/authorization/shell-lexer.d.ts.map +1 -1
- package/dist/authorization/shell-lexer.js +15 -0
- package/dist/authorization/shell-lexer.js.map +1 -1
- package/dist/bridge/acp/permission.d.ts +5 -0
- package/dist/bridge/acp/permission.d.ts.map +1 -1
- package/dist/bridge/acp/permission.js.map +1 -1
- package/dist/bridge/acp/server.d.ts +8 -1
- package/dist/bridge/acp/server.d.ts.map +1 -1
- package/dist/bridge/acp/server.js +48 -6
- package/dist/bridge/acp/server.js.map +1 -1
- package/dist/compaction/context-breakdown.d.ts +25 -6
- package/dist/compaction/context-breakdown.d.ts.map +1 -1
- package/dist/compaction/context-breakdown.js +27 -7
- package/dist/compaction/context-breakdown.js.map +1 -1
- package/dist/compaction/dangling.d.ts.map +1 -1
- package/dist/compaction/dangling.js +2 -0
- package/dist/compaction/dangling.js.map +1 -1
- package/dist/compaction/extractor.d.ts +7 -1
- package/dist/compaction/extractor.d.ts.map +1 -1
- package/dist/compaction/extractor.js +8 -1
- package/dist/compaction/extractor.js.map +1 -1
- package/dist/compaction/index.d.ts +1 -1
- package/dist/compaction/index.d.ts.map +1 -1
- package/dist/compaction/index.js +1 -1
- package/dist/compaction/index.js.map +1 -1
- package/dist/compaction/managers/structured.js +2 -2
- package/dist/compaction/managers/structured.js.map +1 -1
- package/dist/compaction/manual.d.ts.map +1 -1
- package/dist/compaction/manual.js +11 -6
- package/dist/compaction/manual.js.map +1 -1
- package/dist/compaction/model-summary.d.ts.map +1 -1
- package/dist/compaction/model-summary.js +7 -1
- package/dist/compaction/model-summary.js.map +1 -1
- package/dist/compaction/summary.d.ts +13 -2
- package/dist/compaction/summary.d.ts.map +1 -1
- package/dist/compaction/summary.js +46 -3
- package/dist/compaction/summary.js.map +1 -1
- package/dist/constants/tools/index.d.ts +18 -1
- package/dist/constants/tools/index.d.ts.map +1 -1
- package/dist/constants/tools/index.js +28 -16
- package/dist/constants/tools/index.js.map +1 -1
- package/dist/manager/session/turn-recorder.d.ts +6 -0
- package/dist/manager/session/turn-recorder.d.ts.map +1 -1
- package/dist/manager/session/turn-recorder.js +29 -1
- package/dist/manager/session/turn-recorder.js.map +1 -1
- package/dist/network/audit.d.ts +49 -0
- package/dist/network/audit.d.ts.map +1 -0
- package/dist/network/audit.js +84 -0
- package/dist/network/audit.js.map +1 -0
- package/dist/network/clock.d.ts +21 -0
- package/dist/network/clock.d.ts.map +1 -0
- package/dist/network/clock.js +51 -0
- package/dist/network/clock.js.map +1 -0
- package/dist/network/discovery-mdns.d.ts +120 -0
- package/dist/network/discovery-mdns.d.ts.map +1 -0
- package/dist/network/discovery-mdns.js +442 -0
- package/dist/network/discovery-mdns.js.map +1 -0
- package/dist/network/discovery.d.ts +63 -0
- package/dist/network/discovery.d.ts.map +1 -0
- package/dist/network/discovery.js +163 -0
- package/dist/network/discovery.js.map +1 -0
- package/dist/network/fingerprint.d.ts +73 -0
- package/dist/network/fingerprint.d.ts.map +1 -0
- package/dist/network/fingerprint.js +208 -0
- package/dist/network/fingerprint.js.map +1 -0
- package/dist/network/identity.d.ts +38 -0
- package/dist/network/identity.d.ts.map +1 -0
- package/dist/network/identity.js +71 -0
- package/dist/network/identity.js.map +1 -0
- package/dist/network/index.d.ts +39 -0
- package/dist/network/index.d.ts.map +1 -0
- package/dist/network/index.js +25 -0
- package/dist/network/index.js.map +1 -0
- package/dist/network/join.d.ts +69 -0
- package/dist/network/join.d.ts.map +1 -0
- package/dist/network/join.js +136 -0
- package/dist/network/join.js.map +1 -0
- package/dist/network/mail-policy.d.ts +97 -0
- package/dist/network/mail-policy.d.ts.map +1 -0
- package/dist/network/mail-policy.js +147 -0
- package/dist/network/mail-policy.js.map +1 -0
- package/dist/network/membership.d.ts +76 -0
- package/dist/network/membership.d.ts.map +1 -0
- package/dist/network/membership.js +225 -0
- package/dist/network/membership.js.map +1 -0
- package/dist/network/roster.d.ts +59 -0
- package/dist/network/roster.d.ts.map +1 -0
- package/dist/network/roster.js +120 -0
- package/dist/network/roster.js.map +1 -0
- package/dist/network/service.d.ts +303 -0
- package/dist/network/service.d.ts.map +1 -0
- package/dist/network/service.js +1891 -0
- package/dist/network/service.js.map +1 -0
- package/dist/network/store.d.ts +141 -0
- package/dist/network/store.d.ts.map +1 -0
- package/dist/network/store.js +198 -0
- package/dist/network/store.js.map +1 -0
- package/dist/network/transport.d.ts +96 -0
- package/dist/network/transport.d.ts.map +1 -0
- package/dist/network/transport.js +342 -0
- package/dist/network/transport.js.map +1 -0
- package/dist/network/wire.d.ts +345 -0
- package/dist/network/wire.d.ts.map +1 -0
- package/dist/network/wire.js +212 -0
- package/dist/network/wire.js.map +1 -0
- package/dist/network/x509.d.ts +28 -0
- package/dist/network/x509.d.ts.map +1 -0
- package/dist/network/x509.js +84 -0
- package/dist/network/x509.js.map +1 -0
- package/dist/pals/activity/causality.d.ts.map +1 -1
- package/dist/pals/activity/causality.js +14 -2
- package/dist/pals/activity/causality.js.map +1 -1
- package/dist/peers/endpoint.d.ts.map +1 -1
- package/dist/peers/endpoint.js +6 -0
- package/dist/peers/endpoint.js.map +1 -1
- package/dist/peers/envelope.d.ts +18 -0
- package/dist/peers/envelope.d.ts.map +1 -1
- package/dist/peers/envelope.js +68 -5
- package/dist/peers/envelope.js.map +1 -1
- package/dist/peers/index.d.ts +5 -4
- package/dist/peers/index.d.ts.map +1 -1
- package/dist/peers/index.js +3 -2
- package/dist/peers/index.js.map +1 -1
- package/dist/peers/mode-word.d.ts +10 -0
- package/dist/peers/mode-word.d.ts.map +1 -0
- package/dist/peers/mode-word.js +19 -0
- package/dist/peers/mode-word.js.map +1 -0
- package/dist/peers/protocol.d.ts +42 -0
- package/dist/peers/protocol.d.ts.map +1 -1
- package/dist/peers/protocol.js +22 -1
- package/dist/peers/protocol.js.map +1 -1
- package/dist/peers/record.d.ts +8 -0
- package/dist/peers/record.d.ts.map +1 -1
- package/dist/peers/record.js +5 -0
- package/dist/peers/record.js.map +1 -1
- package/dist/plugin/session-hook-env.d.ts.map +1 -1
- package/dist/plugin/session-hook-env.js +22 -2
- package/dist/plugin/session-hook-env.js.map +1 -1
- package/dist/plugin/shell-hook.d.ts +16 -2
- package/dist/plugin/shell-hook.d.ts.map +1 -1
- package/dist/plugin/shell-hook.js +183 -14
- package/dist/plugin/shell-hook.js.map +1 -1
- package/dist/prompt/coding-agent-doctrine.d.ts +4 -2
- package/dist/prompt/coding-agent-doctrine.d.ts.map +1 -1
- package/dist/prompt/coding-agent-doctrine.js +33 -38
- package/dist/prompt/coding-agent-doctrine.js.map +1 -1
- package/dist/public-runtime.d.ts +14 -6
- package/dist/public-runtime.d.ts.map +1 -1
- package/dist/public-runtime.js +22 -5
- package/dist/public-runtime.js.map +1 -1
- package/dist/public-tools.d.ts +3 -2
- package/dist/public-tools.d.ts.map +1 -1
- package/dist/public-tools.js +2 -2
- package/dist/public-tools.js.map +1 -1
- package/dist/public-types.d.ts +7 -2
- package/dist/public-types.d.ts.map +1 -1
- package/dist/runtime/jobs/registry.d.ts +29 -1
- package/dist/runtime/jobs/registry.d.ts.map +1 -1
- package/dist/runtime/jobs/registry.js +64 -0
- package/dist/runtime/jobs/registry.js.map +1 -1
- package/dist/runtime/query/auto-review/classifier.d.ts +30 -6
- package/dist/runtime/query/auto-review/classifier.d.ts.map +1 -1
- package/dist/runtime/query/auto-review/classifier.js +40 -12
- package/dist/runtime/query/auto-review/classifier.js.map +1 -1
- package/dist/runtime/query/auto-review/feedback.d.ts +37 -0
- package/dist/runtime/query/auto-review/feedback.d.ts.map +1 -0
- package/dist/runtime/query/auto-review/feedback.js +45 -0
- package/dist/runtime/query/auto-review/feedback.js.map +1 -0
- package/dist/runtime/query/auto-review/git-status.d.ts +59 -0
- package/dist/runtime/query/auto-review/git-status.d.ts.map +1 -0
- package/dist/runtime/query/auto-review/git-status.js +379 -0
- package/dist/runtime/query/auto-review/git-status.js.map +1 -0
- package/dist/runtime/query/auto-review/index.d.ts +3 -3
- package/dist/runtime/query/auto-review/index.d.ts.map +1 -1
- package/dist/runtime/query/auto-review/index.js +2 -2
- package/dist/runtime/query/auto-review/index.js.map +1 -1
- package/dist/runtime/query/auto-review/prompt.d.ts.map +1 -1
- package/dist/runtime/query/auto-review/prompt.js +6 -1
- package/dist/runtime/query/auto-review/prompt.js.map +1 -1
- package/dist/runtime/query/auto-review/transcript.d.ts +14 -1
- package/dist/runtime/query/auto-review/transcript.d.ts.map +1 -1
- package/dist/runtime/query/auto-review/transcript.js +48 -2
- package/dist/runtime/query/auto-review/transcript.js.map +1 -1
- package/dist/runtime/query/executor/tool-call-admission.d.ts.map +1 -1
- package/dist/runtime/query/executor/tool-call-admission.js +40 -3
- package/dist/runtime/query/executor/tool-call-admission.js.map +1 -1
- package/dist/runtime/query/executor.d.ts +32 -10
- package/dist/runtime/query/executor.d.ts.map +1 -1
- package/dist/runtime/query/executor.js +78 -17
- package/dist/runtime/query/executor.js.map +1 -1
- package/dist/runtime/query/index.d.ts +9 -0
- package/dist/runtime/query/index.d.ts.map +1 -1
- package/dist/runtime/query/index.js +54 -17
- package/dist/runtime/query/index.js.map +1 -1
- package/dist/runtime/query/iteration/index.d.ts.map +1 -1
- package/dist/runtime/query/iteration/index.js +17 -3
- package/dist/runtime/query/iteration/index.js.map +1 -1
- package/dist/runtime/query/iteration/phases/compaction.d.ts.map +1 -1
- package/dist/runtime/query/iteration/phases/compaction.js +5 -2
- package/dist/runtime/query/iteration/phases/compaction.js.map +1 -1
- package/dist/runtime/query/iteration/phases/context.d.ts.map +1 -1
- package/dist/runtime/query/iteration/phases/context.js +5 -0
- package/dist/runtime/query/iteration/phases/context.js.map +1 -1
- package/dist/runtime/query/iteration/phases/per-call-review.d.ts +1 -2
- package/dist/runtime/query/iteration/phases/per-call-review.d.ts.map +1 -1
- package/dist/runtime/query/iteration/phases/per-call-review.js +2 -5
- package/dist/runtime/query/iteration/phases/per-call-review.js.map +1 -1
- package/dist/runtime/query/iteration/phases/tool-review.d.ts.map +1 -1
- package/dist/runtime/query/iteration/phases/tool-review.js +6 -1
- package/dist/runtime/query/iteration/phases/tool-review.js.map +1 -1
- package/dist/runtime/query/pasted-frames.d.ts +34 -0
- package/dist/runtime/query/pasted-frames.d.ts.map +1 -0
- package/dist/runtime/query/pasted-frames.js +108 -0
- package/dist/runtime/query/pasted-frames.js.map +1 -0
- package/dist/runtime/query/path-escalation.d.ts +6 -0
- package/dist/runtime/query/path-escalation.d.ts.map +1 -1
- package/dist/runtime/query/path-escalation.js +15 -3
- package/dist/runtime/query/path-escalation.js.map +1 -1
- package/dist/runtime/query/request-interrupted-turns.d.ts +20 -0
- package/dist/runtime/query/request-interrupted-turns.d.ts.map +1 -0
- package/dist/runtime/query/request-interrupted-turns.js +43 -0
- package/dist/runtime/query/request-interrupted-turns.js.map +1 -0
- package/dist/runtime/query/review-policy.d.ts +16 -6
- package/dist/runtime/query/review-policy.d.ts.map +1 -1
- package/dist/runtime/query/review-policy.js +111 -15
- package/dist/runtime/query/review-policy.js.map +1 -1
- package/dist/runtime/query/turn/outcome-ledger.d.ts +9 -0
- package/dist/runtime/query/turn/outcome-ledger.d.ts.map +1 -1
- package/dist/runtime/query/turn/outcome-ledger.js +94 -6
- package/dist/runtime/query/turn/outcome-ledger.js.map +1 -1
- package/dist/runtime/query/unanswered.d.ts +19 -0
- package/dist/runtime/query/unanswered.d.ts.map +1 -0
- package/dist/runtime/query/unanswered.js +25 -0
- package/dist/runtime/query/unanswered.js.map +1 -0
- package/dist/runtime/system-events.d.ts +4 -4
- package/dist/runtime/system-events.d.ts.map +1 -1
- package/dist/runtime/system-events.js +2 -0
- package/dist/runtime/system-events.js.map +1 -1
- package/dist/session/workspace/git-worktree.d.ts +8 -0
- package/dist/session/workspace/git-worktree.d.ts.map +1 -1
- package/dist/session/workspace/git-worktree.js +21 -3
- package/dist/session/workspace/git-worktree.js.map +1 -1
- package/dist/store/evidence/source-kind.d.ts +1 -1
- package/dist/store/evidence/source-kind.d.ts.map +1 -1
- package/dist/store/evidence/source-kind.js +1 -1
- package/dist/store/evidence/source-kind.js.map +1 -1
- package/dist/store/session-index/sqlite.d.ts.map +1 -1
- package/dist/store/session-index/sqlite.js +42 -3
- package/dist/store/session-index/sqlite.js.map +1 -1
- package/dist/store/session-log/disk.js +1 -1
- package/dist/store/session-log/disk.js.map +1 -1
- package/dist/store/session-log/lease.d.ts.map +1 -1
- package/dist/store/session-log/lease.js +3 -2
- package/dist/store/session-log/lease.js.map +1 -1
- package/dist/tools/admit-facts.d.ts.map +1 -1
- package/dist/tools/admit-facts.js +2 -0
- package/dist/tools/admit-facts.js.map +1 -1
- package/dist/tools/builtins/bash.d.ts +10 -2
- package/dist/tools/builtins/bash.d.ts.map +1 -1
- package/dist/tools/builtins/bash.js +56 -17
- package/dist/tools/builtins/bash.js.map +1 -1
- package/dist/tools/builtins/browser-local.d.ts +117 -0
- package/dist/tools/builtins/browser-local.d.ts.map +1 -0
- package/dist/tools/builtins/browser-local.js +437 -0
- package/dist/tools/builtins/browser-local.js.map +1 -0
- package/dist/tools/builtins/browser.d.ts +18 -1
- package/dist/tools/builtins/browser.d.ts.map +1 -1
- package/dist/tools/builtins/browser.js +98 -8
- package/dist/tools/builtins/browser.js.map +1 -1
- package/dist/tools/builtins/computer-use-window-id.d.ts +16 -0
- package/dist/tools/builtins/computer-use-window-id.d.ts.map +1 -0
- package/dist/tools/builtins/computer-use-window-id.js +52 -0
- package/dist/tools/builtins/computer-use-window-id.js.map +1 -0
- package/dist/tools/builtins/computer-use.d.ts +65 -7
- package/dist/tools/builtins/computer-use.d.ts.map +1 -1
- package/dist/tools/builtins/computer-use.js +384 -71
- package/dist/tools/builtins/computer-use.js.map +1 -1
- package/dist/tools/builtins/content-fingerprint.d.ts +6 -0
- package/dist/tools/builtins/content-fingerprint.d.ts.map +1 -1
- package/dist/tools/builtins/content-fingerprint.js +7 -1
- package/dist/tools/builtins/content-fingerprint.js.map +1 -1
- package/dist/tools/builtins/edit.d.ts.map +1 -1
- package/dist/tools/builtins/edit.js +89 -7
- package/dist/tools/builtins/edit.js.map +1 -1
- package/dist/tools/builtins/file-write-result.d.ts.map +1 -1
- package/dist/tools/builtins/file-write-result.js +2 -1
- package/dist/tools/builtins/file-write-result.js.map +1 -1
- package/dist/tools/builtins/grep.js +1 -1
- package/dist/tools/builtins/grep.js.map +1 -1
- package/dist/tools/builtins/job.d.ts.map +1 -1
- package/dist/tools/builtins/job.js +4 -2
- package/dist/tools/builtins/job.js.map +1 -1
- package/dist/tools/builtins/monitor.d.ts.map +1 -1
- package/dist/tools/builtins/monitor.js +6 -1
- package/dist/tools/builtins/monitor.js.map +1 -1
- package/dist/tools/builtins/search-tools.d.ts +12 -1
- package/dist/tools/builtins/search-tools.d.ts.map +1 -1
- package/dist/tools/builtins/search-tools.js +166 -20
- package/dist/tools/builtins/search-tools.js.map +1 -1
- package/dist/tools/builtins/shell-read-credit.d.ts +18 -6
- package/dist/tools/builtins/shell-read-credit.d.ts.map +1 -1
- package/dist/tools/builtins/shell-read-credit.js +95 -27
- package/dist/tools/builtins/shell-read-credit.js.map +1 -1
- package/dist/tools/builtins/wait-for-job.d.ts.map +1 -1
- package/dist/tools/builtins/wait-for-job.js +14 -3
- package/dist/tools/builtins/wait-for-job.js.map +1 -1
- package/dist/tools/builtins/web-guidance.d.ts +6 -0
- package/dist/tools/builtins/web-guidance.d.ts.map +1 -1
- package/dist/tools/builtins/web-guidance.js +6 -0
- package/dist/tools/builtins/web-guidance.js.map +1 -1
- package/dist/tools/builtins/web.d.ts.map +1 -1
- package/dist/tools/builtins/web.js +2 -1
- package/dist/tools/builtins/web.js.map +1 -1
- package/dist/tools/builtins/write-file.d.ts.map +1 -1
- package/dist/tools/builtins/write-file.js +32 -2
- package/dist/tools/builtins/write-file.js.map +1 -1
- package/dist/tools/command-shell.d.ts +1 -1
- package/dist/tools/command-shell.d.ts.map +1 -1
- package/dist/tools/command-shell.js +6 -8
- package/dist/tools/command-shell.js.map +1 -1
- package/dist/tools/defineTool.d.ts +2 -0
- package/dist/tools/defineTool.d.ts.map +1 -1
- package/dist/tools/defineTool.js +17 -1
- package/dist/tools/defineTool.js.map +1 -1
- package/dist/tools/schedules/index.d.ts +1 -0
- package/dist/tools/schedules/index.d.ts.map +1 -1
- package/dist/tools/schedules/index.js +1 -0
- package/dist/tools/schedules/index.js.map +1 -1
- package/dist/tools/schedules/loop-tool.d.ts.map +1 -1
- package/dist/tools/schedules/loop-tool.js +8 -6
- package/dist/tools/schedules/loop-tool.js.map +1 -1
- package/dist/tools/schedules/present.js +1 -1
- package/dist/tools/schedules/present.js.map +1 -1
- package/dist/tools/schedules/timer-tools.d.ts +36 -0
- package/dist/tools/schedules/timer-tools.d.ts.map +1 -0
- package/dist/tools/schedules/timer-tools.js +234 -0
- package/dist/tools/schedules/timer-tools.js.map +1 -0
- package/dist/tools/schedules/types.d.ts +68 -3
- package/dist/tools/schedules/types.d.ts.map +1 -1
- package/dist/tools/task/create.d.ts.map +1 -1
- package/dist/tools/task/create.js +2 -0
- package/dist/tools/task/create.js.map +1 -1
- package/dist/toolsets/manager.d.ts +49 -7
- package/dist/toolsets/manager.d.ts.map +1 -1
- package/dist/toolsets/manager.js +239 -40
- package/dist/toolsets/manager.js.map +1 -1
- package/dist/turn/evidence-query.d.ts +18 -1
- package/dist/turn/evidence-query.d.ts.map +1 -1
- package/dist/turn/evidence-query.js +177 -35
- package/dist/turn/evidence-query.js.map +1 -1
- package/dist/turn/evidence-recall.d.ts +8 -1
- package/dist/turn/evidence-recall.d.ts.map +1 -1
- package/dist/turn/evidence-recall.js +82 -22
- package/dist/turn/evidence-recall.js.map +1 -1
- package/dist/turn/history-shed.d.ts +15 -0
- package/dist/turn/history-shed.d.ts.map +1 -0
- package/dist/turn/history-shed.js +23 -0
- package/dist/turn/history-shed.js.map +1 -0
- package/dist/types/acp/index.d.ts +26 -0
- package/dist/types/acp/index.d.ts.map +1 -1
- package/dist/types/authorization/index.d.ts +9 -1
- package/dist/types/authorization/index.d.ts.map +1 -1
- package/dist/types/authorization/index.js +11 -2
- package/dist/types/authorization/index.js.map +1 -1
- package/dist/types/browser/index.d.ts +12 -0
- package/dist/types/browser/index.d.ts.map +1 -1
- package/dist/types/hitl/index.d.ts +10 -0
- package/dist/types/hitl/index.d.ts.map +1 -1
- package/dist/types/hitl/index.js.map +1 -1
- package/dist/types/message/index.d.ts +56 -1
- package/dist/types/message/index.d.ts.map +1 -1
- package/dist/types/message/index.js +2 -1
- package/dist/types/message/index.js.map +1 -1
- package/dist/types/permission/index.d.ts +14 -0
- package/dist/types/permission/index.d.ts.map +1 -1
- package/dist/types/permission/index.js +14 -0
- package/dist/types/permission/index.js.map +1 -1
- package/dist/types/plugin/index.d.ts +148 -1
- package/dist/types/plugin/index.d.ts.map +1 -1
- package/dist/types/plugin/index.js +9 -0
- package/dist/types/plugin/index.js.map +1 -1
- package/dist/types/provider/index.d.ts +1 -0
- package/dist/types/provider/index.d.ts.map +1 -1
- package/dist/types/provider/interface.d.ts +12 -0
- package/dist/types/provider/interface.d.ts.map +1 -1
- package/dist/types/provider/limits.d.ts +33 -0
- package/dist/types/provider/limits.d.ts.map +1 -0
- package/dist/types/provider/limits.js +7 -0
- package/dist/types/provider/limits.js.map +1 -0
- package/dist/types/tool/index.d.ts +30 -0
- package/dist/types/tool/index.d.ts.map +1 -1
- package/dist/types/tool/index.js.map +1 -1
- package/dist/types/tool/presentation.d.ts +4 -0
- package/dist/types/tool/presentation.d.ts.map +1 -1
- package/dist/utils/file-lock.d.ts +88 -0
- package/dist/utils/file-lock.d.ts.map +1 -0
- package/dist/utils/file-lock.js +281 -0
- package/dist/utils/file-lock.js.map +1 -0
- package/dist/utils/state-backup.d.ts +87 -0
- package/dist/utils/state-backup.d.ts.map +1 -0
- package/dist/utils/state-backup.js +272 -0
- package/dist/utils/state-backup.js.map +1 -0
- package/dist/utils/temp-sweep.d.ts +66 -0
- package/dist/utils/temp-sweep.d.ts.map +1 -0
- package/dist/utils/temp-sweep.js +311 -0
- package/dist/utils/temp-sweep.js.map +1 -0
- package/dist/utils/temp.d.ts +14 -0
- package/dist/utils/temp.d.ts.map +1 -1
- package/dist/utils/temp.js +70 -2
- package/dist/utils/temp.js.map +1 -1
- package/package.json +1 -1
- package/src/account/lock.ts +13 -133
- package/src/account/registry.ts +75 -21
- package/src/account/types.ts +8 -9
- package/src/authorization/dangerous-commands.ts +542 -0
- package/src/authorization/gate.ts +19 -5
- package/src/authorization/protected-paths.ts +13 -8
- package/src/authorization/readonly-commands.ts +35 -1
- package/src/authorization/removal.ts +7 -7
- package/src/authorization/rules.ts +75 -15
- package/src/authorization/shell-lexer.ts +19 -0
- package/src/bridge/acp/permission.ts +2 -0
- package/src/bridge/acp/server.ts +66 -6
- package/src/compaction/context-breakdown.ts +53 -11
- package/src/compaction/dangling.ts +2 -0
- package/src/compaction/extractor.ts +9 -1
- package/src/compaction/index.ts +1 -0
- package/src/compaction/managers/structured.ts +2 -2
- package/src/compaction/manual.ts +11 -3
- package/src/compaction/model-summary.ts +8 -1
- package/src/compaction/summary.ts +54 -7
- package/src/constants/tools/index.ts +30 -16
- package/src/manager/session/turn-recorder.ts +37 -1
- package/src/network/audit.ts +113 -0
- package/src/network/clock.ts +62 -0
- package/src/network/discovery-mdns.ts +485 -0
- package/src/network/discovery.ts +210 -0
- package/src/network/fingerprint.ts +241 -0
- package/src/network/identity.ts +98 -0
- package/src/network/index.ts +134 -0
- package/src/network/join.ts +177 -0
- package/src/network/mail-policy.ts +199 -0
- package/src/network/membership.ts +290 -0
- package/src/network/roster.ts +165 -0
- package/src/network/service.ts +2304 -0
- package/src/network/store.ts +261 -0
- package/src/network/transport.ts +445 -0
- package/src/network/wire.ts +250 -0
- package/src/network/x509.ts +114 -0
- package/src/pals/activity/causality.ts +16 -2
- package/src/peers/endpoint.ts +6 -0
- package/src/peers/envelope.ts +82 -5
- package/src/peers/index.ts +10 -2
- package/src/peers/mode-word.ts +18 -0
- package/src/peers/protocol.ts +24 -1
- package/src/peers/record.ts +5 -0
- package/src/plugin/session-hook-env.ts +25 -2
- package/src/plugin/shell-hook.ts +208 -14
- package/src/prompt/coding-agent-doctrine.ts +33 -38
- package/src/public-runtime.ts +107 -1
- package/src/public-tools.ts +11 -0
- package/src/public-types.ts +67 -1
- package/src/runtime/jobs/registry.ts +93 -3
- package/src/runtime/query/auto-review/classifier.ts +76 -14
- package/src/runtime/query/auto-review/feedback.ts +50 -0
- package/src/runtime/query/auto-review/git-status.ts +437 -0
- package/src/runtime/query/auto-review/index.ts +7 -2
- package/src/runtime/query/auto-review/prompt.ts +6 -1
- package/src/runtime/query/auto-review/transcript.ts +67 -4
- package/src/runtime/query/executor/tool-call-admission.ts +49 -3
- package/src/runtime/query/executor.ts +104 -21
- package/src/runtime/query/index.ts +66 -17
- package/src/runtime/query/iteration/index.ts +24 -3
- package/src/runtime/query/iteration/phases/compaction.ts +4 -0
- package/src/runtime/query/iteration/phases/context.ts +5 -0
- package/src/runtime/query/iteration/phases/per-call-review.ts +8 -13
- package/src/runtime/query/iteration/phases/tool-review.ts +7 -1
- package/src/runtime/query/pasted-frames.ts +119 -0
- package/src/runtime/query/path-escalation.ts +27 -3
- package/src/runtime/query/request-interrupted-turns.ts +47 -0
- package/src/runtime/query/review-policy.ts +125 -22
- package/src/runtime/query/turn/outcome-ledger.ts +99 -6
- package/src/runtime/query/unanswered.ts +35 -0
- package/src/runtime/system-events.ts +2 -0
- package/src/session/workspace/git-worktree.ts +34 -3
- package/src/store/evidence/source-kind.ts +1 -1
- package/src/store/session-index/sqlite.ts +40 -3
- package/src/store/session-log/disk.ts +1 -1
- package/src/store/session-log/lease.ts +3 -2
- package/src/tools/admit-facts.ts +2 -0
- package/src/tools/builtins/bash.ts +62 -19
- package/src/tools/builtins/browser-local.ts +504 -0
- package/src/tools/builtins/browser.ts +121 -8
- package/src/tools/builtins/computer-use-window-id.ts +50 -0
- package/src/tools/builtins/computer-use.ts +460 -68
- package/src/tools/builtins/content-fingerprint.ts +8 -1
- package/src/tools/builtins/edit.ts +93 -7
- package/src/tools/builtins/file-write-result.ts +2 -1
- package/src/tools/builtins/grep.ts +1 -1
- package/src/tools/builtins/job.ts +4 -2
- package/src/tools/builtins/monitor.ts +6 -1
- package/src/tools/builtins/search-tools.ts +196 -21
- package/src/tools/builtins/shell-read-credit.ts +97 -33
- package/src/tools/builtins/wait-for-job.ts +13 -3
- package/src/tools/builtins/web-guidance.ts +6 -0
- package/src/tools/builtins/web.ts +2 -1
- package/src/tools/builtins/write-file.ts +31 -3
- package/src/tools/command-shell.ts +6 -8
- package/src/tools/defineTool.ts +20 -1
- package/src/tools/schedules/index.ts +11 -0
- package/src/tools/schedules/loop-tool.ts +10 -6
- package/src/tools/schedules/present.ts +1 -1
- package/src/tools/schedules/timer-tools.ts +258 -0
- package/src/tools/schedules/types.ts +72 -3
- package/src/tools/task/create.ts +2 -0
- package/src/toolsets/manager.ts +262 -46
- package/src/turn/evidence-query.ts +183 -42
- package/src/turn/evidence-recall.ts +96 -19
- package/src/turn/history-shed.ts +30 -0
- package/src/types/acp/index.ts +24 -0
- package/src/types/authorization/index.ts +20 -3
- package/src/types/browser/index.ts +9 -0
- package/src/types/hitl/index.ts +10 -0
- package/src/types/message/index.ts +65 -0
- package/src/types/permission/index.ts +18 -0
- package/src/types/plugin/index.ts +205 -26
- package/src/types/provider/index.ts +1 -0
- package/src/types/provider/interface.ts +13 -0
- package/src/types/provider/limits.ts +35 -0
- package/src/types/tool/index.ts +30 -2
- package/src/types/tool/presentation.ts +4 -0
- package/src/utils/file-lock.ts +328 -0
- package/src/utils/state-backup.ts +318 -0
- package/src/utils/temp-sweep.ts +327 -0
- package/src/utils/temp.ts +73 -2
|
@@ -41,10 +41,16 @@ import {
|
|
|
41
41
|
type ToolCall,
|
|
42
42
|
type ToolMessage,
|
|
43
43
|
type ToolResultContent,
|
|
44
|
+
type ToolResultOutcome,
|
|
44
45
|
type ToolRevealReceipt,
|
|
45
46
|
createToolMessage,
|
|
46
47
|
} from '../../types/message/index.js'
|
|
47
|
-
import
|
|
48
|
+
import {
|
|
49
|
+
PLAN_MODE_REFUSAL,
|
|
50
|
+
PLAN_MODE_REFUSAL_WITH_PLAN_FILE,
|
|
51
|
+
type PermissionMode,
|
|
52
|
+
STRICT_MODE_REFUSAL,
|
|
53
|
+
} from '../../types/permission/index.js'
|
|
48
54
|
import type { PluginHookPermission, PluginHookResult } from '../../types/plugin/index.js'
|
|
49
55
|
import type { ChatCompletionResponse } from '../../types/provider/index.js'
|
|
50
56
|
import type { Sandbox } from '../../types/sandbox/index.js'
|
|
@@ -78,12 +84,18 @@ import { compressShellOutput } from '../../utils/shell-compress.js'
|
|
|
78
84
|
import { parseStructuredResultJson } from '../../utils/structured-result-json.js'
|
|
79
85
|
import { ensureScratchpadDirectory } from '../../utils/temp.js'
|
|
80
86
|
import { type BackgroundJobRegistry, type JobProcess, bindOwner } from '../jobs/registry.js'
|
|
87
|
+
import {
|
|
88
|
+
AUTO_REVIEW_BLOCKED_PREFIX,
|
|
89
|
+
AUTO_REVIEW_UNAVAILABLE_PREFIX,
|
|
90
|
+
} from './auto-review/feedback.js'
|
|
91
|
+
import { gitStatusForLine } from './auto-review/git-status.js'
|
|
81
92
|
import {
|
|
82
93
|
type ScriptEvidence,
|
|
83
94
|
analyzeLaunches,
|
|
84
95
|
changedSinceRead,
|
|
85
96
|
readLaunchedScripts,
|
|
86
97
|
} from './auto-review/script-evidence.js'
|
|
98
|
+
import { DECLINED_TOOL_CALL_FEEDBACK } from './declined.js'
|
|
87
99
|
import { type BatchDetach, stillRunningResult } from './detached-calls.js'
|
|
88
100
|
import {
|
|
89
101
|
type ToolAdmissionHost,
|
|
@@ -115,6 +127,7 @@ import {
|
|
|
115
127
|
fitResultsToMessageBudget,
|
|
116
128
|
measureContentBytes,
|
|
117
129
|
} from './tool-output-budget.js'
|
|
130
|
+
import { APPROVAL_NOT_COMPLETED, UNANSWERED_REFUSALS } from './unanswered.js'
|
|
118
131
|
|
|
119
132
|
export type { EmitEvent } from './events.js'
|
|
120
133
|
import type { EmitEvent, SessionEventDraft } from './events.js'
|
|
@@ -386,10 +399,10 @@ export interface ToolExecutorConfig {
|
|
|
386
399
|
/** See `ToolContext.additionalDirectories`. */
|
|
387
400
|
additionalDirectories?: readonly string[]
|
|
388
401
|
/**
|
|
389
|
-
* Where this session's own scratch folder is
|
|
390
|
-
*
|
|
391
|
-
*
|
|
392
|
-
* turn and
|
|
402
|
+
* Where this session's own scratch folder is. It becomes a root of the file
|
|
403
|
+
* tools once it has been made and checked, a write inside it needs no review,
|
|
404
|
+
* and background jobs keep their output files in its `jobs` folder. Unset on a
|
|
405
|
+
* sandboxed turn and when the folder could not be made.
|
|
393
406
|
*/
|
|
394
407
|
scratchpadDirectory?: string
|
|
395
408
|
/** See `QueryParams.outsideRootAccess`. Default `'refuse'`. */
|
|
@@ -641,6 +654,11 @@ export interface ToolCallOutcome {
|
|
|
641
654
|
* a mutable map.
|
|
642
655
|
*/
|
|
643
656
|
revealedTools?: readonly ToolRevealReceipt[]
|
|
657
|
+
/**
|
|
658
|
+
* Why the call did not simply run, as the executor knows it where it made
|
|
659
|
+
* this result; carried onto `ToolMessage.outcome`. Absent: it ran.
|
|
660
|
+
*/
|
|
661
|
+
outcome?: ToolResultOutcome
|
|
644
662
|
}
|
|
645
663
|
|
|
646
664
|
/** What the per-call review decided about one call that reached the front of the walk. */
|
|
@@ -767,6 +785,38 @@ function refusalNote(reason: string | undefined): string | undefined {
|
|
|
767
785
|
: sentence
|
|
768
786
|
}
|
|
769
787
|
|
|
788
|
+
/** How every refusal of a call that a refusal elsewhere in its batch stopped begins. */
|
|
789
|
+
const TURN_STOPPED_REFUSAL = 'An earlier call in this batch was refused and the turn was stopped'
|
|
790
|
+
|
|
791
|
+
/** The refusals a session's mode writes for a call it does not run (plan mode, `strict`). */
|
|
792
|
+
const MODE_REFUSALS: readonly string[] = [
|
|
793
|
+
PLAN_MODE_REFUSAL,
|
|
794
|
+
PLAN_MODE_REFUSAL_WITH_PLAN_FILE,
|
|
795
|
+
STRICT_MODE_REFUSAL,
|
|
796
|
+
]
|
|
797
|
+
|
|
798
|
+
/**
|
|
799
|
+
* How a refused call ended, from who refused it. `reason` is the review's or
|
|
800
|
+
* the gate's own text, never a tool's: a person's no is told by `declined`
|
|
801
|
+
* (or by the words a person's no carries when the host gave none of its
|
|
802
|
+
* own), the auto mode's two kinds by the prefixes its policy writes, a
|
|
803
|
+
* refusal that only followed a stopped turn or a question nobody answered by
|
|
804
|
+
* its own words, a refusal by plan mode or `strict` by theirs, and everything
|
|
805
|
+
* else is a rule, a hook or another guard.
|
|
806
|
+
*/
|
|
807
|
+
export function denialOutcome(
|
|
808
|
+
reason: string,
|
|
809
|
+
declined: ToolCallDeclined | undefined,
|
|
810
|
+
): ToolResultOutcome {
|
|
811
|
+
if (declined !== undefined || reason === DECLINED_TOOL_CALL_FEEDBACK) return 'rejected'
|
|
812
|
+
if (reason.startsWith(AUTO_REVIEW_BLOCKED_PREFIX)) return 'blocked_by_auto_mode'
|
|
813
|
+
if (reason.startsWith(AUTO_REVIEW_UNAVAILABLE_PREFIX)) return 'auto_mode_unavailable'
|
|
814
|
+
if (reason.startsWith(TURN_STOPPED_REFUSAL) || UNANSWERED_REFUSALS.includes(reason))
|
|
815
|
+
return 'interrupted'
|
|
816
|
+
if (MODE_REFUSALS.includes(reason)) return 'refused_by_mode'
|
|
817
|
+
return 'blocked_by_permissions'
|
|
818
|
+
}
|
|
819
|
+
|
|
770
820
|
export function deniedToolOutput(toolName: string, reason: string): string {
|
|
771
821
|
return `Error: Tool "${toolName}" was not executed. ${reason}`
|
|
772
822
|
}
|
|
@@ -914,22 +964,15 @@ export class ToolExecutor {
|
|
|
914
964
|
}
|
|
915
965
|
|
|
916
966
|
/**
|
|
917
|
-
* Make the session's scratch folder a root
|
|
918
|
-
*
|
|
919
|
-
*
|
|
920
|
-
*
|
|
967
|
+
* Make the session's scratch folder a root of the file tools. The turn made
|
|
968
|
+
* it when it started; this checks it again (no link on the way, ours) before
|
|
969
|
+
* the first call trusts it, and leaves it outside the roots when it fails,
|
|
970
|
+
* so a path in it is asked about like any other.
|
|
921
971
|
*/
|
|
922
972
|
private admitScratchpad(call: PreparedSafetyCall): void {
|
|
923
973
|
const directory = this.config.scratchpadDirectory
|
|
924
974
|
if (directory === undefined || this.scratchpadReady !== undefined || this.sandboxed) return
|
|
925
975
|
if (call.kind === 'synthetic') return
|
|
926
|
-
let named = false
|
|
927
|
-
try {
|
|
928
|
-
named = JSON.stringify(call.input)?.includes(JSON.stringify(directory).slice(1, -1)) === true
|
|
929
|
-
} catch {
|
|
930
|
-
// An input that cannot be serialised names nothing.
|
|
931
|
-
}
|
|
932
|
-
if (!named) return
|
|
933
976
|
try {
|
|
934
977
|
this.scratchpadReady = ensureScratchpadDirectory(directory)
|
|
935
978
|
} catch (error) {
|
|
@@ -1095,6 +1138,24 @@ export class ToolExecutor {
|
|
|
1095
1138
|
return evidence.scripts
|
|
1096
1139
|
}
|
|
1097
1140
|
|
|
1141
|
+
/**
|
|
1142
|
+
* The working tree's short status where a shell line runs a destructive git
|
|
1143
|
+
* command, read now for the auto-mode classifier; undefined for any other
|
|
1144
|
+
* line, inside a sandbox (its files are not this host's), or when git does
|
|
1145
|
+
* not answer. See `auto-review/git-status.ts`.
|
|
1146
|
+
*/
|
|
1147
|
+
async gitStatusForReview(line: string, dialect: ShellDialect): Promise<string | undefined> {
|
|
1148
|
+
if (this.sandboxed) return undefined
|
|
1149
|
+
return gitStatusForLine(
|
|
1150
|
+
line,
|
|
1151
|
+
dialect,
|
|
1152
|
+
effectiveBashWorkingDirectory(this.config.sessionId, this.config.workingDirectory, {
|
|
1153
|
+
sandboxed: false,
|
|
1154
|
+
}),
|
|
1155
|
+
{ signal: this.config.abortSignal },
|
|
1156
|
+
)
|
|
1157
|
+
}
|
|
1158
|
+
|
|
1098
1159
|
/** The whole of the evidence as one text, from the same ledger. No filesystem I/O. */
|
|
1099
1160
|
describeFileEvidence(messages: readonly Message[]): string | undefined {
|
|
1100
1161
|
return describeVisibleFileEvidence(
|
|
@@ -1563,6 +1624,9 @@ export class ToolExecutor {
|
|
|
1563
1624
|
roots,
|
|
1564
1625
|
...(shellCwd !== undefined ? { cwd: shellCwd } : {}),
|
|
1565
1626
|
reviewOutside: this.config.outsideRootAccess === 'review' && !sandboxed,
|
|
1627
|
+
...(this.scratchpadReady !== undefined && !sandboxed
|
|
1628
|
+
? { scratchpadDirectory: this.scratchpadReady }
|
|
1629
|
+
: {}),
|
|
1566
1630
|
topLevel: this.config.outsideRootAccess === 'review' && !sandboxed,
|
|
1567
1631
|
})
|
|
1568
1632
|
protectedPaths.push(...found.protectedPaths)
|
|
@@ -2030,7 +2094,7 @@ export class ToolExecutor {
|
|
|
2030
2094
|
// so the failure signal and any image block were structurally lost at
|
|
2031
2095
|
// the last possible moment.
|
|
2032
2096
|
const messages: Message[] = results.map((r) =>
|
|
2033
|
-
createToolMessage(r.content ?? r.output, r.toolCallId, r.isError, r.revealedTools),
|
|
2097
|
+
createToolMessage(r.content ?? r.output, r.toolCallId, r.isError, r.revealedTools, r.outcome),
|
|
2034
2098
|
)
|
|
2035
2099
|
|
|
2036
2100
|
return { messages, results, observations }
|
|
@@ -2058,8 +2122,7 @@ export class ToolExecutor {
|
|
|
2058
2122
|
// before it has settled, so the transcript lists the calls in the order the
|
|
2059
2123
|
// model wrote them: the declined call before the ones refused unasked.
|
|
2060
2124
|
const settledUnits = new Map<number, Promise<void>>()
|
|
2061
|
-
const refusedAfterEnd =
|
|
2062
|
-
'An earlier call in this batch was refused and the turn was stopped, so this call was not run.'
|
|
2125
|
+
const refusedAfterEnd = `${TURN_STOPPED_REFUSAL}, so this call was not run.`
|
|
2063
2126
|
await new Promise<void>((resolve) => {
|
|
2064
2127
|
const start = (unit: ReviewUnit): void => {
|
|
2065
2128
|
inFlight.add(unit)
|
|
@@ -2079,7 +2142,7 @@ export class ToolExecutor {
|
|
|
2079
2142
|
// An answer that could not be obtained is not a yes.
|
|
2080
2143
|
admission = {
|
|
2081
2144
|
run: false,
|
|
2082
|
-
reason:
|
|
2145
|
+
reason: APPROVAL_NOT_COMPLETED,
|
|
2083
2146
|
}
|
|
2084
2147
|
}
|
|
2085
2148
|
if (admission.run && !review.ended.aborted) {
|
|
@@ -2627,6 +2690,11 @@ export class ToolExecutor {
|
|
|
2627
2690
|
this.config.backgroundJobs,
|
|
2628
2691
|
this.config.backgroundJobOwner ?? this.config.turnId,
|
|
2629
2692
|
{
|
|
2693
|
+
// Every job's output is also saved to a file the model is told
|
|
2694
|
+
// about, so it has no reason to redirect it into the project.
|
|
2695
|
+
...(this.config.scratchpadDirectory !== undefined && !this.sandboxed
|
|
2696
|
+
? { outputDirectory: join(this.config.scratchpadDirectory, 'jobs') }
|
|
2697
|
+
: {}),
|
|
2630
2698
|
workingDirectory: this.config.workingDirectory,
|
|
2631
2699
|
env: this.config.env,
|
|
2632
2700
|
...(this.config.sandbox?.spawnDetached
|
|
@@ -3145,6 +3213,11 @@ export class ToolExecutor {
|
|
|
3145
3213
|
...(result.launched === true && !effectiveIsError ? { launched: true as const } : {}),
|
|
3146
3214
|
...(revealedTools !== undefined ? { revealedTools } : {}),
|
|
3147
3215
|
...(result.facts !== undefined && !postOverride ? { facts: result.facts } : {}),
|
|
3216
|
+
// A call that failed while the turn was being stopped was cut short, not
|
|
3217
|
+
// a tool that failed on its own.
|
|
3218
|
+
...(effectiveIsError && this.config.abortSignal.aborted
|
|
3219
|
+
? { outcome: 'interrupted' as const }
|
|
3220
|
+
: {}),
|
|
3148
3221
|
}
|
|
3149
3222
|
}
|
|
3150
3223
|
|
|
@@ -3704,7 +3777,14 @@ export class ToolExecutor {
|
|
|
3704
3777
|
isError: true,
|
|
3705
3778
|
})
|
|
3706
3779
|
|
|
3707
|
-
return {
|
|
3780
|
+
return {
|
|
3781
|
+
toolCallId: toolCall.id,
|
|
3782
|
+
toolName,
|
|
3783
|
+
output,
|
|
3784
|
+
isError: true,
|
|
3785
|
+
notRun: true,
|
|
3786
|
+
outcome: denialOutcome(reason, declined),
|
|
3787
|
+
}
|
|
3708
3788
|
}
|
|
3709
3789
|
|
|
3710
3790
|
/**
|
|
@@ -3757,6 +3837,7 @@ export class ToolExecutor {
|
|
|
3757
3837
|
kind: 'error',
|
|
3758
3838
|
notRun: true,
|
|
3759
3839
|
output: `Tool "${toolName}" was not started because the turn was cancelled${reason ? `: ${reason}` : '.'}`,
|
|
3840
|
+
outcome: 'interrupted',
|
|
3760
3841
|
})
|
|
3761
3842
|
}
|
|
3762
3843
|
|
|
@@ -3771,6 +3852,7 @@ export class ToolExecutor {
|
|
|
3771
3852
|
skipped?: true
|
|
3772
3853
|
notRun?: true
|
|
3773
3854
|
facts?: ToolFacts
|
|
3855
|
+
outcome?: ToolResultOutcome
|
|
3774
3856
|
},
|
|
3775
3857
|
): Promise<ToolCallOutcome> {
|
|
3776
3858
|
const activity = this.activityStore.create({
|
|
@@ -3815,6 +3897,7 @@ export class ToolExecutor {
|
|
|
3815
3897
|
...(outcome.inputFailure ? { inputFailure: outcome.inputFailure } : {}),
|
|
3816
3898
|
...(outcome.skipped ? { skipped: true as const } : {}),
|
|
3817
3899
|
...(outcome.notRun ? { notRun: true as const } : {}),
|
|
3900
|
+
...(outcome.outcome ? { outcome: outcome.outcome } : {}),
|
|
3818
3901
|
}
|
|
3819
3902
|
}
|
|
3820
3903
|
|
|
@@ -20,7 +20,7 @@ import { childSessionLog } from '../../manager/agent/child-session.js'
|
|
|
20
20
|
import { type TurnRecorder, recordedTurnStart } from '../../manager/session/turn-recorder.js'
|
|
21
21
|
import { frameOperatorHookContext } from '../../plugin/hook-context.js'
|
|
22
22
|
import { PromptContributionRegistry } from '../../prompt/contributions.js'
|
|
23
|
-
import { resolveProviderCapabilities } from '../../provider/capabilities.js'
|
|
23
|
+
import { modelReadsImages, resolveProviderCapabilities } from '../../provider/capabilities.js'
|
|
24
24
|
import type { ProviderChainMember } from '../../provider/fallback.js'
|
|
25
25
|
import { withStreamIdleTimeout } from '../../provider/idle-timeout.js'
|
|
26
26
|
import type { ProviderRetryConfig } from '../../provider/retry.js'
|
|
@@ -110,6 +110,7 @@ import type { ModelPricing } from '../../utils/cost.js'
|
|
|
110
110
|
import { toErrorMessage } from '../../utils/error.js'
|
|
111
111
|
import { errorAttributes } from '../../utils/log/exception.js'
|
|
112
112
|
import type { Logger } from '../../utils/logger.js'
|
|
113
|
+
import { NAMZU_SCRATCH_ENV, ensureScratchpadDirectory, scratchpadAlias } from '../../utils/temp.js'
|
|
113
114
|
import { AwaitedJobs } from '../jobs/awaited-jobs.js'
|
|
114
115
|
import type { BackgroundJobRegistry } from '../jobs/registry.js'
|
|
115
116
|
import { catchUpFromCursor, settlePreStartCancellation } from './cancelled-before-start.js'
|
|
@@ -1045,6 +1046,16 @@ export interface QueryParams {
|
|
|
1045
1046
|
|
|
1046
1047
|
sandboxProvider?: SandboxProvider
|
|
1047
1048
|
|
|
1049
|
+
/**
|
|
1050
|
+
* The session's scratch folder, for a host whose session state is not on
|
|
1051
|
+
* disk (an ephemeral run), where {@link paths} cannot name one. It must lie
|
|
1052
|
+
* inside the per-user private temporary folder (`privateTempRootPath()`);
|
|
1053
|
+
* anything else is refused and the turn runs without a scratch folder. With
|
|
1054
|
+
* `paths` and no value here, the folder is `paths.scratchpadPath(sessionId)`
|
|
1055
|
+
* (the parent's, for a delegated turn).
|
|
1056
|
+
*/
|
|
1057
|
+
scratchpadDirectory?: string
|
|
1058
|
+
|
|
1048
1059
|
/**
|
|
1049
1060
|
* Maximum time the turn waits for sandbox teardown, in milliseconds.
|
|
1050
1061
|
*
|
|
@@ -1313,7 +1324,11 @@ export async function* query(params: QueryParams): AsyncGenerator<SessionEvent,
|
|
|
1313
1324
|
// would be a `ToolsetConflictError` naming both sources for a name
|
|
1314
1325
|
// query() itself introduced, not the caller's honest collision.
|
|
1315
1326
|
const callerHasDeferredToolset = params.toolsets.some(
|
|
1316
|
-
|
|
1327
|
+
// A live toolset that has no tools yet still counts: the ones it gains
|
|
1328
|
+
// later (a server that connects after the turn began) arrive deferred.
|
|
1329
|
+
(ts) =>
|
|
1330
|
+
(ts.availability ?? 'active') === 'deferred' &&
|
|
1331
|
+
(ts.tools().length > 0 || ts.onChange !== undefined),
|
|
1317
1332
|
)
|
|
1318
1333
|
const callerSearchToolset = params.toolsets.find((ts) =>
|
|
1319
1334
|
ts.tools().some((tool) => tool.name === SearchToolsTool.name),
|
|
@@ -1391,12 +1406,26 @@ export async function* query(params: QueryParams): AsyncGenerator<SessionEvent,
|
|
|
1391
1406
|
const carries = (m: (typeof params.messages)[number], kind: 'image' | 'document') =>
|
|
1392
1407
|
m.role === 'user' && (m.attachments ?? []).some((a) => (a.type ?? 'image') === kind)
|
|
1393
1408
|
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1409
|
+
// The warning is for the message this run answers: a picture sent three
|
|
1410
|
+
// replies ago was warned about then, and repeating it before every later
|
|
1411
|
+
// reply would say the same thing again about something the person did once.
|
|
1412
|
+
// Strict mode is a refusal, not a warning, so it keeps looking at the whole
|
|
1413
|
+
// history: a picture the driver would drop anywhere in it still throws.
|
|
1414
|
+
const latestUser = [...params.messages].reverse().find((m) => m.role === 'user')
|
|
1415
|
+
const countCarrying = (kind: 'image' | 'document'): number =>
|
|
1416
|
+
params.strictCapabilities
|
|
1417
|
+
? params.messages.filter((m) => carries(m, kind)).length
|
|
1418
|
+
: latestUser !== undefined && carries(latestUser, kind)
|
|
1419
|
+
? 1
|
|
1420
|
+
: 0
|
|
1421
|
+
// A driver that maps images can still serve a model its own catalogue lists
|
|
1422
|
+
// as text-only; that model's requests leave the picture out just the same,
|
|
1423
|
+
// so the person is told about it the same way, naming the model.
|
|
1424
|
+
const textOnlyModel =
|
|
1425
|
+
capabilities.supportsVision && !modelReadsImages(params.provider, turnConfig.model)
|
|
1426
|
+
const attachmentMessageCount =
|
|
1427
|
+
capabilities.supportsVision && !textOnlyModel ? 0 : countCarrying('image')
|
|
1428
|
+
const documentMessageCount = capabilities.supportsDocuments ? 0 : countCarrying('document')
|
|
1400
1429
|
|
|
1401
1430
|
if (stripToolSurfaces) {
|
|
1402
1431
|
const message = `Provider '${params.provider.id}' declares supportsTools: false but ${registeredToolCount} tool(s) are registered — stripping all tool surfaces from the prompt and request so the model is never told about tools it cannot call. Pass strictCapabilities: true to fail instead, or use a tools-capable provider.`
|
|
@@ -1419,7 +1448,9 @@ export async function* query(params: QueryParams): AsyncGenerator<SessionEvent,
|
|
|
1419
1448
|
}
|
|
1420
1449
|
|
|
1421
1450
|
if (attachmentMessageCount > 0) {
|
|
1422
|
-
const message =
|
|
1451
|
+
const message = textOnlyModel
|
|
1452
|
+
? `Model '${turnConfig.model}' on provider '${params.provider.id}' reads text only but ${attachmentMessageCount} user message(s) carry image attachments — they are left out of its requests, so the model never sees the images. Pass strictCapabilities: true to fail instead, or use a model that reads images.`
|
|
1453
|
+
: `Provider '${params.provider.id}' declares supportsVision: false but ${attachmentMessageCount} user message(s) carry image attachments — the driver will not map them, so the model never sees the images. Pass strictCapabilities: true to fail instead, or use a vision-capable provider.`
|
|
1423
1454
|
if (params.strictCapabilities) {
|
|
1424
1455
|
throw new NamzuError({
|
|
1425
1456
|
code: 'capability_unavailable',
|
|
@@ -1601,15 +1632,24 @@ export async function* query(params: QueryParams): AsyncGenerator<SessionEvent,
|
|
|
1601
1632
|
// pre-approves ends with the turn. Shared by the executor, where the
|
|
1602
1633
|
// `skill` tool records a grant, and the review phase, which reads it.
|
|
1603
1634
|
const skillGrants = new SkillGrantSet()
|
|
1604
|
-
// The session's own scratch folder, a root of the
|
|
1605
|
-
//
|
|
1606
|
-
//
|
|
1635
|
+
// The session's own scratch folder: made now, owner-only, and a root of the
|
|
1636
|
+
// file tools from the first call. A host that keeps no session state on
|
|
1637
|
+
// disk names one itself (`scratchpadDirectory`). A delegated turn uses its
|
|
1638
|
+
// parent's, so the files a team of agents leaves are in one place. Not for
|
|
1639
|
+
// a sandboxed turn (it is not mounted there). A folder that cannot be made
|
|
1640
|
+
// or is not safe stays unused, and the turn goes on without it.
|
|
1607
1641
|
let scratchpadDirectory: string | undefined
|
|
1608
1642
|
if (!params.sandboxProvider) {
|
|
1609
1643
|
try {
|
|
1610
|
-
scratchpadDirectory =
|
|
1611
|
-
|
|
1644
|
+
scratchpadDirectory =
|
|
1645
|
+
params.scratchpadDirectory ??
|
|
1646
|
+
ctx.storage.paths?.scratchpadPath(params.parentSessionId ?? ctx.sessionId)
|
|
1647
|
+
if (scratchpadDirectory !== undefined) ensureScratchpadDirectory(scratchpadDirectory)
|
|
1648
|
+
} catch (error) {
|
|
1612
1649
|
scratchpadDirectory = undefined
|
|
1650
|
+
ctx.log.warn('The session scratch folder could not be made, so the turn runs without it', {
|
|
1651
|
+
'exception.message': error instanceof Error ? error.message : String(error),
|
|
1652
|
+
})
|
|
1613
1653
|
}
|
|
1614
1654
|
}
|
|
1615
1655
|
const toolExecutor = ToolingBootstrap.init(
|
|
@@ -1630,7 +1670,13 @@ export async function* query(params: QueryParams): AsyncGenerator<SessionEvent,
|
|
|
1630
1670
|
...(params.outsideRootRefusal ? { outsideRootRefusal: params.outsideRootRefusal } : {}),
|
|
1631
1671
|
...(params.sandboxEscape ? { sandboxEscape: params.sandboxEscape } : {}),
|
|
1632
1672
|
permissionMode: () => ctx.permissionMode.current,
|
|
1633
|
-
env:
|
|
1673
|
+
env: {
|
|
1674
|
+
// A short path for the scratch folder, so a command need not type the long one.
|
|
1675
|
+
...(scratchpadDirectory
|
|
1676
|
+
? { [NAMZU_SCRATCH_ENV]: scratchpadAlias(scratchpadDirectory) }
|
|
1677
|
+
: {}),
|
|
1678
|
+
...(turnConfig.env ?? {}),
|
|
1679
|
+
},
|
|
1634
1680
|
abortSignal: ctx.abortController.signal,
|
|
1635
1681
|
allowedTools: effectiveAllowedTools,
|
|
1636
1682
|
invocationState: params.invocationState,
|
|
@@ -2547,7 +2593,7 @@ export async function* query(params: QueryParams): AsyncGenerator<SessionEvent,
|
|
|
2547
2593
|
let isFirstUserMessage = true
|
|
2548
2594
|
for (const message of initialMessages) {
|
|
2549
2595
|
if (!isOperatorUserMessage(message) || !message.content.trim()) continue
|
|
2550
|
-
extractFromUserMessage(workingStateManager, message
|
|
2596
|
+
extractFromUserMessage(workingStateManager, message, isFirstUserMessage)
|
|
2551
2597
|
isFirstUserMessage = false
|
|
2552
2598
|
}
|
|
2553
2599
|
}
|
|
@@ -2642,7 +2688,10 @@ export async function* query(params: QueryParams): AsyncGenerator<SessionEvent,
|
|
|
2642
2688
|
turnId: ctx.recorder.turnId,
|
|
2643
2689
|
capability: 'vision',
|
|
2644
2690
|
providerId: params.provider.id,
|
|
2645
|
-
|
|
2691
|
+
...(textOnlyModel ? { model: turnConfig.model } : {}),
|
|
2692
|
+
message: textOnlyModel
|
|
2693
|
+
? `Model '${turnConfig.model}' on provider '${params.provider.id}' reads text only — image attachments on ${attachmentMessageCount} user message(s) will not reach the model.`
|
|
2694
|
+
: `Provider '${params.provider.id}' does not support vision — image attachments on ${attachmentMessageCount} user message(s) will not reach the model.`,
|
|
2646
2695
|
})
|
|
2647
2696
|
yield* eventTranslator.drainPending()
|
|
2648
2697
|
}
|
|
@@ -72,12 +72,14 @@ import { SandboxAcquisitionStopped } from '../deferred-sandbox.js'
|
|
|
72
72
|
import { deliverDurableInbound } from '../durable-inbound.js'
|
|
73
73
|
import type { ToolCallOutcome } from '../executor.js'
|
|
74
74
|
import { projectObservationContext } from '../observation-context.js'
|
|
75
|
+
import { framePastedMessages } from '../pasted-frames.js'
|
|
75
76
|
import { applyLifecycleHookResults, lastAssistantMessageField } from '../plugin-hooks.js'
|
|
76
77
|
import {
|
|
77
78
|
type RequestContextSnapshot,
|
|
78
79
|
diffRequestContext,
|
|
79
80
|
snapshotRequestContext,
|
|
80
81
|
} from '../request-context.js'
|
|
82
|
+
import { withInterruptedRequestsMarked } from '../request-interrupted-turns.js'
|
|
81
83
|
import {
|
|
82
84
|
type RequestImageIdentity,
|
|
83
85
|
markProviderRejectedImage,
|
|
@@ -907,6 +909,19 @@ export class IterationOrchestrator {
|
|
|
907
909
|
// Render request-only contributions once before preparation. Their
|
|
908
910
|
// estimated cost reduces every stage's headroom, and the same text
|
|
909
911
|
// reaches the provider even if a stage changes external state.
|
|
912
|
+
// A live toolset may have gained or lost tools since the catalogue was
|
|
913
|
+
// written at the start of the run (an MCP server that connected late).
|
|
914
|
+
// Say so in the conversation, once, instead of leaving them invisible.
|
|
915
|
+
const toolChange = this.ctx.tools.refresh?.()
|
|
916
|
+
if (toolChange) {
|
|
917
|
+
const change = this.ctx.tools.describeChange(toolChange)
|
|
918
|
+
if (change)
|
|
919
|
+
appendRecordedContext(
|
|
920
|
+
recorder,
|
|
921
|
+
[{ key: 'tools-changed', text: change }],
|
|
922
|
+
this.ctx.log,
|
|
923
|
+
)
|
|
924
|
+
}
|
|
910
925
|
const contextSections =
|
|
911
926
|
this.ctx.promptContributions?.render('context', { iteration: iterationNum }) ?? []
|
|
912
927
|
const deferredMcpHints =
|
|
@@ -1065,7 +1080,13 @@ export class IterationOrchestrator {
|
|
|
1065
1080
|
// and a mode change would re-key the whole conversation.
|
|
1066
1081
|
if (policyNotice) requestHistory.push(stepContextMessage(policyNotice))
|
|
1067
1082
|
const projected = projectRequestRichContent(
|
|
1068
|
-
|
|
1083
|
+
// After the empty entries are dropped: an interrupted turn can leave
|
|
1084
|
+
// one behind, and it answered nothing.
|
|
1085
|
+
withInterruptedRequestsMarked(
|
|
1086
|
+
withoutVoidAssistantTurns(
|
|
1087
|
+
this.projectObservations(framePastedMessages(requestHistory)),
|
|
1088
|
+
),
|
|
1089
|
+
),
|
|
1069
1090
|
this.richContentBudget(),
|
|
1070
1091
|
{ imagesReadable: this.modelReadsImages(stepModel) },
|
|
1071
1092
|
)
|
|
@@ -2723,7 +2744,7 @@ export class IterationOrchestrator {
|
|
|
2723
2744
|
// tool result can be shed. Initial history was already extracted at seed.
|
|
2724
2745
|
const manager = this.ctx.workingStateManager
|
|
2725
2746
|
if (arriving && manager) {
|
|
2726
|
-
extractFromUserMessage(manager, message
|
|
2747
|
+
extractFromUserMessage(manager, message, !manager.getState().task)
|
|
2727
2748
|
}
|
|
2728
2749
|
}
|
|
2729
2750
|
|
|
@@ -3804,7 +3825,7 @@ export class IterationOrchestrator {
|
|
|
3804
3825
|
...(workingMemory.context ? [workingMemory.context] : []),
|
|
3805
3826
|
]
|
|
3806
3827
|
const finalMessages = projectRequestRichContent(
|
|
3807
|
-
withoutVoidAssistantTurns(this.projectObservations(finalHistory)),
|
|
3828
|
+
withoutVoidAssistantTurns(this.projectObservations(framePastedMessages(finalHistory))),
|
|
3808
3829
|
this.richContentBudget(),
|
|
3809
3830
|
{ imagesReadable: this.modelReadsImages(model) },
|
|
3810
3831
|
)
|
|
@@ -27,6 +27,7 @@ import { serializeState } from '../../../../compaction/serializer.js'
|
|
|
27
27
|
import {
|
|
28
28
|
COMPACTION_RECOVERY_NOTE,
|
|
29
29
|
buildCompactionMessage,
|
|
30
|
+
collectRevealedTools,
|
|
30
31
|
isCompactionMessage,
|
|
31
32
|
} from '../../../../compaction/summary.js'
|
|
32
33
|
import { estimateMessagesTokens } from '../../../../compaction/token-estimate.js'
|
|
@@ -1282,6 +1283,9 @@ async function runCompactionCheckInner(
|
|
|
1282
1283
|
mounted.has('search_conversation') && mounted.has('read_conversation')
|
|
1283
1284
|
? COMPACTION_RECOVERY_NOTE
|
|
1284
1285
|
: undefined,
|
|
1286
|
+
// The tools the model had loaded stay loaded: the messages that loaded
|
|
1287
|
+
// them are what this pass cuts.
|
|
1288
|
+
collectRevealedTools(messages),
|
|
1285
1289
|
)
|
|
1286
1290
|
|
|
1287
1291
|
const newMessages = [...preservedSystem, compactionMessage, ...retainedOlder, ...recentMessages]
|
|
@@ -477,6 +477,11 @@ function resumeContextOf(ctx: IterationContext, scope?: AskScope): ResumeContext
|
|
|
477
477
|
ctx.toolExecutor.launchedScripts(callId, line, dialect),
|
|
478
478
|
}
|
|
479
479
|
: {}),
|
|
480
|
+
...(typeof ctx.toolExecutor?.gitStatusForReview === 'function'
|
|
481
|
+
? {
|
|
482
|
+
gitStatus: (line, dialect) => ctx.toolExecutor.gitStatusForReview(line, dialect),
|
|
483
|
+
}
|
|
484
|
+
: {}),
|
|
480
485
|
}
|
|
481
486
|
}
|
|
482
487
|
|
|
@@ -9,25 +9,20 @@ import { DECLINED_TOOL_CALL_FEEDBACK } from '../../declined.js'
|
|
|
9
9
|
import type { CallAdmission, ReviewedExecution } from '../../executor.js'
|
|
10
10
|
import { DECLINED_NOTE_MAX_CHARS } from '../../executor.js'
|
|
11
11
|
import { supersededByRecovery } from '../../resume-pending.js'
|
|
12
|
+
import {
|
|
13
|
+
EDIT_NOT_OFFERED,
|
|
14
|
+
NOT_THIS_QUESTION,
|
|
15
|
+
PAUSED_CALL,
|
|
16
|
+
UNANSWERED_CALL,
|
|
17
|
+
} from '../../unanswered.js'
|
|
18
|
+
|
|
19
|
+
export { UNANSWERED_CALL } from '../../unanswered.js'
|
|
12
20
|
import { type IterationContext, awaitDecisionDurably } from './context.js'
|
|
13
21
|
|
|
14
22
|
/** What a call is told when a refusal elsewhere in its batch ended the turn before it started. */
|
|
15
23
|
export const REFUSED_WITH_THE_TURN =
|
|
16
24
|
'An earlier call in this batch was refused and the turn was stopped, so this call was not run. Wait for the user.'
|
|
17
25
|
|
|
18
|
-
/** What a call is told when the answer to it could not be taken. */
|
|
19
|
-
export const UNANSWERED_CALL =
|
|
20
|
-
'No answer was given for this call, so it was not run. Ask again if it is still needed.'
|
|
21
|
-
|
|
22
|
-
const EDIT_NOT_OFFERED =
|
|
23
|
-
'Editing a call while it is asked about is not offered, so this call was not run. Ask again with the input you want.'
|
|
24
|
-
|
|
25
|
-
const PAUSED_CALL =
|
|
26
|
-
'The turn was asked to wait before this call could be answered, so it was not run. Ask again if it is still needed.'
|
|
27
|
-
|
|
28
|
-
const NOT_THIS_QUESTION =
|
|
29
|
-
'That answer was not an answer to a question about a tool call, so this call was not run.'
|
|
30
|
-
|
|
31
26
|
/** The audit trail keeps a person's reason, cut short and without control characters. */
|
|
32
27
|
/**
|
|
33
28
|
* Whether a tool result is the answer to a call that never ran because the
|
|
@@ -662,7 +662,13 @@ export async function* runToolReview(
|
|
|
662
662
|
for (const gr of gateResults) {
|
|
663
663
|
// Before the overrides below: only a rule that was WRITTEN to ask a
|
|
664
664
|
// person, not an allow demoted to a question, is an ask rule.
|
|
665
|
-
|
|
665
|
+
// The dangerous-command floor's questions (`sudo`, `ssh user@host`, …)
|
|
666
|
+
// are not ask rules: nobody wrote one to be kept in every mode, so
|
|
667
|
+
// bypass and auto lift them like any other review.
|
|
668
|
+
const ruleAsked =
|
|
669
|
+
gr.gateResult.decision === 'review' &&
|
|
670
|
+
gr.gateResult.matchedRule !== null &&
|
|
671
|
+
gr.gateResult.matchedRule.type !== 'deny_dangerous_patterns'
|
|
666
672
|
// An `allow` rule was written about a tool, not about a path outside
|
|
667
673
|
// the working directory or a command outside the sandbox, which
|
|
668
674
|
// were refused outright when it was written. So an escalated call
|