@manifesto-ai/core 2.8.0 → 2.9.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 (39) hide show
  1. package/README.md +1 -1
  2. package/dist/core/action-availability.d.ts +27 -0
  3. package/dist/core/apply.d.ts +11 -0
  4. package/dist/core/compute.d.ts +16 -0
  5. package/dist/core/explain.d.ts +13 -0
  6. package/dist/core/index.d.ts +4 -0
  7. package/dist/core/system-delta.d.ts +8 -0
  8. package/dist/core/validate.d.ts +15 -0
  9. package/dist/core/validation-utils.d.ts +22 -0
  10. package/dist/errors.d.ts +29 -0
  11. package/dist/evaluator/computed.d.ts +13 -0
  12. package/dist/evaluator/context.d.ts +61 -0
  13. package/dist/evaluator/dag.d.ts +29 -0
  14. package/dist/evaluator/expr.d.ts +10 -0
  15. package/dist/evaluator/flow.d.ts +35 -0
  16. package/dist/evaluator/index.d.ts +5 -0
  17. package/dist/factories.d.ts +21 -0
  18. package/dist/index.d.ts +20 -1715
  19. package/dist/schema/action.d.ts +13 -0
  20. package/dist/schema/common.d.ts +36 -0
  21. package/dist/schema/computed.d.ts +22 -0
  22. package/dist/schema/defaults.d.ts +11 -0
  23. package/dist/schema/domain.d.ts +49 -0
  24. package/dist/schema/expr.d.ts +482 -0
  25. package/dist/schema/field.d.ts +47 -0
  26. package/dist/schema/flow.d.ts +108 -0
  27. package/dist/schema/host-context.d.ts +11 -0
  28. package/dist/schema/index.d.ts +14 -0
  29. package/dist/schema/patch.d.ts +105 -0
  30. package/dist/schema/result.d.ts +175 -0
  31. package/dist/schema/snapshot.d.ts +132 -0
  32. package/dist/schema/trace.d.ts +97 -0
  33. package/dist/schema/type-spec.d.ts +33 -0
  34. package/dist/utils/canonical.d.ts +37 -0
  35. package/dist/utils/hash.d.ts +54 -0
  36. package/dist/utils/index.d.ts +4 -0
  37. package/dist/utils/patch-path.d.ts +15 -0
  38. package/dist/utils/path.d.ts +41 -0
  39. package/package.json +4 -4
