@mostra/protocol 0.11.0 → 0.13.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.
Files changed (97) hide show
  1. package/dist/actions.d.ts +11 -3
  2. package/dist/actions.d.ts.map +1 -1
  3. package/dist/actions.js.map +1 -1
  4. package/dist/browser.d.ts +1 -1
  5. package/dist/diagnostics/codes/index.d.ts +3 -2
  6. package/dist/diagnostics/codes/index.d.ts.map +1 -1
  7. package/dist/diagnostics/codes/index.js +3 -1
  8. package/dist/diagnostics/codes/index.js.map +1 -1
  9. package/dist/diagnostics/codes/remote.js +2 -2
  10. package/dist/diagnostics/codes/remote.js.map +1 -1
  11. package/dist/diagnostics/codes/team.d.ts +8 -0
  12. package/dist/diagnostics/codes/team.d.ts.map +1 -0
  13. package/dist/diagnostics/codes/team.js +44 -0
  14. package/dist/diagnostics/codes/team.js.map +1 -0
  15. package/dist/diagnostics/diagnostic.d.ts +1 -1
  16. package/dist/diagnostics/diagnostic.d.ts.map +1 -1
  17. package/dist/diagnostics/diagnostic.js +2 -1
  18. package/dist/diagnostics/diagnostic.js.map +1 -1
  19. package/dist/index.d.ts +13 -6
  20. package/dist/index.js +11 -4
  21. package/dist/interaction.d.ts +12 -3
  22. package/dist/interaction.d.ts.map +1 -1
  23. package/dist/interaction.js +15 -12
  24. package/dist/interaction.js.map +1 -1
  25. package/dist/manifest.d.ts +3 -0
  26. package/dist/manifest.d.ts.map +1 -1
  27. package/dist/manifest.js +5 -2
  28. package/dist/manifest.js.map +1 -1
  29. package/dist/methods/index.d.ts.map +1 -1
  30. package/dist/methods/index.js +10 -2
  31. package/dist/methods/index.js.map +1 -1
  32. package/dist/methods/port/trusted-controls-policy.d.ts +1 -1
  33. package/dist/methods/results/get.d.ts +3 -1
  34. package/dist/methods/results/get.d.ts.map +1 -1
  35. package/dist/methods/results/get.js +4 -3
  36. package/dist/methods/results/get.js.map +1 -1
  37. package/dist/methods/results/list.d.ts +33 -0
  38. package/dist/methods/results/list.d.ts.map +1 -0
  39. package/dist/methods/results/list.js +35 -0
  40. package/dist/methods/results/list.js.map +1 -0
  41. package/dist/methods/roster/add.d.ts +47 -0
  42. package/dist/methods/roster/add.d.ts.map +1 -0
  43. package/dist/methods/roster/add.js +46 -0
  44. package/dist/methods/roster/add.js.map +1 -0
  45. package/dist/methods/roster/get.d.ts +18 -0
  46. package/dist/methods/roster/get.d.ts.map +1 -0
  47. package/dist/methods/roster/get.js +22 -0
  48. package/dist/methods/roster/get.js.map +1 -0
  49. package/dist/methods/roster/remove.d.ts +28 -0
  50. package/dist/methods/roster/remove.d.ts.map +1 -0
  51. package/dist/methods/roster/remove.js +31 -0
  52. package/dist/methods/roster/remove.js.map +1 -0
  53. package/dist/methods/share/start.d.ts +15 -2
  54. package/dist/methods/share/start.d.ts.map +1 -1
  55. package/dist/methods/share/start.js +5 -1
  56. package/dist/methods/share/start.js.map +1 -1
  57. package/dist/methods/state/get.d.ts +1 -1
  58. package/dist/methods/state/patch.d.ts +1 -1
  59. package/dist/methods/view/url.d.ts +1 -1
  60. package/dist/methods/wait/wait.d.ts +1 -1
  61. package/dist/operator.d.ts +93 -11
  62. package/dist/operator.d.ts.map +1 -1
  63. package/dist/operator.js.map +1 -1
  64. package/dist/team-settings.d.ts +21 -0
  65. package/dist/team-settings.d.ts.map +1 -0
  66. package/dist/team-settings.js +27 -0
  67. package/dist/team-settings.js.map +1 -0
  68. package/dist/team.d.ts +221 -0
  69. package/dist/team.d.ts.map +1 -0
  70. package/dist/team.js +162 -0
  71. package/dist/team.js.map +1 -0
  72. package/dist/verify.d.ts +7 -0
  73. package/dist/verify.d.ts.map +1 -1
  74. package/dist/verify.js.map +1 -1
  75. package/dist/worker.d.ts +1 -1
  76. package/package.json +1 -1
  77. package/schemas/protocol.draft-07.json +802 -79
  78. package/schemas/protocol.schema.json +782 -91
  79. package/src/actions.ts +8 -4
  80. package/src/diagnostics/codes/index.ts +6 -2
  81. package/src/diagnostics/codes/remote.ts +2 -2
  82. package/src/diagnostics/codes/team.ts +53 -0
  83. package/src/diagnostics/diagnostic.ts +3 -1
  84. package/src/index.ts +47 -2
  85. package/src/interaction.ts +24 -5
  86. package/src/manifest.ts +5 -0
  87. package/src/methods/index.ts +8 -0
  88. package/src/methods/results/get.ts +3 -2
  89. package/src/methods/results/list.ts +61 -0
  90. package/src/methods/roster/add.ts +77 -0
  91. package/src/methods/roster/get.ts +30 -0
  92. package/src/methods/roster/remove.ts +49 -0
  93. package/src/methods/share/start.ts +23 -3
  94. package/src/operator.ts +83 -10
  95. package/src/team-settings.ts +38 -0
  96. package/src/team.ts +398 -0
  97. package/src/verify.ts +7 -0
package/dist/actions.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { Frame, WireError } from "./serializer.js";
2
+ import { PresenceState, RosterForPage } from "./team.js";
2
3
  import * as z from "zod";
3
4
  //#region src/actions.d.ts
4
5
  /** A value written by the serializer: its batches, in order (`serializeAll`). */
@@ -177,9 +178,10 @@ export interface LiveUpdate {
177
178
  readonly awaiting?: boolean;
178
179
  }
179
180
  /**
180
- * An ephemeral message on a page's event stream (SSE `event: run` or `event: live`, without an
181
- * `id`, so a reconnect's cursor is untouched) or in a poll's `ephemeral`: lossy, coalesced, and
182
- * never stored as an event.
181
+ * An ephemeral message on a page's event stream (SSE `event: run`, `live`, `respondents` or
182
+ * `presence`, without an `id`, so a reconnect's cursor is untouched) or in a poll's `ephemeral`:
183
+ * lossy, coalesced, and never stored as an event. `respondents` and `presence` (D168) reach only a
184
+ * page that asked for them, so a version built before them never receives one.
183
185
  */
