@miao-ai/protocol 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,508 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "title": "Miao Runtime Protocol v1",
4
+ "oneOf": [
5
+ {
6
+ "type": "object",
7
+ "required": [
8
+ "type",
9
+ "protocol",
10
+ "requestId",
11
+ "operation",
12
+ "payload"
13
+ ],
14
+ "properties": {
15
+ "type": {
16
+ "const": "request"
17
+ },
18
+ "protocol": {
19
+ "const": "miao.runtime/v1"
20
+ },
21
+ "requestId": {
22
+ "type": "string",
23
+ "minLength": 1
24
+ },
25
+ "operation": {
26
+ "enum": [
27
+ "runtime.describe",
28
+ "apps.register",
29
+ "apps.list",
30
+ "agents.list",
31
+ "agents.launch",
32
+ "runs.start",
33
+ "runs.get",
34
+ "runs.pause",
35
+ "runs.resume",
36
+ "runs.cancel",
37
+ "runs.signal",
38
+ "events.subscribe",
39
+ "events.unsubscribe",
40
+ "approvals.list",
41
+ "approvals.decide",
42
+ "capabilities.register",
43
+ "capabilities.renew",
44
+ "capabilities.unregister",
45
+ "state.get",
46
+ "state.put",
47
+ "memory.list",
48
+ "memory.remember",
49
+ "memory.forget",
50
+ "artifacts.list",
51
+ "artifacts.get",
52
+ "scheduler.list",
53
+ "scheduler.create",
54
+ "scheduler.pause",
55
+ "scheduler.resume",
56
+ "scheduler.delete",
57
+ "scheduler.history",
58
+ "skills.list",
59
+ "skills.reload",
60
+ "mcp.list",
61
+ "mcp.reload",
62
+ "plugins.list",
63
+ "plugins.install",
64
+ "plugins.set_enabled",
65
+ "bindings.list",
66
+ "bindings.create",
67
+ "messages.deliver",
68
+ "delegations.create",
69
+ "gateway.serve",
70
+ "triggers.create",
71
+ "workbench.open"
72
+ ]
73
+ },
74
+ "payload": {}
75
+ },
76
+ "additionalProperties": true
77
+ },
78
+ {
79
+ "type": "object",
80
+ "required": [
81
+ "type",
82
+ "protocol",
83
+ "requestId",
84
+ "status"
85
+ ],
86
+ "properties": {
87
+ "type": {
88
+ "const": "response"
89
+ },
90
+ "protocol": {
91
+ "const": "miao.runtime/v1"
92
+ },
93
+ "requestId": {
94
+ "type": "string",
95
+ "minLength": 1
96
+ },
97
+ "status": {
98
+ "enum": [
99
+ "success",
100
+ "error"
101
+ ]
102
+ },
103
+ "result": {},
104
+ "error": {
105
+ "type": "object",
106
+ "required": [
107
+ "code",
108
+ "message",
109
+ "retryable"
110
+ ],
111
+ "properties": {
112
+ "code": {
113
+ "type": "string",
114
+ "minLength": 1
115
+ },
116
+ "message": {
117
+ "type": "string"
118
+ },
119
+ "retryable": {
120
+ "type": "boolean"
121
+ },
122
+ "runId": {
123
+ "type": "string",
124
+ "minLength": 1
125
+ },
126
+ "details": {}
127
+ },
128
+ "additionalProperties": true
129
+ }
130
+ },
131
+ "allOf": [
132
+ {
133
+ "if": {
134
+ "properties": {
135
+ "status": {
136
+ "const": "success"
137
+ }
138
+ }
139
+ },
140
+ "then": {
141
+ "required": [
142
+ "result"
143
+ ]
144
+ }
145
+ },
146
+ {
147
+ "if": {
148
+ "properties": {
149
+ "status": {
150
+ "const": "error"
151
+ }
152
+ }
153
+ },
154
+ "then": {
155
+ "required": [
156
+ "error"
157
+ ]
158
+ }
159
+ }
160
+ ],
161
+ "additionalProperties": true
162
+ },
163
+ {
164
+ "type": "object",
165
+ "required": [
166
+ "type",
167
+ "protocol",
168
+ "subscriptionId",
169
+ "sequence",
170
+ "event"
171
+ ],
172
+ "properties": {
173
+ "type": {
174
+ "const": "event"
175
+ },
176
+ "protocol": {
177
+ "const": "miao.runtime/v1"
178
+ },
179
+ "subscriptionId": {
180
+ "type": "string",
181
+ "minLength": 1
182
+ },
183
+ "sequence": {
184
+ "type": "integer",
185
+ "minimum": 0
186
+ },
187
+ "event": {
188
+ "type": "object",
189
+ "required": [
190
+ "type",
191
+ "payload"
192
+ ],
193
+ "properties": {
194
+ "type": {
195
+ "type": "string",
196
+ "minLength": 1
197
+ },
198
+ "runId": {
199
+ "type": "string",
200
+ "minLength": 1
201
+ },
202
+ "payload": {}
203
+ },
204
+ "additionalProperties": true
205
+ }
206
+ },
207
+ "additionalProperties": true
208
+ },
209
+ {
210
+ "type": "object",
211
+ "required": [
212
+ "type",
213
+ "protocol",
214
+ "callId",
215
+ "capability",
216
+ "input",
217
+ "deadlineMs",
218
+ "context"
219
+ ],
220
+ "properties": {
221
+ "type": {
222
+ "const": "host_call"
223
+ },
224
+ "protocol": {
225
+ "const": "miao.runtime/v1"
226
+ },
227
+ "callId": {
228
+ "type": "string",
229
+ "minLength": 1
230
+ },
231
+ "capability": {
232
+ "type": "string",
233
+ "minLength": 1
234
+ },
235
+ "input": {},
236
+ "deadlineMs": {
237
+ "type": "integer",
238
+ "minimum": 1
239
+ },
240
+ "context": {
241
+ "type": "object",
242
+ "required": [
243
+ "runId",
244
+ "principal",
245
+ "namespace"
246
+ ],
247
+ "properties": {
248
+ "runId": {
249
+ "type": "string",
250
+ "minLength": 1
251
+ },
252
+ "principal": {
253
+ "type": "string",
254
+ "minLength": 1
255
+ },
256
+ "namespace": {
257
+ "type": "string",
258
+ "minLength": 1
259
+ },
260
+ "traceId": {
261
+ "type": "string",
262
+ "minLength": 1
263
+ }
264
+ },
265
+ "additionalProperties": true
266
+ }
267
+ },
268
+ "additionalProperties": true
269
+ },
270
+ {
271
+ "type": "object",
272
+ "required": [
273
+ "type",
274
+ "protocol",
275
+ "callId",
276
+ "status"
277
+ ],
278
+ "properties": {
279
+ "type": {
280
+ "const": "host_result"
281
+ },
282
+ "protocol": {
283
+ "const": "miao.runtime/v1"
284
+ },
285
+ "callId": {
286
+ "type": "string",
287
+ "minLength": 1
288
+ },
289
+ "status": {
290
+ "enum": [
291
+ "success",
292
+ "error",
293
+ "cancelled"
294
+ ]
295
+ },
296
+ "output": {},
297
+ "error": {
298
+ "type": "object",
299
+ "required": [
300
+ "code",
301
+ "message",
302
+ "retryable"
303
+ ],
304
+ "properties": {
305
+ "code": {
306
+ "type": "string",
307
+ "minLength": 1
308
+ },
309
+ "message": {
310
+ "type": "string"
311
+ },
312
+ "retryable": {
313
+ "type": "boolean"
314
+ },
315
+ "runId": {
316
+ "type": "string",
317
+ "minLength": 1
318
+ },
319
+ "details": {}
320
+ },
321
+ "additionalProperties": true
322
+ },
323
+ "reason": {
324
+ "type": "string"
325
+ }
326
+ },
327
+ "allOf": [
328
+ {
329
+ "if": {
330
+ "properties": {
331
+ "status": {
332
+ "const": "success"
333
+ }
334
+ }
335
+ },
336
+ "then": {
337
+ "required": [
338
+ "output"
339
+ ]
340
+ }
341
+ },
342
+ {
343
+ "if": {
344
+ "properties": {
345
+ "status": {
346
+ "const": "error"
347
+ }
348
+ }
349
+ },
350
+ "then": {
351
+ "required": [
352
+ "error"
353
+ ]
354
+ }
355
+ },
356
+ {
357
+ "if": {
358
+ "properties": {
359
+ "status": {
360
+ "const": "cancelled"
361
+ }
362
+ }
363
+ },
364
+ "then": {
365
+ "required": [
366
+ "reason"
367
+ ]
368
+ }
369
+ }
370
+ ],
371
+ "additionalProperties": true
372
+ },
373
+ {
374
+ "type": "object",
375
+ "required": [
376
+ "type",
377
+ "protocol",
378
+ "target"
379
+ ],
380
+ "properties": {
381
+ "type": {
382
+ "const": "cancel"
383
+ },
384
+ "protocol": {
385
+ "const": "miao.runtime/v1"
386
+ },
387
+ "target": {
388
+ "oneOf": [
389
+ {
390
+ "type": "object",
391
+ "required": [
392
+ "kind",
393
+ "requestId"
394
+ ],
395
+ "properties": {
396
+ "kind": {
397
+ "const": "request"
398
+ },
399
+ "requestId": {
400
+ "type": "string",
401
+ "minLength": 1
402
+ }
403
+ },
404
+ "additionalProperties": true
405
+ },
406
+ {
407
+ "type": "object",
408
+ "required": [
409
+ "kind",
410
+ "runId"
411
+ ],
412
+ "properties": {
413
+ "kind": {
414
+ "const": "run"
415
+ },
416
+ "runId": {
417
+ "type": "string",
418
+ "minLength": 1
419
+ }
420
+ },
421
+ "additionalProperties": true
422
+ },
423
+ {
424
+ "type": "object",
425
+ "required": [
426
+ "kind",
427
+ "callId"
428
+ ],
429
+ "properties": {
430
+ "kind": {
431
+ "const": "host_call"
432
+ },
433
+ "callId": {
434
+ "type": "string",
435
+ "minLength": 1
436
+ }
437
+ },
438
+ "additionalProperties": true
439
+ },
440
+ {
441
+ "type": "object",
442
+ "required": [
443
+ "kind",
444
+ "subscriptionId"
445
+ ],
446
+ "properties": {
447
+ "kind": {
448
+ "const": "subscription"
449
+ },
450
+ "subscriptionId": {
451
+ "type": "string",
452
+ "minLength": 1
453
+ }
454
+ },
455
+ "additionalProperties": true
456
+ }
457
+ ]
458
+ },
459
+ "reason": {
460
+ "type": "string"
461
+ }
462
+ },
463
+ "additionalProperties": true
464
+ },
465
+ {
466
+ "type": "object",
467
+ "required": [
468
+ "type",
469
+ "protocol",
470
+ "nonce"
471
+ ],
472
+ "properties": {
473
+ "type": {
474
+ "const": "ping"
475
+ },
476
+ "protocol": {
477
+ "const": "miao.runtime/v1"
478
+ },
479
+ "nonce": {
480
+ "type": "string",
481
+ "minLength": 1
482
+ }
483
+ },
484
+ "additionalProperties": true
485
+ },
486
+ {
487
+ "type": "object",
488
+ "required": [
489
+ "type",
490
+ "protocol",
491
+ "nonce"
492
+ ],
493
+ "properties": {
494
+ "type": {
495
+ "const": "pong"
496
+ },
497
+ "protocol": {
498
+ "const": "miao.runtime/v1"
499
+ },
500
+ "nonce": {
501
+ "type": "string",
502
+ "minLength": 1
503
+ }
504
+ },
505
+ "additionalProperties": true
506
+ }
507
+ ]
508
+ }