@namzu/sdk 44.3.0 → 45.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (271) hide show
  1. package/CHANGELOG.md +94 -0
  2. package/dist/authorization/command-line.d.ts +66 -19
  3. package/dist/authorization/command-line.d.ts.map +1 -1
  4. package/dist/authorization/command-line.js +130 -270
  5. package/dist/authorization/command-line.js.map +1 -1
  6. package/dist/authorization/gate.d.ts +7 -0
  7. package/dist/authorization/gate.d.ts.map +1 -1
  8. package/dist/authorization/gate.js +13 -3
  9. package/dist/authorization/gate.js.map +1 -1
  10. package/dist/authorization/rules.d.ts +10 -1
  11. package/dist/authorization/rules.d.ts.map +1 -1
  12. package/dist/authorization/rules.js +55 -8
  13. package/dist/authorization/rules.js.map +1 -1
  14. package/dist/authorization/shell-lexer.d.ts +152 -0
  15. package/dist/authorization/shell-lexer.d.ts.map +1 -0
  16. package/dist/authorization/shell-lexer.js +2156 -0
  17. package/dist/authorization/shell-lexer.js.map +1 -0
  18. package/dist/authorization/skill-grant.d.ts +182 -0
  19. package/dist/authorization/skill-grant.d.ts.map +1 -0
  20. package/dist/authorization/skill-grant.js +314 -0
  21. package/dist/authorization/skill-grant.js.map +1 -0
  22. package/dist/bridge/a2a/mapper.d.ts.map +1 -1
  23. package/dist/bridge/a2a/mapper.js +2 -0
  24. package/dist/bridge/a2a/mapper.js.map +1 -1
  25. package/dist/bridge/sse/mapper.d.ts.map +1 -1
  26. package/dist/bridge/sse/mapper.js +1 -0
  27. package/dist/bridge/sse/mapper.js.map +1 -1
  28. package/dist/directory/types.d.ts +2 -0
  29. package/dist/directory/types.d.ts.map +1 -1
  30. package/dist/directory/types.js.map +1 -1
  31. package/dist/manager/resident/outbox.d.ts +4 -4
  32. package/dist/persona/assembler.d.ts.map +1 -1
  33. package/dist/persona/assembler.js +5 -2
  34. package/dist/persona/assembler.js.map +1 -1
  35. package/dist/prompt/coding-agent-doctrine.d.ts +1 -1
  36. package/dist/prompt/coding-agent-doctrine.d.ts.map +1 -1
  37. package/dist/prompt/coding-agent-doctrine.js +1 -0
  38. package/dist/prompt/coding-agent-doctrine.js.map +1 -1
  39. package/dist/public-runtime.d.ts +5 -1
  40. package/dist/public-runtime.d.ts.map +1 -1
  41. package/dist/public-runtime.js +15 -1
  42. package/dist/public-runtime.js.map +1 -1
  43. package/dist/public-tools.d.ts +4 -0
  44. package/dist/public-tools.d.ts.map +1 -1
  45. package/dist/public-tools.js +12 -1
  46. package/dist/public-tools.js.map +1 -1
  47. package/dist/public-types.d.ts +9 -1
  48. package/dist/public-types.d.ts.map +1 -1
  49. package/dist/runtime/jobs/registry.d.ts +2 -2
  50. package/dist/runtime/jobs/registry.d.ts.map +1 -1
  51. package/dist/runtime/jobs/registry.js +6 -2
  52. package/dist/runtime/jobs/registry.js.map +1 -1
  53. package/dist/runtime/query/declined.d.ts +12 -0
  54. package/dist/runtime/query/declined.d.ts.map +1 -0
  55. package/dist/runtime/query/declined.js +12 -0
  56. package/dist/runtime/query/declined.js.map +1 -0
  57. package/dist/runtime/query/executor.d.ts +36 -40
  58. package/dist/runtime/query/executor.d.ts.map +1 -1
  59. package/dist/runtime/query/executor.js +95 -53
  60. package/dist/runtime/query/executor.js.map +1 -1
  61. package/dist/runtime/query/index.d.ts.map +1 -1
  62. package/dist/runtime/query/index.js +8 -0
  63. package/dist/runtime/query/index.js.map +1 -1
  64. package/dist/runtime/query/iteration/index.d.ts.map +1 -1
  65. package/dist/runtime/query/iteration/index.js +13 -0
  66. package/dist/runtime/query/iteration/index.js.map +1 -1
  67. package/dist/runtime/query/iteration/phases/context.d.ts +13 -0
  68. package/dist/runtime/query/iteration/phases/context.d.ts.map +1 -1
  69. package/dist/runtime/query/iteration/phases/context.js.map +1 -1
  70. package/dist/runtime/query/iteration/phases/handoff.d.ts +22 -0
  71. package/dist/runtime/query/iteration/phases/handoff.d.ts.map +1 -0
  72. package/dist/runtime/query/iteration/phases/handoff.js +65 -0
  73. package/dist/runtime/query/iteration/phases/handoff.js.map +1 -0
  74. package/dist/runtime/query/iteration/phases/index.d.ts +1 -0
  75. package/dist/runtime/query/iteration/phases/index.d.ts.map +1 -1
  76. package/dist/runtime/query/iteration/phases/index.js +1 -0
  77. package/dist/runtime/query/iteration/phases/index.js.map +1 -1
  78. package/dist/runtime/query/iteration/phases/tool-review.d.ts.map +1 -1
  79. package/dist/runtime/query/iteration/phases/tool-review.js +56 -3
  80. package/dist/runtime/query/iteration/phases/tool-review.js.map +1 -1
  81. package/dist/runtime/query/resume-pending.d.ts.map +1 -1
  82. package/dist/runtime/query/resume-pending.js +3 -2
  83. package/dist/runtime/query/resume-pending.js.map +1 -1
  84. package/dist/runtime/query/review-policy.d.ts +11 -0
  85. package/dist/runtime/query/review-policy.d.ts.map +1 -1
  86. package/dist/runtime/query/review-policy.js +36 -3
  87. package/dist/runtime/query/review-policy.js.map +1 -1
  88. package/dist/runtime/query/tooling.d.ts +3 -0
  89. package/dist/runtime/query/tooling.d.ts.map +1 -1
  90. package/dist/runtime/query/tooling.js +1 -0
  91. package/dist/runtime/query/tooling.js.map +1 -1
  92. package/dist/schedules/cron.d.ts +21 -0
  93. package/dist/schedules/cron.d.ts.map +1 -0
  94. package/dist/schedules/cron.js +167 -0
  95. package/dist/schedules/cron.js.map +1 -0
  96. package/dist/schedules/describe.d.ts +14 -0
  97. package/dist/schedules/describe.d.ts.map +1 -0
  98. package/dist/schedules/describe.js +133 -0
  99. package/dist/schedules/describe.js.map +1 -0
  100. package/dist/schedules/errors.d.ts +11 -0
  101. package/dist/schedules/errors.d.ts.map +1 -0
  102. package/dist/schedules/errors.js +15 -0
  103. package/dist/schedules/errors.js.map +1 -0
  104. package/dist/schedules/evaluate.d.ts +35 -0
  105. package/dist/schedules/evaluate.d.ts.map +1 -0
  106. package/dist/schedules/evaluate.js +158 -0
  107. package/dist/schedules/evaluate.js.map +1 -0
  108. package/dist/schedules/index.d.ts +11 -0
  109. package/dist/schedules/index.d.ts.map +1 -0
  110. package/dist/schedules/index.js +8 -0
  111. package/dist/schedules/index.js.map +1 -0
  112. package/dist/schedules/next-fire.d.ts +50 -0
  113. package/dist/schedules/next-fire.d.ts.map +1 -0
  114. package/dist/schedules/next-fire.js +250 -0
  115. package/dist/schedules/next-fire.js.map +1 -0
  116. package/dist/schedules/spec.d.ts +30 -0
  117. package/dist/schedules/spec.d.ts.map +1 -0
  118. package/dist/schedules/spec.js +169 -0
  119. package/dist/schedules/spec.js.map +1 -0
  120. package/dist/schedules/types.d.ts +144 -0
  121. package/dist/schedules/types.d.ts.map +1 -0
  122. package/dist/schedules/types.js +11 -0
  123. package/dist/schedules/types.js.map +1 -0
  124. package/dist/schedules/tz.d.ts +44 -0
  125. package/dist/schedules/tz.d.ts.map +1 -0
  126. package/dist/schedules/tz.js +141 -0
  127. package/dist/schedules/tz.js.map +1 -0
  128. package/dist/skills/index.d.ts +1 -1
  129. package/dist/skills/index.d.ts.map +1 -1
  130. package/dist/skills/index.js +1 -1
  131. package/dist/skills/index.js.map +1 -1
  132. package/dist/skills/loader.d.ts +21 -0
  133. package/dist/skills/loader.d.ts.map +1 -1
  134. package/dist/skills/loader.js +51 -1
  135. package/dist/skills/loader.js.map +1 -1
  136. package/dist/tools/builtins/bash.d.ts.map +1 -1
  137. package/dist/tools/builtins/bash.js +18 -6
  138. package/dist/tools/builtins/bash.js.map +1 -1
  139. package/dist/tools/builtins/browser-url.d.ts +83 -0
  140. package/dist/tools/builtins/browser-url.d.ts.map +1 -0
  141. package/dist/tools/builtins/browser-url.js +240 -0
  142. package/dist/tools/builtins/browser-url.js.map +1 -0
  143. package/dist/tools/builtins/browser.d.ts +367 -0
  144. package/dist/tools/builtins/browser.d.ts.map +1 -0
  145. package/dist/tools/builtins/browser.js +704 -0
  146. package/dist/tools/builtins/browser.js.map +1 -0
  147. package/dist/tools/builtins/skill.d.ts +2 -9
  148. package/dist/tools/builtins/skill.d.ts.map +1 -1
  149. package/dist/tools/builtins/skill.js +74 -51
  150. package/dist/tools/builtins/skill.js.map +1 -1
  151. package/dist/tools/command-shell.d.ts +90 -0
  152. package/dist/tools/command-shell.d.ts.map +1 -0
  153. package/dist/tools/command-shell.js +129 -0
  154. package/dist/tools/command-shell.js.map +1 -0
  155. package/dist/tools/defineTool.d.ts +13 -0
  156. package/dist/tools/defineTool.d.ts.map +1 -1
  157. package/dist/tools/defineTool.js +30 -1
  158. package/dist/tools/defineTool.js.map +1 -1
  159. package/dist/tools/schedules/index.d.ts +5 -0
  160. package/dist/tools/schedules/index.d.ts.map +1 -0
  161. package/dist/tools/schedules/index.js +4 -0
  162. package/dist/tools/schedules/index.js.map +1 -0
  163. package/dist/tools/schedules/loop-tool.d.ts +14 -0
  164. package/dist/tools/schedules/loop-tool.d.ts.map +1 -0
  165. package/dist/tools/schedules/loop-tool.js +81 -0
  166. package/dist/tools/schedules/loop-tool.js.map +1 -0
  167. package/dist/tools/schedules/present.d.ts +16 -0
  168. package/dist/tools/schedules/present.d.ts.map +1 -0
  169. package/dist/tools/schedules/present.js +69 -0
  170. package/dist/tools/schedules/present.js.map +1 -0
  171. package/dist/tools/schedules/prompt-scan.d.ts +17 -0
  172. package/dist/tools/schedules/prompt-scan.d.ts.map +1 -0
  173. package/dist/tools/schedules/prompt-scan.js +92 -0
  174. package/dist/tools/schedules/prompt-scan.js.map +1 -0
  175. package/dist/tools/schedules/schedule-tool.d.ts +16 -0
  176. package/dist/tools/schedules/schedule-tool.d.ts.map +1 -0
  177. package/dist/tools/schedules/schedule-tool.js +327 -0
  178. package/dist/tools/schedules/schedule-tool.js.map +1 -0
  179. package/dist/tools/schedules/types.d.ts +184 -0
  180. package/dist/tools/schedules/types.d.ts.map +1 -0
  181. package/dist/tools/schedules/types.js +11 -0
  182. package/dist/tools/schedules/types.js.map +1 -0
  183. package/dist/types/authorization/index.d.ts +86 -9
  184. package/dist/types/authorization/index.d.ts.map +1 -1
  185. package/dist/types/authorization/index.js +11 -1
  186. package/dist/types/authorization/index.js.map +1 -1
  187. package/dist/types/browser/index.d.ts +280 -0
  188. package/dist/types/browser/index.d.ts.map +1 -0
  189. package/dist/types/browser/index.js +12 -0
  190. package/dist/types/browser/index.js.map +1 -0
  191. package/dist/types/hitl/index.d.ts +23 -0
  192. package/dist/types/hitl/index.d.ts.map +1 -1
  193. package/dist/types/hitl/index.js.map +1 -1
  194. package/dist/types/session/events.d.ts +6 -0
  195. package/dist/types/session/events.d.ts.map +1 -1
  196. package/dist/types/session/events.js.map +1 -1
  197. package/dist/types/session/records.d.ts +23 -0
  198. package/dist/types/session/records.d.ts.map +1 -1
  199. package/dist/types/session/records.js +9 -0
  200. package/dist/types/session/records.js.map +1 -1
  201. package/dist/types/tool/index.d.ts +108 -5
  202. package/dist/types/tool/index.d.ts.map +1 -1
  203. package/dist/types/tool/index.js.map +1 -1
  204. package/dist/types/tool/presentation.d.ts +7 -0
  205. package/dist/types/tool/presentation.d.ts.map +1 -1
  206. package/dist/utils/frontmatter.d.ts +35 -3
  207. package/dist/utils/frontmatter.d.ts.map +1 -1
  208. package/dist/utils/frontmatter.js +45 -5
  209. package/dist/utils/frontmatter.js.map +1 -1
  210. package/dist/utils/id.d.ts +8 -0
  211. package/dist/utils/id.d.ts.map +1 -1
  212. package/dist/utils/id.js +12 -0
  213. package/dist/utils/id.js.map +1 -1
  214. package/package.json +1 -1
  215. package/src/authorization/command-line.ts +148 -293
  216. package/src/authorization/gate.ts +22 -2
  217. package/src/authorization/rules.ts +67 -8
  218. package/src/authorization/shell-lexer.ts +2349 -0
  219. package/src/authorization/skill-grant.ts +400 -0
  220. package/src/bridge/a2a/mapper.ts +2 -0
  221. package/src/bridge/sse/mapper.ts +1 -0
  222. package/src/directory/types.ts +2 -0
  223. package/src/persona/assembler.ts +5 -2
  224. package/src/prompt/coding-agent-doctrine.ts +1 -0
  225. package/src/public-runtime.ts +37 -0
  226. package/src/public-tools.ts +37 -1
  227. package/src/public-types.ts +57 -0
  228. package/src/runtime/jobs/registry.ts +19 -11
  229. package/src/runtime/query/declined.ts +12 -0
  230. package/src/runtime/query/executor.ts +116 -56
  231. package/src/runtime/query/index.ts +8 -0
  232. package/src/runtime/query/iteration/index.ts +13 -0
  233. package/src/runtime/query/iteration/phases/context.ts +13 -0
  234. package/src/runtime/query/iteration/phases/handoff.ts +74 -0
  235. package/src/runtime/query/iteration/phases/index.ts +1 -0
  236. package/src/runtime/query/iteration/phases/tool-review.ts +55 -3
  237. package/src/runtime/query/resume-pending.ts +3 -2
  238. package/src/runtime/query/review-policy.ts +57 -3
  239. package/src/runtime/query/tooling.ts +4 -0
  240. package/src/schedules/cron.ts +202 -0
  241. package/src/schedules/describe.ts +138 -0
  242. package/src/schedules/errors.ts +15 -0
  243. package/src/schedules/evaluate.ts +178 -0
  244. package/src/schedules/index.ts +18 -0
  245. package/src/schedules/next-fire.ts +257 -0
  246. package/src/schedules/spec.ts +210 -0
  247. package/src/schedules/types.ts +163 -0
  248. package/src/schedules/tz.ts +155 -0
  249. package/src/skills/index.ts +1 -1
  250. package/src/skills/loader.ts +59 -1
  251. package/src/tools/builtins/bash.ts +24 -6
  252. package/src/tools/builtins/browser-url.ts +251 -0
  253. package/src/tools/builtins/browser.ts +817 -0
  254. package/src/tools/builtins/skill.ts +92 -53
  255. package/src/tools/command-shell.ts +166 -0
  256. package/src/tools/defineTool.ts +36 -1
  257. package/src/tools/schedules/index.ts +4 -0
  258. package/src/tools/schedules/loop-tool.ts +85 -0
  259. package/src/tools/schedules/present.ts +86 -0
  260. package/src/tools/schedules/prompt-scan.ts +96 -0
  261. package/src/tools/schedules/schedule-tool.ts +376 -0
  262. package/src/tools/schedules/types.ts +197 -0
  263. package/src/types/authorization/index.ts +60 -2
  264. package/src/types/browser/index.ts +341 -0
  265. package/src/types/hitl/index.ts +21 -0
  266. package/src/types/session/events.ts +6 -0
  267. package/src/types/session/records.ts +10 -0
  268. package/src/types/tool/index.ts +109 -5
  269. package/src/types/tool/presentation.ts +7 -0
  270. package/src/utils/frontmatter.ts +81 -5
  271. package/src/utils/id.ts +14 -0
