@namzu/sdk 45.0.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 (230) hide show
  1. package/CHANGELOG.md +55 -0
  2. package/dist/authorization/gate.d.ts.map +1 -1
  3. package/dist/authorization/gate.js +12 -2
  4. package/dist/authorization/gate.js.map +1 -1
  5. package/dist/authorization/rules.d.ts.map +1 -1
  6. package/dist/authorization/rules.js +37 -6
  7. package/dist/authorization/rules.js.map +1 -1
  8. package/dist/authorization/shell-lexer.d.ts +14 -0
  9. package/dist/authorization/shell-lexer.d.ts.map +1 -1
  10. package/dist/authorization/shell-lexer.js +19 -6
  11. package/dist/authorization/shell-lexer.js.map +1 -1
  12. package/dist/bridge/a2a/mapper.d.ts.map +1 -1
  13. package/dist/bridge/a2a/mapper.js +2 -0
  14. package/dist/bridge/a2a/mapper.js.map +1 -1
  15. package/dist/bridge/sse/mapper.d.ts.map +1 -1
  16. package/dist/bridge/sse/mapper.js +1 -0
  17. package/dist/bridge/sse/mapper.js.map +1 -1
  18. package/dist/directory/types.d.ts +2 -0
  19. package/dist/directory/types.d.ts.map +1 -1
  20. package/dist/directory/types.js.map +1 -1
  21. package/dist/manager/resident/outbox.d.ts +4 -4
  22. package/dist/prompt/coding-agent-doctrine.d.ts +1 -1
  23. package/dist/prompt/coding-agent-doctrine.d.ts.map +1 -1
  24. package/dist/prompt/coding-agent-doctrine.js +1 -0
  25. package/dist/prompt/coding-agent-doctrine.js.map +1 -1
  26. package/dist/public-runtime.d.ts +4 -1
  27. package/dist/public-runtime.d.ts.map +1 -1
  28. package/dist/public-runtime.js +11 -1
  29. package/dist/public-runtime.js.map +1 -1
  30. package/dist/public-tools.d.ts +4 -0
  31. package/dist/public-tools.d.ts.map +1 -1
  32. package/dist/public-tools.js +10 -0
  33. package/dist/public-tools.js.map +1 -1
  34. package/dist/public-types.d.ts +7 -1
  35. package/dist/public-types.d.ts.map +1 -1
  36. package/dist/runtime/query/declined.d.ts +12 -0
  37. package/dist/runtime/query/declined.d.ts.map +1 -0
  38. package/dist/runtime/query/declined.js +12 -0
  39. package/dist/runtime/query/declined.js.map +1 -0
  40. package/dist/runtime/query/executor.d.ts +3 -1
  41. package/dist/runtime/query/executor.d.ts.map +1 -1
  42. package/dist/runtime/query/executor.js +14 -2
  43. package/dist/runtime/query/executor.js.map +1 -1
  44. package/dist/runtime/query/index.d.ts.map +1 -1
  45. package/dist/runtime/query/index.js +1 -0
  46. package/dist/runtime/query/index.js.map +1 -1
  47. package/dist/runtime/query/iteration/index.d.ts.map +1 -1
  48. package/dist/runtime/query/iteration/index.js +7 -0
  49. package/dist/runtime/query/iteration/index.js.map +1 -1
  50. package/dist/runtime/query/iteration/phases/context.d.ts +6 -0
  51. package/dist/runtime/query/iteration/phases/context.d.ts.map +1 -1
  52. package/dist/runtime/query/iteration/phases/context.js.map +1 -1
  53. package/dist/runtime/query/iteration/phases/handoff.d.ts +22 -0
  54. package/dist/runtime/query/iteration/phases/handoff.d.ts.map +1 -0
  55. package/dist/runtime/query/iteration/phases/handoff.js +65 -0
  56. package/dist/runtime/query/iteration/phases/handoff.js.map +1 -0
  57. package/dist/runtime/query/iteration/phases/index.d.ts +1 -0
  58. package/dist/runtime/query/iteration/phases/index.d.ts.map +1 -1
  59. package/dist/runtime/query/iteration/phases/index.js +1 -0
  60. package/dist/runtime/query/iteration/phases/index.js.map +1 -1
  61. package/dist/runtime/query/iteration/phases/tool-review.d.ts.map +1 -1
  62. package/dist/runtime/query/iteration/phases/tool-review.js +8 -3
  63. package/dist/runtime/query/iteration/phases/tool-review.js.map +1 -1
  64. package/dist/runtime/query/resume-pending.d.ts.map +1 -1
  65. package/dist/runtime/query/resume-pending.js +3 -2
  66. package/dist/runtime/query/resume-pending.js.map +1 -1
  67. package/dist/runtime/query/review-policy.d.ts.map +1 -1
  68. package/dist/runtime/query/review-policy.js +4 -3
  69. package/dist/runtime/query/review-policy.js.map +1 -1
  70. package/dist/schedules/cron.d.ts +21 -0
  71. package/dist/schedules/cron.d.ts.map +1 -0
  72. package/dist/schedules/cron.js +167 -0
  73. package/dist/schedules/cron.js.map +1 -0
  74. package/dist/schedules/describe.d.ts +14 -0
  75. package/dist/schedules/describe.d.ts.map +1 -0
  76. package/dist/schedules/describe.js +133 -0
  77. package/dist/schedules/describe.js.map +1 -0
  78. package/dist/schedules/errors.d.ts +11 -0
  79. package/dist/schedules/errors.d.ts.map +1 -0
  80. package/dist/schedules/errors.js +15 -0
  81. package/dist/schedules/errors.js.map +1 -0
  82. package/dist/schedules/evaluate.d.ts +35 -0
  83. package/dist/schedules/evaluate.d.ts.map +1 -0
  84. package/dist/schedules/evaluate.js +158 -0
  85. package/dist/schedules/evaluate.js.map +1 -0
  86. package/dist/schedules/index.d.ts +11 -0
  87. package/dist/schedules/index.d.ts.map +1 -0
  88. package/dist/schedules/index.js +8 -0
  89. package/dist/schedules/index.js.map +1 -0
  90. package/dist/schedules/next-fire.d.ts +50 -0
  91. package/dist/schedules/next-fire.d.ts.map +1 -0
  92. package/dist/schedules/next-fire.js +250 -0
  93. package/dist/schedules/next-fire.js.map +1 -0
  94. package/dist/schedules/spec.d.ts +30 -0
  95. package/dist/schedules/spec.d.ts.map +1 -0
  96. package/dist/schedules/spec.js +169 -0
  97. package/dist/schedules/spec.js.map +1 -0
  98. package/dist/schedules/types.d.ts +144 -0
  99. package/dist/schedules/types.d.ts.map +1 -0
  100. package/dist/schedules/types.js +11 -0
  101. package/dist/schedules/types.js.map +1 -0
  102. package/dist/schedules/tz.d.ts +44 -0
  103. package/dist/schedules/tz.d.ts.map +1 -0
  104. package/dist/schedules/tz.js +141 -0
  105. package/dist/schedules/tz.js.map +1 -0
  106. package/dist/skills/index.d.ts +1 -1
  107. package/dist/skills/index.d.ts.map +1 -1
  108. package/dist/skills/index.js +1 -1
  109. package/dist/skills/index.js.map +1 -1
  110. package/dist/skills/loader.d.ts +16 -3
  111. package/dist/skills/loader.d.ts.map +1 -1
  112. package/dist/skills/loader.js +48 -4
  113. package/dist/skills/loader.js.map +1 -1
  114. package/dist/tools/builtins/browser-url.d.ts +83 -0
  115. package/dist/tools/builtins/browser-url.d.ts.map +1 -0
  116. package/dist/tools/builtins/browser-url.js +240 -0
  117. package/dist/tools/builtins/browser-url.js.map +1 -0
  118. package/dist/tools/builtins/browser.d.ts +367 -0
  119. package/dist/tools/builtins/browser.d.ts.map +1 -0
  120. package/dist/tools/builtins/browser.js +704 -0
  121. package/dist/tools/builtins/browser.js.map +1 -0
  122. package/dist/tools/builtins/skill.d.ts.map +1 -1
  123. package/dist/tools/builtins/skill.js +15 -0
  124. package/dist/tools/builtins/skill.js.map +1 -1
  125. package/dist/tools/defineTool.d.ts +2 -0
  126. package/dist/tools/defineTool.d.ts.map +1 -1
  127. package/dist/tools/defineTool.js +1 -0
  128. package/dist/tools/defineTool.js.map +1 -1
  129. package/dist/tools/schedules/index.d.ts +5 -0
  130. package/dist/tools/schedules/index.d.ts.map +1 -0
  131. package/dist/tools/schedules/index.js +4 -0
  132. package/dist/tools/schedules/index.js.map +1 -0
  133. package/dist/tools/schedules/loop-tool.d.ts +14 -0
  134. package/dist/tools/schedules/loop-tool.d.ts.map +1 -0
  135. package/dist/tools/schedules/loop-tool.js +81 -0
  136. package/dist/tools/schedules/loop-tool.js.map +1 -0
  137. package/dist/tools/schedules/present.d.ts +16 -0
  138. package/dist/tools/schedules/present.d.ts.map +1 -0
  139. package/dist/tools/schedules/present.js +69 -0
  140. package/dist/tools/schedules/present.js.map +1 -0
  141. package/dist/tools/schedules/prompt-scan.d.ts +17 -0
  142. package/dist/tools/schedules/prompt-scan.d.ts.map +1 -0
  143. package/dist/tools/schedules/prompt-scan.js +92 -0
  144. package/dist/tools/schedules/prompt-scan.js.map +1 -0
  145. package/dist/tools/schedules/schedule-tool.d.ts +16 -0
  146. package/dist/tools/schedules/schedule-tool.d.ts.map +1 -0
  147. package/dist/tools/schedules/schedule-tool.js +327 -0
  148. package/dist/tools/schedules/schedule-tool.js.map +1 -0
  149. package/dist/tools/schedules/types.d.ts +184 -0
  150. package/dist/tools/schedules/types.d.ts.map +1 -0
  151. package/dist/tools/schedules/types.js +11 -0
  152. package/dist/tools/schedules/types.js.map +1 -0
  153. package/dist/types/authorization/index.d.ts +86 -9
  154. package/dist/types/authorization/index.d.ts.map +1 -1
  155. package/dist/types/authorization/index.js +11 -1
  156. package/dist/types/authorization/index.js.map +1 -1
  157. package/dist/types/browser/index.d.ts +280 -0
  158. package/dist/types/browser/index.d.ts.map +1 -0
  159. package/dist/types/browser/index.js +12 -0
  160. package/dist/types/browser/index.js.map +1 -0
  161. package/dist/types/session/events.d.ts +6 -0
  162. package/dist/types/session/events.d.ts.map +1 -1
  163. package/dist/types/session/events.js.map +1 -1
  164. package/dist/types/session/records.d.ts +23 -0
  165. package/dist/types/session/records.d.ts.map +1 -1
  166. package/dist/types/session/records.js +9 -0
  167. package/dist/types/session/records.js.map +1 -1
  168. package/dist/types/tool/index.d.ts +41 -0
  169. package/dist/types/tool/index.d.ts.map +1 -1
  170. package/dist/types/tool/index.js.map +1 -1
  171. package/dist/types/tool/presentation.d.ts +7 -0
  172. package/dist/types/tool/presentation.d.ts.map +1 -1
  173. package/dist/utils/frontmatter.d.ts +18 -2
  174. package/dist/utils/frontmatter.d.ts.map +1 -1
  175. package/dist/utils/frontmatter.js +13 -3
  176. package/dist/utils/frontmatter.js.map +1 -1
  177. package/dist/utils/id.d.ts +8 -0
  178. package/dist/utils/id.d.ts.map +1 -1
  179. package/dist/utils/id.js +12 -0
  180. package/dist/utils/id.js.map +1 -1
  181. package/package.json +1 -1
  182. package/src/authorization/gate.ts +14 -2
  183. package/src/authorization/rules.ts +37 -7
  184. package/src/authorization/shell-lexer.ts +36 -6
  185. package/src/bridge/a2a/mapper.ts +2 -0
  186. package/src/bridge/sse/mapper.ts +1 -0
  187. package/src/directory/types.ts +2 -0
  188. package/src/prompt/coding-agent-doctrine.ts +1 -0
  189. package/src/public-runtime.ts +28 -0
  190. package/src/public-tools.ts +35 -0
  191. package/src/public-types.ts +50 -0
  192. package/src/runtime/query/declined.ts +12 -0
  193. package/src/runtime/query/executor.ts +17 -1
  194. package/src/runtime/query/index.ts +1 -0
  195. package/src/runtime/query/iteration/index.ts +8 -0
  196. package/src/runtime/query/iteration/phases/context.ts +6 -0
  197. package/src/runtime/query/iteration/phases/handoff.ts +74 -0
  198. package/src/runtime/query/iteration/phases/index.ts +1 -0
  199. package/src/runtime/query/iteration/phases/tool-review.ts +11 -4
  200. package/src/runtime/query/resume-pending.ts +3 -2
  201. package/src/runtime/query/review-policy.ts +4 -3
  202. package/src/schedules/cron.ts +202 -0
  203. package/src/schedules/describe.ts +138 -0
  204. package/src/schedules/errors.ts +15 -0
  205. package/src/schedules/evaluate.ts +178 -0
  206. package/src/schedules/index.ts +18 -0
  207. package/src/schedules/next-fire.ts +257 -0
  208. package/src/schedules/spec.ts +210 -0
  209. package/src/schedules/types.ts +163 -0
  210. package/src/schedules/tz.ts +155 -0
  211. package/src/skills/index.ts +1 -1
  212. package/src/skills/loader.ts +55 -4
  213. package/src/tools/builtins/browser-url.ts +251 -0
  214. package/src/tools/builtins/browser.ts +817 -0
  215. package/src/tools/builtins/skill.ts +18 -0
  216. package/src/tools/defineTool.ts +3 -0
  217. package/src/tools/schedules/index.ts +4 -0
  218. package/src/tools/schedules/loop-tool.ts +85 -0
  219. package/src/tools/schedules/present.ts +86 -0
  220. package/src/tools/schedules/prompt-scan.ts +96 -0
  221. package/src/tools/schedules/schedule-tool.ts +376 -0
  222. package/src/tools/schedules/types.ts +197 -0
  223. package/src/types/authorization/index.ts +60 -2
  224. package/src/types/browser/index.ts +341 -0
  225. package/src/types/session/events.ts +6 -0
  226. package/src/types/session/records.ts +10 -0
  227. package/src/types/tool/index.ts +42 -0
  228. package/src/types/tool/presentation.ts +7 -0
  229. package/src/utils/frontmatter.ts +29 -3
  230. package/src/utils/id.ts +14 -0
