@sequenceholdings/managed-functions 0.4.1 → 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 (87) hide show
  1. package/README.md +374 -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 +150 -0
  17. package/dist/capabilities.js +58 -5
  18. package/dist/config.d.ts +17 -2
  19. package/dist/config.js +55 -1
  20. package/dist/deployed-policy.js +90 -2
  21. package/dist/directory-config.js +1 -1
  22. package/dist/directory-contract.d.ts +68 -0
  23. package/dist/directory-contract.js +57 -0
  24. package/dist/directory-manifest.d.ts +5 -0
  25. package/dist/directory-manifest.js +10 -0
  26. package/dist/http-tracing.js +3 -0
  27. package/dist/immutable-release-contract.d.ts +3 -0
  28. package/dist/immutable-release-contract.js +12 -0
  29. package/dist/index.d.ts +37 -1
  30. package/dist/index.js +72 -1
  31. package/dist/invocation-client.d.ts +8 -1
  32. package/dist/invocation-client.js +8 -3
  33. package/dist/invocation-contract.d.ts +36 -0
  34. package/dist/invocation-contract.js +48 -0
  35. package/dist/invocation.d.ts +8 -0
  36. package/dist/invocation.js +134 -0
  37. package/dist/lattice-capability.d.ts +5 -0
  38. package/dist/lattice-capability.js +16 -0
  39. package/dist/lattice-provenance-contract.d.ts +519 -0
  40. package/dist/lattice-provenance-contract.js +148 -0
  41. package/dist/lattice-provenance.d.ts +16 -0
  42. package/dist/lattice-provenance.js +167 -0
  43. package/dist/monitoring-annotations.d.ts +53 -0
  44. package/dist/monitoring-annotations.js +54 -0
  45. package/dist/monitoring-contract.d.ts +463 -0
  46. package/dist/monitoring-contract.js +89 -0
  47. package/dist/monitoring-events.d.ts +257 -0
  48. package/dist/monitoring-events.js +136 -0
  49. package/dist/monitoring.d.ts +14 -0
  50. package/dist/monitoring.js +78 -0
  51. package/dist/orm-contract.d.ts +1 -0
  52. package/dist/orm-contract.js +4 -0
  53. package/dist/orm.d.ts +19 -3
  54. package/dist/orm.js +93 -13
  55. package/dist/preflight-abrigo.d.ts +10 -0
  56. package/dist/preflight-abrigo.js +26 -0
  57. package/dist/preflight-agents.d.ts +10 -0
  58. package/dist/preflight-agents.js +51 -0
  59. package/dist/preflight-immutable-release.d.ts +10 -0
  60. package/dist/preflight-immutable-release.js +34 -0
  61. package/dist/preflight-invocation.d.ts +10 -0
  62. package/dist/preflight-invocation.js +40 -0
  63. package/dist/preflight-lattice.d.ts +10 -0
  64. package/dist/preflight-lattice.js +40 -0
  65. package/dist/preflight-monitoring.d.ts +10 -0
  66. package/dist/preflight-monitoring.js +46 -0
  67. package/dist/preflight-service-directory.d.ts +10 -0
  68. package/dist/preflight-service-directory.js +26 -0
  69. package/dist/preflight-workflows.d.ts +10 -0
  70. package/dist/preflight-workflows.js +38 -0
  71. package/dist/preflight.js +49 -5
  72. package/dist/processes-contract.d.ts +20 -0
  73. package/dist/processes-contract.js +8 -1
  74. package/dist/processes.d.ts +2 -1
  75. package/dist/processes.js +34 -0
  76. package/dist/runtime.cjs +3111 -214
  77. package/dist/sdk-range.d.ts +1 -0
  78. package/dist/sdk-range.js +25 -0
  79. package/dist/service-directory.d.ts +12 -0
  80. package/dist/service-directory.js +72 -0
  81. package/dist/workflow-scopes-contract.d.ts +8 -0
  82. package/dist/workflow-scopes-contract.js +29 -0
  83. package/dist/workflow-source-contract.d.ts +524 -0
  84. package/dist/workflow-source-contract.js +59 -0
  85. package/dist/workflow-source.d.ts +12 -0
  86. package/dist/workflow-source.js +93 -0
  87. package/package.json +2 -2
