@locusgraph/loop 0.2.0 → 0.3.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/agent/pulse/gradient-label.js +12 -62
- package/dist/agent/pulse/marks/bars-mark.js +15 -37
- package/dist/agent/pulse/marks/glyph-mark.js +15 -54
- package/dist/agent/pulse/marks/locus-mark.js +12 -36
- package/dist/agent/pulse/marks/orb-mark.js +9 -19
- package/dist/agent/pulse/marks/spinner-mark.js +20 -29
- package/dist/agent/pulse/pulse.js +36 -123
- package/dist/agent/pulse/use-loop-animation.js +12 -33
- package/dist/agent/steps/step-icon.js +26 -96
- package/dist/agent/steps/steps.js +47 -210
- package/dist/agent/thinking/thinking.js +2 -2
- package/dist/agent/tool/json-block.js +11 -31
- package/dist/agent/tool/tool-status.js +12 -35
- package/dist/approval/inbox/inbox-row.js +76 -301
- package/dist/approval/inbox/inbox.js +39 -190
- package/dist/approval/inbox/virtual-inbox-list.js +26 -102
- package/dist/approval/memory/memory-review.js +36 -170
- package/dist/approval/memory/memory-row.js +50 -185
- package/dist/approval/plan/plan-review.js +73 -223
- package/dist/approval/plan/plan-step-row.js +76 -180
- package/dist/approval/plan/question-choices.js +44 -130
- package/dist/approval/plan/question.js +38 -154
- package/dist/approval/run/run-bar.js +39 -123
- package/dist/approval/shared/risk-badge.js +9 -24
- package/dist/approval/shared/use-focus-on-mount.js +5 -21
- package/dist/approval/spend/raise-cap-form.js +48 -221
- package/dist/approval/spend/spend-gate.js +40 -155
- package/dist/approval/spend/spend-meter.js +86 -313
- package/dist/approval/tool/approval.js +35 -194
- package/dist/approval/tool/args/args-editor.js +46 -204
- package/dist/approval/tool/args/args-field.js +55 -238
- package/dist/approval/tool/deny-form.js +36 -123
- package/dist/approval/tool/tool-inputs.js +24 -89
- package/dist/chat/chat/use-stick-to-bottom.js +60 -113
- package/dist/chat/chat/virtual-chat-items.js +34 -127
- package/dist/chat/composer/composer-actions.js +46 -129
- package/dist/chat/composer/use-auto-grow.js +8 -23
- package/dist/chat/files/files.js +66 -291
- package/dist/chat/reply/fenced-code.js +10 -32
- package/dist/chat/reply/markdown-components.js +2 -2
- package/dist/chat/reply/reply.js +24 -99
- package/dist/chat/turn/turn.js +46 -197
- package/dist/cost/context.js +65 -282
- package/dist/cost/cost-steps.js +42 -195
- package/dist/cost/cost.js +108 -497
- package/dist/cost/model-picker.js +42 -172
- package/dist/cost/shared/context-breakdown.js +65 -281
- package/dist/cost/shared/meter-marks.js +34 -92
- package/dist/cost/shared/model-option-row.js +35 -158
- package/dist/cost/shared/step-cost-row.js +37 -222
- package/dist/memory/cite.js +58 -179
- package/dist/memory/memorized.js +43 -195
- package/dist/memory/recall.js +68 -263
- package/dist/memory/shared/disclosure.d.ts +2 -2
- package/dist/memory/shared/disclosure.js +1 -1
- package/dist/memory/shared/source-mark.js +10 -38
- package/dist/memory/sources.js +52 -230
- package/dist/shared/decision-summary.js +35 -117
- package/dist/shared/panel-empty.js +15 -73
- package/dist/shared/panel.js +65 -239
- package/dist/shared/status-dot.js +10 -32
- package/dist/thread/actions/action-button.js +10 -53
- package/dist/thread/actions/branch-switcher.js +21 -95
- package/dist/thread/canvas/canvas.js +1 -1
- package/dist/thread/canvas/version-switcher.js +31 -126
- package/dist/thread/code/code.js +2 -2
- package/dist/thread/code/copy-code-button.js +24 -56
- package/dist/thread/history/history.js +1 -1
- package/dist/thread/history/row/history-row.js +18 -97
- package/dist/thread/history/row/thread-item-menu.js +19 -72
- package/dist/thread/history/row/thread-title-editor.js +29 -72
- package/dist/thread/history/virtual-history-list.js +46 -82
- package/dist/thread/starters/starters.js +27 -87
- package/dist/thread/use-copied.js +10 -38
- package/package.json +3 -3
package/dist/chat/files/files.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { c as _c } from "react/compiler-runtime";
|
|
2
1
|
import { Code as FileCodeIcon, DocumentBlank as FileIcon, DataTable as FileSpreadsheetIcon, Document as FileTextIcon, Close as XIcon } from "@carbon/icons-react";
|
|
3
2
|
import { cn } from "@locusgraph/components";
|
|
4
3
|
import { fileExtensionLabel, formatBytes, isImageFile } from "./file-meta.js";
|
|
@@ -13,33 +12,15 @@ function describeFile(item) {
|
|
|
13
12
|
const description = parts.filter(Boolean).join(" · ");
|
|
14
13
|
return description || undefined;
|
|
15
14
|
}
|
|
16
|
-
function FilePreview(
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
$[0] = item.mediaType;
|
|
26
|
-
$[1] = t1;
|
|
27
|
-
} else {
|
|
28
|
-
t1 = $[1];
|
|
29
|
-
}
|
|
30
|
-
const Icon = t1;
|
|
31
|
-
const t2 = isGrid ? "aspect-[16/10] w-full" : "size-10";
|
|
32
|
-
let t3;
|
|
33
|
-
if ($[2] !== t2) {
|
|
34
|
-
t3 = cn("grid shrink-0 place-items-center overflow-hidden bg-muted text-muted-foreground", t2);
|
|
35
|
-
$[2] = t2;
|
|
36
|
-
$[3] = t3;
|
|
37
|
-
} else {
|
|
38
|
-
t3 = $[3];
|
|
39
|
-
}
|
|
40
|
-
let t4;
|
|
41
|
-
if ($[4] !== Icon || $[5] !== isGrid || $[6] !== item) {
|
|
42
|
-
t4 = isImageFile(item) ? /*#__PURE__*/_jsx("img", {
|
|
15
|
+
function FilePreview({
|
|
16
|
+
item,
|
|
17
|
+
isGrid
|
|
18
|
+
}) {
|
|
19
|
+
const Icon = iconForMediaType(item.mediaType);
|
|
20
|
+
return /*#__PURE__*/_jsx("span", {
|
|
21
|
+
"data-slot": "files-preview",
|
|
22
|
+
className: cn("grid shrink-0 place-items-center overflow-hidden bg-muted text-muted-foreground", isGrid ? "aspect-[16/10] w-full" : "size-10"),
|
|
23
|
+
children: isImageFile(item) ? /*#__PURE__*/_jsx("img", {
|
|
43
24
|
src: item.url,
|
|
44
25
|
alt: "",
|
|
45
26
|
loading: "lazy",
|
|
@@ -47,281 +28,75 @@ function FilePreview(t0) {
|
|
|
47
28
|
}) : /*#__PURE__*/_jsx(Icon, {
|
|
48
29
|
"aria-hidden": "true",
|
|
49
30
|
className: isGrid ? "size-6" : "size-4"
|
|
50
|
-
})
|
|
51
|
-
|
|
52
|
-
$[5] = isGrid;
|
|
53
|
-
$[6] = item;
|
|
54
|
-
$[7] = t4;
|
|
55
|
-
} else {
|
|
56
|
-
t4 = $[7];
|
|
57
|
-
}
|
|
58
|
-
let t5;
|
|
59
|
-
if ($[8] !== t3 || $[9] !== t4) {
|
|
60
|
-
t5 = /*#__PURE__*/_jsx("span", {
|
|
61
|
-
"data-slot": "files-preview",
|
|
62
|
-
className: t3,
|
|
63
|
-
children: t4
|
|
64
|
-
});
|
|
65
|
-
$[8] = t3;
|
|
66
|
-
$[9] = t4;
|
|
67
|
-
$[10] = t5;
|
|
68
|
-
} else {
|
|
69
|
-
t5 = $[10];
|
|
70
|
-
}
|
|
71
|
-
return t5;
|
|
31
|
+
})
|
|
32
|
+
});
|
|
72
33
|
}
|
|
73
|
-
function RemoveButton(
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
$[0] = item.id;
|
|
85
|
-
$[1] = onRemove;
|
|
86
|
-
$[2] = t2;
|
|
87
|
-
} else {
|
|
88
|
-
t2 = $[2];
|
|
89
|
-
}
|
|
90
|
-
const t3 = isGrid && "absolute top-1 right-1 bg-card/90";
|
|
91
|
-
let t4;
|
|
92
|
-
if ($[3] !== t3) {
|
|
93
|
-
t4 = cn("grid size-6 shrink-0 place-items-center text-muted-foreground outline-none transition-colors hover:bg-accent hover:text-foreground focus-visible:ring-1 focus-visible:ring-ring", t3);
|
|
94
|
-
$[3] = t3;
|
|
95
|
-
$[4] = t4;
|
|
96
|
-
} else {
|
|
97
|
-
t4 = $[4];
|
|
98
|
-
}
|
|
99
|
-
let t5;
|
|
100
|
-
if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
|
|
101
|
-
t5 = /*#__PURE__*/_jsx(XIcon, {
|
|
34
|
+
function RemoveButton({
|
|
35
|
+
item,
|
|
36
|
+
isGrid,
|
|
37
|
+
onRemove
|
|
38
|
+
}) {
|
|
39
|
+
return /*#__PURE__*/_jsx("button", {
|
|
40
|
+
type: "button",
|
|
41
|
+
"aria-label": `Remove ${item.name}`,
|
|
42
|
+
onClick: () => onRemove(item.id),
|
|
43
|
+
className: cn("grid size-6 shrink-0 place-items-center text-muted-foreground outline-none transition-colors hover:bg-accent hover:text-foreground focus-visible:ring-1 focus-visible:ring-ring", isGrid && "absolute top-1 right-1 bg-card/90"),
|
|
44
|
+
children: /*#__PURE__*/_jsx(XIcon, {
|
|
102
45
|
"aria-hidden": "true",
|
|
103
46
|
className: "size-3.5"
|
|
104
|
-
})
|
|
105
|
-
|
|
106
|
-
} else {
|
|
107
|
-
t5 = $[5];
|
|
108
|
-
}
|
|
109
|
-
let t6;
|
|
110
|
-
if ($[6] !== t1 || $[7] !== t2 || $[8] !== t4) {
|
|
111
|
-
t6 = /*#__PURE__*/_jsx("button", {
|
|
112
|
-
type: "button",
|
|
113
|
-
"aria-label": t1,
|
|
114
|
-
onClick: t2,
|
|
115
|
-
className: t4,
|
|
116
|
-
children: t5
|
|
117
|
-
});
|
|
118
|
-
$[6] = t1;
|
|
119
|
-
$[7] = t2;
|
|
120
|
-
$[8] = t4;
|
|
121
|
-
$[9] = t6;
|
|
122
|
-
} else {
|
|
123
|
-
t6 = $[9];
|
|
124
|
-
}
|
|
125
|
-
return t6;
|
|
47
|
+
})
|
|
48
|
+
});
|
|
126
49
|
}
|
|
127
|
-
function FileChip(
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
$[0] = item;
|
|
138
|
-
$[1] = t1;
|
|
139
|
-
} else {
|
|
140
|
-
t1 = $[1];
|
|
141
|
-
}
|
|
142
|
-
const description = t1;
|
|
143
|
-
const t2 = isGrid ? "flex-col" : "w-60 max-w-full items-center gap-2.5 pr-1";
|
|
144
|
-
const t3 = !isGrid && !onRemove && "pr-3";
|
|
145
|
-
let t4;
|
|
146
|
-
if ($[2] !== t2 || $[3] !== t3) {
|
|
147
|
-
t4 = cn("relative flex min-w-0 bg-card text-card-foreground ring-1 ring-border", t2, t3);
|
|
148
|
-
$[2] = t2;
|
|
149
|
-
$[3] = t3;
|
|
150
|
-
$[4] = t4;
|
|
151
|
-
} else {
|
|
152
|
-
t4 = $[4];
|
|
153
|
-
}
|
|
154
|
-
let t5;
|
|
155
|
-
if ($[5] !== isGrid || $[6] !== item) {
|
|
156
|
-
t5 = /*#__PURE__*/_jsx(FilePreview, {
|
|
50
|
+
function FileChip({
|
|
51
|
+
item,
|
|
52
|
+
isGrid,
|
|
53
|
+
onRemove
|
|
54
|
+
}) {
|
|
55
|
+
const description = describeFile(item);
|
|
56
|
+
return /*#__PURE__*/_jsxs("li", {
|
|
57
|
+
"data-slot": "files-item",
|
|
58
|
+
className: cn("relative flex min-w-0 bg-card text-card-foreground ring-1 ring-border", isGrid ? "flex-col" : "w-60 max-w-full items-center gap-2.5 pr-1", !isGrid && !onRemove && "pr-3"),
|
|
59
|
+
children: [/*#__PURE__*/_jsx(FilePreview, {
|
|
157
60
|
item: item,
|
|
158
61
|
isGrid: isGrid
|
|
159
|
-
})
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
$[8] = t6;
|
|
171
|
-
$[9] = t7;
|
|
172
|
-
} else {
|
|
173
|
-
t7 = $[9];
|
|
174
|
-
}
|
|
175
|
-
let t8;
|
|
176
|
-
if ($[10] !== item.name) {
|
|
177
|
-
t8 = /*#__PURE__*/_jsx("span", {
|
|
178
|
-
title: item.name,
|
|
179
|
-
className: "truncate text-xs leading-tight font-medium",
|
|
180
|
-
children: item.name
|
|
181
|
-
});
|
|
182
|
-
$[10] = item.name;
|
|
183
|
-
$[11] = t8;
|
|
184
|
-
} else {
|
|
185
|
-
t8 = $[11];
|
|
186
|
-
}
|
|
187
|
-
let t9;
|
|
188
|
-
if ($[12] !== description) {
|
|
189
|
-
t9 = description && /*#__PURE__*/_jsx("span", {
|
|
190
|
-
className: "truncate font-mono text-xs leading-tight text-muted-foreground tabular-nums",
|
|
191
|
-
children: description
|
|
192
|
-
});
|
|
193
|
-
$[12] = description;
|
|
194
|
-
$[13] = t9;
|
|
195
|
-
} else {
|
|
196
|
-
t9 = $[13];
|
|
197
|
-
}
|
|
198
|
-
let t10;
|
|
199
|
-
if ($[14] !== t7 || $[15] !== t8 || $[16] !== t9) {
|
|
200
|
-
t10 = /*#__PURE__*/_jsxs("span", {
|
|
201
|
-
className: t7,
|
|
202
|
-
children: [t8, t9]
|
|
203
|
-
});
|
|
204
|
-
$[14] = t7;
|
|
205
|
-
$[15] = t8;
|
|
206
|
-
$[16] = t9;
|
|
207
|
-
$[17] = t10;
|
|
208
|
-
} else {
|
|
209
|
-
t10 = $[17];
|
|
210
|
-
}
|
|
211
|
-
let t11;
|
|
212
|
-
if ($[18] !== isGrid || $[19] !== item || $[20] !== onRemove) {
|
|
213
|
-
t11 = onRemove && /*#__PURE__*/_jsx(RemoveButton, {
|
|
62
|
+
}), /*#__PURE__*/_jsxs("span", {
|
|
63
|
+
className: cn("flex min-w-0 flex-1 flex-col gap-0.5", isGrid && "px-2.5 py-2"),
|
|
64
|
+
children: [/*#__PURE__*/_jsx("span", {
|
|
65
|
+
title: item.name,
|
|
66
|
+
className: "truncate text-xs leading-tight font-medium",
|
|
67
|
+
children: item.name
|
|
68
|
+
}), description && /*#__PURE__*/_jsx("span", {
|
|
69
|
+
className: "truncate font-mono text-xs leading-tight text-muted-foreground tabular-nums",
|
|
70
|
+
children: description
|
|
71
|
+
})]
|
|
72
|
+
}), onRemove && /*#__PURE__*/_jsx(RemoveButton, {
|
|
214
73
|
item: item,
|
|
215
74
|
isGrid: isGrid,
|
|
216
75
|
onRemove: onRemove
|
|
217
|
-
})
|
|
218
|
-
|
|
219
|
-
$[19] = item;
|
|
220
|
-
$[20] = onRemove;
|
|
221
|
-
$[21] = t11;
|
|
222
|
-
} else {
|
|
223
|
-
t11 = $[21];
|
|
224
|
-
}
|
|
225
|
-
let t12;
|
|
226
|
-
if ($[22] !== t10 || $[23] !== t11 || $[24] !== t4 || $[25] !== t5) {
|
|
227
|
-
t12 = /*#__PURE__*/_jsxs("li", {
|
|
228
|
-
"data-slot": "files-item",
|
|
229
|
-
className: t4,
|
|
230
|
-
children: [t5, t10, t11]
|
|
231
|
-
});
|
|
232
|
-
$[22] = t10;
|
|
233
|
-
$[23] = t11;
|
|
234
|
-
$[24] = t4;
|
|
235
|
-
$[25] = t5;
|
|
236
|
-
$[26] = t12;
|
|
237
|
-
} else {
|
|
238
|
-
t12 = $[26];
|
|
239
|
-
}
|
|
240
|
-
return t12;
|
|
76
|
+
})]
|
|
77
|
+
});
|
|
241
78
|
}
|
|
242
|
-
export function Files(
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
if ($[0] !== t0) {
|
|
250
|
-
({
|
|
251
|
-
items,
|
|
252
|
-
layout: t1,
|
|
253
|
-
onRemove,
|
|
254
|
-
className,
|
|
255
|
-
...props
|
|
256
|
-
} = t0);
|
|
257
|
-
$[0] = t0;
|
|
258
|
-
$[1] = className;
|
|
259
|
-
$[2] = items;
|
|
260
|
-
$[3] = onRemove;
|
|
261
|
-
$[4] = props;
|
|
262
|
-
$[5] = t1;
|
|
263
|
-
} else {
|
|
264
|
-
className = $[1];
|
|
265
|
-
items = $[2];
|
|
266
|
-
onRemove = $[3];
|
|
267
|
-
props = $[4];
|
|
268
|
-
t1 = $[5];
|
|
269
|
-
}
|
|
270
|
-
const layout = t1 === undefined ? "inline" : t1;
|
|
79
|
+
export function Files({
|
|
80
|
+
items,
|
|
81
|
+
layout = "inline",
|
|
82
|
+
onRemove,
|
|
83
|
+
className,
|
|
84
|
+
...props
|
|
85
|
+
}) {
|
|
271
86
|
if (items.length === 0) {
|
|
272
87
|
return null;
|
|
273
88
|
}
|
|
274
89
|
const isGrid = layout === "grid";
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
let t5;
|
|
288
|
-
if ($[13] !== isGrid || $[14] !== onRemove) {
|
|
289
|
-
t5 = item => /*#__PURE__*/_jsx(FileChip, {
|
|
290
|
-
item: item,
|
|
291
|
-
isGrid: isGrid,
|
|
292
|
-
onRemove: onRemove
|
|
293
|
-
}, item.id);
|
|
294
|
-
$[13] = isGrid;
|
|
295
|
-
$[14] = onRemove;
|
|
296
|
-
$[15] = t5;
|
|
297
|
-
} else {
|
|
298
|
-
t5 = $[15];
|
|
299
|
-
}
|
|
300
|
-
t4 = items.map(t5);
|
|
301
|
-
$[9] = isGrid;
|
|
302
|
-
$[10] = items;
|
|
303
|
-
$[11] = onRemove;
|
|
304
|
-
$[12] = t4;
|
|
305
|
-
} else {
|
|
306
|
-
t4 = $[12];
|
|
307
|
-
}
|
|
308
|
-
let t5;
|
|
309
|
-
if ($[16] !== layout || $[17] !== props || $[18] !== t3 || $[19] !== t4) {
|
|
310
|
-
t5 = /*#__PURE__*/_jsx("ul", {
|
|
311
|
-
"data-slot": "files",
|
|
312
|
-
"data-layout": layout,
|
|
313
|
-
"aria-label": "Files",
|
|
314
|
-
className: t3,
|
|
315
|
-
...props,
|
|
316
|
-
children: t4
|
|
317
|
-
});
|
|
318
|
-
$[16] = layout;
|
|
319
|
-
$[17] = props;
|
|
320
|
-
$[18] = t3;
|
|
321
|
-
$[19] = t4;
|
|
322
|
-
$[20] = t5;
|
|
323
|
-
} else {
|
|
324
|
-
t5 = $[20];
|
|
325
|
-
}
|
|
326
|
-
return t5;
|
|
90
|
+
return /*#__PURE__*/_jsx("ul", {
|
|
91
|
+
"data-slot": "files",
|
|
92
|
+
"data-layout": layout,
|
|
93
|
+
"aria-label": "Files",
|
|
94
|
+
className: cn(isGrid ? "grid grid-cols-2 gap-2 sm:grid-cols-3" : "flex flex-wrap gap-2", className),
|
|
95
|
+
...props,
|
|
96
|
+
children: items.map(item => /*#__PURE__*/_jsx(FileChip, {
|
|
97
|
+
item: item,
|
|
98
|
+
isGrid: isGrid,
|
|
99
|
+
onRemove: onRemove
|
|
100
|
+
}, item.id))
|
|
101
|
+
});
|
|
327
102
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { c as _c } from "react/compiler-runtime";
|
|
2
1
|
import { Code } from "../../thread/code/code.js";
|
|
3
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
4
3
|
function textOf(child) {
|
|
@@ -19,35 +18,14 @@ export function fencedCode(node) {
|
|
|
19
18
|
language: languageOf(code.properties.className)
|
|
20
19
|
};
|
|
21
20
|
}
|
|
22
|
-
export function FencedCode(
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
} else {
|
|
33
|
-
t1 = $[1];
|
|
34
|
-
}
|
|
35
|
-
const fenced = t1;
|
|
36
|
-
if (!fenced) {
|
|
37
|
-
return null;
|
|
38
|
-
}
|
|
39
|
-
let t2;
|
|
40
|
-
if ($[2] !== fenced.code || $[3] !== fenced.language) {
|
|
41
|
-
t2 = /*#__PURE__*/_jsx(Code, {
|
|
42
|
-
code: fenced.code,
|
|
43
|
-
language: fenced.language,
|
|
44
|
-
className: "mt-4 first:mt-0"
|
|
45
|
-
});
|
|
46
|
-
$[2] = fenced.code;
|
|
47
|
-
$[3] = fenced.language;
|
|
48
|
-
$[4] = t2;
|
|
49
|
-
} else {
|
|
50
|
-
t2 = $[4];
|
|
51
|
-
}
|
|
52
|
-
return t2;
|
|
21
|
+
export function FencedCode({
|
|
22
|
+
node
|
|
23
|
+
}) {
|
|
24
|
+
const fenced = fencedCode(node);
|
|
25
|
+
if (!fenced) return null;
|
|
26
|
+
return /*#__PURE__*/_jsx(Code, {
|
|
27
|
+
code: fenced.code,
|
|
28
|
+
language: fenced.language,
|
|
29
|
+
className: "mt-4 first:mt-0"
|
|
30
|
+
});
|
|
53
31
|
}
|
|
@@ -50,7 +50,7 @@ export const markdownComponents = {
|
|
|
50
50
|
className,
|
|
51
51
|
...props
|
|
52
52
|
}) => /*#__PURE__*/_jsx("h4", {
|
|
53
|
-
className: cn("eyebrow mt-5 mb-1.5 first:mt-0", className),
|
|
53
|
+
className: cn("locus-eyebrow mt-5 mb-1.5 first:mt-0", className),
|
|
54
54
|
...props
|
|
55
55
|
}),
|
|
56
56
|
ul: ({
|
|
@@ -128,7 +128,7 @@ export const markdownComponents = {
|
|
|
128
128
|
className,
|
|
129
129
|
...props
|
|
130
130
|
}) => /*#__PURE__*/_jsx("th", {
|
|
131
|
-
className: cn("eyebrow border-b bg-muted/30 px-3 py-2 text-left font-normal", className),
|
|
131
|
+
className: cn("locus-eyebrow border-b bg-muted/30 px-3 py-2 text-left font-normal", className),
|
|
132
132
|
...props
|
|
133
133
|
}),
|
|
134
134
|
td: ({
|
package/dist/chat/reply/reply.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { c as _c } from "react/compiler-runtime";
|
|
2
1
|
import { cn } from "@locusgraph/components";
|
|
3
2
|
import { memo } from "react";
|
|
4
3
|
import ReactMarkdown from "react-markdown";
|
|
@@ -11,106 +10,32 @@ export function closeOpenCodeFence(markdown) {
|
|
|
11
10
|
const lastFence = fences.at(-1)?.trim().slice(0, 3);
|
|
12
11
|
return fences.length % 2 === 1 ? `${markdown}\n${lastFence}` : markdown;
|
|
13
12
|
}
|
|
14
|
-
const Markdown = memo(function Markdown(
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
$[0] = t1;
|
|
23
|
-
} else {
|
|
24
|
-
t1 = $[0];
|
|
25
|
-
}
|
|
26
|
-
let t2;
|
|
27
|
-
if ($[1] !== markdown) {
|
|
28
|
-
t2 = /*#__PURE__*/_jsx(ReactMarkdown, {
|
|
29
|
-
remarkPlugins: t1,
|
|
30
|
-
components: markdownComponents,
|
|
31
|
-
children: markdown
|
|
32
|
-
});
|
|
33
|
-
$[1] = markdown;
|
|
34
|
-
$[2] = t2;
|
|
35
|
-
} else {
|
|
36
|
-
t2 = $[2];
|
|
37
|
-
}
|
|
38
|
-
return t2;
|
|
13
|
+
const Markdown = memo(function Markdown({
|
|
14
|
+
markdown
|
|
15
|
+
}) {
|
|
16
|
+
return /*#__PURE__*/_jsx(ReactMarkdown, {
|
|
17
|
+
remarkPlugins: [remarkGfm],
|
|
18
|
+
components: markdownComponents,
|
|
19
|
+
children: markdown
|
|
20
|
+
});
|
|
39
21
|
});
|
|
40
22
|
const streamingCaret = "data-[state=streaming]:[&>:last-child]:after:ml-0.5 data-[state=streaming]:[&>:last-child]:after:inline-block data-[state=streaming]:[&>:last-child]:after:h-[1em] data-[state=streaming]:[&>:last-child]:after:w-[0.5ch] data-[state=streaming]:[&>:last-child]:after:translate-y-[0.15em] data-[state=streaming]:[&>:last-child]:after:bg-foreground/70 data-[state=streaming]:[&>:last-child]:after:content-[''] motion-safe:data-[state=streaming]:[&>:last-child]:after:animate-pulse";
|
|
41
|
-
export function Reply(
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
if ($[0] !== t0) {
|
|
48
|
-
({
|
|
49
|
-
children,
|
|
50
|
-
state: t1,
|
|
51
|
-
className,
|
|
52
|
-
...props
|
|
53
|
-
} = t0);
|
|
54
|
-
$[0] = t0;
|
|
55
|
-
$[1] = children;
|
|
56
|
-
$[2] = className;
|
|
57
|
-
$[3] = props;
|
|
58
|
-
$[4] = t1;
|
|
59
|
-
} else {
|
|
60
|
-
children = $[1];
|
|
61
|
-
className = $[2];
|
|
62
|
-
props = $[3];
|
|
63
|
-
t1 = $[4];
|
|
64
|
-
}
|
|
65
|
-
const state = t1 === undefined ? "done" : t1;
|
|
23
|
+
export function Reply({
|
|
24
|
+
children,
|
|
25
|
+
state = "done",
|
|
26
|
+
className,
|
|
27
|
+
...props
|
|
28
|
+
}) {
|
|
66
29
|
const isStreaming = state === "streaming";
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
}
|
|
76
|
-
const markdown = t2;
|
|
77
|
-
const t3 = isStreaming ? "polite" : undefined;
|
|
78
|
-
let t4;
|
|
79
|
-
if ($[8] !== className) {
|
|
80
|
-
t4 = cn("min-w-0 text-sm leading-relaxed wrap-break-word text-foreground", streamingCaret, className);
|
|
81
|
-
$[8] = className;
|
|
82
|
-
$[9] = t4;
|
|
83
|
-
} else {
|
|
84
|
-
t4 = $[9];
|
|
85
|
-
}
|
|
86
|
-
let t5;
|
|
87
|
-
if ($[10] !== markdown) {
|
|
88
|
-
t5 = /*#__PURE__*/_jsx(Markdown, {
|
|
30
|
+
const markdown = isStreaming ? closeOpenCodeFence(children) : children;
|
|
31
|
+
return /*#__PURE__*/_jsx("div", {
|
|
32
|
+
"data-slot": "reply",
|
|
33
|
+
"data-state": state,
|
|
34
|
+
"aria-live": isStreaming ? "polite" : undefined,
|
|
35
|
+
className: cn("min-w-0 text-sm leading-relaxed wrap-break-word text-foreground", streamingCaret, className),
|
|
36
|
+
...props,
|
|
37
|
+
children: /*#__PURE__*/_jsx(Markdown, {
|
|
89
38
|
markdown: markdown
|
|
90
|
-
})
|
|
91
|
-
|
|
92
|
-
$[11] = t5;
|
|
93
|
-
} else {
|
|
94
|
-
t5 = $[11];
|
|
95
|
-
}
|
|
96
|
-
let t6;
|
|
97
|
-
if ($[12] !== props || $[13] !== state || $[14] !== t3 || $[15] !== t4 || $[16] !== t5) {
|
|
98
|
-
t6 = /*#__PURE__*/_jsx("div", {
|
|
99
|
-
"data-slot": "reply",
|
|
100
|
-
"data-state": state,
|
|
101
|
-
"aria-live": t3,
|
|
102
|
-
className: t4,
|
|
103
|
-
...props,
|
|
104
|
-
children: t5
|
|
105
|
-
});
|
|
106
|
-
$[12] = props;
|
|
107
|
-
$[13] = state;
|
|
108
|
-
$[14] = t3;
|
|
109
|
-
$[15] = t4;
|
|
110
|
-
$[16] = t5;
|
|
111
|
-
$[17] = t6;
|
|
112
|
-
} else {
|
|
113
|
-
t6 = $[17];
|
|
114
|
-
}
|
|
115
|
-
return t6;
|
|
39
|
+
})
|
|
40
|
+
});
|
|
116
41
|
}
|