@hediet/linkrpc 0.0.1 → 0.0.2

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 (31) hide show
  1. package/README.md +59 -0
  2. package/dist/chunks/{boundedTrafficSubscription-1L592xc7.js → boundedTrafficSubscription-XZ1KwXZC.js} +267 -6
  3. package/dist/chunks/boundedTrafficSubscription-XZ1KwXZC.js.map +1 -0
  4. package/dist/chunks/{hub.interfaces-BzWfsVT2.js → hub.interfaces-Bf4VfWNX.js} +2 -2
  5. package/dist/chunks/{hub.interfaces-BzWfsVT2.js.map → hub.interfaces-Bf4VfWNX.js.map} +1 -1
  6. package/dist/chunks/{hubAccess-DwTZPiI8.d.ts → hubAccess-C06qAKao.d.ts} +2 -2
  7. package/dist/chunks/{hubAccess-DwTZPiI8.d.ts.map → hubAccess-C06qAKao.d.ts.map} +1 -1
  8. package/dist/chunks/{hubFacade-CQflVkVC.js → hubFacade-BIB9CoAv.js} +2 -2
  9. package/dist/chunks/{hubFacade-CQflVkVC.js.map → hubFacade-BIB9CoAv.js.map} +1 -1
  10. package/dist/chunks/{hubFacade-Dkgw2pTi.d.ts → hubFacade-DtQpGpUy.d.ts} +2 -2
  11. package/dist/chunks/{hubFacade-Dkgw2pTi.d.ts.map → hubFacade-DtQpGpUy.d.ts.map} +1 -1
  12. package/dist/chunks/{linkRpcConnection-CtlQmetO.d.ts → linkRpcConnection-BadD37ok.d.ts} +125 -37
  13. package/dist/chunks/linkRpcConnection-BadD37ok.d.ts.map +1 -0
  14. package/dist/chunks/{src-D3NUIwyo.js → src-CAhXne71.js} +160 -198
  15. package/dist/chunks/src-CAhXne71.js.map +1 -0
  16. package/dist/hub/client/index.d.ts +3 -3
  17. package/dist/hub/client/index.js +3 -3
  18. package/dist/hub/common/index.d.ts +14 -14
  19. package/dist/hub/common/index.js +2 -2
  20. package/dist/index.d.ts +2 -2
  21. package/dist/index.js +3 -3
  22. package/dist/inspection/index.d.ts +1 -1
  23. package/dist/inspection/index.js +1 -1
  24. package/dist/node.d.ts +3 -3
  25. package/dist/node.js +4 -4
  26. package/dist/web.d.ts +2 -2
  27. package/dist/web.js +3 -3
  28. package/package.json +1 -1
  29. package/dist/chunks/boundedTrafficSubscription-1L592xc7.js.map +0 -1
  30. package/dist/chunks/linkRpcConnection-CtlQmetO.d.ts.map +0 -1
  31. package/dist/chunks/src-D3NUIwyo.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"boundedTrafficSubscription-XZ1KwXZC.js","names":["zVoid","union","zAny","zVoid","zEnum"],"sources":["../../src/schema/normalize.ts","../../src/schema/memberTypes.ts","../../src/protocol/jcs.ts","../../src/crypto/sha256.ts","../../src/schema/hash.ts","../../src/schema/assertSchemaReferences.ts","../../src/schema/schemaToZod.ts","../../src/connection/interfaceDefinition.ts","../../src/inspection/inspection.interfaces.ts","../../src/inspection/node.interfaces.ts","../../src/inspection/trafficFlowFilter.ts","../../src/inspection/boundedTrafficSubscription.ts"],"sourcesContent":["import type { LinkRpcJsonSchema, DiscriminatorSchema } from \"./linkRpcJsonSchema\";\n\n/**\n * Keys that describe structural shape and are part of the decidable subset.\n * Everything else gets stripped during normalization.\n *\n * Note: `not` is intentionally NOT in this list. The special case `{\"not\":{}}`\n * (i.e. matches-nothing) is mapped to the literal `false` bottom; any other\n * `not` is dropped.\n */\nconst KEPT_KEYS = new Set([\n \"type\", \"format\",\n \"properties\", \"required\", \"additionalProperties\",\n \"items\", \"prefixItems\",\n \"const\", \"enum\",\n \"anyOf\", \"oneOf\", \"discriminator\",\n \"$ref\",\n \"title\", \"description\",\n]);\n\n/**\n * Normalize raw JSON Schema output (e.g. from `z.toJSONSchema`) into the\n * SvcJsonSchema subset:\n *\n * - drop annotation keys (`examples`, `default`, `$comment`, `readOnly`, ...)\n * - drop out-of-subset refinements (`pattern`, `minimum`, `multipleOf`,\n * `allOf`, `oneOf`, `if/then/else`, `patternProperties`, ...)\n * - empty schema `{}` ⇒ `true` (top)\n * - `{\"not\":{}}` ⇒ `false` (bottom); any other `not` is stripped\n * - `type:\"object\"` without `additionalProperties` ⇒ closed (`false`),\n * matching linkrpc's stricter contract\n *\n * The output is canonical: structurally equal inputs produce structurally\n * equal outputs, which is what `computeInterfaceHash` relies on.\n */\nexport function normalizeJsonSchema(raw: unknown): LinkRpcJsonSchema {\n if (raw === true || raw === false) return raw;\n if (raw === null || typeof raw !== \"object\") {\n throw new Error(`normalizeJsonSchema: expected object, got ${typeof raw}`);\n }\n if (Array.isArray(raw)) {\n throw new Error(\"normalizeJsonSchema: expected object, got array\");\n }\n\n const r = raw as Record<string, unknown>;\n\n // {\"not\": {}} => false (bottom). Handle before generic descent.\n if (\"not\" in r && isEmptyObject(r[\"not\"])) return false;\n\n const out: Record<string, unknown> = {};\n for (const [k, v] of Object.entries(r)) {\n if (!KEPT_KEYS.has(k)) continue;\n const normalized = normalizeChild(k, v);\n if (normalized === undefined) continue;\n out[k] = normalized;\n }\n\n // Object: linkrpc requires `additionalProperties` to be set. Default to\n // closed, matching what zod typically emits for `z.object`.\n if (out[\"type\"] === \"object\" && !(\"additionalProperties\" in out)) {\n out[\"additionalProperties\"] = false;\n }\n\n // `oneOf`: if no explicit `discriminator` survived, try to synthesize\n // one from the branches. Zod's `z.discriminatedUnion` lowers via\n // `z.toJSONSchema` to `oneOf` without a `discriminator` keyword, so\n // without this auto-detection the tag information is invisible to\n // consumers (codegen, consent UIs).\n if (Array.isArray(out[\"oneOf\"]) && !(\"discriminator\" in out)) {\n const detected = _detectDiscriminator(out[\"oneOf\"] as LinkRpcJsonSchema[]);\n if (detected !== undefined) out[\"discriminator\"] = detected;\n }\n\n // Drop a `discriminator` that has no `oneOf` to attach to — it would be\n // meaningless and would just bloat the hash.\n if (\"discriminator\" in out && !Array.isArray(out[\"oneOf\"])) {\n delete out[\"discriminator\"];\n }\n\n // Collapse empty into `true` (top).\n if (Object.keys(out).length === 0) return true;\n\n return out as unknown as LinkRpcJsonSchema;\n}\n\nfunction normalizeChild(key: string, v: unknown): unknown {\n switch (key) {\n case \"properties\": {\n if (!isPlainObject(v)) return {};\n const out: Record<string, LinkRpcJsonSchema> = {};\n for (const [pk, pv] of Object.entries(v)) {\n out[pk] = normalizeJsonSchema(pv);\n }\n return out;\n }\n case \"items\":\n case \"additionalProperties\": {\n if (v === false) return false;\n return normalizeJsonSchema(v);\n }\n case \"prefixItems\":\n case \"anyOf\":\n case \"oneOf\": {\n if (!Array.isArray(v)) return [];\n return v.map((s) => normalizeJsonSchema(s));\n }\n case \"discriminator\": {\n // Only `propertyName` is part of the subset. OpenAPI's `mapping`\n // (and anything else) is dropped — we have no use for it and it\n // would complicate hashing.\n if (!isPlainObject(v)) return undefined;\n const name = (v as Record<string, unknown>)[\"propertyName\"];\n if (typeof name !== \"string\" || name.length === 0) return undefined;\n return { propertyName: name };\n }\n case \"enum\": {\n if (!Array.isArray(v)) return [];\n return v.slice();\n }\n case \"required\": {\n if (!Array.isArray(v)) return [];\n return v.slice().sort();\n }\n default:\n return v;\n }\n}\n\nfunction isEmptyObject(v: unknown): boolean {\n return isPlainObject(v) && Object.keys(v).length === 0;\n}\n\nfunction isPlainObject(v: unknown): v is Record<string, unknown> {\n return v !== null && typeof v === \"object\" && !Array.isArray(v);\n}\n\n/**\n * Inspect a `oneOf` branch list and return a `discriminator` hint when\n * every branch is an object schema and there is exactly one property name\n * that appears in every branch with a distinct `const`-valued schema.\n *\n * This is the canonical JSON-Schema-only encoding of a tagged union, and\n * the shape `z.toJSONSchema(z.discriminatedUnion(...))` emits.\n */\nfunction _detectDiscriminator(branches: LinkRpcJsonSchema[]): DiscriminatorSchema | undefined {\n if (branches.length < 2) return undefined;\n // Each branch must be an object schema with `properties`.\n const branchPropsList: Record<string, LinkRpcJsonSchema>[] = [];\n for (const b of branches) {\n if (b === true || b === false) return undefined;\n if ((b as { type?: string }).type !== \"object\") return undefined;\n const props = (b as { properties?: Record<string, LinkRpcJsonSchema> }).properties;\n if (!props) return undefined;\n branchPropsList.push(props);\n }\n // Property names present (with a `const`-valued schema) on every branch.\n const firstConstProps = _constPropNames(branchPropsList[0]);\n let candidates = firstConstProps;\n for (let i = 1; i < branchPropsList.length; i++) {\n candidates = candidates.filter((n) => _constPropNames(branchPropsList[i]).includes(n));\n if (candidates.length === 0) return undefined;\n }\n // Of the surviving candidates, keep those whose const values are\n // pairwise distinct across all branches (a real discriminator).\n for (const name of candidates) {\n const seen = new Set<string>();\n let allDistinct = true;\n for (const props of branchPropsList) {\n const s = props[name] as { const?: unknown };\n const key = JSON.stringify(s.const);\n if (seen.has(key)) { allDistinct = false; break; }\n seen.add(key);\n }\n if (allDistinct) return { propertyName: name };\n }\n return undefined;\n}\n\nfunction _constPropNames(props: Record<string, LinkRpcJsonSchema>): string[] {\n const out: string[] = [];\n for (const [k, v] of Object.entries(props)) {\n if (v === true || v === false) continue;\n if (\"const\" in (v as object)) out.push(k);\n }\n return out;\n}\n","import { void as zVoid } from 'zod/mini';\nimport { toJSONSchema, type $ZodType } from 'zod/v4/core';\nimport { normalizeJsonSchema } from './normalize';\nimport type { MemberAnnotations } from './linkRpcInterfaceSchema';\nimport type { LinkRpcJsonSchema } from './linkRpcJsonSchema';\n\n/**\n * The schema type linkrpc accepts everywhere: the zod *core* base shared by\n * both classic `zod` and `zod/mini`. Typing against it (instead of classic\n * `z.ZodType`) lets callers author interfaces with either flavour — classic\n * for ergonomics, mini for minimal bundle size — while linkrpc's own internal\n * interfaces use mini. `O` is the validated output type.\n */\nexport type Schema<O = unknown> = $ZodType<O>;\n\n/**\n * Marker base for a typed method member. Carries enough metadata to:\n * - validate / parse params at runtime (via the zod schemas),\n * - emit a JSON schema for reflection,\n * - propagate TS types up to the interface definition.\n */\nexport type MemberType = RequestType<any, any, any, any, any, any, any> | NotificationType<any>;\n\nconst applicationErrorBrand: unique symbol = Symbol('linkrpc.applicationError');\n\nexport type ApplicationErrorValue<\n TCode extends number = number,\n TMessage extends string = string,\n TData = never,\n> = {\n readonly kind: 'application';\n readonly code: TCode;\n readonly message: TMessage;\n} & ([TData] extends [never] ? { readonly data?: never; } : { readonly data: TData; });\n\nexport type CreatedApplicationErrorValue<\n TCode extends number = number,\n TMessage extends string = string,\n TData = never,\n> = ApplicationErrorValue<TCode, TMessage, TData> & {\n readonly [applicationErrorBrand]: true;\n};\n\nexport interface ApplicationErrorDescriptor<\n TCode extends number = number,\n TMessage extends string = string,\n TData = never,\n> {\n readonly code: TCode;\n readonly message: TMessage;\n readonly dataSchema?: Schema<TData>;\n readonly create: [TData] extends [never]\n ? () => CreatedApplicationErrorValue<TCode, TMessage, TData>\n : (data: TData) => CreatedApplicationErrorValue<TCode, TMessage, TData>;\n}\n\nexport interface ApplicationErrorDescriptorBase {\n readonly code: number;\n readonly message: string;\n readonly dataSchema?: Schema<any>;\n readonly create: (...args: any[]) => {\n readonly kind: 'application';\n readonly code: number;\n readonly message: string;\n readonly data?: unknown;\n readonly [applicationErrorBrand]: true;\n };\n}\n\nexport type ApplicationErrorOf<T> =\n T extends ApplicationErrorDescriptor<infer C, infer M, infer D>\n ? CreatedApplicationErrorValue<C, M, D>\n : never;\n\n// Legacy schemas can infer `any`; they must neither declare checked errors nor erase result types.\nexport type PublicApplicationErrorOf<T> =\n 0 extends (1 & T) ? never :\n T extends CreatedApplicationErrorValue<infer C, infer M, infer D>\n ? ApplicationErrorValue<C, M, D>\n : never;\n\nexport type DeclaredApplicationErrorOf<T> = 0 extends (1 & T)\n ? never\n : Extract<T, ReturnType<ApplicationErrorDescriptorBase['create']>>;\n\nexport type ApplicationErrorsOf<T extends readonly ApplicationErrorDescriptorBase[]> =\n ApplicationErrorOf<T[number]>;\n\n/** Declare one checked application error for use with {@link RequestType.withErrors}. */\nexport function applicationError<const TCode extends number, const TMessage extends string>(\n code: TCode,\n message: TMessage,\n): ApplicationErrorDescriptor<TCode, TMessage, never>;\nexport function applicationError<const TCode extends number, const TMessage extends string, TData>(\n code: TCode,\n message: TMessage,\n data: Schema<TData>,\n): ApplicationErrorDescriptor<TCode, TMessage, TData>;\nexport function applicationError(\n code: number,\n message: string,\n dataSchema?: Schema<any>,\n): ApplicationErrorDescriptorBase {\n assertApplicationErrorCode(code);\n if (typeof message !== 'string') throw new Error('Application error message must be a string.');\n const create = dataSchema === undefined\n ? function (this: void): CreatedApplicationErrorValue<number, string, never> {\n if (arguments.length !== 0) {\n throw new Error(`Application error ${code} does not accept data.`);\n }\n return Object.freeze({\n kind: 'application' as const,\n code,\n message,\n [applicationErrorBrand]: true as const,\n });\n }\n : function (this: void, data: unknown): CreatedApplicationErrorValue<number, string, unknown> {\n if (arguments.length !== 1) {\n throw new Error(`Application error ${code} requires exactly one data value.`);\n }\n return Object.freeze({\n kind: 'application' as const,\n code,\n message,\n [applicationErrorBrand]: true as const,\n data,\n });\n };\n return Object.freeze({\n code,\n message,\n ...(dataSchema === undefined ? {} : { dataSchema }),\n create,\n }) as ApplicationErrorDescriptorBase;\n}\n\n/** Runtime nominal check for values produced by an application-error descriptor. */\nexport function isApplicationErrorValue(\n value: unknown,\n): value is ReturnType<ApplicationErrorDescriptorBase['create']> {\n return typeof value === 'object' && value !== null\n && (value as { [applicationErrorBrand]?: unknown; })[applicationErrorBrand] === true;\n}\n\nfunction assertApplicationErrorCode(code: number): void {\n if (!Number.isInteger(code) || code < -2147483648 || code > 2147483647) {\n throw new Error(`Application error code ${code} must be a signed 32-bit integer.`);\n }\n if ((code >= -32768 && code <= -32000) || code === -32800) {\n throw new Error(`Application error code ${code} is reserved by JSON-RPC or LinkRPC.`);\n }\n}\n\n/**\n * Optional documentation for a method member.\n *\n * - `description` is the **normative** contract of the method (included in the\n * interface hash — changing it changes `schemaHash`).\n * - `comment` is non-normative implementation notes (stripped from the hash).\n * - `annotations` are normative behavioral claims (e.g. `readOnly`,\n * `idempotent`); included in the hash.\n */\nexport interface MemberDocs {\n description?: string;\n comment?: string;\n annotations?: MemberAnnotations;\n}\n\nexport class RequestType<\n TParams = unknown,\n TResult = void,\n TError = void,\n TClientStream = never,\n TServerStream = never,\n TErrors extends readonly ApplicationErrorDescriptorBase[] = readonly ApplicationErrorDescriptorBase[],\n TLegacyError = TError,\n> {\n public readonly kind = 'request' as const;\n\n constructor(\n public readonly paramsSchema: Schema<TParams>,\n public readonly resultSchema: Schema<TResult>,\n public readonly errorSchema: Schema<TLegacyError>,\n public readonly docs: MemberDocs = {},\n /**\n * Schema for stream messages the **client** may emit on an\n * in-flight call (e.g. cancellation, input). `undefined` means\n * the client may not stream on this method.\n */\n public readonly clientStreamSchema?: Schema<TClientStream>,\n /**\n * Schema for stream messages the **server** may emit while\n * handling an in-flight call (e.g. progress, partial results).\n * `undefined` means the server may not stream on this method.\n */\n public readonly serverStreamSchema?: Schema<TServerStream>,\n /** Checked application errors explicitly declared with `.withErrors()`. */\n public readonly applicationErrors: TErrors = [] as unknown as TErrors,\n ) {\n const seen = new Set<number>();\n for (const error of applicationErrors) {\n assertApplicationErrorCode(error.code);\n if (typeof error.message !== 'string') {\n throw new Error('Application error message must be a string.');\n }\n if (seen.has(error.code)) {\n throw new Error(`Duplicate application error code ${error.code}.`);\n }\n seen.add(error.code);\n }\n this.applicationErrors = Object.freeze([...applicationErrors]) as unknown as TErrors;\n this.errors = this.applicationErrors;\n }\n\n /** Declared checked errors, retained as a tuple for generated-contract consumers. */\n public readonly errors: TErrors;\n\n /** Phantom field — typed-only, do not access at runtime. */\n declare readonly _params: TParams;\n declare readonly _result: TResult;\n declare readonly _error: TError;\n declare readonly _clientStream: TClientStream;\n declare readonly _serverStream: TServerStream;\n\n /**\n * Return a copy of this request type with stream payload schemas\n * attached. Pass `undefined` for either direction to leave it\n * closed.\n * `NoInfer` keeps a contextual MemberMap's `any` stream slots from\n * widening undeclared directions; only the supplied schemas infer payloads.\n */\n public withStream<TClient = TClientStream, TServer = TServerStream>(\n opts: {\n client?: Schema<TClient>;\n server?: Schema<TServer>;\n },\n ): RequestType<TParams, TResult, TError, NoInfer<TClient>, NoInfer<TServer>, TErrors, TLegacyError> {\n return new RequestType<TParams, TResult, TError, TClient, TServer, TErrors, TLegacyError>(\n this.paramsSchema,\n this.resultSchema,\n this.errorSchema,\n this.docs,\n opts.client,\n opts.server,\n this.applicationErrors,\n );\n }\n\n /**\n * Return a copy with an explicit, typed set of checked application errors.\n * The legacy third `requestType` schema remains accepted for compatibility,\n * but does not opt a method into checked errors.\n */\n public withErrors<const TErrors extends readonly ApplicationErrorDescriptorBase[]>(\n errors: TErrors,\n ): RequestType<TParams, TResult, ApplicationErrorsOf<TErrors>, TClientStream, TServerStream, TErrors, TLegacyError> {\n return new RequestType<TParams, TResult, ApplicationErrorsOf<TErrors>, TClientStream, TServerStream, TErrors, TLegacyError>(\n this.paramsSchema,\n this.resultSchema,\n this.errorSchema,\n this.docs,\n this.clientStreamSchema,\n this.serverStreamSchema,\n errors,\n );\n }\n}\n\nexport class NotificationType<TParams = unknown> {\n public readonly kind = 'notification' as const;\n\n constructor(\n public readonly paramsSchema: Schema<TParams>,\n public readonly docs: MemberDocs = {},\n ) { }\n\n declare readonly _params: TParams;\n}\n\n/**\n * Define a request method.\n *\n * @example\n * bar: requestType(z.object({ to: z.string() }), z.string(), {\n * description: \"MUST resolve before the next call from the same caller.\",\n * })\n */\nexport function requestType<\n TParams,\n TResult = void,\n TError = void,\n>(\n params: Schema<TParams>,\n result?: Schema<TResult>,\n docsOrError?: MemberDocs | Schema<TError>,\n maybeDocs?: MemberDocs,\n): RequestType<TParams, TResult, TError> {\n // A zod schema (params/result/error) vs. a `MemberDocs` object: every\n // Zod 4 schema carries the `_zod` marker (the library-author–blessed way\n // to detect one — see zod's \"For library authors\" guide), which plain\n // docs objects never have. Works for both classic and mini schemas.\n const isErrorSchema = (v: unknown): v is Schema<TError> =>\n typeof v === 'object' && v !== null && '_zod' in v;\n\n const error = isErrorSchema(docsOrError) ? docsOrError : undefined;\n const docs = (!isErrorSchema(docsOrError) ? docsOrError : maybeDocs) ?? {};\n\n return new RequestType(\n params,\n result ?? (zVoid() as unknown as Schema<TResult>),\n error ?? (zVoid() as unknown as Schema<TError>),\n docs,\n );\n}\n\n/**\n * Define a notification method.\n *\n * @example\n * foo: notificationType(z.object({ message: z.string() }))\n */\nexport function notificationType<TParams>(\n params: Schema<TParams>,\n docs: MemberDocs = {},\n): NotificationType<TParams> {\n return new NotificationType(params, docs);\n}\n\nexport interface ZodToSvcJsonSchemaOptions {\n readonly methodName: string;\n readonly schemaPosition: string;\n readonly components: Record<string, LinkRpcJsonSchema>;\n}\n\n/** Convert a zod schema to our restricted SvcJsonSchema subset. */\nexport function zodToSvcJsonSchema(\n schema: Schema,\n options?: ZodToSvcJsonSchemaOptions,\n): LinkRpcJsonSchema {\n // `z.void()` / `z.undefined()` have no JSON-Schema representation —\n // `toJSONSchema` throws on them. Treat them as the trivially-true\n // schema (matches anything); JSON-RPC drops `undefined` from the wire\n // anyway, so this is the right structural answer for \"no value\".\n const type = (schema as { _zod?: { def?: { type?: string; }; }; })._zod?.def?.type;\n if (type === 'void' || type === 'undefined') return true;\n return normalizeZodJsonSchema(toJSONSchema(schema), options);\n}\n\nfunction normalizeZodJsonSchema(\n raw: unknown,\n options: ZodToSvcJsonSchemaOptions | undefined,\n): LinkRpcJsonSchema {\n if (!isRecord(raw)) return normalizeJsonSchema(raw);\n\n const definitions = isRecord(raw.$defs) ? raw.$defs : {};\n const localRefs = collectLocalRefs(raw);\n if (Object.keys(definitions).length === 0 && localRefs.size === 0) {\n return normalizeJsonSchema(raw);\n }\n if (options === undefined) {\n throw new Error(\n 'zodToSvcJsonSchema: local references require a component destination',\n );\n }\n\n const componentNamePrefix =\n `method=${encodeComponentNamePart(options.methodName)}` +\n `&schema=${encodeComponentNamePart(options.schemaPosition)}`;\n const definitionComponents = new Map<string, string>();\n for (const definitionName of Object.keys(definitions)) {\n definitionComponents.set(\n definitionName,\n `${componentNamePrefix}&def=${encodeComponentNamePart(definitionName)}`,\n );\n }\n const rootComponent = localRefs.has('#')\n ? `${componentNamePrefix}&root`\n : undefined;\n const rewrite = (value: unknown): unknown =>\n rewriteLocalRefs(value, definitionComponents, rootComponent);\n\n for (const [definitionName, definition] of Object.entries(definitions)) {\n const componentName = definitionComponents.get(definitionName);\n if (componentName === undefined) {\n throw new Error(`zodToSvcJsonSchema: missing component for \"${definitionName}\"`);\n }\n addComponent(\n options.components,\n componentName,\n normalizeJsonSchema(rewrite(definition)),\n );\n }\n\n const root = rewrite(raw);\n if (rootComponent !== undefined) {\n addComponent(options.components, rootComponent, normalizeJsonSchema(root));\n return { $ref: componentRef(rootComponent) };\n }\n return normalizeJsonSchema(root);\n}\n\nfunction collectLocalRefs(value: unknown, refs = new Set<string>()): ReadonlySet<string> {\n if (Array.isArray(value)) {\n for (const child of value) collectLocalRefs(child, refs);\n return refs;\n }\n if (!isRecord(value)) return refs;\n if (typeof value.$ref === 'string' && value.$ref.startsWith('#')) {\n refs.add(value.$ref);\n }\n for (const child of Object.values(value)) collectLocalRefs(child, refs);\n return refs;\n}\n\nfunction rewriteLocalRefs(\n value: unknown,\n definitionComponents: ReadonlyMap<string, string>,\n rootComponent: string | undefined,\n): unknown {\n if (Array.isArray(value)) {\n return value.map((child) =>\n rewriteLocalRefs(child, definitionComponents, rootComponent));\n }\n if (!isRecord(value)) return value;\n\n const result: Record<string, unknown> = {};\n for (const [key, child] of Object.entries(value)) {\n if (key === '$defs') continue;\n if (key === '$ref' && typeof child === 'string') {\n result[key] = rewriteLocalRef(child, definitionComponents, rootComponent);\n } else {\n result[key] = rewriteLocalRefs(child, definitionComponents, rootComponent);\n }\n }\n return result;\n}\n\nfunction rewriteLocalRef(\n ref: string,\n definitionComponents: ReadonlyMap<string, string>,\n rootComponent: string | undefined,\n): string {\n if (ref === '#') {\n if (rootComponent === undefined) {\n throw new Error('zodToSvcJsonSchema: root reference has no component destination');\n }\n return componentRef(rootComponent);\n }\n\n const definitionPrefix = '#/$defs/';\n if (ref.startsWith(definitionPrefix)) {\n const encodedName = ref.slice(definitionPrefix.length);\n const definitionName = [...definitionComponents.keys()]\n .find((name) => encodeJsonPointerSegment(name) === encodedName);\n const componentName = definitionName === undefined\n ? undefined\n : definitionComponents.get(definitionName);\n if (componentName === undefined) {\n throw new Error(`zodToSvcJsonSchema: dangling local reference \"${ref}\"`);\n }\n return componentRef(componentName);\n }\n\n if (ref.startsWith('#') && !ref.startsWith('#/components/schemas/')) {\n throw new Error(`zodToSvcJsonSchema: unsupported local reference \"${ref}\"`);\n }\n return ref;\n}\n\nfunction addComponent(\n components: Record<string, LinkRpcJsonSchema>,\n name: string,\n schema: LinkRpcJsonSchema,\n): void {\n if (Object.hasOwn(components, name)) {\n throw new Error(`zodToSvcJsonSchema: duplicate component name \"${name}\"`);\n }\n components[name] = schema;\n}\n\nfunction componentRef(name: string): string {\n return `#/components/schemas/${encodeJsonPointerSegment(name)}`;\n}\n\nfunction encodeJsonPointerSegment(value: string): string {\n return value.replace(/~/g, '~0').replace(/\\//g, '~1');\n}\n\nfunction encodeComponentNamePart(value: string): string {\n return encodeURIComponent(value).replace(/~/g, '%7E');\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return value !== null && typeof value === 'object' && !Array.isArray(value);\n}\n","/**\n * RFC 8785 JSON Canonicalization Scheme (JCS).\n *\n * Used as the byte-deterministic encoding under every linkrpc signature\n * (RPC calls, capabilities, hub-signed previews). Both signer and verifier\n * canonicalize the same value object and obtain byte-identical UTF-8 bytes.\n *\n * Implementation inlined from the `canonicalize` npm package (Apache-2.0,\n * https://github.com/erdtman/canonicalize) so this module stays\n * zero-dependency for browser bundlers that don't resolve transitive\n * npm specifiers (e.g. the in-house app-bundler).\n */\n\n\n/** RFC 8785 canonical JSON string for `value`. */\nexport function jcsCanonicalize(value: unknown): string {\n const out = _canonicalize(value);\n if (out === undefined) {\n throw new Error(\"jcsCanonicalize: value is not JSON-representable\");\n }\n return out;\n}\n\nconst _encoder = new TextEncoder();\n\n/** UTF-8 bytes of the RFC 8785 canonical JSON for `value`. The thing actually signed / hashed. */\nexport function jcsCanonicalizeBytes(value: unknown): Uint8Array {\n return _encoder.encode(jcsCanonicalize(value));\n}\n\nfunction _canonicalize(object: unknown, seen: Set<object> = new Set()): string | undefined {\n if (typeof object === \"number\" && Number.isNaN(object)) {\n throw new Error(\"NaN is not allowed\");\n }\n if (typeof object === \"number\" && !Number.isFinite(object)) {\n throw new Error(\"Infinity is not allowed\");\n }\n if (object === null || typeof object !== \"object\") {\n return JSON.stringify(object);\n }\n\n const obj = object as { toJSON?: () => unknown } & Record<string, unknown>;\n\n if (typeof obj.toJSON === \"function\") {\n if (seen.has(obj)) throw new Error(\"Circular reference detected\");\n seen.add(obj);\n const result = _canonicalize(obj.toJSON(), seen);\n seen.delete(obj);\n return result;\n }\n\n if (seen.has(obj)) throw new Error(\"Circular reference detected\");\n seen.add(obj);\n\n let result: string;\n if (Array.isArray(obj)) {\n const values = obj.map((cv) => {\n const value = cv === undefined || typeof cv === \"symbol\" ? null : cv;\n return _canonicalize(value, seen);\n });\n result = `[${values.join(\",\")}]`;\n } else {\n const parts: string[] = [];\n for (const key of Object.keys(obj).sort()) {\n const v = obj[key];\n if (v === undefined || typeof v === \"symbol\") continue;\n parts.push(`${JSON.stringify(key)}:${_canonicalize(v, seen)}`);\n }\n result = `{${parts.join(\",\")}}`;\n }\n\n seen.delete(obj);\n return result;\n}\n","/**\n * Pure-JS SHA-256 (RFC 6234 / FIPS 180-4). Synchronous, dependency-free,\n * isomorphic. Used internally by linkrpc for content-hashing interface\n * schemas and deriving identity slot names; also surfaced through the\n * `crypto` API as `crypto.sha256`. For signature work we go through the\n * `crypto` module (`./identity/crypto`).\n *\n * Replaces the previous `@noble/hashes/sha2` import so the bundle has\n * no runtime npm dependencies. Trades the well-vetted dep for ~80 lines\n * of straight-line code that has no branching on input contents and is\n * exercised by the existing test vectors plus `sha256.test.ts`.\n */\n\nconst K = new Uint32Array([\n 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,\n 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,\n 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,\n 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967,\n 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85,\n 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,\n 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3,\n 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2,\n]);\n\nfunction _rotr(x: number, n: number): number {\n return (x >>> n) | (x << (32 - n));\n}\n\nexport function sha256(data: Uint8Array): Uint8Array {\n const inputLen = data.length;\n const bitLen = inputLen * 8;\n // Round up to next 64-byte block leaving room for 0x80 marker + 8-byte length.\n const paddedLen = (inputLen + 9 + 63) & ~63;\n const padded = new Uint8Array(paddedLen);\n padded.set(data);\n padded[inputLen] = 0x80;\n\n const view = new DataView(padded.buffer);\n // Big-endian 64-bit bit length. Bottom 32 bits hold values < 2^32 bits = 2^29 bytes (~512 MiB).\n view.setUint32(paddedLen - 8, Math.floor(bitLen / 0x1_0000_0000), false);\n view.setUint32(paddedLen - 4, bitLen >>> 0, false);\n\n const H = new Uint32Array([\n 0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a,\n 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19,\n ]);\n const W = new Uint32Array(64);\n\n for (let block = 0; block < paddedLen; block += 64) {\n for (let t = 0; t < 16; t++) {\n W[t] = view.getUint32(block + t * 4, false);\n }\n for (let t = 16; t < 64; t++) {\n const w15 = W[t - 15];\n const w2 = W[t - 2];\n const s0 = _rotr(w15, 7) ^ _rotr(w15, 18) ^ (w15 >>> 3);\n const s1 = _rotr(w2, 17) ^ _rotr(w2, 19) ^ (w2 >>> 10);\n W[t] = (W[t - 16] + s0 + W[t - 7] + s1) >>> 0;\n }\n\n let a = H[0], b = H[1], c = H[2], d = H[3];\n let e = H[4], f = H[5], g = H[6], h = H[7];\n for (let t = 0; t < 64; t++) {\n const S1 = _rotr(e, 6) ^ _rotr(e, 11) ^ _rotr(e, 25);\n const ch = (e & f) ^ (~e & g);\n const temp1 = (h + S1 + ch + K[t] + W[t]) >>> 0;\n const S0 = _rotr(a, 2) ^ _rotr(a, 13) ^ _rotr(a, 22);\n const mj = (a & b) ^ (a & c) ^ (b & c);\n const temp2 = (S0 + mj) >>> 0;\n h = g;\n g = f;\n f = e;\n e = (d + temp1) >>> 0;\n d = c;\n c = b;\n b = a;\n a = (temp1 + temp2) >>> 0;\n }\n H[0] = (H[0] + a) >>> 0;\n H[1] = (H[1] + b) >>> 0;\n H[2] = (H[2] + c) >>> 0;\n H[3] = (H[3] + d) >>> 0;\n H[4] = (H[4] + e) >>> 0;\n H[5] = (H[5] + f) >>> 0;\n H[6] = (H[6] + g) >>> 0;\n H[7] = (H[7] + h) >>> 0;\n }\n\n const out = new Uint8Array(32);\n const outView = new DataView(out.buffer);\n for (let i = 0; i < 8; i++) outView.setUint32(i * 4, H[i], false);\n return out;\n}\n","import { jcsCanonicalize } from \"../protocol/jcs\";\nimport { sha256 } from \"../crypto/sha256\";\nimport type { LinkRpcInterfaceSchema, MethodSchema } from \"./linkRpcInterfaceSchema\";\nimport { normalizeJsonSchema } from \"./normalize\";\n\nconst methodSchemaFields = [\n \"params\",\n \"result\",\n \"clientStream\",\n \"serverStream\",\n] as const;\n\n/**\n * Compute the interface hash: SHA-256 of the canonicalized schema, truncated\n * to 16 hex chars (64 bits of collision budget per id).\n *\n * Canonicalization strips the schema down to its **normative wire-contract\n * projection** before hashing, so a single interface document can carry richer\n * non-normative material (codegen hints, safety expressions, notes) without\n * changing identity:\n *\n * 1. Normalize every JSON-Schema position (`params`, `result`, streams, and\n * `components.schemas`) onto the decidable linkrpc subset.\n * 2. Strip every `comment` field (non-normative — must not affect identity).\n * `description` is NORMATIVE and kept in the hash.\n * 3. Strip every **specification-extension** field — any object key whose name\n * begins with `x-` — at every level of the document (see\n * {@link EXTENSION_PREFIX}). This is the minimal, explicit \"one document,\n * two views\" mechanism: the stored document keeps the rich `x-…`\n * expressions; identity hashes only the simple contract. It mirrors\n * OpenRPC/OpenAPI specification extensions (this schema format is a subset\n * of OpenRPC 1.x). Editing an `x-…` value never changes the hash; changing\n * a wire field (`params`, `result`, member names, `type`, `required`,\n * `description`, `annotations`, …) does.\n * 4. Omit the top-level `hash` field itself.\n * 5. RFC 8785 JCS encode (recursive key sort, no whitespace) via {@link jcsCanonicalize}.\n *\n * Because no interface schema uses `x-…` keys today, this preserves every\n * existing hash: stripping a set of keys that are always absent is a no-op.\n *\n * > Reservation. `x-…` is reserved for non-normative extensions at every level.\n * > Member names cannot collide (they are alphanumeric per chapter 01 §2), and\n * > object property names in the JSON Schema subset MUST NOT begin with `x-`.\n */\nexport function computeInterfaceHash(schema: LinkRpcInterfaceSchema): string {\n const normalized = normalizeSchemaPositions(schema);\n const json = jcsCanonicalize(stripNonNormative(normalized, /* isRoot */ true));\n const digest = sha256(new TextEncoder().encode(json));\n const result = Array.from(digest.subarray(0, 8), (b) =>\n b.toString(16).padStart(2, \"0\")\n ).join(\"\");\n return result;\n}\n\nfunction normalizeSchemaPositions(schema: LinkRpcInterfaceSchema): LinkRpcInterfaceSchema {\n const methods: LinkRpcInterfaceSchema[\"methods\"] = Object.fromEntries(\n Object.entries(schema.methods).map(([name, method]) => {\n const normalized: MethodSchema = { ...method };\n for (const field of methodSchemaFields) {\n const value = normalized[field];\n if (value !== undefined) {\n normalized[field] = normalizeJsonSchema(value);\n }\n }\n return [name, normalized];\n }),\n );\n const componentSchemas = schema.components?.schemas;\n const components = componentSchemas === undefined\n ? schema.components\n : {\n ...schema.components,\n schemas: Object.fromEntries(\n Object.entries(componentSchemas).map(([name, value]) => [\n name,\n normalizeJsonSchema(value),\n ]),\n ),\n };\n return {\n ...schema,\n methods,\n ...(components === undefined ? {} : { components }),\n };\n}\n\n/**\n * Prefix marking a non-normative **specification-extension** key. Any object\n * key beginning with this prefix is stripped before hashing (at every level),\n * exactly like `comment`. Reserved for rich, identity-neutral material such as\n * codegen directives, richer validation/safety expressions, or tooling hints.\n */\nexport const EXTENSION_PREFIX = \"x-\";\n\n/** True for a key that must not contribute to the interface hash. */\nfunction isNonNormativeKey(key: string, isRoot: boolean): boolean {\n return (\n key === \"comment\" ||\n key.startsWith(EXTENSION_PREFIX) ||\n (isRoot && key === \"hash\")\n );\n}\n\nfunction stripNonNormative(value: unknown, isRoot = false): unknown {\n if (value === null || typeof value !== \"object\") return value;\n if (Array.isArray(value)) return value.map((v) => stripNonNormative(v));\n\n const out: Record<string, unknown> = {};\n for (const k of Object.keys(value as Record<string, unknown>)) {\n if (isNonNormativeKey(k, isRoot)) continue;\n const v = (value as Record<string, unknown>)[k];\n if (v === undefined) continue;\n out[k] = stripNonNormative(v);\n }\n return out;\n}\n","import type { LinkRpcJsonSchema } from './linkRpcJsonSchema';\n\ntype SchemaNode = Exclude<LinkRpcJsonSchema, boolean>;\nconst componentPrefix = '#/components/schemas/';\n\nexport function componentSchemaRef(name: string): string {\n return componentPrefix + name.replace(/~/g, '~0').replace(/\\//g, '~1');\n}\n\nexport function componentSchemaName(ref: string): string {\n if (!ref.startsWith(componentPrefix)) {\n throw new Error(`Invalid component reference: ${ref}`);\n }\n const token = ref.slice(componentPrefix.length);\n if (token.includes('/') || /~(?:[^01]|$)/.test(token)) {\n throw new Error(`Invalid component reference token: ${ref}`);\n }\n return token.replace(/~1/g, '/').replace(/~0/g, '~');\n}\n\n/**\n * Check the finite schema graph without interpreting JSON literal payloads.\n * A reference/union-only cycle is invalid; descending into an object member\n * or an array item guards a cycle, but does not imply the schema is nonempty.\n */\nexport function assertSchemaReferences(\n roots: Iterable<LinkRpcJsonSchema>,\n components: Record<string, LinkRpcJsonSchema> = {},\n): void {\n const nodes = new Set<SchemaNode>();\n const pending = [...roots, ...Object.values(components)];\n const unguarded = new Map<SchemaNode, LinkRpcJsonSchema[]>();\n while (pending.length > 0) {\n const node = pending.pop()!;\n if (typeof node === 'boolean' || nodes.has(node)) continue;\n nodes.add(node);\n const edges: LinkRpcJsonSchema[] = [];\n if ('$ref' in node) {\n const name = componentSchemaName(node.$ref);\n if (!Object.hasOwn(components, name)) {\n throw new Error(`Unresolved component reference: ${node.$ref}`);\n }\n edges.push(components[name]);\n }\n if ('anyOf' in node) edges.push(...node.anyOf);\n if ('oneOf' in node) edges.push(...node.oneOf);\n unguarded.set(node, edges);\n pending.push(...edges);\n if ('type' in node && node.type === 'object') {\n pending.push(...Object.values(node.properties ?? {}), node.additionalProperties);\n }\n if ('type' in node && node.type === 'array') {\n if ('prefixItems' in node) pending.push(...node.prefixItems);\n if (node.items !== undefined) pending.push(node.items);\n }\n }\n\n const visiting = new Set<SchemaNode>();\n const checked = new Set<SchemaNode>();\n const visit = (node: LinkRpcJsonSchema): void => {\n if (typeof node === 'boolean' || checked.has(node)) return;\n if (visiting.has(node)) {\n throw new Error('Unguarded recursive schema: cycle does not descend into a child value');\n }\n visiting.add(node);\n for (const child of unguarded.get(node) ?? []) visit(child);\n visiting.delete(node);\n checked.add(node);\n };\n for (const node of nodes) visit(node);\n}\n","import { z } from \"zod\";\nimport {\n assertSchemaReferences,\n componentSchemaName,\n} from \"./assertSchemaReferences\";\nimport type { LinkRpcJsonSchema } from \"./linkRpcJsonSchema\";\n\nexport interface SchemaToZodContext {\n readonly toZod: (schema: LinkRpcJsonSchema) => z.ZodType<unknown>;\n}\n\n/**\n * Create a recursive LinkRPC-schema validator materializer. Component\n * references are lazy, so self and mutual recursion remain guarded.\n */\nexport function createSchemaToZod(\n components: Record<string, LinkRpcJsonSchema> = {},\n): SchemaToZodContext {\n assertSchemaReferences([], components);\n const refs = new Map<string, z.ZodType<unknown>>();\n const component = (name: string): z.ZodType<unknown> => {\n const existing = refs.get(name);\n if (existing !== undefined) return existing;\n const source = components[name];\n if (source === undefined) throw new Error(`schemaToZod: dangling component reference \"${name}\"`);\n const lazy: z.ZodType<unknown> = z.lazy(() => compile(source));\n refs.set(name, lazy);\n return lazy;\n };\n\n const compile = (schema: LinkRpcJsonSchema): z.ZodType<unknown> => {\n if (schema === true) return z.unknown();\n if (schema === false) return z.never();\n const raw = schema as unknown as Record<string, unknown>;\n if (Array.isArray(raw.type)) {\n return union(raw.type.map((type) =>\n compile({ ...raw, type } as unknown as LinkRpcJsonSchema)\n ));\n }\n let base: z.ZodType<unknown>;\n if (\"$ref\" in schema) {\n base = component(componentSchemaName(schema.$ref));\n } else if (\"const\" in schema) {\n base = valueSchema(schema.const);\n } else if (\"enum\" in schema) {\n base = union(schema.enum.map(valueSchema));\n } else if (\"anyOf\" in schema) {\n base = union(schema.anyOf.map(compile));\n } else if (\"oneOf\" in schema) {\n // LinkRPC's normative structural semantics treat oneOf as a union;\n // exclusivity is only available through rich JSON Schema export.\n base = union(schema.oneOf.map(compile));\n } else if (isAnnotationOnlySchema(raw)) {\n base = z.unknown();\n } else {\n switch (schema.type) {\n case \"null\":\n base = z.null();\n break;\n case \"boolean\":\n base = z.boolean();\n break;\n case \"string\":\n base = stringSchema(schema.format);\n break;\n case \"integer\":\n base = z.number().int();\n break;\n case \"number\":\n base = z.number();\n break;\n case \"array\":\n if (\"prefixItems\" in schema) {\n const tuple = z.tuple(schema.prefixItems.map(compile) as [\n z.ZodType<unknown>,\n ...z.ZodType<unknown>[],\n ]);\n base = schema.items !== undefined && schema.items !== false\n ? tuple.rest(compile(schema.items))\n : tuple;\n } else {\n base = z.array(compile(schema.items));\n }\n break;\n case \"object\": {\n const required = new Set(schema.required ?? []);\n const shape: Record<string, z.ZodType<unknown>> = {};\n for (const [name, property] of Object.entries(schema.properties)) {\n const validator = compile(property);\n shape[name] = required.has(name) ? validator : validator.optional();\n }\n const object = z.object(shape);\n if (schema.additionalProperties === false) {\n base = object.strict();\n } else if (schema.additionalProperties === true) {\n base = object.loose();\n } else {\n base = object.catchall(compile(schema.additionalProperties));\n }\n break;\n }\n }\n }\n return base;\n };\n return {\n toZod(schema): z.ZodType<unknown> {\n assertSchemaReferences([schema], components);\n return compile(schema);\n },\n };\n}\n\nfunction isAnnotationOnlySchema(schema: Record<string, unknown>): boolean {\n const structuralKeys = [\n \"$ref\", \"const\", \"enum\", \"anyOf\", \"oneOf\", \"type\",\n \"properties\", \"items\", \"prefixItems\", \"additionalProperties\",\n ];\n return !structuralKeys.some((key) => Object.hasOwn(schema, key));\n}\n\nexport function schemaToZod(\n schema: LinkRpcJsonSchema,\n components: Record<string, LinkRpcJsonSchema> = {},\n): z.ZodType<unknown> {\n return createSchemaToZod(components).toZod(schema);\n}\n\nfunction union(items: z.ZodType<unknown>[]): z.ZodType<unknown> {\n if (items.length === 0) return z.never();\n if (items.length === 1) return items[0]!;\n return z.union(items as [z.ZodType<unknown>, z.ZodType<unknown>, ...z.ZodType<unknown>[]]);\n}\n\nfunction valueSchema(expected: import(\"../protocol/jsonValue\").JsonValue): z.ZodType<unknown> {\n return z.unknown().refine((actual) => jsonValueEqual(actual, expected), {\n message: `Expected ${JSON.stringify(expected)}`,\n });\n}\n\nfunction jsonValueEqual(actual: unknown, expected: unknown): boolean {\n if (Object.is(actual, expected)) return true;\n if (Array.isArray(actual) && Array.isArray(expected)) {\n return actual.length === expected.length &&\n actual.every((value, index) => jsonValueEqual(value, expected[index]));\n }\n if (\n actual !== null && expected !== null &&\n typeof actual === \"object\" && typeof expected === \"object\" &&\n !Array.isArray(actual) && !Array.isArray(expected)\n ) {\n const actualRecord = actual as Record<string, unknown>;\n const expectedRecord = expected as Record<string, unknown>;\n const keys = Object.keys(actualRecord);\n return keys.length === Object.keys(expectedRecord).length &&\n keys.every((key) =>\n Object.hasOwn(expectedRecord, key) &&\n jsonValueEqual(actualRecord[key], expectedRecord[key])\n );\n }\n return false;\n}\n\nfunction stringSchema(format: string | undefined): z.ZodType<unknown> {\n switch (format) {\n case \"email\": return z.email();\n case \"uri\":\n case \"url\": return z.url();\n case \"uuid\": return z.uuid();\n case \"date-time\": return z.iso.datetime();\n default: return z.string();\n }\n}\n","import { any as zAny, void as zVoid } from 'zod/mini';\nimport type { RequestId } from '../protocol/jsonRpc';\nimport { computeInterfaceHash } from '../schema/hash';\nimport {\n type ApplicationErrorDescriptorBase,\n type DeclaredApplicationErrorOf,\n type PublicApplicationErrorOf,\n applicationError,\n type MemberType,\n NotificationType,\n RequestType,\n type Schema,\n zodToSvcJsonSchema,\n} from '../schema/memberTypes';\nimport { schemaToZod } from '../schema/schemaToZod';\nimport type { MethodSchema, LinkRpcInterfaceSchema } from '../schema/linkRpcInterfaceSchema';\nimport type { LinkRpcJsonSchema } from '../schema/linkRpcJsonSchema';\n\n/**\n * Per-call stream API handed to a request handler as its third argument.\n * Allows the handler to consume {@link STREAM_METHOD} notifications\n * emitted by the caller (`onMessage`) and emit stream notifications to\n * the caller (`send`) while the request is in flight.\n *\n * Members are typed by the originating method's\n * {@link RequestType.clientStreamSchema} / `serverStreamSchema`.\n * Streams whose schema is `undefined` make the corresponding member\n * effectively unusable: `send` is typed `(payload: never) => void` and\n * the registered `onMessage` listener can never fire because the\n * receiver-side validator rejects the wire payload.\n */\nexport interface StreamApi<TClient = unknown, TServer = unknown> {\n /** Emit a server→client stream message. */\n send(payload: TServer): Promise<void>;\n /**\n * Register a listener for client→server stream messages on this\n * request. Calling twice replaces the previous listener.\n */\n onMessage(listener: (payload: TClient) => void): void;\n /**\n * Liveness probe toward the caller: resolves once the caller\n * acknowledges with a matching pong, rejects if the call settles\n * first. Independent of the channel's automatic keepalive ping.\n */\n ping(): Promise<void>;\n /**\n * Aborts when the caller cancels this in-flight request, or when the\n * hub cancels it on the caller's behalf (caller disconnect / idle\n * timeout). Observe it to stop work early and settle the request\n * (e.g. `signal.throwIfAborted()`), which surfaces as a `cancelled`\n * error to the caller.\n */\n readonly signal: AbortSignal;\n}\n\nexport interface InterfaceInfo {\n id: string;\n /**\n * Normative description of the interface (markdown). Part of the\n * interface hash — changing it is a contract change.\n */\n description?: string;\n /** Non-normative implementation notes. Stripped from the hash. */\n comment?: string;\n /**\n * Optional expected content hash (see `computeInterfaceHash`). When\n * set, {@link InterfaceDefinition}'s constructor verifies that the\n * computed {@link InterfaceDefinition.schemaHash} matches and throws\n * otherwise — a guard against silent contract drift when the wire\n * shape changes but a pinned hash was not updated.\n */\n hash?: string;\n}\n\n\nexport type MemberMap = Record<string, MemberType>;\n\n/** Stable wire identity of one member in an interface definition. */\nexport interface InterfaceMemberRef<TName extends string = string> {\n readonly interfaceId: string;\n readonly interfaceHash: string;\n readonly member: TName;\n}\n\nexport type InterfaceMemberRefMap<TMembers extends MemberMap> = {\n readonly [K in keyof TMembers & string]: InterfaceMemberRef<K>;\n};\n\n/**\n * Per-call options accepted by a streaming-enabled client method. Currently\n * only `onMessage` for consuming server→client stream notifications; the\n * caller addresses client→server stream messages via the returned\n * {@link StreamingCall}.\n */\nexport interface StreamCallOptions<TServer> {\n /** Listener for server→client stream messages on this in-flight call. */\n onMessage?: (payload: TServer) => void;\n}\n\n/**\n * Return shape of a streaming-enabled client method. Behaves as a\n * `Promise<TResult>` for the final response, and exposes `send` for\n * emitting client→server stream messages on the in-flight call. The\n * wire request id is also exposed (resolved once the request has\n * been allocated).\n *\n * For methods whose interface schema declares no client stream\n * (`TClient = never`), `send` is typed `(payload: never) => Promise<void>`\n * and is effectively uncallable — matching the runtime behavior, where\n * the receiver would drop client-emitted stream messages anyway.\n */\nexport interface StreamingCall<TResult, TClient> extends Promise<TResult> {\n /** Resolves to the wire request id once the call has been sent. */\n readonly requestId: Promise<RequestId>;\n /** Emit a client→server stream message on this in-flight call. */\n send(payload: TClient): Promise<void>;\n /**\n * Ask the callee to abort this in-flight call. Advisory: the call\n * settles via its normal response (typically a `cancelled` error).\n * `reason` is an open-set diagnostic string (see `StreamControlReason`).\n */\n cancel(reason?: string): Promise<void>;\n /**\n * Stop tracking this call locally. This does not notify the callee; call\n * {@link cancel} first when remote work should also be cancelled.\n */\n dispose?(reason?: string): void;\n /**\n * Liveness probe toward the callee: resolves once the callee\n * acknowledges with a matching pong, rejects if the call settles\n * first. Independent of the channel's automatic keepalive ping.\n */\n ping(): Promise<void>;\n}\n\nexport interface RemoteRpcError {\n readonly kind: 'remote';\n readonly code: number;\n readonly message: string;\n readonly data?: import('../protocol/jsonValue').JsonValue;\n}\n\nexport interface LocalRpcError {\n readonly kind: 'local';\n readonly cause: unknown;\n}\n\nexport type CheckedCallResult<TResult, TApplicationError = never> =\n | { readonly ok: true; readonly value: TResult; }\n | {\n readonly ok: false;\n readonly error: TApplicationError | RemoteRpcError | LocalRpcError;\n };\n\nexport interface CheckedCall<TResult, TApplicationError = never> extends Promise<TResult> {\n /**\n * Settle without throwing. Only an exact code/message/data-schema match is\n * promoted to a typed application error.\n */\n result(): Promise<CheckedCallResult<TResult, TApplicationError>>;\n}\n\n/**\n * `true` iff at least one stream direction is declared (either client or\n * server stream schema present). Used by {@link InterfaceClient} to pick\n * between the plain `Promise<R>` shape and the {@link StreamingCall}\n * shape per method.\n */\ntype _HasStream<TClient, TServer> = [TClient] extends [never] ? ([TServer] extends [never] ? false : true) :\n true;\n\ntype ClientCall<TResult, TApplicationError> = [TApplicationError] extends [never]\n ? Promise<TResult>\n : CheckedCall<TResult, TApplicationError>;\n\n/**\n * Compile-time TypeScript shape of an interface — useful for typed\n * client/server implementations on top of the runtime definition.\n *\n * Methods whose `RequestType` declares stream payloads via\n * `.withStream({ client, server })` return a {@link StreamingCall}\n * augmented with `send`; all others return a plain `Promise<TResult>`.\n *\n * @example\n * type Client = InterfaceClient<typeof myInterface>;\n * // => { bar(p: {...}): Promise<string>; foo(p: {...}): void; }\n */\ntype InterfaceClientMember<TMember> =\n TMember extends RequestType<infer P, infer R, infer E, infer TC, infer TS, any, any> ? (\n _HasStream<TC, TS> extends true ? (params: P, opts?: StreamCallOptions<TS>) =>\n StreamingCall<R, TC> & ClientCall<R, PublicApplicationErrorOf<E>> :\n (params: P) => ClientCall<R, PublicApplicationErrorOf<E>>\n ) :\n TMember extends NotificationType<infer P> ? (params: P) => void :\n never;\n\nexport type InterfaceClient<TDef extends InterfaceDefinition<any>> = {\n [K in keyof TDef['members']]: InterfaceClientMember<TDef['members'][K]>;\n};\n\n/**\n * Compile-time shape of a server implementation for an interface — used by\n * `LinkRpcConnection.register`. Request handlers may return synchronously or\n * via a promise; notification handlers return void.\n *\n * `TCtx` is the call-context type carried by the hosting connection — see\n * `LinkRpcConnection<TCtx>`. For the default connection (`TCtx = undefined`)\n * handlers may take a single params arg; for ctx-aware connections (e.g.\n * the hub's self connection) they may take a second `ctx` arg of the\n * concrete type. A 1-arg handler remains assignable where a 2-arg handler\n * is expected, so existing handlers compile unchanged.\n */\ntype InterfaceHandler<TMember, TCtx> =\n TMember extends RequestType<infer P, infer R, infer E, infer TC, infer TS, any, any> ?\n (params: P, ctx: TCtx, stream: StreamApi<TC, TS>) =>\n R | DeclaredApplicationErrorOf<E> |\n Promise<R | DeclaredApplicationErrorOf<E>> :\n TMember extends NotificationType<infer P> ? (params: P, ctx: TCtx) => void | Promise<void> :\n never;\n\nexport type InterfaceHandlers<\n TDef extends InterfaceDefinition<any>,\n TCtx = undefined,\n> = {\n [K in keyof TDef['members']]: InterfaceHandler<TDef['members'][K], TCtx>;\n };\n\n/**\n * Options accepted by {@link InterfaceDefinition}'s constructor.\n *\n * `frozenSchema` lets callers supply an externally-authored\n * `LinkRpcInterfaceSchema` (e.g. produced by codegen or, in the faker, by an\n * LLM at runtime) verbatim. When set, `toSchema()` returns that document\n * (with `hash` overlaid) and `schemaHash` is computed from it — the\n * `members` map is used only for runtime dispatch (param/result\n * validation, stream routing) and is no longer the source of truth for\n * the wire shape.\n */\nexport interface InterfaceDefinitionOpts {\n frozenSchema?: LinkRpcInterfaceSchema;\n}\n\ninterface InterfaceDefinitionState {\n readonly frozenSchema: LinkRpcInterfaceSchema | undefined;\n schemaCache: LinkRpcInterfaceSchema | undefined;\n hashCache: string | undefined;\n}\n\nconst interfaceDefinitionState = new WeakMap<object, InterfaceDefinitionState>();\n\nexport class InterfaceDefinition<TMembers extends MemberMap> {\n /** Typed wire references for capability and access-request construction. */\n public readonly ref: InterfaceMemberRefMap<TMembers>;\n\n constructor(\n public readonly info: InterfaceInfo,\n public readonly members: TMembers,\n opts: InterfaceDefinitionOpts = {},\n ) {\n validateInterfaceErrors(opts.frozenSchema);\n interfaceDefinitionState.set(this, {\n frozenSchema: opts.frozenSchema,\n schemaCache: undefined,\n hashCache: undefined,\n });\n this.ref = Object.fromEntries(\n Object.keys(members).map((member) => [\n member,\n {\n interfaceId: this.info.id,\n interfaceHash: this.schemaHash,\n member,\n },\n ]),\n ) as InterfaceMemberRefMap<TMembers>;\n if (info.hash !== undefined && this.schemaHash !== info.hash) {\n throw new Error(\n `Interface hash mismatch for \"${info.id}\": expected \"${info.hash}\", got \"${this.schemaHash}\". `\n + `The interface's wire contract changed — update the pinned hash to \"${this.schemaHash}\" after reviewing the change.`,\n );\n }\n }\n\n /** Content hash of this interface (see `computeInterfaceHash`). */\n public get schemaHash(): string {\n const state = interfaceDefinitionState.get(this)!;\n if (state.hashCache === undefined) {\n const base = state.frozenSchema ?? buildSchema(this.info, this.members, '');\n state.hashCache = computeInterfaceHash(base);\n }\n return state.hashCache;\n }\n\n /** Lower the definition to a wire-format `LinkRpcInterfaceSchema`, hash filled in. */\n public toSchema(): LinkRpcInterfaceSchema {\n const state = interfaceDefinitionState.get(this)!;\n if (state.schemaCache === undefined) {\n state.schemaCache = state.frozenSchema !== undefined ?\n { ...state.frozenSchema, hash: this.schemaHash } :\n buildSchema(this.info, this.members, this.schemaHash);\n }\n return state.schemaCache;\n }\n}\n\nfunction buildSchema(\n info: InterfaceInfo,\n members: MemberMap,\n hash: string,\n): LinkRpcInterfaceSchema {\n const methods: Record<string, MethodSchema> = {};\n const components: Record<string, LinkRpcJsonSchema> = {};\n for (const [name, member] of Object.entries(members)) {\n methods[name] = toMethodSchema(name, member, components);\n }\n const schema: LinkRpcInterfaceSchema = {\n id: info.id,\n hash,\n methods,\n };\n if (Object.keys(components).length > 0) schema.components = { schemas: components };\n if (info.description !== undefined) schema.description = info.description;\n if (info.comment !== undefined) schema.comment = info.comment;\n return schema;\n}\n\nfunction toMethodSchema(\n name: string,\n member: MemberType,\n components: Record<string, LinkRpcJsonSchema>,\n): MethodSchema {\n const docs = member.docs;\n\n if (member.kind === 'request') {\n const m: MethodSchema = {\n params: convertMemberSchema(name, 'params', member.paramsSchema, components),\n result: convertMemberSchema(name, 'result', member.resultSchema, components),\n };\n if (member.clientStreamSchema !== undefined) {\n m.clientStream = convertMemberSchema(\n name,\n 'clientStream',\n member.clientStreamSchema,\n components,\n );\n }\n if (member.serverStreamSchema !== undefined) {\n m.serverStream = convertMemberSchema(\n name,\n 'serverStream',\n member.serverStreamSchema,\n components,\n );\n }\n if (member.applicationErrors.length > 0) {\n m.errors = member.applicationErrors.map((error: ApplicationErrorDescriptorBase) => {\n const result: NonNullable<MethodSchema['errors']>[number] = {\n code: error.code,\n message: error.message,\n };\n if (error.dataSchema !== undefined) {\n result.data = convertMemberSchema(\n name,\n `error=${error.code}`,\n error.dataSchema,\n components,\n );\n }\n return result;\n });\n }\n if (docs.description !== undefined) m.description = docs.description;\n if (docs.comment !== undefined) m.comment = docs.comment;\n if (docs.annotations !== undefined) m.annotations = docs.annotations;\n return m;\n }\n\n const m: MethodSchema = {\n params: convertMemberSchema(name, 'params', member.paramsSchema, components),\n };\n if (docs.description !== undefined) m.description = docs.description;\n if (docs.comment !== undefined) m.comment = docs.comment;\n if (docs.annotations !== undefined) m.annotations = docs.annotations;\n return m;\n}\n\nfunction validateInterfaceErrors(schema: LinkRpcInterfaceSchema | undefined): void {\n if (schema === undefined) return;\n for (const [methodName, method] of Object.entries(schema.methods)) {\n if (method.result === undefined && method.errors !== undefined) {\n throw new Error(`Notification \"${methodName}\" cannot declare application errors.`);\n }\n const seen = new Set<number>();\n for (const error of method.errors ?? []) {\n if (typeof error.message !== 'string') {\n throw new Error(`Application error message on \"${methodName}\" must be a string.`);\n }\n if (!Number.isInteger(error.code) || error.code < -2147483648 || error.code > 2147483647) {\n throw new Error(`Application error code ${error.code} on \"${methodName}\" must be a signed 32-bit integer.`);\n }\n if ((error.code >= -32768 && error.code <= -32000) || error.code === -32800) {\n throw new Error(`Application error code ${error.code} on \"${methodName}\" is reserved by JSON-RPC or LinkRPC.`);\n }\n if (seen.has(error.code)) {\n throw new Error(`Duplicate application error code ${error.code} on \"${methodName}\".`);\n }\n seen.add(error.code);\n }\n }\n}\n\nfunction convertMemberSchema(\n methodName: string,\n position: string,\n schema: Schema,\n components: Record<string, LinkRpcJsonSchema>,\n): LinkRpcJsonSchema {\n return zodToSvcJsonSchema(schema, {\n methodName,\n schemaPosition: position,\n components,\n });\n}\n\n/**\n * Convenient builder for an interface definition. Tracks TypeScript types\n * through `requestType` / `notificationType` so client and server code can\n * derive their shapes from the definition.\n *\n * @example\n * const myInterface = defineInterface(\n * { id: \"de.hediet.notification-target\" },\n * {\n * send: requestType(z.object({ to: z.string() }), z.string()),\n * notify: notificationType(z.object({ message: z.string() })),\n * },\n * );\n */\nexport function defineInterface<TMembers extends MemberMap>(\n info: InterfaceInfo,\n members: TMembers,\n): InterfaceDefinition<TMembers> {\n return new InterfaceDefinition(info, members);\n}\n\n/**\n * Build a runtime {@link InterfaceDefinition} from a previously-published\n * {@link LinkRpcInterfaceSchema} — typically one received over the wire (e.g.\n * from `hubrpc.schemas::get`) or generated at runtime by tooling that does\n * not have the original zod sources at hand (codegen, faker / mock\n * services, dynamic gateways).\n *\n * The original schema is kept verbatim: `toSchema()` returns it (with\n * `hash` overlaid) and `schemaHash` is computed from it, so reflection\n * consumers see the real wire contract. Member-level params / results /\n * streams use `z.any()` because no zod source is available — call-site\n * validation is therefore a no-op and the caller is responsible for\n * shape-checking inputs and outputs. Declared application-error payloads\n * are materialized and validated because recognizing a typed error must\n * never rely on its code alone.\n *\n * Methods with no `result` descriptor become notifications; methods with\n * `clientStream` / `serverStream` get pass-through stream payload\n * schemas attached.\n */\nexport function interfaceFromSchema(schema: LinkRpcInterfaceSchema): InterfaceDefinition<MemberMap> {\n const members: MemberMap = {};\n for (const [name, method] of Object.entries(schema.methods)) {\n if (method.result === undefined) {\n members[name] = new NotificationType(zAny());\n continue;\n }\n const base = new RequestType<unknown, unknown, void>(zAny(), zAny(), zVoid())\n .withErrors((method.errors ?? []).map((error) => error.data === undefined\n ? applicationError(error.code, error.message)\n : applicationError(error.code, error.message, schemaToZod(\n error.data, schema.components?.schemas,\n ))));\n members[name] = method.clientStream !== undefined || method.serverStream !== undefined ?\n base.withStream({\n client: method.clientStream !== undefined ? zAny() : undefined,\n server: method.serverStream !== undefined ? zAny() : undefined,\n }) :\n base;\n }\n const info: InterfaceInfo = { id: schema.id };\n if (schema.description !== undefined) info.description = schema.description;\n if (schema.comment !== undefined) info.comment = schema.comment;\n return new InterfaceDefinition(info, members, { frozenSchema: schema });\n}\n","import {\n array,\n boolean,\n enum as zEnum,\n int,\n literal,\n nonnegative,\n number,\n object,\n optional,\n record,\n string,\n union,\n unknown,\n} from \"zod/mini\";\nimport type { output as zInfer } from \"zod/v4/core\";\nimport { defineInterface } from \"../connection/interfaceDefinition\";\nimport { requestType } from \"../schema/memberTypes\";\n\nexport const zTopologyPort = object({\n portId: string(),\n label: optional(string()),\n});\n\nexport const zParticipantDescriptor = object({\n type: optional(string()),\n label: optional(string()),\n processId: optional(number()),\n processType: optional(string()),\n nodeStatusServiceId: optional(string()),\n metadata: optional(record(string(), union([string(), number(), boolean()]))),\n});\n\nexport const zParticipantDescriptorSource = object({\n source: zEnum([\"self\", \"attacher\"]),\n descriptor: zParticipantDescriptor,\n});\n\nexport const zTopologyNode = object({\n nodeId: string(),\n kind: optional(zEnum([\"endpoint\", \"hub\"])),\n label: optional(string()),\n descriptors: optional(array(zParticipantDescriptorSource)),\n ports: array(zTopologyPort),\n});\n\nexport const zTopologyLinkEndpoint = object({\n nodeId: string(),\n portId: string(),\n});\n\nexport const zTopologyTransportEndpoint = object({\n address: optional(string()),\n port: optional(number().check(int(), nonnegative())),\n});\n\n/**\n * Transport details as observed at a topology link. `local` corresponds to the\n * link's `from` endpoint and `remote` to its `to` endpoint.\n */\nexport const zTopologyTransportInfo = object({\n type: string(),\n local: optional(zTopologyTransportEndpoint),\n remote: optional(zTopologyTransportEndpoint),\n path: optional(string()),\n metadata: optional(record(string(), union([string(), number(), boolean()]))),\n});\n\nexport const zTopologyLink = object({\n from: zTopologyLinkEndpoint,\n to: zTopologyLinkEndpoint,\n label: optional(string()),\n peerState: optional(zEnum([\"identified\", \"pending\", \"unsupported\", \"error\"])),\n transport: optional(zTopologyTransportInfo),\n});\n\nexport const zRouteClaim = object({\n serviceId: string(),\n nodeId: string(),\n portId: string(),\n match: zEnum([\"exact\", \"prefix\"]),\n});\n\nexport const zTopologyGraph = object({\n observerServiceId: string(),\n entryNodeId: string(),\n nodes: array(zTopologyNode),\n links: array(zTopologyLink),\n routes: array(zRouteClaim),\n});\n\nexport type TopologyPort = zInfer<typeof zTopologyPort>;\nexport type ParticipantDescriptor = zInfer<typeof zParticipantDescriptor>;\nexport type ParticipantDescriptorSource = zInfer<typeof zParticipantDescriptorSource>;\nexport type TopologyNode = zInfer<typeof zTopologyNode>;\nexport type TopologyLinkEndpoint = zInfer<typeof zTopologyLinkEndpoint>;\nexport type TopologyTransportEndpoint = zInfer<typeof zTopologyTransportEndpoint>;\nexport type TopologyTransportInfo = zInfer<typeof zTopologyTransportInfo>;\nexport type TopologyLink = zInfer<typeof zTopologyLink>;\nexport type RouteClaim = zInfer<typeof zRouteClaim>;\nexport type TopologyGraph = zInfer<typeof zTopologyGraph>;\n\nexport const topologyInterface = defineInterface(\n {\n id: \"hubrpc.topology\",\n description:\n \"Inspect the transport graph visible from a service. A watch emits invalidation \"\n + \"ticks; consumers re-fetch getGraph after each tick.\",\n },\n {\n getGraph: requestType(object({}), zTopologyGraph).withStream({ client: object({}) }),\n watchGraph: requestType(object({}), object({})).withStream({\n server: object({}),\n }),\n },\n);\n\nexport const zTrafficTransitEndpoint = object({\n edgeId: string(),\n portId: string(),\n requestId: optional(union([number(), string()])),\n});\n\nexport const zTrafficTransitEvent = object({\n type: literal(\"transit\"),\n timeMs: number(),\n nodeId: string(),\n in: optional(zTrafficTransitEndpoint),\n out: optional(zTrafficTransitEndpoint),\n disposition: zEnum([\"forwarded\", \"consumed\", \"dropped\", \"unroutable\"]),\n kind: zEnum([\"request\", \"notification\", \"response\", \"stream\"]),\n method: optional(string()),\n params: optional(unknown()),\n result: optional(unknown()),\n error: optional(object({\n code: number(),\n message: string(),\n data: optional(unknown()),\n })),\n});\n\nexport const zTrafficOverflowEvent = object({\n type: literal(\"overflow\"),\n dropped: number().check(int(), nonnegative()),\n});\n\nexport const zTrafficEvent = union([zTrafficTransitEvent, zTrafficOverflowEvent]);\n\nexport type TrafficTransitEndpoint = zInfer<typeof zTrafficTransitEndpoint>;\nexport type TrafficTransitEvent = zInfer<typeof zTrafficTransitEvent>;\nexport type TrafficOverflowEvent = zInfer<typeof zTrafficOverflowEvent>;\nexport type TrafficEvent = zInfer<typeof zTrafficEvent>;\n\nexport const zTrafficWatchResult = object({\n delivered: number().check(int(), nonnegative()),\n dropped: number().check(int(), nonnegative()),\n});\n\nexport type TrafficWatchResult = zInfer<typeof zTrafficWatchResult>;\n\nconst zTrafficWatchParams = object({\n methodPrefix: optional(string()),\n trafficIgnoreKey: optional(string()),\n focusRequest: optional(object({\n portId: string(),\n requestId: union([number(), string()]),\n })),\n});\n\nconst zTrafficWatchWithPayloadsParams = object({\n methodPrefix: optional(string()),\n trafficIgnoreKey: optional(string()),\n focusRequest: optional(object({\n portId: string(),\n requestId: union([number(), string()]),\n })),\n maxPayloadBytes: number().check(int(), nonnegative()),\n});\n\n/**\n * Observe raw message transits at the node hosting the addressed service.\n * Consumers may correlate adjacent transits by shared `(portId, requestId)`.\n */\nexport const trafficInterface = defineInterface(\n {\n id: \"hubrpc.traffic\",\n description:\n \"Stream raw message transits for the entire node hosting the addressed service. \"\n + \"Payload-free and explicitly payload-bearing variants keep disclosure opt-in.\",\n },\n {\n watch: requestType(zTrafficWatchParams, zTrafficWatchResult).withStream({\n server: zTrafficEvent,\n }),\n watchWithPayloads: requestType(\n zTrafficWatchWithPayloadsParams,\n zTrafficWatchResult,\n ).withStream({\n server: zTrafficEvent,\n }),\n },\n);\n","import { array, object, optional, string } from \"zod/mini\";\nimport type { output as zInfer } from \"zod/v4/core\";\nimport { defineInterface } from \"../connection/interfaceDefinition\";\nimport { requestType } from \"../schema/memberTypes\";\nimport { zParticipantDescriptorSource } from \"./inspection.interfaces\";\nimport type { ParticipantDescriptorSource } from \"./inspection.interfaces\";\n\nconst zNodeInfo = object({\n /**\n * Random identity of this connection's node. It is a topology-correlation\n * label only and must not be used for authentication or authorization.\n */\n nodeId: string(),\n /** Random identity of this connection's port on its node. */\n portId: string(),\n /** Optional diagnostic descriptors; never used for authorization. */\n descriptors: optional(array(zParticipantDescriptorSource)),\n});\n\nexport type NodeInfo = zInfer<typeof zNodeInfo>;\nexport type { ParticipantDescriptorSource };\n\n/**\n * Generates unique topology-correlation labels, not security identities.\n * Custom generators must avoid collisions across nodes and ports. Tests can\n * supply an independent deterministic sequence for each participant.\n */\nexport type TopologyIdGenerator = (kind: 'node' | 'port') => string;\n\n/**\n * Minimal root service for aligning the independently observed topologies at\n * both ends of a connection.\n */\nexport const nodeInterface = defineInterface(\n {\n id: \"hubrpc.node\",\n description:\n \"Topology bootstrap: identify the node and port at this end of the direct connection.\",\n },\n {\n getNodeId: requestType(object({}), zNodeInfo),\n },\n);\n","import type {\n TrafficTransitEndpoint,\n TrafficTransitEvent,\n} from './inspection.interfaces';\n\nexport interface TrafficRequestRef {\n readonly portId: string;\n readonly requestId: string | number;\n}\n\nexport interface TrafficFlowFilterOptions {\n readonly focus?: TrafficRequestRef;\n}\n\nexport class TrafficFlowFilter {\n private readonly _focused: CorrelatedFlow | undefined;\n\n constructor(options: TrafficFlowFilterOptions) {\n this._focused = options.focus !== undefined\n ? new CorrelatedFlow([options.focus])\n : undefined;\n }\n\n public shouldInclude(transit: TrafficTransitEvent): boolean {\n const focused = this._focused?.accept(transit).matches ?? true;\n return focused;\n }\n}\n\nexport class TrafficWatchFlowTracker {\n private readonly _active = new Set<CorrelatedFlow>();\n private readonly _unclaimed = new Map<string, CorrelatedFlow>();\n\n public accept(transit: TrafficTransitEvent): boolean {\n if (transit.kind === 'request' && isTrafficWatchMethod(transit.method)) {\n const trafficIgnoreKey = readTrafficIgnoreKey(transit.params);\n let flow = this._findFlow(transit);\n if (flow === undefined) {\n flow = new CorrelatedFlow(\n requestRefsOf(transit),\n completionRefOf(transit),\n );\n if (!isTerminal(transit)) this._active.add(flow);\n } else {\n flow.accept(transit);\n }\n if (isTerminal(transit)) {\n this._removeFlow(flow);\n return true;\n }\n if (trafficIgnoreKey !== undefined) {\n this._unclaimed.set(trafficIgnoreKey, flow);\n }\n return true;\n }\n for (const flow of this._active) {\n const match = flow.accept(transit);\n if (!match.matches) continue;\n if (match.completed) this._removeFlow(flow);\n return true;\n }\n return false;\n }\n\n private _findFlow(transit: TrafficTransitEvent): CorrelatedFlow | undefined {\n for (const flow of this._active) {\n if (flow.matches(transit)) return flow;\n }\n return undefined;\n }\n\n private _removeFlow(flow: CorrelatedFlow): void {\n this._active.delete(flow);\n for (const [key, pending] of this._unclaimed) {\n if (pending === flow) this._unclaimed.delete(key);\n }\n }\n\n public claim(trafficIgnoreKey: string): boolean {\n return this._unclaimed.delete(trafficIgnoreKey);\n }\n\n public clear(): void {\n this._active.clear();\n this._unclaimed.clear();\n }\n}\n\nclass CorrelatedFlow {\n private readonly _endpoints = new Set<string>();\n private readonly _completionEndpoint: string | undefined;\n\n constructor(\n endpoints: readonly TrafficRequestRef[],\n completionEndpoint: TrafficRequestRef | undefined = endpoints[0],\n ) {\n for (const endpoint of endpoints) this._endpoints.add(endpointKey(endpoint));\n this._completionEndpoint = completionEndpoint === undefined\n ? undefined\n : endpointKey(completionEndpoint);\n }\n\n public matches(transit: TrafficTransitEvent): boolean {\n return requestRefsOf(transit)\n .some((endpoint) => this._endpoints.has(endpointKey(endpoint)));\n }\n\n public accept(transit: TrafficTransitEvent): {\n readonly matches: boolean;\n readonly completed: boolean;\n } {\n const endpoints = requestRefsOf(transit);\n if (!this.matches(transit)) {\n return { matches: false, completed: false };\n }\n for (const endpoint of endpoints) this._endpoints.add(endpointKey(endpoint));\n const completed = transit.kind === 'response'\n && (\n isTerminal(transit)\n || (\n this._completionEndpoint !== undefined\n && endpoints.some((endpoint) =>\n endpointKey(endpoint) === this._completionEndpoint)\n )\n );\n if (completed) this._endpoints.clear();\n return { matches: true, completed };\n }\n\n}\n\nfunction isTerminal(transit: TrafficTransitEvent): boolean {\n return transit.disposition === 'dropped'\n || transit.disposition === 'unroutable';\n}\n\nfunction requestRefsOf(transit: TrafficTransitEvent): TrafficRequestRef[] {\n const result: TrafficRequestRef[] = [];\n if (transit.in?.requestId !== undefined) result.push(requestRef(transit.in));\n if (transit.out?.requestId !== undefined) result.push(requestRef(transit.out));\n return result;\n}\n\nfunction requestRef(endpoint: TrafficTransitEndpoint): TrafficRequestRef {\n return {\n portId: endpoint.portId,\n requestId: endpoint.requestId!,\n };\n}\n\nfunction completionRefOf(transit: TrafficTransitEvent): TrafficRequestRef | undefined {\n if (transit.in?.requestId !== undefined) return requestRef(transit.in);\n if (transit.out?.requestId !== undefined) return requestRef(transit.out);\n return undefined;\n}\n\nfunction endpointKey(endpoint: TrafficRequestRef): string {\n return JSON.stringify([\n endpoint.portId,\n typeof endpoint.requestId,\n endpoint.requestId,\n ]);\n}\n\nfunction isTrafficWatchMethod(method: string | undefined): boolean {\n return method?.endsWith('::hubrpc.traffic::watch') === true\n || method?.endsWith('::hubrpc.traffic::watchWithPayloads') === true\n || method === 'hubrpc.traffic::watch'\n || method === 'hubrpc.traffic::watchWithPayloads';\n}\n\nfunction readTrafficIgnoreKey(params: unknown): string | undefined {\n if (params === null || Array.isArray(params) || typeof params !== 'object' || !('trafficIgnoreKey' in params)) {\n return undefined;\n }\n const value = params.trafficIgnoreKey;\n return typeof value === 'string' ? value : undefined;\n}\n","import type {\n TrafficEvent,\n TrafficTransitEvent,\n TrafficWatchResult,\n} from './inspection.interfaces';\nimport type { JsonValue } from '../protocol/jsonRpc';\nimport {\n TrafficFlowFilter,\n} from './trafficFlowFilter';\nimport type { TrafficRequestRef } from './trafficFlowFilter';\n\nconst DEFAULT_QUEUE_LIMIT = 256;\n\nexport interface TrafficSubscriptionOptions {\n readonly methodPrefix?: string;\n readonly maxPayloadBytes?: number;\n readonly trafficIgnoreKey?: string;\n readonly focusRequest?: TrafficRequestRef;\n}\n\nexport interface TrafficSubscription {\n readonly closed: Promise<TrafficWatchResult>;\n dispose(): void;\n}\n\n/**\n * Applies per-subscriber filtering and payload policy while isolating traffic\n * producers from slow or failed stream consumers.\n */\nexport class BoundedTrafficSubscription implements TrafficSubscription {\n private readonly _queue: TrafficTransitEvent[] = [];\n private _active = true;\n private _pumping = false;\n private _overflowPending = 0;\n private _delivered = 0;\n private _dropped = 0;\n private readonly _resolveClosed: (result: TrafficWatchResult) => void;\n private readonly _filter: TrafficFlowFilter;\n public readonly closed: Promise<TrafficWatchResult>;\n\n constructor(\n private readonly _options: TrafficSubscriptionOptions,\n private readonly _send: (event: TrafficEvent) => Promise<void>,\n private readonly _onDispose: () => void,\n private readonly _queueLimit = DEFAULT_QUEUE_LIMIT,\n ) {\n let resolve!: (result: TrafficWatchResult) => void;\n this.closed = new Promise<TrafficWatchResult>((r) => resolve = r);\n this._resolveClosed = resolve;\n this._filter = new TrafficFlowFilter({\n focus: _options.focusRequest,\n });\n }\n\n public enqueue(transit: TrafficTransitEvent): void {\n if (!this._active) return;\n if (!this._filter.shouldInclude(transit)) return;\n if (\n this._options.methodPrefix !== undefined\n && !transit.method?.startsWith(this._options.methodPrefix)\n ) {\n return;\n }\n\n const event = this._options.maxPayloadBytes === undefined\n ? withoutPayloads(transit)\n : withCappedPayloads(transit, this._options.maxPayloadBytes);\n if (this._queue.length >= this._queueLimit) {\n this._queue.shift();\n this._dropped++;\n this._overflowPending++;\n }\n this._queue.push(event);\n if (!this._pumping) {\n this._pumping = true;\n queueMicrotask(() => void this._pump());\n }\n }\n\n public dispose(): void {\n if (!this._active) return;\n this._active = false;\n this._dropped += this._queue.length;\n this._queue.length = 0;\n this._overflowPending = 0;\n this._onDispose();\n if (!this._pumping) this._complete();\n }\n\n private async _pump(): Promise<void> {\n try {\n while (this._active) {\n if (this._overflowPending > 0) {\n const dropped = this._overflowPending;\n this._overflowPending = 0;\n await this._send({ type: 'overflow', dropped });\n continue;\n }\n const event = this._queue.shift();\n if (event === undefined) break;\n await this._send(event);\n this._delivered++;\n }\n } catch {\n this.dispose();\n } finally {\n this._pumping = false;\n if (!this._active) {\n this._complete();\n } else if (this._queue.length > 0 || this._overflowPending > 0) {\n this._pumping = true;\n queueMicrotask(() => void this._pump());\n }\n }\n }\n\n private _complete(): void {\n this._resolveClosed({\n delivered: this._delivered,\n dropped: this._dropped,\n });\n }\n}\n\nfunction withoutPayloads(transit: TrafficTransitEvent): TrafficTransitEvent {\n const { params: _params, result: _result, error, ...rest } = transit;\n if (error === undefined) return rest;\n return {\n ...rest,\n error: { code: error.code, message: error.message },\n };\n}\n\nfunction withCappedPayloads(\n transit: TrafficTransitEvent,\n maxPayloadBytes: number,\n): TrafficTransitEvent {\n return {\n ...transit,\n params: capPayload(transit.params, maxPayloadBytes),\n result: capPayload(transit.result, maxPayloadBytes),\n error: transit.error === undefined ? undefined : {\n ...transit.error,\n data: capPayload(transit.error.data, maxPayloadBytes),\n },\n };\n}\n\nfunction capPayload(value: unknown, maxBytes: number): JsonValue | undefined {\n if (value === undefined) return undefined;\n if (maxBytes === Number.POSITIVE_INFINITY) return value as JsonValue;\n const json = JSON.stringify(value);\n if (json === undefined) return undefined;\n const encoded = new TextEncoder().encode(json);\n if (encoded.byteLength <= maxBytes) return value as JsonValue;\n const encoder = new TextEncoder();\n let preview = new TextDecoder().decode(encoded.slice(0, maxBytes));\n while (encoder.encode(preview).byteLength > maxBytes) {\n preview = preview.slice(0, -1);\n }\n return preview;\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAUA,MAAM,4BAAY,IAAI,IAAI;CACtB;CAAQ;CACR;CAAc;CAAY;CAC1B;CAAS;CACT;CAAS;CACT;CAAS;CAAS;CAClB;CACA;CAAS;AACb,CAAC;;;;;;;;;;;;;;;;AAiBD,SAAgB,oBAAoB,KAAiC;CACjE,IAAI,QAAQ,QAAQ,QAAQ,OAAO,OAAO;CAC1C,IAAI,QAAQ,QAAQ,OAAO,QAAQ,UAC/B,MAAM,IAAI,MAAM,6CAA6C,OAAO,KAAK;CAE7E,IAAI,MAAM,QAAQ,GAAG,GACjB,MAAM,IAAI,MAAM,iDAAiD;CAGrE,MAAM,IAAI;CAGV,IAAI,SAAS,KAAK,cAAc,EAAE,MAAM,GAAG,OAAO;CAElD,MAAM,MAA+B,CAAC;CACtC,KAAK,MAAM,CAAC,GAAG,MAAM,OAAO,QAAQ,CAAC,GAAG;EACpC,IAAI,CAAC,UAAU,IAAI,CAAC,GAAG;EACvB,MAAM,aAAa,eAAe,GAAG,CAAC;EACtC,IAAI,eAAe,KAAA,GAAW;EAC9B,IAAI,KAAK;CACb;CAIA,IAAI,IAAI,YAAY,YAAY,EAAE,0BAA0B,MACxD,IAAI,0BAA0B;CAQlC,IAAI,MAAM,QAAQ,IAAI,QAAQ,KAAK,EAAE,mBAAmB,MAAM;EAC1D,MAAM,WAAW,qBAAqB,IAAI,QAA+B;EACzE,IAAI,aAA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AU,IAAI,YAAY,CAAC,CAAC,OAAO,IAAI;CAC7C,IAAI,QAAQ,cAAc,UAAU,OAAO;CAC3C,MAAM,UAAU,IAAI,YAAY;CAChC,IAAI,UAAU,IAAI,YAAY,CAAC,CAAC,OAAO,QAAQ,MAAM,GAAG,QAAQ,CAAC;CACjE,OAAO,QAAQ,OAAO,OAAO,CAAC,CAAC,aAAa,UACxC,UAAU,QAAQ,MAAM,GAAG,EAAE;CAEjC,OAAO;AACX"}
