@mostra/protocol 0.8.0 → 0.10.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 (224) 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 +5 -0
  10. package/dist/browser.d.ts.map +1 -1
  11. package/dist/browser.js +7 -2
  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/artifact.d.ts +1 -1
  18. package/dist/diagnostics/codes/artifact.d.ts.map +1 -1
  19. package/dist/diagnostics/codes/artifact.js +45 -1
  20. package/dist/diagnostics/codes/artifact.js.map +1 -1
  21. package/dist/diagnostics/codes/env.d.ts +1 -1
  22. package/dist/diagnostics/codes/env.d.ts.map +1 -1
  23. package/dist/diagnostics/codes/env.js +12 -1
  24. package/dist/diagnostics/codes/env.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 +99 -0
  36. package/dist/diagnostics/codes/remote.js.map +1 -0
  37. package/dist/diagnostics/codes/submit.js +3 -3
  38. package/dist/diagnostics/codes/submit.js.map +1 -1
  39. package/dist/diagnostics/diagnostic.d.ts +1 -1
  40. package/dist/diagnostics/diagnostic.d.ts.map +1 -1
  41. package/dist/diagnostics/diagnostic.js +2 -1
  42. package/dist/diagnostics/diagnostic.js.map +1 -1
  43. package/dist/duration.d.ts +13 -0
  44. package/dist/duration.d.ts.map +1 -0
  45. package/dist/duration.js +27 -0
  46. package/dist/duration.js.map +1 -0
  47. package/dist/hygiene.d.ts +4 -1
  48. package/dist/hygiene.d.ts.map +1 -1
  49. package/dist/hygiene.js +4 -0
  50. package/dist/hygiene.js.map +1 -1
  51. package/dist/ids.d.ts +17 -1
  52. package/dist/ids.d.ts.map +1 -1
  53. package/dist/ids.js +9 -1
  54. package/dist/ids.js.map +1 -1
  55. package/dist/index.d.ts +30 -8
  56. package/dist/index.js +30 -8
  57. package/dist/interaction.d.ts +28 -2
  58. package/dist/interaction.d.ts.map +1 -1
  59. package/dist/interaction.js +20 -5
  60. package/dist/interaction.js.map +1 -1
  61. package/dist/manifest.d.ts +59 -14
  62. package/dist/manifest.d.ts.map +1 -1
  63. package/dist/manifest.js +63 -15
  64. package/dist/manifest.js.map +1 -1
  65. package/dist/methods/artifact/export.d.ts +40 -0
  66. package/dist/methods/artifact/export.d.ts.map +1 -0
  67. package/dist/methods/artifact/export.js +36 -0
  68. package/dist/methods/artifact/export.js.map +1 -0
  69. package/dist/methods/artifact/import.d.ts +23 -0
  70. package/dist/methods/artifact/import.d.ts.map +1 -0
  71. package/dist/methods/artifact/import.js +25 -0
  72. package/dist/methods/artifact/import.js.map +1 -0
  73. package/dist/methods/artifact/publish.d.ts +2 -1
  74. package/dist/methods/artifact/publish.d.ts.map +1 -1
  75. package/dist/methods/artifact/publish.js +1 -1
  76. package/dist/methods/hosted/push.d.ts +76 -0
  77. package/dist/methods/hosted/push.d.ts.map +1 -0
  78. package/dist/methods/hosted/push.js +71 -0
  79. package/dist/methods/hosted/push.js.map +1 -0
  80. package/dist/methods/hosted/submission.d.ts +18 -0
  81. package/dist/methods/hosted/submission.d.ts.map +1 -0
  82. package/dist/methods/hosted/submission.js +23 -0
  83. package/dist/methods/hosted/submission.js.map +1 -0
  84. package/dist/methods/index.d.ts.map +1 -1
  85. package/dist/methods/index.js +38 -2
  86. package/dist/methods/index.js.map +1 -1
  87. package/dist/methods/instance/status.d.ts +3 -0
  88. package/dist/methods/instance/status.d.ts.map +1 -1
  89. package/dist/methods/instance/status.js +3 -1
  90. package/dist/methods/instance/status.js.map +1 -1
  91. package/dist/methods/mostra/initialize.d.ts +17 -3
  92. package/dist/methods/mostra/initialize.d.ts.map +1 -1
  93. package/dist/methods/mostra/initialize.js +11 -3
  94. package/dist/methods/mostra/initialize.js.map +1 -1
  95. package/dist/methods/port/relay-call.d.ts +33 -0
  96. package/dist/methods/port/relay-call.d.ts.map +1 -0
  97. package/dist/methods/port/relay-call.js +31 -0
  98. package/dist/methods/port/relay-call.js.map +1 -0
  99. package/dist/methods/port/relay-cancel.d.ts +16 -0
  100. package/dist/methods/port/relay-cancel.d.ts.map +1 -0
  101. package/dist/methods/port/relay-cancel.js +21 -0
  102. package/dist/methods/port/relay-cancel.js.map +1 -0
  103. package/dist/methods/port/relay-live.d.ts +25 -0
  104. package/dist/methods/port/relay-live.d.ts.map +1 -0
  105. package/dist/methods/port/relay-live.js +32 -0
  106. package/dist/methods/port/relay-live.js.map +1 -0
  107. package/dist/methods/port/relay-reconcile.d.ts +39 -0
  108. package/dist/methods/port/relay-reconcile.d.ts.map +1 -0
  109. package/dist/methods/port/relay-reconcile.js +35 -0
  110. package/dist/methods/port/relay-reconcile.js.map +1 -0
  111. package/dist/methods/port/relay-run.d.ts +47 -0
  112. package/dist/methods/port/relay-run.d.ts.map +1 -0
  113. package/dist/methods/port/relay-run.js +41 -0
  114. package/dist/methods/port/relay-run.js.map +1 -0
  115. package/dist/methods/port/submissions-deliver.d.ts +8 -0
  116. package/dist/methods/port/submissions-deliver.d.ts.map +1 -1
  117. package/dist/methods/port/submissions-deliver.js +4 -2
  118. package/dist/methods/port/submissions-deliver.js.map +1 -1
  119. package/dist/methods/relay/call-batch.d.ts +26 -0
  120. package/dist/methods/relay/call-batch.d.ts.map +1 -0
  121. package/dist/methods/relay/call-batch.js +30 -0
  122. package/dist/methods/relay/call-batch.js.map +1 -0
  123. package/dist/methods/relay/effect.d.ts +31 -0
  124. package/dist/methods/relay/effect.d.ts.map +1 -0
  125. package/dist/methods/relay/effect.js +30 -0
  126. package/dist/methods/relay/effect.js.map +1 -0
  127. package/dist/methods/relay/live-value.d.ts +33 -0
  128. package/dist/methods/relay/live-value.d.ts.map +1 -0
  129. package/dist/methods/relay/live-value.js +32 -0
  130. package/dist/methods/relay/live-value.js.map +1 -0
  131. package/dist/methods/relay/run-update.d.ts +46 -0
  132. package/dist/methods/relay/run-update.d.ts.map +1 -0
  133. package/dist/methods/relay/run-update.js +45 -0
  134. package/dist/methods/relay/run-update.js.map +1 -0
  135. package/dist/methods/remote/login-wait.d.ts +30 -0
  136. package/dist/methods/remote/login-wait.d.ts.map +1 -0
  137. package/dist/methods/remote/login-wait.js +36 -0
  138. package/dist/methods/remote/login-wait.js.map +1 -0
  139. package/dist/methods/remote/login.d.ts +41 -0
  140. package/dist/methods/remote/login.d.ts.map +1 -0
  141. package/dist/methods/remote/login.js +37 -0
  142. package/dist/methods/remote/login.js.map +1 -0
  143. package/dist/methods/remote/logout.d.ts +25 -0
  144. package/dist/methods/remote/logout.d.ts.map +1 -0
  145. package/dist/methods/remote/logout.js +28 -0
  146. package/dist/methods/remote/logout.js.map +1 -0
  147. package/dist/methods/remote/status.d.ts +14 -0
  148. package/dist/methods/remote/status.d.ts.map +1 -0
  149. package/dist/methods/remote/status.js +22 -0
  150. package/dist/methods/remote/status.js.map +1 -0
  151. package/dist/methods/remote/token.d.ts +19 -0
  152. package/dist/methods/remote/token.d.ts.map +1 -0
  153. package/dist/methods/remote/token.js +24 -0
  154. package/dist/methods/remote/token.js.map +1 -0
  155. package/dist/methods/share/start.d.ts +5 -2
  156. package/dist/methods/share/start.d.ts.map +1 -1
  157. package/dist/methods/share/start.js +6 -3
  158. package/dist/methods/share/start.js.map +1 -1
  159. package/dist/methods/state/patch.d.ts +7 -0
  160. package/dist/methods/state/patch.d.ts.map +1 -1
  161. package/dist/methods/state/patch.js +2 -1
  162. package/dist/methods/state/patch.js.map +1 -1
  163. package/dist/methods/view/url.d.ts +2 -1
  164. package/dist/methods/view/url.d.ts.map +1 -1
  165. package/dist/methods/view/url.js +2 -1
  166. package/dist/methods/view/url.js.map +1 -1
  167. package/dist/policy.d.ts +18 -0
  168. package/dist/policy.d.ts.map +1 -0
  169. package/dist/policy.js +23 -0
  170. package/dist/policy.js.map +1 -0
  171. package/dist/remote.d.ts +55 -0
  172. package/dist/remote.d.ts.map +1 -0
  173. package/dist/remote.js +52 -0
  174. package/dist/remote.js.map +1 -0
  175. package/dist/view.d.ts +1 -1
  176. package/dist/view.js +1 -1
  177. package/dist/view.js.map +1 -1
  178. package/package.json +2 -2
  179. package/schemas/protocol.draft-07.json +1607 -126
  180. package/schemas/protocol.schema.json +1543 -126
  181. package/src/actions.ts +45 -5
  182. package/src/browser.ts +6 -0
  183. package/src/capability.ts +0 -23
  184. package/src/diagnostics/codes/artifact.ts +48 -0
  185. package/src/diagnostics/codes/env.ts +12 -0
  186. package/src/diagnostics/codes/home.ts +12 -0
  187. package/src/diagnostics/codes/index.ts +6 -2
  188. package/src/diagnostics/codes/remote.ts +113 -0
  189. package/src/diagnostics/codes/submit.ts +3 -3
  190. package/src/diagnostics/diagnostic.ts +3 -1
  191. package/src/duration.ts +29 -0
  192. package/src/hygiene.ts +12 -1
  193. package/src/ids.ts +33 -1
  194. package/src/index.ts +124 -8
  195. package/src/interaction.ts +42 -2
  196. package/src/manifest.ts +115 -24
  197. package/src/methods/artifact/export.ts +68 -0
  198. package/src/methods/artifact/import.ts +39 -0
  199. package/src/methods/hosted/push.ts +146 -0
  200. package/src/methods/hosted/submission.ts +34 -0
  201. package/src/methods/index.ts +36 -0
  202. package/src/methods/instance/status.ts +4 -0
  203. package/src/methods/mostra/initialize.ts +19 -3
  204. package/src/methods/port/relay-call.ts +58 -0
  205. package/src/methods/port/relay-cancel.ts +33 -0
  206. package/src/methods/port/relay-live.ts +48 -0
  207. package/src/methods/port/relay-reconcile.ts +71 -0
  208. package/src/methods/port/relay-run.ts +80 -0
  209. package/src/methods/port/submissions-deliver.ts +13 -1
  210. package/src/methods/relay/call-batch.ts +52 -0
  211. package/src/methods/relay/effect.ts +55 -0
  212. package/src/methods/relay/live-value.ts +54 -0
  213. package/src/methods/relay/run-update.ts +81 -0
  214. package/src/methods/remote/login-wait.ts +55 -0
  215. package/src/methods/remote/login.ts +72 -0
  216. package/src/methods/remote/logout.ts +42 -0
  217. package/src/methods/remote/status.ts +34 -0
  218. package/src/methods/remote/token.ts +39 -0
  219. package/src/methods/share/start.ts +12 -4
  220. package/src/methods/state/patch.ts +6 -0
  221. package/src/methods/view/url.ts +2 -1
  222. package/src/policy.ts +30 -0
  223. package/src/remote.ts +89 -0
  224. package/src/view.ts +1 -1
@@ -1,5 +1,7 @@
1
1
  import { artifactCreateMethod } from "./artifact/create.js";
2
+ import { artifactExportMethod } from "./artifact/export.js";
2
3
  import { artifactGetMethod } from "./artifact/get.js";
4
+ import { artifactImportMethod } from "./artifact/import.js";
3
5
  import { artifactListMethod } from "./artifact/list.js";
4
6
  import { artifactPublishMethod } from "./artifact/publish.js";
5
7
  import { ARTIFACT_PROGRESS, ArtifactProgressParams } from "../verify.js";
@@ -12,6 +14,9 @@ import { eventsReadMethod } from "./events/read.js";
12
14
  import { EVENTS_NOTIFY, EventsNotifyParams, eventsSubscribeMethod } from "./events/subscribe.js";
13
15
  import { eventsUnsubscribeMethod } from "./events/unsubscribe.js";
14
16
  import { gcRunMethod } from "./gc/run.js";
17
+ import { hostedPushMethod } from "./hosted/push.js";
18
+ import { portSubmissionsDeliverMethod } from "./port/submissions-deliver.js";
19
+ import { hostedSubmissionMethod } from "./hosted/submission.js";
15
20
  import { instanceCheckMethod } from "./instance/check.js";
16
21
  import { mostraInitializeMethod } from "./mostra/initialize.js";
17
22
  import { shareStartMethod } from "./share/start.js";
@@ -21,10 +26,23 @@ import { mostraShutdownMethod } from "./mostra/shutdown.js";
21
26
  import { portAddressingExternalBaseMethod } from "./port/addressing-external-base.js";
22
27
  import { portDraftsMirrorMethod } from "./port/drafts-mirror.js";
23
28
  import { portIdentityResolveMethod } from "./port/identity-resolve.js";
