@namzu/sdk 44.2.0 → 45.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 (124) hide show
  1. package/CHANGELOG.md +49 -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 +1 -1
  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 +21 -5
  13. package/dist/authorization/rules.js.map +1 -1
  14. package/dist/authorization/shell-lexer.d.ts +138 -0
  15. package/dist/authorization/shell-lexer.d.ts.map +1 -0
  16. package/dist/authorization/shell-lexer.js +2143 -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/persona/assembler.d.ts.map +1 -1
  23. package/dist/persona/assembler.js +5 -2
  24. package/dist/persona/assembler.js.map +1 -1
  25. package/dist/prompt/coding-agent-doctrine.d.ts +1 -1
  26. package/dist/prompt/coding-agent-doctrine.d.ts.map +1 -1
  27. package/dist/prompt/coding-agent-doctrine.js +1 -1
  28. package/dist/prompt/coding-agent-doctrine.js.map +1 -1
  29. package/dist/public-runtime.d.ts +1 -0
  30. package/dist/public-runtime.d.ts.map +1 -1
  31. package/dist/public-runtime.js +4 -0
  32. package/dist/public-runtime.js.map +1 -1
  33. package/dist/public-tools.d.ts.map +1 -1
  34. package/dist/public-tools.js +2 -1
  35. package/dist/public-tools.js.map +1 -1
  36. package/dist/public-types.d.ts +3 -1
  37. package/dist/public-types.d.ts.map +1 -1
  38. package/dist/runtime/jobs/registry.d.ts +2 -2
  39. package/dist/runtime/jobs/registry.d.ts.map +1 -1
  40. package/dist/runtime/jobs/registry.js +6 -2
  41. package/dist/runtime/jobs/registry.js.map +1 -1
  42. package/dist/runtime/query/executor.d.ts +34 -40
  43. package/dist/runtime/query/executor.d.ts.map +1 -1
  44. package/dist/runtime/query/executor.js +81 -51
  45. package/dist/runtime/query/executor.js.map +1 -1
  46. package/dist/runtime/query/index.d.ts.map +1 -1
  47. package/dist/runtime/query/index.js +7 -0
  48. package/dist/runtime/query/index.js.map +1 -1
  49. package/dist/runtime/query/iteration/index.d.ts.map +1 -1
  50. package/dist/runtime/query/iteration/index.js +6 -0
  51. package/dist/runtime/query/iteration/index.js.map +1 -1
  52. package/dist/runtime/query/iteration/phases/context.d.ts +7 -0
  53. package/dist/runtime/query/iteration/phases/context.d.ts.map +1 -1
  54. package/dist/runtime/query/iteration/phases/context.js.map +1 -1
  55. package/dist/runtime/query/iteration/phases/tool-review.d.ts.map +1 -1
  56. package/dist/runtime/query/iteration/phases/tool-review.js +48 -0
  57. package/dist/runtime/query/iteration/phases/tool-review.js.map +1 -1
  58. package/dist/runtime/query/review-policy.d.ts +11 -0
  59. package/dist/runtime/query/review-policy.d.ts.map +1 -1
  60. package/dist/runtime/query/review-policy.js +32 -0
  61. package/dist/runtime/query/review-policy.js.map +1 -1
  62. package/dist/runtime/query/tooling.d.ts +3 -0
  63. package/dist/runtime/query/tooling.d.ts.map +1 -1
  64. package/dist/runtime/query/tooling.js +1 -0
  65. package/dist/runtime/query/tooling.js.map +1 -1
  66. package/dist/skills/loader.d.ts +8 -0
  67. package/dist/skills/loader.d.ts.map +1 -1
  68. package/dist/skills/loader.js +7 -1
  69. package/dist/skills/loader.js.map +1 -1
  70. package/dist/tools/builtins/bash.d.ts.map +1 -1
  71. package/dist/tools/builtins/bash.js +18 -6
  72. package/dist/tools/builtins/bash.js.map +1 -1
  73. package/dist/tools/builtins/skill.d.ts +2 -9
  74. package/dist/tools/builtins/skill.d.ts.map +1 -1
  75. package/dist/tools/builtins/skill.js +59 -51
  76. package/dist/tools/builtins/skill.js.map +1 -1
  77. package/dist/tools/command-shell.d.ts +90 -0
  78. package/dist/tools/command-shell.d.ts.map +1 -0
  79. package/dist/tools/command-shell.js +129 -0
  80. package/dist/tools/command-shell.js.map +1 -0
  81. package/dist/tools/defineTool.d.ts +11 -0
  82. package/dist/tools/defineTool.d.ts.map +1 -1
  83. package/dist/tools/defineTool.js +29 -1
  84. package/dist/tools/defineTool.js.map +1 -1
  85. package/dist/types/hitl/index.d.ts +23 -0
  86. package/dist/types/hitl/index.d.ts.map +1 -1
  87. package/dist/types/hitl/index.js.map +1 -1
  88. package/dist/types/provider/stream.d.ts +10 -0
  89. package/dist/types/provider/stream.d.ts.map +1 -1
  90. package/dist/types/tool/index.d.ts +67 -5
  91. package/dist/types/tool/index.d.ts.map +1 -1
  92. package/dist/types/tool/index.js.map +1 -1
  93. package/dist/utils/frontmatter.d.ts +17 -1
  94. package/dist/utils/frontmatter.d.ts.map +1 -1
  95. package/dist/utils/frontmatter.js +32 -2
  96. package/dist/utils/frontmatter.js.map +1 -1
  97. package/package.json +1 -1
  98. package/src/authorization/command-line.ts +148 -293
  99. package/src/authorization/gate.ts +8 -0
  100. package/src/authorization/rules.ts +33 -4
  101. package/src/authorization/shell-lexer.ts +2319 -0
  102. package/src/authorization/skill-grant.ts +400 -0
  103. package/src/persona/assembler.ts +5 -2
  104. package/src/prompt/coding-agent-doctrine.ts +1 -1
  105. package/src/public-runtime.ts +9 -0
  106. package/src/public-tools.ts +2 -1
  107. package/src/public-types.ts +7 -0
  108. package/src/runtime/jobs/registry.ts +19 -11
  109. package/src/runtime/query/executor.ts +99 -55
  110. package/src/runtime/query/index.ts +7 -0
  111. package/src/runtime/query/iteration/index.ts +5 -0
  112. package/src/runtime/query/iteration/phases/context.ts +7 -0
  113. package/src/runtime/query/iteration/phases/tool-review.ts +45 -0
  114. package/src/runtime/query/review-policy.ts +53 -0
  115. package/src/runtime/query/tooling.ts +4 -0
  116. package/src/skills/loader.ts +8 -1
  117. package/src/tools/builtins/bash.ts +24 -6
  118. package/src/tools/builtins/skill.ts +74 -53
  119. package/src/tools/command-shell.ts +166 -0
  120. package/src/tools/defineTool.ts +33 -1
  121. package/src/types/hitl/index.ts +21 -0
  122. package/src/types/provider/stream.ts +10 -0
  123. package/src/types/tool/index.ts +67 -5
  124. package/src/utils/frontmatter.ts +52 -2
