@mostra/protocol 0.6.1 → 0.7.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/bridge.d.ts +25 -0
- package/dist/bridge.d.ts.map +1 -1
- package/dist/bridge.js +32 -2
- package/dist/bridge.js.map +1 -1
- package/dist/browser.d.ts +76 -0
- package/dist/browser.d.ts.map +1 -1
- package/dist/browser.js +45 -2
- package/dist/browser.js.map +1 -1
- package/dist/diagnostics/codes/hygiene.d.ts +1 -1
- package/dist/diagnostics/codes/hygiene.d.ts.map +1 -1
- package/dist/diagnostics/codes/hygiene.js +12 -1
- package/dist/diagnostics/codes/hygiene.js.map +1 -1
- package/dist/diagnostics/codes/index.d.ts +3 -2
- package/dist/diagnostics/codes/index.d.ts.map +1 -1
- package/dist/diagnostics/codes/index.js +3 -1
- package/dist/diagnostics/codes/index.js.map +1 -1
- package/dist/diagnostics/codes/share.d.ts +8 -0
- package/dist/diagnostics/codes/share.d.ts.map +1 -0
- package/dist/diagnostics/codes/share.js +88 -0
- package/dist/diagnostics/codes/share.js.map +1 -0
- package/dist/hygiene.d.ts.map +1 -1
- package/dist/hygiene.js +2 -1
- package/dist/hygiene.js.map +1 -1
- package/dist/ids.d.ts +5 -1
- package/dist/ids.d.ts.map +1 -1
- package/dist/ids.js +3 -1
- package/dist/ids.js.map +1 -1
- package/dist/index.d.ts +10 -5
- package/dist/index.js +9 -4
- package/dist/methods/index.d.ts.map +1 -1
- package/dist/methods/index.js +9 -1
- package/dist/methods/index.js.map +1 -1
- package/dist/methods/instance/status.d.ts +24 -0
- package/dist/methods/instance/status.d.ts.map +1 -1
- package/dist/methods/instance/status.js +11 -2
- package/dist/methods/instance/status.js.map +1 -1
- package/dist/methods/port/addressing-external-base.d.ts +52 -0
- package/dist/methods/port/addressing-external-base.d.ts.map +1 -0
- package/dist/methods/port/addressing-external-base.js +61 -0
- package/dist/methods/port/addressing-external-base.js.map +1 -0
- package/dist/methods/share/list.d.ts +23 -0
- package/dist/methods/share/list.d.ts.map +1 -0
- package/dist/methods/share/list.js +29 -0
- package/dist/methods/share/list.js.map +1 -0
- package/dist/methods/share/start.d.ts +96 -0
- package/dist/methods/share/start.d.ts.map +1 -0
- package/dist/methods/share/start.js +73 -0
- package/dist/methods/share/start.js.map +1 -0
- package/dist/methods/share/stop.d.ts +29 -0
- package/dist/methods/share/stop.d.ts.map +1 -0
- package/dist/methods/share/stop.js +32 -0
- package/dist/methods/share/stop.js.map +1 -0
- package/package.json +3 -3
- package/schemas/protocol.draft-07.json +535 -0
- package/schemas/protocol.schema.json +507 -0
- package/src/bridge.ts +49 -0
- package/src/browser.ts +118 -0
- package/src/diagnostics/codes/hygiene.ts +12 -0
- package/src/diagnostics/codes/index.ts +6 -2
- package/src/diagnostics/codes/share.ts +100 -0
- package/src/hygiene.ts +1 -0
- package/src/ids.ts +9 -1
- package/src/index.ts +39 -0
- package/src/methods/index.ts +8 -0
- package/src/methods/instance/status.ts +38 -0
- package/src/methods/port/addressing-external-base.ts +113 -0
- package/src/methods/share/list.ts +42 -0
- package/src/methods/share/start.ts +150 -0
- package/src/methods/share/stop.ts +50 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hygiene.js","names":[],"sources":["../../../src/diagnostics/codes/hygiene.ts"],"sourcesContent":["/**\n * Diagnostic codes of the HYGIENE area: requests the gateway refuses because they don't come from\n * the holder of an artifact's capability URL (D06, HY-01). None of them limits what an artifact\n * or an agent may do; each keeps strangers out.\n */\nimport type { AreaCatalog } from \"../spec.ts\";\n\n/** The codes of the HYGIENE area, in the order they were added. */\nexport const hygieneDiagnosticCodes = [\n \"MOSTRA_HYGIENE_HOST_REFUSED\",\n \"MOSTRA_HYGIENE_ORIGIN_REFUSED\",\n \"MOSTRA_HYGIENE_CSRF_MISSING\",\n \"MOSTRA_HYGIENE_CONTENT_TYPE\",\n \"MOSTRA_HYGIENE_REQUEST_MALFORMED\",\n \"MOSTRA_HYGIENE_SESSION_MISSING\",\n \"MOSTRA_HYGIENE_TOKEN_INVALID\",\n \"MOSTRA_HYGIENE_TOKEN_REVOKED\",\n \"MOSTRA_HYGIENE_SCOPE_DENIED\",\n \"MOSTRA_HYGIENE_RATE_LIMITED\",\n \"MOSTRA_HYGIENE_NOT_SERVED\",\n \"MOSTRA_HYGIENE_SESSION_CONFLICT\",\n \"MOSTRA_HYGIENE_HEADERS_TOO_LARGE\",\n // gen:codes\n] as const;\n\n/** The codes of the HYGIENE area. */\nexport type HygieneDiagnosticCode = (typeof hygieneDiagnosticCodes)[number];\n\n/** The HYGIENE area's catalog entries. */\nexport const hygieneDiagnostics: AreaCatalog<HygieneDiagnosticCode> = {\n MOSTRA_HYGIENE_HOST_REFUSED: {\n severity: \"error\",\n phase: \"hygiene\",\n title: \"Host not served\",\n hint: \"Open the artifact through the exact link Mostra gave you.\",\n docs: {\n explanation:\n \"The request's `Host` header named a host this gateway doesn't serve. Each gateway listener accepts exactly the host and port its capability URLs use, so a page that rebinds its own DNS name to the loopback address can't reach an artifact (DNS rebinding). The gateway answers 421.\",\n fix: \"Use the URL from `view/url` or the publish receipt as it is, without replacing `127.0.0.1` by `localhost` or another name. A gateway started with `--bind` and `--url-host` accepts the URL host it was given.\",\n },\n },\n MOSTRA_HYGIENE_ORIGIN_REFUSED: {\n severity: \"error\",\n phase: \"hygiene\",\n title: \"Origin refused\",\n hint: \"Send the request from the page's own origin.\",\n docs: {\n explanation:\n \"A request that changes state, opens a stream or upgrades to a WebSocket must carry an `Origin` header equal to the origin it is sent to. The gateway compares the strings exactly and answers 403 otherwise, so another website, or another artifact on a different port, can't drive this one.\",\n fix: \"Call the gateway from the page it serves: the shell from the shell, the artifact from its own frame. Tools outside a browser send the listener's own origin.\",\n },\n },\n MOSTRA_HYGIENE_CSRF_MISSING: {\n severity: \"error\",\n phase: \"hygiene\",\n title: \"CSRF token missing or wrong\",\n hint: \"Send the session's CSRF token from `GET /_mostra/session` in the `X-Mostra-CSRF` header.\",\n docs: {\n explanation:\n \"Every request that changes state through a session carries the session's CSRF token in the `X-Mostra-CSRF` header. The token comes only from the session endpoint of the same origin, which no other page can read. A missing or different token is answered with 403.\",\n fix: \"Read `csrf` from `GET /_mostra/session` (on the shell, `GET /a/<artifactId>/_mostra/session`) and send it with every POST. Mostra's client runtime and shell do this for you.\",\n },\n },\n MOSTRA_HYGIENE_CONTENT_TYPE: {\n severity: \"error\",\n phase: \"hygiene\",\n title: \"JSON content type required\",\n hint: \"Send the body as JSON with `Content-Type: application/json`.\",\n docs: {\n explanation:\n \"Requests that change state must have a JSON body. A form or plain-text body is something any website can send without asking the browser first, so the gateway refuses it with 415.\",\n fix: \"Send `Content-Type: application/json` and a JSON body.\",\n },\n },\n MOSTRA_HYGIENE_REQUEST_MALFORMED: {\n severity: \"error\",\n phase: \"hygiene\",\n title: \"Malformed request\",\n hint: \"Send one well-formed HTTP request with a path that starts with `/`.\",\n docs: {\n explanation:\n \"The gateway refused a request it can't interpret safely: a repeated `Host` or `Origin` header, a request target that isn't a path, an encoded `/` or `..` that would leave the served tree, a body that isn't valid JSON, or a header with control characters. It answers 400 rather than guess.\",\n fix: \"Send a single request with one `Host` header and a plain path. Browsers always do; this usually means a hand-written client or a probe.\",\n },\n },\n MOSTRA_HYGIENE_SESSION_MISSING: {\n severity: \"error\",\n phase: \"hygiene\",\n title: \"No session\",\n hint: \"Open the artifact's capability link again to start a session.\",\n docs: {\n explanation:\n \"The request carried no valid session for this origin. Sessions start when a capability link is opened: the shell exchanges the link's token for a session cookie, and gives the artifact frame a single-use ticket for its own. A session issued for another origin never counts, because every port of the host shares the browser's cookies. The gateway answers 401.\",\n fix: \"Open the full capability link, including the part after `#`. A bookmark of the page without it works while the browser keeps the session cookie (400 days).\",\n },\n },\n MOSTRA_HYGIENE_TOKEN_INVALID: {\n severity: \"error\",\n phase: \"hygiene\",\n title: \"Unknown capability token\",\n hint: \"Use the complete capability link Mostra gave you, or mint a new one with `view/url`.\",\n docs: {\n explanation:\n \"The capability token or frame ticket matched nothing in this home: it was mistyped, cut short, belongs to another home or artifact, or the ticket was already used or expired (tickets last 60 seconds and work once). Over the host protocol, the token ID named in `view/revoke` or `view/rotate` doesn't exist. The gateway answers 401, and failed attempts count towards the rate limit.\",\n fix: \"Copy the whole link again. An agent or host mints a fresh one with `view/url`; the shell gets a new frame ticket by reloading.\",\n },\n },\n MOSTRA_HYGIENE_TOKEN_REVOKED: {\n severity: \"error\",\n phase: \"hygiene\",\n title: \"Link revoked or expired\",\n hint: \"Ask for a new link: `view/url` mints one, or `view/rotate` replaces this one.\",\n docs: {\n explanation:\n \"The capability link was revoked (`view/revoke`), replaced (`view/rotate`), or reached the end of its `ttl`. Every session started from it ends too. The gateway answers 410. Local links have no expiry unless one was asked for.\",\n fix: \"Get a new link from whoever shared this one. An agent mints it with `view/url`, or rotates the old one with `view/rotate`, and shares the new URL.\",\n },\n },\n MOSTRA_HYGIENE_SCOPE_DENIED: {\n severity: \"error\",\n phase: \"hygiene\",\n title: \"Not allowed by this link\",\n hint: \"Open a link minted with this scope (`view/url` with `scopes`).\",\n docs: {\n explanation:\n \"The session's link doesn't carry the scope this request needs: `draft` to save answers, `submit` to submit, `review` to comment, and `action:*`, `action:<export>` or `action:<module path>#<export>` to run a server function. A view-and-comment link, for example, can't submit or run an action. The gateway answers 403.\",\n fix: 'Mint a link with the scopes the viewer needs, such as `view/url` with `scopes: [\"view\", \"draft\", \"submit\"]`. Without `scopes`, a link carries every scope.',\n },\n },\n MOSTRA_HYGIENE_RATE_LIMITED: {\n severity: \"error\",\n phase: \"hygiene\",\n title: \"Too many failed attempts\",\n hint: \"Wait for the time in `Retry-After`, then open the link again.\",\n docs: {\n explanation:\n \"More than 30 capability tokens failed for this artifact within a minute, so the gateway refuses every token for it, valid ones included, until the minute has passed. A guess can't succeed while the limit holds, and only this artifact's links wait. The gateway answers 429 with `Retry-After`.\",\n fix: \"Wait, then open the link again. Repeated failures usually come from a mistyped link or a script retrying an old one.\",\n },\n },\n MOSTRA_HYGIENE_NOT_SERVED: {\n severity: \"error\",\n phase: \"hygiene\",\n title: \"Nothing served here\",\n hint: \"Request a published version's files or a documented `/_mostra/` path.\",\n docs: {\n explanation:\n \"The gateway serves only published versions' client files and the browser-protocol paths under `/_mostra/`. Everything else in the home, such as sources, server bundles, staging and unpublished builds, has no URL. A path or method nothing answers gets 404 or 405.\",\n fix: \"Check the path. Server code runs through the browser protocol, never as a file, and an artifact becomes viewable only once it is published.\",\n },\n },\n MOSTRA_HYGIENE_SESSION_CONFLICT: {\n severity: \"warning\",\n phase: \"hygiene\",\n title: \"Another link is already open for this artifact\",\n hint: \"Choose which link to keep; send `replace: true` to use the new one.\",\n docs: {\n explanation:\n \"This browser already has a live session for the artifact from a different link. Opening a link never silently replaces it, because a page elsewhere could send the viewer to its own, narrower link and take over their tabs (D98). The shell shows both links' access and lets the viewer choose; the answer is 409 with `current` and `offered`.\",\n fix: \"In the shell, choose the link to keep. A client exchanging tokens itself sends `replace: true` to replace the session.\",\n },\n },\n MOSTRA_HYGIENE_HEADERS_TOO_LARGE: {\n severity: \"error\",\n phase: \"hygiene\",\n title: \"The request's headers are too large\",\n hint: \"Open the link again: this page cleared the cookies that made the request too large.\",\n docs: {\n explanation:\n \"The request's headers passed the gateway's limit of 1 MiB, more than any browser sends for one host's cookies. Every port of the loopback host shares one cookie jar, so a page on any of them can fill it. The gateway answers 431 with `Clear-Site-Data: \\\"cookies\\\"`, which empties the host's cookies, so the next request works. Mostra's sessions go with them and come back when a link is opened again.\",\n fix: \"Open the artifact's link again. If it keeps happening, find the page that sets the cookies: it runs on this host.\",\n },\n },\n // gen:entries\n};\n"],"mappings":";;AAQA,MAAa,yBAAyB;CACpC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AAEF;;AAMA,MAAa,qBAAyD;CACpE,6BAA6B;EAC3B,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,6BAA6B;EAC3B,UAAU;EACV,OAAO;EACP,OAAO;EACP,MAAM;EACN,MAAM;GACJ,aACE;GACF,KAAK;EACP;CACF;CACA,6BAA6B;EAC3B,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,gCAAgC;EAC9B,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,6BAA6B;EAC3B,UAAU;EACV,OAAO;EACP,OAAO;EACP,MAAM;EACN,MAAM;GACJ,aACE;GACF,KAAK;EACP;CACF;CACA,6BAA6B;EAC3B,UAAU;EACV,OAAO;EACP,OAAO;EACP,MAAM;EACN,MAAM;GACJ,aACE;GACF,KAAK;EACP;CACF;CACA,2BAA2B;EACzB,UAAU;EACV,OAAO;EACP,OAAO;EACP,MAAM;EACN,MAAM;GACJ,aACE;GACF,KAAK;EACP;CACF;CACA,iCAAiC;EAC/B,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"}
|
|
1
|
+
{"version":3,"file":"hygiene.js","names":[],"sources":["../../../src/diagnostics/codes/hygiene.ts"],"sourcesContent":["/**\n * Diagnostic codes of the HYGIENE area: requests the gateway refuses because they don't come from\n * the holder of an artifact's capability URL (D06, HY-01). None of them limits what an artifact\n * or an agent may do; each keeps strangers out.\n */\nimport type { AreaCatalog } from \"../spec.ts\";\n\n/** The codes of the HYGIENE area, in the order they were added. */\nexport const hygieneDiagnosticCodes = [\n \"MOSTRA_HYGIENE_HOST_REFUSED\",\n \"MOSTRA_HYGIENE_ORIGIN_REFUSED\",\n \"MOSTRA_HYGIENE_CSRF_MISSING\",\n \"MOSTRA_HYGIENE_CONTENT_TYPE\",\n \"MOSTRA_HYGIENE_REQUEST_MALFORMED\",\n \"MOSTRA_HYGIENE_SESSION_MISSING\",\n \"MOSTRA_HYGIENE_TOKEN_INVALID\",\n \"MOSTRA_HYGIENE_TOKEN_REVOKED\",\n \"MOSTRA_HYGIENE_SCOPE_DENIED\",\n \"MOSTRA_HYGIENE_RATE_LIMITED\",\n \"MOSTRA_HYGIENE_NOT_SERVED\",\n \"MOSTRA_HYGIENE_SESSION_CONFLICT\",\n \"MOSTRA_HYGIENE_HEADERS_TOO_LARGE\",\n \"MOSTRA_HYGIENE_FRAME_SESSION\",\n // gen:codes\n] as const;\n\n/** The codes of the HYGIENE area. */\nexport type HygieneDiagnosticCode = (typeof hygieneDiagnosticCodes)[number];\n\n/** The HYGIENE area's catalog entries. */\nexport const hygieneDiagnostics: AreaCatalog<HygieneDiagnosticCode> = {\n MOSTRA_HYGIENE_HOST_REFUSED: {\n severity: \"error\",\n phase: \"hygiene\",\n title: \"Host not served\",\n hint: \"Open the artifact through the exact link Mostra gave you.\",\n docs: {\n explanation:\n \"The request's `Host` header named a host this gateway doesn't serve. Each gateway listener accepts exactly the host and port its capability URLs use, so a page that rebinds its own DNS name to the loopback address can't reach an artifact (DNS rebinding). The gateway answers 421.\",\n fix: \"Use the URL from `view/url` or the publish receipt as it is, without replacing `127.0.0.1` by `localhost` or another name. A gateway started with `--bind` and `--url-host` accepts the URL host it was given.\",\n },\n },\n MOSTRA_HYGIENE_ORIGIN_REFUSED: {\n severity: \"error\",\n phase: \"hygiene\",\n title: \"Origin refused\",\n hint: \"Send the request from the page's own origin.\",\n docs: {\n explanation:\n \"A request that changes state, opens a stream or upgrades to a WebSocket must carry an `Origin` header equal to the origin it is sent to. The gateway compares the strings exactly and answers 403 otherwise, so another website, or another artifact on a different port, can't drive this one.\",\n fix: \"Call the gateway from the page it serves: the shell from the shell, the artifact from its own frame. Tools outside a browser send the listener's own origin.\",\n },\n },\n MOSTRA_HYGIENE_CSRF_MISSING: {\n severity: \"error\",\n phase: \"hygiene\",\n title: \"CSRF token missing or wrong\",\n hint: \"Send the session's CSRF token from `GET /_mostra/session` in the `X-Mostra-CSRF` header.\",\n docs: {\n explanation:\n \"Every request that changes state through a session carries the session's CSRF token in the `X-Mostra-CSRF` header. The token comes only from the session endpoint of the same origin, which no other page can read. A missing or different token is answered with 403.\",\n fix: \"Read `csrf` from `GET /_mostra/session` (on the shell, `GET /a/<artifactId>/_mostra/session`) and send it with every POST. Mostra's client runtime and shell do this for you.\",\n },\n },\n MOSTRA_HYGIENE_CONTENT_TYPE: {\n severity: \"error\",\n phase: \"hygiene\",\n title: \"JSON content type required\",\n hint: \"Send the body as JSON with `Content-Type: application/json`.\",\n docs: {\n explanation:\n \"Requests that change state must have a JSON body. A form or plain-text body is something any website can send without asking the browser first, so the gateway refuses it with 415.\",\n fix: \"Send `Content-Type: application/json` and a JSON body.\",\n },\n },\n MOSTRA_HYGIENE_REQUEST_MALFORMED: {\n severity: \"error\",\n phase: \"hygiene\",\n title: \"Malformed request\",\n hint: \"Send one well-formed HTTP request with a path that starts with `/`.\",\n docs: {\n explanation:\n \"The gateway refused a request it can't interpret safely: a repeated `Host` or `Origin` header, a request target that isn't a path, an encoded `/` or `..` that would leave the served tree, a body that isn't valid JSON, or a header with control characters. It answers 400 rather than guess.\",\n fix: \"Send a single request with one `Host` header and a plain path. Browsers always do; this usually means a hand-written client or a probe.\",\n },\n },\n MOSTRA_HYGIENE_SESSION_MISSING: {\n severity: \"error\",\n phase: \"hygiene\",\n title: \"No session\",\n hint: \"Open the artifact's capability link again to start a session.\",\n docs: {\n explanation:\n \"The request carried no valid session for this origin. Sessions start when a capability link is opened: the shell exchanges the link's token for a session cookie, and gives the artifact frame a single-use ticket for its own. A session issued for another origin never counts, because every port of the host shares the browser's cookies. The gateway answers 401.\",\n fix: \"Open the full capability link, including the part after `#`. A bookmark of the page without it works while the browser keeps the session cookie (400 days).\",\n },\n },\n MOSTRA_HYGIENE_TOKEN_INVALID: {\n severity: \"error\",\n phase: \"hygiene\",\n title: \"Unknown capability token\",\n hint: \"Use the complete capability link Mostra gave you, or mint a new one with `view/url`.\",\n docs: {\n explanation:\n \"The capability token or frame ticket matched nothing in this home: it was mistyped, cut short, belongs to another home or artifact, or the ticket was already used or expired (tickets last 60 seconds and work once). Over the host protocol, the token ID named in `view/revoke` or `view/rotate` doesn't exist. The gateway answers 401, and failed attempts count towards the rate limit.\",\n fix: \"Copy the whole link again. An agent or host mints a fresh one with `view/url`; the shell gets a new frame ticket by reloading.\",\n },\n },\n MOSTRA_HYGIENE_TOKEN_REVOKED: {\n severity: \"error\",\n phase: \"hygiene\",\n title: \"Link revoked or expired\",\n hint: \"Ask for a new link: `view/url` mints one, or `view/rotate` replaces this one.\",\n docs: {\n explanation:\n \"The capability link was revoked (`view/revoke`), replaced (`view/rotate`), or reached the end of its `ttl`. Every session started from it ends too. The gateway answers 410. Local links have no expiry unless one was asked for.\",\n fix: \"Get a new link from whoever shared this one. An agent mints it with `view/url`, or rotates the old one with `view/rotate`, and shares the new URL.\",\n },\n },\n MOSTRA_HYGIENE_SCOPE_DENIED: {\n severity: \"error\",\n phase: \"hygiene\",\n title: \"Not allowed by this link\",\n hint: \"Open a link minted with this scope (`view/url` with `scopes`).\",\n docs: {\n explanation:\n \"The session's link doesn't carry the scope this request needs: `draft` to save answers, `submit` to submit, `review` to comment, and `action:*`, `action:<export>` or `action:<module path>#<export>` to run a server function. A view-and-comment link, for example, can't submit or run an action. The gateway answers 403.\",\n fix: 'Mint a link with the scopes the viewer needs, such as `view/url` with `scopes: [\"view\", \"draft\", \"submit\"]`. Without `scopes`, a link carries every scope.',\n },\n },\n MOSTRA_HYGIENE_RATE_LIMITED: {\n severity: \"error\",\n phase: \"hygiene\",\n title: \"Too many failed attempts\",\n hint: \"Wait for the time in `Retry-After`, then open the link again.\",\n docs: {\n explanation:\n \"More than 30 capability tokens failed for this artifact within a minute, so the gateway refuses every token for it, valid ones included, until the minute has passed. A guess can't succeed while the limit holds, and only this artifact's links wait. The gateway answers 429 with `Retry-After`.\",\n fix: \"Wait, then open the link again. Repeated failures usually come from a mistyped link or a script retrying an old one.\",\n },\n },\n MOSTRA_HYGIENE_NOT_SERVED: {\n severity: \"error\",\n phase: \"hygiene\",\n title: \"Nothing served here\",\n hint: \"Request a published version's files or a documented `/_mostra/` path.\",\n docs: {\n explanation:\n \"The gateway serves only published versions' client files and the browser-protocol paths under `/_mostra/`. Everything else in the home, such as sources, server bundles, staging and unpublished builds, has no URL. A path or method nothing answers gets 404 or 405.\",\n fix: \"Check the path. Server code runs through the browser protocol, never as a file, and an artifact becomes viewable only once it is published.\",\n },\n },\n MOSTRA_HYGIENE_SESSION_CONFLICT: {\n severity: \"warning\",\n phase: \"hygiene\",\n title: \"Another link is already open for this artifact\",\n hint: \"Choose which link to keep; send `replace: true` to use the new one.\",\n docs: {\n explanation:\n \"This browser already has a live session for the artifact from a different link. Opening a link never silently replaces it, because a page elsewhere could send the viewer to its own, narrower link and take over their tabs (D98). The shell shows both links' access and lets the viewer choose; the answer is 409 with `current` and `offered`.\",\n fix: \"In the shell, choose the link to keep. A client exchanging tokens itself sends `replace: true` to replace the session.\",\n },\n },\n MOSTRA_HYGIENE_HEADERS_TOO_LARGE: {\n severity: \"error\",\n phase: \"hygiene\",\n title: \"The request's headers are too large\",\n hint: \"Open the link again: this page cleared the cookies that made the request too large.\",\n docs: {\n explanation:\n \"The request's headers passed the gateway's limit of 1 MiB, more than any browser sends for one host's cookies. Every port of the loopback host shares one cookie jar, so a page on any of them can fill it. The gateway answers 431 with `Clear-Site-Data: \\\"cookies\\\"`, which empties the host's cookies, so the next request works. Mostra's sessions go with them and come back when a link is opened again.\",\n fix: \"Open the artifact's link again. If it keeps happening, find the page that sets the cookies: it runs on this host.\",\n },\n },\n MOSTRA_HYGIENE_FRAME_SESSION: {\n severity: \"error\",\n phase: \"hygiene\",\n title: \"Frame session couldn't start\",\n hint: \"Open the artifact's tailnet or Funnel link, or this link in a normal window of another browser.\",\n docs: {\n explanation:\n \"Where the shell and the artifact are two sites (a Cloudflare quick tunnel, or a host's addresses on two hosts), the artifact's frame can't use a cookie: it enters through a bootstrap page that installs Mostra's service worker at `/`, which signs every request of the frame (worker mode, D70). Mostra reports this code when that can't happen: the browser offers the frame no service worker (a private window, a setting that blocks third-party storage), refuses to install it, or the gateway refused the frame's entry. The client runtime reports it too when the artifact's own code registers another service worker at `/`, which would replace Mostra's and end the frame's session.\",\n fix: \"Open the artifact through a tailnet or Funnel share, where the frame uses a cookie, or in a browser window that allows service workers in frames. An artifact that needs its own service worker registers it at a narrower scope than `/`.\",\n },\n },\n // gen:entries\n};\n"],"mappings":";;AAQA,MAAa,yBAAyB;CACpC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AAEF;;AAMA,MAAa,qBAAyD;CACpE,6BAA6B;EAC3B,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,6BAA6B;EAC3B,UAAU;EACV,OAAO;EACP,OAAO;EACP,MAAM;EACN,MAAM;GACJ,aACE;GACF,KAAK;EACP;CACF;CACA,6BAA6B;EAC3B,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,gCAAgC;EAC9B,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,6BAA6B;EAC3B,UAAU;EACV,OAAO;EACP,OAAO;EACP,MAAM;EACN,MAAM;GACJ,aACE;GACF,KAAK;EACP;CACF;CACA,6BAA6B;EAC3B,UAAU;EACV,OAAO;EACP,OAAO;EACP,MAAM;EACN,MAAM;GACJ,aACE;GACF,KAAK;EACP;CACF;CACA,2BAA2B;EACzB,UAAU;EACV,OAAO;EACP,OAAO;EACP,MAAM;EACN,MAAM;GACJ,aACE;GACF,KAAK;EACP;CACF;CACA,iCAAiC;EAC/B,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,8BAA8B;EAC5B,UAAU;EACV,OAAO;EACP,OAAO;EACP,MAAM;EACN,MAAM;GACJ,aACE;GACF,KAAK;EACP;CACF;AAEF"}
|
|
@@ -20,6 +20,7 @@ import { PublishDiagnosticCode, publishDiagnosticCodes } from "./publish.js";
|
|
|
20
20
|
import { RegressionDiagnosticCode, regressionDiagnosticCodes } from "./regression.js";
|
|
21
21
|
import { RuntimeDiagnosticCode, runtimeDiagnosticCodes } from "./runtime.js";
|
|
22
22
|
import { SecretDiagnosticCode, secretDiagnosticCodes } from "./secret.js";
|
|
23
|
+
import { ShareDiagnosticCode, shareDiagnosticCodes } from "./share.js";
|
|
23
24
|
import { SmokeDiagnosticCode, smokeDiagnosticCodes } from "./smoke.js";
|
|
24
25
|
import { SubmitDiagnosticCode, submitDiagnosticCodes } from "./submit.js";
|
|
25
26
|
import { TargetDiagnosticCode, targetDiagnosticCodes } from "./target.js";
|
|
@@ -27,7 +28,7 @@ import { TypeDiagnosticCode, typeDiagnosticCodes } from "./type.js";
|
|
|
27
28
|
import { VerifyDiagnosticCode, verifyDiagnosticCodes } from "./verify.js";
|
|
28
29
|
//#region src/diagnostics/codes/index.d.ts
|
|
29
30
|
/** Every code in the catalog. Codes are semver surface and are never removed (AX-03). */
|
|
30
|
-
export type KnownDiagnosticCode = CliDiagnosticCode | RegressionDiagnosticCode | SmokeDiagnosticCode | A11yDiagnosticCode | NetworkDiagnosticCode | ConsoleDiagnosticCode | TypeDiagnosticCode | VerifyDiagnosticCode | LiveDiagnosticCode | SecretDiagnosticCode | RuntimeDiagnosticCode | FieldDiagnosticCode | SubmitDiagnosticCode | HygieneDiagnosticCode | DepDiagnosticCode | EnvDiagnosticCode | TargetDiagnosticCode | ArtifactDiagnosticCode | PublishDiagnosticCode | ActionDiagnosticCode | BuildDiagnosticCode | ManifestDiagnosticCode | HomeDiagnosticCode | PlatformDiagnosticCode | HostDiagnosticCode;
|
|
31
|
+
export type KnownDiagnosticCode = ShareDiagnosticCode | CliDiagnosticCode | RegressionDiagnosticCode | SmokeDiagnosticCode | A11yDiagnosticCode | NetworkDiagnosticCode | ConsoleDiagnosticCode | TypeDiagnosticCode | VerifyDiagnosticCode | LiveDiagnosticCode | SecretDiagnosticCode | RuntimeDiagnosticCode | FieldDiagnosticCode | SubmitDiagnosticCode | HygieneDiagnosticCode | DepDiagnosticCode | EnvDiagnosticCode | TargetDiagnosticCode | ArtifactDiagnosticCode | PublishDiagnosticCode | ActionDiagnosticCode | BuildDiagnosticCode | ManifestDiagnosticCode | HomeDiagnosticCode | PlatformDiagnosticCode | HostDiagnosticCode;
|
|
31
32
|
/** Every cataloged code with its severity, phase, title, default hint and docs text. */
|
|
32
33
|
export declare const diagnosticCatalog: Readonly<Record<KnownDiagnosticCode, DiagnosticSpec>>;
|
|
33
34
|
/** Options for {@link createDiagnostic}. */
|
|
@@ -47,5 +48,5 @@ export interface CreateDiagnosticOptions {
|
|
|
47
48
|
*/
|
|
48
49
|
export declare function createDiagnostic(code: KnownDiagnosticCode, details: DiagnosticDetails, options?: CreateDiagnosticOptions): Diagnostic;
|
|
49
50
|
//#endregion
|
|
50
|
-
export { type A11yDiagnosticCode, type ActionDiagnosticCode, type ArtifactDiagnosticCode, type BuildDiagnosticCode, type CliDiagnosticCode, type ConsoleDiagnosticCode, type DepDiagnosticCode, type EnvDiagnosticCode, type FieldDiagnosticCode, type HomeDiagnosticCode, type HostDiagnosticCode, type HygieneDiagnosticCode, type LiveDiagnosticCode, type ManifestDiagnosticCode, type NetworkDiagnosticCode, type PlatformDiagnosticCode, type PublishDiagnosticCode, type RegressionDiagnosticCode, type RuntimeDiagnosticCode, type SecretDiagnosticCode, type SmokeDiagnosticCode, type SubmitDiagnosticCode, type TargetDiagnosticCode, type TypeDiagnosticCode, type VerifyDiagnosticCode, a11yDiagnosticCodes, actionDiagnosticCodes, artifactDiagnosticCodes, buildDiagnosticCodes, cliDiagnosticCodes, consoleDiagnosticCodes, depDiagnosticCodes, envDiagnosticCodes, fieldDiagnosticCodes, homeDiagnosticCodes, hostDiagnosticCodes, hygieneDiagnosticCodes, liveDiagnosticCodes, manifestDiagnosticCodes, networkDiagnosticCodes, platformDiagnosticCodes, publishDiagnosticCodes, regressionDiagnosticCodes, runtimeDiagnosticCodes, secretDiagnosticCodes, smokeDiagnosticCodes, submitDiagnosticCodes, targetDiagnosticCodes, typeDiagnosticCodes, verifyDiagnosticCodes };
|
|
51
|
+
export { type A11yDiagnosticCode, type ActionDiagnosticCode, type ArtifactDiagnosticCode, type BuildDiagnosticCode, type CliDiagnosticCode, type ConsoleDiagnosticCode, type DepDiagnosticCode, type EnvDiagnosticCode, type FieldDiagnosticCode, type HomeDiagnosticCode, type HostDiagnosticCode, type HygieneDiagnosticCode, type LiveDiagnosticCode, type ManifestDiagnosticCode, type NetworkDiagnosticCode, type PlatformDiagnosticCode, type PublishDiagnosticCode, type RegressionDiagnosticCode, type RuntimeDiagnosticCode, type SecretDiagnosticCode, type ShareDiagnosticCode, type SmokeDiagnosticCode, type SubmitDiagnosticCode, type TargetDiagnosticCode, type TypeDiagnosticCode, type VerifyDiagnosticCode, a11yDiagnosticCodes, actionDiagnosticCodes, artifactDiagnosticCodes, buildDiagnosticCodes, cliDiagnosticCodes, consoleDiagnosticCodes, depDiagnosticCodes, envDiagnosticCodes, fieldDiagnosticCodes, homeDiagnosticCodes, hostDiagnosticCodes, hygieneDiagnosticCodes, liveDiagnosticCodes, manifestDiagnosticCodes, networkDiagnosticCodes, platformDiagnosticCodes, publishDiagnosticCodes, regressionDiagnosticCodes, runtimeDiagnosticCodes, secretDiagnosticCodes, shareDiagnosticCodes, smokeDiagnosticCodes, submitDiagnosticCodes, targetDiagnosticCodes, typeDiagnosticCodes, verifyDiagnosticCodes };
|
|
51
52
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../../../src/diagnostics/codes/index.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../../../src/diagnostics/codes/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YA+DY,sBAER,sBACA,oBACA,2BACA,sBACA,qBACA,wBACA,wBACA,qBACA,uBACA,qBACA,uBACA,wBACA,sBACA,uBACA,wBACA,oBACA,oBACA,uBACA,yBACA,wBACA,uBACA,sBACA,yBACA,qBACA,yBACA;;qBAGS,mBAAmB,SAAS,OAAO,qBAAqB;;iBA+BpD;;WAEN;;;;;;;;;;;;wBAaK,iBACd,MAAM,qBACN,SAAS,mBACT,UAAS,0BACR"}
|
|
@@ -19,6 +19,7 @@ import { publishDiagnosticCodes, publishDiagnostics } from "./publish.js";
|
|
|
19
19
|
import { regressionDiagnosticCodes, regressionDiagnostics } from "./regression.js";
|
|
20
20
|
import { runtimeDiagnosticCodes, runtimeDiagnostics } from "./runtime.js";
|
|
21
21
|
import { secretDiagnosticCodes, secretDiagnostics } from "./secret.js";
|
|
22
|
+
import { shareDiagnosticCodes, shareDiagnostics } from "./share.js";
|
|
22
23
|
import { smokeDiagnosticCodes, smokeDiagnostics } from "./smoke.js";
|
|
23
24
|
import { submitDiagnosticCodes, submitDiagnostics } from "./submit.js";
|
|
24
25
|
import { targetDiagnosticCodes, targetDiagnostics } from "./target.js";
|
|
@@ -27,6 +28,7 @@ import { verifyDiagnosticCodes, verifyDiagnostics } from "./verify.js";
|
|
|
27
28
|
//#region src/diagnostics/codes/index.ts
|
|
28
29
|
/** Every cataloged code with its severity, phase, title, default hint and docs text. */
|
|
29
30
|
const diagnosticCatalog = {
|
|
31
|
+
...shareDiagnostics,
|
|
30
32
|
...cliDiagnostics,
|
|
31
33
|
...regressionDiagnostics,
|
|
32
34
|
...smokeDiagnostics,
|
|
@@ -67,6 +69,6 @@ function createDiagnostic(code, details, options = {}) {
|
|
|
67
69
|
return buildDiagnostic(code, diagnosticCatalog[code], details, options.docsBase);
|
|
68
70
|
}
|
|
69
71
|
//#endregion
|
|
70
|
-
export { a11yDiagnosticCodes, actionDiagnosticCodes, artifactDiagnosticCodes, buildDiagnosticCodes, cliDiagnosticCodes, consoleDiagnosticCodes, createDiagnostic, depDiagnosticCodes, diagnosticCatalog, envDiagnosticCodes, fieldDiagnosticCodes, homeDiagnosticCodes, hostDiagnosticCodes, hygieneDiagnosticCodes, liveDiagnosticCodes, manifestDiagnosticCodes, networkDiagnosticCodes, platformDiagnosticCodes, publishDiagnosticCodes, regressionDiagnosticCodes, runtimeDiagnosticCodes, secretDiagnosticCodes, smokeDiagnosticCodes, submitDiagnosticCodes, targetDiagnosticCodes, typeDiagnosticCodes, verifyDiagnosticCodes };
|
|
72
|
+
export { a11yDiagnosticCodes, actionDiagnosticCodes, artifactDiagnosticCodes, buildDiagnosticCodes, cliDiagnosticCodes, consoleDiagnosticCodes, createDiagnostic, depDiagnosticCodes, diagnosticCatalog, envDiagnosticCodes, fieldDiagnosticCodes, homeDiagnosticCodes, hostDiagnosticCodes, hygieneDiagnosticCodes, liveDiagnosticCodes, manifestDiagnosticCodes, networkDiagnosticCodes, platformDiagnosticCodes, publishDiagnosticCodes, regressionDiagnosticCodes, runtimeDiagnosticCodes, secretDiagnosticCodes, shareDiagnosticCodes, smokeDiagnosticCodes, submitDiagnosticCodes, targetDiagnosticCodes, typeDiagnosticCodes, verifyDiagnosticCodes };
|
|
71
73
|
|
|
72
74
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../src/diagnostics/codes/index.ts"],"sourcesContent":["/**\n * The diagnostic catalog, assembled from one source file per area. `pnpm gen diagnostic` keeps\n * the lists below in step with the area files; edit the area files, not these lists.\n */\nimport type { Diagnostic } from \"../diagnostic.ts\";\nimport { buildDiagnostic, type DiagnosticDetails, type DiagnosticSpec } from \"../spec.ts\";\nimport { type A11yDiagnosticCode, a11yDiagnostics } from \"./a11y.ts\";\nimport { type ActionDiagnosticCode, actionDiagnostics } from \"./action.ts\";\nimport { type ArtifactDiagnosticCode, artifactDiagnostics } from \"./artifact.ts\";\nimport { type BuildDiagnosticCode, buildDiagnostics } from \"./build.ts\";\
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../src/diagnostics/codes/index.ts"],"sourcesContent":["/**\n * The diagnostic catalog, assembled from one source file per area. `pnpm gen diagnostic` keeps\n * the lists below in step with the area files; edit the area files, not these lists.\n */\nimport type { Diagnostic } from \"../diagnostic.ts\";\nimport { buildDiagnostic, type DiagnosticDetails, type DiagnosticSpec } from \"../spec.ts\";\nimport { type A11yDiagnosticCode, a11yDiagnostics } from \"./a11y.ts\";\nimport { type ActionDiagnosticCode, actionDiagnostics } from \"./action.ts\";\nimport { type ArtifactDiagnosticCode, artifactDiagnostics } from \"./artifact.ts\";\nimport { type BuildDiagnosticCode, buildDiagnostics } from \"./build.ts\";\nimport { type CliDiagnosticCode, cliDiagnostics } from \"./cli.ts\";\nimport { type ConsoleDiagnosticCode, consoleDiagnostics } from \"./console.ts\";\nimport { type DepDiagnosticCode, depDiagnostics } from \"./dep.ts\";\nimport { type EnvDiagnosticCode, envDiagnostics } from \"./env.ts\";\nimport { type FieldDiagnosticCode, fieldDiagnostics } from \"./field.ts\";\nimport { type HomeDiagnosticCode, homeDiagnostics } from \"./home.ts\";\nimport { type HostDiagnosticCode, hostDiagnostics } from \"./host.ts\";\nimport { type HygieneDiagnosticCode, hygieneDiagnostics } from \"./hygiene.ts\";\nimport { type LiveDiagnosticCode, liveDiagnostics } from \"./live.ts\";\nimport { type ManifestDiagnosticCode, manifestDiagnostics } from \"./manifest.ts\";\nimport { type NetworkDiagnosticCode, networkDiagnostics } from \"./network.ts\";\nimport { type PlatformDiagnosticCode, platformDiagnostics } from \"./platform.ts\";\nimport { type PublishDiagnosticCode, publishDiagnostics } from \"./publish.ts\";\nimport { type RegressionDiagnosticCode, regressionDiagnostics } from \"./regression.ts\";\nimport { type RuntimeDiagnosticCode, runtimeDiagnostics } from \"./runtime.ts\";\nimport { type SecretDiagnosticCode, secretDiagnostics } from \"./secret.ts\";\n// gen:area-imports\nimport { type ShareDiagnosticCode, shareDiagnostics } from \"./share.ts\";\nimport { type SmokeDiagnosticCode, smokeDiagnostics } from \"./smoke.ts\";\nimport { type SubmitDiagnosticCode, submitDiagnostics } from \"./submit.ts\";\nimport { type TargetDiagnosticCode, targetDiagnostics } from \"./target.ts\";\nimport { type TypeDiagnosticCode, typeDiagnostics } from \"./type.ts\";\nimport { type VerifyDiagnosticCode, verifyDiagnostics } from \"./verify.ts\";\n\nexport { type A11yDiagnosticCode, a11yDiagnosticCodes } from \"./a11y.ts\";\nexport { type ActionDiagnosticCode, actionDiagnosticCodes } from \"./action.ts\";\nexport { type ArtifactDiagnosticCode, artifactDiagnosticCodes } from \"./artifact.ts\";\nexport { type BuildDiagnosticCode, buildDiagnosticCodes } from \"./build.ts\";\nexport { type CliDiagnosticCode, cliDiagnosticCodes } from \"./cli.ts\";\nexport { type ConsoleDiagnosticCode, consoleDiagnosticCodes } from \"./console.ts\";\nexport { type DepDiagnosticCode, depDiagnosticCodes } from \"./dep.ts\";\nexport { type EnvDiagnosticCode, envDiagnosticCodes } from \"./env.ts\";\nexport { type FieldDiagnosticCode, fieldDiagnosticCodes } from \"./field.ts\";\nexport { type HomeDiagnosticCode, homeDiagnosticCodes } from \"./home.ts\";\nexport { type HostDiagnosticCode, hostDiagnosticCodes } from \"./host.ts\";\nexport { type HygieneDiagnosticCode, hygieneDiagnosticCodes } from \"./hygiene.ts\";\nexport { type LiveDiagnosticCode, liveDiagnosticCodes } from \"./live.ts\";\nexport { type ManifestDiagnosticCode, manifestDiagnosticCodes } from \"./manifest.ts\";\nexport { type NetworkDiagnosticCode, networkDiagnosticCodes } from \"./network.ts\";\nexport { type PlatformDiagnosticCode, platformDiagnosticCodes } from \"./platform.ts\";\nexport { type PublishDiagnosticCode, publishDiagnosticCodes } from \"./publish.ts\";\nexport { type RegressionDiagnosticCode, regressionDiagnosticCodes } from \"./regression.ts\";\nexport { type RuntimeDiagnosticCode, runtimeDiagnosticCodes } from \"./runtime.ts\";\nexport { type SecretDiagnosticCode, secretDiagnosticCodes } from \"./secret.ts\";\n// gen:area-exports\nexport { type ShareDiagnosticCode, shareDiagnosticCodes } from \"./share.ts\";\nexport { type SmokeDiagnosticCode, smokeDiagnosticCodes } from \"./smoke.ts\";\nexport { type SubmitDiagnosticCode, submitDiagnosticCodes } from \"./submit.ts\";\nexport { type TargetDiagnosticCode, targetDiagnosticCodes } from \"./target.ts\";\nexport { type TypeDiagnosticCode, typeDiagnosticCodes } from \"./type.ts\";\nexport { type VerifyDiagnosticCode, verifyDiagnosticCodes } from \"./verify.ts\";\n\n/** Every code in the catalog. Codes are semver surface and are never removed (AX-03). */\nexport type KnownDiagnosticCode =\n // gen:area-codes\n | ShareDiagnosticCode\n | CliDiagnosticCode\n | RegressionDiagnosticCode\n | SmokeDiagnosticCode\n | A11yDiagnosticCode\n | NetworkDiagnosticCode\n | ConsoleDiagnosticCode\n | TypeDiagnosticCode\n | VerifyDiagnosticCode\n | LiveDiagnosticCode\n | SecretDiagnosticCode\n | RuntimeDiagnosticCode\n | FieldDiagnosticCode\n | SubmitDiagnosticCode\n | HygieneDiagnosticCode\n | DepDiagnosticCode\n | EnvDiagnosticCode\n | TargetDiagnosticCode\n | ArtifactDiagnosticCode\n | PublishDiagnosticCode\n | ActionDiagnosticCode\n | BuildDiagnosticCode\n | ManifestDiagnosticCode\n | HomeDiagnosticCode\n | PlatformDiagnosticCode\n | HostDiagnosticCode;\n\n/** Every cataloged code with its severity, phase, title, default hint and docs text. */\nexport const diagnosticCatalog: Readonly<Record<KnownDiagnosticCode, DiagnosticSpec>> = {\n // gen:area-spreads\n ...shareDiagnostics,\n ...cliDiagnostics,\n ...regressionDiagnostics,\n ...smokeDiagnostics,\n ...a11yDiagnostics,\n ...networkDiagnostics,\n ...consoleDiagnostics,\n ...typeDiagnostics,\n ...verifyDiagnostics,\n ...liveDiagnostics,\n ...secretDiagnostics,\n ...runtimeDiagnostics,\n ...fieldDiagnostics,\n ...submitDiagnostics,\n ...hygieneDiagnostics,\n ...depDiagnostics,\n ...envDiagnostics,\n ...targetDiagnostics,\n ...artifactDiagnostics,\n ...publishDiagnostics,\n ...actionDiagnostics,\n ...buildDiagnostics,\n ...manifestDiagnostics,\n ...homeDiagnostics,\n ...platformDiagnostics,\n ...hostDiagnostics,\n};\n\n/** Options for {@link createDiagnostic}. */\nexport interface CreateDiagnosticOptions {\n /** The docs site base URL. Defaults to `DEFAULT_DOCS_BASE`. */\n readonly docsBase?: string;\n}\n\n/**\n * Creates the diagnostic for one occurrence of a cataloged code. Severity, phase, the default hint\n * and the docs link come from the catalog.\n *\n * ```ts\n * createDiagnostic(\"MOSTRA_HOST_REVISION_UNSUPPORTED\", {\n * message: \"The client offered 2026-01-01; this instance supports 2026-10-10.\",\n * });\n * ```\n */\nexport function createDiagnostic(\n code: KnownDiagnosticCode,\n details: DiagnosticDetails,\n options: CreateDiagnosticOptions = {},\n): Diagnostic {\n return buildDiagnostic(code, diagnosticCatalog[code], details, options.docsBase);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6FA,MAAa,oBAA2E;CAEtF,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;AACL;;;;;;;;;;;AAkBA,SAAgB,iBACd,MACA,SACA,UAAmC,CAAC,GACxB;CACZ,OAAO,gBAAgB,MAAM,kBAAkB,OAAO,SAAS,QAAQ,QAAQ;AACjF"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import "../spec.js";
|
|
2
|
+
//#region src/diagnostics/codes/share.d.ts
|
|
3
|
+
/** The codes of the SHARE area, in the order they were added. */
|
|
4
|
+
export declare const shareDiagnosticCodes: readonly ["MOSTRA_SHARE_TOOL_MISSING", "MOSTRA_SHARE_TOOL_NOT_READY", "MOSTRA_SHARE_NOT_ENABLED", "MOSTRA_SHARE_PORTS_EXHAUSTED", "MOSTRA_SHARE_TUNNEL_FAILED", "MOSTRA_SHARE_NOT_FOUND", "MOSTRA_SHARE_TTL_INVALID"];
|
|
5
|
+
/** The codes of the SHARE area. */
|
|
6
|
+
export type ShareDiagnosticCode = (typeof shareDiagnosticCodes)[number];
|
|
7
|
+
//#endregion
|
|
8
|
+
//# sourceMappingURL=share.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"share.d.ts","names":[],"sources":["../../../src/diagnostics/codes/share.ts"],"mappings":";;;qBAMa;;YAYD,8BAA8B"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
//#region src/diagnostics/codes/share.ts
|
|
2
|
+
/** The codes of the SHARE area, in the order they were added. */
|
|
3
|
+
const shareDiagnosticCodes = [
|
|
4
|
+
"MOSTRA_SHARE_TOOL_MISSING",
|
|
5
|
+
"MOSTRA_SHARE_TOOL_NOT_READY",
|
|
6
|
+
"MOSTRA_SHARE_NOT_ENABLED",
|
|
7
|
+
"MOSTRA_SHARE_PORTS_EXHAUSTED",
|
|
8
|
+
"MOSTRA_SHARE_TUNNEL_FAILED",
|
|
9
|
+
"MOSTRA_SHARE_NOT_FOUND",
|
|
10
|
+
"MOSTRA_SHARE_TTL_INVALID"
|
|
11
|
+
];
|
|
12
|
+
/** The SHARE area's catalog entries. */
|
|
13
|
+
const shareDiagnostics = {
|
|
14
|
+
MOSTRA_SHARE_TOOL_MISSING: {
|
|
15
|
+
severity: "error",
|
|
16
|
+
phase: "host",
|
|
17
|
+
title: "Sharing tool not installed",
|
|
18
|
+
hint: "Install the tool the message names, then run the share again.",
|
|
19
|
+
docs: {
|
|
20
|
+
explanation: "A share drives a tunnel tool installed on this machine: `tailscale` for tailnet and Funnel shares, `cloudflared` for Cloudflare quick tunnels. Mostra never bundles or downloads them; it found none where it looks (`PATH`, the tool's usual install locations, or `MOSTRA_TAILSCALE` and `MOSTRA_CLOUDFLARED`). The message says how to install it on this system.",
|
|
21
|
+
fix: "Install the tool (Tailscale from tailscale.com/download, `cloudflared` from Cloudflare's downloads or a package manager), or point `MOSTRA_TAILSCALE` or `MOSTRA_CLOUDFLARED` at it, then share again."
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
MOSTRA_SHARE_TOOL_NOT_READY: {
|
|
25
|
+
severity: "error",
|
|
26
|
+
phase: "host",
|
|
27
|
+
title: "Sharing tool not ready",
|
|
28
|
+
hint: "Do what the message says to the tool, then run the share again.",
|
|
29
|
+
docs: {
|
|
30
|
+
explanation: "The tunnel tool is installed but can't serve yet: Tailscale isn't running or isn't signed in to a tailnet, or `cloudflared` exited before it opened a tunnel. The message quotes what the tool reported.",
|
|
31
|
+
fix: "Start Tailscale and sign in (`tailscale up`), or check that `cloudflared` runs and this machine reaches Cloudflare, then share again."
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
MOSTRA_SHARE_NOT_ENABLED: {
|
|
35
|
+
severity: "error",
|
|
36
|
+
phase: "host",
|
|
37
|
+
title: "Sharing not enabled on the tailnet",
|
|
38
|
+
hint: "Open the address in the message as the tailnet's admin to turn the feature on, then run the share again.",
|
|
39
|
+
docs: {
|
|
40
|
+
explanation: "Tailscale Serve needs HTTPS certificates turned on for the tailnet, and Funnel needs the Funnel permission for this device. Tailscale refused the share and gave an address where an admin of the tailnet turns the feature on; the message carries it.",
|
|
41
|
+
fix: "Open the address as an admin of the tailnet and approve, then share again. Without admin rights, ask the tailnet's admin, or share publicly through a Cloudflare quick tunnel (`mostra share <artifact> --public`)."
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
MOSTRA_SHARE_PORTS_EXHAUSTED: {
|
|
45
|
+
severity: "error",
|
|
46
|
+
phase: "host",
|
|
47
|
+
title: "No tunnel port free",
|
|
48
|
+
hint: "Stop a share you no longer need (`mostra share list`, then `mostra share stop <share>`), or share through a Cloudflare quick tunnel.",
|
|
49
|
+
docs: {
|
|
50
|
+
explanation: "Tailscale Funnel listens only on ports 443, 8443 and 10000 of a device: Mostra gives 443 to the shell and the other two to one artifact each, so at most two artifacts are shared through Funnel at once. A port is also unavailable when this device's own Serve or Funnel configuration already uses it.",
|
|
51
|
+
fix: "Stop one of the Funnel shares, free the port in Tailscale's own configuration, or share this artifact through a Cloudflare quick tunnel."
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
MOSTRA_SHARE_TUNNEL_FAILED: {
|
|
55
|
+
severity: "error",
|
|
56
|
+
phase: "host",
|
|
57
|
+
title: "Tunnel failed",
|
|
58
|
+
hint: "Run the share again; if it fails the same way, check the tool's message and this machine's network.",
|
|
59
|
+
docs: {
|
|
60
|
+
explanation: "The tunnel tool started but didn't serve within its time, or stopped: the message quotes what it reported. A share whose tunnel ends and can't be set up again stops, and `mostra share list` shows why; a Cloudflare quick tunnel can't keep its address, so its share ends with it.",
|
|
61
|
+
fix: "Share again for a new link. A tailnet or Funnel share keeps its address across restarts of its tunnel; a Cloudflare quick tunnel gets a new one each time."
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
MOSTRA_SHARE_NOT_FOUND: {
|
|
65
|
+
severity: "error",
|
|
66
|
+
phase: "host",
|
|
67
|
+
title: "Unknown share",
|
|
68
|
+
hint: "List the home's shares with `mostra share list` and name one of them.",
|
|
69
|
+
docs: {
|
|
70
|
+
explanation: "No share of this home has the ID given, or the artifact has no share.",
|
|
71
|
+
fix: "Use a share ID from `mostra share list`."
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
MOSTRA_SHARE_TTL_INVALID: {
|
|
75
|
+
severity: "error",
|
|
76
|
+
phase: "host",
|
|
77
|
+
title: "Share lifetime refused",
|
|
78
|
+
hint: "Give a public share a lifetime of at most 7 days, such as `--ttl 24h`.",
|
|
79
|
+
docs: {
|
|
80
|
+
explanation: "A public share (Funnel or Cloudflare) admits anyone holding its link, so it lasts 1 hour unless `ttl` says otherwise, and at most 7 days. Tailnet shares have no limit.",
|
|
81
|
+
fix: "Use a `ttl` of 7 days or less, and share again when it ends, or share inside the tailnet."
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
//#endregion
|
|
86
|
+
export { shareDiagnosticCodes, shareDiagnostics };
|
|
87
|
+
|
|
88
|
+
//# sourceMappingURL=share.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"share.js","names":[],"sources":["../../../src/diagnostics/codes/share.ts"],"sourcesContent":["/**\n * Diagnostic codes of the SHARE area.\n */\nimport type { AreaCatalog } from \"../spec.ts\";\n\n/** The codes of the SHARE area, in the order they were added. */\nexport const shareDiagnosticCodes = [\n \"MOSTRA_SHARE_TOOL_MISSING\",\n \"MOSTRA_SHARE_TOOL_NOT_READY\",\n \"MOSTRA_SHARE_NOT_ENABLED\",\n \"MOSTRA_SHARE_PORTS_EXHAUSTED\",\n \"MOSTRA_SHARE_TUNNEL_FAILED\",\n \"MOSTRA_SHARE_NOT_FOUND\",\n \"MOSTRA_SHARE_TTL_INVALID\",\n // gen:codes\n] as const;\n\n/** The codes of the SHARE area. */\nexport type ShareDiagnosticCode = (typeof shareDiagnosticCodes)[number];\n\n/** The SHARE area's catalog entries. */\nexport const shareDiagnostics: AreaCatalog<ShareDiagnosticCode> = {\n MOSTRA_SHARE_TOOL_MISSING: {\n severity: \"error\",\n phase: \"host\",\n title: \"Sharing tool not installed\",\n hint: \"Install the tool the message names, then run the share again.\",\n docs: {\n explanation:\n \"A share drives a tunnel tool installed on this machine: `tailscale` for tailnet and Funnel shares, `cloudflared` for Cloudflare quick tunnels. Mostra never bundles or downloads them; it found none where it looks (`PATH`, the tool's usual install locations, or `MOSTRA_TAILSCALE` and `MOSTRA_CLOUDFLARED`). The message says how to install it on this system.\",\n fix: \"Install the tool (Tailscale from tailscale.com/download, `cloudflared` from Cloudflare's downloads or a package manager), or point `MOSTRA_TAILSCALE` or `MOSTRA_CLOUDFLARED` at it, then share again.\",\n },\n },\n MOSTRA_SHARE_TOOL_NOT_READY: {\n severity: \"error\",\n phase: \"host\",\n title: \"Sharing tool not ready\",\n hint: \"Do what the message says to the tool, then run the share again.\",\n docs: {\n explanation:\n \"The tunnel tool is installed but can't serve yet: Tailscale isn't running or isn't signed in to a tailnet, or `cloudflared` exited before it opened a tunnel. The message quotes what the tool reported.\",\n fix: \"Start Tailscale and sign in (`tailscale up`), or check that `cloudflared` runs and this machine reaches Cloudflare, then share again.\",\n },\n },\n MOSTRA_SHARE_NOT_ENABLED: {\n severity: \"error\",\n phase: \"host\",\n title: \"Sharing not enabled on the tailnet\",\n hint: \"Open the address in the message as the tailnet's admin to turn the feature on, then run the share again.\",\n docs: {\n explanation:\n \"Tailscale Serve needs HTTPS certificates turned on for the tailnet, and Funnel needs the Funnel permission for this device. Tailscale refused the share and gave an address where an admin of the tailnet turns the feature on; the message carries it.\",\n fix: \"Open the address as an admin of the tailnet and approve, then share again. Without admin rights, ask the tailnet's admin, or share publicly through a Cloudflare quick tunnel (`mostra share <artifact> --public`).\",\n },\n },\n MOSTRA_SHARE_PORTS_EXHAUSTED: {\n severity: \"error\",\n phase: \"host\",\n title: \"No tunnel port free\",\n hint: \"Stop a share you no longer need (`mostra share list`, then `mostra share stop <share>`), or share through a Cloudflare quick tunnel.\",\n docs: {\n explanation:\n \"Tailscale Funnel listens only on ports 443, 8443 and 10000 of a device: Mostra gives 443 to the shell and the other two to one artifact each, so at most two artifacts are shared through Funnel at once. A port is also unavailable when this device's own Serve or Funnel configuration already uses it.\",\n fix: \"Stop one of the Funnel shares, free the port in Tailscale's own configuration, or share this artifact through a Cloudflare quick tunnel.\",\n },\n },\n MOSTRA_SHARE_TUNNEL_FAILED: {\n severity: \"error\",\n phase: \"host\",\n title: \"Tunnel failed\",\n hint: \"Run the share again; if it fails the same way, check the tool's message and this machine's network.\",\n docs: {\n explanation:\n \"The tunnel tool started but didn't serve within its time, or stopped: the message quotes what it reported. A share whose tunnel ends and can't be set up again stops, and `mostra share list` shows why; a Cloudflare quick tunnel can't keep its address, so its share ends with it.\",\n fix: \"Share again for a new link. A tailnet or Funnel share keeps its address across restarts of its tunnel; a Cloudflare quick tunnel gets a new one each time.\",\n },\n },\n MOSTRA_SHARE_NOT_FOUND: {\n severity: \"error\",\n phase: \"host\",\n title: \"Unknown share\",\n hint: \"List the home's shares with `mostra share list` and name one of them.\",\n docs: {\n explanation: \"No share of this home has the ID given, or the artifact has no share.\",\n fix: \"Use a share ID from `mostra share list`.\",\n },\n },\n MOSTRA_SHARE_TTL_INVALID: {\n severity: \"error\",\n phase: \"host\",\n title: \"Share lifetime refused\",\n hint: \"Give a public share a lifetime of at most 7 days, such as `--ttl 24h`.\",\n docs: {\n explanation:\n \"A public share (Funnel or Cloudflare) admits anyone holding its link, so it lasts 1 hour unless `ttl` says otherwise, and at most 7 days. Tailnet shares have no limit.\",\n fix: \"Use a `ttl` of 7 days or less, and share again when it ends, or share inside the tailnet.\",\n },\n },\n // gen:entries\n};\n"],"mappings":";;AAMA,MAAa,uBAAuB;CAClC;CACA;CACA;CACA;CACA;CACA;CACA;AAEF;;AAMA,MAAa,mBAAqD;CAChE,2BAA2B;EACzB,UAAU;EACV,OAAO;EACP,OAAO;EACP,MAAM;EACN,MAAM;GACJ,aACE;GACF,KAAK;EACP;CACF;CACA,6BAA6B;EAC3B,UAAU;EACV,OAAO;EACP,OAAO;EACP,MAAM;EACN,MAAM;GACJ,aACE;GACF,KAAK;EACP;CACF;CACA,0BAA0B;EACxB,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,4BAA4B;EAC1B,UAAU;EACV,OAAO;EACP,OAAO;EACP,MAAM;EACN,MAAM;GACJ,aACE;GACF,KAAK;EACP;CACF;CACA,wBAAwB;EACtB,UAAU;EACV,OAAO;EACP,OAAO;EACP,MAAM;EACN,MAAM;GACJ,aAAa;GACb,KAAK;EACP;CACF;CACA,0BAA0B;EACxB,UAAU;EACV,OAAO;EACP,OAAO;EACP,MAAM;EACN,MAAM;GACJ,aACE;GACF,KAAK;EACP;CACF;AAEF"}
|
package/dist/hygiene.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hygiene.d.ts","names":[],"sources":["../src/hygiene.ts"],"mappings":";;;;iBAoBiB;;WAEN;;WAEA;;;;;;;;;;;;YAaC;;iBAGK;;WAEN;;WAEA;;WAEA;;WAEA,SAAS;;WAET;;;iBAIM;;WAEN;;WAEA,YAAY;;;qBAIV;;
|
|
1
|
+
{"version":3,"file":"hygiene.d.ts","names":[],"sources":["../src/hygiene.ts"],"mappings":";;;;iBAoBiB;;WAEN;;WAEA;;;;;;;;;;;;YAaC;;iBAGK;;WAEN;;WAEA;;WAEA;;WAEA,SAAS;;WAET;;;iBAIM;;WAEN;;WAEA,YAAY;;;qBAIV;;wBAoBG,QAAQ,MAAM,uBAAuB,iBAAiB,kBAAkB;;wBAexE,UAAU,WAAW;;;;;;wBAcrB,SAAS;;wBAiBT,YACd,iDACA;;wBAOc,kBAAkB;;;;;;;wBAWlB,aAAa,QAAQ,eAAe,SAAS,eAAe"}
|
package/dist/hygiene.js
CHANGED
|
@@ -31,7 +31,8 @@ const STATUS = {
|
|
|
31
31
|
MOSTRA_HYGIENE_RATE_LIMITED: 429,
|
|
32
32
|
MOSTRA_HYGIENE_NOT_SERVED: 404,
|
|
33
33
|
MOSTRA_HYGIENE_SESSION_CONFLICT: 409,
|
|
34
|
-
MOSTRA_HYGIENE_HEADERS_TOO_LARGE: 431
|
|
34
|
+
MOSTRA_HYGIENE_HEADERS_TOO_LARGE: 431,
|
|
35
|
+
MOSTRA_HYGIENE_FRAME_SESSION: 403
|
|
35
36
|
};
|
|
36
37
|
/** Builds a refusal with the status the code's HTTP mapping gives (FAILURE_MODEL §8). */
|
|
37
38
|
function refusal(code, message, status) {
|
package/dist/hygiene.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hygiene.js","names":[],"sources":["../src/hygiene.ts"],"sourcesContent":["/**\n * Request hygiene (D06, ARCHITECTURE §10, HY-01): the checks every Mostra HTTP endpoint applies\n * before it acts on a request, as pure functions with no I/O. The gateway runs them on every\n * request, and `mostra mcp --http` (WP-15) runs the same code (D96), so a request a stranger's\n * page could send is refused the same way everywhere. None of them limits what an artifact, an\n * agent or a viewer may do; they only make sure a request comes from the page it claims to.\n *\n * ```ts\n * const refusal = checkRequest(\n * { origin: \"http://127.0.0.1:23456\", hosts: [\"127.0.0.1:23456\"] },\n * { method: \"POST\", target: \"/a/art_…/_mostra/ticket\", headers, intent: \"mutation\", csrf },\n * );\n * if (refusal) return respond(refusal.status, refusal.diagnostic);\n * ```\n */\nimport { type HygieneDiagnosticCode, hygieneDiagnostics } from \"./diagnostics/codes/hygiene.ts\";\nimport type { Diagnostic } from \"./diagnostics/diagnostic.ts\";\nimport { buildDiagnostic } from \"./diagnostics/spec.ts\";\n\n/** What one listener serves: its own origin and the exact `Host` values it accepts. */\nexport interface RequestPolicy {\n /** The listener's origin, such as `http://127.0.0.1:23456`; `Origin` headers must equal it. */\n readonly origin: string;\n /** Every `host:port` this listener answers to (lowercase): its URL host, plus registered tunnels. */\n readonly hosts: readonly string[];\n}\n\n/**\n * What a request is for, which decides the checks beyond the envelope:\n * - `read`: a GET or HEAD of a page or file; a foreign `Origin` is refused, none is fine.\n * - `stream`: an event stream (GET); same-origin only, by `Origin` or `Sec-Fetch-Site`.\n * - `upgrade`: a WebSocket upgrade; `Origin` must be present and equal.\n * - `exchange`: a mutation that starts a session (a capability token or ticket in the body):\n * `Origin` and a JSON content type, but no CSRF token yet.\n * - `mutation`: any other state change: `Origin`, a JSON content type and the session's CSRF\n * token in `X-Mostra-CSRF`.\n */\nexport type RequestIntent = \"read\" | \"stream\" | \"upgrade\" | \"exchange\" | \"mutation\";\n\n/** One request as the transport received it. */\nexport interface RequestFacts {\n /** The method, as sent. */\n readonly method: string;\n /** The request target exactly as sent: an origin-form path with its query. */\n readonly target: string;\n /** Every header as `[name, value]` in arrival order, so repeated headers are visible. */\n readonly headers: readonly (readonly [string, string])[];\n /** The intent the matched route declared; omit to check only the envelope. */\n readonly intent?: RequestIntent;\n /** The session's CSRF token, for `mutation` requests. */\n readonly csrf?: string;\n}\n\n/** A refused request: the HTTP status to answer with and the diagnostic for its body. */\nexport interface Refusal {\n /** The HTTP status: 400, 401, 403, 404, 410, 415, 421 or 429. */\n readonly status: number;\n /** What was refused and why, for the response body and the log. */\n readonly diagnostic: Diagnostic;\n}\n\n/** The header that carries a session's CSRF token on every mutation (D98). */\nexport const CSRF_HEADER = \"x-mostra-csrf\";\n\nconst STATUS: Readonly<Record<HygieneDiagnosticCode, number>> = {\n MOSTRA_HYGIENE_HOST_REFUSED: 421,\n MOSTRA_HYGIENE_ORIGIN_REFUSED: 403,\n MOSTRA_HYGIENE_CSRF_MISSING: 403,\n MOSTRA_HYGIENE_CONTENT_TYPE: 415,\n MOSTRA_HYGIENE_REQUEST_MALFORMED: 400,\n MOSTRA_HYGIENE_SESSION_MISSING: 401,\n MOSTRA_HYGIENE_TOKEN_INVALID: 401,\n MOSTRA_HYGIENE_TOKEN_REVOKED: 410,\n MOSTRA_HYGIENE_SCOPE_DENIED: 403,\n MOSTRA_HYGIENE_RATE_LIMITED: 429,\n MOSTRA_HYGIENE_NOT_SERVED: 404,\n MOSTRA_HYGIENE_SESSION_CONFLICT: 409,\n MOSTRA_HYGIENE_HEADERS_TOO_LARGE: 431,\n};\n\n/** Builds a refusal with the status the code's HTTP mapping gives (FAILURE_MODEL §8). */\nexport function refusal(code: HygieneDiagnosticCode, message: string, status?: number): Refusal {\n return {\n status: status ?? STATUS[code],\n diagnostic: buildDiagnostic(code, hygieneDiagnostics[code], { message }),\n };\n}\n\n/** Headers that must appear at most once: a second copy could mean two different things. */\nconst SINGLE = new Set([\"host\", \"origin\", \"content-type\", \"content-length\", CSRF_HEADER, \"cookie\"]);\n\n/** Characters no header value or path may carry: controls other than tab, and DEL. */\n// biome-ignore lint/suspicious/noControlCharactersInRegex: matching control characters is the point.\nconst CONTROL = /[\\u0000-\\u0008\\u000a-\\u001f\\u007f]/;\n\n/** Constant-time comparison of two strings, so timing reveals nothing about a secret. */\nexport function safeEqual(a: string, b: string): boolean {\n let difference = a.length ^ b.length;\n const length = Math.max(a.length, b.length);\n for (let index = 0; index < length; index++) {\n difference |= (a.charCodeAt(index) | 0) ^ (b.charCodeAt(index) | 0);\n }\n return difference === 0;\n}\n\n/**\n * The path a request target names, decoded, or `undefined` when it isn't a safe origin-form path:\n * absolute and authority forms, `*`, encoded `/` or `\\`, `.` or `..` segments (encoded or not),\n * NUL and other controls, and invalid percent-encoding are all refused.\n */\nexport function safePath(target: string): string | undefined {\n if (!target.startsWith(\"/\") || target.startsWith(\"//\")) return undefined;\n const end = target.search(/[?#]/);\n const raw = end < 0 ? target : target.slice(0, end);\n if (/%(2f|5c)/i.test(raw) || raw.includes(\"\\\\\")) return undefined;\n let path: string;\n try {\n path = decodeURIComponent(raw);\n } catch {\n return undefined;\n }\n if (CONTROL.test(path) || path.includes(\"\\u0000\")) return undefined;\n if (path.split(\"/\").some((segment) => segment === \".\" || segment === \"..\")) return undefined;\n return path;\n}\n\n/** The value of a header (case-insensitive name), or `undefined`. */\nexport function headerValue(\n headers: readonly (readonly [string, string])[],\n name: string,\n): string | undefined {\n const lower = name.toLowerCase();\n return headers.find(([key]) => key.toLowerCase() === lower)?.[1];\n}\n\n/** Whether a `Content-Type` value is JSON (`application/json`, any parameters). */\nexport function isJsonContentType(value: string | undefined): boolean {\n if (value === undefined) return false;\n return value.split(\";\")[0]?.trim().toLowerCase() === \"application/json\";\n}\n\n/**\n * Checks a request's envelope (the `Host` allowlist, the request target, repeated and malformed\n * headers) and, when `intent` is given, what that intent needs: `Origin`, the JSON content type\n * and the CSRF token. Returns the first refusal, or `undefined` when the request may proceed.\n * Session, token and scope checks follow in the endpoint, which knows its session.\n */\nexport function checkRequest(policy: RequestPolicy, request: RequestFacts): Refusal | undefined {\n const counts = new Map<string, number>();\n for (const [name, value] of request.headers) {\n const lower = name.toLowerCase();\n counts.set(lower, (counts.get(lower) ?? 0) + 1);\n if (CONTROL.test(value)) {\n return refusal(\n \"MOSTRA_HYGIENE_REQUEST_MALFORMED\",\n `The ${lower} header has control characters.`,\n );\n }\n }\n for (const name of SINGLE) {\n if ((counts.get(name) ?? 0) > 1) {\n return refusal(\"MOSTRA_HYGIENE_REQUEST_MALFORMED\", `The request repeats the ${name} header.`);\n }\n }\n const host = headerValue(request.headers, \"host\")?.toLowerCase();\n if (host === undefined || !policy.hosts.includes(host)) {\n return refusal(\n \"MOSTRA_HYGIENE_HOST_REFUSED\",\n host === undefined\n ? \"The request has no Host header.\"\n : \"The request's Host isn't one this listener serves.\",\n );\n }\n if (safePath(request.target) === undefined) {\n return refusal(\n \"MOSTRA_HYGIENE_REQUEST_MALFORMED\",\n \"The request target isn't a plain path inside the served tree.\",\n );\n }\n if (request.intent === undefined) return undefined;\n\n const origin = headerValue(request.headers, \"origin\");\n switch (request.intent) {\n case \"read\":\n if (origin !== undefined && origin !== policy.origin) {\n return refusal(\"MOSTRA_HYGIENE_ORIGIN_REFUSED\", \"The request came from another origin.\");\n }\n return undefined;\n case \"stream\": {\n const site = headerValue(request.headers, \"sec-fetch-site\");\n const sameOrigin = origin === undefined ? site === \"same-origin\" : origin === policy.origin;\n return sameOrigin\n ? undefined\n : refusal(\"MOSTRA_HYGIENE_ORIGIN_REFUSED\", \"A stream must be opened by its own origin.\");\n }\n case \"upgrade\":\n case \"exchange\":\n case \"mutation\": {\n if (origin !== policy.origin) {\n return refusal(\n \"MOSTRA_HYGIENE_ORIGIN_REFUSED\",\n origin === undefined\n ? \"The request has no Origin header.\"\n : \"The request came from another origin.\",\n );\n }\n if (request.intent === \"upgrade\") return undefined;\n if (!isJsonContentType(headerValue(request.headers, \"content-type\"))) {\n return refusal(\"MOSTRA_HYGIENE_CONTENT_TYPE\", \"The request's body isn't declared as JSON.\");\n }\n if (request.intent === \"exchange\") return undefined;\n const sent = headerValue(request.headers, CSRF_HEADER);\n if (request.csrf === undefined || sent === undefined || !safeEqual(sent, request.csrf)) {\n return refusal(\n \"MOSTRA_HYGIENE_CSRF_MISSING\",\n sent === undefined\n ? `The request has no ${CSRF_HEADER} header.`\n : `The request's ${CSRF_HEADER} header doesn't match its session.`,\n );\n }\n return undefined;\n }\n }\n}\n"],"mappings":"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"}
|
|
1
|
+
{"version":3,"file":"hygiene.js","names":[],"sources":["../src/hygiene.ts"],"sourcesContent":["/**\n * Request hygiene (D06, ARCHITECTURE §10, HY-01): the checks every Mostra HTTP endpoint applies\n * before it acts on a request, as pure functions with no I/O. The gateway runs them on every\n * request, and `mostra mcp --http` (WP-15) runs the same code (D96), so a request a stranger's\n * page could send is refused the same way everywhere. None of them limits what an artifact, an\n * agent or a viewer may do; they only make sure a request comes from the page it claims to.\n *\n * ```ts\n * const refusal = checkRequest(\n * { origin: \"http://127.0.0.1:23456\", hosts: [\"127.0.0.1:23456\"] },\n * { method: \"POST\", target: \"/a/art_…/_mostra/ticket\", headers, intent: \"mutation\", csrf },\n * );\n * if (refusal) return respond(refusal.status, refusal.diagnostic);\n * ```\n */\nimport { type HygieneDiagnosticCode, hygieneDiagnostics } from \"./diagnostics/codes/hygiene.ts\";\nimport type { Diagnostic } from \"./diagnostics/diagnostic.ts\";\nimport { buildDiagnostic } from \"./diagnostics/spec.ts\";\n\n/** What one listener serves: its own origin and the exact `Host` values it accepts. */\nexport interface RequestPolicy {\n /** The listener's origin, such as `http://127.0.0.1:23456`; `Origin` headers must equal it. */\n readonly origin: string;\n /** Every `host:port` this listener answers to (lowercase): its URL host, plus registered tunnels. */\n readonly hosts: readonly string[];\n}\n\n/**\n * What a request is for, which decides the checks beyond the envelope:\n * - `read`: a GET or HEAD of a page or file; a foreign `Origin` is refused, none is fine.\n * - `stream`: an event stream (GET); same-origin only, by `Origin` or `Sec-Fetch-Site`.\n * - `upgrade`: a WebSocket upgrade; `Origin` must be present and equal.\n * - `exchange`: a mutation that starts a session (a capability token or ticket in the body):\n * `Origin` and a JSON content type, but no CSRF token yet.\n * - `mutation`: any other state change: `Origin`, a JSON content type and the session's CSRF\n * token in `X-Mostra-CSRF`.\n */\nexport type RequestIntent = \"read\" | \"stream\" | \"upgrade\" | \"exchange\" | \"mutation\";\n\n/** One request as the transport received it. */\nexport interface RequestFacts {\n /** The method, as sent. */\n readonly method: string;\n /** The request target exactly as sent: an origin-form path with its query. */\n readonly target: string;\n /** Every header as `[name, value]` in arrival order, so repeated headers are visible. */\n readonly headers: readonly (readonly [string, string])[];\n /** The intent the matched route declared; omit to check only the envelope. */\n readonly intent?: RequestIntent;\n /** The session's CSRF token, for `mutation` requests. */\n readonly csrf?: string;\n}\n\n/** A refused request: the HTTP status to answer with and the diagnostic for its body. */\nexport interface Refusal {\n /** The HTTP status: 400, 401, 403, 404, 410, 415, 421 or 429. */\n readonly status: number;\n /** What was refused and why, for the response body and the log. */\n readonly diagnostic: Diagnostic;\n}\n\n/** The header that carries a session's CSRF token on every mutation (D98). */\nexport const CSRF_HEADER = \"x-mostra-csrf\";\n\nconst STATUS: Readonly<Record<HygieneDiagnosticCode, number>> = {\n MOSTRA_HYGIENE_HOST_REFUSED: 421,\n MOSTRA_HYGIENE_ORIGIN_REFUSED: 403,\n MOSTRA_HYGIENE_CSRF_MISSING: 403,\n MOSTRA_HYGIENE_CONTENT_TYPE: 415,\n MOSTRA_HYGIENE_REQUEST_MALFORMED: 400,\n MOSTRA_HYGIENE_SESSION_MISSING: 401,\n MOSTRA_HYGIENE_TOKEN_INVALID: 401,\n MOSTRA_HYGIENE_TOKEN_REVOKED: 410,\n MOSTRA_HYGIENE_SCOPE_DENIED: 403,\n MOSTRA_HYGIENE_RATE_LIMITED: 429,\n MOSTRA_HYGIENE_NOT_SERVED: 404,\n MOSTRA_HYGIENE_SESSION_CONFLICT: 409,\n MOSTRA_HYGIENE_HEADERS_TOO_LARGE: 431,\n MOSTRA_HYGIENE_FRAME_SESSION: 403,\n};\n\n/** Builds a refusal with the status the code's HTTP mapping gives (FAILURE_MODEL §8). */\nexport function refusal(code: HygieneDiagnosticCode, message: string, status?: number): Refusal {\n return {\n status: status ?? STATUS[code],\n diagnostic: buildDiagnostic(code, hygieneDiagnostics[code], { message }),\n };\n}\n\n/** Headers that must appear at most once: a second copy could mean two different things. */\nconst SINGLE = new Set([\"host\", \"origin\", \"content-type\", \"content-length\", CSRF_HEADER, \"cookie\"]);\n\n/** Characters no header value or path may carry: controls other than tab, and DEL. */\n// biome-ignore lint/suspicious/noControlCharactersInRegex: matching control characters is the point.\nconst CONTROL = /[\\u0000-\\u0008\\u000a-\\u001f\\u007f]/;\n\n/** Constant-time comparison of two strings, so timing reveals nothing about a secret. */\nexport function safeEqual(a: string, b: string): boolean {\n let difference = a.length ^ b.length;\n const length = Math.max(a.length, b.length);\n for (let index = 0; index < length; index++) {\n difference |= (a.charCodeAt(index) | 0) ^ (b.charCodeAt(index) | 0);\n }\n return difference === 0;\n}\n\n/**\n * The path a request target names, decoded, or `undefined` when it isn't a safe origin-form path:\n * absolute and authority forms, `*`, encoded `/` or `\\`, `.` or `..` segments (encoded or not),\n * NUL and other controls, and invalid percent-encoding are all refused.\n */\nexport function safePath(target: string): string | undefined {\n if (!target.startsWith(\"/\") || target.startsWith(\"//\")) return undefined;\n const end = target.search(/[?#]/);\n const raw = end < 0 ? target : target.slice(0, end);\n if (/%(2f|5c)/i.test(raw) || raw.includes(\"\\\\\")) return undefined;\n let path: string;\n try {\n path = decodeURIComponent(raw);\n } catch {\n return undefined;\n }\n if (CONTROL.test(path) || path.includes(\"\\u0000\")) return undefined;\n if (path.split(\"/\").some((segment) => segment === \".\" || segment === \"..\")) return undefined;\n return path;\n}\n\n/** The value of a header (case-insensitive name), or `undefined`. */\nexport function headerValue(\n headers: readonly (readonly [string, string])[],\n name: string,\n): string | undefined {\n const lower = name.toLowerCase();\n return headers.find(([key]) => key.toLowerCase() === lower)?.[1];\n}\n\n/** Whether a `Content-Type` value is JSON (`application/json`, any parameters). */\nexport function isJsonContentType(value: string | undefined): boolean {\n if (value === undefined) return false;\n return value.split(\";\")[0]?.trim().toLowerCase() === \"application/json\";\n}\n\n/**\n * Checks a request's envelope (the `Host` allowlist, the request target, repeated and malformed\n * headers) and, when `intent` is given, what that intent needs: `Origin`, the JSON content type\n * and the CSRF token. Returns the first refusal, or `undefined` when the request may proceed.\n * Session, token and scope checks follow in the endpoint, which knows its session.\n */\nexport function checkRequest(policy: RequestPolicy, request: RequestFacts): Refusal | undefined {\n const counts = new Map<string, number>();\n for (const [name, value] of request.headers) {\n const lower = name.toLowerCase();\n counts.set(lower, (counts.get(lower) ?? 0) + 1);\n if (CONTROL.test(value)) {\n return refusal(\n \"MOSTRA_HYGIENE_REQUEST_MALFORMED\",\n `The ${lower} header has control characters.`,\n );\n }\n }\n for (const name of SINGLE) {\n if ((counts.get(name) ?? 0) > 1) {\n return refusal(\"MOSTRA_HYGIENE_REQUEST_MALFORMED\", `The request repeats the ${name} header.`);\n }\n }\n const host = headerValue(request.headers, \"host\")?.toLowerCase();\n if (host === undefined || !policy.hosts.includes(host)) {\n return refusal(\n \"MOSTRA_HYGIENE_HOST_REFUSED\",\n host === undefined\n ? \"The request has no Host header.\"\n : \"The request's Host isn't one this listener serves.\",\n );\n }\n if (safePath(request.target) === undefined) {\n return refusal(\n \"MOSTRA_HYGIENE_REQUEST_MALFORMED\",\n \"The request target isn't a plain path inside the served tree.\",\n );\n }\n if (request.intent === undefined) return undefined;\n\n const origin = headerValue(request.headers, \"origin\");\n switch (request.intent) {\n case \"read\":\n if (origin !== undefined && origin !== policy.origin) {\n return refusal(\"MOSTRA_HYGIENE_ORIGIN_REFUSED\", \"The request came from another origin.\");\n }\n return undefined;\n case \"stream\": {\n const site = headerValue(request.headers, \"sec-fetch-site\");\n const sameOrigin = origin === undefined ? site === \"same-origin\" : origin === policy.origin;\n return sameOrigin\n ? undefined\n : refusal(\"MOSTRA_HYGIENE_ORIGIN_REFUSED\", \"A stream must be opened by its own origin.\");\n }\n case \"upgrade\":\n case \"exchange\":\n case \"mutation\": {\n if (origin !== policy.origin) {\n return refusal(\n \"MOSTRA_HYGIENE_ORIGIN_REFUSED\",\n origin === undefined\n ? \"The request has no Origin header.\"\n : \"The request came from another origin.\",\n );\n }\n if (request.intent === \"upgrade\") return undefined;\n if (!isJsonContentType(headerValue(request.headers, \"content-type\"))) {\n return refusal(\"MOSTRA_HYGIENE_CONTENT_TYPE\", \"The request's body isn't declared as JSON.\");\n }\n if (request.intent === \"exchange\") return undefined;\n const sent = headerValue(request.headers, CSRF_HEADER);\n if (request.csrf === undefined || sent === undefined || !safeEqual(sent, request.csrf)) {\n return refusal(\n \"MOSTRA_HYGIENE_CSRF_MISSING\",\n sent === undefined\n ? `The request has no ${CSRF_HEADER} header.`\n : `The request's ${CSRF_HEADER} header doesn't match its session.`,\n );\n }\n return undefined;\n }\n }\n}\n"],"mappings":"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"}
|
package/dist/ids.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as z from "zod";
|
|
2
2
|
//#region src/ids.d.ts
|
|
3
3
|
/** The prefixes INTERFACES §1 assigns, one per entity. */
|
|
4
|
-
export type IdPrefix = "art" | "ver" | "vw" | "vwr" | "sub" | "dlv" | "run" | "thr" | "cmt" | "tok" | "mut";
|
|
4
|
+
export type IdPrefix = "art" | "ver" | "vw" | "vwr" | "sub" | "dlv" | "run" | "thr" | "cmt" | "tok" | "mut" | "shr";
|
|
5
5
|
/**
|
|
6
6
|
* A branded ID string. The brand exists only at the type level, so an `Id<"art">` is a plain
|
|
7
7
|
* string at run time and on the wire.
|
|
@@ -97,6 +97,10 @@ export declare const TokenId: GeneratedIdKind<"tok">;
|
|
|
97
97
|
export type MutationId = Id<"mut">;
|
|
98
98
|
/** Mutation IDs. */
|
|
99
99
|
export declare const MutationId: GeneratedIdKind<"mut">;
|
|
100
|
+
/** A share ID (`shr_` + ULID): one share of an artifact through a tunnel (D158). */
|
|
101
|
+
export type ShareId = Id<"shr">;
|
|
102
|
+
/** Share IDs. */
|
|
103
|
+
export declare const ShareId: GeneratedIdKind<"shr">;
|
|
100
104
|
/**
|
|
101
105
|
* An event cursor: the decimal string of a home-wide event position (INTERFACES §1). Decimal
|
|
102
106
|
* strings keep 64-bit positions exact in JavaScript.
|
package/dist/ids.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ids.d.ts","names":[],"sources":["../src/ids.ts"],"mappings":";;;YAmBY;;;;;
|
|
1
|
+
{"version":3,"file":"ids.d.ts","names":[],"sources":["../src/ids.ts"],"mappings":";;;YAmBY;;;;;YAkBA,GAAG,UAAU,eAAe;WAA2B,kBAAkB;;;YAGzE;;iBAGK,OAAO,UAAU;;WAEvB,QAAQ;;WAER;;WAEA,MAAM;;WAEN,SAAS;;WAET,QAAQ,EAAE,QAAQ,GAAG;;EAE9B,GAAG,iBAAiB,SAAS,GAAG;;;;;;;EAOhC,MAAM,gBAAgB,GAAG;;;iBAIV,gBAAgB,UAAU,kBAAkB,OAAO;;EAElE,UAAU,GAAG;;;YAkFH,aAAa;;qBAEZ,YAAY;;YAKb,YAAY;;iBAEP,sBAAsB;;;;;;;;;EASrC,WAAW,QAAQ,aAAa;;;qBAGrB,WAAW;;YAWZ,SAAS;;qBAER,QAAQ;;YAGT,WAAW;;qBAEV,UAAU;;YAKX,eAAe;;qBAEd,cAAc;;;;;YAQf,aAAa;;qBAEZ,YAAY;;YAKb,QAAQ;;qBAEP,OAAO;;YAKR,WAAW;;qBAEV,UAAU;;YAKX,YAAY;;qBAEX,WAAW;;YAKZ,UAAU;;qBAET,SAAS;;YAKV,aAAa;;qBAEZ,YAAY;;YAKb,UAAU;;qBAET,SAAS;;;;;YAQV;WAA6B;;;qBAG5B;;WAEF,SAAS;WACT,QAAQ,EAAE,QAAQ;EAC3B,GAAG,iBAAiB,SAAS;;EAE7B,MAAM,gBAAgB;;EAEtB,QAAQ,GAAG,QAAQ,GAAG"}
|
package/dist/ids.js
CHANGED
|
@@ -109,6 +109,8 @@ const CommentId = generated(defineKind("cmt", "comment", "ulid", "CommentId"));
|
|
|
109
109
|
const TokenId = generated(defineKind("tok", "capability token", "ulid", "TokenId"));
|
|
110
110
|
/** Mutation IDs. */
|
|
111
111
|
const MutationId = generated(defineKind("mut", "mutation", "ulid", "MutationId"));
|
|
112
|
+
/** Share IDs. */
|
|
113
|
+
const ShareId = generated(defineKind("shr", "share", "ulid", "ShareId"));
|
|
112
114
|
/** Event cursors. */
|
|
113
115
|
const Cursor = (() => {
|
|
114
116
|
const pattern = /^(0|[1-9][0-9]{0,18})$/;
|
|
@@ -130,6 +132,6 @@ const Cursor = (() => {
|
|
|
130
132
|
};
|
|
131
133
|
})();
|
|
132
134
|
//#endregion
|
|
133
|
-
export { ArtifactId, CommentId, Cursor, DeliveryId, MutationId, RunId, SubmissionId, ThreadId, TokenId, VersionId, ViewId, ViewerId };
|
|
135
|
+
export { ArtifactId, CommentId, Cursor, DeliveryId, MutationId, RunId, ShareId, SubmissionId, ThreadId, TokenId, VersionId, ViewId, ViewerId };
|
|
134
136
|
|
|
135
137
|
//# sourceMappingURL=ids.js.map
|
package/dist/ids.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ids.js","names":[],"sources":["../src/ids.ts"],"sourcesContent":["/**\n * Prefixed, opaque identifiers (INTERFACES §1, DATA_MODEL §2).\n *\n * Every Mostra entity is named by a string of the form `<prefix>_<body>`. Callers treat IDs as\n * opaque: they validate the form at a boundary and never read meaning out of the body. Each ID\n * kind below is both a type and a value with the same name:\n *\n * ```ts\n * const artifact: ArtifactId = ArtifactId.parse(input);\n * const mutation: MutationId = MutationId.create();\n * const Params = z.object({ artifactId: ArtifactId.schema });\n * ```\n *\n * @packageDocumentation\n */\nimport * as z from \"zod\";\nimport { wireRegistry } from \"./wire-registry.ts\";\n\n/** The prefixes INTERFACES §1 assigns, one per entity. */\nexport type IdPrefix =\n | \"art\"\n | \"ver\"\n | \"vw\"\n | \"vwr\"\n | \"sub\"\n | \"dlv\"\n | \"run\"\n | \"thr\"\n | \"cmt\"\n | \"tok\"\n | \"mut\";\n\n/**\n * A branded ID string. The brand exists only at the type level, so an `Id<\"art\">` is a plain\n * string at run time and on the wire.\n */\nexport type Id<P extends IdPrefix> = `${P}_${string}` & { readonly __mostraIdPrefix: P };\n\n/** How an ID kind's body is formed. */\nexport type IdBody = \"ulid\" | \"sha256-base32\";\n\n/** One ID kind: its prefix, validation and schema. */\nexport interface IdKind<P extends IdPrefix> {\n /** The prefix, without the underscore. */\n readonly prefix: P;\n /** The entity the ID names, in the PRODUCT vocabulary. */\n readonly entity: string;\n /** How the body is formed. */\n readonly body: IdBody;\n /** The exact form, anchored at both ends. */\n readonly pattern: RegExp;\n /** The Zod schema for this ID, registered for JSON Schema output under the kind's type name. */\n readonly schema: z.ZodType<Id<P>, string>;\n /** Whether `value` is an ID of this kind. */\n is(value: unknown): value is Id<P>;\n /**\n * Returns `value` as an ID of this kind.\n *\n * @throws TypeError when `value` is not of this kind's form. The message names the expected\n * form and never echoes the input.\n */\n parse(value: string): Id<P>;\n}\n\n/** An ID kind whose body is a ULID that the creator generates. */\nexport interface GeneratedIdKind<P extends IdPrefix> extends IdKind<P> {\n /** Generates a new ID from the current time and 80 bits of Web Crypto randomness. */\n create(): Id<P>;\n}\n\n/** Crockford's base32 alphabet, used by ULIDs and by content-addressed version IDs. */\nconst CROCKFORD = \"0123456789ABCDEFGHJKMNPQRSTVWXYZ\";\nconst BODY_LENGTH = 26;\n/** A ULID's first character encodes at most 3 bits (48-bit time in 26 × 5 = 130 bits). */\nconst ULID_BODY = \"[0-7][0-9A-HJKMNP-TV-Z]{25}\";\nconst BASE32_BODY = \"[0-9A-HJKMNP-TV-Z]{26}\";\n\nfunction defineKind<P extends IdPrefix>(\n prefix: P,\n entity: string,\n body: IdBody,\n typeName: string,\n): IdKind<P> {\n const pattern = new RegExp(`^${prefix}_${body === \"ulid\" ? ULID_BODY : BASE32_BODY}$`);\n const form = body === \"ulid\" ? \"a 26-character ULID\" : \"26 characters of Crockford base32\";\n const is = (value: unknown): value is Id<P> => typeof value === \"string\" && pattern.test(value);\n const schema = z\n .string()\n .regex(pattern)\n .register(wireRegistry, {\n id: typeName,\n description: `${entity[0]?.toUpperCase()}${entity.slice(1)} ID: \"${prefix}_\" followed by ${form}.`,\n }) as unknown as z.ZodType<Id<P>, string>;\n return {\n prefix,\n entity,\n body,\n pattern,\n schema,\n is,\n parse(value: string): Id<P> {\n if (is(value)) return value;\n throw new TypeError(`Expected ${entity} ID \"${prefix}_\" followed by ${form}.`);\n },\n };\n}\n\nfunction generated<P extends IdPrefix>(kind: IdKind<P>): GeneratedIdKind<P> {\n return { ...kind, create: () => kind.parse(`${kind.prefix}_${ulidBody(Date.now())}`) };\n}\n\n/**\n * Encodes a ULID body: 48 bits of milliseconds since the Unix epoch, then 80 random bits, as 26\n * Crockford base32 characters.\n */\nfunction ulidBody(now: number): string {\n if (!Number.isSafeInteger(now) || now < 0 || now > 0xffff_ffff_ffff) {\n throw new RangeError(\"ULID time must be a millisecond timestamp between 0 and 2^48 - 1.\");\n }\n let time = \"\";\n let rest = now;\n for (let i = 0; i < 10; i++) {\n time = CROCKFORD.charAt(rest % 32) + time;\n rest = Math.floor(rest / 32);\n }\n const random = new Uint8Array(10);\n globalThis.crypto.getRandomValues(random);\n return time + base32(random).slice(0, 16);\n}\n\n/** Encodes bytes as Crockford base32, most significant bit first, padding the last group with 0. */\nfunction base32(bytes: Uint8Array): string {\n let out = \"\";\n let buffer = 0;\n let bits = 0;\n for (const byte of bytes) {\n buffer = (buffer << 8) | byte;\n bits += 8;\n while (bits >= 5) {\n out += CROCKFORD.charAt((buffer >>> (bits - 5)) & 31);\n bits -= 5;\n }\n buffer &= (1 << bits) - 1;\n }\n if (bits > 0) out += CROCKFORD.charAt((buffer << (5 - bits)) & 31);\n return out;\n}\n\n/** An artifact ID (`art_` + ULID). */\nexport type ArtifactId = Id<\"art\">;\n/** Artifact IDs. */\nexport const ArtifactId: GeneratedIdKind<\"art\"> = generated(\n defineKind(\"art\", \"artifact\", \"ulid\", \"ArtifactId\"),\n);\n\n/** A version ID (`ver_` + 26 characters of base32 SHA-256): content-addressed, never generated. */\nexport type VersionId = Id<\"ver\">;\n/** The version ID kind, with the content-addressed constructor DATA_MODEL §2 defines. */\nexport interface VersionIdKind extends IdKind<\"ver\"> {\n /**\n * Returns the version ID for a SHA-256 digest: `ver_` plus the first 26 characters of the\n * digest in Crockford base32 (130 bits). The caller computes the digest of the artifact ID's\n * UTF-8 bytes, a `0x00` byte, and the 32-byte `sourceDigest` and `envDigest` (DATA_MODEL §2,\n * D89).\n *\n * @throws RangeError when `digest` is not 32 bytes long.\n */\n fromSha256(digest: Uint8Array): VersionId;\n}\n/** Version IDs. */\nexport const VersionId: VersionIdKind = {\n ...defineKind(\"ver\", \"version\", \"sha256-base32\", \"VersionId\"),\n fromSha256(digest: Uint8Array): VersionId {\n if (digest.length !== 32) {\n throw new RangeError(`A SHA-256 digest is 32 bytes, got ${digest.length}.`);\n }\n return VersionId.parse(`ver_${base32(digest).slice(0, BODY_LENGTH)}`);\n },\n};\n\n/** A view ID (`vw_` + ULID). */\nexport type ViewId = Id<\"vw\">;\n/** View IDs. */\nexport const ViewId: GeneratedIdKind<\"vw\"> = generated(defineKind(\"vw\", \"view\", \"ulid\", \"ViewId\"));\n\n/** A viewer ID (`vwr_` + ULID). */\nexport type ViewerId = Id<\"vwr\">;\n/** Viewer IDs. */\nexport const ViewerId: GeneratedIdKind<\"vwr\"> = generated(\n defineKind(\"vwr\", \"viewer\", \"ulid\", \"ViewerId\"),\n);\n\n/** A submission ID (`sub_` + ULID). */\nexport type SubmissionId = Id<\"sub\">;\n/** Submission IDs. */\nexport const SubmissionId: GeneratedIdKind<\"sub\"> = generated(\n defineKind(\"sub\", \"submission\", \"ulid\", \"SubmissionId\"),\n);\n\n/**\n * A delivery ID (`dlv_` + ULID): one submission's delivery to one host (D105). A redelivery after a\n * crash repeats it, so a host can treat deliveries idempotently.\n */\nexport type DeliveryId = Id<\"dlv\">;\n/** Delivery IDs. */\nexport const DeliveryId: GeneratedIdKind<\"dlv\"> = generated(\n defineKind(\"dlv\", \"delivery\", \"ulid\", \"DeliveryId\"),\n);\n\n/** An action run ID (`run_` + ULID). */\nexport type RunId = Id<\"run\">;\n/** Action run IDs. */\nexport const RunId: GeneratedIdKind<\"run\"> = generated(\n defineKind(\"run\", \"action run\", \"ulid\", \"RunId\"),\n);\n\n/** A review thread ID (`thr_` + ULID). */\nexport type ThreadId = Id<\"thr\">;\n/** Review thread IDs. */\nexport const ThreadId: GeneratedIdKind<\"thr\"> = generated(\n defineKind(\"thr\", \"thread\", \"ulid\", \"ThreadId\"),\n);\n\n/** A comment ID (`cmt_` + ULID). */\nexport type CommentId = Id<\"cmt\">;\n/** Comment IDs. */\nexport const CommentId: GeneratedIdKind<\"cmt\"> = generated(\n defineKind(\"cmt\", \"comment\", \"ulid\", \"CommentId\"),\n);\n\n/** A capability token ID (`tok_` + ULID). The token's secret is separate and never an ID. */\nexport type TokenId = Id<\"tok\">;\n/** Capability token IDs. */\nexport const TokenId: GeneratedIdKind<\"tok\"> = generated(\n defineKind(\"tok\", \"capability token\", \"ulid\", \"TokenId\"),\n);\n\n/** A mutation ID (`mut_` + ULID), generated by the client that sends the mutation. */\nexport type MutationId = Id<\"mut\">;\n/** Mutation IDs. */\nexport const MutationId: GeneratedIdKind<\"mut\"> = generated(\n defineKind(\"mut\", \"mutation\", \"ulid\", \"MutationId\"),\n);\n\n/**\n * An event cursor: the decimal string of a home-wide event position (INTERFACES §1). Decimal\n * strings keep 64-bit positions exact in JavaScript.\n */\nexport type Cursor = string & { readonly __mostraCursor: true };\n\n/** Event cursors. */\nexport const Cursor: {\n /** The exact form: a non-negative decimal integer without leading zeros, at most 19 digits. */\n readonly pattern: RegExp;\n readonly schema: z.ZodType<Cursor, string>;\n is(value: unknown): value is Cursor;\n /** @throws TypeError when `value` is not a cursor. */\n parse(value: string): Cursor;\n /** Orders two cursors: negative when `a` comes first, zero when equal, positive otherwise. */\n compare(a: Cursor, b: Cursor): number;\n} = (() => {\n const pattern = /^(0|[1-9][0-9]{0,18})$/;\n const is = (value: unknown): value is Cursor => typeof value === \"string\" && pattern.test(value);\n return {\n pattern,\n schema: z.string().regex(pattern).register(wireRegistry, {\n id: \"Cursor\",\n description: \"Event cursor: the decimal string of a home-wide event position.\",\n }) as unknown as z.ZodType<Cursor, string>,\n is,\n parse(value: string): Cursor {\n if (is(value)) return value;\n throw new TypeError(\"Expected an event cursor: a non-negative decimal integer string.\");\n },\n compare(a: Cursor, b: Cursor): number {\n return a.length === b.length ? (a < b ? -1 : a > b ? 1 : 0) : a.length - b.length;\n },\n };\n})();\n"],"mappings":"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"}
|
|
1
|
+
{"version":3,"file":"ids.js","names":[],"sources":["../src/ids.ts"],"sourcesContent":["/**\n * Prefixed, opaque identifiers (INTERFACES §1, DATA_MODEL §2).\n *\n * Every Mostra entity is named by a string of the form `<prefix>_<body>`. Callers treat IDs as\n * opaque: they validate the form at a boundary and never read meaning out of the body. Each ID\n * kind below is both a type and a value with the same name:\n *\n * ```ts\n * const artifact: ArtifactId = ArtifactId.parse(input);\n * const mutation: MutationId = MutationId.create();\n * const Params = z.object({ artifactId: ArtifactId.schema });\n * ```\n *\n * @packageDocumentation\n */\nimport * as z from \"zod\";\nimport { wireRegistry } from \"./wire-registry.ts\";\n\n/** The prefixes INTERFACES §1 assigns, one per entity. */\nexport type IdPrefix =\n | \"art\"\n | \"ver\"\n | \"vw\"\n | \"vwr\"\n | \"sub\"\n | \"dlv\"\n | \"run\"\n | \"thr\"\n | \"cmt\"\n | \"tok\"\n | \"mut\"\n | \"shr\";\n\n/**\n * A branded ID string. The brand exists only at the type level, so an `Id<\"art\">` is a plain\n * string at run time and on the wire.\n */\nexport type Id<P extends IdPrefix> = `${P}_${string}` & { readonly __mostraIdPrefix: P };\n\n/** How an ID kind's body is formed. */\nexport type IdBody = \"ulid\" | \"sha256-base32\";\n\n/** One ID kind: its prefix, validation and schema. */\nexport interface IdKind<P extends IdPrefix> {\n /** The prefix, without the underscore. */\n readonly prefix: P;\n /** The entity the ID names, in the PRODUCT vocabulary. */\n readonly entity: string;\n /** How the body is formed. */\n readonly body: IdBody;\n /** The exact form, anchored at both ends. */\n readonly pattern: RegExp;\n /** The Zod schema for this ID, registered for JSON Schema output under the kind's type name. */\n readonly schema: z.ZodType<Id<P>, string>;\n /** Whether `value` is an ID of this kind. */\n is(value: unknown): value is Id<P>;\n /**\n * Returns `value` as an ID of this kind.\n *\n * @throws TypeError when `value` is not of this kind's form. The message names the expected\n * form and never echoes the input.\n */\n parse(value: string): Id<P>;\n}\n\n/** An ID kind whose body is a ULID that the creator generates. */\nexport interface GeneratedIdKind<P extends IdPrefix> extends IdKind<P> {\n /** Generates a new ID from the current time and 80 bits of Web Crypto randomness. */\n create(): Id<P>;\n}\n\n/** Crockford's base32 alphabet, used by ULIDs and by content-addressed version IDs. */\nconst CROCKFORD = \"0123456789ABCDEFGHJKMNPQRSTVWXYZ\";\nconst BODY_LENGTH = 26;\n/** A ULID's first character encodes at most 3 bits (48-bit time in 26 × 5 = 130 bits). */\nconst ULID_BODY = \"[0-7][0-9A-HJKMNP-TV-Z]{25}\";\nconst BASE32_BODY = \"[0-9A-HJKMNP-TV-Z]{26}\";\n\nfunction defineKind<P extends IdPrefix>(\n prefix: P,\n entity: string,\n body: IdBody,\n typeName: string,\n): IdKind<P> {\n const pattern = new RegExp(`^${prefix}_${body === \"ulid\" ? ULID_BODY : BASE32_BODY}$`);\n const form = body === \"ulid\" ? \"a 26-character ULID\" : \"26 characters of Crockford base32\";\n const is = (value: unknown): value is Id<P> => typeof value === \"string\" && pattern.test(value);\n const schema = z\n .string()\n .regex(pattern)\n .register(wireRegistry, {\n id: typeName,\n description: `${entity[0]?.toUpperCase()}${entity.slice(1)} ID: \"${prefix}_\" followed by ${form}.`,\n }) as unknown as z.ZodType<Id<P>, string>;\n return {\n prefix,\n entity,\n body,\n pattern,\n schema,\n is,\n parse(value: string): Id<P> {\n if (is(value)) return value;\n throw new TypeError(`Expected ${entity} ID \"${prefix}_\" followed by ${form}.`);\n },\n };\n}\n\nfunction generated<P extends IdPrefix>(kind: IdKind<P>): GeneratedIdKind<P> {\n return { ...kind, create: () => kind.parse(`${kind.prefix}_${ulidBody(Date.now())}`) };\n}\n\n/**\n * Encodes a ULID body: 48 bits of milliseconds since the Unix epoch, then 80 random bits, as 26\n * Crockford base32 characters.\n */\nfunction ulidBody(now: number): string {\n if (!Number.isSafeInteger(now) || now < 0 || now > 0xffff_ffff_ffff) {\n throw new RangeError(\"ULID time must be a millisecond timestamp between 0 and 2^48 - 1.\");\n }\n let time = \"\";\n let rest = now;\n for (let i = 0; i < 10; i++) {\n time = CROCKFORD.charAt(rest % 32) + time;\n rest = Math.floor(rest / 32);\n }\n const random = new Uint8Array(10);\n globalThis.crypto.getRandomValues(random);\n return time + base32(random).slice(0, 16);\n}\n\n/** Encodes bytes as Crockford base32, most significant bit first, padding the last group with 0. */\nfunction base32(bytes: Uint8Array): string {\n let out = \"\";\n let buffer = 0;\n let bits = 0;\n for (const byte of bytes) {\n buffer = (buffer << 8) | byte;\n bits += 8;\n while (bits >= 5) {\n out += CROCKFORD.charAt((buffer >>> (bits - 5)) & 31);\n bits -= 5;\n }\n buffer &= (1 << bits) - 1;\n }\n if (bits > 0) out += CROCKFORD.charAt((buffer << (5 - bits)) & 31);\n return out;\n}\n\n/** An artifact ID (`art_` + ULID). */\nexport type ArtifactId = Id<\"art\">;\n/** Artifact IDs. */\nexport const ArtifactId: GeneratedIdKind<\"art\"> = generated(\n defineKind(\"art\", \"artifact\", \"ulid\", \"ArtifactId\"),\n);\n\n/** A version ID (`ver_` + 26 characters of base32 SHA-256): content-addressed, never generated. */\nexport type VersionId = Id<\"ver\">;\n/** The version ID kind, with the content-addressed constructor DATA_MODEL §2 defines. */\nexport interface VersionIdKind extends IdKind<\"ver\"> {\n /**\n * Returns the version ID for a SHA-256 digest: `ver_` plus the first 26 characters of the\n * digest in Crockford base32 (130 bits). The caller computes the digest of the artifact ID's\n * UTF-8 bytes, a `0x00` byte, and the 32-byte `sourceDigest` and `envDigest` (DATA_MODEL §2,\n * D89).\n *\n * @throws RangeError when `digest` is not 32 bytes long.\n */\n fromSha256(digest: Uint8Array): VersionId;\n}\n/** Version IDs. */\nexport const VersionId: VersionIdKind = {\n ...defineKind(\"ver\", \"version\", \"sha256-base32\", \"VersionId\"),\n fromSha256(digest: Uint8Array): VersionId {\n if (digest.length !== 32) {\n throw new RangeError(`A SHA-256 digest is 32 bytes, got ${digest.length}.`);\n }\n return VersionId.parse(`ver_${base32(digest).slice(0, BODY_LENGTH)}`);\n },\n};\n\n/** A view ID (`vw_` + ULID). */\nexport type ViewId = Id<\"vw\">;\n/** View IDs. */\nexport const ViewId: GeneratedIdKind<\"vw\"> = generated(defineKind(\"vw\", \"view\", \"ulid\", \"ViewId\"));\n\n/** A viewer ID (`vwr_` + ULID). */\nexport type ViewerId = Id<\"vwr\">;\n/** Viewer IDs. */\nexport const ViewerId: GeneratedIdKind<\"vwr\"> = generated(\n defineKind(\"vwr\", \"viewer\", \"ulid\", \"ViewerId\"),\n);\n\n/** A submission ID (`sub_` + ULID). */\nexport type SubmissionId = Id<\"sub\">;\n/** Submission IDs. */\nexport const SubmissionId: GeneratedIdKind<\"sub\"> = generated(\n defineKind(\"sub\", \"submission\", \"ulid\", \"SubmissionId\"),\n);\n\n/**\n * A delivery ID (`dlv_` + ULID): one submission's delivery to one host (D105). A redelivery after a\n * crash repeats it, so a host can treat deliveries idempotently.\n */\nexport type DeliveryId = Id<\"dlv\">;\n/** Delivery IDs. */\nexport const DeliveryId: GeneratedIdKind<\"dlv\"> = generated(\n defineKind(\"dlv\", \"delivery\", \"ulid\", \"DeliveryId\"),\n);\n\n/** An action run ID (`run_` + ULID). */\nexport type RunId = Id<\"run\">;\n/** Action run IDs. */\nexport const RunId: GeneratedIdKind<\"run\"> = generated(\n defineKind(\"run\", \"action run\", \"ulid\", \"RunId\"),\n);\n\n/** A review thread ID (`thr_` + ULID). */\nexport type ThreadId = Id<\"thr\">;\n/** Review thread IDs. */\nexport const ThreadId: GeneratedIdKind<\"thr\"> = generated(\n defineKind(\"thr\", \"thread\", \"ulid\", \"ThreadId\"),\n);\n\n/** A comment ID (`cmt_` + ULID). */\nexport type CommentId = Id<\"cmt\">;\n/** Comment IDs. */\nexport const CommentId: GeneratedIdKind<\"cmt\"> = generated(\n defineKind(\"cmt\", \"comment\", \"ulid\", \"CommentId\"),\n);\n\n/** A capability token ID (`tok_` + ULID). The token's secret is separate and never an ID. */\nexport type TokenId = Id<\"tok\">;\n/** Capability token IDs. */\nexport const TokenId: GeneratedIdKind<\"tok\"> = generated(\n defineKind(\"tok\", \"capability token\", \"ulid\", \"TokenId\"),\n);\n\n/** A mutation ID (`mut_` + ULID), generated by the client that sends the mutation. */\nexport type MutationId = Id<\"mut\">;\n/** Mutation IDs. */\nexport const MutationId: GeneratedIdKind<\"mut\"> = generated(\n defineKind(\"mut\", \"mutation\", \"ulid\", \"MutationId\"),\n);\n\n/** A share ID (`shr_` + ULID): one share of an artifact through a tunnel (D158). */\nexport type ShareId = Id<\"shr\">;\n/** Share IDs. */\nexport const ShareId: GeneratedIdKind<\"shr\"> = generated(\n defineKind(\"shr\", \"share\", \"ulid\", \"ShareId\"),\n);\n\n/**\n * An event cursor: the decimal string of a home-wide event position (INTERFACES §1). Decimal\n * strings keep 64-bit positions exact in JavaScript.\n */\nexport type Cursor = string & { readonly __mostraCursor: true };\n\n/** Event cursors. */\nexport const Cursor: {\n /** The exact form: a non-negative decimal integer without leading zeros, at most 19 digits. */\n readonly pattern: RegExp;\n readonly schema: z.ZodType<Cursor, string>;\n is(value: unknown): value is Cursor;\n /** @throws TypeError when `value` is not a cursor. */\n parse(value: string): Cursor;\n /** Orders two cursors: negative when `a` comes first, zero when equal, positive otherwise. */\n compare(a: Cursor, b: Cursor): number;\n} = (() => {\n const pattern = /^(0|[1-9][0-9]{0,18})$/;\n const is = (value: unknown): value is Cursor => typeof value === \"string\" && pattern.test(value);\n return {\n pattern,\n schema: z.string().regex(pattern).register(wireRegistry, {\n id: \"Cursor\",\n description: \"Event cursor: the decimal string of a home-wide event position.\",\n }) as unknown as z.ZodType<Cursor, string>,\n is,\n parse(value: string): Cursor {\n if (is(value)) return value;\n throw new TypeError(\"Expected an event cursor: a non-negative decimal integer string.\");\n },\n compare(a: Cursor, b: Cursor): number {\n return a.length === b.length ? (a < b ? -1 : a > b ? 1 : 0) : a.length - b.length;\n },\n };\n})();\n"],"mappings":"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"}
|
package/dist/index.d.ts
CHANGED
|
@@ -3,10 +3,10 @@ import { ACTION_ARGS_MAX, ACTION_RESULT_MAX, ActionError, Batches, CallLine, Cal
|
|
|
3
3
|
import { ARTIFACT_MANIFEST_KEYS, ArtifactFamily, ArtifactLink, ArtifactManifest, DemoSpec, SubmissionPolicy, TerminalSpec } from "./manifest.js";
|
|
4
4
|
import { ArtifactDetail, ArtifactRef, ArtifactSummary, PublishReceipt, SourceRef, VersionSummary } from "./artifact.js";
|
|
5
5
|
import { ControlsPolicy, DeliveryTarget, REVIEW_SET_ID_PATTERN, SubmitChannel, TrustedControl, VersionRef, ViewContext, ViewContextWire, readViewContext } from "./view.js";
|
|
6
|
-
import { AnyBridgeMessage, BRIDGE_FIELDS_MAX, BRIDGE_MESSAGES, BRIDGE_TEXT_MAX, Bridge, BridgeEvent, BridgeHostContext, BridgeImplementation, BridgeMessage, BridgeOptions, BridgePeer, BridgeReceiver, BridgeRejection, BridgeSide, CONTROL_LABEL_MAX, ControlRequest, FieldRegistration, FieldsParams, FlushResult, MCP_APPS_PROTOCOL_VERSION, OPEN_LINK_SCHEMES, SaveState, SubmitBlocker, UiInitializeParams, UiInitializeResult, VersionAvailableParams, connectBridge, mostraControlsRequest, mostraFieldFocus, mostraFields, mostraFlush, mostraPage, mostraReady, mostraVersionAvailable, uiInitialize, uiInitialized, uiOpenLink, uiSizeChanged } from "./bridge.js";
|
|
7
|
-
import { ArtifactId, CommentId, Cursor, DeliveryId, GeneratedIdKind, Id, IdBody, IdKind, IdPrefix, MutationId, RunId, SubmissionId, ThreadId, TokenId, VersionId, VersionIdKind, ViewId, ViewerId } from "./ids.js";
|
|
6
|
+
import { AnyBridgeMessage, BRIDGE_FIELDS_MAX, BRIDGE_MESSAGES, BRIDGE_TEXT_MAX, Bridge, BridgeEvent, BridgeHostContext, BridgeImplementation, BridgeMessage, BridgeOptions, BridgePeer, BridgeReceiver, BridgeRejection, BridgeSide, CONTROL_LABEL_MAX, ControlRequest, FieldRegistration, FieldsParams, FlushResult, FrameSessionFailedParams, MCP_APPS_PROTOCOL_VERSION, OPEN_LINK_SCHEMES, SaveState, SubmitBlocker, UiInitializeParams, UiInitializeResult, VersionAvailableParams, connectBridge, mostraControlsRequest, mostraFieldFocus, mostraFields, mostraFlush, mostraFrameSessionEntered, mostraFrameSessionFailed, mostraPage, mostraReady, mostraVersionAvailable, uiInitialize, uiInitialized, uiOpenLink, uiSizeChanged } from "./bridge.js";
|
|
7
|
+
import { ArtifactId, CommentId, Cursor, DeliveryId, GeneratedIdKind, Id, IdBody, IdKind, IdPrefix, MutationId, RunId, ShareId, SubmissionId, ThreadId, TokenId, VersionId, VersionIdKind, ViewId, ViewerId } from "./ids.js";
|
|
8
8
|
import { Actor, DeliveryState, DeliveryStatus, DocumentRevision, EventFilter, EventRecord, EventTypePattern, FIELD_ID_MAX_LENGTH, FieldConflict, FieldOp, FieldScope, FieldState, MutationResult, Rect, ResultComment, Results, SIGNAL_NAME_PATTERN, SubmissionSummary, Viewer, ViewerKind, ViewerSpec, Viewport, WaitCondition, isFieldId } from "./interaction.js";
|
|
9
|
-
import { BROWSER_PROTOCOL_REVISION, BROWSER_PROTOCOL_REVISIONS, CarryOver, ChooseRequest, DocumentSnapshot, FieldsRequest, FollowRequest, FrameTicket, OrphanedField, PollResult, SIGNAL_PAYLOAD_MAX_BYTES, ShellSubmitRequest, SignalRequest, StreamSnapshot, SubmitRequest } from "./browser.js";
|
|
9
|
+
import { BROWSER_PROTOCOL_REVISION, BROWSER_PROTOCOL_REVISIONS, CarryOver, ChooseRequest, DocumentSnapshot, EnterRequest, EnterResult, FRAME_SESSION_HEADER, FieldsRequest, FollowRequest, FrameSessionFacts, FrameTicket, OrphanedField, PollResult, SIGNAL_PAYLOAD_MAX_BYTES, ShellSubmitRequest, SignalRequest, StreamSnapshot, StreamTicket, StreamTicketRequest, SubmitRequest } from "./browser.js";
|
|
10
10
|
import { BUNDLE_NAME, BUNDLE_PLATFORMS, BUNDLE_SETUP_MARKER, BundleAsset, BundleBrowser, BundleFileEntry, BundleFiles, BundleInfo, BundleLinkEntry, BundlePins, BundlePlatform, BundlePlatformSchema, BundleSetup, bundleAssetName, isWindowsBundle } from "./bundle.js";
|
|
11
11
|
import { canonicalJson } from "./canonical.js";
|
|
12
12
|
import { ALL_SCOPES, CapabilityScope, Duration, durationMs, normalizeScopes, scopeAllows } from "./capability.js";
|
|
@@ -32,6 +32,7 @@ import { PublishDiagnosticCode, publishDiagnosticCodes } from "./diagnostics/cod
|
|
|
32
32
|
import { RegressionDiagnosticCode, regressionDiagnosticCodes } from "./diagnostics/codes/regression.js";
|
|
33
33
|
import { RuntimeDiagnosticCode, runtimeDiagnosticCodes } from "./diagnostics/codes/runtime.js";
|
|
34
34
|
import { SecretDiagnosticCode, secretDiagnosticCodes } from "./diagnostics/codes/secret.js";
|
|
35
|
+
import { ShareDiagnosticCode, shareDiagnosticCodes } from "./diagnostics/codes/share.js";
|
|
35
36
|
import { SmokeDiagnosticCode, smokeDiagnosticCodes } from "./diagnostics/codes/smoke.js";
|
|
36
37
|
import { SubmitDiagnosticCode, submitDiagnosticCodes } from "./diagnostics/codes/submit.js";
|
|
37
38
|
import { TargetDiagnosticCode, targetDiagnosticCodes } from "./diagnostics/codes/target.js";
|
|
@@ -58,9 +59,11 @@ import { hostMethods, hostNotifications } from "./methods/index.js";
|
|
|
58
59
|
import { InstanceCheck, InstanceCheckParams, InstanceCheckResult, instanceCheckMethod } from "./methods/instance/check.js";
|
|
59
60
|
import { HOST_PROTOCOL_REVISIONS, Revision, RevisionNegotiation, negotiateRevision } from "./revision.js";
|
|
60
61
|
import { CLI_CLIENT_NAME, ClientCapabilities, ClientInfo, DependencyPolicy, HomeConfig, InstanceCapabilities, InstanceInfo, MostraInitializeParams, MostraInitializeResult, PortName, mostraInitializeMethod } from "./methods/mostra/initialize.js";
|
|
61
|
-
import {
|
|
62
|
+
import { PUBLIC_SHARE_DEFAULT_TTL, PUBLIC_SHARE_MAX_TTL_MS, Share, ShareStartParams, ShareStartResult, ShareVia, shareStartMethod } from "./methods/share/start.js";
|
|
63
|
+
import { ChildProcessStatus, DeliveryCounts, FaceStatus, GatewayStatus, InstanceStatusParams, InstanceStatusResult, WorkerStatus, instanceStatusMethod } from "./methods/instance/status.js";
|
|
62
64
|
import { LivePushParams, LivePushResult, livePushMethod } from "./methods/live/push.js";
|
|
63
65
|
import { MostraShutdownParams, MostraShutdownResult, mostraShutdownMethod } from "./methods/mostra/shutdown.js";
|
|
66
|
+
import { ExternalBase, OriginString, PortAddressingExternalBaseParams, PortAddressingExternalBaseResult, portAddressingExternalBaseMethod } from "./methods/port/addressing-external-base.js";
|
|
64
67
|
import { DraftMirror, DraftsMirrorResult, portDraftsMirrorMethod } from "./methods/port/drafts-mirror.js";
|
|
65
68
|
import { IdentityVia, PortIdentityResolveParams, PortIdentityResolveResult, portIdentityResolveMethod } from "./methods/port/identity-resolve.js";
|
|
66
69
|
import { PortSecretsGetParams, PortSecretsGetResult, portSecretsGetMethod } from "./methods/port/secrets-get.js";
|
|
@@ -71,6 +74,8 @@ import { ResultsGetParams, ResultsGetResult, ResultsMarkdown, resultsGetMethod }
|
|
|
71
74
|
import { SecretDeleteParams, SecretDeleteResult, secretDeleteMethod } from "./methods/secret/delete.js";
|
|
72
75
|
import { SecretEntry, SecretSetParams, SecretSetResult, secretSetMethod } from "./methods/secret/set.js";
|
|
73
76
|
import { SecretListParams, SecretListResult, secretListMethod } from "./methods/secret/list.js";
|
|
77
|
+
import { ShareListParams, ShareListResult, shareListMethod } from "./methods/share/list.js";
|
|
78
|
+
import { ShareStopParams, ShareStopResult, shareStopMethod } from "./methods/share/stop.js";
|
|
74
79
|
import { StateGetParams, StateGetResult, stateGetMethod } from "./methods/state/get.js";
|
|
75
80
|
import { StatePatchParams, StatePatchResult, statePatchMethod } from "./methods/state/patch.js";
|
|
76
81
|
import { CapabilityLink, ViewUrlParams, ViewUrlResult, viewUrlMethod } from "./methods/view/url.js";
|
|
@@ -85,4 +90,4 @@ import { JSON_RPC_ERROR_CODES, RpcError } from "./rpc/error.js";
|
|
|
85
90
|
import { LineSplitter, MAX_LINE_LENGTH, encodeLine } from "./rpc/lines.js";
|
|
86
91
|
import { RpcPeer, RpcPeerOptions, RpcRequestContext, RpcRequestOptions, parseParams } from "./rpc/peer.js";
|
|
87
92
|
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";
|
|
88
|
-
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, isWindowsBundle, 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, receivable, 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 };
|
|
93
|
+
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, EnterRequest, EnterResult, type EnvDiagnosticCode, type EphemeralMessage, EventFilter, EventRecord, EventTypePattern, type EventsAckParams, type EventsAckResult, EventsNotifyParams, type EventsReadParams, type EventsReadResult, type EventsSubscribeParams, type EventsSubscribeResult, type EventsUnsubscribeParams, type EventsUnsubscribeResult, ExternalBase, FIELD_ID_MAX_LENGTH, FRAME_SESSION_HEADER, type FaceStatus, FieldConflict, type FieldDiagnosticCode, FieldOp, type FieldRegistration, type FieldScope, FieldState, type FieldsParams, FieldsRequest, type FlushResult, FollowRequest, type Frame, FrameSessionFacts, type FrameSessionFailedParams, 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, OriginString, OrphanedField, PUBLIC_SHARE_DEFAULT_TTL, PUBLIC_SHARE_MAX_TTL_MS, type PlatformDiagnosticCode, PollResult, type PortAddressingExternalBaseParams, type PortAddressingExternalBaseResult, 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, Share, type ShareDiagnosticCode, ShareId, type ShareListParams, type ShareListResult, type ShareStartParams, type ShareStartResult, type ShareStopParams, type ShareStopResult, ShareVia, ShellSubmitRequest, SignalRequest, type SmokeDiagnosticCode, SourceRef, type StateGetParams, type StateGetResult, type StatePatchParams, type StatePatchResult, StreamSnapshot, StreamTicket, StreamTicketRequest, 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, isWindowsBundle, liveDiagnosticCodes, livePushMethod, manifestDiagnosticCodes, mostraControlsRequest, mostraFieldFocus, mostraFields, mostraFlush, mostraFrameSessionEntered, mostraFrameSessionFailed, mostraInitializeMethod, mostraPage, mostraReady, mostraShutdownMethod, mostraVersionAvailable, negotiateRevision, networkDiagnosticCodes, normalizeScopes, parseParams, platformDiagnosticCodes, portAddressingExternalBaseMethod, portDraftsMirrorMethod, portIdentityResolveMethod, portSecretsGetMethod, portSubmissionsDeliverMethod, portTrustedControlsActivatedMethod, portTrustedControlsPolicyMethod, publishDiagnosticCodes, readViewContext, receivable, refusal, regressionDiagnosticCodes, resultsGetMethod, runtimeDiagnosticCodes, safeEqual, safePath, scopeAllows, secretDeleteMethod, secretDiagnosticCodes, secretListMethod, secretSetMethod, serializeAll, shareDiagnosticCodes, shareListMethod, shareStartMethod, shareStopMethod, smokeDiagnosticCodes, stateGetMethod, statePatchMethod, submitDiagnosticCodes, targetDiagnosticCodes, toBase64, typeDiagnosticCodes, uiInitialize, uiInitialized, uiOpenLink, uiSizeChanged, verifyDiagnosticCodes, viewDefaultMethod, viewLaunchMethod, viewRevokeMethod, viewRotateMethod, viewUrlMethod, viewportsFor, waitMethod, wireError };
|