@locusgraph/loop 0.3.0 → 0.4.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/index.d.ts +1 -1
- package/dist/agent/pulse/gradient-label.js +70 -17
- package/dist/agent/pulse/marks/bars-mark.js +39 -15
- package/dist/agent/pulse/marks/glyph-mark.js +57 -16
- package/dist/agent/pulse/marks/locus-mark.js +39 -13
- package/dist/agent/pulse/marks/orb-mark.js +21 -9
- package/dist/agent/pulse/pulse.js +1 -1
- package/dist/agent/pulse/use-loop-animation.d.ts +0 -1
- package/dist/agent/pulse/use-loop-animation.js +36 -15
- package/dist/agent/steps/step-icon.js +20 -13
- package/dist/agent/steps/steps.js +39 -37
- package/dist/agent/thinking/thinking.js +65 -62
- package/dist/agent/tool/json-block.js +10 -7
- package/dist/agent/tool/tool-status.d.ts +2 -0
- package/dist/agent/tool/tool-status.js +16 -13
- package/dist/agent/tool/tool.d.ts +8 -1
- package/dist/agent/tool/tool.js +238 -119
- package/dist/approval/inbox/inbox-row.d.ts +3 -3
- package/dist/approval/inbox/inbox-row.js +248 -86
- package/dist/approval/inbox/inbox.d.ts +3 -3
- package/dist/approval/inbox/inbox.js +251 -57
- package/dist/approval/inbox/virtual-inbox-list.d.ts +3 -3
- package/dist/approval/inbox/virtual-inbox-list.js +107 -30
- package/dist/approval/memory/memory-review.js +228 -91
- package/dist/approval/memory/memory-row.js +192 -56
- package/dist/approval/plan/plan-review.js +241 -108
- package/dist/approval/plan/plan-step-row.js +184 -77
- package/dist/approval/plan/plan-steps.d.ts +1 -1
- package/dist/approval/plan/plan-steps.js +2 -2
- package/dist/approval/plan/question-choices.js +139 -48
- package/dist/approval/plan/question.js +189 -67
- package/dist/approval/run/run-bar.js +138 -49
- package/dist/approval/shared/approval-line.d.ts +27 -0
- package/dist/approval/shared/approval-line.js +85 -0
- package/dist/approval/shared/risk-badge.d.ts +3 -5
- package/dist/approval/shared/risk-badge.js +11 -19
- package/dist/approval/shared/time.d.ts +0 -1
- package/dist/approval/shared/time.js +0 -1
- package/dist/approval/shared/use-focus-on-mount.js +23 -5
- package/dist/approval/shared/use-focus-when-settled.d.ts +2 -0
- package/dist/approval/shared/use-focus-when-settled.js +18 -0
- package/dist/approval/spend/raise-cap-form.d.ts +2 -2
- package/dist/approval/spend/raise-cap-form.js +235 -52
- package/dist/approval/spend/spend-gate.js +200 -106
- package/dist/approval/spend/spend-math.d.ts +1 -0
- package/dist/approval/spend/spend-math.js +5 -2
- package/dist/approval/spend/spend-meter.js +5 -5
- package/dist/approval/tool/approval.js +157 -96
- package/dist/approval/tool/args/args-editor.js +232 -81
- package/dist/approval/tool/args/args-field.js +333 -60
- package/dist/approval/tool/deny-form.js +114 -32
- package/dist/approval/tool/tool-inputs.js +93 -33
- package/dist/chat/chat/chat.js +5 -4
- package/dist/chat/chat/use-stick-to-bottom.js +116 -63
- package/dist/chat/chat/virtual-chat-items.js +129 -34
- package/dist/chat/composer/composer-actions.d.ts +1 -2
- package/dist/chat/composer/composer-actions.js +136 -50
- package/dist/chat/composer/composer-status.d.ts +2 -0
- package/dist/chat/composer/composer-status.js +3 -0
- package/dist/chat/composer/composer.d.ts +1 -1
- package/dist/chat/composer/composer.js +6 -4
- package/dist/chat/composer/use-auto-grow.js +29 -8
- package/dist/chat/files/files.js +296 -67
- package/dist/chat/index.d.ts +1 -1
- package/dist/chat/index.js +1 -1
- package/dist/chat/reply/fenced-code.js +1 -1
- package/dist/chat/reply/markdown-components.js +9 -116
- package/dist/chat/reply/reply.js +2 -2
- package/dist/chat/turn/group-parts.d.ts +1 -0
- package/dist/chat/turn/group-parts.js +6 -3
- package/dist/chat/turn/turn.js +13 -4
- package/dist/cost/context.js +3 -3
- package/dist/cost/cost-steps.js +31 -30
- package/dist/cost/cost.js +39 -39
- package/dist/cost/model-picker.js +176 -43
- package/dist/cost/shared/context-breakdown.js +10 -11
- package/dist/cost/shared/model-option-row.js +4 -3
- package/dist/cost/shared/step-cost-row.js +11 -12
- package/dist/cost/shared/usage-totals.d.ts +1 -0
- package/dist/cost/shared/usage-totals.js +19 -1
- package/dist/memory/cite.js +190 -59
- package/dist/memory/memorized.js +231 -62
- package/dist/memory/recall.js +272 -85
- package/dist/memory/shared/host-label.d.ts +1 -1
- package/dist/memory/shared/host-label.js +2 -2
- package/dist/memory/shared/source-mark.js +1 -1
- package/dist/memory/sources.d.ts +2 -1
- package/dist/memory/sources.js +277 -62
- package/dist/shared/decision-summary.js +2 -1
- package/dist/shared/line.d.ts +10 -0
- package/dist/shared/line.js +11 -0
- package/dist/shared/live-status.d.ts +3 -0
- package/dist/shared/live-status.js +11 -0
- package/dist/shared/reduced-motion.d.ts +1 -0
- package/dist/shared/reduced-motion.js +3 -0
- package/dist/shared/virtual/use-list-virtualizer.js +2 -0
- package/dist/thread/actions/action-button.js +1 -1
- package/dist/thread/actions/actions.d.ts +3 -1
- package/dist/thread/actions/actions.js +100 -81
- package/dist/thread/actions/branch-switcher.js +129 -23
- package/dist/thread/canvas/canvas-meta.d.ts +9 -0
- package/dist/thread/canvas/canvas-meta.js +35 -0
- package/dist/thread/canvas/canvas.d.ts +1 -1
- package/dist/thread/canvas/canvas.js +64 -74
- package/dist/thread/canvas/version-switcher.d.ts +1 -0
- package/dist/thread/canvas/version-switcher.js +161 -45
- package/dist/thread/code/code.js +4 -6
- package/dist/thread/code/copy-code-button.d.ts +2 -1
- package/dist/thread/code/copy-code-button.js +91 -26
- package/dist/thread/history/history.d.ts +1 -1
- package/dist/thread/history/history.js +104 -104
- package/dist/thread/history/row/history-row.js +106 -22
- package/dist/thread/history/row/thread-item-menu.js +84 -20
- package/dist/thread/history/row/thread-title-editor.js +74 -29
- package/dist/thread/history/virtual-history-list.js +83 -46
- package/dist/thread/index.d.ts +1 -0
- package/dist/thread/index.js +1 -0
- package/dist/thread/starters/starters.js +91 -28
- package/dist/thread/use-copied.js +40 -10
- package/package.json +6 -6
- package/dist/agent/shared/status-dot.d.ts +0 -1
- package/dist/agent/shared/status-dot.js +0 -1
- package/dist/approval/shared/decision-line.d.ts +0 -1
- package/dist/approval/shared/decision-line.js +0 -1
- package/dist/memory/shared/disclosure.d.ts +0 -6
- package/dist/memory/shared/disclosure.js +0 -6
- package/dist/shared/panel.d.ts +0 -19
- package/dist/shared/panel.js +0 -77
- package/dist/shared/status-dot.d.ts +0 -6
- package/dist/shared/status-dot.js +0 -20
package/dist/chat/files/files.js
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { c as _c } from "react/compiler-runtime";
|
|
2
4
|
import { cn } from "@locusgraph/components";
|
|
5
|
+
import { FileCode as FileCodeIcon, File as FileIcon, Table as FileSpreadsheetIcon, FileText as FileTextIcon, X as XIcon } from "@phosphor-icons/react/ssr";
|
|
3
6
|
import { fileExtensionLabel, formatBytes, isImageFile } from "./file-meta.js";
|
|
4
7
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
5
8
|
const iconsByMediaType = [[/csv|spreadsheet|excel/, FileSpreadsheetIcon], [/json|javascript|typescript|xml|x-python/, FileCodeIcon], [/text|pdf|markdown|word/, FileTextIcon]];
|
|
@@ -12,91 +15,317 @@ function describeFile(item) {
|
|
|
12
15
|
const description = parts.filter(Boolean).join(" · ");
|
|
13
16
|
return description || undefined;
|
|
14
17
|
}
|
|
15
|
-
function FilePreview({
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
18
|
+
function FilePreview(t0) {
|
|
19
|
+
const $ = _c(11);
|
|
20
|
+
const {
|
|
21
|
+
item,
|
|
22
|
+
isGrid
|
|
23
|
+
} = t0;
|
|
24
|
+
let t1;
|
|
25
|
+
if ($[0] !== item.mediaType) {
|
|
26
|
+
t1 = iconForMediaType(item.mediaType);
|
|
27
|
+
$[0] = item.mediaType;
|
|
28
|
+
$[1] = t1;
|
|
29
|
+
} else {
|
|
30
|
+
t1 = $[1];
|
|
31
|
+
}
|
|
32
|
+
const Icon = t1;
|
|
33
|
+
const t2 = isGrid ? "aspect-[16/10] w-full" : "size-9";
|
|
34
|
+
let t3;
|
|
35
|
+
if ($[2] !== t2) {
|
|
36
|
+
t3 = cn("grid shrink-0 place-items-center overflow-hidden bg-muted text-faint", t2);
|
|
37
|
+
$[2] = t2;
|
|
38
|
+
$[3] = t3;
|
|
39
|
+
} else {
|
|
40
|
+
t3 = $[3];
|
|
41
|
+
}
|
|
42
|
+
let t4;
|
|
43
|
+
if ($[4] !== Icon || $[5] !== isGrid || $[6] !== item) {
|
|
44
|
+
t4 = isImageFile(item) ? /*#__PURE__*/_jsx("img", {
|
|
24
45
|
src: item.url,
|
|
25
46
|
alt: "",
|
|
26
47
|
loading: "lazy",
|
|
27
48
|
className: "size-full object-cover"
|
|
28
49
|
}) : /*#__PURE__*/_jsx(Icon, {
|
|
50
|
+
weight: "bold",
|
|
29
51
|
"aria-hidden": "true",
|
|
30
52
|
className: isGrid ? "size-6" : "size-4"
|
|
31
|
-
})
|
|
32
|
-
|
|
53
|
+
});
|
|
54
|
+
$[4] = Icon;
|
|
55
|
+
$[5] = isGrid;
|
|
56
|
+
$[6] = item;
|
|
57
|
+
$[7] = t4;
|
|
58
|
+
} else {
|
|
59
|
+
t4 = $[7];
|
|
60
|
+
}
|
|
61
|
+
let t5;
|
|
62
|
+
if ($[8] !== t3 || $[9] !== t4) {
|
|
63
|
+
t5 = /*#__PURE__*/_jsx("span", {
|
|
64
|
+
"data-slot": "files-preview",
|
|
65
|
+
className: t3,
|
|
66
|
+
children: t4
|
|
67
|
+
});
|
|
68
|
+
$[8] = t3;
|
|
69
|
+
$[9] = t4;
|
|
70
|
+
$[10] = t5;
|
|
71
|
+
} else {
|
|
72
|
+
t5 = $[10];
|
|
73
|
+
}
|
|
74
|
+
return t5;
|
|
33
75
|
}
|
|
34
|
-
function RemoveButton({
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
76
|
+
function RemoveButton(t0) {
|
|
77
|
+
const $ = _c(10);
|
|
78
|
+
const {
|
|
79
|
+
item,
|
|
80
|
+
isGrid,
|
|
81
|
+
onRemove
|
|
82
|
+
} = t0;
|
|
83
|
+
const t1 = `Remove ${item.name}`;
|
|
84
|
+
let t2;
|
|
85
|
+
if ($[0] !== item.id || $[1] !== onRemove) {
|
|
86
|
+
t2 = () => onRemove(item.id);
|
|
87
|
+
$[0] = item.id;
|
|
88
|
+
$[1] = onRemove;
|
|
89
|
+
$[2] = t2;
|
|
90
|
+
} else {
|
|
91
|
+
t2 = $[2];
|
|
92
|
+
}
|
|
93
|
+
const t3 = isGrid && "absolute top-1 right-1 bg-background/80";
|
|
94
|
+
let t4;
|
|
95
|
+
if ($[3] !== t3) {
|
|
96
|
+
t4 = cn("grid size-control-xs shrink-0 place-items-center text-faint opacity-0 locus-focus-ring transition-[color,opacity] group-hover/file:opacity-100 hover:text-interactive focus-visible:opacity-100 [@media(hover:none)]:opacity-100 motion-reduce:transition-none", t3);
|
|
97
|
+
$[3] = t3;
|
|
98
|
+
$[4] = t4;
|
|
99
|
+
} else {
|
|
100
|
+
t4 = $[4];
|
|
101
|
+
}
|
|
102
|
+
let t5;
|
|
103
|
+
if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
|
|
104
|
+
t5 = /*#__PURE__*/_jsx(XIcon, {
|
|
105
|
+
weight: "bold",
|
|
45
106
|
"aria-hidden": "true",
|
|
46
107
|
className: "size-3.5"
|
|
47
|
-
})
|
|
48
|
-
|
|
108
|
+
});
|
|
109
|
+
$[5] = t5;
|
|
110
|
+
} else {
|
|
111
|
+
t5 = $[5];
|
|
112
|
+
}
|
|
113
|
+
let t6;
|
|
114
|
+
if ($[6] !== t1 || $[7] !== t2 || $[8] !== t4) {
|
|
115
|
+
t6 = /*#__PURE__*/_jsx("button", {
|
|
116
|
+
type: "button",
|
|
117
|
+
"aria-label": t1,
|
|
118
|
+
onClick: t2,
|
|
119
|
+
className: t4,
|
|
120
|
+
children: t5
|
|
121
|
+
});
|
|
122
|
+
$[6] = t1;
|
|
123
|
+
$[7] = t2;
|
|
124
|
+
$[8] = t4;
|
|
125
|
+
$[9] = t6;
|
|
126
|
+
} else {
|
|
127
|
+
t6 = $[9];
|
|
128
|
+
}
|
|
129
|
+
return t6;
|
|
49
130
|
}
|
|
50
|
-
function FileChip({
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
131
|
+
function FileChip(t0) {
|
|
132
|
+
const $ = _c(27);
|
|
133
|
+
const {
|
|
134
|
+
item,
|
|
135
|
+
isGrid,
|
|
136
|
+
onRemove
|
|
137
|
+
} = t0;
|
|
138
|
+
let t1;
|
|
139
|
+
if ($[0] !== item) {
|
|
140
|
+
t1 = describeFile(item);
|
|
141
|
+
$[0] = item;
|
|
142
|
+
$[1] = t1;
|
|
143
|
+
} else {
|
|
144
|
+
t1 = $[1];
|
|
145
|
+
}
|
|
146
|
+
const description = t1;
|
|
147
|
+
const t2 = isGrid ? "flex-col" : "max-w-60 items-center gap-2.5 py-1.5 pr-1.5 pl-1.5";
|
|
148
|
+
const t3 = !isGrid && !onRemove && "pr-3";
|
|
149
|
+
let t4;
|
|
150
|
+
if ($[2] !== t2 || $[3] !== t3) {
|
|
151
|
+
t4 = cn("group/file relative flex min-w-0 bg-muted/50 text-foreground", t2, t3);
|
|
152
|
+
$[2] = t2;
|
|
153
|
+
$[3] = t3;
|
|
154
|
+
$[4] = t4;
|
|
155
|
+
} else {
|
|
156
|
+
t4 = $[4];
|
|
157
|
+
}
|
|
158
|
+
let t5;
|
|
159
|
+
if ($[5] !== isGrid || $[6] !== item) {
|
|
160
|
+
t5 = /*#__PURE__*/_jsx(FilePreview, {
|
|
60
161
|
item: item,
|
|
61
162
|
isGrid: isGrid
|
|
62
|
-
})
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
163
|
+
});
|
|
164
|
+
$[5] = isGrid;
|
|
165
|
+
$[6] = item;
|
|
166
|
+
$[7] = t5;
|
|
167
|
+
} else {
|
|
168
|
+
t5 = $[7];
|
|
169
|
+
}
|
|
170
|
+
const t6 = isGrid && "px-3 py-2.5";
|
|
171
|
+
let t7;
|
|
172
|
+
if ($[8] !== t6) {
|
|
173
|
+
t7 = cn("flex min-w-0 flex-1 flex-col gap-0.5", t6);
|
|
174
|
+
$[8] = t6;
|
|
175
|
+
$[9] = t7;
|
|
176
|
+
} else {
|
|
177
|
+
t7 = $[9];
|
|
178
|
+
}
|
|
179
|
+
let t8;
|
|
180
|
+
if ($[10] !== item.name) {
|
|
181
|
+
t8 = /*#__PURE__*/_jsx("span", {
|
|
182
|
+
title: item.name,
|
|
183
|
+
className: "truncate text-sm leading-tight font-medium",
|
|
184
|
+
children: item.name
|
|
185
|
+
});
|
|
186
|
+
$[10] = item.name;
|
|
187
|
+
$[11] = t8;
|
|
188
|
+
} else {
|
|
189
|
+
t8 = $[11];
|
|
190
|
+
}
|
|
191
|
+
let t9;
|
|
192
|
+
if ($[12] !== description) {
|
|
193
|
+
t9 = description && /*#__PURE__*/_jsx("span", {
|
|
194
|
+
className: "truncate text-xs leading-tight text-faint tabular-nums",
|
|
195
|
+
children: description
|
|
196
|
+
});
|
|
197
|
+
$[12] = description;
|
|
198
|
+
$[13] = t9;
|
|
199
|
+
} else {
|
|
200
|
+
t9 = $[13];
|
|
201
|
+
}
|
|
202
|
+
let t10;
|
|
203
|
+
if ($[14] !== t7 || $[15] !== t8 || $[16] !== t9) {
|
|
204
|
+
t10 = /*#__PURE__*/_jsxs("span", {
|
|
205
|
+
className: t7,
|
|
206
|
+
children: [t8, t9]
|
|
207
|
+
});
|
|
208
|
+
$[14] = t7;
|
|
209
|
+
$[15] = t8;
|
|
210
|
+
$[16] = t9;
|
|
211
|
+
$[17] = t10;
|
|
212
|
+
} else {
|
|
213
|
+
t10 = $[17];
|
|
214
|
+
}
|
|
215
|
+
let t11;
|
|
216
|
+
if ($[18] !== isGrid || $[19] !== item || $[20] !== onRemove) {
|
|
217
|
+
t11 = onRemove && /*#__PURE__*/_jsx(RemoveButton, {
|
|
73
218
|
item: item,
|
|
74
219
|
isGrid: isGrid,
|
|
75
220
|
onRemove: onRemove
|
|
76
|
-
})
|
|
77
|
-
|
|
221
|
+
});
|
|
222
|
+
$[18] = isGrid;
|
|
223
|
+
$[19] = item;
|
|
224
|
+
$[20] = onRemove;
|
|
225
|
+
$[21] = t11;
|
|
226
|
+
} else {
|
|
227
|
+
t11 = $[21];
|
|
228
|
+
}
|
|
229
|
+
let t12;
|
|
230
|
+
if ($[22] !== t10 || $[23] !== t11 || $[24] !== t4 || $[25] !== t5) {
|
|
231
|
+
t12 = /*#__PURE__*/_jsxs("li", {
|
|
232
|
+
"data-slot": "files-item",
|
|
233
|
+
className: t4,
|
|
234
|
+
children: [t5, t10, t11]
|
|
235
|
+
});
|
|
236
|
+
$[22] = t10;
|
|
237
|
+
$[23] = t11;
|
|
238
|
+
$[24] = t4;
|
|
239
|
+
$[25] = t5;
|
|
240
|
+
$[26] = t12;
|
|
241
|
+
} else {
|
|
242
|
+
t12 = $[26];
|
|
243
|
+
}
|
|
244
|
+
return t12;
|
|
78
245
|
}
|
|
79
|
-
export function Files({
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
246
|
+
export function Files(t0) {
|
|
247
|
+
const $ = _c(21);
|
|
248
|
+
let className;
|
|
249
|
+
let items;
|
|
250
|
+
let onRemove;
|
|
251
|
+
let props;
|
|
252
|
+
let t1;
|
|
253
|
+
if ($[0] !== t0) {
|
|
254
|
+
({
|
|
255
|
+
items,
|
|
256
|
+
layout: t1,
|
|
257
|
+
onRemove,
|
|
258
|
+
className,
|
|
259
|
+
...props
|
|
260
|
+
} = t0);
|
|
261
|
+
$[0] = t0;
|
|
262
|
+
$[1] = className;
|
|
263
|
+
$[2] = items;
|
|
264
|
+
$[3] = onRemove;
|
|
265
|
+
$[4] = props;
|
|
266
|
+
$[5] = t1;
|
|
267
|
+
} else {
|
|
268
|
+
className = $[1];
|
|
269
|
+
items = $[2];
|
|
270
|
+
onRemove = $[3];
|
|
271
|
+
props = $[4];
|
|
272
|
+
t1 = $[5];
|
|
273
|
+
}
|
|
274
|
+
const layout = t1 === undefined ? "inline" : t1;
|
|
86
275
|
if (items.length === 0) {
|
|
87
276
|
return null;
|
|
88
277
|
}
|
|
89
278
|
const isGrid = layout === "grid";
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
279
|
+
const t2 = isGrid ? "grid grid-cols-2 gap-2 sm:grid-cols-3" : "flex flex-wrap gap-2";
|
|
280
|
+
let t3;
|
|
281
|
+
if ($[6] !== className || $[7] !== t2) {
|
|
282
|
+
t3 = cn(t2, className);
|
|
283
|
+
$[6] = className;
|
|
284
|
+
$[7] = t2;
|
|
285
|
+
$[8] = t3;
|
|
286
|
+
} else {
|
|
287
|
+
t3 = $[8];
|
|
288
|
+
}
|
|
289
|
+
let t4;
|
|
290
|
+
if ($[9] !== isGrid || $[10] !== items || $[11] !== onRemove) {
|
|
291
|
+
let t5;
|
|
292
|
+
if ($[13] !== isGrid || $[14] !== onRemove) {
|
|
293
|
+
t5 = item => /*#__PURE__*/_jsx(FileChip, {
|
|
294
|
+
item: item,
|
|
295
|
+
isGrid: isGrid,
|
|
296
|
+
onRemove: onRemove
|
|
297
|
+
}, item.id);
|
|
298
|
+
$[13] = isGrid;
|
|
299
|
+
$[14] = onRemove;
|
|
300
|
+
$[15] = t5;
|
|
301
|
+
} else {
|
|
302
|
+
t5 = $[15];
|
|
303
|
+
}
|
|
304
|
+
t4 = items.map(t5);
|
|
305
|
+
$[9] = isGrid;
|
|
306
|
+
$[10] = items;
|
|
307
|
+
$[11] = onRemove;
|
|
308
|
+
$[12] = t4;
|
|
309
|
+
} else {
|
|
310
|
+
t4 = $[12];
|
|
311
|
+
}
|
|
312
|
+
let t5;
|
|
313
|
+
if ($[16] !== layout || $[17] !== props || $[18] !== t3 || $[19] !== t4) {
|
|
314
|
+
t5 = /*#__PURE__*/_jsx("ul", {
|
|
315
|
+
"data-slot": "files",
|
|
316
|
+
"data-layout": layout,
|
|
317
|
+
"aria-label": "Files",
|
|
318
|
+
className: t3,
|
|
319
|
+
...props,
|
|
320
|
+
children: t4
|
|
321
|
+
});
|
|
322
|
+
$[16] = layout;
|
|
323
|
+
$[17] = props;
|
|
324
|
+
$[18] = t3;
|
|
325
|
+
$[19] = t4;
|
|
326
|
+
$[20] = t5;
|
|
327
|
+
} else {
|
|
328
|
+
t5 = $[20];
|
|
329
|
+
}
|
|
330
|
+
return t5;
|
|
102
331
|
}
|
package/dist/chat/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export * from "./chat/chat.js";
|
|
2
2
|
export * from "./composer/composer.js";
|
|
3
|
-
export { type ComposerStatus, isComposerBusy } from "./composer/composer-
|
|
3
|
+
export { type ComposerStatus, isComposerBusy } from "./composer/composer-status.js";
|
|
4
4
|
export { type FileItem, fileFromFilePart, formatBytes } from "./files/file-meta.js";
|
|
5
5
|
export * from "./files/files.js";
|
|
6
6
|
export * from "./reply/reply.js";
|
package/dist/chat/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export * from "./chat/chat.js";
|
|
2
2
|
export * from "./composer/composer.js";
|
|
3
|
-
export { isComposerBusy } from "./composer/composer-
|
|
3
|
+
export { isComposerBusy } from "./composer/composer-status.js";
|
|
4
4
|
export { fileFromFilePart, formatBytes } from "./files/file-meta.js";
|
|
5
5
|
export * from "./files/files.js";
|
|
6
6
|
export * from "./reply/reply.js";
|
|
@@ -1,142 +1,35 @@
|
|
|
1
|
-
import { cn } from "@locusgraph/components";
|
|
2
1
|
import { FencedCode, fencedCode } from "./fenced-code.js";
|
|
3
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
4
|
-
const blockGap = "mt-4 first:mt-0";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
5
3
|
export const markdownComponents = {
|
|
6
|
-
p: ({
|
|
7
|
-
node: _node,
|
|
8
|
-
className,
|
|
9
|
-
...props
|
|
10
|
-
}) => /*#__PURE__*/_jsx("p", {
|
|
11
|
-
className: cn("leading-relaxed text-pretty [&:not(:first-child)]:mt-3", className),
|
|
12
|
-
...props
|
|
13
|
-
}),
|
|
14
4
|
a: ({
|
|
15
5
|
node: _node,
|
|
16
|
-
|
|
6
|
+
children,
|
|
17
7
|
...props
|
|
18
|
-
}) => /*#__PURE__*/
|
|
8
|
+
}) => /*#__PURE__*/_jsxs("a", {
|
|
19
9
|
target: "_blank",
|
|
20
10
|
rel: "noopener noreferrer",
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
className,
|
|
27
|
-
...props
|
|
28
|
-
}) => /*#__PURE__*/_jsx("h1", {
|
|
29
|
-
className: cn("mt-7 mb-2 text-base font-semibold tracking-tight first:mt-0", className),
|
|
30
|
-
...props
|
|
31
|
-
}),
|
|
32
|
-
h2: ({
|
|
33
|
-
node: _node,
|
|
34
|
-
className,
|
|
35
|
-
...props
|
|
36
|
-
}) => /*#__PURE__*/_jsx("h2", {
|
|
37
|
-
className: cn("mt-6 mb-2 text-base font-semibold tracking-tight first:mt-0", className),
|
|
38
|
-
...props
|
|
39
|
-
}),
|
|
40
|
-
h3: ({
|
|
41
|
-
node: _node,
|
|
42
|
-
className,
|
|
43
|
-
...props
|
|
44
|
-
}) => /*#__PURE__*/_jsx("h3", {
|
|
45
|
-
className: cn("mt-5 mb-1.5 text-sm font-semibold first:mt-0", className),
|
|
46
|
-
...props
|
|
47
|
-
}),
|
|
48
|
-
h4: ({
|
|
49
|
-
node: _node,
|
|
50
|
-
className,
|
|
51
|
-
...props
|
|
52
|
-
}) => /*#__PURE__*/_jsx("h4", {
|
|
53
|
-
className: cn("locus-eyebrow mt-5 mb-1.5 first:mt-0", className),
|
|
54
|
-
...props
|
|
55
|
-
}),
|
|
56
|
-
ul: ({
|
|
57
|
-
node: _node,
|
|
58
|
-
className,
|
|
59
|
-
...props
|
|
60
|
-
}) => /*#__PURE__*/_jsx("ul", {
|
|
61
|
-
className: cn("mt-3 list-disc space-y-1.5 pl-5 first:mt-0 [li_&]:mt-1.5", className),
|
|
62
|
-
...props
|
|
63
|
-
}),
|
|
64
|
-
ol: ({
|
|
65
|
-
node: _node,
|
|
66
|
-
className,
|
|
67
|
-
...props
|
|
68
|
-
}) => /*#__PURE__*/_jsx("ol", {
|
|
69
|
-
className: cn("mt-3 list-decimal space-y-1.5 pl-5 first:mt-0 marker:tabular-nums [li_&]:mt-1.5", className),
|
|
70
|
-
...props
|
|
71
|
-
}),
|
|
72
|
-
li: ({
|
|
73
|
-
node: _node,
|
|
74
|
-
className,
|
|
75
|
-
...props
|
|
76
|
-
}) => /*#__PURE__*/_jsx("li", {
|
|
77
|
-
className: cn("pl-1 leading-relaxed marker:text-muted-foreground [&>p]:mt-0", className),
|
|
78
|
-
...props
|
|
79
|
-
}),
|
|
80
|
-
blockquote: ({
|
|
81
|
-
node: _node,
|
|
82
|
-
className,
|
|
83
|
-
...props
|
|
84
|
-
}) => /*#__PURE__*/_jsx("blockquote", {
|
|
85
|
-
className: cn("border-l-2 border-border pl-4 text-muted-foreground", blockGap, className),
|
|
86
|
-
...props
|
|
87
|
-
}),
|
|
88
|
-
hr: ({
|
|
89
|
-
node: _node,
|
|
90
|
-
className,
|
|
91
|
-
...props
|
|
92
|
-
}) => /*#__PURE__*/_jsx("hr", {
|
|
93
|
-
className: cn("my-6 border-border", className),
|
|
94
|
-
...props
|
|
11
|
+
...props,
|
|
12
|
+
children: [children, /*#__PURE__*/_jsx("span", {
|
|
13
|
+
className: "sr-only",
|
|
14
|
+
children: ", opens in a new tab"
|
|
15
|
+
})]
|
|
95
16
|
}),
|
|
96
17
|
pre: ({
|
|
97
18
|
node,
|
|
98
|
-
className,
|
|
99
19
|
...props
|
|
100
20
|
}) => fencedCode(node) ? /*#__PURE__*/_jsx(FencedCode, {
|
|
101
21
|
node: node
|
|
102
22
|
}) : /*#__PURE__*/_jsx("pre", {
|
|
103
|
-
className: cn("overflow-x-auto bg-muted/40 p-3 font-mono text-xs leading-relaxed", blockGap, className),
|
|
104
|
-
...props
|
|
105
|
-
}),
|
|
106
|
-
code: ({
|
|
107
|
-
node: _node,
|
|
108
|
-
className,
|
|
109
|
-
...props
|
|
110
|
-
}) => /*#__PURE__*/_jsx("code", {
|
|
111
|
-
className: cn("bg-muted px-1.5 py-0.5 font-mono text-[0.85em] text-foreground [pre_&]:bg-transparent [pre_&]:p-0", className),
|
|
112
23
|
...props
|
|
113
24
|
}),
|
|
114
25
|
table: ({
|
|
115
26
|
node: _node,
|
|
116
|
-
className,
|
|
117
27
|
...props
|
|
118
28
|
}) => /*#__PURE__*/_jsx("div", {
|
|
119
29
|
"data-slot": "reply-table",
|
|
120
|
-
className:
|
|
30
|
+
className: "typeset-scroll",
|
|
121
31
|
children: /*#__PURE__*/_jsx("table", {
|
|
122
|
-
className: cn("w-full border-collapse text-sm [&_td:not(:first-child)]:tabular-nums", className),
|
|
123
32
|
...props
|
|
124
33
|
})
|
|
125
|
-
}),
|
|
126
|
-
th: ({
|
|
127
|
-
node: _node,
|
|
128
|
-
className,
|
|
129
|
-
...props
|
|
130
|
-
}) => /*#__PURE__*/_jsx("th", {
|
|
131
|
-
className: cn("locus-eyebrow border-b bg-muted/30 px-3 py-2 text-left font-normal", className),
|
|
132
|
-
...props
|
|
133
|
-
}),
|
|
134
|
-
td: ({
|
|
135
|
-
node: _node,
|
|
136
|
-
className,
|
|
137
|
-
...props
|
|
138
|
-
}) => /*#__PURE__*/_jsx("td", {
|
|
139
|
-
className: cn("border-b px-3 py-2 align-top [tr:last-child_&]:border-b-0", className),
|
|
140
|
-
...props
|
|
141
34
|
})
|
|
142
35
|
};
|
package/dist/chat/reply/reply.js
CHANGED
|
@@ -31,8 +31,8 @@ export function Reply({
|
|
|
31
31
|
return /*#__PURE__*/_jsx("div", {
|
|
32
32
|
"data-slot": "reply",
|
|
33
33
|
"data-state": state,
|
|
34
|
-
"aria-
|
|
35
|
-
className: cn("
|
|
34
|
+
"aria-busy": isStreaming || undefined,
|
|
35
|
+
className: cn("typeset locus-typeset-chat min-w-0 text-pretty", streamingCaret, className),
|
|
36
36
|
...props,
|
|
37
37
|
children: /*#__PURE__*/_jsx(Markdown, {
|
|
38
38
|
markdown: markdown
|
|
@@ -19,6 +19,7 @@ export type PartSegment = {
|
|
|
19
19
|
kind: "sources";
|
|
20
20
|
key: string;
|
|
21
21
|
parts: SourceUrlPart[];
|
|
22
|
+
firstIndex: number;
|
|
22
23
|
};
|
|
23
24
|
export declare function isToolPart(part: MessagePart): part is ToolPart;
|
|
24
25
|
export declare function groupParts(parts: MessagePart[]): PartSegment[];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export function isToolPart(part) {
|
|
2
2
|
return part.type === "dynamic-tool" || part.type.startsWith("tool-");
|
|
3
3
|
}
|
|
4
|
-
function appendToRun(segments, kind, part, key) {
|
|
4
|
+
function appendToRun(segments, kind, part, key, firstIndex = 1) {
|
|
5
5
|
const previous = segments.at(-1);
|
|
6
6
|
if (previous?.kind === kind) {
|
|
7
7
|
previous.parts.push(part);
|
|
@@ -14,11 +14,13 @@ function appendToRun(segments, kind, part, key) {
|
|
|
14
14
|
} : {
|
|
15
15
|
kind,
|
|
16
16
|
key,
|
|
17
|
-
parts: [part]
|
|
17
|
+
parts: [part],
|
|
18
|
+
firstIndex
|
|
18
19
|
});
|
|
19
20
|
}
|
|
20
21
|
export function groupParts(parts) {
|
|
21
22
|
const segments = [];
|
|
23
|
+
let sourcesSeen = 0;
|
|
22
24
|
parts.forEach((part, index) => {
|
|
23
25
|
const key = `${part.type}:${index}`;
|
|
24
26
|
if (part.type === "text") {
|
|
@@ -36,7 +38,8 @@ export function groupParts(parts) {
|
|
|
36
38
|
} else if (part.type === "file") {
|
|
37
39
|
appendToRun(segments, "files", part, key);
|
|
38
40
|
} else if (part.type === "source-url") {
|
|
39
|
-
|
|
41
|
+
sourcesSeen += 1;
|
|
42
|
+
appendToRun(segments, "sources", part, key, sourcesSeen);
|
|
40
43
|
} else if (isToolPart(part)) {
|
|
41
44
|
segments.push({
|
|
42
45
|
kind: "tool",
|
package/dist/chat/turn/turn.js
CHANGED
|
@@ -26,10 +26,17 @@ function partClassName(role, kind) {
|
|
|
26
26
|
return "w-full items-end";
|
|
27
27
|
}
|
|
28
28
|
if (role === "system") {
|
|
29
|
-
return "
|
|
29
|
+
return "*:data-[slot=reply]:text-xs *:data-[slot=reply]:text-faint";
|
|
30
30
|
}
|
|
31
31
|
return cn(kind === "text" && "*:data-[slot=reply]:max-w-[68ch]");
|
|
32
32
|
}
|
|
33
|
+
const lineKinds = new Set(["reasoning", "tool", "sources"]);
|
|
34
|
+
function followsLine(segments, position) {
|
|
35
|
+
const previous = segments[position - 1];
|
|
36
|
+
const current = segments[position];
|
|
37
|
+
if (!previous || !current) return false;
|
|
38
|
+
return lineKinds.has(previous.kind) && lineKinds.has(current.kind);
|
|
39
|
+
}
|
|
33
40
|
function renderSegment(segment, isUser, renderers) {
|
|
34
41
|
switch (segment.kind) {
|
|
35
42
|
case "text":
|
|
@@ -51,7 +58,8 @@ function renderSegment(segment, isUser, renderers) {
|
|
|
51
58
|
});
|
|
52
59
|
case "sources":
|
|
53
60
|
return renderers.renderSources ? renderers.renderSources(segment.parts) : /*#__PURE__*/_jsx(Sources, {
|
|
54
|
-
sources: segment.parts
|
|
61
|
+
sources: segment.parts,
|
|
62
|
+
firstIndex: segment.firstIndex
|
|
55
63
|
});
|
|
56
64
|
case "files":
|
|
57
65
|
return /*#__PURE__*/_jsx(Files, {
|
|
@@ -88,10 +96,11 @@ export function Turn({
|
|
|
88
96
|
children: avatar
|
|
89
97
|
}), /*#__PURE__*/_jsxs(MessageContent, {
|
|
90
98
|
className: cn("gap-4", isUser && "items-end gap-2"),
|
|
91
|
-
children: [groupParts(message.parts).map(segment => /*#__PURE__*/_jsx("div", {
|
|
99
|
+
children: [groupParts(message.parts).map((segment, position, segments) => /*#__PURE__*/_jsx("div", {
|
|
92
100
|
"data-slot": "message-part",
|
|
93
101
|
"data-kind": segment.kind,
|
|
94
|
-
|
|
102
|
+
"data-follows-line": followsLine(segments, position) || undefined,
|
|
103
|
+
className: cn("flex min-w-0 flex-col data-follows-line:-mt-3", partClassName(message.role, segment.kind)),
|
|
95
104
|
children: renderSegment(segment, isUser, renderers)
|
|
96
105
|
}, segment.key)), footer && /*#__PURE__*/_jsx(MessageFooter, {
|
|
97
106
|
className: "px-0",
|