@tai42/api-client 13.2.2 → 14.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.
package/dist/schemas.d.ts CHANGED
@@ -118,8 +118,9 @@ export declare const presetExtensions: z.ZodArray<z.ZodArray<z.ZodUnion<readonly
118
118
  * One preset as `GET /api/presets` returns it. Every preset is versioned, so
119
119
  * `active_version` is always an int; `conflicted` marks a QUARANTINED row (its
120
120
  * name collided with a foreign tool at boot — delete-only). `extensions` are the
121
- * ACTIVE version's extension combos and `output_schema` the optional author-set
122
- * output JSON Schema. Categorization tags live in the tool_meta overlay
121
+ * ACTIVE version's extension combos, `output_schema` the optional author-set
122
+ * output JSON Schema, and `input_schema` the optional author-set input JSON
123
+ * Schema. Categorization tags live in the tool_meta overlay
123
124
  * (`GET /api/tool-meta`), never on the record. A drift throws `ApiSchemaError`;
124
125
  * nothing is coerced.
125
126
  */
@@ -133,6 +134,7 @@ export declare const presetRecord: z.ZodObject<{
133
134
  config: z.ZodRecord<z.ZodString, z.ZodUnknown>;
134
135
  }, z.core.$strip>]>>>;
135
136
  output_schema: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
137
+ input_schema: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
136
138
  conflicted: z.ZodBoolean;
137
139
  conflicted_reason: z.ZodNullable<z.ZodString>;
138
140
  uses: z.ZodArray<z.ZodString>;
@@ -149,6 +151,7 @@ export declare const presetList: z.ZodArray<z.ZodObject<{
149
151
  config: z.ZodRecord<z.ZodString, z.ZodUnknown>;
150
152
  }, z.core.$strip>]>>>;
151
153
  output_schema: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
154
+ input_schema: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
152
155
  conflicted: z.ZodBoolean;
153
156
  conflicted_reason: z.ZodNullable<z.ZodString>;
154
157
  uses: z.ZodArray<z.ZodString>;
@@ -165,6 +168,7 @@ export declare const presetDetail: z.ZodObject<{
165
168
  config: z.ZodRecord<z.ZodString, z.ZodUnknown>;
166
169
  }, z.core.$strip>]>>>;
167
170
  output_schema: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
171
+ input_schema: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
168
172
  conflicted: z.ZodBoolean;
169
173
  conflicted_reason: z.ZodNullable<z.ZodString>;
170
174
  uses: z.ZodArray<z.ZodString>;
@@ -172,6 +176,89 @@ export declare const presetDetail: z.ZodObject<{
172
176
  fixed_kwargs: z.ZodRecord<z.ZodString, z.ZodUnknown>;
173
177
  }, z.core.$strip>;
174
178
  export type PresetDetail = z.infer<typeof presetDetail>;
