@namzu/sdk 36.0.0 → 38.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 +244 -0
- package/README.md +68 -41
- package/dist/bridge/a2a/mapper.d.ts.map +1 -1
- package/dist/bridge/a2a/mapper.js +4 -0
- package/dist/bridge/a2a/mapper.js.map +1 -1
- package/dist/bridge/sse/mapper.d.ts.map +1 -1
- package/dist/bridge/sse/mapper.js +16 -1
- package/dist/bridge/sse/mapper.js.map +1 -1
- package/dist/compaction/extractor.d.ts +1 -1
- package/dist/compaction/extractor.d.ts.map +1 -1
- package/dist/compaction/extractor.js +15 -7
- package/dist/compaction/extractor.js.map +1 -1
- package/dist/compaction/manager.d.ts +2 -0
- package/dist/compaction/manager.d.ts.map +1 -1
- package/dist/compaction/manager.js +12 -1
- package/dist/compaction/manager.js.map +1 -1
- package/dist/compaction/verifier.d.ts.map +1 -1
- package/dist/compaction/verifier.js +82 -15
- package/dist/compaction/verifier.js.map +1 -1
- package/dist/config/runtime.d.ts +16 -6
- package/dist/config/runtime.d.ts.map +1 -1
- package/dist/config/runtime.js +2 -0
- package/dist/config/runtime.js.map +1 -1
- package/dist/contracts/api.d.ts +1 -1
- package/dist/contracts/api.d.ts.map +1 -1
- package/dist/contracts/schemas.d.ts +10 -10
- package/dist/eval/harness-verification.d.ts +63 -0
- package/dist/eval/harness-verification.d.ts.map +1 -0
- package/dist/eval/harness-verification.js +165 -0
- package/dist/eval/harness-verification.js.map +1 -0
- package/dist/eval/index.d.ts +2 -0
- package/dist/eval/index.d.ts.map +1 -1
- package/dist/eval/index.js +1 -0
- package/dist/eval/index.js.map +1 -1
- package/dist/execution/code-runtime/json-value.d.ts +10 -0
- package/dist/execution/code-runtime/json-value.d.ts.map +1 -0
- package/dist/execution/code-runtime/json-value.js +89 -0
- package/dist/execution/code-runtime/json-value.js.map +1 -0
- package/dist/execution/code-runtime/worker-program.d.ts +8 -0
- package/dist/execution/code-runtime/worker-program.d.ts.map +1 -0
- package/dist/execution/code-runtime/worker-program.js +240 -0
- package/dist/execution/code-runtime/worker-program.js.map +1 -0
- package/dist/execution/code-runtime/worker.d.ts +22 -0
- package/dist/execution/code-runtime/worker.d.ts.map +1 -1
- package/dist/execution/code-runtime/worker.js +148 -111
- package/dist/execution/code-runtime/worker.js.map +1 -1
- package/dist/manager/agent/lifecycle.d.ts +12 -0
- package/dist/manager/agent/lifecycle.d.ts.map +1 -1
- package/dist/manager/agent/lifecycle.js +316 -46
- package/dist/manager/agent/lifecycle.js.map +1 -1
- package/dist/manager/run/persistence.d.ts +2 -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/prompt/coding-agent-doctrine.d.ts +2 -2
- package/dist/prompt/coding-agent-doctrine.d.ts.map +1 -1
- package/dist/prompt/coding-agent-doctrine.js +11 -5
- package/dist/prompt/coding-agent-doctrine.js.map +1 -1
- package/dist/provider/capabilities.d.ts +5 -1
- package/dist/provider/capabilities.d.ts.map +1 -1
- package/dist/provider/capabilities.js +24 -0
- package/dist/provider/capabilities.js.map +1 -1
- package/dist/provider/fallback.d.ts.map +1 -1
- package/dist/provider/fallback.js +6 -2
- package/dist/provider/fallback.js.map +1 -1
- package/dist/public-runtime.d.ts +4 -1
- package/dist/public-runtime.d.ts.map +1 -1
- package/dist/public-runtime.js +3 -1
- package/dist/public-runtime.js.map +1 -1
- package/dist/public-tools.d.ts +2 -1
- package/dist/public-tools.d.ts.map +1 -1
- package/dist/public-tools.js +2 -1
- package/dist/public-tools.js.map +1 -1
- package/dist/public-types.d.ts +2 -0
- package/dist/public-types.d.ts.map +1 -1
- package/dist/registry/tool/execute.d.ts +3 -0
- package/dist/registry/tool/execute.d.ts.map +1 -1
- package/dist/registry/tool/execute.js +11 -80
- package/dist/registry/tool/execute.js.map +1 -1
- package/dist/run/command-gate.d.ts.map +1 -1
- package/dist/run/command-gate.js +65 -12
- package/dist/run/command-gate.js.map +1 -1
- 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/memory-promoter.d.ts +3 -35
- package/dist/run/memory-promoter.d.ts.map +1 -1
- package/dist/run/memory-promoter.js +32 -40
- package/dist/run/memory-promoter.js.map +1 -1
- package/dist/run/memory-recall.d.ts +25 -0
- package/dist/run/memory-recall.d.ts.map +1 -0
- package/dist/run/memory-recall.js +228 -0
- package/dist/run/memory-recall.js.map +1 -0
- package/dist/run/reporter.d.ts.map +1 -1
- package/dist/run/reporter.js +2 -0
- package/dist/run/reporter.js.map +1 -1
- package/dist/run/token-budget.d.ts +12 -4
- package/dist/run/token-budget.d.ts.map +1 -1
- package/dist/run/token-budget.js +49 -14
- package/dist/run/token-budget.js.map +1 -1
- package/dist/run/workspace-fingerprint.d.ts +10 -3
- package/dist/run/workspace-fingerprint.d.ts.map +1 -1
- package/dist/run/workspace-fingerprint.js +17 -8
- package/dist/run/workspace-fingerprint.js.map +1 -1
- package/dist/runtime/query/checkpoint.d.ts +14 -0
- package/dist/runtime/query/checkpoint.d.ts.map +1 -1
- package/dist/runtime/query/checkpoint.js +82 -1
- package/dist/runtime/query/checkpoint.js.map +1 -1
- package/dist/runtime/query/executor.d.ts +8 -3
- package/dist/runtime/query/executor.d.ts.map +1 -1
- package/dist/runtime/query/executor.js +94 -30
- package/dist/runtime/query/executor.js.map +1 -1
- package/dist/runtime/query/index.d.ts +7 -8
- package/dist/runtime/query/index.d.ts.map +1 -1
- package/dist/runtime/query/index.js +55 -7
- package/dist/runtime/query/index.js.map +1 -1
- package/dist/runtime/query/iteration/index.d.ts +12 -0
- package/dist/runtime/query/iteration/index.d.ts.map +1 -1
- package/dist/runtime/query/iteration/index.js +348 -38
- package/dist/runtime/query/iteration/index.js.map +1 -1
- package/dist/runtime/query/iteration/native-output.d.ts +10 -0
- package/dist/runtime/query/iteration/native-output.d.ts.map +1 -0
- package/dist/runtime/query/iteration/native-output.js +32 -0
- package/dist/runtime/query/iteration/native-output.js.map +1 -0
- package/dist/runtime/query/iteration/phases/advisory.d.ts.map +1 -1
- package/dist/runtime/query/iteration/phases/advisory.js +18 -13
- package/dist/runtime/query/iteration/phases/advisory.js.map +1 -1
- package/dist/runtime/query/iteration/phases/compaction.d.ts +2 -0
- package/dist/runtime/query/iteration/phases/compaction.d.ts.map +1 -1
- package/dist/runtime/query/iteration/phases/compaction.js +32 -11
- package/dist/runtime/query/iteration/phases/compaction.js.map +1 -1
- package/dist/runtime/query/iteration/phases/context.d.ts +9 -0
- 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 +1 -1
- package/dist/runtime/query/iteration/phases/tool-review.js.map +1 -1
- package/dist/runtime/query/iteration/phases/working-memory.d.ts +1 -1
- package/dist/runtime/query/iteration/phases/working-memory.d.ts.map +1 -1
- package/dist/runtime/query/iteration/phases/working-memory.js +23 -6
- package/dist/runtime/query/iteration/phases/working-memory.js.map +1 -1
- package/dist/runtime/query/iteration/stream-turn.d.ts.map +1 -1
- package/dist/runtime/query/iteration/stream-turn.js +12 -0
- package/dist/runtime/query/iteration/stream-turn.js.map +1 -1
- package/dist/runtime/query/observation-context.d.ts +10 -0
- package/dist/runtime/query/observation-context.d.ts.map +1 -0
- package/dist/runtime/query/observation-context.js +84 -0
- package/dist/runtime/query/observation-context.js.map +1 -0
- package/dist/runtime/query/request-context.d.ts +30 -0
- package/dist/runtime/query/request-context.d.ts.map +1 -0
- package/dist/runtime/query/request-context.js +76 -0
- package/dist/runtime/query/request-context.js.map +1 -0
- package/dist/runtime/query/request-rich-content.d.ts.map +1 -1
- package/dist/runtime/query/request-rich-content.js +6 -3
- package/dist/runtime/query/request-rich-content.js.map +1 -1
- package/dist/runtime/query/review-policy.d.ts +3 -0
- package/dist/runtime/query/review-policy.d.ts.map +1 -1
- package/dist/runtime/query/review-policy.js +4 -1
- package/dist/runtime/query/review-policy.js.map +1 -1
- package/dist/runtime/query/steering.d.ts +6 -2
- package/dist/runtime/query/steering.d.ts.map +1 -1
- package/dist/runtime/query/steering.js +17 -2
- package/dist/runtime/query/steering.js.map +1 -1
- package/dist/runtime/query/tool-call-budget.d.ts +19 -0
- package/dist/runtime/query/tool-call-budget.d.ts.map +1 -0
- package/dist/runtime/query/tool-call-budget.js +110 -0
- package/dist/runtime/query/tool-call-budget.js.map +1 -0
- package/dist/runtime/query/tooling.d.ts +3 -0
- package/dist/runtime/query/tooling.d.ts.map +1 -1
- package/dist/runtime/query/tooling.js +5 -0
- package/dist/runtime/query/tooling.js.map +1 -1
- package/dist/sandbox/file-walk-program.d.ts.map +1 -1
- package/dist/sandbox/file-walk-program.js +8 -0
- package/dist/sandbox/file-walk-program.js.map +1 -1
- package/dist/sandbox/file-walk.d.ts.map +1 -1
- package/dist/sandbox/file-walk.js +9 -0
- package/dist/sandbox/file-walk.js.map +1 -1
- package/dist/scheduler/completion-inbox.d.ts.map +1 -1
- package/dist/scheduler/completion-inbox.js +3 -0
- package/dist/scheduler/completion-inbox.js.map +1 -1
- package/dist/scheduler/local.d.ts.map +1 -1
- package/dist/scheduler/local.js +1 -0
- package/dist/scheduler/local.js.map +1 -1
- package/dist/session/handoff/capacity.d.ts +2 -2
- package/dist/session/handoff/capacity.d.ts.map +1 -1
- package/dist/session/handoff/capacity.js +3 -2
- package/dist/session/handoff/capacity.js.map +1 -1
- package/dist/store/memory/disk.d.ts +6 -2
- package/dist/store/memory/disk.d.ts.map +1 -1
- package/dist/store/memory/disk.js +42 -25
- package/dist/store/memory/disk.js.map +1 -1
- package/dist/store/memory/index.d.ts +4 -0
- package/dist/store/memory/index.d.ts.map +1 -1
- package/dist/store/memory/index.js +55 -19
- package/dist/store/memory/index.js.map +1 -1
- package/dist/store/memory/memory.d.ts +3 -2
- package/dist/store/memory/memory.d.ts.map +1 -1
- package/dist/store/memory/memory.js +11 -2
- package/dist/store/memory/memory.js.map +1 -1
- package/dist/store/memory/operation-lock.d.ts +11 -0
- package/dist/store/memory/operation-lock.d.ts.map +1 -0
- package/dist/store/memory/operation-lock.js +94 -0
- package/dist/store/memory/operation-lock.js.map +1 -0
- package/dist/store/run/token-budget-disk.js +3 -0
- package/dist/store/run/token-budget-disk.js.map +1 -1
- package/dist/tools/builtins/computer-use.d.ts.map +1 -1
- package/dist/tools/builtins/computer-use.js +60 -10
- package/dist/tools/builtins/computer-use.js.map +1 -1
- package/dist/tools/builtins/edit.d.ts.map +1 -1
- package/dist/tools/builtins/edit.js +12 -26
- package/dist/tools/builtins/edit.js.map +1 -1
- package/dist/tools/builtins/file-write-result.d.ts +4 -0
- package/dist/tools/builtins/file-write-result.d.ts.map +1 -0
- package/dist/tools/builtins/file-write-result.js +72 -0
- package/dist/tools/builtins/file-write-result.js.map +1 -0
- package/dist/tools/builtins/glob.d.ts.map +1 -1
- package/dist/tools/builtins/glob.js +8 -1
- package/dist/tools/builtins/glob.js.map +1 -1
- package/dist/tools/builtins/grep.d.ts.map +1 -1
- package/dist/tools/builtins/grep.js +10 -0
- 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 +6 -0
- package/dist/tools/builtins/job.js.map +1 -1
- package/dist/tools/builtins/read-file.d.ts.map +1 -1
- package/dist/tools/builtins/read-file.js +10 -0
- package/dist/tools/builtins/read-file.js.map +1 -1
- package/dist/tools/builtins/run-code.d.ts +6 -0
- package/dist/tools/builtins/run-code.d.ts.map +1 -1
- package/dist/tools/builtins/run-code.js +15 -4
- package/dist/tools/builtins/run-code.js.map +1 -1
- package/dist/tools/builtins/search-tools.d.ts.map +1 -1
- package/dist/tools/builtins/search-tools.js +14 -2
- package/dist/tools/builtins/search-tools.js.map +1 -1
- package/dist/tools/builtins/write-file.d.ts.map +1 -1
- package/dist/tools/builtins/write-file.js +30 -44
- package/dist/tools/builtins/write-file.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 +3 -0
- package/dist/tools/defineTool.js.map +1 -1
- package/dist/tools/file-read-tracker.d.ts +4 -0
- package/dist/tools/file-read-tracker.d.ts.map +1 -0
- package/dist/tools/file-read-tracker.js +16 -0
- package/dist/tools/file-read-tracker.js.map +1 -0
- package/dist/tools/memory/delete.d.ts +4 -0
- package/dist/tools/memory/delete.d.ts.map +1 -0
- package/dist/tools/memory/delete.js +26 -0
- package/dist/tools/memory/delete.js.map +1 -0
- package/dist/tools/memory/index.d.ts +2 -0
- package/dist/tools/memory/index.d.ts.map +1 -1
- package/dist/tools/memory/index.js +6 -0
- package/dist/tools/memory/index.js.map +1 -1
- package/dist/tools/memory/save.d.ts.map +1 -1
- package/dist/tools/memory/save.js +3 -2
- package/dist/tools/memory/save.js.map +1 -1
- package/dist/tools/memory/search.d.ts.map +1 -1
- package/dist/tools/memory/search.js +12 -5
- package/dist/tools/memory/search.js.map +1 -1
- package/dist/tools/memory/update.d.ts +4 -0
- package/dist/tools/memory/update.d.ts.map +1 -0
- package/dist/tools/memory/update.js +47 -0
- package/dist/tools/memory/update.js.map +1 -0
- package/dist/tools/task/list.js +2 -2
- package/dist/tools/task/list.js.map +1 -1
- package/dist/types/agent/scheduler.d.ts +5 -0
- package/dist/types/agent/scheduler.d.ts.map +1 -1
- package/dist/types/agent/task.d.ts +10 -0
- package/dist/types/agent/task.d.ts.map +1 -1
- package/dist/types/computer-use/index.d.ts +6 -0
- package/dist/types/computer-use/index.d.ts.map +1 -1
- package/dist/types/computer-use/index.js.map +1 -1
- package/dist/types/errors/catalog.js +1 -1
- package/dist/types/errors/catalog.js.map +1 -1
- package/dist/types/hitl/index.d.ts +11 -1
- package/dist/types/hitl/index.d.ts.map +1 -1
- package/dist/types/hitl/index.js.map +1 -1
- package/dist/types/memory/index.d.ts +14 -1
- package/dist/types/memory/index.d.ts.map +1 -1
- package/dist/types/plugin/index.d.ts +7 -0
- package/dist/types/plugin/index.d.ts.map +1 -1
- package/dist/types/plugin/index.js.map +1 -1
- package/dist/types/project/entity.d.ts +1 -0
- package/dist/types/project/entity.d.ts.map +1 -1
- package/dist/types/provider/chat.d.ts +4 -0
- package/dist/types/provider/chat.d.ts.map +1 -1
- package/dist/types/provider/config.d.ts +4 -0
- package/dist/types/provider/config.d.ts.map +1 -1
- package/dist/types/provider/model.d.ts +4 -0
- package/dist/types/provider/model.d.ts.map +1 -1
- package/dist/types/provider/stream.d.ts +6 -0
- package/dist/types/provider/stream.d.ts.map +1 -1
- package/dist/types/run/answer-review.d.ts +2 -0
- package/dist/types/run/answer-review.d.ts.map +1 -1
- package/dist/types/run/config.d.ts +2 -0
- package/dist/types/run/config.d.ts.map +1 -1
- package/dist/types/run/events.d.ts +19 -0
- 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 +19 -1
- package/dist/types/run/prepare-step.d.ts.map +1 -1
- package/dist/types/sandbox/index.d.ts +1 -0
- package/dist/types/sandbox/index.d.ts.map +1 -1
- package/dist/types/sandbox/index.js.map +1 -1
- package/dist/types/structured-output/index.d.ts +8 -2
- package/dist/types/structured-output/index.d.ts.map +1 -1
- package/dist/types/tool/index.d.ts +15 -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/json-snapshot.d.ts +3 -0
- package/dist/utils/json-snapshot.d.ts.map +1 -0
- package/dist/utils/json-snapshot.js +79 -0
- package/dist/utils/json-snapshot.js.map +1 -0
- package/package.json +4 -2
- package/src/bridge/a2a/mapper.ts +4 -0
- package/src/bridge/sse/mapper.ts +16 -1
- package/src/compaction/extractor.ts +21 -8
- package/src/compaction/manager.ts +11 -1
- package/src/compaction/verifier.ts +80 -18
- package/src/config/runtime.ts +2 -0
- package/src/contracts/api.ts +1 -0
- package/src/eval/harness-verification.ts +270 -0
- package/src/eval/index.ts +10 -0
- package/src/execution/code-runtime/json-value.ts +82 -0
- package/src/execution/code-runtime/worker-program.ts +239 -0
- package/src/execution/code-runtime/worker.ts +164 -111
- package/src/manager/agent/lifecycle.ts +352 -54
- package/src/manager/run/persistence.ts +7 -0
- package/src/prompt/coding-agent-doctrine.ts +11 -5
- package/src/provider/capabilities.ts +41 -1
- package/src/provider/fallback.ts +9 -2
- package/src/public-runtime.ts +6 -0
- package/src/public-tools.ts +7 -1
- package/src/public-types.ts +7 -0
- package/src/registry/tool/execute.ts +17 -79
- package/src/run/command-gate.ts +61 -13
- package/src/run/index.ts +2 -0
- package/src/run/memory-promoter.ts +32 -40
- package/src/run/memory-recall.ts +254 -0
- package/src/run/reporter.ts +2 -0
- package/src/run/token-budget.ts +55 -14
- package/src/run/workspace-fingerprint.ts +17 -8
- package/src/runtime/query/checkpoint.ts +96 -2
- package/src/runtime/query/executor.ts +100 -29
- package/src/runtime/query/index.ts +76 -16
- package/src/runtime/query/iteration/index.ts +405 -46
- package/src/runtime/query/iteration/native-output.ts +35 -0
- package/src/runtime/query/iteration/phases/advisory.ts +21 -11
- package/src/runtime/query/iteration/phases/compaction.ts +36 -14
- package/src/runtime/query/iteration/phases/context.ts +9 -0
- package/src/runtime/query/iteration/phases/tool-review.ts +5 -1
- package/src/runtime/query/iteration/phases/working-memory.ts +23 -5
- package/src/runtime/query/iteration/stream-turn.ts +15 -0
- package/src/runtime/query/observation-context.ts +86 -0
- package/src/runtime/query/request-context.ts +103 -0
- package/src/runtime/query/request-rich-content.ts +8 -3
- package/src/runtime/query/review-policy.ts +7 -1
- package/src/runtime/query/steering.ts +19 -2
- package/src/runtime/query/tool-call-budget.ts +115 -0
- package/src/runtime/query/tooling.ts +8 -0
- package/src/sandbox/file-walk-program.ts +8 -0
- package/src/sandbox/file-walk.ts +9 -0
- package/src/scheduler/completion-inbox.ts +3 -0
- package/src/scheduler/local.ts +1 -0
- package/src/session/handoff/capacity.ts +7 -3
- package/src/store/memory/disk.ts +52 -30
- package/src/store/memory/index.ts +75 -27
- package/src/store/memory/memory.ts +18 -6
- package/src/store/memory/operation-lock.ts +99 -0
- package/src/store/run/token-budget-disk.ts +3 -0
- package/src/tools/builtins/computer-use.ts +61 -7
- package/src/tools/builtins/edit.ts +12 -27
- package/src/tools/builtins/file-write-result.ts +84 -0
- package/src/tools/builtins/glob.ts +7 -1
- package/src/tools/builtins/grep.ts +10 -0
- package/src/tools/builtins/job.ts +8 -0
- package/src/tools/builtins/read-file.ts +10 -0
- package/src/tools/builtins/run-code.ts +24 -5
- package/src/tools/builtins/search-tools.ts +18 -3
- package/src/tools/builtins/write-file.ts +39 -44
- package/src/tools/defineTool.ts +5 -0
- package/src/tools/file-read-tracker.ts +16 -0
- package/src/tools/memory/delete.ts +29 -0
- package/src/tools/memory/index.ts +6 -0
- package/src/tools/memory/save.ts +4 -2
- package/src/tools/memory/search.ts +12 -5
- package/src/tools/memory/update.ts +50 -0
- package/src/tools/task/list.ts +2 -2
- package/src/types/agent/scheduler.ts +6 -0
- package/src/types/agent/task.ts +13 -0
- package/src/types/computer-use/index.ts +6 -0
- package/src/types/errors/catalog.ts +1 -1
- package/src/types/hitl/index.ts +11 -1
- package/src/types/memory/index.ts +16 -1
- package/src/types/plugin/index.ts +10 -0
- package/src/types/project/entity.ts +1 -0
- package/src/types/provider/chat.ts +2 -0
- package/src/types/provider/config.ts +4 -0
- package/src/types/provider/model.ts +4 -0
- package/src/types/provider/stream.ts +7 -0
- package/src/types/run/answer-review.ts +2 -0
- package/src/types/run/config.ts +2 -0
- package/src/types/run/events.ts +20 -0
- package/src/types/run/prepare-step.ts +19 -1
- package/src/types/sandbox/index.ts +1 -0
- package/src/types/structured-output/index.ts +15 -2
- package/src/types/tool/index.ts +16 -0
- package/src/types/tool/presentation.ts +4 -0
- package/src/utils/json-snapshot.ts +76 -0
|
@@ -14,19 +14,26 @@ function defineSearchMemoryTool(search: SearchMemory): ToolDefinition {
|
|
|
14
14
|
return defineTool({
|
|
15
15
|
name: 'search_memory',
|
|
16
16
|
description:
|
|
17
|
-
'Search stored memories by
|
|
17
|
+
'Search active stored memories by relevant words or tags. The built-in store ranks matches in titles, summaries and full content. Returns titles and summaries; use read_memory for evidence. Set status to archived to inspect obsolete records.',
|
|
18
18
|
inputSchema: z.object({
|
|
19
|
-
query: z.string().optional().describe('
|
|
19
|
+
query: z.string().optional().describe('Relevant words or identifiers to search'),
|
|
20
20
|
tags: z.array(z.string()).optional().describe('Filter by tags (all must match)'),
|
|
21
|
-
|
|
21
|
+
status: z.enum(['active', 'archived']).default('active'),
|
|
22
|
+
limit: z
|
|
23
|
+
.number()
|
|
24
|
+
.int()
|
|
25
|
+
.min(1)
|
|
26
|
+
.max(50)
|
|
27
|
+
.default(10)
|
|
28
|
+
.describe('Maximum results to return (1–50)'),
|
|
22
29
|
}),
|
|
23
30
|
category: 'analysis',
|
|
24
31
|
permissions: [],
|
|
25
32
|
readOnly: true,
|
|
26
33
|
destructive: false,
|
|
27
34
|
concurrencySafe: true,
|
|
28
|
-
async execute({ query, tags, limit }) {
|
|
29
|
-
const result = await search({ query, tags, limit })
|
|
35
|
+
async execute({ query, tags, status, limit }) {
|
|
36
|
+
const result = await search({ query, tags, status, limit })
|
|
30
37
|
|
|
31
38
|
if (result.entries.length === 0) {
|
|
32
39
|
return {
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { z } from 'zod'
|
|
2
|
+
import type { MemoryStore } from '../../types/memory/index.js'
|
|
3
|
+
import type { ToolDefinition } from '../../types/tool/index.js'
|
|
4
|
+
import { asMemoryId } from '../../utils/id.js'
|
|
5
|
+
import { defineTool } from '../defineTool.js'
|
|
6
|
+
|
|
7
|
+
export function buildUpdateMemoryTool(store: MemoryStore): ToolDefinition {
|
|
8
|
+
return defineTool({
|
|
9
|
+
name: 'update_memory',
|
|
10
|
+
description:
|
|
11
|
+
'Correct an existing memory in place, or archive an obsolete claim so it is no longer recalled. Use the ID from search_memory; current evidence should determine corrections.',
|
|
12
|
+
inputSchema: z.object({
|
|
13
|
+
id: z.string().describe('Memory ID to correct or archive'),
|
|
14
|
+
title: z.string().min(1).optional(),
|
|
15
|
+
summary: z.string().min(1).optional(),
|
|
16
|
+
content: z.string().min(1).optional(),
|
|
17
|
+
tags: z.array(z.string()).optional(),
|
|
18
|
+
status: z.enum(['active', 'archived']).optional(),
|
|
19
|
+
}),
|
|
20
|
+
category: 'custom',
|
|
21
|
+
permissions: [],
|
|
22
|
+
readOnly: false,
|
|
23
|
+
destructive: false,
|
|
24
|
+
concurrencySafe: true,
|
|
25
|
+
async execute({ id, ...updates }) {
|
|
26
|
+
if (Object.values(updates).every((value) => value === undefined)) {
|
|
27
|
+
return {
|
|
28
|
+
success: false,
|
|
29
|
+
output: 'Provide a correction or status to update.',
|
|
30
|
+
error: 'No memory update supplied',
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
const memoryId = asMemoryId(id)
|
|
34
|
+
// Patch only requested fields in one store operation. A read/merge of
|
|
35
|
+
// provenance here would overwrite metadata from a concurrent writer.
|
|
36
|
+
const entry = await store.update(memoryId, updates)
|
|
37
|
+
if (!entry)
|
|
38
|
+
return {
|
|
39
|
+
success: false,
|
|
40
|
+
output: `Memory ${id} no longer exists.`,
|
|
41
|
+
error: 'Memory not found',
|
|
42
|
+
}
|
|
43
|
+
return {
|
|
44
|
+
success: true,
|
|
45
|
+
output: `Memory updated: ${id} — ${entry.title} (${entry.status}).`,
|
|
46
|
+
data: { id, status: entry.status },
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
})
|
|
50
|
+
}
|
package/src/tools/task/list.ts
CHANGED
|
@@ -8,7 +8,7 @@ export function buildTaskListTool(taskStore: TaskStore, runId: RunId): ToolDefin
|
|
|
8
8
|
return defineTool({
|
|
9
9
|
name: 'task_list',
|
|
10
10
|
description:
|
|
11
|
-
'List
|
|
11
|
+
'List planning items for the current run, not delegated agent invocations. Use agent_task_list, when available, to inspect agent execution. Shows subject, status, owner, and unresolved blockers. Use this to review your plan and decide what to work on next.',
|
|
12
12
|
inputSchema: z.object({}),
|
|
13
13
|
category: 'custom',
|
|
14
14
|
permissions: [],
|
|
@@ -46,7 +46,7 @@ export function buildTaskListTool(taskStore: TaskStore, runId: RunId): ToolDefin
|
|
|
46
46
|
success: true,
|
|
47
47
|
output:
|
|
48
48
|
tasks.length === 0
|
|
49
|
-
? 'No tasks yet.'
|
|
49
|
+
? 'No planning tasks yet. This list does not report delegated agent status; use agent_task_list when available.'
|
|
50
50
|
: `${stats.total} tasks: ${stats.completed} completed, ${stats.in_progress} in progress, ${stats.pending} pending.`,
|
|
51
51
|
data: { tasks: summary, stats },
|
|
52
52
|
}
|
|
@@ -29,6 +29,12 @@ export interface TaskHandle {
|
|
|
29
29
|
export type SiblingFailurePolicy = 'continue' | 'cancel-siblings'
|
|
30
30
|
|
|
31
31
|
export interface CreateTaskOptions {
|
|
32
|
+
/**
|
|
33
|
+
* Revalidate host authority at actual admission, including after a capacity wait.
|
|
34
|
+
* Queue retries may invoke this more than once; checks must tolerate repeated calls.
|
|
35
|
+
*/
|
|
36
|
+
readonly beforeStart?: () => Promise<void>
|
|
37
|
+
|
|
32
38
|
/**
|
|
33
39
|
* Observe events from this one delegated run when the scheduler can expose
|
|
34
40
|
* them.
|
package/src/types/agent/task.ts
CHANGED
|
@@ -122,6 +122,7 @@ export interface AgentTask {
|
|
|
122
122
|
agentId: string
|
|
123
123
|
agent: Agent<BaseAgentConfig, BaseAgentResult>
|
|
124
124
|
childAbortController: AbortController
|
|
125
|
+
/** While pending admission this is the submitting authority; admitted tasks receive child scope. */
|
|
125
126
|
context: AgentTaskContext
|
|
126
127
|
state: AgentTaskState
|
|
127
128
|
result?: BaseAgentResult
|
|
@@ -142,6 +143,12 @@ export interface AgentTask {
|
|
|
142
143
|
* WorkspaceRef triple atomically on every spawn.
|
|
143
144
|
*/
|
|
144
145
|
export interface SendMessageOptions {
|
|
146
|
+
/**
|
|
147
|
+
* Revalidate host authority before admission, including after a capacity wait.
|
|
148
|
+
* Queue retries may invoke this more than once; checks must tolerate repeated calls.
|
|
149
|
+
*/
|
|
150
|
+
readonly beforeStart?: () => Promise<void>
|
|
151
|
+
|
|
145
152
|
/** See {@link import('./scheduler.js').CreateTaskOptions.toolScope}. Deny-only. */
|
|
146
153
|
readonly toolScope?: { readonly deny: readonly string[] }
|
|
147
154
|
/** See {@link import('./scheduler.js').CreateTaskOptions.personaOverride}. */
|
|
@@ -179,6 +186,12 @@ export interface SendMessageOptions {
|
|
|
179
186
|
}
|
|
180
187
|
|
|
181
188
|
export interface AgentManagerConfig {
|
|
189
|
+
/** Reject a full parent immediately (default), or retain bounded pending task handles. */
|
|
190
|
+
capacityBehavior?: 'reject' | 'queue'
|
|
191
|
+
|
|
192
|
+
/** Maximum tasks awaiting admission across this manager. Defaults to 128. */
|
|
193
|
+
maxPendingTasks?: number
|
|
194
|
+
|
|
182
195
|
maxDepth: number
|
|
183
196
|
|
|
184
197
|
evictionMs: number
|
|
@@ -30,6 +30,12 @@ export interface ComputerUseCapabilities {
|
|
|
30
30
|
readonly keyboard: boolean
|
|
31
31
|
readonly cursorPosition: boolean
|
|
32
32
|
readonly clipboard: boolean
|
|
33
|
+
/** Exact action subset when known. Refines the broad flags; absent retains their legacy interpretation. */
|
|
34
|
+
readonly supportedActions?: readonly ComputerUseAction['type'][]
|
|
35
|
+
/** Supported click buttons; absent leaves button admission to the host. */
|
|
36
|
+
readonly mouseClickButtons?: readonly MouseButton[]
|
|
37
|
+
/** Supported drag buttons; absent leaves button admission to the host. */
|
|
38
|
+
readonly mouseDragButtons?: readonly MouseButton[]
|
|
33
39
|
/**
|
|
34
40
|
* Why every flag above is false, when a host loaded but the desktop did
|
|
35
41
|
* not answer — a WSL process with PowerShell and no interactive Windows
|
|
@@ -157,7 +157,7 @@ export const DEFAULT_ERROR_RULES: readonly ErrorCatalogRule[] = [
|
|
|
157
157
|
id: 'provider.rate_limit',
|
|
158
158
|
when: (facts) => facts.code === 'rate_limit' || facts.status === 429,
|
|
159
159
|
message: 'The provider is rate limiting this run.',
|
|
160
|
-
hint: '
|
|
160
|
+
hint: 'Respect the provider retry delay when reported. Lower concurrency, or wait for the quota window to reset before resuming.',
|
|
161
161
|
},
|
|
162
162
|
{
|
|
163
163
|
id: 'provider.context_overflow',
|
package/src/types/hitl/index.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type { WorkingStateSnapshot } from '../../compaction/wire.js'
|
|
|
2
2
|
import type { SerializedSpanContext } from '../../telemetry/attributes.js'
|
|
3
3
|
import type { CostInfo, TokenUsage } from '../common/index.js'
|
|
4
4
|
import type { CheckpointId, PlanId, RunId } from '../ids/index.js'
|
|
5
|
-
import type { Message } from '../message/index.js'
|
|
5
|
+
import type { Message, UserMessage } from '../message/index.js'
|
|
6
6
|
import type { PlanStatus } from '../plan/index.js'
|
|
7
7
|
import type { TokenBudgetBinding } from '../run/token-budget-store.js'
|
|
8
8
|
|
|
@@ -212,6 +212,16 @@ export interface IterationCheckpoint {
|
|
|
212
212
|
runId: RunId
|
|
213
213
|
iteration: number
|
|
214
214
|
messages: Message[]
|
|
215
|
+
/**
|
|
216
|
+
* Current operator/goal/steering text and provenance, independent of
|
|
217
|
+
* compacted history. Attachments are not duplicated here. Older
|
|
218
|
+
* checkpoints omit this field and use surviving history on resume.
|
|
219
|
+
*/
|
|
220
|
+
latestUserMessage?: UserMessage
|
|
221
|
+
/** Structured host-review rejections consumed at this checkpoint, independent of compacted messages. */
|
|
222
|
+
structuredReviewAttempts?: number
|
|
223
|
+
/** Native structured-output corrections consumed independently of message history. */
|
|
224
|
+
nativeStructuredAttempts?: number
|
|
215
225
|
tokenUsage: TokenUsage
|
|
216
226
|
costInfo: CostInfo
|
|
217
227
|
/**
|
|
@@ -31,11 +31,19 @@ export interface MemoryContent {
|
|
|
31
31
|
readonly metadata?: Record<string, unknown>
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
+
/** Metadata and body observed together at one store read boundary. */
|
|
35
|
+
export interface MemoryRecord {
|
|
36
|
+
readonly entry: MemoryIndexEntry
|
|
37
|
+
readonly content: MemoryContent
|
|
38
|
+
}
|
|
39
|
+
|
|
34
40
|
export interface MemorySearchParams {
|
|
35
41
|
readonly query?: string
|
|
36
42
|
readonly tags?: string[]
|
|
37
43
|
readonly status?: MemoryStatus
|
|
38
44
|
readonly limit?: number
|
|
45
|
+
/** Match at least one exact normalized word token before limiting results. Empty means no constraint. */
|
|
46
|
+
readonly requiredIdentifiers?: readonly string[]
|
|
39
47
|
}
|
|
40
48
|
|
|
41
49
|
export interface MemorySearchResult {
|
|
@@ -52,10 +60,17 @@ export interface CreateMemoryParams {
|
|
|
52
60
|
readonly metadata?: Record<string, unknown>
|
|
53
61
|
}
|
|
54
62
|
|
|
63
|
+
/** Change a memory's content or explicitly archive/reactivate it. */
|
|
64
|
+
export interface UpdateMemoryParams extends Partial<CreateMemoryParams> {
|
|
65
|
+
readonly status?: MemoryStatus
|
|
66
|
+
}
|
|
67
|
+
|
|
55
68
|
export interface MemoryStore {
|
|
56
69
|
create(params: CreateMemoryParams): Promise<{ entry: MemoryIndexEntry; content: MemoryContent }>
|
|
57
70
|
get(id: MemoryId): Promise<MemoryContent | undefined>
|
|
58
|
-
|
|
71
|
+
/** Current metadata/body snapshot; supports rechecking status after search. */
|
|
72
|
+
getRecord?(id: MemoryId): Promise<MemoryRecord | undefined>
|
|
73
|
+
update(id: MemoryId, updates: UpdateMemoryParams): Promise<MemoryIndexEntry | undefined>
|
|
59
74
|
delete(id: MemoryId): Promise<boolean>
|
|
60
75
|
list(params?: MemorySearchParams): Promise<MemorySearchResult>
|
|
61
76
|
}
|
|
@@ -8,6 +8,10 @@ import {
|
|
|
8
8
|
MAX_TOOLS_PER_PLUGIN,
|
|
9
9
|
PLUGIN_NAME_MAX_LENGTH,
|
|
10
10
|
} from '../../constants/plugin/index.js'
|
|
11
|
+
import type {
|
|
12
|
+
RequestContextChange,
|
|
13
|
+
RequestContextSnapshot,
|
|
14
|
+
} from '../../runtime/query/request-context.js'
|
|
11
15
|
import type { PluginId, RunId, SessionId } from '../ids/index.js'
|
|
12
16
|
import type { Message, ToolResultContent } from '../message/index.js'
|
|
13
17
|
import type { CancelCause } from '../run/cancel-cause.js'
|
|
@@ -142,6 +146,12 @@ export function assertPluginHookEvent(event: PluginHookEvent): void {
|
|
|
142
146
|
* contract by accident.
|
|
143
147
|
*/
|
|
144
148
|
export interface PluginModelRequest {
|
|
149
|
+
/** SDK provider-input content inventory; excludes adapter/server-private transformations. */
|
|
150
|
+
readonly context?: {
|
|
151
|
+
readonly snapshot: RequestContextSnapshot
|
|
152
|
+
/** Compared with the preceding pre_llm_call in this run; absent on the first. */
|
|
153
|
+
readonly change?: RequestContextChange
|
|
154
|
+
}
|
|
145
155
|
readonly model: string
|
|
146
156
|
readonly messages: readonly Message[]
|
|
147
157
|
/** Names only. A hook auditing tool exposure needs the set, not the schemas. */
|
|
@@ -18,6 +18,7 @@ import type { ProjectId } from '../session/ids.js'
|
|
|
18
18
|
*/
|
|
19
19
|
export interface ProjectConfig {
|
|
20
20
|
maxDelegationDepth: number
|
|
21
|
+
/** Maximum pending or active direct delegations; completed history does not consume capacity. */
|
|
21
22
|
maxDelegationWidth: number
|
|
22
23
|
maxInterventionDepth: number
|
|
23
24
|
sharedMemoryStores?: readonly MemoryStoreRef[]
|
|
@@ -34,6 +34,8 @@ export interface ChatCompletionParams {
|
|
|
34
34
|
* calls may omit it; a provider then uses its own id, `model`, and index 0.
|
|
35
35
|
*/
|
|
36
36
|
providerRoute?: ProviderRoute
|
|
37
|
+
/** Opt in to provider-hosted web search. Absent means no hosted search. */
|
|
38
|
+
webSearch?: { mode: 'cached' | 'live' }
|
|
37
39
|
tools?: LLMToolSchema[]
|
|
38
40
|
/**
|
|
39
41
|
* Provider hint naming tools whose model-facing JSON Schema should be
|
|
@@ -121,6 +121,10 @@ export interface MockProviderConfig extends MockScript {
|
|
|
121
121
|
* degradation is loud instead of silent.
|
|
122
122
|
*/
|
|
123
123
|
export interface ProviderCapabilities {
|
|
124
|
+
/** Explicit provider-hosted web search support; absent means unsupported. */
|
|
125
|
+
supportsHostedWebSearch?: boolean
|
|
126
|
+
/** Native JSON Schema response-format mapping. Absent means unsupported. */
|
|
127
|
+
supportsNativeStructuredOutput?: boolean
|
|
124
128
|
supportsTools: boolean
|
|
125
129
|
supportsStreaming: boolean
|
|
126
130
|
supportsFunctionCalling: boolean
|
|
@@ -14,6 +14,10 @@ export interface ModelInfo {
|
|
|
14
14
|
* the answer; it must not be read as text-only.
|
|
15
15
|
*/
|
|
16
16
|
inputModalities?: readonly ModelInputModality[]
|
|
17
|
+
/** Exact selectable effort levels for this model and route. Absent means unknown; [] means unsupported. */
|
|
18
|
+
reasoningEffortLevels?: readonly import('./chat.js').ReasoningEffort[]
|
|
19
|
+
/** Published default, when established; must belong to reasoningEffortLevels when both are present. */
|
|
20
|
+
reasoningEffortDefault?: import('./chat.js').ReasoningEffort
|
|
17
21
|
/**
|
|
18
22
|
* Tokens the model's context holds, when the driver knows.
|
|
19
23
|
*
|
|
@@ -9,6 +9,13 @@ export interface StreamChunk {
|
|
|
9
9
|
*/
|
|
10
10
|
replayState?: unknown
|
|
11
11
|
delta: {
|
|
12
|
+
/** Activity executed by the provider, never a local function-call request. */
|
|
13
|
+
hostedTool?: {
|
|
14
|
+
id: string
|
|
15
|
+
name: 'web_search'
|
|
16
|
+
status: 'running' | 'completed' | 'failed'
|
|
17
|
+
}
|
|
18
|
+
|
|
12
19
|
content?: string
|
|
13
20
|
toolCalls?: Array<{
|
|
14
21
|
index: number
|
|
@@ -29,6 +29,8 @@ export type AnswerReview =
|
|
|
29
29
|
export interface AnswerReviewContext {
|
|
30
30
|
readonly runId: RunId
|
|
31
31
|
readonly iteration: number
|
|
32
|
+
/** Run cancellation; reviewers should forward it to verification operations. */
|
|
33
|
+
readonly signal?: AbortSignal
|
|
32
34
|
/** The full history, so a reviewer can see how the answer was reached. */
|
|
33
35
|
readonly messages: readonly Message[]
|
|
34
36
|
}
|
package/src/types/run/config.ts
CHANGED
|
@@ -65,6 +65,8 @@ export interface AgentRunConfig {
|
|
|
65
65
|
* high-effort and silently was not is worse than a startup error.
|
|
66
66
|
*/
|
|
67
67
|
effort?: import('../provider/index.js').ReasoningEffort
|
|
68
|
+
/** Provider-hosted search for this run. Explicit opt-in; no local network permission. */
|
|
69
|
+
webSearch?: import('../provider/index.js').ChatCompletionParams['webSearch']
|
|
68
70
|
tokenBudget: number
|
|
69
71
|
costLimitUsd?: number
|
|
70
72
|
maxIterations?: number
|
package/src/types/run/events.ts
CHANGED
|
@@ -17,6 +17,7 @@ import type { Message } from '../message/index.js'
|
|
|
17
17
|
import type { PlanStep } from '../plan/index.js'
|
|
18
18
|
import type { PluginHookEvent, PluginHookResult } from '../plugin/index.js'
|
|
19
19
|
import type { TaskStatus } from '../task/index.js'
|
|
20
|
+
import type { ToolResultView } from '../tool/presentation.js'
|
|
20
21
|
import type { CancelCause } from './cancel-cause.js'
|
|
21
22
|
import type { FencingToken } from './checkpoint-store.js'
|
|
22
23
|
import type { Lineage } from './lineage.js'
|
|
@@ -101,6 +102,16 @@ interface RunEventEnvelope {
|
|
|
101
102
|
}
|
|
102
103
|
|
|
103
104
|
type CoreRunEvent =
|
|
105
|
+
| {
|
|
106
|
+
type: 'tool_calls_admitted'
|
|
107
|
+
runId: RunId
|
|
108
|
+
kind: 'initialize' | 'batch' | 'nested' | 'retry'
|
|
109
|
+
/** Newly reserved attempts; zero only for ledger initialization. */
|
|
110
|
+
count: number
|
|
111
|
+
/** Cumulative reserved attempts, including abandoned reservations. */
|
|
112
|
+
used: number
|
|
113
|
+
limit: number
|
|
114
|
+
}
|
|
104
115
|
| { type: 'run_started'; runId: RunId; systemPrompt?: string }
|
|
105
116
|
| { type: 'iteration_started'; runId: RunId; iteration: number }
|
|
106
117
|
/**
|
|
@@ -357,6 +368,13 @@ type CoreRunEvent =
|
|
|
357
368
|
/** Optional completion in [0,1] when the tool genuinely knows it. */
|
|
358
369
|
fraction?: number
|
|
359
370
|
}
|
|
371
|
+
/** Provider-executed activity, retained as evidence rather than a local tool request. */
|
|
372
|
+
| {
|
|
373
|
+
type: 'hosted_tool'
|
|
374
|
+
runId: RunId
|
|
375
|
+
iteration: number
|
|
376
|
+
tool: NonNullable<import('../provider/index.js').StreamChunk['delta']['hostedTool']>
|
|
377
|
+
}
|
|
360
378
|
/**
|
|
361
379
|
* A model call failed transiently and is being retried after a backoff.
|
|
362
380
|
*
|
|
@@ -416,6 +434,8 @@ type CoreRunEvent =
|
|
|
416
434
|
}
|
|
417
435
|
| {
|
|
418
436
|
type: 'tool_completed'
|
|
437
|
+
/** Bounded result view; omitted when output was overridden or truncated. */
|
|
438
|
+
presentation?: ToolResultView
|
|
419
439
|
runId: RunId
|
|
420
440
|
toolUseId: ToolUseId
|
|
421
441
|
toolName: string
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { RunId } from '../ids/index.js'
|
|
2
|
-
import type { Message } from '../message/index.js'
|
|
2
|
+
import type { Message, UserMessage } from '../message/index.js'
|
|
3
3
|
import type { ToolChoice } from '../provider/chat.js'
|
|
4
4
|
import type { Skill } from '../skills/index.js'
|
|
5
5
|
import type { StepResult } from './step.js'
|
|
@@ -21,6 +21,24 @@ export interface PrepareStepContext {
|
|
|
21
21
|
readonly stepNumber: number
|
|
22
22
|
/** Full history as it stands, so a decision can read what happened. */
|
|
23
23
|
readonly messages: readonly Message[]
|
|
24
|
+
/**
|
|
25
|
+
* Latest operator, goal-round, or steering input accepted by this run,
|
|
26
|
+
* retained even when compaction removes it from `messages`. Project
|
|
27
|
+
* instructions and task-completion context do not replace operator intent.
|
|
28
|
+
*/
|
|
29
|
+
readonly latestUserMessage?: UserMessage
|
|
30
|
+
/** The run's cancellation signal, for bounded asynchronous preparation. */
|
|
31
|
+
readonly signal?: AbortSignal
|
|
32
|
+
/**
|
|
33
|
+
* Estimated room for additional step context after existing messages,
|
|
34
|
+
* earlier stages' system/skills, and a response reserve. Recomputed for
|
|
35
|
+
* each stage and its selected model; not a billing limit or fit guarantee.
|
|
36
|
+
* `beforeStep` observes its existing boundary before compaction runs.
|
|
37
|
+
*/
|
|
38
|
+
readonly contextBudget?: {
|
|
39
|
+
readonly remainingTokens: number
|
|
40
|
+
readonly windowTokens: number
|
|
41
|
+
}
|
|
24
42
|
/** Every completed step, in order. */
|
|
25
43
|
readonly steps: readonly StepResult[]
|
|
26
44
|
|
|
@@ -310,6 +310,7 @@ export interface Sandbox {
|
|
|
310
310
|
listFiles(rootPath: string): Promise<readonly SandboxFileEntry[]>
|
|
311
311
|
/**
|
|
312
312
|
* Lazily enumerate regular files as absolute paths, without following symlinks.
|
|
313
|
+
* A regular-file root yields that file if its basename matches the pattern.
|
|
313
314
|
* Cancellation and iterator return stop traversal. Exceeding the examined-entry
|
|
314
315
|
* budget throws an error with code `ERR_FILE_WALK_LIMIT`; it is not an empty or
|
|
315
316
|
* complete listing. Hosts requiring bounded search must refuse an absent method.
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { z } from 'zod'
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* Configuration for
|
|
4
|
+
* Configuration for validated output via tool constraint or native JSON Schema.
|
|
5
5
|
*
|
|
6
6
|
* This configuration allows an agent to produce validated, typed output by
|
|
7
|
-
* presenting the output schema as a
|
|
7
|
+
* presenting the output schema as a tool by default, or as a native response format.
|
|
8
8
|
*/
|
|
9
9
|
export interface StructuredOutputConfig<TSchema extends z.ZodType = z.ZodType> {
|
|
10
10
|
/**
|
|
@@ -13,6 +13,9 @@ export interface StructuredOutputConfig<TSchema extends z.ZodType = z.ZodType> {
|
|
|
13
13
|
*/
|
|
14
14
|
schema: TSchema
|
|
15
15
|
|
|
16
|
+
/** Default tool constraint, or native JSON schema on an explicitly capable driver. */
|
|
17
|
+
mode?: 'tool' | 'native'
|
|
18
|
+
|
|
16
19
|
/**
|
|
17
20
|
* Turns spent re-prompting when the model answers in prose or fails
|
|
18
21
|
* validation. Defaults to {@link DEFAULT_STRUCTURED_OUTPUT_RETRIES}.
|
|
@@ -21,6 +24,16 @@ export interface StructuredOutputConfig<TSchema extends z.ZodType = z.ZodType> {
|
|
|
21
24
|
* than iterating against `maxIterations`.
|
|
22
25
|
*/
|
|
23
26
|
maxRetries?: number
|
|
27
|
+
|
|
28
|
+
/** Review the JSON-decoded result before settlement. Narrow the value before use: serialization may change schema output types. Exceptions fail the run; cancellation is propagated. */
|
|
29
|
+
review?: (
|
|
30
|
+
output: unknown,
|
|
31
|
+
context: import('../run/answer-review.js').AnswerReviewContext,
|
|
32
|
+
) =>
|
|
33
|
+
| import('../run/answer-review.js').AnswerReview
|
|
34
|
+
| Promise<import('../run/answer-review.js').AnswerReview>
|
|
35
|
+
/** Corrections allowed after host rejection, separate from schema retries. Default 3; zero allows no correction. */
|
|
36
|
+
maxReviews?: number
|
|
24
37
|
}
|
|
25
38
|
|
|
26
39
|
/**
|
package/src/types/tool/index.ts
CHANGED
|
@@ -14,6 +14,8 @@ import type { ToolPresentation } from './presentation.js'
|
|
|
14
14
|
|
|
15
15
|
export interface ToolRegistryRef {
|
|
16
16
|
searchDeferred(query: string): ToolDefinition[]
|
|
17
|
+
/** Ranked active matches, when this registry supports active-tool discovery. */
|
|
18
|
+
searchActive?(query: string): ToolDefinition[]
|
|
17
19
|
activate(names: string[]): void
|
|
18
20
|
getAvailability(name: string): ToolAvailability
|
|
19
21
|
}
|
|
@@ -633,6 +635,18 @@ export interface ToolDefinition<TInput = unknown> extends ToolPresentation<TInpu
|
|
|
633
635
|
isDestructive?(input: TInput): boolean
|
|
634
636
|
isConcurrencySafe?(input: TInput): boolean
|
|
635
637
|
|
|
638
|
+
/**
|
|
639
|
+
* Opt-in ordering boundary in a direct model tool-call batch. Earlier
|
|
640
|
+
* calls settle before this call starts; later calls wait for this call
|
|
641
|
+
* to settle (including failed results). Defaults to false. Independent
|
|
642
|
+
* calls between barriers retain their existing concurrency-safe behavior.
|
|
643
|
+
* Nested dispatch is owned by its enclosing call, not separately queued;
|
|
644
|
+
* mark the enclosing tool as a barrier to isolate its nested operations.
|
|
645
|
+
* Deadlines still abandon uncooperative tools: settlement does not prove
|
|
646
|
+
* their external effects have stopped, and does not imply success.
|
|
647
|
+
*/
|
|
648
|
+
executionBarrier?: boolean
|
|
649
|
+
|
|
636
650
|
/**
|
|
637
651
|
* Where this tool came from, when it did not come from here.
|
|
638
652
|
*
|
|
@@ -763,6 +777,8 @@ export interface ToolRegistryContract {
|
|
|
763
777
|
suspendAll(): void
|
|
764
778
|
hasSuspended(): boolean
|
|
765
779
|
searchDeferred(query: string): ToolDefinition[]
|
|
780
|
+
/** Ranked active matches, when this registry supports active-tool discovery. */
|
|
781
|
+
searchActive?(query: string): ToolDefinition[]
|
|
766
782
|
getCallableTools(toolNames?: string[]): ToolDefinition[]
|
|
767
783
|
|
|
768
784
|
/**
|
|
@@ -22,6 +22,8 @@ export type ToolCallView =
|
|
|
22
22
|
readonly label: string
|
|
23
23
|
/** Render this complete authored label without adding the registry name. */
|
|
24
24
|
readonly presentation?: 'activity'
|
|
25
|
+
/** Successful observations may be grouped by hosts without discarding output. */
|
|
26
|
+
readonly activity?: 'exploration'
|
|
25
27
|
/** A successful result may add no information beyond the completed call row. */
|
|
26
28
|
readonly visibility?: 'hidden'
|
|
27
29
|
}
|
|
@@ -32,6 +34,8 @@ export type ToolCallView =
|
|
|
32
34
|
*/
|
|
33
35
|
| {
|
|
34
36
|
readonly kind: 'diff'
|
|
37
|
+
/** Optional operation summary, distinct from the file path. */
|
|
38
|
+
readonly label?: string
|
|
35
39
|
readonly path?: string
|
|
36
40
|
readonly before: string
|
|
37
41
|
readonly after: string
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/** Clone JSON data without invoking getters or silently dropping values. */
|
|
2
|
+
export function cloneJsonValue(value: unknown, freeze: boolean, path = '$'): unknown {
|
|
3
|
+
const active = new WeakSet<object>()
|
|
4
|
+
const copies = new WeakMap<object, object>()
|
|
5
|
+
|
|
6
|
+
const clone = (candidate: unknown, at: string): unknown => {
|
|
7
|
+
if (candidate === null || typeof candidate === 'string' || typeof candidate === 'boolean') {
|
|
8
|
+
return candidate
|
|
9
|
+
}
|
|
10
|
+
if (typeof candidate === 'number') {
|
|
11
|
+
if (!Number.isFinite(candidate) || Object.is(candidate, -0)) {
|
|
12
|
+
throw new TypeError(`${at} must be a finite JSON number`)
|
|
13
|
+
}
|
|
14
|
+
return candidate
|
|
15
|
+
}
|
|
16
|
+
if (typeof candidate !== 'object') {
|
|
17
|
+
throw new TypeError(`${at} must be a JSON value, not ${typeof candidate}`)
|
|
18
|
+
}
|
|
19
|
+
if (active.has(candidate)) throw new TypeError(`${at} contains a cycle`)
|
|
20
|
+
const existing = copies.get(candidate)
|
|
21
|
+
if (existing) return existing
|
|
22
|
+
|
|
23
|
+
active.add(candidate)
|
|
24
|
+
try {
|
|
25
|
+
if (Array.isArray(candidate)) {
|
|
26
|
+
const extra = Reflect.ownKeys(candidate).filter(
|
|
27
|
+
(key) => key !== 'length' && (typeof key !== 'string' || !/^(0|[1-9]\d*)$/.test(key)),
|
|
28
|
+
)
|
|
29
|
+
if (extra.length > 0) throw new TypeError(`${at} has non-JSON array properties`)
|
|
30
|
+
const result: unknown[] = new Array(candidate.length)
|
|
31
|
+
copies.set(candidate, result)
|
|
32
|
+
for (let index = 0; index < candidate.length; index++) {
|
|
33
|
+
const descriptor = Object.getOwnPropertyDescriptor(candidate, String(index))
|
|
34
|
+
if (!descriptor) throw new TypeError(`${at}[${index}] is a sparse array hole`)
|
|
35
|
+
if (!descriptor.enumerable || !('value' in descriptor)) {
|
|
36
|
+
throw new TypeError(`${at}[${index}] must be an enumerable data property`)
|
|
37
|
+
}
|
|
38
|
+
result[index] = clone(descriptor.value, `${at}[${index}]`)
|
|
39
|
+
}
|
|
40
|
+
if (freeze) Object.freeze(result)
|
|
41
|
+
return result
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const prototype = Object.getPrototypeOf(candidate)
|
|
45
|
+
if (prototype !== Object.prototype && prototype !== null) {
|
|
46
|
+
throw new TypeError(`${at} must be a plain JSON object`)
|
|
47
|
+
}
|
|
48
|
+
// JSON does not preserve prototypes. Canonicalize both admitted plain
|
|
49
|
+
// shapes to an ordinary object so a disk checkpoint round-trip compares
|
|
50
|
+
// equal to a fresh preparation of the same semantic value. Properties
|
|
51
|
+
// are still defined explicitly, so a literal "__proto__" key remains
|
|
52
|
+
// data rather than changing this object's prototype.
|
|
53
|
+
const result: Record<string, unknown> = {}
|
|
54
|
+
copies.set(candidate, result)
|
|
55
|
+
for (const key of Reflect.ownKeys(candidate)) {
|
|
56
|
+
if (typeof key !== 'string') throw new TypeError(`${at} has a symbol property`)
|
|
57
|
+
const descriptor = Object.getOwnPropertyDescriptor(candidate, key)
|
|
58
|
+
if (!descriptor?.enumerable || !('value' in descriptor)) {
|
|
59
|
+
throw new TypeError(`${at}.${key} must be an enumerable data property`)
|
|
60
|
+
}
|
|
61
|
+
Object.defineProperty(result, key, {
|
|
62
|
+
value: clone(descriptor.value, `${at}.${key}`),
|
|
63
|
+
enumerable: true,
|
|
64
|
+
writable: !freeze,
|
|
65
|
+
configurable: !freeze,
|
|
66
|
+
})
|
|
67
|
+
}
|
|
68
|
+
if (freeze) Object.freeze(result)
|
|
69
|
+
return result
|
|
70
|
+
} finally {
|
|
71
|
+
active.delete(candidate)
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
return clone(value, path)
|
|
76
|
+
}
|