@mostra/protocol 0.10.0 → 0.12.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 (129) hide show
  1. package/dist/actions.d.ts +11 -3
  2. package/dist/actions.d.ts.map +1 -1
  3. package/dist/actions.js.map +1 -1
  4. package/dist/browser.d.ts +43 -1
  5. package/dist/browser.d.ts.map +1 -1
  6. package/dist/browser.js +29 -1
  7. package/dist/browser.js.map +1 -1
  8. package/dist/diagnostics/codes/action.d.ts +1 -1
  9. package/dist/diagnostics/codes/action.d.ts.map +1 -1
  10. package/dist/diagnostics/codes/action.js +12 -1
  11. package/dist/diagnostics/codes/action.js.map +1 -1
  12. package/dist/diagnostics/codes/index.d.ts +3 -2
  13. package/dist/diagnostics/codes/index.d.ts.map +1 -1
  14. package/dist/diagnostics/codes/index.js +3 -1
  15. package/dist/diagnostics/codes/index.js.map +1 -1
  16. package/dist/diagnostics/codes/remote.d.ts +1 -1
  17. package/dist/diagnostics/codes/remote.d.ts.map +1 -1
  18. package/dist/diagnostics/codes/remote.js +78 -1
  19. package/dist/diagnostics/codes/remote.js.map +1 -1
  20. package/dist/diagnostics/codes/submit.d.ts +1 -1
  21. package/dist/diagnostics/codes/submit.d.ts.map +1 -1
  22. package/dist/diagnostics/codes/submit.js +12 -1
  23. package/dist/diagnostics/codes/submit.js.map +1 -1
  24. package/dist/diagnostics/codes/team.d.ts +8 -0
  25. package/dist/diagnostics/codes/team.d.ts.map +1 -0
  26. package/dist/diagnostics/codes/team.js +44 -0
  27. package/dist/diagnostics/codes/team.js.map +1 -0
  28. package/dist/diagnostics/diagnostic.d.ts +1 -1
  29. package/dist/diagnostics/diagnostic.d.ts.map +1 -1
  30. package/dist/diagnostics/diagnostic.js +2 -1
  31. package/dist/diagnostics/diagnostic.js.map +1 -1
  32. package/dist/index.d.ts +17 -7
  33. package/dist/index.js +14 -4
  34. package/dist/interaction.d.ts +17 -3
  35. package/dist/interaction.d.ts.map +1 -1
  36. package/dist/interaction.js +17 -13
  37. package/dist/interaction.js.map +1 -1
  38. package/dist/manifest.d.ts +3 -0
  39. package/dist/manifest.d.ts.map +1 -1
  40. package/dist/manifest.js +5 -2
  41. package/dist/manifest.js.map +1 -1
  42. package/dist/methods/artifact/pause.d.ts +33 -0
  43. package/dist/methods/artifact/pause.d.ts.map +1 -0
  44. package/dist/methods/artifact/pause.js +33 -0
  45. package/dist/methods/artifact/pause.js.map +1 -0
  46. package/dist/methods/index.d.ts.map +1 -1
  47. package/dist/methods/index.js +16 -2
  48. package/dist/methods/index.js.map +1 -1
  49. package/dist/methods/port/relay-author.d.ts +28 -0
  50. package/dist/methods/port/relay-author.d.ts.map +1 -0
  51. package/dist/methods/port/relay-author.js +42 -0
  52. package/dist/methods/port/relay-author.js.map +1 -0
  53. package/dist/methods/port/trusted-controls-policy.d.ts +1 -1
  54. package/dist/methods/remote/link.d.ts +40 -0
  55. package/dist/methods/remote/link.d.ts.map +1 -0
  56. package/dist/methods/remote/link.js +40 -0
  57. package/dist/methods/remote/link.js.map +1 -0
  58. package/dist/methods/results/get.d.ts +3 -1
  59. package/dist/methods/results/get.d.ts.map +1 -1
  60. package/dist/methods/results/get.js +4 -3
  61. package/dist/methods/results/get.js.map +1 -1
  62. package/dist/methods/results/list.d.ts +33 -0
  63. package/dist/methods/results/list.d.ts.map +1 -0
  64. package/dist/methods/results/list.js +35 -0
  65. package/dist/methods/results/list.js.map +1 -0
  66. package/dist/methods/roster/add.d.ts +47 -0
  67. package/dist/methods/roster/add.d.ts.map +1 -0
  68. package/dist/methods/roster/add.js +46 -0
  69. package/dist/methods/roster/add.js.map +1 -0
  70. package/dist/methods/roster/get.d.ts +18 -0
  71. package/dist/methods/roster/get.d.ts.map +1 -0
  72. package/dist/methods/roster/get.js +22 -0
  73. package/dist/methods/roster/get.js.map +1 -0
  74. package/dist/methods/roster/remove.d.ts +28 -0
  75. package/dist/methods/roster/remove.d.ts.map +1 -0
  76. package/dist/methods/roster/remove.js +31 -0
  77. package/dist/methods/roster/remove.js.map +1 -0
  78. package/dist/methods/share/start.d.ts +15 -2
  79. package/dist/methods/share/start.d.ts.map +1 -1
  80. package/dist/methods/share/start.js +5 -1
  81. package/dist/methods/share/start.js.map +1 -1
  82. package/dist/methods/state/get.d.ts +1 -1
  83. package/dist/methods/state/patch.d.ts +1 -1
  84. package/dist/methods/view/url.d.ts +1 -1
  85. package/dist/methods/wait/wait.d.ts +1 -1
  86. package/dist/operator.d.ts +511 -0
  87. package/dist/operator.d.ts.map +1 -0
  88. package/dist/operator.js +134 -0
  89. package/dist/operator.js.map +1 -0
  90. package/dist/team-settings.d.ts +21 -0
  91. package/dist/team-settings.d.ts.map +1 -0
  92. package/dist/team-settings.js +27 -0
  93. package/dist/team-settings.js.map +1 -0
  94. package/dist/team.d.ts +221 -0
  95. package/dist/team.d.ts.map +1 -0
  96. package/dist/team.js +162 -0
  97. package/dist/team.js.map +1 -0
  98. package/dist/verify.d.ts +7 -0
  99. package/dist/verify.d.ts.map +1 -1
  100. package/dist/verify.js.map +1 -1
  101. package/dist/worker.d.ts +1 -1
  102. package/package.json +11 -1
  103. package/schemas/protocol.draft-07.json +1027 -45
  104. package/schemas/protocol.schema.json +996 -46
  105. package/src/actions.ts +8 -4
  106. package/src/browser.ts +64 -0
  107. package/src/diagnostics/codes/action.ts +12 -0
  108. package/src/diagnostics/codes/index.ts +6 -2
  109. package/src/diagnostics/codes/remote.ts +84 -0
  110. package/src/diagnostics/codes/submit.ts +12 -0
  111. package/src/diagnostics/codes/team.ts +53 -0
  112. package/src/diagnostics/diagnostic.ts +3 -1
  113. package/src/index.ts +66 -2
  114. package/src/interaction.ts +30 -5
  115. package/src/manifest.ts +5 -0
  116. package/src/methods/artifact/pause.ts +59 -0
  117. package/src/methods/index.ts +14 -0
  118. package/src/methods/port/relay-author.ts +57 -0
  119. package/src/methods/remote/link.ts +65 -0
  120. package/src/methods/results/get.ts +3 -2
  121. package/src/methods/results/list.ts +61 -0
  122. package/src/methods/roster/add.ts +77 -0
  123. package/src/methods/roster/get.ts +30 -0
  124. package/src/methods/roster/remove.ts +49 -0
  125. package/src/methods/share/start.ts +23 -3
  126. package/src/operator.ts +660 -0
  127. package/src/team-settings.ts +38 -0
  128. package/src/team.ts +398 -0
  129. package/src/verify.ts +7 -0
