@manifesto-ai/core 2.6.0 → 2.6.1
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/README.md +4 -4
- package/dist/index.d.ts +1749 -19
- package/dist/index.js +18456 -36
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/dist/__tests__/apply.test.d.ts +0 -2
- package/dist/__tests__/apply.test.d.ts.map +0 -1
- package/dist/__tests__/apply.test.js +0 -320
- package/dist/__tests__/apply.test.js.map +0 -1
- package/dist/__tests__/defaults.test.d.ts +0 -2
- package/dist/__tests__/defaults.test.d.ts.map +0 -1
- package/dist/__tests__/defaults.test.js +0 -74
- package/dist/__tests__/defaults.test.js.map +0 -1
- package/dist/__tests__/jcs.test.d.ts +0 -2
- package/dist/__tests__/jcs.test.d.ts.map +0 -1
- package/dist/__tests__/jcs.test.js +0 -45
- package/dist/__tests__/jcs.test.js.map +0 -1
- package/dist/core/apply.d.ts +0 -17
- package/dist/core/apply.d.ts.map +0 -1
- package/dist/core/apply.js +0 -198
- package/dist/core/apply.js.map +0 -1
- package/dist/core/compute.d.ts +0 -17
- package/dist/core/compute.d.ts.map +0 -1
- package/dist/core/compute.js +0 -305
- package/dist/core/compute.js.map +0 -1
- package/dist/core/compute.test.d.ts +0 -2
- package/dist/core/compute.test.d.ts.map +0 -1
- package/dist/core/compute.test.js +0 -950
- package/dist/core/compute.test.js.map +0 -1
- package/dist/core/explain.d.ts +0 -14
- package/dist/core/explain.d.ts.map +0 -1
- package/dist/core/explain.js +0 -78
- package/dist/core/explain.js.map +0 -1
- package/dist/core/index.d.ts +0 -5
- package/dist/core/index.d.ts.map +0 -1
- package/dist/core/index.js +0 -5
- package/dist/core/index.js.map +0 -1
- package/dist/core/validate.d.ts +0 -16
- package/dist/core/validate.d.ts.map +0 -1
- package/dist/core/validate.js +0 -361
- package/dist/core/validate.js.map +0 -1
- package/dist/core/validate.test.d.ts +0 -2
- package/dist/core/validate.test.d.ts.map +0 -1
- package/dist/core/validate.test.js +0 -719
- package/dist/core/validate.test.js.map +0 -1
- package/dist/core/validation-utils.d.ts +0 -20
- package/dist/core/validation-utils.d.ts.map +0 -1
- package/dist/core/validation-utils.js +0 -351
- package/dist/core/validation-utils.js.map +0 -1
- package/dist/errors.d.ts +0 -30
- package/dist/errors.d.ts.map +0 -1
- package/dist/errors.js +0 -51
- package/dist/errors.js.map +0 -1
- package/dist/evaluator/computed.d.ts +0 -14
- package/dist/evaluator/computed.d.ts.map +0 -1
- package/dist/evaluator/computed.js +0 -60
- package/dist/evaluator/computed.js.map +0 -1
- package/dist/evaluator/context.d.ts +0 -62
- package/dist/evaluator/context.d.ts.map +0 -1
- package/dist/evaluator/context.js +0 -44
- package/dist/evaluator/context.js.map +0 -1
- package/dist/evaluator/dag.d.ts +0 -30
- package/dist/evaluator/dag.d.ts.map +0 -1
- package/dist/evaluator/dag.js +0 -121
- package/dist/evaluator/dag.js.map +0 -1
- package/dist/evaluator/expr.d.ts +0 -11
- package/dist/evaluator/expr.d.ts.map +0 -1
- package/dist/evaluator/expr.js +0 -1030
- package/dist/evaluator/expr.js.map +0 -1
- package/dist/evaluator/expr.test.d.ts +0 -2
- package/dist/evaluator/expr.test.d.ts.map +0 -1
- package/dist/evaluator/expr.test.js +0 -1235
- package/dist/evaluator/expr.test.js.map +0 -1
- package/dist/evaluator/flow.d.ts +0 -36
- package/dist/evaluator/flow.d.ts.map +0 -1
- package/dist/evaluator/flow.js +0 -390
- package/dist/evaluator/flow.js.map +0 -1
- package/dist/evaluator/flow.test.d.ts +0 -2
- package/dist/evaluator/flow.test.d.ts.map +0 -1
- package/dist/evaluator/flow.test.js +0 -499
- package/dist/evaluator/flow.test.js.map +0 -1
- package/dist/evaluator/index.d.ts +0 -6
- package/dist/evaluator/index.d.ts.map +0 -1
- package/dist/evaluator/index.js +0 -6
- package/dist/evaluator/index.js.map +0 -1
- package/dist/factories.d.ts +0 -22
- package/dist/factories.d.ts.map +0 -1
- package/dist/factories.js +0 -44
- package/dist/factories.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.test.d.ts +0 -2
- package/dist/index.test.d.ts.map +0 -1
- package/dist/index.test.js +0 -14
- package/dist/index.test.js.map +0 -1
- package/dist/schema/action.d.ts +0 -14
- package/dist/schema/action.d.ts.map +0 -1
- package/dist/schema/action.js +0 -30
- package/dist/schema/action.js.map +0 -1
- package/dist/schema/common.d.ts +0 -37
- package/dist/schema/common.d.ts.map +0 -1
- package/dist/schema/common.js +0 -20
- package/dist/schema/common.js.map +0 -1
- package/dist/schema/computed.d.ts +0 -23
- package/dist/schema/computed.d.ts.map +0 -1
- package/dist/schema/computed.js +0 -34
- package/dist/schema/computed.js.map +0 -1
- package/dist/schema/defaults.d.ts +0 -12
- package/dist/schema/defaults.d.ts.map +0 -1
- package/dist/schema/defaults.js +0 -19
- package/dist/schema/defaults.js.map +0 -1
- package/dist/schema/domain.d.ts +0 -50
- package/dist/schema/domain.d.ts.map +0 -1
- package/dist/schema/domain.js +0 -60
- package/dist/schema/domain.js.map +0 -1
- package/dist/schema/expr.d.ts +0 -483
- package/dist/schema/expr.d.ts.map +0 -1
- package/dist/schema/expr.js +0 -445
- package/dist/schema/expr.js.map +0 -1
- package/dist/schema/field.d.ts +0 -48
- package/dist/schema/field.d.ts.map +0 -1
- package/dist/schema/field.js +0 -31
- package/dist/schema/field.js.map +0 -1
- package/dist/schema/flow.d.ts +0 -103
- package/dist/schema/flow.d.ts.map +0 -1
- package/dist/schema/flow.js +0 -82
- package/dist/schema/flow.js.map +0 -1
- package/dist/schema/host-context.d.ts +0 -12
- package/dist/schema/host-context.d.ts.map +0 -1
- package/dist/schema/host-context.js +0 -23
- package/dist/schema/host-context.js.map +0 -1
- package/dist/schema/index.d.ts +0 -15
- package/dist/schema/index.d.ts.map +0 -1
- package/dist/schema/index.js +0 -28
- package/dist/schema/index.js.map +0 -1
- package/dist/schema/patch.d.ts +0 -59
- package/dist/schema/patch.d.ts.map +0 -1
- package/dist/schema/patch.js +0 -60
- package/dist/schema/patch.js.map +0 -1
- package/dist/schema/result.d.ts +0 -142
- package/dist/schema/result.d.ts.map +0 -1
- package/dist/schema/result.js +0 -94
- package/dist/schema/result.js.map +0 -1
- package/dist/schema/snapshot.d.ts +0 -153
- package/dist/schema/snapshot.d.ts.map +0 -1
- package/dist/schema/snapshot.js +0 -160
- package/dist/schema/snapshot.js.map +0 -1
- package/dist/schema/trace.d.ts +0 -98
- package/dist/schema/trace.d.ts.map +0 -1
- package/dist/schema/trace.js +0 -90
- package/dist/schema/trace.js.map +0 -1
- package/dist/schema/type-spec.d.ts +0 -34
- package/dist/schema/type-spec.d.ts.map +0 -1
- package/dist/schema/type-spec.js +0 -40
- package/dist/schema/type-spec.js.map +0 -1
- package/dist/utils/canonical.d.ts +0 -37
- package/dist/utils/canonical.d.ts.map +0 -1
- package/dist/utils/canonical.js +0 -122
- package/dist/utils/canonical.js.map +0 -1
- package/dist/utils/canonical.test.d.ts +0 -2
- package/dist/utils/canonical.test.d.ts.map +0 -1
- package/dist/utils/canonical.test.js +0 -183
- package/dist/utils/canonical.test.js.map +0 -1
- package/dist/utils/hash.d.ts +0 -55
- package/dist/utils/hash.d.ts.map +0 -1
- package/dist/utils/hash.js +0 -183
- package/dist/utils/hash.js.map +0 -1
- package/dist/utils/hash.test.d.ts +0 -2
- package/dist/utils/hash.test.d.ts.map +0 -1
- package/dist/utils/hash.test.js +0 -253
- package/dist/utils/hash.test.js.map +0 -1
- package/dist/utils/index.d.ts +0 -4
- package/dist/utils/index.d.ts.map +0 -1
- package/dist/utils/index.js +0 -4
- package/dist/utils/index.js.map +0 -1
- package/dist/utils/path.d.ts +0 -42
- package/dist/utils/path.d.ts.map +0 -1
- package/dist/utils/path.js +0 -170
- package/dist/utils/path.js.map +0 -1
- package/dist/utils/path.test.d.ts +0 -2
- package/dist/utils/path.test.d.ts.map +0 -1
- package/dist/utils/path.test.js +0 -248
- package/dist/utils/path.test.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,1743 @@
|
|
|
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
|
+
errors: z.ZodArray<z.ZodObject<{
|
|
779
|
+
code: z.ZodString;
|
|
780
|
+
message: z.ZodString;
|
|
781
|
+
source: z.ZodObject<{
|
|
782
|
+
actionId: z.ZodString;
|
|
783
|
+
nodePath: z.ZodString;
|
|
784
|
+
}, z.core.$strip>;
|
|
785
|
+
timestamp: z.ZodNumber;
|
|
786
|
+
context: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
787
|
+
}, z.core.$strip>>;
|
|
788
|
+
pendingRequirements: z.ZodArray<z.ZodObject<{
|
|
789
|
+
id: z.ZodString;
|
|
790
|
+
type: z.ZodString;
|
|
791
|
+
params: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
792
|
+
actionId: z.ZodString;
|
|
793
|
+
flowPosition: z.ZodObject<{
|
|
794
|
+
nodePath: z.ZodString;
|
|
795
|
+
snapshotVersion: z.ZodNumber;
|
|
796
|
+
}, z.core.$strip>;
|
|
797
|
+
createdAt: z.ZodNumber;
|
|
798
|
+
}, z.core.$strip>>;
|
|
799
|
+
currentAction: z.ZodNullable<z.ZodString>;
|
|
800
|
+
}, z.core.$strip>;
|
|
801
|
+
type SystemState = z.infer<typeof SystemState>;
|
|
802
|
+
/**
|
|
803
|
+
* SnapshotMeta - Snapshot metadata
|
|
804
|
+
*/
|
|
805
|
+
declare const SnapshotMeta: z.ZodObject<{
|
|
806
|
+
version: z.ZodNumber;
|
|
807
|
+
timestamp: z.ZodNumber;
|
|
808
|
+
randomSeed: z.ZodString;
|
|
809
|
+
schemaHash: z.ZodString;
|
|
810
|
+
}, z.core.$strip>;
|
|
811
|
+
type SnapshotMeta = z.infer<typeof SnapshotMeta>;
|
|
812
|
+
/**
|
|
813
|
+
* Snapshot - Immutable, point-in-time representation of world state.
|
|
814
|
+
* This is the ONLY medium of communication between Core and Host.
|
|
815
|
+
*/
|
|
816
|
+
declare const Snapshot: z.ZodObject<{
|
|
817
|
+
data: z.ZodUnknown;
|
|
818
|
+
computed: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
819
|
+
system: z.ZodObject<{
|
|
820
|
+
status: z.ZodEnum<{
|
|
821
|
+
error: "error";
|
|
822
|
+
idle: "idle";
|
|
823
|
+
computing: "computing";
|
|
824
|
+
pending: "pending";
|
|
825
|
+
}>;
|
|
826
|
+
lastError: z.ZodNullable<z.ZodObject<{
|
|
827
|
+
code: z.ZodString;
|
|
828
|
+
message: z.ZodString;
|
|
829
|
+
source: z.ZodObject<{
|
|
830
|
+
actionId: z.ZodString;
|
|
831
|
+
nodePath: z.ZodString;
|
|
832
|
+
}, z.core.$strip>;
|
|
833
|
+
timestamp: z.ZodNumber;
|
|
834
|
+
context: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
835
|
+
}, z.core.$strip>>;
|
|
836
|
+
errors: z.ZodArray<z.ZodObject<{
|
|
837
|
+
code: z.ZodString;
|
|
838
|
+
message: z.ZodString;
|
|
839
|
+
source: z.ZodObject<{
|
|
840
|
+
actionId: z.ZodString;
|
|
841
|
+
nodePath: z.ZodString;
|
|
842
|
+
}, z.core.$strip>;
|
|
843
|
+
timestamp: z.ZodNumber;
|
|
844
|
+
context: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
845
|
+
}, z.core.$strip>>;
|
|
846
|
+
pendingRequirements: z.ZodArray<z.ZodObject<{
|
|
847
|
+
id: z.ZodString;
|
|
848
|
+
type: z.ZodString;
|
|
849
|
+
params: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
850
|
+
actionId: z.ZodString;
|
|
851
|
+
flowPosition: z.ZodObject<{
|
|
852
|
+
nodePath: z.ZodString;
|
|
853
|
+
snapshotVersion: z.ZodNumber;
|
|
854
|
+
}, z.core.$strip>;
|
|
855
|
+
createdAt: z.ZodNumber;
|
|
856
|
+
}, z.core.$strip>>;
|
|
857
|
+
currentAction: z.ZodNullable<z.ZodString>;
|
|
858
|
+
}, z.core.$strip>;
|
|
859
|
+
input: z.ZodUnknown;
|
|
860
|
+
meta: z.ZodObject<{
|
|
861
|
+
version: z.ZodNumber;
|
|
862
|
+
timestamp: z.ZodNumber;
|
|
863
|
+
randomSeed: z.ZodString;
|
|
864
|
+
schemaHash: z.ZodString;
|
|
865
|
+
}, z.core.$strip>;
|
|
866
|
+
}, z.core.$strip>;
|
|
867
|
+
type Snapshot = z.infer<typeof Snapshot>;
|
|
868
|
+
/**
|
|
869
|
+
* Create initial system state
|
|
870
|
+
*/
|
|
871
|
+
declare function createInitialSystemState(): SystemState;
|
|
872
|
+
|
|
873
|
+
/**
|
|
874
|
+
* PatchSegment - A single segment in a patch path.
|
|
875
|
+
*/
|
|
876
|
+
declare const PatchSegment: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
877
|
+
kind: z.ZodLiteral<"prop">;
|
|
878
|
+
name: z.ZodString;
|
|
879
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
880
|
+
kind: z.ZodLiteral<"index">;
|
|
881
|
+
index: z.ZodNumber;
|
|
882
|
+
}, z.core.$strip>], "kind">;
|
|
883
|
+
type PatchSegment = z.infer<typeof PatchSegment>;
|
|
884
|
+
/**
|
|
885
|
+
* PatchPath - Path segments rooted at snapshot.data.
|
|
886
|
+
*/
|
|
887
|
+
declare const PatchPath: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
888
|
+
kind: z.ZodLiteral<"prop">;
|
|
889
|
+
name: z.ZodString;
|
|
890
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
891
|
+
kind: z.ZodLiteral<"index">;
|
|
892
|
+
index: z.ZodNumber;
|
|
893
|
+
}, z.core.$strip>], "kind">>;
|
|
894
|
+
type PatchPath = z.infer<typeof PatchPath>;
|
|
895
|
+
/**
|
|
896
|
+
* Patch - A single state modification operation.
|
|
897
|
+
* Only three operations: set, unset, merge.
|
|
898
|
+
*/
|
|
899
|
+
declare const Patch: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
900
|
+
op: z.ZodLiteral<"set">;
|
|
901
|
+
path: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
902
|
+
kind: z.ZodLiteral<"prop">;
|
|
903
|
+
name: z.ZodString;
|
|
904
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
905
|
+
kind: z.ZodLiteral<"index">;
|
|
906
|
+
index: z.ZodNumber;
|
|
907
|
+
}, z.core.$strip>], "kind">>;
|
|
908
|
+
value: z.ZodUnknown;
|
|
909
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
910
|
+
op: z.ZodLiteral<"unset">;
|
|
911
|
+
path: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
912
|
+
kind: z.ZodLiteral<"prop">;
|
|
913
|
+
name: z.ZodString;
|
|
914
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
915
|
+
kind: z.ZodLiteral<"index">;
|
|
916
|
+
index: z.ZodNumber;
|
|
917
|
+
}, z.core.$strip>], "kind">>;
|
|
918
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
919
|
+
op: z.ZodLiteral<"merge">;
|
|
920
|
+
path: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
921
|
+
kind: z.ZodLiteral<"prop">;
|
|
922
|
+
name: z.ZodString;
|
|
923
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
924
|
+
kind: z.ZodLiteral<"index">;
|
|
925
|
+
index: z.ZodNumber;
|
|
926
|
+
}, z.core.$strip>], "kind">>;
|
|
927
|
+
value: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
928
|
+
}, z.core.$strip>], "op">;
|
|
929
|
+
type Patch = z.infer<typeof Patch>;
|
|
930
|
+
/**
|
|
931
|
+
* SetPatch - Set value at path
|
|
932
|
+
*/
|
|
933
|
+
type SetPatch = Extract<Patch, {
|
|
934
|
+
op: "set";
|
|
935
|
+
}>;
|
|
936
|
+
/**
|
|
937
|
+
* UnsetPatch - Remove value at path
|
|
938
|
+
*/
|
|
939
|
+
type UnsetPatch = Extract<Patch, {
|
|
940
|
+
op: "unset";
|
|
941
|
+
}>;
|
|
942
|
+
/**
|
|
943
|
+
* MergePatch - Shallow merge object at path
|
|
944
|
+
*/
|
|
945
|
+
type MergePatch = Extract<Patch, {
|
|
946
|
+
op: "merge";
|
|
947
|
+
}>;
|
|
948
|
+
/**
|
|
949
|
+
* Intent - A request to perform an action
|
|
950
|
+
*/
|
|
951
|
+
declare const Intent: z.ZodObject<{
|
|
952
|
+
type: z.ZodString;
|
|
953
|
+
input: z.ZodOptional<z.ZodUnknown>;
|
|
954
|
+
intentId: z.ZodString;
|
|
955
|
+
}, z.core.$strip>;
|
|
956
|
+
type Intent = z.infer<typeof Intent>;
|
|
957
|
+
/**
|
|
958
|
+
* Helper to create a prop segment
|
|
959
|
+
*/
|
|
960
|
+
declare function propSegment(name: string): PatchSegment;
|
|
961
|
+
/**
|
|
962
|
+
* Helper to create an index segment
|
|
963
|
+
*/
|
|
964
|
+
declare function indexSegment(index: number): PatchSegment;
|
|
965
|
+
/**
|
|
966
|
+
* Helper to create a set patch
|
|
967
|
+
*/
|
|
968
|
+
declare function setPatch(path: PatchPath, value: unknown): SetPatch;
|
|
969
|
+
/**
|
|
970
|
+
* Helper to create an unset patch
|
|
971
|
+
*/
|
|
972
|
+
declare function unsetPatch(path: PatchPath): UnsetPatch;
|
|
973
|
+
/**
|
|
974
|
+
* Helper to create a merge patch
|
|
975
|
+
*/
|
|
976
|
+
declare function mergePatch(path: PatchPath, value: Record<string, unknown>): MergePatch;
|
|
977
|
+
|
|
978
|
+
/**
|
|
979
|
+
* Dot-separated path for accessing values (e.g., "user.profile.name")
|
|
980
|
+
*/
|
|
981
|
+
declare const SemanticPath: z.ZodString;
|
|
982
|
+
type SemanticPath = z.infer<typeof SemanticPath>;
|
|
983
|
+
/**
|
|
984
|
+
* Result type for functions that can fail without throwing
|
|
985
|
+
*/
|
|
986
|
+
declare const Result: <T extends z.ZodTypeAny, E extends z.ZodTypeAny>(valueSchema: T, errorSchema: E) => z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
987
|
+
ok: z.ZodLiteral<true>;
|
|
988
|
+
value: T;
|
|
989
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
990
|
+
ok: z.ZodLiteral<false>;
|
|
991
|
+
error: E;
|
|
992
|
+
}, z.core.$strip>], "ok">;
|
|
993
|
+
type Result<T, E> = {
|
|
994
|
+
ok: true;
|
|
995
|
+
value: T;
|
|
996
|
+
} | {
|
|
997
|
+
ok: false;
|
|
998
|
+
error: E;
|
|
999
|
+
};
|
|
1000
|
+
/**
|
|
1001
|
+
* Helper functions for Result type
|
|
1002
|
+
*/
|
|
1003
|
+
declare const ok: <T>(value: T) => Result<T, never>;
|
|
1004
|
+
declare const err: <E>(error: E) => Result<never, E>;
|
|
1005
|
+
declare const isOk: <T, E>(result: Result<T, E>) => result is {
|
|
1006
|
+
ok: true;
|
|
1007
|
+
value: T;
|
|
1008
|
+
};
|
|
1009
|
+
declare const isErr: <T, E>(result: Result<T, E>) => result is {
|
|
1010
|
+
ok: false;
|
|
1011
|
+
error: E;
|
|
1012
|
+
};
|
|
1013
|
+
|
|
1014
|
+
/**
|
|
1015
|
+
* TraceNodeKind - Types of trace nodes
|
|
1016
|
+
*/
|
|
1017
|
+
declare const TraceNodeKind: z.ZodEnum<{
|
|
1018
|
+
computed: "computed";
|
|
1019
|
+
error: "error";
|
|
1020
|
+
expr: "expr";
|
|
1021
|
+
flow: "flow";
|
|
1022
|
+
patch: "patch";
|
|
1023
|
+
effect: "effect";
|
|
1024
|
+
call: "call";
|
|
1025
|
+
halt: "halt";
|
|
1026
|
+
branch: "branch";
|
|
1027
|
+
}>;
|
|
1028
|
+
type TraceNodeKind = z.infer<typeof TraceNodeKind>;
|
|
1029
|
+
/**
|
|
1030
|
+
* TraceNode - A single node in the execution trace.
|
|
1031
|
+
* Enables explainability - every computation produces a trace.
|
|
1032
|
+
*/
|
|
1033
|
+
type TraceNode = {
|
|
1034
|
+
/**
|
|
1035
|
+
* Unique identifier for this trace node
|
|
1036
|
+
*/
|
|
1037
|
+
id: string;
|
|
1038
|
+
/**
|
|
1039
|
+
* Type of trace node
|
|
1040
|
+
*/
|
|
1041
|
+
kind: TraceNodeKind;
|
|
1042
|
+
/**
|
|
1043
|
+
* Path in the schema that produced this trace
|
|
1044
|
+
*/
|
|
1045
|
+
sourcePath: string;
|
|
1046
|
+
/**
|
|
1047
|
+
* Input values at this point
|
|
1048
|
+
*/
|
|
1049
|
+
inputs: Record<string, unknown>;
|
|
1050
|
+
/**
|
|
1051
|
+
* Output value produced
|
|
1052
|
+
*/
|
|
1053
|
+
output: unknown;
|
|
1054
|
+
/**
|
|
1055
|
+
* Child trace nodes
|
|
1056
|
+
*/
|
|
1057
|
+
children: TraceNode[];
|
|
1058
|
+
/**
|
|
1059
|
+
* Timestamp
|
|
1060
|
+
*/
|
|
1061
|
+
timestamp: number;
|
|
1062
|
+
};
|
|
1063
|
+
declare const TraceNode: z.ZodType<TraceNode>;
|
|
1064
|
+
/**
|
|
1065
|
+
* TraceTermination - How the computation ended
|
|
1066
|
+
*/
|
|
1067
|
+
declare const TraceTermination: z.ZodEnum<{
|
|
1068
|
+
error: "error";
|
|
1069
|
+
effect: "effect";
|
|
1070
|
+
halt: "halt";
|
|
1071
|
+
complete: "complete";
|
|
1072
|
+
}>;
|
|
1073
|
+
type TraceTermination = z.infer<typeof TraceTermination>;
|
|
1074
|
+
/**
|
|
1075
|
+
* TraceGraph - Complete trace of a computation
|
|
1076
|
+
*/
|
|
1077
|
+
declare const TraceGraph: z.ZodObject<{
|
|
1078
|
+
root: z.ZodType<TraceNode, unknown, z.core.$ZodTypeInternals<TraceNode, unknown>>;
|
|
1079
|
+
nodes: z.ZodRecord<z.ZodString, z.ZodType<TraceNode, unknown, z.core.$ZodTypeInternals<TraceNode, unknown>>>;
|
|
1080
|
+
intent: z.ZodObject<{
|
|
1081
|
+
type: z.ZodString;
|
|
1082
|
+
input: z.ZodUnknown;
|
|
1083
|
+
}, z.core.$strip>;
|
|
1084
|
+
baseVersion: z.ZodNumber;
|
|
1085
|
+
resultVersion: z.ZodNumber;
|
|
1086
|
+
duration: z.ZodNumber;
|
|
1087
|
+
terminatedBy: z.ZodEnum<{
|
|
1088
|
+
error: "error";
|
|
1089
|
+
effect: "effect";
|
|
1090
|
+
halt: "halt";
|
|
1091
|
+
complete: "complete";
|
|
1092
|
+
}>;
|
|
1093
|
+
}, z.core.$strip>;
|
|
1094
|
+
type TraceGraph = z.infer<typeof TraceGraph>;
|
|
1095
|
+
/**
|
|
1096
|
+
* TraceContext - Deterministic trace ID generation
|
|
1097
|
+
*/
|
|
1098
|
+
type TraceContext = {
|
|
1099
|
+
readonly nextId: () => string;
|
|
1100
|
+
readonly timestamp: number;
|
|
1101
|
+
};
|
|
1102
|
+
/**
|
|
1103
|
+
* Create a trace context for a single compute pass
|
|
1104
|
+
*/
|
|
1105
|
+
declare function createTraceContext(timestamp: number): TraceContext;
|
|
1106
|
+
/**
|
|
1107
|
+
* Create a trace node
|
|
1108
|
+
*/
|
|
1109
|
+
declare function createTraceNode(trace: TraceContext, kind: TraceNodeKind, sourcePath: string, inputs: Record<string, unknown>, output: unknown, children?: TraceNode[]): TraceNode;
|
|
1110
|
+
|
|
1111
|
+
/**
|
|
1112
|
+
* ComputeStatus - Result of a compute() call
|
|
1113
|
+
*/
|
|
1114
|
+
declare const ComputeStatus: z.ZodEnum<{
|
|
1115
|
+
error: "error";
|
|
1116
|
+
pending: "pending";
|
|
1117
|
+
complete: "complete";
|
|
1118
|
+
halted: "halted";
|
|
1119
|
+
}>;
|
|
1120
|
+
type ComputeStatus = z.infer<typeof ComputeStatus>;
|
|
1121
|
+
/**
|
|
1122
|
+
* SystemDelta - Declarative system transition emitted by compute().
|
|
1123
|
+
*/
|
|
1124
|
+
declare const SystemDelta: z.ZodObject<{
|
|
1125
|
+
status: z.ZodOptional<z.ZodEnum<{
|
|
1126
|
+
error: "error";
|
|
1127
|
+
idle: "idle";
|
|
1128
|
+
computing: "computing";
|
|
1129
|
+
pending: "pending";
|
|
1130
|
+
}>>;
|
|
1131
|
+
currentAction: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1132
|
+
lastError: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
1133
|
+
code: z.ZodString;
|
|
1134
|
+
message: z.ZodString;
|
|
1135
|
+
source: z.ZodObject<{
|
|
1136
|
+
actionId: z.ZodString;
|
|
1137
|
+
nodePath: z.ZodString;
|
|
1138
|
+
}, z.core.$strip>;
|
|
1139
|
+
timestamp: z.ZodNumber;
|
|
1140
|
+
context: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
1141
|
+
}, z.core.$strip>>>;
|
|
1142
|
+
appendErrors: z.ZodArray<z.ZodObject<{
|
|
1143
|
+
code: z.ZodString;
|
|
1144
|
+
message: z.ZodString;
|
|
1145
|
+
source: z.ZodObject<{
|
|
1146
|
+
actionId: z.ZodString;
|
|
1147
|
+
nodePath: z.ZodString;
|
|
1148
|
+
}, z.core.$strip>;
|
|
1149
|
+
timestamp: z.ZodNumber;
|
|
1150
|
+
context: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
1151
|
+
}, z.core.$strip>>;
|
|
1152
|
+
addRequirements: z.ZodArray<z.ZodObject<{
|
|
1153
|
+
id: z.ZodString;
|
|
1154
|
+
type: z.ZodString;
|
|
1155
|
+
params: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
1156
|
+
actionId: z.ZodString;
|
|
1157
|
+
flowPosition: z.ZodObject<{
|
|
1158
|
+
nodePath: z.ZodString;
|
|
1159
|
+
snapshotVersion: z.ZodNumber;
|
|
1160
|
+
}, z.core.$strip>;
|
|
1161
|
+
createdAt: z.ZodNumber;
|
|
1162
|
+
}, z.core.$strip>>;
|
|
1163
|
+
removeRequirementIds: z.ZodArray<z.ZodString>;
|
|
1164
|
+
}, z.core.$strip>;
|
|
1165
|
+
type SystemDelta = z.infer<typeof SystemDelta>;
|
|
1166
|
+
/**
|
|
1167
|
+
* ComputeResult - Result of compute() call
|
|
1168
|
+
*/
|
|
1169
|
+
declare const ComputeResult: z.ZodObject<{
|
|
1170
|
+
patches: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
1171
|
+
op: z.ZodLiteral<"set">;
|
|
1172
|
+
path: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
1173
|
+
kind: z.ZodLiteral<"prop">;
|
|
1174
|
+
name: z.ZodString;
|
|
1175
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1176
|
+
kind: z.ZodLiteral<"index">;
|
|
1177
|
+
index: z.ZodNumber;
|
|
1178
|
+
}, z.core.$strip>], "kind">>;
|
|
1179
|
+
value: z.ZodUnknown;
|
|
1180
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1181
|
+
op: z.ZodLiteral<"unset">;
|
|
1182
|
+
path: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
1183
|
+
kind: z.ZodLiteral<"prop">;
|
|
1184
|
+
name: z.ZodString;
|
|
1185
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1186
|
+
kind: z.ZodLiteral<"index">;
|
|
1187
|
+
index: z.ZodNumber;
|
|
1188
|
+
}, z.core.$strip>], "kind">>;
|
|
1189
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1190
|
+
op: z.ZodLiteral<"merge">;
|
|
1191
|
+
path: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
1192
|
+
kind: z.ZodLiteral<"prop">;
|
|
1193
|
+
name: z.ZodString;
|
|
1194
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1195
|
+
kind: z.ZodLiteral<"index">;
|
|
1196
|
+
index: z.ZodNumber;
|
|
1197
|
+
}, z.core.$strip>], "kind">>;
|
|
1198
|
+
value: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
1199
|
+
}, z.core.$strip>], "op">>;
|
|
1200
|
+
systemDelta: z.ZodObject<{
|
|
1201
|
+
status: z.ZodOptional<z.ZodEnum<{
|
|
1202
|
+
error: "error";
|
|
1203
|
+
idle: "idle";
|
|
1204
|
+
computing: "computing";
|
|
1205
|
+
pending: "pending";
|
|
1206
|
+
}>>;
|
|
1207
|
+
currentAction: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1208
|
+
lastError: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
1209
|
+
code: z.ZodString;
|
|
1210
|
+
message: z.ZodString;
|
|
1211
|
+
source: z.ZodObject<{
|
|
1212
|
+
actionId: z.ZodString;
|
|
1213
|
+
nodePath: z.ZodString;
|
|
1214
|
+
}, z.core.$strip>;
|
|
1215
|
+
timestamp: z.ZodNumber;
|
|
1216
|
+
context: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
1217
|
+
}, z.core.$strip>>>;
|
|
1218
|
+
appendErrors: z.ZodArray<z.ZodObject<{
|
|
1219
|
+
code: z.ZodString;
|
|
1220
|
+
message: z.ZodString;
|
|
1221
|
+
source: z.ZodObject<{
|
|
1222
|
+
actionId: z.ZodString;
|
|
1223
|
+
nodePath: z.ZodString;
|
|
1224
|
+
}, z.core.$strip>;
|
|
1225
|
+
timestamp: z.ZodNumber;
|
|
1226
|
+
context: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
1227
|
+
}, z.core.$strip>>;
|
|
1228
|
+
addRequirements: z.ZodArray<z.ZodObject<{
|
|
1229
|
+
id: z.ZodString;
|
|
1230
|
+
type: z.ZodString;
|
|
1231
|
+
params: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
1232
|
+
actionId: z.ZodString;
|
|
1233
|
+
flowPosition: z.ZodObject<{
|
|
1234
|
+
nodePath: z.ZodString;
|
|
1235
|
+
snapshotVersion: z.ZodNumber;
|
|
1236
|
+
}, z.core.$strip>;
|
|
1237
|
+
createdAt: z.ZodNumber;
|
|
1238
|
+
}, z.core.$strip>>;
|
|
1239
|
+
removeRequirementIds: z.ZodArray<z.ZodString>;
|
|
1240
|
+
}, z.core.$strip>;
|
|
1241
|
+
trace: z.ZodObject<{
|
|
1242
|
+
root: z.ZodType<TraceNode, unknown, z.core.$ZodTypeInternals<TraceNode, unknown>>;
|
|
1243
|
+
nodes: z.ZodRecord<z.ZodString, z.ZodType<TraceNode, unknown, z.core.$ZodTypeInternals<TraceNode, unknown>>>;
|
|
1244
|
+
intent: z.ZodObject<{
|
|
1245
|
+
type: z.ZodString;
|
|
1246
|
+
input: z.ZodUnknown;
|
|
1247
|
+
}, z.core.$strip>;
|
|
1248
|
+
baseVersion: z.ZodNumber;
|
|
1249
|
+
resultVersion: z.ZodNumber;
|
|
1250
|
+
duration: z.ZodNumber;
|
|
1251
|
+
terminatedBy: z.ZodEnum<{
|
|
1252
|
+
error: "error";
|
|
1253
|
+
effect: "effect";
|
|
1254
|
+
halt: "halt";
|
|
1255
|
+
complete: "complete";
|
|
1256
|
+
}>;
|
|
1257
|
+
}, z.core.$strip>;
|
|
1258
|
+
status: z.ZodEnum<{
|
|
1259
|
+
error: "error";
|
|
1260
|
+
pending: "pending";
|
|
1261
|
+
complete: "complete";
|
|
1262
|
+
halted: "halted";
|
|
1263
|
+
}>;
|
|
1264
|
+
}, z.core.$strip>;
|
|
1265
|
+
type ComputeResult = z.infer<typeof ComputeResult>;
|
|
1266
|
+
/**
|
|
1267
|
+
* ValidationError - Single validation error
|
|
1268
|
+
*/
|
|
1269
|
+
declare const ValidationError: z.ZodObject<{
|
|
1270
|
+
code: z.ZodString;
|
|
1271
|
+
message: z.ZodString;
|
|
1272
|
+
path: z.ZodOptional<z.ZodString>;
|
|
1273
|
+
}, z.core.$strip>;
|
|
1274
|
+
type ValidationError = z.infer<typeof ValidationError>;
|
|
1275
|
+
/**
|
|
1276
|
+
* ValidationResult - Result of validate() call
|
|
1277
|
+
*/
|
|
1278
|
+
declare const ValidationResult: z.ZodObject<{
|
|
1279
|
+
valid: z.ZodBoolean;
|
|
1280
|
+
errors: z.ZodArray<z.ZodObject<{
|
|
1281
|
+
code: z.ZodString;
|
|
1282
|
+
message: z.ZodString;
|
|
1283
|
+
path: z.ZodOptional<z.ZodString>;
|
|
1284
|
+
}, z.core.$strip>>;
|
|
1285
|
+
}, z.core.$strip>;
|
|
1286
|
+
type ValidationResult = z.infer<typeof ValidationResult>;
|
|
1287
|
+
/**
|
|
1288
|
+
* ExplainResult - Result of explain() call
|
|
1289
|
+
*/
|
|
1290
|
+
declare const ExplainResult: z.ZodObject<{
|
|
1291
|
+
value: z.ZodUnknown;
|
|
1292
|
+
trace: z.ZodType<TraceNode, unknown, z.core.$ZodTypeInternals<TraceNode, unknown>>;
|
|
1293
|
+
deps: z.ZodArray<z.ZodString>;
|
|
1294
|
+
}, z.core.$strip>;
|
|
1295
|
+
type ExplainResult = z.infer<typeof ExplainResult>;
|
|
1296
|
+
/**
|
|
1297
|
+
* Create a successful validation result
|
|
1298
|
+
*/
|
|
1299
|
+
declare function validResult(): ValidationResult;
|
|
1300
|
+
/**
|
|
1301
|
+
* Create a failed validation result
|
|
1302
|
+
*/
|
|
1303
|
+
declare function invalidResult(errors: ValidationError[]): ValidationResult;
|
|
1304
|
+
|
|
1305
|
+
/**
|
|
1306
|
+
* HostContext - Explicit host-provided inputs for determinism
|
|
1307
|
+
*/
|
|
1308
|
+
declare const HostContext: z.ZodObject<{
|
|
1309
|
+
now: z.ZodNumber;
|
|
1310
|
+
randomSeed: z.ZodString;
|
|
1311
|
+
env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
1312
|
+
durationMs: z.ZodOptional<z.ZodNumber>;
|
|
1313
|
+
}, z.core.$strip>;
|
|
1314
|
+
type HostContext = z.infer<typeof HostContext>;
|
|
1315
|
+
|
|
1316
|
+
/**
|
|
1317
|
+
* Compute the result of dispatching an intent (synchronous).
|
|
1318
|
+
*
|
|
1319
|
+
* This is the canonical computation path. Each call is independent -
|
|
1320
|
+
* there is no suspended context.
|
|
1321
|
+
*/
|
|
1322
|
+
declare function computeSync(schema: DomainSchema, snapshot: Snapshot, intent: Intent, context: HostContext): ComputeResult;
|
|
1323
|
+
/**
|
|
1324
|
+
* Compute the result of dispatching an intent (async wrapper).
|
|
1325
|
+
*/
|
|
1326
|
+
declare function compute(schema: DomainSchema, snapshot: Snapshot, intent: Intent, context: HostContext): Promise<ComputeResult>;
|
|
1327
|
+
|
|
1328
|
+
/**
|
|
1329
|
+
* Apply patches to snapshot.data and recompute computed values.
|
|
1330
|
+
*
|
|
1331
|
+
* Patch targets are rooted at snapshot.data only.
|
|
1332
|
+
* System transitions are handled by applySystemDelta().
|
|
1333
|
+
*/
|
|
1334
|
+
declare function apply(schema: DomainSchema, snapshot: Snapshot, patches: readonly Patch[], context: HostContext): Snapshot;
|
|
1335
|
+
|
|
1336
|
+
/**
|
|
1337
|
+
* Apply a declarative system transition to a snapshot.
|
|
1338
|
+
*
|
|
1339
|
+
* This function is pure, deterministic, and total.
|
|
1340
|
+
*/
|
|
1341
|
+
declare function applySystemDelta(snapshot: Snapshot, delta: SystemDelta): Snapshot;
|
|
1342
|
+
|
|
1343
|
+
/**
|
|
1344
|
+
* Validate a domain schema
|
|
1345
|
+
*
|
|
1346
|
+
* Validation rules:
|
|
1347
|
+
* - V-001: All paths in ComputedSpec.deps MUST exist
|
|
1348
|
+
* - V-002: ComputedSpec dependency graph MUST be acyclic
|
|
1349
|
+
* - V-003: All paths in ExprNode.get MUST exist
|
|
1350
|
+
* - V-004: All `call` references in FlowSpec MUST exist
|
|
1351
|
+
* - V-005: FlowSpec `call` graph MUST be acyclic
|
|
1352
|
+
* - V-006: ActionSpec.available expression MUST return boolean (runtime check)
|
|
1353
|
+
* - V-007: ActionSpec.input MUST be valid FieldSpec (Zod handles this)
|
|
1354
|
+
* - V-008: Schema hash MUST match canonical hash
|
|
1355
|
+
*/
|
|
1356
|
+
declare function validate(schema: unknown): ValidationResult;
|
|
1357
|
+
|
|
1358
|
+
/**
|
|
1359
|
+
* Explain why a value is what it is
|
|
1360
|
+
*
|
|
1361
|
+
* @param schema - The domain schema
|
|
1362
|
+
* @param snapshot - Current snapshot state
|
|
1363
|
+
* @param path - The path to explain
|
|
1364
|
+
* @returns ExplainResult with value, trace, and dependencies
|
|
1365
|
+
*/
|
|
1366
|
+
declare function explain(schema: DomainSchema, snapshot: Snapshot, path: SemanticPath): ExplainResult;
|
|
1367
|
+
|
|
1368
|
+
/**
|
|
1369
|
+
* ComputedFieldSpec - Definition of a single computed field
|
|
1370
|
+
*/
|
|
1371
|
+
declare const ComputedFieldSpec: z.ZodObject<{
|
|
1372
|
+
deps: z.ZodArray<z.ZodString>;
|
|
1373
|
+
expr: z.ZodType<ExprNode, unknown, z.core.$ZodTypeInternals<ExprNode, unknown>>;
|
|
1374
|
+
description: z.ZodOptional<z.ZodString>;
|
|
1375
|
+
}, z.core.$strip>;
|
|
1376
|
+
type ComputedFieldSpec = z.infer<typeof ComputedFieldSpec>;
|
|
1377
|
+
/**
|
|
1378
|
+
* ComputedSpec - Collection of computed field definitions
|
|
1379
|
+
* Computed values form a Directed Acyclic Graph (DAG).
|
|
1380
|
+
*/
|
|
1381
|
+
declare const ComputedSpec: z.ZodObject<{
|
|
1382
|
+
fields: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
1383
|
+
deps: z.ZodArray<z.ZodString>;
|
|
1384
|
+
expr: z.ZodType<ExprNode, unknown, z.core.$ZodTypeInternals<ExprNode, unknown>>;
|
|
1385
|
+
description: z.ZodOptional<z.ZodString>;
|
|
1386
|
+
}, z.core.$strip>>;
|
|
1387
|
+
}, z.core.$strip>;
|
|
1388
|
+
type ComputedSpec = z.infer<typeof ComputedSpec>;
|
|
1389
|
+
|
|
1390
|
+
/**
|
|
1391
|
+
* ActionSpec - Maps intents to flows
|
|
1392
|
+
* An action defines what happens when a particular intent is dispatched.
|
|
1393
|
+
*/
|
|
1394
|
+
declare const ActionSpec: z.ZodObject<{
|
|
1395
|
+
flow: z.ZodType<FlowNode, unknown, z.core.$ZodTypeInternals<FlowNode, unknown>>;
|
|
1396
|
+
input: z.ZodOptional<z.ZodType<FieldSpec, unknown, z.core.$ZodTypeInternals<FieldSpec, unknown>>>;
|
|
1397
|
+
available: z.ZodOptional<z.ZodType<ExprNode, unknown, z.core.$ZodTypeInternals<ExprNode, unknown>>>;
|
|
1398
|
+
description: z.ZodOptional<z.ZodString>;
|
|
1399
|
+
}, z.core.$strip>;
|
|
1400
|
+
type ActionSpec = z.infer<typeof ActionSpec>;
|
|
1401
|
+
|
|
1402
|
+
/**
|
|
1403
|
+
* Extract top-level default values from a StateSpec.
|
|
1404
|
+
*
|
|
1405
|
+
* Iterates `stateSpec.fields` and collects fields with an explicit `default`.
|
|
1406
|
+
* Returns a flat record of field names to default values.
|
|
1407
|
+
*
|
|
1408
|
+
* @param stateSpec - The state specification from a DomainSchema
|
|
1409
|
+
* @returns Record of field names to their default values
|
|
1410
|
+
*/
|
|
1411
|
+
declare function extractDefaults(stateSpec: StateSpec): Record<string, unknown>;
|
|
1412
|
+
|
|
1413
|
+
/**
|
|
1414
|
+
* Parse a dot-separated path into segments.
|
|
1415
|
+
*
|
|
1416
|
+
* Supports escaping literal dots inside segments via backslash (for example `a\\.b` -> `a.b`).
|
|
1417
|
+
*/
|
|
1418
|
+
declare function parsePath(path: SemanticPath): string[];
|
|
1419
|
+
/**
|
|
1420
|
+
* Join path segments into a semantic path
|
|
1421
|
+
*/
|
|
1422
|
+
declare function joinPath(...segments: string[]): SemanticPath;
|
|
1423
|
+
/**
|
|
1424
|
+
* Get value at path from object
|
|
1425
|
+
* Returns undefined for non-existent paths (never throws)
|
|
1426
|
+
*/
|
|
1427
|
+
declare function getByPath(obj: unknown, path: SemanticPath): unknown;
|
|
1428
|
+
/**
|
|
1429
|
+
* Immutably set value at path
|
|
1430
|
+
* Creates intermediate objects as needed
|
|
1431
|
+
*/
|
|
1432
|
+
declare function setByPath(obj: unknown, path: SemanticPath, value: unknown): unknown;
|
|
1433
|
+
/**
|
|
1434
|
+
* Immutably remove value at path
|
|
1435
|
+
*/
|
|
1436
|
+
declare function unsetByPath(obj: unknown, path: SemanticPath): unknown;
|
|
1437
|
+
/**
|
|
1438
|
+
* Immutably shallow merge at path
|
|
1439
|
+
*/
|
|
1440
|
+
declare function mergeAtPath(obj: unknown, path: SemanticPath, value: Record<string, unknown>): unknown;
|
|
1441
|
+
/**
|
|
1442
|
+
* Check if a path exists in an object
|
|
1443
|
+
*/
|
|
1444
|
+
declare function hasPath(obj: unknown, path: SemanticPath): boolean;
|
|
1445
|
+
/**
|
|
1446
|
+
* Get parent path
|
|
1447
|
+
*/
|
|
1448
|
+
declare function parentPath(path: SemanticPath): SemanticPath;
|
|
1449
|
+
/**
|
|
1450
|
+
* Get last segment of path
|
|
1451
|
+
*/
|
|
1452
|
+
declare function lastSegment(path: SemanticPath): string;
|
|
1453
|
+
|
|
1454
|
+
/**
|
|
1455
|
+
* Canonical form utilities for deterministic hashing
|
|
1456
|
+
*
|
|
1457
|
+
* Algorithm:
|
|
1458
|
+
* 1. Sort all object keys alphabetically (recursive)
|
|
1459
|
+
* 2. Remove all keys with undefined value
|
|
1460
|
+
* 3. Preserve keys with null value
|
|
1461
|
+
* 4. Serialize using JSON with no whitespace
|
|
1462
|
+
*/
|
|
1463
|
+
/**
|
|
1464
|
+
* Recursively sort object keys alphabetically
|
|
1465
|
+
*/
|
|
1466
|
+
declare function sortKeys(obj: unknown): unknown;
|
|
1467
|
+
/**
|
|
1468
|
+
* Convert object to canonical JSON string
|
|
1469
|
+
* - Keys are sorted alphabetically
|
|
1470
|
+
* - Undefined values are removed
|
|
1471
|
+
* - No whitespace
|
|
1472
|
+
*/
|
|
1473
|
+
declare function toCanonical(obj: unknown): string;
|
|
1474
|
+
/**
|
|
1475
|
+
* Canonicalize JSON per RFC 8785 (JCS)
|
|
1476
|
+
* - Objects: keys sorted by Unicode code points
|
|
1477
|
+
* - Arrays: preserve order
|
|
1478
|
+
* - Undefined/function/symbol: omitted in objects, null in arrays
|
|
1479
|
+
* - Non-finite numbers: null
|
|
1480
|
+
*/
|
|
1481
|
+
declare function toJcs(value: unknown): string;
|
|
1482
|
+
/**
|
|
1483
|
+
* Parse canonical JSON string
|
|
1484
|
+
*/
|
|
1485
|
+
declare function fromCanonical<T>(canonical: string): T;
|
|
1486
|
+
/**
|
|
1487
|
+
* Check if two objects are equal in canonical form
|
|
1488
|
+
*/
|
|
1489
|
+
declare function canonicalEqual(a: unknown, b: unknown): boolean;
|
|
1490
|
+
|
|
1491
|
+
type SchemaHashMode = "semantic" | "effective";
|
|
1492
|
+
type SchemaHashInput = {
|
|
1493
|
+
id: string;
|
|
1494
|
+
version: string;
|
|
1495
|
+
types: Record<string, unknown>;
|
|
1496
|
+
state: {
|
|
1497
|
+
fields: Record<string, unknown>;
|
|
1498
|
+
};
|
|
1499
|
+
computed: {
|
|
1500
|
+
fields: Record<string, {
|
|
1501
|
+
deps: string[];
|
|
1502
|
+
expr: unknown;
|
|
1503
|
+
description?: string;
|
|
1504
|
+
}>;
|
|
1505
|
+
};
|
|
1506
|
+
actions: Record<string, unknown>;
|
|
1507
|
+
meta?: {
|
|
1508
|
+
name?: string;
|
|
1509
|
+
description?: string;
|
|
1510
|
+
authors?: string[];
|
|
1511
|
+
};
|
|
1512
|
+
};
|
|
1513
|
+
/**
|
|
1514
|
+
* SHA-256 hash using Web Crypto API
|
|
1515
|
+
* Works in both browser and Node.js
|
|
1516
|
+
*/
|
|
1517
|
+
declare function sha256(message: string): Promise<string>;
|
|
1518
|
+
/**
|
|
1519
|
+
* SHA-256 hash using a synchronous pure JS implementation
|
|
1520
|
+
*/
|
|
1521
|
+
declare function sha256Sync(message: string): string;
|
|
1522
|
+
/**
|
|
1523
|
+
* Hash a schema in canonical form
|
|
1524
|
+
*/
|
|
1525
|
+
declare function hashSchema(schema: SchemaHashInput, mode?: SchemaHashMode): Promise<string>;
|
|
1526
|
+
/**
|
|
1527
|
+
* Hash a schema in canonical form (sync)
|
|
1528
|
+
*/
|
|
1529
|
+
declare function hashSchemaSync(schema: SchemaHashInput, mode?: SchemaHashMode): string;
|
|
1530
|
+
declare function hashSchemaEffective(schema: SchemaHashInput): Promise<string>;
|
|
1531
|
+
declare function hashSchemaEffectiveSync(schema: SchemaHashInput): string;
|
|
1532
|
+
/**
|
|
1533
|
+
* Generate deterministic requirement ID
|
|
1534
|
+
* Based on: schemaHash, intentId, actionId, flowNodePath
|
|
1535
|
+
*/
|
|
1536
|
+
declare function generateRequirementId(schemaHash: string, intentId: string, actionId: string, flowNodePath: string): Promise<string>;
|
|
1537
|
+
/**
|
|
1538
|
+
* Generate deterministic requirement ID (sync)
|
|
1539
|
+
*/
|
|
1540
|
+
declare function generateRequirementIdSync(schemaHash: string, intentId: string, actionId: string, flowNodePath: string): string;
|
|
1541
|
+
/**
|
|
1542
|
+
* Generate a trace node ID
|
|
1543
|
+
*/
|
|
1544
|
+
declare function generateTraceId(index?: number): string;
|
|
1545
|
+
|
|
1546
|
+
/**
|
|
1547
|
+
* Render PatchPath for logs and error messages only.
|
|
1548
|
+
*/
|
|
1549
|
+
declare function patchPathToDisplayString(path: PatchPath): string;
|
|
1550
|
+
/**
|
|
1551
|
+
* Convert a legacy semantic string path into PatchPath segments.
|
|
1552
|
+
* This helper exists for internal bridging only.
|
|
1553
|
+
*/
|
|
1554
|
+
declare function semanticPathToPatchPath(path: string): PatchPath;
|
|
1555
|
+
declare function isSafePatchPath(path: PatchPath): boolean;
|
|
1556
|
+
declare function getByPatchPath(obj: unknown, path: PatchPath): unknown;
|
|
1557
|
+
declare function setByPatchPath(obj: unknown, path: PatchPath, value: unknown): unknown;
|
|
1558
|
+
declare function unsetByPatchPath(obj: unknown, path: PatchPath): unknown;
|
|
1559
|
+
declare function mergeAtPatchPath(obj: unknown, path: PatchPath, value: Record<string, unknown>): unknown;
|
|
1560
|
+
|
|
1561
|
+
/**
|
|
1562
|
+
* Evaluation context for expressions and flows
|
|
1563
|
+
*/
|
|
1564
|
+
type EvalContext = {
|
|
1565
|
+
/**
|
|
1566
|
+
* Current snapshot state
|
|
1567
|
+
*/
|
|
1568
|
+
readonly snapshot: Snapshot;
|
|
1569
|
+
/**
|
|
1570
|
+
* Domain schema
|
|
1571
|
+
*/
|
|
1572
|
+
readonly schema: DomainSchema;
|
|
1573
|
+
/**
|
|
1574
|
+
* Current action being processed (if any)
|
|
1575
|
+
*/
|
|
1576
|
+
readonly currentAction: string | null;
|
|
1577
|
+
/**
|
|
1578
|
+
* Current node path in the flow (for tracing)
|
|
1579
|
+
*/
|
|
1580
|
+
readonly nodePath: string;
|
|
1581
|
+
/**
|
|
1582
|
+
* Intent ID for the current intent (for re-entry safety)
|
|
1583
|
+
*/
|
|
1584
|
+
readonly intentId?: string;
|
|
1585
|
+
/**
|
|
1586
|
+
* UUID generator counter (for deterministic UUID generation)
|
|
1587
|
+
*/
|
|
1588
|
+
uuidCounter?: number;
|
|
1589
|
+
/**
|
|
1590
|
+
* Trace context for deterministic trace ID generation
|
|
1591
|
+
*/
|
|
1592
|
+
readonly trace: TraceContext;
|
|
1593
|
+
/**
|
|
1594
|
+
* Collection context variables (for filter, map, find, etc.)
|
|
1595
|
+
*/
|
|
1596
|
+
readonly $item?: unknown;
|
|
1597
|
+
readonly $index?: number;
|
|
1598
|
+
readonly $array?: unknown[];
|
|
1599
|
+
};
|
|
1600
|
+
/**
|
|
1601
|
+
* Create a new evaluation context
|
|
1602
|
+
*
|
|
1603
|
+
* @param timestampOrTrace - Required timestamp or TraceContext for deterministic tracing.
|
|
1604
|
+
* MUST be provided by Host via HostContext.now to ensure determinism.
|
|
1605
|
+
*/
|
|
1606
|
+
declare function createContext(snapshot: Snapshot, schema: DomainSchema, currentAction: string | null, nodePath: string, intentId: string | undefined, timestampOrTrace: number | TraceContext): EvalContext;
|
|
1607
|
+
/**
|
|
1608
|
+
* Create context with collection variables for filter/map/find/etc.
|
|
1609
|
+
*/
|
|
1610
|
+
declare function withCollectionContext(ctx: EvalContext, item: unknown, index: number, array: unknown[]): EvalContext;
|
|
1611
|
+
/**
|
|
1612
|
+
* Update context with new snapshot
|
|
1613
|
+
*/
|
|
1614
|
+
declare function withSnapshot(ctx: EvalContext, snapshot: Snapshot): EvalContext;
|
|
1615
|
+
/**
|
|
1616
|
+
* Update context with new node path
|
|
1617
|
+
*/
|
|
1618
|
+
declare function withNodePath(ctx: EvalContext, nodePath: string): EvalContext;
|
|
1619
|
+
|
|
1620
|
+
type ExprResult = Result<unknown, ErrorValue>;
|
|
1621
|
+
/**
|
|
1622
|
+
* Evaluate an expression node
|
|
1623
|
+
* All expressions are pure and total (always return a value or error)
|
|
1624
|
+
*/
|
|
1625
|
+
declare function evaluateExpr(expr: ExprNode, ctx: EvalContext): ExprResult;
|
|
1626
|
+
|
|
1627
|
+
/**
|
|
1628
|
+
* Flow execution status
|
|
1629
|
+
*/
|
|
1630
|
+
type FlowStatus = "running" | "complete" | "pending" | "halted" | "error";
|
|
1631
|
+
/**
|
|
1632
|
+
* Flow execution state
|
|
1633
|
+
*/
|
|
1634
|
+
type FlowState = {
|
|
1635
|
+
readonly snapshot: Snapshot;
|
|
1636
|
+
readonly status: FlowStatus;
|
|
1637
|
+
readonly patches: readonly Patch[];
|
|
1638
|
+
readonly requirements: readonly Requirement[];
|
|
1639
|
+
readonly error: ErrorValue | null;
|
|
1640
|
+
};
|
|
1641
|
+
/**
|
|
1642
|
+
* Flow evaluation result
|
|
1643
|
+
*/
|
|
1644
|
+
type FlowResult = {
|
|
1645
|
+
readonly state: FlowState;
|
|
1646
|
+
readonly trace: TraceNode;
|
|
1647
|
+
};
|
|
1648
|
+
/**
|
|
1649
|
+
* Create initial flow state
|
|
1650
|
+
*/
|
|
1651
|
+
declare function createFlowState(snapshot: Snapshot): FlowState;
|
|
1652
|
+
/**
|
|
1653
|
+
* Evaluate a flow node
|
|
1654
|
+
*/
|
|
1655
|
+
declare function evaluateFlowSync(flow: FlowNode, ctx: EvalContext, state: FlowState, nodePath: string): FlowResult;
|
|
1656
|
+
declare function evaluateFlow(flow: FlowNode, ctx: EvalContext, state: FlowState, nodePath: string): Promise<FlowResult>;
|
|
1657
|
+
|
|
1658
|
+
/**
|
|
1659
|
+
* Dependency graph for computed values
|
|
1660
|
+
*/
|
|
1661
|
+
type DependencyGraph = {
|
|
1662
|
+
readonly nodes: readonly SemanticPath[];
|
|
1663
|
+
readonly edges: ReadonlyMap<SemanticPath, readonly SemanticPath[]>;
|
|
1664
|
+
};
|
|
1665
|
+
/**
|
|
1666
|
+
* Build a dependency graph from ComputedSpec
|
|
1667
|
+
*/
|
|
1668
|
+
declare function buildDependencyGraph(computed: ComputedSpec): DependencyGraph;
|
|
1669
|
+
/**
|
|
1670
|
+
* Topological sort using Kahn's algorithm
|
|
1671
|
+
* Returns sorted order or error if cycles detected
|
|
1672
|
+
*/
|
|
1673
|
+
declare function topologicalSort(graph: DependencyGraph): Result<SemanticPath[], ValidationError>;
|
|
1674
|
+
/**
|
|
1675
|
+
* Detect cycles in the dependency graph
|
|
1676
|
+
* Returns array of cycle paths or null if no cycles
|
|
1677
|
+
*/
|
|
1678
|
+
declare function detectCycles(graph: DependencyGraph): SemanticPath[][] | null;
|
|
1679
|
+
/**
|
|
1680
|
+
* Get all dependencies (transitive) for a given node
|
|
1681
|
+
*/
|
|
1682
|
+
declare function getTransitiveDeps(graph: DependencyGraph, node: SemanticPath): Set<SemanticPath>;
|
|
1683
|
+
|
|
1684
|
+
/**
|
|
1685
|
+
* Evaluate all computed values for a snapshot
|
|
1686
|
+
* Returns the computed values record or an error
|
|
1687
|
+
*/
|
|
1688
|
+
declare function evaluateComputed(schema: DomainSchema, snapshot: Snapshot): Result<Record<SemanticPath, unknown>, ErrorValue>;
|
|
1689
|
+
/**
|
|
1690
|
+
* Evaluate a single computed value
|
|
1691
|
+
*/
|
|
1692
|
+
declare function evaluateSingleComputed(schema: DomainSchema, snapshot: Snapshot, path: SemanticPath): Result<unknown, ErrorValue>;
|
|
1693
|
+
|
|
1694
|
+
/**
|
|
1695
|
+
* Core error codes
|
|
1696
|
+
*/
|
|
1697
|
+
declare const CoreErrorCode: z.ZodEnum<{
|
|
1698
|
+
VALIDATION_ERROR: "VALIDATION_ERROR";
|
|
1699
|
+
PATH_NOT_FOUND: "PATH_NOT_FOUND";
|
|
1700
|
+
TYPE_MISMATCH: "TYPE_MISMATCH";
|
|
1701
|
+
DIVISION_BY_ZERO: "DIVISION_BY_ZERO";
|
|
1702
|
+
INDEX_OUT_OF_BOUNDS: "INDEX_OUT_OF_BOUNDS";
|
|
1703
|
+
UNKNOWN_ACTION: "UNKNOWN_ACTION";
|
|
1704
|
+
ACTION_UNAVAILABLE: "ACTION_UNAVAILABLE";
|
|
1705
|
+
INVALID_INPUT: "INVALID_INPUT";
|
|
1706
|
+
CYCLIC_DEPENDENCY: "CYCLIC_DEPENDENCY";
|
|
1707
|
+
UNKNOWN_FLOW: "UNKNOWN_FLOW";
|
|
1708
|
+
CYCLIC_CALL: "CYCLIC_CALL";
|
|
1709
|
+
UNKNOWN_EFFECT: "UNKNOWN_EFFECT";
|
|
1710
|
+
INTERNAL_ERROR: "INTERNAL_ERROR";
|
|
1711
|
+
}>;
|
|
1712
|
+
type CoreErrorCode = z.infer<typeof CoreErrorCode>;
|
|
1713
|
+
/**
|
|
1714
|
+
* Create an error value (errors are values, not exceptions)
|
|
1715
|
+
*/
|
|
1716
|
+
declare function createError(code: CoreErrorCode, message: string, actionId: string, nodePath: string, timestamp: number, context?: Record<string, unknown>): ErrorValue;
|
|
1717
|
+
/**
|
|
1718
|
+
* Check if a value is an ErrorValue
|
|
1719
|
+
*/
|
|
1720
|
+
declare function isErrorValue(value: unknown): value is ErrorValue;
|
|
1721
|
+
|
|
1722
|
+
/**
|
|
1723
|
+
* Create a new snapshot with initial data
|
|
1724
|
+
*
|
|
1725
|
+
* @param data - Initial domain data
|
|
1726
|
+
* @param schemaHash - Hash of the schema this snapshot conforms to
|
|
1727
|
+
* @returns New snapshot
|
|
1728
|
+
*/
|
|
1729
|
+
declare function createSnapshot<T>(data: T, schemaHash: string, context: HostContext): Snapshot;
|
|
1730
|
+
/**
|
|
1731
|
+
* Create an intent
|
|
1732
|
+
*
|
|
1733
|
+
* @param type - Action type
|
|
1734
|
+
* @param input - Action input (optional)
|
|
1735
|
+
* @param intentId - Unique identifier for this processing attempt (optional, auto-generated if not provided)
|
|
1736
|
+
* @returns Intent
|
|
1737
|
+
*/
|
|
1738
|
+
declare function createIntent(type: string, intentId: string): Intent;
|
|
1739
|
+
declare function createIntent(type: string, input: unknown, intentId: string): Intent;
|
|
1740
|
+
|
|
1
1741
|
/**
|
|
2
1742
|
* @manifesto-ai/core
|
|
3
1743
|
*
|
|
@@ -5,20 +1745,11 @@
|
|
|
5
1745
|
*
|
|
6
1746
|
* Core computes. Host executes. These concerns never mix.
|
|
7
1747
|
*/
|
|
8
|
-
|
|
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 } 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 { validate } from "./core/validate.js";
|
|
17
|
-
import { explain } from "./core/explain.js";
|
|
1748
|
+
|
|
18
1749
|
/**
|
|
19
1750
|
* ManifestoCore interface
|
|
20
1751
|
*/
|
|
21
|
-
|
|
1752
|
+
interface ManifestoCore {
|
|
22
1753
|
/**
|
|
23
1754
|
* Compute the result of dispatching an intent.
|
|
24
1755
|
*
|
|
@@ -35,6 +1766,10 @@ export interface ManifestoCore {
|
|
|
35
1766
|
* Returns new snapshot with recomputed values.
|
|
36
1767
|
*/
|
|
37
1768
|
apply(schema: DomainSchema, snapshot: Snapshot, patches: readonly Patch[], context: HostContext): Snapshot;
|
|
1769
|
+
/**
|
|
1770
|
+
* Apply a system transition emitted by compute().
|
|
1771
|
+
*/
|
|
1772
|
+
applySystemDelta(snapshot: Snapshot, delta: SystemDelta): Snapshot;
|
|
38
1773
|
/**
|
|
39
1774
|
* Validate a schema.
|
|
40
1775
|
*/
|
|
@@ -47,11 +1782,6 @@ export interface ManifestoCore {
|
|
|
47
1782
|
/**
|
|
48
1783
|
* Create a ManifestoCore instance
|
|
49
1784
|
*/
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
export
|
|
53
|
-
export * from "./evaluator/index.js";
|
|
54
|
-
export * from "./errors.js";
|
|
55
|
-
export * from "./factories.js";
|
|
56
|
-
export { compute, computeSync, apply, validate, explain };
|
|
57
|
-
//# sourceMappingURL=index.d.ts.map
|
|
1785
|
+
declare function createCore(): ManifestoCore;
|
|
1786
|
+
|
|
1787
|
+
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, compute, computeSync, createContext, createCore, createError, createFlowState, createInitialSystemState, createIntent, createSnapshot, createTraceContext, createTraceNode, detectCycles, err, evaluateComputed, evaluateExpr, evaluateFlow, evaluateFlowSync, evaluateSingleComputed, explain, extractDefaults, fromCanonical, generateRequirementId, generateRequirementIdSync, generateTraceId, getByPatchPath, getByPath, getTransitiveDeps, hasPath, hashSchema, hashSchemaEffective, hashSchemaEffectiveSync, hashSchemaSync, indexSegment, invalidResult, 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 };
|