@@ -32,8 +32,9 @@
32
32
  * caller must read the two decisions differently, and {@link evaluateRule}
33
33
  * does:
34
34
  *
35
- * - **deny** matches when ANY segment matches. One prohibited command poisons
36
- * the line it rides on.
35
+ * - **deny** matches when ANY segment matches, or when any command's decoded
36
+ * words ({@link decodedCommands}) do. One prohibited command poisons the
37
+ * line it rides on, however it is quoted.
37
38
  * - **allow** matches only when EVERY segment matches, and never when the line
38
39
  * is {@link CommandLineDecomposition.opaque}. Permission is a claim about the
39
40
  * whole line, and a claim that cannot be checked is not granted.
@@ -41,307 +42,166 @@
41
42
  * That asymmetry is the same one `refuse-do-not-degrade` describes: when the
42
43
  * analysis is uncertain, the uncertainty spends against the permissive answer.
43
44
  *
45
+ * ## Where the commands come from
46
+ *
47
+ * One lexer, {@link lexShellCommandLine}, reads the line the way bash does and
48
+ * is the only thing in the SDK that knows bash's quoting. This module and
49
+ * {@link writesThroughRedirection} are views of its result. There used to be
50
+ * three hand-written walkers here, each with its own idea of where a quote
51
+ * ends, and every disagreement between them was a way to run a command the
52
+ * rules never saw.
53
+ *
44
54
  * ## What `opaque` means
