@namzu/sdk 70.0.0 → 71.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 (394) hide show
  1. package/CHANGELOG.md +117 -0
  2. package/dist/authorization/bare-repository.d.ts +21 -0
  3. package/dist/authorization/bare-repository.d.ts.map +1 -0
  4. package/dist/authorization/bare-repository.js +62 -0
  5. package/dist/authorization/bare-repository.js.map +1 -0
  6. package/dist/authorization/command-line.d.ts.map +1 -1
  7. package/dist/authorization/command-line.js +10 -3
  8. package/dist/authorization/command-line.js.map +1 -1
  9. package/dist/authorization/gate.d.ts +7 -0
  10. package/dist/authorization/gate.d.ts.map +1 -1
  11. package/dist/authorization/gate.js +4 -0
  12. package/dist/authorization/gate.js.map +1 -1
  13. package/dist/authorization/protected-paths.d.ts.map +1 -1
  14. package/dist/authorization/protected-paths.js +46 -1
  15. package/dist/authorization/protected-paths.js.map +1 -1
  16. package/dist/authorization/readonly-commands.d.ts +17 -5
  17. package/dist/authorization/readonly-commands.d.ts.map +1 -1
  18. package/dist/authorization/readonly-commands.js +77 -6
  19. package/dist/authorization/readonly-commands.js.map +1 -1
  20. package/dist/authorization/readonly-flags.d.ts.map +1 -1
  21. package/dist/authorization/readonly-flags.js +98 -0
  22. package/dist/authorization/readonly-flags.js.map +1 -1
  23. package/dist/authorization/shell-lexer.d.ts +15 -0
  24. package/dist/authorization/shell-lexer.d.ts.map +1 -1
  25. package/dist/authorization/shell-lexer.js +108 -3
  26. package/dist/authorization/shell-lexer.js.map +1 -1
  27. package/dist/authorization/shell-paths.d.ts.map +1 -1
  28. package/dist/authorization/shell-paths.js +276 -0
  29. package/dist/authorization/shell-paths.js.map +1 -1
  30. package/dist/authorization/shell-session-state.d.ts +47 -0
  31. package/dist/authorization/shell-session-state.d.ts.map +1 -0
  32. package/dist/authorization/shell-session-state.js +70 -0
  33. package/dist/authorization/shell-session-state.js.map +1 -0
  34. package/dist/authorization/shell-session.d.ts +9 -0
  35. package/dist/authorization/shell-session.d.ts.map +1 -0
  36. package/dist/authorization/shell-session.js +19 -0
  37. package/dist/authorization/shell-session.js.map +1 -0
  38. package/dist/authorization/skill-grant.d.ts.map +1 -1
  39. package/dist/authorization/skill-grant.js +1 -0
  40. package/dist/authorization/skill-grant.js.map +1 -1
  41. package/dist/compaction/extractor.d.ts.map +1 -1
  42. package/dist/compaction/extractor.js +2 -0
  43. package/dist/compaction/extractor.js.map +1 -1
  44. package/dist/compaction/hooks.d.ts +16 -0
  45. package/dist/compaction/hooks.d.ts.map +1 -1
  46. package/dist/compaction/hooks.js +26 -1
  47. package/dist/compaction/hooks.js.map +1 -1
  48. package/dist/compaction/manual.d.ts.map +1 -1
  49. package/dist/compaction/manual.js +6 -1
  50. package/dist/compaction/manual.js.map +1 -1
  51. package/dist/compaction/restore.d.ts.map +1 -1
  52. package/dist/compaction/restore.js +3 -2
  53. package/dist/compaction/restore.js.map +1 -1
  54. package/dist/config/runtime.d.ts +2 -0
  55. package/dist/config/runtime.d.ts.map +1 -1
  56. package/dist/config/runtime.js +7 -0
  57. package/dist/config/runtime.js.map +1 -1
  58. package/dist/connector/mcp/client.d.ts +7 -0
  59. package/dist/connector/mcp/client.d.ts.map +1 -1
  60. package/dist/connector/mcp/client.js +54 -4
  61. package/dist/connector/mcp/client.js.map +1 -1
  62. package/dist/connector/web/types.d.ts +8 -0
  63. package/dist/connector/web/types.d.ts.map +1 -1
  64. package/dist/constants/compaction/index.d.ts.map +1 -1
  65. package/dist/constants/compaction/index.js +1 -1
  66. package/dist/constants/compaction/index.js.map +1 -1
  67. package/dist/execution/code-runtime/worker-program.d.ts +1 -1
  68. package/dist/execution/code-runtime/worker-program.d.ts.map +1 -1
  69. package/dist/execution/code-runtime/worker-program.js +9 -5
  70. package/dist/execution/code-runtime/worker-program.js.map +1 -1
  71. package/dist/execution/local.d.ts.map +1 -1
  72. package/dist/execution/local.js +6 -1
  73. package/dist/execution/local.js.map +1 -1
  74. package/dist/peers/index.d.ts +2 -2
  75. package/dist/peers/index.d.ts.map +1 -1
  76. package/dist/peers/index.js +1 -1
  77. package/dist/peers/index.js.map +1 -1
  78. package/dist/peers/record.d.ts +74 -0
  79. package/dist/peers/record.d.ts.map +1 -1
  80. package/dist/peers/record.js +41 -1
  81. package/dist/peers/record.js.map +1 -1
  82. package/dist/peers/registry.d.ts.map +1 -1
  83. package/dist/peers/registry.js +20 -3
  84. package/dist/peers/registry.js.map +1 -1
  85. package/dist/plugin/bin-path.d.ts +41 -0
  86. package/dist/plugin/bin-path.d.ts.map +1 -0
  87. package/dist/plugin/bin-path.js +146 -0
  88. package/dist/plugin/bin-path.js.map +1 -0
  89. package/dist/plugin/common-layout/read.js +1 -1
  90. package/dist/plugin/common-layout/read.js.map +1 -1
  91. package/dist/plugin/common-layout-names.d.ts.map +1 -1
  92. package/dist/plugin/common-layout-names.js +0 -1
  93. package/dist/plugin/common-layout-names.js.map +1 -1
  94. package/dist/plugin/hook-module/scan.d.ts +16 -0
  95. package/dist/plugin/hook-module/scan.d.ts.map +1 -1
  96. package/dist/plugin/hook-module/scan.js +67 -2
  97. package/dist/plugin/hook-module/scan.js.map +1 -1
  98. package/dist/plugin/hook-module/worker-source.d.ts.map +1 -1
  99. package/dist/plugin/hook-module/worker-source.js +56 -0
  100. package/dist/plugin/hook-module/worker-source.js.map +1 -1
  101. package/dist/plugin/lifecycle.d.ts +21 -0
  102. package/dist/plugin/lifecycle.d.ts.map +1 -1
  103. package/dist/plugin/lifecycle.js +64 -0
  104. package/dist/plugin/lifecycle.js.map +1 -1
  105. package/dist/plugin/shell-hook-tool-names.d.ts.map +1 -1
  106. package/dist/plugin/shell-hook-tool-names.js +1 -0
  107. package/dist/plugin/shell-hook-tool-names.js.map +1 -1
  108. package/dist/plugin/shell-hook.d.ts +1 -1
  109. package/dist/plugin/shell-hook.d.ts.map +1 -1
  110. package/dist/plugin/shell-hook.js +22 -4
  111. package/dist/plugin/shell-hook.js.map +1 -1
  112. package/dist/public-runtime.d.ts +8 -6
  113. package/dist/public-runtime.d.ts.map +1 -1
  114. package/dist/public-runtime.js +8 -5
  115. package/dist/public-runtime.js.map +1 -1
  116. package/dist/public-tools.d.ts +6 -2
  117. package/dist/public-tools.d.ts.map +1 -1
  118. package/dist/public-tools.js +6 -2
  119. package/dist/public-tools.js.map +1 -1
  120. package/dist/public-types.d.ts +2 -2
  121. package/dist/public-types.d.ts.map +1 -1
  122. package/dist/runtime/jobs/monitor-stream.d.ts +9 -1
  123. package/dist/runtime/jobs/monitor-stream.d.ts.map +1 -1
  124. package/dist/runtime/jobs/monitor-stream.js +13 -4
  125. package/dist/runtime/jobs/monitor-stream.js.map +1 -1
  126. package/dist/runtime/jobs/registry.d.ts +4 -0
  127. package/dist/runtime/jobs/registry.d.ts.map +1 -1
  128. package/dist/runtime/jobs/registry.js +12 -2
  129. package/dist/runtime/jobs/registry.js.map +1 -1
  130. package/dist/runtime/query/auto-review/git-status.d.ts.map +1 -1
  131. package/dist/runtime/query/auto-review/git-status.js +3 -2
  132. package/dist/runtime/query/auto-review/git-status.js.map +1 -1
  133. package/dist/runtime/query/executor.d.ts +16 -6
  134. package/dist/runtime/query/executor.d.ts.map +1 -1
  135. package/dist/runtime/query/executor.js +60 -5
  136. package/dist/runtime/query/executor.js.map +1 -1
  137. package/dist/runtime/query/index.d.ts.map +1 -1
  138. package/dist/runtime/query/index.js +2 -2
  139. package/dist/runtime/query/index.js.map +1 -1
  140. package/dist/runtime/query/iteration/outstanding-work.d.ts.map +1 -1
  141. package/dist/runtime/query/iteration/outstanding-work.js +14 -4
  142. package/dist/runtime/query/iteration/outstanding-work.js.map +1 -1
  143. package/dist/runtime/query/iteration/phases/compaction.d.ts.map +1 -1
  144. package/dist/runtime/query/iteration/phases/compaction.js +11 -1
  145. package/dist/runtime/query/iteration/phases/compaction.js.map +1 -1
  146. package/dist/runtime/query/iteration/phases/tool-review.d.ts +2 -0
  147. package/dist/runtime/query/iteration/phases/tool-review.d.ts.map +1 -1
  148. package/dist/runtime/query/iteration/phases/tool-review.js +19 -8
  149. package/dist/runtime/query/iteration/phases/tool-review.js.map +1 -1
  150. package/dist/runtime/query/path-escalation.d.ts +6 -0
  151. package/dist/runtime/query/path-escalation.d.ts.map +1 -1
  152. package/dist/runtime/query/path-escalation.js +58 -4
  153. package/dist/runtime/query/path-escalation.js.map +1 -1
  154. package/dist/runtime/query/review-policy.d.ts.map +1 -1
  155. package/dist/runtime/query/review-policy.js +4 -2
  156. package/dist/runtime/query/review-policy.js.map +1 -1
  157. package/dist/runtime/query/steering.d.ts +11 -2
  158. package/dist/runtime/query/steering.d.ts.map +1 -1
  159. package/dist/runtime/query/steering.js +18 -4
  160. package/dist/runtime/query/steering.js.map +1 -1
  161. package/dist/sandbox/provider/local.d.ts.map +1 -1
  162. package/dist/sandbox/provider/local.js +3 -1
  163. package/dist/sandbox/provider/local.js.map +1 -1
  164. package/dist/schedules/describe.d.ts.map +1 -1
  165. package/dist/schedules/describe.js +2 -0
  166. package/dist/schedules/describe.js.map +1 -1
  167. package/dist/schedules/evaluate.d.ts +4 -0
  168. package/dist/schedules/evaluate.d.ts.map +1 -1
  169. package/dist/schedules/evaluate.js +26 -1
  170. package/dist/schedules/evaluate.js.map +1 -1
  171. package/dist/schedules/index.d.ts +3 -1
  172. package/dist/schedules/index.d.ts.map +1 -1
  173. package/dist/schedules/index.js +2 -1
  174. package/dist/schedules/index.js.map +1 -1
  175. package/dist/schedules/next-fire.d.ts.map +1 -1
  176. package/dist/schedules/next-fire.js +10 -0
  177. package/dist/schedules/next-fire.js.map +1 -1
  178. package/dist/schedules/spec.d.ts +9 -0
  179. package/dist/schedules/spec.d.ts.map +1 -1
  180. package/dist/schedules/spec.js +33 -0
  181. package/dist/schedules/spec.js.map +1 -1
  182. package/dist/schedules/types.d.ts +32 -4
  183. package/dist/schedules/types.d.ts.map +1 -1
  184. package/dist/schedules/types.js +3 -2
  185. package/dist/schedules/types.js.map +1 -1
  186. package/dist/schedules/watch.d.ts +23 -0
  187. package/dist/schedules/watch.d.ts.map +1 -0
  188. package/dist/schedules/watch.js +46 -0
  189. package/dist/schedules/watch.js.map +1 -0
  190. package/dist/session/workspace/git-worktree.d.ts.map +1 -1
  191. package/dist/session/workspace/git-worktree.js +2 -1
  192. package/dist/session/workspace/git-worktree.js.map +1 -1
  193. package/dist/skills/arguments.d.ts +58 -0
  194. package/dist/skills/arguments.d.ts.map +1 -0
  195. package/dist/skills/arguments.js +208 -0
  196. package/dist/skills/arguments.js.map +1 -0
  197. package/dist/skills/index.d.ts +3 -1
  198. package/dist/skills/index.d.ts.map +1 -1
  199. package/dist/skills/index.js +1 -0
  200. package/dist/skills/index.js.map +1 -1
  201. package/dist/skills/inline-shell.d.ts +17 -0
  202. package/dist/skills/inline-shell.d.ts.map +1 -1
  203. package/dist/skills/inline-shell.js +1232 -14
  204. package/dist/skills/inline-shell.js.map +1 -1
  205. package/dist/tools/builtins/bash-cwd.d.ts.map +1 -1
  206. package/dist/tools/builtins/bash-cwd.js +2 -0
  207. package/dist/tools/builtins/bash-cwd.js.map +1 -1
  208. package/dist/tools/builtins/bash.d.ts.map +1 -1
  209. package/dist/tools/builtins/bash.js +79 -11
  210. package/dist/tools/builtins/bash.js.map +1 -1
  211. package/dist/tools/builtins/exit-semantics.d.ts +6 -0
  212. package/dist/tools/builtins/exit-semantics.d.ts.map +1 -1
  213. package/dist/tools/builtins/exit-semantics.js +10 -0
  214. package/dist/tools/builtins/exit-semantics.js.map +1 -1
  215. package/dist/tools/builtins/glob.d.ts.map +1 -1
  216. package/dist/tools/builtins/glob.js +68 -13
  217. package/dist/tools/builtins/glob.js.map +1 -1
  218. package/dist/tools/builtins/grep.d.ts.map +1 -1
  219. package/dist/tools/builtins/grep.js +37 -12
  220. package/dist/tools/builtins/grep.js.map +1 -1
  221. package/dist/tools/builtins/index.d.ts +11 -0
  222. package/dist/tools/builtins/index.d.ts.map +1 -1
  223. package/dist/tools/builtins/index.js +14 -0
  224. package/dist/tools/builtins/index.js.map +1 -1
  225. package/dist/tools/builtins/job.js +1 -1
  226. package/dist/tools/builtins/job.js.map +1 -1
  227. package/dist/tools/builtins/monitor.d.ts +1 -1
  228. package/dist/tools/builtins/monitor.d.ts.map +1 -1
  229. package/dist/tools/builtins/monitor.js +4 -2
  230. package/dist/tools/builtins/monitor.js.map +1 -1
  231. package/dist/tools/builtins/notebook-cells.d.ts +31 -0
  232. package/dist/tools/builtins/notebook-cells.d.ts.map +1 -0
  233. package/dist/tools/builtins/notebook-cells.js +160 -0
  234. package/dist/tools/builtins/notebook-cells.js.map +1 -0
  235. package/dist/tools/builtins/notebook-edit.d.ts +8 -0
  236. package/dist/tools/builtins/notebook-edit.d.ts.map +1 -0
  237. package/dist/tools/builtins/notebook-edit.js +249 -0
  238. package/dist/tools/builtins/notebook-edit.js.map +1 -0
  239. package/dist/tools/builtins/notebook-guard.d.ts.map +1 -1
  240. package/dist/tools/builtins/notebook-guard.js +2 -1
  241. package/dist/tools/builtins/notebook-guard.js.map +1 -1
  242. package/dist/tools/builtins/push-notification.d.ts +49 -0
  243. package/dist/tools/builtins/push-notification.d.ts.map +1 -0
  244. package/dist/tools/builtins/push-notification.js +107 -0
  245. package/dist/tools/builtins/push-notification.js.map +1 -0
  246. package/dist/tools/builtins/read-file.d.ts.map +1 -1
  247. package/dist/tools/builtins/read-file.js +8 -3
  248. package/dist/tools/builtins/read-file.js.map +1 -1
  249. package/dist/tools/builtins/read-media.d.ts.map +1 -1
  250. package/dist/tools/builtins/read-media.js +2 -1
  251. package/dist/tools/builtins/read-media.js.map +1 -1
  252. package/dist/tools/builtins/read-render.d.ts.map +1 -1
  253. package/dist/tools/builtins/read-render.js +5 -3
  254. package/dist/tools/builtins/read-render.js.map +1 -1
  255. package/dist/tools/builtins/search-support.d.ts +6 -4
  256. package/dist/tools/builtins/search-support.d.ts.map +1 -1
  257. package/dist/tools/builtins/search-support.js +15 -3
  258. package/dist/tools/builtins/search-support.js.map +1 -1
  259. package/dist/tools/builtins/skill.d.ts.map +1 -1
  260. package/dist/tools/builtins/skill.js +28 -8
  261. package/dist/tools/builtins/skill.js.map +1 -1
  262. package/dist/tools/builtins/sleep-guard.d.ts +20 -0
  263. package/dist/tools/builtins/sleep-guard.d.ts.map +1 -1
  264. package/dist/tools/builtins/sleep-guard.js +125 -1
  265. package/dist/tools/builtins/sleep-guard.js.map +1 -1
  266. package/dist/tools/builtins/wait-for-job.js +1 -1
  267. package/dist/tools/builtins/wait-for-job.js.map +1 -1
  268. package/dist/tools/builtins/web.d.ts +2 -0
  269. package/dist/tools/builtins/web.d.ts.map +1 -1
  270. package/dist/tools/builtins/web.js +97 -3
  271. package/dist/tools/builtins/web.js.map +1 -1
  272. package/dist/tools/command-shell.d.ts +50 -0
  273. package/dist/tools/command-shell.d.ts.map +1 -1
  274. package/dist/tools/command-shell.js +145 -0
  275. package/dist/tools/command-shell.js.map +1 -1
  276. package/dist/tools/env-scrub.d.ts +2 -0
  277. package/dist/tools/env-scrub.d.ts.map +1 -1
  278. package/dist/tools/env-scrub.js +15 -1
  279. package/dist/tools/env-scrub.js.map +1 -1
  280. package/dist/tools/git-config-env.d.ts +55 -0
  281. package/dist/tools/git-config-env.d.ts.map +1 -0
  282. package/dist/tools/git-config-env.js +130 -0
  283. package/dist/tools/git-config-env.js.map +1 -0
  284. package/dist/tools/schedules/schedule-tool.d.ts +7 -0
  285. package/dist/tools/schedules/schedule-tool.d.ts.map +1 -1
  286. package/dist/tools/schedules/schedule-tool.js +72 -3
  287. package/dist/tools/schedules/schedule-tool.js.map +1 -1
  288. package/dist/tools/schedules/types.d.ts +38 -2
  289. package/dist/tools/schedules/types.d.ts.map +1 -1
  290. package/dist/types/connector/mcp.d.ts +24 -0
  291. package/dist/types/connector/mcp.d.ts.map +1 -1
  292. package/dist/types/message/index.d.ts +21 -1
  293. package/dist/types/message/index.d.ts.map +1 -1
  294. package/dist/types/message/index.js +37 -2
  295. package/dist/types/message/index.js.map +1 -1
  296. package/dist/types/plugin/index.d.ts +10 -2
  297. package/dist/types/plugin/index.d.ts.map +1 -1
  298. package/dist/types/plugin/index.js.map +1 -1
  299. package/dist/types/tool/index.d.ts +6 -0
  300. package/dist/types/tool/index.d.ts.map +1 -1
  301. package/dist/types/tool/index.js.map +1 -1
  302. package/dist/utils/plain-terminal-text.d.ts +21 -0
  303. package/dist/utils/plain-terminal-text.d.ts.map +1 -0
  304. package/dist/utils/plain-terminal-text.js +156 -0
  305. package/dist/utils/plain-terminal-text.js.map +1 -0
  306. package/package.json +1 -1
  307. package/src/authorization/bare-repository.ts +70 -0
  308. package/src/authorization/command-line.ts +18 -4
  309. package/src/authorization/gate.ts +11 -0
  310. package/src/authorization/protected-paths.ts +45 -1
  311. package/src/authorization/readonly-commands.ts +75 -6
  312. package/src/authorization/readonly-flags.ts +103 -0
  313. package/src/authorization/shell-lexer.ts +126 -3
  314. package/src/authorization/shell-paths.ts +386 -0
  315. package/src/authorization/shell-session-state.ts +97 -0
  316. package/src/authorization/shell-session.ts +23 -0
  317. package/src/authorization/skill-grant.ts +1 -0
  318. package/src/compaction/extractor.ts +1 -0
  319. package/src/compaction/hooks.ts +43 -1
  320. package/src/compaction/manual.ts +6 -0
  321. package/src/compaction/restore.ts +3 -2
  322. package/src/config/runtime.ts +7 -0
  323. package/src/connector/mcp/client.ts +61 -4
  324. package/src/connector/web/types.ts +8 -0
  325. package/src/constants/compaction/index.ts +1 -1
  326. package/src/execution/code-runtime/worker-program.ts +9 -5
  327. package/src/execution/local.ts +6 -1
  328. package/src/peers/index.ts +8 -2
  329. package/src/peers/record.ts +45 -1
  330. package/src/peers/registry.ts +21 -5
  331. package/src/plugin/bin-path.ts +149 -0
  332. package/src/plugin/common-layout/read.ts +1 -1
  333. package/src/plugin/common-layout-names.ts +0 -1
  334. package/src/plugin/hook-module/scan.ts +74 -2
  335. package/src/plugin/hook-module/worker-source.ts +56 -0
  336. package/src/plugin/lifecycle.ts +67 -0
  337. package/src/plugin/shell-hook-tool-names.ts +1 -0
  338. package/src/plugin/shell-hook.ts +23 -4
  339. package/src/public-runtime.ts +21 -0
  340. package/src/public-tools.ts +32 -1
  341. package/src/public-types.ts +3 -1
  342. package/src/runtime/jobs/monitor-stream.ts +18 -4
  343. package/src/runtime/jobs/registry.ts +22 -2
  344. package/src/runtime/query/auto-review/git-status.ts +3 -2
  345. package/src/runtime/query/executor.ts +79 -5
  346. package/src/runtime/query/index.ts +5 -2
  347. package/src/runtime/query/iteration/outstanding-work.ts +22 -4
  348. package/src/runtime/query/iteration/phases/compaction.ts +14 -1
  349. package/src/runtime/query/iteration/phases/tool-review.ts +24 -7
  350. package/src/runtime/query/path-escalation.ts +52 -4
  351. package/src/runtime/query/review-policy.ts +5 -2
  352. package/src/runtime/query/steering.ts +32 -4
  353. package/src/sandbox/provider/local.ts +3 -1
  354. package/src/schedules/describe.ts +2 -0
  355. package/src/schedules/evaluate.ts +29 -1
  356. package/src/schedules/index.ts +9 -1
  357. package/src/schedules/next-fire.ts +9 -0
  358. package/src/schedules/spec.ts +42 -0
  359. package/src/schedules/types.ts +33 -3
  360. package/src/schedules/watch.ts +71 -0
  361. package/src/session/workspace/git-worktree.ts +3 -1
  362. package/src/skills/arguments.ts +250 -0
  363. package/src/skills/index.ts +10 -0
  364. package/src/skills/inline-shell.ts +1268 -14
  365. package/src/tools/builtins/bash-cwd.ts +2 -0
  366. package/src/tools/builtins/bash.ts +93 -13
  367. package/src/tools/builtins/exit-semantics.ts +10 -0
  368. package/src/tools/builtins/glob.ts +79 -15
  369. package/src/tools/builtins/grep.ts +37 -10
  370. package/src/tools/builtins/index.ts +15 -0
  371. package/src/tools/builtins/job.ts +1 -1
  372. package/src/tools/builtins/monitor.ts +4 -2
  373. package/src/tools/builtins/notebook-cells.ts +196 -0
  374. package/src/tools/builtins/notebook-edit.ts +280 -0
  375. package/src/tools/builtins/notebook-guard.ts +2 -1
  376. package/src/tools/builtins/push-notification.ts +138 -0
  377. package/src/tools/builtins/read-file.ts +9 -3
  378. package/src/tools/builtins/read-media.ts +2 -1
  379. package/src/tools/builtins/read-render.ts +5 -3
  380. package/src/tools/builtins/search-support.ts +17 -3
  381. package/src/tools/builtins/skill.ts +27 -7
  382. package/src/tools/builtins/sleep-guard.ts +128 -1
  383. package/src/tools/builtins/wait-for-job.ts +1 -1
  384. package/src/tools/builtins/web.ts +100 -3
  385. package/src/tools/command-shell.ts +166 -0
  386. package/src/tools/env-scrub.ts +13 -1
  387. package/src/tools/git-config-env.ts +143 -0
  388. package/src/tools/schedules/schedule-tool.ts +79 -3
  389. package/src/tools/schedules/types.ts +47 -9
  390. package/src/types/connector/mcp.ts +25 -0
  391. package/src/types/message/index.ts +53 -1
  392. package/src/types/plugin/index.ts +10 -2
  393. package/src/types/tool/index.ts +6 -0
  394. package/src/utils/plain-terminal-text.ts +142 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,122 @@