package/dist/index.d.ts CHANGED
@@ -1,1713 +1,3 @@
1
- import { z } from 'zod';
2
-
3
- /**
4
- * ExprNode - Pure expression language for ComputedSpec and FlowSpec
5
- * All expressions are deterministic and side-effect free
6
- */
7
- type ExprNode = LitExpr | GetExpr | EqExpr | NeqExpr | GtExpr | GteExpr | LtExpr | LteExpr | AndExpr | OrExpr | NotExpr | IfExpr | AddExpr | SubExpr | MulExpr | DivExpr | ModExpr | MinExpr | MaxExpr | AbsExpr | NegExpr | FloorExpr | CeilExpr | RoundExpr | SqrtExpr | PowExpr | SumArrayExpr | MinArrayExpr | MaxArrayExpr | ConcatExpr | SubstringExpr | TrimExpr | ToLowerCaseExpr | ToUpperCaseExpr | StrLenExpr | StartsWithExpr | EndsWithExpr | StrIncludesExpr | IndexOfExpr | ReplaceExpr | SplitExpr | LenExpr | AtExpr | FirstExpr | LastExpr | SliceExpr | IncludesExpr | FilterExpr | MapExpr | FindExpr | EveryExpr | SomeExpr | AppendExpr | ReverseExpr | UniqueExpr | FlatExpr | ObjectExpr | FieldExpr | KeysExpr | ValuesExpr | EntriesExpr | MergeExpr | HasKeyExpr | PickExpr | OmitExpr | FromEntriesExpr | TypeofExpr | IsNullExpr | CoalesceExpr | ToStringExpr | ToNumberExpr | ToBooleanExpr;
8
- declare const LitExpr: z.ZodObject<{
9
- kind: z.ZodLiteral<"lit">;
10
- value: z.ZodUnknown;
11
- }, z.core.$strip>;
12
- type LitExpr = z.infer<typeof LitExpr>;
13
- declare const GetExpr: z.ZodObject<{
14
- kind: z.ZodLiteral<"get">;
15
- path: z.ZodString;
16
- }, z.core.$strip>;
17
- type GetExpr = z.infer<typeof GetExpr>;
18
- declare const EqExpr: z.ZodType<{
19
- kind: "eq";
20
- left: ExprNode;
21
- right: ExprNode;
22
- }>;
23
- type EqExpr = z.infer<typeof EqExpr>;
24
- declare const NeqExpr: z.ZodType<{
25
- kind: "neq";
26
- left: ExprNode;
27
- right: ExprNode;
28
- }>;
29
- type NeqExpr = z.infer<typeof NeqExpr>;
30
- declare const GtExpr: z.ZodType<{
31
- kind: "gt";
32
- left: ExprNode;
33
- right: ExprNode;
34
- }>;
35
- type GtExpr = z.infer<typeof GtExpr>;
36
- declare const GteExpr: z.ZodType<{
37
- kind: "gte";
38
- left: ExprNode;
39
- right: ExprNode;
40
- }>;
41
- type GteExpr = z.infer<typeof GteExpr>;
42
- declare const LtExpr: z.ZodType<{
43
- kind: "lt";
44
- left: ExprNode;
45
- right: ExprNode;
46
- }>;
47
- type LtExpr = z.infer<typeof LtExpr>;
48
- declare const LteExpr: z.ZodType<{
49
- kind: "lte";
50
- left: ExprNode;
51
- right: ExprNode;
52
- }>;
53
- type LteExpr = z.infer<typeof LteExpr>;
54
- declare const AndExpr: z.ZodType<{
55
- kind: "and";
56
- args: ExprNode[];
57
- }>;
58
- type AndExpr = z.infer<typeof AndExpr>;
59
- declare const OrExpr: z.ZodType<{
60
- kind: "or";
61
- args: ExprNode[];
62
- }>;
63
- type OrExpr = z.infer<typeof OrExpr>;
64
- declare const NotExpr: z.ZodType<{
65
- kind: "not";
66
- arg: ExprNode;
67
- }>;
68
- type NotExpr = z.infer<typeof NotExpr>;
69
- declare const IfExpr: z.ZodType<{
70
- kind: "if";
71
- cond: ExprNode;
72
- then: ExprNode;
73
- else: ExprNode;
74
- }>;
75
- type IfExpr = z.infer<typeof IfExpr>;
76
- declare const AddExpr: z.ZodType<{
77
- kind: "add";
78
- left: ExprNode;
79
- right: ExprNode;
80
- }>;
81
- type AddExpr = z.infer<typeof AddExpr>;
82
- declare const SubExpr: z.ZodType<{
83
- kind: "sub";
84
- left: ExprNode;
85
- right: ExprNode;
86
- }>;
87
- type SubExpr = z.infer<typeof SubExpr>;
88
- declare const MulExpr: z.ZodType<{
89
- kind: "mul";
90
- left: ExprNode;
91
- right: ExprNode;
92
- }>;
93
- type MulExpr = z.infer<typeof MulExpr>;
94
- declare const DivExpr: z.ZodType<{
95
- kind: "div";
96
- left: ExprNode;
97
- right: ExprNode;
98
- }>;
99
- type DivExpr = z.infer<typeof DivExpr>;
100
- declare const ModExpr: z.ZodType<{
101
- kind: "mod";
102
- left: ExprNode;
103
- right: ExprNode;
104
- }>;
105
- type ModExpr = z.infer<typeof ModExpr>;
106
- declare const MinExpr: z.ZodType<{
107
- kind: "min";
108
- args: ExprNode[];
109
- }>;
110
- type MinExpr = z.infer<typeof MinExpr>;
111
- declare const MaxExpr: z.ZodType<{
112
- kind: "max";
113
- args: ExprNode[];
114
- }>;
115
- type MaxExpr = z.infer<typeof MaxExpr>;
116
- declare const AbsExpr: z.ZodType<{
117
- kind: "abs";
118
- arg: ExprNode;
119
- }>;
120
- type AbsExpr = z.infer<typeof AbsExpr>;
121
- declare const NegExpr: z.ZodType<{
122
- kind: "neg";
123
- arg: ExprNode;
124
- }>;
125
- type NegExpr = z.infer<typeof NegExpr>;
126
- declare const FloorExpr: z.ZodType<{
127
- kind: "floor";
128
- arg: ExprNode;
129
- }>;
130
- type FloorExpr = z.infer<typeof FloorExpr>;
131
- declare const CeilExpr: z.ZodType<{
132
- kind: "ceil";
133
- arg: ExprNode;
134
- }>;
135
- type CeilExpr = z.infer<typeof CeilExpr>;
136
- declare const RoundExpr: z.ZodType<{
137
- kind: "round";
138
- arg: ExprNode;
139
- }>;
140
- type RoundExpr = z.infer<typeof RoundExpr>;
141
- declare const SqrtExpr: z.ZodType<{
142
- kind: "sqrt";
143
- arg: ExprNode;
144
- }>;
145
- type SqrtExpr = z.infer<typeof SqrtExpr>;
146
- declare const PowExpr: z.ZodType<{
147
- kind: "pow";
148
- base: ExprNode;
149
- exponent: ExprNode;
150
- }>;
151
- type PowExpr = z.infer<typeof PowExpr>;
152
- declare const SumArrayExpr: z.ZodType<{
153
- kind: "sumArray";
154
- array: ExprNode;
155
- }>;
156
- type SumArrayExpr = z.infer<typeof SumArrayExpr>;
157
- declare const MinArrayExpr: z.ZodType<{
158
- kind: "minArray";
159
- array: ExprNode;
160
- }>;
161
- type MinArrayExpr = z.infer<typeof MinArrayExpr>;
162
- declare const MaxArrayExpr: z.ZodType<{
163
- kind: "maxArray";
164
- array: ExprNode;
165
- }>;
166
- type MaxArrayExpr = z.infer<typeof MaxArrayExpr>;
167
- declare const ConcatExpr: z.ZodType<{
168
- kind: "concat";
169
- args: ExprNode[];
170
- }>;
171
- type ConcatExpr = z.infer<typeof ConcatExpr>;
172
- declare const SubstringExpr: z.ZodType<{
173
- kind: "substring";
174
- str: ExprNode;
175
- start: ExprNode;
176
- end?: ExprNode;
177
- }>;
178
- type SubstringExpr = z.infer<typeof SubstringExpr>;
179
- declare const TrimExpr: z.ZodType<{
180
- kind: "trim";
181
- str: ExprNode;
182
- }>;
183
- type TrimExpr = z.infer<typeof TrimExpr>;
184
- declare const ToLowerCaseExpr: z.ZodType<{
185
- kind: "toLowerCase";
186
- str: ExprNode;
187
- }>;
188
- type ToLowerCaseExpr = z.infer<typeof ToLowerCaseExpr>;
189
- declare const ToUpperCaseExpr: z.ZodType<{
190
- kind: "toUpperCase";
191
- str: ExprNode;
192
- }>;
193
- type ToUpperCaseExpr = z.infer<typeof ToUpperCaseExpr>;
194
- declare const StrLenExpr: z.ZodType<{
195
- kind: "strLen";
196
- str: ExprNode;
197
- }>;
198
- type StrLenExpr = z.infer<typeof StrLenExpr>;
199
- declare const StartsWithExpr: z.ZodType<{
200
- kind: "startsWith";
201
- str: ExprNode;
202
- prefix: ExprNode;
203
- }>;
204
- type StartsWithExpr = z.infer<typeof StartsWithExpr>;
205
- declare const EndsWithExpr: z.ZodType<{
206
- kind: "endsWith";
207
- str: ExprNode;
208
- suffix: ExprNode;
209
- }>;
210
- type EndsWithExpr = z.infer<typeof EndsWithExpr>;
211
- declare const StrIncludesExpr: z.ZodType<{
212
- kind: "strIncludes";
213
- str: ExprNode;
214
- search: ExprNode;
215
- }>;
216
- type StrIncludesExpr = z.infer<typeof StrIncludesExpr>;
217
- declare const IndexOfExpr: z.ZodType<{
218
- kind: "indexOf";
219
- str: ExprNode;
220
- search: ExprNode;
221
- }>;
222
- type IndexOfExpr = z.infer<typeof IndexOfExpr>;
223
- declare const ReplaceExpr: z.ZodType<{
224
- kind: "replace";
225
- str: ExprNode;
226
- search: ExprNode;
227
- replacement: ExprNode;
228
- }>;
229
- type ReplaceExpr = z.infer<typeof ReplaceExpr>;
230
- declare const SplitExpr: z.ZodType<{
231
- kind: "split";
232
- str: ExprNode;
233
- delimiter: ExprNode;
234
- }>;
235
- type SplitExpr = z.infer<typeof SplitExpr>;
236
- declare const LenExpr: z.ZodType<{
237
- kind: "len";
238
- arg: ExprNode;
239
- }>;
240
- type LenExpr = z.infer<typeof LenExpr>;
241
- declare const AtExpr: z.ZodType<{
242
- kind: "at";
243
- array: ExprNode;
244
- index: ExprNode;
245
- }>;
246
- type AtExpr = z.infer<typeof AtExpr>;
247
- declare const FirstExpr: z.ZodType<{
248
- kind: "first";
249
- array: ExprNode;
250
- }>;
251
- type FirstExpr = z.infer<typeof FirstExpr>;
252
- declare const LastExpr: z.ZodType<{
253
- kind: "last";
254
- array: ExprNode;
255
- }>;
256
- type LastExpr = z.infer<typeof LastExpr>;
257
- declare const SliceExpr: z.ZodType<{
258
- kind: "slice";
259
- array: ExprNode;
260
- start: ExprNode;
261
- end?: ExprNode;
262
- }>;
263
- type SliceExpr = z.infer<typeof SliceExpr>;
264
- declare const IncludesExpr: z.ZodType<{
265
- kind: "includes";
266
- array: ExprNode;
267
- item: ExprNode;
268
- }>;
269
- type IncludesExpr = z.infer<typeof IncludesExpr>;
270
- declare const FilterExpr: z.ZodType<{
271
- kind: "filter";
272
- array: ExprNode;
273
- predicate: ExprNode;
274
- }>;
275
- type FilterExpr = z.infer<typeof FilterExpr>;
276
- declare const MapExpr: z.ZodType<{
277
- kind: "map";
278
- array: ExprNode;
279
- mapper: ExprNode;
280
- }>;
281
- type MapExpr = z.infer<typeof MapExpr>;
282
- declare const FindExpr: z.ZodType<{
283
- kind: "find";
284
- array: ExprNode;
285
- predicate: ExprNode;
286
- }>;
287
- type FindExpr = z.infer<typeof FindExpr>;
288
- declare const EveryExpr: z.ZodType<{
289
- kind: "every";
290
- array: ExprNode;
291
- predicate: ExprNode;
292
- }>;
293
- type EveryExpr = z.infer<typeof EveryExpr>;
294
- declare const SomeExpr: z.ZodType<{
295
- kind: "some";
296
- array: ExprNode;
297
- predicate: ExprNode;
298
- }>;
299
- type SomeExpr = z.infer<typeof SomeExpr>;
300
- declare const AppendExpr: z.ZodType<{
301
- kind: "append";
302
- array: ExprNode;
303
- items: ExprNode[];
304
- }>;
305
- type AppendExpr = z.infer<typeof AppendExpr>;
306
- declare const ReverseExpr: z.ZodType<{
307
- kind: "reverse";
308
- array: ExprNode;
309
- }>;
310
- type ReverseExpr = z.infer<typeof ReverseExpr>;
311
- declare const UniqueExpr: z.ZodType<{
312
- kind: "unique";
313
- array: ExprNode;
314
- }>;
315
- type UniqueExpr = z.infer<typeof UniqueExpr>;
316
- declare const FlatExpr: z.ZodType<{
317
- kind: "flat";
318
- array: ExprNode;
319
- }>;
320
- type FlatExpr = z.infer<typeof FlatExpr>;
321
- declare const ObjectExpr: z.ZodType<{
322
- kind: "object";
323
- fields: Record<string, ExprNode>;
324
- }>;
325
- type ObjectExpr = z.infer<typeof ObjectExpr>;
326
- declare const FieldExpr: z.ZodType<{
327
- kind: "field";
328
- object: ExprNode;
329
- property: string;
330
- }>;
331
- type FieldExpr = z.infer<typeof FieldExpr>;
332
- declare const KeysExpr: z.ZodType<{
333
- kind: "keys";
334
- obj: ExprNode;
335
- }>;
336
- type KeysExpr = z.infer<typeof KeysExpr>;
337
- declare const ValuesExpr: z.ZodType<{
338
- kind: "values";
339
- obj: ExprNode;
340
- }>;
341
- type ValuesExpr = z.infer<typeof ValuesExpr>;
342
- declare const EntriesExpr: z.ZodType<{
343
- kind: "entries";
344
- obj: ExprNode;
345
- }>;
346
- type EntriesExpr = z.infer<typeof EntriesExpr>;
347
- declare const MergeExpr: z.ZodType<{
348
- kind: "merge";
349
- objects: ExprNode[];
350
- }>;
351
- type MergeExpr = z.infer<typeof MergeExpr>;
352
- declare const HasKeyExpr: z.ZodType<{
353
- kind: "hasKey";
354
- obj: ExprNode;
355
- key: ExprNode;
356
- }>;
357
- type HasKeyExpr = z.infer<typeof HasKeyExpr>;
358
- declare const PickExpr: z.ZodType<{
359
- kind: "pick";
360
- obj: ExprNode;
361
- keys: ExprNode;
362
- }>;
363
- type PickExpr = z.infer<typeof PickExpr>;
364
- declare const OmitExpr: z.ZodType<{
365
- kind: "omit";
366
- obj: ExprNode;
367
- keys: ExprNode;
368
- }>;
369
- type OmitExpr = z.infer<typeof OmitExpr>;
370
- declare const FromEntriesExpr: z.ZodType<{
371
- kind: "fromEntries";
372
- entries: ExprNode;
373
- }>;
374
- type FromEntriesExpr = z.infer<typeof FromEntriesExpr>;
375
- declare const TypeofExpr: z.ZodType<{
376
- kind: "typeof";
377
- arg: ExprNode;
378
- }>;
379
- type TypeofExpr = z.infer<typeof TypeofExpr>;
380
- declare const IsNullExpr: z.ZodType<{
381
- kind: "isNull";
382
- arg: ExprNode;
383
- }>;
384
- type IsNullExpr = z.infer<typeof IsNullExpr>;
385
- declare const CoalesceExpr: z.ZodType<{
386
- kind: "coalesce";
387
- args: ExprNode[];
388
- }>;
389
- type CoalesceExpr = z.infer<typeof CoalesceExpr>;
390
- declare const ToStringExpr: z.ZodType<{
391
- kind: "toString";
392
- arg: ExprNode;
393
- }>;
394
- type ToStringExpr = z.infer<typeof ToStringExpr>;
395
- declare const ToNumberExpr: z.ZodType<{
396
- kind: "toNumber";
397
- arg: ExprNode;
398
- }>;
399
- type ToNumberExpr = z.infer<typeof ToNumberExpr>;
400
- declare const ToBooleanExpr: z.ZodType<{
401
- kind: "toBoolean";
402
- arg: ExprNode;
403
- }>;
404
- type ToBooleanExpr = z.infer<typeof ToBooleanExpr>;
405
- declare const ExprNodeSchema: z.ZodType<ExprNode>;
406
- /**
407
- * Expression kinds enum for pattern matching
408
- */
409
- declare const ExprKind: z.ZodEnum<{
410
- object: "object";
411
- map: "map";
412
- lit: "lit";
413
- get: "get";
414
- merge: "merge";
415
- values: "values";
416
- keys: "keys";
417
- toString: "toString";
418
- concat: "concat";
419
- reverse: "reverse";
420
- slice: "slice";
421
- indexOf: "indexOf";
422
- every: "every";
423
- some: "some";
424
- filter: "filter";
425
- find: "find";
426
- entries: "entries";
427
- includes: "includes";
428
- flat: "flat";
429
- at: "at";
430
- replace: "replace";
431
- split: "split";
432
- substring: "substring";
433
- toLowerCase: "toLowerCase";
434
- toUpperCase: "toUpperCase";
435
- trim: "trim";
436
- endsWith: "endsWith";
437
- startsWith: "startsWith";
438
- sub: "sub";
439
- eq: "eq";
440
- neq: "neq";
441
- gt: "gt";
442
- gte: "gte";
443
- lt: "lt";
444
- lte: "lte";
445
- and: "and";
446
- or: "or";
447
- not: "not";
448
- if: "if";
449
- add: "add";
450
- mul: "mul";
451
- div: "div";
452
- mod: "mod";
453
- min: "min";
454
- max: "max";
455
- abs: "abs";
456
- neg: "neg";
457
- floor: "floor";
458
- ceil: "ceil";
459
- round: "round";
460
- sqrt: "sqrt";
461
- pow: "pow";
462
- sumArray: "sumArray";
463
- minArray: "minArray";
464
- maxArray: "maxArray";
465
- strLen: "strLen";
466
- strIncludes: "strIncludes";
467
- len: "len";
468
- first: "first";
469
- last: "last";
470
- append: "append";
471
- unique: "unique";
472
- field: "field";
473
- hasKey: "hasKey";
474
- pick: "pick";
475
- omit: "omit";
476
- fromEntries: "fromEntries";
477
- typeof: "typeof";
478
- isNull: "isNull";
479
- coalesce: "coalesce";
480
- toNumber: "toNumber";
481
- toBoolean: "toBoolean";
482
- }>;
483
- type ExprKind = z.infer<typeof ExprKind>;
484
-
485
- /**
486
- * FlowNode - Declarative state transition programs
487
- * Flows do NOT execute; they describe.
488
- * Flows do NOT return values; they modify Snapshot.
489
- * Flows are NOT Turing-complete; they always terminate.
490
- */
491
- type FlowNode = SeqFlow | IfFlow | PatchFlow | EffectFlow | CallFlow | HaltFlow | FailFlow;
492
- /**
493
- * Patch operations
494
- */
495
- declare const PatchOp: z.ZodEnum<{
496
- set: "set";
497
- unset: "unset";
498
- merge: "merge";
499
- }>;
500
- type PatchOp = z.infer<typeof PatchOp>;
501
- /**
502
- * seq - Execute steps in order
503
- */
504
- declare const SeqFlow: z.ZodType<{
505
- kind: "seq";
506
- steps: FlowNode[];
507
- }>;
508
- type SeqFlow = z.infer<typeof SeqFlow>;
509
- /**
510
- * if - Conditional execution
511
- */
512
- declare const IfFlow: z.ZodType<{
513
- kind: "if";
514
- cond: ExprNode;
515
- then: FlowNode;
516
- else?: FlowNode;
517
- }>;
518
- type IfFlow = z.infer<typeof IfFlow>;
519
- /**
520
- * patch - State mutation declaration
521
- */
522
- declare const PatchFlow: z.ZodObject<{
523
- kind: z.ZodLiteral<"patch">;
524
- op: z.ZodEnum<{
525
- set: "set";
526
- unset: "unset";
527
- merge: "merge";
528
- }>;
529
- path: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
530
- kind: z.ZodLiteral<"prop">;
531
- name: z.ZodString;
532
- }, z.core.$strip>, z.ZodObject<{
533
- kind: z.ZodLiteral<"index">;
534
- index: z.ZodNumber;
535
- }, z.core.$strip>], "kind">>;
536
- value: z.ZodOptional<z.ZodType<ExprNode, unknown, z.core.$ZodTypeInternals<ExprNode, unknown>>>;
537
- }, z.core.$strip>;
538
- type PatchFlow = z.infer<typeof PatchFlow>;
539
- /**
540
- * effect - External operation requirement declaration
541
- * Effects are NOT executed by Core. They are declarations recorded in Snapshot.
542
- */
543
- declare const EffectFlow: z.ZodObject<{
544
- kind: z.ZodLiteral<"effect">;
545
- type: z.ZodString;
546
- params: z.ZodRecord<z.ZodString, z.ZodType<ExprNode, unknown, z.core.$ZodTypeInternals<ExprNode, unknown>>>;
547
- }, z.core.$strip>;
548
- type EffectFlow = z.infer<typeof EffectFlow>;
549
- /**
550
- * call - Invoke another flow by name
551
- * Does NOT pass arguments or return values.
552
- * The called Flow reads from the same Snapshot.
553
- */
554
- declare const CallFlow: z.ZodObject<{
555
- kind: z.ZodLiteral<"call">;
556
- flow: z.ZodString;
557
- }, z.core.$strip>;
558
- type CallFlow = z.infer<typeof CallFlow>;
559
- /**
560
- * halt - Stop flow execution normally (not an error)
561
- */
562
- declare const HaltFlow: z.ZodObject<{
563
- kind: z.ZodLiteral<"halt">;
564
- reason: z.ZodOptional<z.ZodString>;
565
- }, z.core.$strip>;
566
- type HaltFlow = z.infer<typeof HaltFlow>;
567
- /**
568
- * fail - Stop flow execution with an error
569
- * The error is recorded in Snapshot.
570
- */
571
- declare const FailFlow: z.ZodObject<{
572
- kind: z.ZodLiteral<"fail">;
573
- code: z.ZodString;
574
- message: z.ZodOptional<z.ZodType<ExprNode, unknown, z.core.$ZodTypeInternals<ExprNode, unknown>>>;
575
- }, z.core.$strip>;
576
- type FailFlow = z.infer<typeof FailFlow>;
577
- declare const FlowNodeSchema: z.ZodType<FlowNode>;
578
- /**
579
- * Flow node kinds enum
580
- */
581
- declare const FlowKind: z.ZodEnum<{
582
- patch: "patch";
583
- effect: "effect";
584
- call: "call";
585
- halt: "halt";
586
- fail: "fail";
587
- if: "if";
588
- seq: "seq";
589
- }>;
590
- type FlowKind = z.infer<typeof FlowKind>;
591
-
592
- /**
593
- * Field type definitions
594
- */
595
- declare const PrimitiveFieldType: z.ZodEnum<{
596
- string: "string";
597
- number: "number";
598
- boolean: "boolean";
599
- object: "object";
600
- null: "null";
601
- array: "array";
602
- }>;
603
- type PrimitiveFieldType = z.infer<typeof PrimitiveFieldType>;
604
- declare const EnumFieldType: z.ZodObject<{
605
- enum: z.ZodReadonly<z.ZodArray<z.ZodUnknown>>;
606
- }, z.core.$strip>;
607
- type EnumFieldType = z.infer<typeof EnumFieldType>;
608
- declare const FieldType: z.ZodUnion<readonly [z.ZodEnum<{
609
- string: "string";
610
- number: "number";
611
- boolean: "boolean";
612
- object: "object";
613
- null: "null";
614
- array: "array";
615
- }>, z.ZodObject<{
616
- enum: z.ZodReadonly<z.ZodArray<z.ZodUnknown>>;
617
- }, z.core.$strip>]>;
618
- type FieldType = z.infer<typeof FieldType>;
619
- /**
620
- * Field specification (recursive for nested objects/arrays)
621
- */
622
- type FieldSpec = {
623
- type: FieldType;
624
- required: boolean;
625
- default?: unknown;
626
- description?: string;
627
- fields?: Record<string, FieldSpec>;
628
- items?: FieldSpec;
629
- };
630
- declare const FieldSpec: z.ZodType<FieldSpec>;
631
- /**
632
- * State specification - defines the shape of domain state
633
- */
634
- declare const StateSpec: z.ZodObject<{
635
- fields: z.ZodRecord<z.ZodString, z.ZodType<FieldSpec, unknown, z.core.$ZodTypeInternals<FieldSpec, unknown>>>;
636
- }, z.core.$strip>;
637
- type StateSpec = z.infer<typeof StateSpec>;
638
-
639
- type TypeDefinition = {
640
- kind: "primitive";
641
- type: string;
642
- } | {
643
- kind: "array";
644
- element: TypeDefinition;
645
- } | {
646
- kind: "record";
647
- key: TypeDefinition;
648
- value: TypeDefinition;
649
- } | {
650
- kind: "object";
651
- fields: Record<string, {
652
- type: TypeDefinition;
653
- optional: boolean;
654
- }>;
655
- } | {
656
- kind: "union";
657
- types: TypeDefinition[];
658
- } | {
659
- kind: "literal";
660
- value: string | number | boolean | null;
661
- } | {
662
- kind: "ref";
663
- name: string;
664
- };
665
- declare const TypeDefinition: z.ZodType<TypeDefinition>;
666
- declare const TypeSpec: z.ZodObject<{
667
- name: z.ZodString;
668
- definition: z.ZodType<TypeDefinition, unknown, z.core.$ZodTypeInternals<TypeDefinition, unknown>>;
669
- }, z.core.$strip>;
670
- type TypeSpec = z.infer<typeof TypeSpec>;
671
-
672
- /**
673
- * Schema metadata
674
- */
675
- declare const SchemaMeta: z.ZodObject<{
676
- name: z.ZodOptional<z.ZodString>;
677
- description: z.ZodOptional<z.ZodString>;
678
- authors: z.ZodOptional<z.ZodArray<z.ZodString>>;
679
- }, z.core.$strip>;
680
- type SchemaMeta = z.infer<typeof SchemaMeta>;
681
- /**
682
- * DomainSchema - Complete schema definition
683
- *
684
- * Defines:
685
- * - What the domain looks like (StateSpec)
686
- * - What can be derived (ComputedSpec)
687
- * - How state transitions occur (Actions → FlowSpec)
688
- */
689
- declare const DomainSchema: z.ZodObject<{
690
- id: z.ZodString;
691
- version: z.ZodString;
692
- hash: z.ZodString;
693
- types: z.ZodRecord<z.ZodString, z.ZodObject<{
694
- name: z.ZodString;
695
- definition: z.ZodType<TypeDefinition, unknown, z.core.$ZodTypeInternals<TypeDefinition, unknown>>;
696
- }, z.core.$strip>>;
697
- state: z.ZodObject<{
698
- fields: z.ZodRecord<z.ZodString, z.ZodType<FieldSpec, unknown, z.core.$ZodTypeInternals<FieldSpec, unknown>>>;
699
- }, z.core.$strip>;
700
- computed: z.ZodObject<{
701
- fields: z.ZodRecord<z.ZodString, z.ZodObject<{
702
- deps: z.ZodArray<z.ZodString>;
703
- expr: z.ZodType<ExprNode, unknown, z.core.$ZodTypeInternals<ExprNode, unknown>>;
704
- description: z.ZodOptional<z.ZodString>;
705
- }, z.core.$strip>>;
706
- }, z.core.$strip>;
707
- actions: z.ZodRecord<z.ZodString, z.ZodObject<{
708
- flow: z.ZodType<FlowNode, unknown, z.core.$ZodTypeInternals<FlowNode, unknown>>;
709
- input: z.ZodOptional<z.ZodType<FieldSpec, unknown, z.core.$ZodTypeInternals<FieldSpec, unknown>>>;
710
- available: z.ZodOptional<z.ZodType<ExprNode, unknown, z.core.$ZodTypeInternals<ExprNode, unknown>>>;
711
- description: z.ZodOptional<z.ZodString>;
712
- }, z.core.$strip>>;
713
- meta: z.ZodOptional<z.ZodObject<{
714
- name: z.ZodOptional<z.ZodString>;
715
- description: z.ZodOptional<z.ZodString>;
716
- authors: z.ZodOptional<z.ZodArray<z.ZodString>>;
717
- }, z.core.$strip>>;
718
- }, z.core.$strip>;
719
- type DomainSchema = z.infer<typeof DomainSchema>;
720
-
721
- /**
722
- * ErrorValue - Errors are values in Snapshot, not exceptions.
723
- */
724
- declare const ErrorValue: z.ZodObject<{
725
- code: z.ZodString;
726
- message: z.ZodString;
727
- source: z.ZodObject<{
728
- actionId: z.ZodString;
729
- nodePath: z.ZodString;
730
- }, z.core.$strip>;
731
- timestamp: z.ZodNumber;
732
- context: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
733
- }, z.core.$strip>;
734
- type ErrorValue = z.infer<typeof ErrorValue>;
735
- /**
736
- * FlowPosition - Position in the flow where effect was encountered
737
- */
738
- declare const FlowPosition: z.ZodObject<{
739
- nodePath: z.ZodString;
740
- snapshotVersion: z.ZodNumber;
741
- }, z.core.$strip>;
742
- type FlowPosition = z.infer<typeof FlowPosition>;
743
- /**
744
- * Requirement - A recorded effect declaration waiting for Host fulfillment
745
- */
746
- declare const Requirement: z.ZodObject<{
747
- id: z.ZodString;
748
- type: z.ZodString;
749
- params: z.ZodRecord<z.ZodString, z.ZodUnknown>;
750
- actionId: z.ZodString;
751
- flowPosition: z.ZodObject<{
752
- nodePath: z.ZodString;
753
- snapshotVersion: z.ZodNumber;
754
- }, z.core.$strip>;
755
- createdAt: z.ZodNumber;
756
- }, z.core.$strip>;
757
- type Requirement = z.infer<typeof Requirement>;
758
- /**
759
- * SystemState - Internal system state
760
- */
761
- declare const SystemState: z.ZodObject<{
762
- status: z.ZodEnum<{
763
- error: "error";
764
- idle: "idle";
765
- computing: "computing";
766
- pending: "pending";
767
- }>;
768
- lastError: z.ZodNullable<z.ZodObject<{
769
- code: z.ZodString;
770
- message: z.ZodString;
771
- source: z.ZodObject<{
772
- actionId: z.ZodString;
773
- nodePath: z.ZodString;
774
- }, z.core.$strip>;
775
- timestamp: z.ZodNumber;
776
- context: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
777
- }, z.core.$strip>>;
778
- pendingRequirements: z.ZodArray<z.ZodObject<{
779
- id: z.ZodString;
780
- type: z.ZodString;
781
- params: z.ZodRecord<z.ZodString, z.ZodUnknown>;
782
- actionId: z.ZodString;
783
- flowPosition: z.ZodObject<{
784
- nodePath: z.ZodString;
785
- snapshotVersion: z.ZodNumber;
786
- }, z.core.$strip>;
787
- createdAt: z.ZodNumber;
788
- }, z.core.$strip>>;
789
- currentAction: z.ZodNullable<z.ZodString>;
790
- }, z.core.$strip>;
791
- type SystemState = z.infer<typeof SystemState>;
792
- /**
793
- * SnapshotMeta - Snapshot metadata
794
- */
795
- declare const SnapshotMeta: z.ZodObject<{
796
- version: z.ZodNumber;
797
- timestamp: z.ZodNumber;
798
- randomSeed: z.ZodString;
799
- schemaHash: z.ZodString;
800
- }, z.core.$strip>;
801
- type SnapshotMeta = z.infer<typeof SnapshotMeta>;
802
- /**
803
- * Snapshot - Immutable, point-in-time representation of world state.
804
- * This is the ONLY medium of communication between Core and Host.
805
- */
806
- declare const Snapshot: z.ZodObject<{
807
- data: z.ZodUnknown;
808
- computed: z.ZodRecord<z.ZodString, z.ZodUnknown>;
809
- system: z.ZodObject<{
810
- status: z.ZodEnum<{
811
- error: "error";
812
- idle: "idle";
813
- computing: "computing";
814
- pending: "pending";
815
- }>;
816
- lastError: z.ZodNullable<z.ZodObject<{
817
- code: z.ZodString;
818
- message: z.ZodString;
819
- source: z.ZodObject<{
820
- actionId: z.ZodString;
821
- nodePath: z.ZodString;
822
- }, z.core.$strip>;
823
- timestamp: z.ZodNumber;
824
- context: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
825
- }, z.core.$strip>>;
826
- pendingRequirements: z.ZodArray<z.ZodObject<{
827
- id: z.ZodString;
828
- type: z.ZodString;
829
- params: z.ZodRecord<z.ZodString, z.ZodUnknown>;
830
- actionId: z.ZodString;
831
- flowPosition: z.ZodObject<{
832
- nodePath: z.ZodString;
833
- snapshotVersion: z.ZodNumber;
834
- }, z.core.$strip>;
835
- createdAt: z.ZodNumber;
836
- }, z.core.$strip>>;
837
- currentAction: z.ZodNullable<z.ZodString>;
838
- }, z.core.$strip>;
839
- input: z.ZodUnknown;
840
- meta: z.ZodObject<{
841
- version: z.ZodNumber;
842
- timestamp: z.ZodNumber;
843
- randomSeed: z.ZodString;
844
- schemaHash: z.ZodString;
845
- }, z.core.$strip>;
846
- }, z.core.$strip>;
847
- type Snapshot = z.infer<typeof Snapshot>;
848
- /**
849
- * Create initial system state
850
- */
851
- declare function createInitialSystemState(): SystemState;
852
-
853
- /**
854
- * PatchSegment - A single segment in a patch path.
855
- */
856
- declare const PatchSegment: z.ZodDiscriminatedUnion<[z.ZodObject<{
857
- kind: z.ZodLiteral<"prop">;
858
- name: z.ZodString;
859
- }, z.core.$strip>, z.ZodObject<{
860
- kind: z.ZodLiteral<"index">;
861
- index: z.ZodNumber;
862
- }, z.core.$strip>], "kind">;
863
- type PatchSegment = z.infer<typeof PatchSegment>;
864
- /**
865
- * PatchPath - Path segments rooted at snapshot.data.
866
- */
867
- declare const PatchPath: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
868
- kind: z.ZodLiteral<"prop">;
869
- name: z.ZodString;
870
- }, z.core.$strip>, z.ZodObject<{
871
- kind: z.ZodLiteral<"index">;
872
- index: z.ZodNumber;
873
- }, z.core.$strip>], "kind">>;
874
- type PatchPath = z.infer<typeof PatchPath>;
875
- /**
876
- * Patch - A single state modification operation.
877
- * Only three operations: set, unset, merge.
878
- */
879
- declare const Patch: z.ZodDiscriminatedUnion<[z.ZodObject<{
880
- op: z.ZodLiteral<"set">;
881
- path: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
882
- kind: z.ZodLiteral<"prop">;
883
- name: z.ZodString;
884
- }, z.core.$strip>, z.ZodObject<{
885
- kind: z.ZodLiteral<"index">;
886
- index: z.ZodNumber;
887
- }, z.core.$strip>], "kind">>;
888
- value: z.ZodUnknown;
889
- }, z.core.$strip>, z.ZodObject<{
890
- op: z.ZodLiteral<"unset">;
891
- path: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
892
- kind: z.ZodLiteral<"prop">;
893
- name: z.ZodString;
894
- }, z.core.$strip>, z.ZodObject<{
895
- kind: z.ZodLiteral<"index">;
896
- index: z.ZodNumber;
897
- }, z.core.$strip>], "kind">>;
898
- }, z.core.$strip>, z.ZodObject<{
899
- op: z.ZodLiteral<"merge">;
900
- path: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
901
- kind: z.ZodLiteral<"prop">;
902
- name: z.ZodString;
903
- }, z.core.$strip>, z.ZodObject<{
904
- kind: z.ZodLiteral<"index">;
905
- index: z.ZodNumber;
906
- }, z.core.$strip>], "kind">>;
907
- value: z.ZodRecord<z.ZodString, z.ZodUnknown>;
908
- }, z.core.$strip>], "op">;
909
- type Patch = z.infer<typeof Patch>;
910
- /**
911
- * SetPatch - Set value at path
912
- */
913
- type SetPatch = Extract<Patch, {
914
- op: "set";
915
- }>;
916
- /**
917
- * UnsetPatch - Remove value at path
918
- */
919
- type UnsetPatch = Extract<Patch, {
920
- op: "unset";
921
- }>;
922
- /**
923
- * MergePatch - Shallow merge object at path
924
- */
925
- type MergePatch = Extract<Patch, {
926
- op: "merge";
927
- }>;
928
- /**
929
- * Intent - A request to perform an action
930
- */
931
- declare const Intent: z.ZodObject<{
932
- type: z.ZodString;
933
- input: z.ZodOptional<z.ZodUnknown>;
934
- intentId: z.ZodString;
935
- }, z.core.$strip>;
936
- type Intent = z.infer<typeof Intent>;
937
- /**
938
- * Helper to create a prop segment
939
- */
940
- declare function propSegment(name: string): PatchSegment;
941
- /**
942
- * Helper to create an index segment
943
- */
944
- declare function indexSegment(index: number): PatchSegment;
945
- /**
946
- * Helper to create a set patch
947
- */
948
- declare function setPatch(path: PatchPath, value: unknown): SetPatch;
949
- /**
950
- * Helper to create an unset patch
951
- */
952
- declare function unsetPatch(path: PatchPath): UnsetPatch;
953
- /**
954
- * Helper to create a merge patch
955
- */
956
- declare function mergePatch(path: PatchPath, value: Record<string, unknown>): MergePatch;
957
-
958
- /**
959
- * Dot-separated path for accessing values (e.g., "user.profile.name")
960
- */
961
- declare const SemanticPath: z.ZodString;
962
- type SemanticPath = z.infer<typeof SemanticPath>;
963
- /**
964
- * Result type for functions that can fail without throwing
965
- */
966
- declare const Result: <T extends z.ZodTypeAny, E extends z.ZodTypeAny>(valueSchema: T, errorSchema: E) => z.ZodDiscriminatedUnion<[z.ZodObject<{
967
- ok: z.ZodLiteral<true>;
968
- value: T;
969
- }, z.core.$strip>, z.ZodObject<{
970
- ok: z.ZodLiteral<false>;
971
- error: E;
972
- }, z.core.$strip>], "ok">;
973
- type Result<T, E> = {
974
- ok: true;
975
- value: T;
976
- } | {
977
- ok: false;
978
- error: E;
979
- };
980
- /**
981
- * Helper functions for Result type
982
- */
983
- declare const ok: <T>(value: T) => Result<T, never>;
984
- declare const err: <E>(error: E) => Result<never, E>;
985
- declare const isOk: <T, E>(result: Result<T, E>) => result is {
986
- ok: true;
987
- value: T;
988
- };
989
- declare const isErr: <T, E>(result: Result<T, E>) => result is {
990
- ok: false;
991
- error: E;
992
- };
993
-
994
- /**
995
- * TraceNodeKind - Types of trace nodes
996
- */
997
- declare const TraceNodeKind: z.ZodEnum<{
998
- computed: "computed";
999
- error: "error";
1000
- expr: "expr";
1001
- flow: "flow";
1002
- patch: "patch";
1003
- effect: "effect";
1004
- call: "call";
1005
- halt: "halt";
1006
- branch: "branch";
1007
- }>;
1008
- type TraceNodeKind = z.infer<typeof TraceNodeKind>;
1009
- /**
1010
- * TraceNode - A single node in the execution trace.
1011
- * Enables explainability - every computation produces a trace.
1012
- */
1013
- type TraceNode = {
1014
- /**
1015
- * Unique identifier for this trace node
1016
- */
1017
- id: string;
1018
- /**
1019
- * Type of trace node
1020
- */
1021
- kind: TraceNodeKind;
1022
- /**
1023
- * Path in the schema that produced this trace
1024
- */
1025
- sourcePath: string;
1026
- /**
1027
- * Input values at this point
1028
- */
1029
- inputs: Record<string, unknown>;
1030
- /**
1031
- * Output value produced
1032
- */
1033
- output: unknown;
1034
- /**
1035
- * Child trace nodes
1036
- */
1037
- children: TraceNode[];
1038
- /**
1039
- * Timestamp
1040
- */
1041
- timestamp: number;
1042
- };
1043
- declare const TraceNode: z.ZodType<TraceNode>;
1044
- /**
1045
- * TraceTermination - How the computation ended
1046
- */
1047
- declare const TraceTermination: z.ZodEnum<{
1048
- error: "error";
1049
- effect: "effect";
1050
- halt: "halt";
1051
- complete: "complete";
1052
- }>;
1053
- type TraceTermination = z.infer<typeof TraceTermination>;
1054
- /**
1055
- * TraceGraph - Complete trace of a computation
1056
- */
1057
- declare const TraceGraph: z.ZodObject<{
1058
- root: z.ZodType<TraceNode, unknown, z.core.$ZodTypeInternals<TraceNode, unknown>>;
1059
- nodes: z.ZodRecord<z.ZodString, z.ZodType<TraceNode, unknown, z.core.$ZodTypeInternals<TraceNode, unknown>>>;
1060
- intent: z.ZodObject<{
1061
- type: z.ZodString;
1062
- input: z.ZodUnknown;
1063
- }, z.core.$strip>;
1064
- baseVersion: z.ZodNumber;
1065
- resultVersion: z.ZodNumber;
1066
- duration: z.ZodNumber;
1067
- terminatedBy: z.ZodEnum<{
1068
- error: "error";
1069
- effect: "effect";
1070
- halt: "halt";
1071
- complete: "complete";
1072
- }>;
1073
- }, z.core.$strip>;
1074
- type TraceGraph = z.infer<typeof TraceGraph>;
1075
- /**
1076
- * TraceContext - Deterministic trace ID generation
1077
- */
1078
- type TraceContext = {
1079
- readonly nextId: () => string;
1080
- readonly timestamp: number;
1081
- };
1082
- /**
1083
- * Create a trace context for a single compute pass
1084
- */
1085
- declare function createTraceContext(timestamp: number): TraceContext;
1086
- /**
1087
- * Create a trace node
1088
- */
1089
- declare function createTraceNode(trace: TraceContext, kind: TraceNodeKind, sourcePath: string, inputs: Record<string, unknown>, output: unknown, children?: TraceNode[]): TraceNode;
1090
-
1091
- /**
1092
- * ComputeStatus - Result of a compute() call
1093
- */
1094
- declare const ComputeStatus: z.ZodEnum<{
1095
- error: "error";
1096
- pending: "pending";
1097
- complete: "complete";
1098
- halted: "halted";
1099
- }>;
1100
- type ComputeStatus = z.infer<typeof ComputeStatus>;
1101
- /**
1102
- * SystemDelta - Declarative system transition emitted by compute().
1103
- */
1104
- declare const SystemDelta: z.ZodObject<{
1105
- status: z.ZodOptional<z.ZodEnum<{
1106
- error: "error";
1107
- idle: "idle";
1108
- computing: "computing";
1109
- pending: "pending";
1110
- }>>;
1111
- currentAction: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1112
- lastError: z.ZodOptional<z.ZodNullable<z.ZodObject<{
1113
- code: z.ZodString;
1114
- message: z.ZodString;
1115
- source: z.ZodObject<{
1116
- actionId: z.ZodString;
1117
- nodePath: z.ZodString;
1118
- }, z.core.$strip>;
1119
- timestamp: z.ZodNumber;
1120
- context: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1121
- }, z.core.$strip>>>;
1122
- addRequirements: z.ZodArray<z.ZodObject<{
1123
- id: z.ZodString;
1124
- type: z.ZodString;
1125
- params: z.ZodRecord<z.ZodString, z.ZodUnknown>;
1126
- actionId: z.ZodString;
1127
- flowPosition: z.ZodObject<{
1128
- nodePath: z.ZodString;
1129
- snapshotVersion: z.ZodNumber;
1130
- }, z.core.$strip>;
1131
- createdAt: z.ZodNumber;
1132
- }, z.core.$strip>>;
1133
- removeRequirementIds: z.ZodArray<z.ZodString>;
1134
- }, z.core.$strip>;
1135
- type SystemDelta = z.infer<typeof SystemDelta>;
1136
- /**
1137
- * ComputeResult - Result of compute() call
1138
- */
1139
- declare const ComputeResult: z.ZodObject<{
1140
- patches: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
1141
- op: z.ZodLiteral<"set">;
1142
- path: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
1143
- kind: z.ZodLiteral<"prop">;
1144
- name: z.ZodString;
1145
- }, z.core.$strip>, z.ZodObject<{
1146
- kind: z.ZodLiteral<"index">;
1147
- index: z.ZodNumber;
1148
- }, z.core.$strip>], "kind">>;
1149
- value: z.ZodUnknown;
1150
- }, z.core.$strip>, z.ZodObject<{
1151
- op: z.ZodLiteral<"unset">;
1152
- path: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
1153
- kind: z.ZodLiteral<"prop">;
1154
- name: z.ZodString;
1155
- }, z.core.$strip>, z.ZodObject<{
1156
- kind: z.ZodLiteral<"index">;
1157
- index: z.ZodNumber;
1158
- }, z.core.$strip>], "kind">>;
1159
- }, z.core.$strip>, z.ZodObject<{
1160
- op: z.ZodLiteral<"merge">;
1161
- path: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
1162
- kind: z.ZodLiteral<"prop">;
1163
- name: z.ZodString;
1164
- }, z.core.$strip>, z.ZodObject<{
1165
- kind: z.ZodLiteral<"index">;
1166
- index: z.ZodNumber;
1167
- }, z.core.$strip>], "kind">>;
1168
- value: z.ZodRecord<z.ZodString, z.ZodUnknown>;
1169
- }, z.core.$strip>], "op">>;
1170
- systemDelta: z.ZodObject<{
1171
- status: z.ZodOptional<z.ZodEnum<{
1172
- error: "error";
1173
- idle: "idle";
1174
- computing: "computing";
1175
- pending: "pending";
1176
- }>>;
1177
- currentAction: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1178
- lastError: z.ZodOptional<z.ZodNullable<z.ZodObject<{
1179
- code: z.ZodString;
1180
- message: z.ZodString;
1181
- source: z.ZodObject<{
1182
- actionId: z.ZodString;
1183
- nodePath: z.ZodString;
1184
- }, z.core.$strip>;
1185
- timestamp: z.ZodNumber;
1186
- context: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1187
- }, z.core.$strip>>>;
1188
- addRequirements: z.ZodArray<z.ZodObject<{
1189
- id: z.ZodString;
1190
- type: z.ZodString;
1191
- params: z.ZodRecord<z.ZodString, z.ZodUnknown>;
1192
- actionId: z.ZodString;
1193
- flowPosition: z.ZodObject<{
1194
- nodePath: z.ZodString;
1195
- snapshotVersion: z.ZodNumber;
1196
- }, z.core.$strip>;
1197
- createdAt: z.ZodNumber;
1198
- }, z.core.$strip>>;
1199
- removeRequirementIds: z.ZodArray<z.ZodString>;
1200
- }, z.core.$strip>;
1201
- trace: z.ZodObject<{
1202
- root: z.ZodType<TraceNode, unknown, z.core.$ZodTypeInternals<TraceNode, unknown>>;
1203
- nodes: z.ZodRecord<z.ZodString, z.ZodType<TraceNode, unknown, z.core.$ZodTypeInternals<TraceNode, unknown>>>;
1204
- intent: z.ZodObject<{
1205
- type: z.ZodString;
1206
- input: z.ZodUnknown;
1207
- }, z.core.$strip>;
1208
- baseVersion: z.ZodNumber;
1209
- resultVersion: z.ZodNumber;
1210
- duration: z.ZodNumber;
1211
- terminatedBy: z.ZodEnum<{
1212
- error: "error";
1213
- effect: "effect";
1214
- halt: "halt";
1215
- complete: "complete";
1216
- }>;
1217
- }, z.core.$strip>;
1218
- status: z.ZodEnum<{
1219
- error: "error";
1220
- pending: "pending";
1221
- complete: "complete";
1222
- halted: "halted";
1223
- }>;
1224
- }, z.core.$strip>;
1225
- type ComputeResult = z.infer<typeof ComputeResult>;
1226
- /**
1227
- * ValidationError - Single validation error
1228
- */
1229
- declare const ValidationError: z.ZodObject<{
1230
- code: z.ZodString;
1231
- message: z.ZodString;
1232
- path: z.ZodOptional<z.ZodString>;
1233
- }, z.core.$strip>;
1234
- type ValidationError = z.infer<typeof ValidationError>;
1235
- /**
1236
- * ValidationResult - Result of validate() call
1237
- */
1238
- declare const ValidationResult: z.ZodObject<{
1239
- valid: z.ZodBoolean;
1240
- errors: z.ZodArray<z.ZodObject<{
1241
- code: z.ZodString;
1242
- message: z.ZodString;
1243
- path: z.ZodOptional<z.ZodString>;
1244
- }, z.core.$strip>>;
1245
- }, z.core.$strip>;
1246
- type ValidationResult = z.infer<typeof ValidationResult>;
1247
- /**
1248
- * ExplainResult - Result of explain() call
1249
- */
1250
- declare const ExplainResult: z.ZodObject<{
1251
- value: z.ZodUnknown;
1252
- trace: z.ZodType<TraceNode, unknown, z.core.$ZodTypeInternals<TraceNode, unknown>>;
1253
- deps: z.ZodArray<z.ZodString>;
1254
- }, z.core.$strip>;
1255
- type ExplainResult = z.infer<typeof ExplainResult>;
1256
- /**
1257
- * Create a successful validation result
1258
- */
1259
- declare function validResult(): ValidationResult;
1260
- /**
1261
- * Create a failed validation result
1262
- */
1263
- declare function invalidResult(errors: ValidationError[]): ValidationResult;
1264
-
1265
- /**
1266
- * HostContext - Explicit host-provided inputs for determinism
1267
- */
1268
- declare const HostContext: z.ZodObject<{
1269
- now: z.ZodNumber;
1270
- randomSeed: z.ZodString;
1271
- env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1272
- durationMs: z.ZodOptional<z.ZodNumber>;
1273
- }, z.core.$strip>;
1274
- type HostContext = z.infer<typeof HostContext>;
1275
-
1276
- /**
1277
- * Compute the result of dispatching an intent (synchronous).
1278
- *
1279
- * This is the canonical computation path. Each call is independent -
1280
- * there is no suspended context.
1281
- */
1282
- declare function computeSync(schema: DomainSchema, snapshot: Snapshot, intent: Intent, context: HostContext): ComputeResult;
1283
- /**
1284
- * Compute the result of dispatching an intent (async wrapper).
1285
- */
1286
- declare function compute(schema: DomainSchema, snapshot: Snapshot, intent: Intent, context: HostContext): Promise<ComputeResult>;
1287
-
1288
- /**
1289
- * Apply patches to snapshot.data and recompute computed values.
1290
- *
1291
- * Patch targets are rooted at snapshot.data only.
1292
- * System transitions are handled by applySystemDelta().
1293
- */
1294
- declare function apply(schema: DomainSchema, snapshot: Snapshot, patches: readonly Patch[], context: HostContext): Snapshot;
1295
-
1296
- /**
1297
- * Apply a declarative system transition to a snapshot.
1298
- *
1299
- * This function is pure, deterministic, and total.
1300
- */
1301
- declare function applySystemDelta(snapshot: Snapshot, delta: SystemDelta): Snapshot;
1302
-
1303
- /**
1304
- * Validate a domain schema
1305
- *
1306
- * Validation rules:
1307
- * - V-001: All paths in ComputedSpec.deps MUST exist
1308
- * - V-002: ComputedSpec dependency graph MUST be acyclic
1309
- * - V-003: All paths in ExprNode.get MUST exist
1310
- * - V-004: All `call` references in FlowSpec MUST exist
1311
- * - V-005: FlowSpec `call` graph MUST be acyclic
1312
- * - V-006: ActionSpec.available expression MUST return boolean (runtime check)
1313
- * - V-007: ActionSpec.input MUST be valid FieldSpec (Zod handles this)
1314
- * - V-008: Schema hash MUST match canonical hash
1315
- */
1316
- declare function validate(schema: unknown): ValidationResult;
1317
-
1318
- /**
1319
- * Explain why a value is what it is
1320
- *
1321
- * @param schema - The domain schema
1322
- * @param snapshot - Current snapshot state
1323
- * @param path - The path to explain
1324
- * @returns ExplainResult with value, trace, and dependencies
1325
- */
1326
- declare function explain(schema: DomainSchema, snapshot: Snapshot, path: SemanticPath): ExplainResult;
1327
-
1328
- /**
1329
- * Check whether an action is available for a new invocation.
1330
- */
1331
- declare function isActionAvailable(schema: DomainSchema, snapshot: Snapshot, actionName: string): boolean;
1332
- /**
1333
- * Return all currently dispatchable actions in schema key order.
1334
- */
1335
- declare function getAvailableActions(schema: DomainSchema, snapshot: Snapshot): readonly string[];
1336
-
1337
- /**
1338
- * ComputedFieldSpec - Definition of a single computed field
1339
- */
1340
- declare const ComputedFieldSpec: z.ZodObject<{
1341
- deps: z.ZodArray<z.ZodString>;
1342
- expr: z.ZodType<ExprNode, unknown, z.core.$ZodTypeInternals<ExprNode, unknown>>;
1343
- description: z.ZodOptional<z.ZodString>;
1344
- }, z.core.$strip>;
1345
- type ComputedFieldSpec = z.infer<typeof ComputedFieldSpec>;
1346
- /**
1347
- * ComputedSpec - Collection of computed field definitions
1348
- * Computed values form a Directed Acyclic Graph (DAG).
1349
- */
1350
- declare const ComputedSpec: z.ZodObject<{
1351
- fields: z.ZodRecord<z.ZodString, z.ZodObject<{
1352
- deps: z.ZodArray<z.ZodString>;
1353
- expr: z.ZodType<ExprNode, unknown, z.core.$ZodTypeInternals<ExprNode, unknown>>;
1354
- description: z.ZodOptional<z.ZodString>;
1355
- }, z.core.$strip>>;
1356
- }, z.core.$strip>;
1357
- type ComputedSpec = z.infer<typeof ComputedSpec>;
1358
-
1359
- /**
1360
- * ActionSpec - Maps intents to flows
1361
- * An action defines what happens when a particular intent is dispatched.
1362
- */
1363
- declare const ActionSpec: z.ZodObject<{
1364
- flow: z.ZodType<FlowNode, unknown, z.core.$ZodTypeInternals<FlowNode, unknown>>;
1365
- input: z.ZodOptional<z.ZodType<FieldSpec, unknown, z.core.$ZodTypeInternals<FieldSpec, unknown>>>;
1366
- available: z.ZodOptional<z.ZodType<ExprNode, unknown, z.core.$ZodTypeInternals<ExprNode, unknown>>>;
1367
- description: z.ZodOptional<z.ZodString>;
1368
- }, z.core.$strip>;
1369
- type ActionSpec = z.infer<typeof ActionSpec>;
1370
-
1371
- /**
1372
- * Extract top-level default values from a StateSpec.
1373
- *
1374
- * Iterates `stateSpec.fields` and collects fields with an explicit `default`.
1375
- * Returns a flat record of field names to default values.
1376
- *
1377
- * @param stateSpec - The state specification from a DomainSchema
1378
- * @returns Record of field names to their default values
1379
- */
1380
- declare function extractDefaults(stateSpec: StateSpec): Record<string, unknown>;
1381
-
1382
- /**
1383
- * Parse a dot-separated path into segments.
1384
- *
1385
- * Supports escaping literal dots inside segments via backslash (for example `a\\.b` -> `a.b`).
1386
- */
1387
- declare function parsePath(path: SemanticPath): string[];
1388
- /**
1389
- * Join path segments into a semantic path
1390
- */
1391
- declare function joinPath(...segments: string[]): SemanticPath;
1392
- /**
1393
- * Get value at path from object
1394
- * Returns undefined for non-existent paths (never throws)
1395
- */
1396
- declare function getByPath(obj: unknown, path: SemanticPath): unknown;
1397
- /**
1398
- * Immutably set value at path
1399
- * Creates intermediate objects as needed
1400
- */
1401
- declare function setByPath(obj: unknown, path: SemanticPath, value: unknown): unknown;
1402
- /**
1403
- * Immutably remove value at path
1404
- */
1405
- declare function unsetByPath(obj: unknown, path: SemanticPath): unknown;
1406
- /**
1407
- * Immutably shallow merge at path
1408
- */
1409
- declare function mergeAtPath(obj: unknown, path: SemanticPath, value: Record<string, unknown>): unknown;
1410
- /**
1411
- * Check if a path exists in an object
1412
- */
1413
- declare function hasPath(obj: unknown, path: SemanticPath): boolean;
1414
- /**
1415
- * Get parent path
1416
- */
1417
- declare function parentPath(path: SemanticPath): SemanticPath;
1418
- /**
1419
- * Get last segment of path
1420
- */
1421
- declare function lastSegment(path: SemanticPath): string;
1422
-
1423
- /**
1424
- * Canonical form utilities for deterministic hashing
1425
- *
1426
- * Algorithm:
1427
- * 1. Sort all object keys alphabetically (recursive)
1428
- * 2. Remove all keys with undefined value
1429
- * 3. Preserve keys with null value
1430
- * 4. Serialize using JSON with no whitespace
1431
- */
1432
- /**
1433
- * Recursively sort object keys alphabetically
1434
- */
1435
- declare function sortKeys(obj: unknown): unknown;
1436
- /**
1437
- * Convert object to canonical JSON string
1438
- * - Keys are sorted alphabetically
1439
- * - Undefined values are removed
1440
- * - No whitespace
1441
- */
1442
- declare function toCanonical(obj: unknown): string;
1443
- /**
1444
- * Canonicalize JSON per RFC 8785 (JCS)
1445
- * - Objects: keys sorted by Unicode code points
1446
- * - Arrays: preserve order
1447
- * - Undefined/function/symbol: omitted in objects, null in arrays
1448
- * - Non-finite numbers: null
1449
- */
1450
- declare function toJcs(value: unknown): string;
1451
- declare function compareUnicodeCodePoints(a: string, b: string): number;
1452
- /**
1453
- * Parse canonical JSON string
1454
- */
1455
- declare function fromCanonical<T>(canonical: string): T;
1456
- /**
1457
- * Check if two objects are equal in canonical form
1458
- */
1459
- declare function canonicalEqual(a: unknown, b: unknown): boolean;
1460
-
1461
- type SchemaHashMode = "semantic" | "effective";
1462
- type SchemaHashInput = {
1463
- id: string;
1464
- version: string;
1465
- types: Record<string, unknown>;
1466
- state: {
1467
- fields: Record<string, unknown>;
1468
- };
1469
- computed: {
1470
- fields: Record<string, {
1471
- deps: string[];
1472
- expr: unknown;
1473
- description?: string;
1474
- }>;
1475
- };
1476
- actions: Record<string, unknown>;
1477
- meta?: {
1478
- name?: string;
1479
- description?: string;
1480
- authors?: string[];
1481
- };
1482
- };
1483
- /**
1484
- * SHA-256 hash using Web Crypto API
1485
- * Works in both browser and Node.js
1486
- */
1487
- declare function sha256(message: string): Promise<string>;
1488
- /**
1489
- * SHA-256 hash using a synchronous pure JS implementation
1490
- */
1491
- declare function sha256Sync(message: string): string;
1492
- /**
1493
- * Hash a schema in canonical form
1494
- */
1495
- declare function hashSchema(schema: SchemaHashInput, mode?: SchemaHashMode): Promise<string>;
1496
- /**
1497
- * Hash a schema in canonical form (sync)
1498
- */
1499
- declare function hashSchemaSync(schema: SchemaHashInput, mode?: SchemaHashMode): string;
1500
- declare function hashSchemaEffective(schema: SchemaHashInput): Promise<string>;
1501
- declare function hashSchemaEffectiveSync(schema: SchemaHashInput): string;
1502
- /**
1503
- * Generate deterministic requirement ID
1504
- * Based on: schemaHash, intentId, actionId, flowNodePath
1505
- */
1506
- declare function generateRequirementId(schemaHash: string, intentId: string, actionId: string, flowNodePath: string): Promise<string>;
1507
- /**
1508
- * Generate deterministic requirement ID (sync)
1509
- */
1510
- declare function generateRequirementIdSync(schemaHash: string, intentId: string, actionId: string, flowNodePath: string): string;
1511
- /**
1512
- * Generate a trace node ID
1513
- */
1514
- declare function generateTraceId(index?: number): string;
1515
-
1516
- /**
1517
- * Render PatchPath for logs and error messages only.
1518
- */
1519
- declare function patchPathToDisplayString(path: PatchPath): string;
1520
- /**
1521
- * Convert a legacy semantic string path into PatchPath segments.
1522
- * This helper exists for internal bridging only.
1523
- */
1524
- declare function semanticPathToPatchPath(path: string): PatchPath;
1525
- declare function isSafePatchPath(path: PatchPath): boolean;
1526
- declare function getByPatchPath(obj: unknown, path: PatchPath): unknown;
1527
- declare function setByPatchPath(obj: unknown, path: PatchPath, value: unknown): unknown;
1528
- declare function unsetByPatchPath(obj: unknown, path: PatchPath): unknown;
1529
- declare function mergeAtPatchPath(obj: unknown, path: PatchPath, value: Record<string, unknown>): unknown;
1530
-
1531
- /**
1532
- * Evaluation context for expressions and flows
1533
- */
1534
- type EvalContext = {
1535
- /**
1536
- * Current snapshot state
1537
- */
1538
- readonly snapshot: Snapshot;
1539
- /**
1540
- * Domain schema
1541
- */
1542
- readonly schema: DomainSchema;
1543
- /**
1544
- * Current action being processed (if any)
1545
- */
1546
- readonly currentAction: string | null;
1547
- /**
1548
- * Current node path in the flow (for tracing)
1549
- */
1550
- readonly nodePath: string;
1551
- /**
1552
- * Intent ID for the current intent (for re-entry safety)
1553
- */
1554
- readonly intentId?: string;
1555
- /**
1556
- * UUID generator counter (for deterministic UUID generation)
1557
- */
1558
- uuidCounter?: number;
1559
- /**
1560
- * Trace context for deterministic trace ID generation
1561
- */
1562
- readonly trace: TraceContext;
1563
- /**
1564
- * Collection context variables (for filter, map, find, etc.)
1565
- */
1566
- readonly $item?: unknown;
1567
- readonly $index?: number;
1568
- readonly $array?: unknown[];
1569
- };
1570
- /**
1571
- * Create a new evaluation context
1572
- *
1573
- * @param timestampOrTrace - Required timestamp or TraceContext for deterministic tracing.
1574
- * MUST be provided by Host via HostContext.now to ensure determinism.
1575
- */
1576
- declare function createContext(snapshot: Snapshot, schema: DomainSchema, currentAction: string | null, nodePath: string, intentId: string | undefined, timestampOrTrace: number | TraceContext): EvalContext;
1577
- /**
1578
- * Create context with collection variables for filter/map/find/etc.
1579
- */
1580
- declare function withCollectionContext(ctx: EvalContext, item: unknown, index: number, array: unknown[]): EvalContext;
1581
- /**
1582
- * Update context with new snapshot
1583
- */
1584
- declare function withSnapshot(ctx: EvalContext, snapshot: Snapshot): EvalContext;
1585
- /**
1586
- * Update context with new node path
1587
- */
1588
- declare function withNodePath(ctx: EvalContext, nodePath: string): EvalContext;
1589
-
1590
- type ExprResult = Result<unknown, ErrorValue>;
1591
- /**
1592
- * Evaluate an expression node
1593
- * All expressions are pure and total (always return a value or error)
1594
- */
1595
- declare function evaluateExpr(expr: ExprNode, ctx: EvalContext): ExprResult;
1596
-
1597
- /**
1598
- * Flow execution status
1599
- */
1600
- type FlowStatus = "running" | "complete" | "pending" | "halted" | "error";
1601
- /**
1602
- * Flow execution state
1603
- */
1604
- type FlowState = {
1605
- readonly snapshot: Snapshot;
1606
- readonly status: FlowStatus;
1607
- readonly patches: readonly Patch[];
1608
- readonly requirements: readonly Requirement[];
1609
- readonly error: ErrorValue | null;
1610
- };
1611
- /**
1612
- * Flow evaluation result
1613
- */
1614
- type FlowResult = {
1615
- readonly state: FlowState;
1616
- readonly trace: TraceNode;
1617
- };
1618
- /**
1619
- * Create initial flow state
1620
- */
1621
- declare function createFlowState(snapshot: Snapshot): FlowState;
1622
- /**
1623
- * Evaluate a flow node
1624
- */
1625
- declare function evaluateFlowSync(flow: FlowNode, ctx: EvalContext, state: FlowState, nodePath: string): FlowResult;
1626
- declare function evaluateFlow(flow: FlowNode, ctx: EvalContext, state: FlowState, nodePath: string): Promise<FlowResult>;
1627
-
1628
- /**
1629
- * Dependency graph for computed values
1630
- */
1631
- type DependencyGraph = {
1632
- readonly nodes: readonly SemanticPath[];
1633
- readonly edges: ReadonlyMap<SemanticPath, readonly SemanticPath[]>;
1634
- };
1635
- /**
1636
- * Build a dependency graph from ComputedSpec
1637
- */
1638
- declare function buildDependencyGraph(computed: ComputedSpec): DependencyGraph;
1639
- /**
1640
- * Topological sort using Kahn's algorithm
1641
- * Returns sorted order or error if cycles detected
1642
- */
1643
- declare function topologicalSort(graph: DependencyGraph): Result<SemanticPath[], ValidationError>;
1644
- /**
1645
- * Detect cycles in the dependency graph
1646
- * Returns array of cycle paths or null if no cycles
1647
- */
1648
- declare function detectCycles(graph: DependencyGraph): SemanticPath[][] | null;
1649
- /**
1650
- * Get all dependencies (transitive) for a given node
1651
- */
1652
- declare function getTransitiveDeps(graph: DependencyGraph, node: SemanticPath): Set<SemanticPath>;
1653
-
1654
- /**
1655
- * Evaluate all computed values for a snapshot
1656
- * Returns the computed values record or an error
1657
- */
1658
- declare function evaluateComputed(schema: DomainSchema, snapshot: Snapshot): Result<Record<SemanticPath, unknown>, ErrorValue>;
1659
- /**
1660
- * Evaluate a single computed value
1661
- */
1662
- declare function evaluateSingleComputed(schema: DomainSchema, snapshot: Snapshot, path: SemanticPath): Result<unknown, ErrorValue>;
1663
-
1664
- /**
1665
- * Core error codes
1666
- */
1667
- declare const CoreErrorCode: z.ZodEnum<{
1668
- VALIDATION_ERROR: "VALIDATION_ERROR";
1669
- PATH_NOT_FOUND: "PATH_NOT_FOUND";
1670
- TYPE_MISMATCH: "TYPE_MISMATCH";
1671
- DIVISION_BY_ZERO: "DIVISION_BY_ZERO";
1672
- INDEX_OUT_OF_BOUNDS: "INDEX_OUT_OF_BOUNDS";
1673
- UNKNOWN_ACTION: "UNKNOWN_ACTION";
1674
- ACTION_UNAVAILABLE: "ACTION_UNAVAILABLE";
1675
- INVALID_INPUT: "INVALID_INPUT";
1676
- CYCLIC_DEPENDENCY: "CYCLIC_DEPENDENCY";
1677
- UNKNOWN_FLOW: "UNKNOWN_FLOW";
1678
- CYCLIC_CALL: "CYCLIC_CALL";
1679
- UNKNOWN_EFFECT: "UNKNOWN_EFFECT";
1680
- INTERNAL_ERROR: "INTERNAL_ERROR";
1681
- }>;
1682
- type CoreErrorCode = z.infer<typeof CoreErrorCode>;
1683
- /**
1684
- * Create an error value (errors are values, not exceptions)
1685
- */
1686
- declare function createError(code: CoreErrorCode, message: string, actionId: string, nodePath: string, timestamp: number, context?: Record<string, unknown>): ErrorValue;
1687
- /**
1688
- * Check if a value is an ErrorValue
1689
- */
1690
- declare function isErrorValue(value: unknown): value is ErrorValue;
1691
-
1692
- /**
1693
- * Create a new snapshot with initial data
1694
- *
1695
- * @param data - Initial domain data
1696
- * @param schemaHash - Hash of the schema this snapshot conforms to
1697
- * @returns New snapshot
1698
- */
1699
- declare function createSnapshot<T>(data: T, schemaHash: string, context: HostContext): Snapshot;
1700
- /**
1701
- * Create an intent
1702
- *
1703
- * @param type - Action type
1704
- * @param input - Action input (optional)
1705
- * @param intentId - Unique identifier for this processing attempt (optional, auto-generated if not provided)
1706
- * @returns Intent
1707
- */
1708
- declare function createIntent(type: string, intentId: string): Intent;
1709
- declare function createIntent(type: string, input: unknown, intentId: string): Intent;
1710
-
1711
1
  /**
1712
2
  * @manifesto-ai/core
1713
3
  *
@@ -1715,11 +5,22 @@ declare function createIntent(type: string, input: unknown, intentId: string): I
1715
5
  *
1716
6
  * Core computes. Host executes. These concerns never mix.
1717
7
  */
