@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
@@ -0,0 +1,35 @@
1
+ import { wireRegistry } from "../../wire-registry.js";
2
+ import { RunState } from "../../actions.js";
3
+ import { defineMethod } from "../../method.js";
4
+ import * as z from "zod";
5
+ //#region src/methods/port/relay-reconcile.ts
6
+ const held = z.object({
7
+ runId: z.string().min(1),
8
+ log: z.int().min(0),
9
+ batches: z.int().min(0)
10
+ }).register(wireRegistry, { id: "RelayHeld" });
11
+ const params = z.object({
12
+ runs: z.array(z.string().min(1)).max(1e4).readonly(),
13
+ held: z.array(held).max(1e4).readonly().exactOptional()
14
+ }).register(wireRegistry, { id: "PortRelayReconcileParams" });
15
+ const reconciled = z.object({
16
+ runId: z.string(),
17
+ state: z.union([RunState, z.literal("unknown-to-owner")])
18
+ }).register(wireRegistry, { id: "RelayReconciled" });
19
+ const result = z.object({ runs: z.array(reconciled).readonly() }).register(wireRegistry, { id: "PortRelayReconcileResult" });
20
+ /**
21
+ * `port/relay.reconcile`: after every reconnect, before any waiting run drains, the hosted home
22
+ * asks its owner for the runs it accepted and hasn't finished (D165 item 4); a run the owner
23
+ * doesn't know becomes `unknown` and is never sent again.
24
+ */
25
+ const portRelayReconcileMethod = defineMethod({
26
+ method: "port/relay.reconcile",
27
+ direction: "instance-to-host",
28
+ mutating: false,
29
+ params,
30
+ result
31
+ });
32
+ //#endregion
33
+ export { portRelayReconcileMethod };
34
+
35
+ //# sourceMappingURL=relay-reconcile.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"relay-reconcile.js","names":[],"sources":["../../../src/methods/port/relay-reconcile.ts"],"sourcesContent":["import * as z from \"zod\";\nimport { RunState } from \"../../actions.ts\";\nimport { defineMethod, type MethodDefinition } from \"../../method.ts\";\nimport { wireRegistry } from \"../../wire-registry.ts\";\n\n/** What the hosted home holds of a run already, so the owner answers only what is newer. */\nexport interface RelayHeld {\n /** The run. */\n readonly runId: string;\n /** How many log lines it holds. */\n readonly log: number;\n /** How many result batches it holds. */\n readonly batches: number;\n}\n\n/** The params of `port/relay.reconcile` (INTERFACES §18.3). */\nexport interface PortRelayReconcileParams {\n /** The runs the owner accepted and the hosted home holds no end for. */\n readonly runs: readonly string[];\n /** What the hosted home holds of each (additive: the owner answers from there). */\n readonly held?: readonly RelayHeld[];\n}\n\n/** One run as the owner knows it, or `unknown-to-owner` when its ledger has no such run. */\nexport interface RelayReconciled {\n /** The run. */\n readonly runId: string;\n /** Its state from the held positions on, or `unknown-to-owner`. */\n readonly state: RunState | \"unknown-to-owner\";\n}\n\n/** The result of `port/relay.reconcile`. */\nexport interface PortRelayReconcileResult {\n /** One answer per run asked about. */\n readonly runs: readonly RelayReconciled[];\n}\n\nconst held: z.ZodType<RelayHeld> = z\n .object({ runId: z.string().min(1), log: z.int().min(0), batches: z.int().min(0) })\n .register(wireRegistry, { id: \"RelayHeld\" });\n\nconst params: z.ZodType<PortRelayReconcileParams> = z\n .object({\n runs: z.array(z.string().min(1)).max(10_000).readonly(),\n held: z.array(held).max(10_000).readonly().exactOptional(),\n })\n .register(wireRegistry, { id: \"PortRelayReconcileParams\" });\n\nconst reconciled: z.ZodType<RelayReconciled> = z\n .object({ runId: z.string(), state: z.union([RunState, z.literal(\"unknown-to-owner\")]) })\n .register(wireRegistry, { id: \"RelayReconciled\" });\n\nconst result: z.ZodType<PortRelayReconcileResult> = z\n .object({ runs: z.array(reconciled).readonly() })\n .register(wireRegistry, { id: \"PortRelayReconcileResult\" });\n\n/**\n * `port/relay.reconcile`: after every reconnect, before any waiting run drains, the hosted home\n * asks its owner for the runs it accepted and hasn't finished (D165 item 4); a run the owner\n * doesn't know becomes `unknown` and is never sent again.\n */\nexport const portRelayReconcileMethod: MethodDefinition<\n PortRelayReconcileParams,\n PortRelayReconcileResult\n> = defineMethod({\n method: \"port/relay.reconcile\",\n direction: \"instance-to-host\",\n mutating: false,\n params,\n result,\n});\n"],"mappings":";;;;;AAqCA,MAAM,OAA6B,EAChC,OAAO;CAAE,OAAO,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC;CAAG,KAAK,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC;CAAG,SAAS,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC;AAAE,CAAC,CAAC,CAClF,SAAS,cAAc,EAAE,IAAI,YAAY,CAAC;AAE7C,MAAM,SAA8C,EACjD,OAAO;CACN,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,GAAM,CAAC,CAAC,SAAS;CACtD,MAAM,EAAE,MAAM,IAAI,CAAC,CAAC,IAAI,GAAM,CAAC,CAAC,SAAS,CAAC,CAAC,cAAc;AAC3D,CAAC,CAAC,CACD,SAAS,cAAc,EAAE,IAAI,2BAA2B,CAAC;AAE5D,MAAM,aAAyC,EAC5C,OAAO;CAAE,OAAO,EAAE,OAAO;CAAG,OAAO,EAAE,MAAM,CAAC,UAAU,EAAE,QAAQ,kBAAkB,CAAC,CAAC;AAAE,CAAC,CAAC,CACxF,SAAS,cAAc,EAAE,IAAI,kBAAkB,CAAC;AAEnD,MAAM,SAA8C,EACjD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC,CAAC,SAAS,EAAE,CAAC,CAAC,CAChD,SAAS,cAAc,EAAE,IAAI,2BAA2B,CAAC;;;;;;AAO5D,MAAa,2BAGT,aAAa;CACf,QAAQ;CACR,WAAW;CACX,UAAU;CACV;CACA;AACF,CAAC"}
@@ -0,0 +1,47 @@
1
+ import { Batches } from "../../actions.js";
2
+ import { MethodDefinition } from "../../method.js";
3
+ import * as z from "zod";
4
+ //#region src/methods/port/relay-run.d.ts
5
+ /** Who pressed a relayed action, as its server code's `viewer()` reads it. */
6
+ export interface RelayViewer {
7
+ /** The hosted home's viewer ID. */
8
+ readonly id: string;
9
+ /** The display name, when one is known. */
10
+ readonly name?: string;
11
+ }
12
+ /** The Zod schema of the `RelayViewer` type. */
13
+ export declare const RelayViewer: z.ZodType<RelayViewer>;
14
+ /** The params of `port/relay.run` (INTERFACES §18.3). */
15
+ export interface PortRelayRunParams {
16
+ /** The hosted home's run ID: the owner records the run under it, so a repeat joins it. */
17
+ readonly runId: string;
18
+ /** The run's relay sequence, unique per owner link and growing (the owner's `relayMark`). */
19
+ readonly seq: number;
20
+ /** The artifact, by its own ID. */
21
+ readonly artifactId: string;
22
+ /** The version whose server code runs it: the view's. */
23
+ readonly versionId: string;
24
+ /** The server function: `<module path>#<export>`. */
25
+ readonly fnId: string;
26
+ /** Its serialized arguments. */
27
+ readonly args: Batches;
28
+ /** The run's idempotency key, which the hosted home checked (D130). */
29
+ readonly key?: string;
30
+ /** Who pressed it. */
31
+ readonly viewer?: RelayViewer;
32
+ /** The hosted view that started it. */
33
+ readonly viewId?: string;
34
+ }
35
+ /** The result of `port/relay.run`: the owner recorded the run, so it happens at most once. */
36
+ export interface PortRelayRunResult {
37
+ /** Always `true`: a run the owner can't record is an error. */
38
+ readonly accepted: true;
39
+ }
40
+ /**
41
+ * `port/relay.run`: a hosted home hands its owner instance a run to execute (D165 item 4), answered
42
+ * once the owner recorded it under the hosted run's ID; its progress, log, result and end come back
43
+ * as `relay/run.update`.
44
+ */
45
+ export declare const portRelayRunMethod: MethodDefinition<PortRelayRunParams, PortRelayRunResult>;
46
+ //#endregion
47
+ //# sourceMappingURL=relay-run.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"relay-run.d.ts","names":[],"sources":["../../../src/methods/port/relay-run.ts"],"mappings":";;;;;iBAMiB;;WAEN;;WAEA;;;qBAIE,aAAa,EAAE,QAAQ;;iBAQnB;;WAEN;;WAEA;;WAEA;;WAEA;;WAEA;;WAEA,MAAM;;WAEN;;WAEA,SAAS;;WAET;;;iBAIM;;WAEN;;;;;;;qBA0BE,oBAAoB,iBAAiB,oBAAoB"}
@@ -0,0 +1,41 @@
1
+ import { wireRegistry } from "../../wire-registry.js";
2
+ import { Batches } from "../../actions.js";
3
+ import { defineMethod } from "../../method.js";
4
+ import * as z from "zod";
5
+ //#region src/methods/port/relay-run.ts
6
+ /** The Zod schema of the `RelayViewer` type. */
7
+ const RelayViewer = z.object({
8
+ id: z.string().min(1),
9
+ name: z.string().exactOptional()
10
+ }).register(wireRegistry, {
11
+ id: "RelayViewer",
12
+ description: "The viewer a relayed run or call acts for: the hosted home's viewer ID and name."
13
+ });
14
+ const params = z.object({
15
+ runId: z.string().min(1),
16
+ seq: z.int().min(1),
17
+ artifactId: z.string().min(1),
18
+ versionId: z.string().min(1),
19
+ fnId: z.string().min(1),
20
+ args: Batches,
21
+ key: z.string().exactOptional(),
22
+ viewer: RelayViewer.exactOptional(),
23
+ viewId: z.string().exactOptional()
24
+ }).register(wireRegistry, { id: "PortRelayRunParams" });
25
+ const result = z.object({ accepted: z.literal(true) }).register(wireRegistry, { id: "PortRelayRunResult" });
26
+ /**
27
+ * `port/relay.run`: a hosted home hands its owner instance a run to execute (D165 item 4), answered
28
+ * once the owner recorded it under the hosted run's ID; its progress, log, result and end come back
29
+ * as `relay/run.update`.
30
+ */
31
+ const portRelayRunMethod = defineMethod({
32
+ method: "port/relay.run",
33
+ direction: "instance-to-host",
34
+ mutating: false,
35
+ params,
36
+ result
37
+ });
38
+ //#endregion
39
+ export { RelayViewer, portRelayRunMethod };
40
+
41
+ //# sourceMappingURL=relay-run.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"relay-run.js","names":[],"sources":["../../../src/methods/port/relay-run.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\";\n\n/** Who pressed a relayed action, as its server code's `viewer()` reads it. */\nexport interface RelayViewer {\n /** The hosted home's viewer ID. */\n readonly id: string;\n /** The display name, when one is known. */\n readonly name?: string;\n}\n\n/** The Zod schema of the `RelayViewer` type. */\nexport const RelayViewer: z.ZodType<RelayViewer> = z\n .object({ id: z.string().min(1), name: z.string().exactOptional() })\n .register(wireRegistry, {\n id: \"RelayViewer\",\n description: \"The viewer a relayed run or call acts for: the hosted home's viewer ID and name.\",\n });\n\n/** The params of `port/relay.run` (INTERFACES §18.3). */\nexport interface PortRelayRunParams {\n /** The hosted home's run ID: the owner records the run under it, so a repeat joins it. */\n readonly runId: string;\n /** The run's relay sequence, unique per owner link and growing (the owner's `relayMark`). */\n readonly seq: number;\n /** The artifact, by its own ID. */\n readonly artifactId: string;\n /** The version whose server code runs it: the view's. */\n readonly versionId: string;\n /** The server function: `<module path>#<export>`. */\n readonly fnId: string;\n /** Its serialized arguments. */\n readonly args: Batches;\n /** The run's idempotency key, which the hosted home checked (D130). */\n readonly key?: string;\n /** Who pressed it. */\n readonly viewer?: RelayViewer;\n /** The hosted view that started it. */\n readonly viewId?: string;\n}\n\n/** The result of `port/relay.run`: the owner recorded the run, so it happens at most once. */\nexport interface PortRelayRunResult {\n /** Always `true`: a run the owner can't record is an error. */\n readonly accepted: true;\n}\n\nconst params: z.ZodType<PortRelayRunParams> = z\n .object({\n runId: z.string().min(1),\n seq: z.int().min(1),\n artifactId: z.string().min(1),\n versionId: z.string().min(1),\n fnId: z.string().min(1),\n args: Batches,\n key: z.string().exactOptional(),\n viewer: RelayViewer.exactOptional(),\n viewId: z.string().exactOptional(),\n })\n .register(wireRegistry, { id: \"PortRelayRunParams\" });\n\nconst result: z.ZodType<PortRelayRunResult> = z\n .object({ accepted: z.literal(true) })\n .register(wireRegistry, { id: \"PortRelayRunResult\" });\n\n/**\n * `port/relay.run`: a hosted home hands its owner instance a run to execute (D165 item 4), answered\n * once the owner recorded it under the hosted run's ID; its progress, log, result and end come back\n * as `relay/run.update`.\n */\nexport const portRelayRunMethod: MethodDefinition<PortRelayRunParams, PortRelayRunResult> =\n defineMethod({\n method: \"port/relay.run\",\n direction: \"instance-to-host\",\n mutating: false,\n params,\n result,\n });\n"],"mappings":";;;;;;AAcA,MAAa,cAAsC,EAChD,OAAO;CAAE,IAAI,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC;CAAG,MAAM,EAAE,OAAO,CAAC,CAAC,cAAc;AAAE,CAAC,CAAC,CACnE,SAAS,cAAc;CACtB,IAAI;CACJ,aAAa;AACf,CAAC;AA8BH,MAAM,SAAwC,EAC3C,OAAO;CACN,OAAO,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC;CACvB,KAAK,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC;CAClB,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,KAAK,EAAE,OAAO,CAAC,CAAC,cAAc;CAC9B,QAAQ,YAAY,cAAc;CAClC,QAAQ,EAAE,OAAO,CAAC,CAAC,cAAc;AACnC,CAAC,CAAC,CACD,SAAS,cAAc,EAAE,IAAI,qBAAqB,CAAC;AAEtD,MAAM,SAAwC,EAC3C,OAAO,EAAE,UAAU,EAAE,QAAQ,IAAI,EAAE,CAAC,CAAC,CACrC,SAAS,cAAc,EAAE,IAAI,qBAAqB,CAAC;;;;;;AAOtD,MAAa,qBACX,aAAa;CACX,QAAQ;CACR,WAAW;CACX,UAAU;CACV;CACA;AACF,CAAC"}
@@ -1,3 +1,4 @@
1
+ import { Cursor } from "../../ids.js";
1
2
  import { Results } from "../../interaction.js";
