@mostra/protocol 0.9.0 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (241) hide show
  1. package/dist/actions.d.ts +30 -4
  2. package/dist/actions.d.ts.map +1 -1
  3. package/dist/actions.js +14 -4
  4. package/dist/actions.js.map +1 -1
  5. package/dist/artifact.d.ts +2 -1
  6. package/dist/artifact.d.ts.map +1 -1
  7. package/dist/artifact.js +2 -1
  8. package/dist/artifact.js.map +1 -1
  9. package/dist/browser.d.ts +47 -0
  10. package/dist/browser.d.ts.map +1 -1
  11. package/dist/browser.js +36 -3
  12. package/dist/browser.js.map +1 -1
  13. package/dist/capability.d.ts +0 -9
  14. package/dist/capability.d.ts.map +1 -1
  15. package/dist/capability.js +1 -17
  16. package/dist/capability.js.map +1 -1
  17. package/dist/diagnostics/codes/action.d.ts +1 -1
  18. package/dist/diagnostics/codes/action.d.ts.map +1 -1
  19. package/dist/diagnostics/codes/action.js +12 -1
  20. package/dist/diagnostics/codes/action.js.map +1 -1
  21. package/dist/diagnostics/codes/artifact.d.ts +1 -1
  22. package/dist/diagnostics/codes/artifact.d.ts.map +1 -1
  23. package/dist/diagnostics/codes/artifact.js +12 -1
  24. package/dist/diagnostics/codes/artifact.js.map +1 -1
  25. package/dist/diagnostics/codes/home.d.ts +1 -1
  26. package/dist/diagnostics/codes/home.d.ts.map +1 -1
  27. package/dist/diagnostics/codes/home.js +12 -1
  28. package/dist/diagnostics/codes/home.js.map +1 -1
  29. package/dist/diagnostics/codes/index.d.ts +3 -2
  30. package/dist/diagnostics/codes/index.d.ts.map +1 -1
  31. package/dist/diagnostics/codes/index.js +3 -1
  32. package/dist/diagnostics/codes/index.js.map +1 -1
  33. package/dist/diagnostics/codes/remote.d.ts +8 -0
  34. package/dist/diagnostics/codes/remote.d.ts.map +1 -0
  35. package/dist/diagnostics/codes/remote.js +176 -0
  36. package/dist/diagnostics/codes/remote.js.map +1 -0
  37. package/dist/diagnostics/codes/submit.d.ts +1 -1
  38. package/dist/diagnostics/codes/submit.d.ts.map +1 -1
  39. package/dist/diagnostics/codes/submit.js +12 -1
  40. package/dist/diagnostics/codes/submit.js.map +1 -1
  41. package/dist/diagnostics/diagnostic.d.ts +1 -1
  42. package/dist/diagnostics/diagnostic.d.ts.map +1 -1
  43. package/dist/diagnostics/diagnostic.js +2 -1
  44. package/dist/diagnostics/diagnostic.js.map +1 -1
  45. package/dist/duration.d.ts +13 -0
  46. package/dist/duration.d.ts.map +1 -0
  47. package/dist/duration.js +27 -0
  48. package/dist/duration.js.map +1 -0
  49. package/dist/ids.d.ts +17 -1
  50. package/dist/ids.d.ts.map +1 -1
  51. package/dist/ids.js +9 -1
  52. package/dist/ids.js.map +1 -1
  53. package/dist/index.d.ts +33 -8
  54. package/dist/index.js +33 -8
  55. package/dist/interaction.d.ts +33 -2
  56. package/dist/interaction.d.ts.map +1 -1
  57. package/dist/interaction.js +22 -6
  58. package/dist/interaction.js.map +1 -1
  59. package/dist/manifest.d.ts +59 -14
  60. package/dist/manifest.d.ts.map +1 -1
  61. package/dist/manifest.js +63 -15
  62. package/dist/manifest.js.map +1 -1
  63. package/dist/methods/artifact/export.d.ts +40 -0
  64. package/dist/methods/artifact/export.d.ts.map +1 -0
  65. package/dist/methods/artifact/export.js +36 -0
  66. package/dist/methods/artifact/export.js.map +1 -0
  67. package/dist/methods/artifact/import.d.ts +23 -0
  68. package/dist/methods/artifact/import.d.ts.map +1 -0
  69. package/dist/methods/artifact/import.js +25 -0
  70. package/dist/methods/artifact/import.js.map +1 -0
  71. package/dist/methods/artifact/pause.d.ts +33 -0
  72. package/dist/methods/artifact/pause.d.ts.map +1 -0
  73. package/dist/methods/artifact/pause.js +33 -0
  74. package/dist/methods/artifact/pause.js.map +1 -0
  75. package/dist/methods/artifact/publish.d.ts +2 -1
  76. package/dist/methods/artifact/publish.d.ts.map +1 -1
  77. package/dist/methods/artifact/publish.js +1 -1
  78. package/dist/methods/hosted/push.d.ts +76 -0
  79. package/dist/methods/hosted/push.d.ts.map +1 -0
  80. package/dist/methods/hosted/push.js +71 -0
  81. package/dist/methods/hosted/push.js.map +1 -0
  82. package/dist/methods/hosted/submission.d.ts +18 -0
  83. package/dist/methods/hosted/submission.d.ts.map +1 -0
  84. package/dist/methods/hosted/submission.js +23 -0
  85. package/dist/methods/hosted/submission.js.map +1 -0
  86. package/dist/methods/index.d.ts.map +1 -1
  87. package/dist/methods/index.js +44 -2
  88. package/dist/methods/index.js.map +1 -1
  89. package/dist/methods/instance/status.d.ts +3 -0
  90. package/dist/methods/instance/status.d.ts.map +1 -1
  91. package/dist/methods/instance/status.js +3 -1
  92. package/dist/methods/instance/status.js.map +1 -1
  93. package/dist/methods/mostra/initialize.d.ts +17 -3
  94. package/dist/methods/mostra/initialize.d.ts.map +1 -1
  95. package/dist/methods/mostra/initialize.js +11 -3
  96. package/dist/methods/mostra/initialize.js.map +1 -1
  97. package/dist/methods/port/relay-author.d.ts +28 -0
  98. package/dist/methods/port/relay-author.d.ts.map +1 -0
  99. package/dist/methods/port/relay-author.js +42 -0
  100. package/dist/methods/port/relay-author.js.map +1 -0
  101. package/dist/methods/port/relay-call.d.ts +33 -0
  102. package/dist/methods/port/relay-call.d.ts.map +1 -0
  103. package/dist/methods/port/relay-call.js +31 -0
  104. package/dist/methods/port/relay-call.js.map +1 -0
  105. package/dist/methods/port/relay-cancel.d.ts +16 -0
  106. package/dist/methods/port/relay-cancel.d.ts.map +1 -0
  107. package/dist/methods/port/relay-cancel.js +21 -0
  108. package/dist/methods/port/relay-cancel.js.map +1 -0
  109. package/dist/methods/port/relay-live.d.ts +25 -0
  110. package/dist/methods/port/relay-live.d.ts.map +1 -0
  111. package/dist/methods/port/relay-live.js +32 -0
  112. package/dist/methods/port/relay-live.js.map +1 -0
  113. package/dist/methods/port/relay-reconcile.d.ts +39 -0
  114. package/dist/methods/port/relay-reconcile.d.ts.map +1 -0
  115. package/dist/methods/port/relay-reconcile.js +35 -0
  116. package/dist/methods/port/relay-reconcile.js.map +1 -0
  117. package/dist/methods/port/relay-run.d.ts +47 -0
  118. package/dist/methods/port/relay-run.d.ts.map +1 -0
  119. package/dist/methods/port/relay-run.js +41 -0
  120. package/dist/methods/port/relay-run.js.map +1 -0
  121. package/dist/methods/port/submissions-deliver.d.ts +8 -0
  122. package/dist/methods/port/submissions-deliver.d.ts.map +1 -1
  123. package/dist/methods/port/submissions-deliver.js +4 -2
  124. package/dist/methods/port/submissions-deliver.js.map +1 -1
  125. package/dist/methods/relay/call-batch.d.ts +26 -0
  126. package/dist/methods/relay/call-batch.d.ts.map +1 -0
  127. package/dist/methods/relay/call-batch.js +30 -0
  128. package/dist/methods/relay/call-batch.js.map +1 -0
  129. package/dist/methods/relay/effect.d.ts +31 -0
  130. package/dist/methods/relay/effect.d.ts.map +1 -0
  131. package/dist/methods/relay/effect.js +30 -0
  132. package/dist/methods/relay/effect.js.map +1 -0
  133. package/dist/methods/relay/live-value.d.ts +33 -0
  134. package/dist/methods/relay/live-value.d.ts.map +1 -0
  135. package/dist/methods/relay/live-value.js +32 -0
  136. package/dist/methods/relay/live-value.js.map +1 -0
  137. package/dist/methods/relay/run-update.d.ts +46 -0
  138. package/dist/methods/relay/run-update.d.ts.map +1 -0
  139. package/dist/methods/relay/run-update.js +45 -0
  140. package/dist/methods/relay/run-update.js.map +1 -0
  141. package/dist/methods/remote/link.d.ts +40 -0
  142. package/dist/methods/remote/link.d.ts.map +1 -0
  143. package/dist/methods/remote/link.js +40 -0
  144. package/dist/methods/remote/link.js.map +1 -0
  145. package/dist/methods/remote/login-wait.d.ts +30 -0
  146. package/dist/methods/remote/login-wait.d.ts.map +1 -0
  147. package/dist/methods/remote/login-wait.js +36 -0
  148. package/dist/methods/remote/login-wait.js.map +1 -0
  149. package/dist/methods/remote/login.d.ts +41 -0
  150. package/dist/methods/remote/login.d.ts.map +1 -0
  151. package/dist/methods/remote/login.js +37 -0
  152. package/dist/methods/remote/login.js.map +1 -0
  153. package/dist/methods/remote/logout.d.ts +25 -0
  154. package/dist/methods/remote/logout.d.ts.map +1 -0
  155. package/dist/methods/remote/logout.js +28 -0
  156. package/dist/methods/remote/logout.js.map +1 -0
  157. package/dist/methods/remote/status.d.ts +14 -0
  158. package/dist/methods/remote/status.d.ts.map +1 -0
  159. package/dist/methods/remote/status.js +22 -0
  160. package/dist/methods/remote/status.js.map +1 -0
  161. package/dist/methods/remote/token.d.ts +19 -0
  162. package/dist/methods/remote/token.d.ts.map +1 -0
  163. package/dist/methods/remote/token.js +24 -0
  164. package/dist/methods/remote/token.js.map +1 -0
  165. package/dist/methods/share/start.d.ts +5 -2
  166. package/dist/methods/share/start.d.ts.map +1 -1
  167. package/dist/methods/share/start.js +6 -3
  168. package/dist/methods/share/start.js.map +1 -1
  169. package/dist/methods/state/patch.d.ts +7 -0
  170. package/dist/methods/state/patch.d.ts.map +1 -1
  171. package/dist/methods/state/patch.js +2 -1
  172. package/dist/methods/state/patch.js.map +1 -1
  173. package/dist/methods/view/url.d.ts +2 -1
  174. package/dist/methods/view/url.d.ts.map +1 -1
  175. package/dist/methods/view/url.js +2 -1
  176. package/dist/methods/view/url.js.map +1 -1
  177. package/dist/operator.d.ts +464 -0
  178. package/dist/operator.d.ts.map +1 -0
  179. package/dist/operator.js +134 -0
  180. package/dist/operator.js.map +1 -0
  181. package/dist/policy.d.ts +18 -0
  182. package/dist/policy.d.ts.map +1 -0
  183. package/dist/policy.js +23 -0
  184. package/dist/policy.js.map +1 -0
  185. package/dist/remote.d.ts +55 -0
  186. package/dist/remote.d.ts.map +1 -0
  187. package/dist/remote.js +52 -0
  188. package/dist/remote.js.map +1 -0
  189. package/dist/view.d.ts +1 -1
  190. package/dist/view.js +1 -1
  191. package/dist/view.js.map +1 -1
  192. package/package.json +12 -2
  193. package/schemas/protocol.draft-07.json +1839 -99
  194. package/schemas/protocol.schema.json +1787 -111
  195. package/src/actions.ts +45 -5
  196. package/src/browser.ts +70 -0
  197. package/src/capability.ts +0 -23
  198. package/src/diagnostics/codes/action.ts +12 -0
  199. package/src/diagnostics/codes/artifact.ts +12 -0
  200. package/src/diagnostics/codes/home.ts +12 -0
  201. package/src/diagnostics/codes/index.ts +6 -2
  202. package/src/diagnostics/codes/remote.ts +197 -0
  203. package/src/diagnostics/codes/submit.ts +12 -0
  204. package/src/diagnostics/diagnostic.ts +3 -1
  205. package/src/duration.ts +29 -0
  206. package/src/ids.ts +33 -1
  207. package/src/index.ts +143 -8
  208. package/src/interaction.ts +48 -2
  209. package/src/manifest.ts +115 -24
  210. package/src/methods/artifact/export.ts +68 -0
  211. package/src/methods/artifact/import.ts +39 -0
  212. package/src/methods/artifact/pause.ts +59 -0
  213. package/src/methods/hosted/push.ts +146 -0
  214. package/src/methods/hosted/submission.ts +34 -0
  215. package/src/methods/index.ts +42 -0
  216. package/src/methods/instance/status.ts +4 -0
  217. package/src/methods/mostra/initialize.ts +19 -3
  218. package/src/methods/port/relay-author.ts +57 -0
  219. package/src/methods/port/relay-call.ts +58 -0
  220. package/src/methods/port/relay-cancel.ts +33 -0
  221. package/src/methods/port/relay-live.ts +48 -0
  222. package/src/methods/port/relay-reconcile.ts +71 -0
  223. package/src/methods/port/relay-run.ts +80 -0
  224. package/src/methods/port/submissions-deliver.ts +13 -1
  225. package/src/methods/relay/call-batch.ts +52 -0
  226. package/src/methods/relay/effect.ts +55 -0
  227. package/src/methods/relay/live-value.ts +54 -0
  228. package/src/methods/relay/run-update.ts +81 -0
  229. package/src/methods/remote/link.ts +65 -0
  230. package/src/methods/remote/login-wait.ts +55 -0
  231. package/src/methods/remote/login.ts +72 -0
  232. package/src/methods/remote/logout.ts +42 -0
  233. package/src/methods/remote/status.ts +34 -0
  234. package/src/methods/remote/token.ts +39 -0
  235. package/src/methods/share/start.ts +12 -4
  236. package/src/methods/state/patch.ts +6 -0
  237. package/src/methods/view/url.ts +2 -1
  238. package/src/operator.ts +621 -0
  239. package/src/policy.ts +30 -0
  240. package/src/remote.ts +89 -0
  241. package/src/view.ts +1 -1
