@namzu/sdk 71.1.0 → 73.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +55 -0
- package/dist/agents/QueryAgent.d.ts.map +1 -1
- package/dist/agents/QueryAgent.js +1 -0
- package/dist/agents/QueryAgent.js.map +1 -1
- package/dist/agents/examples/SupervisorAgent.d.ts.map +1 -1
- package/dist/agents/examples/SupervisorAgent.js +5 -0
- package/dist/agents/examples/SupervisorAgent.js.map +1 -1
- package/dist/authorization/protected-paths.d.ts.map +1 -1
- package/dist/authorization/protected-paths.js +4 -0
- package/dist/authorization/protected-paths.js.map +1 -1
- package/dist/compaction/index.d.ts +1 -1
- package/dist/compaction/index.d.ts.map +1 -1
- package/dist/compaction/index.js +1 -1
- package/dist/compaction/index.js.map +1 -1
- package/dist/compaction/manual.d.ts +24 -1
- package/dist/compaction/manual.d.ts.map +1 -1
- package/dist/compaction/manual.js +80 -21
- package/dist/compaction/manual.js.map +1 -1
- package/dist/compaction/model-summary.d.ts +24 -6
- package/dist/compaction/model-summary.d.ts.map +1 -1
- package/dist/compaction/model-summary.js +108 -23
- package/dist/compaction/model-summary.js.map +1 -1
- package/dist/compaction/precompute.d.ts +179 -0
- package/dist/compaction/precompute.d.ts.map +1 -0
- package/dist/compaction/precompute.js +274 -0
- package/dist/compaction/precompute.js.map +1 -0
- package/dist/compaction/restore.d.ts +23 -0
- package/dist/compaction/restore.d.ts.map +1 -1
- package/dist/compaction/restore.js +59 -1
- package/dist/compaction/restore.js.map +1 -1
- package/dist/compaction/summary.d.ts +37 -2
- package/dist/compaction/summary.d.ts.map +1 -1
- package/dist/compaction/summary.js +46 -6
- package/dist/compaction/summary.js.map +1 -1
- package/dist/config/runtime.d.ts +4 -0
- package/dist/config/runtime.d.ts.map +1 -1
- package/dist/config/runtime.js +20 -3
- package/dist/config/runtime.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 +26 -6
- package/dist/connector/mcp/client.d.ts.map +1 -1
- package/dist/connector/mcp/client.js +49 -7
- package/dist/connector/mcp/client.js.map +1 -1
- package/dist/connector/mcp/index.d.ts +2 -0
- package/dist/connector/mcp/index.d.ts.map +1 -1
- package/dist/connector/mcp/index.js +1 -0
- package/dist/connector/mcp/index.js.map +1 -1
- package/dist/connector/mcp/sandbox-stdio.d.ts +67 -0
- package/dist/connector/mcp/sandbox-stdio.d.ts.map +1 -0
- package/dist/connector/mcp/sandbox-stdio.js +178 -0
- package/dist/connector/mcp/sandbox-stdio.js.map +1 -0
- package/dist/connector/mcp/stdio-program.d.ts +34 -0
- package/dist/connector/mcp/stdio-program.d.ts.map +1 -0
- package/dist/connector/mcp/stdio-program.js +47 -0
- package/dist/connector/mcp/stdio-program.js.map +1 -0
- package/dist/connector/mcp/stdio.d.ts.map +1 -1
- package/dist/connector/mcp/stdio.js +5 -2
- package/dist/connector/mcp/stdio.js.map +1 -1
- package/dist/connector/web/guarded-fetch.d.ts +51 -2
- package/dist/connector/web/guarded-fetch.d.ts.map +1 -1
- package/dist/connector/web/guarded-fetch.js +140 -19
- package/dist/connector/web/guarded-fetch.js.map +1 -1
- package/dist/connector/web/index.d.ts +2 -2
- package/dist/connector/web/index.d.ts.map +1 -1
- package/dist/connector/web/index.js +1 -1
- package/dist/connector/web/index.js.map +1 -1
- package/dist/manager/agent/lifecycle.d.ts.map +1 -1
- package/dist/manager/agent/lifecycle.js +9 -1
- package/dist/manager/agent/lifecycle.js.map +1 -1
- package/dist/manager/session/turn-recorder.d.ts +26 -0
- package/dist/manager/session/turn-recorder.d.ts.map +1 -1
- package/dist/manager/session/turn-recorder.js +72 -5
- package/dist/manager/session/turn-recorder.js.map +1 -1
- package/dist/peers/protocol.d.ts +9 -0
- package/dist/peers/protocol.d.ts.map +1 -1
- package/dist/peers/protocol.js +4 -0
- package/dist/peers/protocol.js.map +1 -1
- package/dist/peers/record.d.ts +6 -0
- package/dist/peers/record.d.ts.map +1 -1
- package/dist/peers/record.js +4 -0
- package/dist/peers/record.js.map +1 -1
- package/dist/plugin/hook-module/capabilities.d.ts.map +1 -1
- package/dist/plugin/hook-module/capabilities.js +24 -13
- package/dist/plugin/hook-module/capabilities.js.map +1 -1
- package/dist/plugin/hook-module/host.d.ts +31 -0
- package/dist/plugin/hook-module/host.d.ts.map +1 -1
- package/dist/plugin/hook-module/host.js +56 -13
- package/dist/plugin/hook-module/host.js.map +1 -1
- package/dist/plugin/hook-module/index.d.ts +3 -2
- package/dist/plugin/hook-module/index.d.ts.map +1 -1
- package/dist/plugin/hook-module/index.js +2 -1
- package/dist/plugin/hook-module/index.js.map +1 -1
- package/dist/plugin/index.d.ts +3 -2
- package/dist/plugin/index.d.ts.map +1 -1
- package/dist/plugin/index.js +2 -1
- package/dist/plugin/index.js.map +1 -1
- package/dist/plugin/shell-hook-execute.d.ts +55 -0
- package/dist/plugin/shell-hook-execute.d.ts.map +1 -0
- package/dist/plugin/shell-hook-execute.js +73 -0
- package/dist/plugin/shell-hook-execute.js.map +1 -0
- package/dist/plugin/shell-hook-restrict.d.ts +31 -0
- package/dist/plugin/shell-hook-restrict.d.ts.map +1 -0
- package/dist/plugin/shell-hook-restrict.js +69 -0
- package/dist/plugin/shell-hook-restrict.js.map +1 -0
- package/dist/plugin/shell-hook.d.ts +59 -2
- package/dist/plugin/shell-hook.d.ts.map +1 -1
- package/dist/plugin/shell-hook.js +79 -12
- package/dist/plugin/shell-hook.js.map +1 -1
- package/dist/public-runtime.d.ts +11 -7
- package/dist/public-runtime.d.ts.map +1 -1
- package/dist/public-runtime.js +9 -6
- package/dist/public-runtime.js.map +1 -1
- package/dist/public-tools.d.ts +1 -1
- package/dist/public-tools.d.ts.map +1 -1
- package/dist/public-tools.js +1 -1
- package/dist/public-tools.js.map +1 -1
- package/dist/public-types.d.ts +5 -2
- package/dist/public-types.d.ts.map +1 -1
- package/dist/registry/command/kernel-commands.d.ts +7 -1
- package/dist/registry/command/kernel-commands.d.ts.map +1 -1
- package/dist/registry/command/kernel-commands.js +40 -2
- package/dist/registry/command/kernel-commands.js.map +1 -1
- package/dist/registry/tool/execute.d.ts +8 -0
- package/dist/registry/tool/execute.d.ts.map +1 -1
- package/dist/registry/tool/execute.js +12 -0
- package/dist/registry/tool/execute.js.map +1 -1
- package/dist/runtime/jobs/websocket-source.d.ts +2 -22
- package/dist/runtime/jobs/websocket-source.d.ts.map +1 -1
- package/dist/runtime/jobs/websocket-source.js +2 -33
- package/dist/runtime/jobs/websocket-source.js.map +1 -1
- package/dist/runtime/query/budget-nudge.d.ts +27 -0
- package/dist/runtime/query/budget-nudge.d.ts.map +1 -0
- package/dist/runtime/query/budget-nudge.js +66 -0
- package/dist/runtime/query/budget-nudge.js.map +1 -0
- package/dist/runtime/query/compact-session.d.ts +9 -0
- package/dist/runtime/query/compact-session.d.ts.map +1 -1
- package/dist/runtime/query/compact-session.js +158 -76
- package/dist/runtime/query/compact-session.js.map +1 -1
- package/dist/runtime/query/events.d.ts +7 -0
- package/dist/runtime/query/events.d.ts.map +1 -1
- package/dist/runtime/query/events.js +29 -11
- package/dist/runtime/query/events.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 +51 -10
- package/dist/runtime/query/executor/tool-call-admission.js.map +1 -1
- package/dist/runtime/query/guard.d.ts +8 -0
- package/dist/runtime/query/guard.d.ts.map +1 -1
- package/dist/runtime/query/guard.js +20 -0
- package/dist/runtime/query/guard.js.map +1 -1
- package/dist/runtime/query/index.d.ts +6 -0
- package/dist/runtime/query/index.d.ts.map +1 -1
- package/dist/runtime/query/index.js +3 -0
- package/dist/runtime/query/index.js.map +1 -1
- package/dist/runtime/query/iteration/index.d.ts +2 -0
- package/dist/runtime/query/iteration/index.d.ts.map +1 -1
- package/dist/runtime/query/iteration/index.js +27 -1
- package/dist/runtime/query/iteration/index.js.map +1 -1
- package/dist/runtime/query/iteration/phases/compaction.d.ts +1 -0
- package/dist/runtime/query/iteration/phases/compaction.d.ts.map +1 -1
- package/dist/runtime/query/iteration/phases/compaction.js +164 -43
- 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/precompute.d.ts +60 -0
- package/dist/runtime/query/iteration/phases/precompute.d.ts.map +1 -0
- package/dist/runtime/query/iteration/phases/precompute.js +240 -0
- package/dist/runtime/query/iteration/phases/precompute.js.map +1 -0
- package/dist/runtime/query/turn/outcome-ledger.d.ts +14 -0
- package/dist/runtime/query/turn/outcome-ledger.d.ts.map +1 -1
- package/dist/runtime/query/turn/outcome-ledger.js +28 -0
- package/dist/runtime/query/turn/outcome-ledger.js.map +1 -1
- package/dist/scheduler/completion-inbox.d.ts.map +1 -1
- package/dist/scheduler/completion-inbox.js +15 -0
- package/dist/scheduler/completion-inbox.js.map +1 -1
- package/dist/store/goal/gates.d.ts +53 -0
- package/dist/store/goal/gates.d.ts.map +1 -0
- package/dist/store/goal/gates.js +664 -0
- package/dist/store/goal/gates.js.map +1 -0
- package/dist/store/goal/index.d.ts +16 -1
- package/dist/store/goal/index.d.ts.map +1 -1
- package/dist/store/goal/index.js +74 -0
- package/dist/store/goal/index.js.map +1 -1
- package/dist/store/session-index/index.d.ts +13 -0
- package/dist/store/session-index/index.d.ts.map +1 -1
- package/dist/store/session-index/index.js +1 -0
- package/dist/store/session-index/index.js.map +1 -1
- package/dist/store/session-index/rebuild.d.ts +12 -0
- package/dist/store/session-index/rebuild.d.ts.map +1 -1
- package/dist/store/session-index/rebuild.js +20 -4
- package/dist/store/session-index/rebuild.js.map +1 -1
- package/dist/store/session-index/sqlite.d.ts +20 -0
- package/dist/store/session-index/sqlite.d.ts.map +1 -1
- package/dist/store/session-index/sqlite.js +50 -12
- package/dist/store/session-index/sqlite.js.map +1 -1
- package/dist/tools/admit-facts.d.ts.map +1 -1
- package/dist/tools/admit-facts.js +59 -0
- package/dist/tools/admit-facts.js.map +1 -1
- package/dist/tools/builtins/bash.js +1 -1
- package/dist/tools/builtins/bash.js.map +1 -1
- package/dist/tools/builtins/browser.d.ts.map +1 -1
- package/dist/tools/builtins/browser.js +2 -0
- package/dist/tools/builtins/browser.js.map +1 -1
- package/dist/tools/builtins/monitor.d.ts.map +1 -1
- package/dist/tools/builtins/monitor.js +1 -0
- package/dist/tools/builtins/monitor.js.map +1 -1
- package/dist/tools/builtins/search-tools.js +2 -2
- package/dist/tools/builtins/search-tools.js.map +1 -1
- package/dist/tools/builtins/sleep-guard.js +1 -1
- package/dist/tools/builtins/sleep-guard.js.map +1 -1
- package/dist/tools/builtins/wait-for-job.js +1 -1
- package/dist/tools/builtins/wait-for-job.js.map +1 -1
- package/dist/tools/coordinator/ask-user-question.d.ts.map +1 -1
- package/dist/tools/coordinator/ask-user-question.js +92 -3
- package/dist/tools/coordinator/ask-user-question.js.map +1 -1
- package/dist/tools/coordinator/index.d.ts.map +1 -1
- package/dist/tools/coordinator/index.js +3 -0
- package/dist/tools/coordinator/index.js.map +1 -1
- package/dist/tools/defineTool.d.ts +2 -0
- package/dist/tools/defineTool.d.ts.map +1 -1
- package/dist/tools/defineTool.js +3 -0
- package/dist/tools/defineTool.js.map +1 -1
- package/dist/tools/goal/confirmation.d.ts +40 -2
- package/dist/tools/goal/confirmation.d.ts.map +1 -1
- package/dist/tools/goal/confirmation.js +117 -0
- package/dist/tools/goal/confirmation.js.map +1 -1
- package/dist/tools/goal/index.d.ts.map +1 -1
- package/dist/tools/goal/index.js +14 -2
- package/dist/tools/goal/index.js.map +1 -1
- package/dist/tools/memory/save.d.ts.map +1 -1
- package/dist/tools/memory/save.js +1 -0
- package/dist/tools/memory/save.js.map +1 -1
- package/dist/tools/schedules/index.d.ts +1 -0
- package/dist/tools/schedules/index.d.ts.map +1 -1
- package/dist/tools/schedules/index.js +1 -0
- package/dist/tools/schedules/index.js.map +1 -1
- package/dist/tools/schedules/loop-tool.d.ts.map +1 -1
- package/dist/tools/schedules/loop-tool.js +1 -0
- package/dist/tools/schedules/loop-tool.js.map +1 -1
- package/dist/tools/schedules/present.d.ts.map +1 -1
- package/dist/tools/schedules/present.js +2 -0
- package/dist/tools/schedules/present.js.map +1 -1
- package/dist/tools/schedules/schedule-tool.d.ts.map +1 -1
- package/dist/tools/schedules/schedule-tool.js +79 -9
- package/dist/tools/schedules/schedule-tool.js.map +1 -1
- package/dist/tools/schedules/self-tool.d.ts +16 -0
- package/dist/tools/schedules/self-tool.d.ts.map +1 -0
- package/dist/tools/schedules/self-tool.js +140 -0
- package/dist/tools/schedules/self-tool.js.map +1 -0
- package/dist/tools/schedules/timer-tools.d.ts.map +1 -1
- package/dist/tools/schedules/timer-tools.js +1 -0
- package/dist/tools/schedules/timer-tools.js.map +1 -1
- package/dist/tools/schedules/types.d.ts +63 -0
- package/dist/tools/schedules/types.d.ts.map +1 -1
- package/dist/toolsets/manager.d.ts +10 -0
- package/dist/toolsets/manager.d.ts.map +1 -1
- package/dist/toolsets/manager.js +56 -7
- package/dist/toolsets/manager.js.map +1 -1
- package/dist/turn/memory-promoter.d.ts.map +1 -1
- package/dist/turn/memory-promoter.js +20 -4
- package/dist/turn/memory-promoter.js.map +1 -1
- package/dist/types/agent/base.d.ts +6 -0
- package/dist/types/agent/base.d.ts.map +1 -1
- package/dist/types/agent/supervisor.d.ts +10 -0
- package/dist/types/agent/supervisor.d.ts.map +1 -1
- package/dist/types/agent/task.d.ts +11 -0
- package/dist/types/agent/task.d.ts.map +1 -1
- package/dist/types/agent/task.js.map +1 -1
- package/dist/types/goal/index.d.ts +66 -0
- package/dist/types/goal/index.d.ts.map +1 -1
- package/dist/types/hitl/index.d.ts +8 -0
- package/dist/types/hitl/index.d.ts.map +1 -1
- package/dist/types/hitl/index.js.map +1 -1
- package/dist/types/message/index.d.ts +7 -0
- package/dist/types/message/index.d.ts.map +1 -1
- package/dist/types/message/index.js.map +1 -1
- package/dist/types/session/events.d.ts +7 -0
- package/dist/types/session/events.d.ts.map +1 -1
- package/dist/types/session/events.js.map +1 -1
- package/dist/types/session/outcome.d.ts +12 -0
- package/dist/types/session/outcome.d.ts.map +1 -1
- package/dist/types/session/outcome.js.map +1 -1
- package/dist/types/session/records.d.ts +79 -1
- package/dist/types/session/records.d.ts.map +1 -1
- package/dist/types/session/records.js +24 -0
- package/dist/types/session/records.js.map +1 -1
- package/dist/types/tool/index.d.ts +7 -0
- package/dist/types/tool/index.d.ts.map +1 -1
- package/dist/types/tool/index.js.map +1 -1
- package/dist/types/tool/presentation.d.ts +21 -0
- package/dist/types/tool/presentation.d.ts.map +1 -1
- package/package.json +6 -6
- package/src/agents/QueryAgent.ts +1 -0
- package/src/agents/examples/SupervisorAgent.ts +5 -0
- package/src/authorization/protected-paths.ts +4 -0
- package/src/compaction/index.ts +1 -0
- package/src/compaction/manual.ts +130 -23
- package/src/compaction/model-summary.ts +118 -23
- package/src/compaction/precompute.ts +390 -0
- package/src/compaction/restore.ts +74 -1
- package/src/compaction/summary.ts +69 -3
- package/src/config/runtime.ts +20 -3
- package/src/connector/index.ts +3 -0
- package/src/connector/mcp/client.ts +49 -7
- package/src/connector/mcp/index.ts +5 -0
- package/src/connector/mcp/sandbox-stdio.ts +214 -0
- package/src/connector/mcp/stdio-program.ts +68 -0
- package/src/connector/mcp/stdio.ts +5 -2
- package/src/connector/web/guarded-fetch.ts +197 -30
- package/src/connector/web/index.ts +4 -1
- package/src/manager/agent/lifecycle.ts +10 -1
- package/src/manager/session/turn-recorder.ts +92 -5
- package/src/peers/protocol.ts +4 -0
- package/src/peers/record.ts +4 -0
- package/src/plugin/hook-module/capabilities.ts +36 -14
- package/src/plugin/hook-module/host.ts +86 -13
- package/src/plugin/hook-module/index.ts +3 -0
- package/src/plugin/index.ts +3 -0
- package/src/plugin/shell-hook-execute.ts +126 -0
- package/src/plugin/shell-hook-restrict.ts +66 -0
- package/src/plugin/shell-hook.ts +138 -10
- package/src/public-runtime.ts +41 -0
- package/src/public-tools.ts +2 -0
- package/src/public-types.ts +21 -0
- package/src/registry/command/kernel-commands.ts +62 -3
- package/src/registry/tool/execute.ts +14 -0
- package/src/runtime/jobs/websocket-source.ts +2 -46
- package/src/runtime/query/budget-nudge.ts +92 -0
- package/src/runtime/query/compact-session.ts +195 -70
- package/src/runtime/query/events.ts +29 -11
- package/src/runtime/query/executor/tool-call-admission.ts +62 -17
- package/src/runtime/query/guard.ts +22 -0
- package/src/runtime/query/index.ts +10 -0
- package/src/runtime/query/iteration/index.ts +26 -1
- package/src/runtime/query/iteration/phases/compaction.ts +173 -43
- package/src/runtime/query/iteration/phases/context.ts +6 -0
- package/src/runtime/query/iteration/phases/precompute.ts +277 -0
- package/src/runtime/query/turn/outcome-ledger.ts +34 -0
- package/src/scheduler/completion-inbox.ts +14 -0
- package/src/store/goal/gates.ts +738 -0
- package/src/store/goal/index.ts +109 -0
- package/src/store/session-index/index.ts +14 -0
- package/src/store/session-index/rebuild.ts +22 -4
- package/src/store/session-index/sqlite.ts +63 -14
- package/src/tools/admit-facts.ts +64 -0
- package/src/tools/builtins/bash.ts +1 -1
- package/src/tools/builtins/browser.ts +4 -0
- package/src/tools/builtins/monitor.ts +2 -0
- package/src/tools/builtins/search-tools.ts +2 -2
- package/src/tools/builtins/sleep-guard.ts +1 -1
- package/src/tools/builtins/wait-for-job.ts +1 -1
- package/src/tools/coordinator/ask-user-question.ts +124 -13
- package/src/tools/coordinator/index.ts +3 -0
- package/src/tools/defineTool.ts +5 -0
- package/src/tools/goal/confirmation.ts +171 -3
- package/src/tools/goal/index.ts +15 -3
- package/src/tools/memory/save.ts +2 -0
- package/src/tools/schedules/index.ts +1 -0
- package/src/tools/schedules/loop-tool.ts +2 -0
- package/src/tools/schedules/present.ts +2 -0
- package/src/tools/schedules/schedule-tool.ts +84 -9
- package/src/tools/schedules/self-tool.ts +152 -0
- package/src/tools/schedules/timer-tools.ts +2 -0
- package/src/tools/schedules/types.ts +62 -0
- package/src/toolsets/manager.ts +55 -8
- package/src/turn/memory-promoter.ts +24 -3
- package/src/types/agent/base.ts +7 -0
- package/src/types/agent/supervisor.ts +11 -0
- package/src/types/agent/task.ts +12 -0
- package/src/types/goal/index.ts +72 -0
- package/src/types/hitl/index.ts +8 -0
- package/src/types/message/index.ts +7 -0
- package/src/types/session/events.ts +7 -0
- package/src/types/session/outcome.ts +16 -1
- package/src/types/session/records.ts +27 -0
- package/src/types/tool/index.ts +7 -0
- package/src/types/tool/presentation.ts +22 -0
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Limiting what a hook's answer may do.
|
|
3
|
+
*
|
|
4
|
+
* A host that cannot vouch for the code behind a hook may still want its
|
|
5
|
+
* refusals and its notes to the model. `ShellHookOptions.restrictVerdicts`
|
|
6
|
+
* keeps those and drops every answer that widens what the session may do:
|
|
7
|
+
*
|
|
8
|
+
* - an `allow` (a hook's `permissionDecision: allow`, `decision: approve`, a
|
|
9
|
+
* module's `allow: true`) stands in for no one's yes; `ask` is kept, since it
|
|
10
|
+
* only sends the call to a person;
|
|
11
|
+
* - `updatedInput` does not rewrite the call;
|
|
12
|
+
* - `retry` does not run a call again;
|
|
13
|
+
* - an elicitation answer does not stand in for the person's;
|
|
14
|
+
* - a worktree folder, files to watch and a retryable mark are not taken.
|
|
15
|
+
*
|
|
16
|
+
* Kept: `deny`, `block`, `skip`, `error`, `halt`, `additionalContext`
|
|
17
|
+
* (`context`, `annotate`), notices, and a replacement of a tool's result
|
|
18
|
+
* (which only narrows what the model reads; a guard that failed closed
|
|
19
|
+
* answers with one).
|
|
20
|
+
*/
|
|
21
|
+
import type { PluginHookResult } from '../types/plugin/index.js';
|
|
22
|
+
import type { Logger } from '../utils/logger.js';
|
|
23
|
+
/**
|
|
24
|
+
* `result` as a restricted host accepts it. A verdict that only narrows is
|
|
25
|
+
* returned as it came; one that widens is returned without the widening part.
|
|
26
|
+
*/
|
|
27
|
+
export declare function restrictHookVerdict(result: PluginHookResult, log: Logger, where: {
|
|
28
|
+
readonly event: string;
|
|
29
|
+
readonly command: string;
|
|
30
|
+
}): PluginHookResult;
|
|
31
|
+
//# sourceMappingURL=shell-hook-restrict.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shell-hook-restrict.d.ts","sourceRoot":"","sources":["../../src/plugin/shell-hook-restrict.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAA;AAChE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAA;AAehD;;;GAGG;AACH,wBAAgB,mBAAmB,CAClC,MAAM,EAAE,gBAAgB,EACxB,GAAG,EAAE,MAAM,EACX,KAAK,EAAE;IAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GACzD,gBAAgB,CAoBlB"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Limiting what a hook's answer may do.
|
|
3
|
+
*
|
|
4
|
+
* A host that cannot vouch for the code behind a hook may still want its
|
|
5
|
+
* refusals and its notes to the model. `ShellHookOptions.restrictVerdicts`
|
|
6
|
+
* keeps those and drops every answer that widens what the session may do:
|
|
7
|
+
*
|
|
8
|
+
* - an `allow` (a hook's `permissionDecision: allow`, `decision: approve`, a
|
|
9
|
+
* module's `allow: true`) stands in for no one's yes; `ask` is kept, since it
|
|
10
|
+
* only sends the call to a person;
|
|
11
|
+
* - `updatedInput` does not rewrite the call;
|
|
12
|
+
* - `retry` does not run a call again;
|
|
13
|
+
* - an elicitation answer does not stand in for the person's;
|
|
14
|
+
* - a worktree folder, files to watch and a retryable mark are not taken.
|
|
15
|
+
*
|
|
16
|
+
* Kept: `deny`, `block`, `skip`, `error`, `halt`, `additionalContext`
|
|
17
|
+
* (`context`, `annotate`), notices, and a replacement of a tool's result
|
|
18
|
+
* (which only narrows what the model reads; a guard that failed closed
|
|
19
|
+
* answers with one).
|
|
20
|
+
*/
|
|
21
|
+
/** What a restricted answer was stripped of, named for the log. */
|
|
22
|
+
function dropped(result) {
|
|
23
|
+
const names = [];
|
|
24
|
+
if (result.action === 'modify')
|
|
25
|
+
names.push('updatedInput');
|
|
26
|
+
if (result.action === 'retry')
|
|
27
|
+
names.push('retry');
|
|
28
|
+
if ('permission' in result && result.permission?.decision === 'allow')
|
|
29
|
+
names.push('allow');
|
|
30
|
+
if ('elicitation' in result && result.elicitation !== undefined)
|
|
31
|
+
names.push('elicitation');
|
|
32
|
+
if ('worktreePath' in result && result.worktreePath !== undefined)
|
|
33
|
+
names.push('worktreePath');
|
|
34
|
+
if ('watchPaths' in result && result.watchPaths !== undefined)
|
|
35
|
+
names.push('watchPaths');
|
|
36
|
+
if ('retryable' in result && result.retryable !== undefined)
|
|
37
|
+
names.push('retryable');
|
|
38
|
+
return names;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* `result` as a restricted host accepts it. A verdict that only narrows is
|
|
42
|
+
* returned as it came; one that widens is returned without the widening part.
|
|
43
|
+
*/
|
|
44
|
+
export function restrictHookVerdict(result, log, where) {
|
|
45
|
+
const names = dropped(result);
|
|
46
|
+
if (names.length === 0)
|
|
47
|
+
return result;
|
|
48
|
+
log.warn('a hook answer was narrowed by the host', {
|
|
49
|
+
'namzu.hook.event': where.event,
|
|
50
|
+
'namzu.hook.command': where.command,
|
|
51
|
+
'namzu.hook.dropped': names.join(','),
|
|
52
|
+
});
|
|
53
|
+
if (result.action === 'retry')
|
|
54
|
+
return { action: 'continue' };
|
|
55
|
+
const { elicitation, worktreePath, watchPaths, retryable, ...rest } = result;
|
|
56
|
+
const kept = rest;
|
|
57
|
+
if (kept.action === 'modify') {
|
|
58
|
+
kept.action = 'continue';
|
|
59
|
+
kept.input = undefined;
|
|
60
|
+
}
|
|
61
|
+
const permission = kept.permission;
|
|
62
|
+
if (permission?.decision === 'allow')
|
|
63
|
+
kept.permission = undefined;
|
|
64
|
+
for (const key of Object.keys(kept))
|
|
65
|
+
if (kept[key] === undefined)
|
|
66
|
+
delete kept[key];
|
|
67
|
+
return kept;
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=shell-hook-restrict.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shell-hook-restrict.js","sourceRoot":"","sources":["../../src/plugin/shell-hook-restrict.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAKH,mEAAmE;AACnE,SAAS,OAAO,CAAC,MAAwB;IACxC,MAAM,KAAK,GAAa,EAAE,CAAA;IAC1B,IAAI,MAAM,CAAC,MAAM,KAAK,QAAQ;QAAE,KAAK,CAAC,IAAI,CAAC,cAAc,CAAC,CAAA;IAC1D,IAAI,MAAM,CAAC,MAAM,KAAK,OAAO;QAAE,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;IAClD,IAAI,YAAY,IAAI,MAAM,IAAI,MAAM,CAAC,UAAU,EAAE,QAAQ,KAAK,OAAO;QAAE,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;IAC1F,IAAI,aAAa,IAAI,MAAM,IAAI,MAAM,CAAC,WAAW,KAAK,SAAS;QAAE,KAAK,CAAC,IAAI,CAAC,aAAa,CAAC,CAAA;IAC1F,IAAI,cAAc,IAAI,MAAM,IAAI,MAAM,CAAC,YAAY,KAAK,SAAS;QAAE,KAAK,CAAC,IAAI,CAAC,cAAc,CAAC,CAAA;IAC7F,IAAI,YAAY,IAAI,MAAM,IAAI,MAAM,CAAC,UAAU,KAAK,SAAS;QAAE,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,CAAA;IACvF,IAAI,WAAW,IAAI,MAAM,IAAI,MAAM,CA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,7 @@ import type { Logger } from '../utils/logger.js';
|
|
|
110
110
|
import type { PluginLifecycleManager } from './lifecycle.js';
|
|
111
111
|
import type { SessionHookEnv } from './session-hook-env.js';
|
|
112
112
|
import { type PluginFolders } from './shell-hook-env.js';
|
|
113
|
+
import { type ShellHookExecutor } from './shell-hook-execute.js';
|
|
113
114
|
import { type ShellHookToolNames } from './shell-hook-tool-names.js';
|
|
114
115
|
/**
|
|
115
116
|
* The events a shell hook may attach to: the ones an operator can act on
|
|
@@ -447,8 +448,14 @@ export interface ShellHookInput {
|
|
|
447
448
|
}
|
|
448
449
|
/** The JSON a hook receives on stdin (or as an HTTP body). */
|
|
449
450
|
export declare function shellHookPayload(input: ShellHookInput): string;
|
|
450
|
-
/**
|
|
451
|
-
|
|
451
|
+
/**
|
|
452
|
+
* Run one hook command to completion, bounded by its deadline and capture.
|
|
453
|
+
*
|
|
454
|
+
* With `execute` the command goes to that executor and nothing is started in
|
|
455
|
+
* this process: no fallback exists, and the host's own environment is not
|
|
456
|
+
* handed over (the command gets the hook's variables and `extraEnv` only).
|
|
457
|
+
*/
|
|
458
|
+
export declare function runShellHook(entry: ShellHookEntry, input: ShellHookInput, signal?: AbortSignal, execute?: ShellHookExecutor): Promise<ShellHookOutcome>;
|
|
452
459
|
/** The PascalCase spelling of each event name, which a hook's JSON may use. */
|
|
453
460
|
export declare const SHELL_HOOK_PASCAL_EVENT_NAMES: Readonly<Partial<Record<ShellHookEvent, string>>>;
|
|
454
461
|
/** The tool tied to an answer: what a rewrite or a replacement is read against. */
|
|
@@ -501,6 +508,16 @@ export type ShellHookMcpToolCaller = (request: {
|
|
|
501
508
|
readonly turnId?: string;
|
|
502
509
|
readonly signal: AbortSignal;
|
|
503
510
|
}) => Promise<ShellHookMcpToolAnswer | undefined>;
|
|
511
|
+
/** The types an entry can have (`type` absent reads as `command`). */
|
|
512
|
+
export type ShellHookHandlerType = 'command' | 'http' | 'prompt' | 'mcp_tool';
|
|
513
|
+
/**
|
|
514
|
+
* Why `entry` may not be registered under `options.handlerTypes` and
|
|
515
|
+
* `options.matcherForms`, or `undefined` when it may. The wording names what
|
|
516
|
+
* was refused and which option refused it.
|
|
517
|
+
*/
|
|
518
|
+
export declare function shellHookEntryLimitProblem(entry: Pick<ShellHookHandler, 'matcher'> & {
|
|
519
|
+
readonly type?: ShellHookHandlerType;
|
|
520
|
+
}, options: Pick<ShellHookOptions, 'handlerTypes' | 'matcherForms'>): string | undefined;
|
|
504
521
|
export interface ShellHookOptions {
|
|
505
522
|
/** Answers `prompt` hooks. Without it a `prompt` hook is logged and lets the action go ahead. */
|
|
506
523
|
readonly judge?: ShellHookJudge;
|
|
@@ -571,6 +588,46 @@ export interface ShellHookOptions {
|
|
|
571
588
|
* Without it no hook gets the variable and nothing is carried.
|
|
572
589
|
*/
|
|
573
590
|
readonly hookEnv?: SessionHookEnv;
|
|
591
|
+
/**
|
|
592
|
+
* Runs every command hook of this adapter somewhere other than this process
|
|
593
|
+
* (a sandbox the host keeps its tools in). With it set, no hook command is
|
|
594
|
+
* ever started as a child of the host, whatever the event: a request the
|
|
595
|
+
* executor cannot serve fails the hook, it does not run on the host. The
|
|
596
|
+
* command gets the hook's own variables and `extraEnv`, not the host's
|
|
597
|
+
* environment, and the plugin's data folder is not made here. A hook that
|
|
598
|
+
* writes variables for later commands (`NAMZU_ENV_FILE`) is not given the
|
|
599
|
+
* file, which is a host path. `http`, `prompt` and `mcp_tool` hooks start no
|
|
600
|
+
* process and are not routed through it.
|
|
601
|
+
*/
|
|
602
|
+
readonly execute?: ShellHookExecutor;
|
|
603
|
+
/**
|
|
604
|
+
* Accept only the answers that narrow: `deny`, `block`, `skip`, errors,
|
|
605
|
+
* `additionalContext`, notices and `halt`. An `allow`, `permissionDecision:
|
|
606
|
+
* allow`, `updatedInput`, `retry` and the other answers that widen what the
|
|
607
|
+
* session may do are dropped, whichever hook gave them. Absent, every answer
|
|
608
|
+
* is read as before.
|
|
609
|
+
*/
|
|
610
|
+
readonly restrictVerdicts?: boolean;
|
|
611
|
+
/**
|
|
612
|
+
* The entry types this adapter accepts: an allow-list of `command`, `http`,
|
|
613
|
+
* `prompt` and `mcp_tool`. An entry of any other type is refused when it is
|
|
614
|
+
* registered, before anything is attached, with a refusal that names the
|
|
615
|
+
* entry's type and the list (`createShellHook` and `attachShellHooks` throw
|
|
616
|
+
* it). For a host that runs untrusted entries and wants no web request, no
|
|
617
|
+
* judge call and no tool call to leave from its own process. Absent, every
|
|
618
|
+
* type is accepted. An entry with no `type` is a `command`.
|
|
619
|
+
*/
|
|
620
|
+
readonly handlerTypes?: readonly ShellHookHandlerType[];
|
|
621
|
+
/**
|
|
622
|
+
* How an entry's `matcher` may be written. `'names'` refuses, when the entry
|
|
623
|
+
* is registered, any matcher that is not a plain name list: a name, names
|
|
624
|
+
* joined by `|` (or `,`), a prefix ending in `*` (`mcp__server__*`), empty or
|
|
625
|
+
* `*`. A regular expression is never compiled or run then, so a pattern that
|
|
626
|
+
* backtracks without bound cannot reach the host. The refusal names the
|
|
627
|
+
* matcher. Absent, a matcher is read as before (a name list, or a regular
|
|
628
|
+
* expression).
|
|
629
|
+
*/
|
|
630
|
+
readonly matcherForms?: 'names';
|
|
574
631
|
/**
|
|
575
632
|
* Called when a hook of this adapter ran out its deadline and was ended.
|
|
576
633
|
* `hook` is the command, URL or prompt text the entry names.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shell-hook.d.ts","sourceRoot":"","sources":["../../src/plugin/shell-hook.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyGG;AAmBH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AACrD,OAAO,KAAK,EACX,oBAAoB,EACpB,qBAAqB,EAErB,qBAAqB,EACrB,gBAAgB,EAChB,iBAAiB,EACjB,oB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5B,OAAO,EAAE,gBAAgB,GACvB,oBAAoB,CA2MtB;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAC/B,OAAO,EAAE,IAAI,CAAC,sBAAsB,EAAE,cAAc,CAAC,EACrD,KAAK,EAAE,gBAAgB,EACvB,OAAO,EAAE,gBAAgB,GAAG;IAAE,QAAQ,CAAC,QAAQ,CAAC,EAAE,QAAQ,CAAA;CAAE,GAC1D,MAAM,CAyBR"}
|
|
@@ -119,7 +119,9 @@ import { NOOP_LOGGER } from '../utils/log/create-logger.js';
|
|
|
119
119
|
import { boundHookReplacement } from './hook-context.js';
|
|
120
120
|
import { readHookCommand } from './shell-hook-command.js';
|
|
121
121
|
import { hookUnsetVariableHint, movedEnvironment, shellPathOutsideEnv, substituteMovedFolders, } from './shell-hook-env.js';
|
|
122
|
+
import { runThroughExecutor } from './shell-hook-execute.js';
|
|
122
123
|
import { postHookJson } from './shell-hook-http.js';
|
|
124
|
+
import { restrictHookVerdict } from './shell-hook-restrict.js';
|
|
123
125
|
import { shellHookToolName } from './shell-hook-tool-names.js';
|
|
124
126
|
import { worktreeHookVerdict } from './worktree-hook-answer.js';
|
|
125
127
|
export const SHELL_HOOK_EVENTS = [
|
|
@@ -651,15 +653,21 @@ function isExecutableFile(path) {
|
|
|
651
653
|
return false;
|
|
652
654
|
}
|
|
653
655
|
}
|
|
654
|
-
/**
|
|
655
|
-
|
|
656
|
+
/**
|
|
657
|
+
* Run one hook command to completion, bounded by its deadline and capture.
|
|
658
|
+
*
|
|
659
|
+
* With `execute` the command goes to that executor and nothing is started in
|
|
660
|
+
* this process: no fallback exists, and the host's own environment is not
|
|
661
|
+
* handed over (the command gets the hook's variables and `extraEnv` only).
|
|
662
|
+
*/
|
|
663
|
+
export function runShellHook(entry, input, signal, execute) {
|
|
656
664
|
const timeoutMs = Math.min(MAX_SHELL_HOOK_TIMEOUT_MS, Math.max(1, entry.timeoutMs ?? DEFAULT_SHELL_HOOK_TIMEOUT_MS));
|
|
657
665
|
const payload = shellHookPayload(input);
|
|
658
666
|
const toolPath = pathOf(input.toolInput);
|
|
659
667
|
// A hook outside a turn must not see a turn id, including one the host
|
|
660
668
|
// inherited from an enclosing hook's environment.
|
|
661
669
|
// Nor the variables file of an enclosing hook: only the three events that own one get it.
|
|
662
|
-
const { NAMZU_TURN_ID: _inheritedTurnId, NAMZU_ENV_FILE: _inheritedEnvFile, ...inherited } = process.env;
|
|
670
|
+
const { NAMZU_TURN_ID: _inheritedTurnId, NAMZU_ENV_FILE: _inheritedEnvFile, ...inherited } = execute !== undefined ? {} : process.env;
|
|
663
671
|
const projectDir = input.projectDir ?? input.cwd;
|
|
664
672
|
const kernel = {
|
|
665
673
|
NAMZU_HOOK_EVENT: input.event,
|
|
@@ -704,6 +712,22 @@ export function runShellHook(entry, input, signal) {
|
|
|
704
712
|
args: entry.args.map((arg) => substituteMovedFolders(arg, env)),
|
|
705
713
|
};
|
|
706
714
|
const unsetVariables = unset.length > 0 ? { unsetVariables: unset } : {};
|
|
715
|
+
if (execute !== undefined) {
|
|
716
|
+
// Nothing below this block runs: no host folder is made, no host process is started.
|
|
717
|
+
const sent = {};
|
|
718
|
+
for (const [name, value] of Object.entries(withSessionChildMarker(withSafeGitConfig(env)))) {
|
|
719
|
+
if (typeof value === 'string')
|
|
720
|
+
sent[name] = value;
|
|
721
|
+
}
|
|
722
|
+
return runThroughExecutor(execute, {
|
|
723
|
+
command: placed.command,
|
|
724
|
+
...(placed.args !== undefined ? { args: placed.args } : {}),
|
|
725
|
+
stdin: payload,
|
|
726
|
+
env: sent,
|
|
727
|
+
cwd: input.cwd,
|
|
728
|
+
timeoutMs,
|
|
729
|
+
}, MAX_CAPTURE_BYTES, signal, unsetVariables);
|
|
730
|
+
}
|
|
707
731
|
if (pluginFolders !== undefined) {
|
|
708
732
|
try {
|
|
709
733
|
// Created when first needed; never inside the plugin's own folder.
|
|
@@ -1625,6 +1649,30 @@ export function describeShellHook(entry) {
|
|
|
1625
1649
|
function isAsyncShellHook(entry) {
|
|
1626
1650
|
return (entry.type === undefined || entry.type === 'command') && entry.async === true;
|
|
1627
1651
|
}
|
|
1652
|
+
/** A part `matcherForms: 'names'` accepts: a name, or a prefix with one `*` at the end only. */
|
|
1653
|
+
const NAME_ONLY_PART = /^[A-Za-z0-9_.:-]+\*?$|^\*$/;
|
|
1654
|
+
/**
|
|
1655
|
+
* Why `entry` may not be registered under `options.handlerTypes` and
|
|
1656
|
+
* `options.matcherForms`, or `undefined` when it may. The wording names what
|
|
1657
|
+
* was refused and which option refused it.
|
|
1658
|
+
*/
|
|
1659
|
+
export function shellHookEntryLimitProblem(entry, options) {
|
|
1660
|
+
const type = entry.type ?? 'command';
|
|
1661
|
+
if (options.handlerTypes !== undefined && !options.handlerTypes.includes(type)) {
|
|
1662
|
+
const allowed = options.handlerTypes.length > 0 ? options.handlerTypes.join(', ') : 'none';
|
|
1663
|
+
return `a ${type} hook is refused: this host accepts only ${allowed} hooks (handlerTypes), so the entry was not attached`;
|
|
1664
|
+
}
|
|
1665
|
+
if (options.matcherForms === 'names') {
|
|
1666
|
+
const matcher = entry.matcher;
|
|
1667
|
+
if (matcher === undefined || matcher.trim() === '' || matcher.trim() === '*')
|
|
1668
|
+
return undefined;
|
|
1669
|
+
const parts = matcher.split(/[|,]/).map((part) => part.trim());
|
|
1670
|
+
if (!parts.every((part) => NAME_ONLY_PART.test(part)) || matcher.includes('.*')) {
|
|
1671
|
+
return `the matcher "${matcher}" is refused: this host accepts only a name, names joined by |, a prefix ending in * (mcp__server__*), empty or * (matcherForms: names), so the entry was not attached`;
|
|
1672
|
+
}
|
|
1673
|
+
}
|
|
1674
|
+
return undefined;
|
|
1675
|
+
}
|
|
1628
1676
|
/** The deadline for `prompt` hooks when they name none. */
|
|
1629
1677
|
export const DEFAULT_PROMPT_HOOK_TIMEOUT_MS = 30_000;
|
|
1630
1678
|
const MAX_PROMPT_EVENT_CHARS = 30_000;
|
|
@@ -1770,7 +1818,7 @@ async function runMcpToolHook(entry, input, call, signal, log) {
|
|
|
1770
1818
|
* out of sight), and a `prompt` or `mcp_tool` hook cannot do it at all, which
|
|
1771
1819
|
* is said as a failure rather than skipped.
|
|
1772
1820
|
*/
|
|
1773
|
-
async function runWorktreeHook(event, entry, input, signal, reportTimeout) {
|
|
1821
|
+
async function runWorktreeHook(event, entry, input, signal, reportTimeout, execute) {
|
|
1774
1822
|
const label = describeShellHook(entry);
|
|
1775
1823
|
if (entry.type === 'prompt' || entry.type === 'mcp_tool') {
|
|
1776
1824
|
return {
|
|
@@ -1797,7 +1845,7 @@ async function runWorktreeHook(event, entry, input, signal, reportTimeout) {
|
|
|
1797
1845
|
...(response.error !== undefined ? { spawnError: response.error } : {}),
|
|
1798
1846
|
});
|
|
1799
1847
|
}
|
|
1800
|
-
const outcome = await runShellHook(entry, input, signal);
|
|
1848
|
+
const outcome = await runShellHook(entry, input, signal, execute);
|
|
1801
1849
|
reportTimeout(outcome.timedOut);
|
|
1802
1850
|
return worktreeHookVerdict(event, label, outcome);
|
|
1803
1851
|
}
|
|
@@ -1879,6 +1927,9 @@ export function shellHookInputFor(event, context, options, extra = {}) {
|
|
|
1879
1927
|
}
|
|
1880
1928
|
/** One entry as a hook definition the lifecycle manager accepts. */
|
|
1881
1929
|
export function createShellHook(event, configured, options) {
|
|
1930
|
+
const refusal = shellHookEntryLimitProblem(configured, options);
|
|
1931
|
+
if (refusal !== undefined)
|
|
1932
|
+
throw new Error(`Shell hook ${event}: ${refusal}`);
|
|
1882
1933
|
const log = options.log ?? NOOP_LOGGER;
|
|
1883
1934
|
const envSlot = nextHookEnvSlot++;
|
|
1884
1935
|
const eventDefault = options.defaultTimeoutMs?.[event];
|
|
@@ -1895,7 +1946,7 @@ export function createShellHook(event, configured, options) {
|
|
|
1895
1946
|
let spent = false;
|
|
1896
1947
|
// The shell verdict branches on `event`, but TypeScript cannot retain that
|
|
1897
1948
|
// correlation across the async handler closure and the union of events.
|
|
1898
|
-
|
|
1949
|
+
const definition = {
|
|
1899
1950
|
event,
|
|
1900
1951
|
...(entry.statusMessage !== undefined ? { statusMessage: entry.statusMessage } : {}),
|
|
1901
1952
|
// A file named by the matcher is watched for as long as the hook is attached.
|
|
@@ -1975,7 +2026,8 @@ export function createShellHook(event, configured, options) {
|
|
|
1975
2026
|
? event
|
|
1976
2027
|
: undefined;
|
|
1977
2028
|
const runsACommand = entry.type === undefined || entry.type === 'command';
|
|
1978
|
-
|
|
2029
|
+
// The variables file is a host path; a command run elsewhere is not given it.
|
|
2030
|
+
const envFile = envEvent !== undefined && runsACommand && options.execute === undefined
|
|
1979
2031
|
? options.hookEnv?.fileFor(envEvent, envSlot)
|
|
1980
2032
|
: undefined;
|
|
1981
2033
|
const hookInput = shellHookInputFor(event, context, options, {
|
|
@@ -1987,7 +2039,7 @@ export function createShellHook(event, configured, options) {
|
|
|
1987
2039
|
...(context.toolInput !== undefined ? { toolInput: context.toolInput } : {}),
|
|
1988
2040
|
};
|
|
1989
2041
|
if (event === 'worktree_create' || event === 'worktree_remove') {
|
|
1990
|
-
return runWorktreeHook(event, entry, hookInput, context.signal, reportTimeout);
|
|
2042
|
+
return runWorktreeHook(event, entry, hookInput, context.signal, reportTimeout, options.execute);
|
|
1991
2043
|
}
|
|
1992
2044
|
if (entry.type === 'http') {
|
|
1993
2045
|
const response = await postHookJson({
|
|
@@ -2019,9 +2071,9 @@ export function createShellHook(event, configured, options) {
|
|
|
2019
2071
|
if (entry.async === true) {
|
|
2020
2072
|
// Started and left running: it decides nothing, so nothing waits
|
|
2021
2073
|
// for it and its own failure is only written down.
|
|
2022
|
-
void runShellHook(entry, hookInput)
|
|
2074
|
+
void runShellHook(entry, hookInput, undefined, options.execute)
|
|
2023
2075
|
.then((outcome) => {
|
|
2024
|
-
if (envEvent !== undefined)
|
|
2076
|
+
if (envEvent !== undefined && options.execute === undefined)
|
|
2025
2077
|
options.hookEnv?.absorb(envEvent, envSlot);
|
|
2026
2078
|
const verdict = shellHookVerdict(event, entry, outcome, log, verdictCall);
|
|
2027
2079
|
if (verdict.action !== 'continue') {
|
|
@@ -2035,15 +2087,22 @@ export function createShellHook(event, configured, options) {
|
|
|
2035
2087
|
.catch(() => undefined);
|
|
2036
2088
|
return { action: 'continue' };
|
|
2037
2089
|
}
|
|
2038
|
-
const outcome = await runShellHook(entry, hookInput, context.signal);
|
|
2090
|
+
const outcome = await runShellHook(entry, hookInput, context.signal, options.execute);
|
|
2039
2091
|
// What the hook appended counts even when it was ended or failed after
|
|
2040
2092
|
// writing it: the lines are data it already gave.
|
|
2041
|
-
if (envEvent !== undefined)
|
|
2093
|
+
if (envEvent !== undefined && options.execute === undefined)
|
|
2042
2094
|
options.hookEnv?.absorb(envEvent, envSlot);
|
|
2043
2095
|
reportTimeout(outcome.timedOut);
|
|
2044
2096
|
return shellHookVerdict(event, entry, outcome, log, verdictCall);
|
|
2045
2097
|
},
|
|
2046
2098
|
};
|
|
2099
|
+
if (options.restrictVerdicts !== true)
|
|
2100
|
+
return definition;
|
|
2101
|
+
const where = { event, command: describeShellHook(entry) };
|
|
2102
|
+
return {
|
|
2103
|
+
...definition,
|
|
2104
|
+
handler: async (context) => restrictHookVerdict(await definition.handler(context), log, where),
|
|
2105
|
+
};
|
|
2047
2106
|
}
|
|
2048
2107
|
/**
|
|
2049
2108
|
* Register every entry on the manager, in file order within an event. The
|
|
@@ -2060,6 +2119,14 @@ export function attachShellHooks(manager, hooks, options) {
|
|
|
2060
2119
|
throw new Error(`Shell hook event '${key}' was renamed to '${renamed}'. Rename it in the hooks config.`);
|
|
2061
2120
|
}
|
|
2062
2121
|
}
|
|
2122
|
+
// Every entry is checked against the limits first, so a refusal leaves nothing attached.
|
|
2123
|
+
for (const event of SHELL_HOOK_EVENTS) {
|
|
2124
|
+
for (const entry of hooks[event] ?? []) {
|
|
2125
|
+
const refusal = shellHookEntryLimitProblem(entry, options);
|
|
2126
|
+
if (refusal !== undefined)
|
|
2127
|
+
throw new Error(`Shell hook ${event}: ${refusal}`);
|
|
2128
|
+
}
|
|
2129
|
+
}
|
|
2063
2130
|
const pluginId = options.pluginId ?? SHELL_HOOKS_PLUGIN_ID;
|
|
2064
2131
|
let count = 0;
|
|
2065
2132
|
for (const event of SHELL_HOOK_EVENTS) {
|