45
55
  *
46
56
  * Some lines contain text that is not the command that runs. Command
47
57
  * substitution (`$(…)`, backticks, `<(…)`) executes something whose text is
48
- * not in the line at all, and `eval` runs a string assembled at runtime. No
49
- * decomposition of the source can be a decomposition of what ran, so the line
50
- * is marked opaque and `allow` declines it. `deny` still tests what is visible,
51
- * because a deny that matches too much costs a prompt and a deny that matches
52
- * too little costs the thing it was written to prevent.
58
+ * not in the line at all, and `eval` or `source` runs a string assembled at
59
+ * runtime. The lexer also reports a line opaque when it does not parse, or
60
+ * contains a construct it does not model. No decomposition of the source can
61
+ * be a decomposition of what ran, so `allow` declines it. `deny` still tests
62
+ * what is visible, because a deny that matches too much costs a prompt and a
63
+ * deny that matches too little costs the thing it was written to prevent.
53
64
  *
54
65
  * ## What it deliberately does not do
55
66
  *
56
- * A value with no chain operator, no nested shell and nothing opaque comes back
57
- * as itself, byte for byte. That keeps every rule about a non-command argument
58
- * — a path, a number, a URL — behaving exactly as it did, and confines this
59
- * machinery to the case that motivated it.
67
+ * A value that is one plain command comes back as itself, byte for byte. That
68
+ * keeps every rule about a non-command argument — a path, a number, a URL —
69
+ * behaving exactly as it did, and confines this machinery to the case that
70
+ * motivated it.
60
71
  *