@@ -0,0 +1,22 @@
1
+ import { wireRegistry } from "../../wire-registry.js";
2
+ import { ArtifactRef } from "../../artifact.js";
3
+ import { defineMethod } from "../../method.js";
4
+ import { Roster } from "../../team.js";
5
+ import * as z from "zod";
6
+ //#region src/methods/roster/get.ts
7
+ const params = z.object({ artifact: ArtifactRef }).register(wireRegistry, { id: "RosterGetParams" });
8
+ /**
9
+ * `roster/get`: every expected respondent with their status in the current round (CO-03), the
10
+ * round, whether it is complete and its counts. Agents and hosts always read all of it (CO-07).
11
+ */
12
+ const rosterGetMethod = defineMethod({
13
+ method: "roster/get",
14
+ direction: "client-to-instance",
15
+ mutating: false,
16
+ params,
17
+ result: Roster
18
+ });
19
+ //#endregion
20
+ export { rosterGetMethod };
21
+
22
+ //# sourceMappingURL=get.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get.js","names":[],"sources":["../../../src/methods/roster/get.ts"],"sourcesContent":["import * as z from \"zod\";\nimport { ArtifactRef } from \"../../artifact.ts\";\nimport { defineMethod, type MethodDefinition } from \"../../method.ts\";\nimport { Roster } from \"../../team.ts\";\nimport { wireRegistry } from \"../../wire-registry.ts\";\n\n/** The params of `roster/get` (INTERFACES §6, D168). */\nexport interface RosterGetParams {\n /** The artifact. */\n readonly artifact: ArtifactRef;\n}\n\n/** The result of `roster/get`: the whole roster, whatever the visibility policy (CO-07). */\nexport type RosterGetResult = Roster;\n\nconst params: z.ZodType<RosterGetParams> = z\n .object({ artifact: ArtifactRef })\n .register(wireRegistry, { id: \"RosterGetParams\" });\n\n/**\n * `roster/get`: every expected respondent with their status in the current round (CO-03), the\n * round, whether it is complete and its counts. Agents and hosts always read all of it (CO-07).\n */\nexport const rosterGetMethod: MethodDefinition<RosterGetParams, RosterGetResult> = defineMethod({\n method: \"roster/get\",\n direction: \"client-to-instance\",\n mutating: false,\n params,\n result: Roster,\n});\n"],"mappings":";;;;;;AAeA,MAAM,SAAqC,EACxC,OAAO,EAAE,UAAU,YAAY,CAAC,CAAC,CACjC,SAAS,cAAc,EAAE,IAAI,kBAAkB,CAAC;;;;;AAMnD,MAAa,kBAAsE,aAAa;CAC9F,QAAQ;CACR,WAAW;CACX,UAAU;CACV;CACA,QAAQ;AACV,CAAC"}
@@ -0,0 +1,28 @@
1
+ import { Roster } from "../../team.js";
2
+ import { ArtifactRef } from "../../artifact.js";
3
+ import { MethodDefinition } from "../../method.js";
4
+ //#region src/methods/roster/remove.d.ts
5
+ /** The params of `roster/remove` (INTERFACES §6, D168). */
6
+ export interface RosterRemoveParams {
7
+ /** The artifact. */
8
+ readonly artifact: ArtifactRef;
9
+ /** The respondents no longer expected, by `ref`; unknown ones are ignored. */
10
+ readonly refs: readonly string[];
11
+ /** Makes retries idempotent (H-03). */
12
+ readonly requestId?: string;
13
+ }
14
+ /** The result of `roster/remove`. */
15
+ export interface RosterRemoveResult {
16
+ /** The roster after the change. */
17
+ readonly roster: Roster;
18
+ /** The refs that were on the roster and left it. */
19
+ readonly removed: readonly string[];
20
+ }
21
+ /**
22
+ * `roster/remove`: stops expecting answers from people (D168). Their personal links keep working
23
+ * until revoked (`view/revoke`), and their drafts and submissions stay. Appends `roster.changed`,
24
+ * and `roster.completed` when everyone still expected has answered.
25
+ */
26
+ export declare const rosterRemoveMethod: MethodDefinition<RosterRemoveParams, RosterRemoveResult>;
27
+ //#endregion
28
+ //# sourceMappingURL=remove.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"remove.d.ts","names":[],"sources":["../../../src/methods/roster/remove.ts"],"mappings":";;;;;iBAOiB;;WAEN,UAAU;;WAEV;;WAEA;;;iBAIM;;WAEN,QAAQ;;WAER;;;;;;;qBAoBE,oBAAoB,iBAAiB,oBAAoB"}
@@ -0,0 +1,31 @@
1
+ import { wireRegistry } from "../../wire-registry.js";
2
+ import { ArtifactRef } from "../../artifact.js";
3
+ import { defineMethod } from "../../method.js";
4
+ import { ROSTER_MAX, Roster } from "../../team.js";
5
+ import * as z from "zod";
6
+ //#region src/methods/roster/remove.ts
7
+ const params = z.object({
8
+ artifact: ArtifactRef,
9
+ refs: z.array(z.string().min(1).max(256)).min(1).max(ROSTER_MAX).readonly(),
10
+ requestId: z.string().min(1).exactOptional()
11
+ }).register(wireRegistry, { id: "RosterRemoveParams" });
12
+ const result = z.object({
13
+ roster: Roster,
14
+ removed: z.array(z.string()).readonly()
15
+ }).register(wireRegistry, { id: "RosterRemoveResult" });
16
+ /**
17
+ * `roster/remove`: stops expecting answers from people (D168). Their personal links keep working
18
+ * until revoked (`view/revoke`), and their drafts and submissions stay. Appends `roster.changed`,
19
+ * and `roster.completed` when everyone still expected has answered.
20
+ */
21
+ const rosterRemoveMethod = defineMethod({
22
+ method: "roster/remove",
23
+ direction: "client-to-instance",
24
+ mutating: true,
25
+ params,
26
+ result
27
+ });
28
+ //#endregion
29
+ export { rosterRemoveMethod };
30
+
31
+ //# sourceMappingURL=remove.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"remove.js","names":[],"sources":["../../../src/methods/roster/remove.ts"],"sourcesContent":["import * as z from \"zod\";\nimport { ArtifactRef } from \"../../artifact.ts\";\nimport { defineMethod, type MethodDefinition } from \"../../method.ts\";\nimport { ROSTER_MAX, Roster } from \"../../team.ts\";\nimport { wireRegistry } from \"../../wire-registry.ts\";\n\n/** The params of `roster/remove` (INTERFACES §6, D168). */\nexport interface RosterRemoveParams {\n /** The artifact. */\n readonly artifact: ArtifactRef;\n /** The respondents no longer expected, by `ref`; unknown ones are ignored. */\n readonly refs: readonly string[];\n /** Makes retries idempotent (H-03). */\n readonly requestId?: string;\n}\n\n/** The result of `roster/remove`. */\nexport interface RosterRemoveResult {\n /** The roster after the change. */\n readonly roster: Roster;\n /** The refs that were on the roster and left it. */\n readonly removed: readonly string[];\n}\n\nconst params: z.ZodType<RosterRemoveParams> = z\n .object({\n artifact: ArtifactRef,\n refs: z.array(z.string().min(1).max(256)).min(1).max(ROSTER_MAX).readonly(),\n requestId: z.string().min(1).exactOptional(),\n })\n .register(wireRegistry, { id: \"RosterRemoveParams\" });\n\nconst result: z.ZodType<RosterRemoveResult> = z\n .object({ roster: Roster, removed: z.array(z.string()).readonly() })\n .register(wireRegistry, { id: \"RosterRemoveResult\" });\n\n/**\n * `roster/remove`: stops expecting answers from people (D168). Their personal links keep working\n * until revoked (`view/revoke`), and their drafts and submissions stay. Appends `roster.changed`,\n * and `roster.completed` when everyone still expected has answered.\n */\nexport const rosterRemoveMethod: MethodDefinition<RosterRemoveParams, RosterRemoveResult> =\n defineMethod({\n method: \"roster/remove\",\n direction: \"client-to-instance\",\n mutating: true,\n params,\n result,\n });\n"],"mappings":";;;;;;AAwBA,MAAM,SAAwC,EAC3C,OAAO;CACN,UAAU;CACV,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,UAAU,CAAC,CAAC,SAAS;CAC1E,WAAW,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,cAAc;AAC7C,CAAC,CAAC,CACD,SAAS,cAAc,EAAE,IAAI,qBAAqB,CAAC;AAEtD,MAAM,SAAwC,EAC3C,OAAO;CAAE,QAAQ;CAAQ,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,SAAS;AAAE,CAAC,CAAC,CACnE,SAAS,cAAc,EAAE,IAAI,qBAAqB,CAAC;;;;;;AAOtD,MAAa,qBACX,aAAa;CACX,QAAQ;CACR,WAAW;CACX,UAAU;CACV;CACA;AACF,CAAC"}
@@ -1,8 +1,10 @@
1
1
  import { Duration } from "../../duration.js";