179
+ /**
180
+ * One input injection of a state binding: BEFORE the run, a value is produced and
181
+ * placed into the run input under `into` (the run-input field name). A template
182
+ * `input` jq (`template_jq`, named `name` or attachment-qualified `template.name`) reads the
183
+ * record — its input is the record (`.`), with declared params bound as `$params`; a
184
+ * custom `jq` reads `{record, input}` → the value. Exactly one of `template_jq`/`jq`
185
+ * carries the program; the other is `null`.
186
+ */
187
+ export declare const stateInjection: z.ZodObject<{
188
+ template_jq: z.ZodDefault<z.ZodNullable<z.ZodString>>;
189
+ jq: z.ZodDefault<z.ZodNullable<z.ZodString>>;
190
+ into: z.ZodString;
191
+ }, z.core.$strip>;
192
+ export type StateInjection = z.infer<typeof stateInjection>;
193
+ /**
194
+ * One update of a state binding: AFTER the run, a template-relative op batch is
195
+ * applied through the store. A NAMED update (`template_jq`) runs the template `update`
196
+ * jq over `{record, input}` where `input` is built by `adapter` — a jq over
197
+ * `{output, input}` that constructs the update jq's declared input object. A custom
198
+ * `jq` runs over `{record, output, input}` → `[{op, path, value}]` and carries no
199
+ * adapter. `op_id` is an optional idempotency-key expression. Exactly one of
200
+ * `template_jq`/`jq` carries the program.
201
+ */
202
+ export declare const stateUpdate: z.ZodObject<{
203
+ template_jq: z.ZodDefault<z.ZodNullable<z.ZodString>>;
204
+ jq: z.ZodDefault<z.ZodNullable<z.ZodString>>;
205
+ adapter: z.ZodDefault<z.ZodNullable<z.ZodString>>;
206
+ op_id: z.ZodDefault<z.ZodNullable<z.ZodString>>;
207
+ }, z.core.$strip>;
208
+ export type StateUpdate = z.infer<typeof stateUpdate>;
209
+ /**
210
+ * One attached state of a binding: the `state`, one or more `templates`
211
+ * (attach-on-use — attached to the state on the binding's save), the `subject_expr`
212
+ * (a jq yielding the record KEY — a bare key string OR a full subject object — that
213
+ * this binding reads and updates), an optional `scope_expr` (a boolean jq predicate;
214
+ * when it is false this state is skipped for the run), and the ordered
215
+ * `input_injections` (before the run) and `updates` (after it).
216
+ */
217
+ export declare const stateAttach: z.ZodObject<{
218
+ state: z.ZodString;
219
+ templates: z.ZodDefault<z.ZodArray<z.ZodString>>;
220
+ subject_expr: z.ZodString;
221
+ scope_expr: z.ZodDefault<z.ZodNullable<z.ZodString>>;
222
+ input_injections: z.ZodDefault<z.ZodArray<z.ZodObject<{
223
+ template_jq: z.ZodDefault<z.ZodNullable<z.ZodString>>;
224
+ jq: z.ZodDefault<z.ZodNullable<z.ZodString>>;
225
+ into: z.ZodString;
226
+ }, z.core.$strip>>>;
227
+ updates: z.ZodDefault<z.ZodArray<z.ZodObject<{
228
+ template_jq: z.ZodDefault<z.ZodNullable<z.ZodString>>;
229
+ jq: z.ZodDefault<z.ZodNullable<z.ZodString>>;
230
+ adapter: z.ZodDefault<z.ZodNullable<z.ZodString>>;
231
+ op_id: z.ZodDefault<z.ZodNullable<z.ZodString>>;
232
+ }, z.core.$strip>>>;
233
+ }, z.core.$strip>;
234
+ export type StateAttach = z.infer<typeof stateAttach>;
235
+ /**
236
+ * The one generic binding shape carried, optionally, on every runnable definition
237
+ * (a preset, a channel route, a schedule, a hook) and repeated per node by the
238
+ * flow engine. It attaches one or more states, each with its templates, subject,
239
+ * injections and updates. `null` on a definition means no binding. Mirrors the
240
+ * platform `StateBinding` document.
241
+ */
242
+ export declare const stateBinding: z.ZodObject<{
243
+ states: z.ZodArray<z.ZodObject<{
244
+ state: z.ZodString;
245
+ templates: z.ZodDefault<z.ZodArray<z.ZodString>>;
246
+ subject_expr: z.ZodString;
247
+ scope_expr: z.ZodDefault<z.ZodNullable<z.ZodString>>;
248
+ input_injections: z.ZodDefault<z.ZodArray<z.ZodObject<{
249
+ template_jq: z.ZodDefault<z.ZodNullable<z.ZodString>>;
250
+ jq: z.ZodDefault<z.ZodNullable<z.ZodString>>;
251
+ into: z.ZodString;
252
+ }, z.core.$strip>>>;
253
+ updates: z.ZodDefault<z.ZodArray<z.ZodObject<{
254
+ template_jq: z.ZodDefault<z.ZodNullable<z.ZodString>>;
255
+ jq: z.ZodDefault<z.ZodNullable<z.ZodString>>;
256
+ adapter: z.ZodDefault<z.ZodNullable<z.ZodString>>;
257
+ op_id: z.ZodDefault<z.ZodNullable<z.ZodString>>;
258
+ }, z.core.$strip>>>;
259
+ }, z.core.$strip>>;
260
+ }, z.core.$strip>;
261
+ export type StateBinding = z.infer<typeof stateBinding>;
175
262
  /** The full version body a preset stores under `kind="preset"`. */
176
263
  export declare const presetBody: z.ZodObject<{
177
264
  base_tool: z.ZodString;
@@ -182,6 +269,26 @@ export declare const presetBody: z.ZodObject<{
182
269
  config: z.ZodRecord<z.ZodString, z.ZodUnknown>;
183
270
  }, z.core.$strip>]>>>;
184
271
  output_schema: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
272
+ input_schema: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
273
+ state_binding: z.ZodDefault<z.ZodNullable<z.ZodObject<{
274
+ states: z.ZodArray<z.ZodObject<{
275
+ state: z.ZodString;
276
+ templates: z.ZodDefault<z.ZodArray<z.ZodString>>;
277
+ subject_expr: z.ZodString;
278
+ scope_expr: z.ZodDefault<z.ZodNullable<z.ZodString>>;
279
+ input_injections: z.ZodDefault<z.ZodArray<z.ZodObject<{
280
+ template_jq: z.ZodDefault<z.ZodNullable<z.ZodString>>;
281
+ jq: z.ZodDefault<z.ZodNullable<z.ZodString>>;
282
+ into: z.ZodString;
283
+ }, z.core.$strip>>>;
284
+ updates: z.ZodDefault<z.ZodArray<z.ZodObject<{
285
+ template_jq: z.ZodDefault<z.ZodNullable<z.ZodString>>;
286
+ jq: z.ZodDefault<z.ZodNullable<z.ZodString>>;
287
+ adapter: z.ZodDefault<z.ZodNullable<z.ZodString>>;
288
+ op_id: z.ZodDefault<z.ZodNullable<z.ZodString>>;
289
+ }, z.core.$strip>>>;
290
+ }, z.core.$strip>>;
291
+ }, z.core.$strip>>>;
185
292
  }, z.core.$strip>;
186
293
  export type PresetBody = z.infer<typeof presetBody>;
