@burdenoff/fe-libs 2026.1113.10 → 2026.1113.11
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/shared/assistant/index.d.ts +2 -0
- package/dist/shared/assistant/ui/AIAssistantPanel.js +267 -241
- package/dist/shared/assistant/ui/AssistantChatArea.js +1243 -1241
- package/dist/shared/assistant/ui/AssistantConversationList.js +253 -252
- package/dist/shared/assistant/ui/AssistantMessageList.js +48 -47
- package/dist/shared/assistant/ui/assistantPageLayout.d.ts +13 -0
- package/dist/shared/assistant/ui/assistantPageLayout.js +8 -0
- package/dist/shared/assistant/ui/avatar/AssistantCompactAvatar.d.ts +6 -0
- package/dist/shared/assistant/ui/avatar/AssistantCompactAvatar.js +77 -71
- package/dist/shared/assistant/ui/compact/AssistantMenuView.js +130 -129
- package/dist/shared/assistant/ui/compact/AssistantPageBar.d.ts +13 -0
- package/dist/shared/assistant/ui/compact/AssistantPageBar.js +46 -0
- package/dist/shared/assistant/ui/compact/AssistantViewSwitch.d.ts +5 -0
- package/dist/shared/assistant/ui/compact/AssistantViewSwitch.js +11 -11
- package/dist/shared/assistant/ui/composer/AssistantCompactFooter.js +15 -11
- package/dist/shared/assistant/ui/composer/AssistantComposer.js +258 -257
- package/dist/shared-assistant.js +65 -63
- package/package.json +1 -1
|
@@ -4,69 +4,70 @@ import { useAssistantTr as n } from "../i18n.js";
|
|
|
4
4
|
import { useLiveOverlay as r } from "../liveOverlay.js";
|
|
5
5
|
import { approvalFollowUpReplyIds as i, approvedPendingWriteIds as a, goAheadSentReplyIds as o } from "../liveTurns.js";
|
|
6
6
|
import { scrollToEndWithin as s } from "./scrollWithin.js";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
7
|
+
import { PAGE_SCROLL_GUTTER as c, useAssistantPageLayout as l } from "./assistantPageLayout.js";
|
|
8
|
+
import { useEffect as u, useRef as d } from "react";
|
|
9
|
+
import { jsx as f, jsxs as p } from "react/jsx-runtime";
|
|
9
10
|
// src/shared/assistant/ui/AssistantMessageList.tsx
|
|
10
|
-
var
|
|
11
|
-
let
|
|
12
|
-
for (let e =
|
|
11
|
+
var m = 250, h = ({ onApprovePendingWrite: m, approvingWriteRef: h = null, approvableMessageId: g = null, retryableMessageId: _ = null, messages: v, processing: y, streamingMessageId: b, failedMessageId: x, onRetry: S, renderWriteProposals: C, hidesLegacyWriteCard: w, renderUiOffers: T, onStopTurn: E, stopTurnLabel: D }) => {
|
|
12
|
+
let O = n(), k = l(), A = (() => {
|
|
13
|
+
for (let e = v.length - 1; e >= 0; --e) if (v[e].role === "assistant") return v[e].id;
|
|
13
14
|
return null;
|
|
14
|
-
})(),
|
|
15
|
-
|
|
16
|
-
let e =
|
|
15
|
+
})(), j = a(v), M = o(v), N = i(v), P = d(null);
|
|
16
|
+
u(() => {
|
|
17
|
+
let e = P.current;
|
|
17
18
|
if (e && e.scrollHeight - e.scrollTop - e.clientHeight < 100) {
|
|
18
19
|
let n = t();
|
|
19
20
|
s(e, { behavior: n ? "auto" : "smooth" });
|
|
20
21
|
}
|
|
21
|
-
}, [
|
|
22
|
-
let
|
|
23
|
-
return
|
|
24
|
-
if (
|
|
22
|
+
}, [v, b]);
|
|
23
|
+
let F = r((e) => e.byMessageId), I = b === null ? null : F[b]?.content ?? null, L = d(0), R = d(null);
|
|
24
|
+
return u(() => {
|
|
25
|
+
if (I === null) return;
|
|
25
26
|
let e = () => {
|
|
26
|
-
|
|
27
|
-
let e =
|
|
27
|
+
R.current = null, L.current = Date.now();
|
|
28
|
+
let e = P.current;
|
|
28
29
|
e && e.scrollHeight - e.scrollTop - e.clientHeight < 100 && s(e, { behavior: "auto" });
|
|
29
|
-
}, t =
|
|
30
|
-
t <= 0 ? e() :
|
|
31
|
-
}, [
|
|
32
|
-
|
|
33
|
-
}, []),
|
|
34
|
-
|
|
35
|
-
}, []), /* @__PURE__ */
|
|
36
|
-
ref:
|
|
37
|
-
className: "scrollbar-slim flex-1 space-y-4 overflow-y-auto p-3",
|
|
30
|
+
}, t = L.current + 250 - Date.now();
|
|
31
|
+
t <= 0 ? e() : R.current === null && (R.current = setTimeout(e, t));
|
|
32
|
+
}, [I]), u(() => () => {
|
|
33
|
+
R.current !== null && clearTimeout(R.current);
|
|
34
|
+
}, []), u(() => {
|
|
35
|
+
P.current && s(P.current, { behavior: "instant" });
|
|
36
|
+
}, []), /* @__PURE__ */ p("div", {
|
|
37
|
+
ref: P,
|
|
38
|
+
className: k ? `scrollbar-slim flex-1 space-y-4 overflow-y-auto py-3 ${c}` : "scrollbar-slim flex-1 space-y-4 overflow-y-auto p-3",
|
|
38
39
|
role: "log",
|
|
39
40
|
"aria-live": "polite",
|
|
40
41
|
"aria-relevant": "additions",
|
|
41
|
-
"aria-busy":
|
|
42
|
-
"aria-label":
|
|
43
|
-
children: [
|
|
44
|
-
let n =
|
|
45
|
-
return /* @__PURE__ */
|
|
46
|
-
onApprovePendingWrite: r ?
|
|
47
|
-
approvingWriteRef:
|
|
42
|
+
"aria-busy": b !== null,
|
|
43
|
+
"aria-label": O("messageList.ariaLabel", "Conversation messages"),
|
|
44
|
+
children: [v.map((t) => {
|
|
45
|
+
let n = j.has(t.id), r = !n && (t.id === g || t.id === b);
|
|
46
|
+
return /* @__PURE__ */ f(e, {
|
|
47
|
+
onApprovePendingWrite: r ? m : void 0,
|
|
48
|
+
approvingWriteRef: h,
|
|
48
49
|
pendingWriteApproved: n,
|
|
49
|
-
pendingWriteGoAheadSent:
|
|
50
|
+
pendingWriteGoAheadSent: M.has(t.id),
|
|
50
51
|
pendingWriteExpired: !n && !r,
|
|
51
|
-
message: t.id ===
|
|
52
|
+
message: t.id === b && I !== null ? {
|
|
52
53
|
...t,
|
|
53
|
-
content:
|
|
54
|
+
content: I
|
|
54
55
|
} : t,
|
|
55
|
-
processing:
|
|
56
|
-
isStreaming: t.id ===
|
|
57
|
-
isFailed: t.id ===
|
|
58
|
-
isLastAssistant: t.id ===
|
|
59
|
-
isNewestAssistant: t.id ===
|
|
60
|
-
onRetry:
|
|
61
|
-
legacyWriteCardHidden:
|
|
62
|
-
writeProposals:
|
|
63
|
-
uiOffers:
|
|
64
|
-
...t.id ===
|
|
65
|
-
onStopTurn:
|
|
66
|
-
stopTurnLabel:
|
|
56
|
+
processing: y,
|
|
57
|
+
isStreaming: t.id === b,
|
|
58
|
+
isFailed: t.id === x,
|
|
59
|
+
isLastAssistant: t.id === _,
|
|
60
|
+
isNewestAssistant: t.id === A,
|
|
61
|
+
onRetry: N.has(t.id) ? void 0 : S,
|
|
62
|
+
legacyWriteCardHidden: w?.(t) ?? !1,
|
|
63
|
+
writeProposals: C?.(t),
|
|
64
|
+
uiOffers: T?.(t),
|
|
65
|
+
...t.id === b && E !== void 0 ? {
|
|
66
|
+
onStopTurn: E,
|
|
67
|
+
stopTurnLabel: D
|
|
67
68
|
} : {}
|
|
68
69
|
}, t.id);
|
|
69
|
-
}), /* @__PURE__ */
|
|
70
|
+
}), /* @__PURE__ */ f("div", {})]
|
|
70
71
|
});
|
|
71
72
|
};
|
|
72
|
-
export {
|
|
73
|
+
export { h as AssistantMessageList, m as LIVE_SCROLL_GAP_MS };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare const AssistantPageLayoutContext: import('react').Context<boolean>;
|
|
2
|
+
/** True inside a panel laid out as a page. */
|
|
3
|
+
export declare function useAssistantPageLayout(): boolean;
|
|
4
|
+
/** The page's one column (48rem), for an element that sits in it. */
|
|
5
|
+
export declare const PAGE_COLUMN = "mx-auto w-full max-w-[48rem]";
|
|
6
|
+
/**
|
|
7
|
+
* Side padding that centres a full-width scroll box's content in the column,
|
|
8
|
+
* so the scrollbar stays at the page's edge. 46.5rem: the column less the
|
|
9
|
+
* message box's own 0.75rem sides, so the messages line up with the box.
|
|
10
|
+
*/
|
|
11
|
+
export declare const PAGE_SCROLL_GUTTER = "px-[max(0.75rem,calc((100%_-_46.5rem)/2))]";
|
|
12
|
+
/** The same, for a full-surface view (☰, history, the Avatar view): its content in the column. */
|
|
13
|
+
export declare const PAGE_VIEW_GUTTER = "px-[max(0rem,calc((100%_-_48rem)/2))]";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { createContext as e, useContext as t } from "react";
|
|
2
|
+
// src/shared/assistant/ui/assistantPageLayout.ts
|
|
3
|
+
var n = e(!1);
|
|
4
|
+
function r() {
|
|
5
|
+
return t(n);
|
|
6
|
+
}
|
|
7
|
+
var i = "mx-auto w-full max-w-[48rem]", a = "px-[max(0.75rem,calc((100%_-_46.5rem)/2))]", o = "px-[max(0rem,calc((100%_-_48rem)/2))]";
|
|
8
|
+
export { n as AssistantPageLayoutContext, i as PAGE_COLUMN, a as PAGE_SCROLL_GUTTER, o as PAGE_VIEW_GUTTER, r as useAssistantPageLayout };
|
|
@@ -17,5 +17,11 @@ export interface AssistantCompactAvatarProps {
|
|
|
17
17
|
readonly ask?: AvatarTabAsk;
|
|
18
18
|
/** The one-line footer (the standing disclaimer), the chat area's own. */
|
|
19
19
|
readonly footer: ReactNode;
|
|
20
|
+
/**
|
|
21
|
+
* BOFF-13461: laid out as a page, where the Chat | Avatar switch is the page bar's (one instance, outside this view). This view then
|
|
22
|
+
* shows no switch of its own (its row stays, empty, for the voice strip's clearance), focus that has nowhere else to go goes to the
|
|
23
|
+
* bar's Avatar segment, and its content sits in the page's column.
|
|
24
|
+
*/
|
|
25
|
+
readonly switchInBar?: boolean;
|
|
20
26
|
}
|
|
21
27
|
export declare const AssistantCompactAvatar: FC<AssistantCompactAvatarProps>;
|
|
@@ -7,114 +7,120 @@ import { clearReplyRequests as a } from "../../speech/replySpeechRequests.js";
|
|
|
7
7
|
import { AvatarCompactAskBox as o } from "./AvatarCompactAskBox.js";
|
|
8
8
|
import { AvatarTabLastExchange as s } from "./AvatarTabLastExchange.js";
|
|
9
9
|
import { useAvatarTabExchange as c } from "./avatarTabExchange.js";
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
10
|
+
import { PAGE_VIEW_GUTTER as l } from "../assistantPageLayout.js";
|
|
11
|
+
import { useEffect as u, useLayoutEffect as d, useRef as f, useState as p } from "react";
|
|
12
|
+
import { jsx as m, jsxs as h } from "react/jsx-runtime";
|
|
12
13
|
// src/shared/assistant/ui/avatar/AssistantCompactAvatar.tsx
|
|
13
|
-
var
|
|
14
|
-
function
|
|
14
|
+
var g = /* @__PURE__ */ new WeakMap();
|
|
15
|
+
function _() {
|
|
15
16
|
if (typeof document > "u") return !1;
|
|
16
17
|
let e = document.activeElement;
|
|
17
18
|
return e === null || e === document.body || !e.isConnected || e.hasAttribute("data-assistant-panel");
|
|
18
19
|
}
|
|
19
|
-
var
|
|
20
|
+
var v = ({ state: e, restored: t }) => {
|
|
20
21
|
let n = i(), r = e === "thinking" ? n.askThinking : e === "not-spoken" ? n.askNotSpoken : e === "cut" ? n.askCut : e === "not-heard" ? n.askNotHeard : e === "failed" ? t ? n.askFailed : n.askFailedInChat : "";
|
|
21
|
-
return /* @__PURE__ */
|
|
22
|
+
return /* @__PURE__ */ m("p", {
|
|
22
23
|
className: "sr-only",
|
|
23
24
|
"aria-live": "polite",
|
|
24
25
|
"aria-atomic": "true",
|
|
25
26
|
"data-testid": "assistant-avatar-tab-ask-live",
|
|
26
27
|
children: r
|
|
27
28
|
});
|
|
28
|
-
},
|
|
29
|
-
let
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
(
|
|
29
|
+
}, y = ({ tab: i, CompactView: y, ids: b, compact: x, shown: S, voice: C, mute: w, ask: T, footer: E, switchInBar: D = !1 }) => {
|
|
30
|
+
let O = f(null), k = f(null), A = e(), j = x.surface === "window", M = n(b);
|
|
31
|
+
d(() => (g.set(i, (g.get(i) ?? 0) + 1), i.setOpen(!0, { compact: !0 }), () => {
|
|
32
|
+
g.set(i, (g.get(i) ?? 1) - 1), queueMicrotask(() => {
|
|
33
|
+
(g.get(i) ?? 0) > 0 || (i.setOpen(!1), a());
|
|
33
34
|
});
|
|
34
35
|
}), [i]);
|
|
35
|
-
let
|
|
36
|
-
l(() => {
|
|
37
|
-
N.current !== M && (N.current = M, (E.current ?? j.current ?? document.getElementById(A.avatarTab))?.focus({ preventScroll: !0 }));
|
|
38
|
-
}, [M, A.avatarTab]);
|
|
39
|
-
let P = d(S.live);
|
|
40
|
-
l(() => {
|
|
41
|
-
let e = P.current;
|
|
42
|
-
P.current = S.live, e && !S.live && g() && (D.current ?? E.current)?.focus();
|
|
43
|
-
}, [S.live]);
|
|
44
|
-
let F = c(w?.last ?? null, w?.navigatingReplyId ?? null), I = S.live ? void 0 : w, [L, R] = f(null), z = F?.state === "failed" ? F.exchange.replyId : null, B = F?.question ?? "", V = w?.draft;
|
|
36
|
+
let N = f(null), P = x.focusRequest ?? 0, F = f(P);
|
|
45
37
|
u(() => {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
38
|
+
F.current !== P && (F.current = P, (O.current ?? N.current ?? document.getElementById(D ? b.avatarTab : M.avatarTab))?.focus({ preventScroll: !0 }));
|
|
39
|
+
}, [
|
|
40
|
+
P,
|
|
41
|
+
M.avatarTab,
|
|
42
|
+
b.avatarTab,
|
|
43
|
+
D
|
|
44
|
+
]);
|
|
45
|
+
let I = f(C.live);
|
|
46
|
+
u(() => {
|
|
47
|
+
let e = I.current;
|
|
48
|
+
I.current = C.live, e && !C.live && _() && (k.current ?? O.current)?.focus();
|
|
49
|
+
}, [C.live]);
|
|
50
|
+
let L = c(T?.last ?? null, T?.navigatingReplyId ?? null), R = C.live ? void 0 : T, [z, B] = p(null), V = L?.state === "failed" ? L.exchange.replyId : null, H = L?.question ?? "", U = T?.draft;
|
|
51
|
+
d(() => {
|
|
52
|
+
if (V === null || U === void 0 || z?.replyId === V) return;
|
|
53
|
+
let e = U.get().trim() === "";
|
|
54
|
+
e && U.set(H), B({
|
|
55
|
+
replyId: V,
|
|
50
56
|
restored: e
|
|
51
57
|
});
|
|
52
58
|
}, [
|
|
53
|
-
z,
|
|
54
|
-
B,
|
|
55
59
|
V,
|
|
56
|
-
|
|
60
|
+
H,
|
|
61
|
+
U,
|
|
62
|
+
z
|
|
57
63
|
]);
|
|
58
|
-
let
|
|
59
|
-
...
|
|
60
|
-
...
|
|
61
|
-
open:
|
|
62
|
-
toggle: () =>
|
|
64
|
+
let W = z === null || z.replyId !== V || z.restored, [G, K] = p(null), q = G ?? !j, J = {
|
|
65
|
+
...w ? { mute: w } : {},
|
|
66
|
+
...R ? { transcript: {
|
|
67
|
+
open: q,
|
|
68
|
+
toggle: () => K(!q)
|
|
63
69
|
} } : {}
|
|
64
70
|
};
|
|
65
|
-
return /* @__PURE__ */
|
|
66
|
-
className: `absolute inset-0 z-[5] flex flex-col ${
|
|
71
|
+
return /* @__PURE__ */ h("div", {
|
|
72
|
+
className: `absolute inset-0 z-[5] flex flex-col ${j ? "bg-bg-elevated" : "bg-bg-surface"}${D ? ` ${l}` : ""}`,
|
|
67
73
|
"data-testid": "assistant-avatar-tab",
|
|
68
74
|
"data-presentation": "compact",
|
|
69
|
-
"data-surface":
|
|
75
|
+
"data-surface": x.surface,
|
|
70
76
|
children: [
|
|
71
|
-
/* @__PURE__ */
|
|
77
|
+
/* @__PURE__ */ h("div", {
|
|
72
78
|
role: "tabpanel",
|
|
73
|
-
id:
|
|
74
|
-
"aria-labelledby":
|
|
79
|
+
id: b.avatarPanel,
|
|
80
|
+
"aria-labelledby": D ? b.avatarTab : M.avatarTab,
|
|
75
81
|
className: "flex min-h-0 flex-1 flex-col",
|
|
76
82
|
"data-testid": "assistant-avatar-tab-column",
|
|
77
|
-
children: [/* @__PURE__ */
|
|
78
|
-
shown:
|
|
79
|
-
voice:
|
|
80
|
-
leaveHintId:
|
|
81
|
-
surface:
|
|
82
|
-
onOpenSettings:
|
|
83
|
-
navigate:
|
|
84
|
-
controls:
|
|
85
|
-
switchRef:
|
|
86
|
-
}),
|
|
83
|
+
children: [/* @__PURE__ */ m(y, {
|
|
84
|
+
shown: S,
|
|
85
|
+
voice: C,
|
|
86
|
+
leaveHintId: b.leaveHint,
|
|
87
|
+
surface: x.surface,
|
|
88
|
+
onOpenSettings: x.openSettings,
|
|
89
|
+
navigate: A,
|
|
90
|
+
controls: J,
|
|
91
|
+
switchRef: N
|
|
92
|
+
}), R && q ? /* @__PURE__ */ m("div", {
|
|
87
93
|
className: "max-h-[40%] shrink-0 overflow-y-auto px-4 pb-1",
|
|
88
|
-
children: /* @__PURE__ */
|
|
89
|
-
view:
|
|
94
|
+
children: /* @__PURE__ */ m(s, {
|
|
95
|
+
view: L,
|
|
90
96
|
invite: !1,
|
|
91
|
-
restored:
|
|
92
|
-
focusAfterStop:
|
|
93
|
-
},
|
|
97
|
+
restored: W,
|
|
98
|
+
focusAfterStop: O
|
|
99
|
+
}, L?.exchange.replyId ?? "none")
|
|
94
100
|
}) : null]
|
|
95
101
|
}),
|
|
96
|
-
/* @__PURE__ */
|
|
97
|
-
voiceLive:
|
|
98
|
-
children: /* @__PURE__ */
|
|
99
|
-
selected:
|
|
100
|
-
onSelect:
|
|
101
|
-
ids:
|
|
102
|
+
/* @__PURE__ */ m(r, {
|
|
103
|
+
voiceLive: C.live,
|
|
104
|
+
children: D ? null : /* @__PURE__ */ m(t, {
|
|
105
|
+
selected: x.view,
|
|
106
|
+
onSelect: x.selectView,
|
|
107
|
+
ids: b,
|
|
102
108
|
instance: "avatar"
|
|
103
109
|
})
|
|
104
110
|
}),
|
|
105
|
-
|
|
106
|
-
ask:
|
|
107
|
-
inputRef:
|
|
108
|
-
voice:
|
|
109
|
-
waveRef:
|
|
110
|
-
windowSurface:
|
|
111
|
+
R ? /* @__PURE__ */ m(o, {
|
|
112
|
+
ask: R,
|
|
113
|
+
inputRef: O,
|
|
114
|
+
voice: C,
|
|
115
|
+
waveRef: k,
|
|
116
|
+
windowSurface: j
|
|
111
117
|
}) : null,
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
state:
|
|
115
|
-
restored:
|
|
118
|
+
E,
|
|
119
|
+
T ? /* @__PURE__ */ m(v, {
|
|
120
|
+
state: L?.state ?? null,
|
|
121
|
+
restored: W
|
|
116
122
|
}) : null
|
|
117
123
|
]
|
|
118
124
|
});
|
|
119
125
|
};
|
|
120
|
-
export {
|
|
126
|
+
export { y as AssistantCompactAvatar };
|