@mostra/protocol 0.6.2 → 0.8.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 (73) hide show
  1. package/dist/actions.d.ts +12 -0
  2. package/dist/actions.d.ts.map +1 -1
  3. package/dist/actions.js.map +1 -1
  4. package/dist/bridge.d.ts +25 -0
  5. package/dist/bridge.d.ts.map +1 -1
  6. package/dist/bridge.js +32 -2
  7. package/dist/bridge.js.map +1 -1
  8. package/dist/browser.d.ts +76 -0
  9. package/dist/browser.d.ts.map +1 -1
  10. package/dist/browser.js +45 -2
  11. package/dist/browser.js.map +1 -1
  12. package/dist/diagnostics/codes/hygiene.d.ts +1 -1
  13. package/dist/diagnostics/codes/hygiene.d.ts.map +1 -1
  14. package/dist/diagnostics/codes/hygiene.js +12 -1
  15. package/dist/diagnostics/codes/hygiene.js.map +1 -1
  16. package/dist/diagnostics/codes/index.d.ts +3 -2
  17. package/dist/diagnostics/codes/index.d.ts.map +1 -1
  18. package/dist/diagnostics/codes/index.js +3 -1
  19. package/dist/diagnostics/codes/index.js.map +1 -1
  20. package/dist/diagnostics/codes/share.d.ts +8 -0
  21. package/dist/diagnostics/codes/share.d.ts.map +1 -0
  22. package/dist/diagnostics/codes/share.js +88 -0
  23. package/dist/diagnostics/codes/share.js.map +1 -0
  24. package/dist/hygiene.d.ts.map +1 -1
  25. package/dist/hygiene.js +2 -1
  26. package/dist/hygiene.js.map +1 -1
  27. package/dist/ids.d.ts +5 -1
  28. package/dist/ids.d.ts.map +1 -1
  29. package/dist/ids.js +3 -1
  30. package/dist/ids.js.map +1 -1
  31. package/dist/index.d.ts +10 -5
  32. package/dist/index.js +9 -4
  33. package/dist/methods/index.d.ts.map +1 -1
  34. package/dist/methods/index.js +9 -1
  35. package/dist/methods/index.js.map +1 -1
  36. package/dist/methods/instance/status.d.ts +24 -0
  37. package/dist/methods/instance/status.d.ts.map +1 -1
  38. package/dist/methods/instance/status.js +11 -2
  39. package/dist/methods/instance/status.js.map +1 -1
  40. package/dist/methods/port/addressing-external-base.d.ts +52 -0
  41. package/dist/methods/port/addressing-external-base.d.ts.map +1 -0
  42. package/dist/methods/port/addressing-external-base.js +61 -0
  43. package/dist/methods/port/addressing-external-base.js.map +1 -0
  44. package/dist/methods/share/list.d.ts +23 -0
  45. package/dist/methods/share/list.d.ts.map +1 -0
  46. package/dist/methods/share/list.js +29 -0
  47. package/dist/methods/share/list.js.map +1 -0
  48. package/dist/methods/share/start.d.ts +96 -0
  49. package/dist/methods/share/start.d.ts.map +1 -0
  50. package/dist/methods/share/start.js +73 -0
  51. package/dist/methods/share/start.js.map +1 -0
  52. package/dist/methods/share/stop.d.ts +29 -0
  53. package/dist/methods/share/stop.d.ts.map +1 -0
  54. package/dist/methods/share/stop.js +32 -0
  55. package/dist/methods/share/stop.js.map +1 -0
  56. package/package.json +2 -2
  57. package/schemas/protocol.draft-07.json +535 -0
  58. package/schemas/protocol.schema.json +507 -0
  59. package/src/actions.ts +12 -0
  60. package/src/bridge.ts +49 -0
  61. package/src/browser.ts +118 -0
  62. package/src/diagnostics/codes/hygiene.ts +12 -0
  63. package/src/diagnostics/codes/index.ts +6 -2
  64. package/src/diagnostics/codes/share.ts +100 -0
  65. package/src/hygiene.ts +1 -0
  66. package/src/ids.ts +9 -1
  67. package/src/index.ts +39 -0
  68. package/src/methods/index.ts +8 -0
  69. package/src/methods/instance/status.ts +38 -0
  70. package/src/methods/port/addressing-external-base.ts +113 -0
  71. package/src/methods/share/list.ts +42 -0
  72. package/src/methods/share/start.ts +150 -0
  73. package/src/methods/share/stop.ts +50 -0
