@runtypelabs/persona 4.8.0 → 4.10.0

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 (130) hide show
  1. package/README.md +14 -1
  2. package/dist/animations/glyph-cycle.d.cts +1 -1
  3. package/dist/animations/glyph-cycle.d.ts +1 -1
  4. package/dist/animations/{types-BsZtXPKK.d.cts → types-4ROVJ1gA.d.cts} +42 -0
  5. package/dist/animations/{types-BsZtXPKK.d.ts → types-4ROVJ1gA.d.ts} +42 -0
  6. package/dist/animations/wipe.d.cts +1 -1
  7. package/dist/animations/wipe.d.ts +1 -1
  8. package/dist/chunk-IO5VVUKP.js +3 -0
  9. package/dist/chunk-IPVK3KOM.js +1 -0
  10. package/dist/chunk-UPO4GUFC.js +1 -0
  11. package/dist/codegen.cjs +6 -6
  12. package/dist/codegen.js +8 -8
  13. package/dist/context-mentions-7S5KVUTG.js +169 -0
  14. package/dist/context-mentions-inline-TTCN7ZM2.js +4 -0
  15. package/dist/context-mentions-inline.cjs +4 -0
  16. package/dist/context-mentions-inline.d.cts +203 -0
  17. package/dist/context-mentions-inline.d.ts +203 -0
  18. package/dist/context-mentions-inline.js +4 -0
  19. package/dist/context-mentions.cjs +295 -0
  20. package/dist/context-mentions.d.cts +7025 -0
  21. package/dist/context-mentions.d.ts +7025 -0
  22. package/dist/context-mentions.js +295 -0
  23. package/dist/index.cjs +72 -64
  24. package/dist/index.cjs.map +1 -1
  25. package/dist/index.d.cts +634 -3
  26. package/dist/index.d.ts +634 -3
  27. package/dist/index.global.js +59 -51
  28. package/dist/index.global.js.map +1 -1
  29. package/dist/index.js +64 -56
  30. package/dist/index.js.map +1 -1
  31. package/dist/launcher.global.js +2 -2
  32. package/dist/launcher.global.js.map +1 -1
  33. package/dist/plugin-kit.cjs +1 -1
  34. package/dist/plugin-kit.d.cts +17 -0
  35. package/dist/plugin-kit.d.ts +17 -0
  36. package/dist/plugin-kit.js +1 -1
  37. package/dist/smart-dom-reader.cjs +17 -16
  38. package/dist/smart-dom-reader.d.cts +507 -1
  39. package/dist/smart-dom-reader.d.ts +507 -1
  40. package/dist/smart-dom-reader.js +17 -16
  41. package/dist/theme-editor-preview.cjs +236 -57
  42. package/dist/theme-editor-preview.d.cts +485 -1
  43. package/dist/theme-editor-preview.d.ts +485 -1
  44. package/dist/theme-editor-preview.js +53 -47
  45. package/dist/theme-editor.cjs +7 -7
  46. package/dist/theme-editor.d.cts +473 -0
  47. package/dist/theme-editor.d.ts +473 -0
  48. package/dist/theme-editor.js +5 -5
  49. package/dist/theme-reference.cjs +1 -1
  50. package/dist/theme-reference.d.cts +2 -0
  51. package/dist/theme-reference.d.ts +2 -0
  52. package/dist/widget.css +1 -1
  53. package/package.json +15 -3
  54. package/src/client.test.ts +69 -0
  55. package/src/client.ts +65 -51
  56. package/src/components/artifact-pane.test.ts +47 -0
  57. package/src/components/artifact-pane.ts +25 -2
  58. package/src/components/composer-parts.ts +3 -12
  59. package/src/components/context-mention-button.test.ts +70 -0
  60. package/src/components/context-mention-button.ts +82 -0
  61. package/src/components/context-mention-chip.ts +134 -0
  62. package/src/components/context-mention-menu.test.ts +508 -0
  63. package/src/components/context-mention-menu.ts +0 -0
  64. package/src/components/message-bubble.test.ts +175 -0
  65. package/src/components/message-bubble.ts +177 -19
  66. package/src/components/panel.ts +7 -10
  67. package/src/context-mentions-bundle.test.ts +163 -0
  68. package/src/context-mentions-entry.ts +185 -0
  69. package/src/context-mentions-inline-entry.test.ts +136 -0
  70. package/src/context-mentions-inline-entry.ts +226 -0
  71. package/src/context-mentions-inline-loader.test.ts +30 -0
  72. package/src/context-mentions-inline-loader.ts +36 -0
  73. package/src/context-mentions-inline.ts +15 -0
  74. package/src/context-mentions-loader.ts +32 -0
  75. package/src/context-mentions.ts +16 -0
  76. package/src/index-core.ts +27 -0
  77. package/src/index-global.ts +51 -0
  78. package/src/markdown-parsers-loader.ts +35 -44
  79. package/src/plugin-kit.test.ts +40 -0
  80. package/src/plugin-kit.ts +39 -5
  81. package/src/runtime/init-update-reset.test.ts +81 -0
  82. package/src/runtime/init.test.ts +62 -0
  83. package/src/runtime/init.ts +7 -14
  84. package/src/session.mentions.test.ts +175 -0
  85. package/src/session.test.ts +52 -4
  86. package/src/session.ts +121 -5
  87. package/src/smart-dom-reader.test.ts +129 -2
  88. package/src/smart-dom-reader.ts +127 -1
  89. package/src/styles/context-mention-menu-css.ts +176 -0
  90. package/src/styles/widget.css +243 -126
  91. package/src/theme-editor/sections.ts +3 -3
  92. package/src/types/theme.ts +2 -0
  93. package/src/types.ts +542 -0
  94. package/src/ui.artifact-pane-gating.test.ts +11 -1
  95. package/src/ui.attachments-drop.test.ts +90 -0
  96. package/src/ui.header-update-stability.test.ts +149 -0
  97. package/src/ui.launcher-update-merge.test.ts +83 -0
  98. package/src/ui.mention-submit.test.ts +235 -0
  99. package/src/ui.send-button-stream-update.test.ts +69 -0
  100. package/src/ui.ts +379 -84
  101. package/src/utils/chunk-loader.test.ts +97 -0
  102. package/src/utils/chunk-loader.ts +88 -0
  103. package/src/utils/composer-contenteditable.test.ts +507 -0
  104. package/src/utils/composer-contenteditable.ts +626 -0
  105. package/src/utils/composer-document.test.ts +280 -0
  106. package/src/utils/composer-document.ts +293 -0
  107. package/src/utils/composer-history.test.ts +35 -7
  108. package/src/utils/composer-history.ts +30 -20
  109. package/src/utils/composer-input.ts +159 -0
  110. package/src/utils/config-merge.test.ts +131 -0
  111. package/src/utils/config-merge.ts +61 -0
  112. package/src/utils/context-mention-controller.test.ts +1215 -0
  113. package/src/utils/context-mention-controller.ts +1186 -0
  114. package/src/utils/context-mention-manager.test.ts +422 -0
  115. package/src/utils/context-mention-manager.ts +410 -0
  116. package/src/utils/context-mention-orchestrator.test.ts +538 -0
  117. package/src/utils/context-mention-orchestrator.ts +348 -0
  118. package/src/utils/live-region.test.ts +108 -0
  119. package/src/utils/live-region.ts +94 -0
  120. package/src/utils/mention-channels.ts +63 -0
  121. package/src/utils/mention-llm-format.test.ts +91 -0
  122. package/src/utils/mention-llm-format.ts +79 -0
  123. package/src/utils/mention-matcher.test.ts +86 -0
  124. package/src/utils/mention-matcher.ts +221 -0
  125. package/src/utils/mention-token.ts +72 -0
  126. package/src/utils/mention-trigger.test.ts +155 -0
  127. package/src/utils/mention-trigger.ts +156 -0
  128. package/src/utils/theme.test.ts +54 -4
  129. package/src/utils/theme.ts +6 -3
  130. package/src/utils/tokens.ts +27 -11
package/dist/index.d.cts CHANGED
@@ -425,6 +425,8 @@ interface ComponentTokenSet {
425
425
  margin?: TokenReference<'spacing'>;
426
426
  shadow?: TokenReference<'shadow'>;
427
427
  opacity?: number;
428
+ /** Hover background — used by transparent variants like `button.ghost`. */
429
+ hoverBackground?: TokenReference<'color'>;
428
430
  }
