@mostra/protocol 0.9.0 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/actions.d.ts +30 -4
- package/dist/actions.d.ts.map +1 -1
- package/dist/actions.js +14 -4
- package/dist/actions.js.map +1 -1
- package/dist/artifact.d.ts +2 -1
- package/dist/artifact.d.ts.map +1 -1
- package/dist/artifact.js +2 -1
- package/dist/artifact.js.map +1 -1
- package/dist/browser.d.ts +47 -0
- package/dist/browser.d.ts.map +1 -1
- package/dist/browser.js +36 -3
- package/dist/browser.js.map +1 -1
- package/dist/capability.d.ts +0 -9
- package/dist/capability.d.ts.map +1 -1
- package/dist/capability.js +1 -17
- package/dist/capability.js.map +1 -1
- package/dist/diagnostics/codes/action.d.ts +1 -1
- package/dist/diagnostics/codes/action.d.ts.map +1 -1
- package/dist/diagnostics/codes/action.js +12 -1
- package/dist/diagnostics/codes/action.js.map +1 -1
- package/dist/diagnostics/codes/artifact.d.ts +1 -1
- package/dist/diagnostics/codes/artifact.d.ts.map +1 -1
- package/dist/diagnostics/codes/artifact.js +12 -1
- package/dist/diagnostics/codes/artifact.js.map +1 -1
- package/dist/diagnostics/codes/home.d.ts +1 -1
- package/dist/diagnostics/codes/home.d.ts.map +1 -1
- package/dist/diagnostics/codes/home.js +12 -1
- package/dist/diagnostics/codes/home.js.map +1 -1
- package/dist/diagnostics/codes/index.d.ts +3 -2
- package/dist/diagnostics/codes/index.d.ts.map +1 -1
- package/dist/diagnostics/codes/index.js +3 -1
- package/dist/diagnostics/codes/index.js.map +1 -1
- package/dist/diagnostics/codes/remote.d.ts +8 -0
- package/dist/diagnostics/codes/remote.d.ts.map +1 -0
- package/dist/diagnostics/codes/remote.js +176 -0
- package/dist/diagnostics/codes/remote.js.map +1 -0
- package/dist/diagnostics/codes/submit.d.ts +1 -1
- package/dist/diagnostics/codes/submit.d.ts.map +1 -1
- package/dist/diagnostics/codes/submit.js +12 -1
- package/dist/diagnostics/codes/submit.js.map +1 -1
- package/dist/diagnostics/diagnostic.d.ts +1 -1
- package/dist/diagnostics/diagnostic.d.ts.map +1 -1
- package/dist/diagnostics/diagnostic.js +2 -1
- package/dist/diagnostics/diagnostic.js.map +1 -1
- package/dist/duration.d.ts +13 -0
- package/dist/duration.d.ts.map +1 -0
- package/dist/duration.js +27 -0
- package/dist/duration.js.map +1 -0
- package/dist/ids.d.ts +17 -1
- package/dist/ids.d.ts.map +1 -1
- package/dist/ids.js +9 -1
- package/dist/ids.js.map +1 -1
- package/dist/index.d.ts +33 -8
- package/dist/index.js +33 -8
- package/dist/interaction.d.ts +33 -2
- package/dist/interaction.d.ts.map +1 -1
- package/dist/interaction.js +22 -6
- package/dist/interaction.js.map +1 -1
- package/dist/manifest.d.ts +59 -14
- package/dist/manifest.d.ts.map +1 -1
- package/dist/manifest.js +63 -15
- package/dist/manifest.js.map +1 -1
- package/dist/methods/artifact/export.d.ts +40 -0
- package/dist/methods/artifact/export.d.ts.map +1 -0
- package/dist/methods/artifact/export.js +36 -0
- package/dist/methods/artifact/export.js.map +1 -0
- package/dist/methods/artifact/import.d.ts +23 -0
- package/dist/methods/artifact/import.d.ts.map +1 -0
- package/dist/methods/artifact/import.js +25 -0
- package/dist/methods/artifact/import.js.map +1 -0
- package/dist/methods/artifact/pause.d.ts +33 -0
- package/dist/methods/artifact/pause.d.ts.map +1 -0
- package/dist/methods/artifact/pause.js +33 -0
- package/dist/methods/artifact/pause.js.map +1 -0
- package/dist/methods/artifact/publish.d.ts +2 -1
- package/dist/methods/artifact/publish.d.ts.map +1 -1
- package/dist/methods/artifact/publish.js +1 -1
- package/dist/methods/hosted/push.d.ts +76 -0
- package/dist/methods/hosted/push.d.ts.map +1 -0
- package/dist/methods/hosted/push.js +71 -0
- package/dist/methods/hosted/push.js.map +1 -0
- package/dist/methods/hosted/submission.d.ts +18 -0
- package/dist/methods/hosted/submission.d.ts.map +1 -0
- package/dist/methods/hosted/submission.js +23 -0
- package/dist/methods/hosted/submission.js.map +1 -0
- package/dist/methods/index.d.ts.map +1 -1
- package/dist/methods/index.js +44 -2
- package/dist/methods/index.js.map +1 -1
- package/dist/methods/instance/status.d.ts +3 -0
- package/dist/methods/instance/status.d.ts.map +1 -1
- package/dist/methods/instance/status.js +3 -1
- package/dist/methods/instance/status.js.map +1 -1
- package/dist/methods/mostra/initialize.d.ts +17 -3
- package/dist/methods/mostra/initialize.d.ts.map +1 -1
- package/dist/methods/mostra/initialize.js +11 -3
- package/dist/methods/mostra/initialize.js.map +1 -1
- package/dist/methods/port/relay-author.d.ts +28 -0
- package/dist/methods/port/relay-author.d.ts.map +1 -0
- package/dist/methods/port/relay-author.js +42 -0
- package/dist/methods/port/relay-author.js.map +1 -0
- package/dist/methods/port/relay-call.d.ts +33 -0
- package/dist/methods/port/relay-call.d.ts.map +1 -0
- package/dist/methods/port/relay-call.js +31 -0
- package/dist/methods/port/relay-call.js.map +1 -0
- package/dist/methods/port/relay-cancel.d.ts +16 -0
- package/dist/methods/port/relay-cancel.d.ts.map +1 -0
- package/dist/methods/port/relay-cancel.js +21 -0
- package/dist/methods/port/relay-cancel.js.map +1 -0
- package/dist/methods/port/relay-live.d.ts +25 -0
- package/dist/methods/port/relay-live.d.ts.map +1 -0
- package/dist/methods/port/relay-live.js +32 -0
- package/dist/methods/port/relay-live.js.map +1 -0
- package/dist/methods/port/relay-reconcile.d.ts +39 -0
- package/dist/methods/port/relay-reconcile.d.ts.map +1 -0
- package/dist/methods/port/relay-reconcile.js +35 -0
- package/dist/methods/port/relay-reconcile.js.map +1 -0
- package/dist/methods/port/relay-run.d.ts +47 -0
- package/dist/methods/port/relay-run.d.ts.map +1 -0
- package/dist/methods/port/relay-run.js +41 -0
- package/dist/methods/port/relay-run.js.map +1 -0
- package/dist/methods/port/submissions-deliver.d.ts +8 -0
- package/dist/methods/port/submissions-deliver.d.ts.map +1 -1
- package/dist/methods/port/submissions-deliver.js +4 -2
- package/dist/methods/port/submissions-deliver.js.map +1 -1
- package/dist/methods/relay/call-batch.d.ts +26 -0
- package/dist/methods/relay/call-batch.d.ts.map +1 -0
- package/dist/methods/relay/call-batch.js +30 -0
- package/dist/methods/relay/call-batch.js.map +1 -0
- package/dist/methods/relay/effect.d.ts +31 -0
- package/dist/methods/relay/effect.d.ts.map +1 -0
- package/dist/methods/relay/effect.js +30 -0
- package/dist/methods/relay/effect.js.map +1 -0
- package/dist/methods/relay/live-value.d.ts +33 -0
- package/dist/methods/relay/live-value.d.ts.map +1 -0
- package/dist/methods/relay/live-value.js +32 -0
- package/dist/methods/relay/live-value.js.map +1 -0
- package/dist/methods/relay/run-update.d.ts +46 -0
- package/dist/methods/relay/run-update.d.ts.map +1 -0
- package/dist/methods/relay/run-update.js +45 -0
- package/dist/methods/relay/run-update.js.map +1 -0
- package/dist/methods/remote/link.d.ts +40 -0
- package/dist/methods/remote/link.d.ts.map +1 -0
- package/dist/methods/remote/link.js +40 -0
- package/dist/methods/remote/link.js.map +1 -0
- package/dist/methods/remote/login-wait.d.ts +30 -0
- package/dist/methods/remote/login-wait.d.ts.map +1 -0
- package/dist/methods/remote/login-wait.js +36 -0
- package/dist/methods/remote/login-wait.js.map +1 -0
- package/dist/methods/remote/login.d.ts +41 -0
- package/dist/methods/remote/login.d.ts.map +1 -0
- package/dist/methods/remote/login.js +37 -0
- package/dist/methods/remote/login.js.map +1 -0
- package/dist/methods/remote/logout.d.ts +25 -0
- package/dist/methods/remote/logout.d.ts.map +1 -0
- package/dist/methods/remote/logout.js +28 -0
- package/dist/methods/remote/logout.js.map +1 -0
- package/dist/methods/remote/status.d.ts +14 -0
- package/dist/methods/remote/status.d.ts.map +1 -0
- package/dist/methods/remote/status.js +22 -0
- package/dist/methods/remote/status.js.map +1 -0
- package/dist/methods/remote/token.d.ts +19 -0
- package/dist/methods/remote/token.d.ts.map +1 -0
- package/dist/methods/remote/token.js +24 -0
- package/dist/methods/remote/token.js.map +1 -0
- package/dist/methods/share/start.d.ts +5 -2
- package/dist/methods/share/start.d.ts.map +1 -1
- package/dist/methods/share/start.js +6 -3
- package/dist/methods/share/start.js.map +1 -1
- package/dist/methods/state/patch.d.ts +7 -0
- package/dist/methods/state/patch.d.ts.map +1 -1
- package/dist/methods/state/patch.js +2 -1
- package/dist/methods/state/patch.js.map +1 -1
- package/dist/methods/view/url.d.ts +2 -1
- package/dist/methods/view/url.d.ts.map +1 -1
- package/dist/methods/view/url.js +2 -1
- package/dist/methods/view/url.js.map +1 -1
- package/dist/operator.d.ts +464 -0
- package/dist/operator.d.ts.map +1 -0
- package/dist/operator.js +134 -0
- package/dist/operator.js.map +1 -0
- package/dist/policy.d.ts +18 -0
- package/dist/policy.d.ts.map +1 -0
- package/dist/policy.js +23 -0
- package/dist/policy.js.map +1 -0
- package/dist/remote.d.ts +55 -0
- package/dist/remote.d.ts.map +1 -0
- package/dist/remote.js +52 -0
- package/dist/remote.js.map +1 -0
- package/dist/view.d.ts +1 -1
- package/dist/view.js +1 -1
- package/dist/view.js.map +1 -1
- package/package.json +12 -2
- package/schemas/protocol.draft-07.json +1839 -99
- package/schemas/protocol.schema.json +1787 -111
- package/src/actions.ts +45 -5
- package/src/browser.ts +70 -0
- package/src/capability.ts +0 -23
- package/src/diagnostics/codes/action.ts +12 -0
- package/src/diagnostics/codes/artifact.ts +12 -0
- package/src/diagnostics/codes/home.ts +12 -0
- package/src/diagnostics/codes/index.ts +6 -2
- package/src/diagnostics/codes/remote.ts +197 -0
- package/src/diagnostics/codes/submit.ts +12 -0
- package/src/diagnostics/diagnostic.ts +3 -1
- package/src/duration.ts +29 -0
- package/src/ids.ts +33 -1
- package/src/index.ts +143 -8
- package/src/interaction.ts +48 -2
- package/src/manifest.ts +115 -24
- package/src/methods/artifact/export.ts +68 -0
- package/src/methods/artifact/import.ts +39 -0
- package/src/methods/artifact/pause.ts +59 -0
- package/src/methods/hosted/push.ts +146 -0
- package/src/methods/hosted/submission.ts +34 -0
- package/src/methods/index.ts +42 -0
- package/src/methods/instance/status.ts +4 -0
- package/src/methods/mostra/initialize.ts +19 -3
- package/src/methods/port/relay-author.ts +57 -0
- package/src/methods/port/relay-call.ts +58 -0
- package/src/methods/port/relay-cancel.ts +33 -0
- package/src/methods/port/relay-live.ts +48 -0
- package/src/methods/port/relay-reconcile.ts +71 -0
- package/src/methods/port/relay-run.ts +80 -0
- package/src/methods/port/submissions-deliver.ts +13 -1
- package/src/methods/relay/call-batch.ts +52 -0
- package/src/methods/relay/effect.ts +55 -0
- package/src/methods/relay/live-value.ts +54 -0
- package/src/methods/relay/run-update.ts +81 -0
- package/src/methods/remote/link.ts +65 -0
- package/src/methods/remote/login-wait.ts +55 -0
- package/src/methods/remote/login.ts +72 -0
- package/src/methods/remote/logout.ts +42 -0
- package/src/methods/remote/status.ts +34 -0
- package/src/methods/remote/token.ts +39 -0
- package/src/methods/share/start.ts +12 -4
- package/src/methods/state/patch.ts +6 -0
- package/src/methods/view/url.ts +2 -1
- package/src/operator.ts +621 -0
- package/src/policy.ts +30 -0
- package/src/remote.ts +89 -0
- package/src/view.ts +1 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { Duration } from "../../duration.js";
|
|
1
2
|
import { ArtifactRef } from "../../artifact.js";
|
|
2
3
|
import { ViewerSpec } from "../../interaction.js";
|
|
3
|
-
import { CapabilityScope
|
|
4
|
+
import { CapabilityScope } from "../../capability.js";
|
|
4
5
|
import { MethodDefinition } from "../../method.js";
|
|
5
6
|
import * as z from "zod";
|
|
6
7
|
//#region src/methods/share/start.d.ts
|
|
@@ -9,7 +10,7 @@ import * as z from "zod";
|
|
|
9
10
|
* user's tailnet, who are known by name; `funnel` through Tailscale Funnel and `cloudflare`
|
|
10
11
|
* through a Cloudflare quick tunnel, both public, where the link is all that admits a viewer.
|
|
11
12
|
*/
|
|
12
|
-
export type ShareVia = "tailnet" | "funnel" | "cloudflare";
|
|
13
|
+
export type ShareVia = "tailnet" | "funnel" | "cloudflare" | "remote";
|
|
13
14
|
/** The Zod schema of the `ShareVia` type. */
|
|
14
15
|
export declare const ShareVia: z.ZodType<ShareVia>;
|
|
15
16
|
/** The longest a public share (Funnel or Cloudflare) may last: 7 days (D158). */
|
|
@@ -22,6 +23,8 @@ export interface ShareStartParams {
|
|
|
22
23
|
readonly artifact: ArtifactRef;
|
|
23
24
|
/** The tunnel. A public one (`funnel`, `cloudflare`) is explicit: never a fallback. */
|
|
24
25
|
readonly via: ShareVia;
|
|
26
|
+
/** For `remote`: the server's API origin. Default: the home's default server (D165 item 15). */
|
|
27
|
+
readonly server?: string;
|
|
25
28
|
/**
|
|
26
29
|
* How long the share and its link last, such as `30m` or `24h`. Public shares: 1 hour by
|
|
27
30
|
* default, at most 7 days. Tailnet shares: until stopped, unless given.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"start.d.ts","names":[],"sources":["../../../src/methods/share/start.ts"],"mappings":"
|
|
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,8 +1,9 @@
|
|
|
1
1
|
import { wireRegistry } from "../../wire-registry.js";
|
|
2
2
|
import { ArtifactId, ShareId, TokenId } from "../../ids.js";
|
|
3
|
+
import { Duration } from "../../duration.js";
|
|
3
4
|
import { ArtifactRef } from "../../artifact.js";
|
|
4
5
|
import { ViewerSpec } from "../../interaction.js";
|
|
5
|
-
import { CapabilityScope
|
|
6
|
+
import { CapabilityScope } from "../../capability.js";
|
|
6
7
|
import { defineMethod } from "../../method.js";
|
|
7
8
|
import * as z from "zod";
|
|
8
9
|
//#region src/methods/share/start.ts
|
|
@@ -10,10 +11,11 @@ import * as z from "zod";
|
|
|
10
11
|
const ShareVia = z.enum([
|
|
11
12
|
"tailnet",
|
|
12
13
|
"funnel",
|
|
13
|
-
"cloudflare"
|
|
14
|
+
"cloudflare",
|
|
15
|
+
"remote"
|
|
14
16
|
]).register(wireRegistry, {
|
|
15
17
|
id: "ShareVia",
|
|
16
|
-
description: "How a share reaches its viewers: tailnet, funnel or cloudflare."
|
|
18
|
+
description: "How a share reaches its viewers: tailnet, funnel or cloudflare, or remote: hosted on a remote server (D165)."
|
|
17
19
|
});
|
|
18
20
|
/** The longest a public share (Funnel or Cloudflare) may last: 7 days (D158). */
|
|
19
21
|
const PUBLIC_SHARE_MAX_TTL_MS = 6048e5;
|
|
@@ -42,6 +44,7 @@ const Share = z.object(shareShape).register(wireRegistry, {
|
|
|
42
44
|
const params = z.object({
|
|
43
45
|
artifact: ArtifactRef,
|
|
44
46
|
via: ShareVia,
|
|
47
|
+
server: z.string().regex(/^https?:\/\/[^/?#\s]+$/).exactOptional(),
|
|
45
48
|
ttl: Duration.exactOptional(),
|
|
46
49
|
scopes: z.array(CapabilityScope).min(1).readonly().exactOptional(),
|
|
47
50
|
viewer: ViewerSpec.exactOptional(),
|
|
@@ -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
|
|
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"}
|
|
@@ -20,6 +20,13 @@ export interface StatePatchParams {
|
|
|
20
20
|
readonly mutationId: string;
|
|
21
21
|
/** Who writes: `agent` (the default) or `host`, recorded as each field's last writer. */
|
|
22
22
|
readonly as?: "agent" | "host";
|
|
23
|
+
/**
|
|
24
|
+
* The relayed run whose server code writes it (`state` in `@mostra/server`, D165 item 4): the
|
|
25
|
+
* change is recorded as that run's, as a local run's own write is.
|
|
26
|
+
*/
|
|
27
|
+
readonly causation?: {
|
|
28
|
+
readonly runId: string;
|
|
29
|
+
};
|
|
23
30
|
}
|
|
24
31
|
/** The result of `state/patch`. */
|
|
25
32
|
export type StatePatchResult = MutationResult;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"patch.d.ts","names":[],"sources":["../../../src/methods/state/patch.ts"],"mappings":";;;;;iBAQiB;;WAEN,UAAU;;WAEV,cAAc;;;;;WAKd,eAAe;;;;;WAKf;;WAEA
|
|
1
|
+
{"version":3,"file":"patch.d.ts","names":[],"sources":["../../../src/methods/state/patch.ts"],"mappings":";;;;;iBAQiB;;WAEN,UAAU;;WAEV,cAAc;;;;;WAKd,eAAe;;;;;WAKf;;WAEA;;;;;WAKA;aAAuB;;;;YAItB,mBAAmB;;;;;qBAiBlB,kBAAkB,iBAAiB,kBAAkB"}
|
|
@@ -10,7 +10,8 @@ const params = z.object({
|
|
|
10
10
|
ops: z.array(FieldOp).min(1).max(1e3).readonly(),
|
|
11
11
|
baseRevision: DocumentRevision.exactOptional(),
|
|
12
12
|
mutationId: MutationId.schema,
|
|
13
|
-
as: z.enum(["agent", "host"]).exactOptional()
|
|
13
|
+
as: z.enum(["agent", "host"]).exactOptional(),
|
|
14
|
+
causation: z.object({ runId: z.string().min(1) }).exactOptional()
|
|
14
15
|
}).register(wireRegistry, { id: "StatePatchParams" });
|
|
15
16
|
/**
|
|
16
17
|
* `state/patch`: writes an artifact's shared state with compare-and-set and per-field conflicts,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"patch.js","names":[],"sources":["../../../src/methods/state/patch.ts"],"sourcesContent":["import * as z from \"zod\";\nimport { ArtifactRef } from \"../../artifact.ts\";\nimport { MutationId } from \"../../ids.ts\";\nimport { DocumentRevision, FieldOp, MutationResult } from \"../../interaction.ts\";\nimport { defineMethod, type MethodDefinition } from \"../../method.ts\";\nimport { wireRegistry } from \"../../wire-registry.ts\";\n\n/** The params of `state/patch` (INTERFACES §6, D63, D106). */\nexport interface StatePatchParams {\n /** The artifact whose shared state to write. */\n readonly artifact: ArtifactRef;\n /** The field changes, applied together under one revision. */\n readonly ops: readonly FieldOp[];\n /**\n * The state revision the caller last read. A field changed after it is a conflict and keeps its\n * value; the other ops apply. Absent: every op applies, whatever changed in between.\n */\n readonly baseRevision?: DocumentRevision;\n /**\n * The change's ID, the idempotency key of this method (H-03): a retry with the same ID and\n * contents returns the recorded result.\n */\n readonly mutationId: string;\n /** Who writes: `agent` (the default) or `host`, recorded as each field's last writer. */\n readonly as?: \"agent\" | \"host\";\n}\n\n/** The result of `state/patch`. */\nexport type StatePatchResult = MutationResult;\n\nconst params: z.ZodType<StatePatchParams> = z\n .object({\n artifact: ArtifactRef,\n ops: z.array(FieldOp).min(1).max(1000).readonly(),\n baseRevision: DocumentRevision.exactOptional(),\n mutationId: MutationId.schema,\n as: z.enum([\"agent\", \"host\"]).exactOptional(),\n })\n .register(wireRegistry, { id: \"StatePatchParams\" });\n\n/**\n * `state/patch`: writes an artifact's shared state with compare-and-set and per-field conflicts,\n * through the same path as viewers' edits (D63). Changes append `state.changed`.\n */\nexport const statePatchMethod: MethodDefinition<StatePatchParams, StatePatchResult> = defineMethod({\n method: \"state/patch\",\n direction: \"client-to-instance\",\n mutating: true,\n params,\n result: MutationResult,\n});\n"],"mappings":";;;;;;;
|
|
1
|
+
{"version":3,"file":"patch.js","names":[],"sources":["../../../src/methods/state/patch.ts"],"sourcesContent":["import * as z from \"zod\";\nimport { ArtifactRef } from \"../../artifact.ts\";\nimport { MutationId } from \"../../ids.ts\";\nimport { DocumentRevision, FieldOp, MutationResult } from \"../../interaction.ts\";\nimport { defineMethod, type MethodDefinition } from \"../../method.ts\";\nimport { wireRegistry } from \"../../wire-registry.ts\";\n\n/** The params of `state/patch` (INTERFACES §6, D63, D106). */\nexport interface StatePatchParams {\n /** The artifact whose shared state to write. */\n readonly artifact: ArtifactRef;\n /** The field changes, applied together under one revision. */\n readonly ops: readonly FieldOp[];\n /**\n * The state revision the caller last read. A field changed after it is a conflict and keeps its\n * value; the other ops apply. Absent: every op applies, whatever changed in between.\n */\n readonly baseRevision?: DocumentRevision;\n /**\n * The change's ID, the idempotency key of this method (H-03): a retry with the same ID and\n * contents returns the recorded result.\n */\n readonly mutationId: string;\n /** Who writes: `agent` (the default) or `host`, recorded as each field's last writer. */\n readonly as?: \"agent\" | \"host\";\n /**\n * The relayed run whose server code writes it (`state` in `@mostra/server`, D165 item 4): the\n * change is recorded as that run's, as a local run's own write is.\n */\n readonly causation?: { readonly runId: string };\n}\n\n/** The result of `state/patch`. */\nexport type StatePatchResult = MutationResult;\n\nconst params: z.ZodType<StatePatchParams> = z\n .object({\n artifact: ArtifactRef,\n ops: z.array(FieldOp).min(1).max(1000).readonly(),\n baseRevision: DocumentRevision.exactOptional(),\n mutationId: MutationId.schema,\n as: z.enum([\"agent\", \"host\"]).exactOptional(),\n causation: z.object({ runId: z.string().min(1) }).exactOptional(),\n })\n .register(wireRegistry, { id: \"StatePatchParams\" });\n\n/**\n * `state/patch`: writes an artifact's shared state with compare-and-set and per-field conflicts,\n * through the same path as viewers' edits (D63). Changes append `state.changed`.\n */\nexport const statePatchMethod: MethodDefinition<StatePatchParams, StatePatchResult> = defineMethod({\n method: \"state/patch\",\n direction: \"client-to-instance\",\n mutating: true,\n params,\n result: MutationResult,\n});\n"],"mappings":";;;;;;;AAmCA,MAAM,SAAsC,EACzC,OAAO;CACN,UAAU;CACV,KAAK,EAAE,MAAM,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,GAAI,CAAC,CAAC,SAAS;CAChD,cAAc,iBAAiB,cAAc;CAC7C,YAAY,WAAW;CACvB,IAAI,EAAE,KAAK,CAAC,SAAS,MAAM,CAAC,CAAC,CAAC,cAAc;CAC5C,WAAW,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,cAAc;AAClE,CAAC,CAAC,CACD,SAAS,cAAc,EAAE,IAAI,mBAAmB,CAAC;;;;;AAMpD,MAAa,mBAAyE,aAAa;CACjG,QAAQ;CACR,WAAW;CACX,UAAU;CACV;CACA,QAAQ;AACV,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { Duration } from "../../duration.js";
|
|
1
2
|
import { ArtifactRef } from "../../artifact.js";
|
|
2
3
|
import { Viewer, ViewerSpec } from "../../interaction.js";
|
|
3
|
-
import { CapabilityScope
|
|
4
|
+
import { CapabilityScope } from "../../capability.js";
|
|
4
5
|
import { MethodDefinition } from "../../method.js";
|
|
5
6
|
import * as z from "zod";
|
|
6
7
|
//#region src/methods/view/url.d.ts
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"url.d.ts","names":[],"sources":["../../../src/methods/view/url.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"url.d.ts","names":[],"sources":["../../../src/methods/view/url.ts"],"mappings":";;;;;;;;iBAUiB;;WAEN,UAAU;;;;;WAKV;;WAEA,kBAAkB;;WAElB,MAAM;;;;;WAKN,SAAS;;WAET;;;iBAIM;;WAEN;;WAEA;;WAEA,iBAAiB;;WAEjB;;WAEA,SAAS;;;YAIR,gBAAgB;;qBAGf,gBAAgB,EAAE,QAAQ;;;;;;qBA6B1B,eAAe,iBAAiB,eAAe"}
|
package/dist/methods/view/url.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { wireRegistry } from "../../wire-registry.js";
|
|
2
2
|
import { TokenId, VersionId } from "../../ids.js";
|
|
3
|
+
import { Duration } from "../../duration.js";
|
|
3
4
|
import { ArtifactRef } from "../../artifact.js";
|
|
4
5
|
import { Viewer, ViewerSpec } from "../../interaction.js";
|
|
5
|
-
import { CapabilityScope
|
|
6
|
+
import { CapabilityScope } from "../../capability.js";
|
|
6
7
|
import { defineMethod } from "../../method.js";
|
|
7
8
|
import * as z from "zod";
|
|
8
9
|
//#region src/methods/view/url.ts
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"url.js","names":[],"sources":["../../../src/methods/view/url.ts"],"sourcesContent":["import * as z from \"zod\";\nimport { ArtifactRef } from \"../../artifact.ts\";\nimport { CapabilityScope
|
|
1
|
+
{"version":3,"file":"url.js","names":[],"sources":["../../../src/methods/view/url.ts"],"sourcesContent":["import * as z from \"zod\";\nimport { ArtifactRef } from \"../../artifact.ts\";\nimport { CapabilityScope } from \"../../capability.ts\";\nimport { Duration } from \"../../duration.ts\";\nimport { TokenId, VersionId } from \"../../ids.ts\";\nimport { Viewer, ViewerSpec } from \"../../interaction.ts\";\nimport { defineMethod, type MethodDefinition } from \"../../method.ts\";\nimport { wireRegistry } from \"../../wire-registry.ts\";\n\n/** The params of `view/url` (INTERFACES §6, D97). */\nexport interface ViewUrlParams {\n /** The artifact the link opens. */\n readonly artifact: ArtifactRef;\n /**\n * The version the link opens, by number or ID. Without it the link opens the artifact's latest\n * version whenever it is used.\n */\n readonly version?: number | string;\n /** What the link allows (D97). Default: every scope. `view` is always included. */\n readonly scopes?: readonly CapabilityScope[];\n /** How long the link works, such as `24h` or `7d`. Default: until it is revoked (D63). */\n readonly ttl?: Duration;\n /**\n * The person the link acts for (D104): its sessions draft, submit and sign as that viewer, so\n * `once` per-viewer gives each person one submission. Absent: the home's local user.\n */\n readonly viewer?: ViewerSpec;\n /** Makes retries idempotent: a repeated `requestId` returns the same link (H-03). */\n readonly requestId?: string;\n}\n\n/** A capability link: what `view/url` and `view/rotate` return. */\nexport interface CapabilityLink {\n /** The capability URL. Holding it is the authorization (D06); share it like a password. */\n readonly url: string;\n /** The token's ID, for `view/rotate` and `view/revoke`. Never a secret. */\n readonly tokenId: string;\n /** The scopes the link carries, `view` included. */\n readonly scopes: readonly CapabilityScope[];\n /** When the link stops working; absent when it works until revoked. */\n readonly expiresAt?: string;\n /** The viewer the link acts for, when it was minted with one (D104). */\n readonly viewer?: Viewer;\n}\n\n/** The result of `view/url`. */\nexport type ViewUrlResult = CapabilityLink;\n\n/** The Zod schema of the `CapabilityLink` type. */\nexport const CapabilityLink: z.ZodType<CapabilityLink> = z\n .object({\n url: z.string().min(1),\n tokenId: TokenId.schema,\n scopes: z.array(CapabilityScope).readonly(),\n expiresAt: z.iso.datetime().exactOptional(),\n viewer: Viewer.exactOptional(),\n })\n .register(wireRegistry, {\n id: \"CapabilityLink\",\n description: \"A capability URL with its token ID, scopes and expiry.\",\n });\n\nconst params: z.ZodType<ViewUrlParams> = z\n .object({\n artifact: ArtifactRef,\n version: z.union([z.int().min(1), VersionId.schema]).exactOptional(),\n scopes: z.array(CapabilityScope).min(1).readonly().exactOptional(),\n ttl: Duration.exactOptional(),\n viewer: ViewerSpec.exactOptional(),\n requestId: z.string().min(1).exactOptional(),\n })\n .register(wireRegistry, { id: \"ViewUrlParams\" });\n\n/**\n * `view/url`: mints a new capability link to an artifact, with the scopes and lifetime asked for.\n * Each call mints a separate token that `view/revoke` ends on its own; the artifact's default link\n * is the publish receipt's `url`.\n */\nexport const viewUrlMethod: MethodDefinition<ViewUrlParams, ViewUrlResult> = defineMethod({\n method: \"view/url\",\n direction: \"client-to-instance\",\n mutating: true,\n params,\n result: CapabilityLink,\n});\n"],"mappings":";;;;;;;;;;AAiDA,MAAa,iBAA4C,EACtD,OAAO;CACN,KAAK,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC;CACrB,SAAS,QAAQ;CACjB,QAAQ,EAAE,MAAM,eAAe,CAAC,CAAC,SAAS;CAC1C,WAAW,EAAE,IAAI,SAAS,CAAC,CAAC,cAAc;CAC1C,QAAQ,OAAO,cAAc;AAC/B,CAAC,CAAC,CACD,SAAS,cAAc;CACtB,IAAI;CACJ,aAAa;AACf,CAAC;AAEH,MAAM,SAAmC,EACtC,OAAO;CACN,UAAU;CACV,SAAS,EAAE,MAAM,CAAC,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC,GAAG,UAAU,MAAM,CAAC,CAAC,CAAC,cAAc;CACnE,QAAQ,EAAE,MAAM,eAAe,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,cAAc;CACjE,KAAK,SAAS,cAAc;CAC5B,QAAQ,WAAW,cAAc;CACjC,WAAW,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,cAAc;AAC7C,CAAC,CAAC,CACD,SAAS,cAAc,EAAE,IAAI,gBAAgB,CAAC;;;;;;AAOjD,MAAa,gBAAgE,aAAa;CACxF,QAAQ;CACR,WAAW;CACX,UAAU;CACV;CACA,QAAQ;AACV,CAAC"}
|