package/dist/ids.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"ids.js","names":[],"sources":["../src/ids.ts"],"sourcesContent":["/**\n * Prefixed, opaque identifiers (INTERFACES §1, DATA_MODEL §2).\n *\n * Every Mostra entity is named by a string of the form `<prefix>_<body>`. Callers treat IDs as\n * opaque: they validate the form at a boundary and never read meaning out of the body. Each ID\n * kind below is both a type and a value with the same name:\n *\n * ```ts\n * const artifact: ArtifactId = ArtifactId.parse(input);\n * const mutation: MutationId = MutationId.create();\n * const Params = z.object({ artifactId: ArtifactId.schema });\n * ```\n *\n * @packageDocumentation\n */\nimport * as z from \"zod\";\nimport { wireRegistry } from \"./wire-registry.ts\";\n\n/** The prefixes INTERFACES §1 assigns, one per entity. */\nexport type IdPrefix =\n | \"art\"\n | \"ver\"\n | \"vw\"\n | \"vwr\"\n | \"sub\"\n | \"dlv\"\n | \"run\"\n | \"thr\"\n | \"cmt\"\n | \"tok\"\n | \"mut\";\n\n/**\n * A branded ID string. The brand exists only at the type level, so an `Id<\"art\">` is a plain\n * string at run time and on the wire.\n */\nexport type Id<P extends IdPrefix> = `${P}_${string}` & { readonly __mostraIdPrefix: P };\n\n/** How an ID kind's body is formed. */\nexport type IdBody = \"ulid\" | \"sha256-base32\";\n\n/** One ID kind: its prefix, validation and schema. */\nexport interface IdKind<P extends IdPrefix> {\n /** The prefix, without the underscore. */\n readonly prefix: P;\n /** The entity the ID names, in the PRODUCT vocabulary. */\n readonly entity: string;\n /** How the body is formed. */\n readonly body: IdBody;\n /** The exact form, anchored at both ends. */\n readonly pattern: RegExp;\n /** The Zod schema for this ID, registered for JSON Schema output under the kind's type name. */\n readonly schema: z.ZodType<Id<P>, string>;\n /** Whether `value` is an ID of this kind. */\n is(value: unknown): value is Id<P>;\n /**\n * Returns `value` as an ID of this kind.\n *\n * @throws TypeError when `value` is not of this kind's form. The message names the expected\n * form and never echoes the input.\n */\n parse(value: string): Id<P>;\n}\n\n/** An ID kind whose body is a ULID that the creator generates. */\nexport interface GeneratedIdKind<P extends IdPrefix> extends IdKind<P> {\n /** Generates a new ID from the current time and 80 bits of Web Crypto randomness. */\n create(): Id<P>;\n}\n\n/** Crockford's base32 alphabet, used by ULIDs and by content-addressed version IDs. */\nconst CROCKFORD = \"0123456789ABCDEFGHJKMNPQRSTVWXYZ\";\nconst BODY_LENGTH = 26;\n/** A ULID's first character encodes at most 3 bits (48-bit time in 26 × 5 = 130 bits). */\nconst ULID_BODY = \"[0-7][0-9A-HJKMNP-TV-Z]{25}\";\nconst BASE32_BODY = \"[0-9A-HJKMNP-TV-Z]{26}\";\n\nfunction defineKind<P extends IdPrefix>(\n prefix: P,\n entity: string,\n body: IdBody,\n typeName: string,\n): IdKind<P> {\n const pattern = new RegExp(`^${prefix}_${body === \"ulid\" ? ULID_BODY : BASE32_BODY}$`);\n const form = body === \"ulid\" ? \"a 26-character ULID\" : \"26 characters of Crockford base32\";\n const is = (value: unknown): value is Id<P> => typeof value === \"string\" && pattern.test(value);\n const schema = z\n .string()\n .regex(pattern)\n .register(wireRegistry, {\n id: typeName,\n description: `${entity[0]?.toUpperCase()}${entity.slice(1)} ID: \"${prefix}_\" followed by ${form}.`,\n }) as unknown as z.ZodType<Id<P>, string>;\n return {\n prefix,\n entity,\n body,\n pattern,\n schema,\n is,\n parse(value: string): Id<P> {\n if (is(value)) return value;\n throw new TypeError(`Expected ${entity} ID \"${prefix}_\" followed by ${form}.`);\n },\n };\n}\n\nfunction generated<P extends IdPrefix>(kind: IdKind<P>): GeneratedIdKind<P> {\n return { ...kind, create: () => kind.parse(`${kind.prefix}_${ulidBody(Date.now())}`) };\n}\n\n/**\n * Encodes a ULID body: 48 bits of milliseconds since the Unix epoch, then 80 random bits, as 26\n * Crockford base32 characters.\n */\nfunction ulidBody(now: number): string {\n if (!Number.isSafeInteger(now) || now < 0 || now > 0xffff_ffff_ffff) {\n throw new RangeError(\"ULID time must be a millisecond timestamp between 0 and 2^48 - 1.\");\n }\n let time = \"\";\n let rest = now;\n for (let i = 0; i < 10; i++) {\n time = CROCKFORD.charAt(rest % 32) + time;\n rest = Math.floor(rest / 32);\n }\n const random = new Uint8Array(10);\n globalThis.crypto.getRandomValues(random);\n return time + base32(random).slice(0, 16);\n}\n\n/** Encodes bytes as Crockford base32, most significant bit first, padding the last group with 0. */\nfunction base32(bytes: Uint8Array): string {\n let out = \"\";\n let buffer = 0;\n let bits = 0;\n for (const byte of bytes) {\n buffer = (buffer << 8) | byte;\n bits += 8;\n while (bits >= 5) {\n out += CROCKFORD.charAt((buffer >>> (bits - 5)) & 31);\n bits -= 5;\n }\n buffer &= (1 << bits) - 1;\n }\n if (bits > 0) out += CROCKFORD.charAt((buffer << (5 - bits)) & 31);\n return out;\n}\n\n/** An artifact ID (`art_` + ULID). */\nexport type ArtifactId = Id<\"art\">;\n/** Artifact IDs. */\nexport const ArtifactId: GeneratedIdKind<\"art\"> = generated(\n defineKind(\"art\", \"artifact\", \"ulid\", \"ArtifactId\"),\n);\n\n/** A version ID (`ver_` + 26 characters of base32 SHA-256): content-addressed, never generated. */\nexport type VersionId = Id<\"ver\">;\n/** The version ID kind, with the content-addressed constructor DATA_MODEL §2 defines. */\nexport interface VersionIdKind extends IdKind<\"ver\"> {\n /**\n * Returns the version ID for a SHA-256 digest: `ver_` plus the first 26 characters of the\n * digest in Crockford base32 (130 bits). The caller computes the digest of the artifact ID's\n * UTF-8 bytes, a `0x00` byte, and the 32-byte `sourceDigest` and `envDigest` (DATA_MODEL §2,\n * D89).\n *\n * @throws RangeError when `digest` is not 32 bytes long.\n */\n fromSha256(digest: Uint8Array): VersionId;\n}\n/** Version IDs. */\nexport const VersionId: VersionIdKind = {\n ...defineKind(\"ver\", \"version\", \"sha256-base32\", \"VersionId\"),\n fromSha256(digest: Uint8Array): VersionId {\n if (digest.length !== 32) {\n throw new RangeError(`A SHA-256 digest is 32 bytes, got ${digest.length}.`);\n }\n return VersionId.parse(`ver_${base32(digest).slice(0, BODY_LENGTH)}`);\n },\n};\n\n/** A view ID (`vw_` + ULID). */\nexport type ViewId = Id<\"vw\">;\n/** View IDs. */\nexport const ViewId: GeneratedIdKind<\"vw\"> = generated(defineKind(\"vw\", \"view\", \"ulid\", \"ViewId\"));\n\n/** A viewer ID (`vwr_` + ULID). */\nexport type ViewerId = Id<\"vwr\">;\n/** Viewer IDs. */\nexport const ViewerId: GeneratedIdKind<\"vwr\"> = generated(\n defineKind(\"vwr\", \"viewer\", \"ulid\", \"ViewerId\"),\n);\n\n/** A submission ID (`sub_` + ULID). */\nexport type SubmissionId = Id<\"sub\">;\n/** Submission IDs. */\nexport const SubmissionId: GeneratedIdKind<\"sub\"> = generated(\n defineKind(\"sub\", \"submission\", \"ulid\", \"SubmissionId\"),\n);\n\n/**\n * A delivery ID (`dlv_` + ULID): one submission's delivery to one host (D105). A redelivery after a\n * crash repeats it, so a host can treat deliveries idempotently.\n */\nexport type DeliveryId = Id<\"dlv\">;\n/** Delivery IDs. */\nexport const DeliveryId: GeneratedIdKind<\"dlv\"> = generated(\n defineKind(\"dlv\", \"delivery\", \"ulid\", \"DeliveryId\"),\n);\n\n/** An action run ID (`run_` + ULID). */\nexport type RunId = Id<\"run\">;\n/** Action run IDs. */\nexport const RunId: GeneratedIdKind<\"run\"> = generated(\n defineKind(\"run\", \"action run\", \"ulid\", \"RunId\"),\n);\n\n/** A review thread ID (`thr_` + ULID). */\nexport type ThreadId = Id<\"thr\">;\n/** Review thread IDs. */\nexport const ThreadId: GeneratedIdKind<\"thr\"> = generated(\n defineKind(\"thr\", \"thread\", \"ulid\", \"ThreadId\"),\n);\n\n/** A comment ID (`cmt_` + ULID). */\nexport type CommentId = Id<\"cmt\">;\n/** Comment IDs. */\nexport const CommentId: GeneratedIdKind<\"cmt\"> = generated(\n defineKind(\"cmt\", \"comment\", \"ulid\", \"CommentId\"),\n);\n\n/** A capability token ID (`tok_` + ULID). The token's secret is separate and never an ID. */\nexport type TokenId = Id<\"tok\">;\n/** Capability token IDs. */\nexport const TokenId: GeneratedIdKind<\"tok\"> = generated(\n defineKind(\"tok\", \"capability token\", \"ulid\", \"TokenId\"),\n);\n\n/** A mutation ID (`mut_` + ULID), generated by the client that sends the mutation. */\nexport type MutationId = Id<\"mut\">;\n/** Mutation IDs. */\nexport const MutationId: GeneratedIdKind<\"mut\"> = generated(\n defineKind(\"mut\", \"mutation\", \"ulid\", \"MutationId\"),\n);\n\n/**\n * An event cursor: the decimal string of a home-wide event position (INTERFACES §1). Decimal\n * strings keep 64-bit positions exact in JavaScript.\n */\nexport type Cursor = string & { readonly __mostraCursor: true };\n\n/** Event cursors. */\nexport const Cursor: {\n /** The exact form: a non-negative decimal integer without leading zeros, at most 19 digits. */\n readonly pattern: RegExp;\n readonly schema: z.ZodType<Cursor, string>;\n is(value: unknown): value is Cursor;\n /** @throws TypeError when `value` is not a cursor. */\n parse(value: string): Cursor;\n /** Orders two cursors: negative when `a` comes first, zero when equal, positive otherwise. */\n compare(a: Cursor, b: Cursor): number;\n} = (() => {\n const pattern = /^(0|[1-9][0-9]{0,18})$/;\n const is = (value: unknown): value is Cursor => typeof value === \"string\" && pattern.test(value);\n return {\n pattern,\n schema: z.string().regex(pattern).register(wireRegistry, {\n id: \"Cursor\",\n description: \"Event cursor: the decimal string of a home-wide event position.\",\n }) as unknown as z.ZodType<Cursor, string>,\n is,\n parse(value: string): Cursor {\n if (is(value)) return value;\n throw new TypeError(\"Expected an event cursor: a non-negative decimal integer string.\");\n },\n compare(a: Cursor, b: Cursor): number {\n return a.length === b.length ? (a < b ? -1 : a > b ? 1 : 0) : a.length - b.length;\n },\n };\n})();\n"],"mappings":"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"}
1
+ {"version":3,"file":"ids.js","names":[],"sources":["../src/ids.ts"],"sourcesContent":["/**\n * Prefixed, opaque identifiers (INTERFACES §1, DATA_MODEL §2).\n *\n * Every Mostra entity is named by a string of the form `<prefix>_<body>`. Callers treat IDs as\n * opaque: they validate the form at a boundary and never read meaning out of the body. Each ID\n * kind below is both a type and a value with the same name:\n *\n * ```ts\n * const artifact: ArtifactId = ArtifactId.parse(input);\n * const mutation: MutationId = MutationId.create();\n * const Params = z.object({ artifactId: ArtifactId.schema });\n * ```\n *\n * @packageDocumentation\n */\nimport * as z from \"zod\";\nimport { wireRegistry } from \"./wire-registry.ts\";\n\n/** The prefixes INTERFACES §1 assigns, one per entity. */\nexport type IdPrefix =\n | \"art\"\n | \"ver\"\n | \"vw\"\n | \"vwr\"\n | \"sub\"\n | \"dlv\"\n | \"run\"\n | \"thr\"\n | \"cmt\"\n | \"tok\"\n | \"mut\"\n | \"shr\";\n\n/**\n * A branded ID string. The brand exists only at the type level, so an `Id<\"art\">` is a plain\n * string at run time and on the wire.\n */\nexport type Id<P extends IdPrefix> = `${P}_${string}` & { readonly __mostraIdPrefix: P };\n\n/** How an ID kind's body is formed. */\nexport type IdBody = \"ulid\" | \"sha256-base32\";\n\n/** One ID kind: its prefix, validation and schema. */\nexport interface IdKind<P extends IdPrefix> {\n /** The prefix, without the underscore. */\n readonly prefix: P;\n /** The entity the ID names, in the PRODUCT vocabulary. */\n readonly entity: string;\n /** How the body is formed. */\n readonly body: IdBody;\n /** The exact form, anchored at both ends. */\n readonly pattern: RegExp;\n /** The Zod schema for this ID, registered for JSON Schema output under the kind's type name. */\n readonly schema: z.ZodType<Id<P>, string>;\n /** Whether `value` is an ID of this kind. */\n is(value: unknown): value is Id<P>;\n /**\n * Returns `value` as an ID of this kind.\n *\n * @throws TypeError when `value` is not of this kind's form. The message names the expected\n * form and never echoes the input.\n */\n parse(value: string): Id<P>;\n}\n\n/** An ID kind whose body is a ULID that the creator generates. */\nexport interface GeneratedIdKind<P extends IdPrefix> extends IdKind<P> {\n /** Generates a new ID from the current time and 80 bits of Web Crypto randomness. */\n create(): Id<P>;\n}\n\n/** Crockford's base32 alphabet, used by ULIDs and by content-addressed version IDs. */\nconst CROCKFORD = \"0123456789ABCDEFGHJKMNPQRSTVWXYZ\";\nconst BODY_LENGTH = 26;\n/** A ULID's first character encodes at most 3 bits (48-bit time in 26 × 5 = 130 bits). */\nconst ULID_BODY = \"[0-7][0-9A-HJKMNP-TV-Z]{25}\";\nconst BASE32_BODY = \"[0-9A-HJKMNP-TV-Z]{26}\";\n\nfunction defineKind<P extends IdPrefix>(\n prefix: P,\n entity: string,\n body: IdBody,\n typeName: string,\n): IdKind<P> {\n const pattern = new RegExp(`^${prefix}_${body === \"ulid\" ? ULID_BODY : BASE32_BODY}$`);\n const form = body === \"ulid\" ? \"a 26-character ULID\" : \"26 characters of Crockford base32\";\n const is = (value: unknown): value is Id<P> => typeof value === \"string\" && pattern.test(value);\n const schema = z\n .string()\n .regex(pattern)\n .register(wireRegistry, {\n id: typeName,\n description: `${entity[0]?.toUpperCase()}${entity.slice(1)} ID: \"${prefix}_\" followed by ${form}.`,\n }) as unknown as z.ZodType<Id<P>, string>;\n return {\n prefix,\n entity,\n body,\n pattern,\n schema,\n is,\n parse(value: string): Id<P> {\n if (is(value)) return value;\n throw new TypeError(`Expected ${entity} ID \"${prefix}_\" followed by ${form}.`);\n },\n };\n}\n\nfunction generated<P extends IdPrefix>(kind: IdKind<P>): GeneratedIdKind<P> {\n return { ...kind, create: () => kind.parse(`${kind.prefix}_${ulidBody(Date.now())}`) };\n}\n\n/**\n * Encodes a ULID body: 48 bits of milliseconds since the Unix epoch, then 80 random bits, as 26\n * Crockford base32 characters.\n */\nfunction ulidBody(now: number): string {\n if (!Number.isSafeInteger(now) || now < 0 || now > 0xffff_ffff_ffff) {\n throw new RangeError(\"ULID time must be a millisecond timestamp between 0 and 2^48 - 1.\");\n }\n let time = \"\";\n let rest = now;\n for (let i = 0; i < 10; i++) {\n time = CROCKFORD.charAt(rest % 32) + time;\n rest = Math.floor(rest / 32);\n }\n const random = new Uint8Array(10);\n globalThis.crypto.getRandomValues(random);\n return time + base32(random).slice(0, 16);\n}\n\n/** Encodes bytes as Crockford base32, most significant bit first, padding the last group with 0. */\nfunction base32(bytes: Uint8Array): string {\n let out = \"\";\n let buffer = 0;\n let bits = 0;\n for (const byte of bytes) {\n buffer = (buffer << 8) | byte;\n bits += 8;\n while (bits >= 5) {\n out += CROCKFORD.charAt((buffer >>> (bits - 5)) & 31);\n bits -= 5;\n }\n buffer &= (1 << bits) - 1;\n }\n if (bits > 0) out += CROCKFORD.charAt((buffer << (5 - bits)) & 31);\n return out;\n}\n\n/** An artifact ID (`art_` + ULID). */\nexport type ArtifactId = Id<\"art\">;\n/** Artifact IDs. */\nexport const ArtifactId: GeneratedIdKind<\"art\"> = generated(\n defineKind(\"art\", \"artifact\", \"ulid\", \"ArtifactId\"),\n);\n\n/** A version ID (`ver_` + 26 characters of base32 SHA-256): content-addressed, never generated. */\nexport type VersionId = Id<\"ver\">;\n/** The version ID kind, with the content-addressed constructor DATA_MODEL §2 defines. */\nexport interface VersionIdKind extends IdKind<\"ver\"> {\n /**\n * Returns the version ID for a SHA-256 digest: `ver_` plus the first 26 characters of the\n * digest in Crockford base32 (130 bits). The caller computes the digest of the artifact ID's\n * UTF-8 bytes, a `0x00` byte, and the 32-byte `sourceDigest` and `envDigest` (DATA_MODEL §2,\n * D89).\n *\n * @throws RangeError when `digest` is not 32 bytes long.\n */\n fromSha256(digest: Uint8Array): VersionId;\n}\n/** Version IDs. */\nexport const VersionId: VersionIdKind = {\n ...defineKind(\"ver\", \"version\", \"sha256-base32\", \"VersionId\"),\n fromSha256(digest: Uint8Array): VersionId {\n if (digest.length !== 32) {\n throw new RangeError(`A SHA-256 digest is 32 bytes, got ${digest.length}.`);\n }\n return VersionId.parse(`ver_${base32(digest).slice(0, BODY_LENGTH)}`);\n },\n};\n\n/** A view ID (`vw_` + ULID). */\nexport type ViewId = Id<\"vw\">;\n/** View IDs. */\nexport const ViewId: GeneratedIdKind<\"vw\"> = generated(defineKind(\"vw\", \"view\", \"ulid\", \"ViewId\"));\n\n/** A viewer ID (`vwr_` + ULID). */\nexport type ViewerId = Id<\"vwr\">;\n/** Viewer IDs. */\nexport const ViewerId: GeneratedIdKind<\"vwr\"> = generated(\n defineKind(\"vwr\", \"viewer\", \"ulid\", \"ViewerId\"),\n);\n\n/** A submission ID (`sub_` + ULID). */\nexport type SubmissionId = Id<\"sub\">;\n/** Submission IDs. */\nexport const SubmissionId: GeneratedIdKind<\"sub\"> = generated(\n defineKind(\"sub\", \"submission\", \"ulid\", \"SubmissionId\"),\n);\n\n/**\n * A delivery ID (`dlv_` + ULID): one submission's delivery to one host (D105). A redelivery after a\n * crash repeats it, so a host can treat deliveries idempotently.\n */\nexport type DeliveryId = Id<\"dlv\">;\n/** Delivery IDs. */\nexport const DeliveryId: GeneratedIdKind<\"dlv\"> = generated(\n defineKind(\"dlv\", \"delivery\", \"ulid\", \"DeliveryId\"),\n);\n\n/** An action run ID (`run_` + ULID). */\nexport type RunId = Id<\"run\">;\n/** Action run IDs. */\nexport const RunId: GeneratedIdKind<\"run\"> = generated(\n defineKind(\"run\", \"action run\", \"ulid\", \"RunId\"),\n);\n\n/** A review thread ID (`thr_` + ULID). */\nexport type ThreadId = Id<\"thr\">;\n/** Review thread IDs. */\nexport const ThreadId: GeneratedIdKind<\"thr\"> = generated(\n defineKind(\"thr\", \"thread\", \"ulid\", \"ThreadId\"),\n);\n\n/** A comment ID (`cmt_` + ULID). */\nexport type CommentId = Id<\"cmt\">;\n/** Comment IDs. */\nexport const CommentId: GeneratedIdKind<\"cmt\"> = generated(\n defineKind(\"cmt\", \"comment\", \"ulid\", \"CommentId\"),\n);\n\n/** A capability token ID (`tok_` + ULID). The token's secret is separate and never an ID. */\nexport type TokenId = Id<\"tok\">;\n/** Capability token IDs. */\nexport const TokenId: GeneratedIdKind<\"tok\"> = generated(\n defineKind(\"tok\", \"capability token\", \"ulid\", \"TokenId\"),\n);\n\n/** A mutation ID (`mut_` + ULID), generated by the client that sends the mutation. */\nexport type MutationId = Id<\"mut\">;\n/** Mutation IDs. */\nexport const MutationId: GeneratedIdKind<\"mut\"> = generated(\n defineKind(\"mut\", \"mutation\", \"ulid\", \"MutationId\"),\n);\n\n/** A share ID (`shr_` + ULID): one share of an artifact through a tunnel (D158). */\nexport type ShareId = Id<\"shr\">;\n/** Share IDs. */\nexport const ShareId: GeneratedIdKind<\"shr\"> = generated(\n defineKind(\"shr\", \"share\", \"ulid\", \"ShareId\"),\n);\n\n/**\n * An event cursor: the decimal string of a home-wide event position (INTERFACES §1). Decimal\n * strings keep 64-bit positions exact in JavaScript.\n */\nexport type Cursor = string & { readonly __mostraCursor: true };\n\n/** Event cursors. */\nexport const Cursor: {\n /** The exact form: a non-negative decimal integer without leading zeros, at most 19 digits. */\n readonly pattern: RegExp;\n readonly schema: z.ZodType<Cursor, string>;\n is(value: unknown): value is Cursor;\n /** @throws TypeError when `value` is not a cursor. */\n parse(value: string): Cursor;\n /** Orders two cursors: negative when `a` comes first, zero when equal, positive otherwise. */\n compare(a: Cursor, b: Cursor): number;\n} = (() => {\n const pattern = /^(0|[1-9][0-9]{0,18})$/;\n const is = (value: unknown): value is Cursor => typeof value === \"string\" && pattern.test(value);\n return {\n pattern,\n schema: z.string().regex(pattern).register(wireRegistry, {\n id: \"Cursor\",\n description: \"Event cursor: the decimal string of a home-wide event position.\",\n }) as unknown as z.ZodType<Cursor, string>,\n is,\n parse(value: string): Cursor {\n if (is(value)) return value;\n throw new TypeError(\"Expected an event cursor: a non-negative decimal integer string.\");\n },\n compare(a: Cursor, b: Cursor): number {\n return a.length === b.length ? (a < b ? -1 : a > b ? 1 : 0) : a.length - b.length;\n },\n };\n})();\n"],"mappings":"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"}
package/dist/index.d.ts CHANGED
@@ -3,10 +3,10 @@ import { ACTION_ARGS_MAX, ACTION_RESULT_MAX, ActionError, Batches, CallLine, Cal
3
3
  import { ARTIFACT_MANIFEST_KEYS, ArtifactFamily, ArtifactLink, ArtifactManifest, DemoSpec, SubmissionPolicy, TerminalSpec } from "./manifest.js";
4
4
  import { ArtifactDetail, ArtifactRef, ArtifactSummary, PublishReceipt, SourceRef, VersionSummary } from "./artifact.js";
5
5
  import { ControlsPolicy, DeliveryTarget, REVIEW_SET_ID_PATTERN, SubmitChannel, TrustedControl, VersionRef, ViewContext, ViewContextWire, readViewContext } from "./view.js";
6
- import { AnyBridgeMessage, BRIDGE_FIELDS_MAX, BRIDGE_MESSAGES, BRIDGE_TEXT_MAX, Bridge, BridgeEvent, BridgeHostContext, BridgeImplementation, BridgeMessage, BridgeOptions, BridgePeer, BridgeReceiver, BridgeRejection, BridgeSide, CONTROL_LABEL_MAX, ControlRequest, FieldRegistration, FieldsParams, FlushResult, MCP_APPS_PROTOCOL_VERSION, OPEN_LINK_SCHEMES, SaveState, SubmitBlocker, UiInitializeParams, UiInitializeResult, VersionAvailableParams, connectBridge, mostraControlsRequest, mostraFieldFocus, mostraFields, mostraFlush, mostraPage, mostraReady, mostraVersionAvailable, uiInitialize, uiInitialized, uiOpenLink, uiSizeChanged } from "./bridge.js";
7
- import { ArtifactId, CommentId, Cursor, DeliveryId, GeneratedIdKind, Id, IdBody, IdKind, IdPrefix, MutationId, RunId, SubmissionId, ThreadId, TokenId, VersionId, VersionIdKind, ViewId, ViewerId } from "./ids.js";
6
+ import { AnyBridgeMessage, BRIDGE_FIELDS_MAX, BRIDGE_MESSAGES, BRIDGE_TEXT_MAX, Bridge, BridgeEvent, BridgeHostContext, BridgeImplementation, BridgeMessage, BridgeOptions, BridgePeer, BridgeReceiver, BridgeRejection, BridgeSide, CONTROL_LABEL_MAX, ControlRequest, FieldRegistration, FieldsParams, FlushResult, FrameSessionFailedParams, MCP_APPS_PROTOCOL_VERSION, OPEN_LINK_SCHEMES, SaveState, SubmitBlocker, UiInitializeParams, UiInitializeResult, VersionAvailableParams, connectBridge, mostraControlsRequest, mostraFieldFocus, mostraFields, mostraFlush, mostraFrameSessionEntered, mostraFrameSessionFailed, mostraPage, mostraReady, mostraVersionAvailable, uiInitialize, uiInitialized, uiOpenLink, uiSizeChanged } from "./bridge.js";
7
+ import { ArtifactId, CommentId, Cursor, DeliveryId, GeneratedIdKind, Id, IdBody, IdKind, IdPrefix, MutationId, RunId, ShareId, SubmissionId, ThreadId, TokenId, VersionId, VersionIdKind, ViewId, ViewerId } from "./ids.js";
8
8
  import { Actor, DeliveryState, DeliveryStatus, DocumentRevision, EventFilter, EventRecord, EventTypePattern, FIELD_ID_MAX_LENGTH, FieldConflict, FieldOp, FieldScope, FieldState, MutationResult, Rect, ResultComment, Results, SIGNAL_NAME_PATTERN, SubmissionSummary, Viewer, ViewerKind, ViewerSpec, Viewport, WaitCondition, isFieldId } from "./interaction.js";
9
- import { BROWSER_PROTOCOL_REVISION, BROWSER_PROTOCOL_REVISIONS, CarryOver, ChooseRequest, DocumentSnapshot, FieldsRequest, FollowRequest, FrameTicket, OrphanedField, PollResult, SIGNAL_PAYLOAD_MAX_BYTES, ShellSubmitRequest, SignalRequest, StreamSnapshot, SubmitRequest } from "./browser.js";
9
+ import { BROWSER_PROTOCOL_REVISION, BROWSER_PROTOCOL_REVISIONS, CarryOver, ChooseRequest, DocumentSnapshot, EnterRequest, EnterResult, FRAME_SESSION_HEADER, FieldsRequest, FollowRequest, FrameSessionFacts, FrameTicket, OrphanedField, PollResult, SIGNAL_PAYLOAD_MAX_BYTES, ShellSubmitRequest, SignalRequest, StreamSnapshot, StreamTicket, StreamTicketRequest, SubmitRequest } from "./browser.js";
10
10
  import { BUNDLE_NAME, BUNDLE_PLATFORMS, BUNDLE_SETUP_MARKER, BundleAsset, BundleBrowser, BundleFileEntry, BundleFiles, BundleInfo, BundleLinkEntry, BundlePins, BundlePlatform, BundlePlatformSchema, BundleSetup, bundleAssetName, isWindowsBundle } from "./bundle.js";
11
11
  import { canonicalJson } from "./canonical.js";
12
12
  import { ALL_SCOPES, CapabilityScope, Duration, durationMs, normalizeScopes, scopeAllows } from "./capability.js";
@@ -32,6 +32,7 @@ import { PublishDiagnosticCode, publishDiagnosticCodes } from "./diagnostics/cod
32
32
  import { RegressionDiagnosticCode, regressionDiagnosticCodes } from "./diagnostics/codes/regression.js";
33
33
  import { RuntimeDiagnosticCode, runtimeDiagnosticCodes } from "./diagnostics/codes/runtime.js";
34
34
  import { SecretDiagnosticCode, secretDiagnosticCodes } from "./diagnostics/codes/secret.js";
35
+ import { ShareDiagnosticCode, shareDiagnosticCodes } from "./diagnostics/codes/share.js";
35
36
  import { SmokeDiagnosticCode, smokeDiagnosticCodes } from "./diagnostics/codes/smoke.js";
36
37
  import { SubmitDiagnosticCode, submitDiagnosticCodes } from "./diagnostics/codes/submit.js";
37
38
  import { TargetDiagnosticCode, targetDiagnosticCodes } from "./diagnostics/codes/target.js";
@@ -58,9 +59,11 @@ import { hostMethods, hostNotifications } from "./methods/index.js";
58
59
  import { InstanceCheck, InstanceCheckParams, InstanceCheckResult, instanceCheckMethod } from "./methods/instance/check.js";
59
60
  import { HOST_PROTOCOL_REVISIONS, Revision, RevisionNegotiation, negotiateRevision } from "./revision.js";
60
61
  import { CLI_CLIENT_NAME, ClientCapabilities, ClientInfo, DependencyPolicy, HomeConfig, InstanceCapabilities, InstanceInfo, MostraInitializeParams, MostraInitializeResult, PortName, mostraInitializeMethod } from "./methods/mostra/initialize.js";
61
- import { ChildProcessStatus, DeliveryCounts, GatewayStatus, InstanceStatusParams, InstanceStatusResult, WorkerStatus, instanceStatusMethod } from "./methods/instance/status.js";
62
+ import { PUBLIC_SHARE_DEFAULT_TTL, PUBLIC_SHARE_MAX_TTL_MS, Share, ShareStartParams, ShareStartResult, ShareVia, shareStartMethod } from "./methods/share/start.js";
63
+ import { ChildProcessStatus, DeliveryCounts, FaceStatus, GatewayStatus, InstanceStatusParams, InstanceStatusResult, WorkerStatus, instanceStatusMethod } from "./methods/instance/status.js";
62
64
  import { LivePushParams, LivePushResult, livePushMethod } from "./methods/live/push.js";
63
65
  import { MostraShutdownParams, MostraShutdownResult, mostraShutdownMethod } from "./methods/mostra/shutdown.js";
66
+ import { ExternalBase, OriginString, PortAddressingExternalBaseParams, PortAddressingExternalBaseResult, portAddressingExternalBaseMethod } from "./methods/port/addressing-external-base.js";
64
67
  import { DraftMirror, DraftsMirrorResult, portDraftsMirrorMethod } from "./methods/port/drafts-mirror.js";
65
68
  import { IdentityVia, PortIdentityResolveParams, PortIdentityResolveResult, portIdentityResolveMethod } from "./methods/port/identity-resolve.js";
66
69
  import { PortSecretsGetParams, PortSecretsGetResult, portSecretsGetMethod } from "./methods/port/secrets-get.js";
@@ -71,6 +74,8 @@ import { ResultsGetParams, ResultsGetResult, ResultsMarkdown, resultsGetMethod }
71
74
  import { SecretDeleteParams, SecretDeleteResult, secretDeleteMethod } from "./methods/secret/delete.js";
72
75
  import { SecretEntry, SecretSetParams, SecretSetResult, secretSetMethod } from "./methods/secret/set.js";
73
76
  import { SecretListParams, SecretListResult, secretListMethod } from "./methods/secret/list.js";
77
+ import { ShareListParams, ShareListResult, shareListMethod } from "./methods/share/list.js";
78
+ import { ShareStopParams, ShareStopResult, shareStopMethod } from "./methods/share/stop.js";
74
79
  import { StateGetParams, StateGetResult, stateGetMethod } from "./methods/state/get.js";
75
80
  import { StatePatchParams, StatePatchResult, statePatchMethod } from "./methods/state/patch.js";
76
81
  import { CapabilityLink, ViewUrlParams, ViewUrlResult, viewUrlMethod } from "./methods/view/url.js";
@@ -85,4 +90,4 @@ import { JSON_RPC_ERROR_CODES, RpcError } from "./rpc/error.js";
85
90
  import { LineSplitter, MAX_LINE_LENGTH, encodeLine } from "./rpc/lines.js";
86
91
  import { RpcPeer, RpcPeerOptions, RpcRequestContext, RpcRequestOptions, parseParams } from "./rpc/peer.js";
87
92
  import { CallContext, DEFAULT_WORKER_LIMITS, LiveSourceInfo, ServerEmitParams, ServerLiveValueParams, ServerLogParams, ServerProgressParams, ServerSecretParams, ServerSignalParams, ServerStateGetParams, ServerStatePatchParams, ServerStatePatchResult, WORKER_CHANNEL_REVISION, WORKER_METHODS, WorkerBatchParams, WorkerCallOutcome, WorkerCallParams, WorkerCancelParams, WorkerLimits, WorkerLiveParams, WorkerPingResult, WorkerStartParams, WorkerStartResult, WorkerVersionRef } from "./worker.js";
88
- export { type A11yDiagnosticCode, ACTION_ARGS_MAX, ACTION_RESULT_MAX, ALL_SCOPES, ARGUMENT_BIGINT_DIGITS_MAX, ARTIFACT_MANIFEST_KEYS, ARTIFACT_PROGRESS, type ActionDiagnosticCode, ActionError, Actor, AddedPackage, type AnyBridgeMessage, type AnyFunction, type AnyMethod, type AnyNotification, type AreaCatalog, type ArtifactCreateParams, type ArtifactCreateResult, ArtifactDetail, type ArtifactDiagnosticCode, type ArtifactFamily, type ArtifactGetParams, type ArtifactGetResult, ArtifactId, ArtifactLink, type ArtifactListFilter, type ArtifactListParams, type ArtifactListResult, ArtifactManifest, ArtifactProgressParams, type ArtifactPublishParams, type ArtifactPublishResult, ArtifactRef, ArtifactSummary, type ArtifactVerifyParams, type ArtifactVerifyResult, BRIDGE_FIELDS_MAX, BRIDGE_MESSAGES, BRIDGE_TEXT_MAX, BROWSER_PROTOCOL_REVISION, BROWSER_PROTOCOL_REVISIONS, BUNDLE_NAME, BUNDLE_PLATFORMS, BUNDLE_SETUP_MARKER, Batches, type Bridge, type BridgeEvent, type BridgeHostContext, type BridgeImplementation, type BridgeMessage, type BridgeOptions, type BridgePeer, type BridgeReceiver, type BridgeRejection, type BridgeSide, type BuildDiagnosticCode, BundleAsset, BundleBrowser, BundleFileEntry, BundleFiles, BundleInfo, BundleLinkEntry, BundlePins, type BundlePlatform, BundlePlatformSchema, BundleSetup, CLI_CLIENT_NAME, CONTROL_LABEL_MAX, CSRF_HEADER, type CallContext, type CallLine, CallRequest, CapabilityLink, CapabilityScope, CarryOver, ChildProcessStatus, ChooseRequest, type ClassifiedMessage, type CliDiagnosticCode, ClientCapabilities, ClientInfo, CommentId, type CompareRequest, type CompareResult, type ConsoleDiagnosticCode, type ControlRequest, ControlsPolicy, type CreateDiagnosticOptions, Cursor, DEFAULT_DOCS_BASE, DEFAULT_VIEWPORTS, DEFAULT_WORKER_LIMITS, DEV_NOTIFY, DIAGNOSTIC_AREAS, DeliveryCounts, DeliveryId, type DeliveryState, DeliveryStatus, type DeliveryTarget, type DemoSpec, type DepDiagnosticCode, DependencyPolicy, type DepsAddParams, type DepsAddResult, type DevEventKind, DevNotifyParams, type DevStartParams, type DevStartResult, type DevStopParams, type DevStopResult, Diagnostic, type DiagnosticArea, type DiagnosticCode, type DiagnosticDetails, DiagnosticFix, DiagnosticLocation, DiagnosticPhase, DiagnosticSeverity, type DiagnosticSpec, DocumentRevision, DocumentSnapshot, DraftMirror, type DraftsMirrorResult, Duration, EVENTS_NOTIFY, EVENTS_READ_MAX, type EnvDiagnosticCode, type EphemeralMessage, EventFilter, EventRecord, EventTypePattern, type EventsAckParams, type EventsAckResult, EventsNotifyParams, type EventsReadParams, type EventsReadResult, type EventsSubscribeParams, type EventsSubscribeResult, type EventsUnsubscribeParams, type EventsUnsubscribeResult, FIELD_ID_MAX_LENGTH, FieldConflict, type FieldDiagnosticCode, FieldOp, type FieldRegistration, type FieldScope, FieldState, type FieldsParams, FieldsRequest, type FlushResult, FollowRequest, type Frame, FrameTicket, GatewayStatus, type GcCompactEvents, type GcCompacted, type GcCount, type GcRunParams, type GcRunResult, type GcVersion, type GeneratedIdKind, HOST_PROTOCOL_REVISIONS, HomeConfig, type HomeDiagnosticCode, type HostDiagnosticCode, type HygieneDiagnosticCode, type Id, type IdBody, type IdKind, type IdPrefix, type IdentityVia, InstanceCapabilities, type InstanceCheck, type InstanceCheckParams, type InstanceCheckResult, InstanceInfo, type InstanceStatusParams, type InstanceStatusResult, JSON_RPC_ERROR_CODES, JsonRpcErrorObject, JsonRpcFailure, type JsonRpcId, type JsonRpcMessage, JsonRpcNotification, type JsonRpcParams, JsonRpcRequest, type JsonRpcResponse, JsonRpcSuccess, type KnownDiagnosticCode, LIVE_KEY_PATTERN, LIVE_RING_DEFAULT, LIVE_RING_MAX, LIVE_VALUE_MAX, LineSplitter, type LiveDiagnosticCode, type LivePushParams, type LivePushResult, LiveRequest, type LiveSourceInfo, type LiveState, type LiveUpdate, MAX_LINE_LENGTH, MCP_APPS_PROTOCOL_VERSION, type ManifestDiagnosticCode, type MethodDefinition, type MethodDirection, type MostraInitializeParams, type MostraInitializeResult, type MostraShutdownParams, type MostraShutdownResult, MutationId, MutationResult, type NetworkDiagnosticCode, type NotificationDefinition, OPEN_LINK_SCHEMES, OrphanedField, type PlatformDiagnosticCode, PollResult, type PortIdentityResolveParams, type PortIdentityResolveResult, PortName, type PortSecretsGetParams, type PortSecretsGetResult, type PortTrustedControlsActivatedParams, type PortTrustedControlsActivatedResult, type PortTrustedControlsPolicyParams, type PortTrustedControlsPolicyResult, type ProbedField, type PublishDiagnosticCode, PublishReceipt, REVIEW_SET_ID_PATTERN, RUN_KEY_MAX, RUN_LOG_MAX, RUN_LOG_TRUNCATED, RUN_STATUSES, type Rect, type Refusal, type RegressionDiagnosticCode, RemoteError, type RenderRequest, type RenderResult, type RequestFacts, type RequestIntent, type RequestPolicy, ResultComment, Results, type ResultsGetParams, type ResultsGetResult, ResultsMarkdown, Revision, type RevisionNegotiation, RpcError, RpcPeer, type RpcPeerOptions, type RpcRequestContext, type RpcRequestOptions, RunAttachRequest, RunCancelRequest, type RunDelta, RunId, RunProgress, type RunReason, RunRequest, RunState, type RunStatus, type RuntimeDiagnosticCode, SECRET_NAME_PATTERN, SECRET_VALUE_MAX, SIGNAL_NAME_PATTERN, SIGNAL_PAYLOAD_MAX_BYTES, type SaveState, ScreenshotPolicy, type SecretDeleteParams, type SecretDeleteResult, type SecretDiagnosticCode, SecretEntry, type SecretListParams, type SecretListResult, type SecretSetParams, type SecretSetResult, SerializationError, type SerializeMode, ServerEmitParams, ServerLiveValueParams, ServerLogParams, ServerProgressParams, ServerSecretParams, ServerSignalParams, ServerStateGetParams, ServerStatePatchParams, type ServerStatePatchResult, ShellSubmitRequest, SignalRequest, type SmokeDiagnosticCode, SourceRef, type StateGetParams, type StateGetResult, type StatePatchParams, type StatePatchResult, StreamSnapshot, SubmissionEnvelope, SubmissionId, SubmissionPolicy, SubmissionSummary, type SubmissionsDeliverResult, type SubmitBlocker, SubmitChannel, type SubmitDiagnosticCode, SubmitRequest, type TargetDiagnosticCode, type TerminalSpec, ThreadId, type TokenEstimate, TokenId, TrustedControl, type TypeDiagnosticCode, UNSERIALIZABLE_CODE, type UiInitializeParams, type UiInitializeResult, VERIFY_PROBE, VERIFY_REPORT, VERIFY_RUNNER_METHODS, ValueReader, type ValueReaderOptions, ValueWriter, type ValueWriterOptions, type VerdictAria, type VerdictScreenshot, type VerifyDiagnosticCode, VerifyVerdict, type VerifyViewport, type VersionAvailableParams, VersionId, type VersionIdKind, VersionRef, VersionSummary, ViewContext, ViewContextWire, type ViewDefaultParams, type ViewDefaultResult, ViewId, type ViewLaunchParams, type ViewLaunchResult, type ViewRevokeParams, type ViewRevokeResult, type ViewRotateParams, type ViewRotateResult, type ViewUrlParams, type ViewUrlResult, Viewer, ViewerId, type ViewerKind, ViewerSpec, type Viewport, WAIT_MAX_MS, WORKER_CHANNEL_REVISION, WORKER_METHODS, WaitCondition, type WaitParams, type WaitResult, type WireError, WorkerBatchParams, WorkerCallOutcome, WorkerCallParams, type WorkerCancelParams, type WorkerLimits, type WorkerLiveParams, WorkerPingResult, WorkerStartParams, WorkerStartResult, WorkerStatus, WorkerVersionRef, a11yDiagnosticCodes, actionDiagnosticCodes, ariaSummary, artifactCreateMethod, artifactDiagnosticCodes, artifactGetMethod, artifactListMethod, artifactPublishMethod, artifactVerifyMethod, buildDiagnosticCodes, bundleAssetName, canonicalJson, checkArgumentFrames, checkRequest, classifyMessage, cliDiagnosticCodes, connectBridge, consoleDiagnosticCodes, createDiagnostic, defineMethod, depDiagnosticCodes, depsAddMethod, deserializeAll, devStartMethod, devStopMethod, diagnosticCatalog, docsUrl, durationMs, encodeLine, envDiagnosticCodes, estimateImageTokens, eventsAckMethod, eventsReadMethod, eventsSubscribeMethod, eventsUnsubscribeMethod, fieldDiagnosticCodes, fromBase64, gcRunMethod, headerValue, homeDiagnosticCodes, hostDiagnosticCodes, hostMethods, hostNotifications, hygieneDiagnosticCodes, instanceCheckMethod, instanceStatusMethod, isFieldId, isFinalRunStatus, isJsonContentType, isWindowsBundle, liveDiagnosticCodes, livePushMethod, manifestDiagnosticCodes, mostraControlsRequest, mostraFieldFocus, mostraFields, mostraFlush, mostraInitializeMethod, mostraPage, mostraReady, mostraShutdownMethod, mostraVersionAvailable, negotiateRevision, networkDiagnosticCodes, normalizeScopes, parseParams, platformDiagnosticCodes, portDraftsMirrorMethod, portIdentityResolveMethod, portSecretsGetMethod, portSubmissionsDeliverMethod, portTrustedControlsActivatedMethod, portTrustedControlsPolicyMethod, publishDiagnosticCodes, readViewContext, receivable, refusal, regressionDiagnosticCodes, resultsGetMethod, runtimeDiagnosticCodes, safeEqual, safePath, scopeAllows, secretDeleteMethod, secretDiagnosticCodes, secretListMethod, secretSetMethod, serializeAll, smokeDiagnosticCodes, stateGetMethod, statePatchMethod, submitDiagnosticCodes, targetDiagnosticCodes, toBase64, typeDiagnosticCodes, uiInitialize, uiInitialized, uiOpenLink, uiSizeChanged, verifyDiagnosticCodes, viewDefaultMethod, viewLaunchMethod, viewRevokeMethod, viewRotateMethod, viewUrlMethod, viewportsFor, waitMethod, wireError };
93
+ export { type A11yDiagnosticCode, ACTION_ARGS_MAX, ACTION_RESULT_MAX, ALL_SCOPES, ARGUMENT_BIGINT_DIGITS_MAX, ARTIFACT_MANIFEST_KEYS, ARTIFACT_PROGRESS, type ActionDiagnosticCode, ActionError, Actor, AddedPackage, type AnyBridgeMessage, type AnyFunction, type AnyMethod, type AnyNotification, type AreaCatalog, type ArtifactCreateParams, type ArtifactCreateResult, ArtifactDetail, type ArtifactDiagnosticCode, type ArtifactFamily, type ArtifactGetParams, type ArtifactGetResult, ArtifactId, ArtifactLink, type ArtifactListFilter, type ArtifactListParams, type ArtifactListResult, ArtifactManifest, ArtifactProgressParams, type ArtifactPublishParams, type ArtifactPublishResult, ArtifactRef, ArtifactSummary, type ArtifactVerifyParams, type ArtifactVerifyResult, BRIDGE_FIELDS_MAX, BRIDGE_MESSAGES, BRIDGE_TEXT_MAX, BROWSER_PROTOCOL_REVISION, BROWSER_PROTOCOL_REVISIONS, BUNDLE_NAME, BUNDLE_PLATFORMS, BUNDLE_SETUP_MARKER, Batches, type Bridge, type BridgeEvent, type BridgeHostContext, type BridgeImplementation, type BridgeMessage, type BridgeOptions, type BridgePeer, type BridgeReceiver, type BridgeRejection, type BridgeSide, type BuildDiagnosticCode, BundleAsset, BundleBrowser, BundleFileEntry, BundleFiles, BundleInfo, BundleLinkEntry, BundlePins, type BundlePlatform, BundlePlatformSchema, BundleSetup, CLI_CLIENT_NAME, CONTROL_LABEL_MAX, CSRF_HEADER, type CallContext, type CallLine, CallRequest, CapabilityLink, CapabilityScope, CarryOver, ChildProcessStatus, ChooseRequest, type ClassifiedMessage, type CliDiagnosticCode, ClientCapabilities, ClientInfo, CommentId, type CompareRequest, type CompareResult, type ConsoleDiagnosticCode, type ControlRequest, ControlsPolicy, type CreateDiagnosticOptions, Cursor, DEFAULT_DOCS_BASE, DEFAULT_VIEWPORTS, DEFAULT_WORKER_LIMITS, DEV_NOTIFY, DIAGNOSTIC_AREAS, DeliveryCounts, DeliveryId, type DeliveryState, DeliveryStatus, type DeliveryTarget, type DemoSpec, type DepDiagnosticCode, DependencyPolicy, type DepsAddParams, type DepsAddResult, type DevEventKind, DevNotifyParams, type DevStartParams, type DevStartResult, type DevStopParams, type DevStopResult, Diagnostic, type DiagnosticArea, type DiagnosticCode, type DiagnosticDetails, DiagnosticFix, DiagnosticLocation, DiagnosticPhase, DiagnosticSeverity, type DiagnosticSpec, DocumentRevision, DocumentSnapshot, DraftMirror, type DraftsMirrorResult, Duration, EVENTS_NOTIFY, EVENTS_READ_MAX, EnterRequest, EnterResult, type EnvDiagnosticCode, type EphemeralMessage, EventFilter, EventRecord, EventTypePattern, type EventsAckParams, type EventsAckResult, EventsNotifyParams, type EventsReadParams, type EventsReadResult, type EventsSubscribeParams, type EventsSubscribeResult, type EventsUnsubscribeParams, type EventsUnsubscribeResult, ExternalBase, FIELD_ID_MAX_LENGTH, FRAME_SESSION_HEADER, type FaceStatus, FieldConflict, type FieldDiagnosticCode, FieldOp, type FieldRegistration, type FieldScope, FieldState, type FieldsParams, FieldsRequest, type FlushResult, FollowRequest, type Frame, FrameSessionFacts, type FrameSessionFailedParams, FrameTicket, GatewayStatus, type GcCompactEvents, type GcCompacted, type GcCount, type GcRunParams, type GcRunResult, type GcVersion, type GeneratedIdKind, HOST_PROTOCOL_REVISIONS, HomeConfig, type HomeDiagnosticCode, type HostDiagnosticCode, type HygieneDiagnosticCode, type Id, type IdBody, type IdKind, type IdPrefix, type IdentityVia, InstanceCapabilities, type InstanceCheck, type InstanceCheckParams, type InstanceCheckResult, InstanceInfo, type InstanceStatusParams, type InstanceStatusResult, JSON_RPC_ERROR_CODES, JsonRpcErrorObject, JsonRpcFailure, type JsonRpcId, type JsonRpcMessage, JsonRpcNotification, type JsonRpcParams, JsonRpcRequest, type JsonRpcResponse, JsonRpcSuccess, type KnownDiagnosticCode, LIVE_KEY_PATTERN, LIVE_RING_DEFAULT, LIVE_RING_MAX, LIVE_VALUE_MAX, LineSplitter, type LiveDiagnosticCode, type LivePushParams, type LivePushResult, LiveRequest, type LiveSourceInfo, type LiveState, type LiveUpdate, MAX_LINE_LENGTH, MCP_APPS_PROTOCOL_VERSION, type ManifestDiagnosticCode, type MethodDefinition, type MethodDirection, type MostraInitializeParams, type MostraInitializeResult, type MostraShutdownParams, type MostraShutdownResult, MutationId, MutationResult, type NetworkDiagnosticCode, type NotificationDefinition, OPEN_LINK_SCHEMES, OriginString, OrphanedField, PUBLIC_SHARE_DEFAULT_TTL, PUBLIC_SHARE_MAX_TTL_MS, type PlatformDiagnosticCode, PollResult, type PortAddressingExternalBaseParams, type PortAddressingExternalBaseResult, type PortIdentityResolveParams, type PortIdentityResolveResult, PortName, type PortSecretsGetParams, type PortSecretsGetResult, type PortTrustedControlsActivatedParams, type PortTrustedControlsActivatedResult, type PortTrustedControlsPolicyParams, type PortTrustedControlsPolicyResult, type ProbedField, type PublishDiagnosticCode, PublishReceipt, REVIEW_SET_ID_PATTERN, RUN_KEY_MAX, RUN_LOG_MAX, RUN_LOG_TRUNCATED, RUN_STATUSES, type Rect, type Refusal, type RegressionDiagnosticCode, RemoteError, type RenderRequest, type RenderResult, type RequestFacts, type RequestIntent, type RequestPolicy, ResultComment, Results, type ResultsGetParams, type ResultsGetResult, ResultsMarkdown, Revision, type RevisionNegotiation, RpcError, RpcPeer, type RpcPeerOptions, type RpcRequestContext, type RpcRequestOptions, RunAttachRequest, RunCancelRequest, type RunDelta, RunId, RunProgress, type RunReason, RunRequest, RunState, type RunStatus, type RuntimeDiagnosticCode, SECRET_NAME_PATTERN, SECRET_VALUE_MAX, SIGNAL_NAME_PATTERN, SIGNAL_PAYLOAD_MAX_BYTES, type SaveState, ScreenshotPolicy, type SecretDeleteParams, type SecretDeleteResult, type SecretDiagnosticCode, SecretEntry, type SecretListParams, type SecretListResult, type SecretSetParams, type SecretSetResult, SerializationError, type SerializeMode, ServerEmitParams, ServerLiveValueParams, ServerLogParams, ServerProgressParams, ServerSecretParams, ServerSignalParams, ServerStateGetParams, ServerStatePatchParams, type ServerStatePatchResult, Share, type ShareDiagnosticCode, ShareId, type ShareListParams, type ShareListResult, type ShareStartParams, type ShareStartResult, type ShareStopParams, type ShareStopResult, ShareVia, ShellSubmitRequest, SignalRequest, type SmokeDiagnosticCode, SourceRef, type StateGetParams, type StateGetResult, type StatePatchParams, type StatePatchResult, StreamSnapshot, StreamTicket, StreamTicketRequest, SubmissionEnvelope, SubmissionId, SubmissionPolicy, SubmissionSummary, type SubmissionsDeliverResult, type SubmitBlocker, SubmitChannel, type SubmitDiagnosticCode, SubmitRequest, type TargetDiagnosticCode, type TerminalSpec, ThreadId, type TokenEstimate, TokenId, TrustedControl, type TypeDiagnosticCode, UNSERIALIZABLE_CODE, type UiInitializeParams, type UiInitializeResult, VERIFY_PROBE, VERIFY_REPORT, VERIFY_RUNNER_METHODS, ValueReader, type ValueReaderOptions, ValueWriter, type ValueWriterOptions, type VerdictAria, type VerdictScreenshot, type VerifyDiagnosticCode, VerifyVerdict, type VerifyViewport, type VersionAvailableParams, VersionId, type VersionIdKind, VersionRef, VersionSummary, ViewContext, ViewContextWire, type ViewDefaultParams, type ViewDefaultResult, ViewId, type ViewLaunchParams, type ViewLaunchResult, type ViewRevokeParams, type ViewRevokeResult, type ViewRotateParams, type ViewRotateResult, type ViewUrlParams, type ViewUrlResult, Viewer, ViewerId, type ViewerKind, ViewerSpec, type Viewport, WAIT_MAX_MS, WORKER_CHANNEL_REVISION, WORKER_METHODS, WaitCondition, type WaitParams, type WaitResult, type WireError, WorkerBatchParams, WorkerCallOutcome, WorkerCallParams, type WorkerCancelParams, type WorkerLimits, type WorkerLiveParams, WorkerPingResult, WorkerStartParams, WorkerStartResult, WorkerStatus, WorkerVersionRef, a11yDiagnosticCodes, actionDiagnosticCodes, ariaSummary, artifactCreateMethod, artifactDiagnosticCodes, artifactGetMethod, artifactListMethod, artifactPublishMethod, artifactVerifyMethod, buildDiagnosticCodes, bundleAssetName, canonicalJson, checkArgumentFrames, checkRequest, classifyMessage, cliDiagnosticCodes, connectBridge, consoleDiagnosticCodes, createDiagnostic, defineMethod, depDiagnosticCodes, depsAddMethod, deserializeAll, devStartMethod, devStopMethod, diagnosticCatalog, docsUrl, durationMs, encodeLine, envDiagnosticCodes, estimateImageTokens, eventsAckMethod, eventsReadMethod, eventsSubscribeMethod, eventsUnsubscribeMethod, fieldDiagnosticCodes, fromBase64, gcRunMethod, headerValue, homeDiagnosticCodes, hostDiagnosticCodes, hostMethods, hostNotifications, hygieneDiagnosticCodes, instanceCheckMethod, instanceStatusMethod, isFieldId, isFinalRunStatus, isJsonContentType, isWindowsBundle, liveDiagnosticCodes, livePushMethod, manifestDiagnosticCodes, mostraControlsRequest, mostraFieldFocus, mostraFields, mostraFlush, mostraFrameSessionEntered, mostraFrameSessionFailed, mostraInitializeMethod, mostraPage, mostraReady, mostraShutdownMethod, mostraVersionAvailable, negotiateRevision, networkDiagnosticCodes, normalizeScopes, parseParams, platformDiagnosticCodes, portAddressingExternalBaseMethod, portDraftsMirrorMethod, portIdentityResolveMethod, portSecretsGetMethod, portSubmissionsDeliverMethod, portTrustedControlsActivatedMethod, portTrustedControlsPolicyMethod, publishDiagnosticCodes, readViewContext, receivable, refusal, regressionDiagnosticCodes, resultsGetMethod, runtimeDiagnosticCodes, safeEqual, safePath, scopeAllows, secretDeleteMethod, secretDiagnosticCodes, secretListMethod, secretSetMethod, serializeAll, shareDiagnosticCodes, shareListMethod, shareStartMethod, shareStopMethod, smokeDiagnosticCodes, stateGetMethod, statePatchMethod, submitDiagnosticCodes, targetDiagnosticCodes, toBase64, typeDiagnosticCodes, uiInitialize, uiInitialized, uiOpenLink, uiSizeChanged, verifyDiagnosticCodes, viewDefaultMethod, viewLaunchMethod, viewRevokeMethod, viewRotateMethod, viewUrlMethod, viewportsFor, waitMethod, wireError };
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { ArtifactId, CommentId, Cursor, DeliveryId, MutationId, RunId, SubmissionId, ThreadId, TokenId, VersionId, ViewId, ViewerId } from "./ids.js";
1
+ import { ArtifactId, CommentId, Cursor, DeliveryId, MutationId, RunId, ShareId, SubmissionId, ThreadId, TokenId, VersionId, ViewId, ViewerId } from "./ids.js";
2
2
  import { ACTION_ARGS_MAX, ACTION_RESULT_MAX, ActionError, Batches, CallRequest, LIVE_KEY_PATTERN, LIVE_RING_DEFAULT, LIVE_RING_MAX, LIVE_VALUE_MAX, LiveRequest, RUN_KEY_MAX, RUN_LOG_MAX, RUN_LOG_TRUNCATED, RUN_STATUSES, RunAttachRequest, RunCancelRequest, RunProgress, RunRequest, RunState, SECRET_NAME_PATTERN, SECRET_VALUE_MAX, isFinalRunStatus } from "./actions.js";
3
3
  import { ARTIFACT_MANIFEST_KEYS, ArtifactLink, ArtifactManifest, SubmissionPolicy } from "./manifest.js";
4
4
  import { ArtifactDetail, ArtifactRef, ArtifactSummary, PublishReceipt, SourceRef, VersionSummary } from "./artifact.js";
@@ -9,9 +9,9 @@ import { JsonRpcErrorObject, JsonRpcFailure, JsonRpcNotification, JsonRpcRequest
9
9
  import { receivable } from "./receive.js";
10
10
  import { RpcPeer, parseParams } from "./rpc/peer.js";
11
11
  import { ControlsPolicy, REVIEW_SET_ID_PATTERN, SubmitChannel, TrustedControl, VersionRef, ViewContext, ViewContextWire, readViewContext } from "./view.js";
12
- import { BRIDGE_FIELDS_MAX, BRIDGE_MESSAGES, BRIDGE_TEXT_MAX, CONTROL_LABEL_MAX, MCP_APPS_PROTOCOL_VERSION, OPEN_LINK_SCHEMES, connectBridge, mostraControlsRequest, mostraFieldFocus, mostraFields, mostraFlush, mostraPage, mostraReady, mostraVersionAvailable, uiInitialize, uiInitialized, uiOpenLink, uiSizeChanged } from "./bridge.js";
12
+ import { BRIDGE_FIELDS_MAX, BRIDGE_MESSAGES, BRIDGE_TEXT_MAX, CONTROL_LABEL_MAX, MCP_APPS_PROTOCOL_VERSION, OPEN_LINK_SCHEMES, connectBridge, mostraControlsRequest, mostraFieldFocus, mostraFields, mostraFlush, mostraFrameSessionEntered, mostraFrameSessionFailed, mostraPage, mostraReady, mostraVersionAvailable, uiInitialize, uiInitialized, uiOpenLink, uiSizeChanged } from "./bridge.js";
13
13
  import { Actor, DeliveryStatus, DocumentRevision, EventFilter, EventRecord, EventTypePattern, FIELD_ID_MAX_LENGTH, FieldConflict, FieldOp, FieldState, MutationResult, ResultComment, Results, SIGNAL_NAME_PATTERN, SubmissionSummary, Viewer, ViewerSpec, WaitCondition, isFieldId } from "./interaction.js";
14
- import { BROWSER_PROTOCOL_REVISION, BROWSER_PROTOCOL_REVISIONS, CarryOver, ChooseRequest, DocumentSnapshot, FieldsRequest, FollowRequest, FrameTicket, OrphanedField, PollResult, SIGNAL_PAYLOAD_MAX_BYTES, ShellSubmitRequest, SignalRequest, StreamSnapshot, SubmitRequest } from "./browser.js";
14
+ import { BROWSER_PROTOCOL_REVISION, BROWSER_PROTOCOL_REVISIONS, CarryOver, ChooseRequest, DocumentSnapshot, EnterRequest, EnterResult, FRAME_SESSION_HEADER, FieldsRequest, FollowRequest, FrameSessionFacts, FrameTicket, OrphanedField, PollResult, SIGNAL_PAYLOAD_MAX_BYTES, ShellSubmitRequest, SignalRequest, StreamSnapshot, StreamTicket, StreamTicketRequest, SubmitRequest } from "./browser.js";
15
15
  import { BUNDLE_NAME, BUNDLE_PLATFORMS, BUNDLE_SETUP_MARKER, BundleAsset, BundleBrowser, BundleFileEntry, BundleFiles, BundleInfo, BundleLinkEntry, BundlePins, BundlePlatformSchema, BundleSetup, bundleAssetName, isWindowsBundle } from "./bundle.js";
16
16
  import { canonicalJson } from "./canonical.js";
17
17
  import { ALL_SCOPES, CapabilityScope, Duration, durationMs, normalizeScopes, scopeAllows } from "./capability.js";
@@ -35,6 +35,7 @@ import { publishDiagnosticCodes } from "./diagnostics/codes/publish.js";
35
35
  import { regressionDiagnosticCodes } from "./diagnostics/codes/regression.js";
36
36
  import { runtimeDiagnosticCodes } from "./diagnostics/codes/runtime.js";
37
37
  import { secretDiagnosticCodes } from "./diagnostics/codes/secret.js";
38
+ import { shareDiagnosticCodes } from "./diagnostics/codes/share.js";
38
39
  import { smokeDiagnosticCodes } from "./diagnostics/codes/smoke.js";
39
40
  import { submitDiagnosticCodes } from "./diagnostics/codes/submit.js";
40
41
  import { targetDiagnosticCodes } from "./diagnostics/codes/target.js";
@@ -60,9 +61,11 @@ import { gcRunMethod } from "./methods/gc/run.js";
60
61
  import { instanceCheckMethod } from "./methods/instance/check.js";
61
62
  import { HOST_PROTOCOL_REVISIONS, Revision, negotiateRevision } from "./revision.js";
62
63
  import { CLI_CLIENT_NAME, ClientCapabilities, ClientInfo, DependencyPolicy, HomeConfig, InstanceCapabilities, InstanceInfo, PortName, mostraInitializeMethod } from "./methods/mostra/initialize.js";
64
+ import { PUBLIC_SHARE_DEFAULT_TTL, PUBLIC_SHARE_MAX_TTL_MS, Share, ShareVia, shareStartMethod } from "./methods/share/start.js";
63
65
  import { ChildProcessStatus, DeliveryCounts, GatewayStatus, WorkerStatus, instanceStatusMethod } from "./methods/instance/status.js";
64
66
  import { livePushMethod } from "./methods/live/push.js";
65
67
  import { mostraShutdownMethod } from "./methods/mostra/shutdown.js";
68
+ import { ExternalBase, OriginString, portAddressingExternalBaseMethod } from "./methods/port/addressing-external-base.js";
66
69
  import { DraftMirror, portDraftsMirrorMethod } from "./methods/port/drafts-mirror.js";
67
70
  import { portIdentityResolveMethod } from "./methods/port/identity-resolve.js";
68
71
  import { portSecretsGetMethod } from "./methods/port/secrets-get.js";
@@ -73,6 +76,8 @@ import { ResultsMarkdown, resultsGetMethod } from "./methods/results/get.js";
73
76
  import { secretDeleteMethod } from "./methods/secret/delete.js";
74
77
  import { SecretEntry, secretSetMethod } from "./methods/secret/set.js";
75
78
  import { secretListMethod } from "./methods/secret/list.js";
79
+ import { shareListMethod } from "./methods/share/list.js";
80
+ import { shareStopMethod } from "./methods/share/stop.js";
76
81
  import { stateGetMethod } from "./methods/state/get.js";
77
82
  import { statePatchMethod } from "./methods/state/patch.js";
78
83
  import { CapabilityLink, viewUrlMethod } from "./methods/view/url.js";
@@ -85,4 +90,4 @@ import { hostMethods, hostNotifications } from "./methods/index.js";
85
90
  import { LineSplitter, MAX_LINE_LENGTH, encodeLine } from "./rpc/lines.js";
86
91
  import { ARGUMENT_BIGINT_DIGITS_MAX, RemoteError, SerializationError, UNSERIALIZABLE_CODE, ValueReader, ValueWriter, checkArgumentFrames, deserializeAll, fromBase64, serializeAll, toBase64, wireError } from "./serializer.js";
87
92
  import { DEFAULT_WORKER_LIMITS, ServerEmitParams, ServerLiveValueParams, ServerLogParams, ServerProgressParams, ServerSecretParams, ServerSignalParams, ServerStateGetParams, ServerStatePatchParams, WORKER_CHANNEL_REVISION, WORKER_METHODS, WorkerBatchParams, WorkerCallOutcome, WorkerCallParams, WorkerPingResult, WorkerStartParams, WorkerStartResult, WorkerVersionRef } from "./worker.js";
88
- export { ACTION_ARGS_MAX, ACTION_RESULT_MAX, ALL_SCOPES, ARGUMENT_BIGINT_DIGITS_MAX, ARTIFACT_MANIFEST_KEYS, ARTIFACT_PROGRESS, ActionError, Actor, AddedPackage, ArtifactDetail, ArtifactId, ArtifactLink, ArtifactManifest, ArtifactProgressParams, ArtifactRef, ArtifactSummary, BRIDGE_FIELDS_MAX, BRIDGE_MESSAGES, BRIDGE_TEXT_MAX, BROWSER_PROTOCOL_REVISION, BROWSER_PROTOCOL_REVISIONS, BUNDLE_NAME, BUNDLE_PLATFORMS, BUNDLE_SETUP_MARKER, Batches, BundleAsset, BundleBrowser, BundleFileEntry, BundleFiles, BundleInfo, BundleLinkEntry, BundlePins, BundlePlatformSchema, BundleSetup, CLI_CLIENT_NAME, CONTROL_LABEL_MAX, CSRF_HEADER, CallRequest, CapabilityLink, CapabilityScope, CarryOver, ChildProcessStatus, ChooseRequest, ClientCapabilities, ClientInfo, CommentId, ControlsPolicy, Cursor, DEFAULT_DOCS_BASE, DEFAULT_VIEWPORTS, DEFAULT_WORKER_LIMITS, DEV_NOTIFY, DIAGNOSTIC_AREAS, DeliveryCounts, DeliveryId, DeliveryStatus, DependencyPolicy, DevNotifyParams, Diagnostic, DiagnosticFix, DiagnosticLocation, DiagnosticPhase, DiagnosticSeverity, DocumentRevision, DocumentSnapshot, DraftMirror, Duration, EVENTS_NOTIFY, EVENTS_READ_MAX, EventFilter, EventRecord, EventTypePattern, EventsNotifyParams, FIELD_ID_MAX_LENGTH, FieldConflict, FieldOp, FieldState, FieldsRequest, FollowRequest, FrameTicket, GatewayStatus, HOST_PROTOCOL_REVISIONS, HomeConfig, InstanceCapabilities, InstanceInfo, JSON_RPC_ERROR_CODES, JsonRpcErrorObject, JsonRpcFailure, JsonRpcNotification, JsonRpcRequest, JsonRpcSuccess, LIVE_KEY_PATTERN, LIVE_RING_DEFAULT, LIVE_RING_MAX, LIVE_VALUE_MAX, LineSplitter, LiveRequest, MAX_LINE_LENGTH, MCP_APPS_PROTOCOL_VERSION, MutationId, MutationResult, OPEN_LINK_SCHEMES, OrphanedField, PollResult, PortName, PublishReceipt, REVIEW_SET_ID_PATTERN, RUN_KEY_MAX, RUN_LOG_MAX, RUN_LOG_TRUNCATED, RUN_STATUSES, RemoteError, ResultComment, Results, ResultsMarkdown, Revision, RpcError, RpcPeer, RunAttachRequest, RunCancelRequest, RunId, RunProgress, RunRequest, RunState, SECRET_NAME_PATTERN, SECRET_VALUE_MAX, SIGNAL_NAME_PATTERN, SIGNAL_PAYLOAD_MAX_BYTES, ScreenshotPolicy, SecretEntry, SerializationError, ServerEmitParams, ServerLiveValueParams, ServerLogParams, ServerProgressParams, ServerSecretParams, ServerSignalParams, ServerStateGetParams, ServerStatePatchParams, ShellSubmitRequest, SignalRequest, SourceRef, StreamSnapshot, SubmissionEnvelope, SubmissionId, SubmissionPolicy, SubmissionSummary, SubmitChannel, SubmitRequest, ThreadId, TokenId, TrustedControl, UNSERIALIZABLE_CODE, VERIFY_PROBE, VERIFY_REPORT, VERIFY_RUNNER_METHODS, ValueReader, ValueWriter, VerifyVerdict, VersionId, VersionRef, VersionSummary, ViewContext, ViewContextWire, ViewId, Viewer, ViewerId, ViewerSpec, WAIT_MAX_MS, WORKER_CHANNEL_REVISION, WORKER_METHODS, WaitCondition, WorkerBatchParams, WorkerCallOutcome, WorkerCallParams, WorkerPingResult, WorkerStartParams, WorkerStartResult, WorkerStatus, WorkerVersionRef, a11yDiagnosticCodes, actionDiagnosticCodes, ariaSummary, artifactCreateMethod, artifactDiagnosticCodes, artifactGetMethod, artifactListMethod, artifactPublishMethod, artifactVerifyMethod, buildDiagnosticCodes, bundleAssetName, canonicalJson, checkArgumentFrames, checkRequest, classifyMessage, cliDiagnosticCodes, connectBridge, consoleDiagnosticCodes, createDiagnostic, defineMethod, depDiagnosticCodes, depsAddMethod, deserializeAll, devStartMethod, devStopMethod, diagnosticCatalog, docsUrl, durationMs, encodeLine, envDiagnosticCodes, estimateImageTokens, eventsAckMethod, eventsReadMethod, eventsSubscribeMethod, eventsUnsubscribeMethod, fieldDiagnosticCodes, fromBase64, gcRunMethod, headerValue, homeDiagnosticCodes, hostDiagnosticCodes, hostMethods, hostNotifications, hygieneDiagnosticCodes, instanceCheckMethod, instanceStatusMethod, isFieldId, isFinalRunStatus, isJsonContentType, isWindowsBundle, liveDiagnosticCodes, livePushMethod, manifestDiagnosticCodes, mostraControlsRequest, mostraFieldFocus, mostraFields, mostraFlush, mostraInitializeMethod, mostraPage, mostraReady, mostraShutdownMethod, mostraVersionAvailable, negotiateRevision, networkDiagnosticCodes, normalizeScopes, parseParams, platformDiagnosticCodes, portDraftsMirrorMethod, portIdentityResolveMethod, portSecretsGetMethod, portSubmissionsDeliverMethod, portTrustedControlsActivatedMethod, portTrustedControlsPolicyMethod, publishDiagnosticCodes, readViewContext, receivable, refusal, regressionDiagnosticCodes, resultsGetMethod, runtimeDiagnosticCodes, safeEqual, safePath, scopeAllows, secretDeleteMethod, secretDiagnosticCodes, secretListMethod, secretSetMethod, serializeAll, smokeDiagnosticCodes, stateGetMethod, statePatchMethod, submitDiagnosticCodes, targetDiagnosticCodes, toBase64, typeDiagnosticCodes, uiInitialize, uiInitialized, uiOpenLink, uiSizeChanged, verifyDiagnosticCodes, viewDefaultMethod, viewLaunchMethod, viewRevokeMethod, viewRotateMethod, viewUrlMethod, viewportsFor, waitMethod, wireError };
93
+ export { ACTION_ARGS_MAX, ACTION_RESULT_MAX, ALL_SCOPES, ARGUMENT_BIGINT_DIGITS_MAX, ARTIFACT_MANIFEST_KEYS, ARTIFACT_PROGRESS, ActionError, Actor, AddedPackage, ArtifactDetail, ArtifactId, ArtifactLink, ArtifactManifest, ArtifactProgressParams, ArtifactRef, ArtifactSummary, BRIDGE_FIELDS_MAX, BRIDGE_MESSAGES, BRIDGE_TEXT_MAX, BROWSER_PROTOCOL_REVISION, BROWSER_PROTOCOL_REVISIONS, BUNDLE_NAME, BUNDLE_PLATFORMS, BUNDLE_SETUP_MARKER, Batches, BundleAsset, BundleBrowser, BundleFileEntry, BundleFiles, BundleInfo, BundleLinkEntry, BundlePins, BundlePlatformSchema, BundleSetup, CLI_CLIENT_NAME, CONTROL_LABEL_MAX, CSRF_HEADER, CallRequest, CapabilityLink, CapabilityScope, CarryOver, ChildProcessStatus, ChooseRequest, ClientCapabilities, ClientInfo, CommentId, ControlsPolicy, Cursor, DEFAULT_DOCS_BASE, DEFAULT_VIEWPORTS, DEFAULT_WORKER_LIMITS, DEV_NOTIFY, DIAGNOSTIC_AREAS, DeliveryCounts, DeliveryId, DeliveryStatus, DependencyPolicy, DevNotifyParams, Diagnostic, DiagnosticFix, DiagnosticLocation, DiagnosticPhase, DiagnosticSeverity, DocumentRevision, DocumentSnapshot, DraftMirror, Duration, EVENTS_NOTIFY, EVENTS_READ_MAX, EnterRequest, EnterResult, EventFilter, EventRecord, EventTypePattern, EventsNotifyParams, ExternalBase, FIELD_ID_MAX_LENGTH, FRAME_SESSION_HEADER, FieldConflict, FieldOp, FieldState, FieldsRequest, FollowRequest, FrameSessionFacts, FrameTicket, GatewayStatus, HOST_PROTOCOL_REVISIONS, HomeConfig, InstanceCapabilities, InstanceInfo, JSON_RPC_ERROR_CODES, JsonRpcErrorObject, JsonRpcFailure, JsonRpcNotification, JsonRpcRequest, JsonRpcSuccess, LIVE_KEY_PATTERN, LIVE_RING_DEFAULT, LIVE_RING_MAX, LIVE_VALUE_MAX, LineSplitter, LiveRequest, MAX_LINE_LENGTH, MCP_APPS_PROTOCOL_VERSION, MutationId, MutationResult, OPEN_LINK_SCHEMES, OriginString, OrphanedField, PUBLIC_SHARE_DEFAULT_TTL, PUBLIC_SHARE_MAX_TTL_MS, PollResult, PortName, PublishReceipt, REVIEW_SET_ID_PATTERN, RUN_KEY_MAX, RUN_LOG_MAX, RUN_LOG_TRUNCATED, RUN_STATUSES, RemoteError, ResultComment, Results, ResultsMarkdown, Revision, RpcError, RpcPeer, RunAttachRequest, RunCancelRequest, RunId, RunProgress, RunRequest, RunState, SECRET_NAME_PATTERN, SECRET_VALUE_MAX, SIGNAL_NAME_PATTERN, SIGNAL_PAYLOAD_MAX_BYTES, ScreenshotPolicy, SecretEntry, SerializationError, ServerEmitParams, ServerLiveValueParams, ServerLogParams, ServerProgressParams, ServerSecretParams, ServerSignalParams, ServerStateGetParams, ServerStatePatchParams, Share, ShareId, ShareVia, ShellSubmitRequest, SignalRequest, SourceRef, StreamSnapshot, StreamTicket, StreamTicketRequest, SubmissionEnvelope, SubmissionId, SubmissionPolicy, SubmissionSummary, SubmitChannel, SubmitRequest, ThreadId, TokenId, TrustedControl, UNSERIALIZABLE_CODE, VERIFY_PROBE, VERIFY_REPORT, VERIFY_RUNNER_METHODS, ValueReader, ValueWriter, VerifyVerdict, VersionId, VersionRef, VersionSummary, ViewContext, ViewContextWire, ViewId, Viewer, ViewerId, ViewerSpec, WAIT_MAX_MS, WORKER_CHANNEL_REVISION, WORKER_METHODS, WaitCondition, WorkerBatchParams, WorkerCallOutcome, WorkerCallParams, WorkerPingResult, WorkerStartParams, WorkerStartResult, WorkerStatus, WorkerVersionRef, a11yDiagnosticCodes, actionDiagnosticCodes, ariaSummary, artifactCreateMethod, artifactDiagnosticCodes, artifactGetMethod, artifactListMethod, artifactPublishMethod, artifactVerifyMethod, buildDiagnosticCodes, bundleAssetName, canonicalJson, checkArgumentFrames, checkRequest, classifyMessage, cliDiagnosticCodes, connectBridge, consoleDiagnosticCodes, createDiagnostic, defineMethod, depDiagnosticCodes, depsAddMethod, deserializeAll, devStartMethod, devStopMethod, diagnosticCatalog, docsUrl, durationMs, encodeLine, envDiagnosticCodes, estimateImageTokens, eventsAckMethod, eventsReadMethod, eventsSubscribeMethod, eventsUnsubscribeMethod, fieldDiagnosticCodes, fromBase64, gcRunMethod, headerValue, homeDiagnosticCodes, hostDiagnosticCodes, hostMethods, hostNotifications, hygieneDiagnosticCodes, instanceCheckMethod, instanceStatusMethod, isFieldId, isFinalRunStatus, isJsonContentType, isWindowsBundle, liveDiagnosticCodes, livePushMethod, manifestDiagnosticCodes, mostraControlsRequest, mostraFieldFocus, mostraFields, mostraFlush, mostraFrameSessionEntered, mostraFrameSessionFailed, mostraInitializeMethod, mostraPage, mostraReady, mostraShutdownMethod, mostraVersionAvailable, negotiateRevision, networkDiagnosticCodes, normalizeScopes, parseParams, platformDiagnosticCodes, portAddressingExternalBaseMethod, portDraftsMirrorMethod, portIdentityResolveMethod, portSecretsGetMethod, portSubmissionsDeliverMethod, portTrustedControlsActivatedMethod, portTrustedControlsPolicyMethod, publishDiagnosticCodes, readViewContext, receivable, refusal, regressionDiagnosticCodes, resultsGetMethod, runtimeDiagnosticCodes, safeEqual, safePath, scopeAllows, secretDeleteMethod, secretDiagnosticCodes, secretListMethod, secretSetMethod, serializeAll, shareDiagnosticCodes, shareListMethod, shareStartMethod, shareStopMethod, smokeDiagnosticCodes, stateGetMethod, statePatchMethod, submitDiagnosticCodes, targetDiagnosticCodes, toBase64, typeDiagnosticCodes, uiInitialize, uiInitialized, uiOpenLink, uiSizeChanged, verifyDiagnosticCodes, viewDefaultMethod, viewLaunchMethod, viewRevokeMethod, viewRotateMethod, viewUrlMethod, viewportsFor, waitMethod, wireError };
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../../src/methods/index.ts"],"mappings":";;;qBA6Ca,sBAAsB;;qBAyCtB,4BAA4B"}
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../../src/methods/index.ts"],"mappings":";;;qBAiDa,sBAAsB;;qBA6CtB,4BAA4B"}
@@ -14,9 +14,11 @@ import { eventsUnsubscribeMethod } from "./events/unsubscribe.js";
14
14
  import { gcRunMethod } from "./gc/run.js";
15
15
  import { instanceCheckMethod } from "./instance/check.js";
16
16
  import { mostraInitializeMethod } from "./mostra/initialize.js";
17
+ import { shareStartMethod } from "./share/start.js";
17
18
  import { instanceStatusMethod } from "./instance/status.js";
18
19
  import { livePushMethod } from "./live/push.js";
19
20
  import { mostraShutdownMethod } from "./mostra/shutdown.js";
21
+ import { portAddressingExternalBaseMethod } from "./port/addressing-external-base.js";
20
22
  import { portDraftsMirrorMethod } from "./port/drafts-mirror.js";
21
23
  import { portIdentityResolveMethod } from "./port/identity-resolve.js";
22
24
  import { portSecretsGetMethod } from "./port/secrets-get.js";
@@ -27,6 +29,8 @@ import { resultsGetMethod } from "./results/get.js";
27
29
  import { secretDeleteMethod } from "./secret/delete.js";
28
30
  import { secretSetMethod } from "./secret/set.js";
29
31
  import { secretListMethod } from "./secret/list.js";
32
+ import { shareListMethod } from "./share/list.js";
33
+ import { shareStopMethod } from "./share/stop.js";
30
34
  import { stateGetMethod } from "./state/get.js";
31
35
  import { statePatchMethod } from "./state/patch.js";
32
36
  import { viewUrlMethod } from "./view/url.js";
@@ -73,7 +77,11 @@ const hostMethods = [
73
77
  instanceCheckMethod,
74
78
  devStartMethod,
75
79
  devStopMethod,
76
- portIdentityResolveMethod
80
+ portIdentityResolveMethod,
81
+ shareStartMethod,
82
+ shareStopMethod,
83
+ shareListMethod,
84
+ portAddressingExternalBaseMethod
77
85
  ];
78
86
  /** Every notification the instance sends to its clients (INTERFACES §6). */
79
87
  const hostNotifications = [
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../src/methods/index.ts"],"sourcesContent":["/**\n * Every host protocol method this package defines. `pnpm gen protocol-method` adds entries at the\n * markers; the method itself lives in its own module under `methods/<group>/`.\n */\nimport type { AnyMethod, AnyNotification } from \"../method.ts\";\nimport { ARTIFACT_PROGRESS, ArtifactProgressParams } from \"../verify.ts\";\nimport { artifactCreateMethod } from \"./artifact/create.ts\";\nimport { artifactGetMethod } from \"./artifact/get.ts\";\nimport { artifactListMethod } from \"./artifact/list.ts\";\nimport { artifactPublishMethod } from \"./artifact/publish.ts\";\nimport { artifactVerifyMethod } from \"./artifact/verify.ts\";\nimport { depsAddMethod } from \"./deps/add.ts\";\nimport { DEV_NOTIFY, DevNotifyParams, devStartMethod } from \"./dev/start.ts\";\nimport { devStopMethod } from \"./dev/stop.ts\";\nimport { eventsAckMethod } from \"./events/ack.ts\";\nimport { eventsReadMethod } from \"./events/read.ts\";\nimport { EVENTS_NOTIFY, EventsNotifyParams, eventsSubscribeMethod } from \"./events/subscribe.ts\";\nimport { eventsUnsubscribeMethod } from \"./events/unsubscribe.ts\";\nimport { gcRunMethod } from \"./gc/run.ts\";\nimport { instanceCheckMethod } from \"./instance/check.ts\";\nimport { instanceStatusMethod } from \"./instance/status.ts\";\nimport { livePushMethod } from \"./live/push.ts\";\nimport { mostraInitializeMethod } from \"./mostra/initialize.ts\";\nimport { mostraShutdownMethod } from \"./mostra/shutdown.ts\";\nimport { portDraftsMirrorMethod } from \"./port/drafts-mirror.ts\";\nimport { portIdentityResolveMethod } from \"./port/identity-resolve.ts\";\nimport { portSecretsGetMethod } from \"./port/secrets-get.ts\";\nimport { portSubmissionsDeliverMethod } from \"./port/submissions-deliver.ts\";\nimport { portTrustedControlsActivatedMethod } from \"./port/trusted-controls-activated.ts\";\nimport { portTrustedControlsPolicyMethod } from \"./port/trusted-controls-policy.ts\";\nimport { resultsGetMethod } from \"./results/get.ts\";\nimport { secretDeleteMethod } from \"./secret/delete.ts\";\nimport { secretListMethod } from \"./secret/list.ts\";\nimport { secretSetMethod } from \"./secret/set.ts\";\nimport { stateGetMethod } from \"./state/get.ts\";\nimport { statePatchMethod } from \"./state/patch.ts\";\nimport { viewDefaultMethod } from \"./view/default.ts\";\nimport { viewLaunchMethod } from \"./view/launch.ts\";\nimport { viewRevokeMethod } from \"./view/revoke.ts\";\nimport { viewRotateMethod } from \"./view/rotate.ts\";\nimport { viewUrlMethod } from \"./view/url.ts\";\nimport { waitMethod } from \"./wait/wait.ts\";\n// gen:method-imports\n\n/** Every host protocol method, in the order they were added. */\nexport const hostMethods: readonly AnyMethod[] = [\n mostraInitializeMethod,\n mostraShutdownMethod,\n instanceStatusMethod,\n artifactCreateMethod,\n artifactPublishMethod,\n artifactListMethod,\n artifactGetMethod,\n depsAddMethod,\n viewUrlMethod,\n viewRevokeMethod,\n viewRotateMethod,\n stateGetMethod,\n resultsGetMethod,\n waitMethod,\n eventsReadMethod,\n eventsSubscribeMethod,\n eventsUnsubscribeMethod,\n statePatchMethod,\n eventsAckMethod,\n portSubmissionsDeliverMethod,\n portDraftsMirrorMethod,\n portTrustedControlsPolicyMethod,\n portTrustedControlsActivatedMethod,\n secretSetMethod,\n secretListMethod,\n secretDeleteMethod,\n livePushMethod,\n portSecretsGetMethod,\n artifactVerifyMethod,\n viewDefaultMethod,\n viewLaunchMethod,\n gcRunMethod,\n instanceCheckMethod,\n devStartMethod,\n devStopMethod,\n portIdentityResolveMethod,\n // gen:methods\n];\n\n/** Every notification the instance sends to its clients (INTERFACES §6). */\nexport const hostNotifications: readonly AnyNotification[] = [\n { method: EVENTS_NOTIFY, params: EventsNotifyParams as AnyNotification[\"params\"] },\n { method: ARTIFACT_PROGRESS, params: ArtifactProgressParams as AnyNotification[\"params\"] },\n { method: DEV_NOTIFY, params: DevNotifyParams as AnyNotification[\"params\"] },\n];\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6CA,MAAa,cAAoC;CAC/C;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AAEF;;AAGA,MAAa,oBAAgD;CAC3D;EAAE,QAAQ;EAAe,QAAQ;CAAgD;CACjF;EAAE,QAAQ;EAAmB,QAAQ;CAAoD;CACzF;EAAE,QAAQ;EAAY,QAAQ;CAA6C;AAC7E"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../src/methods/index.ts"],"sourcesContent":["/**\n * Every host protocol method this package defines. `pnpm gen protocol-method` adds entries at the\n * markers; the method itself lives in its own module under `methods/<group>/`.\n */\nimport type { AnyMethod, AnyNotification } from \"../method.ts\";\nimport { ARTIFACT_PROGRESS, ArtifactProgressParams } from \"../verify.ts\";\nimport { artifactCreateMethod } from \"./artifact/create.ts\";\nimport { artifactGetMethod } from \"./artifact/get.ts\";\nimport { artifactListMethod } from \"./artifact/list.ts\";\nimport { artifactPublishMethod } from \"./artifact/publish.ts\";\nimport { artifactVerifyMethod } from \"./artifact/verify.ts\";\nimport { depsAddMethod } from \"./deps/add.ts\";\nimport { DEV_NOTIFY, DevNotifyParams, devStartMethod } from \"./dev/start.ts\";\nimport { devStopMethod } from \"./dev/stop.ts\";\nimport { eventsAckMethod } from \"./events/ack.ts\";\nimport { eventsReadMethod } from \"./events/read.ts\";\nimport { EVENTS_NOTIFY, EventsNotifyParams, eventsSubscribeMethod } from \"./events/subscribe.ts\";\nimport { eventsUnsubscribeMethod } from \"./events/unsubscribe.ts\";\nimport { gcRunMethod } from \"./gc/run.ts\";\nimport { instanceCheckMethod } from \"./instance/check.ts\";\nimport { instanceStatusMethod } from \"./instance/status.ts\";\nimport { livePushMethod } from \"./live/push.ts\";\nimport { mostraInitializeMethod } from \"./mostra/initialize.ts\";\nimport { mostraShutdownMethod } from \"./mostra/shutdown.ts\";\nimport { portAddressingExternalBaseMethod } from \"./port/addressing-external-base.ts\";\nimport { portDraftsMirrorMethod } from \"./port/drafts-mirror.ts\";\nimport { portIdentityResolveMethod } from \"./port/identity-resolve.ts\";\nimport { portSecretsGetMethod } from \"./port/secrets-get.ts\";\nimport { portSubmissionsDeliverMethod } from \"./port/submissions-deliver.ts\";\nimport { portTrustedControlsActivatedMethod } from \"./port/trusted-controls-activated.ts\";\nimport { portTrustedControlsPolicyMethod } from \"./port/trusted-controls-policy.ts\";\nimport { resultsGetMethod } from \"./results/get.ts\";\nimport { secretDeleteMethod } from \"./secret/delete.ts\";\nimport { secretListMethod } from \"./secret/list.ts\";\nimport { secretSetMethod } from \"./secret/set.ts\";\nimport { shareListMethod } from \"./share/list.ts\";\nimport { shareStartMethod } from \"./share/start.ts\";\nimport { shareStopMethod } from \"./share/stop.ts\";\nimport { stateGetMethod } from \"./state/get.ts\";\nimport { statePatchMethod } from \"./state/patch.ts\";\nimport { viewDefaultMethod } from \"./view/default.ts\";\nimport { viewLaunchMethod } from \"./view/launch.ts\";\nimport { viewRevokeMethod } from \"./view/revoke.ts\";\nimport { viewRotateMethod } from \"./view/rotate.ts\";\nimport { viewUrlMethod } from \"./view/url.ts\";\nimport { waitMethod } from \"./wait/wait.ts\";\n// gen:method-imports\n\n/** Every host protocol method, in the order they were added. */\nexport const hostMethods: readonly AnyMethod[] = [\n mostraInitializeMethod,\n mostraShutdownMethod,\n instanceStatusMethod,\n artifactCreateMethod,\n artifactPublishMethod,\n artifactListMethod,\n artifactGetMethod,\n depsAddMethod,\n viewUrlMethod,\n viewRevokeMethod,\n viewRotateMethod,\n stateGetMethod,\n resultsGetMethod,\n waitMethod,\n eventsReadMethod,\n eventsSubscribeMethod,\n eventsUnsubscribeMethod,\n statePatchMethod,\n eventsAckMethod,\n portSubmissionsDeliverMethod,\n portDraftsMirrorMethod,\n portTrustedControlsPolicyMethod,\n portTrustedControlsActivatedMethod,\n secretSetMethod,\n secretListMethod,\n secretDeleteMethod,\n livePushMethod,\n portSecretsGetMethod,\n artifactVerifyMethod,\n viewDefaultMethod,\n viewLaunchMethod,\n gcRunMethod,\n instanceCheckMethod,\n devStartMethod,\n devStopMethod,\n portIdentityResolveMethod,\n shareStartMethod,\n shareStopMethod,\n shareListMethod,\n portAddressingExternalBaseMethod,\n // gen:methods\n];\n\n/** Every notification the instance sends to its clients (INTERFACES §6). */\nexport const hostNotifications: readonly AnyNotification[] = [\n { method: EVENTS_NOTIFY, params: EventsNotifyParams as AnyNotification[\"params\"] },\n { method: ARTIFACT_PROGRESS, params: ArtifactProgressParams as AnyNotification[\"params\"] },\n { method: DEV_NOTIFY, params: DevNotifyParams as AnyNotification[\"params\"] },\n];\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiDA,MAAa,cAAoC;CAC/C;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AAEF;;AAGA,MAAa,oBAAgD;CAC3D;EAAE,QAAQ;EAAe,QAAQ;CAAgD;CACjF;EAAE,QAAQ;EAAmB,QAAQ;CAAoD;CACzF;EAAE,QAAQ;EAAY,QAAQ;CAA6C;AAC7E"}
@@ -1,5 +1,6 @@
1
1
  import { MethodDefinition } from "../../method.js";
2
2
  import { InstanceInfo } from "../mostra/initialize.js";
3
+ import { Share } from "../share/start.js";
3
4
  import * as z from "zod";
4
5
  //#region src/methods/instance/status.d.ts
5
6
  /** The params of `instance/status` (INTERFACES §6): none. */
@@ -26,6 +27,24 @@ export interface GatewayStatus {
26
27
  readonly artifactId: string;
27
28
  readonly origin: string;
28
29
  }[];
30
+ /**
31
+ * The gateway's external addresses (D158 item 1): a share's tunnel addresses and a host's
32
+ * external bases, each a listener of its own on loopback (WP-13).
33
+ */
34
+ readonly faces?: readonly FaceStatus[];
35
+ }
36
+ /** One external address of the gateway (D158 item 1). */
37
+ export interface FaceStatus {
38
+ /** The origin browsers use. */
39
+ readonly origin: string;
40
+ /** The loopback origin the tunnel or the host forwards it to. */
41
+ readonly local: string;
42
+ /** Which listener it fronts: the shell, or one artifact's frame. */
43
+ readonly listener: "shell" | "artifact";
44
+ /** The artifact, for an artifact's face. */
45
+ readonly artifactId?: string;
46
+ /** Who keeps it: a share's tunnel (`tailnet`, `funnel`, `cloudflare`) or a host (`host`). */
47
+ readonly by: "tailnet" | "funnel" | "cloudflare" | "host" | (string & {});
29
48
  }
30
49
  /**
31
50
  * The result of `instance/status`. The packages that add ports, deliveries, shares and versions
@@ -50,6 +69,11 @@ export interface InstanceStatusResult {
50
69
  readonly workers?: readonly WorkerStatus[];
51
70
  /** When the daemon exits for lack of work, if it will (WP-08, RT-08); absent: it won't. */
52
71
  readonly idleExitAt?: string;
72
+ /**
73
+ * The active shares (WP-13, D158), which keep a daemon from its idle exit. Their `url` is left
74
+ * out here, since status is printed where a link's secret mustn't appear: `share/list` gives it.
75
+ */
76
+ readonly shares?: readonly Share[];
53
77
  }
