@runtypelabs/persona 3.17.0 → 3.18.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.
- package/README.md +142 -0
- package/dist/animations/glyph-cycle.d.cts +1 -1
- package/dist/animations/glyph-cycle.d.ts +1 -1
- package/dist/animations/{types-HPZY7oAI.d.cts → types-cwY5HaFD.d.cts} +25 -0
- package/dist/animations/{types-HPZY7oAI.d.ts → types-cwY5HaFD.d.ts} +25 -0
- package/dist/animations/wipe.d.cts +1 -1
- package/dist/animations/wipe.d.ts +1 -1
- package/dist/index.cjs +47 -47
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +300 -1
- package/dist/index.d.ts +300 -1
- package/dist/index.global.js +75 -75
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +47 -47
- package/dist/index.js.map +1 -1
- package/dist/theme-editor.cjs +1432 -159
- package/dist/theme-editor.d.cts +218 -0
- package/dist/theme-editor.d.ts +218 -0
- package/dist/theme-editor.js +1432 -159
- package/dist/theme-reference.cjs +1 -1
- package/dist/theme-reference.d.cts +14 -0
- package/dist/theme-reference.d.ts +14 -0
- package/dist/widget.css +432 -0
- package/package.json +1 -1
- package/src/client.test.ts +134 -0
- package/src/client.ts +71 -0
- package/src/components/ask-user-question-bubble.test.ts +583 -0
- package/src/components/ask-user-question-bubble.ts +924 -0
- package/src/components/messages.ts +33 -1
- package/src/components/panel.ts +41 -4
- package/src/defaults.ts +21 -0
- package/src/index.ts +16 -1
- package/src/plugins/types.ts +57 -0
- package/src/session.test.ts +183 -0
- package/src/session.ts +242 -3
- package/src/styles/widget.css +432 -0
- package/src/types/theme.ts +15 -0
- package/src/types.ts +150 -0
- package/src/ui.ask-user-question-plugin.test.ts +649 -0
- package/src/ui.ts +631 -5
- package/src/utils/storage.ts +10 -2
- package/src/utils/theme.test.ts +36 -0
- package/src/utils/tokens.ts +23 -0
package/dist/index.d.ts
CHANGED
|
@@ -91,6 +91,61 @@ interface AgentWidgetPlugin {
|
|
|
91
91
|
defaultRenderer: () => HTMLElement;
|
|
92
92
|
config: AgentWidgetConfig;
|
|
93
93
|
}) => HTMLElement | null;
|
|
94
|
+
/**
|
|
95
|
+
* Custom renderer for `ask_user_question` tool calls.
|
|
96
|
+
*
|
|
97
|
+
* When a plugin returns an `HTMLElement`, it is inserted into the transcript
|
|
98
|
+
* in place of the default (which is no transcript bubble — the built-in
|
|
99
|
+
* renders a sheet over the composer). The built-in composer-overlay sheet
|
|
100
|
+
* is suppressed so the plugin's UI fully owns the interaction.
|
|
101
|
+
*
|
|
102
|
+
* Return `null` to fall through to the built-in overlay sheet.
|
|
103
|
+
*
|
|
104
|
+
* The context gives you a pre-parsed `payload` (may be partial while the
|
|
105
|
+
* tool call is still streaming — check `complete`) and two callbacks:
|
|
106
|
+
* `resolve(answer)` resumes the paused LOCAL tool with the user's answer,
|
|
107
|
+
* and `dismiss()` cancels with the sentinel `"(dismissed)"`.
|
|
108
|
+
*
|
|
109
|
+
* @example
|
|
110
|
+
* ```typescript
|
|
111
|
+
* renderAskUserQuestion: ({ payload, resolve, dismiss }) => {
|
|
112
|
+
* const prompt = payload.questions?.[0];
|
|
113
|
+
* if (!prompt) return null;
|
|
114
|
+
* const root = document.createElement("div");
|
|
115
|
+
* root.textContent = prompt.question ?? "";
|
|
116
|
+
* (prompt.options ?? []).forEach((option) => {
|
|
117
|
+
* const btn = document.createElement("button");
|
|
118
|
+
* btn.textContent = option.label;
|
|
119
|
+
* btn.addEventListener("click", () => resolve(option.label));
|
|
120
|
+
* root.appendChild(btn);
|
|
121
|
+
* });
|
|
122
|
+
* return root;
|
|
123
|
+
* }
|
|
124
|
+
* ```
|
|
125
|
+
*/
|
|
126
|
+
renderAskUserQuestion?: (context: {
|
|
127
|
+
message: AgentWidgetMessage;
|
|
128
|
+
/**
|
|
129
|
+
* Parsed `{ questions: [...] }` payload. May be partial while the tool
|
|
130
|
+
* call is still streaming; see `complete`. `null` when no payload has
|
|
131
|
+
* arrived yet.
|
|
132
|
+
*/
|
|
133
|
+
payload: Partial<AskUserQuestionPayload> | null;
|
|
134
|
+
/** `true` once the tool-call args have fully streamed in. */
|
|
135
|
+
complete: boolean;
|
|
136
|
+
/**
|
|
137
|
+
* Resume the paused LOCAL tool with the user's answer. Posts to the
|
|
138
|
+
* resume endpoint, pipes the SSE stream back into the session, and
|
|
139
|
+
* appends a user-visible answer bubble to the transcript.
|
|
140
|
+
*/
|
|
141
|
+
resolve: (answer: string) => void;
|
|
142
|
+
/**
|
|
143
|
+
* Cancel the question. Resumes with the sentinel `"(dismissed)"` so the
|
|
144
|
+
* server doesn't sit in `waiting_for_local` forever. Idempotent.
|
|
145
|
+
*/
|
|
146
|
+
dismiss: () => void;
|
|
147
|
+
config: AgentWidgetConfig;
|
|
148
|
+
}) => HTMLElement | null;
|
|
94
149
|
/**
|
|
95
150
|
* Custom renderer for approval bubbles
|
|
96
151
|
* Return null to use default renderer
|
|
@@ -384,6 +439,18 @@ interface MessageTokens {
|
|
|
384
439
|
/** Border color between messages in the thread. */
|
|
385
440
|
border?: TokenReference<'color'>;
|
|
386
441
|
}
|
|
442
|
+
/**
|
|
443
|
+
* Welcome / intro card rendered above the message list when no messages exist.
|
|
444
|
+
* Set `copy.showWelcomeCard: false` to hide it; use `layout.slots["body-top"]`
|
|
445
|
+
* to replace it wholesale.
|
|
446
|
+
*/
|
|
447
|
+
interface IntroCardTokens extends ComponentTokenSet {
|
|
448
|
+
background?: TokenReference<'color'>;
|
|
449
|
+
borderRadius?: TokenReference<'radius'>;
|
|
450
|
+
padding?: TokenReference<'spacing'>;
|
|
451
|
+
/** Box-shadow on the intro card (token ref or raw CSS, e.g. `none`). */
|
|
452
|
+
shadow?: string;
|
|
453
|
+
}
|
|
387
454
|
/** Collapsible widget chrome (tool bubbles, reasoning bubbles, approval bubbles). */
|
|
388
455
|
interface CollapsibleWidgetTokens {
|
|
389
456
|
/** Background for content areas. */
|
|
@@ -581,6 +648,8 @@ interface ComponentTokens {
|
|
|
581
648
|
panel: PanelTokens;
|
|
582
649
|
header: HeaderTokens;
|
|
583
650
|
message: MessageTokens;
|
|
651
|
+
/** Welcome / intro card shown above the message list. */
|
|
652
|
+
introCard?: IntroCardTokens;
|
|
584
653
|
/** Markdown surfaces (chat + artifact pane). */
|
|
585
654
|
markdown?: MarkdownTokens;
|
|
586
655
|
voice: VoiceTokens;
|
|
@@ -829,6 +898,31 @@ type AgentMessageMetadata = {
|
|
|
829
898
|
* or `prompt` step inside the nested flow). Stable key for that step.
|
|
830
899
|
*/
|
|
831
900
|
parentStepId?: string;
|
|
901
|
+
/**
|
|
902
|
+
* Set to `true` on a tool-variant message produced from a `step_await`
|
|
903
|
+
* event (`awaitReason: "local_tool_required"`). Signals to UI code that
|
|
904
|
+
* the tool call is a LOCAL tool and the server is paused waiting for a
|
|
905
|
+
* `POST /v1/dispatch/resume` with the user's answer keyed by tool name.
|
|
906
|
+
*/
|
|
907
|
+
awaitingLocalTool?: boolean;
|
|
908
|
+
/**
|
|
909
|
+
* Set to `true` once the user has picked / typed / dismissed an answer for
|
|
910
|
+
* an `ask_user_question` tool call, so renderers stop re-mounting the
|
|
911
|
+
* answer-pill sheet for this tool call on subsequent render passes.
|
|
912
|
+
*/
|
|
913
|
+
askUserQuestionAnswered?: boolean;
|
|
914
|
+
/**
|
|
915
|
+
* In-progress answers for a multi-question `ask_user_question` payload,
|
|
916
|
+
* keyed by question text. Persisted across refresh so the user lands back
|
|
917
|
+
* where they were if the page reloads mid-flow. Cleared once
|
|
918
|
+
* `askUserQuestionAnswered` flips to `true`.
|
|
919
|
+
*/
|
|
920
|
+
askUserQuestionAnswers?: Record<string, string | string[]>;
|
|
921
|
+
/**
|
|
922
|
+
* Current page index for a multi-question `ask_user_question` payload's
|
|
923
|
+
* paginated stepper. Persists alongside `askUserQuestionAnswers`.
|
|
924
|
+
*/
|
|
925
|
+
askUserQuestionIndex?: number;
|
|
832
926
|
};
|
|
833
927
|
type AgentWidgetRequestMiddlewareContext = {
|
|
834
928
|
payload: AgentWidgetRequestPayload;
|
|
@@ -876,6 +970,8 @@ type AgentWidgetActionHandler = (action: AgentWidgetParsedAction, context: Agent
|
|
|
876
970
|
type AgentWidgetStoredState = {
|
|
877
971
|
messages?: AgentWidgetMessage[];
|
|
878
972
|
metadata?: Record<string, unknown>;
|
|
973
|
+
artifacts?: PersonaArtifactRecord[];
|
|
974
|
+
selectedArtifactId?: string | null;
|
|
879
975
|
};
|
|
880
976
|
interface AgentWidgetStorageAdapter {
|
|
881
977
|
load?: () => AgentWidgetStoredState | null | Promise<AgentWidgetStoredState | null>;
|
|
@@ -1433,6 +1529,113 @@ type AgentWidgetFeatureFlags = {
|
|
|
1433
1529
|
artifacts?: AgentWidgetArtifactsFeature;
|
|
1434
1530
|
/** Reveal animation for streaming assistant text. */
|
|
1435
1531
|
streamAnimation?: AgentWidgetStreamAnimationFeature;
|
|
1532
|
+
/**
|
|
1533
|
+
* Built-in interactive answer-pill sheet shown when the assistant invokes
|
|
1534
|
+
* the `ask_user_question` tool. Slides up over the composer with tappable
|
|
1535
|
+
* pills + optional free-text input.
|
|
1536
|
+
*/
|
|
1537
|
+
askUserQuestion?: AgentWidgetAskUserQuestionFeature;
|
|
1538
|
+
};
|
|
1539
|
+
/**
|
|
1540
|
+
* Single selectable option in an `ask_user_question` prompt.
|
|
1541
|
+
* Mirrors Anthropic's AskUserQuestion schema.
|
|
1542
|
+
*/
|
|
1543
|
+
type AskUserQuestionOption = {
|
|
1544
|
+
/** Pill label (required). */
|
|
1545
|
+
label: string;
|
|
1546
|
+
/** Optional long-form description (shown as a subtitle on tap-hover). */
|
|
1547
|
+
description?: string;
|
|
1548
|
+
/** Optional rich preview — reserved for future rendering; ignored in v1. */
|
|
1549
|
+
preview?: string;
|
|
1550
|
+
};
|
|
1551
|
+
/**
|
|
1552
|
+
* A single question in an `ask_user_question` tool call.
|
|
1553
|
+
* The tool may carry 1–8 prompts. When more than one is supplied, the built-in
|
|
1554
|
+
* renderer paginates them as a "Question N of M" stepper with Back / Next /
|
|
1555
|
+
* Submit-all controls; single-question payloads render without stepper chrome.
|
|
1556
|
+
*/
|
|
1557
|
+
type AskUserQuestionPrompt = {
|
|
1558
|
+
/** The question text shown to the user. */
|
|
1559
|
+
question: string;
|
|
1560
|
+
/** Optional short header label (≤12 chars) used as a compact group title. */
|
|
1561
|
+
header?: string;
|
|
1562
|
+
/** 2–4 selectable options. */
|
|
1563
|
+
options: AskUserQuestionOption[];
|
|
1564
|
+
/** When true, the user can pick multiple options and submit together. Default false. */
|
|
1565
|
+
multiSelect?: boolean;
|
|
1566
|
+
/** When true, a free-text "Other…" pill expands to an input. Default true. */
|
|
1567
|
+
allowFreeText?: boolean;
|
|
1568
|
+
};
|
|
1569
|
+
/** Parsed payload of an `ask_user_question` tool call. */
|
|
1570
|
+
type AskUserQuestionPayload = {
|
|
1571
|
+
/** 1–8 questions. Anything beyond the renderer's cap is truncated with a console warning. */
|
|
1572
|
+
questions: AskUserQuestionPrompt[];
|
|
1573
|
+
};
|
|
1574
|
+
/**
|
|
1575
|
+
* Style overrides for the answer-pill sheet. All values are raw CSS strings
|
|
1576
|
+
* and are plumbed through as CSS custom properties on the sheet root.
|
|
1577
|
+
*/
|
|
1578
|
+
type AgentWidgetAskUserQuestionStyles = {
|
|
1579
|
+
sheetBackground?: string;
|
|
1580
|
+
sheetBorder?: string;
|
|
1581
|
+
sheetShadow?: string;
|
|
1582
|
+
pillBackground?: string;
|
|
1583
|
+
pillBackgroundSelected?: string;
|
|
1584
|
+
pillTextColor?: string;
|
|
1585
|
+
pillTextColorSelected?: string;
|
|
1586
|
+
pillBorderRadius?: string;
|
|
1587
|
+
customInputBackground?: string;
|
|
1588
|
+
};
|
|
1589
|
+
/**
|
|
1590
|
+
* Feature config for the built-in `ask_user_question` answer-pill sheet.
|
|
1591
|
+
* When a tool call with the name `ask_user_question` arrives, the widget
|
|
1592
|
+
* renders an interactive sheet over the composer in place of the generic
|
|
1593
|
+
* tool bubble.
|
|
1594
|
+
*/
|
|
1595
|
+
type AgentWidgetAskUserQuestionFeature = {
|
|
1596
|
+
/** Enable the feature. Defaults to true. When false, `ask_user_question` renders as a regular tool bubble. */
|
|
1597
|
+
enabled?: boolean;
|
|
1598
|
+
/** Slide-in animation duration in ms. Defaults to 180. */
|
|
1599
|
+
slideInMs?: number;
|
|
1600
|
+
/** Label for the free-text pill. Defaults to "Other…". */
|
|
1601
|
+
freeTextLabel?: string;
|
|
1602
|
+
/** Placeholder text in the free-text input. Defaults to "Type your answer…". */
|
|
1603
|
+
freeTextPlaceholder?: string;
|
|
1604
|
+
/** Button label for submitting multi-select / free-text answers. Defaults to "Send". */
|
|
1605
|
+
submitLabel?: string;
|
|
1606
|
+
/** Button label advancing to the next question in grouped (paginated) payloads. Defaults to "Next". */
|
|
1607
|
+
nextLabel?: string;
|
|
1608
|
+
/** Button label moving back to the previous question in grouped payloads. Defaults to "Back". */
|
|
1609
|
+
backLabel?: string;
|
|
1610
|
+
/** Button label submitting all answers from the final page of a grouped payload. Defaults to "Submit all". */
|
|
1611
|
+
submitAllLabel?: string;
|
|
1612
|
+
/**
|
|
1613
|
+
* In grouped (multi-question) mode, auto-advance to the next page after a
|
|
1614
|
+
* single-select pill pick or free-text submit on intermediate pages.
|
|
1615
|
+
* Defaults to `true`. The final page never auto-submits — users always
|
|
1616
|
+
* confirm with an explicit "Submit all" click. Multi-select pages always
|
|
1617
|
+
* require an explicit Next regardless of this setting.
|
|
1618
|
+
*/
|
|
1619
|
+
groupedAutoAdvance?: boolean;
|
|
1620
|
+
/**
|
|
1621
|
+
* Visual layout for the option list.
|
|
1622
|
+
* - `"rows"` (default) — full-width stacked rows with always-visible
|
|
1623
|
+
* descriptions, right-edge number badges (single-select) or checkboxes
|
|
1624
|
+
* (multi-select), and an always-visible inline "Other" input.
|
|
1625
|
+
* - `"pills"` — legacy compact pill list with horizontal wrap; description
|
|
1626
|
+
* surfaces as a tooltip and the "Other…" pill expands on click.
|
|
1627
|
+
*/
|
|
1628
|
+
layout?: "rows" | "pills";
|
|
1629
|
+
/**
|
|
1630
|
+
* Button label for skipping the current question in grouped payloads.
|
|
1631
|
+
* Defaults to "Skip". On intermediate pages Skip advances without recording
|
|
1632
|
+
* an answer; on the final page Skip submits the partial answer record
|
|
1633
|
+
* (skipped questions absent from the resolved object). For single-question
|
|
1634
|
+
* payloads Skip behaves like dismiss.
|
|
1635
|
+
*/
|
|
1636
|
+
skipLabel?: string;
|
|
1637
|
+
/** Style overrides for the sheet and pills. */
|
|
1638
|
+
styles?: AgentWidgetAskUserQuestionStyles;
|
|
1436
1639
|
};
|
|
1437
1640
|
type SSEEventRecord = {
|
|
1438
1641
|
id: string;
|
|
@@ -3288,6 +3491,17 @@ type AgentWidgetConfig = {
|
|
|
3288
3491
|
autoFocusInput?: boolean;
|
|
3289
3492
|
launcher?: AgentWidgetLauncherConfig;
|
|
3290
3493
|
initialMessages?: AgentWidgetMessage[];
|
|
3494
|
+
/**
|
|
3495
|
+
* Artifacts to hydrate into the pane at init. Typically populated from
|
|
3496
|
+
* `storageAdapter.load()` alongside `initialMessages` so the artifact pane
|
|
3497
|
+
* survives a page refresh.
|
|
3498
|
+
*/
|
|
3499
|
+
initialArtifacts?: PersonaArtifactRecord[];
|
|
3500
|
+
/**
|
|
3501
|
+
* Which artifact id (if any) should be selected in the pane at init. Paired
|
|
3502
|
+
* with `initialArtifacts`.
|
|
3503
|
+
*/
|
|
3504
|
+
initialSelectedArtifactId?: string | null;
|
|
3291
3505
|
suggestionChips?: string[];
|
|
3292
3506
|
suggestionChipsConfig?: AgentWidgetSuggestionChipsConfig;
|
|
3293
3507
|
debug?: boolean;
|
|
@@ -4157,6 +4371,22 @@ declare class AgentWidgetClient {
|
|
|
4157
4371
|
executionId: string;
|
|
4158
4372
|
approvalId: string;
|
|
4159
4373
|
}, decision: 'approved' | 'denied'): Promise<Response>;
|
|
4374
|
+
/**
|
|
4375
|
+
* Resume a paused flow execution by supplying outputs for LOCAL
|
|
4376
|
+
* (client-executed) tools. Used by the built-in `ask_user_question`
|
|
4377
|
+
* answer-pill sheet, but generic enough for any LOCAL tool.
|
|
4378
|
+
*
|
|
4379
|
+
* Posts to the upstream `/resume` endpoint (the dispatch URL with
|
|
4380
|
+
* `/dispatch` replaced by `/resume` — works for both direct-to-Runtype
|
|
4381
|
+
* and the persona proxy) and returns the raw Response so the caller can
|
|
4382
|
+
* pipe its SSE body through `connectStream()`.
|
|
4383
|
+
*
|
|
4384
|
+
* @param executionId - The paused execution id carried on `step_await`.
|
|
4385
|
+
* @param toolOutputs - Map keyed by tool name → the tool's result value.
|
|
4386
|
+
*/
|
|
4387
|
+
resumeFlow(executionId: string, toolOutputs: Record<string, unknown>, options?: {
|
|
4388
|
+
streamResponse?: boolean;
|
|
4389
|
+
}): Promise<Response>;
|
|
4160
4390
|
private buildAgentPayload;
|
|
4161
4391
|
private buildPayload;
|
|
4162
4392
|
/**
|
|
@@ -4419,6 +4649,37 @@ declare class AgentWidgetSession {
|
|
|
4419
4649
|
* and pipes the response stream through connectStream().
|
|
4420
4650
|
*/
|
|
4421
4651
|
resolveApproval(approval: AgentWidgetApproval, decision: 'approved' | 'denied'): Promise<void>;
|
|
4652
|
+
/**
|
|
4653
|
+
* Resolve a paused `ask_user_question` LOCAL tool call.
|
|
4654
|
+
*
|
|
4655
|
+
* When the server emits `step_await` for `ask_user_question`, the widget
|
|
4656
|
+
* renders the answer-pill sheet and calls this method once the user
|
|
4657
|
+
* picks. Steps:
|
|
4658
|
+
* 1. POST the answer to `/resume` via `client.resumeFlow`.
|
|
4659
|
+
* 2. Pipe the resulting SSE stream through `connectStream()` so the
|
|
4660
|
+
* paused agent execution continues.
|
|
4661
|
+
* 3. Append a user-visible bubble with the answer text so the
|
|
4662
|
+
* transcript reads naturally.
|
|
4663
|
+
*/
|
|
4664
|
+
/**
|
|
4665
|
+
* Persist in-progress answers and the current page index for a multi-question
|
|
4666
|
+
* `ask_user_question` payload, so a refresh resumes on the same page with
|
|
4667
|
+
* prior answers intact. Called by ui.ts on every Back/Next/pick interaction.
|
|
4668
|
+
*/
|
|
4669
|
+
persistAskUserQuestionProgress(toolMessage: AgentWidgetMessage, progress: {
|
|
4670
|
+
answers: Record<string, string | string[]>;
|
|
4671
|
+
currentIndex: number;
|
|
4672
|
+
}): void;
|
|
4673
|
+
/**
|
|
4674
|
+
* Flip an `ask_user_question` tool message from awaiting → answered so
|
|
4675
|
+
* render passes stop re-mounting its answer-pill sheet. Idempotent.
|
|
4676
|
+
* When `answers` is provided, persists the full structured answer Record
|
|
4677
|
+
* atomically with the answered flag — guarding against later events that
|
|
4678
|
+
* could re-emit the tool message and clobber the per-pick persisted
|
|
4679
|
+
* answers via top-level merge.
|
|
4680
|
+
*/
|
|
4681
|
+
markAskUserQuestionResolved(toolMessage: AgentWidgetMessage, answers?: Record<string, string | string[]>): void;
|
|
4682
|
+
resolveAskUserQuestion(toolMessage: AgentWidgetMessage, answer: string | Record<string, string | string[]>): Promise<void>;
|
|
4422
4683
|
cancel(): void;
|
|
4423
4684
|
clearMessages(): void;
|
|
4424
4685
|
getArtifacts(): PersonaArtifactRecord[];
|
|
@@ -4431,6 +4692,7 @@ declare class AgentWidgetSession {
|
|
|
4431
4692
|
private emitArtifactsState;
|
|
4432
4693
|
private applyArtifactStreamEvent;
|
|
4433
4694
|
hydrateMessages(messages: AgentWidgetMessage[]): void;
|
|
4695
|
+
hydrateArtifacts(artifacts: PersonaArtifactRecord[], selectedId?: string | null): void;
|
|
4434
4696
|
private handleEvent;
|
|
4435
4697
|
private setStatus;
|
|
4436
4698
|
private setStreaming;
|
|
@@ -4592,6 +4854,10 @@ type Controller = {
|
|
|
4592
4854
|
upsertArtifact: (manual: PersonaArtifactManualUpsert) => PersonaArtifactRecord | null;
|
|
4593
4855
|
selectArtifact: (id: string) => void;
|
|
4594
4856
|
clearArtifacts: () => void;
|
|
4857
|
+
/** Read current artifacts (useful on init to rebuild host-side tab state after hydration). */
|
|
4858
|
+
getArtifacts: () => PersonaArtifactRecord[];
|
|
4859
|
+
/** Read the currently selected artifact id (paired with `getArtifacts`). */
|
|
4860
|
+
getSelectedArtifactId: () => string | null;
|
|
4595
4861
|
/**
|
|
4596
4862
|
* Focus the chat input. Returns true if focus succeeded, false if panel is closed
|
|
4597
4863
|
* (launcher mode) or textarea is unavailable.
|
|
@@ -4614,6 +4880,39 @@ type AgentWidgetInitHandle = AgentWidgetController & {
|
|
|
4614
4880
|
};
|
|
4615
4881
|
declare const initAgentWidget: (options: AgentWidgetInitOptions) => AgentWidgetInitHandle;
|
|
4616
4882
|
|
|
4883
|
+
declare const ASK_USER_QUESTION_TOOL_NAME = "ask_user_question";
|
|
4884
|
+
declare const isAskUserQuestionMessage: (message: AgentWidgetMessage) => boolean;
|
|
4885
|
+
/**
|
|
4886
|
+
* Parse an `ask_user_question` tool-variant message into a partial payload.
|
|
4887
|
+
* Safe to call mid-stream — will walk the tool call's `chunks` via
|
|
4888
|
+
* `partial-json` and return `{ payload: null, complete: false }` when there
|
|
4889
|
+
* isn't enough data yet. `complete` flips to `true` once the tool call
|
|
4890
|
+
* reports status `"complete"`.
|
|
4891
|
+
*
|
|
4892
|
+
* Exported for plugin authors implementing `renderAskUserQuestion`.
|
|
4893
|
+
*/
|
|
4894
|
+
declare const parseAskUserQuestionPayload: (message: AgentWidgetMessage) => {
|
|
4895
|
+
payload: Partial<AskUserQuestionPayload> | null;
|
|
4896
|
+
complete: boolean;
|
|
4897
|
+
};
|
|
4898
|
+
/**
|
|
4899
|
+
* Create the small in-transcript stub for an `ask_user_question` tool call.
|
|
4900
|
+
* The stub is passive — the interactive sheet is mounted separately into
|
|
4901
|
+
* the composer overlay via `ensureAskUserQuestionSheet`.
|
|
4902
|
+
*/
|
|
4903
|
+
declare const createAskUserQuestionBubble: (message: AgentWidgetMessage, config?: AgentWidgetConfig) => HTMLElement;
|
|
4904
|
+
/**
|
|
4905
|
+
* Mount or update the interactive answer-pill sheet for a given message.
|
|
4906
|
+
* Idempotent — if a sheet already exists for the tool-call id, it is hydrated
|
|
4907
|
+
* in-place instead of remounted, so streaming updates don't flicker.
|
|
4908
|
+
*/
|
|
4909
|
+
declare const ensureAskUserQuestionSheet: (message: AgentWidgetMessage, config: AgentWidgetConfig | undefined, overlay: HTMLElement | null | undefined) => void;
|
|
4910
|
+
/**
|
|
4911
|
+
* Remove the sheet for a specific tool-call id, or all sheets if omitted.
|
|
4912
|
+
* Runs a slide-out transition before removing.
|
|
4913
|
+
*/
|
|
4914
|
+
declare const removeAskUserQuestionSheet: (overlay: HTMLElement | null | undefined, toolCallId?: string) => void;
|
|
4915
|
+
|
|
4617
4916
|
type WidgetHostLayoutMode = "direct" | "docked";
|
|
4618
4917
|
type WidgetHostLayout = {
|
|
4619
4918
|
mode: WidgetHostLayoutMode;
|
|
@@ -6084,4 +6383,4 @@ declare function createVoiceProvider(config: VoiceConfig): VoiceProvider;
|
|
|
6084
6383
|
declare function createBestAvailableVoiceProvider(config?: Partial<VoiceConfig>): VoiceProvider;
|
|
6085
6384
|
declare function isVoiceSupported(config?: Partial<VoiceConfig>): boolean;
|
|
6086
6385
|
|
|
6087
|
-
export { type AgentConfig, type AgentExecutionState, type AgentLoopConfig, type AgentMessageMetadata, type AgentRequestOptions, type AgentToolsConfig, type AgentWidgetAgentRequestPayload, type AgentWidgetApproval, type AgentWidgetApprovalConfig, type AgentWidgetArtifactsFeature, type AgentWidgetArtifactsLayoutConfig, type AgentWidgetAttachmentsConfig, type AgentWidgetAvatarConfig, AgentWidgetClient, type AgentWidgetComposerConfig, type AgentWidgetConfig, 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 AgentWidgetPlugin, type AgentWidgetRequestPayload, type AgentWidgetSSEEventParser, type AgentWidgetSSEEventResult, AgentWidgetSession, type AgentWidgetSessionStatus, type AgentWidgetStreamAnimationBuffer, type AgentWidgetStreamAnimationBuiltinType, type AgentWidgetStreamAnimationFeature, type AgentWidgetStreamAnimationPlaceholder, type AgentWidgetStreamAnimationType, type AgentWidgetStreamParser, type AgentWidgetStreamParserResult, type AgentWidgetTimestampConfig, type ArtifactConfigPayload, type ArtifactPaneTokens, type ArtifactTabTokens, type ArtifactToolbarTokens, AttachmentManager, type AttachmentManagerConfig, type BorderScale, type CSATFeedbackOptions, type ClientChatRequest, type ClientFeedbackRequest, type ClientFeedbackType, type ClientInitResponse, type ClientSession, type CodeFormat, type CodeGeneratorHooks, type CodeGeneratorOptions, type ColorPalette, type ColorShade, type ComboButtonHandle, type ComponentContext, type ComponentDirective, 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 FormatEnrichedContextOptions, type HeaderBuildContext, type HeaderElements, type HeaderLayoutContext, type HeaderLayoutRenderer, type HeaderRenderContext, type IconButtonTokens, type IdleIndicatorRenderContext, type ImageContentPart, type InjectAssistantMessageOptions, type InjectMessageOptions, type InjectSystemMessageOptions, type InjectUserMessageOptions, type LabelButtonTokens, type LoadingIndicatorRenderContext, type LoadingIndicatorRenderer, type MarkdownProcessorOptions, type MessageActionCallbacks, type MessageContent, type MessageRenderContext, type MessageTransform, type NPSFeedbackOptions, PRESETS, PRESET_FULLSCREEN, PRESET_MINIMAL, PRESET_SHOP, type ParseOptionsConfig, type ParseRule, type PendingAttachment, type PersonaArtifactKind, type PersonaArtifactManualUpsert, type PersonaArtifactRecord, type PersonaTheme, type PersonaThemePlugin, type RadiusScale, type RuleScoringContext, type SSEEventCallback, type SSEEventRecord, type SanitizeFunction, type SemanticColors, type SemanticSpacing, type SemanticTypography, type ShadowScale, type SlotRenderContext, type SlotRenderer, type SpacingScale, type StreamAnimationContext, type StreamAnimationPlugin, THEME_ZONES, type TextContentPart, type ThemeValidationError, type ThemeValidationResult, type ThemeZone, type ToggleGroupHandle, type ToggleGroupItem, type ToggleGroupTokens, type TokenReference, type TypographyScale, VERSION, type VoiceConfig, type VoiceProvider, type VoiceResult, type VoiceStatus, type WidgetHostLayout, type WidgetHostLayoutMode, type WidgetLayoutSlot, type WidgetPreset, accessibilityPlugin, animationsPlugin, applyThemeVariables, attachHeaderToContainer, brandPlugin, buildComposer, buildDefaultHeader, buildHeader, buildHeaderWithLayout, buildMinimalHeader, collectEnrichedPageContext, componentRegistry, createActionManager, createAgentExperience, createBestAvailableVoiceProvider, createBubbleWithLayout, createCSATFeedback, createComboButton, createComponentMiddleware, createComponentStreamParser, createDefaultSanitizer, createDemoCarousel, createDirectivePostprocessor, createDropdownMenu, createFlexibleJsonStreamParser, createIconButton, createImagePart, createJsonStreamParser, createLabelButton, createLocalStorageAdapter, createMarkdownProcessor, createMarkdownProcessorFromConfig, createMessageActions, createNPSFeedback, createPlainTextParser, createPlugin, createRegexJsonParser, createStandardBubble, createTextPart, createTheme, createThemeObserver, createToggleGroup, createTypingIndicator, createVoiceProvider, createWidgetHostLayout, createXmlParser, initAgentWidget as default, defaultActionHandlers, defaultJsonActionParser, defaultParseRules, detectColorScheme, directivePostprocessor, escapeHtml, extractComponentDirectiveFromMessage, fileToImagePart, formatEnrichedContext, generateAssistantMessageId, generateCodeSnippet, generateMessageId, generateStableSelector, generateUserMessageId, getActiveTheme, getColorScheme, getDisplayText, getHeaderLayout, getImageParts, getPreset, hasComponentDirective, hasImages, headerLayouts, highContrastPlugin, initAgentWidget, isComponentDirectiveType, isDockedMountMode, isVoiceSupported, listRegisteredStreamAnimations, markdownPostprocessor, mergeWithDefaults, normalizeContent, pluginRegistry, reducedMotionPlugin, registerStreamAnimationPlugin, renderComponentDirective, renderLoadingIndicatorWithFallback, resolveDockConfig, resolveSanitizer, resolveTokens, themeToCssVariables, unregisterStreamAnimationPlugin, validateImageFile, validateTheme };
|
|
6386
|
+
export { ASK_USER_QUESTION_TOOL_NAME, type AgentConfig, type AgentExecutionState, type AgentLoopConfig, type AgentMessageMetadata, type AgentRequestOptions, type AgentToolsConfig, type AgentWidgetAgentRequestPayload, type AgentWidgetApproval, type AgentWidgetApprovalConfig, type AgentWidgetArtifactsFeature, type AgentWidgetArtifactsLayoutConfig, type AgentWidgetAskUserQuestionFeature, type AgentWidgetAskUserQuestionStyles, type AgentWidgetAttachmentsConfig, type AgentWidgetAvatarConfig, AgentWidgetClient, type AgentWidgetComposerConfig, type AgentWidgetConfig, 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 AgentWidgetPlugin, type AgentWidgetRequestPayload, type AgentWidgetSSEEventParser, type AgentWidgetSSEEventResult, AgentWidgetSession, type AgentWidgetSessionStatus, type AgentWidgetStreamAnimationBuffer, type AgentWidgetStreamAnimationBuiltinType, type AgentWidgetStreamAnimationFeature, type AgentWidgetStreamAnimationPlaceholder, type AgentWidgetStreamAnimationType, type AgentWidgetStreamParser, type AgentWidgetStreamParserResult, type AgentWidgetTimestampConfig, type ArtifactConfigPayload, type ArtifactPaneTokens, type ArtifactTabTokens, type ArtifactToolbarTokens, type AskUserQuestionOption, type AskUserQuestionPayload, type AskUserQuestionPrompt, AttachmentManager, type AttachmentManagerConfig, type BorderScale, type CSATFeedbackOptions, type ClientChatRequest, type ClientFeedbackRequest, type ClientFeedbackType, type ClientInitResponse, type ClientSession, type CodeFormat, type CodeGeneratorHooks, type CodeGeneratorOptions, type ColorPalette, type ColorShade, type ComboButtonHandle, type ComponentContext, type ComponentDirective, 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 FormatEnrichedContextOptions, type HeaderBuildContext, type HeaderElements, type HeaderLayoutContext, type HeaderLayoutRenderer, type HeaderRenderContext, type IconButtonTokens, type IdleIndicatorRenderContext, type ImageContentPart, type InjectAssistantMessageOptions, type InjectMessageOptions, type InjectSystemMessageOptions, type InjectUserMessageOptions, type LabelButtonTokens, type LoadingIndicatorRenderContext, type LoadingIndicatorRenderer, type MarkdownProcessorOptions, type MessageActionCallbacks, type MessageContent, type MessageRenderContext, type MessageTransform, type NPSFeedbackOptions, PRESETS, PRESET_FULLSCREEN, PRESET_MINIMAL, PRESET_SHOP, type ParseOptionsConfig, type ParseRule, type PendingAttachment, type PersonaArtifactKind, type PersonaArtifactManualUpsert, type PersonaArtifactRecord, type PersonaTheme, type PersonaThemePlugin, type RadiusScale, type RuleScoringContext, type SSEEventCallback, type SSEEventRecord, type SanitizeFunction, type SemanticColors, type SemanticSpacing, type SemanticTypography, type ShadowScale, type SlotRenderContext, type SlotRenderer, type SpacingScale, type StreamAnimationContext, type StreamAnimationPlugin, THEME_ZONES, type TextContentPart, type ThemeValidationError, type ThemeValidationResult, type ThemeZone, type ToggleGroupHandle, type ToggleGroupItem, type ToggleGroupTokens, type TokenReference, type TypographyScale, VERSION, type VoiceConfig, type VoiceProvider, type VoiceResult, type VoiceStatus, type WidgetHostLayout, type WidgetHostLayoutMode, type WidgetLayoutSlot, type WidgetPreset, accessibilityPlugin, animationsPlugin, applyThemeVariables, attachHeaderToContainer, brandPlugin, buildComposer, buildDefaultHeader, buildHeader, buildHeaderWithLayout, buildMinimalHeader, 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, 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, isVoiceSupported, listRegisteredStreamAnimations, markdownPostprocessor, mergeWithDefaults, normalizeContent, parseAskUserQuestionPayload, pluginRegistry, reducedMotionPlugin, registerStreamAnimationPlugin, removeAskUserQuestionSheet, renderComponentDirective, renderLoadingIndicatorWithFallback, resolveDockConfig, resolveSanitizer, resolveTokens, themeToCssVariables, unregisterStreamAnimationPlugin, validateImageFile, validateTheme };
|