2
- import { ArtifactRef } from "../../artifact.js";
3
2
  import { ViewerSpec } from "../../interaction.js";
3
+ import { RespondentSpec } from "../../team.js";
4
+ import { ArtifactRef } from "../../artifact.js";
4
5
  import { CapabilityScope } from "../../capability.js";
5
6
  import { MethodDefinition } from "../../method.js";
7
+ import { RespondentLink } from "../roster/add.js";
6
8
  import * as z from "zod";
7
9
  //#region src/methods/share/start.d.ts
8
10
  /**
@@ -37,6 +39,13 @@ export interface ShareStartParams {
37
39
  * port names, else the link's own viewer, never the home's local user (D158).
38
40
  */
39
41
  readonly viewer?: ViewerSpec;
42
+ /**
43
+ * People the artifact expects answers from through this share (D121, D168): they join the
44
+ * roster of the home that holds the artifact's viewers (a remote share's hosted home), and each
45
+ * gets a personal link at the share's address. On a remote server, `email` reaches the operator's
46
+ * `invitations` port. Not with `viewer`.
47
+ */
48
+ readonly respondents?: readonly RespondentSpec[];
40
49
  /** Makes retries idempotent: a repeated `requestId` returns the same share (H-03). */
41
50
  readonly requestId?: string;