29
+ import { portRelayRunMethod } from "./port/relay-run.js";
30
+ import { portRelayCallMethod } from "./port/relay-call.js";
31
+ import { portRelayCancelMethod } from "./port/relay-cancel.js";
32
+ import { portRelayLiveMethod } from "./port/relay-live.js";
33
+ import { portRelayReconcileMethod } from "./port/relay-reconcile.js";
24
34
  import { portSecretsGetMethod } from "./port/secrets-get.js";
25
- import { portSubmissionsDeliverMethod } from "./port/submissions-deliver.js";
26
35
  import { portTrustedControlsActivatedMethod } from "./port/trusted-controls-activated.js";
27
36
  import { portTrustedControlsPolicyMethod } from "./port/trusted-controls-policy.js";
37
+ import { relayCallBatchMethod } from "./relay/call-batch.js";
38
+ import { relayEffectMethod } from "./relay/effect.js";
39
+ import { relayLiveValueMethod } from "./relay/live-value.js";
40
+ import { relayRunUpdateMethod } from "./relay/run-update.js";
41
+ import { remoteLoginMethod } from "./remote/login.js";
42
+ import { remoteLoginWaitMethod } from "./remote/login-wait.js";
43
+ import { remoteLogoutMethod } from "./remote/logout.js";
44
+ import { remoteStatusMethod } from "./remote/status.js";
45
+ import { remoteTokenMethod } from "./remote/token.js";
28
46
  import { resultsGetMethod } from "./results/get.js";
29
47
  import { secretDeleteMethod } from "./secret/delete.js";
30
48
  import { secretSetMethod } from "./secret/set.js";
@@ -81,7 +99,25 @@ const hostMethods = [
81
99
  shareStartMethod,
82
100
  shareStopMethod,
83
101
  shareListMethod,
84
- portAddressingExternalBaseMethod
102
+ portAddressingExternalBaseMethod,
103
+ artifactExportMethod,
104
+ artifactImportMethod,
105
+ remoteLoginMethod,
106
+ remoteLoginWaitMethod,
107
+ remoteLogoutMethod,
108
+ remoteStatusMethod,
109
+ remoteTokenMethod,
110
+ hostedPushMethod,
111
+ portRelayRunMethod,
112
+ portRelayCancelMethod,
113
+ portRelayReconcileMethod,
114
+ portRelayCallMethod,
115
+ relayRunUpdateMethod,
116
+ relayCallBatchMethod,
117
+ relayEffectMethod,
118
+ portRelayLiveMethod,
119
+ relayLiveValueMethod,
120
+ hostedSubmissionMethod
85
121
  ];
86
122
  /** Every notification the instance sends to its clients (INTERFACES §6). */
87
123
  const hostNotifications = [
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../src/methods/index.ts"],"sourcesContent":["/**\n * Every host protocol method this package defines. `pnpm gen protocol-method` adds entries at the\n * markers; the method itself lives in its own module under `methods/<group>/`.\n */\nimport type { AnyMethod, AnyNotification } from \"../method.ts\";\nimport { ARTIFACT_PROGRESS, ArtifactProgressParams } from \"../verify.ts\";\nimport { artifactCreateMethod } from \"./artifact/create.ts\";\nimport { artifactGetMethod } from \"./artifact/get.ts\";\nimport { artifactListMethod } from \"./artifact/list.ts\";\nimport { artifactPublishMethod } from \"./artifact/publish.ts\";\nimport { artifactVerifyMethod } from \"./artifact/verify.ts\";\nimport { depsAddMethod } from \"./deps/add.ts\";\nimport { DEV_NOTIFY, DevNotifyParams, devStartMethod } from \"./dev/start.ts\";\nimport { devStopMethod } from \"./dev/stop.ts\";\nimport { eventsAckMethod } from \"./events/ack.ts\";\nimport { eventsReadMethod } from \"./events/read.ts\";\nimport { EVENTS_NOTIFY, EventsNotifyParams, eventsSubscribeMethod } from \"./events/subscribe.ts\";\nimport { eventsUnsubscribeMethod } from \"./events/unsubscribe.ts\";\nimport { gcRunMethod } from \"./gc/run.ts\";\nimport { instanceCheckMethod } from \"./instance/check.ts\";\nimport { instanceStatusMethod } from \"./instance/status.ts\";\nimport { livePushMethod } from \"./live/push.ts\";\nimport { mostraInitializeMethod } from \"./mostra/initialize.ts\";\nimport { mostraShutdownMethod } from \"./mostra/shutdown.ts\";\nimport { portAddressingExternalBaseMethod } from \"./port/addressing-external-base.ts\";\nimport { portDraftsMirrorMethod } from \"./port/drafts-mirror.ts\";\nimport { portIdentityResolveMethod } from \"./port/identity-resolve.ts\";\nimport { portSecretsGetMethod } from \"./port/secrets-get.ts\";\nimport { portSubmissionsDeliverMethod } from \"./port/submissions-deliver.ts\";\nimport { portTrustedControlsActivatedMethod } from \"./port/trusted-controls-activated.ts\";\nimport { portTrustedControlsPolicyMethod } from \"./port/trusted-controls-policy.ts\";\nimport { resultsGetMethod } from \"./results/get.ts\";\nimport { secretDeleteMethod } from \"./secret/delete.ts\";\nimport { secretListMethod } from \"./secret/list.ts\";\nimport { secretSetMethod } from \"./secret/set.ts\";\nimport { shareListMethod } from \"./share/list.ts\";\nimport { shareStartMethod } from \"./share/start.ts\";\nimport { shareStopMethod } from \"./share/stop.ts\";\nimport { stateGetMethod } from \"./state/get.ts\";\nimport { statePatchMethod } from \"./state/patch.ts\";\nimport { viewDefaultMethod } from \"./view/default.ts\";\nimport { viewLaunchMethod } from \"./view/launch.ts\";\nimport { viewRevokeMethod } from \"./view/revoke.ts\";\nimport { viewRotateMethod } from \"./view/rotate.ts\";\nimport { viewUrlMethod } from \"./view/url.ts\";\nimport { waitMethod } from \"./wait/wait.ts\";\n// gen:method-imports\n\n/** Every host protocol method, in the order they were added. */\nexport const hostMethods: readonly AnyMethod[] = [\n mostraInitializeMethod,\n mostraShutdownMethod,\n instanceStatusMethod,\n artifactCreateMethod,\n artifactPublishMethod,\n artifactListMethod,\n artifactGetMethod,\n depsAddMethod,\n viewUrlMethod,\n viewRevokeMethod,\n viewRotateMethod,\n stateGetMethod,\n resultsGetMethod,\n waitMethod,\n eventsReadMethod,\n eventsSubscribeMethod,\n eventsUnsubscribeMethod,\n statePatchMethod,\n eventsAckMethod,\n portSubmissionsDeliverMethod,\n portDraftsMirrorMethod,\n portTrustedControlsPolicyMethod,\n portTrustedControlsActivatedMethod,\n secretSetMethod,\n secretListMethod,\n secretDeleteMethod,\n livePushMethod,\n portSecretsGetMethod,\n artifactVerifyMethod,\n viewDefaultMethod,\n viewLaunchMethod,\n gcRunMethod,\n instanceCheckMethod,\n devStartMethod,\n devStopMethod,\n portIdentityResolveMethod,\n shareStartMethod,\n shareStopMethod,\n shareListMethod,\n portAddressingExternalBaseMethod,\n // gen:methods\n];\n\n/** Every notification the instance sends to its clients (INTERFACES §6). */\nexport const hostNotifications: readonly AnyNotification[] = [\n { method: EVENTS_NOTIFY, params: EventsNotifyParams as AnyNotification[\"params\"] },\n { method: ARTIFACT_PROGRESS, params: ArtifactProgressParams as AnyNotification[\"params\"] },\n { method: DEV_NOTIFY, params: DevNotifyParams as AnyNotification[\"params\"] },\n];\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiDA,MAAa,cAAoC;CAC/C;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AAEF;;AAGA,MAAa,oBAAgD;CAC3D;EAAE,QAAQ;EAAe,QAAQ;CAAgD;CACjF;EAAE,QAAQ;EAAmB,QAAQ;CAAoD;CACzF;EAAE,QAAQ;EAAY,QAAQ;CAA6C;AAC7E"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../src/methods/index.ts"],"sourcesContent":["/**\n * Every host protocol method this package defines. `pnpm gen protocol-method` adds entries at the\n * markers; the method itself lives in its own module under `methods/<group>/`.\n */\nimport type { AnyMethod, AnyNotification } from \"../method.ts\";\nimport { ARTIFACT_PROGRESS, ArtifactProgressParams } from \"../verify.ts\";\nimport { artifactCreateMethod } from \"./artifact/create.ts\";\nimport { artifactExportMethod } from \"./artifact/export.ts\";\nimport { artifactGetMethod } from \"./artifact/get.ts\";\nimport { artifactImportMethod } from \"./artifact/import.ts\";\nimport { artifactListMethod } from \"./artifact/list.ts\";\nimport { artifactPublishMethod } from \"./artifact/publish.ts\";\nimport { artifactVerifyMethod } from \"./artifact/verify.ts\";\nimport { depsAddMethod } from \"./deps/add.ts\";\nimport { DEV_NOTIFY, DevNotifyParams, devStartMethod } from \"./dev/start.ts\";\nimport { devStopMethod } from \"./dev/stop.ts\";\nimport { eventsAckMethod } from \"./events/ack.ts\";\nimport { eventsReadMethod } from \"./events/read.ts\";\nimport { EVENTS_NOTIFY, EventsNotifyParams, eventsSubscribeMethod } from \"./events/subscribe.ts\";\nimport { eventsUnsubscribeMethod } from \"./events/unsubscribe.ts\";\nimport { gcRunMethod } from \"./gc/run.ts\";\nimport { hostedPushMethod } from \"./hosted/push.ts\";\nimport { hostedSubmissionMethod } from \"./hosted/submission.ts\";\nimport { instanceCheckMethod } from \"./instance/check.ts\";\nimport { instanceStatusMethod } from \"./instance/status.ts\";\nimport { livePushMethod } from \"./live/push.ts\";\nimport { mostraInitializeMethod } from \"./mostra/initialize.ts\";\nimport { mostraShutdownMethod } from \"./mostra/shutdown.ts\";\nimport { portAddressingExternalBaseMethod } from \"./port/addressing-external-base.ts\";\nimport { portDraftsMirrorMethod } from \"./port/drafts-mirror.ts\";\nimport { portIdentityResolveMethod } from \"./port/identity-resolve.ts\";\nimport { portRelayCallMethod } from \"./port/relay-call.ts\";\nimport { portRelayCancelMethod } from \"./port/relay-cancel.ts\";\nimport { portRelayLiveMethod } from \"./port/relay-live.ts\";\nimport { portRelayReconcileMethod } from \"./port/relay-reconcile.ts\";\nimport { portRelayRunMethod } from \"./port/relay-run.ts\";\nimport { portSecretsGetMethod } from \"./port/secrets-get.ts\";\nimport { portSubmissionsDeliverMethod } from \"./port/submissions-deliver.ts\";\nimport { portTrustedControlsActivatedMethod } from \"./port/trusted-controls-activated.ts\";\nimport { portTrustedControlsPolicyMethod } from \"./port/trusted-controls-policy.ts\";\nimport { relayCallBatchMethod } from \"./relay/call-batch.ts\";\nimport { relayEffectMethod } from \"./relay/effect.ts\";\nimport { relayLiveValueMethod } from \"./relay/live-value.ts\";\nimport { relayRunUpdateMethod } from \"./relay/run-update.ts\";\nimport { remoteLoginMethod } from \"./remote/login.ts\";\nimport { remoteLoginWaitMethod } from \"./remote/login-wait.ts\";\nimport { remoteLogoutMethod } from \"./remote/logout.ts\";\nimport { remoteStatusMethod } from \"./remote/status.ts\";\nimport { remoteTokenMethod } from \"./remote/token.ts\";\nimport { resultsGetMethod } from \"./results/get.ts\";\nimport { secretDeleteMethod } from \"./secret/delete.ts\";\nimport { secretListMethod } from \"./secret/list.ts\";\nimport { secretSetMethod } from \"./secret/set.ts\";\nimport { shareListMethod } from \"./share/list.ts\";\nimport { shareStartMethod } from \"./share/start.ts\";\nimport { shareStopMethod } from \"./share/stop.ts\";\nimport { stateGetMethod } from \"./state/get.ts\";\nimport { statePatchMethod } from \"./state/patch.ts\";\nimport { viewDefaultMethod } from \"./view/default.ts\";\nimport { viewLaunchMethod } from \"./view/launch.ts\";\nimport { viewRevokeMethod } from \"./view/revoke.ts\";\nimport { viewRotateMethod } from \"./view/rotate.ts\";\nimport { viewUrlMethod } from \"./view/url.ts\";\nimport { waitMethod } from \"./wait/wait.ts\";\n// gen:method-imports\n\n/** Every host protocol method, in the order they were added. */\nexport const hostMethods: readonly AnyMethod[] = [\n mostraInitializeMethod,\n mostraShutdownMethod,\n instanceStatusMethod,\n artifactCreateMethod,\n artifactPublishMethod,\n artifactListMethod,\n artifactGetMethod,\n depsAddMethod,\n viewUrlMethod,\n viewRevokeMethod,\n viewRotateMethod,\n stateGetMethod,\n resultsGetMethod,\n waitMethod,\n eventsReadMethod,\n eventsSubscribeMethod,\n eventsUnsubscribeMethod,\n statePatchMethod,\n eventsAckMethod,\n portSubmissionsDeliverMethod,\n portDraftsMirrorMethod,\n portTrustedControlsPolicyMethod,\n portTrustedControlsActivatedMethod,\n secretSetMethod,\n secretListMethod,\n secretDeleteMethod,\n livePushMethod,\n portSecretsGetMethod,\n artifactVerifyMethod,\n viewDefaultMethod,\n viewLaunchMethod,\n gcRunMethod,\n instanceCheckMethod,\n devStartMethod,\n devStopMethod,\n portIdentityResolveMethod,\n shareStartMethod,\n shareStopMethod,\n shareListMethod,\n portAddressingExternalBaseMethod,\n artifactExportMethod,\n artifactImportMethod,\n remoteLoginMethod,\n remoteLoginWaitMethod,\n remoteLogoutMethod,\n remoteStatusMethod,\n remoteTokenMethod,\n hostedPushMethod,\n portRelayRunMethod,\n portRelayCancelMethod,\n portRelayReconcileMethod,\n portRelayCallMethod,\n relayRunUpdateMethod,\n relayCallBatchMethod,\n relayEffectMethod,\n portRelayLiveMethod,\n relayLiveValueMethod,\n hostedSubmissionMethod,\n // gen:methods\n];\n\n/** Every notification the instance sends to its clients (INTERFACES §6). */\nexport const hostNotifications: readonly AnyNotification[] = [\n { method: EVENTS_NOTIFY, params: EventsNotifyParams as AnyNotification[\"params\"] },\n { method: ARTIFACT_PROGRESS, params: ArtifactProgressParams as AnyNotification[\"params\"] },\n { method: DEV_NOTIFY, params: DevNotifyParams as AnyNotification[\"params\"] },\n];\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmEA,MAAa,cAAoC;CAC/C;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AAEF;;AAGA,MAAa,oBAAgD;CAC3D;EAAE,QAAQ;EAAe,QAAQ;CAAgD;CACjF;EAAE,QAAQ;EAAmB,QAAQ;CAAoD;CACzF;EAAE,QAAQ;EAAY,QAAQ;CAA6C;AAC7E"}
@@ -1,4 +1,5 @@
1
1
  import { MethodDefinition } from "../../method.js";
