@namzu/sdk 65.3.0 → 68.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 +167 -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/pricing/catalogue.generated.d.ts.map +1 -1
- package/dist/pricing/catalogue.generated.js +6 -0
- package/dist/pricing/catalogue.generated.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/provider/fallback.d.ts.map +1 -1
- package/dist/provider/fallback.js +12 -0
- package/dist/provider/fallback.js.map +1 -1
- package/dist/provider/idle-timeout.d.ts.map +1 -1
- package/dist/provider/idle-timeout.js +5 -0
- package/dist/provider/idle-timeout.js.map +1 -1
- package/dist/provider/model-window-suffix.d.ts.map +1 -1
- package/dist/provider/model-window-suffix.js +1 -0
- package/dist/provider/model-window-suffix.js.map +1 -1
- package/dist/provider/retry.d.ts.map +1 -1
- package/dist/provider/retry.js +5 -0
- package/dist/provider/retry.js.map +1 -1
- package/dist/public-runtime.d.ts +16 -8
- package/dist/public-runtime.d.ts.map +1 -1
- package/dist/public-runtime.js +24 -7
- 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 +10 -5
- package/dist/public-types.d.ts.map +1 -1
- package/dist/registry/command/kernel-commands.d.ts +11 -1
- package/dist/registry/command/kernel-commands.d.ts.map +1 -1
- package/dist/registry/command/kernel-commands.js +114 -46
- package/dist/registry/command/kernel-commands.js.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 +1 -1
- package/dist/runtime/query/iteration/index.d.ts.map +1 -1
- package/dist/runtime/query/iteration/index.js +20 -6
- 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/goal/index.d.ts +53 -3
- package/dist/store/goal/index.d.ts.map +1 -1
- package/dist/store/goal/index.js +245 -9
- package/dist/store/goal/index.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 +84 -6
- 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/goal/confirmation.d.ts +82 -1
- package/dist/tools/goal/confirmation.d.ts.map +1 -1
- package/dist/tools/goal/confirmation.js +153 -3
- package/dist/tools/goal/confirmation.js.map +1 -1
- package/dist/tools/goal/index.d.ts.map +1 -1
- package/dist/tools/goal/index.js +34 -3
- package/dist/tools/goal/index.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/command/index.d.ts +26 -2
- package/dist/types/command/index.d.ts.map +1 -1
- package/dist/types/command/index.js +5 -2
- package/dist/types/command/index.js.map +1 -1
- package/dist/types/common/index.d.ts +4 -2
- package/dist/types/common/index.d.ts.map +1 -1
- package/dist/types/common/index.js.map +1 -1
- package/dist/types/goal/index.d.ts +59 -0
- package/dist/types/goal/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/chat.d.ts +10 -5
- package/dist/types/provider/chat.d.ts.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 +19 -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/provider/model.d.ts +5 -0
- package/dist/types/provider/model.d.ts.map +1 -1
- package/dist/types/session/config.d.ts +2 -2
- package/dist/types/session/outcome.d.ts +5 -2
- package/dist/types/session/outcome.d.ts.map +1 -1
- package/dist/types/session/outcome.js.map +1 -1
- 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/cost.d.ts +1 -1
- package/dist/utils/cost.d.ts.map +1 -1
- package/dist/utils/cost.js +14 -5
- package/dist/utils/cost.js.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/pricing/catalogue.generated.ts +6 -0
- package/src/pricing/rates.source.json +13 -7
- package/src/prompt/coding-agent-doctrine.ts +33 -38
- package/src/provider/fallback.ts +11 -0
- package/src/provider/idle-timeout.ts +5 -0
- package/src/provider/model-window-suffix.ts +1 -0
- package/src/provider/retry.ts +5 -0
- package/src/public-runtime.ts +116 -1
- package/src/public-tools.ts +11 -0
- package/src/public-types.ts +74 -1
- package/src/registry/command/kernel-commands.ts +136 -49
- 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 +33 -9
- 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/goal/index.ts +320 -21
- 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 +108 -6
- 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/goal/confirmation.ts +227 -3
- package/src/tools/goal/index.ts +40 -4
- 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/command/index.ts +27 -2
- package/src/types/common/index.ts +4 -2
- package/src/types/goal/index.ts +61 -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/chat.ts +10 -5
- package/src/types/provider/index.ts +1 -0
- package/src/types/provider/interface.ts +21 -0
- package/src/types/provider/limits.ts +35 -0
- package/src/types/provider/model.ts +5 -0
- package/src/types/session/config.ts +2 -2
- package/src/types/session/outcome.ts +3 -1
- package/src/types/tool/index.ts +30 -2
- package/src/types/tool/presentation.ts +4 -0
- package/src/utils/cost.ts +15 -6
- 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
|
@@ -6,9 +6,11 @@ import {
|
|
|
6
6
|
GoalTransitionError,
|
|
7
7
|
type SessionGoalStore,
|
|
8
8
|
StaleGoalError,
|
|
9
|
+
goalCostText,
|
|
10
|
+
goalTokensText,
|
|
9
11
|
} from '../../store/goal/index.js'
|
|
10
12
|
import type { HostCommandDescriptor } from '../../types/command/index.js'
|
|
11
|
-
import type { GoalConfirmedBy, GoalRef, SessionGoal } from '../../types/goal/index.js'
|
|
13
|
+
import type { GoalConfirmedBy, GoalGuards, GoalRef, SessionGoal } from '../../types/goal/index.js'
|
|
12
14
|
import type { SessionId, TenantId } from '../../types/ids/index.js'
|
|
13
15
|
import type { Skill } from '../../types/skills/index.js'
|
|
14
16
|
import { isInvocableBy, skillInvocation } from '../../types/skills/index.js'
|
|
@@ -50,10 +52,21 @@ export interface GoalCommandScope {
|
|
|
50
52
|
readonly activation?: SessionGoalActivation
|
|
51
53
|
/** What a goal that does not choose is confirmed by; shown by `/goal status`. Default `model`. */
|
|
52
54
|
readonly defaultConfirmedBy?: GoalConfirmedBy
|
|
55
|
+
/**
|
|
56
|
+
* What a goal created here gets when the command does not say: the round cap
|
|
57
|
+
* and the stop rules the host applies. Absent leaves the kernel's own cap and
|
|
58
|
+
* no stop rules.
|
|
59
|
+
*/
|
|
60
|
+
readonly defaults?: GoalCommandDefaults
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export interface GoalCommandDefaults {
|
|
64
|
+
readonly maxGoalRounds?: number
|
|
65
|
+
readonly guards?: GoalGuards
|
|
53
66
|
}
|
|
54
67
|
|
|
55
68
|
const GOAL_ARGUMENTS =
|
|
56
|
-
'[status|set [--confirmed-by record|model] <objective>|<objective>|edit <objective>|pause|resume|clear]'
|
|
69
|
+
'[status|set [--confirmed-by record|model] [--token-budget <n>] [--max-rounds <n>] <objective>|<objective>|edit <objective>|pause|resume|clear]'
|
|
57
70
|
const GOAL_USAGE = `Usage: /goal ${GOAL_ARGUMENTS}`
|
|
58
71
|
|
|
59
72
|
type ParsedGoalCommand =
|
|
@@ -81,58 +94,85 @@ function parseGoalCommand(args: readonly string[]): ParsedGoalCommand {
|
|
|
81
94
|
return { kind: 'create', objective: input }
|
|
82
95
|
}
|
|
83
96
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
97
|
+
interface GoalFlags {
|
|
98
|
+
readonly confirmedBy?: GoalConfirmedBy
|
|
99
|
+
readonly tokenBudget?: number
|
|
100
|
+
readonly maxRounds?: number
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
type TakenFlags =
|
|
104
|
+
| { readonly kind: 'ok'; readonly args: readonly string[]; readonly flags: GoalFlags }
|
|
105
|
+
| { readonly kind: 'invalid'; readonly flag: string }
|
|
106
|
+
|
|
107
|
+
const GOAL_FLAG_NAMES = ['--confirmed-by', '--token-budget', '--max-rounds'] as const
|
|
108
|
+
type GoalFlagName = (typeof GOAL_FLAG_NAMES)[number]
|
|
109
|
+
|
|
110
|
+
/** `--name value` or `--name=value` at `args[i]`; the flag, its value and how many words it took. */
|
|
111
|
+
function flagAt(
|
|
112
|
+
args: readonly string[],
|
|
113
|
+
i: number,
|
|
114
|
+
): { readonly name: GoalFlagName; readonly value: string; readonly width: number } | undefined {
|
|
115
|
+
const arg = args[i] ?? ''
|
|
116
|
+
for (const name of GOAL_FLAG_NAMES) {
|
|
117
|
+
if (arg === name) return { name, value: args[i + 1] ?? '', width: 2 }
|
|
118
|
+
if (arg.startsWith(`${name}=`)) return { name, value: arg.slice(name.length + 1), width: 1 }
|
|
119
|
+
}
|
|
120
|
+
return undefined
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
function applyFlag(flags: GoalFlags, name: GoalFlagName, value: string): GoalFlags | undefined {
|
|
124
|
+
if (name === '--confirmed-by') {
|
|
125
|
+
return value === 'model' || value === 'record' ? { ...flags, confirmedBy: value } : undefined
|
|
126
|
+
}
|
|
127
|
+
if (!/^[1-9][0-9]{0,15}$/u.test(value)) return undefined
|
|
128
|
+
const n = Number(value)
|
|
129
|
+
if (!Number.isSafeInteger(n)) return undefined
|
|
130
|
+
return name === '--token-budget' ? { ...flags, tokenBudget: n } : { ...flags, maxRounds: n }
|
|
131
|
+
}
|
|
91
132
|
|
|
92
133
|
/**
|
|
93
|
-
* Takes `--confirmed-by <model|record
|
|
94
|
-
*
|
|
95
|
-
*
|
|
134
|
+
* Takes `--confirmed-by <model|record>`, `--token-budget <n>` and `--max-rounds
|
|
135
|
+
* <n>` (or `=`) out of the arguments, but only where a flag stands: at the
|
|
136
|
+
* front, right after `set`, or closing the command. In the middle the words
|
|
137
|
+
* belong to the objective, so a goal about a flag itself keeps its text.
|
|
96
138
|
*/
|
|
97
|
-
function
|
|
139
|
+
function takeGoalFlags(args: readonly string[]): TakenFlags {
|
|
98
140
|
const head: string[] = []
|
|
99
141
|
let i = 0
|
|
100
142
|
if ((args[0] ?? '').toLowerCase() === 'set') {
|
|
101
143
|
head.push(args[0] ?? '')
|
|
102
144
|
i = 1
|
|
103
145
|
}
|
|
104
|
-
let
|
|
105
|
-
for (
|
|
106
|
-
const
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
146
|
+
let flags: GoalFlags = {}
|
|
147
|
+
for (;;) {
|
|
148
|
+
const found = flagAt(args, i)
|
|
149
|
+
if (!found) break
|
|
150
|
+
const next = applyFlag(flags, found.name, found.value)
|
|
151
|
+
if (!next) return { kind: 'invalid', flag: found.name }
|
|
152
|
+
flags = next
|
|
153
|
+
i += found.width
|
|
154
|
+
}
|
|
155
|
+
let tail = args.slice(i)
|
|
156
|
+
// Flags may also close the command; in the middle their words are the objective's.
|
|
157
|
+
for (;;) {
|
|
158
|
+
const last = tail.length - 1
|
|
159
|
+
const one = flagAt(tail, last)
|
|
160
|
+
const two = last >= 1 ? flagAt(tail, last - 1) : undefined
|
|
161
|
+
if (one && one.width === 1) {
|
|
162
|
+
const next = applyFlag(flags, one.name, one.value)
|
|
163
|
+
if (!next) return { kind: 'invalid', flag: one.name }
|
|
164
|
+
flags = next
|
|
165
|
+
tail = tail.slice(0, -1)
|
|
166
|
+
} else if (two && two.width === 2) {
|
|
167
|
+
const next = applyFlag(flags, two.name, two.value)
|
|
168
|
+
if (!next) return { kind: 'invalid', flag: two.name }
|
|
169
|
+
flags = next
|
|
170
|
+
tail = tail.slice(0, -2)
|
|
113
171
|
} else {
|
|
114
172
|
break
|
|
115
173
|
}
|
|
116
|
-
if (value !== 'model' && value !== 'record') return { kind: 'invalid' }
|
|
117
|
-
found = value
|
|
118
|
-
}
|
|
119
|
-
let tail = args.slice(i)
|
|
120
|
-
// A flag may also close the command; in the middle its words are the objective's.
|
|
121
|
-
const last = tail[tail.length - 1] ?? ''
|
|
122
|
-
const beforeLast = tail[tail.length - 2] ?? ''
|
|
123
|
-
let closing: string | undefined
|
|
124
|
-
if (last.startsWith('--confirmed-by=')) {
|
|
125
|
-
closing = last.slice('--confirmed-by='.length)
|
|
126
|
-
tail = tail.slice(0, -1)
|
|
127
|
-
} else if (beforeLast === '--confirmed-by') {
|
|
128
|
-
closing = last
|
|
129
|
-
tail = tail.slice(0, -2)
|
|
130
|
-
}
|
|
131
|
-
if (closing !== undefined) {
|
|
132
|
-
if (closing !== 'model' && closing !== 'record') return { kind: 'invalid' }
|
|
133
|
-
found = closing
|
|
134
174
|
}
|
|
135
|
-
return { kind: 'ok', args: [...head, ...tail],
|
|
175
|
+
return { kind: 'ok', args: [...head, ...tail], flags }
|
|
136
176
|
}
|
|
137
177
|
|
|
138
178
|
function goalRef(goal: SessionGoal): GoalRef {
|
|
@@ -163,10 +203,22 @@ function renderGoal(
|
|
|
163
203
|
? ['Confirmed by: the record of the work']
|
|
164
204
|
: []),
|
|
165
205
|
`Automatic continuation: ${armed ? 'enabled' : 'paused'}`,
|
|
166
|
-
`Automatic turns: ${goal.roundsAdmitted}
|
|
206
|
+
`Automatic turns: ${goal.roundsAdmitted}, up to ${goal.maxGoalRounds}`,
|
|
207
|
+
`Tokens: ${goalTokensText(goal)}`,
|
|
208
|
+
`Cost: ${goalCostText(goal)}`,
|
|
209
|
+
...(goal.guards?.tokenBudget !== undefined
|
|
210
|
+
? [`Token budget: ${goal.guards.tokenBudget.toLocaleString('en-US')}`]
|
|
211
|
+
: []),
|
|
212
|
+
...(goal.guards?.checkInEvery
|
|
213
|
+
? [`Check-in: every ${goal.guards.checkInEvery} automatic turns`]
|
|
214
|
+
: []),
|
|
215
|
+
...(goal.pauseReason ? [`Paused: ${goal.pauseReason.message}`] : []),
|
|
167
216
|
...(goal.blockedReason
|
|
168
217
|
? [`Blocker: ${goal.blockedReason.code}: ${goal.blockedReason.message}`]
|
|
169
218
|
: []),
|
|
219
|
+
...(goal.missing && goal.missing.length > 0
|
|
220
|
+
? [`Still missing: ${goal.missing.join('; ')}`]
|
|
221
|
+
: []),
|
|
170
222
|
`Objective: ${goal.objective}`,
|
|
171
223
|
'',
|
|
172
224
|
`Commands: ${goalCommands(goal, armed)}`,
|
|
@@ -196,18 +248,22 @@ async function runGoalCommand(scope: GoalCommandScope | undefined, args: readonl
|
|
|
196
248
|
reason: 'Goals need a durable session. This host did not supply one for the current command.',
|
|
197
249
|
}
|
|
198
250
|
}
|
|
199
|
-
const
|
|
200
|
-
if (
|
|
251
|
+
const taken = takeGoalFlags(args)
|
|
252
|
+
if (taken.kind === 'invalid') {
|
|
201
253
|
return {
|
|
202
254
|
kind: 'refused' as const,
|
|
203
|
-
reason:
|
|
255
|
+
reason:
|
|
256
|
+
taken.flag === '--confirmed-by'
|
|
257
|
+
? `--confirmed-by takes record or model.\n${GOAL_USAGE}`
|
|
258
|
+
: `${taken.flag} takes a whole number of at least 1.\n${GOAL_USAGE}`,
|
|
204
259
|
}
|
|
205
260
|
}
|
|
206
|
-
const
|
|
207
|
-
|
|
261
|
+
const flag = taken.flags
|
|
262
|
+
const command = parseGoalCommand(taken.args)
|
|
263
|
+
if (Object.keys(flag).length > 0 && command.kind !== 'create') {
|
|
208
264
|
return {
|
|
209
265
|
kind: 'refused' as const,
|
|
210
|
-
reason:
|
|
266
|
+
reason: `Flags such as --confirmed-by, --token-budget and --max-rounds are chosen when a goal is set.\n${GOAL_USAGE}`,
|
|
211
267
|
}
|
|
212
268
|
}
|
|
213
269
|
try {
|
|
@@ -237,10 +293,18 @@ async function runGoalCommand(scope: GoalCommandScope | undefined, args: readonl
|
|
|
237
293
|
reason: `A goal is already ${current.phase}. Use /goal edit <objective> to change it or /goal clear before replacing it.`,
|
|
238
294
|
}
|
|
239
295
|
}
|
|
296
|
+
const defaults = scope.defaults
|
|
297
|
+
const guards: GoalGuards = {
|
|
298
|
+
...defaults?.guards,
|
|
299
|
+
...(flag.tokenBudget !== undefined ? { tokenBudget: flag.tokenBudget } : {}),
|
|
300
|
+
}
|
|
301
|
+
const maxGoalRounds = flag.maxRounds ?? defaults?.maxGoalRounds
|
|
240
302
|
const created = await scope.store.createGoal(
|
|
241
303
|
{
|
|
242
304
|
sessionId: scope.sessionId,
|
|
243
305
|
objective: command.objective,
|
|
306
|
+
...(maxGoalRounds !== undefined ? { maxGoalRounds } : {}),
|
|
307
|
+
...(Object.keys(guards).length > 0 ? { guards } : {}),
|
|
244
308
|
...(flag.confirmedBy !== undefined ? { confirmedBy: flag.confirmedBy } : {}),
|
|
245
309
|
},
|
|
246
310
|
scope.tenantId,
|
|
@@ -255,7 +319,14 @@ async function runGoalCommand(scope: GoalCommandScope | undefined, args: readonl
|
|
|
255
319
|
if (!current) return missingGoal('edit')
|
|
256
320
|
if (current.phase === 'complete') {
|
|
257
321
|
const replacement = await scope.store.createGoal(
|
|
258
|
-
{
|
|
322
|
+
{
|
|
323
|
+
sessionId: scope.sessionId,
|
|
324
|
+
objective: command.objective,
|
|
325
|
+
...(scope.defaults?.maxGoalRounds !== undefined
|
|
326
|
+
? { maxGoalRounds: scope.defaults.maxGoalRounds }
|
|
327
|
+
: {}),
|
|
328
|
+
...(scope.defaults?.guards ? { guards: scope.defaults.guards } : {}),
|
|
329
|
+
},
|
|
259
330
|
scope.tenantId,
|
|
260
331
|
)
|
|
261
332
|
scope.activation?.arm(replacement)
|
|
@@ -299,10 +370,20 @@ async function runGoalCommand(scope: GoalCommandScope | undefined, args: readonl
|
|
|
299
370
|
message: renderScopedGoal('Goal resumed', current, scope),
|
|
300
371
|
}
|
|
301
372
|
}
|
|
373
|
+
// A goal stopped by a limit goes on when the setting now allows more.
|
|
302
374
|
const resumed = await scope.store.resumeGoal(
|
|
303
375
|
scope.sessionId,
|
|
304
376
|
scope.tenantId,
|
|
305
377
|
goalRef(current),
|
|
378
|
+
{
|
|
379
|
+
...(scope.defaults?.maxGoalRounds !== undefined
|
|
380
|
+
? { maxGoalRounds: scope.defaults.maxGoalRounds }
|
|
381
|
+
: {}),
|
|
382
|
+
...(scope.defaults?.guards?.tokenBudget !== undefined
|
|
383
|
+
? { tokenBudget: scope.defaults.guards.tokenBudget }
|
|
384
|
+
: {}),
|
|
385
|
+
...(scope.defaults?.guards ? { guards: scope.defaults.guards } : {}),
|
|
386
|
+
},
|
|
306
387
|
)
|
|
307
388
|
scope.activation?.arm(resumed)
|
|
308
389
|
return {
|
|
@@ -346,12 +427,17 @@ export function kernelHostCommands(options: KernelCommandOptions): HostCommandDe
|
|
|
346
427
|
name: 'goal',
|
|
347
428
|
description: 'Persist or inspect a completion goal for this conversation.',
|
|
348
429
|
hint: GOAL_ARGUMENTS,
|
|
430
|
+
// Setting, editing, pausing, resuming and clearing change what the
|
|
431
|
+
// conversation does next; only reading the goal runs unasked.
|
|
432
|
+
modelRun: 'confirm',
|
|
433
|
+
modelRunReads: ['', 'status'],
|
|
349
434
|
handler: async ({ args }) => await runGoalCommand(options.goal, args),
|
|
350
435
|
},
|
|
351
436
|
{
|
|
352
437
|
name: 'skills',
|
|
353
438
|
description: 'List the skills an operator may invoke.',
|
|
354
439
|
hint: 'name, description and policy for every operator-invocable skill',
|
|
440
|
+
modelRun: 'run',
|
|
355
441
|
handler() {
|
|
356
442
|
// Operator-invocable only, which is the point of the split: the
|
|
357
443
|
// model's manifest and the operator's menu are different lists
|
|
@@ -381,6 +467,7 @@ export function kernelHostCommands(options: KernelCommandOptions): HostCommandDe
|
|
|
381
467
|
name: 'agents',
|
|
382
468
|
description: 'List the agents this turn may delegate to.',
|
|
383
469
|
hint: 'the roster, as the delegation tools see it',
|
|
470
|
+
modelRun: 'run',
|
|
384
471
|
handler() {
|
|
385
472
|
// An empty roster IS the answer here, unlike the store above: the
|
|
386
473
|
// question is "who may I call", and "nobody" is a complete and
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import type { spawn } from 'node:child_process'
|
|
2
|
+
import { closeSync, mkdirSync, openSync, writeSync } from 'node:fs'
|
|
3
|
+
import { join as joinPath } from 'node:path'
|
|
2
4
|
|
|
3
5
|
import { SANDBOX_KILL_GRACE_MS } from '../../constants/sandbox/index.js'
|
|
4
6
|
import { isSignalablePid, killTree } from '../../process/kill-tree.js'
|
|
@@ -78,7 +80,10 @@ export interface BackgroundJob {
|
|
|
78
80
|
* other job.
|
|
79
81
|
*/
|
|
80
82
|
readonly kind?: 'monitor'
|
|
81
|
-
/**
|
|
83
|
+
/**
|
|
84
|
+
* What the job is for, in the model's words. For a monitor, what it watches
|
|
85
|
+
* (shown with every event); for a command started with a label, that label.
|
|
86
|
+
*/
|
|
82
87
|
readonly description?: string
|
|
83
88
|
/** When the monitor will be stopped if the command has not ended first (epoch ms). */
|
|
84
89
|
readonly expiresAt?: number
|
|
@@ -98,8 +103,18 @@ export interface BackgroundJob {
|
|
|
98
103
|
/** The close code and reason the server ended a WebSocket connection with, if it did. */
|
|
99
104
|
readonly closeCode?: number
|
|
100
105
|
readonly closeReason?: string
|
|
106
|
+
/**
|
|
107
|
+
* The file the job's whole output is also written to (stdout and stderr, in
|
|
108
|
+
* the order they arrived), when the host gave the registry a folder for it.
|
|
109
|
+
* The in-memory tail is capped; this file is not, up to
|
|
110
|
+
* {@link JOB_OUTPUT_FILE_MAX_BYTES}.
|
|
111
|
+
*/
|
|
112
|
+
readonly outputFile?: string
|
|
101
113
|
}
|
|
102
114
|
|
|
115
|
+
/** The most one job writes to its output file; the file says so when it stops. */
|
|
116
|
+
export const JOB_OUTPUT_FILE_MAX_BYTES = 256 * 1024 * 1024
|
|
117
|
+
|
|
103
118
|
/**
|
|
104
119
|
* One thing a monitor has to say: a batch of its stdout lines, or a notice
|
|
105
120
|
* from the monitor itself (events suppressed, stopped, expired).
|
|
@@ -202,6 +217,8 @@ export interface JobProcess {
|
|
|
202
217
|
export interface StartJobParams {
|
|
203
218
|
readonly owner: string
|
|
204
219
|
readonly command: string
|
|
220
|
+
/** A short label for a command that is not a monitor; see {@link BackgroundJob.description}. */
|
|
221
|
+
readonly description?: string
|
|
205
222
|
readonly workingDirectory: string
|
|
206
223
|
readonly env?: Readonly<Record<string, string>>
|
|
207
224
|
/**
|
|
@@ -226,6 +243,13 @@ export interface StartJobParams {
|
|
|
226
243
|
* decoded the way a foreground command's are, not as a Linux guest's.
|
|
227
244
|
*/
|
|
228
245
|
readonly hostOutput?: boolean
|
|
246
|
+
/**
|
|
247
|
+
* A folder (made if it is missing, owner-only) for a file named after the
|
|
248
|
+
* job that receives everything the job writes. Absent, the output lives in
|
|
249
|
+
* memory only. A folder that cannot be made leaves the job without a file;
|
|
250
|
+
* the job still runs.
|
|
251
|
+
*/
|
|
252
|
+
readonly outputDirectory?: string
|
|
229
253
|
/**
|
|
230
254
|
* Run the command as a monitor: stdout is split into lines and delivered
|
|
231
255
|
* to `onMonitorEvent` listeners in batches, and the job is stopped at
|
|
@@ -661,6 +685,32 @@ export class BackgroundJobRegistry {
|
|
|
661
685
|
}
|
|
662
686
|
|
|
663
687
|
const id = createBackgroundJobId((candidate) => this.jobs.has(candidate))
|
|
688
|
+
// The job's output file, when the host named a folder for it. A file that
|
|
689
|
+
// cannot be opened is not a reason to refuse the job: the in-memory tail
|
|
690
|
+
// is still there, and the model is simply not told a path.
|
|
691
|
+
let outputFile: string | undefined
|
|
692
|
+
let outputFd: number | undefined
|
|
693
|
+
let outputWritten = 0
|
|
694
|
+
if (params.outputDirectory !== undefined) {
|
|
695
|
+
try {
|
|
696
|
+
mkdirSync(params.outputDirectory, { recursive: true, mode: 0o700 })
|
|
697
|
+
const file = joinPath(params.outputDirectory, `${id}.log`)
|
|
698
|
+
outputFd = openSync(file, 'a', 0o600)
|
|
699
|
+
outputFile = file
|
|
700
|
+
} catch {
|
|
701
|
+
outputFd = undefined
|
|
702
|
+
}
|
|
703
|
+
}
|
|
704
|
+
const closeOutputFile = (): void => {
|
|
705
|
+
if (outputFd === undefined) return
|
|
706
|
+
const fd = outputFd
|
|
707
|
+
outputFd = undefined
|
|
708
|
+
try {
|
|
709
|
+
closeSync(fd)
|
|
710
|
+
} catch {
|
|
711
|
+
// Nothing is left to flush: every write above was synchronous.
|
|
712
|
+
}
|
|
713
|
+
}
|
|
664
714
|
// Same scrub as the foreground path: inheritance is implicit, so the
|
|
665
715
|
// operator's provider credentials do not travel into a command nobody
|
|
666
716
|
// decided should see them. A background job outlives the call that
|
|
@@ -747,6 +797,10 @@ export class BackgroundJobRegistry {
|
|
|
747
797
|
command: params.command,
|
|
748
798
|
status: 'running',
|
|
749
799
|
startedAt,
|
|
800
|
+
...(outputFile !== undefined ? { outputFile } : {}),
|
|
801
|
+
...(!monitor && params.description !== undefined
|
|
802
|
+
? { description: params.description }
|
|
803
|
+
: {}),
|
|
750
804
|
...(monitor
|
|
751
805
|
? {
|
|
752
806
|
kind: 'monitor' as const,
|
|
@@ -772,6 +826,7 @@ export class BackgroundJobRegistry {
|
|
|
772
826
|
const finalize = (code: number | null, signal: NodeJS.Signals | null): void => {
|
|
773
827
|
if (finalized) return
|
|
774
828
|
finalized = true
|
|
829
|
+
closeOutputFile()
|
|
775
830
|
untrackAtHostExit()
|
|
776
831
|
entry.record = {
|
|
777
832
|
...entry.record,
|
|
@@ -867,6 +922,23 @@ export class BackgroundJobRegistry {
|
|
|
867
922
|
const chunk: OutputChunk = { stream, offset: entry.produced, bytes: Buffer.from(text) }
|
|
868
923
|
if (chunk.bytes.length === 0) return
|
|
869
924
|
entry.produced += chunk.bytes.length
|
|
925
|
+
if (outputFd !== undefined) {
|
|
926
|
+
try {
|
|
927
|
+
if (outputWritten + chunk.bytes.length <= JOB_OUTPUT_FILE_MAX_BYTES) {
|
|
928
|
+
writeSync(outputFd, chunk.bytes)
|
|
929
|
+
outputWritten += chunk.bytes.length
|
|
930
|
+
} else {
|
|
931
|
+
writeSync(
|
|
932
|
+
outputFd,
|
|
933
|
+
`\n[the output file stopped at ${JOB_OUTPUT_FILE_MAX_BYTES} bytes; the job kept running]\n`,
|
|
934
|
+
)
|
|
935
|
+
closeOutputFile()
|
|
936
|
+
}
|
|
937
|
+
} catch {
|
|
938
|
+
// A full disk must not take the job's live output with it.
|
|
939
|
+
closeOutputFile()
|
|
940
|
+
}
|
|
941
|
+
}
|
|
870
942
|
const line = lastLineOf(text)
|
|
871
943
|
entry.record = {
|
|
872
944
|
...entry.record,
|
|
@@ -1366,23 +1438,35 @@ export function bindOwner(
|
|
|
1366
1438
|
* reported, because the host wakes on its events.
|
|
1367
1439
|
*/
|
|
1368
1440
|
readonly onMonitorStarted?: (id: string) => void
|
|
1441
|
+
/**
|
|
1442
|
+
* Where each job's output file goes; see {@link StartJobParams.outputDirectory}.
|
|
1443
|
+
* A function, so the folder is asked for when a job starts.
|
|
1444
|
+
*/
|
|
1445
|
+
readonly outputDirectory?: string | (() => string | undefined)
|
|
1369
1446
|
} = {},
|
|
1370
1447
|
) {
|
|
1448
|
+
const outputDirectory = (): string | undefined =>
|
|
1449
|
+
typeof defaults.outputDirectory === 'function'
|
|
1450
|
+
? defaults.outputDirectory()
|
|
1451
|
+
: defaults.outputDirectory
|
|
1371
1452
|
const mine = (id: string): BackgroundJob => {
|
|
1372
1453
|
const job = registry.get(id)
|
|
1373
1454
|
if (job.owner !== owner) throw new UnknownBackgroundJobError({ id })
|
|
1374
1455
|
return job
|
|
1375
1456
|
}
|
|
1376
1457
|
const launch = (
|
|
1377
|
-
params: { command: string; workingDirectory?: string },
|
|
1458
|
+
params: { command: string; workingDirectory?: string; description?: string },
|
|
1378
1459
|
monitor?: StartJobParams['monitor'],
|
|
1379
1460
|
): BackgroundJob => {
|
|
1380
1461
|
const workingDirectory = params.workingDirectory ?? defaults.workingDirectory ?? process.cwd()
|
|
1381
1462
|
const spawnHost = defaults.spawn
|
|
1463
|
+
const jobsFolder = outputDirectory()
|
|
1382
1464
|
return registry.start({
|
|
1383
1465
|
owner,
|
|
1384
1466
|
command: params.command,
|
|
1385
1467
|
workingDirectory,
|
|
1468
|
+
...(!monitor && params.description !== undefined ? { description: params.description } : {}),
|
|
1469
|
+
...(jobsFolder !== undefined ? { outputDirectory: jobsFolder } : {}),
|
|
1386
1470
|
...(defaults.env ? { env: defaults.env } : {}),
|
|
1387
1471
|
...(spawnHost
|
|
1388
1472
|
? {
|
|
@@ -1400,7 +1484,8 @@ export function bindOwner(
|
|
|
1400
1484
|
const clampMonitorTimeout = (requested: number): number =>
|
|
1401
1485
|
Math.min(requested, defaults.monitorTimeoutCapMs ?? MONITOR_TIMEOUT_CAP_MS)
|
|
1402
1486
|
return {
|
|
1403
|
-
start: (params: { command: string; workingDirectory?: string }) =>
|
|
1487
|
+
start: (params: { command: string; workingDirectory?: string; description?: string }) =>
|
|
1488
|
+
launch(params),
|
|
1404
1489
|
// The same spawn, owner and cap as `start`, plus a deadline. The timeout
|
|
1405
1490
|
// is clamped to the host's ceiling and the clamped value is returned, so
|
|
1406
1491
|
// the number the model is told is the number that will fire.
|
|
@@ -1444,6 +1529,7 @@ export function bindOwner(
|
|
|
1444
1529
|
// running, with what it has written so far.
|
|
1445
1530
|
adopt: (params: {
|
|
1446
1531
|
command: string
|
|
1532
|
+
description?: string
|
|
1447
1533
|
child: ReturnType<typeof spawn>
|
|
1448
1534
|
workingDirectory?: string
|
|
1449
1535
|
initialOutput?: StartJobParams['initialOutput']
|
|
@@ -1451,9 +1537,13 @@ export function bindOwner(
|
|
|
1451
1537
|
registry.start({
|
|
1452
1538
|
owner,
|
|
1453
1539
|
command: params.command,
|
|
1540
|
+
...(params.description !== undefined ? { description: params.description } : {}),
|
|
1454
1541
|
workingDirectory: params.workingDirectory ?? defaults.workingDirectory ?? process.cwd(),
|
|
1455
1542
|
spawn: () => ({ child: params.child }),
|
|
1456
1543
|
hostOutput: true,
|
|
1544
|
+
...(outputDirectory() !== undefined
|
|
1545
|
+
? { outputDirectory: outputDirectory() as string }
|
|
1546
|
+
: {}),
|
|
1457
1547
|
...(params.initialOutput ? { initialOutput: params.initialOutput } : {}),
|
|
1458
1548
|
}),
|
|
1459
1549
|
// The owner is bound here, so a tool can offer its own waiting command and
|