@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
|
@@ -63,6 +63,7 @@
|
|
|
63
63
|
import { closeSync, mkdirSync, openSync, readSync, rmSync, writeFileSync } from 'node:fs'
|
|
64
64
|
import { join } from 'node:path'
|
|
65
65
|
|
|
66
|
+
import { HOOK_ENV_OWNER_FILE } from '../utils/temp-sweep.js'
|
|
66
67
|
import { createTempDirSync } from '../utils/temp.js'
|
|
67
68
|
|
|
68
69
|
/** The events whose hooks may set variables, in the order a later one outranks an earlier one. */
|
|
@@ -139,6 +140,24 @@ export function refusedHookEnvName(name: string): string | undefined {
|
|
|
139
140
|
const envFileName = (event: HookEnvEvent, slot: number): string =>
|
|
140
141
|
slot === 0 ? `${event}.env` : `${event}.${slot}.env`
|
|
141
142
|
|
|
143
|
+
/**
|
|
144
|
+
* Write who made a hook-env folder: this process's id and when it started. A folder left by a
|
|
145
|
+
* process that crashed is then known to be no one's once that process is gone. Best effort: a
|
|
146
|
+
* folder without it is removed by age instead.
|
|
147
|
+
*/
|
|
148
|
+
function writeHookEnvOwner(directory: string): void {
|
|
149
|
+
try {
|
|
150
|
+
const startedAt = new Date(Date.now() - process.uptime() * 1000).toISOString()
|
|
151
|
+
writeFileSync(
|
|
152
|
+
join(directory, HOOK_ENV_OWNER_FILE),
|
|
153
|
+
`${JSON.stringify({ pid: process.pid, startedAt })}\n`,
|
|
154
|
+
{ flag: 'wx', mode: 0o600 },
|
|
155
|
+
)
|
|
156
|
+
} catch {
|
|
157
|
+
// The age rule covers a folder whose owner is not written.
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
142
161
|
interface Reading {
|
|
143
162
|
readonly name: string
|
|
144
163
|
readonly value: string
|
|
@@ -303,8 +322,12 @@ export class SessionHookEnv {
|
|
|
303
322
|
if (this.disposed) return undefined
|
|
304
323
|
try {
|
|
305
324
|
if (this.directory === undefined) {
|
|
306
|
-
|
|
325
|
+
const chosen = this.options.directory?.()
|
|
326
|
+
this.directory = chosen ?? createTempDirSync('hook-env')
|
|
307
327
|
mkdirSync(this.directory, { recursive: true, mode: 0o700 })
|
|
328
|
+
// The folder is in the shared temporary folder, so it says whose it is: a later
|
|
329
|
+
// start removes it once that process has exited (`sweepPrivateTempRoot`).
|
|
330
|
+
if (chosen === undefined) writeHookEnvOwner(this.directory)
|
|
308
331
|
}
|
|
309
332
|
const file = join(this.directory, envFileName(event, slot))
|
|
310
333
|
const known = this.slots.get(event) ?? new Set<number>()
|
|
@@ -378,7 +401,7 @@ export class SessionHookEnv {
|
|
|
378
401
|
try {
|
|
379
402
|
rmSync(this.directory, { recursive: true, force: true })
|
|
380
403
|
} catch {
|
|
381
|
-
//
|
|
404
|
+
// A later start's sweep removes it once this process has exited (`sweepPrivateTempRoot`).
|
|
382
405
|
}
|
|
383
406
|
this.directory = undefined
|
|
384
407
|
}
|
package/src/plugin/shell-hook.ts
CHANGED
|
@@ -119,13 +119,20 @@ import { spawnHostShell } from '../tools/command-shell.js'
|
|
|
119
119
|
import type { PluginId } from '../types/ids/index.js'
|
|
120
120
|
import type {
|
|
121
121
|
PluginCompactionInfo,
|
|
122
|
+
PluginDirectorySource,
|
|
123
|
+
PluginElicitationAnswer,
|
|
124
|
+
PluginElicitationInfo,
|
|
122
125
|
PluginFileChange,
|
|
123
126
|
PluginHookContext,
|
|
124
127
|
PluginHookDefinition,
|
|
125
128
|
PluginHookEvent,
|
|
126
129
|
PluginHookPermission,
|
|
127
130
|
PluginHookResult,
|
|
131
|
+
PluginInstructionsInfo,
|
|
132
|
+
PluginModelSwitchInfo,
|
|
128
133
|
PluginNotificationInfo,
|
|
134
|
+
PluginPromptExpansionInfo,
|
|
135
|
+
PluginTaskInfo,
|
|
129
136
|
PluginToolBatchCall,
|
|
130
137
|
} from '../types/plugin/index.js'
|
|
131
138
|
import { RENAMED_PLUGIN_HOOK_EVENTS } from '../types/plugin/index.js'
|
|
@@ -175,6 +182,15 @@ export type ShellHookEvent = Extract<
|
|
|
175
182
|
| 'cwd_changed'
|
|
176
183
|
| 'worktree_create'
|
|
177
184
|
| 'worktree_remove'
|
|
185
|
+
| 'pre_model_switch'
|
|
186
|
+
| 'post_model_switch'
|
|
187
|
+
| 'elicitation'
|
|
188
|
+
| 'elicitation_result'
|
|
189
|
+
| 'directory_added'
|
|
190
|
+
| 'instructions_loaded'
|
|
191
|
+
| 'user_prompt_expansion'
|
|
192
|
+
| 'task_created'
|
|
193
|
+
| 'task_completed'
|
|
178
194
|
>
|
|
179
195
|
|
|
180
196
|
export const SHELL_HOOK_EVENTS: readonly ShellHookEvent[] = [
|
|
@@ -199,6 +215,15 @@ export const SHELL_HOOK_EVENTS: readonly ShellHookEvent[] = [
|
|
|
199
215
|
'cwd_changed',
|
|
200
216
|
'worktree_create',
|
|
201
217
|
'worktree_remove',
|
|
218
|
+
'pre_model_switch',
|
|
219
|
+
'post_model_switch',
|
|
220
|
+
'elicitation',
|
|
221
|
+
'elicitation_result',
|
|
222
|
+
'directory_added',
|
|
223
|
+
'instructions_loaded',
|
|
224
|
+
'user_prompt_expansion',
|
|
225
|
+
'task_created',
|
|
226
|
+
'task_completed',
|
|
202
227
|
]
|
|
203
228
|
|
|
204
229
|
/** What a failed hook does to the action it guards. */
|
|
@@ -717,6 +742,20 @@ export interface ShellHookInput {
|
|
|
717
742
|
readonly worktreeBaseRef?: string
|
|
718
743
|
/** On `worktree_remove`: the worktree. Sent as `worktree_path`. */
|
|
719
744
|
readonly worktreePath?: string
|
|
745
|
+
/** On `pre_model_switch` and `post_model_switch`. Sent as `from_model`, `to_model`, `requested_model` and `source`. */
|
|
746
|
+
readonly modelSwitch?: PluginModelSwitchInfo
|
|
747
|
+
/** On `elicitation` and `elicitation_result`. Sent as `mcp_server_name`, `message`, `mode`, `url`, `elicitation_id`, `requested_schema`, `action` and `content`. */
|
|
748
|
+
readonly elicitation?: PluginElicitationInfo
|
|
749
|
+
/** On `directory_added`: the folder, absolute. Sent as `directory`. */
|
|
750
|
+
readonly directory?: string
|
|
751
|
+
/** On `directory_added`: what added it. Sent as `source`. */
|
|
752
|
+
readonly directorySource?: PluginDirectorySource
|
|
753
|
+
/** On `instructions_loaded`. Sent as `file_path`, `memory_type`, `load_reason`, `parent_file_path` and `trigger_file_path`. */
|
|
754
|
+
readonly instructions?: PluginInstructionsInfo
|
|
755
|
+
/** On `user_prompt_expansion`. Sent as `expansion_type`, `command_name`, `command_args` and `command_source`. */
|
|
756
|
+
readonly expansion?: PluginPromptExpansionInfo
|
|
757
|
+
/** On `task_created` and `task_completed`. Sent as `task_id`, `task_subject` and `task_description`. */
|
|
758
|
+
readonly task?: PluginTaskInfo
|
|
720
759
|
/**
|
|
721
760
|
* The file this hook may append `export NAME=value` lines to. Sent as
|
|
722
761
|
* `NAMZU_ENV_FILE`; on every other event the variable is not set at all.
|
|
@@ -785,6 +824,66 @@ export function shellHookPayload(input: ShellHookInput): string {
|
|
|
785
824
|
...(input.worktreeRoot !== undefined ? { worktree_root: input.worktreeRoot } : {}),
|
|
786
825
|
...(input.worktreeBaseRef !== undefined ? { base_ref: input.worktreeBaseRef } : {}),
|
|
787
826
|
...(input.worktreePath !== undefined ? { worktree_path: input.worktreePath } : {}),
|
|
827
|
+
...(input.modelSwitch !== undefined
|
|
828
|
+
? {
|
|
829
|
+
from_model: input.modelSwitch.fromModel,
|
|
830
|
+
to_model: input.modelSwitch.toModel,
|
|
831
|
+
requested_model: input.modelSwitch.requestedModel,
|
|
832
|
+
source: input.modelSwitch.source,
|
|
833
|
+
}
|
|
834
|
+
: {}),
|
|
835
|
+
...(input.elicitation !== undefined
|
|
836
|
+
? {
|
|
837
|
+
mcp_server_name: input.elicitation.serverName,
|
|
838
|
+
message: input.elicitation.message,
|
|
839
|
+
...(input.elicitation.mode !== undefined ? { mode: input.elicitation.mode } : {}),
|
|
840
|
+
...(input.elicitation.url !== undefined ? { url: input.elicitation.url } : {}),
|
|
841
|
+
...(input.elicitation.elicitationId !== undefined
|
|
842
|
+
? { elicitation_id: input.elicitation.elicitationId }
|
|
843
|
+
: {}),
|
|
844
|
+
...(input.elicitation.requestedSchema !== undefined
|
|
845
|
+
? { requested_schema: input.elicitation.requestedSchema }
|
|
846
|
+
: {}),
|
|
847
|
+
...(input.elicitation.action !== undefined ? { action: input.elicitation.action } : {}),
|
|
848
|
+
...(input.elicitation.content !== undefined
|
|
849
|
+
? { content: input.elicitation.content }
|
|
850
|
+
: {}),
|
|
851
|
+
}
|
|
852
|
+
: {}),
|
|
853
|
+
...(input.directory !== undefined ? { directory: input.directory } : {}),
|
|
854
|
+
...(input.directorySource !== undefined ? { source: input.directorySource } : {}),
|
|
855
|
+
...(input.instructions !== undefined
|
|
856
|
+
? {
|
|
857
|
+
file_path: input.instructions.filePath,
|
|
858
|
+
memory_type: input.instructions.memoryType,
|
|
859
|
+
load_reason: input.instructions.loadReason,
|
|
860
|
+
...(input.instructions.parentFilePath !== undefined
|
|
861
|
+
? { parent_file_path: input.instructions.parentFilePath }
|
|
862
|
+
: {}),
|
|
863
|
+
...(input.instructions.triggerFilePath !== undefined
|
|
864
|
+
? { trigger_file_path: input.instructions.triggerFilePath }
|
|
865
|
+
: {}),
|
|
866
|
+
}
|
|
867
|
+
: {}),
|
|
868
|
+
...(input.expansion !== undefined
|
|
869
|
+
? {
|
|
870
|
+
expansion_type: input.expansion.expansionType,
|
|
871
|
+
command_name: input.expansion.commandName,
|
|
872
|
+
command_args: input.expansion.commandArgs,
|
|
873
|
+
...(input.expansion.commandSource !== undefined
|
|
874
|
+
? { command_source: input.expansion.commandSource }
|
|
875
|
+
: {}),
|
|
876
|
+
}
|
|
877
|
+
: {}),
|
|
878
|
+
...(input.task !== undefined
|
|
879
|
+
? {
|
|
880
|
+
...(input.task.id !== undefined ? { task_id: input.task.id } : {}),
|
|
881
|
+
...(input.task.subject !== undefined ? { task_subject: input.task.subject } : {}),
|
|
882
|
+
...(input.task.description !== undefined
|
|
883
|
+
? { task_description: input.task.description }
|
|
884
|
+
: {}),
|
|
885
|
+
}
|
|
886
|
+
: {}),
|
|
788
887
|
...(input.compaction !== undefined ? compactionFields(input.event, input.compaction) : {}),
|
|
789
888
|
...(input.toolName !== undefined
|
|
790
889
|
? { tool_name: shellHookToolName(input.toolName, input.toolNames) }
|
|
@@ -1154,6 +1253,15 @@ export const SHELL_HOOK_PASCAL_EVENT_NAMES: Readonly<Partial<Record<ShellHookEve
|
|
|
1154
1253
|
cwd_changed: 'CwdChanged',
|
|
1155
1254
|
worktree_create: 'WorktreeCreate',
|
|
1156
1255
|
worktree_remove: 'WorktreeRemove',
|
|
1256
|
+
pre_model_switch: 'PreModelSwitch',
|
|
1257
|
+
post_model_switch: 'PostModelSwitch',
|
|
1258
|
+
elicitation: 'Elicitation',
|
|
1259
|
+
elicitation_result: 'ElicitationResult',
|
|
1260
|
+
directory_added: 'DirectoryAdded',
|
|
1261
|
+
instructions_loaded: 'InstructionsLoaded',
|
|
1262
|
+
user_prompt_expansion: 'UserPromptExpansion',
|
|
1263
|
+
task_created: 'TaskCreated',
|
|
1264
|
+
task_completed: 'TaskCompleted',
|
|
1157
1265
|
}
|
|
1158
1266
|
|
|
1159
1267
|
/** What a hook's stdout JSON said, before it is mapped to a verdict for an event. */
|
|
@@ -1171,6 +1279,8 @@ interface ShellHookReading {
|
|
|
1171
1279
|
suppressOutput?: boolean
|
|
1172
1280
|
/** On `session_start`, `file_changed` and `cwd_changed`: the files to watch from now on. */
|
|
1173
1281
|
watchPaths?: readonly string[]
|
|
1282
|
+
/** On `elicitation` and `elicitation_result`: the answer the hook gave. */
|
|
1283
|
+
elicitation?: PluginElicitationAnswer
|
|
1174
1284
|
/** Why the JSON was set aside, when it was. */
|
|
1175
1285
|
invalid?: string
|
|
1176
1286
|
}
|
|
@@ -1344,7 +1454,27 @@ function readShellHookJson(
|
|
|
1344
1454
|
const additional = optionalString('additionalContext', specific)
|
|
1345
1455
|
if (additional && additional.trim().length > 0) reading.context = additional.trim()
|
|
1346
1456
|
|
|
1347
|
-
if (event === '
|
|
1457
|
+
if (event === 'elicitation' || event === 'elicitation_result') {
|
|
1458
|
+
const action = specific.action
|
|
1459
|
+
if (action !== undefined) {
|
|
1460
|
+
if (action !== 'accept' && action !== 'decline' && action !== 'cancel') {
|
|
1461
|
+
return { invalid: '`action` must be "accept", "decline" or "cancel"' }
|
|
1462
|
+
}
|
|
1463
|
+
if (specific.content !== undefined && !isRecord(specific.content)) {
|
|
1464
|
+
return { invalid: '`content` must be an object' }
|
|
1465
|
+
}
|
|
1466
|
+
reading.elicitation = {
|
|
1467
|
+
action,
|
|
1468
|
+
...(isRecord(specific.content) ? { content: specific.content } : {}),
|
|
1469
|
+
}
|
|
1470
|
+
} else if (specific.content !== undefined) {
|
|
1471
|
+
// Values with no action: on a result they replace what was given.
|
|
1472
|
+
if (!isRecord(specific.content)) return { invalid: '`content` must be an object' }
|
|
1473
|
+
if (event === 'elicitation') return { invalid: '`content` needs an `action` beside it' }
|
|
1474
|
+
reading.elicitation = { action: 'accept', content: specific.content }
|
|
1475
|
+
}
|
|
1476
|
+
}
|
|
1477
|
+
if (event === 'pre_tool_use' || event === 'pre_model_switch') {
|
|
1348
1478
|
const decision = specific.permissionDecision
|
|
1349
1479
|
const why = optionalString('permissionDecisionReason', specific)
|
|
1350
1480
|
if (decision !== undefined) {
|
|
@@ -1360,7 +1490,7 @@ function readShellHookJson(
|
|
|
1360
1490
|
// back to a separate permission service gets the ordinary rules, the
|
|
1361
1491
|
// same as a hook that said nothing.
|
|
1362
1492
|
}
|
|
1363
|
-
if (specific.updatedInput !== undefined) {
|
|
1493
|
+
if (event === 'pre_tool_use' && specific.updatedInput !== undefined) {
|
|
1364
1494
|
if (!isRecord(specific.updatedInput)) return { invalid: '`updatedInput` must be an object' }
|
|
1365
1495
|
const rewritten = readRewrittenInput(call.toolName, call.toolInput, specific.updatedInput)
|
|
1366
1496
|
if (rewritten === undefined) {
|
|
@@ -1474,6 +1604,13 @@ export function shellHookVerdict(
|
|
|
1474
1604
|
case 'turn_end':
|
|
1475
1605
|
case 'subagent_stop':
|
|
1476
1606
|
case 'pre_compact':
|
|
1607
|
+
// Refused before they happen; a refused question is declined.
|
|
1608
|
+
case 'pre_model_switch':
|
|
1609
|
+
case 'elicitation':
|
|
1610
|
+
case 'elicitation_result':
|
|
1611
|
+
case 'user_prompt_expansion':
|
|
1612
|
+
case 'task_created':
|
|
1613
|
+
case 'task_completed':
|
|
1477
1614
|
return { action: 'skip', reason }
|
|
1478
1615
|
// The child is starting regardless; what the hook said is its context.
|
|
1479
1616
|
case 'subagent_start':
|
|
@@ -1533,6 +1670,8 @@ export function shellHookVerdict(
|
|
|
1533
1670
|
(event === 'user_prompt_submit' ||
|
|
1534
1671
|
event === 'subagent_start' ||
|
|
1535
1672
|
event === 'session_start' ||
|
|
1673
|
+
event === 'user_prompt_expansion' ||
|
|
1674
|
+
event === 'post_model_switch' ||
|
|
1536
1675
|
event === 'pre_compact') &&
|
|
1537
1676
|
text.length > 0
|
|
1538
1677
|
)
|
|
@@ -1589,6 +1728,46 @@ export function shellHookVerdict(
|
|
|
1589
1728
|
? { action: 'annotate', text: reading.context }
|
|
1590
1729
|
: { action: 'continue' }
|
|
1591
1730
|
}
|
|
1731
|
+
case 'user_prompt_expansion': {
|
|
1732
|
+
const block = reading.block ?? reading.halt?.reason
|
|
1733
|
+
if (block !== undefined) return { action: 'skip', reason: block }
|
|
1734
|
+
return reading.context !== undefined
|
|
1735
|
+
? { action: 'annotate', text: reading.context }
|
|
1736
|
+
: { action: 'continue' }
|
|
1737
|
+
}
|
|
1738
|
+
case 'pre_model_switch': {
|
|
1739
|
+
const block = reading.block ?? reading.halt?.reason
|
|
1740
|
+
if (block !== undefined) return { action: 'skip', reason: block, ...notes }
|
|
1741
|
+
return {
|
|
1742
|
+
action: 'continue',
|
|
1743
|
+
...(reading.permission ? { permission: reading.permission } : {}),
|
|
1744
|
+
...notes,
|
|
1745
|
+
}
|
|
1746
|
+
}
|
|
1747
|
+
case 'post_model_switch':
|
|
1748
|
+
// The switch has happened. What the hook said is for the model's next request.
|
|
1749
|
+
return reading.context !== undefined
|
|
1750
|
+
? { action: 'annotate', text: reading.context }
|
|
1751
|
+
: {
|
|
1752
|
+
action: 'continue',
|
|
1753
|
+
...(reading.notice ? { notice: reading.notice } : {}),
|
|
1754
|
+
}
|
|
1755
|
+
case 'elicitation':
|
|
1756
|
+
case 'elicitation_result': {
|
|
1757
|
+
const block = reading.block ?? reading.halt?.reason
|
|
1758
|
+
if (block !== undefined) return { action: 'skip', reason: block }
|
|
1759
|
+
return {
|
|
1760
|
+
action: 'continue',
|
|
1761
|
+
...(reading.elicitation !== undefined ? { elicitation: reading.elicitation } : {}),
|
|
1762
|
+
...(reading.notice ? { notice: reading.notice } : {}),
|
|
1763
|
+
}
|
|
1764
|
+
}
|
|
1765
|
+
case 'task_created':
|
|
1766
|
+
case 'task_completed': {
|
|
1767
|
+
const block = reading.block ?? reading.halt?.reason
|
|
1768
|
+
if (block !== undefined) return { action: 'skip', reason: block }
|
|
1769
|
+
return { action: 'continue', ...(reading.notice ? { notice: reading.notice } : {}) }
|
|
1770
|
+
}
|
|
1592
1771
|
case 'subagent_start': {
|
|
1593
1772
|
// The child is already starting: a refusal cannot stop it, so its reason
|
|
1594
1773
|
// is context for the child like anything else the hook said.
|
|
@@ -1986,20 +2165,26 @@ export function createShellHook(
|
|
|
1986
2165
|
event === 'subagent_start' ||
|
|
1987
2166
|
event === 'subagent_stop' ||
|
|
1988
2167
|
event === 'session_start' ||
|
|
1989
|
-
event === 'session_end'
|
|
2168
|
+
event === 'session_end' ||
|
|
2169
|
+
event === 'directory_added' ||
|
|
2170
|
+
event === 'instructions_loaded'
|
|
1990
2171
|
)
|
|
1991
2172
|
const subject =
|
|
1992
|
-
event === '
|
|
1993
|
-
? context.
|
|
1994
|
-
: event === '
|
|
1995
|
-
? context.
|
|
1996
|
-
: event === '
|
|
1997
|
-
? context.
|
|
1998
|
-
: event === '
|
|
1999
|
-
? context.
|
|
2000
|
-
: event === '
|
|
2001
|
-
? context.
|
|
2002
|
-
:
|
|
2173
|
+
event === 'directory_added'
|
|
2174
|
+
? context.directorySource
|
|
2175
|
+
: event === 'instructions_loaded'
|
|
2176
|
+
? context.instructions?.loadReason
|
|
2177
|
+
: event === 'notification'
|
|
2178
|
+
? context.notification?.type
|
|
2179
|
+
: event === 'pre_compact' || event === 'post_compact'
|
|
2180
|
+
? context.compaction?.trigger
|
|
2181
|
+
: event === 'subagent_start' || event === 'subagent_stop'
|
|
2182
|
+
? context.agentType
|
|
2183
|
+
: event === 'session_start'
|
|
2184
|
+
? context.source
|
|
2185
|
+
: event === 'session_end'
|
|
2186
|
+
? context.endReason
|
|
2187
|
+
: context.toolName
|
|
2003
2188
|
// An event that has no name to match (`turn_end`, `user_prompt_submit`,
|
|
2004
2189
|
// `turn_start`, `post_tool_batch`) ignores the matcher and the hook
|
|
2005
2190
|
// fires: a matcher cannot be read against a name that is not there, and
|
|
@@ -2050,6 +2235,15 @@ export function createShellHook(
|
|
|
2050
2235
|
? { worktreeBaseRef: context.worktreeBaseRef }
|
|
2051
2236
|
: {}),
|
|
2052
2237
|
...(context.worktreePath !== undefined ? { worktreePath: context.worktreePath } : {}),
|
|
2238
|
+
...(context.modelSwitch !== undefined ? { modelSwitch: context.modelSwitch } : {}),
|
|
2239
|
+
...(context.elicitation !== undefined ? { elicitation: context.elicitation } : {}),
|
|
2240
|
+
...(context.directory !== undefined ? { directory: context.directory } : {}),
|
|
2241
|
+
...(context.directorySource !== undefined
|
|
2242
|
+
? { directorySource: context.directorySource }
|
|
2243
|
+
: {}),
|
|
2244
|
+
...(context.instructions !== undefined ? { instructions: context.instructions } : {}),
|
|
2245
|
+
...(context.expansion !== undefined ? { expansion: context.expansion } : {}),
|
|
2246
|
+
...(context.task !== undefined ? { task: context.task } : {}),
|
|
2053
2247
|
...(options.projectDir !== undefined ? { projectDir: options.projectDir } : {}),
|
|
2054
2248
|
...(options.plugin !== undefined ? { plugin: options.plugin } : {}),
|
|
2055
2249
|
sessionId: String(context.sessionId),
|
|
@@ -36,66 +36,61 @@ import type { PromptContribution } from './contributions.js'
|
|
|
36
36
|
|
|
37
37
|
export const CODING_AGENT_WORKING_DOCTRINE = `## How you work
|
|
38
38
|
|
|
39
|
-
###
|
|
40
|
-
-
|
|
41
|
-
-
|
|
42
|
-
-
|
|
43
|
-
-
|
|
39
|
+
### Finishing the work
|
|
40
|
+
- Do the whole task. Ending your turn stops all work, so do not stop while work you were given remains, and never close on a plan or a promise of later work: do it now. A step that says it will do something does it in that step.
|
|
41
|
+
- Work through ordinary obstacles (an error, a failing command, a missing file) by finding the cause and fixing it; report one only after the reasonable ways round it are used up. After a refused or empty result, change the request or report it; do not issue the same call again. A denied call is a decision: adjust, and do not retry it.
|
|
42
|
+
- If one part is blocked (a tool you lack, a missing input), say so plainly instead of improvising a result, finish every other part in full, and say what you left out and why.
|
|
43
|
+
- Context is compacted automatically as it fills, so a long conversation is never a reason to wrap up early or skip a step.
|
|
44
44
|
|
|
45
45
|
### Asking and proceeding
|
|
46
|
-
- Act when you have enough information. Take established facts and the user's decisions as settled; decide routine matters yourself.
|
|
46
|
+
- Act when you have enough information. Take established facts and the user's decisions as settled, without re-deriving or reopening them; decide routine matters yourself and give a recommendation, not a survey of options.
|
|
47
47
|
- Ask only when you cannot name the most likely reading of the request, or when proceeding under any assumption would be unsafe or would make the work useless if wrong. Ask once, with your best guess, because ending the turn stops all work.
|
|
48
|
-
- If you find a real problem with the task as stated, say so in a sentence
|
|
49
|
-
-
|
|
48
|
+
- If you find a real problem with the task as stated, say so in a sentence and keep going under a stated assumption. If the user repeats or reaffirms a request after you raised a concern, that is their decision: say so and do the full request.
|
|
49
|
+
- Confirm first before an action that is hard to reverse or visible outside this machine (deleting data, sending a message, publishing, changing a shared system), unless the user asked for exactly that. Never type a credential the user did not give you.
|
|
50
|
+
|
|
51
|
+
### Questions, problems and investigations
|
|
52
|
+
- A plain question (what, why, how, where, how much) gets the answer first: open with it, not with an apology or agreement for its own sake. Put every look it needs in one response, and stop once you have the fact. A status or cost question is answered from what is at hand.
|
|
53
|
+
- A report that something is broken (the tests fail, a total is wrong), made in a working directory, is a request to fix it, unless the person says they only want a diagnosis: find the cause, fix it, and check the fix.
|
|
54
|
+
- An investigation continues until the cause is found or every reasonable lead is used up. Then report the cause, or what you ruled out and what would settle it.
|
|
50
55
|
|
|
51
56
|
### Reporting
|
|
52
|
-
- Report outcomes faithfully: show failing test output, say what you skipped, and state what is done and verified.
|
|
53
|
-
-
|
|
54
|
-
- Correct an earlier statement only when the error would change the user's code, conclusions or decisions; state it once, plainly, with no apology or tally of past mistakes, because they spend the reader's attention on the past.
|
|
57
|
+
- Report outcomes faithfully: show failing test output, say what you skipped, and state what is done and verified. Name which checks were actually run, so a green run on a subset reads as that subset.
|
|
58
|
+
- Reference code as \`path:line\`, and identifiers as the evidence spells them. Correct an earlier statement only when the error would change the user's code, conclusions or decisions; state it once, with no apology or tally of past mistakes, because they spend the reader's attention on the past.
|
|
55
59
|
|
|
56
60
|
### Using available evidence
|
|
57
|
-
- A successful tool result
|
|
58
|
-
- Reuse
|
|
59
|
-
-
|
|
60
|
-
-
|
|
61
|
-
- Wait for a mutation to finish before an observation or another action that depends on it.
|
|
61
|
+
- A successful tool result is evidence of what happened, and so is content you wrote; an announced action, a failed call or another agent's unsupported claim is not.
|
|
62
|
+
- Reuse what is in the conversation instead of observing again by habit; observe again when evidence is missing, stale or the target may have changed, and ask the narrowest question (a known file, not a directory). Repeating a state-changing action changes state twice.
|
|
63
|
+
- A question about your own earlier answer is answered from that answer; do not open files to find a reason you did not have.
|
|
64
|
+
- If a check or an exact-match edit reports a mismatch, inspect the current state and revise before going on.
|
|
62
65
|
|
|
63
66
|
### When the task is to change code
|
|
64
67
|
This section applies only when you were asked to change something.
|
|
65
|
-
- Begin editing once you know the first change
|
|
66
|
-
-
|
|
67
|
-
-
|
|
68
|
-
- Prefer the dedicated tools over shell equivalents (\`read\` over \`cat\`, \`grep\` over a shell grep, \`glob\` over \`find\`, \`edit\` over \`sed -i\`, \`write\` over a shell redirect); use \`bash\` for a shell.
|
|
69
|
-
- For a defect, reproduce it first with a small script or a failing test, and keep it; make the change, then rerun that reproduction. Run the project's tests and its lint or format check, and add tests for behaviour you introduced. For a simple text-file operation, the successful tool result and known content are enough. Claim only the checks you ran.
|
|
68
|
+
- Begin editing once you know the first change; the requested scope is the deliverable, at the size asked. Match the surrounding idiom.
|
|
69
|
+
- Prefer the dedicated tools over shell equivalents (\`read\` over \`cat\`, \`grep\` over a shell grep, \`glob\` over \`find\`, \`edit\` over \`sed -i\`, \`write\` over a redirect); use \`bash\` for the rest.
|
|
70
|
+
- For a defect, reproduce it first with a small script or a failing test; a script stays in the scratch folder unless it becomes a test. After the change, rerun it. Run the project's tests and lint or format check, and add tests for behaviour you introduced. Claim only the checks you ran.
|
|
70
71
|
- Say where any throwaway file you made is, and which files outside the request you touched.
|
|
71
72
|
|
|
72
73
|
### Working with git
|
|
73
|
-
- Never push, force-push, reset, rebase, clean, or otherwise discard or rewrite history unless the user explicitly asked for
|
|
74
|
-
- Before any command that could discard uncommitted work, run \`git status
|
|
75
|
-
- Commit only when the user asks, on the branch that is checked out
|
|
76
|
-
- Never change git configuration or other persistent settings without asking: not \`user.name\` or \`user.email\`, hooks, remotes, credential helpers,
|
|
74
|
+
- Never push, force-push, reset, rebase, clean, or otherwise discard or rewrite history unless the user explicitly asked for it; approval for one push does not extend to the next.
|
|
75
|
+
- Before any command that could discard uncommitted work, run \`git status\`; if there are changes you did not make, stop and ask rather than stashing, committing or discarding somebody else's work.
|
|
76
|
+
- Commit only when the user asks, on the branch that is checked out; switch branches only when asked or the project's instructions require it, because the checked-out branch is the user's working state.
|
|
77
|
+
- Never change git configuration or other persistent settings without asking: not \`user.name\` or \`user.email\`, hooks, remotes, credential helpers, any \`git config\`, a shell profile or a tool's own config. If a commit fails because no identity is set, stop and tell the user the command to set one; do not invent one.
|
|
77
78
|
|
|
78
79
|
### Keeping the user informed
|
|
79
|
-
- For work that takes several calls, say one short line before the first call and
|
|
80
|
+
- For work that takes several calls, say one short line before the first call and another when you find something, change direction or hit a blocker; none beside each call, and none for a question that needs one look.
|
|
81
|
+
- Answer about the work, not about the setting. Name a path only when the person needs it (where a file was saved, what to open). Leave out the machine, sandbox, session, scratch folders, tools used and where you looked unless asked: an empty folder or a search that finds nothing is a clause, then the answer. A greeting is one short line.
|
|
80
82
|
- When you changed something, close with what changed, what was verified and what is left. For a question the reply is the answer.`
|
|
81
83
|
|
|
82
84
|
/**
|
|
83
85
|
* Parent-only: rules about the task list and `Agent`, which a
|
|
84
86
|
* delegated sub-agent does not have. See the module comment for the split.
|
|
87
|
+
* The mechanics (types, forks, worktrees, parallel writers) live in the
|
|
88
|
+
* `Agent` tool's own description.
|
|
85
89
|
*/
|
|
86
90
|
export const CODING_AGENT_DELEGATION_DOCTRINE = `### Planning and delegating
|
|
87
|
-
- A task list is optional. For work of three or more distinct steps you may keep one
|
|
88
|
-
- When the \`Agent\` tool is available, do small work, or work whose target you already know, yourself
|
|
89
|
-
-
|
|
90
|
-
- A sub-agent's report is a claim, not a fact. Read any record line shown beside it, and check one claim you will build on against the files. Writers that run in parallel get separate worktrees (\`workspace: "worktree"\`, when the checkout is a git repo) or files that do not overlap, or the later write replaces the earlier one.
|
|
91
|
-
- When the \`Agent\` tool lists a \`fork\` type, use \`subagent_type: "fork"\` for a side task whose output you will not need again; its prompt is only the directive. Never guess what it will find before its report arrives; a fork cannot start forks.
|
|
92
|
-
- When delegated agents finish, tell the user what each one found in your next message, because their results reach you and not the user.
|
|
93
|
-
- Use \`subagent_type: "explore"\` to locate something small; it only reads and searches, and never asks the user for permission. It is not for reviewing or auditing whole files. Reserve the default sub-agent for work that changes files or runs commands.
|
|
94
|
-
|
|
95
|
-
### Answering how work is going
|
|
96
|
-
- Read the note about running work on your request first if the host gives you one, and add one status read from the tool that started an item only when the note does not say enough. Leave the work running.
|
|
97
|
-
- Give each item the state you were given for it (progressing, waiting, stalled or dead) and how long ago it last moved; stalled means only quiet for a while. Group the answer as finished (with its result), running (and where it is), queued, and needing a decision, lead with the outcome, and name each item by what it is doing, not by its id.
|
|
98
|
-
- A result exists only once its completion message has arrived, so for an unfinished item say it is still running. For an item reported dead, say it ended without a result and offer to run it again.`
|
|
91
|
+
- A task list is optional. For work of three or more distinct steps you may keep one, a step in progress at a time, each marked done when it is; none for a two-step job.
|
|
92
|
+
- When the \`Agent\` tool is available, do small work, or work whose target you already know, yourself. A fresh sub-agent starts with none of your context, so brief it fully: the objective, what is out of bounds, the sources to use, the shape of the reply, paths and what is ruled out, never a conclusion to confirm. Delegate work that is independent of your next step, large, or whose output would flood your context.
|
|
93
|
+
- A sub-agent's report is a claim, not a fact: check one claim you will build on against the files, and tell the user what each delegated agent found, because their results reach you and not the user.`
|
|
99
94
|
|
|
100
95
|
/**
|
|
101
96
|
* For a session whose permission layer refuses every mutation. Says what that
|