@runtypelabs/persona 4.33.0 → 4.35.1
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/dist/activity-ui.d.cts +3 -15
- package/dist/activity-ui.d.ts +3 -15
- package/dist/animations/glyph-cycle.d.cts +1 -3
- package/dist/animations/glyph-cycle.d.ts +1 -3
- package/dist/animations/wipe.d.cts +1 -3
- package/dist/animations/wipe.d.ts +1 -3
- package/dist/approval-ui.cjs +2 -2
- package/dist/approval-ui.d.cts +3 -15
- package/dist/approval-ui.d.ts +3 -15
- package/dist/approval-ui.js +1 -1
- package/dist/artifacts-ui.cjs +1 -1
- package/dist/artifacts-ui.d.cts +3 -21
- package/dist/artifacts-ui.d.ts +3 -21
- package/dist/background-runtime.d.cts +2 -3
- package/dist/background-runtime.d.ts +2 -3
- package/dist/{chunk-DW7Vg_l2.js → chunk-B1P8w9_X.js} +1 -1
- package/dist/{chunk-D6U0E82p.js → chunk-B30Jdgg6.js} +1 -1
- package/dist/{chunk-gu34lr-P.js → chunk-Brdx4NCz.js} +1 -1
- package/dist/{chunk-6CUrH_jm.js → chunk-Bzo9GaAi.js} +1 -1
- package/dist/{chunk-Ds_twaZn.js → chunk-C4v-HNhS.js} +1 -1
- package/dist/{chunk-Bkma5hIU.js → chunk-CE4seJxF.js} +1 -1
- package/dist/chunk-CNBMBx-Y.js +2 -0
- package/dist/{chunk-ql5N2I_t.js → chunk-CWzHNuVK.js} +1 -1
- package/dist/{chunk-DbGLjU2P.js → chunk-CYpt7PsO.js} +1 -1
- package/dist/chunk-Cd8mp8Sv.js +1 -0
- package/dist/chunk-CsfE8WRG.js +1 -0
- package/dist/{chunk-DOZmcve8.js → chunk-Csr59G5V.js} +1 -1
- package/dist/{chunk-Co3VVwGe.js → chunk-D2pHRNEq.js} +0 -0
- package/dist/chunk-D3kZO8u-.js +1 -0
- package/dist/chunk-DAthf5H3.js +1 -0
- package/dist/{chunk-CXQJG7pb.js → chunk-DZ_aillY.js} +2 -2
- package/dist/{chunk-6C23QQdP.js → chunk-DgJV9zbK.js} +1 -1
- package/dist/chunk-Dv6KtIT1.js +1 -0
- package/dist/chunk-Dws8IrdR.js +1 -0
- package/dist/chunk-ThxxD8oK.js +1 -0
- package/dist/{chunk-C-EHtpbB.js → chunk-h5aOI_Pa.js} +1 -1
- package/dist/chunk-kizhspe5.js +1 -0
- package/dist/client-dispatch.js +1 -1
- package/dist/client-history.js +1 -1
- package/dist/client-stream.js +1 -1
- package/dist/{code-generators-DqauYyfX.d.cts → code-generators-DPAqTcAz.d.cts} +0 -2
- package/dist/{code-generators-DqauYyfX.d.ts → code-generators-DPAqTcAz.d.ts} +0 -2
- package/dist/codegen.cjs +1 -1
- package/dist/codegen.d.cts +1 -1
- package/dist/codegen.d.ts +1 -1
- package/dist/codegen.js +1 -1
- package/dist/composer-actions-runtime.cjs +1 -1
- package/dist/composer-actions-runtime.d.cts +4 -20
- package/dist/composer-actions-runtime.d.ts +4 -20
- package/dist/composer-actions-runtime.js +1 -1
- package/dist/{composer-input-DnqGCXZz.d.ts → composer-input-BSDNPOqV.d.cts} +1 -7
- package/dist/{composer-input-DnqGCXZz.d.cts → composer-input-BSDNPOqV.d.ts} +1 -7
- package/dist/{composer-store-6Iwy6WLI.d.ts → composer-store-DC-gAjtN.d.cts} +1 -3
- package/dist/{composer-store-6Iwy6WLI.d.cts → composer-store-DC-gAjtN.d.ts} +1 -3
- package/dist/config-diagnostics.d.cts +0 -2
- package/dist/config-diagnostics.d.ts +0 -2
- package/dist/{context-mention-manager-B-rHF98n.d.ts → context-mention-manager-CCpeoGL2.d.cts} +2 -6
- package/dist/{context-mention-manager-B-rHF98n.d.cts → context-mention-manager-CCpeoGL2.d.ts} +2 -6
- package/dist/context-mentions-inline.cjs +1 -1
- package/dist/context-mentions-inline.d.cts +2 -4
- package/dist/context-mentions-inline.d.ts +2 -4
- package/dist/context-mentions-inline.js +1 -1
- package/dist/context-mentions.cjs +2 -2
- package/dist/context-mentions.d.cts +3 -9
- package/dist/context-mentions.d.ts +3 -9
- package/dist/context-mentions.js +1 -1
- package/dist/{defaults-BuOjqUAG.d.ts → defaults-tj5RcN8r.d.cts} +1 -5
- package/dist/{defaults-BuOjqUAG.d.cts → defaults-tj5RcN8r.d.ts} +1 -5
- package/dist/dictation-runtime.cjs +1 -1
- package/dist/dictation-runtime.d.cts +4 -13
- package/dist/dictation-runtime.d.ts +4 -13
- package/dist/dictation-runtime.js +1 -1
- package/dist/{dom-context-DHTabIn7.d.cts → dom-context-Bw-_9Evh.d.cts} +0 -2
- package/dist/{dom-context-DHTabIn7.d.ts → dom-context-Bw-_9Evh.d.ts} +0 -2
- package/dist/event-stream-view.cjs +1 -1
- package/dist/event-stream-view.d.cts +3 -16
- package/dist/event-stream-view.d.ts +3 -16
- package/dist/{fallback-speech-engine-SqEfkGda.d.ts → fallback-speech-engine-gkhbjLiZ.d.cts} +1 -3
- package/dist/{fallback-speech-engine-SqEfkGda.d.cts → fallback-speech-engine-gkhbjLiZ.d.ts} +1 -3
- package/dist/{feature-preferences-DqAmje-2.d.ts → feature-preferences-CerDWGZ7.d.cts} +1 -5
- package/dist/{feature-preferences-DqAmje-2.d.cts → feature-preferences-CerDWGZ7.d.ts} +1 -5
- package/dist/forms-ui.d.cts +2 -4
- package/dist/forms-ui.d.ts +2 -4
- package/dist/{history-confirm-dialog-B3L7QNcO.d.cts → history-confirm-dialog-CrkSB3Ra.d.cts} +2 -14
- package/dist/{history-confirm-dialog-B3L7QNcO.d.ts → history-confirm-dialog-CrkSB3Ra.d.ts} +2 -14
- package/dist/history-shell.cjs +1 -1
- package/dist/history-shell.d.cts +8 -27
- package/dist/history-shell.d.ts +8 -27
- package/dist/history-shell.js +1 -1
- package/dist/history-view.d.cts +1 -1
- package/dist/history-view.d.ts +1 -1
- package/dist/icons-extra.cjs +1 -1
- package/dist/icons-extra.d.cts +0 -2
- package/dist/icons-extra.d.ts +0 -2
- package/dist/index.cjs +44 -44
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +10 -10
- package/dist/index.d.ts +10 -10
- package/dist/index.global.js +1 -1
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +50 -50
- package/dist/index.js.map +1 -1
- package/dist/install.global.js +1 -1
- package/dist/install.global.js.map +1 -1
- package/dist/launcher.global.js +2 -2
- package/dist/launcher.global.js.map +1 -1
- package/dist/{loading-label-runtime-loader-JecjOfJS.d.ts → loading-label-runtime-loader-fWIRrhUF.d.cts} +1 -3
- package/dist/{loading-label-runtime-loader-JecjOfJS.d.cts → loading-label-runtime-loader-fWIRrhUF.d.ts} +1 -3
- package/dist/loading-label-runtime.cjs +1 -1
- package/dist/loading-label-runtime.d.cts +1 -1
- package/dist/loading-label-runtime.d.ts +1 -1
- package/dist/loading-label-runtime.js +1 -1
- package/dist/markdown-parsers.js +1 -1
- package/dist/{message-bubble-CBYtpDsT.d.ts → message-bubble-Czc0lOHr.d.cts} +20 -3
- package/dist/{message-bubble-CBYtpDsT.d.cts → message-bubble-Czc0lOHr.d.ts} +20 -3
- package/dist/{plugin-kit-C1mRjLgW.d.cts → plugin-kit-C30jE-cw.d.cts} +3 -3
- package/dist/{plugin-kit-C1mRjLgW.d.ts → plugin-kit-C30jE-cw.d.ts} +3 -3
- package/dist/plugin-kit.cjs +1 -1
- package/dist/plugin-kit.d.cts +1 -1
- package/dist/plugin-kit.d.ts +1 -1
- package/dist/plugin-kit.js +1 -1
- package/dist/preferences-runtime.cjs +1 -1
- package/dist/preferences-runtime.d.cts +1 -1
- package/dist/preferences-runtime.d.ts +1 -1
- package/dist/preferences-runtime.js +1 -1
- package/dist/{preview-_UJwwt2L.d.cts → preview-D-osV3FU.d.cts} +2 -6
- package/dist/{preview-_UJwwt2L.d.ts → preview-D-osV3FU.d.ts} +2 -6
- package/dist/{registry-B5ZV3K-h.d.ts → registry-B6w91tx0.d.cts} +1 -8
- package/dist/{registry-B5ZV3K-h.d.cts → registry-B6w91tx0.d.ts} +1 -8
- package/dist/{session-Bys8_XuB.d.cts → session-BUQrs3Of.d.cts} +10 -93
- package/dist/{session-Bys8_XuB.d.ts → session-BUQrs3Of.d.ts} +10 -93
- package/dist/session-reconnect.d.cts +2 -4
- package/dist/session-reconnect.d.ts +2 -4
- package/dist/smart-dom-reader.d.cts +2 -8
- package/dist/smart-dom-reader.d.ts +2 -8
- package/dist/testing.d.cts +0 -2
- package/dist/testing.d.ts +0 -2
- package/dist/theme-editor-preview.cjs +50 -50
- package/dist/theme-editor-preview.d.cts +1 -1
- package/dist/theme-editor-preview.d.ts +1 -1
- package/dist/theme-editor-preview.js +25 -25
- package/dist/theme-editor.cjs +25 -5
- package/dist/theme-editor.d.cts +2 -22
- package/dist/theme-editor.d.ts +2 -22
- package/dist/theme-editor.js +1 -1
- package/dist/theme-reference.cjs +1 -1
- package/dist/theme-reference.d.cts +2 -4
- package/dist/theme-reference.d.ts +2 -4
- package/dist/theme-reference.js +1 -1
- package/dist/{tool-loading-animation-d5qAQcwv.d.ts → tool-loading-animation-B7XUf8TN.d.cts} +1 -7
- package/dist/{tool-loading-animation-d5qAQcwv.d.cts → tool-loading-animation-B7XUf8TN.d.ts} +1 -7
- package/dist/{tooltip-BkW-8MnD.d.cts → tooltip-DbXkAuJL.d.cts} +0 -2
- package/dist/{tooltip-BkW-8MnD.d.ts → tooltip-DbXkAuJL.d.ts} +0 -2
- package/dist/{turn-activity-ui-q6fHVnx-.d.cts → turn-activity-ui-CohuNMHT.d.cts} +2 -12
- package/dist/{turn-activity-ui-q6fHVnx-.d.ts → turn-activity-ui-CohuNMHT.d.ts} +2 -12
- package/dist/turn-activity-ui.d.cts +1 -1
- package/dist/turn-activity-ui.d.ts +1 -1
- package/dist/{types-B_mj21jg.d.cts → types-9i0xcAMT.d.cts} +128 -29
- package/dist/{types-B_mj21jg.d.ts → types-9i0xcAMT.d.ts} +128 -29
- package/dist/ui-extras.js +3 -3
- package/dist/voice-client-tools.d.cts +1 -3
- package/dist/voice-client-tools.d.ts +1 -3
- package/dist/voice-runtime.cjs +1 -1
- package/dist/voice-runtime.d.cts +2 -12
- package/dist/voice-runtime.d.ts +2 -12
- package/dist/voice-runtime.js +2 -2
- package/dist/voice-worklet-player.d.cts +2 -6
- package/dist/voice-worklet-player.d.ts +2 -6
- package/dist/{webmcp-runtime-entry-ClEO3qdI.d.ts → webmcp-runtime-entry-XNaXa-9h.d.cts} +9 -5
- package/dist/{webmcp-runtime-entry-ClEO3qdI.d.cts → webmcp-runtime-entry-XNaXa-9h.d.ts} +9 -5
- package/dist/webmcp-runtime.cjs +1 -1
- package/dist/webmcp-runtime.d.cts +1 -1
- package/dist/webmcp-runtime.d.ts +1 -1
- package/dist/webmcp-runtime.js +1 -1
- package/dist/widget.css +1 -1
- package/package.json +5 -5
- package/src/client-dispatch.ts +13 -0
- package/src/client.ts +37 -2
- package/src/client.webmcp-require-confirm.test.ts +212 -0
- package/src/components/composer-model-picker.ts +0 -14
- package/src/components/composer-overflow-menu.ts +0 -15
- package/src/components/composer-tokens.ts +0 -20
- package/src/components/event-stream-view.test.ts +5 -0
- package/src/components/message-bubble.ts +26 -6
- package/src/components/scroll-to-bottom.test.ts +135 -0
- package/src/components/scroll-to-bottom.ts +50 -13
- package/src/components/user-message-collapse.ts +117 -0
- package/src/defaults.ts +6 -0
- package/src/generated/runtype-openapi-contract.ts +13 -0
- package/src/plugin-kit.test.ts +101 -0
- package/src/plugin-kit.ts +29 -1
- package/src/session.ts +6 -2
- package/src/session.webmcp.test.ts +32 -0
- package/src/styles/widget.css +56 -0
- package/src/theme-reference.ts +2 -2
- package/src/types/theme.ts +29 -0
- package/src/types.ts +84 -5
- package/src/ui.composer-models.test.ts +5 -7
- package/src/ui.composer-overflow.test.ts +14 -21
- package/src/ui.scroll-additive.test.ts +219 -117
- package/src/ui.scroll.test.ts +176 -13
- package/src/ui.ts +230 -107
- package/src/ui.turn-activity.test.ts +7 -7
- package/src/ui.user-message-collapse.test.ts +540 -0
- package/src/utils/auto-follow.test.ts +0 -38
- package/src/utils/auto-follow.ts +0 -35
- package/src/utils/context-mention-controller.test.ts +56 -0
- package/src/utils/theme.test.ts +23 -0
- package/src/utils/tokens.ts +16 -0
- package/src/webmcp-bridge.test.ts +102 -0
- package/src/webmcp-runtime-entry.ts +29 -1
- package/dist/chunk-BAkaTZpd.js +0 -1
- package/dist/chunk-BEDTp-dm.js +0 -1
- package/dist/chunk-C7-m0EmI.js +0 -1
- package/dist/chunk-CNhThrLX.js +0 -1
- package/dist/chunk-CVMIncEY.js +0 -1
- package/dist/chunk-CzLEhoB_.js +0 -2
- package/dist/chunk-DVgzoVCB.js +0 -1
- package/dist/chunk-d54BJdKd.js +0 -1
- package/dist/chunk-dLJWKfOb.js +0 -1
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { IconNode } from "lucide";
|
|
2
|
-
//#region src/welcome.d.ts
|
|
3
2
|
interface ResolvedWelcomeConfig {
|
|
4
3
|
title: string;
|
|
5
4
|
/** Empty string when unset: the renderer omits the line. */
|
|
@@ -37,8 +36,6 @@ declare const resolveWelcomeConfig: (config?: AgentWidgetConfig, fullscreen?: bo
|
|
|
37
36
|
* transcript activity; `dismiss: "never"` keeps the authored surface visible.
|
|
38
37
|
*/
|
|
39
38
|
declare const isWelcomeVisible: (resolved: ResolvedWelcomeConfig, messages: readonly AgentWidgetMessage[] | undefined) => boolean;
|
|
40
|
-
//#endregion
|
|
41
|
-
//#region src/utils/plugin-storage.d.ts
|
|
42
39
|
/**
|
|
43
40
|
* Synchronous key-value store handed to plugin render hooks. Backed by
|
|
44
41
|
* `localStorage`, namespaced per plugin id. The async `storageAdapter` cannot
|
|
@@ -49,8 +46,6 @@ interface AgentWidgetPluginStorage {
|
|
|
49
46
|
set: (key: string, value: string) => void;
|
|
50
47
|
remove: (key: string) => void;
|
|
51
48
|
}
|
|
52
|
-
//#endregion
|
|
53
|
-
//#region src/utils/shortcuts.d.ts
|
|
54
49
|
/**
|
|
55
50
|
* Keyboard shortcuts: one declaration, three artifacts that cannot drift — the
|
|
56
51
|
* keydown binding, the tooltip hint chip (`formatCombo`), and the control's
|
|
@@ -86,8 +81,6 @@ declare const formatCombo: (combo: string) => string;
|
|
|
86
81
|
* elsewhere.
|
|
87
82
|
*/
|
|
88
83
|
declare const ariaCombo: (combo: string) => string;
|
|
89
|
-
//#endregion
|
|
90
|
-
//#region src/plugins/types.d.ts
|
|
91
84
|
type AgentWidgetTransformSuggestionsContext = {
|
|
92
85
|
/**
|
|
93
86
|
* Fresh copy of the suggestions entering this plugin, already normalized:
|
|
@@ -655,8 +648,6 @@ interface AgentWidgetPlugin {
|
|
|
655
648
|
*/
|
|
656
649
|
onUnregister?: () => void;
|
|
657
650
|
}
|
|
658
|
-
//#endregion
|
|
659
|
-
//#region src/types/theme.d.ts
|
|
660
651
|
/** Optional brand inputs, derived beneath explicit theme tokens. */
|
|
661
652
|
interface BrandConfig {
|
|
662
653
|
/** Opaque hex or rgb() color for primary actions and the accent ramp. */
|
|
@@ -1164,6 +1155,21 @@ interface MessageActionsTokens {
|
|
|
1164
1155
|
/** Button corner radius. Defaults to `palette.radius.md`. */
|
|
1165
1156
|
borderRadius?: TokenReference<'radius'>;
|
|
1166
1157
|
}
|
|
1158
|
+
/**
|
|
1159
|
+
* Long user message collapse (`features.userMessageCollapse`). Every key is
|
|
1160
|
+
* optional; unset, the fade and the toggle follow the user bubble's own text
|
|
1161
|
+
* color and type, so they already work on any fill in light and dark schemes.
|
|
1162
|
+
*/
|
|
1163
|
+
interface UserMessageCollapseTokens {
|
|
1164
|
+
/** Height of the bottom fade on a collapsed bubble. @default "48px" */
|
|
1165
|
+
fadeHeight?: string;
|
|
1166
|
+
/** "Show more" / "Show less" text color. Defaults to the user bubble text color. */
|
|
1167
|
+
toggleForeground?: TokenReference<'color'>;
|
|
1168
|
+
/** Toggle label type size. @default "0.8125rem" */
|
|
1169
|
+
toggleFontSize?: string;
|
|
1170
|
+
/** Toggle label weight. @default "600" */
|
|
1171
|
+
toggleFontWeight?: string;
|
|
1172
|
+
}
|
|
1167
1173
|
/**
|
|
1168
1174
|
* Bubble geometry and type, per role. Every key is unset by default and each
|
|
1169
1175
|
* one falls back to the value the message layout preset already produced, so
|
|
@@ -1952,6 +1958,17 @@ interface ScrollToBottomTokens extends ComponentTokenSet {
|
|
|
1952
1958
|
fontSize?: string;
|
|
1953
1959
|
fontWeight?: string;
|
|
1954
1960
|
};
|
|
1961
|
+
/**
|
|
1962
|
+
* The labelled "Approval needed" state shown while a pending approval is
|
|
1963
|
+
* below the fold. Omitted values follow the control's own colors, so it
|
|
1964
|
+
* matches the theme until you give it an accent.
|
|
1965
|
+
*/
|
|
1966
|
+
approval?: {
|
|
1967
|
+
background?: TokenReference<'color'>;
|
|
1968
|
+
foreground?: TokenReference<'color'>;
|
|
1969
|
+
border?: TokenReference<'color'>;
|
|
1970
|
+
fontWeight?: string;
|
|
1971
|
+
};
|
|
1955
1972
|
}
|
|
1956
1973
|
/** Visual tokens shared by one suggestion presentation variant. */
|
|
1957
1974
|
interface SuggestionVariantTokens extends ComponentTokenSet {
|
|
@@ -1998,6 +2015,8 @@ interface ComponentTokens {
|
|
|
1998
2015
|
message: MessageTokens;
|
|
1999
2016
|
/** Hover-revealed per-message action row (copy, vote, read aloud). */
|
|
2000
2017
|
messageActions?: MessageActionsTokens;
|
|
2018
|
+
/** Fade and "Show more" toggle on collapsed long user messages. */
|
|
2019
|
+
userMessageCollapse?: UserMessageCollapseTokens;
|
|
2001
2020
|
/** Welcome / intro card shown above the message list. */
|
|
2002
2021
|
introCard?: IntroCardTokens;
|
|
2003
2022
|
/** Markdown surfaces (chat + artifact pane). */
|
|
@@ -2106,8 +2125,6 @@ interface CreateThemeOptions {
|
|
|
2106
2125
|
v5Defaults?: boolean;
|
|
2107
2126
|
};
|
|
2108
2127
|
}
|
|
2109
|
-
//#endregion
|
|
2110
|
-
//#region src/generated/runtype-openapi-contract.d.ts
|
|
2111
2128
|
type RuntypeExecutionStreamEvent = ({
|
|
2112
2129
|
agentId?: string;
|
|
2113
2130
|
agentName?: string;
|
|
@@ -2137,6 +2154,12 @@ type RuntypeExecutionStreamEvent = ({
|
|
|
2137
2154
|
iterations?: number;
|
|
2138
2155
|
kind: "agent" | "flow";
|
|
2139
2156
|
outcome?: "completed" | "error" | "aborted";
|
|
2157
|
+
output?: {
|
|
2158
|
+
validation?: {
|
|
2159
|
+
errored?: Array<string>;
|
|
2160
|
+
failed?: Array<string>;
|
|
2161
|
+
};
|
|
2162
|
+
};
|
|
2140
2163
|
seq: number;
|
|
2141
2164
|
stepErrorCount?: number;
|
|
2142
2165
|
stopReason?: string;
|
|
@@ -2149,7 +2172,12 @@ type RuntypeExecutionStreamEvent = ({
|
|
|
2149
2172
|
output: number;
|
|
2150
2173
|
};
|
|
2151
2174
|
totalTokensUsed?: number;
|
|
2175
|
+
truncatedStepCount?: number;
|
|
2152
2176
|
type: "execution_complete";
|
|
2177
|
+
warnings?: Array<{
|
|
2178
|
+
code: string;
|
|
2179
|
+
message: string;
|
|
2180
|
+
}>;
|
|
2153
2181
|
}) | ({
|
|
2154
2182
|
blockReason?: string;
|
|
2155
2183
|
code?: string;
|
|
@@ -2317,6 +2345,7 @@ type RuntypeExecutionStreamEvent = ({
|
|
|
2317
2345
|
};
|
|
2318
2346
|
success?: boolean;
|
|
2319
2347
|
tokensUsed?: number;
|
|
2348
|
+
truncated?: boolean;
|
|
2320
2349
|
type: "step_complete";
|
|
2321
2350
|
unresolvedVariables?: Array<string>;
|
|
2322
2351
|
}) | {
|
|
@@ -2540,6 +2569,7 @@ type RuntypeExecutionStreamEvent = ({
|
|
|
2540
2569
|
toolCallId: string;
|
|
2541
2570
|
type: "tool_output_delta";
|
|
2542
2571
|
} | {
|
|
2572
|
+
completedAt?: string;
|
|
2543
2573
|
error?: string;
|
|
2544
2574
|
executionId: string;
|
|
2545
2575
|
executionTime?: number;
|
|
@@ -2876,8 +2906,6 @@ type RuntypeClientFeedbackResponse = {
|
|
|
2876
2906
|
success: true;
|
|
2877
2907
|
};
|
|
2878
2908
|
type RuntypeClientFeedbackType = RuntypeClientFeedbackRequest["type"];
|
|
2879
|
-
//#endregion
|
|
2880
|
-
//#region src/utils/target.d.ts
|
|
2881
2909
|
/**
|
|
2882
2910
|
* Target resolution for the normalized, backend-neutral `target` field.
|
|
2883
2911
|
*
|
|
@@ -2914,8 +2942,6 @@ type ResolvedTarget = {
|
|
|
2914
2942
|
kind: "payload";
|
|
2915
2943
|
payload: Record<string, unknown>;
|
|
2916
2944
|
};
|
|
2917
|
-
//#endregion
|
|
2918
|
-
//#region src/utils/visitor-store.d.ts
|
|
2919
2945
|
/**
|
|
2920
2946
|
* Durable visitor-credential store for per-visitor conversation history
|
|
2921
2947
|
* (client-token mode only). Holds the raw `cvt_…` secret under a localStorage
|
|
@@ -2951,8 +2977,6 @@ interface VisitorStore {
|
|
|
2951
2977
|
matches(clientToken: string, keyPrefix: string, persistDisabled: boolean): boolean;
|
|
2952
2978
|
destroy(): void;
|
|
2953
2979
|
}
|
|
2954
|
-
//#endregion
|
|
2955
|
-
//#region src/utils/history-messages.d.ts
|
|
2956
2980
|
/** One message as served by the client conversation history route. */
|
|
2957
2981
|
type HistoryWireMessage = {
|
|
2958
2982
|
/** Optional display provenance from a custom history adapter. */
|
|
@@ -2967,8 +2991,6 @@ type HistoryWireMessage = {
|
|
|
2967
2991
|
displayAvailable: boolean;
|
|
2968
2992
|
timestamp?: string;
|
|
2969
2993
|
};
|
|
2970
|
-
//#endregion
|
|
2971
|
-
//#region src/internal/history-provider.d.ts
|
|
2972
2994
|
/** Fixed for the lifetime of one opened history view/action chain. */
|
|
2973
2995
|
interface HistoryOperationContext {
|
|
2974
2996
|
scope: HistoryScope;
|
|
@@ -3067,8 +3089,6 @@ declare class HistoryProviderError extends Error {
|
|
|
3067
3089
|
});
|
|
3068
3090
|
}
|
|
3069
3091
|
declare function isHistoryProviderError(value: unknown): value is HistoryProviderError;
|
|
3070
|
-
//#endregion
|
|
3071
|
-
//#region src/utils/icons.d.ts
|
|
3072
3092
|
/**
|
|
3073
3093
|
* Curated icon registry for `renderLucideIcon` (host-suppliable name strings).
|
|
3074
3094
|
*
|
|
@@ -3207,8 +3227,6 @@ declare const registerIcons: (icons: Record<string, IconNode>) => void;
|
|
|
3207
3227
|
* @returns SVGElement, or null if the name is not in the registry.
|
|
3208
3228
|
*/
|
|
3209
3229
|
declare const renderLucideIcon: (iconName: IconName | (string & {}), size?: number | string, color?: string, strokeWidth?: number) => SVGElement | null;
|
|
3210
|
-
//#endregion
|
|
3211
|
-
//#region src/types.d.ts
|
|
3212
3230
|
/**
|
|
3213
3231
|
* Text content part for multi-modal messages
|
|
3214
3232
|
*/
|
|
@@ -3981,6 +3999,16 @@ type WebMcpConfirmInfo = {
|
|
|
3981
3999
|
* callbacks on v6 receive an AbortSignal, not a nested confirmation API.
|
|
3982
4000
|
*/
|
|
3983
4001
|
reason: 'gate';
|
|
4002
|
+
/**
|
|
4003
|
+
* `true` when the tool matches a `requireConfirmFor` pattern (the widget's
|
|
4004
|
+
* `webmcp.requireConfirmFor`, or the bound Runtype surface's
|
|
4005
|
+
* `behavior.webmcp.requireConfirmFor` from client-token init). The call
|
|
4006
|
+
* must be confirmed by the user: Persona never runs `autoApprove` for it,
|
|
4007
|
+
* and a custom `onConfirm` should not auto-approve it either. In
|
|
4008
|
+
* client-token mode it is also set on every call until the surface policy
|
|
4009
|
+
* has loaded (fail closed).
|
|
4010
|
+
*/
|
|
4011
|
+
confirmRequired?: true;
|
|
3984
4012
|
/**
|
|
3985
4013
|
* Aborts when the call no longer needs an answer (its deadline passed, or it
|
|
3986
4014
|
* was cancelled). A confirm UI should close and resolve `false`; the tool
|
|
@@ -4031,8 +4059,23 @@ type AgentWidgetWebMcpConfig = {
|
|
|
4031
4059
|
* confirmation UI entirely. Use this to auto-allow read-only tools (e.g.
|
|
4032
4060
|
* a catalog search) while still gating mutating ones. Only consulted on
|
|
4033
4061
|
* the default-UI path: a custom `onConfirm` takes full control instead.
|
|
4062
|
+
* Never consulted for a tool matching `requireConfirmFor`.
|
|
4034
4063
|
*/
|
|
4035
4064
|
autoApprove?: (info: WebMcpConfirmInfo) => boolean;
|
|
4065
|
+
/**
|
|
4066
|
+
* Tool-name patterns that must always be confirmed, even when `autoApprove`
|
|
4067
|
+
* would approve them (and even on the voice path's read-only fast tier).
|
|
4068
|
+
* Matched against the bare tool name (no `webmcp:` prefix); `*` matches any
|
|
4069
|
+
* run of characters, e.g. `["checkout_*", "delete_account"]`. A matched
|
|
4070
|
+
* call shows the default approval bubble, or reaches your `onConfirm` with
|
|
4071
|
+
* `info.confirmRequired === true`.
|
|
4072
|
+
*
|
|
4073
|
+
* Merged with the bound surface's `behavior.webmcp.requireConfirmFor`,
|
|
4074
|
+
* which Runtype returns from `/v1/client/init` in client-token mode. This
|
|
4075
|
+
* is client-side UX, not a security boundary: the server enforces only
|
|
4076
|
+
* `webmcp.enabled` and its `allowlist`.
|
|
4077
|
+
*/
|
|
4078
|
+
requireConfirmFor?: string[];
|
|
4036
4079
|
/**
|
|
4037
4080
|
* Confirm gate handler. When omitted, Persona renders its native in-panel
|
|
4038
4081
|
* approval bubble (the same chrome used for server-driven tool approvals)
|
|
@@ -5293,10 +5336,13 @@ type AgentWidgetArtifactsFeature = {
|
|
|
5293
5336
|
*
|
|
5294
5337
|
* - `"anchor-top"` (default): on send, scroll the user's message near the top
|
|
5295
5338
|
* of the viewport and hold it there while the response streams in beneath it
|
|
5296
|
-
* (ChatGPT-style).
|
|
5297
|
-
*
|
|
5298
|
-
*
|
|
5299
|
-
*
|
|
5339
|
+
* (ChatGPT-style). The anchor holds for the whole reply, even when the
|
|
5340
|
+
* message is taller than the viewport or tool calls push the answer below
|
|
5341
|
+
* the fold, until the reader scrolls away, jumps to the latest content with
|
|
5342
|
+
* the scroll-to-bottom control, or sends again. When a turn has no user send
|
|
5343
|
+
* to anchor to (a proactive greeting, an injected assistant message, a
|
|
5344
|
+
* resubmit, or first-load streaming), it falls back to `"follow"` for that
|
|
5345
|
+
* turn so content never streams in off-screen.
|
|
5300
5346
|
* - `"follow"`: keep the newest content pinned to the bottom of the viewport,
|
|
5301
5347
|
* pausing when the user scrolls up and resuming when they return to the
|
|
5302
5348
|
* bottom. This was the default before 4.x.
|
|
@@ -5381,7 +5427,8 @@ type AgentWidgetScrollBehaviorFeature = {
|
|
|
5381
5427
|
};
|
|
5382
5428
|
/** Decorative glyph state. Hidden glyphs should pause host-owned animation. */
|
|
5383
5429
|
type AgentWidgetScrollToBottomIconState = {
|
|
5384
|
-
|
|
5430
|
+
/** `"approval-below"`: a pending approval is below the fold and the turn waits on it. */
|
|
5431
|
+
activity: "idle" | "generating-below" | "approval-below";
|
|
5385
5432
|
visible: boolean;
|
|
5386
5433
|
hovered: boolean;
|
|
5387
5434
|
focused: boolean;
|
|
@@ -5418,6 +5465,15 @@ type AgentWidgetScrollToBottomFeature = {
|
|
|
5418
5465
|
* @default ""
|
|
5419
5466
|
*/
|
|
5420
5467
|
label?: string;
|
|
5468
|
+
/**
|
|
5469
|
+
* Label shown while a pending approval sits below the fold. The control
|
|
5470
|
+
* widens to a labelled pill with the approval's shield glyph, and the turn
|
|
5471
|
+
* stays put until the reader jumps (anchor-top never scrolls them to it).
|
|
5472
|
+
* Styled by `theme.components.scrollToBottom.approval`. Set to an empty
|
|
5473
|
+
* string to keep the regular control.
|
|
5474
|
+
* @default "Approval needed"
|
|
5475
|
+
*/
|
|
5476
|
+
approvalLabel?: string;
|
|
5421
5477
|
/** Glyph while a live response is arriving below. V4 defaults to arrow; V5 to dots. */
|
|
5422
5478
|
streamingIndicator?: "dots" | "arrow";
|
|
5423
5479
|
/** Visibility transition. V4 defaults to none; V5 to fade. Honors reduced motion. */
|
|
@@ -5808,6 +5864,30 @@ type AgentWidgetStreamAnimationFeature = {
|
|
|
5808
5864
|
*/
|
|
5809
5865
|
plugins?: Record<string, StreamAnimationPlugin>;
|
|
5810
5866
|
};
|
|
5867
|
+
/**
|
|
5868
|
+
* Collapse long user messages behind a "Show more" / "Show less" toggle.
|
|
5869
|
+
* Only the built-in user bubble collapses; `layout.messages.renderUserMessage`
|
|
5870
|
+
* and plugin `renderMessage` output is left untouched.
|
|
5871
|
+
*/
|
|
5872
|
+
type AgentWidgetUserMessageCollapseFeature = {
|
|
5873
|
+
/**
|
|
5874
|
+
* Clip a user bubble whose rendered content (text, markdown, code,
|
|
5875
|
+
* attachments) is taller than `maxHeight`, with a bottom fade and a real
|
|
5876
|
+
* toggle button. The full message stays in the DOM, so find-in-page, copy,
|
|
5877
|
+
* selection and screen readers still reach it. Interim voice transcripts
|
|
5878
|
+
* stay expanded and collapse once final. A reader's toggle is remembered
|
|
5879
|
+
* per message for the life of the widget.
|
|
5880
|
+
* @default false (`true` under `future.v5Defaults`)
|
|
5881
|
+
*/
|
|
5882
|
+
enabled?: boolean;
|
|
5883
|
+
/**
|
|
5884
|
+
* Collapsed height in px. Content within about two lines (48px) of the
|
|
5885
|
+
* limit is left expanded, so the toggle never hides just a line or two.
|
|
5886
|
+
* The default shows about ten lines of bubble text.
|
|
5887
|
+
* @default 240
|
|
5888
|
+
*/
|
|
5889
|
+
maxHeight?: number;
|
|
5890
|
+
};
|
|
5811
5891
|
type AgentWidgetFeatureFlags = {
|
|
5812
5892
|
showReasoning?: boolean;
|
|
5813
5893
|
showToolCalls?: boolean;
|
|
@@ -5824,6 +5904,8 @@ type AgentWidgetFeatureFlags = {
|
|
|
5824
5904
|
scrollToBottom?: AgentWidgetScrollToBottomFeature;
|
|
5825
5905
|
/** Transcript scroll behavior during streamed responses. */
|
|
5826
5906
|
scrollBehavior?: AgentWidgetScrollBehaviorFeature;
|
|
5907
|
+
/** "Show more" collapse for long user messages. Off by default; on under `future.v5Defaults`. */
|
|
5908
|
+
userMessageCollapse?: AgentWidgetUserMessageCollapseFeature;
|
|
5827
5909
|
/** Collapsed transcript behavior for tool call rows. */
|
|
5828
5910
|
toolCallDisplay?: AgentWidgetToolCallDisplayFeature;
|
|
5829
5911
|
/** Collapsed transcript behavior for reasoning rows. */
|
|
@@ -9581,6 +9663,13 @@ type ClientSession = {
|
|
|
9581
9663
|
welcomeMessage: string | null;
|
|
9582
9664
|
placeholder: string;
|
|
9583
9665
|
theme: Record<string, unknown> | null;
|
|
9666
|
+
/**
|
|
9667
|
+
* The bound chat surface's WebMCP confirm policy. Present only when the
|
|
9668
|
+
* surface enables WebMCP and lists `requireConfirmFor` patterns.
|
|
9669
|
+
*/
|
|
9670
|
+
webmcp?: {
|
|
9671
|
+
requireConfirmFor: string[];
|
|
9672
|
+
};
|
|
9584
9673
|
};
|
|
9585
9674
|
};
|
|
9586
9675
|
/**
|
|
@@ -9621,6 +9710,13 @@ type ClientInitResponse = {
|
|
|
9621
9710
|
welcomeMessage: string | null;
|
|
9622
9711
|
placeholder: string;
|
|
9623
9712
|
theme: Record<string, unknown> | null;
|
|
9713
|
+
/**
|
|
9714
|
+
* The bound chat surface's WebMCP confirm policy. Present only when the
|
|
9715
|
+
* surface enables WebMCP and lists `requireConfirmFor` patterns.
|
|
9716
|
+
*/
|
|
9717
|
+
webmcp?: {
|
|
9718
|
+
requireConfirmFor: string[];
|
|
9719
|
+
};
|
|
9624
9720
|
};
|
|
9625
9721
|
};
|
|
9626
9722
|
/**
|
|
@@ -11163,6 +11259,10 @@ type AgentWidgetConfig = {
|
|
|
11163
11259
|
sendButtonLabel?: string;
|
|
11164
11260
|
/** Button label shown in text mode while a response is streaming. Default: "Stop". */
|
|
11165
11261
|
stopButtonLabel?: string;
|
|
11262
|
+
/** Toggle label on a collapsed long user message (`features.userMessageCollapse`). @default "Show more" */
|
|
11263
|
+
showMoreLabel?: string;
|
|
11264
|
+
/** Toggle label on an expanded long user message (`features.userMessageCollapse`). @default "Show less" */
|
|
11265
|
+
showLessLabel?: string;
|
|
11166
11266
|
/**
|
|
11167
11267
|
* When false, the welcome / intro card is not shown above the message list.
|
|
11168
11268
|
* @deprecated Use `welcome.variant: "none"`.
|
|
@@ -12428,6 +12528,5 @@ type AgentWidgetInitOptions = {
|
|
|
12428
12528
|
windowKey?: string;
|
|
12429
12529
|
debugTools?: boolean;
|
|
12430
12530
|
};
|
|
12431
|
-
//#endregion
|
|
12432
12531
|
export { AgentWidgetEvent as $, RuntypeClientResumeStreamEvent as $a, TextContentPart as $i, ClientFeedbackType as $n, EventStreamPayloadRenderContext as $r, AgentWidgetScrollToBottomIconContext as $t, AgentWidgetConfigPatch as A, registerIcons as Aa, PersonaArtifactDisplayModeInput as Ai, AgentWidgetVoicePrewarmHook as An, ShadowScale as Ao, ComposerModel as Ar, AgentWidgetModelMessageProjection as At, AgentWidgetContextMentionRef as B, HistoryProviderErrorCode as Ba, ReadAloudState as Bi, AgentWidgetWelcomeVariant as Bn, AgentWidgetRailSectionContext as Bo, ComposerSubmissionOptions as Br, AgentWidgetRenderHistoryStateContext as Bt, AgentWidgetAttachmentsConfig as C, WebMcpToolResult as Ca, LoadingLabelAnimationHandle as Ci, AgentWidgetSuggestionVariant as Cn, PersonaThemePlugin as Co, ComposerMenuItem as Cr, AgentWidgetMessage as Ct, AgentWidgetComponentRenderer as D, WidgetPreferenceCapabilities as Da, PersonaArtifactActionContext as Di, AgentWidgetTooltipConfig as Dn, SemanticSpacing as Do, ComposerModeChipVisibility as Dr, AgentWidgetMessageLayoutConfig as Dt, AgentWidgetComponentRenderHandle as E, WidgetLayoutSlot as Ea, PcmStreamPlayer as Ei, AgentWidgetToolCallLoadingAnimation as En, SemanticColors as Eo, ComposerMode as Er, AgentWidgetMessageFeedback as Et, AgentWidgetContextMentionConfig as F, HistoryOperationContext as Fa, PersonaArtifactManualUpsert as Fi, AgentWidgetWelcomeConfig as Fn, ToggleGroupTokens as Fo, ComposerPhase as Fr, AgentWidgetReadAloudEvent as Ft, AgentWidgetContextProvider as G, RuntypeClientChatRequest as Ga, SlotRenderContext as Gi, AttachmentPreviewRemoveConfig as Gn, ariaCombo as Go, DictationPhase as Gr, AgentWidgetRunFinishedEvent as Gt, AgentWidgetContextMentionSearchContext as H, isHistoryProviderError as Ha, ResolvedHistoryPresentation as Hi, AskUserQuestionOption as Hn, AgentWidgetRenderWelcomeContext as Ho, ComposerSubmitKey as Hr, AgentWidgetRequestPayload as Ht, AgentWidgetContextMentionItem as I, HistoryPageOptions as Ia, PersonaArtifactPresentation as Ii, AgentWidgetWelcomeDismiss as In, TokenReference as Io, ComposerQuote as Ir, AgentWidgetReasoning as It, AgentWidgetCustomFetch as J, RuntypeClientFeedbackResponse as Ja, SpeechCallbacks as Ji, AttachmentPreviewState as Jn, AgentWidgetPluginStorage as Jo, DictationRenderHandle as Jr, AgentWidgetSSEEventResult as Jt, AgentWidgetContextProviderContext as K, RuntypeClientChatStreamEvent as Ka, SlotRenderResult as Ki, AttachmentPreviewRenderContext as Kn, formatCombo as Ko, DictationProviderConfig as Kr, AgentWidgetRunStartedEvent as Kt, AgentWidgetContextMentionItemRenderContext as L, HistoryPageResult as La, PersonaArtifactRecord as Li, AgentWidgetWelcomeIcon as Ln, TypographyScale as Lo, ComposerResubmitOptions as Lr, AgentWidgetRenderHistoryConversationContext as Lt, AgentWidgetContextMentionChipRenderContext as M, HistoryDeleteAllOptions as Ma, PersonaArtifactFileMeta as Mi, AgentWidgetVoiceStatusEvent as Mn, TextStyleTokens as Mo, ComposerModelPickerPresentation as Mr, AgentWidgetModelMessageTransform as Mt, AgentWidgetContextMentionCommandContext as N, HistoryListOptions as Na, PersonaArtifactFilesDisplayRules as Ni, AgentWidgetWebMcpConfig as Nn, ThemeValidationError as No, ComposerOptionsPayload as Nr, AgentWidgetOpenConversationOptions as Nt, AgentWidgetComposerConfig as O, WidgetPreferenceSlice as Oa, PersonaArtifactCustomAction as Oi, AgentWidgetTurnActivity as On, SemanticTokens as Oo, ComposerModeGroup as Or, AgentWidgetMessageRole as Ot, AgentWidgetContextMentionComposerCapability as P, HistoryListResult as Pa, PersonaArtifactKind as Pi, AgentWidgetWelcomeAlign as Pn, ThemeValidationResult as Po, ComposerOverflowMenuConfig as Pr, AgentWidgetParsedAction as Pt, AgentWidgetDockConfig as Q, RuntypeClientResumeRequest as Qa, StreamAnimationPlugin as Qi, ClientFeedbackRequest as Qn, EventStreamConfig as Qr, AgentWidgetScrollToBottomFeature as Qt, AgentWidgetContextMentionMenuRenderContext as R, HistoryProvider as Ra, PersonaArtifactStatusLabelContext as Ri, AgentWidgetWelcomeIconBase as Rn, AgentWidgetPlugin as Ro, ComposerState as Rr, AgentWidgetRenderHistoryHeaderContext as Rt, AgentWidgetAttachmentPreviewConfig as S, WebMcpConfirmInfo as Sa, LoadingLabelAnimationContext as Si, AgentWidgetSuggestionSurfaceConfig as Sn, PersonaTheme as So, ComposerLayout as Sr, AgentWidgetMentionTriggerPosition as St, AgentWidgetComponentRenderContext as T, WidgetHistoryInternals as Ta, MessageRenderContext as Ti, AgentWidgetTimestampConfig as Tn, ResolvedToken as To, ComposerMenuRenderHandle as Tr, AgentWidgetMessageAuthor as Tt, AgentWidgetContextMentionSource as U, ResolvedTarget as Ua, ResumableHandle as Ui, AskUserQuestionPayload as Un, AgentWidgetSuggestionSelectContext as Uo, ContentPart as Ur, AgentWidgetResolvedSuggestion as Ut, AgentWidgetContextMentionResolveContext as V, PreparedHistoryActivation as Va, ResolvedHistoryCopy as Vi, ArtifactConfigPayload as Vn, AgentWidgetRenderSuggestionContext as Vo, ComposerSubmissionSnapshot as Vr, AgentWidgetRenderHistoryViewContext as Vt, AgentWidgetContextMentionTokenRenderContext as W, TargetResolver as Wa, SSEEventRecord as Wi, AskUserQuestionPrompt as Wn, AgentWidgetTransformSuggestionsContext as Wo, ConversationExecutionState as Wr, AgentWidgetRevealToolCallOptions as Wt, AgentWidgetCustomMessageActionRole as X, RuntypeClientInitRequest as Xa, SpeechRequest as Xi, BackgroundConversationAdapter as Xn, isWelcomeVisible as Xo, DictationStateEvent as Xr, AgentWidgetScrollMode as Xt, AgentWidgetCustomMessageAction as Y, RuntypeClientFeedbackType as Ya, SpeechEngine as Yi, AttachmentUploadContext as Yn, ResolvedWelcomeConfig as Yo, DictationState as Yr, AgentWidgetScrollBehaviorFeature as Yt, AgentWidgetDictationConfig as Z, RuntypeClientInitResponse as Za, StreamAnimationContext as Zi, ClientChatRequest as Zn, resolveWelcomeConfig as Zo, EventStreamBadgeColor as Zr, AgentWidgetScrollRestorePosition as Zt, AgentWidgetArtifactsFeature as _, VoiceResult as _a, InjectComponentDirectiveOptions as _i, AgentWidgetSuggestion as _n, DeepPartial as _o, ComposerBeforeSendResult as _r, AgentWidgetMarkdownConfig as _t, AgentMessagePhase as a, VoiceClientToolsSession as aa, HistoryConversationPage as ai, AgentWidgetStateSnapshot as an, ArtifactPaneTokens as ao, ClientToolsFrame as ar, AgentWidgetHeadersFunction as at, AgentWidgetAskUserQuestionStyles as b, VoiceTranscriptMetadata as ba, InjectUserMessageOptions as bi, AgentWidgetSuggestionSource as bn, MessageGeometryTokens as bo, ComposerDisabledOption as br, AgentWidgetMentionLlmEntry as bt, AgentWidgetActionContext as c, VoiceDelegationFollowUp as ca, HistoryDisplayProjection as ci, AgentWidgetStoredState as cn, AttachmentRemoveTokens as co, ComposerActionBase as cr, AgentWidgetHistoryListAction as ct, AgentWidgetActionHandlerResult as d, VoiceDelegationStatus as da, HistoryReturnSurface as di, AgentWidgetStreamAnimationFeature as dn, BrandConfig as do, ComposerActionOverflowConfig as dr, AgentWidgetLauncherConfig as dt, ToolAnnotations as ea, EventStreamRowRenderContext as ei, AgentWidgetScrollToBottomIconHandle as en, RuntypeExecutionStreamEvent as eo, ClientInitResponse as er, AgentWidgetEventContext as et, AgentWidgetActionParser as f, VoiceDirectTurn as fa, HistoryScope as fi, AgentWidgetStreamAnimationPlaceholder as fn, ColorPalette as fo, ComposerActionPlacement as fr, AgentWidgetLauncherTeaserConfig as ft, AgentWidgetApprovalDecisionOptions as g, VoiceProvider as ga, InjectAssistantMessageOptions as gi, AgentWidgetStreamParserResult as gn, CreateThemeOptions as go, ComposerAttachmentState as gr, AgentWidgetLoadingLabelConfig as gt, AgentWidgetApprovalConfig as h, VoicePriorToolResult as ha, ImageContentPart as hi, AgentWidgetStreamParser as hn, ComposerOverflowMenuTokens as ho, ComposerActionVisibility as hr, AgentWidgetLoadingIndicatorConfig as ht, AgentMessageMetadata as i, VoiceClientToolsChannel as ia, HistoryConversationDetail as ii, AgentWidgetStarterSuggestionsConfig as in, RuntypeTurnCompleteEvent as io, ClientToolResultFrame as ir, AgentWidgetHeaderLayoutConfig as it, AgentWidgetContentSegment as j, renderLucideIcon as ja, PersonaArtifactDisplayRules as ji, AgentWidgetVoicePrewarmTrigger as jn, SpacingScale as jo, ComposerModelPickerConfig as jr, AgentWidgetModelMessageRole as jt, AgentWidgetConfig as k, IconName as ka, PersonaArtifactDisplayMode as ki, AgentWidgetTurnActivityConfig as kn, SemanticTypography as ko, ComposerModeGroupPresentation as kr, AgentWidgetMessageRoleLayout as kt, AgentWidgetActionEventPayload as l, VoiceDelegationRequest as la, HistoryIdentityStatus as li, AgentWidgetStreamAnimationBuffer as ln, AttachmentTokens as lo, ComposerActionContext as lr, AgentWidgetHistoryRenderActions as lt, AgentWidgetApproval as m, VoicePlaybackEngine as ma, IdleIndicatorRenderContext as mi, AgentWidgetStreamCheckpoint as mn, ComponentTokens as mo, ComposerActionRenderContext as mr, AgentWidgetLinkClickContext as mt, AgentExecutionState as n, VoiceClientToolStatus as na, EventStreamViewRenderContext as ni, AgentWidgetSessionInitHook as nn, RuntypeStopReasonKind as no, ClientToolCallFrame as nr, AgentWidgetFeatureFlags as nt, AgentRequestOptions as o, VoiceClientToolsSnapshot as oa, HistoryConversationPatch as oi, AgentWidgetStorageAdapter as on, ArtifactTabTokens as oo, ClientVisitorGrant as or, AgentWidgetHistoryCopy as ot, AgentWidgetAgentRequestPayload as p, VoiceMetrics as pa, HistoryViewState as pi, AgentWidgetStreamAnimationType as pn, ColorShade as po, ComposerActionPresentation as pr, AgentWidgetLayoutConfig as pt, AgentWidgetControllerEventMap as q, RuntypeClientFeedbackRequest as qa, SlotRenderer as qi, AttachmentPreviewRenderHandle as qn, parseCombo as qo, DictationRenderContext as qr, AgentWidgetSSEEventParser as qt, AgentLoopConfig as r, VoiceClientTools as ra, HeaderRenderContext as ri, AgentWidgetSessionInitTrigger as rn, RuntypeStreamEventOf as ro, ClientToolDefinition as rr, AgentWidgetFollowUpSuggestionsConfig as rt, AgentToolsConfig as s, VoiceConfig as sa, HistoryConversationSummary as si, AgentWidgetStoredDraft as sn, ArtifactToolbarTokens as so, ComposerAction as sr, AgentWidgetHistoryFeature as st, AgentConfig as t, VoiceClientToolOutcome as ta, EventStreamToolbarRenderContext as ti, AgentWidgetScrollToBottomIconState as tn, RuntypeStepCompleteEvent as to, ClientSession as tr, AgentWidgetExpansionConfig as tt, AgentWidgetActionHandler as u, VoiceDelegationResult as ua, HistoryPendingAction as ui, AgentWidgetStreamAnimationBuiltinType as un, BorderScale as uo, ComposerActionContributionContext as ur, AgentWidgetInitOptions as ut, AgentWidgetArtifactsLayoutConfig as v, VoiceSessionBridge as va, InjectMessageOptions as vi, AgentWidgetSuggestionBehavior as vn, IconButtonTokens as vo, ComposerButtonAction as vr, AgentWidgetMarkdownOptions as vt, AgentWidgetAvatarConfig as w, WidgetArtifactLayoutPreference as wa, MessageContent as wi, AgentWidgetSuggestionsConfig as wn, RadiusScale as wo, ComposerMenuRenderContext as wr, AgentWidgetMessageActionsConfig as wt, AgentWidgetAttachmentAdapter as x, WebMcpConfirmHandler as xa, LoadingIndicatorRenderContext as xi, AgentWidgetSuggestionSurface as xn, MessageTokens as xo, ComposerInputAttributes as xr, AgentWidgetMentionTriggerChannel as xt, AgentWidgetAskUserQuestionFeature as y, VoiceStatus as ya, InjectSystemMessageOptions as yi, AgentWidgetSuggestionChipsConfig as yn, LabelButtonTokens as yo, ComposerCustomAction as yr, AgentWidgetMarkdownRendererOverrides as yt, AgentWidgetContextMentionPayload as z, HistoryProviderError as za, PreparedClientSession as zi, AgentWidgetWelcomeIconPlacement as zn, AgentWidgetRailSection as zo, ComposerStreamingSubmitBehavior as zr, AgentWidgetRenderHistoryOpenErrorContext as zt };
|
|
12433
12532
|
export {}
|
package/dist/ui-extras.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
var e=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(e){throw n=[e],e}},t=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),n=/* @__PURE__ */ t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Allow=e.ALL=e.COLLECTION=e.ATOM=e.SPECIAL=e.INF=e._INFINITY=e.INFINITY=e.NAN=e.BOOL=e.NULL=e.OBJ=e.ARR=e.NUM=e.STR=void 0,e.STR=1,e.NUM=2,e.ARR=4,e.OBJ=8,e.NULL=16,e.BOOL=32,e.NAN=64,e.INFINITY=128,e._INFINITY=256,e.INF=e.INFINITY|e._INFINITY,e.SPECIAL=e.NULL|e.BOOL|e.INF|e.NAN,e.ATOM=e.STR|e.NUM|e.SPECIAL,e.COLLECTION=e.ARR|e.OBJ,e.ALL=e.ATOM|e.COLLECTION,e.Allow={STR:e.STR,NUM:e.NUM,ARR:e.ARR,OBJ:e.OBJ,NULL:e.NULL,BOOL:e.BOOL,NAN:e.NAN,INFINITY:e.INFINITY,_INFINITY:e._INFINITY,INF:e.INF,SPECIAL:e.SPECIAL,ATOM:e.ATOM,COLLECTION:e.COLLECTION,ALL:e.ALL},e.default=e.Allow})),r=/* @__PURE__ */ t((e=>{var
|
|
2
|
-
\r `.includes(e[r]);)r++};return l()};e.parse=s}));function i(e,t){if(!e)return t;if(!t)return e;let n={...e};for(let[e,r]of Object.entries(t)){let t=n[e];n[e]=a(t)&&a(r)?i(t,r):r}return n}var a,o=e((()=>{a=e=>typeof e==`object`&&!!e&&!Array.isArray(e)})),s,c,l,u=e((()=>{s=(e,t)=>{let n=document.createElement(e);return t&&(n.className=t),n},c=(e,t={},...n)=>{let r=document.createElement(e);if(t.className&&(r.className=t.className),t.text!==void 0&&(r.textContent=t.text),t.attrs)for(let[e,n]of Object.entries(t.attrs))r.setAttribute(e,n);if(t.style){let e=r.style,n=t.style;for(let t of Object.keys(n)){let r=n[t];r!=null&&(e[t]=r)}}let i=n.filter(e=>e!=null);return i.length>0&&r.append(...i),r},l=(...e)=>e.filter(Boolean).join(` `)})),d,f,p,m,h,g,_,v,y,b,x,S,C,w,T,E,D,O,k,A,j,M,N,P,ee,te,ne,re,ie,F,ae,I,oe,L,R,z,B,V,se,H,U,W,G;e((()=>{d=r(),u(),f=`data-persona-ask-sheet-for`,p=`Other`,m=`Other…`,h=`Type your own answer here`,g=`Send`,_=`Next`,v=`Back`,y=`Submit all`,b=`Skip`,x=3,S=`data-ask-current-index`,C=`data-ask-answers`,w=`data-ask-grouped`,T=e=>e.getAttribute(`data-ask-layout`)===`pills`?`pills`:`rows`,E=!1,D=e=>e.replace(/["\\]/g,`\\$&`),O=e=>e?.features?.askUserQuestion??{},k=e=>{let t=e.toolCall;if(!t)return{payload:null,complete:!1};let n=t.status===`complete`;if(t.args&&typeof t.args==`object`)return{payload:t.args,complete:n};let r=t.chunks;if(!r||r.length===0)return{payload:null,complete:n};try{let e=r.join(``),t=(0,d.parse)(e,d.STR|d.OBJ|d.ARR);if(t&&typeof t==`object`)return{payload:t,complete:n}}catch{}return{payload:null,complete:n}},A=e=>{let t=Array.isArray(e?.questions)?e.questions:[];return t.length>8&&!E&&(E=!0,typeof console<`u`&&console.warn(`[AgentWidget] ask_user_question received ${t.length} questions; truncating to 8.`)),t.slice(0,8)},j=e=>A(e)[0]??null,M=(e,t)=>A(e)[t]??null,N=(e,t,n)=>{if(e!==`rows`)return null;let r=s(`span`,`persona-ask-row-affordance`);if(r.setAttribute(`aria-hidden`,`true`),t){let e=s(`span`,`persona-ask-row-check`);r.appendChild(e)}else{let e=s(`span`,`persona-ask-row-badge`);e.textContent=String(n+1),r.appendChild(e)}return r},P=(e,t,n,r)=>{let i=s(`button`,n===`rows`?`persona-ask-pill persona-ask-row persona-pointer-events-auto`:`persona-ask-pill persona-pointer-events-auto`);if(i.type=`button`,i.setAttribute(`role`,r?`checkbox`:`button`),i.setAttribute(`aria-pressed`,`false`),i.setAttribute(`data-ask-user-action`,`pick`),i.setAttribute(`data-option-index`,String(t)),i.setAttribute(`data-option-label`,e.label),n===`rows`){let a=s(`span`,`persona-ask-row-content`),o=s(`span`,`persona-ask-row-label`);if(o.textContent=e.label,a.appendChild(o),e.description){let t=s(`span`,`persona-ask-row-description`);t.textContent=e.description,a.appendChild(t)}i.appendChild(a);let c=N(n,r,t);c&&i.appendChild(c)}else i.textContent=e.label,e.description&&(i.title=e.description);return i},ee=e=>{let t=s(`span`,e===`rows`?`persona-ask-pill persona-ask-row persona-ask-pill-skeleton persona-pointer-events-none`:`persona-ask-pill persona-ask-pill-skeleton persona-pointer-events-none`);return t.setAttribute(`aria-hidden`,`true`),t},te=(e,t,n,r)=>{let i=s(`div`,r===`rows`?`persona-ask-pills persona-ask-pills--rows persona-flex persona-flex-col persona-gap-2`:`persona-ask-pills persona-flex persona-flex-wrap persona-gap-2`);i.setAttribute(`role`,`group`),i.setAttribute(`data-ask-pill-list`,`true`);let a=!!e?.multiSelect,o=(Array.isArray(e?.options)?e.options:[]).filter(e=>e&&typeof e.label==`string`&&e.label.length>0);if(o.length===0&&!n){for(let e=0;e<x;e++)i.appendChild(ee(r));return i}if(o.forEach((e,t)=>{i.appendChild(P(e,t,r,a))}),e?.allowFreeText!==!1){let e=r===`rows`?p:m;if(r===`rows`){let n=s(`div`,`persona-ask-pill persona-ask-row persona-ask-row--other persona-ask-pill-custom persona-pointer-events-auto`);n.setAttribute(`data-ask-user-action`,`focus-free-text`),n.setAttribute(`data-option-index`,String(o.length)),n.setAttribute(`data-ask-other-row`,`true`);let c=s(`span`,`persona-ask-row-content`),l=document.createElement(`input`);l.type=`text`,l.className=`persona-ask-row-input persona-flex-1 persona-pointer-events-auto`,l.placeholder=t.freeTextPlaceholder??h,l.setAttribute(`data-ask-free-text-input`,`true`),l.setAttribute(`aria-label`,t.freeTextLabel??e),c.appendChild(l),n.appendChild(c);let u=N(r,a,o.length);u&&n.appendChild(u),i.appendChild(n)}else{let n=s(`button`,`persona-ask-pill persona-ask-pill-custom persona-pointer-events-auto`);n.type=`button`,n.setAttribute(`data-ask-user-action`,`open-free-text`),n.textContent=t.freeTextLabel??e,i.appendChild(n)}}return i},ne=(e,t)=>{let n=s(`div`,t===`rows`?`persona-ask-free-text persona-ask-free-text--rows persona-flex persona-gap-2 persona-mt-2`:`persona-ask-free-text persona-hidden persona-flex persona-gap-2 persona-mt-2`);n.setAttribute(`data-ask-free-text-row`,`true`);let r=document.createElement(`input`);if(r.type=`text`,r.className=`persona-ask-free-text-input persona-flex-1 persona-pointer-events-auto`,r.placeholder=e.freeTextPlaceholder??h,r.setAttribute(`data-ask-free-text-input`,`true`),n.appendChild(r),t!==`rows`){let t=s(`button`,`persona-ask-free-text-submit persona-pointer-events-auto`);t.type=`button`,t.textContent=e.submitLabel??g,t.setAttribute(`data-ask-user-action`,`submit-free-text`),n.appendChild(t)}return n},re=e=>{let t=s(`div`,`persona-ask-multi-actions persona-flex persona-justify-end persona-mt-2`);t.setAttribute(`data-ask-multi-actions`,`true`);let n=s(`button`,`persona-ask-multi-submit persona-pointer-events-auto`);return n.type=`button`,n.textContent=e.submitLabel??g,n.setAttribute(`data-ask-user-action`,`submit-multi`),n.disabled=!0,t.appendChild(n),t},ie=(e,t,n)=>{let r=s(`div`,`persona-ask-nav persona-flex persona-justify-between persona-items-center persona-gap-2 persona-mt-2`);r.setAttribute(`data-ask-nav-row`,`true`);let i=s(`button`,`persona-ask-nav-back persona-pointer-events-auto`);i.type=`button`,i.textContent=n.backLabel??v,i.setAttribute(`data-ask-user-action`,`back`),i.disabled=e===0,r.appendChild(i);let a=s(`div`,`persona-ask-nav-right persona-flex persona-items-center persona-gap-2`),o=s(`button`,`persona-ask-nav-skip persona-pointer-events-auto`);o.type=`button`,o.textContent=n.skipLabel??b,o.setAttribute(`data-ask-user-action`,`skip`),a.appendChild(o);let c=s(`button`,`persona-ask-nav-next persona-pointer-events-auto`);c.type=`button`;let l=e===t-1;return c.textContent=l?n.submitAllLabel??y:n.nextLabel??_,c.setAttribute(`data-ask-user-action`,l?`submit-all`:`next`),c.disabled=!0,a.appendChild(c),r.appendChild(a),r},F=e=>{let t=e.getAttribute(C);if(!t)return{};try{let e=JSON.parse(t);return e&&typeof e==`object`?e:{}}catch{return{}}},ae=(e,t)=>{e.setAttribute(C,JSON.stringify(t))},I=e=>{let t=Number(e.getAttribute(`data-ask-current-index`)??`0`);return Number.isFinite(t)?Math.max(0,Math.floor(t)):0},oe=(e,t)=>{e.setAttribute(S,String(Math.max(0,Math.floor(t))))},L=e=>{let t=Number(e.getAttribute(`data-ask-question-count`)??`1`);return Number.isFinite(t)?Math.max(1,Math.floor(t)):1},R=e=>e.getAttribute(w)===`true`,z=(e,t)=>{let{payload:n}=k(t),r=A(n),i=F(e),a={},o=/* @__PURE__ */ new Set;return r.forEach((e,t)=>{let n=typeof e?.question==`string`?e.question:``;n&&(o.has(n)&&typeof console<`u`&&console.warn(`[AgentWidget] ask_user_question has duplicate question text "${n}"; later answer wins.`),o.add(n),Object.prototype.hasOwnProperty.call(i,t)&&(a[n]=i[t]))}),a},B=e=>{let t=F(e)[I(e)],n=/* @__PURE__ */ new Set;typeof t==`string`?n.add(t):Array.isArray(t)&&t.forEach(e=>n.add(e));let r=e.querySelectorAll(`[data-ask-user-action="pick"][data-option-label]`);r.forEach(e=>{let t=e.getAttribute(`data-option-label`)??``,r=n.has(t);e.setAttribute(`aria-pressed`,r?`true`:`false`),e.classList.toggle(`persona-ask-pill-selected`,r)});let i=new Set(Array.from(r).map(e=>e.getAttribute(`data-option-label`)??``)),a=e.querySelector(`[data-ask-free-text-input="true"]`);a&&(typeof t==`string`&&t.length>0&&!i.has(t)?(a.value=t,a.closest(`[data-ask-free-text-row="true"]`)?.classList.remove(`persona-hidden`)):a.value=``)},V=e=>{if(!R(e))return;let t=F(e)[I(e)],n=typeof t==`string`&&t.length>0||Array.isArray(t)&&t.length>0,r=e.querySelector(`[data-ask-user-action="next"], [data-ask-user-action="submit-all"]`);r&&(r.disabled=!n);let i=e.querySelector(`[data-ask-user-action="submit-multi"]`);i&&(i.disabled=Array.from(e.querySelectorAll(`[aria-pressed="true"][data-option-label]`)).length===0)},se=(e,t,n)=>{let r=O(n),i=T(e),{payload:a,complete:o}=k(t),s=R(e),c=I(e),l=L(e),u=s?M(a,c):j(a),d=!!u?.multiSelect,f=e.querySelector(`[data-ask-step-inline="true"]`);f&&(f.textContent=s?`${c+1}/${l}`:``);let p=e.querySelector(`[data-ask-stepper="true"]`);p&&p.remove();let m=e.querySelector(`[data-ask-question="true"]`);if(m){let e=typeof u?.question==`string`?u.question:``;m.textContent=e,m.classList.toggle(`persona-ask-question-skeleton`,!e&&!o)}let h=e.querySelector(`[data-ask-pill-list="true"]`);if(h){let e=te(u,r,o,i);h.replaceWith(e)}if(i!==`rows`){let t=e.querySelector(`[data-ask-free-text-row="true"]`);t&&t.replaceWith(ne(r,i))}let g=e.querySelector(`[data-ask-multi-actions="true"]`);!s&&d&&!g?e.appendChild(re(r)):(!d||s)&&g&&g.remove(),e.setAttribute(`data-multi-select`,d?`true`:`false`);let _=e.querySelector(`[data-ask-nav-row="true"]`);if(s){let t=ie(c,l,r);_?_.replaceWith(t):e.appendChild(t)}else _&&_.remove();B(e),V(e)},H=(e,t)=>{if(!e)return;let n=t?`[${f}="${D(t)}"]`:`[${f}]`;e.querySelectorAll(n).forEach(e=>{e.classList.add(`persona-ask-sheet-leave`);let t=Number.parseInt(getComputedStyle(e).getPropertyValue(`--persona-ask-sheet-duration`)||`180`,10);setTimeout(()=>e.remove(),Number.isFinite(t)?t:180)})},U=e=>Array.from(e.querySelectorAll(`[aria-pressed="true"][data-option-label]`)).map(e=>e.getAttribute(`data-option-label`)).filter(e=>typeof e==`string`&&e.length>0),W=(e,t)=>{let n=F(e),r=I(e);typeof t==`string`&&t.length===0||Array.isArray(t)&&t.length===0?delete n[r]:n[r]=t,ae(e,n),B(e),V(e)},G=(e,t,n,r)=>{let i=L(e),a=Math.max(0,Math.min(i-1,r));oe(e,a),se(e,t,n)}}))();const ce=e=>{let{mount:t,overlay:n,sessionRef:r}=e,i=(i,a,o)=>{let s=a.trim();if(!s||!r.current)return;let c=i.getAttribute(`data-tool-call-id`)??``,l=o.source===`free-text`;t.dispatchEvent(new CustomEvent(`persona:askUserQuestion:answered`,{detail:{instanceId:e.instanceId,toolUseId:c,answer:s,answers:o.structured,values:o.values??(o.source===`multi`?s.split(`, `):[s]),isFreeText:l,source:o.source},bubbles:!0,composed:!0})),H(n,c);let u=r.current.getMessages().find(e=>e.toolCall?.id===c);u?.agentMetadata?.awaitingLocalTool?r.current.resolveAskUserQuestion(u,o.structured??s):r.current.sendMessage(s)},a=e=>{let t=r.current;if(!t)return;let n=e.getAttribute(`data-tool-call-id`)??``,i=t.getMessages().find(e=>e.toolCall?.id===n);i&&t.persistAskUserQuestionProgress(i,{answers:z(e,i),currentIndex:I(e)})},o=e=>Object.entries(e).map(([e,t])=>`${e}: ${Array.isArray(t)?t.join(`, `):t}`).join(` | `),s=t=>{if(e.config().features?.askUserQuestion?.groupedAutoAdvance===!1)return;let n=I(t);if(n>=L(t)-1)return;let i=r.current?.getMessages().find(e=>e.toolCall?.id===t.getAttribute(`data-tool-call-id`));i&&(G(t,i,e.config(),n+1),a(t))};return{click:c=>{let l=c.target.closest(`[data-ask-user-action]`);if(!l)return;let u=l.closest(`[data-persona-ask-sheet-for]`);if(!u)return;let d=l.getAttribute(`data-ask-user-action`);if(c.preventDefault(),c.stopPropagation(),d===`dismiss`){let i=u.getAttribute(`data-tool-call-id`)??``;t.dispatchEvent(new CustomEvent(`persona:askUserQuestion:dismissed`,{detail:{instanceId:e.instanceId,toolUseId:i},bubbles:!0,composed:!0})),H(n,i);let a=r.current?.getMessages().find(e=>e.toolCall?.id===i);a?.agentMetadata?.awaitingLocalTool&&(r.current?.markAskUserQuestionResolved(a),r.current?.resolveAskUserQuestion(a,`(dismissed)`))}else if(d===`pick`){let e=l.getAttribute(`data-option-label`);if(!e)return;let t=u.getAttribute(`data-multi-select`)===`true`,n=R(u);if(n&&t){let t=F(u)[I(u)],n=new Set(Array.isArray(t)?t:[]);n.has(e)?n.delete(e):n.add(e),W(u,Array.from(n)),a(u);return}if(n){W(u,e),a(u),s(u);return}if(t){let e=l.getAttribute(`aria-pressed`)===`true`;l.setAttribute(`aria-pressed`,e?`false`:`true`),l.classList.toggle(`persona-ask-pill-selected`,!e);let t=u.querySelector(`[data-ask-user-action="submit-multi"]`);t&&(t.disabled=U(u).length===0);return}i(u,e,{source:`pick`,values:[e]})}else if(d===`submit-multi`){let e=U(u);if(e.length===0)return;i(u,e.join(`, `),{source:`multi`,values:e})}else if(d===`open-free-text`){let e=u.querySelector(`[data-ask-free-text-row="true"]`);e&&(e.classList.remove(`persona-hidden`),e.querySelector(`[data-ask-free-text-input="true"]`)?.focus())}else if(d===`focus-free-text`)u.querySelector(`[data-ask-free-text-input="true"]`)?.focus();else if(d===`submit-free-text`){let e=u.querySelector(`[data-ask-free-text-input="true"]`)?.value??``;if(!e.trim())return;if(R(u)){W(u,e.trim()),a(u),s(u);return}i(u,e,{source:`free-text`})}else if(d===`next`||d===`back`){if(!r.current)return;let t=u.getAttribute(`data-tool-call-id`)??``,n=r.current.getMessages().find(e=>e.toolCall?.id===t);if(!n)return;let i=u.querySelector(`[data-ask-free-text-input="true"]`)?.value?.trim()??``;if(i){let e=F(u)[I(u)];(typeof e!=`string`||e!==i)&&W(u,i)}let o=d===`next`?1:-1,s=I(u)+o;G(u,n,e.config(),s),a(u)}else if(d===`submit-all`){if(!r.current)return;let e=u.getAttribute(`data-tool-call-id`)??``,t=r.current.getMessages().find(t=>t.toolCall?.id===e);if(!t)return;let n=u.querySelector(`[data-ask-free-text-input="true"]`)?.value?.trim()??``;n&&W(u,n);let a=z(u,t);r.current.persistAskUserQuestionProgress(t,{answers:a,currentIndex:I(u)});let s=o(a);i(u,s||`(submitted)`,{source:`submit-all`,structured:a})}else if(d===`skip`){if(!r.current)return;let s=u.getAttribute(`data-tool-call-id`)??``,c=r.current.getMessages().find(e=>e.toolCall?.id===s);if(!c)return;let l=R(u),d=I(u),f=d>=L(u)-1;if(!l){t.dispatchEvent(new CustomEvent(`persona:askUserQuestion:dismissed`,{detail:{instanceId:e.instanceId,toolUseId:s},bubbles:!0,composed:!0})),H(n,s),c.agentMetadata?.awaitingLocalTool&&(r.current.markAskUserQuestionResolved(c),r.current.resolveAskUserQuestion(c,`(dismissed)`));return}W(u,``);let p=u.querySelector(`[data-ask-free-text-input="true"]`);if(p&&(p.value=``),f){let e=z(u,c),t=o(e);i(u,t||`(skipped)`,{source:`submit-all`,structured:e});return}G(u,c,e.config(),d+1),a(u)}},keydown:e=>{if(e.key!==`Enter`)return;let t=e.target;if(!t.matches?.(`[data-ask-free-text-input="true"]`))return;let n=t.closest(`[data-persona-ask-sheet-for]`);if(!n)return;e.preventDefault();let r=t.value;r.trim()&&(R(n)?(W(n,r.trim()),a(n),s(n)):i(n,r,{source:`free-text`}))}}},le=/\s/;function ue(e,t,n){if(n===`input-start`)return t===0;let r=t>0?e[t-1]:``;return n===`line-start`?r===``||r===`
|
|
1
|
+
var e=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(e){throw n=[e],e}},t=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t,t.exports),e=null),t.exports),n=/* @__PURE__ */ t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Allow=e.ALL=e.COLLECTION=e.ATOM=e.SPECIAL=e.INF=e._INFINITY=e.INFINITY=e.NAN=e.BOOL=e.NULL=e.OBJ=e.ARR=e.NUM=e.STR=void 0,e.STR=1,e.NUM=2,e.ARR=4,e.OBJ=8,e.NULL=16,e.BOOL=32,e.NAN=64,e.INFINITY=128,e._INFINITY=256,e.INF=e.INFINITY|e._INFINITY,e.SPECIAL=e.NULL|e.BOOL|e.INF|e.NAN,e.ATOM=e.STR|e.NUM|e.SPECIAL,e.COLLECTION=e.ARR|e.OBJ,e.ALL=e.ATOM|e.COLLECTION,e.Allow={STR:e.STR,NUM:e.NUM,ARR:e.ARR,OBJ:e.OBJ,NULL:e.NULL,BOOL:e.BOOL,NAN:e.NAN,INFINITY:e.INFINITY,_INFINITY:e._INFINITY,INF:e.INF,SPECIAL:e.SPECIAL,ATOM:e.ATOM,COLLECTION:e.COLLECTION,ALL:e.ALL},e.default=e.Allow})),r=/* @__PURE__ */ t(((e,t,r)=>{var i=r&&r.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||(`get`in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),a=r&&r.__exportStar||function(e,t){for(var n in e)n!=="default"&&!Object.prototype.hasOwnProperty.call(t,n)&&i(t,e,n)};Object.defineProperty(e,"__esModule",{value:!0}),e.Allow=e.MalformedJSON=e.PartialJSON=e.parseJSON=e.parse=void 0;let o=n();Object.defineProperty(e,"Allow",{enumerable:!0,get:function(){return o.Allow}}),a(n(),e);var s=class extends Error{};e.PartialJSON=s;var c=class extends Error{};e.MalformedJSON=c;function l(e,t=o.Allow.ALL){if(typeof e!=`string`)throw TypeError(`expecting str, got ${typeof e}`);if(!e.trim())throw Error(`${e} is empty`);return u(e.trim(),t)}e.parseJSON=l;let u=(e,t)=>{let n=e.length,r=0,i=e=>{throw new s(`${e} at position ${r}`)},a=e=>{throw new c(`${e} at position ${r}`)},l=()=>(m(),r>=n&&i(`Unexpected end of input`),e[r]===`"`?u():e[r]===`{`?d():e[r]===`[`?f():e.substring(r,r+4)===`null`||o.Allow.NULL&t&&n-r<4&&`null`.startsWith(e.substring(r))?(r+=4,null):e.substring(r,r+4)===`true`||o.Allow.BOOL&t&&n-r<4&&`true`.startsWith(e.substring(r))?(r+=4,!0):e.substring(r,r+5)===`false`||o.Allow.BOOL&t&&n-r<5&&`false`.startsWith(e.substring(r))?(r+=5,!1):e.substring(r,r+8)===`Infinity`||o.Allow.INFINITY&t&&n-r<8&&`Infinity`.startsWith(e.substring(r))?(r+=8,1/0):e.substring(r,r+9)===`-Infinity`||o.Allow._INFINITY&t&&1<n-r&&n-r<9&&`-Infinity`.startsWith(e.substring(r))?(r+=9,-1/0):e.substring(r,r+3)===`NaN`||o.Allow.NAN&t&&n-r<3&&`NaN`.startsWith(e.substring(r))?(r+=3,NaN):p()),u=()=>{let s=r,c=!1;for(r++;r<n&&(e[r]!==`"`||c&&e[r-1]===`\\`);)c=e[r]===`\\`&&!c,r++;if(e.charAt(r)==`"`)try{return JSON.parse(e.substring(s,++r-Number(c)))}catch(e){a(String(e))}else if(o.Allow.STR&t)try{return JSON.parse(e.substring(s,r-Number(c))+`"`)}catch{return JSON.parse(e.substring(s,e.lastIndexOf(`\\`))+`"`)}i(`Unterminated string literal`)},d=()=>{r++,m();let a={};try{for(;e[r]!==`}`;){if(m(),r>=n&&o.Allow.OBJ&t)return a;let i=u();m(),r++;try{a[i]=l()}catch(e){if(o.Allow.OBJ&t)return a;throw e}m(),e[r]===`,`&&r++}}catch{if(o.Allow.OBJ&t)return a;i(`Expected '}' at end of object`)}return r++,a},f=()=>{r++;let n=[];try{for(;e[r]!==`]`;)n.push(l()),m(),e[r]===`,`&&r++}catch{if(o.Allow.ARR&t)return n;i(`Expected ']' at end of array`)}return r++,n},p=()=>{if(r===0){e===`-`&&a(`Not sure what '-' is`);try{return JSON.parse(e)}catch(n){if(o.Allow.NUM&t)try{return JSON.parse(e.substring(0,e.lastIndexOf(`e`)))}catch{}a(String(n))}}let s=r;for(e[r]===`-`&&r++;e[r]&&`,]}`.indexOf(e[r])===-1;)r++;r==n&&!(o.Allow.NUM&t)&&i(`Unterminated number literal`);try{return JSON.parse(e.substring(s,r))}catch{e.substring(s,r)===`-`&&i(`Not sure what '-' is`);try{return JSON.parse(e.substring(s,e.lastIndexOf(`e`)))}catch(e){a(String(e))}}},m=()=>{for(;r<n&&`
|
|
2
|
+
\r `.includes(e[r]);)r++};return l()};e.parse=l}));function i(e,t){if(!e)return t;if(!t)return e;let n={...e};for(let[e,r]of Object.entries(t)){let t=n[e];n[e]=a(t)&&a(r)?i(t,r):r}return n}var a,o=e((()=>{a=e=>typeof e==`object`&&!!e&&!Array.isArray(e)})),s,c,l,u=e((()=>{s=(e,t)=>{let n=document.createElement(e);return t&&(n.className=t),n},c=(e,t={},...n)=>{let r=document.createElement(e);if(t.className&&(r.className=t.className),t.text!==void 0&&(r.textContent=t.text),t.attrs)for(let[e,n]of Object.entries(t.attrs))r.setAttribute(e,n);if(t.style){let e=r.style,n=t.style;for(let t of Object.keys(n)){let r=n[t];r!=null&&(e[t]=r)}}let i=n.filter(e=>e!=null);return i.length>0&&r.append(...i),r},l=(...e)=>e.filter(Boolean).join(` `)})),d,f,p,m,h,g,_,v,y,b,x,S,C,w,T,E,D,O,k,A,j,M,N,P,ee,te,ne,re,ie,F,ae,I,oe,L,R,z,B,V,se,H,U,W,G;e((()=>{d=r(),u(),f=`data-persona-ask-sheet-for`,p=`Other`,m=`Other…`,h=`Type your own answer here`,g=`Send`,_=`Next`,v=`Back`,y=`Submit all`,b=`Skip`,x=3,S=`data-ask-current-index`,C=`data-ask-answers`,w=`data-ask-grouped`,T=e=>e.getAttribute(`data-ask-layout`)===`pills`?`pills`:`rows`,E=!1,D=e=>e.replace(/["\\]/g,`\\$&`),O=e=>e?.features?.askUserQuestion??{},k=e=>{let t=e.toolCall;if(!t)return{payload:null,complete:!1};let n=t.status===`complete`;if(t.args&&typeof t.args==`object`)return{payload:t.args,complete:n};let r=t.chunks;if(!r||r.length===0)return{payload:null,complete:n};try{let e=r.join(``),t=(0,d.parse)(e,d.STR|d.OBJ|d.ARR);if(t&&typeof t==`object`)return{payload:t,complete:n}}catch{}return{payload:null,complete:n}},A=e=>{let t=Array.isArray(e?.questions)?e.questions:[];return t.length>8&&!E&&(E=!0,typeof console<`u`&&console.warn(`[AgentWidget] ask_user_question received ${t.length} questions; truncating to 8.`)),t.slice(0,8)},j=e=>A(e)[0]??null,M=(e,t)=>A(e)[t]??null,N=(e,t,n)=>{if(e!==`rows`)return null;let r=s(`span`,`persona-ask-row-affordance`);if(r.setAttribute(`aria-hidden`,`true`),t){let e=s(`span`,`persona-ask-row-check`);r.appendChild(e)}else{let e=s(`span`,`persona-ask-row-badge`);e.textContent=String(n+1),r.appendChild(e)}return r},P=(e,t,n,r)=>{let i=s(`button`,n===`rows`?`persona-ask-pill persona-ask-row persona-pointer-events-auto`:`persona-ask-pill persona-pointer-events-auto`);if(i.type=`button`,i.setAttribute(`role`,r?`checkbox`:`button`),i.setAttribute(`aria-pressed`,`false`),i.setAttribute(`data-ask-user-action`,`pick`),i.setAttribute(`data-option-index`,String(t)),i.setAttribute(`data-option-label`,e.label),n===`rows`){let a=s(`span`,`persona-ask-row-content`),o=s(`span`,`persona-ask-row-label`);if(o.textContent=e.label,a.appendChild(o),e.description){let t=s(`span`,`persona-ask-row-description`);t.textContent=e.description,a.appendChild(t)}i.appendChild(a);let c=N(n,r,t);c&&i.appendChild(c)}else i.textContent=e.label,e.description&&(i.title=e.description);return i},ee=e=>{let t=s(`span`,e===`rows`?`persona-ask-pill persona-ask-row persona-ask-pill-skeleton persona-pointer-events-none`:`persona-ask-pill persona-ask-pill-skeleton persona-pointer-events-none`);return t.setAttribute(`aria-hidden`,`true`),t},te=(e,t,n,r)=>{let i=s(`div`,r===`rows`?`persona-ask-pills persona-ask-pills--rows persona-flex persona-flex-col persona-gap-2`:`persona-ask-pills persona-flex persona-flex-wrap persona-gap-2`);i.setAttribute(`role`,`group`),i.setAttribute(`data-ask-pill-list`,`true`);let a=!!e?.multiSelect,o=(Array.isArray(e?.options)?e.options:[]).filter(e=>e&&typeof e.label==`string`&&e.label.length>0);if(o.length===0&&!n){for(let e=0;e<x;e++)i.appendChild(ee(r));return i}if(o.forEach((e,t)=>{i.appendChild(P(e,t,r,a))}),e?.allowFreeText!==!1){let e=r===`rows`?p:m;if(r===`rows`){let n=s(`div`,`persona-ask-pill persona-ask-row persona-ask-row--other persona-ask-pill-custom persona-pointer-events-auto`);n.setAttribute(`data-ask-user-action`,`focus-free-text`),n.setAttribute(`data-option-index`,String(o.length)),n.setAttribute(`data-ask-other-row`,`true`);let c=s(`span`,`persona-ask-row-content`),l=document.createElement(`input`);l.type=`text`,l.className=`persona-ask-row-input persona-flex-1 persona-pointer-events-auto`,l.placeholder=t.freeTextPlaceholder??h,l.setAttribute(`data-ask-free-text-input`,`true`),l.setAttribute(`aria-label`,t.freeTextLabel??e),c.appendChild(l),n.appendChild(c);let u=N(r,a,o.length);u&&n.appendChild(u),i.appendChild(n)}else{let n=s(`button`,`persona-ask-pill persona-ask-pill-custom persona-pointer-events-auto`);n.type=`button`,n.setAttribute(`data-ask-user-action`,`open-free-text`),n.textContent=t.freeTextLabel??e,i.appendChild(n)}}return i},ne=(e,t)=>{let n=s(`div`,t===`rows`?`persona-ask-free-text persona-ask-free-text--rows persona-flex persona-gap-2 persona-mt-2`:`persona-ask-free-text persona-hidden persona-flex persona-gap-2 persona-mt-2`);n.setAttribute(`data-ask-free-text-row`,`true`);let r=document.createElement(`input`);if(r.type=`text`,r.className=`persona-ask-free-text-input persona-flex-1 persona-pointer-events-auto`,r.placeholder=e.freeTextPlaceholder??h,r.setAttribute(`data-ask-free-text-input`,`true`),n.appendChild(r),t!==`rows`){let t=s(`button`,`persona-ask-free-text-submit persona-pointer-events-auto`);t.type=`button`,t.textContent=e.submitLabel??g,t.setAttribute(`data-ask-user-action`,`submit-free-text`),n.appendChild(t)}return n},re=e=>{let t=s(`div`,`persona-ask-multi-actions persona-flex persona-justify-end persona-mt-2`);t.setAttribute(`data-ask-multi-actions`,`true`);let n=s(`button`,`persona-ask-multi-submit persona-pointer-events-auto`);return n.type=`button`,n.textContent=e.submitLabel??g,n.setAttribute(`data-ask-user-action`,`submit-multi`),n.disabled=!0,t.appendChild(n),t},ie=(e,t,n)=>{let r=s(`div`,`persona-ask-nav persona-flex persona-justify-between persona-items-center persona-gap-2 persona-mt-2`);r.setAttribute(`data-ask-nav-row`,`true`);let i=s(`button`,`persona-ask-nav-back persona-pointer-events-auto`);i.type=`button`,i.textContent=n.backLabel??v,i.setAttribute(`data-ask-user-action`,`back`),i.disabled=e===0,r.appendChild(i);let a=s(`div`,`persona-ask-nav-right persona-flex persona-items-center persona-gap-2`),o=s(`button`,`persona-ask-nav-skip persona-pointer-events-auto`);o.type=`button`,o.textContent=n.skipLabel??b,o.setAttribute(`data-ask-user-action`,`skip`),a.appendChild(o);let c=s(`button`,`persona-ask-nav-next persona-pointer-events-auto`);c.type=`button`;let l=e===t-1;return c.textContent=l?n.submitAllLabel??y:n.nextLabel??_,c.setAttribute(`data-ask-user-action`,l?`submit-all`:`next`),c.disabled=!0,a.appendChild(c),r.appendChild(a),r},F=e=>{let t=e.getAttribute(C);if(!t)return{};try{let e=JSON.parse(t);return e&&typeof e==`object`?e:{}}catch{return{}}},ae=(e,t)=>{e.setAttribute(C,JSON.stringify(t))},I=e=>{let t=Number(e.getAttribute(`data-ask-current-index`)??`0`);return Number.isFinite(t)?Math.max(0,Math.floor(t)):0},oe=(e,t)=>{e.setAttribute(S,String(Math.max(0,Math.floor(t))))},L=e=>{let t=Number(e.getAttribute(`data-ask-question-count`)??`1`);return Number.isFinite(t)?Math.max(1,Math.floor(t)):1},R=e=>e.getAttribute(w)===`true`,z=(e,t)=>{let{payload:n}=k(t),r=A(n),i=F(e),a={},o=/* @__PURE__ */ new Set;return r.forEach((e,t)=>{let n=typeof e?.question==`string`?e.question:``;n&&(o.has(n)&&typeof console<`u`&&console.warn(`[AgentWidget] ask_user_question has duplicate question text "${n}"; later answer wins.`),o.add(n),Object.prototype.hasOwnProperty.call(i,t)&&(a[n]=i[t]))}),a},B=e=>{let t=F(e)[I(e)],n=/* @__PURE__ */ new Set;typeof t==`string`?n.add(t):Array.isArray(t)&&t.forEach(e=>n.add(e));let r=e.querySelectorAll(`[data-ask-user-action="pick"][data-option-label]`);r.forEach(e=>{let t=e.getAttribute(`data-option-label`)??``,r=n.has(t);e.setAttribute(`aria-pressed`,r?`true`:`false`),e.classList.toggle(`persona-ask-pill-selected`,r)});let i=new Set(Array.from(r).map(e=>e.getAttribute(`data-option-label`)??``)),a=e.querySelector(`[data-ask-free-text-input="true"]`);a&&(typeof t==`string`&&t.length>0&&!i.has(t)?(a.value=t,a.closest(`[data-ask-free-text-row="true"]`)?.classList.remove(`persona-hidden`)):a.value=``)},V=e=>{if(!R(e))return;let t=F(e)[I(e)],n=typeof t==`string`&&t.length>0||Array.isArray(t)&&t.length>0,r=e.querySelector(`[data-ask-user-action="next"], [data-ask-user-action="submit-all"]`);r&&(r.disabled=!n);let i=e.querySelector(`[data-ask-user-action="submit-multi"]`);i&&(i.disabled=Array.from(e.querySelectorAll(`[aria-pressed="true"][data-option-label]`)).length===0)},se=(e,t,n)=>{let r=O(n),i=T(e),{payload:a,complete:o}=k(t),s=R(e),c=I(e),l=L(e),u=s?M(a,c):j(a),d=!!u?.multiSelect,f=e.querySelector(`[data-ask-step-inline="true"]`);f&&(f.textContent=s?`${c+1}/${l}`:``);let p=e.querySelector(`[data-ask-stepper="true"]`);p&&p.remove();let m=e.querySelector(`[data-ask-question="true"]`);if(m){let e=typeof u?.question==`string`?u.question:``;m.textContent=e,m.classList.toggle(`persona-ask-question-skeleton`,!e&&!o)}let h=e.querySelector(`[data-ask-pill-list="true"]`);if(h){let e=te(u,r,o,i);h.replaceWith(e)}if(i!==`rows`){let t=e.querySelector(`[data-ask-free-text-row="true"]`);t&&t.replaceWith(ne(r,i))}let g=e.querySelector(`[data-ask-multi-actions="true"]`);!s&&d&&!g?e.appendChild(re(r)):(!d||s)&&g&&g.remove(),e.setAttribute(`data-multi-select`,d?`true`:`false`);let _=e.querySelector(`[data-ask-nav-row="true"]`);if(s){let t=ie(c,l,r);_?_.replaceWith(t):e.appendChild(t)}else _&&_.remove();B(e),V(e)},H=(e,t)=>{if(!e)return;let n=t?`[${f}="${D(t)}"]`:`[${f}]`;e.querySelectorAll(n).forEach(e=>{e.classList.add(`persona-ask-sheet-leave`);let t=Number.parseInt(getComputedStyle(e).getPropertyValue(`--persona-ask-sheet-duration`)||`180`,10);setTimeout(()=>e.remove(),Number.isFinite(t)?t:180)})},U=e=>Array.from(e.querySelectorAll(`[aria-pressed="true"][data-option-label]`)).map(e=>e.getAttribute(`data-option-label`)).filter(e=>typeof e==`string`&&e.length>0),W=(e,t)=>{let n=F(e),r=I(e);typeof t==`string`&&t.length===0||Array.isArray(t)&&t.length===0?delete n[r]:n[r]=t,ae(e,n),B(e),V(e)},G=(e,t,n,r)=>{let i=L(e),a=Math.max(0,Math.min(i-1,r));oe(e,a),se(e,t,n)}}))();const ce=e=>{let{mount:t,overlay:n,sessionRef:r}=e,i=(i,a,o)=>{let s=a.trim();if(!s||!r.current)return;let c=i.getAttribute(`data-tool-call-id`)??``,l=o.source===`free-text`;t.dispatchEvent(new CustomEvent(`persona:askUserQuestion:answered`,{detail:{instanceId:e.instanceId,toolUseId:c,answer:s,answers:o.structured,values:o.values??(o.source===`multi`?s.split(`, `):[s]),isFreeText:l,source:o.source},bubbles:!0,composed:!0})),H(n,c);let u=r.current.getMessages().find(e=>e.toolCall?.id===c);u?.agentMetadata?.awaitingLocalTool?r.current.resolveAskUserQuestion(u,o.structured??s):r.current.sendMessage(s)},a=e=>{let t=r.current;if(!t)return;let n=e.getAttribute(`data-tool-call-id`)??``,i=t.getMessages().find(e=>e.toolCall?.id===n);i&&t.persistAskUserQuestionProgress(i,{answers:z(e,i),currentIndex:I(e)})},o=e=>Object.entries(e).map(([e,t])=>`${e}: ${Array.isArray(t)?t.join(`, `):t}`).join(` | `),s=t=>{if(e.config().features?.askUserQuestion?.groupedAutoAdvance===!1)return;let n=I(t);if(n>=L(t)-1)return;let i=r.current?.getMessages().find(e=>e.toolCall?.id===t.getAttribute(`data-tool-call-id`));i&&(G(t,i,e.config(),n+1),a(t))};return{click:c=>{let l=c.target.closest(`[data-ask-user-action]`);if(!l)return;let u=l.closest(`[data-persona-ask-sheet-for]`);if(!u)return;let d=l.getAttribute(`data-ask-user-action`);if(c.preventDefault(),c.stopPropagation(),d===`dismiss`){let i=u.getAttribute(`data-tool-call-id`)??``;t.dispatchEvent(new CustomEvent(`persona:askUserQuestion:dismissed`,{detail:{instanceId:e.instanceId,toolUseId:i},bubbles:!0,composed:!0})),H(n,i);let a=r.current?.getMessages().find(e=>e.toolCall?.id===i);a?.agentMetadata?.awaitingLocalTool&&(r.current?.markAskUserQuestionResolved(a),r.current?.resolveAskUserQuestion(a,`(dismissed)`))}else if(d===`pick`){let e=l.getAttribute(`data-option-label`);if(!e)return;let t=u.getAttribute(`data-multi-select`)===`true`,n=R(u);if(n&&t){let t=F(u)[I(u)],n=new Set(Array.isArray(t)?t:[]);n.has(e)?n.delete(e):n.add(e),W(u,Array.from(n)),a(u);return}if(n){W(u,e),a(u),s(u);return}if(t){let e=l.getAttribute(`aria-pressed`)===`true`;l.setAttribute(`aria-pressed`,e?`false`:`true`),l.classList.toggle(`persona-ask-pill-selected`,!e);let t=u.querySelector(`[data-ask-user-action="submit-multi"]`);t&&(t.disabled=U(u).length===0);return}i(u,e,{source:`pick`,values:[e]})}else if(d===`submit-multi`){let e=U(u);if(e.length===0)return;i(u,e.join(`, `),{source:`multi`,values:e})}else if(d===`open-free-text`){let e=u.querySelector(`[data-ask-free-text-row="true"]`);e&&(e.classList.remove(`persona-hidden`),e.querySelector(`[data-ask-free-text-input="true"]`)?.focus())}else if(d===`focus-free-text`)u.querySelector(`[data-ask-free-text-input="true"]`)?.focus();else if(d===`submit-free-text`){let e=u.querySelector(`[data-ask-free-text-input="true"]`)?.value??``;if(!e.trim())return;if(R(u)){W(u,e.trim()),a(u),s(u);return}i(u,e,{source:`free-text`})}else if(d===`next`||d===`back`){if(!r.current)return;let t=u.getAttribute(`data-tool-call-id`)??``,n=r.current.getMessages().find(e=>e.toolCall?.id===t);if(!n)return;let i=u.querySelector(`[data-ask-free-text-input="true"]`)?.value?.trim()??``;if(i){let e=F(u)[I(u)];(typeof e!=`string`||e!==i)&&W(u,i)}let o=d===`next`?1:-1,s=I(u)+o;G(u,n,e.config(),s),a(u)}else if(d===`submit-all`){if(!r.current)return;let e=u.getAttribute(`data-tool-call-id`)??``,t=r.current.getMessages().find(t=>t.toolCall?.id===e);if(!t)return;let n=u.querySelector(`[data-ask-free-text-input="true"]`)?.value?.trim()??``;n&&W(u,n);let a=z(u,t);r.current.persistAskUserQuestionProgress(t,{answers:a,currentIndex:I(u)});let s=o(a);i(u,s||`(submitted)`,{source:`submit-all`,structured:a})}else if(d===`skip`){if(!r.current)return;let s=u.getAttribute(`data-tool-call-id`)??``,c=r.current.getMessages().find(e=>e.toolCall?.id===s);if(!c)return;let l=R(u),d=I(u),f=d>=L(u)-1;if(!l){t.dispatchEvent(new CustomEvent(`persona:askUserQuestion:dismissed`,{detail:{instanceId:e.instanceId,toolUseId:s},bubbles:!0,composed:!0})),H(n,s),c.agentMetadata?.awaitingLocalTool&&(r.current.markAskUserQuestionResolved(c),r.current.resolveAskUserQuestion(c,`(dismissed)`));return}W(u,``);let p=u.querySelector(`[data-ask-free-text-input="true"]`);if(p&&(p.value=``),f){let e=z(u,c),t=o(e);i(u,t||`(skipped)`,{source:`submit-all`,structured:e});return}G(u,c,e.config(),d+1),a(u)}},keydown:e=>{if(e.key!==`Enter`)return;let t=e.target;if(!t.matches?.(`[data-ask-free-text-input="true"]`))return;let n=t.closest(`[data-persona-ask-sheet-for]`);if(!n)return;e.preventDefault();let r=t.value;r.trim()&&(R(n)?(W(n,r.trim()),a(n),s(n)):i(n,r,{source:`free-text`}))}}},le=/\s/;function ue(e,t,n){if(n===`input-start`)return t===0;let r=t>0?e[t-1]:``;return n===`line-start`?r===``||r===`
|
|
3
3
|
`:r===``||le.test(r)}function de(e,t,n=`@`,r=`anywhere`,i=!1){if(!n||t<=0||t>e.length)return null;let a=t-1;for(;a>=0;){let o=e[a];if(o===n)return ue(e,a,r)?{triggerIndex:a,query:e.slice(a+1,t)}:null;if(o===`
|
|
4
4
|
`||o===``||!i&&le.test(o))return null;a--}return null}function fe(e,t,n){for(let r of n){let n=de(e,t,r.trigger,r.position??`anywhere`,r.allowSpaces??!1);if(n)return{channel:r,match:n}}return null}function pe(e){return!e||e!==`insertFromPaste`&&e!==`insertFromDrop`}function me(e){return[{trigger:e.trigger??`@`,position:e.triggerPosition??`anywhere`,allowSpaces:!1,sources:Array.isArray(e.sources)?e.sources:[],searchPlaceholder:e.searchPlaceholder,showButton:e.showButton!==!1,buttonIconName:e.buttonIconName,buttonTooltipText:e.buttonTooltipText},...(e.triggers??[]).map(e=>({trigger:e.trigger,position:e.triggerPosition??`anywhere`,allowSpaces:e.allowSpaces??!1,sources:Array.isArray(e.sources)?e.sources:[],searchPlaceholder:e.searchPlaceholder,showButton:e.showButton===!0,buttonIconName:e.buttonIconName,buttonTooltipText:e.buttonTooltipText}))]}const K=(e,t=24,n=`currentColor`,r=2)=>{if(!Array.isArray(e))return null;let i=document.createElementNS(`http://www.w3.org/2000/svg`,`svg`);for(let[e,a]of Object.entries({width:String(t),height:String(t),viewBox:`0 0 24 24`,fill:`none`,stroke:n,"stroke-width":String(r),"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`}))i.setAttribute(e,a);for(let t of e){if(!Array.isArray(t)||t.length<2)continue;let e=t[0],n=t[1];if(!n)continue;let r=document.createElementNS(`http://www.w3.org/2000/svg`,e);for(let[e,t]of Object.entries(n))e!==`stroke`&&r.setAttribute(e,String(t));i.appendChild(r)}return i},q=e=>{let{fallbackImport:t,resetOnSetLoader:n=!1}=e,r=null,i=null,a=null;return{setLoader:e=>{r=e,n&&(i=null,a=null)},load:()=>{if(i)return Promise.resolve(i);if(a)return a;let e=r??t;try{return a=e().then(e=>(i=e,e)).catch(e=>{throw a=null,e}),a}catch(e){return Promise.reject(e)}},provide:e=>{i=e},getSync:()=>i}},{setLoader:he,load:ge}=q({fallbackImport:()=>import(`@runtypelabs/persona/icons-extra`)}),_e=ge,ve={activity:[[`path`,{d:`M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2`}]],"arrow-down":[[`path`,{d:`M12 5v14`}],[`path`,{d:`m19 12-7 7-7-7`}]],"arrow-up":[[`path`,{d:`m5 12 7-7 7 7`}],[`path`,{d:`M12 19V5`}]],"arrow-up-right":[[`path`,{d:`M7 7h10v10`}],[`path`,{d:`M7 17 17 7`}]],bot:[[`path`,{d:`M12 8V4H8`}],[`rect`,{width:`16`,height:`12`,x:`4`,y:`8`,rx:`2`}],[`path`,{d:`M2 14h2`}],[`path`,{d:`M20 14h2`}],[`path`,{d:`M15 13v2`}],[`path`,{d:`M9 13v2`}]],"chevron-down":[[`path`,{d:`m6 9 6 6 6-6`}]],"chevron-up":[[`path`,{d:`m18 15-6-6-6 6`}]],"chevron-right":[[`path`,{d:`m9 18 6-6-6-6`}]],"chevron-left":[[`path`,{d:`m15 18-6-6 6-6`}]],check:[[`path`,{d:`M20 6 9 17l-5-5`}]],clipboard:[[`rect`,{width:`8`,height:`4`,x:`8`,y:`2`,rx:`1`,ry:`1`}],[`path`,{d:`M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2`}]],"clipboard-copy":[[`rect`,{width:`8`,height:`4`,x:`8`,y:`2`,rx:`1`,ry:`1`}],[`path`,{d:`M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-2`}],[`path`,{d:`M16 4h2a2 2 0 0 1 2 2v4`}],[`path`,{d:`M21 14H11`}],[`path`,{d:`m15 10-4 4 4 4`}]],"code-xml":[[`path`,{d:`m18 16 4-4-4-4`}],[`path`,{d:`m6 8-4 4 4 4`}],[`path`,{d:`m14.5 4-5 16`}]],copy:[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`}]],file:[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`}]],"file-code":[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`}],[`path`,{d:`M10 12.5 8 15l2 2.5`}],[`path`,{d:`m14 12.5 2 2.5-2 2.5`}]],"file-spreadsheet":[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`}],[`path`,{d:`M8 13h2`}],[`path`,{d:`M14 13h2`}],[`path`,{d:`M8 17h2`}],[`path`,{d:`M14 17h2`}]],"file-text":[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`}],[`path`,{d:`M10 9H8`}],[`path`,{d:`M16 13H8`}],[`path`,{d:`M16 17H8`}]],"image-plus":[[`path`,{d:`M16 5h6`}],[`path`,{d:`M19 2v6`}],[`path`,{d:`M21 11.5V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7.5`}],[`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`}],[`circle`,{cx:`9`,cy:`9`,r:`2`}]],loader:[[`path`,{d:`M12 2v4`}],[`path`,{d:`m16.2 7.8 2.9-2.9`}],[`path`,{d:`M18 12h4`}],[`path`,{d:`m16.2 16.2 2.9 2.9`}],[`path`,{d:`M12 18v4`}],[`path`,{d:`m4.9 19.1 2.9-2.9`}],[`path`,{d:`M2 12h4`}],[`path`,{d:`m4.9 4.9 2.9 2.9`}]],"loader-circle":[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`}]],mic:[[`path`,{d:`M12 19v3`}],[`path`,{d:`M19 10v2a7 7 0 0 1-14 0v-2`}],[`rect`,{x:`9`,y:`2`,width:`6`,height:`13`,rx:`3`}]],paperclip:[[`path`,{d:`m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551`}]],quote:[[`path`,{d:`M16 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z`}],[`path`,{d:`M5 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z`}]],"refresh-cw":[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`}],[`path`,{d:`M21 3v5h-5`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`}],[`path`,{d:`M8 16H3v5`}]],search:[[`path`,{d:`m21 21-4.34-4.34`}],[`circle`,{cx:`11`,cy:`11`,r:`8`}]],send:[[`path`,{d:`M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z`}],[`path`,{d:`m21.854 2.147-10.94 10.939`}]],"shield-alert":[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`}],[`path`,{d:`M12 8v4`}],[`path`,{d:`M12 16h.01`}]],"shield-check":[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`}],[`path`,{d:`m9 12 2 2 4-4`}]],"shield-x":[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`}],[`path`,{d:`m14.5 9.5-5 5`}],[`path`,{d:`m9.5 9.5 5 5`}]],square:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`}]],"square-text":[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`}],[`path`,{d:`M7 8h10M7 12h10M7 16h6`}]],"thumbs-down":[[`path`,{d:`M9 18.12 10 14H4.17a2 2 0 0 1-1.92-2.56l2.33-8A2 2 0 0 1 6.5 2H20a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2h-2.76a2 2 0 0 0-1.79 1.11L12 22a3.13 3.13 0 0 1-3-3.88Z`}],[`path`,{d:`M17 14V2`}]],"thumbs-up":[[`path`,{d:`M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2a3.13 3.13 0 0 1 3 3.88Z`}],[`path`,{d:`M7 10v12`}]],upload:[[`path`,{d:`M12 3v12`}],[`path`,{d:`m17 8-5-5-5 5`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`}]],"volume-2":[[`path`,{d:`M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z`}],[`path`,{d:`M16 9a5 5 0 0 1 0 6`}],[`path`,{d:`M19.364 18.364a9 9 0 0 0 0-12.728`}]],"voice-bars":[[`path`,{d:`M4 10v4`}],[`path`,{d:`M8 6v12`}],[`path`,{d:`M12 3v18`}],[`path`,{d:`M16 7v10`}],[`path`,{d:`M20 10v4`}]],x:[[`path`,{d:`M18 6 6 18`}],[`path`,{d:`m6 6 12 12`}]],"at-sign":[[`circle`,{cx:`12`,cy:`12`,r:`4`}],[`path`,{d:`M16 8v5a3 3 0 0 0 6 0v-1a10 10 0 1 0-4 8`}]],"arrow-left":[[`path`,{d:`m12 19-7-7 7-7`}],[`path`,{d:`M19 12H5`}]],"arrow-right":[[`path`,{d:`M5 12h14`}],[`path`,{d:`m12 5 7 7-7 7`}]],"external-link":[[`path`,{d:`M15 3h6v6`}],[`path`,{d:`M10 14 21 3`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`}]],ellipsis:[[`circle`,{cx:`12`,cy:`12`,r:`1`}],[`circle`,{cx:`19`,cy:`12`,r:`1`}],[`circle`,{cx:`5`,cy:`12`,r:`1`}]],menu:[[`path`,{d:`M4 5h16`}],[`path`,{d:`M4 12h16`}],[`path`,{d:`M4 19h16`}]],"panel-left":[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`}],[`path`,{d:`M9 3v18`}]],plus:[[`path`,{d:`M5 12h14`}],[`path`,{d:`M12 5v14`}]],minus:[[`path`,{d:`M5 12h14`}]],pencil:[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`}],[`path`,{d:`m15 5 4 4`}]],trash:[[`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`}],[`path`,{d:`M3 6h18`}],[`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`}]],"trash-2":[[`path`,{d:`M10 11v6`}],[`path`,{d:`M14 11v6`}],[`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`}],[`path`,{d:`M3 6h18`}],[`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`}]],download:[[`path`,{d:`M12 15V3`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`}],[`path`,{d:`m7 10 5 5 5-5`}]],maximize:[[`path`,{d:`M8 3H5a2 2 0 0 0-2 2v3`}],[`path`,{d:`M21 8V5a2 2 0 0 0-2-2h-3`}],[`path`,{d:`M3 16v3a2 2 0 0 0 2 2h3`}],[`path`,{d:`M16 21h3a2 2 0 0 0 2-2v-3`}]],minimize:[[`path`,{d:`M8 3v3a2 2 0 0 1-2 2H3`}],[`path`,{d:`M21 8h-3a2 2 0 0 1-2-2V3`}],[`path`,{d:`M3 16h3a2 2 0 0 1 2 2v3`}],[`path`,{d:`M16 21v-3a2 2 0 0 1 2-2h3`}]],"message-square":[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`}]],star:[[`path`,{d:`M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z`}]],eye:[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`}]],history:[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`}],[`path`,{d:`M3 3v5h5`}],[`path`,{d:`M12 7v5l4 2`}]]},ye=/* @__PURE__ */ `brain.toolbox.wrench.circle.database.terminal.user.mail.phone.calendar.clock.building.map-pin.lock.key.credit-card.hash.globe.link.circle-check.circle-x.triangle-alert.info.ban.shield.ellipsis-vertical.house.pen-line.save.share.funnel.settings.rotate-cw.shopping-cart.shopping-bag.package.truck.tag.gift.receipt.wallet.store.dollar-sign.percent.play.pause.volume-x.camera.image.film.headphones.message-circle.bell.heart.eye-off.bookmark.calendar-days.timer.folder.folder-open.files.chart-column.sparkles.zap.sun.moon.flag.lightbulb.monitor.smartphone`.split(`.`),J=new Map(Object.entries(ve)),Y=/* @__PURE__ */ new Map
|
|
5
5
|
/**
|
|
@@ -332,6 +332,6 @@ var e=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(e){throw n=
|
|
|
332
332
|
* This source code is licensed under the ISC license.
|
|
333
333
|
* See the LICENSE file in the root directory of this source tree.
|
|
334
334
|
*/
|
|
335
|
-
;let X=!1;const be=/* @__PURE__ */ new Set,xe=e=>{let t=[...be];e&&be.clear();for(let e of t)try{e()}catch{}},Se=()=>{let e=0;for(let[t,n]of Y){let r=J.get(n);if(!r)continue;Y.delete(t),e++;let i=K(r);if(i)for(t.removeAttribute(`data-persona-icon-pending`);i.firstChild;)t.appendChild(i.firstChild)}return e},Ce=e=>{if(!X){for(let[t,n]of Object.entries(e))J.has(t)||J.set(t,n);X=!0,Se(),xe(!0)}},we=()=>X?null:_e().then(e=>Ce(e.EXTRA_LUCIDE_ICONS)),Te=()=>{we()?.catch(e=>{console.warn(`[Persona] Failed to load the icons-extra chunk`,e)})},Ee=(e,t,n)=>{let r=K([],e,t,n);return r.setAttribute(`data-persona-icon-pending`,`true`),r},Z=(e,t=24,n=`currentColor`,r=2)=>{let i=J.get(e);if(i)return K(i,t,n,r);if(ye.includes(e)){let i=Ee(t,n,r);return Y.size>=500&&Y.delete(Y.keys().next().value),Y.set(i,e),Te(),i}return console.warn(`Unknown Persona icon "${e}". Use registerIcons().`),null};var De;e((()=>{De=100001}))();let Oe=0;const ke=e=>Math.max(0,e),Ae=()=>Date.now()<Oe,je=e=>{Oe=e>0?Date.now()+e:0},Q=/* @__PURE__ */ new WeakMap,Me=e=>typeof e.closest==`function`&&e.closest(`[data-persona-tooltip-suppressed]`)!==null,Ne=e=>e.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&`host`in e,Pe=e=>{let t=e.getRootNode?.();return Ne(t)?t:e.closest(`dialog[open]`)??e.ownerDocument.body},$=(e,t,n)=>Math.min(Math.max(e,t),Math.max(t,n)),Fe=[...[`background`,`foreground`,`hint-fg`,`radius`,`font-size`,`padding`,`max-width`,`shadow`,`arrow-display`].map(e=>`--persona-tooltip-${e}`),`--persona-font-family`,`--persona-radius-sm`];function Ie(e){Q.get(e.anchor)?.destroy();let{anchor:t,trigger:n=t,text:r,hint:i,enabled:a=!0,gap:o=8,viewportPadding:s=8}=e,c=()=>t.ownerDocument,l=()=>c().defaultView??window,u=null,d=null,f=null,p=null,m,h=!1,g=!1,_=!1,v=()=>(typeof r==`function`?r():r).trim(),y=()=>(typeof i==`function`?i():i??``).trim(),b=()=>ke(e.delayMs??400),x=()=>ke(e.skipDelayMs??300),S=()=>{m!==void 0&&(l().clearTimeout(m),m=void 0)},C=()=>{S();let e=u!==null;p?.(),p=null,u?.remove(),u=null,d=null,f=null,e&&je(x())},w=()=>{if(!u)return;let e=c(),n=l(),r=t.getBoundingClientRect(),i=u.getBoundingClientRect(),a=e.documentElement.clientWidth||n.innerWidth,d=e.documentElement.clientHeight||n.innerHeight,f=a-s-i.width,p=r.left+r.width/2-i.width/2,m=$(p,s,f),h=r.top-s,g=d-s-r.bottom,_=h>=i.height+o||h>=g?`top`:`bottom`,v=_===`top`?r.top-o-i.height:r.bottom+o,y=d-s-i.height,b=$(v,s,y),x=r.left+r.width/2,S=Math.max(10,i.width-10),C=$(x-m,10,S);u.dataset.placement=_,u.style.left=`${m}px`,u.style.top=`${b}px`,u.style.setProperty(`--persona-tooltip-arrow-x`,`${C}px`)},T=()=>{if(_||!a||u||!t.isConnected||Me(t))return;let e=v(),n=Pe(t);if(!e||!n)return;let r=c(),i=l();u=r.createElement(`div`),u.className=`persona-control-tooltip`,u.setAttribute(`role`,`tooltip`),u.dataset.state=`measuring`,u.style.zIndex=String(De);let o=i.getComputedStyle?.(t);if(o){for(let e of Fe){let t=o.getPropertyValue(e).trim();t&&u.style.setProperty(e,t)}o.fontFamily&&(u.style.fontFamily=o.fontFamily)}d=r.createElement(`span`),d.className=`persona-control-tooltip__label`,d.textContent=e,u.appendChild(d);let s=y();s&&(f=r.createElement(`span`),f.className=`persona-control-tooltip__hint`,f.textContent=s,u.appendChild(f));let m=r.createElement(`span`);m.className=`persona-control-tooltip__arrow`,u.appendChild(m),n.appendChild(u),w(),u.dataset.state=`open`;let h=()=>{if(!t.isConnected){C();return}d&&(d.textContent=v()),f&&(f.textContent=y());let e=Pe(t);u&&e&&u.parentNode!==e&&e.appendChild(u),w()};i.addEventListener(`scroll`,h,!0),i.addEventListener(`resize`,h);let g=t.closest(`[data-persona-root]`);g?.addEventListener(`persona:internal:host-moved`,h);let b=t.getRootNode(),x=Ne(b)?b:r.documentElement,S=typeof MutationObserver>`u`?null:new MutationObserver(()=>{t.isConnected||C()});S?.observe(x,{childList:!0,subtree:!0}),p=()=>{i.removeEventListener(`scroll`,h,!0),i.removeEventListener(`resize`,h),g?.removeEventListener(`persona:internal:host-moved`,h),S?.disconnect()}},E=e=>{_||u||(S(),e||b()<=0||Ae()?T():m=l().setTimeout(()=>{m=void 0,T()},b()))},D=()=>{h||g?E(g):C()},O=()=>{let e=l();e.matchMedia&&e.matchMedia(`(hover: none)`).matches||(h=!0,D())},k=()=>{h=!1,D()},A=()=>{try{g=t.matches(`:focus-visible`)}catch{g=!0}D()},j=()=>{g=!1,D()},M=()=>{h=!1,g=!1,C()},N=e=>{e.key===`Escape`&&M()};n.addEventListener(`mouseenter`,O),n.addEventListener(`mouseleave`,k),t.addEventListener(`focus`,A),t.addEventListener(`blur`,j),t.addEventListener(`keydown`,N),t.addEventListener(`click`,M);let P={get isOpen(){return u!==null},show:T,hide:C,reposition:w,destroy:()=>{_||(_=!0,C(),n.removeEventListener(`mouseenter`,O),n.removeEventListener(`mouseleave`,k),t.removeEventListener(`focus`,A),t.removeEventListener(`blur`,j),t.removeEventListener(`keydown`,N),t.removeEventListener(`click`,M),Q.delete(t))}};return Q.set(t,P),P}const Le={collapsedMode:`tool-call`,activePreview:!1,grouped:!1,groupedMode:`stack`,groupBoundary:`adjacent`,previewMaxLines:3,expandable:!0,loadingAnimation:`none`},Re={activePreview:!1,previewMaxLines:3,expandable:!0,loadingAnimation:`none`},ze={layout:`row`,variant:`row`,iconVisibility:`active`,autoExpand:!1,grouped:!0,groupedMode:`collapsible`,groupAppearance:`inset`,loadingAnimation:`shimmer`},Be={appearance:`inset`,layout:`row`,variant:`row`,iconVisibility:`active`,autoExpand:!1,loadingAnimation:`shimmer`};o();const Ve={resolvedDisplay:`row`,primaryAction:`allow-once`,keyboardShortcuts:`focused`},He={apiUrl:`https://api.runtype.com/api/chat/dispatch`,clientToken:void 0,agentId:void 0,target:void 0,theme:void 0,darkTheme:void 0,colorScheme:`light`,tooltip:{delayMs:400,skipDelayMs:300},launcher:{enabled:!0,mountMode:`floating`,dock:{side:`right`,width:`420px`},title:`Chat Assistant`,subtitle:`Here to help you get answers fast`,agentIconText:`💬`,agentIconName:`bot`,headerIconName:`bot`,position:`bottom-right`,width:`min(440px, calc(100vw - 24px))`,heightOffset:0,autoExpand:!1,callToActionIconHidden:!1,agentIconSize:`40px`,headerIconSize:`40px`,closeButtonPaddingX:`0px`,closeButtonPaddingY:`0px`,callToActionIconName:`arrow-up-right`,callToActionIconText:``,callToActionIconSize:`32px`,callToActionIconPadding:`5px`,callToActionIconColor:void 0,callToActionIconBackgroundColor:void 0,closeButtonBackgroundColor:`transparent`,clearChat:{backgroundColor:`transparent`,borderColor:`transparent`,enabled:!0,placement:`inline`,iconName:`refresh-cw`,showTooltip:!0,tooltipText:`Clear chat`,paddingX:`0px`,paddingY:`0px`},headerIconHidden:!1,border:void 0,shadow:`0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1)`},copy:{inputPlaceholder:`How can I help...`,sendButtonLabel:`Send`},sendButton:{borderWidth:`0px`,paddingX:`12px`,paddingY:`10px`,borderColor:void 0,useIcon:!0,iconText:`↑`,showTooltip:!0,tooltipText:`Send message`,iconName:`send`},statusIndicator:{visible:!0,idleText:`Online`,connectingText:`Connecting…`,connectedText:`Streaming…`,errorText:`Offline`},voiceRecognition:{enabled:!0,pauseDuration:2e3,iconName:`mic`,borderWidth:`0px`,iconColor:void 0,backgroundColor:`transparent`,borderColor:`transparent`,recordingIconColor:void 0,recordingBackgroundColor:void 0,recordingBorderColor:`transparent`,showTooltip:!0,tooltipText:`Start voice recognition`},features:{showReasoning:!0,showToolCalls:!0,scrollToBottom:{enabled:!0,iconName:`arrow-down`,label:``,streamingIndicator:`arrow`,scrollBehavior:`instant`,scrollDurationMs:220,transition:`none`},scrollBehavior:{mode:`anchor-top`,anchorTopOffset:16,showActivityWhilePinned:!0},toolCallDisplay:Le,reasoningDisplay:Re,streamAnimation:{type:`none`,placeholder:`none`,speed:120,duration:1800},askUserQuestion:{enabled:!0,slideInMs:180,freeTextLabel:`Other…`,freeTextPlaceholder:`Type your answer…`,submitLabel:`Send`},history:{enabled:!1,presentation:`panel`,showScopeStatus:!0,showDelete:!0,showDeleteAll:!0}},suggestionChips:[`Show me what you can help with`,`Walk me through getting started`,`Answer a question about this page`],suggestionChipsConfig:{fontFamily:`sans-serif`,fontWeight:`500`,paddingX:`12px`,paddingY:`6px`},layout:{header:{layout:`default`,showIcon:!0,showTitle:!0,showSubtitle:!0,showCloseButton:!0,showClearChat:!0},messages:{layout:`bubble`,avatar:{show:!1,position:`left`},timestamp:{show:!1,position:`below`},groupConsecutive:!1},slots:{}},markdown:{options:{gfm:!0,breaks:!0},disableDefaultStyles:!1},messageActions:{enabled:!0,showCopy:!0,showUpvote:!1,showDownvote:!1,visibility:`hover`,align:`right`,layout:`pill-inside`},debug:!1},Ue={},We={colorScheme:`light`,errorDisplay:`block`,messageActions:{visibility:void 0},suggestionChipsConfig:{fontWeight:void 0},approval:Ve,loadingIndicator:{variant:`label`},launcher:{variant:`circle`,width:`min(400px, calc(100vw - 24px))`,headerIconSize:`20px`},features:{artifacts:{enabled:!0},scrollToBottom:{streamingIndicator:`dots`,transition:`fade`,scrollBehavior:`smooth`},toolCallDisplay:ze,reasoningDisplay:Be},composer:{layout:`single-row`,placement:`overlay`},sendButton:{iconName:`arrow-up`},statusIndicator:{mode:`transient`},layout:{contentMaxWidth:`768px`,topFade:!0,header:{showSubtitle:!1},messages:{assistant:{width:`full`}}}};function Ge(e){return e?.future?.v5Defaults===!0?`v5`:`v4`}function Ke(e){let t=Ge(e)===`v5`?We:Ue;return i(He,t)}Ke();var qe,Je;e((()=>{qe=[`image/png`,`image/jpeg`,`image/gif`,`image/webp`,`image/svg+xml`,`image/bmp`],Je=[`application/pdf`,`text/plain`,`text/markdown`,`text/csv`,`application/msword`,`application/vnd.openxmlformats-officedocument.wordprocessingml.document`,`application/vnd.ms-excel`,`application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`,`application/json`],[...qe,...Je]}))(),u();function Ye(e){let{config:t,onOpen:n}=e,r=t.buttonIconName??`plus`,i=t.buttonTooltipText??`Add context`,a=s(`div`,`persona-send-button-wrapper`),o=c(`button`,{className:`persona-rounded-button persona-flex persona-items-center persona-justify-center disabled:persona-opacity-50 persona-cursor-pointer persona-mention-button persona-composer-control persona-composer-control--glyph`,attrs:{type:`button`,"data-persona-composer-mention-button":``,"aria-label":i,"aria-haspopup":`listbox`,"aria-expanded":`false`},style:{fontSize:`18px`,lineHeight:`1`}}),l=Z(r,24,`currentColor`,1.5);return l?o.appendChild(l):o.textContent=`+`,o.addEventListener(`click`,e=>{e.preventDefault(),e.stopPropagation(),n()}),a.appendChild(o),Ie({anchor:o,trigger:a,text:()=>o.getAttribute(`aria-label`)??i}),{button:o,wrapper:a}}const{setLoader:Xe,load:Ze}=q({fallbackImport:()=>import(`@runtypelabs/persona/context-mentions`)}),Qe=Ze,{setLoader:$e,load:et}=q({fallbackImport:()=>import(`@runtypelabs/persona/context-mentions-inline`),resetOnSetLoader:!0}),tt=et;u();function nt(e,t={}){if(t.render)return t.render({ref:e,readonly:!!t.readonly});let n=c(`span`,{className:l(`persona-mention-token`,t.readonly&&`persona-mention-token-readonly`),attrs:{"data-mention-source":e.sourceId,title:e.label,role:`img`,"aria-label":`${e.label} mention`}});e.color&&n.style.setProperty(`--persona-mention-token-accent`,e.color);let r=Z(e.iconName??`at-sign`,13,`currentColor`,2);if(r){let e=s(`span`,`persona-mention-token-icon`);e.appendChild(r),n.appendChild(e)}return n.appendChild(c(`span`,{className:`persona-mention-token-label`,text:`@${e.label}`})),n}u();const rt={loadContextMentions:()=>Qe(),loadContextMentionsInline:()=>tt(),renderLucideIcon:(...e)=>Z(...e),createMentionButton:(...e)=>Ye(...e)};function it(e){let{loadContextMentions:t,loadContextMentionsInline:n,renderLucideIcon:r,createMentionButton:i}=e.deps??rt,a=e.config.contextMentions;if(!a?.enabled)return null;let o=me(a).filter(e=>e.sources.length>0);if(o.length===0)return typeof console<`u`&&console.warn(`[Persona] contextMentions.enabled is true but no sources were provided; mentions are disabled.`),null;let s=o.filter(e=>e.sources.some(e=>typeof e.matchCommand==`function`)),l=e=>s.some(t=>t.trigger?t.position===`line-start`?e.split(`
|
|
335
|
+
;let X=!1;const be=/* @__PURE__ */ new Set,xe=e=>{let t=[...be];e&&be.clear();for(let e of t)try{e()}catch{}},Se=()=>{let e=0;for(let[t,n]of Y){let r=J.get(n);if(!r)continue;Y.delete(t),e++;let i=K(r);if(i)for(t.removeAttribute(`data-persona-icon-pending`);i.firstChild;)t.appendChild(i.firstChild)}return e},Ce=e=>{if(!X){for(let[t,n]of Object.entries(e))J.has(t)||J.set(t,n);X=!0,Se(),xe(!0)}},we=()=>X?null:_e().then(e=>Ce(e.EXTRA_LUCIDE_ICONS)),Te=()=>{we()?.catch(e=>{console.warn(`[Persona] Failed to load the icons-extra chunk`,e)})},Ee=(e,t,n)=>{let r=K([],e,t,n);return r.setAttribute(`data-persona-icon-pending`,`true`),r},Z=(e,t=24,n=`currentColor`,r=2)=>{let i=J.get(e);if(i)return K(i,t,n,r);if(ye.includes(e)){let i=Ee(t,n,r);return Y.size>=500&&Y.delete(Y.keys().next().value),Y.set(i,e),Te(),i}return console.warn(`Unknown Persona icon "${e}". Use registerIcons().`),null};var De;e((()=>{De=100001}))();let Oe=0;const ke=e=>Math.max(0,e),Ae=()=>Date.now()<Oe,je=e=>{Oe=e>0?Date.now()+e:0},Q=/* @__PURE__ */ new WeakMap,Me=e=>typeof e.closest==`function`&&e.closest(`[data-persona-tooltip-suppressed]`)!==null,Ne=e=>e.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&`host`in e,Pe=e=>{let t=e.getRootNode?.();return Ne(t)?t:e.closest(`dialog[open]`)??e.ownerDocument.body},$=(e,t,n)=>Math.min(Math.max(e,t),Math.max(t,n)),Fe=[...[`background`,`foreground`,`hint-fg`,`radius`,`font-size`,`padding`,`max-width`,`shadow`,`arrow-display`].map(e=>`--persona-tooltip-${e}`),`--persona-font-family`,`--persona-radius-sm`];function Ie(e){Q.get(e.anchor)?.destroy();let{anchor:t,trigger:n=t,text:r,hint:i,enabled:a=!0,gap:o=8,viewportPadding:s=8}=e,c=()=>t.ownerDocument,l=()=>c().defaultView??window,u=null,d=null,f=null,p=null,m,h=!1,g=!1,_=!1,v=()=>(typeof r==`function`?r():r).trim(),y=()=>(typeof i==`function`?i():i??``).trim(),b=()=>ke(e.delayMs??400),x=()=>ke(e.skipDelayMs??300),S=()=>{m!==void 0&&(l().clearTimeout(m),m=void 0)},C=()=>{S();let e=u!==null;p?.(),p=null,u?.remove(),u=null,d=null,f=null,e&&je(x())},w=()=>{if(!u)return;let e=c(),n=l(),r=t.getBoundingClientRect(),i=u.getBoundingClientRect(),a=e.documentElement.clientWidth||n.innerWidth,d=e.documentElement.clientHeight||n.innerHeight,f=a-s-i.width,p=r.left+r.width/2-i.width/2,m=$(p,s,f),h=r.top-s,g=d-s-r.bottom,_=h>=i.height+o||h>=g?`top`:`bottom`,v=_===`top`?r.top-o-i.height:r.bottom+o,y=d-s-i.height,b=$(v,s,y),x=r.left+r.width/2,S=Math.max(10,i.width-10),C=$(x-m,10,S);u.dataset.placement=_,u.style.left=`${m}px`,u.style.top=`${b}px`,u.style.setProperty(`--persona-tooltip-arrow-x`,`${C}px`)},T=()=>{if(_||!a||u||!t.isConnected||Me(t))return;let e=v(),n=Pe(t);if(!e||!n)return;let r=c(),i=l();u=r.createElement(`div`),u.className=`persona-control-tooltip`,u.setAttribute(`role`,`tooltip`),u.dataset.state=`measuring`,u.style.zIndex=String(De);let o=i.getComputedStyle?.(t);if(o){for(let e of Fe){let t=o.getPropertyValue(e).trim();t&&u.style.setProperty(e,t)}o.fontFamily&&(u.style.fontFamily=o.fontFamily)}d=r.createElement(`span`),d.className=`persona-control-tooltip__label`,d.textContent=e,u.appendChild(d);let s=y();s&&(f=r.createElement(`span`),f.className=`persona-control-tooltip__hint`,f.textContent=s,u.appendChild(f));let m=r.createElement(`span`);m.className=`persona-control-tooltip__arrow`,u.appendChild(m),n.appendChild(u),w(),u.dataset.state=`open`;let h=()=>{if(!t.isConnected){C();return}d&&(d.textContent=v()),f&&(f.textContent=y());let e=Pe(t);u&&e&&u.parentNode!==e&&e.appendChild(u),w()};i.addEventListener(`scroll`,h,!0),i.addEventListener(`resize`,h);let g=t.closest(`[data-persona-root]`);g?.addEventListener(`persona:internal:host-moved`,h);let b=t.getRootNode(),x=Ne(b)?b:r.documentElement,S=typeof MutationObserver>`u`?null:new MutationObserver(()=>{t.isConnected||C()});S?.observe(x,{childList:!0,subtree:!0}),p=()=>{i.removeEventListener(`scroll`,h,!0),i.removeEventListener(`resize`,h),g?.removeEventListener(`persona:internal:host-moved`,h),S?.disconnect()}},E=e=>{_||u||(S(),e||b()<=0||Ae()?T():m=l().setTimeout(()=>{m=void 0,T()},b()))},D=()=>{h||g?E(g):C()},O=()=>{let e=l();e.matchMedia&&e.matchMedia(`(hover: none)`).matches||(h=!0,D())},k=()=>{h=!1,D()},A=()=>{try{g=t.matches(`:focus-visible`)}catch{g=!0}D()},j=()=>{g=!1,D()},M=()=>{h=!1,g=!1,C()},N=e=>{e.key===`Escape`&&M()};n.addEventListener(`mouseenter`,O),n.addEventListener(`mouseleave`,k),t.addEventListener(`focus`,A),t.addEventListener(`blur`,j),t.addEventListener(`keydown`,N),t.addEventListener(`click`,M);let P={get isOpen(){return u!==null},show:T,hide:C,reposition:w,destroy:()=>{_||(_=!0,C(),n.removeEventListener(`mouseenter`,O),n.removeEventListener(`mouseleave`,k),t.removeEventListener(`focus`,A),t.removeEventListener(`blur`,j),t.removeEventListener(`keydown`,N),t.removeEventListener(`click`,M),Q.delete(t))}};return Q.set(t,P),P}const Le={collapsedMode:`tool-call`,activePreview:!1,grouped:!1,groupedMode:`stack`,groupBoundary:`adjacent`,previewMaxLines:3,expandable:!0,loadingAnimation:`none`},Re={activePreview:!1,previewMaxLines:3,expandable:!0,loadingAnimation:`none`},ze={layout:`row`,variant:`row`,iconVisibility:`active`,autoExpand:!1,grouped:!0,groupedMode:`collapsible`,groupAppearance:`inset`,loadingAnimation:`shimmer`},Be={appearance:`inset`,layout:`row`,variant:`row`,iconVisibility:`active`,autoExpand:!1,loadingAnimation:`shimmer`};o();const Ve={resolvedDisplay:`row`,primaryAction:`allow-once`,keyboardShortcuts:`focused`},He={apiUrl:`https://api.runtype.com/api/chat/dispatch`,clientToken:void 0,agentId:void 0,target:void 0,theme:void 0,darkTheme:void 0,colorScheme:`light`,tooltip:{delayMs:400,skipDelayMs:300},launcher:{enabled:!0,mountMode:`floating`,dock:{side:`right`,width:`420px`},title:`Chat Assistant`,subtitle:`Here to help you get answers fast`,agentIconText:`💬`,agentIconName:`bot`,headerIconName:`bot`,position:`bottom-right`,width:`min(440px, calc(100vw - 24px))`,heightOffset:0,autoExpand:!1,callToActionIconHidden:!1,agentIconSize:`40px`,headerIconSize:`40px`,closeButtonPaddingX:`0px`,closeButtonPaddingY:`0px`,callToActionIconName:`arrow-up-right`,callToActionIconText:``,callToActionIconSize:`32px`,callToActionIconPadding:`5px`,callToActionIconColor:void 0,callToActionIconBackgroundColor:void 0,closeButtonBackgroundColor:`transparent`,clearChat:{backgroundColor:`transparent`,borderColor:`transparent`,enabled:!0,placement:`inline`,iconName:`refresh-cw`,showTooltip:!0,tooltipText:`Clear chat`,paddingX:`0px`,paddingY:`0px`},headerIconHidden:!1,border:void 0,shadow:`0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1)`},copy:{inputPlaceholder:`How can I help...`,sendButtonLabel:`Send`},sendButton:{borderWidth:`0px`,paddingX:`12px`,paddingY:`10px`,borderColor:void 0,useIcon:!0,iconText:`↑`,showTooltip:!0,tooltipText:`Send message`,iconName:`send`},statusIndicator:{visible:!0,idleText:`Online`,connectingText:`Connecting…`,connectedText:`Streaming…`,errorText:`Offline`},voiceRecognition:{enabled:!0,pauseDuration:2e3,iconName:`mic`,borderWidth:`0px`,iconColor:void 0,backgroundColor:`transparent`,borderColor:`transparent`,recordingIconColor:void 0,recordingBackgroundColor:void 0,recordingBorderColor:`transparent`,showTooltip:!0,tooltipText:`Start voice recognition`},features:{showReasoning:!0,showToolCalls:!0,scrollToBottom:{enabled:!0,iconName:`arrow-down`,label:``,streamingIndicator:`arrow`,scrollBehavior:`instant`,scrollDurationMs:220,transition:`none`},scrollBehavior:{mode:`anchor-top`,anchorTopOffset:16,showActivityWhilePinned:!0},toolCallDisplay:Le,reasoningDisplay:Re,streamAnimation:{type:`none`,placeholder:`none`,speed:120,duration:1800},askUserQuestion:{enabled:!0,slideInMs:180,freeTextLabel:`Other…`,freeTextPlaceholder:`Type your answer…`,submitLabel:`Send`},history:{enabled:!1,presentation:`panel`,showScopeStatus:!0,showDelete:!0,showDeleteAll:!0}},suggestionChips:[`Show me what you can help with`,`Walk me through getting started`,`Answer a question about this page`],suggestionChipsConfig:{fontFamily:`sans-serif`,fontWeight:`500`,paddingX:`12px`,paddingY:`6px`},layout:{header:{layout:`default`,showIcon:!0,showTitle:!0,showSubtitle:!0,showCloseButton:!0,showClearChat:!0},messages:{layout:`bubble`,avatar:{show:!1,position:`left`},timestamp:{show:!1,position:`below`},groupConsecutive:!1},slots:{}},markdown:{options:{gfm:!0,breaks:!0},disableDefaultStyles:!1},messageActions:{enabled:!0,showCopy:!0,showUpvote:!1,showDownvote:!1,visibility:`hover`,align:`right`,layout:`pill-inside`},debug:!1},Ue={},We={colorScheme:`light`,errorDisplay:`block`,messageActions:{visibility:void 0},suggestionChipsConfig:{fontWeight:void 0},approval:Ve,loadingIndicator:{variant:`label`},launcher:{variant:`circle`,width:`min(400px, calc(100vw - 24px))`,headerIconSize:`20px`},features:{artifacts:{enabled:!0},scrollToBottom:{streamingIndicator:`dots`,transition:`fade`,scrollBehavior:`smooth`},userMessageCollapse:{enabled:!0},toolCallDisplay:ze,reasoningDisplay:Be},composer:{layout:`single-row`,placement:`overlay`},sendButton:{iconName:`arrow-up`},statusIndicator:{mode:`transient`},layout:{contentMaxWidth:`768px`,topFade:!0,header:{showSubtitle:!1},messages:{assistant:{width:`full`}}}};function Ge(e){return e?.future?.v5Defaults===!0?`v5`:`v4`}function Ke(e){let t=Ge(e)===`v5`?We:Ue;return i(He,t)}Ke();var qe,Je;e((()=>{qe=[`image/png`,`image/jpeg`,`image/gif`,`image/webp`,`image/svg+xml`,`image/bmp`],Je=[`application/pdf`,`text/plain`,`text/markdown`,`text/csv`,`application/msword`,`application/vnd.openxmlformats-officedocument.wordprocessingml.document`,`application/vnd.ms-excel`,`application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`,`application/json`],[...qe,...Je]}))(),u();function Ye(e){let{config:t,onOpen:n}=e,r=t.buttonIconName??`plus`,i=t.buttonTooltipText??`Add context`,a=s(`div`,`persona-send-button-wrapper`),o=c(`button`,{className:`persona-rounded-button persona-flex persona-items-center persona-justify-center disabled:persona-opacity-50 persona-cursor-pointer persona-mention-button persona-composer-control persona-composer-control--glyph`,attrs:{type:`button`,"data-persona-composer-mention-button":``,"aria-label":i,"aria-haspopup":`listbox`,"aria-expanded":`false`},style:{fontSize:`18px`,lineHeight:`1`}}),l=Z(r,24,`currentColor`,1.5);return l?o.appendChild(l):o.textContent=`+`,o.addEventListener(`click`,e=>{e.preventDefault(),e.stopPropagation(),n()}),a.appendChild(o),Ie({anchor:o,trigger:a,text:()=>o.getAttribute(`aria-label`)??i}),{button:o,wrapper:a}}const{setLoader:Xe,load:Ze}=q({fallbackImport:()=>import(`@runtypelabs/persona/context-mentions`)}),Qe=Ze,{setLoader:$e,load:et}=q({fallbackImport:()=>import(`@runtypelabs/persona/context-mentions-inline`),resetOnSetLoader:!0}),tt=et;u();function nt(e,t={}){if(t.render)return t.render({ref:e,readonly:!!t.readonly});let n=c(`span`,{className:l(`persona-mention-token`,t.readonly&&`persona-mention-token-readonly`),attrs:{"data-mention-source":e.sourceId,title:e.label,role:`img`,"aria-label":`${e.label} mention`}});e.color&&n.style.setProperty(`--persona-mention-token-accent`,e.color);let r=Z(e.iconName??`at-sign`,13,`currentColor`,2);if(r){let e=s(`span`,`persona-mention-token-icon`);e.appendChild(r),n.appendChild(e)}return n.appendChild(c(`span`,{className:`persona-mention-token-label`,text:`@${e.label}`})),n}u();const rt={loadContextMentions:()=>Qe(),loadContextMentionsInline:()=>tt(),renderLucideIcon:(...e)=>Z(...e),createMentionButton:(...e)=>Ye(...e)};function it(e){let{loadContextMentions:t,loadContextMentionsInline:n,renderLucideIcon:r,createMentionButton:i}=e.deps??rt,a=e.config.contextMentions;if(!a?.enabled)return null;let o=me(a).filter(e=>e.sources.length>0);if(o.length===0)return typeof console<`u`&&console.warn(`[Persona] contextMentions.enabled is true but no sources were provided; mentions are disabled.`),null;let s=o.filter(e=>e.sources.some(e=>typeof e.matchCommand==`function`)),l=e=>s.some(t=>t.trigger?t.position===`line-start`?e.split(`
|
|
336
336
|
`).some(e=>e.startsWith(t.trigger)):(t.position===`anywhere`?e:e.split(`
|
|
337
337
|
`)[0]).startsWith(t.trigger):!1),u=(t,n)=>{if(typeof window<`u`)try{window.dispatchEvent(new CustomEvent(`persona:mention:${t}`,{detail:{...n,instanceId:e.textarea.closest(`[data-persona-instance]`)?.dataset.personaInstance}}))}catch{}},d=!e.chipRow,f=e.chipRow??c(`div`,{className:`persona-mention-context-row`,attrs:{"data-persona-mention-context-row":``}}),p=null,m=null,h=e.textarea,g=null,_=null,v=null,y=null,b=()=>{if(p)return Promise.resolve(p);if(m)return m;let n=t().then(t=>(t.setMentionIconRenderer(r),p=t.mountContextMentions({mentionConfig:a,textarea:e.textarea,composerInput:g??void 0,anchor:e.anchor,contextRow:f,getMessages:e.getMessages,getConfig:()=>e.config,liveRegionHost:e.liveRegionHost,popoverContainer:e.popoverContainer,onPickerOpenChange:C,emit:u}),p)).catch(e=>(typeof console<`u`&&console.warn(`[Persona] Failed to load context mentions runtime`,e),m===n&&(m=null),null));return m=n,n};a.display===`inline`&&n().then(t=>{let n=t.mountInlineComposer({textarea:e.textarea,renderToken:e=>nt(e,{render:a.renderMentionToken}),onMentionRemoved:e=>p?.untrackMention(e)});g=n.input,_=n.destroy;let r=h;r.replaceWith(n.element),h=n.element,y={next:n.element,prev:r},v?.(n.element,r),p?p.rebindComposer(n.input):m&&m.then(e=>e?.rebindComposer(n.input))}).catch(e=>{typeof console<`u`&&console.warn(`[Persona] Failed to load inline mention composer`,e)});let x=[],S=/* @__PURE__ */ new Map;for(let e of o){if(!e.showButton)continue;let t=i({config:{...a,buttonIconName:e.buttonIconName,buttonTooltipText:e.buttonTooltipText},onOpen:()=>{b().then(t=>t?.openMenu(e.trigger))}});x.push(t),S.set(e.trigger,t.button)}let C=(e,t,n)=>{let r=S.get(t);r&&(r.setAttribute(`aria-expanded`,e?`true`:`false`),e?r.setAttribute(`aria-controls`,n):r.removeAttribute(`aria-controls`))};return{affordanceButtons:x.map(e=>e.wrapper),contextRow:f,handleInput:e=>{if(p){p.handleInput();return}if(!pe(e))return;let t=h,n=t.selectionStart??0;fe(t.value,n,o)&&b().then(e=>e?.handleInput())},handleKeydown:e=>{if(p?.isMenuOpen())return p.handleKeydown(e);if(e.key===`Backspace`&&p?.hasMentions()&&!y){let t=h,n=t.selectionStart===0&&t.selectionEnd===0;if((t.value.length===0||n)&&p.removeLastChip())return e.preventDefault(),!0}return!1},isMenuOpen:()=>p?.isMenuOpen()??!1,hasMentions:()=>p?.hasMentions()??!1,getMentionRefs:()=>p?.getMentionRefs()??[],captureDraft:()=>p?.captureDraft()??[],restoreDraft:e=>p?.restoreDraft(e),getInlineInput:()=>g,collectForSubmit:()=>p?.collectForSubmit()??null,takeInlineCommand:async e=>l(e)?(p??await b())?.dispatchInlineCommand(e)??null:null,clear:()=>p?.clear(),prefetch:()=>{t().catch(()=>{})},onComposerSwap:e=>{v=e,y&&e(y.next,y.prev)},destroy:()=>{p?.destroy(),_?.();for(let e of x)e.wrapper.remove();d&&f.remove()}}}export{ce as createAskUserSheetHandlers,it as createContextMentionOrchestrator};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { aa as VoiceClientToolsSession, ia as VoiceClientToolsChannel, ra as VoiceClientTools, rr as ClientToolDefinition } from "./types-
|
|
2
|
-
//#region src/voice/voice-client-tools-session.d.ts
|
|
1
|
+
import { aa as VoiceClientToolsSession, ia as VoiceClientToolsChannel, ra as VoiceClientTools, rr as ClientToolDefinition } from "./types-9i0xcAMT.cjs";
|
|
3
2
|
/** The name the server calls a client tool back with: `webmcp:` prefixed for page tools. */
|
|
4
3
|
export declare function voiceClientToolName(tool: ClientToolDefinition): string;
|
|
5
4
|
/**
|
|
@@ -9,5 +8,4 @@ export declare function voiceClientToolName(tool: ClientToolDefinition): string;
|
|
|
9
8
|
* `voice-client-tools` chunk, loaded only when the server negotiates it.
|
|
10
9
|
*/
|
|
11
10
|
export declare function createVoiceClientToolsSession(surface: VoiceClientTools, channel: VoiceClientToolsChannel): VoiceClientToolsSession;
|
|
12
|
-
//#endregion
|
|
13
11
|
export {}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { aa as VoiceClientToolsSession, ia as VoiceClientToolsChannel, ra as VoiceClientTools, rr as ClientToolDefinition } from "./types-
|
|
2
|
-
//#region src/voice/voice-client-tools-session.d.ts
|
|
1
|
+
import { aa as VoiceClientToolsSession, ia as VoiceClientToolsChannel, ra as VoiceClientTools, rr as ClientToolDefinition } from "./types-9i0xcAMT.js";
|
|
3
2
|
/** The name the server calls a client tool back with: `webmcp:` prefixed for page tools. */
|
|
4
3
|
export declare function voiceClientToolName(tool: ClientToolDefinition): string;
|
|
5
4
|
/**
|
|
@@ -9,5 +8,4 @@ export declare function voiceClientToolName(tool: ClientToolDefinition): string;
|
|
|
9
8
|
* `voice-client-tools` chunk, loaded only when the server negotiates it.
|
|
10
9
|
*/
|
|
11
10
|
export declare function createVoiceClientToolsSession(surface: VoiceClientTools, channel: VoiceClientToolsChannel): VoiceClientToolsSession;
|
|
12
|
-
//#endregion
|
|
13
11
|
export {}
|