184
186
  export type EphemeralMessage = {
185
187
  readonly kind: "run";
@@ -187,6 +189,12 @@ export type EphemeralMessage = {
187
189
  } | {
188
190
  readonly kind: "live";
189
191
  readonly live: LiveUpdate;
192
+ } | {
193
+ readonly kind: "respondents";
194
+ readonly respondents: RosterForPage;
195
+ } | {
196
+ readonly kind: "presence";
197
+ readonly presence: PresenceState;
190
198
  };
191
199
  /** `POST …/call/{fnId}`: a plain server-function call, no durable record (D54). */
192
200
  export interface CallRequest {
@@ -1 +1 @@
1
- {"version":3,"file":"actions.d.ts","names":[],"sources":["../src/actions.ts"],"mappings":";;;;YAgBY,6BAA6B;;;;;qBAM5B,SAAS,EAAE,QAAQ;;iBASf,oBAAoB;;WAE1B;;;qBAIE,aAAa,EAAE,QAAQ;;qBAYvB;;qBAGA;;qBAGA;;qBAGA;;qBAGA;;;;;;;;YASD;;qBAUC,uBAAuB;;wBAWpB,iBAAiB,QAAQ;;;;;;;YAU7B;;iBAGK;;WAEN;;WAEA;;;qBAIE,aAAa,EAAE,QAAQ;;;;;iBAcnB;;WAEN;;WAEA;;WAEA;;WAEA,QAAQ;;WAER,SAAS;;WAET,WAAW;;WAEX;;WAEA,SAAS;;WAET,QAAQ;;WAER;;WAEA;;WAEA;;;;;WAKA;;WAEA;;;;;WAKA;;;qBAIE,UAAU,EAAE,QAAQ;;;;;;iBA4BhB;;WAEN;;WAEA,QAAQ;;WAER,SAAS;;WAET,WAAW;;WAEX;;WAEA;;WAEA;;WAEA,SAAS;;WAET,QAAQ;;WAER;;;iBAIM;;WAEN;;WAEA;;WAEA;;WAEA,QAAQ;;;;;WAKR;aACE;aACA;aACA,OAAO;;;WAGT,QAAQ;;;;;;;WAOR;;;;;WAKA;;;iBAIM;;WAEN;;WAEA;;WAEA;;WAEA,QAAQ;;WAER,QAAQ;;;;;WAKR;;;;;;;YAQC;WACG;WAAsB,KAAK;;WAC3B;WAAuB,MAAM;;;iBAG3B;;WAEN;;WAEA,MAAM;;;qBAIJ,aAAa,EAAE,QAAQ;;;;YAUxB;WACG,gBAAgB;;WAChB;aAAgB;;;WAChB;aAAgB;aAA2B,OAAO;;;;iBAGhD;;WAEN;;WAEA;;WAEA,MAAM;;WAEN;;WAEA;;;qBAIE,YAAY,EAAE,QAAQ;;;;;iBAiBlB;;WAEN;;WAEA;;WAEA;aAA4B;aAAuB;;;;;;;WAMnD;aACE;aACA;aACA;;;;qBAKA,kBA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AIJ,aAAa,EAAE,QAAQ;;;;YAUxB;WACG,gBAAgB;;WAChB;aAAgB;;;WAChB;aAAgB;aAA2B,OAAO;;;;iBAGhD;;WAEN;;WAEA;;WAEA,MAAM;;WAEN;;WAEA;;;qBAIE,YAAY,EAAE,QAAQ;;;;;iBAiBlB;;WAEN;;WAEA;;WAEA;aAA4B;aAAuB;;;;;;;WAMnD;aACE;aACA;aACA;;;;qBAKA,kBAAkB,EAAE,QAAQ;;iBA6BxB;;WAEN;;;qBAIE,kBAAkB,EAAE,QAAQ;;qBAK5B,kBAAkB;;;;;;qBAOlB;;iBAGI;;WAEN,SAAS,SAAS;;WAElB;;;qBAIE,2BAA2B;;qBAK3B;;qBAGA;;qBAGA;;;;;iBAMI;;WAEN;;;;;WAKA;aACE;aACA;aACA;;;;qBAKA,aAAa,EAAE,QAAQ;;qBAoBvB,qBAAqB;;qBAGrB"}
@@ -1 +1 @@
1
- {"version":3,"file":"actions.js","names":[],"sources":["../src/actions.ts"],"sourcesContent":["/**\n * Actions, live data and secrets (INTERFACES §2.4, §4, §6; D24, D44, D54, D56): the shapes the\n * browser protocol, the host protocol and the worker channel share. Server-function arguments and\n * results travel as the serializer's batches (`Batches`).\n *\n * ```ts\n * const run: RunState = await post(\"runs\", { viewId, fnId: \"actions.ts#sendReply\", args, clientKey });\n * if (run.status === \"succeeded\") show(await deserializeAll(run.batches));\n * ```\n */\nimport * as z from \"zod\";\nimport { ViewId } from \"./ids.ts\";\nimport type { Frame, WireError } from \"./serializer.ts\";\nimport { wireRegistry } from \"./wire-registry.ts\";\n\n/** A value written by the serializer: its batches, in order (`serializeAll`). */\nexport type Batches = readonly (readonly Frame[])[];\n\n/**\n * The Zod schema of the `Batches` type: a list of batches, each a list of frames. The frames\n * themselves are checked by the reader (`ValueReader`), which refuses anything malformed.\n */\nexport const Batches: z.ZodType<Batches> = z\n .array(z.array(z.record(z.string(), z.unknown())).readonly())\n .readonly()\n .register(wireRegistry, {\n id: \"Batches\",\n description: \"A serialized server-function value: its batches of frames, in order.\",\n }) as unknown as z.ZodType<Batches>;\n\n/** An error as runs, calls and live sources report it. */\nexport interface ActionError extends WireError {\n /** The stack of the thrown error, kept in the run log and never sent to a page. */\n readonly stack?: string;\n}\n\n/** The Zod schema of the `ActionError` type. */\nexport const ActionError: z.ZodType<ActionError> = z\n .object({\n message: z.string(),\n code: z.string().exactOptional(),\n stack: z.string().exactOptional(),\n })\n .register(wireRegistry, {\n id: \"ActionError\",\n description: \"An error from server code: its message and diagnostic code.\",\n });\n\n/** The largest serialized arguments a call or run takes, in characters of JSON. */\nexport const ACTION_ARGS_MAX: number = 16 * 1024 * 1024;\n\n/** The largest serialized result a run keeps, in characters of JSON (larger fails the run). */\nexport const ACTION_RESULT_MAX: number = 16 * 1024 * 1024;\n\n/** The cap of a run's log, in UTF-16 code units of its lines (D47's 1 MB). */\nexport const RUN_LOG_MAX: number = 1024 * 1024;\n\n/** The line a capped log ends with. */\nexport const RUN_LOG_TRUNCATED = \"[log truncated at 1 MB]\";\n\n/** The longest run key, in characters. */\nexport const RUN_KEY_MAX = 256;\n\n/**\n * A run's state (D24, ARCHITECTURE §7). `queued`: recorded, not yet started in a worker.\n * `running`: started. `waiting`: a remote server's run that waits for its owner's instance (D165\n * item 4); a page that doesn't know it treats it like `queued`. `unknown`: a relayed run whose\n * owner never reported its end within the artifact's offline limit, which may have taken effect;\n * the owner's later report replaces it once. The others are final.\n */\nexport type RunStatus =\n | \"queued\"\n | \"running\"\n | \"waiting\"\n | \"succeeded\"\n | \"failed\"\n | \"cancelled\"\n | \"unknown\";\n\n/** Every run status. */\nexport const RUN_STATUSES: readonly RunStatus[] = [\n \"queued\",\n \"running\",\n \"waiting\",\n \"succeeded\",\n \"failed\",\n \"cancelled\",\n \"unknown\",\n];\n\n/** Whether a run in `status` has ended. */\nexport function isFinalRunStatus(status: RunStatus): boolean {\n return status === \"succeeded\" || status === \"failed\" || status === \"cancelled\";\n}\n\n/**\n * Why a run ended the way it did, beside its status: `interrupted` (its worker or the instance\n * stopped while it ran, D24), `threw` (the action threw), `unserializable` (its result is outside\n * the type set), `too-large`, `parked` (its artifact's worker keeps crashing), `cancelled` (by a\n * viewer), `unknown-function`. Later releases add reasons.\n */\nexport type RunReason = string;\n\n/** A run's progress, as the action last reported it. */\nexport interface RunProgress {\n /** From 0 to 1. */\n readonly fraction?: number;\n /** One short line for people. */\n readonly message?: string;\n}\n\n/** The Zod schema of the `RunProgress` type. */\nexport const RunProgress: z.ZodType<RunProgress> = z\n .object({\n fraction: z.number().min(0).max(1).exactOptional(),\n message: z.string().max(1000).exactOptional(),\n })\n .register(wireRegistry, {\n id: \"RunProgress\",\n description: \"A run's progress: fraction and message.\",\n });\n\n/**\n * One action run as a page reads it (D54): its state, progress, log and the result written so far.\n * A result that is an async iterable grows item by item while the run is `running`.\n */\nexport interface RunState {\n /** The run's `run_` ID. */\n readonly runId: string;\n /** The server function it runs: `<module path>#<export>`. */\n readonly fnId: string;\n /** The idempotency key it was started with, if any. */\n readonly key?: string;\n /** The run's state. */\n readonly status: RunStatus;\n /** Why it ended, for `failed` and `cancelled`. */\n readonly reason?: RunReason;\n /** Its latest progress. */\n readonly progress?: RunProgress;\n /** The log lines, capped at 1 MB with a marker line. */\n readonly log: readonly string[];\n /** The result's batches so far. */\n readonly batches: Batches;\n /** For `failed`: what went wrong, without the stack. */\n readonly error?: WireError;\n /** When it was recorded. */\n readonly startedAt: string;\n /** When it ended. */\n readonly finishedAt?: string;\n /** Whether this request joined a run that already existed (a key or a retried `clientKey`). */\n readonly joined?: boolean;\n /**\n * The index of the first line in `log`, when the request said which lines the page holds\n * (`RunAttachRequest.held`); absent: 0, the whole log.\n */\n readonly logFrom?: number;\n /** The index of the first batch in `batches`, as `logFrom`; absent: 0. */\n readonly batchFrom?: number;\n /**\n * On a remote server: the run is `running` on its owner's instance, which can't be reached now\n * (D165 item 4); it ends when the owner reports, or becomes `unknown` past the offline limit.\n */\n readonly ownerUnreachable?: boolean;\n}\n\n/** The Zod schema of the `RunState` type. */\nexport const RunState: z.ZodType<RunState> = z\n .object({\n runId: z.string(),\n fnId: z.string(),\n key: z.string().exactOptional(),\n status: z.enum(RUN_STATUSES as [RunStatus, ...RunStatus[]]),\n reason: z.string().exactOptional(),\n progress: RunProgress.exactOptional(),\n log: z.array(z.string()).readonly(),\n batches: Batches,\n error: z.object({ message: z.string(), code: z.string().exactOptional() }).exactOptional(),\n startedAt: z.string(),\n finishedAt: z.string().exactOptional(),\n joined: z.boolean().exactOptional(),\n logFrom: z.number().int().nonnegative().exactOptional(),\n batchFrom: z.number().int().nonnegative().exactOptional(),\n ownerUnreachable: z.boolean().exactOptional(),\n })\n .register(wireRegistry, {\n id: \"RunState\",\n description: \"An action run: status, progress, log and the result written so far.\",\n });\n\n/**\n * What changed in a run since a page last heard: a lossy notification on the event stream. Lines\n * start at `logFrom` and batches at `batchFrom`; a page that holds fewer reads the run again\n * (`runs/attach`).\n */\nexport interface RunDelta {\n /** The run's `run_` ID. */\n readonly runId: string;\n /** The run's state. */\n readonly status: RunStatus;\n /** Why it ended so, for `failed` and `cancelled`. */\n readonly reason?: RunReason;\n /** Its latest progress. */\n readonly progress?: RunProgress;\n /** The index of the first line in `log`. */\n readonly logFrom: number;\n /** Log lines, starting at `logFrom`. */\n readonly log: readonly string[];\n /** The index of the first batch in `batches`. */\n readonly batchFrom: number;\n /** Result batches, starting at `batchFrom`. */\n readonly batches: Batches;\n /** What went wrong. */\n readonly error?: WireError;\n /** When it ended. */\n readonly finishedAt?: string;\n}\n\n/** A live source's value as a page reads it (D56). */\nexport interface LiveState {\n /** The idempotency key it was started with, if any. */\n readonly key: string;\n /** The value's revision, a decimal string that only grows; absent before any value. */\n readonly revision?: string;\n /** When the value was produced. */\n readonly at?: string;\n /** The latest value, serialized. */\n readonly value?: Batches;\n /**\n * Append mode (`useLive(key, { mode: \"append\" })`): the values kept in the source's ring, oldest\n * first, at most the window the page asked for.\n */\n readonly ring?: readonly {\n readonly revision: string;\n readonly at: string;\n readonly value: Batches;\n }[];\n /** The producer's last failure, while the last good value stays (FAILURE_MODEL §6). */\n readonly error?: WireError;\n /**\n * `true` while the source has no value and no failure and the artifact's latest version has a\n * producer whose first `load` is on its way: the page shows it loading, and verify waits for it.\n * Absent for a key nothing produces (one only `mostra push` writes) and for a source that only\n * streams, whose first value may never come (WP-14's Opus review).\n */\n readonly awaiting?: boolean;\n /**\n * `true` on a hosted page while the artifact's owner instance is offline, so its producers\n * can't refresh the value: the last value stays, with its `at` (D165 item 4).\n */\n readonly ownerOffline?: boolean;\n}\n\n/** One live update on the event stream: never stored as an event (D63, LL-04). */\nexport interface LiveUpdate {\n /** The live source's key. */\n readonly key: string;\n /** The value's revision. */\n readonly revision?: string;\n /** When the value was produced. */\n readonly at?: string;\n /** The value, serialized. */\n readonly value?: Batches;\n /** What went wrong. */\n readonly error?: WireError;\n /**\n * `false` when a source read as {@link LiveState.awaiting} turned out to have no first `load`\n * (its producer only streams): the page stops waiting for a first value.\n */\n readonly awaiting?: boolean;\n}\n\n/**\n * An ephemeral message on a page's event stream (SSE `event: run` or `event: live`, without an\n * `id`, so a reconnect's cursor is untouched) or in a poll's `ephemeral`: lossy, coalesced, and\n * never stored as an event.\n */\nexport type EphemeralMessage =\n | { readonly kind: \"run\"; readonly run: RunDelta }\n | { readonly kind: \"live\"; readonly live: LiveUpdate };\n\n/** `POST …/call/{fnId}`: a plain server-function call, no durable record (D54). */\nexport interface CallRequest {\n /** The view the page was opened as (D104). */\n readonly viewId: string;\n /** The arguments, serialized as one array value. */\n readonly args: Batches;\n}\n\n/** The Zod schema of the `CallRequest` type. */\nexport const CallRequest: z.ZodType<CallRequest> = z\n .object({ viewId: ViewId.schema, args: Batches })\n .register(wireRegistry, {\n id: \"CallRequest\",\n description: \"A plain server-function call: the view and the serialized arguments.\",\n });\n\n/**\n * One line of a plain call's answer (`application/x-ndjson`): a batch of the result, then the end.\n */\nexport type CallLine =\n | { readonly batch: readonly Frame[] }\n | { readonly end: { readonly status: \"succeeded\" } }\n | { readonly end: { readonly status: \"failed\"; readonly error: WireError } };\n\n/** `POST …/runs`: start a durable action run, or join one (D54, AC-02, AC-03). */\nexport interface RunRequest {\n /** The view the page was opened as (D104). */\n readonly viewId: string;\n /** `<module path>#<export>`. */\n readonly fnId: string;\n /** The arguments, serialized as one array value. */\n readonly args: Batches;\n /** The author's idempotency key: one run per artifact, function and key, ever. */\n readonly key?: string;\n /** A fresh ID per invocation, so a retried request joins the run it already started. */\n readonly clientKey: string;\n}\n\n/** The Zod schema of the `RunRequest` type. */\nexport const RunRequest: z.ZodType<RunRequest> = z\n .object({\n viewId: ViewId.schema,\n fnId: z.string().min(3).max(1024),\n args: Batches,\n key: z.string().min(1).max(RUN_KEY_MAX).exactOptional(),\n clientKey: z.string().min(8).max(64),\n })\n .register(wireRegistry, {\n id: \"RunRequest\",\n description: \"Start or join an action run: the function, its arguments and keys.\",\n });\n\n/**\n * `POST …/runs/attach`: read runs and hear their changes on the event stream for the next minute\n * (re-attach after a reload, AC-02). By ID, or by function and key.\n */\nexport interface RunAttachRequest {\n /** The view the page was opened as (D104). */\n readonly viewId: string;\n /** Runs by ID. */\n readonly runIds?: readonly string[];\n /** Runs by function and key. */\n readonly keyed?: readonly { readonly fnId: string; readonly key: string }[];\n /**\n * What the page already holds of runs it names by ID: so many log lines and batches. Each such\n * run's answer starts there (`RunState.logFrom`, `batchFrom`), so a page renewing its interest\n * doesn't read the whole run again (Opus review 14).\n */\n readonly held?: readonly {\n readonly runId: string;\n readonly log: number;\n readonly batches: number;\n }[];\n}\n\n/** The Zod schema of the `RunAttachRequest` type. */\nexport const RunAttachRequest: z.ZodType<RunAttachRequest> = z\n .object({\n viewId: ViewId.schema,\n runIds: z.array(z.string().max(64)).max(100).readonly().exactOptional(),\n keyed: z\n .array(\n z.object({ fnId: z.string().min(3).max(1024), key: z.string().min(1).max(RUN_KEY_MAX) }),\n )\n .max(100)\n .readonly()\n .exactOptional(),\n held: z\n .array(\n z.object({\n runId: z.string().max(64),\n log: z.number().int().nonnegative(),\n batches: z.number().int().nonnegative(),\n }),\n )\n .max(100)\n .readonly()\n .exactOptional(),\n })\n .register(wireRegistry, {\n id: \"RunAttachRequest\",\n description: \"Runs a page reads and follows: by ID, or by function and key.\",\n });\n\n/** `POST …/runs/{id}/cancel`. */\nexport interface RunCancelRequest {\n /** The view the page was opened as (D104). */\n readonly viewId: string;\n}\n\n/** The Zod schema of the `RunCancelRequest` type. */\nexport const RunCancelRequest: z.ZodType<RunCancelRequest> = z\n .object({ viewId: ViewId.schema })\n .register(wireRegistry, { id: \"RunCancelRequest\", description: \"Cancel a run, from a view.\" });\n\n/** The keys of live sources: like JavaScript export names, which is what `live.ts` declares. */\nexport const LIVE_KEY_PATTERN: RegExp = /^[A-Za-z_$][A-Za-z0-9_$]{0,127}$/;\n\n/**\n * The reserved live keys of tallies (D165 item 12, INTERFACES §18.4): `$tally/<field>` reads the\n * count by choice of a manifest `tally` entry. No producer or push writes one (their keys follow\n * {@link LIVE_KEY_PATTERN}); only a page reads them.\n */\nexport const TALLY_LIVE_PREFIX = \"$tally/\";\n\n/** The value of a tally's live key: the counts by choice, or only the total below `minTotal`. */\nexport interface TallyValue {\n /** Each listed choice's count, absent while fewer than `minTotal` answers were counted. */\n readonly counts?: Readonly<Record<string, number>>;\n /** How many answers were counted: answers, never people. */\n readonly total: number;\n}\n\n/** The keys a page may read: a source's ({@link LIVE_KEY_PATTERN}) or a tally's (`$tally/<field>`). */\nexport const READABLE_LIVE_KEY_PATTERN: RegExp =\n // biome-ignore lint/suspicious/noControlCharactersInRegex: control characters are what it refuses.\n /^(?:[A-Za-z_$][A-Za-z0-9_$]{0,127}$|\\$tally\\/[^\\u0000-\\u001f\\u007f]{1,256}$)/;\n\n/** The largest live value, in characters of serialized JSON (DATA_MODEL §5's 4 MiB). */\nexport const LIVE_VALUE_MAX: number = 4 * 1024 * 1024;\n\n/** The ring size of a pushed source in append mode that no `defineLive` sized. */\nexport const LIVE_RING_DEFAULT = 1024;\n\n/** The largest ring a source may keep. */\nexport const LIVE_RING_MAX = 100_000;\n\n/**\n * `POST …/live`: read live sources and keep their producers running for this view for the next\n * minute (D56, LL-04); a page asks again while it shows them.\n */\nexport interface LiveRequest {\n /** The view the page was opened as (D104). */\n readonly viewId: string;\n /**\n * The sources, each with its append window; `refresh` asks the source's producer to load again\n * now (`useLive`'s `refresh()`).\n */\n readonly keys: readonly {\n readonly key: string;\n readonly window?: number;\n readonly refresh?: boolean;\n }[];\n}\n\n/** The Zod schema of the `LiveRequest` type. */\nexport const LiveRequest: z.ZodType<LiveRequest> = z\n .object({\n viewId: ViewId.schema,\n keys: z\n .array(\n z.object({\n key: z.string().regex(READABLE_LIVE_KEY_PATTERN),\n window: z.int().min(1).max(LIVE_RING_MAX).exactOptional(),\n refresh: z.boolean().exactOptional(),\n }),\n )\n .max(256)\n .readonly(),\n })\n .register(wireRegistry, {\n id: \"LiveRequest\",\n description: \"Live sources a page reads and keeps running: keys and append windows.\",\n });\n\n/** Secret names: letters, digits, `_`, `.` and `-`, starting with a letter or `_` (D44). */\nexport const SECRET_NAME_PATTERN: RegExp = /^[A-Za-z_][A-Za-z0-9_.-]{0,127}$/;\n\n/** The largest secret value, in UTF-8 bytes. */\nexport const SECRET_VALUE_MAX: number = 64 * 1024;\n"],"mappings":";;;;;;;;;;;;;;;;;;AAsBA,MAAa,UAA8B,EACxC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAC5D,SAAS,CAAC,CACV,SAAS,cAAc;CACtB,IAAI;CACJ,aAAa;AACf,CAAC;;AASH,MAAa,cAAsC,EAChD,OAAO;CACN,SAAS,EAAE,OAAO;CAClB,MAAM,EAAE,OAAO,CAAC,CAAC,cAAc;CAC/B,OAAO,EAAE,OAAO,CAAC,CAAC,cAAc;AAClC,CAAC,CAAC,CACD,SAAS,cAAc;CACtB,IAAI;CACJ,aAAa;AAC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C,CAAC,CACH,CAAC,CACA,IAAI,GAAG,CAAC,CACR,SAAS,CAAC,CACV,cAAc;AACnB,CAAC,CAAC,CACD,SAAS,cAAc;CACtB,IAAI;CACJ,aAAa;AACf,CAAC;;AASH,MAAa,mBAAgD,EAC1D,OAAO,EAAE,QAAQ,OAAO,OAAO,CAAC,CAAC,CACjC,SAAS,cAAc;CAAE,IAAI;CAAoB,aAAa;AAA6B,CAAC;;AAG/F,MAAa,mBAA2B;;;;;;AAOxC,MAAa,oBAAoB;;AAWjC,MAAa,4BAEX;;AAGF,MAAa,iBAAyB;;AAGtC,MAAa,oBAAoB;;AAGjC,MAAa,gBAAgB;;AAqB7B,MAAa,cAAsC,EAChD,OAAO;CACN,QAAQ,OAAO;CACf,MAAM,EACH,MACC,EAAE,OAAO;EACP,KAAK,EAAE,OAAO,CAAC,CAAC,MAAM,yBAAyB;EAC/C,QAAQ,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,aAAa,CAAC,CAAC,cAAc;EACxD,SAAS,EAAE,QAAQ,CAAC,CAAC,cAAc;CACrC,CAAC,CACH,CAAC,CACA,IAAI,GAAG,CAAC,CACR,SAAS;AACd,CAAC,CAAC,CACD,SAAS,cAAc;CACtB,IAAI;CACJ,aAAa;AACf,CAAC;;AAGH,MAAa,sBAA8B;;AAG3C,MAAa,mBAA2B"}
1
+ {"version":3,"file":"actions.js","names":[],"sources":["../src/actions.ts"],"sourcesContent":["/**\n * Actions, live data and secrets (INTERFACES §2.4, §4, §6; D24, D44, D54, D56): the shapes the\n * browser protocol, the host protocol and the worker channel share. Server-function arguments and\n * results travel as the serializer's batches (`Batches`).\n *\n * ```ts\n * const run: RunState = await post(\"runs\", { viewId, fnId: \"actions.ts#sendReply\", args, clientKey });\n * if (run.status === \"succeeded\") show(await deserializeAll(run.batches));\n * ```\n */\nimport * as z from \"zod\";\nimport { ViewId } from \"./ids.ts\";\nimport type { Frame, WireError } from \"./serializer.ts\";\nimport type { PresenceState, RosterForPage } from \"./team.ts\";\nimport { wireRegistry } from \"./wire-registry.ts\";\n\n/** A value written by the serializer: its batches, in order (`serializeAll`). */\nexport type Batches = readonly (readonly Frame[])[];\n\n/**\n * The Zod schema of the `Batches` type: a list of batches, each a list of frames. The frames\n * themselves are checked by the reader (`ValueReader`), which refuses anything malformed.\n */\nexport const Batches: z.ZodType<Batches> = z\n .array(z.array(z.record(z.string(), z.unknown())).readonly())\n .readonly()\n .register(wireRegistry, {\n id: \"Batches\",\n description: \"A serialized server-function value: its batches of frames, in order.\",\n }) as unknown as z.ZodType<Batches>;\n\n/** An error as runs, calls and live sources report it. */\nexport interface ActionError extends WireError {\n /** The stack of the thrown error, kept in the run log and never sent to a page. */\n readonly stack?: string;\n}\n\n/** The Zod schema of the `ActionError` type. */\nexport const ActionError: z.ZodType<ActionError> = z\n .object({\n message: z.string(),\n code: z.string().exactOptional(),\n stack: z.string().exactOptional(),\n })\n .register(wireRegistry, {\n id: \"ActionError\",\n description: \"An error from server code: its message and diagnostic code.\",\n });\n\n/** The largest serialized arguments a call or run takes, in characters of JSON. */\nexport const ACTION_ARGS_MAX: number = 16 * 1024 * 1024;\n\n/** The largest serialized result a run keeps, in characters of JSON (larger fails the run). */\nexport const ACTION_RESULT_MAX: number = 16 * 1024 * 1024;\n\n/** The cap of a run's log, in UTF-16 code units of its lines (D47's 1 MB). */\nexport const RUN_LOG_MAX: number = 1024 * 1024;\n\n/** The line a capped log ends with. */\nexport const RUN_LOG_TRUNCATED = \"[log truncated at 1 MB]\";\n\n/** The longest run key, in characters. */\nexport const RUN_KEY_MAX = 256;\n\n/**\n * A run's state (D24, ARCHITECTURE §7). `queued`: recorded, not yet started in a worker.\n * `running`: started. `waiting`: a remote server's run that waits for its owner's instance (D165\n * item 4); a page that doesn't know it treats it like `queued`. `unknown`: a relayed run whose\n * owner never reported its end within the artifact's offline limit, which may have taken effect;\n * the owner's later report replaces it once. The others are final.\n */\nexport type RunStatus =\n | \"queued\"\n | \"running\"\n | \"waiting\"\n | \"succeeded\"\n | \"failed\"\n | \"cancelled\"\n | \"unknown\";\n\n/** Every run status. */\nexport const RUN_STATUSES: readonly RunStatus[] = [\n \"queued\",\n \"running\",\n \"waiting\",\n \"succeeded\",\n \"failed\",\n \"cancelled\",\n \"unknown\",\n];\n\n/** Whether a run in `status` has ended. */\nexport function isFinalRunStatus(status: RunStatus): boolean {\n return status === \"succeeded\" || status === \"failed\" || status === \"cancelled\";\n}\n\n/**\n * Why a run ended the way it did, beside its status: `interrupted` (its worker or the instance\n * stopped while it ran, D24), `threw` (the action threw), `unserializable` (its result is outside\n * the type set), `too-large`, `parked` (its artifact's worker keeps crashing), `cancelled` (by a\n * viewer), `unknown-function`. Later releases add reasons.\n */\nexport type RunReason = string;\n\n/** A run's progress, as the action last reported it. */\nexport interface RunProgress {\n /** From 0 to 1. */\n readonly fraction?: number;\n /** One short line for people. */\n readonly message?: string;\n}\n\n/** The Zod schema of the `RunProgress` type. */\nexport const RunProgress: z.ZodType<RunProgress> = z\n .object({\n fraction: z.number().min(0).max(1).exactOptional(),\n message: z.string().max(1000).exactOptional(),\n })\n .register(wireRegistry, {\n id: \"RunProgress\",\n description: \"A run's progress: fraction and message.\",\n });\n\n/**\n * One action run as a page reads it (D54): its state, progress, log and the result written so far.\n * A result that is an async iterable grows item by item while the run is `running`.\n */\nexport interface RunState {\n /** The run's `run_` ID. */\n readonly runId: string;\n /** The server function it runs: `<module path>#<export>`. */\n readonly fnId: string;\n /** The idempotency key it was started with, if any. */\n readonly key?: string;\n /** The run's state. */\n readonly status: RunStatus;\n /** Why it ended, for `failed` and `cancelled`. */\n readonly reason?: RunReason;\n /** Its latest progress. */\n readonly progress?: RunProgress;\n /** The log lines, capped at 1 MB with a marker line. */\n readonly log: readonly string[];\n /** The result's batches so far. */\n readonly batches: Batches;\n /** For `failed`: what went wrong, without the stack. */\n readonly error?: WireError;\n /** When it was recorded. */\n readonly startedAt: string;\n /** When it ended. */\n readonly finishedAt?: string;\n /** Whether this request joined a run that already existed (a key or a retried `clientKey`). */\n readonly joined?: boolean;\n /**\n * The index of the first line in `log`, when the request said which lines the page holds\n * (`RunAttachRequest.held`); absent: 0, the whole log.\n */\n readonly logFrom?: number;\n /** The index of the first batch in `batches`, as `logFrom`; absent: 0. */\n readonly batchFrom?: number;\n /**\n * On a remote server: the run is `running` on its owner's instance, which can't be reached now\n * (D165 item 4); it ends when the owner reports, or becomes `unknown` past the offline limit.\n */\n readonly ownerUnreachable?: boolean;\n}\n\n/** The Zod schema of the `RunState` type. */\nexport const RunState: z.ZodType<RunState> = z\n .object({\n runId: z.string(),\n fnId: z.string(),\n key: z.string().exactOptional(),\n status: z.enum(RUN_STATUSES as [RunStatus, ...RunStatus[]]),\n reason: z.string().exactOptional(),\n progress: RunProgress.exactOptional(),\n log: z.array(z.string()).readonly(),\n batches: Batches,\n error: z.object({ message: z.string(), code: z.string().exactOptional() }).exactOptional(),\n startedAt: z.string(),\n finishedAt: z.string().exactOptional(),\n joined: z.boolean().exactOptional(),\n logFrom: z.number().int().nonnegative().exactOptional(),\n batchFrom: z.number().int().nonnegative().exactOptional(),\n ownerUnreachable: z.boolean().exactOptional(),\n })\n .register(wireRegistry, {\n id: \"RunState\",\n description: \"An action run: status, progress, log and the result written so far.\",\n });\n\n/**\n * What changed in a run since a page last heard: a lossy notification on the event stream. Lines\n * start at `logFrom` and batches at `batchFrom`; a page that holds fewer reads the run again\n * (`runs/attach`).\n */\nexport interface RunDelta {\n /** The run's `run_` ID. */\n readonly runId: string;\n /** The run's state. */\n readonly status: RunStatus;\n /** Why it ended so, for `failed` and `cancelled`. */\n readonly reason?: RunReason;\n /** Its latest progress. */\n readonly progress?: RunProgress;\n /** The index of the first line in `log`. */\n readonly logFrom: number;\n /** Log lines, starting at `logFrom`. */\n readonly log: readonly string[];\n /** The index of the first batch in `batches`. */\n readonly batchFrom: number;\n /** Result batches, starting at `batchFrom`. */\n readonly batches: Batches;\n /** What went wrong. */\n readonly error?: WireError;\n /** When it ended. */\n readonly finishedAt?: string;\n}\n\n/** A live source's value as a page reads it (D56). */\nexport interface LiveState {\n /** The idempotency key it was started with, if any. */\n readonly key: string;\n /** The value's revision, a decimal string that only grows; absent before any value. */\n readonly revision?: string;\n /** When the value was produced. */\n readonly at?: string;\n /** The latest value, serialized. */\n readonly value?: Batches;\n /**\n * Append mode (`useLive(key, { mode: \"append\" })`): the values kept in the source's ring, oldest\n * first, at most the window the page asked for.\n */\n readonly ring?: readonly {\n readonly revision: string;\n readonly at: string;\n readonly value: Batches;\n }[];\n /** The producer's last failure, while the last good value stays (FAILURE_MODEL §6). */\n readonly error?: WireError;\n /**\n * `true` while the source has no value and no failure and the artifact's latest version has a\n * producer whose first `load` is on its way: the page shows it loading, and verify waits for it.\n * Absent for a key nothing produces (one only `mostra push` writes) and for a source that only\n * streams, whose first value may never come (WP-14's Opus review).\n */\n readonly awaiting?: boolean;\n /**\n * `true` on a hosted page while the artifact's owner instance is offline, so its producers\n * can't refresh the value: the last value stays, with its `at` (D165 item 4).\n */\n readonly ownerOffline?: boolean;\n}\n\n/** One live update on the event stream: never stored as an event (D63, LL-04). */\nexport interface LiveUpdate {\n /** The live source's key. */\n readonly key: string;\n /** The value's revision. */\n readonly revision?: string;\n /** When the value was produced. */\n readonly at?: string;\n /** The value, serialized. */\n readonly value?: Batches;\n /** What went wrong. */\n readonly error?: WireError;\n /**\n * `false` when a source read as {@link LiveState.awaiting} turned out to have no first `load`\n * (its producer only streams): the page stops waiting for a first value.\n */\n readonly awaiting?: boolean;\n}\n\n/**\n * An ephemeral message on a page's event stream (SSE `event: run`, `live`, `respondents` or\n * `presence`, without an `id`, so a reconnect's cursor is untouched) or in a poll's `ephemeral`:\n * lossy, coalesced, and never stored as an event. `respondents` and `presence` (D168) reach only a\n * page that asked for them, so a version built before them never receives one.\n */\nexport type EphemeralMessage =\n | { readonly kind: \"run\"; readonly run: RunDelta }\n | { readonly kind: \"live\"; readonly live: LiveUpdate }\n | { readonly kind: \"respondents\"; readonly respondents: RosterForPage }\n | { readonly kind: \"presence\"; readonly presence: PresenceState };\n\n/** `POST …/call/{fnId}`: a plain server-function call, no durable record (D54). */\nexport interface CallRequest {\n /** The view the page was opened as (D104). */\n readonly viewId: string;\n /** The arguments, serialized as one array value. */\n readonly args: Batches;\n}\n\n/** The Zod schema of the `CallRequest` type. */\nexport const CallRequest: z.ZodType<CallRequest> = z\n .object({ viewId: ViewId.schema, args: Batches })\n .register(wireRegistry, {\n id: \"CallRequest\",\n description: \"A plain server-function call: the view and the serialized arguments.\",\n });\n\n/**\n * One line of a plain call's answer (`application/x-ndjson`): a batch of the result, then the end.\n */\nexport type CallLine =\n | { readonly batch: readonly Frame[] }\n | { readonly end: { readonly status: \"succeeded\" } }\n | { readonly end: { readonly status: \"failed\"; readonly error: WireError } };\n\n/** `POST …/runs`: start a durable action run, or join one (D54, AC-02, AC-03). */\nexport interface RunRequest {\n /** The view the page was opened as (D104). */\n readonly viewId: string;\n /** `<module path>#<export>`. */\n readonly fnId: string;\n /** The arguments, serialized as one array value. */\n readonly args: Batches;\n /** The author's idempotency key: one run per artifact, function and key, ever. */\n readonly key?: string;\n /** A fresh ID per invocation, so a retried request joins the run it already started. */\n readonly clientKey: string;\n}\n\n/** The Zod schema of the `RunRequest` type. */\nexport const RunRequest: z.ZodType<RunRequest> = z\n .object({\n viewId: ViewId.schema,\n fnId: z.string().min(3).max(1024),\n args: Batches,\n key: z.string().min(1).max(RUN_KEY_MAX).exactOptional(),\n clientKey: z.string().min(8).max(64),\n })\n .register(wireRegistry, {\n id: \"RunRequest\",\n description: \"Start or join an action run: the function, its arguments and keys.\",\n });\n\n/**\n * `POST …/runs/attach`: read runs and hear their changes on the event stream for the next minute\n * (re-attach after a reload, AC-02). By ID, or by function and key.\n */\nexport interface RunAttachRequest {\n /** The view the page was opened as (D104). */\n readonly viewId: string;\n /** Runs by ID. */\n readonly runIds?: readonly string[];\n /** Runs by function and key. */\n readonly keyed?: readonly { readonly fnId: string; readonly key: string }[];\n /**\n * What the page already holds of runs it names by ID: so many log lines and batches. Each such\n * run's answer starts there (`RunState.logFrom`, `batchFrom`), so a page renewing its interest\n * doesn't read the whole run again (Opus review 14).\n */\n readonly held?: readonly {\n readonly runId: string;\n readonly log: number;\n readonly batches: number;\n }[];\n}\n\n/** The Zod schema of the `RunAttachRequest` type. */\nexport const RunAttachRequest: z.ZodType<RunAttachRequest> = z\n .object({\n viewId: ViewId.schema,\n runIds: z.array(z.string().max(64)).max(100).readonly().exactOptional(),\n keyed: z\n .array(\n z.object({ fnId: z.string().min(3).max(1024), key: z.string().min(1).max(RUN_KEY_MAX) }),\n )\n .max(100)\n .readonly()\n .exactOptional(),\n held: z\n .array(\n z.object({\n runId: z.string().max(64),\n log: z.number().int().nonnegative(),\n batches: z.number().int().nonnegative(),\n }),\n )\n .max(100)\n .readonly()\n .exactOptional(),\n })\n .register(wireRegistry, {\n id: \"RunAttachRequest\",\n description: \"Runs a page reads and follows: by ID, or by function and key.\",\n });\n\n/** `POST …/runs/{id}/cancel`. */\nexport interface RunCancelRequest {\n /** The view the page was opened as (D104). */\n readonly viewId: string;\n}\n\n/** The Zod schema of the `RunCancelRequest` type. */\nexport const RunCancelRequest: z.ZodType<RunCancelRequest> = z\n .object({ viewId: ViewId.schema })\n .register(wireRegistry, { id: \"RunCancelRequest\", description: \"Cancel a run, from a view.\" });\n\n/** The keys of live sources: like JavaScript export names, which is what `live.ts` declares. */\nexport const LIVE_KEY_PATTERN: RegExp = /^[A-Za-z_$][A-Za-z0-9_$]{0,127}$/;\n\n/**\n * The reserved live keys of tallies (D165 item 12, INTERFACES §18.4): `$tally/<field>` reads the\n * count by choice of a manifest `tally` entry. No producer or push writes one (their keys follow\n * {@link LIVE_KEY_PATTERN}); only a page reads them.\n */\nexport const TALLY_LIVE_PREFIX = \"$tally/\";\n\n/** The value of a tally's live key: the counts by choice, or only the total below `minTotal`. */\nexport interface TallyValue {\n /** Each listed choice's count, absent while fewer than `minTotal` answers were counted. */\n readonly counts?: Readonly<Record<string, number>>;\n /** How many answers were counted: answers, never people. */\n readonly total: number;\n}\n\n/** The keys a page may read: a source's ({@link LIVE_KEY_PATTERN}) or a tally's (`$tally/<field>`). */\nexport const READABLE_LIVE_KEY_PATTERN: RegExp =\n // biome-ignore lint/suspicious/noControlCharactersInRegex: control characters are what it refuses.\n /^(?:[A-Za-z_$][A-Za-z0-9_$]{0,127}$|\\$tally\\/[^\\u0000-\\u001f\\u007f]{1,256}$)/;\n\n/** The largest live value, in characters of serialized JSON (DATA_MODEL §5's 4 MiB). */\nexport const LIVE_VALUE_MAX: number = 4 * 1024 * 1024;\n\n/** The ring size of a pushed source in append mode that no `defineLive` sized. */\nexport const LIVE_RING_DEFAULT = 1024;\n\n/** The largest ring a source may keep. */\nexport const LIVE_RING_MAX = 100_000;\n\n/**\n * `POST …/live`: read live sources and keep their producers running for this view for the next\n * minute (D56, LL-04); a page asks again while it shows them.\n */\nexport interface LiveRequest {\n /** The view the page was opened as (D104). */\n readonly viewId: string;\n /**\n * The sources, each with its append window; `refresh` asks the source's producer to load again\n * now (`useLive`'s `refresh()`).\n */\n readonly keys: readonly {\n readonly key: string;\n readonly window?: number;\n readonly refresh?: boolean;\n }[];\n}\n\n/** The Zod schema of the `LiveRequest` type. */\nexport const LiveRequest: z.ZodType<LiveRequest> = z\n .object({\n viewId: ViewId.schema,\n keys: z\n .array(\n z.object({\n key: z.string().regex(READABLE_LIVE_KEY_PATTERN),\n window: z.int().min(1).max(LIVE_RING_MAX).exactOptional(),\n refresh: z.boolean().exactOptional(),\n }),\n )\n .max(256)\n .readonly(),\n })\n .register(wireRegistry, {\n id: \"LiveRequest\",\n description: \"Live sources a page reads and keeps running: keys and append windows.\",\n });\n\n/** Secret names: letters, digits, `_`, `.` and `-`, starting with a letter or `_` (D44). */\nexport const SECRET_NAME_PATTERN: RegExp = /^[A-Za-z_][A-Za-z0-9_.-]{0,127}$/;\n\n/** The largest secret value, in UTF-8 bytes. */\nexport const SECRET_VALUE_MAX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,aAAa;AACf,CAAC;;AAGH,MAAa,sBAA8B;;AAG3C,MAAa,mBAA2B"}
package/dist/browser.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { EphemeralMessage } from "./actions.js";
2
1
  import { DeliveryTarget, REVIEW_SET_ID_PATTERN, VersionRef, ViewContext, ViewContextWire, readViewContext } from "./view.js";
3
2
  import { DocumentRevision, EventRecord, FieldOp, FieldState, SubmissionSummary, Viewer } from "./interaction.js";
3
+ import { EphemeralMessage } from "./actions.js";
4
4
  import * as z from "zod";
5
5
  //#region src/browser.d.ts
6
6
  /** Every browser-protocol revision this release serves, oldest first. */
@@ -25,11 +25,12 @@ import { ShareDiagnosticCode, shareDiagnosticCodes } from "./share.js";
25
25
  import { SmokeDiagnosticCode, smokeDiagnosticCodes } from "./smoke.js";
26
26
  import { SubmitDiagnosticCode, submitDiagnosticCodes } from "./submit.js";
27
27
  import { TargetDiagnosticCode, targetDiagnosticCodes } from "./target.js";
28
+ import { TeamDiagnosticCode, teamDiagnosticCodes } from "./team.js";
28
29
  import { TypeDiagnosticCode, typeDiagnosticCodes } from "./type.js";
29
30
  import { VerifyDiagnosticCode, verifyDiagnosticCodes } from "./verify.js";
30
31
  //#region src/diagnostics/codes/index.d.ts
31
32
  /** Every code in the catalog. Codes are semver surface and are never removed (AX-03). */
32
- export type KnownDiagnosticCode = RemoteDiagnosticCode | 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;
33
+ export type KnownDiagnosticCode = TeamDiagnosticCode | RemoteDiagnosticCode | 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;
33
34
  /** Every cataloged code with its severity, phase, title, default hint and docs text. */
34
35
  export declare const diagnosticCatalog: Readonly<Record<KnownDiagnosticCode, DiagnosticSpec>>;
35
36
  /** Options for {@link createDiagnostic}. */
@@ -49,5 +50,5 @@ export interface CreateDiagnosticOptions {
49
50
  */
50
51
  export declare function createDiagnostic(code: KnownDiagnosticCode, details: DiagnosticDetails, options?: CreateDiagnosticOptions): Diagnostic;
51
52
  //#endregion
52
- 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 RemoteDiagnosticCode, 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, remoteDiagnosticCodes, runtimeDiagnosticCodes, secretDiagnosticCodes, shareDiagnosticCodes, smokeDiagnosticCodes, submitDiagnosticCodes, targetDiagnosticCodes, typeDiagnosticCodes, verifyDiagnosticCodes };
53
+ 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 RemoteDiagnosticCode, type RuntimeDiagnosticCode, type SecretDiagnosticCode, type ShareDiagnosticCode, type SmokeDiagnosticCode, type SubmitDiagnosticCode, type TargetDiagnosticCode, type TeamDiagnosticCode, type TypeDiagnosticCode, type VerifyDiagnosticCode, a11yDiagnosticCodes, actionDiagnosticCodes, artifactDiagnosticCodes, buildDiagnosticCodes, cliDiagnosticCodes, consoleDiagnosticCodes, depDiagnosticCodes, envDiagnosticCodes, fieldDiagnosticCodes, homeDiagnosticCodes, hostDiagnosticCodes, hygieneDiagnosticCodes, liveDiagnosticCodes, manifestDiagnosticCodes, networkDiagnosticCodes, platformDiagnosticCodes, publishDiagnosticCodes, regressionDiagnosticCodes, remoteDiagnosticCodes, runtimeDiagnosticCodes, secretDiagnosticCodes, shareDiagnosticCodes, smokeDiagnosticCodes, submitDiagnosticCodes, targetDiagnosticCodes, teamDiagnosticCodes, typeDiagnosticCodes, verifyDiagnosticCodes };
53
54
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../../../src/diagnostics/codes/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAiEY,sBAER,uBACA,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;;iBAgCpD;;WAEN;;;;;;;;;;;;wBAaK,iBACd,MAAM,qBACN,SAAS,mBACT,UAAS,0BACR"}
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../../../src/diagnostics/codes/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAmEY,sBAER,qBACA,uBACA,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;;iBAiCpD;;WAEN;;;;;;;;;;;;wBAaK,iBACd,MAAM,qBACN,SAAS,mBACT,UAAS,0BACR"}
@@ -24,11 +24,13 @@ import { shareDiagnosticCodes, shareDiagnostics } from "./share.js";
24
24
  import { smokeDiagnosticCodes, smokeDiagnostics } from "./smoke.js";
25
25
  import { submitDiagnosticCodes, submitDiagnostics } from "./submit.js";
26
26
  import { targetDiagnosticCodes, targetDiagnostics } from "./target.js";
27
+ import { teamDiagnosticCodes, teamDiagnostics } from "./team.js";
27
28
  import { typeDiagnosticCodes, typeDiagnostics } from "./type.js";
28
29
  import { verifyDiagnosticCodes, verifyDiagnostics } from "./verify.js";
29
30
  //#region src/diagnostics/codes/index.ts
30
31
  /** Every cataloged code with its severity, phase, title, default hint and docs text. */
31
32
  const diagnosticCatalog = {
33
+ ...teamDiagnostics,
32
34
  ...remoteDiagnostics,
33
35
  ...shareDiagnostics,
34
36
  ...cliDiagnostics,
@@ -71,6 +73,6 @@ function createDiagnostic(code, details, options = {}) {
71
73
  return buildDiagnostic(code, diagnosticCatalog[code], details, options.docsBase);
72
74
  }
73
75
  //#endregion
74
- export { a11yDiagnosticCodes, actionDiagnosticCodes, artifactDiagnosticCodes, buildDiagnosticCodes, cliDiagnosticCodes, consoleDiagnosticCodes, createDiagnostic, depDiagnosticCodes, diagnosticCatalog, envDiagnosticCodes, fieldDiagnosticCodes, homeDiagnosticCodes, hostDiagnosticCodes, hygieneDiagnosticCodes, liveDiagnosticCodes, manifestDiagnosticCodes, networkDiagnosticCodes, platformDiagnosticCodes, publishDiagnosticCodes, regressionDiagnosticCodes, remoteDiagnosticCodes, runtimeDiagnosticCodes, secretDiagnosticCodes, shareDiagnosticCodes, smokeDiagnosticCodes, submitDiagnosticCodes, targetDiagnosticCodes, typeDiagnosticCodes, verifyDiagnosticCodes };
76
+ export { a11yDiagnosticCodes, actionDiagnosticCodes, artifactDiagnosticCodes, buildDiagnosticCodes, cliDiagnosticCodes, consoleDiagnosticCodes, createDiagnostic, depDiagnosticCodes, diagnosticCatalog, envDiagnosticCodes, fieldDiagnosticCodes, homeDiagnosticCodes, hostDiagnosticCodes, hygieneDiagnosticCodes, liveDiagnosticCodes, manifestDiagnosticCodes, networkDiagnosticCodes, platformDiagnosticCodes, publishDiagnosticCodes, regressionDiagnosticCodes, remoteDiagnosticCodes, runtimeDiagnosticCodes, secretDiagnosticCodes, shareDiagnosticCodes, smokeDiagnosticCodes, submitDiagnosticCodes, targetDiagnosticCodes, teamDiagnosticCodes, typeDiagnosticCodes, verifyDiagnosticCodes };
75
77
 
76
78
  //# 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\";\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\";\n// gen:area-imports\nimport { type RemoteDiagnosticCode, remoteDiagnostics } from \"./remote.ts\";\nimport { type RuntimeDiagnosticCode, runtimeDiagnostics } from \"./runtime.ts\";\nimport { type SecretDiagnosticCode, secretDiagnostics } from \"./secret.ts\";\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\";\n// gen:area-exports\nexport { type RemoteDiagnosticCode, remoteDiagnosticCodes } from \"./remote.ts\";\nexport { type RuntimeDiagnosticCode, runtimeDiagnosticCodes } from \"./runtime.ts\";\nexport { type SecretDiagnosticCode, secretDiagnosticCodes } from \"./secret.ts\";\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 | RemoteDiagnosticCode\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 ...remoteDiagnostics,\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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgGA,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;CACH,GAAG;AACL;;;;;;;;;;;AAkBA,SAAgB,iBACd,MACA,SACA,UAAmC,CAAC,GACxB;CACZ,OAAO,gBAAgB,MAAM,kBAAkB,OAAO,SAAS,QAAQ,QAAQ;AACjF"}
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 RemoteDiagnosticCode, remoteDiagnostics } from \"./remote.ts\";\nimport { type RuntimeDiagnosticCode, runtimeDiagnostics } from \"./runtime.ts\";\nimport { type SecretDiagnosticCode, secretDiagnostics } from \"./secret.ts\";\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\";\n// gen:area-imports\nimport { type TeamDiagnosticCode, teamDiagnostics } from \"./team.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 RemoteDiagnosticCode, remoteDiagnosticCodes } from \"./remote.ts\";\nexport { type RuntimeDiagnosticCode, runtimeDiagnosticCodes } from \"./runtime.ts\";\nexport { type SecretDiagnosticCode, secretDiagnosticCodes } from \"./secret.ts\";\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\";\n// gen:area-exports\nexport { type TeamDiagnosticCode, teamDiagnosticCodes } from \"./team.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 | TeamDiagnosticCode\n | RemoteDiagnosticCode\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 ...teamDiagnostics,\n ...remoteDiagnostics,\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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmGA,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;CACH,GAAG;CACH,GAAG;AACL;;;;;;;;;;;AAkBA,SAAgB,iBACd,MACA,SACA,UAAmC,CAAC,GACxB;CACZ,OAAO,gBAAgB,MAAM,kBAAkB,OAAO,SAAS,QAAQ,QAAQ;AACjF"}
@@ -65,8 +65,8 @@ const remoteDiagnostics = {
65
65
  title: "Too many runs wait for the owner",
66
66
  hint: "Wait for the owner to come back and work through its queue, then press again.",
67
67
  docs: {
68
- explanation: "The artifact's owner instance is offline and as many runs as the server allows already wait for it, so this one was refused before anything was recorded. Runs already waiting keep their place.",
69
- fix: "Bring the owner instance back online: waiting runs then go out in the order they were made. The cap is the server's `relay.waitingRunsPerArtifact` setting."
68
+ explanation: "The artifact's owner instance is offline and as many runs as the server allows already wait for it, or the server's operator allows no more waiting runs for this account now (its `limits` port, `run.wait`, whose message is the operator's own), so this one was refused before anything was recorded. Runs already waiting keep their place.",
69
+ fix: "Bring the owner instance back online: waiting runs then go out in the order they were made. The cap is the server's `relay.waitingRunsPerArtifact` setting, or the operator's limit its message names; its `Retry-After`, when present, says when to try again."
70
70
  }
71
71
  },
72
72
  MOSTRA_REMOTE_NOT_OWNER_INSTANCE: {
@@ -1 +1 @@
1
- {"version":3,"file":"remote.js","names":[],"sources":["../../../src/diagnostics/codes/remote.ts"],"sourcesContent":["/**\n * Diagnostic codes of the REMOTE area.\n */\nimport type { AreaCatalog } from \"../spec.ts\";\n\n/** The codes of the REMOTE area, in the order they were added. */\nexport const remoteDiagnosticCodes = [\n \"MOSTRA_REMOTE_CONFIG_INVALID\",\n \"MOSTRA_REMOTE_LOGIN_FAILED\",\n \"MOSTRA_REMOTE_UNREACHABLE\",\n \"MOSTRA_REMOTE_OWNER_OFFLINE\",\n \"MOSTRA_REMOTE_QUEUE_FULL\",\n \"MOSTRA_REMOTE_NOT_OWNER_INSTANCE\",\n \"MOSTRA_REMOTE_SIGN_IN_REQUIRED\",\n \"MOSTRA_REMOTE_RATE_LIMITED\",\n \"MOSTRA_REMOTE_PAUSED_BY_OPERATOR\",\n \"MOSTRA_REMOTE_LIMIT_REACHED\",\n \"MOSTRA_REMOTE_OPERATOR_UNAVAILABLE\",\n \"MOSTRA_REMOTE_NO_INSTANCE\",\n \"MOSTRA_REMOTE_UNDER_REVIEW\",\n \"MOSTRA_REMOTE_HOME_SUSPENDED\",\n \"MOSTRA_REMOTE_HOME_MOVING\",\n // gen:codes\n] as const;\n\n/** The codes of the REMOTE area. */\nexport type RemoteDiagnosticCode = (typeof remoteDiagnosticCodes)[number];\n\n/** The REMOTE area's catalog entries. */\nexport const remoteDiagnostics: AreaCatalog<RemoteDiagnosticCode> = {\n MOSTRA_REMOTE_CONFIG_INVALID: {\n severity: \"error\",\n phase: \"host\",\n title: \"Remote server configuration can't be used\",\n hint: \"Fix the configuration key the message names, then start mostra-runtime server again.\",\n docs: {\n explanation:\n \"`mostra-runtime server` reads its configuration (the file `--config` names and `MOSTRA_SERVER_*` variables) before it serves anything, and stops when a key is missing, of the wrong type or out of range, naming the key. Nothing was served.\",\n fix: \"Correct the key the message names: `apiOrigin` must be an `https:` origin (or `http:` on loopback), and `domains.active` a host name.\",\n },\n },\n MOSTRA_REMOTE_LOGIN_FAILED: {\n severity: \"error\",\n phase: \"host\",\n title: \"Signing in to a remote server failed\",\n hint: \"Run mostra login again, and approve the code on the server's page within ten minutes.\",\n docs: {\n explanation:\n \"Signing this home in to a remote server didn't finish: the code expired, the person refused it, the server refused the client, or the binding's access token was refused (revoked, expired, or for another server). Nothing of the home changed; artifacts it owns on that server stay its own.\",\n fix: \"Sign in to the server again and approve the code on the page it names. A refusal you didn't expect means the sign-in was revoked on the server.\",\n },\n },\n MOSTRA_REMOTE_UNREACHABLE: {\n severity: \"error\",\n phase: \"host\",\n title: \"The remote server can't be reached\",\n hint: \"Check the network and the server's address, then try again; mostra status shows the link.\",\n docs: {\n explanation:\n \"The owner instance couldn't reach the remote server that holds this hosted artifact, so a write that must go there (its artifact state, a live value) was refused, never applied locally alone (D165 item 1). Nothing was lost: a page's edit stays in its journal and is sent again.\",\n fix: \"Run `mostra status` to see each server's link. When the server is back the link reconnects by itself; then write again.\",\n },\n },\n MOSTRA_REMOTE_OWNER_OFFLINE: {\n severity: \"error\",\n phase: \"host\",\n title: \"The artifact's owner instance is offline\",\n hint: \"Start Mostra on the machine that shared the page, or try again once it is back.\",\n docs: {\n explanation:\n \"A hosted page called server code its owner instance runs, and the owner instance isn't connected. A plain call isn't kept, so it is refused at once; an action run waits or fails as the artifact's `hosted.offline` says.\",\n fix: 'Start Mostra on the owner\\'s machine (`mostra daemon start`, or `mostra daemon install` for always-on). An action that must work while the owner is away should be an action run with `hosted.offline.actions: \"queue\"`.',\n },\n },\n MOSTRA_REMOTE_QUEUE_FULL: {\n severity: \"error\",\n phase: \"host\",\n title: \"Too many runs wait for the owner\",\n hint: \"Wait for the owner to come back and work through its queue, then press again.\",\n docs: {\n explanation:\n \"The artifact's owner instance is offline and as many runs as the server allows already wait for it, so this one was refused before anything was recorded. Runs already waiting keep their place.\",\n fix: \"Bring the owner instance back online: waiting runs then go out in the order they were made. The cap is the server's `relay.waitingRunsPerArtifact` setting.\",\n },\n },\n MOSTRA_REMOTE_NOT_OWNER_INSTANCE: {\n severity: \"error\",\n phase: \"host\",\n title: \"Another instance owns this hosted artifact\",\n hint: \"Share or push this artifact from its owner instance, named in the message.\",\n docs: {\n explanation:\n \"A hosted artifact has one owner instance: the one that shared it. It alone receives the artifact's submissions, relayed runs and authoring, and only it pushes versions of it (D165 item 1b). Another instance of the same account reads and waits through the hosted home.\",\n fix: \"Run the command on the instance the message names. Moving an artifact to another owner instance isn't part of this release.\",\n },\n },\n MOSTRA_REMOTE_SIGN_IN_REQUIRED: {\n severity: \"error\",\n phase: \"host\",\n title: \"This action needs a signed-in viewer\",\n hint: \"Sign in from the page's chrome, or have the owner allow this for anyone with the link.\",\n docs: {\n explanation:\n \"On a hosted link, an action that runs on the owner's machine, or a submission when the artifact asks for it, needs a viewer signed in (D159, D165 item 13). Nothing was recorded.\",\n fix: 'Sign in with the page\\'s Sign in. An owner who wants anyone with the link to run actions sets `hosted: { actions: \"link\" }` in the manifest (and `submissions: \"link\"` for answers).',\n },\n },\n MOSTRA_REMOTE_RATE_LIMITED: {\n severity: \"error\",\n phase: \"host\",\n title: \"Too many requests on this link\",\n hint: \"Try again after the time the answer's Retry-After gives.\",\n docs: {\n explanation:\n \"Too many requests of this kind came through one link or one address in a short time, past the server's `rateLimits`. Nothing was recorded, and a draft stays as it was.\",\n fix: \"Wait for the `Retry-After` the answer carries and try again. The limits are the server's `rateLimits` settings.\",\n },\n },\n MOSTRA_REMOTE_PAUSED_BY_OPERATOR: {\n severity: \"error\",\n phase: \"host\",\n title: \"Paused by the server's operator\",\n hint: \"Contact the server's operator: only the operator resumes a pause it made.\",\n docs: {\n explanation:\n \"The server's operator paused this hosted artifact, and an owner can't undo an operator's pause (D165 item 14). Views keep working and the links stay valid.\",\n fix: \"Ask the server's operator why it was paused and to resume it.\",\n },\n },\n MOSTRA_REMOTE_LIMIT_REACHED: {\n severity: \"error\",\n phase: \"host\",\n title: \"The server's limit refused this\",\n hint: \"Read the message for the server's limit, and try again once it allows the operation.\",\n docs: {\n explanation:\n \"The server's operator refused the operation for this account (its `limits` port): a share, a version push, a link, a view, a submission, an action or an MCP call. The message is the operator's own. A refused submission keeps its draft.\",\n fix: \"Follow the operator's message; its `Retry-After`, when present, says when to try again.\",\n },\n },\n MOSTRA_REMOTE_OPERATOR_UNAVAILABLE: {\n severity: \"error\",\n phase: \"host\",\n title: \"The server's operator didn't answer\",\n hint: \"Try again in a moment; the server's operator didn't answer in time.\",\n docs: {\n explanation:\n \"The server's operator module didn't answer in time (2 s for limits, 5 s for sign-in), so an operation that creates something (a share, a push, a link, authoring, a sign-in) was refused rather than allowed blind. Views, drafts and submissions never wait for it, and existing sessions keep working.\",\n fix: \"Try again; if it lasts, the server's operator has to fix its operator module.\",\n },\n },\n MOSTRA_REMOTE_NO_INSTANCE: {\n severity: \"error\",\n phase: \"host\",\n title: \"No owner instance connected\",\n hint: \"Start Mostra on the machine linked to this account (mostra daemon start), then try again.\",\n docs: {\n explanation:\n \"Creating, verifying and publishing from a chat host run on the account's default owner instance, through the relay (D165 item 5), and no default instance is connected to the server now. Reading tools (list, wait, results, state, docs, open) keep working.\",\n fix: \"Start Mostra on the linked machine (`mostra daemon start`, or `mostra daemon install` to keep it running); link a machine first with `mostra login <server> --default`.\",\n },\n },\n MOSTRA_REMOTE_UNDER_REVIEW: {\n severity: \"error\",\n phase: \"host\",\n title: \"This page is under review\",\n hint: \"Nothing to do here: the server's operator is reviewing this page.\",\n docs: {\n explanation:\n \"The server's operator quarantined this hosted page, or this version of it, while it reviews it. Its data is kept; the page shows a neutral notice instead of its content until the operator releases it.\",\n fix: \"The owner can ask the server's operator about the review.\",\n },\n },\n MOSTRA_REMOTE_HOME_SUSPENDED: {\n severity: \"error\",\n phase: \"host\",\n title: \"This account's pages are suspended\",\n hint: \"Contact the server's operator: this account's pages are suspended.\",\n docs: {\n explanation:\n \"The server's operator suspended this account's hosted home: its pages, its owner instances' bindings, pushes and links are refused until the operator resumes it. Nothing was deleted.\",\n fix: \"Ask the server's operator to resume the account.\",\n },\n },\n MOSTRA_REMOTE_HOME_MOVING: {\n severity: \"error\",\n phase: \"host\",\n title: \"This account's pages are moving\",\n hint: \"Try again in a minute: this account's pages are moving between machines.\",\n docs: {\n explanation:\n \"The server's operator is moving this account's hosted home to another data directory (`drainHome`), so the home is closed here until it serves again. Clients retry; nothing is lost.\",\n fix: \"Retry shortly; the move ends when the operator releases the home on its new machine.\",\n },\n },\n // gen:entries\n};\n"],"mappings":";;AAMA,MAAa,wBAAwB;CACnC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AAEF;;AAMA,MAAa,oBAAuD;CAClE,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,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,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,4BAA4B;EAC1B,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,6BAA6B;EAC3B,UAAU;EACV,OAAO;EACP,OAAO;EACP,MAAM;EACN,MAAM;GACJ,aACE;GACF,KAAK;EACP;CACF;CACA,oCAAoC;EAClC,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,4BAA4B;EAC1B,UAAU;EACV,OAAO;EACP,OAAO;EACP,MAAM;EACN,MAAM;GACJ,aACE;GACF,KAAK;EACP;CACF;CACA,8BAA8B;EAC5B,UAAU;EACV,OAAO;EACP,OAAO;EACP,MAAM;EACN,MAAM;GACJ,aACE;GACF,KAAK;EACP;CACF;CACA,2BAA2B;EACzB,UAAU;EACV,OAAO;EACP,OAAO;EACP,MAAM;EACN,MAAM;GACJ,aACE;GACF,KAAK;EACP;CACF;AAEF"}
1
+ {"version":3,"file":"remote.js","names":[],"sources":["../../../src/diagnostics/codes/remote.ts"],"sourcesContent":["/**\n * Diagnostic codes of the REMOTE area.\n */\nimport type { AreaCatalog } from \"../spec.ts\";\n\n/** The codes of the REMOTE area, in the order they were added. */\nexport const remoteDiagnosticCodes = [\n \"MOSTRA_REMOTE_CONFIG_INVALID\",\n \"MOSTRA_REMOTE_LOGIN_FAILED\",\n \"MOSTRA_REMOTE_UNREACHABLE\",\n \"MOSTRA_REMOTE_OWNER_OFFLINE\",\n \"MOSTRA_REMOTE_QUEUE_FULL\",\n \"MOSTRA_REMOTE_NOT_OWNER_INSTANCE\",\n \"MOSTRA_REMOTE_SIGN_IN_REQUIRED\",\n \"MOSTRA_REMOTE_RATE_LIMITED\",\n \"MOSTRA_REMOTE_PAUSED_BY_OPERATOR\",\n \"MOSTRA_REMOTE_LIMIT_REACHED\",\n \"MOSTRA_REMOTE_OPERATOR_UNAVAILABLE\",\n \"MOSTRA_REMOTE_NO_INSTANCE\",\n \"MOSTRA_REMOTE_UNDER_REVIEW\",\n \"MOSTRA_REMOTE_HOME_SUSPENDED\",\n \"MOSTRA_REMOTE_HOME_MOVING\",\n // gen:codes\n] as const;\n\n/** The codes of the REMOTE area. */\nexport type RemoteDiagnosticCode = (typeof remoteDiagnosticCodes)[number];\n\n/** The REMOTE area's catalog entries. */\nexport const remoteDiagnostics: AreaCatalog<RemoteDiagnosticCode> = {\n MOSTRA_REMOTE_CONFIG_INVALID: {\n severity: \"error\",\n phase: \"host\",\n title: \"Remote server configuration can't be used\",\n hint: \"Fix the configuration key the message names, then start mostra-runtime server again.\",\n docs: {\n explanation:\n \"`mostra-runtime server` reads its configuration (the file `--config` names and `MOSTRA_SERVER_*` variables) before it serves anything, and stops when a key is missing, of the wrong type or out of range, naming the key. Nothing was served.\",\n fix: \"Correct the key the message names: `apiOrigin` must be an `https:` origin (or `http:` on loopback), and `domains.active` a host name.\",\n },\n },\n MOSTRA_REMOTE_LOGIN_FAILED: {\n severity: \"error\",\n phase: \"host\",\n title: \"Signing in to a remote server failed\",\n hint: \"Run mostra login again, and approve the code on the server's page within ten minutes.\",\n docs: {\n explanation:\n \"Signing this home in to a remote server didn't finish: the code expired, the person refused it, the server refused the client, or the binding's access token was refused (revoked, expired, or for another server). Nothing of the home changed; artifacts it owns on that server stay its own.\",\n fix: \"Sign in to the server again and approve the code on the page it names. A refusal you didn't expect means the sign-in was revoked on the server.\",\n },\n },\n MOSTRA_REMOTE_UNREACHABLE: {\n severity: \"error\",\n phase: \"host\",\n title: \"The remote server can't be reached\",\n hint: \"Check the network and the server's address, then try again; mostra status shows the link.\",\n docs: {\n explanation:\n \"The owner instance couldn't reach the remote server that holds this hosted artifact, so a write that must go there (its artifact state, a live value) was refused, never applied locally alone (D165 item 1). Nothing was lost: a page's edit stays in its journal and is sent again.\",\n fix: \"Run `mostra status` to see each server's link. When the server is back the link reconnects by itself; then write again.\",\n },\n },\n MOSTRA_REMOTE_OWNER_OFFLINE: {\n severity: \"error\",\n phase: \"host\",\n title: \"The artifact's owner instance is offline\",\n hint: \"Start Mostra on the machine that shared the page, or try again once it is back.\",\n docs: {\n explanation:\n \"A hosted page called server code its owner instance runs, and the owner instance isn't connected. A plain call isn't kept, so it is refused at once; an action run waits or fails as the artifact's `hosted.offline` says.\",\n fix: 'Start Mostra on the owner\\'s machine (`mostra daemon start`, or `mostra daemon install` for always-on). An action that must work while the owner is away should be an action run with `hosted.offline.actions: \"queue\"`.',\n },\n },\n MOSTRA_REMOTE_QUEUE_FULL: {\n severity: \"error\",\n phase: \"host\",\n title: \"Too many runs wait for the owner\",\n hint: \"Wait for the owner to come back and work through its queue, then press again.\",\n docs: {\n explanation:\n \"The artifact's owner instance is offline and as many runs as the server allows already wait for it, or the server's operator allows no more waiting runs for this account now (its `limits` port, `run.wait`, whose message is the operator's own), so this one was refused before anything was recorded. Runs already waiting keep their place.\",\n fix: \"Bring the owner instance back online: waiting runs then go out in the order they were made. The cap is the server's `relay.waitingRunsPerArtifact` setting, or the operator's limit its message names; its `Retry-After`, when present, says when to try again.\",\n },\n },\n MOSTRA_REMOTE_NOT_OWNER_INSTANCE: {\n severity: \"error\",\n phase: \"host\",\n title: \"Another instance owns this hosted artifact\",\n hint: \"Share or push this artifact from its owner instance, named in the message.\",\n docs: {\n explanation:\n \"A hosted artifact has one owner instance: the one that shared it. It alone receives the artifact's submissions, relayed runs and authoring, and only it pushes versions of it (D165 item 1b). Another instance of the same account reads and waits through the hosted home.\",\n fix: \"Run the command on the instance the message names. Moving an artifact to another owner instance isn't part of this release.\",\n },\n },\n MOSTRA_REMOTE_SIGN_IN_REQUIRED: {\n severity: \"error\",\n phase: \"host\",\n title: \"This action needs a signed-in viewer\",\n hint: \"Sign in from the page's chrome, or have the owner allow this for anyone with the link.\",\n docs: {\n explanation:\n \"On a hosted link, an action that runs on the owner's machine, or a submission when the artifact asks for it, needs a viewer signed in (D159, D165 item 13). Nothing was recorded.\",\n fix: 'Sign in with the page\\'s Sign in. An owner who wants anyone with the link to run actions sets `hosted: { actions: \"link\" }` in the manifest (and `submissions: \"link\"` for answers).',\n },\n },\n MOSTRA_REMOTE_RATE_LIMITED: {\n severity: \"error\",\n phase: \"host\",\n title: \"Too many requests on this link\",\n hint: \"Try again after the time the answer's Retry-After gives.\",\n docs: {\n explanation:\n \"Too many requests of this kind came through one link or one address in a short time, past the server's `rateLimits`. Nothing was recorded, and a draft stays as it was.\",\n fix: \"Wait for the `Retry-After` the answer carries and try again. The limits are the server's `rateLimits` settings.\",\n },\n },\n MOSTRA_REMOTE_PAUSED_BY_OPERATOR: {\n severity: \"error\",\n phase: \"host\",\n title: \"Paused by the server's operator\",\n hint: \"Contact the server's operator: only the operator resumes a pause it made.\",\n docs: {\n explanation:\n \"The server's operator paused this hosted artifact, and an owner can't undo an operator's pause (D165 item 14). Views keep working and the links stay valid.\",\n fix: \"Ask the server's operator why it was paused and to resume it.\",\n },\n },\n MOSTRA_REMOTE_LIMIT_REACHED: {\n severity: \"error\",\n phase: \"host\",\n title: \"The server's limit refused this\",\n hint: \"Read the message for the server's limit, and try again once it allows the operation.\",\n docs: {\n explanation:\n \"The server's operator refused the operation for this account (its `limits` port): a share, a version push, a link, a view, a submission, an action or an MCP call. The message is the operator's own. A refused submission keeps its draft.\",\n fix: \"Follow the operator's message; its `Retry-After`, when present, says when to try again.\",\n },\n },\n MOSTRA_REMOTE_OPERATOR_UNAVAILABLE: {\n severity: \"error\",\n phase: \"host\",\n title: \"The server's operator didn't answer\",\n hint: \"Try again in a moment; the server's operator didn't answer in time.\",\n docs: {\n explanation:\n \"The server's operator module didn't answer in time (2 s for limits, 5 s for sign-in), so an operation that creates something (a share, a push, a link, authoring, a sign-in) was refused rather than allowed blind. Views, drafts and submissions never wait for it, and existing sessions keep working.\",\n fix: \"Try again; if it lasts, the server's operator has to fix its operator module.\",\n },\n },\n MOSTRA_REMOTE_NO_INSTANCE: {\n severity: \"error\",\n phase: \"host\",\n title: \"No owner instance connected\",\n hint: \"Start Mostra on the machine linked to this account (mostra daemon start), then try again.\",\n docs: {\n explanation:\n \"Creating, verifying and publishing from a chat host run on the account's default owner instance, through the relay (D165 item 5), and no default instance is connected to the server now. Reading tools (list, wait, results, state, docs, open) keep working.\",\n fix: \"Start Mostra on the linked machine (`mostra daemon start`, or `mostra daemon install` to keep it running); link a machine first with `mostra login <server> --default`.\",\n },\n },\n MOSTRA_REMOTE_UNDER_REVIEW: {\n severity: \"error\",\n phase: \"host\",\n title: \"This page is under review\",\n hint: \"Nothing to do here: the server's operator is reviewing this page.\",\n docs: {\n explanation:\n \"The server's operator quarantined this hosted page, or this version of it, while it reviews it. Its data is kept; the page shows a neutral notice instead of its content until the operator releases it.\",\n fix: \"The owner can ask the server's operator about the review.\",\n },\n },\n MOSTRA_REMOTE_HOME_SUSPENDED: {\n severity: \"error\",\n phase: \"host\",\n title: \"This account's pages are suspended\",\n hint: \"Contact the server's operator: this account's pages are suspended.\",\n docs: {\n explanation:\n \"The server's operator suspended this account's hosted home: its pages, its owner instances' bindings, pushes and links are refused until the operator resumes it. Nothing was deleted.\",\n fix: \"Ask the server's operator to resume the account.\",\n },\n },\n MOSTRA_REMOTE_HOME_MOVING: {\n severity: \"error\",\n phase: \"host\",\n title: \"This account's pages are moving\",\n hint: \"Try again in a minute: this account's pages are moving between machines.\",\n docs: {\n explanation:\n \"The server's operator is moving this account's hosted home to another data directory (`drainHome`), so the home is closed here until it serves again. Clients retry; nothing is lost.\",\n fix: \"Retry shortly; the move ends when the operator releases the home on its new machine.\",\n },\n },\n // gen:entries\n};\n"],"mappings":";;AAMA,MAAa,wBAAwB;CACnC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AAEF;;AAMA,MAAa,oBAAuD;CAClE,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,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,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,4BAA4B;EAC1B,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,6BAA6B;EAC3B,UAAU;EACV,OAAO;EACP,OAAO;EACP,MAAM;EACN,MAAM;GACJ,aACE;GACF,KAAK;EACP;CACF;CACA,oCAAoC;EAClC,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,4BAA4B;EAC1B,UAAU;EACV,OAAO;EACP,OAAO;EACP,MAAM;EACN,MAAM;GACJ,aACE;GACF,KAAK;EACP;CACF;CACA,8BAA8B;EAC5B,UAAU;EACV,OAAO;EACP,OAAO;EACP,MAAM;EACN,MAAM;GACJ,aACE;GACF,KAAK;EACP;CACF;CACA,2BAA2B;EACzB,UAAU;EACV,OAAO;EACP,OAAO;EACP,MAAM;EACN,MAAM;GACJ,aACE;GACF,KAAK;EACP;CACF;AAEF"}
@@ -0,0 +1,8 @@
1
+ import "../spec.js";
2
+ //#region src/diagnostics/codes/team.d.ts
3
+ /** The codes of the TEAM area, in the order they were added. */
4
+ export declare const teamDiagnosticCodes: readonly ["MOSTRA_TEAM_ROSTER_POLICY", "MOSTRA_TEAM_ROSTER_TOO_LARGE", "MOSTRA_TEAM_PRESENCE_RATE_LIMITED"];
5
+ /** The codes of the TEAM area. */
6
+ export type TeamDiagnosticCode = (typeof teamDiagnosticCodes)[number];
7
+ //#endregion
8
+ //# sourceMappingURL=team.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"team.d.ts","names":[],"sources":["../../../src/diagnostics/codes/team.ts"],"mappings":";;;qBAMa;;YAQD,6BAA6B"}
@@ -0,0 +1,44 @@
1
+ //#region src/diagnostics/codes/team.ts
2
+ /** The codes of the TEAM area, in the order they were added. */
3
+ const teamDiagnosticCodes = [
4
+ "MOSTRA_TEAM_ROSTER_POLICY",
5
+ "MOSTRA_TEAM_ROSTER_TOO_LARGE",
6
+ "MOSTRA_TEAM_PRESENCE_RATE_LIMITED"
7
+ ];
8
+ /** The TEAM area's catalog entries. */
9
+ const teamDiagnostics = {
10
+ MOSTRA_TEAM_ROSTER_POLICY: {
11
+ severity: "error",
12
+ phase: "host",
13
+ title: "This artifact's policy can't wait for every respondent",
14
+ hint: "Publish with the submission policy once per-viewer or epochs, then wait again; or wait for submitted.",
15
+ docs: {
16
+ explanation: "`submitted:all` waits until every expected respondent has submitted, and `submitted:<N>` for N submissions. Both need a policy that takes a submission from each person: `once` with scope `per-viewer`, or `epochs`. Under `once` per-artifact the artifact takes one submission in all, so neither can be met beyond the first, and Mostra refuses the wait instead of letting it run forever.",
17
+ fix: "Publish again with `mostra publish <path> --policy once-per-viewer` (or `--policy epochs`), or wait for `submitted`."
18
+ }
19
+ },
20
+ MOSTRA_TEAM_ROSTER_TOO_LARGE: {
21
+ severity: "error",
22
+ phase: "host",
23
+ title: "Roster larger than 1,000 respondents",
24
+ hint: "Name at most 1,000 expected respondents; share one link for everyone else instead.",
25
+ docs: {
26
+ explanation: "A roster lists the people an artifact expects answers from, each with a personal link and a status. It holds at most 1,000 of them. Nothing was added: the roster is as it was.",
27
+ fix: "Remove respondents you no longer expect (`mostra roster remove`), or, for a page many people answer, share one link and wait for `submitted:<N>` instead."
28
+ }
29
+ },
30
+ MOSTRA_TEAM_PRESENCE_RATE_LIMITED: {
31
+ severity: "error",
32
+ phase: "hygiene",
33
+ title: "Presence updates too fast",
34
+ hint: "Send presence at most 10 times a second; usePresence does this for you.",
35
+ docs: {
36
+ explanation: "A page shares its viewer's cursor and selection through `POST /_mostra/v/<rev>/presence`. Each view may send 20 updates a second; past that the gateway answers 429 with `Retry-After`. Presence is never stored, so nothing is lost: the next update replaces the last one.",
37
+ fix: "Use `usePresence` from `@mostra/react`, which sends at most 10 updates a second, or throttle your own calls to the route."
38
+ }
39
+ }
40
+ };
41
+ //#endregion
42
+ export { teamDiagnosticCodes, teamDiagnostics };
43
+
44
+ //# sourceMappingURL=team.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"team.js","names":[],"sources":["../../../src/diagnostics/codes/team.ts"],"sourcesContent":["/**\n * Diagnostic codes of the TEAM area.\n */\nimport type { AreaCatalog } from \"../spec.ts\";\n\n/** The codes of the TEAM area, in the order they were added. */\nexport const teamDiagnosticCodes = [\n \"MOSTRA_TEAM_ROSTER_POLICY\",\n \"MOSTRA_TEAM_ROSTER_TOO_LARGE\",\n \"MOSTRA_TEAM_PRESENCE_RATE_LIMITED\",\n // gen:codes\n] as const;\n\n/** The codes of the TEAM area. */\nexport type TeamDiagnosticCode = (typeof teamDiagnosticCodes)[number];\n\n/** The TEAM area's catalog entries. */\nexport const teamDiagnostics: AreaCatalog<TeamDiagnosticCode> = {\n MOSTRA_TEAM_ROSTER_POLICY: {\n severity: \"error\",\n phase: \"host\",\n title: \"This artifact's policy can't wait for every respondent\",\n hint: \"Publish with the submission policy once per-viewer or epochs, then wait again; or wait for submitted.\",\n docs: {\n explanation:\n \"`submitted:all` waits until every expected respondent has submitted, and `submitted:<N>` for N submissions. Both need a policy that takes a submission from each person: `once` with scope `per-viewer`, or `epochs`. Under `once` per-artifact the artifact takes one submission in all, so neither can be met beyond the first, and Mostra refuses the wait instead of letting it run forever.\",\n fix: \"Publish again with `mostra publish <path> --policy once-per-viewer` (or `--policy epochs`), or wait for `submitted`.\",\n },\n },\n MOSTRA_TEAM_ROSTER_TOO_LARGE: {\n severity: \"error\",\n phase: \"host\",\n title: \"Roster larger than 1,000 respondents\",\n hint: \"Name at most 1,000 expected respondents; share one link for everyone else instead.\",\n docs: {\n explanation:\n \"A roster lists the people an artifact expects answers from, each with a personal link and a status. It holds at most 1,000 of them. Nothing was added: the roster is as it was.\",\n fix: \"Remove respondents you no longer expect (`mostra roster remove`), or, for a page many people answer, share one link and wait for `submitted:<N>` instead.\",\n },\n },\n MOSTRA_TEAM_PRESENCE_RATE_LIMITED: {\n severity: \"error\",\n phase: \"hygiene\",\n title: \"Presence updates too fast\",\n hint: \"Send presence at most 10 times a second; usePresence does this for you.\",\n docs: {\n explanation:\n \"A page shares its viewer's cursor and selection through `POST /_mostra/v/<rev>/presence`. Each view may send 20 updates a second; past that the gateway answers 429 with `Retry-After`. Presence is never stored, so nothing is lost: the next update replaces the last one.\",\n fix: \"Use `usePresence` from `@mostra/react`, which sends at most 10 updates a second, or throttle your own calls to the route.\",\n },\n },\n // gen:entries\n};\n"],"mappings":";;AAMA,MAAa,sBAAsB;CACjC;CACA;CACA;AAEF;;AAMA,MAAa,kBAAmD;CAC9D,2BAA2B;EACzB,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,mCAAmC;EACjC,UAAU;EACV,OAAO;EACP,OAAO;EACP,MAAM;EACN,MAAM;GACJ,aACE;GACF,KAAK;EACP;CACF;AAEF"}
@@ -4,7 +4,7 @@ import * as z from "zod";
4
4
  * Diagnostic areas. A code is `MOSTRA_<AREA>_<NAME>`. INTERFACES §13 holds the authoritative list,
5
5
  * which only grows.
6
6
  */
7
- export type DiagnosticArea = "MANIFEST" | "BUILD" | "TYPE" | "LINT" | "DEP" | "KIT" | "FIELD" | "ACTION" | "LIVE" | "RUNTIME" | "CONSOLE" | "NETWORK" | "A11Y" | "VISUAL" | "SMOKE" | "REGRESSION" | "TERM" | "PUBLISH" | "SUBMIT" | "HOST" | "HOME" | "HYGIENE" | "SECRET" | "SHARE" | "VERIFY" | "TARGET" | "ENV" | "PLATFORM" | "ARTIFACT" | "CLI" | "REMOTE";
7
+ export type DiagnosticArea = "MANIFEST" | "BUILD" | "TYPE" | "LINT" | "DEP" | "KIT" | "FIELD" | "ACTION" | "LIVE" | "RUNTIME" | "CONSOLE" | "NETWORK" | "A11Y" | "VISUAL" | "SMOKE" | "REGRESSION" | "TERM" | "PUBLISH" | "SUBMIT" | "HOST" | "HOME" | "HYGIENE" | "SECRET" | "SHARE" | "VERIFY" | "TARGET" | "ENV" | "PLATFORM" | "ARTIFACT" | "CLI" | "REMOTE" | "TEAM";
8
8
  /** Every diagnostic area, in INTERFACES §13 order. */
9
9
  export declare const DIAGNOSTIC_AREAS: readonly DiagnosticArea[];
10
10
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"diagnostic.d.ts","names":[],"sources":["../../src/diagnostics/diagnostic.ts"],"mappings":";;;;;;YAWY;;qBAkCC,2BAA2B;;;;;YAsC5B,2BAA2B;;;;;YAM3B;;YAGA;;;;;iBAqBK;;WAEN;;WAEA;;WAEA;;WAEA;;WAEA;;;YAIC;WACG;WAAuB;WAAuB;;WAC9C;WAA2B;;;iBAGzB;;WAEN,MAAM;;WAEN,UAAU;;WAEV;;WAEA;;WAEA,MAAM;;WAEN,WAAW;;WAEX,OAAO;;WAEP;;WAEA;;;qBAkBE,oBAAoB,EAAE,QAAQ;;qBAQ9B,iBAAiB,EAAE,QAAQ;;qBAwB3B,eAAe,EAAE,QAAQ;;qBAezB,oBAAoB,EAAE,QAAQ;;qBAW9B,YAAY,EAAE,QAAQ"}
1
+ {"version":3,"file":"diagnostic.d.ts","names":[],"sources":["../../src/diagnostics/diagnostic.ts"],"mappings":";;;;;;YAWY;;qBAmCC,2BAA2B;;;;;YAuC5B,2BAA2B;;;;;YAM3B;;YAGA;;;;;iBAqBK;;WAEN;;WAEA;;WAEA;;WAEA;;WAEA;;;YAIC;WACG;WAAuB;WAAuB;;WAC9C;WAA2B;;;iBAGzB;;WAEN,MAAM;;WAEN,UAAU;;WAEV;;WAEA;;WAEA,MAAM;;WAEN,WAAW;;WAEX,OAAO;;WAEP;;WAEA;;;qBAkBE,oBAAoB,EAAE,QAAQ;;qBAQ9B,iBAAiB,EAAE,QAAQ;;qBAwB3B,eAAe,EAAE,QAAQ;;qBAezB,oBAAoB,EAAE,QAAQ;;qBAW9B,YAAY,EAAE,QAAQ"}
@@ -37,7 +37,8 @@ const DIAGNOSTIC_AREAS = [
37
37
  "PLATFORM",
38
38
  "ARTIFACT",
39
39
  "CLI",
40
- "REMOTE"
40
+ "REMOTE",
41
+ "TEAM"
41
42
  ];
42
43
  const positiveInt = z.int().min(1);
43
44
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"diagnostic.js","names":[],"sources":["../../src/diagnostics/diagnostic.ts"],"sourcesContent":["/**\n * The one diagnostic object every Mostra interface uses for errors, warnings and hints\n * (INTERFACES §1 and §13, AX-03).\n */\nimport * as z from \"zod\";\nimport { wireRegistry } from \"../wire-registry.ts\";\n\n/**\n * Diagnostic areas. A code is `MOSTRA_<AREA>_<NAME>`. INTERFACES §13 holds the authoritative list,\n * which only grows.\n */\nexport type DiagnosticArea =\n | \"MANIFEST\"\n | \"BUILD\"\n | \"TYPE\"\n | \"LINT\"\n | \"DEP\"\n | \"KIT\"\n | \"FIELD\"\n | \"ACTION\"\n | \"LIVE\"\n | \"RUNTIME\"\n | \"CONSOLE\"\n | \"NETWORK\"\n | \"A11Y\"\n | \"VISUAL\"\n | \"SMOKE\"\n | \"REGRESSION\"\n | \"TERM\"\n | \"PUBLISH\"\n | \"SUBMIT\"\n | \"HOST\"\n | \"HOME\"\n | \"HYGIENE\"\n | \"SECRET\"\n | \"SHARE\"\n | \"VERIFY\"\n | \"TARGET\"\n | \"ENV\"\n | \"PLATFORM\"\n | \"ARTIFACT\"\n | \"CLI\"\n | \"REMOTE\";\n\n/** Every diagnostic area, in INTERFACES §13 order. */\nexport const DIAGNOSTIC_AREAS: readonly DiagnosticArea[] = [\n \"MANIFEST\",\n \"BUILD\",\n \"TYPE\",\n \"LINT\",\n \"DEP\",\n \"KIT\",\n \"FIELD\",\n \"ACTION\",\n \"LIVE\",\n \"RUNTIME\",\n \"CONSOLE\",\n \"NETWORK\",\n \"A11Y\",\n \"VISUAL\",\n \"SMOKE\",\n \"REGRESSION\",\n \"TERM\",\n \"PUBLISH\",\n \"SUBMIT\",\n \"HOST\",\n \"HOME\",\n \"HYGIENE\",\n \"SECRET\",\n \"SHARE\",\n \"VERIFY\",\n \"TARGET\",\n \"ENV\",\n \"PLATFORM\",\n \"ARTIFACT\",\n \"CLI\",\n \"REMOTE\",\n];\n\n/**\n * A diagnostic code. Codes are semver surface: once released, a code keeps its meaning and is\n * never removed (AX-03).\n */\nexport type DiagnosticCode = `MOSTRA_${DiagnosticArea}_${string}`;\n\n/**\n * How bad it is. `error` is only for definite failures; observations that might be fine are\n * warnings (D72).\n */\nexport type DiagnosticSeverity = \"error\" | \"warning\" | \"hint\";\n\n/** The stage of work that produced the diagnostic. */\nexport type DiagnosticPhase =\n | \"manifest\"\n | \"compile\"\n | \"lint\"\n | \"runtime\"\n | \"console\"\n | \"network\"\n | \"a11y\"\n | \"visual\"\n | \"smoke\"\n | \"regression\"\n | \"contract\"\n | \"publish\"\n | \"host\"\n | \"hygiene\"\n | \"platform\";\n\n/**\n * A machine-applicable fix. `range` is `[startLine, startColumn, endLine, endColumn]`, 1-based,\n * with the end exclusive.\n */\nexport interface DiagnosticFix {\n /** Replace, insert or delete text in `file`, or run `command`. */\n readonly kind: \"replace\" | \"insert\" | \"delete\" | \"command\";\n /** The file to edit, relative to the artifact or project root. */\n readonly file?: string;\n /** The span to edit. */\n readonly range?: readonly [number, number, number, number];\n /** The replacement or inserted text. */\n readonly text?: string;\n /** The command to run, for `kind: \"command\"`. */\n readonly command?: string;\n}\n\n/** Where the problem is: a source position (1-based) or a place in a rendered viewport. */\nexport type DiagnosticLocation =\n | { readonly file: string; readonly line: number; readonly column: number }\n | { readonly viewport: string; readonly selector?: string };\n\n/** One diagnostic (INTERFACES §13). */\nexport interface Diagnostic {\n /** The stable code, `MOSTRA_<AREA>_<NAME>`. */\n readonly code: DiagnosticCode;\n /** How bad it is. */\n readonly severity: DiagnosticSeverity;\n /** What is wrong, for this occurrence. */\n readonly message: string;\n /** What to do: one imperative sentence. */\n readonly hint?: string;\n /** A machine-applicable fix, when one exists. */\n readonly fix?: DiagnosticFix;\n /** Where the problem is, when it has a place. */\n readonly location?: DiagnosticLocation;\n /** The stage of work that produced it. */\n readonly phase: DiagnosticPhase;\n /** The code's documentation page: `${docsBase}/errors/${code}` (D37). */\n readonly docs: string;\n /** How many identical occurrences this one stands for, when deduplicated. */\n readonly count?: number;\n}\n\nconst positiveInt = z.int().min(1);\n\n/**\n * Codes on the wire accept any area, so a client keeps working when a newer Mostra reports a code\n * from an area it doesn't know yet. Producers are typed against {@link DiagnosticArea}.\n */\nconst codeSchema = z\n .string()\n .regex(/^MOSTRA_[A-Z0-9]+_[A-Z0-9_]+$/)\n .register(wireRegistry, {\n id: \"DiagnosticCode\",\n description: \"Stable diagnostic code: MOSTRA_<AREA>_<NAME>.\",\n }) as unknown as z.ZodType<DiagnosticCode, string>;\n\n/** The Zod schema of the `DiagnosticSeverity` type. */\nexport const DiagnosticSeverity: z.ZodType<DiagnosticSeverity, string> = z\n .enum([\"error\", \"warning\", \"hint\"])\n .register(wireRegistry, {\n id: \"DiagnosticSeverity\",\n description: \"How bad it is: error only for definite failures.\",\n });\n\n/** The Zod schema of the `DiagnosticPhase` type. */\nexport const DiagnosticPhase: z.ZodType<DiagnosticPhase, string> = z\n .enum([\n \"manifest\",\n \"compile\",\n \"lint\",\n \"runtime\",\n \"console\",\n \"network\",\n \"a11y\",\n \"visual\",\n \"smoke\",\n \"regression\",\n \"contract\",\n \"publish\",\n \"host\",\n \"hygiene\",\n \"platform\",\n ])\n .register(wireRegistry, {\n id: \"DiagnosticPhase\",\n description: \"The stage of work that produced the diagnostic.\",\n });\n\n/** The Zod schema of the `DiagnosticFix` type. */\nexport const DiagnosticFix: z.ZodType<DiagnosticFix> = z\n .object({\n kind: z.enum([\"replace\", \"insert\", \"delete\", \"command\"]),\n file: z.string().exactOptional(),\n range: z.tuple([positiveInt, positiveInt, positiveInt, positiveInt]).readonly().exactOptional(),\n text: z.string().exactOptional(),\n command: z.string().exactOptional(),\n })\n .register(wireRegistry, {\n id: \"DiagnosticFix\",\n description:\n \"A machine-applicable fix; range is [startLine, startColumn, endLine, endColumn], 1-based, end exclusive.\",\n });\n\n/** The Zod schema of the `DiagnosticLocation` type. */\nexport const DiagnosticLocation: z.ZodType<DiagnosticLocation> = z\n .union([\n z.object({ file: z.string(), line: positiveInt, column: positiveInt }),\n z.object({ viewport: z.string(), selector: z.string().exactOptional() }),\n ])\n .register(wireRegistry, {\n id: \"DiagnosticLocation\",\n description: \"A 1-based source position, or a place in a rendered viewport.\",\n });\n\n/** The Zod schema of the `Diagnostic` type. */\nexport const Diagnostic: z.ZodType<Diagnostic> = z\n .object({\n code: codeSchema,\n severity: DiagnosticSeverity,\n message: z.string(),\n hint: z.string().exactOptional(),\n fix: DiagnosticFix.exactOptional(),\n location: DiagnosticLocation.exactOptional(),\n phase: DiagnosticPhase,\n docs: z.url(),\n count: positiveInt.exactOptional(),\n })\n .register(wireRegistry, {\n id: \"Diagnostic\",\n description: \"One diagnostic: a stable code, severity, message, hint, fix and docs link.\",\n });\n"],"mappings":";;;;;;;;AA6CA,MAAa,mBAA8C;CACzD;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AA4EA,MAAM,cAAc,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC;;;;;AAMjC,MAAM,aAAa,EAChB,OAAO,CAAC,CACR,MAAM,+BAA+B,CAAC,CACtC,SAAS,cAAc;CACtB,IAAI;CACJ,aAAa;AACf,CAAC;;AAGH,MAAa,qBAA4D,EACtE,KAAK;CAAC;CAAS;CAAW;AAAM,CAAC,CAAC,CAClC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["../../src/diagnostics/diagnostic.ts"],"sourcesContent":["/**\n * The one diagnostic object every Mostra interface uses for errors, warnings and hints\n * (INTERFACES §1 and §13, AX-03).\n */\nimport * as z from \"zod\";\nimport { wireRegistry } from \"../wire-registry.ts\";\n\n/**\n * Diagnostic areas. A code is `MOSTRA_<AREA>_<NAME>`. INTERFACES §13 holds the authoritative list,\n * which only grows.\n */\nexport type DiagnosticArea =\n | \"MANIFEST\"\n | \"BUILD\"\n | \"TYPE\"\n | \"LINT\"\n | \"DEP\"\n | \"KIT\"\n | \"FIELD\"\n | \"ACTION\"\n | \"LIVE\"\n | \"RUNTIME\"\n | \"CONSOLE\"\n | \"NETWORK\"\n | \"A11Y\"\n | \"VISUAL\"\n | \"SMOKE\"\n | \"REGRESSION\"\n | \"TERM\"\n | \"PUBLISH\"\n | \"SUBMIT\"\n | \"HOST\"\n | \"HOME\"\n | \"HYGIENE\"\n | \"SECRET\"\n | \"SHARE\"\n | \"VERIFY\"\n | \"TARGET\"\n | \"ENV\"\n | \"PLATFORM\"\n | \"ARTIFACT\"\n | \"CLI\"\n | \"REMOTE\"\n | \"TEAM\";\n\n/** Every diagnostic area, in INTERFACES §13 order. */\nexport const DIAGNOSTIC_AREAS: readonly DiagnosticArea[] = [\n \"MANIFEST\",\n \"BUILD\",\n \"TYPE\",\n \"LINT\",\n \"DEP\",\n \"KIT\",\n \"FIELD\",\n \"ACTION\",\n \"LIVE\",\n \"RUNTIME\",\n \"CONSOLE\",\n \"NETWORK\",\n \"A11Y\",\n \"VISUAL\",\n \"SMOKE\",\n \"REGRESSION\",\n \"TERM\",\n \"PUBLISH\",\n \"SUBMIT\",\n \"HOST\",\n \"HOME\",\n \"HYGIENE\",\n \"SECRET\",\n \"SHARE\",\n \"VERIFY\",\n \"TARGET\",\n \"ENV\",\n \"PLATFORM\",\n \"ARTIFACT\",\n \"CLI\",\n \"REMOTE\",\n \"TEAM\",\n];\n\n/**\n * A diagnostic code. Codes are semver surface: once released, a code keeps its meaning and is\n * never removed (AX-03).\n */\nexport type DiagnosticCode = `MOSTRA_${DiagnosticArea}_${string}`;\n\n/**\n * How bad it is. `error` is only for definite failures; observations that might be fine are\n * warnings (D72).\n */\nexport type DiagnosticSeverity = \"error\" | \"warning\" | \"hint\";\n\n/** The stage of work that produced the diagnostic. */\nexport type DiagnosticPhase =\n | \"manifest\"\n | \"compile\"\n | \"lint\"\n | \"runtime\"\n | \"console\"\n | \"network\"\n | \"a11y\"\n | \"visual\"\n | \"smoke\"\n | \"regression\"\n | \"contract\"\n | \"publish\"\n | \"host\"\n | \"hygiene\"\n | \"platform\";\n\n/**\n * A machine-applicable fix. `range` is `[startLine, startColumn, endLine, endColumn]`, 1-based,\n * with the end exclusive.\n */\nexport interface DiagnosticFix {\n /** Replace, insert or delete text in `file`, or run `command`. */\n readonly kind: \"replace\" | \"insert\" | \"delete\" | \"command\";\n /** The file to edit, relative to the artifact or project root. */\n readonly file?: string;\n /** The span to edit. */\n readonly range?: readonly [number, number, number, number];\n /** The replacement or inserted text. */\n readonly text?: string;\n /** The command to run, for `kind: \"command\"`. */\n readonly command?: string;\n}\n\n/** Where the problem is: a source position (1-based) or a place in a rendered viewport. */\nexport type DiagnosticLocation =\n | { readonly file: string; readonly line: number; readonly column: number }\n | { readonly viewport: string; readonly selector?: string };\n\n/** One diagnostic (INTERFACES §13). */\nexport interface Diagnostic {\n /** The stable code, `MOSTRA_<AREA>_<NAME>`. */\n readonly code: DiagnosticCode;\n /** How bad it is. */\n readonly severity: DiagnosticSeverity;\n /** What is wrong, for this occurrence. */\n readonly message: string;\n /** What to do: one imperative sentence. */\n readonly hint?: string;\n /** A machine-applicable fix, when one exists. */\n readonly fix?: DiagnosticFix;\n /** Where the problem is, when it has a place. */\n readonly location?: DiagnosticLocation;\n /** The stage of work that produced it. */\n readonly phase: DiagnosticPhase;\n /** The code's documentation page: `${docsBase}/errors/${code}` (D37). */\n readonly docs: string;\n /** How many identical occurrences this one stands for, when deduplicated. */\n readonly count?: number;\n}\n\nconst positiveInt = z.int().min(1);\n\n/**\n * Codes on the wire accept any area, so a client keeps working when a newer Mostra reports a code\n * from an area it doesn't know yet. Producers are typed against {@link DiagnosticArea}.\n */\nconst codeSchema = z\n .string()\n .regex(/^MOSTRA_[A-Z0-9]+_[A-Z0-9_]+$/)\n .register(wireRegistry, {\n id: \"DiagnosticCode\",\n description: \"Stable diagnostic code: MOSTRA_<AREA>_<NAME>.\",\n }) as unknown as z.ZodType<DiagnosticCode, string>;\n\n/** The Zod schema of the `DiagnosticSeverity` type. */\nexport const DiagnosticSeverity: z.ZodType<DiagnosticSeverity, string> = z\n .enum([\"error\", \"warning\", \"hint\"])\n .register(wireRegistry, {\n id: \"DiagnosticSeverity\",\n description: \"How bad it is: error only for definite failures.\",\n });\n\n/** The Zod schema of the `DiagnosticPhase` type. */\nexport const DiagnosticPhase: z.ZodType<DiagnosticPhase, string> = z\n .enum([\n \"manifest\",\n \"compile\",\n \"lint\",\n \"runtime\",\n \"console\",\n \"network\",\n \"a11y\",\n \"visual\",\n \"smoke\",\n \"regression\",\n \"contract\",\n \"publish\",\n \"host\",\n \"hygiene\",\n \"platform\",\n ])\n .register(wireRegistry, {\n id: \"DiagnosticPhase\",\n description: \"The stage of work that produced the diagnostic.\",\n });\n\n/** The Zod schema of the `DiagnosticFix` type. */\nexport const DiagnosticFix: z.ZodType<DiagnosticFix> = z\n .object({\n kind: z.enum([\"replace\", \"insert\", \"delete\", \"command\"]),\n file: z.string().exactOptional(),\n range: z.tuple([positiveInt, positiveInt, positiveInt, positiveInt]).readonly().exactOptional(),\n text: z.string().exactOptional(),\n command: z.string().exactOptional(),\n })\n .register(wireRegistry, {\n id: \"DiagnosticFix\",\n description:\n \"A machine-applicable fix; range is [startLine, startColumn, endLine, endColumn], 1-based, end exclusive.\",\n });\n\n/** The Zod schema of the `DiagnosticLocation` type. */\nexport const DiagnosticLocation: z.ZodType<DiagnosticLocation> = z\n .union([\n z.object({ file: z.string(), line: positiveInt, column: positiveInt }),\n z.object({ viewport: z.string(), selector: z.string().exactOptional() }),\n ])\n .register(wireRegistry, {\n id: \"DiagnosticLocation\",\n description: \"A 1-based source position, or a place in a rendered viewport.\",\n });\n\n/** The Zod schema of the `Diagnostic` type. */\nexport const Diagnostic: z.ZodType<Diagnostic> = z\n .object({\n code: codeSchema,\n severity: DiagnosticSeverity,\n message: z.string(),\n hint: z.string().exactOptional(),\n fix: DiagnosticFix.exactOptional(),\n location: DiagnosticLocation.exactOptional(),\n phase: DiagnosticPhase,\n docs: z.url(),\n count: positiveInt.exactOptional(),\n })\n .register(wireRegistry, {\n id: \"Diagnostic\",\n description: \"One diagnostic: a stable code, severity, message, hint, fix and docs link.\",\n });\n"],"mappings":";;;;;;;;AA8CA,MAAa,mBAA8C;CACzD;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AA4EA,MAAM,cAAc,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC;;;;;AAMjC,MAAM,aAAa,EAChB,OAAO,CAAC,CACR,MAAM,+BAA+B,CAAC,CACtC,SAAS,cAAc;CACtB,IAAI;CACJ,aAAa;AACf,CAAC;;AAGH,MAAa,qBAA4D,EACtE,KAAK;CAAC;CAAS;CAAW;AAAM,CAAC,CAAC,CAClC,SAAS,cAAc;CACtB,IAAI;CACJ,aAAa;AACf,CAAC;;AAGH,MAAa,kBAAsD,EAChE,KAAK;CACJ;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,CAAC,CAAC,CACD,SAAS,cAAc;CACtB,IAAI;CACJ,aAAa;AACf,CAAC;;AAGH,MAAa,gBAA0C,EACpD,OAAO;CACN,MAAM,EAAE,KAAK;EAAC;EAAW;EAAU;EAAU;CAAS,CAAC;CACvD,MAAM,EAAE,OAAO,CAAC,CAAC,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