1718
-
8
+ import type { DomainSchema } from "./schema/domain.js";
9
+ import type { Snapshot } from "./schema/snapshot.js";
10
+ import type { Intent, Patch } from "./schema/patch.js";
11
+ import type { SemanticPath } from "./schema/common.js";
12
+ import type { ComputeResult, ValidationResult, ExplainResult, SystemDelta } from "./schema/result.js";
13
+ import type { HostContext } from "./schema/host-context.js";
14
+ import { compute, computeSync } from "./core/compute.js";
15
+ import { apply } from "./core/apply.js";
16
+ import { applySystemDelta } from "./core/system-delta.js";
17
+ import { validate } from "./core/validate.js";
18
+ import { explain } from "./core/explain.js";
19
+ import { getAvailableActions, isActionAvailable } from "./core/action-availability.js";
1719
20
  /**
1720
21
  * ManifestoCore interface
1721
22
  */
1722
- interface ManifestoCore {
23
+ export interface ManifestoCore {
1723
24
  /**
1724
25
  * Compute the result of dispatching an intent.
1725
26
  *
@@ -1760,6 +61,10 @@ interface ManifestoCore {
1760
61
  /**
1761
62
  * Create a ManifestoCore instance
1762
63
  */
1763
- declare function createCore(): ManifestoCore;
1764
-
1765
- export { AbsExpr, ActionSpec, AddExpr, AndExpr, AppendExpr, AtExpr, CallFlow, CeilExpr, CoalesceExpr, ComputeResult, ComputeStatus, ComputedFieldSpec, ComputedSpec, ConcatExpr, CoreErrorCode, type DependencyGraph, DivExpr, DomainSchema, EffectFlow, EndsWithExpr, EntriesExpr, EnumFieldType, EqExpr, ErrorValue, type EvalContext, EveryExpr, ExplainResult, ExprKind, type ExprNode, ExprNodeSchema, type ExprResult, FailFlow, FieldExpr, FieldSpec, FieldType, FilterExpr, FindExpr, FirstExpr, FlatExpr, FloorExpr, FlowKind, type FlowNode, FlowNodeSchema, FlowPosition, type FlowResult, type FlowState, type FlowStatus, FromEntriesExpr, GetExpr, GtExpr, GteExpr, HaltFlow, HasKeyExpr, HostContext, IfExpr, IfFlow, IncludesExpr, IndexOfExpr, Intent, IsNullExpr, KeysExpr, LastExpr, LenExpr, LitExpr, LtExpr, LteExpr, type ManifestoCore, MapExpr, MaxArrayExpr, MaxExpr, MergeExpr, type MergePatch, MinArrayExpr, MinExpr, ModExpr, MulExpr, NegExpr, NeqExpr, NotExpr, ObjectExpr, OmitExpr, OrExpr, Patch, PatchFlow, PatchOp, PatchPath, PatchSegment, PickExpr, PowExpr, PrimitiveFieldType, ReplaceExpr, Requirement, Result, ReverseExpr, RoundExpr, type SchemaHashInput, type SchemaHashMode, SchemaMeta, SemanticPath, SeqFlow, type SetPatch, SliceExpr, Snapshot, SnapshotMeta, SomeExpr, SplitExpr, SqrtExpr, StartsWithExpr, StateSpec, StrIncludesExpr, StrLenExpr, SubExpr, SubstringExpr, SumArrayExpr, SystemDelta, SystemState, ToBooleanExpr, ToLowerCaseExpr, ToNumberExpr, ToStringExpr, ToUpperCaseExpr, type TraceContext, TraceGraph, TraceNode, TraceNodeKind, TraceTermination, TrimExpr, TypeDefinition, TypeSpec, TypeofExpr, UniqueExpr, type UnsetPatch, ValidationError, ValidationResult, ValuesExpr, apply, applySystemDelta, buildDependencyGraph, canonicalEqual, compareUnicodeCodePoints, compute, computeSync, createContext, createCore, createError, createFlowState, createInitialSystemState, createIntent, createSnapshot, createTraceContext, createTraceNode, detectCycles, err, evaluateComputed, evaluateExpr, evaluateFlow, evaluateFlowSync, evaluateSingleComputed, explain, extractDefaults, fromCanonical, generateRequirementId, generateRequirementIdSync, generateTraceId, getAvailableActions, getByPatchPath, getByPath, getTransitiveDeps, hasPath, hashSchema, hashSchemaEffective, hashSchemaEffectiveSync, hashSchemaSync, indexSegment, invalidResult, isActionAvailable, isErr, isErrorValue, isOk, isSafePatchPath, joinPath, lastSegment, mergeAtPatchPath, mergeAtPath, mergePatch, ok, parentPath, parsePath, patchPathToDisplayString, propSegment, semanticPathToPatchPath, setByPatchPath, setByPath, setPatch, sha256, sha256Sync, sortKeys, toCanonical, toJcs, topologicalSort, unsetByPatchPath, unsetByPath, unsetPatch, validResult, validate, withCollectionContext, withNodePath, withSnapshot };
64
+ export declare function createCore(): ManifestoCore;
65
+ export * from "./schema/index.js";
66
+ export * from "./utils/index.js";
67
+ export * from "./evaluator/index.js";
68
+ export * from "./errors.js";
69
+ export * from "./factories.js";
70
+ export { compute, computeSync, apply, applySystemDelta, validate, explain, isActionAvailable, getAvailableActions, };