@@ -0,0 +1,524 @@
1
+ import { z } from 'zod';
2
+ export declare const FUNCTION_WORKFLOW_TOKEN_HEADER = "x-sequence-workflow-service-token";
3
+ export declare const FUNCTION_WORKFLOW_EVIDENCE_TOKEN_HEADER = "x-sequence-workflow-evidence-token";
4
+ export declare const FUNCTION_WORKFLOW_CAPTURE_PATH = "/api/managed-functions/workflows/capture";
5
+ export declare const FUNCTION_WORKFLOW_EVIDENCE_PATH = "/api/managed-functions/workflows/evidence";
6
+ export declare const functionWorkflowSourceRootSchema: z.ZodObject<{
7
+ id: z.ZodString;
8
+ runId: z.ZodString;
9
+ identity: z.ZodObject<{
10
+ id: z.ZodString;
11
+ version: z.ZodString;
12
+ definitionSha256: z.ZodString;
13
+ }, z.core.$strict>;
14
+ branches: z.ZodArray<z.ZodObject<{
15
+ nodeId: z.ZodString;
16
+ nodeRunId: z.ZodString;
17
+ attempt: z.ZodNumber;
18
+ agentId: z.ZodString;
19
+ runId: z.ZodNullable<z.ZodString>;
20
+ status: z.ZodEnum<{
21
+ completed: "completed";
22
+ failed: "failed";
23
+ cancelled: "cancelled";
24
+ skipped: "skipped";
25
+ }>;
26
+ identity: z.ZodObject<{
27
+ id: z.ZodString;
28
+ version: z.ZodString;
29
+ definitionSha256: z.ZodString;
30
+ }, z.core.$strict>;
31
+ completedAt: z.ZodNullable<z.ZodISODateTime>;
32
+ }, z.core.$strict>>;
33
+ }, z.core.$strict>;
34
+ export declare const functionWorkflowSourceExecutionSchema: z.ZodObject<{
35
+ run: z.ZodObject<{
36
+ id: z.ZodString;
37
+ processId: z.ZodString;
38
+ processVersion: z.ZodString;
39
+ bundleHash: z.ZodString;
40
+ entity: z.ZodNullable<z.ZodObject<{
41
+ type: z.ZodString;
42
+ id: z.ZodString;
43
+ }, z.core.$strict>>;
44
+ }, z.core.$strict>;
45
+ step: z.ZodObject<{
46
+ id: z.ZodString;
47
+ nodeId: z.ZodString;
48
+ attempt: z.ZodNumber;
49
+ }, z.core.$strict>;
50
+ workflow: z.ZodObject<{
51
+ id: z.ZodString;
52
+ runId: z.ZodString;
53
+ identity: z.ZodObject<{
54
+ id: z.ZodString;
55
+ version: z.ZodString;
56
+ definitionSha256: z.ZodString;
57
+ }, z.core.$strict>;
58
+ branches: z.ZodArray<z.ZodObject<{
59
+ nodeId: z.ZodString;
60
+ nodeRunId: z.ZodString;
61
+ attempt: z.ZodNumber;
62
+ agentId: z.ZodString;
63
+ runId: z.ZodNullable<z.ZodString>;
64
+ status: z.ZodEnum<{
65
+ completed: "completed";
66
+ failed: "failed";
67
+ cancelled: "cancelled";
68
+ skipped: "skipped";
69
+ }>;
70
+ identity: z.ZodObject<{
71
+ id: z.ZodString;
72
+ version: z.ZodString;
73
+ definitionSha256: z.ZodString;
74
+ }, z.core.$strict>;
75
+ completedAt: z.ZodNullable<z.ZodISODateTime>;
76
+ }, z.core.$strict>>;
77
+ }, z.core.$strict>;
78
+ }, z.core.$strict>;
79
+ export type FunctionWorkflowSourceExecution = z.infer<typeof functionWorkflowSourceExecutionSchema>;
80
+ export declare const functionWorkflowCompletedRunQuerySchema: z.ZodObject<{
81
+ workflow: z.ZodString;
82
+ runId: z.ZodString;
83
+ }, z.core.$strict>;
84
+ export type FunctionWorkflowCompletedRunQuery = z.infer<typeof functionWorkflowCompletedRunQuerySchema>;
85
+ export declare const functionWorkflowCompletedRunSchema: z.ZodObject<{
86
+ workflow: z.ZodString;
87
+ runId: z.ZodString;
88
+ status: z.ZodLiteral<"completed">;
89
+ output: z.ZodJSONSchema;
90
+ }, z.core.$strict>;
91
+ export type FunctionWorkflowCompletedRun = z.infer<typeof functionWorkflowCompletedRunSchema>;
92
+ export declare const functionWorkflowSourceCaptureSchema: z.ZodObject<{
93
+ response: z.ZodObject<{
94
+ workflow: z.ZodString;
95
+ runId: z.ZodString;
96
+ status: z.ZodLiteral<"completed">;
97
+ output: z.ZodJSONSchema;
98
+ }, z.core.$strict>;
99
+ responseHash: z.ZodString;
100
+ sourceReceipt: z.ZodString;
101
+ }, z.core.$strict>;
102
+ export type FunctionWorkflowSourceCapture = z.infer<typeof functionWorkflowSourceCaptureSchema>;
103
+ export declare const functionWorkflowManagedFunctionSourceClaimsSchema: z.ZodObject<{
104
+ actualServiceAccountSub: z.ZodString;
105
+ sourceReceiver: z.ZodObject<{
106
+ functionId: z.ZodUUID;
107
+ versionId: z.ZodUUID;
108
+ invocationId: z.ZodUUID;
109
+ serviceAccountId: z.ZodUUID;
110
+ org: z.ZodString;
111
+ }, z.core.$strict>;
112
+ sourceExecution: z.ZodObject<{
113
+ run: z.ZodObject<{
114
+ id: z.ZodString;
115
+ processId: z.ZodString;
116
+ processVersion: z.ZodString;
117
+ bundleHash: z.ZodString;
118
+ entity: z.ZodNullable<z.ZodObject<{
119
+ type: z.ZodString;
120
+ id: z.ZodString;
121
+ }, z.core.$strict>>;
122
+ }, z.core.$strict>;
123
+ step: z.ZodObject<{
124
+ id: z.ZodString;
125
+ nodeId: z.ZodString;
126
+ attempt: z.ZodNumber;
127
+ }, z.core.$strict>;
128
+ workflow: z.ZodObject<{
129
+ id: z.ZodString;
130
+ runId: z.ZodString;
131
+ identity: z.ZodObject<{
132
+ id: z.ZodString;
133
+ version: z.ZodString;
134
+ definitionSha256: z.ZodString;
135
+ }, z.core.$strict>;
136
+ branches: z.ZodArray<z.ZodObject<{
137
+ nodeId: z.ZodString;
138
+ nodeRunId: z.ZodString;
139
+ attempt: z.ZodNumber;
140
+ agentId: z.ZodString;
141
+ runId: z.ZodNullable<z.ZodString>;
142
+ status: z.ZodEnum<{
143
+ completed: "completed";
144
+ failed: "failed";
145
+ cancelled: "cancelled";
146
+ skipped: "skipped";
147
+ }>;
148
+ identity: z.ZodObject<{
149
+ id: z.ZodString;
150
+ version: z.ZodString;
151
+ definitionSha256: z.ZodString;
152
+ }, z.core.$strict>;
153
+ completedAt: z.ZodNullable<z.ZodISODateTime>;
154
+ }, z.core.$strict>>;
155
+ }, z.core.$strict>;
156
+ }, z.core.$strict>;
157
+ environment: z.ZodString;
158
+ org: z.ZodString;
159
+ workflowId: z.ZodString;
160
+ runId: z.ZodString;
161
+ cutoffAt: z.ZodISODateTime;
162
+ outputHash: z.ZodString;
163
+ responseHash: z.ZodString;
164
+ jobAdmission: z.ZodNullable<z.ZodObject<{
165
+ idempotencyKey: z.ZodString;
166
+ requestHash: z.ZodString;
167
+ kind: z.ZodEnum<{
168
+ workflow: "workflow";
169
+ agent: "agent";
170
+ }>;
171
+ resourceId: z.ZodString;
172
+ actorSub: z.ZodString;
173
+ runId: z.ZodString;
174
+ executionSnapshotId: z.ZodUUID;
175
+ }, z.core.$strict>>;
176
+ sourceKind: z.ZodLiteral<"managed_function">;
177
+ projection: z.ZodLiteral<"workflow-completed-v1">;
178
+ audience: z.ZodLiteral<"atlas-managed-function-workflow-source-evidence">;
179
+ }, z.core.$strict>;
180
+ export declare const functionWorkflowHumanSourceClaimsSchema: z.ZodObject<{
181
+ sourceKind: z.ZodLiteral<"human">;
182
+ projection: z.ZodLiteral<"workflow-completed-v1">;
183
+ audience: z.ZodLiteral<"atlas-workflow-source-evidence">;
184
+ actualUserSub: z.ZodString;
185
+ sourceExecution: z.ZodNull;
186
+ workflowSource: z.ZodObject<{
187
+ id: z.ZodString;
188
+ runId: z.ZodString;
189
+ identity: z.ZodObject<{
190
+ id: z.ZodString;
191
+ version: z.ZodString;
192
+ definitionSha256: z.ZodString;
193
+ }, z.core.$strict>;
194
+ branches: z.ZodArray<z.ZodObject<{
195
+ nodeId: z.ZodString;
196
+ nodeRunId: z.ZodString;
197
+ attempt: z.ZodNumber;
198
+ agentId: z.ZodString;
199
+ runId: z.ZodNullable<z.ZodString>;
200
+ status: z.ZodEnum<{
201
+ completed: "completed";
202
+ failed: "failed";
203
+ cancelled: "cancelled";
204
+ skipped: "skipped";
205
+ }>;
206
+ identity: z.ZodObject<{
207
+ id: z.ZodString;
208
+ version: z.ZodString;
209
+ definitionSha256: z.ZodString;
210
+ }, z.core.$strict>;
211
+ completedAt: z.ZodNullable<z.ZodISODateTime>;
212
+ }, z.core.$strict>>;
213
+ }, z.core.$strict>;
214
+ environment: z.ZodString;
215
+ org: z.ZodString;
216
+ workflowId: z.ZodString;
217
+ runId: z.ZodString;
218
+ cutoffAt: z.ZodISODateTime;
219
+ outputHash: z.ZodString;
220
+ responseHash: z.ZodString;
221
+ jobAdmission: z.ZodNullable<z.ZodObject<{
222
+ idempotencyKey: z.ZodString;
223
+ requestHash: z.ZodString;
224
+ kind: z.ZodEnum<{
225
+ workflow: "workflow";
226
+ agent: "agent";
227
+ }>;
228
+ resourceId: z.ZodString;
229
+ actorSub: z.ZodString;
230
+ runId: z.ZodString;
231
+ executionSnapshotId: z.ZodUUID;
232
+ }, z.core.$strict>>;
233
+ }, z.core.$strict>;
234
+ export declare const functionWorkflowSourceClaimsSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
235
+ actualServiceAccountSub: z.ZodString;
236
+ sourceReceiver: z.ZodObject<{
237
+ functionId: z.ZodUUID;
238
+ versionId: z.ZodUUID;
239
+ invocationId: z.ZodUUID;
240
+ serviceAccountId: z.ZodUUID;
241
+ org: z.ZodString;
242
+ }, z.core.$strict>;
243
+ sourceExecution: z.ZodObject<{
244
+ run: z.ZodObject<{
245
+ id: z.ZodString;
246
+ processId: z.ZodString;
247
+ processVersion: z.ZodString;
248
+ bundleHash: z.ZodString;
249
+ entity: z.ZodNullable<z.ZodObject<{
250
+ type: z.ZodString;
251
+ id: z.ZodString;
252
+ }, z.core.$strict>>;
253
+ }, z.core.$strict>;
254
+ step: z.ZodObject<{
255
+ id: z.ZodString;
256
+ nodeId: z.ZodString;
257
+ attempt: z.ZodNumber;
258
+ }, z.core.$strict>;
259
+ workflow: z.ZodObject<{
260
+ id: z.ZodString;
261
+ runId: z.ZodString;
262
+ identity: z.ZodObject<{
263
+ id: z.ZodString;
264
+ version: z.ZodString;
265
+ definitionSha256: z.ZodString;
266
+ }, z.core.$strict>;
267
+ branches: z.ZodArray<z.ZodObject<{
268
+ nodeId: z.ZodString;
269
+ nodeRunId: z.ZodString;
270
+ attempt: z.ZodNumber;
271
+ agentId: z.ZodString;
272
+ runId: z.ZodNullable<z.ZodString>;
273
+ status: z.ZodEnum<{
274
+ completed: "completed";
275
+ failed: "failed";
276
+ cancelled: "cancelled";
277
+ skipped: "skipped";
278
+ }>;
279
+ identity: z.ZodObject<{
280
+ id: z.ZodString;
281
+ version: z.ZodString;
282
+ definitionSha256: z.ZodString;
283
+ }, z.core.$strict>;
284
+ completedAt: z.ZodNullable<z.ZodISODateTime>;
285
+ }, z.core.$strict>>;
286
+ }, z.core.$strict>;
287
+ }, z.core.$strict>;
288
+ environment: z.ZodString;
289
+ org: z.ZodString;
290
+ workflowId: z.ZodString;
291
+ runId: z.ZodString;
292
+ cutoffAt: z.ZodISODateTime;
293
+ outputHash: z.ZodString;
294
+ responseHash: z.ZodString;
295
+ jobAdmission: z.ZodNullable<z.ZodObject<{
296
+ idempotencyKey: z.ZodString;
297
+ requestHash: z.ZodString;
298
+ kind: z.ZodEnum<{
299
+ workflow: "workflow";
300
+ agent: "agent";
301
+ }>;
302
+ resourceId: z.ZodString;
303
+ actorSub: z.ZodString;
304
+ runId: z.ZodString;
305
+ executionSnapshotId: z.ZodUUID;
306
+ }, z.core.$strict>>;
307
+ sourceKind: z.ZodLiteral<"managed_function">;
308
+ projection: z.ZodLiteral<"workflow-completed-v1">;
309
+ audience: z.ZodLiteral<"atlas-managed-function-workflow-source-evidence">;
310
+ }, z.core.$strict>, z.ZodObject<{
311
+ sourceKind: z.ZodLiteral<"human">;
312
+ projection: z.ZodLiteral<"workflow-completed-v1">;
313
+ audience: z.ZodLiteral<"atlas-workflow-source-evidence">;
314
+ actualUserSub: z.ZodString;
315
+ sourceExecution: z.ZodNull;
316
+ workflowSource: z.ZodObject<{
317
+ id: z.ZodString;
318
+ runId: z.ZodString;
319
+ identity: z.ZodObject<{
320
+ id: z.ZodString;
321
+ version: z.ZodString;
322
+ definitionSha256: z.ZodString;
323
+ }, z.core.$strict>;
324
+ branches: z.ZodArray<z.ZodObject<{
325
+ nodeId: z.ZodString;
326
+ nodeRunId: z.ZodString;
327
+ attempt: z.ZodNumber;
328
+ agentId: z.ZodString;
329
+ runId: z.ZodNullable<z.ZodString>;
330
+ status: z.ZodEnum<{
331
+ completed: "completed";
332
+ failed: "failed";
333
+ cancelled: "cancelled";
334
+ skipped: "skipped";
335
+ }>;
336
+ identity: z.ZodObject<{
337
+ id: z.ZodString;
338
+ version: z.ZodString;
339
+ definitionSha256: z.ZodString;
340
+ }, z.core.$strict>;
341
+ completedAt: z.ZodNullable<z.ZodISODateTime>;
342
+ }, z.core.$strict>>;
343
+ }, z.core.$strict>;
344
+ environment: z.ZodString;
345
+ org: z.ZodString;
346
+ workflowId: z.ZodString;
347
+ runId: z.ZodString;
348
+ cutoffAt: z.ZodISODateTime;
349
+ outputHash: z.ZodString;
350
+ responseHash: z.ZodString;
351
+ jobAdmission: z.ZodNullable<z.ZodObject<{
352
+ idempotencyKey: z.ZodString;
353
+ requestHash: z.ZodString;
354
+ kind: z.ZodEnum<{
355
+ workflow: "workflow";
356
+ agent: "agent";
357
+ }>;
358
+ resourceId: z.ZodString;
359
+ actorSub: z.ZodString;
360
+ runId: z.ZodString;
361
+ executionSnapshotId: z.ZodUUID;
362
+ }, z.core.$strict>>;
363
+ }, z.core.$strict>], "sourceKind">;
364
+ export type FunctionWorkflowSourceClaims = z.infer<typeof functionWorkflowSourceClaimsSchema>;
365
+ export declare const functionWorkflowSourceEvidenceRequestSchema: z.ZodObject<{
366
+ workflow: z.ZodString;
367
+ runId: z.ZodString;
368
+ operation: z.ZodLiteral<"verifySourceEvidence">;
369
+ response: z.ZodObject<{
370
+ workflow: z.ZodString;
371
+ runId: z.ZodString;
372
+ status: z.ZodLiteral<"completed">;
373
+ output: z.ZodJSONSchema;
374
+ }, z.core.$strict>;
375
+ responseHash: z.ZodString;
376
+ sourceReceipt: z.ZodString;
377
+ }, z.core.$strict>;
378
+ export type FunctionWorkflowSourceEvidenceRequest = z.infer<typeof functionWorkflowSourceEvidenceRequestSchema>;
379
+ export declare const functionWorkflowSourceVerificationSchema: z.ZodObject<{
380
+ source: z.ZodDiscriminatedUnion<[z.ZodObject<{
381
+ actualServiceAccountSub: z.ZodString;
382
+ sourceReceiver: z.ZodObject<{
383
+ functionId: z.ZodUUID;
384
+ versionId: z.ZodUUID;
385
+ invocationId: z.ZodUUID;
386
+ serviceAccountId: z.ZodUUID;
387
+ org: z.ZodString;
388
+ }, z.core.$strict>;
389
+ sourceExecution: z.ZodObject<{
390
+ run: z.ZodObject<{
391
+ id: z.ZodString;
392
+ processId: z.ZodString;
393
+ processVersion: z.ZodString;
394
+ bundleHash: z.ZodString;
395
+ entity: z.ZodNullable<z.ZodObject<{
396
+ type: z.ZodString;
397
+ id: z.ZodString;
398
+ }, z.core.$strict>>;
399
+ }, z.core.$strict>;
400
+ step: z.ZodObject<{
401
+ id: z.ZodString;
402
+ nodeId: z.ZodString;
403
+ attempt: z.ZodNumber;
404
+ }, z.core.$strict>;
405
+ workflow: z.ZodObject<{
406
+ id: z.ZodString;
407
+ runId: z.ZodString;
408
+ identity: z.ZodObject<{
409
+ id: z.ZodString;
410
+ version: z.ZodString;
411
+ definitionSha256: z.ZodString;
412
+ }, z.core.$strict>;
413
+ branches: z.ZodArray<z.ZodObject<{
414
+ nodeId: z.ZodString;
415
+ nodeRunId: z.ZodString;
416
+ attempt: z.ZodNumber;
417
+ agentId: z.ZodString;
418
+ runId: z.ZodNullable<z.ZodString>;
419
+ status: z.ZodEnum<{
420
+ completed: "completed";
421
+ failed: "failed";
422
+ cancelled: "cancelled";
423
+ skipped: "skipped";
424
+ }>;
425
+ identity: z.ZodObject<{
426
+ id: z.ZodString;
427
+ version: z.ZodString;
428
+ definitionSha256: z.ZodString;
429
+ }, z.core.$strict>;
430
+ completedAt: z.ZodNullable<z.ZodISODateTime>;
431
+ }, z.core.$strict>>;
432
+ }, z.core.$strict>;
433
+ }, z.core.$strict>;
434
+ environment: z.ZodString;
435
+ org: z.ZodString;
436
+ workflowId: z.ZodString;
437
+ runId: z.ZodString;
438
+ cutoffAt: z.ZodISODateTime;
439
+ outputHash: z.ZodString;
440
+ responseHash: z.ZodString;
441
+ jobAdmission: z.ZodNullable<z.ZodObject<{
442
+ idempotencyKey: z.ZodString;
443
+ requestHash: z.ZodString;
444
+ kind: z.ZodEnum<{
445
+ workflow: "workflow";
446
+ agent: "agent";
447
+ }>;
448
+ resourceId: z.ZodString;
449
+ actorSub: z.ZodString;
450
+ runId: z.ZodString;
451
+ executionSnapshotId: z.ZodUUID;
452
+ }, z.core.$strict>>;
453
+ sourceKind: z.ZodLiteral<"managed_function">;
454
+ projection: z.ZodLiteral<"workflow-completed-v1">;
455
+ audience: z.ZodLiteral<"atlas-managed-function-workflow-source-evidence">;
456
+ }, z.core.$strict>, z.ZodObject<{
457
+ sourceKind: z.ZodLiteral<"human">;
458
+ projection: z.ZodLiteral<"workflow-completed-v1">;
459
+ audience: z.ZodLiteral<"atlas-workflow-source-evidence">;
460
+ actualUserSub: z.ZodString;
461
+ sourceExecution: z.ZodNull;
462
+ workflowSource: z.ZodObject<{
463
+ id: z.ZodString;
464
+ runId: z.ZodString;
465
+ identity: z.ZodObject<{
466
+ id: z.ZodString;
467
+ version: z.ZodString;
468
+ definitionSha256: z.ZodString;
469
+ }, z.core.$strict>;
470
+ branches: z.ZodArray<z.ZodObject<{
471
+ nodeId: z.ZodString;
472
+ nodeRunId: z.ZodString;
473
+ attempt: z.ZodNumber;
474
+ agentId: z.ZodString;
475
+ runId: z.ZodNullable<z.ZodString>;
476
+ status: z.ZodEnum<{
477
+ completed: "completed";
478
+ failed: "failed";
479
+ cancelled: "cancelled";
480
+ skipped: "skipped";
481
+ }>;
482
+ identity: z.ZodObject<{
483
+ id: z.ZodString;
484
+ version: z.ZodString;
485
+ definitionSha256: z.ZodString;
486
+ }, z.core.$strict>;
487
+ completedAt: z.ZodNullable<z.ZodISODateTime>;
488
+ }, z.core.$strict>>;
489
+ }, z.core.$strict>;
490
+ environment: z.ZodString;
491
+ org: z.ZodString;
492
+ workflowId: z.ZodString;
493
+ runId: z.ZodString;
494
+ cutoffAt: z.ZodISODateTime;
495
+ outputHash: z.ZodString;
496
+ responseHash: z.ZodString;
497
+ jobAdmission: z.ZodNullable<z.ZodObject<{
498
+ idempotencyKey: z.ZodString;
499
+ requestHash: z.ZodString;
500
+ kind: z.ZodEnum<{
501
+ workflow: "workflow";
502
+ agent: "agent";
503
+ }>;
504
+ resourceId: z.ZodString;
505
+ actorSub: z.ZodString;
506
+ runId: z.ZodString;
507
+ executionSnapshotId: z.ZodUUID;
508
+ }, z.core.$strict>>;
509
+ }, z.core.$strict>], "sourceKind">;
510
+ receiver: z.ZodObject<{
511
+ functionId: z.ZodUUID;
512
+ versionId: z.ZodUUID;
513
+ invocationId: z.ZodUUID;
514
+ serviceAccountId: z.ZodUUID;
515
+ org: z.ZodString;
516
+ }, z.core.$strict>;
517
+ }, z.core.$strict>;
518
+ export type FunctionWorkflowSourceVerification = z.infer<typeof functionWorkflowSourceVerificationSchema>;
519
+ export declare class FunctionWorkflowReadError extends Error {
520
+ readonly status: number;
521
+ readonly code: string;
522
+ readonly name = "FunctionWorkflowReadError";
523
+ constructor(status: number, code: string, message: string);
524
+ }
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FunctionWorkflowReadError = exports.functionWorkflowSourceVerificationSchema = exports.functionWorkflowSourceEvidenceRequestSchema = exports.functionWorkflowSourceClaimsSchema = exports.functionWorkflowHumanSourceClaimsSchema = exports.functionWorkflowManagedFunctionSourceClaimsSchema = exports.functionWorkflowSourceCaptureSchema = exports.functionWorkflowCompletedRunSchema = exports.functionWorkflowCompletedRunQuerySchema = exports.functionWorkflowSourceExecutionSchema = exports.functionWorkflowSourceRootSchema = exports.FUNCTION_WORKFLOW_EVIDENCE_PATH = exports.FUNCTION_WORKFLOW_CAPTURE_PATH = exports.FUNCTION_WORKFLOW_EVIDENCE_TOKEN_HEADER = exports.FUNCTION_WORKFLOW_TOKEN_HEADER = void 0;
4
+ const zod_1 = require("zod");
5
+ const agent_source_evidence_contract_1 = require("./agent-source-evidence-contract");
6
+ exports.FUNCTION_WORKFLOW_TOKEN_HEADER = 'x-sequence-workflow-service-token';
7
+ exports.FUNCTION_WORKFLOW_EVIDENCE_TOKEN_HEADER = 'x-sequence-workflow-evidence-token';
8
+ exports.FUNCTION_WORKFLOW_CAPTURE_PATH = '/api/managed-functions/workflows/capture';
9
+ exports.FUNCTION_WORKFLOW_EVIDENCE_PATH = '/api/managed-functions/workflows/evidence';
10
+ const id = zod_1.z.string().min(1).max(255).regex(/^[A-Za-z0-9._-]+$/);
11
+ const hash = zod_1.z.string().regex(/^[a-f0-9]{64}$/);
12
+ const identity = zod_1.z.strictObject({ id, version: id, definitionSha256: hash });
13
+ exports.functionWorkflowSourceRootSchema = zod_1.z.strictObject({
14
+ id, runId: id, identity,
15
+ branches: zod_1.z.array(zod_1.z.strictObject({
16
+ nodeId: id, nodeRunId: id, attempt: zod_1.z.number().int().positive(), agentId: id,
17
+ runId: id.nullable(), status: zod_1.z.enum(['completed', 'failed', 'cancelled', 'skipped']), identity,
18
+ completedAt: zod_1.z.iso.datetime({ offset: true }).nullable(),
19
+ }).refine((branch) => branch.agentId === branch.identity.id && (branch.status !== 'completed' || (branch.runId !== null && branch.completedAt !== null)), 'Completed branches require actual completed source records')).max(64),
20
+ }).refine((workflow) => workflow.id === workflow.identity.id, 'The workflow must match its private identity');
21
+ exports.functionWorkflowSourceExecutionSchema = zod_1.z.strictObject({
22
+ run: agent_source_evidence_contract_1.functionAgentSourceExecutionSchema.shape.run,
23
+ step: agent_source_evidence_contract_1.functionAgentSourceExecutionSchema.shape.step,
24
+ workflow: exports.functionWorkflowSourceRootSchema,
25
+ });
26
+ exports.functionWorkflowCompletedRunQuerySchema = zod_1.z.strictObject({ workflow: id, runId: id });
27
+ exports.functionWorkflowCompletedRunSchema = zod_1.z.strictObject({ workflow: id, runId: id, status: zod_1.z.literal('completed'), output: zod_1.z.json() });
28
+ exports.functionWorkflowSourceCaptureSchema = zod_1.z.strictObject({ response: exports.functionWorkflowCompletedRunSchema, responseHash: hash, sourceReceipt: zod_1.z.string().min(1).max(16_384) });
29
+ const receiver = zod_1.z.strictObject({ functionId: zod_1.z.uuid(), versionId: zod_1.z.uuid(), invocationId: zod_1.z.uuid(), serviceAccountId: zod_1.z.uuid(), org: zod_1.z.string().min(1).max(255) });
30
+ const sourceFields = {
31
+ environment: zod_1.z.string(), org: zod_1.z.string().min(1).max(255),
32
+ workflowId: id, runId: id, cutoffAt: zod_1.z.iso.datetime({ offset: true }), outputHash: hash, responseHash: hash,
33
+ jobAdmission: agent_source_evidence_contract_1.functionSourceJobAdmissionSchema.nullable(),
34
+ };
35
+ exports.functionWorkflowManagedFunctionSourceClaimsSchema = zod_1.z.strictObject({
36
+ sourceKind: zod_1.z.literal('managed_function'), projection: zod_1.z.literal('workflow-completed-v1'), audience: zod_1.z.literal('atlas-managed-function-workflow-source-evidence'),
37
+ ...sourceFields, actualServiceAccountSub: zod_1.z.string().min(1).max(512), sourceReceiver: receiver,
38
+ sourceExecution: exports.functionWorkflowSourceExecutionSchema,
39
+ }).refine((source) => source.actualServiceAccountSub === `service-account|${source.sourceReceiver.serviceAccountId}` && source.org === source.sourceReceiver.org && source.workflowId === source.sourceExecution.workflow.id && source.runId === source.sourceExecution.workflow.runId, 'The workflow source must match its actual identity and execution');
40
+ exports.functionWorkflowHumanSourceClaimsSchema = zod_1.z.strictObject({
41
+ ...sourceFields, sourceKind: zod_1.z.literal('human'), projection: zod_1.z.literal('workflow-completed-v1'), audience: zod_1.z.literal('atlas-workflow-source-evidence'),
42
+ actualUserSub: zod_1.z.string().min(1).max(512).refine((sub) => !sub.startsWith('service-account|'), 'Human workflow evidence requires an actual user'),
43
+ sourceExecution: zod_1.z.null(), workflowSource: exports.functionWorkflowSourceRootSchema,
44
+ }).refine((source) => source.workflowId === source.workflowSource.id && source.runId === source.workflowSource.runId && source.jobAdmission !== null, 'A standalone human workflow source requires its actual job admission');
45
+ exports.functionWorkflowSourceClaimsSchema = zod_1.z.discriminatedUnion('sourceKind', [exports.functionWorkflowManagedFunctionSourceClaimsSchema, exports.functionWorkflowHumanSourceClaimsSchema])
46
+ .refine((source) => source.jobAdmission === null || (source.jobAdmission.kind === 'workflow' && source.jobAdmission.runId === source.runId && source.jobAdmission.resourceId === source.workflowId && (source.sourceKind === 'human' || source.jobAdmission.actorSub === source.actualServiceAccountSub)), 'The job admission must match the workflow source');
47
+ exports.functionWorkflowSourceEvidenceRequestSchema = exports.functionWorkflowCompletedRunQuerySchema.extend({ operation: zod_1.z.literal('verifySourceEvidence'), response: exports.functionWorkflowCompletedRunSchema, responseHash: hash, sourceReceipt: zod_1.z.string().min(1).max(16_384) });
48
+ exports.functionWorkflowSourceVerificationSchema = zod_1.z.strictObject({ source: exports.functionWorkflowSourceClaimsSchema, receiver });
49
+ class FunctionWorkflowReadError extends Error {
50
+ status;
51
+ code;
52
+ name = 'FunctionWorkflowReadError';
53
+ constructor(status, code, message) {
54
+ super(message);
55
+ this.status = status;
56
+ this.code = code;
57
+ }
58
+ }
59
+ exports.FunctionWorkflowReadError = FunctionWorkflowReadError;
@@ -0,0 +1,12 @@
1
+ import type { FunctionServiceAgentsOptions } from './agents';
2
+ import { type FunctionWorkflowCompletedRunQuery, type FunctionWorkflowSourceCapture, type FunctionWorkflowSourceEvidenceRequest, type FunctionWorkflowSourceVerification } from './workflow-source-contract';
3
+ export type FunctionServiceWorkflowsOptions = FunctionServiceAgentsOptions;
4
+ export interface FunctionServiceWorkflowsClient {
5
+ captureCompletedRun(query: FunctionWorkflowCompletedRunQuery): Promise<FunctionWorkflowSourceCapture>;
6
+ }
7
+ export type FunctionWorkflowSourceEvidenceInput = Omit<FunctionWorkflowSourceEvidenceRequest, 'operation'>;
8
+ export interface FunctionWorkflowEvidenceClient {
9
+ verifySourceEvidence(input: FunctionWorkflowSourceEvidenceInput): Promise<FunctionWorkflowSourceVerification>;
10
+ }
11
+ export declare function createFunctionServiceWorkflowsClient(options: FunctionServiceWorkflowsOptions): FunctionServiceWorkflowsClient;
12
+ export declare function createFunctionWorkflowEvidenceClient(options: FunctionServiceWorkflowsOptions): FunctionWorkflowEvidenceClient;