@mostra/protocol 0.9.0 → 0.11.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.
Files changed (241) hide show
  1. package/dist/actions.d.ts +30 -4
  2. package/dist/actions.d.ts.map +1 -1
  3. package/dist/actions.js +14 -4
  4. package/dist/actions.js.map +1 -1
  5. package/dist/artifact.d.ts +2 -1
  6. package/dist/artifact.d.ts.map +1 -1
  7. package/dist/artifact.js +2 -1
  8. package/dist/artifact.js.map +1 -1
  9. package/dist/browser.d.ts +47 -0
  10. package/dist/browser.d.ts.map +1 -1
  11. package/dist/browser.js +36 -3
  12. package/dist/browser.js.map +1 -1
  13. package/dist/capability.d.ts +0 -9
  14. package/dist/capability.d.ts.map +1 -1
  15. package/dist/capability.js +1 -17
  16. package/dist/capability.js.map +1 -1
  17. package/dist/diagnostics/codes/action.d.ts +1 -1
  18. package/dist/diagnostics/codes/action.d.ts.map +1 -1
  19. package/dist/diagnostics/codes/action.js +12 -1
  20. package/dist/diagnostics/codes/action.js.map +1 -1
  21. package/dist/diagnostics/codes/artifact.d.ts +1 -1
  22. package/dist/diagnostics/codes/artifact.d.ts.map +1 -1
  23. package/dist/diagnostics/codes/artifact.js +12 -1
  24. package/dist/diagnostics/codes/artifact.js.map +1 -1
  25. package/dist/diagnostics/codes/home.d.ts +1 -1
  26. package/dist/diagnostics/codes/home.d.ts.map +1 -1
  27. package/dist/diagnostics/codes/home.js +12 -1
  28. package/dist/diagnostics/codes/home.js.map +1 -1
  29. package/dist/diagnostics/codes/index.d.ts +3 -2
  30. package/dist/diagnostics/codes/index.d.ts.map +1 -1
  31. package/dist/diagnostics/codes/index.js +3 -1
  32. package/dist/diagnostics/codes/index.js.map +1 -1
  33. package/dist/diagnostics/codes/remote.d.ts +8 -0
  34. package/dist/diagnostics/codes/remote.d.ts.map +1 -0
  35. package/dist/diagnostics/codes/remote.js +176 -0
  36. package/dist/diagnostics/codes/remote.js.map +1 -0
  37. package/dist/diagnostics/codes/submit.d.ts +1 -1
  38. package/dist/diagnostics/codes/submit.d.ts.map +1 -1
  39. package/dist/diagnostics/codes/submit.js +12 -1
  40. package/dist/diagnostics/codes/submit.js.map +1 -1
  41. package/dist/diagnostics/diagnostic.d.ts +1 -1
  42. package/dist/diagnostics/diagnostic.d.ts.map +1 -1
  43. package/dist/diagnostics/diagnostic.js +2 -1
  44. package/dist/diagnostics/diagnostic.js.map +1 -1
  45. package/dist/duration.d.ts +13 -0
  46. package/dist/duration.d.ts.map +1 -0
  47. package/dist/duration.js +27 -0
  48. package/dist/duration.js.map +1 -0
  49. package/dist/ids.d.ts +17 -1
  50. package/dist/ids.d.ts.map +1 -1
  51. package/dist/ids.js +9 -1
  52. package/dist/ids.js.map +1 -1
  53. package/dist/index.d.ts +33 -8
  54. package/dist/index.js +33 -8
  55. package/dist/interaction.d.ts +33 -2
  56. package/dist/interaction.d.ts.map +1 -1
  57. package/dist/interaction.js +22 -6
  58. package/dist/interaction.js.map +1 -1
  59. package/dist/manifest.d.ts +59 -14
  60. package/dist/manifest.d.ts.map +1 -1
  61. package/dist/manifest.js +63 -15
  62. package/dist/manifest.js.map +1 -1
  63. package/dist/methods/artifact/export.d.ts +40 -0
  64. package/dist/methods/artifact/export.d.ts.map +1 -0
  65. package/dist/methods/artifact/export.js +36 -0
  66. package/dist/methods/artifact/export.js.map +1 -0
  67. package/dist/methods/artifact/import.d.ts +23 -0
  68. package/dist/methods/artifact/import.d.ts.map +1 -0
  69. package/dist/methods/artifact/import.js +25 -0
  70. package/dist/methods/artifact/import.js.map +1 -0
  71. package/dist/methods/artifact/pause.d.ts +33 -0
  72. package/dist/methods/artifact/pause.d.ts.map +1 -0
  73. package/dist/methods/artifact/pause.js +33 -0
  74. package/dist/methods/artifact/pause.js.map +1 -0
  75. package/dist/methods/artifact/publish.d.ts +2 -1
  76. package/dist/methods/artifact/publish.d.ts.map +1 -1
  77. package/dist/methods/artifact/publish.js +1 -1
  78. package/dist/methods/hosted/push.d.ts +76 -0
  79. package/dist/methods/hosted/push.d.ts.map +1 -0
  80. package/dist/methods/hosted/push.js +71 -0
  81. package/dist/methods/hosted/push.js.map +1 -0
  82. package/dist/methods/hosted/submission.d.ts +18 -0
  83. package/dist/methods/hosted/submission.d.ts.map +1 -0
  84. package/dist/methods/hosted/submission.js +23 -0
  85. package/dist/methods/hosted/submission.js.map +1 -0
  86. package/dist/methods/index.d.ts.map +1 -1
  87. package/dist/methods/index.js +44 -2
  88. package/dist/methods/index.js.map +1 -1
  89. package/dist/methods/instance/status.d.ts +3 -0
  90. package/dist/methods/instance/status.d.ts.map +1 -1
  91. package/dist/methods/instance/status.js +3 -1
  92. package/dist/methods/instance/status.js.map +1 -1
  93. package/dist/methods/mostra/initialize.d.ts +17 -3
  94. package/dist/methods/mostra/initialize.d.ts.map +1 -1
  95. package/dist/methods/mostra/initialize.js +11 -3
  96. package/dist/methods/mostra/initialize.js.map +1 -1
  97. package/dist/methods/port/relay-author.d.ts +28 -0
  98. package/dist/methods/port/relay-author.d.ts.map +1 -0
  99. package/dist/methods/port/relay-author.js +42 -0
  100. package/dist/methods/port/relay-author.js.map +1 -0
  101. package/dist/methods/port/relay-call.d.ts +33 -0
  102. package/dist/methods/port/relay-call.d.ts.map +1 -0
  103. package/dist/methods/port/relay-call.js +31 -0
  104. package/dist/methods/port/relay-call.js.map +1 -0
  105. package/dist/methods/port/relay-cancel.d.ts +16 -0
  106. package/dist/methods/port/relay-cancel.d.ts.map +1 -0
  107. package/dist/methods/port/relay-cancel.js +21 -0
  108. package/dist/methods/port/relay-cancel.js.map +1 -0
  109. package/dist/methods/port/relay-live.d.ts +25 -0
  110. package/dist/methods/port/relay-live.d.ts.map +1 -0
  111. package/dist/methods/port/relay-live.js +32 -0
  112. package/dist/methods/port/relay-live.js.map +1 -0
  113. package/dist/methods/port/relay-reconcile.d.ts +39 -0
  114. package/dist/methods/port/relay-reconcile.d.ts.map +1 -0
  115. package/dist/methods/port/relay-reconcile.js +35 -0
  116. package/dist/methods/port/relay-reconcile.js.map +1 -0
  117. package/dist/methods/port/relay-run.d.ts +47 -0
  118. package/dist/methods/port/relay-run.d.ts.map +1 -0
  119. package/dist/methods/port/relay-run.js +41 -0
  120. package/dist/methods/port/relay-run.js.map +1 -0
  121. package/dist/methods/port/submissions-deliver.d.ts +8 -0
  122. package/dist/methods/port/submissions-deliver.d.ts.map +1 -1
  123. package/dist/methods/port/submissions-deliver.js +4 -2
  124. package/dist/methods/port/submissions-deliver.js.map +1 -1
  125. package/dist/methods/relay/call-batch.d.ts +26 -0
  126. package/dist/methods/relay/call-batch.d.ts.map +1 -0
  127. package/dist/methods/relay/call-batch.js +30 -0
  128. package/dist/methods/relay/call-batch.js.map +1 -0
  129. package/dist/methods/relay/effect.d.ts +31 -0
  130. package/dist/methods/relay/effect.d.ts.map +1 -0
  131. package/dist/methods/relay/effect.js +30 -0
  132. package/dist/methods/relay/effect.js.map +1 -0
  133. package/dist/methods/relay/live-value.d.ts +33 -0
  134. package/dist/methods/relay/live-value.d.ts.map +1 -0
  135. package/dist/methods/relay/live-value.js +32 -0
  136. package/dist/methods/relay/live-value.js.map +1 -0
  137. package/dist/methods/relay/run-update.d.ts +46 -0
  138. package/dist/methods/relay/run-update.d.ts.map +1 -0
  139. package/dist/methods/relay/run-update.js +45 -0
  140. package/dist/methods/relay/run-update.js.map +1 -0
  141. package/dist/methods/remote/link.d.ts +40 -0
  142. package/dist/methods/remote/link.d.ts.map +1 -0
  143. package/dist/methods/remote/link.js +40 -0
  144. package/dist/methods/remote/link.js.map +1 -0
  145. package/dist/methods/remote/login-wait.d.ts +30 -0
  146. package/dist/methods/remote/login-wait.d.ts.map +1 -0
  147. package/dist/methods/remote/login-wait.js +36 -0
  148. package/dist/methods/remote/login-wait.js.map +1 -0
  149. package/dist/methods/remote/login.d.ts +41 -0
  150. package/dist/methods/remote/login.d.ts.map +1 -0
  151. package/dist/methods/remote/login.js +37 -0
  152. package/dist/methods/remote/login.js.map +1 -0
  153. package/dist/methods/remote/logout.d.ts +25 -0
  154. package/dist/methods/remote/logout.d.ts.map +1 -0
  155. package/dist/methods/remote/logout.js +28 -0
  156. package/dist/methods/remote/logout.js.map +1 -0
  157. package/dist/methods/remote/status.d.ts +14 -0
  158. package/dist/methods/remote/status.d.ts.map +1 -0
  159. package/dist/methods/remote/status.js +22 -0
  160. package/dist/methods/remote/status.js.map +1 -0
  161. package/dist/methods/remote/token.d.ts +19 -0
  162. package/dist/methods/remote/token.d.ts.map +1 -0
  163. package/dist/methods/remote/token.js +24 -0
  164. package/dist/methods/remote/token.js.map +1 -0
  165. package/dist/methods/share/start.d.ts +5 -2
  166. package/dist/methods/share/start.d.ts.map +1 -1
  167. package/dist/methods/share/start.js +6 -3
  168. package/dist/methods/share/start.js.map +1 -1
  169. package/dist/methods/state/patch.d.ts +7 -0
  170. package/dist/methods/state/patch.d.ts.map +1 -1
  171. package/dist/methods/state/patch.js +2 -1
  172. package/dist/methods/state/patch.js.map +1 -1
  173. package/dist/methods/view/url.d.ts +2 -1
  174. package/dist/methods/view/url.d.ts.map +1 -1
  175. package/dist/methods/view/url.js +2 -1
  176. package/dist/methods/view/url.js.map +1 -1
  177. package/dist/operator.d.ts +464 -0
  178. package/dist/operator.d.ts.map +1 -0
  179. package/dist/operator.js +134 -0
  180. package/dist/operator.js.map +1 -0
  181. package/dist/policy.d.ts +18 -0
  182. package/dist/policy.d.ts.map +1 -0
  183. package/dist/policy.js +23 -0
  184. package/dist/policy.js.map +1 -0
  185. package/dist/remote.d.ts +55 -0
  186. package/dist/remote.d.ts.map +1 -0
  187. package/dist/remote.js +52 -0
  188. package/dist/remote.js.map +1 -0
  189. package/dist/view.d.ts +1 -1
  190. package/dist/view.js +1 -1
  191. package/dist/view.js.map +1 -1
  192. package/package.json +12 -2
  193. package/schemas/protocol.draft-07.json +1839 -99
  194. package/schemas/protocol.schema.json +1787 -111
  195. package/src/actions.ts +45 -5
  196. package/src/browser.ts +70 -0
  197. package/src/capability.ts +0 -23
  198. package/src/diagnostics/codes/action.ts +12 -0
  199. package/src/diagnostics/codes/artifact.ts +12 -0
  200. package/src/diagnostics/codes/home.ts +12 -0
  201. package/src/diagnostics/codes/index.ts +6 -2
  202. package/src/diagnostics/codes/remote.ts +197 -0
  203. package/src/diagnostics/codes/submit.ts +12 -0
  204. package/src/diagnostics/diagnostic.ts +3 -1
  205. package/src/duration.ts +29 -0
  206. package/src/ids.ts +33 -1
  207. package/src/index.ts +143 -8
  208. package/src/interaction.ts +48 -2
  209. package/src/manifest.ts +115 -24
  210. package/src/methods/artifact/export.ts +68 -0
  211. package/src/methods/artifact/import.ts +39 -0
  212. package/src/methods/artifact/pause.ts +59 -0
  213. package/src/methods/hosted/push.ts +146 -0
  214. package/src/methods/hosted/submission.ts +34 -0
  215. package/src/methods/index.ts +42 -0
  216. package/src/methods/instance/status.ts +4 -0
  217. package/src/methods/mostra/initialize.ts +19 -3
  218. package/src/methods/port/relay-author.ts +57 -0
  219. package/src/methods/port/relay-call.ts +58 -0
  220. package/src/methods/port/relay-cancel.ts +33 -0
  221. package/src/methods/port/relay-live.ts +48 -0
  222. package/src/methods/port/relay-reconcile.ts +71 -0
  223. package/src/methods/port/relay-run.ts +80 -0
  224. package/src/methods/port/submissions-deliver.ts +13 -1
  225. package/src/methods/relay/call-batch.ts +52 -0
  226. package/src/methods/relay/effect.ts +55 -0
  227. package/src/methods/relay/live-value.ts +54 -0
  228. package/src/methods/relay/run-update.ts +81 -0
  229. package/src/methods/remote/link.ts +65 -0
  230. package/src/methods/remote/login-wait.ts +55 -0
  231. package/src/methods/remote/login.ts +72 -0
  232. package/src/methods/remote/logout.ts +42 -0
  233. package/src/methods/remote/status.ts +34 -0
  234. package/src/methods/remote/token.ts +39 -0
  235. package/src/methods/share/start.ts +12 -4
  236. package/src/methods/state/patch.ts +6 -0
  237. package/src/methods/view/url.ts +2 -1
  238. package/src/operator.ts +621 -0
  239. package/src/policy.ts +30 -0
  240. package/src/remote.ts +89 -0
  241. package/src/view.ts +1 -1
