@burdenoff/fe-libs 2026.1117.2 → 2026.1117.3

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.
Files changed (28) hide show
  1. package/dist/shared/assistant/history/historyControls.d.ts +5 -0
  2. package/dist/shared/assistant/history/historyControls.js +9 -5
  3. package/dist/shared/assistant/home/AssistantHomeActions.d.ts +37 -0
  4. package/dist/shared/assistant/home/AssistantHomeActions.js +68 -0
  5. package/dist/shared/assistant/home/AssistantHomeComposer.d.ts +36 -0
  6. package/dist/shared/assistant/home/AssistantHomeComposer.js +85 -0
  7. package/dist/shared/assistant/home/AssistantHomeHistory.d.ts +106 -0
  8. package/dist/shared/assistant/home/AssistantHomeHistory.js +499 -0
  9. package/dist/shared/assistant/home/AssistantHomePage.d.ts +67 -0
  10. package/dist/shared/assistant/home/AssistantHomePage.js +78 -0
  11. package/dist/shared/assistant/home/AssistantHomeStart.d.ts +171 -0
  12. package/dist/shared/assistant/home/AssistantHomeStart.js +224 -0
  13. package/dist/shared/assistant/home/assistantHomeChat.d.ts +47 -0
  14. package/dist/shared/assistant/home/assistantHomeChat.js +49 -0
  15. package/dist/shared/assistant/home/assistantHomeHistoryRows.d.ts +93 -0
  16. package/dist/shared/assistant/home/assistantHomeHistoryRows.js +113 -0
  17. package/dist/shared/assistant/home/assistantHomeRoutes.d.ts +49 -0
  18. package/dist/shared/assistant/home/assistantHomeRoutes.js +48 -0
  19. package/dist/shared/assistant/home/assistantHomeTopBar.d.ts +4 -0
  20. package/dist/shared/assistant/home/assistantHomeTopBar.js +10 -0
  21. package/dist/shared/assistant/home/useAssistantHomeHistoryRows.d.ts +46 -0
  22. package/dist/shared/assistant/home/useAssistantHomeHistoryRows.js +120 -0
  23. package/dist/shared/assistant/home.d.ts +19 -0
  24. package/dist/shared/assistant/home.js +11 -0
  25. package/dist/shared/assistant/index.d.ts +10 -0
  26. package/dist/shared/assistant/ui/AssistantConversationList.js +44 -48
  27. package/dist/shared-assistant.js +222 -212
  28. package/package.json +1 -1