42
51
  }
@@ -84,9 +93,13 @@ export interface Share {
84
93
  }
85
94
  /** The Zod schema of the `Share` type. */
86
95
  export declare const Share: z.ZodType<Share>;
87
- /** The result of `share/start`: the share, with its link. */
96
+ /**
97
+ * The result of `share/start`: the share, with its link, and the personal link of every respondent
98
+ * it named (D168).
99
+ */
88
100
  export type ShareStartResult = Share & {
89
101
  readonly url: string;
102
+ readonly respondents?: readonly RespondentLink[];
90
103
  };
91
104
  /**
92
105
  * `share/start`: shares an artifact through a tunnel the instance drives (D158): Tailscale Serve
@@ -1 +1 @@
1
- {"version":3,"file":"start.d.ts","names":[],"sources":["../../../src/methods/share/start.ts"],"mappings":";;;;;;;;;;;;YAcY;;qBAGC,UAAU,EAAE,QAAQ;;qBASpB;;qBAGA,0BAA0B;;iBAGtB;;WAEN,UAAU;;WAEV,KAAK;;WAEL;;;;;WAKA,MAAM;;WAEN,kBAAkB;;;;;WAKlB,SAAS;;WAET;;;iBAIM;;WAEN;;WAEA;;WAEA,KAAK;;;;;WAKL;;WAEA;;;;;WAKA;;;;;WAKA;;WAEA;;WAEA;;WAEA;;WAEA;;WAEA;;;;;;WAMA;;;qBAoBE,OAAO,EAAE,QAAQ;;YAMlB,mBAAmB;WAAmB;;;;;;;;qBA8BrC,kBAAkB,iBAAiB,kBAAkB"}
1
+ {"version":3,"file":"start.d.ts","names":[],"sources":["../../../src/methods/share/start.ts"],"mappings":";;;;;;;;;;;;;;YAgBY;;qBAGC,UAAU,EAAE,QAAQ;;qBASpB;;qBAGA,0BAA0B;;iBAGtB;;WAEN,UAAU;;WAEV,KAAK;;WAEL;;;;;WAKA,MAAM;;WAEN,kBAAkB;;;;;WAKlB,SAAS;;;;;;;WAOT,uBAAuB;;WAEvB;;;iBAIM;;WAEN;;WAEA;;WAEA,KAAK;;;;;WAKL;;WAEA;;;;;WAKA;;;;;WAKA;;WAEA;;WAEA;;WAEA;;WAEA;;WAEA;;;;;;WAMA;;;qBAoBE,OAAO,EAAE,QAAQ;;;;;YASlB,mBAAmB;WACpB;WACA,uBAAuB;;;;;;;;qBAoCrB,kBAAkB,iBAAiB,kBAAkB"}
@@ -5,6 +5,8 @@ import { ArtifactRef } from "../../artifact.js";
5
5
  import { ViewerSpec } from "../../interaction.js";
6
6
  import { CapabilityScope } from "../../capability.js";
7
7
  import { defineMethod } from "../../method.js";
8
+ import { ROSTER_MAX, RespondentSpec } from "../../team.js";
9
+ import { RespondentLink } from "../roster/add.js";
8
10
  import * as z from "zod";
9
11
  //#region src/methods/share/start.ts
10
12
  /** The Zod schema of the `ShareVia` type. */
@@ -48,11 +50,13 @@ const params = z.object({
48
50
  ttl: Duration.exactOptional(),
49
51
  scopes: z.array(CapabilityScope).min(1).readonly().exactOptional(),
50
52
  viewer: ViewerSpec.exactOptional(),
53
+ respondents: z.array(RespondentSpec).min(1).max(ROSTER_MAX).readonly().exactOptional(),
51
54
  requestId: z.string().min(1).exactOptional()
52
55
  }).register(wireRegistry, { id: "ShareStartParams" });
