@mostra/protocol 0.11.0 → 0.12.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 (94) 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/team.d.ts +8 -0
  10. package/dist/diagnostics/codes/team.d.ts.map +1 -0
  11. package/dist/diagnostics/codes/team.js +44 -0
  12. package/dist/diagnostics/codes/team.js.map +1 -0
  13. package/dist/diagnostics/diagnostic.d.ts +1 -1
  14. package/dist/diagnostics/diagnostic.d.ts.map +1 -1
  15. package/dist/diagnostics/diagnostic.js +2 -1
  16. package/dist/diagnostics/diagnostic.js.map +1 -1
  17. package/dist/index.d.ts +13 -6
  18. package/dist/index.js +11 -4
  19. package/dist/interaction.d.ts +12 -3
  20. package/dist/interaction.d.ts.map +1 -1
  21. package/dist/interaction.js +15 -12
  22. package/dist/interaction.js.map +1 -1
  23. package/dist/manifest.d.ts +3 -0
  24. package/dist/manifest.d.ts.map +1 -1
  25. package/dist/manifest.js +5 -2
  26. package/dist/manifest.js.map +1 -1
  27. package/dist/methods/index.d.ts.map +1 -1
  28. package/dist/methods/index.js +10 -2
  29. package/dist/methods/index.js.map +1 -1
  30. package/dist/methods/port/trusted-controls-policy.d.ts +1 -1
  31. package/dist/methods/results/get.d.ts +3 -1
  32. package/dist/methods/results/get.d.ts.map +1 -1
  33. package/dist/methods/results/get.js +4 -3
  34. package/dist/methods/results/get.js.map +1 -1
  35. package/dist/methods/results/list.d.ts +33 -0
  36. package/dist/methods/results/list.d.ts.map +1 -0
  37. package/dist/methods/results/list.js +35 -0
  38. package/dist/methods/results/list.js.map +1 -0
  39. package/dist/methods/roster/add.d.ts +47 -0
  40. package/dist/methods/roster/add.d.ts.map +1 -0
  41. package/dist/methods/roster/add.js +46 -0
  42. package/dist/methods/roster/add.js.map +1 -0
  43. package/dist/methods/roster/get.d.ts +18 -0
  44. package/dist/methods/roster/get.d.ts.map +1 -0
  45. package/dist/methods/roster/get.js +22 -0
  46. package/dist/methods/roster/get.js.map +1 -0
  47. package/dist/methods/roster/remove.d.ts +28 -0
  48. package/dist/methods/roster/remove.d.ts.map +1 -0
  49. package/dist/methods/roster/remove.js +31 -0
  50. package/dist/methods/roster/remove.js.map +1 -0
  51. package/dist/methods/share/start.d.ts +15 -2
  52. package/dist/methods/share/start.d.ts.map +1 -1
  53. package/dist/methods/share/start.js +5 -1
  54. package/dist/methods/share/start.js.map +1 -1
  55. package/dist/methods/state/get.d.ts +1 -1
  56. package/dist/methods/state/patch.d.ts +1 -1
  57. package/dist/methods/view/url.d.ts +1 -1
  58. package/dist/methods/wait/wait.d.ts +1 -1
  59. package/dist/operator.d.ts +50 -3
  60. package/dist/operator.d.ts.map +1 -1
  61. package/dist/operator.js.map +1 -1
  62. package/dist/team-settings.d.ts +21 -0
  63. package/dist/team-settings.d.ts.map +1 -0
  64. package/dist/team-settings.js +27 -0
  65. package/dist/team-settings.js.map +1 -0
  66. package/dist/team.d.ts +221 -0
  67. package/dist/team.d.ts.map +1 -0
  68. package/dist/team.js +162 -0
  69. package/dist/team.js.map +1 -0
  70. package/dist/verify.d.ts +7 -0
  71. package/dist/verify.d.ts.map +1 -1
  72. package/dist/verify.js.map +1 -1
  73. package/dist/worker.d.ts +1 -1
  74. package/package.json +1 -1
  75. package/schemas/protocol.draft-07.json +802 -79
  76. package/schemas/protocol.schema.json +782 -91
  77. package/src/actions.ts +8 -4
  78. package/src/diagnostics/codes/index.ts +6 -2
  79. package/src/diagnostics/codes/team.ts +53 -0
  80. package/src/diagnostics/diagnostic.ts +3 -1
  81. package/src/index.ts +47 -2
  82. package/src/interaction.ts +24 -5
  83. package/src/manifest.ts +5 -0
  84. package/src/methods/index.ts +8 -0
  85. package/src/methods/results/get.ts +3 -2
  86. package/src/methods/results/list.ts +61 -0
  87. package/src/methods/roster/add.ts +77 -0
  88. package/src/methods/roster/get.ts +30 -0
  89. package/src/methods/roster/remove.ts +49 -0
  90. package/src/methods/share/start.ts +23 -3
  91. package/src/operator.ts +42 -3
  92. package/src/team-settings.ts +38 -0
  93. package/src/team.ts +398 -0
  94. package/src/verify.ts +7 -0
@@ -324,7 +324,9 @@ export type OperatorEventKind = "submission.accepted" | "version.pushed" | "run.
324
324
  /**
325
325
  * One outbound event, delivered at least once with a stable `eventId`. `payload`:
326
326
  * `submission.accepted` carries the submission's `Results` (INTERFACES §8, the `Results` type of `@mostra/protocol`); `version.pushed`
327
- * `{ versionId, number }`; `run.ended` `{ runId, action, status }`; `roster.completed` is WP-31's.
327
+ * `{ versionId, number }`; `run.ended` `{ runId, action, status }`; `roster.completed`
328
+ * `{ round, respondents, submissions: { ref, submissionId }[] }`, when every expected respondent
329
+ * answered (D168).
328
330
  * `label` is the route's label, so an operator running several servers behind one front learns
329
331
  * which serves which label (WP-30).
330
332
  */
@@ -412,8 +414,53 @@ export interface OperatorPorts {
412
414
  readonly events?: {
413
415
  deliver(e: OperatorEvent): Promise<void>;
414
416
  };
415
- /** Reserved for WP-31 (D121, D165 item 16); no mailer ships. */
416
- readonly invitations?: unknown;
417
+ /**
418
+ * Invitations to expected respondents (D121, D168): for each respondent a hosted roster names
419
+ * with an `email`, when they are added or their personal link is replaced, so the operator can
420
+ * mail them their link. At least once, ordered per home, with a stable `invitationId`. No mailer
421
+ * ships: the open server only hands them over. Default: none sent.
422
+ */
423
+ readonly invitations?: {
424
+ send(invitation: Invitation): Promise<void>;
425
+ };
426
+ }
427
+ /**
428
+ * One invitation (D168). `url` is the respondent's personal link, a capability URL whose secret is
429
+ * in its fragment: the server never stores or logs it (it builds it from the link's token when it
430
+ * hands the invitation over), so the operator mails it and keeps it no longer than that.
431
+ */
432
+ export interface Invitation {
433
+ /** Stable across retries: `<home>:<tokenId>`, one per personal link. */
434
+ readonly invitationId: string;
435
+ /** The account that owns the route. */
436
+ readonly account: string;
437
+ /** Its hosted home. */
438
+ readonly home: string;
439
+ /** The route. */
440
+ readonly routeId: string;
441
+ /** The route's label. */
442
+ readonly label: string;
443
+ /** The artifact's ID. */
444
+ readonly artifactId: string;
445
+ /** The artifact's title, as its latest version names it. */
446
+ readonly title: string;
447
+ /** Who is invited: the owner's key for them, their name and the address to write to. */
448
+ readonly respondent: {
449
+ readonly ref: string;
450
+ readonly name?: string;
451
+ readonly email: string;
452
+ };
453
+ /** Who invites: the owner's display name and the provider that verified it, when one did. */
454
+ readonly sender: {
455
+ readonly name?: string;
456
+ readonly verifiedBy?: string;
457
+ };
458
+ /** The personal link. */
459
+ readonly url: string;
460
+ /** When the link stops working, when it has a lifetime. */
461
+ readonly expiresAt?: string;
462
+ /** When the respondent was added, or their link replaced. */
463
+ readonly at: string;
417
464
  }
418
465
  /** A hosted route, or one version of it: what the handle's quarantine and release act on. */