@@ -0,0 +1,171 @@
1
+ import { ComponentType, ReactNode } from 'react';
2
+ /** An icon component the page sizes and colours itself (a lucide icon, say). */
3
+ export type AssistantHomeIcon = ComponentType<{
4
+ className?: string;
5
+ 'aria-hidden'?: boolean | 'true' | 'false';
6
+ }>;
7
+ /** The start cards' icon tiles: the two accents (tokens.css `boff-accent-tile`). */
8
+ declare const TILE_GLOW: {
9
+ readonly glow: "flex size-9 shrink-0 items-center justify-center rounded-button boff-accent-tile";
10
+ readonly alt: "flex size-9 shrink-0 items-center justify-center rounded-button boff-accent-tile boff-accent-tile--alt";
11
+ readonly duo: "flex size-9 shrink-0 items-center justify-center rounded-button boff-accent-tile boff-accent-tile--duo";
12
+ };
13
+ /**
14
+ * The hero's glow: two hues from the accent-glow tokens that drift slowly (tokens.css
15
+ * `boff-mesh-duo`; still under reduced motion). The wrappers that hold it do not clip, so the glow
16
+ * clips itself (no sideways scroll on a phone, in either reading direction).
17
+ */
18
+ export declare function AssistantHomeGlow(): import('react').JSX.Element;
19
+ export interface AssistantHomeHeroContent {
20
+ /** The badge over the greeting (say, the assistant's name). */
21
+ chip: string;
22
+ /** The greeting: a welcome on a first run, the time of day after. */
23
+ heading: string;
24
+ /** The line under it. */
25
+ subtitle: string;
26
+ }
27
+ /** The badge, the greeting and the line under it. */
28
+ export declare function AssistantHomeHero({ chip, heading, subtitle }: AssistantHomeHeroContent): import('react').JSX.Element;
29
+ /** One suggestion chip under the message box. */
30
+ export interface AssistantHomeSuggestion {
31
+ key: string;
32
+ /** What the chip says (a long name in it may be clipped). */
33
+ text: string;
34
+ /** The words in full, as a tooltip, when `text` clips them; null or absent: none. */
35
+ title?: string | null;
36
+ /** Its icon, in the two accents by turns. */
37
+ icon: AssistantHomeIcon;
38
+ /** One of the few a phone shows (the rest from `md`). */
39
+ phone: boolean;
40
+ onSelect: () => void;
41
+ }
42
+ export interface AssistantHomeSuggestionsContent {
43
+ /** The list's name for screen readers ("Suggestions"). */
44
+ label: string;
45
+ items: readonly AssistantHomeSuggestion[];
46
+ }
47
+ /** The suggestion chips under the message box: full-width rows on a phone, pills from `md`. */
48
+ export declare function AssistantHomeSuggestions({ label, items }: AssistantHomeSuggestionsContent): import('react').JSX.Element;
49
+ /** One of the latest chats a phone lists under the suggestions. */
50
+ export interface AssistantHomeRecentChat {
51
+ key: string;
52
+ /** Empty: `untitledLabel`. */
53
+ title: string;
54
+ updatedAt: string;
55
+ icon: AssistantHomeIcon;
56
+ }
57
+ export interface AssistantHomeRecentChatsContent {
58
+ /** "Recent chats". */
59
+ title: string;
60
+ /** "View all": History. */
61
+ viewAllLabel: string;
62
+ /** What an untitled chat is called. */
63
+ untitledLabel: string;
64
+ rows: readonly AssistantHomeRecentChat[];
65
+ onOpen: (key: string) => void;
66
+ onViewAll: () => void;
67
+ }
68
+ /** Phones only: the three latest chats, and View all. Nothing without a chat. */
69
+ export declare function AssistantHomeRecentChats({ title, viewAllLabel, untitledLabel, rows, onOpen, onViewAll, }: AssistantHomeRecentChatsContent): import('react').JSX.Element | null;
70
+ /** Which mix of the two accents a start card's icon tile takes. */
71
+ export type AssistantHomeStartCardTile = keyof typeof TILE_GLOW;
72
+ /** One of the ways to start, on a first run. */
73
+ export interface AssistantHomeStartCard {
74
+ key: string;
75
+ tile: AssistantHomeStartCardTile;
76
+ icon: ReactNode;
77
+ title: string;
78
+ body: string;
79
+ onSelect: () => void;
80
+ }
81
+ /** A start card: the only cards with the soft sheen and the lift under the pointer. */
82
+ export declare function AssistantHomeStartCardButton({ icon, title, body, onSelect, tile, }: Omit<AssistantHomeStartCard, 'key'>): import('react').JSX.Element;
83
+ /** One card of a section. */
84
+ export interface AssistantHomeSectionItem {
85
+ key: string;
86
+ content: ReactNode;
87
+ }
88
+ /** A section of cards under the start content, drawn by the page. */
89
+ export interface AssistantHomeSectionData {
90
+ /** Names the section: its heading's id is `assistant-home-<key>`. */
91
+ key: string;
92
+ title: string;
93
+ icon: ReactNode;
94
+ /** A quiet link at the heading's end (say, "All workflows"). */
95
+ action?: {
96
+ label: string;
97
+ href: string;
98
+ };
99
+ /**
100
+ * 3: three cards a row. 2: one a row until the page is wide (`xl`), then two, for cards whose
101
+ * text needs the room beside an action ("Ask why →").
102
+ */
103
+ columns: 2 | 3;
104
+ items: readonly AssistantHomeSectionItem[];
105
+ }
106
+ /** A section the host draws itself (say, with hooks of its own), with `AssistantHomeSection`. */
107
+ export interface AssistantHomeSectionNode {
108
+ key: string;
109
+ content: ReactNode;
110
+ }
111
+ export type AssistantHomeSectionEntry = AssistantHomeSectionData | AssistantHomeSectionNode;
112
+ /** A section: its heading (with an icon and an optional link), then its cards. Nothing without one. */
113
+ export declare function AssistantHomeSection({ section }: {
114
+ section: AssistantHomeSectionData;
115
+ }): import('react').JSX.Element | null;
116
+ export interface AssistantHomeSectionsContent {
117
+ /** First run: the ways to start, three a row. Null or empty: none. */
118
+ startCards?: readonly AssistantHomeStartCard[] | null;
119
+ /** After the start cards, in order. */
120
+ sections?: readonly AssistantHomeSectionEntry[];
121
+ }
122
+ /**
123
+ * Desktop: the start cards (first run) and the host's sections (say, what needs attention, then
124
+ * what to continue). A host draws its sections only once their content is known, all together, so
125
+ * the cards a person is about to click never move.
126
+ */
127
+ export declare function AssistantHomeSections({ startCards, sections }: AssistantHomeSectionsContent): import('react').JSX.Element;
128
+ /** A card under "what needs attention": a tile, two lines and an action at its end. */
129
+ export interface AssistantHomeAttentionCardProps {
130
+ /** The tile: the accent (something waiting for the person), or danger (something failed). */
131
+ tone: 'accent' | 'danger';
132
+ icon: ReactNode;
133
+ /** Two lines at most. */
134
+ title: string;
135
+ /** The title in full, as a tooltip, where `title` clips a name. */
136
+ titleInFull?: string;
137
+ body: string;
138
+ /** The body in full, as a tooltip, where `body` clips a name. */
139
+ bodyInFull?: string;
140
+ /** Clip the body at two lines (it names the person's own things). */
141
+ bodyClamp?: boolean;
142
+ /** The action at the card's end ("Review", "Ask why"), with an arrow. */
143
+ actionLabel: string;
144
+ /** A link… */
145
+ href?: string;
146
+ /** …or a button. */
147
+ onSelect?: () => void;
148
+ }
149
+ export declare function AssistantHomeAttentionCard({ tone, icon, title, titleInFull, body, bodyInFull, bodyClamp, actionLabel, href, onSelect, }: AssistantHomeAttentionCardProps): import('react').JSX.Element;
150
+ /** A card under "continue where you left off": a tile and a badge, a name and a line under it. */
151
+ export interface AssistantHomeContinueCardProps {
152
+ href: string;
153
+ icon: ReactNode;
154
+ /** At the top end (say, a status pill). */
155
+ badge?: ReactNode;
156
+ /** One line, clipped. */
157
+ title: string;
158
+ /** The line under it (say, "Succeeded · 10:15"), with an icon if it needs one. */
159
+ meta: ReactNode;
160
+ }
161
+ export declare function AssistantHomeContinueCard({ href, icon, badge, title, meta, }: AssistantHomeContinueCardProps): import('react').JSX.Element;
162
+ /** Everything a host gives the start content. */
163
+ export interface AssistantHomeStartContent {
164
+ hero: AssistantHomeHeroContent;
165
+ suggestions: AssistantHomeSuggestionsContent;
166
+ /** Phones only, under the suggestions. */
167
+ recentChats: AssistantHomeRecentChatsContent;
168
+ /** Desktop only, under everything else. */
169
+ sections: AssistantHomeSectionsContent;
170
+ }
171
+ export {};
@@ -0,0 +1,224 @@
1
+ import { Fragment as e } from "react";
2
+ import { ArrowRight as t, History as n, Sparkles as r } from "lucide-react";
3
+ import { Fragment as i, jsx as a, jsxs as o } from "react/jsx-runtime";
4
+ import { Link as s } from "react-router";
5
+ // src/shared/assistant/home/AssistantHomeStart.tsx
6
+ var c = "rounded-card border border-border-subtle bg-bg-elevated p-4 text-start transition-colors hover:bg-bg-sunken focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus-ring", l = "flex size-8 shrink-0 items-center justify-center rounded-button bg-accent-soft text-accent-primary", u = "flex size-9 shrink-0 items-center justify-center rounded-button bg-status-error-bg-subtle text-status-error-text", d = "inline-flex shrink-0 items-center gap-1 text-body-sm font-medium text-accent-glow", f = {
7
+ glow: "flex size-9 shrink-0 items-center justify-center rounded-button boff-accent-tile",
8
+ alt: "flex size-9 shrink-0 items-center justify-center rounded-button boff-accent-tile boff-accent-tile--alt",
9
+ duo: "flex size-9 shrink-0 items-center justify-center rounded-button boff-accent-tile boff-accent-tile--duo"
10
+ }, p = "flex items-center gap-2 text-body-sm font-medium text-text-secondary", m = "rounded-button text-body-sm text-text-muted hover:text-text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus-ring", h = [
11
+ "boff-delay-5",
12
+ "boff-delay-6",
13
+ "boff-delay-7"
14
+ ];
15
+ function g() {
16
+ return /* @__PURE__ */ a("div", {
17
+ "aria-hidden": "true",
18
+ className: "pointer-events-none absolute inset-x-0 top-0 -z-10 h-[36rem] overflow-hidden",
19
+ children: /* @__PURE__ */ a("div", { className: "absolute -inset-x-[14%] inset-y-0 boff-mesh-duo" })
20
+ });
21
+ }
22
+ function _({ chip: e, heading: t, subtitle: n }) {
23
+ return /* @__PURE__ */ o(i, { children: [/* @__PURE__ */ o("span", {
24
+ className: "inline-flex items-center gap-2 rounded-pill border border-border-subtle bg-bg-elevated px-3 py-1 text-body-sm font-medium text-text-primary boff-glow-pill boff-rise",
25
+ children: [/* @__PURE__ */ a(r, {
26
+ className: "size-4 text-accent-glow boff-twinkle",
27
+ "aria-hidden": "true"
28
+ }), e]
29
+ }), /* @__PURE__ */ o("div", {
30
+ className: "flex flex-col items-center gap-2 text-center boff-rise boff-delay-1",
31
+ children: [/* @__PURE__ */ a("h1", {
32
+ className: "text-3xl font-bold text-text-primary md:text-4xl",
33
+ children: t
34
+ }), /* @__PURE__ */ a("p", {
35
+ className: "text-body-md text-text-secondary",
36
+ children: n
37
+ })]
38
+ })] });
39
+ }
40
+ function v({ label: e, items: t }) {
41
+ return /* @__PURE__ */ a("ul", {
42
+ "aria-label": e,
43
+ className: "flex w-full flex-col gap-2 md:flex-row md:flex-wrap md:justify-center boff-rise boff-delay-4",
44
+ children: t.map((e, t) => {
45
+ let n = e.icon;
46
+ return /* @__PURE__ */ a("li", {
47
+ className: e.phone ? void 0 : "hidden md:block",
48
+ children: /* @__PURE__ */ o("button", {
49
+ type: "button",
50
+ title: e.title ?? void 0,
51
+ onClick: e.onSelect,
52
+ className: "flex w-full items-center gap-2 rounded-card border border-border-subtle px-3 py-2 text-start text-body-sm text-text-secondary transition-colors hover:bg-bg-sunken hover:text-text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus-ring md:w-auto md:rounded-pill md:py-1.5 boff-wash-chip",
53
+ children: [/* @__PURE__ */ a(n, {
54
+ className: `size-4 shrink-0 ${t % 2 == 0 ? "text-accent-glow" : "text-accent-glow-alt"}`,
55
+ "aria-hidden": "true"
56
+ }), e.text]
57
+ })
58
+ }, e.key);
59
+ })
60
+ });
61
+ }
62
+ function y({ title: e, viewAllLabel: t, untitledLabel: r, rows: i, onOpen: s, onViewAll: c }) {
63
+ let l = [...i].sort((e, t) => t.updatedAt.localeCompare(e.updatedAt)).slice(0, 3);
64
+ return l.length === 0 ? null : /* @__PURE__ */ o("section", {
65
+ "aria-labelledby": "assistant-home-recent",
66
+ className: "flex w-full flex-col gap-1 md:hidden",
67
+ children: [/* @__PURE__ */ o("div", {
68
+ className: "flex items-center justify-between py-2",
69
+ children: [/* @__PURE__ */ o("h2", {
70
+ id: "assistant-home-recent",
71
+ className: p,
72
+ children: [/* @__PURE__ */ a(n, {
73
+ className: "size-4",
74
+ "aria-hidden": "true"
75
+ }), e]
76
+ }), /* @__PURE__ */ a("button", {
77
+ type: "button",
78
+ onClick: c,
79
+ className: m,
80
+ children: t
81
+ })]
82
+ }), /* @__PURE__ */ a("ul", {
83
+ className: "flex flex-col",
84
+ children: l.map((e) => {
85
+ let t = e.icon;
86
+ return /* @__PURE__ */ a("li", { children: /* @__PURE__ */ o("button", {
87
+ type: "button",
88
+ onClick: () => s(e.key),
89
+ className: "flex w-full items-center gap-3 rounded-button px-2 py-2.5 text-start text-body-sm text-text-secondary hover:bg-bg-sunken hover:text-text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus-ring",
90
+ children: [/* @__PURE__ */ a(t, {
91
+ className: "size-4 shrink-0",
92
+ "aria-hidden": "true"
93
+ }), /* @__PURE__ */ a("span", {
94
+ className: "truncate",
95
+ children: e.title || r
96
+ })]
97
+ }) }, e.key);
98
+ })
99
+ })]
100
+ });
101
+ }
102
+ function b({ icon: e, title: t, body: n, onSelect: r, tile: i }) {
103
+ return /* @__PURE__ */ o("button", {
104
+ type: "button",
105
+ onClick: r,
106
+ className: `${c} boff-gloss-card flex h-full w-full flex-col gap-3`,
107
+ children: [/* @__PURE__ */ a("span", {
108
+ className: f[i],
109
+ children: e
110
+ }), /* @__PURE__ */ o("span", {
111
+ className: "flex flex-col gap-1",
112
+ children: [/* @__PURE__ */ a("span", {
113
+ className: "text-body-sm font-semibold text-text-primary",
114
+ children: t
115
+ }), /* @__PURE__ */ a("span", {
116
+ className: "text-body-sm text-text-secondary",
117
+ children: n
118
+ })]
119
+ })]
120
+ });
121
+ }
122
+ function x(e) {
123
+ return "items" in e;
124
+ }
125
+ function S({ section: e }) {
126
+ let { key: t, title: n, icon: r, action: i, columns: c, items: l } = e;
127
+ if (l.length === 0) return null;
128
+ let u = `assistant-home-${t}`;
129
+ return /* @__PURE__ */ o("section", {
130
+ "aria-labelledby": u,
131
+ children: [i ? /* @__PURE__ */ o("div", {
132
+ className: "mb-3 flex items-center justify-between",
133
+ children: [/* @__PURE__ */ o("h2", {
134
+ id: u,
135
+ className: p,
136
+ children: [r, n]
137
+ }), /* @__PURE__ */ a(s, {
138
+ to: i.href,
139
+ className: m,
140
+ children: i.label
141
+ })]
142
+ }) : /* @__PURE__ */ o("h2", {
143
+ id: u,
144
+ className: `${p} mb-3`,
145
+ children: [r, n]
146
+ }), /* @__PURE__ */ a("ul", {
147
+ className: c === 3 ? "grid grid-cols-3 gap-3" : "grid grid-cols-1 gap-3 xl:grid-cols-2",
148
+ children: l.map((e) => /* @__PURE__ */ a("li", { children: e.content }, e.key))
149
+ })]
150
+ });
151
+ }
152
+ function C({ startCards: t, sections: n = [] }) {
153
+ return /* @__PURE__ */ o("div", {
154
+ className: "mx-auto hidden w-full max-w-4xl flex-col gap-8 px-4 pb-16 md:flex",
155
+ children: [t && t.length > 0 ? /* @__PURE__ */ a("ul", {
156
+ className: "grid grid-cols-3 gap-3",
157
+ children: t.map(({ key: e, ...t }, n) => /* @__PURE__ */ a("li", {
158
+ className: `boff-rise ${h[Math.min(n, h.length - 1)]}`,
159
+ children: /* @__PURE__ */ a(b, { ...t })
160
+ }, e))
161
+ }) : null, n.map((t) => x(t) ? /* @__PURE__ */ a(S, { section: t }, t.key) : /* @__PURE__ */ a(e, { children: t.content }, t.key))]
162
+ });
163
+ }
164
+ var w = (e, t) => t === void 0 || t === e ? void 0 : t;
165
+ function T({ tone: e, icon: n, title: r, titleInFull: l, body: p, bodyInFull: m, bodyClamp: h = !1, actionLabel: g, href: _, onSelect: v }) {
166
+ let y = /* @__PURE__ */ o(i, { children: [
167
+ /* @__PURE__ */ a("span", {
168
+ className: e === "danger" ? u : f.glow,
169
+ children: n
170
+ }),
171
+ /* @__PURE__ */ o("span", {
172
+ className: "flex min-w-0 flex-1 flex-col",
173
+ children: [/* @__PURE__ */ a("span", {
174
+ className: "line-clamp-2 text-body-sm font-semibold text-text-primary",
175
+ title: w(r, l),
176
+ children: r
177
+ }), /* @__PURE__ */ a("span", {
178
+ className: h ? "line-clamp-2 text-body-sm text-text-secondary" : "text-body-sm text-text-secondary",
179
+ title: w(p, m),
180
+ children: p
181
+ })]
182
+ }),
183
+ /* @__PURE__ */ o("span", {
184
+ className: d,
185
+ children: [g, /* @__PURE__ */ a(t, {
186
+ className: "size-3.5 rtl:rotate-180",
187
+ "aria-hidden": "true"
188
+ })]
189
+ })
190
+ ] });
191
+ return _ === void 0 ? /* @__PURE__ */ a("button", {
192
+ type: "button",
193
+ onClick: v,
194
+ className: `${c} flex h-full w-full items-center gap-3`,
195
+ children: y
196
+ }) : /* @__PURE__ */ a(s, {
197
+ to: _,
198
+ className: `${c} flex h-full items-center gap-3`,
199
+ children: y
200
+ });
201
+ }
202
+ function E({ href: e, icon: t, badge: n, title: r, meta: i }) {
203
+ return /* @__PURE__ */ o(s, {
204
+ to: e,
205
+ className: `${c} flex h-full flex-col gap-3`,
206
+ children: [/* @__PURE__ */ o("span", {
207
+ className: "flex items-center justify-between gap-2",
208
+ children: [/* @__PURE__ */ a("span", {
209
+ className: l,
210
+ children: t
211
+ }), n]
212
+ }), /* @__PURE__ */ o("span", {
213
+ className: "flex min-w-0 flex-col gap-1",
214
+ children: [/* @__PURE__ */ a("span", {
215
+ className: "truncate text-body-sm font-semibold text-text-primary",
216
+ children: r
217
+ }), /* @__PURE__ */ a("span", {
218
+ className: "flex items-center gap-1.5 text-body-sm text-text-muted",
219
+ children: i
220
+ })]
221
+ })]
222
+ });
223
+ }
224
+ export { T as AssistantHomeAttentionCard, E as AssistantHomeContinueCard, g as AssistantHomeGlow, _ as AssistantHomeHero, y as AssistantHomeRecentChats, S as AssistantHomeSection, C as AssistantHomeSections, b as AssistantHomeStartCardButton, v as AssistantHomeSuggestions };
@@ -0,0 +1,47 @@
1
+ import { AssistantMode } from '../types';
2
+ /**
3
+ * The conversation a new chat goes into: the open one while it is still a reusable draft, the
4
+ * composer's own rule (`isReusableHistoryDraft`: empty, with no history on the server, saved where
5
+ * the next turn will be saved, and idle), otherwise a new one. So the page never piles up empty
6
+ * chats, never sends into a past one (one read from the server holds no message here while its
7
+ * messages load), and never keeps a turn off the history it belongs in (a device-only draft once
8
+ * history is on, or a draft from another account, workspace or product). With a mode (the person
9
+ * chose one, say with a Build/Ask toggle), in that mode; without, the selection as it is
10
+ * (`createConversation`'s own rule).
11
+ */
12
+ export declare function assistantHomeNewChat(mode?: AssistantMode): string;
13
+ /**
14
+ * The open conversation, when a new chat may go into it (`assistantHomeNewChat`): a reusable draft
15
+ * (`isReusableHistoryDraft`), idle. Null otherwise, or with nothing open. The page's New chat asks
16
+ * it too, so it leaves a new chat the history would not keep (say, a device-only draft once history
17
+ * is on) as a new chat's rule does.
18
+ */
19
+ export declare function assistantHomeReusableOpenChat(): string | null;
20
+ /**
21
+ * The page's rule for a new chat (`AssistantHomePage` `newChat`): what it opens on arrival, and
22
+ * what its New chat starts (`AssistantHomeActions`), so a product's new chats begin its way (say,
23
+ * in a mode of its own) whichever way they start. Outside a page, `assistantHomeNewChat`.
24
+ */
25
+ export declare const AssistantHomeNewChatContext: import('react').Context<() => string>;
26
+ /** The page's rule for a new chat (`AssistantHomeNewChatContext`). */
27
+ export declare function useAssistantHomeNewChat(): () => string;
28
+ /**
29
+ * Is the open conversation a new chat already (nothing to leave)? The page's own rule for its start
30
+ * content (`assistantPageStartShows`): empty, not loading or failed to load, no older messages. The
31
+ * page bar (and with it the page's New chat) shows exactly where it is not, so from a chat New chat
32
+ * always starts a new one.
33
+ */
34
+ export declare function assistantHomeOpenChatIsNew(): boolean;
35
+ /**
36
+ * The start page opens on a fresh chat, in the assistant itself. While `active` (the Chat tab of
37
+ * the page without `?chat=1`, hosted):
38
+ * - on arrival, the open conversation is the start page's new chat (`newChat`, by default
39
+ * `assistantHomeNewChat`: the open one while it is still empty, otherwise a new one), so what is
40
+ * typed in the assistant's box starts a NEW chat;
41
+ * - once that chat has its first message, the page moves to `?chat=1` (pushed), so Back returns to
42
+ * a fresh start page.
43
+ *
44
+ * `newChat` is read when the page arrives, not followed: a host's own rule (a product that starts
45
+ * new chats in a mode of its own) can be passed inline.
46
+ */
47
+ export declare function useAssistantHomeStartChat(active: boolean, newChat?: () => string): void;
@@ -0,0 +1,49 @@
1
+ import { isReusableHistoryDraft as e } from "../history/historyList.js";
2
+ import { useAssistantHistoryStatus as t } from "../history/historyStatus.js";
3
+ import { getHistoryStamp as n } from "../history/stampRegistry.js";
4
+ import { useAssistantStore as r } from "../store.js";
5
+ import { assistantPageStartShows as i } from "../ui/assistantPageStart.js";
6
+ import { assistantHomeChatHref as a } from "./assistantHomeRoutes.js";
7
+ import { createContext as o, useContext as s, useEffect as c, useRef as l } from "react";
8
+ import { useNavigate as u } from "react-router";
9
+ // src/shared/assistant/home/assistantHomeChat.ts
10
+ function d(e) {
11
+ let t = r.getState(), n = f();
12
+ return n === null ? t.createConversation(void 0, e) : (e && t.setConversationMode(n, e), n);
13
+ }
14
+ function f() {
15
+ let t = r.getState(), i = t.conversations.find((e) => e.id === t.activeConversationId);
16
+ return i && e(i, n()) && !t.processingByConversationId[i.id] ? i.id : null;
17
+ }
18
+ var p = o(d);
19
+ function m() {
20
+ return s(p);
21
+ }
22
+ function h() {
23
+ let e = r.getState(), n = e.activeConversationId, a = e.conversations.find((e) => e.id === n), o = t.getState();
24
+ return i({
25
+ empty: (a?.messages.length ?? 0) === 0,
26
+ historyPending: n !== null && (n in o.loadingIds || n in o.loadErrorIds),
27
+ hasOlder: a?.sync?.hasOlder === !0
28
+ });
29
+ }
30
+ function g(e, t = d) {
31
+ let n = u(), i = l(t);
32
+ c(() => {
33
+ i.current = t;
34
+ });
35
+ let o = l(null);
36
+ c(() => {
37
+ o.current = e ? i.current() : null;
38
+ }, [e]);
39
+ let s = r((e) => e.activeConversationId), f = r((e) => (e.conversations.find((t) => t.id === e.activeConversationId)?.messages.length ?? 0) > 0);
40
+ c(() => {
41
+ e && f && s !== null && s === o.current && n(a());
42
+ }, [
43
+ e,
44
+ f,
45
+ s,
46
+ n
47
+ ]);
48
+ }
49
+ export { p as AssistantHomeNewChatContext, d as assistantHomeNewChat, h as assistantHomeOpenChatIsNew, f as assistantHomeReusableOpenChat, m as useAssistantHomeNewChat, g as useAssistantHomeStartChat };
@@ -0,0 +1,93 @@
1
+ import { Conversation, Message } from '../conversation';
2
+ import { AssistantHistoryChannel, AssistantHistoryConversationFilter } from '../history/historyTypes';
3
+ import { AssistantMode } from '../types';
4
+ /** The history engine's own filters (the ☰ drawer's), offered where the server has its controls. */
5
+ export type AssistantHomeHistoryEngineFilter = 'pinned' | 'voice' | 'typed' | 'archived';
6
+ export declare const ASSISTANT_HOME_HISTORY_ENGINE_FILTERS: readonly AssistantHomeHistoryEngineFilter[];
7
+ /**
8
+ * Every pill: All, the product's kinds (`K`), and the engine's filters (Pinned, Voice, Typed: typed
9
+ * turns only, Archived).
10
+ */
11
+ export type AssistantHomeHistoryFilter<K extends string = string> = 'all' | K | AssistantHomeHistoryEngineFilter;
12
+ /** Is the pill one of the history engine's own filters (not All, not a kind)? */
13
+ export declare function isAssistantHomeHistoryEngineFilter(filter: string): filter is AssistantHomeHistoryEngineFilter;
14
+ /** The engine's filter for a pill (a stable reference per pill). */
15
+ export declare function assistantHomeHistoryEngineFilterOf(filter: string): Readonly<AssistantHistoryConversationFilter>;
16
+ /** The date groups, newest first. */
17
+ export type AssistantHomeHistoryGroup = 'today' | 'yesterday' | 'week' | 'older';
18
+ export declare const ASSISTANT_HOME_HISTORY_GROUPS: readonly AssistantHomeHistoryGroup[];
19
+ /** One row as the page shows it. A product may add its own fields (`AssistantHomeHistory`'s `rowLink`). */
20
+ export interface AssistantHomeHistoryRow<K extends string = string> {
21
+ /** The conversation key the history engine and store address it by. */
22
+ key: string;
23
+ /** Empty when neither the device nor the server has a title (the page names it). */
24
+ title: string;
25
+ updatedAt: string;
26
+ /**
27
+ * What the chat was for, from its mode. Null when unknown: a conversation only the server has
28
+ * (its header carries no mode). Such a row is listed under All only, never guessed into a kind.
29
+ */
30
+ kind: K | null;
31
+ pinned: boolean;
32
+ /** Pin / unpin may be offered (the server can address it, and it is not archived). */
33
+ canPin: boolean;
34
+ /** Archived (listed under Archived only). */
35
+ archived: boolean;
36
+ /** Archive / unarchive may be offered (as pin: the server can address it). */
37
+ canArchive: boolean;
38
+ /**
39
+ * False where the chat can be renamed neither on this device nor on the server: one only the
40
+ * server has, while the server lacks its controls (the drawer leaves Rename out there too).
41
+ * Absent: it can be renamed.
42
+ */
43
+ canRename?: boolean;
44
+ /** Typed, spoken or both; null when unknown. */
45
+ channel: AssistantHistoryChannel | null;
46
+ /** Typed and spoken turns, where this device holds the chat; null for a chat only the server has. */
47
+ typedCount: number | null;
48
+ spokenCount: number | null;
49
+ }
50
+ /** What the history list resolved for one row (`useAssistantHomeHistoryRows` hands it to `rowOf`). */
51
+ export interface AssistantHomeHistoryRowInput {
52
+ key: string;
53
+ title: string;
54
+ updatedAt: string;
55
+ conversation: Pick<Conversation, 'mode' | 'messages'> | null;
56
+ pinnedAt: string | null;
57
+ canPin: boolean;
58
+ /** The engine's archive stamp and channel (absent: a device-only chat). */
59
+ archivedAt?: string | null;
60
+ channel?: AssistantHistoryChannel | null;
61
+ }
62
+ /** The kind a product reads from a conversation's mode; null when it cannot tell. */
63
+ export type AssistantHomeHistoryKindOf<K extends string> = (mode: AssistantMode | null | undefined) => K | null;
64
+ /** The view of one row, given what the history list resolved for it and the product's kinds. */
65
+ export declare function assistantHomeHistoryRowOf<K extends string>(row: AssistantHomeHistoryRowInput, kindOf: AssistantHomeHistoryKindOf<K>): AssistantHomeHistoryRow<K>;
66
+ /**
67
+ * The newest link in the assistant's replies that `pattern` matches, say the page of something the
68
+ * chat built (the last match in the newest reply that has one); null when there is none. Every match
69
+ * counts, with or without the pattern's `g` flag.
70
+ */
71
+ export declare function assistantHomeLastReplyLink(messages: readonly Pick<Message, 'role' | 'content'>[] | undefined, pattern: RegExp): string | null;
72
+ /**
73
+ * The group a timestamp falls in, by the reader's calendar days: today, yesterday, the five days
74
+ * before that ("This week"), then older. A missing or unreadable timestamp is Older.
75
+ */
76
+ export declare function assistantHomeHistoryGroupOf(updatedAt: string, now: Date): AssistantHomeHistoryGroup;
77
+ /** Case-insensitive title match; a blank query matches everything. */
78
+ export declare function matchesAssistantHomeHistoryQuery(row: Pick<AssistantHomeHistoryRow, 'title'>, query: string, untitled: string): boolean;
79
+ /** A kind pill narrows by kind; All and the engine's pills are the engine's filter, already applied. */
80
+ export declare function matchesAssistantHomeHistoryKind(row: Pick<AssistantHomeHistoryRow, 'kind'>, filter: string): boolean;
81
+ /**
82
+ * The rows in their groups, each newest first, empty groups dropped. Pinned rows are not lifted out
83
+ * of their date: a sidebar's Pinned block is where pins sit at the top.
84
+ */
85
+ export declare function groupAssistantHomeHistoryRows<T extends Pick<AssistantHomeHistoryRow, 'updatedAt'>>(rows: readonly T[], now: Date): Array<{
86
+ group: AssistantHomeHistoryGroup;
87
+ rows: T[];
88
+ }>;
89
+ /**
90
+ * The time on the right of a row: the clock time today, "Yesterday"'s and this week's weekday,
91
+ * otherwise the date ("22 Oct").
92
+ */
93
+ export declare function assistantHomeHistoryTimeLabel(updatedAt: string, group: AssistantHomeHistoryGroup, locale: string): string;