@@ -715,6 +715,31 @@ export interface ToolResult {
715
715
  * must not lose: what its controls do, where things are, what failed.
716
716
  */
717
717
  workingState?: readonly import('../../compaction/types.js').WorkingStatePin[]
718
+ /**
719
+ * This result needs a person before the turn can go on — a sign-in page,
720
+ * a CAPTCHA, a second factor, anything the model must not try to answer
721
+ * itself.
722
+ *
723
+ * The result is committed like any other: it reaches the transcript and
724
+ * the session log with the rest of its batch. Then, instead of calling
725
+ * the model again, the kernel writes a checkpoint and ends the segment
726
+ * with `turn_paused` carrying this value. Resuming the turn continues
727
+ * from that checkpoint, and the next step is a model call that sees the
728
+ * results. Inside a delegated child there is no person to hand to, so
729
+ * the child's turn fails with {@link ToolHandoff.reason} instead.
730
+ */
731
+ handoff?: ToolHandoff
732
+ }
733
+
734
+ /**
735
+ * A tool's request to stop the turn for a person. See {@link ToolResult.handoff}.
736
+ */
737
+ export interface ToolHandoff {
738
+ readonly kind: 'human-required'
739
+ /** Operator-facing text: what the person has to do before the turn resumes. */
740
+ readonly reason: string
741
+ /** Structured facts a host can render or act on, such as an origin or a command. */
742
+ readonly detail?: Readonly<Record<string, string>>
718
743
  }
