/** VendoProvider + the internal context every hook and surface reads (08 §2). */ import type { ComponentRegistryEntry, VendoNavigation, VendoRouteMap, VendoTheme } from "../core/apps/index.js"; import type { ChatTransport, UIMessage } from "ai"; import { type ComponentType, type ReactNode } from "react"; import { type VendoClient } from "./client.js"; import type { VendoDiscoverability, VendoGreeting } from "./chrome/discoverability.js"; import type { ToolMetaMap } from "./chrome/humanize.js"; import { type KitIntl } from "./kit/format.js"; export interface VendoContextValue { client: VendoClient; /** Host catalog implementations, by registered name (08 §2). */ components: Record; /** The slots `vendo sync` could split — the generated wiring's own keys, and exactly the components a ✦ may appear on. Empty when the host wired no wiring: nothing has ported, so nothing offers a remix. */ remixSlots: ReadonlySet; /** Resolved brand tokens (defaults ⊕ provider overrides). */ theme: VendoTheme; /** The host's `.vendo/fonts.css` text — the brand's `@font-face` rules, as inlined data URIs. Chrome injects it beside its own sheet. */ fonts?: string; /** * Optional chat-transport override (director/replay tooling). When absent, * threads use the live wire transport — this is never a default. */ transport?: ChatTransport; /** * Optional host handler for pinning a previewed app into the product — the * DIY path, for a host that keeps placement in its own product state. * * WHERE a pin lands is not a prop: a mounted `` reports itself to * the slot registry, and the placement affordance reads that registry (see * `PlacementAction`). So a host that mounts one slot gets a real * `apps.place` write with no config at all, and this handler is a mirror it * may also keep. With NO slot reported it is the whole pin, and the only * thing that puts a "Pin to dashboard" action on a finished view. */ onPin?(app: { appId: string; payload: unknown; }): void | Promise; /** Optional host-supplied friendly tool metadata, keyed by tool name/id (ENG-216 humanization seam — additive, UI-side, no wire/contract change). */ tools: ToolMetaMap; /** ENG-225 — the connect dock's catalog: which toolkits this host's users can connect. An explicit array is used as-is (empty = no dock renders); `"auto"` (the omitted-prop default) means surfaces resolve the catalog from `GET /connections/catalog` — everything the host's server-side connectors advertise. Resolve through useConnectorCatalog, never read this raw. */ connectors: ConnectorOption[] | "auto"; /** The discoverability dial (ui-usage-dx §6): quiet | default. Default keeps the fire-once whisper + greeting; surfaces may override via their own prop. */ discoverability: VendoDiscoverability; /** Host greeting-as-tutorial content (§6): intro + starter prompts, the `.vendo/greeting.json` shape. Absent = the built-in generic greeting. */ greeting?: VendoGreeting; /** The host's display currency + locale for the formatting the KIT still does itself — a chart's axis ticks, and the chrome's own rendering of a tool's arguments. A screen formats its own figures with `Intl`, so the currency also reaches the model through its briefing. */ intl: KitIntl; /** Spec 2026-08-05 §2 — whether sends snapshot the visible host page into the [Context] channel. Default true; false disables capture entirely (useVendoContext data still rides). */ captureScreen: boolean; /** The host's own pages, by the name a generated `` may reach for. Unset, no target resolves and no link navigates. */ routes?: VendoRouteMap; /** Where a Link press goes. The HOST performs the move — only its router knows its basePath and its transitions; Vendo only says where. */ onNavigate?(nav: VendoNavigation): void; } /** One connectable toolkit in the connect dock (ENG-225). */ export interface ConnectorOption { toolkit: string; /** Broker connector id, when the host pins one (04 §3.1). */ connector?: string; /** Display name; defaults to the capitalized toolkit. */ label?: string; } /** Exported for the provider-optional hooks that live in their own modules * (`./routes.js`); not part of the package's public surface. */ export declare const VendoContext: import("react").Context; /** 08 §2 (amended 2026-07-18): the components input — the plain name→component * map, or the 01 §14 name-keyed ComponentRegistry (the same object the server * takes as `catalog`). The choice is per ENTRY, which is how hostComponentMap * has always read it; a union of the two whole-map forms could not express a * mixed one. `ComponentType` because a host component declares its own * required props and `ComponentType`'s default `{}` rejects every one of them. */ export type HostComponentsInput = Record | ComponentRegistryEntry>; /** Extract the name→component map from either components-input form. Registry * data fields (description, props schema, examples) are server-side * concerns the client ignores (01 §14). */ export declare function hostComponentMap(components: HostComponentsInput | undefined): Record; /** The client half of the generated remix wiring (`vendo sync` writes * `.vendo/generated/remix-wiring.ts`; `holes` binds a name the ported screen * renders to the component itself, and the wiring's KEYS are the slots sync * could split). Read STRUCTURALLY, so the host hands the whole generated const * over — `tools` and all — exactly as it hands it to * `createVendo({ remixWiring })`. */ export type RemixWiringInput = Record; holes?: Record>; }>; export declare function VendoProvider(props: { client?: VendoClient; /** The wire mount, path prefix included ("/maple/api/vendo"). Default "/api/vendo". Ignored when `client` is passed — an explicit client already carries its own base. */ baseUrl?: string; components?: HostComponentsInput; /** The same generated const `createVendo({ remixWiring })` takes. It is read two ways, and both ends need it. Its HOLES join the components map as its WEAKEST leg — mirroring the server, where a hole is the weakest leg of the catalog (`vendo` compose-surfaces.ts) — so a `components` entry for the same name still wins. The client screen VM's vocabulary is built from this map too (tree/renderer.tsx), so a hole missing here is a name the port cannot even paint. Its KEYS name the slots sync could split, and `` offers the ✦ on those and only those — sync already refused the rest, loudly, in its report. Unset is the honest zero: no slot has ported, so no component offers a remix, and none paints a hole. */ remixWiring?: RemixWiringInput; theme?: Partial; /** The host's `.vendo/fonts.css` text — see VendoContextValue.fonts. */ fonts?: string; transport?: ChatTransport; onPin?(app: { appId: string; payload: unknown; }): void | Promise; tools?: ToolMetaMap; connectors?: ConnectorOption[]; discoverability?: VendoDiscoverability; greeting?: VendoGreeting; /** Display currency + locale, e.g. `{ currency: "PKR" }` for a Pakistani host. Omitted fields fall back to USD / en-US. */ intl?: Partial; /** Disable the automatic screen snapshot on send (spec 2026-08-05 §2). */ captureScreen?: boolean; /** The host's own pages a generated `` may open — see VendoContextValue.routes. */ routes?: VendoRouteMap; /** Perform the navigation a Link press asked for (`router.push(nav.path)`). */ onNavigate?(nav: VendoNavigation): void; children: ReactNode; }): ReactNode; /** Everything VendoProvider supplies — the seam every hook and surface reads. * Named `useVendoProvider` (not `useVendoContext`) since 2026-08-05: the * host-facing `useVendoContext(data)` publishes into the agent's [Context] * channel and owns that name. * * The provider is OPTIONAL: with none above, this answers the shared defaults * ({@link bareContextValue}) and the surfaces work bare. A provider always * wins — it has always been "settings for the components inside me", and the * defaults only add "here's what I assume when you don't say". */ export declare function useVendoProvider(): VendoContextValue; /** Resolved brand tokens (08 §3 — the useVendoTheme hook). */ export declare function useVendoTheme(): VendoTheme; /** Host-supplied tool metadata (ENG-216). Provider-optional so surfaces that can render standalone still degrade to the pure formatting fallback. */ export declare function useVendoTools(): ToolMetaMap; /** Like useVendoTheme, but provider-optional: surfaces that also work standalone (TreeView) fall back to the default brand tokens. */ export declare function useVendoThemeOrDefault(): VendoTheme; /** The wire, provider-optional. A tree inside a provider can ask what became of an approval one of its presses parked; a standalone one has nobody to ask and simply never resolves one. */ export declare function useVendoClientOrNone(): VendoClient | undefined; /** The discoverability dial, provider-optional (standalone surfaces default on). */ export declare function useVendoDiscoverability(): VendoDiscoverability; /** Host greeting-as-tutorial content, provider-optional (absent = built-in). */ export declare function useVendoGreeting(): VendoGreeting | undefined; /** Display currency + locale, provider-optional (standalone surfaces get the ambient defaults, which are USD/en-US until a provider sets them). */ export declare function useVendoIntl(): KitIntl;