@tomny-dev/uzi 0.19.0-pr.131.455.1.82ab131 → 0.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/ai-chat/AIChat.d.ts.map +1 -1
- package/dist/index83.js +3 -3
- package/dist/index83.js.map +1 -1
- package/dist/index84.cjs +3 -3
- package/dist/index84.cjs.map +1 -1
- package/dist/index84.js +27 -28
- package/dist/index84.js.map +1 -1
- package/dist/index85.cjs +27 -28
- package/dist/index85.cjs.map +1 -1
- package/dist/style.css +13 -17
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AIChat.d.ts","sourceRoot":"","sources":["../../../src/components/ai-chat/AIChat.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAA4B,SAAS,EAAE,MAAM,OAAO,CAAC;AAG/F,OAAO,EAAE,SAAS,EAAE,sBAAsB,EAAgB,MAAM,sBAAsB,CAAC;AAIvF,KAAK,sBAAsB,GAAG,WAAW,CAAC,qBAAqB,CAAC,OAAO,sBAAsB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAEnG,MAAM,WAAW,WAAW;IAC1B,yCAAyC;IACzC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,yEAAyE;IACzE,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,+EAA+E;IAC/E,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,iFAAiF;IACjF,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,UAAU,CAAC,KAAK,CAAC;IACzC,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC1C,QAAQ,CAAC,WAAW,CAAC,EAAE,kBAAkB,CAAC;IAC1C,2EAA2E;IAC3E,QAAQ,CAAC,0BAA0B,CAAC,EAAE,sBAAsB,C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jG;AA0JD,wBAAgB,MAAM,CAAC,EACrB,GAAG,EACH,KAAK,EACL,UAAU,EACV,KAAK,EAAE,YAAY,EACnB,OAAO,EACP,WAAW,EACX,0BAA0B,EAC1B,UAAU,EACV,YAAoC,EACpC,gBAAsC,EACtC,cAA0B,EAC1B,cAAqB,EACrB,UAAU,EACV,cAAc,EACd,oBAA2B,EAC3B,iBAAiB,EACjB,WAAW,EACX,aAAa,EACb,kBAAkB,EAClB,OAAO,EACP,qBAAqB,EACrB,OAAO,EACP,SAAS,EACT,KAAK,GACN,EAAE,WAAW,2CAuDb;AAwND;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,EACzB,QAAQ,EACR,MAAgB,EAChB,aAA2C,EAC3C,kBAAkB,EAClB,KAAK,EACL,KAAU,EACV,aAAa,EACb,MAAM,EACN,MAAM,EACN,OAAO,EACP,SAAS,EACT,oBAA2B,EAC3B,YAAY,EACZ,gBAAsC,EACtC,cAA0B,EAC1B,cAAqB,EACrB,UAAU,EACV,WAAW,EACX,mBAAmB,EACnB,kBAAkB,EAClB,gBAAgB,EAChB,eAAe,EACf,cAAc,EACd,cAAc,EACd,MAAM,EACN,eAAe,EACf,gBAAgB,EAChB,QAAQ,EACR,UAAU,EACV,SAAS,EACT,KAAK,GACN,EAAE,eAAe,
|
|
1
|
+
{"version":3,"file":"AIChat.d.ts","sourceRoot":"","sources":["../../../src/components/ai-chat/AIChat.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAA4B,SAAS,EAAE,MAAM,OAAO,CAAC;AAG/F,OAAO,EAAE,SAAS,EAAE,sBAAsB,EAAgB,MAAM,sBAAsB,CAAC;AAIvF,KAAK,sBAAsB,GAAG,WAAW,CAAC,qBAAqB,CAAC,OAAO,sBAAsB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAEnG,MAAM,WAAW,WAAW;IAC1B,yCAAyC;IACzC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IAC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js
CHANGED
|
@@ -46,9 +46,9 @@ var attachmentCard = "uzi-ai-chat-module__attachmentCard__JdvKJ";
|
|
|
46
46
|
var stagedAttachment = "uzi-ai-chat-module__stagedAttachment__5axXj";
|
|
47
47
|
var stagedFileAttachment = "uzi-ai-chat-module__stagedFileAttachment__hZfVm";
|
|
48
48
|
var sentAttachment = "uzi-ai-chat-module__sentAttachment__PP-fs";
|
|
49
|
+
var sentImageAttachment = "uzi-ai-chat-module__sentImageAttachment__M9wpx";
|
|
49
50
|
var imageAttachmentButton = "uzi-ai-chat-module__imageAttachmentButton__PM2cf";
|
|
50
51
|
var attachmentThumbnail = "uzi-ai-chat-module__attachmentThumbnail__OzmIc";
|
|
51
|
-
var sentAttachmentName = "uzi-ai-chat-module__sentAttachmentName__rGevY";
|
|
52
52
|
var fileAttachment = "uzi-ai-chat-module__fileAttachment__lVB09";
|
|
53
53
|
var fileAttachmentDetails = "uzi-ai-chat-module__fileAttachmentDetails__NVfrg";
|
|
54
54
|
var removeAttachment = "uzi-ai-chat-module__removeAttachment__ck6iq";
|
|
@@ -105,9 +105,9 @@ var ai_chat_module_default = {
|
|
|
105
105
|
stagedAttachment,
|
|
106
106
|
stagedFileAttachment,
|
|
107
107
|
sentAttachment,
|
|
108
|
+
sentImageAttachment,
|
|
108
109
|
imageAttachmentButton,
|
|
109
110
|
attachmentThumbnail,
|
|
110
|
-
sentAttachmentName,
|
|
111
111
|
fileAttachment,
|
|
112
112
|
fileAttachmentDetails,
|
|
113
113
|
removeAttachment,
|
|
@@ -116,6 +116,6 @@ var ai_chat_module_default = {
|
|
|
116
116
|
attachmentDialogHeader
|
|
117
117
|
};
|
|
118
118
|
//#endregion
|
|
119
|
-
export { activityBubble, activityDots, approvalActions, assistantMessage, attachmentCard, attachmentDialog, attachmentDialogHeader, attachmentError, attachmentList, attachmentThumbnail, chatToolbar, chatToolbarExtras, closeBtn, composerActions, composerExtras, composerForm, composerIconButton, composerRow, composerSurface, container, data, ai_chat_module_default as default, emptyState, error, errorActions, fileAttachment, fileAttachmentDetails, footer, historyLimit, imageAttachmentButton, input, messageBubble, messageLabel, messageList, newChatButton, reasoning, reasoningSummary, reasoningText, removeAttachment, removeAttachmentSlot, scope, scopeHelp, scopeLabel, sendButton, sentAttachment,
|
|
119
|
+
export { activityBubble, activityDots, approvalActions, assistantMessage, attachmentCard, attachmentDialog, attachmentDialogHeader, attachmentError, attachmentList, attachmentThumbnail, chatToolbar, chatToolbarExtras, closeBtn, composerActions, composerExtras, composerForm, composerIconButton, composerRow, composerSurface, container, data, ai_chat_module_default as default, emptyState, error, errorActions, fileAttachment, fileAttachmentDetails, footer, historyLimit, imageAttachmentButton, input, messageBubble, messageLabel, messageList, newChatButton, reasoning, reasoningSummary, reasoningText, removeAttachment, removeAttachmentSlot, scope, scopeHelp, scopeLabel, sendButton, sentAttachment, sentImageAttachment, sources, sourcesLabel, stagedAttachment, stagedFileAttachment, structuredData, textPart, thread, toolPart, userMessage, viewport, visuallyHidden };
|
|
120
120
|
|
|
121
121
|
//# sourceMappingURL=index83.js.map
|
package/dist/index83.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index83.js","names":[],"sources":["../src/components/ai-chat/ai-chat.module.css"],"sourcesContent":[".container {\n display: flex;\n flex-direction: column;\n height: 100%;\n min-height: 0;\n max-height: none;\n overflow: hidden;\n position: relative;\n}\n\n.scope {\n display: flex;\n flex-direction: column;\n gap: 0.25rem;\n padding: 0.75rem 3rem 0.75rem 1rem;\n background: var(--uzi-surface-1, var(--muted));\n border-bottom: 1px solid var(--border);\n}\n\n.scopeLabel {\n font-size: 0.6875rem;\n font-weight: 650;\n letter-spacing: 0.04em;\n text-transform: uppercase;\n color: var(--muted-foreground);\n}\n\n.scope strong {\n font-size: 0.875rem;\n}\n\n.scopeHelp {\n margin: 0;\n font-size: 0.75rem;\n color: var(--muted-foreground);\n line-height: 1.5;\n}\n\n.closeBtn {\n position: absolute;\n top: 0.5rem;\n right: 0.5rem;\n z-index: 1;\n display: grid;\n place-items: center;\n width: 2rem;\n height: 2rem;\n border: 0;\n border-radius: 50%;\n background: transparent;\n color: var(--muted-foreground);\n cursor: pointer;\n font-size: 0.875rem;\n}\n\n.closeBtn:hover {\n background: var(--uzi-surface-2, var(--muted));\n color: var(--foreground);\n}\n\n.closeBtn:focus-visible,\n.sendButton:focus-visible,\n.errorActions button:focus-visible,\n.historyLimit button:focus-visible {\n outline: 2px solid var(--primary);\n outline-offset: 2px;\n}\n\n.thread {\n display: flex;\n flex: 1;\n flex-direction: column;\n min-height: 0;\n overflow: hidden;\n}\n\n.viewport {\n flex: 1;\n display: flex;\n flex-direction: column;\n min-height: 0;\n overflow-y: auto;\n overflow-x: hidden;\n gap: 0.75rem;\n}\n\n.chatToolbar {\n flex-shrink: 0;\n display: flex;\n align-items: center;\n justify-content: flex-end;\n gap: 0.75rem;\n min-height: 2.75rem;\n padding: 0.375rem 0.75rem;\n background: var(--uzi-surface-1, var(--background));\n border-bottom: 1px solid var(--border);\n}\n\n.chatToolbarExtras {\n display: flex;\n align-items: center;\n gap: 0.5rem;\n min-width: 0;\n margin-right: auto;\n}\n\n.chatToolbar button {\n margin-left: 0;\n flex-shrink: 0;\n border: 0;\n border-radius: 0.375rem;\n padding: 0.35rem 0.5rem;\n background: transparent;\n color: var(--muted-foreground);\n font: inherit;\n font-size: 0.75rem;\n cursor: pointer;\n}\n\n.chatToolbar .newChatButton {\n display: grid;\n place-items: center;\n width: 2rem;\n height: 2rem;\n padding: 0;\n}\n\n.chatToolbar button:hover {\n color: var(--foreground);\n background: var(--uzi-surface-2, var(--muted));\n}\n\n.chatToolbar button:focus-visible {\n outline: 2px solid var(--primary);\n outline-offset: 2px;\n}\n\n.messageList {\n display: flex;\n flex: 1 0 auto;\n flex-direction: column;\n gap: 0.75rem;\n padding: 1rem;\n}\n\n.userMessage,\n.assistantMessage {\n display: flex;\n flex-direction: column;\n gap: 0.5rem;\n padding: 0.75rem 1rem;\n border-radius: 0.75rem;\n color: var(--foreground);\n overflow-wrap: anywhere;\n}\n\n.userMessage {\n background: color-mix(in srgb, var(--primary) 10%, transparent);\n border: 1px solid color-mix(in srgb, var(--primary) 20%, transparent);\n}\n\n.assistantMessage {\n background: var(--muted);\n border: 1px solid var(--border);\n}\n\n.textPart {\n white-space: pre-wrap;\n line-height: 1.6;\n}\n\n.reasoning,\n.toolPart {\n border: 1px solid var(--border);\n border-radius: 0.5rem;\n padding: 0.5rem 0.75rem;\n background: var(--uzi-surface-1, transparent);\n}\n\n.reasoningSummary,\n.toolPart summary {\n cursor: pointer;\n font-size: 0.75rem;\n font-weight: 600;\n color: var(--muted-foreground);\n}\n\n.reasoningText {\n margin: 0.5rem 0 0;\n font-size: 0.8125rem;\n line-height: 1.6;\n color: var(--muted-foreground);\n white-space: pre-wrap;\n}\n\n.sources {\n padding-top: 0.5rem;\n border-top: 1px solid var(--border);\n}\n\n.sourcesLabel {\n display: block;\n font-size: 0.6875rem;\n font-weight: 650;\n color: var(--muted-foreground);\n margin-bottom: 0.25rem;\n}\n\n.sources ul {\n display: flex;\n flex-wrap: wrap;\n gap: 0.5rem;\n margin: 0;\n padding-left: 1.25rem;\n}\n\n.sources li {\n font-size: 0.75rem;\n overflow-wrap: anywhere;\n}\n\n.data {\n padding: 0.5rem;\n background: var(--uzi-surface-2, var(--muted));\n border-radius: 0.5rem;\n overflow-x: auto;\n}\n\n.structuredData {\n margin: 0;\n padding: 0.5rem 0;\n max-width: 100%;\n overflow-x: auto;\n white-space: pre-wrap;\n overflow-wrap: anywhere;\n font-size: 0.75rem;\n line-height: 1.5;\n}\n\n.footer {\n position: sticky;\n bottom: 0;\n z-index: 1;\n flex-shrink: 0;\n background: var(--background);\n border-top: 1px solid var(--border);\n}\n\n.composerForm {\n display: grid;\n grid-template-columns: minmax(0, 1fr) auto;\n align-items: end;\n gap: 0.75rem;\n padding: 0.75rem 1rem;\n}\n\n.input {\n width: 100%;\n min-height: 2.5rem;\n padding: 0.5rem 0.75rem;\n border: 1px solid var(--border);\n border-radius: 0.5rem;\n background: var(--background);\n color: var(--foreground);\n font: inherit;\n font-size: 0.875rem;\n line-height: 1.5;\n resize: vertical;\n}\n\n.input:focus {\n outline: none;\n border-color: var(--primary);\n box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 30%, transparent);\n}\n\n.input::placeholder {\n color: var(--muted-foreground);\n}\n\n.input:disabled,\n.sendButton:disabled {\n opacity: 0.5;\n cursor: not-allowed;\n}\n\n.sendButton {\n min-height: 2.5rem;\n padding: 0.5rem 0.875rem;\n border: 1px solid var(--border);\n border-radius: 0.5rem;\n background: var(--primary);\n color: var(--primary-foreground);\n font: inherit;\n font-size: 0.875rem;\n font-weight: 600;\n cursor: pointer;\n}\n\n.sendButton:not(:disabled):hover {\n filter: brightness(0.95);\n}\n\n.activityBubble {\n display: inline-flex;\n align-items: center;\n align-self: flex-start;\n gap: 0.625rem;\n width: fit-content;\n max-width: 100%;\n padding: 0.75rem 0.875rem;\n border: 1px solid var(--border);\n border-radius: 0.875rem;\n background: var(--muted);\n color: var(--muted-foreground);\n font-size: 0.8125rem;\n line-height: 1.4;\n animation: uzi-chat-activity-enter 180ms ease-out 120ms both;\n}\n\n.activityDots { display: flex; align-items: center; gap: 0.2rem; }\n.activityDots i {\n display: block;\n width: 0.35rem;\n height: 0.35rem;\n flex: 0 0 auto;\n border-radius: 50%;\n background: currentColor;\n animation: uzi-chat-dot-pulse 1.2s ease-in-out infinite;\n}\n.activityDots i:nth-child(2) { animation-delay: 150ms; }\n.activityDots i:nth-child(3) { animation-delay: 300ms; }\n\n@keyframes uzi-chat-activity-enter {\n from { opacity: 0; transform: translateY(3px); }\n to { opacity: 1; transform: translateY(0); }\n}\n@keyframes uzi-chat-dot-pulse {\n 0%, 60%, 100% { opacity: 0.35; transform: translateY(0); }\n 30% { opacity: 1; transform: translateY(-3px); }\n}\n\n@media (prefers-reduced-motion: reduce) {\n .activityBubble, .activityDots i { animation: none; }\n}\n\n.error {\n display: flex;\n flex-direction: column;\n gap: 0.5rem;\n padding: 0.75rem 1rem;\n border: 1px solid var(--destructive);\n border-radius: 0.5rem;\n margin: 0.75rem 1rem;\n background: color-mix(in srgb, var(--destructive) 10%, transparent);\n}\n\n.error p {\n margin: 0;\n color: var(--destructive);\n font-size: 0.8125rem;\n}\n\n.errorActions {\n display: flex;\n gap: 0.5rem;\n}\n\n.errorActions button,\n.historyLimit button {\n padding: 0.375rem 0.75rem;\n border: 1px solid var(--border);\n border-radius: 0.375rem;\n background: transparent;\n color: var(--foreground);\n font: inherit;\n font-size: 0.75rem;\n cursor: pointer;\n}\n\n.errorActions button:hover,\n.historyLimit button:hover {\n background: var(--uzi-surface-2, var(--muted));\n}\n\n.historyLimit {\n display: flex;\n flex-direction: column;\n gap: 0.5rem;\n align-items: center;\n padding: 0.75rem 1rem;\n margin: 0.75rem 1rem;\n background: var(--uzi-surface-1, var(--muted));\n border: 1px solid var(--border);\n border-radius: 0.5rem;\n}\n\n.historyLimit span {\n font-size: 0.75rem;\n color: var(--muted-foreground);\n}\n\n.emptyState {\n display: grid;\n place-items: center;\n flex: 1;\n min-height: 12rem;\n color: var(--muted-foreground);\n text-align: center;\n}\n\n.emptyState p {\n margin: 0;\n font-size: 0.875rem;\n}\n\n@media (max-width: 640px) {\n .composerForm {\n grid-template-columns: minmax(0, 1fr) auto;\n }\n\n .errorActions {\n flex-wrap: wrap;\n }\n}\n\n/* Optional integration controls use the same Uzi surface and layout tokens. */\n.composerExtras {\n grid-column: 1 / -1;\n min-width: 0;\n}\n\n.composerActions {\n display: flex;\n align-items: center;\n gap: 0.5rem;\n}\n\n.approvalActions { display: flex; align-items: center; flex-wrap: wrap; gap: 0.5rem; padding-top: 0.5rem; }\n.approvalActions button {\n background: var(--background); color: var(--foreground); border: 1px solid var(--border);\n border-radius: 0.375rem; padding: 0.3rem 0.55rem; cursor: pointer;\n}\n.approvalActions button:disabled { opacity: 0.5; cursor: not-allowed; }\n.attachmentError { color: var(--destructive); padding: 0.5rem 1rem; margin: 0; }\n.attachmentList {\n display: flex;\n flex-wrap: nowrap;\n gap: 0.625rem;\n max-width: 100%;\n padding: 0.125rem 0.125rem 0.5rem;\n margin: 0;\n overflow-x: auto;\n list-style: none;\n scrollbar-width: thin;\n}\n.attachmentList li { display: flex; flex: 0 0 auto; min-width: 0; }\n\n/* Role-aware message layout shared by the default renderer and consumer apps. */\n.messageBubble { width: fit-content; min-width: 0; max-width: 100%; }\n.messageBubble.userMessage { align-self: flex-end; max-width: min(90%, 42rem); }\n.messageBubble.assistantMessage { align-self: flex-start; max-width: 100%; }\n.messageLabel { font-size: 0.6875rem; font-weight: 650; color: var(--muted-foreground); }\n\n/* Shared compact composer: same visual grammar as Betty, without app-owned behavior. */\n.composerSurface {\n grid-column: 1 / -1;\n min-width: 0;\n border: 1px solid var(--border);\n border-radius: 0.875rem;\n background: var(--background);\n}\n.composerSurface:focus-within { outline: 2px solid var(--ring); outline-offset: 2px; }\n.composerRow { display: flex; align-items: end; min-width: 0; gap: 0.375rem; padding: 0.375rem; }\n.composerRow .input {\n display: block; flex: 1; width: 0; min-width: 0; min-height: 2.75rem;\n max-height: 11rem; padding: 0.625rem 0.25rem; border: 0;\n background: transparent; resize: none; font-size: 1rem;\n}\n.composerRow .input:focus { outline: none; box-shadow: none; }\n.composerIconButton, .composerRow .sendButton {\n display: grid; place-items: center; flex-shrink: 0;\n width: 2.75rem; height: 2.75rem; min-height: 2.75rem;\n padding: 0; border-radius: 0.625rem; cursor: pointer;\n}\n.composerIconButton {\n color: var(--foreground); border: 0; background: transparent;\n}\n.composerIconButton:hover:not(:disabled) { background: var(--muted); }\n.composerRow .sendButton { border: 0; background: var(--primary); color: var(--primary-foreground); }\n.composerIconButton:focus-visible, .composerRow .sendButton:focus-visible {\n outline: 2px solid var(--ring); outline-offset: 2px;\n}\n.composerIconButton:disabled { opacity: 0.5; cursor: not-allowed; }\n.visuallyHidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }\n\n/* Shared image tiles and file cards for both the composer and message history. */\n.attachmentCard {\n position: relative;\n display: flex;\n flex-direction: column;\n min-width: 0;\n max-width: 100%;\n overflow: hidden;\n border: 1px solid var(--border);\n border-radius: 0.75rem;\n background: var(--uzi-surface-1, var(--muted));\n}\n.stagedAttachment {\n width: 5.75rem;\n height: 5.75rem;\n}\n.stagedFileAttachment { width: min(15rem, 75vw); }\n.sentAttachment {\n width: fit-content;\n max-width: min(16rem, 100%);\n}\n.imageAttachmentButton {\n display: block;\n width: 100%;\n min-width: 0;\n padding: 0;\n border: 0;\n background: transparent;\n cursor: zoom-in;\n}\n.stagedAttachment .imageAttachmentButton { height: 100%; }\n.attachmentThumbnail {\n display: block;\n max-width: 100%;\n object-fit: contain;\n}\n.stagedAttachment .attachmentThumbnail { width: 100%; height: 100%; object-fit: cover; }\n.sentAttachment .attachmentThumbnail {\n width: auto;\n min-width: 6rem;\n max-height: 14rem;\n}\n.sentAttachmentName {\n display: block;\n max-width: 100%;\n padding: 0.375rem 0.5rem;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n color: var(--muted-foreground);\n font-size: 0.6875rem;\n}\n.fileAttachment {\n display: flex;\n align-items: center;\n gap: 0.625rem;\n min-width: 0;\n min-height: 4rem;\n padding: 0.625rem;\n color: var(--foreground);\n}\n.stagedFileAttachment .fileAttachment { height: 100%; box-sizing: border-box; padding-right: 1.875rem; }\n.fileAttachment svg { flex: 0 0 auto; color: var(--muted-foreground); }\n.fileAttachmentDetails {\n display: flex;\n flex-direction: column;\n gap: 0.125rem;\n min-width: 0;\n font-size: 0.75rem;\n}\n.fileAttachmentDetails a,\n.fileAttachmentDetails > span {\n display: block;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n color: var(--foreground);\n text-decoration: none;\n}\n.fileAttachmentDetails a:hover { text-decoration: underline; }\n.fileAttachmentDetails small { color: var(--muted-foreground); font-size: 0.6875rem; }\n.removeAttachment {\n position: absolute;\n top: 0.25rem;\n right: 0.25rem;\n display: grid;\n place-items: center;\n width: 1.5rem;\n height: 1.5rem;\n padding: 0;\n border: 1px solid var(--border);\n border-radius: 50%;\n background: var(--background);\n color: var(--foreground);\n font: inherit;\n font-size: 1.125rem;\n line-height: 1;\n cursor: pointer;\n box-shadow: 0 1px 4px rgb(0 0 0 / 20%);\n}\n.removeAttachment:hover { background: var(--muted); }\n.removeAttachmentSlot {\n position: absolute;\n top: 0.25rem;\n right: 0.25rem;\n display: grid;\n place-items: center;\n}\n.removeAttachmentSlot button {\n display: grid;\n place-items: center;\n width: 1.5rem;\n min-width: 1.5rem;\n height: 1.5rem;\n min-height: 1.5rem;\n padding: 0;\n border: 1px solid var(--border);\n border-radius: 50%;\n background: var(--background);\n color: var(--foreground);\n font-size: 1.125rem;\n line-height: 1;\n box-shadow: 0 1px 4px rgb(0 0 0 / 20%);\n}\n.imageAttachmentButton:focus-visible, .removeAttachment:focus-visible,\n.fileAttachmentDetails a:focus-visible, .attachmentDialog button:focus-visible {\n outline: 2px solid var(--ring);\n outline-offset: 2px;\n}\n.attachmentDialog {\n max-width: min(95vw, 60rem);\n max-height: 90dvh;\n padding: 0.75rem;\n border: 1px solid var(--border);\n border-radius: 0.875rem;\n background: var(--background);\n color: var(--foreground);\n box-shadow: 0 16px 60px rgb(0 0 0 / 35%);\n}\n.attachmentDialog::backdrop { background: rgb(0 0 0 / 80%); }\n.attachmentDialogHeader {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 1rem;\n padding-bottom: 0.5rem;\n font-size: 0.8125rem;\n}\n.attachmentDialogHeader span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }\n.attachmentDialogHeader button {\n flex-shrink: 0;\n width: 2rem;\n height: 2rem;\n border: 0;\n border-radius: 50%;\n background: var(--muted);\n color: var(--foreground);\n font: inherit;\n font-size: 1.25rem;\n cursor: pointer;\n}\n.attachmentDialog > img {\n display: block;\n width: auto;\n height: auto;\n max-width: 100%;\n max-height: calc(90dvh - 5rem);\n margin: auto;\n object-fit: contain;\n}\n"],"mappings":""}
|
|
1
|
+
{"version":3,"file":"index83.js","names":[],"sources":["../src/components/ai-chat/ai-chat.module.css"],"sourcesContent":[".container {\n display: flex;\n flex-direction: column;\n height: 100%;\n min-height: 0;\n max-height: none;\n overflow: hidden;\n position: relative;\n}\n\n.scope {\n display: flex;\n flex-direction: column;\n gap: 0.25rem;\n padding: 0.75rem 3rem 0.75rem 1rem;\n background: var(--uzi-surface-1, var(--muted));\n border-bottom: 1px solid var(--border);\n}\n\n.scopeLabel {\n font-size: 0.6875rem;\n font-weight: 650;\n letter-spacing: 0.04em;\n text-transform: uppercase;\n color: var(--muted-foreground);\n}\n\n.scope strong {\n font-size: 0.875rem;\n}\n\n.scopeHelp {\n margin: 0;\n font-size: 0.75rem;\n color: var(--muted-foreground);\n line-height: 1.5;\n}\n\n.closeBtn {\n position: absolute;\n top: 0.5rem;\n right: 0.5rem;\n z-index: 1;\n display: grid;\n place-items: center;\n width: 2rem;\n height: 2rem;\n border: 0;\n border-radius: 50%;\n background: transparent;\n color: var(--muted-foreground);\n cursor: pointer;\n font-size: 0.875rem;\n}\n\n.closeBtn:hover {\n background: var(--uzi-surface-2, var(--muted));\n color: var(--foreground);\n}\n\n.closeBtn:focus-visible,\n.sendButton:focus-visible,\n.errorActions button:focus-visible,\n.historyLimit button:focus-visible {\n outline: 2px solid var(--primary);\n outline-offset: 2px;\n}\n\n.thread {\n display: flex;\n flex: 1;\n flex-direction: column;\n min-height: 0;\n overflow: hidden;\n}\n\n.viewport {\n flex: 1;\n display: flex;\n flex-direction: column;\n min-height: 0;\n overflow-y: auto;\n overflow-x: hidden;\n gap: 0.75rem;\n}\n\n.chatToolbar {\n flex-shrink: 0;\n display: flex;\n align-items: center;\n justify-content: flex-end;\n gap: 0.75rem;\n min-height: 2.75rem;\n padding: 0.375rem 0.75rem;\n background: var(--uzi-surface-1, var(--background));\n border-bottom: 1px solid var(--border);\n}\n\n.chatToolbarExtras {\n display: flex;\n align-items: center;\n gap: 0.5rem;\n min-width: 0;\n margin-right: auto;\n}\n\n.chatToolbar button {\n margin-left: 0;\n flex-shrink: 0;\n border: 0;\n border-radius: 0.375rem;\n padding: 0.35rem 0.5rem;\n background: transparent;\n color: var(--muted-foreground);\n font: inherit;\n font-size: 0.75rem;\n cursor: pointer;\n}\n\n.chatToolbar .newChatButton {\n display: grid;\n place-items: center;\n width: 2rem;\n height: 2rem;\n padding: 0;\n}\n\n.chatToolbar button:hover {\n color: var(--foreground);\n background: var(--uzi-surface-2, var(--muted));\n}\n\n.chatToolbar button:focus-visible {\n outline: 2px solid var(--primary);\n outline-offset: 2px;\n}\n\n.messageList {\n display: flex;\n flex: 1 0 auto;\n flex-direction: column;\n gap: 0.75rem;\n padding: 1rem;\n}\n\n.userMessage,\n.assistantMessage {\n display: flex;\n flex-direction: column;\n gap: 0.5rem;\n padding: 0.75rem 1rem;\n border-radius: 0.75rem;\n color: var(--foreground);\n overflow-wrap: anywhere;\n}\n\n.userMessage {\n background: color-mix(in srgb, var(--primary) 10%, transparent);\n border: 1px solid color-mix(in srgb, var(--primary) 20%, transparent);\n}\n\n.assistantMessage {\n background: var(--muted);\n border: 1px solid var(--border);\n}\n\n.textPart {\n white-space: pre-wrap;\n line-height: 1.6;\n}\n\n.reasoning,\n.toolPart {\n border: 1px solid var(--border);\n border-radius: 0.5rem;\n padding: 0.5rem 0.75rem;\n background: var(--uzi-surface-1, transparent);\n}\n\n.reasoningSummary,\n.toolPart summary {\n cursor: pointer;\n font-size: 0.75rem;\n font-weight: 600;\n color: var(--muted-foreground);\n}\n\n.reasoningText {\n margin: 0.5rem 0 0;\n font-size: 0.8125rem;\n line-height: 1.6;\n color: var(--muted-foreground);\n white-space: pre-wrap;\n}\n\n.sources {\n padding-top: 0.5rem;\n border-top: 1px solid var(--border);\n}\n\n.sourcesLabel {\n display: block;\n font-size: 0.6875rem;\n font-weight: 650;\n color: var(--muted-foreground);\n margin-bottom: 0.25rem;\n}\n\n.sources ul {\n display: flex;\n flex-wrap: wrap;\n gap: 0.5rem;\n margin: 0;\n padding-left: 1.25rem;\n}\n\n.sources li {\n font-size: 0.75rem;\n overflow-wrap: anywhere;\n}\n\n.data {\n padding: 0.5rem;\n background: var(--uzi-surface-2, var(--muted));\n border-radius: 0.5rem;\n overflow-x: auto;\n}\n\n.structuredData {\n margin: 0;\n padding: 0.5rem 0;\n max-width: 100%;\n overflow-x: auto;\n white-space: pre-wrap;\n overflow-wrap: anywhere;\n font-size: 0.75rem;\n line-height: 1.5;\n}\n\n.footer {\n position: sticky;\n bottom: 0;\n z-index: 1;\n flex-shrink: 0;\n background: var(--background);\n border-top: 1px solid var(--border);\n}\n\n.composerForm {\n display: grid;\n grid-template-columns: minmax(0, 1fr) auto;\n align-items: end;\n gap: 0.75rem;\n padding: 0.75rem 1rem;\n}\n\n.input {\n width: 100%;\n min-height: 2.5rem;\n padding: 0.5rem 0.75rem;\n border: 1px solid var(--border);\n border-radius: 0.5rem;\n background: var(--background);\n color: var(--foreground);\n font: inherit;\n font-size: 0.875rem;\n line-height: 1.5;\n resize: vertical;\n}\n\n.input:focus {\n outline: none;\n border-color: var(--primary);\n box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 30%, transparent);\n}\n\n.input::placeholder {\n color: var(--muted-foreground);\n}\n\n.input:disabled,\n.sendButton:disabled {\n opacity: 0.5;\n cursor: not-allowed;\n}\n\n.sendButton {\n min-height: 2.5rem;\n padding: 0.5rem 0.875rem;\n border: 1px solid var(--border);\n border-radius: 0.5rem;\n background: var(--primary);\n color: var(--primary-foreground);\n font: inherit;\n font-size: 0.875rem;\n font-weight: 600;\n cursor: pointer;\n}\n\n.sendButton:not(:disabled):hover {\n filter: brightness(0.95);\n}\n\n.activityBubble {\n display: inline-flex;\n align-items: center;\n align-self: flex-start;\n gap: 0.625rem;\n width: fit-content;\n max-width: 100%;\n padding: 0.375rem 0.5rem;\n color: var(--muted-foreground);\n font-size: 0.8125rem;\n line-height: 1.4;\n animation: uzi-chat-activity-enter 180ms ease-out 120ms both;\n}\n\n.activityDots { display: flex; align-items: center; gap: 0.2rem; }\n.activityDots i {\n display: block;\n width: 0.35rem;\n height: 0.35rem;\n flex: 0 0 auto;\n border-radius: 50%;\n background: currentColor;\n animation: uzi-chat-dot-pulse 1.2s ease-in-out infinite;\n}\n.activityDots i:nth-child(2) { animation-delay: 150ms; }\n.activityDots i:nth-child(3) { animation-delay: 300ms; }\n\n@keyframes uzi-chat-activity-enter {\n from { opacity: 0; transform: translateY(3px); }\n to { opacity: 1; transform: translateY(0); }\n}\n@keyframes uzi-chat-dot-pulse {\n 0%, 60%, 100% { opacity: 0.35; transform: translateY(0); }\n 30% { opacity: 1; transform: translateY(-3px); }\n}\n\n@media (prefers-reduced-motion: reduce) {\n .activityBubble, .activityDots i { animation: none; }\n}\n\n.error {\n display: flex;\n flex-direction: column;\n gap: 0.5rem;\n padding: 0.75rem 1rem;\n border: 1px solid var(--destructive);\n border-radius: 0.5rem;\n align-self: flex-start;\n max-width: min(100%, 42rem);\n margin: 0;\n background: color-mix(in srgb, var(--destructive) 10%, transparent);\n}\n\n.error p {\n margin: 0;\n color: var(--destructive);\n font-size: 0.8125rem;\n}\n\n.errorActions {\n display: flex;\n gap: 0.5rem;\n}\n\n.errorActions button,\n.historyLimit button {\n padding: 0.375rem 0.75rem;\n border: 1px solid var(--border);\n border-radius: 0.375rem;\n background: transparent;\n color: var(--foreground);\n font: inherit;\n font-size: 0.75rem;\n cursor: pointer;\n}\n\n.errorActions button:hover,\n.historyLimit button:hover {\n background: var(--uzi-surface-2, var(--muted));\n}\n\n.historyLimit {\n display: flex;\n flex-direction: column;\n gap: 0.5rem;\n align-items: center;\n padding: 0.75rem 1rem;\n margin: 0.75rem 1rem;\n background: var(--uzi-surface-1, var(--muted));\n border: 1px solid var(--border);\n border-radius: 0.5rem;\n}\n\n.historyLimit span {\n font-size: 0.75rem;\n color: var(--muted-foreground);\n}\n\n.emptyState {\n display: grid;\n place-items: center;\n flex: 1;\n min-height: 12rem;\n color: var(--muted-foreground);\n text-align: center;\n}\n\n.emptyState p {\n margin: 0;\n font-size: 0.875rem;\n}\n\n@media (max-width: 640px) {\n .composerForm {\n grid-template-columns: minmax(0, 1fr) auto;\n }\n\n .errorActions {\n flex-wrap: wrap;\n }\n}\n\n/* Optional integration controls use the same Uzi surface and layout tokens. */\n.composerExtras {\n grid-column: 1 / -1;\n min-width: 0;\n}\n\n.composerActions {\n display: flex;\n align-items: center;\n gap: 0.5rem;\n}\n\n.approvalActions { display: flex; align-items: center; flex-wrap: wrap; gap: 0.5rem; padding-top: 0.5rem; }\n.approvalActions button {\n background: var(--background); color: var(--foreground); border: 1px solid var(--border);\n border-radius: 0.375rem; padding: 0.3rem 0.55rem; cursor: pointer;\n}\n.approvalActions button:disabled { opacity: 0.5; cursor: not-allowed; }\n.attachmentError { color: var(--destructive); padding: 0.5rem 1rem; margin: 0; }\n.attachmentList {\n display: flex;\n flex-wrap: nowrap;\n gap: 0.625rem;\n max-width: 100%;\n padding: 0.125rem 0.125rem 0.5rem;\n margin: 0;\n overflow-x: auto;\n list-style: none;\n scrollbar-width: thin;\n}\n.attachmentList li { display: flex; flex: 0 0 auto; min-width: 0; }\n\n/* Role-aware message layout shared by the default renderer and consumer apps. */\n.messageBubble { width: fit-content; min-width: 0; max-width: 100%; }\n.messageBubble.userMessage { align-self: flex-end; max-width: min(90%, 42rem); }\n.messageBubble.assistantMessage { align-self: flex-start; max-width: 100%; }\n.messageLabel { font-size: 0.6875rem; font-weight: 650; color: var(--muted-foreground); }\n\n/* Shared compact composer: same visual grammar as Betty, without app-owned behavior. */\n.composerSurface {\n grid-column: 1 / -1;\n min-width: 0;\n border: 1px solid var(--border);\n border-radius: 0.875rem;\n background: var(--background);\n}\n.composerSurface:focus-within { outline: 2px solid var(--ring); outline-offset: 2px; }\n.composerRow { display: flex; align-items: end; min-width: 0; gap: 0.375rem; padding: 0.375rem; }\n.composerRow .input {\n display: block; flex: 1; width: 0; min-width: 0; min-height: 2.75rem;\n max-height: 11rem; padding: 0.625rem 0.25rem; border: 0;\n background: transparent; resize: none; font-size: 1rem;\n}\n.composerRow .input:focus { outline: none; box-shadow: none; }\n.composerIconButton, .composerRow .sendButton {\n display: grid; place-items: center; flex-shrink: 0;\n width: 2.75rem; height: 2.75rem; min-height: 2.75rem;\n padding: 0; border-radius: 0.625rem; cursor: pointer;\n}\n.composerIconButton {\n color: var(--foreground); border: 0; background: transparent;\n}\n.composerIconButton:hover:not(:disabled) { background: var(--muted); }\n.composerRow .sendButton { border: 0; background: var(--primary); color: var(--primary-foreground); }\n.composerIconButton:focus-visible, .composerRow .sendButton:focus-visible {\n outline: 2px solid var(--ring); outline-offset: 2px;\n}\n.composerIconButton:disabled { opacity: 0.5; cursor: not-allowed; }\n.visuallyHidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }\n\n/* Shared image tiles and file cards for both the composer and message history. */\n.attachmentCard {\n position: relative;\n display: flex;\n flex-direction: column;\n min-width: 0;\n max-width: 100%;\n overflow: hidden;\n border: 1px solid var(--border);\n border-radius: 0.75rem;\n background: var(--uzi-surface-1, var(--muted));\n}\n.stagedAttachment {\n width: 5.75rem;\n height: 5.75rem;\n}\n.stagedFileAttachment { width: min(15rem, 75vw); }\n.sentAttachment {\n width: fit-content;\n max-width: min(20rem, 100%);\n}\n/* Sent images are part of the message, not nested file cards. */\n.sentImageAttachment {\n border: 0;\n background: transparent;\n}\n.imageAttachmentButton {\n display: block;\n width: 100%;\n min-width: 0;\n padding: 0;\n border: 0;\n background: transparent;\n cursor: zoom-in;\n}\n.stagedAttachment .imageAttachmentButton { height: 100%; }\n.attachmentThumbnail {\n display: block;\n max-width: 100%;\n object-fit: contain;\n}\n.stagedAttachment .attachmentThumbnail { width: 100%; height: 100%; object-fit: cover; }\n.sentAttachment .attachmentThumbnail {\n width: auto;\n height: auto;\n min-width: 8rem;\n max-width: 100%;\n max-height: min(26rem, 60dvh);\n}\n.fileAttachment {\n display: flex;\n align-items: center;\n gap: 0.625rem;\n min-width: 0;\n min-height: 4rem;\n padding: 0.625rem;\n color: var(--foreground);\n}\n.stagedFileAttachment .fileAttachment { height: 100%; box-sizing: border-box; padding-right: 1.875rem; }\n.fileAttachment svg { flex: 0 0 auto; color: var(--muted-foreground); }\n.fileAttachmentDetails {\n display: flex;\n flex-direction: column;\n gap: 0.125rem;\n min-width: 0;\n font-size: 0.75rem;\n}\n.fileAttachmentDetails a,\n.fileAttachmentDetails > span {\n display: block;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n color: var(--foreground);\n text-decoration: none;\n}\n.fileAttachmentDetails a:hover { text-decoration: underline; }\n.fileAttachmentDetails small { color: var(--muted-foreground); font-size: 0.6875rem; }\n.removeAttachment {\n position: absolute;\n top: 0.25rem;\n right: 0.25rem;\n display: grid;\n place-items: center;\n width: 1.5rem;\n height: 1.5rem;\n padding: 0;\n border: 1px solid var(--border);\n border-radius: 50%;\n background: var(--background);\n color: var(--foreground);\n font: inherit;\n font-size: 1.125rem;\n line-height: 1;\n cursor: pointer;\n box-shadow: 0 1px 4px rgb(0 0 0 / 20%);\n}\n.removeAttachment:hover { background: var(--muted); }\n.removeAttachmentSlot {\n position: absolute;\n top: 0.25rem;\n right: 0.25rem;\n display: grid;\n place-items: center;\n}\n.removeAttachmentSlot button {\n display: grid;\n place-items: center;\n width: 1.5rem;\n min-width: 1.5rem;\n height: 1.5rem;\n min-height: 1.5rem;\n padding: 0;\n border: 1px solid var(--border);\n border-radius: 50%;\n background: var(--background);\n color: var(--foreground);\n font-size: 1.125rem;\n line-height: 1;\n box-shadow: 0 1px 4px rgb(0 0 0 / 20%);\n}\n.imageAttachmentButton:focus-visible, .removeAttachment:focus-visible,\n.fileAttachmentDetails a:focus-visible, .attachmentDialog button:focus-visible {\n outline: 2px solid var(--ring);\n outline-offset: 2px;\n}\n.attachmentDialog {\n max-width: min(95vw, 60rem);\n max-height: 90dvh;\n padding: 0.75rem;\n border: 1px solid var(--border);\n border-radius: 0.875rem;\n background: var(--background);\n color: var(--foreground);\n box-shadow: 0 16px 60px rgb(0 0 0 / 35%);\n}\n.attachmentDialog::backdrop { background: rgb(0 0 0 / 80%); }\n.attachmentDialogHeader {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 1rem;\n padding-bottom: 0.5rem;\n font-size: 0.8125rem;\n}\n.attachmentDialogHeader span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }\n.attachmentDialogHeader button {\n flex-shrink: 0;\n width: 2rem;\n height: 2rem;\n border: 0;\n border-radius: 50%;\n background: var(--muted);\n color: var(--foreground);\n font: inherit;\n font-size: 1.25rem;\n cursor: pointer;\n}\n.attachmentDialog > img {\n display: block;\n width: auto;\n height: auto;\n max-width: 100%;\n max-height: calc(90dvh - 5rem);\n margin: auto;\n object-fit: contain;\n}\n"],"mappings":""}
|
package/dist/index84.cjs
CHANGED
|
@@ -46,9 +46,9 @@ var attachmentCard = "uzi-ai-chat-module__attachmentCard__JdvKJ";
|
|
|
46
46
|
var stagedAttachment = "uzi-ai-chat-module__stagedAttachment__5axXj";
|
|
47
47
|
var stagedFileAttachment = "uzi-ai-chat-module__stagedFileAttachment__hZfVm";
|
|
48
48
|
var sentAttachment = "uzi-ai-chat-module__sentAttachment__PP-fs";
|
|
49
|
+
var sentImageAttachment = "uzi-ai-chat-module__sentImageAttachment__M9wpx";
|
|
49
50
|
var imageAttachmentButton = "uzi-ai-chat-module__imageAttachmentButton__PM2cf";
|
|
50
51
|
var attachmentThumbnail = "uzi-ai-chat-module__attachmentThumbnail__OzmIc";
|
|
51
|
-
var sentAttachmentName = "uzi-ai-chat-module__sentAttachmentName__rGevY";
|
|
52
52
|
var fileAttachment = "uzi-ai-chat-module__fileAttachment__lVB09";
|
|
53
53
|
var fileAttachmentDetails = "uzi-ai-chat-module__fileAttachmentDetails__NVfrg";
|
|
54
54
|
var removeAttachment = "uzi-ai-chat-module__removeAttachment__ck6iq";
|
|
@@ -105,9 +105,9 @@ var ai_chat_module_default = {
|
|
|
105
105
|
stagedAttachment,
|
|
106
106
|
stagedFileAttachment,
|
|
107
107
|
sentAttachment,
|
|
108
|
+
sentImageAttachment,
|
|
108
109
|
imageAttachmentButton,
|
|
109
110
|
attachmentThumbnail,
|
|
110
|
-
sentAttachmentName,
|
|
111
111
|
fileAttachment,
|
|
112
112
|
fileAttachmentDetails,
|
|
113
113
|
removeAttachment,
|
|
@@ -161,7 +161,7 @@ exports.scopeHelp = scopeHelp;
|
|
|
161
161
|
exports.scopeLabel = scopeLabel;
|
|
162
162
|
exports.sendButton = sendButton;
|
|
163
163
|
exports.sentAttachment = sentAttachment;
|
|
164
|
-
exports.
|
|
164
|
+
exports.sentImageAttachment = sentImageAttachment;
|
|
165
165
|
exports.sources = sources;
|
|
166
166
|
exports.sourcesLabel = sourcesLabel;
|
|
167
167
|
exports.stagedAttachment = stagedAttachment;
|
package/dist/index84.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index84.cjs","names":[],"sources":["../src/components/ai-chat/ai-chat.module.css"],"sourcesContent":[".container {\n display: flex;\n flex-direction: column;\n height: 100%;\n min-height: 0;\n max-height: none;\n overflow: hidden;\n position: relative;\n}\n\n.scope {\n display: flex;\n flex-direction: column;\n gap: 0.25rem;\n padding: 0.75rem 3rem 0.75rem 1rem;\n background: var(--uzi-surface-1, var(--muted));\n border-bottom: 1px solid var(--border);\n}\n\n.scopeLabel {\n font-size: 0.6875rem;\n font-weight: 650;\n letter-spacing: 0.04em;\n text-transform: uppercase;\n color: var(--muted-foreground);\n}\n\n.scope strong {\n font-size: 0.875rem;\n}\n\n.scopeHelp {\n margin: 0;\n font-size: 0.75rem;\n color: var(--muted-foreground);\n line-height: 1.5;\n}\n\n.closeBtn {\n position: absolute;\n top: 0.5rem;\n right: 0.5rem;\n z-index: 1;\n display: grid;\n place-items: center;\n width: 2rem;\n height: 2rem;\n border: 0;\n border-radius: 50%;\n background: transparent;\n color: var(--muted-foreground);\n cursor: pointer;\n font-size: 0.875rem;\n}\n\n.closeBtn:hover {\n background: var(--uzi-surface-2, var(--muted));\n color: var(--foreground);\n}\n\n.closeBtn:focus-visible,\n.sendButton:focus-visible,\n.errorActions button:focus-visible,\n.historyLimit button:focus-visible {\n outline: 2px solid var(--primary);\n outline-offset: 2px;\n}\n\n.thread {\n display: flex;\n flex: 1;\n flex-direction: column;\n min-height: 0;\n overflow: hidden;\n}\n\n.viewport {\n flex: 1;\n display: flex;\n flex-direction: column;\n min-height: 0;\n overflow-y: auto;\n overflow-x: hidden;\n gap: 0.75rem;\n}\n\n.chatToolbar {\n flex-shrink: 0;\n display: flex;\n align-items: center;\n justify-content: flex-end;\n gap: 0.75rem;\n min-height: 2.75rem;\n padding: 0.375rem 0.75rem;\n background: var(--uzi-surface-1, var(--background));\n border-bottom: 1px solid var(--border);\n}\n\n.chatToolbarExtras {\n display: flex;\n align-items: center;\n gap: 0.5rem;\n min-width: 0;\n margin-right: auto;\n}\n\n.chatToolbar button {\n margin-left: 0;\n flex-shrink: 0;\n border: 0;\n border-radius: 0.375rem;\n padding: 0.35rem 0.5rem;\n background: transparent;\n color: var(--muted-foreground);\n font: inherit;\n font-size: 0.75rem;\n cursor: pointer;\n}\n\n.chatToolbar .newChatButton {\n display: grid;\n place-items: center;\n width: 2rem;\n height: 2rem;\n padding: 0;\n}\n\n.chatToolbar button:hover {\n color: var(--foreground);\n background: var(--uzi-surface-2, var(--muted));\n}\n\n.chatToolbar button:focus-visible {\n outline: 2px solid var(--primary);\n outline-offset: 2px;\n}\n\n.messageList {\n display: flex;\n flex: 1 0 auto;\n flex-direction: column;\n gap: 0.75rem;\n padding: 1rem;\n}\n\n.userMessage,\n.assistantMessage {\n display: flex;\n flex-direction: column;\n gap: 0.5rem;\n padding: 0.75rem 1rem;\n border-radius: 0.75rem;\n color: var(--foreground);\n overflow-wrap: anywhere;\n}\n\n.userMessage {\n background: color-mix(in srgb, var(--primary) 10%, transparent);\n border: 1px solid color-mix(in srgb, var(--primary) 20%, transparent);\n}\n\n.assistantMessage {\n background: var(--muted);\n border: 1px solid var(--border);\n}\n\n.textPart {\n white-space: pre-wrap;\n line-height: 1.6;\n}\n\n.reasoning,\n.toolPart {\n border: 1px solid var(--border);\n border-radius: 0.5rem;\n padding: 0.5rem 0.75rem;\n background: var(--uzi-surface-1, transparent);\n}\n\n.reasoningSummary,\n.toolPart summary {\n cursor: pointer;\n font-size: 0.75rem;\n font-weight: 600;\n color: var(--muted-foreground);\n}\n\n.reasoningText {\n margin: 0.5rem 0 0;\n font-size: 0.8125rem;\n line-height: 1.6;\n color: var(--muted-foreground);\n white-space: pre-wrap;\n}\n\n.sources {\n padding-top: 0.5rem;\n border-top: 1px solid var(--border);\n}\n\n.sourcesLabel {\n display: block;\n font-size: 0.6875rem;\n font-weight: 650;\n color: var(--muted-foreground);\n margin-bottom: 0.25rem;\n}\n\n.sources ul {\n display: flex;\n flex-wrap: wrap;\n gap: 0.5rem;\n margin: 0;\n padding-left: 1.25rem;\n}\n\n.sources li {\n font-size: 0.75rem;\n overflow-wrap: anywhere;\n}\n\n.data {\n padding: 0.5rem;\n background: var(--uzi-surface-2, var(--muted));\n border-radius: 0.5rem;\n overflow-x: auto;\n}\n\n.structuredData {\n margin: 0;\n padding: 0.5rem 0;\n max-width: 100%;\n overflow-x: auto;\n white-space: pre-wrap;\n overflow-wrap: anywhere;\n font-size: 0.75rem;\n line-height: 1.5;\n}\n\n.footer {\n position: sticky;\n bottom: 0;\n z-index: 1;\n flex-shrink: 0;\n background: var(--background);\n border-top: 1px solid var(--border);\n}\n\n.composerForm {\n display: grid;\n grid-template-columns: minmax(0, 1fr) auto;\n align-items: end;\n gap: 0.75rem;\n padding: 0.75rem 1rem;\n}\n\n.input {\n width: 100%;\n min-height: 2.5rem;\n padding: 0.5rem 0.75rem;\n border: 1px solid var(--border);\n border-radius: 0.5rem;\n background: var(--background);\n color: var(--foreground);\n font: inherit;\n font-size: 0.875rem;\n line-height: 1.5;\n resize: vertical;\n}\n\n.input:focus {\n outline: none;\n border-color: var(--primary);\n box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 30%, transparent);\n}\n\n.input::placeholder {\n color: var(--muted-foreground);\n}\n\n.input:disabled,\n.sendButton:disabled {\n opacity: 0.5;\n cursor: not-allowed;\n}\n\n.sendButton {\n min-height: 2.5rem;\n padding: 0.5rem 0.875rem;\n border: 1px solid var(--border);\n border-radius: 0.5rem;\n background: var(--primary);\n color: var(--primary-foreground);\n font: inherit;\n font-size: 0.875rem;\n font-weight: 600;\n cursor: pointer;\n}\n\n.sendButton:not(:disabled):hover {\n filter: brightness(0.95);\n}\n\n.activityBubble {\n display: inline-flex;\n align-items: center;\n align-self: flex-start;\n gap: 0.625rem;\n width: fit-content;\n max-width: 100%;\n padding: 0.75rem 0.875rem;\n border: 1px solid var(--border);\n border-radius: 0.875rem;\n background: var(--muted);\n color: var(--muted-foreground);\n font-size: 0.8125rem;\n line-height: 1.4;\n animation: uzi-chat-activity-enter 180ms ease-out 120ms both;\n}\n\n.activityDots { display: flex; align-items: center; gap: 0.2rem; }\n.activityDots i {\n display: block;\n width: 0.35rem;\n height: 0.35rem;\n flex: 0 0 auto;\n border-radius: 50%;\n background: currentColor;\n animation: uzi-chat-dot-pulse 1.2s ease-in-out infinite;\n}\n.activityDots i:nth-child(2) { animation-delay: 150ms; }\n.activityDots i:nth-child(3) { animation-delay: 300ms; }\n\n@keyframes uzi-chat-activity-enter {\n from { opacity: 0; transform: translateY(3px); }\n to { opacity: 1; transform: translateY(0); }\n}\n@keyframes uzi-chat-dot-pulse {\n 0%, 60%, 100% { opacity: 0.35; transform: translateY(0); }\n 30% { opacity: 1; transform: translateY(-3px); }\n}\n\n@media (prefers-reduced-motion: reduce) {\n .activityBubble, .activityDots i { animation: none; }\n}\n\n.error {\n display: flex;\n flex-direction: column;\n gap: 0.5rem;\n padding: 0.75rem 1rem;\n border: 1px solid var(--destructive);\n border-radius: 0.5rem;\n margin: 0.75rem 1rem;\n background: color-mix(in srgb, var(--destructive) 10%, transparent);\n}\n\n.error p {\n margin: 0;\n color: var(--destructive);\n font-size: 0.8125rem;\n}\n\n.errorActions {\n display: flex;\n gap: 0.5rem;\n}\n\n.errorActions button,\n.historyLimit button {\n padding: 0.375rem 0.75rem;\n border: 1px solid var(--border);\n border-radius: 0.375rem;\n background: transparent;\n color: var(--foreground);\n font: inherit;\n font-size: 0.75rem;\n cursor: pointer;\n}\n\n.errorActions button:hover,\n.historyLimit button:hover {\n background: var(--uzi-surface-2, var(--muted));\n}\n\n.historyLimit {\n display: flex;\n flex-direction: column;\n gap: 0.5rem;\n align-items: center;\n padding: 0.75rem 1rem;\n margin: 0.75rem 1rem;\n background: var(--uzi-surface-1, var(--muted));\n border: 1px solid var(--border);\n border-radius: 0.5rem;\n}\n\n.historyLimit span {\n font-size: 0.75rem;\n color: var(--muted-foreground);\n}\n\n.emptyState {\n display: grid;\n place-items: center;\n flex: 1;\n min-height: 12rem;\n color: var(--muted-foreground);\n text-align: center;\n}\n\n.emptyState p {\n margin: 0;\n font-size: 0.875rem;\n}\n\n@media (max-width: 640px) {\n .composerForm {\n grid-template-columns: minmax(0, 1fr) auto;\n }\n\n .errorActions {\n flex-wrap: wrap;\n }\n}\n\n/* Optional integration controls use the same Uzi surface and layout tokens. */\n.composerExtras {\n grid-column: 1 / -1;\n min-width: 0;\n}\n\n.composerActions {\n display: flex;\n align-items: center;\n gap: 0.5rem;\n}\n\n.approvalActions { display: flex; align-items: center; flex-wrap: wrap; gap: 0.5rem; padding-top: 0.5rem; }\n.approvalActions button {\n background: var(--background); color: var(--foreground); border: 1px solid var(--border);\n border-radius: 0.375rem; padding: 0.3rem 0.55rem; cursor: pointer;\n}\n.approvalActions button:disabled { opacity: 0.5; cursor: not-allowed; }\n.attachmentError { color: var(--destructive); padding: 0.5rem 1rem; margin: 0; }\n.attachmentList {\n display: flex;\n flex-wrap: nowrap;\n gap: 0.625rem;\n max-width: 100%;\n padding: 0.125rem 0.125rem 0.5rem;\n margin: 0;\n overflow-x: auto;\n list-style: none;\n scrollbar-width: thin;\n}\n.attachmentList li { display: flex; flex: 0 0 auto; min-width: 0; }\n\n/* Role-aware message layout shared by the default renderer and consumer apps. */\n.messageBubble { width: fit-content; min-width: 0; max-width: 100%; }\n.messageBubble.userMessage { align-self: flex-end; max-width: min(90%, 42rem); }\n.messageBubble.assistantMessage { align-self: flex-start; max-width: 100%; }\n.messageLabel { font-size: 0.6875rem; font-weight: 650; color: var(--muted-foreground); }\n\n/* Shared compact composer: same visual grammar as Betty, without app-owned behavior. */\n.composerSurface {\n grid-column: 1 / -1;\n min-width: 0;\n border: 1px solid var(--border);\n border-radius: 0.875rem;\n background: var(--background);\n}\n.composerSurface:focus-within { outline: 2px solid var(--ring); outline-offset: 2px; }\n.composerRow { display: flex; align-items: end; min-width: 0; gap: 0.375rem; padding: 0.375rem; }\n.composerRow .input {\n display: block; flex: 1; width: 0; min-width: 0; min-height: 2.75rem;\n max-height: 11rem; padding: 0.625rem 0.25rem; border: 0;\n background: transparent; resize: none; font-size: 1rem;\n}\n.composerRow .input:focus { outline: none; box-shadow: none; }\n.composerIconButton, .composerRow .sendButton {\n display: grid; place-items: center; flex-shrink: 0;\n width: 2.75rem; height: 2.75rem; min-height: 2.75rem;\n padding: 0; border-radius: 0.625rem; cursor: pointer;\n}\n.composerIconButton {\n color: var(--foreground); border: 0; background: transparent;\n}\n.composerIconButton:hover:not(:disabled) { background: var(--muted); }\n.composerRow .sendButton { border: 0; background: var(--primary); color: var(--primary-foreground); }\n.composerIconButton:focus-visible, .composerRow .sendButton:focus-visible {\n outline: 2px solid var(--ring); outline-offset: 2px;\n}\n.composerIconButton:disabled { opacity: 0.5; cursor: not-allowed; }\n.visuallyHidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }\n\n/* Shared image tiles and file cards for both the composer and message history. */\n.attachmentCard {\n position: relative;\n display: flex;\n flex-direction: column;\n min-width: 0;\n max-width: 100%;\n overflow: hidden;\n border: 1px solid var(--border);\n border-radius: 0.75rem;\n background: var(--uzi-surface-1, var(--muted));\n}\n.stagedAttachment {\n width: 5.75rem;\n height: 5.75rem;\n}\n.stagedFileAttachment { width: min(15rem, 75vw); }\n.sentAttachment {\n width: fit-content;\n max-width: min(16rem, 100%);\n}\n.imageAttachmentButton {\n display: block;\n width: 100%;\n min-width: 0;\n padding: 0;\n border: 0;\n background: transparent;\n cursor: zoom-in;\n}\n.stagedAttachment .imageAttachmentButton { height: 100%; }\n.attachmentThumbnail {\n display: block;\n max-width: 100%;\n object-fit: contain;\n}\n.stagedAttachment .attachmentThumbnail { width: 100%; height: 100%; object-fit: cover; }\n.sentAttachment .attachmentThumbnail {\n width: auto;\n min-width: 6rem;\n max-height: 14rem;\n}\n.sentAttachmentName {\n display: block;\n max-width: 100%;\n padding: 0.375rem 0.5rem;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n color: var(--muted-foreground);\n font-size: 0.6875rem;\n}\n.fileAttachment {\n display: flex;\n align-items: center;\n gap: 0.625rem;\n min-width: 0;\n min-height: 4rem;\n padding: 0.625rem;\n color: var(--foreground);\n}\n.stagedFileAttachment .fileAttachment { height: 100%; box-sizing: border-box; padding-right: 1.875rem; }\n.fileAttachment svg { flex: 0 0 auto; color: var(--muted-foreground); }\n.fileAttachmentDetails {\n display: flex;\n flex-direction: column;\n gap: 0.125rem;\n min-width: 0;\n font-size: 0.75rem;\n}\n.fileAttachmentDetails a,\n.fileAttachmentDetails > span {\n display: block;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n color: var(--foreground);\n text-decoration: none;\n}\n.fileAttachmentDetails a:hover { text-decoration: underline; }\n.fileAttachmentDetails small { color: var(--muted-foreground); font-size: 0.6875rem; }\n.removeAttachment {\n position: absolute;\n top: 0.25rem;\n right: 0.25rem;\n display: grid;\n place-items: center;\n width: 1.5rem;\n height: 1.5rem;\n padding: 0;\n border: 1px solid var(--border);\n border-radius: 50%;\n background: var(--background);\n color: var(--foreground);\n font: inherit;\n font-size: 1.125rem;\n line-height: 1;\n cursor: pointer;\n box-shadow: 0 1px 4px rgb(0 0 0 / 20%);\n}\n.removeAttachment:hover { background: var(--muted); }\n.removeAttachmentSlot {\n position: absolute;\n top: 0.25rem;\n right: 0.25rem;\n display: grid;\n place-items: center;\n}\n.removeAttachmentSlot button {\n display: grid;\n place-items: center;\n width: 1.5rem;\n min-width: 1.5rem;\n height: 1.5rem;\n min-height: 1.5rem;\n padding: 0;\n border: 1px solid var(--border);\n border-radius: 50%;\n background: var(--background);\n color: var(--foreground);\n font-size: 1.125rem;\n line-height: 1;\n box-shadow: 0 1px 4px rgb(0 0 0 / 20%);\n}\n.imageAttachmentButton:focus-visible, .removeAttachment:focus-visible,\n.fileAttachmentDetails a:focus-visible, .attachmentDialog button:focus-visible {\n outline: 2px solid var(--ring);\n outline-offset: 2px;\n}\n.attachmentDialog {\n max-width: min(95vw, 60rem);\n max-height: 90dvh;\n padding: 0.75rem;\n border: 1px solid var(--border);\n border-radius: 0.875rem;\n background: var(--background);\n color: var(--foreground);\n box-shadow: 0 16px 60px rgb(0 0 0 / 35%);\n}\n.attachmentDialog::backdrop { background: rgb(0 0 0 / 80%); }\n.attachmentDialogHeader {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 1rem;\n padding-bottom: 0.5rem;\n font-size: 0.8125rem;\n}\n.attachmentDialogHeader span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }\n.attachmentDialogHeader button {\n flex-shrink: 0;\n width: 2rem;\n height: 2rem;\n border: 0;\n border-radius: 50%;\n background: var(--muted);\n color: var(--foreground);\n font: inherit;\n font-size: 1.25rem;\n cursor: pointer;\n}\n.attachmentDialog > img {\n display: block;\n width: auto;\n height: auto;\n max-width: 100%;\n max-height: calc(90dvh - 5rem);\n margin: auto;\n object-fit: contain;\n}\n"],"mappings":""}
|
|
1
|
+
{"version":3,"file":"index84.cjs","names":[],"sources":["../src/components/ai-chat/ai-chat.module.css"],"sourcesContent":[".container {\n display: flex;\n flex-direction: column;\n height: 100%;\n min-height: 0;\n max-height: none;\n overflow: hidden;\n position: relative;\n}\n\n.scope {\n display: flex;\n flex-direction: column;\n gap: 0.25rem;\n padding: 0.75rem 3rem 0.75rem 1rem;\n background: var(--uzi-surface-1, var(--muted));\n border-bottom: 1px solid var(--border);\n}\n\n.scopeLabel {\n font-size: 0.6875rem;\n font-weight: 650;\n letter-spacing: 0.04em;\n text-transform: uppercase;\n color: var(--muted-foreground);\n}\n\n.scope strong {\n font-size: 0.875rem;\n}\n\n.scopeHelp {\n margin: 0;\n font-size: 0.75rem;\n color: var(--muted-foreground);\n line-height: 1.5;\n}\n\n.closeBtn {\n position: absolute;\n top: 0.5rem;\n right: 0.5rem;\n z-index: 1;\n display: grid;\n place-items: center;\n width: 2rem;\n height: 2rem;\n border: 0;\n border-radius: 50%;\n background: transparent;\n color: var(--muted-foreground);\n cursor: pointer;\n font-size: 0.875rem;\n}\n\n.closeBtn:hover {\n background: var(--uzi-surface-2, var(--muted));\n color: var(--foreground);\n}\n\n.closeBtn:focus-visible,\n.sendButton:focus-visible,\n.errorActions button:focus-visible,\n.historyLimit button:focus-visible {\n outline: 2px solid var(--primary);\n outline-offset: 2px;\n}\n\n.thread {\n display: flex;\n flex: 1;\n flex-direction: column;\n min-height: 0;\n overflow: hidden;\n}\n\n.viewport {\n flex: 1;\n display: flex;\n flex-direction: column;\n min-height: 0;\n overflow-y: auto;\n overflow-x: hidden;\n gap: 0.75rem;\n}\n\n.chatToolbar {\n flex-shrink: 0;\n display: flex;\n align-items: center;\n justify-content: flex-end;\n gap: 0.75rem;\n min-height: 2.75rem;\n padding: 0.375rem 0.75rem;\n background: var(--uzi-surface-1, var(--background));\n border-bottom: 1px solid var(--border);\n}\n\n.chatToolbarExtras {\n display: flex;\n align-items: center;\n gap: 0.5rem;\n min-width: 0;\n margin-right: auto;\n}\n\n.chatToolbar button {\n margin-left: 0;\n flex-shrink: 0;\n border: 0;\n border-radius: 0.375rem;\n padding: 0.35rem 0.5rem;\n background: transparent;\n color: var(--muted-foreground);\n font: inherit;\n font-size: 0.75rem;\n cursor: pointer;\n}\n\n.chatToolbar .newChatButton {\n display: grid;\n place-items: center;\n width: 2rem;\n height: 2rem;\n padding: 0;\n}\n\n.chatToolbar button:hover {\n color: var(--foreground);\n background: var(--uzi-surface-2, var(--muted));\n}\n\n.chatToolbar button:focus-visible {\n outline: 2px solid var(--primary);\n outline-offset: 2px;\n}\n\n.messageList {\n display: flex;\n flex: 1 0 auto;\n flex-direction: column;\n gap: 0.75rem;\n padding: 1rem;\n}\n\n.userMessage,\n.assistantMessage {\n display: flex;\n flex-direction: column;\n gap: 0.5rem;\n padding: 0.75rem 1rem;\n border-radius: 0.75rem;\n color: var(--foreground);\n overflow-wrap: anywhere;\n}\n\n.userMessage {\n background: color-mix(in srgb, var(--primary) 10%, transparent);\n border: 1px solid color-mix(in srgb, var(--primary) 20%, transparent);\n}\n\n.assistantMessage {\n background: var(--muted);\n border: 1px solid var(--border);\n}\n\n.textPart {\n white-space: pre-wrap;\n line-height: 1.6;\n}\n\n.reasoning,\n.toolPart {\n border: 1px solid var(--border);\n border-radius: 0.5rem;\n padding: 0.5rem 0.75rem;\n background: var(--uzi-surface-1, transparent);\n}\n\n.reasoningSummary,\n.toolPart summary {\n cursor: pointer;\n font-size: 0.75rem;\n font-weight: 600;\n color: var(--muted-foreground);\n}\n\n.reasoningText {\n margin: 0.5rem 0 0;\n font-size: 0.8125rem;\n line-height: 1.6;\n color: var(--muted-foreground);\n white-space: pre-wrap;\n}\n\n.sources {\n padding-top: 0.5rem;\n border-top: 1px solid var(--border);\n}\n\n.sourcesLabel {\n display: block;\n font-size: 0.6875rem;\n font-weight: 650;\n color: var(--muted-foreground);\n margin-bottom: 0.25rem;\n}\n\n.sources ul {\n display: flex;\n flex-wrap: wrap;\n gap: 0.5rem;\n margin: 0;\n padding-left: 1.25rem;\n}\n\n.sources li {\n font-size: 0.75rem;\n overflow-wrap: anywhere;\n}\n\n.data {\n padding: 0.5rem;\n background: var(--uzi-surface-2, var(--muted));\n border-radius: 0.5rem;\n overflow-x: auto;\n}\n\n.structuredData {\n margin: 0;\n padding: 0.5rem 0;\n max-width: 100%;\n overflow-x: auto;\n white-space: pre-wrap;\n overflow-wrap: anywhere;\n font-size: 0.75rem;\n line-height: 1.5;\n}\n\n.footer {\n position: sticky;\n bottom: 0;\n z-index: 1;\n flex-shrink: 0;\n background: var(--background);\n border-top: 1px solid var(--border);\n}\n\n.composerForm {\n display: grid;\n grid-template-columns: minmax(0, 1fr) auto;\n align-items: end;\n gap: 0.75rem;\n padding: 0.75rem 1rem;\n}\n\n.input {\n width: 100%;\n min-height: 2.5rem;\n padding: 0.5rem 0.75rem;\n border: 1px solid var(--border);\n border-radius: 0.5rem;\n background: var(--background);\n color: var(--foreground);\n font: inherit;\n font-size: 0.875rem;\n line-height: 1.5;\n resize: vertical;\n}\n\n.input:focus {\n outline: none;\n border-color: var(--primary);\n box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 30%, transparent);\n}\n\n.input::placeholder {\n color: var(--muted-foreground);\n}\n\n.input:disabled,\n.sendButton:disabled {\n opacity: 0.5;\n cursor: not-allowed;\n}\n\n.sendButton {\n min-height: 2.5rem;\n padding: 0.5rem 0.875rem;\n border: 1px solid var(--border);\n border-radius: 0.5rem;\n background: var(--primary);\n color: var(--primary-foreground);\n font: inherit;\n font-size: 0.875rem;\n font-weight: 600;\n cursor: pointer;\n}\n\n.sendButton:not(:disabled):hover {\n filter: brightness(0.95);\n}\n\n.activityBubble {\n display: inline-flex;\n align-items: center;\n align-self: flex-start;\n gap: 0.625rem;\n width: fit-content;\n max-width: 100%;\n padding: 0.375rem 0.5rem;\n color: var(--muted-foreground);\n font-size: 0.8125rem;\n line-height: 1.4;\n animation: uzi-chat-activity-enter 180ms ease-out 120ms both;\n}\n\n.activityDots { display: flex; align-items: center; gap: 0.2rem; }\n.activityDots i {\n display: block;\n width: 0.35rem;\n height: 0.35rem;\n flex: 0 0 auto;\n border-radius: 50%;\n background: currentColor;\n animation: uzi-chat-dot-pulse 1.2s ease-in-out infinite;\n}\n.activityDots i:nth-child(2) { animation-delay: 150ms; }\n.activityDots i:nth-child(3) { animation-delay: 300ms; }\n\n@keyframes uzi-chat-activity-enter {\n from { opacity: 0; transform: translateY(3px); }\n to { opacity: 1; transform: translateY(0); }\n}\n@keyframes uzi-chat-dot-pulse {\n 0%, 60%, 100% { opacity: 0.35; transform: translateY(0); }\n 30% { opacity: 1; transform: translateY(-3px); }\n}\n\n@media (prefers-reduced-motion: reduce) {\n .activityBubble, .activityDots i { animation: none; }\n}\n\n.error {\n display: flex;\n flex-direction: column;\n gap: 0.5rem;\n padding: 0.75rem 1rem;\n border: 1px solid var(--destructive);\n border-radius: 0.5rem;\n align-self: flex-start;\n max-width: min(100%, 42rem);\n margin: 0;\n background: color-mix(in srgb, var(--destructive) 10%, transparent);\n}\n\n.error p {\n margin: 0;\n color: var(--destructive);\n font-size: 0.8125rem;\n}\n\n.errorActions {\n display: flex;\n gap: 0.5rem;\n}\n\n.errorActions button,\n.historyLimit button {\n padding: 0.375rem 0.75rem;\n border: 1px solid var(--border);\n border-radius: 0.375rem;\n background: transparent;\n color: var(--foreground);\n font: inherit;\n font-size: 0.75rem;\n cursor: pointer;\n}\n\n.errorActions button:hover,\n.historyLimit button:hover {\n background: var(--uzi-surface-2, var(--muted));\n}\n\n.historyLimit {\n display: flex;\n flex-direction: column;\n gap: 0.5rem;\n align-items: center;\n padding: 0.75rem 1rem;\n margin: 0.75rem 1rem;\n background: var(--uzi-surface-1, var(--muted));\n border: 1px solid var(--border);\n border-radius: 0.5rem;\n}\n\n.historyLimit span {\n font-size: 0.75rem;\n color: var(--muted-foreground);\n}\n\n.emptyState {\n display: grid;\n place-items: center;\n flex: 1;\n min-height: 12rem;\n color: var(--muted-foreground);\n text-align: center;\n}\n\n.emptyState p {\n margin: 0;\n font-size: 0.875rem;\n}\n\n@media (max-width: 640px) {\n .composerForm {\n grid-template-columns: minmax(0, 1fr) auto;\n }\n\n .errorActions {\n flex-wrap: wrap;\n }\n}\n\n/* Optional integration controls use the same Uzi surface and layout tokens. */\n.composerExtras {\n grid-column: 1 / -1;\n min-width: 0;\n}\n\n.composerActions {\n display: flex;\n align-items: center;\n gap: 0.5rem;\n}\n\n.approvalActions { display: flex; align-items: center; flex-wrap: wrap; gap: 0.5rem; padding-top: 0.5rem; }\n.approvalActions button {\n background: var(--background); color: var(--foreground); border: 1px solid var(--border);\n border-radius: 0.375rem; padding: 0.3rem 0.55rem; cursor: pointer;\n}\n.approvalActions button:disabled { opacity: 0.5; cursor: not-allowed; }\n.attachmentError { color: var(--destructive); padding: 0.5rem 1rem; margin: 0; }\n.attachmentList {\n display: flex;\n flex-wrap: nowrap;\n gap: 0.625rem;\n max-width: 100%;\n padding: 0.125rem 0.125rem 0.5rem;\n margin: 0;\n overflow-x: auto;\n list-style: none;\n scrollbar-width: thin;\n}\n.attachmentList li { display: flex; flex: 0 0 auto; min-width: 0; }\n\n/* Role-aware message layout shared by the default renderer and consumer apps. */\n.messageBubble { width: fit-content; min-width: 0; max-width: 100%; }\n.messageBubble.userMessage { align-self: flex-end; max-width: min(90%, 42rem); }\n.messageBubble.assistantMessage { align-self: flex-start; max-width: 100%; }\n.messageLabel { font-size: 0.6875rem; font-weight: 650; color: var(--muted-foreground); }\n\n/* Shared compact composer: same visual grammar as Betty, without app-owned behavior. */\n.composerSurface {\n grid-column: 1 / -1;\n min-width: 0;\n border: 1px solid var(--border);\n border-radius: 0.875rem;\n background: var(--background);\n}\n.composerSurface:focus-within { outline: 2px solid var(--ring); outline-offset: 2px; }\n.composerRow { display: flex; align-items: end; min-width: 0; gap: 0.375rem; padding: 0.375rem; }\n.composerRow .input {\n display: block; flex: 1; width: 0; min-width: 0; min-height: 2.75rem;\n max-height: 11rem; padding: 0.625rem 0.25rem; border: 0;\n background: transparent; resize: none; font-size: 1rem;\n}\n.composerRow .input:focus { outline: none; box-shadow: none; }\n.composerIconButton, .composerRow .sendButton {\n display: grid; place-items: center; flex-shrink: 0;\n width: 2.75rem; height: 2.75rem; min-height: 2.75rem;\n padding: 0; border-radius: 0.625rem; cursor: pointer;\n}\n.composerIconButton {\n color: var(--foreground); border: 0; background: transparent;\n}\n.composerIconButton:hover:not(:disabled) { background: var(--muted); }\n.composerRow .sendButton { border: 0; background: var(--primary); color: var(--primary-foreground); }\n.composerIconButton:focus-visible, .composerRow .sendButton:focus-visible {\n outline: 2px solid var(--ring); outline-offset: 2px;\n}\n.composerIconButton:disabled { opacity: 0.5; cursor: not-allowed; }\n.visuallyHidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }\n\n/* Shared image tiles and file cards for both the composer and message history. */\n.attachmentCard {\n position: relative;\n display: flex;\n flex-direction: column;\n min-width: 0;\n max-width: 100%;\n overflow: hidden;\n border: 1px solid var(--border);\n border-radius: 0.75rem;\n background: var(--uzi-surface-1, var(--muted));\n}\n.stagedAttachment {\n width: 5.75rem;\n height: 5.75rem;\n}\n.stagedFileAttachment { width: min(15rem, 75vw); }\n.sentAttachment {\n width: fit-content;\n max-width: min(20rem, 100%);\n}\n/* Sent images are part of the message, not nested file cards. */\n.sentImageAttachment {\n border: 0;\n background: transparent;\n}\n.imageAttachmentButton {\n display: block;\n width: 100%;\n min-width: 0;\n padding: 0;\n border: 0;\n background: transparent;\n cursor: zoom-in;\n}\n.stagedAttachment .imageAttachmentButton { height: 100%; }\n.attachmentThumbnail {\n display: block;\n max-width: 100%;\n object-fit: contain;\n}\n.stagedAttachment .attachmentThumbnail { width: 100%; height: 100%; object-fit: cover; }\n.sentAttachment .attachmentThumbnail {\n width: auto;\n height: auto;\n min-width: 8rem;\n max-width: 100%;\n max-height: min(26rem, 60dvh);\n}\n.fileAttachment {\n display: flex;\n align-items: center;\n gap: 0.625rem;\n min-width: 0;\n min-height: 4rem;\n padding: 0.625rem;\n color: var(--foreground);\n}\n.stagedFileAttachment .fileAttachment { height: 100%; box-sizing: border-box; padding-right: 1.875rem; }\n.fileAttachment svg { flex: 0 0 auto; color: var(--muted-foreground); }\n.fileAttachmentDetails {\n display: flex;\n flex-direction: column;\n gap: 0.125rem;\n min-width: 0;\n font-size: 0.75rem;\n}\n.fileAttachmentDetails a,\n.fileAttachmentDetails > span {\n display: block;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n color: var(--foreground);\n text-decoration: none;\n}\n.fileAttachmentDetails a:hover { text-decoration: underline; }\n.fileAttachmentDetails small { color: var(--muted-foreground); font-size: 0.6875rem; }\n.removeAttachment {\n position: absolute;\n top: 0.25rem;\n right: 0.25rem;\n display: grid;\n place-items: center;\n width: 1.5rem;\n height: 1.5rem;\n padding: 0;\n border: 1px solid var(--border);\n border-radius: 50%;\n background: var(--background);\n color: var(--foreground);\n font: inherit;\n font-size: 1.125rem;\n line-height: 1;\n cursor: pointer;\n box-shadow: 0 1px 4px rgb(0 0 0 / 20%);\n}\n.removeAttachment:hover { background: var(--muted); }\n.removeAttachmentSlot {\n position: absolute;\n top: 0.25rem;\n right: 0.25rem;\n display: grid;\n place-items: center;\n}\n.removeAttachmentSlot button {\n display: grid;\n place-items: center;\n width: 1.5rem;\n min-width: 1.5rem;\n height: 1.5rem;\n min-height: 1.5rem;\n padding: 0;\n border: 1px solid var(--border);\n border-radius: 50%;\n background: var(--background);\n color: var(--foreground);\n font-size: 1.125rem;\n line-height: 1;\n box-shadow: 0 1px 4px rgb(0 0 0 / 20%);\n}\n.imageAttachmentButton:focus-visible, .removeAttachment:focus-visible,\n.fileAttachmentDetails a:focus-visible, .attachmentDialog button:focus-visible {\n outline: 2px solid var(--ring);\n outline-offset: 2px;\n}\n.attachmentDialog {\n max-width: min(95vw, 60rem);\n max-height: 90dvh;\n padding: 0.75rem;\n border: 1px solid var(--border);\n border-radius: 0.875rem;\n background: var(--background);\n color: var(--foreground);\n box-shadow: 0 16px 60px rgb(0 0 0 / 35%);\n}\n.attachmentDialog::backdrop { background: rgb(0 0 0 / 80%); }\n.attachmentDialogHeader {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 1rem;\n padding-bottom: 0.5rem;\n font-size: 0.8125rem;\n}\n.attachmentDialogHeader span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }\n.attachmentDialogHeader button {\n flex-shrink: 0;\n width: 2rem;\n height: 2rem;\n border: 0;\n border-radius: 50%;\n background: var(--muted);\n color: var(--foreground);\n font: inherit;\n font-size: 1.25rem;\n cursor: pointer;\n}\n.attachmentDialog > img {\n display: block;\n width: auto;\n height: auto;\n max-width: 100%;\n max-height: calc(90dvh - 5rem);\n margin: auto;\n object-fit: contain;\n}\n"],"mappings":""}
|
package/dist/index84.js
CHANGED
|
@@ -38,7 +38,8 @@ function AIChatAttachmentPreview({ name, size, imageUrl, href, staged, onRemove,
|
|
|
38
38
|
className: [
|
|
39
39
|
ai_chat_module_default.attachmentCard,
|
|
40
40
|
staged ? ai_chat_module_default.stagedAttachment : ai_chat_module_default.sentAttachment,
|
|
41
|
-
staged && !safePreviewUrl ? ai_chat_module_default.stagedFileAttachment : ""
|
|
41
|
+
staged && !safePreviewUrl ? ai_chat_module_default.stagedFileAttachment : "",
|
|
42
|
+
safePreviewUrl && !staged ? ai_chat_module_default.sentImageAttachment : ""
|
|
42
43
|
].filter(Boolean).join(" "),
|
|
43
44
|
children: [
|
|
44
45
|
safePreviewUrl ? /* @__PURE__ */ jsx("button", {
|
|
@@ -81,11 +82,6 @@ function AIChatAttachmentPreview({ name, size, imageUrl, href, staged, onRemove,
|
|
|
81
82
|
}), size !== void 0 && /* @__PURE__ */ jsx("small", { children: formatAttachmentSize(size) })]
|
|
82
83
|
})]
|
|
83
84
|
}),
|
|
84
|
-
safePreviewUrl && !staged && /* @__PURE__ */ jsx("span", {
|
|
85
|
-
className: ai_chat_module_default.sentAttachmentName,
|
|
86
|
-
title: name,
|
|
87
|
-
children: name
|
|
88
|
-
}),
|
|
89
85
|
removeControl && /* @__PURE__ */ jsx("span", {
|
|
90
86
|
className: ai_chat_module_default.removeAttachmentSlot,
|
|
91
87
|
children: removeControl
|
|
@@ -565,7 +561,10 @@ function AIChatView({ messages, status = "ready", activityLabel = "Working on yo
|
|
|
565
561
|
const hasAnswer = assistantParts.some((part) => part.type === "text" && Boolean(asString(part.text)?.trim()));
|
|
566
562
|
const showActivity = isBusy && (!hasAnswer || Boolean(activeTool));
|
|
567
563
|
const toolName = asString(activeTool?.toolName) ?? lastPartType.replace(/^tool-/, "");
|
|
568
|
-
const
|
|
564
|
+
const toolState = asString(activeTool?.state);
|
|
565
|
+
const approval = activeTool?.approval;
|
|
566
|
+
const approved = isRecord(approval) && approval.approved === true;
|
|
567
|
+
const currentActivityLabel = toolState === "approval-requested" ? "Waiting for approval…" : toolState === "approval-responded" && !approved ? "Processing approval response…" : activeTool ? (toolState && (toolState !== "approval-responded" || approved) ? toolActivityLabels?.[`${toolName}:${toolState}`] : void 0) ?? toolActivityLabels?.[toolName] ?? "Using a tool…" : activityLabel;
|
|
569
568
|
const limit = messageLimit != null && Number.isFinite(messageLimit) ? Math.max(1, Math.floor(messageLimit)) : null;
|
|
570
569
|
const historyFull = limit !== null && messages.filter((message) => message.role === "user").length >= limit;
|
|
571
570
|
const MessageRenderer = components?.MessageRenderer ?? DefaultMessageRenderer;
|
|
@@ -654,7 +653,27 @@ function AIChatView({ messages, status = "ready", activityLabel = "Working on yo
|
|
|
654
653
|
/* @__PURE__ */ jsx("i", {})
|
|
655
654
|
]
|
|
656
655
|
}), /* @__PURE__ */ jsx("span", { children: currentActivityLabel })]
|
|
657
|
-
})
|
|
656
|
+
}),
|
|
657
|
+
error && (onRetry && onNewChat ? /* @__PURE__ */ jsx(ErrorRenderer, {
|
|
658
|
+
error,
|
|
659
|
+
onRetry,
|
|
660
|
+
onClear: onNewChat
|
|
661
|
+
}) : /* @__PURE__ */ jsxs("div", {
|
|
662
|
+
className: ai_chat_module_default.error,
|
|
663
|
+
role: "alert",
|
|
664
|
+
children: [/* @__PURE__ */ jsx("p", { children: error.message }), (onRetry || onNewChat) && /* @__PURE__ */ jsxs("div", {
|
|
665
|
+
className: ai_chat_module_default.errorActions,
|
|
666
|
+
children: [onRetry && /* @__PURE__ */ jsx("button", {
|
|
667
|
+
type: "button",
|
|
668
|
+
onClick: onRetry,
|
|
669
|
+
children: "Retry response"
|
|
670
|
+
}), onNewChat && /* @__PURE__ */ jsx("button", {
|
|
671
|
+
type: "button",
|
|
672
|
+
onClick: onNewChat,
|
|
673
|
+
children: "Start new chat"
|
|
674
|
+
})]
|
|
675
|
+
})]
|
|
676
|
+
}))
|
|
658
677
|
]
|
|
659
678
|
})
|
|
660
679
|
}),
|
|
@@ -671,26 +690,6 @@ function AIChatView({ messages, status = "ready", activityLabel = "Working on yo
|
|
|
671
690
|
className: ai_chat_module_default.attachmentError,
|
|
672
691
|
children: attachmentError
|
|
673
692
|
}),
|
|
674
|
-
error && (onRetry && onNewChat ? /* @__PURE__ */ jsx(ErrorRenderer, {
|
|
675
|
-
error,
|
|
676
|
-
onRetry,
|
|
677
|
-
onClear: onNewChat
|
|
678
|
-
}) : /* @__PURE__ */ jsxs("div", {
|
|
679
|
-
className: ai_chat_module_default.error,
|
|
680
|
-
role: "alert",
|
|
681
|
-
children: [/* @__PURE__ */ jsx("p", { children: error.message }), (onRetry || onNewChat) && /* @__PURE__ */ jsxs("div", {
|
|
682
|
-
className: ai_chat_module_default.errorActions,
|
|
683
|
-
children: [onRetry && /* @__PURE__ */ jsx("button", {
|
|
684
|
-
type: "button",
|
|
685
|
-
onClick: onRetry,
|
|
686
|
-
children: "Retry response"
|
|
687
|
-
}), onNewChat && /* @__PURE__ */ jsx("button", {
|
|
688
|
-
type: "button",
|
|
689
|
-
onClick: onNewChat,
|
|
690
|
-
children: "Start new chat"
|
|
691
|
-
})]
|
|
692
|
-
})]
|
|
693
|
-
})),
|
|
694
693
|
historyFull && !error && !isBusy && onNewChat && /* @__PURE__ */ jsxs("div", {
|
|
695
694
|
className: ai_chat_module_default.historyLimit,
|
|
696
695
|
children: [/* @__PURE__ */ jsxs("span", { children: [
|
package/dist/index84.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index84.js","names":[],"sources":["../src/components/ai-chat/AIChat.tsx"],"sourcesContent":["'use client';\n\nimport { useEffect, useMemo, useRef, useState } from 'react';\nimport type { CSSProperties, ComponentType, FormEvent, KeyboardEvent, ReactNode } from 'react';\n\nimport { AuiConfig, AuiProvider, ThreadPrimitive } from '@assistant-ui/react';\nimport { AISDKChat, AssistantChatTransport, useAISDKChat } from '@assistant-ui/ai-sdk';\n\nimport styles from './ai-chat.module.css';\n\ntype AIChatTransportOptions = NonNullable<ConstructorParameters<typeof AssistantChatTransport>[0]>;\n\nexport interface AIChatProps {\n /** AI SDK UI-message stream endpoint. */\n readonly api: string;\n /** Opaque scope identifier sent to the API. Server must authorize it. */\n readonly scope?: string;\n /** Human-readable display text; never used as an access-control identifier. */\n readonly scopeLabel?: string;\n /** Fetch adapter for authentication, request instrumentation and local demos. */\n readonly fetch?: typeof globalThis.fetch;\n readonly headers?: Record<string, string>;\n readonly credentials?: RequestCredentials;\n /** Customize serialized requests for APIs with a strict request schema. */\n readonly prepareSendMessagesRequest?: AIChatTransportOptions['prepareSendMessagesRequest'];\n /** Change this when the authenticated identity changes to reset the transcript. */\n readonly sessionKey?: string | number;\n /** Maximum number of user turns (default: 8). */\n readonly messageLimit?: number;\n readonly inputPlaceholder?: string;\n /** Accessible name for the message textarea. */\n readonly inputAriaLabel?: string;\n readonly inputMaxLength?: number;\n readonly components?: AIChatComponents;\n /** Actions displayed beside the native New chat control in one shared toolbar. */\n readonly toolbarActions?: ReactNode;\n /** When false, the enclosing AIChatDock owns the New chat control. */\n readonly showNewChatInToolbar?: boolean;\n /** Increment or replace this stable token to request the native New chat flow externally. */\n readonly newChatRequestKey?: string | number;\n /** Opt-in files, restricted to images/text accepted by the application API. */\n readonly attachments?: AIChatAttachmentOptions;\n /** Visible, accessible activity label while the assistant has not started answering. */\n readonly activityLabel?: string;\n /** Human-friendly labels for running tools, keyed by SDK tool name. */\n readonly toolActivityLabels?: Readonly<Record<string, string>>;\n /** Optional persistence; implementations must scope storage by user AND resource. */\n readonly history?: AIChatHistoryAdapter;\n /** Native SDK continuation predicate for tool approvals. */\n readonly sendAutomaticallyWhen?: NonNullable<Parameters<typeof AISDKChat>[0]>['sendAutomaticallyWhen'];\n readonly onClose?: () => void;\n readonly className?: string;\n readonly style?: CSSProperties;\n}\n\n/**\n * Framework-independent presentation contract. The parent owns the runtime,\n * message identities, approvals, uploads, history and security boundaries.\n * Uzi does not serialize, persist or reinterpret any messages supplied here.\n */\nexport type AIChatMessage = AIChatMessageRendererProps['message'];\n\nexport interface AIChatAttachmentOptions {\n readonly accept: string;\n readonly maxFiles?: number;\n readonly maxBytesPerFile?: number;\n}\n\nexport interface AIChatSelectedAttachment {\n readonly name: string;\n readonly size: number;\n /** Local thumbnail URL for supported image files. */\n readonly previewUrl?: string;\n}\n\nexport interface AIChatHistoryAdapter {\n /** Load only validated UI messages from the authenticated principal's own storage. */\n readonly load: () => Promise<readonly AIChatMessage[]> | readonly AIChatMessage[];\n /** Save after complete turns; the consumer decides what metadata is safe. */\n readonly save: (messages: readonly AIChatMessage[]) => Promise<void> | void;\n readonly clear: () => Promise<void> | void;\n /** Observability for failed history operations; never include message payloads in logs. */\n readonly onError?: (operation: 'load' | 'save' | 'clear', error: unknown) => void;\n}\n\nexport type AIChatToolApprovalHandler = (id: string, approved: boolean) => Promise<void> | void;\n\nexport interface AIChatViewProps {\n readonly messages: readonly AIChatMessage[];\n readonly status?: string;\n readonly activityLabel?: string;\n readonly toolActivityLabels?: Readonly<Record<string, string>>;\n readonly error?: Error | null;\n readonly draft?: string;\n readonly onDraftChange?: (draft: string) => void;\n readonly onSend?: () => void;\n readonly onStop?: () => void;\n readonly onRetry?: () => void;\n readonly onNewChat?: () => void;\n /** False when AIChatDock owns the new-chat action in its header. */\n readonly showNewChatInToolbar?: boolean;\n /** No limit by default: specialized apps decide their own session policy. */\n readonly messageLimit?: number;\n readonly inputPlaceholder?: string;\n readonly inputAriaLabel?: string;\n readonly inputMaxLength?: number;\n readonly components?: AIChatComponents;\n readonly attachments?: readonly AIChatSelectedAttachment[];\n readonly onSelectAttachments?: (files: FileList) => void;\n readonly onRemoveAttachment?: (index: number) => void;\n readonly attachmentAccept?: string;\n readonly attachmentError?: string | null;\n /** Only invoked from explicit user action on an approval-requested tool part. */\n readonly onToolApproval?: AIChatToolApprovalHandler;\n /** Custom message toolbar controls, e.g. a conversation selector. */\n readonly toolbarActions?: ReactNode;\n /** Context labels or other app-owned notices above the transcript. */\n readonly header?: ReactNode;\n /** Upload actions, attachment previews or context chips before the input. */\n readonly composerLeading?: ReactNode;\n /** Additional buttons beside the Send/Stop control. */\n readonly composerTrailing?: ReactNode;\n /** Completely replace the composer while retaining shared transcript chrome. */\n readonly composer?: ReactNode;\n readonly emptyState?: ReactNode;\n readonly className?: string;\n readonly style?: CSSProperties;\n}\n\nexport interface AIChatComponents {\n readonly MessageRenderer?: ComponentType<AIChatMessageRendererProps>;\n readonly ReasoningRenderer?: ComponentType<AIChatReasoningRendererProps>;\n readonly SourceRenderer?: ComponentType<AIChatSourceRendererProps>;\n readonly DataRenderer?: ComponentType<AIChatDataRendererProps>;\n readonly ToolRenderer?: ComponentType<AIChatToolRendererProps>;\n readonly ErrorRenderer?: ComponentType<AIChatErrorRendererProps>;\n}\n\nexport interface AIChatMessageRendererProps {\n readonly message: {\n readonly id: string;\n readonly role: 'user' | 'assistant';\n readonly parts: readonly unknown[];\n readonly metadata?: Record<string, unknown>;\n };\n readonly renderMessagePart: (part: Record<string, unknown>, index: number) => ReactNode;\n readonly onToolApproval?: AIChatToolApprovalHandler;\n}\n\nexport interface AIChatReasoningRendererProps {\n readonly children: string;\n readonly title?: string;\n}\n\nexport interface AIChatSource {\n readonly id: string;\n readonly title?: string;\n readonly url?: string;\n}\n\nexport interface AIChatSourceRendererProps {\n readonly sources: readonly AIChatSource[];\n readonly renderSource: (source: AIChatSource, index: number) => ReactNode;\n}\n\nexport interface AIChatDataRendererProps {\n readonly data: readonly Record<string, unknown>[];\n readonly renderDataItem: (item: Record<string, unknown>, index: number) => ReactNode;\n}\n\nexport interface AIChatToolRendererProps {\n readonly part: Record<string, unknown>;\n readonly name: string;\n readonly approvalId?: string;\n readonly onApprove?: () => void;\n readonly onDeny?: () => void;\n readonly approvalPending: boolean;\n}\n\nexport interface AIChatErrorRendererProps {\n readonly error: Error;\n readonly onRetry: () => void;\n readonly onClear: () => void;\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\nfunction asString(value: unknown): string | undefined {\n return typeof value === 'string' ? value : undefined;\n}\n\nfunction safeHttpUrl(value: unknown): string | undefined {\n const url = asString(value);\n return url && /^https?:\\/\\//i.test(url) ? url : undefined;\n}\n\n/** Allow only inert bitmap image data, never script-capable data or blob links from messages. */\nfunction safeImageUrl(value: unknown): string | undefined {\n const url = asString(value);\n return url && (/^https?:\\/\\//i.test(url) || /^data:image\\/(?:png|jpeg|gif|webp|avif);base64,/i.test(url))\n ? url : undefined;\n}\n\nfunction formatAttachmentSize(bytes: number): string {\n if (bytes < 1024) return `${bytes} B`;\n return bytes < 1024 * 1024 ? `${(bytes / 1024).toFixed(1)} KB` : `${(bytes / (1024 * 1024)).toFixed(1)} MB`;\n}\n\n/** Shared attachment surface for built-in Uzi chat and custom SDK runtimes. */\nexport interface AIChatAttachmentPreviewProps {\n readonly name: string;\n readonly size?: number;\n /** HTTP(S), safe bitmap data URI, or a local object URL when staged. */\n readonly imageUrl?: string;\n /** Optional HTTP(S) link for non-image files. */\n readonly href?: string;\n /** Compact composer chip rather than a history attachment. */\n readonly staged?: boolean;\n readonly onRemove?: () => void;\n /** Pass an SDK-owned remove button here when removal must be done by a primitive. */\n readonly removeControl?: ReactNode;\n}\n\n/** The same attachment surface is used for staged files and sent message parts. */\nexport function AIChatAttachmentPreview({ name, size, imageUrl, href, staged, onRemove, removeControl }: AIChatAttachmentPreviewProps) {\n const safePreviewUrl = imageUrl && (safeImageUrl(imageUrl) || (staged && /^blob:/i.test(imageUrl) ? imageUrl : undefined));\n const safeHref = safeHttpUrl(href);\n const dialogRef = useRef<HTMLDialogElement>(null);\n const previewButtonRef = useRef<HTMLButtonElement>(null);\n const [previewOpen, setPreviewOpen] = useState(false);\n\n useEffect(() => {\n if (previewOpen && dialogRef.current && !dialogRef.current.open) dialogRef.current.showModal?.();\n }, [previewOpen]);\n\n return (\n <div className={[styles.attachmentCard, staged ? styles.stagedAttachment : styles.sentAttachment,\n staged && !safePreviewUrl ? styles.stagedFileAttachment : ''].filter(Boolean).join(' ')}>\n {safePreviewUrl ? (\n <button ref={previewButtonRef} type=\"button\" className={styles.imageAttachmentButton}\n onClick={() => setPreviewOpen(true)} aria-label={`Preview ${name}`} title={`Preview ${name}`}>\n <img className={styles.attachmentThumbnail} src={safePreviewUrl} alt={name} loading=\"lazy\" />\n </button>\n ) : (\n <div className={styles.fileAttachment}>\n <svg aria-hidden=\"true\" width=\"22\" height=\"22\" viewBox=\"0 0 24 24\" fill=\"none\"\n stroke=\"currentColor\" strokeWidth=\"1.7\" strokeLinecap=\"round\" strokeLinejoin=\"round\">\n <path d=\"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8Z\" />\n <path d=\"M14 2v6h6M8 13h8M8 17h5\" />\n </svg>\n <span className={styles.fileAttachmentDetails}>\n {safeHref ? <a href={safeHref} target=\"_blank\" rel=\"noopener noreferrer\" title={name}>{name}</a>\n : <span title={name}>{name}</span>}\n {size !== undefined && <small>{formatAttachmentSize(size)}</small>}\n </span>\n </div>\n )}\n {safePreviewUrl && !staged && <span className={styles.sentAttachmentName} title={name}>{name}</span>}\n {removeControl && <span className={styles.removeAttachmentSlot}>{removeControl}</span>}\n {!removeControl && onRemove && (\n <button type=\"button\" className={styles.removeAttachment} onClick={onRemove}\n aria-label={`Remove ${name}`} title={`Remove ${name}`}>×</button>\n )}\n {previewOpen && safePreviewUrl && (\n <dialog ref={dialogRef} className={styles.attachmentDialog} aria-label={`Preview ${name}`}\n onClose={() => { setPreviewOpen(false); previewButtonRef.current?.focus(); }}\n onClick={(event) => { if (event.target === event.currentTarget) event.currentTarget.close(); }}>\n <div className={styles.attachmentDialogHeader}>\n <span title={name}>{name}</span>\n <button type=\"button\" onClick={() => dialogRef.current?.close()} aria-label=\"Close attachment preview\">×</button>\n </div>\n <img src={safePreviewUrl} alt={name} />\n </dialog>\n )}\n </div>\n );\n}\n\n/** Reusable role-aware message surface for domain renderers. */\nexport interface AIChatMessageBubbleProps {\n readonly role: 'user' | 'assistant';\n readonly label?: string;\n readonly children: ReactNode;\n readonly className?: string;\n}\n\nexport function AIChatMessageBubble({ role, label, children, className }: AIChatMessageBubbleProps) {\n return (\n <div className={[styles.messageBubble, role === 'user' ? styles.userMessage : styles.assistantMessage, className]\n .filter(Boolean).join(' ')} data-role={role}>\n {label && <span className={styles.messageLabel}>{label}</span>}\n {children}\n </div>\n );\n}\n\nfunction DefaultMessageRenderer({ message, renderMessagePart }: AIChatMessageRendererProps) {\n return (\n <AIChatMessageBubble role={message.role}>\n {message.parts.map((part, index) => (\n <div key={isRecord(part) && typeof part.id === 'string' ? part.id : index}>\n {isRecord(part) ? renderMessagePart(part, index) : null}\n </div>\n ))}\n </AIChatMessageBubble>\n );\n}\n\nfunction DefaultReasoningRenderer({ children, title = 'Reasoning' }: AIChatReasoningRendererProps) {\n return (\n <details className={styles.reasoning}>\n <summary className={styles.reasoningSummary}>{title}</summary>\n <p className={styles.reasoningText}>{children}</p>\n </details>\n );\n}\n\nfunction DefaultSourceRenderer({ sources, renderSource }: AIChatSourceRendererProps) {\n return (\n <div className={styles.sources}>\n <span className={styles.sourcesLabel}>Sources</span>\n <ul>\n {sources.map((source, index) => (\n <li key={source.id}>{renderSource(source, index)}</li>\n ))}\n </ul>\n </div>\n );\n}\n\nfunction DefaultDataRenderer({ data, renderDataItem }: AIChatDataRendererProps) {\n return (\n <div className={styles.data}>\n {data.map((item, index) => (\n <div key={index}>{renderDataItem(item, index)}</div>\n ))}\n </div>\n );\n}\n\nfunction DefaultErrorRenderer({ error, onRetry, onClear }: AIChatErrorRendererProps) {\n return (\n <div className={styles.error} role=\"alert\">\n <p>{error.message}</p>\n <div className={styles.errorActions}>\n <button type=\"button\" onClick={onRetry}>Retry response</button>\n <button type=\"button\" onClick={onClear}>Start new chat</button>\n </div>\n </div>\n );\n}\n\nfunction renderPart(\n part: Record<string, unknown>,\n index: number,\n components: AIChatComponents | undefined,\n onToolApproval?: AIChatToolApprovalHandler,\n pendingApprovalId?: string | null,\n): ReactNode {\n const type = asString(part.type) ?? '';\n if (type === 'step-start') return null;\n if (type === 'text') {\n return <span className={styles.textPart}>{asString(part.text) ?? ''}</span>;\n }\n if (type === 'reasoning') {\n const ReasoningRenderer = components?.ReasoningRenderer ?? DefaultReasoningRenderer;\n return <ReasoningRenderer>{asString(part.text) ?? ''}</ReasoningRenderer>;\n }\n if (type === 'source-url' || type === 'source-document') {\n const SourceRenderer = components?.SourceRenderer ?? DefaultSourceRenderer;\n const source: AIChatSource = {\n id: asString(part.sourceId) ?? asString(part.id) ?? `source-${index}`,\n title: asString(part.title) ?? asString(part.filename),\n url: safeHttpUrl(part.url),\n };\n return (\n <SourceRenderer\n sources={[source]}\n renderSource={(item) => item.url ? (\n <a href={item.url} target=\"_blank\" rel=\"noopener noreferrer\">\n {item.title ?? item.url}\n </a>\n ) : <span>{item.title ?? item.id}</span>}\n />\n );\n }\n if (type.startsWith('data-')) {\n const DataRenderer = components?.DataRenderer ?? DefaultDataRenderer;\n return (\n <DataRenderer\n data={[part]}\n renderDataItem={(item) => (\n <pre className={styles.structuredData}>{JSON.stringify(item.data ?? item, null, 2)}</pre>\n )}\n />\n );\n }\n if (type.startsWith('tool-') || type === 'dynamic-tool') {\n const name = asString(part.toolName) ?? type.replace(/^tool-/, '');\n const approval = isRecord(part.approval) ? asString(part.approval.id) : undefined;\n const approvalId = part.state === 'approval-requested' ? approval : undefined;\n const controlsDisabled = pendingApprovalId !== null && pendingApprovalId !== undefined;\n const ToolRenderer = components?.ToolRenderer;\n const props: AIChatToolRendererProps = {\n part, name, approvalId,\n approvalPending: controlsDisabled,\n ...(approvalId && onToolApproval ? {\n onApprove: () => { if (!controlsDisabled) void onToolApproval(approvalId, true); },\n onDeny: () => { if (!controlsDisabled) void onToolApproval(approvalId, false); },\n } : {}),\n };\n if (ToolRenderer) return <ToolRenderer {...props} />;\n return (\n <div className={styles.toolPart}>\n <details>\n <summary>{name}</summary>\n <pre className={styles.structuredData}>\n {JSON.stringify(part.output ?? part.input ?? part, null, 2)}\n </pre>\n </details>\n {approvalId && (\n <div className={styles.approvalActions} aria-label={`Approval required for ${name}`}>\n {props.onApprove && props.onDeny ? (\n <>\n <button type=\"button\" disabled={controlsDisabled} onClick={props.onApprove}>Approve</button>\n <button type=\"button\" disabled={controlsDisabled} onClick={props.onDeny}>Deny</button>\n </>\n ) : <span>Approval required in application</span>}\n </div>\n )}\n </div>\n );\n }\n if (type === 'file' || type === 'image') {\n const name = asString(part.filename) ?? asString(part.name) ?? 'Attachment';\n const mediaType = asString(part.mediaType) ?? asString(part.mimeType);\n const isImage = type === 'image' || /^image\\/(?:png|jpeg|gif|webp|avif)$/i.test(mediaType ?? '')\n || /\\.(?:png|jpe?g|gif|webp|avif)$/i.test(name);\n const imageUrl = isImage ? safeImageUrl(part.url) : undefined;\n return <AIChatAttachmentPreview name={name} imageUrl={imageUrl} href={safeHttpUrl(part.url)}\n size={typeof part.size === 'number' && part.size >= 0 ? part.size : undefined} />;\n }\n // Preserve unsupported part types as inspectable data instead of silently dropping them.\n return <pre className={styles.structuredData}>{JSON.stringify(part, null, 2)}</pre>;\n}\n\nconst DEFAULT_MESSAGE_LIMIT = 8;\n\nexport function AIChat({\n api,\n scope,\n scopeLabel,\n fetch: requestFetch,\n headers,\n credentials,\n prepareSendMessagesRequest,\n sessionKey,\n messageLimit = DEFAULT_MESSAGE_LIMIT,\n inputPlaceholder = 'Ask a question...',\n inputAriaLabel = 'Message',\n inputMaxLength = 2000,\n components,\n toolbarActions,\n showNewChatInToolbar = true,\n newChatRequestKey,\n attachments,\n activityLabel,\n toolActivityLabels,\n history,\n sendAutomaticallyWhen,\n onClose,\n className,\n style,\n}: AIChatProps) {\n // Remounting the provider creates a fresh AI SDK chat id, not merely an empty transcript.\n const [session, setSession] = useState(0);\n const transport = useMemo(\n () => new AssistantChatTransport({\n api,\n // The transport merges this with the AI SDK messages, id, model context and tools.\n // The endpoint, not the presentation component, must enforce the scope.\n ...(scope ? { body: { scope } } : {}),\n ...(requestFetch ? { fetch: requestFetch } : {}),\n ...(headers ? { headers } : {}),\n ...(credentials ? { credentials } : {}),\n ...(prepareSendMessagesRequest ? { prepareSendMessagesRequest } : {}),\n }),\n [api, scope, requestFetch, headers, credentials, prepareSendMessagesRequest],\n );\n const config = useMemo(\n () => AuiConfig({ threads: AISDKChat({ transport, ...(sendAutomaticallyWhen ? { sendAutomaticallyWhen } : {}) }) }),\n [transport, session, sendAutomaticallyWhen],\n );\n\n return (\n <div className={[styles.container, className].filter(Boolean).join(' ')} style={style}>\n {scopeLabel && (\n <div className={styles.scope}>\n <span className={styles.scopeLabel}>Current scope</span>\n <strong>{scopeLabel}</strong>\n </div>\n )}\n {onClose && (\n <button className={styles.closeBtn} type=\"button\" onClick={onClose} aria-label=\"Close chat\">\n ✕\n </button>\n )}\n <AuiProvider key={JSON.stringify([api, scope, sessionKey, session])} config={config}>\n <ThreadPrimitive.Root className={styles.thread}>\n <ChatViewport\n messageLimit={Number.isFinite(messageLimit) ? Math.max(1, Math.floor(messageLimit)) : DEFAULT_MESSAGE_LIMIT}\n inputPlaceholder={inputPlaceholder}\n inputAriaLabel={inputAriaLabel}\n inputMaxLength={inputMaxLength}\n components={components}\n toolbarActions={toolbarActions}\n showNewChatInToolbar={showNewChatInToolbar}\n newChatRequestKey={newChatRequestKey}\n attachmentOptions={attachments}\n activityLabel={activityLabel}\n toolActivityLabels={toolActivityLabels}\n history={history}\n onNewChat={() => setSession((previous) => previous + 1)}\n />\n </ThreadPrimitive.Root>\n </AuiProvider>\n </div>\n );\n}\n\ninterface ChatViewportProps {\n readonly messageLimit: number;\n readonly inputPlaceholder: string;\n readonly inputAriaLabel: string;\n readonly inputMaxLength: number;\n readonly components?: AIChatComponents;\n readonly toolbarActions?: ReactNode;\n readonly showNewChatInToolbar?: boolean;\n readonly newChatRequestKey?: string | number;\n readonly attachmentOptions?: AIChatAttachmentOptions;\n readonly activityLabel?: string;\n readonly toolActivityLabels?: Readonly<Record<string, string>>;\n readonly history?: AIChatHistoryAdapter;\n readonly onNewChat: () => void;\n}\n\nfunction ChatViewport({\n messageLimit,\n inputPlaceholder,\n inputAriaLabel,\n inputMaxLength,\n components,\n toolbarActions,\n showNewChatInToolbar,\n newChatRequestKey,\n attachmentOptions,\n activityLabel,\n toolActivityLabels,\n history,\n onNewChat,\n}: ChatViewportProps) {\n const chat = useAISDKChat();\n const [draft, setDraft] = useState('');\n const [selectedFiles, setSelectedFiles] = useState<File[]>([]);\n const [attachmentError, setAttachmentError] = useState<string | null>(null);\n const [attachmentPreviews, setAttachmentPreviews] = useState<string[]>([]);\n const [hydrated, setHydrated] = useState(!history);\n const expectedRestoredId = useRef<string | null>(null);\n const saveQueue = useRef<Promise<void>>(Promise.resolve());\n const [approvalBusy, setApprovalBusy] = useState(false);\n useEffect(() => {\n const urls = selectedFiles.map((file) => file.type.startsWith('image/') && typeof URL.createObjectURL === 'function' ? URL.createObjectURL(file) : '');\n setAttachmentPreviews(urls);\n return () => urls.forEach((url) => { if (url && typeof URL.revokeObjectURL === 'function') URL.revokeObjectURL(url); });\n }, [selectedFiles]);\n const messages = chat?.messages ?? [];\n const status = chat?.status ?? 'ready';\n const isBusy = status === 'submitted' || status === 'streaming';\n const historyFull = messages.filter((message) => message.role === 'user').length >= messageLimit;\n const reportHistoryError = (operation: 'load' | 'save' | 'clear', error: unknown) => {\n if (history?.onError) history.onError(operation, error);\n else console.warn(`[Uzi AIChat] History ${operation} failed`);\n };\n // Persist only complete turns. Do not save an empty runtime over stored history\n // during hydration or while a response is still streaming.\n useEffect(() => {\n if (!history) return;\n let active = true;\n void Promise.resolve().then(() => history.load()).then((restored) => {\n if (!active) return;\n if (Array.isArray(restored)) {\n const valid = restored.filter((message) =>\n typeof message?.id === 'string' &&\n (message.role === 'user' || message.role === 'assistant') &&\n Array.isArray(message.parts));\n expectedRestoredId.current = valid.length ? valid[0].id : null;\n if (valid.length) chat?.setMessages(valid as Parameters<NonNullable<typeof chat>['setMessages']>[0]);\n }\n setHydrated(true);\n }).catch((error: unknown) => {\n if (active) {\n reportHistoryError('load', error);\n setHydrated(true);\n }\n });\n return () => { active = false; };\n }, [chat?.setMessages, history]);\n\n useEffect(() => {\n if (!history || !hydrated || isBusy) return;\n const snapshot = messages.filter((message) => message.role === 'user' || message.role === 'assistant').map((message) => ({\n id: message.id, role: message.role as 'user' | 'assistant', parts: message.parts,\n ...(isRecord(message.metadata) ? { metadata: message.metadata } : {}),\n }));\n // Guard against the transient empty SDK state between history.load and\n // setMessages propagation; otherwise an old transcript could be erased.\n if (expectedRestoredId.current) {\n if (!snapshot.some((message) => message.id === expectedRestoredId.current)) return;\n expectedRestoredId.current = null;\n }\n // Serialize writes. New Chat waits for in-flight writes before clearing.\n saveQueue.current = saveQueue.current.then(\n () => history.save(snapshot),\n () => history.save(snapshot),\n ).then(\n () => {},\n (error: unknown) => { reportHistoryError('save', error); },\n );\n }, [history, hydrated, isBusy, messages]);\n\n const handleSelectedFiles = (files: FileList) => {\n if (!attachmentOptions) return;\n const selected = Array.from(files);\n if (selected.length + selectedFiles.length > (attachmentOptions.maxFiles ?? 3)) {\n setAttachmentError('Too many attachments.');\n return;\n }\n if (selected.some((file) => file.size > (attachmentOptions.maxBytesPerFile ?? 5 * 1024 * 1024))) {\n setAttachmentError('An attachment exceeds the size limit.');\n return;\n }\n const allowedTypes = attachmentOptions.accept.split(',').map((item) => item.trim());\n if (selected.some((file) => !allowedTypes.some((allow) => (\n allow === file.type || (allow.endsWith('/*') && file.type.startsWith(allow.slice(0, -1)))\n )))) {\n setAttachmentError('Unsupported attachment type.');\n return;\n }\n setAttachmentError(null);\n setSelectedFiles((existing) => [...existing, ...selected]);\n };\n\n const handleSubmit = () => {\n const text = draft.trim();\n if (!chat || (!text && selectedFiles.length === 0) || isBusy || historyFull || chat.error || !hydrated || approvalBusy) return;\n const files = selectedFiles.length ? new DataTransfer() : null;\n selectedFiles.forEach((file) => files?.items.add(file));\n // AI SDK serializes FileList to FileUIParts and sends them through the\n // app-owned transport. The server MUST validate types and sizes again.\n // Clear the composer promptly; restore the draft and files if submission\n // fails, so users do not lose attachments or typed content.\n const previousDraft = draft;\n const previousFiles = selectedFiles;\n setDraft('');\n setSelectedFiles([]);\n setAttachmentError(null);\n void Promise.resolve(chat.sendMessage({ text, ...(files ? { files: files.files } : {}) }))\n .catch(() => {\n setDraft((current) => current || previousDraft);\n setSelectedFiles((current) => current.length ? current : previousFiles);\n });\n };\n\n const handleNewChat = () => {\n void (async () => {\n await chat?.stop();\n if (history) {\n try {\n await saveQueue.current;\n await history.clear();\n } catch (error) {\n reportHistoryError('clear', error);\n return;\n }\n }\n onNewChat();\n })();\n };\n\n // An enclosing dock can reuse the native reset path without duplicating\n // history deletion, aborts, or SDK session management in each consumer.\n const lastNewChatRequestKey = useRef(newChatRequestKey);\n useEffect(() => {\n if (lastNewChatRequestKey.current === newChatRequestKey) return;\n lastNewChatRequestKey.current = newChatRequestKey;\n handleNewChat();\n }, [newChatRequestKey]);\n\n const handleRetry = () => {\n if (!chat || isBusy) return;\n chat.clearError();\n void chat.regenerate();\n };\n\n return (\n <AIChatView\n messages={messages.filter((message) => message.role === 'user' || message.role === 'assistant').map((message) => ({\n id: message.id,\n role: message.role as 'user' | 'assistant',\n parts: message.parts,\n ...(isRecord(message.metadata) ? { metadata: message.metadata } : {}),\n }))}\n status={status}\n activityLabel={activityLabel}\n toolActivityLabels={toolActivityLabels}\n error={chat?.error}\n draft={draft}\n onDraftChange={setDraft}\n onSend={handleSubmit}\n onStop={() => { void chat?.stop(); }}\n onRetry={handleRetry}\n onNewChat={handleNewChat}\n showNewChatInToolbar={showNewChatInToolbar}\n toolbarActions={toolbarActions}\n messageLimit={messageLimit}\n attachments={selectedFiles.map((file, index) => ({ name: file.name, size: file.size, ...(attachmentPreviews[index] ? { previewUrl: attachmentPreviews[index] } : {}) }))}\n onSelectAttachments={attachmentOptions ? handleSelectedFiles : undefined}\n onRemoveAttachment={attachmentOptions ? (index) => setSelectedFiles((files) => files.filter((_, i) => i !== index)) : undefined}\n attachmentAccept={attachmentOptions?.accept}\n attachmentError={attachmentError}\n onToolApproval={chat ? async (id, approved) => {\n if (approvalBusy) return;\n setApprovalBusy(true);\n try { await chat.addToolApprovalResponse({ id, approved, ...(!approved ? { reason: 'User denied approval' } : {}) }); }\n finally { setApprovalBusy(false); }\n } : undefined}\n inputPlaceholder={inputPlaceholder}\n inputAriaLabel={inputAriaLabel}\n inputMaxLength={inputMaxLength}\n components={components}\n />\n );\n}\n\n/**\n * Controlled chat presentation for apps with their own AI SDK/assistant-ui\n * runtime. It does not create providers, transports or chat state. Callbacks\n * are the only way messages/actions leave the view.\n */\nexport function AIChatView({\n messages,\n status = 'ready',\n activityLabel = 'Working on your response…',\n toolActivityLabels,\n error,\n draft = '',\n onDraftChange,\n onSend,\n onStop,\n onRetry,\n onNewChat,\n showNewChatInToolbar = true,\n messageLimit,\n inputPlaceholder = 'Ask a question...',\n inputAriaLabel = 'Message',\n inputMaxLength = 2000,\n components,\n attachments,\n onSelectAttachments,\n onRemoveAttachment,\n attachmentAccept,\n attachmentError,\n onToolApproval,\n toolbarActions,\n header,\n composerLeading,\n composerTrailing,\n composer,\n emptyState,\n className,\n style,\n}: AIChatViewProps) {\n const viewportRef = useRef<HTMLDivElement>(null);\n const pinnedToBottom = useRef(true);\n const fileInputRef = useRef<HTMLInputElement>(null);\n const approvalRef = useRef<string | null>(null);\n const [pendingApprovalId, setPendingApprovalId] = useState<string | null>(null);\n const [approvalError, setApprovalError] = useState<string | null>(null);\n const respondToApproval: AIChatToolApprovalHandler = async (id, approved) => {\n if (!onToolApproval || approvalRef.current) return;\n approvalRef.current = id;\n setPendingApprovalId(id);\n setApprovalError(null);\n try { await onToolApproval(id, approved); }\n catch { setApprovalError('Could not submit approval. Please try again.'); }\n finally { approvalRef.current = null; setPendingApprovalId(null); }\n };\n const isBusy = status === 'submitted' || status === 'streaming';\n const lastMessage = messages[messages.length - 1];\n const assistantParts = lastMessage?.role === 'assistant' ? lastMessage.parts.filter(isRecord) : [];\n const lastPart = [...assistantParts].reverse().find((part) => part.type !== 'step-start');\n const lastPartType = asString(lastPart?.type) ?? '';\n const activeTool = (lastPartType.startsWith('tool-') || lastPartType === 'dynamic-tool')\n && lastPart?.state !== 'output-available' && lastPart?.state !== 'output-error'\n ? lastPart : undefined;\n const hasAnswer = assistantParts.some((part) => part.type === 'text' && Boolean(asString(part.text)?.trim()));\n const showActivity = isBusy && (!hasAnswer || Boolean(activeTool));\n const toolName = asString(activeTool?.toolName) ?? lastPartType.replace(/^tool-/, '');\n const currentActivityLabel = activeTool?.state === 'approval-requested' ? 'Waiting for approval…'\n : activeTool ? (toolActivityLabels?.[toolName] ?? 'Using a tool…') : activityLabel;\n const limit = messageLimit != null && Number.isFinite(messageLimit)\n ? Math.max(1, Math.floor(messageLimit)) : null;\n const historyFull = limit !== null && messages.filter((message) => message.role === 'user').length >= limit;\n const MessageRenderer = components?.MessageRenderer ?? DefaultMessageRenderer;\n const ErrorRenderer = components?.ErrorRenderer ?? DefaultErrorRenderer;\n\n // Follow streaming text only if the user is already near the bottom.\n useEffect(() => {\n const viewport = viewportRef.current;\n if (viewport && pinnedToBottom.current) viewport.scrollTop = viewport.scrollHeight;\n });\n\n const handleKeyDown = (event: KeyboardEvent<HTMLTextAreaElement>) => {\n if (event.key === 'Enter' && !event.shiftKey && !event.nativeEvent.isComposing) {\n event.preventDefault();\n if (!isBusy && !historyFull && !error && (draft.trim() || (attachments?.length ?? 0) > 0)) onSend?.();\n }\n };\n\n const handleFormSubmit = (event: FormEvent<HTMLFormElement>) => {\n event.preventDefault();\n if (!isBusy && !historyFull && !error && (draft.trim() || (attachments?.length ?? 0) > 0)) onSend?.();\n };\n\n return (\n <div className={[styles.thread, className].filter(Boolean).join(' ')} style={style}>\n {header}\n {(toolbarActions || (showNewChatInToolbar && onNewChat && messages.length > 0)) && (\n <div className={styles.chatToolbar} role=\"toolbar\" aria-label=\"Conversation actions\">\n <div className={styles.chatToolbarExtras}>{toolbarActions}</div>\n {showNewChatInToolbar && onNewChat && messages.length > 0 && (\n <button\n type=\"button\"\n className={styles.newChatButton}\n onClick={onNewChat}\n aria-label=\"New chat\"\n title=\"New chat\"\n >\n <svg aria-hidden=\"true\" width=\"18\" height=\"18\" viewBox=\"0 0 24 24\" fill=\"none\"\n stroke=\"currentColor\" strokeWidth=\"1.8\" strokeLinecap=\"round\" strokeLinejoin=\"round\">\n <path d=\"M12 5H6a2 2 0 0 0-2 2v11a2 2 0 0 0 2 2h11a2 2 0 0 0 2-2v-6\" />\n <path d=\"m15 5 4 4M13 11l7-7a2.12 2.12 0 0 1 3 3l-7 7-4 1 1-4Z\" transform=\"translate(-2 -2)\" />\n </svg>\n </button>\n )}\n </div>\n )}\n <div\n ref={viewportRef}\n className={styles.viewport}\n onScroll={(event) => {\n const viewport = event.currentTarget;\n pinnedToBottom.current = viewport.scrollHeight - viewport.scrollTop - viewport.clientHeight < 80;\n }}\n >\n <div className={styles.messageList} role=\"log\" aria-label=\"Chat history\" aria-live=\"polite\">\n {messages.length === 0 && (\n <div className={styles.emptyState}>\n {emptyState ?? <p>Start a conversation</p>}\n </div>\n )}\n {messages.map((message) => (\n <MessageRenderer\n key={message.id}\n message={message}\n renderMessagePart={(part, index) => renderPart(part, index, components, onToolApproval ? respondToApproval : undefined, pendingApprovalId)}\n onToolApproval={onToolApproval ? respondToApproval : undefined}\n />\n ))}\n {showActivity && (\n <div className={styles.activityBubble} role=\"status\" aria-label={currentActivityLabel}>\n <span className={styles.activityDots} aria-hidden=\"true\"><i /><i /><i /></span>\n <span>{currentActivityLabel}</span>\n </div>\n )}\n </div>\n </div>\n <div className={styles.footer}>\n {approvalError && <p role=\"alert\" className={styles.attachmentError}>{approvalError}</p>}\n {attachmentError && <p role=\"alert\" className={styles.attachmentError}>{attachmentError}</p>}\n {error && (\n onRetry && onNewChat ? (\n <ErrorRenderer error={error} onRetry={onRetry} onClear={onNewChat} />\n ) : (\n <div className={styles.error} role=\"alert\">\n <p>{error.message}</p>\n {(onRetry || onNewChat) && (\n <div className={styles.errorActions}>\n {onRetry && <button type=\"button\" onClick={onRetry}>Retry response</button>}\n {onNewChat && <button type=\"button\" onClick={onNewChat}>Start new chat</button>}\n </div>\n )}\n </div>\n )\n )}\n {historyFull && !error && !isBusy && onNewChat && (\n <div className={styles.historyLimit}>\n <span>This chat has reached its {limit}-question limit.</span>\n <button type=\"button\" onClick={onNewChat}>Start new chat</button>\n </div>\n )}\n {(!historyFull || isBusy) && !error && (\n composer !== undefined ? composer : (\n <form className={styles.composerForm} onSubmit={handleFormSubmit}>\n {composerLeading && <div className={styles.composerExtras}>{composerLeading}</div>}\n {onSelectAttachments && (\n <input\n ref={fileInputRef}\n className={styles.visuallyHidden}\n type=\"file\"\n aria-label=\"Add attachments\"\n accept={attachmentAccept}\n multiple\n disabled={isBusy}\n onChange={(event) => {\n if (event.target.files) onSelectAttachments(event.target.files);\n event.target.value = '';\n }}\n />\n )}\n {attachments && attachments.length > 0 && (\n <div className={styles.composerExtras}>\n <ul className={styles.attachmentList} aria-label=\"Attached files\">\n {attachments.map((attachment, index) => (\n <li key={index}>\n <AIChatAttachmentPreview name={attachment.name} size={attachment.size} staged\n imageUrl={attachment.previewUrl}\n onRemove={onRemoveAttachment ? () => onRemoveAttachment(index) : undefined} />\n </li>\n ))}\n </ul>\n </div>\n )}\n <div className={styles.composerSurface}>\n <div className={styles.composerRow}>\n {onSelectAttachments && (\n <button type=\"button\" className={styles.composerIconButton}\n aria-label=\"Attach file\" title=\"Attach file\"\n disabled={isBusy} onClick={() => fileInputRef.current?.click()}>\n <svg width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\"\n strokeWidth=\"1.8\" strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden=\"true\">\n <path d=\"m21 11-8.5 8.5a6 6 0 0 1-8.5-8.5l9-9a4 4 0 0 1 5.7 5.7l-9 9a2 2 0 0 1-2.8-2.8l8.5-8.5\" />\n </svg>\n </button>\n )}\n <textarea\n className={styles.input}\n aria-label={inputAriaLabel}\n rows={1}\n value={draft}\n onChange={(event) => onDraftChange?.(event.target.value)}\n onKeyDown={handleKeyDown}\n placeholder={inputPlaceholder}\n maxLength={inputMaxLength}\n disabled={isBusy || !onSend || !onDraftChange}\n readOnly={!onDraftChange}\n />\n <div className={styles.composerActions}>\n {composerTrailing}\n {isBusy ? (\n onStop && <button type=\"button\" className={styles.composerIconButton} onClick={onStop}\n aria-label=\"Stop response\" title=\"Stop response\">\n <svg width=\"18\" height=\"18\" viewBox=\"0 0 24 24\" fill=\"currentColor\" aria-hidden=\"true\"><rect x=\"5\" y=\"5\" width=\"14\" height=\"14\" rx=\"2\" /></svg>\n </button>\n ) : (\n <button type=\"submit\" className={styles.sendButton} aria-label=\"Send message\"\n title=\"Send message\" disabled={!onSend || (!draft.trim() && !attachments?.length)}>\n <svg width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"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["../src/components/ai-chat/AIChat.tsx"],"sourcesContent":["'use client';\n\nimport { useEffect, useMemo, useRef, useState } from 'react';\nimport type { CSSProperties, ComponentType, FormEvent, KeyboardEvent, ReactNode } from 'react';\n\nimport { AuiConfig, AuiProvider, ThreadPrimitive } from '@assistant-ui/react';\nimport { AISDKChat, AssistantChatTransport, useAISDKChat } from '@assistant-ui/ai-sdk';\n\nimport styles from './ai-chat.module.css';\n\ntype AIChatTransportOptions = NonNullable<ConstructorParameters<typeof AssistantChatTransport>[0]>;\n\nexport interface AIChatProps {\n /** AI SDK UI-message stream endpoint. */\n readonly api: string;\n /** Opaque scope identifier sent to the API. Server must authorize it. */\n readonly scope?: string;\n /** Human-readable display text; never used as an access-control identifier. */\n readonly scopeLabel?: string;\n /** Fetch adapter for authentication, request instrumentation and local demos. */\n readonly fetch?: typeof globalThis.fetch;\n readonly headers?: Record<string, string>;\n readonly credentials?: RequestCredentials;\n /** Customize serialized requests for APIs with a strict request schema. */\n readonly prepareSendMessagesRequest?: AIChatTransportOptions['prepareSendMessagesRequest'];\n /** Change this when the authenticated identity changes to reset the transcript. */\n readonly sessionKey?: string | number;\n /** Maximum number of user turns (default: 8). */\n readonly messageLimit?: number;\n readonly inputPlaceholder?: string;\n /** Accessible name for the message textarea. */\n readonly inputAriaLabel?: string;\n readonly inputMaxLength?: number;\n readonly components?: AIChatComponents;\n /** Actions displayed beside the native New chat control in one shared toolbar. */\n readonly toolbarActions?: ReactNode;\n /** When false, the enclosing AIChatDock owns the New chat control. */\n readonly showNewChatInToolbar?: boolean;\n /** Increment or replace this stable token to request the native New chat flow externally. */\n readonly newChatRequestKey?: string | number;\n /** Opt-in files, restricted to images/text accepted by the application API. */\n readonly attachments?: AIChatAttachmentOptions;\n /** Visible, accessible activity label while the assistant has not started answering. */\n readonly activityLabel?: string;\n /** Human-friendly labels for running tools, keyed by SDK tool name. */\n readonly toolActivityLabels?: Readonly<Record<string, string>>;\n /** Optional persistence; implementations must scope storage by user AND resource. */\n readonly history?: AIChatHistoryAdapter;\n /** Native SDK continuation predicate for tool approvals. */\n readonly sendAutomaticallyWhen?: NonNullable<Parameters<typeof AISDKChat>[0]>['sendAutomaticallyWhen'];\n readonly onClose?: () => void;\n readonly className?: string;\n readonly style?: CSSProperties;\n}\n\n/**\n * Framework-independent presentation contract. The parent owns the runtime,\n * message identities, approvals, uploads, history and security boundaries.\n * Uzi does not serialize, persist or reinterpret any messages supplied here.\n */\nexport type AIChatMessage = AIChatMessageRendererProps['message'];\n\nexport interface AIChatAttachmentOptions {\n readonly accept: string;\n readonly maxFiles?: number;\n readonly maxBytesPerFile?: number;\n}\n\nexport interface AIChatSelectedAttachment {\n readonly name: string;\n readonly size: number;\n /** Local thumbnail URL for supported image files. */\n readonly previewUrl?: string;\n}\n\nexport interface AIChatHistoryAdapter {\n /** Load only validated UI messages from the authenticated principal's own storage. */\n readonly load: () => Promise<readonly AIChatMessage[]> | readonly AIChatMessage[];\n /** Save after complete turns; the consumer decides what metadata is safe. */\n readonly save: (messages: readonly AIChatMessage[]) => Promise<void> | void;\n readonly clear: () => Promise<void> | void;\n /** Observability for failed history operations; never include message payloads in logs. */\n readonly onError?: (operation: 'load' | 'save' | 'clear', error: unknown) => void;\n}\n\nexport type AIChatToolApprovalHandler = (id: string, approved: boolean) => Promise<void> | void;\n\nexport interface AIChatViewProps {\n readonly messages: readonly AIChatMessage[];\n readonly status?: string;\n readonly activityLabel?: string;\n readonly toolActivityLabels?: Readonly<Record<string, string>>;\n readonly error?: Error | null;\n readonly draft?: string;\n readonly onDraftChange?: (draft: string) => void;\n readonly onSend?: () => void;\n readonly onStop?: () => void;\n readonly onRetry?: () => void;\n readonly onNewChat?: () => void;\n /** False when AIChatDock owns the new-chat action in its header. */\n readonly showNewChatInToolbar?: boolean;\n /** No limit by default: specialized apps decide their own session policy. */\n readonly messageLimit?: number;\n readonly inputPlaceholder?: string;\n readonly inputAriaLabel?: string;\n readonly inputMaxLength?: number;\n readonly components?: AIChatComponents;\n readonly attachments?: readonly AIChatSelectedAttachment[];\n readonly onSelectAttachments?: (files: FileList) => void;\n readonly onRemoveAttachment?: (index: number) => void;\n readonly attachmentAccept?: string;\n readonly attachmentError?: string | null;\n /** Only invoked from explicit user action on an approval-requested tool part. */\n readonly onToolApproval?: AIChatToolApprovalHandler;\n /** Custom message toolbar controls, e.g. a conversation selector. */\n readonly toolbarActions?: ReactNode;\n /** Context labels or other app-owned notices above the transcript. */\n readonly header?: ReactNode;\n /** Upload actions, attachment previews or context chips before the input. */\n readonly composerLeading?: ReactNode;\n /** Additional buttons beside the Send/Stop control. */\n readonly composerTrailing?: ReactNode;\n /** Completely replace the composer while retaining shared transcript chrome. */\n readonly composer?: ReactNode;\n readonly emptyState?: ReactNode;\n readonly className?: string;\n readonly style?: CSSProperties;\n}\n\nexport interface AIChatComponents {\n readonly MessageRenderer?: ComponentType<AIChatMessageRendererProps>;\n readonly ReasoningRenderer?: ComponentType<AIChatReasoningRendererProps>;\n readonly SourceRenderer?: ComponentType<AIChatSourceRendererProps>;\n readonly DataRenderer?: ComponentType<AIChatDataRendererProps>;\n readonly ToolRenderer?: ComponentType<AIChatToolRendererProps>;\n readonly ErrorRenderer?: ComponentType<AIChatErrorRendererProps>;\n}\n\nexport interface AIChatMessageRendererProps {\n readonly message: {\n readonly id: string;\n readonly role: 'user' | 'assistant';\n readonly parts: readonly unknown[];\n readonly metadata?: Record<string, unknown>;\n };\n readonly renderMessagePart: (part: Record<string, unknown>, index: number) => ReactNode;\n readonly onToolApproval?: AIChatToolApprovalHandler;\n}\n\nexport interface AIChatReasoningRendererProps {\n readonly children: string;\n readonly title?: string;\n}\n\nexport interface AIChatSource {\n readonly id: string;\n readonly title?: string;\n readonly url?: string;\n}\n\nexport interface AIChatSourceRendererProps {\n readonly sources: readonly AIChatSource[];\n readonly renderSource: (source: AIChatSource, index: number) => ReactNode;\n}\n\nexport interface AIChatDataRendererProps {\n readonly data: readonly Record<string, unknown>[];\n readonly renderDataItem: (item: Record<string, unknown>, index: number) => ReactNode;\n}\n\nexport interface AIChatToolRendererProps {\n readonly part: Record<string, unknown>;\n readonly name: string;\n readonly approvalId?: string;\n readonly onApprove?: () => void;\n readonly onDeny?: () => void;\n readonly approvalPending: boolean;\n}\n\nexport interface AIChatErrorRendererProps {\n readonly error: Error;\n readonly onRetry: () => void;\n readonly onClear: () => void;\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\nfunction asString(value: unknown): string | undefined {\n return typeof value === 'string' ? value : undefined;\n}\n\nfunction safeHttpUrl(value: unknown): string | undefined {\n const url = asString(value);\n return url && /^https?:\\/\\//i.test(url) ? url : undefined;\n}\n\n/** Allow only inert bitmap image data, never script-capable data or blob links from messages. */\nfunction safeImageUrl(value: unknown): string | undefined {\n const url = asString(value);\n return url && (/^https?:\\/\\//i.test(url) || /^data:image\\/(?:png|jpeg|gif|webp|avif);base64,/i.test(url))\n ? url : undefined;\n}\n\nfunction formatAttachmentSize(bytes: number): string {\n if (bytes < 1024) return `${bytes} B`;\n return bytes < 1024 * 1024 ? `${(bytes / 1024).toFixed(1)} KB` : `${(bytes / (1024 * 1024)).toFixed(1)} MB`;\n}\n\n/** Shared attachment surface for built-in Uzi chat and custom SDK runtimes. */\nexport interface AIChatAttachmentPreviewProps {\n readonly name: string;\n readonly size?: number;\n /** HTTP(S), safe bitmap data URI, or a local object URL when staged. */\n readonly imageUrl?: string;\n /** Optional HTTP(S) link for non-image files. */\n readonly href?: string;\n /** Compact composer chip rather than a history attachment. */\n readonly staged?: boolean;\n readonly onRemove?: () => void;\n /** Pass an SDK-owned remove button here when removal must be done by a primitive. */\n readonly removeControl?: ReactNode;\n}\n\n/** The same attachment surface is used for staged files and sent message parts. */\nexport function AIChatAttachmentPreview({ name, size, imageUrl, href, staged, onRemove, removeControl }: AIChatAttachmentPreviewProps) {\n const safePreviewUrl = imageUrl && (safeImageUrl(imageUrl) || (staged && /^blob:/i.test(imageUrl) ? imageUrl : undefined));\n const safeHref = safeHttpUrl(href);\n const dialogRef = useRef<HTMLDialogElement>(null);\n const previewButtonRef = useRef<HTMLButtonElement>(null);\n const [previewOpen, setPreviewOpen] = useState(false);\n\n useEffect(() => {\n if (previewOpen && dialogRef.current && !dialogRef.current.open) dialogRef.current.showModal?.();\n }, [previewOpen]);\n\n return (\n <div className={[styles.attachmentCard, staged ? styles.stagedAttachment : styles.sentAttachment,\n staged && !safePreviewUrl ? styles.stagedFileAttachment : '',\n safePreviewUrl && !staged ? styles.sentImageAttachment : ''].filter(Boolean).join(' ')}>\n {safePreviewUrl ? (\n <button ref={previewButtonRef} type=\"button\" className={styles.imageAttachmentButton}\n onClick={() => setPreviewOpen(true)} aria-label={`Preview ${name}`} title={`Preview ${name}`}>\n <img className={styles.attachmentThumbnail} src={safePreviewUrl} alt={name} loading=\"lazy\" />\n </button>\n ) : (\n <div className={styles.fileAttachment}>\n <svg aria-hidden=\"true\" width=\"22\" height=\"22\" viewBox=\"0 0 24 24\" fill=\"none\"\n stroke=\"currentColor\" strokeWidth=\"1.7\" strokeLinecap=\"round\" strokeLinejoin=\"round\">\n <path d=\"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8Z\" />\n <path d=\"M14 2v6h6M8 13h8M8 17h5\" />\n </svg>\n <span className={styles.fileAttachmentDetails}>\n {safeHref ? <a href={safeHref} target=\"_blank\" rel=\"noopener noreferrer\" title={name}>{name}</a>\n : <span title={name}>{name}</span>}\n {size !== undefined && <small>{formatAttachmentSize(size)}</small>}\n </span>\n </div>\n )}\n {removeControl && <span className={styles.removeAttachmentSlot}>{removeControl}</span>}\n {!removeControl && onRemove && (\n <button type=\"button\" className={styles.removeAttachment} onClick={onRemove}\n aria-label={`Remove ${name}`} title={`Remove ${name}`}>×</button>\n )}\n {previewOpen && safePreviewUrl && (\n <dialog ref={dialogRef} className={styles.attachmentDialog} aria-label={`Preview ${name}`}\n onClose={() => { setPreviewOpen(false); previewButtonRef.current?.focus(); }}\n onClick={(event) => { if (event.target === event.currentTarget) event.currentTarget.close(); }}>\n <div className={styles.attachmentDialogHeader}>\n <span title={name}>{name}</span>\n <button type=\"button\" onClick={() => dialogRef.current?.close()} aria-label=\"Close attachment preview\">×</button>\n </div>\n <img src={safePreviewUrl} alt={name} />\n </dialog>\n )}\n </div>\n );\n}\n\n/** Reusable role-aware message surface for domain renderers. */\nexport interface AIChatMessageBubbleProps {\n readonly role: 'user' | 'assistant';\n readonly label?: string;\n readonly children: ReactNode;\n readonly className?: string;\n}\n\nexport function AIChatMessageBubble({ role, label, children, className }: AIChatMessageBubbleProps) {\n return (\n <div className={[styles.messageBubble, role === 'user' ? styles.userMessage : styles.assistantMessage, className]\n .filter(Boolean).join(' ')} data-role={role}>\n {label && <span className={styles.messageLabel}>{label}</span>}\n {children}\n </div>\n );\n}\n\nfunction DefaultMessageRenderer({ message, renderMessagePart }: AIChatMessageRendererProps) {\n return (\n <AIChatMessageBubble role={message.role}>\n {message.parts.map((part, index) => (\n <div key={isRecord(part) && typeof part.id === 'string' ? part.id : index}>\n {isRecord(part) ? renderMessagePart(part, index) : null}\n </div>\n ))}\n </AIChatMessageBubble>\n );\n}\n\nfunction DefaultReasoningRenderer({ children, title = 'Reasoning' }: AIChatReasoningRendererProps) {\n return (\n <details className={styles.reasoning}>\n <summary className={styles.reasoningSummary}>{title}</summary>\n <p className={styles.reasoningText}>{children}</p>\n </details>\n );\n}\n\nfunction DefaultSourceRenderer({ sources, renderSource }: AIChatSourceRendererProps) {\n return (\n <div className={styles.sources}>\n <span className={styles.sourcesLabel}>Sources</span>\n <ul>\n {sources.map((source, index) => (\n <li key={source.id}>{renderSource(source, index)}</li>\n ))}\n </ul>\n </div>\n );\n}\n\nfunction DefaultDataRenderer({ data, renderDataItem }: AIChatDataRendererProps) {\n return (\n <div className={styles.data}>\n {data.map((item, index) => (\n <div key={index}>{renderDataItem(item, index)}</div>\n ))}\n </div>\n );\n}\n\nfunction DefaultErrorRenderer({ error, onRetry, onClear }: AIChatErrorRendererProps) {\n return (\n <div className={styles.error} role=\"alert\">\n <p>{error.message}</p>\n <div className={styles.errorActions}>\n <button type=\"button\" onClick={onRetry}>Retry response</button>\n <button type=\"button\" onClick={onClear}>Start new chat</button>\n </div>\n </div>\n );\n}\n\nfunction renderPart(\n part: Record<string, unknown>,\n index: number,\n components: AIChatComponents | undefined,\n onToolApproval?: AIChatToolApprovalHandler,\n pendingApprovalId?: string | null,\n): ReactNode {\n const type = asString(part.type) ?? '';\n if (type === 'step-start') return null;\n if (type === 'text') {\n return <span className={styles.textPart}>{asString(part.text) ?? ''}</span>;\n }\n if (type === 'reasoning') {\n const ReasoningRenderer = components?.ReasoningRenderer ?? DefaultReasoningRenderer;\n return <ReasoningRenderer>{asString(part.text) ?? ''}</ReasoningRenderer>;\n }\n if (type === 'source-url' || type === 'source-document') {\n const SourceRenderer = components?.SourceRenderer ?? DefaultSourceRenderer;\n const source: AIChatSource = {\n id: asString(part.sourceId) ?? asString(part.id) ?? `source-${index}`,\n title: asString(part.title) ?? asString(part.filename),\n url: safeHttpUrl(part.url),\n };\n return (\n <SourceRenderer\n sources={[source]}\n renderSource={(item) => item.url ? (\n <a href={item.url} target=\"_blank\" rel=\"noopener noreferrer\">\n {item.title ?? item.url}\n </a>\n ) : <span>{item.title ?? item.id}</span>}\n />\n );\n }\n if (type.startsWith('data-')) {\n const DataRenderer = components?.DataRenderer ?? DefaultDataRenderer;\n return (\n <DataRenderer\n data={[part]}\n renderDataItem={(item) => (\n <pre className={styles.structuredData}>{JSON.stringify(item.data ?? item, null, 2)}</pre>\n )}\n />\n );\n }\n if (type.startsWith('tool-') || type === 'dynamic-tool') {\n const name = asString(part.toolName) ?? type.replace(/^tool-/, '');\n const approval = isRecord(part.approval) ? asString(part.approval.id) : undefined;\n const approvalId = part.state === 'approval-requested' ? approval : undefined;\n const controlsDisabled = pendingApprovalId !== null && pendingApprovalId !== undefined;\n const ToolRenderer = components?.ToolRenderer;\n const props: AIChatToolRendererProps = {\n part, name, approvalId,\n approvalPending: controlsDisabled,\n ...(approvalId && onToolApproval ? {\n onApprove: () => { if (!controlsDisabled) void onToolApproval(approvalId, true); },\n onDeny: () => { if (!controlsDisabled) void onToolApproval(approvalId, false); },\n } : {}),\n };\n if (ToolRenderer) return <ToolRenderer {...props} />;\n return (\n <div className={styles.toolPart}>\n <details>\n <summary>{name}</summary>\n <pre className={styles.structuredData}>\n {JSON.stringify(part.output ?? part.input ?? part, null, 2)}\n </pre>\n </details>\n {approvalId && (\n <div className={styles.approvalActions} aria-label={`Approval required for ${name}`}>\n {props.onApprove && props.onDeny ? (\n <>\n <button type=\"button\" disabled={controlsDisabled} onClick={props.onApprove}>Approve</button>\n <button type=\"button\" disabled={controlsDisabled} onClick={props.onDeny}>Deny</button>\n </>\n ) : <span>Approval required in application</span>}\n </div>\n )}\n </div>\n );\n }\n if (type === 'file' || type === 'image') {\n const name = asString(part.filename) ?? asString(part.name) ?? 'Attachment';\n const mediaType = asString(part.mediaType) ?? asString(part.mimeType);\n const isImage = type === 'image' || /^image\\/(?:png|jpeg|gif|webp|avif)$/i.test(mediaType ?? '')\n || /\\.(?:png|jpe?g|gif|webp|avif)$/i.test(name);\n const imageUrl = isImage ? safeImageUrl(part.url) : undefined;\n return <AIChatAttachmentPreview name={name} imageUrl={imageUrl} href={safeHttpUrl(part.url)}\n size={typeof part.size === 'number' && part.size >= 0 ? part.size : undefined} />;\n }\n // Preserve unsupported part types as inspectable data instead of silently dropping them.\n return <pre className={styles.structuredData}>{JSON.stringify(part, null, 2)}</pre>;\n}\n\nconst DEFAULT_MESSAGE_LIMIT = 8;\n\nexport function AIChat({\n api,\n scope,\n scopeLabel,\n fetch: requestFetch,\n headers,\n credentials,\n prepareSendMessagesRequest,\n sessionKey,\n messageLimit = DEFAULT_MESSAGE_LIMIT,\n inputPlaceholder = 'Ask a question...',\n inputAriaLabel = 'Message',\n inputMaxLength = 2000,\n components,\n toolbarActions,\n showNewChatInToolbar = true,\n newChatRequestKey,\n attachments,\n activityLabel,\n toolActivityLabels,\n history,\n sendAutomaticallyWhen,\n onClose,\n className,\n style,\n}: AIChatProps) {\n // Remounting the provider creates a fresh AI SDK chat id, not merely an empty transcript.\n const [session, setSession] = useState(0);\n const transport = useMemo(\n () => new AssistantChatTransport({\n api,\n // The transport merges this with the AI SDK messages, id, model context and tools.\n // The endpoint, not the presentation component, must enforce the scope.\n ...(scope ? { body: { scope } } : {}),\n ...(requestFetch ? { fetch: requestFetch } : {}),\n ...(headers ? { headers } : {}),\n ...(credentials ? { credentials } : {}),\n ...(prepareSendMessagesRequest ? { prepareSendMessagesRequest } : {}),\n }),\n [api, scope, requestFetch, headers, credentials, prepareSendMessagesRequest],\n );\n const config = useMemo(\n () => AuiConfig({ threads: AISDKChat({ transport, ...(sendAutomaticallyWhen ? { sendAutomaticallyWhen } : {}) }) }),\n [transport, session, sendAutomaticallyWhen],\n );\n\n return (\n <div className={[styles.container, className].filter(Boolean).join(' ')} style={style}>\n {scopeLabel && (\n <div className={styles.scope}>\n <span className={styles.scopeLabel}>Current scope</span>\n <strong>{scopeLabel}</strong>\n </div>\n )}\n {onClose && (\n <button className={styles.closeBtn} type=\"button\" onClick={onClose} aria-label=\"Close chat\">\n ✕\n </button>\n )}\n <AuiProvider key={JSON.stringify([api, scope, sessionKey, session])} config={config}>\n <ThreadPrimitive.Root className={styles.thread}>\n <ChatViewport\n messageLimit={Number.isFinite(messageLimit) ? Math.max(1, Math.floor(messageLimit)) : DEFAULT_MESSAGE_LIMIT}\n inputPlaceholder={inputPlaceholder}\n inputAriaLabel={inputAriaLabel}\n inputMaxLength={inputMaxLength}\n components={components}\n toolbarActions={toolbarActions}\n showNewChatInToolbar={showNewChatInToolbar}\n newChatRequestKey={newChatRequestKey}\n attachmentOptions={attachments}\n activityLabel={activityLabel}\n toolActivityLabels={toolActivityLabels}\n history={history}\n onNewChat={() => setSession((previous) => previous + 1)}\n />\n </ThreadPrimitive.Root>\n </AuiProvider>\n </div>\n );\n}\n\ninterface ChatViewportProps {\n readonly messageLimit: number;\n readonly inputPlaceholder: string;\n readonly inputAriaLabel: string;\n readonly inputMaxLength: number;\n readonly components?: AIChatComponents;\n readonly toolbarActions?: ReactNode;\n readonly showNewChatInToolbar?: boolean;\n readonly newChatRequestKey?: string | number;\n readonly attachmentOptions?: AIChatAttachmentOptions;\n readonly activityLabel?: string;\n readonly toolActivityLabels?: Readonly<Record<string, string>>;\n readonly history?: AIChatHistoryAdapter;\n readonly onNewChat: () => void;\n}\n\nfunction ChatViewport({\n messageLimit,\n inputPlaceholder,\n inputAriaLabel,\n inputMaxLength,\n components,\n toolbarActions,\n showNewChatInToolbar,\n newChatRequestKey,\n attachmentOptions,\n activityLabel,\n toolActivityLabels,\n history,\n onNewChat,\n}: ChatViewportProps) {\n const chat = useAISDKChat();\n const [draft, setDraft] = useState('');\n const [selectedFiles, setSelectedFiles] = useState<File[]>([]);\n const [attachmentError, setAttachmentError] = useState<string | null>(null);\n const [attachmentPreviews, setAttachmentPreviews] = useState<string[]>([]);\n const [hydrated, setHydrated] = useState(!history);\n const expectedRestoredId = useRef<string | null>(null);\n const saveQueue = useRef<Promise<void>>(Promise.resolve());\n const [approvalBusy, setApprovalBusy] = useState(false);\n useEffect(() => {\n const urls = selectedFiles.map((file) => file.type.startsWith('image/') && typeof URL.createObjectURL === 'function' ? URL.createObjectURL(file) : '');\n setAttachmentPreviews(urls);\n return () => urls.forEach((url) => { if (url && typeof URL.revokeObjectURL === 'function') URL.revokeObjectURL(url); });\n }, [selectedFiles]);\n const messages = chat?.messages ?? [];\n const status = chat?.status ?? 'ready';\n const isBusy = status === 'submitted' || status === 'streaming';\n const historyFull = messages.filter((message) => message.role === 'user').length >= messageLimit;\n const reportHistoryError = (operation: 'load' | 'save' | 'clear', error: unknown) => {\n if (history?.onError) history.onError(operation, error);\n else console.warn(`[Uzi AIChat] History ${operation} failed`);\n };\n // Persist only complete turns. Do not save an empty runtime over stored history\n // during hydration or while a response is still streaming.\n useEffect(() => {\n if (!history) return;\n let active = true;\n void Promise.resolve().then(() => history.load()).then((restored) => {\n if (!active) return;\n if (Array.isArray(restored)) {\n const valid = restored.filter((message) =>\n typeof message?.id === 'string' &&\n (message.role === 'user' || message.role === 'assistant') &&\n Array.isArray(message.parts));\n expectedRestoredId.current = valid.length ? valid[0].id : null;\n if (valid.length) chat?.setMessages(valid as Parameters<NonNullable<typeof chat>['setMessages']>[0]);\n }\n setHydrated(true);\n }).catch((error: unknown) => {\n if (active) {\n reportHistoryError('load', error);\n setHydrated(true);\n }\n });\n return () => { active = false; };\n }, [chat?.setMessages, history]);\n\n useEffect(() => {\n if (!history || !hydrated || isBusy) return;\n const snapshot = messages.filter((message) => message.role === 'user' || message.role === 'assistant').map((message) => ({\n id: message.id, role: message.role as 'user' | 'assistant', parts: message.parts,\n ...(isRecord(message.metadata) ? { metadata: message.metadata } : {}),\n }));\n // Guard against the transient empty SDK state between history.load and\n // setMessages propagation; otherwise an old transcript could be erased.\n if (expectedRestoredId.current) {\n if (!snapshot.some((message) => message.id === expectedRestoredId.current)) return;\n expectedRestoredId.current = null;\n }\n // Serialize writes. New Chat waits for in-flight writes before clearing.\n saveQueue.current = saveQueue.current.then(\n () => history.save(snapshot),\n () => history.save(snapshot),\n ).then(\n () => {},\n (error: unknown) => { reportHistoryError('save', error); },\n );\n }, [history, hydrated, isBusy, messages]);\n\n const handleSelectedFiles = (files: FileList) => {\n if (!attachmentOptions) return;\n const selected = Array.from(files);\n if (selected.length + selectedFiles.length > (attachmentOptions.maxFiles ?? 3)) {\n setAttachmentError('Too many attachments.');\n return;\n }\n if (selected.some((file) => file.size > (attachmentOptions.maxBytesPerFile ?? 5 * 1024 * 1024))) {\n setAttachmentError('An attachment exceeds the size limit.');\n return;\n }\n const allowedTypes = attachmentOptions.accept.split(',').map((item) => item.trim());\n if (selected.some((file) => !allowedTypes.some((allow) => (\n allow === file.type || (allow.endsWith('/*') && file.type.startsWith(allow.slice(0, -1)))\n )))) {\n setAttachmentError('Unsupported attachment type.');\n return;\n }\n setAttachmentError(null);\n setSelectedFiles((existing) => [...existing, ...selected]);\n };\n\n const handleSubmit = () => {\n const text = draft.trim();\n if (!chat || (!text && selectedFiles.length === 0) || isBusy || historyFull || chat.error || !hydrated || approvalBusy) return;\n const files = selectedFiles.length ? new DataTransfer() : null;\n selectedFiles.forEach((file) => files?.items.add(file));\n // AI SDK serializes FileList to FileUIParts and sends them through the\n // app-owned transport. The server MUST validate types and sizes again.\n // Clear the composer promptly; restore the draft and files if submission\n // fails, so users do not lose attachments or typed content.\n const previousDraft = draft;\n const previousFiles = selectedFiles;\n setDraft('');\n setSelectedFiles([]);\n setAttachmentError(null);\n void Promise.resolve(chat.sendMessage({ text, ...(files ? { files: files.files } : {}) }))\n .catch(() => {\n setDraft((current) => current || previousDraft);\n setSelectedFiles((current) => current.length ? current : previousFiles);\n });\n };\n\n const handleNewChat = () => {\n void (async () => {\n await chat?.stop();\n if (history) {\n try {\n await saveQueue.current;\n await history.clear();\n } catch (error) {\n reportHistoryError('clear', error);\n return;\n }\n }\n onNewChat();\n })();\n };\n\n // An enclosing dock can reuse the native reset path without duplicating\n // history deletion, aborts, or SDK session management in each consumer.\n const lastNewChatRequestKey = useRef(newChatRequestKey);\n useEffect(() => {\n if (lastNewChatRequestKey.current === newChatRequestKey) return;\n lastNewChatRequestKey.current = newChatRequestKey;\n handleNewChat();\n }, [newChatRequestKey]);\n\n const handleRetry = () => {\n if (!chat || isBusy) return;\n chat.clearError();\n void chat.regenerate();\n };\n\n return (\n <AIChatView\n messages={messages.filter((message) => message.role === 'user' || message.role === 'assistant').map((message) => ({\n id: message.id,\n role: message.role as 'user' | 'assistant',\n parts: message.parts,\n ...(isRecord(message.metadata) ? { metadata: message.metadata } : {}),\n }))}\n status={status}\n activityLabel={activityLabel}\n toolActivityLabels={toolActivityLabels}\n error={chat?.error}\n draft={draft}\n onDraftChange={setDraft}\n onSend={handleSubmit}\n onStop={() => { void chat?.stop(); }}\n onRetry={handleRetry}\n onNewChat={handleNewChat}\n showNewChatInToolbar={showNewChatInToolbar}\n toolbarActions={toolbarActions}\n messageLimit={messageLimit}\n attachments={selectedFiles.map((file, index) => ({ name: file.name, size: file.size, ...(attachmentPreviews[index] ? { previewUrl: attachmentPreviews[index] } : {}) }))}\n onSelectAttachments={attachmentOptions ? handleSelectedFiles : undefined}\n onRemoveAttachment={attachmentOptions ? (index) => setSelectedFiles((files) => files.filter((_, i) => i !== index)) : undefined}\n attachmentAccept={attachmentOptions?.accept}\n attachmentError={attachmentError}\n onToolApproval={chat ? async (id, approved) => {\n if (approvalBusy) return;\n setApprovalBusy(true);\n try { await chat.addToolApprovalResponse({ id, approved, ...(!approved ? { reason: 'User denied approval' } : {}) }); }\n finally { setApprovalBusy(false); }\n } : undefined}\n inputPlaceholder={inputPlaceholder}\n inputAriaLabel={inputAriaLabel}\n inputMaxLength={inputMaxLength}\n components={components}\n />\n );\n}\n\n/**\n * Controlled chat presentation for apps with their own AI SDK/assistant-ui\n * runtime. It does not create providers, transports or chat state. Callbacks\n * are the only way messages/actions leave the view.\n */\nexport function AIChatView({\n messages,\n status = 'ready',\n activityLabel = 'Working on your response…',\n toolActivityLabels,\n error,\n draft = '',\n onDraftChange,\n onSend,\n onStop,\n onRetry,\n onNewChat,\n showNewChatInToolbar = true,\n messageLimit,\n inputPlaceholder = 'Ask a question...',\n inputAriaLabel = 'Message',\n inputMaxLength = 2000,\n components,\n attachments,\n onSelectAttachments,\n onRemoveAttachment,\n attachmentAccept,\n attachmentError,\n onToolApproval,\n toolbarActions,\n header,\n composerLeading,\n composerTrailing,\n composer,\n emptyState,\n className,\n style,\n}: AIChatViewProps) {\n const viewportRef = useRef<HTMLDivElement>(null);\n const pinnedToBottom = useRef(true);\n const fileInputRef = useRef<HTMLInputElement>(null);\n const approvalRef = useRef<string | null>(null);\n const [pendingApprovalId, setPendingApprovalId] = useState<string | null>(null);\n const [approvalError, setApprovalError] = useState<string | null>(null);\n const respondToApproval: AIChatToolApprovalHandler = async (id, approved) => {\n if (!onToolApproval || approvalRef.current) return;\n approvalRef.current = id;\n setPendingApprovalId(id);\n setApprovalError(null);\n try { await onToolApproval(id, approved); }\n catch { setApprovalError('Could not submit approval. Please try again.'); }\n finally { approvalRef.current = null; setPendingApprovalId(null); }\n };\n const isBusy = status === 'submitted' || status === 'streaming';\n const lastMessage = messages[messages.length - 1];\n const assistantParts = lastMessage?.role === 'assistant' ? lastMessage.parts.filter(isRecord) : [];\n const lastPart = [...assistantParts].reverse().find((part) => part.type !== 'step-start');\n const lastPartType = asString(lastPart?.type) ?? '';\n const activeTool = (lastPartType.startsWith('tool-') || lastPartType === 'dynamic-tool')\n && lastPart?.state !== 'output-available' && lastPart?.state !== 'output-error'\n ? lastPart : undefined;\n const hasAnswer = assistantParts.some((part) => part.type === 'text' && Boolean(asString(part.text)?.trim()));\n const showActivity = isBusy && (!hasAnswer || Boolean(activeTool));\n const toolName = asString(activeTool?.toolName) ?? lastPartType.replace(/^tool-/, '');\n const toolState = asString(activeTool?.state);\n const approval = activeTool?.approval;\n const approved = isRecord(approval) && approval.approved === true;\n const stateActivityLabel = toolState && (toolState !== 'approval-responded' || approved)\n ? toolActivityLabels?.[`${toolName}:${toolState}`] : undefined;\n const currentActivityLabel = toolState === 'approval-requested' ? 'Waiting for approval…'\n : toolState === 'approval-responded' && !approved ? 'Processing approval response…'\n : activeTool ? (stateActivityLabel ?? toolActivityLabels?.[toolName] ?? 'Using a tool…') : activityLabel;\n const limit = messageLimit != null && Number.isFinite(messageLimit)\n ? Math.max(1, Math.floor(messageLimit)) : null;\n const historyFull = limit !== null && messages.filter((message) => message.role === 'user').length >= limit;\n const MessageRenderer = components?.MessageRenderer ?? DefaultMessageRenderer;\n const ErrorRenderer = components?.ErrorRenderer ?? DefaultErrorRenderer;\n\n // Follow streaming text only if the user is already near the bottom.\n useEffect(() => {\n const viewport = viewportRef.current;\n if (viewport && pinnedToBottom.current) viewport.scrollTop = viewport.scrollHeight;\n });\n\n const handleKeyDown = (event: KeyboardEvent<HTMLTextAreaElement>) => {\n if (event.key === 'Enter' && !event.shiftKey && !event.nativeEvent.isComposing) {\n event.preventDefault();\n if (!isBusy && !historyFull && !error && (draft.trim() || (attachments?.length ?? 0) > 0)) onSend?.();\n }\n };\n\n const handleFormSubmit = (event: FormEvent<HTMLFormElement>) => {\n event.preventDefault();\n if (!isBusy && !historyFull && !error && (draft.trim() || (attachments?.length ?? 0) > 0)) onSend?.();\n };\n\n return (\n <div className={[styles.thread, className].filter(Boolean).join(' ')} style={style}>\n {header}\n {(toolbarActions || (showNewChatInToolbar && onNewChat && messages.length > 0)) && (\n <div className={styles.chatToolbar} role=\"toolbar\" aria-label=\"Conversation actions\">\n <div className={styles.chatToolbarExtras}>{toolbarActions}</div>\n {showNewChatInToolbar && onNewChat && messages.length > 0 && (\n <button\n type=\"button\"\n className={styles.newChatButton}\n onClick={onNewChat}\n aria-label=\"New chat\"\n title=\"New chat\"\n >\n <svg aria-hidden=\"true\" width=\"18\" height=\"18\" viewBox=\"0 0 24 24\" fill=\"none\"\n stroke=\"currentColor\" strokeWidth=\"1.8\" strokeLinecap=\"round\" strokeLinejoin=\"round\">\n <path d=\"M12 5H6a2 2 0 0 0-2 2v11a2 2 0 0 0 2 2h11a2 2 0 0 0 2-2v-6\" />\n <path d=\"m15 5 4 4M13 11l7-7a2.12 2.12 0 0 1 3 3l-7 7-4 1 1-4Z\" transform=\"translate(-2 -2)\" />\n </svg>\n </button>\n )}\n </div>\n )}\n <div\n ref={viewportRef}\n className={styles.viewport}\n onScroll={(event) => {\n const viewport = event.currentTarget;\n pinnedToBottom.current = viewport.scrollHeight - viewport.scrollTop - viewport.clientHeight < 80;\n }}\n >\n <div className={styles.messageList} role=\"log\" aria-label=\"Chat history\" aria-live=\"polite\">\n {messages.length === 0 && (\n <div className={styles.emptyState}>\n {emptyState ?? <p>Start a conversation</p>}\n </div>\n )}\n {messages.map((message) => (\n <MessageRenderer\n key={message.id}\n message={message}\n renderMessagePart={(part, index) => renderPart(part, index, components, onToolApproval ? respondToApproval : undefined, pendingApprovalId)}\n onToolApproval={onToolApproval ? respondToApproval : undefined}\n />\n ))}\n {showActivity && (\n <div className={styles.activityBubble} role=\"status\" aria-label={currentActivityLabel}>\n <span className={styles.activityDots} aria-hidden=\"true\"><i /><i /><i /></span>\n <span>{currentActivityLabel}</span>\n </div>\n )}\n {error && (\n onRetry && onNewChat ? (\n <ErrorRenderer error={error} onRetry={onRetry} onClear={onNewChat} />\n ) : (\n <div className={styles.error} role=\"alert\">\n <p>{error.message}</p>\n {(onRetry || onNewChat) && (\n <div className={styles.errorActions}>\n {onRetry && <button type=\"button\" onClick={onRetry}>Retry response</button>}\n {onNewChat && <button type=\"button\" onClick={onNewChat}>Start new chat</button>}\n </div>\n )}\n </div>\n )\n )}\n </div>\n </div>\n <div className={styles.footer}>\n {approvalError && <p role=\"alert\" className={styles.attachmentError}>{approvalError}</p>}\n {attachmentError && <p role=\"alert\" className={styles.attachmentError}>{attachmentError}</p>}\n {historyFull && !error && !isBusy && onNewChat && (\n <div className={styles.historyLimit}>\n <span>This chat has reached its {limit}-question limit.</span>\n <button type=\"button\" onClick={onNewChat}>Start new chat</button>\n </div>\n )}\n {(!historyFull || isBusy) && !error && (\n composer !== undefined ? composer : (\n <form className={styles.composerForm} onSubmit={handleFormSubmit}>\n {composerLeading && <div className={styles.composerExtras}>{composerLeading}</div>}\n {onSelectAttachments && (\n <input\n ref={fileInputRef}\n className={styles.visuallyHidden}\n type=\"file\"\n aria-label=\"Add attachments\"\n accept={attachmentAccept}\n multiple\n disabled={isBusy}\n onChange={(event) => {\n if (event.target.files) onSelectAttachments(event.target.files);\n event.target.value = '';\n }}\n />\n )}\n {attachments && attachments.length > 0 && (\n <div className={styles.composerExtras}>\n <ul className={styles.attachmentList} aria-label=\"Attached files\">\n {attachments.map((attachment, index) => (\n <li key={index}>\n <AIChatAttachmentPreview name={attachment.name} size={attachment.size} staged\n imageUrl={attachment.previewUrl}\n onRemove={onRemoveAttachment ? () => onRemoveAttachment(index) : undefined} />\n </li>\n ))}\n </ul>\n </div>\n )}\n <div className={styles.composerSurface}>\n <div className={styles.composerRow}>\n {onSelectAttachments && (\n <button type=\"button\" className={styles.composerIconButton}\n aria-label=\"Attach file\" title=\"Attach file\"\n disabled={isBusy} onClick={() => fileInputRef.current?.click()}>\n <svg width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\"\n strokeWidth=\"1.8\" strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden=\"true\">\n <path d=\"m21 11-8.5 8.5a6 6 0 0 1-8.5-8.5l9-9a4 4 0 0 1 5.7 5.7l-9 9a2 2 0 0 1-2.8-2.8l8.5-8.5\" />\n </svg>\n </button>\n )}\n <textarea\n className={styles.input}\n aria-label={inputAriaLabel}\n rows={1}\n value={draft}\n onChange={(event) => onDraftChange?.(event.target.value)}\n onKeyDown={handleKeyDown}\n placeholder={inputPlaceholder}\n maxLength={inputMaxLength}\n disabled={isBusy || !onSend || !onDraftChange}\n readOnly={!onDraftChange}\n />\n <div className={styles.composerActions}>\n {composerTrailing}\n {isBusy ? (\n onStop && <button type=\"button\" className={styles.composerIconButton} onClick={onStop}\n aria-label=\"Stop response\" title=\"Stop response\">\n <svg width=\"18\" height=\"18\" viewBox=\"0 0 24 24\" fill=\"currentColor\" aria-hidden=\"true\"><rect x=\"5\" y=\"5\" width=\"14\" height=\"14\" rx=\"2\" /></svg>\n </button>\n ) : (\n <button type=\"submit\" className={styles.sendButton} aria-label=\"Send message\"\n title=\"Send message\" disabled={!onSend || (!draft.trim() && !attachments?.length)}>\n <svg width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\"\n strokeWidth=\"2\" strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden=\"true\"><path d=\"M12 19V5m-7 7 7-7 7 7\" /></svg>\n </button>\n )}\n </div>\n </div>\n </div>\n </form>\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
CHANGED
|
@@ -38,7 +38,8 @@ function AIChatAttachmentPreview({ name, size, imageUrl, href, staged, onRemove,
|
|
|
38
38
|
className: [
|
|
39
39
|
require_ai_chat_module.default.attachmentCard,
|
|
40
40
|
staged ? require_ai_chat_module.default.stagedAttachment : require_ai_chat_module.default.sentAttachment,
|
|
41
|
-
staged && !safePreviewUrl ? require_ai_chat_module.default.stagedFileAttachment : ""
|
|
41
|
+
staged && !safePreviewUrl ? require_ai_chat_module.default.stagedFileAttachment : "",
|
|
42
|
+
safePreviewUrl && !staged ? require_ai_chat_module.default.sentImageAttachment : ""
|
|
42
43
|
].filter(Boolean).join(" "),
|
|
43
44
|
children: [
|
|
44
45
|
safePreviewUrl ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
@@ -81,11 +82,6 @@ function AIChatAttachmentPreview({ name, size, imageUrl, href, staged, onRemove,
|
|
|
81
82
|
}), size !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("small", { children: formatAttachmentSize(size) })]
|
|
82
83
|
})]
|
|
83
84
|
}),
|
|
84
|
-
safePreviewUrl && !staged && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
85
|
-
className: require_ai_chat_module.default.sentAttachmentName,
|
|
86
|
-
title: name,
|
|
87
|
-
children: name
|
|
88
|
-
}),
|
|
89
85
|
removeControl && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
90
86
|
className: require_ai_chat_module.default.removeAttachmentSlot,
|
|
91
87
|
children: removeControl
|
|
@@ -565,7 +561,10 @@ function AIChatView({ messages, status = "ready", activityLabel = "Working on yo
|
|
|
565
561
|
const hasAnswer = assistantParts.some((part) => part.type === "text" && Boolean(asString(part.text)?.trim()));
|
|
566
562
|
const showActivity = isBusy && (!hasAnswer || Boolean(activeTool));
|
|
567
563
|
const toolName = asString(activeTool?.toolName) ?? lastPartType.replace(/^tool-/, "");
|
|
568
|
-
const
|
|
564
|
+
const toolState = asString(activeTool?.state);
|
|
565
|
+
const approval = activeTool?.approval;
|
|
566
|
+
const approved = isRecord(approval) && approval.approved === true;
|
|
567
|
+
const currentActivityLabel = toolState === "approval-requested" ? "Waiting for approval…" : toolState === "approval-responded" && !approved ? "Processing approval response…" : activeTool ? (toolState && (toolState !== "approval-responded" || approved) ? toolActivityLabels?.[`${toolName}:${toolState}`] : void 0) ?? toolActivityLabels?.[toolName] ?? "Using a tool…" : activityLabel;
|
|
569
568
|
const limit = messageLimit != null && Number.isFinite(messageLimit) ? Math.max(1, Math.floor(messageLimit)) : null;
|
|
570
569
|
const historyFull = limit !== null && messages.filter((message) => message.role === "user").length >= limit;
|
|
571
570
|
const MessageRenderer = components?.MessageRenderer ?? DefaultMessageRenderer;
|
|
@@ -654,7 +653,27 @@ function AIChatView({ messages, status = "ready", activityLabel = "Working on yo
|
|
|
654
653
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("i", {})
|
|
655
654
|
]
|
|
656
655
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: currentActivityLabel })]
|
|
657
|
-
})
|
|
656
|
+
}),
|
|
657
|
+
error && (onRetry && onNewChat ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ErrorRenderer, {
|
|
658
|
+
error,
|
|
659
|
+
onRetry,
|
|
660
|
+
onClear: onNewChat
|
|
661
|
+
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
662
|
+
className: require_ai_chat_module.default.error,
|
|
663
|
+
role: "alert",
|
|
664
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", { children: error.message }), (onRetry || onNewChat) && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
665
|
+
className: require_ai_chat_module.default.errorActions,
|
|
666
|
+
children: [onRetry && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
667
|
+
type: "button",
|
|
668
|
+
onClick: onRetry,
|
|
669
|
+
children: "Retry response"
|
|
670
|
+
}), onNewChat && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
671
|
+
type: "button",
|
|
672
|
+
onClick: onNewChat,
|
|
673
|
+
children: "Start new chat"
|
|
674
|
+
})]
|
|
675
|
+
})]
|
|
676
|
+
}))
|
|
658
677
|
]
|
|
659
678
|
})
|
|
660
679
|
}),
|
|
@@ -671,26 +690,6 @@ function AIChatView({ messages, status = "ready", activityLabel = "Working on yo
|
|
|
671
690
|
className: require_ai_chat_module.default.attachmentError,
|
|
672
691
|
children: attachmentError
|
|
673
692
|
}),
|
|
674
|
-
error && (onRetry && onNewChat ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ErrorRenderer, {
|
|
675
|
-
error,
|
|
676
|
-
onRetry,
|
|
677
|
-
onClear: onNewChat
|
|
678
|
-
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
679
|
-
className: require_ai_chat_module.default.error,
|
|
680
|
-
role: "alert",
|
|
681
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", { children: error.message }), (onRetry || onNewChat) && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
682
|
-
className: require_ai_chat_module.default.errorActions,
|
|
683
|
-
children: [onRetry && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
684
|
-
type: "button",
|
|
685
|
-
onClick: onRetry,
|
|
686
|
-
children: "Retry response"
|
|
687
|
-
}), onNewChat && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
688
|
-
type: "button",
|
|
689
|
-
onClick: onNewChat,
|
|
690
|
-
children: "Start new chat"
|
|
691
|
-
})]
|
|
692
|
-
})]
|
|
693
|
-
})),
|
|
694
693
|
historyFull && !error && !isBusy && onNewChat && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
695
694
|
className: require_ai_chat_module.default.historyLimit,
|
|
696
695
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", { children: [
|
package/dist/index85.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index85.cjs","names":[],"sources":["../src/components/ai-chat/AIChat.tsx"],"sourcesContent":["'use client';\n\nimport { useEffect, useMemo, useRef, useState } from 'react';\nimport type { CSSProperties, ComponentType, FormEvent, KeyboardEvent, ReactNode } from 'react';\n\nimport { AuiConfig, AuiProvider, ThreadPrimitive } from '@assistant-ui/react';\nimport { AISDKChat, AssistantChatTransport, useAISDKChat } from '@assistant-ui/ai-sdk';\n\nimport styles from './ai-chat.module.css';\n\ntype AIChatTransportOptions = NonNullable<ConstructorParameters<typeof AssistantChatTransport>[0]>;\n\nexport interface AIChatProps {\n /** AI SDK UI-message stream endpoint. */\n readonly api: string;\n /** Opaque scope identifier sent to the API. Server must authorize it. */\n readonly scope?: string;\n /** Human-readable display text; never used as an access-control identifier. */\n readonly scopeLabel?: string;\n /** Fetch adapter for authentication, request instrumentation and local demos. */\n readonly fetch?: typeof globalThis.fetch;\n readonly headers?: Record<string, string>;\n readonly credentials?: RequestCredentials;\n /** Customize serialized requests for APIs with a strict request schema. */\n readonly prepareSendMessagesRequest?: AIChatTransportOptions['prepareSendMessagesRequest'];\n /** Change this when the authenticated identity changes to reset the transcript. */\n readonly sessionKey?: string | number;\n /** Maximum number of user turns (default: 8). */\n readonly messageLimit?: number;\n readonly inputPlaceholder?: string;\n /** Accessible name for the message textarea. */\n readonly inputAriaLabel?: string;\n readonly inputMaxLength?: number;\n readonly components?: AIChatComponents;\n /** Actions displayed beside the native New chat control in one shared toolbar. */\n readonly toolbarActions?: ReactNode;\n /** When false, the enclosing AIChatDock owns the New chat control. */\n readonly showNewChatInToolbar?: boolean;\n /** Increment or replace this stable token to request the native New chat flow externally. */\n readonly newChatRequestKey?: string | number;\n /** Opt-in files, restricted to images/text accepted by the application API. */\n readonly attachments?: AIChatAttachmentOptions;\n /** Visible, accessible activity label while the assistant has not started answering. */\n readonly activityLabel?: string;\n /** Human-friendly labels for running tools, keyed by SDK tool name. */\n readonly toolActivityLabels?: Readonly<Record<string, string>>;\n /** Optional persistence; implementations must scope storage by user AND resource. */\n readonly history?: AIChatHistoryAdapter;\n /** Native SDK continuation predicate for tool approvals. */\n readonly sendAutomaticallyWhen?: NonNullable<Parameters<typeof AISDKChat>[0]>['sendAutomaticallyWhen'];\n readonly onClose?: () => void;\n readonly className?: string;\n readonly style?: CSSProperties;\n}\n\n/**\n * Framework-independent presentation contract. The parent owns the runtime,\n * message identities, approvals, uploads, history and security boundaries.\n * Uzi does not serialize, persist or reinterpret any messages supplied here.\n */\nexport type AIChatMessage = AIChatMessageRendererProps['message'];\n\nexport interface AIChatAttachmentOptions {\n readonly accept: string;\n readonly maxFiles?: number;\n readonly maxBytesPerFile?: number;\n}\n\nexport interface AIChatSelectedAttachment {\n readonly name: string;\n readonly size: number;\n /** Local thumbnail URL for supported image files. */\n readonly previewUrl?: string;\n}\n\nexport interface AIChatHistoryAdapter {\n /** Load only validated UI messages from the authenticated principal's own storage. */\n readonly load: () => Promise<readonly AIChatMessage[]> | readonly AIChatMessage[];\n /** Save after complete turns; the consumer decides what metadata is safe. */\n readonly save: (messages: readonly AIChatMessage[]) => Promise<void> | void;\n readonly clear: () => Promise<void> | void;\n /** Observability for failed history operations; never include message payloads in logs. */\n readonly onError?: (operation: 'load' | 'save' | 'clear', error: unknown) => void;\n}\n\nexport type AIChatToolApprovalHandler = (id: string, approved: boolean) => Promise<void> | void;\n\nexport interface AIChatViewProps {\n readonly messages: readonly AIChatMessage[];\n readonly status?: string;\n readonly activityLabel?: string;\n readonly toolActivityLabels?: Readonly<Record<string, string>>;\n readonly error?: Error | null;\n readonly draft?: string;\n readonly onDraftChange?: (draft: string) => void;\n readonly onSend?: () => void;\n readonly onStop?: () => void;\n readonly onRetry?: () => void;\n readonly onNewChat?: () => void;\n /** False when AIChatDock owns the new-chat action in its header. */\n readonly showNewChatInToolbar?: boolean;\n /** No limit by default: specialized apps decide their own session policy. */\n readonly messageLimit?: number;\n readonly inputPlaceholder?: string;\n readonly inputAriaLabel?: string;\n readonly inputMaxLength?: number;\n readonly components?: AIChatComponents;\n readonly attachments?: readonly AIChatSelectedAttachment[];\n readonly onSelectAttachments?: (files: FileList) => void;\n readonly onRemoveAttachment?: (index: number) => void;\n readonly attachmentAccept?: string;\n readonly attachmentError?: string | null;\n /** Only invoked from explicit user action on an approval-requested tool part. */\n readonly onToolApproval?: AIChatToolApprovalHandler;\n /** Custom message toolbar controls, e.g. a conversation selector. */\n readonly toolbarActions?: ReactNode;\n /** Context labels or other app-owned notices above the transcript. */\n readonly header?: ReactNode;\n /** Upload actions, attachment previews or context chips before the input. */\n readonly composerLeading?: ReactNode;\n /** Additional buttons beside the Send/Stop control. */\n readonly composerTrailing?: ReactNode;\n /** Completely replace the composer while retaining shared transcript chrome. */\n readonly composer?: ReactNode;\n readonly emptyState?: ReactNode;\n readonly className?: string;\n readonly style?: CSSProperties;\n}\n\nexport interface AIChatComponents {\n readonly MessageRenderer?: ComponentType<AIChatMessageRendererProps>;\n readonly ReasoningRenderer?: ComponentType<AIChatReasoningRendererProps>;\n readonly SourceRenderer?: ComponentType<AIChatSourceRendererProps>;\n readonly DataRenderer?: ComponentType<AIChatDataRendererProps>;\n readonly ToolRenderer?: ComponentType<AIChatToolRendererProps>;\n readonly ErrorRenderer?: ComponentType<AIChatErrorRendererProps>;\n}\n\nexport interface AIChatMessageRendererProps {\n readonly message: {\n readonly id: string;\n readonly role: 'user' | 'assistant';\n readonly parts: readonly unknown[];\n readonly metadata?: Record<string, unknown>;\n };\n readonly renderMessagePart: (part: Record<string, unknown>, index: number) => ReactNode;\n readonly onToolApproval?: AIChatToolApprovalHandler;\n}\n\nexport interface AIChatReasoningRendererProps {\n readonly children: string;\n readonly title?: string;\n}\n\nexport interface AIChatSource {\n readonly id: string;\n readonly title?: string;\n readonly url?: string;\n}\n\nexport interface AIChatSourceRendererProps {\n readonly sources: readonly AIChatSource[];\n readonly renderSource: (source: AIChatSource, index: number) => ReactNode;\n}\n\nexport interface AIChatDataRendererProps {\n readonly data: readonly Record<string, unknown>[];\n readonly renderDataItem: (item: Record<string, unknown>, index: number) => ReactNode;\n}\n\nexport interface AIChatToolRendererProps {\n readonly part: Record<string, unknown>;\n readonly name: string;\n readonly approvalId?: string;\n readonly onApprove?: () => void;\n readonly onDeny?: () => void;\n readonly approvalPending: boolean;\n}\n\nexport interface AIChatErrorRendererProps {\n readonly error: Error;\n readonly onRetry: () => void;\n readonly onClear: () => void;\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\nfunction asString(value: unknown): string | undefined {\n return typeof value === 'string' ? value : undefined;\n}\n\nfunction safeHttpUrl(value: unknown): string | undefined {\n const url = asString(value);\n return url && /^https?:\\/\\//i.test(url) ? url : undefined;\n}\n\n/** Allow only inert bitmap image data, never script-capable data or blob links from messages. */\nfunction safeImageUrl(value: unknown): string | undefined {\n const url = asString(value);\n return url && (/^https?:\\/\\//i.test(url) || /^data:image\\/(?:png|jpeg|gif|webp|avif);base64,/i.test(url))\n ? url : undefined;\n}\n\nfunction formatAttachmentSize(bytes: number): string {\n if (bytes < 1024) return `${bytes} B`;\n return bytes < 1024 * 1024 ? `${(bytes / 1024).toFixed(1)} KB` : `${(bytes / (1024 * 1024)).toFixed(1)} MB`;\n}\n\n/** Shared attachment surface for built-in Uzi chat and custom SDK runtimes. */\nexport interface AIChatAttachmentPreviewProps {\n readonly name: string;\n readonly size?: number;\n /** HTTP(S), safe bitmap data URI, or a local object URL when staged. */\n readonly imageUrl?: string;\n /** Optional HTTP(S) link for non-image files. */\n readonly href?: string;\n /** Compact composer chip rather than a history attachment. */\n readonly staged?: boolean;\n readonly onRemove?: () => void;\n /** Pass an SDK-owned remove button here when removal must be done by a primitive. */\n readonly removeControl?: ReactNode;\n}\n\n/** The same attachment surface is used for staged files and sent message parts. */\nexport function AIChatAttachmentPreview({ name, size, imageUrl, href, staged, onRemove, removeControl }: AIChatAttachmentPreviewProps) {\n const safePreviewUrl = imageUrl && (safeImageUrl(imageUrl) || (staged && /^blob:/i.test(imageUrl) ? imageUrl : undefined));\n const safeHref = safeHttpUrl(href);\n const dialogRef = useRef<HTMLDialogElement>(null);\n const previewButtonRef = useRef<HTMLButtonElement>(null);\n const [previewOpen, setPreviewOpen] = useState(false);\n\n useEffect(() => {\n if (previewOpen && dialogRef.current && !dialogRef.current.open) dialogRef.current.showModal?.();\n }, [previewOpen]);\n\n return (\n <div className={[styles.attachmentCard, staged ? styles.stagedAttachment : styles.sentAttachment,\n staged && !safePreviewUrl ? styles.stagedFileAttachment : ''].filter(Boolean).join(' ')}>\n {safePreviewUrl ? (\n <button ref={previewButtonRef} type=\"button\" className={styles.imageAttachmentButton}\n onClick={() => setPreviewOpen(true)} aria-label={`Preview ${name}`} title={`Preview ${name}`}>\n <img className={styles.attachmentThumbnail} src={safePreviewUrl} alt={name} loading=\"lazy\" />\n </button>\n ) : (\n <div className={styles.fileAttachment}>\n <svg aria-hidden=\"true\" width=\"22\" height=\"22\" viewBox=\"0 0 24 24\" fill=\"none\"\n stroke=\"currentColor\" strokeWidth=\"1.7\" strokeLinecap=\"round\" strokeLinejoin=\"round\">\n <path d=\"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8Z\" />\n <path d=\"M14 2v6h6M8 13h8M8 17h5\" />\n </svg>\n <span className={styles.fileAttachmentDetails}>\n {safeHref ? <a href={safeHref} target=\"_blank\" rel=\"noopener noreferrer\" title={name}>{name}</a>\n : <span title={name}>{name}</span>}\n {size !== undefined && <small>{formatAttachmentSize(size)}</small>}\n </span>\n </div>\n )}\n {safePreviewUrl && !staged && <span className={styles.sentAttachmentName} title={name}>{name}</span>}\n {removeControl && <span className={styles.removeAttachmentSlot}>{removeControl}</span>}\n {!removeControl && onRemove && (\n <button type=\"button\" className={styles.removeAttachment} onClick={onRemove}\n aria-label={`Remove ${name}`} title={`Remove ${name}`}>×</button>\n )}\n {previewOpen && safePreviewUrl && (\n <dialog ref={dialogRef} className={styles.attachmentDialog} aria-label={`Preview ${name}`}\n onClose={() => { setPreviewOpen(false); previewButtonRef.current?.focus(); }}\n onClick={(event) => { if (event.target === event.currentTarget) event.currentTarget.close(); }}>\n <div className={styles.attachmentDialogHeader}>\n <span title={name}>{name}</span>\n <button type=\"button\" onClick={() => dialogRef.current?.close()} aria-label=\"Close attachment preview\">×</button>\n </div>\n <img src={safePreviewUrl} alt={name} />\n </dialog>\n )}\n </div>\n );\n}\n\n/** Reusable role-aware message surface for domain renderers. */\nexport interface AIChatMessageBubbleProps {\n readonly role: 'user' | 'assistant';\n readonly label?: string;\n readonly children: ReactNode;\n readonly className?: string;\n}\n\nexport function AIChatMessageBubble({ role, label, children, className }: AIChatMessageBubbleProps) {\n return (\n <div className={[styles.messageBubble, role === 'user' ? styles.userMessage : styles.assistantMessage, className]\n .filter(Boolean).join(' ')} data-role={role}>\n {label && <span className={styles.messageLabel}>{label}</span>}\n {children}\n </div>\n );\n}\n\nfunction DefaultMessageRenderer({ message, renderMessagePart }: AIChatMessageRendererProps) {\n return (\n <AIChatMessageBubble role={message.role}>\n {message.parts.map((part, index) => (\n <div key={isRecord(part) && typeof part.id === 'string' ? part.id : index}>\n {isRecord(part) ? renderMessagePart(part, index) : null}\n </div>\n ))}\n </AIChatMessageBubble>\n );\n}\n\nfunction DefaultReasoningRenderer({ children, title = 'Reasoning' }: AIChatReasoningRendererProps) {\n return (\n <details className={styles.reasoning}>\n <summary className={styles.reasoningSummary}>{title}</summary>\n <p className={styles.reasoningText}>{children}</p>\n </details>\n );\n}\n\nfunction DefaultSourceRenderer({ sources, renderSource }: AIChatSourceRendererProps) {\n return (\n <div className={styles.sources}>\n <span className={styles.sourcesLabel}>Sources</span>\n <ul>\n {sources.map((source, index) => (\n <li key={source.id}>{renderSource(source, index)}</li>\n ))}\n </ul>\n </div>\n );\n}\n\nfunction DefaultDataRenderer({ data, renderDataItem }: AIChatDataRendererProps) {\n return (\n <div className={styles.data}>\n {data.map((item, index) => (\n <div key={index}>{renderDataItem(item, index)}</div>\n ))}\n </div>\n );\n}\n\nfunction DefaultErrorRenderer({ error, onRetry, onClear }: AIChatErrorRendererProps) {\n return (\n <div className={styles.error} role=\"alert\">\n <p>{error.message}</p>\n <div className={styles.errorActions}>\n <button type=\"button\" onClick={onRetry}>Retry response</button>\n <button type=\"button\" onClick={onClear}>Start new chat</button>\n </div>\n </div>\n );\n}\n\nfunction renderPart(\n part: Record<string, unknown>,\n index: number,\n components: AIChatComponents | undefined,\n onToolApproval?: AIChatToolApprovalHandler,\n pendingApprovalId?: string | null,\n): ReactNode {\n const type = asString(part.type) ?? '';\n if (type === 'step-start') return null;\n if (type === 'text') {\n return <span className={styles.textPart}>{asString(part.text) ?? ''}</span>;\n }\n if (type === 'reasoning') {\n const ReasoningRenderer = components?.ReasoningRenderer ?? DefaultReasoningRenderer;\n return <ReasoningRenderer>{asString(part.text) ?? ''}</ReasoningRenderer>;\n }\n if (type === 'source-url' || type === 'source-document') {\n const SourceRenderer = components?.SourceRenderer ?? DefaultSourceRenderer;\n const source: AIChatSource = {\n id: asString(part.sourceId) ?? asString(part.id) ?? `source-${index}`,\n title: asString(part.title) ?? asString(part.filename),\n url: safeHttpUrl(part.url),\n };\n return (\n <SourceRenderer\n sources={[source]}\n renderSource={(item) => item.url ? (\n <a href={item.url} target=\"_blank\" rel=\"noopener noreferrer\">\n {item.title ?? item.url}\n </a>\n ) : <span>{item.title ?? item.id}</span>}\n />\n );\n }\n if (type.startsWith('data-')) {\n const DataRenderer = components?.DataRenderer ?? DefaultDataRenderer;\n return (\n <DataRenderer\n data={[part]}\n renderDataItem={(item) => (\n <pre className={styles.structuredData}>{JSON.stringify(item.data ?? item, null, 2)}</pre>\n )}\n />\n );\n }\n if (type.startsWith('tool-') || type === 'dynamic-tool') {\n const name = asString(part.toolName) ?? type.replace(/^tool-/, '');\n const approval = isRecord(part.approval) ? asString(part.approval.id) : undefined;\n const approvalId = part.state === 'approval-requested' ? approval : undefined;\n const controlsDisabled = pendingApprovalId !== null && pendingApprovalId !== undefined;\n const ToolRenderer = components?.ToolRenderer;\n const props: AIChatToolRendererProps = {\n part, name, approvalId,\n approvalPending: controlsDisabled,\n ...(approvalId && onToolApproval ? {\n onApprove: () => { if (!controlsDisabled) void onToolApproval(approvalId, true); },\n onDeny: () => { if (!controlsDisabled) void onToolApproval(approvalId, false); },\n } : {}),\n };\n if (ToolRenderer) return <ToolRenderer {...props} />;\n return (\n <div className={styles.toolPart}>\n <details>\n <summary>{name}</summary>\n <pre className={styles.structuredData}>\n {JSON.stringify(part.output ?? part.input ?? part, null, 2)}\n </pre>\n </details>\n {approvalId && (\n <div className={styles.approvalActions} aria-label={`Approval required for ${name}`}>\n {props.onApprove && props.onDeny ? (\n <>\n <button type=\"button\" disabled={controlsDisabled} onClick={props.onApprove}>Approve</button>\n <button type=\"button\" disabled={controlsDisabled} onClick={props.onDeny}>Deny</button>\n </>\n ) : <span>Approval required in application</span>}\n </div>\n )}\n </div>\n );\n }\n if (type === 'file' || type === 'image') {\n const name = asString(part.filename) ?? asString(part.name) ?? 'Attachment';\n const mediaType = asString(part.mediaType) ?? asString(part.mimeType);\n const isImage = type === 'image' || /^image\\/(?:png|jpeg|gif|webp|avif)$/i.test(mediaType ?? '')\n || /\\.(?:png|jpe?g|gif|webp|avif)$/i.test(name);\n const imageUrl = isImage ? safeImageUrl(part.url) : undefined;\n return <AIChatAttachmentPreview name={name} imageUrl={imageUrl} href={safeHttpUrl(part.url)}\n size={typeof part.size === 'number' && part.size >= 0 ? part.size : undefined} />;\n }\n // Preserve unsupported part types as inspectable data instead of silently dropping them.\n return <pre className={styles.structuredData}>{JSON.stringify(part, null, 2)}</pre>;\n}\n\nconst DEFAULT_MESSAGE_LIMIT = 8;\n\nexport function AIChat({\n api,\n scope,\n scopeLabel,\n fetch: requestFetch,\n headers,\n credentials,\n prepareSendMessagesRequest,\n sessionKey,\n messageLimit = DEFAULT_MESSAGE_LIMIT,\n inputPlaceholder = 'Ask a question...',\n inputAriaLabel = 'Message',\n inputMaxLength = 2000,\n components,\n toolbarActions,\n showNewChatInToolbar = true,\n newChatRequestKey,\n attachments,\n activityLabel,\n toolActivityLabels,\n history,\n sendAutomaticallyWhen,\n onClose,\n className,\n style,\n}: AIChatProps) {\n // Remounting the provider creates a fresh AI SDK chat id, not merely an empty transcript.\n const [session, setSession] = useState(0);\n const transport = useMemo(\n () => new AssistantChatTransport({\n api,\n // The transport merges this with the AI SDK messages, id, model context and tools.\n // The endpoint, not the presentation component, must enforce the scope.\n ...(scope ? { body: { scope } } : {}),\n ...(requestFetch ? { fetch: requestFetch } : {}),\n ...(headers ? { headers } : {}),\n ...(credentials ? { credentials } : {}),\n ...(prepareSendMessagesRequest ? { prepareSendMessagesRequest } : {}),\n }),\n [api, scope, requestFetch, headers, credentials, prepareSendMessagesRequest],\n );\n const config = useMemo(\n () => AuiConfig({ threads: AISDKChat({ transport, ...(sendAutomaticallyWhen ? { sendAutomaticallyWhen } : {}) }) }),\n [transport, session, sendAutomaticallyWhen],\n );\n\n return (\n <div className={[styles.container, className].filter(Boolean).join(' ')} style={style}>\n {scopeLabel && (\n <div className={styles.scope}>\n <span className={styles.scopeLabel}>Current scope</span>\n <strong>{scopeLabel}</strong>\n </div>\n )}\n {onClose && (\n <button className={styles.closeBtn} type=\"button\" onClick={onClose} aria-label=\"Close chat\">\n ✕\n </button>\n )}\n <AuiProvider key={JSON.stringify([api, scope, sessionKey, session])} config={config}>\n <ThreadPrimitive.Root className={styles.thread}>\n <ChatViewport\n messageLimit={Number.isFinite(messageLimit) ? Math.max(1, Math.floor(messageLimit)) : DEFAULT_MESSAGE_LIMIT}\n inputPlaceholder={inputPlaceholder}\n inputAriaLabel={inputAriaLabel}\n inputMaxLength={inputMaxLength}\n components={components}\n toolbarActions={toolbarActions}\n showNewChatInToolbar={showNewChatInToolbar}\n newChatRequestKey={newChatRequestKey}\n attachmentOptions={attachments}\n activityLabel={activityLabel}\n toolActivityLabels={toolActivityLabels}\n history={history}\n onNewChat={() => setSession((previous) => previous + 1)}\n />\n </ThreadPrimitive.Root>\n </AuiProvider>\n </div>\n );\n}\n\ninterface ChatViewportProps {\n readonly messageLimit: number;\n readonly inputPlaceholder: string;\n readonly inputAriaLabel: string;\n readonly inputMaxLength: number;\n readonly components?: AIChatComponents;\n readonly toolbarActions?: ReactNode;\n readonly showNewChatInToolbar?: boolean;\n readonly newChatRequestKey?: string | number;\n readonly attachmentOptions?: AIChatAttachmentOptions;\n readonly activityLabel?: string;\n readonly toolActivityLabels?: Readonly<Record<string, string>>;\n readonly history?: AIChatHistoryAdapter;\n readonly onNewChat: () => void;\n}\n\nfunction ChatViewport({\n messageLimit,\n inputPlaceholder,\n inputAriaLabel,\n inputMaxLength,\n components,\n toolbarActions,\n showNewChatInToolbar,\n newChatRequestKey,\n attachmentOptions,\n activityLabel,\n toolActivityLabels,\n history,\n onNewChat,\n}: ChatViewportProps) {\n const chat = useAISDKChat();\n const [draft, setDraft] = useState('');\n const [selectedFiles, setSelectedFiles] = useState<File[]>([]);\n const [attachmentError, setAttachmentError] = useState<string | null>(null);\n const [attachmentPreviews, setAttachmentPreviews] = useState<string[]>([]);\n const [hydrated, setHydrated] = useState(!history);\n const expectedRestoredId = useRef<string | null>(null);\n const saveQueue = useRef<Promise<void>>(Promise.resolve());\n const [approvalBusy, setApprovalBusy] = useState(false);\n useEffect(() => {\n const urls = selectedFiles.map((file) => file.type.startsWith('image/') && typeof URL.createObjectURL === 'function' ? URL.createObjectURL(file) : '');\n setAttachmentPreviews(urls);\n return () => urls.forEach((url) => { if (url && typeof URL.revokeObjectURL === 'function') URL.revokeObjectURL(url); });\n }, [selectedFiles]);\n const messages = chat?.messages ?? [];\n const status = chat?.status ?? 'ready';\n const isBusy = status === 'submitted' || status === 'streaming';\n const historyFull = messages.filter((message) => message.role === 'user').length >= messageLimit;\n const reportHistoryError = (operation: 'load' | 'save' | 'clear', error: unknown) => {\n if (history?.onError) history.onError(operation, error);\n else console.warn(`[Uzi AIChat] History ${operation} failed`);\n };\n // Persist only complete turns. Do not save an empty runtime over stored history\n // during hydration or while a response is still streaming.\n useEffect(() => {\n if (!history) return;\n let active = true;\n void Promise.resolve().then(() => history.load()).then((restored) => {\n if (!active) return;\n if (Array.isArray(restored)) {\n const valid = restored.filter((message) =>\n typeof message?.id === 'string' &&\n (message.role === 'user' || message.role === 'assistant') &&\n Array.isArray(message.parts));\n expectedRestoredId.current = valid.length ? valid[0].id : null;\n if (valid.length) chat?.setMessages(valid as Parameters<NonNullable<typeof chat>['setMessages']>[0]);\n }\n setHydrated(true);\n }).catch((error: unknown) => {\n if (active) {\n reportHistoryError('load', error);\n setHydrated(true);\n }\n });\n return () => { active = false; };\n }, [chat?.setMessages, history]);\n\n useEffect(() => {\n if (!history || !hydrated || isBusy) return;\n const snapshot = messages.filter((message) => message.role === 'user' || message.role === 'assistant').map((message) => ({\n id: message.id, role: message.role as 'user' | 'assistant', parts: message.parts,\n ...(isRecord(message.metadata) ? { metadata: message.metadata } : {}),\n }));\n // Guard against the transient empty SDK state between history.load and\n // setMessages propagation; otherwise an old transcript could be erased.\n if (expectedRestoredId.current) {\n if (!snapshot.some((message) => message.id === expectedRestoredId.current)) return;\n expectedRestoredId.current = null;\n }\n // Serialize writes. New Chat waits for in-flight writes before clearing.\n saveQueue.current = saveQueue.current.then(\n () => history.save(snapshot),\n () => history.save(snapshot),\n ).then(\n () => {},\n (error: unknown) => { reportHistoryError('save', error); },\n );\n }, [history, hydrated, isBusy, messages]);\n\n const handleSelectedFiles = (files: FileList) => {\n if (!attachmentOptions) return;\n const selected = Array.from(files);\n if (selected.length + selectedFiles.length > (attachmentOptions.maxFiles ?? 3)) {\n setAttachmentError('Too many attachments.');\n return;\n }\n if (selected.some((file) => file.size > (attachmentOptions.maxBytesPerFile ?? 5 * 1024 * 1024))) {\n setAttachmentError('An attachment exceeds the size limit.');\n return;\n }\n const allowedTypes = attachmentOptions.accept.split(',').map((item) => item.trim());\n if (selected.some((file) => !allowedTypes.some((allow) => (\n allow === file.type || (allow.endsWith('/*') && file.type.startsWith(allow.slice(0, -1)))\n )))) {\n setAttachmentError('Unsupported attachment type.');\n return;\n }\n setAttachmentError(null);\n setSelectedFiles((existing) => [...existing, ...selected]);\n };\n\n const handleSubmit = () => {\n const text = draft.trim();\n if (!chat || (!text && selectedFiles.length === 0) || isBusy || historyFull || chat.error || !hydrated || approvalBusy) return;\n const files = selectedFiles.length ? new DataTransfer() : null;\n selectedFiles.forEach((file) => files?.items.add(file));\n // AI SDK serializes FileList to FileUIParts and sends them through the\n // app-owned transport. The server MUST validate types and sizes again.\n // Clear the composer promptly; restore the draft and files if submission\n // fails, so users do not lose attachments or typed content.\n const previousDraft = draft;\n const previousFiles = selectedFiles;\n setDraft('');\n setSelectedFiles([]);\n setAttachmentError(null);\n void Promise.resolve(chat.sendMessage({ text, ...(files ? { files: files.files } : {}) }))\n .catch(() => {\n setDraft((current) => current || previousDraft);\n setSelectedFiles((current) => current.length ? current : previousFiles);\n });\n };\n\n const handleNewChat = () => {\n void (async () => {\n await chat?.stop();\n if (history) {\n try {\n await saveQueue.current;\n await history.clear();\n } catch (error) {\n reportHistoryError('clear', error);\n return;\n }\n }\n onNewChat();\n })();\n };\n\n // An enclosing dock can reuse the native reset path without duplicating\n // history deletion, aborts, or SDK session management in each consumer.\n const lastNewChatRequestKey = useRef(newChatRequestKey);\n useEffect(() => {\n if (lastNewChatRequestKey.current === newChatRequestKey) return;\n lastNewChatRequestKey.current = newChatRequestKey;\n handleNewChat();\n }, [newChatRequestKey]);\n\n const handleRetry = () => {\n if (!chat || isBusy) return;\n chat.clearError();\n void chat.regenerate();\n };\n\n return (\n <AIChatView\n messages={messages.filter((message) => message.role === 'user' || message.role === 'assistant').map((message) => ({\n id: message.id,\n role: message.role as 'user' | 'assistant',\n parts: message.parts,\n ...(isRecord(message.metadata) ? { metadata: message.metadata } : {}),\n }))}\n status={status}\n activityLabel={activityLabel}\n toolActivityLabels={toolActivityLabels}\n error={chat?.error}\n draft={draft}\n onDraftChange={setDraft}\n onSend={handleSubmit}\n onStop={() => { void chat?.stop(); }}\n onRetry={handleRetry}\n onNewChat={handleNewChat}\n showNewChatInToolbar={showNewChatInToolbar}\n toolbarActions={toolbarActions}\n messageLimit={messageLimit}\n attachments={selectedFiles.map((file, index) => ({ name: file.name, size: file.size, ...(attachmentPreviews[index] ? { previewUrl: attachmentPreviews[index] } : {}) }))}\n onSelectAttachments={attachmentOptions ? handleSelectedFiles : undefined}\n onRemoveAttachment={attachmentOptions ? (index) => setSelectedFiles((files) => files.filter((_, i) => i !== index)) : undefined}\n attachmentAccept={attachmentOptions?.accept}\n attachmentError={attachmentError}\n onToolApproval={chat ? async (id, approved) => {\n if (approvalBusy) return;\n setApprovalBusy(true);\n try { await chat.addToolApprovalResponse({ id, approved, ...(!approved ? { reason: 'User denied approval' } : {}) }); }\n finally { setApprovalBusy(false); }\n } : undefined}\n inputPlaceholder={inputPlaceholder}\n inputAriaLabel={inputAriaLabel}\n inputMaxLength={inputMaxLength}\n components={components}\n />\n );\n}\n\n/**\n * Controlled chat presentation for apps with their own AI SDK/assistant-ui\n * runtime. It does not create providers, transports or chat state. Callbacks\n * are the only way messages/actions leave the view.\n */\nexport function AIChatView({\n messages,\n status = 'ready',\n activityLabel = 'Working on your response…',\n toolActivityLabels,\n error,\n draft = '',\n onDraftChange,\n onSend,\n onStop,\n onRetry,\n onNewChat,\n showNewChatInToolbar = true,\n messageLimit,\n inputPlaceholder = 'Ask a question...',\n inputAriaLabel = 'Message',\n inputMaxLength = 2000,\n components,\n attachments,\n onSelectAttachments,\n onRemoveAttachment,\n attachmentAccept,\n attachmentError,\n onToolApproval,\n toolbarActions,\n header,\n composerLeading,\n composerTrailing,\n composer,\n emptyState,\n className,\n style,\n}: AIChatViewProps) {\n const viewportRef = useRef<HTMLDivElement>(null);\n const pinnedToBottom = useRef(true);\n const fileInputRef = useRef<HTMLInputElement>(null);\n const approvalRef = useRef<string | null>(null);\n const [pendingApprovalId, setPendingApprovalId] = useState<string | null>(null);\n const [approvalError, setApprovalError] = useState<string | null>(null);\n const respondToApproval: AIChatToolApprovalHandler = async (id, approved) => {\n if (!onToolApproval || approvalRef.current) return;\n approvalRef.current = id;\n setPendingApprovalId(id);\n setApprovalError(null);\n try { await onToolApproval(id, approved); }\n catch { setApprovalError('Could not submit approval. Please try again.'); }\n finally { approvalRef.current = null; setPendingApprovalId(null); }\n };\n const isBusy = status === 'submitted' || status === 'streaming';\n const lastMessage = messages[messages.length - 1];\n const assistantParts = lastMessage?.role === 'assistant' ? lastMessage.parts.filter(isRecord) : [];\n const lastPart = [...assistantParts].reverse().find((part) => part.type !== 'step-start');\n const lastPartType = asString(lastPart?.type) ?? '';\n const activeTool = (lastPartType.startsWith('tool-') || lastPartType === 'dynamic-tool')\n && lastPart?.state !== 'output-available' && lastPart?.state !== 'output-error'\n ? lastPart : undefined;\n const hasAnswer = assistantParts.some((part) => part.type === 'text' && Boolean(asString(part.text)?.trim()));\n const showActivity = isBusy && (!hasAnswer || Boolean(activeTool));\n const toolName = asString(activeTool?.toolName) ?? lastPartType.replace(/^tool-/, '');\n const currentActivityLabel = activeTool?.state === 'approval-requested' ? 'Waiting for approval…'\n : activeTool ? (toolActivityLabels?.[toolName] ?? 'Using a tool…') : activityLabel;\n const limit = messageLimit != null && Number.isFinite(messageLimit)\n ? Math.max(1, Math.floor(messageLimit)) : null;\n const historyFull = limit !== null && messages.filter((message) => message.role === 'user').length >= limit;\n const MessageRenderer = components?.MessageRenderer ?? DefaultMessageRenderer;\n const ErrorRenderer = components?.ErrorRenderer ?? DefaultErrorRenderer;\n\n // Follow streaming text only if the user is already near the bottom.\n useEffect(() => {\n const viewport = viewportRef.current;\n if (viewport && pinnedToBottom.current) viewport.scrollTop = viewport.scrollHeight;\n });\n\n const handleKeyDown = (event: KeyboardEvent<HTMLTextAreaElement>) => {\n if (event.key === 'Enter' && !event.shiftKey && !event.nativeEvent.isComposing) {\n event.preventDefault();\n if (!isBusy && !historyFull && !error && (draft.trim() || (attachments?.length ?? 0) > 0)) onSend?.();\n }\n };\n\n const handleFormSubmit = (event: FormEvent<HTMLFormElement>) => {\n event.preventDefault();\n if (!isBusy && !historyFull && !error && (draft.trim() || (attachments?.length ?? 0) > 0)) onSend?.();\n };\n\n return (\n <div className={[styles.thread, className].filter(Boolean).join(' ')} style={style}>\n {header}\n {(toolbarActions || (showNewChatInToolbar && onNewChat && messages.length > 0)) && (\n <div className={styles.chatToolbar} role=\"toolbar\" aria-label=\"Conversation actions\">\n <div className={styles.chatToolbarExtras}>{toolbarActions}</div>\n {showNewChatInToolbar && onNewChat && messages.length > 0 && (\n <button\n type=\"button\"\n className={styles.newChatButton}\n onClick={onNewChat}\n aria-label=\"New chat\"\n title=\"New chat\"\n >\n <svg aria-hidden=\"true\" width=\"18\" height=\"18\" viewBox=\"0 0 24 24\" fill=\"none\"\n stroke=\"currentColor\" strokeWidth=\"1.8\" strokeLinecap=\"round\" strokeLinejoin=\"round\">\n <path d=\"M12 5H6a2 2 0 0 0-2 2v11a2 2 0 0 0 2 2h11a2 2 0 0 0 2-2v-6\" />\n <path d=\"m15 5 4 4M13 11l7-7a2.12 2.12 0 0 1 3 3l-7 7-4 1 1-4Z\" transform=\"translate(-2 -2)\" />\n </svg>\n </button>\n )}\n </div>\n )}\n <div\n ref={viewportRef}\n className={styles.viewport}\n onScroll={(event) => {\n const viewport = event.currentTarget;\n pinnedToBottom.current = viewport.scrollHeight - viewport.scrollTop - viewport.clientHeight < 80;\n }}\n >\n <div className={styles.messageList} role=\"log\" aria-label=\"Chat history\" aria-live=\"polite\">\n {messages.length === 0 && (\n <div className={styles.emptyState}>\n {emptyState ?? <p>Start a conversation</p>}\n </div>\n )}\n {messages.map((message) => (\n <MessageRenderer\n key={message.id}\n message={message}\n renderMessagePart={(part, index) => renderPart(part, index, components, onToolApproval ? respondToApproval : undefined, pendingApprovalId)}\n onToolApproval={onToolApproval ? respondToApproval : undefined}\n />\n ))}\n {showActivity && (\n <div className={styles.activityBubble} role=\"status\" aria-label={currentActivityLabel}>\n <span className={styles.activityDots} aria-hidden=\"true\"><i /><i /><i /></span>\n <span>{currentActivityLabel}</span>\n </div>\n )}\n </div>\n </div>\n <div className={styles.footer}>\n {approvalError && <p role=\"alert\" className={styles.attachmentError}>{approvalError}</p>}\n {attachmentError && <p role=\"alert\" className={styles.attachmentError}>{attachmentError}</p>}\n {error && (\n onRetry && onNewChat ? (\n <ErrorRenderer error={error} onRetry={onRetry} onClear={onNewChat} />\n ) : (\n <div className={styles.error} role=\"alert\">\n <p>{error.message}</p>\n {(onRetry || onNewChat) && (\n <div className={styles.errorActions}>\n {onRetry && <button type=\"button\" onClick={onRetry}>Retry response</button>}\n {onNewChat && <button type=\"button\" onClick={onNewChat}>Start new chat</button>}\n </div>\n )}\n </div>\n )\n )}\n {historyFull && !error && !isBusy && onNewChat && (\n <div className={styles.historyLimit}>\n <span>This chat has reached its {limit}-question limit.</span>\n <button type=\"button\" onClick={onNewChat}>Start new chat</button>\n </div>\n )}\n {(!historyFull || isBusy) && !error && (\n composer !== undefined ? composer : (\n <form className={styles.composerForm} onSubmit={handleFormSubmit}>\n {composerLeading && <div className={styles.composerExtras}>{composerLeading}</div>}\n {onSelectAttachments && (\n <input\n ref={fileInputRef}\n className={styles.visuallyHidden}\n type=\"file\"\n aria-label=\"Add attachments\"\n accept={attachmentAccept}\n multiple\n disabled={isBusy}\n onChange={(event) => {\n if (event.target.files) onSelectAttachments(event.target.files);\n event.target.value = '';\n }}\n />\n )}\n {attachments && attachments.length > 0 && (\n <div className={styles.composerExtras}>\n <ul className={styles.attachmentList} aria-label=\"Attached files\">\n {attachments.map((attachment, index) => (\n <li key={index}>\n <AIChatAttachmentPreview name={attachment.name} size={attachment.size} staged\n imageUrl={attachment.previewUrl}\n onRemove={onRemoveAttachment ? () => onRemoveAttachment(index) : undefined} />\n </li>\n ))}\n </ul>\n </div>\n )}\n <div className={styles.composerSurface}>\n <div className={styles.composerRow}>\n {onSelectAttachments && (\n <button type=\"button\" className={styles.composerIconButton}\n aria-label=\"Attach file\" title=\"Attach file\"\n disabled={isBusy} onClick={() => fileInputRef.current?.click()}>\n <svg width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\"\n strokeWidth=\"1.8\" strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden=\"true\">\n <path d=\"m21 11-8.5 8.5a6 6 0 0 1-8.5-8.5l9-9a4 4 0 0 1 5.7 5.7l-9 9a2 2 0 0 1-2.8-2.8l8.5-8.5\" />\n </svg>\n </button>\n )}\n <textarea\n className={styles.input}\n aria-label={inputAriaLabel}\n rows={1}\n value={draft}\n onChange={(event) => onDraftChange?.(event.target.value)}\n onKeyDown={handleKeyDown}\n placeholder={inputPlaceholder}\n maxLength={inputMaxLength}\n disabled={isBusy || !onSend || !onDraftChange}\n readOnly={!onDraftChange}\n />\n <div className={styles.composerActions}>\n {composerTrailing}\n {isBusy ? (\n onStop && <button type=\"button\" className={styles.composerIconButton} onClick={onStop}\n aria-label=\"Stop response\" title=\"Stop response\">\n <svg width=\"18\" height=\"18\" viewBox=\"0 0 24 24\" fill=\"currentColor\" aria-hidden=\"true\"><rect x=\"5\" y=\"5\" width=\"14\" height=\"14\" rx=\"2\" /></svg>\n </button>\n ) : (\n <button type=\"submit\" className={styles.sendButton} aria-label=\"Send message\"\n title=\"Send message\" disabled={!onSend || (!draft.trim() && !attachments?.length)}>\n <svg width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\"\n strokeWidth=\"2\" strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden=\"true\"><path d=\"M12 19V5m-7 7 7-7 7 7\" /></svg>\n </button>\n )}\n </div>\n </div>\n </div>\n </form>\n )\n )}\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;;;AAyLA,SAAS,SAAS,OAAkD;CAClE,OAAO,OAAO,UAAU,YAAY,UAA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Memo, useRef, useState } from 'react';\nimport type { CSSProperties, ComponentType, FormEvent, KeyboardEvent, ReactNode } from 'react';\n\nimport { AuiConfig, AuiProvider, ThreadPrimitive } from '@assistant-ui/react';\nimport { AISDKChat, AssistantChatTransport, useAISDKChat } from '@assistant-ui/ai-sdk';\n\nimport styles from './ai-chat.module.css';\n\ntype AIChatTransportOptions = NonNullable<ConstructorParameters<typeof AssistantChatTransport>[0]>;\n\nexport interface AIChatProps {\n /** AI SDK UI-message stream endpoint. */\n readonly api: string;\n /** Opaque scope identifier sent to the API. Server must authorize it. */\n readonly scope?: string;\n /** Human-readable display text; never used as an access-control identifier. */\n readonly scopeLabel?: string;\n /** Fetch adapter for authentication, request instrumentation and local demos. */\n readonly fetch?: typeof globalThis.fetch;\n readonly headers?: Record<string, string>;\n readonly credentials?: RequestCredentials;\n /** Customize serialized requests for APIs with a strict request schema. */\n readonly prepareSendMessagesRequest?: AIChatTransportOptions['prepareSendMessagesRequest'];\n /** Change this when the authenticated identity changes to reset the transcript. */\n readonly sessionKey?: string | number;\n /** Maximum number of user turns (default: 8). */\n readonly messageLimit?: number;\n readonly inputPlaceholder?: string;\n /** Accessible name for the message textarea. */\n readonly inputAriaLabel?: string;\n readonly inputMaxLength?: number;\n readonly components?: AIChatComponents;\n /** Actions displayed beside the native New chat control in one shared toolbar. */\n readonly toolbarActions?: ReactNode;\n /** When false, the enclosing AIChatDock owns the New chat control. */\n readonly showNewChatInToolbar?: boolean;\n /** Increment or replace this stable token to request the native New chat flow externally. */\n readonly newChatRequestKey?: string | number;\n /** Opt-in files, restricted to images/text accepted by the application API. */\n readonly attachments?: AIChatAttachmentOptions;\n /** Visible, accessible activity label while the assistant has not started answering. */\n readonly activityLabel?: string;\n /** Human-friendly labels for running tools, keyed by SDK tool name. */\n readonly toolActivityLabels?: Readonly<Record<string, string>>;\n /** Optional persistence; implementations must scope storage by user AND resource. */\n readonly history?: AIChatHistoryAdapter;\n /** Native SDK continuation predicate for tool approvals. */\n readonly sendAutomaticallyWhen?: NonNullable<Parameters<typeof AISDKChat>[0]>['sendAutomaticallyWhen'];\n readonly onClose?: () => void;\n readonly className?: string;\n readonly style?: CSSProperties;\n}\n\n/**\n * Framework-independent presentation contract. The parent owns the runtime,\n * message identities, approvals, uploads, history and security boundaries.\n * Uzi does not serialize, persist or reinterpret any messages supplied here.\n */\nexport type AIChatMessage = AIChatMessageRendererProps['message'];\n\nexport interface AIChatAttachmentOptions {\n readonly accept: string;\n readonly maxFiles?: number;\n readonly maxBytesPerFile?: number;\n}\n\nexport interface AIChatSelectedAttachment {\n readonly name: string;\n readonly size: number;\n /** Local thumbnail URL for supported image files. */\n readonly previewUrl?: string;\n}\n\nexport interface AIChatHistoryAdapter {\n /** Load only validated UI messages from the authenticated principal's own storage. */\n readonly load: () => Promise<readonly AIChatMessage[]> | readonly AIChatMessage[];\n /** Save after complete turns; the consumer decides what metadata is safe. */\n readonly save: (messages: readonly AIChatMessage[]) => Promise<void> | void;\n readonly clear: () => Promise<void> | void;\n /** Observability for failed history operations; never include message payloads in logs. */\n readonly onError?: (operation: 'load' | 'save' | 'clear', error: unknown) => void;\n}\n\nexport type AIChatToolApprovalHandler = (id: string, approved: boolean) => Promise<void> | void;\n\nexport interface AIChatViewProps {\n readonly messages: readonly AIChatMessage[];\n readonly status?: string;\n readonly activityLabel?: string;\n readonly toolActivityLabels?: Readonly<Record<string, string>>;\n readonly error?: Error | null;\n readonly draft?: string;\n readonly onDraftChange?: (draft: string) => void;\n readonly onSend?: () => void;\n readonly onStop?: () => void;\n readonly onRetry?: () => void;\n readonly onNewChat?: () => void;\n /** False when AIChatDock owns the new-chat action in its header. */\n readonly showNewChatInToolbar?: boolean;\n /** No limit by default: specialized apps decide their own session policy. */\n readonly messageLimit?: number;\n readonly inputPlaceholder?: string;\n readonly inputAriaLabel?: string;\n readonly inputMaxLength?: number;\n readonly components?: AIChatComponents;\n readonly attachments?: readonly AIChatSelectedAttachment[];\n readonly onSelectAttachments?: (files: FileList) => void;\n readonly onRemoveAttachment?: (index: number) => void;\n readonly attachmentAccept?: string;\n readonly attachmentError?: string | null;\n /** Only invoked from explicit user action on an approval-requested tool part. */\n readonly onToolApproval?: AIChatToolApprovalHandler;\n /** Custom message toolbar controls, e.g. a conversation selector. */\n readonly toolbarActions?: ReactNode;\n /** Context labels or other app-owned notices above the transcript. */\n readonly header?: ReactNode;\n /** Upload actions, attachment previews or context chips before the input. */\n readonly composerLeading?: ReactNode;\n /** Additional buttons beside the Send/Stop control. */\n readonly composerTrailing?: ReactNode;\n /** Completely replace the composer while retaining shared transcript chrome. */\n readonly composer?: ReactNode;\n readonly emptyState?: ReactNode;\n readonly className?: string;\n readonly style?: CSSProperties;\n}\n\nexport interface AIChatComponents {\n readonly MessageRenderer?: ComponentType<AIChatMessageRendererProps>;\n readonly ReasoningRenderer?: ComponentType<AIChatReasoningRendererProps>;\n readonly SourceRenderer?: ComponentType<AIChatSourceRendererProps>;\n readonly DataRenderer?: ComponentType<AIChatDataRendererProps>;\n readonly ToolRenderer?: ComponentType<AIChatToolRendererProps>;\n readonly ErrorRenderer?: ComponentType<AIChatErrorRendererProps>;\n}\n\nexport interface AIChatMessageRendererProps {\n readonly message: {\n readonly id: string;\n readonly role: 'user' | 'assistant';\n readonly parts: readonly unknown[];\n readonly metadata?: Record<string, unknown>;\n };\n readonly renderMessagePart: (part: Record<string, unknown>, index: number) => ReactNode;\n readonly onToolApproval?: AIChatToolApprovalHandler;\n}\n\nexport interface AIChatReasoningRendererProps {\n readonly children: string;\n readonly title?: string;\n}\n\nexport interface AIChatSource {\n readonly id: string;\n readonly title?: string;\n readonly url?: string;\n}\n\nexport interface AIChatSourceRendererProps {\n readonly sources: readonly AIChatSource[];\n readonly renderSource: (source: AIChatSource, index: number) => ReactNode;\n}\n\nexport interface AIChatDataRendererProps {\n readonly data: readonly Record<string, unknown>[];\n readonly renderDataItem: (item: Record<string, unknown>, index: number) => ReactNode;\n}\n\nexport interface AIChatToolRendererProps {\n readonly part: Record<string, unknown>;\n readonly name: string;\n readonly approvalId?: string;\n readonly onApprove?: () => void;\n readonly onDeny?: () => void;\n readonly approvalPending: boolean;\n}\n\nexport interface AIChatErrorRendererProps {\n readonly error: Error;\n readonly onRetry: () => void;\n readonly onClear: () => void;\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\nfunction asString(value: unknown): string | undefined {\n return typeof value === 'string' ? value : undefined;\n}\n\nfunction safeHttpUrl(value: unknown): string | undefined {\n const url = asString(value);\n return url && /^https?:\\/\\//i.test(url) ? url : undefined;\n}\n\n/** Allow only inert bitmap image data, never script-capable data or blob links from messages. */\nfunction safeImageUrl(value: unknown): string | undefined {\n const url = asString(value);\n return url && (/^https?:\\/\\//i.test(url) || /^data:image\\/(?:png|jpeg|gif|webp|avif);base64,/i.test(url))\n ? url : undefined;\n}\n\nfunction formatAttachmentSize(bytes: number): string {\n if (bytes < 1024) return `${bytes} B`;\n return bytes < 1024 * 1024 ? `${(bytes / 1024).toFixed(1)} KB` : `${(bytes / (1024 * 1024)).toFixed(1)} MB`;\n}\n\n/** Shared attachment surface for built-in Uzi chat and custom SDK runtimes. */\nexport interface AIChatAttachmentPreviewProps {\n readonly name: string;\n readonly size?: number;\n /** HTTP(S), safe bitmap data URI, or a local object URL when staged. */\n readonly imageUrl?: string;\n /** Optional HTTP(S) link for non-image files. */\n readonly href?: string;\n /** Compact composer chip rather than a history attachment. */\n readonly staged?: boolean;\n readonly onRemove?: () => void;\n /** Pass an SDK-owned remove button here when removal must be done by a primitive. */\n readonly removeControl?: ReactNode;\n}\n\n/** The same attachment surface is used for staged files and sent message parts. */\nexport function AIChatAttachmentPreview({ name, size, imageUrl, href, staged, onRemove, removeControl }: AIChatAttachmentPreviewProps) {\n const safePreviewUrl = imageUrl && (safeImageUrl(imageUrl) || (staged && /^blob:/i.test(imageUrl) ? imageUrl : undefined));\n const safeHref = safeHttpUrl(href);\n const dialogRef = useRef<HTMLDialogElement>(null);\n const previewButtonRef = useRef<HTMLButtonElement>(null);\n const [previewOpen, setPreviewOpen] = useState(false);\n\n useEffect(() => {\n if (previewOpen && dialogRef.current && !dialogRef.current.open) dialogRef.current.showModal?.();\n }, [previewOpen]);\n\n return (\n <div className={[styles.attachmentCard, staged ? styles.stagedAttachment : styles.sentAttachment,\n staged && !safePreviewUrl ? styles.stagedFileAttachment : '',\n safePreviewUrl && !staged ? styles.sentImageAttachment : ''].filter(Boolean).join(' ')}>\n {safePreviewUrl ? (\n <button ref={previewButtonRef} type=\"button\" className={styles.imageAttachmentButton}\n onClick={() => setPreviewOpen(true)} aria-label={`Preview ${name}`} title={`Preview ${name}`}>\n <img className={styles.attachmentThumbnail} src={safePreviewUrl} alt={name} loading=\"lazy\" />\n </button>\n ) : (\n <div className={styles.fileAttachment}>\n <svg aria-hidden=\"true\" width=\"22\" height=\"22\" viewBox=\"0 0 24 24\" fill=\"none\"\n stroke=\"currentColor\" strokeWidth=\"1.7\" strokeLinecap=\"round\" strokeLinejoin=\"round\">\n <path d=\"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8Z\" />\n <path d=\"M14 2v6h6M8 13h8M8 17h5\" />\n </svg>\n <span className={styles.fileAttachmentDetails}>\n {safeHref ? <a href={safeHref} target=\"_blank\" rel=\"noopener noreferrer\" title={name}>{name}</a>\n : <span title={name}>{name}</span>}\n {size !== undefined && <small>{formatAttachmentSize(size)}</small>}\n </span>\n </div>\n )}\n {removeControl && <span className={styles.removeAttachmentSlot}>{removeControl}</span>}\n {!removeControl && onRemove && (\n <button type=\"button\" className={styles.removeAttachment} onClick={onRemove}\n aria-label={`Remove ${name}`} title={`Remove ${name}`}>×</button>\n )}\n {previewOpen && safePreviewUrl && (\n <dialog ref={dialogRef} className={styles.attachmentDialog} aria-label={`Preview ${name}`}\n onClose={() => { setPreviewOpen(false); previewButtonRef.current?.focus(); }}\n onClick={(event) => { if (event.target === event.currentTarget) event.currentTarget.close(); }}>\n <div className={styles.attachmentDialogHeader}>\n <span title={name}>{name}</span>\n <button type=\"button\" onClick={() => dialogRef.current?.close()} aria-label=\"Close attachment preview\">×</button>\n </div>\n <img src={safePreviewUrl} alt={name} />\n </dialog>\n )}\n </div>\n );\n}\n\n/** Reusable role-aware message surface for domain renderers. */\nexport interface AIChatMessageBubbleProps {\n readonly role: 'user' | 'assistant';\n readonly label?: string;\n readonly children: ReactNode;\n readonly className?: string;\n}\n\nexport function AIChatMessageBubble({ role, label, children, className }: AIChatMessageBubbleProps) {\n return (\n <div className={[styles.messageBubble, role === 'user' ? styles.userMessage : styles.assistantMessage, className]\n .filter(Boolean).join(' ')} data-role={role}>\n {label && <span className={styles.messageLabel}>{label}</span>}\n {children}\n </div>\n );\n}\n\nfunction DefaultMessageRenderer({ message, renderMessagePart }: AIChatMessageRendererProps) {\n return (\n <AIChatMessageBubble role={message.role}>\n {message.parts.map((part, index) => (\n <div key={isRecord(part) && typeof part.id === 'string' ? part.id : index}>\n {isRecord(part) ? renderMessagePart(part, index) : null}\n </div>\n ))}\n </AIChatMessageBubble>\n );\n}\n\nfunction DefaultReasoningRenderer({ children, title = 'Reasoning' }: AIChatReasoningRendererProps) {\n return (\n <details className={styles.reasoning}>\n <summary className={styles.reasoningSummary}>{title}</summary>\n <p className={styles.reasoningText}>{children}</p>\n </details>\n );\n}\n\nfunction DefaultSourceRenderer({ sources, renderSource }: AIChatSourceRendererProps) {\n return (\n <div className={styles.sources}>\n <span className={styles.sourcesLabel}>Sources</span>\n <ul>\n {sources.map((source, index) => (\n <li key={source.id}>{renderSource(source, index)}</li>\n ))}\n </ul>\n </div>\n );\n}\n\nfunction DefaultDataRenderer({ data, renderDataItem }: AIChatDataRendererProps) {\n return (\n <div className={styles.data}>\n {data.map((item, index) => (\n <div key={index}>{renderDataItem(item, index)}</div>\n ))}\n </div>\n );\n}\n\nfunction DefaultErrorRenderer({ error, onRetry, onClear }: AIChatErrorRendererProps) {\n return (\n <div className={styles.error} role=\"alert\">\n <p>{error.message}</p>\n <div className={styles.errorActions}>\n <button type=\"button\" onClick={onRetry}>Retry response</button>\n <button type=\"button\" onClick={onClear}>Start new chat</button>\n </div>\n </div>\n );\n}\n\nfunction renderPart(\n part: Record<string, unknown>,\n index: number,\n components: AIChatComponents | undefined,\n onToolApproval?: AIChatToolApprovalHandler,\n pendingApprovalId?: string | null,\n): ReactNode {\n const type = asString(part.type) ?? '';\n if (type === 'step-start') return null;\n if (type === 'text') {\n return <span className={styles.textPart}>{asString(part.text) ?? ''}</span>;\n }\n if (type === 'reasoning') {\n const ReasoningRenderer = components?.ReasoningRenderer ?? DefaultReasoningRenderer;\n return <ReasoningRenderer>{asString(part.text) ?? ''}</ReasoningRenderer>;\n }\n if (type === 'source-url' || type === 'source-document') {\n const SourceRenderer = components?.SourceRenderer ?? DefaultSourceRenderer;\n const source: AIChatSource = {\n id: asString(part.sourceId) ?? asString(part.id) ?? `source-${index}`,\n title: asString(part.title) ?? asString(part.filename),\n url: safeHttpUrl(part.url),\n };\n return (\n <SourceRenderer\n sources={[source]}\n renderSource={(item) => item.url ? (\n <a href={item.url} target=\"_blank\" rel=\"noopener noreferrer\">\n {item.title ?? item.url}\n </a>\n ) : <span>{item.title ?? item.id}</span>}\n />\n );\n }\n if (type.startsWith('data-')) {\n const DataRenderer = components?.DataRenderer ?? DefaultDataRenderer;\n return (\n <DataRenderer\n data={[part]}\n renderDataItem={(item) => (\n <pre className={styles.structuredData}>{JSON.stringify(item.data ?? item, null, 2)}</pre>\n )}\n />\n );\n }\n if (type.startsWith('tool-') || type === 'dynamic-tool') {\n const name = asString(part.toolName) ?? type.replace(/^tool-/, '');\n const approval = isRecord(part.approval) ? asString(part.approval.id) : undefined;\n const approvalId = part.state === 'approval-requested' ? approval : undefined;\n const controlsDisabled = pendingApprovalId !== null && pendingApprovalId !== undefined;\n const ToolRenderer = components?.ToolRenderer;\n const props: AIChatToolRendererProps = {\n part, name, approvalId,\n approvalPending: controlsDisabled,\n ...(approvalId && onToolApproval ? {\n onApprove: () => { if (!controlsDisabled) void onToolApproval(approvalId, true); },\n onDeny: () => { if (!controlsDisabled) void onToolApproval(approvalId, false); },\n } : {}),\n };\n if (ToolRenderer) return <ToolRenderer {...props} />;\n return (\n <div className={styles.toolPart}>\n <details>\n <summary>{name}</summary>\n <pre className={styles.structuredData}>\n {JSON.stringify(part.output ?? part.input ?? part, null, 2)}\n </pre>\n </details>\n {approvalId && (\n <div className={styles.approvalActions} aria-label={`Approval required for ${name}`}>\n {props.onApprove && props.onDeny ? (\n <>\n <button type=\"button\" disabled={controlsDisabled} onClick={props.onApprove}>Approve</button>\n <button type=\"button\" disabled={controlsDisabled} onClick={props.onDeny}>Deny</button>\n </>\n ) : <span>Approval required in application</span>}\n </div>\n )}\n </div>\n );\n }\n if (type === 'file' || type === 'image') {\n const name = asString(part.filename) ?? asString(part.name) ?? 'Attachment';\n const mediaType = asString(part.mediaType) ?? asString(part.mimeType);\n const isImage = type === 'image' || /^image\\/(?:png|jpeg|gif|webp|avif)$/i.test(mediaType ?? '')\n || /\\.(?:png|jpe?g|gif|webp|avif)$/i.test(name);\n const imageUrl = isImage ? safeImageUrl(part.url) : undefined;\n return <AIChatAttachmentPreview name={name} imageUrl={imageUrl} href={safeHttpUrl(part.url)}\n size={typeof part.size === 'number' && part.size >= 0 ? part.size : undefined} />;\n }\n // Preserve unsupported part types as inspectable data instead of silently dropping them.\n return <pre className={styles.structuredData}>{JSON.stringify(part, null, 2)}</pre>;\n}\n\nconst DEFAULT_MESSAGE_LIMIT = 8;\n\nexport function AIChat({\n api,\n scope,\n scopeLabel,\n fetch: requestFetch,\n headers,\n credentials,\n prepareSendMessagesRequest,\n sessionKey,\n messageLimit = DEFAULT_MESSAGE_LIMIT,\n inputPlaceholder = 'Ask a question...',\n inputAriaLabel = 'Message',\n inputMaxLength = 2000,\n components,\n toolbarActions,\n showNewChatInToolbar = true,\n newChatRequestKey,\n attachments,\n activityLabel,\n toolActivityLabels,\n history,\n sendAutomaticallyWhen,\n onClose,\n className,\n style,\n}: AIChatProps) {\n // Remounting the provider creates a fresh AI SDK chat id, not merely an empty transcript.\n const [session, setSession] = useState(0);\n const transport = useMemo(\n () => new AssistantChatTransport({\n api,\n // The transport merges this with the AI SDK messages, id, model context and tools.\n // The endpoint, not the presentation component, must enforce the scope.\n ...(scope ? { body: { scope } } : {}),\n ...(requestFetch ? { fetch: requestFetch } : {}),\n ...(headers ? { headers } : {}),\n ...(credentials ? { credentials } : {}),\n ...(prepareSendMessagesRequest ? { prepareSendMessagesRequest } : {}),\n }),\n [api, scope, requestFetch, headers, credentials, prepareSendMessagesRequest],\n );\n const config = useMemo(\n () => AuiConfig({ threads: AISDKChat({ transport, ...(sendAutomaticallyWhen ? { sendAutomaticallyWhen } : {}) }) }),\n [transport, session, sendAutomaticallyWhen],\n );\n\n return (\n <div className={[styles.container, className].filter(Boolean).join(' ')} style={style}>\n {scopeLabel && (\n <div className={styles.scope}>\n <span className={styles.scopeLabel}>Current scope</span>\n <strong>{scopeLabel}</strong>\n </div>\n )}\n {onClose && (\n <button className={styles.closeBtn} type=\"button\" onClick={onClose} aria-label=\"Close chat\">\n ✕\n </button>\n )}\n <AuiProvider key={JSON.stringify([api, scope, sessionKey, session])} config={config}>\n <ThreadPrimitive.Root className={styles.thread}>\n <ChatViewport\n messageLimit={Number.isFinite(messageLimit) ? Math.max(1, Math.floor(messageLimit)) : DEFAULT_MESSAGE_LIMIT}\n inputPlaceholder={inputPlaceholder}\n inputAriaLabel={inputAriaLabel}\n inputMaxLength={inputMaxLength}\n components={components}\n toolbarActions={toolbarActions}\n showNewChatInToolbar={showNewChatInToolbar}\n newChatRequestKey={newChatRequestKey}\n attachmentOptions={attachments}\n activityLabel={activityLabel}\n toolActivityLabels={toolActivityLabels}\n history={history}\n onNewChat={() => setSession((previous) => previous + 1)}\n />\n </ThreadPrimitive.Root>\n </AuiProvider>\n </div>\n );\n}\n\ninterface ChatViewportProps {\n readonly messageLimit: number;\n readonly inputPlaceholder: string;\n readonly inputAriaLabel: string;\n readonly inputMaxLength: number;\n readonly components?: AIChatComponents;\n readonly toolbarActions?: ReactNode;\n readonly showNewChatInToolbar?: boolean;\n readonly newChatRequestKey?: string | number;\n readonly attachmentOptions?: AIChatAttachmentOptions;\n readonly activityLabel?: string;\n readonly toolActivityLabels?: Readonly<Record<string, string>>;\n readonly history?: AIChatHistoryAdapter;\n readonly onNewChat: () => void;\n}\n\nfunction ChatViewport({\n messageLimit,\n inputPlaceholder,\n inputAriaLabel,\n inputMaxLength,\n components,\n toolbarActions,\n showNewChatInToolbar,\n newChatRequestKey,\n attachmentOptions,\n activityLabel,\n toolActivityLabels,\n history,\n onNewChat,\n}: ChatViewportProps) {\n const chat = useAISDKChat();\n const [draft, setDraft] = useState('');\n const [selectedFiles, setSelectedFiles] = useState<File[]>([]);\n const [attachmentError, setAttachmentError] = useState<string | null>(null);\n const [attachmentPreviews, setAttachmentPreviews] = useState<string[]>([]);\n const [hydrated, setHydrated] = useState(!history);\n const expectedRestoredId = useRef<string | null>(null);\n const saveQueue = useRef<Promise<void>>(Promise.resolve());\n const [approvalBusy, setApprovalBusy] = useState(false);\n useEffect(() => {\n const urls = selectedFiles.map((file) => file.type.startsWith('image/') && typeof URL.createObjectURL === 'function' ? URL.createObjectURL(file) : '');\n setAttachmentPreviews(urls);\n return () => urls.forEach((url) => { if (url && typeof URL.revokeObjectURL === 'function') URL.revokeObjectURL(url); });\n }, [selectedFiles]);\n const messages = chat?.messages ?? [];\n const status = chat?.status ?? 'ready';\n const isBusy = status === 'submitted' || status === 'streaming';\n const historyFull = messages.filter((message) => message.role === 'user').length >= messageLimit;\n const reportHistoryError = (operation: 'load' | 'save' | 'clear', error: unknown) => {\n if (history?.onError) history.onError(operation, error);\n else console.warn(`[Uzi AIChat] History ${operation} failed`);\n };\n // Persist only complete turns. Do not save an empty runtime over stored history\n // during hydration or while a response is still streaming.\n useEffect(() => {\n if (!history) return;\n let active = true;\n void Promise.resolve().then(() => history.load()).then((restored) => {\n if (!active) return;\n if (Array.isArray(restored)) {\n const valid = restored.filter((message) =>\n typeof message?.id === 'string' &&\n (message.role === 'user' || message.role === 'assistant') &&\n Array.isArray(message.parts));\n expectedRestoredId.current = valid.length ? valid[0].id : null;\n if (valid.length) chat?.setMessages(valid as Parameters<NonNullable<typeof chat>['setMessages']>[0]);\n }\n setHydrated(true);\n }).catch((error: unknown) => {\n if (active) {\n reportHistoryError('load', error);\n setHydrated(true);\n }\n });\n return () => { active = false; };\n }, [chat?.setMessages, history]);\n\n useEffect(() => {\n if (!history || !hydrated || isBusy) return;\n const snapshot = messages.filter((message) => message.role === 'user' || message.role === 'assistant').map((message) => ({\n id: message.id, role: message.role as 'user' | 'assistant', parts: message.parts,\n ...(isRecord(message.metadata) ? { metadata: message.metadata } : {}),\n }));\n // Guard against the transient empty SDK state between history.load and\n // setMessages propagation; otherwise an old transcript could be erased.\n if (expectedRestoredId.current) {\n if (!snapshot.some((message) => message.id === expectedRestoredId.current)) return;\n expectedRestoredId.current = null;\n }\n // Serialize writes. New Chat waits for in-flight writes before clearing.\n saveQueue.current = saveQueue.current.then(\n () => history.save(snapshot),\n () => history.save(snapshot),\n ).then(\n () => {},\n (error: unknown) => { reportHistoryError('save', error); },\n );\n }, [history, hydrated, isBusy, messages]);\n\n const handleSelectedFiles = (files: FileList) => {\n if (!attachmentOptions) return;\n const selected = Array.from(files);\n if (selected.length + selectedFiles.length > (attachmentOptions.maxFiles ?? 3)) {\n setAttachmentError('Too many attachments.');\n return;\n }\n if (selected.some((file) => file.size > (attachmentOptions.maxBytesPerFile ?? 5 * 1024 * 1024))) {\n setAttachmentError('An attachment exceeds the size limit.');\n return;\n }\n const allowedTypes = attachmentOptions.accept.split(',').map((item) => item.trim());\n if (selected.some((file) => !allowedTypes.some((allow) => (\n allow === file.type || (allow.endsWith('/*') && file.type.startsWith(allow.slice(0, -1)))\n )))) {\n setAttachmentError('Unsupported attachment type.');\n return;\n }\n setAttachmentError(null);\n setSelectedFiles((existing) => [...existing, ...selected]);\n };\n\n const handleSubmit = () => {\n const text = draft.trim();\n if (!chat || (!text && selectedFiles.length === 0) || isBusy || historyFull || chat.error || !hydrated || approvalBusy) return;\n const files = selectedFiles.length ? new DataTransfer() : null;\n selectedFiles.forEach((file) => files?.items.add(file));\n // AI SDK serializes FileList to FileUIParts and sends them through the\n // app-owned transport. The server MUST validate types and sizes again.\n // Clear the composer promptly; restore the draft and files if submission\n // fails, so users do not lose attachments or typed content.\n const previousDraft = draft;\n const previousFiles = selectedFiles;\n setDraft('');\n setSelectedFiles([]);\n setAttachmentError(null);\n void Promise.resolve(chat.sendMessage({ text, ...(files ? { files: files.files } : {}) }))\n .catch(() => {\n setDraft((current) => current || previousDraft);\n setSelectedFiles((current) => current.length ? current : previousFiles);\n });\n };\n\n const handleNewChat = () => {\n void (async () => {\n await chat?.stop();\n if (history) {\n try {\n await saveQueue.current;\n await history.clear();\n } catch (error) {\n reportHistoryError('clear', error);\n return;\n }\n }\n onNewChat();\n })();\n };\n\n // An enclosing dock can reuse the native reset path without duplicating\n // history deletion, aborts, or SDK session management in each consumer.\n const lastNewChatRequestKey = useRef(newChatRequestKey);\n useEffect(() => {\n if (lastNewChatRequestKey.current === newChatRequestKey) return;\n lastNewChatRequestKey.current = newChatRequestKey;\n handleNewChat();\n }, [newChatRequestKey]);\n\n const handleRetry = () => {\n if (!chat || isBusy) return;\n chat.clearError();\n void chat.regenerate();\n };\n\n return (\n <AIChatView\n messages={messages.filter((message) => message.role === 'user' || message.role === 'assistant').map((message) => ({\n id: message.id,\n role: message.role as 'user' | 'assistant',\n parts: message.parts,\n ...(isRecord(message.metadata) ? { metadata: message.metadata } : {}),\n }))}\n status={status}\n activityLabel={activityLabel}\n toolActivityLabels={toolActivityLabels}\n error={chat?.error}\n draft={draft}\n onDraftChange={setDraft}\n onSend={handleSubmit}\n onStop={() => { void chat?.stop(); }}\n onRetry={handleRetry}\n onNewChat={handleNewChat}\n showNewChatInToolbar={showNewChatInToolbar}\n toolbarActions={toolbarActions}\n messageLimit={messageLimit}\n attachments={selectedFiles.map((file, index) => ({ name: file.name, size: file.size, ...(attachmentPreviews[index] ? { previewUrl: attachmentPreviews[index] } : {}) }))}\n onSelectAttachments={attachmentOptions ? handleSelectedFiles : undefined}\n onRemoveAttachment={attachmentOptions ? (index) => setSelectedFiles((files) => files.filter((_, i) => i !== index)) : undefined}\n attachmentAccept={attachmentOptions?.accept}\n attachmentError={attachmentError}\n onToolApproval={chat ? async (id, approved) => {\n if (approvalBusy) return;\n setApprovalBusy(true);\n try { await chat.addToolApprovalResponse({ id, approved, ...(!approved ? { reason: 'User denied approval' } : {}) }); }\n finally { setApprovalBusy(false); }\n } : undefined}\n inputPlaceholder={inputPlaceholder}\n inputAriaLabel={inputAriaLabel}\n inputMaxLength={inputMaxLength}\n components={components}\n />\n );\n}\n\n/**\n * Controlled chat presentation for apps with their own AI SDK/assistant-ui\n * runtime. It does not create providers, transports or chat state. Callbacks\n * are the only way messages/actions leave the view.\n */\nexport function AIChatView({\n messages,\n status = 'ready',\n activityLabel = 'Working on your response…',\n toolActivityLabels,\n error,\n draft = '',\n onDraftChange,\n onSend,\n onStop,\n onRetry,\n onNewChat,\n showNewChatInToolbar = true,\n messageLimit,\n inputPlaceholder = 'Ask a question...',\n inputAriaLabel = 'Message',\n inputMaxLength = 2000,\n components,\n attachments,\n onSelectAttachments,\n onRemoveAttachment,\n attachmentAccept,\n attachmentError,\n onToolApproval,\n toolbarActions,\n header,\n composerLeading,\n composerTrailing,\n composer,\n emptyState,\n className,\n style,\n}: AIChatViewProps) {\n const viewportRef = useRef<HTMLDivElement>(null);\n const pinnedToBottom = useRef(true);\n const fileInputRef = useRef<HTMLInputElement>(null);\n const approvalRef = useRef<string | null>(null);\n const [pendingApprovalId, setPendingApprovalId] = useState<string | null>(null);\n const [approvalError, setApprovalError] = useState<string | null>(null);\n const respondToApproval: AIChatToolApprovalHandler = async (id, approved) => {\n if (!onToolApproval || approvalRef.current) return;\n approvalRef.current = id;\n setPendingApprovalId(id);\n setApprovalError(null);\n try { await onToolApproval(id, approved); }\n catch { setApprovalError('Could not submit approval. Please try again.'); }\n finally { approvalRef.current = null; setPendingApprovalId(null); }\n };\n const isBusy = status === 'submitted' || status === 'streaming';\n const lastMessage = messages[messages.length - 1];\n const assistantParts = lastMessage?.role === 'assistant' ? lastMessage.parts.filter(isRecord) : [];\n const lastPart = [...assistantParts].reverse().find((part) => part.type !== 'step-start');\n const lastPartType = asString(lastPart?.type) ?? '';\n const activeTool = (lastPartType.startsWith('tool-') || lastPartType === 'dynamic-tool')\n && lastPart?.state !== 'output-available' && lastPart?.state !== 'output-error'\n ? lastPart : undefined;\n const hasAnswer = assistantParts.some((part) => part.type === 'text' && Boolean(asString(part.text)?.trim()));\n const showActivity = isBusy && (!hasAnswer || Boolean(activeTool));\n const toolName = asString(activeTool?.toolName) ?? lastPartType.replace(/^tool-/, '');\n const toolState = asString(activeTool?.state);\n const approval = activeTool?.approval;\n const approved = isRecord(approval) && approval.approved === true;\n const stateActivityLabel = toolState && (toolState !== 'approval-responded' || approved)\n ? toolActivityLabels?.[`${toolName}:${toolState}`] : undefined;\n const currentActivityLabel = toolState === 'approval-requested' ? 'Waiting for approval…'\n : toolState === 'approval-responded' && !approved ? 'Processing approval response…'\n : activeTool ? (stateActivityLabel ?? toolActivityLabels?.[toolName] ?? 'Using a tool…') : activityLabel;\n const limit = messageLimit != null && Number.isFinite(messageLimit)\n ? Math.max(1, Math.floor(messageLimit)) : null;\n const historyFull = limit !== null && messages.filter((message) => message.role === 'user').length >= limit;\n const MessageRenderer = components?.MessageRenderer ?? DefaultMessageRenderer;\n const ErrorRenderer = components?.ErrorRenderer ?? DefaultErrorRenderer;\n\n // Follow streaming text only if the user is already near the bottom.\n useEffect(() => {\n const viewport = viewportRef.current;\n if (viewport && pinnedToBottom.current) viewport.scrollTop = viewport.scrollHeight;\n });\n\n const handleKeyDown = (event: KeyboardEvent<HTMLTextAreaElement>) => {\n if (event.key === 'Enter' && !event.shiftKey && !event.nativeEvent.isComposing) {\n event.preventDefault();\n if (!isBusy && !historyFull && !error && (draft.trim() || (attachments?.length ?? 0) > 0)) onSend?.();\n }\n };\n\n const handleFormSubmit = (event: FormEvent<HTMLFormElement>) => {\n event.preventDefault();\n if (!isBusy && !historyFull && !error && (draft.trim() || (attachments?.length ?? 0) > 0)) onSend?.();\n };\n\n return (\n <div className={[styles.thread, className].filter(Boolean).join(' ')} style={style}>\n {header}\n {(toolbarActions || (showNewChatInToolbar && onNewChat && messages.length > 0)) && (\n <div className={styles.chatToolbar} role=\"toolbar\" aria-label=\"Conversation actions\">\n <div className={styles.chatToolbarExtras}>{toolbarActions}</div>\n {showNewChatInToolbar && onNewChat && messages.length > 0 && (\n <button\n type=\"button\"\n className={styles.newChatButton}\n onClick={onNewChat}\n aria-label=\"New chat\"\n title=\"New chat\"\n >\n <svg aria-hidden=\"true\" width=\"18\" height=\"18\" viewBox=\"0 0 24 24\" fill=\"none\"\n stroke=\"currentColor\" strokeWidth=\"1.8\" strokeLinecap=\"round\" strokeLinejoin=\"round\">\n <path d=\"M12 5H6a2 2 0 0 0-2 2v11a2 2 0 0 0 2 2h11a2 2 0 0 0 2-2v-6\" />\n <path d=\"m15 5 4 4M13 11l7-7a2.12 2.12 0 0 1 3 3l-7 7-4 1 1-4Z\" transform=\"translate(-2 -2)\" />\n </svg>\n </button>\n )}\n </div>\n )}\n <div\n ref={viewportRef}\n className={styles.viewport}\n onScroll={(event) => {\n const viewport = event.currentTarget;\n pinnedToBottom.current = viewport.scrollHeight - viewport.scrollTop - viewport.clientHeight < 80;\n }}\n >\n <div className={styles.messageList} role=\"log\" aria-label=\"Chat history\" aria-live=\"polite\">\n {messages.length === 0 && (\n <div className={styles.emptyState}>\n {emptyState ?? <p>Start a conversation</p>}\n </div>\n )}\n {messages.map((message) => (\n <MessageRenderer\n key={message.id}\n message={message}\n renderMessagePart={(part, index) => renderPart(part, index, components, onToolApproval ? respondToApproval : undefined, pendingApprovalId)}\n onToolApproval={onToolApproval ? respondToApproval : undefined}\n />\n ))}\n {showActivity && (\n <div className={styles.activityBubble} role=\"status\" aria-label={currentActivityLabel}>\n <span className={styles.activityDots} aria-hidden=\"true\"><i /><i /><i /></span>\n <span>{currentActivityLabel}</span>\n </div>\n )}\n {error && (\n onRetry && onNewChat ? (\n <ErrorRenderer error={error} onRetry={onRetry} onClear={onNewChat} />\n ) : (\n <div className={styles.error} role=\"alert\">\n <p>{error.message}</p>\n {(onRetry || onNewChat) && (\n <div className={styles.errorActions}>\n {onRetry && <button type=\"button\" onClick={onRetry}>Retry response</button>}\n {onNewChat && <button type=\"button\" onClick={onNewChat}>Start new chat</button>}\n </div>\n )}\n </div>\n )\n )}\n </div>\n </div>\n <div className={styles.footer}>\n {approvalError && <p role=\"alert\" className={styles.attachmentError}>{approvalError}</p>}\n {attachmentError && <p role=\"alert\" className={styles.attachmentError}>{attachmentError}</p>}\n {historyFull && !error && !isBusy && onNewChat && (\n <div className={styles.historyLimit}>\n <span>This chat has reached its {limit}-question limit.</span>\n <button type=\"button\" onClick={onNewChat}>Start new chat</button>\n </div>\n )}\n {(!historyFull || isBusy) && !error && (\n composer !== undefined ? composer : (\n <form className={styles.composerForm} onSubmit={handleFormSubmit}>\n {composerLeading && <div className={styles.composerExtras}>{composerLeading}</div>}\n {onSelectAttachments && (\n <input\n ref={fileInputRef}\n className={styles.visuallyHidden}\n type=\"file\"\n aria-label=\"Add attachments\"\n accept={attachmentAccept}\n multiple\n disabled={isBusy}\n onChange={(event) => {\n if (event.target.files) onSelectAttachments(event.target.files);\n event.target.value = '';\n }}\n />\n )}\n {attachments && attachments.length > 0 && (\n <div className={styles.composerExtras}>\n <ul className={styles.attachmentList} aria-label=\"Attached files\">\n {attachments.map((attachment, index) => (\n <li key={index}>\n <AIChatAttachmentPreview name={attachment.name} size={attachment.size} staged\n imageUrl={attachment.previewUrl}\n onRemove={onRemoveAttachment ? () => onRemoveAttachment(index) : undefined} />\n </li>\n ))}\n </ul>\n </div>\n )}\n <div className={styles.composerSurface}>\n <div className={styles.composerRow}>\n {onSelectAttachments && (\n <button type=\"button\" className={styles.composerIconButton}\n aria-label=\"Attach file\" title=\"Attach file\"\n disabled={isBusy} onClick={() => fileInputRef.current?.click()}>\n <svg width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\"\n strokeWidth=\"1.8\" strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden=\"true\">\n <path d=\"m21 11-8.5 8.5a6 6 0 0 1-8.5-8.5l9-9a4 4 0 0 1 5.7 5.7l-9 9a2 2 0 0 1-2.8-2.8l8.5-8.5\" />\n </svg>\n </button>\n )}\n <textarea\n className={styles.input}\n aria-label={inputAriaLabel}\n rows={1}\n value={draft}\n onChange={(event) => onDraftChange?.(event.target.value)}\n onKeyDown={handleKeyDown}\n placeholder={inputPlaceholder}\n maxLength={inputMaxLength}\n disabled={isBusy || !onSend || !onDraftChange}\n readOnly={!onDraftChange}\n />\n <div className={styles.composerActions}>\n {composerTrailing}\n {isBusy ? (\n onStop && <button type=\"button\" className={styles.composerIconButton} onClick={onStop}\n aria-label=\"Stop response\" title=\"Stop response\">\n <svg width=\"18\" height=\"18\" viewBox=\"0 0 24 24\" fill=\"currentColor\" aria-hidden=\"true\"><rect x=\"5\" y=\"5\" width=\"14\" height=\"14\" rx=\"2\" /></svg>\n </button>\n ) : (\n <button type=\"submit\" className={styles.sendButton} aria-label=\"Send message\"\n title=\"Send message\" disabled={!onSend || (!draft.trim() && !attachments?.length)}>\n <svg width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\"\n strokeWidth=\"2\" strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden=\"true\"><path d=\"M12 19V5m-7 7 7-7 7 7\" /></svg>\n </button>\n )}\n </div>\n </div>\n </div>\n </form>\n )\n )}\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;;;AAyLA,SAAS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AE,wBAAyB,CAAA;YAAM,CAAA;WACnH,CAAA,CAEP;;SACF;;OACF,CAAA;MACD;;IAGP;;EACF;;AAET"}
|
package/dist/style.css
CHANGED
|
@@ -3897,10 +3897,7 @@ button.uzi-sidebar-nav-module__item__uMHkJ {
|
|
|
3897
3897
|
gap: 0.625rem;
|
|
3898
3898
|
width: fit-content;
|
|
3899
3899
|
max-width: 100%;
|
|
3900
|
-
padding: 0.
|
|
3901
|
-
border: 1px solid var(--border);
|
|
3902
|
-
border-radius: 0.875rem;
|
|
3903
|
-
background: var(--muted);
|
|
3900
|
+
padding: 0.375rem 0.5rem;
|
|
3904
3901
|
color: var(--muted-foreground);
|
|
3905
3902
|
font-size: 0.8125rem;
|
|
3906
3903
|
line-height: 1.4;
|
|
@@ -3940,7 +3937,9 @@ button.uzi-sidebar-nav-module__item__uMHkJ {
|
|
|
3940
3937
|
padding: 0.75rem 1rem;
|
|
3941
3938
|
border: 1px solid var(--destructive);
|
|
3942
3939
|
border-radius: 0.5rem;
|
|
3943
|
-
|
|
3940
|
+
align-self: flex-start;
|
|
3941
|
+
max-width: min(100%, 42rem);
|
|
3942
|
+
margin: 0;
|
|
3944
3943
|
background: color-mix(in srgb, var(--destructive) 10%, transparent);
|
|
3945
3944
|
}
|
|
3946
3945
|
|
|
@@ -4102,7 +4101,12 @@ button.uzi-sidebar-nav-module__item__uMHkJ {
|
|
|
4102
4101
|
.uzi-ai-chat-module__stagedFileAttachment__hZfVm { width: min(15rem, 75vw); }
|
|
4103
4102
|
.uzi-ai-chat-module__sentAttachment__PP-fs {
|
|
4104
4103
|
width: fit-content;
|
|
4105
|
-
max-width: min(
|
|
4104
|
+
max-width: min(20rem, 100%);
|
|
4105
|
+
}
|
|
4106
|
+
/* Sent images are part of the message, not nested file cards. */
|
|
4107
|
+
.uzi-ai-chat-module__sentImageAttachment__M9wpx {
|
|
4108
|
+
border: 0;
|
|
4109
|
+
background: transparent;
|
|
4106
4110
|
}
|
|
4107
4111
|
.uzi-ai-chat-module__imageAttachmentButton__PM2cf {
|
|
4108
4112
|
display: block;
|
|
@@ -4122,18 +4126,10 @@ button.uzi-sidebar-nav-module__item__uMHkJ {
|
|
|
4122
4126
|
.uzi-ai-chat-module__stagedAttachment__5axXj .uzi-ai-chat-module__attachmentThumbnail__OzmIc { width: 100%; height: 100%; object-fit: cover; }
|
|
4123
4127
|
.uzi-ai-chat-module__sentAttachment__PP-fs .uzi-ai-chat-module__attachmentThumbnail__OzmIc {
|
|
4124
4128
|
width: auto;
|
|
4125
|
-
|
|
4126
|
-
|
|
4127
|
-
}
|
|
4128
|
-
.uzi-ai-chat-module__sentAttachmentName__rGevY {
|
|
4129
|
-
display: block;
|
|
4129
|
+
height: auto;
|
|
4130
|
+
min-width: 8rem;
|
|
4130
4131
|
max-width: 100%;
|
|
4131
|
-
|
|
4132
|
-
overflow: hidden;
|
|
4133
|
-
text-overflow: ellipsis;
|
|
4134
|
-
white-space: nowrap;
|
|
4135
|
-
color: var(--muted-foreground);
|
|
4136
|
-
font-size: 0.6875rem;
|
|
4132
|
+
max-height: min(26rem, 60dvh);
|
|
4137
4133
|
}
|
|
4138
4134
|
.uzi-ai-chat-module__fileAttachment__lVB09 {
|
|
4139
4135
|
display: flex;
|