@mostra/protocol 0.1.0 → 0.2.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/diagnostics/codes/host.d.ts +1 -1
- package/dist/diagnostics/codes/host.d.ts.map +1 -1
- package/dist/diagnostics/codes/host.js +12 -1
- package/dist/diagnostics/codes/host.js.map +1 -1
- package/dist/index.d.ts +4 -3
- package/dist/index.js +3 -2
- package/dist/method.d.ts +12 -0
- package/dist/method.d.ts.map +1 -1
- package/dist/method.js.map +1 -1
- package/dist/methods/index.d.ts +3 -1
- package/dist/methods/index.d.ts.map +1 -1
- package/dist/methods/index.js +22 -4
- package/dist/methods/index.js.map +1 -1
- package/dist/methods/mostra/initialize.d.ts +1 -1
- package/dist/methods/mostra/initialize.js.map +1 -1
- package/dist/methods/port/identity-resolve.d.ts +36 -0
- package/dist/methods/port/identity-resolve.d.ts.map +1 -0
- package/dist/methods/port/identity-resolve.js +35 -0
- package/dist/methods/port/identity-resolve.js.map +1 -0
- package/package.json +2 -2
- package/schemas/protocol.draft-07.json +413 -0
- package/schemas/protocol.schema.json +413 -0
- package/src/diagnostics/codes/host.ts +12 -0
- package/src/index.ts +9 -1
- package/src/method.ts +14 -0
- package/src/methods/index.ts +13 -3
- package/src/methods/mostra/initialize.ts +1 -1
- package/src/methods/port/identity-resolve.ts +67 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "../spec.js";
|
|
2
2
|
//#region src/diagnostics/codes/host.d.ts
|
|
3
3
|
/** The codes of the HOST area, in the order they were added. */
|
|
4
|
-
export declare const hostDiagnosticCodes: readonly ["MOSTRA_HOST_REVISION_UNSUPPORTED", "MOSTRA_HOST_MALFORMED", "MOSTRA_HOST_METHOD_UNKNOWN", "MOSTRA_HOST_INVALID_PARAMS", "MOSTRA_HOST_INTERNAL_ERROR", "MOSTRA_HOST_INITIALIZE_ORDER", "MOSTRA_HOST_PORT_UNSUPPORTED", "MOSTRA_HOST_CONNECTION_CLOSED", "MOSTRA_HOST_TIMEOUT", "MOSTRA_HOST_SHUTDOWN_REFUSED", "MOSTRA_HOST_REQUEST_ID_REUSED", "MOSTRA_HOST_CURSOR_COMPACTED", "MOSTRA_HOST_SUBSCRIPTION_UNKNOWN", "MOSTRA_HOST_NOTIFICATION_UNSUPPORTED", "MOSTRA_HOST_MESSAGE_TOO_LARGE"];
|
|
4
|
+
export declare const hostDiagnosticCodes: readonly ["MOSTRA_HOST_REVISION_UNSUPPORTED", "MOSTRA_HOST_MALFORMED", "MOSTRA_HOST_METHOD_UNKNOWN", "MOSTRA_HOST_INVALID_PARAMS", "MOSTRA_HOST_INTERNAL_ERROR", "MOSTRA_HOST_INITIALIZE_ORDER", "MOSTRA_HOST_PORT_UNSUPPORTED", "MOSTRA_HOST_CONNECTION_CLOSED", "MOSTRA_HOST_TIMEOUT", "MOSTRA_HOST_SHUTDOWN_REFUSED", "MOSTRA_HOST_REQUEST_ID_REUSED", "MOSTRA_HOST_CURSOR_COMPACTED", "MOSTRA_HOST_SUBSCRIPTION_UNKNOWN", "MOSTRA_HOST_NOTIFICATION_UNSUPPORTED", "MOSTRA_HOST_MESSAGE_TOO_LARGE", "MOSTRA_HOST_IDENTITY_UNAVAILABLE"];
|
|
5
5
|
/** The codes of the HOST area. */
|
|
6
6
|
export type HostDiagnosticCode = (typeof hostDiagnosticCodes)[number];
|
|
7
7
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"host.d.ts","names":[],"sources":["../../../src/diagnostics/codes/host.ts"],"mappings":";;;qBAMa;;
|
|
1
|
+
{"version":3,"file":"host.d.ts","names":[],"sources":["../../../src/diagnostics/codes/host.ts"],"mappings":";;;qBAMa;;YAqBD,6BAA6B"}
|
|
@@ -15,7 +15,8 @@ const hostDiagnosticCodes = [
|
|
|
15
15
|
"MOSTRA_HOST_CURSOR_COMPACTED",
|
|
16
16
|
"MOSTRA_HOST_SUBSCRIPTION_UNKNOWN",
|
|
17
17
|
"MOSTRA_HOST_NOTIFICATION_UNSUPPORTED",
|
|
18
|
-
"MOSTRA_HOST_MESSAGE_TOO_LARGE"
|
|
18
|
+
"MOSTRA_HOST_MESSAGE_TOO_LARGE",
|
|
19
|
+
"MOSTRA_HOST_IDENTITY_UNAVAILABLE"
|
|
19
20
|
];
|
|
20
21
|
/** The HOST area's catalog entries. */
|
|
21
22
|
const hostDiagnostics = {
|
|
@@ -168,6 +169,16 @@ const hostDiagnostics = {
|
|
|
168
169
|
explanation: "One host-protocol message is one line of JSON, and a line holds at most 64 Mi characters (`MAX_LINE_LENGTH`), so neither side buffers without bound. Mostra checks every message before it writes it: an answer that would be longer is replaced by this error, and a delivery whose envelope would be longer is recorded as undeliverable instead of being sent and retried forever.",
|
|
169
170
|
fix: "Read less per request (`events/read` with a smaller `limit`, `results/get` for one submission), and keep artifacts' values within the field and document limits."
|
|
170
171
|
}
|
|
172
|
+
},
|
|
173
|
+
MOSTRA_HOST_IDENTITY_UNAVAILABLE: {
|
|
174
|
+
severity: "error",
|
|
175
|
+
phase: "host",
|
|
176
|
+
title: "The host that identifies viewers didn't answer",
|
|
177
|
+
hint: "Start the host that serves this home's identity port, then open the link again.",
|
|
178
|
+
docs: {
|
|
179
|
+
explanation: "A host registered the `identity` port, so it decides who opens this home's links. When a link minted without a viewer was opened, that host failed, didn't answer within 5 seconds, gave an answer its schema refuses, or is expected (it lists `identity` in `HomeConfig.ports`) but not connected. Mostra refuses the link rather than let the session act as someone else.",
|
|
180
|
+
fix: "Start or reconnect the host, then open the link again. A link minted with `view/url`'s `viewer` names its person itself and never needs the port. To return the home to Mostra's own identity, have the host register without the port and clear its expected ports (`HomeConfig.ports: []`)."
|
|
181
|
+
}
|
|
171
182
|
}
|
|
172
183
|
};
|
|
173
184
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"host.js","names":[],"sources":["../../../src/diagnostics/codes/host.ts"],"sourcesContent":["/**\n * Diagnostic codes of the HOST area: the host protocol between clients and an instance.\n */\nimport type { AreaCatalog } from \"../spec.ts\";\n\n/** The codes of the HOST area, in the order they were added. */\nexport const hostDiagnosticCodes = [\n \"MOSTRA_HOST_REVISION_UNSUPPORTED\",\n \"MOSTRA_HOST_MALFORMED\",\n \"MOSTRA_HOST_METHOD_UNKNOWN\",\n \"MOSTRA_HOST_INVALID_PARAMS\",\n \"MOSTRA_HOST_INTERNAL_ERROR\",\n \"MOSTRA_HOST_INITIALIZE_ORDER\",\n \"MOSTRA_HOST_PORT_UNSUPPORTED\",\n \"MOSTRA_HOST_CONNECTION_CLOSED\",\n \"MOSTRA_HOST_TIMEOUT\",\n \"MOSTRA_HOST_SHUTDOWN_REFUSED\",\n \"MOSTRA_HOST_REQUEST_ID_REUSED\",\n \"MOSTRA_HOST_CURSOR_COMPACTED\",\n \"MOSTRA_HOST_SUBSCRIPTION_UNKNOWN\",\n \"MOSTRA_HOST_NOTIFICATION_UNSUPPORTED\",\n \"MOSTRA_HOST_MESSAGE_TOO_LARGE\",\n // gen:codes\n] as const;\n\n/** The codes of the HOST area. */\nexport type HostDiagnosticCode = (typeof hostDiagnosticCodes)[number];\n\n/** The HOST area's catalog entries. */\nexport const hostDiagnostics: AreaCatalog<HostDiagnosticCode> = {\n MOSTRA_HOST_REVISION_UNSUPPORTED: {\n severity: \"error\",\n phase: \"host\",\n title: \"No common host protocol revision\",\n hint: \"Run the client and the instance from the same Mostra release, for example with `mostra daemon restart`.\",\n docs: {\n explanation:\n \"A client and a Mostra instance agree on a host protocol revision when they connect (`mostra/initialize`). The client offers the revisions it speaks, and the instance picks the newest one it also supports. This code means the two lists have nothing in common, usually because the client and the running daemon come from Mostra releases far apart.\",\n fix: \"Restart the daemon so it runs the same release as the client: `mostra daemon restart`. Durable state survives the restart, and open views reconnect. A host that embeds Mostra updates its pinned Mostra runtime or its host library until both support a common revision.\",\n },\n },\n MOSTRA_HOST_MALFORMED: {\n severity: \"error\",\n phase: \"host\",\n title: \"Malformed protocol message\",\n hint: \"Send each message as one line of JSON holding a single JSON-RPC 2.0 request or notification.\",\n docs: {\n explanation:\n \"Every message on a Mostra connection is one line of JSON with one JSON-RPC 2.0 object. This code means a line wasn't valid JSON, wasn't a JSON-RPC 2.0 request or response, or was a batch (a JSON array), which revision `2026-10-10` doesn't accept. A client also reports it when a response doesn't match the method's result schema.\",\n fix: 'Encode one request per line with `\"jsonrpc\": \"2.0\"`, a `method`, an `id` for requests, and `params` as an object. Send several requests as separate lines instead of a batch.',\n },\n },\n MOSTRA_HOST_METHOD_UNKNOWN: {\n severity: \"error\",\n phase: \"host\",\n title: \"Unknown protocol method\",\n hint: \"Call only the methods listed in `capabilities.methods` of the `mostra/initialize` result.\",\n docs: {\n explanation:\n \"The instance doesn't serve the method that was called. Either the name is misspelled, or the client is newer than the instance and calls a method the instance's release doesn't have.\",\n fix: \"Check the method name against INTERFACES \\u00a76, and against `capabilities.methods` in the `mostra/initialize` result, which lists every method this instance serves. Upgrade the instance if the client needs a newer method.\",\n },\n },\n MOSTRA_HOST_INVALID_PARAMS: {\n severity: \"error\",\n phase: \"host\",\n title: \"Invalid method params\",\n hint: \"Fix the params named in the message so they match the method's schema.\",\n docs: {\n explanation:\n \"The request's `params` don't match the method's published schema: a required field is missing, a value has the wrong type, or a value is outside its allowed range. The message names the first problem found.\",\n fix: \"Compare the request with the method's schema in `@mostra/protocol` (or the published JSON Schema) and correct the field named in the message.\",\n },\n },\n MOSTRA_HOST_INTERNAL_ERROR: {\n severity: \"error\",\n phase: \"host\",\n title: \"Unexpected failure in the instance\",\n hint: \"Retry the request with the same request ID; if it fails again, report it with the instance's log.\",\n docs: {\n explanation:\n \"The instance failed while handling the request, for a reason that isn't one of its known conditions. Durable state is unaffected: a request is acknowledged only after its ledger transaction commits. The details are in the instance's log (`logs/supervisor.log` in the home), not in the response.\",\n fix: \"Retry the request with the same request ID; retries are idempotent. If the failure repeats, report it with the relevant lines of `logs/supervisor.log`.\",\n },\n },\n MOSTRA_HOST_INITIALIZE_ORDER: {\n severity: \"error\",\n phase: \"host\",\n title: \"Initialize first, and only once\",\n hint: \"Send `mostra/initialize` as the first request on the connection, and only once.\",\n docs: {\n explanation:\n \"Every connection starts with `mostra/initialize`, which agrees the protocol revision and registers the client's ports. The instance received another request before it, or a second `mostra/initialize` on the same connection.\",\n fix: \"Send `mostra/initialize` first and wait for its result before any other request. To renegotiate, open a new connection.\",\n },\n },\n MOSTRA_HOST_PORT_UNSUPPORTED: {\n severity: \"warning\",\n phase: \"host\",\n title: \"Port not supported by this instance\",\n hint: \"Leave the port out of `mostra/initialize`, or run a Mostra release that lists it in `capabilities.ports`.\",\n docs: {\n explanation:\n \"The client registered a port this instance doesn't call, so registering it has no effect. The port may be reserved for a later release (such as `ai`), or the client may be newer than the instance. The session continues without the port, and Mostra uses its standalone behavior instead.\",\n fix: \"Register only the ports listed in `capabilities.ports` of the `mostra/initialize` result. If the host needs the port, upgrade the instance to a release that supports it.\",\n },\n },\n MOSTRA_HOST_CONNECTION_CLOSED: {\n severity: \"error\",\n phase: \"host\",\n title: \"Connection closed\",\n hint: \"Reconnect, then retry the request with the same request ID.\",\n docs: {\n explanation:\n \"The connection to the other side closed before a response arrived, for example because the instance exited or restarted. The request may or may not have taken effect.\",\n fix: \"Reconnect and send `mostra/initialize` again, then retry the request with the same request ID. Mutating methods are idempotent by request ID, so a retry never applies twice.\",\n },\n },\n MOSTRA_HOST_TIMEOUT: {\n severity: \"error\",\n phase: \"host\",\n title: \"Request timed out\",\n hint: \"Retry the request with the same request ID, or allow it more time.\",\n docs: {\n explanation:\n \"No response arrived within the time the caller allowed. The other side may still be working on the request, and it may still take effect.\",\n fix: \"Retry with the same request ID, which returns the recorded result if the first attempt completed. Allow a longer timeout for slow operations.\",\n },\n },\n MOSTRA_HOST_SHUTDOWN_REFUSED: {\n severity: \"error\",\n phase: \"host\",\n title: \"Only the spawning host can stop this instance\",\n hint: \"Ask the host that started this instance to stop it, or end the connection you opened instead.\",\n docs: {\n explanation:\n \"An instance started by a host over stdio (`mostra host`) lives as long as that host's connection, so only the host may stop it with `mostra/shutdown`. A client that attached through the home's socket asked it to stop. A daemon (`mostra daemon`) accepts `mostra/shutdown` from every attached client (D87).\",\n fix: \"Close your own connection when you are done. To stop the instance, stop the host that spawned it, or have the host send `mostra/shutdown` or close its stdio.\",\n },\n },\n MOSTRA_HOST_REQUEST_ID_REUSED: {\n severity: \"error\",\n phase: \"host\",\n title: \"A requestId was reused with other parameters\",\n hint: \"Send a new `requestId` for a new request; repeat the exact parameters only to retry one.\",\n docs: {\n explanation:\n \"A mutating method recorded its result under this `requestId` for different parameters. Replaying that result would answer a request nobody made (a link for another artifact or with other scopes, another source's publish), so the instance refuses (H-03). Retries with the same parameters still return the recorded result.\",\n fix: \"Generate a fresh `requestId` for every new request, and reuse one only to retry the same request after a timeout or a lost connection.\",\n },\n },\n MOSTRA_HOST_CURSOR_COMPACTED: {\n severity: \"error\",\n phase: \"host\",\n title: \"Events compacted\",\n hint: \"Read from the cursor in the message to receive the compaction summary, then continue from there.\",\n docs: {\n explanation:\n \"Events before a cursor were compacted on request (`mostra gc --compact-events`, DATA_MODEL §4): an artifact's old events were replaced by one `artifact.compacted` event that summarizes them. A reader asking for events after an earlier cursor would miss some, and Mostra never leaves a silent gap.\",\n fix: \"Read again with `after` set to the cursor the message names: the next event is the `artifact.compacted` summary. Rebuild what you track from it and continue as usual.\",\n },\n },\n MOSTRA_HOST_SUBSCRIPTION_UNKNOWN: {\n severity: \"error\",\n phase: \"host\",\n title: \"Unknown subscription\",\n hint: \"Subscribe again with `events/subscribe`, then use the ID it returns.\",\n docs: {\n explanation:\n \"The subscription ID belongs to no subscription on this connection: it was never created here, was ended with `events/unsubscribe`, or belonged to a connection that closed. Subscriptions live as long as their connection; a named subscriber's acknowledged cursor outlives it.\",\n fix: \"Call `events/subscribe` again on this connection. With the same `name`, delivery resumes after the last acknowledged cursor.\",\n },\n },\n MOSTRA_HOST_NOTIFICATION_UNSUPPORTED: {\n severity: \"error\",\n phase: \"host\",\n title: \"Notification not accepted\",\n hint: \"List the notification in `capabilities.notifications` when you initialize.\",\n docs: {\n explanation:\n \"Mostra sends a client only the notifications it listed in `mostra/initialize` (D84). This method would send one the client didn't list, such as `events/notify` for `events/subscribe`.\",\n fix: 'Reconnect and initialize with `capabilities: { notifications: [\"events/notify\"] }`, or poll with `events/read` instead.',\n },\n },\n MOSTRA_HOST_MESSAGE_TOO_LARGE: {\n severity: \"error\",\n phase: \"host\",\n title: \"Message too large for the protocol\",\n hint: \"Ask for less at once: a specific submission, fewer events, or smaller values.\",\n docs: {\n explanation:\n \"One host-protocol message is one line of JSON, and a line holds at most 64 Mi characters (`MAX_LINE_LENGTH`), so neither side buffers without bound. Mostra checks every message before it writes it: an answer that would be longer is replaced by this error, and a delivery whose envelope would be longer is recorded as undeliverable instead of being sent and retried forever.\",\n fix: \"Read less per request (`events/read` with a smaller `limit`, `results/get` for one submission), and keep artifacts' values within the field and document limits.\",\n },\n },\n // gen:entries\n};\n"],"mappings":";;AAMA,MAAa,sBAAsB;CACjC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AAEF;;AAMA,MAAa,kBAAmD;CAC9D,kCAAkC;EAChC,UAAU;EACV,OAAO;EACP,OAAO;EACP,MAAM;EACN,MAAM;GACJ,aACE;GACF,KAAK;EACP;CACF;CACA,uBAAuB;EACrB,UAAU;EACV,OAAO;EACP,OAAO;EACP,MAAM;EACN,MAAM;GACJ,aACE;GACF,KAAK;EACP;CACF;CACA,4BAA4B;EAC1B,UAAU;EACV,OAAO;EACP,OAAO;EACP,MAAM;EACN,MAAM;GACJ,aACE;GACF,KAAK;EACP;CACF;CACA,4BAA4B;EAC1B,UAAU;EACV,OAAO;EACP,OAAO;EACP,MAAM;EACN,MAAM;GACJ,aACE;GACF,KAAK;EACP;CACF;CACA,4BAA4B;EAC1B,UAAU;EACV,OAAO;EACP,OAAO;EACP,MAAM;EACN,MAAM;GACJ,aACE;GACF,KAAK;EACP;CACF;CACA,8BAA8B;EAC5B,UAAU;EACV,OAAO;EACP,OAAO;EACP,MAAM;EACN,MAAM;GACJ,aACE;GACF,KAAK;EACP;CACF;CACA,8BAA8B;EAC5B,UAAU;EACV,OAAO;EACP,OAAO;EACP,MAAM;EACN,MAAM;GACJ,aACE;GACF,KAAK;EACP;CACF;CACA,+BAA+B;EAC7B,UAAU;EACV,OAAO;EACP,OAAO;EACP,MAAM;EACN,MAAM;GACJ,aACE;GACF,KAAK;EACP;CACF;CACA,qBAAqB;EACnB,UAAU;EACV,OAAO;EACP,OAAO;EACP,MAAM;EACN,MAAM;GACJ,aACE;GACF,KAAK;EACP;CACF;CACA,8BAA8B;EAC5B,UAAU;EACV,OAAO;EACP,OAAO;EACP,MAAM;EACN,MAAM;GACJ,aACE;GACF,KAAK;EACP;CACF;CACA,+BAA+B;EAC7B,UAAU;EACV,OAAO;EACP,OAAO;EACP,MAAM;EACN,MAAM;GACJ,aACE;GACF,KAAK;EACP;CACF;CACA,8BAA8B;EAC5B,UAAU;EACV,OAAO;EACP,OAAO;EACP,MAAM;EACN,MAAM;GACJ,aACE;GACF,KAAK;EACP;CACF;CACA,kCAAkC;EAChC,UAAU;EACV,OAAO;EACP,OAAO;EACP,MAAM;EACN,MAAM;GACJ,aACE;GACF,KAAK;EACP;CACF;CACA,sCAAsC;EACpC,UAAU;EACV,OAAO;EACP,OAAO;EACP,MAAM;EACN,MAAM;GACJ,aACE;GACF,KAAK;EACP;CACF;CACA,+BAA+B;EAC7B,UAAU;EACV,OAAO;EACP,OAAO;EACP,MAAM;EACN,MAAM;GACJ,aACE;GACF,KAAK;EACP;CACF;AAEF"}
|
|
1
|
+
{"version":3,"file":"host.js","names":[],"sources":["../../../src/diagnostics/codes/host.ts"],"sourcesContent":["/**\n * Diagnostic codes of the HOST area: the host protocol between clients and an instance.\n */\nimport type { AreaCatalog } from \"../spec.ts\";\n\n/** The codes of the HOST area, in the order they were added. */\nexport const hostDiagnosticCodes = [\n \"MOSTRA_HOST_REVISION_UNSUPPORTED\",\n \"MOSTRA_HOST_MALFORMED\",\n \"MOSTRA_HOST_METHOD_UNKNOWN\",\n \"MOSTRA_HOST_INVALID_PARAMS\",\n \"MOSTRA_HOST_INTERNAL_ERROR\",\n \"MOSTRA_HOST_INITIALIZE_ORDER\",\n \"MOSTRA_HOST_PORT_UNSUPPORTED\",\n \"MOSTRA_HOST_CONNECTION_CLOSED\",\n \"MOSTRA_HOST_TIMEOUT\",\n \"MOSTRA_HOST_SHUTDOWN_REFUSED\",\n \"MOSTRA_HOST_REQUEST_ID_REUSED\",\n \"MOSTRA_HOST_CURSOR_COMPACTED\",\n \"MOSTRA_HOST_SUBSCRIPTION_UNKNOWN\",\n \"MOSTRA_HOST_NOTIFICATION_UNSUPPORTED\",\n \"MOSTRA_HOST_MESSAGE_TOO_LARGE\",\n \"MOSTRA_HOST_IDENTITY_UNAVAILABLE\",\n // gen:codes\n] as const;\n\n/** The codes of the HOST area. */\nexport type HostDiagnosticCode = (typeof hostDiagnosticCodes)[number];\n\n/** The HOST area's catalog entries. */\nexport const hostDiagnostics: AreaCatalog<HostDiagnosticCode> = {\n MOSTRA_HOST_REVISION_UNSUPPORTED: {\n severity: \"error\",\n phase: \"host\",\n title: \"No common host protocol revision\",\n hint: \"Run the client and the instance from the same Mostra release, for example with `mostra daemon restart`.\",\n docs: {\n explanation:\n \"A client and a Mostra instance agree on a host protocol revision when they connect (`mostra/initialize`). The client offers the revisions it speaks, and the instance picks the newest one it also supports. This code means the two lists have nothing in common, usually because the client and the running daemon come from Mostra releases far apart.\",\n fix: \"Restart the daemon so it runs the same release as the client: `mostra daemon restart`. Durable state survives the restart, and open views reconnect. A host that embeds Mostra updates its pinned Mostra runtime or its host library until both support a common revision.\",\n },\n },\n MOSTRA_HOST_MALFORMED: {\n severity: \"error\",\n phase: \"host\",\n title: \"Malformed protocol message\",\n hint: \"Send each message as one line of JSON holding a single JSON-RPC 2.0 request or notification.\",\n docs: {\n explanation:\n \"Every message on a Mostra connection is one line of JSON with one JSON-RPC 2.0 object. This code means a line wasn't valid JSON, wasn't a JSON-RPC 2.0 request or response, or was a batch (a JSON array), which revision `2026-10-10` doesn't accept. A client also reports it when a response doesn't match the method's result schema.\",\n fix: 'Encode one request per line with `\"jsonrpc\": \"2.0\"`, a `method`, an `id` for requests, and `params` as an object. Send several requests as separate lines instead of a batch.',\n },\n },\n MOSTRA_HOST_METHOD_UNKNOWN: {\n severity: \"error\",\n phase: \"host\",\n title: \"Unknown protocol method\",\n hint: \"Call only the methods listed in `capabilities.methods` of the `mostra/initialize` result.\",\n docs: {\n explanation:\n \"The instance doesn't serve the method that was called. Either the name is misspelled, or the client is newer than the instance and calls a method the instance's release doesn't have.\",\n fix: \"Check the method name against INTERFACES \\u00a76, and against `capabilities.methods` in the `mostra/initialize` result, which lists every method this instance serves. Upgrade the instance if the client needs a newer method.\",\n },\n },\n MOSTRA_HOST_INVALID_PARAMS: {\n severity: \"error\",\n phase: \"host\",\n title: \"Invalid method params\",\n hint: \"Fix the params named in the message so they match the method's schema.\",\n docs: {\n explanation:\n \"The request's `params` don't match the method's published schema: a required field is missing, a value has the wrong type, or a value is outside its allowed range. The message names the first problem found.\",\n fix: \"Compare the request with the method's schema in `@mostra/protocol` (or the published JSON Schema) and correct the field named in the message.\",\n },\n },\n MOSTRA_HOST_INTERNAL_ERROR: {\n severity: \"error\",\n phase: \"host\",\n title: \"Unexpected failure in the instance\",\n hint: \"Retry the request with the same request ID; if it fails again, report it with the instance's log.\",\n docs: {\n explanation:\n \"The instance failed while handling the request, for a reason that isn't one of its known conditions. Durable state is unaffected: a request is acknowledged only after its ledger transaction commits. The details are in the instance's log (`logs/supervisor.log` in the home), not in the response.\",\n fix: \"Retry the request with the same request ID; retries are idempotent. If the failure repeats, report it with the relevant lines of `logs/supervisor.log`.\",\n },\n },\n MOSTRA_HOST_INITIALIZE_ORDER: {\n severity: \"error\",\n phase: \"host\",\n title: \"Initialize first, and only once\",\n hint: \"Send `mostra/initialize` as the first request on the connection, and only once.\",\n docs: {\n explanation:\n \"Every connection starts with `mostra/initialize`, which agrees the protocol revision and registers the client's ports. The instance received another request before it, or a second `mostra/initialize` on the same connection.\",\n fix: \"Send `mostra/initialize` first and wait for its result before any other request. To renegotiate, open a new connection.\",\n },\n },\n MOSTRA_HOST_PORT_UNSUPPORTED: {\n severity: \"warning\",\n phase: \"host\",\n title: \"Port not supported by this instance\",\n hint: \"Leave the port out of `mostra/initialize`, or run a Mostra release that lists it in `capabilities.ports`.\",\n docs: {\n explanation:\n \"The client registered a port this instance doesn't call, so registering it has no effect. The port may be reserved for a later release (such as `ai`), or the client may be newer than the instance. The session continues without the port, and Mostra uses its standalone behavior instead.\",\n fix: \"Register only the ports listed in `capabilities.ports` of the `mostra/initialize` result. If the host needs the port, upgrade the instance to a release that supports it.\",\n },\n },\n MOSTRA_HOST_CONNECTION_CLOSED: {\n severity: \"error\",\n phase: \"host\",\n title: \"Connection closed\",\n hint: \"Reconnect, then retry the request with the same request ID.\",\n docs: {\n explanation:\n \"The connection to the other side closed before a response arrived, for example because the instance exited or restarted. The request may or may not have taken effect.\",\n fix: \"Reconnect and send `mostra/initialize` again, then retry the request with the same request ID. Mutating methods are idempotent by request ID, so a retry never applies twice.\",\n },\n },\n MOSTRA_HOST_TIMEOUT: {\n severity: \"error\",\n phase: \"host\",\n title: \"Request timed out\",\n hint: \"Retry the request with the same request ID, or allow it more time.\",\n docs: {\n explanation:\n \"No response arrived within the time the caller allowed. The other side may still be working on the request, and it may still take effect.\",\n fix: \"Retry with the same request ID, which returns the recorded result if the first attempt completed. Allow a longer timeout for slow operations.\",\n },\n },\n MOSTRA_HOST_SHUTDOWN_REFUSED: {\n severity: \"error\",\n phase: \"host\",\n title: \"Only the spawning host can stop this instance\",\n hint: \"Ask the host that started this instance to stop it, or end the connection you opened instead.\",\n docs: {\n explanation:\n \"An instance started by a host over stdio (`mostra host`) lives as long as that host's connection, so only the host may stop it with `mostra/shutdown`. A client that attached through the home's socket asked it to stop. A daemon (`mostra daemon`) accepts `mostra/shutdown` from every attached client (D87).\",\n fix: \"Close your own connection when you are done. To stop the instance, stop the host that spawned it, or have the host send `mostra/shutdown` or close its stdio.\",\n },\n },\n MOSTRA_HOST_REQUEST_ID_REUSED: {\n severity: \"error\",\n phase: \"host\",\n title: \"A requestId was reused with other parameters\",\n hint: \"Send a new `requestId` for a new request; repeat the exact parameters only to retry one.\",\n docs: {\n explanation:\n \"A mutating method recorded its result under this `requestId` for different parameters. Replaying that result would answer a request nobody made (a link for another artifact or with other scopes, another source's publish), so the instance refuses (H-03). Retries with the same parameters still return the recorded result.\",\n fix: \"Generate a fresh `requestId` for every new request, and reuse one only to retry the same request after a timeout or a lost connection.\",\n },\n },\n MOSTRA_HOST_CURSOR_COMPACTED: {\n severity: \"error\",\n phase: \"host\",\n title: \"Events compacted\",\n hint: \"Read from the cursor in the message to receive the compaction summary, then continue from there.\",\n docs: {\n explanation:\n \"Events before a cursor were compacted on request (`mostra gc --compact-events`, DATA_MODEL §4): an artifact's old events were replaced by one `artifact.compacted` event that summarizes them. A reader asking for events after an earlier cursor would miss some, and Mostra never leaves a silent gap.\",\n fix: \"Read again with `after` set to the cursor the message names: the next event is the `artifact.compacted` summary. Rebuild what you track from it and continue as usual.\",\n },\n },\n MOSTRA_HOST_SUBSCRIPTION_UNKNOWN: {\n severity: \"error\",\n phase: \"host\",\n title: \"Unknown subscription\",\n hint: \"Subscribe again with `events/subscribe`, then use the ID it returns.\",\n docs: {\n explanation:\n \"The subscription ID belongs to no subscription on this connection: it was never created here, was ended with `events/unsubscribe`, or belonged to a connection that closed. Subscriptions live as long as their connection; a named subscriber's acknowledged cursor outlives it.\",\n fix: \"Call `events/subscribe` again on this connection. With the same `name`, delivery resumes after the last acknowledged cursor.\",\n },\n },\n MOSTRA_HOST_NOTIFICATION_UNSUPPORTED: {\n severity: \"error\",\n phase: \"host\",\n title: \"Notification not accepted\",\n hint: \"List the notification in `capabilities.notifications` when you initialize.\",\n docs: {\n explanation:\n \"Mostra sends a client only the notifications it listed in `mostra/initialize` (D84). This method would send one the client didn't list, such as `events/notify` for `events/subscribe`.\",\n fix: 'Reconnect and initialize with `capabilities: { notifications: [\"events/notify\"] }`, or poll with `events/read` instead.',\n },\n },\n MOSTRA_HOST_MESSAGE_TOO_LARGE: {\n severity: \"error\",\n phase: \"host\",\n title: \"Message too large for the protocol\",\n hint: \"Ask for less at once: a specific submission, fewer events, or smaller values.\",\n docs: {\n explanation:\n \"One host-protocol message is one line of JSON, and a line holds at most 64 Mi characters (`MAX_LINE_LENGTH`), so neither side buffers without bound. Mostra checks every message before it writes it: an answer that would be longer is replaced by this error, and a delivery whose envelope would be longer is recorded as undeliverable instead of being sent and retried forever.\",\n fix: \"Read less per request (`events/read` with a smaller `limit`, `results/get` for one submission), and keep artifacts' values within the field and document limits.\",\n },\n },\n MOSTRA_HOST_IDENTITY_UNAVAILABLE: {\n severity: \"error\",\n phase: \"host\",\n title: \"The host that identifies viewers didn't answer\",\n hint: \"Start the host that serves this home's identity port, then open the link again.\",\n docs: {\n explanation:\n \"A host registered the `identity` port, so it decides who opens this home's links. When a link minted without a viewer was opened, that host failed, didn't answer within 5 seconds, gave an answer its schema refuses, or is expected (it lists `identity` in `HomeConfig.ports`) but not connected. Mostra refuses the link rather than let the session act as someone else.\",\n fix: \"Start or reconnect the host, then open the link again. A link minted with `view/url`'s `viewer` names its person itself and never needs the port. To return the home to Mostra's own identity, have the host register without the port and clear its expected ports (`HomeConfig.ports: []`).\",\n },\n },\n // gen:entries\n};\n"],"mappings":";;AAMA,MAAa,sBAAsB;CACjC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AAEF;;AAMA,MAAa,kBAAmD;CAC9D,kCAAkC;EAChC,UAAU;EACV,OAAO;EACP,OAAO;EACP,MAAM;EACN,MAAM;GACJ,aACE;GACF,KAAK;EACP;CACF;CACA,uBAAuB;EACrB,UAAU;EACV,OAAO;EACP,OAAO;EACP,MAAM;EACN,MAAM;GACJ,aACE;GACF,KAAK;EACP;CACF;CACA,4BAA4B;EAC1B,UAAU;EACV,OAAO;EACP,OAAO;EACP,MAAM;EACN,MAAM;GACJ,aACE;GACF,KAAK;EACP;CACF;CACA,4BAA4B;EAC1B,UAAU;EACV,OAAO;EACP,OAAO;EACP,MAAM;EACN,MAAM;GACJ,aACE;GACF,KAAK;EACP;CACF;CACA,4BAA4B;EAC1B,UAAU;EACV,OAAO;EACP,OAAO;EACP,MAAM;EACN,MAAM;GACJ,aACE;GACF,KAAK;EACP;CACF;CACA,8BAA8B;EAC5B,UAAU;EACV,OAAO;EACP,OAAO;EACP,MAAM;EACN,MAAM;GACJ,aACE;GACF,KAAK;EACP;CACF;CACA,8BAA8B;EAC5B,UAAU;EACV,OAAO;EACP,OAAO;EACP,MAAM;EACN,MAAM;GACJ,aACE;GACF,KAAK;EACP;CACF;CACA,+BAA+B;EAC7B,UAAU;EACV,OAAO;EACP,OAAO;EACP,MAAM;EACN,MAAM;GACJ,aACE;GACF,KAAK;EACP;CACF;CACA,qBAAqB;EACnB,UAAU;EACV,OAAO;EACP,OAAO;EACP,MAAM;EACN,MAAM;GACJ,aACE;GACF,KAAK;EACP;CACF;CACA,8BAA8B;EAC5B,UAAU;EACV,OAAO;EACP,OAAO;EACP,MAAM;EACN,MAAM;GACJ,aACE;GACF,KAAK;EACP;CACF;CACA,+BAA+B;EAC7B,UAAU;EACV,OAAO;EACP,OAAO;EACP,MAAM;EACN,MAAM;GACJ,aACE;GACF,KAAK;EACP;CACF;CACA,8BAA8B;EAC5B,UAAU;EACV,OAAO;EACP,OAAO;EACP,MAAM;EACN,MAAM;GACJ,aACE;GACF,KAAK;EACP;CACF;CACA,kCAAkC;EAChC,UAAU;EACV,OAAO;EACP,OAAO;EACP,MAAM;EACN,MAAM;GACJ,aACE;GACF,KAAK;EACP;CACF;CACA,sCAAsC;EACpC,UAAU;EACV,OAAO;EACP,OAAO;EACP,MAAM;EACN,MAAM;GACJ,aACE;GACF,KAAK;EACP;CACF;CACA,+BAA+B;EAC7B,UAAU;EACV,OAAO;EACP,OAAO;EACP,MAAM;EACN,MAAM;GACJ,aACE;GACF,KAAK;EACP;CACF;CACA,kCAAkC;EAChC,UAAU;EACV,OAAO;EACP,OAAO;EACP,MAAM;EACN,MAAM;GACJ,aACE;GACF,KAAK;EACP;CACF;AAEF"}
|
package/dist/index.d.ts
CHANGED
|
@@ -39,7 +39,7 @@ import { TypeDiagnosticCode, typeDiagnosticCodes } from "./diagnostics/codes/typ
|
|
|
39
39
|
import { VerifyDiagnosticCode, verifyDiagnosticCodes } from "./diagnostics/codes/verify.js";
|
|
40
40
|
import { CreateDiagnosticOptions, KnownDiagnosticCode, createDiagnostic, diagnosticCatalog } from "./diagnostics/codes/index.js";
|
|
41
41
|
import { CSRF_HEADER, Refusal, RequestFacts, RequestIntent, RequestPolicy, checkRequest, headerValue, isJsonContentType, refusal, safeEqual, safePath } from "./hygiene.js";
|
|
42
|
-
import { AnyMethod, MethodDefinition, MethodDirection, defineMethod } from "./method.js";
|
|
42
|
+
import { AnyMethod, AnyNotification, MethodDefinition, MethodDirection, NotificationDefinition, defineMethod } from "./method.js";
|
|
43
43
|
import { ArtifactCreateParams, ArtifactCreateResult, artifactCreateMethod } from "./methods/artifact/create.js";
|
|
44
44
|
import { ArtifactGetParams, ArtifactGetResult, artifactGetMethod } from "./methods/artifact/get.js";
|
|
45
45
|
import { ArtifactListFilter, ArtifactListParams, ArtifactListResult, artifactListMethod } from "./methods/artifact/list.js";
|
|
@@ -54,7 +54,7 @@ import { EVENTS_READ_MAX, EventsReadParams, EventsReadResult, eventsReadMethod }
|
|
|
54
54
|
import { EVENTS_NOTIFY, EventsNotifyParams, EventsSubscribeParams, EventsSubscribeResult, eventsSubscribeMethod } from "./methods/events/subscribe.js";
|
|
55
55
|
import { EventsUnsubscribeParams, EventsUnsubscribeResult, eventsUnsubscribeMethod } from "./methods/events/unsubscribe.js";
|
|
56
56
|
import { GcCompactEvents, GcCompacted, GcCount, GcRunParams, GcRunResult, GcVersion, gcRunMethod } from "./methods/gc/run.js";
|
|
57
|
-
import { hostMethods } from "./methods/index.js";
|
|
57
|
+
import { hostMethods, hostNotifications } from "./methods/index.js";
|
|
58
58
|
import { InstanceCheck, InstanceCheckParams, InstanceCheckResult, instanceCheckMethod } from "./methods/instance/check.js";
|
|
59
59
|
import { HOST_PROTOCOL_REVISIONS, Revision, RevisionNegotiation, negotiateRevision } from "./revision.js";
|
|
60
60
|
import { CLI_CLIENT_NAME, ClientCapabilities, ClientInfo, DependencyPolicy, HomeConfig, InstanceCapabilities, InstanceInfo, MostraInitializeParams, MostraInitializeResult, PortName, mostraInitializeMethod } from "./methods/mostra/initialize.js";
|
|
@@ -62,6 +62,7 @@ import { ChildProcessStatus, DeliveryCounts, GatewayStatus, InstanceStatusParams
|
|
|
62
62
|
import { LivePushParams, LivePushResult, livePushMethod } from "./methods/live/push.js";
|
|
63
63
|
import { MostraShutdownParams, MostraShutdownResult, mostraShutdownMethod } from "./methods/mostra/shutdown.js";
|
|
64
64
|
import { DraftMirror, DraftsMirrorResult, portDraftsMirrorMethod } from "./methods/port/drafts-mirror.js";
|
|
65
|
+
import { IdentityVia, PortIdentityResolveParams, PortIdentityResolveResult, portIdentityResolveMethod } from "./methods/port/identity-resolve.js";
|
|
65
66
|
import { PortSecretsGetParams, PortSecretsGetResult, portSecretsGetMethod } from "./methods/port/secrets-get.js";
|
|
66
67
|
import { SubmissionEnvelope, SubmissionsDeliverResult, portSubmissionsDeliverMethod } from "./methods/port/submissions-deliver.js";
|
|
67
68
|
import { PortTrustedControlsActivatedParams, PortTrustedControlsActivatedResult, portTrustedControlsActivatedMethod } from "./methods/port/trusted-controls-activated.js";
|
|
@@ -83,4 +84,4 @@ import { JSON_RPC_ERROR_CODES, RpcError } from "./rpc/error.js";
|
|
|
83
84
|
import { LineSplitter, MAX_LINE_LENGTH, encodeLine } from "./rpc/lines.js";
|
|
84
85
|
import { RpcPeer, RpcPeerOptions, RpcRequestContext, RpcRequestOptions, parseParams } from "./rpc/peer.js";
|
|
85
86
|
import { CallContext, DEFAULT_WORKER_LIMITS, LiveSourceInfo, ServerEmitParams, ServerLiveValueParams, ServerLogParams, ServerProgressParams, ServerSecretParams, ServerSignalParams, ServerStateGetParams, ServerStatePatchParams, ServerStatePatchResult, WORKER_CHANNEL_REVISION, WORKER_METHODS, WorkerBatchParams, WorkerCallOutcome, WorkerCallParams, WorkerCancelParams, WorkerLimits, WorkerLiveParams, WorkerPingResult, WorkerStartParams, WorkerStartResult, WorkerVersionRef } from "./worker.js";
|
|
86
|
-
export { type A11yDiagnosticCode, ACTION_ARGS_MAX, ACTION_RESULT_MAX, ALL_SCOPES, ARGUMENT_BIGINT_DIGITS_MAX, ARTIFACT_MANIFEST_KEYS, ARTIFACT_PROGRESS, type ActionDiagnosticCode, ActionError, Actor, AddedPackage, type AnyBridgeMessage, type AnyFunction, type AnyMethod, type AreaCatalog, type ArtifactCreateParams, type ArtifactCreateResult, ArtifactDetail, type ArtifactDiagnosticCode, type ArtifactFamily, type ArtifactGetParams, type ArtifactGetResult, ArtifactId, ArtifactLink, type ArtifactListFilter, type ArtifactListParams, type ArtifactListResult, ArtifactManifest, ArtifactProgressParams, type ArtifactPublishParams, type ArtifactPublishResult, ArtifactRef, ArtifactSummary, type ArtifactVerifyParams, type ArtifactVerifyResult, BRIDGE_FIELDS_MAX, BRIDGE_MESSAGES, BRIDGE_TEXT_MAX, BROWSER_PROTOCOL_REVISION, BROWSER_PROTOCOL_REVISIONS, BUNDLE_NAME, BUNDLE_PLATFORMS, BUNDLE_SETUP_MARKER, Batches, type Bridge, type BridgeEvent, type BridgeHostContext, type BridgeImplementation, type BridgeMessage, type BridgeOptions, type BridgePeer, type BridgeReceiver, type BridgeRejection, type BridgeSide, type BuildDiagnosticCode, BundleAsset, BundleBrowser, BundleFileEntry, BundleFiles, BundleInfo, BundleLinkEntry, BundlePins, type BundlePlatform, BundlePlatformSchema, BundleSetup, CLI_CLIENT_NAME, CONTROL_LABEL_MAX, CSRF_HEADER, type CallContext, type CallLine, CallRequest, CapabilityLink, CapabilityScope, CarryOver, ChildProcessStatus, ChooseRequest, type ClassifiedMessage, type CliDiagnosticCode, ClientCapabilities, ClientInfo, CommentId, type CompareRequest, type CompareResult, type ConsoleDiagnosticCode, type ControlRequest, ControlsPolicy, type CreateDiagnosticOptions, Cursor, DEFAULT_DOCS_BASE, DEFAULT_VIEWPORTS, DEFAULT_WORKER_LIMITS, DEV_NOTIFY, DIAGNOSTIC_AREAS, DeliveryCounts, DeliveryId, type DeliveryState, DeliveryStatus, type DeliveryTarget, type DemoSpec, type DepDiagnosticCode, DependencyPolicy, type DepsAddParams, type DepsAddResult, type DevEventKind, DevNotifyParams, type DevStartParams, type DevStartResult, type DevStopParams, type DevStopResult, Diagnostic, type DiagnosticArea, type DiagnosticCode, type DiagnosticDetails, DiagnosticFix, DiagnosticLocation, DiagnosticPhase, DiagnosticSeverity, type DiagnosticSpec, DocumentRevision, DocumentSnapshot, DraftMirror, type DraftsMirrorResult, Duration, EVENTS_NOTIFY, EVENTS_READ_MAX, type EnvDiagnosticCode, type EphemeralMessage, EventFilter, EventRecord, EventTypePattern, type EventsAckParams, type EventsAckResult, EventsNotifyParams, type EventsReadParams, type EventsReadResult, type EventsSubscribeParams, type EventsSubscribeResult, type EventsUnsubscribeParams, type EventsUnsubscribeResult, FIELD_ID_MAX_LENGTH, FieldConflict, type FieldDiagnosticCode, FieldOp, type FieldRegistration, type FieldScope, FieldState, type FieldsParams, FieldsRequest, type FlushResult, FollowRequest, type Frame, FrameTicket, GatewayStatus, type GcCompactEvents, type GcCompacted, type GcCount, type GcRunParams, type GcRunResult, type GcVersion, type GeneratedIdKind, HOST_PROTOCOL_REVISIONS, HomeConfig, type HomeDiagnosticCode, type HostDiagnosticCode, type HygieneDiagnosticCode, type Id, type IdBody, type IdKind, type IdPrefix, InstanceCapabilities, type InstanceCheck, type InstanceCheckParams, type InstanceCheckResult, InstanceInfo, type InstanceStatusParams, type InstanceStatusResult, JSON_RPC_ERROR_CODES, JsonRpcErrorObject, JsonRpcFailure, type JsonRpcId, type JsonRpcMessage, JsonRpcNotification, type JsonRpcParams, JsonRpcRequest, type JsonRpcResponse, JsonRpcSuccess, type KnownDiagnosticCode, LIVE_KEY_PATTERN, LIVE_RING_DEFAULT, LIVE_RING_MAX, LIVE_VALUE_MAX, LineSplitter, type LiveDiagnosticCode, type LivePushParams, type LivePushResult, LiveRequest, type LiveSourceInfo, type LiveState, type LiveUpdate, MAX_LINE_LENGTH, MCP_APPS_PROTOCOL_VERSION, type ManifestDiagnosticCode, type MethodDefinition, type MethodDirection, type MostraInitializeParams, type MostraInitializeResult, type MostraShutdownParams, type MostraShutdownResult, MutationId, MutationResult, type NetworkDiagnosticCode, OPEN_LINK_SCHEMES, OrphanedField, type PlatformDiagnosticCode, PollResult, PortName, type PortSecretsGetParams, type PortSecretsGetResult, type PortTrustedControlsActivatedParams, type PortTrustedControlsActivatedResult, type PortTrustedControlsPolicyParams, type PortTrustedControlsPolicyResult, type ProbedField, type PublishDiagnosticCode, PublishReceipt, REVIEW_SET_ID_PATTERN, RUN_KEY_MAX, RUN_LOG_MAX, RUN_LOG_TRUNCATED, RUN_STATUSES, type Rect, type Refusal, type RegressionDiagnosticCode, RemoteError, type RenderRequest, type RenderResult, type RequestFacts, type RequestIntent, type RequestPolicy, ResultComment, Results, type ResultsGetParams, type ResultsGetResult, ResultsMarkdown, Revision, type RevisionNegotiation, RpcError, RpcPeer, type RpcPeerOptions, type RpcRequestContext, type RpcRequestOptions, RunAttachRequest, RunCancelRequest, type RunDelta, RunId, RunProgress, type RunReason, RunRequest, RunState, type RunStatus, type RuntimeDiagnosticCode, SECRET_NAME_PATTERN, SECRET_VALUE_MAX, SIGNAL_NAME_PATTERN, SIGNAL_PAYLOAD_MAX_BYTES, type SaveState, ScreenshotPolicy, type SecretDeleteParams, type SecretDeleteResult, type SecretDiagnosticCode, SecretEntry, type SecretListParams, type SecretListResult, type SecretSetParams, type SecretSetResult, SerializationError, type SerializeMode, ServerEmitParams, ServerLiveValueParams, ServerLogParams, ServerProgressParams, ServerSecretParams, ServerSignalParams, ServerStateGetParams, ServerStatePatchParams, type ServerStatePatchResult, ShellSubmitRequest, SignalRequest, type SmokeDiagnosticCode, SourceRef, type StateGetParams, type StateGetResult, type StatePatchParams, type StatePatchResult, StreamSnapshot, SubmissionEnvelope, SubmissionId, SubmissionPolicy, SubmissionSummary, type SubmissionsDeliverResult, type SubmitBlocker, SubmitChannel, type SubmitDiagnosticCode, SubmitRequest, type TargetDiagnosticCode, type TerminalSpec, ThreadId, type TokenEstimate, TokenId, TrustedControl, type TypeDiagnosticCode, UNSERIALIZABLE_CODE, type UiInitializeParams, type UiInitializeResult, VERIFY_PROBE, VERIFY_REPORT, VERIFY_RUNNER_METHODS, ValueReader, type ValueReaderOptions, ValueWriter, type ValueWriterOptions, type VerdictAria, type VerdictScreenshot, type VerifyDiagnosticCode, VerifyVerdict, type VerifyViewport, type VersionAvailableParams, VersionId, type VersionIdKind, VersionRef, VersionSummary, ViewContext, ViewContextWire, type ViewDefaultParams, type ViewDefaultResult, ViewId, type ViewLaunchParams, type ViewLaunchResult, type ViewRevokeParams, type ViewRevokeResult, type ViewRotateParams, type ViewRotateResult, type ViewUrlParams, type ViewUrlResult, Viewer, ViewerId, type ViewerKind, ViewerSpec, type Viewport, WAIT_MAX_MS, WORKER_CHANNEL_REVISION, WORKER_METHODS, WaitCondition, type WaitParams, type WaitResult, type WireError, WorkerBatchParams, WorkerCallOutcome, WorkerCallParams, type WorkerCancelParams, type WorkerLimits, type WorkerLiveParams, WorkerPingResult, WorkerStartParams, WorkerStartResult, WorkerStatus, WorkerVersionRef, a11yDiagnosticCodes, actionDiagnosticCodes, ariaSummary, artifactCreateMethod, artifactDiagnosticCodes, artifactGetMethod, artifactListMethod, artifactPublishMethod, artifactVerifyMethod, buildDiagnosticCodes, bundleAssetName, canonicalJson, checkArgumentFrames, checkRequest, classifyMessage, cliDiagnosticCodes, connectBridge, consoleDiagnosticCodes, createDiagnostic, defineMethod, depDiagnosticCodes, depsAddMethod, deserializeAll, devStartMethod, devStopMethod, diagnosticCatalog, docsUrl, durationMs, encodeLine, envDiagnosticCodes, estimateImageTokens, eventsAckMethod, eventsReadMethod, eventsSubscribeMethod, eventsUnsubscribeMethod, fieldDiagnosticCodes, fromBase64, gcRunMethod, headerValue, homeDiagnosticCodes, hostDiagnosticCodes, hostMethods, hygieneDiagnosticCodes, instanceCheckMethod, instanceStatusMethod, isFieldId, isFinalRunStatus, isJsonContentType, liveDiagnosticCodes, livePushMethod, manifestDiagnosticCodes, mostraControlsRequest, mostraFieldFocus, mostraFields, mostraFlush, mostraInitializeMethod, mostraPage, mostraReady, mostraShutdownMethod, mostraVersionAvailable, negotiateRevision, networkDiagnosticCodes, normalizeScopes, parseParams, platformDiagnosticCodes, portDraftsMirrorMethod, portSecretsGetMethod, portSubmissionsDeliverMethod, portTrustedControlsActivatedMethod, portTrustedControlsPolicyMethod, publishDiagnosticCodes, readViewContext, refusal, regressionDiagnosticCodes, resultsGetMethod, runtimeDiagnosticCodes, safeEqual, safePath, scopeAllows, secretDeleteMethod, secretDiagnosticCodes, secretListMethod, secretSetMethod, serializeAll, smokeDiagnosticCodes, stateGetMethod, statePatchMethod, submitDiagnosticCodes, targetDiagnosticCodes, toBase64, typeDiagnosticCodes, uiInitialize, uiInitialized, uiOpenLink, uiSizeChanged, verifyDiagnosticCodes, viewDefaultMethod, viewLaunchMethod, viewRevokeMethod, viewRotateMethod, viewUrlMethod, viewportsFor, waitMethod, wireError };
|
|
87
|
+
export { type A11yDiagnosticCode, ACTION_ARGS_MAX, ACTION_RESULT_MAX, ALL_SCOPES, ARGUMENT_BIGINT_DIGITS_MAX, ARTIFACT_MANIFEST_KEYS, ARTIFACT_PROGRESS, type ActionDiagnosticCode, ActionError, Actor, AddedPackage, type AnyBridgeMessage, type AnyFunction, type AnyMethod, type AnyNotification, type AreaCatalog, type ArtifactCreateParams, type ArtifactCreateResult, ArtifactDetail, type ArtifactDiagnosticCode, type ArtifactFamily, type ArtifactGetParams, type ArtifactGetResult, ArtifactId, ArtifactLink, type ArtifactListFilter, type ArtifactListParams, type ArtifactListResult, ArtifactManifest, ArtifactProgressParams, type ArtifactPublishParams, type ArtifactPublishResult, ArtifactRef, ArtifactSummary, type ArtifactVerifyParams, type ArtifactVerifyResult, BRIDGE_FIELDS_MAX, BRIDGE_MESSAGES, BRIDGE_TEXT_MAX, BROWSER_PROTOCOL_REVISION, BROWSER_PROTOCOL_REVISIONS, BUNDLE_NAME, BUNDLE_PLATFORMS, BUNDLE_SETUP_MARKER, Batches, type Bridge, type BridgeEvent, type BridgeHostContext, type BridgeImplementation, type BridgeMessage, type BridgeOptions, type BridgePeer, type BridgeReceiver, type BridgeRejection, type BridgeSide, type BuildDiagnosticCode, BundleAsset, BundleBrowser, BundleFileEntry, BundleFiles, BundleInfo, BundleLinkEntry, BundlePins, type BundlePlatform, BundlePlatformSchema, BundleSetup, CLI_CLIENT_NAME, CONTROL_LABEL_MAX, CSRF_HEADER, type CallContext, type CallLine, CallRequest, CapabilityLink, CapabilityScope, CarryOver, ChildProcessStatus, ChooseRequest, type ClassifiedMessage, type CliDiagnosticCode, ClientCapabilities, ClientInfo, CommentId, type CompareRequest, type CompareResult, type ConsoleDiagnosticCode, type ControlRequest, ControlsPolicy, type CreateDiagnosticOptions, Cursor, DEFAULT_DOCS_BASE, DEFAULT_VIEWPORTS, DEFAULT_WORKER_LIMITS, DEV_NOTIFY, DIAGNOSTIC_AREAS, DeliveryCounts, DeliveryId, type DeliveryState, DeliveryStatus, type DeliveryTarget, type DemoSpec, type DepDiagnosticCode, DependencyPolicy, type DepsAddParams, type DepsAddResult, type DevEventKind, DevNotifyParams, type DevStartParams, type DevStartResult, type DevStopParams, type DevStopResult, Diagnostic, type DiagnosticArea, type DiagnosticCode, type DiagnosticDetails, DiagnosticFix, DiagnosticLocation, DiagnosticPhase, DiagnosticSeverity, type DiagnosticSpec, DocumentRevision, DocumentSnapshot, DraftMirror, type DraftsMirrorResult, Duration, EVENTS_NOTIFY, EVENTS_READ_MAX, type EnvDiagnosticCode, type EphemeralMessage, EventFilter, EventRecord, EventTypePattern, type EventsAckParams, type EventsAckResult, EventsNotifyParams, type EventsReadParams, type EventsReadResult, type EventsSubscribeParams, type EventsSubscribeResult, type EventsUnsubscribeParams, type EventsUnsubscribeResult, FIELD_ID_MAX_LENGTH, FieldConflict, type FieldDiagnosticCode, FieldOp, type FieldRegistration, type FieldScope, FieldState, type FieldsParams, FieldsRequest, type FlushResult, FollowRequest, type Frame, FrameTicket, GatewayStatus, type GcCompactEvents, type GcCompacted, type GcCount, type GcRunParams, type GcRunResult, type GcVersion, type GeneratedIdKind, HOST_PROTOCOL_REVISIONS, HomeConfig, type HomeDiagnosticCode, type HostDiagnosticCode, type HygieneDiagnosticCode, type Id, type IdBody, type IdKind, type IdPrefix, type IdentityVia, InstanceCapabilities, type InstanceCheck, type InstanceCheckParams, type InstanceCheckResult, InstanceInfo, type InstanceStatusParams, type InstanceStatusResult, JSON_RPC_ERROR_CODES, JsonRpcErrorObject, JsonRpcFailure, type JsonRpcId, type JsonRpcMessage, JsonRpcNotification, type JsonRpcParams, JsonRpcRequest, type JsonRpcResponse, JsonRpcSuccess, type KnownDiagnosticCode, LIVE_KEY_PATTERN, LIVE_RING_DEFAULT, LIVE_RING_MAX, LIVE_VALUE_MAX, LineSplitter, type LiveDiagnosticCode, type LivePushParams, type LivePushResult, LiveRequest, type LiveSourceInfo, type LiveState, type LiveUpdate, MAX_LINE_LENGTH, MCP_APPS_PROTOCOL_VERSION, type ManifestDiagnosticCode, type MethodDefinition, type MethodDirection, type MostraInitializeParams, type MostraInitializeResult, type MostraShutdownParams, type MostraShutdownResult, MutationId, MutationResult, type NetworkDiagnosticCode, type NotificationDefinition, OPEN_LINK_SCHEMES, OrphanedField, type PlatformDiagnosticCode, PollResult, type PortIdentityResolveParams, type PortIdentityResolveResult, PortName, type PortSecretsGetParams, type PortSecretsGetResult, type PortTrustedControlsActivatedParams, type PortTrustedControlsActivatedResult, type PortTrustedControlsPolicyParams, type PortTrustedControlsPolicyResult, type ProbedField, type PublishDiagnosticCode, PublishReceipt, REVIEW_SET_ID_PATTERN, RUN_KEY_MAX, RUN_LOG_MAX, RUN_LOG_TRUNCATED, RUN_STATUSES, type Rect, type Refusal, type RegressionDiagnosticCode, RemoteError, type RenderRequest, type RenderResult, type RequestFacts, type RequestIntent, type RequestPolicy, ResultComment, Results, type ResultsGetParams, type ResultsGetResult, ResultsMarkdown, Revision, type RevisionNegotiation, RpcError, RpcPeer, type RpcPeerOptions, type RpcRequestContext, type RpcRequestOptions, RunAttachRequest, RunCancelRequest, type RunDelta, RunId, RunProgress, type RunReason, RunRequest, RunState, type RunStatus, type RuntimeDiagnosticCode, SECRET_NAME_PATTERN, SECRET_VALUE_MAX, SIGNAL_NAME_PATTERN, SIGNAL_PAYLOAD_MAX_BYTES, type SaveState, ScreenshotPolicy, type SecretDeleteParams, type SecretDeleteResult, type SecretDiagnosticCode, SecretEntry, type SecretListParams, type SecretListResult, type SecretSetParams, type SecretSetResult, SerializationError, type SerializeMode, ServerEmitParams, ServerLiveValueParams, ServerLogParams, ServerProgressParams, ServerSecretParams, ServerSignalParams, ServerStateGetParams, ServerStatePatchParams, type ServerStatePatchResult, ShellSubmitRequest, SignalRequest, type SmokeDiagnosticCode, SourceRef, type StateGetParams, type StateGetResult, type StatePatchParams, type StatePatchResult, StreamSnapshot, SubmissionEnvelope, SubmissionId, SubmissionPolicy, SubmissionSummary, type SubmissionsDeliverResult, type SubmitBlocker, SubmitChannel, type SubmitDiagnosticCode, SubmitRequest, type TargetDiagnosticCode, type TerminalSpec, ThreadId, type TokenEstimate, TokenId, TrustedControl, type TypeDiagnosticCode, UNSERIALIZABLE_CODE, type UiInitializeParams, type UiInitializeResult, VERIFY_PROBE, VERIFY_REPORT, VERIFY_RUNNER_METHODS, ValueReader, type ValueReaderOptions, ValueWriter, type ValueWriterOptions, type VerdictAria, type VerdictScreenshot, type VerifyDiagnosticCode, VerifyVerdict, type VerifyViewport, type VersionAvailableParams, VersionId, type VersionIdKind, VersionRef, VersionSummary, ViewContext, ViewContextWire, type ViewDefaultParams, type ViewDefaultResult, ViewId, type ViewLaunchParams, type ViewLaunchResult, type ViewRevokeParams, type ViewRevokeResult, type ViewRotateParams, type ViewRotateResult, type ViewUrlParams, type ViewUrlResult, Viewer, ViewerId, type ViewerKind, ViewerSpec, type Viewport, WAIT_MAX_MS, WORKER_CHANNEL_REVISION, WORKER_METHODS, WaitCondition, type WaitParams, type WaitResult, type WireError, WorkerBatchParams, WorkerCallOutcome, WorkerCallParams, type WorkerCancelParams, type WorkerLimits, type WorkerLiveParams, WorkerPingResult, WorkerStartParams, WorkerStartResult, WorkerStatus, WorkerVersionRef, a11yDiagnosticCodes, actionDiagnosticCodes, ariaSummary, artifactCreateMethod, artifactDiagnosticCodes, artifactGetMethod, artifactListMethod, artifactPublishMethod, artifactVerifyMethod, buildDiagnosticCodes, bundleAssetName, canonicalJson, checkArgumentFrames, checkRequest, classifyMessage, cliDiagnosticCodes, connectBridge, consoleDiagnosticCodes, createDiagnostic, defineMethod, depDiagnosticCodes, depsAddMethod, deserializeAll, devStartMethod, devStopMethod, diagnosticCatalog, docsUrl, durationMs, encodeLine, envDiagnosticCodes, estimateImageTokens, eventsAckMethod, eventsReadMethod, eventsSubscribeMethod, eventsUnsubscribeMethod, fieldDiagnosticCodes, fromBase64, gcRunMethod, headerValue, homeDiagnosticCodes, hostDiagnosticCodes, hostMethods, hostNotifications, hygieneDiagnosticCodes, instanceCheckMethod, instanceStatusMethod, isFieldId, isFinalRunStatus, isJsonContentType, liveDiagnosticCodes, livePushMethod, manifestDiagnosticCodes, mostraControlsRequest, mostraFieldFocus, mostraFields, mostraFlush, mostraInitializeMethod, mostraPage, mostraReady, mostraShutdownMethod, mostraVersionAvailable, negotiateRevision, networkDiagnosticCodes, normalizeScopes, parseParams, platformDiagnosticCodes, portDraftsMirrorMethod, portIdentityResolveMethod, portSecretsGetMethod, portSubmissionsDeliverMethod, portTrustedControlsActivatedMethod, portTrustedControlsPolicyMethod, publishDiagnosticCodes, readViewContext, refusal, regressionDiagnosticCodes, resultsGetMethod, runtimeDiagnosticCodes, safeEqual, safePath, scopeAllows, secretDeleteMethod, secretDiagnosticCodes, secretListMethod, secretSetMethod, serializeAll, smokeDiagnosticCodes, stateGetMethod, statePatchMethod, submitDiagnosticCodes, targetDiagnosticCodes, toBase64, typeDiagnosticCodes, uiInitialize, uiInitialized, uiOpenLink, uiSizeChanged, verifyDiagnosticCodes, viewDefaultMethod, viewLaunchMethod, viewRevokeMethod, viewRotateMethod, viewUrlMethod, viewportsFor, waitMethod, wireError };
|
package/dist/index.js
CHANGED
|
@@ -63,6 +63,7 @@ import { ChildProcessStatus, DeliveryCounts, GatewayStatus, WorkerStatus, instan
|
|
|
63
63
|
import { livePushMethod } from "./methods/live/push.js";
|
|
64
64
|
import { mostraShutdownMethod } from "./methods/mostra/shutdown.js";
|
|
65
65
|
import { DraftMirror, portDraftsMirrorMethod } from "./methods/port/drafts-mirror.js";
|
|
66
|
+
import { portIdentityResolveMethod } from "./methods/port/identity-resolve.js";
|
|
66
67
|
import { portSecretsGetMethod } from "./methods/port/secrets-get.js";
|
|
67
68
|
import { SubmissionEnvelope, portSubmissionsDeliverMethod } from "./methods/port/submissions-deliver.js";
|
|
68
69
|
import { portTrustedControlsActivatedMethod } from "./methods/port/trusted-controls-activated.js";
|
|
@@ -79,8 +80,8 @@ import { viewLaunchMethod } from "./methods/view/launch.js";
|
|
|
79
80
|
import { viewRevokeMethod } from "./methods/view/revoke.js";
|
|
80
81
|
import { viewRotateMethod } from "./methods/view/rotate.js";
|
|
81
82
|
import { WAIT_MAX_MS, waitMethod } from "./methods/wait/wait.js";
|
|
82
|
-
import { hostMethods } from "./methods/index.js";
|
|
83
|
+
import { hostMethods, hostNotifications } from "./methods/index.js";
|
|
83
84
|
import { LineSplitter, MAX_LINE_LENGTH, encodeLine } from "./rpc/lines.js";
|
|
84
85
|
import { ARGUMENT_BIGINT_DIGITS_MAX, RemoteError, SerializationError, UNSERIALIZABLE_CODE, ValueReader, ValueWriter, checkArgumentFrames, deserializeAll, fromBase64, serializeAll, toBase64, wireError } from "./serializer.js";
|
|
85
86
|
import { DEFAULT_WORKER_LIMITS, ServerEmitParams, ServerLiveValueParams, ServerLogParams, ServerProgressParams, ServerSecretParams, ServerSignalParams, ServerStateGetParams, ServerStatePatchParams, WORKER_CHANNEL_REVISION, WORKER_METHODS, WorkerBatchParams, WorkerCallOutcome, WorkerCallParams, WorkerPingResult, WorkerStartParams, WorkerStartResult, WorkerVersionRef } from "./worker.js";
|
|
86
|
-
export { ACTION_ARGS_MAX, ACTION_RESULT_MAX, ALL_SCOPES, ARGUMENT_BIGINT_DIGITS_MAX, ARTIFACT_MANIFEST_KEYS, ARTIFACT_PROGRESS, ActionError, Actor, AddedPackage, ArtifactDetail, ArtifactId, ArtifactLink, ArtifactManifest, ArtifactProgressParams, ArtifactRef, ArtifactSummary, BRIDGE_FIELDS_MAX, BRIDGE_MESSAGES, BRIDGE_TEXT_MAX, BROWSER_PROTOCOL_REVISION, BROWSER_PROTOCOL_REVISIONS, BUNDLE_NAME, BUNDLE_PLATFORMS, BUNDLE_SETUP_MARKER, Batches, BundleAsset, BundleBrowser, BundleFileEntry, BundleFiles, BundleInfo, BundleLinkEntry, BundlePins, BundlePlatformSchema, BundleSetup, CLI_CLIENT_NAME, CONTROL_LABEL_MAX, CSRF_HEADER, CallRequest, CapabilityLink, CapabilityScope, CarryOver, ChildProcessStatus, ChooseRequest, ClientCapabilities, ClientInfo, CommentId, ControlsPolicy, Cursor, DEFAULT_DOCS_BASE, DEFAULT_VIEWPORTS, DEFAULT_WORKER_LIMITS, DEV_NOTIFY, DIAGNOSTIC_AREAS, DeliveryCounts, DeliveryId, DeliveryStatus, DependencyPolicy, DevNotifyParams, Diagnostic, DiagnosticFix, DiagnosticLocation, DiagnosticPhase, DiagnosticSeverity, DocumentRevision, DocumentSnapshot, DraftMirror, Duration, EVENTS_NOTIFY, EVENTS_READ_MAX, EventFilter, EventRecord, EventTypePattern, EventsNotifyParams, FIELD_ID_MAX_LENGTH, FieldConflict, FieldOp, FieldState, FieldsRequest, FollowRequest, FrameTicket, GatewayStatus, HOST_PROTOCOL_REVISIONS, HomeConfig, InstanceCapabilities, InstanceInfo, JSON_RPC_ERROR_CODES, JsonRpcErrorObject, JsonRpcFailure, JsonRpcNotification, JsonRpcRequest, JsonRpcSuccess, LIVE_KEY_PATTERN, LIVE_RING_DEFAULT, LIVE_RING_MAX, LIVE_VALUE_MAX, LineSplitter, LiveRequest, MAX_LINE_LENGTH, MCP_APPS_PROTOCOL_VERSION, MutationId, MutationResult, OPEN_LINK_SCHEMES, OrphanedField, PollResult, PortName, PublishReceipt, REVIEW_SET_ID_PATTERN, RUN_KEY_MAX, RUN_LOG_MAX, RUN_LOG_TRUNCATED, RUN_STATUSES, RemoteError, ResultComment, Results, ResultsMarkdown, Revision, RpcError, RpcPeer, RunAttachRequest, RunCancelRequest, RunId, RunProgress, RunRequest, RunState, SECRET_NAME_PATTERN, SECRET_VALUE_MAX, SIGNAL_NAME_PATTERN, SIGNAL_PAYLOAD_MAX_BYTES, ScreenshotPolicy, SecretEntry, SerializationError, ServerEmitParams, ServerLiveValueParams, ServerLogParams, ServerProgressParams, ServerSecretParams, ServerSignalParams, ServerStateGetParams, ServerStatePatchParams, ShellSubmitRequest, SignalRequest, SourceRef, StreamSnapshot, SubmissionEnvelope, SubmissionId, SubmissionPolicy, SubmissionSummary, SubmitChannel, SubmitRequest, ThreadId, TokenId, TrustedControl, UNSERIALIZABLE_CODE, VERIFY_PROBE, VERIFY_REPORT, VERIFY_RUNNER_METHODS, ValueReader, ValueWriter, VerifyVerdict, VersionId, VersionRef, VersionSummary, ViewContext, ViewContextWire, ViewId, Viewer, ViewerId, ViewerSpec, WAIT_MAX_MS, WORKER_CHANNEL_REVISION, WORKER_METHODS, WaitCondition, WorkerBatchParams, WorkerCallOutcome, WorkerCallParams, WorkerPingResult, WorkerStartParams, WorkerStartResult, WorkerStatus, WorkerVersionRef, a11yDiagnosticCodes, actionDiagnosticCodes, ariaSummary, artifactCreateMethod, artifactDiagnosticCodes, artifactGetMethod, artifactListMethod, artifactPublishMethod, artifactVerifyMethod, buildDiagnosticCodes, bundleAssetName, canonicalJson, checkArgumentFrames, checkRequest, classifyMessage, cliDiagnosticCodes, connectBridge, consoleDiagnosticCodes, createDiagnostic, defineMethod, depDiagnosticCodes, depsAddMethod, deserializeAll, devStartMethod, devStopMethod, diagnosticCatalog, docsUrl, durationMs, encodeLine, envDiagnosticCodes, estimateImageTokens, eventsAckMethod, eventsReadMethod, eventsSubscribeMethod, eventsUnsubscribeMethod, fieldDiagnosticCodes, fromBase64, gcRunMethod, headerValue, homeDiagnosticCodes, hostDiagnosticCodes, hostMethods, hygieneDiagnosticCodes, instanceCheckMethod, instanceStatusMethod, isFieldId, isFinalRunStatus, isJsonContentType, liveDiagnosticCodes, livePushMethod, manifestDiagnosticCodes, mostraControlsRequest, mostraFieldFocus, mostraFields, mostraFlush, mostraInitializeMethod, mostraPage, mostraReady, mostraShutdownMethod, mostraVersionAvailable, negotiateRevision, networkDiagnosticCodes, normalizeScopes, parseParams, platformDiagnosticCodes, portDraftsMirrorMethod, portSecretsGetMethod, portSubmissionsDeliverMethod, portTrustedControlsActivatedMethod, portTrustedControlsPolicyMethod, publishDiagnosticCodes, readViewContext, refusal, regressionDiagnosticCodes, resultsGetMethod, runtimeDiagnosticCodes, safeEqual, safePath, scopeAllows, secretDeleteMethod, secretDiagnosticCodes, secretListMethod, secretSetMethod, serializeAll, smokeDiagnosticCodes, stateGetMethod, statePatchMethod, submitDiagnosticCodes, targetDiagnosticCodes, toBase64, typeDiagnosticCodes, uiInitialize, uiInitialized, uiOpenLink, uiSizeChanged, verifyDiagnosticCodes, viewDefaultMethod, viewLaunchMethod, viewRevokeMethod, viewRotateMethod, viewUrlMethod, viewportsFor, waitMethod, wireError };
|
|
87
|
+
export { ACTION_ARGS_MAX, ACTION_RESULT_MAX, ALL_SCOPES, ARGUMENT_BIGINT_DIGITS_MAX, ARTIFACT_MANIFEST_KEYS, ARTIFACT_PROGRESS, ActionError, Actor, AddedPackage, ArtifactDetail, ArtifactId, ArtifactLink, ArtifactManifest, ArtifactProgressParams, ArtifactRef, ArtifactSummary, BRIDGE_FIELDS_MAX, BRIDGE_MESSAGES, BRIDGE_TEXT_MAX, BROWSER_PROTOCOL_REVISION, BROWSER_PROTOCOL_REVISIONS, BUNDLE_NAME, BUNDLE_PLATFORMS, BUNDLE_SETUP_MARKER, Batches, BundleAsset, BundleBrowser, BundleFileEntry, BundleFiles, BundleInfo, BundleLinkEntry, BundlePins, BundlePlatformSchema, BundleSetup, CLI_CLIENT_NAME, CONTROL_LABEL_MAX, CSRF_HEADER, CallRequest, CapabilityLink, CapabilityScope, CarryOver, ChildProcessStatus, ChooseRequest, ClientCapabilities, ClientInfo, CommentId, ControlsPolicy, Cursor, DEFAULT_DOCS_BASE, DEFAULT_VIEWPORTS, DEFAULT_WORKER_LIMITS, DEV_NOTIFY, DIAGNOSTIC_AREAS, DeliveryCounts, DeliveryId, DeliveryStatus, DependencyPolicy, DevNotifyParams, Diagnostic, DiagnosticFix, DiagnosticLocation, DiagnosticPhase, DiagnosticSeverity, DocumentRevision, DocumentSnapshot, DraftMirror, Duration, EVENTS_NOTIFY, EVENTS_READ_MAX, EventFilter, EventRecord, EventTypePattern, EventsNotifyParams, FIELD_ID_MAX_LENGTH, FieldConflict, FieldOp, FieldState, FieldsRequest, FollowRequest, FrameTicket, GatewayStatus, HOST_PROTOCOL_REVISIONS, HomeConfig, InstanceCapabilities, InstanceInfo, JSON_RPC_ERROR_CODES, JsonRpcErrorObject, JsonRpcFailure, JsonRpcNotification, JsonRpcRequest, JsonRpcSuccess, LIVE_KEY_PATTERN, LIVE_RING_DEFAULT, LIVE_RING_MAX, LIVE_VALUE_MAX, LineSplitter, LiveRequest, MAX_LINE_LENGTH, MCP_APPS_PROTOCOL_VERSION, MutationId, MutationResult, OPEN_LINK_SCHEMES, OrphanedField, PollResult, PortName, PublishReceipt, REVIEW_SET_ID_PATTERN, RUN_KEY_MAX, RUN_LOG_MAX, RUN_LOG_TRUNCATED, RUN_STATUSES, RemoteError, ResultComment, Results, ResultsMarkdown, Revision, RpcError, RpcPeer, RunAttachRequest, RunCancelRequest, RunId, RunProgress, RunRequest, RunState, SECRET_NAME_PATTERN, SECRET_VALUE_MAX, SIGNAL_NAME_PATTERN, SIGNAL_PAYLOAD_MAX_BYTES, ScreenshotPolicy, SecretEntry, SerializationError, ServerEmitParams, ServerLiveValueParams, ServerLogParams, ServerProgressParams, ServerSecretParams, ServerSignalParams, ServerStateGetParams, ServerStatePatchParams, ShellSubmitRequest, SignalRequest, SourceRef, StreamSnapshot, SubmissionEnvelope, SubmissionId, SubmissionPolicy, SubmissionSummary, SubmitChannel, SubmitRequest, ThreadId, TokenId, TrustedControl, UNSERIALIZABLE_CODE, VERIFY_PROBE, VERIFY_REPORT, VERIFY_RUNNER_METHODS, ValueReader, ValueWriter, VerifyVerdict, VersionId, VersionRef, VersionSummary, ViewContext, ViewContextWire, ViewId, Viewer, ViewerId, ViewerSpec, WAIT_MAX_MS, WORKER_CHANNEL_REVISION, WORKER_METHODS, WaitCondition, WorkerBatchParams, WorkerCallOutcome, WorkerCallParams, WorkerPingResult, WorkerStartParams, WorkerStartResult, WorkerStatus, WorkerVersionRef, a11yDiagnosticCodes, actionDiagnosticCodes, ariaSummary, artifactCreateMethod, artifactDiagnosticCodes, artifactGetMethod, artifactListMethod, artifactPublishMethod, artifactVerifyMethod, buildDiagnosticCodes, bundleAssetName, canonicalJson, checkArgumentFrames, checkRequest, classifyMessage, cliDiagnosticCodes, connectBridge, consoleDiagnosticCodes, createDiagnostic, defineMethod, depDiagnosticCodes, depsAddMethod, deserializeAll, devStartMethod, devStopMethod, diagnosticCatalog, docsUrl, durationMs, encodeLine, envDiagnosticCodes, estimateImageTokens, eventsAckMethod, eventsReadMethod, eventsSubscribeMethod, eventsUnsubscribeMethod, fieldDiagnosticCodes, fromBase64, gcRunMethod, headerValue, homeDiagnosticCodes, hostDiagnosticCodes, hostMethods, hostNotifications, hygieneDiagnosticCodes, instanceCheckMethod, instanceStatusMethod, isFieldId, isFinalRunStatus, isJsonContentType, liveDiagnosticCodes, livePushMethod, manifestDiagnosticCodes, mostraControlsRequest, mostraFieldFocus, mostraFields, mostraFlush, mostraInitializeMethod, mostraPage, mostraReady, mostraShutdownMethod, mostraVersionAvailable, negotiateRevision, networkDiagnosticCodes, normalizeScopes, parseParams, platformDiagnosticCodes, portDraftsMirrorMethod, portIdentityResolveMethod, portSecretsGetMethod, portSubmissionsDeliverMethod, portTrustedControlsActivatedMethod, portTrustedControlsPolicyMethod, publishDiagnosticCodes, readViewContext, refusal, regressionDiagnosticCodes, resultsGetMethod, runtimeDiagnosticCodes, safeEqual, safePath, scopeAllows, secretDeleteMethod, secretDiagnosticCodes, secretListMethod, secretSetMethod, serializeAll, smokeDiagnosticCodes, stateGetMethod, statePatchMethod, submitDiagnosticCodes, targetDiagnosticCodes, toBase64, typeDiagnosticCodes, uiInitialize, uiInitialized, uiOpenLink, uiSizeChanged, verifyDiagnosticCodes, viewDefaultMethod, viewLaunchMethod, viewRevokeMethod, viewRotateMethod, viewUrlMethod, viewportsFor, waitMethod, wireError };
|
package/dist/method.d.ts
CHANGED
|
@@ -22,5 +22,17 @@ export interface MethodDefinition<Params, Result> {
|
|
|
22
22
|
export type AnyMethod = MethodDefinition<unknown, unknown>;
|
|
23
23
|
/** Defines a protocol method, checking its name has the `group/name` (or bare `name`) form. */
|
|
24
24
|
export declare function defineMethod<Params, Result>(definition: MethodDefinition<Params, Result>): MethodDefinition<Params, Result>;
|
|
25
|
+
/**
|
|
26
|
+
* One notification of the host protocol: a message without an answer, sent by the instance to a
|
|
27
|
+
* client that accepted it in `mostra/initialize` (`ClientCapabilities.notifications`).
|
|
28
|
+
*/
|
|
29
|
+
export interface NotificationDefinition<Params> {
|
|
30
|
+
/** The JSON-RPC method name, such as `events/notify`. */
|
|
31
|
+
readonly method: string;
|
|
32
|
+
/** The schema of its `params`. */
|
|
33
|
+
readonly params: z.ZodType<Params>;
|
|
34
|
+
}
|
|
35
|
+
/** A notification of any params type. */
|
|
36
|
+
export type AnyNotification = NotificationDefinition<unknown>;
|
|
25
37
|
//#endregion
|
|
26
38
|
//# sourceMappingURL=method.d.ts.map
|
package/dist/method.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"method.d.ts","names":[],"sources":["../src/method.ts"],"mappings":";;;YASY;;iBAGK,iBAAiB,QAAQ;;WAE/B;;WAEA,WAAW;;;;;WAKX;;WAEA,QAAQ,EAAE,QAAQ;;WAElB,QAAQ,EAAE,QAAQ;;;YAIjB,YAAY;;wBAGR,aAAa,QAAQ,QACnC,YAAY,iBAAiB,QAAQ,UACpC,iBAAiB,QAAQ"}
|
|
1
|
+
{"version":3,"file":"method.d.ts","names":[],"sources":["../src/method.ts"],"mappings":";;;YASY;;iBAGK,iBAAiB,QAAQ;;WAE/B;;WAEA,WAAW;;;;;WAKX;;WAEA,QAAQ,EAAE,QAAQ;;WAElB,QAAQ,EAAE,QAAQ;;;YAIjB,YAAY;;wBAGR,aAAa,QAAQ,QACnC,YAAY,iBAAiB,QAAQ,UACpC,iBAAiB,QAAQ;;;;;iBAaX,uBAAuB;;WAE7B;;WAEA,QAAQ,EAAE,QAAQ;;;YAIjB,kBAAkB"}
|
package/dist/method.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"method.js","names":[],"sources":["../src/method.ts"],"sourcesContent":["/**\n * Host protocol methods (INTERFACES §6, D59): JSON-RPC 2.0 methods between clients and an\n * instance, each defined once with Zod schemas for its params and result. `pnpm gen\n * protocol-method <group>/<name>` adds one in the right shape; the method modules live in\n * `methods/` and are listed in `methods/index.ts`.\n */\nimport type * as z from \"zod\";\n\n/** Who sends the request: a client to the instance, or the instance to a registering host (ports). */\nexport type MethodDirection = \"client-to-instance\" | \"instance-to-host\";\n\n/** One protocol method. */\nexport interface MethodDefinition<Params, Result> {\n /** The JSON-RPC method name: `group/name` (`artifact/publish`) or a bare name (`wait`). */\n readonly method: string;\n /** Who sends the request. */\n readonly direction: MethodDirection;\n /**\n * Whether the method changes durable state. Mutating methods take an optional `requestId`, and a\n * retry with the same ID returns the recorded result (H-03).\n */\n readonly mutating: boolean;\n /** The schema of the request's `params`. */\n readonly params: z.ZodType<Params>;\n /** The schema of a successful response's `result`. */\n readonly result: z.ZodType<Result>;\n}\n\n/** A method of any params and result type. */\nexport type AnyMethod = MethodDefinition<unknown, unknown>;\n\n/** Defines a protocol method, checking its name has the `group/name` (or bare `name`) form. */\nexport function defineMethod<Params, Result>(\n definition: MethodDefinition<Params, Result>,\n): MethodDefinition<Params, Result> {\n if (!/^([a-z][a-zA-Z]*\\/)?[a-z][a-zA-Z.]*$/.test(definition.method)) {\n throw new Error(\n `Protocol method names have the form group/name or name, got \"${definition.method}\".`,\n );\n }\n return definition;\n}\n"],"mappings":";;AAgCA,SAAgB,aACd,YACkC;CAClC,IAAI,CAAC,uCAAuC,KAAK,WAAW,MAAM,GAChE,MAAM,IAAI,MACR,gEAAgE,WAAW,OAAO,GACpF;CAEF,OAAO;AACT"}
|
|
1
|
+
{"version":3,"file":"method.js","names":[],"sources":["../src/method.ts"],"sourcesContent":["/**\n * Host protocol methods (INTERFACES §6, D59): JSON-RPC 2.0 methods between clients and an\n * instance, each defined once with Zod schemas for its params and result. `pnpm gen\n * protocol-method <group>/<name>` adds one in the right shape; the method modules live in\n * `methods/` and are listed in `methods/index.ts`.\n */\nimport type * as z from \"zod\";\n\n/** Who sends the request: a client to the instance, or the instance to a registering host (ports). */\nexport type MethodDirection = \"client-to-instance\" | \"instance-to-host\";\n\n/** One protocol method. */\nexport interface MethodDefinition<Params, Result> {\n /** The JSON-RPC method name: `group/name` (`artifact/publish`) or a bare name (`wait`). */\n readonly method: string;\n /** Who sends the request. */\n readonly direction: MethodDirection;\n /**\n * Whether the method changes durable state. Mutating methods take an optional `requestId`, and a\n * retry with the same ID returns the recorded result (H-03).\n */\n readonly mutating: boolean;\n /** The schema of the request's `params`. */\n readonly params: z.ZodType<Params>;\n /** The schema of a successful response's `result`. */\n readonly result: z.ZodType<Result>;\n}\n\n/** A method of any params and result type. */\nexport type AnyMethod = MethodDefinition<unknown, unknown>;\n\n/** Defines a protocol method, checking its name has the `group/name` (or bare `name`) form. */\nexport function defineMethod<Params, Result>(\n definition: MethodDefinition<Params, Result>,\n): MethodDefinition<Params, Result> {\n if (!/^([a-z][a-zA-Z]*\\/)?[a-z][a-zA-Z.]*$/.test(definition.method)) {\n throw new Error(\n `Protocol method names have the form group/name or name, got \"${definition.method}\".`,\n );\n }\n return definition;\n}\n\n/**\n * One notification of the host protocol: a message without an answer, sent by the instance to a\n * client that accepted it in `mostra/initialize` (`ClientCapabilities.notifications`).\n */\nexport interface NotificationDefinition<Params> {\n /** The JSON-RPC method name, such as `events/notify`. */\n readonly method: string;\n /** The schema of its `params`. */\n readonly params: z.ZodType<Params>;\n}\n\n/** A notification of any params type. */\nexport type AnyNotification = NotificationDefinition<unknown>;\n"],"mappings":";;AAgCA,SAAgB,aACd,YACkC;CAClC,IAAI,CAAC,uCAAuC,KAAK,WAAW,MAAM,GAChE,MAAM,IAAI,MACR,gEAAgE,WAAW,OAAO,GACpF;CAEF,OAAO;AACT"}
|
package/dist/methods/index.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import { AnyMethod } from "../method.js";
|
|
1
|
+
import { AnyMethod, AnyNotification } from "../method.js";
|
|
2
2
|
//#region src/methods/index.d.ts
|
|
3
3
|
/** Every host protocol method, in the order they were added. */
|
|
4
4
|
export declare const hostMethods: readonly AnyMethod[];
|
|
5
|
+
/** Every notification the instance sends to its clients (INTERFACES §6). */
|
|
6
|
+
export declare const hostNotifications: readonly AnyNotification[];
|
|
5
7
|
//#endregion
|
|
6
8
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../../src/methods/index.ts"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../../src/methods/index.ts"],"mappings":";;;qBA6Ca,sBAAsB;;qBAyCtB,4BAA4B"}
|
package/dist/methods/index.js
CHANGED
|
@@ -2,13 +2,14 @@ import { artifactCreateMethod } from "./artifact/create.js";
|
|
|
2
2
|
import { artifactGetMethod } from "./artifact/get.js";
|
|
3
3
|
import { artifactListMethod } from "./artifact/list.js";
|
|
4
4
|
import { artifactPublishMethod } from "./artifact/publish.js";
|
|
5
|
+
import { ARTIFACT_PROGRESS, ArtifactProgressParams } from "../verify.js";
|
|
5
6
|
import { artifactVerifyMethod } from "./artifact/verify.js";
|
|
6
7
|
import { depsAddMethod } from "./deps/add.js";
|
|
7
|
-
import { devStartMethod } from "./dev/start.js";
|
|
8
|
+
import { DEV_NOTIFY, DevNotifyParams, devStartMethod } from "./dev/start.js";
|
|
8
9
|
import { devStopMethod } from "./dev/stop.js";
|
|
9
10
|
import { eventsAckMethod } from "./events/ack.js";
|
|
10
11
|
import { eventsReadMethod } from "./events/read.js";
|
|
11
|
-
import { eventsSubscribeMethod } from "./events/subscribe.js";
|
|
12
|
+
import { EVENTS_NOTIFY, EventsNotifyParams, eventsSubscribeMethod } from "./events/subscribe.js";
|
|
12
13
|
import { eventsUnsubscribeMethod } from "./events/unsubscribe.js";
|
|
13
14
|
import { gcRunMethod } from "./gc/run.js";
|
|
14
15
|
import { instanceCheckMethod } from "./instance/check.js";
|
|
@@ -17,6 +18,7 @@ import { instanceStatusMethod } from "./instance/status.js";
|
|
|
17
18
|
import { livePushMethod } from "./live/push.js";
|
|
18
19
|
import { mostraShutdownMethod } from "./mostra/shutdown.js";
|
|
19
20
|
import { portDraftsMirrorMethod } from "./port/drafts-mirror.js";
|
|
21
|
+
import { portIdentityResolveMethod } from "./port/identity-resolve.js";
|
|
20
22
|
import { portSecretsGetMethod } from "./port/secrets-get.js";
|
|
21
23
|
import { portSubmissionsDeliverMethod } from "./port/submissions-deliver.js";
|
|
22
24
|
import { portTrustedControlsActivatedMethod } from "./port/trusted-controls-activated.js";
|
|
@@ -70,9 +72,25 @@ const hostMethods = [
|
|
|
70
72
|
gcRunMethod,
|
|
71
73
|
instanceCheckMethod,
|
|
72
74
|
devStartMethod,
|
|
73
|
-
devStopMethod
|
|
75
|
+
devStopMethod,
|
|
76
|
+
portIdentityResolveMethod
|
|
77
|
+
];
|
|
78
|
+
/** Every notification the instance sends to its clients (INTERFACES §6). */
|
|
79
|
+
const hostNotifications = [
|
|
80
|
+
{
|
|
81
|
+
method: EVENTS_NOTIFY,
|
|
82
|
+
params: EventsNotifyParams
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
method: ARTIFACT_PROGRESS,
|
|
86
|
+
params: ArtifactProgressParams
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
method: DEV_NOTIFY,
|
|
90
|
+
params: DevNotifyParams
|
|
91
|
+
}
|
|
74
92
|
];
|
|
75
93
|
//#endregion
|
|
76
|
-
export { hostMethods };
|
|
94
|
+
export { hostMethods, hostNotifications };
|
|
77
95
|
|
|
78
96
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../src/methods/index.ts"],"sourcesContent":["/**\n * Every host protocol method this package defines. `pnpm gen protocol-method` adds entries at the\n * markers; the method itself lives in its own module under `methods/<group>/`.\n */\nimport type { AnyMethod } from \"../method.ts\";\nimport { artifactCreateMethod } from \"./artifact/create.ts\";\nimport { artifactGetMethod } from \"./artifact/get.ts\";\nimport { artifactListMethod } from \"./artifact/list.ts\";\nimport { artifactPublishMethod } from \"./artifact/publish.ts\";\nimport { artifactVerifyMethod } from \"./artifact/verify.ts\";\nimport { depsAddMethod } from \"./deps/add.ts\";\nimport { devStartMethod } from \"./dev/start.ts\";\nimport { devStopMethod } from \"./dev/stop.ts\";\nimport { eventsAckMethod } from \"./events/ack.ts\";\nimport { eventsReadMethod } from \"./events/read.ts\";\nimport { eventsSubscribeMethod } from \"./events/subscribe.ts\";\nimport { eventsUnsubscribeMethod } from \"./events/unsubscribe.ts\";\nimport { gcRunMethod } from \"./gc/run.ts\";\nimport { instanceCheckMethod } from \"./instance/check.ts\";\nimport { instanceStatusMethod } from \"./instance/status.ts\";\nimport { livePushMethod } from \"./live/push.ts\";\nimport { mostraInitializeMethod } from \"./mostra/initialize.ts\";\nimport { mostraShutdownMethod } from \"./mostra/shutdown.ts\";\nimport { portDraftsMirrorMethod } from \"./port/drafts-mirror.ts\";\nimport { portSecretsGetMethod } from \"./port/secrets-get.ts\";\nimport { portSubmissionsDeliverMethod } from \"./port/submissions-deliver.ts\";\nimport { portTrustedControlsActivatedMethod } from \"./port/trusted-controls-activated.ts\";\nimport { portTrustedControlsPolicyMethod } from \"./port/trusted-controls-policy.ts\";\nimport { resultsGetMethod } from \"./results/get.ts\";\nimport { secretDeleteMethod } from \"./secret/delete.ts\";\nimport { secretListMethod } from \"./secret/list.ts\";\nimport { secretSetMethod } from \"./secret/set.ts\";\nimport { stateGetMethod } from \"./state/get.ts\";\nimport { statePatchMethod } from \"./state/patch.ts\";\nimport { viewDefaultMethod } from \"./view/default.ts\";\nimport { viewLaunchMethod } from \"./view/launch.ts\";\nimport { viewRevokeMethod } from \"./view/revoke.ts\";\nimport { viewRotateMethod } from \"./view/rotate.ts\";\nimport { viewUrlMethod } from \"./view/url.ts\";\nimport { waitMethod } from \"./wait/wait.ts\";\n// gen:method-imports\n\n/** Every host protocol method, in the order they were added. */\nexport const hostMethods: readonly AnyMethod[] = [\n mostraInitializeMethod,\n mostraShutdownMethod,\n instanceStatusMethod,\n artifactCreateMethod,\n artifactPublishMethod,\n artifactListMethod,\n artifactGetMethod,\n depsAddMethod,\n viewUrlMethod,\n viewRevokeMethod,\n viewRotateMethod,\n stateGetMethod,\n resultsGetMethod,\n waitMethod,\n eventsReadMethod,\n eventsSubscribeMethod,\n eventsUnsubscribeMethod,\n statePatchMethod,\n eventsAckMethod,\n portSubmissionsDeliverMethod,\n portDraftsMirrorMethod,\n portTrustedControlsPolicyMethod,\n portTrustedControlsActivatedMethod,\n secretSetMethod,\n secretListMethod,\n secretDeleteMethod,\n livePushMethod,\n portSecretsGetMethod,\n artifactVerifyMethod,\n viewDefaultMethod,\n viewLaunchMethod,\n gcRunMethod,\n instanceCheckMethod,\n devStartMethod,\n devStopMethod,\n // gen:methods\n];\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/methods/index.ts"],"sourcesContent":["/**\n * Every host protocol method this package defines. `pnpm gen protocol-method` adds entries at the\n * markers; the method itself lives in its own module under `methods/<group>/`.\n */\nimport type { AnyMethod, AnyNotification } from \"../method.ts\";\nimport { ARTIFACT_PROGRESS, ArtifactProgressParams } from \"../verify.ts\";\nimport { artifactCreateMethod } from \"./artifact/create.ts\";\nimport { artifactGetMethod } from \"./artifact/get.ts\";\nimport { artifactListMethod } from \"./artifact/list.ts\";\nimport { artifactPublishMethod } from \"./artifact/publish.ts\";\nimport { artifactVerifyMethod } from \"./artifact/verify.ts\";\nimport { depsAddMethod } from \"./deps/add.ts\";\nimport { DEV_NOTIFY, DevNotifyParams, devStartMethod } from \"./dev/start.ts\";\nimport { devStopMethod } from \"./dev/stop.ts\";\nimport { eventsAckMethod } from \"./events/ack.ts\";\nimport { eventsReadMethod } from \"./events/read.ts\";\nimport { EVENTS_NOTIFY, EventsNotifyParams, eventsSubscribeMethod } from \"./events/subscribe.ts\";\nimport { eventsUnsubscribeMethod } from \"./events/unsubscribe.ts\";\nimport { gcRunMethod } from \"./gc/run.ts\";\nimport { instanceCheckMethod } from \"./instance/check.ts\";\nimport { instanceStatusMethod } from \"./instance/status.ts\";\nimport { livePushMethod } from \"./live/push.ts\";\nimport { mostraInitializeMethod } from \"./mostra/initialize.ts\";\nimport { mostraShutdownMethod } from \"./mostra/shutdown.ts\";\nimport { portDraftsMirrorMethod } from \"./port/drafts-mirror.ts\";\nimport { portIdentityResolveMethod } from \"./port/identity-resolve.ts\";\nimport { portSecretsGetMethod } from \"./port/secrets-get.ts\";\nimport { portSubmissionsDeliverMethod } from \"./port/submissions-deliver.ts\";\nimport { portTrustedControlsActivatedMethod } from \"./port/trusted-controls-activated.ts\";\nimport { portTrustedControlsPolicyMethod } from \"./port/trusted-controls-policy.ts\";\nimport { resultsGetMethod } from \"./results/get.ts\";\nimport { secretDeleteMethod } from \"./secret/delete.ts\";\nimport { secretListMethod } from \"./secret/list.ts\";\nimport { secretSetMethod } from \"./secret/set.ts\";\nimport { stateGetMethod } from \"./state/get.ts\";\nimport { statePatchMethod } from \"./state/patch.ts\";\nimport { viewDefaultMethod } from \"./view/default.ts\";\nimport { viewLaunchMethod } from \"./view/launch.ts\";\nimport { viewRevokeMethod } from \"./view/revoke.ts\";\nimport { viewRotateMethod } from \"./view/rotate.ts\";\nimport { viewUrlMethod } from \"./view/url.ts\";\nimport { waitMethod } from \"./wait/wait.ts\";\n// gen:method-imports\n\n/** Every host protocol method, in the order they were added. */\nexport const hostMethods: readonly AnyMethod[] = [\n mostraInitializeMethod,\n mostraShutdownMethod,\n instanceStatusMethod,\n artifactCreateMethod,\n artifactPublishMethod,\n artifactListMethod,\n artifactGetMethod,\n depsAddMethod,\n viewUrlMethod,\n viewRevokeMethod,\n viewRotateMethod,\n stateGetMethod,\n resultsGetMethod,\n waitMethod,\n eventsReadMethod,\n eventsSubscribeMethod,\n eventsUnsubscribeMethod,\n statePatchMethod,\n eventsAckMethod,\n portSubmissionsDeliverMethod,\n portDraftsMirrorMethod,\n portTrustedControlsPolicyMethod,\n portTrustedControlsActivatedMethod,\n secretSetMethod,\n secretListMethod,\n secretDeleteMethod,\n livePushMethod,\n portSecretsGetMethod,\n artifactVerifyMethod,\n viewDefaultMethod,\n viewLaunchMethod,\n gcRunMethod,\n instanceCheckMethod,\n devStartMethod,\n devStopMethod,\n portIdentityResolveMethod,\n // gen:methods\n];\n\n/** Every notification the instance sends to its clients (INTERFACES §6). */\nexport const hostNotifications: readonly AnyNotification[] = [\n { method: EVENTS_NOTIFY, params: EventsNotifyParams as AnyNotification[\"params\"] },\n { method: ARTIFACT_PROGRESS, params: ArtifactProgressParams as AnyNotification[\"params\"] },\n { method: DEV_NOTIFY, params: DevNotifyParams as AnyNotification[\"params\"] },\n];\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6CA,MAAa,cAAoC;CAC/C;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AAEF;;AAGA,MAAa,oBAAgD;CAC3D;EAAE,QAAQ;EAAe,QAAQ;CAAgD;CACjF;EAAE,QAAQ;EAAmB,QAAQ;CAAoD;CACzF;EAAE,QAAQ;EAAY,QAAQ;CAA6C;AAC7E"}
|
|
@@ -22,7 +22,7 @@ export declare const PortName: z.ZodType<PortName, string>;
|
|
|
22
22
|
export declare const CLI_CLIENT_NAME = "mostra-cli";
|
|
23
23
|
/** The client that opens a connection. */
|
|
24
24
|
export interface ClientInfo {
|
|
25
|
-
/** The client's name, for logs and status (`mostra-cli`, `
|
|
25
|
+
/** The client's name, for logs and status (`mostra-cli`, `my-host`). */
|
|
26
26
|
readonly name: string;
|
|
27
27
|
/** The client's own version. */
|
|
28
28
|
readonly version: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"initialize.js","names":[],"sources":["../../../src/methods/mostra/initialize.ts"],"sourcesContent":["import * as z from \"zod\";\nimport { Diagnostic } from \"../../diagnostics/diagnostic.ts\";\nimport { SubmitChannel } from \"../../interaction.ts\";\nimport { SubmissionPolicy } from \"../../manifest.ts\";\nimport { defineMethod, type MethodDefinition } from \"../../method.ts\";\nimport { Revision } from \"../../revision.ts\";\nimport { wireRegistry } from \"../../wire-registry.ts\";\n\n/**\n * A host port name (INTERFACES §7). Port names are open strings on the wire, so an older instance\n * answers a newer port with a warning instead of refusing the session (D84). `ai` is reserved for\n * the AI port, which is not part of v1 (D46).\n */\nexport type PortName =\n | \"identity\"\n | \"submissions\"\n | \"drafts\"\n | \"reviews\"\n | \"addressing\"\n | \"trustedControls\"\n | \"capture\"\n | \"secrets\"\n | \"pty\"\n | \"ai\"\n | (string & {});\n\n/** The Zod schema of the `PortName` type. */\nexport const PortName: z.ZodType<PortName, string> = z\n .string()\n .regex(/^[a-z][a-zA-Z0-9]*$/)\n .register(wireRegistry, {\n id: \"PortName\",\n description:\n \"A host port name: identity, submissions, drafts, reviews, addressing, trustedControls, capture, secrets, pty, or ai (reserved). Open for later ports.\",\n });\n\n/**\n * The standalone CLI's client name (D140 item 4). The supervisor marks a home as configured by a\n * host when any other client sends `home` or `ports`, and the CLI never sends telemetry for such a\n * home. A host that uses this name as its own is out of scope.\n */\nexport const CLI_CLIENT_NAME = \"mostra-cli\";\n\n/** The client that opens a connection. */\nexport interface ClientInfo {\n /** The client's name, for logs and status (`mostra-cli`, `jcode`). */\n readonly name: string;\n /** The client's own version. */\n readonly version: string;\n}\n\n/** What the client can handle (D84). */\nexport interface ClientCapabilities {\n /** Notification methods the client accepts. The instance sends no others. */\n readonly notifications?: readonly string[];\n}\n\n/**\n * Home settings from a spawning host (INTERFACES §6). Each setting arrives with the package that\n * implements it.\n */\nexport interface HomeConfig {\n /**\n * The home the client expects. A check, not a setting (D84): the instance chose and locked its\n * home at start-up, and refuses the session with `MOSTRA_HOME_MISMATCH` when this names a\n * different one.\n */\n readonly path?: string;\n /**\n * The dependency policy (D43, D95), kept in the home's `config.json` for every later client:\n * `auto` (the default) installs any package an artifact imports; `explicit` installs only what\n * `deps/add` adds and reports other imports as `MOSTRA_DEP_MISSING`.\n */\n readonly dependencies?: DependencyPolicy;\n /**\n * The home's submission policy (D102), kept in `config.json`: it applies to every artifact whose\n * `artifact/publish` names no policy, before the manifest's request.\n */\n readonly submission?: SubmissionPolicy;\n /**\n * The ports this client always provides, kept in `config.json` under its `client.name` (D105).\n * Submissions made while it is away wait in the outbox for it; an empty list stops that.\n */\n readonly ports?: readonly PortName[];\n /**\n * The submit channels the home accepts (D40, D108), kept in `config.json`: `[\"shell\"]` lets only\n * the shell's trusted Submit and Choose make submissions and choices; absent, both channels are\n * allowed. A host's `trustedControls` port answers per view instead, when it is connected.\n */\n readonly submitChannels?: readonly SubmitChannel[];\n}\n\n/** How packages enter an artifact's lockfile (D43). */\nexport type DependencyPolicy = \"auto\" | \"explicit\";\n\n/** The Zod schema of the `DependencyPolicy` type. */\nexport const DependencyPolicy: z.ZodType<DependencyPolicy> = z\n .enum([\"auto\", \"explicit\"])\n .register(wireRegistry, {\n id: \"DependencyPolicy\",\n description:\n \"How packages enter an artifact's lockfile: auto installs what artifacts import; explicit only what deps/add adds (D43).\",\n });\n\n/** The params of `mostra/initialize` (INTERFACES §6). */\nexport interface MostraInitializeParams {\n /** Who is connecting. */\n readonly client: ClientInfo;\n /**\n * The host protocol revisions the client speaks. The instance picks the newest one it also\n * supports, or refuses with `MOSTRA_HOST_REVISION_UNSUPPORTED`. Entries that aren't revisions\n * never match.\n */\n readonly revisions: readonly string[];\n /** What the client can handle. */\n readonly capabilities: ClientCapabilities;\n /**\n * Ports the client implements. The instance calls a port only on the connection that registered\n * it; ports it doesn't support get a `MOSTRA_HOST_PORT_UNSUPPORTED` warning.\n */\n readonly ports: readonly PortName[];\n /** Home settings and the home check. */\n readonly home?: HomeConfig;\n}\n\n/** The instance a client is connected to. */\nexport interface InstanceInfo {\n /** The runtime release (`@mostra/runtime` version). */\n readonly version: string;\n /** The home's real path. */\n readonly home: string;\n /** The platform as `<os>-<arch>`, for example `darwin-arm64`. */\n readonly platform: string;\n /** The supervisor's process ID. */\n readonly pid: number;\n /** `host` when spawned over stdio (`mostra-runtime host`), `daemon` when started as a daemon. */\n readonly mode: \"host\" | \"daemon\";\n}\n\n/** What the instance offers (D84). */\nexport interface InstanceCapabilities {\n /** Every method the instance serves. */\n readonly methods: readonly string[];\n /** Every notification the instance may send. */\n readonly notifications: readonly string[];\n /** The ports the instance calls when a client registers them. */\n readonly ports: readonly PortName[];\n}\n\n/** The result of `mostra/initialize`. */\nexport interface MostraInitializeResult {\n /** The negotiated host protocol revision: the newest both sides support. */\n readonly revision: Revision;\n /** The instance the client is connected to. */\n readonly instance: InstanceInfo;\n /** What the instance offers. */\n readonly capabilities: InstanceCapabilities;\n /** Warnings about the session, such as ports the instance doesn't support. */\n readonly warnings: readonly Diagnostic[];\n}\n\n/** The Zod schema of the `ClientInfo` type. */\nexport const ClientInfo: z.ZodType<ClientInfo> = z\n .object({ name: z.string().min(1), version: z.string() })\n .register(wireRegistry, { id: \"ClientInfo\", description: \"The client that opens a connection.\" });\n\n/** The Zod schema of the `ClientCapabilities` type. */\nexport const ClientCapabilities: z.ZodType<ClientCapabilities> = z\n .object({ notifications: z.array(z.string()).readonly().exactOptional() })\n .register(wireRegistry, {\n id: \"ClientCapabilities\",\n description: \"What the client can handle: the notification methods it accepts.\",\n });\n\n/** The Zod schema of the `HomeConfig` type. */\nexport const HomeConfig: z.ZodType<HomeConfig> = z\n .object({\n path: z.string().min(1).exactOptional(),\n dependencies: DependencyPolicy.exactOptional(),\n submission: SubmissionPolicy.exactOptional(),\n ports: z.array(PortName).max(32).readonly().exactOptional(),\n submitChannels: z.array(SubmitChannel).min(1).max(2).readonly().exactOptional(),\n })\n .register(wireRegistry, {\n id: \"HomeConfig\",\n description:\n \"Home settings from a spawning host; path is a check against the instance's home (D84), dependencies the dependency policy (D43), submission the home's policy (D102), ports those the host always provides (D105).\",\n });\n\n/** The Zod schema of the `InstanceInfo` type. */\nexport const InstanceInfo: z.ZodType<InstanceInfo> = z\n .object({\n version: z.string(),\n home: z.string(),\n platform: z.string(),\n pid: z.int().min(1),\n mode: z.enum([\"host\", \"daemon\"]),\n })\n .register(wireRegistry, {\n id: \"InstanceInfo\",\n description: \"The instance a client is connected to.\",\n });\n\n/** The Zod schema of the `InstanceCapabilities` type. */\nexport const InstanceCapabilities: z.ZodType<InstanceCapabilities> = z\n .object({\n methods: z.array(z.string()).readonly(),\n notifications: z.array(z.string()).readonly(),\n ports: z.array(PortName).readonly(),\n })\n .register(wireRegistry, {\n id: \"InstanceCapabilities\",\n description: \"What the instance offers: methods, notifications and supported ports.\",\n });\n\nconst params: z.ZodType<MostraInitializeParams> = z\n .object({\n client: ClientInfo,\n revisions: z.array(z.string()).readonly(),\n capabilities: ClientCapabilities,\n ports: z.array(PortName).readonly(),\n home: HomeConfig.exactOptional(),\n })\n .register(wireRegistry, { id: \"MostraInitializeParams\" });\n\nconst result: z.ZodType<MostraInitializeResult> = z\n .object({\n revision: Revision.schema,\n instance: InstanceInfo,\n capabilities: InstanceCapabilities,\n warnings: z.array(Diagnostic).readonly(),\n })\n .register(wireRegistry, { id: \"MostraInitializeResult\" });\n\n/**\n * `mostra/initialize`: opens a session. It must be the first request on a connection and is sent\n * once. It negotiates the protocol revision, registers the client's ports on this connection and\n * checks the home (D59, D84).\n */\nexport const mostraInitializeMethod: MethodDefinition<\n MostraInitializeParams,\n MostraInitializeResult\n> = defineMethod({\n method: \"mostra/initialize\",\n direction: \"client-to-instance\",\n mutating: false,\n params,\n result,\n});\n"],"mappings":";;;;;;;;;AA2BA,MAAa,WAAwC,EAClD,OAAO,CAAC,CACR,MAAM,qBAAqB,CAAC,CAC5B,SAAS,cAAc;CACtB,IAAI;CACJ,aACE;AACJ,CAAC;;;;;;AAOH,MAAa,kBAAkB;;AAuD/B,MAAa,mBAAgD,EAC1D,KAAK,CAAC,QAAQ,UAAU,CAAC,CAAC,CAC1B,SAAS,cAAc;CACtB,IAAI;CACJ,aACE;AACJ,CAAC;;AA4DH,MAAa,aAAoC,EAC9C,OAAO;CAAE,MAAM,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC;CAAG,SAAS,EAAE,OAAO;AAAE,CAAC,CAAC,CACxD,SAAS,cAAc;CAAE,IAAI;CAAc,aAAa;AAAsC,CAAC;;AAGlG,MAAa,qBAAoD,EAC9D,OAAO,EAAE,eAAe,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,cAAc,EAAE,CAAC,CAAC,CACzE,SAAS,cAAc;CACtB,IAAI;CACJ,aAAa;AACf,CAAC;;AAGH,MAAa,aAAoC,EAC9C,OAAO;CACN,MAAM,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,cAAc;CACtC,cAAc,iBAAiB,cAAc;CAC7C,YAAY,iBAAiB,cAAc;CAC3C,OAAO,EAAE,MAAM,QAAQ,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,cAAc;CAC1D,gBAAgB,EAAE,MAAM,aAAa,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,cAAc;AAChF,CAAC,CAAC,CACD,SAAS,cAAc;CACtB,IAAI;CACJ,aACE;AACJ,CAAC;;AAGH,MAAa,eAAwC,EAClD,OAAO;CACN,SAAS,EAAE,OAAO;CAClB,MAAM,EAAE,OAAO;CACf,UAAU,EAAE,OAAO;CACnB,KAAK,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC;CAClB,MAAM,EAAE,KAAK,CAAC,QAAQ,QAAQ,CAAC;AACjC,CAAC,CAAC,CACD,SAAS,cAAc;CACtB,IAAI;CACJ,aAAa;AACf,CAAC;;AAGH,MAAa,uBAAwD,EAClE,OAAO;CACN,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,SAAS;CACtC,eAAe,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,SAAS;CAC5C,OAAO,EAAE,MAAM,QAAQ,CAAC,CAAC,SAAS;AACpC,CAAC,CAAC,CACD,SAAS,cAAc;CACtB,IAAI;CACJ,aAAa;AACf,CAAC;AAEH,MAAM,SAA4C,EAC/C,OAAO;CACN,QAAQ;CACR,WAAW,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,SAAS;CACxC,cAAc;CACd,OAAO,EAAE,MAAM,QAAQ,CAAC,CAAC,SAAS;CAClC,MAAM,WAAW,cAAc;AACjC,CAAC,CAAC,CACD,SAAS,cAAc,EAAE,IAAI,yBAAyB,CAAC;AAE1D,MAAM,SAA4C,EAC/C,OAAO;CACN,UAAU,SAAS;CACnB,UAAU;CACV,cAAc;CACd,UAAU,EAAE,MAAM,UAAU,CAAC,CAAC,SAAS;AACzC,CAAC,CAAC,CACD,SAAS,cAAc,EAAE,IAAI,yBAAyB,CAAC;;;;;;AAO1D,MAAa,yBAGT,aAAa;CACf,QAAQ;CACR,WAAW;CACX,UAAU;CACV;CACA;AACF,CAAC"}
|
|
1
|
+
{"version":3,"file":"initialize.js","names":[],"sources":["../../../src/methods/mostra/initialize.ts"],"sourcesContent":["import * as z from \"zod\";\nimport { Diagnostic } from \"../../diagnostics/diagnostic.ts\";\nimport { SubmitChannel } from \"../../interaction.ts\";\nimport { SubmissionPolicy } from \"../../manifest.ts\";\nimport { defineMethod, type MethodDefinition } from \"../../method.ts\";\nimport { Revision } from \"../../revision.ts\";\nimport { wireRegistry } from \"../../wire-registry.ts\";\n\n/**\n * A host port name (INTERFACES §7). Port names are open strings on the wire, so an older instance\n * answers a newer port with a warning instead of refusing the session (D84). `ai` is reserved for\n * the AI port, which is not part of v1 (D46).\n */\nexport type PortName =\n | \"identity\"\n | \"submissions\"\n | \"drafts\"\n | \"reviews\"\n | \"addressing\"\n | \"trustedControls\"\n | \"capture\"\n | \"secrets\"\n | \"pty\"\n | \"ai\"\n | (string & {});\n\n/** The Zod schema of the `PortName` type. */\nexport const PortName: z.ZodType<PortName, string> = z\n .string()\n .regex(/^[a-z][a-zA-Z0-9]*$/)\n .register(wireRegistry, {\n id: \"PortName\",\n description:\n \"A host port name: identity, submissions, drafts, reviews, addressing, trustedControls, capture, secrets, pty, or ai (reserved). Open for later ports.\",\n });\n\n/**\n * The standalone CLI's client name (D140 item 4). The supervisor marks a home as configured by a\n * host when any other client sends `home` or `ports`, and the CLI never sends telemetry for such a\n * home. A host that uses this name as its own is out of scope.\n */\nexport const CLI_CLIENT_NAME = \"mostra-cli\";\n\n/** The client that opens a connection. */\nexport interface ClientInfo {\n /** The client's name, for logs and status (`mostra-cli`, `my-host`). */\n readonly name: string;\n /** The client's own version. */\n readonly version: string;\n}\n\n/** What the client can handle (D84). */\nexport interface ClientCapabilities {\n /** Notification methods the client accepts. The instance sends no others. */\n readonly notifications?: readonly string[];\n}\n\n/**\n * Home settings from a spawning host (INTERFACES §6). Each setting arrives with the package that\n * implements it.\n */\nexport interface HomeConfig {\n /**\n * The home the client expects. A check, not a setting (D84): the instance chose and locked its\n * home at start-up, and refuses the session with `MOSTRA_HOME_MISMATCH` when this names a\n * different one.\n */\n readonly path?: string;\n /**\n * The dependency policy (D43, D95), kept in the home's `config.json` for every later client:\n * `auto` (the default) installs any package an artifact imports; `explicit` installs only what\n * `deps/add` adds and reports other imports as `MOSTRA_DEP_MISSING`.\n */\n readonly dependencies?: DependencyPolicy;\n /**\n * The home's submission policy (D102), kept in `config.json`: it applies to every artifact whose\n * `artifact/publish` names no policy, before the manifest's request.\n */\n readonly submission?: SubmissionPolicy;\n /**\n * The ports this client always provides, kept in `config.json` under its `client.name` (D105).\n * Submissions made while it is away wait in the outbox for it; an empty list stops that.\n */\n readonly ports?: readonly PortName[];\n /**\n * The submit channels the home accepts (D40, D108), kept in `config.json`: `[\"shell\"]` lets only\n * the shell's trusted Submit and Choose make submissions and choices; absent, both channels are\n * allowed. A host's `trustedControls` port answers per view instead, when it is connected.\n */\n readonly submitChannels?: readonly SubmitChannel[];\n}\n\n/** How packages enter an artifact's lockfile (D43). */\nexport type DependencyPolicy = \"auto\" | \"explicit\";\n\n/** The Zod schema of the `DependencyPolicy` type. */\nexport const DependencyPolicy: z.ZodType<DependencyPolicy> = z\n .enum([\"auto\", \"explicit\"])\n .register(wireRegistry, {\n id: \"DependencyPolicy\",\n description:\n \"How packages enter an artifact's lockfile: auto installs what artifacts import; explicit only what deps/add adds (D43).\",\n });\n\n/** The params of `mostra/initialize` (INTERFACES §6). */\nexport interface MostraInitializeParams {\n /** Who is connecting. */\n readonly client: ClientInfo;\n /**\n * The host protocol revisions the client speaks. The instance picks the newest one it also\n * supports, or refuses with `MOSTRA_HOST_REVISION_UNSUPPORTED`. Entries that aren't revisions\n * never match.\n */\n readonly revisions: readonly string[];\n /** What the client can handle. */\n readonly capabilities: ClientCapabilities;\n /**\n * Ports the client implements. The instance calls a port only on the connection that registered\n * it; ports it doesn't support get a `MOSTRA_HOST_PORT_UNSUPPORTED` warning.\n */\n readonly ports: readonly PortName[];\n /** Home settings and the home check. */\n readonly home?: HomeConfig;\n}\n\n/** The instance a client is connected to. */\nexport interface InstanceInfo {\n /** The runtime release (`@mostra/runtime` version). */\n readonly version: string;\n /** The home's real path. */\n readonly home: string;\n /** The platform as `<os>-<arch>`, for example `darwin-arm64`. */\n readonly platform: string;\n /** The supervisor's process ID. */\n readonly pid: number;\n /** `host` when spawned over stdio (`mostra-runtime host`), `daemon` when started as a daemon. */\n readonly mode: \"host\" | \"daemon\";\n}\n\n/** What the instance offers (D84). */\nexport interface InstanceCapabilities {\n /** Every method the instance serves. */\n readonly methods: readonly string[];\n /** Every notification the instance may send. */\n readonly notifications: readonly string[];\n /** The ports the instance calls when a client registers them. */\n readonly ports: readonly PortName[];\n}\n\n/** The result of `mostra/initialize`. */\nexport interface MostraInitializeResult {\n /** The negotiated host protocol revision: the newest both sides support. */\n readonly revision: Revision;\n /** The instance the client is connected to. */\n readonly instance: InstanceInfo;\n /** What the instance offers. */\n readonly capabilities: InstanceCapabilities;\n /** Warnings about the session, such as ports the instance doesn't support. */\n readonly warnings: readonly Diagnostic[];\n}\n\n/** The Zod schema of the `ClientInfo` type. */\nexport const ClientInfo: z.ZodType<ClientInfo> = z\n .object({ name: z.string().min(1), version: z.string() })\n .register(wireRegistry, { id: \"ClientInfo\", description: \"The client that opens a connection.\" });\n\n/** The Zod schema of the `ClientCapabilities` type. */\nexport const ClientCapabilities: z.ZodType<ClientCapabilities> = z\n .object({ notifications: z.array(z.string()).readonly().exactOptional() })\n .register(wireRegistry, {\n id: \"ClientCapabilities\",\n description: \"What the client can handle: the notification methods it accepts.\",\n });\n\n/** The Zod schema of the `HomeConfig` type. */\nexport const HomeConfig: z.ZodType<HomeConfig> = z\n .object({\n path: z.string().min(1).exactOptional(),\n dependencies: DependencyPolicy.exactOptional(),\n submission: SubmissionPolicy.exactOptional(),\n ports: z.array(PortName).max(32).readonly().exactOptional(),\n submitChannels: z.array(SubmitChannel).min(1).max(2).readonly().exactOptional(),\n })\n .register(wireRegistry, {\n id: \"HomeConfig\",\n description:\n \"Home settings from a spawning host; path is a check against the instance's home (D84), dependencies the dependency policy (D43), submission the home's policy (D102), ports those the host always provides (D105).\",\n });\n\n/** The Zod schema of the `InstanceInfo` type. */\nexport const InstanceInfo: z.ZodType<InstanceInfo> = z\n .object({\n version: z.string(),\n home: z.string(),\n platform: z.string(),\n pid: z.int().min(1),\n mode: z.enum([\"host\", \"daemon\"]),\n })\n .register(wireRegistry, {\n id: \"InstanceInfo\",\n description: \"The instance a client is connected to.\",\n });\n\n/** The Zod schema of the `InstanceCapabilities` type. */\nexport const InstanceCapabilities: z.ZodType<InstanceCapabilities> = z\n .object({\n methods: z.array(z.string()).readonly(),\n notifications: z.array(z.string()).readonly(),\n ports: z.array(PortName).readonly(),\n })\n .register(wireRegistry, {\n id: \"InstanceCapabilities\",\n description: \"What the instance offers: methods, notifications and supported ports.\",\n });\n\nconst params: z.ZodType<MostraInitializeParams> = z\n .object({\n client: ClientInfo,\n revisions: z.array(z.string()).readonly(),\n capabilities: ClientCapabilities,\n ports: z.array(PortName).readonly(),\n home: HomeConfig.exactOptional(),\n })\n .register(wireRegistry, { id: \"MostraInitializeParams\" });\n\nconst result: z.ZodType<MostraInitializeResult> = z\n .object({\n revision: Revision.schema,\n instance: InstanceInfo,\n capabilities: InstanceCapabilities,\n warnings: z.array(Diagnostic).readonly(),\n })\n .register(wireRegistry, { id: \"MostraInitializeResult\" });\n\n/**\n * `mostra/initialize`: opens a session. It must be the first request on a connection and is sent\n * once. It negotiates the protocol revision, registers the client's ports on this connection and\n * checks the home (D59, D84).\n */\nexport const mostraInitializeMethod: MethodDefinition<\n MostraInitializeParams,\n MostraInitializeResult\n> = defineMethod({\n method: \"mostra/initialize\",\n direction: \"client-to-instance\",\n mutating: false,\n params,\n result,\n});\n"],"mappings":";;;;;;;;;AA2BA,MAAa,WAAwC,EAClD,OAAO,CAAC,CACR,MAAM,qBAAqB,CAAC,CAC5B,SAAS,cAAc;CACtB,IAAI;CACJ,aACE;AACJ,CAAC;;;;;;AAOH,MAAa,kBAAkB;;AAuD/B,MAAa,mBAAgD,EAC1D,KAAK,CAAC,QAAQ,UAAU,CAAC,CAAC,CAC1B,SAAS,cAAc;CACtB,IAAI;CACJ,aACE;AACJ,CAAC;;AA4DH,MAAa,aAAoC,EAC9C,OAAO;CAAE,MAAM,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC;CAAG,SAAS,EAAE,OAAO;AAAE,CAAC,CAAC,CACxD,SAAS,cAAc;CAAE,IAAI;CAAc,aAAa;AAAsC,CAAC;;AAGlG,MAAa,qBAAoD,EAC9D,OAAO,EAAE,eAAe,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,cAAc,EAAE,CAAC,CAAC,CACzE,SAAS,cAAc;CACtB,IAAI;CACJ,aAAa;AACf,CAAC;;AAGH,MAAa,aAAoC,EAC9C,OAAO;CACN,MAAM,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,cAAc;CACtC,cAAc,iBAAiB,cAAc;CAC7C,YAAY,iBAAiB,cAAc;CAC3C,OAAO,EAAE,MAAM,QAAQ,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,cAAc;CAC1D,gBAAgB,EAAE,MAAM,aAAa,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,cAAc;AAChF,CAAC,CAAC,CACD,SAAS,cAAc;CACtB,IAAI;CACJ,aACE;AACJ,CAAC;;AAGH,MAAa,eAAwC,EAClD,OAAO;CACN,SAAS,EAAE,OAAO;CAClB,MAAM,EAAE,OAAO;CACf,UAAU,EAAE,OAAO;CACnB,KAAK,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC;CAClB,MAAM,EAAE,KAAK,CAAC,QAAQ,QAAQ,CAAC;AACjC,CAAC,CAAC,CACD,SAAS,cAAc;CACtB,IAAI;CACJ,aAAa;AACf,CAAC;;AAGH,MAAa,uBAAwD,EAClE,OAAO;CACN,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,SAAS;CACtC,eAAe,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,SAAS;CAC5C,OAAO,EAAE,MAAM,QAAQ,CAAC,CAAC,SAAS;AACpC,CAAC,CAAC,CACD,SAAS,cAAc;CACtB,IAAI;CACJ,aAAa;AACf,CAAC;AAEH,MAAM,SAA4C,EAC/C,OAAO;CACN,QAAQ;CACR,WAAW,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,SAAS;CACxC,cAAc;CACd,OAAO,EAAE,MAAM,QAAQ,CAAC,CAAC,SAAS;CAClC,MAAM,WAAW,cAAc;AACjC,CAAC,CAAC,CACD,SAAS,cAAc,EAAE,IAAI,yBAAyB,CAAC;AAE1D,MAAM,SAA4C,EAC/C,OAAO;CACN,UAAU,SAAS;CACnB,UAAU;CACV,cAAc;CACd,UAAU,EAAE,MAAM,UAAU,CAAC,CAAC,SAAS;AACzC,CAAC,CAAC,CACD,SAAS,cAAc,EAAE,IAAI,yBAAyB,CAAC;;;;;;AAO1D,MAAa,yBAGT,aAAa;CACf,QAAQ;CACR,WAAW;CACX,UAAU;CACV;CACA;AACF,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { ViewerSpec } from "../../interaction.js";
|
|
2
|
+
import { MethodDefinition } from "../../method.js";
|
|
3
|
+
//#region src/methods/port/identity-resolve.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* How a browser's request reached the gateway (D143 item 2): `local` on the gateway's own
|
|
6
|
+
* address; `tailnet` through Tailscale Serve and `token` through a public share, where the link is
|
|
7
|
+
* all that identifies the viewer (both WP-13). An open string on the wire, so a host meets a newer
|
|
8
|
+
* value instead of a refusal.
|
|
9
|
+
*/
|
|
10
|
+
export type IdentityVia = "local" | "tailnet" | "token" | (string & {});
|
|
11
|
+
/** The params of `port/identity.resolve` (INTERFACES §7, D143 item 2). */
|
|
12
|
+
export interface PortIdentityResolveParams {
|
|
13
|
+
/** The artifact whose link is being opened. */
|
|
14
|
+
readonly artifactId: string;
|
|
15
|
+
/** How the request reached the gateway. */
|
|
16
|
+
readonly via: IdentityVia;
|
|
17
|
+
/**
|
|
18
|
+
* The request's headers, names in lower case, without `cookie` and without Mostra's own
|
|
19
|
+
* `x-mostra-*` headers: what a host's proxy or tunnel added (an identity header) is here.
|
|
20
|
+
*/
|
|
21
|
+
readonly headers: Readonly<Record<string, string>>;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* The result of `port/identity.resolve`: the person, as the host's stable key and display name
|
|
25
|
+
* (one viewer of kind `host` per `ref`), or `null` for the standalone default.
|
|
26
|
+
*/
|
|
27
|
+
export type PortIdentityResolveResult = ViewerSpec | null;
|
|
28
|
+
/**
|
|
29
|
+
* `port/identity.resolve`: Mostra asks the host that registered the `identity` port who a browser
|
|
30
|
+
* is when it opens a link minted without a viewer (D143 item 2), with 5 seconds to answer. A
|
|
31
|
+
* failure, a timeout or an answer the schema refuses refuses the link's exchange with
|
|
32
|
+
* `MOSTRA_HOST_IDENTITY_UNAVAILABLE`; it never falls back to another person.
|
|
33
|
+
*/
|
|
34
|
+
export declare const portIdentityResolveMethod: MethodDefinition<PortIdentityResolveParams, PortIdentityResolveResult>;
|
|
35
|
+
//#endregion
|
|
36
|
+
//# sourceMappingURL=identity-resolve.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"identity-resolve.d.ts","names":[],"sources":["../../../src/methods/port/identity-resolve.ts"],"mappings":";;;;;;;;;YAYY;;iBAGK;;WAEN;;WAEA,KAAK;;;;;WAKL,SAAS,SAAS;;;;;;YAOjB,4BAA4B;;;;;;;qBA0B3B,2BAA2B,iBACtC,2BACA"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { wireRegistry } from "../../wire-registry.js";
|
|
2
|
+
import { ArtifactId } from "../../ids.js";
|
|
3
|
+
import { ViewerSpec } from "../../interaction.js";
|
|
4
|
+
import { defineMethod } from "../../method.js";
|
|
5
|
+
import * as z from "zod";
|
|
6
|
+
//#region src/methods/port/identity-resolve.ts
|
|
7
|
+
const params = z.object({
|
|
8
|
+
artifactId: ArtifactId.schema,
|
|
9
|
+
via: z.string().min(1),
|
|
10
|
+
headers: z.record(z.string(), z.string())
|
|
11
|
+
}).register(wireRegistry, {
|
|
12
|
+
id: "PortIdentityResolveParams",
|
|
13
|
+
description: "A browser opening a link without a viewer: the artifact, how the request arrived and its headers (no cookies, no Mostra headers)."
|
|
14
|
+
});
|
|
15
|
+
const result = ViewerSpec.nullable().register(wireRegistry, {
|
|
16
|
+
id: "PortIdentityResolveResult",
|
|
17
|
+
description: "The person the session acts for, by the host's stable key, or null for the default."
|
|
18
|
+
});
|
|
19
|
+
/**
|
|
20
|
+
* `port/identity.resolve`: Mostra asks the host that registered the `identity` port who a browser
|
|
21
|
+
* is when it opens a link minted without a viewer (D143 item 2), with 5 seconds to answer. A
|
|
22
|
+
* failure, a timeout or an answer the schema refuses refuses the link's exchange with
|
|
23
|
+
* `MOSTRA_HOST_IDENTITY_UNAVAILABLE`; it never falls back to another person.
|
|
24
|
+
*/
|
|
25
|
+
const portIdentityResolveMethod = defineMethod({
|
|
26
|
+
method: "port/identity.resolve",
|
|
27
|
+
direction: "instance-to-host",
|
|
28
|
+
mutating: false,
|
|
29
|
+
params,
|
|
30
|
+
result
|
|
31
|
+
});
|
|
32
|
+
//#endregion
|
|
33
|
+
export { portIdentityResolveMethod };
|
|
34
|
+
|
|
35
|
+
//# sourceMappingURL=identity-resolve.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"identity-resolve.js","names":[],"sources":["../../../src/methods/port/identity-resolve.ts"],"sourcesContent":["import * as z from \"zod\";\nimport { ArtifactId } 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 browser's request reached the gateway (D143 item 2): `local` on the gateway's own\n * address; `tailnet` through Tailscale Serve and `token` through a public share, where the link is\n * all that identifies the viewer (both WP-13). An open string on the wire, so a host meets a newer\n * value instead of a refusal.\n */\nexport type IdentityVia = \"local\" | \"tailnet\" | \"token\" | (string & {});\n\n/** The params of `port/identity.resolve` (INTERFACES §7, D143 item 2). */\nexport interface PortIdentityResolveParams {\n /** The artifact whose link is being opened. */\n readonly artifactId: string;\n /** How the request reached the gateway. */\n readonly via: IdentityVia;\n /**\n * The request's headers, names in lower case, without `cookie` and without Mostra's own\n * `x-mostra-*` headers: what a host's proxy or tunnel added (an identity header) is here.\n */\n readonly headers: Readonly<Record<string, string>>;\n}\n\n/**\n * The result of `port/identity.resolve`: the person, as the host's stable key and display name\n * (one viewer of kind `host` per `ref`), or `null` for the standalone default.\n */\nexport type PortIdentityResolveResult = ViewerSpec | null;\n\nconst params: z.ZodType<PortIdentityResolveParams> = z\n .object({\n artifactId: ArtifactId.schema,\n via: z.string().min(1),\n headers: z.record(z.string(), z.string()),\n })\n .register(wireRegistry, {\n id: \"PortIdentityResolveParams\",\n description:\n \"A browser opening a link without a viewer: the artifact, how the request arrived and its headers (no cookies, no Mostra headers).\",\n });\n\nconst result: z.ZodType<PortIdentityResolveResult> = ViewerSpec.nullable().register(wireRegistry, {\n id: \"PortIdentityResolveResult\",\n description:\n \"The person the session acts for, by the host's stable key, or null for the default.\",\n});\n\n/**\n * `port/identity.resolve`: Mostra asks the host that registered the `identity` port who a browser\n * is when it opens a link minted without a viewer (D143 item 2), with 5 seconds to answer. A\n * failure, a timeout or an answer the schema refuses refuses the link's exchange with\n * `MOSTRA_HOST_IDENTITY_UNAVAILABLE`; it never falls back to another person.\n */\nexport const portIdentityResolveMethod: MethodDefinition<\n PortIdentityResolveParams,\n PortIdentityResolveResult\n> = defineMethod({\n method: \"port/identity.resolve\",\n direction: \"instance-to-host\",\n mutating: false,\n params,\n result,\n});\n"],"mappings":";;;;;;AAiCA,MAAM,SAA+C,EAClD,OAAO;CACN,YAAY,WAAW;CACvB,KAAK,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC;CACrB,SAAS,EAAE,OAAO,EAAE,OAAO,GAAG,EAAE,OAAO,CAAC;AAC1C,CAAC,CAAC,CACD,SAAS,cAAc;CACtB,IAAI;CACJ,aACE;AACJ,CAAC;AAEH,MAAM,SAA+C,WAAW,SAAS,CAAC,CAAC,SAAS,cAAc;CAChG,IAAI;CACJ,aACE;AACJ,CAAC;;;;;;;AAQD,MAAa,4BAGT,aAAa;CACf,QAAQ;CACR,WAAW;CACX,UAAU;CACV;CACA;AACF,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mostra/protocol",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Mostra's shared protocol vocabulary: IDs, dated revisions and diagnostics, with Zod schemas and generated JSON Schema.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "The Mostra Authors",
|
|
@@ -93,7 +93,7 @@
|
|
|
93
93
|
"ignore": [
|
|
94
94
|
"zod"
|
|
95
95
|
],
|
|
96
|
-
"limit": "8.
|
|
96
|
+
"limit": "8.75 kB"
|
|
97
97
|
},
|
|
98
98
|
{
|
|
99
99
|
"name": "@mostra/protocol server-function serializer (D54)",
|