@sequenceholdings/managed-functions 0.4.0 → 0.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (92) hide show
  1. package/README.md +444 -2
  2. package/dist/abrigo-contract.d.ts +92 -0
  3. package/dist/abrigo-contract.js +55 -0
  4. package/dist/abrigo-response.d.ts +6 -0
  5. package/dist/abrigo-response.js +27 -0
  6. package/dist/abrigo.d.ts +14 -0
  7. package/dist/abrigo.js +150 -0
  8. package/dist/agent-evidence.d.ts +9 -0
  9. package/dist/agent-evidence.js +84 -0
  10. package/dist/agent-source-evidence-contract.d.ts +1197 -0
  11. package/dist/agent-source-evidence-contract.js +96 -0
  12. package/dist/agents-contract.d.ts +99 -0
  13. package/dist/agents-contract.js +69 -0
  14. package/dist/agents.d.ts +15 -0
  15. package/dist/agents.js +121 -0
  16. package/dist/capabilities.d.ts +165 -0
  17. package/dist/capabilities.js +61 -1
  18. package/dist/config.d.ts +18 -2
  19. package/dist/config.js +62 -1
  20. package/dist/deployed-policy.js +102 -0
  21. package/dist/directory-config.d.ts +23 -0
  22. package/dist/directory-config.js +22 -0
  23. package/dist/directory-contract.d.ts +68 -0
  24. package/dist/directory-contract.js +57 -0
  25. package/dist/directory-manifest.d.ts +5 -0
  26. package/dist/directory-manifest.js +10 -0
  27. package/dist/directory.d.ts +15 -0
  28. package/dist/directory.js +65 -0
  29. package/dist/http-tracing.js +3 -0
  30. package/dist/immutable-release-contract.d.ts +3 -0
  31. package/dist/immutable-release-contract.js +12 -0
  32. package/dist/index.d.ts +40 -1
  33. package/dist/index.js +75 -1
  34. package/dist/invocation-client.d.ts +45 -0
  35. package/dist/invocation-client.js +90 -0
  36. package/dist/invocation-contract.d.ts +36 -0
  37. package/dist/invocation-contract.js +48 -0
  38. package/dist/invocation.d.ts +8 -0
  39. package/dist/invocation.js +134 -0
  40. package/dist/lattice-capability.d.ts +5 -0
  41. package/dist/lattice-capability.js +16 -0
  42. package/dist/lattice-provenance-contract.d.ts +519 -0
  43. package/dist/lattice-provenance-contract.js +148 -0
  44. package/dist/lattice-provenance.d.ts +16 -0
  45. package/dist/lattice-provenance.js +167 -0
  46. package/dist/monitoring-annotations.d.ts +53 -0
  47. package/dist/monitoring-annotations.js +54 -0
  48. package/dist/monitoring-contract.d.ts +463 -0
  49. package/dist/monitoring-contract.js +89 -0
  50. package/dist/monitoring-events.d.ts +257 -0
  51. package/dist/monitoring-events.js +136 -0
  52. package/dist/monitoring.d.ts +14 -0
  53. package/dist/monitoring.js +78 -0
  54. package/dist/orm-contract.d.ts +1 -0
  55. package/dist/orm-contract.js +4 -0
  56. package/dist/orm.d.ts +19 -3
  57. package/dist/orm.js +93 -13
  58. package/dist/preflight-abrigo.d.ts +10 -0
  59. package/dist/preflight-abrigo.js +26 -0
  60. package/dist/preflight-agents.d.ts +10 -0
  61. package/dist/preflight-agents.js +51 -0
  62. package/dist/preflight-directory.d.ts +10 -0
  63. package/dist/preflight-directory.js +36 -0
  64. package/dist/preflight-immutable-release.d.ts +10 -0
  65. package/dist/preflight-immutable-release.js +34 -0
  66. package/dist/preflight-invocation.d.ts +10 -0
  67. package/dist/preflight-invocation.js +40 -0
  68. package/dist/preflight-lattice.d.ts +10 -0
  69. package/dist/preflight-lattice.js +40 -0
  70. package/dist/preflight-monitoring.d.ts +10 -0
  71. package/dist/preflight-monitoring.js +46 -0
  72. package/dist/preflight-service-directory.d.ts +10 -0
  73. package/dist/preflight-service-directory.js +26 -0
  74. package/dist/preflight-workflows.d.ts +10 -0
  75. package/dist/preflight-workflows.js +38 -0
  76. package/dist/preflight.js +50 -2
  77. package/dist/processes-contract.d.ts +20 -0
  78. package/dist/processes-contract.js +8 -1
  79. package/dist/processes.d.ts +4 -8
  80. package/dist/processes.js +52 -83
  81. package/dist/runtime.cjs +3387 -259
  82. package/dist/sdk-range.d.ts +1 -0
  83. package/dist/sdk-range.js +25 -0
  84. package/dist/service-directory.d.ts +12 -0
  85. package/dist/service-directory.js +72 -0
  86. package/dist/workflow-scopes-contract.d.ts +8 -0
  87. package/dist/workflow-scopes-contract.js +29 -0
  88. package/dist/workflow-source-contract.d.ts +524 -0
  89. package/dist/workflow-source-contract.js +59 -0
  90. package/dist/workflow-source.d.ts +12 -0
  91. package/dist/workflow-source.js +93 -0
  92. package/package.json +2 -2
