@aparte/core 1.6.0 → 1.8.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/aparte-client.d.ts +8 -0
- package/dist/client/aparte-client.d.ts.map +1 -1
- package/dist/client/stream-adapter.d.ts +20 -0
- package/dist/client/stream-adapter.d.ts.map +1 -1
- package/dist/client/wire-history.d.ts +2 -0
- package/dist/client/wire-history.d.ts.map +1 -1
- package/dist/components/bubble/aparte-chat-bubble.d.ts +14 -0
- package/dist/components/bubble/aparte-chat-bubble.d.ts.map +1 -1
- package/dist/components/conversation-list/aparte-conversation-list.d.ts +46 -22
- package/dist/components/conversation-list/aparte-conversation-list.d.ts.map +1 -1
- package/dist/components/viewport/aparte-chat-viewport.d.ts +5 -0
- package/dist/components/viewport/aparte-chat-viewport.d.ts.map +1 -1
- package/dist/config/aparte-config.d.ts +44 -1
- package/dist/config/aparte-config.d.ts.map +1 -1
- package/dist/config/bubble-shell-renderer.d.ts +3 -0
- package/dist/config/bubble-shell-renderer.d.ts.map +1 -1
- package/dist/config/index.d.ts +1 -1
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/locale.d.ts +7 -0
- package/dist/config/locale.d.ts.map +1 -1
- package/dist/custom-elements.json +723 -71
- package/dist/{defer-hydration-W4yhnyfc.js → defer-hydration-BE2ToXC_.js} +452 -202
- package/dist/defer-hydration-BE2ToXC_.js.map +1 -0
- package/dist/elicitation/panel.d.ts.map +1 -1
- package/dist/host/aparte-chat-host.d.ts +8 -0
- package/dist/host/aparte-chat-host.d.ts.map +1 -1
- package/dist/index.css +1 -1
- package/dist/index.d.ts +6 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +241 -181
- package/dist/index.js.map +1 -1
- package/dist/index.node.d.ts +6 -2
- package/dist/index.node.d.ts.map +1 -1
- package/dist/index.node.js +52 -47
- package/dist/index.node.js.map +1 -1
- package/dist/kit-keyboard-BUSLQ5i4.js +434 -0
- package/dist/kit-keyboard-BUSLQ5i4.js.map +1 -0
- package/dist/renderers/segment-renderers.d.ts.map +1 -1
- package/dist/renderers/segments/activity.d.ts +5 -0
- package/dist/renderers/segments/activity.d.ts.map +1 -0
- package/dist/renderers/segments/tool-call.d.ts.map +1 -1
- package/dist/transport/agent-handler.d.ts +7 -0
- package/dist/transport/agent-handler.d.ts.map +1 -1
- package/dist/types/chat.d.ts +22 -0
- package/dist/types/chat.d.ts.map +1 -1
- package/dist/types/event-map.d.ts +4 -0
- package/dist/types/event-map.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/segments.d.ts +62 -1
- package/dist/types/segments.d.ts.map +1 -1
- package/dist/types/tools.d.ts +46 -1
- package/dist/types/tools.d.ts.map +1 -1
- package/dist/utils/menu.d.ts +90 -0
- package/dist/utils/menu.d.ts.map +1 -0
- package/dist/utils/segments.d.ts +2 -0
- package/dist/utils/segments.d.ts.map +1 -1
- package/dist/utils/tabs.d.ts +49 -0
- package/dist/utils/tabs.d.ts.map +1 -0
- package/package.json +2 -2
- package/dist/defer-hydration-W4yhnyfc.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { A, a, b, c, d, f, h, i, j, k, l, m, n, p, s, S, u, v, y, z, B, D, E, F, G, H, J,
|
|
1
|
+
import { K as deferHydrationOf, ag as resolveConfig, ao as subscribeConfigChange, aj as runWithConfig, o as AparteElicitationAbortError, w as buildApprovalPanel, x as buildElicitationPanel, at as gateGlide, O as escapeAttr, al as segmentTiming, au as chatBoundaryOf, av as relabelCodeLanguages, aw as relabelCitations, ax as toolCallRenderer, ay as activityRenderer, t as aparteGlobalConfig, az as isMountedRenderer, aA as renderingVersionOf, a3 as onRenderersChange, aB as renderSourceList, aC as mergeSegmentUpdate, a1 as isSegmentSettled, a7 as pluralize, U as formatDuration, aD as toolNameOf, P as escapeHtml, aE as writeStreamedMarkdown, aF as replaceHighlighted, a0 as isSafeUrl, C as copyText, W as getSegmentRenderer, Y as installDefaultRenderersOnce, aG as toolRendererThatDrew, aH as activityRendererThatDrew, r as AparteMessageRepository, aI as CheckpointStateWatcher, aJ as chatIdOf, aK as stampSegmentActivity, aL as stampSegmentOnInsert, aM as stampSegmentOnUpdate, aN as renumberSegments, aO as openSegmentIds, aP as isTerminalStatus, aQ as adoptMessageSegments, _ as isAwaitingReply, a8 as populateBubbleFromMessage, as as uuid, ah as revokeAttachmentUrls, a6 as parseMarkdownToSegments, aR as APARTE_DERIVED_SEGMENTS, aS as rememberConversationStatus, aT as tellConversationStatus, aU as conversationStatusOf, e as APARTE_DEFAULT_LOCALE, aV as visibleReply, aW as usageTokens, q as AparteErrorCode, a2 as measureContext, aX as inRenderedContent, g as APARTE_HOST_ATTR, Z as installDialogTriggersOnce } from "./defer-hydration-BE2ToXC_.js";
|
|
2
|
+
import { A, a, b, c, d, f, h, i, j, k, l, m, n, p, s, S, u, v, y, z, B, D, E, F, G, H, I, J, L, M, N, Q, R, T, V, X, $, a4, a5, a9, aa, ab, ac, ad, ae, af, ai, ak, am, an, ap, aq, ar } from "./defer-hydration-BE2ToXC_.js";
|
|
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
|
+
import { b as b2 } from "./kit-keyboard-BUSLQ5i4.js";
|
|
3
5
|
function presenceOn(value) {
|
|
4
6
|
return value === "" ? true : Boolean(value);
|
|
5
7
|
}
|
|
@@ -1383,7 +1385,7 @@ function draw(root, content, token) {
|
|
|
1383
1385
|
}
|
|
1384
1386
|
function drawMessageTokens(root, content, tokens) {
|
|
1385
1387
|
if (root.querySelector(".aparte-inline-token")) return;
|
|
1386
|
-
for (const token of [...tokens].sort((a2,
|
|
1388
|
+
for (const token of [...tokens].sort((a2, b3) => b3.start - a2.start)) {
|
|
1387
1389
|
if (token.text) draw(root, content, token);
|
|
1388
1390
|
}
|
|
1389
1391
|
}
|
|
@@ -1499,6 +1501,11 @@ function buildCheckpointSeparator(options) {
|
|
|
1499
1501
|
}
|
|
1500
1502
|
return root;
|
|
1501
1503
|
}
|
|
1504
|
+
function innerRendererThatDrew(segment, el2) {
|
|
1505
|
+
if (segment.type === "tool_call") return toolRendererThatDrew(el2);
|
|
1506
|
+
if (segment.type === "activity") return activityRendererThatDrew(el2);
|
|
1507
|
+
return null;
|
|
1508
|
+
}
|
|
1502
1509
|
let _warnedNoRenderer = false;
|
|
1503
1510
|
function warnMissingRenderer(type) {
|
|
1504
1511
|
if (_warnedNoRenderer) return;
|
|
@@ -1556,6 +1563,8 @@ class AparteChatBubble extends HTMLElement {
|
|
|
1556
1563
|
_role = "assistant";
|
|
1557
1564
|
_attachments = [];
|
|
1558
1565
|
_usage = null;
|
|
1566
|
+
/** The step the agent is on while this reply waits: live only, never part of the message. */
|
|
1567
|
+
_step = null;
|
|
1559
1568
|
_finishReason = null;
|
|
1560
1569
|
/** The checkpoint this message carries: the separator above it is drawn from it. */
|
|
1561
1570
|
_contextSummary = null;
|
|
@@ -1658,6 +1667,12 @@ class AparteChatBubble extends HTMLElement {
|
|
|
1658
1667
|
if (!name || cfg.isToolHidden(name)) return null;
|
|
1659
1668
|
return cfg.getToolRenderer(name) ?? null;
|
|
1660
1669
|
}
|
|
1670
|
+
/** The tool or activity renderer in effect for a segment, when core's own renderer for its type is what draws it. */
|
|
1671
|
+
_innerRendererFor(segment) {
|
|
1672
|
+
if (segment.type !== "activity") return this._toolRendererFor(segment);
|
|
1673
|
+
if (resolveSegmentRenderer("activity", this._cfg) !== activityRenderer) return null;
|
|
1674
|
+
return this._cfg.getActivityRenderer(segment.activityType) ?? null;
|
|
1675
|
+
}
|
|
1661
1676
|
/**
|
|
1662
1677
|
* Record a segment as drawn, set it up, then read back which tool renderer is behind the
|
|
1663
1678
|
* row (tool-call.ts records it as the row is set up — one record, not a second lookup).
|
|
@@ -1671,7 +1686,7 @@ class AparteChatBubble extends HTMLElement {
|
|
|
1671
1686
|
this._drawn.set(segment.id, drawn);
|
|
1672
1687
|
if (!this.isConnected) this._scheduleReleaseCheck();
|
|
1673
1688
|
if (renderer?.setup) runWithConfig(this._cfg, () => renderer.setup(el2, drawnAs));
|
|
1674
|
-
|
|
1689
|
+
drawn.tool = innerRendererThatDrew(segment, el2);
|
|
1675
1690
|
}
|
|
1676
1691
|
/**
|
|
1677
1692
|
* The segment as its renderer's `setup` sees it: one ADDED while the message streams is
|
|
@@ -1757,7 +1772,7 @@ class AparteChatBubble extends HTMLElement {
|
|
|
1757
1772
|
}
|
|
1758
1773
|
/** The renderer that drew this segment is still the one in effect (for a tool call, the tool renderer too). */
|
|
1759
1774
|
_stillDrawnByCurrent(segment, drawn) {
|
|
1760
|
-
return resolveSegmentRenderer(segment.type, this._cfg) === drawn.renderer && this.
|
|
1775
|
+
return resolveSegmentRenderer(segment.type, this._cfg) === drawn.renderer && this._innerRendererFor(segment) === drawn.tool;
|
|
1761
1776
|
}
|
|
1762
1777
|
/**
|
|
1763
1778
|
* A renderer registered, unregistered or overridden since these segments were drawn: draw
|
|
@@ -1788,7 +1803,7 @@ class AparteChatBubble extends HTMLElement {
|
|
|
1788
1803
|
* as that renderer is still the one in effect.
|
|
1789
1804
|
*/
|
|
1790
1805
|
_keepsItsDrawing(segment, drawn) {
|
|
1791
|
-
const mounted = isMountedRenderer(drawn.renderer) ||
|
|
1806
|
+
const mounted = isMountedRenderer(drawn.renderer) || isMountedRenderer(drawn.tool);
|
|
1792
1807
|
return mounted && this._stillDrawnByCurrent(segment, drawn);
|
|
1793
1808
|
}
|
|
1794
1809
|
/**
|
|
@@ -2102,7 +2117,7 @@ class AparteChatBubble extends HTMLElement {
|
|
|
2102
2117
|
this._applySegmentUpdate(segmentId, updated, updates);
|
|
2103
2118
|
if ("sources" in updates) this._syncSources();
|
|
2104
2119
|
this._syncCopyAction();
|
|
2105
|
-
if ("status" in updates || "isStreaming" in updates) {
|
|
2120
|
+
if ("status" in updates || "isStreaming" in updates || "queued" in updates || "deferred" in updates) {
|
|
2106
2121
|
this._syncTurns();
|
|
2107
2122
|
this._updateWaiting();
|
|
2108
2123
|
}
|
|
@@ -2189,6 +2204,21 @@ class AparteChatBubble extends HTMLElement {
|
|
|
2189
2204
|
this._usage = usage ?? null;
|
|
2190
2205
|
this._updateActionBar();
|
|
2191
2206
|
}
|
|
2207
|
+
/**
|
|
2208
|
+
* Say the step the agent is on ("Reading the parser") while this reply waits, or `null`
|
|
2209
|
+
* when it is on none. The client calls it as the run announces steps.
|
|
2210
|
+
*
|
|
2211
|
+
* Live only: the words show beside the waiting dots while the reply has nothing to show
|
|
2212
|
+
* (or between two calls), and are what a screen reader hears in place of "Typing". They
|
|
2213
|
+
* are never one of the message's segments, never saved and never sent to the model, and
|
|
2214
|
+
* they go with the reply's end even when nobody closed the step.
|
|
2215
|
+
*/
|
|
2216
|
+
setStep(name) {
|
|
2217
|
+
const next = typeof name === "string" && name.trim() ? name.trim() : null;
|
|
2218
|
+
if (next === this._step) return;
|
|
2219
|
+
this._step = next;
|
|
2220
|
+
this._updateWaiting();
|
|
2221
|
+
}
|
|
2192
2222
|
/**
|
|
2193
2223
|
* Say why the model stopped writing this reply (assistant only).
|
|
2194
2224
|
*
|
|
@@ -2541,7 +2571,8 @@ class AparteChatBubble extends HTMLElement {
|
|
|
2541
2571
|
const current = turn.querySelector(":scope > summary > .aparte-turn__current");
|
|
2542
2572
|
label.classList.toggle("aparte-shimmer", running);
|
|
2543
2573
|
label.textContent = running ? cfg.t("turnWorking") : this._turnOutcome(steps, calls.length);
|
|
2544
|
-
|
|
2574
|
+
const now = calls.filter((call) => !call.queued && call.deferred?.reason !== "queued").at(-1) ?? calls.at(-1);
|
|
2575
|
+
current.textContent = running && now ? this._stepName(now) : "";
|
|
2545
2576
|
if (openWhileRunning && !("touched" in turn.dataset)) turn.open = running;
|
|
2546
2577
|
}
|
|
2547
2578
|
_turnOutcome(steps, callCount) {
|
|
@@ -2582,7 +2613,7 @@ class AparteChatBubble extends HTMLElement {
|
|
|
2582
2613
|
const now = this._segmentsEl ? rowOf(this._segmentsEl, segmentId) : null;
|
|
2583
2614
|
if (now && now !== drawn.el) {
|
|
2584
2615
|
drawn.el = now;
|
|
2585
|
-
drawn.tool = segment
|
|
2616
|
+
drawn.tool = innerRendererThatDrew(segment, now);
|
|
2586
2617
|
}
|
|
2587
2618
|
}
|
|
2588
2619
|
} else {
|
|
@@ -2647,7 +2678,8 @@ class AparteChatBubble extends HTMLElement {
|
|
|
2647
2678
|
<div class="aparte-content" dir="auto"></div>
|
|
2648
2679
|
<div class="aparte-waiting" hidden>
|
|
2649
2680
|
<span class="aparte-dots" aria-hidden="true"><span class="aparte-dot"></span><span class="aparte-dot"></span><span class="aparte-dot"></span></span>
|
|
2650
|
-
<span class="aparte-
|
|
2681
|
+
<span class="aparte-waiting-step aparte-shimmer" aria-hidden="true" dir="auto" hidden></span>
|
|
2682
|
+
<span class="aparte-sr-only" aria-live="polite">${escapeHtml(this._cfg.getLocale().typing ?? "")}</span>
|
|
2651
2683
|
</div>
|
|
2652
2684
|
</div>
|
|
2653
2685
|
<div class="aparte-footer">
|
|
@@ -2743,8 +2775,23 @@ class AparteChatBubble extends HTMLElement {
|
|
|
2743
2775
|
const el2 = this.querySelector(".aparte-waiting");
|
|
2744
2776
|
if (!el2) return;
|
|
2745
2777
|
el2.hidden = !waiting;
|
|
2778
|
+
const step = waiting ? this._step : null;
|
|
2779
|
+
let words = el2.querySelector(".aparte-waiting-step");
|
|
2780
|
+
if (!words && step) {
|
|
2781
|
+
words = document.createElement("span");
|
|
2782
|
+
words.className = "aparte-waiting-step aparte-shimmer";
|
|
2783
|
+
words.setAttribute("aria-hidden", "true");
|
|
2784
|
+
words.dir = "auto";
|
|
2785
|
+
const dots = el2.querySelector(".aparte-dots");
|
|
2786
|
+
if (dots) dots.after(words);
|
|
2787
|
+
else el2.prepend(words);
|
|
2788
|
+
}
|
|
2789
|
+
if (words) {
|
|
2790
|
+
words.hidden = !step;
|
|
2791
|
+
if (step && words.textContent !== step) words.textContent = step;
|
|
2792
|
+
}
|
|
2746
2793
|
if (!waiting) return;
|
|
2747
|
-
const label = this._cfg.getLocale().typing;
|
|
2794
|
+
const label = step ?? this._cfg.getLocale().typing;
|
|
2748
2795
|
const sr = el2.querySelector(".aparte-sr-only");
|
|
2749
2796
|
if (sr && sr.textContent !== label) sr.textContent = label;
|
|
2750
2797
|
}
|
|
@@ -3135,7 +3182,7 @@ class AparteChatBubble extends HTMLElement {
|
|
|
3135
3182
|
* whether to offer the button at all.
|
|
3136
3183
|
*/
|
|
3137
3184
|
_copyableText() {
|
|
3138
|
-
return (this._content || this._segments.filter((s2) => s2.type !== "thinking").map((s2) => s2.content ?? "").join("\n")).trim();
|
|
3185
|
+
return (this._content || this._segments.filter((s2) => s2.type !== "thinking" && s2.type !== "activity").map((s2) => s2.content ?? "").join("\n")).trim();
|
|
3139
3186
|
}
|
|
3140
3187
|
/**
|
|
3141
3188
|
* The copy button is for text. `hidden` rather than removed: the bar is rebuilt
|
|
@@ -3209,8 +3256,8 @@ class AparteChatBubble extends HTMLElement {
|
|
|
3209
3256
|
_setRovingIndex() {
|
|
3210
3257
|
const buttons = this._rovingButtons();
|
|
3211
3258
|
if (!buttons.length) return;
|
|
3212
|
-
const usable = buttons.filter((
|
|
3213
|
-
const current = buttons.find((
|
|
3259
|
+
const usable = buttons.filter((b3) => !b3.disabled);
|
|
3260
|
+
const current = buttons.find((b3) => b3.tabIndex === 0 && !b3.disabled);
|
|
3214
3261
|
const stop = current ?? usable[0] ?? buttons[0];
|
|
3215
3262
|
for (const button2 of buttons) button2.tabIndex = button2 === stop ? 0 : -1;
|
|
3216
3263
|
}
|
|
@@ -3226,10 +3273,10 @@ class AparteChatBubble extends HTMLElement {
|
|
|
3226
3273
|
const event = e;
|
|
3227
3274
|
const keys = ["ArrowLeft", "ArrowRight", "Home", "End"];
|
|
3228
3275
|
if (!keys.includes(event.key)) return;
|
|
3229
|
-
const buttons = this._rovingButtons().filter((
|
|
3276
|
+
const buttons = this._rovingButtons().filter((b3) => !b3.disabled);
|
|
3230
3277
|
if (buttons.length === 0) return;
|
|
3231
3278
|
const active = document.activeElement;
|
|
3232
|
-
const from = buttons.findIndex((
|
|
3279
|
+
const from = buttons.findIndex((b3) => b3 === active);
|
|
3233
3280
|
if (from === -1 && event.key !== "Home" && event.key !== "End") return;
|
|
3234
3281
|
const rtl = (this.closest("[dir]")?.getAttribute("dir") ?? document.documentElement.dir) === "rtl";
|
|
3235
3282
|
const forward = rtl ? "ArrowLeft" : "ArrowRight";
|
|
@@ -3506,6 +3553,7 @@ class AparteChatBubble extends HTMLElement {
|
|
|
3506
3553
|
_updateStreaming(streaming) {
|
|
3507
3554
|
const wasStreaming = this._streaming;
|
|
3508
3555
|
this._streaming = streaming;
|
|
3556
|
+
if (!streaming) this._step = null;
|
|
3509
3557
|
const message = this.querySelector(".aparte-message");
|
|
3510
3558
|
if (message) {
|
|
3511
3559
|
message.setAttribute("data-streaming", String(streaming));
|
|
@@ -4148,11 +4196,11 @@ class AparteChatViewport extends HTMLElement {
|
|
|
4148
4196
|
this._notifyBubble(messageId, "addSegment", stamped);
|
|
4149
4197
|
this._autoScroll();
|
|
4150
4198
|
}
|
|
4151
|
-
updateSegment(a2,
|
|
4152
|
-
const clientForm = c2 === void 0 && typeof
|
|
4199
|
+
updateSegment(a2, b3, c2) {
|
|
4200
|
+
const clientForm = c2 === void 0 && typeof b3 === "object";
|
|
4153
4201
|
const messageId = clientForm ? this._activeMessageId() : a2;
|
|
4154
|
-
const segmentId = clientForm ? a2 :
|
|
4155
|
-
const updates = clientForm ?
|
|
4202
|
+
const segmentId = clientForm ? a2 : b3;
|
|
4203
|
+
const updates = clientForm ? b3 : c2;
|
|
4156
4204
|
if (!messageId) return;
|
|
4157
4205
|
const message = this._repo.getMessageById(messageId);
|
|
4158
4206
|
if (!message?.segments) return;
|
|
@@ -4164,10 +4212,10 @@ class AparteChatViewport extends HTMLElement {
|
|
|
4164
4212
|
this._notifyBubble(messageId, "updateSegment", { segmentId, updates: stamped });
|
|
4165
4213
|
}
|
|
4166
4214
|
}
|
|
4167
|
-
removeSegment(a2,
|
|
4168
|
-
const clientForm =
|
|
4215
|
+
removeSegment(a2, b3) {
|
|
4216
|
+
const clientForm = b3 === void 0;
|
|
4169
4217
|
const messageId = clientForm ? this._activeMessageId() : a2;
|
|
4170
|
-
const segmentId = clientForm ? a2 :
|
|
4218
|
+
const segmentId = clientForm ? a2 : b3;
|
|
4171
4219
|
if (!messageId || !segmentId) return;
|
|
4172
4220
|
const message = this._repo.getMessageById(messageId);
|
|
4173
4221
|
if (message?.segments) {
|
|
@@ -4204,6 +4252,13 @@ class AparteChatViewport extends HTMLElement {
|
|
|
4204
4252
|
if (message) message.usage = usage;
|
|
4205
4253
|
this._notifyBubble(messageId, "setUsage", usage);
|
|
4206
4254
|
}
|
|
4255
|
+
/**
|
|
4256
|
+
* Say the step the agent is on ("Reading the parser") in the reply's waiting indicator,
|
|
4257
|
+
* or `null` for none. Live only: handed to the bubble, never written on the message.
|
|
4258
|
+
*/
|
|
4259
|
+
setStep(messageId, name) {
|
|
4260
|
+
this._notifyBubble(messageId, "setStep", name);
|
|
4261
|
+
}
|
|
4207
4262
|
// ─────────────────────────────────────────────────────────────────────────
|
|
4208
4263
|
// Message Management
|
|
4209
4264
|
// ─────────────────────────────────────────────────────────────────────────
|
|
@@ -4513,7 +4568,7 @@ class AparteChatViewport extends HTMLElement {
|
|
|
4513
4568
|
if (!this._frameworkManagedDOM) {
|
|
4514
4569
|
const wrapper = this.querySelector(".aparte-messages-wrapper");
|
|
4515
4570
|
if (wrapper) {
|
|
4516
|
-
Array.from(wrapper.querySelectorAll("aparte-chat-bubble")).forEach((
|
|
4571
|
+
Array.from(wrapper.querySelectorAll("aparte-chat-bubble")).forEach((b3) => b3.remove());
|
|
4517
4572
|
}
|
|
4518
4573
|
}
|
|
4519
4574
|
this._setSpacerHeight(0);
|
|
@@ -4624,6 +4679,9 @@ class AparteChatViewport extends HTMLElement {
|
|
|
4624
4679
|
case "setUsage":
|
|
4625
4680
|
bubble.setUsage?.(payload);
|
|
4626
4681
|
break;
|
|
4682
|
+
case "setStep":
|
|
4683
|
+
bubble.setStep?.(payload);
|
|
4684
|
+
break;
|
|
4627
4685
|
case "update": {
|
|
4628
4686
|
const updates = payload;
|
|
4629
4687
|
const renderable = ["status", "segments", "content", "attachments", "usage", "finishReason", "contextSummary", "compaction"];
|
|
@@ -5263,7 +5321,7 @@ class AparteChatViewport extends HTMLElement {
|
|
|
5263
5321
|
this._setSpacerHeight(0);
|
|
5264
5322
|
return;
|
|
5265
5323
|
}
|
|
5266
|
-
const lastUserBubble = [...allBubbles].reverse().find((
|
|
5324
|
+
const lastUserBubble = [...allBubbles].reverse().find((b3) => b3.getAttribute("data-role") === "user");
|
|
5267
5325
|
if (!lastUserBubble) {
|
|
5268
5326
|
this._setSpacerHeight(0);
|
|
5269
5327
|
return;
|
|
@@ -7058,7 +7116,14 @@ const VIEWPORT_MARGIN = 8;
|
|
|
7058
7116
|
class AparteConversationList extends HTMLElement {
|
|
7059
7117
|
_conversations = [];
|
|
7060
7118
|
_activeId = null;
|
|
7061
|
-
|
|
7119
|
+
/**
|
|
7120
|
+
* What stops the menus of the rows on screen: one `enhanceMenu` per `⋯`, and the
|
|
7121
|
+
* context menu over the whole list. A render replaces the rows, so it releases them
|
|
7122
|
+
* all and wires the new ones.
|
|
7123
|
+
*/
|
|
7124
|
+
_menus = [];
|
|
7125
|
+
/** The context menu's element: one for the list, filled for the row it was asked about. */
|
|
7126
|
+
_contextMenu = null;
|
|
7062
7127
|
_renaming = null;
|
|
7063
7128
|
_warnedNoManager = false;
|
|
7064
7129
|
static get observedAttributes() {
|
|
@@ -7101,17 +7166,17 @@ class AparteConversationList extends HTMLElement {
|
|
|
7101
7166
|
}
|
|
7102
7167
|
this.addEventListener("click", this._onClick);
|
|
7103
7168
|
this.addEventListener("keydown", this._onKeydown);
|
|
7104
|
-
this.addEventListener("
|
|
7169
|
+
this.addEventListener("aparte-menu-select", this._onMenuSelect);
|
|
7105
7170
|
this.addEventListener("pointerdown", this._onPress);
|
|
7106
7171
|
this._render();
|
|
7107
7172
|
window.addEventListener("aparte-config-change", this._onConfigChange);
|
|
7108
7173
|
window.addEventListener("aparte-conversation-status", this._onStatus);
|
|
7109
7174
|
}
|
|
7110
7175
|
disconnectedCallback() {
|
|
7111
|
-
this.
|
|
7176
|
+
this._releaseMenus();
|
|
7112
7177
|
this.removeEventListener("click", this._onClick);
|
|
7113
7178
|
this.removeEventListener("keydown", this._onKeydown);
|
|
7114
|
-
this.removeEventListener("
|
|
7179
|
+
this.removeEventListener("aparte-menu-select", this._onMenuSelect);
|
|
7115
7180
|
this.removeEventListener("pointerdown", this._onPress);
|
|
7116
7181
|
window.removeEventListener("pointerup", this._onRelease, true);
|
|
7117
7182
|
window.removeEventListener("pointercancel", this._onRelease, true);
|
|
@@ -7237,7 +7302,7 @@ class AparteConversationList extends HTMLElement {
|
|
|
7237
7302
|
this._renderAfterPress = true;
|
|
7238
7303
|
return;
|
|
7239
7304
|
}
|
|
7240
|
-
this.
|
|
7305
|
+
this._releaseMenus();
|
|
7241
7306
|
this._renaming = null;
|
|
7242
7307
|
const focused2 = activeElementIn(this);
|
|
7243
7308
|
const held = focused2 && this.contains(focused2) ? focused2.closest("[data-select-id], [data-more-id]") : null;
|
|
@@ -7268,6 +7333,7 @@ class AparteConversationList extends HTMLElement {
|
|
|
7268
7333
|
this.innerHTML = groups;
|
|
7269
7334
|
}
|
|
7270
7335
|
this._applyFilter();
|
|
7336
|
+
this._wireMenus();
|
|
7271
7337
|
if (!restore) return;
|
|
7272
7338
|
const back = this.querySelector(restore);
|
|
7273
7339
|
if (back && visible(back)) {
|
|
@@ -7371,7 +7437,7 @@ class AparteConversationList extends HTMLElement {
|
|
|
7371
7437
|
}
|
|
7372
7438
|
}
|
|
7373
7439
|
const fixed = ["pinned", "today", "yesterday", "week", "month"].map((k2) => buckets.get(k2)).filter((g) => !!g);
|
|
7374
|
-
const months = [...buckets.keys()].filter((k2) => k2.startsWith("m-")).sort((a2,
|
|
7440
|
+
const months = [...buckets.keys()].filter((k2) => k2.startsWith("m-")).sort((a2, b3) => b3.localeCompare(a2)).map((k2) => buckets.get(k2));
|
|
7375
7441
|
const undated = buckets.get("undated");
|
|
7376
7442
|
return [...fixed, ...months, ...undated ? [undated] : []];
|
|
7377
7443
|
}
|
|
@@ -7457,85 +7523,91 @@ class AparteConversationList extends HTMLElement {
|
|
|
7457
7523
|
</div>
|
|
7458
7524
|
</div>`;
|
|
7459
7525
|
}
|
|
7460
|
-
|
|
7461
|
-
|
|
7462
|
-
const id = row.dataset["convId"];
|
|
7463
|
-
const conv = this._conversations.find((c2) => c2.id === id);
|
|
7464
|
-
if (!conv) return;
|
|
7526
|
+
/** A row menu's element, empty: `_fillMenu` gives it its items as it opens. */
|
|
7527
|
+
_newMenu() {
|
|
7465
7528
|
const menu = document.createElement("div");
|
|
7466
7529
|
menu.className = "aparte-menu aparte-conv-menu";
|
|
7467
7530
|
menu.setAttribute("role", "menu");
|
|
7531
|
+
return menu;
|
|
7532
|
+
}
|
|
7533
|
+
/**
|
|
7534
|
+
* Fills `menu` for the row's conversation and puts it in the row, as it opens; it leaves
|
|
7535
|
+
* the row when it closes, so a list with no menu open holds none. `enhanceMenu` places it
|
|
7536
|
+
* fixed to the window, because a sidebar scrolls and an absolute menu on the last rows
|
|
7537
|
+
* would be clipped by the list's own overflow. False — stay closed — when the
|
|
7538
|
+
* conversation is gone.
|
|
7539
|
+
*/
|
|
7540
|
+
_fillMenu(row, menu) {
|
|
7541
|
+
const id = row.dataset["convId"];
|
|
7542
|
+
const conv = id ? this._conversations.find((c2) => c2.id === id) : void 0;
|
|
7543
|
+
if (!conv) return false;
|
|
7544
|
+
menu.dataset["menuFor"] = conv.id;
|
|
7545
|
+
menu.setAttribute("role", "menu");
|
|
7468
7546
|
menu.setAttribute("aria-label", conv.title || this._t("newChat"));
|
|
7469
7547
|
menu.innerHTML = this._menuMarkup(conv);
|
|
7470
7548
|
row.appendChild(menu);
|
|
7471
|
-
|
|
7472
|
-
|
|
7473
|
-
|
|
7474
|
-
|
|
7475
|
-
|
|
7476
|
-
|
|
7477
|
-
|
|
7478
|
-
|
|
7479
|
-
|
|
7480
|
-
|
|
7481
|
-
|
|
7482
|
-
|
|
7483
|
-
|
|
7484
|
-
|
|
7485
|
-
|
|
7486
|
-
|
|
7487
|
-
|
|
7488
|
-
|
|
7489
|
-
|
|
7549
|
+
return true;
|
|
7550
|
+
}
|
|
7551
|
+
/**
|
|
7552
|
+
* The keyboard, the closing and the placing are `enhanceMenu`'s, the same code the kit
|
|
7553
|
+
* gives a host for its own menus: each row's `⋯` drives its own menu, and a right
|
|
7554
|
+
* click, Shift+F10 or the Menu key on a row opens one shared menu there
|
|
7555
|
+
* (`enhanceContextMenu`). Both fill as they open.
|
|
7556
|
+
*/
|
|
7557
|
+
_wireMenus() {
|
|
7558
|
+
for (const button2 of this.querySelectorAll("[data-more-id]")) {
|
|
7559
|
+
const row = button2.closest("[data-conv-id]");
|
|
7560
|
+
if (!row) continue;
|
|
7561
|
+
const menu = this._newMenu();
|
|
7562
|
+
this._menus.push(enhanceMenu(button2, menu, {
|
|
7563
|
+
gap: MENU_GAP,
|
|
7564
|
+
margin: VIEWPORT_MARGIN,
|
|
7565
|
+
align: "end",
|
|
7566
|
+
onOpen: () => this._fillMenu(row, menu),
|
|
7567
|
+
onClose: () => menu.remove()
|
|
7568
|
+
}));
|
|
7569
|
+
}
|
|
7570
|
+
const context = this._contextMenu ??= this._newMenu();
|
|
7571
|
+
this._menus.push(enhanceContextMenu(this, context, {
|
|
7490
7572
|
gap: MENU_GAP,
|
|
7491
7573
|
margin: VIEWPORT_MARGIN,
|
|
7492
|
-
|
|
7493
|
-
|
|
7574
|
+
onOpen: (target) => {
|
|
7575
|
+
const row = target.closest("[data-conv-id]");
|
|
7576
|
+
if (!row || !this.contains(row) || target.closest("[data-rename-id], [data-menu-for]")) return false;
|
|
7577
|
+
return this._fillMenu(row, context);
|
|
7578
|
+
},
|
|
7579
|
+
onClose: () => context.remove()
|
|
7580
|
+
}));
|
|
7581
|
+
}
|
|
7582
|
+
/** Closes whichever menu is open, without moving the focus, and stops them all. */
|
|
7583
|
+
_releaseMenus() {
|
|
7584
|
+
for (const release of this._menus.splice(0)) release();
|
|
7585
|
+
}
|
|
7586
|
+
/**
|
|
7587
|
+
* Placed again once the question has taken the items' place, since it is not their
|
|
7588
|
+
* size: the `⋯` menu against its button, the context menu on the corner it opened at.
|
|
7589
|
+
*/
|
|
7590
|
+
_placeQuestion(menu, id) {
|
|
7591
|
+
const rtl = getComputedStyle(this).direction === "rtl";
|
|
7592
|
+
const button2 = menu === this._contextMenu ? null : this.querySelector(rowSelector("data-more-id", id));
|
|
7593
|
+
const box = menu.getBoundingClientRect();
|
|
7594
|
+
const corner = rtl ? box.right : box.left;
|
|
7595
|
+
placeFloating(button2?.getBoundingClientRect() ?? { top: box.top, bottom: box.top, left: corner, right: corner }, menu, {
|
|
7596
|
+
gap: button2 ? MENU_GAP : 0,
|
|
7597
|
+
margin: VIEWPORT_MARGIN,
|
|
7598
|
+
align: button2 ? "end" : "start",
|
|
7599
|
+
rtl
|
|
7494
7600
|
});
|
|
7495
7601
|
}
|
|
7496
|
-
|
|
7497
|
-
|
|
7498
|
-
|
|
7499
|
-
|
|
7500
|
-
|
|
7501
|
-
|
|
7502
|
-
|
|
7503
|
-
|
|
7504
|
-
|
|
7505
|
-
this._pressInMenu = false;
|
|
7506
|
-
window.removeEventListener("scroll", this._onWindowScroll, true);
|
|
7507
|
-
window.removeEventListener("resize", this._onWindowScroll);
|
|
7508
|
-
if (returnFocus && open.button.isConnected) open.button.focus();
|
|
7509
|
-
}
|
|
7510
|
-
/**
|
|
7511
|
-
* A pointer is down inside the open menu. WebKit does not move the focus to a
|
|
7512
|
-
* button on mousedown: the element that held it is blurred instead — `focusout`
|
|
7513
|
-
* with no `relatedTarget` — before the click reaches the item. `_onFocusOut` used
|
|
7514
|
-
* to read that as the focus leaving the menu and close it on the press, so with a
|
|
7515
|
-
* mouse no item could be chosen at all. Held from the press to its release.
|
|
7516
|
-
*/
|
|
7517
|
-
_pressInMenu = false;
|
|
7518
|
-
_onDocumentPointerUp = () => {
|
|
7519
|
-
this._pressInMenu = false;
|
|
7520
|
-
};
|
|
7521
|
-
_onDocumentPointerDown = (e) => {
|
|
7522
|
-
const open = this._open;
|
|
7523
|
-
if (!open) return;
|
|
7524
|
-
const target = eventOrigin(e);
|
|
7525
|
-
this._pressInMenu = !!target && open.menu.contains(target);
|
|
7526
|
-
if (open.menu.contains(target) || open.button.contains(target)) return;
|
|
7527
|
-
this._closeMenu();
|
|
7528
|
-
};
|
|
7529
|
-
_onWindowScroll = () => {
|
|
7530
|
-
this._closeMenu();
|
|
7531
|
-
};
|
|
7532
|
-
_onFocusOut = (e) => {
|
|
7533
|
-
const open = this._open;
|
|
7534
|
-
if (!open) return;
|
|
7535
|
-
const next = e.relatedTarget;
|
|
7536
|
-
if (!next && this._pressInMenu) return;
|
|
7537
|
-
if (next && (open.menu.contains(next) || open.button.contains(next))) return;
|
|
7538
|
-
if (open.menu.contains(e.target)) this._closeMenu();
|
|
7602
|
+
/**
|
|
7603
|
+
* An item chosen in a row's menu: `enhanceMenu` asks before it closes. Delete keeps it
|
|
7604
|
+
* open, since the question takes the items' place. The event stops here: the menu is
|
|
7605
|
+
* this element's own, and what the list tells the page is `aparte-conversation-*`.
|
|
7606
|
+
*/
|
|
7607
|
+
_onMenuSelect = (e) => {
|
|
7608
|
+
if (e.target.dataset["menuFor"] === void 0) return;
|
|
7609
|
+
e.stopPropagation();
|
|
7610
|
+
if (e.detail.item.dataset["menuAction"] === "delete") e.preventDefault();
|
|
7539
7611
|
};
|
|
7540
7612
|
/**
|
|
7541
7613
|
* The gesture, finished. The event has already gone out — cancelable, so a host
|
|
@@ -7567,26 +7639,25 @@ class AparteConversationList extends HTMLElement {
|
|
|
7567
7639
|
console.warn("[aparte-conversation-list] the conversation manager refused the change:", err);
|
|
7568
7640
|
});
|
|
7569
7641
|
}
|
|
7570
|
-
|
|
7571
|
-
|
|
7572
|
-
|
|
7573
|
-
|
|
7574
|
-
|
|
7575
|
-
|
|
7576
|
-
|
|
7577
|
-
}
|
|
7642
|
+
/**
|
|
7643
|
+
* What the item does, once the menu has done its part: by now it has closed and put the
|
|
7644
|
+
* focus back on the `⋯` (or the row) — except for delete, kept open to ask.
|
|
7645
|
+
*/
|
|
7646
|
+
_onMenuAction(action2, menu) {
|
|
7647
|
+
const conv = this._conversations.find((c2) => c2.id === menu.dataset["menuFor"]);
|
|
7648
|
+
if (!conv) return;
|
|
7578
7649
|
const id = conv.id;
|
|
7579
7650
|
switch (action2) {
|
|
7580
|
-
case "rename":
|
|
7581
|
-
this.
|
|
7582
|
-
this._startRename(
|
|
7651
|
+
case "rename": {
|
|
7652
|
+
const row = this.querySelector(rowSelector("data-conv-id", id));
|
|
7653
|
+
if (row) this._startRename(row, conv);
|
|
7583
7654
|
return;
|
|
7655
|
+
}
|
|
7584
7656
|
// The two toggles dispatch each name as a LITERAL, in its own branch: the
|
|
7585
7657
|
// manifest analyzer records a dispatch whose name is a ternary as an event
|
|
7586
7658
|
// with no name (the Angular generator then crashes on it), and one whose
|
|
7587
7659
|
// name is a local as an event called after the local.
|
|
7588
7660
|
case "pin":
|
|
7589
|
-
this._closeMenu(true);
|
|
7590
7661
|
if (conv.pinnedAt) {
|
|
7591
7662
|
const unpin = new CustomEvent(
|
|
7592
7663
|
"aparte-conversation-unpin",
|
|
@@ -7604,7 +7675,6 @@ class AparteConversationList extends HTMLElement {
|
|
|
7604
7675
|
}
|
|
7605
7676
|
return;
|
|
7606
7677
|
case "archive":
|
|
7607
|
-
this._closeMenu(true);
|
|
7608
7678
|
if (conv.archivedAt) {
|
|
7609
7679
|
const unarchive = new CustomEvent(
|
|
7610
7680
|
"aparte-conversation-unarchive",
|
|
@@ -7622,22 +7692,20 @@ class AparteConversationList extends HTMLElement {
|
|
|
7622
7692
|
}
|
|
7623
7693
|
return;
|
|
7624
7694
|
case "delete": {
|
|
7625
|
-
const previous = [...
|
|
7695
|
+
const previous = [...menu.childNodes];
|
|
7626
7696
|
const holder = document.createElement("div");
|
|
7627
7697
|
holder.innerHTML = this._confirmMarkup(conv);
|
|
7628
|
-
|
|
7629
|
-
|
|
7630
|
-
|
|
7631
|
-
|
|
7698
|
+
menu.append(...holder.childNodes);
|
|
7699
|
+
menu.setAttribute("role", "dialog");
|
|
7700
|
+
menu.setAttribute("aria-label", this._confirmQuestion(conv));
|
|
7701
|
+
menu.querySelector('[data-menu-action="cancel"]')?.focus();
|
|
7632
7702
|
for (const node of previous) node.remove();
|
|
7633
|
-
this.
|
|
7703
|
+
this._placeQuestion(menu, id);
|
|
7634
7704
|
return;
|
|
7635
7705
|
}
|
|
7636
7706
|
case "cancel":
|
|
7637
|
-
this._closeMenu(true);
|
|
7638
7707
|
return;
|
|
7639
7708
|
case "confirm-delete": {
|
|
7640
|
-
this._closeMenu(true);
|
|
7641
7709
|
const remove = new CustomEvent(
|
|
7642
7710
|
"aparte-conversation-delete",
|
|
7643
7711
|
{ detail: { id }, bubbles: true, composed: true, cancelable: true }
|
|
@@ -7648,27 +7716,20 @@ class AparteConversationList extends HTMLElement {
|
|
|
7648
7716
|
}
|
|
7649
7717
|
}
|
|
7650
7718
|
}
|
|
7651
|
-
|
|
7652
|
-
|
|
7653
|
-
|
|
7654
|
-
|
|
7655
|
-
|
|
7656
|
-
|
|
7657
|
-
|
|
7658
|
-
const
|
|
7719
|
+
/**
|
|
7720
|
+
* The delete question's own keys: the arrows, Home and End between its two answers.
|
|
7721
|
+
* A menu holds no item while it asks, so the menu's own arrows have nothing to move
|
|
7722
|
+
* to; Escape and Tab are still the menu's, and close it.
|
|
7723
|
+
*/
|
|
7724
|
+
_onQuestionKeydown(e, menu) {
|
|
7725
|
+
if (e.defaultPrevented) return;
|
|
7726
|
+
const answers = Array.from(menu.querySelectorAll("[data-menu-action]"));
|
|
7727
|
+
const index = answers.indexOf(activeElementIn(this));
|
|
7659
7728
|
const focusAt = (i2) => {
|
|
7660
7729
|
e.preventDefault();
|
|
7661
|
-
|
|
7730
|
+
answers[(i2 + answers.length) % answers.length]?.focus();
|
|
7662
7731
|
};
|
|
7663
7732
|
switch (e.key) {
|
|
7664
|
-
case "Escape":
|
|
7665
|
-
e.preventDefault();
|
|
7666
|
-
this._closeMenu(true);
|
|
7667
|
-
return;
|
|
7668
|
-
case "Tab":
|
|
7669
|
-
e.preventDefault();
|
|
7670
|
-
this._closeMenu(true);
|
|
7671
|
-
return;
|
|
7672
7733
|
case "ArrowDown":
|
|
7673
7734
|
focusAt(index + 1);
|
|
7674
7735
|
return;
|
|
@@ -7679,7 +7740,7 @@ class AparteConversationList extends HTMLElement {
|
|
|
7679
7740
|
focusAt(0);
|
|
7680
7741
|
return;
|
|
7681
7742
|
case "End":
|
|
7682
|
-
focusAt(
|
|
7743
|
+
focusAt(answers.length - 1);
|
|
7683
7744
|
return;
|
|
7684
7745
|
}
|
|
7685
7746
|
}
|
|
@@ -7736,25 +7797,19 @@ class AparteConversationList extends HTMLElement {
|
|
|
7736
7797
|
_onClick = (e) => {
|
|
7737
7798
|
const target = e.target;
|
|
7738
7799
|
const menuAction = target.closest("[data-menu-action]");
|
|
7739
|
-
|
|
7800
|
+
const menu = menuAction?.closest("[data-menu-for]");
|
|
7801
|
+
if (menuAction && menu) {
|
|
7740
7802
|
e.stopPropagation();
|
|
7741
|
-
this._onMenuAction(menuAction.dataset["menuAction"]);
|
|
7803
|
+
this._onMenuAction(menuAction.dataset["menuAction"], menu);
|
|
7742
7804
|
return;
|
|
7743
7805
|
}
|
|
7744
|
-
|
|
7745
|
-
if (more) {
|
|
7806
|
+
if (target.closest("[data-more-id]")) {
|
|
7746
7807
|
e.stopPropagation();
|
|
7747
|
-
if (this._open?.button === more) {
|
|
7748
|
-
this._closeMenu(true);
|
|
7749
|
-
} else {
|
|
7750
|
-
this._openMenu(more.closest("[data-conv-id]"), more);
|
|
7751
|
-
}
|
|
7752
7808
|
return;
|
|
7753
7809
|
}
|
|
7754
7810
|
if (target.closest("[data-rename-id]")) return;
|
|
7755
7811
|
const select = target.closest("[data-select-id]");
|
|
7756
7812
|
if (select) {
|
|
7757
|
-
this._closeMenu();
|
|
7758
7813
|
const targetId = this.getAttribute("target");
|
|
7759
7814
|
this.dispatchEvent(new CustomEvent(
|
|
7760
7815
|
"aparte-conversation-select",
|
|
@@ -7764,8 +7819,9 @@ class AparteConversationList extends HTMLElement {
|
|
|
7764
7819
|
};
|
|
7765
7820
|
_onKeydown = (e) => {
|
|
7766
7821
|
const target = e.target;
|
|
7767
|
-
|
|
7768
|
-
|
|
7822
|
+
const menu = target.closest("[data-menu-for]");
|
|
7823
|
+
if (menu) {
|
|
7824
|
+
if (menu.getAttribute("role") === "dialog") this._onQuestionKeydown(e, menu);
|
|
7769
7825
|
return;
|
|
7770
7826
|
}
|
|
7771
7827
|
if (target.matches("[data-rename-id]")) {
|
|
@@ -8917,7 +8973,7 @@ class AparteScrollRail extends HTMLElement {
|
|
|
8917
8973
|
/** The bubbles that get a tick, from all of them. */
|
|
8918
8974
|
_bubbles(all = this._messages()) {
|
|
8919
8975
|
const every = this.getAttribute("every") === "message" ? "message" : "user";
|
|
8920
|
-
return every === "message" ? all : all.filter((
|
|
8976
|
+
return every === "message" ? all : all.filter((b3) => b3.getAttribute("data-role") === "user");
|
|
8921
8977
|
}
|
|
8922
8978
|
// ─── Rendering ────────────────────────────────────────────────────────
|
|
8923
8979
|
/** The first words of a message, for the tick's name. An excerpt, never a summary. */
|
|
@@ -8975,7 +9031,7 @@ class AparteScrollRail extends HTMLElement {
|
|
|
8975
9031
|
const id = item.firstElementChild instanceof HTMLElement ? item.firstElementChild.dataset["messageId"] : void 0;
|
|
8976
9032
|
if (id) existing.set(id, item);
|
|
8977
9033
|
}
|
|
8978
|
-
const known = new Set(bubbles.map((
|
|
9034
|
+
const known = new Set(bubbles.map((b3) => b3.getAttribute("message-id")));
|
|
8979
9035
|
for (const [id, item] of existing) {
|
|
8980
9036
|
if (known.has(id)) continue;
|
|
8981
9037
|
item.remove();
|
|
@@ -9388,9 +9444,9 @@ function isBubble(node) {
|
|
|
9388
9444
|
function holdsBubbles(nodes) {
|
|
9389
9445
|
return Array.from(nodes).some((n2) => n2 instanceof Element && (isBubble(n2) || n2.localName === "aparte-chat-viewport" || n2.querySelector("aparte-chat-bubble") !== null));
|
|
9390
9446
|
}
|
|
9391
|
-
function sameElements(a2,
|
|
9392
|
-
if (a2.length !==
|
|
9393
|
-
for (let i2 = 0; i2 < a2.length; i2++) if (a2[i2] !==
|
|
9447
|
+
function sameElements(a2, b3) {
|
|
9448
|
+
if (a2.length !== b3.length) return false;
|
|
9449
|
+
for (let i2 = 0; i2 < a2.length; i2++) if (a2[i2] !== b3[i2]) return false;
|
|
9394
9450
|
return true;
|
|
9395
9451
|
}
|
|
9396
9452
|
deferHydrationOf(AparteScrollRail);
|
|
@@ -11353,54 +11409,58 @@ export {
|
|
|
11353
11409
|
G as createSegmentList,
|
|
11354
11410
|
H as createStreamAdapter,
|
|
11355
11411
|
cssEscape,
|
|
11356
|
-
|
|
11357
|
-
|
|
11412
|
+
I as declineDefaultRenderers,
|
|
11413
|
+
J as defaultSanitizer,
|
|
11358
11414
|
deferHydrationOf,
|
|
11359
|
-
|
|
11360
|
-
|
|
11361
|
-
|
|
11415
|
+
L as defineMountedSegmentRenderer,
|
|
11416
|
+
M as defineMountedToolRenderer,
|
|
11417
|
+
N as detachConfig,
|
|
11418
|
+
enhanceContextMenu,
|
|
11419
|
+
enhanceMenu,
|
|
11420
|
+
b2 as enhanceTabs,
|
|
11362
11421
|
escapeAttr,
|
|
11363
11422
|
escapeHtml,
|
|
11364
|
-
|
|
11365
|
-
|
|
11366
|
-
|
|
11423
|
+
Q as estimateTokens,
|
|
11424
|
+
R as estimateWireTokens,
|
|
11425
|
+
T as filesToAttachments,
|
|
11367
11426
|
formatDuration,
|
|
11368
|
-
|
|
11427
|
+
V as getAllRenderers,
|
|
11369
11428
|
getSegmentRenderer,
|
|
11370
|
-
|
|
11429
|
+
X as historyFromCheckpoint,
|
|
11371
11430
|
installDefaultRenderersOnce,
|
|
11372
11431
|
installDialogTriggersOnce,
|
|
11373
11432
|
isAwaitingReply,
|
|
11374
|
-
|
|
11433
|
+
$ as isFormatAdapter,
|
|
11375
11434
|
isSafeUrl,
|
|
11376
11435
|
isSegmentSettled,
|
|
11377
11436
|
measureContext,
|
|
11437
|
+
onRenderersChange,
|
|
11378
11438
|
a4 as overrideSegmentRenderer,
|
|
11379
11439
|
a5 as parseAparteEventStream,
|
|
11380
11440
|
parseMarkdownToSegments,
|
|
11381
11441
|
placeFloating,
|
|
11382
11442
|
pluralize,
|
|
11383
11443
|
populateBubbleFromMessage,
|
|
11384
|
-
|
|
11444
|
+
a9 as readableToAsyncIterable,
|
|
11385
11445
|
registerAllComponents,
|
|
11386
|
-
|
|
11387
|
-
|
|
11388
|
-
|
|
11389
|
-
|
|
11390
|
-
|
|
11391
|
-
|
|
11446
|
+
aa as registerDefaultRenderers,
|
|
11447
|
+
ab as registerSegmentRenderer,
|
|
11448
|
+
ac as releaseDeferredHydration,
|
|
11449
|
+
ad as renderCitations,
|
|
11450
|
+
ae as renderCodeLanguages,
|
|
11451
|
+
af as requestUserInput,
|
|
11392
11452
|
resolveConfig,
|
|
11393
11453
|
revokeAttachmentUrls,
|
|
11394
|
-
|
|
11454
|
+
ai as runSubAgent,
|
|
11395
11455
|
runWithConfig,
|
|
11396
|
-
|
|
11456
|
+
ak as segmentDuration,
|
|
11397
11457
|
segmentTiming,
|
|
11398
|
-
|
|
11399
|
-
|
|
11458
|
+
am as setupSuggestionBlocks,
|
|
11459
|
+
an as startSubAgent,
|
|
11400
11460
|
subscribeConfigChange,
|
|
11401
|
-
|
|
11402
|
-
|
|
11403
|
-
|
|
11461
|
+
ap as toToolCallView,
|
|
11462
|
+
aq as toolRefusal,
|
|
11463
|
+
ar as unregisterSegmentRenderer,
|
|
11404
11464
|
uuid
|
|
11405
11465
|
};
|
|
11406
11466
|
//# sourceMappingURL=index.js.map
|