astryx-dracula 0.5.0 → 0.6.2
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/BRAND.md +3 -3
- package/README.md +7 -4
- package/USAGE.md +49 -49
- package/astryx-dracula.d.ts +2 -2
- package/astryx-dracula.js +25 -9
- package/astryx-dracula.variants.d.ts +2 -2
- package/astryx.integration.mjs +1 -1
- package/icons.mjs +21 -17
- package/icons.tsx +69 -62
- package/package.json +125 -120
- package/shared/auth-chrome-config.ts +6 -6
- package/shared/auth-chrome.tsx +143 -144
- package/shared/auth-copy.ts +14 -14
- package/shared/chaptered-doc-config.ts +48 -51
- package/shared/chaptered-doc.tsx +267 -289
- package/shared/chart-hues.ts +25 -10
- package/shared/chart-labels.tsx +31 -30
- package/shared/chart-legend.tsx +55 -56
- package/shared/chart-panel-style.ts +3 -3
- package/shared/data-bar.tsx +97 -102
- package/shared/format-money.ts +1 -1
- package/shared/gallery-image.ts +6 -6
- package/shared/login-demo.ts +1 -1
- package/shared/metric-card.tsx +101 -105
- package/shared/metric-delta.tsx +28 -27
- package/shared/order-desk.tsx +205 -216
- package/shared/revenue-chart.tsx +145 -165
- package/shared/scene-castle.tsx +206 -291
- package/shared/scene-frame.tsx +33 -32
- package/shared/scene-hues.ts +17 -17
- package/shared/scene-tile.tsx +88 -92
- package/shared/settings-data.ts +119 -125
- package/shared/settings-rows.tsx +122 -159
- package/shared/sparkline.tsx +75 -88
- package/shared/sso-icons.tsx +10 -22
- package/shared/stars.tsx +16 -25
- package/templates/ai-chat-landing.template.mjs +5 -4
- package/templates/ai-chat-landing.tsx +473 -460
- package/templates/ai-chat.template.mjs +5 -4
- package/templates/ai-chat.tsx +543 -612
- package/templates/blank.template.mjs +5 -4
- package/templates/blank.tsx +18 -14
- package/templates/centered-hero.template.mjs +5 -4
- package/templates/centered-hero.tsx +55 -68
- package/templates/classic-gallery.template.mjs +5 -4
- package/templates/classic-gallery.tsx +97 -104
- package/templates/contact-form.template.mjs +5 -4
- package/templates/contact-form.tsx +247 -282
- package/templates/dashboard-portfolio.template.mjs +5 -4
- package/templates/dashboard-portfolio.tsx +717 -548
- package/templates/dashboard.template.mjs +5 -4
- package/templates/dashboard.tsx +596 -567
- package/templates/detail-page.template.mjs +5 -4
- package/templates/detail-page.tsx +546 -603
- package/templates/documentation-design.template.mjs +5 -4
- package/templates/documentation-design.tsx +231 -243
- package/templates/documentation-technical.template.mjs +5 -4
- package/templates/documentation-technical.tsx +236 -239
- package/templates/documentation.template.mjs +5 -4
- package/templates/documentation.tsx +267 -279
- package/templates/editor.template.mjs +5 -4
- package/templates/editor.tsx +844 -877
- package/templates/file-explorer.template.mjs +5 -4
- package/templates/file-explorer.tsx +566 -590
- package/templates/form-two-column.template.mjs +5 -4
- package/templates/form-two-column.tsx +195 -210
- package/templates/gallery-hero.template.mjs +5 -4
- package/templates/gallery-hero.tsx +93 -114
- package/templates/ide.template.mjs +5 -4
- package/templates/ide.tsx +407 -453
- package/templates/incident-console.template.mjs +5 -4
- package/templates/incident-console.tsx +593 -575
- package/templates/kanban-board.template.mjs +5 -4
- package/templates/kanban-board.tsx +665 -683
- package/templates/library.template.mjs +5 -4
- package/templates/library.tsx +409 -430
- package/templates/login-card.template.mjs +5 -4
- package/templates/login-card.tsx +63 -72
- package/templates/login-split.template.mjs +5 -4
- package/templates/login-split.tsx +192 -193
- package/templates/login-sso.template.mjs +5 -4
- package/templates/login-sso.tsx +257 -258
- package/templates/login.template.mjs +5 -4
- package/templates/login.tsx +53 -49
- package/templates/messaging-shell.template.mjs +5 -4
- package/templates/messaging-shell.tsx +556 -574
- package/templates/mixed-gallery.template.mjs +5 -4
- package/templates/mixed-gallery.tsx +60 -58
- package/templates/payment-form.template.mjs +5 -4
- package/templates/payment-form.tsx +882 -991
- package/templates/product-detail.template.mjs +5 -4
- package/templates/product-detail.tsx +261 -272
- package/templates/product-gallery.template.mjs +5 -4
- package/templates/product-gallery.tsx +126 -137
- package/templates/product-tour.template.mjs +5 -4
- package/templates/product-tour.tsx +741 -773
- package/templates/settings-dialog.template.mjs +5 -4
- package/templates/settings-dialog.tsx +688 -717
- package/templates/settings-sidebar.template.mjs +5 -4
- package/templates/settings-sidebar.tsx +762 -807
- package/templates/settings.template.mjs +5 -4
- package/templates/settings.tsx +289 -304
- package/templates/shell-nav.template.mjs +5 -4
- package/templates/shell-nav.tsx +212 -219
- package/templates/shell-side-nav.template.mjs +5 -4
- package/templates/shell-side-nav.tsx +135 -157
- package/templates/shell-top-nav.template.mjs +5 -4
- package/templates/shell-top-nav.tsx +182 -203
- package/templates/side-gallery.template.mjs +5 -4
- package/templates/side-gallery.tsx +85 -90
- package/templates/table-grouped.template.mjs +5 -4
- package/templates/table-grouped.tsx +1000 -1053
- package/templates/table-page-chart.template.mjs +5 -4
- package/templates/table-page-chart.tsx +400 -398
- package/templates/table-page-heatmap-status.template.mjs +5 -4
- package/templates/table-page-heatmap-status.tsx +483 -512
- package/templates/table-page-shoe-store-heatmap.template.mjs +5 -4
- package/templates/table-page-shoe-store-heatmap.tsx +748 -746
- package/templates/table-page.template.mjs +5 -4
- package/templates/table-page.tsx +396 -405
- package/templates/table.template.mjs +5 -4
- package/templates/table.tsx +92 -93
- package/templates/tech-report.template.mjs +5 -4
- package/templates/tech-report.tsx +1316 -1304
- package/templates/theme-showcase.template.mjs +5 -4
- package/templates/theme-showcase.tsx +871 -951
- package/theme.css +35 -77
- package/theme.css.d.ts +9 -0
- package/tokens.css +373 -380
package/templates/ai-chat.tsx
CHANGED
|
@@ -1,56 +1,42 @@
|
|
|
1
1
|
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
-
// XLE (canonical structure
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
StackItem,
|
|
11
|
-
Layout,
|
|
12
|
-
LayoutContent,
|
|
13
|
-
} from '@astryxdesign/core/Layout';
|
|
14
|
-
import {Text, Heading} from '@astryxdesign/core/Text';
|
|
15
|
-
import {
|
|
16
|
-
ChatComposer,
|
|
17
|
-
ChatComposerInput,
|
|
18
|
-
ChatLayout,
|
|
19
|
-
ChatMessage,
|
|
20
|
-
ChatMessageBubble,
|
|
21
|
-
ChatMessageList,
|
|
22
|
-
ChatMessageMetadata,
|
|
23
|
-
ChatSystemMessage,
|
|
24
|
-
ChatTokenizedText,
|
|
25
|
-
ChatToolCalls,
|
|
26
|
-
} from '@astryxdesign/core/Chat';
|
|
27
|
-
import {Avatar} from '@astryxdesign/core/Avatar';
|
|
28
|
-
import {Card} from '@astryxdesign/core/Card';
|
|
29
|
-
import {ClickableCard} from '@astryxdesign/core/ClickableCard';
|
|
30
|
-
import {Section} from '@astryxdesign/core/Section';
|
|
31
|
-
import {Markdown} from '@astryxdesign/core/Markdown';
|
|
32
|
-
import {CodeBlock} from '@astryxdesign/core/CodeBlock';
|
|
33
|
-
import {Timestamp} from '@astryxdesign/core/Timestamp';
|
|
34
|
-
import {Token} from '@astryxdesign/core/Token';
|
|
35
|
-
import {Button} from '@astryxdesign/core/Button';
|
|
36
|
-
import {Icon} from '@astryxdesign/core/Icon';
|
|
37
|
-
import {Dialog, DialogHeader} from '@astryxdesign/core/Dialog';
|
|
38
|
-
import {VisuallyHidden} from '@astryxdesign/core/VisuallyHidden';
|
|
39
|
-
import {DropdownMenu} from '@astryxdesign/core/DropdownMenu';
|
|
40
|
-
import {MoreMenu} from '@astryxdesign/core/MoreMenu';
|
|
41
|
-
import {Toolbar} from '@astryxdesign/core/Toolbar';
|
|
42
|
-
import {useResizable, ResizeHandle} from '@astryxdesign/core/Resizable';
|
|
43
|
-
import {useMediaQuery} from '@astryxdesign/core/hooks';
|
|
44
|
-
|
|
2
|
+
// XLE (canonical structure of the tree below; the CLI had no XLE validator
|
|
3
|
+
// after `astryx layout` was removed in 0.7.0, so this is a reading aid and a
|
|
4
|
+
// human drift check — update it with the file, never alone):
|
|
5
|
+
// L > LC[p=0] > H > (V > ChL > (VH"Night thread"[as=h1] + ChML > (ChSM"Today" + (ChM > ChBu)*8 + ChSM"Changes sealed in the crypt") + ChC"Ask the night anything...")) + (RH + C.transparent > Tbar + S.transparent > (V[g=2] > Hd"JWT Token Refresh: Design & Rollout"[level=2 t=display-2] + MD)) ;; Dlg#artifact[variant=fullscreen] > L > (DH"JWT Token Refresh" + (LC[p=0] > S.transparent > (V[g=2] > Hd"JWT Token Refresh: Design & Rollout"[level=2 t=display-2] + MD)))
|
|
6
|
+
|
|
7
|
+
import { Avatar } from "@astryxdesign/core/Avatar";
|
|
8
|
+
import { Button } from "@astryxdesign/core/Button";
|
|
9
|
+
import { Card } from "@astryxdesign/core/Card";
|
|
45
10
|
import {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
11
|
+
ChatComposer,
|
|
12
|
+
ChatComposerInput,
|
|
13
|
+
ChatLayout,
|
|
14
|
+
ChatMessage,
|
|
15
|
+
ChatMessageBubble,
|
|
16
|
+
ChatMessageList,
|
|
17
|
+
ChatMessageMetadata,
|
|
18
|
+
ChatSystemMessage,
|
|
19
|
+
ChatTokenizedText,
|
|
20
|
+
ChatToolCalls,
|
|
21
|
+
} from "@astryxdesign/core/Chat";
|
|
22
|
+
import { ClickableCard } from "@astryxdesign/core/ClickableCard";
|
|
23
|
+
import { CodeBlock } from "@astryxdesign/core/CodeBlock";
|
|
24
|
+
import { Dialog, DialogHeader } from "@astryxdesign/core/Dialog";
|
|
25
|
+
import { DropdownMenu } from "@astryxdesign/core/DropdownMenu";
|
|
26
|
+
import { useMediaQuery } from "@astryxdesign/core/hooks";
|
|
27
|
+
import { Icon } from "@astryxdesign/core/Icon";
|
|
28
|
+
import { HStack, Layout, LayoutContent, StackItem, VStack } from "@astryxdesign/core/Layout";
|
|
29
|
+
import { Markdown } from "@astryxdesign/core/Markdown";
|
|
30
|
+
import { MoreMenu } from "@astryxdesign/core/MoreMenu";
|
|
31
|
+
import { ResizeHandle, useResizable } from "@astryxdesign/core/Resizable";
|
|
32
|
+
import { Section } from "@astryxdesign/core/Section";
|
|
33
|
+
import { Heading, Text } from "@astryxdesign/core/Text";
|
|
34
|
+
import { Timestamp } from "@astryxdesign/core/Timestamp";
|
|
35
|
+
import { Token } from "@astryxdesign/core/Token";
|
|
36
|
+
import { Toolbar } from "@astryxdesign/core/Toolbar";
|
|
37
|
+
import { VisuallyHidden } from "@astryxdesign/core/VisuallyHidden";
|
|
38
|
+
import { AtSign, ChevronRight, Copy, FileText, Paperclip, Share2, X } from "lucide-react";
|
|
39
|
+
import { type CSSProperties, useState } from "react";
|
|
54
40
|
|
|
55
41
|
// Below this container width the split-pane collapses to a single chat column
|
|
56
42
|
// and the artifact opens as a full-screen dialog instead. Single source:
|
|
@@ -60,55 +46,53 @@ import {
|
|
|
60
46
|
// the 640px default artifact panel.
|
|
61
47
|
const MOBILE_MAX_WIDTH = 1023;
|
|
62
48
|
const root: CSSProperties = {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
49
|
+
// The viewer owns its chrome: the root fills the viewport and the message
|
|
50
|
+
// list plus artifact body scroll inside it (editor pattern).
|
|
51
|
+
height: "100dvh",
|
|
52
|
+
width: "100%",
|
|
67
53
|
};
|
|
68
54
|
const chatColumn: CSSProperties = {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
55
|
+
flex: 1,
|
|
56
|
+
width: "100%",
|
|
57
|
+
minWidth: 0,
|
|
58
|
+
height: "100%",
|
|
73
59
|
};
|
|
74
60
|
const chatLayout: CSSProperties = {
|
|
75
|
-
|
|
76
|
-
|
|
61
|
+
flex: 1,
|
|
62
|
+
minHeight: 0,
|
|
77
63
|
};
|
|
78
64
|
// ChatMessage already separates its children by --spacing-2, so this doubles
|
|
79
65
|
// that step to set the attached document apart from its bubble. --space-gap
|
|
80
66
|
// (24px) is a layout gutter, not an in-message rhythm.
|
|
81
67
|
const artifactCard: CSSProperties = {
|
|
82
|
-
|
|
68
|
+
marginBlockStart: "var(--spacing-2)",
|
|
83
69
|
};
|
|
84
70
|
const artifactScroll: CSSProperties = {
|
|
85
|
-
|
|
86
|
-
|
|
71
|
+
flex: 1,
|
|
72
|
+
overflowY: "auto",
|
|
87
73
|
};
|
|
88
74
|
const articleBody: CSSProperties = {
|
|
89
|
-
|
|
90
|
-
|
|
75
|
+
maxWidth: 720,
|
|
76
|
+
marginInline: "auto",
|
|
91
77
|
};
|
|
92
78
|
|
|
93
79
|
// Width for the artifact panel. Plain style object — the panel unmounts below
|
|
94
80
|
// the breakpoint (see useMediaQuery in the component), so no container query
|
|
95
81
|
// or <style> tag is needed to hide it.
|
|
96
82
|
const artifactPanelWidthVar = (size: number | string): CSSProperties =>
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
83
|
+
({
|
|
84
|
+
width: typeof size === "number" ? `${size}px` : size,
|
|
85
|
+
flexShrink: 0,
|
|
86
|
+
overflow: "hidden",
|
|
87
|
+
}) as CSSProperties;
|
|
102
88
|
|
|
103
89
|
// Artifact content
|
|
104
90
|
|
|
105
|
-
const MENTION_TOKENS = [
|
|
106
|
-
{value: '@agent', label: '@Agent', variant: 'cyan' as const},
|
|
107
|
-
];
|
|
91
|
+
const MENTION_TOKENS = [{ value: "@agent", label: "@Agent", variant: "cyan" as const }];
|
|
108
92
|
|
|
109
|
-
const ARTIFACT_TITLE =
|
|
93
|
+
const ARTIFACT_TITLE = "JWT Token Refresh: Design & Rollout";
|
|
110
94
|
|
|
111
|
-
const ARTIFACT_SUBTITLE =
|
|
95
|
+
const ARTIFACT_SUBTITLE = "Grimoire · Sealed just now";
|
|
112
96
|
|
|
113
97
|
const ARTIFACT_CONTENT = `## Overview
|
|
114
98
|
|
|
@@ -155,272 +139,266 @@ The refresh path is covered end to end:
|
|
|
155
139
|
// Copy/Share live in both surfaces: desktop toolbar buttons and the mobile
|
|
156
140
|
// overflow menu. One items array so the two can't drift.
|
|
157
141
|
const ARTIFACT_ACTION_ITEMS = [
|
|
158
|
-
|
|
159
|
-
|
|
142
|
+
{ label: "Copy", icon: Copy },
|
|
143
|
+
{ label: "Share", icon: Share2 },
|
|
160
144
|
] as const;
|
|
161
145
|
|
|
162
146
|
// Header actions: version menu, copy, share. Pass `onClose` for the desktop
|
|
163
147
|
// close button. A fragment so each control is a direct child of the toolbar.
|
|
164
|
-
function ArtifactActions({onClose}: {onClose?: () => void}) {
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
148
|
+
function ArtifactActions({ onClose }: { onClose?: () => void }) {
|
|
149
|
+
return (
|
|
150
|
+
<>
|
|
151
|
+
<DropdownMenu
|
|
152
|
+
button={{
|
|
153
|
+
label: "v2",
|
|
154
|
+
variant: "ghost",
|
|
155
|
+
size: "sm",
|
|
156
|
+
}}
|
|
157
|
+
items={[{ label: "v2 (current)" }, { label: "v1" }]}
|
|
158
|
+
/>
|
|
159
|
+
{ARTIFACT_ACTION_ITEMS.map((item) => (
|
|
160
|
+
<Button
|
|
161
|
+
key={item.label}
|
|
162
|
+
label={item.label}
|
|
163
|
+
variant="ghost"
|
|
164
|
+
size="sm"
|
|
165
|
+
icon={<Icon icon={item.icon} size="sm" />}
|
|
166
|
+
isIconOnly
|
|
167
|
+
/>
|
|
168
|
+
))}
|
|
169
|
+
{onClose != null && (
|
|
170
|
+
<Button
|
|
171
|
+
label="Close document"
|
|
172
|
+
variant="ghost"
|
|
173
|
+
size="sm"
|
|
174
|
+
icon={<Icon icon={X} size="sm" />}
|
|
175
|
+
isIconOnly
|
|
176
|
+
onClick={onClose}
|
|
177
|
+
/>
|
|
178
|
+
)}
|
|
179
|
+
</>
|
|
180
|
+
);
|
|
197
181
|
}
|
|
198
182
|
|
|
199
183
|
// Mobile variant: the actions collapse into an overflow menu.
|
|
200
184
|
function MobileArtifactActions() {
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
185
|
+
return (
|
|
186
|
+
<MoreMenu
|
|
187
|
+
label="Document actions"
|
|
188
|
+
size="sm"
|
|
189
|
+
items={[
|
|
190
|
+
{
|
|
191
|
+
type: "section",
|
|
192
|
+
title: "Version",
|
|
193
|
+
items: [{ label: "v2 (current)" }, { label: "v1" }],
|
|
194
|
+
},
|
|
195
|
+
{ type: "divider" },
|
|
196
|
+
...ARTIFACT_ACTION_ITEMS,
|
|
197
|
+
]}
|
|
198
|
+
/>
|
|
199
|
+
);
|
|
216
200
|
}
|
|
217
201
|
|
|
218
202
|
// Scrollable artifact content — the formatted document, no heading. The
|
|
219
203
|
// desktop panel renders ArtifactBody above it; the mobile dialog renders its
|
|
220
204
|
// title in DialogHeader instead, so both share this rather than a flag prop.
|
|
221
205
|
function ArtifactContent() {
|
|
222
|
-
|
|
206
|
+
return <Markdown>{ARTIFACT_CONTENT}</Markdown>;
|
|
223
207
|
}
|
|
224
208
|
// Desktop body: in-body heading plus the shared content.
|
|
225
209
|
function ArtifactBody() {
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
210
|
+
return (
|
|
211
|
+
<Section
|
|
212
|
+
variant="transparent"
|
|
213
|
+
style={artifactScroll}
|
|
214
|
+
role="region"
|
|
215
|
+
aria-label={ARTIFACT_TITLE}
|
|
216
|
+
tabIndex={0}
|
|
217
|
+
>
|
|
218
|
+
<VStack gap={2} style={articleBody}>
|
|
219
|
+
<Heading level={2} type="display-2">
|
|
220
|
+
{ARTIFACT_TITLE}
|
|
221
|
+
</Heading>
|
|
222
|
+
<ArtifactContent />
|
|
223
|
+
</VStack>
|
|
224
|
+
</Section>
|
|
225
|
+
);
|
|
241
226
|
}
|
|
242
227
|
|
|
243
228
|
// In-message card that opens the artifact panel/dialog.
|
|
244
|
-
function ArtifactCard({onOpen}: {onOpen: () => void}) {
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
229
|
+
function ArtifactCard({ onOpen }: { onOpen: () => void }) {
|
|
230
|
+
return (
|
|
231
|
+
<ClickableCard
|
|
232
|
+
label={`Open ${ARTIFACT_TITLE}`}
|
|
233
|
+
onClick={onOpen}
|
|
234
|
+
variant="muted"
|
|
235
|
+
padding={3}
|
|
236
|
+
maxWidth={360}
|
|
237
|
+
style={artifactCard}
|
|
238
|
+
>
|
|
239
|
+
<HStack gap={3} vAlign="center" width="100%">
|
|
240
|
+
<Icon icon={FileText} size="md" color="secondary" />
|
|
241
|
+
<StackItem size="fill">
|
|
242
|
+
<VStack gap={0}>
|
|
243
|
+
<Text type="label" weight="semibold">
|
|
244
|
+
{ARTIFACT_TITLE}
|
|
245
|
+
</Text>
|
|
246
|
+
<Text type="supporting" color="secondary">
|
|
247
|
+
Grimoire
|
|
248
|
+
</Text>
|
|
249
|
+
</VStack>
|
|
250
|
+
</StackItem>
|
|
251
|
+
<Icon icon={ChevronRight} size="sm" color="secondary" />
|
|
252
|
+
</HStack>
|
|
253
|
+
</ClickableCard>
|
|
254
|
+
);
|
|
269
255
|
}
|
|
270
256
|
|
|
271
257
|
// Main component
|
|
272
258
|
|
|
273
259
|
export default function AiChat() {
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
duration: '120ms',
|
|
417
|
-
node: 'cli:remote-server',
|
|
418
|
-
},
|
|
419
|
-
]}
|
|
420
|
-
/>
|
|
421
|
-
|
|
422
|
-
<ChatMessageBubble variant="ghost">
|
|
423
|
-
<Markdown density="compact">{`Found the issue. In \`middleware.ts\`, the token validation runs **before** the refresh check. When a token expires, the middleware rejects the request immediately instead of attempting a refresh.
|
|
260
|
+
const [composerMode, setComposerMode] = useState("ask");
|
|
261
|
+
// Mobile shows the artifact as a full-screen dialog; desktop as a side panel.
|
|
262
|
+
const [isArtifactDialogOpen, setIsArtifactDialogOpen] = useState(false);
|
|
263
|
+
const [isArtifactOpen, setIsArtifactOpen] = useState(true);
|
|
264
|
+
const artifactResize = useResizable({
|
|
265
|
+
defaultSize: 640,
|
|
266
|
+
minSize: 480,
|
|
267
|
+
maxSize: 960,
|
|
268
|
+
autoSaveId: "ai-chat-artifact-panel",
|
|
269
|
+
});
|
|
270
|
+
|
|
271
|
+
// Single source for the breakpoint: the media query both gates the panel
|
|
272
|
+
// below and routes openArtifact, so the split-pane and the dialog target
|
|
273
|
+
// can't disagree about which surface is live.
|
|
274
|
+
const isMobileWidth = useMediaQuery(`(max-width: ${MOBILE_MAX_WIDTH}px)`);
|
|
275
|
+
const openArtifact = () => {
|
|
276
|
+
if (isMobileWidth) {
|
|
277
|
+
setIsArtifactDialogOpen(true);
|
|
278
|
+
} else {
|
|
279
|
+
setIsArtifactOpen(true);
|
|
280
|
+
}
|
|
281
|
+
};
|
|
282
|
+
|
|
283
|
+
return (
|
|
284
|
+
<VStack style={root}>
|
|
285
|
+
<Layout
|
|
286
|
+
height="fill"
|
|
287
|
+
content={
|
|
288
|
+
<LayoutContent padding={0}>
|
|
289
|
+
<HStack height="100%">
|
|
290
|
+
{/* Chat column — flexes to fill the space the artifact leaves */}
|
|
291
|
+
<VStack style={chatColumn}>
|
|
292
|
+
<ChatLayout
|
|
293
|
+
density="spacious"
|
|
294
|
+
style={chatLayout}
|
|
295
|
+
composer={
|
|
296
|
+
<ChatComposer
|
|
297
|
+
onSubmit={() => {}}
|
|
298
|
+
placeholder={
|
|
299
|
+
composerMode === "ask"
|
|
300
|
+
? "Ask the night anything..."
|
|
301
|
+
: "Describe the rite..."
|
|
302
|
+
}
|
|
303
|
+
input={<ChatComposerInput />}
|
|
304
|
+
headerActions={
|
|
305
|
+
<>
|
|
306
|
+
<Button
|
|
307
|
+
label="Mention"
|
|
308
|
+
variant="ghost"
|
|
309
|
+
size="sm"
|
|
310
|
+
icon={<Icon icon={AtSign} size="sm" />}
|
|
311
|
+
isIconOnly
|
|
312
|
+
/>
|
|
313
|
+
<Button
|
|
314
|
+
label="Attach"
|
|
315
|
+
variant="ghost"
|
|
316
|
+
size="sm"
|
|
317
|
+
icon={<Icon icon={Paperclip} size="sm" />}
|
|
318
|
+
isIconOnly
|
|
319
|
+
/>
|
|
320
|
+
</>
|
|
321
|
+
}
|
|
322
|
+
footerActions={
|
|
323
|
+
<DropdownMenu
|
|
324
|
+
button={{
|
|
325
|
+
label: composerMode === "ask" ? "Ask" : "Edit",
|
|
326
|
+
variant: "ghost",
|
|
327
|
+
size: "sm",
|
|
328
|
+
}}
|
|
329
|
+
items={[
|
|
330
|
+
{
|
|
331
|
+
label: "Ask",
|
|
332
|
+
onClick: () => setComposerMode("ask"),
|
|
333
|
+
},
|
|
334
|
+
{
|
|
335
|
+
label: "Edit",
|
|
336
|
+
onClick: () => setComposerMode("edit"),
|
|
337
|
+
},
|
|
338
|
+
]}
|
|
339
|
+
/>
|
|
340
|
+
}
|
|
341
|
+
/>
|
|
342
|
+
}
|
|
343
|
+
>
|
|
344
|
+
<VisuallyHidden as="h1">Night thread</VisuallyHidden>
|
|
345
|
+
<ChatMessageList>
|
|
346
|
+
{/* Date divider */}
|
|
347
|
+
<ChatSystemMessage variant="divider">Today</ChatSystemMessage>
|
|
348
|
+
|
|
349
|
+
{/* User message: mention + file attachments */}
|
|
350
|
+
<ChatMessage sender="user">
|
|
351
|
+
<HStack gap={1} wrap="wrap">
|
|
352
|
+
<Token label="auth-service.ts" />
|
|
353
|
+
<Token label="middleware.ts" />
|
|
354
|
+
</HStack>
|
|
355
|
+
<ChatMessageBubble
|
|
356
|
+
metadata={
|
|
357
|
+
<ChatMessageMetadata
|
|
358
|
+
timestamp={<Timestamp value="2026-04-29T10:15:00" format="time" />}
|
|
359
|
+
/>
|
|
360
|
+
}
|
|
361
|
+
>
|
|
362
|
+
<ChatTokenizedText tokens={MENTION_TOKENS}>
|
|
363
|
+
@agent Can you review these auth files? The JWT refresh logic seems
|
|
364
|
+
broken, tokens expire but the middleware doesn't catch it.
|
|
365
|
+
</ChatTokenizedText>
|
|
366
|
+
</ChatMessageBubble>
|
|
367
|
+
</ChatMessage>
|
|
368
|
+
|
|
369
|
+
{/* Assistant message: tool calls, markdown, code block */}
|
|
370
|
+
<ChatMessage sender="assistant" avatar={<Avatar name="Agent" size="md" />}>
|
|
371
|
+
<ChatMessageBubble variant="ghost">
|
|
372
|
+
Looking into the auth files now. Let me read through the code and trace the
|
|
373
|
+
token refresh flow.
|
|
374
|
+
</ChatMessageBubble>
|
|
375
|
+
<ChatToolCalls
|
|
376
|
+
defaultIsExpanded
|
|
377
|
+
calls={[
|
|
378
|
+
{
|
|
379
|
+
name: "read",
|
|
380
|
+
target: "auth-service.ts",
|
|
381
|
+
status: "complete",
|
|
382
|
+
duration: "45ms",
|
|
383
|
+
},
|
|
384
|
+
{
|
|
385
|
+
name: "read",
|
|
386
|
+
target: "middleware.ts",
|
|
387
|
+
status: "complete",
|
|
388
|
+
duration: "38ms",
|
|
389
|
+
},
|
|
390
|
+
{
|
|
391
|
+
name: "bash",
|
|
392
|
+
target: 'grep -rn "refreshToken" src/',
|
|
393
|
+
status: "complete",
|
|
394
|
+
duration: "120ms",
|
|
395
|
+
node: "cli:remote-server",
|
|
396
|
+
},
|
|
397
|
+
]}
|
|
398
|
+
/>
|
|
399
|
+
|
|
400
|
+
<ChatMessageBubble variant="ghost">
|
|
401
|
+
<Markdown density="compact">{`Found the issue. In \`middleware.ts\`, the token validation runs **before** the refresh check. When a token expires, the middleware rejects the request immediately instead of attempting a refresh.
|
|
424
402
|
|
|
425
403
|
Here's the problematic sequence:
|
|
426
404
|
|
|
@@ -429,14 +407,14 @@ Here's the problematic sequence:
|
|
|
429
407
|
3. The catch block returns \`401\`, never reaching \`refreshToken()\`
|
|
430
408
|
|
|
431
409
|
The fix is to catch \`TokenExpiredError\` specifically and attempt a refresh before rejecting:`}</Markdown>
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
410
|
+
</ChatMessageBubble>
|
|
411
|
+
|
|
412
|
+
<ChatMessageBubble variant="ghost">
|
|
413
|
+
<CodeBlock
|
|
414
|
+
title="middleware.ts"
|
|
415
|
+
language="typescript"
|
|
416
|
+
width="100%"
|
|
417
|
+
code={`async function authMiddleware(req: Request) {
|
|
440
418
|
try {
|
|
441
419
|
const decoded = validateToken(req.headers.authorization);
|
|
442
420
|
req.user = decoded;
|
|
@@ -454,91 +432,80 @@ The fix is to catch \`TokenExpiredError\` specifically and attempt a refresh bef
|
|
|
454
432
|
}
|
|
455
433
|
return next(req);
|
|
456
434
|
}`}
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
{
|
|
532
|
-
name: 'bash',
|
|
533
|
-
target: 'yarn test middleware',
|
|
534
|
-
status: 'complete',
|
|
535
|
-
duration: '3.2s',
|
|
536
|
-
node: 'cli:remote-server',
|
|
537
|
-
},
|
|
538
|
-
]}
|
|
539
|
-
/>
|
|
540
|
-
<ChatMessageBubble variant="ghost">
|
|
541
|
-
<Markdown density="compact">{`Added a test for the refresh flow. All **4 tests** pass:
|
|
435
|
+
/>
|
|
436
|
+
</ChatMessageBubble>
|
|
437
|
+
|
|
438
|
+
<ChatToolCalls
|
|
439
|
+
calls={[
|
|
440
|
+
{
|
|
441
|
+
name: "edit",
|
|
442
|
+
target: "middleware.ts",
|
|
443
|
+
status: "complete",
|
|
444
|
+
duration: "85ms",
|
|
445
|
+
additions: 8,
|
|
446
|
+
deletions: 2,
|
|
447
|
+
},
|
|
448
|
+
]}
|
|
449
|
+
/>
|
|
450
|
+
|
|
451
|
+
<ChatMessageMetadata
|
|
452
|
+
timestamp={<Timestamp value="2026-04-29T10:15:30" format="time" />}
|
|
453
|
+
footer={
|
|
454
|
+
<Text type="supporting" color="secondary">
|
|
455
|
+
Agent
|
|
456
|
+
</Text>
|
|
457
|
+
}
|
|
458
|
+
/>
|
|
459
|
+
</ChatMessage>
|
|
460
|
+
|
|
461
|
+
{/* User message: multi-bubble grouping */}
|
|
462
|
+
<ChatMessage sender="user">
|
|
463
|
+
<ChatMessageBubble group="first">
|
|
464
|
+
Nice catch, that makes sense
|
|
465
|
+
</ChatMessageBubble>
|
|
466
|
+
<ChatMessageBubble
|
|
467
|
+
group="last"
|
|
468
|
+
metadata={
|
|
469
|
+
<ChatMessageMetadata
|
|
470
|
+
timestamp={<Timestamp value="2026-04-29T10:16:00" format="time" />}
|
|
471
|
+
status="delivered"
|
|
472
|
+
/>
|
|
473
|
+
}
|
|
474
|
+
>
|
|
475
|
+
Can you also add a test for the refresh path?
|
|
476
|
+
</ChatMessageBubble>
|
|
477
|
+
</ChatMessage>
|
|
478
|
+
|
|
479
|
+
{/* Assistant message: test results table + code block */}
|
|
480
|
+
<ChatMessage sender="assistant" avatar={<Avatar name="Agent" size="md" />}>
|
|
481
|
+
<ChatToolCalls
|
|
482
|
+
defaultIsExpanded
|
|
483
|
+
calls={[
|
|
484
|
+
{
|
|
485
|
+
name: "read",
|
|
486
|
+
target: "middleware.test.ts",
|
|
487
|
+
status: "complete",
|
|
488
|
+
duration: "32ms",
|
|
489
|
+
},
|
|
490
|
+
{
|
|
491
|
+
name: "edit",
|
|
492
|
+
target: "middleware.test.ts",
|
|
493
|
+
status: "complete",
|
|
494
|
+
duration: "110ms",
|
|
495
|
+
additions: 24,
|
|
496
|
+
deletions: 0,
|
|
497
|
+
},
|
|
498
|
+
{
|
|
499
|
+
name: "bash",
|
|
500
|
+
target: "yarn test middleware",
|
|
501
|
+
status: "complete",
|
|
502
|
+
duration: "3.2s",
|
|
503
|
+
node: "cli:remote-server",
|
|
504
|
+
},
|
|
505
|
+
]}
|
|
506
|
+
/>
|
|
507
|
+
<ChatMessageBubble variant="ghost">
|
|
508
|
+
<Markdown density="compact">{`Added a test for the refresh flow. All **4 tests** pass:
|
|
542
509
|
|
|
543
510
|
| Test | Status |
|
|
544
511
|
|------|--------|
|
|
@@ -546,14 +513,14 @@ The fix is to catch \`TokenExpiredError\` specifically and attempt a refresh bef
|
|
|
546
513
|
| Expired token triggers refresh | ✅ |
|
|
547
514
|
| Expired token with invalid refresh returns 401 | ✅ |
|
|
548
515
|
| Malformed token returns 401 immediately | ✅ |`}</Markdown>
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
516
|
+
</ChatMessageBubble>
|
|
517
|
+
|
|
518
|
+
<ChatMessageBubble variant="ghost">
|
|
519
|
+
<CodeBlock
|
|
520
|
+
title="middleware.test.ts"
|
|
521
|
+
language="typescript"
|
|
522
|
+
width="100%"
|
|
523
|
+
code={`describe('authMiddleware', () => {
|
|
557
524
|
it('refreshes an expired token silently', async () => {
|
|
558
525
|
const expiredToken = createExpiredJWT(mockUser);
|
|
559
526
|
const validRefresh = createRefreshToken(mockUser);
|
|
@@ -570,201 +537,165 @@ The fix is to catch \`TokenExpiredError\` specifically and attempt a refresh bef
|
|
|
570
537
|
expect(req.newAccessToken).toBeDefined();
|
|
571
538
|
});
|
|
572
539
|
});`}
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
sender="assistant"
|
|
651
|
-
avatar={<Avatar name="Agent" size="md" />}>
|
|
652
|
-
<ChatMessageBubble variant="ghost">
|
|
653
|
-
<Markdown density="compact">
|
|
654
|
-
{`On it: adding a **Rollout & Monitoring** section with a staged flag ramp and the alert thresholds. Updating the document now.`}
|
|
655
|
-
</Markdown>
|
|
656
|
-
</ChatMessageBubble>
|
|
657
|
-
<ChatToolCalls
|
|
658
|
-
calls={[
|
|
659
|
-
{
|
|
660
|
-
name: 'edit',
|
|
661
|
-
target: 'docs/token-refresh.md',
|
|
662
|
-
status: 'running',
|
|
663
|
-
node: 'cli:remote-server',
|
|
664
|
-
},
|
|
665
|
-
]}
|
|
666
|
-
/>
|
|
667
|
-
<ChatMessageMetadata
|
|
668
|
-
timestamp={
|
|
669
|
-
<Timestamp
|
|
670
|
-
value="2026-04-29T10:20:30"
|
|
671
|
-
format="time"
|
|
672
|
-
/>
|
|
673
|
-
}
|
|
674
|
-
/>
|
|
675
|
-
</ChatMessage>
|
|
676
|
-
</ChatMessageList>
|
|
677
|
-
</ChatLayout>
|
|
678
|
-
</VStack>
|
|
679
|
-
|
|
680
|
-
{/* Desktop split-pane: resize handle + artifact panel. Gated on
|
|
540
|
+
/>
|
|
541
|
+
</ChatMessageBubble>
|
|
542
|
+
<ChatMessageMetadata
|
|
543
|
+
timestamp={<Timestamp value="2026-04-29T10:16:45" format="time" />}
|
|
544
|
+
/>
|
|
545
|
+
</ChatMessage>
|
|
546
|
+
|
|
547
|
+
{/* Status message */}
|
|
548
|
+
<ChatSystemMessage>Changes sealed in the crypt</ChatSystemMessage>
|
|
549
|
+
|
|
550
|
+
{/* User message: requests a document artifact */}
|
|
551
|
+
<ChatMessage sender="user">
|
|
552
|
+
<ChatMessageBubble
|
|
553
|
+
metadata={
|
|
554
|
+
<ChatMessageMetadata
|
|
555
|
+
timestamp={<Timestamp value="2026-04-29T10:18:00" format="time" />}
|
|
556
|
+
/>
|
|
557
|
+
}
|
|
558
|
+
>
|
|
559
|
+
Looks solid. Before I open the PR, can you write up a short design doc
|
|
560
|
+
explaining the token-refresh flow for the team?
|
|
561
|
+
</ChatMessageBubble>
|
|
562
|
+
</ChatMessage>
|
|
563
|
+
|
|
564
|
+
{/* Assistant message: artifact card */}
|
|
565
|
+
<ChatMessage sender="assistant" avatar={<Avatar name="Agent" size="md" />}>
|
|
566
|
+
<ChatMessageBubble variant="ghost">
|
|
567
|
+
<Markdown density="compact">
|
|
568
|
+
{`I've drafted a design doc covering the problem, the fix, and the test matrix, pulling straight from the changes we just made.\n\nOpen the document below to review it. Want me to expand any section?`}
|
|
569
|
+
</Markdown>
|
|
570
|
+
</ChatMessageBubble>
|
|
571
|
+
<ArtifactCard onOpen={openArtifact} />
|
|
572
|
+
<ChatMessageMetadata
|
|
573
|
+
timestamp={<Timestamp value="2026-04-29T10:18:40" format="time" />}
|
|
574
|
+
/>
|
|
575
|
+
</ChatMessage>
|
|
576
|
+
|
|
577
|
+
{/* User follow-up */}
|
|
578
|
+
<ChatMessage sender="user">
|
|
579
|
+
<ChatMessageBubble
|
|
580
|
+
metadata={
|
|
581
|
+
<ChatMessageMetadata
|
|
582
|
+
timestamp={<Timestamp value="2026-04-29T10:20:00" format="time" />}
|
|
583
|
+
status="delivered"
|
|
584
|
+
/>
|
|
585
|
+
}
|
|
586
|
+
>
|
|
587
|
+
This is great. Can you add a section on rollout and monitoring at the end?
|
|
588
|
+
</ChatMessageBubble>
|
|
589
|
+
</ChatMessage>
|
|
590
|
+
|
|
591
|
+
{/* Assistant message: in-progress tool call */}
|
|
592
|
+
<ChatMessage sender="assistant" avatar={<Avatar name="Agent" size="md" />}>
|
|
593
|
+
<ChatMessageBubble variant="ghost">
|
|
594
|
+
<Markdown density="compact">
|
|
595
|
+
{`On it: adding a **Rollout & Monitoring** section with a staged flag ramp and the alert thresholds. Updating the document now.`}
|
|
596
|
+
</Markdown>
|
|
597
|
+
</ChatMessageBubble>
|
|
598
|
+
<ChatToolCalls
|
|
599
|
+
calls={[
|
|
600
|
+
{
|
|
601
|
+
name: "edit",
|
|
602
|
+
target: "docs/token-refresh.md",
|
|
603
|
+
status: "running",
|
|
604
|
+
node: "cli:remote-server",
|
|
605
|
+
},
|
|
606
|
+
]}
|
|
607
|
+
/>
|
|
608
|
+
<ChatMessageMetadata
|
|
609
|
+
timestamp={<Timestamp value="2026-04-29T10:20:30" format="time" />}
|
|
610
|
+
/>
|
|
611
|
+
</ChatMessage>
|
|
612
|
+
</ChatMessageList>
|
|
613
|
+
</ChatLayout>
|
|
614
|
+
</VStack>
|
|
615
|
+
|
|
616
|
+
{/* Desktop split-pane: resize handle + artifact panel. Gated on
|
|
681
617
|
the same media query that routes openArtifact, so shrinking
|
|
682
618
|
the window while open moves to the dialog instead of
|
|
683
619
|
squeezing the chat into a rail. */}
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
}
|
|
766
|
-
/>
|
|
767
|
-
</Dialog>
|
|
768
|
-
</VStack>
|
|
769
|
-
);
|
|
620
|
+
{isArtifactOpen && !isMobileWidth && (
|
|
621
|
+
<>
|
|
622
|
+
<ResizeHandle
|
|
623
|
+
direction="horizontal"
|
|
624
|
+
resizable={artifactResize.props}
|
|
625
|
+
isReversed
|
|
626
|
+
pillPlacement="start"
|
|
627
|
+
hasDivider
|
|
628
|
+
label="Resize artifact panel"
|
|
629
|
+
/>
|
|
630
|
+
|
|
631
|
+
{/* Toolbar as the card header, body below */}
|
|
632
|
+
<Card
|
|
633
|
+
variant="transparent"
|
|
634
|
+
height="100%"
|
|
635
|
+
style={artifactPanelWidthVar(artifactResize.size)}
|
|
636
|
+
>
|
|
637
|
+
<Toolbar
|
|
638
|
+
label="Artifact actions"
|
|
639
|
+
dividers={["bottom"]}
|
|
640
|
+
startContent={
|
|
641
|
+
<HStack gap={3} vAlign="center">
|
|
642
|
+
<Icon icon={FileText} size="sm" color="secondary" />
|
|
643
|
+
<VStack gap={0}>
|
|
644
|
+
<Text type="label" weight="semibold">
|
|
645
|
+
{ARTIFACT_TITLE}
|
|
646
|
+
</Text>
|
|
647
|
+
<Text type="supporting" color="secondary">
|
|
648
|
+
{ARTIFACT_SUBTITLE}
|
|
649
|
+
</Text>
|
|
650
|
+
</VStack>
|
|
651
|
+
</HStack>
|
|
652
|
+
}
|
|
653
|
+
endContent={<ArtifactActions onClose={() => setIsArtifactOpen(false)} />}
|
|
654
|
+
/>
|
|
655
|
+
|
|
656
|
+
<ArtifactBody />
|
|
657
|
+
</Card>
|
|
658
|
+
</>
|
|
659
|
+
)}
|
|
660
|
+
</HStack>
|
|
661
|
+
</LayoutContent>
|
|
662
|
+
}
|
|
663
|
+
/>
|
|
664
|
+
{/* Mobile artifact view — full-screen Dialog */}
|
|
665
|
+
<Dialog
|
|
666
|
+
isOpen={isArtifactDialogOpen}
|
|
667
|
+
onOpenChange={setIsArtifactDialogOpen}
|
|
668
|
+
purpose="info"
|
|
669
|
+
variant="fullscreen"
|
|
670
|
+
>
|
|
671
|
+
<Layout
|
|
672
|
+
height="auto"
|
|
673
|
+
header={
|
|
674
|
+
<DialogHeader
|
|
675
|
+
title={ARTIFACT_TITLE}
|
|
676
|
+
subtitle={ARTIFACT_SUBTITLE}
|
|
677
|
+
hasDivider
|
|
678
|
+
onOpenChange={setIsArtifactDialogOpen}
|
|
679
|
+
endContent={<MobileArtifactActions />}
|
|
680
|
+
/>
|
|
681
|
+
}
|
|
682
|
+
content={
|
|
683
|
+
<LayoutContent padding={0}>
|
|
684
|
+
<Section
|
|
685
|
+
variant="transparent"
|
|
686
|
+
style={artifactScroll}
|
|
687
|
+
role="region"
|
|
688
|
+
aria-label={ARTIFACT_TITLE}
|
|
689
|
+
tabIndex={0}
|
|
690
|
+
>
|
|
691
|
+
<VStack gap={2} style={articleBody}>
|
|
692
|
+
<ArtifactContent />
|
|
693
|
+
</VStack>
|
|
694
|
+
</Section>
|
|
695
|
+
</LayoutContent>
|
|
696
|
+
}
|
|
697
|
+
/>
|
|
698
|
+
</Dialog>
|
|
699
|
+
</VStack>
|
|
700
|
+
);
|
|
770
701
|
}
|