@mostra/protocol 0.10.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/browser.d.ts +42 -0
- package/dist/browser.d.ts.map +1 -1
- package/dist/browser.js +29 -1
- package/dist/browser.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/remote.d.ts +1 -1
- package/dist/diagnostics/codes/remote.d.ts.map +1 -1
- package/dist/diagnostics/codes/remote.js +78 -1
- package/dist/diagnostics/codes/remote.js.map +1 -1
- 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/index.d.ts +5 -2
- package/dist/index.js +4 -1
- package/dist/interaction.d.ts +5 -0
- package/dist/interaction.d.ts.map +1 -1
- package/dist/interaction.js +2 -1
- package/dist/interaction.js.map +1 -1
- 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/index.d.ts.map +1 -1
- package/dist/methods/index.js +7 -1
- package/dist/methods/index.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/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/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/package.json +11 -1
- package/schemas/protocol.draft-07.json +259 -0
- package/schemas/protocol.schema.json +259 -0
- package/src/browser.ts +64 -0
- package/src/diagnostics/codes/action.ts +12 -0
- package/src/diagnostics/codes/remote.ts +84 -0
- package/src/diagnostics/codes/submit.ts +12 -0
- package/src/index.ts +19 -0
- package/src/interaction.ts +6 -0
- package/src/methods/artifact/pause.ts +59 -0
- package/src/methods/index.ts +6 -0
- package/src/methods/port/relay-author.ts +57 -0
- package/src/methods/remote/link.ts +65 -0
- package/src/operator.ts +621 -0
package/src/methods/index.ts
CHANGED
|
@@ -9,6 +9,7 @@ import { artifactExportMethod } from "./artifact/export.ts";
|
|
|
9
9
|
import { artifactGetMethod } from "./artifact/get.ts";
|
|
10
10
|
import { artifactImportMethod } from "./artifact/import.ts";
|
|
11
11
|
import { artifactListMethod } from "./artifact/list.ts";
|
|
12
|
+
import { artifactPauseMethod } from "./artifact/pause.ts";
|
|
12
13
|
import { artifactPublishMethod } from "./artifact/publish.ts";
|
|
13
14
|
import { artifactVerifyMethod } from "./artifact/verify.ts";
|
|
14
15
|
import { depsAddMethod } from "./deps/add.ts";
|
|
@@ -29,6 +30,7 @@ import { mostraShutdownMethod } from "./mostra/shutdown.ts";
|
|
|
29
30
|
import { portAddressingExternalBaseMethod } from "./port/addressing-external-base.ts";
|
|
30
31
|
import { portDraftsMirrorMethod } from "./port/drafts-mirror.ts";
|
|
31
32
|
import { portIdentityResolveMethod } from "./port/identity-resolve.ts";
|
|
33
|
+
import { portRelayAuthorMethod } from "./port/relay-author.ts";
|
|
32
34
|
import { portRelayCallMethod } from "./port/relay-call.ts";
|
|
33
35
|
import { portRelayCancelMethod } from "./port/relay-cancel.ts";
|
|
34
36
|
import { portRelayLiveMethod } from "./port/relay-live.ts";
|
|
@@ -42,6 +44,7 @@ import { relayCallBatchMethod } from "./relay/call-batch.ts";
|
|
|
42
44
|
import { relayEffectMethod } from "./relay/effect.ts";
|
|
43
45
|
import { relayLiveValueMethod } from "./relay/live-value.ts";
|
|
44
46
|
import { relayRunUpdateMethod } from "./relay/run-update.ts";
|
|
47
|
+
import { remoteLinkMethod } from "./remote/link.ts";
|
|
45
48
|
import { remoteLoginMethod } from "./remote/login.ts";
|
|
46
49
|
import { remoteLoginWaitMethod } from "./remote/login-wait.ts";
|
|
47
50
|
import { remoteLogoutMethod } from "./remote/logout.ts";
|
|
@@ -124,6 +127,9 @@ export const hostMethods: readonly AnyMethod[] = [
|
|
|
124
127
|
portRelayLiveMethod,
|
|
125
128
|
relayLiveValueMethod,
|
|
126
129
|
hostedSubmissionMethod,
|
|
130
|
+
artifactPauseMethod,
|
|
131
|
+
portRelayAuthorMethod,
|
|
132
|
+
remoteLinkMethod,
|
|
127
133
|
// gen:methods
|
|
128
134
|
];
|
|
129
135
|
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import * as z from "zod";
|
|
2
|
+
import { defineMethod, type MethodDefinition } from "../../method.ts";
|
|
3
|
+
import { wireRegistry } from "../../wire-registry.ts";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* What remote MCP may ask an owner instance to do for it (INTERFACES §18.8, D165 item 5): the
|
|
7
|
+
* authoring methods of the host protocol, and the owner's workspace (`McpWorkspace`, its root and
|
|
8
|
+
* its artifacts' files) and verify's screenshots, which only that machine holds.
|
|
9
|
+
*/
|
|
10
|
+
export const RELAY_AUTHOR_METHODS = [
|
|
11
|
+
"artifact/create",
|
|
12
|
+
"artifact/verify",
|
|
13
|
+
"artifact/publish",
|
|
14
|
+
"artifact/get",
|
|
15
|
+
"workspace/root",
|
|
16
|
+
"workspace/allocate",
|
|
17
|
+
"workspace/read",
|
|
18
|
+
"workspace/apply",
|
|
19
|
+
"verify/screenshot",
|
|
20
|
+
] as const;
|
|
21
|
+
|
|
22
|
+
/** One of {@link RELAY_AUTHOR_METHODS}. */
|
|
23
|
+
export type RelayAuthorMethod = (typeof RELAY_AUTHOR_METHODS)[number];
|
|
24
|
+
|
|
25
|
+
/** The params of `port/relay.author` (INTERFACES §18.3). */
|
|
26
|
+
export interface PortRelayAuthorParams {
|
|
27
|
+
/** What to do on the owner instance. */
|
|
28
|
+
readonly method: RelayAuthorMethod;
|
|
29
|
+
/** Its params: the host protocol method's, or the workspace operation's. */
|
|
30
|
+
readonly params: unknown;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/** The result of `port/relay.author`: the method's own result. */
|
|
34
|
+
export type PortRelayAuthorResult = unknown;
|
|
35
|
+
|
|
36
|
+
const params: z.ZodType<PortRelayAuthorParams> = z
|
|
37
|
+
.object({ method: z.enum(RELAY_AUTHOR_METHODS), params: z.unknown() })
|
|
38
|
+
.register(wireRegistry, { id: "PortRelayAuthorParams" });
|
|
39
|
+
|
|
40
|
+
const result: z.ZodType<PortRelayAuthorResult> = z
|
|
41
|
+
.unknown()
|
|
42
|
+
.register(wireRegistry, { id: "PortRelayAuthorResult" });
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* `port/relay.author`: the remote MCP server relays an authoring step to the account's default
|
|
46
|
+
* owner instance (D165 item 5), which runs it in its own workspace, builder and `verify`, and
|
|
47
|
+
* answers its result or its diagnostic. A publish through it also hosts the version on the server
|
|
48
|
+
* that asked and answers the hosted link. Workspace paths stay inside the owner's workspace.
|
|
49
|
+
*/
|
|
50
|
+
export const portRelayAuthorMethod: MethodDefinition<PortRelayAuthorParams, PortRelayAuthorResult> =
|
|
51
|
+
defineMethod({
|
|
52
|
+
method: "port/relay.author",
|
|
53
|
+
direction: "instance-to-host",
|
|
54
|
+
mutating: true,
|
|
55
|
+
params,
|
|
56
|
+
result,
|
|
57
|
+
});
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import * as z from "zod";
|
|
2
|
+
import { defineMethod, type MethodDefinition } from "../../method.ts";
|
|
3
|
+
import { ServerOrigin } from "../../remote.ts";
|
|
4
|
+
import { wireRegistry } from "../../wire-registry.ts";
|
|
5
|
+
|
|
6
|
+
/** The params of `remote/link` (INTERFACES §18.2). */
|
|
7
|
+
export interface RemoteLinkParams {
|
|
8
|
+
/** The server's API origin. */
|
|
9
|
+
readonly server: ServerOrigin;
|
|
10
|
+
/**
|
|
11
|
+
* A credential the server's operator issued for an account (`accounts.authenticate`, §18.6), in
|
|
12
|
+
* place of a person's sign-in: a program runs an always-on owner instance with it. Kept in the
|
|
13
|
+
* home, owner-only, like a refresh token; never logged.
|
|
14
|
+
*/
|
|
15
|
+
readonly key: string;
|
|
16
|
+
/** Makes this instance the account's default: the one chat-host authoring goes to (D165 item 1b). */
|
|
17
|
+
readonly default?: boolean;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/** The result of `remote/link`: this home is linked to the server for the key's account. */
|
|
21
|
+
export interface RemoteLinkResult {
|
|
22
|
+
/** The server linked to. */
|
|
23
|
+
readonly server: ServerOrigin;
|
|
24
|
+
/** The account the key is the operator's credential for. */
|
|
25
|
+
readonly account: { readonly id: string; readonly name?: string };
|
|
26
|
+
/** This home's instance link on that server (`lnk_…`), one per key's subject. */
|
|
27
|
+
readonly instanceId: string;
|
|
28
|
+
/** Whether this instance is the account's default. */
|
|
29
|
+
readonly default: boolean;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const params: z.ZodType<RemoteLinkParams> = z
|
|
33
|
+
.object({
|
|
34
|
+
server: ServerOrigin,
|
|
35
|
+
key: z.string().min(20).max(512),
|
|
36
|
+
default: z.boolean().exactOptional(),
|
|
37
|
+
})
|
|
38
|
+
.register(wireRegistry, { id: "RemoteLinkParams" });
|
|
39
|
+
|
|
40
|
+
const result: z.ZodType<RemoteLinkResult> = z
|
|
41
|
+
.object({
|
|
42
|
+
server: ServerOrigin,
|
|
43
|
+
account: z.object({ id: z.string(), name: z.string().exactOptional() }),
|
|
44
|
+
instanceId: z.string(),
|
|
45
|
+
default: z.boolean(),
|
|
46
|
+
})
|
|
47
|
+
.register(wireRegistry, {
|
|
48
|
+
id: "RemoteLinkResult",
|
|
49
|
+
description: "A home linked to a remote server with an operator-issued key.",
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* `remote/link`: links this home to a remote server with a key its operator issued for an account,
|
|
54
|
+
* in place of `remote/login`'s device grant, so a program can run an always-on owner instance
|
|
55
|
+
* (WP-30, D167). Linking again with a key is idempotent by nature, so it takes no `requestId`: the
|
|
56
|
+
* ledger never records the key's digest. A key the server doesn't admit is
|
|
57
|
+
* `MOSTRA_REMOTE_LOGIN_FAILED`.
|
|
58
|
+
*/
|
|
59
|
+
export const remoteLinkMethod: MethodDefinition<RemoteLinkParams, RemoteLinkResult> = defineMethod({
|
|
60
|
+
method: "remote/link",
|
|
61
|
+
direction: "client-to-instance",
|
|
62
|
+
mutating: false,
|
|
63
|
+
params,
|
|
64
|
+
result,
|
|
65
|
+
});
|