package/src/index.ts CHANGED
@@ -22,6 +22,7 @@ export {
22
22
  LiveRequest,
23
23
  type LiveState,
24
24
  type LiveUpdate,
25
+ READABLE_LIVE_KEY_PATTERN,
25
26
  RUN_KEY_MAX,
26
27
  RUN_LOG_MAX,
27
28
  RUN_LOG_TRUNCATED,
@@ -36,6 +37,8 @@ export {
36
37
  type RunStatus,
37
38
  SECRET_NAME_PATTERN,
38
39
  SECRET_VALUE_MAX,
40
+ TALLY_LIVE_PREFIX,
41
+ type TallyValue,
39
42
  } from "./actions.ts";
40
43
  export {
41
44
  ArtifactDetail,
@@ -102,10 +105,12 @@ export {
102
105
  FRAME_SESSION_HEADER,
103
106
  FrameSessionFacts,
104
107
  FrameTicket,
108
+ type HostedChrome,
105
109
  OrphanedField,
106
110
  PollResult,
107
111
  REVIEW_SET_ID_PATTERN,
108
112
  readViewContext,
113
+ SHELL_SESSION_HEADER,
109
114
  ShellSubmitRequest,
110
115
  SIGNAL_PAYLOAD_MAX_BYTES,
111
116
  SignalRequest,
@@ -135,14 +140,7 @@ export {
135
140
  isWindowsBundle,
136
141
  } from "./bundle.ts";
137
142
  export { canonicalJson } from "./canonical.ts";
138
- export {
139
- ALL_SCOPES,
140
- CapabilityScope,
141
- Duration,
142
- durationMs,
143
- normalizeScopes,
144
- scopeAllows,
145
- } from "./capability.ts";
143
+ export { ALL_SCOPES, CapabilityScope, normalizeScopes, scopeAllows } from "./capability.ts";
146
144
  export {
147
145
  type A11yDiagnosticCode,
148
146
  type ActionDiagnosticCode,
@@ -183,8 +181,10 @@ export {
183
181
  platformDiagnosticCodes,
184
182
  publishDiagnosticCodes,
185
183
  type RegressionDiagnosticCode,
184
+ type RemoteDiagnosticCode,
186
185
  type RuntimeDiagnosticCode,
187
186
  regressionDiagnosticCodes,
187
+ remoteDiagnosticCodes,
188
188
  runtimeDiagnosticCodes,
189
189
  type SecretDiagnosticCode,
190
190
  type ShareDiagnosticCode,
@@ -219,6 +219,7 @@ export {
219
219
  type DiagnosticSpec,
220
220
  docsUrl,
221
221
  } from "./diagnostics/spec.ts";
222
+ export { Duration, durationMs } from "./duration.ts";
222
223
  export {
223
224
  CSRF_HEADER,
224
225
  checkRequest,
@@ -233,16 +234,20 @@ export {
233
234
  safePath,
234
235
  } from "./hygiene.ts";
235
236
  export {
237
+ AccountId,
236
238
  ArtifactId,
237
239
  CommentId,
238
240
  Cursor,
239
241
  DeliveryId,
240
242
  type GeneratedIdKind,
243
+ HomeId,
241
244
  type Id,
242
245
  type IdBody,
243
246
  type IdKind,
244
247
  type IdPrefix,
248
+ LinkId,
245
249
  MutationId,
250
+ RouteId,
246
251
  RunId,
247
252
  ShareId,
248
253
  SubmissionId,
@@ -260,6 +265,7 @@ export {
260
265
  DeliveryStatus,
261
266
  DocumentRevision,
262
267
  EventFilter,
268
+ EventOrigin,
263
269
  EventRecord,
264
270
  EventTypePattern,
265
271
  FIELD_ID_MAX_LENGTH,
@@ -288,7 +294,14 @@ export {
288
294
  ArtifactLink,
289
295
  ArtifactManifest,
290
296
  type DemoSpec,
297
+ HOSTED_OFFLINE_LIMIT_DEFAULT,
298
+ HOSTED_OFFLINE_LIMIT_MAX_MS,
299
+ HostedSettings,
300
+ manifestProblem,
291
301
  SubmissionPolicy,
302
+ TALLY_CHOICES_MAX,
303
+ TALLY_CHOICES_MIN,
304
+ TallySpec,
292
305
  type TerminalSpec,
293
306
  } from "./manifest.ts";
294
307
  export {
@@ -304,17 +317,34 @@ export {
304
317
  type ArtifactCreateResult,
305
318
  artifactCreateMethod,
306
319
  } from "./methods/artifact/create.ts";
320
+ export {
321
+ type ArtifactExportParams,
322
+ type ArtifactExportResult,
323
+ artifactExportMethod,
324
+ ExportClass,
325
+ } from "./methods/artifact/export.ts";
307
326
  export {
308
327
  type ArtifactGetParams,
309
328
  type ArtifactGetResult,
310
329
  artifactGetMethod,
311
330
  } from "./methods/artifact/get.ts";
331
+ export {
332
+ type ArtifactImportParams,
333
+ type ArtifactImportResult,
334
+ artifactImportMethod,
335
+ } from "./methods/artifact/import.ts";
312
336
  export {
313
337
  type ArtifactListFilter,
314
338
  type ArtifactListParams,
315
339
  type ArtifactListResult,
316
340
  artifactListMethod,
317
341
  } from "./methods/artifact/list.ts";
342
+ export {
343
+ type ArtifactPauseParams,
344
+ type ArtifactPauseResult,
345
+ artifactPauseMethod,
346
+ type PausedBy,
347
+ } from "./methods/artifact/pause.ts";
318
348
  export {
319
349
  type ArtifactPublishParams,
320
350
  type ArtifactPublishResult,
@@ -372,6 +402,19 @@ export {
372
402
  type GcVersion,
373
403
  gcRunMethod,
374
404
  } from "./methods/gc/run.ts";
405
+ export {
406
+ type HostedPushParams,
407
+ type HostedPushResult,
408
+ HostedRoute,
409
+ hostedPushMethod,
410
+ type ListingEntry,
411
+ VersionPush,
412
+ } from "./methods/hosted/push.ts";
413
+ export {
414
+ type HostedSubmissionParams,
415
+ type HostedSubmissionResult,
416
+ hostedSubmissionMethod,
417
+ } from "./methods/hosted/submission.ts";
375
418
  export { hostMethods, hostNotifications } from "./methods/index.ts";
376
419
  export {
377
420
  type InstanceCheck,
@@ -426,6 +469,41 @@ export {
426
469
  type PortIdentityResolveResult,
427
470
  portIdentityResolveMethod,
428
471
  } from "./methods/port/identity-resolve.ts";
472
+ export {
473
+ type PortRelayAuthorParams,
474
+ type PortRelayAuthorResult,
475
+ portRelayAuthorMethod,
476
+ RELAY_AUTHOR_METHODS,
477
+ type RelayAuthorMethod,
478
+ } from "./methods/port/relay-author.ts";
479
+ export {
480
+ type PortRelayCallParams,
481
+ type PortRelayCallResult,
482
+ portRelayCallMethod,
483
+ } from "./methods/port/relay-call.ts";
484
+ export {
485
+ type PortRelayCancelParams,
486
+ type PortRelayCancelResult,
487
+ portRelayCancelMethod,
488
+ } from "./methods/port/relay-cancel.ts";
489
+ export {
490
+ type PortRelayLiveParams,
491
+ type PortRelayLiveResult,
492
+ portRelayLiveMethod,
493
+ } from "./methods/port/relay-live.ts";
494
+ export {
495
+ type PortRelayReconcileParams,
496
+ type PortRelayReconcileResult,
497
+ portRelayReconcileMethod,
498
+ type RelayHeld,
499
+ type RelayReconciled,
500
+ } from "./methods/port/relay-reconcile.ts";
501
+ export {
502
+ type PortRelayRunParams,
503
+ type PortRelayRunResult,
504
+ portRelayRunMethod,
505
+ RelayViewer,
506
+ } from "./methods/port/relay-run.ts";
429
507
  export {
430
508
  type PortSecretsGetParams,
431
509
  type PortSecretsGetResult,
@@ -446,6 +524,57 @@ export {
446
524
  type PortTrustedControlsPolicyResult,
447
525
  portTrustedControlsPolicyMethod,
448
526
  } from "./methods/port/trusted-controls-policy.ts";
527
+ export {
528
+ type RelayCallBatchParams,
529
+ type RelayCallBatchResult,
530
+ relayCallBatchMethod,
531
+ } from "./methods/relay/call-batch.ts";
532
+ export {
533
+ type RelayEffectParams,
534
+ type RelayEffectResult,
535
+ relayEffectMethod,
536
+ } from "./methods/relay/effect.ts";
537
+ export {
538
+ type RelayLiveValueParams,
539
+ type RelayLiveValueResult,
540
+ relayLiveValueMethod,
541
+ } from "./methods/relay/live-value.ts";
542
+ export {
543
+ type RelayRunEnd,
544
+ type RelayRunUpdateParams,
545
+ type RelayRunUpdateResult,
546
+ relayRunUpdateMethod,
547
+ } from "./methods/relay/run-update.ts";
548
+ export {
549
+ type RemoteLinkParams,
550
+ type RemoteLinkResult,
551
+ remoteLinkMethod,
552
+ } from "./methods/remote/link.ts";
553
+ export {
554
+ type RemoteLoginParams,
555
+ type RemoteLoginResult,
556
+ remoteLoginMethod,
557
+ } from "./methods/remote/login.ts";
558
+ export {
559
+ type RemoteLoginWaitParams,
560
+ type RemoteLoginWaitResult,
561
+ remoteLoginWaitMethod,
562
+ } from "./methods/remote/login-wait.ts";
563
+ export {
564
+ type RemoteLogoutParams,
565
+ type RemoteLogoutResult,
566
+ remoteLogoutMethod,
567
+ } from "./methods/remote/logout.ts";
568
+ export {
569
+ type RemoteStatusParams,
570
+ type RemoteStatusResult,
571
+ remoteStatusMethod,
572
+ } from "./methods/remote/status.ts";
573
+ export {
574
+ type RemoteTokenParams,
575
+ type RemoteTokenResult,
576
+ remoteTokenMethod,
577
+ } from "./methods/remote/token.ts";
449
578
  export {
450
579
  type ResultsGetParams,
451
580
  type ResultsGetResult,
@@ -526,6 +655,12 @@ export {
526
655
  waitMethod,
527
656
  } from "./methods/wait/wait.ts";
528
657
  export { receivable } from "./receive.ts";
658
+ export {
659
+ OwnerLinkInfo,
660
+ RemoteLink,
661
+ type RemoteLinkState,
662
+ ServerOrigin,
663
+ } from "./remote.ts";
529
664
  export {
530
665
  HOST_PROTOCOL_REVISIONS,
531
666
  negotiateRevision,
@@ -23,7 +23,11 @@ export { ControlsPolicy, SubmitChannel, TrustedControl } from "./view.ts";
23
23
  // ── Viewers and actors ────────────────────────────────────────────────────────────────────
24
24
 
25
25
  /** How Mostra knows a viewer (DATA_MODEL §3 `viewer.kind`). */
26
- export type ViewerKind = "local" | "tailnet" | "token" | "host";
26
+ /**
27
+ * How Mostra knows a viewer: `account` and `anonymous` are hosted links' (a signed-in person, and
28
+ * one per browser who isn't signed in, D165 item 8).
29
+ */
30
+ export type ViewerKind = "local" | "tailnet" | "token" | "host" | "account" | "anonymous";
27
31
 
28
32
  /**
29
33
  * A person who views an artifact (PRODUCT vocabulary). The home's local user is one viewer of kind
@@ -38,15 +42,21 @@ export interface Viewer {
38
42
  readonly name?: string;
39
43
  /** The host's own key for this person, as given to `view/url` (D104). */
40
44
  readonly ref?: string;
45
+ /**
46
+ * Whether an identity provider verified the name: `true` for a signed-in account, `false` for an
47
+ * anonymous viewer's self-chosen name (hosted links, D165 item 8). Absent for other kinds.
48
+ */
49
+ readonly verified?: boolean;
41
50
  }
42
51
 
43
52
  /** The Zod schema of the `Viewer` type. */
44
53
  export const Viewer: z.ZodType<Viewer> = z
45
54
  .object({
46
55
  id: ViewerId.schema,
47
- kind: z.enum(["local", "tailnet", "token", "host"]),
56
+ kind: z.enum(["local", "tailnet", "token", "host", "account", "anonymous"]),
48
57
  name: z.string().exactOptional(),
49
58
  ref: z.string().exactOptional(),
59
+ verified: z.boolean().exactOptional(),
50
60
  })
51
61
  .register(wireRegistry, {
52
62
  id: "Viewer",
@@ -263,6 +273,36 @@ export const MutationResult: z.ZodType<MutationResult> = z
263
273
 
264
274
  // ── Events ────────────────────────────────────────────────────────────────────────────────
265
275
 
276
+ /**
277
+ * Where an owner instance's copy of a hosted record came from (INTERFACES §18.2, D165 item 1): the
278
+ * server, the hosted home, its incarnation and the record's cursor there (a submission's is the
279
+ * cursor of its `submission.created`).
280
+ */
281
+ export interface EventOrigin {
282
+ /** The server's API origin. */
283
+ readonly server: string;
284
+ /** The hosted home's `hom_` ID. */
285
+ readonly home: string;
286
+ /** The hosted home's incarnation when the record was copied. */
287
+ readonly incarnation: string;
288
+ /** The record's cursor in the hosted home. */
289
+ readonly cursor: Cursor;
290
+ }
291
+
292
+ /** The Zod schema of the `EventOrigin` type. */
293
+ export const EventOrigin: z.ZodType<EventOrigin> = z
294
+ .object({
295
+ server: z.string().min(1),
296
+ home: z.string().min(1),
297
+ incarnation: z.string().min(1),
298
+ cursor: Cursor.schema,
299
+ })
300
+ .register(wireRegistry, {
301
+ id: "EventOrigin",
302
+ description:
303
+ "Where an owner's copy of a hosted record came from: server, home, incarnation, cursor.",
304
+ }) as z.ZodType<EventOrigin>;
305
+
266
306
  /**
267
307
  * One durable event (DATA_MODEL §4). Its cursor is its stable ID and its place in the home-wide
268
308
  * order; `seq` orders an artifact's own events without gaps.
@@ -284,6 +324,8 @@ export interface EventRecord {
284
324
  readonly causation?: Readonly<Record<string, string>>;
285
325
  /** The event's data; sensitive field values are redacted (D52). */
286
326
  readonly payload: Readonly<Record<string, unknown>>;
327
+ /** For an event an owner instance copied from its hosted home: where it came from. */
328
+ readonly origin?: EventOrigin;
287
329
  }
288
330
 
289
331
  /** The Zod schema of the `EventRecord` type. */
@@ -297,6 +339,7 @@ export const EventRecord: z.ZodType<EventRecord> = z
297
339
  actor: Actor,
298
340
  causation: z.record(z.string(), z.string()).exactOptional(),
299
341
  payload: z.record(z.string(), z.unknown()),
342
+ origin: EventOrigin.exactOptional(),
300
343
  })
301
344
  .register(wireRegistry, {
302
345
  id: "EventRecord",
@@ -553,6 +596,8 @@ export interface Results {
553
596
  readonly digest: string;
554
597
  readonly delivery: DeliveryState;
555
598
  readonly deliveries: readonly DeliveryStatus[];
599
+ /** For a submission imported from a hosted home: where it came from (D165 item 1). */
600
+ readonly origin?: EventOrigin;
556
601
  };
557
602
  /** The draft's fields by ID, dotted IDs nested (D52). */
558
603
  readonly answers: Readonly<Record<string, unknown>>;
@@ -669,6 +714,7 @@ export const Results: z.ZodType<Results> = z
669
714
  digest: z.string().regex(/^[0-9a-f]{64}$/),
670
715
  delivery: z.enum(["pending", "delivered", "rejected", "undeliverable"]),
671
716
  deliveries: z.array(DeliveryStatus).readonly(),
717
+ origin: EventOrigin.exactOptional(),
672
718
  }),
673
719
  answers: z.record(z.string(), z.unknown()),
674
720
  fields: z
package/src/manifest.ts CHANGED
@@ -9,6 +9,11 @@
9
9
  * ```
10
10
  */
11
11
  import * as z from "zod";
12
+ import { Duration, durationMs } from "./duration.ts";
13
+ import { SubmissionPolicy } from "./policy.ts";
14
+
15
+ export { SubmissionPolicy };
16
+
12
17
  import { ArtifactId } from "./ids.ts";
13
18
  import { wireRegistry } from "./wire-registry.ts";
14
19
 
@@ -33,15 +38,6 @@ export interface ArtifactLink {
33
38
  readonly artifact: string;
34
39
  }
35
40
 
36
- /**
37
- * The submission policy an artifact requests (D10, D39, D63). The host decides the policy in force;
38
- * the manifest only asks for one.
39
- */
40
- export type SubmissionPolicy =
41
- | { readonly policy: "once"; readonly scope?: "per-artifact" | "per-viewer" }
42
- | { readonly policy: "epochs" }
43
- | { readonly policy: "none" };
44
-
45
41
  /** A live terminal session the artifact declares (ROUND-3 §5.1, D65). */
46
42
  export interface TerminalSpec {
47
43
  /** The program and its arguments. */
@@ -68,6 +64,47 @@ export type DemoSpec =
68
64
  }
69
65
  | { readonly attach: number; readonly bridge?: boolean };
70
66
 
67
+ /**
68
+ * A count by choice the artifact opts into (D165 item 12, RM-07): every accepted submission adds
69
+ * one to the choice its viewer-scoped `field` holds, counted in the submit transaction, and viewers
70
+ * read the counts with `useLive("$tally/<field>")`. A value outside `choices`, or none, counts
71
+ * nothing, so free text is never shown.
72
+ */
73
+ export interface TallySpec {
74
+ /** The viewer-scoped field whose value is counted. */
75
+ readonly field: string;
76
+ /** The values counted: 2 to 50 distinct strings. */
77
+ readonly choices: readonly string[];
78
+ /** Below this many answers (default 0), viewers see only the total, never the counts. */
79
+ readonly minTotal?: number;
80
+ }
81
+
82
+ /** How the artifact behaves on a remote server (D165, INTERFACES §18). */
83
+ export interface HostedSettings {
84
+ /**
85
+ * Relayed action runs while the owner instance is away (D165 item 4): `queue` (the default)
86
+ * waits up to `limit` (default `24h`, at most `7d`), `fail` ends a run at once.
87
+ */
88
+ readonly offline?: { readonly actions?: "queue" | "fail"; readonly limit?: Duration };
89
+ /** Who may trigger relayed actions (D159): `signed-in` (the default) or anyone with the `link`. */
90
+ readonly actions?: "signed-in" | "link";
91
+ /** Who may submit (D165 item 13): anyone with the `link` (the default), or `signed-in` viewers. */
92
+ readonly submissions?: "link" | "signed-in";
93
+ /** Link previews (D161): `generic` (the default) or the artifact's `title`. */
94
+ readonly preview?: "generic" | "title";
95
+ }
96
+
97
+ /** The longest offline limit a hosted artifact may set: 7 days (D165 item 4). */
98
+ export const HOSTED_OFFLINE_LIMIT_MAX_MS: number = 7 * 24 * 60 * 60 * 1000;
99
+
100
+ /** The offline limit of a hosted artifact that sets none: 24 hours (D165 item 4). */
101
+ export const HOSTED_OFFLINE_LIMIT_DEFAULT: Duration = "24h";
102
+
103
+ /** The fewest and most choices a tally counts (INTERFACES §18.4). */
104
+ export const TALLY_CHOICES_MIN = 2;
105
+ /** The most choices a tally counts. */
106
+ export const TALLY_CHOICES_MAX = 50;
107
+
71
108
  /** The artifact manifest (INTERFACES §2.2). Every field except `title` is optional. */
72
109
  export interface ArtifactManifest {
73
110
  /** The artifact's ID. Written by `mostra new`; without one, the artifact is bound to its source path at first publish (D51). */
@@ -103,6 +140,10 @@ export interface ArtifactManifest {
103
140
  readonly extraChecks?: readonly string[];
104
141
  readonly smoke?: boolean;
105
142
  };
143
+ /** Counts by choice of fixed-choice fields (D165 item 12). */
144
+ readonly tally?: readonly TallySpec[];
145
+ /** How the artifact behaves on a remote server (D165). */
146
+ readonly hosted?: HostedSettings;
106
147
  }
107
148
 
108
149
  /** The keys of the artifact manifest, in INTERFACES §2.2 order. Other keys are warnings (FAILURE_MODEL §10). */
@@ -119,6 +160,8 @@ export const ARTIFACT_MANIFEST_KEYS: readonly (keyof ArtifactManifest)[] = [
119
160
  "demos",
120
161
  "limits",
121
162
  "verify",
163
+ "tally",
164
+ "hosted",
122
165
  ];
123
166
 
124
167
  const strings = z.array(z.string()).readonly();
@@ -131,21 +174,6 @@ export const ArtifactLink: z.ZodType<ArtifactLink> = z
131
174
  description: "A related artifact: how this one relates (rel) and the other artifact's ID.",
132
175
  });
133
176
 
134
- /** The Zod schema of the `SubmissionPolicy` type. */
135
- export const SubmissionPolicy: z.ZodType<SubmissionPolicy> = z
136
- .discriminatedUnion("policy", [
137
- z.object({
138
- policy: z.literal("once"),
139
- scope: z.enum(["per-artifact", "per-viewer"]).exactOptional(),
140
- }),
141
- z.object({ policy: z.literal("epochs") }),
142
- z.object({ policy: z.literal("none") }),
143
- ])
144
- .register(wireRegistry, {
145
- id: "SubmissionPolicy",
146
- description: "A submission policy: once (per-artifact or per-viewer), epochs, or none.",
147
- });
148
-
149
177
  const TerminalSpec: z.ZodType<TerminalSpec> = z.object({
150
178
  command: z.array(z.string()).min(1).readonly(),
151
179
  cwd: z.string().exactOptional(),
@@ -165,6 +193,42 @@ const DemoSpec: z.ZodType<DemoSpec> = z.union([
165
193
  z.object({ attach: z.int().min(1).max(65535), bridge: z.boolean().exactOptional() }),
166
194
  ]);
167
195
 
196
+ /** The Zod schema of the `TallySpec` type. */
197
+ export const TallySpec: z.ZodType<TallySpec> = z
198
+ .object({
199
+ field: z.string().min(1).max(256),
200
+ choices: z
201
+ .array(z.string().min(1).max(256))
202
+ .min(TALLY_CHOICES_MIN)
203
+ .max(TALLY_CHOICES_MAX)
204
+ .readonly(),
205
+ minTotal: z.int().min(0).exactOptional(),
206
+ })
207
+ .register(wireRegistry, {
208
+ id: "TallySpec",
209
+ description:
210
+ "A count by choice of a viewer-scoped field: its field, 2 to 50 distinct choices and minTotal.",
211
+ });
212
+
213
+ /** The Zod schema of the `HostedSettings` type. */
214
+ export const HostedSettings: z.ZodType<HostedSettings> = z
215
+ .object({
216
+ offline: z
217
+ .object({
218
+ actions: z.enum(["queue", "fail"]).exactOptional(),
219
+ limit: Duration.exactOptional(),
220
+ })
221
+ .exactOptional(),
222
+ actions: z.enum(["signed-in", "link"]).exactOptional(),
223
+ submissions: z.enum(["link", "signed-in"]).exactOptional(),
224
+ preview: z.enum(["generic", "title"]).exactOptional(),
225
+ })
226
+ .register(wireRegistry, {
227
+ id: "HostedSettings",
228
+ description:
229
+ "How an artifact behaves on a remote server: offline actions, who may act and submit, previews.",
230
+ });
231
+
168
232
  /** The Zod schema of the `ArtifactManifest` type. Objects stay open, so newer keys pass through. */
169
233
  export const ArtifactManifest: z.ZodType<ArtifactManifest> = z
170
234
  .object({
@@ -198,9 +262,36 @@ export const ArtifactManifest: z.ZodType<ArtifactManifest> = z
198
262
  smoke: z.boolean().exactOptional(),
199
263
  })
200
264
  .exactOptional(),
265
+ tally: z.array(TallySpec).readonly().exactOptional(),
266
+ hosted: HostedSettings.exactOptional(),
201
267
  })
202
268
  .register(wireRegistry, {
203
269
  id: "ArtifactManifest",
204
270
  description:
205
271
  "The artifact manifest (INTERFACES §2.2): literal metadata from the entry's defineArtifact call or MDX frontmatter.",
206
272
  });
273
+
274
+ /**
275
+ * The rules of a manifest that JSON Schema can't state, checked after its schema by everything
276
+ * that reads a manifest (D165 items 4, 12): a tally's choices are distinct, each field is tallied
277
+ * once, and an offline limit is at most 7 days. Answers the first problem, with its field's path.
278
+ */
279
+ export function manifestProblem(
280
+ manifest: ArtifactManifest,
281
+ ): { readonly path: string; readonly message: string } | undefined {
282
+ const fields = new Set<string>();
283
+ for (const [index, tally] of (manifest.tally ?? []).entries()) {
284
+ if (new Set(tally.choices).size !== tally.choices.length) {
285
+ return { path: `tally.${index}.choices`, message: "a tally's choices must be distinct" };
286
+ }
287
+ if (fields.has(tally.field)) {
288
+ return { path: `tally.${index}.field`, message: `\`${tally.field}\` is tallied twice` };
289
+ }
290
+ fields.add(tally.field);
291
+ }
292
+ const limit = manifest.hosted?.offline?.limit;
293
+ if (limit !== undefined && durationMs(limit) > HOSTED_OFFLINE_LIMIT_MAX_MS) {
294
+ return { path: "hosted.offline.limit", message: "an offline limit is at most 7d" };
295
+ }
296
+ return undefined;
297
+ }
@@ -0,0 +1,68 @@
1
+ import * as z from "zod";
2
+ import { ArtifactRef } from "../../artifact.ts";
3
+ import { defineMethod, type MethodDefinition } from "../../method.ts";
4
+ import { wireRegistry } from "../../wire-registry.ts";
5
+
6
+ /**
7
+ * An export class (ARCHITECTURE §3, VR-07). `bundle` is the portable artifact package (RM-01,
8
+ * WP-29); WP-24 adds `static`, `html` and `snapshot`, and WP-17 `mcp-app`, additively.
9
+ */
10
+ export type ExportClass = "bundle";
11
+
12
+ /** The Zod schema of the `ExportClass` type. */
13
+ export const ExportClass: z.ZodType<ExportClass> = z
14
+ .enum(["bundle"])
15
+ .register(wireRegistry, { id: "ExportClass", description: "An export class (VR-07)." });
16
+
17
+ /** The params of `artifact/export` (INTERFACES §6, §15). */
18
+ export interface ArtifactExportParams {
19
+ /** The artifact: its ID, or a source path it was published from. */
20
+ readonly artifact: ArtifactRef;
21
+ /** The version: a number or a version ID; the latest when absent. */
22
+ readonly version?: number | string;
23
+ /** What to write. */
24
+ readonly as: ExportClass;
25
+ /**
26
+ * Where: an absolute path. A bundle is a directory there, or one archive when the path ends in
27
+ * `.tar.zst`. It must not exist yet, or be an empty directory.
28
+ */
29
+ readonly out: string;
30
+ }
31
+
32
+ /** The result of `artifact/export`. */
33
+ export interface ArtifactExportResult {
34
+ /** What it wrote, as absolute paths: the bundle's directory or archive. */
35
+ readonly files: readonly string[];
36
+ /** The version exported. */
37
+ readonly versionId: string;
38
+ }
39
+
40
+ const params: z.ZodType<ArtifactExportParams> = z
41
+ .object({
42
+ artifact: ArtifactRef,
43
+ version: z.union([z.int().min(1), z.string().min(1)]).exactOptional(),
44
+ as: ExportClass,
45
+ out: z.string().min(1),
46
+ })
47
+ .register(wireRegistry, { id: "ArtifactExportParams" });
48
+
49
+ const result: z.ZodType<ArtifactExportResult> = z
50
+ .object({
51
+ files: z.array(z.string()).readonly(),
52
+ versionId: z.string(),
53
+ })
54
+ .register(wireRegistry, { id: "ArtifactExportResult" });
55
+
56
+ /**
57
+ * `artifact/export`: writes a published version out of the home. A `bundle` carries the version's
58
+ * builds, manifest, lockfile and source snapshot, so `artifact/import` (`mostra run <bundle>`) in
59
+ * another home makes it the same version, with the same artifact and version IDs (RM-01).
60
+ */
61
+ export const artifactExportMethod: MethodDefinition<ArtifactExportParams, ArtifactExportResult> =
62
+ defineMethod({
63
+ method: "artifact/export",
64
+ direction: "client-to-instance",
65
+ mutating: false,
66
+ params,
67
+ result,
68
+ });
@@ -0,0 +1,39 @@
1
+ import * as z from "zod";
2
+ import { PublishReceipt } from "../../artifact.ts";
3
+ import { defineMethod, type MethodDefinition } from "../../method.ts";
4
+ import { wireRegistry } from "../../wire-registry.ts";
5
+
6
+ /** The params of `artifact/import` (INTERFACES §15). */
7
+ export interface ArtifactImportParams {
8
+ /** A bundle `artifact/export` wrote: its directory or its `.tar.zst` archive, as an absolute path. */
9
+ readonly bundle: string;
10
+ /** Makes retries idempotent: a repeated `requestId` returns the recorded result (H-03). */
11
+ readonly requestId?: string;
12
+ }
13
+
14
+ /**
15
+ * The result of `artifact/import`: the receipt of the version it made, or found (`reused`), with
16
+ * the bundle's artifact and version IDs.
17
+ */
18
+ export type ArtifactImportResult = PublishReceipt;
19
+
20
+ const params: z.ZodType<ArtifactImportParams> = z
21
+ .object({
22
+ bundle: z.string().min(1),
23
+ requestId: z.string().min(1).exactOptional(),
24
+ })
25
+ .register(wireRegistry, { id: "ArtifactImportParams" });
26
+
27
+ /**
28
+ * `artifact/import`: makes a portable bundle a published version of this home (RM-01; the CLI's
29
+ * `mostra run <bundle>`): the same artifact ID, version ID and digests, checked against the
30
+ * bundle's files before anything is kept. Its server code runs here, against the bundle's lockfile.
31
+ */
32
+ export const artifactImportMethod: MethodDefinition<ArtifactImportParams, ArtifactImportResult> =
33
+ defineMethod({
34
+ method: "artifact/import",
35
+ direction: "client-to-instance",
36
+ mutating: true,
37
+ params,
38
+ result: PublishReceipt,
39
+ });