53
56
  const result = z.object({
54
57
  ...shareShape,
55
- url: z.string().min(1)
58
+ url: z.string().min(1),
59
+ respondents: z.array(RespondentLink).readonly().exactOptional()
56
60
  }).register(wireRegistry, {
57
61
  id: "ShareStartResult",
58
62
  description: "The share that started, with its capability URL."
@@ -1 +1 @@
1
- {"version":3,"file":"start.js","names":[],"sources":["../../../src/methods/share/start.ts"],"sourcesContent":["import * as z from \"zod\";\nimport { ArtifactRef } from \"../../artifact.ts\";\nimport { CapabilityScope } from \"../../capability.ts\";\nimport { Duration } from \"../../duration.ts\";\nimport { ArtifactId, ShareId, TokenId } from \"../../ids.ts\";\nimport { ViewerSpec } from \"../../interaction.ts\";\nimport { defineMethod, type MethodDefinition } from \"../../method.ts\";\nimport { wireRegistry } from \"../../wire-registry.ts\";\n\n/**\n * How a share reaches its viewers (D158): `tailnet` through Tailscale Serve, to the people of the\n * user's tailnet, who are known by name; `funnel` through Tailscale Funnel and `cloudflare`\n * through a Cloudflare quick tunnel, both public, where the link is all that admits a viewer.\n */\nexport type ShareVia = \"tailnet\" | \"funnel\" | \"cloudflare\" | \"remote\";\n\n/** The Zod schema of the `ShareVia` type. */\nexport const ShareVia: z.ZodType<ShareVia> = z\n .enum([\"tailnet\", \"funnel\", \"cloudflare\", \"remote\"])\n .register(wireRegistry, {\n id: \"ShareVia\",\n description:\n \"How a share reaches its viewers: tailnet, funnel or cloudflare, or remote: hosted on a remote server (D165).\",\n });\n\n/** The longest a public share (Funnel or Cloudflare) may last: 7 days (D158). */\nexport const PUBLIC_SHARE_MAX_TTL_MS: number = 7 * 24 * 60 * 60 * 1000;\n\n/** How long a public share lasts when its `ttl` isn't given: 1 hour (D63 item 5, D158). */\nexport const PUBLIC_SHARE_DEFAULT_TTL: Duration = \"1h\";\n\n/** The params of `share/start` (INTERFACES §6, D158). */\nexport interface ShareStartParams {\n /** The artifact to share; the link opens its latest version. */\n readonly artifact: ArtifactRef;\n /** The tunnel. A public one (`funnel`, `cloudflare`) is explicit: never a fallback. */\n readonly via: ShareVia;\n /** For `remote`: the server's API origin. Default: the home's default server (D165 item 15). */\n readonly server?: string;\n /**\n * How long the share and its link last, such as `30m` or `24h`. Public shares: 1 hour by\n * default, at most 7 days. Tailnet shares: until stopped, unless given.\n */\n readonly ttl?: Duration;\n /** What the share's link allows (D97). Default: every scope. */\n readonly scopes?: readonly CapabilityScope[];\n /**\n * The person the share's link acts for (D104). Absent: whoever the tailnet or a host's identity\n * port names, else the link's own viewer, never the home's local user (D158).\n */\n readonly viewer?: ViewerSpec;\n /** Makes retries idempotent: a repeated `requestId` returns the same share (H-03). */\n readonly requestId?: string;\n}\n\n/** A share, as `share/start` and `share/list` report it. */\nexport interface Share {\n /** The share's ID, for `share/stop`. */\n readonly shareId: string;\n /** The artifact shared. */\n readonly artifactId: string;\n /** The tunnel. */\n readonly via: ShareVia;\n /**\n * The share's capability URL, at the tunnel's address. Holding it is the authorization (D06);\n * absent once the share ended, and in `share/list` when the home's key can no longer show it.\n */\n readonly url?: string;\n /** The tunnel's host name: the tailnet device's, or the quick tunnel's random one. */\n readonly hostname: string;\n /**\n * The address the artifact's frame is served at over the tunnel, while the share is active:\n * on a tailnet, the second port of this device that viewers must be allowed to reach.\n */\n readonly artifactOrigin?: string;\n /**\n * How the artifact's frame authenticates over this tunnel (D70): `cookie` where the shell and\n * the artifact are one site (Tailscale), `worker` where they are two (Cloudflare).\n */\n readonly mode: \"cookie\" | \"worker\";\n /** The share's link, for `view/rotate` and `view/revoke`. */\n readonly tokenId: string;\n /** When the share started (RFC 3339, UTC). */\n readonly startedAt: string;\n /** When the share and its link end, if they do. */\n readonly expiresAt?: string;\n /** `active` while it serves; `stopped` once it ended. */\n readonly state: \"active\" | \"stopped\";\n /** When it ended. */\n readonly stoppedAt?: string;\n /**\n * Why it ended: `stopped` (`share/stop`), `expired` (its TTL), `tunnel` (its tunnel ended and\n * couldn't be set up again), `restart` (a quick tunnel can't outlive its instance), or\n * `revoked` (its link was revoked).\n */\n readonly stopReason?: \"stopped\" | \"expired\" | \"tunnel\" | \"restart\" | \"revoked\" | (string & {});\n}\n\nconst shareShape = {\n shareId: ShareId.schema,\n artifactId: ArtifactId.schema,\n via: ShareVia,\n url: z.string().min(1).exactOptional(),\n hostname: z.string().min(1),\n artifactOrigin: z.string().min(1).exactOptional(),\n mode: z.enum([\"cookie\", \"worker\"]),\n tokenId: TokenId.schema,\n startedAt: z.iso.datetime(),\n expiresAt: z.iso.datetime().exactOptional(),\n state: z.enum([\"active\", \"stopped\"]),\n stoppedAt: z.iso.datetime().exactOptional(),\n stopReason: z.string().min(1).exactOptional(),\n};\n\n/** The Zod schema of the `Share` type. */\nexport const Share: z.ZodType<Share> = z.object(shareShape).register(wireRegistry, {\n id: \"Share\",\n description: \"A share: its tunnel, link, address, frame mode and lifetime.\",\n});\n\n/** The result of `share/start`: the share, with its link. */\nexport type ShareStartResult = Share & { readonly url: string };\n\nconst params: z.ZodType<ShareStartParams> = z\n .object({\n artifact: ArtifactRef,\n via: ShareVia,\n server: z\n .string()\n .regex(/^https?:\\/\\/[^/?#\\s]+$/)\n .exactOptional(),\n ttl: Duration.exactOptional(),\n scopes: z.array(CapabilityScope).min(1).readonly().exactOptional(),\n viewer: ViewerSpec.exactOptional(),\n requestId: z.string().min(1).exactOptional(),\n })\n .register(wireRegistry, { id: \"ShareStartParams\" });\n\nconst result: z.ZodType<ShareStartResult> = z\n .object({ ...shareShape, url: z.string().min(1) })\n .register(wireRegistry, {\n id: \"ShareStartResult\",\n description: \"The share that started, with its capability URL.\",\n });\n\n/**\n * `share/start`: shares an artifact through a tunnel the instance drives (D158): Tailscale Serve\n * for the tailnet, or Tailscale Funnel or a Cloudflare quick tunnel for anyone with the link. It\n * answers once the tunnel serves, with a new link at the tunnel's address that works there only.\n * A missing or unready tool is a `MOSTRA_SHARE_*` diagnostic saying what to do.\n */\nexport const shareStartMethod: MethodDefinition<ShareStartParams, ShareStartResult> = defineMethod({\n method: \"share/start\",\n direction: \"client-to-instance\",\n mutating: true,\n params,\n result,\n});\n"],"mappings":";;;;;;;;;;AAiBA,MAAa,WAAgC,EAC1C,KAAK;CAAC;CAAW;CAAU;CAAc;AAAQ,CAAC,CAAC,CACnD,SAAS,cAAc;CACtB,IAAI;CACJ,aACE;AACJ,CAAC;;AAGH,MAAa,0BAAkC;;AAG/C,MAAa,2BAAqC;AAqElD,MAAM,aAAa;CACjB,SAAS,QAAQ;CACjB,YAAY,WAAW;CACvB,KAAK;CACL,KAAK,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,cAAc;CACrC,UAAU,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC;CAC1B,gBAAgB,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,cAAc;CAChD,MAAM,EAAE,KAAK,CAAC,UAAU,QAAQ,CAAC;CACjC,SAAS,QAAQ;CACjB,WAAW,EAAE,IAAI,SAAS;CAC1B,WAAW,EAAE,IAAI,SAAS,CAAC,CAAC,cAAc;CAC1C,OAAO,EAAE,KAAK,CAAC,UAAU,SAAS,CAAC;CACnC,WAAW,EAAE,IAAI,SAAS,CAAC,CAAC,cAAc;CAC1C,YAAY,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,cAAc;AAC9C;;AAGA,MAAa,QAA0B,EAAE,OAAO,UAAU,CAAC,CAAC,SAAS,cAAc;CACjF,IAAI;CACJ,aAAa;AACf,CAAC;AAKD,MAAM,SAAsC,EACzC,OAAO;CACN,UAAU;CACV,KAAK;CACL,QAAQ,EACL,OAAO,CAAC,CACR,MAAM,wBAAwB,CAAC,CAC/B,cAAc;CACjB,KAAK,SAAS,cAAc;CAC5B,QAAQ,EAAE,MAAM,eAAe,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,cAAc;CACjE,QAAQ,WAAW,cAAc;CACjC,WAAW,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,cAAc;AAC7C,CAAC,CAAC,CACD,SAAS,cAAc,EAAE,IAAI,mBAAmB,CAAC;AAEpD,MAAM,SAAsC,EACzC,OAAO;CAAE,GAAG;CAAY,KAAK,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC;AAAE,CAAC,CAAC,CACjD,SAAS,cAAc;CACtB,IAAI;CACJ,aAAa;AACf,CAAC;;;;;;;AAQH,MAAa,mBAAyE,aAAa;CACjG,QAAQ;CACR,WAAW;CACX,UAAU;CACV;CACA;AACF,CAAC"}
1
+ {"version":3,"file":"start.js","names":[],"sources":["../../../src/methods/share/start.ts"],"sourcesContent":["import * as z from \"zod\";\nimport { ArtifactRef } from \"../../artifact.ts\";\nimport { CapabilityScope } from \"../../capability.ts\";\nimport { Duration } from \"../../duration.ts\";\nimport { ArtifactId, ShareId, TokenId } from \"../../ids.ts\";\nimport { ViewerSpec } from \"../../interaction.ts\";\nimport { defineMethod, type MethodDefinition } from \"../../method.ts\";\nimport { RespondentSpec, ROSTER_MAX } from \"../../team.ts\";\nimport { wireRegistry } from \"../../wire-registry.ts\";\nimport { RespondentLink } from \"../roster/add.ts\";\n\n/**\n * How a share reaches its viewers (D158): `tailnet` through Tailscale Serve, to the people of the\n * user's tailnet, who are known by name; `funnel` through Tailscale Funnel and `cloudflare`\n * through a Cloudflare quick tunnel, both public, where the link is all that admits a viewer.\n */\nexport type ShareVia = \"tailnet\" | \"funnel\" | \"cloudflare\" | \"remote\";\n\n/** The Zod schema of the `ShareVia` type. */\nexport const ShareVia: z.ZodType<ShareVia> = z\n .enum([\"tailnet\", \"funnel\", \"cloudflare\", \"remote\"])\n .register(wireRegistry, {\n id: \"ShareVia\",\n description:\n \"How a share reaches its viewers: tailnet, funnel or cloudflare, or remote: hosted on a remote server (D165).\",\n });\n\n/** The longest a public share (Funnel or Cloudflare) may last: 7 days (D158). */\nexport const PUBLIC_SHARE_MAX_TTL_MS: number = 7 * 24 * 60 * 60 * 1000;\n\n/** How long a public share lasts when its `ttl` isn't given: 1 hour (D63 item 5, D158). */\nexport const PUBLIC_SHARE_DEFAULT_TTL: Duration = \"1h\";\n\n/** The params of `share/start` (INTERFACES §6, D158). */\nexport interface ShareStartParams {\n /** The artifact to share; the link opens its latest version. */\n readonly artifact: ArtifactRef;\n /** The tunnel. A public one (`funnel`, `cloudflare`) is explicit: never a fallback. */\n readonly via: ShareVia;\n /** For `remote`: the server's API origin. Default: the home's default server (D165 item 15). */\n readonly server?: string;\n /**\n * How long the share and its link last, such as `30m` or `24h`. Public shares: 1 hour by\n * default, at most 7 days. Tailnet shares: until stopped, unless given.\n */\n readonly ttl?: Duration;\n /** What the share's link allows (D97). Default: every scope. */\n readonly scopes?: readonly CapabilityScope[];\n /**\n * The person the share's link acts for (D104). Absent: whoever the tailnet or a host's identity\n * port names, else the link's own viewer, never the home's local user (D158).\n */\n readonly viewer?: ViewerSpec;\n /**\n * People the artifact expects answers from through this share (D121, D168): they join the\n * roster of the home that holds the artifact's viewers (a remote share's hosted home), and each\n * gets a personal link at the share's address. On a remote server, `email` reaches the operator's\n * `invitations` port. Not with `viewer`.\n */\n readonly respondents?: readonly RespondentSpec[];\n /** Makes retries idempotent: a repeated `requestId` returns the same share (H-03). */\n readonly requestId?: string;\n}\n\n/** A share, as `share/start` and `share/list` report it. */\nexport interface Share {\n /** The share's ID, for `share/stop`. */\n readonly shareId: string;\n /** The artifact shared. */\n readonly artifactId: string;\n /** The tunnel. */\n readonly via: ShareVia;\n /**\n * The share's capability URL, at the tunnel's address. Holding it is the authorization (D06);\n * absent once the share ended, and in `share/list` when the home's key can no longer show it.\n */\n readonly url?: string;\n /** The tunnel's host name: the tailnet device's, or the quick tunnel's random one. */\n readonly hostname: string;\n /**\n * The address the artifact's frame is served at over the tunnel, while the share is active:\n * on a tailnet, the second port of this device that viewers must be allowed to reach.\n */\n readonly artifactOrigin?: string;\n /**\n * How the artifact's frame authenticates over this tunnel (D70): `cookie` where the shell and\n * the artifact are one site (Tailscale), `worker` where they are two (Cloudflare).\n */\n readonly mode: \"cookie\" | \"worker\";\n /** The share's link, for `view/rotate` and `view/revoke`. */\n readonly tokenId: string;\n /** When the share started (RFC 3339, UTC). */\n readonly startedAt: string;\n /** When the share and its link end, if they do. */\n readonly expiresAt?: string;\n /** `active` while it serves; `stopped` once it ended. */\n readonly state: \"active\" | \"stopped\";\n /** When it ended. */\n readonly stoppedAt?: string;\n /**\n * Why it ended: `stopped` (`share/stop`), `expired` (its TTL), `tunnel` (its tunnel ended and\n * couldn't be set up again), `restart` (a quick tunnel can't outlive its instance), or\n * `revoked` (its link was revoked).\n */\n readonly stopReason?: \"stopped\" | \"expired\" | \"tunnel\" | \"restart\" | \"revoked\" | (string & {});\n}\n\nconst shareShape = {\n shareId: ShareId.schema,\n artifactId: ArtifactId.schema,\n via: ShareVia,\n url: z.string().min(1).exactOptional(),\n hostname: z.string().min(1),\n artifactOrigin: z.string().min(1).exactOptional(),\n mode: z.enum([\"cookie\", \"worker\"]),\n tokenId: TokenId.schema,\n startedAt: z.iso.datetime(),\n expiresAt: z.iso.datetime().exactOptional(),\n state: z.enum([\"active\", \"stopped\"]),\n stoppedAt: z.iso.datetime().exactOptional(),\n stopReason: z.string().min(1).exactOptional(),\n};\n\n/** The Zod schema of the `Share` type. */\nexport const Share: z.ZodType<Share> = z.object(shareShape).register(wireRegistry, {\n id: \"Share\",\n description: \"A share: its tunnel, link, address, frame mode and lifetime.\",\n});\n\n/**\n * The result of `share/start`: the share, with its link, and the personal link of every respondent\n * it named (D168).\n */\nexport type ShareStartResult = Share & {\n readonly url: string;\n readonly respondents?: readonly RespondentLink[];\n};\n\nconst params: z.ZodType<ShareStartParams> = z\n .object({\n artifact: ArtifactRef,\n via: ShareVia,\n server: z\n .string()\n .regex(/^https?:\\/\\/[^/?#\\s]+$/)\n .exactOptional(),\n ttl: Duration.exactOptional(),\n scopes: z.array(CapabilityScope).min(1).readonly().exactOptional(),\n viewer: ViewerSpec.exactOptional(),\n respondents: z.array(RespondentSpec).min(1).max(ROSTER_MAX).readonly().exactOptional(),\n requestId: z.string().min(1).exactOptional(),\n })\n .register(wireRegistry, { id: \"ShareStartParams\" });\n\nconst result: z.ZodType<ShareStartResult> = z\n .object({\n ...shareShape,\n url: z.string().min(1),\n respondents: z.array(RespondentLink).readonly().exactOptional(),\n })\n .register(wireRegistry, {\n id: \"ShareStartResult\",\n description: \"The share that started, with its capability URL.\",\n });\n\n/**\n * `share/start`: shares an artifact through a tunnel the instance drives (D158): Tailscale Serve\n * for the tailnet, or Tailscale Funnel or a Cloudflare quick tunnel for anyone with the link. It\n * answers once the tunnel serves, with a new link at the tunnel's address that works there only.\n * A missing or unready tool is a `MOSTRA_SHARE_*` diagnostic saying what to do.\n */\nexport const shareStartMethod: MethodDefinition<ShareStartParams, ShareStartResult> = defineMethod({\n method: \"share/start\",\n direction: \"client-to-instance\",\n mutating: true,\n params,\n result,\n});\n"],"mappings":";;;;;;;;;;;;AAmBA,MAAa,WAAgC,EAC1C,KAAK;CAAC;CAAW;CAAU;CAAc;AAAQ,CAAC,CAAC,CACnD,SAAS,cAAc;CACtB,IAAI;CACJ,aACE;AACJ,CAAC;;AAGH,MAAa,0BAAkC;;AAG/C,MAAa,2BAAqC;AA4ElD,MAAM,aAAa;CACjB,SAAS,QAAQ;CACjB,YAAY,WAAW;CACvB,KAAK;CACL,KAAK,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,cAAc;CACrC,UAAU,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC;CAC1B,gBAAgB,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,cAAc;CAChD,MAAM,EAAE,KAAK,CAAC,UAAU,QAAQ,CAAC;CACjC,SAAS,QAAQ;CACjB,WAAW,EAAE,IAAI,SAAS;CAC1B,WAAW,EAAE,IAAI,SAAS,CAAC,CAAC,cAAc;CAC1C,OAAO,EAAE,KAAK,CAAC,UAAU,SAAS,CAAC;CACnC,WAAW,EAAE,IAAI,SAAS,CAAC,CAAC,cAAc;CAC1C,YAAY,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,cAAc;AAC9C;;AAGA,MAAa,QAA0B,EAAE,OAAO,UAAU,CAAC,CAAC,SAAS,cAAc;CACjF,IAAI;CACJ,aAAa;AACf,CAAC;AAWD,MAAM,SAAsC,EACzC,OAAO;CACN,UAAU;CACV,KAAK;CACL,QAAQ,EACL,OAAO,CAAC,CACR,MAAM,wBAAwB,CAAC,CAC/B,cAAc;CACjB,KAAK,SAAS,cAAc;CAC5B,QAAQ,EAAE,MAAM,eAAe,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,cAAc;CACjE,QAAQ,WAAW,cAAc;CACjC,aAAa,EAAE,MAAM,cAAc,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,UAAU,CAAC,CAAC,SAAS,CAAC,CAAC,cAAc;CACrF,WAAW,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,cAAc;AAC7C,CAAC,CAAC,CACD,SAAS,cAAc,EAAE,IAAI,mBAAmB,CAAC;AAEpD,MAAM,SAAsC,EACzC,OAAO;CACN,GAAG;CACH,KAAK,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC;CACrB,aAAa,EAAE,MAAM,cAAc,CAAC,CAAC,SAAS,CAAC,CAAC,cAAc;AAChE,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"}
@@ -1,5 +1,5 @@
1
- import { ArtifactRef } from "../../artifact.js";
2
1
  import { DocumentRevision, FieldState } from "../../interaction.js";
2
+ import { ArtifactRef } from "../../artifact.js";
3
3
  import { MethodDefinition } from "../../method.js";
4
4
  //#region src/methods/state/get.d.ts
5
5
  /** The params of `state/get` (INTERFACES §6, D63). */
@@ -1,5 +1,5 @@
1
- import { ArtifactRef } from "../../artifact.js";
2
1
  import { DocumentRevision, FieldOp, MutationResult } from "../../interaction.js";
2
+ import { ArtifactRef } from "../../artifact.js";
3
3
  import { MethodDefinition } from "../../method.js";
4
4
  //#region src/methods/state/patch.d.ts
5
5
  /** The params of `state/patch` (INTERFACES §6, D63, D106). */
@@ -1,6 +1,6 @@
1
1
  import { Duration } from "../../duration.js";
2
- import { ArtifactRef } from "../../artifact.js";
3
2
  import { Viewer, ViewerSpec } from "../../interaction.js";
3
+ import { ArtifactRef } from "../../artifact.js";
4
4
  import { CapabilityScope } from "../../capability.js";
5
5
  import { MethodDefinition } from "../../method.js";
6
6
  import * as z from "zod";
@@ -1,5 +1,5 @@
1
- import { ArtifactRef } from "../../artifact.js";
2
1
  import { EventRecord, WaitCondition } from "../../interaction.js";
2
+ import { ArtifactRef } from "../../artifact.js";
3
3
  import { MethodDefinition } from "../../method.js";
4
4
  //#region src/methods/wait/wait.d.ts
5
5
  /** The longest `wait`, in milliseconds: the longest timer JavaScript keeps (about 24.8 days). */