719
744
 
720
745
  /**
@@ -810,6 +835,23 @@ export interface ToolDefinition<TInput = unknown> extends ToolPresentation<TInpu
810
835
  * the safe direction to be wrong in.
811
836
  */
812
837
  pathArgument?: string
838
+ /**
839
+ * The argument that holds an absolute URL the tool has already
840
+ * canonicalised in its input schema — one spelling, no whitespace.
841
+ *
842
+ * Declared so an `argument_pattern` rule tests the URL whole. Without it
843
+ * the rule reads every argument as a possible command line, and a URL's
844
+ * query separators (`&`, `;`, `|`) cut it into "segments": an `allow` for
845
+ * `^https://github\.com(?:[/?#]|$)` then declined
846
+ * `https://github.com/search?q=a&type=code`, because `type=code` is not
847
+ * GitHub. A `deny` or `review` is unaffected either way; only an `allow`
848
+ * needed every segment to match.
849
+ *
850
+ * Declare it only for an argument the input schema itself canonicalises
851
+ * to a URL. A free-text argument that happens to hold one keeps the
852
+ * command-line reading, which is the safe direction to be wrong in.
853
+ */
854
+ urlArgument?: string
813
855
  /**
814
856
  * The boolean argument by which a call asks to run outside the turn's
815
857
  * sandbox, when the tool offers that at all (the shipped `bash` does).
@@ -26,6 +26,13 @@ export type ToolCallView =
26
26
  readonly activity?: 'exploration'
27
27
  /** A successful result may add no information beyond the completed call row. */