187
294
  /**
@@ -201,6 +308,26 @@ export declare const presetVersion: z.ZodObject<{
201
308
  config: z.ZodRecord<z.ZodString, z.ZodUnknown>;
202
309
  }, z.core.$strip>]>>>;
203
310
  output_schema: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
311
+ input_schema: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
312
+ state_binding: z.ZodDefault<z.ZodNullable<z.ZodObject<{
313
+ states: z.ZodArray<z.ZodObject<{
314
+ state: z.ZodString;
315
+ templates: z.ZodDefault<z.ZodArray<z.ZodString>>;
316
+ subject_expr: z.ZodString;
317
+ scope_expr: z.ZodDefault<z.ZodNullable<z.ZodString>>;
318
+ input_injections: z.ZodDefault<z.ZodArray<z.ZodObject<{
319
+ template_jq: z.ZodDefault<z.ZodNullable<z.ZodString>>;
320
+ jq: z.ZodDefault<z.ZodNullable<z.ZodString>>;
321
+ into: z.ZodString;
322
+ }, z.core.$strip>>>;
323
+ updates: z.ZodDefault<z.ZodArray<z.ZodObject<{
324
+ template_jq: z.ZodDefault<z.ZodNullable<z.ZodString>>;
325
+ jq: z.ZodDefault<z.ZodNullable<z.ZodString>>;
326
+ adapter: z.ZodDefault<z.ZodNullable<z.ZodString>>;
327
+ op_id: z.ZodDefault<z.ZodNullable<z.ZodString>>;
328
+ }, z.core.$strip>>>;
329
+ }, z.core.$strip>>;
330
+ }, z.core.$strip>>>;
204
331
  }, z.core.$strip>;
205
332
  tags: z.ZodArray<z.ZodString>;
206
333
  created_at: z.ZodString;
@@ -218,6 +345,26 @@ export declare const presetVersionList: z.ZodArray<z.ZodObject<{
218
345
  config: z.ZodRecord<z.ZodString, z.ZodUnknown>;
219
346
  }, z.core.$strip>]>>>;
220
347
  output_schema: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
348
+ input_schema: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
349
+ state_binding: z.ZodDefault<z.ZodNullable<z.ZodObject<{
350
+ states: z.ZodArray<z.ZodObject<{
351
+ state: z.ZodString;
352
+ templates: z.ZodDefault<z.ZodArray<z.ZodString>>;
353
+ subject_expr: z.ZodString;
354
+ scope_expr: z.ZodDefault<z.ZodNullable<z.ZodString>>;
355
+ input_injections: z.ZodDefault<z.ZodArray<z.ZodObject<{
356
+ template_jq: z.ZodDefault<z.ZodNullable<z.ZodString>>;
357
+ jq: z.ZodDefault<z.ZodNullable<z.ZodString>>;
358
+ into: z.ZodString;
359
+ }, z.core.$strip>>>;
360
+ updates: z.ZodDefault<z.ZodArray<z.ZodObject<{
361
+ template_jq: z.ZodDefault<z.ZodNullable<z.ZodString>>;
362
+ jq: z.ZodDefault<z.ZodNullable<z.ZodString>>;
363
+ adapter: z.ZodDefault<z.ZodNullable<z.ZodString>>;
364
+ op_id: z.ZodDefault<z.ZodNullable<z.ZodString>>;
365
+ }, z.core.$strip>>>;
366
+ }, z.core.$strip>>;
367
+ }, z.core.$strip>>>;
221
368
  }, z.core.$strip>;
222
369
  tags: z.ZodArray<z.ZodString>;
223
370
  created_at: z.ZodString;
@@ -1769,6 +1916,25 @@ export declare const conversationRoute: z.ZodObject<{
1769
1916
  turns_per_hour_override: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
1770
1917
  error_reply_text: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1771
1918
  execution_key_fingerprint: z.ZodString;
1919
+ state_binding: z.ZodDefault<z.ZodNullable<z.ZodObject<{
1920
+ states: z.ZodArray<z.ZodObject<{
1921
+ state: z.ZodString;
1922
+ templates: z.ZodDefault<z.ZodArray<z.ZodString>>;
1923
+ subject_expr: z.ZodString;
1924
+ scope_expr: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1925
+ input_injections: z.ZodDefault<z.ZodArray<z.ZodObject<{
1926
+ template_jq: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1927
+ jq: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1928
+ into: z.ZodString;
1929
+ }, z.core.$strip>>>;
1930
+ updates: z.ZodDefault<z.ZodArray<z.ZodObject<{
1931
+ template_jq: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1932
+ jq: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1933
+ adapter: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1934
+ op_id: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1935
+ }, z.core.$strip>>>;
1936
+ }, z.core.$strip>>;
1937
+ }, z.core.$strip>>>;
1772
1938
  }, z.core.$strip>;
1773
1939
  export type ConversationRoute = z.infer<typeof conversationRoute>;
1774
1940
  export declare const conversationRoutes: z.ZodObject<{
@@ -1796,6 +1962,25 @@ export declare const conversationRoutes: z.ZodObject<{
1796
1962
  turns_per_hour_override: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
1797
1963
  error_reply_text: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1798
1964
  execution_key_fingerprint: z.ZodString;
1965
+ state_binding: z.ZodDefault<z.ZodNullable<z.ZodObject<{
1966
+ states: z.ZodArray<z.ZodObject<{
1967
+ state: z.ZodString;
1968
+ templates: z.ZodDefault<z.ZodArray<z.ZodString>>;
1969
+ subject_expr: z.ZodString;
1970
+ scope_expr: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1971
+ input_injections: z.ZodDefault<z.ZodArray<z.ZodObject<{
1972
+ template_jq: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1973
+ jq: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1974
+ into: z.ZodString;
1975
+ }, z.core.$strip>>>;
1976
+ updates: z.ZodDefault<z.ZodArray<z.ZodObject<{
1977
+ template_jq: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1978
+ jq: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1979
+ adapter: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1980
+ op_id: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1981
+ }, z.core.$strip>>>;
1982
+ }, z.core.$strip>>;
1983
+ }, z.core.$strip>>>;
1799
1984
  }, z.core.$strip>>;
1800
1985
  total: z.ZodNumber;
1801
1986
  }, z.core.$strip>;
@@ -1836,6 +2021,25 @@ export declare const conversationRouteCreate: z.ZodObject<{
1836
2021
  callback_url: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1837
2022
  turns_per_hour_override: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
1838
2023
  error_reply_text: z.ZodDefault<z.ZodNullable<z.ZodString>>;
2024
+ state_binding: z.ZodDefault<z.ZodNullable<z.ZodObject<{
2025
+ states: z.ZodArray<z.ZodObject<{
2026
+ state: z.ZodString;
2027
+ templates: z.ZodDefault<z.ZodArray<z.ZodString>>;
2028
+ subject_expr: z.ZodString;
2029
+ scope_expr: z.ZodDefault<z.ZodNullable<z.ZodString>>;
2030
+ input_injections: z.ZodDefault<z.ZodArray<z.ZodObject<{
2031
+ template_jq: z.ZodDefault<z.ZodNullable<z.ZodString>>;
2032
+ jq: z.ZodDefault<z.ZodNullable<z.ZodString>>;
2033
+ into: z.ZodString;
2034
+ }, z.core.$strip>>>;
2035
+ updates: z.ZodDefault<z.ZodArray<z.ZodObject<{
2036
+ template_jq: z.ZodDefault<z.ZodNullable<z.ZodString>>;
2037
+ jq: z.ZodDefault<z.ZodNullable<z.ZodString>>;
2038
+ adapter: z.ZodDefault<z.ZodNullable<z.ZodString>>;
2039
+ op_id: z.ZodDefault<z.ZodNullable<z.ZodString>>;
2040
+ }, z.core.$strip>>>;
2041
+ }, z.core.$strip>>;
2042
+ }, z.core.$strip>>>;
1839
2043
  }, z.core.$strip>;
1840
2044
  export type ConversationRouteCreate = z.infer<typeof conversationRouteCreate>;
1841
2045
  /**
@@ -1872,6 +2076,25 @@ export declare const conversationRouteWritten: z.ZodObject<{
1872
2076
  turns_per_hour_override: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
1873
2077
  error_reply_text: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1874
2078
  execution_key_fingerprint: z.ZodString;
2079
+ state_binding: z.ZodDefault<z.ZodNullable<z.ZodObject<{
2080
+ states: z.ZodArray<z.ZodObject<{
2081
+ state: z.ZodString;
2082
+ templates: z.ZodDefault<z.ZodArray<z.ZodString>>;
2083
+ subject_expr: z.ZodString;
2084
+ scope_expr: z.ZodDefault<z.ZodNullable<z.ZodString>>;
2085
+ input_injections: z.ZodDefault<z.ZodArray<z.ZodObject<{
2086
+ template_jq: z.ZodDefault<z.ZodNullable<z.ZodString>>;
2087
+ jq: z.ZodDefault<z.ZodNullable<z.ZodString>>;
2088
+ into: z.ZodString;
2089
+ }, z.core.$strip>>>;
2090
+ updates: z.ZodDefault<z.ZodArray<z.ZodObject<{
2091
+ template_jq: z.ZodDefault<z.ZodNullable<z.ZodString>>;
2092
+ jq: z.ZodDefault<z.ZodNullable<z.ZodString>>;
2093
+ adapter: z.ZodDefault<z.ZodNullable<z.ZodString>>;
2094
+ op_id: z.ZodDefault<z.ZodNullable<z.ZodString>>;
2095
+ }, z.core.$strip>>>;
2096
+ }, z.core.$strip>>;
2097
+ }, z.core.$strip>>>;
1875
2098
  }, z.core.$strip>;
1876
2099
  callback_secret: z.ZodNullable<z.ZodString>;
1877
2100
  }, z.core.$strip>;
@@ -2401,6 +2624,25 @@ export declare const hookParams: z.ZodObject<{
2401
2624
  expr: z.ZodDefault<z.ZodNullable<z.ZodString>>;
2402
2625
  expr_id: z.ZodDefault<z.ZodNullable<z.ZodString>>;
2403
2626
  expr_kwargs: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
2627
+ state_binding: z.ZodDefault<z.ZodNullable<z.ZodObject<{
2628
+ states: z.ZodArray<z.ZodObject<{
2629
+ state: z.ZodString;
2630
+ templates: z.ZodDefault<z.ZodArray<z.ZodString>>;
2631
+ subject_expr: z.ZodString;
2632
+ scope_expr: z.ZodDefault<z.ZodNullable<z.ZodString>>;
2633
+ input_injections: z.ZodDefault<z.ZodArray<z.ZodObject<{
2634
+ template_jq: z.ZodDefault<z.ZodNullable<z.ZodString>>;
2635
+ jq: z.ZodDefault<z.ZodNullable<z.ZodString>>;
2636
+ into: z.ZodString;
2637
+ }, z.core.$strip>>>;
2638
+ updates: z.ZodDefault<z.ZodArray<z.ZodObject<{
2639
+ template_jq: z.ZodDefault<z.ZodNullable<z.ZodString>>;
2640
+ jq: z.ZodDefault<z.ZodNullable<z.ZodString>>;
2641
+ adapter: z.ZodDefault<z.ZodNullable<z.ZodString>>;
2642
+ op_id: z.ZodDefault<z.ZodNullable<z.ZodString>>;
2643
+ }, z.core.$strip>>>;
2644
+ }, z.core.$strip>>;
2645
+ }, z.core.$strip>>>;
2404
2646
  }, z.core.$strip>;
2405
2647
  export type HookParams = z.infer<typeof hookParams>;
2406
2648
  export declare const hookList: z.ZodObject<{
@@ -2425,6 +2667,25 @@ export declare const hookList: z.ZodObject<{
2425
2667
  expr: z.ZodDefault<z.ZodNullable<z.ZodString>>;
2426
2668
  expr_id: z.ZodDefault<z.ZodNullable<z.ZodString>>;
2427
2669
  expr_kwargs: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
2670
+ state_binding: z.ZodDefault<z.ZodNullable<z.ZodObject<{
2671
+ states: z.ZodArray<z.ZodObject<{
2672
+ state: z.ZodString;
2673
+ templates: z.ZodDefault<z.ZodArray<z.ZodString>>;
2674
+ subject_expr: z.ZodString;
2675
+ scope_expr: z.ZodDefault<z.ZodNullable<z.ZodString>>;
2676
+ input_injections: z.ZodDefault<z.ZodArray<z.ZodObject<{
2677
+ template_jq: z.ZodDefault<z.ZodNullable<z.ZodString>>;
2678
+ jq: z.ZodDefault<z.ZodNullable<z.ZodString>>;
2679
+ into: z.ZodString;
2680
+ }, z.core.$strip>>>;
2681
+ updates: z.ZodDefault<z.ZodArray<z.ZodObject<{
2682
+ template_jq: z.ZodDefault<z.ZodNullable<z.ZodString>>;
2683
+ jq: z.ZodDefault<z.ZodNullable<z.ZodString>>;
2684
+ adapter: z.ZodDefault<z.ZodNullable<z.ZodString>>;
2685
+ op_id: z.ZodDefault<z.ZodNullable<z.ZodString>>;
2686
+ }, z.core.$strip>>>;
2687
+ }, z.core.$strip>>;
2688
+ }, z.core.$strip>>>;
2428
2689
  }, z.core.$strip>>;
2429
2690
  total: z.ZodNumber;
2430
2691
  topic_verifiers: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
@@ -3960,11 +4221,11 @@ export declare const stateSubject: z.ZodObject<{
3960
4221
  key: z.ZodString;
3961
4222
  }, z.core.$strip>;
3962
4223
  export type StateSubject = z.infer<typeof stateSubject>;
3963
- /** One absolute write-regime rule composed over the mounts: `{path, regime}`, permissive. */
4224
+ /** One absolute write-regime rule composed over the attachments: `{path, regime}`, permissive. */
3964
4225
  export declare const stateRegime: z.ZodRecord<z.ZodString, z.ZodUnknown>;