@@ -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,40 @@
1
+ import { MethodDefinition } from "../../method.js";
2
+ import { ServerOrigin } from "../../remote.js";
3
+ //#region src/methods/remote/link.d.ts
4
+ /** The params of `remote/link` (INTERFACES §18.2). */
5
+ export interface RemoteLinkParams {
6
+ /** The server's API origin. */
7
+ readonly server: ServerOrigin;
8
+ /**
9
+ * A credential the server's operator issued for an account (`accounts.authenticate`, §18.6), in
10
+ * place of a person's sign-in: a program runs an always-on owner instance with it. Kept in the
11
+ * home, owner-only, like a refresh token; never logged.
12
+ */
13
+ readonly key: string;
14
+ /** Makes this instance the account's default: the one chat-host authoring goes to (D165 item 1b). */
15
+ readonly default?: boolean;
16
+ }
17
+ /** The result of `remote/link`: this home is linked to the server for the key's account. */
18
+ export interface RemoteLinkResult {
19
+ /** The server linked to. */
20
+ readonly server: ServerOrigin;
21
+ /** The account the key is the operator's credential for. */
22
+ readonly account: {
23
+ readonly id: string;
24
+ readonly name?: string;
25
+ };
26
+ /** This home's instance link on that server (`lnk_…`), one per key's subject. */
27
+ readonly instanceId: string;
28
+ /** Whether this instance is the account's default. */
29
+ readonly default: boolean;
30
+ }
31
+ /**
32
+ * `remote/link`: links this home to a remote server with a key its operator issued for an account,
33
+ * in place of `remote/login`'s device grant, so a program can run an always-on owner instance
34
+ * (WP-30, D167). Linking again with a key is idempotent by nature, so it takes no `requestId`: the
35
+ * ledger never records the key's digest. A key the server doesn't admit is
36
+ * `MOSTRA_REMOTE_LOGIN_FAILED`.
37
+ */
38
+ export declare const remoteLinkMethod: MethodDefinition<RemoteLinkParams, RemoteLinkResult>;
39
+ //#endregion
40
+ //# sourceMappingURL=link.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"link.d.ts","names":[],"sources":["../../../src/methods/remote/link.ts"],"mappings":";;;;iBAMiB;;WAEN,QAAQ;;;;;;WAMR;;WAEA;;;iBAIM;;WAEN,QAAQ;;WAER;aAAoB;aAAqB;;;WAEzC;;WAEA;;;;;;;;;qBA8BE,kBAAkB,iBAAiB,kBAAkB"}
@@ -0,0 +1,40 @@
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/link.ts
6
+ const params = z.object({
7
+ server: ServerOrigin,
8
+ key: z.string().min(20).max(512),
9
+ default: z.boolean().exactOptional()
10
+ }).register(wireRegistry, { id: "RemoteLinkParams" });
11
+ const result = z.object({
12
+ server: ServerOrigin,
13
+ account: z.object({
14
+ id: z.string(),
15
+ name: z.string().exactOptional()
16
+ }),
17
+ instanceId: z.string(),
18
+ default: z.boolean()
19
+ }).register(wireRegistry, {
20
+ id: "RemoteLinkResult",
21
+ description: "A home linked to a remote server with an operator-issued key."
22
+ });
23
+ /**
24
+ * `remote/link`: links this home to a remote server with a key its operator issued for an account,
25
+ * in place of `remote/login`'s device grant, so a program can run an always-on owner instance
26
+ * (WP-30, D167). Linking again with a key is idempotent by nature, so it takes no `requestId`: the
27
+ * ledger never records the key's digest. A key the server doesn't admit is
28
+ * `MOSTRA_REMOTE_LOGIN_FAILED`.
29
+ */
30
+ const remoteLinkMethod = defineMethod({
31
+ method: "remote/link",
32
+ direction: "client-to-instance",
33
+ mutating: false,
34
+ params,
35
+ result
36
+ });
37
+ //#endregion
38
+ export { remoteLinkMethod };
39
+
40
+ //# sourceMappingURL=link.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"link.js","names":[],"sources":["../../../src/methods/remote/link.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/link` (INTERFACES §18.2). */\nexport interface RemoteLinkParams {\n /** The server's API origin. */\n readonly server: ServerOrigin;\n /**\n * A credential the server's operator issued for an account (`accounts.authenticate`, §18.6), in\n * place of a person's sign-in: a program runs an always-on owner instance with it. Kept in the\n * home, owner-only, like a refresh token; never logged.\n */\n readonly key: string;\n /** Makes this instance the account's default: the one chat-host authoring goes to (D165 item 1b). */\n readonly default?: boolean;\n}\n\n/** The result of `remote/link`: this home is linked to the server for the key's account. */\nexport interface RemoteLinkResult {\n /** The server linked to. */\n readonly server: ServerOrigin;\n /** The account the key is the operator's credential for. */\n readonly account: { readonly id: string; readonly name?: string };\n /** This home's instance link on that server (`lnk_…`), one per key's subject. */\n readonly instanceId: string;\n /** Whether this instance is the account's default. */\n readonly default: boolean;\n}\n\nconst params: z.ZodType<RemoteLinkParams> = z\n .object({\n server: ServerOrigin,\n key: z.string().min(20).max(512),\n default: z.boolean().exactOptional(),\n })\n .register(wireRegistry, { id: \"RemoteLinkParams\" });\n\nconst result: z.ZodType<RemoteLinkResult> = z\n .object({\n server: ServerOrigin,\n account: z.object({ id: z.string(), name: z.string().exactOptional() }),\n instanceId: z.string(),\n default: z.boolean(),\n })\n .register(wireRegistry, {\n id: \"RemoteLinkResult\",\n description: \"A home linked to a remote server with an operator-issued key.\",\n });\n\n/**\n * `remote/link`: links this home to a remote server with a key its operator issued for an account,\n * in place of `remote/login`'s device grant, so a program can run an always-on owner instance\n * (WP-30, D167). Linking again with a key is idempotent by nature, so it takes no `requestId`: the\n * ledger never records the key's digest. A key the server doesn't admit is\n * `MOSTRA_REMOTE_LOGIN_FAILED`.\n */\nexport const remoteLinkMethod: MethodDefinition<RemoteLinkParams, RemoteLinkResult> = defineMethod({\n method: \"remote/link\",\n direction: \"client-to-instance\",\n mutating: false,\n params,\n result,\n});\n"],"mappings":";;;;;AA+BA,MAAM,SAAsC,EACzC,OAAO;CACN,QAAQ;CACR,KAAK,EAAE,OAAO,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,GAAG;CAC/B,SAAS,EAAE,QAAQ,CAAC,CAAC,cAAc;AACrC,CAAC,CAAC,CACD,SAAS,cAAc,EAAE,IAAI,mBAAmB,CAAC;AAEpD,MAAM,SAAsC,EACzC,OAAO;CACN,QAAQ;CACR,SAAS,EAAE,OAAO;EAAE,IAAI,EAAE,OAAO;EAAG,MAAM,EAAE,OAAO,CAAC,CAAC,cAAc;CAAE,CAAC;CACtE,YAAY,EAAE,OAAO;CACrB,SAAS,EAAE,QAAQ;AACrB,CAAC,CAAC,CACD,SAAS,cAAc;CACtB,IAAI;CACJ,aAAa;AACf,CAAC;;;;;;;;AASH,MAAa,mBAAyE,aAAa;CACjG,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"}
@@ -0,0 +1,41 @@
1
+ import { MethodDefinition } from "../../method.js";
2
+ import { ServerOrigin } from "../../remote.js";
3
+ //#region src/methods/remote/login.d.ts
4
+ /** The params of `remote/login` (INTERFACES §18.2). */
5
+ export interface RemoteLoginParams {
6
+ /** The server's API origin. Default: the home's default server. */
7
+ readonly server?: ServerOrigin;
8
+ /**
9
+ * Makes this instance the account's default: the one chat-host authoring goes to (D165 item
10
+ * 1b). Without it, an account's first linked instance is its default.
11
+ */
12
+ readonly default?: boolean;
13
+ /** Makes a retry return the same sign-in. */
14
+ readonly requestId?: string;
15
+ }
16
+ /**
17
+ * The result of `remote/login`: a sign-in by the OAuth device authorization grant (RFC 8628) has
18
+ * started; the person opens `verificationUri` and enters `userCode`.
19
+ */
20
+ export interface RemoteLoginResult {
21
+ /** The sign-in, for `remote/login.wait`. */
22
+ readonly loginId: string;
23
+ /** The server signed in to. */
24
+ readonly server: ServerOrigin;
25
+ /** The page the person opens. */
26
+ readonly verificationUri: string;
27
+ /** The address with the code filled in, when the server offers one. */
28
+ readonly verificationUriComplete?: string;
29
+ /** The code the person enters there. */
30
+ readonly userCode: string;
31
+ /** When the code stops working. */
32
+ readonly expiresAt: string;
33
+ }
34
+ /**
35
+ * `remote/login`: starts signing this home in to a remote server by the device authorization
36
+ * grant, and polls for its token in the background (D165 item 2). The instance keeps the refresh
37
+ * token in the home, owner-only; a home already linked there rebinds its instance link.
38
+ */
39
+ export declare const remoteLoginMethod: MethodDefinition<RemoteLoginParams, RemoteLoginResult>;
40
+ //#endregion
41
+ //# sourceMappingURL=login.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"login.d.ts","names":[],"sources":["../../../src/methods/remote/login.ts"],"mappings":";;;;iBAMiB;;WAEN,SAAS;;;;;WAKT;;WAEA;;;;;;iBAOM;;WAEN;;WAEA,QAAQ;;WAER;;WAEA;;WAEA;;WAEA;;;;;;;qBA8BE,mBAAmB,iBAAiB,mBAAmB"}
@@ -0,0 +1,37 @@
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.ts
6
+ const params = z.object({
7
+ server: ServerOrigin.exactOptional(),
8
+ default: z.boolean().exactOptional(),
9
+ requestId: z.string().min(1).exactOptional()
10
+ }).register(wireRegistry, { id: "RemoteLoginParams" });
11
+ const result = z.object({
12
+ loginId: z.string(),
13
+ server: ServerOrigin,
14
+ verificationUri: z.string(),
15
+ verificationUriComplete: z.string().exactOptional(),
16
+ userCode: z.string(),
17
+ expiresAt: z.string()
18
+ }).register(wireRegistry, {
19
+ id: "RemoteLoginResult",
20
+ description: "A device-grant sign-in that started: where to go and the code to enter."
21
+ });
22
+ /**
23
+ * `remote/login`: starts signing this home in to a remote server by the device authorization
24
+ * grant, and polls for its token in the background (D165 item 2). The instance keeps the refresh
25
+ * token in the home, owner-only; a home already linked there rebinds its instance link.
26
+ */
27
+ const remoteLoginMethod = defineMethod({
28
+ method: "remote/login",
29
+ direction: "client-to-instance",
30
+ mutating: true,
31
+ params,
32
+ result
33
+ });
34
+ //#endregion
35
+ export { remoteLoginMethod };
36
+
37
+ //# sourceMappingURL=login.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"login.js","names":[],"sources":["../../../src/methods/remote/login.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` (INTERFACES §18.2). */\nexport interface RemoteLoginParams {\n /** The server's API origin. Default: the home's default server. */\n readonly server?: ServerOrigin;\n /**\n * Makes this instance the account's default: the one chat-host authoring goes to (D165 item\n * 1b). Without it, an account's first linked instance is its default.\n */\n readonly default?: boolean;\n /** Makes a retry return the same sign-in. */\n readonly requestId?: string;\n}\n\n/**\n * The result of `remote/login`: a sign-in by the OAuth device authorization grant (RFC 8628) has\n * started; the person opens `verificationUri` and enters `userCode`.\n */\nexport interface RemoteLoginResult {\n /** The sign-in, for `remote/login.wait`. */\n readonly loginId: string;\n /** The server signed in to. */\n readonly server: ServerOrigin;\n /** The page the person opens. */\n readonly verificationUri: string;\n /** The address with the code filled in, when the server offers one. */\n readonly verificationUriComplete?: string;\n /** The code the person enters there. */\n readonly userCode: string;\n /** When the code stops working. */\n readonly expiresAt: string;\n}\n\nconst params: z.ZodType<RemoteLoginParams> = z\n .object({\n server: ServerOrigin.exactOptional(),\n default: z.boolean().exactOptional(),\n requestId: z.string().min(1).exactOptional(),\n })\n .register(wireRegistry, { id: \"RemoteLoginParams\" });\n\nconst result: z.ZodType<RemoteLoginResult> = z\n .object({\n loginId: z.string(),\n server: ServerOrigin,\n verificationUri: z.string(),\n verificationUriComplete: z.string().exactOptional(),\n userCode: z.string(),\n expiresAt: z.string(),\n })\n .register(wireRegistry, {\n id: \"RemoteLoginResult\",\n description: \"A device-grant sign-in that started: where to go and the code to enter.\",\n });\n\n/**\n * `remote/login`: starts signing this home in to a remote server by the device authorization\n * grant, and polls for its token in the background (D165 item 2). The instance keeps the refresh\n * token in the home, owner-only; a home already linked there rebinds its instance link.\n */\nexport const remoteLoginMethod: MethodDefinition<RemoteLoginParams, RemoteLoginResult> =\n defineMethod({\n method: \"remote/login\",\n direction: \"client-to-instance\",\n mutating: true,\n params,\n result,\n });\n"],"mappings":";;;;;AAqCA,MAAM,SAAuC,EAC1C,OAAO;CACN,QAAQ,aAAa,cAAc;CACnC,SAAS,EAAE,QAAQ,CAAC,CAAC,cAAc;CACnC,WAAW,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,cAAc;AAC7C,CAAC,CAAC,CACD,SAAS,cAAc,EAAE,IAAI,oBAAoB,CAAC;AAErD,MAAM,SAAuC,EAC1C,OAAO;CACN,SAAS,EAAE,OAAO;CAClB,QAAQ;CACR,iBAAiB,EAAE,OAAO;CAC1B,yBAAyB,EAAE,OAAO,CAAC,CAAC,cAAc;CAClD,UAAU,EAAE,OAAO;CACnB,WAAW,EAAE,OAAO;AACtB,CAAC,CAAC,CACD,SAAS,cAAc;CACtB,IAAI;CACJ,aAAa;AACf,CAAC;;;;;;AAOH,MAAa,oBACX,aAAa;CACX,QAAQ;CACR,WAAW;CACX,UAAU;CACV;CACA;AACF,CAAC"}
@@ -0,0 +1,25 @@
1
+ import { MethodDefinition } from "../../method.js";
2
+ import { ServerOrigin } from "../../remote.js";
3
+ //#region src/methods/remote/logout.d.ts
4
+ /** The params of `remote/logout` (INTERFACES §18.2). */
5
+ export interface RemoteLogoutParams {
6
+ /** The server. Default: every server this home is signed in to. */
7
+ readonly server?: ServerOrigin;
8
+ /**
9
+ * Also forgets the instance link, after which this home owns none of the artifacts it shared
10
+ * there. Without it, the next sign-in rebinds the same link.
11
+ */
12
+ readonly forget?: boolean;
13
+ }
14
+ /** The result of `remote/logout`: the servers signed out of. */
15
+ export interface RemoteLogoutResult {
16
+ /** The servers this home is no longer signed in to. */
17
+ readonly servers: readonly ServerOrigin[];
18
+ }
19
+ /**
20
+ * `remote/logout`: revokes this home's grant on a server and removes its tokens, keeping the
21
+ * instance link unless `forget` (D165, after the Opus review).
22
+ */
23
+ export declare const remoteLogoutMethod: MethodDefinition<RemoteLogoutParams, RemoteLogoutResult>;
24
+ //#endregion
25
+ //# sourceMappingURL=logout.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logout.d.ts","names":[],"sources":["../../../src/methods/remote/logout.ts"],"mappings":";;;;iBAMiB;;WAEN,SAAS;;;;;WAKT;;;iBAIM;;WAEN,kBAAkB;;;;;;qBAehB,oBAAoB,iBAAiB,oBAAoB"}
@@ -0,0 +1,28 @@
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/logout.ts
6
+ const params = z.object({
7
+ server: ServerOrigin.exactOptional(),
8
+ forget: z.boolean().exactOptional()
9
+ }).register(wireRegistry, { id: "RemoteLogoutParams" });
10
+ const result = z.object({ servers: z.array(ServerOrigin).readonly() }).register(wireRegistry, {
11
+ id: "RemoteLogoutResult",
12
+ description: "The servers signed out of."
13
+ });
14
+ /**
15
+ * `remote/logout`: revokes this home's grant on a server and removes its tokens, keeping the
16
+ * instance link unless `forget` (D165, after the Opus review).
17
+ */
18
+ const remoteLogoutMethod = defineMethod({
19
+ method: "remote/logout",
20
+ direction: "client-to-instance",
21
+ mutating: true,
22
+ params,
23
+ result
24
+ });
25
+ //#endregion
26
+ export { remoteLogoutMethod };
27
+
28
+ //# sourceMappingURL=logout.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logout.js","names":[],"sources":["../../../src/methods/remote/logout.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/logout` (INTERFACES §18.2). */\nexport interface RemoteLogoutParams {\n /** The server. Default: every server this home is signed in to. */\n readonly server?: ServerOrigin;\n /**\n * Also forgets the instance link, after which this home owns none of the artifacts it shared\n * there. Without it, the next sign-in rebinds the same link.\n */\n readonly forget?: boolean;\n}\n\n/** The result of `remote/logout`: the servers signed out of. */\nexport interface RemoteLogoutResult {\n /** The servers this home is no longer signed in to. */\n readonly servers: readonly ServerOrigin[];\n}\n\nconst params: z.ZodType<RemoteLogoutParams> = z\n .object({ server: ServerOrigin.exactOptional(), forget: z.boolean().exactOptional() })\n .register(wireRegistry, { id: \"RemoteLogoutParams\" });\n\nconst result: z.ZodType<RemoteLogoutResult> = z\n .object({ servers: z.array(ServerOrigin).readonly() })\n .register(wireRegistry, { id: \"RemoteLogoutResult\", description: \"The servers signed out of.\" });\n\n/**\n * `remote/logout`: revokes this home's grant on a server and removes its tokens, keeping the\n * instance link unless `forget` (D165, after the Opus review).\n */\nexport const remoteLogoutMethod: MethodDefinition<RemoteLogoutParams, RemoteLogoutResult> =\n defineMethod({\n method: \"remote/logout\",\n direction: \"client-to-instance\",\n mutating: true,\n params,\n result,\n });\n"],"mappings":";;;;;AAsBA,MAAM,SAAwC,EAC3C,OAAO;CAAE,QAAQ,aAAa,cAAc;CAAG,QAAQ,EAAE,QAAQ,CAAC,CAAC,cAAc;AAAE,CAAC,CAAC,CACrF,SAAS,cAAc,EAAE,IAAI,qBAAqB,CAAC;AAEtD,MAAM,SAAwC,EAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC,CAAC,SAAS,EAAE,CAAC,CAAC,CACrD,SAAS,cAAc;CAAE,IAAI;CAAsB,aAAa;AAA6B,CAAC;;;;;AAMjG,MAAa,qBACX,aAAa;CACX,QAAQ;CACR,WAAW;CACX,UAAU;CACV;CACA;AACF,CAAC"}
@@ -0,0 +1,14 @@
1
+ import { MethodDefinition } from "../../method.js";
2
+ import { RemoteLink } from "../../remote.js";
3
+ //#region src/methods/remote/status.d.ts
4
+ /** The params of `remote/status` (INTERFACES §18.2). */
5
+ export type RemoteStatusParams = Record<string, never>;
6
+ /** The result of `remote/status`: every server this home is linked to. */
7
+ export interface RemoteStatusResult {
8
+ /** Each server this home is linked to. */
9
+ readonly links: readonly RemoteLink[];
10
+ }
11
+ /** `remote/status`: the remote servers this home is linked to and each link's state. */
12
+ export declare const remoteStatusMethod: MethodDefinition<RemoteStatusParams, RemoteStatusResult>;
13
+ //#endregion
14
+ //# sourceMappingURL=status.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"status.d.ts","names":[],"sources":["../../../src/methods/remote/status.ts"],"mappings":";;;;YAMY,qBAAqB;;iBAGhB;;WAEN,gBAAgB;;;qBAed,oBAAoB,iBAAiB,oBAAoB"}
@@ -0,0 +1,22 @@
1
+ import { wireRegistry } from "../../wire-registry.js";
2
+ import { defineMethod } from "../../method.js";
3
+ import { RemoteLink } from "../../remote.js";
4
+ import * as z from "zod";
5
+ //#region src/methods/remote/status.ts
6
+ const params = z.object({}).register(wireRegistry, { id: "RemoteStatusParams" });
7
+ const result = z.object({ links: z.array(RemoteLink).readonly() }).register(wireRegistry, {
8
+ id: "RemoteStatusResult",
9
+ description: "Every remote server this home is linked to."
10
+ });
11
+ /** `remote/status`: the remote servers this home is linked to and each link's state. */
12
+ const remoteStatusMethod = defineMethod({
13
+ method: "remote/status",
14
+ direction: "client-to-instance",
15
+ mutating: false,
16
+ params,
17
+ result
18
+ });
19
+ //#endregion
20
+ export { remoteStatusMethod };
21
+
22
+ //# sourceMappingURL=status.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"status.js","names":[],"sources":["../../../src/methods/remote/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\";\n\n/** The params of `remote/status` (INTERFACES §18.2). */\nexport type RemoteStatusParams = Record<string, never>;\n\n/** The result of `remote/status`: every server this home is linked to. */\nexport interface RemoteStatusResult {\n /** Each server this home is linked to. */\n readonly links: readonly RemoteLink[];\n}\n\nconst params: z.ZodType<RemoteStatusParams> = z\n .object({})\n .register(wireRegistry, { id: \"RemoteStatusParams\" });\n\nconst result: z.ZodType<RemoteStatusResult> = z\n .object({ links: z.array(RemoteLink).readonly() })\n .register(wireRegistry, {\n id: \"RemoteStatusResult\",\n description: \"Every remote server this home is linked to.\",\n });\n\n/** `remote/status`: the remote servers this home is linked to and each link's state. */\nexport const remoteStatusMethod: MethodDefinition<RemoteStatusParams, RemoteStatusResult> =\n defineMethod({\n method: \"remote/status\",\n direction: \"client-to-instance\",\n mutating: false,\n params,\n result,\n });\n"],"mappings":";;;;;AAcA,MAAM,SAAwC,EAC3C,OAAO,CAAC,CAAC,CAAC,CACV,SAAS,cAAc,EAAE,IAAI,qBAAqB,CAAC;AAEtD,MAAM,SAAwC,EAC3C,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC,CAAC,SAAS,EAAE,CAAC,CAAC,CACjD,SAAS,cAAc;CACtB,IAAI;CACJ,aAAa;AACf,CAAC;;AAGH,MAAa,qBACX,aAAa;CACX,QAAQ;CACR,WAAW;CACX,UAAU;CACV;CACA;AACF,CAAC"}
@@ -0,0 +1,19 @@
1
+ import { MethodDefinition } from "../../method.js";
2
+ //#region src/methods/remote/token.d.ts
3
+ /** The params of `remote/token` (INTERFACES §18.2): a fresh access token, sent in band. */
4
+ export interface RemoteTokenParams {
5
+ /** A fresh access token of the binding's own grant. */
6
+ readonly accessToken: string;
7
+ }
8
+ /** The result of `remote/token`: when the binding now closes unless refreshed again. */
9
+ export interface RemoteTokenResult {
10
+ /** When the new token expires. */
11
+ readonly expiresAt: string;
12
+ }
13
+ /**
14
+ * `remote/token`: on a binding to a remote server, replaces the session's access token with a
15
+ * fresh one for the same grant, so the server doesn't close the binding at the old one's expiry.
16
+ */
17
+ export declare const remoteTokenMethod: MethodDefinition<RemoteTokenParams, RemoteTokenResult>;
18
+ //#endregion
19
+ //# sourceMappingURL=token.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"token.d.ts","names":[],"sources":["../../../src/methods/remote/token.ts"],"mappings":";;;iBAKiB;;WAEN;;;iBAIM;;WAEN;;;;;;qBAkBE,mBAAmB,iBAAiB,mBAAmB"}
@@ -0,0 +1,24 @@
1
+ import { wireRegistry } from "../../wire-registry.js";
2
+ import { defineMethod } from "../../method.js";
3
+ import * as z from "zod";
4
+ //#region src/methods/remote/token.ts
5
+ const params = z.object({ accessToken: z.string().min(1) }).register(wireRegistry, { id: "RemoteTokenParams" });
6
+ const result = z.object({ expiresAt: z.string() }).register(wireRegistry, {
7
+ id: "RemoteTokenResult",
8
+ description: "When the binding closes unless its token is refreshed again."
9
+ });
10
+ /**
11
+ * `remote/token`: on a binding to a remote server, replaces the session's access token with a
12
+ * fresh one for the same grant, so the server doesn't close the binding at the old one's expiry.
13
+ */
14
+ const remoteTokenMethod = defineMethod({
15
+ method: "remote/token",
16
+ direction: "client-to-instance",
17
+ mutating: false,
18
+ params,
19
+ result
20
+ });
21
+ //#endregion
22
+ export { remoteTokenMethod };
23
+
24
+ //# sourceMappingURL=token.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"token.js","names":[],"sources":["../../../src/methods/remote/token.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 `remote/token` (INTERFACES §18.2): a fresh access token, sent in band. */\nexport interface RemoteTokenParams {\n /** A fresh access token of the binding's own grant. */\n readonly accessToken: string;\n}\n\n/** The result of `remote/token`: when the binding now closes unless refreshed again. */\nexport interface RemoteTokenResult {\n /** When the new token expires. */\n readonly expiresAt: string;\n}\n\nconst params: z.ZodType<RemoteTokenParams> = z\n .object({ accessToken: z.string().min(1) })\n .register(wireRegistry, { id: \"RemoteTokenParams\" });\n\nconst result: z.ZodType<RemoteTokenResult> = z\n .object({ expiresAt: z.string() })\n .register(wireRegistry, {\n id: \"RemoteTokenResult\",\n description: \"When the binding closes unless its token is refreshed again.\",\n });\n\n/**\n * `remote/token`: on a binding to a remote server, replaces the session's access token with a\n * fresh one for the same grant, so the server doesn't close the binding at the old one's expiry.\n */\nexport const remoteTokenMethod: MethodDefinition<RemoteTokenParams, RemoteTokenResult> =\n defineMethod({\n method: \"remote/token\",\n direction: \"client-to-instance\",\n mutating: false,\n params,\n result,\n });\n"],"mappings":";;;;AAgBA,MAAM,SAAuC,EAC1C,OAAO,EAAE,aAAa,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAC1C,SAAS,cAAc,EAAE,IAAI,oBAAoB,CAAC;AAErD,MAAM,SAAuC,EAC1C,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,CAAC,CAAC,CACjC,SAAS,cAAc;CACtB,IAAI;CACJ,aAAa;AACf,CAAC;;;;;AAMH,MAAa,oBACX,aAAa;CACX,QAAQ;CACR,WAAW;CACX,UAAU;CACV;CACA;AACF,CAAC"}