@namzu/sdk 51.1.0 → 52.1.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 +119 -0
- package/dist/agents/QueryAgent.d.ts.map +1 -1
- package/dist/agents/QueryAgent.js +2 -0
- package/dist/agents/QueryAgent.js.map +1 -1
- package/dist/agents/SupervisorAgent.d.ts +1 -1
- package/dist/agents/SupervisorAgent.d.ts.map +1 -1
- package/dist/agents/SupervisorAgent.js.map +1 -1
- package/dist/agents/examples/SupervisorAgent.d.ts +42 -0
- package/dist/agents/examples/SupervisorAgent.d.ts.map +1 -1
- package/dist/agents/examples/SupervisorAgent.js +80 -4
- package/dist/agents/examples/SupervisorAgent.js.map +1 -1
- package/dist/agents/index.d.ts +1 -1
- package/dist/agents/index.d.ts.map +1 -1
- package/dist/agents/index.js.map +1 -1
- package/dist/authorization/protected-paths.d.ts +36 -0
- package/dist/authorization/protected-paths.d.ts.map +1 -0
- package/dist/authorization/protected-paths.js +107 -0
- package/dist/authorization/protected-paths.js.map +1 -0
- package/dist/authorization/readonly-commands.d.ts +39 -0
- package/dist/authorization/readonly-commands.d.ts.map +1 -0
- package/dist/authorization/readonly-commands.js +797 -0
- package/dist/authorization/readonly-commands.js.map +1 -0
- package/dist/authorization/readonly-flags.d.ts +19 -0
- package/dist/authorization/readonly-flags.d.ts.map +1 -0
- package/dist/authorization/readonly-flags.js +178 -0
- package/dist/authorization/readonly-flags.js.map +1 -0
- package/dist/authorization/removal.d.ts +52 -0
- package/dist/authorization/removal.d.ts.map +1 -0
- package/dist/authorization/removal.js +283 -0
- package/dist/authorization/removal.js.map +1 -0
- package/dist/authorization/shell-paths.d.ts +66 -0
- package/dist/authorization/shell-paths.d.ts.map +1 -0
- package/dist/authorization/shell-paths.js +697 -0
- package/dist/authorization/shell-paths.js.map +1 -0
- package/dist/bridge/acp/update.d.ts.map +1 -1
- package/dist/bridge/acp/update.js +1 -0
- package/dist/bridge/acp/update.js.map +1 -1
- package/dist/compaction/context-window.d.ts +24 -0
- package/dist/compaction/context-window.d.ts.map +1 -1
- package/dist/compaction/context-window.js +34 -0
- package/dist/compaction/context-window.js.map +1 -1
- package/dist/compaction/manual.d.ts.map +1 -1
- package/dist/compaction/manual.js +10 -2
- package/dist/compaction/manual.js.map +1 -1
- package/dist/compaction/plan.d.ts +4 -0
- package/dist/compaction/plan.d.ts.map +1 -1
- package/dist/compaction/plan.js +6 -2
- package/dist/compaction/plan.js.map +1 -1
- package/dist/compaction/verifier.d.ts +11 -1
- package/dist/compaction/verifier.d.ts.map +1 -1
- package/dist/compaction/verifier.js +75 -23
- package/dist/compaction/verifier.js.map +1 -1
- package/dist/config/runtime.d.ts +55 -7
- package/dist/config/runtime.d.ts.map +1 -1
- package/dist/config/runtime.js +23 -2
- package/dist/config/runtime.js.map +1 -1
- package/dist/connector/web/guarded-fetch.d.ts.map +1 -1
- package/dist/connector/web/guarded-fetch.js +24 -0
- package/dist/connector/web/guarded-fetch.js.map +1 -1
- package/dist/connector/web/index.d.ts +1 -1
- package/dist/connector/web/index.d.ts.map +1 -1
- package/dist/connector/web/page.d.ts +59 -0
- package/dist/connector/web/page.d.ts.map +1 -0
- package/dist/connector/web/page.js +112 -0
- package/dist/connector/web/page.js.map +1 -0
- package/dist/connector/web/types.d.ts +47 -0
- package/dist/connector/web/types.d.ts.map +1 -1
- package/dist/connector/web/types.js.map +1 -1
- package/dist/constants/continuation.d.ts +8 -0
- package/dist/constants/continuation.d.ts.map +1 -1
- package/dist/constants/continuation.js +8 -0
- package/dist/constants/continuation.js.map +1 -1
- package/dist/constants/plugin/index.d.ts +1 -1
- package/dist/constants/plugin/index.d.ts.map +1 -1
- package/dist/constants/plugin/index.js +1 -1
- package/dist/constants/plugin/index.js.map +1 -1
- package/dist/contracts/a2a.d.ts +2 -2
- package/dist/manager/agent/lifecycle.d.ts +7 -0
- package/dist/manager/agent/lifecycle.d.ts.map +1 -1
- package/dist/manager/agent/lifecycle.js +11 -2
- package/dist/manager/agent/lifecycle.js.map +1 -1
- package/dist/manager/session/turn-recorder.d.ts.map +1 -1
- package/dist/manager/session/turn-recorder.js +4 -2
- package/dist/manager/session/turn-recorder.js.map +1 -1
- package/dist/plugin/index.d.ts +1 -1
- package/dist/plugin/index.d.ts.map +1 -1
- package/dist/plugin/index.js +1 -1
- package/dist/plugin/index.js.map +1 -1
- package/dist/plugin/lifecycle.d.ts +6 -0
- package/dist/plugin/lifecycle.d.ts.map +1 -1
- package/dist/plugin/lifecycle.js +98 -114
- package/dist/plugin/lifecycle.js.map +1 -1
- package/dist/plugin/shell-hook.d.ts +90 -22
- package/dist/plugin/shell-hook.d.ts.map +1 -1
- package/dist/plugin/shell-hook.js +434 -41
- package/dist/plugin/shell-hook.js.map +1 -1
- package/dist/provider/capabilities.d.ts +9 -0
- package/dist/provider/capabilities.d.ts.map +1 -1
- package/dist/provider/capabilities.js +15 -0
- package/dist/provider/capabilities.js.map +1 -1
- package/dist/provider/errors.d.ts.map +1 -1
- package/dist/provider/errors.js +13 -0
- package/dist/provider/errors.js.map +1 -1
- package/dist/provider/fallback.d.ts.map +1 -1
- package/dist/provider/fallback.js +10 -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/image-input-refusal.d.ts +9 -0
- package/dist/provider/image-input-refusal.d.ts.map +1 -0
- package/dist/provider/image-input-refusal.js +54 -0
- package/dist/provider/image-input-refusal.js.map +1 -0
- package/dist/provider/index.d.ts +2 -1
- package/dist/provider/index.d.ts.map +1 -1
- package/dist/provider/index.js +2 -1
- package/dist/provider/index.js.map +1 -1
- package/dist/provider/retry.d.ts +7 -2
- package/dist/provider/retry.d.ts.map +1 -1
- package/dist/provider/retry.js +38 -4
- package/dist/provider/retry.js.map +1 -1
- package/dist/public-runtime.d.ts +5 -2
- package/dist/public-runtime.d.ts.map +1 -1
- package/dist/public-runtime.js +5 -2
- package/dist/public-runtime.js.map +1 -1
- package/dist/public-types.d.ts +2 -2
- package/dist/public-types.d.ts.map +1 -1
- package/dist/runtime/jobs/registry.d.ts +21 -0
- package/dist/runtime/jobs/registry.d.ts.map +1 -1
- package/dist/runtime/jobs/registry.js +15 -2
- package/dist/runtime/jobs/registry.js.map +1 -1
- package/dist/runtime/query/deferred-sandbox.d.ts +54 -0
- package/dist/runtime/query/deferred-sandbox.d.ts.map +1 -0
- package/dist/runtime/query/deferred-sandbox.js +75 -0
- package/dist/runtime/query/deferred-sandbox.js.map +1 -0
- package/dist/runtime/query/executor/tool-call-admission.d.ts +10 -0
- package/dist/runtime/query/executor/tool-call-admission.d.ts.map +1 -1
- package/dist/runtime/query/executor/tool-call-admission.js +74 -13
- package/dist/runtime/query/executor/tool-call-admission.js.map +1 -1
- package/dist/runtime/query/executor.d.ts +51 -2
- package/dist/runtime/query/executor.d.ts.map +1 -1
- package/dist/runtime/query/executor.js +214 -9
- package/dist/runtime/query/executor.js.map +1 -1
- package/dist/runtime/query/finalize-turn.d.ts +6 -0
- package/dist/runtime/query/finalize-turn.d.ts.map +1 -1
- package/dist/runtime/query/finalize-turn.js +1 -1
- package/dist/runtime/query/finalize-turn.js.map +1 -1
- package/dist/runtime/query/index.d.ts +29 -0
- package/dist/runtime/query/index.d.ts.map +1 -1
- package/dist/runtime/query/index.js +108 -28
- package/dist/runtime/query/index.js.map +1 -1
- package/dist/runtime/query/iteration/index.d.ts +57 -0
- package/dist/runtime/query/iteration/index.d.ts.map +1 -1
- package/dist/runtime/query/iteration/index.js +380 -28
- package/dist/runtime/query/iteration/index.js.map +1 -1
- package/dist/runtime/query/iteration/phases/compaction-breaker.d.ts +61 -0
- package/dist/runtime/query/iteration/phases/compaction-breaker.d.ts.map +1 -0
- package/dist/runtime/query/iteration/phases/compaction-breaker.js +94 -0
- package/dist/runtime/query/iteration/phases/compaction-breaker.js.map +1 -0
- package/dist/runtime/query/iteration/phases/compaction.d.ts +42 -1
- package/dist/runtime/query/iteration/phases/compaction.d.ts.map +1 -1
- package/dist/runtime/query/iteration/phases/compaction.js +203 -23
- package/dist/runtime/query/iteration/phases/compaction.js.map +1 -1
- package/dist/runtime/query/iteration/phases/context.d.ts +10 -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 +165 -2
- package/dist/runtime/query/iteration/phases/tool-review.js.map +1 -1
- package/dist/runtime/query/iteration/provider-rejected-image.d.ts +21 -1
- package/dist/runtime/query/iteration/provider-rejected-image.d.ts.map +1 -1
- package/dist/runtime/query/iteration/provider-rejected-image.js +53 -7
- package/dist/runtime/query/iteration/provider-rejected-image.js.map +1 -1
- package/dist/runtime/query/iteration/request-repair.d.ts +108 -0
- package/dist/runtime/query/iteration/request-repair.d.ts.map +1 -0
- package/dist/runtime/query/iteration/request-repair.js +593 -0
- package/dist/runtime/query/iteration/request-repair.js.map +1 -0
- package/dist/runtime/query/iteration/stream-turn.d.ts +6 -0
- package/dist/runtime/query/iteration/stream-turn.d.ts.map +1 -1
- package/dist/runtime/query/iteration/stream-turn.js +2 -2
- package/dist/runtime/query/iteration/stream-turn.js.map +1 -1
- package/dist/runtime/query/path-escalation.d.ts +36 -0
- package/dist/runtime/query/path-escalation.d.ts.map +1 -0
- package/dist/runtime/query/path-escalation.js +184 -0
- package/dist/runtime/query/path-escalation.js.map +1 -0
- package/dist/runtime/query/plugin-hooks.d.ts.map +1 -1
- package/dist/runtime/query/plugin-hooks.js +8 -0
- package/dist/runtime/query/plugin-hooks.js.map +1 -1
- package/dist/runtime/query/reminders.d.ts +35 -0
- package/dist/runtime/query/reminders.d.ts.map +1 -0
- package/dist/runtime/query/reminders.js +7 -0
- package/dist/runtime/query/reminders.js.map +1 -0
- package/dist/runtime/query/request-rich-content.d.ts +5 -1
- package/dist/runtime/query/request-rich-content.d.ts.map +1 -1
- package/dist/runtime/query/request-rich-content.js +67 -25
- package/dist/runtime/query/request-rich-content.js.map +1 -1
- package/dist/runtime/query/resume-pending.d.ts.map +1 -1
- package/dist/runtime/query/resume-pending.js +26 -0
- package/dist/runtime/query/resume-pending.js.map +1 -1
- package/dist/runtime/query/review-policy.d.ts +26 -0
- package/dist/runtime/query/review-policy.d.ts.map +1 -1
- package/dist/runtime/query/review-policy.js +79 -5
- package/dist/runtime/query/review-policy.js.map +1 -1
- package/dist/runtime/query/tool-output-budget.d.ts +46 -0
- package/dist/runtime/query/tool-output-budget.d.ts.map +1 -1
- package/dist/runtime/query/tool-output-budget.js +85 -1
- package/dist/runtime/query/tool-output-budget.js.map +1 -1
- package/dist/runtime/query/tooling.d.ts +1 -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/session/paths.d.ts +5 -1
- package/dist/session/paths.d.ts.map +1 -1
- package/dist/session/paths.js +8 -0
- package/dist/session/paths.js.map +1 -1
- package/dist/store/memory/disk.d.ts.map +1 -1
- package/dist/store/memory/disk.js +2 -2
- package/dist/store/memory/disk.js.map +1 -1
- package/dist/store/memory/markdown.d.ts.map +1 -1
- package/dist/store/memory/markdown.js +2 -2
- package/dist/store/memory/markdown.js.map +1 -1
- package/dist/store/memory/naming.d.ts +9 -0
- package/dist/store/memory/naming.d.ts.map +1 -1
- package/dist/store/memory/naming.js +12 -0
- package/dist/store/memory/naming.js.map +1 -1
- package/dist/tools/builtins/bash.d.ts +30 -1
- package/dist/tools/builtins/bash.d.ts.map +1 -1
- package/dist/tools/builtins/bash.js +170 -26
- package/dist/tools/builtins/bash.js.map +1 -1
- package/dist/tools/builtins/computer-use.d.ts +1 -1
- package/dist/tools/builtins/computer-use.d.ts.map +1 -1
- package/dist/tools/builtins/computer-use.js +12 -5
- package/dist/tools/builtins/computer-use.js.map +1 -1
- package/dist/tools/builtins/content-fingerprint.d.ts +2 -0
- package/dist/tools/builtins/content-fingerprint.d.ts.map +1 -1
- package/dist/tools/builtins/content-fingerprint.js +4 -0
- 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 +60 -18
- package/dist/tools/builtins/edit.js.map +1 -1
- package/dist/tools/builtins/grep.d.ts +8 -1
- package/dist/tools/builtins/grep.d.ts.map +1 -1
- package/dist/tools/builtins/grep.js +152 -33
- package/dist/tools/builtins/grep.js.map +1 -1
- package/dist/tools/builtins/read-file.d.ts +1 -0
- package/dist/tools/builtins/read-file.d.ts.map +1 -1
- package/dist/tools/builtins/read-file.js +44 -5
- package/dist/tools/builtins/read-file.js.map +1 -1
- package/dist/tools/builtins/read-render.d.ts +52 -0
- package/dist/tools/builtins/read-render.d.ts.map +1 -1
- package/dist/tools/builtins/read-render.js +143 -0
- package/dist/tools/builtins/read-render.js.map +1 -1
- package/dist/tools/builtins/web.d.ts +13 -2
- package/dist/tools/builtins/web.d.ts.map +1 -1
- package/dist/tools/builtins/web.js +225 -32
- package/dist/tools/builtins/web.js.map +1 -1
- package/dist/tools/coordinator/ask-user-question.d.ts +2 -0
- package/dist/tools/coordinator/ask-user-question.d.ts.map +1 -1
- package/dist/tools/coordinator/ask-user-question.js +256 -92
- package/dist/tools/coordinator/ask-user-question.js.map +1 -1
- package/dist/tools/coordinator/question-options.d.ts +1 -0
- package/dist/tools/coordinator/question-options.d.ts.map +1 -1
- package/dist/tools/coordinator/question-options.js +6 -1
- package/dist/tools/coordinator/question-options.js.map +1 -1
- package/dist/tools/defineTool.d.ts +4 -1
- package/dist/tools/defineTool.d.ts.map +1 -1
- package/dist/tools/defineTool.js +6 -1
- package/dist/tools/defineTool.js.map +1 -1
- package/dist/tools/paths.d.ts +6 -0
- package/dist/tools/paths.d.ts.map +1 -1
- package/dist/tools/paths.js +1 -1
- package/dist/tools/paths.js.map +1 -1
- package/dist/types/agent/query.d.ts +3 -0
- package/dist/types/agent/query.d.ts.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 +104 -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 +1 -1
- package/dist/types/message/index.d.ts.map +1 -1
- package/dist/types/message/index.js +2 -0
- package/dist/types/message/index.js.map +1 -1
- package/dist/types/plugin/index.d.ts +93 -19
- package/dist/types/plugin/index.d.ts.map +1 -1
- package/dist/types/plugin/index.js +3 -0
- package/dist/types/plugin/index.js.map +1 -1
- package/dist/types/provider/errors.d.ts +19 -0
- package/dist/types/provider/errors.d.ts.map +1 -1
- package/dist/types/provider/errors.js +54 -5
- package/dist/types/provider/errors.js.map +1 -1
- package/dist/types/provider/interface.d.ts +12 -0
- package/dist/types/provider/interface.d.ts.map +1 -1
- package/dist/types/provider/stream.d.ts +1 -1
- package/dist/types/session/config.d.ts +14 -0
- package/dist/types/session/config.d.ts.map +1 -1
- package/dist/types/session/events.d.ts +27 -4
- package/dist/types/session/events.d.ts.map +1 -1
- package/dist/types/session/events.js.map +1 -1
- package/dist/types/session/records.d.ts +9 -9
- package/dist/types/session/records.d.ts.map +1 -1
- package/dist/types/session/records.js +1 -0
- package/dist/types/session/records.js.map +1 -1
- package/dist/types/session/stop-reason.d.ts +5 -0
- package/dist/types/session/stop-reason.d.ts.map +1 -1
- package/dist/types/tool/index.d.ts +52 -0
- package/dist/types/tool/index.d.ts.map +1 -1
- package/dist/types/tool/index.js.map +1 -1
- package/package.json +4 -2
- package/src/agents/QueryAgent.ts +5 -1
- package/src/agents/SupervisorAgent.ts +1 -1
- package/src/agents/examples/SupervisorAgent.ts +217 -106
- package/src/agents/index.ts +1 -1
- package/src/authorization/protected-paths.ts +110 -0
- package/src/authorization/readonly-commands.ts +771 -0
- package/src/authorization/readonly-flags.ts +196 -0
- package/src/authorization/removal.ts +326 -0
- package/src/authorization/shell-paths.ts +927 -0
- package/src/bridge/acp/update.ts +1 -0
- package/src/compaction/context-window.ts +41 -0
- package/src/compaction/manual.ts +10 -2
- package/src/compaction/plan.ts +11 -2
- package/src/compaction/verifier.ts +84 -22
- package/src/config/runtime.ts +23 -2
- package/src/connector/web/guarded-fetch.ts +26 -0
- package/src/connector/web/index.ts +3 -0
- package/src/connector/web/page.ts +130 -0
- package/src/connector/web/types.ts +47 -0
- package/src/constants/continuation.ts +10 -0
- package/src/constants/plugin/index.ts +1 -1
- package/src/manager/agent/lifecycle.ts +12 -4
- package/src/manager/session/turn-recorder.ts +10 -2
- package/src/plugin/index.ts +1 -0
- package/src/plugin/lifecycle.ts +107 -119
- package/src/plugin/shell-hook.ts +477 -43
- package/src/provider/capabilities.ts +17 -0
- package/src/provider/errors.ts +13 -0
- package/src/provider/fallback.ts +10 -0
- package/src/provider/idle-timeout.ts +5 -0
- package/src/provider/image-input-refusal.ts +54 -0
- package/src/provider/index.ts +2 -0
- package/src/provider/retry.ts +42 -4
- package/src/public-runtime.ts +11 -0
- package/src/public-types.ts +4 -0
- package/src/runtime/jobs/registry.ts +39 -2
- package/src/runtime/query/deferred-sandbox.ts +110 -0
- package/src/runtime/query/executor/tool-call-admission.ts +79 -13
- package/src/runtime/query/executor.ts +267 -11
- package/src/runtime/query/finalize-turn.ts +7 -1
- package/src/runtime/query/index.ts +169 -52
- package/src/runtime/query/iteration/index.ts +439 -35
- package/src/runtime/query/iteration/phases/compaction-breaker.ts +108 -0
- package/src/runtime/query/iteration/phases/compaction.ts +241 -38
- package/src/runtime/query/iteration/phases/context.ts +11 -0
- package/src/runtime/query/iteration/phases/tool-review.ts +177 -2
- package/src/runtime/query/iteration/provider-rejected-image.ts +71 -5
- package/src/runtime/query/iteration/request-repair.ts +743 -0
- package/src/runtime/query/iteration/stream-turn.ts +11 -1
- package/src/runtime/query/path-escalation.ts +204 -0
- package/src/runtime/query/plugin-hooks.ts +8 -0
- package/src/runtime/query/reminders.ts +45 -0
- package/src/runtime/query/request-rich-content.ts +77 -27
- package/src/runtime/query/resume-pending.ts +27 -0
- package/src/runtime/query/review-policy.ts +106 -5
- package/src/runtime/query/tool-output-budget.ts +115 -1
- package/src/runtime/query/tooling.ts +6 -0
- package/src/session/paths.ts +11 -1
- package/src/store/memory/disk.ts +2 -1
- package/src/store/memory/markdown.ts +2 -1
- package/src/store/memory/naming.ts +13 -0
- package/src/tools/builtins/bash.ts +203 -34
- package/src/tools/builtins/computer-use.ts +13 -4
- package/src/tools/builtins/content-fingerprint.ts +5 -0
- package/src/tools/builtins/edit.ts +69 -19
- package/src/tools/builtins/grep.ts +159 -38
- package/src/tools/builtins/read-file.ts +48 -5
- package/src/tools/builtins/read-render.ts +193 -0
- package/src/tools/builtins/web.ts +258 -33
- package/src/tools/coordinator/ask-user-question.ts +309 -103
- package/src/tools/coordinator/question-options.ts +8 -1
- package/src/tools/defineTool.ts +11 -2
- package/src/tools/paths.ts +1 -1
- package/src/types/agent/query.ts +3 -0
- package/src/types/errors/catalog.ts +1 -1
- package/src/types/hitl/index.ts +104 -0
- package/src/types/message/index.ts +2 -0
- package/src/types/plugin/index.ts +101 -18
- package/src/types/provider/errors.ts +66 -5
- package/src/types/provider/interface.ts +13 -0
- package/src/types/provider/stream.ts +1 -1
- package/src/types/session/config.ts +14 -0
- package/src/types/session/events.ts +32 -4
- package/src/types/session/records.ts +1 -0
- package/src/types/session/stop-reason.ts +5 -0
- package/src/types/tool/index.ts +53 -2
|
@@ -104,6 +104,13 @@ import { AwaitedJobs } from '../jobs/awaited-jobs.js'
|
|
|
104
104
|
import type { BackgroundJobRegistry } from '../jobs/registry.js'
|
|
105
105
|
import { catchUpFromCursor, settlePreStartCancellation } from './cancelled-before-start.js'
|
|
106
106
|
import { CheckpointManager, findPendingCheckpoint } from './checkpoint.js'
|
|
107
|
+
import {
|
|
108
|
+
type DeferredSandbox,
|
|
109
|
+
type SandboxAcquireMode,
|
|
110
|
+
type SandboxAcquisitionStop,
|
|
111
|
+
SandboxAcquisitionStopped,
|
|
112
|
+
createDeferredSandbox,
|
|
113
|
+
} from './deferred-sandbox.js'
|
|
107
114
|
import type { EventTranslator } from './events.js'
|
|
108
115
|
import { finalizeTurn } from './finalize-turn.js'
|
|
109
116
|
import { GuardCoordinator } from './guard.js'
|
|
@@ -331,6 +338,17 @@ export interface QueryParams {
|
|
|
331
338
|
maxToolConcurrency?: number
|
|
332
339
|
/** Per-turn cumulative tool attempt limit, including nested calls and retries. Unset is unlimited. Re-supply on resume; durable reservations are never refunded. */
|
|
333
340
|
maxToolCalls?: number
|
|
341
|
+
/**
|
|
342
|
+
* How many times in a row the loop nudges the model to carry on after a
|
|
343
|
+
* reply was cut off at its output limit, before the turn stops with an
|
|
344
|
+
* error naming the limit. The count restarts after any call that finishes
|
|
345
|
+
* on its own.
|
|
346
|
+
*
|
|
347
|
+
* Unset keeps the earlier behaviour: nudge every time, bounded only by
|
|
348
|
+
* `maxIterations`. Opt-in because a cap is a stop a host did not have
|
|
349
|
+
* before; `0` stops at the first cut-off.
|
|
350
|
+
*/
|
|
351
|
+
maxOutputContinuations?: number
|
|
334
352
|
|
|
335
353
|
/**
|
|
336
354
|
* Model-visible size cap for a single tool result. Over-budget output is
|
|
@@ -339,6 +357,18 @@ export interface QueryParams {
|
|
|
339
357
|
* agent decides the rest is worth re-reading. Set `0` to disable.
|
|
340
358
|
*/
|
|
341
359
|
maxToolOutputChars?: number
|
|
360
|
+
/**
|
|
361
|
+
* Cap on the COMBINED model-visible text of every tool result one assistant
|
|
362
|
+
* message produced. Defaults to {@link DEFAULT_MAX_TOOL_OUTPUT_CHARS_PER_MESSAGE}
|
|
363
|
+
* (200,000 characters); `0` disables it. When a batch exceeds it, the
|
|
364
|
+
* largest results are replaced, largest first, by a short preview that
|
|
365
|
+
* names where the full text was kept, until the batch fits. The
|
|
366
|
+
* replacement is written into the result before it reaches the history, so
|
|
367
|
+
* it never changes afterwards and the prompt-cache prefix stays stable.
|
|
368
|
+
* Tools that bound their own output (`selfLimitingOutput`) are never
|
|
369
|
+
* replaced.
|
|
370
|
+
*/
|
|
371
|
+
maxToolOutputCharsPerMessage?: number
|
|
342
372
|
/**
|
|
343
373
|
* Screens to run against every tool result. The turn builds its manager
|
|
344
374
|
* from `toolsets` and gives it this policy.
|
|
@@ -726,6 +756,13 @@ export interface QueryParams {
|
|
|
726
756
|
* started. See `BaseAgentConfig.inboundMessages` for what it closes.
|
|
727
757
|
*/
|
|
728
758
|
inboundMessages?: () => import('../../types/message/index.js').Message[]
|
|
759
|
+
/**
|
|
760
|
+
* Hidden reminders a host feeds into the conversation, asked for before
|
|
761
|
+
* every model request of the turn. Opt-in: omitted, a turn carries none.
|
|
762
|
+
* See {@link ReminderSource}.
|
|
763
|
+
*/
|
|
764
|
+
reminders?: import('./reminders.js').ReminderSource
|
|
765
|
+
|
|
729
766
|
/**
|
|
730
767
|
* Wake a background-task hold when operator input is available, without draining it.
|
|
731
768
|
* Resolve immediately if input is already pending. Otherwise wait for its arrival;
|
|
@@ -1407,6 +1444,11 @@ export async function* query(params: QueryParams): AsyncGenerator<SessionEvent,
|
|
|
1407
1444
|
...(params.maxToolOutputChars !== undefined
|
|
1408
1445
|
? { maxToolOutputChars: params.maxToolOutputChars }
|
|
1409
1446
|
: {}),
|
|
1447
|
+
...(params.maxToolOutputCharsPerMessage !== undefined
|
|
1448
|
+
? {
|
|
1449
|
+
maxToolOutputCharsPerMessage: params.maxToolOutputCharsPerMessage,
|
|
1450
|
+
}
|
|
1451
|
+
: {}),
|
|
1410
1452
|
...(params.toolResultGuardrails !== undefined
|
|
1411
1453
|
? { toolResultGuardrails: params.toolResultGuardrails }
|
|
1412
1454
|
: {}),
|
|
@@ -1474,9 +1516,9 @@ export async function* query(params: QueryParams): AsyncGenerator<SessionEvent,
|
|
|
1474
1516
|
// Normalised once, defaults applied. A host that passes a partial
|
|
1475
1517
|
// object — a strategy and a window, nothing else — used to reach the
|
|
1476
1518
|
// phase with `triggerThreshold` undefined, and `usage < undefined` is
|
|
1477
|
-
// false: the pass ran on every iteration
|
|
1478
|
-
//
|
|
1479
|
-
//
|
|
1519
|
+
// false: the pass ran on every iteration. An absent threshold now means
|
|
1520
|
+
// the derived trigger (`resolveTriggerThreshold`), resolved where it is
|
|
1521
|
+
// compared.
|
|
1480
1522
|
const compactionConfig = params.compactionConfig
|
|
1481
1523
|
? CompactionConfigSchema.parse(params.compactionConfig)
|
|
1482
1524
|
: undefined
|
|
@@ -1635,7 +1677,11 @@ export async function* query(params: QueryParams): AsyncGenerator<SessionEvent,
|
|
|
1635
1677
|
// would leak exactly that way.
|
|
1636
1678
|
...(params.repeatCallAdvisory === false ? {} : { repeatCalls: new RepeatCallTracker() }),
|
|
1637
1679
|
compactionConfig,
|
|
1680
|
+
...(params.maxOutputContinuations !== undefined
|
|
1681
|
+
? { maxOutputContinuations: params.maxOutputContinuations }
|
|
1682
|
+
: {}),
|
|
1638
1683
|
...(params.inboundMessages ? { inboundMessages: params.inboundMessages } : {}),
|
|
1684
|
+
...(params.reminders ? { reminders: params.reminders } : {}),
|
|
1639
1685
|
...(params.durableInbound ? { durableInbound: params.durableInbound } : {}),
|
|
1640
1686
|
...(params.resumeFromCheckpoint ? { resumedInput: queuedForThisRun } : {}),
|
|
1641
1687
|
...(params.waitForInbound ? { waitForInbound: params.waitForInbound } : {}),
|
|
@@ -1666,6 +1712,8 @@ export async function* query(params: QueryParams): AsyncGenerator<SessionEvent,
|
|
|
1666
1712
|
agentBus: params.agentBus,
|
|
1667
1713
|
verificationGate,
|
|
1668
1714
|
pluginManager: params.pluginManager,
|
|
1715
|
+
...(params.parentSessionId !== undefined ? { parentSessionId: params.parentSessionId } : {}),
|
|
1716
|
+
...(params.parentTurnId !== undefined ? { parentTurnId: params.parentTurnId } : {}),
|
|
1669
1717
|
})
|
|
1670
1718
|
|
|
1671
1719
|
const tracer = getTracer()
|
|
@@ -1784,6 +1832,10 @@ export async function* query(params: QueryParams): AsyncGenerator<SessionEvent,
|
|
|
1784
1832
|
})
|
|
1785
1833
|
|
|
1786
1834
|
let sandbox: Sandbox | undefined
|
|
1835
|
+
/** Set only for `sandbox.acquire: 'concurrent' | 'on-first-use'`. */
|
|
1836
|
+
let deferredSandbox: DeferredSandbox | undefined
|
|
1837
|
+
/** How a stopped acquisition settles the turn; set where the provider is known. */
|
|
1838
|
+
let applyAcquisitionStop: (acquisition: SandboxAcquisitionStop) => void = () => {}
|
|
1787
1839
|
// Decided during checkpoint restore, executed after the sandbox
|
|
1788
1840
|
// exists — the approved tools may well need it.
|
|
1789
1841
|
let pendingResume: PendingResumePlan | null = null
|
|
@@ -2259,6 +2311,20 @@ export async function* query(params: QueryParams): AsyncGenerator<SessionEvent,
|
|
|
2259
2311
|
yield* eventTranslator.drainPending()
|
|
2260
2312
|
}
|
|
2261
2313
|
|
|
2314
|
+
// Checked whether or not a provider is present: a host that mistypes the
|
|
2315
|
+
// option should hear about it before it wires a provider in, not after.
|
|
2316
|
+
const acquireMode: SandboxAcquireMode = turnConfig.sandbox?.acquire ?? 'eager'
|
|
2317
|
+
if (
|
|
2318
|
+
acquireMode !== 'eager' &&
|
|
2319
|
+
acquireMode !== 'concurrent' &&
|
|
2320
|
+
acquireMode !== 'on-first-use'
|
|
2321
|
+
) {
|
|
2322
|
+
throw new NamzuError({
|
|
2323
|
+
code: 'invalid_config',
|
|
2324
|
+
message: `sandbox.acquire must be 'eager', 'concurrent' or 'on-first-use'; received ${String(acquireMode)}`,
|
|
2325
|
+
details: { acquire: String(acquireMode) },
|
|
2326
|
+
})
|
|
2327
|
+
}
|
|
2262
2328
|
// --- Sandbox lifecycle: create before iteration loop ---
|
|
2263
2329
|
if (params.sandboxProvider) {
|
|
2264
2330
|
const rootAtCwd = turnConfig.sandbox?.workspace === 'working-directory'
|
|
@@ -2290,40 +2356,60 @@ export async function* query(params: QueryParams): AsyncGenerator<SessionEvent,
|
|
|
2290
2356
|
},
|
|
2291
2357
|
})
|
|
2292
2358
|
}
|
|
2293
|
-
const
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
? {
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
|
|
2359
|
+
const sandboxProvider = params.sandboxProvider
|
|
2360
|
+
const startAcquisition = (signal: AbortSignal) =>
|
|
2361
|
+
acquireSandbox({
|
|
2362
|
+
provider: sandboxProvider,
|
|
2363
|
+
config: {
|
|
2364
|
+
...(rootAtCwd ? { workingDirectory: ctx.cwd } : {}),
|
|
2365
|
+
...(rootAtCwd && params.additionalDirectories?.length
|
|
2366
|
+
? { additionalDirectories: params.additionalDirectories }
|
|
2367
|
+
: {}),
|
|
2368
|
+
timeoutMs: turnConfig.sandbox?.timeoutMs,
|
|
2369
|
+
memoryLimitMb: turnConfig.sandbox?.memoryLimitMb,
|
|
2370
|
+
maxProcesses: turnConfig.sandbox?.maxProcesses,
|
|
2371
|
+
},
|
|
2372
|
+
signal,
|
|
2373
|
+
timeoutMs: guard.remainingUntilTimeoutMs(),
|
|
2374
|
+
teardownTimeoutMs: sandboxTeardownTimeoutMs,
|
|
2375
|
+
onLateTeardown: (result) => {
|
|
2376
|
+
if (result.kind === 'destroyed') {
|
|
2377
|
+
ctx.log.info('Late sandbox allocation was destroyed after the turn stopped', {
|
|
2378
|
+
[NAMZU.TURN_ID]: ctx.turnId,
|
|
2379
|
+
})
|
|
2380
|
+
return
|
|
2381
|
+
}
|
|
2382
|
+
ctx.log.error('Late sandbox allocation did not stop cleanly', {
|
|
2310
2383
|
[NAMZU.TURN_ID]: ctx.turnId,
|
|
2384
|
+
...errorAttributes(result.error),
|
|
2311
2385
|
})
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
|
|
2317
|
-
|
|
2318
|
-
|
|
2319
|
-
|
|
2320
|
-
|
|
2386
|
+
},
|
|
2387
|
+
})
|
|
2388
|
+
const publishSandbox = async (acquired: Sandbox): Promise<void> => {
|
|
2389
|
+
sandbox = acquired
|
|
2390
|
+
toolExecutor.setSandbox(acquired)
|
|
2391
|
+
|
|
2392
|
+
await eventTranslator.emitEvent({
|
|
2393
|
+
type: 'sandbox_created',
|
|
2394
|
+
turnId: ctx.turnId,
|
|
2395
|
+
sandboxId: acquired.id,
|
|
2396
|
+
environment: acquired.environment,
|
|
2397
|
+
})
|
|
2398
|
+
}
|
|
2399
|
+
const logSandboxCreated = (acquired: Sandbox): void => {
|
|
2400
|
+
ctx.log.info('Sandbox created for run', {
|
|
2401
|
+
'namzu.sandbox.id': acquired.id,
|
|
2402
|
+
'namzu.execution.environment': acquired.environment,
|
|
2403
|
+
'namzu.runtime.root_dir': acquired.rootDir,
|
|
2404
|
+
})
|
|
2405
|
+
}
|
|
2406
|
+
applyAcquisitionStop = (acquisition) => {
|
|
2321
2407
|
if (acquisition.createPending) {
|
|
2322
2408
|
ctx.log.warn(
|
|
2323
2409
|
'Sandbox creation was unsettled when the turn stopped; any returned handle will be released, but a remote allocation hidden behind a lost response requires provider-side reconciliation or a fleet reaper',
|
|
2324
2410
|
{
|
|
2325
2411
|
[NAMZU.TURN_ID]: ctx.turnId,
|
|
2326
|
-
'namzu.sandbox.provider_id':
|
|
2412
|
+
'namzu.sandbox.provider_id': sandboxProvider.id,
|
|
2327
2413
|
},
|
|
2328
2414
|
)
|
|
2329
2415
|
}
|
|
@@ -2333,32 +2419,40 @@ export async function* query(params: QueryParams): AsyncGenerator<SessionEvent,
|
|
|
2333
2419
|
ctx.recorder.setStopReason('timeout')
|
|
2334
2420
|
ctx.log.warn('Sandbox creation exhausted the turn timeout', {
|
|
2335
2421
|
[NAMZU.TURN_ID]: ctx.turnId,
|
|
2336
|
-
'namzu.sandbox.provider_id':
|
|
2422
|
+
'namzu.sandbox.provider_id': sandboxProvider.id,
|
|
2337
2423
|
...errorAttributes(acquisition.error),
|
|
2338
2424
|
})
|
|
2339
2425
|
}
|
|
2340
|
-
yield* resultAssembler.completeTurn(rootSpan)
|
|
2341
|
-
// The turn HAS settled, so the outer `finally` must not read
|
|
2342
|
-
// this as an abandonment — it would persist a second time.
|
|
2343
|
-
settled = true
|
|
2344
|
-
return await resultAssembler.finalize()
|
|
2345
2426
|
}
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2427
|
+
if (acquireMode === 'eager') {
|
|
2428
|
+
const acquisition = await startAcquisition(ctx.abortController.signal)
|
|
2429
|
+
if (acquisition.kind !== 'created') {
|
|
2430
|
+
applyAcquisitionStop(acquisition)
|
|
2431
|
+
yield* resultAssembler.completeTurn(rootSpan)
|
|
2432
|
+
// The turn HAS settled, so the outer `finally` must not read
|
|
2433
|
+
// this as an abandonment — it would persist a second time.
|
|
2434
|
+
settled = true
|
|
2435
|
+
return await resultAssembler.finalize()
|
|
2436
|
+
}
|
|
2437
|
+
await publishSandbox(acquisition.sandbox)
|
|
2438
|
+
yield* eventTranslator.drainPending()
|
|
2439
|
+
logSandboxCreated(acquisition.sandbox)
|
|
2440
|
+
} else {
|
|
2441
|
+
// The handle is published, and `sandbox_created` emitted, when
|
|
2442
|
+
// the provider answers. Until then the executor holds tool
|
|
2443
|
+
// admission on the gate, so nothing runs without it.
|
|
2444
|
+
const deferred = createDeferredSandbox({
|
|
2445
|
+
turnSignal: ctx.abortController.signal,
|
|
2446
|
+
acquire: startAcquisition,
|
|
2447
|
+
publish: async (acquired) => {
|
|
2448
|
+
await publishSandbox(acquired)
|
|
2449
|
+
logSandboxCreated(acquired)
|
|
2450
|
+
},
|
|
2451
|
+
})
|
|
2452
|
+
deferredSandbox = deferred
|
|
2453
|
+
toolExecutor.setSandboxGate(() => deferred.ensure())
|
|
2454
|
+
if (acquireMode === 'concurrent') deferred.start()
|
|
2455
|
+
}
|
|
2362
2456
|
}
|
|
2363
2457
|
|
|
2364
2458
|
// Before the first model call: the cheapest place to refuse, since
|
|
@@ -2484,16 +2578,35 @@ export async function* query(params: QueryParams): AsyncGenerator<SessionEvent,
|
|
|
2484
2578
|
|
|
2485
2579
|
yield* iterationOrchestrator.runLoop()
|
|
2486
2580
|
|
|
2581
|
+
// A turn that never needed the sandbox still settles it: a failure or
|
|
2582
|
+
// a timeout ends the turn the way an eager acquisition would have, and
|
|
2583
|
+
// a handle that arrives after that is released by the lifecycle.
|
|
2584
|
+
if (deferredSandbox) {
|
|
2585
|
+
await deferredSandbox.settle()
|
|
2586
|
+
yield* eventTranslator.drainPending()
|
|
2587
|
+
}
|
|
2588
|
+
|
|
2487
2589
|
yield* finalizeTurn({
|
|
2488
2590
|
ctx,
|
|
2489
2591
|
params,
|
|
2490
2592
|
eventTranslator,
|
|
2491
2593
|
takeSteps: () => iterationOrchestrator.getSteps(),
|
|
2594
|
+
turnEndHooksFired: () => iterationOrchestrator.turnEndHooksFired,
|
|
2492
2595
|
workingStateManager,
|
|
2493
2596
|
resultAssembler,
|
|
2494
2597
|
rootSpan,
|
|
2495
2598
|
})
|
|
2496
2599
|
} catch (err) {
|
|
2600
|
+
// A deferred acquisition stopped (cancelled, or out of time) and the
|
|
2601
|
+
// turn found out at its first tool call or at its end. Settled the
|
|
2602
|
+
// way the eager path settles it, with nothing else to report.
|
|
2603
|
+
if (err instanceof SandboxAcquisitionStopped) {
|
|
2604
|
+
applyAcquisitionStop(err.acquisition)
|
|
2605
|
+
yield* eventTranslator.drainPending()
|
|
2606
|
+
yield* resultAssembler.completeTurn(rootSpan)
|
|
2607
|
+
settled = true
|
|
2608
|
+
return await resultAssembler.finalize()
|
|
2609
|
+
}
|
|
2497
2610
|
// Another turn is active in this session: nothing of this turn was
|
|
2498
2611
|
// written, so there is nothing to settle. The caller gets the
|
|
2499
2612
|
// refusal itself.
|
|
@@ -2504,6 +2617,10 @@ export async function* query(params: QueryParams): AsyncGenerator<SessionEvent,
|
|
|
2504
2617
|
yield* eventTranslator.drainPending()
|
|
2505
2618
|
yield* resultAssembler.handleError(err, rootSpan)
|
|
2506
2619
|
} finally {
|
|
2620
|
+
// A pending acquisition is withdrawn and awaited first, so a handle
|
|
2621
|
+
// that arrives now is either published (and released below) or
|
|
2622
|
+
// handed to the late-teardown path. Nothing is left allocated.
|
|
2623
|
+
await deferredSandbox?.cancel()
|
|
2507
2624
|
yield* releaseTurnResources({
|
|
2508
2625
|
ctx,
|
|
2509
2626
|
eventTranslator,
|