@runnee/sdk 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,1391 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.contracts = void 0;
4
+ // Generated public schemas only. No interpreter.
5
+ exports.contracts = {
6
+ schemas: {
7
+ Error: {
8
+ type: 'object',
9
+ properties: {
10
+ statusCode: {
11
+ type: 'integer',
12
+ },
13
+ message: {
14
+ anyOf: [
15
+ {
16
+ type: 'string',
17
+ },
18
+ {
19
+ type: 'array',
20
+ items: {
21
+ type: 'string',
22
+ },
23
+ },
24
+ ],
25
+ },
26
+ error: {
27
+ type: 'string',
28
+ },
29
+ code: {
30
+ type: 'string',
31
+ },
32
+ },
33
+ required: [],
34
+ additionalProperties: true,
35
+ },
36
+ ExecuteRequest: {
37
+ type: 'object',
38
+ properties: {
39
+ code: {
40
+ type: 'string',
41
+ minLength: 1,
42
+ maxLength: 6000,
43
+ },
44
+ mode: {
45
+ type: 'string',
46
+ enum: ['dry-run', 'live'],
47
+ },
48
+ event: {
49
+ type: 'object',
50
+ additionalProperties: true,
51
+ description: 'JSON execution input, at most 8 KiB encoded. Available as ctx.input.',
52
+ },
53
+ retainSource: {
54
+ type: 'boolean',
55
+ },
56
+ scriptName: {
57
+ type: 'string',
58
+ maxLength: 80,
59
+ },
60
+ secretNames: {
61
+ type: 'array',
62
+ items: {
63
+ type: 'string',
64
+ pattern: '^[A-Z][A-Z0-9_]{0,63}$',
65
+ },
66
+ maxItems: 16,
67
+ uniqueItems: true,
68
+ description: 'Explicit secret grant; requires secrets:use in addition to scripts:execute. Policies are enforced server-side.',
69
+ },
70
+ scriptId: {
71
+ type: 'string',
72
+ format: 'uuid',
73
+ },
74
+ },
75
+ required: ['code'],
76
+ additionalProperties: false,
77
+ },
78
+ Diagnostic: {
79
+ type: 'object',
80
+ properties: {
81
+ code: {
82
+ type: 'string',
83
+ },
84
+ message: {
85
+ type: 'string',
86
+ },
87
+ line: {
88
+ type: 'integer',
89
+ },
90
+ column: {
91
+ type: 'integer',
92
+ },
93
+ filename: {
94
+ type: 'string',
95
+ },
96
+ snippet: {
97
+ type: 'string',
98
+ },
99
+ },
100
+ required: ['message'],
101
+ additionalProperties: true,
102
+ },
103
+ Timings: {
104
+ type: 'object',
105
+ additionalProperties: {
106
+ type: 'number',
107
+ },
108
+ },
109
+ ExecutionResult: {
110
+ type: 'object',
111
+ properties: {
112
+ durationMs: {
113
+ type: 'number',
114
+ },
115
+ instructions: {
116
+ type: 'integer',
117
+ },
118
+ returnValue: {},
119
+ replies: {
120
+ type: 'object',
121
+ properties: {
122
+ count: {
123
+ type: 'integer',
124
+ },
125
+ lastPayload: {},
126
+ },
127
+ required: ['count'],
128
+ additionalProperties: false,
129
+ },
130
+ counters: {
131
+ type: 'object',
132
+ properties: {
133
+ dbOps: {
134
+ type: 'integer',
135
+ },
136
+ httpCalls: {
137
+ type: 'integer',
138
+ },
139
+ },
140
+ required: ['dbOps', 'httpCalls'],
141
+ additionalProperties: false,
142
+ },
143
+ explain: {
144
+ type: 'object',
145
+ additionalProperties: true,
146
+ description: 'JSON execution input, at most 8 KiB encoded. Available as ctx.input.',
147
+ },
148
+ },
149
+ required: ['durationMs', 'instructions', 'replies'],
150
+ additionalProperties: false,
151
+ },
152
+ ExecuteResponse: {
153
+ type: 'object',
154
+ properties: {
155
+ success: {
156
+ type: 'boolean',
157
+ },
158
+ mocked: {
159
+ type: 'boolean',
160
+ },
161
+ error: {
162
+ $ref: '#/components/schemas/Diagnostic',
163
+ },
164
+ executionResult: {
165
+ $ref: '#/components/schemas/ExecutionResult',
166
+ },
167
+ replies: {
168
+ type: 'array',
169
+ items: {},
170
+ },
171
+ metrics: {
172
+ type: 'object',
173
+ additionalProperties: true,
174
+ description: 'JSON execution input, at most 8 KiB encoded. Available as ctx.input.',
175
+ },
176
+ telemetryRecorded: {
177
+ type: 'boolean',
178
+ },
179
+ executionId: {
180
+ anyOf: [
181
+ {
182
+ type: 'string',
183
+ },
184
+ {
185
+ type: 'null',
186
+ },
187
+ ],
188
+ },
189
+ replayed: {
190
+ type: 'boolean',
191
+ },
192
+ originalResultOmitted: {
193
+ type: 'boolean',
194
+ },
195
+ },
196
+ required: ['success'],
197
+ additionalProperties: true,
198
+ },
199
+ Policy: {
200
+ type: 'object',
201
+ additionalProperties: true,
202
+ description: 'JSON execution input, at most 8 KiB encoded. Available as ctx.input.',
203
+ },
204
+ Execution: {
205
+ type: 'object',
206
+ properties: {
207
+ id: {
208
+ type: 'string',
209
+ },
210
+ scriptName: {
211
+ anyOf: [
212
+ {
213
+ type: 'string',
214
+ },
215
+ {
216
+ type: 'null',
217
+ },
218
+ ],
219
+ },
220
+ mode: {
221
+ type: 'string',
222
+ },
223
+ status: {
224
+ type: 'string',
225
+ },
226
+ durationMs: {
227
+ type: 'number',
228
+ },
229
+ instructionsUsed: {
230
+ type: 'integer',
231
+ },
232
+ errorCode: {
233
+ anyOf: [
234
+ {
235
+ type: 'string',
236
+ },
237
+ {
238
+ type: 'null',
239
+ },
240
+ ],
241
+ },
242
+ httpCalls: {
243
+ type: 'integer',
244
+ },
245
+ dbOps: {
246
+ type: 'integer',
247
+ },
248
+ errorMessage: {
249
+ anyOf: [
250
+ {
251
+ type: 'string',
252
+ },
253
+ {
254
+ type: 'null',
255
+ },
256
+ ],
257
+ },
258
+ hasSource: {
259
+ type: 'boolean',
260
+ },
261
+ timings: {
262
+ $ref: '#/components/schemas/Timings',
263
+ },
264
+ createdAt: {
265
+ type: 'string',
266
+ format: 'date-time',
267
+ },
268
+ expiresAt: {
269
+ type: 'string',
270
+ format: 'date-time',
271
+ },
272
+ },
273
+ required: ['id', 'mode', 'status', 'durationMs', 'instructionsUsed', 'createdAt'],
274
+ additionalProperties: true,
275
+ },
276
+ ExecutionDetail: {
277
+ type: 'object',
278
+ properties: {
279
+ id: {
280
+ type: 'string',
281
+ },
282
+ scriptName: {
283
+ anyOf: [
284
+ {
285
+ type: 'string',
286
+ },
287
+ {
288
+ type: 'null',
289
+ },
290
+ ],
291
+ },
292
+ mode: {
293
+ type: 'string',
294
+ },
295
+ status: {
296
+ type: 'string',
297
+ },
298
+ durationMs: {
299
+ type: 'number',
300
+ },
301
+ instructionsUsed: {
302
+ type: 'integer',
303
+ },
304
+ errorCode: {
305
+ anyOf: [
306
+ {
307
+ type: 'string',
308
+ },
309
+ {
310
+ type: 'null',
311
+ },
312
+ ],
313
+ },
314
+ httpCalls: {
315
+ type: 'integer',
316
+ },
317
+ dbOps: {
318
+ type: 'integer',
319
+ },
320
+ errorMessage: {
321
+ anyOf: [
322
+ {
323
+ type: 'string',
324
+ },
325
+ {
326
+ type: 'null',
327
+ },
328
+ ],
329
+ },
330
+ hasSource: {
331
+ type: 'boolean',
332
+ },
333
+ timings: {
334
+ $ref: '#/components/schemas/Timings',
335
+ },
336
+ createdAt: {
337
+ type: 'string',
338
+ format: 'date-time',
339
+ },
340
+ expiresAt: {
341
+ type: 'string',
342
+ format: 'date-time',
343
+ },
344
+ sourceCode: {
345
+ anyOf: [
346
+ {
347
+ type: 'string',
348
+ },
349
+ {
350
+ type: 'null',
351
+ },
352
+ ],
353
+ },
354
+ outputPreview: {
355
+ anyOf: [
356
+ {
357
+ type: 'string',
358
+ },
359
+ {
360
+ type: 'null',
361
+ },
362
+ ],
363
+ },
364
+ },
365
+ required: ['id', 'mode', 'status', 'durationMs', 'instructionsUsed', 'createdAt'],
366
+ additionalProperties: true,
367
+ },
368
+ ExecutionPage: {
369
+ type: 'object',
370
+ properties: {
371
+ items: {
372
+ type: 'array',
373
+ items: {
374
+ $ref: '#/components/schemas/Execution',
375
+ },
376
+ },
377
+ nextCursor: {
378
+ anyOf: [
379
+ {
380
+ type: 'string',
381
+ },
382
+ {
383
+ type: 'null',
384
+ },
385
+ ],
386
+ },
387
+ policy: {
388
+ $ref: '#/components/schemas/Policy',
389
+ },
390
+ },
391
+ required: ['items', 'nextCursor', 'policy'],
392
+ additionalProperties: false,
393
+ },
394
+ Script: {
395
+ type: 'object',
396
+ properties: {
397
+ id: {
398
+ type: 'string',
399
+ format: 'uuid',
400
+ },
401
+ name: {
402
+ type: 'string',
403
+ },
404
+ currentVersion: {
405
+ type: 'integer',
406
+ },
407
+ createdAt: {
408
+ type: 'string',
409
+ format: 'date-time',
410
+ },
411
+ updatedAt: {
412
+ type: 'string',
413
+ format: 'date-time',
414
+ },
415
+ },
416
+ required: ['id', 'name', 'currentVersion', 'createdAt', 'updatedAt'],
417
+ additionalProperties: false,
418
+ },
419
+ ScriptDetail: {
420
+ type: 'object',
421
+ properties: {
422
+ id: {
423
+ type: 'string',
424
+ format: 'uuid',
425
+ },
426
+ name: {
427
+ type: 'string',
428
+ },
429
+ currentVersion: {
430
+ type: 'integer',
431
+ },
432
+ createdAt: {
433
+ type: 'string',
434
+ format: 'date-time',
435
+ },
436
+ updatedAt: {
437
+ type: 'string',
438
+ format: 'date-time',
439
+ },
440
+ code: {
441
+ type: 'string',
442
+ },
443
+ versions: {
444
+ type: 'array',
445
+ items: {
446
+ type: 'object',
447
+ properties: {
448
+ version: {
449
+ type: 'integer',
450
+ },
451
+ createdAt: {
452
+ type: 'string',
453
+ format: 'date-time',
454
+ },
455
+ bytes: {
456
+ type: 'integer',
457
+ },
458
+ },
459
+ required: ['version', 'createdAt', 'bytes'],
460
+ additionalProperties: false,
461
+ },
462
+ },
463
+ },
464
+ required: ['id', 'name', 'currentVersion', 'createdAt', 'updatedAt', 'code', 'versions'],
465
+ additionalProperties: true,
466
+ },
467
+ ScriptList: {
468
+ type: 'object',
469
+ properties: {
470
+ items: {
471
+ type: 'array',
472
+ items: {
473
+ $ref: '#/components/schemas/Script',
474
+ },
475
+ },
476
+ policy: {
477
+ $ref: '#/components/schemas/Policy',
478
+ },
479
+ },
480
+ required: ['items', 'policy'],
481
+ additionalProperties: false,
482
+ },
483
+ ScriptCreate: {
484
+ type: 'object',
485
+ properties: {
486
+ name: {
487
+ type: 'string',
488
+ minLength: 1,
489
+ maxLength: 80,
490
+ pattern: '\\S',
491
+ },
492
+ code: {
493
+ type: 'string',
494
+ minLength: 1,
495
+ maxLength: 6000,
496
+ },
497
+ },
498
+ required: ['name', 'code'],
499
+ additionalProperties: false,
500
+ },
501
+ ScriptUpdate: {
502
+ type: 'object',
503
+ properties: {
504
+ name: {
505
+ type: 'string',
506
+ minLength: 1,
507
+ maxLength: 80,
508
+ pattern: '\\S',
509
+ },
510
+ code: {
511
+ type: 'string',
512
+ minLength: 1,
513
+ maxLength: 6000,
514
+ },
515
+ expectedVersion: {
516
+ type: 'integer',
517
+ minimum: 1,
518
+ maximum: 2147483646,
519
+ },
520
+ },
521
+ required: ['name', 'code', 'expectedVersion'],
522
+ additionalProperties: false,
523
+ },
524
+ ScriptRestore: {
525
+ type: 'object',
526
+ properties: {
527
+ version: {
528
+ type: 'integer',
529
+ minimum: 1,
530
+ maximum: 2147483646,
531
+ },
532
+ expectedVersion: {
533
+ type: 'integer',
534
+ minimum: 1,
535
+ maximum: 2147483646,
536
+ },
537
+ },
538
+ required: ['version', 'expectedVersion'],
539
+ additionalProperties: false,
540
+ },
541
+ ScriptVersion: {
542
+ type: 'object',
543
+ properties: {
544
+ version: {
545
+ type: 'integer',
546
+ },
547
+ code: {
548
+ type: 'string',
549
+ },
550
+ createdAt: {
551
+ type: 'string',
552
+ format: 'date-time',
553
+ },
554
+ },
555
+ required: ['version', 'code', 'createdAt'],
556
+ additionalProperties: false,
557
+ },
558
+ Deleted: {
559
+ type: 'object',
560
+ properties: {
561
+ deleted: {
562
+ type: 'boolean',
563
+ },
564
+ },
565
+ required: ['deleted'],
566
+ additionalProperties: false,
567
+ },
568
+ Storage: {
569
+ type: 'object',
570
+ properties: {
571
+ policy: {
572
+ $ref: '#/components/schemas/Policy',
573
+ },
574
+ history: {
575
+ type: 'object',
576
+ properties: {
577
+ count: {
578
+ type: 'integer',
579
+ },
580
+ bytes: {
581
+ type: 'integer',
582
+ },
583
+ },
584
+ required: ['count', 'bytes'],
585
+ additionalProperties: false,
586
+ },
587
+ scripts: {
588
+ type: 'object',
589
+ properties: {
590
+ count: {
591
+ type: 'integer',
592
+ },
593
+ versions: {
594
+ type: 'integer',
595
+ },
596
+ bytes: {
597
+ type: 'integer',
598
+ },
599
+ },
600
+ required: ['count', 'versions', 'bytes'],
601
+ additionalProperties: false,
602
+ },
603
+ },
604
+ required: ['policy', 'history', 'scripts'],
605
+ additionalProperties: false,
606
+ },
607
+ Secret: {
608
+ type: 'object',
609
+ properties: {
610
+ name: {
611
+ type: 'string',
612
+ pattern: '^[A-Z][A-Z0-9_]{0,63}$',
613
+ },
614
+ allowInline: {
615
+ type: 'boolean',
616
+ },
617
+ scriptIds: {
618
+ type: 'array',
619
+ items: {
620
+ type: 'string',
621
+ format: 'uuid',
622
+ },
623
+ },
624
+ version: {
625
+ type: 'integer',
626
+ },
627
+ createdAt: {
628
+ type: 'string',
629
+ format: 'date-time',
630
+ },
631
+ updatedAt: {
632
+ type: 'string',
633
+ format: 'date-time',
634
+ },
635
+ },
636
+ required: ['name', 'allowInline', 'scriptIds', 'version', 'createdAt', 'updatedAt'],
637
+ additionalProperties: false,
638
+ },
639
+ SecretList: {
640
+ type: 'object',
641
+ properties: {
642
+ items: {
643
+ type: 'array',
644
+ items: {
645
+ $ref: '#/components/schemas/Secret',
646
+ },
647
+ },
648
+ },
649
+ required: ['items'],
650
+ additionalProperties: false,
651
+ },
652
+ SecretCreate: {
653
+ type: 'object',
654
+ properties: {
655
+ name: {
656
+ type: 'string',
657
+ pattern: '^[A-Z][A-Z0-9_]{0,63}$',
658
+ },
659
+ value: {
660
+ type: 'string',
661
+ minLength: 8,
662
+ maxLength: 4096,
663
+ writeOnly: true,
664
+ description: 'Write-only credential: 8–4096 UTF-8 bytes; never returned. No null characters or malformed Unicode.',
665
+ },
666
+ allowInline: {
667
+ type: 'boolean',
668
+ default: false,
669
+ },
670
+ scriptIds: {
671
+ type: 'array',
672
+ items: {
673
+ type: 'string',
674
+ format: 'uuid',
675
+ },
676
+ maxItems: 10,
677
+ uniqueItems: true,
678
+ },
679
+ },
680
+ required: ['name', 'value'],
681
+ additionalProperties: false,
682
+ },
683
+ SecretUpdate: {
684
+ type: 'object',
685
+ properties: {
686
+ value: {
687
+ type: 'string',
688
+ minLength: 8,
689
+ maxLength: 4096,
690
+ writeOnly: true,
691
+ description: 'Write-only credential: 8–4096 UTF-8 bytes; never returned. No null characters or malformed Unicode.',
692
+ },
693
+ allowInline: {
694
+ type: 'boolean',
695
+ },
696
+ scriptIds: {
697
+ type: 'array',
698
+ items: {
699
+ type: 'string',
700
+ format: 'uuid',
701
+ },
702
+ maxItems: 10,
703
+ uniqueItems: true,
704
+ },
705
+ },
706
+ required: [],
707
+ additionalProperties: false,
708
+ minProperties: 1,
709
+ },
710
+ SandboxLimits: {
711
+ type: 'object',
712
+ properties: {
713
+ timeoutMs: {
714
+ type: 'integer',
715
+ },
716
+ maxInstructions: {
717
+ type: 'integer',
718
+ },
719
+ maxMemoryMb: {
720
+ type: 'integer',
721
+ },
722
+ },
723
+ required: ['timeoutMs', 'maxInstructions', 'maxMemoryMb'],
724
+ additionalProperties: false,
725
+ },
726
+ Sandbox: {
727
+ type: 'object',
728
+ properties: {
729
+ plan: {
730
+ type: 'string',
731
+ },
732
+ configurable: {
733
+ type: 'boolean',
734
+ },
735
+ limits: {
736
+ $ref: '#/components/schemas/SandboxLimits',
737
+ },
738
+ defaults: {
739
+ $ref: '#/components/schemas/SandboxLimits',
740
+ },
741
+ maxLimits: {
742
+ $ref: '#/components/schemas/SandboxLimits',
743
+ },
744
+ },
745
+ required: ['plan', 'configurable', 'limits', 'defaults', 'maxLimits'],
746
+ additionalProperties: false,
747
+ },
748
+ Plan: {
749
+ type: 'object',
750
+ properties: {
751
+ id: {
752
+ type: 'string',
753
+ },
754
+ configurable: {
755
+ type: 'boolean',
756
+ },
757
+ limits: {
758
+ $ref: '#/components/schemas/SandboxLimits',
759
+ },
760
+ maxLimits: {
761
+ $ref: '#/components/schemas/SandboxLimits',
762
+ },
763
+ name: {
764
+ type: 'string',
765
+ },
766
+ monthlyUsd: {
767
+ anyOf: [
768
+ {
769
+ type: 'number',
770
+ },
771
+ {
772
+ type: 'null',
773
+ },
774
+ ],
775
+ },
776
+ yearlyMonthlyUsd: {
777
+ anyOf: [
778
+ {
779
+ type: 'number',
780
+ },
781
+ {
782
+ type: 'null',
783
+ },
784
+ ],
785
+ },
786
+ usageUsdPer1k: {
787
+ type: 'number',
788
+ },
789
+ executionsPerMonth: {
790
+ anyOf: [
791
+ {
792
+ type: 'integer',
793
+ },
794
+ {
795
+ type: 'null',
796
+ },
797
+ ],
798
+ },
799
+ timeoutMs: {
800
+ type: 'integer',
801
+ },
802
+ features: {
803
+ type: 'array',
804
+ items: {
805
+ type: 'string',
806
+ },
807
+ },
808
+ },
809
+ required: ['id', 'name', 'limits', 'executionsPerMonth'],
810
+ additionalProperties: true,
811
+ },
812
+ Plans: {
813
+ type: 'object',
814
+ properties: {
815
+ configured: {
816
+ type: 'boolean',
817
+ },
818
+ plans: {
819
+ type: 'array',
820
+ items: {
821
+ $ref: '#/components/schemas/Plan',
822
+ },
823
+ },
824
+ },
825
+ required: ['configured', 'plans'],
826
+ additionalProperties: false,
827
+ },
828
+ BillingStatus: {
829
+ type: 'object',
830
+ properties: {
831
+ configured: {
832
+ type: 'boolean',
833
+ },
834
+ plan: {
835
+ $ref: '#/components/schemas/Plan',
836
+ },
837
+ subscription: {
838
+ anyOf: [
839
+ {
840
+ type: 'object',
841
+ properties: {
842
+ status: {
843
+ type: 'string',
844
+ },
845
+ interval: {
846
+ anyOf: [
847
+ {
848
+ type: 'string',
849
+ },
850
+ {
851
+ type: 'null',
852
+ },
853
+ ],
854
+ },
855
+ currentPeriodEnd: {
856
+ anyOf: [
857
+ {
858
+ type: 'string',
859
+ format: 'date-time',
860
+ },
861
+ {
862
+ type: 'null',
863
+ },
864
+ ],
865
+ },
866
+ cancelAtPeriodEnd: {
867
+ type: 'boolean',
868
+ },
869
+ hasCustomer: {
870
+ type: 'boolean',
871
+ },
872
+ },
873
+ required: [],
874
+ additionalProperties: true,
875
+ },
876
+ {
877
+ type: 'null',
878
+ },
879
+ ],
880
+ },
881
+ usage: {
882
+ type: 'object',
883
+ properties: {
884
+ executions: {
885
+ type: 'integer',
886
+ },
887
+ limit: {
888
+ anyOf: [
889
+ {
890
+ type: 'integer',
891
+ },
892
+ {
893
+ type: 'null',
894
+ },
895
+ ],
896
+ },
897
+ resetsAt: {
898
+ type: 'string',
899
+ format: 'date-time',
900
+ },
901
+ },
902
+ required: ['executions', 'limit', 'resetsAt'],
903
+ additionalProperties: false,
904
+ },
905
+ },
906
+ required: ['configured', 'plan', 'subscription', 'usage'],
907
+ additionalProperties: false,
908
+ },
909
+ UsageSummary: {
910
+ type: 'object',
911
+ properties: {
912
+ windowDays: {
913
+ type: 'integer',
914
+ },
915
+ totalExecutions: {
916
+ type: 'integer',
917
+ },
918
+ successfulExecutions: {
919
+ type: 'integer',
920
+ },
921
+ failedExecutions: {
922
+ type: 'integer',
923
+ },
924
+ averageDurationMs: {
925
+ type: 'number',
926
+ },
927
+ latest: {
928
+ type: 'array',
929
+ items: {
930
+ type: 'object',
931
+ additionalProperties: true,
932
+ description: 'JSON execution input, at most 8 KiB encoded. Available as ctx.input.',
933
+ },
934
+ },
935
+ },
936
+ required: [
937
+ 'windowDays',
938
+ 'totalExecutions',
939
+ 'successfulExecutions',
940
+ 'failedExecutions',
941
+ 'averageDurationMs',
942
+ 'latest',
943
+ ],
944
+ additionalProperties: false,
945
+ },
946
+ UsageHistory: {
947
+ type: 'object',
948
+ properties: {
949
+ days: {
950
+ type: 'integer',
951
+ },
952
+ total: {
953
+ type: 'integer',
954
+ },
955
+ success: {
956
+ type: 'integer',
957
+ },
958
+ failed: {
959
+ type: 'integer',
960
+ },
961
+ successRate: {
962
+ type: 'number',
963
+ },
964
+ daily: {
965
+ type: 'array',
966
+ items: {
967
+ type: 'object',
968
+ properties: {
969
+ date: {
970
+ type: 'string',
971
+ },
972
+ total: {
973
+ type: 'integer',
974
+ },
975
+ success: {
976
+ type: 'integer',
977
+ },
978
+ failed: {
979
+ type: 'integer',
980
+ },
981
+ avgDurationMs: {
982
+ type: 'number',
983
+ },
984
+ },
985
+ required: ['date', 'total', 'success', 'failed', 'avgDurationMs'],
986
+ additionalProperties: false,
987
+ },
988
+ },
989
+ topScripts: {
990
+ type: 'array',
991
+ items: {
992
+ type: 'object',
993
+ properties: {
994
+ name: {
995
+ type: 'string',
996
+ },
997
+ count: {
998
+ type: 'integer',
999
+ },
1000
+ },
1001
+ required: ['name', 'count'],
1002
+ additionalProperties: false,
1003
+ },
1004
+ },
1005
+ topScriptsSample: {
1006
+ type: 'object',
1007
+ properties: {
1008
+ days: {
1009
+ type: 'integer',
1010
+ },
1011
+ limit: {
1012
+ type: 'integer',
1013
+ },
1014
+ },
1015
+ required: ['days', 'limit'],
1016
+ additionalProperties: false,
1017
+ },
1018
+ apiKeys: {
1019
+ type: 'object',
1020
+ properties: {
1021
+ active: {
1022
+ type: 'integer',
1023
+ },
1024
+ lastUsedAt: {
1025
+ anyOf: [
1026
+ {
1027
+ type: 'string',
1028
+ format: 'date-time',
1029
+ },
1030
+ {
1031
+ type: 'null',
1032
+ },
1033
+ ],
1034
+ },
1035
+ },
1036
+ required: ['active', 'lastUsedAt'],
1037
+ additionalProperties: false,
1038
+ },
1039
+ },
1040
+ required: [
1041
+ 'days',
1042
+ 'total',
1043
+ 'success',
1044
+ 'failed',
1045
+ 'successRate',
1046
+ 'daily',
1047
+ 'topScripts',
1048
+ 'topScriptsSample',
1049
+ 'apiKeys',
1050
+ ],
1051
+ additionalProperties: false,
1052
+ },
1053
+ TelemetryExecution: {
1054
+ type: 'object',
1055
+ properties: {
1056
+ scriptName: {
1057
+ type: 'string',
1058
+ maxLength: 200,
1059
+ },
1060
+ mode: {
1061
+ type: 'string',
1062
+ maxLength: 40,
1063
+ },
1064
+ status: {
1065
+ type: 'string',
1066
+ maxLength: 40,
1067
+ },
1068
+ durationMs: {
1069
+ type: 'integer',
1070
+ minimum: 0,
1071
+ maximum: 86400000,
1072
+ },
1073
+ instructionsUsed: {
1074
+ type: 'integer',
1075
+ minimum: 0,
1076
+ },
1077
+ memoryUsageKb: {
1078
+ type: 'integer',
1079
+ minimum: 0,
1080
+ },
1081
+ errorCode: {
1082
+ type: 'string',
1083
+ maxLength: 100,
1084
+ },
1085
+ metadata: {
1086
+ type: 'object',
1087
+ additionalProperties: true,
1088
+ description: 'JSON execution input, at most 8 KiB encoded. Available as ctx.input.',
1089
+ },
1090
+ },
1091
+ required: ['status', 'durationMs', 'instructionsUsed'],
1092
+ additionalProperties: false,
1093
+ },
1094
+ TelemetryEvent: {
1095
+ type: 'object',
1096
+ properties: {
1097
+ eventName: {
1098
+ type: 'string',
1099
+ maxLength: 80,
1100
+ },
1101
+ pagePath: {
1102
+ type: 'string',
1103
+ maxLength: 300,
1104
+ },
1105
+ sessionId: {
1106
+ type: 'string',
1107
+ maxLength: 100,
1108
+ },
1109
+ fingerprintHash: {
1110
+ type: 'string',
1111
+ maxLength: 128,
1112
+ },
1113
+ properties: {
1114
+ type: 'object',
1115
+ additionalProperties: {
1116
+ anyOf: [
1117
+ {
1118
+ type: 'string',
1119
+ },
1120
+ {
1121
+ type: 'number',
1122
+ },
1123
+ {
1124
+ type: 'boolean',
1125
+ },
1126
+ {
1127
+ type: 'null',
1128
+ },
1129
+ ],
1130
+ },
1131
+ },
1132
+ },
1133
+ required: ['eventName'],
1134
+ additionalProperties: false,
1135
+ },
1136
+ TelemetryRecorded: {
1137
+ anyOf: [
1138
+ {
1139
+ type: 'object',
1140
+ additionalProperties: true,
1141
+ description: 'JSON execution input, at most 8 KiB encoded. Available as ctx.input.',
1142
+ },
1143
+ {
1144
+ type: 'string',
1145
+ },
1146
+ {
1147
+ type: 'null',
1148
+ },
1149
+ ],
1150
+ },
1151
+ Accepted: {
1152
+ type: 'object',
1153
+ properties: {
1154
+ accepted: {
1155
+ type: 'boolean',
1156
+ },
1157
+ },
1158
+ required: ['accepted'],
1159
+ additionalProperties: false,
1160
+ },
1161
+ Health: {
1162
+ type: 'object',
1163
+ properties: {
1164
+ status: {
1165
+ type: 'string',
1166
+ enum: ['operational', 'degraded'],
1167
+ },
1168
+ timestamp: {
1169
+ type: 'string',
1170
+ format: 'date-time',
1171
+ },
1172
+ services: {
1173
+ type: 'array',
1174
+ items: {
1175
+ type: 'object',
1176
+ properties: {
1177
+ id: {
1178
+ type: 'string',
1179
+ },
1180
+ name: {
1181
+ type: 'string',
1182
+ },
1183
+ status: {
1184
+ type: 'string',
1185
+ enum: ['operational', 'degraded'],
1186
+ },
1187
+ },
1188
+ required: ['id', 'name', 'status'],
1189
+ additionalProperties: false,
1190
+ },
1191
+ },
1192
+ },
1193
+ required: ['status', 'timestamp', 'services'],
1194
+ additionalProperties: false,
1195
+ },
1196
+ },
1197
+ operations: [
1198
+ {
1199
+ id: 'execute',
1200
+ method: 'POST',
1201
+ path: '/api/runtime/execute',
1202
+ request: 'ExecuteRequest',
1203
+ response: 'ExecuteResponse',
1204
+ scope: 'scripts:execute',
1205
+ },
1206
+ {
1207
+ id: 'executions.list',
1208
+ method: 'GET',
1209
+ path: '/api/workspace/history',
1210
+ request: null,
1211
+ response: 'ExecutionPage',
1212
+ scope: 'executions:read',
1213
+ },
1214
+ {
1215
+ id: 'executions.get',
1216
+ method: 'GET',
1217
+ path: '/api/workspace/history/{id}',
1218
+ request: null,
1219
+ response: 'ExecutionDetail',
1220
+ scope: 'executions:read',
1221
+ },
1222
+ {
1223
+ id: 'scripts.list',
1224
+ method: 'GET',
1225
+ path: '/api/workspace/scripts',
1226
+ request: null,
1227
+ response: 'ScriptList',
1228
+ scope: 'scripts:read',
1229
+ },
1230
+ {
1231
+ id: 'scripts.create',
1232
+ method: 'POST',
1233
+ path: '/api/workspace/scripts',
1234
+ request: 'ScriptCreate',
1235
+ response: 'Script',
1236
+ scope: 'scripts:write',
1237
+ },
1238
+ {
1239
+ id: 'scripts.get',
1240
+ method: 'GET',
1241
+ path: '/api/workspace/scripts/{id}',
1242
+ request: null,
1243
+ response: 'ScriptDetail',
1244
+ scope: 'scripts:read',
1245
+ },
1246
+ {
1247
+ id: 'scripts.update',
1248
+ method: 'PATCH',
1249
+ path: '/api/workspace/scripts/{id}',
1250
+ request: 'ScriptUpdate',
1251
+ response: 'Script',
1252
+ scope: 'scripts:write',
1253
+ },
1254
+ {
1255
+ id: 'scripts.delete',
1256
+ method: 'DELETE',
1257
+ path: '/api/workspace/scripts/{id}',
1258
+ request: null,
1259
+ response: 'Deleted',
1260
+ scope: 'scripts:write',
1261
+ },
1262
+ {
1263
+ id: 'scripts.getVersion',
1264
+ method: 'GET',
1265
+ path: '/api/workspace/scripts/{id}/versions/{version}',
1266
+ request: null,
1267
+ response: 'ScriptVersion',
1268
+ scope: 'scripts:read',
1269
+ },
1270
+ {
1271
+ id: 'scripts.restore',
1272
+ method: 'POST',
1273
+ path: '/api/workspace/scripts/{id}/restore',
1274
+ request: 'ScriptRestore',
1275
+ response: 'Script',
1276
+ scope: 'scripts:write',
1277
+ },
1278
+ {
1279
+ id: 'scripts.storage',
1280
+ method: 'GET',
1281
+ path: '/api/workspace/storage',
1282
+ request: null,
1283
+ response: 'Storage',
1284
+ scope: 'scripts:read',
1285
+ },
1286
+ {
1287
+ id: 'secrets.list',
1288
+ method: 'GET',
1289
+ path: '/api/secrets',
1290
+ request: null,
1291
+ response: 'SecretList',
1292
+ scope: 'secrets:read',
1293
+ },
1294
+ {
1295
+ id: 'secrets.create',
1296
+ method: 'POST',
1297
+ path: '/api/secrets',
1298
+ request: 'SecretCreate',
1299
+ response: 'Secret',
1300
+ scope: 'secrets:write',
1301
+ },
1302
+ {
1303
+ id: 'secrets.get',
1304
+ method: 'GET',
1305
+ path: '/api/secrets/{name}',
1306
+ request: null,
1307
+ response: 'Secret',
1308
+ scope: 'secrets:read',
1309
+ },
1310
+ {
1311
+ id: 'secrets.update',
1312
+ method: 'PATCH',
1313
+ path: '/api/secrets/{name}',
1314
+ request: 'SecretUpdate',
1315
+ response: 'Secret',
1316
+ scope: 'secrets:write',
1317
+ },
1318
+ {
1319
+ id: 'secrets.delete',
1320
+ method: 'DELETE',
1321
+ path: '/api/secrets/{name}',
1322
+ request: null,
1323
+ response: 'Deleted',
1324
+ scope: 'secrets:write',
1325
+ },
1326
+ {
1327
+ id: 'usage.get',
1328
+ method: 'GET',
1329
+ path: '/api/billing/status',
1330
+ request: null,
1331
+ response: 'BillingStatus',
1332
+ scope: 'usage:read',
1333
+ },
1334
+ {
1335
+ id: 'usage.summary',
1336
+ method: 'GET',
1337
+ path: '/api/telemetry/summary',
1338
+ request: null,
1339
+ response: 'UsageSummary',
1340
+ scope: 'usage:read',
1341
+ },
1342
+ {
1343
+ id: 'usage.history',
1344
+ method: 'GET',
1345
+ path: '/api/telemetry/usage',
1346
+ request: null,
1347
+ response: 'UsageHistory',
1348
+ scope: 'usage:read',
1349
+ },
1350
+ {
1351
+ id: 'sandbox.get',
1352
+ method: 'GET',
1353
+ path: '/api/billing/sandbox',
1354
+ request: null,
1355
+ response: 'Sandbox',
1356
+ scope: 'scripts:read',
1357
+ },
1358
+ {
1359
+ id: 'billing.plans',
1360
+ method: 'GET',
1361
+ path: '/api/billing/plans',
1362
+ request: null,
1363
+ response: 'Plans',
1364
+ scope: null,
1365
+ },
1366
+ {
1367
+ id: 'telemetry.recordExecution',
1368
+ method: 'POST',
1369
+ path: '/api/telemetry/executions',
1370
+ request: 'TelemetryExecution',
1371
+ response: 'TelemetryRecorded',
1372
+ scope: 'telemetry:write',
1373
+ },
1374
+ {
1375
+ id: 'telemetry.recordEvent',
1376
+ method: 'POST',
1377
+ path: '/api/telemetry/events',
1378
+ request: 'TelemetryEvent',
1379
+ response: 'Accepted',
1380
+ scope: 'telemetry:write',
1381
+ },
1382
+ {
1383
+ id: 'health.get',
1384
+ method: 'GET',
1385
+ path: '/api/health',
1386
+ request: null,
1387
+ response: 'Health',
1388
+ scope: null,
1389
+ },
1390
+ ],
1391
+ };