61
- * It is a decomposition, not a shell. `xargs sh -c`, a command read from a
62
- * file, and a shell invoked through an interpreter it does not recognise all
63
- * pass through as ordinary text. Each of those either denies as before or, for
64
- * an allow rule, fails to match every segment and so declines. The failure mode
65
- * is a prompt, never a silent grant.
72
+ * It is a decomposition, not a shell. `xargs sh -c`, `env git push`, a command
73
+ * read from a file, and a shell invoked through an interpreter it does not
74
+ * recognise all pass through as ordinary text. Each of those either denies as
75
+ * before or, for an allow rule, fails to match every segment and so declines.
76
+ * The failure mode is a prompt, never a silent grant.
66
77
  */
67
- /**
68
- * Shells whose `-c` argument is another command line.
69
- *
70
- * Matched on the basename, so `/bin/bash` and `bash` are the same entry. An
71
- * interpreter absent from this list is not a hole that grants anything: its
72
- * payload stays inside one segment, where an allow rule fails to match it.
73
- */
74
- const NESTED_SHELLS = new Set(['sh', 'bash', 'zsh', 'dash', 'ksh', 'ash', 'busybox']);
78
+ import { basename, lexShellCommandLine, } from './shell-lexer.js';
75
79
  /** Commands whose argument is code assembled at runtime. */
76
80
  const RUNTIME_EVALUATORS = new Set(['eval', 'source', '.']);
77
81
  /**
78
- * Depth and width limits.
79
- *
80
- * A line that exceeds either is reported opaque rather than truncated: a
82
+ * Width limit. A line past it is reported opaque rather than truncated: a
81
83
  * shortened list of segments would read as complete to `allow`, which is the
82
84
  * one reading that must never be wrong.
83
85
  */
84
- const MAX_DEPTH = 4;
85
86
  const MAX_SEGMENTS = 64;