@@ -2,7 +2,7 @@
2
2
  * Copyright (c) Microsoft Corporation. All rights reserved.
3
3
  * Licensed under the MIT License. See License.txt in the project root for license information.
4
4
  *--------------------------------------------------------------------------------------------*/
5
- import { C as defineInterface, N as requestType } from "./boundedTrafficSubscription-1L592xc7.js";
5
+ import { B as requestType, C as defineInterface } from "./boundedTrafficSubscription-XZ1KwXZC.js";
6
6
  import { array, boolean, discriminatedUnion, enum as enum$1, extend, literal, minLength, number, object, optional, record, string, union, unknown } from "zod/mini";
7
7
  //#region src/hub/common/hub.interfaces.ts
8
8
  const zMemberPattern = union([object({ exact: string() }), object({ prefix: string() })]);
@@ -523,4 +523,4 @@ const hubAccessManifestInterface = defineInterface({
523
523
  //#endregion
524
524
  export { hubServiceIdRegistryInterface as i, hubAccessManifestInterface as n, hubGrantedServiceIdInterface as r, hubAccessInterface as t };
525
525
 
526
- //# sourceMappingURL=hub.interfaces-BzWfsVT2.js.map
526
+ //# sourceMappingURL=hub.interfaces-Bf4VfWNX.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"hub.interfaces-BzWfsVT2.js","names":["zEnum"],"sources":["../../src/hub/common/hub.interfaces.ts"],"sourcesContent":["import { array, boolean, discriminatedUnion, enum as zEnum, extend, literal, minLength, number, object, optional, record, string, union, unknown } from 'zod/mini';\nimport { defineInterface, requestType, type InterfaceClient } from '../../index';\n\nconst zMemberPattern = union([\n object({ exact: string() }),\n object({ prefix: string() }),\n]);\n\n/**\n * Optional per-permission invocation preview the requester suggests for\n * \"Allow once\" consent UX. When present, the user can bind the resulting\n * capability to this exact (method, params, interfaceHash) tuple.\n *\n * `nonce` and `signedAtMs` are consumer-chosen and identify the exact call\n * attempt the cap will authorise. The host hashes the same canonical\n * bytes the consumer will sign; the gate re-derives the hash from the\n * inbound call and compares. The consumer MUST use the same\n * nonce+signedAtMs when it actually issues the call (`@hediet/linkrpc`'s\n * {@link JsonRpcChannel.setCapProvider} hook does this automatically).\n *\n * Everything in `params` is shown to the user verbatim.\n */\nconst zCallIntent = object({\n /** Fully-qualified method name the requester intends to call. */\n method: string(),\n /** Exact params the requester intends to send. */\n params: optional(unknown()),\n /** Optional schema hash assertion the call carries inside the signed payload. */\n interfaceHash: optional(string()),\n /** base64url-encoded nonce bytes the consumer will sign with. */\n nonce: string(),\n /** Unix milliseconds the consumer will sign with. */\n signedAtMs: number(),\n /** Optional one-line summary the shell displays next to params. */\n summary: optional(string()),\n /** Requester's preferred default action (`once` if omitted). */\n suggestion: optional(zEnum(['once', 'shortLived', 'longLived', 'persistent'])),\n});\n\nconst zParamMatcher = union([\n object({ exact: unknown() }),\n object({ enum: array(unknown()) }),\n object({ prefix: string() }),\n object({ subsetOf: array(string()) }),\n object({ any: literal(true) }),\n]);\n\nconst zCallBindHash = object({\n alg: literal('sha256'),\n payloadHash: string(),\n});\n\n/** Wire shape of `TargetPattern` from `@hediet/linkrpc`. */\nconst zTargetPattern = object({\n serviceId: zMemberPattern,\n interfaceId: zMemberPattern,\n interfaceHash: optional(string()),\n members: array(zMemberPattern),\n});\n\n/**\n * Wire shape of `Permission` from `@hediet/linkrpc/identity/capability`.\n * Used by `hubAccess::requestAccess` so the consumer can describe exactly\n * what authority it wants — including wildcard service ids\n * (`target.serviceId: { prefix: \"\" }`). `canInvoke`/`canDelegate` default\n * to `false` (fail closed).\n */\nconst zPermission = object({\n target: zTargetPattern,\n canInvoke: optional(boolean()),\n canDelegate: optional(boolean()),\n params: optional(record(string(), zParamMatcher)),\n callBind: optional(zCallBindHash),\n});\n\n/**\n * A `requestAccess` permission carrying the consent-only {@link zCallIntent}\n * preview alongside the authority it requests. The host strips `callIntent`\n * before minting the signed capability.\n */\nconst zRequestPermission = extend(zPermission, {\n callIntent: optional(zCallIntent),\n});\n\n/**\n * Who is asking, plus the `principal` that becomes the minted capability's\n * `audience`/target. The hub uses `principal` directly (it is no longer derived\n * from the call's verified signer): a cap minted for a `principal` is only usable\n * by the holder of that principal's key, enforced at call time\n * (`permits` checks `audience === call.signer`).\n */\nconst zConsumer = object({\n name: string(),\n /** Capability audience/target — the consumer's own PrincipalId. */\n principal: string(),\n origin: optional(string()),\n purpose: optional(string()),\n});\n\n/**\n * Wire shape of `SignedCapability` from `@hediet/linkrpc`. Mirrors the\n * structural type without pulling zod into the identity package. Keep in\n * sync with `Capability` / `SignedCapability` there.\n *\n * A capability is now a flat object (its fields) plus a `$hubrpcSignature`\n * map carrying the issuer's `capability` signature. Delegation links to a\n * single `parentHash` (the parent's `signedHash(\"capability\", ...)`).\n */\nconst zSignedCapability = object({\n issuer: string(),\n audience: string(),\n permissions: array(zPermission),\n expiresAtMs: optional(number()),\n parentHash: optional(string()),\n nonce: string(),\n $hubrpcSignature: object({\n capability: optional(object({ keyId: string(), sig: string() })),\n call: optional(object({ keyId: string(), sig: string() })),\n }),\n});\n\n/** Lifetime hint for a minted capability. Shared across hubAccess + the manifest. */\nconst zDuration = zEnum(['once', 'shortLived', 'longLived', 'persistent']);\n\n// ---- discovery slot shapes (shared by hubAccess.request and hubAccessManifest) ----\n\n/** One interface a slot's chosen service must implement. */\nconst zInterfaceRef = object({\n id: string(),\n hash: optional(string()),\n /** Default true. */\n required: optional(boolean()),\n});\n\n/** One member (method) the consumer intends to call on a slot's interface. */\nconst zMemberRequest = object({\n interfaceId: string(),\n member: zMemberPattern,\n /** Default true. */\n required: optional(boolean()),\n});\n\n/**\n * A consumer's need for ONE service: the interfaces it must speak and the\n * members it intends to call. The discovery side of both `hubAccess::request`\n * (sent as a call param) and `hubAccessManifest` (published as state).\n */\nconst zSlotRequest = object({\n interfaces: array(zInterfaceRef),\n members: optional(array(zMemberRequest)),\n});\n\n/** The resolution of one slot: exactly one chosen service. */\nconst zResolvedSlot = object({\n serviceId: string(),\n satisfiedInterfaces: array(string()),\n});\n\n/**\n * Minimal JSON-document patch op, addressed by an RFC 6901 JSON Pointer.\n * `path: \"\"` targets the whole document; a pointer like `/granted/secretStore`\n * targets one entry. Used by `hubAccessManifest::setCurrent` to replace the\n * entire granted document or a single entry.\n */\nconst zManifestPatch = discriminatedUnion('op', [\n object({ op: literal('set'), path: string(), value: unknown() }),\n object({ op: literal('remove'), path: string() }),\n]);\n\n/**\n * `hubServiceIdRegistry::registerServiceId` — a participant claims a prefix\n * **outside** its provenance-granted namespace.\n *\n * Reached under the hub's own service id (form-3\n * `<hubServiceId>::hubServiceIdRegistry::registerServiceId`) and gated by an\n * admin-rooted capability. For claims **within** the connection's granted\n * namespace, use the cheaper, capability-free `hubGrantedServiceId::register`\n * instead.\n */\nexport const hubServiceIdRegistryInterface = defineInterface(\n {\n id: 'hubServiceIdRegistry',\n description: 'Claim a serviceId prefix on the hub.',\n },\n {\n registerServiceId: requestType(\n object({\n requestedPrefix: string().check(minLength(1)),\n }),\n object({}),\n ),\n },\n);\n\n\n/**\n * `hubGrantedServiceId` — the ungated connection surface, served at the\n * connection root on each participant's overlay (so it is reachable directly,\n * never forwarded, and needs no capability of its own). Two jobs:\n *\n * - `get` (unsigned) reports the topology facts the hub decided for this\n * connection — where it is and what it may claim.\n * - `register` (provenance-gated) claims a prefix **within**\n * this connection's granted namespace — the capability-free claim path.\n * Claims outside the namespace go through the admin-gated\n * `<hubServiceId>::hubServiceIdRegistry::registerServiceId` door instead.\n * - `getHubServiceId` (unsigned) reports the serviceId prefix the hub mounts\n * its own global services under — the prefix to address the admin-gated\n * registry and reflection endpoints through. Served at the connection root\n * so a participant can discover it **before** it knows where the hub lives.\n *\n * The hub's consent front door (`hubAccess::*`) is served at the connection\n * root too, so it needs no bootstrap capability and is reached directly.\n */\nexport const hubGrantedServiceIdInterface = defineInterface(\n {\n id: 'hubGrantedServiceId',\n description: 'Connection facts and capability-free serviceId claims.',\n },\n {\n /**\n * Connection facts (unsigned). The participant pulls, on each\n * (re)connect, the topology facts the hub has decided for this\n * connection:\n *\n * - `grantedServiceIdNamespace` — the absolute serviceId region this\n * connection's provenance may claim (anything at/under it). May be\n * the empty string, meaning \"claim nothing freely\".\n */\n get: requestType(\n object({}),\n object({\n grantedServiceIdNamespace: string(),\n }),\n ),\n\n /**\n * The serviceId prefix the hub mounts its own global services under\n * (default `'hub'`). Use it to address the admin-gated\n * `<hubServiceId>::hubServiceIdRegistry::registerServiceId` door and the\n * hub's reflection endpoints. Served at the connection root (unsigned),\n * so a participant can learn it without first knowing where the hub\n * lives.\n */\n getHubServiceId: requestType(\n object({}),\n object({\n hubServiceId: string(),\n }),\n ),\n\n /**\n * Claim a serviceId prefix **within** this connection's provenance-\n * granted namespace (see `get().grantedServiceIdNamespace`). No\n * capability needed — the grant already happened out-of-band at attach\n * time. The requested `serviceId` must equal the granted namespace or be\n * nested beneath it; anything else is rejected (claim it through the\n * admin-gated `<hubServiceId>::hubServiceIdRegistry::registerServiceId`\n * door instead).\n */\n register: requestType(\n object({ serviceId: string().check(minLength(1)) }),\n object({}),\n ),\n },\n);\n\n/**\n * `hubAccess::request` — a consumer (e.g. a sandboxed web editor) asks the\n * hub for scoped access to one or more services.\n *\n * Consumers describe their needs as named *dependencies* (\"slots\"): each\n * slot lists the interfaces the chosen service must implement and the\n * methods the consumer wants to call. The hub resolves candidate services\n * from its participant directory, then forwards the bundle to a host-\n * supplied handler (see `Hub` options) that shows the user a single\n * prompt. The handler picks a concrete service per slot and approves a\n * subset of the requested methods.\n *\n * In v1 the response carries only the resolution (which serviceId was\n * chosen per slot). Once the hub holds a signing identity it will also\n * return a `SignedCapability` the consumer attaches to subsequent calls.\n * Until then, dispatch is not gated on the grant — see plan-access.md.\n */\nexport const hubAccessInterface = defineInterface(\n {\n id: 'hubAccess',\n description: 'Consumer requests scoped access to services on the hub.',\n },\n {\n request: requestType(\n object({\n consumer: zConsumer,\n dependencies: record(string(), zSlotRequest),\n duration: optional(zDuration),\n }),\n discriminatedUnion('status', [\n object({\n status: literal('granted'),\n slots: record(string(), zResolvedSlot),\n /**\n * One or more `SignedCapability`s issued by the hub\n * (audience = consumer NodeId). Consumers attach them\n * via `$hubrpc.capabilities` on subsequent calls. Empty\n * array is legal (hub with no signing identity / tests).\n *\n * Plural so a handler can return per-slot caps with\n * different `exp`/caveats; typical handlers return a\n * single cap covering every granted member.\n */\n capabilities: array(zSignedCapability),\n }),\n object({\n status: literal('denied'),\n reason: optional(string()),\n }),\n object({\n status: literal('noCandidates'),\n /** Slot ids that have zero matching candidates. */\n slots: array(string()),\n }),\n ]),\n ),\n\n /**\n * Service-pinned widening of an existing grant. The consumer asks\n * the hub for additional members on a `serviceId` they already\n * deal with — same audience (their NodeId) and (intended) same\n * `rootIssuer` as the prior grant. The hub never picks the service\n * for the consumer here: `serviceId` is an input, not a result.\n *\n * On grant the response carries a fresh `SignedCapability` whose\n * attenuations cover **only** the granted delta. Bag-compatible\n * with the prior cap; combine via `merge` (when it exists) or\n * just keep both in `$hubrpc.capabilities`.\n *\n * Distinguished from `request` so the consent UI can render a\n * different affordance (\"X already has read access on `github`,\n * grant `update` as well?\" instead of from-zero selection).\n *\n * TODO(hub-ledger): enforce \"consumer has prior history on this\n * service\" — see `hub.ts:_handleAccessExtend`. v1 forwards\n * directly to the host's `onAccessExtend` without consulting the\n * `_grants` ledger; this is by design while we settle on the\n * persistence model.\n */\n extend: requestType(\n object({\n consumer: zConsumer,\n /**\n * Service to widen the grant on. MUST equal the\n * `serviceId` of a previously-issued attenuation for this\n * consumer NodeId. v1 does not validate this.\n */\n serviceId: string(),\n /**\n * The delta. Same shape as `request`'s slot.members. Each\n * entry MUST refer to an interface the consumer has been\n * introduced to on `serviceId` via a prior `request`.\n */\n added: array(zMemberRequest),\n duration: optional(zDuration),\n }),\n discriminatedUnion('status', [\n object({\n status: literal('granted'),\n serviceId: string(),\n /** Members actually granted (handler may approve a subset). */\n granted: array(\n object({\n interfaceId: string(),\n member: zMemberPattern,\n }),\n ),\n /**\n * Capability covering only the granted delta. Audience\n * = consumer NodeId. Bag-compatible with the prior\n * cap on this service.\n */\n capabilities: optional(array(zSignedCapability)),\n }),\n object({\n status: literal('denied'),\n reason: optional(string()),\n }),\n // TODO(hub-ledger): additional variants once the host's\n // grant ledger is persisted:\n // - { status: \"unknownService\", serviceId }\n // - { status: \"unknownInterface\", serviceId, interfaceIds }\n // Reject without ever prompting the user when the consumer\n // is asking to widen a service it has no prior grant on.\n ]),\n ),\n\n /**\n * `hubAccess::requestAccess` — direct capability request. The\n * consumer specifies the exact attenuations it wants. No\n * service-discovery, no candidate resolution: the consumer\n * already knows which `(serviceId, interfaceId, members)` it\n * needs, including wildcards (e.g. `serviceId: { prefix: \"\" }`\n * to ask for an interface anywhere).\n *\n * Compared to `request`:\n * - `request` does directory-based discovery, picks one service\n * per slot, and returns a cap pinned to that service. Use\n * when the consumer says \"give me SOME service that does X\".\n * - `requestAccess` is verbatim. Use when the consumer says\n * \"give me exactly these attenuations\". Especially useful for\n * reflection (`hubrpc.directory::list` on any service) and\n * for on-demand per-method grants from an explorer-style UI.\n *\n * The user prompt shows the exact `Capability` the hub will sign\n * on Allow, same byte-equality guarantee as `request`/`extend`.\n */\n requestAccess: requestType(\n object({\n consumer: zConsumer,\n permissions: array(zRequestPermission).check(minLength(1)),\n duration: optional(zDuration),\n }),\n discriminatedUnion('status', [\n object({\n status: literal('granted'),\n capabilities: array(zSignedCapability),\n }),\n object({\n status: literal('denied'),\n reason: optional(string()),\n }),\n ]),\n ),\n },\n);\n\n// ════════════════════════════════════════════════════════════════════════\n// hubAccessManifest — the declarative twin of `hubAccess`.\n// ════════════════════════════════════════════════════════════════════════\n\n/**\n * The root issuer(s) whose signature the participant will accept on the minted\n * capability. A capability is only usable by its holder if it chains to a root\n * that the *target* service trusts — and not every service trusts every root.\n * So the participant declares, per entry, which minting root(s) would produce a\n * cap it can actually use; the admin must mint with one of them (or decline).\n *\n * Tri-state, by design:\n * - **omitted** (`undefined`) — unspecified. The participant doesn't know /\n * doesn't constrain the root; the admin picks. (The common, lenient default.)\n * - **non-empty** (`[\"id:abc\", …]`) — mint with one of *these* roots; a cap\n * rooted elsewhere is useless to the participant.\n * - **empty** (`[]`) — \"no root is acceptable\", i.e. nothing can satisfy this.\n * Almost certainly a bug (it can never be granted); kept representable so a\n * tool can detect and flag it rather than silently treating it as \"any\".\n */\nconst zAcceptableRootIds = array(string());\n\n/**\n * A desired access entry the participant publishes. Two kinds, mirroring the\n * two discovery-vs-verbatim halves of `hubAccess`:\n *\n * - `discover` — \"find me a service implementing X\" (same shape as a\n * `hubAccess::request` slot). The admin resolves one concrete service.\n * - `direct` — \"grant exactly these permissions\" (same shape as\n * `hubAccess::requestAccess`). The serviceId is already in each permission's\n * target; no discovery.\n */\nconst zManifestRequest = discriminatedUnion('kind', [\n extend(zSlotRequest, {\n kind: literal('discover'),\n /** Who is asking; `principal` is the audience minted caps must target. */\n consumer: zConsumer,\n /** Human rationale shown to the admin (\"seal tokens at rest\"). */\n reason: optional(string()),\n duration: optional(zDuration),\n /** Root issuer(s) that must mint this cap. See {@link zAcceptableRootIds}. */\n acceptableRootIds: optional(zAcceptableRootIds),\n /**\n * Host-authored provenance bag, stamped at `registerHubAccessAtRoot`\n * (NOT taken from the consumer's request params — so it cannot be\n * spoofed). An open `record<string, unknown>` so a host can attach\n * whatever origin info it observed about the requesting transport (e.g.\n * `{ sourceTransportId }` to route a local consent UI). Meaningful only\n * to a consumer that KNOWS this manifest is local; an aggregating\n * manifest MUST re-scope or omit it.\n */\n origin: optional(record(string(), unknown())),\n }),\n object({\n kind: literal('direct'),\n /** Who is asking; `principal` is the audience minted caps must target. */\n consumer: zConsumer,\n reason: optional(string()),\n permissions: array(zRequestPermission).check(minLength(1)),\n duration: optional(zDuration),\n /** Root issuer(s) that must mint this cap. See {@link zAcceptableRootIds}. */\n acceptableRootIds: optional(zAcceptableRootIds),\n /** Host-authored provenance bag. See the `discover` variant. */\n origin: optional(record(string(), unknown())),\n }),\n]);\n\n/**\n * The current (granted) value of one entry. For `discover` it carries the single\n * chosen service (mirroring `hubAccess::request`'s resolved slot) plus the caps;\n * for `direct` just the caps (the serviceId is in each permission's target).\n */\nconst zGrantedEntry = discriminatedUnion('kind', [\n extend(zResolvedSlot, {\n kind: literal('discover'),\n capabilities: array(zSignedCapability),\n }),\n object({\n kind: literal('direct'),\n capabilities: array(zSignedCapability),\n }),\n]);\n\n/**\n * The current value of one entry: `granted` (caps, plus the chosen service for\n * `discover`) or `denied` (with an optional reason). An entry *absent* from the\n * current document is **undecided** — distinct from a terminal `denied`, which\n * lets an approver say \"no\" (and why) instead of silently withholding.\n */\nconst zCurrentEntry = discriminatedUnion('status', [\n object({ status: literal('granted'), granted: zGrantedEntry }),\n object({ status: literal('denied'), reason: optional(string()) }),\n]);\n\n/**\n * `hubAccessManifest` — the declarative twin of {@link hubAccessInterface}.\n *\n * Where `hubAccess` is the imperative, just-in-time door a consumer *calls* (and\n * the hub serves at the connection root), `hubAccessManifest` is **served by the\n * participant** under its own serviceId, so it appears in `hubrpc.directory::list`\n * — its very presence is the request. A participant publishes its DESIRED access\n * entries (keyed by id, like `request`'s `dependencies`); an admin discovers\n * them via the directory, mints capabilities **with its own identity** (a\n * configured hub capability root), and writes the CURRENT/granted state back via\n * patches. The participant reads the granted entries and attaches the caps to\n * its later calls.\n *\n * Reconcile model (desired vs. current), aligned with the hub's other surfaces:\n * - `getDesired` / `watchDesired` — the participant's declared needs.\n * - `getCurrent` / `setCurrent` / `watchCurrent` — the admin-written grants.\n *\n * `watch*` follows the coarse empty-tick convention of `hubrpc.directory::watch`:\n * a tick means \"re-`get` now\", keeping the server stateless (no per-item deltas).\n */\nexport const hubAccessManifestInterface = defineInterface(\n {\n id: 'hubAccessManifest',\n description:\n 'Participant-served declarative access: publish DESIRED access entries '\n + '(discover | direct), an admin mints capabilities and writes the CURRENT '\n + 'granted state back. The reconcile twin of hubAccess::{request,requestAccess}.',\n },\n {\n // ---- desired (participant-authored; the admin reads) ----------------\n /** The full desired document: who is asking and the entries it wants. */\n getDesired: requestType(\n object({}),\n object({\n /**\n * entryId → desired entry, each carrying its own `consumer`. A\n * per-participant manifest's entries all share one consumer; a hub\n * broker aggregates entries from many consumers in one flat map.\n */\n requested: record(string(), zManifestRequest),\n /** Bumped whenever `requested` changes; lets watchers dedupe ticks. */\n revision: number(),\n }),\n ).withStream({ client: object({}) }),\n /**\n * Coarse change tap on the desired document. Emits an empty tick when\n * `requested` may have changed; the caller re-`getDesired`. Resolves when\n * the caller cancels. Mirrors `hubrpc.directory::watch`.\n */\n watchDesired: requestType(\n object({}),\n object({}),\n ).withStream({ server: object({}) }),\n\n // ---- current / granted (admin-authored; the participant reads) ------\n /** The full current document: entryId → granted/denied (absent ⇒ undecided). */\n getCurrent: requestType(\n object({}),\n object({\n /** entryId → current value (granted | denied). */\n current: record(string(), zCurrentEntry),\n /** Bumped on every successful `setCurrent`. */\n revision: number(),\n }),\n ),\n /**\n * Apply patches to the current document. Replace the whole document with\n * `{ op: 'set', path: '', value }`, or a single entry with\n * `{ op: 'set', path: '/current/<entryId>', value }` (a `zCurrentEntry`:\n * granted or denied). Admin-only in practice (gated by a capability\n * rooted at an accepted issuer).\n */\n setCurrent: requestType(\n object({ patches: array(zManifestPatch) }),\n object({ revision: number() }),\n ).withStream({ client: object({}) }),\n /**\n * Coarse change tap on the current document. Emits an empty tick when\n * `current` may have changed; the participant re-`getCurrent` and applies\n * any new capabilities. Resolves when the caller cancels.\n */\n watchCurrent: requestType(\n object({}),\n object({}),\n ).withStream({ server: object({}) }),\n },\n);\n\n/**\n * The typed client shape of {@link hubAccessManifestInterface} — the exact\n * object `connection.get(hubAccessManifestInterface)` (or\n * `connection.service(id).get(...)`) returns. Approvers depend on this contract,\n * not on a concrete connection: the same approver runs against a local in-memory\n * host (loopback connection), a remote hub's served manifest, or a future\n * aggregating implementation with no code change.\n */\nexport type IHubAccessManifest = InterfaceClient<typeof hubAccessManifestInterface>;\n\n/** One typed entry from `hubAccessManifest::getDesired().requested`. */\nexport type HubAccessManifestRequest =\n Awaited<ReturnType<IHubAccessManifest['getDesired']>>['requested'][string];\n\n/** One typed value accepted at `/current/<entryId>` by `setCurrent`. */\nexport type HubAccessManifestDecision =\n Awaited<ReturnType<IHubAccessManifest['getCurrent']>>['current'][string];\n"],"mappings":";;;;;;;AAGA,MAAM,iBAAiB,MAAM,CACzB,OAAO,EAAE,OAAO,OAAO,EAAE,CAAC,GAC1B,OAAO,EAAE,QAAQ,OAAO,EAAE,CAAC,CAC/B,CAAC;;;;;;;;;;;;;;;AAgBD,MAAM,cAAc,OAAO;;CAEvB,QAAQ,OAAO;;CAEf,QAAQ,SAAS,QAAQ,CAAC;;CAE1B,eAAe,SAAS,OAAO,CAAC;;CAEhC,OAAO,OAAO;;CAEd,YAAY,OAAO;;CAEnB,SAAS,SAAS,OAAO,CAAC;;CAE1B,YAAY,SAASA,OAAM;EAAC;EAAQ;EAAc;EAAa;CAAY,CAAC,CAAC;AACjF,CAAC;AAED,MAAM,gBAAgB,MAAM;CACxB,OAAO,EAAE,OAAO,QAAQ,EAAE,CAAC;CAC3B,OAAO,EAAE,MAAM,MAAM,QAAQ,CAAC,EAAE,CAAC;CACjC,OAAO,EAAE,QAAQ,OAAO,EAAE,CAAC;CAC3B,OAAO,EAAE,UAAU,MAAM,OAAO,CAAC,EAAE,CAAC;CACpC,OAAO,EAAE,KAAK,QAAQ,IAAI,EAAE,CAAC;AACjC,CAAC;AAED,MAAM,gBAAgB,OAAO;CACzB,KAAK,QAAQ,QAAQ;CACrB,aAAa,OAAO;AACxB,CAAC;;AAGD,MAAM,iBAAiB,OAAO;CAC1B,WAAW;CACX,aAAa;CACb,eAAe,SAAS,OAAO,CAAC;CAChC,SAAS,MAAM,cAAc;AACjC,CAAC;;;;;;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AAO,GAAG,aAAa;;EAEvC,UAAU,OAAO;CACrB,CAAC,CACL;;;;;;;;CAQA,YAAY,YACR,OAAO,EAAE,SAAS,MAAM,cAAc,EAAE,CAAC,GACzC,OAAO,EAAE,UAAU,OAAO,EAAE,CAAC,CACjC,CAAC,CAAC,WAAW,EAAE,QAAQ,OAAO,CAAC,CAAC,EAAE,CAAC;;;;;;CAMnC,cAAc,YACV,OAAO,CAAC,CAAC,GACT,OAAO,CAAC,CAAC,CACb,CAAC,CAAC,WAAW,EAAE,QAAQ,OAAO,CAAC,CAAC,EAAE,CAAC;AACvC,CACJ"}
1
+ {"version":3,"file":"hub.interfaces-Bf4VfWNX.js","names":["zEnum"],"sources":["../../src/hub/common/hub.interfaces.ts"],"sourcesContent":["import { array, boolean, discriminatedUnion, enum as zEnum, extend, literal, minLength, number, object, optional, record, string, union, unknown } from 'zod/mini';\nimport { defineInterface, requestType, type InterfaceClient } from '../../index';\n\nconst zMemberPattern = union([\n object({ exact: string() }),\n object({ prefix: string() }),\n]);\n\n/**\n * Optional per-permission invocation preview the requester suggests for\n * \"Allow once\" consent UX. When present, the user can bind the resulting\n * capability to this exact (method, params, interfaceHash) tuple.\n *\n * `nonce` and `signedAtMs` are consumer-chosen and identify the exact call\n * attempt the cap will authorise. The host hashes the same canonical\n * bytes the consumer will sign; the gate re-derives the hash from the\n * inbound call and compares. The consumer MUST use the same\n * nonce+signedAtMs when it actually issues the call (`@hediet/linkrpc`'s\n * {@link JsonRpcChannel.setCapProvider} hook does this automatically).\n *\n * Everything in `params` is shown to the user verbatim.\n */\nconst zCallIntent = object({\n /** Fully-qualified method name the requester intends to call. */\n method: string(),\n /** Exact params the requester intends to send. */\n params: optional(unknown()),\n /** Optional schema hash assertion the call carries inside the signed payload. */\n interfaceHash: optional(string()),\n /** base64url-encoded nonce bytes the consumer will sign with. */\n nonce: string(),\n /** Unix milliseconds the consumer will sign with. */\n signedAtMs: number(),\n /** Optional one-line summary the shell displays next to params. */\n summary: optional(string()),\n /** Requester's preferred default action (`once` if omitted). */\n suggestion: optional(zEnum(['once', 'shortLived', 'longLived', 'persistent'])),\n});\n\nconst zParamMatcher = union([\n object({ exact: unknown() }),\n object({ enum: array(unknown()) }),\n object({ prefix: string() }),\n object({ subsetOf: array(string()) }),\n object({ any: literal(true) }),\n]);\n\nconst zCallBindHash = object({\n alg: literal('sha256'),\n payloadHash: string(),\n});\n\n/** Wire shape of `TargetPattern` from `@hediet/linkrpc`. */\nconst zTargetPattern = object({\n serviceId: zMemberPattern,\n interfaceId: zMemberPattern,\n interfaceHash: optional(string()),\n members: array(zMemberPattern),\n});\n\n/**\n * Wire shape of `Permission` from `@hediet/linkrpc/identity/capability`.\n * Used by `hubAccess::requestAccess` so the consumer can describe exactly\n * what authority it wants — including wildcard service ids\n * (`target.serviceId: { prefix: \"\" }`). `canInvoke`/`canDelegate` default\n * to `false` (fail closed).\n */\nconst zPermission = object({\n target: zTargetPattern,\n canInvoke: optional(boolean()),\n canDelegate: optional(boolean()),\n params: optional(record(string(), zParamMatcher)),\n callBind: optional(zCallBindHash),\n});\n\n/**\n * A `requestAccess` permission carrying the consent-only {@link zCallIntent}\n * preview alongside the authority it requests. The host strips `callIntent`\n * before minting the signed capability.\n */\nconst zRequestPermission = extend(zPermission, {\n callIntent: optional(zCallIntent),\n});\n\n/**\n * Who is asking, plus the `principal` that becomes the minted capability's\n * `audience`/target. The hub uses `principal` directly (it is no longer derived\n * from the call's verified signer): a cap minted for a `principal` is only usable\n * by the holder of that principal's key, enforced at call time\n * (`permits` checks `audience === call.signer`).\n */\nconst zConsumer = object({\n name: string(),\n /** Capability audience/target — the consumer's own PrincipalId. */\n principal: string(),\n origin: optional(string()),\n purpose: optional(string()),\n});\n\n/**\n * Wire shape of `SignedCapability` from `@hediet/linkrpc`. Mirrors the\n * structural type without pulling zod into the identity package. Keep in\n * sync with `Capability` / `SignedCapability` there.\n *\n * A capability is now a flat object (its fields) plus a `$hubrpcSignature`\n * map carrying the issuer's `capability` signature. Delegation links to a\n * single `parentHash` (the parent's `signedHash(\"capability\", ...)`).\n */\nconst zSignedCapability = object({\n issuer: string(),\n audience: string(),\n permissions: array(zPermission),\n expiresAtMs: optional(number()),\n parentHash: optional(string()),\n nonce: string(),\n $hubrpcSignature: object({\n capability: optional(object({ keyId: string(), sig: string() })),\n call: optional(object({ keyId: string(), sig: string() })),\n }),\n});\n\n/** Lifetime hint for a minted capability. Shared across hubAccess + the manifest. */\nconst zDuration = zEnum(['once', 'shortLived', 'longLived', 'persistent']);\n\n// ---- discovery slot shapes (shared by hubAccess.request and hubAccessManifest) ----\n\n/** One interface a slot's chosen service must implement. */\nconst zInterfaceRef = object({\n id: string(),\n hash: optional(string()),\n /** Default true. */\n required: optional(boolean()),\n});\n\n/** One member (method) the consumer intends to call on a slot's interface. */\nconst zMemberRequest = object({\n interfaceId: string(),\n member: zMemberPattern,\n /** Default true. */\n required: optional(boolean()),\n});\n\n/**\n * A consumer's need for ONE service: the interfaces it must speak and the\n * members it intends to call. The discovery side of both `hubAccess::request`\n * (sent as a call param) and `hubAccessManifest` (published as state).\n */\nconst zSlotRequest = object({\n interfaces: array(zInterfaceRef),\n members: optional(array(zMemberRequest)),\n});\n\n/** The resolution of one slot: exactly one chosen service. */\nconst zResolvedSlot = object({\n serviceId: string(),\n satisfiedInterfaces: array(string()),\n});\n\n/**\n * Minimal JSON-document patch op, addressed by an RFC 6901 JSON Pointer.\n * `path: \"\"` targets the whole document; a pointer like `/granted/secretStore`\n * targets one entry. Used by `hubAccessManifest::setCurrent` to replace the\n * entire granted document or a single entry.\n */\nconst zManifestPatch = discriminatedUnion('op', [\n object({ op: literal('set'), path: string(), value: unknown() }),\n object({ op: literal('remove'), path: string() }),\n]);\n\n/**\n * `hubServiceIdRegistry::registerServiceId` — a participant claims a prefix\n * **outside** its provenance-granted namespace.\n *\n * Reached under the hub's own service id (form-3\n * `<hubServiceId>::hubServiceIdRegistry::registerServiceId`) and gated by an\n * admin-rooted capability. For claims **within** the connection's granted\n * namespace, use the cheaper, capability-free `hubGrantedServiceId::register`\n * instead.\n */\nexport const hubServiceIdRegistryInterface = defineInterface(\n {\n id: 'hubServiceIdRegistry',\n description: 'Claim a serviceId prefix on the hub.',\n },\n {\n registerServiceId: requestType(\n object({\n requestedPrefix: string().check(minLength(1)),\n }),\n object({}),\n ),\n },\n);\n\n\n/**\n * `hubGrantedServiceId` — the ungated connection surface, served at the\n * connection root on each participant's overlay (so it is reachable directly,\n * never forwarded, and needs no capability of its own). Two jobs:\n *\n * - `get` (unsigned) reports the topology facts the hub decided for this\n * connection — where it is and what it may claim.\n * - `register` (provenance-gated) claims a prefix **within**\n * this connection's granted namespace — the capability-free claim path.\n * Claims outside the namespace go through the admin-gated\n * `<hubServiceId>::hubServiceIdRegistry::registerServiceId` door instead.\n * - `getHubServiceId` (unsigned) reports the serviceId prefix the hub mounts\n * its own global services under — the prefix to address the admin-gated\n * registry and reflection endpoints through. Served at the connection root\n * so a participant can discover it **before** it knows where the hub lives.\n *\n * The hub's consent front door (`hubAccess::*`) is served at the connection\n * root too, so it needs no bootstrap capability and is reached directly.\n */\nexport const hubGrantedServiceIdInterface = defineInterface(\n {\n id: 'hubGrantedServiceId',\n description: 'Connection facts and capability-free serviceId claims.',\n },\n {\n /**\n * Connection facts (unsigned). The participant pulls, on each\n * (re)connect, the topology facts the hub has decided for this\n * connection:\n *\n * - `grantedServiceIdNamespace` — the absolute serviceId region this\n * connection's provenance may claim (anything at/under it). May be\n * the empty string, meaning \"claim nothing freely\".\n */\n get: requestType(\n object({}),\n object({\n grantedServiceIdNamespace: string(),\n }),\n ),\n\n /**\n * The serviceId prefix the hub mounts its own global services under\n * (default `'hub'`). Use it to address the admin-gated\n * `<hubServiceId>::hubServiceIdRegistry::registerServiceId` door and the\n * hub's reflection endpoints. Served at the connection root (unsigned),\n * so a participant can learn it without first knowing where the hub\n * lives.\n */\n getHubServiceId: requestType(\n object({}),\n object({\n hubServiceId: string(),\n }),\n ),\n\n /**\n * Claim a serviceId prefix **within** this connection's provenance-\n * granted namespace (see `get().grantedServiceIdNamespace`). No\n * capability needed — the grant already happened out-of-band at attach\n * time. The requested `serviceId` must equal the granted namespace or be\n * nested beneath it; anything else is rejected (claim it through the\n * admin-gated `<hubServiceId>::hubServiceIdRegistry::registerServiceId`\n * door instead).\n */\n register: requestType(\n object({ serviceId: string().check(minLength(1)) }),\n object({}),\n ),\n },\n);\n\n/**\n * `hubAccess::request` — a consumer (e.g. a sandboxed web editor) asks the\n * hub for scoped access to one or more services.\n *\n * Consumers describe their needs as named *dependencies* (\"slots\"): each\n * slot lists the interfaces the chosen service must implement and the\n * methods the consumer wants to call. The hub resolves candidate services\n * from its participant directory, then forwards the bundle to a host-\n * supplied handler (see `Hub` options) that shows the user a single\n * prompt. The handler picks a concrete service per slot and approves a\n * subset of the requested methods.\n *\n * In v1 the response carries only the resolution (which serviceId was\n * chosen per slot). Once the hub holds a signing identity it will also\n * return a `SignedCapability` the consumer attaches to subsequent calls.\n * Until then, dispatch is not gated on the grant — see plan-access.md.\n */\nexport const hubAccessInterface = defineInterface(\n {\n id: 'hubAccess',\n description: 'Consumer requests scoped access to services on the hub.',\n },\n {\n request: requestType(\n object({\n consumer: zConsumer,\n dependencies: record(string(), zSlotRequest),\n duration: optional(zDuration),\n }),\n discriminatedUnion('status', [\n object({\n status: literal('granted'),\n slots: record(string(), zResolvedSlot),\n /**\n * One or more `SignedCapability`s issued by the hub\n * (audience = consumer NodeId). Consumers attach them\n * via `$hubrpc.capabilities` on subsequent calls. Empty\n * array is legal (hub with no signing identity / tests).\n *\n * Plural so a handler can return per-slot caps with\n * different `exp`/caveats; typical handlers return a\n * single cap covering every granted member.\n */\n capabilities: array(zSignedCapability),\n }),\n object({\n status: literal('denied'),\n reason: optional(string()),\n }),\n object({\n status: literal('noCandidates'),\n /** Slot ids that have zero matching candidates. */\n slots: array(string()),\n }),\n ]),\n ),\n\n /**\n * Service-pinned widening of an existing grant. The consumer asks\n * the hub for additional members on a `serviceId` they already\n * deal with — same audience (their NodeId) and (intended) same\n * `rootIssuer` as the prior grant. The hub never picks the service\n * for the consumer here: `serviceId` is an input, not a result.\n *\n * On grant the response carries a fresh `SignedCapability` whose\n * attenuations cover **only** the granted delta. Bag-compatible\n * with the prior cap; combine via `merge` (when it exists) or\n * just keep both in `$hubrpc.capabilities`.\n *\n * Distinguished from `request` so the consent UI can render a\n * different affordance (\"X already has read access on `github`,\n * grant `update` as well?\" instead of from-zero selection).\n *\n * TODO(hub-ledger): enforce \"consumer has prior history on this\n * service\" — see `hub.ts:_handleAccessExtend`. v1 forwards\n * directly to the host's `onAccessExtend` without consulting the\n * `_grants` ledger; this is by design while we settle on the\n * persistence model.\n */\n extend: requestType(\n object({\n consumer: zConsumer,\n /**\n * Service to widen the grant on. MUST equal the\n * `serviceId` of a previously-issued attenuation for this\n * consumer NodeId. v1 does not validate this.\n */\n serviceId: string(),\n /**\n * The delta. Same shape as `request`'s slot.members. Each\n * entry MUST refer to an interface the consumer has been\n * introduced to on `serviceId` via a prior `request`.\n */\n added: array(zMemberRequest),\n duration: optional(zDuration),\n }),\n discriminatedUnion('status', [\n object({\n status: literal('granted'),\n serviceId: string(),\n /** Members actually granted (handler may approve a subset). */\n granted: array(\n object({\n interfaceId: string(),\n member: zMemberPattern,\n }),\n ),\n /**\n * Capability covering only the granted delta. Audience\n * = consumer NodeId. Bag-compatible with the prior\n * cap on this service.\n */\n capabilities: optional(array(zSignedCapability)),\n }),\n object({\n status: literal('denied'),\n reason: optional(string()),\n }),\n // TODO(hub-ledger): additional variants once the host's\n // grant ledger is persisted:\n // - { status: \"unknownService\", serviceId }\n // - { status: \"unknownInterface\", serviceId, interfaceIds }\n // Reject without ever prompting the user when the consumer\n // is asking to widen a service it has no prior grant on.\n ]),\n ),\n\n /**\n * `hubAccess::requestAccess` — direct capability request. The\n * consumer specifies the exact attenuations it wants. No\n * service-discovery, no candidate resolution: the consumer\n * already knows which `(serviceId, interfaceId, members)` it\n * needs, including wildcards (e.g. `serviceId: { prefix: \"\" }`\n * to ask for an interface anywhere).\n *\n * Compared to `request`:\n * - `request` does directory-based discovery, picks one service\n * per slot, and returns a cap pinned to that service. Use\n * when the consumer says \"give me SOME service that does X\".\n * - `requestAccess` is verbatim. Use when the consumer says\n * \"give me exactly these attenuations\". Especially useful for\n * reflection (`hubrpc.directory::list` on any service) and\n * for on-demand per-method grants from an explorer-style UI.\n *\n * The user prompt shows the exact `Capability` the hub will sign\n * on Allow, same byte-equality guarantee as `request`/`extend`.\n */\n requestAccess: requestType(\n object({\n consumer: zConsumer,\n permissions: array(zRequestPermission).check(minLength(1)),\n duration: optional(zDuration),\n }),\n discriminatedUnion('status', [\n object({\n status: literal('granted'),\n capabilities: array(zSignedCapability),\n }),\n object({\n status: literal('denied'),\n reason: optional(string()),\n }),\n ]),\n ),\n },\n);\n\n// ════════════════════════════════════════════════════════════════════════\n// hubAccessManifest — the declarative twin of `hubAccess`.\n// ════════════════════════════════════════════════════════════════════════\n\n/**\n * The root issuer(s) whose signature the participant will accept on the minted\n * capability. A capability is only usable by its holder if it chains to a root\n * that the *target* service trusts — and not every service trusts every root.\n * So the participant declares, per entry, which minting root(s) would produce a\n * cap it can actually use; the admin must mint with one of them (or decline).\n *\n * Tri-state, by design:\n * - **omitted** (`undefined`) — unspecified. The participant doesn't know /\n * doesn't constrain the root; the admin picks. (The common, lenient default.)\n * - **non-empty** (`[\"id:abc\", …]`) — mint with one of *these* roots; a cap\n * rooted elsewhere is useless to the participant.\n * - **empty** (`[]`) — \"no root is acceptable\", i.e. nothing can satisfy this.\n * Almost certainly a bug (it can never be granted); kept representable so a\n * tool can detect and flag it rather than silently treating it as \"any\".\n */\nconst zAcceptableRootIds = array(string());\n\n/**\n * A desired access entry the participant publishes. Two kinds, mirroring the\n * two discovery-vs-verbatim halves of `hubAccess`:\n *\n * - `discover` — \"find me a service implementing X\" (same shape as a\n * `hubAccess::request` slot). The admin resolves one concrete service.\n * - `direct` — \"grant exactly these permissions\" (same shape as\n * `hubAccess::requestAccess`). The serviceId is already in each permission's\n * target; no discovery.\n */\nconst zManifestRequest = discriminatedUnion('kind', [\n extend(zSlotRequest, {\n kind: literal('discover'),\n /** Who is asking; `principal` is the audience minted caps must target. */\n consumer: zConsumer,\n /** Human rationale shown to the admin (\"seal tokens at rest\"). */\n reason: optional(string()),\n duration: optional(zDuration),\n /** Root issuer(s) that must mint this cap. See {@link zAcceptableRootIds}. */\n acceptableRootIds: optional(zAcceptableRootIds),\n /**\n * Host-authored provenance bag, stamped at `registerHubAccessAtRoot`\n * (NOT taken from the consumer's request params — so it cannot be\n * spoofed). An open `record<string, unknown>` so a host can attach\n * whatever origin info it observed about the requesting transport (e.g.\n * `{ sourceTransportId }` to route a local consent UI). Meaningful only\n * to a consumer that KNOWS this manifest is local; an aggregating\n * manifest MUST re-scope or omit it.\n */\n origin: optional(record(string(), unknown())),\n }),\n object({\n kind: literal('direct'),\n /** Who is asking; `principal` is the audience minted caps must target. */\n consumer: zConsumer,\n reason: optional(string()),\n permissions: array(zRequestPermission).check(minLength(1)),\n duration: optional(zDuration),\n /** Root issuer(s) that must mint this cap. See {@link zAcceptableRootIds}. */\n acceptableRootIds: optional(zAcceptableRootIds),\n /** Host-authored provenance bag. See the `discover` variant. */\n origin: optional(record(string(), unknown())),\n }),\n]);\n\n/**\n * The current (granted) value of one entry. For `discover` it carries the single\n * chosen service (mirroring `hubAccess::request`'s resolved slot) plus the caps;\n * for `direct` just the caps (the serviceId is in each permission's target).\n */\nconst zGrantedEntry = discriminatedUnion('kind', [\n extend(zResolvedSlot, {\n kind: literal('discover'),\n capabilities: array(zSignedCapability),\n }),\n object({\n kind: literal('direct'),\n capabilities: array(zSignedCapability),\n }),\n]);\n\n/**\n * The current value of one entry: `granted` (caps, plus the chosen service for\n * `discover`) or `denied` (with an optional reason). An entry *absent* from the\n * current document is **undecided** — distinct from a terminal `denied`, which\n * lets an approver say \"no\" (and why) instead of silently withholding.\n */\nconst zCurrentEntry = discriminatedUnion('status', [\n object({ status: literal('granted'), granted: zGrantedEntry }),\n object({ status: literal('denied'), reason: optional(string()) }),\n]);\n\n/**\n * `hubAccessManifest` — the declarative twin of {@link hubAccessInterface}.\n *\n * Where `hubAccess` is the imperative, just-in-time door a consumer *calls* (and\n * the hub serves at the connection root), `hubAccessManifest` is **served by the\n * participant** under its own serviceId, so it appears in `hubrpc.directory::list`\n * — its very presence is the request. A participant publishes its DESIRED access\n * entries (keyed by id, like `request`'s `dependencies`); an admin discovers\n * them via the directory, mints capabilities **with its own identity** (a\n * configured hub capability root), and writes the CURRENT/granted state back via\n * patches. The participant reads the granted entries and attaches the caps to\n * its later calls.\n *\n * Reconcile model (desired vs. current), aligned with the hub's other surfaces:\n * - `getDesired` / `watchDesired` — the participant's declared needs.\n * - `getCurrent` / `setCurrent` / `watchCurrent` — the admin-written grants.\n *\n * `watch*` follows the coarse empty-tick convention of `hubrpc.directory::watch`:\n * a tick means \"re-`get` now\", keeping the server stateless (no per-item deltas).\n */\nexport const hubAccessManifestInterface = defineInterface(\n {\n id: 'hubAccessManifest',\n description:\n 'Participant-served declarative access: publish DESIRED access entries '\n + '(discover | direct), an admin mints capabilities and writes the CURRENT '\n + 'granted state back. The reconcile twin of hubAccess::{request,requestAccess}.',\n },\n {\n // ---- desired (participant-authored; the admin reads) ----------------\n /** The full desired document: who is asking and the entries it wants. */\n getDesired: requestType(\n object({}),\n object({\n /**\n * entryId → desired entry, each carrying its own `consumer`. A\n * per-participant manifest's entries all share one consumer; a hub\n * broker aggregates entries from many consumers in one flat map.\n */\n requested: record(string(), zManifestRequest),\n /** Bumped whenever `requested` changes; lets watchers dedupe ticks. */\n revision: number(),\n }),\n ).withStream({ client: object({}) }),\n /**\n * Coarse change tap on the desired document. Emits an empty tick when\n * `requested` may have changed; the caller re-`getDesired`. Resolves when\n * the caller cancels. Mirrors `hubrpc.directory::watch`.\n */\n watchDesired: requestType(\n object({}),\n object({}),\n ).withStream({ server: object({}) }),\n\n // ---- current / granted (admin-authored; the participant reads) ------\n /** The full current document: entryId → granted/denied (absent ⇒ undecided). */\n getCurrent: requestType(\n object({}),\n object({\n /** entryId → current value (granted | denied). */\n current: record(string(), zCurrentEntry),\n /** Bumped on every successful `setCurrent`. */\n revision: number(),\n }),\n ),\n /**\n * Apply patches to the current document. Replace the whole document with\n * `{ op: 'set', path: '', value }`, or a single entry with\n * `{ op: 'set', path: '/current/<entryId>', value }` (a `zCurrentEntry`:\n * granted or denied). Admin-only in practice (gated by a capability\n * rooted at an accepted issuer).\n */\n setCurrent: requestType(\n object({ patches: array(zManifestPatch) }),\n object({ revision: number() }),\n ).withStream({ client: object({}) }),\n /**\n * Coarse change tap on the current document. Emits an empty tick when\n * `current` may have changed; the participant re-`getCurrent` and applies\n * any new capabilities. Resolves when the caller cancels.\n */\n watchCurrent: requestType(\n object({}),\n object({}),\n ).withStream({ server: object({}) }),\n },\n);\n\n/**\n * The typed client shape of {@link hubAccessManifestInterface} — the exact\n * object `connection.get(hubAccessManifestInterface)` (or\n * `connection.service(id).get(...)`) returns. Approvers depend on this contract,\n * not on a concrete connection: the same approver runs against a local in-memory\n * host (loopback connection), a remote hub's served manifest, or a future\n * aggregating implementation with no code change.\n */\nexport type IHubAccessManifest = InterfaceClient<typeof hubAccessManifestInterface>;\n\n/** One typed entry from `hubAccessManifest::getDesired().requested`. */\nexport type HubAccessManifestRequest =\n Awaited<ReturnType<IHubAccessManifest['getDesired']>>['requested'][string];\n\n/** One typed value accepted at `/current/<entryId>` by `setCurrent`. */\nexport type HubAccessManifestDecision =\n Awaited<ReturnType<IHubAccessManifest['getCurrent']>>['current'][string];\n"],"mappings":";;;;;;;AAGA,MAAM,iBAAiB,MAAM,CACzB,OAAO,EAAE,OAAO,OAAO,EAAE,CAAC,GAC1B,OAAO,EAAE,QAAQ,OAAO,EAAE,CAAC,CAC/B,CAAC;;;;;;;;;;;;;;;AAgBD,MAAM,cAAc,OAAO;;CAEvB,QAAQ,OAAO;;CAEf,QAAQ,SAAS,QAAQ,CAAC;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;;;;;;AAQD,MAAM,gBAAgB,mBAAmB,UAAU,CAC/C,OAAO;CAAE,QAAQ,QAAQ,SAAS;CAAG,SAAS;AAAc,CAAC,GAC7D,OAAO;CAAE,QAAQ,QAAQ,QAAQ;CAAG,QAAQ,SAAS,OAAO,CAAC;AAAE,CAAC,CACpE,CAAC;;;;;;;;;;;;;;;;;;;;;AAsBD,MAAa,6BAA6B,gBACtC;CACI,IAAI;CACJ,aACI;AAGR,GACA;;CAGI,YAAY,YACR,OAAO,CAAC,CAAC,GACT,OAAO;;;;;;EAMH,WAAW,OAAO,OAAO,GAAG,gBAAgB;;EAE5C,UAAU,OAAO;CACrB,CAAC,CACL,CAAC,CAAC,WAAW,EAAE,QAAQ,OAAO,CAAC,CAAC,EAAE,CAAC;;;;;;CAMnC,cAAc,YACV,OAAO,CAAC,CAAC,GACT,OAAO,CAAC,CAAC,CACb,CAAC,CAAC,WAAW,EAAE,QAAQ,OAAO,CAAC,CAAC,EAAE,CAAC;;CAInC,YAAY,YACR,OAAO,CAAC,CAAC,GACT,OAAO;;EAEH,SAAS,OAAO,OAAO,GAAG,aAAa;;EAEvC,UAAU,OAAO;CACrB,CAAC,CACL;;;;;;;;CAQA,YAAY,YACR,OAAO,EAAE,SAAS,MAAM,cAAc,EAAE,CAAC,GACzC,OAAO,EAAE,UAAU,OAAO,EAAE,CAAC,CACjC,CAAC,CAAC,WAAW,EAAE,QAAQ,OAAO,CAAC,CAAC,EAAE,CAAC;;;;;;CAMnC,cAAc,YACV,OAAO,CAAC,CAAC,GACT,OAAO,CAAC,CAAC,CACb,CAAC,CAAC,WAAW,EAAE,QAAQ,OAAO,CAAC,CAAC,EAAE,CAAC;AACvC,CACJ"}
@@ -2,7 +2,7 @@
2
2
  * Copyright (c) Microsoft Corporation. All rights reserved.
3
3
  * Licensed under the MIT License. See License.txt in the project root for license information.
4
4
  *--------------------------------------------------------------------------------------------*/
5
- import { Pn as SignedCapability } from "./linkRpcConnection-CtlQmetO.js";
5
+ import { Pn as SignedCapability } from "./linkRpcConnection-BadD37ok.js";
6
6
  //#region src/hub/common/hubAccess.d.ts
7
7
  /**
8
8
  * The client-facing wire shapes of the hub's capability-negotiation protocol
@@ -76,4 +76,4 @@ declare function findCoveringCapabilities(capabilities: readonly SignedCapabilit
76
76
  }): readonly SignedCapability[] | undefined;
77
77
  //#endregion
78
78
  export { HubAccessResult as a, HubAccessRequest as i, HubAccessPattern as n, findCoveringCapabilities as o, HubAccessPermission as r, HubAccessDuration as t };
79
- //# sourceMappingURL=hubAccess-DwTZPiI8.d.ts.map
79
+ //# sourceMappingURL=hubAccess-C06qAKao.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"hubAccess-DwTZPiI8.d.ts","names":[],"sources":["../../src/hub/common/hubAccess.ts"],"mappings":";;;;;;;;;;;;;KAqBY;;KAGA;WAA8B;;WAA8B;;;UAGvD;WACJ;aACI,WAAW;aACX,aAAa;aACb;aACA,kBAAkB;;;WAGtB;;WAEA;WACA,SAAS;;;UAIL;WACJ;aAAqB;aAAuB;aAA0B;;;WAEtE,sBAAsB;;WAEtB,WAAW;;;;;;;KAQZ;WAEK;;WAEA,uBAAuB;;WAEvB;;WAEA;WAA2B;;WAC3B;WAAyB;;;;;;;;;;iBAU1B,yBACZ,uBAAuB,oBACvB,oBAAoB,uBACpB;WACa;WACA;aAEL"}
1
+ {"version":3,"file":"hubAccess-C06qAKao.d.ts","names":[],"sources":["../../src/hub/common/hubAccess.ts"],"mappings":";;;;;;;;;;;;;KAqBY;;KAGA;WAA8B;;WAA8B;;;UAGvD;WACJ;aACI,WAAW;aACX,aAAa;aACb;aACA,kBAAkB;;;WAGtB;;WAEA;WACA,SAAS;;;UAIL;WACJ;aAAqB;aAAuB;aAA0B;;;WAEtE,sBAAsB;;WAEtB,WAAW;;;;;;;KAQZ;WAEK;;WAEA,uBAAuB;;WAEvB;;WAEA;WAA2B;;WAC3B;WAAyB;;;;;;;;;;iBAU1B,yBACZ,uBAAuB,oBACvB,oBAAoB,uBACpB;WACa;WACA;aAEL"}
@@ -2,7 +2,7 @@
2
2
  * Copyright (c) Microsoft Corporation. All rights reserved.
3
3
  * Licensed under the MIT License. See License.txt in the project root for license information.
4
4
  *--------------------------------------------------------------------------------------------*/
5
- import { r as hubGrantedServiceIdInterface } from "./hub.interfaces-BzWfsVT2.js";
5
+ import { r as hubGrantedServiceIdInterface } from "./hub.interfaces-Bf4VfWNX.js";
6
6
  //#region src/hub/client/hubFacade.ts
7
7
  /**
8
8
  * Thin façade over the hub's own serviceId-routed services
@@ -82,4 +82,4 @@ function hubFromConnection(connection) {
82
82
  //#endregion
83
83
  export { hubFromConnection as n, Hub as t };
84
84
 
85
- //# sourceMappingURL=hubFacade-CQflVkVC.js.map
85
+ //# sourceMappingURL=hubFacade-BIB9CoAv.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"hubFacade-CQflVkVC.js","names":[],"sources":["../../src/hub/client/hubFacade.ts"],"sourcesContent":["import type { LinkRpcConnection } from '../../connection/linkRpcConnection';\nimport { hubGrantedServiceIdInterface } from '../common/hub.interfaces';\n\n/**\n * Description of the services a consumer will need, presented to the user\n * up-front so access can be approved before the first call. Each named\n * *dependency* (\"slot\") lists the interfaces the chosen service must\n * implement and the members the consumer intends to call.\n */\nexport interface SlotPrerequest {\n readonly consumer: { readonly name: string; readonly purpose: string; };\n readonly dependencies: Readonly<\n Record<string, {\n readonly interfaces: readonly { readonly id: string; }[];\n readonly members: readonly {\n readonly interfaceId: string;\n readonly member: { readonly exact: string; };\n }[];\n }>\n >;\n}\n\n/** Handle for a set of slots reserved via {@link Hub.prerequestSlots}. */\nexport interface SlotReservation {\n /** Resolve the reserved slots into connected service clients. */\n resolve(): Promise<never>;\n}\n\n/**\n * Thin façade over the hub's own serviceId-routed services\n * (`hubGrantedServiceId`, `hubAccess`, …). The hub is not a single object on\n * the wire — it is a set of services the connection can `get`. This groups the\n * common connection calls so callers don't hand-route interface clients.\n */\nexport class Hub {\n constructor(private readonly _connection: LinkRpcConnection) { }\n\n /** `hubGrantedServiceId::get` — where am I and which serviceId namespace may I claim. */\n public getConnectionInfo() {\n return this._connection.get(hubGrantedServiceIdInterface).get({});\n }\n\n /**\n * Reserve the slots a consumer will need so the user can approve them\n * ahead of the first call. NOT YET IMPLEMENTED by the hub — the\n * returned reservation throws on {@link SlotReservation.resolve}.\n */\n public prerequestSlots(_request: SlotPrerequest): SlotReservation {\n return {\n resolve: async (): Promise<never> => {\n throw new Error('not implemented: hub.prerequestSlots / slot resolution');\n },\n };\n }\n\n /**\n * Claim a serviceId namespace for this connection so it may register\n * services under it, via `hubGrantedServiceId::register`.\n *\n * The claim is auto-granted from the connection's provenance when\n * `serviceIdNamespace` is at/under the connection's\n * `grantedServiceIdNamespace` (see {@link getConnectionInfo}) — no\n * signature or capability needed. Claims **outside** the granted namespace\n * are rejected here; route those through the admin-gated\n * `<hubServiceId>::hubServiceIdRegistry::registerServiceId` door instead.\n *\n * Resolves once the namespace is owned by this connection (idempotent for\n * a namespace this connection already owns). Rejects when the hub denies\n * the claim — e.g. the namespace is owned by another identity, or the\n * caller lacks admin authority outside its granted namespace.\n *\n * `requestPermissionIfDenied` is a hint for the future interactive\n * admin-approval flow; the hub does not yet expose one, so denial always\n * surfaces as a rejection regardless of the flag.\n */\n public async registerServiceIdNamespace(\n serviceIdNamespace: string,\n _opts?: { readonly requestPermissionIfDenied?: boolean; },\n ): Promise<void> {\n await this._connection\n .get(hubGrantedServiceIdInterface)\n .register({ serviceId: serviceIdNamespace });\n }\n\n /**\n * Claim this connection's provenance-granted serviceId namespace in one\n * step: read `grantedServiceIdNamespace` via {@link getConnectionInfo},\n * then {@link registerServiceIdNamespace} it, returning the claimed\n * `serviceId` so the caller can mount services under it.\n *\n * This is the batteries-included version of the\n * `hubGrantedServiceId::get` → `hubGrantedServiceId::register` dance a\n * service-exposing participant performs right after connecting.\n *\n * Throws when the hub granted this connection no namespace (an empty\n * `grantedServiceIdNamespace`, meaning \"claim nothing freely\") — there is\n * nothing to register, and any service prefix would have to be claimed\n * through the admin-gated\n * `<hubServiceId>::hubServiceIdRegistry::registerServiceId` door instead.\n */\n public async claimGrantedServiceIdNamespace(): Promise<{ readonly serviceId: string; }> {\n const { grantedServiceIdNamespace } = await this.getConnectionInfo();\n if (!grantedServiceIdNamespace) {\n throw new Error(\n 'hubGrantedServiceId::get returned an empty granted namespace; ' +\n 'nothing to claim (register a prefix through the admin-gated ' +\n 'hubServiceIdRegistry::registerServiceId door instead)',\n );\n }\n await this.registerServiceIdNamespace(grantedServiceIdNamespace);\n return { serviceId: grantedServiceIdNamespace };\n }\n}\n\n/** Wrap a connection in a {@link Hub} façade. */\nexport function hubFromConnection(connection: LinkRpcConnection): Hub {\n return new Hub(connection);\n}\n"],"mappings":";;;;;;;;;;;;AAkCA,IAAa,MAAb,MAAiB;CACgB;CAA7B,YAAY,aAAiD;EAAhC,KAAA,cAAA;CAAkC;;CAG/D,oBAA2B;EACvB,OAAO,KAAK,YAAY,IAAI,4BAA4B,CAAC,CAAC,IAAI,CAAC,CAAC;CACpE;;;;;;CAOA,gBAAuB,UAA2C;EAC9D,OAAO,EACH,SAAS,YAA4B;GACjC,MAAM,IAAI,MAAM,wDAAwD;EAC5E,EACJ;CACJ;;;;;;;;;;;;;;;;;;;;;CAsBA,MAAa,2BACT,oBACA,OACa;EACb,MAAM,KAAK,YACN,IAAI,4BAA4B,CAAC,CACjC,SAAS,EAAE,WAAW,mBAAmB,CAAC;CACnD;;;;;;;;;;;;;;;;;CAkBA,MAAa,iCAA2E;EACpF,MAAM,EAAE,8BAA8B,MAAM,KAAK,kBAAkB;EACnE,IAAI,CAAC,2BACD,MAAM,IAAI,MACN,iLAGJ;EAEJ,MAAM,KAAK,2BAA2B,yBAAyB;EAC/D,OAAO,EAAE,WAAW,0BAA0B;CAClD;AACJ;;AAGA,SAAgB,kBAAkB,YAAoC;CAClE,OAAO,IAAI,IAAI,UAAU;AAC7B"}
1
+ {"version":3,"file":"hubFacade-BIB9CoAv.js","names":[],"sources":["../../src/hub/client/hubFacade.ts"],"sourcesContent":["import type { LinkRpcConnection } from '../../connection/linkRpcConnection';\nimport { hubGrantedServiceIdInterface } from '../common/hub.interfaces';\n\n/**\n * Description of the services a consumer will need, presented to the user\n * up-front so access can be approved before the first call. Each named\n * *dependency* (\"slot\") lists the interfaces the chosen service must\n * implement and the members the consumer intends to call.\n */\nexport interface SlotPrerequest {\n readonly consumer: { readonly name: string; readonly purpose: string; };\n readonly dependencies: Readonly<\n Record<string, {\n readonly interfaces: readonly { readonly id: string; }[];\n readonly members: readonly {\n readonly interfaceId: string;\n readonly member: { readonly exact: string; };\n }[];\n }>\n >;\n}\n\n/** Handle for a set of slots reserved via {@link Hub.prerequestSlots}. */\nexport interface SlotReservation {\n /** Resolve the reserved slots into connected service clients. */\n resolve(): Promise<never>;\n}\n\n/**\n * Thin façade over the hub's own serviceId-routed services\n * (`hubGrantedServiceId`, `hubAccess`, …). The hub is not a single object on\n * the wire — it is a set of services the connection can `get`. This groups the\n * common connection calls so callers don't hand-route interface clients.\n */\nexport class Hub {\n constructor(private readonly _connection: LinkRpcConnection) { }\n\n /** `hubGrantedServiceId::get` — where am I and which serviceId namespace may I claim. */\n public getConnectionInfo() {\n return this._connection.get(hubGrantedServiceIdInterface).get({});\n }\n\n /**\n * Reserve the slots a consumer will need so the user can approve them\n * ahead of the first call. NOT YET IMPLEMENTED by the hub — the\n * returned reservation throws on {@link SlotReservation.resolve}.\n */\n public prerequestSlots(_request: SlotPrerequest): SlotReservation {\n return {\n resolve: async (): Promise<never> => {\n throw new Error('not implemented: hub.prerequestSlots / slot resolution');\n },\n };\n }\n\n /**\n * Claim a serviceId namespace for this connection so it may register\n * services under it, via `hubGrantedServiceId::register`.\n *\n * The claim is auto-granted from the connection's provenance when\n * `serviceIdNamespace` is at/under the connection's\n * `grantedServiceIdNamespace` (see {@link getConnectionInfo}) — no\n * signature or capability needed. Claims **outside** the granted namespace\n * are rejected here; route those through the admin-gated\n * `<hubServiceId>::hubServiceIdRegistry::registerServiceId` door instead.\n *\n * Resolves once the namespace is owned by this connection (idempotent for\n * a namespace this connection already owns). Rejects when the hub denies\n * the claim — e.g. the namespace is owned by another identity, or the\n * caller lacks admin authority outside its granted namespace.\n *\n * `requestPermissionIfDenied` is a hint for the future interactive\n * admin-approval flow; the hub does not yet expose one, so denial always\n * surfaces as a rejection regardless of the flag.\n */\n public async registerServiceIdNamespace(\n serviceIdNamespace: string,\n _opts?: { readonly requestPermissionIfDenied?: boolean; },\n ): Promise<void> {\n await this._connection\n .get(hubGrantedServiceIdInterface)\n .register({ serviceId: serviceIdNamespace });\n }\n\n /**\n * Claim this connection's provenance-granted serviceId namespace in one\n * step: read `grantedServiceIdNamespace` via {@link getConnectionInfo},\n * then {@link registerServiceIdNamespace} it, returning the claimed\n * `serviceId` so the caller can mount services under it.\n *\n * This is the batteries-included version of the\n * `hubGrantedServiceId::get` → `hubGrantedServiceId::register` dance a\n * service-exposing participant performs right after connecting.\n *\n * Throws when the hub granted this connection no namespace (an empty\n * `grantedServiceIdNamespace`, meaning \"claim nothing freely\") — there is\n * nothing to register, and any service prefix would have to be claimed\n * through the admin-gated\n * `<hubServiceId>::hubServiceIdRegistry::registerServiceId` door instead.\n */\n public async claimGrantedServiceIdNamespace(): Promise<{ readonly serviceId: string; }> {\n const { grantedServiceIdNamespace } = await this.getConnectionInfo();\n if (!grantedServiceIdNamespace) {\n throw new Error(\n 'hubGrantedServiceId::get returned an empty granted namespace; ' +\n 'nothing to claim (register a prefix through the admin-gated ' +\n 'hubServiceIdRegistry::registerServiceId door instead)',\n );\n }\n await this.registerServiceIdNamespace(grantedServiceIdNamespace);\n return { serviceId: grantedServiceIdNamespace };\n }\n}\n\n/** Wrap a connection in a {@link Hub} façade. */\nexport function hubFromConnection(connection: LinkRpcConnection): Hub {\n return new Hub(connection);\n}\n"],"mappings":";;;;;;;;;;;;AAkCA,IAAa,MAAb,MAAiB;CACgB;CAA7B,YAAY,aAAiD;EAAhC,KAAA,cAAA;CAAkC;;CAG/D,oBAA2B;EACvB,OAAO,KAAK,YAAY,IAAI,4BAA4B,CAAC,CAAC,IAAI,CAAC,CAAC;CACpE;;;;;;CAOA,gBAAuB,UAA2C;EAC9D,OAAO,EACH,SAAS,YAA4B;GACjC,MAAM,IAAI,MAAM,wDAAwD;EAC5E,EACJ;CACJ;;;;;;;;;;;;;;;;;;;;;CAsBA,MAAa,2BACT,oBACA,OACa;EACb,MAAM,KAAK,YACN,IAAI,4BAA4B,CAAC,CACjC,SAAS,EAAE,WAAW,mBAAmB,CAAC;CACnD;;;;;;;;;;;;;;;;;CAkBA,MAAa,iCAA2E;EACpF,MAAM,EAAE,8BAA8B,MAAM,KAAK,kBAAkB;EACnE,IAAI,CAAC,2BACD,MAAM,IAAI,MACN,iLAGJ;EAEJ,MAAM,KAAK,2BAA2B,yBAAyB;EAC/D,OAAO,EAAE,WAAW,0BAA0B;CAClD;AACJ;;AAGA,SAAgB,kBAAkB,YAAoC;CAClE,OAAO,IAAI,IAAI,UAAU;AAC7B"}
@@ -2,7 +2,7 @@
2
2
  * Copyright (c) Microsoft Corporation. All rights reserved.
3
3
  * Licensed under the MIT License. See License.txt in the project root for license information.
4
4
  *--------------------------------------------------------------------------------------------*/
5
- import { a as LinkRpcConnection } from "./linkRpcConnection-CtlQmetO.js";
5
+ import { a as LinkRpcConnection } from "./linkRpcConnection-BadD37ok.js";
6
6
  //#region src/hub/client/hubFacade.d.ts
7
7
  /**
8
8
  * Description of the services a consumer will need, presented to the user
@@ -98,4 +98,4 @@ declare class Hub {
98
98
  declare function hubFromConnection(connection: LinkRpcConnection): Hub;
99
99
  //#endregion
100
100
  export { hubFromConnection as i, SlotPrerequest as n, SlotReservation as r, Hub as t };
101
- //# sourceMappingURL=hubFacade-Dkgw2pTi.d.ts.map
101
+ //# sourceMappingURL=hubFacade-DtQpGpUy.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"hubFacade-Dkgw2pTi.d.ts","names":[],"sources":["../../src/hub/client/hubFacade.ts"],"mappings":";;;;;;;;;;;;UASiB;WACJ;aAAqB;aAAuB;;WAC5C,cAAc,SACnB;aACa;eAAgC;;aAChC;eACI;eACA;iBAAmB;;;;;;UAO3B;;EAEb,WAAW;;;;;;;;cASF;mBACoB;EAAA,YAAA,aAAa;;EAGnC,qBAAiB;;;;;;;;EASjB,gBAAgB,UAAU,iBAAiB;;;;;;;;;;;;;;;;;;;;;EA4BrC,2BACT,4BACA;aAAmB;MACpB;;;;;;;;;;;;;;;;;EAsBU,kCAAkC;aAAmB;;;;iBAetD,kBAAkB,YAAY,oBAAoB"}
1
+ {"version":3,"file":"hubFacade-DtQpGpUy.d.ts","names":[],"sources":["../../src/hub/client/hubFacade.ts"],"mappings":";;;;;;;;;;;;UASiB;WACJ;aAAqB;aAAuB;;WAC5C,cAAc,SACnB;aACa;eAAgC;;aAChC;eACI;eACA;iBAAmB;;;;;;UAO3B;;EAEb,WAAW;;;;;;;;cASF;mBACoB;EAAA,YAAA,aAAa;;EAGnC,qBAAiB;;;;;;;;EASjB,gBAAgB,UAAU,iBAAiB;;;;;;;;;;;;;;;;;;;;;EA4BrC,2BACT,4BACA;aAAmB;MACpB;;;;;;;;;;;;;;;;;EAsBU,kCAAkC;aAAmB;;;;iBAetD,kBAAkB,YAAY,oBAAoB"}