diff options
Diffstat (limited to 'packages/surface-registry/src')
| -rw-r--r-- | packages/surface-registry/src/index.ts | 2 | ||||
| -rw-r--r-- | packages/surface-registry/src/registry.ts | 13 |
2 files changed, 12 insertions, 3 deletions
diff --git a/packages/surface-registry/src/index.ts b/packages/surface-registry/src/index.ts index cdfcf7e..da52c92 100644 --- a/packages/surface-registry/src/index.ts +++ b/packages/surface-registry/src/index.ts @@ -1,4 +1,4 @@ export { createSurfaceRegistryExtension, manifest } from "./extension.js"; -export type { SurfaceProvider, SurfaceRegistry } from "./registry.js"; +export type { SurfaceContext, SurfaceProvider, SurfaceRegistry } from "./registry.js"; export { createSurfaceRegistry } from "./registry.js"; export { surfaceRegistryHandle } from "./service.js"; diff --git a/packages/surface-registry/src/registry.ts b/packages/surface-registry/src/registry.ts index b1c8116..5780910 100644 --- a/packages/surface-registry/src/registry.ts +++ b/packages/surface-registry/src/registry.ts @@ -1,6 +1,15 @@ import type { SurfaceCatalog, SurfaceCatalogEntry, SurfaceSpec } from "@dispatch/ui-contract"; /** + * Optional context threaded by the transport when calling a surface provider. + * Providers may use this to scope per-conversation state; omitting it yields + * the default/global behaviour. + */ +export interface SurfaceContext { + readonly conversationId?: string; +} + +/** * What a surface-contributing extension registers with the surface registry. * Each provider owns one surface identified by its catalog entry id. */ @@ -9,10 +18,10 @@ export interface SurfaceProvider { readonly catalogEntry: SurfaceCatalogEntry; /** Build the current surface spec (may be async for dynamic surfaces). */ - getSpec(): SurfaceSpec | Promise<SurfaceSpec>; + getSpec(context?: SurfaceContext): SurfaceSpec | Promise<SurfaceSpec>; /** Run a backend action by id with an optional payload. */ - invoke(actionId: string, payload?: unknown): void | Promise<void>; + invoke(actionId: string, payload?: unknown, context?: SurfaceContext): void | Promise<void>; /** * Optional: subscribe to spec changes. Returns an unsubscribe disposer. |
