@nylorun/runtime 0.14.0-beta → 0.15.1-beta

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 (198) hide show
  1. package/CHANGELOG.md +115 -0
  2. package/README.md +82 -40
  3. package/dist/adapters/execution/restate.js +2 -2
  4. package/dist/adapters/replication/pgoutput.d.ts +5 -0
  5. package/dist/adapters/replication/pgoutput.js +4 -3
  6. package/dist/admin-openapi.json +185 -686
  7. package/dist/api/components.d.ts +308 -68
  8. package/dist/api/components.js +4 -5
  9. package/dist/api/gate/keys.d.ts +14 -0
  10. package/dist/api/gate/keys.js +59 -0
  11. package/dist/api/gate/routes.d.ts +34 -0
  12. package/dist/api/gate/routes.js +235 -0
  13. package/dist/api/http/define.js +0 -8
  14. package/dist/api/http/routes/access.js +25 -18
  15. package/dist/api/http/routes/tenant.d.ts +2 -1
  16. package/dist/api/http/routes/tenant.js +77 -5
  17. package/dist/api/http/routes/vaults.js +2 -2
  18. package/dist/api/openapi.js +6 -7
  19. package/dist/gates/contract.d.ts +51 -0
  20. package/dist/gates/contract.js +37 -0
  21. package/dist/gates/handler.d.ts +21 -0
  22. package/dist/gates/handler.js +55 -0
  23. package/dist/gates/http-client.d.ts +12 -0
  24. package/dist/gates/http-client.js +160 -0
  25. package/dist/gates/in-process.d.ts +32 -0
  26. package/dist/gates/in-process.js +42 -0
  27. package/dist/gates/inflight.d.ts +39 -0
  28. package/dist/gates/inflight.js +70 -0
  29. package/dist/gates/mcp-handler.d.ts +35 -0
  30. package/dist/gates/mcp-handler.js +142 -0
  31. package/dist/gates/meter.d.ts +24 -0
  32. package/dist/gates/meter.js +165 -0
  33. package/dist/gates/model-gate.d.ts +45 -0
  34. package/dist/gates/model-gate.js +1 -0
  35. package/dist/gates/tenant-vaults.d.ts +64 -0
  36. package/dist/gates/tenant-vaults.js +94 -0
  37. package/dist/gates/tool-calls.d.ts +51 -0
  38. package/dist/gates/tool-calls.js +64 -0
  39. package/dist/gates/tool-client.d.ts +12 -0
  40. package/dist/gates/tool-client.js +201 -0
  41. package/dist/gates/tool-contract.d.ts +116 -0
  42. package/dist/gates/tool-contract.js +64 -0
  43. package/dist/gates/tool-gate.d.ts +45 -0
  44. package/dist/gates/tool-gate.js +10 -0
  45. package/dist/host/admin-api.d.ts +7 -6
  46. package/dist/host/admin-api.js +9 -113
  47. package/dist/host/app.d.ts +1 -1
  48. package/dist/host/app.js +20 -24
  49. package/dist/host/config-for.d.ts +1 -1
  50. package/dist/host/config-for.js +2 -2
  51. package/dist/host/create-host.d.ts +5 -5
  52. package/dist/host/create-host.js +5 -15
  53. package/dist/host/execution.d.ts +20 -18
  54. package/dist/host/execution.js +2 -2
  55. package/dist/host/gates.d.ts +58 -0
  56. package/dist/host/gates.js +127 -0
  57. package/dist/host/http.d.ts +6 -1
  58. package/dist/host/http.js +17 -0
  59. package/dist/host/index.d.ts +1 -1
  60. package/dist/host/main.js +151 -71
  61. package/dist/host/stack-config.d.ts +71 -19
  62. package/dist/host/stack-config.js +192 -18
  63. package/dist/infra/database.d.ts +2 -2
  64. package/dist/infra/execution.d.ts +5 -5
  65. package/dist/infra/execution.js +8 -6
  66. package/dist/infra/index.d.ts +1 -1
  67. package/dist/infra/workers.d.ts +17 -17
  68. package/dist/infra/workers.js +9 -9
  69. package/dist/keys/client.d.ts +9 -0
  70. package/dist/keys/client.js +70 -0
  71. package/dist/keys/contract.d.ts +24 -0
  72. package/dist/keys/contract.js +12 -0
  73. package/dist/keys/keys.d.ts +41 -0
  74. package/dist/keys/keys.js +50 -0
  75. package/dist/mcp/connect.d.ts +43 -3
  76. package/dist/mcp/connect.js +12 -5
  77. package/dist/mcp/pool.d.ts +21 -3
  78. package/dist/mcp/pool.js +15 -2
  79. package/dist/openapi.json +888 -695
  80. package/dist/record/append.d.ts +51 -0
  81. package/dist/record/append.js +20 -0
  82. package/dist/{store/event.js → record/envelope.js} +1 -1
  83. package/dist/record/index.d.ts +11 -0
  84. package/dist/record/index.js +11 -0
  85. package/dist/store/postgres/connect.d.ts +15 -12
  86. package/dist/store/postgres/connect.js +24 -12
  87. package/dist/store/postgres/db.d.ts +16 -0
  88. package/dist/store/postgres/db.js +28 -0
  89. package/dist/store/postgres/drizzle/0000_foundation.sql +22 -0
  90. package/dist/store/postgres/drizzle/0001_baseline.sql +255 -0
  91. package/dist/store/postgres/drizzle/0002_stream_relay.sql +4 -0
  92. package/dist/store/postgres/drizzle/0003_tool_crossings.sql +9 -0
  93. package/dist/store/postgres/drizzle/meta/_journal.json +34 -0
  94. package/dist/store/postgres/migrate.d.ts +68 -0
  95. package/dist/store/postgres/migrate.js +183 -0
  96. package/dist/store/postgres/record-writer.d.ts +4 -0
  97. package/dist/store/postgres/record-writer.js +34 -0
  98. package/dist/store/postgres/record.d.ts +2 -8
  99. package/dist/store/postgres/record.js +50 -54
  100. package/dist/store/postgres/schema.d.ts +3096 -0
  101. package/dist/store/postgres/schema.js +363 -0
  102. package/dist/store/postgres/store.d.ts +2 -4
  103. package/dist/store/postgres/store.js +481 -567
  104. package/dist/store/postgres/tenant.d.ts +56 -0
  105. package/dist/store/postgres/tenant.js +154 -0
  106. package/dist/store/types.d.ts +43 -87
  107. package/dist/store/types.js +0 -1
  108. package/dist/streams/control.d.ts +1 -1
  109. package/dist/streams/control.js +6 -2
  110. package/dist/streams/relay/types.d.ts +2 -1
  111. package/dist/streams/relay/types.js +2 -1
  112. package/dist/streams/types.d.ts +5 -0
  113. package/dist/tenant/advance.d.ts +7 -2
  114. package/dist/tenant/advance.js +95 -16
  115. package/dist/tenant/cause.d.ts +25 -0
  116. package/dist/tenant/cause.js +45 -0
  117. package/dist/tenant/commands.js +4 -2
  118. package/dist/tenant/context.d.ts +26 -3
  119. package/dist/tenant/delivery-token.js +17 -18
  120. package/dist/tenant/delivery.d.ts +1 -1
  121. package/dist/tenant/delivery.js +18 -13
  122. package/dist/tenant/effects.d.ts +15 -1
  123. package/dist/tenant/effects.js +93 -17
  124. package/dist/tenant/ephemeral.d.ts +16 -7
  125. package/dist/tenant/ephemeral.js +45 -111
  126. package/dist/tenant/history.d.ts +64 -0
  127. package/dist/tenant/history.js +120 -0
  128. package/dist/tenant/model-setting.d.ts +2 -2
  129. package/dist/tenant/module.d.ts +14 -28
  130. package/dist/tenant/module.js +131 -271
  131. package/dist/tenant/paths.d.ts +11 -16
  132. package/dist/tenant/paths.js +24 -68
  133. package/dist/tenant/pool.d.ts +1 -1
  134. package/dist/tenant/pool.js +1 -1
  135. package/dist/tenant/principals.d.ts +23 -11
  136. package/dist/tenant/principals.js +61 -49
  137. package/dist/tenant/runtime.d.ts +19 -1
  138. package/dist/tenant/runtime.js +40 -26
  139. package/dist/tenant/scheduler.d.ts +4 -2
  140. package/dist/tenant/scheduler.js +4 -4
  141. package/dist/tenant/session-streams.d.ts +2 -0
  142. package/dist/tenant/session-streams.js +8 -3
  143. package/dist/tenant/status.d.ts +3 -0
  144. package/dist/tenant/status.js +1 -1
  145. package/dist/tenant/store-pg.d.ts +9 -6
  146. package/dist/tenant/store-pg.js +60 -125
  147. package/dist/tenant/streams.d.ts +9 -25
  148. package/dist/tenant/streams.js +7 -22
  149. package/dist/tenant/tokens.js +16 -14
  150. package/dist/tenant/types.d.ts +41 -92
  151. package/dist/tenant/types.js +4 -15
  152. package/dist/tenant/worker.js +4 -4
  153. package/dist/vault/host-model.d.ts +31 -0
  154. package/dist/vault/host-model.js +57 -0
  155. package/dist/vault/service.d.ts +26 -15
  156. package/dist/vault/service.js +70 -109
  157. package/dist/version.d.ts +1 -1
  158. package/dist/version.js +1 -1
  159. package/package.json +9 -5
  160. package/dist/store/memory.d.ts +0 -69
  161. package/dist/store/memory.js +0 -810
  162. package/dist/store/postgres/migrations/001_initial.d.ts +0 -27
  163. package/dist/store/postgres/migrations/001_initial.js +0 -196
  164. package/dist/store/postgres/migrations/002_session_owner.d.ts +0 -6
  165. package/dist/store/postgres/migrations/002_session_owner.js +0 -13
  166. package/dist/store/postgres/migrations/003_subject_tokens.d.ts +0 -8
  167. package/dist/store/postgres/migrations/003_subject_tokens.js +0 -42
  168. package/dist/store/postgres/migrations/004_publishable_keys.d.ts +0 -6
  169. package/dist/store/postgres/migrations/004_publishable_keys.js +0 -18
  170. package/dist/store/postgres/migrations/005_action_endpoints.d.ts +0 -6
  171. package/dist/store/postgres/migrations/005_action_endpoints.js +0 -32
  172. package/dist/store/postgres/migrations/006_drop_executors.d.ts +0 -11
  173. package/dist/store/postgres/migrations/006_drop_executors.js +0 -32
  174. package/dist/store/postgres/migrations/007_event_time.d.ts +0 -7
  175. package/dist/store/postgres/migrations/007_event_time.js +0 -14
  176. package/dist/store/postgres/migrations/008_durable_streams.d.ts +0 -13
  177. package/dist/store/postgres/migrations/008_durable_streams.js +0 -35
  178. package/dist/store/postgres/migrations/index.d.ts +0 -53
  179. package/dist/store/postgres/migrations/index.js +0 -96
  180. package/dist/store/postgres/migrations/shared/index.d.ts +0 -31
  181. package/dist/store/postgres/migrations/shared/index.js +0 -92
  182. package/dist/store/postgres/names.d.ts +0 -11
  183. package/dist/store/postgres/names.js +0 -42
  184. package/dist/store/postgres/tenants.d.ts +0 -90
  185. package/dist/store/postgres/tenants.js +0 -228
  186. package/dist/streams/relay/memory.d.ts +0 -69
  187. package/dist/streams/relay/memory.js +0 -176
  188. package/dist/tenant/envelope.d.ts +0 -7
  189. package/dist/tenant/envelope.js +0 -22
  190. package/dist/tenant/quarantine-error.d.ts +0 -6
  191. package/dist/tenant/quarantine-error.js +0 -9
  192. package/dist/tenant/quarantine.d.ts +0 -27
  193. package/dist/tenant/quarantine.js +0 -72
  194. package/dist/tenant/store-memory.d.ts +0 -16
  195. package/dist/tenant/store-memory.js +0 -111
  196. /package/dist/{store → record}/cursor.d.ts +0 -0
  197. /package/dist/{store → record}/cursor.js +0 -0
  198. /package/dist/{store/event.d.ts → record/envelope.d.ts} +0 -0
