/** * Wire types for LLM-authored UI element instantiation — Phase 6. * * These mirror the backend Pydantic models in * `platform/backend/app/services/agents/elements_models.py`. Kept as * plain TypeScript types (no Zod validators) for v1 — the SDK trusts * what it fetches from the workspace's own backend per the design doc's * "backend is the sole enforcer" stance. Add Zod here if defence-in-depth * ever becomes a real concern. * * Wire format documented in * `docs/plans/current/2026-05-24-adaptive-chatbot-action-triggers-design.md`. */ export type ElementState = 'active' | 'applied' | 'reverted' | 'expired'; export interface AgentProvenance { agent_id: string; turn_id: string; } export interface Mutation { op: 'mount' | 'patch' | 'unmount'; at: string; by: AgentProvenance; paths?: string[]; } export interface SlotPlacement { type: 'slot'; slot: string; } export interface SelectorPlacement { type: 'selector'; selector: string; position: 'beforebegin' | 'afterbegin' | 'beforeend' | 'afterend' | 'replace' | 'modify'; } export interface NoPlacement { type: 'none'; } /** * Compositional-item placement — for chips, FAQ items, nav tips that * mount INSIDE an existing tile's compositional-actions list rather * than occupying their own slot. `tile_id` references a tile by its * config-time id (e.g. `hero-chips`); `position` controls insertion * order in the parent's items array. * * Backend mirror: `ParentTilePlacement` in * `platform/backend/app/services/agents/elements_models.py`. */ export interface ParentTilePlacement { type: 'parent_tile'; tile_id: string; position: 'append' | 'prepend'; } export type Placement = SlotPlacement | SelectorPlacement | NoPlacement | ParentTilePlacement; export interface MountedElement { instance_id: string; element_type: 'tile' | 'action' | 'item'; template_id: string; placement: Placement; /** The agent's placement plan for a tile: its group heading and whether it * leads the group. Absent when the agent gave none, and on elements mounted * before the plan existed. */ layout?: { group?: string | null; lead: boolean; } | null; content: Record; state: ElementState; mounted_by: AgentProvenance; mounted_at: string; /** Model-issued id of the tool call that mounted this element — the SDK * anchors the restored element to the transcript message hosting this * call (BUG-1784935730). Absent on pre-existing sessions. */ tool_call_id?: string | null; version: number; mutation_log?: Mutation[]; } /** * Live-mutation envelope carried on the `syntro.element.mutation` * AG-UI custom event. */ export interface MutationEnvelope { type: 'syntro.element.mutation'; schema_version: 'v0'; mutations: ElementMutation[]; } export type ElementMutation = MountMutation | PatchMutation | UnmountMutation; export interface MountMutation { op: 'mount'; instance: MountedElement; } export interface PatchMutation { op: 'patch'; instance_id: string; patches: { path: string; value: unknown; }[]; expected_version: number; /** New version after patch, sent by the backend. SDK uses this for dedup. */ resulting_version: number; /** Full content snapshot after patch — saves the SDK from having to * apply patches client-side. */ resulting_content: Record; } export interface UnmountMutation { op: 'unmount'; instance_id: string; } /** * Response shape from `GET /api/adaptive/mounted_elements`. Matches the * backend `MountedElementsResponse` (Phase 4). */ export interface MountedElementsResponse { mounted_elements: MountedElement[]; session_expires_at: string | null; schema_version: 'v0'; } //# sourceMappingURL=types.d.ts.map