@mokei/host-protocol 0.14.0 → 0.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"flow-schemas.d.ts","sourceRoot":"","sources":["../src/flow-schemas.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAU,MAAM,eAAe,CAAA;AAGvD,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAWlB,CAAA;AAIV,eAAO,MAAM,gBAAgB;;;cADE,MAAM;;CAIV,CAAA;AAE3B,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkCT,CAAA;AAC3B,MAAM,MAAM,iBAAiB,GAAG,UAAU,CAAC,OAAO,uBAAuB,CAAC,CAAA;AAE1E,eAAO,MAAM,cAAc;;;CAWA,CAAA;AAS3B,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0BA/DH,MAAM;;;;;;;kCAAN,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkGV,CAAA;AAC3B,MAAM,MAAM,eAAe,GAAG,UAAU,CAAC,OAAO,qBAAqB,CAAC,CAAA;AAEtE,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0BArGG,MAAM;;;;;;;;;;CAoIV,CAAA;AAC3B,MAAM,MAAM,SAAS,GAAG,UAAU,CAAC,OAAO,eAAe,CAAC,CAAA;AAE1D,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sBAvIC,MAAM;;;;;;;;;;;;;;;;;;CAoJV,CAAA;AAC3B,MAAM,MAAM,WAAW,GAAG,UAAU,CAAC,OAAO,iBAAiB,CAAC,CAAA;AAE9D,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAWD,CAAA;AAC3B,MAAM,MAAM,SAAS,GAAG,UAAU,CAAC,OAAO,eAAe,CAAC,CAAA;AAE1D,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0BArKH,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8LV,CAAA;AAC3B,MAAM,MAAM,eAAe,GAAG,UAAU,CAAC,OAAO,qBAAqB,CAAC,CAAA;AAEtE,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sBAjME,MAAM;;;;;;;;;;;;;;;;;kCAAN,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuPV,CAAA;AAC3B,MAAM,MAAM,UAAU,GAAG,UAAU,CAAC,OAAO,gBAAgB,CAAC,CAAA;AAE5D,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sBA1PG,MAAM;;;;;;CAwQV,CAAA;AAC3B,MAAM,MAAM,SAAS,GAAG,UAAU,CAAC,OAAO,eAAe,CAAC,CAAA"}
@@ -0,0 +1,541 @@
1
+ // Every wire schema carries this definition so nested JSON references resolve at its root.
2
+ export const jsonDefinitions = {
3
+ json: {
4
+ anyOf: [
5
+ {
6
+ type: 'string'
7
+ },
8
+ {
9
+ type: 'number'
10
+ },
11
+ {
12
+ type: 'boolean'
13
+ },
14
+ {
15
+ type: 'null'
16
+ },
17
+ {
18
+ type: 'array',
19
+ items: {
20
+ $ref: '#/definitions/json'
21
+ }
22
+ },
23
+ {
24
+ type: 'object',
25
+ additionalProperties: {
26
+ $ref: '#/definitions/json'
27
+ }
28
+ }
29
+ ]
30
+ }
31
+ };
32
+ // Widen recursive values for inference while retaining recursive validation on the wire.
33
+ const jsonValueSchema = {
34
+ $ref: '#/definitions/json'
35
+ };
36
+ export const jsonObjectSchema = {
37
+ type: 'object',
38
+ additionalProperties: jsonValueSchema
39
+ };
40
+ export const flowServiceStatusSchema = {
41
+ anyOf: [
42
+ {
43
+ type: 'object',
44
+ properties: {
45
+ state: {
46
+ const: 'starting',
47
+ type: 'string'
48
+ }
49
+ },
50
+ required: [
51
+ 'state'
52
+ ],
53
+ additionalProperties: false
54
+ },
55
+ {
56
+ type: 'object',
57
+ properties: {
58
+ state: {
59
+ const: 'ready',
60
+ type: 'string'
61
+ }
62
+ },
63
+ required: [
64
+ 'state'
65
+ ],
66
+ additionalProperties: false
67
+ },
68
+ {
69
+ type: 'object',
70
+ properties: {
71
+ state: {
72
+ const: 'failed',
73
+ type: 'string'
74
+ },
75
+ error: {
76
+ type: 'object',
77
+ properties: {
78
+ type: {
79
+ type: 'string'
80
+ },
81
+ message: {
82
+ type: 'string'
83
+ },
84
+ path: {
85
+ type: 'string'
86
+ },
87
+ issues: {
88
+ type: 'array',
89
+ items: {
90
+ type: 'string'
91
+ }
92
+ }
93
+ },
94
+ required: [
95
+ 'type',
96
+ 'message'
97
+ ],
98
+ additionalProperties: false
99
+ }
100
+ },
101
+ required: [
102
+ 'state',
103
+ 'error'
104
+ ],
105
+ additionalProperties: false
106
+ }
107
+ ]
108
+ };
109
+ export const runStateSchema = {
110
+ type: 'string',
111
+ enum: [
112
+ 'awaiting_approval',
113
+ 'denied',
114
+ 'working',
115
+ 'input_required',
116
+ 'completed',
117
+ 'failed',
118
+ 'cancelled'
119
+ ]
120
+ };
121
+ const runPlanSchema = {
122
+ type: 'object',
123
+ properties: {
124
+ tools: {
125
+ type: 'array',
126
+ items: {
127
+ type: 'string'
128
+ }
129
+ }
130
+ },
131
+ required: [
132
+ 'tools'
133
+ ],
134
+ additionalProperties: false
135
+ };
136
+ export const flowRunSnapshotSchema = {
137
+ definitions: jsonDefinitions,
138
+ type: 'object',
139
+ properties: {
140
+ runID: {
141
+ type: 'string'
142
+ },
143
+ flowID: {
144
+ type: 'string'
145
+ },
146
+ label: {
147
+ type: 'string'
148
+ },
149
+ state: runStateSchema,
150
+ createdAt: {
151
+ type: 'number'
152
+ },
153
+ updatedAt: {
154
+ type: 'number'
155
+ },
156
+ traceID: {
157
+ type: 'string'
158
+ },
159
+ plan: runPlanSchema,
160
+ result: {
161
+ type: 'object',
162
+ properties: {
163
+ outcome: {
164
+ type: 'string'
165
+ },
166
+ output: jsonValueSchema,
167
+ content: {
168
+ type: 'array',
169
+ items: jsonObjectSchema
170
+ }
171
+ },
172
+ required: [
173
+ 'content'
174
+ ],
175
+ additionalProperties: false
176
+ },
177
+ error: {
178
+ type: 'object',
179
+ properties: {
180
+ type: {
181
+ type: 'string'
182
+ },
183
+ message: {
184
+ type: 'string'
185
+ },
186
+ code: {
187
+ type: 'string'
188
+ }
189
+ },
190
+ required: [
191
+ 'type',
192
+ 'message'
193
+ ],
194
+ additionalProperties: false
195
+ }
196
+ },
197
+ required: [
198
+ 'runID',
199
+ 'label',
200
+ 'state',
201
+ 'createdAt',
202
+ 'updatedAt',
203
+ 'plan'
204
+ ],
205
+ additionalProperties: false
206
+ };
207
+ export const inboxItemSchema = {
208
+ type: 'object',
209
+ definitions: jsonDefinitions,
210
+ anyOf: [
211
+ {
212
+ type: 'object',
213
+ properties: {
214
+ id: {
215
+ type: 'string'
216
+ },
217
+ runID: {
218
+ type: 'string'
219
+ },
220
+ kind: {
221
+ type: 'string',
222
+ const: 'approval'
223
+ },
224
+ plan: runPlanSchema,
225
+ createdAt: {
226
+ type: 'number'
227
+ }
228
+ },
229
+ required: [
230
+ 'id',
231
+ 'runID',
232
+ 'kind',
233
+ 'plan',
234
+ 'createdAt'
235
+ ],
236
+ additionalProperties: false
237
+ },
238
+ {
239
+ type: 'object',
240
+ properties: {
241
+ id: {
242
+ type: 'string'
243
+ },
244
+ runID: {
245
+ type: 'string'
246
+ },
247
+ kind: {
248
+ type: 'string',
249
+ const: 'input'
250
+ },
251
+ inputKey: {
252
+ type: 'string'
253
+ },
254
+ message: {
255
+ type: 'string'
256
+ },
257
+ requestedSchema: jsonObjectSchema,
258
+ createdAt: {
259
+ type: 'number'
260
+ }
261
+ },
262
+ required: [
263
+ 'id',
264
+ 'runID',
265
+ 'kind',
266
+ 'inputKey',
267
+ 'message',
268
+ 'requestedSchema',
269
+ 'createdAt'
270
+ ],
271
+ additionalProperties: false
272
+ }
273
+ ]
274
+ };
275
+ export const flowSummarySchema = {
276
+ definitions: jsonDefinitions,
277
+ type: 'object',
278
+ properties: {
279
+ id: {
280
+ type: 'string'
281
+ },
282
+ name: {
283
+ type: 'string'
284
+ },
285
+ version: {
286
+ type: 'number'
287
+ },
288
+ input: jsonObjectSchema,
289
+ outputs: {
290
+ type: 'array',
291
+ items: {
292
+ type: 'string'
293
+ }
294
+ },
295
+ outcomes: {
296
+ type: 'array',
297
+ items: {
298
+ type: 'string'
299
+ }
300
+ }
301
+ },
302
+ required: [
303
+ 'id',
304
+ 'name',
305
+ 'version',
306
+ 'input',
307
+ 'outputs',
308
+ 'outcomes'
309
+ ],
310
+ additionalProperties: false
311
+ };
312
+ export const flowIssueSchema = {
313
+ type: 'object',
314
+ properties: {
315
+ path: {
316
+ type: 'array',
317
+ items: {
318
+ anyOf: [
319
+ {
320
+ type: 'string'
321
+ },
322
+ {
323
+ type: 'number'
324
+ }
325
+ ]
326
+ }
327
+ },
328
+ severity: {
329
+ type: 'string',
330
+ enum: [
331
+ 'error',
332
+ 'warning'
333
+ ]
334
+ },
335
+ code: {
336
+ type: 'string'
337
+ },
338
+ message: {
339
+ type: 'string'
340
+ },
341
+ hint: {
342
+ type: 'string'
343
+ }
344
+ },
345
+ required: [
346
+ 'path',
347
+ 'severity',
348
+ 'code',
349
+ 'message'
350
+ ],
351
+ additionalProperties: false
352
+ };
353
+ export const flowCheckResultSchema = {
354
+ type: 'object',
355
+ definitions: jsonDefinitions,
356
+ anyOf: [
357
+ {
358
+ type: 'object',
359
+ properties: {
360
+ value: jsonObjectSchema,
361
+ warnings: {
362
+ type: 'array',
363
+ items: flowIssueSchema
364
+ },
365
+ formatted: {
366
+ type: 'string'
367
+ }
368
+ },
369
+ required: [
370
+ 'value',
371
+ 'warnings',
372
+ 'formatted'
373
+ ],
374
+ additionalProperties: false
375
+ },
376
+ {
377
+ type: 'object',
378
+ properties: {
379
+ issues: {
380
+ type: 'array',
381
+ items: flowIssueSchema
382
+ },
383
+ warnings: {
384
+ type: 'array',
385
+ items: flowIssueSchema
386
+ },
387
+ formatted: {
388
+ type: 'string'
389
+ }
390
+ },
391
+ required: [
392
+ 'issues',
393
+ 'warnings',
394
+ 'formatted'
395
+ ],
396
+ additionalProperties: false
397
+ }
398
+ ]
399
+ };
400
+ export const storedSpanSchema = {
401
+ definitions: jsonDefinitions,
402
+ type: 'object',
403
+ properties: {
404
+ traceID: {
405
+ type: 'string'
406
+ },
407
+ spanID: {
408
+ type: 'string'
409
+ },
410
+ parentSpanID: {
411
+ type: 'string'
412
+ },
413
+ name: {
414
+ type: 'string'
415
+ },
416
+ kind: {
417
+ type: 'number'
418
+ },
419
+ startTime: {
420
+ type: 'number'
421
+ },
422
+ endTime: {
423
+ type: 'number'
424
+ },
425
+ status: {
426
+ type: 'object',
427
+ properties: {
428
+ code: {
429
+ type: 'number'
430
+ },
431
+ message: {
432
+ type: 'string'
433
+ }
434
+ },
435
+ required: [
436
+ 'code'
437
+ ],
438
+ additionalProperties: false
439
+ },
440
+ attributes: jsonObjectSchema,
441
+ events: {
442
+ type: 'array',
443
+ items: {
444
+ type: 'object',
445
+ properties: {
446
+ name: {
447
+ type: 'string'
448
+ },
449
+ time: {
450
+ type: 'number'
451
+ },
452
+ attributes: jsonObjectSchema
453
+ },
454
+ required: [
455
+ 'name',
456
+ 'time',
457
+ 'attributes'
458
+ ],
459
+ additionalProperties: false
460
+ }
461
+ },
462
+ links: {
463
+ type: 'array',
464
+ items: {
465
+ type: 'object',
466
+ properties: {
467
+ traceID: {
468
+ type: 'string'
469
+ },
470
+ spanID: {
471
+ type: 'string'
472
+ }
473
+ },
474
+ required: [
475
+ 'traceID',
476
+ 'spanID'
477
+ ],
478
+ additionalProperties: false
479
+ }
480
+ }
481
+ },
482
+ required: [
483
+ 'traceID',
484
+ 'spanID',
485
+ 'name',
486
+ 'kind',
487
+ 'startTime',
488
+ 'endTime',
489
+ 'status',
490
+ 'attributes',
491
+ 'events',
492
+ 'links'
493
+ ],
494
+ additionalProperties: false
495
+ };
496
+ export const storedLogSchema = {
497
+ definitions: jsonDefinitions,
498
+ type: 'object',
499
+ properties: {
500
+ traceID: {
501
+ type: 'string'
502
+ },
503
+ spanID: {
504
+ type: 'string'
505
+ },
506
+ timestamp: {
507
+ type: 'number'
508
+ },
509
+ level: {
510
+ type: 'string',
511
+ enum: [
512
+ 'trace',
513
+ 'debug',
514
+ 'info',
515
+ 'warning',
516
+ 'error',
517
+ 'fatal'
518
+ ]
519
+ },
520
+ category: {
521
+ type: 'array',
522
+ items: {
523
+ type: 'string'
524
+ }
525
+ },
526
+ message: {
527
+ type: 'string'
528
+ },
529
+ properties: jsonObjectSchema
530
+ },
531
+ required: [
532
+ 'traceID',
533
+ 'spanID',
534
+ 'timestamp',
535
+ 'level',
536
+ 'category',
537
+ 'message',
538
+ 'properties'
539
+ ],
540
+ additionalProperties: false
541
+ };