@mostra/protocol 0.8.0 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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 +5 -0
- package/dist/browser.d.ts.map +1 -1
- package/dist/browser.js +7 -2
- 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/artifact.d.ts +1 -1
- package/dist/diagnostics/codes/artifact.d.ts.map +1 -1
- package/dist/diagnostics/codes/artifact.js +45 -1
- package/dist/diagnostics/codes/artifact.js.map +1 -1
- package/dist/diagnostics/codes/env.d.ts +1 -1
- package/dist/diagnostics/codes/env.d.ts.map +1 -1
- package/dist/diagnostics/codes/env.js +12 -1
- package/dist/diagnostics/codes/env.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 +99 -0
- package/dist/diagnostics/codes/remote.js.map +1 -0
- package/dist/diagnostics/codes/submit.js +3 -3
- 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/hygiene.d.ts +4 -1
- package/dist/hygiene.d.ts.map +1 -1
- package/dist/hygiene.js +4 -0
- package/dist/hygiene.js.map +1 -1
- 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 +30 -8
- package/dist/index.js +30 -8
- package/dist/interaction.d.ts +28 -2
- package/dist/interaction.d.ts.map +1 -1
- package/dist/interaction.js +20 -5
- 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/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 +38 -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-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/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/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 +2 -2
- package/schemas/protocol.draft-07.json +1607 -126
- package/schemas/protocol.schema.json +1543 -126
- package/src/actions.ts +45 -5
- package/src/browser.ts +6 -0
- package/src/capability.ts +0 -23
- package/src/diagnostics/codes/artifact.ts +48 -0
- package/src/diagnostics/codes/env.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 +113 -0
- package/src/diagnostics/codes/submit.ts +3 -3
- package/src/diagnostics/diagnostic.ts +3 -1
- package/src/duration.ts +29 -0
- package/src/hygiene.ts +12 -1
- package/src/ids.ts +33 -1
- package/src/index.ts +124 -8
- package/src/interaction.ts +42 -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/hosted/push.ts +146 -0
- package/src/methods/hosted/submission.ts +34 -0
- package/src/methods/index.ts +36 -0
- package/src/methods/instance/status.ts +4 -0
- package/src/methods/mostra/initialize.ts +19 -3
- 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/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/policy.ts +30 -0
- package/src/remote.ts +89 -0
- package/src/view.ts +1 -1
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { MethodDefinition } from "../../method.js";
|
|
2
|
+
import { ServerOrigin } from "../../remote.js";
|
|
3
|
+
//#region src/methods/remote/login.d.ts
|
|
4
|
+
/** The params of `remote/login` (INTERFACES §18.2). */
|
|
5
|
+
export interface RemoteLoginParams {
|
|
6
|
+
/** The server's API origin. Default: the home's default server. */
|
|
7
|
+
readonly server?: ServerOrigin;
|
|
8
|
+
/**
|
|
9
|
+
* Makes this instance the account's default: the one chat-host authoring goes to (D165 item
|
|
10
|
+
* 1b). Without it, an account's first linked instance is its default.
|
|
11
|
+
*/
|
|
12
|
+
readonly default?: boolean;
|
|
13
|
+
/** Makes a retry return the same sign-in. */
|
|
14
|
+
readonly requestId?: string;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* The result of `remote/login`: a sign-in by the OAuth device authorization grant (RFC 8628) has
|
|
18
|
+
* started; the person opens `verificationUri` and enters `userCode`.
|
|
19
|
+
*/
|
|
20
|
+
export interface RemoteLoginResult {
|
|
21
|
+
/** The sign-in, for `remote/login.wait`. */
|
|
22
|
+
readonly loginId: string;
|
|
23
|
+
/** The server signed in to. */
|
|
24
|
+
readonly server: ServerOrigin;
|
|
25
|
+
/** The page the person opens. */
|
|
26
|
+
readonly verificationUri: string;
|
|
27
|
+
/** The address with the code filled in, when the server offers one. */
|
|
28
|
+
readonly verificationUriComplete?: string;
|
|
29
|
+
/** The code the person enters there. */
|
|
30
|
+
readonly userCode: string;
|
|
31
|
+
/** When the code stops working. */
|
|
32
|
+
readonly expiresAt: string;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* `remote/login`: starts signing this home in to a remote server by the device authorization
|
|
36
|
+
* grant, and polls for its token in the background (D165 item 2). The instance keeps the refresh
|
|
37
|
+
* token in the home, owner-only; a home already linked there rebinds its instance link.
|
|
38
|
+
*/
|
|
39
|
+
export declare const remoteLoginMethod: MethodDefinition<RemoteLoginParams, RemoteLoginResult>;
|
|
40
|
+
//#endregion
|
|
41
|
+
//# sourceMappingURL=login.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"login.d.ts","names":[],"sources":["../../../src/methods/remote/login.ts"],"mappings":";;;;iBAMiB;;WAEN,SAAS;;;;;WAKT;;WAEA;;;;;;iBAOM;;WAEN;;WAEA,QAAQ;;WAER;;WAEA;;WAEA;;WAEA;;;;;;;qBA8BE,mBAAmB,iBAAiB,mBAAmB"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { wireRegistry } from "../../wire-registry.js";
|
|
2
|
+
import { defineMethod } from "../../method.js";
|
|
3
|
+
import { ServerOrigin } from "../../remote.js";
|
|
4
|
+
import * as z from "zod";
|
|
5
|
+
//#region src/methods/remote/login.ts
|
|
6
|
+
const params = z.object({
|
|
7
|
+
server: ServerOrigin.exactOptional(),
|
|
8
|
+
default: z.boolean().exactOptional(),
|
|
9
|
+
requestId: z.string().min(1).exactOptional()
|
|
10
|
+
}).register(wireRegistry, { id: "RemoteLoginParams" });
|
|
11
|
+
const result = z.object({
|
|
12
|
+
loginId: z.string(),
|
|
13
|
+
server: ServerOrigin,
|
|
14
|
+
verificationUri: z.string(),
|
|
15
|
+
verificationUriComplete: z.string().exactOptional(),
|
|
16
|
+
userCode: z.string(),
|
|
17
|
+
expiresAt: z.string()
|
|
18
|
+
}).register(wireRegistry, {
|
|
19
|
+
id: "RemoteLoginResult",
|
|
20
|
+
description: "A device-grant sign-in that started: where to go and the code to enter."
|
|
21
|
+
});
|
|
22
|
+
/**
|
|
23
|
+
* `remote/login`: starts signing this home in to a remote server by the device authorization
|
|
24
|
+
* grant, and polls for its token in the background (D165 item 2). The instance keeps the refresh
|
|
25
|
+
* token in the home, owner-only; a home already linked there rebinds its instance link.
|
|
26
|
+
*/
|
|
27
|
+
const remoteLoginMethod = defineMethod({
|
|
28
|
+
method: "remote/login",
|
|
29
|
+
direction: "client-to-instance",
|
|
30
|
+
mutating: true,
|
|
31
|
+
params,
|
|
32
|
+
result
|
|
33
|
+
});
|
|
34
|
+
//#endregion
|
|
35
|
+
export { remoteLoginMethod };
|
|
36
|
+
|
|
37
|
+
//# sourceMappingURL=login.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"login.js","names":[],"sources":["../../../src/methods/remote/login.ts"],"sourcesContent":["import * as z from \"zod\";\nimport { defineMethod, type MethodDefinition } from \"../../method.ts\";\nimport { ServerOrigin } from \"../../remote.ts\";\nimport { wireRegistry } from \"../../wire-registry.ts\";\n\n/** The params of `remote/login` (INTERFACES §18.2). */\nexport interface RemoteLoginParams {\n /** The server's API origin. Default: the home's default server. */\n readonly server?: ServerOrigin;\n /**\n * Makes this instance the account's default: the one chat-host authoring goes to (D165 item\n * 1b). Without it, an account's first linked instance is its default.\n */\n readonly default?: boolean;\n /** Makes a retry return the same sign-in. */\n readonly requestId?: string;\n}\n\n/**\n * The result of `remote/login`: a sign-in by the OAuth device authorization grant (RFC 8628) has\n * started; the person opens `verificationUri` and enters `userCode`.\n */\nexport interface RemoteLoginResult {\n /** The sign-in, for `remote/login.wait`. */\n readonly loginId: string;\n /** The server signed in to. */\n readonly server: ServerOrigin;\n /** The page the person opens. */\n readonly verificationUri: string;\n /** The address with the code filled in, when the server offers one. */\n readonly verificationUriComplete?: string;\n /** The code the person enters there. */\n readonly userCode: string;\n /** When the code stops working. */\n readonly expiresAt: string;\n}\n\nconst params: z.ZodType<RemoteLoginParams> = z\n .object({\n server: ServerOrigin.exactOptional(),\n default: z.boolean().exactOptional(),\n requestId: z.string().min(1).exactOptional(),\n })\n .register(wireRegistry, { id: \"RemoteLoginParams\" });\n\nconst result: z.ZodType<RemoteLoginResult> = z\n .object({\n loginId: z.string(),\n server: ServerOrigin,\n verificationUri: z.string(),\n verificationUriComplete: z.string().exactOptional(),\n userCode: z.string(),\n expiresAt: z.string(),\n })\n .register(wireRegistry, {\n id: \"RemoteLoginResult\",\n description: \"A device-grant sign-in that started: where to go and the code to enter.\",\n });\n\n/**\n * `remote/login`: starts signing this home in to a remote server by the device authorization\n * grant, and polls for its token in the background (D165 item 2). The instance keeps the refresh\n * token in the home, owner-only; a home already linked there rebinds its instance link.\n */\nexport const remoteLoginMethod: MethodDefinition<RemoteLoginParams, RemoteLoginResult> =\n defineMethod({\n method: \"remote/login\",\n direction: \"client-to-instance\",\n mutating: true,\n params,\n result,\n });\n"],"mappings":";;;;;AAqCA,MAAM,SAAuC,EAC1C,OAAO;CACN,QAAQ,aAAa,cAAc;CACnC,SAAS,EAAE,QAAQ,CAAC,CAAC,cAAc;CACnC,WAAW,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,cAAc;AAC7C,CAAC,CAAC,CACD,SAAS,cAAc,EAAE,IAAI,oBAAoB,CAAC;AAErD,MAAM,SAAuC,EAC1C,OAAO;CACN,SAAS,EAAE,OAAO;CAClB,QAAQ;CACR,iBAAiB,EAAE,OAAO;CAC1B,yBAAyB,EAAE,OAAO,CAAC,CAAC,cAAc;CAClD,UAAU,EAAE,OAAO;CACnB,WAAW,EAAE,OAAO;AACtB,CAAC,CAAC,CACD,SAAS,cAAc;CACtB,IAAI;CACJ,aAAa;AACf,CAAC;;;;;;AAOH,MAAa,oBACX,aAAa;CACX,QAAQ;CACR,WAAW;CACX,UAAU;CACV;CACA;AACF,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { MethodDefinition } from "../../method.js";
|
|
2
|
+
import { ServerOrigin } from "../../remote.js";
|
|
3
|
+
//#region src/methods/remote/logout.d.ts
|
|
4
|
+
/** The params of `remote/logout` (INTERFACES §18.2). */
|
|
5
|
+
export interface RemoteLogoutParams {
|
|
6
|
+
/** The server. Default: every server this home is signed in to. */
|
|
7
|
+
readonly server?: ServerOrigin;
|
|
8
|
+
/**
|
|
9
|
+
* Also forgets the instance link, after which this home owns none of the artifacts it shared
|
|
10
|
+
* there. Without it, the next sign-in rebinds the same link.
|
|
11
|
+
*/
|
|
12
|
+
readonly forget?: boolean;
|
|
13
|
+
}
|
|
14
|
+
/** The result of `remote/logout`: the servers signed out of. */
|
|
15
|
+
export interface RemoteLogoutResult {
|
|
16
|
+
/** The servers this home is no longer signed in to. */
|
|
17
|
+
readonly servers: readonly ServerOrigin[];
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* `remote/logout`: revokes this home's grant on a server and removes its tokens, keeping the
|
|
21
|
+
* instance link unless `forget` (D165, after the Opus review).
|
|
22
|
+
*/
|
|
23
|
+
export declare const remoteLogoutMethod: MethodDefinition<RemoteLogoutParams, RemoteLogoutResult>;
|
|
24
|
+
//#endregion
|
|
25
|
+
//# sourceMappingURL=logout.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logout.d.ts","names":[],"sources":["../../../src/methods/remote/logout.ts"],"mappings":";;;;iBAMiB;;WAEN,SAAS;;;;;WAKT;;;iBAIM;;WAEN,kBAAkB;;;;;;qBAehB,oBAAoB,iBAAiB,oBAAoB"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { wireRegistry } from "../../wire-registry.js";
|
|
2
|
+
import { defineMethod } from "../../method.js";
|
|
3
|
+
import { ServerOrigin } from "../../remote.js";
|
|
4
|
+
import * as z from "zod";
|
|
5
|
+
//#region src/methods/remote/logout.ts
|
|
6
|
+
const params = z.object({
|
|
7
|
+
server: ServerOrigin.exactOptional(),
|
|
8
|
+
forget: z.boolean().exactOptional()
|
|
9
|
+
}).register(wireRegistry, { id: "RemoteLogoutParams" });
|
|
10
|
+
const result = z.object({ servers: z.array(ServerOrigin).readonly() }).register(wireRegistry, {
|
|
11
|
+
id: "RemoteLogoutResult",
|
|
12
|
+
description: "The servers signed out of."
|
|
13
|
+
});
|
|
14
|
+
/**
|
|
15
|
+
* `remote/logout`: revokes this home's grant on a server and removes its tokens, keeping the
|
|
16
|
+
* instance link unless `forget` (D165, after the Opus review).
|
|
17
|
+
*/
|
|
18
|
+
const remoteLogoutMethod = defineMethod({
|
|
19
|
+
method: "remote/logout",
|
|
20
|
+
direction: "client-to-instance",
|
|
21
|
+
mutating: true,
|
|
22
|
+
params,
|
|
23
|
+
result
|
|
24
|
+
});
|
|
25
|
+
//#endregion
|
|
26
|
+
export { remoteLogoutMethod };
|
|
27
|
+
|
|
28
|
+
//# sourceMappingURL=logout.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logout.js","names":[],"sources":["../../../src/methods/remote/logout.ts"],"sourcesContent":["import * as z from \"zod\";\nimport { defineMethod, type MethodDefinition } from \"../../method.ts\";\nimport { ServerOrigin } from \"../../remote.ts\";\nimport { wireRegistry } from \"../../wire-registry.ts\";\n\n/** The params of `remote/logout` (INTERFACES §18.2). */\nexport interface RemoteLogoutParams {\n /** The server. Default: every server this home is signed in to. */\n readonly server?: ServerOrigin;\n /**\n * Also forgets the instance link, after which this home owns none of the artifacts it shared\n * there. Without it, the next sign-in rebinds the same link.\n */\n readonly forget?: boolean;\n}\n\n/** The result of `remote/logout`: the servers signed out of. */\nexport interface RemoteLogoutResult {\n /** The servers this home is no longer signed in to. */\n readonly servers: readonly ServerOrigin[];\n}\n\nconst params: z.ZodType<RemoteLogoutParams> = z\n .object({ server: ServerOrigin.exactOptional(), forget: z.boolean().exactOptional() })\n .register(wireRegistry, { id: \"RemoteLogoutParams\" });\n\nconst result: z.ZodType<RemoteLogoutResult> = z\n .object({ servers: z.array(ServerOrigin).readonly() })\n .register(wireRegistry, { id: \"RemoteLogoutResult\", description: \"The servers signed out of.\" });\n\n/**\n * `remote/logout`: revokes this home's grant on a server and removes its tokens, keeping the\n * instance link unless `forget` (D165, after the Opus review).\n */\nexport const remoteLogoutMethod: MethodDefinition<RemoteLogoutParams, RemoteLogoutResult> =\n defineMethod({\n method: \"remote/logout\",\n direction: \"client-to-instance\",\n mutating: true,\n params,\n result,\n });\n"],"mappings":";;;;;AAsBA,MAAM,SAAwC,EAC3C,OAAO;CAAE,QAAQ,aAAa,cAAc;CAAG,QAAQ,EAAE,QAAQ,CAAC,CAAC,cAAc;AAAE,CAAC,CAAC,CACrF,SAAS,cAAc,EAAE,IAAI,qBAAqB,CAAC;AAEtD,MAAM,SAAwC,EAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC,CAAC,SAAS,EAAE,CAAC,CAAC,CACrD,SAAS,cAAc;CAAE,IAAI;CAAsB,aAAa;AAA6B,CAAC;;;;;AAMjG,MAAa,qBACX,aAAa;CACX,QAAQ;CACR,WAAW;CACX,UAAU;CACV;CACA;AACF,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { MethodDefinition } from "../../method.js";
|
|
2
|
+
import { RemoteLink } from "../../remote.js";
|
|
3
|
+
//#region src/methods/remote/status.d.ts
|
|
4
|
+
/** The params of `remote/status` (INTERFACES §18.2). */
|
|
5
|
+
export type RemoteStatusParams = Record<string, never>;
|
|
6
|
+
/** The result of `remote/status`: every server this home is linked to. */
|
|
7
|
+
export interface RemoteStatusResult {
|
|
8
|
+
/** Each server this home is linked to. */
|
|
9
|
+
readonly links: readonly RemoteLink[];
|
|
10
|
+
}
|
|
11
|
+
/** `remote/status`: the remote servers this home is linked to and each link's state. */
|
|
12
|
+
export declare const remoteStatusMethod: MethodDefinition<RemoteStatusParams, RemoteStatusResult>;
|
|
13
|
+
//#endregion
|
|
14
|
+
//# sourceMappingURL=status.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"status.d.ts","names":[],"sources":["../../../src/methods/remote/status.ts"],"mappings":";;;;YAMY,qBAAqB;;iBAGhB;;WAEN,gBAAgB;;;qBAed,oBAAoB,iBAAiB,oBAAoB"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { wireRegistry } from "../../wire-registry.js";
|
|
2
|
+
import { defineMethod } from "../../method.js";
|
|
3
|
+
import { RemoteLink } from "../../remote.js";
|
|
4
|
+
import * as z from "zod";
|
|
5
|
+
//#region src/methods/remote/status.ts
|
|
6
|
+
const params = z.object({}).register(wireRegistry, { id: "RemoteStatusParams" });
|
|
7
|
+
const result = z.object({ links: z.array(RemoteLink).readonly() }).register(wireRegistry, {
|
|
8
|
+
id: "RemoteStatusResult",
|
|
9
|
+
description: "Every remote server this home is linked to."
|
|
10
|
+
});
|
|
11
|
+
/** `remote/status`: the remote servers this home is linked to and each link's state. */
|
|
12
|
+
const remoteStatusMethod = defineMethod({
|
|
13
|
+
method: "remote/status",
|
|
14
|
+
direction: "client-to-instance",
|
|
15
|
+
mutating: false,
|
|
16
|
+
params,
|
|
17
|
+
result
|
|
18
|
+
});
|
|
19
|
+
//#endregion
|
|
20
|
+
export { remoteStatusMethod };
|
|
21
|
+
|
|
22
|
+
//# sourceMappingURL=status.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"status.js","names":[],"sources":["../../../src/methods/remote/status.ts"],"sourcesContent":["import * as z from \"zod\";\nimport { defineMethod, type MethodDefinition } from \"../../method.ts\";\nimport { RemoteLink } from \"../../remote.ts\";\nimport { wireRegistry } from \"../../wire-registry.ts\";\n\n/** The params of `remote/status` (INTERFACES §18.2). */\nexport type RemoteStatusParams = Record<string, never>;\n\n/** The result of `remote/status`: every server this home is linked to. */\nexport interface RemoteStatusResult {\n /** Each server this home is linked to. */\n readonly links: readonly RemoteLink[];\n}\n\nconst params: z.ZodType<RemoteStatusParams> = z\n .object({})\n .register(wireRegistry, { id: \"RemoteStatusParams\" });\n\nconst result: z.ZodType<RemoteStatusResult> = z\n .object({ links: z.array(RemoteLink).readonly() })\n .register(wireRegistry, {\n id: \"RemoteStatusResult\",\n description: \"Every remote server this home is linked to.\",\n });\n\n/** `remote/status`: the remote servers this home is linked to and each link's state. */\nexport const remoteStatusMethod: MethodDefinition<RemoteStatusParams, RemoteStatusResult> =\n defineMethod({\n method: \"remote/status\",\n direction: \"client-to-instance\",\n mutating: false,\n params,\n result,\n });\n"],"mappings":";;;;;AAcA,MAAM,SAAwC,EAC3C,OAAO,CAAC,CAAC,CAAC,CACV,SAAS,cAAc,EAAE,IAAI,qBAAqB,CAAC;AAEtD,MAAM,SAAwC,EAC3C,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC,CAAC,SAAS,EAAE,CAAC,CAAC,CACjD,SAAS,cAAc;CACtB,IAAI;CACJ,aAAa;AACf,CAAC;;AAGH,MAAa,qBACX,aAAa;CACX,QAAQ;CACR,WAAW;CACX,UAAU;CACV;CACA;AACF,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { MethodDefinition } from "../../method.js";
|
|
2
|
+
//#region src/methods/remote/token.d.ts
|
|
3
|
+
/** The params of `remote/token` (INTERFACES §18.2): a fresh access token, sent in band. */
|
|
4
|
+
export interface RemoteTokenParams {
|
|
5
|
+
/** A fresh access token of the binding's own grant. */
|
|
6
|
+
readonly accessToken: string;
|
|
7
|
+
}
|
|
8
|
+
/** The result of `remote/token`: when the binding now closes unless refreshed again. */
|
|
9
|
+
export interface RemoteTokenResult {
|
|
10
|
+
/** When the new token expires. */
|
|
11
|
+
readonly expiresAt: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* `remote/token`: on a binding to a remote server, replaces the session's access token with a
|
|
15
|
+
* fresh one for the same grant, so the server doesn't close the binding at the old one's expiry.
|
|
16
|
+
*/
|
|
17
|
+
export declare const remoteTokenMethod: MethodDefinition<RemoteTokenParams, RemoteTokenResult>;
|
|
18
|
+
//#endregion
|
|
19
|
+
//# sourceMappingURL=token.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"token.d.ts","names":[],"sources":["../../../src/methods/remote/token.ts"],"mappings":";;;iBAKiB;;WAEN;;;iBAIM;;WAEN;;;;;;qBAkBE,mBAAmB,iBAAiB,mBAAmB"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { wireRegistry } from "../../wire-registry.js";
|
|
2
|
+
import { defineMethod } from "../../method.js";
|
|
3
|
+
import * as z from "zod";
|
|
4
|
+
//#region src/methods/remote/token.ts
|
|
5
|
+
const params = z.object({ accessToken: z.string().min(1) }).register(wireRegistry, { id: "RemoteTokenParams" });
|
|
6
|
+
const result = z.object({ expiresAt: z.string() }).register(wireRegistry, {
|
|
7
|
+
id: "RemoteTokenResult",
|
|
8
|
+
description: "When the binding closes unless its token is refreshed again."
|
|
9
|
+
});
|
|
10
|
+
/**
|
|
11
|
+
* `remote/token`: on a binding to a remote server, replaces the session's access token with a
|
|
12
|
+
* fresh one for the same grant, so the server doesn't close the binding at the old one's expiry.
|
|
13
|
+
*/
|
|
14
|
+
const remoteTokenMethod = defineMethod({
|
|
15
|
+
method: "remote/token",
|
|
16
|
+
direction: "client-to-instance",
|
|
17
|
+
mutating: false,
|
|
18
|
+
params,
|
|
19
|
+
result
|
|
20
|
+
});
|
|
21
|
+
//#endregion
|
|
22
|
+
export { remoteTokenMethod };
|
|
23
|
+
|
|
24
|
+
//# sourceMappingURL=token.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"token.js","names":[],"sources":["../../../src/methods/remote/token.ts"],"sourcesContent":["import * as z from \"zod\";\nimport { defineMethod, type MethodDefinition } from \"../../method.ts\";\nimport { wireRegistry } from \"../../wire-registry.ts\";\n\n/** The params of `remote/token` (INTERFACES §18.2): a fresh access token, sent in band. */\nexport interface RemoteTokenParams {\n /** A fresh access token of the binding's own grant. */\n readonly accessToken: string;\n}\n\n/** The result of `remote/token`: when the binding now closes unless refreshed again. */\nexport interface RemoteTokenResult {\n /** When the new token expires. */\n readonly expiresAt: string;\n}\n\nconst params: z.ZodType<RemoteTokenParams> = z\n .object({ accessToken: z.string().min(1) })\n .register(wireRegistry, { id: \"RemoteTokenParams\" });\n\nconst result: z.ZodType<RemoteTokenResult> = z\n .object({ expiresAt: z.string() })\n .register(wireRegistry, {\n id: \"RemoteTokenResult\",\n description: \"When the binding closes unless its token is refreshed again.\",\n });\n\n/**\n * `remote/token`: on a binding to a remote server, replaces the session's access token with a\n * fresh one for the same grant, so the server doesn't close the binding at the old one's expiry.\n */\nexport const remoteTokenMethod: MethodDefinition<RemoteTokenParams, RemoteTokenResult> =\n defineMethod({\n method: \"remote/token\",\n direction: \"client-to-instance\",\n mutating: false,\n params,\n result,\n });\n"],"mappings":";;;;AAgBA,MAAM,SAAuC,EAC1C,OAAO,EAAE,aAAa,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAC1C,SAAS,cAAc,EAAE,IAAI,oBAAoB,CAAC;AAErD,MAAM,SAAuC,EAC1C,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,CAAC,CAAC,CACjC,SAAS,cAAc;CACtB,IAAI;CACJ,aAAa;AACf,CAAC;;;;;AAMH,MAAa,oBACX,aAAa;CACX,QAAQ;CACR,WAAW;CACX,UAAU;CACV;CACA;AACF,CAAC"}
|
|
@@ -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"}
|
package/dist/policy.d.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as z from "zod";
|
|
2
|
+
//#region src/policy.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* The submission policy an artifact requests (D10, D39, D63). The host decides the policy in force;
|
|
5
|
+
* the manifest only asks for one.
|
|
6
|
+
*/
|
|
7
|
+
export type SubmissionPolicy = {
|
|
8
|
+
readonly policy: "once";
|
|
9
|
+
readonly scope?: "per-artifact" | "per-viewer";
|
|
10
|
+
} | {
|
|
11
|
+
readonly policy: "epochs";
|
|
12
|
+
} | {
|
|
13
|
+
readonly policy: "none";
|
|
14
|
+
};
|
|
15
|
+
/** The Zod schema of the `SubmissionPolicy` type. */
|
|
16
|
+
export declare const SubmissionPolicy: z.ZodType<SubmissionPolicy>;
|
|
17
|
+
//#endregion
|
|
18
|
+
//# sourceMappingURL=policy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"policy.d.ts","names":[],"sources":["../src/policy.ts"],"mappings":";;;;;;YAWY;WACG;WAAyB;;WACzB;;WACA;;;qBAGF,kBAAkB,EAAE,QAAQ"}
|
package/dist/policy.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { wireRegistry } from "./wire-registry.js";
|
|
2
|
+
import * as z from "zod";
|
|
3
|
+
//#region src/policy.ts
|
|
4
|
+
/**
|
|
5
|
+
* The submission policy (D10, D39, D63): a module of its own, so the shell bridge's view context
|
|
6
|
+
* reads it without the whole manifest schema in its bundle.
|
|
7
|
+
*/
|
|
8
|
+
/** The Zod schema of the `SubmissionPolicy` type. */
|
|
9
|
+
const SubmissionPolicy = z.discriminatedUnion("policy", [
|
|
10
|
+
z.object({
|
|
11
|
+
policy: z.literal("once"),
|
|
12
|
+
scope: z.enum(["per-artifact", "per-viewer"]).exactOptional()
|
|
13
|
+
}),
|
|
14
|
+
z.object({ policy: z.literal("epochs") }),
|
|
15
|
+
z.object({ policy: z.literal("none") })
|
|
16
|
+
]).register(wireRegistry, {
|
|
17
|
+
id: "SubmissionPolicy",
|
|
18
|
+
description: "A submission policy: once (per-artifact or per-viewer), epochs, or none."
|
|
19
|
+
});
|
|
20
|
+
//#endregion
|
|
21
|
+
export { SubmissionPolicy };
|
|
22
|
+
|
|
23
|
+
//# sourceMappingURL=policy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"policy.js","names":[],"sources":["../src/policy.ts"],"sourcesContent":["/**\n * The submission policy (D10, D39, D63): a module of its own, so the shell bridge's view context\n * reads it without the whole manifest schema in its bundle.\n */\nimport * as z from \"zod\";\nimport { wireRegistry } from \"./wire-registry.ts\";\n\n/**\n * The submission policy an artifact requests (D10, D39, D63). The host decides the policy in force;\n * the manifest only asks for one.\n */\nexport type SubmissionPolicy =\n | { readonly policy: \"once\"; readonly scope?: \"per-artifact\" | \"per-viewer\" }\n | { readonly policy: \"epochs\" }\n | { readonly policy: \"none\" };\n\n/** The Zod schema of the `SubmissionPolicy` type. */\nexport const SubmissionPolicy: z.ZodType<SubmissionPolicy> = z\n .discriminatedUnion(\"policy\", [\n z.object({\n policy: z.literal(\"once\"),\n scope: z.enum([\"per-artifact\", \"per-viewer\"]).exactOptional(),\n }),\n z.object({ policy: z.literal(\"epochs\") }),\n z.object({ policy: z.literal(\"none\") }),\n ])\n .register(wireRegistry, {\n id: \"SubmissionPolicy\",\n description: \"A submission policy: once (per-artifact or per-viewer), epochs, or none.\",\n });\n"],"mappings":";;;;;;;;AAiBA,MAAa,mBAAgD,EAC1D,mBAAmB,UAAU;CAC5B,EAAE,OAAO;EACP,QAAQ,EAAE,QAAQ,MAAM;EACxB,OAAO,EAAE,KAAK,CAAC,gBAAgB,YAAY,CAAC,CAAC,CAAC,cAAc;CAC9D,CAAC;CACD,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,QAAQ,EAAE,CAAC;CACxC,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,MAAM,EAAE,CAAC;AACxC,CAAC,CAAC,CACD,SAAS,cAAc;CACtB,IAAI;CACJ,aAAa;AACf,CAAC"}
|
package/dist/remote.d.ts
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { Cursor } from "./ids.js";
|
|
2
|
+
import * as z from "zod";
|
|
3
|
+
//#region src/remote.d.ts
|
|
4
|
+
/** A server, by its API origin (`https://api.example`). */
|
|
5
|
+
export type ServerOrigin = string;
|
|
6
|
+
/** The Zod schema of the `ServerOrigin` type: an origin with no path. */
|
|
7
|
+
export declare const ServerOrigin: z.ZodType<ServerOrigin>;
|
|
8
|
+
/** The state of an instance's link to one server (INTERFACES §18.2). */
|
|
9
|
+
export type RemoteLinkState = "connected" | "connecting" | "offline" | "signed-out";
|
|
10
|
+
/** One server this home is linked to (`remote/status`). */
|
|
11
|
+
export interface RemoteLink {
|
|
12
|
+
/** The server's API origin. */
|
|
13
|
+
readonly server: ServerOrigin;
|
|
14
|
+
/** The account signed in there. */
|
|
15
|
+
readonly account: {
|
|
16
|
+
readonly id: string;
|
|
17
|
+
readonly name?: string;
|
|
18
|
+
};
|
|
19
|
+
/** This home's instance link on that server (`lnk_…`), kept across sign-outs. */
|
|
20
|
+
readonly instanceId: string;
|
|
21
|
+
/** The link's name, as the account's other instances see it. */
|
|
22
|
+
readonly name: string;
|
|
23
|
+
/** Whether this instance is the account's default instance (D165 item 1b). */
|
|
24
|
+
readonly default: boolean;
|
|
25
|
+
/** Whether the binding is open, being dialled, offline, or signed out. */
|
|
26
|
+
readonly state: RemoteLinkState;
|
|
27
|
+
/** When the link reached its state. */
|
|
28
|
+
readonly since: string;
|
|
29
|
+
/** Publishes of shared artifacts waiting to reach the server. */
|
|
30
|
+
readonly pendingPushes: number;
|
|
31
|
+
/** Why the link isn't connected, when it failed. */
|
|
32
|
+
readonly lastError?: string;
|
|
33
|
+
}
|
|
34
|
+
/** The Zod schema of the `RemoteLink` type. */
|
|
35
|
+
export declare const RemoteLink: z.ZodType<RemoteLink>;
|
|
36
|
+
/**
|
|
37
|
+
* What an owner instance tells its hosted home as it opens a binding session (INTERFACES §18.2):
|
|
38
|
+
* its link, the highest relay sequence it accepted, and the hosted home's position it committed,
|
|
39
|
+
* so a home restored to an earlier copy is found before it answers (D165, FAILURE_MODEL §11.2).
|
|
40
|
+
*/
|
|
41
|
+
export interface OwnerLinkInfo {
|
|
42
|
+
/** The instance's `lnk_` ID on this server. */
|
|
43
|
+
readonly instanceId: string;
|
|
44
|
+
/** The highest relay sequence the owner's ledger accepted. */
|
|
45
|
+
readonly relayMark: number;
|
|
46
|
+
/** The hosted home's position the owner committed: its incarnation and cursor. */
|
|
47
|
+
readonly followed?: {
|
|
48
|
+
readonly incarnation: string;
|
|
49
|
+
readonly cursor: Cursor;
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
/** The Zod schema of the `OwnerLinkInfo` type. */
|
|
53
|
+
export declare const OwnerLinkInfo: z.ZodType<OwnerLinkInfo>;
|
|
54
|
+
//#endregion
|
|
55
|
+
//# sourceMappingURL=remote.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remote.d.ts","names":[],"sources":["../src/remote.ts"],"mappings":";;;;YASY;;qBAGC,cAAc,EAAE,QAAQ;;YASzB;;iBAGK;;WAEN,QAAQ;;WAER;aAAoB;aAAqB;;;WAEzC;;WAEA;;WAEA;;WAEA,OAAO;;WAEP;;WAEA;;WAEA;;;qBAIE,YAAY,EAAE,QAAQ;;;;;;iBAsBlB;;WAEN;;WAEA;;WAEA;aAAsB;aAA8B,QAAQ;;;;qBAI1D,eAAe,EAAE,QAAQ"}
|