@@ -0,0 +1,519 @@
1
+ import { z } from 'zod';
2
+ export declare const FUNCTION_LATTICE_EXECUTION_TOKEN_HEADER = "x-sequence-lattice-execution-token";
3
+ export declare const FUNCTION_LATTICE_CONTEXT_PATH = "/api/managed-functions/lattice/context";
4
+ export declare const functionLatticeStartProvenanceSchema: z.ZodObject<{
5
+ version: z.ZodLiteral<1>;
6
+ issuer: z.ZodString;
7
+ runId: z.ZodString;
8
+ processId: z.ZodString;
9
+ processVersion: z.ZodString;
10
+ bundleHash: z.ZodString;
11
+ actorSub: z.ZodString;
12
+ startedBy: z.ZodNullable<z.ZodString>;
13
+ mode: z.ZodEnum<{
14
+ system: "system";
15
+ manual: "manual";
16
+ trigger: "trigger";
17
+ schedule: "schedule";
18
+ subprocess: "subprocess";
19
+ intervention: "intervention";
20
+ }>;
21
+ basis: z.ZodEnum<{
22
+ fga_invoker: "fga_invoker";
23
+ trusted_trigger: "trusted_trigger";
24
+ schedule_author: "schedule_author";
25
+ schedule_no_author: "schedule_no_author";
26
+ trusted_service: "trusted_service";
27
+ subprocess_spawn_gate: "subprocess_spawn_gate";
28
+ subprocess_parent_starter: "subprocess_parent_starter";
29
+ subprocess_existing_child: "subprocess_existing_child";
30
+ intervention_actor: "intervention_actor";
31
+ }>;
32
+ authorizedAt: z.ZodISODateTime;
33
+ schedule: z.ZodNullable<z.ZodObject<{
34
+ scheduleId: z.ZodString;
35
+ scheduledAt: z.ZodISODateTime;
36
+ }, z.core.$strict>>;
37
+ }, z.core.$strict>;
38
+ export type FunctionLatticeStartProvenance = z.infer<typeof functionLatticeStartProvenanceSchema>;
39
+ export declare const functionLatticeHumanCompletionQuerySchema: z.ZodObject<{
40
+ nodeId: z.ZodString;
41
+ stepId: z.ZodOptional<z.ZodString>;
42
+ ancestorNodeId: z.ZodOptional<z.ZodString>;
43
+ }, z.core.$strict>;
44
+ export type FunctionLatticeHumanCompletionQuery = z.infer<typeof functionLatticeHumanCompletionQuerySchema>;
45
+ export declare const functionLatticeHumanCompletionsQuerySchema: z.ZodObject<{
46
+ nodeId: z.ZodString;
47
+ ancestorNodeId: z.ZodOptional<z.ZodString>;
48
+ }, z.core.$strict>;
49
+ export type FunctionLatticeHumanCompletionsQuery = z.infer<typeof functionLatticeHumanCompletionsQuerySchema>;
50
+ export declare const functionLatticeParallelSnapshotQuerySchema: z.ZodObject<{
51
+ nodeId: z.ZodString;
52
+ ancestorNodeId: z.ZodString;
53
+ }, z.core.$strict>;
54
+ export type FunctionLatticeParallelSnapshotQuery = z.infer<typeof functionLatticeParallelSnapshotQuerySchema>;
55
+ export declare const functionLatticeContextRequestSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
56
+ operation: z.ZodLiteral<"getExecutionContext">;
57
+ }, z.core.$strict>, z.ZodObject<{
58
+ nodeId: z.ZodString;
59
+ stepId: z.ZodOptional<z.ZodString>;
60
+ ancestorNodeId: z.ZodOptional<z.ZodString>;
61
+ operation: z.ZodLiteral<"getHumanCompletion">;
62
+ }, z.core.$strict>, z.ZodObject<{
63
+ nodeId: z.ZodString;
64
+ ancestorNodeId: z.ZodOptional<z.ZodString>;
65
+ operation: z.ZodLiteral<"getHumanCompletions">;
66
+ }, z.core.$strict>, z.ZodObject<{
67
+ nodeId: z.ZodString;
68
+ ancestorNodeId: z.ZodString;
69
+ operation: z.ZodLiteral<"getParallelSnapshot">;
70
+ }, z.core.$strict>], "operation">;
71
+ export type FunctionLatticeContextRequest = z.infer<typeof functionLatticeContextRequestSchema>;
72
+ export declare const functionLatticeExecutionContextSchema: z.ZodObject<{
73
+ receiverFunctionOrgId: z.ZodString;
74
+ parent: z.ZodOptional<z.ZodNullable<z.ZodObject<{
75
+ runId: z.ZodString;
76
+ processId: z.ZodString;
77
+ processVersion: z.ZodString;
78
+ bundleHash: z.ZodString;
79
+ stepId: z.ZodString;
80
+ nodeId: z.ZodString;
81
+ attempt: z.ZodNumber;
82
+ input: z.ZodUnknown;
83
+ branch: z.ZodNullable<z.ZodObject<{
84
+ id: z.ZodString;
85
+ index: z.ZodNumber;
86
+ item: z.ZodUnknown;
87
+ }, z.core.$strip>>;
88
+ }, z.core.$strip>>>;
89
+ run: z.ZodObject<{
90
+ id: z.ZodString;
91
+ processId: z.ZodString;
92
+ processVersion: z.ZodString;
93
+ bundleHash: z.ZodString;
94
+ entity: z.ZodNullable<z.ZodObject<{
95
+ type: z.ZodString;
96
+ id: z.ZodString;
97
+ }, z.core.$strip>>;
98
+ startProvenance: z.ZodOptional<z.ZodNullable<z.ZodObject<{
99
+ version: z.ZodLiteral<1>;
100
+ issuer: z.ZodString;
101
+ runId: z.ZodString;
102
+ processId: z.ZodString;
103
+ processVersion: z.ZodString;
104
+ bundleHash: z.ZodString;
105
+ actorSub: z.ZodString;
106
+ startedBy: z.ZodNullable<z.ZodString>;
107
+ mode: z.ZodEnum<{
108
+ system: "system";
109
+ manual: "manual";
110
+ trigger: "trigger";
111
+ schedule: "schedule";
112
+ subprocess: "subprocess";
113
+ intervention: "intervention";
114
+ }>;
115
+ basis: z.ZodEnum<{
116
+ fga_invoker: "fga_invoker";
117
+ trusted_trigger: "trusted_trigger";
118
+ schedule_author: "schedule_author";
119
+ schedule_no_author: "schedule_no_author";
120
+ trusted_service: "trusted_service";
121
+ subprocess_spawn_gate: "subprocess_spawn_gate";
122
+ subprocess_parent_starter: "subprocess_parent_starter";
123
+ subprocess_existing_child: "subprocess_existing_child";
124
+ intervention_actor: "intervention_actor";
125
+ }>;
126
+ authorizedAt: z.ZodISODateTime;
127
+ schedule: z.ZodNullable<z.ZodObject<{
128
+ scheduleId: z.ZodString;
129
+ scheduledAt: z.ZodISODateTime;
130
+ }, z.core.$strict>>;
131
+ }, z.core.$strict>>>;
132
+ }, z.core.$strip>;
133
+ step: z.ZodObject<{
134
+ id: z.ZodString;
135
+ nodeId: z.ZodString;
136
+ attempt: z.ZodNumber;
137
+ runAsServiceAccount: z.ZodNullable<z.ZodString>;
138
+ }, z.core.$strip>;
139
+ receiver: z.ZodObject<{
140
+ functionId: z.ZodString;
141
+ versionId: z.ZodString;
142
+ invocationId: z.ZodString;
143
+ invoker: z.ZodObject<{
144
+ sub: z.ZodString;
145
+ kind: z.ZodString;
146
+ authenticationMethod: z.ZodString;
147
+ }, z.core.$strip>;
148
+ attachedServiceAccountSub: z.ZodString;
149
+ }, z.core.$strip>;
150
+ input: z.ZodUnknown;
151
+ ctxSnapshot: z.ZodObject<{
152
+ entity: z.ZodUnknown;
153
+ upstream: z.ZodRecord<z.ZodString, z.ZodUnknown>;
154
+ state: z.ZodRecord<z.ZodString, z.ZodUnknown>;
155
+ run: z.ZodObject<{
156
+ id: z.ZodString;
157
+ process_id: z.ZodString;
158
+ version: z.ZodString;
159
+ started_at: z.ZodISODateTime;
160
+ started_by: z.ZodNullable<z.ZodString>;
161
+ metadata: z.ZodRecord<z.ZodString, z.ZodUnknown>;
162
+ trigger_reason: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
163
+ }, z.core.$strip>;
164
+ branch: z.ZodOptional<z.ZodObject<{
165
+ id: z.ZodString;
166
+ index: z.ZodNumber;
167
+ item: z.ZodUnknown;
168
+ }, z.core.$strip>>;
169
+ }, z.core.$strip>;
170
+ }, z.core.$strip>;
171
+ export type FunctionLatticeExecutionContext = z.infer<typeof functionLatticeExecutionContextSchema>;
172
+ export declare const functionLatticeHumanCompletionSchema: z.ZodObject<{
173
+ receiverFunctionOrgId: z.ZodString;
174
+ parent: z.ZodOptional<z.ZodNullable<z.ZodObject<{
175
+ runId: z.ZodString;
176
+ processId: z.ZodString;
177
+ processVersion: z.ZodString;
178
+ bundleHash: z.ZodString;
179
+ stepId: z.ZodString;
180
+ nodeId: z.ZodString;
181
+ attempt: z.ZodNumber;
182
+ input: z.ZodUnknown;
183
+ branch: z.ZodNullable<z.ZodObject<{
184
+ id: z.ZodString;
185
+ index: z.ZodNumber;
186
+ item: z.ZodUnknown;
187
+ }, z.core.$strip>>;
188
+ }, z.core.$strip>>>;
189
+ run: z.ZodObject<{
190
+ id: z.ZodString;
191
+ processId: z.ZodString;
192
+ processVersion: z.ZodString;
193
+ bundleHash: z.ZodString;
194
+ entity: z.ZodNullable<z.ZodObject<{
195
+ type: z.ZodString;
196
+ id: z.ZodString;
197
+ }, z.core.$strip>>;
198
+ startProvenance: z.ZodOptional<z.ZodNullable<z.ZodObject<{
199
+ version: z.ZodLiteral<1>;
200
+ issuer: z.ZodString;
201
+ runId: z.ZodString;
202
+ processId: z.ZodString;
203
+ processVersion: z.ZodString;
204
+ bundleHash: z.ZodString;
205
+ actorSub: z.ZodString;
206
+ startedBy: z.ZodNullable<z.ZodString>;
207
+ mode: z.ZodEnum<{
208
+ system: "system";
209
+ manual: "manual";
210
+ trigger: "trigger";
211
+ schedule: "schedule";
212
+ subprocess: "subprocess";
213
+ intervention: "intervention";
214
+ }>;
215
+ basis: z.ZodEnum<{
216
+ fga_invoker: "fga_invoker";
217
+ trusted_trigger: "trusted_trigger";
218
+ schedule_author: "schedule_author";
219
+ schedule_no_author: "schedule_no_author";
220
+ trusted_service: "trusted_service";
221
+ subprocess_spawn_gate: "subprocess_spawn_gate";
222
+ subprocess_parent_starter: "subprocess_parent_starter";
223
+ subprocess_existing_child: "subprocess_existing_child";
224
+ intervention_actor: "intervention_actor";
225
+ }>;
226
+ authorizedAt: z.ZodISODateTime;
227
+ schedule: z.ZodNullable<z.ZodObject<{
228
+ scheduleId: z.ZodString;
229
+ scheduledAt: z.ZodISODateTime;
230
+ }, z.core.$strict>>;
231
+ }, z.core.$strict>>>;
232
+ }, z.core.$strip>;
233
+ step: z.ZodObject<{
234
+ id: z.ZodString;
235
+ nodeId: z.ZodString;
236
+ attempt: z.ZodNumber;
237
+ runAsServiceAccount: z.ZodNullable<z.ZodString>;
238
+ }, z.core.$strip>;
239
+ receiver: z.ZodObject<{
240
+ functionId: z.ZodString;
241
+ versionId: z.ZodString;
242
+ invocationId: z.ZodString;
243
+ invoker: z.ZodObject<{
244
+ sub: z.ZodString;
245
+ kind: z.ZodString;
246
+ authenticationMethod: z.ZodString;
247
+ }, z.core.$strip>;
248
+ attachedServiceAccountSub: z.ZodString;
249
+ }, z.core.$strip>;
250
+ human: z.ZodObject<{
251
+ receipt: z.ZodString;
252
+ runId: z.ZodString;
253
+ processId: z.ZodString;
254
+ bundleHash: z.ZodString;
255
+ actorSub: z.ZodString;
256
+ receiptId: z.ZodString;
257
+ stepId: z.ZodString;
258
+ nodeId: z.ZodString;
259
+ attempt: z.ZodNumber;
260
+ edgeId: z.ZodNullable<z.ZodString>;
261
+ payload: z.ZodRecord<z.ZodString, z.ZodUnknown>;
262
+ completedAt: z.ZodISODateTime;
263
+ ancestor: z.ZodOptional<z.ZodObject<{
264
+ runId: z.ZodString;
265
+ processId: z.ZodString;
266
+ bundleHash: z.ZodString;
267
+ stepId: z.ZodString;
268
+ nodeId: z.ZodString;
269
+ attempt: z.ZodNumber;
270
+ }, z.core.$strip>>;
271
+ }, z.core.$strip>;
272
+ }, z.core.$strip>;
273
+ export type FunctionLatticeHumanCompletion = z.infer<typeof functionLatticeHumanCompletionSchema>;
274
+ export declare const functionLatticeHumanCompletionsPageSchema: z.ZodObject<{
275
+ completions: z.ZodArray<z.ZodObject<{
276
+ receiverFunctionOrgId: z.ZodString;
277
+ parent: z.ZodOptional<z.ZodNullable<z.ZodObject<{
278
+ runId: z.ZodString;
279
+ processId: z.ZodString;
280
+ processVersion: z.ZodString;
281
+ bundleHash: z.ZodString;
282
+ stepId: z.ZodString;
283
+ nodeId: z.ZodString;
284
+ attempt: z.ZodNumber;
285
+ input: z.ZodUnknown;
286
+ branch: z.ZodNullable<z.ZodObject<{
287
+ id: z.ZodString;
288
+ index: z.ZodNumber;
289
+ item: z.ZodUnknown;
290
+ }, z.core.$strip>>;
291
+ }, z.core.$strip>>>;
292
+ run: z.ZodObject<{
293
+ id: z.ZodString;
294
+ processId: z.ZodString;
295
+ processVersion: z.ZodString;
296
+ bundleHash: z.ZodString;
297
+ entity: z.ZodNullable<z.ZodObject<{
298
+ type: z.ZodString;
299
+ id: z.ZodString;
300
+ }, z.core.$strip>>;
301
+ startProvenance: z.ZodOptional<z.ZodNullable<z.ZodObject<{
302
+ version: z.ZodLiteral<1>;
303
+ issuer: z.ZodString;
304
+ runId: z.ZodString;
305
+ processId: z.ZodString;
306
+ processVersion: z.ZodString;
307
+ bundleHash: z.ZodString;
308
+ actorSub: z.ZodString;
309
+ startedBy: z.ZodNullable<z.ZodString>;
310
+ mode: z.ZodEnum<{
311
+ system: "system";
312
+ manual: "manual";
313
+ trigger: "trigger";
314
+ schedule: "schedule";
315
+ subprocess: "subprocess";
316
+ intervention: "intervention";
317
+ }>;
318
+ basis: z.ZodEnum<{
319
+ fga_invoker: "fga_invoker";
320
+ trusted_trigger: "trusted_trigger";
321
+ schedule_author: "schedule_author";
322
+ schedule_no_author: "schedule_no_author";
323
+ trusted_service: "trusted_service";
324
+ subprocess_spawn_gate: "subprocess_spawn_gate";
325
+ subprocess_parent_starter: "subprocess_parent_starter";
326
+ subprocess_existing_child: "subprocess_existing_child";
327
+ intervention_actor: "intervention_actor";
328
+ }>;
329
+ authorizedAt: z.ZodISODateTime;
330
+ schedule: z.ZodNullable<z.ZodObject<{
331
+ scheduleId: z.ZodString;
332
+ scheduledAt: z.ZodISODateTime;
333
+ }, z.core.$strict>>;
334
+ }, z.core.$strict>>>;
335
+ }, z.core.$strip>;
336
+ step: z.ZodObject<{
337
+ id: z.ZodString;
338
+ nodeId: z.ZodString;
339
+ attempt: z.ZodNumber;
340
+ runAsServiceAccount: z.ZodNullable<z.ZodString>;
341
+ }, z.core.$strip>;
342
+ receiver: z.ZodObject<{
343
+ functionId: z.ZodString;
344
+ versionId: z.ZodString;
345
+ invocationId: z.ZodString;
346
+ invoker: z.ZodObject<{
347
+ sub: z.ZodString;
348
+ kind: z.ZodString;
349
+ authenticationMethod: z.ZodString;
350
+ }, z.core.$strip>;
351
+ attachedServiceAccountSub: z.ZodString;
352
+ }, z.core.$strip>;
353
+ human: z.ZodObject<{
354
+ receipt: z.ZodString;
355
+ runId: z.ZodString;
356
+ processId: z.ZodString;
357
+ bundleHash: z.ZodString;
358
+ actorSub: z.ZodString;
359
+ receiptId: z.ZodString;
360
+ stepId: z.ZodString;
361
+ nodeId: z.ZodString;
362
+ attempt: z.ZodNumber;
363
+ edgeId: z.ZodNullable<z.ZodString>;
364
+ payload: z.ZodRecord<z.ZodString, z.ZodUnknown>;
365
+ completedAt: z.ZodISODateTime;
366
+ ancestor: z.ZodOptional<z.ZodObject<{
367
+ runId: z.ZodString;
368
+ processId: z.ZodString;
369
+ bundleHash: z.ZodString;
370
+ stepId: z.ZodString;
371
+ nodeId: z.ZodString;
372
+ attempt: z.ZodNumber;
373
+ }, z.core.$strip>>;
374
+ }, z.core.$strip>;
375
+ }, z.core.$strip>>;
376
+ }, z.core.$strip>;
377
+ export type FunctionLatticeHumanCompletionsPage = z.infer<typeof functionLatticeHumanCompletionsPageSchema>;
378
+ export declare const functionLatticeParallelSnapshotSchema: z.ZodObject<{
379
+ receiverFunctionOrgId: z.ZodString;
380
+ parent: z.ZodOptional<z.ZodNullable<z.ZodObject<{
381
+ runId: z.ZodString;
382
+ processId: z.ZodString;
383
+ processVersion: z.ZodString;
384
+ bundleHash: z.ZodString;
385
+ stepId: z.ZodString;
386
+ nodeId: z.ZodString;
387
+ attempt: z.ZodNumber;
388
+ input: z.ZodUnknown;
389
+ branch: z.ZodNullable<z.ZodObject<{
390
+ id: z.ZodString;
391
+ index: z.ZodNumber;
392
+ item: z.ZodUnknown;
393
+ }, z.core.$strip>>;
394
+ }, z.core.$strip>>>;
395
+ run: z.ZodObject<{
396
+ id: z.ZodString;
397
+ processId: z.ZodString;
398
+ processVersion: z.ZodString;
399
+ bundleHash: z.ZodString;
400
+ entity: z.ZodNullable<z.ZodObject<{
401
+ type: z.ZodString;
402
+ id: z.ZodString;
403
+ }, z.core.$strip>>;
404
+ startProvenance: z.ZodOptional<z.ZodNullable<z.ZodObject<{
405
+ version: z.ZodLiteral<1>;
406
+ issuer: z.ZodString;
407
+ runId: z.ZodString;
408
+ processId: z.ZodString;
409
+ processVersion: z.ZodString;
410
+ bundleHash: z.ZodString;
411
+ actorSub: z.ZodString;
412
+ startedBy: z.ZodNullable<z.ZodString>;
413
+ mode: z.ZodEnum<{
414
+ system: "system";
415
+ manual: "manual";
416
+ trigger: "trigger";
417
+ schedule: "schedule";
418
+ subprocess: "subprocess";
419
+ intervention: "intervention";
420
+ }>;
421
+ basis: z.ZodEnum<{
422
+ fga_invoker: "fga_invoker";
423
+ trusted_trigger: "trusted_trigger";
424
+ schedule_author: "schedule_author";
425
+ schedule_no_author: "schedule_no_author";
426
+ trusted_service: "trusted_service";
427
+ subprocess_spawn_gate: "subprocess_spawn_gate";
428
+ subprocess_parent_starter: "subprocess_parent_starter";
429
+ subprocess_existing_child: "subprocess_existing_child";
430
+ intervention_actor: "intervention_actor";
431
+ }>;
432
+ authorizedAt: z.ZodISODateTime;
433
+ schedule: z.ZodNullable<z.ZodObject<{
434
+ scheduleId: z.ZodString;
435
+ scheduledAt: z.ZodISODateTime;
436
+ }, z.core.$strict>>;
437
+ }, z.core.$strict>>>;
438
+ }, z.core.$strip>;
439
+ step: z.ZodObject<{
440
+ id: z.ZodString;
441
+ nodeId: z.ZodString;
442
+ attempt: z.ZodNumber;
443
+ runAsServiceAccount: z.ZodNullable<z.ZodString>;
444
+ }, z.core.$strip>;
445
+ receiver: z.ZodObject<{
446
+ functionId: z.ZodString;
447
+ versionId: z.ZodString;
448
+ invocationId: z.ZodString;
449
+ invoker: z.ZodObject<{
450
+ sub: z.ZodString;
451
+ kind: z.ZodString;
452
+ authenticationMethod: z.ZodString;
453
+ }, z.core.$strip>;
454
+ attachedServiceAccountSub: z.ZodString;
455
+ }, z.core.$strip>;
456
+ parallel: z.ZodObject<{
457
+ runId: z.ZodString;
458
+ processId: z.ZodString;
459
+ processVersion: z.ZodString;
460
+ bundleHash: z.ZodString;
461
+ entity: z.ZodNullable<z.ZodObject<{
462
+ type: z.ZodString;
463
+ id: z.ZodString;
464
+ }, z.core.$strip>>;
465
+ stepId: z.ZodString;
466
+ nodeId: z.ZodString;
467
+ attempt: z.ZodNumber;
468
+ status: z.ZodLiteral<"completed">;
469
+ observedAt: z.ZodISODateTime;
470
+ proof: z.ZodString;
471
+ ancestor: z.ZodObject<{
472
+ runId: z.ZodString;
473
+ processId: z.ZodString;
474
+ bundleHash: z.ZodString;
475
+ stepId: z.ZodString;
476
+ nodeId: z.ZodString;
477
+ attempt: z.ZodNumber;
478
+ receipt: z.ZodString;
479
+ receiptId: z.ZodString;
480
+ }, z.core.$strip>;
481
+ branches: z.ZodArray<z.ZodObject<{
482
+ branchId: z.ZodString;
483
+ branchIndex: z.ZodNumber;
484
+ item: z.ZodUnknown;
485
+ stepId: z.ZodString;
486
+ nodeId: z.ZodString;
487
+ attempt: z.ZodNumber;
488
+ status: z.ZodEnum<{
489
+ pending: "pending";
490
+ running: "running";
491
+ completed: "completed";
492
+ failed: "failed";
493
+ cancelled: "cancelled";
494
+ timed_out: "timed_out";
495
+ }>;
496
+ joinStatus: z.ZodEnum<{
497
+ pending: "pending";
498
+ completed: "completed";
499
+ failed: "failed";
500
+ cancelled: "cancelled";
501
+ timed_out: "timed_out";
502
+ }>;
503
+ humanStep: z.ZodNullable<z.ZodObject<{
504
+ runId: z.ZodString;
505
+ stepId: z.ZodString;
506
+ nodeId: z.ZodString;
507
+ attempt: z.ZodNumber;
508
+ receiptId: z.ZodString;
509
+ }, z.core.$strip>>;
510
+ }, z.core.$strip>>;
511
+ }, z.core.$strip>;
512
+ }, z.core.$strip>;
513
+ export type FunctionLatticeParallelSnapshot = z.infer<typeof functionLatticeParallelSnapshotSchema>;
514
+ export declare class FunctionLatticeContextError extends Error {
515
+ readonly status: number;
516
+ readonly code: string;
517
+ readonly name = "FunctionLatticeContextError";
518
+ constructor(status: number, code: string, message: string);
519
+ }
@@ -0,0 +1,148 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FunctionLatticeContextError = exports.functionLatticeParallelSnapshotSchema = exports.functionLatticeHumanCompletionsPageSchema = exports.functionLatticeHumanCompletionSchema = exports.functionLatticeExecutionContextSchema = exports.functionLatticeContextRequestSchema = exports.functionLatticeParallelSnapshotQuerySchema = exports.functionLatticeHumanCompletionsQuerySchema = exports.functionLatticeHumanCompletionQuerySchema = exports.functionLatticeStartProvenanceSchema = exports.FUNCTION_LATTICE_CONTEXT_PATH = exports.FUNCTION_LATTICE_EXECUTION_TOKEN_HEADER = void 0;
4
+ const zod_1 = require("zod");
5
+ exports.FUNCTION_LATTICE_EXECUTION_TOKEN_HEADER = 'x-sequence-lattice-execution-token';
6
+ exports.FUNCTION_LATTICE_CONTEXT_PATH = '/api/managed-functions/lattice/context';
7
+ const identifier = zod_1.z.string().min(1).max(255);
8
+ const principal = zod_1.z.string().min(1).max(512);
9
+ const record = zod_1.z.record(zod_1.z.string(), zod_1.z.unknown());
10
+ const attempt = zod_1.z.number().int().positive();
11
+ const startBasisByMode = {
12
+ manual: ['fga_invoker'], trigger: ['trusted_trigger'], schedule: ['schedule_author', 'schedule_no_author'],
13
+ system: ['trusted_service'], subprocess: ['subprocess_spawn_gate', 'subprocess_parent_starter', 'subprocess_existing_child'], intervention: ['intervention_actor'],
14
+ };
15
+ exports.functionLatticeStartProvenanceSchema = zod_1.z.strictObject({
16
+ version: zod_1.z.literal(1), issuer: zod_1.z.string().min(1).max(8192),
17
+ runId: identifier, processId: identifier, processVersion: identifier, bundleHash: identifier,
18
+ actorSub: principal, startedBy: principal.nullable(),
19
+ mode: zod_1.z.enum(['manual', 'trigger', 'schedule', 'system', 'subprocess', 'intervention']),
20
+ basis: zod_1.z.enum(['fga_invoker', 'schedule_author', 'schedule_no_author', 'trusted_service', 'trusted_trigger', 'subprocess_spawn_gate', 'subprocess_parent_starter', 'subprocess_existing_child', 'intervention_actor']),
21
+ authorizedAt: zod_1.z.iso.datetime(), schedule: zod_1.z.strictObject({ scheduleId: identifier, scheduledAt: zod_1.z.iso.datetime() }).nullable(),
22
+ }).refine((value) => startBasisByMode[value.mode].includes(value.basis) && (value.mode === 'schedule') === (value.schedule !== null), 'Start basis and schedule must match the verified authorization mode');
23
+ exports.functionLatticeHumanCompletionQuerySchema = zod_1.z.strictObject({
24
+ nodeId: identifier,
25
+ stepId: identifier.optional(),
26
+ ancestorNodeId: identifier.optional(),
27
+ });
28
+ exports.functionLatticeHumanCompletionsQuerySchema = exports.functionLatticeHumanCompletionQuerySchema.omit({ stepId: true });
29
+ exports.functionLatticeParallelSnapshotQuerySchema = zod_1.z.strictObject({ nodeId: identifier, ancestorNodeId: identifier });
30
+ exports.functionLatticeContextRequestSchema = zod_1.z.discriminatedUnion('operation', [
31
+ zod_1.z.strictObject({ operation: zod_1.z.literal('getExecutionContext') }),
32
+ exports.functionLatticeHumanCompletionQuerySchema.extend({
33
+ operation: zod_1.z.literal('getHumanCompletion'),
34
+ }),
35
+ exports.functionLatticeHumanCompletionsQuerySchema.extend({
36
+ operation: zod_1.z.literal('getHumanCompletions'),
37
+ }),
38
+ exports.functionLatticeParallelSnapshotQuerySchema.extend({ operation: zod_1.z.literal('getParallelSnapshot') }),
39
+ ]);
40
+ const executionIdentity = zod_1.z.object({
41
+ receiverFunctionOrgId: identifier,
42
+ parent: zod_1.z.object({ runId: identifier, processId: identifier, processVersion: identifier, bundleHash: identifier, stepId: identifier, nodeId: identifier, attempt, input: zod_1.z.unknown(), branch: zod_1.z.object({ id: identifier, index: zod_1.z.number().int().nonnegative(), item: zod_1.z.unknown() }).nullable() }).nullable().optional(),
43
+ run: zod_1.z.object({
44
+ id: identifier,
45
+ processId: identifier,
46
+ processVersion: identifier,
47
+ bundleHash: identifier,
48
+ entity: zod_1.z.object({ type: identifier, id: identifier }).nullable(),
49
+ startProvenance: exports.functionLatticeStartProvenanceSchema.nullable().optional(),
50
+ }).refine((run) => !run.startProvenance || (run.startProvenance.runId === run.id && run.startProvenance.processId === run.processId && run.startProvenance.processVersion === run.processVersion && run.startProvenance.bundleHash === run.bundleHash), 'Start provenance must identify the exact executing run'),
51
+ step: zod_1.z.object({
52
+ id: identifier,
53
+ nodeId: identifier,
54
+ attempt,
55
+ runAsServiceAccount: principal.nullable(),
56
+ }),
57
+ receiver: zod_1.z.object({
58
+ functionId: identifier,
59
+ versionId: identifier,
60
+ invocationId: identifier,
61
+ invoker: zod_1.z.object({ sub: principal, kind: identifier, authenticationMethod: identifier }),
62
+ attachedServiceAccountSub: principal,
63
+ }),
64
+ });
65
+ exports.functionLatticeExecutionContextSchema = executionIdentity.extend({
66
+ input: zod_1.z.unknown(),
67
+ ctxSnapshot: zod_1.z.object({
68
+ entity: zod_1.z.unknown(),
69
+ upstream: record,
70
+ state: record,
71
+ run: zod_1.z.object({
72
+ id: identifier,
73
+ process_id: identifier,
74
+ version: identifier,
75
+ started_at: zod_1.z.iso.datetime({ offset: true }),
76
+ started_by: principal.nullable(),
77
+ metadata: record,
78
+ trigger_reason: record.nullable().optional(),
79
+ }),
80
+ branch: zod_1.z.object({ id: identifier, index: zod_1.z.number().int().nonnegative(), item: zod_1.z.unknown() }).optional(),
81
+ }),
82
+ }).refine((value) => value.ctxSnapshot.run.id === value.run.id &&
83
+ value.ctxSnapshot.run.process_id === value.run.processId &&
84
+ value.ctxSnapshot.run.version === value.run.processVersion, 'The context snapshot must identify the executing run');
85
+ exports.functionLatticeHumanCompletionSchema = executionIdentity.extend({
86
+ human: zod_1.z.object({
87
+ receipt: zod_1.z.string().min(1).max(16_384),
88
+ runId: identifier,
89
+ processId: identifier,
90
+ bundleHash: identifier,
91
+ actorSub: principal,
92
+ receiptId: identifier,
93
+ stepId: identifier,
94
+ nodeId: identifier,
95
+ attempt,
96
+ edgeId: identifier.nullable(),
97
+ payload: record,
98
+ completedAt: zod_1.z.iso.datetime({ offset: true }),
99
+ ancestor: zod_1.z.object({
100
+ runId: identifier,
101
+ processId: identifier,
102
+ bundleHash: identifier,
103
+ stepId: identifier,
104
+ nodeId: identifier,
105
+ attempt,
106
+ }).optional(),
107
+ }),
108
+ }).refine((value) => value.human.receiptId === value.human.stepId, 'The receipt identifier must be the actual human step identifier');
109
+ exports.functionLatticeHumanCompletionsPageSchema = zod_1.z.object({
110
+ completions: zod_1.z.array(exports.functionLatticeHumanCompletionSchema).max(64),
111
+ });
112
+ const parallelHumanStep = zod_1.z.object({ runId: identifier, stepId: identifier, nodeId: identifier, attempt, receiptId: identifier });
113
+ exports.functionLatticeParallelSnapshotSchema = executionIdentity.extend({
114
+ parallel: zod_1.z.object({
115
+ runId: identifier, processId: identifier, processVersion: identifier, bundleHash: identifier,
116
+ entity: zod_1.z.object({ type: identifier, id: identifier }).nullable(),
117
+ stepId: identifier, nodeId: identifier, attempt, status: zod_1.z.literal('completed'),
118
+ observedAt: zod_1.z.iso.datetime({ offset: true }), proof: zod_1.z.string().min(1).max(131_072),
119
+ ancestor: zod_1.z.object({ runId: identifier, processId: identifier, bundleHash: identifier, stepId: identifier, nodeId: identifier, attempt, receipt: zod_1.z.string().min(1).max(16_384), receiptId: identifier }),
120
+ branches: zod_1.z.array(zod_1.z.object({
121
+ branchId: identifier, branchIndex: zod_1.z.number().int().nonnegative(), item: zod_1.z.unknown(),
122
+ stepId: identifier, nodeId: identifier, attempt,
123
+ status: zod_1.z.enum(['pending', 'running', 'completed', 'failed', 'cancelled', 'timed_out']),
124
+ joinStatus: zod_1.z.enum(['pending', 'completed', 'failed', 'cancelled', 'timed_out']), humanStep: parallelHumanStep.nullable(),
125
+ })).max(64),
126
+ }),
127
+ }).refine((value) => {
128
+ const branches = value.parallel.branches;
129
+ return value.parallel.runId === value.run.id && value.parallel.bundleHash === value.run.bundleHash &&
130
+ value.parallel.processId === value.run.processId && value.parallel.processVersion === value.run.processVersion &&
131
+ value.parallel.entity?.id === value.run.entity?.id && value.parallel.entity?.type === value.run.entity?.type &&
132
+ value.parallel.ancestor.runId === value.run.id && value.parallel.ancestor.processId === value.run.processId &&
133
+ value.parallel.ancestor.bundleHash === value.run.bundleHash && value.parallel.ancestor.receiptId === value.parallel.ancestor.stepId &&
134
+ new Set(branches.map((branch) => branch.branchId)).size === branches.length &&
135
+ new Set(branches.map((branch) => branch.branchIndex)).size === branches.length &&
136
+ branches.every((branch) => !branch.humanStep || (!['pending', 'timed_out'].includes(branch.joinStatus) && branch.humanStep.runId === value.run.id && branch.humanStep.nodeId === branch.nodeId && branch.humanStep.stepId === branch.stepId && branch.humanStep.attempt === branch.attempt && branch.humanStep.receiptId === branch.stepId));
137
+ }, 'Parallel snapshots must identify one complete causal execution with unique actual branches');
138
+ class FunctionLatticeContextError extends Error {
139
+ status;
140
+ code;
141
+ name = 'FunctionLatticeContextError';
142
+ constructor(status, code, message) {
143
+ super(message);
144
+ this.status = status;
145
+ this.code = code;
146
+ }
147
+ }
148
+ exports.FunctionLatticeContextError = FunctionLatticeContextError;
@@ -0,0 +1,16 @@
1
+ import { type FunctionLatticeExecutionContext, type FunctionLatticeHumanCompletion, type FunctionLatticeHumanCompletionQuery, type FunctionLatticeHumanCompletionsQuery, type FunctionLatticeHumanCompletionsPage, type FunctionLatticeParallelSnapshot, type FunctionLatticeParallelSnapshotQuery } from './lattice-provenance-contract';
2
+ export * from './lattice-provenance-contract';
3
+ export interface FunctionLatticeClientOptions {
4
+ request: {
5
+ headers: Pick<Headers, 'get'> | Readonly<Record<string, string | readonly string[] | undefined>>;
6
+ };
7
+ baseUrl: string;
8
+ fetchImpl?: typeof globalThis.fetch;
9
+ }
10
+ export interface FunctionLatticeClient {
11
+ getExecutionContext(): Promise<FunctionLatticeExecutionContext>;
12
+ getHumanCompletion(query: FunctionLatticeHumanCompletionQuery): Promise<FunctionLatticeHumanCompletion>;
13
+ getHumanCompletions(query: FunctionLatticeHumanCompletionsQuery): Promise<FunctionLatticeHumanCompletionsPage>;
14
+ getParallelSnapshot(query: FunctionLatticeParallelSnapshotQuery): Promise<FunctionLatticeParallelSnapshot>;
15
+ }
16
+ export declare function createFunctionLatticeClient({ request, baseUrl, fetchImpl, }: FunctionLatticeClientOptions): FunctionLatticeClient;