@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
|
@@ -226,6 +226,15 @@ export type PluginHookEvent =
|
|
|
226
226
|
* command expanded to. `skip` stops it, and `annotate` adds context.
|
|
227
227
|
*/
|
|
228
228
|
| 'user_prompt_expansion'
|
|
229
|
+
/**
|
|
230
|
+
* A shell command written inside a skill or a custom command is about to run
|
|
231
|
+
* while that text loads (`!`cmd`` or a fenced block opened with three backticks
|
|
232
|
+
* and a bang), after the permission check allowed it and before it starts.
|
|
233
|
+
* Carries `toolName`, `toolInput` (`command`), `toolCallId` (new for each
|
|
234
|
+
* command) and `skillShell`. `skip` refuses that one command, which stays
|
|
235
|
+
* out of the text; `continue` with `halt` stops the whole load.
|
|
236
|
+
*/
|
|
237
|
+
| 'pre_skill_shell_command'
|
|
229
238
|
/**
|
|
230
239
|
* A task is being created (`task_create`), before it is. Carries `task`.
|
|
231
240
|
* `skip` refuses it, and the reason reaches the model.
|
|
@@ -237,6 +246,16 @@ export type PluginHookEvent =
|
|
|
237
246
|
* reason reaches the model.
|
|
238
247
|
*/
|
|
239
248
|
| 'task_completed'
|
|
249
|
+
/**
|
|
250
|
+
* A teammate has finished its turn and is about to go idle. Carries
|
|
251
|
+
* `teammateName` and `teamName`. `skip` keeps it working: the reason is sent
|
|
252
|
+
* to it as feedback (shell exit code 2).
|
|
253
|
+
*/
|
|
254
|
+
| 'teammate_idle'
|
|
255
|
+
/** A teammate was started. Carries `teammateName` and `teamName`. Observational. */
|
|
256
|
+
| 'teammate_start'
|
|
257
|
+
/** A teammate left the team (shut down, stopped or ended). Carries `teammateName` and `teamName`. Observational. */
|
|
258
|
+
| 'teammate_stop'
|
|
240
259
|
| 'pre_llm_call'
|
|
241
260
|
| 'post_llm_call'
|
|
242
261
|
| 'iteration_start'
|
|
@@ -287,8 +306,12 @@ export function assertPluginHookEvent(event: PluginHookEvent): void {
|
|
|
287
306
|
case 'directory_added':
|
|
288
307
|
case 'instructions_loaded':
|
|
289
308
|
case 'user_prompt_expansion':
|
|
309
|
+
case 'pre_skill_shell_command':
|
|
290
310
|
case 'task_created':
|
|
291
311
|
case 'task_completed':
|
|
312
|
+
case 'teammate_idle':
|
|
313
|
+
case 'teammate_start':
|
|
314
|
+
case 'teammate_stop':
|
|
292
315
|
case 'pre_llm_call':
|
|
293
316
|
case 'post_llm_call':
|
|
294
317
|
case 'iteration_start':
|
|
@@ -483,6 +506,22 @@ export interface PluginPromptExpansionInfo {
|
|
|
483
506
|
readonly commandSource?: string
|
|
484
507
|
}
|
|
485
508
|
|
|
509
|
+
/** Who asked for a skill or command to load, on `pre_skill_shell_command`. */
|
|
510
|
+
export type PluginSkillShellInvoker = 'user' | 'model' | 'other'
|
|
511
|
+
|
|
512
|
+
/** What a `pre_skill_shell_command` hook is shown beside the command itself. */
|
|
513
|
+
export interface PluginSkillShellInfo {
|
|
514
|
+
/** The skill or command whose text holds the shell command, without the slash. */
|
|
515
|
+
readonly commandName: string
|
|
516
|
+
/** Where it came from (`user`, `project`, `plugin`, `skill`, `system`), when known. */
|
|
517
|
+
readonly commandSource?: string
|
|
518
|
+
/**
|
|
519
|
+
* `user` for a command the person typed, `model` for the skill tool, `other`
|
|
520
|
+
* for a preload into a sub-agent or anything not known.
|
|
521
|
+
*/
|
|
522
|
+
readonly invokedBy: PluginSkillShellInvoker
|
|
523
|
+
}
|
|
524
|
+
|
|
486
525
|
/** What a task hook is shown. */
|
|
487
526
|
export interface PluginTaskInfo {
|
|
488
527
|
/** Absent on `task_created`: the task has no id yet. */
|
|
@@ -538,8 +577,17 @@ export interface PluginHookContext {
|
|
|
538
577
|
readonly instructions?: PluginInstructionsInfo
|
|
539
578
|
/** The command that expanded, on `user_prompt_expansion`. */
|
|
540
579
|
readonly expansion?: PluginPromptExpansionInfo
|
|
580
|
+
/** The skill or command that holds the shell command, on `pre_skill_shell_command`. */
|
|
581
|
+
readonly skillShell?: PluginSkillShellInfo
|
|
541
582
|
/** The task, on `task_created` and `task_completed`. */
|
|
542
583
|
readonly task?: PluginTaskInfo
|
|
584
|
+
/**
|
|
585
|
+
* The teammate's name, on `teammate_idle`, `teammate_start` and `teammate_stop`, and on
|
|
586
|
+
* `task_created` and `task_completed` when a teammate makes or completes the task.
|
|
587
|
+
*/
|
|
588
|
+
readonly teammateName?: string
|
|
589
|
+
/** The team that teammate belongs to; present wherever `teammateName` is. */
|
|
590
|
+
readonly teamName?: string
|
|
543
591
|
/** The pass, on `pre_compact` and `post_compact`. */
|
|
544
592
|
readonly compaction?: PluginCompactionInfo
|
|
545
593
|
readonly toolName?: string
|
|
@@ -761,46 +809,54 @@ export type PluginHookResultFor<E extends PluginHookEvent> = E extends 'user_pro
|
|
|
761
809
|
? Extract<PluginHookResult, { action: 'continue' | 'annotate' | 'skip' | 'error' }>
|
|
762
810
|
: E extends 'user_prompt_expansion'
|
|
763
811
|
? Extract<PluginHookResult, { action: 'continue' | 'annotate' | 'skip' | 'error' }>
|
|
764
|
-
: E extends
|
|
765
|
-
| 'pre_model_switch'
|
|
766
|
-
| 'elicitation'
|
|
767
|
-
| 'elicitation_result'
|
|
768
|
-
| 'task_created'
|
|
769
|
-
| 'task_completed'
|
|
812
|
+
: E extends 'pre_skill_shell_command'
|
|
770
813
|
? Extract<PluginHookResult, { action: 'continue' | 'skip' | 'error' }>
|
|
771
|
-
: E extends
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
:
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
814
|
+
: E extends
|
|
815
|
+
| 'pre_model_switch'
|
|
816
|
+
| 'elicitation'
|
|
817
|
+
| 'elicitation_result'
|
|
818
|
+
| 'task_created'
|
|
819
|
+
| 'task_completed'
|
|
820
|
+
| 'teammate_idle'
|
|
821
|
+
? Extract<PluginHookResult, { action: 'continue' | 'skip' | 'error' }>
|
|
822
|
+
: E extends 'post_model_switch'
|
|
823
|
+
? Extract<PluginHookResult, { action: 'continue' | 'annotate' | 'error' }>
|
|
824
|
+
: E extends 'directory_added' | 'instructions_loaded'
|
|
825
|
+
? Extract<PluginHookResult, { action: 'continue' }>
|
|
826
|
+
: E extends 'subagent_start'
|
|
827
|
+
? Extract<PluginHookResult, { action: 'continue' | 'annotate' | 'error' }>
|
|
828
|
+
: E extends 'pre_tool_use'
|
|
829
|
+
? Extract<PluginHookResult, { action: 'continue' | 'skip' | 'modify' | 'error' }>
|
|
830
|
+
: E extends 'post_tool_use'
|
|
831
|
+
? Extract<
|
|
832
|
+
PluginHookResult,
|
|
833
|
+
{ action: 'continue' | 'replace' | 'retry' | 'error' }
|
|
834
|
+
>
|
|
835
|
+
: E extends 'post_tool_use_failure'
|
|
836
|
+
? Extract<PluginHookResult, { action: 'continue' | 'error' }>
|
|
837
|
+
: E extends 'permission_request'
|
|
838
|
+
? Extract<PluginHookResult, { action: 'continue' | 'skip' }>
|
|
839
|
+
: E extends 'pre_compact'
|
|
840
|
+
? Extract<
|
|
841
|
+
PluginHookResult,
|
|
842
|
+
{ action: 'continue' | 'annotate' | 'skip' | 'error' }
|
|
843
|
+
>
|
|
844
|
+
: E extends 'turn_end' | 'subagent_stop'
|
|
845
|
+
? Extract<PluginHookResult, { action: 'continue' | 'skip' | 'error' }>
|
|
846
|
+
: E extends 'session_start'
|
|
847
|
+
? Extract<PluginHookResult, { action: 'continue' | 'annotate' }>
|
|
848
|
+
: E extends
|
|
849
|
+
| 'turn_interrupt'
|
|
850
|
+
| 'session_end'
|
|
851
|
+
| 'notification'
|
|
852
|
+
| 'turn_failure'
|
|
853
|
+
| 'permission_denied'
|
|
854
|
+
| 'file_changed'
|
|
855
|
+
| 'cwd_changed'
|
|
856
|
+
| 'teammate_start'
|
|
857
|
+
| 'teammate_stop'
|
|
858
|
+
? Extract<PluginHookResult, { action: 'continue' }>
|
|
859
|
+
: Extract<PluginHookResult, { action: 'continue' | 'error' }>
|
|
804
860
|
|
|
805
861
|
/** The event and its handler verdict stay correlated, including in hook arrays. */
|
|
806
862
|
export type PluginHookDefinition<E extends PluginHookEvent = PluginHookEvent> =
|
|
@@ -74,6 +74,15 @@ export interface ChatCompletionParams {
|
|
|
74
74
|
|
|
75
75
|
cacheControl?: CacheControl
|
|
76
76
|
|
|
77
|
+
/**
|
|
78
|
+
* A stable name for the conversation this request belongs to. A driver
|
|
79
|
+
* whose wire has a cache-routing field (a prompt cache key, a session
|
|
80
|
+
* header) sends it so every request of one conversation lands on the same
|
|
81
|
+
* cache; a driver without one ignores it. Never a secret and never
|
|
82
|
+
* derived from the content of the request.
|
|
83
|
+
*/
|
|
84
|
+
cacheKey?: string
|
|
85
|
+
|
|
77
86
|
topP?: number
|
|
78
87
|
topK?: number
|
|
79
88
|
frequencyPenalty?: number
|
|
@@ -36,6 +36,13 @@ export interface LLMProvider {
|
|
|
36
36
|
*/
|
|
37
37
|
supportsImageInputFor?(model: string): boolean
|
|
38
38
|
|
|
39
|
+
/**
|
|
40
|
+
* A model of this driver that reads images, offered to a person whose own
|
|
41
|
+
* attachment `model` cannot read ("Select 'x'"). Absent, or `undefined`, when
|
|
42
|
+
* the driver has none to name; the refusal then names no model.
|
|
43
|
+
*/
|
|
44
|
+
imageModelFor?(model: string): string | undefined
|
|
45
|
+
|
|
39
46
|
/**
|
|
40
47
|
* Retry behaviour this DRIVER wants, when the generic default is wrong
|
|
41
48
|
* for the vendor behind it.
|
|
@@ -280,6 +287,17 @@ export interface LLMProvider {
|
|
|
280
287
|
*/
|
|
281
288
|
resolveContextWindow?(model: string, signal?: AbortSignal): Promise<number | undefined>
|
|
282
289
|
|
|
290
|
+
/**
|
|
291
|
+
* The token count at which the provider's own service says a conversation on `model`
|
|
292
|
+
* should be compacted, when it states one (the same listing that states the window).
|
|
293
|
+
*
|
|
294
|
+
* The compaction trigger uses it as `min(limit, 90% of the window)` when the host set no
|
|
295
|
+
* threshold of its own; without it Namzu's derived trigger applies. Same contract as
|
|
296
|
+
* `resolveContextWindow`: asked once per turn, bounded, and a rejection or `undefined`
|
|
297
|
+
* means "no answer", never a failed turn.
|
|
298
|
+
*/
|
|
299
|
+
resolveAutoCompactLimit?(model: string, signal?: AbortSignal): Promise<number | undefined>
|
|
300
|
+
|
|
283
301
|
/**
|
|
284
302
|
* The model to re-run a refused request on, when this provider has one.
|
|
285
303
|
*
|
|
@@ -37,6 +37,12 @@ export interface ModelInfo {
|
|
|
37
37
|
* back to its own table instead of trusting a zero.
|
|
38
38
|
*/
|
|
39
39
|
contextWindow?: number
|
|
40
|
+
/**
|
|
41
|
+
* Tokens at which the provider's service says a conversation should be compacted, already
|
|
42
|
+
* held to 90% of `contextWindow` when both are known. Absent means the service stated none
|
|
43
|
+
* and Namzu's own trigger rule applies.
|
|
44
|
+
*/
|
|
45
|
+
autoCompactTokenLimit?: number
|
|
40
46
|
/** Same, and absent for the same reason. */
|
|
41
47
|
maxOutputTokens?: number
|
|
42
48
|
/**
|
|
@@ -26,6 +26,8 @@ export interface StreamChunk {
|
|
|
26
26
|
url?: string
|
|
27
27
|
/** How many sources the provider reported for this call. Absent means unknown, not zero. */
|
|
28
28
|
results?: number
|
|
29
|
+
/** How many queries one hosted call ran, when it ran several. Absent means one or unknown. */
|
|
30
|
+
searches?: number
|
|
29
31
|
}
|
|
30
32
|
|
|
31
33
|
content?: string
|
package/src/types/tool/index.ts
CHANGED
|
@@ -189,8 +189,12 @@ export interface SkillHooksPlan {
|
|
|
189
189
|
* belong to one run; a skill whose hooks are switched off).
|
|
190
190
|
*/
|
|
191
191
|
readonly resumable?: boolean
|
|
192
|
-
/**
|
|
193
|
-
|
|
192
|
+
/**
|
|
193
|
+
* Make the hooks live. Idempotent for a skill already attached to the
|
|
194
|
+
* conversation. A forked skill's host may be told the delegated prompt here,
|
|
195
|
+
* when it was not known to {@link SkillRegistryRef.prepareHooks}.
|
|
196
|
+
*/
|
|
197
|
+
attach(late?: { readonly prompt?: string }): SkillHooksHandle
|
|
194
198
|
}
|
|
195
199
|
|
|
196
200
|
/** What {@link SkillHooksPlan.attach} gives back. */
|
|
@@ -626,6 +630,23 @@ export type ToolCallSource =
|
|
|
626
630
|
export interface ToolDispatchOptions {
|
|
627
631
|
readonly signal?: AbortSignal
|
|
628
632
|
readonly runtimeToolCallId?: string
|
|
633
|
+
/**
|
|
634
|
+
* A pre-approval that holds for this one dispatch only. It answers a call no
|
|
635
|
+
* rule decided (the gate said "review" with no rule matched); it never
|
|
636
|
+
* reopens a call a rule denied or sent to review, or the dangerous-command
|
|
637
|
+
* floor stopped, and never covers a call the tool declares needs approval.
|
|
638
|
+
*/
|
|
639
|
+
readonly allow?: (call: { readonly name: string; readonly input: unknown }) => boolean
|
|
640
|
+
/**
|
|
641
|
+
* Asked after the call is allowed and before it starts. Returns `undefined`
|
|
642
|
+
* to let it run, or the reason it is not to run, which comes back as the
|
|
643
|
+
* dispatch's failure with nothing started and no tool event written.
|
|
644
|
+
*/
|
|
645
|
+
readonly beforeRun?: (call: {
|
|
646
|
+
readonly name: string
|
|
647
|
+
readonly input: unknown
|
|
648
|
+
readonly toolUseId: string
|
|
649
|
+
}) => Promise<string | undefined>
|
|
629
650
|
}
|
|
630
651
|
|
|
631
652
|
export interface ToolContext {
|
|
@@ -219,6 +219,20 @@ export type ToolFacts =
|
|
|
219
219
|
readonly hunks?: readonly ToolDiffHunk[]
|
|
220
220
|
readonly hunksTruncated?: true
|
|
221
221
|
}
|
|
222
|
+
| {
|
|
223
|
+
readonly kind: 'shared'
|
|
224
|
+
/** Files handed to the person, as absolute paths. */
|
|
225
|
+
readonly files: readonly {
|
|
226
|
+
readonly path: string
|
|
227
|
+
/** Where the path led when the call checked it, links followed; a host compares it again at use. */
|
|
228
|
+
readonly real?: string
|
|
229
|
+
readonly bytes?: number
|
|
230
|
+
}[]
|
|
231
|
+
/** One line saying what they are. */
|
|
232
|
+
readonly caption?: string
|
|
233
|
+
/** The one file is an image the agent made: the prompt it was made from. A host draws the picture itself. */
|
|
234
|
+
readonly generatedImage?: { readonly prompt: string }
|
|
235
|
+
}
|
|
222
236
|
| {
|
|
223
237
|
readonly kind: 'failure'
|
|
224
238
|
readonly reason: ToolFailureReason
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { constants, accessSync, realpathSync, statSync } from 'node:fs'
|
|
2
|
+
import { posix, win32 } from 'node:path'
|
|
3
|
+
import { readEnvironmentEntry, setEnvironmentEntry } from './process-environment.js'
|
|
4
|
+
|
|
5
|
+
export interface NodeOnPathOptions {
|
|
6
|
+
/** The running binary. Defaults to `process.execPath`. */
|
|
7
|
+
readonly execPath?: string
|
|
8
|
+
readonly platform?: NodeJS.Platform
|
|
9
|
+
/** Whether a file is an executable `node`. Defaults to a filesystem check. */
|
|
10
|
+
readonly isExecutable?: (file: string) => boolean
|
|
11
|
+
/** Resolve links. Defaults to `fs.realpathSync`. */
|
|
12
|
+
readonly realpath?: (file: string) => string
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function defaultIsExecutable(file: string, platform: NodeJS.Platform): boolean {
|
|
16
|
+
try {
|
|
17
|
+
if (!statSync(file).isFile()) return false
|
|
18
|
+
if (platform !== 'win32') accessSync(file, constants.X_OK)
|
|
19
|
+
return true
|
|
20
|
+
} catch {
|
|
21
|
+
return false
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* The directory that would be appended to PATH so `node` resolves, or
|
|
27
|
+
* undefined when `node` already resolves (or cannot be offered).
|
|
28
|
+
*/
|
|
29
|
+
export function nodeDirectoryToAppend(
|
|
30
|
+
pathValue: string,
|
|
31
|
+
options: NodeOnPathOptions = {},
|
|
32
|
+
): string | undefined {
|
|
33
|
+
const platform = options.platform ?? process.platform
|
|
34
|
+
const path = platform === 'win32' ? win32 : posix
|
|
35
|
+
const execPath = options.execPath ?? process.execPath
|
|
36
|
+
const binary = path.basename(execPath).toLowerCase()
|
|
37
|
+
const wanted = platform === 'win32' ? ['node.exe', 'node.cmd'] : ['node']
|
|
38
|
+
if (!wanted.includes(binary)) return undefined
|
|
39
|
+
|
|
40
|
+
const entries = pathValue.split(path.delimiter)
|
|
41
|
+
const isExecutable =
|
|
42
|
+
options.isExecutable ?? ((file: string) => defaultIsExecutable(file, platform))
|
|
43
|
+
for (const dir of entries) {
|
|
44
|
+
if (dir === '') continue
|
|
45
|
+
for (const file of wanted) if (isExecutable(path.join(dir, file))) return undefined
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
let target: string
|
|
49
|
+
try {
|
|
50
|
+
target = path.dirname((options.realpath ?? realpathSync)(execPath))
|
|
51
|
+
} catch {
|
|
52
|
+
target = path.dirname(execPath)
|
|
53
|
+
}
|
|
54
|
+
return entries.includes(target) ? undefined : target
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Make `node` resolvable in a shell command's environment.
|
|
59
|
+
*
|
|
60
|
+
* The runtime is often started by an absolute path whose directory is not on
|
|
61
|
+
* the user's PATH, so a command like `node --test` then fails with exit 127
|
|
62
|
+
* while the runtime itself is running on that very binary. When no `node`
|
|
63
|
+
* resolves on PATH, the directory of the running binary is appended to the END
|
|
64
|
+
* of PATH: a `node` the user has installed always wins. The environment is
|
|
65
|
+
* returned unchanged when `node` already resolves, when PATH is absent, or when
|
|
66
|
+
* the running binary is not a plain node binary (an embedded runtime).
|
|
67
|
+
*/
|
|
68
|
+
export function withNodeOnPath(
|
|
69
|
+
env: Record<string, string>,
|
|
70
|
+
options: NodeOnPathOptions = {},
|
|
71
|
+
): Record<string, string> {
|
|
72
|
+
const platform = options.platform ?? process.platform
|
|
73
|
+
const entry = readEnvironmentEntry(env, 'PATH', platform)
|
|
74
|
+
if (!entry) return env
|
|
75
|
+
const [name, value] = entry
|
|
76
|
+
const target = nodeDirectoryToAppend(value, options)
|
|
77
|
+
if (target === undefined) return env
|
|
78
|
+
const separator = platform === 'win32' ? ';' : ':'
|
|
79
|
+
setEnvironmentEntry(env, name, value === '' ? target : `${value}${separator}${target}`, platform)
|
|
80
|
+
return env
|
|
81
|
+
}
|