2
3
  import { MethodDefinition } from "../../method.js";
3
4
  import * as z from "zod";
@@ -16,6 +17,13 @@ export interface SubmissionEnvelope {
16
17
  readonly attempt: number;
17
18
  /** The complete submission (INTERFACES §8), built from the immutable submission alone. */
18
19
  readonly results: Results;
20
+ /**
21
+ * The submission's stored snapshot, its canonical text, whose SHA-256 is `results.submission.digest`.
22
+ * A hosted home sends it to its owner instance, which keeps the same submission (D165 item 1).
23
+ */
24
+ readonly snapshot?: string;
25
+ /** With `snapshot`: the cursor of the submission's `submission.created` in the hosted home. */
26
+ readonly cursor?: Cursor;
19
27
  }
20
28
  /** What a host answers a delivery. */
21
29
  export type SubmissionsDeliverResult = {
@@ -1 +1 @@
1
- {"version":3,"file":"submissions-deliver.d.ts","names":[],"sources":["../../../src/methods/port/submissions-deliver.ts"],"mappings":";;;;;iBAOiB;;WAEN;;WAEA;;WAEA;;WAEA;;WAEA;;WAEA,SAAS;;;YAIR;WACG;;WAEA;;WAEA;;WAEA;;;qBAIF,oBAAoB,EAAE,QAAQ;;;;;qBA0B9B,8BAA8B,iBACzC,oBACA"}
1
+ {"version":3,"file":"submissions-deliver.d.ts","names":[],"sources":["../../../src/methods/port/submissions-deliver.ts"],"mappings":";;;;;;iBAOiB;;WAEN;;WAEA;;WAEA;;WAEA;;WAEA;;WAEA,SAAS;;;;;WAKT;;WAEA,SAAS;;;YAIR;WACG;;WAEA;;WAEA;;WAEA;;;qBAIF,oBAAoB,EAAE,QAAQ;;;;;qBA+B9B,8BAA8B,iBACzC,oBACA"}
@@ -1,5 +1,5 @@
1
1
  import { wireRegistry } from "../../wire-registry.js";
2
- import { ArtifactId, DeliveryId, SubmissionId } from "../../ids.js";
2
+ import { ArtifactId, Cursor, DeliveryId, SubmissionId } from "../../ids.js";
3
3
  import { Results } from "../../interaction.js";
4
4
  import { defineMethod } from "../../method.js";
5
5
  import * as z from "zod";
@@ -11,7 +11,9 @@ const SubmissionEnvelope = z.object({
11
11
  submissionId: SubmissionId.schema,
12
12
  artifactId: ArtifactId.schema,
13
13
  attempt: z.int().min(1),
14
- results: Results
14
+ results: Results,
15
+ snapshot: z.string().max(41943040).exactOptional(),
16
+ cursor: Cursor.schema.exactOptional()
15
17
  }).register(wireRegistry, {
16
18
  id: "SubmissionEnvelope",
17
19
  description: "One submission delivered to a host: delivery ID, attempt and the complete results."
@@ -1 +1 @@
1
- {"version":3,"file":"submissions-deliver.js","names":[],"sources":["../../../src/methods/port/submissions-deliver.ts"],"sourcesContent":["import * as z from \"zod\";\nimport { ArtifactId, DeliveryId, SubmissionId } from \"../../ids.ts\";\nimport { Results } from \"../../interaction.ts\";\nimport { defineMethod, type MethodDefinition } from \"../../method.ts\";\nimport { wireRegistry } from \"../../wire-registry.ts\";\n\n/** One submission delivered to a host (INTERFACES §7, D105). */\nexport interface SubmissionEnvelope {\n /** Always `submission`: a draft never arrives through this port (IN-06). */\n readonly kind: \"submission\";\n /** Stable across redeliveries: treat a repeated ID as the same delivery (H-03). */\n readonly deliveryId: string;\n /** The submission. */\n readonly submissionId: string;\n /** Its artifact. */\n readonly artifactId: string;\n /** 1 for the first attempt; more after retries and restarts. */\n readonly attempt: number;\n /** The complete submission (INTERFACES §8), built from the immutable submission alone. */\n readonly results: Results;\n}\n\n/** What a host answers a delivery. */\nexport type SubmissionsDeliverResult =\n | { readonly accepted: true }\n | {\n readonly accepted: false;\n /** `duplicate` (already held), `undeliverable` (terminal, shown to the viewer), or the host's own. */\n readonly reason: string;\n /** `true` keeps the delivery pending and retries it with backoff. */\n readonly retry: boolean;\n };\n\n/** The Zod schema of the `SubmissionEnvelope` type. */\nexport const SubmissionEnvelope: z.ZodType<SubmissionEnvelope> = z\n .object({\n kind: z.literal(\"submission\"),\n deliveryId: DeliveryId.schema,\n submissionId: SubmissionId.schema,\n artifactId: ArtifactId.schema,\n attempt: z.int().min(1),\n results: Results,\n })\n .register(wireRegistry, {\n id: \"SubmissionEnvelope\",\n description:\n \"One submission delivered to a host: delivery ID, attempt and the complete results.\",\n });\n\nconst result: z.ZodType<SubmissionsDeliverResult> = z\n .union([\n z.object({ accepted: z.literal(true) }),\n z.object({ accepted: z.literal(false), reason: z.string().min(1), retry: z.boolean() }),\n ])\n .register(wireRegistry, { id: \"PortSubmissionsDeliverResult\" });\n\n/**\n * `port/submissions.deliver`: Mostra delivers one submission to the host that registered the\n * submissions port, after the submission is durable (IN-12), one at a time in submission order.\n */\nexport const portSubmissionsDeliverMethod: MethodDefinition<\n SubmissionEnvelope,\n SubmissionsDeliverResult\n> = defineMethod({\n method: \"port/submissions.deliver\",\n direction: \"instance-to-host\",\n mutating: false,\n params: SubmissionEnvelope,\n result,\n});\n"],"mappings":";;;;;;;AAkCA,MAAa,qBAAoD,EAC9D,OAAO;CACN,MAAM,EAAE,QAAQ,YAAY;CAC5B,YAAY,WAAW;CACvB,cAAc,aAAa;CAC3B,YAAY,WAAW;CACvB,SAAS,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC;CACtB,SAAS;AACX,CAAC,CAAC,CACD,SAAS,cAAc;CACtB,IAAI;CACJ,aACE;AACJ,CAAC;AAEH,MAAM,SAA8C,EACjD,MAAM,CACL,EAAE,OAAO,EAAE,UAAU,EAAE,QAAQ,IAAI,EAAE,CAAC,GACtC,EAAE,OAAO;CAAE,UAAU,EAAE,QAAQ,KAAK;CAAG,QAAQ,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC;CAAG,OAAO,EAAE,QAAQ;AAAE,CAAC,CACxF,CAAC,CAAC,CACD,SAAS,cAAc,EAAE,IAAI,+BAA+B,CAAC;;;;;AAMhE,MAAa,+BAGT,aAAa;CACf,QAAQ;CACR,WAAW;CACX,UAAU;CACV,QAAQ;CACR;AACF,CAAC"}
1
+ {"version":3,"file":"submissions-deliver.js","names":[],"sources":["../../../src/methods/port/submissions-deliver.ts"],"sourcesContent":["import * as z from \"zod\";\nimport { ArtifactId, Cursor, DeliveryId, SubmissionId } from \"../../ids.ts\";\nimport { Results } from \"../../interaction.ts\";\nimport { defineMethod, type MethodDefinition } from \"../../method.ts\";\nimport { wireRegistry } from \"../../wire-registry.ts\";\n\n/** One submission delivered to a host (INTERFACES §7, D105). */\nexport interface SubmissionEnvelope {\n /** Always `submission`: a draft never arrives through this port (IN-06). */\n readonly kind: \"submission\";\n /** Stable across redeliveries: treat a repeated ID as the same delivery (H-03). */\n readonly deliveryId: string;\n /** The submission. */\n readonly submissionId: string;\n /** Its artifact. */\n readonly artifactId: string;\n /** 1 for the first attempt; more after retries and restarts. */\n readonly attempt: number;\n /** The complete submission (INTERFACES §8), built from the immutable submission alone. */\n readonly results: Results;\n /**\n * The submission's stored snapshot, its canonical text, whose SHA-256 is `results.submission.digest`.\n * A hosted home sends it to its owner instance, which keeps the same submission (D165 item 1).\n */\n readonly snapshot?: string;\n /** With `snapshot`: the cursor of the submission's `submission.created` in the hosted home. */\n readonly cursor?: Cursor;\n}\n\n/** What a host answers a delivery. */\nexport type SubmissionsDeliverResult =\n | { readonly accepted: true }\n | {\n readonly accepted: false;\n /** `duplicate` (already held), `undeliverable` (terminal, shown to the viewer), or the host's own. */\n readonly reason: string;\n /** `true` keeps the delivery pending and retries it with backoff. */\n readonly retry: boolean;\n };\n\n/** The Zod schema of the `SubmissionEnvelope` type. */\nexport const SubmissionEnvelope: z.ZodType<SubmissionEnvelope> = z\n .object({\n kind: z.literal(\"submission\"),\n deliveryId: DeliveryId.schema,\n submissionId: SubmissionId.schema,\n artifactId: ArtifactId.schema,\n attempt: z.int().min(1),\n results: Results,\n snapshot: z\n .string()\n .max(40 * 1024 * 1024)\n .exactOptional(),\n cursor: Cursor.schema.exactOptional(),\n })\n .register(wireRegistry, {\n id: \"SubmissionEnvelope\",\n description:\n \"One submission delivered to a host: delivery ID, attempt and the complete results.\",\n });\n\nconst result: z.ZodType<SubmissionsDeliverResult> = z\n .union([\n z.object({ accepted: z.literal(true) }),\n z.object({ accepted: z.literal(false), reason: z.string().min(1), retry: z.boolean() }),\n ])\n .register(wireRegistry, { id: \"PortSubmissionsDeliverResult\" });\n\n/**\n * `port/submissions.deliver`: Mostra delivers one submission to the host that registered the\n * submissions port, after the submission is durable (IN-12), one at a time in submission order.\n */\nexport const portSubmissionsDeliverMethod: MethodDefinition<\n SubmissionEnvelope,\n SubmissionsDeliverResult\n> = defineMethod({\n method: \"port/submissions.deliver\",\n direction: \"instance-to-host\",\n mutating: false,\n params: SubmissionEnvelope,\n result,\n});\n"],"mappings":";;;;;;;AAyCA,MAAa,qBAAoD,EAC9D,OAAO;CACN,MAAM,EAAE,QAAQ,YAAY;CAC5B,YAAY,WAAW;CACvB,cAAc,aAAa;CAC3B,YAAY,WAAW;CACvB,SAAS,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC;CACtB,SAAS;CACT,UAAU,EACP,OAAO,CAAC,CACR,IAAI,QAAgB,CAAC,CACrB,cAAc;CACjB,QAAQ,OAAO,OAAO,cAAc;AACtC,CAAC,CAAC,CACD,SAAS,cAAc;CACtB,IAAI;CACJ,aACE;AACJ,CAAC;AAEH,MAAM,SAA8C,EACjD,MAAM,CACL,EAAE,OAAO,EAAE,UAAU,EAAE,QAAQ,IAAI,EAAE,CAAC,GACtC,EAAE,OAAO;CAAE,UAAU,EAAE,QAAQ,KAAK;CAAG,QAAQ,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC;CAAG,OAAO,EAAE,QAAQ;AAAE,CAAC,CACxF,CAAC,CAAC,CACD,SAAS,cAAc,EAAE,IAAI,+BAA+B,CAAC;;;;;AAMhE,MAAa,+BAGT,aAAa;CACf,QAAQ;CACR,WAAW;CACX,UAAU;CACV,QAAQ;CACR;AACF,CAAC"}
@@ -0,0 +1,26 @@
1
+ import { Batches } from "../../actions.js";
2
+ import { MethodDefinition } from "../../method.js";
3
+ //#region src/methods/relay/call-batch.d.ts
4
+ /** The params of `relay/call.batch` (INTERFACES §18.3). */
5
+ export interface RelayCallBatchParams {
6
+ /** The hosted home's call. */
7
+ readonly callId: string;
8
+ /** Grows by one per message of the call. */
9
+ readonly seq: number;
10
+ /** Serialized batches of the result, in order. */
11
+ readonly batches?: Batches;
12
+ /** The call's end: the last message. */
13
+ readonly end?: {
14
+ readonly status: "succeeded" | "failed";
15
+ readonly error?: {
16
+ readonly message: string;
17
+ readonly code?: string;
18
+ };
19
+ };
20
+ }
21
+ /** The result of `relay/call.batch`. */
22
+ export type RelayCallBatchResult = Record<string, never>;
23
+ /** `relay/call.batch`: the owner streams a relayed plain call's result back, then its end. */
24
+ export declare const relayCallBatchMethod: MethodDefinition<RelayCallBatchParams, RelayCallBatchResult>;
25
+ //#endregion
26
+ //# sourceMappingURL=call-batch.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"call-batch.d.ts","names":[],"sources":["../../../src/methods/relay/call-batch.ts"],"mappings":";;;;iBAMiB;;WAEN;;WAEA;;WAEA,UAAU;;WAEV;aACE;aACA;eAAmB;eAA0B;;;;;YAK9C,uBAAuB;;qBAuBtB,sBAAsB,iBAAiB,sBAAsB"}
@@ -0,0 +1,30 @@
1
+ import { wireRegistry } from "../../wire-registry.js";
2
+ import { Batches } from "../../actions.js";
3
+ import { defineMethod } from "../../method.js";
4
+ import * as z from "zod";
5
+ //#region src/methods/relay/call-batch.ts
6
+ const params = z.object({
7
+ callId: z.string().min(1),
8
+ seq: z.int().min(1),
9
+ batches: Batches.exactOptional(),
10
+ end: z.object({
11
+ status: z.enum(["succeeded", "failed"]),
12
+ error: z.object({
13
+ message: z.string().max(1e4),
14
+ code: z.string().max(200).exactOptional()
15
+ }).exactOptional()
16
+ }).exactOptional()
17
+ }).register(wireRegistry, { id: "RelayCallBatchParams" });
18
+ const result = z.object({}).register(wireRegistry, { id: "RelayCallBatchResult" });
19
+ /** `relay/call.batch`: the owner streams a relayed plain call's result back, then its end. */
20
+ const relayCallBatchMethod = defineMethod({
21
+ method: "relay/call.batch",
22
+ direction: "client-to-instance",
23
+ mutating: false,
24
+ params,
25
+ result
26
+ });
27
+ //#endregion
28
+ export { relayCallBatchMethod };
29
+
30
+ //# sourceMappingURL=call-batch.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"call-batch.js","names":[],"sources":["../../../src/methods/relay/call-batch.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\";\n\n/** The params of `relay/call.batch` (INTERFACES §18.3). */\nexport interface RelayCallBatchParams {\n /** The hosted home's call. */\n readonly callId: string;\n /** Grows by one per message of the call. */\n readonly seq: number;\n /** Serialized batches of the result, in order. */\n readonly batches?: Batches;\n /** The call's end: the last message. */\n readonly end?: {\n readonly status: \"succeeded\" | \"failed\";\n readonly error?: { readonly message: string; readonly code?: string };\n };\n}\n\n/** The result of `relay/call.batch`. */\nexport type RelayCallBatchResult = Record<string, never>;\n\nconst params: z.ZodType<RelayCallBatchParams> = z\n .object({\n callId: z.string().min(1),\n seq: z.int().min(1),\n batches: Batches.exactOptional(),\n end: z\n .object({\n status: z.enum([\"succeeded\", \"failed\"]),\n error: z\n .object({ message: z.string().max(10_000), code: z.string().max(200).exactOptional() })\n .exactOptional(),\n })\n .exactOptional(),\n })\n .register(wireRegistry, { id: \"RelayCallBatchParams\" });\n\nconst result: z.ZodType<RelayCallBatchResult> = z\n .object({})\n .register(wireRegistry, { id: \"RelayCallBatchResult\" });\n\n/** `relay/call.batch`: the owner streams a relayed plain call's result back, then its end. */\nexport const relayCallBatchMethod: MethodDefinition<RelayCallBatchParams, RelayCallBatchResult> =\n defineMethod({\n method: \"relay/call.batch\",\n direction: \"client-to-instance\",\n mutating: false,\n params,\n result,\n });\n"],"mappings":";;;;;AAuBA,MAAM,SAA0C,EAC7C,OAAO;CACN,QAAQ,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC;CACxB,KAAK,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC;CAClB,SAAS,QAAQ,cAAc;CAC/B,KAAK,EACF,OAAO;EACN,QAAQ,EAAE,KAAK,CAAC,aAAa,QAAQ,CAAC;EACtC,OAAO,EACJ,OAAO;GAAE,SAAS,EAAE,OAAO,CAAC,CAAC,IAAI,GAAM;GAAG,MAAM,EAAE,OAAO,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,cAAc;EAAE,CAAC,CAAC,CACtF,cAAc;CACnB,CAAC,CAAC,CACD,cAAc;AACnB,CAAC,CAAC,CACD,SAAS,cAAc,EAAE,IAAI,uBAAuB,CAAC;AAExD,MAAM,SAA0C,EAC7C,OAAO,CAAC,CAAC,CAAC,CACV,SAAS,cAAc,EAAE,IAAI,uBAAuB,CAAC;;AAGxD,MAAa,uBACX,aAAa;CACX,QAAQ;CACR,WAAW;CACX,UAAU;CACV;CACA;AACF,CAAC"}
@@ -0,0 +1,31 @@
1
+ import { Cursor } from "../../ids.js";
2
+ import { MethodDefinition } from "../../method.js";
3
+ //#region src/methods/relay/effect.d.ts
4
+ /** The params of `relay/effect` (INTERFACES §18.3). */
5
+ export interface RelayEffectParams {
6
+ /** The artifact, by its own ID. */
7
+ readonly artifactId: string;
8
+ /** The relayed run whose server code raised it. */
9
+ readonly runId?: string;
10
+ /** Or the relayed plain call. */
11
+ readonly callId?: string;
12
+ /** `signal()` or `emit()` (§2.4). */
13
+ readonly kind: "signal" | "emit";
14
+ /** The signal's name, or the host event's type (`host.…`). */
15
+ readonly name: string;
16
+ /** Its JSON payload, at most 64 KiB. */
17
+ readonly payload?: unknown;
18
+ }
19
+ /** The result of `relay/effect`: the event's cursor in the hosted home. */
20
+ export interface RelayEffectResult {
21
+ /** Where the hosted home appended it. */
22
+ readonly cursor: Cursor;
23
+ }
24
+ /**
25
+ * `relay/effect`: a relayed run's or call's server code raised a signal or emitted a host event;
26
+ * the hosted home appends it with the run's causation and the viewer who pressed it (D165 item 4),
27
+ * where the page and the owner's follow see it.
28
+ */
29
+ export declare const relayEffectMethod: MethodDefinition<RelayEffectParams, RelayEffectResult>;
30
+ //#endregion
31
+ //# sourceMappingURL=effect.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"effect.d.ts","names":[],"sources":["../../../src/methods/relay/effect.ts"],"mappings":";;;;iBAMiB;;WAEN;;WAEA;;WAEA;;WAEA;;WAEA;;WAEA;;;iBAIM;;WAEN,QAAQ;;;;;;;qBAuBN,mBAAmB,iBAAiB,mBAAmB"}
@@ -0,0 +1,30 @@
1
+ import { wireRegistry } from "../../wire-registry.js";
2
+ import { Cursor } from "../../ids.js";
3
+ import { defineMethod } from "../../method.js";
4
+ import * as z from "zod";
5
+ //#region src/methods/relay/effect.ts
6
+ const params = z.object({
7
+ artifactId: z.string().min(1),
8
+ runId: z.string().exactOptional(),
9
+ callId: z.string().exactOptional(),
10
+ kind: z.enum(["signal", "emit"]),
11
+ name: z.string().min(1).max(200),
12
+ payload: z.unknown().exactOptional()
13
+ }).register(wireRegistry, { id: "RelayEffectParams" });
14
+ const result = z.object({ cursor: Cursor.schema }).register(wireRegistry, { id: "RelayEffectResult" });
15
+ /**
16
+ * `relay/effect`: a relayed run's or call's server code raised a signal or emitted a host event;
17
+ * the hosted home appends it with the run's causation and the viewer who pressed it (D165 item 4),
18
+ * where the page and the owner's follow see it.
19
+ */
20
+ const relayEffectMethod = defineMethod({
21
+ method: "relay/effect",
22
+ direction: "client-to-instance",
23
+ mutating: true,
24
+ params,
25
+ result
26
+ });
27
+ //#endregion
28
+ export { relayEffectMethod };
29
+
30
+ //# sourceMappingURL=effect.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"effect.js","names":[],"sources":["../../../src/methods/relay/effect.ts"],"sourcesContent":["import * as z from \"zod\";\nimport { Cursor } from \"../../ids.ts\";\nimport { defineMethod, type MethodDefinition } from \"../../method.ts\";\nimport { wireRegistry } from \"../../wire-registry.ts\";\n\n/** The params of `relay/effect` (INTERFACES §18.3). */\nexport interface RelayEffectParams {\n /** The artifact, by its own ID. */\n readonly artifactId: string;\n /** The relayed run whose server code raised it. */\n readonly runId?: string;\n /** Or the relayed plain call. */\n readonly callId?: string;\n /** `signal()` or `emit()` (§2.4). */\n readonly kind: \"signal\" | \"emit\";\n /** The signal's name, or the host event's type (`host.…`). */\n readonly name: string;\n /** Its JSON payload, at most 64 KiB. */\n readonly payload?: unknown;\n}\n\n/** The result of `relay/effect`: the event's cursor in the hosted home. */\nexport interface RelayEffectResult {\n /** Where the hosted home appended it. */\n readonly cursor: Cursor;\n}\n\nconst params: z.ZodType<RelayEffectParams> = z\n .object({\n artifactId: z.string().min(1),\n runId: z.string().exactOptional(),\n callId: z.string().exactOptional(),\n kind: z.enum([\"signal\", \"emit\"]),\n name: z.string().min(1).max(200),\n payload: z.unknown().exactOptional(),\n })\n .register(wireRegistry, { id: \"RelayEffectParams\" });\n\nconst result: z.ZodType<RelayEffectResult> = z\n .object({ cursor: Cursor.schema })\n .register(wireRegistry, { id: \"RelayEffectResult\" });\n\n/**\n * `relay/effect`: a relayed run's or call's server code raised a signal or emitted a host event;\n * the hosted home appends it with the run's causation and the viewer who pressed it (D165 item 4),\n * where the page and the owner's follow see it.\n */\nexport const relayEffectMethod: MethodDefinition<RelayEffectParams, RelayEffectResult> =\n defineMethod({\n method: \"relay/effect\",\n direction: \"client-to-instance\",\n mutating: true,\n params,\n result,\n });\n"],"mappings":";;;;;AA2BA,MAAM,SAAuC,EAC1C,OAAO;CACN,YAAY,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC;CAC5B,OAAO,EAAE,OAAO,CAAC,CAAC,cAAc;CAChC,QAAQ,EAAE,OAAO,CAAC,CAAC,cAAc;CACjC,MAAM,EAAE,KAAK,CAAC,UAAU,MAAM,CAAC;CAC/B,MAAM,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,GAAG;CAC/B,SAAS,EAAE,QAAQ,CAAC,CAAC,cAAc;AACrC,CAAC,CAAC,CACD,SAAS,cAAc,EAAE,IAAI,oBAAoB,CAAC;AAErD,MAAM,SAAuC,EAC1C,OAAO,EAAE,QAAQ,OAAO,OAAO,CAAC,CAAC,CACjC,SAAS,cAAc,EAAE,IAAI,oBAAoB,CAAC;;;;;;AAOrD,MAAa,oBACX,aAAa;CACX,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
+ //#region src/methods/relay/live-value.d.ts
4
+ /** The params of `relay/live.value` (INTERFACES §18.3). */
5
+ export interface RelayLiveValueParams {
6
+ /** The artifact, by its own ID. */
7
+ readonly artifactId: string;
8
+ /** The version whose producer made it. */
9
+ readonly versionId: string;
10
+ /** The live source's key. */
11
+ readonly key: string;
12
+ /** The value, serialized. */
13
+ readonly value?: Batches;
14
+ /** What went wrong instead. */
15
+ readonly error?: {
16
+ readonly message: string;
17
+ readonly code?: string;
18
+ };
19
+ /** When the owner's producer made it. */
20
+ readonly at: string;
21
+ }
22
+ /** The result of `relay/live.value`. */
23
+ export interface RelayLiveValueResult {
24
+ /** The value's revision on the hosted home; absent for an error. */
25
+ readonly revision?: string;
26
+ }
27
+ /**
28
+ * `relay/live.value`: a value (or failure) of a hosted artifact's live source, which a producer on
29
+ * the owner instance made; the hosted home keeps it and its ring and serves it to viewers.
30
+ */
31
+ export declare const relayLiveValueMethod: MethodDefinition<RelayLiveValueParams, RelayLiveValueResult>;
32
+ //#endregion
33
+ //# sourceMappingURL=live-value.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"live-value.d.ts","names":[],"sources":["../../../src/methods/relay/live-value.ts"],"mappings":";;;;iBAMiB;;WAEN;;WAEA;;WAEA;;WAEA,QAAQ;;WAER;aAAmB;aAA0B;;;WAE7C;;;iBAIM;;WAEN;;;;;;qBAsBE,sBAAsB,iBAAiB,sBAAsB"}
@@ -0,0 +1,32 @@
1
+ import { wireRegistry } from "../../wire-registry.js";
2
+ import { Batches, LIVE_KEY_PATTERN } from "../../actions.js";
3
+ import { defineMethod } from "../../method.js";
4
+ import * as z from "zod";
5
+ //#region src/methods/relay/live-value.ts
6
+ const params = z.object({
7
+ artifactId: z.string().min(1),
8
+ versionId: z.string().min(1),
9
+ key: z.string().regex(LIVE_KEY_PATTERN),
10
+ value: Batches.exactOptional(),
11
+ error: z.object({
12
+ message: z.string(),
13
+ code: z.string().exactOptional()
14
+ }).exactOptional(),
15
+ at: z.string()
16
+ }).register(wireRegistry, { id: "RelayLiveValueParams" });
17
+ const result = z.object({ revision: z.string().exactOptional() }).register(wireRegistry, { id: "RelayLiveValueResult" });
18
+ /**
19
+ * `relay/live.value`: a value (or failure) of a hosted artifact's live source, which a producer on
20
+ * the owner instance made; the hosted home keeps it and its ring and serves it to viewers.
21
+ */
22
+ const relayLiveValueMethod = defineMethod({
23
+ method: "relay/live.value",
24
+ direction: "client-to-instance",
25
+ mutating: true,
26
+ params,
27
+ result
28
+ });
29
+ //#endregion
30
+ export { relayLiveValueMethod };
31
+
32
+ //# sourceMappingURL=live-value.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"live-value.js","names":[],"sources":["../../../src/methods/relay/live-value.ts"],"sourcesContent":["import * as z from \"zod\";\nimport { Batches, LIVE_KEY_PATTERN } from \"../../actions.ts\";\nimport { defineMethod, type MethodDefinition } from \"../../method.ts\";\nimport { wireRegistry } from \"../../wire-registry.ts\";\n\n/** The params of `relay/live.value` (INTERFACES §18.3). */\nexport interface RelayLiveValueParams {\n /** The artifact, by its own ID. */\n readonly artifactId: string;\n /** The version whose producer made it. */\n readonly versionId: string;\n /** The live source's key. */\n readonly key: string;\n /** The value, serialized. */\n readonly value?: Batches;\n /** What went wrong instead. */\n readonly error?: { readonly message: string; readonly code?: string };\n /** When the owner's producer made it. */\n readonly at: string;\n}\n\n/** The result of `relay/live.value`. */\nexport interface RelayLiveValueResult {\n /** The value's revision on the hosted home; absent for an error. */\n readonly revision?: string;\n}\n\nconst params: z.ZodType<RelayLiveValueParams> = z\n .object({\n artifactId: z.string().min(1),\n versionId: z.string().min(1),\n key: z.string().regex(LIVE_KEY_PATTERN),\n value: Batches.exactOptional(),\n error: z.object({ message: z.string(), code: z.string().exactOptional() }).exactOptional(),\n at: z.string(),\n })\n .register(wireRegistry, { id: \"RelayLiveValueParams\" });\n\nconst result: z.ZodType<RelayLiveValueResult> = z\n .object({ revision: z.string().exactOptional() })\n .register(wireRegistry, { id: \"RelayLiveValueResult\" });\n\n/**\n * `relay/live.value`: a value (or failure) of a hosted artifact's live source, which a producer on\n * the owner instance made; the hosted home keeps it and its ring and serves it to viewers.\n */\nexport const relayLiveValueMethod: MethodDefinition<RelayLiveValueParams, RelayLiveValueResult> =\n defineMethod({\n method: \"relay/live.value\",\n direction: \"client-to-instance\",\n mutating: true,\n params,\n result,\n });\n"],"mappings":";;;;;AA2BA,MAAM,SAA0C,EAC7C,OAAO;CACN,YAAY,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC;CAC5B,WAAW,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC;CAC3B,KAAK,EAAE,OAAO,CAAC,CAAC,MAAM,gBAAgB;CACtC,OAAO,QAAQ,cAAc;CAC7B,OAAO,EAAE,OAAO;EAAE,SAAS,EAAE,OAAO;EAAG,MAAM,EAAE,OAAO,CAAC,CAAC,cAAc;CAAE,CAAC,CAAC,CAAC,cAAc;CACzF,IAAI,EAAE,OAAO;AACf,CAAC,CAAC,CACD,SAAS,cAAc,EAAE,IAAI,uBAAuB,CAAC;AAExD,MAAM,SAA0C,EAC7C,OAAO,EAAE,UAAU,EAAE,OAAO,CAAC,CAAC,cAAc,EAAE,CAAC,CAAC,CAChD,SAAS,cAAc,EAAE,IAAI,uBAAuB,CAAC;;;;;AAMxD,MAAa,uBACX,aAAa;CACX,QAAQ;CACR,WAAW;CACX,UAAU;CACV;CACA;AACF,CAAC"}
@@ -0,0 +1,46 @@
1
+ import { Batches, RunProgress } from "../../actions.js";
2
+ import { MethodDefinition } from "../../method.js";
3
+ //#region src/methods/relay/run-update.d.ts
4
+ /** How a relayed run ended, as the owner ran it. */
5
+ export interface RelayRunEnd {
6
+ /** The run's final state. */
7
+ readonly status: "succeeded" | "failed" | "cancelled";
8
+ /** Why, as a local run's `reason`. */
9
+ readonly reason?: string;
10
+ /** What went wrong, without the stack. */
11
+ readonly error?: {
12
+ readonly message: string;
13
+ readonly code?: string;
14
+ };
15
+ }
16
+ /** The params of `relay/run.update` (INTERFACES §18.3). */
17
+ export interface RelayRunUpdateParams {
18
+ /** The hosted run. */
19
+ readonly runId: string;
20
+ /** Grows by one per update of the run; a repeat is ignored. */
21
+ readonly seq: number;
22
+ /** Its worker has it now. */
23
+ readonly running?: boolean;
24
+ /** Its latest progress. */
25
+ readonly progress?: RunProgress;
26
+ /** New log lines, from `logFrom`. */
27
+ readonly log?: readonly string[];
28
+ /** The index of `log`'s first line (additive: positions make a repeat harmless). */
29
+ readonly logFrom?: number;
30
+ /** New result batches, from `batchFrom`. */
31
+ readonly batches?: Batches;
32
+ /** The index of `batches`' first batch. */
33
+ readonly batchFrom?: number;
34
+ /** The run's end: the last update. */
35
+ readonly end?: RelayRunEnd;
36
+ }
37
+ /** The result of `relay/run.update`. */
38
+ export type RelayRunUpdateResult = Record<string, never>;
39
+ /**
40
+ * `relay/run.update`: the owner instance reports a relayed run's progress, log, result and end to
41
+ * its hosted home, in order and idempotently; an update for a run the hosted home doesn't know is
42
+ * dropped and logged (D165 item 4).
43
+ */
44
+ export declare const relayRunUpdateMethod: MethodDefinition<RelayRunUpdateParams, RelayRunUpdateResult>;
45
+ //#endregion
46
+ //# sourceMappingURL=run-update.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"run-update.d.ts","names":[],"sources":["../../../src/methods/relay/run-update.ts"],"mappings":";;;;iBAMiB;;WAEN;;WAEA;;WAEA;aAAmB;aAA0B;;;;iBAIvC;;WAEN;;WAEA;;WAEA;;WAEA,WAAW;;WAEX;;WAEA;;WAEA,UAAU;;WAEV;;WAEA,MAAM;;;YAIL,uBAAuB;;;;;;qBAmCtB,sBAAsB,iBAAiB,sBAAsB"}
@@ -0,0 +1,45 @@
1
+ import { wireRegistry } from "../../wire-registry.js";
2
+ import { Batches, RunProgress } from "../../actions.js";
3
+ import { defineMethod } from "../../method.js";
4
+ import * as z from "zod";
5
+ //#region src/methods/relay/run-update.ts
6
+ const end = z.object({
7
+ status: z.enum([
8
+ "succeeded",
9
+ "failed",
10
+ "cancelled"
11
+ ]),
12
+ reason: z.string().max(200).exactOptional(),
13
+ error: z.object({
14
+ message: z.string().max(1e4),
15
+ code: z.string().max(200).exactOptional()
16
+ }).exactOptional()
17
+ }).register(wireRegistry, { id: "RelayRunEnd" });
18
+ const params = z.object({
19
+ runId: z.string().min(1),
20
+ seq: z.int().min(1),
21
+ running: z.boolean().exactOptional(),
22
+ progress: RunProgress.exactOptional(),
23
+ log: z.array(z.string()).readonly().exactOptional(),
24
+ logFrom: z.int().min(0).exactOptional(),
25
+ batches: Batches.exactOptional(),
26
+ batchFrom: z.int().min(0).exactOptional(),
27
+ end: end.exactOptional()
28
+ }).register(wireRegistry, { id: "RelayRunUpdateParams" });
29
+ const result = z.object({}).register(wireRegistry, { id: "RelayRunUpdateResult" });
30
+ /**
31
+ * `relay/run.update`: the owner instance reports a relayed run's progress, log, result and end to
32
+ * its hosted home, in order and idempotently; an update for a run the hosted home doesn't know is
33
+ * dropped and logged (D165 item 4).
34
+ */
35
+ const relayRunUpdateMethod = defineMethod({
36
+ method: "relay/run.update",
37
+ direction: "client-to-instance",
38
+ mutating: true,
39
+ params,
40
+ result
41
+ });
42
+ //#endregion
43
+ export { relayRunUpdateMethod };
44
+
45
+ //# sourceMappingURL=run-update.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"run-update.js","names":[],"sources":["../../../src/methods/relay/run-update.ts"],"sourcesContent":["import * as z from \"zod\";\nimport { Batches, RunProgress } from \"../../actions.ts\";\nimport { defineMethod, type MethodDefinition } from \"../../method.ts\";\nimport { wireRegistry } from \"../../wire-registry.ts\";\n\n/** How a relayed run ended, as the owner ran it. */\nexport interface RelayRunEnd {\n /** The run's final state. */\n readonly status: \"succeeded\" | \"failed\" | \"cancelled\";\n /** Why, as a local run's `reason`. */\n readonly reason?: string;\n /** What went wrong, without the stack. */\n readonly error?: { readonly message: string; readonly code?: string };\n}\n\n/** The params of `relay/run.update` (INTERFACES §18.3). */\nexport interface RelayRunUpdateParams {\n /** The hosted run. */\n readonly runId: string;\n /** Grows by one per update of the run; a repeat is ignored. */\n readonly seq: number;\n /** Its worker has it now. */\n readonly running?: boolean;\n /** Its latest progress. */\n readonly progress?: RunProgress;\n /** New log lines, from `logFrom`. */\n readonly log?: readonly string[];\n /** The index of `log`'s first line (additive: positions make a repeat harmless). */\n readonly logFrom?: number;\n /** New result batches, from `batchFrom`. */\n readonly batches?: Batches;\n /** The index of `batches`' first batch. */\n readonly batchFrom?: number;\n /** The run's end: the last update. */\n readonly end?: RelayRunEnd;\n}\n\n/** The result of `relay/run.update`. */\nexport type RelayRunUpdateResult = Record<string, never>;\n\nconst end: z.ZodType<RelayRunEnd> = z\n .object({\n status: z.enum([\"succeeded\", \"failed\", \"cancelled\"]),\n reason: z.string().max(200).exactOptional(),\n error: z\n .object({ message: z.string().max(10_000), code: z.string().max(200).exactOptional() })\n .exactOptional(),\n })\n .register(wireRegistry, { id: \"RelayRunEnd\" });\n\nconst params: z.ZodType<RelayRunUpdateParams> = z\n .object({\n runId: z.string().min(1),\n seq: z.int().min(1),\n running: z.boolean().exactOptional(),\n progress: RunProgress.exactOptional(),\n log: z.array(z.string()).readonly().exactOptional(),\n logFrom: z.int().min(0).exactOptional(),\n batches: Batches.exactOptional(),\n batchFrom: z.int().min(0).exactOptional(),\n end: end.exactOptional(),\n })\n .register(wireRegistry, { id: \"RelayRunUpdateParams\" });\n\nconst result: z.ZodType<RelayRunUpdateResult> = z\n .object({})\n .register(wireRegistry, { id: \"RelayRunUpdateResult\" });\n\n/**\n * `relay/run.update`: the owner instance reports a relayed run's progress, log, result and end to\n * its hosted home, in order and idempotently; an update for a run the hosted home doesn't know is\n * dropped and logged (D165 item 4).\n */\nexport const relayRunUpdateMethod: MethodDefinition<RelayRunUpdateParams, RelayRunUpdateResult> =\n defineMethod({\n method: \"relay/run.update\",\n direction: \"client-to-instance\",\n mutating: true,\n params,\n result,\n });\n"],"mappings":";;;;;AAwCA,MAAM,MAA8B,EACjC,OAAO;CACN,QAAQ,EAAE,KAAK;EAAC;EAAa;EAAU;CAAW,CAAC;CACnD,QAAQ,EAAE,OAAO,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,cAAc;CAC1C,OAAO,EACJ,OAAO;EAAE,SAAS,EAAE,OAAO,CAAC,CAAC,IAAI,GAAM;EAAG,MAAM,EAAE,OAAO,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,cAAc;CAAE,CAAC,CAAC,CACtF,cAAc;AACnB,CAAC,CAAC,CACD,SAAS,cAAc,EAAE,IAAI,cAAc,CAAC;AAE/C,MAAM,SAA0C,EAC7C,OAAO;CACN,OAAO,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC;CACvB,KAAK,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC;CAClB,SAAS,EAAE,QAAQ,CAAC,CAAC,cAAc;CACnC,UAAU,YAAY,cAAc;CACpC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,cAAc;CAClD,SAAS,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,cAAc;CACtC,SAAS,QAAQ,cAAc;CAC/B,WAAW,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,cAAc;CACxC,KAAK,IAAI,cAAc;AACzB,CAAC,CAAC,CACD,SAAS,cAAc,EAAE,IAAI,uBAAuB,CAAC;AAExD,MAAM,SAA0C,EAC7C,OAAO,CAAC,CAAC,CAAC,CACV,SAAS,cAAc,EAAE,IAAI,uBAAuB,CAAC;;;;;;AAOxD,MAAa,uBACX,aAAa;CACX,QAAQ;CACR,WAAW;CACX,UAAU;CACV;CACA;AACF,CAAC"}
@@ -0,0 +1,30 @@
1
+ import { MethodDefinition } from "../../method.js";
2
+ import { ServerOrigin } from "../../remote.js";
3
+ //#region src/methods/remote/login-wait.d.ts
4
+ /** The params of `remote/login.wait` (INTERFACES §18.2). */
5
+ export interface RemoteLoginWaitParams {
6
+ /** The sign-in `remote/login` started. */
7
+ readonly loginId: string;
8
+ /** How long to wait, 0 to check once. */
9
+ readonly timeoutMs: number;
10
+ }
11
+ /** The result of `remote/login.wait`: signed in, or still waiting for the person. */
12
+ export type RemoteLoginWaitResult = {
13
+ readonly status: "signed-in";
14
+ readonly server: ServerOrigin;
15
+ readonly account: {
16
+ readonly id: string;
17
+ readonly name?: string;
18
+ };
19
+ /** This home's instance link there (`lnk_…`). */
20
+ readonly instanceId: string;
21
+ } | {
22
+ readonly status: "pending";
23
+ };
24
+ /**
25
+ * `remote/login.wait`: waits for a sign-in `remote/login` started; a refused or expired code is
26
+ * `MOSTRA_REMOTE_LOGIN_FAILED`.
27
+ */
28
+ export declare const remoteLoginWaitMethod: MethodDefinition<RemoteLoginWaitParams, RemoteLoginWaitResult>;
29
+ //#endregion
30
+ //# sourceMappingURL=login-wait.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"login-wait.d.ts","names":[],"sources":["../../../src/methods/remote/login-wait.ts"],"mappings":";;;;iBAMiB;;WAEN;;WAEA;;;YAIC;WAEG;WACA,QAAQ;WACR;aAAoB;aAAqB;;;WAEzC;;WAEA;;;;;;qBAyBF,uBAAuB,iBAAiB,uBAAuB"}
@@ -0,0 +1,36 @@
1
+ import { wireRegistry } from "../../wire-registry.js";
2
+ import { defineMethod } from "../../method.js";
3
+ import { ServerOrigin } from "../../remote.js";
4
+ import * as z from "zod";
5
+ //#region src/methods/remote/login-wait.ts
6
+ const params = z.object({
7
+ loginId: z.string().min(1),
8
+ timeoutMs: z.int().min(0).max(2147483647)
9
+ }).register(wireRegistry, { id: "RemoteLoginWaitParams" });
10
+ const result = z.discriminatedUnion("status", [z.object({
11
+ status: z.literal("signed-in"),
12
+ server: ServerOrigin,
13
+ account: z.object({
14
+ id: z.string(),
15
+ name: z.string().exactOptional()
16
+ }),
17
+ instanceId: z.string()
18
+ }), z.object({ status: z.literal("pending") })]).register(wireRegistry, {
19
+ id: "RemoteLoginWaitResult",
20
+ description: "A sign-in's end: signed in with the account and instance link, or pending."
21
+ });
22
+ /**
23
+ * `remote/login.wait`: waits for a sign-in `remote/login` started; a refused or expired code is
24
+ * `MOSTRA_REMOTE_LOGIN_FAILED`.
25
+ */
26
+ const remoteLoginWaitMethod = defineMethod({
27
+ method: "remote/login.wait",
28
+ direction: "client-to-instance",
29
+ mutating: false,
30
+ params,
31
+ result
32
+ });
33
+ //#endregion
34
+ export { remoteLoginWaitMethod };
35
+
36
+ //# sourceMappingURL=login-wait.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"login-wait.js","names":[],"sources":["../../../src/methods/remote/login-wait.ts"],"sourcesContent":["import * as z from \"zod\";\nimport { defineMethod, type MethodDefinition } from \"../../method.ts\";\nimport { ServerOrigin } from \"../../remote.ts\";\nimport { wireRegistry } from \"../../wire-registry.ts\";\n\n/** The params of `remote/login.wait` (INTERFACES §18.2). */\nexport interface RemoteLoginWaitParams {\n /** The sign-in `remote/login` started. */\n readonly loginId: string;\n /** How long to wait, 0 to check once. */\n readonly timeoutMs: number;\n}\n\n/** The result of `remote/login.wait`: signed in, or still waiting for the person. */\nexport type RemoteLoginWaitResult =\n | {\n readonly status: \"signed-in\";\n readonly server: ServerOrigin;\n readonly account: { readonly id: string; readonly name?: string };\n /** This home's instance link there (`lnk_…`). */\n readonly instanceId: string;\n }\n | { readonly status: \"pending\" };\n\nconst params: z.ZodType<RemoteLoginWaitParams> = z\n .object({ loginId: z.string().min(1), timeoutMs: z.int().min(0).max(2_147_483_647) })\n .register(wireRegistry, { id: \"RemoteLoginWaitParams\" });\n\nconst result: z.ZodType<RemoteLoginWaitResult> = z\n .discriminatedUnion(\"status\", [\n z.object({\n status: z.literal(\"signed-in\"),\n server: ServerOrigin,\n account: z.object({ id: z.string(), name: z.string().exactOptional() }),\n instanceId: z.string(),\n }),\n z.object({ status: z.literal(\"pending\") }),\n ])\n .register(wireRegistry, {\n id: \"RemoteLoginWaitResult\",\n description: \"A sign-in's end: signed in with the account and instance link, or pending.\",\n });\n\n/**\n * `remote/login.wait`: waits for a sign-in `remote/login` started; a refused or expired code is\n * `MOSTRA_REMOTE_LOGIN_FAILED`.\n */\nexport const remoteLoginWaitMethod: MethodDefinition<RemoteLoginWaitParams, RemoteLoginWaitResult> =\n defineMethod({\n method: \"remote/login.wait\",\n direction: \"client-to-instance\",\n mutating: false,\n params,\n result,\n });\n"],"mappings":";;;;;AAwBA,MAAM,SAA2C,EAC9C,OAAO;CAAE,SAAS,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC;CAAG,WAAW,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,UAAa;AAAE,CAAC,CAAC,CACpF,SAAS,cAAc,EAAE,IAAI,wBAAwB,CAAC;AAEzD,MAAM,SAA2C,EAC9C,mBAAmB,UAAU,CAC5B,EAAE,OAAO;CACP,QAAQ,EAAE,QAAQ,WAAW;CAC7B,QAAQ;CACR,SAAS,EAAE,OAAO;EAAE,IAAI,EAAE,OAAO;EAAG,MAAM,EAAE,OAAO,CAAC,CAAC,cAAc;CAAE,CAAC;CACtE,YAAY,EAAE,OAAO;AACvB,CAAC,GACD,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,SAAS,EAAE,CAAC,CAC3C,CAAC,CAAC,CACD,SAAS,cAAc;CACtB,IAAI;CACJ,aAAa;AACf,CAAC;;;;;AAMH,MAAa,wBACX,aAAa;CACX,QAAQ;CACR,WAAW;CACX,UAAU;CACV;CACA;AACF,CAAC"}