429
431
  interface ButtonTokens extends ComponentTokenSet {
430
432
  primary: ComponentTokenSet;
@@ -1911,6 +1913,446 @@ type AgentWidgetContextProviderContext = {
1911
1913
  config: AgentWidgetConfig;
1912
1914
  };
1913
1915
  type AgentWidgetContextProvider = (context: AgentWidgetContextProviderContext) => Record<string, unknown> | void | Promise<Record<string, unknown> | void>;
1916
+ /** A single selectable item in the mention menu (host-provided). */
1917
+ type AgentWidgetContextMentionItem = {
1918
+ /** Stable key within its source. */
1919
+ id: string;
1920
+ /** Shown in the menu and on the chip (e.g. "App.tsx"). */
1921
+ label: string;
1922
+ /** Subtitle line in the menu. */
1923
+ description?: string;
1924
+ /** Lucide icon name. */
1925
+ iconName?: string;
1926
+ /**
1927
+ * Accent color for this item's inline token (`display: "inline"`), any CSS
1928
+ * color. Sets `--persona-mention-token-accent` on the token, tinting its pill
1929
+ * background + icon/label — the per-item/per-type color knob (Slack/Linear
1930
+ * style). Prefer setting the same color across a source's items for a "color
1931
+ * per type" look, or theme by `[data-mention-source]` in CSS instead. Ignored
1932
+ * in chip mode.
1933
+ */
1934
+ color?: string;
1935
+ /** Group header override; defaults to the source's `label`. */
1936
+ group?: string;
1937
+ /** Optional recency/popularity hint the default matcher boosts on. */
1938
+ recencyScore?: number;
1939
+ /**
1940
+ * SKILLS / SLASH-COMMANDS. When set, this item is a COMMAND (a verb) rather
1941
+ * than a context mention (a noun), so selecting it dispatches a behavior
1942
+ * instead of adding a context chip. Absent for ordinary mentions.
1943
+ *
1944
+ * - `"prompt"`: a prompt macro. `resolve()` returns `insertText` (or
1945
+ * `llmAppend`) which is written into the composer (see `insertMode`);
1946
+ * `submitOnSelect` optionally sends it immediately. No chip.
1947
+ * - `"action"`: a client action. `action()` runs in the browser; no resolve,
1948
+ * no chip, no message sent (e.g. `/clear`, `/theme dark`).
1949
+ * - `"server"`: a server-invoked skill. Routed like a `resolveOn:"submit"`
1950
+ * mention whose `resolve().context` reaches the backend via request
1951
+ * `context.mentions.<sourceId>.<itemId>` (a flow/agent reads it).
1952
+ */
1953
+ command?: "prompt" | "action" | "server";
1954
+ /**
1955
+ * `command:"action"` handler. Receives the parsed `args` (text after the
1956
+ * command name), plus a small `composer` capability + `config`/`messages`.
1957
+ * Short-circuits the mention flow (no chip, no send). Ignored otherwise.
1958
+ */
1959
+ action?: (ctx: AgentWidgetContextMentionCommandContext) => void | Promise<void>;
1960
+ /**
1961
+ * `command:"prompt"` insertion mode. `"replace"` (default) swaps the whole
1962
+ * composer value for the resolved text; `"insert-at-caret"` replaces only the
1963
+ * `/token` span, keeping surrounding prose. Ignored otherwise.
1964
+ */
1965
+ insertMode?: "replace" | "insert-at-caret";
1966
+ /**
1967
+ * When true, a `command:"prompt"` submits the composer immediately after
1968
+ * inserting its text (a one-shot macro). Ignored for other kinds.
1969
+ */
1970
+ submitOnSelect?: boolean;
1971
+ /**
1972
+ * COMMANDS only. Ghost hint for a free-text argument (e.g. "order id" →
1973
+ * `/lookup ‹order id›` in the menu). Its presence switches the command to
1974
+ * INLINE COMPLETION (Slack-style): selecting it fills `/name ` into the
1975
+ * composer for inline arg entry instead of dispatching on select, and the
1976
+ * command is executed at SUBMIT with the typed args. `command:"server"` items
1977
+ * always use inline completion (their chip had no way to add an argument);
1978
+ * for `"prompt"`/`"action"` items this is opt-in. Ignored for non-commands.
1979
+ */
1980
+ commandArgsPlaceholder?: string;
1981
+ };
1982
+ /**
1983
+ * Capability object handed to a `command:"action"` handler. The widget exposes
1984
+ * only composer-local operations; broader actions (clear the transcript, change
1985
+ * theme) are wired by the host via closures over its own controller.
1986
+ */
1987
+ type AgentWidgetContextMentionComposerCapability = {
1988
+ /** Current composer text. */
1989
+ getValue: () => string;
1990
+ /** Replace composer text (fires `input`, moves caret to end, refocuses). */
1991
+ setValue: (value: string) => void;
1992
+ /** Submit the composer (same path as pressing send). */
1993
+ submit: () => void;
1994
+ };
1995
+ /** Context passed to a `command:"action"` handler. */
1996
+ type AgentWidgetContextMentionCommandContext = {
1997
+ /** Text typed after the command name (e.g. `staging` for `/deploy staging`). */
1998
+ args: string;
1999
+ config: AgentWidgetConfig;
2000
+ messages: AgentWidgetMessage[];
2001
+ composer: AgentWidgetContextMentionComposerCapability;
2002
+ };
2003
+ /** Reference stored on a sent message for transcript fidelity + chip rendering. */
2004
+ type AgentWidgetContextMentionRef = {
2005
+ sourceId: string;
2006
+ itemId: string;
2007
+ label: string;
2008
+ iconName?: string;
2009
+ /** Accent color for the inline token (see `AgentWidgetContextMentionItem.color`). */
2010
+ color?: string;
2011
+ };
2012
+ /**
2013
+ * One ordered segment of a sent message's prose, for inline mention rendering
2014
+ * (`contextMentions.display: "inline"`). Text runs and atomic mention tokens
2015
+ * interleave in document order so the sent bubble re-renders `@tokens` in place
2016
+ * and composer history can round-trip them. Display/transcript concern only —
2017
+ * the model still sees resolved bodies via `llmContent`/`contentParts`.
2018
+ */
2019
+ type AgentWidgetContentSegment = {
2020
+ kind: "text";
2021
+ text: string;
2022
+ } | {
2023
+ kind: "mention";
2024
+ ref: AgentWidgetContextMentionRef;
2025
+ };
2026
+ /**
2027
+ * The payload a source returns from `resolve()` for one selected item.
2028
+ * Lead with `llmAppend` — it is the only channel guaranteed to reach the model
2029
+ * with no backend changes.
2030
+ */
2031
+ type AgentWidgetContextMentionPayload = {
2032
+ /**
2033
+ * PRIMARY, model-visible channel. Appended to this user message's LLM content
2034
+ * so the model actually sees the context with no backend changes.
2035
+ */
2036
+ llmAppend?: string;
2037
+ /**
2038
+ * `command:"prompt"` macros only. Text written into the COMPOSER on select
2039
+ * (see `AgentWidgetContextMentionItem.insertMode`) — distinct from the hidden
2040
+ * `llmAppend` context channel. Falls back to `llmAppend` when omitted.
2041
+ */
2042
+ insertText?: string;
2043
+ /** Extra content parts (e.g. file text / image) via the multi-modal path. */
2044
+ contentParts?: ContentPart[];
2045
+ /**
2046
+ * OPT-IN structured channel. Merged into request `context` under
2047
+ * `mentions.<sourceId>.<itemId>` for flows/agents that read it. NOTE: ambient
2048
+ * `context` is NOT guaranteed to reach the model — use `llmAppend` if you need
2049
+ * the model to see it.
2050
+ */
2051
+ context?: Record<string, unknown>;
2052
+ };
2053
+ /**
2054
+ * One resolved mention, handed to `contextMentions.llmFormat` to build the
2055
+ * model-visible block. `text` is the source's `llmAppend`; `ref`/`item` carry
2056
+ * the selection identity/metadata for a custom formatter (e.g. a source-specific
2057
+ * wrapper or a path from `item`).
2058
+ */
2059
+ type AgentWidgetMentionLlmEntry = {
2060
+ /** The mention's display label (from `ref.label`). */
2061
+ label: string;
2062
+ /** The resolved model-visible body (the source's `llmAppend`). */
2063
+ text: string;
2064
+ ref: AgentWidgetContextMentionRef;
2065
+ item: AgentWidgetContextMentionItem;
2066
+ };
2067
+ type AgentWidgetContextMentionSearchContext = {
2068
+ messages: AgentWidgetMessage[];
2069
+ config: AgentWidgetConfig;
2070
+ /** Aborts when the next keystroke supersedes this in-flight search. */
2071
+ signal: AbortSignal;
2072
+ };
2073
+ type AgentWidgetContextMentionResolveContext = AgentWidgetContextMentionSearchContext & {
2074
+ /** Plain-text composer value at resolve time. */
2075
+ composerText: string;
2076
+ /**
2077
+ * For `command` items: the text typed after the command name (e.g.
2078
+ * `"123"` for `/lookup 123`). Empty string for ordinary mentions.
2079
+ */
2080
+ args: string;
2081
+ };
2082
+ type AgentWidgetContextMentionSource = {
2083
+ id: string;
2084
+ /** Group header shown in the menu. */
2085
+ label: string;
2086
+ /**
2087
+ * Filter items for the current `@query` (empty query → recent/popular).
2088
+ * Implement server-side search for large/remote sets, or return all items and
2089
+ * let the widget rank them with `defaultMentionFilter`
2090
+ * (see `createStaticMentionSource` for the common case).
2091
+ */
2092
+ search: (query: string, ctx: AgentWidgetContextMentionSearchContext) => AgentWidgetContextMentionItem[] | Promise<AgentWidgetContextMentionItem[]>;
2093
+ /**
2094
+ * Fetch the payload for dispatch. Called once when the user SELECTS the item
2095
+ * (eagerly, cached on the chip, abortable on removal) unless `resolveOn` is
2096
+ * `"submit"`. A throw/abort drops the mention via `onMentionResolveError`.
2097
+ */
2098
+ resolve: (item: AgentWidgetContextMentionItem, ctx: AgentWidgetContextMentionResolveContext) => AgentWidgetContextMentionPayload | Promise<AgentWidgetContextMentionPayload>;
2099
+ /**
2100
+ * When to call `resolve()`:
2101
+ * - `"select"` (default): eager on pick; parallelizes the fetch with the user
2102
+ * finishing their sentence so submit stays instant.
2103
+ * - `"submit"`: defer to send time, for time-sensitive sources (e.g. current
2104
+ * page state that may change between select and send).
2105
+ * @default "select"
2106
+ */
2107
+ resolveOn?: "select" | "submit";
2108
+ /**
2109
+ * COMMAND sources only. Resolve a `/name` (the first token of a command line)
2110
+ * to its menu item, for submit-time inline-command dispatch and the menu's
2111
+ * "typing args now" suppression. `createSlashCommandsSource` sets this; plain
2112
+ * `@`-mention sources leave it undefined.
2113
+ */
2114
+ matchCommand?: (name: string) => AgentWidgetContextMentionItem | undefined;
2115
+ };
2116
+ /** Context passed to the optional `renderMentionMenu` override. */
2117
+ type AgentWidgetContextMentionMenuRenderContext = {
2118
+ /** Current trigger query ("" when freshly opened). */
2119
+ query: string;
2120
+ /** Grouped, ranked, capped results ready to paint. */
2121
+ groups: {
2122
+ source: AgentWidgetContextMentionSource;
2123
+ items: AgentWidgetContextMentionItem[];
2124
+ }[];
2125
+ /** Per-source async state for loading/empty/error rendering, keyed by source id. */
2126
+ status: Record<string, "loading" | "ready" | "empty" | "error">;
2127
+ /** Index into the flat keyboard-traversal order. */
2128
+ activeIndex: number;
2129
+ /** Commit a selection (strips `@query`, adds chip, resolves on select). */
2130
+ select: (item: AgentWidgetContextMentionItem) => void;
2131
+ /** Close the menu, keeping a literal `@`. */
2132
+ close: () => void;
2133
+ };
2134
+ /** Context passed to the optional `renderMentionItem` per-row override. */
2135
+ type AgentWidgetContextMentionItemRenderContext = {
2136
+ /** The item to render. */
2137
+ item: AgentWidgetContextMentionItem;
2138
+ /** The source this item came from (its group). */
2139
+ source: AgentWidgetContextMentionSource;
2140
+ /** Current trigger query, for highlighting matches. */
2141
+ query: string;
2142
+ /** True when this row is the keyboard-highlighted one at render time. */
2143
+ active: boolean;
2144
+ /** Position in the flat keyboard-traversal order. */
2145
+ index: number;
2146
+ };
2147
+ /** Context passed to the optional `renderMentionChip` override. */
2148
+ type AgentWidgetContextMentionChipRenderContext = {
2149
+ ref: AgentWidgetContextMentionRef;
2150
+ /** Resolve-on-select lifecycle for spinner→ready→error UI. */
2151
+ status: "resolving" | "ready" | "error";
2152
+ /**
2153
+ * The resolved payload, once available (select-resolved sources only). Use it
2154
+ * to preview already-fetched content on hover. Undefined while `status` is
2155
+ * `"resolving"`, on `"error"`, and for `resolveOn:"submit"` sources (which
2156
+ * resolve at send time, not while the chip sits in the composer — for those,
2157
+ * `ref.itemId` carries the source key you can re-read on demand, e.g. a CSS
2158
+ * selector for the smart-dom source).
2159
+ */
2160
+ payload?: AgentWidgetContextMentionPayload;
2161
+ /** Remove the chip; aborts any in-flight resolve. */
2162
+ remove: () => void;
2163
+ };
2164
+ /**
2165
+ * Where a trigger char is allowed to open the menu:
2166
+ * - `"anywhere"` (default): after any whitespace or start (the `@` rule).
2167
+ * - `"line-start"`: only when the char before the trigger is a newline or the
2168
+ * start of input — the natural rule for `/` slash-commands.
2169
+ * - `"input-start"`: only at index 0 of the composer.
2170
+ */
2171
+ type AgentWidgetMentionTriggerPosition = "anywhere" | "line-start" | "input-start";
2172
+ /**
2173
+ * A SECOND (or Nth) trigger channel sharing the same menu engine — e.g. `/` for
2174
+ * slash-commands alongside `@` for context. The legacy `trigger`/`sources`
2175
+ * fields form the implicit first channel; `triggers[]` adds more. At any caret
2176
+ * at most one channel is active, so all channels drive one menu/controller.
2177
+ */
2178
+ type AgentWidgetMentionTriggerChannel = {
2179
+ /** Trigger character (e.g. "/"). */
2180
+ trigger: string;
2181
+ /** Sources for this channel (searched only when this trigger is active). */
2182
+ sources: AgentWidgetContextMentionSource[];
2183
+ /** Where the trigger may open. @default "anywhere" */
2184
+ triggerPosition?: AgentWidgetMentionTriggerPosition;
2185
+ /**
2186
+ * Let the query span spaces so a command can take ARGS (`/deploy staging`).
2187
+ * A newline still ends it. Pair with `triggerPosition: "line-start"` for
2188
+ * slash-commands. @default false
2189
+ */
2190
+ allowSpaces?: boolean;
2191
+ /** Show a composer affordance button for this channel. @default false */
2192
+ showButton?: boolean;
2193
+ /** Icon for this channel's affordance button. */
2194
+ buttonIconName?: string;
2195
+ /** Tooltip / aria-label for this channel's affordance button. */
2196
+ buttonTooltipText?: string;
2197
+ /** Placeholder for this channel's picker search field. */
2198
+ searchPlaceholder?: string;
2199
+ };
2200
+ type AgentWidgetContextMentionConfig = {
2201
+ /** @default false */
2202
+ enabled?: boolean;
2203
+ /**
2204
+ * Show the visible composer affordance button (the discoverable entry point).
2205
+ * Strongly recommended; the bare `@` trigger alone is hard to discover for
2206
+ * non-technical users. @default true
2207
+ */
2208
+ showButton?: boolean;
2209
+ /**
2210
+ * Icon for the affordance button (any registered Lucide name). Defaults to a
2211
+ * "+" signifier — the consumer-recognized "add context" affordance — rather
2212
+ * than an "@" glyph, which reads as power-user. Use `"at-sign"` on a
2213
+ * developer/power-user surface. @default "plus"
2214
+ */
2215
+ buttonIconName?: string;
2216
+ /** Tooltip / aria-label for the affordance button. @default "Add context" */
2217
+ buttonTooltipText?: string;
2218
+ /**
2219
+ * Placeholder for the picker's search field, shown when the menu is opened
2220
+ * from the affordance button (a Cursor/Copilot-style picker that inserts no
2221
+ * trigger character). The typed-trigger path keeps its query in the textarea
2222
+ * and never shows this field. @default "Search context…"
2223
+ */
2224
+ searchPlaceholder?: string;
2225
+ /** Trigger character. @default "@" */
2226
+ trigger?: string;
2227
+ /**
2228
+ * Where the primary `trigger` may open the menu. @default "anywhere"
2229
+ */
2230
+ triggerPosition?: AgentWidgetMentionTriggerPosition;
2231
+ /**
2232
+ * ADDITIONAL trigger channels sharing this engine — e.g. a `/` slash-command
2233
+ * channel next to `@` context. Each channel has its own trigger char,
2234
+ * sources, and position rule. See `AgentWidgetMentionTriggerChannel`.
2235
+ */
2236
+ triggers?: AgentWidgetMentionTriggerChannel[];
2237
+ /** Max mentions per message. @default 8 */
2238
+ maxMentions?: number;
2239
+ /** Max items shown per source group before "keep typing to narrow". @default 6 */
2240
+ maxItemsPerGroup?: number;
2241
+ /**
2242
+ * Debounce for ASYNC source search only (ms). Synchronous sources and the
2243
+ * menu's first paint are never debounced. @default 150
2244
+ */
2245
+ searchDebounceMs?: number;
2246
+ /** Registered mention sources (search + resolve). */
2247
+ sources: AgentWidgetContextMentionSource[];
2248
+ /** Chip icon fallback when a source/item omits one. @default "at-sign" */
2249
+ chipIconName?: string;
2250
+ /**
2251
+ * How each resolved mention's `llmAppend` text is wrapped into a delimited
2252
+ * block before it is prepended to the model-visible message content. Blocks
2253
+ * are joined with a blank line and the typed prose follows last.
2254
+ *
2255
+ * - `"fenced"` (default): a fenced code block with the label in the info
2256
+ * string, e.g. selecting `App.tsx` emits:
2257
+ * ```text
2258
+ * ```App.tsx
2259
+ * <file body>
2260
+ * ```
2261
+ * ```
2262
+ * The fence auto-escalates (four+ backticks) when the body itself contains a
2263
+ * fence, so a body can never terminate its own wrapper.
2264
+ * - `"document"`: Anthropic's long-context document shape, e.g.:
2265
+ * ```text
2266
+ * <document index="1">
2267
+ * <source>App.tsx</source>
2268
+ * <document_content>
2269
+ * <file body>
2270
+ * </document_content>
2271
+ * </document>
2272
+ * ```
2273
+ * Prefer this for prose/document-shaped sources per Anthropic's long-context
2274
+ * guidance (indexed `<document>` blocks improve grounding and citation). A
2275
+ * body containing the literal `</document_content>` closing tag falls back to
2276
+ * the fenced block for that entry to avoid a broken XML boundary.
2277
+ * - function form: fully owns the block for one mention — its return string is
2278
+ * used verbatim (no extra wrapping), joined with the other blocks. `index` is
2279
+ * the 0-based position among the message's mention blocks.
2280
+ *
2281
+ * @default "fenced"
2282
+ */
2283
+ llmFormat?: "fenced" | "document" | ((entry: AgentWidgetMentionLlmEntry, index: number) => string);
2284
+ /**
2285
+ * How `@` selections appear in the composer and sent user bubble.
2286
+ *
2287
+ * - `"chip"` (default): strip `@query` on select; show a compact pill in the
2288
+ * composer context row; `content` is prose-only.
2289
+ * - `"inline"`: insert an atomic styled token in the sentence (Slack/Linear/
2290
+ * Cursor style), backed by a contenteditable composer. Slash-command channels
2291
+ * (`triggers[]` with `/`) stay inline-text regardless — they already use the
2292
+ * `/name args` model, not chips. `renderMentionChip` is ignored for `@`
2293
+ * mentions in this mode.
2294
+ *
2295
+ * The resolved-context channel (`llmContent`/`contentParts`) is unchanged
2296
+ * across both modes — inline tokens are a display concern.
2297
+ *
2298
+ * @default "chip"
2299
+ */
2300
+ display?: "chip" | "inline";
2301
+ /**
2302
+ * Fired when a pick is rejected: it duplicates an existing chip in chip display
2303
+ * (`"duplicate"` — inline display allows the same item as multiple tokens, so it
2304
+ * never rejects for this reason), hits `maxMentions` (`"limit"`), or (inline
2305
+ * display) the composer text changed between parse and commit so the token could
2306
+ * not be inserted (`"stale"`).
2307
+ */
2308
+ onMentionRejected?: (item: AgentWidgetContextMentionItem, reason: "duplicate" | "limit" | "stale") => void;
2309
+ /**
2310
+ * A `resolve()` that throws/aborts: the mention is dropped and the message
2311
+ * still sends. Surface a non-blocking notice here if desired.
2312
+ */
2313
+ onMentionResolveError?: (item: AgentWidgetContextMentionItem, error: unknown) => void;
2314
+ /**
2315
+ * MID-LEVEL render override for the autocomplete menu. The widget still owns
2316
+ * trigger detection, search, debounce/abort, keyboard nav, and positioning;
2317
+ * you only supply the menu markup and drive selection through `ctx`. Omit to
2318
+ * use the built-in grouped menu. @default built-in
2319
+ */
2320
+ renderMentionMenu?: (ctx: AgentWidgetContextMentionMenuRenderContext) => HTMLElement;
2321
+ /**
2322
+ * NARROW render override for a single result row's INNER content, keeping the
2323
+ * built-in menu chrome (group headers, loading/empty/error, keyboard nav, the
2324
+ * "keep typing" hint). The widget keeps the `role="option"` wrapper and its
2325
+ * click/hover wiring; you return only the row's contents. For full menu
2326
+ * control use `renderMentionMenu` instead. Highlight is CSS-driven via the
2327
+ * wrapper's `[data-active]` attribute, so this is called once per render, not
2328
+ * on every arrow key. Ignored when `renderMentionMenu` is set. @default built-in
2329
+ */
2330
+ renderMentionItem?: (ctx: AgentWidgetContextMentionItemRenderContext) => HTMLElement;
2331
+ /**
2332
+ * MID-LEVEL render override for a single context chip. Return your own pill
2333
+ * (must include an accessible remove control wired to `ctx.remove`); reflect
2334
+ * `ctx.status` for resolve-on-select. Omit to use the built-in compact pill.
2335
+ * @default built-in
2336
+ */
2337
+ renderMentionChip?: (ctx: AgentWidgetContextMentionChipRenderContext) => HTMLElement;
2338
+ /**
2339
+ * INLINE display only (`display: "inline"`). Render override for a single inline
2340
+ * mention TOKEN — the atomic styled node that sits in the sentence, in both the
2341
+ * contenteditable composer and the read-only sent bubble. Return your own
2342
+ * element (e.g. a fully custom colored pill); the composer marks it
2343
+ * `contenteditable="false"` and stamps `data-mention-id` so it stays atomic.
2344
+ * Omit to use the built-in pill (icon + `@label`, tinted by
2345
+ * `--persona-mention-token-accent` / `ref.color`, themeable per source via the
2346
+ * `[data-mention-source]` attribute). Ignored in chip mode.
2347
+ * @default built-in
2348
+ */
2349
+ renderMentionToken?: (ctx: AgentWidgetContextMentionTokenRenderContext) => HTMLElement;
2350
+ };
2351
+ /** Render context for `renderMentionToken`. `readonly` is true in the sent bubble. */
2352
+ type AgentWidgetContextMentionTokenRenderContext = {
2353
+ ref: AgentWidgetContextMentionRef;
2354
+ readonly: boolean;
2355
+ };
1914
2356
  type AgentWidgetRequestPayloadMessage = {
1915
2357
  role: AgentWidgetMessageRole;
1916
2358
  content: MessageContent;
@@ -6082,6 +6524,18 @@ type AgentWidgetConfig = {
6082
6524
  }) => string;
6083
6525
  plugins?: AgentWidgetPlugin[];
6084
6526
  contextProviders?: AgentWidgetContextProvider[];
6527
+ /**
6528
+ * Context mentions: let users explicitly pull external context into a turn by
6529
+ * typing `@` or clicking a visible composer button, both opening one shared
6530
+ * searchable menu of host-provided sources. Selecting a mention adds a
6531
+ * removable pill chip; resolved content reaches the model via `llmAppend`
6532
+ * (default) or the opt-in structured `context` channel.
6533
+ *
6534
+ * Disabled by default. When enabled, the mention runtime is lazy-loaded from a
6535
+ * sibling chunk on first use, so sites that leave it off pay no bundle cost.
6536
+ * See `docs/context-mentions-plan.md`.
6537
+ */
6538
+ contextMentions?: AgentWidgetContextMentionConfig;
6085
6539
  requestMiddleware?: AgentWidgetRequestMiddleware;
6086
6540
  actionParsers?: AgentWidgetActionParser[];
6087
6541
  actionHandlers?: AgentWidgetActionHandler[];
@@ -6531,6 +6985,17 @@ type AgentWidgetConfig = {
6531
6985
  */
6532
6986
  loadingIndicator?: AgentWidgetLoadingIndicatorConfig;
6533
6987
  };
6988
+ /**
6989
+ * Patch-aware deep-partial of {@link AgentWidgetConfig} accepted by `update()`.
6990
+ * Function types and arrays are preserved whole (not mapped over); plain-object
6991
+ * leaves recurse so a partial patch merges into the live config. See the merge
6992
+ * policy in utils/config-merge.ts (some plain-object fields still replace
6993
+ * wholesale at runtime; that is not encoded at the type level).
6994
+ */
6995
+ type AgentWidgetConfigPatch = ConfigPatch<AgentWidgetConfig>;
6996
+ type ConfigPatch<T> = T extends (...args: never[]) => unknown ? T : T extends readonly unknown[] ? T : T extends object ? {
6997
+ [K in keyof T]?: ConfigPatch<T[K]>;
6998
+ } : T;
6534
6999
  type AgentWidgetMessageRole = "user" | "assistant" | "system";
6535
7000
  type AgentWidgetReasoning = {
6536
7001
  id: string;
@@ -6624,6 +7089,25 @@ type AgentWidgetMessage = {
6624
7089
  * The `content` field contains the text-only representation for display.
6625
7090
  */
6626
7091
  contentParts?: ContentPart[];
7092
+ /**
7093
+ * Context mentions attached to this (user) message, for transcript fidelity +
7094
+ * chip rendering in the sent bubble. Refs only — the resolved payloads are
7095
+ * merged into `llmContent`/`contentParts` (model-visible) at send time.
7096
+ */
7097
+ contextMentions?: AgentWidgetContextMentionRef[];
7098
+ /**
7099
+ * Ordered prose + mention blocks for inline-mode rendering and composer history
7100
+ * recall (`contextMentions.display: "inline"`). Present only on inline-mode user
7101
+ * messages; when omitted the sent bubble falls back to the chip row derived from
7102
+ * `contextMentions`. Display/transcript concern only — not the model channel.
7103
+ */
7104
+ contentSegments?: AgentWidgetContentSegment[];
7105
+ /**
7106
+ * Resolved opt-in structured mention context for this (user) message, merged
7107
+ * into the request `context` under `mentions.<sourceId>.<itemId>` by the
7108
+ * client. Internal: set at send time from each source's `resolve().context`.
7109
+ */
7110
+ mentionContext?: Record<string, unknown>;
6627
7111
  streaming?: boolean;
6628
7112
  variant?: AgentWidgetMessageVariant;
6629
7113
  sequence?: number;
@@ -7222,6 +7706,23 @@ declare class AgentWidgetClient {
7222
7706
  streamResponse?: boolean;
7223
7707
  signal?: AbortSignal;
7224
7708
  }): Promise<Response>;
7709
+ /**
7710
+ * The opt-in structured mention channel: the MOST RECENT user turn's
7711
+ * `mentionContext` (set by `session.applyMentionBundle`) namespaced under
7712
+ * `mentions`. Only the latest user message is consulted — otherwise an older
7713
+ * turn's mentions would re-attach to `context.mentions` on every later send.
7714
+ * Returns null when the latest user turn carried no structured mention context.
7715
+ * The default model-visible path (`llmAppend`) already rode into the message's
7716
+ * `llmContent`/`contentParts`, so it needs nothing here.
7717
+ */
7718
+ private latestMentionContext;
7719
+ /**
7720
+ * Aggregate request `context`: merge every context provider's result with the
7721
+ * opt-in mention context from the latest user turn. Returns null when nothing
7722
+ * contributed, so callers can skip setting `payload.context`. Shared by the
7723
+ * agent and flow payload builders.
7724
+ */
7725
+ private buildContextAggregate;
7225
7726
  private buildAgentPayload;
7226
7727
  private buildPayload;
7227
7728
  /**
@@ -7232,6 +7733,19 @@ declare class AgentWidgetClient {
7232
7733
  private streamResponse;
7233
7734
  }
7234
7735
 
7736
+ /** The resolved bundle gathered at submit, merged into the user message. */
7737
+ interface MentionSubmitBundle {
7738
+ /**
7739
+ * Ready-to-join, per-mention LLM blocks (mentions-first). The mention layer
7740
+ * has already applied `contextMentions.llmFormat` (fenced/document/custom), so
7741
+ * the session just joins these with a blank line and appends the typed prose.
7742
+ */
7743
+ blocks: string[];
7744
+ contentParts: ContentPart[];
7745
+ /** Namespaced `{ [sourceId]: { [itemId]: context } }` for the opt-in path. */
7746
+ context: Record<string, Record<string, unknown>>;
7747
+ }
7748
+
7235
7749
  declare function createVoiceProvider(config: VoiceConfig): VoiceProvider;
7236
7750
  declare function createBestAvailableVoiceProvider(config?: Partial<VoiceConfig>): VoiceProvider;
7237
7751
  declare function isVoiceSupported(config?: Partial<VoiceConfig>): boolean;
@@ -7587,10 +8101,36 @@ declare class AgentWidgetSession {
7587
8101
  * });
7588
8102
  */
7589
8103
  injectComponentDirective(options: InjectComponentDirectiveOptions): AgentWidgetMessage;
8104
+ /**
8105
+ * Resolve the gathered mentions and merge them into the user message's
8106
+ * model-visible content. Default path is `llmAppend` → `llmContent` (or a text
8107
+ * `contentPart` when parts are present, since `contentParts` wins the priority
8108
+ * chain); the opt-in structured `context` lands on `mentionContext` for the
8109
+ * client to namespace into the request `context`. Failures were already
8110
+ * dropped by `finalize()`.
8111
+ */
8112
+ private applyMentionBundle;
7590
8113
  sendMessage(rawInput: string, options?: {
7591
8114
  viaVoice?: boolean;
7592
8115
  /** Multi-modal content parts (e.g., images) to include with the message */
7593
8116
  contentParts?: ContentPart[];
8117
+ /**
8118
+ * Context mentions gathered from the composer. `refs` echo immediately as
8119
+ * chips; `finalize()` resolves any pending/submit sources just before
8120
+ * dispatch (after the instant echo) and the bundle is merged into this
8121
+ * message's model-visible content.
8122
+ */
8123
+ mentions?: {
8124
+ refs: AgentWidgetContextMentionRef[];
8125
+ finalize: () => Promise<MentionSubmitBundle>;
8126
+ };
8127
+ /**
8128
+ * Ordered prose + mention segments for inline-mode display (`display:
8129
+ * "inline"`). Stored on the user message so its bubble re-renders `@tokens`
8130
+ * in place (and suppresses the chip row). Display/transcript only — the
8131
+ * model still sees resolved bodies via the `mentions` bundle above.
8132
+ */
8133
+ contentSegments?: AgentWidgetContentSegment[];
7594
8134
  }): Promise<void>;
7595
8135
  /**
7596
8136
  * Continue the conversation without adding a new user message.
@@ -8062,7 +8602,7 @@ declare function createCSATFeedback(options: CSATFeedbackOptions): HTMLElement;
8062
8602
  declare function createNPSFeedback(options: NPSFeedbackOptions): HTMLElement;
8063
8603
 
8064
8604
  type Controller = {
8065
- update: (config: AgentWidgetConfig) => void;
8605
+ update: (config: AgentWidgetConfigPatch) => void;
8066
8606
  destroy: () => void;
8067
8607
  open: () => void;
8068
8608
  close: () => void;
@@ -8602,6 +9142,7 @@ type MarkdownParsersModule = {
8602
9142
  Marked: typeof Marked;
8603
9143
  DOMPurify: typeof DOMPurify;
8604
9144
  };
9145
+ declare const loadMarkdownParsers: () => Promise<MarkdownParsersModule>;
8605
9146
  /**
8606
9147
  * Register `cb` to run once the markdown parsers (marked + DOMPurify) become
8607
9148
  * available, i.e. when the lazy `markdown-parsers.js` chunk resolves on the
@@ -8622,7 +9163,6 @@ type MarkdownParsersModule = {
8622
9163
  * Fires at most once per subscription.
8623
9164
  */
8624
9165
  declare const onMarkdownParsersReady: (cb: () => void) => (() => void);
8625
- declare const loadMarkdownParsers: () => Promise<MarkdownParsersModule>;
8626
9166
 
8627
9167
  /**
8628
9168
  * A function that sanitizes an HTML string, returning safe HTML.
@@ -8733,6 +9273,97 @@ declare function validateImageFile(file: File, acceptedTypes?: string[], maxSize
8733
9273
  error?: string;
8734
9274
  };
8735
9275
 
9276
+ /**
9277
+ * Default fuzzy matcher + static-source helper for context mentions.
9278
+ *
9279
+ * Pure and dependency-free so it can be exported for hosts (to filter
9280
+ * client-side sources) and unit-tested in isolation. Ranking tiers, best first:
9281
+ * 1. prefix — label starts with the query
9282
+ * 2. word-boundary — a word inside the label starts with the query
9283
+ * 3. subsequence — query chars appear in order anywhere in the label
9284
+ * Ties break by `recencyScore` (desc) then label (asc). An empty query returns
9285
+ * every item ordered by recency (recents/popular first).
9286
+ */
9287
+
9288
+ /**
9289
+ * Filter + rank items for the current `@query`. An empty query keeps all items,
9290
+ * recency-ordered. Non-matching items are dropped.
9291
+ */
9292
+ declare function defaultMentionFilter(items: AgentWidgetContextMentionItem[], query: string): AgentWidgetContextMentionItem[];
9293
+ /**
9294
+ * The easy path: a static, in-memory list filtered client-side with
9295
+ * {@link defaultMentionFilter}. Supply your own `resolve()` to turn a selected
9296
+ * item into a dispatch payload (lead with `llmAppend`).
9297
+ */
9298
+ declare function createStaticMentionSource(opts: {
9299
+ id: string;
9300
+ label: string;
9301
+ items: AgentWidgetContextMentionItem[];
9302
+ resolve: AgentWidgetContextMentionSource["resolve"];
9303
+ resolveOn?: "select" | "submit";
9304
+ }): AgentWidgetContextMentionSource;
9305
+ /**
9306
+ * A single slash-command definition for {@link createSlashCommandsSource}. Maps
9307
+ * to a menu item plus its dispatch behavior (see `AgentWidgetContextMentionItem.command`):
9308
+ * - `"prompt"` (default): `prompt` text is written into the composer (a macro).
9309
+ * - `"action"`: `action()` runs in the browser (no message sent).
9310
+ * - `"server"`: `data` is sent to the backend via request `context.mentions`.
9311
+ */
9312
+ type SlashCommandDefinition = {
9313
+ /** Command name shown after the trigger (e.g. "summarize" → `/summarize`). */
9314
+ name: string;
9315
+ /** Menu subtitle. */
9316
+ description?: string;
9317
+ /** Lucide icon name for the menu row / chip. */
9318
+ iconName?: string;
9319
+ /** Dispatch kind. @default "prompt" */
9320
+ kind?: "prompt" | "action" | "server";
9321
+ /** `kind:"prompt"` — composer text (static, or built from the typed args). */
9322
+ prompt?: string | ((args: string) => string);
9323
+ /** `kind:"prompt"` — insertion mode. @default "replace" */
9324
+ insertMode?: "replace" | "insert-at-caret";
9325
+ /** `kind:"prompt"` — submit the composer immediately after inserting. */
9326
+ submitOnSelect?: boolean;
9327
+ /**
9328
+ * Free-text argument hint (e.g. "order id"). Shown as ghost text in the menu
9329
+ * row (`lookup ‹order id›`) and switches the command to INLINE COMPLETION:
9330
+ * selecting it fills `/name ` into the composer so you type the arg inline,
9331
+ * and the command runs at SUBMIT with the typed args (Slack-style). Optional
9332
+ * for `"prompt"`/`"action"`; `"server"` commands always complete inline.
9333
+ */
9334
+ argsPlaceholder?: string;
9335
+ /** `kind:"action"` — the browser handler (receives parsed `args`). */
9336
+ action?: (ctx: AgentWidgetContextMentionCommandContext) => void | Promise<void>;
9337
+ /** `kind:"server"` — structured payload sent via `context.mentions.<sourceId>.<name>`. */
9338
+ data?: Record<string, unknown> | ((args: string) => Record<string, unknown>);
9339
+ };
9340
+ /**
9341
+ * Build a `/`-slash-command SOURCE for `contextMentions.triggers`. Unlike a
9342
+ * mention source, its items are COMMANDS (verbs): selecting one runs a prompt
9343
+ * macro, a client action, or a server skill (see {@link SlashCommandDefinition}).
9344
+ *
9345
+ * Matching is on the command NAME only (the first token of the query), so
9346
+ * `/deploy staging` still matches the `deploy` command while `staging` becomes
9347
+ * the command's `args`. Pair it with a `"/"` channel, typically at line-start:
9348
+ *
9349
+ * ```ts
9350
+ * contextMentions: {
9351
+ * enabled: true,
9352
+ * sources: [ ...mentionSources ], // @ context
9353
+ * triggers: [{
9354
+ * trigger: "/",
9355
+ * triggerPosition: "line-start",
9356
+ * sources: [createSlashCommandsSource({ id: "cmd", label: "Commands", commands })],
9357
+ * }],
9358
+ * }
9359
+ * ```
9360
+ */
9361
+ declare function createSlashCommandsSource(opts: {
9362
+ id: string;
9363
+ label: string;
9364
+ commands: SlashCommandDefinition[];
9365
+ }): AgentWidgetContextMentionSource;
9366
+
8736
9367
  /**
8737
9368
  * Enriched DOM context collection for providing richer page information to AI.
8738
9369
  *
@@ -9993,4 +10624,4 @@ interface RovingTablistController {
9993
10624
  }
9994
10625
  declare function createRovingTablist(container: HTMLElement, options: RovingTablistOptions): RovingTablistController;
9995
10626
 
9996
- export { ASK_USER_QUESTION_CLIENT_TOOL, ASK_USER_QUESTION_PARAMETERS_SCHEMA, ASK_USER_QUESTION_TOOL_NAME, type AgentConfig, type AgentExecutionState, type AgentLoopConfig, type AgentMessageMetadata, type AgentRequestOptions, type AgentToolsConfig, type AgentWidgetActionContext, type AgentWidgetActionEventPayload, type AgentWidgetActionHandler, type AgentWidgetActionHandlerResult, type AgentWidgetActionParser, type AgentWidgetAgentRequestPayload, type AgentWidgetApproval, type AgentWidgetApprovalConfig, type AgentWidgetApprovalDecisionOptions, type AgentWidgetArtifactsFeature, type AgentWidgetArtifactsLayoutConfig, type AgentWidgetAskUserQuestionFeature, type AgentWidgetAskUserQuestionStyles, type AgentWidgetAttachmentsConfig, type AgentWidgetAvatarConfig, AgentWidgetClient, type AgentWidgetComponentRenderer, type AgentWidgetComposerConfig, type AgentWidgetConfig, type AgentWidgetContextProvider, type AgentWidgetContextProviderContext, type AgentWidgetController, type AgentWidgetControllerEventMap, type AgentWidgetCustomFetch, type AgentWidgetDockConfig, type AgentWidgetEvent, type AgentWidgetFeatureFlags, type AgentWidgetHeaderLayoutConfig, type AgentWidgetHeadersFunction, type AgentWidgetInitHandle, type AgentWidgetInitOptions, type AgentWidgetLauncherConfig, type AgentWidgetLayoutConfig, type AgentWidgetLoadingIndicatorConfig, type AgentWidgetMarkdownConfig, type AgentWidgetMarkdownOptions, type AgentWidgetMarkdownRendererOverrides, type AgentWidgetMessage, type AgentWidgetMessageActionsConfig, type AgentWidgetMessageFeedback, type AgentWidgetMessageLayoutConfig, type AgentWidgetParsedAction, type AgentWidgetPlugin, type AgentWidgetReadAloudEvent, type AgentWidgetRequestPayload, type AgentWidgetSSEEventParser, type AgentWidgetSSEEventResult, type AgentWidgetScrollBehaviorFeature, type AgentWidgetScrollMode, type AgentWidgetScrollRestorePosition, type AgentWidgetScrollToBottomFeature, AgentWidgetSession, type AgentWidgetSessionStatus, type AgentWidgetStreamAnimationBuffer, type AgentWidgetStreamAnimationBuiltinType, type AgentWidgetStreamAnimationFeature, type AgentWidgetStreamAnimationPlaceholder, type AgentWidgetStreamAnimationType, type AgentWidgetStreamParser, type AgentWidgetStreamParserResult, type AgentWidgetTimestampConfig, type AgentWidgetVoiceStatusEvent, type AgentWidgetWebMcpConfig, type ArtifactConfigPayload, type ArtifactPaneTokens, type ArtifactTabTokens, type ArtifactToolbarTokens, type AskUserQuestionOption, type AskUserQuestionPayload, type AskUserQuestionPrompt, AttachmentManager, type AttachmentManagerConfig, type BorderScale, BrowserSpeechEngine, type BrowserSpeechEngineOptions, type CSATFeedbackOptions, type ClientChatRequest, type ClientFeedbackRequest, type ClientFeedbackType, type ClientInitResponse, type ClientSession, type ClientToolDefinition, type CodeFormat, type CodeGeneratorHooks, type CodeGeneratorOptions, type ColorPalette, type ColorShade, type ComboButtonHandle, type ComponentContext, type ComponentDirective, type ComponentRegistrationOptions, type ComponentRenderer, type ComponentTokens, type ComposerBuildContext, type ComposerElements, type ContentPart, type CreateComboButtonOptions, type CreateDropdownOptions, type CreateIconButtonOptions, type CreateLabelButtonOptions, type CreateStandardBubbleOptions, type CreateThemeOptions, type CreateToggleGroupOptions, DEFAULT_COMPONENTS, DEFAULT_FLOATING_LAUNCHER_MAX_WIDTH, DEFAULT_FLOATING_LAUNCHER_WIDTH, DEFAULT_PALETTE, DEFAULT_SEMANTIC, DEFAULT_WIDGET_CONFIG, type DeepPartial, type DemoCarouselHandle, type DemoCarouselItem, type DemoCarouselOptions, type DomContextMode, type DomContextOptions, type DropdownMenuHandle, type DropdownMenuItem, type EnrichedPageElement, type EventStreamBadgeColor, type EventStreamConfig, type EventStreamPayloadRenderContext, type EventStreamRowRenderContext, type EventStreamToolbarRenderContext, type EventStreamViewRenderContext, type FallbackSpeechEngineOptions, type FormatEnrichedContextOptions, type HeaderBuildContext, type HeaderElements, type HeaderLayoutContext, type HeaderLayoutRenderer, type HeaderRenderContext, type IconButtonTokens, type IconName, type IdleIndicatorRenderContext, type ImageContentPart, type InjectAssistantMessageOptions, type InjectComponentDirectiveOptions, type InjectMessageOptions, type InjectSystemMessageOptions, type InjectUserMessageOptions, type LabelButtonTokens, type LoadingIndicatorRenderContext, type LoadingIndicatorRenderer, type MarkdownParsersModule, type MarkdownProcessorOptions, type MessageActionCallbacks, type MessageContent, type MessageRenderContext, type MessageTransform, type NPSFeedbackOptions, PRESETS, PRESET_FULLSCREEN, PRESET_MINIMAL, PRESET_SHOP, type ParseOptionsConfig, type ParseRule, type PcmStreamPlayer, type PendingAttachment, type PersonaArtifactActionContext, type PersonaArtifactCustomAction, type PersonaArtifactDisplayMode, type PersonaArtifactKind, type PersonaArtifactManualUpsert, type PersonaArtifactRecord, type PersonaArtifactStatusLabelContext, type PersonaTheme, type PersonaThemePlugin, type RadiusScale, ReadAloudController, type ReadAloudListener, type ReadAloudState, type ResolvedTarget, type RovingTablistController, type RovingTablistOptions, type RuleScoringContext, type RuntypeClientChatRequest, type RuntypeClientChatStreamEvent, type RuntypeClientFeedbackRequest, type RuntypeClientFeedbackResponse, type RuntypeClientFeedbackType, type RuntypeClientInitRequest, type RuntypeClientInitResponse, type RuntypeClientResumeRequest, type RuntypeClientResumeStreamEvent, type RuntypeExecutionStreamEvent, type RuntypeFlowSSEEvent, type RuntypeStepCompleteEvent, type RuntypeStopReasonKind, type RuntypeStreamEventOf, type RuntypeTurnCompleteEvent, type SSEEventCallback, type SSEEventRecord, SUGGEST_REPLIES_CLIENT_TOOL, SUGGEST_REPLIES_PARAMETERS_SCHEMA, SUGGEST_REPLIES_TOOL_NAME, type SanitizeFunction, type SemanticColors, type SemanticSpacing, type SemanticTypography, type ShadowScale, type SlotRenderContext, type SlotRenderer, type SpacingScale, type SpeechCallbacks, type SpeechEngine, type SpeechRequest, type StreamAnimationContext, type StreamAnimationPlugin, THEME_ZONES, type TargetResolver, type TextContentPart, type ThemeValidationError, type ThemeValidationResult, type ThemeZone, type ToggleGroupHandle, type ToggleGroupItem, type ToggleGroupTokens, type TokenReference, type TypographyScale, VERSION, type VoiceConfig, type VoiceMetrics, type VoicePlaybackEngine, type VoiceProvider, type VoiceResult, type VoiceStatus, WEBMCP_TOOL_PREFIX, WebMcpBridge, type WebMcpConfirmHandler, type WebMcpConfirmInfo, type WebMcpToolResult, type WidgetHostLayout, type WidgetHostLayoutMode, type WidgetLayoutSlot, type WidgetPreset, accessibilityPlugin, animationsPlugin, applyThemeVariables, attachHeaderToContainer, brandPlugin, buildComposer, buildDefaultHeader, buildHeader, buildHeaderWithLayout, buildMinimalHeader, builtInClientToolsForDispatch, collectEnrichedPageContext, componentRegistry, createActionManager, createAgentExperience, createAskUserQuestionBubble, createBestAvailableVoiceProvider, createBubbleWithLayout, createCSATFeedback, createComboButton, createComponentMiddleware, createComponentStreamParser, createDefaultSanitizer, createDemoCarousel, createDirectivePostprocessor, createDropdownMenu, createFlexibleJsonStreamParser, createIconButton, createImagePart, createJsonStreamParser, createLabelButton, createLocalStorageAdapter, createMarkdownProcessor, createMarkdownProcessorFromConfig, createMessageActions, createNPSFeedback, createPlainTextParser, createPlugin, createRegexJsonParser, createRovingTablist, createStandardBubble, createTextPart, createTheme, createThemeObserver, createToggleGroup, createTypingIndicator, createVoiceProvider, createWidgetHostLayout, createXmlParser, initAgentWidget as default, defaultActionHandlers, defaultJsonActionParser, defaultParseRules, detectColorScheme, directivePostprocessor, ensureAskUserQuestionSheet, escapeHtml, extractComponentDirectiveFromMessage, fileToImagePart, formatEnrichedContext, generateAssistantMessageId, generateCodeSnippet, generateMessageId, generateStableSelector, generateUserMessageId, getActiveTheme, getColorScheme, getDisplayText, getHeaderLayout, getImageParts, getPreset, hasComponentDirective, hasImages, headerLayouts, highContrastPlugin, initAgentWidget, isAskUserQuestionMessage, isComponentDirectiveType, isDockedMountMode, isSuggestRepliesMessage, isVoiceSupported, isWebMcpToolName, latestAgentSuggestions, listRegisteredStreamAnimations, loadMarkdownParsers, markdownPostprocessor, mergeWithDefaults, normalizeContent, onMarkdownParsersReady, parseAskUserQuestionPayload, parseSuggestRepliesPayload, pickBestVoice, pluginRegistry, reducedMotionPlugin, registerStreamAnimationPlugin, removeAskUserQuestionSheet, renderComponentDirective, renderLoadingIndicatorWithFallback, renderLucideIcon, resolveDockConfig, resolveSanitizer, resolveTokens, stripWebMcpPrefix, themeToCssVariables, unregisterStreamAnimationPlugin, validateImageFile, validateTheme };
10627
+ export { ASK_USER_QUESTION_CLIENT_TOOL, ASK_USER_QUESTION_PARAMETERS_SCHEMA, ASK_USER_QUESTION_TOOL_NAME, type AgentConfig, type AgentExecutionState, type AgentLoopConfig, type AgentMessageMetadata, type AgentRequestOptions, type AgentToolsConfig, type AgentWidgetActionContext, type AgentWidgetActionEventPayload, type AgentWidgetActionHandler, type AgentWidgetActionHandlerResult, type AgentWidgetActionParser, type AgentWidgetAgentRequestPayload, type AgentWidgetApproval, type AgentWidgetApprovalConfig, type AgentWidgetApprovalDecisionOptions, type AgentWidgetArtifactsFeature, type AgentWidgetArtifactsLayoutConfig, type AgentWidgetAskUserQuestionFeature, type AgentWidgetAskUserQuestionStyles, type AgentWidgetAttachmentsConfig, type AgentWidgetAvatarConfig, AgentWidgetClient, type AgentWidgetComponentRenderer, type AgentWidgetComposerConfig, type AgentWidgetConfig, type AgentWidgetConfigPatch, type AgentWidgetContextMentionChipRenderContext, type AgentWidgetContextMentionCommandContext, type AgentWidgetContextMentionComposerCapability, type AgentWidgetContextMentionConfig, type AgentWidgetContextMentionItem, type AgentWidgetContextMentionItemRenderContext, type AgentWidgetContextMentionMenuRenderContext, type AgentWidgetContextMentionPayload, type AgentWidgetContextMentionRef, type AgentWidgetContextMentionResolveContext, type AgentWidgetContextMentionSearchContext, type AgentWidgetContextMentionSource, type AgentWidgetContextMentionTokenRenderContext, type AgentWidgetContextProvider, type AgentWidgetContextProviderContext, type AgentWidgetController, type AgentWidgetControllerEventMap, type AgentWidgetCustomFetch, type AgentWidgetDockConfig, type AgentWidgetEvent, type AgentWidgetFeatureFlags, type AgentWidgetHeaderLayoutConfig, type AgentWidgetHeadersFunction, type AgentWidgetInitHandle, type AgentWidgetInitOptions, type AgentWidgetLauncherConfig, type AgentWidgetLayoutConfig, type AgentWidgetLoadingIndicatorConfig, type AgentWidgetMarkdownConfig, type AgentWidgetMarkdownOptions, type AgentWidgetMarkdownRendererOverrides, type AgentWidgetMentionLlmEntry, type AgentWidgetMentionTriggerChannel, type AgentWidgetMentionTriggerPosition, type AgentWidgetMessage, type AgentWidgetMessageActionsConfig, type AgentWidgetMessageFeedback, type AgentWidgetMessageLayoutConfig, type AgentWidgetParsedAction, type AgentWidgetPlugin, type AgentWidgetReadAloudEvent, type AgentWidgetRequestPayload, type AgentWidgetSSEEventParser, type AgentWidgetSSEEventResult, type AgentWidgetScrollBehaviorFeature, type AgentWidgetScrollMode, type AgentWidgetScrollRestorePosition, type AgentWidgetScrollToBottomFeature, AgentWidgetSession, type AgentWidgetSessionStatus, type AgentWidgetStreamAnimationBuffer, type AgentWidgetStreamAnimationBuiltinType, type AgentWidgetStreamAnimationFeature, type AgentWidgetStreamAnimationPlaceholder, type AgentWidgetStreamAnimationType, type AgentWidgetStreamParser, type AgentWidgetStreamParserResult, type AgentWidgetTimestampConfig, type AgentWidgetVoiceStatusEvent, type AgentWidgetWebMcpConfig, type ArtifactConfigPayload, type ArtifactPaneTokens, type ArtifactTabTokens, type ArtifactToolbarTokens, type AskUserQuestionOption, type AskUserQuestionPayload, type AskUserQuestionPrompt, AttachmentManager, type AttachmentManagerConfig, type BorderScale, BrowserSpeechEngine, type BrowserSpeechEngineOptions, type CSATFeedbackOptions, type ClientChatRequest, type ClientFeedbackRequest, type ClientFeedbackType, type ClientInitResponse, type ClientSession, type ClientToolDefinition, type CodeFormat, type CodeGeneratorHooks, type CodeGeneratorOptions, type ColorPalette, type ColorShade, type ComboButtonHandle, type ComponentContext, type ComponentDirective, type ComponentRegistrationOptions, type ComponentRenderer, type ComponentTokens, type ComposerBuildContext, type ComposerElements, type ContentPart, type CreateComboButtonOptions, type CreateDropdownOptions, type CreateIconButtonOptions, type CreateLabelButtonOptions, type CreateStandardBubbleOptions, type CreateThemeOptions, type CreateToggleGroupOptions, DEFAULT_COMPONENTS, DEFAULT_FLOATING_LAUNCHER_MAX_WIDTH, DEFAULT_FLOATING_LAUNCHER_WIDTH, DEFAULT_PALETTE, DEFAULT_SEMANTIC, DEFAULT_WIDGET_CONFIG, type DeepPartial, type DemoCarouselHandle, type DemoCarouselItem, type DemoCarouselOptions, type DomContextMode, type DomContextOptions, type DropdownMenuHandle, type DropdownMenuItem, type EnrichedPageElement, type EventStreamBadgeColor, type EventStreamConfig, type EventStreamPayloadRenderContext, type EventStreamRowRenderContext, type EventStreamToolbarRenderContext, type EventStreamViewRenderContext, type FallbackSpeechEngineOptions, type FormatEnrichedContextOptions, type HeaderBuildContext, type HeaderElements, type HeaderLayoutContext, type HeaderLayoutRenderer, type HeaderRenderContext, type IconButtonTokens, type IconName, type IdleIndicatorRenderContext, type ImageContentPart, type InjectAssistantMessageOptions, type InjectComponentDirectiveOptions, type InjectMessageOptions, type InjectSystemMessageOptions, type InjectUserMessageOptions, type LabelButtonTokens, type LoadingIndicatorRenderContext, type LoadingIndicatorRenderer, type MarkdownParsersModule, type MarkdownProcessorOptions, type MessageActionCallbacks, type MessageContent, type MessageRenderContext, type MessageTransform, type NPSFeedbackOptions, PRESETS, PRESET_FULLSCREEN, PRESET_MINIMAL, PRESET_SHOP, type ParseOptionsConfig, type ParseRule, type PcmStreamPlayer, type PendingAttachment, type PersonaArtifactActionContext, type PersonaArtifactCustomAction, type PersonaArtifactDisplayMode, type PersonaArtifactKind, type PersonaArtifactManualUpsert, type PersonaArtifactRecord, type PersonaArtifactStatusLabelContext, type PersonaTheme, type PersonaThemePlugin, type RadiusScale, ReadAloudController, type ReadAloudListener, type ReadAloudState, type ResolvedTarget, type RovingTablistController, type RovingTablistOptions, type RuleScoringContext, type RuntypeClientChatRequest, type RuntypeClientChatStreamEvent, type RuntypeClientFeedbackRequest, type RuntypeClientFeedbackResponse, type RuntypeClientFeedbackType, type RuntypeClientInitRequest, type RuntypeClientInitResponse, type RuntypeClientResumeRequest, type RuntypeClientResumeStreamEvent, type RuntypeExecutionStreamEvent, type RuntypeFlowSSEEvent, type RuntypeStepCompleteEvent, type RuntypeStopReasonKind, type RuntypeStreamEventOf, type RuntypeTurnCompleteEvent, type SSEEventCallback, type SSEEventRecord, SUGGEST_REPLIES_CLIENT_TOOL, SUGGEST_REPLIES_PARAMETERS_SCHEMA, SUGGEST_REPLIES_TOOL_NAME, type SanitizeFunction, type SemanticColors, type SemanticSpacing, type SemanticTypography, type ShadowScale, type SlashCommandDefinition, type SlotRenderContext, type SlotRenderer, type SpacingScale, type SpeechCallbacks, type SpeechEngine, type SpeechRequest, type StreamAnimationContext, type StreamAnimationPlugin, THEME_ZONES, type TargetResolver, type TextContentPart, type ThemeValidationError, type ThemeValidationResult, type ThemeZone, type ToggleGroupHandle, type ToggleGroupItem, type ToggleGroupTokens, type TokenReference, type TypographyScale, VERSION, type VoiceConfig, type VoiceMetrics, type VoicePlaybackEngine, type VoiceProvider, type VoiceResult, type VoiceStatus, WEBMCP_TOOL_PREFIX, WebMcpBridge, type WebMcpConfirmHandler, type WebMcpConfirmInfo, type WebMcpToolResult, type WidgetHostLayout, type WidgetHostLayoutMode, type WidgetLayoutSlot, type WidgetPreset, accessibilityPlugin, animationsPlugin, applyThemeVariables, attachHeaderToContainer, brandPlugin, buildComposer, buildDefaultHeader, buildHeader, buildHeaderWithLayout, buildMinimalHeader, builtInClientToolsForDispatch, collectEnrichedPageContext, componentRegistry, createActionManager, createAgentExperience, createAskUserQuestionBubble, createBestAvailableVoiceProvider, createBubbleWithLayout, createCSATFeedback, createComboButton, createComponentMiddleware, createComponentStreamParser, createDefaultSanitizer, createDemoCarousel, createDirectivePostprocessor, createDropdownMenu, createFlexibleJsonStreamParser, createIconButton, createImagePart, createJsonStreamParser, createLabelButton, createLocalStorageAdapter, createMarkdownProcessor, createMarkdownProcessorFromConfig, createMessageActions, createNPSFeedback, createPlainTextParser, createPlugin, createRegexJsonParser, createRovingTablist, createSlashCommandsSource, createStandardBubble, createStaticMentionSource, createTextPart, createTheme, createThemeObserver, createToggleGroup, createTypingIndicator, createVoiceProvider, createWidgetHostLayout, createXmlParser, initAgentWidget as default, defaultActionHandlers, defaultJsonActionParser, defaultMentionFilter, defaultParseRules, detectColorScheme, directivePostprocessor, ensureAskUserQuestionSheet, escapeHtml, extractComponentDirectiveFromMessage, fileToImagePart, formatEnrichedContext, generateAssistantMessageId, generateCodeSnippet, generateMessageId, generateStableSelector, generateUserMessageId, getActiveTheme, getColorScheme, getDisplayText, getHeaderLayout, getImageParts, getPreset, hasComponentDirective, hasImages, headerLayouts, highContrastPlugin, initAgentWidget, isAskUserQuestionMessage, isComponentDirectiveType, isDockedMountMode, isSuggestRepliesMessage, isVoiceSupported, isWebMcpToolName, latestAgentSuggestions, listRegisteredStreamAnimations, loadMarkdownParsers, markdownPostprocessor, mergeWithDefaults, normalizeContent, onMarkdownParsersReady, parseAskUserQuestionPayload, parseSuggestRepliesPayload, pickBestVoice, pluginRegistry, reducedMotionPlugin, registerStreamAnimationPlugin, removeAskUserQuestionSheet, renderComponentDirective, renderLoadingIndicatorWithFallback, renderLucideIcon, resolveDockConfig, resolveSanitizer, resolveTokens, stripWebMcpPrefix, themeToCssVariables, unregisterStreamAnimationPlugin, validateImageFile, validateTheme };