@locusgraph/loop 0.2.0 → 0.2.1
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/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 +85 -312
- 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 +23 -88
- 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/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 +64 -280
- 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 +42 -194
- package/dist/memory/recall.js +68 -263
- 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/version-switcher.js +31 -126
- package/dist/thread/code/copy-code-button.js +24 -56
- 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/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
|
}
|
package/dist/chat/turn/turn.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { c as _c } from "react/compiler-runtime";
|
|
2
1
|
import { cn, MessageAvatar, MessageContent, MessageFooter, Message as MessageRow } from "@locusgraph/components";
|
|
3
2
|
import { Thinking } from "../../agent/thinking/thinking.js";
|
|
4
3
|
import { Tool } from "../../agent/tool/tool.js";
|
|
@@ -13,24 +12,14 @@ const roleLabels = {
|
|
|
13
12
|
assistant: "Assistant said",
|
|
14
13
|
system: "System note"
|
|
15
14
|
};
|
|
16
|
-
function UserText(
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
"data-slot": "message-user-text",
|
|
25
|
-
className: "max-w-[85%] bg-muted px-3.5 py-2 text-sm leading-relaxed whitespace-pre-wrap wrap-break-word text-foreground",
|
|
26
|
-
children: part.text
|
|
27
|
-
});
|
|
28
|
-
$[0] = part.text;
|
|
29
|
-
$[1] = t1;
|
|
30
|
-
} else {
|
|
31
|
-
t1 = $[1];
|
|
32
|
-
}
|
|
33
|
-
return t1;
|
|
15
|
+
function UserText({
|
|
16
|
+
part
|
|
17
|
+
}) {
|
|
18
|
+
return /*#__PURE__*/_jsx("div", {
|
|
19
|
+
"data-slot": "message-user-text",
|
|
20
|
+
className: "max-w-[85%] bg-muted px-3.5 py-2 text-sm leading-relaxed whitespace-pre-wrap wrap-break-word text-foreground",
|
|
21
|
+
children: part.text
|
|
22
|
+
});
|
|
34
23
|
}
|
|
35
24
|
function partClassName(role, kind) {
|
|
36
25
|
if (role === "user") {
|
|
@@ -71,183 +60,43 @@ function renderSegment(segment, isUser, renderers) {
|
|
|
71
60
|
});
|
|
72
61
|
}
|
|
73
62
|
}
|
|
74
|
-
export function Turn(
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
if ($[0] !== t0) {
|
|
85
|
-
({
|
|
86
|
-
message,
|
|
87
|
-
avatar,
|
|
88
|
-
footer,
|
|
89
|
-
renderReasoning,
|
|
90
|
-
renderTool,
|
|
91
|
-
renderSources,
|
|
92
|
-
className,
|
|
93
|
-
...props
|
|
94
|
-
} = t0);
|
|
95
|
-
$[0] = t0;
|
|
96
|
-
$[1] = avatar;
|
|
97
|
-
$[2] = className;
|
|
98
|
-
$[3] = footer;
|
|
99
|
-
$[4] = message;
|
|
100
|
-
$[5] = props;
|
|
101
|
-
$[6] = renderReasoning;
|
|
102
|
-
$[7] = renderSources;
|
|
103
|
-
$[8] = renderTool;
|
|
104
|
-
} else {
|
|
105
|
-
avatar = $[1];
|
|
106
|
-
className = $[2];
|
|
107
|
-
footer = $[3];
|
|
108
|
-
message = $[4];
|
|
109
|
-
props = $[5];
|
|
110
|
-
renderReasoning = $[6];
|
|
111
|
-
renderSources = $[7];
|
|
112
|
-
renderTool = $[8];
|
|
113
|
-
}
|
|
63
|
+
export function Turn({
|
|
64
|
+
message,
|
|
65
|
+
avatar,
|
|
66
|
+
footer,
|
|
67
|
+
renderReasoning,
|
|
68
|
+
renderTool,
|
|
69
|
+
renderSources,
|
|
70
|
+
className,
|
|
71
|
+
...props
|
|
72
|
+
}) {
|
|
114
73
|
const isUser = message.role === "user";
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
}
|
|
144
|
-
t8 = props;
|
|
145
|
-
if ($[31] !== avatar) {
|
|
146
|
-
t9 = avatar && /*#__PURE__*/_jsx(MessageAvatar, {
|
|
147
|
-
className: "mt-0.5 self-start group-has-data-[slot=message-footer]/message:translate-y-0",
|
|
148
|
-
children: avatar
|
|
149
|
-
});
|
|
150
|
-
$[31] = avatar;
|
|
151
|
-
$[32] = t9;
|
|
152
|
-
} else {
|
|
153
|
-
t9 = $[32];
|
|
154
|
-
}
|
|
155
|
-
T0 = MessageContent;
|
|
156
|
-
const t10 = isUser && "items-end gap-2";
|
|
157
|
-
if ($[33] !== t10) {
|
|
158
|
-
t1 = cn("gap-4", t10);
|
|
159
|
-
$[33] = t10;
|
|
160
|
-
$[34] = t1;
|
|
161
|
-
} else {
|
|
162
|
-
t1 = $[34];
|
|
163
|
-
}
|
|
164
|
-
t2 = groupParts(message.parts).map(segment => /*#__PURE__*/_jsx("div", {
|
|
165
|
-
"data-slot": "message-part",
|
|
166
|
-
"data-kind": segment.kind,
|
|
167
|
-
className: cn("flex min-w-0 flex-col", partClassName(message.role, segment.kind)),
|
|
168
|
-
children: renderSegment(segment, isUser, renderers)
|
|
169
|
-
}, segment.key));
|
|
170
|
-
$[9] = avatar;
|
|
171
|
-
$[10] = className;
|
|
172
|
-
$[11] = isUser;
|
|
173
|
-
$[12] = message.parts;
|
|
174
|
-
$[13] = message.role;
|
|
175
|
-
$[14] = props;
|
|
176
|
-
$[15] = renderReasoning;
|
|
177
|
-
$[16] = renderSources;
|
|
178
|
-
$[17] = renderTool;
|
|
179
|
-
$[18] = T0;
|
|
180
|
-
$[19] = T1;
|
|
181
|
-
$[20] = t1;
|
|
182
|
-
$[21] = t2;
|
|
183
|
-
$[22] = t3;
|
|
184
|
-
$[23] = t4;
|
|
185
|
-
$[24] = t5;
|
|
186
|
-
$[25] = t6;
|
|
187
|
-
$[26] = t7;
|
|
188
|
-
$[27] = t8;
|
|
189
|
-
$[28] = t9;
|
|
190
|
-
} else {
|
|
191
|
-
T0 = $[18];
|
|
192
|
-
T1 = $[19];
|
|
193
|
-
t1 = $[20];
|
|
194
|
-
t2 = $[21];
|
|
195
|
-
t3 = $[22];
|
|
196
|
-
t4 = $[23];
|
|
197
|
-
t5 = $[24];
|
|
198
|
-
t6 = $[25];
|
|
199
|
-
t7 = $[26];
|
|
200
|
-
t8 = $[27];
|
|
201
|
-
t9 = $[28];
|
|
202
|
-
}
|
|
203
|
-
let t10;
|
|
204
|
-
if ($[35] !== footer) {
|
|
205
|
-
t10 = footer && /*#__PURE__*/_jsx(MessageFooter, {
|
|
206
|
-
className: "px-0",
|
|
207
|
-
children: footer
|
|
208
|
-
});
|
|
209
|
-
$[35] = footer;
|
|
210
|
-
$[36] = t10;
|
|
211
|
-
} else {
|
|
212
|
-
t10 = $[36];
|
|
213
|
-
}
|
|
214
|
-
let t11;
|
|
215
|
-
if ($[37] !== T0 || $[38] !== t1 || $[39] !== t10 || $[40] !== t2) {
|
|
216
|
-
t11 = /*#__PURE__*/_jsxs(T0, {
|
|
217
|
-
className: t1,
|
|
218
|
-
children: [t2, t10]
|
|
219
|
-
});
|
|
220
|
-
$[37] = T0;
|
|
221
|
-
$[38] = t1;
|
|
222
|
-
$[39] = t10;
|
|
223
|
-
$[40] = t2;
|
|
224
|
-
$[41] = t11;
|
|
225
|
-
} else {
|
|
226
|
-
t11 = $[41];
|
|
227
|
-
}
|
|
228
|
-
let t12;
|
|
229
|
-
if ($[42] !== T1 || $[43] !== t11 || $[44] !== t3 || $[45] !== t4 || $[46] !== t5 || $[47] !== t6 || $[48] !== t7 || $[49] !== t8 || $[50] !== t9) {
|
|
230
|
-
t12 = /*#__PURE__*/_jsxs(T1, {
|
|
231
|
-
"data-role": t3,
|
|
232
|
-
align: t4,
|
|
233
|
-
"aria-label": t5,
|
|
234
|
-
role: t6,
|
|
235
|
-
className: t7,
|
|
236
|
-
...t8,
|
|
237
|
-
children: [t9, t11]
|
|
238
|
-
});
|
|
239
|
-
$[42] = T1;
|
|
240
|
-
$[43] = t11;
|
|
241
|
-
$[44] = t3;
|
|
242
|
-
$[45] = t4;
|
|
243
|
-
$[46] = t5;
|
|
244
|
-
$[47] = t6;
|
|
245
|
-
$[48] = t7;
|
|
246
|
-
$[49] = t8;
|
|
247
|
-
$[50] = t9;
|
|
248
|
-
$[51] = t12;
|
|
249
|
-
} else {
|
|
250
|
-
t12 = $[51];
|
|
251
|
-
}
|
|
252
|
-
return t12;
|
|
74
|
+
const renderers = {
|
|
75
|
+
renderReasoning,
|
|
76
|
+
renderTool,
|
|
77
|
+
renderSources
|
|
78
|
+
};
|
|
79
|
+
return /*#__PURE__*/_jsxs(MessageRow, {
|
|
80
|
+
"data-role": message.role,
|
|
81
|
+
align: isUser ? "end" : "start",
|
|
82
|
+
"aria-label": roleLabels[message.role],
|
|
83
|
+
role: "article",
|
|
84
|
+
className: cn("gap-3 data-[role=system]:text-muted-foreground", className),
|
|
85
|
+
...props,
|
|
86
|
+
children: [avatar && /*#__PURE__*/_jsx(MessageAvatar, {
|
|
87
|
+
className: "mt-0.5 self-start group-has-data-[slot=message-footer]/message:translate-y-0",
|
|
88
|
+
children: avatar
|
|
89
|
+
}), /*#__PURE__*/_jsxs(MessageContent, {
|
|
90
|
+
className: cn("gap-4", isUser && "items-end gap-2"),
|
|
91
|
+
children: [groupParts(message.parts).map(segment => /*#__PURE__*/_jsx("div", {
|
|
92
|
+
"data-slot": "message-part",
|
|
93
|
+
"data-kind": segment.kind,
|
|
94
|
+
className: cn("flex min-w-0 flex-col", partClassName(message.role, segment.kind)),
|
|
95
|
+
children: renderSegment(segment, isUser, renderers)
|
|
96
|
+
}, segment.key)), footer && /*#__PURE__*/_jsx(MessageFooter, {
|
|
97
|
+
className: "px-0",
|
|
98
|
+
children: footer
|
|
99
|
+
})]
|
|
100
|
+
})]
|
|
101
|
+
});
|
|
253
102
|
}
|