@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
|
@@ -209,6 +209,83 @@ export function describeGoalEnding(
|
|
|
209
209
|
}
|
|
210
210
|
}
|
|
211
211
|
|
|
212
|
+
/** One requirement of a goal and what was done to check it. */
|
|
213
|
+
export interface GoalEvidence {
|
|
214
|
+
readonly requirement: string
|
|
215
|
+
readonly checked: string
|
|
216
|
+
readonly result: string
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
/** What a judge is shown when the model says a goal is complete. */
|
|
220
|
+
export interface GoalJudgeInput {
|
|
221
|
+
/** The conversation and turn the report was made in, for a host that counts the judge's spend there. */
|
|
222
|
+
readonly sessionId: string
|
|
223
|
+
readonly turnId: string
|
|
224
|
+
readonly objective: string
|
|
225
|
+
readonly evidence: readonly GoalEvidence[]
|
|
226
|
+
/** The turn's record in plain words, as {@link recordSentence} writes it. */
|
|
227
|
+
readonly outcome: string
|
|
228
|
+
/** The model's last message of the turn. */
|
|
229
|
+
readonly finalMessage: string
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
/** What a judge found: whether the goal is met and, when it is not, what is missing. */
|
|
233
|
+
export interface GoalJudgement {
|
|
234
|
+
readonly met: boolean
|
|
235
|
+
readonly missing: readonly string[]
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
/**
|
|
239
|
+
* Judges one completion report. Resolves `undefined` when it could not judge
|
|
240
|
+
* (no model, an error, a timeout, a reply that was not an answer); the goal
|
|
241
|
+
* then takes the path it takes without a judge, and is never blocked by it.
|
|
242
|
+
*/
|
|
243
|
+
export type GoalJudge = (input: GoalJudgeInput) => Promise<GoalJudgement | undefined>
|
|
244
|
+
|
|
245
|
+
/** Every field a completion report's evidence entries must carry, in the words the model reads. */
|
|
246
|
+
export const GOAL_AUDIT_RUBRIC = [
|
|
247
|
+
'Before reporting a goal complete: restate each requirement in the objective, check each one against the current state (open the file, run the check, read the output), and list them as evidence with what you checked and what you saw.',
|
|
248
|
+
'Intent, earlier work or a plausible-looking answer is not proof. If any evidence is weak or missing, keep working instead of reporting.',
|
|
249
|
+
].join(' ')
|
|
250
|
+
|
|
251
|
+
/** Turns the model's `evidence` input into entries, or says what is wrong with it. */
|
|
252
|
+
export function parseGoalEvidence(
|
|
253
|
+
value: unknown,
|
|
254
|
+
):
|
|
255
|
+
| { readonly ok: true; readonly evidence: readonly GoalEvidence[] }
|
|
256
|
+
| { readonly ok: false; readonly problem: string } {
|
|
257
|
+
if (!Array.isArray(value) || value.length === 0) {
|
|
258
|
+
return {
|
|
259
|
+
ok: false,
|
|
260
|
+
problem: 'Reporting a goal complete needs evidence: a list with one entry per requirement.',
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
const evidence: GoalEvidence[] = []
|
|
264
|
+
for (const entry of value) {
|
|
265
|
+
const item = entry as Partial<Record<keyof GoalEvidence, unknown>> | null
|
|
266
|
+
const text = (field: keyof GoalEvidence): string =>
|
|
267
|
+
typeof item?.[field] === 'string' ? (item[field] as string).trim() : ''
|
|
268
|
+
const requirement = text('requirement')
|
|
269
|
+
const checked = text('checked')
|
|
270
|
+
const result = text('result')
|
|
271
|
+
if (requirement === '' || checked === '' || result === '') {
|
|
272
|
+
return {
|
|
273
|
+
ok: false,
|
|
274
|
+
problem: 'Every evidence entry needs a requirement, what was checked, and the result.',
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
evidence.push({ requirement, checked, result })
|
|
278
|
+
}
|
|
279
|
+
return { ok: true, evidence }
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
function sameRequirement(a: string, b: string): boolean {
|
|
283
|
+
const fold = (text: string): string => text.toLowerCase().replace(/\s+/gu, ' ').trim()
|
|
284
|
+
const x = fold(a)
|
|
285
|
+
const y = fold(b)
|
|
286
|
+
return x === y || x.includes(y) || y.includes(x)
|
|
287
|
+
}
|
|
288
|
+
|
|
212
289
|
export interface GoalConfirmationOptions {
|
|
213
290
|
readonly store: SessionGoalStore
|
|
214
291
|
/** The same resolver the goal tools use: the authority of the turn, or none. */
|
|
@@ -217,13 +294,30 @@ export interface GoalConfirmationOptions {
|
|
|
217
294
|
readonly defaultConfirmedBy?: GoalConfirmedBy
|
|
218
295
|
/** Refusals a goal may be given. Default {@link DEFAULT_GOAL_REFUSALS}. */
|
|
219
296
|
readonly maxRefusals?: number
|
|
297
|
+
/**
|
|
298
|
+
* Make `update_goal` with `complete` need evidence, and hold the first such
|
|
299
|
+
* report of a goal once so the model audits itself. Default off: the report
|
|
300
|
+
* ends the goal, as it always has.
|
|
301
|
+
*/
|
|
302
|
+
readonly requireEvidence?: boolean
|
|
303
|
+
/** Checks a completion report when {@link judgeActive} says so. */
|
|
304
|
+
readonly judge?: GoalJudge
|
|
305
|
+
/** Whether a judge is in use for the goal now. Default: a judge was given. */
|
|
306
|
+
readonly judgeActive?: () => boolean
|
|
220
307
|
}
|
|
221
308
|
|
|
222
309
|
interface Claim {
|
|
223
310
|
readonly statement: GoalStatement
|
|
224
311
|
readonly reason?: string
|
|
312
|
+
/** Present on a report of a goal the model confirms, with its evidence. */
|
|
313
|
+
readonly evidence?: readonly GoalEvidence[]
|
|
225
314
|
}
|
|
226
315
|
|
|
316
|
+
/** What to do with a completion report when no judge decides it. */
|
|
317
|
+
export type SelfAuditDecision =
|
|
318
|
+
| { readonly kind: 'accept' }
|
|
319
|
+
| { readonly kind: 'hold'; readonly note: string }
|
|
320
|
+
|
|
227
321
|
/**
|
|
228
322
|
* Holds, for one session, what the model reported this turn, how many times a
|
|
229
323
|
* goal was sent back, and whether an earlier round of it changed files. All of
|
|
@@ -235,9 +329,64 @@ export class GoalConfirmation {
|
|
|
235
329
|
private readonly refusals = new Map<string, number>()
|
|
236
330
|
private readonly changed = new Set<string>()
|
|
237
331
|
private readonly endings = new Map<string, GoalEndingReport>()
|
|
332
|
+
/** Requirements listed in the first completion report of a goal, which held it once. */
|
|
333
|
+
private readonly audited = new Map<string, readonly string[]>()
|
|
334
|
+
private readonly judged = new Map<string, number>()
|
|
238
335
|
|
|
239
336
|
constructor(private readonly options: GoalConfirmationOptions) {}
|
|
240
337
|
|
|
338
|
+
/** Whether `update_goal` with `complete` needs evidence. */
|
|
339
|
+
get requiresEvidence(): boolean {
|
|
340
|
+
return this.options.requireEvidence === true
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
/** Whether a judge checks the completion reports of a goal the model confirms. */
|
|
344
|
+
get judging(): boolean {
|
|
345
|
+
return (
|
|
346
|
+
this.options.judge !== undefined &&
|
|
347
|
+
(this.options.judgeActive === undefined || this.options.judgeActive())
|
|
348
|
+
)
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
/**
|
|
352
|
+
* A completion report made while no judge decides it. The first report of a
|
|
353
|
+
* goal is handed back once with the rubric; the next is accepted when its
|
|
354
|
+
* evidence covers each requirement the first one listed. No model is asked.
|
|
355
|
+
*/
|
|
356
|
+
selfAudit(goalId: string, evidence: readonly GoalEvidence[]): SelfAuditDecision {
|
|
357
|
+
const listed = this.audited.get(goalId)
|
|
358
|
+
if (listed === undefined) {
|
|
359
|
+
this.audited.set(
|
|
360
|
+
goalId,
|
|
361
|
+
evidence.map((entry) => entry.requirement),
|
|
362
|
+
)
|
|
363
|
+
return {
|
|
364
|
+
kind: 'hold',
|
|
365
|
+
note: `Held once for an audit. ${GOAL_AUDIT_RUBRIC} Report complete again with the evidence once every requirement holds.`,
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
const uncovered = listed.filter(
|
|
369
|
+
(requirement) => !evidence.some((entry) => sameRequirement(entry.requirement, requirement)),
|
|
370
|
+
)
|
|
371
|
+
if (uncovered.length > 0) {
|
|
372
|
+
return {
|
|
373
|
+
kind: 'hold',
|
|
374
|
+
note: `The evidence does not cover: ${uncovered.join('; ')}. Report complete again with an entry for each requirement you listed before.`,
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
this.audited.delete(goalId)
|
|
378
|
+
return { kind: 'accept' }
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
/** Keeps a model-confirmed report until the model finishes its answer and a judge can read it. */
|
|
382
|
+
claimEvidence(goalId: string, evidence: readonly GoalEvidence[], reason?: string): void {
|
|
383
|
+
this.claims.set(goalId, {
|
|
384
|
+
statement: 'met',
|
|
385
|
+
evidence,
|
|
386
|
+
...(reason !== undefined ? { reason } : {}),
|
|
387
|
+
})
|
|
388
|
+
}
|
|
389
|
+
|
|
241
390
|
/** What decides this goal: its own choice, else the host's setting, else the model. */
|
|
242
391
|
confirmedByFor(goal: Pick<SessionGoal, 'confirmedBy'>): GoalConfirmedBy {
|
|
243
392
|
return goal.confirmedBy ?? this.options.defaultConfirmedBy ?? 'model'
|
|
@@ -299,9 +448,79 @@ export class GoalConfirmation {
|
|
|
299
448
|
this.claims.delete(goal.id)
|
|
300
449
|
this.refusals.delete(goal.id)
|
|
301
450
|
this.changed.delete(goal.id)
|
|
451
|
+
this.audited.delete(goal.id)
|
|
452
|
+
this.judged.delete(goal.id)
|
|
302
453
|
return report
|
|
303
454
|
}
|
|
304
455
|
|
|
456
|
+
/**
|
|
457
|
+
* A report of a goal the model confirms, read when the model finishes its
|
|
458
|
+
* answer: the judge decides it. Met ends the goal. Not met keeps it active
|
|
459
|
+
* and sends the missing list back while refusals remain; past the bound the
|
|
460
|
+
* turn ends and the list leads the next round. A judge that cannot judge
|
|
461
|
+
* leaves the decision to the self-audit.
|
|
462
|
+
*/
|
|
463
|
+
private async judgeClaim(
|
|
464
|
+
authority: GoalRoundAuthority,
|
|
465
|
+
goal: SessionGoal,
|
|
466
|
+
turnId: string,
|
|
467
|
+
read: () => Promise<TurnOutcome | undefined>,
|
|
468
|
+
finalMessage: string,
|
|
469
|
+
): Promise<string | undefined> {
|
|
470
|
+
const claim = this.claims.get(goal.id)
|
|
471
|
+
this.claims.delete(goal.id)
|
|
472
|
+
if (!claim?.evidence) return undefined
|
|
473
|
+
const { store } = this.options
|
|
474
|
+
const ref = { id: authority.id, revision: authority.revision }
|
|
475
|
+
const evidence = claim.evidence
|
|
476
|
+
let judgement: GoalJudgement | undefined
|
|
477
|
+
if (this.options.judge !== undefined) {
|
|
478
|
+
try {
|
|
479
|
+
judgement = await this.options.judge({
|
|
480
|
+
sessionId: String(authority.sessionId),
|
|
481
|
+
turnId,
|
|
482
|
+
objective: goal.objective,
|
|
483
|
+
evidence,
|
|
484
|
+
outcome: recordSentence(await read()),
|
|
485
|
+
finalMessage,
|
|
486
|
+
})
|
|
487
|
+
} catch {
|
|
488
|
+
judgement = undefined
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
const accept = async (): Promise<undefined> => {
|
|
492
|
+
// What an earlier check found missing is moot once the goal is met.
|
|
493
|
+
if ((this.judged.get(goal.id) ?? 0) > 0) {
|
|
494
|
+
await store.recordRound?.(authority.sessionId, authority.tenantId, authority.id, {
|
|
495
|
+
progress: 'unknown',
|
|
496
|
+
missing: [],
|
|
497
|
+
})
|
|
498
|
+
}
|
|
499
|
+
try {
|
|
500
|
+
await store.completeGoal(authority.sessionId, authority.tenantId, ref)
|
|
501
|
+
} catch (error) {
|
|
502
|
+
if (!(error instanceof StaleGoalError)) throw error
|
|
503
|
+
}
|
|
504
|
+
this.judged.delete(goal.id)
|
|
505
|
+
return undefined
|
|
506
|
+
}
|
|
507
|
+
if (judgement === undefined) {
|
|
508
|
+
const decision = this.selfAudit(goal.id, evidence)
|
|
509
|
+
return decision.kind === 'accept' ? await accept() : decision.note
|
|
510
|
+
}
|
|
511
|
+
if (judgement.met) return await accept()
|
|
512
|
+
const missing = judgement.missing.map((line) => line.trim()).filter((line) => line !== '')
|
|
513
|
+
const asked = this.judged.get(goal.id) ?? 0
|
|
514
|
+
this.judged.set(goal.id, asked + 1)
|
|
515
|
+
const list = missing.length > 0 ? missing : ['the evidence does not show the goal is met']
|
|
516
|
+
await store.recordRound?.(authority.sessionId, authority.tenantId, authority.id, {
|
|
517
|
+
progress: 'unknown',
|
|
518
|
+
missing: list,
|
|
519
|
+
})
|
|
520
|
+
if (asked >= this.maxRefusals) return undefined
|
|
521
|
+
return `The check of your completion report found the goal is not met yet. Missing: ${list.join('; ')}. Keep working on these, then report complete again with updated evidence.`
|
|
522
|
+
}
|
|
523
|
+
|
|
305
524
|
/** Drop a report that was never answered for, when its round ends without the turn finishing an answer. */
|
|
306
525
|
forget(goalId: string): void {
|
|
307
526
|
this.claims.delete(goalId)
|
|
@@ -314,13 +533,18 @@ export class GoalConfirmation {
|
|
|
314
533
|
*/
|
|
315
534
|
beforeEnd(
|
|
316
535
|
turnId: string,
|
|
317
|
-
): (
|
|
318
|
-
|
|
536
|
+
): (
|
|
537
|
+
read: () => Promise<TurnOutcome | undefined>,
|
|
538
|
+
context?: { readonly finalMessage?: string },
|
|
539
|
+
) => Promise<string | undefined> {
|
|
540
|
+
return async (read, context) => {
|
|
319
541
|
const authority = this.options.resolveAuthority(turnId)
|
|
320
542
|
if (!authority) return undefined
|
|
321
543
|
const goal = await this.options.store.getGoal(authority.sessionId, authority.tenantId)
|
|
322
544
|
if (!goal || goal.id !== authority.id || goal.phase !== 'active') return undefined
|
|
323
|
-
if (this.confirmedByFor(goal) !== 'record')
|
|
545
|
+
if (this.confirmedByFor(goal) !== 'record') {
|
|
546
|
+
return await this.judgeClaim(authority, goal, turnId, read, context?.finalMessage ?? '')
|
|
547
|
+
}
|
|
324
548
|
|
|
325
549
|
const record = await read()
|
|
326
550
|
const claim = this.claims.get(goal.id)
|
package/src/tools/goal/index.ts
CHANGED
|
@@ -5,7 +5,12 @@ import type { GoalRoundAuthority, SessionGoal } from '../../types/goal/index.js'
|
|
|
5
5
|
import type { TurnId } from '../../types/ids/index.js'
|
|
6
6
|
import type { ToolDefinition } from '../../types/tool/index.js'
|
|
7
7
|
import { defineTool } from '../defineTool.js'
|
|
8
|
-
import {
|
|
8
|
+
import {
|
|
9
|
+
GOAL_AUDIT_RUBRIC,
|
|
10
|
+
type GoalConfirmation,
|
|
11
|
+
NO_CHECK_REASON_CODE,
|
|
12
|
+
parseGoalEvidence,
|
|
13
|
+
} from './confirmation.js'
|
|
9
14
|
|
|
10
15
|
export const SESSION_GOAL_TOOL_NAMES = ['get_goal', 'update_goal'] as const
|
|
11
16
|
export const MIN_GOAL_BLOCK_ROUND = 3
|
|
@@ -83,6 +88,12 @@ export function buildSessionGoalTools(
|
|
|
83
88
|
round: authority.round,
|
|
84
89
|
maxGoalRounds: goal.maxGoalRounds,
|
|
85
90
|
roundsAdmitted: goal.roundsAdmitted,
|
|
91
|
+
tokensUsed: goal.tokensUsed ?? 0,
|
|
92
|
+
costUsd: goal.costUsd ?? 0,
|
|
93
|
+
...(goal.guards?.tokenBudget !== undefined
|
|
94
|
+
? { tokenBudget: goal.guards.tokenBudget }
|
|
95
|
+
: {}),
|
|
96
|
+
...(authority.wrapUp ? { wrapUp: true } : {}),
|
|
86
97
|
}),
|
|
87
98
|
data: goal,
|
|
88
99
|
}
|
|
@@ -91,8 +102,7 @@ export function buildSessionGoalTools(
|
|
|
91
102
|
|
|
92
103
|
const updateGoal = defineTool({
|
|
93
104
|
name: 'update_goal',
|
|
94
|
-
description:
|
|
95
|
-
'Mark this admitted goal complete, or blocked after at least three admitted rounds. This does not end the turn; explain the final state to the operator afterward.',
|
|
105
|
+
description: `Mark this admitted goal complete, or blocked after at least three admitted rounds. Completion takes evidence: one entry per requirement of the objective, with what you checked and the result. ${GOAL_AUDIT_RUBRIC} This does not end the turn; explain the final state to the operator afterward.`,
|
|
96
106
|
inputSchema: z.object({
|
|
97
107
|
status: z.enum(['complete', 'blocked']),
|
|
98
108
|
reasonCode: z
|
|
@@ -100,13 +110,23 @@ export function buildSessionGoalTools(
|
|
|
100
110
|
.optional()
|
|
101
111
|
.describe('Lower-kebab-case reason code; required when status is blocked.'),
|
|
102
112
|
reason: z.string().optional().describe('Operator-readable reason; required when blocked.'),
|
|
113
|
+
evidence: z
|
|
114
|
+
.array(
|
|
115
|
+
z.object({
|
|
116
|
+
requirement: z.string().describe('One requirement of the objective, restated.'),
|
|
117
|
+
checked: z.string().describe('What you did to check it against the current state.'),
|
|
118
|
+
result: z.string().describe('What the check showed.'),
|
|
119
|
+
}),
|
|
120
|
+
)
|
|
121
|
+
.optional()
|
|
122
|
+
.describe('Required when status is complete: one entry per requirement.'),
|
|
103
123
|
}),
|
|
104
124
|
category: 'custom',
|
|
105
125
|
permissions: [],
|
|
106
126
|
readOnly: false,
|
|
107
127
|
destructive: false,
|
|
108
128
|
concurrencySafe: false,
|
|
109
|
-
async execute({ status, reasonCode, reason }, context) {
|
|
129
|
+
async execute({ status, reasonCode, reason, evidence }, context) {
|
|
110
130
|
const authority = authorityFor(resolveAuthority, context.turnId)
|
|
111
131
|
const current = await currentGoal(store, authority)
|
|
112
132
|
const ref = { id: authority.id, revision: authority.revision }
|
|
@@ -145,6 +165,22 @@ export function buildSessionGoalTools(
|
|
|
145
165
|
}
|
|
146
166
|
}
|
|
147
167
|
if (status === 'complete') {
|
|
168
|
+
if (confirmation?.requiresEvidence) {
|
|
169
|
+
const parsed = parseGoalEvidence(evidence)
|
|
170
|
+
if (!parsed.ok) throw new TypeError(`${parsed.problem} ${GOAL_AUDIT_RUBRIC}`)
|
|
171
|
+
if (confirmation.judging) {
|
|
172
|
+
// A judge reads the report together with the final answer, so the
|
|
173
|
+
// report is held until the model has given it.
|
|
174
|
+
confirmation.claimEvidence(authority.id, parsed.evidence, reason)
|
|
175
|
+
return {
|
|
176
|
+
success: true,
|
|
177
|
+
output:
|
|
178
|
+
'Completion reported. The evidence is checked when you finish your answer: give your final answer now, and if something is found missing you will be told what.',
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
const decision = confirmation.selfAudit(authority.id, parsed.evidence)
|
|
182
|
+
if (decision.kind === 'hold') throw new Error(decision.note)
|
|
183
|
+
}
|
|
148
184
|
const goal = await store.completeGoal(authority.sessionId, authority.tenantId, ref)
|
|
149
185
|
return { success: true, output: 'Goal marked complete.', data: goal }
|
|
150
186
|
}
|
|
@@ -2,3 +2,14 @@ export { buildScheduleTools, SCHEDULE_TOOL_NAME } from './schedule-tool.js'
|
|
|
2
2
|
export { buildSessionLoopTools, SESSION_LOOP_TOOL_NAME } from './loop-tool.js'
|
|
3
3
|
export { revealHiddenCharacters, scanSchedulePrompt } from './prompt-scan.js'
|
|
4
4
|
export type * from './types.js'
|
|
5
|
+
export {
|
|
6
|
+
buildSessionTimerTools,
|
|
7
|
+
buildWakeUpTool,
|
|
8
|
+
clampWakeUpDelay,
|
|
9
|
+
TIMER_CANCEL_TOOL_NAME,
|
|
10
|
+
TIMER_LIST_TOOL_NAME,
|
|
11
|
+
TIMER_SET_TOOL_NAME,
|
|
12
|
+
WAKE_UP_MAX_SECONDS,
|
|
13
|
+
WAKE_UP_MIN_SECONDS,
|
|
14
|
+
WAKE_UP_TOOL_NAME,
|
|
15
|
+
} from './timer-tools.js'
|
|
@@ -13,7 +13,9 @@ const inputSchema = z.object({
|
|
|
13
13
|
interval: z
|
|
14
14
|
.string()
|
|
15
15
|
.optional()
|
|
16
|
-
.describe(
|
|
16
|
+
.describe(
|
|
17
|
+
'create: how often, e.g. "5m", "1h", or a five-field cron expression; leave out to pace the loop yourself with wake_up',
|
|
18
|
+
),
|
|
17
19
|
prompt: z.string().min(1).max(4_000).optional().describe('create: the message to send each time'),
|
|
18
20
|
id: z.string().optional().describe('delete: the loop id, or "all"'),
|
|
19
21
|
})
|
|
@@ -32,7 +34,7 @@ export function buildSessionLoopTools(host: SessionLoopHost): ToolDefinition[] {
|
|
|
32
34
|
defineTool({
|
|
33
35
|
name: SESSION_LOOP_TOOL_NAME,
|
|
34
36
|
description:
|
|
35
|
-
"Re-send a prompt to this conversation on an interval while the session stays open (between turns only; stops when the session closes; expires after 7 days). Use only when the user asks for something to repeat. Minimum interval one minute. Returns the new loop's id on create, this session's loops on list, and how many loops were stopped on delete.",
|
|
37
|
+
"Re-send a prompt to this conversation on an interval while the session stays open (between turns only; stops when the session closes; expires after 7 days). Use only when the user asks for something to repeat. Minimum interval one minute. Without an interval the loop is self-paced: you get the first tick at once and choose each next wake-up with wake_up. Returns the new loop's id on create, this session's loops on list, and how many loops were stopped on delete.",
|
|
36
38
|
inputSchema,
|
|
37
39
|
category: 'custom',
|
|
38
40
|
permissions: [],
|
|
@@ -60,18 +62,20 @@ export function buildSessionLoopTools(host: SessionLoopHost): ToolDefinition[] {
|
|
|
60
62
|
? { success: false, output: '', error: `No loop has id "${input.id}".` }
|
|
61
63
|
: { success: true, output: `Stopped ${stopped} loop${stopped === 1 ? '' : 's'}.` }
|
|
62
64
|
}
|
|
63
|
-
if (!input.
|
|
64
|
-
return { success: false, output: '', error: 'create needs
|
|
65
|
+
if (!input.prompt) {
|
|
66
|
+
return { success: false, output: '', error: 'create needs a prompt.' }
|
|
65
67
|
}
|
|
66
68
|
try {
|
|
67
69
|
const loop = await host.create({
|
|
68
|
-
interval: input.interval,
|
|
70
|
+
...(input.interval ? { interval: input.interval } : {}),
|
|
69
71
|
prompt: input.prompt,
|
|
70
72
|
createdBy: 'model',
|
|
71
73
|
})
|
|
72
74
|
return {
|
|
73
75
|
success: true,
|
|
74
|
-
output:
|
|
76
|
+
output: loop.paced
|
|
77
|
+
? `Loop ${loop.id} created, self-paced. The first tick arrives when this turn ends; each tick, call wake_up to choose the next one. The operator can stop it with /loop stop ${loop.id}.`
|
|
78
|
+
: `Loop ${loop.id} created: ${loop.schedule}. The operator can stop it with /loop stop ${loop.id}.`,
|
|
75
79
|
data: { id: loop.id },
|
|
76
80
|
}
|
|
77
81
|
} catch (error) {
|
|
@@ -72,7 +72,7 @@ export function presentLoopCall(input: {
|
|
|
72
72
|
}): ToolCallView {
|
|
73
73
|
switch (input.action) {
|
|
74
74
|
case 'create':
|
|
75
|
-
return activity(`Loop ${oneLine(input.interval)} · ${oneLine(input.prompt)}`)
|
|
75
|
+
return activity(`Loop ${oneLine(input.interval) || 'self-paced'} · ${oneLine(input.prompt)}`)
|
|
76
76
|
case 'list':
|
|
77
77
|
return activity('List loops')
|
|
78
78
|
case 'delete':
|