@hatua/schema 0.0.0 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/dist/contract.test.d.ts +1 -0
- package/dist/generated/component.d.ts +312 -0
- package/dist/generated/context.d.ts +43 -0
- package/dist/generated/definition.d.ts +309 -0
- package/dist/generated/execution.d.ts +148 -0
- package/dist/generated/function.d.ts +193 -0
- package/dist/generated/index.d.ts +5 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +335 -0
- package/dist/references.d.ts +77 -0
- package/package.json +25 -5
- package/README.md +0 -5
|
@@ -0,0 +1,309 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* A name that has to survive being a path segment. Every user-chosen name sits one segment below a reserved root — `steps.<id>`, `triggers.<id>`, `var.<key>`, `block.<id>` — so a name the expression grammar cannot parse is a name nothing can ever address. Refused here rather than accepted into a file and reported as a broken Reference on every use of it.
|
|
4
|
+
*/
|
|
5
|
+
export declare const identifier: z.ZodString;
|
|
6
|
+
export type Identifier = z.infer<typeof identifier>;
|
|
7
|
+
/**
|
|
8
|
+
* One Board: a step tree whose root is this contract rather than the workflow's triggers.
|
|
9
|
+
* Step ids are scoped to the block, so `{{steps.put}}` inside one names that block's `put` and two blocks may each have a step by the same name. A block's `vars` are its own and are rebuilt on every invocation, which is why a block called twice carries nothing between calls.
|
|
10
|
+
*/
|
|
11
|
+
export declare const block: z.ZodObject<{
|
|
12
|
+
id: z.ZodString;
|
|
13
|
+
name: z.ZodOptional<z.ZodString>;
|
|
14
|
+
params: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
15
|
+
k: z.ZodString;
|
|
16
|
+
label: z.ZodString;
|
|
17
|
+
t: z.ZodEnum<{
|
|
18
|
+
number: "number";
|
|
19
|
+
boolean: "boolean";
|
|
20
|
+
object: "object";
|
|
21
|
+
text: "text";
|
|
22
|
+
datetime: "datetime";
|
|
23
|
+
list: "list";
|
|
24
|
+
}>;
|
|
25
|
+
of: z.ZodOptional<z.ZodArray<z.ZodObject</*elided*/ any, z.core.$strict>>>;
|
|
26
|
+
}, z.core.$strict>>>;
|
|
27
|
+
outputs: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
28
|
+
k: z.ZodString;
|
|
29
|
+
label: z.ZodString;
|
|
30
|
+
t: z.ZodEnum<{
|
|
31
|
+
number: "number";
|
|
32
|
+
boolean: "boolean";
|
|
33
|
+
object: "object";
|
|
34
|
+
text: "text";
|
|
35
|
+
datetime: "datetime";
|
|
36
|
+
list: "list";
|
|
37
|
+
}>;
|
|
38
|
+
of: z.ZodOptional<z.ZodArray<z.ZodObject</*elided*/ any, z.core.$strict>>>;
|
|
39
|
+
}, z.core.$strict>>>;
|
|
40
|
+
vars: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
41
|
+
key: z.ZodString;
|
|
42
|
+
t: z.ZodEnum<{
|
|
43
|
+
number: "number";
|
|
44
|
+
boolean: "boolean";
|
|
45
|
+
object: "object";
|
|
46
|
+
text: "text";
|
|
47
|
+
datetime: "datetime";
|
|
48
|
+
list: "list";
|
|
49
|
+
}>;
|
|
50
|
+
of: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
51
|
+
k: z.ZodString;
|
|
52
|
+
label: z.ZodString;
|
|
53
|
+
t: z.ZodEnum<{
|
|
54
|
+
number: "number";
|
|
55
|
+
boolean: "boolean";
|
|
56
|
+
object: "object";
|
|
57
|
+
text: "text";
|
|
58
|
+
datetime: "datetime";
|
|
59
|
+
list: "list";
|
|
60
|
+
}>;
|
|
61
|
+
of: z.ZodOptional<z.ZodArray<z.ZodObject</*elided*/ any, z.core.$strict>>>;
|
|
62
|
+
}, z.core.$strict>>>;
|
|
63
|
+
value: z.ZodUnknown;
|
|
64
|
+
}, z.core.$strict>>>;
|
|
65
|
+
steps: z.ZodArray<z.ZodObject<{
|
|
66
|
+
id: z.ZodString;
|
|
67
|
+
use: z.ZodString;
|
|
68
|
+
name: z.ZodOptional<z.ZodString>;
|
|
69
|
+
with: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
70
|
+
branches: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
71
|
+
label: z.ZodString;
|
|
72
|
+
when: z.ZodOptional<z.ZodString>;
|
|
73
|
+
steps: z.ZodArray<z.ZodObject</*elided*/ any, z.core.$strict>>;
|
|
74
|
+
}, z.core.$strict>>>;
|
|
75
|
+
steps: z.ZodOptional<z.ZodArray<z.ZodObject</*elided*/ any, z.core.$strict>>>;
|
|
76
|
+
handler: z.ZodOptional<z.ZodArray<z.ZodObject</*elided*/ any, z.core.$strict>>>;
|
|
77
|
+
until: z.ZodOptional<z.ZodString>;
|
|
78
|
+
}, z.core.$strict>>;
|
|
79
|
+
}, z.core.$strict>;
|
|
80
|
+
export type Block = z.infer<typeof block>;
|
|
81
|
+
/**
|
|
82
|
+
* One parameter or one output. Spelled `{k, label, t, of}` exactly as a Component Manifest's output and a Run Context key are — ADR-0012 rejected inventing a second spelling for an idea the contract already has one of, and the reasoning holds here unchanged.
|
|
83
|
+
*/
|
|
84
|
+
export declare const declaration: z.ZodObject<{
|
|
85
|
+
k: z.ZodString;
|
|
86
|
+
label: z.ZodString;
|
|
87
|
+
t: z.ZodEnum<{
|
|
88
|
+
number: "number";
|
|
89
|
+
boolean: "boolean";
|
|
90
|
+
object: "object";
|
|
91
|
+
text: "text";
|
|
92
|
+
datetime: "datetime";
|
|
93
|
+
list: "list";
|
|
94
|
+
}>;
|
|
95
|
+
of: z.ZodOptional<z.ZodArray<z.ZodObject</*elided*/ any, z.core.$strict>>>;
|
|
96
|
+
}, z.core.$strict>;
|
|
97
|
+
export type Declaration = z.infer<typeof declaration>;
|
|
98
|
+
export declare const connection: z.ZodObject<{
|
|
99
|
+
id: z.ZodString;
|
|
100
|
+
ref: z.ZodNullable<z.ZodString>;
|
|
101
|
+
}, z.core.$strict>;
|
|
102
|
+
export type Connection = z.infer<typeof connection>;
|
|
103
|
+
export declare const trigger: z.ZodObject<{
|
|
104
|
+
id: z.ZodString;
|
|
105
|
+
use: z.ZodString;
|
|
106
|
+
name: z.ZodOptional<z.ZodString>;
|
|
107
|
+
with: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
108
|
+
}, z.core.$strict>;
|
|
109
|
+
export type Trigger = z.infer<typeof trigger>;
|
|
110
|
+
/**
|
|
111
|
+
* A list of key/value objects rather than a map, which is what let `t` be added here without inventing a second spelling for a variable.
|
|
112
|
+
* NOT a `declaration`. A declaration is a contract with nothing in it; a variable carries a value, and its key is its own label — the builder shows `var.digest_to`, not a friendly name. `t` and `of` are spelled identically to a declaration's so one function reads both, but three shared fields out of five is not one idea.
|
|
113
|
+
*/
|
|
114
|
+
export declare const variable: z.ZodObject<{
|
|
115
|
+
key: z.ZodString;
|
|
116
|
+
t: z.ZodEnum<{
|
|
117
|
+
number: "number";
|
|
118
|
+
boolean: "boolean";
|
|
119
|
+
object: "object";
|
|
120
|
+
text: "text";
|
|
121
|
+
datetime: "datetime";
|
|
122
|
+
list: "list";
|
|
123
|
+
}>;
|
|
124
|
+
of: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
125
|
+
k: z.ZodString;
|
|
126
|
+
label: z.ZodString;
|
|
127
|
+
t: z.ZodEnum<{
|
|
128
|
+
number: "number";
|
|
129
|
+
boolean: "boolean";
|
|
130
|
+
object: "object";
|
|
131
|
+
text: "text";
|
|
132
|
+
datetime: "datetime";
|
|
133
|
+
list: "list";
|
|
134
|
+
}>;
|
|
135
|
+
of: z.ZodOptional<z.ZodArray<z.ZodObject</*elided*/ any, z.core.$strict>>>;
|
|
136
|
+
}, z.core.$strict>>>;
|
|
137
|
+
value: z.ZodUnknown;
|
|
138
|
+
}, z.core.$strict>;
|
|
139
|
+
export type Variable = z.infer<typeof variable>;
|
|
140
|
+
export declare const step: z.ZodObject<{
|
|
141
|
+
id: z.ZodString;
|
|
142
|
+
use: z.ZodString;
|
|
143
|
+
name: z.ZodOptional<z.ZodString>;
|
|
144
|
+
with: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
145
|
+
branches: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
146
|
+
label: z.ZodString;
|
|
147
|
+
when: z.ZodOptional<z.ZodString>;
|
|
148
|
+
steps: z.ZodArray<z.ZodObject</*elided*/ any, z.core.$strict>>;
|
|
149
|
+
}, z.core.$strict>>>;
|
|
150
|
+
steps: z.ZodOptional<z.ZodArray<z.ZodObject</*elided*/ any, z.core.$strict>>>;
|
|
151
|
+
handler: z.ZodOptional<z.ZodArray<z.ZodObject</*elided*/ any, z.core.$strict>>>;
|
|
152
|
+
until: z.ZodOptional<z.ZodString>;
|
|
153
|
+
}, z.core.$strict>;
|
|
154
|
+
export type Step = z.infer<typeof step>;
|
|
155
|
+
export declare const branch: z.ZodObject<{
|
|
156
|
+
label: z.ZodString;
|
|
157
|
+
when: z.ZodOptional<z.ZodString>;
|
|
158
|
+
steps: z.ZodArray<z.ZodObject<{
|
|
159
|
+
id: z.ZodString;
|
|
160
|
+
use: z.ZodString;
|
|
161
|
+
name: z.ZodOptional<z.ZodString>;
|
|
162
|
+
with: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
163
|
+
branches: z.ZodOptional<z.ZodArray<z.ZodObject</*elided*/ any, z.core.$strict>>>;
|
|
164
|
+
steps: z.ZodOptional<z.ZodArray<z.ZodObject</*elided*/ any, z.core.$strict>>>;
|
|
165
|
+
handler: z.ZodOptional<z.ZodArray<z.ZodObject</*elided*/ any, z.core.$strict>>>;
|
|
166
|
+
until: z.ZodOptional<z.ZodString>;
|
|
167
|
+
}, z.core.$strict>>;
|
|
168
|
+
}, z.core.$strict>;
|
|
169
|
+
export type Branch = z.infer<typeof branch>;
|
|
170
|
+
/**
|
|
171
|
+
* Field values keyed by the manifest's `FieldSpec.k`. Templates remain `{{…}}` strings so the document round-trips and a step can be renamed without breaking a mapping.
|
|
172
|
+
* A `map` field holds a list of `{key, value, type}` objects rather than a scalar — see `core.map` on `use`. That shape is deliberately NOT declared as a `$def` here: which key holds a map field is decided by the Component Manifest, not by this schema, so JSON Schema cannot reach it. It is checked where the manifest is known, in `@hatua/model` and the Go SDK, and an unreferenced definition would be a promise this file does not keep.
|
|
173
|
+
* `key` is how downstream steps address the entry — `{{<step id>.<key>}}`. `type` is declared rather than inferred from `value`, for the same reason every other field's type is: the expression is checked against the declared type, never the reverse.
|
|
174
|
+
*/
|
|
175
|
+
export declare const values: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
176
|
+
export type Values = z.infer<typeof values>;
|
|
177
|
+
/**
|
|
178
|
+
* The declarative description of a workflow — its steps, the mapping between one step's typed outputs and the next step's inputs, branches and loops. Read AND written by Hatua, unlike a Workflow Execution which is only ever read.
|
|
179
|
+
* Steps form a TREE, nesting through `branches` (forks) and `steps` (loops); they are never an arbitrary graph. There is deliberately no position data anywhere in this document: node placement is computed from the tree on every render, which is what makes it impossible for a hand-edited file and the flow map to disagree. See ADR-0001.
|
|
180
|
+
*/
|
|
181
|
+
export declare const workflowDefinition: z.ZodObject<{
|
|
182
|
+
id: z.ZodString;
|
|
183
|
+
name: z.ZodString;
|
|
184
|
+
version: z.ZodNumber;
|
|
185
|
+
status: z.ZodEnum<{
|
|
186
|
+
published: "published";
|
|
187
|
+
draft: "draft";
|
|
188
|
+
archived: "archived";
|
|
189
|
+
}>;
|
|
190
|
+
connections: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
191
|
+
id: z.ZodString;
|
|
192
|
+
ref: z.ZodNullable<z.ZodString>;
|
|
193
|
+
}, z.core.$strict>>>;
|
|
194
|
+
triggers: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
195
|
+
id: z.ZodString;
|
|
196
|
+
use: z.ZodString;
|
|
197
|
+
name: z.ZodOptional<z.ZodString>;
|
|
198
|
+
with: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
199
|
+
}, z.core.$strict>>>;
|
|
200
|
+
vars: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
201
|
+
key: z.ZodString;
|
|
202
|
+
t: z.ZodEnum<{
|
|
203
|
+
number: "number";
|
|
204
|
+
boolean: "boolean";
|
|
205
|
+
object: "object";
|
|
206
|
+
text: "text";
|
|
207
|
+
datetime: "datetime";
|
|
208
|
+
list: "list";
|
|
209
|
+
}>;
|
|
210
|
+
of: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
211
|
+
k: z.ZodString;
|
|
212
|
+
label: z.ZodString;
|
|
213
|
+
t: z.ZodEnum<{
|
|
214
|
+
number: "number";
|
|
215
|
+
boolean: "boolean";
|
|
216
|
+
object: "object";
|
|
217
|
+
text: "text";
|
|
218
|
+
datetime: "datetime";
|
|
219
|
+
list: "list";
|
|
220
|
+
}>;
|
|
221
|
+
of: z.ZodOptional<z.ZodArray<z.ZodObject</*elided*/ any, z.core.$strict>>>;
|
|
222
|
+
}, z.core.$strict>>>;
|
|
223
|
+
value: z.ZodUnknown;
|
|
224
|
+
}, z.core.$strict>>>;
|
|
225
|
+
blocks: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
226
|
+
id: z.ZodString;
|
|
227
|
+
name: z.ZodOptional<z.ZodString>;
|
|
228
|
+
params: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
229
|
+
k: z.ZodString;
|
|
230
|
+
label: z.ZodString;
|
|
231
|
+
t: z.ZodEnum<{
|
|
232
|
+
number: "number";
|
|
233
|
+
boolean: "boolean";
|
|
234
|
+
object: "object";
|
|
235
|
+
text: "text";
|
|
236
|
+
datetime: "datetime";
|
|
237
|
+
list: "list";
|
|
238
|
+
}>;
|
|
239
|
+
of: z.ZodOptional<z.ZodArray<z.ZodObject</*elided*/ any, z.core.$strict>>>;
|
|
240
|
+
}, z.core.$strict>>>;
|
|
241
|
+
outputs: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
242
|
+
k: z.ZodString;
|
|
243
|
+
label: z.ZodString;
|
|
244
|
+
t: z.ZodEnum<{
|
|
245
|
+
number: "number";
|
|
246
|
+
boolean: "boolean";
|
|
247
|
+
object: "object";
|
|
248
|
+
text: "text";
|
|
249
|
+
datetime: "datetime";
|
|
250
|
+
list: "list";
|
|
251
|
+
}>;
|
|
252
|
+
of: z.ZodOptional<z.ZodArray<z.ZodObject</*elided*/ any, z.core.$strict>>>;
|
|
253
|
+
}, z.core.$strict>>>;
|
|
254
|
+
vars: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
255
|
+
key: z.ZodString;
|
|
256
|
+
t: z.ZodEnum<{
|
|
257
|
+
number: "number";
|
|
258
|
+
boolean: "boolean";
|
|
259
|
+
object: "object";
|
|
260
|
+
text: "text";
|
|
261
|
+
datetime: "datetime";
|
|
262
|
+
list: "list";
|
|
263
|
+
}>;
|
|
264
|
+
of: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
265
|
+
k: z.ZodString;
|
|
266
|
+
label: z.ZodString;
|
|
267
|
+
t: z.ZodEnum<{
|
|
268
|
+
number: "number";
|
|
269
|
+
boolean: "boolean";
|
|
270
|
+
object: "object";
|
|
271
|
+
text: "text";
|
|
272
|
+
datetime: "datetime";
|
|
273
|
+
list: "list";
|
|
274
|
+
}>;
|
|
275
|
+
of: z.ZodOptional<z.ZodArray<z.ZodObject</*elided*/ any, z.core.$strict>>>;
|
|
276
|
+
}, z.core.$strict>>>;
|
|
277
|
+
value: z.ZodUnknown;
|
|
278
|
+
}, z.core.$strict>>>;
|
|
279
|
+
steps: z.ZodArray<z.ZodObject<{
|
|
280
|
+
id: z.ZodString;
|
|
281
|
+
use: z.ZodString;
|
|
282
|
+
name: z.ZodOptional<z.ZodString>;
|
|
283
|
+
with: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
284
|
+
branches: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
285
|
+
label: z.ZodString;
|
|
286
|
+
when: z.ZodOptional<z.ZodString>;
|
|
287
|
+
steps: z.ZodArray<z.ZodObject</*elided*/ any, z.core.$strict>>;
|
|
288
|
+
}, z.core.$strict>>>;
|
|
289
|
+
steps: z.ZodOptional<z.ZodArray<z.ZodObject</*elided*/ any, z.core.$strict>>>;
|
|
290
|
+
handler: z.ZodOptional<z.ZodArray<z.ZodObject</*elided*/ any, z.core.$strict>>>;
|
|
291
|
+
until: z.ZodOptional<z.ZodString>;
|
|
292
|
+
}, z.core.$strict>>;
|
|
293
|
+
}, z.core.$strict>>>;
|
|
294
|
+
steps: z.ZodArray<z.ZodObject<{
|
|
295
|
+
id: z.ZodString;
|
|
296
|
+
use: z.ZodString;
|
|
297
|
+
name: z.ZodOptional<z.ZodString>;
|
|
298
|
+
with: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
299
|
+
branches: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
300
|
+
label: z.ZodString;
|
|
301
|
+
when: z.ZodOptional<z.ZodString>;
|
|
302
|
+
steps: z.ZodArray<z.ZodObject</*elided*/ any, z.core.$strict>>;
|
|
303
|
+
}, z.core.$strict>>>;
|
|
304
|
+
steps: z.ZodOptional<z.ZodArray<z.ZodObject</*elided*/ any, z.core.$strict>>>;
|
|
305
|
+
handler: z.ZodOptional<z.ZodArray<z.ZodObject</*elided*/ any, z.core.$strict>>>;
|
|
306
|
+
until: z.ZodOptional<z.ZodString>;
|
|
307
|
+
}, z.core.$strict>>;
|
|
308
|
+
}, z.core.$strict>;
|
|
309
|
+
export type WorkflowDefinition = z.infer<typeof workflowDefinition>;
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const stepExecution: z.ZodObject<{
|
|
3
|
+
id: z.ZodString;
|
|
4
|
+
status: z.ZodEnum<{
|
|
5
|
+
pending: "pending";
|
|
6
|
+
running: "running";
|
|
7
|
+
succeeded: "succeeded";
|
|
8
|
+
failed: "failed";
|
|
9
|
+
skipped: "skipped";
|
|
10
|
+
}>;
|
|
11
|
+
duration_ms: z.ZodOptional<z.ZodNumber>;
|
|
12
|
+
resolved_input: z.ZodOptional<z.ZodUnknown>;
|
|
13
|
+
output: z.ZodOptional<z.ZodUnknown>;
|
|
14
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
15
|
+
error: z.ZodOptional<z.ZodObject<{
|
|
16
|
+
message: z.ZodString;
|
|
17
|
+
code: z.ZodOptional<z.ZodString>;
|
|
18
|
+
}, z.core.$strict>>;
|
|
19
|
+
iterations: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
20
|
+
index: z.ZodNumber;
|
|
21
|
+
status: z.ZodEnum<{
|
|
22
|
+
pending: "pending";
|
|
23
|
+
running: "running";
|
|
24
|
+
succeeded: "succeeded";
|
|
25
|
+
failed: "failed";
|
|
26
|
+
skipped: "skipped";
|
|
27
|
+
}>;
|
|
28
|
+
duration_ms: z.ZodOptional<z.ZodNumber>;
|
|
29
|
+
steps: z.ZodOptional<z.ZodArray<z.ZodObject</*elided*/ any, z.core.$strict>>>;
|
|
30
|
+
error: z.ZodOptional<z.ZodObject<{
|
|
31
|
+
message: z.ZodString;
|
|
32
|
+
code: z.ZodOptional<z.ZodString>;
|
|
33
|
+
}, z.core.$strict>>;
|
|
34
|
+
}, z.core.$strict>>>;
|
|
35
|
+
}, z.core.$strict>;
|
|
36
|
+
export type StepExecution = z.infer<typeof stepExecution>;
|
|
37
|
+
export declare const iteration: z.ZodObject<{
|
|
38
|
+
index: z.ZodNumber;
|
|
39
|
+
status: z.ZodEnum<{
|
|
40
|
+
pending: "pending";
|
|
41
|
+
running: "running";
|
|
42
|
+
succeeded: "succeeded";
|
|
43
|
+
failed: "failed";
|
|
44
|
+
skipped: "skipped";
|
|
45
|
+
}>;
|
|
46
|
+
duration_ms: z.ZodOptional<z.ZodNumber>;
|
|
47
|
+
steps: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
48
|
+
id: z.ZodString;
|
|
49
|
+
status: z.ZodEnum<{
|
|
50
|
+
pending: "pending";
|
|
51
|
+
running: "running";
|
|
52
|
+
succeeded: "succeeded";
|
|
53
|
+
failed: "failed";
|
|
54
|
+
skipped: "skipped";
|
|
55
|
+
}>;
|
|
56
|
+
duration_ms: z.ZodOptional<z.ZodNumber>;
|
|
57
|
+
resolved_input: z.ZodOptional<z.ZodUnknown>;
|
|
58
|
+
output: z.ZodOptional<z.ZodUnknown>;
|
|
59
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
60
|
+
error: z.ZodOptional<z.ZodObject<{
|
|
61
|
+
message: z.ZodString;
|
|
62
|
+
code: z.ZodOptional<z.ZodString>;
|
|
63
|
+
}, z.core.$strict>>;
|
|
64
|
+
iterations: z.ZodOptional<z.ZodArray<z.ZodObject</*elided*/ any, z.core.$strict>>>;
|
|
65
|
+
}, z.core.$strict>>>;
|
|
66
|
+
error: z.ZodOptional<z.ZodObject<{
|
|
67
|
+
message: z.ZodString;
|
|
68
|
+
code: z.ZodOptional<z.ZodString>;
|
|
69
|
+
}, z.core.$strict>>;
|
|
70
|
+
}, z.core.$strict>;
|
|
71
|
+
export type Iteration = z.infer<typeof iteration>;
|
|
72
|
+
export declare const error: z.ZodObject<{
|
|
73
|
+
message: z.ZodString;
|
|
74
|
+
code: z.ZodOptional<z.ZodString>;
|
|
75
|
+
}, z.core.$strict>;
|
|
76
|
+
export type Error = z.infer<typeof error>;
|
|
77
|
+
export declare const logEntry: z.ZodObject<{
|
|
78
|
+
at: z.ZodISODateTime;
|
|
79
|
+
step: z.ZodOptional<z.ZodString>;
|
|
80
|
+
channel: z.ZodOptional<z.ZodString>;
|
|
81
|
+
message: z.ZodString;
|
|
82
|
+
}, z.core.$strict>;
|
|
83
|
+
export type LogEntry = z.infer<typeof logEntry>;
|
|
84
|
+
/**
|
|
85
|
+
* The record of one run of a Workflow Definition, handed to Hatua by the Host and rendered as run history. Read-only: Hatua never produces one, because it never executes anything.
|
|
86
|
+
* An execution REFERENCES its definition by version rather than embedding it. That is why published versions are immutable and retained — painting a three-week-old run against today's definition would put durations on steps that did not exist and silently drop steps that did.
|
|
87
|
+
* There is no run-level metadata block. Totals and pivots (`tokens per model`, `tokens per step`) are derived by Hatua from the per-step values below, using the `measure` / `dimension` roles the component manifests declare. That keeps runners from each inventing their own summary shape.
|
|
88
|
+
*/
|
|
89
|
+
export declare const workflowExecution: z.ZodObject<{
|
|
90
|
+
run_id: z.ZodString;
|
|
91
|
+
status: z.ZodEnum<{
|
|
92
|
+
running: "running";
|
|
93
|
+
succeeded: "succeeded";
|
|
94
|
+
failed: "failed";
|
|
95
|
+
}>;
|
|
96
|
+
workflow: z.ZodObject<{
|
|
97
|
+
id: z.ZodString;
|
|
98
|
+
version: z.ZodNumber;
|
|
99
|
+
}, z.core.$strict>;
|
|
100
|
+
trigger: z.ZodOptional<z.ZodObject<{
|
|
101
|
+
id: z.ZodString;
|
|
102
|
+
payload: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
103
|
+
}, z.core.$strict>>;
|
|
104
|
+
started_at: z.ZodISODateTime;
|
|
105
|
+
finished_at: z.ZodOptional<z.ZodISODateTime>;
|
|
106
|
+
duration_ms: z.ZodOptional<z.ZodNumber>;
|
|
107
|
+
steps: z.ZodArray<z.ZodObject<{
|
|
108
|
+
id: z.ZodString;
|
|
109
|
+
status: z.ZodEnum<{
|
|
110
|
+
pending: "pending";
|
|
111
|
+
running: "running";
|
|
112
|
+
succeeded: "succeeded";
|
|
113
|
+
failed: "failed";
|
|
114
|
+
skipped: "skipped";
|
|
115
|
+
}>;
|
|
116
|
+
duration_ms: z.ZodOptional<z.ZodNumber>;
|
|
117
|
+
resolved_input: z.ZodOptional<z.ZodUnknown>;
|
|
118
|
+
output: z.ZodOptional<z.ZodUnknown>;
|
|
119
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
120
|
+
error: z.ZodOptional<z.ZodObject<{
|
|
121
|
+
message: z.ZodString;
|
|
122
|
+
code: z.ZodOptional<z.ZodString>;
|
|
123
|
+
}, z.core.$strict>>;
|
|
124
|
+
iterations: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
125
|
+
index: z.ZodNumber;
|
|
126
|
+
status: z.ZodEnum<{
|
|
127
|
+
pending: "pending";
|
|
128
|
+
running: "running";
|
|
129
|
+
succeeded: "succeeded";
|
|
130
|
+
failed: "failed";
|
|
131
|
+
skipped: "skipped";
|
|
132
|
+
}>;
|
|
133
|
+
duration_ms: z.ZodOptional<z.ZodNumber>;
|
|
134
|
+
steps: z.ZodOptional<z.ZodArray<z.ZodObject</*elided*/ any, z.core.$strict>>>;
|
|
135
|
+
error: z.ZodOptional<z.ZodObject<{
|
|
136
|
+
message: z.ZodString;
|
|
137
|
+
code: z.ZodOptional<z.ZodString>;
|
|
138
|
+
}, z.core.$strict>>;
|
|
139
|
+
}, z.core.$strict>>>;
|
|
140
|
+
}, z.core.$strict>>;
|
|
141
|
+
log: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
142
|
+
at: z.ZodISODateTime;
|
|
143
|
+
step: z.ZodOptional<z.ZodString>;
|
|
144
|
+
channel: z.ZodOptional<z.ZodString>;
|
|
145
|
+
message: z.ZodString;
|
|
146
|
+
}, z.core.$strict>>>;
|
|
147
|
+
}, z.core.$strict>;
|
|
148
|
+
export type WorkflowExecution = z.infer<typeof workflowExecution>;
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const functionNamespace: z.ZodObject<{
|
|
3
|
+
kind: z.ZodEnum<{
|
|
4
|
+
function: "function";
|
|
5
|
+
}>;
|
|
6
|
+
namespace: z.ZodString;
|
|
7
|
+
summary: z.ZodOptional<z.ZodString>;
|
|
8
|
+
functions: z.ZodArray<z.ZodObject<{
|
|
9
|
+
name: z.ZodString;
|
|
10
|
+
summary: z.ZodOptional<z.ZodString>;
|
|
11
|
+
params: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
12
|
+
name: z.ZodString;
|
|
13
|
+
type: z.ZodEnum<{
|
|
14
|
+
number: "number";
|
|
15
|
+
boolean: "boolean";
|
|
16
|
+
object: "object";
|
|
17
|
+
text: "text";
|
|
18
|
+
null: "null";
|
|
19
|
+
unknown: "unknown";
|
|
20
|
+
datetime: "datetime";
|
|
21
|
+
list: "list";
|
|
22
|
+
item: "item";
|
|
23
|
+
}>;
|
|
24
|
+
description: z.ZodOptional<z.ZodString>;
|
|
25
|
+
optional: z.ZodOptional<z.ZodBoolean>;
|
|
26
|
+
variadic: z.ZodOptional<z.ZodBoolean>;
|
|
27
|
+
}, z.core.$strict>>>;
|
|
28
|
+
returns: z.ZodEnum<{
|
|
29
|
+
number: "number";
|
|
30
|
+
boolean: "boolean";
|
|
31
|
+
object: "object";
|
|
32
|
+
text: "text";
|
|
33
|
+
null: "null";
|
|
34
|
+
unknown: "unknown";
|
|
35
|
+
datetime: "datetime";
|
|
36
|
+
list: "list";
|
|
37
|
+
item: "item";
|
|
38
|
+
}>;
|
|
39
|
+
}, z.core.$strict>>;
|
|
40
|
+
}, z.core.$strict>;
|
|
41
|
+
export type FunctionNamespace = z.infer<typeof functionNamespace>;
|
|
42
|
+
export declare const functionSpec: z.ZodObject<{
|
|
43
|
+
name: z.ZodString;
|
|
44
|
+
summary: z.ZodOptional<z.ZodString>;
|
|
45
|
+
params: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
46
|
+
name: z.ZodString;
|
|
47
|
+
type: z.ZodEnum<{
|
|
48
|
+
number: "number";
|
|
49
|
+
boolean: "boolean";
|
|
50
|
+
object: "object";
|
|
51
|
+
text: "text";
|
|
52
|
+
null: "null";
|
|
53
|
+
unknown: "unknown";
|
|
54
|
+
datetime: "datetime";
|
|
55
|
+
list: "list";
|
|
56
|
+
item: "item";
|
|
57
|
+
}>;
|
|
58
|
+
description: z.ZodOptional<z.ZodString>;
|
|
59
|
+
optional: z.ZodOptional<z.ZodBoolean>;
|
|
60
|
+
variadic: z.ZodOptional<z.ZodBoolean>;
|
|
61
|
+
}, z.core.$strict>>>;
|
|
62
|
+
returns: z.ZodEnum<{
|
|
63
|
+
number: "number";
|
|
64
|
+
boolean: "boolean";
|
|
65
|
+
object: "object";
|
|
66
|
+
text: "text";
|
|
67
|
+
null: "null";
|
|
68
|
+
unknown: "unknown";
|
|
69
|
+
datetime: "datetime";
|
|
70
|
+
list: "list";
|
|
71
|
+
item: "item";
|
|
72
|
+
}>;
|
|
73
|
+
}, z.core.$strict>;
|
|
74
|
+
export type FunctionSpec = z.infer<typeof functionSpec>;
|
|
75
|
+
export declare const param: z.ZodObject<{
|
|
76
|
+
name: z.ZodString;
|
|
77
|
+
type: z.ZodEnum<{
|
|
78
|
+
number: "number";
|
|
79
|
+
boolean: "boolean";
|
|
80
|
+
object: "object";
|
|
81
|
+
text: "text";
|
|
82
|
+
null: "null";
|
|
83
|
+
unknown: "unknown";
|
|
84
|
+
datetime: "datetime";
|
|
85
|
+
list: "list";
|
|
86
|
+
item: "item";
|
|
87
|
+
}>;
|
|
88
|
+
description: z.ZodOptional<z.ZodString>;
|
|
89
|
+
optional: z.ZodOptional<z.ZodBoolean>;
|
|
90
|
+
variadic: z.ZodOptional<z.ZodBoolean>;
|
|
91
|
+
}, z.core.$strict>;
|
|
92
|
+
export type Param = z.infer<typeof param>;
|
|
93
|
+
/**
|
|
94
|
+
* The Component Manifest's output types, plus the two that exist only in the expression language: `unknown` for a value whose type cannot be known statically — which is accepted with a warning and checked at run time — and `null`, the one absent value, which satisfies any declared type.
|
|
95
|
+
*/
|
|
96
|
+
export declare const valueType: z.ZodEnum<{
|
|
97
|
+
number: "number";
|
|
98
|
+
boolean: "boolean";
|
|
99
|
+
object: "object";
|
|
100
|
+
text: "text";
|
|
101
|
+
null: "null";
|
|
102
|
+
unknown: "unknown";
|
|
103
|
+
datetime: "datetime";
|
|
104
|
+
list: "list";
|
|
105
|
+
item: "item";
|
|
106
|
+
}>;
|
|
107
|
+
export type ValueType = z.infer<typeof valueType>;
|
|
108
|
+
/**
|
|
109
|
+
* The Host-supplied declaration of functions an Expression may call — `crm.owner_of(...)`, `pricing.tier(...)`. Hatua ships its own set under `dt`, `text`, `num`, `list` and `json`; the format is identical and the only difference is who wrote the file.
|
|
110
|
+
* Hatua never implements a Host function. It reads the signature so the builder can offer it, check its arity and argument types, and know what it returns; the Host's runner supplies the code. A declaration with no implementation behind it fails when the registry is built, not at a call site in production.
|
|
111
|
+
* This is a separate file rather than a third `kind:` inside the Component Manifest. A conditional manifest shape — `if kind is function then ...` — would need the JSON-Schema-to-zod generator to grow `if`/`then` support, and ADR-0006 keeps that generator deliberately narrow precisely because a silent mistranslation there is the failure the whole decision prevents.
|
|
112
|
+
* A namespace and name Hatua already declares is a loud error at merge time. Either silent winner — Hatua's or the Host's — is a workflow that behaves differently depending on which registry was built first, and neither is discoverable from the workflow.
|
|
113
|
+
*/
|
|
114
|
+
export declare const functionManifest: z.ZodUnion<readonly [z.ZodObject<{
|
|
115
|
+
kind: z.ZodEnum<{
|
|
116
|
+
function: "function";
|
|
117
|
+
}>;
|
|
118
|
+
namespace: z.ZodString;
|
|
119
|
+
summary: z.ZodOptional<z.ZodString>;
|
|
120
|
+
functions: z.ZodArray<z.ZodObject<{
|
|
121
|
+
name: z.ZodString;
|
|
122
|
+
summary: z.ZodOptional<z.ZodString>;
|
|
123
|
+
params: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
124
|
+
name: z.ZodString;
|
|
125
|
+
type: z.ZodEnum<{
|
|
126
|
+
number: "number";
|
|
127
|
+
boolean: "boolean";
|
|
128
|
+
object: "object";
|
|
129
|
+
text: "text";
|
|
130
|
+
null: "null";
|
|
131
|
+
unknown: "unknown";
|
|
132
|
+
datetime: "datetime";
|
|
133
|
+
list: "list";
|
|
134
|
+
item: "item";
|
|
135
|
+
}>;
|
|
136
|
+
description: z.ZodOptional<z.ZodString>;
|
|
137
|
+
optional: z.ZodOptional<z.ZodBoolean>;
|
|
138
|
+
variadic: z.ZodOptional<z.ZodBoolean>;
|
|
139
|
+
}, z.core.$strict>>>;
|
|
140
|
+
returns: z.ZodEnum<{
|
|
141
|
+
number: "number";
|
|
142
|
+
boolean: "boolean";
|
|
143
|
+
object: "object";
|
|
144
|
+
text: "text";
|
|
145
|
+
null: "null";
|
|
146
|
+
unknown: "unknown";
|
|
147
|
+
datetime: "datetime";
|
|
148
|
+
list: "list";
|
|
149
|
+
item: "item";
|
|
150
|
+
}>;
|
|
151
|
+
}, z.core.$strict>>;
|
|
152
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
153
|
+
namespaces: z.ZodArray<z.ZodObject<{
|
|
154
|
+
kind: z.ZodEnum<{
|
|
155
|
+
function: "function";
|
|
156
|
+
}>;
|
|
157
|
+
namespace: z.ZodString;
|
|
158
|
+
summary: z.ZodOptional<z.ZodString>;
|
|
159
|
+
functions: z.ZodArray<z.ZodObject<{
|
|
160
|
+
name: z.ZodString;
|
|
161
|
+
summary: z.ZodOptional<z.ZodString>;
|
|
162
|
+
params: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
163
|
+
name: z.ZodString;
|
|
164
|
+
type: z.ZodEnum<{
|
|
165
|
+
number: "number";
|
|
166
|
+
boolean: "boolean";
|
|
167
|
+
object: "object";
|
|
168
|
+
text: "text";
|
|
169
|
+
null: "null";
|
|
170
|
+
unknown: "unknown";
|
|
171
|
+
datetime: "datetime";
|
|
172
|
+
list: "list";
|
|
173
|
+
item: "item";
|
|
174
|
+
}>;
|
|
175
|
+
description: z.ZodOptional<z.ZodString>;
|
|
176
|
+
optional: z.ZodOptional<z.ZodBoolean>;
|
|
177
|
+
variadic: z.ZodOptional<z.ZodBoolean>;
|
|
178
|
+
}, z.core.$strict>>>;
|
|
179
|
+
returns: z.ZodEnum<{
|
|
180
|
+
number: "number";
|
|
181
|
+
boolean: "boolean";
|
|
182
|
+
object: "object";
|
|
183
|
+
text: "text";
|
|
184
|
+
null: "null";
|
|
185
|
+
unknown: "unknown";
|
|
186
|
+
datetime: "datetime";
|
|
187
|
+
list: "list";
|
|
188
|
+
item: "item";
|
|
189
|
+
}>;
|
|
190
|
+
}, z.core.$strict>>;
|
|
191
|
+
}, z.core.$strict>>;
|
|
192
|
+
}, z.core.$strict>]>;
|
|
193
|
+
export type FunctionManifest = z.infer<typeof functionManifest>;
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The contract. Types and runtime validation for the three payloads.
|
|
3
|
+
*
|
|
4
|
+
* Most of this package is GENERATED from `schemas/*.schema.yaml`, which is the
|
|
5
|
+
* source of truth — see `schemas/README.md` for why the schema is hand-authored
|
|
6
|
+
* as JSON Schema rather than as zod. Only behaviour that no schema can express
|
|
7
|
+
* is hand-written here.
|
|
8
|
+
*/
|
|
9
|
+
export * from './generated';
|
|
10
|
+
export * from './references';
|