54
78
  /** One artifact version's worker (RT-03, D62). */
55
79
  export interface WorkerStatus {
@@ -1 +1 @@
1
- {"version":3,"file":"status.d.ts","names":[],"sources":["../../../src/methods/instance/status.ts"],"mappings":";;;;;YAMY,uBAAuB;;iBAGlB;;WAEN;;WAEA;;WAEA;;WAEA;;;iBAIM;;WAEN;;WAEA;;WAEA;aAA+B;aAA6B;;;;;;;iBAOtD;;WAEN,UAAU;;WAEV;;WAEA;;WAEA;;WAEA,oBAAoB;;WAEpB,UAAU;;WAEV,sBAAsB;;WAEtB,mBAAmB;;WAEnB;;;iBAIM;;WAEN;;WAEA;;;;;WAKA;;WAEA;;WAEA;;WAEA;;WAEA;;WAEA;;;qBAIE,cAAc,EAAE,QAAQ;;iBAcpB;;WAEN;;WAEA;;WAEA;;WAEA;;WAEA;;WAEA;;;qBAIE,gBAAgB,EAAE,QAAQ;;qBAe1B,eAAe,EAAE,QAAQ;;qBASzB,oBAAoB,EAAE,QAAQ;;qBA+B9B,sBAAsB,iBAAiB,sBAAsB"}
1
+ {"version":3,"file":"status.d.ts","names":[],"sources":["../../../src/methods/instance/status.ts"],"mappings":";;;;;;YAOY,uBAAuB;;iBAGlB;;WAEN;;WAEA;;WAEA;;WAEA;;;iBAIM;;WAEN;;WAEA;;WAEA;aAA+B;aAA6B;;;;;;WAK5D,iBAAiB;;;iBAIX;;WAEN;;WAEA;;WAEA;;WAEA;;WAEA;;;;;;iBAOM;;WAEN,UAAU;;WAEV;;WAEA;;WAEA;;WAEA,oBAAoB;;WAEpB,UAAU;;WAEV,sBAAsB;;WAEtB,mBAAmB;;WAEnB;;;;;WAKA,kBAAkB;;;iBAIZ;;WAEN;;WAEA;;;;;WAKA;;WAEA;;WAEA;;WAEA;;WAEA;;WAEA;;;qBAIE,cAAc,EAAE,QAAQ;;iBAcpB;;WAEN;;WAEA;;WAEA;;WAEA;;WAEA;;WAEA;;;qBAIE,gBAAgB,EAAE,QAAQ;;qBAe1B,eAAe,EAAE,QAAQ;;qBAqBzB,oBAAoB,EAAE,QAAQ;;qBAgC9B,sBAAsB,iBAAiB,sBAAsB"}
@@ -1,6 +1,7 @@
1
1
  import { wireRegistry } from "../../wire-registry.js";
2
2
  import { defineMethod } from "../../method.js";
3
3
  import { InstanceInfo } from "../mostra/initialize.js";
4
+ import { Share } from "../share/start.js";
4
5
  import * as z from "zod";
5
6
  //#region src/methods/instance/status.ts
6
7
  /** The Zod schema of the `WorkerStatus` type. */
@@ -42,7 +43,14 @@ const GatewayStatus = z.object({
42
43
  artifacts: z.array(z.object({
43
44
  artifactId: z.string(),
44
45
  origin: z.string()
45
- })).readonly()
46
+ })).readonly(),
47
+ faces: z.array(z.object({
48
+ origin: z.string(),
49
+ local: z.string(),
50
+ listener: z.enum(["shell", "artifact"]),
51
+ artifactId: z.string().exactOptional(),
52
+ by: z.string()
53
+ })).readonly().exactOptional()
46
54
  }).register(wireRegistry, {
47
55
  id: "GatewayStatus",
48
56
  description: "Where the gateway listens."
@@ -67,7 +75,8 @@ const result = z.object({
67
75
  gateway: GatewayStatus.exactOptional(),
68
76
  deliveries: z.array(DeliveryCounts).readonly().exactOptional(),
69
77
  workers: z.array(WorkerStatus).readonly().exactOptional(),
70
- idleExitAt: z.string().exactOptional()
78
+ idleExitAt: z.string().exactOptional(),
79
+ shares: z.array(Share).readonly().exactOptional()
71
80
  }).register(wireRegistry, { id: "InstanceStatusResult" });
72
81
  /** `instance/status`: reports the instance, its socket, its connections and its child processes. */
73
82
  const instanceStatusMethod = defineMethod({
@@ -1 +1 @@
1
- {"version":3,"file":"status.js","names":[],"sources":["../../../src/methods/instance/status.ts"],"sourcesContent":["import * as z from \"zod\";\nimport { defineMethod, type MethodDefinition } from \"../../method.ts\";\nimport { wireRegistry } from \"../../wire-registry.ts\";\nimport { InstanceInfo } from \"../mostra/initialize.ts\";\n\n/** The params of `instance/status` (INTERFACES §6): none. */\nexport type InstanceStatusParams = Record<string, never>;\n\n/** One child process the instance supervises. */\nexport interface ChildProcessStatus {\n /** The process ID. The child leads its own process group, so this is also its group ID. */\n readonly pid: number;\n /** What the child is: `builder`, `verify`, `worker`, `pty-host`, `demo`, `install` and so on. */\n readonly kind: string;\n /** What the child serves, such as an artifact or version ID. */\n readonly ownerRef: string;\n /** When the instance started it (RFC 3339, UTC). */\n readonly startedAt: string;\n}\n\n/** Where the gateway listens (D99, WP-05). */\nexport interface GatewayStatus {\n /** The address its listeners bind: `127.0.0.1` unless the instance started with `--bind`. */\n readonly bind: string;\n /** The shell's origin, where every capability link points. */\n readonly shell: string;\n /** The artifact origins it is serving now, one per opened artifact. */\n readonly artifacts: readonly { readonly artifactId: string; readonly origin: string }[];\n}\n\n/**\n * The result of `instance/status`. The packages that add ports, deliveries, shares and versions\n * add their fields here (INTERFACES §6).\n */\nexport interface InstanceStatusResult {\n /** The instance itself. */\n readonly instance: InstanceInfo;\n /** When the instance took ownership of its home (RFC 3339, UTC). */\n readonly startedAt: string;\n /** The control socket clients attach to. */\n readonly socket: string;\n /** How many protocol connections are open, this one included. */\n readonly connections: number;\n /** The child processes the instance supervises. */\n readonly processes: readonly ChildProcessStatus[];\n /** Where the gateway listens, once it has started (WP-05). */\n readonly gateway?: GatewayStatus;\n /** The outbox per host (WP-06, D105): how many deliveries are in each state. */\n readonly deliveries?: readonly DeliveryCounts[];\n /** The artifact workers, one per active version with server code (WP-08, RT-03). */\n readonly workers?: readonly WorkerStatus[];\n /** When the daemon exits for lack of work, if it will (WP-08, RT-08); absent: it won't. */\n readonly idleExitAt?: string;\n}\n\n/** One artifact version's worker (RT-03, D62). */\nexport interface WorkerStatus {\n /** The artifact. */\n readonly artifactId: string;\n /** The version. */\n readonly versionId: string;\n /**\n * `starting`, `ready`, `backoff` (it crashed and restarts on the next request after `retryAt`),\n * `parked` (it crashed more than 5 times in 10 minutes, FAILURE_MODEL §2), `stopped`.\n */\n readonly state: \"starting\" | \"ready\" | \"backoff\" | \"parked\" | \"stopped\";\n /** The worker's process, while it runs locally. */\n readonly pid?: number;\n /** Crashes in the last 10 minutes. */\n readonly crashes: number;\n /** The last crash's cause, such as `out of memory` or `event loop blocked for 10 s`. */\n readonly lastCause?: string;\n /** When a worker in `backoff` may start again. */\n readonly retryAt?: string;\n /** Calls, runs and live producers it serves now. */\n readonly active: number;\n}\n\n/** The Zod schema of the `WorkerStatus` type. */\nexport const WorkerStatus: z.ZodType<WorkerStatus> = z\n .object({\n artifactId: z.string(),\n versionId: z.string(),\n state: z.enum([\"starting\", \"ready\", \"backoff\", \"parked\", \"stopped\"]),\n pid: z.int().min(1).exactOptional(),\n crashes: z.int().min(0),\n lastCause: z.string().exactOptional(),\n retryAt: z.string().exactOptional(),\n active: z.int().min(0),\n })\n .register(wireRegistry, { id: \"WorkerStatus\", description: \"One artifact version's worker.\" });\n\n/** One host's deliveries by state (D105). */\nexport interface DeliveryCounts {\n /** The host's client name; empty for Mostra's built-in adapter (D105). */\n readonly owner: string;\n /** Whether a connection of this host has the submissions port registered now. */\n readonly connected: boolean;\n /** Deliveries not yet answered terminally. */\n readonly pending: number;\n /** Deliveries the host accepted. */\n readonly delivered: number;\n /** Deliveries the host rejected terminally. */\n readonly rejected: number;\n /** Deliveries the host declared undeliverable. */\n readonly undeliverable: number;\n}\n\n/** The Zod schema of the `DeliveryCounts` type. */\nexport const DeliveryCounts: z.ZodType<DeliveryCounts> = z\n .object({\n owner: z.string(),\n connected: z.boolean(),\n pending: z.int().min(0),\n delivered: z.int().min(0),\n rejected: z.int().min(0),\n undeliverable: z.int().min(0),\n })\n .register(wireRegistry, {\n id: \"DeliveryCounts\",\n description: \"One host's deliveries by state, and whether it is connected.\",\n });\n\n/** The Zod schema of the `GatewayStatus` type. */\nexport const GatewayStatus: z.ZodType<GatewayStatus> = z\n .object({\n bind: z.string(),\n shell: z.string(),\n artifacts: z.array(z.object({ artifactId: z.string(), origin: z.string() })).readonly(),\n })\n .register(wireRegistry, { id: \"GatewayStatus\", description: \"Where the gateway listens.\" });\n\n/** The Zod schema of the `ChildProcessStatus` type. */\nexport const ChildProcessStatus: z.ZodType<ChildProcessStatus> = z\n .object({\n pid: z.int().min(1),\n kind: z.string(),\n ownerRef: z.string(),\n startedAt: z.iso.datetime(),\n })\n .register(wireRegistry, {\n id: \"ChildProcessStatus\",\n description: \"One child process the instance supervises.\",\n });\n\nconst params: z.ZodType<InstanceStatusParams> = z\n .object({})\n .register(wireRegistry, { id: \"InstanceStatusParams\" });\n\nconst result: z.ZodType<InstanceStatusResult> = z\n .object({\n instance: InstanceInfo,\n startedAt: z.iso.datetime(),\n socket: z.string(),\n connections: z.int().min(0),\n processes: z.array(ChildProcessStatus).readonly(),\n gateway: GatewayStatus.exactOptional(),\n deliveries: z.array(DeliveryCounts).readonly().exactOptional(),\n workers: z.array(WorkerStatus).readonly().exactOptional(),\n idleExitAt: z.string().exactOptional(),\n })\n .register(wireRegistry, { id: \"InstanceStatusResult\" });\n\n/** `instance/status`: reports the instance, its socket, its connections and its child processes. */\nexport const instanceStatusMethod: MethodDefinition<InstanceStatusParams, InstanceStatusResult> =\n defineMethod({\n method: \"instance/status\",\n direction: \"client-to-instance\",\n mutating: false,\n params,\n result,\n });\n"],"mappings":";;;;;;AA+EA,MAAa,eAAwC,EAClD,OAAO;CACN,YAAY,EAAE,OAAO;CACrB,WAAW,EAAE,OAAO;CACpB,OAAO,EAAE,KAAK;EAAC;EAAY;EAAS;EAAW;EAAU;CAAS,CAAC;CACnE,KAAK,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,cAAc;CAClC,SAAS,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC;CACtB,WAAW,EAAE,OAAO,CAAC,CAAC,cAAc;CACpC,SAAS,EAAE,OAAO,CAAC,CAAC,cAAc;CAClC,QAAQ,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC;AACvB,CAAC,CAAC,CACD,SAAS,cAAc;CAAE,IAAI;CAAgB,aAAa;AAAiC,CAAC;;AAmB/F,MAAa,iBAA4C,EACtD,OAAO;CACN,OAAO,EAAE,OAAO;CAChB,WAAW,EAAE,QAAQ;CACrB,SAAS,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC;CACtB,WAAW,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC;CACxB,UAAU,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC;CACvB,eAAe,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC;AAC9B,CAAC,CAAC,CACD,SAAS,cAAc;CACtB,IAAI;CACJ,aAAa;AACf,CAAC;;AAGH,MAAa,gBAA0C,EACpD,OAAO;CACN,MAAM,EAAE,OAAO;CACf,OAAO,EAAE,OAAO;CAChB,WAAW,EAAE,MAAM,EAAE,OAAO;EAAE,YAAY,EAAE,OAAO;EAAG,QAAQ,EAAE,OAAO;CAAE,CAAC,CAAC,CAAC,CAAC,SAAS;AACxF,CAAC,CAAC,CACD,SAAS,cAAc;CAAE,IAAI;CAAiB,aAAa;AAA6B,CAAC;;AAG5F,MAAa,qBAAoD,EAC9D,OAAO;CACN,KAAK,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC;CAClB,MAAM,EAAE,OAAO;CACf,UAAU,EAAE,OAAO;CACnB,WAAW,EAAE,IAAI,SAAS;AAC5B,CAAC,CAAC,CACD,SAAS,cAAc;CACtB,IAAI;CACJ,aAAa;AACf,CAAC;AAEH,MAAM,SAA0C,EAC7C,OAAO,CAAC,CAAC,CAAC,CACV,SAAS,cAAc,EAAE,IAAI,uBAAuB,CAAC;AAExD,MAAM,SAA0C,EAC7C,OAAO;CACN,UAAU;CACV,WAAW,EAAE,IAAI,SAAS;CAC1B,QAAQ,EAAE,OAAO;CACjB,aAAa,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC;CAC1B,WAAW,EAAE,MAAM,kBAAkB,CAAC,CAAC,SAAS;CAChD,SAAS,cAAc,cAAc;CACrC,YAAY,EAAE,MAAM,cAAc,CAAC,CAAC,SAAS,CAAC,CAAC,cAAc;CAC7D,SAAS,EAAE,MAAM,YAAY,CAAC,CAAC,SAAS,CAAC,CAAC,cAAc;CACxD,YAAY,EAAE,OAAO,CAAC,CAAC,cAAc;AACvC,CAAC,CAAC,CACD,SAAS,cAAc,EAAE,IAAI,uBAAuB,CAAC;;AAGxD,MAAa,uBACX,aAAa;CACX,QAAQ;CACR,WAAW;CACX,UAAU;CACV;CACA;AACF,CAAC"}
1
+ {"version":3,"file":"status.js","names":[],"sources":["../../../src/methods/instance/status.ts"],"sourcesContent":["import * as z from \"zod\";\nimport { defineMethod, type MethodDefinition } from \"../../method.ts\";\nimport { wireRegistry } from \"../../wire-registry.ts\";\nimport { InstanceInfo } from \"../mostra/initialize.ts\";\nimport { Share } from \"../share/start.ts\";\n\n/** The params of `instance/status` (INTERFACES §6): none. */\nexport type InstanceStatusParams = Record<string, never>;\n\n/** One child process the instance supervises. */\nexport interface ChildProcessStatus {\n /** The process ID. The child leads its own process group, so this is also its group ID. */\n readonly pid: number;\n /** What the child is: `builder`, `verify`, `worker`, `pty-host`, `demo`, `install` and so on. */\n readonly kind: string;\n /** What the child serves, such as an artifact or version ID. */\n readonly ownerRef: string;\n /** When the instance started it (RFC 3339, UTC). */\n readonly startedAt: string;\n}\n\n/** Where the gateway listens (D99, WP-05). */\nexport interface GatewayStatus {\n /** The address its listeners bind: `127.0.0.1` unless the instance started with `--bind`. */\n readonly bind: string;\n /** The shell's origin, where every capability link points. */\n readonly shell: string;\n /** The artifact origins it is serving now, one per opened artifact. */\n readonly artifacts: readonly { readonly artifactId: string; readonly origin: string }[];\n /**\n * The gateway's external addresses (D158 item 1): a share's tunnel addresses and a host's\n * external bases, each a listener of its own on loopback (WP-13).\n */\n readonly faces?: readonly FaceStatus[];\n}\n\n/** One external address of the gateway (D158 item 1). */\nexport interface FaceStatus {\n /** The origin browsers use. */\n readonly origin: string;\n /** The loopback origin the tunnel or the host forwards it to. */\n readonly local: string;\n /** Which listener it fronts: the shell, or one artifact's frame. */\n readonly listener: \"shell\" | \"artifact\";\n /** The artifact, for an artifact's face. */\n readonly artifactId?: string;\n /** Who keeps it: a share's tunnel (`tailnet`, `funnel`, `cloudflare`) or a host (`host`). */\n readonly by: \"tailnet\" | \"funnel\" | \"cloudflare\" | \"host\" | (string & {});\n}\n\n/**\n * The result of `instance/status`. The packages that add ports, deliveries, shares and versions\n * add their fields here (INTERFACES §6).\n */\nexport interface InstanceStatusResult {\n /** The instance itself. */\n readonly instance: InstanceInfo;\n /** When the instance took ownership of its home (RFC 3339, UTC). */\n readonly startedAt: string;\n /** The control socket clients attach to. */\n readonly socket: string;\n /** How many protocol connections are open, this one included. */\n readonly connections: number;\n /** The child processes the instance supervises. */\n readonly processes: readonly ChildProcessStatus[];\n /** Where the gateway listens, once it has started (WP-05). */\n readonly gateway?: GatewayStatus;\n /** The outbox per host (WP-06, D105): how many deliveries are in each state. */\n readonly deliveries?: readonly DeliveryCounts[];\n /** The artifact workers, one per active version with server code (WP-08, RT-03). */\n readonly workers?: readonly WorkerStatus[];\n /** When the daemon exits for lack of work, if it will (WP-08, RT-08); absent: it won't. */\n readonly idleExitAt?: string;\n /**\n * The active shares (WP-13, D158), which keep a daemon from its idle exit. Their `url` is left\n * out here, since status is printed where a link's secret mustn't appear: `share/list` gives it.\n */\n readonly shares?: readonly Share[];\n}\n\n/** One artifact version's worker (RT-03, D62). */\nexport interface WorkerStatus {\n /** The artifact. */\n readonly artifactId: string;\n /** The version. */\n readonly versionId: string;\n /**\n * `starting`, `ready`, `backoff` (it crashed and restarts on the next request after `retryAt`),\n * `parked` (it crashed more than 5 times in 10 minutes, FAILURE_MODEL §2), `stopped`.\n */\n readonly state: \"starting\" | \"ready\" | \"backoff\" | \"parked\" | \"stopped\";\n /** The worker's process, while it runs locally. */\n readonly pid?: number;\n /** Crashes in the last 10 minutes. */\n readonly crashes: number;\n /** The last crash's cause, such as `out of memory` or `event loop blocked for 10 s`. */\n readonly lastCause?: string;\n /** When a worker in `backoff` may start again. */\n readonly retryAt?: string;\n /** Calls, runs and live producers it serves now. */\n readonly active: number;\n}\n\n/** The Zod schema of the `WorkerStatus` type. */\nexport const WorkerStatus: z.ZodType<WorkerStatus> = z\n .object({\n artifactId: z.string(),\n versionId: z.string(),\n state: z.enum([\"starting\", \"ready\", \"backoff\", \"parked\", \"stopped\"]),\n pid: z.int().min(1).exactOptional(),\n crashes: z.int().min(0),\n lastCause: z.string().exactOptional(),\n retryAt: z.string().exactOptional(),\n active: z.int().min(0),\n })\n .register(wireRegistry, { id: \"WorkerStatus\", description: \"One artifact version's worker.\" });\n\n/** One host's deliveries by state (D105). */\nexport interface DeliveryCounts {\n /** The host's client name; empty for Mostra's built-in adapter (D105). */\n readonly owner: string;\n /** Whether a connection of this host has the submissions port registered now. */\n readonly connected: boolean;\n /** Deliveries not yet answered terminally. */\n readonly pending: number;\n /** Deliveries the host accepted. */\n readonly delivered: number;\n /** Deliveries the host rejected terminally. */\n readonly rejected: number;\n /** Deliveries the host declared undeliverable. */\n readonly undeliverable: number;\n}\n\n/** The Zod schema of the `DeliveryCounts` type. */\nexport const DeliveryCounts: z.ZodType<DeliveryCounts> = z\n .object({\n owner: z.string(),\n connected: z.boolean(),\n pending: z.int().min(0),\n delivered: z.int().min(0),\n rejected: z.int().min(0),\n undeliverable: z.int().min(0),\n })\n .register(wireRegistry, {\n id: \"DeliveryCounts\",\n description: \"One host's deliveries by state, and whether it is connected.\",\n });\n\n/** The Zod schema of the `GatewayStatus` type. */\nexport const GatewayStatus: z.ZodType<GatewayStatus> = z\n .object({\n bind: z.string(),\n shell: z.string(),\n artifacts: z.array(z.object({ artifactId: z.string(), origin: z.string() })).readonly(),\n faces: z\n .array(\n z.object({\n origin: z.string(),\n local: z.string(),\n listener: z.enum([\"shell\", \"artifact\"]),\n artifactId: z.string().exactOptional(),\n by: z.string(),\n }),\n )\n .readonly()\n .exactOptional(),\n })\n .register(wireRegistry, { id: \"GatewayStatus\", description: \"Where the gateway listens.\" });\n\n/** The Zod schema of the `ChildProcessStatus` type. */\nexport const ChildProcessStatus: z.ZodType<ChildProcessStatus> = z\n .object({\n pid: z.int().min(1),\n kind: z.string(),\n ownerRef: z.string(),\n startedAt: z.iso.datetime(),\n })\n .register(wireRegistry, {\n id: \"ChildProcessStatus\",\n description: \"One child process the instance supervises.\",\n });\n\nconst params: z.ZodType<InstanceStatusParams> = z\n .object({})\n .register(wireRegistry, { id: \"InstanceStatusParams\" });\n\nconst result: z.ZodType<InstanceStatusResult> = z\n .object({\n instance: InstanceInfo,\n startedAt: z.iso.datetime(),\n socket: z.string(),\n connections: z.int().min(0),\n processes: z.array(ChildProcessStatus).readonly(),\n gateway: GatewayStatus.exactOptional(),\n deliveries: z.array(DeliveryCounts).readonly().exactOptional(),\n workers: z.array(WorkerStatus).readonly().exactOptional(),\n idleExitAt: z.string().exactOptional(),\n shares: z.array(Share).readonly().exactOptional(),\n })\n .register(wireRegistry, { id: \"InstanceStatusResult\" });\n\n/** `instance/status`: reports the instance, its socket, its connections and its child processes. */\nexport const instanceStatusMethod: MethodDefinition<InstanceStatusParams, InstanceStatusResult> =\n defineMethod({\n method: \"instance/status\",\n direction: \"client-to-instance\",\n mutating: false,\n params,\n result,\n });\n"],"mappings":";;;;;;;AAwGA,MAAa,eAAwC,EAClD,OAAO;CACN,YAAY,EAAE,OAAO;CACrB,WAAW,EAAE,OAAO;CACpB,OAAO,EAAE,KAAK;EAAC;EAAY;EAAS;EAAW;EAAU;CAAS,CAAC;CACnE,KAAK,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,cAAc;CAClC,SAAS,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC;CACtB,WAAW,EAAE,OAAO,CAAC,CAAC,cAAc;CACpC,SAAS,EAAE,OAAO,CAAC,CAAC,cAAc;CAClC,QAAQ,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC;AACvB,CAAC,CAAC,CACD,SAAS,cAAc;CAAE,IAAI;CAAgB,aAAa;AAAiC,CAAC;;AAmB/F,MAAa,iBAA4C,EACtD,OAAO;CACN,OAAO,EAAE,OAAO;CAChB,WAAW,EAAE,QAAQ;CACrB,SAAS,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC;CACtB,WAAW,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC;CACxB,UAAU,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC;CACvB,eAAe,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC;AAC9B,CAAC,CAAC,CACD,SAAS,cAAc;CACtB,IAAI;CACJ,aAAa;AACf,CAAC;;AAGH,MAAa,gBAA0C,EACpD,OAAO;CACN,MAAM,EAAE,OAAO;CACf,OAAO,EAAE,OAAO;CAChB,WAAW,EAAE,MAAM,EAAE,OAAO;EAAE,YAAY,EAAE,OAAO;EAAG,QAAQ,EAAE,OAAO;CAAE,CAAC,CAAC,CAAC,CAAC,SAAS;CACtF,OAAO,EACJ,MACC,EAAE,OAAO;EACP,QAAQ,EAAE,OAAO;EACjB,OAAO,EAAE,OAAO;EAChB,UAAU,EAAE,KAAK,CAAC,SAAS,UAAU,CAAC;EACtC,YAAY,EAAE,OAAO,CAAC,CAAC,cAAc;EACrC,IAAI,EAAE,OAAO;CACf,CAAC,CACH,CAAC,CACA,SAAS,CAAC,CACV,cAAc;AACnB,CAAC,CAAC,CACD,SAAS,cAAc;CAAE,IAAI;CAAiB,aAAa;AAA6B,CAAC;;AAG5F,MAAa,qBAAoD,EAC9D,OAAO;CACN,KAAK,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC;CAClB,MAAM,EAAE,OAAO;CACf,UAAU,EAAE,OAAO;CACnB,WAAW,EAAE,IAAI,SAAS;AAC5B,CAAC,CAAC,CACD,SAAS,cAAc;CACtB,IAAI;CACJ,aAAa;AACf,CAAC;AAEH,MAAM,SAA0C,EAC7C,OAAO,CAAC,CAAC,CAAC,CACV,SAAS,cAAc,EAAE,IAAI,uBAAuB,CAAC;AAExD,MAAM,SAA0C,EAC7C,OAAO;CACN,UAAU;CACV,WAAW,EAAE,IAAI,SAAS;CAC1B,QAAQ,EAAE,OAAO;CACjB,aAAa,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC;CAC1B,WAAW,EAAE,MAAM,kBAAkB,CAAC,CAAC,SAAS;CAChD,SAAS,cAAc,cAAc;CACrC,YAAY,EAAE,MAAM,cAAc,CAAC,CAAC,SAAS,CAAC,CAAC,cAAc;CAC7D,SAAS,EAAE,MAAM,YAAY,CAAC,CAAC,SAAS,CAAC,CAAC,cAAc;CACxD,YAAY,EAAE,OAAO,CAAC,CAAC,cAAc;CACrC,QAAQ,EAAE,MAAM,KAAK,CAAC,CAAC,SAAS,CAAC,CAAC,cAAc;AAClD,CAAC,CAAC,CACD,SAAS,cAAc,EAAE,IAAI,uBAAuB,CAAC;;AAGxD,MAAa,uBACX,aAAa;CACX,QAAQ;CACR,WAAW;CACX,UAAU;CACV;CACA;AACF,CAAC"}
@@ -0,0 +1,52 @@
1
+ import { MethodDefinition } from "../../method.js";
2
+ import * as z from "zod";
3
+ //#region src/methods/port/addressing-external-base.d.ts
4
+ /**
5
+ * An origin as browsers write it (`https://host.example`, `http://host:8080`): a scheme, a lower
6
+ * case host and a port only when it isn't the scheme's default, with no path, query or fragment.
7
+ */
8
+ export declare const OriginString: z.ZodType<string>;
9
+ /** The params of `port/addressing.externalBase` (INTERFACES §7, D158 item 6). */
10
+ export interface PortAddressingExternalBaseParams {
11
+ /** The artifact whose links or frame this address serves. */
12
+ readonly artifactId: string;
13
+ /**
14
+ * Which of Mostra's listeners the address fronts: `shell` for the artifact's links (the shell
15
+ * that opens them), `artifact` for the artifact's own frame.
16
+ */
17
+ readonly listener: "shell" | "artifact";
18
+ /**
19
+ * The loopback origin the host forwards this address to, such as `http://127.0.0.1:23456`: a
20
+ * port leased for this face, the same across restarts while the face exists.
21
+ */
22
+ readonly local: string;
23
+ }
24
+ /**
25
+ * The host's answer: the origin browsers use for this listener, and optionally how the artifact's
26
+ * frame authenticates there (`worker` by default whenever the shell's and the artifact's hosts
27
+ * differ, D70); `null` when the host offers no external address, so links stay on loopback.
28
+ */
29
+ export type PortAddressingExternalBaseResult = ExternalBase | null;
30
+ /** One external address a host gives a listener (D158 item 6). */
31
+ export interface ExternalBase {
32
+ /** The origin browsers use for the listener, such as `https://host.example.com`. */
33
+ readonly origin: string;
34
+ /**
35
+ * How the frame authenticates there (D70): `cookie` where the shell and the artifact are one
36
+ * site, `worker` where they are two. Absent: `cookie` for one host name, `worker` for two.
37
+ */
38
+ readonly mode?: "cookie" | "worker";
39
+ }
40
+ /** The schema of the `ExternalBase` type. */
41
+ export declare const ExternalBase: z.ZodType<ExternalBase>;
42
+ /**
43
+ * `port/addressing.externalBase`: Mostra asks the host that registered the `addressing` port for
44
+ * the external address of one of its listeners (HO-10, D158 item 6), with 5 seconds to answer,
45
+ * when it mints a link for an artifact and when the shell at such an address opens the artifact's
46
+ * frame. The answer joins the Host allowlist and the links Mostra mints; `null`, or another
47
+ * origin, withdraws the address given before, whose links stop working. A host that fails or
48
+ * answers something the schema refuses leaves links on loopback.
49
+ */
50
+ export declare const portAddressingExternalBaseMethod: MethodDefinition<PortAddressingExternalBaseParams, PortAddressingExternalBaseResult>;
51
+ //#endregion
52
+ //# sourceMappingURL=addressing-external-base.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"addressing-external-base.d.ts","names":[],"sources":["../../../src/methods/port/addressing-external-base.ts"],"mappings":";;;;;;;qBASa,cAAc,EAAE;;iBAyBZ;;WAEN;;;;;WAKA;;;;;WAKA;;;;;;;YAQC,mCAAmC;;iBAe9B;;WAEN;;;;;WAKA;;;qBAIE,cAAc,EAAE,QAAQ;;;;;;;;;qBAuBxB,kCAAkC,iBAC7C,kCACA"}
@@ -0,0 +1,61 @@
1
+ import { wireRegistry } from "../../wire-registry.js";
2
+ import { ArtifactId } from "../../ids.js";
3
+ import { defineMethod } from "../../method.js";
4
+ import * as z from "zod";
5
+ //#region src/methods/port/addressing-external-base.ts
6
+ /**
7
+ * An origin as browsers write it (`https://host.example`, `http://host:8080`): a scheme, a lower
8
+ * case host and a port only when it isn't the scheme's default, with no path, query or fragment.
9
+ */
10
+ const OriginString = z.string().max(2048).regex(originPattern(), { message: "An origin: http: or https:, a lower case host and a port only when not the default." }).register(wireRegistry, {
11
+ id: "OriginString",
12
+ description: "A web origin: scheme, host and a port only when it isn't the default."
13
+ });
14
+ /**
15
+ * An origin exactly as browsers serialize one, as one regular expression, so JSON Schema and the
16
+ * Rust crate check what Zod checks: a lower case DNS name or bracketed IPv6 literal, a port of 1
17
+ * to 65535, and never the scheme's default port written out.
18
+ */
19
+ function originPattern() {
20
+ const label = "[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?";
21
+ return new RegExp(`^(?!http://[^/]*:80$)(?!https://[^/]*:443$)https?://${`(?:${label}(?:\\.${label})*|\\[[0-9a-f:.]+\\])`}(?::(?:[1-9][0-9]{0,3}|[1-5][0-9]{4}|6[0-4][0-9]{3}|65[0-4][0-9]{2}|655[0-2][0-9]|6553[0-5]))?$`);
22
+ }
23
+ const params = z.object({
24
+ artifactId: ArtifactId.schema,
25
+ listener: z.enum(["shell", "artifact"]),
26
+ local: z.string().min(1)
27
+ }).register(wireRegistry, {
28
+ id: "PortAddressingExternalBaseParams",
29
+ description: "Which listener of which artifact needs an external address, and where it listens."
30
+ });
31
+ /** The schema of the `ExternalBase` type. */
32
+ const ExternalBase = z.object({
33
+ origin: OriginString,
34
+ mode: z.enum(["cookie", "worker"]).exactOptional()
35
+ }).register(wireRegistry, {
36
+ id: "ExternalBase",
37
+ description: "The origin browsers use for a listener, and how its frame authenticates there."
38
+ });
39
+ const result = ExternalBase.nullable().register(wireRegistry, {
40
+ id: "PortAddressingExternalBaseResult",
41
+ description: "The external origin a host gives a listener, or null for loopback."
42
+ });
43
+ /**
44
+ * `port/addressing.externalBase`: Mostra asks the host that registered the `addressing` port for
45
+ * the external address of one of its listeners (HO-10, D158 item 6), with 5 seconds to answer,
46
+ * when it mints a link for an artifact and when the shell at such an address opens the artifact's
47
+ * frame. The answer joins the Host allowlist and the links Mostra mints; `null`, or another
48
+ * origin, withdraws the address given before, whose links stop working. A host that fails or
49
+ * answers something the schema refuses leaves links on loopback.
50
+ */
51
+ const portAddressingExternalBaseMethod = defineMethod({
52
+ method: "port/addressing.externalBase",
53
+ direction: "instance-to-host",
54
+ mutating: false,
55
+ params,
56
+ result
57
+ });
58
+ //#endregion
59
+ export { ExternalBase, OriginString, portAddressingExternalBaseMethod };
60
+
61
+ //# sourceMappingURL=addressing-external-base.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"addressing-external-base.js","names":[],"sources":["../../../src/methods/port/addressing-external-base.ts"],"sourcesContent":["import * as z from \"zod\";\nimport { ArtifactId } from \"../../ids.ts\";\nimport { defineMethod, type MethodDefinition } from \"../../method.ts\";\nimport { wireRegistry } from \"../../wire-registry.ts\";\n\n/**\n * An origin as browsers write it (`https://host.example`, `http://host:8080`): a scheme, a lower\n * case host and a port only when it isn't the scheme's default, with no path, query or fragment.\n */\nexport const OriginString: z.ZodType<string> = z\n .string()\n .max(2048)\n .regex(originPattern(), {\n message: \"An origin: http: or https:, a lower case host and a port only when not the default.\",\n })\n .register(wireRegistry, {\n id: \"OriginString\",\n description: \"A web origin: scheme, host and a port only when it isn't the default.\",\n });\n\n/**\n * An origin exactly as browsers serialize one, as one regular expression, so JSON Schema and the\n * Rust crate check what Zod checks: a lower case DNS name or bracketed IPv6 literal, a port of 1\n * to 65535, and never the scheme's default port written out.\n */\nfunction originPattern(): RegExp {\n const label = \"[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\";\n const host = `(?:${label}(?:\\\\.${label})*|\\\\[[0-9a-f:.]+\\\\])`;\n const port =\n \"(?:[1-9][0-9]{0,3}|[1-5][0-9]{4}|6[0-4][0-9]{3}|65[0-4][0-9]{2}|655[0-2][0-9]|6553[0-5])\";\n return new RegExp(`^(?!http://[^/]*:80$)(?!https://[^/]*:443$)https?://${host}(?::${port})?$`);\n}\n\n/** The params of `port/addressing.externalBase` (INTERFACES §7, D158 item 6). */\nexport interface PortAddressingExternalBaseParams {\n /** The artifact whose links or frame this address serves. */\n readonly artifactId: string;\n /**\n * Which of Mostra's listeners the address fronts: `shell` for the artifact's links (the shell\n * that opens them), `artifact` for the artifact's own frame.\n */\n readonly listener: \"shell\" | \"artifact\";\n /**\n * The loopback origin the host forwards this address to, such as `http://127.0.0.1:23456`: a\n * port leased for this face, the same across restarts while the face exists.\n */\n readonly local: string;\n}\n\n/**\n * The host's answer: the origin browsers use for this listener, and optionally how the artifact's\n * frame authenticates there (`worker` by default whenever the shell's and the artifact's hosts\n * differ, D70); `null` when the host offers no external address, so links stay on loopback.\n */\nexport type PortAddressingExternalBaseResult = ExternalBase | null;\n\nconst params: z.ZodType<PortAddressingExternalBaseParams> = z\n .object({\n artifactId: ArtifactId.schema,\n listener: z.enum([\"shell\", \"artifact\"]),\n local: z.string().min(1),\n })\n .register(wireRegistry, {\n id: \"PortAddressingExternalBaseParams\",\n description:\n \"Which listener of which artifact needs an external address, and where it listens.\",\n });\n\n/** One external address a host gives a listener (D158 item 6). */\nexport interface ExternalBase {\n /** The origin browsers use for the listener, such as `https://host.example.com`. */\n readonly origin: string;\n /**\n * How the frame authenticates there (D70): `cookie` where the shell and the artifact are one\n * site, `worker` where they are two. Absent: `cookie` for one host name, `worker` for two.\n */\n readonly mode?: \"cookie\" | \"worker\";\n}\n\n/** The schema of the `ExternalBase` type. */\nexport const ExternalBase: z.ZodType<ExternalBase> = z\n .object({ origin: OriginString, mode: z.enum([\"cookie\", \"worker\"]).exactOptional() })\n .register(wireRegistry, {\n id: \"ExternalBase\",\n description: \"The origin browsers use for a listener, and how its frame authenticates there.\",\n });\n\nconst result: z.ZodType<PortAddressingExternalBaseResult> = ExternalBase.nullable().register(\n wireRegistry,\n {\n id: \"PortAddressingExternalBaseResult\",\n description: \"The external origin a host gives a listener, or null for loopback.\",\n },\n);\n\n/**\n * `port/addressing.externalBase`: Mostra asks the host that registered the `addressing` port for\n * the external address of one of its listeners (HO-10, D158 item 6), with 5 seconds to answer,\n * when it mints a link for an artifact and when the shell at such an address opens the artifact's\n * frame. The answer joins the Host allowlist and the links Mostra mints; `null`, or another\n * origin, withdraws the address given before, whose links stop working. A host that fails or\n * answers something the schema refuses leaves links on loopback.\n */\nexport const portAddressingExternalBaseMethod: MethodDefinition<\n PortAddressingExternalBaseParams,\n PortAddressingExternalBaseResult\n> = defineMethod({\n method: \"port/addressing.externalBase\",\n direction: \"instance-to-host\",\n mutating: false,\n params,\n result,\n});\n"],"mappings":";;;;;;;;;AASA,MAAa,eAAkC,EAC5C,OAAO,CAAC,CACR,IAAI,IAAI,CAAC,CACT,MAAM,cAAc,GAAG,EACtB,SAAS,sFACX,CAAC,CAAC,CACD,SAAS,cAAc;CACtB,IAAI;CACJ,aAAa;AACf,CAAC;;;;;;AAOH,SAAS,gBAAwB;CAC/B,MAAM,QAAQ;CAId,OAAO,IAAI,OAAO,uDAAuD,MAHtD,MAAM,QAAQ,MAAM,uBAGuC,gGAAe;AAC/F;AAyBA,MAAM,SAAsD,EACzD,OAAO;CACN,YAAY,WAAW;CACvB,UAAU,EAAE,KAAK,CAAC,SAAS,UAAU,CAAC;CACtC,OAAO,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC;AACzB,CAAC,CAAC,CACD,SAAS,cAAc;CACtB,IAAI;CACJ,aACE;AACJ,CAAC;;AAcH,MAAa,eAAwC,EAClD,OAAO;CAAE,QAAQ;CAAc,MAAM,EAAE,KAAK,CAAC,UAAU,QAAQ,CAAC,CAAC,CAAC,cAAc;AAAE,CAAC,CAAC,CACpF,SAAS,cAAc;CACtB,IAAI;CACJ,aAAa;AACf,CAAC;AAEH,MAAM,SAAsD,aAAa,SAAS,CAAC,CAAC,SAClF,cACA;CACE,IAAI;CACJ,aAAa;AACf,CACF;;;;;;;;;AAUA,MAAa,mCAGT,aAAa;CACf,QAAQ;CACR,WAAW;CACX,UAAU;CACV;CACA;AACF,CAAC"}