@@ -117,6 +117,23 @@ export type FrontmatterValue =
117
117
  | { readonly kind: 'scalar'; readonly value: string }
118
118
  | { readonly kind: 'mapping'; readonly entries: Readonly<Record<string, string>> }
119
119
 
120
+ /** What a caller lets {@link parseFrontmatter} accept beyond flat scalars. */
121
+ export interface FrontmatterOptions {
122
+ /**
123
+ * Keys that may be written as a YAML list — a block sequence (`- item`
124
+ * lines) or a flow sequence (`[a, b]`) — and come back as ONE scalar, the
125
+ * items joined with `", "`.
126
+ *
127
+ * Opt-in per key, because a list is refused everywhere else for a reason:
128
+ * a key the caller reads as a scalar would otherwise come back absent. A
129
+ * caller names a key here only when a comma-separated scalar is already
130
+ * a spelling it reads, so the joined value means what the list did.
131
+ * `allowed-tools` is the case: the Agent Skills format writes it either
132
+ * way.
133
+ */
134
+ readonly lists?: readonly string[]
135
+ }
136
+
120
137
  export interface ParsedFrontmatter {
121
138
  /**
122
139
  * Every top-level key, in the order the file declared it.
@@ -146,7 +163,12 @@ export interface ParsedFrontmatter {
146
163
  * does not implement. It never returns a partial or empty result to stand in
147
164
  * for a file it could not read.
148
165
  */
149
- export function parseFrontmatter(raw: string, source: string): ParsedFrontmatter {
166
+ export function parseFrontmatter(
167
+ raw: string,
168
+ source: string,
169
+ options: FrontmatterOptions = {},
170
+ ): ParsedFrontmatter {
171
+ const listKeys = new Set(options.lists ?? [])
150
172
  const trimmed = raw.trimStart()
151
173
 
152
174
  if (!trimmed.startsWith(FRONTMATTER_DELIMITER)) {
@@ -174,6 +196,7 @@ export function parseFrontmatter(raw: string, source: string): ParsedFrontmatter
174
196
  // round trip is safe at both ends.
175
197
  const data = new Map<string, string>()
176
198
  const blocks = new Map<string, Map<string, string>>()
199
+ const lists = new Map<string, string[]>()
177
200
  let currentKey: string | undefined
178
201
 
179
202
  for (const line of frontmatterRaw.split(LINE_SPLIT)) {
@@ -182,7 +205,8 @@ export function parseFrontmatter(raw: string, source: string): ParsedFrontmatter
182
205
  if (/^\s/.test(line)) {
183
206
  if (!currentKey) continue
184
207
 
185
- // A block sequence item. Refused, not skipped.
208
+ // A block sequence item. Read as a list when the caller named this
209
+ // key in `options.lists`; refused, not skipped, everywhere else.
186
210
  //
187
211
  // These lines carry no `:`, so the `continue` below used to drop them
188
212
  // and the key — having no scalar value and no mapping entries — came
@@ -195,6 +219,18 @@ export function parseFrontmatter(raw: string, source: string): ParsedFrontmatter
195
219
  // and silently did not get it is indistinguishable from one that never
196
220
  // asked. A capability quietly not granted is the worst thing this
197
221
  // reader can produce.
222
+ if (listKeys.has(currentKey) && !data.has(currentKey) && /^\s*-(\s|$)/.test(line)) {
223
+ const item = normalizeScalar(line.replace(/^\s*-/, ''))
224
+ if (item) {
225
+ let list = lists.get(currentKey)
226
+ if (!list) {
227
+ list = []
228
+ lists.set(currentKey, list)
229
+ }
230
+ list.push(item)
231
+ }
232
+ continue
233
+ }
198
234
  if (/^\s*-\s/.test(line)) {
199
235
  throw new Error(
200
236
  `${source}: "${currentKey}" uses a block sequence (a "- " list), which this reader does not support. Write it as a single-line value instead. Refusing rather than reading "${currentKey}" as absent, which is what silently dropping the list would mean.`,
@@ -220,6 +256,17 @@ export function parseFrontmatter(raw: string, source: string): ParsedFrontmatter
220
256
  const key = line.slice(0, colonIdx).trim()
221
257
  const value = normalizeScalar(line.slice(colonIdx + 1))
222
258
 
259
+ if (listKeys.has(key) && /^\[.*\]$/.test(value)) {
260
+ currentKey = key
261
+ const items = value
262
+ .slice(1, -1)
263
+ .split(',')
264
+ .map(normalizeScalar)
265
+ .filter((item) => item.length > 0)
266
+ // `[]` is a list the author declared empty, which is not absence.
267
+ data.set(key, items.join(', '))
268
+ continue
269
+ }
223
270
  assertReadableScalar(key, value, source)
224
271
 
225
272
  currentKey = key
@@ -230,6 +277,9 @@ export function parseFrontmatter(raw: string, source: string): ParsedFrontmatter
230
277
  // that — so refusing here is what makes the illegal state unrepresentable
231
278
  // in the returned type rather than merely undocumented. The alternative,
232
279
  // picking a precedence, would silently drop half of what the author wrote.
280
+ for (const [key, items] of lists) {
281
+ if (!data.has(key)) data.set(key, items.join(', '))
282
+ }
233
283
  for (const key of blocks.keys()) {
234
284
  if (!data.has(key)) continue
235
285
  throw new Error(