3965
4226
  /**
3966
4227
  * A declared state served on every read. `schema` is the base JSON Schema;
3967
- * `effective_schema` (the base composed with every mounted module's fragment) and
4228
+ * `effective_schema` (the base composed with every attached template's fragment) and
3968
4229
  * `regimes` (the absolute write-regime rules) are platform-COMPUTED and served on every
3969
4230
  * read — modelled optional so a write body that omits them, or a server yet to compose
3970
4231
  * them, still parses. A drift throws ApiSchemaError.
@@ -4009,21 +4270,21 @@ export declare const stateList: z.ZodArray<z.ZodObject<{
4009
4270
  regimes: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>>>;
4010
4271
  updated_at: z.ZodDefault<z.ZodNullable<z.ZodString>>;
4011
4272
  }, z.core.$strip>>;
4012
- /** One module mount on a state: where the fragment lands + its param/declaration values. */
4013
- export declare const stateMount: z.ZodObject<{
4014
- module: z.ZodString;
4273
+ /** One template attachment on a state: where the fragment lands + its param/declaration values. */
4274
+ export declare const stateAttachment: z.ZodObject<{
4275
+ template: z.ZodString;
4015
4276
  path: z.ZodArray<z.ZodString>;
4016
4277
  parameters: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
4017
4278
  declarations: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
4018
4279
  }, z.core.$strip>;
4019
- export type StateMount = z.infer<typeof stateMount>;
4020
- export declare const stateMountList: z.ZodArray<z.ZodObject<{
4021
- module: z.ZodString;
4280
+ export type StateAttachment = z.infer<typeof stateAttachment>;
4281
+ export declare const stateAttachmentList: z.ZodArray<z.ZodObject<{
4282
+ template: z.ZodString;
4022
4283
  path: z.ZodArray<z.ZodString>;
4023
4284
  parameters: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
4024
4285
  declarations: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
4025
4286
  }, z.core.$strip>>;
4026
- /** `GET /api/states/{name}` — the declaration (with effective schema + regimes) plus mounts. */
4287
+ /** `GET /api/states/{name}` — the declaration (with effective schema + regimes) plus attachments. */
4027
4288
  export declare const stateDetail: z.ZodObject<{
4028
4289
  name: z.ZodString;
4029
4290
  description: z.ZodDefault<z.ZodString>;
@@ -4033,8 +4294,8 @@ export declare const stateDetail: z.ZodObject<{
4033
4294
  retention_days: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
4034
4295
  effective_schema: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
4035
4296
  regimes: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>>>;
4036
- mounts: z.ZodDefault<z.ZodArray<z.ZodObject<{
4037
- module: z.ZodString;
4297
+ attachments: z.ZodDefault<z.ZodArray<z.ZodObject<{
4298
+ template: z.ZodString;
4038
4299
  path: z.ZodArray<z.ZodString>;
4039
4300
  parameters: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
4040
4301
  declarations: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
@@ -4054,9 +4315,44 @@ export declare const stateStats: z.ZodObject<{
4054
4315
  consumers: z.ZodDefault<z.ZodNumber>;
4055
4316
  }, z.core.$strip>;
4056
4317
  export type StateStats = z.infer<typeof stateStats>;
4057
- /** The platform half of a state-module document (mirrors StateModuleDocument). */
4058
- export declare const stateModuleDocument: z.ZodObject<{
4059
- kind: z.ZodDefault<z.ZodLiteral<"state-module">>;
4318
+ /**
4319
+ * One template jq: `jq` is a program over the subject's attached subtree, its `purpose`
4320
+ * either `input` (a read-only program feeding a tool argument) or `update` (a program
4321
+ * returning an op batch that mutates the record). `params` are its declared argument
4322
+ * names; `reads`/`writes` are the template-relative record paths an `update` declares,
4323
+ * each a list of key segments; `description` is the human label.
4324
+ */
4325
+ export declare const templateJq: z.ZodObject<{
4326
+ description: z.ZodDefault<z.ZodString>;
4327
+ purpose: z.ZodEnum<{
4328
+ input: "input";
4329
+ update: "update";
4330
+ }>;
4331
+ params: z.ZodDefault<z.ZodArray<z.ZodString>>;
4332
+ reads: z.ZodDefault<z.ZodArray<z.ZodArray<z.ZodString>>>;
4333
+ writes: z.ZodDefault<z.ZodArray<z.ZodArray<z.ZodString>>>;
4334
+ jq: z.ZodString;
4335
+ }, z.core.$strip>;
4336
+ export type TemplateJq = z.infer<typeof templateJq>;
4337
+ /**
4338
+ * How a declarations edit settles open records: `view` reads the record, `close`
4339
+ * builds the op batch that settles it, `resolutions` names the resolutions a close
4340
+ * may name — each a jq program.
4341
+ */
4342
+ export declare const templateReconcile: z.ZodObject<{
4343
+ view: z.ZodString;
4344
+ close: z.ZodString;
4345
+ resolutions: z.ZodString;
4346
+ }, z.core.$strip>;
4347
+ export type TemplateReconcile = z.infer<typeof templateReconcile>;
4348
+ /**
4349
+ * The platform half of a state-template document (mirrors StateTemplateDocument).
4350
+ * `template_jq` maps a name to its definition (each carrying its `purpose`);
4351
+ * `reconcile` is the settle policy — both optional (`null` when the template declares
4352
+ * none).
4353
+ */
4354
+ export declare const stateTemplateDocument: z.ZodObject<{
4355
+ kind: z.ZodDefault<z.ZodLiteral<"state-template">>;
4060
4356
  name: z.ZodString;
4061
4357
  description: z.ZodDefault<z.ZodString>;
4062
4358
  parameters: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
@@ -4064,16 +4360,32 @@ export declare const stateModuleDocument: z.ZodObject<{
4064
4360
  regimes: z.ZodDefault<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
4065
4361
  declarations: z.ZodDefault<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
4066
4362
  trace: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
4363
+ template_jq: z.ZodDefault<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodObject<{
4364
+ description: z.ZodDefault<z.ZodString>;
4365
+ purpose: z.ZodEnum<{
4366
+ input: "input";
4367
+ update: "update";
4368
+ }>;
4369
+ params: z.ZodDefault<z.ZodArray<z.ZodString>>;
4370
+ reads: z.ZodDefault<z.ZodArray<z.ZodArray<z.ZodString>>>;
4371
+ writes: z.ZodDefault<z.ZodArray<z.ZodArray<z.ZodString>>>;
4372
+ jq: z.ZodString;
4373
+ }, z.core.$strip>>>>;
4374
+ reconcile: z.ZodDefault<z.ZodNullable<z.ZodObject<{
4375
+ view: z.ZodString;
4376
+ close: z.ZodString;
4377
+ resolutions: z.ZodString;
4378
+ }, z.core.$strip>>>;
4067
4379
  }, z.core.$strip>;
4068
- export type StateModuleDocument = z.infer<typeof stateModuleDocument>;
4380
+ export type StateTemplateDocument = z.infer<typeof stateTemplateDocument>;
4069
4381
  /**
4070
- * One row of `GET /api/state-modules`. The module document plus the two derived columns
4071
- * the Modules tab shows: `mounted_on` (how many states mount it — a delete is refused
4072
- * while > 0) and `shipped_default` (a platform-shipped module). ASSUMED derived fields
4073
- * (WP-3 owns the list router); the document fields are verbatim.
4382
+ * One row of `GET /api/state-templates`. The template document plus the two derived columns
4383
+ * the Templates tab shows: `attached_to` (how many states attach it — a delete is refused
4384
+ * while > 0) and `shipped_default` (a platform-shipped template). Both are server-derived
4385
+ * columns; the document fields are verbatim.
4074
4386
  */
4075
- export declare const stateModuleListItem: z.ZodObject<{
4076
- kind: z.ZodDefault<z.ZodLiteral<"state-module">>;
4387
+ export declare const stateTemplateListItem: z.ZodObject<{
4388
+ kind: z.ZodDefault<z.ZodLiteral<"state-template">>;
4077
4389
  name: z.ZodString;
4078
4390
  description: z.ZodDefault<z.ZodString>;
4079
4391
  parameters: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
@@ -4081,12 +4393,28 @@ export declare const stateModuleListItem: z.ZodObject<{
4081
4393
  regimes: z.ZodDefault<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
4082
4394
  declarations: z.ZodDefault<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
4083
4395
  trace: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
4084
- mounted_on: z.ZodDefault<z.ZodNumber>;
4396
+ template_jq: z.ZodDefault<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodObject<{
4397
+ description: z.ZodDefault<z.ZodString>;
4398
+ purpose: z.ZodEnum<{
4399
+ input: "input";
4400
+ update: "update";
4401
+ }>;
4402
+ params: z.ZodDefault<z.ZodArray<z.ZodString>>;
4403
+ reads: z.ZodDefault<z.ZodArray<z.ZodArray<z.ZodString>>>;
4404
+ writes: z.ZodDefault<z.ZodArray<z.ZodArray<z.ZodString>>>;
4405
+ jq: z.ZodString;
4406
+ }, z.core.$strip>>>>;
4407
+ reconcile: z.ZodDefault<z.ZodNullable<z.ZodObject<{
4408
+ view: z.ZodString;
4409
+ close: z.ZodString;
4410
+ resolutions: z.ZodString;
4411
+ }, z.core.$strip>>>;
4412
+ attached_to: z.ZodDefault<z.ZodNumber>;
4085
4413
  shipped_default: z.ZodDefault<z.ZodBoolean>;
4086
4414
  }, z.core.$strip>;
4087
- export type StateModuleListItem = z.infer<typeof stateModuleListItem>;
4088
- export declare const stateModuleList: z.ZodArray<z.ZodObject<{
4089
- kind: z.ZodDefault<z.ZodLiteral<"state-module">>;
4415
+ export type StateTemplateListItem = z.infer<typeof stateTemplateListItem>;
4416
+ export declare const stateTemplateList: z.ZodArray<z.ZodObject<{
4417
+ kind: z.ZodDefault<z.ZodLiteral<"state-template">>;
4090
4418
  name: z.ZodString;
4091
4419
  description: z.ZodDefault<z.ZodString>;
4092
4420
  parameters: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
@@ -4094,11 +4422,27 @@ export declare const stateModuleList: z.ZodArray<z.ZodObject<{
4094
4422
  regimes: z.ZodDefault<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
4095
4423
  declarations: z.ZodDefault<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
4096
4424
  trace: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
4097
- mounted_on: z.ZodDefault<z.ZodNumber>;
4425
+ template_jq: z.ZodDefault<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodObject<{
4426
+ description: z.ZodDefault<z.ZodString>;
4427
+ purpose: z.ZodEnum<{
4428
+ input: "input";
4429
+ update: "update";
4430
+ }>;
4431
+ params: z.ZodDefault<z.ZodArray<z.ZodString>>;
4432
+ reads: z.ZodDefault<z.ZodArray<z.ZodArray<z.ZodString>>>;
4433
+ writes: z.ZodDefault<z.ZodArray<z.ZodArray<z.ZodString>>>;
4434
+ jq: z.ZodString;
4435
+ }, z.core.$strip>>>>;
4436
+ reconcile: z.ZodDefault<z.ZodNullable<z.ZodObject<{
4437
+ view: z.ZodString;
4438
+ close: z.ZodString;
4439
+ resolutions: z.ZodString;
4440
+ }, z.core.$strip>>>;
4441
+ attached_to: z.ZodDefault<z.ZodNumber>;
4098
4442
  shipped_default: z.ZodDefault<z.ZodBoolean>;
4099
4443
  }, z.core.$strip>>;
4100
4444
  /** A read record: the state, its subject, the document + monotonic seq, and any fold. */
4101
- export declare const recordView: z.ZodObject<{
4445
+ export declare const stateRecord: z.ZodObject<{
4102
4446
  state: z.ZodString;
4103
4447
  subject: z.ZodObject<{
4104
4448
  target_kind: z.ZodEnum<{
@@ -4130,7 +4474,7 @@ export declare const recordView: z.ZodObject<{
4130
4474
  key: z.ZodString;
4131
4475
  }, z.core.$strip>>>;
4132
4476
  }, z.core.$strip>;
4133
- export type RecordView = z.infer<typeof recordView>;
4477
+ export type StateRecord = z.infer<typeof stateRecord>;
4134
4478
  /** The outcome of an `apply` (a delta batch): whether it applied + the resulting doc. */
4135
4479
  export declare const applyResult: z.ZodObject<{
4136
4480
  applied: z.ZodBoolean;
@@ -4139,6 +4483,31 @@ export declare const applyResult: z.ZodObject<{
4139
4483
  skipped: z.ZodDefault<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
4140
4484
  }, z.core.$strip>;
4141
4485
  export type ApplyResult = z.infer<typeof applyResult>;
4486
+ /**
4487
+ * `GET …/template-jq/{name}` — the evaluated template jq's `name`, its `purpose`, and
4488
+ * its `value` (the `input` jq's read). GET evaluates ONLY an `input`-purpose jq; a GET
4489
+ * on an `update`-purpose name is refused with 422, so the result's purpose is always
4490
+ * `input`.
4491
+ */
4492
+ export declare const templateJqResult: z.ZodObject<{
4493
+ name: z.ZodString;
4494
+ purpose: z.ZodLiteral<"input">;
4495
+ value: z.ZodUnknown;
4496
+ }, z.core.$strip>;
4497
+ export type TemplateJqResult = z.infer<typeof templateJqResult>;
4498
+ /**
4499
+ * `POST …/template-jq/{name}` — the applied template jq's outcome. The jq lands an op
4500
+ * batch through the same `apply` chokepoint as a delta, so `applied`/`data`/`seq`/`skipped`
4501
+ * carry that outcome.
4502
+ */
4503
+ export declare const templateJqApplyResult: z.ZodObject<{
4504
+ name: z.ZodString;
4505
+ applied: z.ZodBoolean;
4506
+ data: z.ZodDefault<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
4507
+ seq: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
4508
+ skipped: z.ZodDefault<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
4509
+ }, z.core.$strip>;
4510
+ export type TemplateJqApplyResult = z.infer<typeof templateJqApplyResult>;
4142
4511
  /**
4143
4512
  * One paged subject row: the addressed `subject` plus its record's last-write
4144
4513
  * `updated_at` — epoch seconds (the store's `extract(epoch FROM updated_at)`), served
@@ -4291,27 +4660,27 @@ export declare const stateDeleted: z.ZodObject<{
4291
4660
  name: z.ZodString;
4292
4661
  deleted: z.ZodLiteral<true>;
4293
4662
  }, z.core.$strip>;
4294
- /** `PUT /api/states/{name}/mounts/{module}` — the module now mounted on the state. */
4295
- export declare const stateMounted: z.ZodObject<{
4296
- mounted: z.ZodLiteral<true>;
4663
+ /** `PUT /api/states/{name}/attachments/{template}` — the template now attached to the state. */
4664
+ export declare const stateAttached: z.ZodObject<{
4665
+ attached: z.ZodLiteral<true>;
4297
4666
  state: z.ZodString;
4298
- module: z.ZodString;
4667
+ template: z.ZodString;
4299
4668
  }, z.core.$strip>;
4300
- export type StateMounted = z.infer<typeof stateMounted>;
4301
- /** `PATCH /api/states/{name}/mounts/{module}` — the mount whose declarations were rewritten. */
4302
- export declare const stateMountUpdated: z.ZodObject<{
4669
+ export type StateAttached = z.infer<typeof stateAttached>;
4670
+ /** `PATCH /api/states/{name}/attachments/{template}` — the attachment whose declarations were rewritten. */
4671
+ export declare const stateAttachmentUpdated: z.ZodObject<{
4303
4672
  updated: z.ZodLiteral<true>;
4304
4673
  state: z.ZodString;
4305
- module: z.ZodString;
4674
+ template: z.ZodString;
4306
4675
  }, z.core.$strip>;
4307
- export type StateMountUpdated = z.infer<typeof stateMountUpdated>;
4308
- /** `DELETE /api/states/{name}/mounts/{module}` — the module unmounted from the state. */
4309
- export declare const stateUnmounted: z.ZodObject<{
4310
- unmounted: z.ZodLiteral<true>;
4676
+ export type StateAttachmentUpdated = z.infer<typeof stateAttachmentUpdated>;
4677
+ /** `DELETE /api/states/{name}/attachments/{template}` — the template detached from the state. */
4678
+ export declare const stateDetached: z.ZodObject<{
4679
+ detached: z.ZodLiteral<true>;
4311
4680
  state: z.ZodString;
4312
- module: z.ZodString;
4681
+ template: z.ZodString;
4313
4682
  }, z.core.$strip>;
4314
- export type StateUnmounted = z.infer<typeof stateUnmounted>;
4683
+ export type StateDetached = z.infer<typeof stateDetached>;
4315
4684
  /**
4316
4685
  * `POST /api/states/{name}/records/.../fold` — the fold report: the `mode`, the
4317
4686
  * `{kind, key}` of the folded `from` and surviving `into` subjects, whether the fold
@@ -4334,8 +4703,8 @@ export declare const stateFoldReport: z.ZodObject<{
4334
4703
  flattened: z.ZodDefault<z.ZodNumber>;
4335
4704
  }, z.core.$strip>;
4336
4705
  export type StateFoldReport = z.infer<typeof stateFoldReport>;
4337
- /** `DELETE /api/state-modules/{name}` — the removed module document. */
4338
- export declare const stateModuleDeleted: z.ZodObject<{
4706
+ /** `DELETE /api/state-templates/{name}` — the removed template document. */
4707
+ export declare const stateTemplateDeleted: z.ZodObject<{
4339
4708
  name: z.ZodString;
4340
4709
  deleted: z.ZodLiteral<true>;
4341
4710
  }, z.core.$strip>;