@namzu/sdk 71.0.1 → 72.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.
Files changed (268) hide show
  1. package/CHANGELOG.md +126 -0
  2. package/dist/agents/QueryAgent.d.ts.map +1 -1
  3. package/dist/agents/QueryAgent.js +1 -0
  4. package/dist/agents/QueryAgent.js.map +1 -1
  5. package/dist/authorization/readonly-commands.d.ts +9 -1
  6. package/dist/authorization/readonly-commands.d.ts.map +1 -1
  7. package/dist/authorization/readonly-commands.js +70 -4
  8. package/dist/authorization/readonly-commands.js.map +1 -1
  9. package/dist/authorization/shell-paths.d.ts.map +1 -1
  10. package/dist/authorization/shell-paths.js +68 -16
  11. package/dist/authorization/shell-paths.js.map +1 -1
  12. package/dist/compaction/index.d.ts +1 -1
  13. package/dist/compaction/index.d.ts.map +1 -1
  14. package/dist/compaction/index.js +1 -1
  15. package/dist/compaction/index.js.map +1 -1
  16. package/dist/compaction/manual.d.ts +8 -0
  17. package/dist/compaction/manual.d.ts.map +1 -1
  18. package/dist/compaction/manual.js +18 -14
  19. package/dist/compaction/manual.js.map +1 -1
  20. package/dist/compaction/model-summary.d.ts +24 -6
  21. package/dist/compaction/model-summary.d.ts.map +1 -1
  22. package/dist/compaction/model-summary.js +152 -28
  23. package/dist/compaction/model-summary.js.map +1 -1
  24. package/dist/compaction/restore.d.ts +23 -0
  25. package/dist/compaction/restore.d.ts.map +1 -1
  26. package/dist/compaction/restore.js +59 -1
  27. package/dist/compaction/restore.js.map +1 -1
  28. package/dist/compaction/summary.d.ts +37 -2
  29. package/dist/compaction/summary.d.ts.map +1 -1
  30. package/dist/compaction/summary.js +46 -6
  31. package/dist/compaction/summary.js.map +1 -1
  32. package/dist/config/registry.d.ts +2 -0
  33. package/dist/config/registry.d.ts.map +1 -1
  34. package/dist/config/registry.js +76 -5
  35. package/dist/config/registry.js.map +1 -1
  36. package/dist/config/runtime.js +3 -3
  37. package/dist/config/runtime.js.map +1 -1
  38. package/dist/connector/index.d.ts +2 -2
  39. package/dist/connector/index.d.ts.map +1 -1
  40. package/dist/connector/index.js +1 -1
  41. package/dist/connector/index.js.map +1 -1
  42. package/dist/connector/mcp/adapter.d.ts +8 -0
  43. package/dist/connector/mcp/adapter.d.ts.map +1 -1
  44. package/dist/connector/mcp/adapter.js +131 -1
  45. package/dist/connector/mcp/adapter.js.map +1 -1
  46. package/dist/connector/mcp/client.d.ts +26 -6
  47. package/dist/connector/mcp/client.d.ts.map +1 -1
  48. package/dist/connector/mcp/client.js +49 -7
  49. package/dist/connector/mcp/client.js.map +1 -1
  50. package/dist/connector/mcp/index.d.ts +2 -0
  51. package/dist/connector/mcp/index.d.ts.map +1 -1
  52. package/dist/connector/mcp/index.js +1 -0
  53. package/dist/connector/mcp/index.js.map +1 -1
  54. package/dist/connector/mcp/sandbox-stdio.d.ts +67 -0
  55. package/dist/connector/mcp/sandbox-stdio.d.ts.map +1 -0
  56. package/dist/connector/mcp/sandbox-stdio.js +178 -0
  57. package/dist/connector/mcp/sandbox-stdio.js.map +1 -0
  58. package/dist/connector/mcp/stdio-program.d.ts +34 -0
  59. package/dist/connector/mcp/stdio-program.d.ts.map +1 -0
  60. package/dist/connector/mcp/stdio-program.js +47 -0
  61. package/dist/connector/mcp/stdio-program.js.map +1 -0
  62. package/dist/connector/mcp/stdio.d.ts +12 -0
  63. package/dist/connector/mcp/stdio.d.ts.map +1 -1
  64. package/dist/connector/mcp/stdio.js +54 -7
  65. package/dist/connector/mcp/stdio.js.map +1 -1
  66. package/dist/connector/web/guarded-fetch.d.ts +51 -2
  67. package/dist/connector/web/guarded-fetch.d.ts.map +1 -1
  68. package/dist/connector/web/guarded-fetch.js +140 -19
  69. package/dist/connector/web/guarded-fetch.js.map +1 -1
  70. package/dist/connector/web/index.d.ts +2 -2
  71. package/dist/connector/web/index.d.ts.map +1 -1
  72. package/dist/connector/web/index.js +1 -1
  73. package/dist/connector/web/index.js.map +1 -1
  74. package/dist/constants/mcp/index.d.ts +29 -0
  75. package/dist/constants/mcp/index.d.ts.map +1 -1
  76. package/dist/constants/mcp/index.js +29 -0
  77. package/dist/constants/mcp/index.js.map +1 -1
  78. package/dist/manager/agent/lifecycle.d.ts +18 -1
  79. package/dist/manager/agent/lifecycle.d.ts.map +1 -1
  80. package/dist/manager/agent/lifecycle.js +53 -8
  81. package/dist/manager/agent/lifecycle.js.map +1 -1
  82. package/dist/plugin/hook-module/capabilities.d.ts.map +1 -1
  83. package/dist/plugin/hook-module/capabilities.js +24 -13
  84. package/dist/plugin/hook-module/capabilities.js.map +1 -1
  85. package/dist/plugin/hook-module/host.d.ts +31 -0
  86. package/dist/plugin/hook-module/host.d.ts.map +1 -1
  87. package/dist/plugin/hook-module/host.js +56 -13
  88. package/dist/plugin/hook-module/host.js.map +1 -1
  89. package/dist/plugin/hook-module/index.d.ts +3 -2
  90. package/dist/plugin/hook-module/index.d.ts.map +1 -1
  91. package/dist/plugin/hook-module/index.js +2 -1
  92. package/dist/plugin/hook-module/index.js.map +1 -1
  93. package/dist/plugin/index.d.ts +2 -1
  94. package/dist/plugin/index.d.ts.map +1 -1
  95. package/dist/plugin/index.js +1 -0
  96. package/dist/plugin/index.js.map +1 -1
  97. package/dist/plugin/shell-hook-execute.d.ts +55 -0
  98. package/dist/plugin/shell-hook-execute.d.ts.map +1 -0
  99. package/dist/plugin/shell-hook-execute.js +73 -0
  100. package/dist/plugin/shell-hook-execute.js.map +1 -0
  101. package/dist/plugin/shell-hook-restrict.d.ts +31 -0
  102. package/dist/plugin/shell-hook-restrict.d.ts.map +1 -0
  103. package/dist/plugin/shell-hook-restrict.js +69 -0
  104. package/dist/plugin/shell-hook-restrict.js.map +1 -0
  105. package/dist/plugin/shell-hook.d.ts +73 -4
  106. package/dist/plugin/shell-hook.d.ts.map +1 -1
  107. package/dist/plugin/shell-hook.js +118 -17
  108. package/dist/plugin/shell-hook.js.map +1 -1
  109. package/dist/public-runtime.d.ts +9 -7
  110. package/dist/public-runtime.d.ts.map +1 -1
  111. package/dist/public-runtime.js +6 -5
  112. package/dist/public-runtime.js.map +1 -1
  113. package/dist/public-types.d.ts +4 -2
  114. package/dist/public-types.d.ts.map +1 -1
  115. package/dist/runtime/jobs/websocket-source.d.ts +2 -22
  116. package/dist/runtime/jobs/websocket-source.d.ts.map +1 -1
  117. package/dist/runtime/jobs/websocket-source.js +2 -33
  118. package/dist/runtime/jobs/websocket-source.js.map +1 -1
  119. package/dist/runtime/query/compact-session.d.ts.map +1 -1
  120. package/dist/runtime/query/compact-session.js +5 -0
  121. package/dist/runtime/query/compact-session.js.map +1 -1
  122. package/dist/runtime/query/events.d.ts +7 -0
  123. package/dist/runtime/query/events.d.ts.map +1 -1
  124. package/dist/runtime/query/events.js +29 -11
  125. package/dist/runtime/query/events.js.map +1 -1
  126. package/dist/runtime/query/executor/tool-call-admission.d.ts.map +1 -1
  127. package/dist/runtime/query/executor/tool-call-admission.js +51 -10
  128. package/dist/runtime/query/executor/tool-call-admission.js.map +1 -1
  129. package/dist/runtime/query/index.d.ts +6 -0
  130. package/dist/runtime/query/index.d.ts.map +1 -1
  131. package/dist/runtime/query/index.js +3 -0
  132. package/dist/runtime/query/index.js.map +1 -1
  133. package/dist/runtime/query/iteration/phases/compaction.d.ts.map +1 -1
  134. package/dist/runtime/query/iteration/phases/compaction.js +21 -3
  135. package/dist/runtime/query/iteration/phases/compaction.js.map +1 -1
  136. package/dist/runtime/query/iteration/phases/context.d.ts +4 -0
  137. package/dist/runtime/query/iteration/phases/context.d.ts.map +1 -1
  138. package/dist/runtime/query/iteration/phases/context.js.map +1 -1
  139. package/dist/runtime/query/path-escalation.d.ts.map +1 -1
  140. package/dist/runtime/query/path-escalation.js +90 -17
  141. package/dist/runtime/query/path-escalation.js.map +1 -1
  142. package/dist/runtime/query/steering.d.ts +15 -0
  143. package/dist/runtime/query/steering.d.ts.map +1 -1
  144. package/dist/runtime/query/steering.js +27 -3
  145. package/dist/runtime/query/steering.js.map +1 -1
  146. package/dist/scheduler/completion-inbox.d.ts.map +1 -1
  147. package/dist/scheduler/completion-inbox.js +15 -0
  148. package/dist/scheduler/completion-inbox.js.map +1 -1
  149. package/dist/session/workspace/driver.d.ts +12 -0
  150. package/dist/session/workspace/driver.d.ts.map +1 -1
  151. package/dist/session/workspace/git-worktree.d.ts +16 -0
  152. package/dist/session/workspace/git-worktree.d.ts.map +1 -1
  153. package/dist/session/workspace/git-worktree.js +35 -0
  154. package/dist/session/workspace/git-worktree.js.map +1 -1
  155. package/dist/session/workspace/holds.d.ts +78 -0
  156. package/dist/session/workspace/holds.d.ts.map +1 -0
  157. package/dist/session/workspace/holds.js +150 -0
  158. package/dist/session/workspace/holds.js.map +1 -0
  159. package/dist/session/workspace/index.d.ts +3 -1
  160. package/dist/session/workspace/index.d.ts.map +1 -1
  161. package/dist/session/workspace/index.js +2 -1
  162. package/dist/session/workspace/index.js.map +1 -1
  163. package/dist/store/config/index.d.ts +3 -0
  164. package/dist/store/config/index.d.ts.map +1 -1
  165. package/dist/store/config/index.js +3 -0
  166. package/dist/store/config/index.js.map +1 -1
  167. package/dist/store/session-index/index.d.ts +13 -0
  168. package/dist/store/session-index/index.d.ts.map +1 -1
  169. package/dist/store/session-index/index.js +1 -0
  170. package/dist/store/session-index/index.js.map +1 -1
  171. package/dist/store/session-index/rebuild.d.ts +12 -0
  172. package/dist/store/session-index/rebuild.d.ts.map +1 -1
  173. package/dist/store/session-index/rebuild.js +20 -4
  174. package/dist/store/session-index/rebuild.js.map +1 -1
  175. package/dist/store/session-index/sqlite.d.ts +20 -0
  176. package/dist/store/session-index/sqlite.d.ts.map +1 -1
  177. package/dist/store/session-index/sqlite.js +50 -12
  178. package/dist/store/session-index/sqlite.js.map +1 -1
  179. package/dist/tools/admit-facts.d.ts.map +1 -1
  180. package/dist/tools/admit-facts.js +59 -0
  181. package/dist/tools/admit-facts.js.map +1 -1
  182. package/dist/tools/builtins/grep.d.ts.map +1 -1
  183. package/dist/tools/builtins/grep.js +57 -0
  184. package/dist/tools/builtins/grep.js.map +1 -1
  185. package/dist/tools/builtins/lsp.d.ts.map +1 -1
  186. package/dist/tools/builtins/lsp.js +41 -4
  187. package/dist/tools/builtins/lsp.js.map +1 -1
  188. package/dist/tools/coordinator/ask-user-question.d.ts.map +1 -1
  189. package/dist/tools/coordinator/ask-user-question.js +67 -3
  190. package/dist/tools/coordinator/ask-user-question.js.map +1 -1
  191. package/dist/turn/memory-promoter.d.ts.map +1 -1
  192. package/dist/turn/memory-promoter.js +20 -4
  193. package/dist/turn/memory-promoter.js.map +1 -1
  194. package/dist/types/agent/base.d.ts +6 -0
  195. package/dist/types/agent/base.d.ts.map +1 -1
  196. package/dist/types/agent/task.d.ts +5 -0
  197. package/dist/types/agent/task.d.ts.map +1 -1
  198. package/dist/types/agent/task.js.map +1 -1
  199. package/dist/types/code-navigation/index.d.ts +34 -4
  200. package/dist/types/code-navigation/index.d.ts.map +1 -1
  201. package/dist/types/hitl/index.d.ts +8 -0
  202. package/dist/types/hitl/index.d.ts.map +1 -1
  203. package/dist/types/hitl/index.js.map +1 -1
  204. package/dist/types/message/index.d.ts +7 -0
  205. package/dist/types/message/index.d.ts.map +1 -1
  206. package/dist/types/message/index.js.map +1 -1
  207. package/dist/types/tool/presentation.d.ts +21 -0
  208. package/dist/types/tool/presentation.d.ts.map +1 -1
  209. package/package.json +6 -6
  210. package/src/agents/QueryAgent.ts +1 -0
  211. package/src/authorization/readonly-commands.ts +72 -4
  212. package/src/authorization/shell-paths.ts +75 -18
  213. package/src/compaction/index.ts +1 -0
  214. package/src/compaction/manual.ts +48 -12
  215. package/src/compaction/model-summary.ts +163 -28
  216. package/src/compaction/restore.ts +74 -1
  217. package/src/compaction/summary.ts +69 -3
  218. package/src/config/registry.ts +87 -5
  219. package/src/config/runtime.ts +3 -3
  220. package/src/connector/index.ts +3 -0
  221. package/src/connector/mcp/adapter.ts +137 -1
  222. package/src/connector/mcp/client.ts +49 -7
  223. package/src/connector/mcp/index.ts +5 -0
  224. package/src/connector/mcp/sandbox-stdio.ts +214 -0
  225. package/src/connector/mcp/stdio-program.ts +68 -0
  226. package/src/connector/mcp/stdio.ts +61 -7
  227. package/src/connector/web/guarded-fetch.ts +197 -30
  228. package/src/connector/web/index.ts +4 -1
  229. package/src/constants/mcp/index.ts +31 -0
  230. package/src/manager/agent/lifecycle.ts +58 -13
  231. package/src/plugin/hook-module/capabilities.ts +36 -14
  232. package/src/plugin/hook-module/host.ts +86 -13
  233. package/src/plugin/hook-module/index.ts +3 -0
  234. package/src/plugin/index.ts +4 -0
  235. package/src/plugin/shell-hook-execute.ts +126 -0
  236. package/src/plugin/shell-hook-restrict.ts +66 -0
  237. package/src/plugin/shell-hook.ts +209 -16
  238. package/src/public-runtime.ts +19 -0
  239. package/src/public-types.ts +20 -0
  240. package/src/runtime/jobs/websocket-source.ts +2 -46
  241. package/src/runtime/query/compact-session.ts +5 -0
  242. package/src/runtime/query/events.ts +29 -11
  243. package/src/runtime/query/executor/tool-call-admission.ts +62 -17
  244. package/src/runtime/query/index.ts +10 -0
  245. package/src/runtime/query/iteration/phases/compaction.ts +26 -2
  246. package/src/runtime/query/iteration/phases/context.ts +6 -0
  247. package/src/runtime/query/path-escalation.ts +102 -16
  248. package/src/runtime/query/steering.ts +38 -3
  249. package/src/scheduler/completion-inbox.ts +14 -0
  250. package/src/session/workspace/driver.ts +12 -0
  251. package/src/session/workspace/git-worktree.ts +49 -0
  252. package/src/session/workspace/holds.ts +201 -0
  253. package/src/session/workspace/index.ts +13 -1
  254. package/src/store/config/index.ts +6 -0
  255. package/src/store/session-index/index.ts +14 -0
  256. package/src/store/session-index/rebuild.ts +22 -4
  257. package/src/store/session-index/sqlite.ts +63 -14
  258. package/src/tools/admit-facts.ts +64 -0
  259. package/src/tools/builtins/grep.ts +52 -0
  260. package/src/tools/builtins/lsp.ts +47 -4
  261. package/src/tools/coordinator/ask-user-question.ts +88 -4
  262. package/src/turn/memory-promoter.ts +24 -3
  263. package/src/types/agent/base.ts +7 -0
  264. package/src/types/agent/task.ts +5 -0
  265. package/src/types/code-navigation/index.ts +48 -4
  266. package/src/types/hitl/index.ts +8 -0
  267. package/src/types/message/index.ts +7 -0
  268. package/src/types/tool/presentation.ts +22 -0
