import type { DataSurfaceRegistry } from '@happyvertical/smrt-ui/data'; import type { ControlInteractionRegistry } from '@happyvertical/smrt-ui/forms'; import type { ViewIntent, ViewIntentControlIdentity, ViewIntentDataSurfaceIdentity, WebMcpToolEffect } from '@happyvertical/smrt-web'; /** * The mounted registry identity an intent addresses. Both members carry the * optional `subject`, so a rich form can bind an intent to the right record * when several controls share a `formId`/`controlId`. */ export type ViewIntentIdentity = ViewIntentControlIdentity | ViewIntentDataSurfaceIdentity; export interface UseViewIntentOptions { /** * The mounted identity this intent is bound to for the component's * lifetime. Shape must match the intent's declared target registry: * `{ formId, controlId, subject? }` for a control intent, * `{ surfaceId, kind, subject? }` for a data-surface intent. */ identity: ViewIntentIdentity; /** * `effects` exposure-policy fallback, used only when no Provider ancestor * supplies an explicit `webmcp.effects` policy — see * {@link useWebMcpTool}. A Provider's explicit policy always wins. */ effects?: readonly WebMcpToolEffect[]; /** Override the Provider's control registry (tests, nested hosts). */ controlRegistry?: ControlInteractionRegistry; /** Override the Provider's data-surface registry. */ dataSurfaceRegistry?: DataSurfaceRegistry; } /** * Bind a declared view intent (#2588) to this component's mounted registry * identity, for exactly this component's lifetime. * * Svelte is the FIRST binding, not the only one: the declaration contract, * the registry, and the compilation to a browser tool all live in * `@happyvertical/smrt-web` with no Svelte dependency. This file is the thin * part — it resolves the mounted registries from the nearest Provider and * hands the compiled spec to {@link useWebMcpTool}, which already owns the * WebMCP lifecycle: the synchronous Provider policy read, the `options.effects` * fallback, serialized same-name re-registration across effect reruns, and * the lazy `@happyvertical/smrt-web` import. * * Registration therefore goes through `registerWebMcpBespokeTool`, so an * intent is subject to the same fail-closed exposure policy as a generated * model tool, and reserves its tool name as `intent` rather than `bespoke`. Execution dispatches exactly one registry command with * `source: 'agent'` — `StagedControlReview` stays on the path, agent-staged * values remain proposals, and there is no path to REST. * * Declare the intent itself at module scope in a `.ts` sidecar * (`Foo.intents.ts`) so #2591's scanner can emit it; import it here. * * With no Provider ancestor and no explicit registry override, this is a * silent no-op — an intent with nothing mounted to dispatch to registers * nothing, the same way every WebMCP entry point no-ops off-WebMCP. Because * the registries are resolved INSIDE the tool factory, a Provider that * enables `webmcp.ui` after this component initializes, or that swaps a * registry, re-runs the effect and registers the intent against the current * one rather than staying stuck on what was there at init. * * @throws if `identity` does not match the intent's declared target registry, * or contradicts an identity the declaration pinned — both are author errors, * not environment differences. */ export declare function useViewIntent(intent: ViewIntent, options: UseViewIntentOptions): void; //# sourceMappingURL=view-intent.svelte.d.ts.map