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