28
28
  readonly visibility?: 'hidden'
29
+ /**
30
+ * For a result: the person declined on the tool's own screen (a
31
+ * confirmation they cancelled). The call did not succeed, but
32
+ * nothing failed either, so a host draws it as neither: `label` says
33
+ * what did not happen ("Cancelled — nothing was saved").
34
+ */
35
+ readonly outcome?: 'cancelled'
29
36
  }
30
37
  /**
31
38
  * A change to a document. `path` is optional because not every diff is
@@ -132,6 +132,19 @@ export interface FrontmatterOptions {
132
132
  * way.
133
133
  */
134
134
  readonly lists?: readonly string[]
135
+ /**
136
+ * The keys the caller reads. When given, a top-level key it answers
137
+ * `false` for is skipped whole — its value and every indented line under
138
+ * it — and does not appear in the result.
139
+ *
140
+ * The refusals in {@link UNSUPPORTED_YAML} exist so a value the caller
141
+ * USES is never read wrongly. A key nobody reads cannot be read wrongly,
142
+ * and refusing the whole file over it made a skill written for another
143
+ * tool (`argument-hint: [file]`, a `hooks:` block with a list in it)
144
+ * unusable here for the sake of a field this kernel ignores. Absent, every
145
+ * key is parsed and refused exactly as before.
146
+ */
147
+ readonly readsKey?: (key: string) => boolean
135
148
  }