86
- export function decomposeCommandLine(command) {
87
- const state = { opaque: false, structured: false };
88
- const segments = split(command, state, 0);
89
- // The untouched-value case, kept exact. Nothing was cut and nothing was
90
- // unpacked, so there is no decomposition to report and the value goes back
91
- // as it arrived — which is what keeps a rule about a path or a URL seeing
92
- // the string it always saw, punctuation and surrounding space included.
93
- if (!state.structured)
94
- return { segments: [command], opaque: state.opaque };
95
- if (segments.length === 0)
96
- return { segments: [command], opaque: state.opaque };
97
- if (segments.length > MAX_SEGMENTS) {
98
- return { segments: segments.slice(0, MAX_SEGMENTS), opaque: true };
87
+ /**
88
+ * `dialect` is the shell that will run the line (see `ShellDialect`); a
89
+ * caller that does not know passes `sh`, whose reading holds for any POSIX
90
+ * shell.
91
+ */
92
+ export function decomposeCommandLine(command, dialect = 'bash') {
93
+ const lexed = lex(command, dialect);
94
+ let opaque = lexed.opaque;
95
+ for (const each of lexed.commands) {
96
+ const head = each.words[each.assignments];
97
+ if (head !== undefined && !head.expands && RUNTIME_EVALUATORS.has(basename(head.value))) {
98
+ // The argument is source text assembled elsewhere. Even when it is a
99
+ // visible literal, what runs is decided at runtime.
100
+ opaque = true;
101
+ }
99
102
  }
100
- return { segments, opaque: state.opaque };
103
+ // A line that does not parse runs none of the text from its error on, and
104
+ // what it ran before that is in `decodedCommands` for deny. The value goes
105
+ // back untouched, the way a path or a URL that is not shell at all does.
106
+ if (!lexed.complete || lexed.commands.length === 0)
107
+ return { segments: [command], opaque };
108
+ // The untouched-value case, kept exact: one command whose text is the
109
+ // whole line. Nothing was cut and nothing was unpacked, so the value goes
110
+ // back as it arrived — which is what keeps a rule about a path or a URL
111
+ // seeing the string it always saw, surrounding space included.
112
+ const only = lexed.commands[0];
113
+ if (lexed.commands.length === 1 &&
114
+ only !== undefined &&
115
+ only.origin === 'line' &&
116
+ only.text === command.trim()) {
117
+ return { segments: [command], opaque };
118
+ }
119
+ const segments = lexed.commands.map((each) => each.text);
120
+ if (segments.length > MAX_SEGMENTS)
121
+ return { segments: segments.slice(0, MAX_SEGMENTS), opaque: true };
122
+ return { segments, opaque };
101
123
  }
102
124
  /**
103
- * Walk the line once, quote-aware, cutting at every top-level separator.
104
- *
105
- * Quote tracking is the whole reason this is not a `String.split`: `echo "a &&
106
- * b"` is one command that prints a literal, and a splitter that cannot tell
107
- * would report a second command named `b"` — inventing a segment is as wrong as
108
- * missing one, because `allow` requires every segment to match.
125
+ * Each command's words as bash passes them (quotes removed, `$'…'` decoded),
126
+ * joined by single spaces — and, for a command led by assignments, the same
127
+ * without them. For `deny` only.
128
+ *
129
+ * A deny rule written as `^git push` must not be evaded by `'git' push`,
130
+ * `g\it push`, `$'git' push` or `GIT_DIR=x git push`: the source text of each
131
+ * differs from the pattern and the command that runs does not. `allow` does
132
+ * not use these. Its subject stays the source text, so a pattern that names
133
+ * quotes keeps meaning what its author wrote, and a decoded form can only ever
134
+ * add a match — which for `deny` is the safe direction and for `allow` is not.
109
135
  */
110
- function split(command, state, depth) {
111
- const segments = [];
112
- let current = '';
113
- let quote = null;
114
- const cut = () => {
115
- const trimmed = trimSegment(current);
116
- current = '';
117
- if (trimmed === '')
118
- return;
119
- for (const piece of expand(trimmed, state, depth))
120
- segments.push(piece);
121
- };
122
- for (let i = 0; i < command.length; i += 1) {
123
- const char = command[i];
124
- if (quote === "'") {
125
- // Single quotes suspend everything, including the backslash. This is
126
- // the branch that keeps `echo 'a && b'` one command.
127
- if (char === "'")
128
- quote = null;
129
- current += char;
136
+ export function decodedCommands(command, dialect = 'bash') {
137
+ const out = [];
138
+ for (const each of lex(command, dialect).commands) {
139
+ if (each.words.length === 0)
130
140
  continue;
141
+ out.push(each.words.map((word) => word.value).join(' '));
142
+ if (each.assignments > 0 && each.words.length > each.assignments) {
143
+ out.push(each.words
144
+ .slice(each.assignments)
145
+ .map((word) => word.value)
146
+ .join(' '));
131
147
  }
132
- if (char === '\\') {
133
- // An escaped separator is a literal, so both characters go through
134
- // untouched and the next loop never sees the separator as one.
135
- current += char + (command[i + 1] ?? '');
136
- i += 1;
137
- continue;
138
- }
139
- if (quote === '"') {
140
- if (char === '"')
141
- quote = null;
142
- // Substitution is live inside double quotes, which is exactly where
143
- // it hides best.
144
- else if (isSubstitutionStart(command, i))
145
- state.opaque = true;
146
- current += char;
147
- continue;
148
- }
149
- if (char === "'" || char === '"') {
150
- quote = char;
151
- current += char;
152
- continue;
153
- }
154
- if (isSubstitutionStart(command, i)) {
155
- state.opaque = true;
156
- current += char;
157
- continue;
158
- }
159
- const separator = separatorAt(command, i);
160
- if (separator > 0) {
161
- state.structured = true;
162
- cut();
163
- i += separator - 1;
164
- continue;
165
- }
166
- current += char;
167
148
  }
168
- // An unterminated quote means the line does not parse. Whatever it runs is
169
- // not what this walk saw, so the caller must not treat the result as a
170
- // complete account.
171
- if (quote !== null)
172
- state.opaque = true;
173
- cut();
174
- return segments;
149
+ return out;
175
150
  }
176
151
  /**
177
- * Length of the separator starting at `index`, or 0.
178
- *
179
- * The redirection cases are why this is a function. `2>&1` and `&>log` contain
180
- * `&` and are not separators; splitting there would manufacture a segment named
181
- * `1`, which no allow rule matches, and a command that redirects its output
182
- * would stop being approvable for a reason nobody could see.
152
+ * Whether a command line sends output into a file through a shell redirection.
153
+ *
154
+ * A permission pattern names commands. `>`, `>>`, `>|`, `&>`, `&>>`, `<>` and
155
+ * `>&word` open a file for writing whose path is not the command's argument,
156
+ * so a pattern that covers `git status *` would otherwise also cover
157
+ * `git status > ~/.bashrc`. Callers that grant on a pattern's say-so decline
158
+ * such a line.
159
+ *
160
+ * Not writes: a target of `/dev/null`, descriptor duplication and closing
161
+ * (`2>&1`, `>&2`, `>&-`), and anything quoted or escaped so that it is not an
162
+ * operator. Anything whose target is not known before the line runs — a
163
+ * target built from a variable, a glob or a tilde — counts as a write, and so
164
+ * does a line that does not parse or holds a process substitution: the
165
+ * uncertainty spends against the grant.
183
166
  */
184
- function separatorAt(command, index) {
185
- const char = command[index];
186
- const next = command[index + 1];
187
- if (char === '\n')
188
- return 1;
189
- if (char === ';')
190
- return next === ';' ? 2 : 1;
191
- if (char === '&') {
192
- if (next === '&')
193
- return 2;
194
- if (next === '>')
195
- return 0;
196
- if (command[index - 1] === '>')
197
- return 0;
198
- return 1;
199
- }
200
- if (char === '|') {
201
- if (next === '|')
202
- return 2;
203
- // `|&` pipes stderr as well; still a pipe, and both sides still run.
204
- if (next === '&')
205
- return 2;
206
- return 1;
207
- }
208
- return 0;
209
- }
210
- /** Whether a command substitution opens here. */
211
- function isSubstitutionStart(command, index) {
212
- const char = command[index];
213
- if (char === '`')
167
+ export function writesThroughRedirection(command, dialect = 'bash') {
168
+ const lexed = lex(command, dialect);
169
+ if (!lexed.complete)
214
170
  return true;
215
- if (char === '$' && command[index + 1] === '(')
171
+ if (lexed.reasons.includes('process substitution'))
216
172
  return true;
217
- // Process substitution: `diff <(a) <(b)` runs `a` and `b`.
218
- if ((char === '<' || char === '>') && command[index + 1] === '(')
219
- return true;
220
- return false;
221
- }
222
- /**
223
- * Strip the grouping punctuation a split leaves behind.
224
- *
225
- * `(cd build && make)` cuts into `(cd build` and `make)`. Leaving the bracket on
226
- * would stop an allow rule matching a command it names, and — worse — stop a
227
- * deny rule matching one, since `^make` does not match `make)`.
228
- */
229
- function trimSegment(segment) {
230
- return segment
231
- .trim()
232
- .replace(/^[({\s]+/, '')
233
- .replace(/[)}\s]+$/, '');
173
+ return lexed.redirections.some(writes);
234
174
  }
235
- /**
236
- * Turn one segment into the commands it stands for.
237
- *
238
- * A shell invoked with `-c` carries a whole second command line in an argument,
239
- * and that argument is where the smuggling this module exists for is easiest:
240
- * `bash -c "git push"` contains no separator at all, so nothing above this
241
- * function would have looked inside it.
242
- *
243
- * The outer segment is kept alongside the inner ones. A rule that denies the
244
- * interpreter itself must still fire, and for `allow` the extra segment only
245
- * makes the requirement stricter — which is the safe direction.
246
- */
247
- function expand(segment, state, depth) {
248
- const words = tokenize(segment);
249
- const head = words[0];
250
- if (head === undefined)
251
- return [segment];
252
- if (RUNTIME_EVALUATORS.has(basename(head.text))) {
253
- // The argument is source text assembled elsewhere. Even when it is a
254
- // visible literal, what runs is decided at runtime.
255
- state.opaque = true;
256
- return [segment];
257
- }
258
- if (!NESTED_SHELLS.has(basename(head.text)))
259
- return [segment];
260
- const flag = words.findIndex((word, index) => index > 0 && word.quoted === null && word.text === '-c');
261
- if (flag < 0)
262
- return [segment];
263
- const payload = words[flag + 1];
264
- if (payload === undefined) {
265
- // `bash -c` with nothing after it is either a syntax error or an
266
- // argument this tokenizer failed to read. Neither may be reported as
267
- // "there is no nested command".
268
- state.opaque = true;
269
- return [segment];
270
- }
271
- if (depth + 1 >= MAX_DEPTH) {
272
- state.opaque = true;
273
- return [segment];
175
+ function writes(redirection) {
176
+ const { operator, target } = redirection;
177
+ switch (operator) {
178
+ case '<':
179
+ case '<&':
180
+ case '<<':
181
+ case '<<-':
182
+ case '<<<':
183
+ return false;
184
+ case '>&':
185
+ // `>&N`, `>&N-`, `>&-` duplicate or close a descriptor. `>&word`
186
+ // with any other word redirects both streams into that file.
187
+ if (!target.expands && /^(?:\d+-?|-)$/.test(target.value))
188
+ return false;
189
+ return target.expands || target.value !== '/dev/null';
190
+ default:
191
+ return target.expands || target.value !== '/dev/null';
274
192
  }
275
- const nested = split(payload.text, state, depth + 1);
276
- if (nested.length === 0)
277
- return [segment];
278
- state.structured = true;
279
- return [segment, ...nested];
280
193
  }
281
194
  /**
282
- * Split a segment into words, removing one layer of quoting.
283
- *
284
- * The quote is reported rather than discarded because `-c` must be the flag and
285
- * not a literal: `echo "-c"` names no nested shell, and treating its next word
286
- * as a command line would decompose a string that never runs.
195
+ * One gate evaluation tests the same line against every rule, and each rule
196
+ * asks for it again. The last line lexed is kept so that is one lexing.
287
197
  */
288
- function tokenize(segment) {
289
- const words = [];
290
- let current = '';
291
- let quote = null;
292
- let sawQuote = null;
293
- let open = false;
294
- const push = () => {
295
- if (open)
296
- words.push({ text: current, quoted: sawQuote });
297
- current = '';
298
- sawQuote = null;
299
- open = false;
300
- };
301
- for (let i = 0; i < segment.length; i += 1) {
302
- const char = segment[i];
303
- if (quote === "'") {
304
- // Single quotes suspend the backslash too, so this branch precedes
305
- // the escape below rather than sharing it.
306
- if (char === "'")
307
- quote = null;
308
- else
309
- current += char;
310
- open = true;
311
- continue;
312
- }
313
- if (char === '\\' && i + 1 < segment.length) {
314
- current += segment[i + 1];
315
- i += 1;
316
- open = true;
317
- continue;
318
- }
319
- if (quote === '"') {
320
- if (char === '"')
321
- quote = null;
322
- else
323
- current += char;
324
- open = true;
325
- continue;
326
- }
327
- if (char === "'" || char === '"') {
328
- quote = char;
329
- sawQuote = char;
330
- open = true;
331
- continue;
332
- }
333
- if (char === ' ' || char === '\t') {
334
- push();
335
- continue;
336
- }
337
- current += char;
338
- open = true;
198
+ let cached;
199
+ function lex(command, dialect) {
200
+ if (cached !== undefined && cached.command === command && cached.dialect === dialect) {
201
+ return cached.result;
339
202
  }
340
- push();
341
- return words;
342
- }
343
- function basename(word) {
344
- const cut = word.lastIndexOf('/');
345
- return cut < 0 ? word : word.slice(cut + 1);
203
+ const result = lexShellCommandLine(command, { dialect });
204
+ cached = { command, dialect, result };
205
+ return result;
346
206
  }
347
207
  //# sourceMappingURL=command-line.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"command-line.js","sourceRoot":"","sources":["../../src/authorization/command-line.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiEG;AAgBH;;;;;;GAMG;AACH,MAAM,aAAa,GAAG,IAAI,GAAG,CAAC,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC,CAAA;AAErF,4DAA4D;AAC5D,MAAM,kBAAkB,GAAG,IAAI,GAAG,CAAC,CAAC,MAAM,EAAE,QAAQ,EAAE,GAAG,CAAC,CAAC,CAAA;AAE3D;;;;;;GAMG;AACH,MAAM,SAAS,GAAG,CAAC,CAAA;AACnB,MAAM,YAAY,GAAG,EAAE,CAAA;AAEvB,MAAM,UAAU,oBAAoB,CAAC,OAAe;IACnD,MAAM,KAAK,GAAc,EAAE,MAAM,EAAE,K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AAK,IAAI,CAAC;QACV,KAAK,IAAI,CAAC;QACV,KAAK,KAAK,CAAC;QACX,KAAK,KAAK;YACT,OAAO,KAAK,CAAA;QACb,KAAK,IAAI;YACR,iEAAiE;YACjE,6DAA6D;YAC7D,IAAI,CAAC,MAAM,CAAC,OAAO,IAAI,eAAe,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC;gBAAE,OAAO,KAAK,CAAA;YACvE,OAAO,MAAM,CAAC,OAAO,IAAI,MAAM,CAAC,KAAK,KAAK,WAAW,CAAA;QACtD;YACC,OAAO,MAAM,CAAC,OAAO,IAAI,MAAM,CAAC,KAAK,KAAK,WAAW,CAAA;IACvD,CAAC;AACF,CAAC;AAED;;;GAGG;AACH,IAAI,MAEQ,CAAA;AAEZ,SAAS,GAAG,CAAC,OAAe,EAAE,OAAqB;IAClD,IAAI,MAAM,KAAK,SAAS,IAAI,MAAM,CAAC,OAAO,KAAK,OAAO,IAAI,MAAM,CAAC,OAAO,KAAK,OAAO,EAAE,CAAC;QACtF,OAAO,MAAM,CAAC,MAAM,CAAA;IACrB,CAAC;IACD,MAAM,MAAM,GAAG,mBAAmB,CAAC,OAAO,EAAE,EAAE,OAAO,EAAE,CAAC,CAAA;IACxD,MAAM,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,CAAA;IACrC,OAAO,MAAM,CAAA;AACd,CAAC"}
@@ -1,10 +1,17 @@
1
1
  import type { AuthorizationGateConfig, AuthorizationRule, GateEvaluationResult } from '../types/authorization/index.js';
2
2
  import type { ToolDefinition } from '../types/tool/index.js';
3
3
  import type { Logger } from '../utils/logger.js';
4
+ import type { ShellDialect } from './shell-lexer.js';
4
5
  export interface ToolCallContext {
5
6
  readonly toolName: string;
6
7
  readonly toolInput: unknown;
7
8
  readonly toolDef: ToolDefinition | undefined;
9
+ /**
10
+ * The shell this call's command line will run in, when the caller knows
11
+ * (`ToolDefinition.commandDialect`). Absent, a command line is read in the
12
+ * `sh` dialect, which holds whichever shell runs it.
13
+ */
14
+ readonly commandDialect?: ShellDialect;
8
15
  }
9
16
  /**
10
17
  * What the rule actually said, in words a model can act on.
@@ -1 +1 @@
1
- {"version":3,"file":"gate.d.ts","sourceRoot":"","sources":["../../src/authorization/gate.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACX,uBAAuB,EACvB,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,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;CAC5C;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,iBAAiB,GAAG,MAAM,CAgC5D;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;IAiHxD,QAAQ,CAAC,GAAG,EAAE,eAAe,GAAG,oBAAoB;CAwDpD"}
1
+ {"version":3,"file":"gate.d.ts","sourceRoot":"","sources":["../../src/authorization/gate.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACX,uBAAuB,EACvB,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;AAEhD,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;CACtC;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,iBAAiB,GAAG,MAAM,CA4C5D;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;IAiHxD,QAAQ,CAAC,GAAG,EAAE,eAAe,GAAG,oBAAoB;CAyDpD"}
@@ -36,14 +36,24 @@ export function describeRule(rule) {
36
36
  // Names the argument, not just the pattern. That is what tells a
37
37
  // model whether a different value could get through — which is the
38
38
  // difference between rewording once and rewording forever.
39
- const verb = rule.decision === 'deny' ? 'denied' : 'allowed';
39
+ const verb = rule.decision === 'deny'
40
+ ? 'denied'
41
+ : rule.decision === 'review'
42
+ ? 'sent for review'
43
+ : 'allowed';
40
44
  return `${verb} because the \`${rule.argument}\` argument matched ${rule.pattern} (this rule applies to ${rule.toolNames.join(', ')})`;
41
45
  }
42
46
  case 'custom_pattern': {
43
47
  const where = rule.target === 'both' ? 'name or arguments' : rule.target;
44
- const verb = rule.decision === 'deny' ? 'denied' : 'allowed';
48
+ const verb = rule.decision === 'deny'
49
+ ? 'denied'
50
+ : rule.decision === 'review'
51
+ ? 'sent for review'
52
+ : 'allowed';
45
53
  return `${verb} by a pattern rule matching the ${where}: ${rule.pattern}`;
46
54
  }
55
+ case 'predicate':
56
+ return rule.description;
47
57
  default: {
48
58
  const exhaustive = rule;
49
59
  return `matched an unrecognised rule: ${JSON.stringify(exhaustive)}`;
@@ -175,7 +185,7 @@ export class AuthorizationGate {
175
185
  const rule = this.rules[i];
176
186
  if (!rule)
177
187
  continue;
178
- const decision = evaluateRule(rule, ctx.toolName, ctx.toolInput, ctx.toolDef, this.compiledPatterns.get(i), this.nameSets.get(i));
188
+ const decision = evaluateRule(rule, ctx.toolName, ctx.toolInput, ctx.toolDef, this.compiledPatterns.get(i), this.nameSets.get(i), ctx.commandDialect !== undefined ? { commandDialect: ctx.commandDialect } : {});
179
189
  if (decision !== null) {
180
190
  const result = {
181
191
  decision,
@@ -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;AAMvD,OAAO,EAAE,6BAA6B,EAAE,MAAM,iCAAiC,CAAA;AAE/E,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAEvD,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAQzC;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,YAAY,CAAC,IAAuB;IACnD,QAAQ,IAAI,CAAC,IAAI,EAAE,CAAC;QACnB,KAAK,yBAAyB;YAC7B,OAAO,kFAAkF,CAAA;QAC1F,KAAK,iBAAiB;YACrB,OAAO,yCAAyC,CAAA;QACjD,KAAK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;oBACjB,MAAM,EAAE,YAAY,CAAC,IAAI,CAAC;iBAC1B,CAAA;gBAED,IAAI,IAAI,CAAC,YAAY,EAAE,CAAC;oBACvB,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,eAAe,EAAE;wBAC/B,CAAC,KAAK,CAAC,SAAS,CAAC,EAAE,GAAG,CAAC,QAAQ;wBAC/B,8BAA8B,EAAE,QAAQ;wBACxC,+BAA+B,EAAE,IAAI,CAAC,IAAI;wBAC1C,gCAAgC,EAAE,CAAC;qBACnC,CAAC,CAAA;gBACH,CAAC;gBAED,OAAO,MAAM,CAAA;YACd,CAAC;QACF,CAAC;QAED,MAAM,MAAM,GAAyB;YACpC,QAAQ,EAAE,QAAQ;YAClB,WAAW,EAAE,IAAI;YACjB,MAAM,EAAE,wBAAwB;SAChC,CAAA;QAED,IAAI,IAAI,CAAC,YAAY,EAAE,CAAC;YACvB,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,yBAAyB,EAAE;gBACzC,CAAC,KAAK,CAAC,SAAS,CAAC,EAAE,GAAG,CAAC,QAAQ;gBAC/B,8BAA8B,EAAE,QAAQ;aACxC,CAAC,CAAA;QACH,CAAC;QAED,OAAO,MAAM,CAAA;IACd,CAAC;CACD"}
@@ -1,4 +1,13 @@
1
1
  import type { AuthorizationRule, GateDecision } from '../types/authorization/index.js';
2
2
  import type { ToolDefinition } from '../types/tool/index.js';
3
- export declare function evaluateRule(rule: AuthorizationRule, toolName: string, toolInput: unknown, toolDef: ToolDefinition | undefined, compiledPattern?: RegExp, nameSet?: Set<string>): GateDecision | null;
3
+ import type { ShellDialect } from './shell-lexer.js';
4
+ export interface EvaluateRuleOptions {
5
+ /**
6
+ * The shell the tool will run a command-line argument in. Default `sh`:
7
+ * every construct bash and a POSIX shell read differently makes the line
8
+ * opaque. `ToolDefinition.commandDialect` supplies it for a tool.
9
+ */
10
+ readonly commandDialect?: ShellDialect;
11
+ }
12
+ export declare function evaluateRule(rule: AuthorizationRule, toolName: string, toolInput: unknown, toolDef: ToolDefinition | undefined, compiledPattern?: RegExp, nameSet?: Set<string>, options?: EvaluateRuleOptions): GateDecision | null;
4
13
  //# sourceMappingURL=rules.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"rules.d.ts","sourceRoot":"","sources":["../../src/authorization/rules.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAA;AACtF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAA;AAG5D,wBAAgB,YAAY,CAC3B,IAAI,EAAE,iBAAiB,EACvB,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,OAAO,EAClB,OAAO,EAAE,cAAc,GAAG,SAAS,EACnC,eAAe,CAAC,EAAE,MAAM,EACxB,OAAO,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,GACnB,YAAY,GAAG,IAAI,CAkIrB"}
1
+ {"version":3,"file":"rules.d.ts","sourceRoot":"","sources":["../../src/authorization/rules.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAA;AACtF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAA;AAE5D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAEpD,MAAM,WAAW,mBAAmB;IACnC;;;;OAIG;IACH,QAAQ,CAAC,cAAc,CAAC,EAAE,YAAY,CAAA;CACtC;AAED,wBAAgB,YAAY,CAC3B,IAAI,EAAE,iBAAiB,EACvB,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,OAAO,EAClB,OAAO,EAAE,cAAc,GAAG,SAAS,EACnC,eAAe,CAAC,EAAE,MAAM,EACxB,OAAO,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,EACrB,OAAO,GAAE,mBAAwB,GAC/B,YAAY,GAAG,IAAI,CAkLrB"}