@aparte/core 1.8.0 → 1.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/agent-runner.d.ts +8 -3
- package/dist/client/agent-runner.d.ts.map +1 -1
- package/dist/client/aparte-client.d.ts +48 -11
- package/dist/client/aparte-client.d.ts.map +1 -1
- package/dist/client/stream-adapter.d.ts +5 -0
- package/dist/client/stream-adapter.d.ts.map +1 -1
- package/dist/client/wire-history.d.ts +21 -1
- package/dist/client/wire-history.d.ts.map +1 -1
- package/dist/components/bubble/aparte-chat-bubble.d.ts +13 -3
- package/dist/components/bubble/aparte-chat-bubble.d.ts.map +1 -1
- package/dist/components/chat/aparte-chat.d.ts +64 -0
- package/dist/components/chat/aparte-chat.d.ts.map +1 -1
- package/dist/components/composer/aparte-composer-action.d.ts +2 -1
- package/dist/components/composer/aparte-composer-action.d.ts.map +1 -1
- package/dist/components/composer/aparte-composer-add-attachment.d.ts.map +1 -1
- package/dist/components/composer/aparte-composer-attachments.d.ts.map +1 -1
- package/dist/components/composer/aparte-composer-input.d.ts +3 -1
- package/dist/components/composer/aparte-composer-input.d.ts.map +1 -1
- package/dist/components/composer/aparte-composer-send.d.ts +11 -0
- package/dist/components/composer/aparte-composer-send.d.ts.map +1 -1
- package/dist/components/composer/aparte-composer.d.ts +2 -1
- package/dist/components/composer/aparte-composer.d.ts.map +1 -1
- package/dist/components/context/aparte-context.d.ts +1 -1
- package/dist/components/context/aparte-context.d.ts.map +1 -1
- package/dist/components/conversation-list/aparte-conversation-list.d.ts +43 -1
- package/dist/components/conversation-list/aparte-conversation-list.d.ts.map +1 -1
- package/dist/components/conversation-list/index.d.ts +1 -1
- package/dist/components/conversation-list/index.d.ts.map +1 -1
- package/dist/components/elicitation/aparte-elicitation.d.ts.map +1 -1
- package/dist/components/index.d.ts +1 -1
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/launcher/aparte-launcher.d.ts.map +1 -1
- package/dist/components/scroll-rail/aparte-scroll-rail.d.ts +1 -1
- package/dist/components/scroll-rail/aparte-scroll-rail.d.ts.map +1 -1
- package/dist/components/sidebar/aparte-sidebar.d.ts +14 -1
- package/dist/components/sidebar/aparte-sidebar.d.ts.map +1 -1
- package/dist/components/split/aparte-split.d.ts +1 -1
- package/dist/components/split/aparte-split.d.ts.map +1 -1
- package/dist/components/suggestions/aparte-suggestions.d.ts +3 -2
- package/dist/components/suggestions/aparte-suggestions.d.ts.map +1 -1
- package/dist/components/viewport/aparte-chat-viewport.d.ts +3 -0
- package/dist/components/viewport/aparte-chat-viewport.d.ts.map +1 -1
- package/dist/config/aparte-config.d.ts +108 -13
- package/dist/config/aparte-config.d.ts.map +1 -1
- package/dist/config/index.d.ts +2 -0
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/link-target.d.ts +39 -0
- package/dist/config/link-target.d.ts.map +1 -0
- package/dist/config/sanitize.d.ts +22 -3
- package/dist/config/sanitize.d.ts.map +1 -1
- package/dist/config/step-label.d.ts +22 -0
- package/dist/config/step-label.d.ts.map +1 -0
- package/dist/context/checkpoint-state.d.ts +0 -7
- package/dist/context/checkpoint-state.d.ts.map +1 -1
- package/dist/context/measure.d.ts +3 -1
- package/dist/context/measure.d.ts.map +1 -1
- package/dist/conversations/conversation-controller.d.ts +56 -0
- package/dist/conversations/conversation-controller.d.ts.map +1 -1
- package/dist/conversations/open-conversation.d.ts +28 -0
- package/dist/conversations/open-conversation.d.ts.map +1 -0
- package/dist/custom-elements.json +1969 -335
- package/dist/{defer-hydration-BE2ToXC_.js → defer-hydration-OFqdbk3O.js} +991 -299
- package/dist/defer-hydration-OFqdbk3O.js.map +1 -0
- package/dist/elicitation/approval-panel.d.ts +1 -1
- package/dist/elicitation/approval-panel.d.ts.map +1 -1
- package/dist/elicitation/option-keys.d.ts +26 -0
- package/dist/elicitation/option-keys.d.ts.map +1 -0
- package/dist/elicitation/types.d.ts +16 -0
- package/dist/elicitation/types.d.ts.map +1 -1
- package/dist/generated/element-attributes.d.ts +13 -6
- package/dist/generated/element-attributes.d.ts.map +1 -1
- package/dist/{glyphs-LolG04CC.js → glyphs-BgKFtByg.js} +10 -10
- package/dist/{glyphs-LolG04CC.js.map → glyphs-BgKFtByg.js.map} +1 -1
- package/dist/host/aparte-chat-host.d.ts +42 -1
- package/dist/host/aparte-chat-host.d.ts.map +1 -1
- package/dist/icons/extended.d.ts +9 -0
- package/dist/icons/extended.d.ts.map +1 -1
- package/dist/icons.js +20 -11
- package/dist/icons.js.map +1 -1
- package/dist/index.css +1 -1
- package/dist/index.d.ts +10 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +310 -197
- package/dist/index.js.map +1 -1
- package/dist/index.node.d.ts +8 -3
- package/dist/index.node.d.ts.map +1 -1
- package/dist/index.node.js +61 -58
- package/dist/index.node.js.map +1 -1
- package/dist/interop/chat-events.d.ts +64 -0
- package/dist/interop/chat-events.d.ts.map +1 -0
- package/dist/interop/element-props.d.ts +6 -0
- package/dist/interop/element-props.d.ts.map +1 -1
- package/dist/interop/element-spec.d.ts +85 -0
- package/dist/interop/element-spec.d.ts.map +1 -0
- package/dist/primitives/progress-spinner/aparte-progress-spinner.d.ts +1 -1
- package/dist/primitives/progress-spinner/aparte-progress-spinner.d.ts.map +1 -1
- package/dist/primitives/select/aparte-option.d.ts +1 -1
- package/dist/primitives/select/aparte-option.d.ts.map +1 -1
- package/dist/primitives/select/aparte-select.d.ts.map +1 -1
- package/dist/renderers/citations.d.ts.map +1 -1
- package/dist/transport/agent-handler.d.ts +14 -4
- package/dist/transport/agent-handler.d.ts.map +1 -1
- package/dist/types/element-attributes.d.ts +5 -2
- package/dist/types/element-attributes.d.ts.map +1 -1
- package/dist/types/events.d.ts +15 -13
- package/dist/types/events.d.ts.map +1 -1
- package/dist/types/imperative-api.d.ts +26 -0
- package/dist/types/imperative-api.d.ts.map +1 -1
- package/dist/types/index.d.ts +2 -2
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/models.d.ts +26 -0
- package/dist/types/models.d.ts.map +1 -1
- package/dist/types/segments.d.ts +2 -1
- package/dist/types/segments.d.ts.map +1 -1
- package/dist/types/tools.d.ts +60 -5
- package/dist/types/tools.d.ts.map +1 -1
- package/dist/utils/segments.d.ts +1 -0
- package/dist/utils/segments.d.ts.map +1 -1
- package/dist/utils/tool-line.d.ts +9 -8
- package/dist/utils/tool-line.d.ts.map +1 -1
- package/package.json +2 -2
- package/dist/defer-hydration-BE2ToXC_.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { A, a, b, c, d, f, h, i, j, k, l, m, n, p, s, S, u, v,
|
|
1
|
+
import { L as deferHydrationOf, ai as resolveConfig, aq as subscribeConfigChange, al as runWithConfig, o as AparteElicitationAbortError, w as buildApprovalPanel, x as buildElicitationPanel, y as chatIdOf, aw as gateGlide, Q as escapeAttr, an as segmentTiming, ax as chatBoundaryOf, ay as relabelCodeLanguages, az as relabelCitations, aA as toolCallRenderer, aB as activityRenderer, t as aparteGlobalConfig, aC as isMountedRenderer, aD as renderingVersionOf, a5 as onRenderersChange, aE as renderSourceList, aF as mergeSegmentUpdate, a3 as isSegmentSettled, a9 as pluralize, W as formatDuration, aG as toolNameOf, R as escapeHtml, aH as writeStreamedMarkdown, aI as replaceHighlighted, a2 as isSafeUrl, P as dispatchChatEvent, D as copyText, Y as getSegmentRenderer, _ as installDefaultRenderersOnce, aJ as toolRendererThatDrew, aK as activityRendererThatDrew, r as AparteMessageRepository, aL as CheckpointStateWatcher, aM as stampSegmentActivity, aN as stampSegmentOnInsert, aO as stampSegmentOnUpdate, aP as renumberSegments, aQ as openSegmentIds, aR as isTerminalStatus, aS as adoptMessageSegments, a0 as isAwaitingReply, aa as populateBubbleFromMessage, au as uuid, aj as revokeAttachmentUrls, a8 as parseMarkdownToSegments, aT as APARTE_DERIVED_SEGMENTS, aU as rememberConversationStatus, aV as tellConversationStatus, aW as conversationStatusOf, e as APARTE_DEFAULT_LOCALE, aX as visibleReply, aY as usageTokens, q as AparteErrorCode, a4 as measureContext, aZ as inRenderedContent, g as APARTE_HOST_ATTR, $ as installDialogTriggersOnce } from "./defer-hydration-OFqdbk3O.js";
|
|
2
|
+
import { A, a, b, c, d, f, h, i, j, k, l, m, n, p, s, S, u, v, z, B, C, E, F, G, H, I, J, K, M, N, O, T, U, V, X, Z, a1, a6, a7, ab, ac, ad, ae, af, ag, ah, ak, am, ao, ap, ar, as, at, av } from "./defer-hydration-OFqdbk3O.js";
|
|
3
3
|
import { d as eventOrigin, f as activeElementIn, c as cssEscape, a as enhanceMenu, e as enhanceContextMenu, p as placeFloating, r as rootOf } from "./kit-keyboard-BUSLQ5i4.js";
|
|
4
4
|
import { b as b2 } from "./kit-keyboard-BUSLQ5i4.js";
|
|
5
5
|
function presenceOn(value) {
|
|
@@ -14,7 +14,8 @@ class AparteOption extends HTMLElement {
|
|
|
14
14
|
this._updateAriaSelected();
|
|
15
15
|
this._updateStatusDot();
|
|
16
16
|
}
|
|
17
|
-
attributeChangedCallback(name) {
|
|
17
|
+
attributeChangedCallback(name, previous, value) {
|
|
18
|
+
if (previous === value) return;
|
|
18
19
|
if (name === "selected") {
|
|
19
20
|
this._updateAriaSelected();
|
|
20
21
|
}
|
|
@@ -249,6 +250,7 @@ class AparteSelect extends HTMLElement {
|
|
|
249
250
|
this._observer?.disconnect();
|
|
250
251
|
}
|
|
251
252
|
attributeChangedCallback(name, oldValue, newValue) {
|
|
253
|
+
if (oldValue === newValue) return;
|
|
252
254
|
if (!this.isConnected) return;
|
|
253
255
|
if (name === "value" && oldValue !== newValue && newValue !== this._value) {
|
|
254
256
|
this._value = newValue || "";
|
|
@@ -674,11 +676,11 @@ class AparteSelect extends HTMLElement {
|
|
|
674
676
|
const sizer = this._trigger?.querySelector(".aparte-select-label-sizer");
|
|
675
677
|
if (sizer) {
|
|
676
678
|
const labels = [placeholder, ...Array.from(this.querySelectorAll("aparte-option"), (o) => optionLabelText(o))];
|
|
677
|
-
const current = Array.from(sizer.children, (s2) => s2.
|
|
679
|
+
const current = Array.from(sizer.children, (s2) => s2.getAttribute("data-label") ?? "");
|
|
678
680
|
if (labels.length !== current.length || labels.some((l2, i2) => l2 !== current[i2])) {
|
|
679
681
|
sizer.replaceChildren(...labels.map((text) => {
|
|
680
682
|
const span = document.createElement("span");
|
|
681
|
-
span.
|
|
683
|
+
span.setAttribute("data-label", text);
|
|
682
684
|
return span;
|
|
683
685
|
}));
|
|
684
686
|
}
|
|
@@ -746,7 +748,8 @@ class AparteProgressSpinner extends HTMLElement {
|
|
|
746
748
|
connectedCallback() {
|
|
747
749
|
this._render();
|
|
748
750
|
}
|
|
749
|
-
attributeChangedCallback() {
|
|
751
|
+
attributeChangedCallback(_name, previous, value) {
|
|
752
|
+
if (previous === value) return;
|
|
750
753
|
this._render();
|
|
751
754
|
}
|
|
752
755
|
_render() {
|
|
@@ -796,6 +799,43 @@ deferHydrationOf(AparteIcon);
|
|
|
796
799
|
if (!customElements.get("aparte-icon")) {
|
|
797
800
|
customElements.define("aparte-icon", AparteIcon);
|
|
798
801
|
}
|
|
802
|
+
const OPTION = ".aparte-elic-option--command, .aparte-approval-option";
|
|
803
|
+
const TEXT_FIELD = 'input:not([type="checkbox"]):not([type="radio"]):not([type="button"]), textarea, select, [contenteditable]:not([contenteditable="false"])';
|
|
804
|
+
function numberOptions(panel) {
|
|
805
|
+
const options = [...panel.querySelectorAll(OPTION)];
|
|
806
|
+
options.forEach((option, i2) => {
|
|
807
|
+
if (i2 >= 9) return;
|
|
808
|
+
option.setAttribute("data-shortcut", String(i2 + 1));
|
|
809
|
+
option.setAttribute("aria-keyshortcuts", String(i2 + 1));
|
|
810
|
+
});
|
|
811
|
+
}
|
|
812
|
+
function bindOptionKeys(panel) {
|
|
813
|
+
const onKeyDown2 = (e) => {
|
|
814
|
+
if (e.defaultPrevented || e.repeat || e.isComposing || e.keyCode === 229) return;
|
|
815
|
+
if (e.ctrlKey || e.metaKey || e.altKey || e.shiftKey) return;
|
|
816
|
+
if (panel.hasAttribute("data-collapsed")) return;
|
|
817
|
+
const target = e.target instanceof Element ? e.target : null;
|
|
818
|
+
if (!target || target.closest(TEXT_FIELD)) return;
|
|
819
|
+
if (/^[1-9]$/.test(e.key)) {
|
|
820
|
+
if (!target.closest(OPTION)) return;
|
|
821
|
+
const option = panel.querySelectorAll(OPTION)[Number(e.key) - 1];
|
|
822
|
+
if (!option) return;
|
|
823
|
+
e.preventDefault();
|
|
824
|
+
option.click();
|
|
825
|
+
return;
|
|
826
|
+
}
|
|
827
|
+
if (e.key === "Escape") {
|
|
828
|
+
const skip = panel.querySelector(".aparte-elic-skip");
|
|
829
|
+
const denies = panel.querySelectorAll(".aparte-approval-option--deny");
|
|
830
|
+
const answer = skip ?? (denies.length === 1 ? denies[0] : null);
|
|
831
|
+
if (!answer) return;
|
|
832
|
+
e.preventDefault();
|
|
833
|
+
answer.click();
|
|
834
|
+
}
|
|
835
|
+
};
|
|
836
|
+
panel.addEventListener("keydown", onKeyDown2);
|
|
837
|
+
return () => panel.removeEventListener("keydown", onKeyDown2);
|
|
838
|
+
}
|
|
799
839
|
function deepActiveElement(root) {
|
|
800
840
|
let active = root.activeElement;
|
|
801
841
|
while (active?.shadowRoot?.activeElement) active = active.shadowRoot.activeElement;
|
|
@@ -944,7 +984,7 @@ class AparteElicitation extends HTMLElement {
|
|
|
944
984
|
status(message);
|
|
945
985
|
return;
|
|
946
986
|
}
|
|
947
|
-
const x = window.scrollX,
|
|
987
|
+
const x = window.scrollX, y = window.scrollY;
|
|
948
988
|
if (typing && inChat) {
|
|
949
989
|
if (!panel2.el.hasAttribute("tabindex")) panel2.el.setAttribute("tabindex", "-1");
|
|
950
990
|
if (!panel2.el.hasAttribute("role")) panel2.el.setAttribute("role", "group");
|
|
@@ -953,7 +993,7 @@ class AparteElicitation extends HTMLElement {
|
|
|
953
993
|
} else {
|
|
954
994
|
panel2.focus();
|
|
955
995
|
}
|
|
956
|
-
if (fromNobody && (window.scrollX !== x || window.scrollY !==
|
|
996
|
+
if (fromNobody && (window.scrollX !== x || window.scrollY !== y)) window.scrollTo(x, y);
|
|
957
997
|
};
|
|
958
998
|
const close = () => {
|
|
959
999
|
if (done) return false;
|
|
@@ -987,7 +1027,9 @@ class AparteElicitation extends HTMLElement {
|
|
|
987
1027
|
const sendable = () => panel2.isComplete() && !panel2.el.hasAttribute("data-collapsed");
|
|
988
1028
|
const approvalMode = () => sendable() ? "submit" : "none";
|
|
989
1029
|
const syncSubmit2 = () => composer.setPanelSubmitEnabled(sendable(), approvalMode());
|
|
990
|
-
const panel2 = runWithConfig(cfg, () => buildApprovalPanel(request.message, request.options ?? [], syncSubmit2, request.details, request.allowOther ?? true));
|
|
1030
|
+
const panel2 = runWithConfig(cfg, () => buildApprovalPanel(request.message, request.options ?? [], syncSubmit2, request.details, request.allowOther ?? true, request.preview));
|
|
1031
|
+
numberOptions(panel2.el);
|
|
1032
|
+
bindOptionKeys(panel2.el);
|
|
991
1033
|
panel2.onSettle((answer) => settle({ action: "accept", content: answer }));
|
|
992
1034
|
const retract2 = addRetract(panel2.el, panel2.dismiss, cfg, () => panel2.focus(), syncSubmit2);
|
|
993
1035
|
this._pending = {
|
|
@@ -1021,6 +1063,8 @@ class AparteElicitation extends HTMLElement {
|
|
|
1021
1063
|
skip.textContent = cfg.t("elicitationSkip");
|
|
1022
1064
|
skip.addEventListener("click", () => settle({ action: "decline" }));
|
|
1023
1065
|
panel.dismiss.appendChild(skip);
|
|
1066
|
+
numberOptions(panel.el);
|
|
1067
|
+
bindOptionKeys(panel.el);
|
|
1024
1068
|
const retract = addRetract(panel.el, panel.dismiss, cfg, () => panel.focus(), syncSubmit);
|
|
1025
1069
|
panel.onSettle((content) => settle({ action: "accept", content }));
|
|
1026
1070
|
this._pending = {
|
|
@@ -1066,14 +1110,7 @@ class AparteElicitation extends HTMLElement {
|
|
|
1066
1110
|
* resolves `undefined` on three wrappers out of four.
|
|
1067
1111
|
*/
|
|
1068
1112
|
_pendingTargetId() {
|
|
1069
|
-
|
|
1070
|
-
while (el2) {
|
|
1071
|
-
const tag = el2.tagName?.toLowerCase();
|
|
1072
|
-
const isHost = tag === "aparte-chat" || el2.hasAttribute?.("data-aparte-chat");
|
|
1073
|
-
if (isHost && el2.id) return el2.id;
|
|
1074
|
-
el2 = el2.parentElement;
|
|
1075
|
-
}
|
|
1076
|
-
return void 0;
|
|
1113
|
+
return chatIdOf(this._pending?.composer ?? null);
|
|
1077
1114
|
}
|
|
1078
1115
|
/**
|
|
1079
1116
|
* The composer to present in: the nearest one in an ancestor subtree, and
|
|
@@ -1133,6 +1170,7 @@ class AparteChat extends HTMLElement {
|
|
|
1133
1170
|
*/
|
|
1134
1171
|
_ownsShell = false;
|
|
1135
1172
|
connectedCallback() {
|
|
1173
|
+
this.setAttribute("data-aparte-chat", "");
|
|
1136
1174
|
this._render();
|
|
1137
1175
|
this._forwardAttr("placeholder");
|
|
1138
1176
|
this._forwardAttr("disabled");
|
|
@@ -1372,11 +1410,11 @@ function draw(root, content, token) {
|
|
|
1372
1410
|
const walker = doc.createTreeWalker(root, NodeFilter.SHOW_TEXT);
|
|
1373
1411
|
while (walker.nextNode()) {
|
|
1374
1412
|
const node = walker.currentNode;
|
|
1375
|
-
for (let
|
|
1413
|
+
for (let at2 = node.data.indexOf(token.text); at2 >= 0; at2 = node.data.indexOf(token.text, at2 + token.text.length)) {
|
|
1376
1414
|
if (skip-- > 0) continue;
|
|
1377
1415
|
const range = doc.createRange();
|
|
1378
|
-
range.setStart(node,
|
|
1379
|
-
range.setEnd(node,
|
|
1416
|
+
range.setStart(node, at2);
|
|
1417
|
+
range.setEnd(node, at2 + token.text.length);
|
|
1380
1418
|
range.deleteContents();
|
|
1381
1419
|
range.insertNode(pill(doc, token));
|
|
1382
1420
|
return;
|
|
@@ -1559,6 +1597,8 @@ class AparteChatBubble extends HTMLElement {
|
|
|
1559
1597
|
_content = "";
|
|
1560
1598
|
_tokens;
|
|
1561
1599
|
_streaming = false;
|
|
1600
|
+
/** The element is taking its own `streaming` attribute off: the change says what the state already does. */
|
|
1601
|
+
_clearingStreamingAttr = false;
|
|
1562
1602
|
_segments = [];
|
|
1563
1603
|
_role = "assistant";
|
|
1564
1604
|
_attachments = [];
|
|
@@ -1918,6 +1958,7 @@ class AparteChatBubble extends HTMLElement {
|
|
|
1918
1958
|
queueMicrotask(() => {
|
|
1919
1959
|
this._redrawFrameIfChanged();
|
|
1920
1960
|
this._redrawSegmentsWhoseRendererChanged();
|
|
1961
|
+
if (this.isConnected) this._updateWaiting();
|
|
1921
1962
|
});
|
|
1922
1963
|
}
|
|
1923
1964
|
_redrawFrameIfChanged() {
|
|
@@ -1982,7 +2023,7 @@ class AparteChatBubble extends HTMLElement {
|
|
|
1982
2023
|
if (this.getAttribute("data-checkpoint") === "failed") this._updateCheckpoint();
|
|
1983
2024
|
break;
|
|
1984
2025
|
case "streaming":
|
|
1985
|
-
this._updateStreaming(newValue !== null && newValue !== "false");
|
|
2026
|
+
if (!this._clearingStreamingAttr) this._updateStreaming(newValue !== null && newValue !== "false");
|
|
1986
2027
|
break;
|
|
1987
2028
|
case "name":
|
|
1988
2029
|
this._updateName();
|
|
@@ -2008,11 +2049,7 @@ class AparteChatBubble extends HTMLElement {
|
|
|
2008
2049
|
dismiss: this._cfg.t("feedbackReasonDismiss"),
|
|
2009
2050
|
onPick: (reason) => {
|
|
2010
2051
|
panel.remove();
|
|
2011
|
-
this
|
|
2012
|
-
bubbles: true,
|
|
2013
|
-
composed: true,
|
|
2014
|
-
detail: { messageId, reason }
|
|
2015
|
-
}));
|
|
2052
|
+
dispatchChatEvent(this, "aparte-feedback-reason", { messageId, reason });
|
|
2016
2053
|
},
|
|
2017
2054
|
onClose: () => panel.remove()
|
|
2018
2055
|
});
|
|
@@ -2775,7 +2812,7 @@ class AparteChatBubble extends HTMLElement {
|
|
|
2775
2812
|
const el2 = this.querySelector(".aparte-waiting");
|
|
2776
2813
|
if (!el2) return;
|
|
2777
2814
|
el2.hidden = !waiting;
|
|
2778
|
-
const step = waiting ? this._step : null;
|
|
2815
|
+
const step = waiting && this._step ? this._cfg.getStepLabel(this._step) ?? this._step : null;
|
|
2779
2816
|
let words = el2.querySelector(".aparte-waiting-step");
|
|
2780
2817
|
if (!words && step) {
|
|
2781
2818
|
words = document.createElement("span");
|
|
@@ -3024,11 +3061,7 @@ class AparteChatBubble extends HTMLElement {
|
|
|
3024
3061
|
const open = () => {
|
|
3025
3062
|
const url = tile.querySelector(".aparte-thumbnail__image")?.src ?? tile.dataset["url"];
|
|
3026
3063
|
if (!url) return;
|
|
3027
|
-
this
|
|
3028
|
-
bubbles: true,
|
|
3029
|
-
composed: true,
|
|
3030
|
-
detail: { url, name: tile.getAttribute("title") ?? "", type: tile.dataset["type"] ?? "" }
|
|
3031
|
-
}));
|
|
3064
|
+
dispatchChatEvent(this, "aparte-attachment-preview", { url, name: tile.getAttribute("title") ?? "", type: tile.dataset["type"] ?? "" });
|
|
3032
3065
|
};
|
|
3033
3066
|
tile.addEventListener("click", open);
|
|
3034
3067
|
tile.addEventListener("keydown", (e) => {
|
|
@@ -3087,18 +3120,14 @@ class AparteChatBubble extends HTMLElement {
|
|
|
3087
3120
|
const messageId = this.getAttribute("message-id");
|
|
3088
3121
|
if (!messageId) return;
|
|
3089
3122
|
const detail = { messageId, direction };
|
|
3090
|
-
this
|
|
3091
|
-
bubbles: true,
|
|
3092
|
-
composed: true,
|
|
3093
|
-
detail
|
|
3094
|
-
}));
|
|
3123
|
+
dispatchChatEvent(this, "aparte-branch-navigate", detail);
|
|
3095
3124
|
};
|
|
3096
3125
|
/**
|
|
3097
3126
|
* A link the MODEL wrote is about to be followed. Announced as a cancelable event
|
|
3098
3127
|
* before the browser acts, so a host can route it — an external browser, a
|
|
3099
3128
|
* confirmation, an embedded view — without intercepting the DOM. With
|
|
3100
|
-
* no listener the browser follows it,
|
|
3101
|
-
*
|
|
3129
|
+
* no listener the browser follows it, where the config's link target sent it (a new
|
|
3130
|
+
* tab by default, `setLinkTarget`); `preventDefault()` on the event cancels the click.
|
|
3102
3131
|
*
|
|
3103
3132
|
* Only anchors inside the message body: the action bar and the branch picker are
|
|
3104
3133
|
* buttons, and an attachment tile is its own event.
|
|
@@ -3112,12 +3141,7 @@ class AparteChatBubble extends HTMLElement {
|
|
|
3112
3141
|
anchor,
|
|
3113
3142
|
messageId: this.getAttribute("message-id")
|
|
3114
3143
|
};
|
|
3115
|
-
const announced = this
|
|
3116
|
-
bubbles: true,
|
|
3117
|
-
composed: true,
|
|
3118
|
-
cancelable: true,
|
|
3119
|
-
detail
|
|
3120
|
-
}));
|
|
3144
|
+
const announced = dispatchChatEvent(this, "aparte-link-click", detail, { cancelable: true });
|
|
3121
3145
|
if (!announced) event.preventDefault();
|
|
3122
3146
|
};
|
|
3123
3147
|
/**
|
|
@@ -3378,11 +3402,7 @@ class AparteChatBubble extends HTMLElement {
|
|
|
3378
3402
|
role: this._role,
|
|
3379
3403
|
targetId: this._resolveTargetId()
|
|
3380
3404
|
};
|
|
3381
|
-
this
|
|
3382
|
-
bubbles: true,
|
|
3383
|
-
composed: true,
|
|
3384
|
-
detail
|
|
3385
|
-
}));
|
|
3405
|
+
dispatchChatEvent(this, "aparte-action", detail);
|
|
3386
3406
|
this._cfg.getActions("bubble").find((x) => x.id === actionId)?.onClick?.(e);
|
|
3387
3407
|
return;
|
|
3388
3408
|
}
|
|
@@ -3438,11 +3458,7 @@ class AparteChatBubble extends HTMLElement {
|
|
|
3438
3458
|
const value = action2 === "feedback-positive" ? "positive" : "negative";
|
|
3439
3459
|
btn.setAttribute("data-submitted", "");
|
|
3440
3460
|
const detail = { messageId, value };
|
|
3441
|
-
this
|
|
3442
|
-
bubbles: true,
|
|
3443
|
-
composed: true,
|
|
3444
|
-
detail
|
|
3445
|
-
}));
|
|
3461
|
+
dispatchChatEvent(this, "aparte-feedback", detail);
|
|
3446
3462
|
if (value === "negative") this._askFeedbackReason(messageId);
|
|
3447
3463
|
else this.querySelector(".aparte-feedback-reasons")?.remove();
|
|
3448
3464
|
break;
|
|
@@ -3453,11 +3469,7 @@ class AparteChatBubble extends HTMLElement {
|
|
|
3453
3469
|
messageId,
|
|
3454
3470
|
usage: this._usage ?? void 0
|
|
3455
3471
|
};
|
|
3456
|
-
this
|
|
3457
|
-
bubbles: true,
|
|
3458
|
-
composed: true,
|
|
3459
|
-
detail
|
|
3460
|
-
}));
|
|
3472
|
+
dispatchChatEvent(this, "aparte-message-info", detail);
|
|
3461
3473
|
break;
|
|
3462
3474
|
}
|
|
3463
3475
|
}
|
|
@@ -3538,14 +3550,7 @@ class AparteChatBubble extends HTMLElement {
|
|
|
3538
3550
|
}
|
|
3539
3551
|
}
|
|
3540
3552
|
_resolveTargetId() {
|
|
3541
|
-
|
|
3542
|
-
while (el2) {
|
|
3543
|
-
const tag = el2.tagName?.toLowerCase();
|
|
3544
|
-
const isHost = tag === "aparte-chat" || el2.hasAttribute?.("data-aparte-chat");
|
|
3545
|
-
if (isHost && el2.id) return el2.id;
|
|
3546
|
-
el2 = el2.parentElement;
|
|
3547
|
-
}
|
|
3548
|
-
return void 0;
|
|
3553
|
+
return chatIdOf(this);
|
|
3549
3554
|
}
|
|
3550
3555
|
// ─────────────────────────────────────────────────────────────────────────
|
|
3551
3556
|
// Utilities
|
|
@@ -3572,6 +3577,24 @@ class AparteChatBubble extends HTMLElement {
|
|
|
3572
3577
|
if (wasStreaming && !streaming) this._settleWrittenSegments();
|
|
3573
3578
|
if (wasStreaming && !streaming && this._segments.length > 0) this._redrawIfStale();
|
|
3574
3579
|
this._syncTurns();
|
|
3580
|
+
if (!streaming) this._dropStreamingAttribute();
|
|
3581
|
+
}
|
|
3582
|
+
/**
|
|
3583
|
+
* A reply in flight is declared with `streaming`, and it ends as `updateMessage({ status })`
|
|
3584
|
+
* — which moved the state and left the attribute. A vanilla viewport writes it on the bubble
|
|
3585
|
+
* it appends for a reply on its way and nothing took it off, so every finished reply of a
|
|
3586
|
+
* transcript still matched `[streaming]`. It comes off here, once the state is off.
|
|
3587
|
+
* `streaming="false"` is left alone: it already says so.
|
|
3588
|
+
*/
|
|
3589
|
+
_dropStreamingAttribute() {
|
|
3590
|
+
const value = this.getAttribute("streaming");
|
|
3591
|
+
if (value === null || value === "false") return;
|
|
3592
|
+
this._clearingStreamingAttr = true;
|
|
3593
|
+
try {
|
|
3594
|
+
this.removeAttribute("streaming");
|
|
3595
|
+
} finally {
|
|
3596
|
+
this._clearingStreamingAttr = false;
|
|
3597
|
+
}
|
|
3575
3598
|
}
|
|
3576
3599
|
}
|
|
3577
3600
|
deferHydrationOf(AparteChatBubble);
|
|
@@ -3766,11 +3789,11 @@ function markDerivedSegments(message) {
|
|
|
3766
3789
|
function hasDerivedSegments(message) {
|
|
3767
3790
|
return message[APARTE_DERIVED_SEGMENTS] === true;
|
|
3768
3791
|
}
|
|
3769
|
-
function longDate(
|
|
3792
|
+
function longDate(at2, tag) {
|
|
3770
3793
|
try {
|
|
3771
|
-
return new Intl.DateTimeFormat(tag || void 0, { dateStyle: "long" }).format(
|
|
3794
|
+
return new Intl.DateTimeFormat(tag || void 0, { dateStyle: "long" }).format(at2);
|
|
3772
3795
|
} catch {
|
|
3773
|
-
return
|
|
3796
|
+
return at2.toDateString();
|
|
3774
3797
|
}
|
|
3775
3798
|
}
|
|
3776
3799
|
class AparteChatViewport extends HTMLElement {
|
|
@@ -4017,6 +4040,7 @@ class AparteChatViewport extends HTMLElement {
|
|
|
4017
4040
|
else container.removeAttribute("dir");
|
|
4018
4041
|
}
|
|
4019
4042
|
disconnectedCallback() {
|
|
4043
|
+
this._chatId = void 0;
|
|
4020
4044
|
window.removeEventListener("aparte-config-change", this._onConfigChange);
|
|
4021
4045
|
if (this._boundResetHandler) {
|
|
4022
4046
|
window.removeEventListener("aparte-reset", this._boundResetHandler);
|
|
@@ -4099,14 +4123,17 @@ class AparteChatViewport extends HTMLElement {
|
|
|
4099
4123
|
...stampSegmentActivity(segment)
|
|
4100
4124
|
};
|
|
4101
4125
|
}
|
|
4102
|
-
this.
|
|
4103
|
-
|
|
4104
|
-
|
|
4105
|
-
detail: { messageId, segmentId, content: chunk, append: true }
|
|
4106
|
-
}));
|
|
4126
|
+
const targetId = this._chatIdOnce();
|
|
4127
|
+
const detail = targetId === void 0 ? { messageId, segmentId, content: chunk, append: true } : { messageId, segmentId, content: chunk, append: true, targetId };
|
|
4128
|
+
this.dispatchEvent(new CustomEvent("aparte-segment-update", { bubbles: true, composed: true, detail }));
|
|
4107
4129
|
this._notifyBubble(messageId, "appendToSegment", chunk, segmentId);
|
|
4108
4130
|
this._autoScroll();
|
|
4109
4131
|
}
|
|
4132
|
+
/** The chat this viewport is in, while it stays connected — see `appendToSegment`. */
|
|
4133
|
+
_chatId;
|
|
4134
|
+
_chatIdOnce() {
|
|
4135
|
+
return this._chatId ??= chatIdOf(this);
|
|
4136
|
+
}
|
|
4110
4137
|
/**
|
|
4111
4138
|
* The active (head) message id — the target of `AparteClient`'s 1-argument
|
|
4112
4139
|
* streaming convention (`addSegment(segment)`, `updateSegment(segmentId,
|
|
@@ -4701,21 +4728,21 @@ class AparteChatViewport extends HTMLElement {
|
|
|
4701
4728
|
const on = cfg.getDateSeparators();
|
|
4702
4729
|
if (!on && !this.querySelector("aparte-chat-bubble[data-date]")) return;
|
|
4703
4730
|
const now = /* @__PURE__ */ new Date();
|
|
4704
|
-
const dayOf = (
|
|
4731
|
+
const dayOf = (at2) => new Date(at2.getFullYear(), at2.getMonth(), at2.getDate()).getTime();
|
|
4705
4732
|
const today = dayOf(now);
|
|
4706
4733
|
let previous = null;
|
|
4707
4734
|
this.querySelectorAll("aparte-chat-bubble").forEach((bubble) => {
|
|
4708
4735
|
const raw = Number(bubble.getAttribute("timestamp"));
|
|
4709
|
-
const
|
|
4710
|
-
const day =
|
|
4711
|
-
const starts = on &&
|
|
4736
|
+
const at2 = raw ? new Date(raw) : null;
|
|
4737
|
+
const day = at2 ? dayOf(at2) : null;
|
|
4738
|
+
const starts = on && at2 && day !== previous;
|
|
4712
4739
|
if (day !== null) previous = day;
|
|
4713
|
-
if (!starts || !
|
|
4740
|
+
if (!starts || !at2) {
|
|
4714
4741
|
if (bubble.hasAttribute("data-date")) bubble.removeAttribute("data-date");
|
|
4715
4742
|
return;
|
|
4716
4743
|
}
|
|
4717
4744
|
const elapsed = Math.round((today - day) / 864e5);
|
|
4718
|
-
const label = elapsed === 0 ? cfg.t("conversationGroupToday") : elapsed === 1 ? cfg.t("conversationGroupYesterday") : longDate(
|
|
4745
|
+
const label = elapsed === 0 ? cfg.t("conversationGroupToday") : elapsed === 1 ? cfg.t("conversationGroupYesterday") : longDate(at2, cfg.getLocale().tag);
|
|
4719
4746
|
if (bubble.getAttribute("data-date") !== label) bubble.setAttribute("data-date", label);
|
|
4720
4747
|
});
|
|
4721
4748
|
}
|
|
@@ -4765,11 +4792,7 @@ class AparteChatViewport extends HTMLElement {
|
|
|
4765
4792
|
}
|
|
4766
4793
|
_dispatchPathChanged(messages, siblings) {
|
|
4767
4794
|
const detail = { messages, siblings };
|
|
4768
|
-
this
|
|
4769
|
-
bubbles: true,
|
|
4770
|
-
composed: true,
|
|
4771
|
-
detail
|
|
4772
|
-
}));
|
|
4795
|
+
dispatchChatEvent(this, "aparte-path-changed", detail);
|
|
4773
4796
|
}
|
|
4774
4797
|
_autoScroll() {
|
|
4775
4798
|
if (this._isAutoScrollEnabled) {
|
|
@@ -5616,6 +5639,7 @@ class AparteComposer extends HTMLElement {
|
|
|
5616
5639
|
this._offTypeToFocus = null;
|
|
5617
5640
|
}
|
|
5618
5641
|
attributeChangedCallback(name, _old, value) {
|
|
5642
|
+
if (_old === value) return;
|
|
5619
5643
|
if (name === "disabled") {
|
|
5620
5644
|
this._emit("disabled-change", { disabled: value !== null });
|
|
5621
5645
|
}
|
|
@@ -5979,11 +6003,7 @@ class AparteComposer extends HTMLElement {
|
|
|
5979
6003
|
_emit(event, payload) {
|
|
5980
6004
|
this._listeners.get(event)?.forEach((cb) => cb(payload));
|
|
5981
6005
|
if (AparteComposer._STATE_EVENTS.has(event)) {
|
|
5982
|
-
this
|
|
5983
|
-
bubbles: true,
|
|
5984
|
-
composed: true,
|
|
5985
|
-
detail: { state: this.getState(), composer: this }
|
|
5986
|
-
}));
|
|
6006
|
+
dispatchChatEvent(this, "aparte-composer-change", { state: this.getState(), composer: this });
|
|
5987
6007
|
}
|
|
5988
6008
|
}
|
|
5989
6009
|
/** @internal The composer parts' own bus. From outside, listen for `aparte-composer-change`. */
|
|
@@ -6026,16 +6046,7 @@ class AparteComposer extends HTMLElement {
|
|
|
6026
6046
|
console.warn(`[aparte-composer] this composer belongs to no chat while the page has several: give it target="<chat id>" or place it under a chat host with an id, or it will answer to every chat's events.`);
|
|
6027
6047
|
}
|
|
6028
6048
|
_ownTargetId() {
|
|
6029
|
-
|
|
6030
|
-
if (attr) return attr;
|
|
6031
|
-
let el2 = this.parentElement;
|
|
6032
|
-
while (el2) {
|
|
6033
|
-
const tag = el2.tagName?.toLowerCase();
|
|
6034
|
-
const isHost = tag === "aparte-chat" || el2.hasAttribute?.("data-aparte-chat");
|
|
6035
|
-
if (isHost && el2.id) return el2.id;
|
|
6036
|
-
el2 = el2.parentElement;
|
|
6037
|
-
}
|
|
6038
|
-
return void 0;
|
|
6049
|
+
return chatIdOf(this);
|
|
6039
6050
|
}
|
|
6040
6051
|
/**
|
|
6041
6052
|
* The message this composer's turn is writing, when the event that started it said.
|
|
@@ -6210,6 +6221,7 @@ class AparteComposerInput extends HTMLElement {
|
|
|
6210
6221
|
this._unsubscribes = [];
|
|
6211
6222
|
}
|
|
6212
6223
|
attributeChangedCallback(name, _old, value) {
|
|
6224
|
+
if (_old === value) return;
|
|
6213
6225
|
if (name === "placeholder") this._updatePlaceholder();
|
|
6214
6226
|
if (name === "max-height") this._maxHeight = parseInt(value || "200", 10);
|
|
6215
6227
|
if (name === "min-height") this._minHeight = parseInt(value || "44", 10);
|
|
@@ -6524,6 +6536,7 @@ class AparteComposerSend extends HTMLElement {
|
|
|
6524
6536
|
data-act="send"
|
|
6525
6537
|
${disabled ? "disabled" : ""}
|
|
6526
6538
|
>${icon}</button>`;
|
|
6539
|
+
this.setAttribute("data-act", "send");
|
|
6527
6540
|
}
|
|
6528
6541
|
_connectToRoot() {
|
|
6529
6542
|
const root = this._getRoot();
|
|
@@ -6592,7 +6605,7 @@ class AparteComposerSend extends HTMLElement {
|
|
|
6592
6605
|
}
|
|
6593
6606
|
this._button.disabled = !panel.submitEnabled;
|
|
6594
6607
|
this._button.innerHTML = this._getSubmitIcon();
|
|
6595
|
-
this.
|
|
6608
|
+
this._setAct("submit");
|
|
6596
6609
|
const label = cfg.t("submitButton") || "Submit";
|
|
6597
6610
|
this._button.setAttribute("aria-label", label);
|
|
6598
6611
|
this._button.setAttribute("title", label);
|
|
@@ -6602,6 +6615,15 @@ class AparteComposerSend extends HTMLElement {
|
|
|
6602
6615
|
e.preventDefault();
|
|
6603
6616
|
this._getRoot()?.submit();
|
|
6604
6617
|
}
|
|
6618
|
+
/**
|
|
6619
|
+
* What a press does now, said on the button (where the stylesheet reads it) and on this
|
|
6620
|
+
* element (where a test does: it asks for the act, then presses the button inside).
|
|
6621
|
+
* One writer, so the two can never say different things.
|
|
6622
|
+
*/
|
|
6623
|
+
_setAct(act) {
|
|
6624
|
+
this._button?.setAttribute("data-act", act);
|
|
6625
|
+
this.setAttribute("data-act", act);
|
|
6626
|
+
}
|
|
6605
6627
|
_syncState() {
|
|
6606
6628
|
const root = this._getRoot();
|
|
6607
6629
|
if (!root || !this._button) return;
|
|
@@ -6609,7 +6631,7 @@ class AparteComposerSend extends HTMLElement {
|
|
|
6609
6631
|
const isEmpty = root.value.trim() === "" && root.attachments.length === 0;
|
|
6610
6632
|
this._button.disabled = root.disabled || isEmpty;
|
|
6611
6633
|
this._button.innerHTML = this._getSendIcon();
|
|
6612
|
-
this.
|
|
6634
|
+
this._setAct("send");
|
|
6613
6635
|
const label = resolveConfig(this).t("sendButton") || "Send";
|
|
6614
6636
|
this._button.setAttribute("aria-label", label);
|
|
6615
6637
|
this._button.setAttribute("title", label);
|
|
@@ -6620,7 +6642,7 @@ class AparteComposerSend extends HTMLElement {
|
|
|
6620
6642
|
if (streaming) {
|
|
6621
6643
|
this._button.disabled = false;
|
|
6622
6644
|
this._button.innerHTML = this._getStopIcon();
|
|
6623
|
-
this.
|
|
6645
|
+
this._setAct("stop");
|
|
6624
6646
|
const label = resolveConfig(this).t("stopButton") || "Stop";
|
|
6625
6647
|
this._button.setAttribute("aria-label", label);
|
|
6626
6648
|
this._button.setAttribute("title", label);
|
|
@@ -6812,11 +6834,7 @@ class AparteComposerAttachments extends HTMLElement {
|
|
|
6812
6834
|
img.setAttribute("tabindex", "0");
|
|
6813
6835
|
img.setAttribute("aria-label", images[i2]?.name ?? "");
|
|
6814
6836
|
const open = () => {
|
|
6815
|
-
this
|
|
6816
|
-
bubbles: true,
|
|
6817
|
-
composed: true,
|
|
6818
|
-
detail: { url: img.src, name: images[i2]?.name ?? "", type: images[i2]?.type ?? "" }
|
|
6819
|
-
}));
|
|
6837
|
+
dispatchChatEvent(this, "aparte-attachment-preview", { url: img.src, name: images[i2]?.name ?? "", type: images[i2]?.type ?? "" });
|
|
6820
6838
|
};
|
|
6821
6839
|
img.addEventListener("click", open);
|
|
6822
6840
|
img.addEventListener("keydown", (e) => {
|
|
@@ -6861,6 +6879,7 @@ class AparteComposerAddAttachment extends HTMLElement {
|
|
|
6861
6879
|
this._unsubscribes = [];
|
|
6862
6880
|
}
|
|
6863
6881
|
attributeChangedCallback(name, _old, value) {
|
|
6882
|
+
if (_old === value) return;
|
|
6864
6883
|
if (name === "disabled" && this._button) {
|
|
6865
6884
|
this._button.disabled = value !== null;
|
|
6866
6885
|
}
|
|
@@ -6992,6 +7011,7 @@ class AparteComposerAction extends HTMLElement {
|
|
|
6992
7011
|
this._unsubscribes = [];
|
|
6993
7012
|
}
|
|
6994
7013
|
attributeChangedCallback(name, _old, value) {
|
|
7014
|
+
if (_old === value) return;
|
|
6995
7015
|
if (!this._button) return;
|
|
6996
7016
|
if (name === "disabled") {
|
|
6997
7017
|
this._button.disabled = value !== null;
|
|
@@ -7036,11 +7056,7 @@ class AparteComposerAction extends HTMLElement {
|
|
|
7036
7056
|
);
|
|
7037
7057
|
}
|
|
7038
7058
|
_handleClick(_e) {
|
|
7039
|
-
this
|
|
7040
|
-
bubbles: true,
|
|
7041
|
-
composed: true,
|
|
7042
|
-
detail: { actionId: this.getAttribute("action-id") ?? "", composer: this._getRoot() }
|
|
7043
|
-
}));
|
|
7059
|
+
dispatchChatEvent(this, "aparte-action-click", { actionId: this.getAttribute("action-id") ?? "", composer: this._getRoot() });
|
|
7044
7060
|
}
|
|
7045
7061
|
_resolveIcon(icon) {
|
|
7046
7062
|
if (!icon) return "";
|
|
@@ -7253,14 +7269,77 @@ class AparteConversationList extends HTMLElement {
|
|
|
7253
7269
|
if (status === "waiting") return this._t("conversationWaiting");
|
|
7254
7270
|
return "";
|
|
7255
7271
|
}
|
|
7256
|
-
/**
|
|
7272
|
+
/**
|
|
7273
|
+
* Set the list of conversations to display. Triggers a re-render — held while a row's menu is
|
|
7274
|
+
* open or a title is being renamed, and run when that ends.
|
|
7275
|
+
*
|
|
7276
|
+
* A host assigns this on every manager change, and a wrapper on every render of the app around
|
|
7277
|
+
* it, often the very array the list holds (mutated in place, so it is drawn again rather than
|
|
7278
|
+
* skipped). A render replaces the rows, and with them the open menu and the field being typed
|
|
7279
|
+
* in: those are the reader's, so the rows wait for them, as they wait for a press to land.
|
|
7280
|
+
*/
|
|
7257
7281
|
set conversations(items) {
|
|
7258
7282
|
this._conversations = Array.isArray(items) ? items : [];
|
|
7283
|
+
this._renderUnlessHeld();
|
|
7284
|
+
}
|
|
7285
|
+
/** A render held by an open menu or a rename (see `conversations`): run once it is over. */
|
|
7286
|
+
_renderAfterMenu = false;
|
|
7287
|
+
/**
|
|
7288
|
+
* The one way a render asked from outside runs: held while a row menu is open or a title is
|
|
7289
|
+
* being renamed, drawn once that ends. A press's deferred render goes through it too, so a
|
|
7290
|
+
* rename started by the click that closed a menu is not wiped by the render that menu held.
|
|
7291
|
+
*/
|
|
7292
|
+
_renderUnlessHeld() {
|
|
7293
|
+
if (this._renaming && !this._renaming.done || this.querySelector("[data-menu-for]")) {
|
|
7294
|
+
this._renderAfterMenu = true;
|
|
7295
|
+
return;
|
|
7296
|
+
}
|
|
7297
|
+
this._render();
|
|
7298
|
+
}
|
|
7299
|
+
_renderHeld() {
|
|
7300
|
+
if (!this._renderAfterMenu || !this.isConnected) return;
|
|
7301
|
+
this._renderAfterMenu = false;
|
|
7259
7302
|
this._render();
|
|
7260
7303
|
}
|
|
7261
7304
|
get conversations() {
|
|
7262
7305
|
return this._conversations;
|
|
7263
7306
|
}
|
|
7307
|
+
_renderMeta = null;
|
|
7308
|
+
/**
|
|
7309
|
+
* Draws something of the app's after a row's title — a shared mark, a count, a status
|
|
7310
|
+
* pill — and returns `null` for a row with nothing to say. An element goes in as it is;
|
|
7311
|
+
* a string is text, never markup. It sits BESIDE the title button, not inside it, so it
|
|
7312
|
+
* may hold a button or a link of its own, with its own accessible name. Setting it draws
|
|
7313
|
+
* the rows again, held like `conversations` while a menu is open or a title is being
|
|
7314
|
+
* renamed; the same function handed again draws nothing. It is read on every render after that.
|
|
7315
|
+
*/
|
|
7316
|
+
set renderMeta(fn) {
|
|
7317
|
+
const next = typeof fn === "function" ? fn : null;
|
|
7318
|
+
if (next === this._renderMeta) return;
|
|
7319
|
+
this._renderMeta = next;
|
|
7320
|
+
this._renderUnlessHeld();
|
|
7321
|
+
}
|
|
7322
|
+
get renderMeta() {
|
|
7323
|
+
return this._renderMeta;
|
|
7324
|
+
}
|
|
7325
|
+
/** Puts what `renderMeta` returns after each row's title. Rows are strings, so this runs on the built DOM. */
|
|
7326
|
+
_applyMeta() {
|
|
7327
|
+
const draw2 = this._renderMeta;
|
|
7328
|
+
if (!draw2) return;
|
|
7329
|
+
const byId = new Map(this._conversations.map((c2) => [c2.id, c2]));
|
|
7330
|
+
for (const row of this.querySelectorAll("[data-conv-id]")) {
|
|
7331
|
+
const item = byId.get(row.dataset["convId"] ?? "");
|
|
7332
|
+
const select = row.querySelector(".aparte-conv-item__select");
|
|
7333
|
+
if (!item || !select) continue;
|
|
7334
|
+
const made = draw2(item);
|
|
7335
|
+
if (made === null || made === void 0 || made === "") continue;
|
|
7336
|
+
const slot = document.createElement("span");
|
|
7337
|
+
slot.className = "aparte-conv-item__meta";
|
|
7338
|
+
if (typeof made === "string") slot.textContent = made;
|
|
7339
|
+
else slot.append(made);
|
|
7340
|
+
select.after(slot);
|
|
7341
|
+
}
|
|
7342
|
+
}
|
|
7264
7343
|
// ─── Rendering ────────────────────────────────────────────────────────
|
|
7265
7344
|
/**
|
|
7266
7345
|
* A press holds every render until its click has landed. The host re-assigns
|
|
@@ -7287,7 +7366,7 @@ class AparteConversationList extends HTMLElement {
|
|
|
7287
7366
|
this._pressed = false;
|
|
7288
7367
|
if (!this._renderAfterPress) return;
|
|
7289
7368
|
this._renderAfterPress = false;
|
|
7290
|
-
if (this.isConnected) this.
|
|
7369
|
+
if (this.isConnected) this._renderUnlessHeld();
|
|
7291
7370
|
}, 0);
|
|
7292
7371
|
};
|
|
7293
7372
|
/** The name this element last wrote, so one the app wrote — before or after connect — is left alone. */
|
|
@@ -7302,6 +7381,7 @@ class AparteConversationList extends HTMLElement {
|
|
|
7302
7381
|
this._renderAfterPress = true;
|
|
7303
7382
|
return;
|
|
7304
7383
|
}
|
|
7384
|
+
this._renderAfterMenu = false;
|
|
7305
7385
|
this._releaseMenus();
|
|
7306
7386
|
this._renaming = null;
|
|
7307
7387
|
const focused2 = activeElementIn(this);
|
|
@@ -7332,6 +7412,7 @@ class AparteConversationList extends HTMLElement {
|
|
|
7332
7412
|
} else {
|
|
7333
7413
|
this.innerHTML = groups;
|
|
7334
7414
|
}
|
|
7415
|
+
this._applyMeta();
|
|
7335
7416
|
this._applyFilter();
|
|
7336
7417
|
this._wireMenus();
|
|
7337
7418
|
if (!restore) return;
|
|
@@ -7399,7 +7480,7 @@ class AparteConversationList extends HTMLElement {
|
|
|
7399
7480
|
*/
|
|
7400
7481
|
_groups() {
|
|
7401
7482
|
const items = this._conversations;
|
|
7402
|
-
if (this.hasAttribute("flat") || !items.some((c2) => typeof c2.updatedAt === "number")) {
|
|
7483
|
+
if (this.hasAttribute("flat") || !items.some((c2) => typeof c2.updatedAt === "number" || c2.group)) {
|
|
7403
7484
|
return [{ key: "all", label: null, items }];
|
|
7404
7485
|
}
|
|
7405
7486
|
const now = /* @__PURE__ */ new Date();
|
|
@@ -7414,22 +7495,32 @@ class AparteConversationList extends HTMLElement {
|
|
|
7414
7495
|
}
|
|
7415
7496
|
g.items.push(item);
|
|
7416
7497
|
};
|
|
7498
|
+
const named = /* @__PURE__ */ new Map();
|
|
7417
7499
|
for (const c2 of items) {
|
|
7500
|
+
if (c2.group) {
|
|
7501
|
+
let g = named.get(c2.group.key);
|
|
7502
|
+
if (!g) {
|
|
7503
|
+
g = { key: c2.group.key, label: c2.group.label, items: [] };
|
|
7504
|
+
named.set(c2.group.key, g);
|
|
7505
|
+
}
|
|
7506
|
+
g.items.push(c2);
|
|
7507
|
+
continue;
|
|
7508
|
+
}
|
|
7418
7509
|
if (c2.pinnedAt) {
|
|
7419
7510
|
push("pinned", this._t("conversationGroupPinned"), c2);
|
|
7420
7511
|
continue;
|
|
7421
7512
|
}
|
|
7422
|
-
const
|
|
7423
|
-
if (typeof
|
|
7513
|
+
const at2 = c2.updatedAt;
|
|
7514
|
+
if (typeof at2 !== "number") {
|
|
7424
7515
|
push("undated", null, c2);
|
|
7425
7516
|
continue;
|
|
7426
7517
|
}
|
|
7427
|
-
if (
|
|
7428
|
-
else if (
|
|
7429
|
-
else if (
|
|
7430
|
-
else if (
|
|
7518
|
+
if (at2 >= today) push("today", this._t("conversationGroupToday"), c2);
|
|
7519
|
+
else if (at2 >= today - DAY) push("yesterday", this._t("conversationGroupYesterday"), c2);
|
|
7520
|
+
else if (at2 >= today - 7 * DAY) push("week", this._t("conversationGroupWeek"), c2);
|
|
7521
|
+
else if (at2 >= today - 30 * DAY) push("month", this._t("conversationGroupMonth"), c2);
|
|
7431
7522
|
else {
|
|
7432
|
-
const d2 = new Date(
|
|
7523
|
+
const d2 = new Date(at2);
|
|
7433
7524
|
const sameYear = d2.getFullYear() === now.getFullYear();
|
|
7434
7525
|
const raw = new Intl.DateTimeFormat(tag, sameYear ? { month: "long" } : { month: "long", year: "numeric" }).format(d2);
|
|
7435
7526
|
const label = raw.charAt(0).toLocaleUpperCase(tag) + raw.slice(1);
|
|
@@ -7439,7 +7530,7 @@ class AparteConversationList extends HTMLElement {
|
|
|
7439
7530
|
const fixed = ["pinned", "today", "yesterday", "week", "month"].map((k2) => buckets.get(k2)).filter((g) => !!g);
|
|
7440
7531
|
const months = [...buckets.keys()].filter((k2) => k2.startsWith("m-")).sort((a2, b3) => b3.localeCompare(a2)).map((k2) => buckets.get(k2));
|
|
7441
7532
|
const undated = buckets.get("undated");
|
|
7442
|
-
return [...fixed, ...months, ...undated ? [undated] : []];
|
|
7533
|
+
return [...named.values(), ...fixed, ...months, ...undated ? [undated] : []];
|
|
7443
7534
|
}
|
|
7444
7535
|
_renderGroup(group) {
|
|
7445
7536
|
const rows = group.items.map((conv) => this._renderItem(conv)).join("");
|
|
@@ -7564,7 +7655,10 @@ class AparteConversationList extends HTMLElement {
|
|
|
7564
7655
|
margin: VIEWPORT_MARGIN,
|
|
7565
7656
|
align: "end",
|
|
7566
7657
|
onOpen: () => this._fillMenu(row, menu),
|
|
7567
|
-
onClose: () =>
|
|
7658
|
+
onClose: () => {
|
|
7659
|
+
menu.remove();
|
|
7660
|
+
this._renderHeld();
|
|
7661
|
+
}
|
|
7568
7662
|
}));
|
|
7569
7663
|
}
|
|
7570
7664
|
const context = this._contextMenu ??= this._newMenu();
|
|
@@ -7576,7 +7670,10 @@ class AparteConversationList extends HTMLElement {
|
|
|
7576
7670
|
if (!row || !this.contains(row) || target.closest("[data-rename-id], [data-menu-for]")) return false;
|
|
7577
7671
|
return this._fillMenu(row, context);
|
|
7578
7672
|
},
|
|
7579
|
-
onClose: () =>
|
|
7673
|
+
onClose: () => {
|
|
7674
|
+
context.remove();
|
|
7675
|
+
this._renderHeld();
|
|
7676
|
+
}
|
|
7580
7677
|
}));
|
|
7581
7678
|
}
|
|
7582
7679
|
/** Closes whichever menu is open, without moving the focus, and stops them all. */
|
|
@@ -7930,7 +8027,8 @@ class AparteSuggestions extends HTMLElement {
|
|
|
7930
8027
|
this._stopHolding();
|
|
7931
8028
|
window.removeEventListener("aparte-config-change", this._onConfigChange);
|
|
7932
8029
|
}
|
|
7933
|
-
attributeChangedCallback(name) {
|
|
8030
|
+
attributeChangedCallback(name, previous, value) {
|
|
8031
|
+
if (previous === value) return;
|
|
7934
8032
|
if (!this.isConnected) return;
|
|
7935
8033
|
if (name === "suggestions") {
|
|
7936
8034
|
this._readAttribute();
|
|
@@ -8056,6 +8154,11 @@ class AparteSuggestions extends HTMLElement {
|
|
|
8056
8154
|
}
|
|
8057
8155
|
}
|
|
8058
8156
|
_render() {
|
|
8157
|
+
const was = this.querySelector(".aparte-suggestions");
|
|
8158
|
+
const chips = was ? [...was.querySelectorAll(".aparte-suggestion")] : [];
|
|
8159
|
+
const focused2 = chips.findIndex((chip) => chip === document.activeElement);
|
|
8160
|
+
const focusedText = focused2 >= 0 ? chips[focused2].textContent : null;
|
|
8161
|
+
const scroll = was?.scrollLeft ?? 0;
|
|
8059
8162
|
this.replaceChildren();
|
|
8060
8163
|
if (this._suggestions.length === 0) {
|
|
8061
8164
|
this.setAttribute("data-empty", "");
|
|
@@ -8077,6 +8180,10 @@ class AparteSuggestions extends HTMLElement {
|
|
|
8077
8180
|
row.appendChild(button2);
|
|
8078
8181
|
}
|
|
8079
8182
|
this.appendChild(row);
|
|
8183
|
+
row.scrollLeft = scroll;
|
|
8184
|
+
if (focused2 < 0) return;
|
|
8185
|
+
const next = [...row.children];
|
|
8186
|
+
(next.find((chip) => chip.textContent === focusedText) ?? next[Math.min(focused2, next.length - 1)])?.focus();
|
|
8080
8187
|
}
|
|
8081
8188
|
_sending = false;
|
|
8082
8189
|
_sendingTimer;
|
|
@@ -8097,13 +8204,7 @@ class AparteSuggestions extends HTMLElement {
|
|
|
8097
8204
|
};
|
|
8098
8205
|
/** The chat the sending composer belongs to: its `target`, else the id of the chat host above it. */
|
|
8099
8206
|
_ownChatId() {
|
|
8100
|
-
|
|
8101
|
-
const attr = composer?.getAttribute("target");
|
|
8102
|
-
if (attr) return attr;
|
|
8103
|
-
for (let el2 = composer?.parentElement ?? null; el2; el2 = el2.parentElement) {
|
|
8104
|
-
if ((el2.tagName.toLowerCase() === "aparte-chat" || el2.hasAttribute("data-aparte-chat")) && el2.id) return el2.id;
|
|
8105
|
-
}
|
|
8106
|
-
return void 0;
|
|
8207
|
+
return chatIdOf(this._composer);
|
|
8107
8208
|
}
|
|
8108
8209
|
/** A chip sent: no other chip sends until the turn has started, or a second has passed without one. */
|
|
8109
8210
|
_holdUntilStreaming() {
|
|
@@ -8114,12 +8215,7 @@ class AparteSuggestions extends HTMLElement {
|
|
|
8114
8215
|
}
|
|
8115
8216
|
_activate(suggestion) {
|
|
8116
8217
|
const detail = { label: labelOf(suggestion), prompt: promptOf(suggestion) };
|
|
8117
|
-
const proceed = this
|
|
8118
|
-
detail,
|
|
8119
|
-
bubbles: true,
|
|
8120
|
-
composed: true,
|
|
8121
|
-
cancelable: true
|
|
8122
|
-
}));
|
|
8218
|
+
const proceed = dispatchChatEvent(this, "aparte-suggestion", detail, { cancelable: true });
|
|
8123
8219
|
if (!proceed) return;
|
|
8124
8220
|
const composer = this._composer ?? this._resolveComposer();
|
|
8125
8221
|
if (!composer) {
|
|
@@ -8387,7 +8483,8 @@ class AparteContext extends HTMLElement {
|
|
|
8387
8483
|
this.removeEventListener("keydown", this._onKeydown);
|
|
8388
8484
|
this._stopListeningWhileOpen();
|
|
8389
8485
|
}
|
|
8390
|
-
attributeChangedCallback(name) {
|
|
8486
|
+
attributeChangedCallback(name, previous, value) {
|
|
8487
|
+
if (previous === value) return;
|
|
8391
8488
|
if (name === "used") {
|
|
8392
8489
|
const n2 = Number(this.getAttribute("used"));
|
|
8393
8490
|
this._used = this.hasAttribute("used") && Number.isFinite(n2) && n2 >= 0 ? n2 : null;
|
|
@@ -8413,15 +8510,7 @@ class AparteContext extends HTMLElement {
|
|
|
8413
8510
|
}
|
|
8414
8511
|
/** The chat this gauge watches: `target`, else the chat host above it — the composer's rule. */
|
|
8415
8512
|
_ownTargetId() {
|
|
8416
|
-
|
|
8417
|
-
if (attr) return attr;
|
|
8418
|
-
let node = this.parentElement;
|
|
8419
|
-
while (node) {
|
|
8420
|
-
const isHost = node.tagName.toLowerCase() === "aparte-chat" || node.hasAttribute("data-aparte-chat");
|
|
8421
|
-
if (isHost && node.id) return node.id;
|
|
8422
|
-
node = node.parentElement;
|
|
8423
|
-
}
|
|
8424
|
-
return void 0;
|
|
8513
|
+
return chatIdOf(this);
|
|
8425
8514
|
}
|
|
8426
8515
|
_isMine(targetId) {
|
|
8427
8516
|
const own = this._ownTargetId();
|
|
@@ -8842,7 +8931,8 @@ class AparteScrollRail extends HTMLElement {
|
|
|
8842
8931
|
this.removeEventListener("focusout", this._onFocusOut);
|
|
8843
8932
|
window.removeEventListener("aparte-config-change", this._onConfigChange);
|
|
8844
8933
|
}
|
|
8845
|
-
attributeChangedCallback(name) {
|
|
8934
|
+
attributeChangedCallback(name, previous, value) {
|
|
8935
|
+
if (previous === value) return;
|
|
8846
8936
|
if (!this.isConnected) return;
|
|
8847
8937
|
if (name === "target") this._attach();
|
|
8848
8938
|
else this._rebuild();
|
|
@@ -8877,8 +8967,8 @@ class AparteScrollRail extends HTMLElement {
|
|
|
8877
8967
|
}
|
|
8878
8968
|
continue;
|
|
8879
8969
|
}
|
|
8880
|
-
const
|
|
8881
|
-
const owner =
|
|
8970
|
+
const at2 = record.target instanceof Element ? record.target : record.target.parentElement;
|
|
8971
|
+
const owner = at2?.closest("aparte-chat-bubble");
|
|
8882
8972
|
if (owner) {
|
|
8883
8973
|
this._excerpts.delete(owner);
|
|
8884
8974
|
if (this._ticked(owner)) this._queueRelabel(owner);
|
|
@@ -9037,7 +9127,7 @@ class AparteScrollRail extends HTMLElement {
|
|
|
9037
9127
|
item.remove();
|
|
9038
9128
|
existing.delete(id);
|
|
9039
9129
|
}
|
|
9040
|
-
let
|
|
9130
|
+
let at2 = list.firstElementChild;
|
|
9041
9131
|
for (const bubble of bubbles) {
|
|
9042
9132
|
const id = bubble.getAttribute("message-id");
|
|
9043
9133
|
let item = existing.get(id);
|
|
@@ -9061,8 +9151,8 @@ class AparteScrollRail extends HTMLElement {
|
|
|
9061
9151
|
} else {
|
|
9062
9152
|
tick.removeAttribute("aria-current");
|
|
9063
9153
|
}
|
|
9064
|
-
if (item ===
|
|
9065
|
-
else list.insertBefore(item,
|
|
9154
|
+
if (item === at2) at2 = at2.nextElementSibling;
|
|
9155
|
+
else list.insertBefore(item, at2);
|
|
9066
9156
|
}
|
|
9067
9157
|
const dropped = this._currentId !== null && !known.has(this._currentId);
|
|
9068
9158
|
if (dropped) this._currentId = null;
|
|
@@ -9463,6 +9553,7 @@ class AparteSidebar extends HTMLElement {
|
|
|
9463
9553
|
/** The control that last opened the drawer, to hand the focus back to. */
|
|
9464
9554
|
_opener = null;
|
|
9465
9555
|
_lastCollapsed = null;
|
|
9556
|
+
_lastRail = false;
|
|
9466
9557
|
/**
|
|
9467
9558
|
* `connectedCallback` has run and the element knows what its markup asked for.
|
|
9468
9559
|
*
|
|
@@ -9511,6 +9602,14 @@ class AparteSidebar extends HTMLElement {
|
|
|
9511
9602
|
set collapsed(value) {
|
|
9512
9603
|
this.toggleAttribute("collapsed", presenceOn(value));
|
|
9513
9604
|
}
|
|
9605
|
+
/**
|
|
9606
|
+
* A rail is a column folded to `--aparte-sidebar-rail-width` that stays in the flow and
|
|
9607
|
+
* stays usable (`collapsed="rail"`). Only in the flow: a drawer is open or closed, and a
|
|
9608
|
+
* closed one is off-screen whatever its attribute says.
|
|
9609
|
+
*/
|
|
9610
|
+
_rail() {
|
|
9611
|
+
return this.getAttribute("collapsed") === "rail" && !this.drawer;
|
|
9612
|
+
}
|
|
9514
9613
|
/** True while the sidebar is a drawer: the window is under the breakpoint, or it is in a floating chat's card. */
|
|
9515
9614
|
get drawer() {
|
|
9516
9615
|
return this.hasAttribute("data-drawer");
|
|
@@ -9541,6 +9640,7 @@ class AparteSidebar extends HTMLElement {
|
|
|
9541
9640
|
this._watchBreakpoint();
|
|
9542
9641
|
this._syncHidden();
|
|
9543
9642
|
this._lastCollapsed = this.collapsed;
|
|
9643
|
+
this._lastRail = this._rail();
|
|
9544
9644
|
if (!this.id) this.id = `aparte-sidebar-${++sidebarIdSeq}`;
|
|
9545
9645
|
this._syncToggles();
|
|
9546
9646
|
this._ready = true;
|
|
@@ -9628,7 +9728,15 @@ class AparteSidebar extends HTMLElement {
|
|
|
9628
9728
|
}
|
|
9629
9729
|
if (name !== "collapsed") return;
|
|
9630
9730
|
const collapsed = this.collapsed;
|
|
9631
|
-
|
|
9731
|
+
const rail = this._rail();
|
|
9732
|
+
if (collapsed === this._lastCollapsed && rail === this._lastRail) {
|
|
9733
|
+
return;
|
|
9734
|
+
}
|
|
9735
|
+
this._lastRail = rail;
|
|
9736
|
+
if (collapsed === this._lastCollapsed) {
|
|
9737
|
+
this._syncHidden();
|
|
9738
|
+
return;
|
|
9739
|
+
}
|
|
9632
9740
|
this._lastCollapsed = collapsed;
|
|
9633
9741
|
if (!this._auto && !this.drawer) this._closedByHost = collapsed;
|
|
9634
9742
|
this._syncScrim();
|
|
@@ -9721,7 +9829,7 @@ class AparteSidebar extends HTMLElement {
|
|
|
9721
9829
|
* `<aparte-sidebar inert={busy}>` out of existence. The class docblock says it in prose.
|
|
9722
9830
|
*/
|
|
9723
9831
|
_syncHidden() {
|
|
9724
|
-
if (this.collapsed) {
|
|
9832
|
+
if (this.collapsed && !this._rail()) {
|
|
9725
9833
|
this.toggleAttribute("inert", true);
|
|
9726
9834
|
this.setAttribute("aria-hidden", "true");
|
|
9727
9835
|
this._ownHidden = true;
|
|
@@ -10110,7 +10218,8 @@ class AparteSplit extends HTMLElement {
|
|
|
10110
10218
|
this._keying = false;
|
|
10111
10219
|
this._ready = false;
|
|
10112
10220
|
}
|
|
10113
|
-
attributeChangedCallback(name) {
|
|
10221
|
+
attributeChangedCallback(name, previous, value) {
|
|
10222
|
+
if (previous === value) return;
|
|
10114
10223
|
if (!this._ready) return;
|
|
10115
10224
|
switch (name) {
|
|
10116
10225
|
case "position": {
|
|
@@ -10865,6 +10974,7 @@ class AparteLauncher extends HTMLElement {
|
|
|
10865
10974
|
this._ready = false;
|
|
10866
10975
|
}
|
|
10867
10976
|
attributeChangedCallback(name, previous, value) {
|
|
10977
|
+
if (previous === value) return;
|
|
10868
10978
|
if (!this._ready) return;
|
|
10869
10979
|
if (name === "breakpoint") {
|
|
10870
10980
|
this._watchBreakpoint();
|
|
@@ -11399,68 +11509,71 @@ export {
|
|
|
11399
11509
|
v as attachConfig,
|
|
11400
11510
|
buildApprovalPanel,
|
|
11401
11511
|
buildElicitationPanel,
|
|
11402
|
-
|
|
11403
|
-
z as
|
|
11404
|
-
B as
|
|
11512
|
+
chatIdOf,
|
|
11513
|
+
z as collectRendererStyles,
|
|
11514
|
+
B as contentToText,
|
|
11515
|
+
C as contextConfig,
|
|
11405
11516
|
copyText,
|
|
11406
|
-
|
|
11407
|
-
|
|
11408
|
-
|
|
11409
|
-
|
|
11410
|
-
|
|
11517
|
+
E as createAgentStreamRunner,
|
|
11518
|
+
F as createAparteAgentHandler,
|
|
11519
|
+
G as createAparteChatHandler,
|
|
11520
|
+
H as createSegmentList,
|
|
11521
|
+
I as createStreamAdapter,
|
|
11411
11522
|
cssEscape,
|
|
11412
|
-
|
|
11413
|
-
|
|
11523
|
+
J as declineDefaultRenderers,
|
|
11524
|
+
K as defaultSanitizer,
|
|
11414
11525
|
deferHydrationOf,
|
|
11415
|
-
|
|
11416
|
-
|
|
11417
|
-
|
|
11526
|
+
M as defineMountedSegmentRenderer,
|
|
11527
|
+
N as defineMountedToolRenderer,
|
|
11528
|
+
O as detachConfig,
|
|
11529
|
+
dispatchChatEvent,
|
|
11418
11530
|
enhanceContextMenu,
|
|
11419
11531
|
enhanceMenu,
|
|
11420
11532
|
b2 as enhanceTabs,
|
|
11421
11533
|
escapeAttr,
|
|
11422
11534
|
escapeHtml,
|
|
11423
|
-
|
|
11424
|
-
|
|
11425
|
-
|
|
11535
|
+
T as estimateTokens,
|
|
11536
|
+
U as estimateWireTokens,
|
|
11537
|
+
V as filesToAttachments,
|
|
11426
11538
|
formatDuration,
|
|
11427
|
-
|
|
11539
|
+
X as getAllRenderers,
|
|
11428
11540
|
getSegmentRenderer,
|
|
11429
|
-
|
|
11541
|
+
Z as historyFromCheckpoint,
|
|
11430
11542
|
installDefaultRenderersOnce,
|
|
11431
11543
|
installDialogTriggersOnce,
|
|
11432
11544
|
isAwaitingReply,
|
|
11433
|
-
|
|
11545
|
+
a1 as isFormatAdapter,
|
|
11434
11546
|
isSafeUrl,
|
|
11435
11547
|
isSegmentSettled,
|
|
11436
11548
|
measureContext,
|
|
11437
11549
|
onRenderersChange,
|
|
11438
|
-
|
|
11439
|
-
|
|
11550
|
+
a6 as overrideSegmentRenderer,
|
|
11551
|
+
a7 as parseAparteEventStream,
|
|
11440
11552
|
parseMarkdownToSegments,
|
|
11441
11553
|
placeFloating,
|
|
11442
11554
|
pluralize,
|
|
11443
11555
|
populateBubbleFromMessage,
|
|
11444
|
-
|
|
11556
|
+
ab as readableToAsyncIterable,
|
|
11445
11557
|
registerAllComponents,
|
|
11446
|
-
|
|
11447
|
-
|
|
11448
|
-
|
|
11449
|
-
|
|
11450
|
-
|
|
11451
|
-
|
|
11558
|
+
ac as registerDefaultRenderers,
|
|
11559
|
+
ad as registerSegmentRenderer,
|
|
11560
|
+
ae as releaseDeferredHydration,
|
|
11561
|
+
af as renderCitations,
|
|
11562
|
+
ag as renderCodeLanguages,
|
|
11563
|
+
ah as requestUserInput,
|
|
11452
11564
|
resolveConfig,
|
|
11453
11565
|
revokeAttachmentUrls,
|
|
11454
|
-
|
|
11566
|
+
ak as runSubAgent,
|
|
11455
11567
|
runWithConfig,
|
|
11456
|
-
|
|
11568
|
+
am as segmentDuration,
|
|
11457
11569
|
segmentTiming,
|
|
11458
|
-
|
|
11459
|
-
|
|
11570
|
+
ao as setupSuggestionBlocks,
|
|
11571
|
+
ap as startSubAgent,
|
|
11460
11572
|
subscribeConfigChange,
|
|
11461
|
-
|
|
11462
|
-
|
|
11463
|
-
|
|
11464
|
-
uuid
|
|
11573
|
+
ar as toToolCallView,
|
|
11574
|
+
as as toolRefusal,
|
|
11575
|
+
at as unregisterSegmentRenderer,
|
|
11576
|
+
uuid,
|
|
11577
|
+
av as withoutAbandonedTurns
|
|
11465
11578
|
};
|
|
11466
11579
|
//# sourceMappingURL=index.js.map
|