2
+ import { RemoteLink } from "../../remote.js";
2
3
  import { InstanceInfo } from "../mostra/initialize.js";
3
4
  import { Share } from "../share/start.js";
4
5
  import * as z from "zod";
@@ -74,6 +75,8 @@ export interface InstanceStatusResult {
74
75
  * out here, since status is printed where a link's secret mustn't appear: `share/list` gives it.
75
76
  */
76
77
  readonly shares?: readonly Share[];
78
+ /** This home's links to remote servers (WP-29, `remote/status`), for `mostra status`. */
79
+ readonly links?: readonly RemoteLink[];
77
80
  }
78
81
  /** One artifact version's worker (RT-03, D62). */
79
82
  export interface WorkerStatus {
@@ -1 +1 @@
1
- {"version":3,"file":"status.d.ts","names":[],"sources":["../../../src/methods/instance/status.ts"],"mappings":";;;;;;YAOY,uBAAuB;;iBAGlB;;WAEN;;WAEA;;WAEA;;WAEA;;;iBAIM;;WAEN;;WAEA;;WAEA;aAA+B;aAA6B;;;;;;WAK5D,iBAAiB;;;iBAIX;;WAEN;;WAEA;;WAEA;;WAEA;;WAEA;;;;;;iBAOM;;WAEN,UAAU;;WAEV;;WAEA;;WAEA;;WAEA,oBAAoB;;WAEpB,UAAU;;WAEV,sBAAsB;;WAEtB,mBAAmB;;WAEnB;;;;;WAKA,kBAAkB;;;iBAIZ;;WAEN;;WAEA;;;;;WAKA;;WAEA;;WAEA;;WAEA;;WAEA;;WAEA;;;qBAIE,cAAc,EAAE,QAAQ;;iBAcpB;;WAEN;;WAEA;;WAEA;;WAEA;;WAEA;;WAEA;;;qBAIE,gBAAgB,EAAE,QAAQ;;qBAe1B,eAAe,EAAE,QAAQ;;qBAqBzB,oBAAoB,EAAE,QAAQ;;qBAgC9B,sBAAsB,iBAAiB,sBAAsB"}
1
+ {"version":3,"file":"status.d.ts","names":[],"sources":["../../../src/methods/instance/status.ts"],"mappings":";;;;;;;YAQY,uBAAuB;;iBAGlB;;WAEN;;WAEA;;WAEA;;WAEA;;;iBAIM;;WAEN;;WAEA;;WAEA;aAA+B;aAA6B;;;;;;WAK5D,iBAAiB;;;iBAIX;;WAEN;;WAEA;;WAEA;;WAEA;;WAEA;;;;;;iBAOM;;WAEN,UAAU;;WAEV;;WAEA;;WAEA;;WAEA,oBAAoB;;WAEpB,UAAU;;WAEV,sBAAsB;;WAEtB,mBAAmB;;WAEnB;;;;;WAKA,kBAAkB;;WAElB,iBAAiB;;;iBAIX;;WAEN;;WAEA;;;;;WAKA;;WAEA;;WAEA;;WAEA;;WAEA;;WAEA;;;qBAIE,cAAc,EAAE,QAAQ;;iBAcpB;;WAEN;;WAEA;;WAEA;;WAEA;;WAEA;;WAEA;;;qBAIE,gBAAgB,EAAE,QAAQ;;qBAe1B,eAAe,EAAE,QAAQ;;qBAqBzB,oBAAoB,EAAE,QAAQ;;qBAiC9B,sBAAsB,iBAAiB,sBAAsB"}
@@ -1,5 +1,6 @@
1
1
  import { wireRegistry } from "../../wire-registry.js";
2
2
  import { defineMethod } from "../../method.js";
3
+ import { RemoteLink } from "../../remote.js";
3
4
  import { InstanceInfo } from "../mostra/initialize.js";
4
5
  import { Share } from "../share/start.js";
5
6
  import * as z from "zod";
@@ -76,7 +77,8 @@ const result = z.object({
76
77
  deliveries: z.array(DeliveryCounts).readonly().exactOptional(),
77
78
  workers: z.array(WorkerStatus).readonly().exactOptional(),
78
79
  idleExitAt: z.string().exactOptional(),
79
- shares: z.array(Share).readonly().exactOptional()
80
+ shares: z.array(Share).readonly().exactOptional(),
81
+ links: z.array(RemoteLink).readonly().exactOptional()
80
82
  }).register(wireRegistry, { id: "InstanceStatusResult" });
81
83
  /** `instance/status`: reports the instance, its socket, its connections and its child processes. */
82
84
  const instanceStatusMethod = defineMethod({
@@ -1 +1 @@
1
- {"version":3,"file":"status.js","names":[],"sources":["../../../src/methods/instance/status.ts"],"sourcesContent":["import * as z from \"zod\";\nimport { defineMethod, type MethodDefinition } from \"../../method.ts\";\nimport { wireRegistry } from \"../../wire-registry.ts\";\nimport { InstanceInfo } from \"../mostra/initialize.ts\";\nimport { Share } from \"../share/start.ts\";\n\n/** The params of `instance/status` (INTERFACES §6): none. */\nexport type InstanceStatusParams = Record<string, never>;\n\n/** One child process the instance supervises. */\nexport interface ChildProcessStatus {\n /** The process ID. The child leads its own process group, so this is also its group ID. */\n readonly pid: number;\n /** What the child is: `builder`, `verify`, `worker`, `pty-host`, `demo`, `install` and so on. */\n readonly kind: string;\n /** What the child serves, such as an artifact or version ID. */\n readonly ownerRef: string;\n /** When the instance started it (RFC 3339, UTC). */\n readonly startedAt: string;\n}\n\n/** Where the gateway listens (D99, WP-05). */\nexport interface GatewayStatus {\n /** The address its listeners bind: `127.0.0.1` unless the instance started with `--bind`. */\n readonly bind: string;\n /** The shell's origin, where every capability link points. */\n readonly shell: string;\n /** The artifact origins it is serving now, one per opened artifact. */\n readonly artifacts: readonly { readonly artifactId: string; readonly origin: string }[];\n /**\n * The gateway's external addresses (D158 item 1): a share's tunnel addresses and a host's\n * external bases, each a listener of its own on loopback (WP-13).\n */\n readonly faces?: readonly FaceStatus[];\n}\n\n/** One external address of the gateway (D158 item 1). */\nexport interface FaceStatus {\n /** The origin browsers use. */\n readonly origin: string;\n /** The loopback origin the tunnel or the host forwards it to. */\n readonly local: string;\n /** Which listener it fronts: the shell, or one artifact's frame. */\n readonly listener: \"shell\" | \"artifact\";\n /** The artifact, for an artifact's face. */\n readonly artifactId?: string;\n /** Who keeps it: a share's tunnel (`tailnet`, `funnel`, `cloudflare`) or a host (`host`). */\n readonly by: \"tailnet\" | \"funnel\" | \"cloudflare\" | \"host\" | (string & {});\n}\n\n/**\n * The result of `instance/status`. The packages that add ports, deliveries, shares and versions\n * add their fields here (INTERFACES §6).\n */\nexport interface InstanceStatusResult {\n /** The instance itself. */\n readonly instance: InstanceInfo;\n /** When the instance took ownership of its home (RFC 3339, UTC). */\n readonly startedAt: string;\n /** The control socket clients attach to. */\n readonly socket: string;\n /** How many protocol connections are open, this one included. */\n readonly connections: number;\n /** The child processes the instance supervises. */\n readonly processes: readonly ChildProcessStatus[];\n /** Where the gateway listens, once it has started (WP-05). */\n readonly gateway?: GatewayStatus;\n /** The outbox per host (WP-06, D105): how many deliveries are in each state. */\n readonly deliveries?: readonly DeliveryCounts[];\n /** The artifact workers, one per active version with server code (WP-08, RT-03). */\n readonly workers?: readonly WorkerStatus[];\n /** When the daemon exits for lack of work, if it will (WP-08, RT-08); absent: it won't. */\n readonly idleExitAt?: string;\n /**\n * The active shares (WP-13, D158), which keep a daemon from its idle exit. Their `url` is left\n * out here, since status is printed where a link's secret mustn't appear: `share/list` gives it.\n */\n readonly shares?: readonly Share[];\n}\n\n/** One artifact version's worker (RT-03, D62). */\nexport interface WorkerStatus {\n /** The artifact. */\n readonly artifactId: string;\n /** The version. */\n readonly versionId: string;\n /**\n * `starting`, `ready`, `backoff` (it crashed and restarts on the next request after `retryAt`),\n * `parked` (it crashed more than 5 times in 10 minutes, FAILURE_MODEL §2), `stopped`.\n */\n readonly state: \"starting\" | \"ready\" | \"backoff\" | \"parked\" | \"stopped\";\n /** The worker's process, while it runs locally. */\n readonly pid?: number;\n /** Crashes in the last 10 minutes. */\n readonly crashes: number;\n /** The last crash's cause, such as `out of memory` or `event loop blocked for 10 s`. */\n readonly lastCause?: string;\n /** When a worker in `backoff` may start again. */\n readonly retryAt?: string;\n /** Calls, runs and live producers it serves now. */\n readonly active: number;\n}\n\n/** The Zod schema of the `WorkerStatus` type. */\nexport const WorkerStatus: z.ZodType<WorkerStatus> = z\n .object({\n artifactId: z.string(),\n versionId: z.string(),\n state: z.enum([\"starting\", \"ready\", \"backoff\", \"parked\", \"stopped\"]),\n pid: z.int().min(1).exactOptional(),\n crashes: z.int().min(0),\n lastCause: z.string().exactOptional(),\n retryAt: z.string().exactOptional(),\n active: z.int().min(0),\n })\n .register(wireRegistry, { id: \"WorkerStatus\", description: \"One artifact version's worker.\" });\n\n/** One host's deliveries by state (D105). */\nexport interface DeliveryCounts {\n /** The host's client name; empty for Mostra's built-in adapter (D105). */\n readonly owner: string;\n /** Whether a connection of this host has the submissions port registered now. */\n readonly connected: boolean;\n /** Deliveries not yet answered terminally. */\n readonly pending: number;\n /** Deliveries the host accepted. */\n readonly delivered: number;\n /** Deliveries the host rejected terminally. */\n readonly rejected: number;\n /** Deliveries the host declared undeliverable. */\n readonly undeliverable: number;\n}\n\n/** The Zod schema of the `DeliveryCounts` type. */\nexport const DeliveryCounts: z.ZodType<DeliveryCounts> = z\n .object({\n owner: z.string(),\n connected: z.boolean(),\n pending: z.int().min(0),\n delivered: z.int().min(0),\n rejected: z.int().min(0),\n undeliverable: z.int().min(0),\n })\n .register(wireRegistry, {\n id: \"DeliveryCounts\",\n description: \"One host's deliveries by state, and whether it is connected.\",\n });\n\n/** The Zod schema of the `GatewayStatus` type. */\nexport const GatewayStatus: z.ZodType<GatewayStatus> = z\n .object({\n bind: z.string(),\n shell: z.string(),\n artifacts: z.array(z.object({ artifactId: z.string(), origin: z.string() })).readonly(),\n faces: z\n .array(\n z.object({\n origin: z.string(),\n local: z.string(),\n listener: z.enum([\"shell\", \"artifact\"]),\n artifactId: z.string().exactOptional(),\n by: z.string(),\n }),\n )\n .readonly()\n .exactOptional(),\n })\n .register(wireRegistry, { id: \"GatewayStatus\", description: \"Where the gateway listens.\" });\n\n/** The Zod schema of the `ChildProcessStatus` type. */\nexport const ChildProcessStatus: z.ZodType<ChildProcessStatus> = z\n .object({\n pid: z.int().min(1),\n kind: z.string(),\n ownerRef: z.string(),\n startedAt: z.iso.datetime(),\n })\n .register(wireRegistry, {\n id: \"ChildProcessStatus\",\n description: \"One child process the instance supervises.\",\n });\n\nconst params: z.ZodType<InstanceStatusParams> = z\n .object({})\n .register(wireRegistry, { id: \"InstanceStatusParams\" });\n\nconst result: z.ZodType<InstanceStatusResult> = z\n .object({\n instance: InstanceInfo,\n startedAt: z.iso.datetime(),\n socket: z.string(),\n connections: z.int().min(0),\n processes: z.array(ChildProcessStatus).readonly(),\n gateway: GatewayStatus.exactOptional(),\n deliveries: z.array(DeliveryCounts).readonly().exactOptional(),\n workers: z.array(WorkerStatus).readonly().exactOptional(),\n idleExitAt: z.string().exactOptional(),\n shares: z.array(Share).readonly().exactOptional(),\n })\n .register(wireRegistry, { id: \"InstanceStatusResult\" });\n\n/** `instance/status`: reports the instance, its socket, its connections and its child processes. */\nexport const instanceStatusMethod: MethodDefinition<InstanceStatusParams, InstanceStatusResult> =\n defineMethod({\n method: \"instance/status\",\n direction: \"client-to-instance\",\n mutating: false,\n params,\n result,\n });\n"],"mappings":";;;;;;;AAwGA,MAAa,eAAwC,EAClD,OAAO;CACN,YAAY,EAAE,OAAO;CACrB,WAAW,EAAE,OAAO;CACpB,OAAO,EAAE,KAAK;EAAC;EAAY;EAAS;EAAW;EAAU;CAAS,CAAC;CACnE,KAAK,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,cAAc;CAClC,SAAS,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC;CACtB,WAAW,EAAE,OAAO,CAAC,CAAC,cAAc;CACpC,SAAS,EAAE,OAAO,CAAC,CAAC,cAAc;CAClC,QAAQ,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC;AACvB,CAAC,CAAC,CACD,SAAS,cAAc;CAAE,IAAI;CAAgB,aAAa;AAAiC,CAAC;;AAmB/F,MAAa,iBAA4C,EACtD,OAAO;CACN,OAAO,EAAE,OAAO;CAChB,WAAW,EAAE,QAAQ;CACrB,SAAS,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC;CACtB,WAAW,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC;CACxB,UAAU,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC;CACvB,eAAe,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC;AAC9B,CAAC,CAAC,CACD,SAAS,cAAc;CACtB,IAAI;CACJ,aAAa;AACf,CAAC;;AAGH,MAAa,gBAA0C,EACpD,OAAO;CACN,MAAM,EAAE,OAAO;CACf,OAAO,EAAE,OAAO;CAChB,WAAW,EAAE,MAAM,EAAE,OAAO;EAAE,YAAY,EAAE,OAAO;EAAG,QAAQ,EAAE,OAAO;CAAE,CAAC,CAAC,CAAC,CAAC,SAAS;CACtF,OAAO,EACJ,MACC,EAAE,OAAO;EACP,QAAQ,EAAE,OAAO;EACjB,OAAO,EAAE,OAAO;EAChB,UAAU,EAAE,KAAK,CAAC,SAAS,UAAU,CAAC;EACtC,YAAY,EAAE,OAAO,CAAC,CAAC,cAAc;EACrC,IAAI,EAAE,OAAO;CACf,CAAC,CACH,CAAC,CACA,SAAS,CAAC,CACV,cAAc;AACnB,CAAC,CAAC,CACD,SAAS,cAAc;CAAE,IAAI;CAAiB,aAAa;AAA6B,CAAC;;AAG5F,MAAa,qBAAoD,EAC9D,OAAO;CACN,KAAK,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC;CAClB,MAAM,EAAE,OAAO;CACf,UAAU,EAAE,OAAO;CACnB,WAAW,EAAE,IAAI,SAAS;AAC5B,CAAC,CAAC,CACD,SAAS,cAAc;CACtB,IAAI;CACJ,aAAa;AACf,CAAC;AAEH,MAAM,SAA0C,EAC7C,OAAO,CAAC,CAAC,CAAC,CACV,SAAS,cAAc,EAAE,IAAI,uBAAuB,CAAC;AAExD,MAAM,SAA0C,EAC7C,OAAO;CACN,UAAU;CACV,WAAW,EAAE,IAAI,SAAS;CAC1B,QAAQ,EAAE,OAAO;CACjB,aAAa,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC;CAC1B,WAAW,EAAE,MAAM,kBAAkB,CAAC,CAAC,SAAS;CAChD,SAAS,cAAc,cAAc;CACrC,YAAY,EAAE,MAAM,cAAc,CAAC,CAAC,SAAS,CAAC,CAAC,cAAc;CAC7D,SAAS,EAAE,MAAM,YAAY,CAAC,CAAC,SAAS,CAAC,CAAC,cAAc;CACxD,YAAY,EAAE,OAAO,CAAC,CAAC,cAAc;CACrC,QAAQ,EAAE,MAAM,KAAK,CAAC,CAAC,SAAS,CAAC,CAAC,cAAc;AAClD,CAAC,CAAC,CACD,SAAS,cAAc,EAAE,IAAI,uBAAuB,CAAC;;AAGxD,MAAa,uBACX,aAAa;CACX,QAAQ;CACR,WAAW;CACX,UAAU;CACV;CACA;AACF,CAAC"}
1
+ {"version":3,"file":"status.js","names":[],"sources":["../../../src/methods/instance/status.ts"],"sourcesContent":["import * as z from \"zod\";\nimport { defineMethod, type MethodDefinition } from \"../../method.ts\";\nimport { RemoteLink } from \"../../remote.ts\";\nimport { wireRegistry } from \"../../wire-registry.ts\";\nimport { InstanceInfo } from \"../mostra/initialize.ts\";\nimport { Share } from \"../share/start.ts\";\n\n/** The params of `instance/status` (INTERFACES §6): none. */\nexport type InstanceStatusParams = Record<string, never>;\n\n/** One child process the instance supervises. */\nexport interface ChildProcessStatus {\n /** The process ID. The child leads its own process group, so this is also its group ID. */\n readonly pid: number;\n /** What the child is: `builder`, `verify`, `worker`, `pty-host`, `demo`, `install` and so on. */\n readonly kind: string;\n /** What the child serves, such as an artifact or version ID. */\n readonly ownerRef: string;\n /** When the instance started it (RFC 3339, UTC). */\n readonly startedAt: string;\n}\n\n/** Where the gateway listens (D99, WP-05). */\nexport interface GatewayStatus {\n /** The address its listeners bind: `127.0.0.1` unless the instance started with `--bind`. */\n readonly bind: string;\n /** The shell's origin, where every capability link points. */\n readonly shell: string;\n /** The artifact origins it is serving now, one per opened artifact. */\n readonly artifacts: readonly { readonly artifactId: string; readonly origin: string }[];\n /**\n * The gateway's external addresses (D158 item 1): a share's tunnel addresses and a host's\n * external bases, each a listener of its own on loopback (WP-13).\n */\n readonly faces?: readonly FaceStatus[];\n}\n\n/** One external address of the gateway (D158 item 1). */\nexport interface FaceStatus {\n /** The origin browsers use. */\n readonly origin: string;\n /** The loopback origin the tunnel or the host forwards it to. */\n readonly local: string;\n /** Which listener it fronts: the shell, or one artifact's frame. */\n readonly listener: \"shell\" | \"artifact\";\n /** The artifact, for an artifact's face. */\n readonly artifactId?: string;\n /** Who keeps it: a share's tunnel (`tailnet`, `funnel`, `cloudflare`) or a host (`host`). */\n readonly by: \"tailnet\" | \"funnel\" | \"cloudflare\" | \"host\" | (string & {});\n}\n\n/**\n * The result of `instance/status`. The packages that add ports, deliveries, shares and versions\n * add their fields here (INTERFACES §6).\n */\nexport interface InstanceStatusResult {\n /** The instance itself. */\n readonly instance: InstanceInfo;\n /** When the instance took ownership of its home (RFC 3339, UTC). */\n readonly startedAt: string;\n /** The control socket clients attach to. */\n readonly socket: string;\n /** How many protocol connections are open, this one included. */\n readonly connections: number;\n /** The child processes the instance supervises. */\n readonly processes: readonly ChildProcessStatus[];\n /** Where the gateway listens, once it has started (WP-05). */\n readonly gateway?: GatewayStatus;\n /** The outbox per host (WP-06, D105): how many deliveries are in each state. */\n readonly deliveries?: readonly DeliveryCounts[];\n /** The artifact workers, one per active version with server code (WP-08, RT-03). */\n readonly workers?: readonly WorkerStatus[];\n /** When the daemon exits for lack of work, if it will (WP-08, RT-08); absent: it won't. */\n readonly idleExitAt?: string;\n /**\n * The active shares (WP-13, D158), which keep a daemon from its idle exit. Their `url` is left\n * out here, since status is printed where a link's secret mustn't appear: `share/list` gives it.\n */\n readonly shares?: readonly Share[];\n /** This home's links to remote servers (WP-29, `remote/status`), for `mostra status`. */\n readonly links?: readonly RemoteLink[];\n}\n\n/** One artifact version's worker (RT-03, D62). */\nexport interface WorkerStatus {\n /** The artifact. */\n readonly artifactId: string;\n /** The version. */\n readonly versionId: string;\n /**\n * `starting`, `ready`, `backoff` (it crashed and restarts on the next request after `retryAt`),\n * `parked` (it crashed more than 5 times in 10 minutes, FAILURE_MODEL §2), `stopped`.\n */\n readonly state: \"starting\" | \"ready\" | \"backoff\" | \"parked\" | \"stopped\";\n /** The worker's process, while it runs locally. */\n readonly pid?: number;\n /** Crashes in the last 10 minutes. */\n readonly crashes: number;\n /** The last crash's cause, such as `out of memory` or `event loop blocked for 10 s`. */\n readonly lastCause?: string;\n /** When a worker in `backoff` may start again. */\n readonly retryAt?: string;\n /** Calls, runs and live producers it serves now. */\n readonly active: number;\n}\n\n/** The Zod schema of the `WorkerStatus` type. */\nexport const WorkerStatus: z.ZodType<WorkerStatus> = z\n .object({\n artifactId: z.string(),\n versionId: z.string(),\n state: z.enum([\"starting\", \"ready\", \"backoff\", \"parked\", \"stopped\"]),\n pid: z.int().min(1).exactOptional(),\n crashes: z.int().min(0),\n lastCause: z.string().exactOptional(),\n retryAt: z.string().exactOptional(),\n active: z.int().min(0),\n })\n .register(wireRegistry, { id: \"WorkerStatus\", description: \"One artifact version's worker.\" });\n\n/** One host's deliveries by state (D105). */\nexport interface DeliveryCounts {\n /** The host's client name; empty for Mostra's built-in adapter (D105). */\n readonly owner: string;\n /** Whether a connection of this host has the submissions port registered now. */\n readonly connected: boolean;\n /** Deliveries not yet answered terminally. */\n readonly pending: number;\n /** Deliveries the host accepted. */\n readonly delivered: number;\n /** Deliveries the host rejected terminally. */\n readonly rejected: number;\n /** Deliveries the host declared undeliverable. */\n readonly undeliverable: number;\n}\n\n/** The Zod schema of the `DeliveryCounts` type. */\nexport const DeliveryCounts: z.ZodType<DeliveryCounts> = z\n .object({\n owner: z.string(),\n connected: z.boolean(),\n pending: z.int().min(0),\n delivered: z.int().min(0),\n rejected: z.int().min(0),\n undeliverable: z.int().min(0),\n })\n .register(wireRegistry, {\n id: \"DeliveryCounts\",\n description: \"One host's deliveries by state, and whether it is connected.\",\n });\n\n/** The Zod schema of the `GatewayStatus` type. */\nexport const GatewayStatus: z.ZodType<GatewayStatus> = z\n .object({\n bind: z.string(),\n shell: z.string(),\n artifacts: z.array(z.object({ artifactId: z.string(), origin: z.string() })).readonly(),\n faces: z\n .array(\n z.object({\n origin: z.string(),\n local: z.string(),\n listener: z.enum([\"shell\", \"artifact\"]),\n artifactId: z.string().exactOptional(),\n by: z.string(),\n }),\n )\n .readonly()\n .exactOptional(),\n })\n .register(wireRegistry, { id: \"GatewayStatus\", description: \"Where the gateway listens.\" });\n\n/** The Zod schema of the `ChildProcessStatus` type. */\nexport const ChildProcessStatus: z.ZodType<ChildProcessStatus> = z\n .object({\n pid: z.int().min(1),\n kind: z.string(),\n ownerRef: z.string(),\n startedAt: z.iso.datetime(),\n })\n .register(wireRegistry, {\n id: \"ChildProcessStatus\",\n description: \"One child process the instance supervises.\",\n });\n\nconst params: z.ZodType<InstanceStatusParams> = z\n .object({})\n .register(wireRegistry, { id: \"InstanceStatusParams\" });\n\nconst result: z.ZodType<InstanceStatusResult> = z\n .object({\n instance: InstanceInfo,\n startedAt: z.iso.datetime(),\n socket: z.string(),\n connections: z.int().min(0),\n processes: z.array(ChildProcessStatus).readonly(),\n gateway: GatewayStatus.exactOptional(),\n deliveries: z.array(DeliveryCounts).readonly().exactOptional(),\n workers: z.array(WorkerStatus).readonly().exactOptional(),\n idleExitAt: z.string().exactOptional(),\n shares: z.array(Share).readonly().exactOptional(),\n links: z.array(RemoteLink).readonly().exactOptional(),\n })\n .register(wireRegistry, { id: \"InstanceStatusResult\" });\n\n/** `instance/status`: reports the instance, its socket, its connections and its child processes. */\nexport const instanceStatusMethod: MethodDefinition<InstanceStatusParams, InstanceStatusResult> =\n defineMethod({\n method: \"instance/status\",\n direction: \"client-to-instance\",\n mutating: false,\n params,\n result,\n });\n"],"mappings":";;;;;;;;AA2GA,MAAa,eAAwC,EAClD,OAAO;CACN,YAAY,EAAE,OAAO;CACrB,WAAW,EAAE,OAAO;CACpB,OAAO,EAAE,KAAK;EAAC;EAAY;EAAS;EAAW;EAAU;CAAS,CAAC;CACnE,KAAK,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,cAAc;CAClC,SAAS,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC;CACtB,WAAW,EAAE,OAAO,CAAC,CAAC,cAAc;CACpC,SAAS,EAAE,OAAO,CAAC,CAAC,cAAc;CAClC,QAAQ,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC;AACvB,CAAC,CAAC,CACD,SAAS,cAAc;CAAE,IAAI;CAAgB,aAAa;AAAiC,CAAC;;AAmB/F,MAAa,iBAA4C,EACtD,OAAO;CACN,OAAO,EAAE,OAAO;CAChB,WAAW,EAAE,QAAQ;CACrB,SAAS,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC;CACtB,WAAW,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC;CACxB,UAAU,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC;CACvB,eAAe,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC;AAC9B,CAAC,CAAC,CACD,SAAS,cAAc;CACtB,IAAI;CACJ,aAAa;AACf,CAAC;;AAGH,MAAa,gBAA0C,EACpD,OAAO;CACN,MAAM,EAAE,OAAO;CACf,OAAO,EAAE,OAAO;CAChB,WAAW,EAAE,MAAM,EAAE,OAAO;EAAE,YAAY,EAAE,OAAO;EAAG,QAAQ,EAAE,OAAO;CAAE,CAAC,CAAC,CAAC,CAAC,SAAS;CACtF,OAAO,EACJ,MACC,EAAE,OAAO;EACP,QAAQ,EAAE,OAAO;EACjB,OAAO,EAAE,OAAO;EAChB,UAAU,EAAE,KAAK,CAAC,SAAS,UAAU,CAAC;EACtC,YAAY,EAAE,OAAO,CAAC,CAAC,cAAc;EACrC,IAAI,EAAE,OAAO;CACf,CAAC,CACH,CAAC,CACA,SAAS,CAAC,CACV,cAAc;AACnB,CAAC,CAAC,CACD,SAAS,cAAc;CAAE,IAAI;CAAiB,aAAa;AAA6B,CAAC;;AAG5F,MAAa,qBAAoD,EAC9D,OAAO;CACN,KAAK,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC;CAClB,MAAM,EAAE,OAAO;CACf,UAAU,EAAE,OAAO;CACnB,WAAW,EAAE,IAAI,SAAS;AAC5B,CAAC,CAAC,CACD,SAAS,cAAc;CACtB,IAAI;CACJ,aAAa;AACf,CAAC;AAEH,MAAM,SAA0C,EAC7C,OAAO,CAAC,CAAC,CAAC,CACV,SAAS,cAAc,EAAE,IAAI,uBAAuB,CAAC;AAExD,MAAM,SAA0C,EAC7C,OAAO;CACN,UAAU;CACV,WAAW,EAAE,IAAI,SAAS;CAC1B,QAAQ,EAAE,OAAO;CACjB,aAAa,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC;CAC1B,WAAW,EAAE,MAAM,kBAAkB,CAAC,CAAC,SAAS;CAChD,SAAS,cAAc,cAAc;CACrC,YAAY,EAAE,MAAM,cAAc,CAAC,CAAC,SAAS,CAAC,CAAC,cAAc;CAC7D,SAAS,EAAE,MAAM,YAAY,CAAC,CAAC,SAAS,CAAC,CAAC,cAAc;CACxD,YAAY,EAAE,OAAO,CAAC,CAAC,cAAc;CACrC,QAAQ,EAAE,MAAM,KAAK,CAAC,CAAC,SAAS,CAAC,CAAC,cAAc;CAChD,OAAO,EAAE,MAAM,UAAU,CAAC,CAAC,SAAS,CAAC,CAAC,cAAc;AACtD,CAAC,CAAC,CACD,SAAS,cAAc,EAAE,IAAI,uBAAuB,CAAC;;AAGxD,MAAa,uBACX,aAAa;CACX,QAAQ;CACR,WAAW;CACX,UAAU;CACV;CACA;AACF,CAAC"}
@@ -1,8 +1,10 @@
1
- import { SubmissionPolicy } from "../../manifest.js";
1
+ import { SubmissionPolicy } from "../../policy.js";
2
+ import "../../manifest.js";
2
3
  import { SubmitChannel } from "../../view.js";
3
4
  import "../../interaction.js";
4
5
  import { Diagnostic } from "../../diagnostics/diagnostic.js";
5
6
  import { MethodDefinition } from "../../method.js";
7
+ import { OwnerLinkInfo } from "../../remote.js";
6
8
  import { Revision } from "../../revision.js";
7
9
  import * as z from "zod";
8
10
  //#region src/methods/mostra/initialize.d.ts
@@ -89,6 +91,11 @@ export interface MostraInitializeParams {
89
91
  readonly ports: readonly PortName[];
90
92
  /** Home settings and the home check. */
91
93
  readonly home?: HomeConfig;
94
+ /**
95
+ * On a binding to a remote server, the owner instance's link (INTERFACES §18.2): its `lnk_` ID,
96
+ * its relay mark and the hosted home's position it committed. Other sessions send none.
97
+ */
98
+ readonly link?: OwnerLinkInfo;
92
99
  }
93
100
  /** The instance a client is connected to. */
94
101
  export interface InstanceInfo {
@@ -100,8 +107,15 @@ export interface InstanceInfo {
100
107
  readonly platform: string;
101
108
  /** The supervisor's process ID. */
102
109
  readonly pid: number;
103
- /** `host` when spawned over stdio (`mostra-runtime host`), `daemon` when started as a daemon. */
104
- readonly mode: "host" | "daemon";
110
+ /**
111
+ * `host` when spawned over stdio (`mostra-runtime host`), `daemon` when started as a daemon,
112
+ * `hosted` for a hosted home on a remote server (INTERFACES §18.2).
113
+ */
114
+ readonly mode: "host" | "daemon" | "hosted";
115
+ /** A hosted home's current incarnation, rotated when it is restored from a backup. */
116
+ readonly incarnation?: string;
117
+ /** A hosted home's head: its newest event cursor. */
118
+ readonly cursor?: string;
105
119
  }
106
120
  /** What the instance offers (D84). */
107
121
  export interface InstanceCapabilities {
@@ -1 +1 @@
1
- {"version":3,"file":"initialize.d.ts","names":[],"sources":["../../../src/methods/mostra/initialize.ts"],"mappings":";;;;;;;;;;;;;YAaY;;qBAcC,UAAU,EAAE,QAAQ;;;;;;qBAcpB;;iBAGI;;WAEN;;WAEA;;;iBAIM;;WAEN;;;;;;iBAOM;;;;;;WAMN;;;;;;WAMA,eAAe;;;;;WAKf,aAAa;;;;;WAKb,iBAAiB;;;;;;WAMjB,0BAA0B;;;YAIzB;;qBAGC,kBAAkB,EAAE,QAAQ;;iBASxB;;WAEN,QAAQ;;;;;;WAMR;;WAEA,cAAc;;;;;WAKd,gBAAgB;;WAEhB,OAAO;;;iBAID;;WAEN;;WAEA;;WAEA;;WAEA;;WAEA;;;iBAIM;;WAEN;;WAEA;;WAEA,gBAAgB;;;iBAIV;;WAEN,UAAU;;WAEV,UAAU;;WAEV,cAAc;;WAEd,mBAAmB;;;qBAIjB,YAAY,EAAE,QAAQ;;qBAKtB,oBAAoB,EAAE,QAAQ;;qBAQ9B,YAAY,EAAE,QAAQ;;qBAetB,cAAc,EAAE,QAAQ;;qBAcxB,sBAAsB,EAAE,QAAQ;;;;;;qBAmChC,wBAAwB,iBACnC,wBACA"}
1
+ {"version":3,"file":"initialize.d.ts","names":[],"sources":["../../../src/methods/mostra/initialize.ts"],"mappings":";;;;;;;;;;;;;;;YAcY;;qBAcC,UAAU,EAAE,QAAQ;;;;;;qBAcpB;;iBAGI;;WAEN;;WAEA;;;iBAIM;;WAEN;;;;;;iBAOM;;;;;;WAMN;;;;;;WAMA,eAAe;;;;;WAKf,aAAa;;;;;WAKb,iBAAiB;;;;;;WAMjB,0BAA0B;;;YAIzB;;qBAGC,kBAAkB,EAAE,QAAQ;;iBASxB;;WAEN,QAAQ;;;;;;WAMR;;WAEA,cAAc;;;;;WAKd,gBAAgB;;WAEhB,OAAO;;;;;WAKP,OAAO;;;iBAID;;WAEN;;WAEA;;WAEA;;WAEA;;;;;WAKA;;WAEA;;WAEA;;;iBAIM;;WAEN;;WAEA;;WAEA,gBAAgB;;;iBAIV;;WAEN,UAAU;;WAEV,UAAU;;WAEV,cAAc;;WAEd,mBAAmB;;;qBAIjB,YAAY,EAAE,QAAQ;;qBAKtB,oBAAoB,EAAE,QAAQ;;qBAQ9B,YAAY,EAAE,QAAQ;;qBAetB,cAAc,EAAE,QAAQ;;qBAgBxB,sBAAsB,EAAE,QAAQ;;;;;;qBAoChC,wBAAwB,iBACnC,wBACA"}
@@ -1,8 +1,9 @@
1
1
  import { wireRegistry } from "../../wire-registry.js";
2
- import { SubmissionPolicy } from "../../manifest.js";
2
+ import { SubmissionPolicy } from "../../policy.js";
3
3
  import { Diagnostic } from "../../diagnostics/diagnostic.js";
4
4
  import { SubmitChannel } from "../../view.js";
5
5
  import { defineMethod } from "../../method.js";
6
+ import { OwnerLinkInfo } from "../../remote.js";
6
7
  import { Revision } from "../../revision.js";
7
8
  import * as z from "zod";
8
9
  //#region src/methods/mostra/initialize.ts
@@ -52,7 +53,13 @@ const InstanceInfo = z.object({
52
53
  home: z.string(),
53
54
  platform: z.string(),
54
55
  pid: z.int().min(1),
55
- mode: z.enum(["host", "daemon"])
56
+ mode: z.enum([
57
+ "host",
58
+ "daemon",
59
+ "hosted"
60
+ ]),
61
+ incarnation: z.string().exactOptional(),
62
+ cursor: z.string().exactOptional()
56
63
  }).register(wireRegistry, {
57
64
  id: "InstanceInfo",
58
65
  description: "The instance a client is connected to."
@@ -71,7 +78,8 @@ const params = z.object({
71
78
  revisions: z.array(z.string()).readonly(),
72
79
  capabilities: ClientCapabilities,
73
80
  ports: z.array(PortName).readonly(),
74
- home: HomeConfig.exactOptional()
81
+ home: HomeConfig.exactOptional(),
82
+ link: OwnerLinkInfo.exactOptional()
75
83
  }).register(wireRegistry, { id: "MostraInitializeParams" });
76
84
  const result = z.object({
77
85
  revision: Revision.schema,
@@ -1 +1 @@
1
- {"version":3,"file":"initialize.js","names":[],"sources":["../../../src/methods/mostra/initialize.ts"],"sourcesContent":["import * as z from \"zod\";\nimport { Diagnostic } from \"../../diagnostics/diagnostic.ts\";\nimport { SubmitChannel } from \"../../interaction.ts\";\nimport { SubmissionPolicy } from \"../../manifest.ts\";\nimport { defineMethod, type MethodDefinition } from \"../../method.ts\";\nimport { Revision } from \"../../revision.ts\";\nimport { wireRegistry } from \"../../wire-registry.ts\";\n\n/**\n * A host port name (INTERFACES §7). Port names are open strings on the wire, so an older instance\n * answers a newer port with a warning instead of refusing the session (D84). `ai` is reserved for\n * the AI port, which is not part of v1 (D46).\n */\nexport type PortName =\n | \"identity\"\n | \"submissions\"\n | \"drafts\"\n | \"reviews\"\n | \"addressing\"\n | \"trustedControls\"\n | \"capture\"\n | \"secrets\"\n | \"pty\"\n | \"ai\"\n | (string & {});\n\n/** The Zod schema of the `PortName` type. */\nexport const PortName: z.ZodType<PortName, string> = z\n .string()\n .regex(/^[a-z][a-zA-Z0-9]*$/)\n .register(wireRegistry, {\n id: \"PortName\",\n description:\n \"A host port name: identity, submissions, drafts, reviews, addressing, trustedControls, capture, secrets, pty, or ai (reserved). Open for later ports.\",\n });\n\n/**\n * The standalone CLI's client name (D140 item 4). The supervisor marks a home as configured by a\n * host when any other client sends `home` or `ports`, and the CLI never sends telemetry for such a\n * home. A host that uses this name as its own is out of scope.\n */\nexport const CLI_CLIENT_NAME = \"mostra-cli\";\n\n/** The client that opens a connection. */\nexport interface ClientInfo {\n /** The client's name, for logs and status (`mostra-cli`, `my-host`). */\n readonly name: string;\n /** The client's own version. */\n readonly version: string;\n}\n\n/** What the client can handle (D84). */\nexport interface ClientCapabilities {\n /** Notification methods the client accepts. The instance sends no others. */\n readonly notifications?: readonly string[];\n}\n\n/**\n * Home settings from a spawning host (INTERFACES §6). Each setting arrives with the package that\n * implements it.\n */\nexport interface HomeConfig {\n /**\n * The home the client expects. A check, not a setting (D84): the instance chose and locked its\n * home at start-up, and refuses the session with `MOSTRA_HOME_MISMATCH` when this names a\n * different one.\n */\n readonly path?: string;\n /**\n * The dependency policy (D43, D95), kept in the home's `config.json` for every later client:\n * `auto` (the default) installs any package an artifact imports; `explicit` installs only what\n * `deps/add` adds and reports other imports as `MOSTRA_DEP_MISSING`.\n */\n readonly dependencies?: DependencyPolicy;\n /**\n * The home's submission policy (D102), kept in `config.json`: it applies to every artifact whose\n * `artifact/publish` names no policy, before the manifest's request.\n */\n readonly submission?: SubmissionPolicy;\n /**\n * The ports this client always provides, kept in `config.json` under its `client.name` (D105).\n * Submissions made while it is away wait in the outbox for it; an empty list stops that.\n */\n readonly ports?: readonly PortName[];\n /**\n * The submit channels the home accepts (D40, D108), kept in `config.json`: `[\"shell\"]` lets only\n * the shell's trusted Submit and Choose make submissions and choices; absent, both channels are\n * allowed. A host's `trustedControls` port answers per view instead, when it is connected.\n */\n readonly submitChannels?: readonly SubmitChannel[];\n}\n\n/** How packages enter an artifact's lockfile (D43). */\nexport type DependencyPolicy = \"auto\" | \"explicit\";\n\n/** The Zod schema of the `DependencyPolicy` type. */\nexport const DependencyPolicy: z.ZodType<DependencyPolicy> = z\n .enum([\"auto\", \"explicit\"])\n .register(wireRegistry, {\n id: \"DependencyPolicy\",\n description:\n \"How packages enter an artifact's lockfile: auto installs what artifacts import; explicit only what deps/add adds (D43).\",\n });\n\n/** The params of `mostra/initialize` (INTERFACES §6). */\nexport interface MostraInitializeParams {\n /** Who is connecting. */\n readonly client: ClientInfo;\n /**\n * The host protocol revisions the client speaks. The instance picks the newest one it also\n * supports, or refuses with `MOSTRA_HOST_REVISION_UNSUPPORTED`. Entries that aren't revisions\n * never match.\n */\n readonly revisions: readonly string[];\n /** What the client can handle. */\n readonly capabilities: ClientCapabilities;\n /**\n * Ports the client implements. The instance calls a port only on the connection that registered\n * it; ports it doesn't support get a `MOSTRA_HOST_PORT_UNSUPPORTED` warning.\n */\n readonly ports: readonly PortName[];\n /** Home settings and the home check. */\n readonly home?: HomeConfig;\n}\n\n/** The instance a client is connected to. */\nexport interface InstanceInfo {\n /** The runtime release (`@mostra/runtime` version). */\n readonly version: string;\n /** The home's real path. */\n readonly home: string;\n /** The platform as `<os>-<arch>`, for example `darwin-arm64`. */\n readonly platform: string;\n /** The supervisor's process ID. */\n readonly pid: number;\n /** `host` when spawned over stdio (`mostra-runtime host`), `daemon` when started as a daemon. */\n readonly mode: \"host\" | \"daemon\";\n}\n\n/** What the instance offers (D84). */\nexport interface InstanceCapabilities {\n /** Every method the instance serves. */\n readonly methods: readonly string[];\n /** Every notification the instance may send. */\n readonly notifications: readonly string[];\n /** The ports the instance calls when a client registers them. */\n readonly ports: readonly PortName[];\n}\n\n/** The result of `mostra/initialize`. */\nexport interface MostraInitializeResult {\n /** The negotiated host protocol revision: the newest both sides support. */\n readonly revision: Revision;\n /** The instance the client is connected to. */\n readonly instance: InstanceInfo;\n /** What the instance offers. */\n readonly capabilities: InstanceCapabilities;\n /** Warnings about the session, such as ports the instance doesn't support. */\n readonly warnings: readonly Diagnostic[];\n}\n\n/** The Zod schema of the `ClientInfo` type. */\nexport const ClientInfo: z.ZodType<ClientInfo> = z\n .object({ name: z.string().min(1), version: z.string() })\n .register(wireRegistry, { id: \"ClientInfo\", description: \"The client that opens a connection.\" });\n\n/** The Zod schema of the `ClientCapabilities` type. */\nexport const ClientCapabilities: z.ZodType<ClientCapabilities> = z\n .object({ notifications: z.array(z.string()).readonly().exactOptional() })\n .register(wireRegistry, {\n id: \"ClientCapabilities\",\n description: \"What the client can handle: the notification methods it accepts.\",\n });\n\n/** The Zod schema of the `HomeConfig` type. */\nexport const HomeConfig: z.ZodType<HomeConfig> = z\n .object({\n path: z.string().min(1).exactOptional(),\n dependencies: DependencyPolicy.exactOptional(),\n submission: SubmissionPolicy.exactOptional(),\n ports: z.array(PortName).max(32).readonly().exactOptional(),\n submitChannels: z.array(SubmitChannel).min(1).max(2).readonly().exactOptional(),\n })\n .register(wireRegistry, {\n id: \"HomeConfig\",\n description:\n \"Home settings from a spawning host; path is a check against the instance's home (D84), dependencies the dependency policy (D43), submission the home's policy (D102), ports those the host always provides (D105).\",\n });\n\n/** The Zod schema of the `InstanceInfo` type. */\nexport const InstanceInfo: z.ZodType<InstanceInfo> = z\n .object({\n version: z.string(),\n home: z.string(),\n platform: z.string(),\n pid: z.int().min(1),\n mode: z.enum([\"host\", \"daemon\"]),\n })\n .register(wireRegistry, {\n id: \"InstanceInfo\",\n description: \"The instance a client is connected to.\",\n });\n\n/** The Zod schema of the `InstanceCapabilities` type. */\nexport const InstanceCapabilities: z.ZodType<InstanceCapabilities> = z\n .object({\n methods: z.array(z.string()).readonly(),\n notifications: z.array(z.string()).readonly(),\n ports: z.array(PortName).readonly(),\n })\n .register(wireRegistry, {\n id: \"InstanceCapabilities\",\n description: \"What the instance offers: methods, notifications and supported ports.\",\n });\n\nconst params: z.ZodType<MostraInitializeParams> = z\n .object({\n client: ClientInfo,\n revisions: z.array(z.string()).readonly(),\n capabilities: ClientCapabilities,\n ports: z.array(PortName).readonly(),\n home: HomeConfig.exactOptional(),\n })\n .register(wireRegistry, { id: \"MostraInitializeParams\" });\n\nconst result: z.ZodType<MostraInitializeResult> = z\n .object({\n revision: Revision.schema,\n instance: InstanceInfo,\n capabilities: InstanceCapabilities,\n warnings: z.array(Diagnostic).readonly(),\n })\n .register(wireRegistry, { id: \"MostraInitializeResult\" });\n\n/**\n * `mostra/initialize`: opens a session. It must be the first request on a connection and is sent\n * once. It negotiates the protocol revision, registers the client's ports on this connection and\n * checks the home (D59, D84).\n */\nexport const mostraInitializeMethod: MethodDefinition<\n MostraInitializeParams,\n MostraInitializeResult\n> = defineMethod({\n method: \"mostra/initialize\",\n direction: \"client-to-instance\",\n mutating: false,\n params,\n result,\n});\n"],"mappings":";;;;;;;;;AA2BA,MAAa,WAAwC,EAClD,OAAO,CAAC,CACR,MAAM,qBAAqB,CAAC,CAC5B,SAAS,cAAc;CACtB,IAAI;CACJ,aACE;AACJ,CAAC;;;;;;AAOH,MAAa,kBAAkB;;AAuD/B,MAAa,mBAAgD,EAC1D,KAAK,CAAC,QAAQ,UAAU,CAAC,CAAC,CAC1B,SAAS,cAAc;CACtB,IAAI;CACJ,aACE;AACJ,CAAC;;AA4DH,MAAa,aAAoC,EAC9C,OAAO;CAAE,MAAM,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC;CAAG,SAAS,EAAE,OAAO;AAAE,CAAC,CAAC,CACxD,SAAS,cAAc;CAAE,IAAI;CAAc,aAAa;AAAsC,CAAC;;AAGlG,MAAa,qBAAoD,EAC9D,OAAO,EAAE,eAAe,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,cAAc,EAAE,CAAC,CAAC,CACzE,SAAS,cAAc;CACtB,IAAI;CACJ,aAAa;AACf,CAAC;;AAGH,MAAa,aAAoC,EAC9C,OAAO;CACN,MAAM,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,cAAc;CACtC,cAAc,iBAAiB,cAAc;CAC7C,YAAY,iBAAiB,cAAc;CAC3C,OAAO,EAAE,MAAM,QAAQ,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,cAAc;CAC1D,gBAAgB,EAAE,MAAM,aAAa,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,cAAc;AAChF,CAAC,CAAC,CACD,SAAS,cAAc;CACtB,IAAI;CACJ,aACE;AACJ,CAAC;;AAGH,MAAa,eAAwC,EAClD,OAAO;CACN,SAAS,EAAE,OAAO;CAClB,MAAM,EAAE,OAAO;CACf,UAAU,EAAE,OAAO;CACnB,KAAK,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC;CAClB,MAAM,EAAE,KAAK,CAAC,QAAQ,QAAQ,CAAC;AACjC,CAAC,CAAC,CACD,SAAS,cAAc;CACtB,IAAI;CACJ,aAAa;AACf,CAAC;;AAGH,MAAa,uBAAwD,EAClE,OAAO;CACN,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,SAAS;CACtC,eAAe,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,SAAS;CAC5C,OAAO,EAAE,MAAM,QAAQ,CAAC,CAAC,SAAS;AACpC,CAAC,CAAC,CACD,SAAS,cAAc;CACtB,IAAI;CACJ,aAAa;AACf,CAAC;AAEH,MAAM,SAA4C,EAC/C,OAAO;CACN,QAAQ;CACR,WAAW,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,SAAS;CACxC,cAAc;CACd,OAAO,EAAE,MAAM,QAAQ,CAAC,CAAC,SAAS;CAClC,MAAM,WAAW,cAAc;AACjC,CAAC,CAAC,CACD,SAAS,cAAc,EAAE,IAAI,yBAAyB,CAAC;AAE1D,MAAM,SAA4C,EAC/C,OAAO;CACN,UAAU,SAAS;CACnB,UAAU;CACV,cAAc;CACd,UAAU,EAAE,MAAM,UAAU,CAAC,CAAC,SAAS;AACzC,CAAC,CAAC,CACD,SAAS,cAAc,EAAE,IAAI,yBAAyB,CAAC;;;;;;AAO1D,MAAa,yBAGT,aAAa;CACf,QAAQ;CACR,WAAW;CACX,UAAU;CACV;CACA;AACF,CAAC"}
1
+ {"version":3,"file":"initialize.js","names":[],"sources":["../../../src/methods/mostra/initialize.ts"],"sourcesContent":["import * as z from \"zod\";\nimport { Diagnostic } from \"../../diagnostics/diagnostic.ts\";\nimport { SubmitChannel } from \"../../interaction.ts\";\nimport { SubmissionPolicy } from \"../../manifest.ts\";\nimport { defineMethod, type MethodDefinition } from \"../../method.ts\";\nimport { OwnerLinkInfo } from \"../../remote.ts\";\nimport { Revision } from \"../../revision.ts\";\nimport { wireRegistry } from \"../../wire-registry.ts\";\n\n/**\n * A host port name (INTERFACES §7). Port names are open strings on the wire, so an older instance\n * answers a newer port with a warning instead of refusing the session (D84). `ai` is reserved for\n * the AI port, which is not part of v1 (D46).\n */\nexport type PortName =\n | \"identity\"\n | \"submissions\"\n | \"drafts\"\n | \"reviews\"\n | \"addressing\"\n | \"trustedControls\"\n | \"capture\"\n | \"secrets\"\n | \"pty\"\n | \"ai\"\n | (string & {});\n\n/** The Zod schema of the `PortName` type. */\nexport const PortName: z.ZodType<PortName, string> = z\n .string()\n .regex(/^[a-z][a-zA-Z0-9]*$/)\n .register(wireRegistry, {\n id: \"PortName\",\n description:\n \"A host port name: identity, submissions, drafts, reviews, addressing, trustedControls, capture, secrets, pty, or ai (reserved). Open for later ports.\",\n });\n\n/**\n * The standalone CLI's client name (D140 item 4). The supervisor marks a home as configured by a\n * host when any other client sends `home` or `ports`, and the CLI never sends telemetry for such a\n * home. A host that uses this name as its own is out of scope.\n */\nexport const CLI_CLIENT_NAME = \"mostra-cli\";\n\n/** The client that opens a connection. */\nexport interface ClientInfo {\n /** The client's name, for logs and status (`mostra-cli`, `my-host`). */\n readonly name: string;\n /** The client's own version. */\n readonly version: string;\n}\n\n/** What the client can handle (D84). */\nexport interface ClientCapabilities {\n /** Notification methods the client accepts. The instance sends no others. */\n readonly notifications?: readonly string[];\n}\n\n/**\n * Home settings from a spawning host (INTERFACES §6). Each setting arrives with the package that\n * implements it.\n */\nexport interface HomeConfig {\n /**\n * The home the client expects. A check, not a setting (D84): the instance chose and locked its\n * home at start-up, and refuses the session with `MOSTRA_HOME_MISMATCH` when this names a\n * different one.\n */\n readonly path?: string;\n /**\n * The dependency policy (D43, D95), kept in the home's `config.json` for every later client:\n * `auto` (the default) installs any package an artifact imports; `explicit` installs only what\n * `deps/add` adds and reports other imports as `MOSTRA_DEP_MISSING`.\n */\n readonly dependencies?: DependencyPolicy;\n /**\n * The home's submission policy (D102), kept in `config.json`: it applies to every artifact whose\n * `artifact/publish` names no policy, before the manifest's request.\n */\n readonly submission?: SubmissionPolicy;\n /**\n * The ports this client always provides, kept in `config.json` under its `client.name` (D105).\n * Submissions made while it is away wait in the outbox for it; an empty list stops that.\n */\n readonly ports?: readonly PortName[];\n /**\n * The submit channels the home accepts (D40, D108), kept in `config.json`: `[\"shell\"]` lets only\n * the shell's trusted Submit and Choose make submissions and choices; absent, both channels are\n * allowed. A host's `trustedControls` port answers per view instead, when it is connected.\n */\n readonly submitChannels?: readonly SubmitChannel[];\n}\n\n/** How packages enter an artifact's lockfile (D43). */\nexport type DependencyPolicy = \"auto\" | \"explicit\";\n\n/** The Zod schema of the `DependencyPolicy` type. */\nexport const DependencyPolicy: z.ZodType<DependencyPolicy> = z\n .enum([\"auto\", \"explicit\"])\n .register(wireRegistry, {\n id: \"DependencyPolicy\",\n description:\n \"How packages enter an artifact's lockfile: auto installs what artifacts import; explicit only what deps/add adds (D43).\",\n });\n\n/** The params of `mostra/initialize` (INTERFACES §6). */\nexport interface MostraInitializeParams {\n /** Who is connecting. */\n readonly client: ClientInfo;\n /**\n * The host protocol revisions the client speaks. The instance picks the newest one it also\n * supports, or refuses with `MOSTRA_HOST_REVISION_UNSUPPORTED`. Entries that aren't revisions\n * never match.\n */\n readonly revisions: readonly string[];\n /** What the client can handle. */\n readonly capabilities: ClientCapabilities;\n /**\n * Ports the client implements. The instance calls a port only on the connection that registered\n * it; ports it doesn't support get a `MOSTRA_HOST_PORT_UNSUPPORTED` warning.\n */\n readonly ports: readonly PortName[];\n /** Home settings and the home check. */\n readonly home?: HomeConfig;\n /**\n * On a binding to a remote server, the owner instance's link (INTERFACES §18.2): its `lnk_` ID,\n * its relay mark and the hosted home's position it committed. Other sessions send none.\n */\n readonly link?: OwnerLinkInfo;\n}\n\n/** The instance a client is connected to. */\nexport interface InstanceInfo {\n /** The runtime release (`@mostra/runtime` version). */\n readonly version: string;\n /** The home's real path. */\n readonly home: string;\n /** The platform as `<os>-<arch>`, for example `darwin-arm64`. */\n readonly platform: string;\n /** The supervisor's process ID. */\n readonly pid: number;\n /**\n * `host` when spawned over stdio (`mostra-runtime host`), `daemon` when started as a daemon,\n * `hosted` for a hosted home on a remote server (INTERFACES §18.2).\n */\n readonly mode: \"host\" | \"daemon\" | \"hosted\";\n /** A hosted home's current incarnation, rotated when it is restored from a backup. */\n readonly incarnation?: string;\n /** A hosted home's head: its newest event cursor. */\n readonly cursor?: string;\n}\n\n/** What the instance offers (D84). */\nexport interface InstanceCapabilities {\n /** Every method the instance serves. */\n readonly methods: readonly string[];\n /** Every notification the instance may send. */\n readonly notifications: readonly string[];\n /** The ports the instance calls when a client registers them. */\n readonly ports: readonly PortName[];\n}\n\n/** The result of `mostra/initialize`. */\nexport interface MostraInitializeResult {\n /** The negotiated host protocol revision: the newest both sides support. */\n readonly revision: Revision;\n /** The instance the client is connected to. */\n readonly instance: InstanceInfo;\n /** What the instance offers. */\n readonly capabilities: InstanceCapabilities;\n /** Warnings about the session, such as ports the instance doesn't support. */\n readonly warnings: readonly Diagnostic[];\n}\n\n/** The Zod schema of the `ClientInfo` type. */\nexport const ClientInfo: z.ZodType<ClientInfo> = z\n .object({ name: z.string().min(1), version: z.string() })\n .register(wireRegistry, { id: \"ClientInfo\", description: \"The client that opens a connection.\" });\n\n/** The Zod schema of the `ClientCapabilities` type. */\nexport const ClientCapabilities: z.ZodType<ClientCapabilities> = z\n .object({ notifications: z.array(z.string()).readonly().exactOptional() })\n .register(wireRegistry, {\n id: \"ClientCapabilities\",\n description: \"What the client can handle: the notification methods it accepts.\",\n });\n\n/** The Zod schema of the `HomeConfig` type. */\nexport const HomeConfig: z.ZodType<HomeConfig> = z\n .object({\n path: z.string().min(1).exactOptional(),\n dependencies: DependencyPolicy.exactOptional(),\n submission: SubmissionPolicy.exactOptional(),\n ports: z.array(PortName).max(32).readonly().exactOptional(),\n submitChannels: z.array(SubmitChannel).min(1).max(2).readonly().exactOptional(),\n })\n .register(wireRegistry, {\n id: \"HomeConfig\",\n description:\n \"Home settings from a spawning host; path is a check against the instance's home (D84), dependencies the dependency policy (D43), submission the home's policy (D102), ports those the host always provides (D105).\",\n });\n\n/** The Zod schema of the `InstanceInfo` type. */\nexport const InstanceInfo: z.ZodType<InstanceInfo> = z\n .object({\n version: z.string(),\n home: z.string(),\n platform: z.string(),\n pid: z.int().min(1),\n mode: z.enum([\"host\", \"daemon\", \"hosted\"]),\n incarnation: z.string().exactOptional(),\n cursor: z.string().exactOptional(),\n })\n .register(wireRegistry, {\n id: \"InstanceInfo\",\n description: \"The instance a client is connected to.\",\n });\n\n/** The Zod schema of the `InstanceCapabilities` type. */\nexport const InstanceCapabilities: z.ZodType<InstanceCapabilities> = z\n .object({\n methods: z.array(z.string()).readonly(),\n notifications: z.array(z.string()).readonly(),\n ports: z.array(PortName).readonly(),\n })\n .register(wireRegistry, {\n id: \"InstanceCapabilities\",\n description: \"What the instance offers: methods, notifications and supported ports.\",\n });\n\nconst params: z.ZodType<MostraInitializeParams> = z\n .object({\n client: ClientInfo,\n revisions: z.array(z.string()).readonly(),\n capabilities: ClientCapabilities,\n ports: z.array(PortName).readonly(),\n home: HomeConfig.exactOptional(),\n link: OwnerLinkInfo.exactOptional(),\n })\n .register(wireRegistry, { id: \"MostraInitializeParams\" });\n\nconst result: z.ZodType<MostraInitializeResult> = z\n .object({\n revision: Revision.schema,\n instance: InstanceInfo,\n capabilities: InstanceCapabilities,\n warnings: z.array(Diagnostic).readonly(),\n })\n .register(wireRegistry, { id: \"MostraInitializeResult\" });\n\n/**\n * `mostra/initialize`: opens a session. It must be the first request on a connection and is sent\n * once. It negotiates the protocol revision, registers the client's ports on this connection and\n * checks the home (D59, D84).\n */\nexport const mostraInitializeMethod: MethodDefinition<\n MostraInitializeParams,\n MostraInitializeResult\n> = defineMethod({\n method: \"mostra/initialize\",\n direction: \"client-to-instance\",\n mutating: false,\n params,\n result,\n});\n"],"mappings":";;;;;;;;;;AA4BA,MAAa,WAAwC,EAClD,OAAO,CAAC,CACR,MAAM,qBAAqB,CAAC,CAC5B,SAAS,cAAc;CACtB,IAAI;CACJ,aACE;AACJ,CAAC;;;;;;AAOH,MAAa,kBAAkB;;AAuD/B,MAAa,mBAAgD,EAC1D,KAAK,CAAC,QAAQ,UAAU,CAAC,CAAC,CAC1B,SAAS,cAAc;CACtB,IAAI;CACJ,aACE;AACJ,CAAC;;AAwEH,MAAa,aAAoC,EAC9C,OAAO;CAAE,MAAM,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC;CAAG,SAAS,EAAE,OAAO;AAAE,CAAC,CAAC,CACxD,SAAS,cAAc;CAAE,IAAI;CAAc,aAAa;AAAsC,CAAC;;AAGlG,MAAa,qBAAoD,EAC9D,OAAO,EAAE,eAAe,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,cAAc,EAAE,CAAC,CAAC,CACzE,SAAS,cAAc;CACtB,IAAI;CACJ,aAAa;AACf,CAAC;;AAGH,MAAa,aAAoC,EAC9C,OAAO;CACN,MAAM,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,cAAc;CACtC,cAAc,iBAAiB,cAAc;CAC7C,YAAY,iBAAiB,cAAc;CAC3C,OAAO,EAAE,MAAM,QAAQ,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,cAAc;CAC1D,gBAAgB,EAAE,MAAM,aAAa,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,cAAc;AAChF,CAAC,CAAC,CACD,SAAS,cAAc;CACtB,IAAI;CACJ,aACE;AACJ,CAAC;;AAGH,MAAa,eAAwC,EAClD,OAAO;CACN,SAAS,EAAE,OAAO;CAClB,MAAM,EAAE,OAAO;CACf,UAAU,EAAE,OAAO;CACnB,KAAK,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC;CAClB,MAAM,EAAE,KAAK;EAAC;EAAQ;EAAU;CAAQ,CAAC;CACzC,aAAa,EAAE,OAAO,CAAC,CAAC,cAAc;CACtC,QAAQ,EAAE,OAAO,CAAC,CAAC,cAAc;AACnC,CAAC,CAAC,CACD,SAAS,cAAc;CACtB,IAAI;CACJ,aAAa;AACf,CAAC;;AAGH,MAAa,uBAAwD,EAClE,OAAO;CACN,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,SAAS;CACtC,eAAe,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,SAAS;CAC5C,OAAO,EAAE,MAAM,QAAQ,CAAC,CAAC,SAAS;AACpC,CAAC,CAAC,CACD,SAAS,cAAc;CACtB,IAAI;CACJ,aAAa;AACf,CAAC;AAEH,MAAM,SAA4C,EAC/C,OAAO;CACN,QAAQ;CACR,WAAW,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,SAAS;CACxC,cAAc;CACd,OAAO,EAAE,MAAM,QAAQ,CAAC,CAAC,SAAS;CAClC,MAAM,WAAW,cAAc;CAC/B,MAAM,cAAc,cAAc;AACpC,CAAC,CAAC,CACD,SAAS,cAAc,EAAE,IAAI,yBAAyB,CAAC;AAE1D,MAAM,SAA4C,EAC/C,OAAO;CACN,UAAU,SAAS;CACnB,UAAU;CACV,cAAc;CACd,UAAU,EAAE,MAAM,UAAU,CAAC,CAAC,SAAS;AACzC,CAAC,CAAC,CACD,SAAS,cAAc,EAAE,IAAI,yBAAyB,CAAC;;;;;;AAO1D,MAAa,yBAGT,aAAa;CACf,QAAQ;CACR,WAAW;CACX,UAAU;CACV;CACA;AACF,CAAC"}
@@ -0,0 +1,33 @@
1
+ import { Batches } from "../../actions.js";
2
+ import { MethodDefinition } from "../../method.js";
3
+ import { RelayViewer } from "./relay-run.js";
4
+ //#region src/methods/port/relay-call.d.ts
5
+ /** The params of `port/relay.call` (INTERFACES §18.3). */
6
+ export interface PortRelayCallParams {
7
+ /** The hosted home's ID for this call: its batches come back as `relay/call.batch`. */
8
+ readonly callId: string;
9
+ /** The artifact, by its own ID. */
10
+ readonly artifactId: string;
11
+ /** The version whose server code answers it: the view's. */
12
+ readonly versionId: string;
13
+ /** The server function. */
14
+ readonly fnId: string;
15
+ /** Its serialized arguments. */
16
+ readonly args: Batches;
17
+ /** Who called it. */
18
+ readonly viewer?: RelayViewer;
19
+ /** The hosted view that called it. */
20
+ readonly viewId?: string;
21
+ }
22
+ /** The result of `port/relay.call`. */
23
+ export interface PortRelayCallResult {
24
+ /** Always `true`: the owner's worker has the call. */
25
+ readonly accepted: true;
26
+ }
27
+ /**
28
+ * `port/relay.call`: a plain call relayed to the owner while it is connected (D165 item 4); it
29
+ * leaves no record, and its batches and end come back as `relay/call.batch`.
30
+ */
31
+ export declare const portRelayCallMethod: MethodDefinition<PortRelayCallParams, PortRelayCallResult>;
32
+ //#endregion
33
+ //# sourceMappingURL=relay-call.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"relay-call.d.ts","names":[],"sources":["../../../src/methods/port/relay-call.ts"],"mappings":";;;;;iBAOiB;;WAEN;;WAEA;;WAEA;;WAEA;;WAEA,MAAM;;WAEN,SAAS;;WAET;;;iBAIM;;WAEN;;;;;;qBAuBE,qBAAqB,iBAAiB,qBAAqB"}
@@ -0,0 +1,31 @@
1
+ import { wireRegistry } from "../../wire-registry.js";
2
+ import { Batches } from "../../actions.js";
3
+ import { defineMethod } from "../../method.js";
4
+ import { RelayViewer } from "./relay-run.js";
5
+ import * as z from "zod";
6
+ //#region src/methods/port/relay-call.ts
7
+ const params = z.object({
8
+ callId: z.string().min(1),
9
+ artifactId: z.string().min(1),
10
+ versionId: z.string().min(1),
11
+ fnId: z.string().min(1),
12
+ args: Batches,
13
+ viewer: RelayViewer.exactOptional(),
14
+ viewId: z.string().exactOptional()
15
+ }).register(wireRegistry, { id: "PortRelayCallParams" });
16
+ const result = z.object({ accepted: z.literal(true) }).register(wireRegistry, { id: "PortRelayCallResult" });
17
+ /**
18
+ * `port/relay.call`: a plain call relayed to the owner while it is connected (D165 item 4); it
19
+ * leaves no record, and its batches and end come back as `relay/call.batch`.
20
+ */
21
+ const portRelayCallMethod = defineMethod({
22
+ method: "port/relay.call",
23
+ direction: "instance-to-host",
24
+ mutating: false,
25
+ params,
26
+ result
27
+ });
28
+ //#endregion
29
+ export { portRelayCallMethod };
30
+
31
+ //# sourceMappingURL=relay-call.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"relay-call.js","names":[],"sources":["../../../src/methods/port/relay-call.ts"],"sourcesContent":["import * as z from \"zod\";\nimport { Batches } from \"../../actions.ts\";\nimport { defineMethod, type MethodDefinition } from \"../../method.ts\";\nimport { wireRegistry } from \"../../wire-registry.ts\";\nimport { RelayViewer } from \"./relay-run.ts\";\n\n/** The params of `port/relay.call` (INTERFACES §18.3). */\nexport interface PortRelayCallParams {\n /** The hosted home's ID for this call: its batches come back as `relay/call.batch`. */\n readonly callId: string;\n /** The artifact, by its own ID. */\n readonly artifactId: string;\n /** The version whose server code answers it: the view's. */\n readonly versionId: string;\n /** The server function. */\n readonly fnId: string;\n /** Its serialized arguments. */\n readonly args: Batches;\n /** Who called it. */\n readonly viewer?: RelayViewer;\n /** The hosted view that called it. */\n readonly viewId?: string;\n}\n\n/** The result of `port/relay.call`. */\nexport interface PortRelayCallResult {\n /** Always `true`: the owner's worker has the call. */\n readonly accepted: true;\n}\n\nconst params: z.ZodType<PortRelayCallParams> = z\n .object({\n callId: z.string().min(1),\n artifactId: z.string().min(1),\n versionId: z.string().min(1),\n fnId: z.string().min(1),\n args: Batches,\n viewer: RelayViewer.exactOptional(),\n viewId: z.string().exactOptional(),\n })\n .register(wireRegistry, { id: \"PortRelayCallParams\" });\n\nconst result: z.ZodType<PortRelayCallResult> = z\n .object({ accepted: z.literal(true) })\n .register(wireRegistry, { id: \"PortRelayCallResult\" });\n\n/**\n * `port/relay.call`: a plain call relayed to the owner while it is connected (D165 item 4); it\n * leaves no record, and its batches and end come back as `relay/call.batch`.\n */\nexport const portRelayCallMethod: MethodDefinition<PortRelayCallParams, PortRelayCallResult> =\n defineMethod({\n method: \"port/relay.call\",\n direction: \"instance-to-host\",\n mutating: false,\n params,\n result,\n });\n"],"mappings":";;;;;;AA8BA,MAAM,SAAyC,EAC5C,OAAO;CACN,QAAQ,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC;CACxB,YAAY,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC;CAC5B,WAAW,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC;CAC3B,MAAM,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC;CACtB,MAAM;CACN,QAAQ,YAAY,cAAc;CAClC,QAAQ,EAAE,OAAO,CAAC,CAAC,cAAc;AACnC,CAAC,CAAC,CACD,SAAS,cAAc,EAAE,IAAI,sBAAsB,CAAC;AAEvD,MAAM,SAAyC,EAC5C,OAAO,EAAE,UAAU,EAAE,QAAQ,IAAI,EAAE,CAAC,CAAC,CACrC,SAAS,cAAc,EAAE,IAAI,sBAAsB,CAAC;;;;;AAMvD,MAAa,sBACX,aAAa;CACX,QAAQ;CACR,WAAW;CACX,UAAU;CACV;CACA;AACF,CAAC"}
@@ -0,0 +1,16 @@
1
+ import { MethodDefinition } from "../../method.js";
2
+ //#region src/methods/port/relay-cancel.d.ts
3
+ /** The params of `port/relay.cancel` (INTERFACES §18.3). */
4
+ export interface PortRelayCancelParams {
5
+ /** The hosted run to cancel. */
6
+ readonly runId: string;
7
+ }
8
+ /** The result of `port/relay.cancel`. */
9
+ export type PortRelayCancelResult = Record<string, never>;
10
+ /**
11
+ * `port/relay.cancel`: a viewer cancelled a relayed run; the owner fires its `abortSignal` if it
12
+ * still runs (AC-04). A cancel made while the owner was away arrives on reconnect.
13
+ */
14
+ export declare const portRelayCancelMethod: MethodDefinition<PortRelayCancelParams, PortRelayCancelResult>;
15
+ //#endregion
16
+ //# sourceMappingURL=relay-cancel.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"relay-cancel.d.ts","names":[],"sources":["../../../src/methods/port/relay-cancel.ts"],"mappings":";;;iBAKiB;;WAEN;;;YAIC,wBAAwB;;;;;qBAcvB,uBAAuB,iBAAiB,uBAAuB"}
@@ -0,0 +1,21 @@
1
+ import { wireRegistry } from "../../wire-registry.js";
2
+ import { defineMethod } from "../../method.js";
3
+ import * as z from "zod";
4
+ //#region src/methods/port/relay-cancel.ts
5
+ const params = z.object({ runId: z.string().min(1) }).register(wireRegistry, { id: "PortRelayCancelParams" });
6
+ const result = z.object({}).register(wireRegistry, { id: "PortRelayCancelResult" });
7
+ /**
8
+ * `port/relay.cancel`: a viewer cancelled a relayed run; the owner fires its `abortSignal` if it
9
+ * still runs (AC-04). A cancel made while the owner was away arrives on reconnect.
10
+ */
11
+ const portRelayCancelMethod = defineMethod({
12
+ method: "port/relay.cancel",
13
+ direction: "instance-to-host",
14
+ mutating: false,
15
+ params,
16
+ result
17
+ });
18
+ //#endregion
19
+ export { portRelayCancelMethod };
20
+
21
+ //# sourceMappingURL=relay-cancel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"relay-cancel.js","names":[],"sources":["../../../src/methods/port/relay-cancel.ts"],"sourcesContent":["import * as z from \"zod\";\nimport { defineMethod, type MethodDefinition } from \"../../method.ts\";\nimport { wireRegistry } from \"../../wire-registry.ts\";\n\n/** The params of `port/relay.cancel` (INTERFACES §18.3). */\nexport interface PortRelayCancelParams {\n /** The hosted run to cancel. */\n readonly runId: string;\n}\n\n/** The result of `port/relay.cancel`. */\nexport type PortRelayCancelResult = Record<string, never>;\n\nconst params: z.ZodType<PortRelayCancelParams> = z\n .object({ runId: z.string().min(1) })\n .register(wireRegistry, { id: \"PortRelayCancelParams\" });\n\nconst result: z.ZodType<PortRelayCancelResult> = z\n .object({})\n .register(wireRegistry, { id: \"PortRelayCancelResult\" });\n\n/**\n * `port/relay.cancel`: a viewer cancelled a relayed run; the owner fires its `abortSignal` if it\n * still runs (AC-04). A cancel made while the owner was away arrives on reconnect.\n */\nexport const portRelayCancelMethod: MethodDefinition<PortRelayCancelParams, PortRelayCancelResult> =\n defineMethod({\n method: \"port/relay.cancel\",\n direction: \"instance-to-host\",\n mutating: false,\n params,\n result,\n });\n"],"mappings":";;;;AAaA,MAAM,SAA2C,EAC9C,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CACpC,SAAS,cAAc,EAAE,IAAI,wBAAwB,CAAC;AAEzD,MAAM,SAA2C,EAC9C,OAAO,CAAC,CAAC,CAAC,CACV,SAAS,cAAc,EAAE,IAAI,wBAAwB,CAAC;;;;;AAMzD,MAAa,wBACX,aAAa;CACX,QAAQ;CACR,WAAW;CACX,UAAU;CACV;CACA;AACF,CAAC"}
@@ -0,0 +1,25 @@
1
+ import { MethodDefinition } from "../../method.js";
2
+ //#region src/methods/port/relay-live.d.ts
3
+ /** The params of `port/relay.live` (INTERFACES §18.3). */
4
+ export interface PortRelayLiveParams {
5
+ /** The artifact, by its own ID. */
6
+ readonly artifactId: string;
7
+ /** The version whose producers are wanted: the artifact's latest on the hosted home. */
8
+ readonly versionId: string;
9
+ /**
10
+ * `start` and `renew` keep the producers of `keys` running for a minute; `stop` lets them stop;
11
+ * `refresh` asks them to load again now.
12
+ */
13
+ readonly interest: "start" | "renew" | "stop" | "refresh";
14
+ /** The live sources' keys. */
15
+ readonly keys: readonly string[];
16
+ }
17
+ /** The result of `port/relay.live`. */
18
+ export type PortRelayLiveResult = Record<string, never>;
19
+ /**
20
+ * `port/relay.live`: viewers of a hosted page want (or no longer want) its live sources, so their
21
+ * producers run on the owner instance while someone views (D165 item 4).
22
+ */
23
+ export declare const portRelayLiveMethod: MethodDefinition<PortRelayLiveParams, PortRelayLiveResult>;
24
+ //#endregion
25
+ //# sourceMappingURL=relay-live.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"relay-live.d.ts","names":[],"sources":["../../../src/methods/port/relay-live.ts"],"mappings":";;;iBAMiB;;WAEN;;WAEA;;;;;WAKA;;WAEA;;;YAIC,sBAAsB;;;;;qBAmBrB,qBAAqB,iBAAiB,qBAAqB"}
@@ -0,0 +1,32 @@
1
+ import { wireRegistry } from "../../wire-registry.js";
2
+ import { LIVE_KEY_PATTERN } from "../../actions.js";
3
+ import { defineMethod } from "../../method.js";
4
+ import * as z from "zod";
5
+ //#region src/methods/port/relay-live.ts
6
+ const params = z.object({
7
+ artifactId: z.string().min(1),
8
+ versionId: z.string().min(1),
9
+ interest: z.enum([
10
+ "start",
11
+ "renew",
12
+ "stop",
13
+ "refresh"
14
+ ]),
15
+ keys: z.array(z.string().regex(LIVE_KEY_PATTERN)).max(1e3).readonly()
16
+ }).register(wireRegistry, { id: "PortRelayLiveParams" });
17
+ const result = z.object({}).register(wireRegistry, { id: "PortRelayLiveResult" });
18
+ /**
19
+ * `port/relay.live`: viewers of a hosted page want (or no longer want) its live sources, so their
20
+ * producers run on the owner instance while someone views (D165 item 4).
21
+ */
22
+ const portRelayLiveMethod = defineMethod({
23
+ method: "port/relay.live",
24
+ direction: "instance-to-host",
25
+ mutating: false,
26
+ params,
27
+ result
28
+ });
29
+ //#endregion
30
+ export { portRelayLiveMethod };
31
+
32
+ //# sourceMappingURL=relay-live.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"relay-live.js","names":[],"sources":["../../../src/methods/port/relay-live.ts"],"sourcesContent":["import * as z from \"zod\";\nimport { LIVE_KEY_PATTERN } from \"../../actions.ts\";\nimport { defineMethod, type MethodDefinition } from \"../../method.ts\";\nimport { wireRegistry } from \"../../wire-registry.ts\";\n\n/** The params of `port/relay.live` (INTERFACES §18.3). */\nexport interface PortRelayLiveParams {\n /** The artifact, by its own ID. */\n readonly artifactId: string;\n /** The version whose producers are wanted: the artifact's latest on the hosted home. */\n readonly versionId: string;\n /**\n * `start` and `renew` keep the producers of `keys` running for a minute; `stop` lets them stop;\n * `refresh` asks them to load again now.\n */\n readonly interest: \"start\" | \"renew\" | \"stop\" | \"refresh\";\n /** The live sources' keys. */\n readonly keys: readonly string[];\n}\n\n/** The result of `port/relay.live`. */\nexport type PortRelayLiveResult = Record<string, never>;\n\nconst params: z.ZodType<PortRelayLiveParams> = z\n .object({\n artifactId: z.string().min(1),\n versionId: z.string().min(1),\n interest: z.enum([\"start\", \"renew\", \"stop\", \"refresh\"]),\n keys: z.array(z.string().regex(LIVE_KEY_PATTERN)).max(1000).readonly(),\n })\n .register(wireRegistry, { id: \"PortRelayLiveParams\" });\n\nconst result: z.ZodType<PortRelayLiveResult> = z\n .object({})\n .register(wireRegistry, { id: \"PortRelayLiveResult\" });\n\n/**\n * `port/relay.live`: viewers of a hosted page want (or no longer want) its live sources, so their\n * producers run on the owner instance while someone views (D165 item 4).\n */\nexport const portRelayLiveMethod: MethodDefinition<PortRelayLiveParams, PortRelayLiveResult> =\n defineMethod({\n method: \"port/relay.live\",\n direction: \"instance-to-host\",\n mutating: false,\n params,\n result,\n });\n"],"mappings":";;;;;AAuBA,MAAM,SAAyC,EAC5C,OAAO;CACN,YAAY,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC;CAC5B,WAAW,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC;CAC3B,UAAU,EAAE,KAAK;EAAC;EAAS;EAAS;EAAQ;CAAS,CAAC;CACtD,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC,MAAM,gBAAgB,CAAC,CAAC,CAAC,IAAI,GAAI,CAAC,CAAC,SAAS;AACvE,CAAC,CAAC,CACD,SAAS,cAAc,EAAE,IAAI,sBAAsB,CAAC;AAEvD,MAAM,SAAyC,EAC5C,OAAO,CAAC,CAAC,CAAC,CACV,SAAS,cAAc,EAAE,IAAI,sBAAsB,CAAC;;;;;AAMvD,MAAa,sBACX,aAAa;CACX,QAAQ;CACR,WAAW;CACX,UAAU;CACV;CACA;AACF,CAAC"}
@@ -0,0 +1,39 @@
1
+ import { RunState } from "../../actions.js";
2
+ import { MethodDefinition } from "../../method.js";
3
+ //#region src/methods/port/relay-reconcile.d.ts
4
+ /** What the hosted home holds of a run already, so the owner answers only what is newer. */
5
+ export interface RelayHeld {
6
+ /** The run. */
7
+ readonly runId: string;
8
+ /** How many log lines it holds. */
9
+ readonly log: number;
10
+ /** How many result batches it holds. */
11
+ readonly batches: number;
12
+ }
13
+ /** The params of `port/relay.reconcile` (INTERFACES §18.3). */
14
+ export interface PortRelayReconcileParams {
15
+ /** The runs the owner accepted and the hosted home holds no end for. */
16
+ readonly runs: readonly string[];
17
+ /** What the hosted home holds of each (additive: the owner answers from there). */
18
+ readonly held?: readonly RelayHeld[];
19
+ }
20
+ /** One run as the owner knows it, or `unknown-to-owner` when its ledger has no such run. */
21
+ export interface RelayReconciled {
22
+ /** The run. */
23
+ readonly runId: string;
24
+ /** Its state from the held positions on, or `unknown-to-owner`. */
25
+ readonly state: RunState | "unknown-to-owner";
26
+ }
27
+ /** The result of `port/relay.reconcile`. */
28
+ export interface PortRelayReconcileResult {
29
+ /** One answer per run asked about. */
30
+ readonly runs: readonly RelayReconciled[];
31
+ }
32
+ /**
33
+ * `port/relay.reconcile`: after every reconnect, before any waiting run drains, the hosted home
34
+ * asks its owner for the runs it accepted and hasn't finished (D165 item 4); a run the owner
35
+ * doesn't know becomes `unknown` and is never sent again.
36
+ */
37
+ export declare const portRelayReconcileMethod: MethodDefinition<PortRelayReconcileParams, PortRelayReconcileResult>;
38
+ //#endregion
39
+ //# sourceMappingURL=relay-reconcile.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"relay-reconcile.d.ts","names":[],"sources":["../../../src/methods/port/relay-reconcile.ts"],"mappings":";;;;iBAMiB;;WAEN;;WAEA;;WAEA;;;iBAIM;;WAEN;;WAEA,gBAAgB;;;iBAIV;;WAEN;;WAEA,OAAO;;;iBAID;;WAEN,eAAe;;;;;;;qBA2Bb,0BAA0B,iBACrC,0BACA"}