@@ -110,6 +110,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
@@ -223,8 +224,21 @@ export interface PromptHookEntry extends ShellHookEntryBase {
223
224
  */
224
225
  readonly prompt: string;
225
226
  }
227
+ /** One call to a tool on a connected tool server, at one event. */
228
+ export interface McpToolHookEntry extends ShellHookEntryBase {
229
+ readonly type: 'mcp_tool';
230
+ /** The server to call, by its name in the tool-server config. */
231
+ readonly server: string;
232
+ /** The tool to call, by the name the server itself reports (no `mcp__` prefix). */
233
+ readonly tool: string;
234
+ /**
235
+ * The arguments the tool is called with, as one JSON object. Absent, the
236
+ * tool is called with none.
237
+ */
238
+ readonly arguments?: Readonly<Record<string, unknown>>;
239
+ }
226
240
  /** Any hook entry a config may carry. */
227
- export type ShellHookHandler = ShellHookEntry | HttpHookEntry | PromptHookEntry;
241
+ export type ShellHookHandler = ShellHookEntry | HttpHookEntry | PromptHookEntry | McpToolHookEntry;
228
242
  /** Event → entries, the shape a host's config file carries. */
229
243
  export type ShellHooksConfig = {
230
244
  readonly [event in ShellHookEvent]?: readonly ShellHookHandler[];
@@ -434,8 +448,14 @@ export interface ShellHookInput {
434
448
  }
435
449
  /** The JSON a hook receives on stdin (or as an HTTP body). */
436
450
  export declare function shellHookPayload(input: ShellHookInput): string;
437
- /** Run one hook command to completion, bounded by its deadline and capture. */
438
- export declare function runShellHook(entry: ShellHookEntry, input: ShellHookInput, signal?: AbortSignal): Promise<ShellHookOutcome>;
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>;
439
459
  /** The PascalCase spelling of each event name, which a hook's JSON may use. */
440
460
  export declare const SHELL_HOOK_PASCAL_EVENT_NAMES: Readonly<Partial<Record<ShellHookEvent, string>>>;
441
461
  /** The tool tied to an answer: what a rewrite or a replacement is read against. */
@@ -449,7 +469,7 @@ export interface ShellHookCall {
449
469
  * testable without a process.
450
470
  */
451
471
  export declare function shellHookVerdict(event: ShellHookEvent, entry: ShellHookHandler, outcome: ShellHookOutcome, log?: Logger, call?: ShellHookCall): PluginHookResult;
452
- /** A short name for a hook in logs: its command, its url, or the start of its prompt. */
472
+ /** A short name for a hook in logs: its command, its url, the tool it calls, or the start of its prompt. */
453
473
  export declare function describeShellHook(entry: ShellHookHandler): string;
454
474
  /**
455
475
  * Puts a question to a model and returns its reply text, or `undefined` when
@@ -464,9 +484,38 @@ export type ShellHookJudge = (request: {
464
484
  readonly turnId?: string;
465
485
  readonly signal: AbortSignal;
466
486
  }) => Promise<string | undefined>;
487
+ /**
488
+ * What one `mcp_tool` call came back with. `ok` false is a call the server
489
+ * refused or that failed; `output` is the text of a successful one, read
490
+ * exactly as a command hook's stdout is (its JSON answer included).
491
+ */
492
+ export interface ShellHookMcpToolAnswer {
493
+ readonly ok: boolean;
494
+ readonly output: string;
495
+ readonly error?: string;
496
+ }
497
+ /**
498
+ * Calls one tool on one connected tool server and returns its answer, or
499
+ * `undefined` when no connected server has that tool. The host supplies it:
500
+ * the kernel does not own the servers a session is connected to. It should
501
+ * honour `signal`.
502
+ */
503
+ export type ShellHookMcpToolCaller = (request: {
504
+ readonly server: string;
505
+ readonly tool: string;
506
+ readonly arguments: Readonly<Record<string, unknown>>;
507
+ readonly sessionId: string;
508
+ readonly turnId?: string;
509
+ readonly signal: AbortSignal;
510
+ }) => Promise<ShellHookMcpToolAnswer | undefined>;
467
511
  export interface ShellHookOptions {
468
512
  /** Answers `prompt` hooks. Without it a `prompt` hook is logged and lets the action go ahead. */
469
513
  readonly judge?: ShellHookJudge;
514
+ /**
515
+ * Calls the tool an `mcp_tool` hook names. Without it such a hook is
516
+ * reported as a failure, which `onFailure: block` counts as a refusal.
517
+ */
518
+ readonly mcpToolCall?: ShellHookMcpToolCaller;
470
519
  /** Where the command runs and what `cwd` says on stdin. */
471
520
  readonly cwd: string;
472
521
  readonly log?: Logger;
@@ -529,6 +578,26 @@ export interface ShellHookOptions {
529
578
  * Without it no hook gets the variable and nothing is carried.
530
579
  */
531
580
  readonly hookEnv?: SessionHookEnv;
581
+ /**
582
+ * Runs every command hook of this adapter somewhere other than this process
583
+ * (a sandbox the host keeps its tools in). With it set, no hook command is
584
+ * ever started as a child of the host, whatever the event: a request the
585
+ * executor cannot serve fails the hook, it does not run on the host. The
586
+ * command gets the hook's own variables and `extraEnv`, not the host's
587
+ * environment, and the plugin's data folder is not made here. A hook that
588
+ * writes variables for later commands (`NAMZU_ENV_FILE`) is not given the
589
+ * file, which is a host path. `http`, `prompt` and `mcp_tool` hooks start no
590
+ * process and are not routed through it.
591
+ */
592
+ readonly execute?: ShellHookExecutor;
593
+ /**
594
+ * Accept only the answers that narrow: `deny`, `block`, `skip`, errors,
595
+ * `additionalContext`, notices and `halt`. An `allow`, `permissionDecision:
596
+ * allow`, `updatedInput`, `retry` and the other answers that widen what the
597
+ * session may do are dropped, whichever hook gave them. Absent, every answer
598
+ * is read as before.
599
+ */
600
+ readonly restrictVerdicts?: boolean;
532
601
  /**
533
602
  * Called when a hook of this adapter ran out its deadline and was ended.
534
603
  * `hook` is the command, URL or prompt text the entry names.
@@ -1 +1 @@
1
- {"version":3,"file":"shell-hook.d.ts","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,UAAU,EAAE,gBAAgB,EAC5B,OAAO,EAAE,gBAAgB,GACvB,oBAAoB,CAyMtB;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,CAkBR"}
@@ -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
- /** Run one hook command to completion, bounded by its deadline and capture. */
655
- export function runShellHook(entry, input, signal) {
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.
@@ -1612,12 +1636,14 @@ export function shellHookVerdict(event, entry, outcome, log = NOOP_LOGGER, call
1612
1636
  };
1613
1637
  }
1614
1638
  }
1615
- /** A short name for a hook in logs: its command, its url, or the start of its prompt. */
1639
+ /** A short name for a hook in logs: its command, its url, the tool it calls, or the start of its prompt. */
1616
1640
  export function describeShellHook(entry) {
1617
1641
  if (entry.type === 'http')
1618
1642
  return entry.url;
1619
1643
  if (entry.type === 'prompt')
1620
1644
  return `prompt: ${entry.prompt.slice(0, 80)}`;
1645
+ if (entry.type === 'mcp_tool')
1646
+ return `mcp: ${entry.server}/${entry.tool}`;
1621
1647
  return entry.command;
1622
1648
  }
1623
1649
  function isAsyncShellHook(entry) {
@@ -1700,18 +1726,80 @@ function readJudgement(reply) {
1700
1726
  return undefined;
1701
1727
  }
1702
1728
  }
1729
+ /**
1730
+ * An `mcp_tool` hook: the host calls the named tool on the named server, and
1731
+ * its answer is read exactly as a command hook's stdout is. A call that
1732
+ * cannot be made — no caller, no such server or tool, a refused or failed
1733
+ * call, the deadline — is the hook's own failure, which `onFailure: block`
1734
+ * counts as a refusal.
1735
+ */
1736
+ async function runMcpToolHook(entry, input, call, signal, log) {
1737
+ const where = describeShellHook(entry);
1738
+ if (call === undefined) {
1739
+ return {
1740
+ exitCode: null,
1741
+ timedOut: false,
1742
+ stdout: '',
1743
+ stderr: '',
1744
+ spawnError: `no connected tool server is reachable, so ${where} was not called`,
1745
+ };
1746
+ }
1747
+ const deadline = AbortSignal.timeout(hookTimeout(entry));
1748
+ const combined = signal ? AbortSignal.any([signal, deadline]) : deadline;
1749
+ let answer;
1750
+ try {
1751
+ answer = await call({
1752
+ server: entry.server,
1753
+ tool: entry.tool,
1754
+ arguments: entry.arguments ?? {},
1755
+ sessionId: input.sessionId,
1756
+ ...(input.turnId !== undefined ? { turnId: input.turnId } : {}),
1757
+ signal: combined,
1758
+ });
1759
+ }
1760
+ catch (error) {
1761
+ log.warn('mcp tool hook failed', {
1762
+ 'namzu.hook.event': input.event,
1763
+ 'namzu.hook.command': where,
1764
+ 'namzu.hook.error': error instanceof Error ? error.message : String(error),
1765
+ });
1766
+ return {
1767
+ exitCode: 1,
1768
+ timedOut: deadline.aborted,
1769
+ stdout: '',
1770
+ stderr: error instanceof Error ? error.message : String(error),
1771
+ };
1772
+ }
1773
+ if (answer === undefined) {
1774
+ return {
1775
+ exitCode: 1,
1776
+ timedOut: deadline.aborted,
1777
+ stdout: '',
1778
+ stderr: `no connected server named ${entry.server} offers a tool named ${entry.tool}`,
1779
+ };
1780
+ }
1781
+ if (!answer.ok) {
1782
+ return {
1783
+ exitCode: 1,
1784
+ timedOut: deadline.aborted,
1785
+ stdout: '',
1786
+ stderr: answer.error ?? 'the tool call failed',
1787
+ };
1788
+ }
1789
+ return { exitCode: 0, timedOut: false, stdout: answer.output, stderr: '' };
1790
+ }
1703
1791
  /**
1704
1792
  * One run of a `worktree_create` or `worktree_remove` hook, to its answer. It
1705
1793
  * is always awaited (an `async` flag cannot make a hook that does the work run
1706
- * out of sight), and a `prompt` hook cannot do it at all, which is said as a
1707
- * failure rather than skipped.
1794
+ * out of sight), and a `prompt` or `mcp_tool` hook cannot do it at all, which
1795
+ * is said as a failure rather than skipped.
1708
1796
  */
1709
- async function runWorktreeHook(event, entry, input, signal, reportTimeout) {
1797
+ async function runWorktreeHook(event, entry, input, signal, reportTimeout, execute) {
1710
1798
  const label = describeShellHook(entry);
1711
- if (entry.type === 'prompt') {
1799
+ if (entry.type === 'prompt' || entry.type === 'mcp_tool') {
1712
1800
  return {
1713
1801
  action: 'error',
1714
- message: `The ${event} hook \`${label}\` is a prompt, and a prompt cannot make or remove a worktree. Use a command or an http hook.`,
1802
+ message: `The ${event} hook \`${label}\` is a ${entry.type} hook, and it cannot make or remove a worktree. Use a command or an http hook.`,
1715
1803
  };
1716
1804
  }
1717
1805
  if (entry.type === 'http') {
@@ -1733,7 +1821,7 @@ async function runWorktreeHook(event, entry, input, signal, reportTimeout) {
1733
1821
  ...(response.error !== undefined ? { spawnError: response.error } : {}),
1734
1822
  });
1735
1823
  }
1736
- const outcome = await runShellHook(entry, input, signal);
1824
+ const outcome = await runShellHook(entry, input, signal, execute);
1737
1825
  reportTimeout(outcome.timedOut);
1738
1826
  return worktreeHookVerdict(event, label, outcome);
1739
1827
  }
@@ -1831,7 +1919,7 @@ export function createShellHook(event, configured, options) {
1831
1919
  let spent = false;
1832
1920
  // The shell verdict branches on `event`, but TypeScript cannot retain that
1833
1921
  // correlation across the async handler closure and the union of events.
1834
- return {
1922
+ const definition = {
1835
1923
  event,
1836
1924
  ...(entry.statusMessage !== undefined ? { statusMessage: entry.statusMessage } : {}),
1837
1925
  // A file named by the matcher is watched for as long as the hook is attached.
@@ -1911,7 +1999,8 @@ export function createShellHook(event, configured, options) {
1911
1999
  ? event
1912
2000
  : undefined;
1913
2001
  const runsACommand = entry.type === undefined || entry.type === 'command';
1914
- const envFile = envEvent !== undefined && runsACommand
2002
+ // The variables file is a host path; a command run elsewhere is not given it.
2003
+ const envFile = envEvent !== undefined && runsACommand && options.execute === undefined
1915
2004
  ? options.hookEnv?.fileFor(envEvent, envSlot)
1916
2005
  : undefined;
1917
2006
  const hookInput = shellHookInputFor(event, context, options, {
@@ -1923,7 +2012,7 @@ export function createShellHook(event, configured, options) {
1923
2012
  ...(context.toolInput !== undefined ? { toolInput: context.toolInput } : {}),
1924
2013
  };
1925
2014
  if (event === 'worktree_create' || event === 'worktree_remove') {
1926
- return runWorktreeHook(event, entry, hookInput, context.signal, reportTimeout);
2015
+ return runWorktreeHook(event, entry, hookInput, context.signal, reportTimeout, options.execute);
1927
2016
  }
1928
2017
  if (entry.type === 'http') {
1929
2018
  const response = await postHookJson({
@@ -1947,12 +2036,17 @@ export function createShellHook(event, configured, options) {
1947
2036
  if (entry.type === 'prompt') {
1948
2037
  return judgePromptHook(event, entry, hookInput, options.judge, context.signal, log);
1949
2038
  }
2039
+ if (entry.type === 'mcp_tool') {
2040
+ const outcome = await runMcpToolHook(entry, hookInput, options.mcpToolCall, context.signal, log);
2041
+ reportTimeout(outcome.timedOut);
2042
+ return shellHookVerdict(event, entry, outcome, log, verdictCall);
2043
+ }
1950
2044
  if (entry.async === true) {
1951
2045
  // Started and left running: it decides nothing, so nothing waits
1952
2046
  // for it and its own failure is only written down.
1953
- void runShellHook(entry, hookInput)
2047
+ void runShellHook(entry, hookInput, undefined, options.execute)
1954
2048
  .then((outcome) => {
1955
- if (envEvent !== undefined)
2049
+ if (envEvent !== undefined && options.execute === undefined)
1956
2050
  options.hookEnv?.absorb(envEvent, envSlot);
1957
2051
  const verdict = shellHookVerdict(event, entry, outcome, log, verdictCall);
1958
2052
  if (verdict.action !== 'continue') {
@@ -1966,15 +2060,22 @@ export function createShellHook(event, configured, options) {
1966
2060
  .catch(() => undefined);
1967
2061
  return { action: 'continue' };
1968
2062
  }
1969
- const outcome = await runShellHook(entry, hookInput, context.signal);
2063
+ const outcome = await runShellHook(entry, hookInput, context.signal, options.execute);
1970
2064
  // What the hook appended counts even when it was ended or failed after
1971
2065
  // writing it: the lines are data it already gave.
1972
- if (envEvent !== undefined)
2066
+ if (envEvent !== undefined && options.execute === undefined)
1973
2067
  options.hookEnv?.absorb(envEvent, envSlot);
1974
2068
  reportTimeout(outcome.timedOut);
1975
2069
  return shellHookVerdict(event, entry, outcome, log, verdictCall);
1976
2070
  },
1977
2071
  };
2072
+ if (options.restrictVerdicts !== true)
2073
+ return definition;
2074
+ const where = { event, command: describeShellHook(entry) };
2075
+ return {
2076
+ ...definition,
2077
+ handler: async (context) => restrictHookVerdict(await definition.handler(context), log, where),
2078
+ };
1978
2079
  }
1979
2080
  /**
1980
2081
  * Register every entry on the manager, in file order within an event. The