136
149
 
137
150
  export interface ParsedFrontmatter {
@@ -153,15 +166,19 @@ export interface ParsedFrontmatter {
153
166
  readonly body: string
154
167
  }
155
168
 
169
+ /** Optional behaviour for {@link parseFrontmatter}: the same as {@link FrontmatterOptions}. */
170
+ export type ParseFrontmatterOptions = FrontmatterOptions
171
+
156
172
  /**
157
173
  * Parse a markdown file's `---` frontmatter.
158
174
  *
159
175
  * @param raw The file's full contents. LF and CRLF both parse.
160
176
  * @param source A label for error messages — a path, or a phrase naming the
161
177
  * file. Used verbatim, so the caller controls how its own errors read.
178
+ * @param options See {@link FrontmatterOptions}.
162
179
  * @throws If the frontmatter is absent, unclosed, or uses YAML this reader
163
- * does not implement. It never returns a partial or empty result to stand in
164
- * for a file it could not read.
180
+ * does not implement in a key the caller reads. It never returns a partial
181
+ * or empty result to stand in for a file it could not read.
165
182
  */
166
183
  export function parseFrontmatter(
167
184
  raw: string,
@@ -198,12 +215,15 @@ export function parseFrontmatter(
198
215
  const blocks = new Map<string, Map<string, string>>()
199
216
  const lists = new Map<string, string[]>()
200
217
  let currentKey: string | undefined
218
+ // The current top-level key is one the caller does not read: its value
219
+ // and its indented lines are skipped rather than parsed or refused.
220
+ let skipping = false
201
221
 
202
222
  for (const line of frontmatterRaw.split(LINE_SPLIT)) {
203
223
  if (!line.trim() || line.trimStart().startsWith('#')) continue
204
224
 
205
225
  if (/^\s/.test(line)) {
206
- if (!currentKey) continue
226
+ if (!currentKey || skipping) continue
207
227
 
208
228
  // A block sequence item. Read as a list when the caller named this
209
229
  // key in `options.lists`; refused, not skipped, everywhere else.
@@ -254,6 +274,12 @@ export function parseFrontmatter(
254
274
  const colonIdx = line.indexOf(':')
255
275
  if (colonIdx === -1) continue
256
276
  const key = line.slice(0, colonIdx).trim()
277
+ if (options.readsKey && !options.readsKey(key)) {
278
+ currentKey = key
279
+ skipping = true
280
+ continue
281
+ }
282
+ skipping = false
257
283
  const value = normalizeScalar(line.slice(colonIdx + 1))
258
284
 
259
285
  if (listKeys.has(key) && /^\[.*\]$/.test(value)) {
package/src/utils/id.ts CHANGED
@@ -197,6 +197,20 @@ export function generateDeliverableId(): DeliverableId {
197
197
  return generateId()
198
198
  }
199
199
 
200
+ /**
201
+ * The id of a scheduled job, for a host that stores schedules (the CLI's
202
+ * `NAMZU_HOME/schedule/`). A plain UUIDv7 string: jobs are the host's records,
203
+ * not a kernel entity, so there is no branded kind for them.
204
+ */
205
+ export function generateScheduleJobId(): string {
206
+ return uuidv7()
207
+ }
208
+
209
+ /** The id of one run of a scheduled job. See {@link generateScheduleJobId}. */
210
+ export function generateScheduleRunId(): string {
211
+ return uuidv7()
212
+ }
213
+
200
214
  /** Entity kinds are supplied by a typed field or storage collection. */
201
215
  export interface EntityIdByKind {
202
216
  turn: TurnId