@namzu/sdk 68.0.1 → 69.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 +96 -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/authorization/skill-grant.d.ts.map +1 -1
- package/dist/authorization/skill-grant.js +1 -0
- package/dist/authorization/skill-grant.js.map +1 -1
- package/dist/bridge/acp/permission.d.ts +10 -0
- package/dist/bridge/acp/permission.d.ts.map +1 -1
- package/dist/bridge/acp/permission.js.map +1 -1
- package/dist/bridge/acp/server.d.ts +12 -0
- package/dist/bridge/acp/server.d.ts.map +1 -1
- package/dist/bridge/acp/server.js +21 -0
- package/dist/bridge/acp/server.js.map +1 -1
- package/dist/compaction/context-window.d.ts +8 -0
- package/dist/compaction/context-window.d.ts.map +1 -1
- package/dist/compaction/context-window.js +14 -0
- package/dist/compaction/context-window.js.map +1 -1
- package/dist/compaction/loaded-skills.d.ts +10 -0
- package/dist/compaction/loaded-skills.d.ts.map +1 -1
- package/dist/compaction/loaded-skills.js +45 -1
- package/dist/compaction/loaded-skills.js.map +1 -1
- package/dist/compaction/manager.d.ts +8 -0
- package/dist/compaction/manager.d.ts.map +1 -1
- package/dist/compaction/manager.js +31 -0
- package/dist/compaction/manager.js.map +1 -1
- package/dist/compaction/manual.d.ts.map +1 -1
- package/dist/compaction/manual.js +7 -1
- package/dist/compaction/manual.js.map +1 -1
- package/dist/compaction/model-summary.js +2 -2
- package/dist/compaction/model-summary.js.map +1 -1
- package/dist/compaction/restore.d.ts +8 -0
- package/dist/compaction/restore.d.ts.map +1 -1
- package/dist/compaction/restore.js +65 -0
- package/dist/compaction/restore.js.map +1 -1
- package/dist/compaction/salience/working-set.d.ts.map +1 -1
- package/dist/compaction/salience/working-set.js +2 -2
- package/dist/compaction/salience/working-set.js.map +1 -1
- package/dist/compaction/tool-result-editing.d.ts +6 -0
- package/dist/compaction/tool-result-editing.d.ts.map +1 -1
- package/dist/compaction/tool-result-editing.js +7 -1
- package/dist/compaction/tool-result-editing.js.map +1 -1
- package/dist/compaction/types.d.ts +2 -0
- package/dist/compaction/types.d.ts.map +1 -1
- package/dist/compaction/wire.d.ts.map +1 -1
- package/dist/compaction/wire.js +4 -0
- package/dist/compaction/wire.js.map +1 -1
- package/dist/connector/index.d.ts +2 -2
- package/dist/connector/index.d.ts.map +1 -1
- package/dist/connector/index.js +1 -1
- package/dist/connector/index.js.map +1 -1
- package/dist/connector/mcp/client.d.ts +29 -0
- package/dist/connector/mcp/client.d.ts.map +1 -1
- package/dist/connector/mcp/client.js +59 -2
- package/dist/connector/mcp/client.js.map +1 -1
- package/dist/connector/mcp/errors.d.ts +7 -0
- package/dist/connector/mcp/errors.d.ts.map +1 -1
- package/dist/connector/mcp/errors.js +14 -0
- package/dist/connector/mcp/errors.js.map +1 -1
- package/dist/connector/mcp/index.d.ts +5 -1
- package/dist/connector/mcp/index.d.ts.map +1 -1
- package/dist/connector/mcp/index.js +3 -1
- package/dist/connector/mcp/index.js.map +1 -1
- package/dist/connector/mcp/skill-source.d.ts +144 -0
- package/dist/connector/mcp/skill-source.d.ts.map +1 -0
- package/dist/connector/mcp/skill-source.js +375 -0
- package/dist/connector/mcp/skill-source.js.map +1 -0
- package/dist/connector/mcp/skills.d.ts +137 -0
- package/dist/connector/mcp/skills.d.ts.map +1 -0
- package/dist/connector/mcp/skills.js +303 -0
- package/dist/connector/mcp/skills.js.map +1 -0
- package/dist/manager/session/turn-recorder.d.ts.map +1 -1
- package/dist/manager/session/turn-recorder.js +23 -1
- package/dist/manager/session/turn-recorder.js.map +1 -1
- package/dist/network/audit.d.ts +1 -1
- package/dist/network/audit.d.ts.map +1 -1
- package/dist/network/audit.js +2 -0
- package/dist/network/audit.js.map +1 -1
- package/dist/network/computer.d.ts +107 -0
- package/dist/network/computer.d.ts.map +1 -0
- package/dist/network/computer.js +250 -0
- package/dist/network/computer.js.map +1 -0
- package/dist/network/index.d.ts +2 -0
- package/dist/network/index.d.ts.map +1 -1
- package/dist/network/index.js +1 -0
- package/dist/network/index.js.map +1 -1
- package/dist/network/join.d.ts +13 -1
- package/dist/network/join.d.ts.map +1 -1
- package/dist/network/join.js +21 -3
- package/dist/network/join.js.map +1 -1
- package/dist/network/roster.d.ts +5 -0
- package/dist/network/roster.d.ts.map +1 -1
- package/dist/network/roster.js.map +1 -1
- package/dist/network/service.d.ts +12 -2
- package/dist/network/service.d.ts.map +1 -1
- package/dist/network/service.js +539 -60
- package/dist/network/service.js.map +1 -1
- package/dist/network/store.d.ts +33 -1
- package/dist/network/store.d.ts.map +1 -1
- package/dist/network/store.js +48 -4
- package/dist/network/store.js.map +1 -1
- package/dist/network/transport.d.ts +1 -1
- package/dist/network/transport.js +1 -1
- package/dist/network/wire.d.ts +14 -0
- package/dist/network/wire.d.ts.map +1 -1
- package/dist/network/wire.js +17 -1
- package/dist/network/wire.js.map +1 -1
- package/dist/plugin/shell-hook-tool-names.d.ts.map +1 -1
- package/dist/plugin/shell-hook-tool-names.js +1 -0
- package/dist/plugin/shell-hook-tool-names.js.map +1 -1
- package/dist/plugin/shell-hook.d.ts +8 -3
- package/dist/plugin/shell-hook.d.ts.map +1 -1
- package/dist/plugin/shell-hook.js +132 -7
- package/dist/plugin/shell-hook.js.map +1 -1
- package/dist/prompt/coding-agent-doctrine.d.ts +4 -4
- package/dist/prompt/coding-agent-doctrine.d.ts.map +1 -1
- package/dist/prompt/coding-agent-doctrine.js +7 -2
- package/dist/prompt/coding-agent-doctrine.js.map +1 -1
- package/dist/provider/fallback.d.ts.map +1 -1
- package/dist/provider/fallback.js +9 -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 +8 -0
- package/dist/provider/idle-timeout.js.map +1 -1
- package/dist/provider/instrumentation.d.ts.map +1 -1
- package/dist/provider/instrumentation.js +10 -0
- package/dist/provider/instrumentation.js.map +1 -1
- package/dist/provider/model-window-suffix.d.ts.map +1 -1
- package/dist/provider/model-window-suffix.js +2 -0
- package/dist/provider/model-window-suffix.js.map +1 -1
- package/dist/provider/retry.d.ts.map +1 -1
- package/dist/provider/retry.js +8 -0
- package/dist/provider/retry.js.map +1 -1
- package/dist/public-runtime.d.ts +10 -7
- package/dist/public-runtime.d.ts.map +1 -1
- package/dist/public-runtime.js +12 -5
- package/dist/public-runtime.js.map +1 -1
- package/dist/public-tools.d.ts +7 -4
- package/dist/public-tools.d.ts.map +1 -1
- package/dist/public-tools.js +9 -3
- package/dist/public-tools.js.map +1 -1
- package/dist/public-types.d.ts +4 -1
- package/dist/public-types.d.ts.map +1 -1
- package/dist/registry/tool/presentation.d.ts +8 -1
- package/dist/registry/tool/presentation.d.ts.map +1 -1
- package/dist/registry/tool/presentation.js +14 -5
- package/dist/registry/tool/presentation.js.map +1 -1
- package/dist/runtime/jobs/registry.d.ts.map +1 -1
- package/dist/runtime/jobs/registry.js +2 -1
- package/dist/runtime/jobs/registry.js.map +1 -1
- package/dist/runtime/query/auto-review/classifier.d.ts.map +1 -1
- package/dist/runtime/query/auto-review/classifier.js +19 -3
- package/dist/runtime/query/auto-review/classifier.js.map +1 -1
- package/dist/runtime/query/auto-review/failure.d.ts +12 -0
- package/dist/runtime/query/auto-review/failure.d.ts.map +1 -0
- package/dist/runtime/query/auto-review/failure.js +46 -0
- package/dist/runtime/query/auto-review/failure.js.map +1 -0
- package/dist/runtime/query/auto-review/index.d.ts +1 -0
- package/dist/runtime/query/auto-review/index.d.ts.map +1 -1
- package/dist/runtime/query/auto-review/index.js +1 -0
- package/dist/runtime/query/auto-review/index.js.map +1 -1
- package/dist/runtime/query/executor/tool-call-admission.d.ts.map +1 -1
- package/dist/runtime/query/executor/tool-call-admission.js +10 -1
- package/dist/runtime/query/executor/tool-call-admission.js.map +1 -1
- package/dist/runtime/query/executor.d.ts +12 -0
- package/dist/runtime/query/executor.d.ts.map +1 -1
- package/dist/runtime/query/executor.js +43 -9
- package/dist/runtime/query/executor.js.map +1 -1
- package/dist/runtime/query/file-evidence-replay.d.ts.map +1 -1
- package/dist/runtime/query/file-evidence-replay.js +6 -6
- package/dist/runtime/query/file-evidence-replay.js.map +1 -1
- package/dist/runtime/query/index.d.ts +4 -0
- package/dist/runtime/query/index.d.ts.map +1 -1
- package/dist/runtime/query/index.js +40 -1
- package/dist/runtime/query/index.js.map +1 -1
- package/dist/runtime/query/iteration/index.d.ts.map +1 -1
- package/dist/runtime/query/iteration/index.js +2 -0
- package/dist/runtime/query/iteration/index.js.map +1 -1
- package/dist/runtime/query/iteration/phases/compaction.d.ts.map +1 -1
- package/dist/runtime/query/iteration/phases/compaction.js +21 -3
- package/dist/runtime/query/iteration/phases/compaction.js.map +1 -1
- package/dist/runtime/query/iteration/phases/context.d.ts +4 -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/per-call-review.d.ts +6 -2
- package/dist/runtime/query/iteration/phases/per-call-review.d.ts.map +1 -1
- package/dist/runtime/query/iteration/phases/per-call-review.js +24 -9
- package/dist/runtime/query/iteration/phases/per-call-review.js.map +1 -1
- package/dist/runtime/query/iteration/step-shaping.d.ts.map +1 -1
- package/dist/runtime/query/iteration/step-shaping.js +4 -0
- package/dist/runtime/query/iteration/step-shaping.js.map +1 -1
- package/dist/runtime/query/prepare-turn.d.ts +5 -1
- package/dist/runtime/query/prepare-turn.d.ts.map +1 -1
- package/dist/runtime/query/prepare-turn.js +13 -3
- package/dist/runtime/query/prepare-turn.js.map +1 -1
- package/dist/runtime/query/review-policy.d.ts +15 -4
- package/dist/runtime/query/review-policy.d.ts.map +1 -1
- package/dist/runtime/query/review-policy.js +15 -4
- package/dist/runtime/query/review-policy.js.map +1 -1
- package/dist/runtime/query/shell-line-escalation.d.ts +24 -0
- package/dist/runtime/query/shell-line-escalation.d.ts.map +1 -0
- package/dist/runtime/query/shell-line-escalation.js +38 -0
- package/dist/runtime/query/shell-line-escalation.js.map +1 -0
- package/dist/runtime/query/tooling.d.ts +7 -0
- package/dist/runtime/query/tooling.d.ts.map +1 -1
- package/dist/runtime/query/tooling.js +2 -0
- package/dist/runtime/query/tooling.js.map +1 -1
- package/dist/runtime/query/turn/outcome-ledger.d.ts +4 -0
- package/dist/runtime/query/turn/outcome-ledger.d.ts.map +1 -1
- package/dist/runtime/query/turn/outcome-ledger.js +47 -1
- package/dist/runtime/query/turn/outcome-ledger.js.map +1 -1
- package/dist/sandbox/provider/local.d.ts.map +1 -1
- package/dist/sandbox/provider/local.js +3 -1
- package/dist/sandbox/provider/local.js.map +1 -1
- package/dist/scheduler/local.d.ts.map +1 -1
- package/dist/scheduler/local.js +3 -1
- package/dist/scheduler/local.js.map +1 -1
- package/dist/skills/index.d.ts +4 -0
- package/dist/skills/index.d.ts.map +1 -1
- package/dist/skills/index.js +2 -0
- package/dist/skills/index.js.map +1 -1
- package/dist/skills/inline-shell-host.d.ts +103 -0
- package/dist/skills/inline-shell-host.d.ts.map +1 -0
- package/dist/skills/inline-shell-host.js +238 -0
- package/dist/skills/inline-shell-host.js.map +1 -0
- package/dist/skills/inline-shell.d.ts +176 -0
- package/dist/skills/inline-shell.d.ts.map +1 -0
- package/dist/skills/inline-shell.js +646 -0
- package/dist/skills/inline-shell.js.map +1 -0
- package/dist/store/index.d.ts +2 -0
- package/dist/store/index.d.ts.map +1 -1
- package/dist/store/index.js +1 -0
- package/dist/store/index.js.map +1 -1
- package/dist/store/task/file.d.ts +124 -0
- package/dist/store/task/file.d.ts.map +1 -0
- package/dist/store/task/file.js +498 -0
- package/dist/store/task/file.js.map +1 -0
- package/dist/teams/backend.d.ts +28 -0
- package/dist/teams/backend.d.ts.map +1 -0
- package/dist/teams/backend.js +2 -0
- package/dist/teams/backend.js.map +1 -0
- package/dist/teams/fs-sync.d.ts +19 -0
- package/dist/teams/fs-sync.d.ts.map +1 -0
- package/dist/teams/fs-sync.js +81 -0
- package/dist/teams/fs-sync.js.map +1 -0
- package/dist/teams/index.d.ts +14 -0
- package/dist/teams/index.d.ts.map +1 -0
- package/dist/teams/index.js +11 -0
- package/dist/teams/index.js.map +1 -0
- package/dist/teams/names.d.ts +15 -0
- package/dist/teams/names.d.ts.map +1 -0
- package/dist/teams/names.js +43 -0
- package/dist/teams/names.js.map +1 -0
- package/dist/teams/store.d.ts +133 -0
- package/dist/teams/store.d.ts.map +1 -0
- package/dist/teams/store.js +536 -0
- package/dist/teams/store.js.map +1 -0
- package/dist/teams/types.d.ts +97 -0
- package/dist/teams/types.d.ts.map +1 -0
- package/dist/teams/types.js +70 -0
- package/dist/teams/types.js.map +1 -0
- package/dist/tools/admit-facts.d.ts.map +1 -1
- package/dist/tools/admit-facts.js +28 -0
- package/dist/tools/admit-facts.js.map +1 -1
- package/dist/tools/builtins/bash.d.ts.map +1 -1
- package/dist/tools/builtins/bash.js +5 -2
- package/dist/tools/builtins/bash.js.map +1 -1
- package/dist/tools/builtins/browser.js +1 -1
- package/dist/tools/builtins/browser.js.map +1 -1
- package/dist/tools/builtins/computer-use.d.ts +60 -2
- package/dist/tools/builtins/computer-use.d.ts.map +1 -1
- package/dist/tools/builtins/computer-use.js +695 -80
- package/dist/tools/builtins/computer-use.js.map +1 -1
- package/dist/tools/builtins/content-fingerprint.d.ts.map +1 -1
- package/dist/tools/builtins/content-fingerprint.js +2 -1
- package/dist/tools/builtins/content-fingerprint.js.map +1 -1
- package/dist/tools/builtins/edit-apply.d.ts +1 -0
- package/dist/tools/builtins/edit-apply.d.ts.map +1 -1
- package/dist/tools/builtins/edit-apply.js +108 -21
- package/dist/tools/builtins/edit-apply.js.map +1 -1
- package/dist/tools/builtins/edit-match.d.ts +37 -0
- package/dist/tools/builtins/edit-match.d.ts.map +1 -1
- package/dist/tools/builtins/edit-match.js +193 -0
- package/dist/tools/builtins/edit-match.js.map +1 -1
- package/dist/tools/builtins/edit.d.ts.map +1 -1
- package/dist/tools/builtins/edit.js +14 -7
- package/dist/tools/builtins/edit.js.map +1 -1
- package/dist/tools/builtins/exit-semantics.d.ts +8 -0
- package/dist/tools/builtins/exit-semantics.d.ts.map +1 -1
- package/dist/tools/builtins/exit-semantics.js +19 -0
- package/dist/tools/builtins/exit-semantics.js.map +1 -1
- package/dist/tools/builtins/index.d.ts +3 -1
- package/dist/tools/builtins/index.d.ts.map +1 -1
- package/dist/tools/builtins/index.js +1 -0
- package/dist/tools/builtins/index.js.map +1 -1
- package/dist/tools/builtins/present-file.d.ts +24 -0
- package/dist/tools/builtins/present-file.d.ts.map +1 -0
- package/dist/tools/builtins/present-file.js +116 -0
- package/dist/tools/builtins/present-file.js.map +1 -0
- package/dist/tools/builtins/read-file.js +1 -1
- package/dist/tools/builtins/read-file.js.map +1 -1
- package/dist/tools/builtins/read-render.d.ts +12 -1
- package/dist/tools/builtins/read-render.d.ts.map +1 -1
- package/dist/tools/builtins/read-render.js +16 -3
- package/dist/tools/builtins/read-render.js.map +1 -1
- package/dist/tools/builtins/search-tools.d.ts +10 -0
- package/dist/tools/builtins/search-tools.d.ts.map +1 -1
- package/dist/tools/builtins/search-tools.js +36 -2
- package/dist/tools/builtins/search-tools.js.map +1 -1
- package/dist/tools/builtins/skill.d.ts +31 -0
- package/dist/tools/builtins/skill.d.ts.map +1 -1
- package/dist/tools/builtins/skill.js +232 -88
- package/dist/tools/builtins/skill.js.map +1 -1
- package/dist/tools/builtins/wait-for-job.d.ts.map +1 -1
- package/dist/tools/builtins/wait-for-job.js +5 -0
- package/dist/tools/builtins/wait-for-job.js.map +1 -1
- package/dist/tools/builtins/web.d.ts.map +1 -1
- package/dist/tools/builtins/web.js +13 -2
- package/dist/tools/builtins/web.js.map +1 -1
- package/dist/tools/task/create.d.ts.map +1 -1
- package/dist/tools/task/create.js +13 -4
- package/dist/tools/task/create.js.map +1 -1
- package/dist/tools/task/get.d.ts +8 -0
- package/dist/tools/task/get.d.ts.map +1 -0
- package/dist/tools/task/get.js +51 -0
- package/dist/tools/task/get.js.map +1 -0
- package/dist/tools/task/index.d.ts +7 -0
- package/dist/tools/task/index.d.ts.map +1 -1
- package/dist/tools/task/index.js +10 -2
- package/dist/tools/task/index.js.map +1 -1
- package/dist/tools/task/list.d.ts.map +1 -1
- package/dist/tools/task/list.js +10 -2
- package/dist/tools/task/list.js.map +1 -1
- package/dist/tools/task/number.d.ts +13 -0
- package/dist/tools/task/number.d.ts.map +1 -0
- package/dist/tools/task/number.js +30 -0
- package/dist/tools/task/number.js.map +1 -0
- package/dist/tools/task/present.d.ts.map +1 -1
- package/dist/tools/task/present.js +17 -3
- package/dist/tools/task/present.js.map +1 -1
- package/dist/tools/task/update.d.ts +2 -1
- package/dist/tools/task/update.d.ts.map +1 -1
- package/dist/tools/task/update.js +87 -20
- package/dist/tools/task/update.js.map +1 -1
- package/dist/types/acp/index.d.ts +10 -0
- package/dist/types/acp/index.d.ts.map +1 -1
- package/dist/types/agent/base.d.ts +4 -0
- package/dist/types/agent/base.d.ts.map +1 -1
- package/dist/types/agent/scheduler.d.ts +9 -0
- package/dist/types/agent/scheduler.d.ts.map +1 -1
- package/dist/types/computer-use/index.d.ts +7 -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/connector/mcp.d.ts +10 -0
- package/dist/types/connector/mcp.d.ts.map +1 -1
- package/dist/types/permission/index.d.ts +20 -0
- package/dist/types/permission/index.d.ts.map +1 -1
- package/dist/types/permission/index.js +25 -0
- package/dist/types/permission/index.js.map +1 -1
- package/dist/types/plugin/index.d.ts +47 -3
- package/dist/types/plugin/index.d.ts.map +1 -1
- package/dist/types/plugin/index.js +4 -0
- package/dist/types/plugin/index.js.map +1 -1
- package/dist/types/provider/chat.d.ts +8 -0
- package/dist/types/provider/chat.d.ts.map +1 -1
- package/dist/types/provider/interface.d.ts +16 -0
- package/dist/types/provider/interface.d.ts.map +1 -1
- package/dist/types/provider/model.d.ts +6 -0
- package/dist/types/provider/model.d.ts.map +1 -1
- package/dist/types/provider/stream.d.ts +2 -0
- package/dist/types/provider/stream.d.ts.map +1 -1
- package/dist/types/tool/index.d.ts +28 -2
- 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 +15 -0
- package/dist/types/tool/presentation.d.ts.map +1 -1
- package/dist/utils/node-on-path.d.ts +27 -0
- package/dist/utils/node-on-path.d.ts.map +1 -0
- package/dist/utils/node-on-path.js +70 -0
- package/dist/utils/node-on-path.js.map +1 -0
- package/package.json +1 -1
- package/src/agents/QueryAgent.ts +2 -0
- package/src/authorization/skill-grant.ts +1 -0
- package/src/bridge/acp/permission.ts +11 -1
- package/src/bridge/acp/server.ts +26 -0
- package/src/compaction/context-window.ts +18 -0
- package/src/compaction/loaded-skills.ts +42 -1
- package/src/compaction/manager.ts +28 -0
- package/src/compaction/manual.ts +9 -1
- package/src/compaction/model-summary.ts +2 -2
- package/src/compaction/restore.ts +69 -0
- package/src/compaction/salience/working-set.ts +6 -2
- package/src/compaction/tool-result-editing.ts +8 -1
- package/src/compaction/types.ts +2 -0
- package/src/compaction/wire.ts +4 -0
- package/src/connector/index.ts +27 -0
- package/src/connector/mcp/client.ts +71 -2
- package/src/connector/mcp/errors.ts +14 -0
- package/src/connector/mcp/index.ts +36 -0
- package/src/connector/mcp/skill-source.ts +499 -0
- package/src/connector/mcp/skills.ts +367 -0
- package/src/manager/session/turn-recorder.ts +24 -1
- package/src/network/audit.ts +2 -0
- package/src/network/computer.ts +347 -0
- package/src/network/index.ts +20 -0
- package/src/network/join.ts +21 -2
- package/src/network/roster.ts +5 -0
- package/src/network/service.ts +674 -84
- package/src/network/store.ts +57 -4
- package/src/network/transport.ts +1 -1
- package/src/network/wire.ts +18 -1
- package/src/plugin/shell-hook-tool-names.ts +1 -0
- package/src/plugin/shell-hook.ts +144 -7
- package/src/prompt/coding-agent-doctrine.ts +7 -2
- package/src/provider/fallback.ts +10 -0
- package/src/provider/idle-timeout.ts +9 -0
- package/src/provider/instrumentation.ts +12 -0
- package/src/provider/model-window-suffix.ts +2 -0
- package/src/provider/retry.ts +9 -0
- package/src/public-runtime.ts +100 -0
- package/src/public-tools.ts +18 -0
- package/src/public-types.ts +29 -0
- package/src/registry/tool/presentation.ts +14 -4
- package/src/runtime/jobs/registry.ts +2 -1
- package/src/runtime/query/auto-review/classifier.ts +19 -3
- package/src/runtime/query/auto-review/failure.ts +50 -0
- package/src/runtime/query/auto-review/index.ts +1 -0
- package/src/runtime/query/executor/tool-call-admission.ts +10 -1
- package/src/runtime/query/executor.ts +57 -8
- package/src/runtime/query/file-evidence-replay.ts +6 -5
- package/src/runtime/query/index.ts +62 -0
- package/src/runtime/query/iteration/index.ts +2 -0
- package/src/runtime/query/iteration/phases/compaction.ts +25 -2
- package/src/runtime/query/iteration/phases/context.ts +4 -0
- package/src/runtime/query/iteration/phases/per-call-review.ts +24 -7
- package/src/runtime/query/iteration/step-shaping.ts +4 -0
- package/src/runtime/query/prepare-turn.ts +20 -2
- package/src/runtime/query/review-policy.ts +31 -5
- package/src/runtime/query/shell-line-escalation.ts +49 -0
- package/src/runtime/query/tooling.ts +6 -0
- package/src/runtime/query/turn/outcome-ledger.ts +56 -1
- package/src/sandbox/provider/local.ts +3 -1
- package/src/scheduler/local.ts +3 -1
- package/src/skills/index.ts +43 -0
- package/src/skills/inline-shell-host.ts +303 -0
- package/src/skills/inline-shell.ts +765 -0
- package/src/store/index.ts +8 -0
- package/src/store/task/file.ts +641 -0
- package/src/teams/backend.ts +29 -0
- package/src/teams/fs-sync.ts +91 -0
- package/src/teams/index.ts +47 -0
- package/src/teams/names.ts +49 -0
- package/src/teams/store.ts +607 -0
- package/src/teams/types.ts +102 -0
- package/src/tools/admit-facts.ts +26 -0
- package/src/tools/builtins/bash.ts +5 -2
- package/src/tools/builtins/browser.ts +1 -1
- package/src/tools/builtins/computer-use.ts +799 -86
- package/src/tools/builtins/content-fingerprint.ts +2 -1
- package/src/tools/builtins/edit-apply.ts +124 -24
- package/src/tools/builtins/edit-match.ts +200 -0
- package/src/tools/builtins/edit.ts +16 -7
- package/src/tools/builtins/exit-semantics.ts +23 -0
- package/src/tools/builtins/index.ts +3 -0
- package/src/tools/builtins/present-file.ts +127 -0
- package/src/tools/builtins/read-file.ts +1 -1
- package/src/tools/builtins/read-render.ts +18 -3
- package/src/tools/builtins/search-tools.ts +36 -2
- package/src/tools/builtins/skill.ts +291 -95
- package/src/tools/builtins/wait-for-job.ts +5 -0
- package/src/tools/builtins/web.ts +15 -2
- package/src/tools/task/create.ts +13 -4
- package/src/tools/task/get.ts +53 -0
- package/src/tools/task/index.ts +14 -2
- package/src/tools/task/list.ts +10 -2
- package/src/tools/task/number.ts +32 -0
- package/src/tools/task/present.ts +18 -3
- package/src/tools/task/update.ts +94 -20
- package/src/types/acp/index.ts +11 -1
- package/src/types/agent/base.ts +6 -0
- package/src/types/agent/scheduler.ts +9 -0
- package/src/types/computer-use/index.ts +7 -0
- package/src/types/connector/mcp.ts +10 -0
- package/src/types/permission/index.ts +29 -0
- package/src/types/plugin/index.ts +95 -39
- package/src/types/provider/chat.ts +9 -0
- package/src/types/provider/interface.ts +18 -0
- package/src/types/provider/model.ts +6 -0
- package/src/types/provider/stream.ts +2 -0
- package/src/types/tool/index.ts +23 -2
- package/src/types/tool/presentation.ts +14 -0
- package/src/utils/node-on-path.ts +81 -0
|
@@ -835,6 +835,12 @@ export interface QueryParams {
|
|
|
835
835
|
|
|
836
836
|
taskStore?: TaskStore
|
|
837
837
|
|
|
838
|
+
/** The member name the task tools claim under when `taskStore` is a list a team shares. */
|
|
839
|
+
taskMember?: string
|
|
840
|
+
|
|
841
|
+
/** The team a teammate belongs to; with `taskMember` it names the teammate on the task hooks. */
|
|
842
|
+
taskTeam?: string
|
|
843
|
+
|
|
838
844
|
runtimeToolOverrides?: RuntimeToolOverrides
|
|
839
845
|
|
|
840
846
|
runtimeContext?: AgentRuntimeContext
|
|
@@ -1173,7 +1179,9 @@ export async function* query(params: QueryParams): AsyncGenerator<SessionEvent,
|
|
|
1173
1179
|
resilientProvider,
|
|
1174
1180
|
serving,
|
|
1175
1181
|
providerContextWindow,
|
|
1182
|
+
providerAutoCompactLimit,
|
|
1176
1183
|
modelContextWindows,
|
|
1184
|
+
modelAutoCompactLimits,
|
|
1177
1185
|
approvalPolicy,
|
|
1178
1186
|
eventTranslator,
|
|
1179
1187
|
executeUserInterruptHooks,
|
|
@@ -1299,6 +1307,7 @@ export async function* query(params: QueryParams): AsyncGenerator<SessionEvent,
|
|
|
1299
1307
|
const taskTools = buildTaskTools(params.taskStore, {
|
|
1300
1308
|
sessionId: ctx.sessionId,
|
|
1301
1309
|
turnId: ctx.turnId,
|
|
1310
|
+
...(params.taskMember !== undefined ? { member: params.taskMember } : {}),
|
|
1302
1311
|
// A resumed turn began when its `turn_started` was recorded, maybe
|
|
1303
1312
|
// in another process: tasks it closed before the pause are still
|
|
1304
1313
|
// "closed in this turn".
|
|
@@ -1447,6 +1456,36 @@ export async function* query(params: QueryParams): AsyncGenerator<SessionEvent,
|
|
|
1447
1456
|
})
|
|
1448
1457
|
}
|
|
1449
1458
|
|
|
1459
|
+
// The person's own picture, on a model known to read text only, is refused
|
|
1460
|
+
// before anything is sent: leaving it out would answer a question about a
|
|
1461
|
+
// picture the model never saw, with nothing on screen to say so. Images a
|
|
1462
|
+
// tool returned are another matter (they are left out quietly beside the
|
|
1463
|
+
// text the tool gave), and so is a driver that declares no vision at all.
|
|
1464
|
+
// Only when that message is the last one: a run continuing after it (a
|
|
1465
|
+
// resume past an approval pause) answers with the picture already left
|
|
1466
|
+
// out, and refusing there would block a turn the person did not start.
|
|
1467
|
+
if (
|
|
1468
|
+
textOnlyModel &&
|
|
1469
|
+
latestUser !== undefined &&
|
|
1470
|
+
latestUser === params.messages[params.messages.length - 1] &&
|
|
1471
|
+
carries(latestUser, 'image')
|
|
1472
|
+
) {
|
|
1473
|
+
const alternative = params.provider.imageModelFor?.(turnConfig.model)
|
|
1474
|
+
throw new NamzuError({
|
|
1475
|
+
code: 'capability_unavailable',
|
|
1476
|
+
message: `Model '${turnConfig.model}' does not accept image input. ${
|
|
1477
|
+
alternative
|
|
1478
|
+
? `Select '${alternative}' or remove the images.`
|
|
1479
|
+
: 'Select a model that reads images or remove the images.'
|
|
1480
|
+
}`,
|
|
1481
|
+
details: {
|
|
1482
|
+
providerId: params.provider.id,
|
|
1483
|
+
capability: 'vision',
|
|
1484
|
+
model: turnConfig.model,
|
|
1485
|
+
},
|
|
1486
|
+
})
|
|
1487
|
+
}
|
|
1488
|
+
|
|
1450
1489
|
if (attachmentMessageCount > 0) {
|
|
1451
1490
|
const message = textOnlyModel
|
|
1452
1491
|
? `Model '${turnConfig.model}' on provider '${params.provider.id}' reads text only but ${attachmentMessageCount} user message(s) carry image attachments — they are left out of its requests, so the model never sees the images. Pass strictCapabilities: true to fail instead, or use a model that reads images.`
|
|
@@ -1655,6 +1694,9 @@ export async function* query(params: QueryParams): AsyncGenerator<SessionEvent,
|
|
|
1655
1694
|
const toolExecutor = ToolingBootstrap.init(
|
|
1656
1695
|
{
|
|
1657
1696
|
skillGrants,
|
|
1697
|
+
// A host names its approval policy for the mode it implements, so the name is
|
|
1698
|
+
// the live mode; a name that is not a mode says nothing about nested calls.
|
|
1699
|
+
reviewMode: () => approvalPolicy.current.name,
|
|
1658
1700
|
tools: toolManager,
|
|
1659
1701
|
...(params.structuredOutput?.toolResultRetention === 'durable' && structuredOutputTool
|
|
1660
1702
|
? { durableStructuredOutputTool: structuredOutputTool }
|
|
@@ -1681,6 +1723,9 @@ export async function* query(params: QueryParams): AsyncGenerator<SessionEvent,
|
|
|
1681
1723
|
allowedTools: effectiveAllowedTools,
|
|
1682
1724
|
invocationState: params.invocationState,
|
|
1683
1725
|
pluginManager: params.pluginManager,
|
|
1726
|
+
...(params.taskTeam !== undefined && params.taskMember !== undefined
|
|
1727
|
+
? { teammate: { name: params.taskMember, team: params.taskTeam } }
|
|
1728
|
+
: {}),
|
|
1684
1729
|
...(params.backgroundJobs ? { backgroundJobs: params.backgroundJobs } : {}),
|
|
1685
1730
|
...(params.backgroundJobOwner ? { backgroundJobOwner: params.backgroundJobOwner } : {}),
|
|
1686
1731
|
...(awaitedJobs ? { onJobAwaited: (id: string) => awaitedJobs.expect(id) } : {}),
|
|
@@ -2063,6 +2108,23 @@ export async function* query(params: QueryParams): AsyncGenerator<SessionEvent,
|
|
|
2063
2108
|
? { compactionSummaryRoute: params.compactionSummaryRoute }
|
|
2064
2109
|
: {}),
|
|
2065
2110
|
...(providerContextWindow !== undefined ? { providerContextWindow } : {}),
|
|
2111
|
+
...(providerAutoCompactLimit !== undefined ? { providerAutoCompactLimit } : {}),
|
|
2112
|
+
resolveModelAutoCompactLimit: async (model) => {
|
|
2113
|
+
if (!modelAutoCompactLimits.has(model)) {
|
|
2114
|
+
modelAutoCompactLimits.set(
|
|
2115
|
+
model,
|
|
2116
|
+
await resolveProviderContextWindow(
|
|
2117
|
+
resilientProvider,
|
|
2118
|
+
model,
|
|
2119
|
+
ctx.abortController.signal,
|
|
2120
|
+
turnConfig.timeoutMs,
|
|
2121
|
+
log,
|
|
2122
|
+
'resolveAutoCompactLimit',
|
|
2123
|
+
),
|
|
2124
|
+
)
|
|
2125
|
+
}
|
|
2126
|
+
return modelAutoCompactLimits.get(model)
|
|
2127
|
+
},
|
|
2066
2128
|
resolveModelContextWindow: async (model) => {
|
|
2067
2129
|
if (!modelContextWindows.has(model)) {
|
|
2068
2130
|
modelContextWindows.set(
|
|
@@ -1335,6 +1335,7 @@ export class IterationOrchestrator {
|
|
|
1335
1335
|
maxTokens:
|
|
1336
1336
|
outputCapOverride ?? step.maxResponseTokens ?? turnConfig.maxResponseTokens,
|
|
1337
1337
|
cacheControl: { type: 'auto' },
|
|
1338
|
+
cacheKey: recorder.sessionId,
|
|
1338
1339
|
...(turnConfig.thinking ? { thinking: turnConfig.thinking } : {}),
|
|
1339
1340
|
...(stepEffort ? { effort: stepEffort } : {}),
|
|
1340
1341
|
...(turnConfig.speed ? { speed: turnConfig.speed } : {}),
|
|
@@ -3866,6 +3867,7 @@ export class IterationOrchestrator {
|
|
|
3866
3867
|
temperature: this.ctx.turnConfig.temperature,
|
|
3867
3868
|
maxTokens: this.ctx.turnConfig.maxResponseTokens,
|
|
3868
3869
|
cacheControl: { type: 'auto' },
|
|
3870
|
+
cacheKey: this.ctx.recorder.sessionId,
|
|
3869
3871
|
...(this.ctx.turnConfig.thinking ? { thinking: this.ctx.turnConfig.thinking } : {}),
|
|
3870
3872
|
// This turn is a hand-maintained duplicate of the one above, which
|
|
3871
3873
|
// is exactly the shape a field goes missing from — so it is tested
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
|
+
providerTriggerFraction,
|
|
2
3
|
resolveContextWindow,
|
|
3
4
|
resolveTriggerThreshold,
|
|
4
5
|
} from '../../../../compaction/context-window.js'
|
|
@@ -21,7 +22,7 @@ import {
|
|
|
21
22
|
} from '../../../../compaction/plan.js'
|
|
22
23
|
import type { ContextReducer, ContextReduction } from '../../../../compaction/reducer.js'
|
|
23
24
|
import { createSlidingWindowReducer } from '../../../../compaction/reducer.js'
|
|
24
|
-
import { renderRestoredContext } from '../../../../compaction/restore.js'
|
|
25
|
+
import { carriedWorkingCommands, renderRestoredContext } from '../../../../compaction/restore.js'
|
|
25
26
|
import { findRetainedIndices } from '../../../../compaction/retention.js'
|
|
26
27
|
import { serializeState } from '../../../../compaction/serializer.js'
|
|
27
28
|
import {
|
|
@@ -188,6 +189,10 @@ async function emitToolResultClear(
|
|
|
188
189
|
*/
|
|
189
190
|
function adoptLoadedSkills(ctx: IterationContext): void {
|
|
190
191
|
ctx.workingStateManager?.adoptSkillBodies(adoptableSkills(ctx.recorder.messages))
|
|
192
|
+
for (const message of ctx.recorder.messages) {
|
|
193
|
+
if (message.role === 'system' && typeof message.content === 'string')
|
|
194
|
+
ctx.workingStateManager?.adoptWorkingCommands(carriedWorkingCommands(message.content))
|
|
195
|
+
}
|
|
191
196
|
}
|
|
192
197
|
|
|
193
198
|
/**
|
|
@@ -836,7 +841,7 @@ async function runCompactionCheckInner(
|
|
|
836
841
|
const configured = ctx.compactionConfig
|
|
837
842
|
if (!configured) return
|
|
838
843
|
if (configured.strategy === 'disabled') return
|
|
839
|
-
const
|
|
844
|
+
const deepened = options?.deeper ? deepenConfig(configured, ctx.recorder.messages) : configured
|
|
840
845
|
|
|
841
846
|
const measured = measureContext(ctx)
|
|
842
847
|
const estimatedTokens = measured.tokens
|
|
@@ -851,6 +856,24 @@ async function runCompactionCheckInner(
|
|
|
851
856
|
const window = activeContextWindow(ctx)
|
|
852
857
|
const budget = window.tokens
|
|
853
858
|
|
|
859
|
+
// The provider's own compaction limit, when its service stated one, is the trigger:
|
|
860
|
+
// min(limit, 90% of the window). A host that set a threshold or an auto-compact window
|
|
861
|
+
// keeps what it set. Folding it into the config means the planners below read the same
|
|
862
|
+
// trigger this pass does.
|
|
863
|
+
const model = ctx.contextModel ?? ctx.turnConfig.model
|
|
864
|
+
const providerLimit =
|
|
865
|
+
model === ctx.turnConfig.model
|
|
866
|
+
? ctx.providerAutoCompactLimit
|
|
867
|
+
: ctx.activeProviderAutoCompactLimit
|
|
868
|
+
const providerFraction =
|
|
869
|
+
deepened.triggerThreshold === undefined &&
|
|
870
|
+
deepened.autoCompactWindowTokens === undefined &&
|
|
871
|
+
window.source !== 'config'
|
|
872
|
+
? providerTriggerFraction(providerLimit, budget)
|
|
873
|
+
: undefined
|
|
874
|
+
const config =
|
|
875
|
+
providerFraction !== undefined ? { ...deepened, triggerThreshold: providerFraction } : deepened
|
|
876
|
+
|
|
854
877
|
const usage = estimatedTokens / budget
|
|
855
878
|
|
|
856
879
|
// A forced pass skips the threshold: it runs because the provider
|
|
@@ -242,6 +242,10 @@ export interface IterationContext {
|
|
|
242
242
|
* through to the table.
|
|
243
243
|
*/
|
|
244
244
|
readonly providerContextWindow?: number
|
|
245
|
+
/** What the driver's service says compaction starts at, in tokens; asked once at the start of the turn. */
|
|
246
|
+
readonly providerAutoCompactLimit?: number
|
|
247
|
+
activeProviderAutoCompactLimit?: number
|
|
248
|
+
readonly resolveModelAutoCompactLimit?: (model: string) => Promise<number | undefined>
|
|
245
249
|
/** Selected request model; its window must not reuse another model's metadata. */
|
|
246
250
|
contextModel?: string
|
|
247
251
|
activeProviderContextWindow?: number
|
|
@@ -81,6 +81,8 @@ interface Interpreted {
|
|
|
81
81
|
readonly verdicts: Map<string, Verdict>
|
|
82
82
|
/** The calls were refused and the refusal ends the turn. */
|
|
83
83
|
readonly endsTurn: boolean
|
|
84
|
+
/** The refusal was a person's own No, not the safety check's. */
|
|
85
|
+
readonly byPerson?: boolean
|
|
84
86
|
/** The decision was the host stopping the turn outright. */
|
|
85
87
|
readonly cancelled: boolean
|
|
86
88
|
/** The decision was a request to wait: the park it recorded must not stay open. */
|
|
@@ -135,8 +137,12 @@ export interface PerCallReviewDeps {
|
|
|
135
137
|
* - An answer that grants something (a remembered approval, a changed rule or
|
|
136
138
|
* mode on the host's side) re-checks the questions still open, and any call
|
|
137
139
|
* the new state covers is let through unasked. A re-check never refuses.
|
|
138
|
-
* - A
|
|
139
|
-
*
|
|
140
|
+
* - A refusal that ends the turn closes the questions still open and refuses,
|
|
141
|
+
* without asking, the calls that would have needed one. When the safety
|
|
142
|
+
* check refused, calls that need no review (a read, a search, a call a rule
|
|
143
|
+
* already allowed) still run and calls already running finish: the refusal
|
|
144
|
+
* is about the call it answered. A person's own No, and the host stopping
|
|
145
|
+
* the turn (`cancelled`), cancel what is running and start nothing more.
|
|
140
146
|
* - Every refusal and every call that could not be matched to a reviewed
|
|
141
147
|
* summary is a refusal. Nothing is approved by the absence of an answer.
|
|
142
148
|
*/
|
|
@@ -266,6 +272,10 @@ export class PerCallReview implements ReviewedExecution {
|
|
|
266
272
|
})
|
|
267
273
|
return { run: true }
|
|
268
274
|
}
|
|
275
|
+
// A refusal ended the turn while this call waited its turn: nobody is asked
|
|
276
|
+
// about it any more. It is refused here; a call that needed no question was
|
|
277
|
+
// let through above.
|
|
278
|
+
if (this.#endsTurn) return { run: false, reason: REFUSED_WITH_THE_TURN }
|
|
269
279
|
const interpreted = await this.#ask([summary], leave)
|
|
270
280
|
this.#noteEnd(interpreted)
|
|
271
281
|
const verdict = interpreted.verdicts.get(summary.id) ?? {
|
|
@@ -361,10 +371,10 @@ export class PerCallReview implements ReviewedExecution {
|
|
|
361
371
|
|
|
362
372
|
#noteEnd(interpreted: Interpreted): void {
|
|
363
373
|
if (!interpreted.endsTurn && !interpreted.cancelled) return
|
|
364
|
-
this.#end(interpreted.cancelled)
|
|
374
|
+
this.#end(interpreted.cancelled, interpreted.byPerson === true)
|
|
365
375
|
}
|
|
366
376
|
|
|
367
|
-
#end(cancelled: boolean): void {
|
|
377
|
+
#end(cancelled: boolean, byPerson = false): void {
|
|
368
378
|
if (this.#endsTurn) return
|
|
369
379
|
this.#endsTurn = true
|
|
370
380
|
this.#cancelled = cancelled
|
|
@@ -372,7 +382,10 @@ export class PerCallReview implements ReviewedExecution {
|
|
|
372
382
|
ask.closedBy ??= 'ended'
|
|
373
383
|
ask.controller.abort()
|
|
374
384
|
}
|
|
375
|
-
|
|
385
|
+
// A person's No, and the host stopping the turn, cancel what is running
|
|
386
|
+
// and start nothing more. A refusal by the safety check is about the call
|
|
387
|
+
// it answered: what is running and what needs no review carries on.
|
|
388
|
+
if (cancelled || byPerson) this.#endController.abort(new Error('the user stopped the turn'))
|
|
376
389
|
}
|
|
377
390
|
|
|
378
391
|
/** One request to the handler about `calls`, and what its answer means for each. */
|
|
@@ -481,6 +494,7 @@ export class PerCallReview implements ReviewedExecution {
|
|
|
481
494
|
interpreted.endsTurn,
|
|
482
495
|
interpreted.cancelled,
|
|
483
496
|
interpreted.paused,
|
|
497
|
+
interpreted.byPerson === true,
|
|
484
498
|
)
|
|
485
499
|
}
|
|
486
500
|
|
|
@@ -492,6 +506,7 @@ export class PerCallReview implements ReviewedExecution {
|
|
|
492
506
|
endsTurn: boolean,
|
|
493
507
|
cancelled: boolean,
|
|
494
508
|
paused: boolean,
|
|
509
|
+
byPerson = false,
|
|
495
510
|
): Promise<Interpreted> {
|
|
496
511
|
const { ctx } = this.#deps
|
|
497
512
|
const denials = new Map<string, string>()
|
|
@@ -534,7 +549,7 @@ export class PerCallReview implements ReviewedExecution {
|
|
|
534
549
|
})
|
|
535
550
|
}
|
|
536
551
|
}
|
|
537
|
-
return { verdicts: result, endsTurn, cancelled, paused }
|
|
552
|
+
return { verdicts: result, endsTurn, byPerson, cancelled, paused }
|
|
538
553
|
}
|
|
539
554
|
|
|
540
555
|
#interpret(decision: HITLResumeDecision, calls: readonly ToolCallSummary[]): Interpreted {
|
|
@@ -545,6 +560,7 @@ export class PerCallReview implements ReviewedExecution {
|
|
|
545
560
|
let endsTurn = false
|
|
546
561
|
let cancelled = false
|
|
547
562
|
let paused = false
|
|
563
|
+
let byPerson = false
|
|
548
564
|
switch (decision.action) {
|
|
549
565
|
case 'approve_tools':
|
|
550
566
|
case 'continue':
|
|
@@ -562,6 +578,7 @@ export class PerCallReview implements ReviewedExecution {
|
|
|
562
578
|
...(decision.declined ? { declined: note ? { note } : {} } : {}),
|
|
563
579
|
})
|
|
564
580
|
endsTurn = decision.endTurn === true
|
|
581
|
+
byPerson = decision.declined !== undefined
|
|
565
582
|
break
|
|
566
583
|
}
|
|
567
584
|
case 'modify_tools': {
|
|
@@ -600,7 +617,7 @@ export class PerCallReview implements ReviewedExecution {
|
|
|
600
617
|
})
|
|
601
618
|
refuseAll({ run: false, reason: NOT_THIS_QUESTION })
|
|
602
619
|
}
|
|
603
|
-
return { verdicts, endsTurn, cancelled, paused }
|
|
620
|
+
return { verdicts, endsTurn, byPerson, cancelled, paused }
|
|
604
621
|
}
|
|
605
622
|
}
|
|
606
623
|
|
|
@@ -330,4 +330,8 @@ export async function selectContextModel(
|
|
|
330
330
|
model && model !== ctx.turnConfig.model && !ctx.compactionConfig?.contextWindowTokens
|
|
331
331
|
? await ctx.resolveModelContextWindow?.(model)
|
|
332
332
|
: undefined
|
|
333
|
+
ctx.activeProviderAutoCompactLimit =
|
|
334
|
+
model && model !== ctx.turnConfig.model && !ctx.compactionConfig?.contextWindowTokens
|
|
335
|
+
? await ctx.resolveModelAutoCompactLimit?.(model)
|
|
336
|
+
: undefined
|
|
333
337
|
}
|
|
@@ -86,7 +86,9 @@ export interface PreparedTurn {
|
|
|
86
86
|
readonly resilientProvider: LLMProvider
|
|
87
87
|
readonly serving: { current: ServingMember }
|
|
88
88
|
readonly providerContextWindow: number | undefined
|
|
89
|
+
readonly providerAutoCompactLimit: number | undefined
|
|
89
90
|
readonly modelContextWindows: Map<string, number | undefined>
|
|
91
|
+
readonly modelAutoCompactLimits: Map<string, number | undefined>
|
|
90
92
|
readonly approvalPolicy: SessionApprovalPolicy
|
|
91
93
|
readonly eventTranslator: EventTranslator
|
|
92
94
|
readonly executeUserInterruptHooks: (terminalError: unknown) => Promise<void>
|
|
@@ -224,8 +226,11 @@ export async function resolveProviderContextWindow(
|
|
|
224
226
|
signal: AbortSignal | undefined,
|
|
225
227
|
timeoutMs: number,
|
|
226
228
|
log: Logger,
|
|
229
|
+
/** Which of the driver's two optional limit lookups to ask; both share one bounded, swallowed path. */
|
|
230
|
+
member: 'resolveContextWindow' | 'resolveAutoCompactLimit' = 'resolveContextWindow',
|
|
227
231
|
): Promise<number | undefined> {
|
|
228
|
-
|
|
232
|
+
const lookup = provider[member]
|
|
233
|
+
if (!lookup || !model) return undefined
|
|
229
234
|
if (signal?.aborted) return undefined
|
|
230
235
|
|
|
231
236
|
// The resolver is an optional optimisation that runs before TurnContext
|
|
@@ -253,7 +258,7 @@ export async function resolveProviderContextWindow(
|
|
|
253
258
|
}, deadlineMs)
|
|
254
259
|
|
|
255
260
|
try {
|
|
256
|
-
const resolution =
|
|
261
|
+
const resolution = lookup.call(provider, model, resolverSignal)
|
|
257
262
|
const reported = await Promise.race([resolution, interruption])
|
|
258
263
|
if (reported === interrupted) {
|
|
259
264
|
if (deadline.signal.aborted) {
|
|
@@ -499,6 +504,17 @@ export async function prepareTurn(params: QueryParams): Promise<PreparedTurn> {
|
|
|
499
504
|
)
|
|
500
505
|
const modelContextWindows = new Map<string, number | undefined>()
|
|
501
506
|
if (turnConfig.model) modelContextWindows.set(turnConfig.model, providerContextWindow)
|
|
507
|
+
// The same lookup, for the threshold the driver's own service says compaction starts at.
|
|
508
|
+
const providerAutoCompactLimit = await resolveProviderContextWindow(
|
|
509
|
+
resilientProvider,
|
|
510
|
+
turnConfig.model,
|
|
511
|
+
params.signal,
|
|
512
|
+
turnConfig.timeoutMs,
|
|
513
|
+
log,
|
|
514
|
+
'resolveAutoCompactLimit',
|
|
515
|
+
)
|
|
516
|
+
const modelAutoCompactLimits = new Map<string, number | undefined>()
|
|
517
|
+
if (turnConfig.model) modelAutoCompactLimits.set(turnConfig.model, providerAutoCompactLimit)
|
|
502
518
|
|
|
503
519
|
// The mode this conversation was left in, when the turn config names none.
|
|
504
520
|
// Read once, before the loop exists, for the same reason the context
|
|
@@ -880,7 +896,9 @@ export async function prepareTurn(params: QueryParams): Promise<PreparedTurn> {
|
|
|
880
896
|
resilientProvider,
|
|
881
897
|
serving,
|
|
882
898
|
providerContextWindow,
|
|
899
|
+
providerAutoCompactLimit,
|
|
883
900
|
modelContextWindows,
|
|
901
|
+
modelAutoCompactLimits,
|
|
884
902
|
approvalPolicy,
|
|
885
903
|
eventTranslator,
|
|
886
904
|
executeUserInterruptHooks,
|
|
@@ -50,6 +50,7 @@ import {
|
|
|
50
50
|
PLAN_MODE_REFUSAL,
|
|
51
51
|
PLAN_MODE_REFUSAL_WITH_PLAN_FILE,
|
|
52
52
|
STRICT_MODE_REFUSAL,
|
|
53
|
+
nestedCallModeRefusal,
|
|
53
54
|
} from '../../types/permission/index.js'
|
|
54
55
|
import type { AutoReviewClassifier, AutoReviewDecision } from './auto-review/classifier.js'
|
|
55
56
|
import {
|
|
@@ -149,7 +150,12 @@ export function isReviewMode(value: unknown): value is ReviewMode {
|
|
|
149
150
|
return typeof value === 'string' && (REVIEW_MODES as readonly string[]).includes(value)
|
|
150
151
|
}
|
|
151
152
|
|
|
152
|
-
export {
|
|
153
|
+
export {
|
|
154
|
+
PLAN_MODE_REFUSAL,
|
|
155
|
+
PLAN_MODE_REFUSAL_WITH_PLAN_FILE,
|
|
156
|
+
STRICT_MODE_REFUSAL,
|
|
157
|
+
nestedCallModeRefusal,
|
|
158
|
+
}
|
|
153
159
|
|
|
154
160
|
/** The tools `accept-edits` approves without asking. Everything else prompts. */
|
|
155
161
|
export const ACCEPT_EDITS_TOOLS: ReadonlySet<string> = new Set(['edit', 'write'])
|
|
@@ -949,11 +955,20 @@ export interface ReviewPolicyOptions {
|
|
|
949
955
|
/**
|
|
950
956
|
* Called when the classifier has given no verdict several times in a row
|
|
951
957
|
* (`AutoReviewLimits.noVerdict`): it could not be reached, or its answers
|
|
952
|
-
* could not be read.
|
|
953
|
-
*
|
|
958
|
+
* could not be read. With nobody to ask, the policy refuses the batch and
|
|
959
|
+
* ends the turn rather than hold back call after call; with a person to ask,
|
|
960
|
+
* the person is asked instead and this is not called. This
|
|
954
961
|
* is where a host says so in its own words. `reason` is the last block's.
|
|
955
962
|
*/
|
|
956
963
|
readonly onClassifierUnavailable?: (event: { readonly reason: string }) => void
|
|
964
|
+
/**
|
|
965
|
+
* Called when the classifier could not complete a check (or gave an answer
|
|
966
|
+
* that was not a verdict) and a person was asked about the call instead.
|
|
967
|
+
* Only with a `prompt`; without one the call is refused and
|
|
968
|
+
* {@link onClassifierUnavailable} is how a run of them is reported.
|
|
969
|
+
* `reason` names the class of failure.
|
|
970
|
+
*/
|
|
971
|
+
readonly onClassifierFellBack?: (event: { readonly reason: string }) => void
|
|
957
972
|
}
|
|
958
973
|
|
|
959
974
|
/**
|
|
@@ -1370,8 +1385,19 @@ export function createReviewHandler(options: ReviewPolicyOptions = {}): ResumeHa
|
|
|
1370
1385
|
return askPerson(escapes)
|
|
1371
1386
|
}
|
|
1372
1387
|
transcriptTooLong = false
|
|
1373
|
-
// A check that
|
|
1374
|
-
//
|
|
1388
|
+
// A check that could not be completed says nothing about the call,
|
|
1389
|
+
// so with a person to ask the person is asked, as for a call the
|
|
1390
|
+
// classifier was never going to judge. This is not a refusal and it
|
|
1391
|
+
// does not count toward ending the turn. The host hears why, so it
|
|
1392
|
+
// can say the check is down.
|
|
1393
|
+
if (decision.cause === 'unavailable' || decision.cause === 'unreadable') {
|
|
1394
|
+
if (prompt) {
|
|
1395
|
+
options.onClassifierFellBack?.({ reason: decision.reason })
|
|
1396
|
+
return askPerson(escapes)
|
|
1397
|
+
}
|
|
1398
|
+
}
|
|
1399
|
+
// With nobody to ask, a check that keeps giving no verdict ends the
|
|
1400
|
+
// turn: holding calls back one at a time against it gets nowhere, and
|
|
1375
1401
|
// nothing is run unchecked.
|
|
1376
1402
|
if (decision.noVerdictLimitReached === true) {
|
|
1377
1403
|
options.onClassifierUnavailable?.({ reason: decision.reason })
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a shell line reaches that no rule and no skill grant may approve in
|
|
3
|
+
* advance, asked outside a turn. The executor asks the same questions of a
|
|
4
|
+
* nested call (`escalationOf`); a host that runs a command without an
|
|
5
|
+
* executor (a command a person typed, a headless prompt) asks them here, so
|
|
6
|
+
* the two routes refuse the same lines.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { unknownProgramInLine } from '../../authorization/program.js'
|
|
10
|
+
import type { ShellDialect } from '../../authorization/shell-lexer.js'
|
|
11
|
+
import { shellEscalations } from './path-escalation.js'
|
|
12
|
+
|
|
13
|
+
export interface ShellLineEscalationContext {
|
|
14
|
+
/** The working directory first, then the added directories. */
|
|
15
|
+
readonly roots: readonly string[]
|
|
16
|
+
/** Where the line starts, when that is not the first root. */
|
|
17
|
+
readonly cwd?: string
|
|
18
|
+
/** Whether the line runs in a sandbox (paths there are the guest's). */
|
|
19
|
+
readonly sandboxed: boolean
|
|
20
|
+
readonly dialect?: ShellDialect
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* The reason a shell line must go to a person, or `undefined` when it reaches
|
|
25
|
+
* nothing past the roots. A check that throws is answered as an unfinished
|
|
26
|
+
* check, never as "nothing found".
|
|
27
|
+
*/
|
|
28
|
+
export async function shellLineEscalation(
|
|
29
|
+
line: string,
|
|
30
|
+
context: ShellLineEscalationContext,
|
|
31
|
+
): Promise<string | undefined> {
|
|
32
|
+
const dialect = context.dialect ?? 'sh'
|
|
33
|
+
try {
|
|
34
|
+
const found = await shellEscalations(line, dialect, {
|
|
35
|
+
roots: context.roots,
|
|
36
|
+
...(context.cwd !== undefined ? { cwd: context.cwd } : {}),
|
|
37
|
+
reviewOutside: !context.sandboxed,
|
|
38
|
+
topLevel: !context.sandboxed,
|
|
39
|
+
})
|
|
40
|
+
if (found.protectedPaths.length > 0) return 'it writes to a protected path'
|
|
41
|
+
if (found.dangerousRemoval !== undefined) return 'it removes more than a command may'
|
|
42
|
+
if (found.outsidePaths.length > 0) return 'it reaches outside the working folders'
|
|
43
|
+
if (unknownProgramInLine(line, dialect) !== undefined)
|
|
44
|
+
return 'it runs a program Namzu cannot read'
|
|
45
|
+
return undefined
|
|
46
|
+
} catch {
|
|
47
|
+
return 'the safety checks did not finish'
|
|
48
|
+
}
|
|
49
|
+
}
|
|
@@ -48,6 +48,8 @@ export interface ToolingBootstrapConfig {
|
|
|
48
48
|
allowedTools?: readonly string[]
|
|
49
49
|
invocationState?: InvocationState
|
|
50
50
|
pluginManager?: PluginLifecycleManager
|
|
51
|
+
/** Set for a teammate's turn: the task hooks name it. */
|
|
52
|
+
teammate?: { readonly name: string; readonly team: string }
|
|
51
53
|
toolTimeoutMs?: number
|
|
52
54
|
/** Host-owned and shared; the executor binds it to this turn. */
|
|
53
55
|
backgroundJobs?: BackgroundJobRegistry
|
|
@@ -92,6 +94,8 @@ export interface ToolingBootstrapConfig {
|
|
|
92
94
|
toolPause?: (toolUseId: string) => RequestToolPause
|
|
93
95
|
/** The turn's skill pre-approvals; see the executor's own field. */
|
|
94
96
|
skillGrants?: SkillGrantSet
|
|
97
|
+
/** See `ExecutorConfig.reviewMode`. */
|
|
98
|
+
reviewMode?: () => string | undefined
|
|
95
99
|
}
|
|
96
100
|
|
|
97
101
|
export class ToolingBootstrap {
|
|
@@ -126,6 +130,7 @@ export class ToolingBootstrap {
|
|
|
126
130
|
invocationState: config.invocationState,
|
|
127
131
|
captureSessionEvidence: config.captureSessionEvidence,
|
|
128
132
|
pluginManager: config.pluginManager,
|
|
133
|
+
...(config.teammate ? { teammate: config.teammate } : {}),
|
|
129
134
|
...(config.backgroundJobs ? { backgroundJobs: config.backgroundJobs } : {}),
|
|
130
135
|
...(config.backgroundJobOwner ? { backgroundJobOwner: config.backgroundJobOwner } : {}),
|
|
131
136
|
...(config.onJobAwaited ? { onJobAwaited: config.onJobAwaited } : {}),
|
|
@@ -178,6 +183,7 @@ export class ToolingBootstrap {
|
|
|
178
183
|
: {}),
|
|
179
184
|
...(config.toolPause !== undefined ? { toolPause: config.toolPause } : {}),
|
|
180
185
|
...(config.skillGrants !== undefined ? { skillGrants: config.skillGrants } : {}),
|
|
186
|
+
...(config.reviewMode !== undefined ? { reviewMode: config.reviewMode } : {}),
|
|
181
187
|
},
|
|
182
188
|
activityStore,
|
|
183
189
|
emitEvent,
|
|
@@ -140,6 +140,8 @@ export interface OutcomeLedgerSnapshot {
|
|
|
140
140
|
readonly unseen?: boolean
|
|
141
141
|
/** Absent in a snapshot written before it existed. */
|
|
142
142
|
readonly pathless?: number
|
|
143
|
+
/** Background jobs that run a recognised check: job id and command. Absent in an older snapshot. */
|
|
144
|
+
readonly jobs?: readonly (readonly [string, string])[]
|
|
143
145
|
readonly checks: readonly {
|
|
144
146
|
readonly key: string
|
|
145
147
|
readonly command: string
|
|
@@ -357,6 +359,14 @@ function runsRecognisedCheck(line: string, hostIsCheck?: (command: string) => bo
|
|
|
357
359
|
return false
|
|
358
360
|
}
|
|
359
361
|
|
|
362
|
+
/** Tools that only write to the task list or to the mail between agents. */
|
|
363
|
+
const COORDINATION_TOOLS: ReadonlySet<string> = new Set([
|
|
364
|
+
'task_create',
|
|
365
|
+
'task_update',
|
|
366
|
+
'send_message',
|
|
367
|
+
'stop_task',
|
|
368
|
+
])
|
|
369
|
+
|
|
360
370
|
export class OutcomeLedger {
|
|
361
371
|
private readonly config: TurnOutcomeConfig
|
|
362
372
|
private started = false
|
|
@@ -369,6 +379,8 @@ export class OutcomeLedger {
|
|
|
369
379
|
private couldHaveChangedUnseen = false
|
|
370
380
|
private writes = 0
|
|
371
381
|
private readonly checks = new Map<string, CheckState>()
|
|
382
|
+
/** Background jobs that run a recognised check, by job id: the command they run. */
|
|
383
|
+
private readonly jobChecks = new Map<string, string>()
|
|
372
384
|
private unrecorded = false
|
|
373
385
|
private settled: TurnOutcome | undefined
|
|
374
386
|
|
|
@@ -403,6 +415,8 @@ export class OutcomeLedger {
|
|
|
403
415
|
this.writes = parsed.writes
|
|
404
416
|
this.pathless = parsed.pathless ?? 0
|
|
405
417
|
this.couldHaveChangedUnseen = parsed.unseen === true
|
|
418
|
+
this.jobChecks.clear()
|
|
419
|
+
for (const [id, command] of parsed.jobs ?? []) this.jobChecks.set(id, command)
|
|
406
420
|
this.checks.clear()
|
|
407
421
|
for (const check of parsed.checks) {
|
|
408
422
|
this.checks.set(check.key, { ...check, fingerprint: check.fingerprint })
|
|
@@ -419,6 +433,7 @@ export class OutcomeLedger {
|
|
|
419
433
|
writes: this.writes,
|
|
420
434
|
unseen: this.couldHaveChangedUnseen,
|
|
421
435
|
pathless: this.pathless,
|
|
436
|
+
jobs: [...this.jobChecks.entries()].slice(-MAX_REMEMBERED_CHECKS),
|
|
422
437
|
checks: [...this.checks.values()].map((check) => ({
|
|
423
438
|
key: check.key,
|
|
424
439
|
command: check.command,
|
|
@@ -439,6 +454,9 @@ export class OutcomeLedger {
|
|
|
439
454
|
*/
|
|
440
455
|
private couldChange(call: PendingOutcomeCall): boolean {
|
|
441
456
|
if (call.readOnly === true) return false
|
|
457
|
+
// These keep the plan and the team's mail: they write to the task list and the mailboxes, never to
|
|
458
|
+
// the workspace, so a turn that only used them has nothing it could have changed unseen.
|
|
459
|
+
if (COORDINATION_TOOLS.has(call.toolName)) return false
|
|
442
460
|
if (call.toolName === 'bash') {
|
|
443
461
|
const command = commandOf(call.input)
|
|
444
462
|
if (command !== undefined && isReadOnlyCommandLine(command)) return false
|
|
@@ -486,6 +504,21 @@ export class OutcomeLedger {
|
|
|
486
504
|
// answers for exactly the state they left.
|
|
487
505
|
let pending: CheckState[] = []
|
|
488
506
|
for (const call of calls) {
|
|
507
|
+
// A check started as a background job is not a result yet; the wait that
|
|
508
|
+
// reads its exit is. Remember which command the job runs.
|
|
509
|
+
// A foreground check the time limit moved to the background is a job too,
|
|
510
|
+
// though the call was not marked `launched`.
|
|
511
|
+
if (
|
|
512
|
+
call.toolName === 'bash' &&
|
|
513
|
+
call.facts?.kind === 'command' &&
|
|
514
|
+
call.facts.jobId !== undefined &&
|
|
515
|
+
(call.launched === true || call.facts.background === true)
|
|
516
|
+
) {
|
|
517
|
+
const started = commandOf(call.input)
|
|
518
|
+
if (started !== undefined && runsRecognisedCheck(started, this.config.isCheck)) {
|
|
519
|
+
this.jobChecks.set(call.facts.jobId, started)
|
|
520
|
+
}
|
|
521
|
+
}
|
|
489
522
|
// A call that did not run, or only started work elsewhere, changed nothing here.
|
|
490
523
|
if (call.skipped === true || call.notRun === true || call.launched === true) continue
|
|
491
524
|
const written = WRITING_TOOLS.has(call.toolName)
|
|
@@ -498,7 +531,16 @@ export class OutcomeLedger {
|
|
|
498
531
|
continue
|
|
499
532
|
}
|
|
500
533
|
if (written) continue
|
|
501
|
-
|
|
534
|
+
// The exit of a background check, read by `wait_for_job`, is that check's
|
|
535
|
+
// result: the job's own command, with the exit code the wait reported.
|
|
536
|
+
const jobCommand =
|
|
537
|
+
call.toolName === 'wait_for_job' &&
|
|
538
|
+
call.facts?.kind === 'command' &&
|
|
539
|
+
call.facts.jobId !== undefined &&
|
|
540
|
+
call.facts.exitCode !== undefined
|
|
541
|
+
? this.jobChecks.get(call.facts.jobId)
|
|
542
|
+
: undefined
|
|
543
|
+
const command = call.toolName === 'bash' ? commandOf(call.input) : jobCommand
|
|
502
544
|
if (command !== undefined && runsRecognisedCheck(command, this.config.isCheck)) {
|
|
503
545
|
this.afterEveryCheck('other')
|
|
504
546
|
for (const check of pending) check.fingerprint = null
|
|
@@ -720,6 +762,19 @@ function parseSnapshot(value: unknown): OutcomeLedgerSnapshot | undefined {
|
|
|
720
762
|
) {
|
|
721
763
|
return undefined
|
|
722
764
|
}
|
|
765
|
+
if (
|
|
766
|
+
snap.jobs !== undefined &&
|
|
767
|
+
(!Array.isArray(snap.jobs) ||
|
|
768
|
+
!snap.jobs.every(
|
|
769
|
+
(j) =>
|
|
770
|
+
Array.isArray(j) &&
|
|
771
|
+
j.length === 2 &&
|
|
772
|
+
typeof j[0] === 'string' &&
|
|
773
|
+
typeof j[1] === 'string',
|
|
774
|
+
))
|
|
775
|
+
) {
|
|
776
|
+
return undefined
|
|
777
|
+
}
|
|
723
778
|
if (!Array.isArray(snap.checks)) return undefined
|
|
724
779
|
const results = new Set<string>(['passed', 'failed', 'masked', 'unsettled'])
|
|
725
780
|
for (const raw of snap.checks) {
|
|
@@ -49,6 +49,7 @@ import type {
|
|
|
49
49
|
import { subscribeToAbort } from '../../utils/abort.js'
|
|
50
50
|
import { generateSandboxId } from '../../utils/id.js'
|
|
51
51
|
import type { Logger } from '../../utils/logger.js'
|
|
52
|
+
import { withNodeOnPath } from '../../utils/node-on-path.js'
|
|
52
53
|
import {
|
|
53
54
|
WINDOWS_CORE_ENV_KEYS,
|
|
54
55
|
applyEnvironmentOverrides,
|
|
@@ -603,7 +604,8 @@ export function buildSafeEnv(
|
|
|
603
604
|
// Last: a command in a sandbox is still a command a session started.
|
|
604
605
|
setEnvironmentEntry(env, SESSION_CHILD_ENV, '1')
|
|
605
606
|
|
|
606
|
-
|
|
607
|
+
// A shell inside the sandbox can run `node` when the user's PATH has none.
|
|
608
|
+
return withNodeOnPath(env)
|
|
607
609
|
}
|
|
608
610
|
|
|
609
611
|
/**
|