@namzu/sdk 38.1.0 → 39.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 +758 -0
- package/dist/advisory/executor.d.ts +10 -1
- package/dist/advisory/executor.d.ts.map +1 -1
- package/dist/advisory/executor.js +5 -26
- package/dist/advisory/executor.js.map +1 -1
- package/dist/advisory/history.d.ts +9 -0
- package/dist/advisory/history.d.ts.map +1 -0
- package/dist/advisory/history.js +120 -0
- package/dist/advisory/history.js.map +1 -0
- package/dist/advisory/index.d.ts +1 -1
- package/dist/advisory/index.d.ts.map +1 -1
- package/dist/advisory/index.js.map +1 -1
- package/dist/agents/ReactiveAgent.d.ts.map +1 -1
- package/dist/agents/ReactiveAgent.js +3 -0
- package/dist/agents/ReactiveAgent.js.map +1 -1
- package/dist/agents/runAgent.d.ts +10 -0
- package/dist/agents/runAgent.d.ts.map +1 -1
- package/dist/agents/runAgent.js +3 -0
- package/dist/agents/runAgent.js.map +1 -1
- package/dist/compaction/manual.d.ts +6 -0
- package/dist/compaction/manual.d.ts.map +1 -1
- package/dist/compaction/manual.js +21 -2
- package/dist/compaction/manual.js.map +1 -1
- package/dist/compaction/summary.d.ts.map +1 -1
- package/dist/compaction/summary.js +4 -1
- package/dist/compaction/summary.js.map +1 -1
- package/dist/config/runtime.js +2 -2
- package/dist/config/runtime.js.map +1 -1
- package/dist/contracts/schemas.js +1 -1
- package/dist/contracts/schemas.js.map +1 -1
- package/dist/eval/harness-protection.d.ts +18 -0
- package/dist/eval/harness-protection.d.ts.map +1 -0
- package/dist/eval/harness-protection.js +58 -0
- package/dist/eval/harness-protection.js.map +1 -0
- package/dist/eval/harness-verification.d.ts +6 -1
- package/dist/eval/harness-verification.d.ts.map +1 -1
- package/dist/eval/harness-verification.js +19 -2
- package/dist/eval/harness-verification.js.map +1 -1
- package/dist/eval/index.d.ts +1 -0
- package/dist/eval/index.d.ts.map +1 -1
- package/dist/eval/index.js.map +1 -1
- package/dist/manager/resident/activity.d.ts +50 -0
- package/dist/manager/resident/activity.d.ts.map +1 -0
- package/dist/manager/resident/activity.js +125 -0
- package/dist/manager/resident/activity.js.map +1 -0
- package/dist/manager/resident/agenda.d.ts +137 -0
- package/dist/manager/resident/agenda.d.ts.map +1 -0
- package/dist/manager/resident/agenda.js +586 -0
- package/dist/manager/resident/agenda.js.map +1 -0
- package/dist/manager/resident/consumption.d.ts +104 -0
- package/dist/manager/resident/consumption.d.ts.map +1 -0
- package/dist/manager/resident/consumption.js +233 -0
- package/dist/manager/resident/consumption.js.map +1 -0
- package/dist/manager/resident/delivery-window.d.ts +22 -0
- package/dist/manager/resident/delivery-window.d.ts.map +1 -0
- package/dist/manager/resident/delivery-window.js +78 -0
- package/dist/manager/resident/delivery-window.js.map +1 -0
- package/dist/manager/resident/evidence-recall.d.ts +24 -0
- package/dist/manager/resident/evidence-recall.d.ts.map +1 -0
- package/dist/manager/resident/evidence-recall.js +295 -0
- package/dist/manager/resident/evidence-recall.js.map +1 -0
- package/dist/manager/resident/history-disk.d.ts +10 -0
- package/dist/manager/resident/history-disk.d.ts.map +1 -0
- package/dist/manager/resident/history-disk.js +50 -0
- package/dist/manager/resident/history-disk.js.map +1 -0
- package/dist/manager/resident/history.d.ts +79 -0
- package/dist/manager/resident/history.d.ts.map +1 -0
- package/dist/manager/resident/history.js +203 -0
- package/dist/manager/resident/history.js.map +1 -0
- package/dist/manager/resident/host.d.ts +78 -0
- package/dist/manager/resident/host.d.ts.map +1 -0
- package/dist/manager/resident/host.js +252 -0
- package/dist/manager/resident/host.js.map +1 -0
- package/dist/manager/resident/initiative.d.ts +111 -0
- package/dist/manager/resident/initiative.d.ts.map +1 -0
- package/dist/manager/resident/initiative.js +129 -0
- package/dist/manager/resident/initiative.js.map +1 -0
- package/dist/manager/resident/learning-cycle.d.ts +131 -0
- package/dist/manager/resident/learning-cycle.d.ts.map +1 -0
- package/dist/manager/resident/learning-cycle.js +306 -0
- package/dist/manager/resident/learning-cycle.js.map +1 -0
- package/dist/manager/resident/learning-observation.d.ts +80 -0
- package/dist/manager/resident/learning-observation.d.ts.map +1 -0
- package/dist/manager/resident/learning-observation.js +22 -0
- package/dist/manager/resident/learning-observation.js.map +1 -0
- package/dist/manager/resident/learning-store.d.ts +106 -0
- package/dist/manager/resident/learning-store.d.ts.map +1 -0
- package/dist/manager/resident/learning-store.js +598 -0
- package/dist/manager/resident/learning-store.js.map +1 -0
- package/dist/manager/resident/learning.d.ts +726 -0
- package/dist/manager/resident/learning.d.ts.map +1 -0
- package/dist/manager/resident/learning.js +353 -0
- package/dist/manager/resident/learning.js.map +1 -0
- package/dist/manager/resident/loop.d.ts +31 -0
- package/dist/manager/resident/loop.d.ts.map +1 -0
- package/dist/manager/resident/loop.js +69 -0
- package/dist/manager/resident/loop.js.map +1 -0
- package/dist/manager/resident/outbox.d.ts +180 -0
- package/dist/manager/resident/outbox.d.ts.map +1 -0
- package/dist/manager/resident/outbox.js +214 -0
- package/dist/manager/resident/outbox.js.map +1 -0
- package/dist/manager/resident/proposal.d.ts +91 -0
- package/dist/manager/resident/proposal.d.ts.map +1 -0
- package/dist/manager/resident/proposal.js +75 -0
- package/dist/manager/resident/proposal.js.map +1 -0
- package/dist/manager/resident/store.d.ts +182 -0
- package/dist/manager/resident/store.d.ts.map +1 -0
- package/dist/manager/resident/store.js +199 -0
- package/dist/manager/resident/store.js.map +1 -0
- package/dist/manager/resident/tool-evidence.d.ts +71 -0
- package/dist/manager/resident/tool-evidence.d.ts.map +1 -0
- package/dist/manager/resident/tool-evidence.js +285 -0
- package/dist/manager/resident/tool-evidence.js.map +1 -0
- package/dist/manager/run/persistence.d.ts.map +1 -1
- package/dist/manager/run/persistence.js +6 -0
- package/dist/manager/run/persistence.js.map +1 -1
- package/dist/plugin/loader.d.ts.map +1 -1
- package/dist/plugin/loader.js +5 -3
- package/dist/plugin/loader.js.map +1 -1
- package/dist/prompt/coding-agent-doctrine.d.ts +1 -1
- package/dist/prompt/coding-agent-doctrine.d.ts.map +1 -1
- package/dist/prompt/coding-agent-doctrine.js +2 -0
- package/dist/prompt/coding-agent-doctrine.js.map +1 -1
- package/dist/prompt/contributions.d.ts +5 -2
- package/dist/prompt/contributions.d.ts.map +1 -1
- package/dist/prompt/contributions.js.map +1 -1
- package/dist/prompt/index.d.ts +4 -0
- package/dist/prompt/index.d.ts.map +1 -1
- package/dist/prompt/index.js +2 -0
- package/dist/prompt/index.js.map +1 -1
- package/dist/prompt/resident-learning.d.ts +19 -0
- package/dist/prompt/resident-learning.d.ts.map +1 -0
- package/dist/prompt/resident-learning.js +125 -0
- package/dist/prompt/resident-learning.js.map +1 -0
- package/dist/prompt/resident-step.d.ts +36 -0
- package/dist/prompt/resident-step.d.ts.map +1 -0
- package/dist/prompt/resident-step.js +135 -0
- package/dist/prompt/resident-step.js.map +1 -0
- package/dist/provider/collect-chat-completion.d.ts +2 -1
- package/dist/provider/collect-chat-completion.d.ts.map +1 -1
- package/dist/provider/collect-chat-completion.js +7 -6
- package/dist/provider/collect-chat-completion.js.map +1 -1
- package/dist/provider/fallback.d.ts.map +1 -1
- package/dist/provider/fallback.js +2 -1
- package/dist/provider/fallback.js.map +1 -1
- package/dist/provider/stream-text.d.ts +16 -0
- package/dist/provider/stream-text.d.ts.map +1 -0
- package/dist/provider/stream-text.js +51 -0
- package/dist/provider/stream-text.js.map +1 -0
- package/dist/public-runtime.d.ts +22 -3
- package/dist/public-runtime.d.ts.map +1 -1
- package/dist/public-runtime.js +21 -3
- package/dist/public-runtime.js.map +1 -1
- package/dist/public-tools.d.ts +2 -0
- package/dist/public-tools.d.ts.map +1 -1
- package/dist/public-tools.js +2 -0
- package/dist/public-tools.js.map +1 -1
- package/dist/public-types.d.ts +29 -3
- package/dist/public-types.d.ts.map +1 -1
- package/dist/registry/index.d.ts +1 -1
- package/dist/registry/index.d.ts.map +1 -1
- package/dist/registry/tool/execute.d.ts +18 -0
- package/dist/registry/tool/execute.d.ts.map +1 -1
- package/dist/registry/tool/execute.js +43 -6
- package/dist/registry/tool/execute.js.map +1 -1
- package/dist/run/LimitChecker.js +3 -3
- package/dist/run/LimitChecker.js.map +1 -1
- package/dist/run/evidence-query.d.ts +41 -0
- package/dist/run/evidence-query.d.ts.map +1 -0
- package/dist/run/evidence-query.js +270 -0
- package/dist/run/evidence-query.js.map +1 -0
- package/dist/run/evidence-recall.d.ts +99 -0
- package/dist/run/evidence-recall.d.ts.map +1 -0
- package/dist/run/evidence-recall.js +633 -0
- package/dist/run/evidence-recall.js.map +1 -0
- package/dist/run/index.d.ts +2 -0
- package/dist/run/index.d.ts.map +1 -1
- package/dist/run/index.js +1 -0
- package/dist/run/index.js.map +1 -1
- package/dist/run/json-claim-verifier.d.ts +83 -0
- package/dist/run/json-claim-verifier.d.ts.map +1 -0
- package/dist/run/json-claim-verifier.js +200 -0
- package/dist/run/json-claim-verifier.js.map +1 -0
- package/dist/run/preparation-context-error.d.ts +10 -0
- package/dist/run/preparation-context-error.d.ts.map +1 -0
- package/dist/run/preparation-context-error.js +15 -0
- package/dist/run/preparation-context-error.js.map +1 -0
- package/dist/run-query/index.d.ts +3 -1
- package/dist/run-query/index.d.ts.map +1 -1
- package/dist/runtime/query/callback-inference.d.ts +8 -0
- package/dist/runtime/query/callback-inference.d.ts.map +1 -0
- package/dist/runtime/query/callback-inference.js +89 -0
- package/dist/runtime/query/callback-inference.js.map +1 -0
- package/dist/runtime/query/checkpoint.d.ts +4 -0
- package/dist/runtime/query/checkpoint.d.ts.map +1 -1
- package/dist/runtime/query/checkpoint.js +13 -0
- package/dist/runtime/query/checkpoint.js.map +1 -1
- package/dist/runtime/query/events.d.ts +7 -1
- package/dist/runtime/query/events.d.ts.map +1 -1
- package/dist/runtime/query/events.js +39 -12
- package/dist/runtime/query/events.js.map +1 -1
- package/dist/runtime/query/executor.d.ts +7 -1
- package/dist/runtime/query/executor.d.ts.map +1 -1
- package/dist/runtime/query/executor.js +38 -7
- package/dist/runtime/query/executor.js.map +1 -1
- package/dist/runtime/query/file-evidence-context.d.ts +5 -0
- package/dist/runtime/query/file-evidence-context.d.ts.map +1 -0
- package/dist/runtime/query/file-evidence-context.js +64 -0
- package/dist/runtime/query/file-evidence-context.js.map +1 -0
- package/dist/runtime/query/guard.d.ts.map +1 -1
- package/dist/runtime/query/guard.js +4 -0
- package/dist/runtime/query/guard.js.map +1 -1
- package/dist/runtime/query/index.d.ts +10 -1
- package/dist/runtime/query/index.d.ts.map +1 -1
- package/dist/runtime/query/index.js +40 -25
- package/dist/runtime/query/index.js.map +1 -1
- package/dist/runtime/query/iteration/index.d.ts +9 -31
- package/dist/runtime/query/iteration/index.d.ts.map +1 -1
- package/dist/runtime/query/iteration/index.js +231 -93
- package/dist/runtime/query/iteration/index.js.map +1 -1
- package/dist/runtime/query/iteration/phases/advisory.d.ts +2 -1
- package/dist/runtime/query/iteration/phases/advisory.d.ts.map +1 -1
- package/dist/runtime/query/iteration/phases/advisory.js +2 -1
- package/dist/runtime/query/iteration/phases/advisory.js.map +1 -1
- package/dist/runtime/query/iteration/phases/context.d.ts +2 -1
- package/dist/runtime/query/iteration/phases/context.d.ts.map +1 -1
- package/dist/runtime/query/iteration/phases/context.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 +3 -0
- package/dist/runtime/query/iteration/phases/tool-review.js.map +1 -1
- package/dist/runtime/query/iteration/provider-rejected-image.d.ts +2 -1
- package/dist/runtime/query/iteration/provider-rejected-image.d.ts.map +1 -1
- package/dist/runtime/query/iteration/provider-rejected-image.js +5 -2
- package/dist/runtime/query/iteration/provider-rejected-image.js.map +1 -1
- package/dist/runtime/query/iteration/stream-turn.d.ts +4 -1
- package/dist/runtime/query/iteration/stream-turn.d.ts.map +1 -1
- package/dist/runtime/query/iteration/stream-turn.js +22 -8
- package/dist/runtime/query/iteration/stream-turn.js.map +1 -1
- package/dist/runtime/query/prompt-cache.d.ts.map +1 -1
- package/dist/runtime/query/prompt-cache.js +21 -42
- package/dist/runtime/query/prompt-cache.js.map +1 -1
- package/dist/runtime/query/resume-pending.d.ts +18 -33
- package/dist/runtime/query/resume-pending.d.ts.map +1 -1
- package/dist/runtime/query/resume-pending.js +59 -42
- package/dist/runtime/query/resume-pending.js.map +1 -1
- package/dist/runtime/query/review-policy.d.ts +4 -4
- package/dist/runtime/query/review-policy.d.ts.map +1 -1
- package/dist/runtime/query/review-policy.js +10 -9
- package/dist/runtime/query/review-policy.js.map +1 -1
- package/dist/runtime/query/sandbox-lifecycle.d.ts.map +1 -1
- package/dist/runtime/query/sandbox-lifecycle.js +4 -0
- package/dist/runtime/query/sandbox-lifecycle.js.map +1 -1
- package/dist/runtime/query/tool-output-budget.d.ts +10 -6
- package/dist/runtime/query/tool-output-budget.d.ts.map +1 -1
- package/dist/runtime/query/tool-output-budget.js +54 -12
- package/dist/runtime/query/tool-output-budget.js.map +1 -1
- package/dist/runtime/query/tooling.d.ts +3 -1
- package/dist/runtime/query/tooling.d.ts.map +1 -1
- package/dist/runtime/query/tooling.js +4 -0
- package/dist/runtime/query/tooling.js.map +1 -1
- package/dist/scheduler/completion-inbox.d.ts +3 -0
- package/dist/scheduler/completion-inbox.d.ts.map +1 -1
- package/dist/scheduler/completion-inbox.js +28 -0
- package/dist/scheduler/completion-inbox.js.map +1 -1
- package/dist/store/evidence/compaction-archive.d.ts +109 -0
- package/dist/store/evidence/compaction-archive.d.ts.map +1 -0
- package/dist/store/evidence/compaction-archive.js +125 -0
- package/dist/store/evidence/compaction-archive.js.map +1 -0
- package/dist/store/evidence/compaction-provenance.d.ts +7 -0
- package/dist/store/evidence/compaction-provenance.d.ts.map +1 -0
- package/dist/store/evidence/compaction-provenance.js +49 -0
- package/dist/store/evidence/compaction-provenance.js.map +1 -0
- package/dist/store/evidence/compaction-text.d.ts +16 -0
- package/dist/store/evidence/compaction-text.d.ts.map +1 -0
- package/dist/store/evidence/compaction-text.js +51 -0
- package/dist/store/evidence/compaction-text.js.map +1 -0
- package/dist/store/evidence/disk.d.ts +11 -0
- package/dist/store/evidence/disk.d.ts.map +1 -0
- package/dist/store/evidence/disk.js +367 -0
- package/dist/store/evidence/disk.js.map +1 -0
- package/dist/store/evidence/format.d.ts +25 -0
- package/dist/store/evidence/format.d.ts.map +1 -0
- package/dist/store/evidence/format.js +115 -0
- package/dist/store/evidence/format.js.map +1 -0
- package/dist/store/evidence/index-page.d.ts +208 -0
- package/dist/store/evidence/index-page.d.ts.map +1 -0
- package/dist/store/evidence/index-page.js +262 -0
- package/dist/store/evidence/index-page.js.map +1 -0
- package/dist/store/evidence/io.d.ts +24 -0
- package/dist/store/evidence/io.d.ts.map +1 -0
- package/dist/store/evidence/io.js +69 -0
- package/dist/store/evidence/io.js.map +1 -0
- package/dist/store/evidence/linked.d.ts +9 -0
- package/dist/store/evidence/linked.d.ts.map +1 -0
- package/dist/store/evidence/linked.js +314 -0
- package/dist/store/evidence/linked.js.map +1 -0
- package/dist/store/evidence/passages.d.ts +15 -0
- package/dist/store/evidence/passages.d.ts.map +1 -0
- package/dist/store/evidence/passages.js +72 -0
- package/dist/store/evidence/passages.js.map +1 -0
- package/dist/store/evidence/record-chain.d.ts +42 -0
- package/dist/store/evidence/record-chain.d.ts.map +1 -0
- package/dist/store/evidence/record-chain.js +111 -0
- package/dist/store/evidence/record-chain.js.map +1 -0
- package/dist/store/evidence/search-input.d.ts +21 -0
- package/dist/store/evidence/search-input.d.ts.map +1 -0
- package/dist/store/evidence/search-input.js +44 -0
- package/dist/store/evidence/search-input.js.map +1 -0
- package/dist/store/evidence/selection.d.ts +9 -0
- package/dist/store/evidence/selection.d.ts.map +1 -0
- package/dist/store/evidence/selection.js +17 -0
- package/dist/store/evidence/selection.js.map +1 -0
- package/dist/store/evidence/source-kind.d.ts +11 -0
- package/dist/store/evidence/source-kind.d.ts.map +1 -0
- package/dist/store/evidence/source-kind.js +26 -0
- package/dist/store/evidence/source-kind.js.map +1 -0
- package/dist/store/evidence/source-text.d.ts +51 -0
- package/dist/store/evidence/source-text.d.ts.map +1 -0
- package/dist/store/evidence/source-text.js +213 -0
- package/dist/store/evidence/source-text.js.map +1 -0
- package/dist/store/evidence/types.d.ts +162 -0
- package/dist/store/evidence/types.d.ts.map +1 -0
- package/dist/store/evidence/types.js +2 -0
- package/dist/store/evidence/types.js.map +1 -0
- package/dist/store/memory/disk.d.ts +2 -0
- package/dist/store/memory/disk.d.ts.map +1 -1
- package/dist/store/memory/disk.js +2 -1
- package/dist/store/memory/disk.js.map +1 -1
- package/dist/store/run/disk.d.ts +10 -0
- package/dist/store/run/disk.d.ts.map +1 -1
- package/dist/store/run/disk.js +87 -7
- package/dist/store/run/disk.js.map +1 -1
- package/dist/store/run/memory.d.ts +1 -0
- package/dist/store/run/memory.d.ts.map +1 -1
- package/dist/store/run/memory.js +10 -0
- package/dist/store/run/memory.js.map +1 -1
- package/dist/store/run/tool-executions.d.ts +13 -0
- package/dist/store/run/tool-executions.d.ts.map +1 -0
- package/dist/store/run/tool-executions.js +99 -0
- package/dist/store/run/tool-executions.js.map +1 -0
- package/dist/store/session/index.d.ts +2 -0
- package/dist/store/session/index.d.ts.map +1 -1
- package/dist/store/session/index.js +1 -0
- package/dist/store/session/index.js.map +1 -1
- package/dist/store/session/sqlite.d.ts +57 -0
- package/dist/store/session/sqlite.d.ts.map +1 -0
- package/dist/store/session/sqlite.js +430 -0
- package/dist/store/session/sqlite.js.map +1 -0
- package/dist/tools/builtins/job.d.ts.map +1 -1
- package/dist/tools/builtins/job.js +4 -5
- package/dist/tools/builtins/job.js.map +1 -1
- package/dist/tools/builtins/write-file.js +2 -2
- package/dist/tools/builtins/write-file.js.map +1 -1
- package/dist/tools/defineTool.d.ts +2 -1
- package/dist/tools/defineTool.d.ts.map +1 -1
- package/dist/tools/defineTool.js +1 -1
- package/dist/tools/defineTool.js.map +1 -1
- package/dist/tools/file-read-tracker.d.ts.map +1 -1
- package/dist/tools/file-read-tracker.js +12 -3
- package/dist/tools/file-read-tracker.js.map +1 -1
- package/dist/tools/resident-history.d.ts +10 -0
- package/dist/tools/resident-history.d.ts.map +1 -0
- package/dist/tools/resident-history.js +80 -0
- package/dist/tools/resident-history.js.map +1 -0
- package/dist/tools/resident-tool-evidence.d.ts +5 -0
- package/dist/tools/resident-tool-evidence.d.ts.map +1 -0
- package/dist/tools/resident-tool-evidence.js +57 -0
- package/dist/tools/resident-tool-evidence.js.map +1 -0
- package/dist/types/advisory/config.d.ts +7 -0
- package/dist/types/advisory/config.d.ts.map +1 -1
- package/dist/types/agent/reactive.d.ts +1 -0
- package/dist/types/agent/reactive.d.ts.map +1 -1
- package/dist/types/authorization/index.d.ts +9 -9
- package/dist/types/authorization/index.d.ts.map +1 -1
- package/dist/types/authorization/index.js +1 -1
- package/dist/types/authorization/index.js.map +1 -1
- package/dist/types/hitl/index.d.ts +4 -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 +16 -2
- package/dist/types/message/index.d.ts.map +1 -1
- package/dist/types/message/index.js +8 -1
- package/dist/types/message/index.js.map +1 -1
- package/dist/types/provider/chat.d.ts +2 -0
- package/dist/types/provider/chat.d.ts.map +1 -1
- package/dist/types/provider/stream.d.ts +4 -0
- package/dist/types/provider/stream.d.ts.map +1 -1
- package/dist/types/run/answer-review.d.ts +34 -3
- package/dist/types/run/answer-review.d.ts.map +1 -1
- package/dist/types/run/config.d.ts +3 -0
- package/dist/types/run/config.d.ts.map +1 -1
- package/dist/types/run/entity.d.ts +7 -0
- package/dist/types/run/entity.d.ts.map +1 -1
- package/dist/types/run/events.d.ts +31 -8
- package/dist/types/run/events.d.ts.map +1 -1
- package/dist/types/run/events.js.map +1 -1
- package/dist/types/run/prepare-step.d.ts +53 -8
- package/dist/types/run/prepare-step.d.ts.map +1 -1
- package/dist/types/run/store.d.ts +29 -4
- package/dist/types/run/store.d.ts.map +1 -1
- package/dist/types/run/store.js +0 -28
- package/dist/types/run/store.js.map +1 -1
- package/dist/types/tool/index.d.ts +15 -1
- package/dist/types/tool/index.d.ts.map +1 -1
- package/dist/types/tool/index.js.map +1 -1
- package/dist/utils/await-with-abort.d.ts +8 -0
- package/dist/utils/await-with-abort.d.ts.map +1 -0
- package/dist/utils/await-with-abort.js +28 -0
- package/dist/utils/await-with-abort.js.map +1 -0
- package/dist/utils/evidence-time.d.ts +3 -0
- package/dist/utils/evidence-time.d.ts.map +1 -0
- package/dist/utils/evidence-time.js +10 -0
- package/dist/utils/evidence-time.js.map +1 -0
- package/dist/utils/evidence-tokens.d.ts +13 -0
- package/dist/utils/evidence-tokens.d.ts.map +1 -0
- package/dist/utils/evidence-tokens.js +29 -0
- package/dist/utils/evidence-tokens.js.map +1 -0
- package/package.json +1 -1
- package/src/advisory/executor.ts +15 -30
- package/src/advisory/history.ts +126 -0
- package/src/advisory/index.ts +5 -1
- package/src/agents/ReactiveAgent.ts +3 -0
- package/src/agents/runAgent.ts +14 -1
- package/src/compaction/manual.ts +30 -2
- package/src/compaction/summary.ts +4 -1
- package/src/config/runtime.ts +2 -2
- package/src/contracts/schemas.ts +1 -1
- package/src/eval/harness-protection.ts +79 -0
- package/src/eval/harness-verification.ts +31 -1
- package/src/eval/index.ts +1 -0
- package/src/manager/resident/activity.ts +187 -0
- package/src/manager/resident/agenda.ts +907 -0
- package/src/manager/resident/consumption.ts +311 -0
- package/src/manager/resident/delivery-window.ts +93 -0
- package/src/manager/resident/evidence-recall.ts +363 -0
- package/src/manager/resident/history-disk.ts +63 -0
- package/src/manager/resident/history.ts +312 -0
- package/src/manager/resident/host.ts +356 -0
- package/src/manager/resident/initiative.ts +205 -0
- package/src/manager/resident/learning-cycle.ts +499 -0
- package/src/manager/resident/learning-observation.ts +39 -0
- package/src/manager/resident/learning-store.ts +813 -0
- package/src/manager/resident/learning.ts +493 -0
- package/src/manager/resident/loop.ts +101 -0
- package/src/manager/resident/outbox.ts +307 -0
- package/src/manager/resident/proposal.ts +105 -0
- package/src/manager/resident/store.ts +257 -0
- package/src/manager/resident/tool-evidence.ts +412 -0
- package/src/manager/run/persistence.ts +6 -0
- package/src/plugin/loader.ts +8 -3
- package/src/prompt/coding-agent-doctrine.ts +2 -0
- package/src/prompt/contributions.ts +5 -2
- package/src/prompt/index.ts +4 -0
- package/src/prompt/resident-learning.ts +143 -0
- package/src/prompt/resident-step.ts +176 -0
- package/src/provider/collect-chat-completion.ts +7 -6
- package/src/provider/fallback.ts +2 -1
- package/src/provider/stream-text.ts +56 -0
- package/src/public-runtime.ts +44 -0
- package/src/public-tools.ts +3 -0
- package/src/public-types.ts +165 -0
- package/src/registry/index.ts +1 -1
- package/src/registry/tool/execute.ts +56 -9
- package/src/run/LimitChecker.ts +3 -3
- package/src/run/evidence-query.ts +333 -0
- package/src/run/evidence-recall.ts +854 -0
- package/src/run/index.ts +11 -0
- package/src/run/json-claim-verifier.ts +298 -0
- package/src/run/preparation-context-error.ts +16 -0
- package/src/run-query/index.ts +1 -1
- package/src/runtime/query/callback-inference.ts +94 -0
- package/src/runtime/query/checkpoint.ts +14 -0
- package/src/runtime/query/events.ts +46 -14
- package/src/runtime/query/executor.ts +51 -9
- package/src/runtime/query/file-evidence-context.ts +65 -0
- package/src/runtime/query/guard.ts +2 -0
- package/src/runtime/query/index.ts +50 -27
- package/src/runtime/query/iteration/index.ts +269 -86
- package/src/runtime/query/iteration/phases/advisory.ts +3 -0
- package/src/runtime/query/iteration/phases/context.ts +2 -0
- package/src/runtime/query/iteration/phases/tool-review.ts +3 -0
- package/src/runtime/query/iteration/provider-rejected-image.ts +6 -1
- package/src/runtime/query/iteration/stream-turn.ts +35 -8
- package/src/runtime/query/prompt-cache.ts +24 -47
- package/src/runtime/query/resume-pending.ts +65 -40
- package/src/runtime/query/review-policy.ts +13 -9
- package/src/runtime/query/sandbox-lifecycle.ts +3 -0
- package/src/runtime/query/tool-output-budget.ts +65 -13
- package/src/runtime/query/tooling.ts +7 -1
- package/src/scheduler/completion-inbox.ts +26 -0
- package/src/store/evidence/compaction-archive.ts +139 -0
- package/src/store/evidence/compaction-provenance.ts +52 -0
- package/src/store/evidence/compaction-text.ts +61 -0
- package/src/store/evidence/disk.ts +461 -0
- package/src/store/evidence/format.ts +126 -0
- package/src/store/evidence/index-page.ts +292 -0
- package/src/store/evidence/io.ts +95 -0
- package/src/store/evidence/linked.ts +365 -0
- package/src/store/evidence/passages.ts +88 -0
- package/src/store/evidence/record-chain.ts +108 -0
- package/src/store/evidence/search-input.ts +62 -0
- package/src/store/evidence/selection.ts +25 -0
- package/src/store/evidence/source-kind.ts +36 -0
- package/src/store/evidence/source-text.ts +285 -0
- package/src/store/evidence/types.ts +177 -0
- package/src/store/memory/disk.ts +4 -1
- package/src/store/run/disk.ts +110 -8
- package/src/store/run/memory.ts +10 -0
- package/src/store/run/tool-executions.ts +112 -0
- package/src/store/session/index.ts +2 -0
- package/src/store/session/sqlite.ts +584 -0
- package/src/tools/builtins/job.ts +4 -5
- package/src/tools/builtins/write-file.ts +2 -2
- package/src/tools/defineTool.ts +4 -2
- package/src/tools/file-read-tracker.ts +8 -2
- package/src/tools/resident-history.ts +86 -0
- package/src/tools/resident-tool-evidence.ts +68 -0
- package/src/types/advisory/config.ts +7 -0
- package/src/types/agent/reactive.ts +1 -0
- package/src/types/authorization/index.ts +2 -2
- package/src/types/hitl/index.ts +4 -0
- package/src/types/message/index.ts +20 -0
- package/src/types/provider/chat.ts +2 -0
- package/src/types/provider/stream.ts +4 -0
- package/src/types/run/answer-review.ts +34 -3
- package/src/types/run/config.ts +3 -0
- package/src/types/run/entity.ts +7 -0
- package/src/types/run/events.ts +31 -8
- package/src/types/run/prepare-step.ts +59 -8
- package/src/types/run/store.ts +35 -4
- package/src/types/tool/index.ts +19 -1
- package/src/utils/await-with-abort.ts +26 -0
- package/src/utils/evidence-time.ts +9 -0
- package/src/utils/evidence-tokens.ts +32 -0
|
@@ -1,8 +1,28 @@
|
|
|
1
|
+
import type { TokenUsage } from '../common/index.js'
|
|
1
2
|
import type { RunId } from '../ids/index.js'
|
|
2
3
|
import type { Message, UserMessage } from '../message/index.js'
|
|
3
4
|
import type { ToolChoice } from '../provider/chat.js'
|
|
4
5
|
import type { Skill } from '../skills/index.js'
|
|
5
6
|
import type { StepResult } from './step.js'
|
|
7
|
+
import type { StepProvenance } from './step.js'
|
|
8
|
+
|
|
9
|
+
/** @experimental Bounded, tool-free inference shared by preparation and answer review. */
|
|
10
|
+
export interface PreparationTextRequest {
|
|
11
|
+
readonly system: string
|
|
12
|
+
readonly prompt: string
|
|
13
|
+
/** Default 256; maximum 1,024. A provider limit, not a hard billing ceiling. */
|
|
14
|
+
readonly maxTokens?: number
|
|
15
|
+
/** Default and maximum 10,000ms, shortened by stage/run cancellation. */
|
|
16
|
+
readonly timeoutMs?: number
|
|
17
|
+
readonly signal?: AbortSignal
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/** @experimental Side-call usage also contributes to the owning run's totals. */
|
|
21
|
+
export interface PreparationTextResult {
|
|
22
|
+
readonly text: string
|
|
23
|
+
readonly usage: TokenUsage
|
|
24
|
+
readonly servedBy: StepProvenance
|
|
25
|
+
}
|
|
6
26
|
|
|
7
27
|
/**
|
|
8
28
|
* What the loop knows before it calls the model again.
|
|
@@ -17,6 +37,25 @@ import type { StepResult } from './step.js'
|
|
|
17
37
|
*/
|
|
18
38
|
export interface PrepareStepContext {
|
|
19
39
|
readonly runId: RunId
|
|
40
|
+
/**
|
|
41
|
+
* Optional run-owned inference for context preparation. At most one call per
|
|
42
|
+
* stage invocation; cannot be called after that stage returns. Uses the run's
|
|
43
|
+
* metered provider/fallback chain and the model selected by preceding stages.
|
|
44
|
+
* Only supplied text is sent (12,000 characters total); no tools or history
|
|
45
|
+
* are implicitly attached. Returned text is bounded to 8,192 characters.
|
|
46
|
+
* Absent in beforeStep and in hosts which do not supply this capability.
|
|
47
|
+
*/
|
|
48
|
+
readonly generateText?: (request: PreparationTextRequest) => Promise<PreparationTextResult>
|
|
49
|
+
/**
|
|
50
|
+
* Optional writer-bound snapshot of this invocation's completed events.
|
|
51
|
+
* Never discovers other runs or repeats tools. Unsupported stores return
|
|
52
|
+
* undefined; cancellation or a settled invocation rejects capture. A local
|
|
53
|
+
* signal can shorten, never extend, the run's lifetime.
|
|
54
|
+
*/
|
|
55
|
+
readonly captureRunEvidence?: (
|
|
56
|
+
maxReadBytes?: number,
|
|
57
|
+
signal?: AbortSignal,
|
|
58
|
+
) => Promise<import('../../store/evidence/types.js').RunTextEvidenceSource | undefined>
|
|
20
59
|
/** 1-based, matching the iteration number in events and traces. */
|
|
21
60
|
readonly stepNumber: number
|
|
22
61
|
/** Full history as it stands, so a decision can read what happened. */
|
|
@@ -31,7 +70,7 @@ export interface PrepareStepContext {
|
|
|
31
70
|
readonly signal?: AbortSignal
|
|
32
71
|
/**
|
|
33
72
|
* Estimated room for additional step context after existing messages,
|
|
34
|
-
* earlier stages' system/skills, and a response reserve. Recomputed for
|
|
73
|
+
* earlier stages' system/skills/context, and a response reserve. Recomputed for
|
|
35
74
|
* each stage and its selected model; not a billing limit or fit guarantee.
|
|
36
75
|
* `beforeStep` observes its existing boundary before compaction runs.
|
|
37
76
|
*/
|
|
@@ -127,10 +166,9 @@ export interface PrepareStepResult {
|
|
|
127
166
|
* research wants the search skill, writing wants the style guide, and
|
|
128
167
|
* neither benefits from carrying the other.
|
|
129
168
|
*
|
|
130
|
-
* Rendered into the same ephemeral
|
|
131
|
-
*
|
|
132
|
-
*
|
|
133
|
-
* iteration for what is usually one phase's worth of guidance.
|
|
169
|
+
* Rendered into the same ephemeral system message `system` uses. Providers
|
|
170
|
+
* may move that message before history, so changing skills can invalidate
|
|
171
|
+
* reuse of the conversation prefix even though the run's prompt is unchanged.
|
|
134
172
|
*
|
|
135
173
|
* ADDITIVE to the run's skills, not a replacement. A skill the run
|
|
136
174
|
* always carries is not something a step should be able to take away by
|
|
@@ -152,12 +190,25 @@ export interface PrepareStepResult {
|
|
|
152
190
|
* Guidance for this step ONLY, appended as a system message that is not
|
|
153
191
|
* retained afterwards.
|
|
154
192
|
*
|
|
155
|
-
*
|
|
156
|
-
*
|
|
157
|
-
*
|
|
193
|
+
* Some providers collect all system messages before conversation history.
|
|
194
|
+
* Changing this field can therefore invalidate reuse of the history prefix.
|
|
195
|
+
* Use `context` for changing observations that do not require system authority.
|
|
158
196
|
*/
|
|
159
197
|
readonly system?: string
|
|
160
198
|
|
|
199
|
+
/**
|
|
200
|
+
* Current observations for this request only, appended after history and any
|
|
201
|
+
* step system guidance. Carried as a visibly labelled user-role message with
|
|
202
|
+
* runtime provenance, not operator input or system authority. It never enters
|
|
203
|
+
* durable conversation history or replaces `latestUserMessage`.
|
|
204
|
+
*
|
|
205
|
+
* Useful for changing inventories and retrieved data on providers that hoist
|
|
206
|
+
* system messages. This preserves the history's placement, not a cache-hit
|
|
207
|
+
* guarantee. Later stages may compose `prepared.context` or replace it; an
|
|
208
|
+
* empty string clears it. The next step starts without it.
|
|
209
|
+
*/
|
|
210
|
+
readonly context?: string
|
|
211
|
+
|
|
161
212
|
readonly temperature?: number
|
|
162
213
|
readonly maxResponseTokens?: number
|
|
163
214
|
}
|
package/src/types/run/store.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { RunEvidenceScope, RunTextEvidenceSource } from '../../store/evidence/types.js'
|
|
1
2
|
/**
|
|
2
3
|
* RunStore — persistence contract for a run's own evidence.
|
|
3
4
|
*
|
|
@@ -97,7 +98,38 @@ export interface CompletedToolRecord {
|
|
|
97
98
|
readonly isError: boolean
|
|
98
99
|
}
|
|
99
100
|
|
|
101
|
+
/** The latest recorded execution boundary of a tool call, not its inferred external effect. */
|
|
102
|
+
export type ToolExecutionRecord =
|
|
103
|
+
| (CompletedToolRecord & { readonly status: 'completed' })
|
|
104
|
+
| { readonly toolUseId: string; readonly toolName: string; readonly status: 'started' }
|
|
105
|
+
|
|
106
|
+
/** Absence proves no recorded start only when the whole selected log is complete. */
|
|
107
|
+
export interface ToolExecutionSnapshot {
|
|
108
|
+
readonly complete: boolean
|
|
109
|
+
readonly records: ReadonlyMap<string, ToolExecutionRecord>
|
|
110
|
+
}
|
|
111
|
+
|
|
100
112
|
export interface RunStore {
|
|
113
|
+
/**
|
|
114
|
+
* Optional bounded recovery scan for selected call IDs. A started call without
|
|
115
|
+
* a completion has an unknown outcome and must not be automatically replayed.
|
|
116
|
+
* The runtime falls back to strict readEvents for stores without this method.
|
|
117
|
+
*/
|
|
118
|
+
readToolExecutions?(
|
|
119
|
+
toolUseIds: readonly string[],
|
|
120
|
+
signal?: AbortSignal,
|
|
121
|
+
): Promise<ToolExecutionSnapshot>
|
|
122
|
+
/**
|
|
123
|
+
* Optional bounded read capability anchored to this writer's completed event
|
|
124
|
+
* boundary. Observe signal while waiting/reading; cancellation must not release
|
|
125
|
+
* a writer lock before its pending operation settles.
|
|
126
|
+
*/
|
|
127
|
+
captureTextEvidence?(
|
|
128
|
+
scope: RunEvidenceScope,
|
|
129
|
+
maxReadBytes?: number,
|
|
130
|
+
signal?: AbortSignal,
|
|
131
|
+
): Promise<RunTextEvidenceSource | undefined>
|
|
132
|
+
|
|
101
133
|
/**
|
|
102
134
|
* Bind this store to a run, before any other call.
|
|
103
135
|
*
|
|
@@ -186,10 +218,9 @@ export interface RunStore {
|
|
|
186
218
|
* already come back, and the resumed run re-executes those calls. For a
|
|
187
219
|
* file write that is waste; for a payment or an email it is a second one.
|
|
188
220
|
*
|
|
189
|
-
*
|
|
190
|
-
*
|
|
191
|
-
*
|
|
192
|
-
* answered", so a half-remembered batch is worse than a forgotten one.
|
|
221
|
+
* This completed-only view cannot distinguish an unstarted call from an
|
|
222
|
+
* interrupted effect. It is not authority to execute an absent call. Runtime
|
|
223
|
+
* recovery uses readToolExecutions or a strict readEvents scan instead.
|
|
193
224
|
*/
|
|
194
225
|
readCompletedTools(): Promise<Map<string, CompletedToolRecord>>
|
|
195
226
|
|
package/src/types/tool/index.ts
CHANGED
|
@@ -127,9 +127,17 @@ export interface FileReadTracker {
|
|
|
127
127
|
* `content` lets the tracker fingerprint what was read, which is what
|
|
128
128
|
* makes drift detectable later. Optional so a host that only needs the
|
|
129
129
|
* read-before-overwrite guard can keep its existing implementation.
|
|
130
|
+
* `fullWriteCallId` links a successfully written complete body to its
|
|
131
|
+
* execution; pass ToolContext.toolUseId only after the write succeeds.
|
|
130
132
|
*/
|
|
131
|
-
recordRead(key: string, content?: string): void
|
|
133
|
+
recordRead(key: string, content?: string, fullWriteCallId?: string): void
|
|
132
134
|
hasRead(key: string): boolean
|
|
135
|
+
/**
|
|
136
|
+
* Optional witness of a successful full-body write, supplied by the executing
|
|
137
|
+
* tool through recordRead's third argument. An unchanged later observation
|
|
138
|
+
* preserves it; different or unknown content clears it. Never infer from a name.
|
|
139
|
+
*/
|
|
140
|
+
writeCallId?(key: string): string | undefined
|
|
133
141
|
/**
|
|
134
142
|
* Fingerprint of the body captured at the last read, when one was.
|
|
135
143
|
*
|
|
@@ -223,6 +231,16 @@ export interface ToolDispatchOptions {
|
|
|
223
231
|
}
|
|
224
232
|
|
|
225
233
|
export interface ToolContext {
|
|
234
|
+
/**
|
|
235
|
+
* Host-owned read snapshot. Bound to this tool call's lifetime, including its
|
|
236
|
+
* deadline; an optional signal can cancel capture earlier. Never replays
|
|
237
|
+
* effects. Unsupported stores return undefined.
|
|
238
|
+
*/
|
|
239
|
+
captureRunEvidence?: (
|
|
240
|
+
maxReadBytes?: number,
|
|
241
|
+
signal?: AbortSignal,
|
|
242
|
+
) => Promise<import('../../store/evidence/types.js').RunTextEvidenceSource | undefined>
|
|
243
|
+
|
|
226
244
|
runId: RunId
|
|
227
245
|
workingDirectory: string
|
|
228
246
|
/**
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { subscribeToAbort } from './abort.js'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Stop waiting without releasing any lock owned by the operation. Its promise
|
|
5
|
+
* stays observed until settlement; cancellation cannot reorder queued work.
|
|
6
|
+
* The operation must also check the signal before starting work and pass it
|
|
7
|
+
* into cooperative I/O. This race cannot stop an uncooperative backend.
|
|
8
|
+
*/
|
|
9
|
+
export async function awaitWithAbort<T>(operation: Promise<T>, signal?: AbortSignal): Promise<T> {
|
|
10
|
+
if (!signal) return operation
|
|
11
|
+
if (signal.aborted) {
|
|
12
|
+
void operation.catch(() => {})
|
|
13
|
+
signal.throwIfAborted()
|
|
14
|
+
}
|
|
15
|
+
let dispose = () => {}
|
|
16
|
+
const cancelled = new Promise<never>((_resolve, reject) => {
|
|
17
|
+
dispose = subscribeToAbort(signal, () => reject(signal.reason))
|
|
18
|
+
})
|
|
19
|
+
try {
|
|
20
|
+
const result = await Promise.race([operation, cancelled])
|
|
21
|
+
signal.throwIfAborted()
|
|
22
|
+
return result
|
|
23
|
+
} finally {
|
|
24
|
+
dispose()
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** Stored event wall-clock time, not the time a statement became true. Zero is legacy unknown. */
|
|
2
|
+
export function evidenceRecordedAt(value: unknown): number | undefined {
|
|
3
|
+
return typeof value === 'number' &&
|
|
4
|
+
Number.isSafeInteger(value) &&
|
|
5
|
+
value > 0 &&
|
|
6
|
+
value <= 8_640_000_000_000_000
|
|
7
|
+
? value
|
|
8
|
+
: undefined
|
|
9
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/** The lexical units shared by evidence discovery and bounded relevance scoring. */
|
|
2
|
+
export function evidenceTokens(text: string): string[] {
|
|
3
|
+
return Array.from(evidenceTokenEntries(text), (match) => match[0])
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
/** Iterate large stored text without materializing a token array. */
|
|
7
|
+
export function evidenceTokenEntries(text: string): IterableIterator<RegExpExecArray> {
|
|
8
|
+
return text.matchAll(/[\p{L}\p{N}_]+/gu)
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/** No stemming, locale-sensitive folding or accent normalization. */
|
|
12
|
+
export function evidenceTokenKey(token: string, caseSensitive = false): string {
|
|
13
|
+
return caseSensitive ? token : token.toLowerCase()
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export function isEvidenceToken(text: string): boolean {
|
|
17
|
+
return /^[\p{L}\p{N}_]+$/u.test(text)
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/** `from` may lie inside a token; such a suffix must not become a new word. */
|
|
21
|
+
export function evidenceTokenMatcher(terms: readonly string[], caseSensitive: boolean) {
|
|
22
|
+
const wanted = new Set(terms.map((term) => evidenceTokenKey(term, caseSensitive)))
|
|
23
|
+
const expression = /(?<![\p{L}\p{N}_])[\p{L}\p{N}_]+/gu
|
|
24
|
+
return (text: string, from: number): { index: number; length: number } | undefined => {
|
|
25
|
+
expression.lastIndex = from
|
|
26
|
+
for (let match = expression.exec(text); match; match = expression.exec(text)) {
|
|
27
|
+
if (wanted.has(evidenceTokenKey(match[0], caseSensitive)))
|
|
28
|
+
return { index: match.index, length: match[0].length }
|
|
29
|
+
}
|
|
30
|
+
return undefined
|
|
31
|
+
}
|
|
32
|
+
}
|