1
1
  # Changelog
2
2
 
3
+ ## 71.0.0
4
+
5
+ ### Major Changes
6
+
7
+ - f6e125a: The built-in `read` tool's `offset` now counts lines from 1, the way `grep` reports line numbers and the way `readRange` already counted. It used to count from 0, so `offset: 100` started at line 101; now it starts at line 100. A missing `offset` and `offset: 0` both still mean the first line, and `offset: 1` now means the same.
8
+
9
+ What breaks: any caller, saved prompt or script that passes a 0-based `offset` to `read` now starts one line earlier than before (and sees one line repeated when it pages). To keep the old window, add 1 to the offset. The notices the tool prints for the next page (`offset: 2001`, `offset=N limit=N`) name the next unseen line in the new numbering, and the tool description says so.
10
+
11
+ ### Minor Changes
12
+
13
+ - b4d9ffb: A session inside a workspaces host now lists its own agents, workflows, teammates and background shell tasks in the live record it already writes, so the host can show them under the session. Nothing is drawn from it yet and nothing you run changes.
14
+
15
+ `@namzu/sdk` adds the optional `agents` field to `PeerRecord` (at most 40 rows of id, parent, kind, state, a name, one line of detail and a time; no prompt, transcript or output) and exports `PEER_AGENTS_MAX` and the `PeerAgentNode` type. A record without the field reads as no agents, and an older reader drops it. The CLI writes it only inside a workspaces host, at most once a second and only when the list changed, and loads the code for it there alone. A record file that is a link, owned by another user or over 256 KiB is no longer read by `readPeerRecord` and `readPeerRecords`, and an `agents` list that does not fit its bounds is dropped on its own instead of hiding the whole record.
16
+
17
+ - 866823c: Breaking default for `@namzu/cli`: the left arrow on an empty message box, `namzu agents` and `namzu workspaces` now open a new agents screen, where they used to open the sidebar-and-panes screen (`tui.workspacesScreen` now defaults to `agents`; it was the sidebar). To keep the old screen, set `tui.workspacesScreen` to `sidebar`.
18
+
19
+ New agents screen, and the left arrow now opens it. Pressing `←` on an empty message box used to open the workspaces screen (a sidebar beside tiled panes); it now opens a list of every workspace with its sessions, and under each session the workflows, agents, teammates and background shell tasks it is running, each with what it is doing, whether it needs you and how long ago it changed. `namzu agents` opens the same screen, and `namzu workspaces` still works and opens it too. Up and down move over the rows, Enter opens a session full screen (`←` on its empty message box comes back, Esc returns to the session you came from), typing filters the rows, Enter in the box starts a new session in the focused workspace with what you typed as its first message, `?` shows the keys, and the footer reads `← for agents`. The tiled panes are still there: `ctrl+b p` shows them from the list and `ctrl+b a` comes back.
20
+
21
+ To keep the earlier screen behind the left arrow and both commands, set `tui.workspacesScreen` to `sidebar` (Settings > Terminal, Agents screen) before you upgrade. That value is on its way out and is removed in the next major release. If something you do depends on the sidebar being the first thing `←` shows, set it now.
22
+
23
+ `@namzu/sdk` adds the optional `detail` field to `PeerRecord`: one line (at most 160 characters) of what the session is on, the question it waits on or else the last line of its latest reply, written inside a workspaces host, or in a plain terminal after its first left arrow; a reader drops a `detail` that is too long or not a string and keeps the session. A plain sub-agent whose tool call waits on you now shows as needing approval, with the tool and its target, and the mark rises to its session.
24
+
25
+ - 861c1f9: Automatic compaction can now be turned off, and its trigger sized as a percent of the window. Nothing changes unless you opt in: compaction stays on by default.
26
+
27
+ - `compaction.autoCompact: false` (or `NAMZU_DISABLE_AUTO_COMPACT=1`) stops the compaction the context size starts. `/compact` still works, and a prompt the provider refuses as too large is still shortened once and retried; if that frees too little the turn fails with the provider's own message.
28
+ - `compaction.autoCompactPercent` (1 to 100, or `NAMZU_AUTOCOMPACT_PCT`) summarises at that share of the model window.
29
+ - `/autocompact [on|off|auto|<tokens>]` changes the switch or the window for the running conversation without writing the config file.
30
+ - Both keys are rows in Settings. In the SDK, `CompactionConfig.autoCompact` is a new optional field: `false` skips the threshold-triggered pass and keeps the forced overflow pass.
31
+
32
+ - 861c1f9: `session_start` hooks now run after every compaction pass (source `compact`) and when `/fork` opens a copy (source `fork`). A fork used to report `resume` when the copy had earlier turns and now reports `fork`, so a hook whose matcher must keep running on `/fork` needs `fork` added (for example `startup|resume|fork`). A hook with no matcher now also runs after each compaction and in a fork, so add `matcher: "startup"` if it must not repeat its work. What a hook says after a compaction (bounded to 8000 characters) joins the model's next turn in the terminal app (other entry points run the hooks but do not yet deliver the text). The text is kept per session, so a sub-agent's compaction never reaches its parent. This changes a default: a `session_start` hook with no matcher used to run only at start and resume, and now also runs after each compaction and in a fork; add `matcher: "startup"` (or `startup|resume`) to keep the old behaviour. `PluginSessionSource` gains `fork` and `compact`.
33
+
34
+ A `permission_denied` hook can answer `hookSpecificOutput.retry: true` (in process, `retryable: true` on a `continue`); the refusal the model reads then says it may retry the call. The refusal itself stands and a retry goes through the same permission check.
35
+
36
+ - 861c1f9: Breaking default: the CLI's MCP tool-call deadline changes from 30 seconds (120 for the turn) to 100,000,000 ms; a run with nobody at it (exec, scheduled, sub-agent) gets 3,600,000 ms. To keep the old bound, set `NAMZU_MCP_TOOL_TIMEOUT=30000` or `requestTimeoutMs: 30000` on the server. MCP tool calls are no longer cut at 120 seconds, and a few MCP limits are now settable. In the CLI a tool call from an MCP server may run for up to about 28 hours (100,000,000 ms) by default instead of being cut by the 30-second request deadline and the 120-second tool deadline. Stop still ends a stuck call at once. To keep a shorter bound, set `NAMZU_MCP_TOOL_TIMEOUT` (milliseconds) or `requestTimeoutMs` on the server; the latter now also moves the turn's tool deadline, so a value above 120 seconds is honoured. New settings: `NAMZU_MCP_TIMEOUT` (default connect deadline for servers without `connectTimeoutMs`) and `NAMZU_MAX_MCP_OUTPUT_CHARS` (the 30,000-character result cap). Sessions now declare the MCP `roots` capability, answer `roots/list` with the working directory and added folders, and send `roots/list_changed` after `/add dir`.
37
+
38
+ SDK: `MCPClientConfig` gains `toolCallTimeoutMs` (a tool-call-only deadline, reported by `getToolCallWindowMs()`) and `roots` (with `MCPClient.notifyRootsChanged()`). Both are off unless set, so an SDK host sees no change.
39
+
40
+ - a091417: An enabled plugin's `bin/` folder is now added to the end of the PATH of the shell tool and of background jobs, so its programs run by their bare names; turning the plugin off removes it from the next command. It goes after the existing PATH, so a program already installed is never replaced by a plugin program of the same name. A command the read-only list names but that a plugin's `bin/` also supplies is no longer approved without asking, whether or not it is installed (on a machine without `rg` or `tree`, the plugin's file is what would run). A `bin/` that is a link leaving the plugin folder, or that holds one, is left off and logged. Sandboxed commands do not get the folder. New SDK surface: `ToolContext.pluginBinDirs`, `PluginLifecycleManager.enabledBinDirs()`. The plugin consent now also lists links under `bin/`, and the "bin/ is not used" note is gone. If you relied on a plugin's `bin/` not being on PATH, a command with the same name as one of its programs still resolves to your own program first; only names you did not have now resolve to the plugin. A plugin you already enabled that ships a `bin/` folder is put on the PATH after you upgrade, without a new consent (its install listed those files); turn the plugin off with `namzu plugin disable` if you do not want its programs to resolve.
41
+ - 861c1f9: Command output no longer shows terminal escape codes in Desktop or to an AG-UI client. Since the kernel started passing a command's output on as it was printed, Desktop's live tool row and the adapter's `TOOL_CALL_RESULT` (and `fromNamzuMessages` for stored results) carried colour, cursor and link codes as text, and a progress bar as every one of its redraws. Both now show plain text with a bar at its last frame. `@namzu/sdk` adds the export `plainTerminalText(text)` they use; a host of your own that shows output can call it too. Only the results of `bash`, `job`, `wait_for_job` and `run_code` are read as terminal output; any other tool's result is sent as it is. `@namzu/ag-ui` now needs `@namzu/sdk` 70.1.0 or later (its peer range is `>=70.1.0`), because it imports this export: with an older SDK the adapter fails to load, so update both together. A bash progress line cut to its last 160 characters no longer starts inside an escape sequence.
42
+ - 9d3fe18: New `push_notification` tool: the model can send one short line as a terminal notification when a long task has finished or it needs a decision and you have walked away. `@namzu/sdk` exports `createPushNotificationTool({ notify })` (the host supplies delivery; the tool cleans the line to 200 characters and allows one a minute). In `@namzu/cli` the interactive terminal offers it, but it stays off until `tui.notifications` lists the new `agent-message` event (`namzu config set tui.notifications turn-settled,agent-message`); `true` does not include it, so nothing changes for existing settings. It is not sent while you are typing (a key in the last minute), and `exec`, `-p`, drain and scheduled runs do not offer it. `tui.notifications` now accepts `"agent-message"`; a config that lists it is refused by older versions.
43
+ - 5fc3a4f: A schedule job can have a time box. `namzu schedule add` and `edit` take `--expires <time>` (`in 30d`, `at 2026-12-31 17:00`, an ISO instant; `--expires never` on `edit` removes it), and the `schedule` tool takes `expires` on `create` and `update`. The time is written once as an absolute instant, must be after the job's first run, is shown on the confirmation and is part of the confirmation digest, so changing it needs a new confirmation. No run starts at or after it, and the scheduler ends the job as `expired` and does not catch up past it. `schedule list --json` and `show` carry `expiresAt`. A job saved with an expiry is written at format version 3, so an older namzu holds it for confirmation rather than ignoring the limit.
44
+
45
+ SDK: `evaluateJob` reads a new optional `expiresAt` on its job and may return the new `job-expired` skip reason (the union may grow; keep a `default:` branch when you switch over it), `parseScheduleExpiry` is exported, and the schedule tool's `ScheduleJobDraft`, `ScheduleJobChanges`, `ScheduleJobPreview` and `ScheduleJobSummary` gain an optional expiry field. A `ScheduleToolHost` that ignores them keeps working, but then a model's `expires` is dropped; pass `draft.expires` and `changes.expires` through to `parseScheduleExpiry` to honour it.
46
+
47
+ - 49ea26b: Schedule script jobs run on native Windows. `namzu schedule add --kind script` takes `--shell bash|sh|powershell`; without it the job records `bash`, or `powershell` on Windows when Git Bash is not found. On native Windows `bash` and `sh` are Git for Windows' own (`NAMZU_BASH_SHELL`, which the `bash` tool already reads, may name the full path of a `bash.exe` or `sh.exe`; any other program there is refused), and `powershell` is `pwsh`, else Windows PowerShell, passed as one encoded argument and limited to 8,000 characters. The shell is shown on the confirmation and bound by its digest, and the check and the run use it and no other: a job recorded with a shell the machine lacks stops with a reason and never runs under another shell. The shell checker cannot read PowerShell, so a PowerShell script is matched as text against the scheduled-run floor and the `deny` rules (with the call operator, directory, case and `.exe`/`.cmd` suffix removed, and quoted text and comments set aside so ordinary scripts with variables pass), and a script that hides the program it runs (a call through a variable, `Invoke-Expression`, `Start-Process`, a nested shell command string) or recursively deletes a drive root or home is refused; the confirmation says to read it yourself. Before this, a script job was refused on native Windows. Nothing changes for an existing `bash` or `sh` job on Linux, macOS or WSL, except that omitting `--shell` is no longer an error.
48
+
49
+ SDK: `script.shell` on the `schedule` tool's `create` and on `ScheduleJobPreview` gains `'powershell'` (code that switches over it needs a default branch), and `findScriptShell`, `installedScriptShell`, `defaultScriptShellName`, `hostDefaultScriptShellName`, `powershellArgs` and `windowsShellOverrideProblem` are exported. An older namzu holds a `powershell` job instead of running it.
50
+
51
+ - 49ea26b: A schedule job can hand each run's result to one live session. `namzu schedule add` and `edit` take `--deliver-to <session>` (the name, ref or id `namzu peers list` shows), and the `schedule` tool takes `deliverTo` on `create`. The session must be open in the job's own folder when the job is made; a session in another folder, none, or more than one match is refused. The result is queued in that session's inbox as a command-line sender's message, quoted as the run's output and never as an instruction, so it does not interrupt a turn. Each run is sent at most once, and a session that has closed, moved folder or stopped accepting messages is not waited for: the scheduler records `delivery-refused` in the job's history and the job runs again. The confirmation shows the target and the confirmation digest covers it, so naming another session needs a new confirmation. A job has one delivery, so `--deliver-to` replaces a source conversation binding; `--delivery none` removes either. A job saved with a session target is format version 3, so an older namzu holds it for confirmation.
52
+ A script job that reports a change stays pending when its session cannot take the result, so the checkpoint does not move past a change nobody received; run `namzu schedule edit <job> --delivery none` and confirm to release it (editing without `--deliver-to` keeps the binding and the hold). A message the session holds for its person is recorded as `delivery-held`. The scheduler also finds a terminal that registered under `XDG_RUNTIME_DIR` when the scheduler itself started without it (`/run/user/<uid>` is tried as well).
53
+
54
+ SDK: `ScheduleJobDraft` gains an optional `deliverTo`, and `ScheduleJobPreview.delivery` becomes a union with a `{ kind: 'session', ref, title }` variant (narrow on `kind` where you read it). A `ScheduleToolHost` that ignores `deliverTo` keeps working, but then a model's `deliverTo` is dropped; resolve it to one live session in the job's folder and show it in the preview to honour it.
55
+
56
+ - 49ea26b: A schedule job can wake on a change of one tool-server resource instead of at a time. `namzu schedule add` and `edit` take `--watch <server>` and `--watch-resource <uri>` (the server must be configured for the job's folder and list the resource), with `--watch-min-interval` (default 5 minutes, whole minutes) for the least time between two runs and `--watch-max-events` (default 60) for the most changed updates accepted in an hour. The scheduler subscribes to that one resource and calls none of the server's tools; it reads the content on each notification and runs only when it differs from the last content it accepted, so a restart neither replays a delivered update nor misses one that happened while it was stopped. Updates inside the gap collapse into the next run, a resource is read at most once every five seconds, and a job updated faster than its hourly limit is paused as `paused (too many updates)` with the reason. The run's system note quotes the content, cut at 4,000 characters, as one JSON string labelled as the server's data and never as your instruction; the job's own permissions, the scheduled-run floor and budget still apply. The confirmation shows the server and what it runs and the digest covers the server, the resource, both limits and a digest of the server's definition, so a settings file that points the same name at another program holds the watch until you confirm again. A server that asks for approval before use cannot be watched. The `schedule` tool cannot create or retarget a watch. A watch job is format version 3, so an older namzu holds it instead of running it as a timed job.
57
+
58
+ SDK: `ScheduleSpec` gains a `{ kind: 'watch', server, uri, minIntervalMs, maxEventsPerHour }` member (`ScheduleWatchSpec`), and `parseWatchSpec` is exported with `SCHEDULE_WATCH_*` constants. A watch spec has no times: `nextFireTime` and `previousFireTime` return `null`, `countOccurrences` counts none and `describeSchedule` words it, so code that switches over `ScheduleSpec.kind` needs a `default:` branch (the union may grow). The schedule unions are documented as growing in minor releases (`public-types.ts`); the same sentence is now in `ScheduleSpec`'s own header. A caller that cannot handle a watch (a host with no tool servers) should skip the job, not fail on it.
59
+
60
+ Editing a watch job to another resource or server starts it clean: the baseline, an update waiting out the gap and the hour's count are kept per source, so the old resource's content is never run under the new resource's name. Resuming a paused watch drops the updates that waited while it was paused.
61
+
62
+ - 866823c: New `setDeliberateEnvKeys(names)` export. A host that writes variables into the process environment on purpose (the CLI's settings `env` block) calls it so the shell tool's removal of inherited credential-shaped variables leaves those names in. Nothing changes for a host that never calls it.
63
+ - 9d85c30: The bash tool now runs a set of read-only GitHub CLI commands without asking: `gh pr view|list|diff|checks|status`, `gh issue view|list|status`, `gh repo view`, `gh run list|view`, `gh release list|view`, `gh workflow list|view`, `gh label list`, `gh auth status` and `gh search repos|issues|prs|commits|code`, each only with the flags its table names (`--json`, `--repo owner/name`, `--limit`, `--state` and the like). Everything else about `gh` still asks, as before: `gh api`, `--web`, `--jq`/`--template`, `--output`, `--hostname`, a flag before the subcommand, `GH_*` assignments, aliases, extensions, and any repository argument that names a host, a URL, `user@host` or a `~` path, and a `cd` next to `gh` asks, as next to `git`. Nothing to change on your side; a rule that denies `gh` still wins.
64
+ - a6b9e66: A folder written to look like a bare git repository (`HEAD`, `objects/`, `refs/` and a `config`) can no longer make git run a program. Before, a model that was allowed to write files could write one, then run `cd` and `git status` as two read-only looking calls and git would run the program the folder's `config` names (`core.fsmonitor`); git that Namzu starts itself, such as the workspace change check, ran it with no model call at all.
65
+
66
+ What changes for you: a `git` or `gh` line is no longer approved as read-only when the folder it starts in, or one above it, looks like a bare repository, so you are asked. Every command the model starts (`bash`, background jobs, `monitor`, and commands in the local sandbox) now carries `safe.bareRepository=explicit` and an empty `core.fsmonitor` through `GIT_CONFIG_COUNT`, appended after any entries you already set. Your own commit hooks still run for a commit the model makes. Git that Namzu starts itself also turns hooks off for that call. If you rely on running git from inside a real bare repository (`cd repo.git && git log`), name the repository now: `git --git-dir=. log`. A normal checkout, a subfolder, a linked worktree and a submodule are unchanged. git older than 2.38 ignores these settings.
67
+
68
+ For hosts: new exports `withSafeGitConfig`, `withHostGitConfig`, `withGitConfig`, `hostGitEnv`, `hostGitConfig`, `SAFE_GIT_CONFIG` and `isGitProgram` for code that starts git itself, a third argument to `isReadOnlyCommandLine` (`{ directory }`), and a `directory` argument on `withShellSession`.
69
+
70
+ Also: the remaining places Namzu starts git itself (the remember-this-rule ignore check, the project-state move, the Desktop commit and header reads, project compare, and a plugin hook's own git commands, and the history lookup behind the example text in an empty prompt, which ran at start-up with no model call) now carry the same settings; a `GIT_CONFIG_COUNT` such as `+1` no longer makes the helper overwrite your own `GIT_CONFIG_*` entries; and edits through the Windows spellings of `.git` (`.git.`, `GIT~1`, `.git::$INDEX_ALLOCATION`) now ask like `.git` does. A subfolder of a real checkout that itself looks like a bare repository also refuses git from inside it; use `git -C <checkout root>`.
71
+
72
+ - a650622: `glob` now lists matches newest modification first and applies its 500-path cap after sorting, so a capped result keeps the newest files instead of whichever the directory walk met first; the notice says how many files matched. `grep` in `content` and `count` modes now returns files in path order, so a later page (`offset`) continues the same list on every run (`files_with_matches` stays newest first). New `NAMZU_SEARCH_TIMEOUT_SECONDS` (default 12) sets the time budget of both tools (1 to 600; larger values fall back to 12). A host `glob` collects at most 10,000 matches before sorting; past that the notice says "at least". If you relied on walk order from `glob`, sort the paths yourself; nothing else needs to change.
73
+ - 262b865: The shell permission check now remembers, for the whole session, which variables an earlier `bash` call gave the integer attribute (`declare -i`, `typeset -i`, `local -i`, also `-n`, in any flag cluster). Bash evaluates every value stored into such a variable as arithmetic, so `x='a[$(cmd)]'` in a later call runs `cmd`. Such a later line (`x=…`, `x+=…`, `read x`, `printf -v x`, `mapfile x`, `for x in …`, `export x=…`, `${x:=…}`) is now read as opaque and asks instead of being allowed by a pattern rule or a read-only reading. When the names cannot be known (`declare -i "$v"`, an `eval` that may declare, any `source` or `.`) the session is marked, and until it restarts any later stored value that holds a subscript or an expansion asks. Lines with plain values, such as `x=5` or `x+=1`, are unaffected. Nothing to change in your own code; a call that now asks can be approved as before. Hosts that read lines themselves can pass the session's names through the new `attributes` option of `lexShellCommandLine`; `ShellLexResult` gains `integerNames` and `integerNamesUnknown`. A bare name stored into a variable that has the attribute (`x=y`, `x+=y`, `x=y+1`, `for x in y`) also asks, because bash evaluates the value of `y` again. `AuthorizationGate.evaluate` takes an optional `sessionId` and reads the line with that session's names in every rule, so an allow rule no longer passes a line the session's earlier calls turned into a command run.
74
+ - 2dc890e: The message the kernel records when a background job ends, or a monitor speaks, now names the jobs it is about in a typed `origins` list on its `runtime-context` source (`job-exit` for the end of a job, `job-event` for a monitor's output, notices and end), beside the existing text tag; older records have none and nothing about the text changes. New exports: `RuntimeContextOrigin`, `isRuntimeContextOrigin`, `RUNTIME_CONTEXT_ORIGIN_KINDS` and `formatJobExitNotice`; `createRuntimeContextMessage` takes the origins as an optional third argument and `SteeringChannel` gets an optional `keys()`. A job's exit notice also says how long it ran and where its saved output is. A `bash` call that only starts a background command is marked `launched`, so the turn that started it no longer ends with the line that a command may have changed files.
75
+ - 864d2da: New built-in tool `notebook_edit` changes one cell of a Jupyter notebook (`notebook_path`, `cell_id`, `new_source`, `cell_type`, `edit_mode` of replace, insert or delete) and keeps the rest of the notebook as it was. It is not in `getBuiltinTools()` (its schema would ride every request): `getNotebookTools()` returns it, and it is exported as `NotebookEditTool`. The CLI offers it in every session and loads it on demand through `search_tools`, or with the rest when `toolLoading` is `eager`; a host that builds its own tool set from `getBuiltinTools()` adds `getNotebookTools()` to offer it. It counts as an edit tool: `accept-edits` approves it, a permission rule written under `edit` (for example `edit: { "private/**": "deny" }`) covers its `notebook_path`, and a hook matcher can name it `NotebookEdit`.
76
+
77
+ Also changed: reading a notebook with `read` now counts as reading it, so `edit`, `write` and `notebook_edit` see it as read and notice when it changed afterwards; a notebook saved with a byte-order mark is now read and accepted by the notebook check instead of being reported as invalid JSON.
78
+
79
+ A hook matcher written as a regular expression such as `(Edit|Write)` or `.*Edit.*` also fires for `notebook_edit` now, since the tool is written `NotebookEdit`; anchor it (`^(Edit|Write)$`) to keep the old reach.
80
+
81
+ `notebook_edit` is checkpointed like `edit` and `write` (a rewind restores the notebook), a hook `if` such as `Edit(private/**)` narrows it by its `notebook_path`, and hooks see that path in `NAMZU_TOOL_PATH`; its input has `notebook_path` only, not `file_path`. A notebook that cannot be written back exactly (an indent over ten characters, an integer beyond 2^53) is refused and left untouched, and after a compaction the notebook text a read showed is dropped once the cell is edited. Number spellings such as `1.0` may be written as `1`.
82
+
83
+ - 5fc3a4f: The `schedule` tool's `list` result now starts with `Now: <time>` (and `data.now`), and each job reports when its last run ended, how many runs it has had, and a one-line preview of what the last run said (capped at 160 characters, control and escape characters removed, quoted as the run's own words and not an instruction). `ScheduleJobSummary` gains the optional `lastRunAt`, `runCount` and `lastOutputPreview`; a host that does not set them keeps working, and the first output line of `list` is now the `Now:` line, so a caller that parsed the output text line by line should skip it or read `data.jobs`. The CLI fills the fields from the job's existing run history. The preview is filled only for a job in the session's folder, and tag characters and variation selectors are removed from it.
84
+ - a3a2626: `web_search` takes optional `allowed_domains` and `blocked_domains` lists. Results are filtered by URL host (a domain also covers its subdomains; `www.` and case are ignored), the tool asks the backend for extra results so `limit` is still met, and a call that sets both lists is refused (`Cannot specify both allowed_domains and blocked_domains in the same request`), so send one or the other. `WebSearchRequest` gains optional `allowedDomains` and `blockedDomains` so a search backend can filter natively; a backend that ignores them keeps working. `web_search` now also trims a backend's reply to `limit`.
85
+ - affe54e: A command file or skill given arguments it has no `$ARGUMENTS` for no longer refuses them: the text is appended as a last line, `ARGUMENTS: <text>`, after a blank line (nothing is appended when no text was typed). This turns a refusal into a feature, so a script that relied on the error to detect a template without a placeholder will now get a normal run; add `$ARGUMENTS` where the text belongs to keep it out of the end of the prompt.
86
+
87
+ New placeholders: `$0`, `$1`, ... and `$ARGUMENTS[0]`, ... take one word each, read as a shell line (`"two words"` is one word; an unclosed quote or a text over 10,000 characters is split on spaces), a numbered placeholder with no word is left as written, and `\$ARGUMENTS` or `\$1` writes the placeholder text. A prompt that already contained `\$` before `ARGUMENTS` or a digit now loses the backslash. Named arguments declared in frontmatter (`$name`) are not supported; such a placeholder stays as written. Inside a shell command a numbered word stays one quoted argument, and the appended line is plain text escaped like any value, so it cannot start or hide a command.
88
+
89
+ The `skill` tool now fills placeholders in a skill body even when the host gives no `shell` (as plain text: nothing runs there, so nothing is escaped or refused), leaves the body exactly as written when the call carries no `args`, and shows the `Arguments:` line only when no placeholder took them. A skill preloaded into an agent gets `$ARGUMENTS` as empty even without shell commands. `@namzu/sdk` exports `fillArguments`, `splitSkillArguments` and `takesSkillArguments`, `fillArguments` takes an `escape: false` option for hosts that run no command, and `substituteEscaped` accepts a `reader` option.
90
+
91
+ - 2dc890e: The model is now told to wait for an event instead of a timer. A background command ends with an exit notice, so the model ends its turn or keeps working and does not poll; a step that waits for a person (a command that prints a sign-in URL) is run in the background with no timeout and is not cut short. `wait_for_job` is described as the way to get a result needed inside the current step. A chain of short sleeps, or a `timeout` under ten minutes wrapped round a sign-in or an until-loop (in any sub-command, also after `env` or `VAR=value`, also for a background launch), is refused with a pointer to a background until-loop or `monitor`; in a background launch the result says to drop the wrapper. A one-turn run (`exec`, a scheduled fire, a drain) is told in its environment block to wait inside the turn with `wait_for_job`, because nothing there starts a new turn when a job exits.
92
+
93
+ In the terminal app `monitor` is listed in the first request instead of behind `search_tools`, which adds 3,137 bytes (its description and schema) to each request's tools block; other hosts keep it deferred, and a run that is one turn and closes (a scheduled fire, a drain) says in its environment block that no monitor is offered. Nothing is renamed or removed; a caller that checked the refusal text of a long sleep sees new wording.
94
+
95
+ ### Patch Changes
96
+
97
+ - 4356391: A monitor that expires with no events delivered, after its command wrote to stderr, now says so in its expiry notice and names the `job read` call that shows the output. stderr is still never an event; before, the model got only "no events delivered" and could not tell a failed command from a quiet one. `expiryNotice` takes an optional third argument (`{ stderrJobId }`); callers that omit it get the same text as before. Nothing to change on your side.
98
+ - 75883a2: Three permission rules now decide what they say. A `deny` written as the list entry `Agent` (or `agent`, or in the table under either spelling) used to match nothing, so sub-agents were never refused; it now refuses them, as do `--disallowed-tools Agent` and the other flags. `Agent(explore)` matches the sub-agent type of the call instead of any call whose prompt or label contains the word. `WebFetch(domain:example.com)` compares the parsed host of the address: before, an allow also admitted `https://other.test/?r=https://example.com/` and any call whose `prompt` field named the host, and a bare `http://example.com` was not matched; now only the host (any scheme, port, path or query) is allowed, `domain:*.example.com` covers its subdomains and not the bare domain, and a deny or ask for the host also catches an address spelled `EXAMPLE.COM.`. A `WebFetch(...)` pattern that is not a `domain:` entry now tests the address, not the whole call. `@namzu/sdk`: `web_fetch` declares `urlArgument: 'url'`, so a rule on its address tests it whole.
99
+
100
+ What to check: an allow you wrote for a host that relied on the old over-broad match (a URL on another host, or a subdomain without `*.`) now asks again; add the host or `domain:*.host` if you meant it. A deny for `Agent` that did nothing before now takes effect, so delegation is refused where you wrote it.
101
+
102
+ Also: an `Agent(name)` deny or ask now also fires on an Agent call that leaves the sub-agent type out, and an `Agent(name)` allow never applies to such a call. An `Agent(name)` allow compares the type exactly as written; a deny or ask ignores case. A `WebFetch` allow that is not a plain host (`domain:example.com:8443`, or a `*` that is not a whole leading label) allows nothing and is reported as a diagnostic, so the call asks; write `domain:example.com` or `domain:*.example.com`. Two spellings of one tool in the same table (`agent` and `Agent`, `WebFetch` and `web_fetch`) are now one entry and the stricter effect stands, whatever order they were written in. Narrowing an over-broad allow is the intended fail-safe.
103
+
104
+ - a6b9e66: Adding a folder that is itself protected, such as the Namzu home, a `.git` folder, a project `.namzu` or `.vscode` (with `--add-dir`, `additionalDirectories` or `/add dir`), or starting in one, no longer lets the model write inside it without a question: writes and shell redirections below it are asked about in every mode, the way they are anywhere else. A session logs one notice for each such folder. A sub-agent's managed worktree is still written freely, apart from its own `.git` and `.namzu`.
105
+
106
+ Writes into credential folders (`.ssh`, `.aws`, `.azure`, `.gnupg`, `.kube`, `.docker`, `.config/gh`, `.config/glab-cli`, `.config/gcloud`) are now asked about in every mode too, at any depth. If you keep a folder with one of those names in a project and write to it often, expect the question.
107
+
108
+ A shell line that downloads, copies or unpacks into a protected path is now asked about too: `curl -o`, `wget`, `dd of=`, `install`, `rsync`, `tar -C` or extract, `unzip -d` and `git clone`/`git init` were not read as writes before, so a git hook or a file in the Namzu home could be planted without a question. A working directory or added folder that sits inside a sub-agent's managed worktree is excused like the worktree itself, and a look-alike `.namzu/projects/<slug>/worktrees/<name>` folder in a repository is no longer excused: only the real Namzu home is.
109
+
110
+ `git clone` and `git init` with an option that takes a value (`--depth 1`, `-b main`, `-c a=b`) now have their real destination read, so a clone into the Namzu home or a `.git` folder is asked about; `rsync --exclude .git` and similar filters are no longer asked about. `ln`, `zip`, `patch`, `truncate`, `perl -i`, `sort -o`, `openssl -out`, `ssh-keygen -f`, `find -fprint`, a `git config` of a hook or command key, `git archive -o` and `git worktree add` into a protected path are asked about too, and so are `tar` update, append and delete and `unzip -d<folder>`.
111
+
112
+ - a6b9e66: A plugin hooks module that uses `<!--` or a line-start `-->` to hide code from the scan is now refused. The runtime reads those as comments and the scan did not, so the consent summary could show less than the module did. Ordinary uses are unaffected: the markers inside strings, templates, regexes and comments, and `while (n --> 0)`, still load. The hooks worker also freezes the prototypes its own errors inherit from, so nothing set on them survives into later hook calls. If a module of yours is refused for this, remove the HTML-style comment.
113
+ - 2dc890e: A context message that names more than 64 background jobs (many commands ending while the session was idle) is now stored with the first 64 ids instead of failing its session-log record; the ids are a note on the record and never decided whether it could be kept.
114
+ - a6b9e66: A skill or command template that puts an argument where the shell reads a word again is now refused instead of loaded. That covers an open subscript (`a['$ARGUMENTS']=1`, `arr=([$ARGUMENTS]=1)`), `trap`, `eval`, `let`, `source` and `.`, a `[[` test that compares numbers or uses `-v`, `((` arithmetic (also after `&&`, `;` or a closing parenthesis), a shell or `$SHELL` handed the argument as its `-c` string or reading it from a pipe, here-string or `<(...)`, `printf -v`, `read` names, `[ -v`, a first word that is not a plain name, a variable that is later used in arithmetic or as a prompt, and commands that take variable names (`declare`, `unset`, `export` where the argument is a name). A redirection or `command -p` before the first word no longer hides it. Before, quoting an argument there did not stop the shell from running a `$(...)` inside it. If a skill of yours does this on purpose, pass the argument through a plain command (`echo`, `git`) or an environment variable instead. Ordinary templates, including `[[ -n $ARGUMENTS ]]`, `export NAME=$ARGUMENTS`, `cat <<< $ARGUMENTS` and `bash -c '...' _ $ARGUMENTS`, load as before; so do `git log $ARGUMENTS`, `[ -f $ARGUMENTS ]` and `echo '$ARGUMENTS'`.
115
+
116
+ The check follows the shell's own reading of the command: an apostrophe in a `#` comment or `$'...'` string no longer hides what follows, a quote inside a `$(...)` inside double quotes is its own, `-c` is found behind options and `--`, a program started through any wrapper (`/bin/env`, `taskset`, `unshare`, `bwrap`, `coproc`, `find -exec`, and `sudo`, `xargs`, `timeout` and the like with their own options) is seen, a glob in the command word is refused like an expansion, and a value stored in a variable, `set --`, an array, a `read` or `for` word, a pipe or a file is refused when the same command reads variables as text, names, subscripts, offsets or scripts. `RANDOM`, `SRANDOM`, `OPTIND`, `compgen -C`, `expand_aliases` and a `case` inside `$(...)` are refused too. A whole-number argument is now accepted anywhere, including inside `$(( ))`, `(( ))` and `[[ -lt ]]`, and a value after a closed `$(( ))`, inside `<( )` in `mapfile`, as the data of `printf -v`, or after an earlier here-document loads as before. A command that defines a shell function (`name() { ... }`, `function name { ... }`) refuses any argument, because a function can hand it on to one of those places; put the function in a script file the skill ships instead. An argument that stands where the program goes (`env $ARGUMENTS`, `sudo $ARGUMENTS`, a bare `$ARGUMENTS`) is refused too, since quoting it still lets it pick the program.
117
+
118
+ - a6b9e66: A workflow or code-runtime script that loops on `await` with nothing slow in it (`for (;;) { await Promise.resolve() }`) is now always stopped by the total CPU limit. The limit used to add up whole milliseconds per slice, so very short slices counted as zero and the loop could run on without end; slices are now timed to the microsecond. No setting changes, and scripts that stay inside their limits behave as before.
119
+
3
120
  ## 70.0.0
4
121
 
5
122
  ### Major Changes
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Whether a folder looks like a bare git repository that is not one.
3
+ *
4
+ * Git started in a folder that holds `HEAD`, `objects/` and `refs/` outside a
5
+ * `.git` folder reads it as a repository and obeys its `config`, which can name
6
+ * a program to run. A model that may write files can plant such a folder, so a
7
+ * `git` line that looks harmless is not harmless when the folder it starts in,
8
+ * or one above it, looks like that. The read-only decision asks the person when
9
+ * this is true (see `readonly-commands.ts`).
10
+ */
11
+ /** The sentence a person reads when a git line is asked about for this reason. */
12
+ export declare const BARE_INDICATORS_REASON = "Git command in a folder that looks like a bare repository (HEAD, objects and refs outside a .git folder). Git may read it as a repository and run the configuration and programs it names. To work with a real bare repository, name it: git --git-dir=<folder> <command>.";
13
+ /** The sentence for a `cd` and a `git` command in one line. */
14
+ export declare const CD_AND_GIT_REASON = "A line that changes folder and runs git needs approval: the folder it enters may hold a repository that was planted there.";
15
+ /**
16
+ * The folder, from `cwd` up to the root, that looks like a bare repository
17
+ * outside a `.git` folder, or `undefined` when none does. A folder that cannot
18
+ * be read counts as not looking like one: there is nothing git could read.
19
+ */
20
+ export declare function bareRepositoryIndicator(cwd: string): string | undefined;
21
+ //# sourceMappingURL=bare-repository.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bare-repository.d.ts","sourceRoot":"","sources":["../../src/authorization/bare-repository.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAKH,kFAAkF;AAClF,eAAO,MAAM,sBAAsB,+QAC0O,CAAA;AAE7Q,+DAA+D;AAC/D,eAAO,MAAM,iBAAiB,+HAC+F,CAAA;AAmC7H;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CASvE"}
@@ -0,0 +1,62 @@
1
+ /**
2
+ * Whether a folder looks like a bare git repository that is not one.
3
+ *
4
+ * Git started in a folder that holds `HEAD`, `objects/` and `refs/` outside a
5
+ * `.git` folder reads it as a repository and obeys its `config`, which can name
6
+ * a program to run. A model that may write files can plant such a folder, so a
7
+ * `git` line that looks harmless is not harmless when the folder it starts in,
8
+ * or one above it, looks like that. The read-only decision asks the person when
9
+ * this is true (see `readonly-commands.ts`).
10
+ */
11
+ import { statSync } from 'node:fs';
12
+ import { dirname, sep } from 'node:path';
13
+ /** The sentence a person reads when a git line is asked about for this reason. */
14
+ export const BARE_INDICATORS_REASON = 'Git command in a folder that looks like a bare repository (HEAD, objects and refs outside a .git folder). Git may read it as a repository and run the configuration and programs it names. To work with a real bare repository, name it: git --git-dir=<folder> <command>.';
15
+ /** The sentence for a `cd` and a `git` command in one line. */
16
+ export const CD_AND_GIT_REASON = 'A line that changes folder and runs git needs approval: the folder it enters may hold a repository that was planted there.';
17
+ // A path longer than this many folders is not a real checkout; stop looking.
18
+ const MAX_DEPTH = 64;
19
+ function isDirectory(path) {
20
+ try {
21
+ return statSync(path).isDirectory();
22
+ }
23
+ catch {
24
+ return false;
25
+ }
26
+ }
27
+ function isFile(path) {
28
+ try {
29
+ return statSync(path).isFile();
30
+ }
31
+ catch {
32
+ return false;
33
+ }
34
+ }
35
+ /** Whether `folder` itself has the three marks of a bare repository. */
36
+ function hasBareMarks(folder) {
37
+ return (isFile(`${folder}${sep}HEAD`) &&
38
+ isDirectory(`${folder}${sep}objects`) &&
39
+ isDirectory(`${folder}${sep}refs`));
40
+ }
41
+ /** Whether `folder` is, or lies inside, a `.git` folder. */
42
+ function insideDotGit(folder) {
43
+ return folder.split(/[\\/]/).includes('.git');
44
+ }
45
+ /**
46
+ * The folder, from `cwd` up to the root, that looks like a bare repository
47
+ * outside a `.git` folder, or `undefined` when none does. A folder that cannot
48
+ * be read counts as not looking like one: there is nothing git could read.
49
+ */
50
+ export function bareRepositoryIndicator(cwd) {
51
+ let folder = cwd;
52
+ for (let depth = 0; depth < MAX_DEPTH; depth++) {
53
+ if (!insideDotGit(folder) && hasBareMarks(folder))
54
+ return folder;
55
+ const parent = dirname(folder);
56
+ if (parent === folder)
57
+ return undefined;
58
+ folder = parent;
59
+ }
60
+ return undefined;
61
+ }
62
+ //# sourceMappingURL=bare-repository.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bare-repository.js","sourceRoot":"","sources":["../../src/authorization/bare-repository.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AAClC,OAAO,EAAE,OAAO,EA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YAAE,OAAO,MAAM,CAAA;QAChE,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAA;QAC9B,IAAI,MAAM,KAAK,MAAM;YAAE,OAAO,SAAS,CAAA;QACvC,MAAM,GAAG,MAAM,CAAA;IAChB,CAAC;IACD,OAAO,SAAS,CAAA;AACjB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"command-line.d.ts","sourceRoot":"","sources":["../../src/authorization/command-line.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4EG;AAEH,OAAO,EACN,KAAK,YAAY,EAKjB,MAAM,kBAAkB,CAAA;AAEzB,kFAAkF;AAClF,MAAM,WAAW,wBAAwB;IACxC;;;OAGG;IACH,QAAQ,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAA;IACpC;;;OAGG;IACH,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAA;CACxB;AAED,sFAAsF;AACtF,eAAO,MAAM,kBAAkB,aAAmC,CAAA;AASlE;;;;GAIG;AACH,wBAAgB,oBAAoB,CACnC,OAAO,EAAE,MAAM,EACf,OAAO,GAAE,YAAqB,GAC5B,wBAAwB,CAmC1B;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,eAAe,CAC9B,OAAO,EAAE,MAAM,EACf,OAAO,GAAE,YAAqB,GAC5B,SAAS,MAAM,EAAE,CAenB;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,GAAE,YAAqB,GAAG,OAAO,CAKjG"}
1
+ {"version":3,"file":"command-line.d.ts","sourceRoot":"","sources":["../../src/authorization/command-line.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4EG;AAEH,OAAO,EACN,KAAK,YAAY,EAKjB,MAAM,kBAAkB,CAAA;AAGzB,kFAAkF;AAClF,MAAM,WAAW,wBAAwB;IACxC;;;OAGG;IACH,QAAQ,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAA;IACpC;;;OAGG;IACH,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAA;CACxB;AAED,sFAAsF;AACtF,eAAO,MAAM,kBAAkB,aAAmC,CAAA;AASlE;;;;GAIG;AACH,wBAAgB,oBAAoB,CACnC,OAAO,EAAE,MAAM,EACf,OAAO,GAAE,YAAqB,GAC5B,wBAAwB,CAmC1B;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,eAAe,CAC9B,OAAO,EAAE,MAAM,EACf,OAAO,GAAE,YAAqB,GAC5B,SAAS,MAAM,EAAE,CAenB;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,GAAE,YAAqB,GAAG,OAAO,CAKjG"}
@@ -76,6 +76,7 @@
76
76
  * The failure mode is a prompt, never a silent grant.
77
77
  */
78
78
  import { basename, lexShellCommandLine, } from './shell-lexer.js';
79
+ import { currentShellAttributes } from './shell-session-state.js';
79
80
  /** Commands whose argument is code assembled at runtime. Shared with `program.ts`. */
80
81
  export const RUNTIME_EVALUATORS = new Set(['eval', 'source', '.']);
81
82
  /**
@@ -197,11 +198,17 @@ function writes(redirection) {
197
198
  */
198
199
  let cached;
199
200
  function lex(command, dialect) {
200
- if (cached !== undefined && cached.command === command && cached.dialect === dialect) {
201
+ // The session's attributes are part of the reading: another session, or
202
+ // the same one after it declared a name, reads the same text differently.
203
+ const attributes = currentShellAttributes();
204
+ if (cached !== undefined &&
205
+ cached.command === command &&
206
+ cached.dialect === dialect &&
207
+ cached.attributes === attributes) {
201
208
  return cached.result;
202
209
  }
203
- const result = lexShellCommandLine(command, { dialect });
204
- cached = { command, dialect, result };
210
+ const result = lexShellCommandLine(command, { dialect, ...(attributes ? { attributes } : {}) });
211
+ cached = { command, dialect, attributes, result };
205
212
  return result;
206
213
  }
207
214
  //# sourceMappingURL=command-line.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"command-line.js","sourceRoot":"","sources":["../../src/authorization/command-line.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4EG;AAEH,OAAO,EAIN,QAAQ,EACR,mBAAmB,GACnB,MAAM,kBAAkB,CAAA;AAgBzB,sFAAsF;AACtF,MAAM,CAAC,MAAM,kBAAkB,GAAG,IAAI,GAAG,CAAC,CAAC,MAAM,EAAE,QAAQ,EAAE,GAAG,CAAC,CAAC,CAAA;AAElE;;;;GAIG;AACH,MAAM,YAAY,GAAG,EAAE,CAAA;AAEvB;;;;GAIG;AACH,MAAM,UAAU,oBAAoB,CACnC,OAAe,EACf,UAAwB,MAAM;IAE9B,MAAM,KAAK,GAAG,GAAG,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;IACnC,IAAI,MAAM,GAAG,KAAK,CAAC,MAAM,CAAA;IACzB,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,QAAQ,EAAE,CAAC;QACnC,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,CAAA;QACzC,IAAI,IAAI,KAAK,SAAS,IAAI,CAAC,IAAI,CAAC,OAAO,IAAI,kBAAkB,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC;YACzF,qEAAqE;YACrE,oDAAoD;YACpD,MAAM,GAAG,IAAI,CAAA;QACd,CAAC;IACF,CAAC;IAED,0EAA0E;IAC1E,2EAA2E;IAC3E,yEAAyE;IACzE,IAAI,CAAC,KAAK,CAAC,QAAQ,IAAI,KAAK,CAAC,QAAQ,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,QAAQ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"}
@@ -20,6 +20,12 @@ export interface ToolCallContext {
20
20
  * omitted, it is read the same as a host-defined tool.
21
21
  */
22
22
  readonly toolSource?: ToolSourceRef;
23
+ /**
24
+ * The shell session the call runs in. The gate reads a command line with
25
+ * the integer names earlier lines of that session declared (see
26
+ * `shell-session-state.ts`), in every rule, predicates included.
27
+ */
28
+ readonly sessionId?: string;
23
29
  }
24
30
  /**
25
31
  * What the rule actually said, in words a model can act on.
@@ -49,6 +55,7 @@ export declare class AuthorizationGate {
49
55
  private readonly enabled;
50
56
  constructor(config: AuthorizationGateConfig, log: Logger);
51
57
  evaluate(ctx: ToolCallContext): GateEvaluationResult;
58
+ private evaluateIn;
52
59
  }
53
60
  /**
54
61
  * How wide an `allow` rule is, for the review modes that must not let a broad
@@ -1 +1 @@
1
- {"version":3,"file":"gate.d.ts","sourceRoot":"","sources":["../../src/authorization/gate.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AACzD,OAAO,KAAK,EACX,uBAAuB,EACvB,0BAA0B,EAC1B,iBAAiB,EACjB,oBAAoB,EACpB,MAAM,iCAAiC,CAAA;AAExC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAA;AAE5D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAA;AAGhD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAEpD,MAAM,WAAW,eAAe;IAC/B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IACzB,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAA;IAC3B,QAAQ,CAAC,OAAO,EAAE,cAAc,GAAG,SAAS,CAAA;IAC5C;;;;OAIG;IACH,QAAQ,CAAC,cAAc,CAAC,EAAE,YAAY,CAAA;IACtC;;;;;OAKG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,aAAa,CAAA;CACnC;AAED;;;;;;;;;;;;;;;;;GAiBG;A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CAAC,cAAc,CAAC,EAAE,YAAY,CAAA;IACtC;;;;;OAKG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,aAAa,CAAA;IACnC;;;;OAIG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAC3B;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,iBAAiB,EAAE,IAAI,CAAC,EAAE,0BAA0B,GAAG,MAAM,CAuE/F;AAED,qBAAa,iBAAiB;IAC7B,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAqB;IAC3C,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAqB;IACtD,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAA0B;IACnD,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAQ;IAC5B,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAS;IACtC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;gBAErB,MAAM,EAAE,uBAAuB,EAAE,GAAG,EAAE,MAAM;IAoHxD,QAAQ,CAAC,GAAG,EAAE,eAAe,GAAG,oBAAoB;IAIpD,OAAO,CAAC,UAAU;CAqElB;AAED;;;;;;;;;GASG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,iBAAiB,GAAG,IAAI,GAAG,MAAM,GAAG,SAAS,GAAG,SAAS,CAkB7F"}
@@ -4,6 +4,7 @@ import { AuthorizationGateConfigSchema } from '../types/authorization/index.js';
4
4
  import { SCOPE_ATTRIBUTE } from '../utils/log/types.js';
5
5
  import { describeDangerousFinding } from './dangerous-commands.js';
6
6
  import { dangerousFindingFor, evaluateRule } from './rules.js';
7
+ import { withShellSession } from './shell-session-state.js';
7
8
  /**
8
9
  * What the rule actually said, in words a model can act on.
9
10
  *
@@ -209,6 +210,9 @@ export class AuthorizationGate {
209
210
  }
210
211
  }
211
212
  evaluate(ctx) {
213
+ return withShellSession(ctx.sessionId, () => this.evaluateIn(ctx));
214
+ }
215
+ evaluateIn(ctx) {
212
216
  if (!this.enabled) {
213
217
  return {
214
218
  decision: 'review',
@@ -1 +1 @@
1
- {"version":3,"file":"gate.js","sourceRoot":"","sources":["../../src/authorization/gate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,qCAAqC,CAAA;AAC/E,OAAO,EAAE,KAAK,EAAE,MAAM,iCAAiC,CAAA;AAQvD,OAAO,EAAE,6BAA6B,EAAE,MAAM,iCAAiC,CAAA;AAE/E,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAEvD,OAAO,EAAE,wBAAwB,EAAE,MAAM,yBAAyB,CAAA;AAClE,OAAO,EAAE,mBAAmB,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAsB9D;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,YAAY,CAAC,IAAuB,EAAE,IAAiC;IACtF,QAAQ,IAAI,CAAC,IAAI,EAAE,CAAC;QACnB,KAAK,yBAAyB,CAAC,CAAC,CAAC;YAChC,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;gBACxB,OAAO,uEAAuE,CAAA;YAC/E,CAAC;YACD,MAAM,OAAO,GAAG,mBAAmB,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,SAAS,EAAE;gBACjE,cAAc,EAAE,IAAI,CAAC,cAAc;gBACnC,MAAM,EAAE,IAAI,CAAC,MAAM,KAAK,IAAI;aAC5B,CAAC,CAAA;YACF,OAAO,OAAO,KAAK,SAAS;gBAC3B,CAAC,CAAC,uEAAuE;gBACzE,CAAC,CAAC,wBAAwB,CAAC,OAAO,CAAC,CAAA;QACrC,CAAC;QACD,KAAK,iBAAiB;YACrB,OAAO,yCAAyC,CAAA;QACjD,KAAK,eAAe;YACnB,OAAO,oBAAoB,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAA;QACxD,KAAK,cAAc;YAClB,OAAO,mBAAmB,IAAI,CAAC,SAAS,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O,MAAM,0BAA0B,EAAE,SAAS,MAAM,EAAe,CAAA;AAEvE;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,kCAAkC,EAAE,SAAS,MAAM,EAI/D,CAAA;AAgBD,MAAM,WAAW,oBAAoB;IACpC;;;OAGG;IACH,QAAQ,CAAC,aAAa,CAAC,EAAE,OAAO,CAAA;CAChC;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,oBAAyB,GAAG,OAAO,CA0BzF"}
1
+ {"version":3,"file":"protected-paths.d.ts","sourceRoot":"","sources":["../../src/authorization/protected-paths.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,6EAA6E;AAC7E,eAAO,MAAM,qBAAqB,EAAE,SAAS,MAAM,EAkBlD,CAAA;AAED,0DAA0D;AAC1D,eAAO,MAAM,4BAA4B,EAAE,SAAS,CAAC,SAAS,MAAM,EAAE,CAAC,EAStE,CAAA;AAED,0EAA0E;AAC1E,eAAO,MAAM,oBAAoB,EAAE,SAAS,MAAM,EA4CjD,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,0BAA0B,EAAE,SAAS,MAAM,EAAe,CAAA;AAEvE;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,kCAAkC,EAAE,SAAS,MAAM,EAI/D,CAAA;AAiDD,MAAM,WAAW,oBAAoB;IACpC;;;OAGG;IACH,QAAQ,CAAC,aAAa,CAAC,EAAE,OAAO,CAAA;CAChC;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,oBAAyB,GAAG,OAAO,CA0BzF"}
@@ -31,10 +31,21 @@ export const PROTECTED_DIRECTORIES = [
31
31
  '.devcontainer',
32
32
  '.yarn',
33
33
  '.mvn',
34
+ // Credential homes: a key, token or kubeconfig written here is used later
35
+ // by every command that signs in with it.
36
+ '.ssh',
37
+ '.aws',
38
+ '.azure',
39
+ '.gnupg',
40
+ '.kube',
41
+ '.docker',
34
42
  ];
35
43
  /** Directory sequences; the segments must be adjacent. */
36
44
  export const PROTECTED_NESTED_DIRECTORIES = [
37
45
  ['.config', 'git'],
46
+ ['.config', 'gh'],
47
+ ['.config', 'glab-cli'],
48
+ ['.config', 'gcloud'],
38
49
  // A skill, agent or command folder is read back as instructions, and a
39
50
  // skill's hooks run commands. `.agents/skills` is one of the folders Namzu
40
51
  // loads skills from, at every level from the checkout root down.
@@ -117,9 +128,43 @@ export const PROJECT_DIRECTORY_AUTHORED_FOLDERS = [
117
128
  const PROJECT_DIRECTORY = '.namzu';
118
129
  const SKILL_FILE = 'skill.md';
119
130
  /** Lower case, with the two letters that fold into ASCII on some file systems. */
120
- function fold(name) {
131
+ function lower(name) {
121
132
  return name.toLowerCase().replace(/ı/g, 'i').replace(/ſ/g, 's');
122
133
  }
134
+ /** The six letters an 8.3 short name keeps of a long one: no dots, no spaces. */
135
+ function shortStem(name) {
136
+ return name.replace(/[^a-z0-9]/g, '').slice(0, 6);
137
+ }
138
+ // Protected names by the stem their NTFS short alias (`GIT~1` for `.git`) starts with.
139
+ const SHORT_STEMS = new Map();
140
+ function rememberShortNames(names) {
141
+ for (const raw of names) {
142
+ const name = lower(raw);
143
+ const stem = shortStem(name);
144
+ if (stem !== '' && !SHORT_STEMS.has(stem))
145
+ SHORT_STEMS.set(stem, name);
146
+ }
147
+ }
148
+ /**
149
+ * A path segment as the file system names it: lower case, with the two letters
150
+ * that fold into ASCII, a stream suffix (`:$INDEX_ALLOCATION`) dropped, the
151
+ * trailing dots and spaces Windows ignores removed, and an 8.3 alias read as
152
+ * the long name it stands for.
153
+ */
154
+ function fold(name) {
155
+ let out = lower(name);
156
+ const colon = out.indexOf(':');
157
+ if (colon > 0)
158
+ out = out.slice(0, colon);
159
+ const trimmed = out.replace(/[. ]+$/, '');
160
+ if (trimmed !== '')
161
+ out = trimmed;
162
+ const alias = /^([a-z0-9]{1,6})~\d+$/.exec(out);
163
+ if (alias !== null)
164
+ return SHORT_STEMS.get(alias[1]) ?? out;
165
+ return out;
166
+ }
167
+ rememberShortNames([...PROTECTED_DIRECTORIES, ...PROTECTED_FILE_NAMES]);
123
168
  const AUTHORED = new Set(PROJECT_DIRECTORY_AUTHORED_FOLDERS.map(fold));
124
169
  const DIRECTORIES = new Set(PROTECTED_DIRECTORIES.map(fold));
125
170
  const FILE_NAMES = new Set(PROTECTED_FILE_NAMES.map(fold));
@@ -1 +1 @@
1
- {"version":3,"file":"protected-paths.js","sourceRoot":"","sources":["../../src/authorization/protected-paths.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,6EAA6E;AAC7E,MAAM,CAAC,MAAM,qBAAqB,GAAsB;IACvD,MAAM;IACN,SAAS;IACT,OAAO;IACP,QAAQ;IACR,QAAQ;IACR,QAAQ;IACR,eAAe;IACf,OAAO;IACP,MAAM;CACN,CAAA;AAED,0DAA0D;AAC1D,MAAM,CAAC,MAAM,4BAA4B,GAAmC;IAC3E,CAAC,SAAS,EAAE,KAAK,CAAC;IAClB,uEAAuE;IACvE,2EAA2E;IAC3E,iEAAiE;IACjE,CAAC,SAAS,EAAE,QAAQ,CAAC;CACrB,CAAA;AAED,0EAA0E;AAC1E,MAAM,CAAC,MAAM,oBAAoB,GAAsB;IACtD,YAAY;IACZ,aAAa;IACb,SAAS;IACT,eAAe;IACf,QAAQ;IACR,WAAW;IACX,UAAU;IACV,SAAS;IACT,SAAS;IACT,UAAU;IACV,aAAa;IACb,eAAe;IACf,cAAc;IACd,QAAQ;IACR,YAAY;IACZ,WAAW;IACX,mBAAmB;IACnB,uEAAuE;IACvE,sDAAsD;IACtD,yBAAyB;IACzB,QAAQ;IACR,SAAS;IACT,aAAa;IACb,UAAU;IACV,iBAAiB;IACjB,eAAe;IACf,aAAa;IACb,cAAc;IACd,UAAU;IACV,eAAe;IACf,aAAa;IACb,yBAAyB;IACzB,cAAc;IACd,eAAe;IACf,e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GAAG,QAAQ,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAA;IAC1C,IAAI,IAAI,KAAK,SAAS,IAAI,IAAI,KAAK,EAAE,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC;QAAE,OAAO,KAAK,CAAA;IAC5E,6EAA6E;IAC7E,OAAO,CAAC,CAAC,OAAO,IAAI,IAAI,KAAK,UAAU,CAAC,CAAA;AACzC,CAAC"}
1
+ {"version":3,"file":"protected-paths.js","sourceRoot":"","sources":["../../src/authorization/protected-paths.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,6EAA6E;AAC7E,MAAM,CAAC,MAAM,qBAAqB,GAAsB;IACvD,MAAM;IACN,SAAS;IACT,OAAO;IACP,QAAQ;IACR,QAAQ;IACR,QAAQ;IACR,eAAe;IACf,OAAO;IACP,MAAM;IACN,0EAA0E;IAC1E,0CAA0C;IAC1C,MAAM;IACN,MAAM;IACN,QAAQ;IACR,QAAQ;IACR,OAAO;IACP,SAAS;CACT,CAAA;AAED,0DAA0D;AAC1D,MAAM,CAAC,MAAM,4BAA4B,GAAmC;IAC3E,CAAC,SAAS,EAAE,KAAK,CAAC;IAClB,CAAC,SAAS,EAAE,IAAI,CAAC;IACjB,CAAC,SAAS,EAAE,UAAU,CAAC;IACvB,CAAC,SAAS,EAAE,QAAQ,CAAC;IACrB,uEAAuE;IACvE,2EAA2E;IAC3E,iEAAiE;IACjE,CAAC,SAAS,EAAE,QAAQ,CAAC;CACrB,CAAA;AAED,0EAA0E;AAC1E,MAAM,CAAC,MAAM,oBAAoB,GAAsB;IACtD,YAAY;IACZ,aAAa;IACb,SAAS;IACT,eAAe;IACf,QAAQ;IACR,WAAW;IACX,UAAU;IACV,SAAS;IACT,SAAS;IACT,UAAU;IACV,aAAa;IACb,eAAe;IACf,cAAc;IACd,QAAQ;IACR,YAAY;IACZ,WAAW;IACX,mBAAmB;IACnB,uEAAuE;IACvE,s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C,MAAM,EAAE,KAAK,IAAI,CAAC,EAAE,CAAC;YAC5E,IAAI,QAAQ,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,CAAC,QAAQ,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK,IAAI,CAAC;gBAAE,OAAO,IAAI,CAAA;QACrF,CAAC;IACF,CAAC;IACD,MAAM,IAAI,GAAG,QAAQ,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAA;IAC1C,IAAI,IAAI,KAAK,SAAS,IAAI,IAAI,KAAK,EAAE,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC;QAAE,OAAO,KAAK,CAAA;IAC5E,6EAA6E;IAC7E,OAAO,CAAC,CAAC,OAAO,IAAI,IAAI,KAAK,UAAU,CAAC,CAAA;AACzC,CAAC"}
@@ -25,11 +25,21 @@
25
25
  * No `-i`, `-e`, `-f`, no substitution, no `w`, `r`, `e`, `y` or `d`, no
26
26
  * regular-expression address: every one of those is refused.
27
27
  *
28
+ * - `gh` is read-only only as one of the named forms (`gh pr view`, `gh issue
29
+ * list`, `gh run view`, `gh search code`, ...) with the flags its table
30
+ * names. `gh api`, `--web`, `-q/--jq`, `--template`, `--hostname`, a leading
31
+ * `--repo`, `GH_HOST=` and `GH_REPO=` assignments, an extension or an alias
32
+ * are in no table, so they are refused; a repository argument naming a
33
+ * host, a URL or `user@host` is refused.
34
+ *
28
35
  * Not ported, and so never read-only here: `ps`, `lsof`, `ss`, `date`,
29
- * `man`, `xargs`, `fd`, `gh`, `docker logs|inspect`, `printf`, `[[`, `test`
30
- * and the shell builtins other than `cd`. The check of the working
31
- * directory for a planted bare repository needs the directory, which the tool
32
- * predicate does not get; the trusted-project gate is what stands in for it.
36
+ * `man`, `xargs`, `fd`, `docker logs|inspect`, `printf`, `[[`, `test`
37
+ * and the shell builtins other than `cd`.
38
+ *
39
+ * A `git` or `gh` line is not read-only when the folder it starts in, or one
40
+ * above it, holds `HEAD`, `objects/` and `refs/` outside a `.git` folder: git
41
+ * would read it as a repository and run what its `config` names. The folder is
42
+ * the session's own (`withShellSession`), or `options.directory`.
33
43
  *
34
44
  * This decides only "does not need a prompt for being a command". The path
35
45
  * floor still applies: a read-only command that reads outside the roots is
@@ -40,5 +50,7 @@ import type { ShellDialect } from '../types/tool/index.js';
40
50
  * Whether `line` only reads: every command in it is vetted and nothing in it
41
51
  * is decided at run time. False for anything this module cannot vouch for.
42
52
  */
43
- export declare function isReadOnlyCommandLine(line: string, dialect?: ShellDialect): boolean;
53
+ export declare function isReadOnlyCommandLine(line: string, dialect?: ShellDialect, options?: {
54
+ readonly directory?: string;
55
+ }): boolean;
44
56
  //# sourceMappingURL=readonly-commands.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"readonly-commands.d.ts","sourceRoot":"","sources":["../../src/authorization/readonly-commands.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAA;AA0uB1D;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,YAAqB,GAAG,OAAO,CA4C3F"}
1
+ {"version":3,"file":"readonly-commands.d.ts","sourceRoot":"","sources":["../../src/authorization/readonly-commands.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AAGH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAA;AAwxB1D;;;GAGG;AACH,wBAAgB,qBAAqB,CACpC,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE,YAAqB,EAC9B,OAAO,GAAE;IAAE,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAO,GAC3C,OAAO,CAoDT"}