@onereach/state-machine-contracts 0.0.0-stage → 1.0.0-framework.12
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 +455 -2
- package/dist/index.d.mts +741 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +14 -0
- package/dist/index.mjs.map +1 -0
- package/dist/json-schemas/CreateStateMachineInstanceRequestSchema.json +64 -0
- package/dist/json-schemas/CreateStateMachineTemplateSchema.json +203 -0
- package/dist/json-schemas/ExecuteStateMachineFunctionRequestSchema.json +38 -0
- package/dist/json-schemas/FunctionImplementationSchema.json +55 -0
- package/dist/json-schemas/FunctionKindSchema.json +8 -0
- package/dist/json-schemas/JsonSchemaSchema.json +7 -0
- package/dist/json-schemas/ObjectJsonSchemaSchema.json +16 -0
- package/dist/json-schemas/StateMachineFunctionDefinitionSchema.json +140 -0
- package/dist/json-schemas/StateMachineInstanceSchema.json +99 -0
- package/dist/json-schemas/StateMachineTemplateBindingSchema.json +26 -0
- package/dist/json-schemas/StateMachineTemplateSchema.json +203 -0
- package/dist/schemas/index.d.mts +732 -0
- package/dist/schemas/index.d.mts.map +1 -0
- package/dist/schemas/index.mjs +2 -0
- package/dist/schemas/index.mjs.map +1 -0
- package/package.json +59 -3
|
@@ -0,0 +1,732 @@
|
|
|
1
|
+
//#region generated/schema-values.d.mts
|
|
2
|
+
declare const CreateStateMachineInstanceRequestSchema: {
|
|
3
|
+
readonly description: "Request to create an instance; the store resolves its template and assigns persisted lifecycle fields.";
|
|
4
|
+
readonly additionalProperties: false;
|
|
5
|
+
readonly type: "object";
|
|
6
|
+
readonly required: readonly ["id", "template"];
|
|
7
|
+
readonly properties: {
|
|
8
|
+
readonly id: {
|
|
9
|
+
readonly description: "Unique identifier of the instance.";
|
|
10
|
+
readonly minLength: 1;
|
|
11
|
+
readonly type: "string";
|
|
12
|
+
};
|
|
13
|
+
readonly template: {
|
|
14
|
+
readonly description: "Template reference to resolve during creation, not a persisted revision binding.";
|
|
15
|
+
readonly additionalProperties: false;
|
|
16
|
+
readonly type: "object";
|
|
17
|
+
readonly required: readonly ["id"];
|
|
18
|
+
readonly properties: {
|
|
19
|
+
readonly id: {
|
|
20
|
+
readonly description: "Unique identifier of the template.";
|
|
21
|
+
readonly minLength: 1;
|
|
22
|
+
readonly type: "string";
|
|
23
|
+
};
|
|
24
|
+
readonly version: {
|
|
25
|
+
readonly description: "Logical application version of the template. Optional because the template may have no version.";
|
|
26
|
+
readonly type: "string";
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
readonly state: {
|
|
31
|
+
readonly description: "Optional initial state override. The store clones it, or the resolved template initial state when omitted, and validates it against the template state schema.";
|
|
32
|
+
readonly additionalProperties: true;
|
|
33
|
+
readonly type: "object";
|
|
34
|
+
readonly properties: {};
|
|
35
|
+
};
|
|
36
|
+
readonly metadata: {
|
|
37
|
+
readonly description: "Optional application-defined metadata about the instance. Arbitrary keys are preserved.";
|
|
38
|
+
readonly additionalProperties: true;
|
|
39
|
+
readonly type: "object";
|
|
40
|
+
readonly properties: {};
|
|
41
|
+
};
|
|
42
|
+
readonly retention: {
|
|
43
|
+
readonly description: "Instance-owned retention policy, independent of execution callers and application state.";
|
|
44
|
+
readonly additionalProperties: false;
|
|
45
|
+
readonly type: "object";
|
|
46
|
+
readonly required: readonly ["ttlMs"];
|
|
47
|
+
readonly properties: {
|
|
48
|
+
readonly ttlMs: {
|
|
49
|
+
readonly description: "Sliding expiration duration in milliseconds, renewed on successful persisted updates. Zero means no expiration.";
|
|
50
|
+
readonly minimum: 0;
|
|
51
|
+
readonly maximum: 9007199254740991;
|
|
52
|
+
readonly type: "integer";
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
declare const CreateStateMachineTemplateSchema: {
|
|
59
|
+
readonly description: "Persisted state-machine template defining shared state, initial state, and available functions.";
|
|
60
|
+
readonly additionalProperties: false;
|
|
61
|
+
readonly type: "object";
|
|
62
|
+
readonly required: readonly ["schemaVersion", "id", "stateSchema", "initialState", "functions"];
|
|
63
|
+
readonly properties: {
|
|
64
|
+
readonly schemaVersion: {
|
|
65
|
+
readonly description: "Version of the persisted template format, not the logical application version.";
|
|
66
|
+
readonly const: 1;
|
|
67
|
+
readonly type: "number";
|
|
68
|
+
};
|
|
69
|
+
readonly id: {
|
|
70
|
+
readonly description: "Unique identifier of the template.";
|
|
71
|
+
readonly minLength: 1;
|
|
72
|
+
readonly type: "string";
|
|
73
|
+
};
|
|
74
|
+
readonly version: {
|
|
75
|
+
readonly description: "Optional logical application version. This is different from a storage-driver revision.";
|
|
76
|
+
readonly type: "string";
|
|
77
|
+
};
|
|
78
|
+
readonly description: {
|
|
79
|
+
readonly description: "Optional human-readable explanation of the state machine.";
|
|
80
|
+
readonly type: "string";
|
|
81
|
+
};
|
|
82
|
+
readonly stateSchema: {
|
|
83
|
+
readonly description: "Object-form JSON Schema shared by every function to validate instance state. Core checks its shape only; the injected schema compiler validates and compiles its constraints.";
|
|
84
|
+
readonly additionalProperties: true;
|
|
85
|
+
readonly type: "object";
|
|
86
|
+
readonly required: readonly ["type"];
|
|
87
|
+
readonly properties: {
|
|
88
|
+
readonly type: {
|
|
89
|
+
readonly description: "Explicit root instance type required for state and function-input schemas.";
|
|
90
|
+
readonly const: "object";
|
|
91
|
+
readonly type: "string";
|
|
92
|
+
};
|
|
93
|
+
};
|
|
94
|
+
};
|
|
95
|
+
readonly initialState: {
|
|
96
|
+
readonly description: "Default state used when creating an instance without an explicit state override. Must satisfy stateSchema when the template is prepared.";
|
|
97
|
+
readonly additionalProperties: true;
|
|
98
|
+
readonly type: "object";
|
|
99
|
+
readonly properties: {};
|
|
100
|
+
};
|
|
101
|
+
readonly functions: {
|
|
102
|
+
readonly description: "Functions available on instances of this template. Names must be unique; the template parser enforces this semantic rule.";
|
|
103
|
+
readonly type: "array";
|
|
104
|
+
readonly items: {
|
|
105
|
+
readonly description: "Named state-machine function, including its input/output contracts and executable implementation.";
|
|
106
|
+
readonly additionalProperties: false;
|
|
107
|
+
readonly type: "object";
|
|
108
|
+
readonly required: readonly ["name", "kind", "inputSchema", "implementation"];
|
|
109
|
+
readonly properties: {
|
|
110
|
+
readonly name: {
|
|
111
|
+
readonly description: "Function name, unique within the template. Must contain 1–64 ASCII letters, digits, underscores, or hyphens.";
|
|
112
|
+
readonly minLength: 1;
|
|
113
|
+
readonly maxLength: 64;
|
|
114
|
+
readonly pattern: "^[a-zA-Z0-9_-]{1,64}$";
|
|
115
|
+
readonly type: "string";
|
|
116
|
+
};
|
|
117
|
+
readonly description: {
|
|
118
|
+
readonly description: "Optional human-readable explanation of the function.";
|
|
119
|
+
readonly type: "string";
|
|
120
|
+
};
|
|
121
|
+
readonly kind: {
|
|
122
|
+
readonly description: "Function classification: queries read state; mutations may update state.";
|
|
123
|
+
readonly enum: readonly ["query", "mutation"];
|
|
124
|
+
};
|
|
125
|
+
readonly inputSchema: {
|
|
126
|
+
readonly description: "Object-form JSON Schema for input, the first implementation argument. Core checks its shape only; the injected schema compiler validates and compiles its constraints.";
|
|
127
|
+
readonly additionalProperties: true;
|
|
128
|
+
readonly type: "object";
|
|
129
|
+
readonly required: readonly ["type"];
|
|
130
|
+
readonly properties: {
|
|
131
|
+
readonly type: {
|
|
132
|
+
readonly description: "Explicit root instance type required for state and function-input schemas.";
|
|
133
|
+
readonly const: "object";
|
|
134
|
+
readonly type: "string";
|
|
135
|
+
};
|
|
136
|
+
};
|
|
137
|
+
};
|
|
138
|
+
readonly outputSchema: {
|
|
139
|
+
readonly description: "Optional object-form JSON Schema for the returned value. If omitted, no output schema validator is prepared. Core checks its shape only; the injected schema compiler validates and compiles its constraints.";
|
|
140
|
+
readonly additionalProperties: true;
|
|
141
|
+
readonly type: "object";
|
|
142
|
+
readonly properties: {};
|
|
143
|
+
};
|
|
144
|
+
readonly implementation: {
|
|
145
|
+
readonly description: "Executable JavaScript implementation and its execution requirements.";
|
|
146
|
+
readonly additionalProperties: false;
|
|
147
|
+
readonly type: "object";
|
|
148
|
+
readonly required: readonly ["runtime", "abi", "format", "code"];
|
|
149
|
+
readonly properties: {
|
|
150
|
+
readonly runtime: {
|
|
151
|
+
readonly description: "Runtime used to execute the implementation.";
|
|
152
|
+
readonly const: "javascript";
|
|
153
|
+
readonly type: "string";
|
|
154
|
+
};
|
|
155
|
+
readonly abi: {
|
|
156
|
+
readonly description: "Calling convention: async function(input, state, ctx). The stored implementation.code runs as its body. The arguments are function input, instance state, and the execution context, in that order.";
|
|
157
|
+
readonly examples: readonly ["async function(input, state, ctx) {\n // implementation.code\n}"];
|
|
158
|
+
readonly const: "state-machine-function-v1";
|
|
159
|
+
readonly type: "string";
|
|
160
|
+
};
|
|
161
|
+
readonly format: {
|
|
162
|
+
readonly description: "Source format: the body of an async function, not a complete function declaration.";
|
|
163
|
+
readonly const: "async-function-body";
|
|
164
|
+
readonly type: "string";
|
|
165
|
+
};
|
|
166
|
+
readonly code: {
|
|
167
|
+
readonly description: "JavaScript async-function body. Do not wrap it in async function(...) { ... }. The body can await context operations, access input and state, and return the function result.";
|
|
168
|
+
readonly examples: readonly ["const x = await ctx.foo(input);\nstate.foo = x;\nreturn x;"];
|
|
169
|
+
readonly minLength: 1;
|
|
170
|
+
readonly type: "string";
|
|
171
|
+
};
|
|
172
|
+
readonly capabilities: {
|
|
173
|
+
readonly description: "Capability names requested by the implementation. Creation defaults an omitted list to [].";
|
|
174
|
+
readonly type: "array";
|
|
175
|
+
readonly items: {
|
|
176
|
+
readonly description: "Name of a capability requested by the implementation.";
|
|
177
|
+
readonly type: "string";
|
|
178
|
+
};
|
|
179
|
+
readonly default: readonly [];
|
|
180
|
+
};
|
|
181
|
+
readonly timeoutMs: {
|
|
182
|
+
readonly description: "Optional execution timeout in milliseconds, expressed as a positive safe integer.";
|
|
183
|
+
readonly minimum: 1;
|
|
184
|
+
readonly maximum: 9007199254740991;
|
|
185
|
+
readonly type: "integer";
|
|
186
|
+
};
|
|
187
|
+
};
|
|
188
|
+
};
|
|
189
|
+
readonly annotations: {
|
|
190
|
+
readonly description: "Optional descriptive hints about the function, not additional schema validation rules.";
|
|
191
|
+
readonly additionalProperties: false;
|
|
192
|
+
readonly type: "object";
|
|
193
|
+
readonly properties: {
|
|
194
|
+
readonly exposeAsTool: {
|
|
195
|
+
readonly description: "Whether tool adapters may advertise this function. Omission means true. Controls discovery only, not execution authorization.";
|
|
196
|
+
readonly type: "boolean";
|
|
197
|
+
};
|
|
198
|
+
readonly pure: {
|
|
199
|
+
readonly description: "Author declaration of context-free execution using only input/state and local computation, without external effects. When true, allows an explicitly configured backend to select isolated execution; false or omission retains trusted execution. Not a purity proof, security sandbox, idempotency declaration, or permission to retry.";
|
|
200
|
+
readonly type: "boolean";
|
|
201
|
+
};
|
|
202
|
+
readonly idempotent: {
|
|
203
|
+
readonly description: "Whether the function is declared to be idempotent.";
|
|
204
|
+
readonly type: "boolean";
|
|
205
|
+
};
|
|
206
|
+
readonly destructive: {
|
|
207
|
+
readonly description: "Whether the function is declared to perform destructive operations.";
|
|
208
|
+
readonly type: "boolean";
|
|
209
|
+
};
|
|
210
|
+
readonly deprecated: {
|
|
211
|
+
readonly description: "Whether use of this function is deprecated.";
|
|
212
|
+
readonly type: "boolean";
|
|
213
|
+
};
|
|
214
|
+
};
|
|
215
|
+
};
|
|
216
|
+
readonly metadata: {
|
|
217
|
+
readonly description: "Optional application-defined metadata about the function. Arbitrary keys are preserved.";
|
|
218
|
+
readonly additionalProperties: true;
|
|
219
|
+
readonly type: "object";
|
|
220
|
+
readonly properties: {};
|
|
221
|
+
};
|
|
222
|
+
};
|
|
223
|
+
};
|
|
224
|
+
};
|
|
225
|
+
readonly metadata: {
|
|
226
|
+
readonly description: "Optional application-defined metadata about the template. Arbitrary keys are preserved.";
|
|
227
|
+
readonly additionalProperties: true;
|
|
228
|
+
readonly type: "object";
|
|
229
|
+
readonly properties: {};
|
|
230
|
+
};
|
|
231
|
+
};
|
|
232
|
+
};
|
|
233
|
+
declare const ExecuteStateMachineFunctionRequestSchema: {
|
|
234
|
+
readonly description: "Execution request envelope; instance lookup and function-specific input validation occur later.";
|
|
235
|
+
readonly additionalProperties: false;
|
|
236
|
+
readonly type: "object";
|
|
237
|
+
readonly required: readonly ["instance", "functionName", "input"];
|
|
238
|
+
readonly properties: {
|
|
239
|
+
readonly instance: {
|
|
240
|
+
readonly description: "Reference identifying the instance on which to execute the function.";
|
|
241
|
+
readonly additionalProperties: false;
|
|
242
|
+
readonly type: "object";
|
|
243
|
+
readonly required: readonly ["id"];
|
|
244
|
+
readonly properties: {
|
|
245
|
+
readonly id: {
|
|
246
|
+
readonly description: "Unique identifier of the instance.";
|
|
247
|
+
readonly minLength: 1;
|
|
248
|
+
readonly type: "string";
|
|
249
|
+
};
|
|
250
|
+
};
|
|
251
|
+
};
|
|
252
|
+
readonly functionName: {
|
|
253
|
+
readonly description: "Name of the function to invoke on the resolved instance template.";
|
|
254
|
+
readonly minLength: 1;
|
|
255
|
+
readonly maxLength: 64;
|
|
256
|
+
readonly pattern: "^[a-zA-Z0-9_-]{1,64}$";
|
|
257
|
+
readonly type: "string";
|
|
258
|
+
};
|
|
259
|
+
readonly input: {
|
|
260
|
+
readonly description: "Opaque function input, preserved without transformation. The prepared template validates it against the selected function input schema before implementation execution.";
|
|
261
|
+
};
|
|
262
|
+
};
|
|
263
|
+
};
|
|
264
|
+
declare const FunctionImplementationSchema: {
|
|
265
|
+
readonly description: "Executable JavaScript implementation and its execution requirements.";
|
|
266
|
+
readonly additionalProperties: false;
|
|
267
|
+
readonly type: "object";
|
|
268
|
+
readonly required: readonly ["runtime", "abi", "format", "code", "capabilities"];
|
|
269
|
+
readonly properties: {
|
|
270
|
+
readonly runtime: {
|
|
271
|
+
readonly description: "Runtime used to execute the implementation.";
|
|
272
|
+
readonly const: "javascript";
|
|
273
|
+
readonly type: "string";
|
|
274
|
+
};
|
|
275
|
+
readonly abi: {
|
|
276
|
+
readonly description: "Calling convention: async function(input, state, ctx). The stored implementation.code runs as its body. The arguments are function input, instance state, and the execution context, in that order.";
|
|
277
|
+
readonly examples: readonly ["async function(input, state, ctx) {\n // implementation.code\n}"];
|
|
278
|
+
readonly const: "state-machine-function-v1";
|
|
279
|
+
readonly type: "string";
|
|
280
|
+
};
|
|
281
|
+
readonly format: {
|
|
282
|
+
readonly description: "Source format: the body of an async function, not a complete function declaration.";
|
|
283
|
+
readonly const: "async-function-body";
|
|
284
|
+
readonly type: "string";
|
|
285
|
+
};
|
|
286
|
+
readonly code: {
|
|
287
|
+
readonly description: "JavaScript async-function body. Do not wrap it in async function(...) { ... }. The body can await context operations, access input and state, and return the function result.";
|
|
288
|
+
readonly examples: readonly ["const x = await ctx.foo(input);\nstate.foo = x;\nreturn x;"];
|
|
289
|
+
readonly minLength: 1;
|
|
290
|
+
readonly type: "string";
|
|
291
|
+
};
|
|
292
|
+
readonly capabilities: {
|
|
293
|
+
readonly description: "Capability names requested by the implementation. Required in canonical definitions.";
|
|
294
|
+
readonly type: "array";
|
|
295
|
+
readonly items: {
|
|
296
|
+
readonly description: "Name of a capability requested by the implementation.";
|
|
297
|
+
readonly type: "string";
|
|
298
|
+
};
|
|
299
|
+
};
|
|
300
|
+
readonly timeoutMs: {
|
|
301
|
+
readonly description: "Optional execution timeout in milliseconds, expressed as a positive safe integer.";
|
|
302
|
+
readonly minimum: 1;
|
|
303
|
+
readonly maximum: 9007199254740991;
|
|
304
|
+
readonly type: "integer";
|
|
305
|
+
};
|
|
306
|
+
};
|
|
307
|
+
};
|
|
308
|
+
declare const FunctionKindSchema: {
|
|
309
|
+
readonly description: "Function classification: queries read state; mutations may update state.";
|
|
310
|
+
readonly enum: readonly ["query", "mutation"];
|
|
311
|
+
};
|
|
312
|
+
declare const JsonSchemaSchema: {
|
|
313
|
+
readonly description: "Opaque object-form JSON Schema. Core preserves all keywords and checks only that the value is an object. The injected schema compiler is responsible for validating the dialect, keywords, and references. Boolean schemas are excluded.";
|
|
314
|
+
readonly additionalProperties: true;
|
|
315
|
+
readonly type: "object";
|
|
316
|
+
readonly properties: {};
|
|
317
|
+
};
|
|
318
|
+
declare const ObjectJsonSchemaSchema: {
|
|
319
|
+
readonly description: "Opaque object-form JSON Schema with an explicit type of object. Other keywords are preserved, not interpreted by core. The injected schema compiler is responsible for validating the dialect, keywords, and references.";
|
|
320
|
+
readonly additionalProperties: true;
|
|
321
|
+
readonly type: "object";
|
|
322
|
+
readonly required: readonly ["type"];
|
|
323
|
+
readonly properties: {
|
|
324
|
+
readonly type: {
|
|
325
|
+
readonly description: "Explicit root instance type required for state and function-input schemas.";
|
|
326
|
+
readonly const: "object";
|
|
327
|
+
readonly type: "string";
|
|
328
|
+
};
|
|
329
|
+
};
|
|
330
|
+
};
|
|
331
|
+
declare const StateMachineFunctionDefinitionSchema: {
|
|
332
|
+
readonly description: "Named state-machine function, including its input/output contracts and executable implementation.";
|
|
333
|
+
readonly additionalProperties: false;
|
|
334
|
+
readonly type: "object";
|
|
335
|
+
readonly required: readonly ["name", "kind", "inputSchema", "implementation"];
|
|
336
|
+
readonly properties: {
|
|
337
|
+
readonly name: {
|
|
338
|
+
readonly description: "Function name, unique within the template. Must contain 1–64 ASCII letters, digits, underscores, or hyphens.";
|
|
339
|
+
readonly minLength: 1;
|
|
340
|
+
readonly maxLength: 64;
|
|
341
|
+
readonly pattern: "^[a-zA-Z0-9_-]{1,64}$";
|
|
342
|
+
readonly type: "string";
|
|
343
|
+
};
|
|
344
|
+
readonly description: {
|
|
345
|
+
readonly description: "Optional human-readable explanation of the function.";
|
|
346
|
+
readonly type: "string";
|
|
347
|
+
};
|
|
348
|
+
readonly kind: {
|
|
349
|
+
readonly description: "Function classification: queries read state; mutations may update state.";
|
|
350
|
+
readonly enum: readonly ["query", "mutation"];
|
|
351
|
+
};
|
|
352
|
+
readonly inputSchema: {
|
|
353
|
+
readonly description: "Object-form JSON Schema for input, the first implementation argument. Core checks its shape only; the injected schema compiler validates and compiles its constraints.";
|
|
354
|
+
readonly additionalProperties: true;
|
|
355
|
+
readonly type: "object";
|
|
356
|
+
readonly required: readonly ["type"];
|
|
357
|
+
readonly properties: {
|
|
358
|
+
readonly type: {
|
|
359
|
+
readonly description: "Explicit root instance type required for state and function-input schemas.";
|
|
360
|
+
readonly const: "object";
|
|
361
|
+
readonly type: "string";
|
|
362
|
+
};
|
|
363
|
+
};
|
|
364
|
+
};
|
|
365
|
+
readonly outputSchema: {
|
|
366
|
+
readonly description: "Optional object-form JSON Schema for the returned value. If omitted, no output schema validator is prepared. Core checks its shape only; the injected schema compiler validates and compiles its constraints.";
|
|
367
|
+
readonly additionalProperties: true;
|
|
368
|
+
readonly type: "object";
|
|
369
|
+
readonly properties: {};
|
|
370
|
+
};
|
|
371
|
+
readonly implementation: {
|
|
372
|
+
readonly description: "Executable JavaScript implementation and its execution requirements.";
|
|
373
|
+
readonly additionalProperties: false;
|
|
374
|
+
readonly type: "object";
|
|
375
|
+
readonly required: readonly ["runtime", "abi", "format", "code", "capabilities"];
|
|
376
|
+
readonly properties: {
|
|
377
|
+
readonly runtime: {
|
|
378
|
+
readonly description: "Runtime used to execute the implementation.";
|
|
379
|
+
readonly const: "javascript";
|
|
380
|
+
readonly type: "string";
|
|
381
|
+
};
|
|
382
|
+
readonly abi: {
|
|
383
|
+
readonly description: "Calling convention: async function(input, state, ctx). The stored implementation.code runs as its body. The arguments are function input, instance state, and the execution context, in that order.";
|
|
384
|
+
readonly examples: readonly ["async function(input, state, ctx) {\n // implementation.code\n}"];
|
|
385
|
+
readonly const: "state-machine-function-v1";
|
|
386
|
+
readonly type: "string";
|
|
387
|
+
};
|
|
388
|
+
readonly format: {
|
|
389
|
+
readonly description: "Source format: the body of an async function, not a complete function declaration.";
|
|
390
|
+
readonly const: "async-function-body";
|
|
391
|
+
readonly type: "string";
|
|
392
|
+
};
|
|
393
|
+
readonly code: {
|
|
394
|
+
readonly description: "JavaScript async-function body. Do not wrap it in async function(...) { ... }. The body can await context operations, access input and state, and return the function result.";
|
|
395
|
+
readonly examples: readonly ["const x = await ctx.foo(input);\nstate.foo = x;\nreturn x;"];
|
|
396
|
+
readonly minLength: 1;
|
|
397
|
+
readonly type: "string";
|
|
398
|
+
};
|
|
399
|
+
readonly capabilities: {
|
|
400
|
+
readonly description: "Capability names requested by the implementation. Required in canonical definitions.";
|
|
401
|
+
readonly type: "array";
|
|
402
|
+
readonly items: {
|
|
403
|
+
readonly description: "Name of a capability requested by the implementation.";
|
|
404
|
+
readonly type: "string";
|
|
405
|
+
};
|
|
406
|
+
};
|
|
407
|
+
readonly timeoutMs: {
|
|
408
|
+
readonly description: "Optional execution timeout in milliseconds, expressed as a positive safe integer.";
|
|
409
|
+
readonly minimum: 1;
|
|
410
|
+
readonly maximum: 9007199254740991;
|
|
411
|
+
readonly type: "integer";
|
|
412
|
+
};
|
|
413
|
+
};
|
|
414
|
+
};
|
|
415
|
+
readonly annotations: {
|
|
416
|
+
readonly description: "Optional descriptive hints about the function, not additional schema validation rules.";
|
|
417
|
+
readonly additionalProperties: false;
|
|
418
|
+
readonly type: "object";
|
|
419
|
+
readonly properties: {
|
|
420
|
+
readonly exposeAsTool: {
|
|
421
|
+
readonly description: "Whether tool adapters may advertise this function. Omission means true. Controls discovery only, not execution authorization.";
|
|
422
|
+
readonly type: "boolean";
|
|
423
|
+
};
|
|
424
|
+
readonly pure: {
|
|
425
|
+
readonly description: "Author declaration of context-free execution using only input/state and local computation, without external effects. When true, allows an explicitly configured backend to select isolated execution; false or omission retains trusted execution. Not a purity proof, security sandbox, idempotency declaration, or permission to retry.";
|
|
426
|
+
readonly type: "boolean";
|
|
427
|
+
};
|
|
428
|
+
readonly idempotent: {
|
|
429
|
+
readonly description: "Whether the function is declared to be idempotent.";
|
|
430
|
+
readonly type: "boolean";
|
|
431
|
+
};
|
|
432
|
+
readonly destructive: {
|
|
433
|
+
readonly description: "Whether the function is declared to perform destructive operations.";
|
|
434
|
+
readonly type: "boolean";
|
|
435
|
+
};
|
|
436
|
+
readonly deprecated: {
|
|
437
|
+
readonly description: "Whether use of this function is deprecated.";
|
|
438
|
+
readonly type: "boolean";
|
|
439
|
+
};
|
|
440
|
+
};
|
|
441
|
+
};
|
|
442
|
+
readonly metadata: {
|
|
443
|
+
readonly description: "Optional application-defined metadata about the function. Arbitrary keys are preserved.";
|
|
444
|
+
readonly additionalProperties: true;
|
|
445
|
+
readonly type: "object";
|
|
446
|
+
readonly properties: {};
|
|
447
|
+
};
|
|
448
|
+
};
|
|
449
|
+
};
|
|
450
|
+
declare const StateMachineInstanceSchema: {
|
|
451
|
+
readonly description: "Persisted state-machine instance, pinned to a template revision and tracking its current state.";
|
|
452
|
+
readonly additionalProperties: false;
|
|
453
|
+
readonly type: "object";
|
|
454
|
+
readonly required: readonly ["schemaVersion", "id", "template", "retention", "state", "sequence", "createdAt", "updatedAt"];
|
|
455
|
+
readonly properties: {
|
|
456
|
+
readonly schemaVersion: {
|
|
457
|
+
readonly description: "Version of the persisted instance format, not the logical instance sequence.";
|
|
458
|
+
readonly const: 2;
|
|
459
|
+
readonly type: "number";
|
|
460
|
+
};
|
|
461
|
+
readonly id: {
|
|
462
|
+
readonly description: "Unique identifier of the instance.";
|
|
463
|
+
readonly minLength: 1;
|
|
464
|
+
readonly type: "string";
|
|
465
|
+
};
|
|
466
|
+
readonly template: {
|
|
467
|
+
readonly description: "Template identity and storage revision bound to a state-machine instance.";
|
|
468
|
+
readonly additionalProperties: false;
|
|
469
|
+
readonly type: "object";
|
|
470
|
+
readonly required: readonly ["id", "revision"];
|
|
471
|
+
readonly properties: {
|
|
472
|
+
readonly id: {
|
|
473
|
+
readonly description: "Unique identifier of the template.";
|
|
474
|
+
readonly minLength: 1;
|
|
475
|
+
readonly type: "string";
|
|
476
|
+
};
|
|
477
|
+
readonly version: {
|
|
478
|
+
readonly description: "Logical application version of the template. Optional because the template may have no version.";
|
|
479
|
+
readonly type: "string";
|
|
480
|
+
};
|
|
481
|
+
readonly revision: {
|
|
482
|
+
readonly description: "Storage-driver revision of the template used to create this instance. Pins execution to that revision so changing a stored template cannot silently change instance behavior.";
|
|
483
|
+
readonly minLength: 1;
|
|
484
|
+
readonly type: "string";
|
|
485
|
+
};
|
|
486
|
+
};
|
|
487
|
+
};
|
|
488
|
+
readonly retention: {
|
|
489
|
+
readonly description: "Instance-owned retention policy, independent of execution callers and application state.";
|
|
490
|
+
readonly additionalProperties: false;
|
|
491
|
+
readonly type: "object";
|
|
492
|
+
readonly required: readonly ["ttlMs"];
|
|
493
|
+
readonly properties: {
|
|
494
|
+
readonly ttlMs: {
|
|
495
|
+
readonly description: "Sliding expiration duration in milliseconds, renewed on successful persisted updates. Zero means no expiration.";
|
|
496
|
+
readonly minimum: 0;
|
|
497
|
+
readonly maximum: 9007199254740991;
|
|
498
|
+
readonly type: "integer";
|
|
499
|
+
};
|
|
500
|
+
};
|
|
501
|
+
};
|
|
502
|
+
readonly state: {
|
|
503
|
+
readonly description: "Current instance state, validated against the bound template's stateSchema during execution and storage operations.";
|
|
504
|
+
readonly additionalProperties: true;
|
|
505
|
+
readonly type: "object";
|
|
506
|
+
readonly properties: {};
|
|
507
|
+
};
|
|
508
|
+
readonly sequence: {
|
|
509
|
+
readonly description: "Logical instance version. Increased for every successful persisted update; independent of the storage-driver revision.";
|
|
510
|
+
readonly minimum: 0;
|
|
511
|
+
readonly maximum: 9007199254740991;
|
|
512
|
+
readonly type: "integer";
|
|
513
|
+
};
|
|
514
|
+
readonly createdAt: {
|
|
515
|
+
readonly format: "date-time";
|
|
516
|
+
readonly pattern: "^\\d{4}-\\d{2}-\\d{2}T(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?Z$";
|
|
517
|
+
readonly type: "string";
|
|
518
|
+
readonly description: "Date and time the instance was created, as an ISO 8601 UTC datetime ending in Z.";
|
|
519
|
+
};
|
|
520
|
+
readonly updatedAt: {
|
|
521
|
+
readonly format: "date-time";
|
|
522
|
+
readonly pattern: "^\\d{4}-\\d{2}-\\d{2}T(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?Z$";
|
|
523
|
+
readonly type: "string";
|
|
524
|
+
readonly description: "Date and time the instance was last updated, as an ISO 8601 UTC datetime ending in Z.";
|
|
525
|
+
};
|
|
526
|
+
readonly metadata: {
|
|
527
|
+
readonly description: "Optional application-defined metadata about the instance. Arbitrary keys are preserved.";
|
|
528
|
+
readonly additionalProperties: true;
|
|
529
|
+
readonly type: "object";
|
|
530
|
+
readonly properties: {};
|
|
531
|
+
};
|
|
532
|
+
};
|
|
533
|
+
};
|
|
534
|
+
declare const StateMachineTemplateBindingSchema: {
|
|
535
|
+
readonly description: "Template identity and storage revision bound to a state-machine instance.";
|
|
536
|
+
readonly additionalProperties: false;
|
|
537
|
+
readonly type: "object";
|
|
538
|
+
readonly required: readonly ["id", "revision"];
|
|
539
|
+
readonly properties: {
|
|
540
|
+
readonly id: {
|
|
541
|
+
readonly description: "Unique identifier of the template.";
|
|
542
|
+
readonly minLength: 1;
|
|
543
|
+
readonly type: "string";
|
|
544
|
+
};
|
|
545
|
+
readonly version: {
|
|
546
|
+
readonly description: "Logical application version of the template. Optional because the template may have no version.";
|
|
547
|
+
readonly type: "string";
|
|
548
|
+
};
|
|
549
|
+
readonly revision: {
|
|
550
|
+
readonly description: "Storage-driver revision of the template used to create this instance. Pins execution to that revision so changing a stored template cannot silently change instance behavior.";
|
|
551
|
+
readonly minLength: 1;
|
|
552
|
+
readonly type: "string";
|
|
553
|
+
};
|
|
554
|
+
};
|
|
555
|
+
};
|
|
556
|
+
declare const StateMachineTemplateSchema: {
|
|
557
|
+
readonly description: "Persisted state-machine template defining shared state, initial state, and available functions.";
|
|
558
|
+
readonly additionalProperties: false;
|
|
559
|
+
readonly type: "object";
|
|
560
|
+
readonly required: readonly ["schemaVersion", "id", "stateSchema", "initialState", "functions"];
|
|
561
|
+
readonly properties: {
|
|
562
|
+
readonly schemaVersion: {
|
|
563
|
+
readonly description: "Version of the persisted template format, not the logical application version.";
|
|
564
|
+
readonly const: 1;
|
|
565
|
+
readonly type: "number";
|
|
566
|
+
};
|
|
567
|
+
readonly id: {
|
|
568
|
+
readonly description: "Unique identifier of the template.";
|
|
569
|
+
readonly minLength: 1;
|
|
570
|
+
readonly type: "string";
|
|
571
|
+
};
|
|
572
|
+
readonly version: {
|
|
573
|
+
readonly description: "Optional logical application version. This is different from a storage-driver revision.";
|
|
574
|
+
readonly type: "string";
|
|
575
|
+
};
|
|
576
|
+
readonly description: {
|
|
577
|
+
readonly description: "Optional human-readable explanation of the state machine.";
|
|
578
|
+
readonly type: "string";
|
|
579
|
+
};
|
|
580
|
+
readonly stateSchema: {
|
|
581
|
+
readonly description: "Object-form JSON Schema shared by every function to validate instance state. Core checks its shape only; the injected schema compiler validates and compiles its constraints.";
|
|
582
|
+
readonly additionalProperties: true;
|
|
583
|
+
readonly type: "object";
|
|
584
|
+
readonly required: readonly ["type"];
|
|
585
|
+
readonly properties: {
|
|
586
|
+
readonly type: {
|
|
587
|
+
readonly description: "Explicit root instance type required for state and function-input schemas.";
|
|
588
|
+
readonly const: "object";
|
|
589
|
+
readonly type: "string";
|
|
590
|
+
};
|
|
591
|
+
};
|
|
592
|
+
};
|
|
593
|
+
readonly initialState: {
|
|
594
|
+
readonly description: "Default state used when creating an instance without an explicit state override. Must satisfy stateSchema when the template is prepared.";
|
|
595
|
+
readonly additionalProperties: true;
|
|
596
|
+
readonly type: "object";
|
|
597
|
+
readonly properties: {};
|
|
598
|
+
};
|
|
599
|
+
readonly functions: {
|
|
600
|
+
readonly description: "Functions available on instances of this template. Names must be unique; the template parser enforces this semantic rule.";
|
|
601
|
+
readonly type: "array";
|
|
602
|
+
readonly items: {
|
|
603
|
+
readonly description: "Named state-machine function, including its input/output contracts and executable implementation.";
|
|
604
|
+
readonly additionalProperties: false;
|
|
605
|
+
readonly type: "object";
|
|
606
|
+
readonly required: readonly ["name", "kind", "inputSchema", "implementation"];
|
|
607
|
+
readonly properties: {
|
|
608
|
+
readonly name: {
|
|
609
|
+
readonly description: "Function name, unique within the template. Must contain 1–64 ASCII letters, digits, underscores, or hyphens.";
|
|
610
|
+
readonly minLength: 1;
|
|
611
|
+
readonly maxLength: 64;
|
|
612
|
+
readonly pattern: "^[a-zA-Z0-9_-]{1,64}$";
|
|
613
|
+
readonly type: "string";
|
|
614
|
+
};
|
|
615
|
+
readonly description: {
|
|
616
|
+
readonly description: "Optional human-readable explanation of the function.";
|
|
617
|
+
readonly type: "string";
|
|
618
|
+
};
|
|
619
|
+
readonly kind: {
|
|
620
|
+
readonly description: "Function classification: queries read state; mutations may update state.";
|
|
621
|
+
readonly enum: readonly ["query", "mutation"];
|
|
622
|
+
};
|
|
623
|
+
readonly inputSchema: {
|
|
624
|
+
readonly description: "Object-form JSON Schema for input, the first implementation argument. Core checks its shape only; the injected schema compiler validates and compiles its constraints.";
|
|
625
|
+
readonly additionalProperties: true;
|
|
626
|
+
readonly type: "object";
|
|
627
|
+
readonly required: readonly ["type"];
|
|
628
|
+
readonly properties: {
|
|
629
|
+
readonly type: {
|
|
630
|
+
readonly description: "Explicit root instance type required for state and function-input schemas.";
|
|
631
|
+
readonly const: "object";
|
|
632
|
+
readonly type: "string";
|
|
633
|
+
};
|
|
634
|
+
};
|
|
635
|
+
};
|
|
636
|
+
readonly outputSchema: {
|
|
637
|
+
readonly description: "Optional object-form JSON Schema for the returned value. If omitted, no output schema validator is prepared. Core checks its shape only; the injected schema compiler validates and compiles its constraints.";
|
|
638
|
+
readonly additionalProperties: true;
|
|
639
|
+
readonly type: "object";
|
|
640
|
+
readonly properties: {};
|
|
641
|
+
};
|
|
642
|
+
readonly implementation: {
|
|
643
|
+
readonly description: "Executable JavaScript implementation and its execution requirements.";
|
|
644
|
+
readonly additionalProperties: false;
|
|
645
|
+
readonly type: "object";
|
|
646
|
+
readonly required: readonly ["runtime", "abi", "format", "code", "capabilities"];
|
|
647
|
+
readonly properties: {
|
|
648
|
+
readonly runtime: {
|
|
649
|
+
readonly description: "Runtime used to execute the implementation.";
|
|
650
|
+
readonly const: "javascript";
|
|
651
|
+
readonly type: "string";
|
|
652
|
+
};
|
|
653
|
+
readonly abi: {
|
|
654
|
+
readonly description: "Calling convention: async function(input, state, ctx). The stored implementation.code runs as its body. The arguments are function input, instance state, and the execution context, in that order.";
|
|
655
|
+
readonly examples: readonly ["async function(input, state, ctx) {\n // implementation.code\n}"];
|
|
656
|
+
readonly const: "state-machine-function-v1";
|
|
657
|
+
readonly type: "string";
|
|
658
|
+
};
|
|
659
|
+
readonly format: {
|
|
660
|
+
readonly description: "Source format: the body of an async function, not a complete function declaration.";
|
|
661
|
+
readonly const: "async-function-body";
|
|
662
|
+
readonly type: "string";
|
|
663
|
+
};
|
|
664
|
+
readonly code: {
|
|
665
|
+
readonly description: "JavaScript async-function body. Do not wrap it in async function(...) { ... }. The body can await context operations, access input and state, and return the function result.";
|
|
666
|
+
readonly examples: readonly ["const x = await ctx.foo(input);\nstate.foo = x;\nreturn x;"];
|
|
667
|
+
readonly minLength: 1;
|
|
668
|
+
readonly type: "string";
|
|
669
|
+
};
|
|
670
|
+
readonly capabilities: {
|
|
671
|
+
readonly description: "Capability names requested by the implementation. Required in canonical definitions.";
|
|
672
|
+
readonly type: "array";
|
|
673
|
+
readonly items: {
|
|
674
|
+
readonly description: "Name of a capability requested by the implementation.";
|
|
675
|
+
readonly type: "string";
|
|
676
|
+
};
|
|
677
|
+
};
|
|
678
|
+
readonly timeoutMs: {
|
|
679
|
+
readonly description: "Optional execution timeout in milliseconds, expressed as a positive safe integer.";
|
|
680
|
+
readonly minimum: 1;
|
|
681
|
+
readonly maximum: 9007199254740991;
|
|
682
|
+
readonly type: "integer";
|
|
683
|
+
};
|
|
684
|
+
};
|
|
685
|
+
};
|
|
686
|
+
readonly annotations: {
|
|
687
|
+
readonly description: "Optional descriptive hints about the function, not additional schema validation rules.";
|
|
688
|
+
readonly additionalProperties: false;
|
|
689
|
+
readonly type: "object";
|
|
690
|
+
readonly properties: {
|
|
691
|
+
readonly exposeAsTool: {
|
|
692
|
+
readonly description: "Whether tool adapters may advertise this function. Omission means true. Controls discovery only, not execution authorization.";
|
|
693
|
+
readonly type: "boolean";
|
|
694
|
+
};
|
|
695
|
+
readonly pure: {
|
|
696
|
+
readonly description: "Author declaration of context-free execution using only input/state and local computation, without external effects. When true, allows an explicitly configured backend to select isolated execution; false or omission retains trusted execution. Not a purity proof, security sandbox, idempotency declaration, or permission to retry.";
|
|
697
|
+
readonly type: "boolean";
|
|
698
|
+
};
|
|
699
|
+
readonly idempotent: {
|
|
700
|
+
readonly description: "Whether the function is declared to be idempotent.";
|
|
701
|
+
readonly type: "boolean";
|
|
702
|
+
};
|
|
703
|
+
readonly destructive: {
|
|
704
|
+
readonly description: "Whether the function is declared to perform destructive operations.";
|
|
705
|
+
readonly type: "boolean";
|
|
706
|
+
};
|
|
707
|
+
readonly deprecated: {
|
|
708
|
+
readonly description: "Whether use of this function is deprecated.";
|
|
709
|
+
readonly type: "boolean";
|
|
710
|
+
};
|
|
711
|
+
};
|
|
712
|
+
};
|
|
713
|
+
readonly metadata: {
|
|
714
|
+
readonly description: "Optional application-defined metadata about the function. Arbitrary keys are preserved.";
|
|
715
|
+
readonly additionalProperties: true;
|
|
716
|
+
readonly type: "object";
|
|
717
|
+
readonly properties: {};
|
|
718
|
+
};
|
|
719
|
+
};
|
|
720
|
+
};
|
|
721
|
+
};
|
|
722
|
+
readonly metadata: {
|
|
723
|
+
readonly description: "Optional application-defined metadata about the template. Arbitrary keys are preserved.";
|
|
724
|
+
readonly additionalProperties: true;
|
|
725
|
+
readonly type: "object";
|
|
726
|
+
readonly properties: {};
|
|
727
|
+
};
|
|
728
|
+
};
|
|
729
|
+
};
|
|
730
|
+
//#endregion
|
|
731
|
+
export { CreateStateMachineInstanceRequestSchema, CreateStateMachineTemplateSchema, ExecuteStateMachineFunctionRequestSchema, FunctionImplementationSchema, FunctionKindSchema, JsonSchemaSchema, ObjectJsonSchemaSchema, StateMachineFunctionDefinitionSchema, StateMachineInstanceSchema, StateMachineTemplateBindingSchema, StateMachineTemplateSchema };
|
|
732
|
+
//# sourceMappingURL=index.d.mts.map
|