@@ -2,11 +2,11 @@
2
2
  "openapi": "3.2.0",
3
3
  "info": {
4
4
  "title": "Nylorun Runtime: Admin API",
5
- "version": "0.14.0-beta",
6
- "description": "Tenants and the Host's status, with the admin key. Served on the operator listener when the Host has one; the public listener answers these routes with the opaque 404.",
5
+ "version": "0.15.1-beta",
6
+ "description": "The Host's status, its Tenant's state and shutdown, with the admin key. Served on the operator listener when the Host has one; the public listener answers these routes with the opaque 404.",
7
7
  "x-nylorun-protocol": {
8
8
  "min": 4,
9
- "max": 4,
9
+ "max": 5,
10
10
  "features": [
11
11
  "runtime-tenants",
12
12
  "admin-status",
@@ -27,7 +27,7 @@
27
27
  "servers": [
28
28
  {
29
29
  "url": "{origin}",
30
- "description": "The operator listener: the local stack's, or where yours runs",
30
+ "description": "The operator listener: a local Tenant's, or where yours runs",
31
31
  "variables": {
32
32
  "origin": {
33
33
  "default": "http://localhost:8788"
@@ -44,135 +44,16 @@
44
44
  }
45
45
  },
46
46
  "schemas": {
47
- "AdminTenantList": {
48
- "type": "array",
49
- "items": {
50
- "type": "object",
51
- "properties": {
52
- "id": {
53
- "type": "string",
54
- "minLength": 1
55
- },
56
- "name": {
57
- "type": [
58
- "string",
59
- "null"
60
- ]
61
- },
62
- "state": {
63
- "type": "string",
64
- "enum": [
65
- "open",
66
- "quarantined"
67
- ]
68
- },
69
- "envelope": {
70
- "type": [
71
- "object",
72
- "null"
73
- ],
74
- "properties": {
75
- "id": {
76
- "type": "string",
77
- "minLength": 1
78
- },
79
- "name": {
80
- "type": "string",
81
- "minLength": 1
82
- },
83
- "createdAt": {
84
- "type": "string",
85
- "minLength": 1
86
- },
87
- "updatedAt": {
88
- "type": "string",
89
- "minLength": 1
90
- },
91
- "schemaVersion": {
92
- "type": "integer"
93
- }
94
- },
95
- "required": [
96
- "id",
97
- "name",
98
- "createdAt",
99
- "updatedAt",
100
- "schemaVersion"
101
- ],
102
- "additionalProperties": false
103
- }
104
- },
105
- "required": [
106
- "id",
107
- "name",
108
- "state",
109
- "envelope"
110
- ],
111
- "additionalProperties": false
112
- }
113
- },
114
- "Rejected": {
115
- "type": "object",
116
- "properties": {
117
- "status": {
118
- "type": "string",
119
- "enum": [
120
- "rejected"
121
- ]
122
- },
123
- "code": {
124
- "type": "string",
125
- "enum": [
126
- "not_found",
127
- "protocol_unsupported",
128
- "host_rejected",
129
- "origin_rejected",
130
- "unsupported_media_type",
131
- "tenant_conflict",
132
- "active_work",
133
- "connection_missing",
134
- "incompatible_host",
135
- "subject_invalid",
136
- "scope_required",
137
- "token_expired",
138
- "limit_exceeded",
139
- "request_rejected",
140
- "invalid_request",
141
- "subject_required",
142
- "internal_error"
143
- ]
144
- },
145
- "message": {
146
- "type": "string"
147
- },
148
- "details": {},
149
- "activeTurnId": {
150
- "type": "string"
151
- },
152
- "requestId": {
153
- "type": "string"
154
- }
155
- },
156
- "required": [
157
- "status",
158
- "code",
159
- "message"
160
- ]
161
- },
162
- "ProtocolRejected": {
47
+ "AdminStatus": {
163
48
  "type": "object",
164
49
  "properties": {
165
- "status": {
50
+ "service": {
166
51
  "type": "string",
167
- "enum": [
168
- "rejected"
169
- ]
52
+ "minLength": 1
170
53
  },
171
- "code": {
54
+ "version": {
172
55
  "type": "string",
173
- "enum": [
174
- "protocol_unsupported"
175
- ]
56
+ "minLength": 1
176
57
  },
177
58
  "protocol": {
178
59
  "type": "object",
@@ -196,301 +77,104 @@
196
77
  "features"
197
78
  ],
198
79
  "additionalProperties": false
199
- }
200
- },
201
- "required": [
202
- "status",
203
- "code",
204
- "protocol"
205
- ],
206
- "additionalProperties": false
207
- },
208
- "TenantEnvelope": {
209
- "type": "object",
210
- "properties": {
211
- "id": {
212
- "type": "string",
213
- "minLength": 1
214
- },
215
- "name": {
216
- "type": "string",
217
- "minLength": 1
218
- },
219
- "createdAt": {
220
- "type": "string",
221
- "minLength": 1
222
- },
223
- "updatedAt": {
224
- "type": "string",
225
- "minLength": 1
226
- },
227
- "schemaVersion": {
228
- "type": "integer"
229
- }
230
- },
231
- "required": [
232
- "id",
233
- "name",
234
- "createdAt",
235
- "updatedAt",
236
- "schemaVersion"
237
- ],
238
- "additionalProperties": false
239
- },
240
- "CreateTenantRequest": {
241
- "type": "object",
242
- "properties": {
243
- "tenantId": {
244
- "type": "string",
245
- "minLength": 1
246
- },
247
- "name": {
248
- "type": "string",
249
- "minLength": 1
250
- },
251
- "principalId": {
252
- "type": "string",
253
- "minLength": 1
254
- },
255
- "credentialHash": {
256
- "type": "string",
257
- "pattern": "^[0-9a-f]{64}$"
258
- },
259
- "idempotencyKey": {
260
- "type": "string",
261
- "minLength": 1,
262
- "maxLength": 256
263
- },
264
- "studioCredentialHash": {
265
- "type": "string",
266
- "pattern": "^[0-9a-f]{64}$"
267
- },
268
- "derivedPrincipals": {
269
- "type": "array",
270
- "items": {
271
- "type": "object",
272
- "properties": {
273
- "id": {
274
- "type": "string",
275
- "pattern": "^[a-z][a-z0-9-]{0,31}$"
276
- },
277
- "credentialHash": {
278
- "type": "string",
279
- "pattern": "^[0-9a-f]{64}$"
280
- }
281
- },
282
- "required": [
283
- "id",
284
- "credentialHash"
285
- ],
286
- "additionalProperties": false
287
- },
288
- "maxItems": 16
289
- }
290
- },
291
- "required": [
292
- "tenantId",
293
- "name",
294
- "principalId",
295
- "credentialHash",
296
- "idempotencyKey"
297
- ],
298
- "additionalProperties": false
299
- },
300
- "AdminTenantStatus": {
301
- "type": "object",
302
- "properties": {
303
- "id": {
304
- "type": "string",
305
- "minLength": 1
306
- },
307
- "name": {
308
- "type": [
309
- "string",
310
- "null"
311
- ]
312
- },
313
- "state": {
314
- "type": "string",
315
- "enum": [
316
- "open",
317
- "quarantined"
318
- ]
319
80
  },
320
- "envelope": {
321
- "type": [
322
- "object",
323
- "null"
324
- ],
81
+ "tenant": {
82
+ "type": "object",
325
83
  "properties": {
326
84
  "id": {
327
- "type": "string",
85
+ "type": [
86
+ "string",
87
+ "null"
88
+ ],
328
89
  "minLength": 1
329
90
  },
330
91
  "name": {
331
- "type": "string",
332
- "minLength": 1
333
- },
334
- "createdAt": {
335
- "type": "string",
336
- "minLength": 1
337
- },
338
- "updatedAt": {
339
- "type": "string",
340
- "minLength": 1
92
+ "type": [
93
+ "string",
94
+ "null"
95
+ ]
341
96
  },
342
- "schemaVersion": {
343
- "type": "integer"
344
- }
345
- },
346
- "required": [
347
- "id",
348
- "name",
349
- "createdAt",
350
- "updatedAt",
351
- "schemaVersion"
352
- ],
353
- "additionalProperties": false
354
- },
355
- "quarantine": {
356
- "type": "object",
357
- "properties": {
358
- "code": {
97
+ "state": {
359
98
  "type": "string",
360
99
  "enum": [
361
- "kek-missing",
362
- "corrupt",
363
- "schema-too-new",
364
- "migration-failed",
365
- "envelope-invalid",
366
- "open-timeout",
367
- "open-failed"
100
+ "open",
101
+ "unavailable"
368
102
  ]
369
103
  },
370
- "message": {
371
- "type": "string"
372
- },
373
- "repair": {
374
- "type": "string"
375
- }
376
- },
377
- "required": [
378
- "code",
379
- "message",
380
- "repair"
381
- ],
382
- "additionalProperties": false
383
- }
384
- },
385
- "required": [
386
- "id",
387
- "name",
388
- "state",
389
- "envelope"
390
- ],
391
- "additionalProperties": false
392
- },
393
- "AdminStatus": {
394
- "type": "object",
395
- "properties": {
396
- "service": {
397
- "type": "string",
398
- "minLength": 1
399
- },
400
- "version": {
401
- "type": "string",
402
- "minLength": 1
403
- },
404
- "protocol": {
405
- "type": "object",
406
- "properties": {
407
- "min": {
408
- "type": "integer"
409
- },
410
- "max": {
411
- "type": "integer"
104
+ "envelope": {
105
+ "type": [
106
+ "object",
107
+ "null"
108
+ ],
109
+ "properties": {
110
+ "id": {
111
+ "type": "string",
112
+ "minLength": 1
113
+ },
114
+ "name": {
115
+ "type": "string",
116
+ "minLength": 1
117
+ },
118
+ "createdAt": {
119
+ "type": "string",
120
+ "minLength": 1
121
+ },
122
+ "updatedAt": {
123
+ "type": "string",
124
+ "minLength": 1
125
+ },
126
+ "schemaVersion": {
127
+ "type": "integer"
128
+ }
129
+ },
130
+ "required": [
131
+ "id",
132
+ "name",
133
+ "createdAt",
134
+ "updatedAt",
135
+ "schemaVersion"
136
+ ],
137
+ "additionalProperties": false
412
138
  },
413
- "features": {
414
- "type": "array",
415
- "items": {
416
- "type": "string"
417
- }
139
+ "cause": {
140
+ "type": "object",
141
+ "properties": {
142
+ "code": {
143
+ "type": "string",
144
+ "enum": [
145
+ "kek-missing",
146
+ "corrupt",
147
+ "schema-too-new",
148
+ "migration-failed",
149
+ "envelope-invalid",
150
+ "open-timeout",
151
+ "open-failed",
152
+ "database-layout-old"
153
+ ]
154
+ },
155
+ "message": {
156
+ "type": "string"
157
+ },
158
+ "repair": {
159
+ "type": "string"
160
+ }
161
+ },
162
+ "required": [
163
+ "code",
164
+ "message",
165
+ "repair"
166
+ ],
167
+ "additionalProperties": false
418
168
  }
419
169
  },
420
170
  "required": [
421
- "min",
422
- "max",
423
- "features"
171
+ "id",
172
+ "name",
173
+ "state",
174
+ "envelope"
424
175
  ],
425
176
  "additionalProperties": false
426
177
  },
427
- "tenants": {
428
- "type": "array",
429
- "items": {
430
- "type": "object",
431
- "properties": {
432
- "id": {
433
- "type": "string",
434
- "minLength": 1
435
- },
436
- "name": {
437
- "type": [
438
- "string",
439
- "null"
440
- ]
441
- },
442
- "state": {
443
- "type": "string",
444
- "enum": [
445
- "open",
446
- "quarantined"
447
- ]
448
- },
449
- "envelope": {
450
- "type": [
451
- "object",
452
- "null"
453
- ],
454
- "properties": {
455
- "id": {
456
- "type": "string",
457
- "minLength": 1
458
- },
459
- "name": {
460
- "type": "string",
461
- "minLength": 1
462
- },
463
- "createdAt": {
464
- "type": "string",
465
- "minLength": 1
466
- },
467
- "updatedAt": {
468
- "type": "string",
469
- "minLength": 1
470
- },
471
- "schemaVersion": {
472
- "type": "integer"
473
- }
474
- },
475
- "required": [
476
- "id",
477
- "name",
478
- "createdAt",
479
- "updatedAt",
480
- "schemaVersion"
481
- ],
482
- "additionalProperties": false
483
- }
484
- },
485
- "required": [
486
- "id",
487
- "name",
488
- "state",
489
- "envelope"
490
- ],
491
- "additionalProperties": false
492
- }
493
- },
494
178
  "aggregate": {
495
179
  "type": "object",
496
180
  "properties": {
@@ -591,307 +275,122 @@
591
275
  "service",
592
276
  "version",
593
277
  "protocol",
594
- "tenants",
278
+ "tenant",
595
279
  "aggregate"
596
280
  ],
597
281
  "additionalProperties": false
598
282
  },
599
- "HostShutdownResponse": {
283
+ "Rejected": {
600
284
  "type": "object",
601
285
  "properties": {
602
286
  "status": {
603
287
  "type": "string",
604
288
  "enum": [
605
- "shutting_down"
289
+ "rejected"
606
290
  ]
607
- }
608
- },
609
- "required": [
610
- "status"
611
- ],
612
- "additionalProperties": false
613
- }
614
- },
615
- "parameters": {}
616
- },
617
- "paths": {
618
- "/v1/admin/tenants": {
619
- "get": {
620
- "summary": "List Tenants",
621
- "tags": [
622
- "Admin"
623
- ],
624
- "security": [
625
- {
626
- "adminKey": []
627
- }
628
- ],
629
- "responses": {
630
- "200": {
631
- "description": "Every Tenant on the Host",
632
- "content": {
633
- "application/json": {
634
- "schema": {
635
- "$ref": "#/components/schemas/AdminTenantList"
636
- }
637
- }
638
- }
639
- },
640
- "404": {
641
- "description": "Not found: an unknown admin key, the public listener, or an unknown Tenant",
642
- "content": {
643
- "application/json": {
644
- "schema": {
645
- "$ref": "#/components/schemas/Rejected"
646
- }
647
- }
648
- }
649
291
  },
650
- "426": {
651
- "description": "`Nylorun-Protocol` missing or unsupported",
652
- "content": {
653
- "application/json": {
654
- "schema": {
655
- "$ref": "#/components/schemas/ProtocolRejected"
656
- }
657
- }
658
- }
659
- }
660
- }
661
- },
662
- "post": {
663
- "summary": "Create a Tenant",
664
- "description": "Idempotent on `idempotencyKey`: a replay answers 200 with the same Tenant.",
665
- "tags": [
666
- "Admin"
667
- ],
668
- "security": [
669
- {
670
- "adminKey": []
671
- }
672
- ],
673
- "requestBody": {
674
- "required": true,
675
- "content": {
676
- "application/json": {
677
- "schema": {
678
- "$ref": "#/components/schemas/CreateTenantRequest"
679
- }
680
- }
681
- }
682
- },
683
- "responses": {
684
- "200": {
685
- "description": "The Tenant, created earlier by the same request",
686
- "content": {
687
- "application/json": {
688
- "schema": {
689
- "$ref": "#/components/schemas/TenantEnvelope"
690
- }
691
- }
692
- }
693
- },
694
- "201": {
695
- "description": "The Tenant, created",
696
- "content": {
697
- "application/json": {
698
- "schema": {
699
- "$ref": "#/components/schemas/TenantEnvelope"
700
- }
701
- }
702
- }
292
+ "code": {
293
+ "type": "string",
294
+ "enum": [
295
+ "not_found",
296
+ "protocol_unsupported",
297
+ "host_rejected",
298
+ "origin_rejected",
299
+ "unsupported_media_type",
300
+ "connection_missing",
301
+ "incompatible_host",
302
+ "subject_invalid",
303
+ "scope_required",
304
+ "token_expired",
305
+ "limit_exceeded",
306
+ "request_rejected",
307
+ "invalid_request",
308
+ "subject_required",
309
+ "internal_error"
310
+ ]
703
311
  },
704
- "400": {
705
- "description": "Invalid JSON or request body (`invalid_request`)",
706
- "content": {
707
- "application/json": {
708
- "schema": {
709
- "$ref": "#/components/schemas/Rejected"
710
- }
711
- }
712
- }
312
+ "message": {
313
+ "type": "string"
713
314
  },
714
- "404": {
715
- "description": "Not found: an unknown admin key, the public listener, or an unknown Tenant",
716
- "content": {
717
- "application/json": {
718
- "schema": {
719
- "$ref": "#/components/schemas/Rejected"
720
- }
721
- }
722
- }
315
+ "details": {},
316
+ "activeTurnId": {
317
+ "type": "string"
723
318
  },
724
- "409": {
725
- "description": "Another Tenant has this id or idempotency key (`tenant_conflict`)",
726
- "content": {
727
- "application/json": {
728
- "schema": {
729
- "$ref": "#/components/schemas/Rejected"
730
- }
731
- }
732
- }
319
+ "requestId": {
320
+ "type": "string"
321
+ }
322
+ },
323
+ "required": [
324
+ "status",
325
+ "code",
326
+ "message"
327
+ ]
328
+ },
329
+ "ProtocolRejected": {
330
+ "type": "object",
331
+ "properties": {
332
+ "status": {
333
+ "type": "string",
334
+ "enum": [
335
+ "rejected"
336
+ ]
733
337
  },
734
- "413": {
735
- "description": "Request body over 1 MiB",
736
- "content": {
737
- "application/json": {
738
- "schema": {
739
- "$ref": "#/components/schemas/Rejected"
740
- }
741
- }
742
- }
338
+ "code": {
339
+ "type": "string",
340
+ "enum": [
341
+ "protocol_unsupported"
342
+ ]
743
343
  },
744
- "426": {
745
- "description": "`Nylorun-Protocol` missing or unsupported",
746
- "content": {
747
- "application/json": {
748
- "schema": {
749
- "$ref": "#/components/schemas/ProtocolRejected"
344
+ "protocol": {
345
+ "type": "object",
346
+ "properties": {
347
+ "min": {
348
+ "type": "integer"
349
+ },
350
+ "max": {
351
+ "type": "integer"
352
+ },
353
+ "features": {
354
+ "type": "array",
355
+ "items": {
356
+ "type": "string"
750
357
  }
751
358
  }
752
- }
753
- }
754
- }
755
- }
756
- },
757
- "/v1/admin/tenants/{tenantId}": {
758
- "get": {
759
- "summary": "Get a Tenant's status",
760
- "tags": [
761
- "Admin"
762
- ],
763
- "security": [
764
- {
765
- "adminKey": []
766
- }
767
- ],
768
- "parameters": [
769
- {
770
- "schema": {
771
- "type": "string",
772
- "example": "tn_0123456789abcdefghjkmnpqrs"
773
359
  },
774
- "required": true,
775
- "name": "tenantId",
776
- "in": "path"
360
+ "required": [
361
+ "min",
362
+ "max",
363
+ "features"
364
+ ],
365
+ "additionalProperties": false
777
366
  }
367
+ },
368
+ "required": [
369
+ "status",
370
+ "code",
371
+ "protocol"
778
372
  ],
779
- "responses": {
780
- "200": {
781
- "description": "The Tenant and its state",
782
- "content": {
783
- "application/json": {
784
- "schema": {
785
- "$ref": "#/components/schemas/AdminTenantStatus"
786
- }
787
- }
788
- }
789
- },
790
- "404": {
791
- "description": "Not found: an unknown admin key, the public listener, or an unknown Tenant",
792
- "content": {
793
- "application/json": {
794
- "schema": {
795
- "$ref": "#/components/schemas/Rejected"
796
- }
797
- }
798
- }
799
- },
800
- "426": {
801
- "description": "`Nylorun-Protocol` missing or unsupported",
802
- "content": {
803
- "application/json": {
804
- "schema": {
805
- "$ref": "#/components/schemas/ProtocolRejected"
806
- }
807
- }
808
- }
809
- }
810
- }
373
+ "additionalProperties": false
811
374
  },
812
- "delete": {
813
- "summary": "Delete a Tenant",
814
- "tags": [
815
- "Admin"
816
- ],
817
- "security": [
818
- {
819
- "adminKey": []
820
- }
821
- ],
822
- "parameters": [
823
- {
824
- "schema": {
825
- "type": "string",
826
- "example": "tn_0123456789abcdefghjkmnpqrs"
827
- },
828
- "required": true,
829
- "name": "tenantId",
830
- "in": "path"
831
- },
832
- {
833
- "schema": {
834
- "type": "string",
835
- "enum": [
836
- "refuse",
837
- "drain",
838
- "cancel"
839
- ],
840
- "description": "What to do with turns in progress: refuse to delete (default), wait for them, or cancel them"
841
- },
842
- "required": false,
843
- "description": "What to do with turns in progress: refuse to delete (default), wait for them, or cancel them",
844
- "name": "activeWork",
845
- "in": "query"
375
+ "HostShutdownResponse": {
376
+ "type": "object",
377
+ "properties": {
378
+ "status": {
379
+ "type": "string",
380
+ "enum": [
381
+ "shutting_down"
382
+ ]
846
383
  }
384
+ },
385
+ "required": [
386
+ "status"
847
387
  ],
848
- "responses": {
849
- "204": {
850
- "description": "Deleted"
851
- },
852
- "400": {
853
- "description": "`activeWork` is not refuse, drain or cancel (`invalid_request`)",
854
- "content": {
855
- "application/json": {
856
- "schema": {
857
- "$ref": "#/components/schemas/Rejected"
858
- }
859
- }
860
- }
861
- },
862
- "404": {
863
- "description": "Not found: an unknown admin key, the public listener, or an unknown Tenant",
864
- "content": {
865
- "application/json": {
866
- "schema": {
867
- "$ref": "#/components/schemas/Rejected"
868
- }
869
- }
870
- }
871
- },
872
- "409": {
873
- "description": "The Tenant has work in progress and `activeWork` is refuse (`active_work`)",
874
- "content": {
875
- "application/json": {
876
- "schema": {
877
- "$ref": "#/components/schemas/Rejected"
878
- }
879
- }
880
- }
881
- },
882
- "426": {
883
- "description": "`Nylorun-Protocol` missing or unsupported",
884
- "content": {
885
- "application/json": {
886
- "schema": {
887
- "$ref": "#/components/schemas/ProtocolRejected"
888
- }
889
- }
890
- }
891
- }
892
- }
388
+ "additionalProperties": false
893
389
  }
894
390
  },
391
+ "parameters": {}
392
+ },
393
+ "paths": {
895
394
  "/v1/admin/status": {
896
395
  "get": {
897
396
  "summary": "Get the Host's status",
@@ -905,7 +404,7 @@
905
404
  ],
906
405
  "responses": {
907
406
  "200": {
908
- "description": "Version, protocol, Tenants and the Host",
407
+ "description": "Version, protocol, the Tenant and the Host",
909
408
  "content": {
910
409
  "application/json": {
911
410
  "schema": {
@@ -915,7 +414,7 @@
915
414
  }
916
415
  },
917
416
  "404": {
918
- "description": "Not found: an unknown admin key, the public listener, or an unknown Tenant",
417
+ "description": "Not found: an unknown admin key, or the public listener",
919
418
  "content": {
920
419
  "application/json": {
921
420
  "schema": {
@@ -950,7 +449,7 @@
950
449
  ],
951
450
  "responses": {
952
451
  "200": {
953
- "description": "Version, protocol, Tenants and the Host",
452
+ "description": "Version, protocol, the Tenant and the Host",
954
453
  "content": {
955
454
  "application/json": {
956
455
  "schema": {
@@ -960,7 +459,7 @@
960
459
  }
961
460
  },
962
461
  "404": {
963
- "description": "Not found: an unknown admin key, the public listener, or an unknown Tenant",
462
+ "description": "Not found: an unknown admin key, or the public listener",
964
463
  "content": {
965
464
  "application/json": {
966
465
  "schema": {
@@ -1006,7 +505,7 @@
1006
505
  }
1007
506
  },
1008
507
  "404": {
1009
- "description": "Not found: an unknown admin key, the public listener, or an unknown Tenant",
508
+ "description": "Not found: an unknown admin key, or the public listener",
1010
509
  "content": {
1011
510
  "application/json": {
1012
511
  "schema": {
@@ -1044,7 +543,7 @@
1044
543
  "description": "The Admin API's OpenAPI document"
1045
544
  },
1046
545
  "404": {
1047
- "description": "Not found: an unknown admin key, the public listener, or an unknown Tenant",
546
+ "description": "Not found: an unknown admin key, or the public listener",
1048
547
  "content": {
1049
548
  "application/json": {
1050
549
  "schema": {