419
466
  export type RouteTarget = {
@@ -1 +1 @@
1
- {"version":3,"file":"operator.d.ts","names":[],"sources":["../src/operator.ts"],"mappings":";;;qBA4Ba;;qBAGA;WACF;WACA;WACA;WACA;WACA;WACA;WACA;WACA;;;;;;;YAmBC;;iBAaK;;WAEN;;WAEA;;WAEA;;WAEA;;WAEA,WAAW;;WAEX;;;iBAIM;;WAEN;;;YAIC;WACI;IAAkB;WAEnB;;WAEA;;WAEA;WACA;IACP;;qBAKK,aAAa,EAAE,QAAQ;;YAcxB;;;;;;;;iBAkBK;;WAEN,MAAM;;WAEN;;WAEA;;WAEA;;WAEA;;WAEA;;WAEA,aAAa,SAAS;;;iBAIhB;;WAEN;;WAEA;;WAEA;;WAEA,mBAAmB;;;;;;iBASb;;WAEN;;WAEA;;WAEA;;WAEA;;WAEA;;WAEA,QAAQ,SAAS;;;qBAIf,gBAAgB,EAAE,QAAQ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;;;;;WAMtD;IACP,QACE,UAAU,gBACV;eAAoB;QACnB,QAAQ;IACX,cACE,gBACA;eAAoB,UAAU;QAC7B,QAAQ;IACX,QAAQ,kBAAkB;;;WAGnB;IACP,OAAO,GAAG,cAAc;IACxB,QAAQ,GAAG,gBAAgB,QAAQ;;;WAG5B;IACP,KAAK,GAAG,YAAY,QAAQ;IAC5B,UAAU;eACC;eACA;QACP,QAAQ;;;;;;WAML;IACP,QAAQ,eAAe,QAAQ;;;;;;IAM/B,UAAU;eACC;eACA;eACA;QACP;;;WAGG;IAAW,QAAQ,GAAG,gBAAgB;;;;;;;;WAOtC;IAAgB,KAAK,YAAY,aAAa;;;;;;;;iBAQxC;;WAEN;;WAEA;;WAEA;;WAEA;;WAEA;;WAEA;;WAEA;;WAEA;aAAuB;aAAsB;aAAwB;;;WAErE;aAAmB;aAAwB;;;WAE3C;;WAEA;;WAEA;;;YAIC;WACG;;WACA;WAA0B;;;;;;iBAMxB;;WAEN;;WAEA;;EAET,WAAW,QAAQ,aAAa,iBAAiB;;EAEjD,QAAQ,QAAQ,cAAc;;EAE9B,MAAM,iBAAiB,iBAAiB;;EAExC,OAAO,kBAAkB;;EAEzB,YAAY,cAAc,iBAAiB;;EAE3C,WAAW,eAAe;;EAE1B,YAAY,kBAAkB;;EAE9B,WAAW,kBAAkB;;EAE7B,UAAU,eAAe;;EAEzB,YAAY,eAAe;;EAE3B,SAAS,eAAe;;EAExB,OAAO,kBAAkB;;;YAIf,kBAAkB,QAAQ,iBAAiB,gBAAgB,QAAQ;;wBAG/D,eAAe,QAAQ,iBAAiB"}
@@ -1 +1 @@
1
- {"version":3,"file":"operator.js","names":[],"sources":["../src/operator.ts"],"sourcesContent":["/**\n * The operator boundary of a remote server (ARCHITECTURE §15.10, INTERFACES §18.6, D165 items 9\n * and 11): the ports an operating layer implements in an ES module the server loads in process,\n * and the handle the server gives it. Each port is optional and has a no-op default, so a\n * self-hoster needs none of it; each call is async and time-limited, and the server checks every\n * answer against the schemas below before it acts on one (an answer they refuse counts as no\n * answer).\n *\n * An operating layer imports nothing of Mostra but this module (`@mostra/protocol/operator`), so\n * the surface it builds on is this file's, versioned with `@mostra/protocol` and changed only\n * additively (D32).\n *\n * ```ts\n * import { defineOperator } from \"@mostra/protocol/operator\";\n *\n * export default defineOperator((server) => ({\n * limits: { check: async (q) => (q.operation === \"share\" ? { allowed: true } : { allowed: true }) },\n * abuse: { report: async (r) => { await server.quarantine({ routeId: r.routeId }, r.reason); } },\n * }));\n * ```\n *\n * Every port call and every handle target names a hosted route (`rte_…`): an artifact ID, and a\n * version ID derived from it (D89), repeat across homes when a project is copied, so a bare ID\n * would reach every tenant hosting it.\n */\nimport * as z from \"zod\";\n\n/** The operator boundary's own revision, which a module may check (additive within it). */\nexport const OPERATOR_REVISION = \"2026-11-08\";\n\n/** How long the server waits for each port, in milliseconds, before it acts as if none answered. */\nexport const OPERATOR_TIME_LIMITS: {\n readonly limits: number;\n readonly policy: number;\n readonly routing: number;\n readonly identity: number;\n readonly accounts: number;\n readonly authenticate: number;\n readonly pushed: number;\n readonly outbound: number;\n} = {\n limits: 2_000,\n policy: 2_000,\n routing: 2_000,\n identity: 2_000,\n accounts: 5_000,\n authenticate: 5_000,\n pushed: 30_000,\n outbound: 30_000,\n};\n\n// ── limits ──────────────────────────────────────────────────────────────────────────────\n\n/**\n * An operation `limits.check` judges. When the operator doesn't answer in time, `share`,\n * `version.push`, `link` and authoring fail closed, and `view`, `submit` and draft writes proceed,\n * so nothing a person typed is lost (D165 item 9).\n */\nexport type LimitOperation =\n | \"share\"\n | \"version.push\"\n | \"link\"\n | \"view\"\n | \"submit\"\n | \"run\"\n | \"run.wait\"\n | \"call\"\n | \"mcp.call\"\n | \"storage\";\n\n/** What `limits.check` is asked. */\nexport interface LimitQuery {\n /** The account the operation counts against. */\n readonly account: string;\n /** The account's hosted home. */\n readonly home: string;\n /** The artifact, for operations on one. */\n readonly artifact?: string;\n /** The artifact's hosted route, for operations on one (WP-30). */\n readonly routeId?: string;\n /** What is asked for. */\n readonly operation: LimitOperation;\n /** How much: bytes for `storage` and `version.push`, else 1. */\n readonly quantity?: number;\n}\n\n/** How long the server may keep an answer instead of asking again, in milliseconds (WP-30). */\nexport interface Cacheable {\n /** Absent or 0: ask again next time. */\n readonly cacheForMs?: number;\n}\n\n/** `limits.check`'s answer. */\nexport type LimitAnswer =\n | ({ readonly allowed: true } & Cacheable)\n | ({\n readonly allowed: false;\n /** A diagnostic code of the operator's (the server answers `MOSTRA_REMOTE_LIMIT_REACHED`). */\n readonly code: string;\n /** Shown as text to whoever was refused. */\n readonly message: string;\n readonly retryAfterMs?: number;\n } & Cacheable);\n\nconst cacheFor = z.int().min(0).max(86_400_000).exactOptional();\n\n/** The schema the server checks `limits.check`'s answer against. */\nexport const LimitAnswer: z.ZodType<LimitAnswer> = z.union([\n z.object({ allowed: z.literal(true), cacheForMs: cacheFor }),\n z.object({\n allowed: z.literal(false),\n code: z.string().min(1).max(128),\n message: z.string().max(1_000),\n retryAfterMs: z.int().min(0).max(86_400_000).exactOptional(),\n cacheForMs: cacheFor,\n }),\n]);\n\n// ── metering ────────────────────────────────────────────────────────────────────────────\n\n/** A counter's name (INTERFACES §18.6). */\nexport type MeterName =\n | \"views\"\n | \"submissions\"\n | \"requests\"\n | \"bytes.stored\"\n | \"bytes.egress\"\n | \"relay.messages\"\n | \"mcp.calls\"\n | \"home.activeSeconds\"\n | (string & {});\n\n/**\n * One counter of a batch. `views` carry `viewerKey`, a monthly pseudonymous key (an HMAC under a\n * key the server rotates each month), never an identity: per account for a signed-in viewer, per\n * viewer for a link minted with one, and per route for an anonymous viewer, since the shell gives\n * each route a different key and none spans routes (HY-08). `mcp.calls` carry `client`, the MCP\n * client's `clientInfo` name (D148).\n */\nexport interface MeterCounter {\n /** What is counted. */\n readonly name: MeterName;\n /** The account it counts against. */\n readonly account: string;\n /** The account's hosted home. */\n readonly home?: string;\n /** The artifact, for counters of one. */\n readonly artifactId?: string;\n /** The artifact's hosted route, for counters of one. */\n readonly routeId?: string;\n /** How much in the batch's window: a count, bytes or seconds. */\n readonly value: number;\n /** What tells counters of one name apart (`viewerKey`, `client`). */\n readonly dimensions?: Readonly<Record<string, string>>;\n}\n\n/** What `metering.record` receives, at least once, idempotent by `batchId`. */\nexport interface MeterBatch {\n /** Stable across retries: a batch delivered twice is the same batch. */\n readonly batchId: string;\n /** Where the window the counters cover starts. */\n readonly from: string;\n /** Where it ends. */\n readonly to: string;\n /** The counters, one per name, account, route and dimensions. */\n readonly counters: readonly MeterCounter[];\n}\n\n// ── sign-in: identity providers and accounts ────────────────────────────────────────────\n\n/**\n * Who an identity provider says signed in (INTERFACES §18.5). `facts` carries what a provider\n * tells beyond that (GitHub's account age, `createdAt`), for an operator's policy.\n */\nexport interface SignInIdentity {\n /** The provider's ID (`IdentityProvider.id`). */\n readonly provider: string;\n /** The provider's own stable ID for the person. */\n readonly subject: string;\n /** The person's email address, when the provider gives one. */\n readonly email?: string;\n /** Whether the provider verified `email`. */\n readonly emailVerified?: boolean;\n /** The display name the provider gives. */\n readonly name?: string;\n /** What else the provider tells (an account's age as `createdAt`). */\n readonly facts?: Readonly<Record<string, unknown>>;\n}\n\n/** The schema the server checks a provider's `SignInIdentity` against. */\nexport const SignInIdentity: z.ZodType<SignInIdentity> = z.object({\n provider: z.string().regex(/^[a-z][a-z0-9-]{0,31}$/),\n subject: z.string().min(1).max(256),\n email: z.string().max(320).exactOptional(),\n emailVerified: z.boolean().exactOptional(),\n name: z.string().max(256).exactOptional(),\n facts: z.record(z.string(), z.unknown()).exactOptional(),\n});\n\n/** PKCE for one sign-in at a provider: the server makes it; the provider sends `challenge`. */\nexport interface SignInPkce {\n /** The S256 challenge the provider's authorization request carries. */\n readonly challenge: string;\n /** Always S256. */\n readonly method: \"S256\";\n /** The verifier the provider's code exchange sends. */\n readonly verifier: string;\n}\n\n/** What a provider's `authorize` and `callback` are told about the sign-in in progress. */\nexport interface SignInContext {\n /** The provider's return address on the API origin: `<apiOrigin>/signin/<id>/callback`. */\n readonly redirectUri: string;\n /** A fresh value an OpenID Connect provider binds its ID token to. */\n readonly nonce: string;\n}\n\n/**\n * An identity provider behind the sign-in port (D165 item 8): the built-in OpenID Connect and\n * GitHub adapters, a development one for tests, or one an operator module supplies.\n */\nexport interface IdentityProvider {\n /** Lower-case letters, digits and hyphens, at most 32: part of its callback's path. */\n readonly id: string;\n /** What the sign-in page calls it (\"GitHub\"). */\n readonly label: string;\n /** Where to send the person: the provider's authorization URL with `state` and PKCE. */\n authorize(state: string, pkce: SignInPkce, context: SignInContext): string | Promise<string>;\n /**\n * The person the provider names on return, from its callback's query (each parameter once; a\n * repeated one is refused before this is called). The server has already\n * checked `state`; the provider exchanges the code (with `pkce.verifier`) and checks what it\n * gets. Throws when sign-in failed.\n */\n callback(\n params: Readonly<Record<string, string>>,\n context: SignInContext & { readonly state: string; readonly pkce: SignInPkce },\n ): Promise<SignInIdentity>;\n}\n\n/**\n * `accounts.resolve`'s answer: the account (`status` `suspended` refuses sign-in), a **first\n * sign-in step** on the operator's origin, or a refusal shown as text.\n *\n * A step: the server sends the person to `step.url` with `mostra_return` added, an address on the\n * API origin (`/signin/return?step=<handle>`). The handle is single-use, lasts 15 minutes and is\n * bound to the browser that started the sign-in (a `__Host-` cookie on the API origin, never on a\n * user-content domain), so it can't be replayed or swapped. When the person comes back the server\n * calls `resolve` again with the same identity and `context.steps` one higher; at most three steps\n * per sign-in (WP-30, D167).\n */\nexport type AccountResolution =\n | {\n readonly account: string;\n readonly name?: string;\n readonly status: \"active\" | \"suspended\";\n }\n | { readonly step: { readonly url: string } }\n | { readonly refused: { readonly message: string } };\n\n/** The schema the server checks `accounts.resolve`'s answer against. */\nexport const AccountResolution: z.ZodType<AccountResolution> = z.union([\n z.object({\n account: z.string().min(1).max(128),\n name: z.string().max(256).exactOptional(),\n status: z.enum([\"active\", \"suspended\"]),\n }),\n z.object({ step: z.object({ url: z.url({ protocol: /^https$/ }).max(2_048) }) }),\n z.object({ refused: z.object({ message: z.string().max(1_000) }) }),\n]);\n\n/** Where an operator-issued credential was presented (D165 item 9, Opus review of WP-28). */\nexport type CredentialResource = \"host\" | \"mcp\" | \"files\";\n\n/**\n * `accounts.authenticate`'s answer for a credential the operator issued, or `null`. `subject`\n * names the credential stably (a service key's ID): a binding with it is one owner instance link\n * of the account, kept per subject, so a program can run an always-on owner instance.\n */\nexport interface AuthenticatedCredential {\n /** The account the credential acts for. */\n readonly account: string;\n /** What it may do: `mostra` for everything a sign-in may. */\n readonly scope: readonly string[];\n /** The credential's own stable name, which keys its instance link. */\n readonly subject?: string;\n}\n\n/** The schema the server checks `accounts.authenticate`'s answer against. */\nexport const AuthenticatedCredential: z.ZodType<AuthenticatedCredential | null> = z\n .object({\n account: z.string().min(1).max(128),\n scope: z.array(z.string().max(64)).max(32),\n subject: z\n .string()\n .regex(/^[A-Za-z0-9._:-]{1,128}$/)\n .exactOptional(),\n })\n .nullable();\n\n// ── abuse ───────────────────────────────────────────────────────────────────────────────\n\n/** A report from the shell's report control (`POST /a/{routeId}/_mostra/report`). */\nexport interface AbuseReport {\n /** The reported route. */\n readonly routeId: string;\n /** The route's label. */\n readonly label: string;\n /** The artifact's own ID (as its manifest names it). */\n readonly artifactId: string;\n /** The hosted home. */\n readonly home: string;\n /** The version the reporter saw, when the shell knew it. */\n readonly versionId?: string;\n /** The reason the reporter chose. */\n readonly reason: string;\n /** What the reporter wrote, as text. */\n readonly detail?: string;\n /** When the report was made. */\n readonly at: string;\n}\n\n/** What `abuse.pushed` receives after each version push, with read access to its client files. */\nexport interface PushedVersion {\n /** The route the version was pushed to. */\n readonly routeId: string;\n /** The route's label. */\n readonly label: string;\n /** The artifact's own ID (as its manifest names it). */\n readonly artifactId: string;\n /** The hosted home. */\n readonly home: string;\n /** The pushed version. */\n readonly versionId: string;\n /** The version's `manifest.json`, parsed. */\n readonly manifest: unknown;\n /** Every client file's path (`client/…`). */\n readonly files: readonly string[];\n /** A client file's bytes, by its path in the listing. */\n read(path: string): Promise<Uint8Array>;\n}\n\n/** `abuse.pushed`'s answer: quarantine the version, or nothing. */\nexport type PushedAnswer = { readonly quarantine?: { readonly reason: string } } | undefined;\n\n/** The schema the server checks `abuse.pushed`'s answer against. */\nexport const PushedAnswer: z.ZodType<PushedAnswer> = z\n .object({ quarantine: z.object({ reason: z.string().max(1_000) }).exactOptional() })\n .optional();\n\n// ── policy ──────────────────────────────────────────────────────────────────────────────\n\n/** What `policy.link` is asked about one link of one route. */\nexport interface LinkQuery {\n /** The account that owns the route. */\n readonly account: string;\n /** Its hosted home. */\n readonly home: string;\n /** The route. */\n readonly routeId: string;\n /** The artifact's own ID (as its manifest names it). */\n readonly artifactId: string;\n /** The link, once it exists. */\n readonly tokenId?: string;\n}\n\n/**\n * Per link and artifact (D161): an interstitial before the page, the longest link lifetime and an\n * idle expiry (durations such as `7d`), the after-submit line, the footer's wording (it can't be\n * hidden on a public link), and the made-with mark.\n */\nexport interface LinkPolicy extends Cacheable {\n /** A page the shell shows before the artifact, once per browser and link; its message as text. */\n readonly interstitial?: { readonly kind: string; readonly message?: string };\n /** The longest a link may live from when it was minted. */\n readonly maxTtl?: string;\n /** A link unused for this long expires. */\n readonly idleExpiry?: string;\n /** The line after \"Your answer was sent.\", as text. */\n readonly afterSubmit?: string;\n /** The footer's wording in place of \"Never enter passwords\", as text. */\n readonly footer?: string;\n /** Whether the made-with mark shows, and where it links. */\n readonly madeWith?: { readonly show: boolean; readonly href?: string };\n}\n\nconst duration = z.string().regex(/^[1-9][0-9]{0,8}[smhd]$/);\n\n/** The schema the server checks `policy.link`'s answer against. */\nexport const LinkPolicy: z.ZodType<LinkPolicy> = z.object({\n interstitial: z\n .object({ kind: z.string().min(1).max(64), message: z.string().max(2_000).exactOptional() })\n .exactOptional(),\n maxTtl: duration.exactOptional(),\n idleExpiry: duration.exactOptional(),\n afterSubmit: z.string().max(500).exactOptional(),\n footer: z.string().min(1).max(500).exactOptional(),\n madeWith: z\n .object({ show: z.boolean(), href: z.url({ protocol: /^https$/ }).exactOptional() })\n .exactOptional(),\n cacheForMs: cacheFor,\n});\n\n/**\n * How Mostra behaves in one chat host (D160): how a page renders there (an MCP App resource, or\n * the hosted link), and what a reached limit may say (`limit-reached` only, or the operator's\n * message).\n */\nexport interface ChatHostPolicy {\n /** `app`: through the MCP Apps resource; `link`: the hosted link only. */\n readonly render?: \"app\" | \"link\";\n /** What a reached limit may say there. */\n readonly quota?: \"limit-reached\" | \"message\";\n}\n\n/** The schema of the `ChatHostPolicy` type, for configuration and `policy.chatHost`. */\nexport const ChatHostPolicy: z.ZodType<ChatHostPolicy> = z.object({\n render: z.enum([\"app\", \"link\"]).exactOptional(),\n quota: z.enum([\"limit-reached\", \"message\"]).exactOptional(),\n});\n\n// ── routing ─────────────────────────────────────────────────────────────────────────────\n\n/**\n * `routing.resolve`'s answer for an exact `Host` the server doesn't serve by itself (any host but\n * a configured user-content domain's apex and its routes' labels):\n *\n * - `shell`: the host shows the hosted shell (`/a/<routeId>`) for one home's routes, whose frames\n * are served on `<route label>.<domain>`. `domain` is a configured user-content domain, or one\n * the operator supplies (an organization's own, whose TLS the operator's edge terminates for the\n * host and every label under `domain`); the server serves those labels once the host is\n * recorded, without asking again.\n * - `route`: the host shows the shell of one route only (`/a/<routeId>`), with its frames on its\n * label under the active domain: a chosen, readable name.\n * - `null`: nothing is served (421).\n *\n * A host the operator supplies is recorded like the server's own labels, bound to its home\n * forever: never issued to another home, so no origin's storage passes between tenants (D165).\n */\nexport type RoutingAnswer =\n | ({ readonly shell: { readonly domain: string; readonly home: string } } & Cacheable)\n | ({ readonly route: { readonly home: string; readonly routeId: string } } & Cacheable)\n | null;\n\n/**\n * A host name of at least two labels, lower case; a port only as a local test server's hosts carry\n * one (the server's own configuration allows the same).\n */\nconst hostName = z\n .string()\n .regex(\n /^(?=.{1,253}(:|$))[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)+(:\\d{1,5})?$/,\n );\n\n/** The schema the server checks `routing.resolve`'s answer against. */\nexport const RoutingAnswer: z.ZodType<RoutingAnswer> = z.union([\n z.object({\n shell: z.object({ domain: hostName, home: z.string().min(1) }),\n cacheForMs: cacheFor,\n }),\n z.object({\n route: z.object({ home: z.string().min(1), routeId: z.string().min(1) }),\n cacheForMs: cacheFor,\n }),\n z.null(),\n]);\n\n/** The schema of `routing.linkHost`'s answer: a shell host, or `null` for the active domain. */\nexport const LinkHost: z.ZodType<string | null> = hostName.nullable();\n\n// ── events ──────────────────────────────────────────────────────────────────────────────\n\n/** The kind of an outbound event. */\nexport type OperatorEventKind =\n | \"submission.accepted\"\n | \"version.pushed\"\n | \"run.ended\"\n | \"roster.completed\"\n | (string & {});\n\n/**\n * One outbound event, delivered at least once with a stable `eventId`. `payload`:\n * `submission.accepted` carries the submission's `Results` (INTERFACES §8, the `Results` type of `@mostra/protocol`); `version.pushed`\n * `{ versionId, number }`; `run.ended` `{ runId, action, status }`; `roster.completed` is WP-31's.\n * `label` is the route's label, so an operator running several servers behind one front learns\n * which serves which label (WP-30).\n */\nexport interface OperatorEvent {\n /** Stable across retries. */\n readonly eventId: string;\n /** What happened. */\n readonly kind: OperatorEventKind;\n /** The account that owns the route. */\n readonly account: string;\n /** Its hosted home. */\n readonly home: string;\n /** The route. */\n readonly routeId: string;\n /** The route's label. */\n readonly label: string;\n /** The artifact's own ID (as its manifest names it). */\n readonly artifactId: string;\n /** When it happened. */\n readonly at: string;\n /** What the kind carries. */\n readonly payload: unknown;\n}\n\n// ── the module ──────────────────────────────────────────────────────────────────────────\n\n/** The ports an operator module implements; each is optional, with the default named. */\nexport interface OperatorPorts {\n /** Allows or refuses an operation for an account. Default: allow. */\n readonly limits?: { check(q: LimitQuery): Promise<LimitAnswer> };\n /** Counters in batches, at least once. Default: discard. */\n readonly metering?: { record(batch: MeterBatch): Promise<void> };\n /**\n * Identity providers beside the configured ones, asked at each sign-in so the set can change\n * while the server runs (WP-30). Default: none.\n */\n readonly identity?: {\n providers(): Promise<readonly IdentityProvider[]> | readonly IdentityProvider[];\n };\n /**\n * Sign-in identities to accounts, a first sign-in step, and credentials the operator issued.\n * Default: the server's own accounts, no step, no outside credential.\n */\n readonly accounts?: {\n resolve(\n identity: SignInIdentity,\n context: { readonly steps: number },\n ): Promise<AccountResolution>;\n authenticate?(\n bearer: string,\n context: { readonly resource: CredentialResource },\n ): Promise<AuthenticatedCredential | null>;\n status?(account: string): Promise<\"active\" | \"suspended\">;\n };\n /** Reports and the after-push hook. Default: nothing. */\n readonly abuse?: {\n report(r: AbuseReport): Promise<void>;\n pushed?(v: PushedVersion): Promise<PushedAnswer>;\n };\n /** Per link and per chat host. Default: nothing beyond configuration. */\n readonly policy?: {\n link(q: LinkQuery): Promise<LinkPolicy>;\n chatHost?(client: {\n readonly name: string;\n readonly redirectHost?: string;\n }): Promise<ChatHostPolicy | null>;\n };\n /**\n * Hosts the operator supplies, and the host a new link is minted on. Default: the server's own\n * labels, and links on the active domain.\n */\n readonly routing?: {\n resolve(host: string): Promise<RoutingAnswer>;\n /**\n * The shell host a new link of this route is minted on (one `resolve` answers `shell` or\n * `route` for), or `null` for the active domain (WP-30). A link keeps the host it was minted\n * on (D137).\n */\n linkHost?(q: {\n readonly account: string;\n readonly home: string;\n readonly routeId: string;\n }): Promise<string | null>;\n };\n /** Outbound events, at least once with stable IDs. Default: discard. */\n readonly events?: { deliver(e: OperatorEvent): Promise<void> };\n /** Reserved for WP-31 (D121, D165 item 16); no mailer ships. */\n readonly invitations?: unknown;\n}\n\n/** A hosted route, or one version of it: what the handle's quarantine and release act on. */\nexport type RouteTarget =\n | { readonly routeId: string }\n | { readonly routeId: string; readonly versionId: string };\n\n/**\n * What the server gives its operator module (INTERFACES §18.6). Every target names a hosted route.\n * Each call is durable when it resolves.\n */\nexport interface ServerHandle {\n /** The operator boundary's revision this server speaks. */\n readonly revision: string;\n /** The server's API origin. */\n readonly apiOrigin: string;\n /** A neutral \"under review\" page from the shell; data kept; `release` restores it. */\n quarantine(target: RouteTarget, reason: string): Promise<void>;\n /** Ends a quarantine. */\n release(target: RouteTarget): Promise<void>;\n /** Views keep working; submissions and relayed actions are refused; only the operator resumes. */\n pause(routeId: string, reason: string): Promise<void>;\n /** Ends an operator's pause (and an owner's, too). */\n resume(routeId: string): Promise<void>;\n /** Refuses the home's bindings, pushes, links and pages until `resumeHome`. */\n suspendHome(home: string, reason: string): Promise<void>;\n /** Ends a suspension. */\n resumeHome(home: string): Promise<void>;\n /** Revokes every link of a route; answers how many were live. */\n revokeLinks(routeId: string): Promise<number>;\n /** Revokes one link (410 from then on). */\n revokeLink(tokenId: string): Promise<void>;\n /** Closes the home and refuses to reopen it, to move it between data directories. */\n drainHome(home: string): Promise<void>;\n /** Serves a drained home again. */\n releaseHome(home: string): Promise<void>;\n /** A restore from a backup: rotates the home's incarnation before it serves anything. */\n restored(home: string): Promise<void>;\n /** Deletion: explicit, never part of another action. The route's label is never issued again. */\n remove(routeId: string): Promise<void>;\n}\n\n/** An operator module's default export. */\nexport type OperatorModule = (server: ServerHandle) => OperatorPorts | Promise<OperatorPorts>;\n\n/** Types an operator module's default export; returns it unchanged. */\nexport function defineOperator(module: OperatorModule): OperatorModule {\n return module;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BA,MAAa,oBAAoB;;AAGjC,MAAa,uBAST;CACF,QAAQ;CACR,QAAQ;CACR,SAAS;CACT,UAAU;CACV,UAAU;CACV,cAAc;CACd,QAAQ;CACR,UAAU;AACZ;AAuDA,MAAM,WAAW,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,KAAU,CAAC,CAAC,cAAc;;AAG9D,MAAa,cAAsC,EAAE,MAAM,CACzD,EAAE,OAAO;CAAE,SAAS,EAAE,QAAQ,IAAI;CAAG,YAAY;AAAS,CAAC,GAC3D,EAAE,OAAO;CACP,SAAS,EAAE,QAAQ,KAAK;CACxB,MAAM,EAAE,OAAO,CAAC,CA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;;AA6BD,MAAM,WAAW,EACd,OAAO,CAAC,CACR,MACC,+GACF;;AAGF,MAAa,gBAA0C,EAAE,MAAM;CAC7D,EAAE,OAAO;EACP,OAAO,EAAE,OAAO;GAAE,QAAQ;GAAU,MAAM,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC;EAAE,CAAC;EAC7D,YAAY;CACd,CAAC;CACD,EAAE,OAAO;EACP,OAAO,EAAE,OAAO;GAAE,MAAM,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC;GAAG,SAAS,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC;EAAE,CAAC;EACvE,YAAY;CACd,CAAC;CACD,EAAE,KAAK;AACT,CAAC;;AAGD,MAAa,WAAqC,SAAS,SAAS;;AAsJpE,SAAgB,eAAe,QAAwC;CACrE,OAAO;AACT"}
1
+ {"version":3,"file":"operator.js","names":[],"sources":["../src/operator.ts"],"sourcesContent":["/**\n * The operator boundary of a remote server (ARCHITECTURE §15.10, INTERFACES §18.6, D165 items 9\n * and 11): the ports an operating layer implements in an ES module the server loads in process,\n * and the handle the server gives it. Each port is optional and has a no-op default, so a\n * self-hoster needs none of it; each call is async and time-limited, and the server checks every\n * answer against the schemas below before it acts on one (an answer they refuse counts as no\n * answer).\n *\n * An operating layer imports nothing of Mostra but this module (`@mostra/protocol/operator`), so\n * the surface it builds on is this file's, versioned with `@mostra/protocol` and changed only\n * additively (D32).\n *\n * ```ts\n * import { defineOperator } from \"@mostra/protocol/operator\";\n *\n * export default defineOperator((server) => ({\n * limits: { check: async (q) => (q.operation === \"share\" ? { allowed: true } : { allowed: true }) },\n * abuse: { report: async (r) => { await server.quarantine({ routeId: r.routeId }, r.reason); } },\n * }));\n * ```\n *\n * Every port call and every handle target names a hosted route (`rte_…`): an artifact ID, and a\n * version ID derived from it (D89), repeat across homes when a project is copied, so a bare ID\n * would reach every tenant hosting it.\n */\nimport * as z from \"zod\";\n\n/** The operator boundary's own revision, which a module may check (additive within it). */\nexport const OPERATOR_REVISION = \"2026-11-08\";\n\n/** How long the server waits for each port, in milliseconds, before it acts as if none answered. */\nexport const OPERATOR_TIME_LIMITS: {\n readonly limits: number;\n readonly policy: number;\n readonly routing: number;\n readonly identity: number;\n readonly accounts: number;\n readonly authenticate: number;\n readonly pushed: number;\n readonly outbound: number;\n} = {\n limits: 2_000,\n policy: 2_000,\n routing: 2_000,\n identity: 2_000,\n accounts: 5_000,\n authenticate: 5_000,\n pushed: 30_000,\n outbound: 30_000,\n};\n\n// ── limits ──────────────────────────────────────────────────────────────────────────────\n\n/**\n * An operation `limits.check` judges. When the operator doesn't answer in time, `share`,\n * `version.push`, `link` and authoring fail closed, and `view`, `submit` and draft writes proceed,\n * so nothing a person typed is lost (D165 item 9).\n */\nexport type LimitOperation =\n | \"share\"\n | \"version.push\"\n | \"link\"\n | \"view\"\n | \"submit\"\n | \"run\"\n | \"run.wait\"\n | \"call\"\n | \"mcp.call\"\n | \"storage\";\n\n/** What `limits.check` is asked. */\nexport interface LimitQuery {\n /** The account the operation counts against. */\n readonly account: string;\n /** The account's hosted home. */\n readonly home: string;\n /** The artifact, for operations on one. */\n readonly artifact?: string;\n /** The artifact's hosted route, for operations on one (WP-30). */\n readonly routeId?: string;\n /** What is asked for. */\n readonly operation: LimitOperation;\n /** How much: bytes for `storage` and `version.push`, else 1. */\n readonly quantity?: number;\n}\n\n/** How long the server may keep an answer instead of asking again, in milliseconds (WP-30). */\nexport interface Cacheable {\n /** Absent or 0: ask again next time. */\n readonly cacheForMs?: number;\n}\n\n/** `limits.check`'s answer. */\nexport type LimitAnswer =\n | ({ readonly allowed: true } & Cacheable)\n | ({\n readonly allowed: false;\n /** A diagnostic code of the operator's (the server answers `MOSTRA_REMOTE_LIMIT_REACHED`). */\n readonly code: string;\n /** Shown as text to whoever was refused. */\n readonly message: string;\n readonly retryAfterMs?: number;\n } & Cacheable);\n\nconst cacheFor = z.int().min(0).max(86_400_000).exactOptional();\n\n/** The schema the server checks `limits.check`'s answer against. */\nexport const LimitAnswer: z.ZodType<LimitAnswer> = z.union([\n z.object({ allowed: z.literal(true), cacheForMs: cacheFor }),\n z.object({\n allowed: z.literal(false),\n code: z.string().min(1).max(128),\n message: z.string().max(1_000),\n retryAfterMs: z.int().min(0).max(86_400_000).exactOptional(),\n cacheForMs: cacheFor,\n }),\n]);\n\n// ── metering ────────────────────────────────────────────────────────────────────────────\n\n/** A counter's name (INTERFACES §18.6). */\nexport type MeterName =\n | \"views\"\n | \"submissions\"\n | \"requests\"\n | \"bytes.stored\"\n | \"bytes.egress\"\n | \"relay.messages\"\n | \"mcp.calls\"\n | \"home.activeSeconds\"\n | (string & {});\n\n/**\n * One counter of a batch. `views` carry `viewerKey`, a monthly pseudonymous key (an HMAC under a\n * key the server rotates each month), never an identity: per account for a signed-in viewer, per\n * viewer for a link minted with one, and per route for an anonymous viewer, since the shell gives\n * each route a different key and none spans routes (HY-08). `mcp.calls` carry `client`, the MCP\n * client's `clientInfo` name (D148).\n */\nexport interface MeterCounter {\n /** What is counted. */\n readonly name: MeterName;\n /** The account it counts against. */\n readonly account: string;\n /** The account's hosted home. */\n readonly home?: string;\n /** The artifact, for counters of one. */\n readonly artifactId?: string;\n /** The artifact's hosted route, for counters of one. */\n readonly routeId?: string;\n /** How much in the batch's window: a count, bytes or seconds. */\n readonly value: number;\n /** What tells counters of one name apart (`viewerKey`, `client`). */\n readonly dimensions?: Readonly<Record<string, string>>;\n}\n\n/** What `metering.record` receives, at least once, idempotent by `batchId`. */\nexport interface MeterBatch {\n /** Stable across retries: a batch delivered twice is the same batch. */\n readonly batchId: string;\n /** Where the window the counters cover starts. */\n readonly from: string;\n /** Where it ends. */\n readonly to: string;\n /** The counters, one per name, account, route and dimensions. */\n readonly counters: readonly MeterCounter[];\n}\n\n// ── sign-in: identity providers and accounts ────────────────────────────────────────────\n\n/**\n * Who an identity provider says signed in (INTERFACES §18.5). `facts` carries what a provider\n * tells beyond that (GitHub's account age, `createdAt`), for an operator's policy.\n */\nexport interface SignInIdentity {\n /** The provider's ID (`IdentityProvider.id`). */\n readonly provider: string;\n /** The provider's own stable ID for the person. */\n readonly subject: string;\n /** The person's email address, when the provider gives one. */\n readonly email?: string;\n /** Whether the provider verified `email`. */\n readonly emailVerified?: boolean;\n /** The display name the provider gives. */\n readonly name?: string;\n /** What else the provider tells (an account's age as `createdAt`). */\n readonly facts?: Readonly<Record<string, unknown>>;\n}\n\n/** The schema the server checks a provider's `SignInIdentity` against. */\nexport const SignInIdentity: z.ZodType<SignInIdentity> = z.object({\n provider: z.string().regex(/^[a-z][a-z0-9-]{0,31}$/),\n subject: z.string().min(1).max(256),\n email: z.string().max(320).exactOptional(),\n emailVerified: z.boolean().exactOptional(),\n name: z.string().max(256).exactOptional(),\n facts: z.record(z.string(), z.unknown()).exactOptional(),\n});\n\n/** PKCE for one sign-in at a provider: the server makes it; the provider sends `challenge`. */\nexport interface SignInPkce {\n /** The S256 challenge the provider's authorization request carries. */\n readonly challenge: string;\n /** Always S256. */\n readonly method: \"S256\";\n /** The verifier the provider's code exchange sends. */\n readonly verifier: string;\n}\n\n/** What a provider's `authorize` and `callback` are told about the sign-in in progress. */\nexport interface SignInContext {\n /** The provider's return address on the API origin: `<apiOrigin>/signin/<id>/callback`. */\n readonly redirectUri: string;\n /** A fresh value an OpenID Connect provider binds its ID token to. */\n readonly nonce: string;\n}\n\n/**\n * An identity provider behind the sign-in port (D165 item 8): the built-in OpenID Connect and\n * GitHub adapters, a development one for tests, or one an operator module supplies.\n */\nexport interface IdentityProvider {\n /** Lower-case letters, digits and hyphens, at most 32: part of its callback's path. */\n readonly id: string;\n /** What the sign-in page calls it (\"GitHub\"). */\n readonly label: string;\n /** Where to send the person: the provider's authorization URL with `state` and PKCE. */\n authorize(state: string, pkce: SignInPkce, context: SignInContext): string | Promise<string>;\n /**\n * The person the provider names on return, from its callback's query (each parameter once; a\n * repeated one is refused before this is called). The server has already\n * checked `state`; the provider exchanges the code (with `pkce.verifier`) and checks what it\n * gets. Throws when sign-in failed.\n */\n callback(\n params: Readonly<Record<string, string>>,\n context: SignInContext & { readonly state: string; readonly pkce: SignInPkce },\n ): Promise<SignInIdentity>;\n}\n\n/**\n * `accounts.resolve`'s answer: the account (`status` `suspended` refuses sign-in), a **first\n * sign-in step** on the operator's origin, or a refusal shown as text.\n *\n * A step: the server sends the person to `step.url` with `mostra_return` added, an address on the\n * API origin (`/signin/return?step=<handle>`). The handle is single-use, lasts 15 minutes and is\n * bound to the browser that started the sign-in (a `__Host-` cookie on the API origin, never on a\n * user-content domain), so it can't be replayed or swapped. When the person comes back the server\n * calls `resolve` again with the same identity and `context.steps` one higher; at most three steps\n * per sign-in (WP-30, D167).\n */\nexport type AccountResolution =\n | {\n readonly account: string;\n readonly name?: string;\n readonly status: \"active\" | \"suspended\";\n }\n | { readonly step: { readonly url: string } }\n | { readonly refused: { readonly message: string } };\n\n/** The schema the server checks `accounts.resolve`'s answer against. */\nexport const AccountResolution: z.ZodType<AccountResolution> = z.union([\n z.object({\n account: z.string().min(1).max(128),\n name: z.string().max(256).exactOptional(),\n status: z.enum([\"active\", \"suspended\"]),\n }),\n z.object({ step: z.object({ url: z.url({ protocol: /^https$/ }).max(2_048) }) }),\n z.object({ refused: z.object({ message: z.string().max(1_000) }) }),\n]);\n\n/** Where an operator-issued credential was presented (D165 item 9, Opus review of WP-28). */\nexport type CredentialResource = \"host\" | \"mcp\" | \"files\";\n\n/**\n * `accounts.authenticate`'s answer for a credential the operator issued, or `null`. `subject`\n * names the credential stably (a service key's ID): a binding with it is one owner instance link\n * of the account, kept per subject, so a program can run an always-on owner instance.\n */\nexport interface AuthenticatedCredential {\n /** The account the credential acts for. */\n readonly account: string;\n /** What it may do: `mostra` for everything a sign-in may. */\n readonly scope: readonly string[];\n /** The credential's own stable name, which keys its instance link. */\n readonly subject?: string;\n}\n\n/** The schema the server checks `accounts.authenticate`'s answer against. */\nexport const AuthenticatedCredential: z.ZodType<AuthenticatedCredential | null> = z\n .object({\n account: z.string().min(1).max(128),\n scope: z.array(z.string().max(64)).max(32),\n subject: z\n .string()\n .regex(/^[A-Za-z0-9._:-]{1,128}$/)\n .exactOptional(),\n })\n .nullable();\n\n// ── abuse ───────────────────────────────────────────────────────────────────────────────\n\n/** A report from the shell's report control (`POST /a/{routeId}/_mostra/report`). */\nexport interface AbuseReport {\n /** The reported route. */\n readonly routeId: string;\n /** The route's label. */\n readonly label: string;\n /** The artifact's own ID (as its manifest names it). */\n readonly artifactId: string;\n /** The hosted home. */\n readonly home: string;\n /** The version the reporter saw, when the shell knew it. */\n readonly versionId?: string;\n /** The reason the reporter chose. */\n readonly reason: string;\n /** What the reporter wrote, as text. */\n readonly detail?: string;\n /** When the report was made. */\n readonly at: string;\n}\n\n/** What `abuse.pushed` receives after each version push, with read access to its client files. */\nexport interface PushedVersion {\n /** The route the version was pushed to. */\n readonly routeId: string;\n /** The route's label. */\n readonly label: string;\n /** The artifact's own ID (as its manifest names it). */\n readonly artifactId: string;\n /** The hosted home. */\n readonly home: string;\n /** The pushed version. */\n readonly versionId: string;\n /** The version's `manifest.json`, parsed. */\n readonly manifest: unknown;\n /** Every client file's path (`client/…`). */\n readonly files: readonly string[];\n /** A client file's bytes, by its path in the listing. */\n read(path: string): Promise<Uint8Array>;\n}\n\n/** `abuse.pushed`'s answer: quarantine the version, or nothing. */\nexport type PushedAnswer = { readonly quarantine?: { readonly reason: string } } | undefined;\n\n/** The schema the server checks `abuse.pushed`'s answer against. */\nexport const PushedAnswer: z.ZodType<PushedAnswer> = z\n .object({ quarantine: z.object({ reason: z.string().max(1_000) }).exactOptional() })\n .optional();\n\n// ── policy ──────────────────────────────────────────────────────────────────────────────\n\n/** What `policy.link` is asked about one link of one route. */\nexport interface LinkQuery {\n /** The account that owns the route. */\n readonly account: string;\n /** Its hosted home. */\n readonly home: string;\n /** The route. */\n readonly routeId: string;\n /** The artifact's own ID (as its manifest names it). */\n readonly artifactId: string;\n /** The link, once it exists. */\n readonly tokenId?: string;\n}\n\n/**\n * Per link and artifact (D161): an interstitial before the page, the longest link lifetime and an\n * idle expiry (durations such as `7d`), the after-submit line, the footer's wording (it can't be\n * hidden on a public link), and the made-with mark.\n */\nexport interface LinkPolicy extends Cacheable {\n /** A page the shell shows before the artifact, once per browser and link; its message as text. */\n readonly interstitial?: { readonly kind: string; readonly message?: string };\n /** The longest a link may live from when it was minted. */\n readonly maxTtl?: string;\n /** A link unused for this long expires. */\n readonly idleExpiry?: string;\n /** The line after \"Your answer was sent.\", as text. */\n readonly afterSubmit?: string;\n /** The footer's wording in place of \"Never enter passwords\", as text. */\n readonly footer?: string;\n /** Whether the made-with mark shows, and where it links. */\n readonly madeWith?: { readonly show: boolean; readonly href?: string };\n}\n\nconst duration = z.string().regex(/^[1-9][0-9]{0,8}[smhd]$/);\n\n/** The schema the server checks `policy.link`'s answer against. */\nexport const LinkPolicy: z.ZodType<LinkPolicy> = z.object({\n interstitial: z\n .object({ kind: z.string().min(1).max(64), message: z.string().max(2_000).exactOptional() })\n .exactOptional(),\n maxTtl: duration.exactOptional(),\n idleExpiry: duration.exactOptional(),\n afterSubmit: z.string().max(500).exactOptional(),\n footer: z.string().min(1).max(500).exactOptional(),\n madeWith: z\n .object({ show: z.boolean(), href: z.url({ protocol: /^https$/ }).exactOptional() })\n .exactOptional(),\n cacheForMs: cacheFor,\n});\n\n/**\n * How Mostra behaves in one chat host (D160): how a page renders there (an MCP App resource, or\n * the hosted link), and what a reached limit may say (`limit-reached` only, or the operator's\n * message).\n */\nexport interface ChatHostPolicy {\n /** `app`: through the MCP Apps resource; `link`: the hosted link only. */\n readonly render?: \"app\" | \"link\";\n /** What a reached limit may say there. */\n readonly quota?: \"limit-reached\" | \"message\";\n}\n\n/** The schema of the `ChatHostPolicy` type, for configuration and `policy.chatHost`. */\nexport const ChatHostPolicy: z.ZodType<ChatHostPolicy> = z.object({\n render: z.enum([\"app\", \"link\"]).exactOptional(),\n quota: z.enum([\"limit-reached\", \"message\"]).exactOptional(),\n});\n\n// ── routing ─────────────────────────────────────────────────────────────────────────────\n\n/**\n * `routing.resolve`'s answer for an exact `Host` the server doesn't serve by itself (any host but\n * a configured user-content domain's apex and its routes' labels):\n *\n * - `shell`: the host shows the hosted shell (`/a/<routeId>`) for one home's routes, whose frames\n * are served on `<route label>.<domain>`. `domain` is a configured user-content domain, or one\n * the operator supplies (an organization's own, whose TLS the operator's edge terminates for the\n * host and every label under `domain`); the server serves those labels once the host is\n * recorded, without asking again.\n * - `route`: the host shows the shell of one route only (`/a/<routeId>`), with its frames on its\n * label under the active domain: a chosen, readable name.\n * - `null`: nothing is served (421).\n *\n * A host the operator supplies is recorded like the server's own labels, bound to its home\n * forever: never issued to another home, so no origin's storage passes between tenants (D165).\n */\nexport type RoutingAnswer =\n | ({ readonly shell: { readonly domain: string; readonly home: string } } & Cacheable)\n | ({ readonly route: { readonly home: string; readonly routeId: string } } & Cacheable)\n | null;\n\n/**\n * A host name of at least two labels, lower case; a port only as a local test server's hosts carry\n * one (the server's own configuration allows the same).\n */\nconst hostName = z\n .string()\n .regex(\n /^(?=.{1,253}(:|$))[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)+(:\\d{1,5})?$/,\n );\n\n/** The schema the server checks `routing.resolve`'s answer against. */\nexport const RoutingAnswer: z.ZodType<RoutingAnswer> = z.union([\n z.object({\n shell: z.object({ domain: hostName, home: z.string().min(1) }),\n cacheForMs: cacheFor,\n }),\n z.object({\n route: z.object({ home: z.string().min(1), routeId: z.string().min(1) }),\n cacheForMs: cacheFor,\n }),\n z.null(),\n]);\n\n/** The schema of `routing.linkHost`'s answer: a shell host, or `null` for the active domain. */\nexport const LinkHost: z.ZodType<string | null> = hostName.nullable();\n\n// ── events ──────────────────────────────────────────────────────────────────────────────\n\n/** The kind of an outbound event. */\nexport type OperatorEventKind =\n | \"submission.accepted\"\n | \"version.pushed\"\n | \"run.ended\"\n | \"roster.completed\"\n | (string & {});\n\n/**\n * One outbound event, delivered at least once with a stable `eventId`. `payload`:\n * `submission.accepted` carries the submission's `Results` (INTERFACES §8, the `Results` type of `@mostra/protocol`); `version.pushed`\n * `{ versionId, number }`; `run.ended` `{ runId, action, status }`; `roster.completed`\n * `{ round, respondents, submissions: { ref, submissionId }[] }`, when every expected respondent\n * answered (D168).\n * `label` is the route's label, so an operator running several servers behind one front learns\n * which serves which label (WP-30).\n */\nexport interface OperatorEvent {\n /** Stable across retries. */\n readonly eventId: string;\n /** What happened. */\n readonly kind: OperatorEventKind;\n /** The account that owns the route. */\n readonly account: string;\n /** Its hosted home. */\n readonly home: string;\n /** The route. */\n readonly routeId: string;\n /** The route's label. */\n readonly label: string;\n /** The artifact's own ID (as its manifest names it). */\n readonly artifactId: string;\n /** When it happened. */\n readonly at: string;\n /** What the kind carries. */\n readonly payload: unknown;\n}\n\n// ── the module ──────────────────────────────────────────────────────────────────────────\n\n/** The ports an operator module implements; each is optional, with the default named. */\nexport interface OperatorPorts {\n /** Allows or refuses an operation for an account. Default: allow. */\n readonly limits?: { check(q: LimitQuery): Promise<LimitAnswer> };\n /** Counters in batches, at least once. Default: discard. */\n readonly metering?: { record(batch: MeterBatch): Promise<void> };\n /**\n * Identity providers beside the configured ones, asked at each sign-in so the set can change\n * while the server runs (WP-30). Default: none.\n */\n readonly identity?: {\n providers(): Promise<readonly IdentityProvider[]> | readonly IdentityProvider[];\n };\n /**\n * Sign-in identities to accounts, a first sign-in step, and credentials the operator issued.\n * Default: the server's own accounts, no step, no outside credential.\n */\n readonly accounts?: {\n resolve(\n identity: SignInIdentity,\n context: { readonly steps: number },\n ): Promise<AccountResolution>;\n authenticate?(\n bearer: string,\n context: { readonly resource: CredentialResource },\n ): Promise<AuthenticatedCredential | null>;\n status?(account: string): Promise<\"active\" | \"suspended\">;\n };\n /** Reports and the after-push hook. Default: nothing. */\n readonly abuse?: {\n report(r: AbuseReport): Promise<void>;\n pushed?(v: PushedVersion): Promise<PushedAnswer>;\n };\n /** Per link and per chat host. Default: nothing beyond configuration. */\n readonly policy?: {\n link(q: LinkQuery): Promise<LinkPolicy>;\n chatHost?(client: {\n readonly name: string;\n readonly redirectHost?: string;\n }): Promise<ChatHostPolicy | null>;\n };\n /**\n * Hosts the operator supplies, and the host a new link is minted on. Default: the server's own\n * labels, and links on the active domain.\n */\n readonly routing?: {\n resolve(host: string): Promise<RoutingAnswer>;\n /**\n * The shell host a new link of this route is minted on (one `resolve` answers `shell` or\n * `route` for), or `null` for the active domain (WP-30). A link keeps the host it was minted\n * on (D137).\n */\n linkHost?(q: {\n readonly account: string;\n readonly home: string;\n readonly routeId: string;\n }): Promise<string | null>;\n };\n /** Outbound events, at least once with stable IDs. Default: discard. */\n readonly events?: { deliver(e: OperatorEvent): Promise<void> };\n /**\n * Invitations to expected respondents (D121, D168): for each respondent a hosted roster names\n * with an `email`, when they are added or their personal link is replaced, so the operator can\n * mail them their link. At least once, ordered per home, with a stable `invitationId`. No mailer\n * ships: the open server only hands them over. Default: none sent.\n */\n readonly invitations?: { send(invitation: Invitation): Promise<void> };\n}\n\n/**\n * One invitation (D168). `url` is the respondent's personal link, a capability URL whose secret is\n * in its fragment: the server never stores or logs it (it builds it from the link's token when it\n * hands the invitation over), so the operator mails it and keeps it no longer than that.\n */\nexport interface Invitation {\n /** Stable across retries: `<home>:<tokenId>`, one per personal link. */\n readonly invitationId: string;\n /** The account that owns the route. */\n readonly account: string;\n /** Its hosted home. */\n readonly home: string;\n /** The route. */\n readonly routeId: string;\n /** The route's label. */\n readonly label: string;\n /** The artifact's ID. */\n readonly artifactId: string;\n /** The artifact's title, as its latest version names it. */\n readonly title: string;\n /** Who is invited: the owner's key for them, their name and the address to write to. */\n readonly respondent: { readonly ref: string; readonly name?: string; readonly email: string };\n /** Who invites: the owner's display name and the provider that verified it, when one did. */\n readonly sender: { readonly name?: string; readonly verifiedBy?: string };\n /** The personal link. */\n readonly url: string;\n /** When the link stops working, when it has a lifetime. */\n readonly expiresAt?: string;\n /** When the respondent was added, or their link replaced. */\n readonly at: string;\n}\n\n/** A hosted route, or one version of it: what the handle's quarantine and release act on. */\nexport type RouteTarget =\n | { readonly routeId: string }\n | { readonly routeId: string; readonly versionId: string };\n\n/**\n * What the server gives its operator module (INTERFACES §18.6). Every target names a hosted route.\n * Each call is durable when it resolves.\n */\nexport interface ServerHandle {\n /** The operator boundary's revision this server speaks. */\n readonly revision: string;\n /** The server's API origin. */\n readonly apiOrigin: string;\n /** A neutral \"under review\" page from the shell; data kept; `release` restores it. */\n quarantine(target: RouteTarget, reason: string): Promise<void>;\n /** Ends a quarantine. */\n release(target: RouteTarget): Promise<void>;\n /** Views keep working; submissions and relayed actions are refused; only the operator resumes. */\n pause(routeId: string, reason: string): Promise<void>;\n /** Ends an operator's pause (and an owner's, too). */\n resume(routeId: string): Promise<void>;\n /** Refuses the home's bindings, pushes, links and pages until `resumeHome`. */\n suspendHome(home: string, reason: string): Promise<void>;\n /** Ends a suspension. */\n resumeHome(home: string): Promise<void>;\n /** Revokes every link of a route; answers how many were live. */\n revokeLinks(routeId: string): Promise<number>;\n /** Revokes one link (410 from then on). */\n revokeLink(tokenId: string): Promise<void>;\n /** Closes the home and refuses to reopen it, to move it between data directories. */\n drainHome(home: string): Promise<void>;\n /** Serves a drained home again. */\n releaseHome(home: string): Promise<void>;\n /** A restore from a backup: rotates the home's incarnation before it serves anything. */\n restored(home: string): Promise<void>;\n /** Deletion: explicit, never part of another action. The route's label is never issued again. */\n remove(routeId: string): Promise<void>;\n}\n\n/** An operator module's default export. */\nexport type OperatorModule = (server: ServerHandle) => OperatorPorts | Promise<OperatorPorts>;\n\n/** Types an operator module's default export; returns it unchanged. */\nexport function defineOperator(module: OperatorModule): OperatorModule {\n return module;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BA,MAAa,oBAAoB;;AAGjC,MAAa,uBAST;CACF,QAAQ;CACR,QAAQ;CACR,SAAS;CACT,UAAU;CACV,UAAU;CACV,cAAc;CACd,QAAQ;CACR,UAAU;AACZ;AAuDA,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AE,UAAU,UAAU,CAAC,CAAC,CAAC,cAAc;CAAE,CAAC,CAAC,CACnF,cAAc;CACjB,YAAY;AACd,CAAC;;AAeD,MAAa,iBAA4C,EAAE,OAAO;CAChE,QAAQ,EAAE,KAAK,CAAC,OAAO,MAAM,CAAC,CAAC,CAAC,cAAc;CAC9C,OAAO,EAAE,KAAK,CAAC,iBAAiB,SAAS,CAAC,CAAC,CAAC,cAAc;AAC5D,CAAC;;;;;AA6BD,MAAM,WAAW,EACd,OAAO,CAAC,CACR,MACC,+GACF;;AAGF,MAAa,gBAA0C,EAAE,MAAM;CAC7D,EAAE,OAAO;EACP,OAAO,EAAE,OAAO;GAAE,QAAQ;GAAU,MAAM,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC;EAAE,CAAC;EAC7D,YAAY;CACd,CAAC;CACD,EAAE,OAAO;EACP,OAAO,EAAE,OAAO;GAAE,MAAM,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC;GAAG,SAAS,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC;EAAE,CAAC;EACvE,YAAY;CACd,CAAC;CACD,EAAE,KAAK;AACT,CAAC;;AAGD,MAAa,WAAqC,SAAS,SAAS;;AA6LpE,SAAgB,eAAe,QAAwC;CACrE,OAAO;AACT"}
@@ -0,0 +1,21 @@
1
+ import * as z from "zod";
2
+ //#region src/team-settings.d.ts
3
+ /**
4
+ * What viewers see of each other's respondent status and presence (CO-07, D168): `private` (their
5
+ * own entry only), `counts` (their own entry and how many stand where), `names` (everyone's name and
6
+ * status). The manifest's `team.visibility`; owners, agents and hosts always see everything.
7
+ */
8
+ export type TeamVisibility = "private" | "counts" | "names";
9
+ /** The Zod schema of the `TeamVisibility` type. */
10
+ export declare const TeamVisibility: z.ZodType<TeamVisibility>;
11
+ /** The visibility an artifact gets when its manifest names none (D168: private unless it opts in). */
12
+ export declare const DEFAULT_TEAM_VISIBILITY: TeamVisibility;
13
+ /** The manifest's `team` settings (D168). */
14
+ export interface TeamSettings {
15
+ /** What viewers see of each other's status and presence; default `private`. */
16
+ readonly visibility?: TeamVisibility;
17
+ }
18
+ /** The Zod schema of the `TeamSettings` type. */
19
+ export declare const TeamSettings: z.ZodType<TeamSettings>;
20
+ //#endregion
21
+ //# sourceMappingURL=team-settings.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"team-settings.d.ts","names":[],"sources":["../src/team-settings.ts"],"mappings":";;;;;;;YAYY;;qBAGC,gBAAgB,EAAE,QAAQ;;qBAQ1B,yBAAyB;;iBAGrB;;WAEN,aAAa;;;qBAIX,cAAc,EAAE,QAAQ"}
@@ -0,0 +1,27 @@
1
+ import { wireRegistry } from "./wire-registry.js";
2
+ import * as z from "zod";
3
+ //#region src/team-settings.ts
4
+ /**
5
+ * The manifest's `team` settings (D168): a module of its own, with no other import of the
6
+ * protocol, so the manifest reads them without the team wire types.
7
+ */
8
+ /** The Zod schema of the `TeamVisibility` type. */
9
+ const TeamVisibility = z.enum([
10
+ "private",
11
+ "counts",
12
+ "names"
13
+ ]).register(wireRegistry, {
14
+ id: "TeamVisibility",
15
+ description: "What viewers see of each other: private, counts or names (D168)."
16
+ });
17
+ /** The visibility an artifact gets when its manifest names none (D168: private unless it opts in). */
18
+ const DEFAULT_TEAM_VISIBILITY = "private";
19
+ /** The Zod schema of the `TeamSettings` type. */
20
+ const TeamSettings = z.object({ visibility: TeamVisibility.exactOptional() }).register(wireRegistry, {
21
+ id: "TeamSettings",
22
+ description: "An artifact's team settings: what viewers see of each other (D168)."
23
+ });
24
+ //#endregion
25
+ export { DEFAULT_TEAM_VISIBILITY, TeamSettings, TeamVisibility };
26
+
27
+ //# sourceMappingURL=team-settings.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"team-settings.js","names":[],"sources":["../src/team-settings.ts"],"sourcesContent":["/**\n * The manifest's `team` settings (D168): a module of its own, with no other import of the\n * protocol, so the manifest reads them without the team wire types.\n */\nimport * as z from \"zod\";\nimport { wireRegistry } from \"./wire-registry.ts\";\n\n/**\n * What viewers see of each other's respondent status and presence (CO-07, D168): `private` (their\n * own entry only), `counts` (their own entry and how many stand where), `names` (everyone's name and\n * status). The manifest's `team.visibility`; owners, agents and hosts always see everything.\n */\nexport type TeamVisibility = \"private\" | \"counts\" | \"names\";\n\n/** The Zod schema of the `TeamVisibility` type. */\nexport const TeamVisibility: z.ZodType<TeamVisibility> = z\n .enum([\"private\", \"counts\", \"names\"])\n .register(wireRegistry, {\n id: \"TeamVisibility\",\n description: \"What viewers see of each other: private, counts or names (D168).\",\n });\n\n/** The visibility an artifact gets when its manifest names none (D168: private unless it opts in). */\nexport const DEFAULT_TEAM_VISIBILITY: TeamVisibility = \"private\";\n\n/** The manifest's `team` settings (D168). */\nexport interface TeamSettings {\n /** What viewers see of each other's status and presence; default `private`. */\n readonly visibility?: TeamVisibility;\n}\n\n/** The Zod schema of the `TeamSettings` type. */\nexport const TeamSettings: z.ZodType<TeamSettings> = z\n .object({ visibility: TeamVisibility.exactOptional() })\n .register(wireRegistry, {\n id: \"TeamSettings\",\n description: \"An artifact's team settings: what viewers see of each other (D168).\",\n });\n"],"mappings":";;;;;;;;AAeA,MAAa,iBAA4C,EACtD,KAAK;CAAC;CAAW;CAAU;AAAO,CAAC,CAAC,CACpC,SAAS,cAAc;CACtB,IAAI;CACJ,aAAa;AACf,CAAC;;AAGH,MAAa,0BAA0C;;AASvD,MAAa,eAAwC,EAClD,OAAO,EAAE,YAAY,eAAe,cAAc,EAAE,CAAC,CAAC,CACtD,SAAS,cAAc;CACtB,IAAI;CACJ,aAAa;AACf,CAAC"}
package/dist/team.d.ts ADDED
@@ -0,0 +1,221 @@
1
+ import { DEFAULT_TEAM_VISIBILITY, TeamSettings, TeamVisibility } from "./team-settings.js";
2
+ import { ViewerKind } from "./interaction.js";
3
+ import * as z from "zod";
4
+ //#region src/team.d.ts
5
+ /** The most expected respondents one artifact's roster holds. */
6
+ export declare const ROSTER_MAX = 1e3;
7
+ /**
8
+ * An expected respondent as a host or agent names them (D121): the host's stable key for the
9
+ * person (`view/url`'s `viewer.ref`, D104), their display name, and an email address a remote
10
+ * server may send an invitation to (its operator's `invitations` port; nothing is sent locally).
11
+ */
12
+ export interface RespondentSpec {
13
+ /** The host's stable key for this person, such as an email or an account ID (D104). */
14
+ readonly ref: string;
15
+ /** The name people see; updated when given again. */
16
+ readonly name?: string;
17
+ /** Where a remote server's operator may send this person's invitation. Never sent by Mostra. */
18
+ readonly email?: string;
19
+ }
20
+ /** The Zod schema of the `RespondentSpec` type. */
21
+ export declare const RespondentSpec: z.ZodType<RespondentSpec>;
22
+ /**
23
+ * Where an expected respondent stands in the roster's current round (CO-03): `not-opened` (no view
24
+ * of the artifact since the round began), `drafting` (opened it or wrote their draft since), or
25
+ * `submitted` (a submission in the round). Open for later states on the wire.
26
+ */
27
+ export type RespondentStatus = "not-opened" | "drafting" | "submitted";
28
+ /** The Zod schema of the `RespondentStatus` type. */
29
+ export declare const RespondentStatus: z.ZodType<RespondentStatus>;
30
+ /** How many respondents stand where, in the current round. */
31
+ export interface RosterCounts {
32
+ /** Every expected respondent. */
33
+ readonly total: number;
34
+ /** How many haven't opened the artifact in the round. */
35
+ readonly notOpened: number;
36
+ /** How many opened it or wrote their draft in the round, without submitting. */
37
+ readonly drafting: number;
38
+ /** How many submitted in the round. */
39
+ readonly submitted: number;
40
+ }
41
+ /** The Zod schema of the `RosterCounts` type. */
42
+ export declare const RosterCounts: z.ZodType<RosterCounts>;
43
+ /** One expected respondent as agents and hosts read it (`roster/get`): everything. */
44
+ export interface Respondent {
45
+ /** The host's stable key for the person. */
46
+ readonly ref: string;
47
+ /** The display name. */
48
+ readonly name?: string;
49
+ /** The invitation address, when one was given. */
50
+ readonly email?: string;
51
+ /** The viewer the person's personal link acts as (D104). */
52
+ readonly viewerId: string;
53
+ /** Where they stand in the current round. */
54
+ readonly status: RespondentStatus;
55
+ /** When they first opened the artifact. */
56
+ readonly openedAt?: string;
57
+ /** When they last opened it or wrote their draft. */
58
+ readonly activeAt?: string;
59
+ /** Their submission in the current round, when they made one. */
60
+ readonly submission?: {
61
+ readonly id: string;
62
+ readonly at: string;
63
+ };
64
+ /** How many submissions they made in all. */
65
+ readonly submissions: number;
66
+ /** Their personal link's token, for `view/rotate` and `view/revoke`; absent once revoked. */
67
+ readonly tokenId?: string;
68
+ /** When they joined the roster. */
69
+ readonly addedAt: string;
70
+ }
71
+ /** The Zod schema of the `Respondent` type. */
72
+ export declare const Respondent: z.ZodType<Respondent>;
73
+ /** An artifact's roster as agents and hosts read it (`roster/get`). */
74
+ export interface Roster {
75
+ /** The roster's round (D168): always 1 under `once`; under `epochs`, one more after each completion. */
76
+ readonly round: number;
77
+ /** Whether every expected respondent has submitted in the round; an empty roster never has. */
78
+ readonly complete: boolean;
79
+ /** What viewers see of each other (the manifest's `team.visibility`). */
80
+ readonly visibility: TeamVisibility;
81
+ /** How many stand where in the round. */
82
+ readonly counts: RosterCounts;
83
+ /** Every expected respondent, in the order they joined. */
84
+ readonly respondents: readonly Respondent[];
85
+ }
86
+ /** The Zod schema of the `Roster` type. */
87
+ export declare const Roster: z.ZodType<Roster>;
88
+ /**
89
+ * Another viewer as a page may see them: an opaque key that is stable for one viewer of one
90
+ * artifact (never a viewer or view ID, D104), their display name and how Mostra knows them.
91
+ */
92
+ export interface Peer {
93
+ /** Stable for one viewer of one artifact, different across artifacts; `self` marks the page's own. */
94
+ readonly key: string;
95
+ /** Whether this is the page's own viewer. */
96
+ readonly self: boolean;
97
+ /** The display name, when one is known. */
98
+ readonly name?: string;
99
+ /** How Mostra knows the viewer. */
100
+ readonly kind: ViewerKind;
101
+ /** On a hosted link: whether a provider verified the name (D165 item 8). */
102
+ readonly verified?: boolean;
103
+ }
104
+ /** One respondent as a page sees them under the visibility policy. */
105
+ export interface RespondentForPage extends Peer {
106
+ /** Where they stand in the round. */
107
+ readonly status: RespondentStatus;
108
+ /** When they first opened the artifact. */
109
+ readonly openedAt?: string;
110
+ /** When they submitted in the round. */
111
+ readonly submittedAt?: string;
112
+ }
113
+ /** The Zod schema of the `RespondentForPage` type. */
114
+ export declare const RespondentForPage: z.ZodType<RespondentForPage>;
115
+ /**
116
+ * The roster as one page may see it (CO-03, CO-07): under `private` only the viewer's own entry,
117
+ * under `counts` also the counts and whether the round is complete, under `names` every respondent.
118
+ * The owner's page sees as under `names`.
119
+ */
120
+ export interface RosterForPage {
121
+ /** The policy that decided what this answer holds. */
122
+ readonly visibility: TeamVisibility;
123
+ /** Whether this page's viewer sees everything as the artifact's owner. */
124
+ readonly owner: boolean;
125
+ /** The roster's round (always 1 under `once`). */
126
+ readonly round: number;
127
+ /** The viewer's own entry, when they are an expected respondent. */
128
+ readonly self?: RespondentForPage;
129
+ /** Under `counts` and `names`, and for the owner. */
130
+ readonly counts?: RosterCounts;
131
+ /** Under `counts` and `names`, and for the owner. */
132
+ readonly complete?: boolean;
133
+ /** Under `names`, and for the owner: every respondent, in the order they joined. */
134
+ readonly respondents?: readonly RespondentForPage[];
135
+ }
136
+ /** The Zod schema of the `RosterForPage` type. */
137
+ export declare const RosterForPage: z.ZodType<RosterForPage>;
138
+ /** `POST …/respondents`: reads the roster as the page may see it and follows it for a minute. */
139
+ export interface RespondentsRequest {
140
+ /** The view the page was opened as (D104). */
141
+ readonly viewId: string;
142
+ }
143
+ /** The Zod schema of the `RespondentsRequest` type. */
144
+ export declare const RespondentsRequest: z.ZodType<RespondentsRequest>;
145
+ /** The largest coordinate a shared cursor may carry, in CSS pixels. */
146
+ export declare const PRESENCE_COORDINATE_MAX = 1e7;
147
+ /** A shared pointer position, in the page's document coordinates (CSS pixels). */
148
+ export interface PresenceCursor {
149
+ /** From the document's left edge. */
150
+ readonly x: number;
151
+ /** From the document's top edge. */
152
+ readonly y: number;
153
+ }
154
+ /** The Zod schema of the `PresenceCursor` type. */
155
+ export declare const PresenceCursor: z.ZodType<PresenceCursor>;
156
+ /**
157
+ * A shared selection: the element the viewer is in (its `data-presence-id`, `id` or `name`) and,
158
+ * in a text input, the selected range.
159
+ */
160
+ export interface PresenceSelection {
161
+ /** The element: its `data-presence-id`, `id` or `name`. */
162
+ readonly element?: string;
163
+ /** In a text input, where the selection starts. */
164
+ readonly start?: number;
165
+ /** In a text input, where it ends. */
166
+ readonly end?: number;
167
+ }
168
+ /** The Zod schema of the `PresenceSelection` type. */
169
+ export declare const PresenceSelection: z.ZodType<PresenceSelection>;
170
+ /**
171
+ * `POST …/presence`: the page joins presence for the next half minute, sharing what it gives
172
+ * (CO-04). `cursor` and `selection` replace what the page shared (`null` stops sharing it); `leave`
173
+ * ends the page's presence at once. Never stored.
174
+ */
175
+ export interface PresenceRequest {
176
+ /** The view the page was opened as (D104). */
177
+ readonly viewId: string;
178
+ /** The pointer to share; `null` stops sharing it; absent leaves it as it was. */
179
+ readonly cursor?: PresenceCursor | null;
180
+ /** The selection to share; `null` stops sharing it; absent leaves it as it was. */
181
+ readonly selection?: PresenceSelection | null;
182
+ /** Ends the page's presence now. */
183
+ readonly leave?: true;
184
+ /**
185
+ * The page's own count of its presence posts, growing with each (a leave included): a post the
186
+ * gateway gets after one with a higher count, such as an update that overtook the page's leave,
187
+ * changes nothing.
188
+ */
189
+ readonly seq?: number;
190
+ }
191
+ /** The Zod schema of the `PresenceRequest` type. */
192
+ export declare const PresenceRequest: z.ZodType<PresenceRequest>;
193
+ /** A viewer present on the artifact now, as a page may see them. */
194
+ export interface PresencePeer extends Peer {
195
+ /** Their pointer, when they share it. */
196
+ readonly cursor?: PresenceCursor;
197
+ /** Their selection, when they share it. */
198
+ readonly selection?: PresenceSelection;
199
+ /** When they last told Mostra anything. */
200
+ readonly at: string;
201
+ }
202
+ /** The Zod schema of the `PresencePeer` type. */
203
+ export declare const PresencePeer: z.ZodType<PresencePeer>;
204
+ /**
205
+ * Who is present, as one page may see it (CO-04, CO-07): under `names` (or for the owner) every
206
+ * present viewer with what they share; under `counts` how many others are present; under
207
+ * `private` only the page's own viewer.
208
+ */
209
+ export interface PresenceState {
210
+ /** The policy that decided what this answer holds. */
211
+ readonly visibility: TeamVisibility;
212
+ /** Present viewers this page may see, its own first. */
213
+ readonly peers: readonly PresencePeer[];
214
+ /** How many other viewers are present, under `counts` and `names`. */
215
+ readonly others?: number;
216
+ }
217
+ /** The Zod schema of the `PresenceState` type. */
218
+ export declare const PresenceState: z.ZodType<PresenceState>;
219
+ //#endregion
220
+ export { DEFAULT_TEAM_VISIBILITY, TeamSettings, TeamVisibility };
221
+ //# sourceMappingURL=team.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"team.d.ts","names":[],"sources":["../src/team.ts"],"mappings":";;;;;qBAkBa;;;;;;iBAOI;;WAEN;;WAEA;;WAEA;;;qBAIE,gBAAgB,EAAE,QAAQ;;;;;;YAoB3B;;qBAGC,kBAAkB,EAAE,QAAQ;;iBAQxB;;WAEN;;WAEA;;WAEA;;WAEA;;;qBAIE,cAAc,EAAE,QAAQ;;iBAapB;;WAEN;;WAEA;;WAEA;;WAEA;;WAEA,QAAQ;;WAER;;WAEA;;WAEA;aAAwB;aAAqB;;;WAE7C;;WAEA;;WAEA;;;qBAIE,YAAY,EAAE,QAAQ;;iBAqBlB;;WAEN;;WAEA;;WAEA,YAAY;;WAEZ,QAAQ;;WAER,sBAAsB;;;qBAIpB,QAAQ,EAAE,QAAQ;;;;;iBAiBd;;WAEN;;WAEA;;WAEA;;WAEA,MAAM;;WAEN;;;iBAYM,0BAA0B;;WAEhC,QAAQ;;WAER;;WAEA;;;qBAIE,mBAAmB,EAAE,QAAQ;;;;;;iBAiBzB;;WAEN,YAAY;;WAEZ;;WAEA;;WAEA,OAAO;;WAEP,SAAS;;WAET;;WAEA,uBAAuB;;;qBAIrB,eAAe,EAAE,QAAQ;;iBAgBrB;;WAEN;;;qBAIE,oBAAoB,EAAE,QAAQ;;qBAU9B;;iBAGI;;WAEN;;WAEA;;;qBAIE,gBAAgB,EAAE,QAAQ;;;;;iBActB;;WAEN;;WAEA;;WAEA;;;qBAIE,mBAAmB,EAAE,QAAQ;;;;;;iBAgBzB;;WAE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