@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/cost/cost-steps.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { c as _c } from "react/compiler-runtime";
|
|
2
1
|
import { Roadmap as ChartNoAxesGanttIcon } from "@carbon/icons-react";
|
|
3
2
|
import { formatCount, formatMicroUsd, pluralize } from "@locusgraph/utils";
|
|
4
3
|
import { ApprovalPanel, PanelHeader } from "../shared/panel.js";
|
|
@@ -16,170 +15,48 @@ export function stepCostTotals(steps) {
|
|
|
16
15
|
durationMs
|
|
17
16
|
};
|
|
18
17
|
}
|
|
19
|
-
function Totals(
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
t1 = formatMicroUsd(totals.costMicroUsd);
|
|
27
|
-
$[0] = totals.costMicroUsd;
|
|
28
|
-
$[1] = t1;
|
|
29
|
-
} else {
|
|
30
|
-
t1 = $[1];
|
|
31
|
-
}
|
|
32
|
-
let t2;
|
|
33
|
-
if ($[2] !== t1) {
|
|
34
|
-
t2 = /*#__PURE__*/_jsx("span", {
|
|
18
|
+
function Totals({
|
|
19
|
+
totals
|
|
20
|
+
}) {
|
|
21
|
+
return /*#__PURE__*/_jsxs("div", {
|
|
22
|
+
"data-slot": "step-cost-totals",
|
|
23
|
+
className: "flex flex-col gap-1 px-5 pt-2 pb-4",
|
|
24
|
+
children: [/*#__PURE__*/_jsx("span", {
|
|
35
25
|
className: "text-2xl font-semibold tracking-tight tabular-nums",
|
|
36
|
-
children:
|
|
37
|
-
})
|
|
38
|
-
$[2] = t1;
|
|
39
|
-
$[3] = t2;
|
|
40
|
-
} else {
|
|
41
|
-
t2 = $[3];
|
|
42
|
-
}
|
|
43
|
-
let t3;
|
|
44
|
-
if ($[4] !== totals.inputTokens) {
|
|
45
|
-
t3 = formatCount(totals.inputTokens);
|
|
46
|
-
$[4] = totals.inputTokens;
|
|
47
|
-
$[5] = t3;
|
|
48
|
-
} else {
|
|
49
|
-
t3 = $[5];
|
|
50
|
-
}
|
|
51
|
-
let t4;
|
|
52
|
-
if ($[6] !== totals.outputTokens) {
|
|
53
|
-
t4 = formatCount(totals.outputTokens);
|
|
54
|
-
$[6] = totals.outputTokens;
|
|
55
|
-
$[7] = t4;
|
|
56
|
-
} else {
|
|
57
|
-
t4 = $[7];
|
|
58
|
-
}
|
|
59
|
-
let t5;
|
|
60
|
-
if ($[8] !== totals.durationMs) {
|
|
61
|
-
t5 = totals.durationMs > 0 && ` · ${formatDuration(totals.durationMs)}`;
|
|
62
|
-
$[8] = totals.durationMs;
|
|
63
|
-
$[9] = t5;
|
|
64
|
-
} else {
|
|
65
|
-
t5 = $[9];
|
|
66
|
-
}
|
|
67
|
-
let t6;
|
|
68
|
-
if ($[10] !== t3 || $[11] !== t4 || $[12] !== t5) {
|
|
69
|
-
t6 = /*#__PURE__*/_jsxs("span", {
|
|
70
|
-
children: [t3, " in \xB7 ", t4, " out", t5]
|
|
71
|
-
});
|
|
72
|
-
$[10] = t3;
|
|
73
|
-
$[11] = t4;
|
|
74
|
-
$[12] = t5;
|
|
75
|
-
$[13] = t6;
|
|
76
|
-
} else {
|
|
77
|
-
t6 = $[13];
|
|
78
|
-
}
|
|
79
|
-
let t7;
|
|
80
|
-
if ($[14] !== totals.wastedMicroUsd) {
|
|
81
|
-
t7 = totals.wastedMicroUsd > 0 && /*#__PURE__*/_jsxs("span", {
|
|
82
|
-
className: "text-destructive",
|
|
83
|
-
children: ["Wasted on failures ", formatMicroUsd(totals.wastedMicroUsd)]
|
|
84
|
-
});
|
|
85
|
-
$[14] = totals.wastedMicroUsd;
|
|
86
|
-
$[15] = t7;
|
|
87
|
-
} else {
|
|
88
|
-
t7 = $[15];
|
|
89
|
-
}
|
|
90
|
-
let t8;
|
|
91
|
-
if ($[16] !== t6 || $[17] !== t7) {
|
|
92
|
-
t8 = /*#__PURE__*/_jsxs("span", {
|
|
26
|
+
children: formatMicroUsd(totals.costMicroUsd)
|
|
27
|
+
}), /*#__PURE__*/_jsxs("span", {
|
|
93
28
|
className: "flex flex-wrap gap-x-3 gap-y-0.5 text-xs text-muted-foreground tabular-nums",
|
|
94
|
-
children: [
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
}
|
|
102
|
-
let t9;
|
|
103
|
-
if ($[19] !== t2 || $[20] !== t8) {
|
|
104
|
-
t9 = /*#__PURE__*/_jsxs("div", {
|
|
105
|
-
"data-slot": "step-cost-totals",
|
|
106
|
-
className: "flex flex-col gap-1 px-5 pt-2 pb-4",
|
|
107
|
-
children: [t2, t8]
|
|
108
|
-
});
|
|
109
|
-
$[19] = t2;
|
|
110
|
-
$[20] = t8;
|
|
111
|
-
$[21] = t9;
|
|
112
|
-
} else {
|
|
113
|
-
t9 = $[21];
|
|
114
|
-
}
|
|
115
|
-
return t9;
|
|
29
|
+
children: [/*#__PURE__*/_jsxs("span", {
|
|
30
|
+
children: [formatCount(totals.inputTokens), " in \xB7 ", formatCount(totals.outputTokens), " out", totals.durationMs > 0 && ` · ${formatDuration(totals.durationMs)}`]
|
|
31
|
+
}), totals.wastedMicroUsd > 0 && /*#__PURE__*/_jsxs("span", {
|
|
32
|
+
className: "text-destructive",
|
|
33
|
+
children: ["Wasted on failures ", formatMicroUsd(totals.wastedMicroUsd)]
|
|
34
|
+
})]
|
|
35
|
+
})]
|
|
36
|
+
});
|
|
116
37
|
}
|
|
117
|
-
export function CostSteps(
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
const
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
}
|
|
135
|
-
const totals = t3;
|
|
136
|
-
let t4;
|
|
137
|
-
if ($[2] !== steps) {
|
|
138
|
-
t4 = Math.max(0, ...steps.map(_temp));
|
|
139
|
-
$[2] = steps;
|
|
140
|
-
$[3] = t4;
|
|
141
|
-
} else {
|
|
142
|
-
t4 = $[3];
|
|
143
|
-
}
|
|
144
|
-
const maxCost = t4;
|
|
145
|
-
const running = steps.some(_temp2);
|
|
146
|
-
let t5;
|
|
147
|
-
if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
|
|
148
|
-
t5 = /*#__PURE__*/_jsx(ChartNoAxesGanttIcon, {
|
|
149
|
-
"aria-hidden": true
|
|
150
|
-
});
|
|
151
|
-
$[4] = t5;
|
|
152
|
-
} else {
|
|
153
|
-
t5 = $[4];
|
|
154
|
-
}
|
|
155
|
-
let t6;
|
|
156
|
-
if ($[5] !== steps.length) {
|
|
157
|
-
t6 = steps.length > 0 ? pluralize(steps.length, "step") : undefined;
|
|
158
|
-
$[5] = steps.length;
|
|
159
|
-
$[6] = t6;
|
|
160
|
-
} else {
|
|
161
|
-
t6 = $[6];
|
|
162
|
-
}
|
|
163
|
-
const t7 = running ? "Running" : undefined;
|
|
164
|
-
let t8;
|
|
165
|
-
if ($[7] !== label || $[8] !== t6 || $[9] !== t7) {
|
|
166
|
-
t8 = /*#__PURE__*/_jsx(PanelHeader, {
|
|
167
|
-
icon: t5,
|
|
38
|
+
export function CostSteps({
|
|
39
|
+
steps,
|
|
40
|
+
label = "Cost by step",
|
|
41
|
+
emptyText = "No steps have run yet.",
|
|
42
|
+
className
|
|
43
|
+
}) {
|
|
44
|
+
const totals = stepCostTotals(steps);
|
|
45
|
+
const maxCost = Math.max(0, ...steps.map(step => step.usage.costMicroUsd));
|
|
46
|
+
const running = steps.some(step => step.status === "running");
|
|
47
|
+
return /*#__PURE__*/_jsxs(ApprovalPanel, {
|
|
48
|
+
"data-slot": "cost-steps",
|
|
49
|
+
"aria-label": label,
|
|
50
|
+
className: className,
|
|
51
|
+
children: [/*#__PURE__*/_jsx(PanelHeader, {
|
|
52
|
+
icon: /*#__PURE__*/_jsx(ChartNoAxesGanttIcon, {
|
|
53
|
+
"aria-hidden": true
|
|
54
|
+
}),
|
|
168
55
|
eyebrow: label,
|
|
169
|
-
aside:
|
|
170
|
-
status:
|
|
56
|
+
aside: steps.length > 0 ? pluralize(steps.length, "step") : undefined,
|
|
57
|
+
status: running ? "Running" : undefined,
|
|
171
58
|
tone: "running"
|
|
172
|
-
})
|
|
173
|
-
$[7] = label;
|
|
174
|
-
$[8] = t6;
|
|
175
|
-
$[9] = t7;
|
|
176
|
-
$[10] = t8;
|
|
177
|
-
} else {
|
|
178
|
-
t8 = $[10];
|
|
179
|
-
}
|
|
180
|
-
let t9;
|
|
181
|
-
if ($[11] !== emptyText || $[12] !== maxCost || $[13] !== steps || $[14] !== totals) {
|
|
182
|
-
t9 = steps.length === 0 ? /*#__PURE__*/_jsx(PanelEmpty, {
|
|
59
|
+
}), steps.length === 0 ? /*#__PURE__*/_jsx(PanelEmpty, {
|
|
183
60
|
icon: /*#__PURE__*/_jsx(ChartNoAxesGanttIcon, {
|
|
184
61
|
"aria-hidden": true
|
|
185
62
|
}),
|
|
@@ -189,42 +66,12 @@ export function CostSteps(t0) {
|
|
|
189
66
|
totals: totals
|
|
190
67
|
}), /*#__PURE__*/_jsx("ol", {
|
|
191
68
|
className: "flex flex-col divide-y divide-border border-t border-border",
|
|
192
|
-
children: steps.map(
|
|
193
|
-
step:
|
|
69
|
+
children: steps.map(step => /*#__PURE__*/_jsx(StepCostRow, {
|
|
70
|
+
step: step,
|
|
194
71
|
maxCost: maxCost,
|
|
195
72
|
totalCost: totals.costMicroUsd
|
|
196
|
-
},
|
|
73
|
+
}, step.id))
|
|
197
74
|
})]
|
|
198
|
-
})
|
|
199
|
-
|
|
200
|
-
$[12] = maxCost;
|
|
201
|
-
$[13] = steps;
|
|
202
|
-
$[14] = totals;
|
|
203
|
-
$[15] = t9;
|
|
204
|
-
} else {
|
|
205
|
-
t9 = $[15];
|
|
206
|
-
}
|
|
207
|
-
let t10;
|
|
208
|
-
if ($[16] !== className || $[17] !== label || $[18] !== t8 || $[19] !== t9) {
|
|
209
|
-
t10 = /*#__PURE__*/_jsxs(ApprovalPanel, {
|
|
210
|
-
"data-slot": "cost-steps",
|
|
211
|
-
"aria-label": label,
|
|
212
|
-
className: className,
|
|
213
|
-
children: [t8, t9]
|
|
214
|
-
});
|
|
215
|
-
$[16] = className;
|
|
216
|
-
$[17] = label;
|
|
217
|
-
$[18] = t8;
|
|
218
|
-
$[19] = t9;
|
|
219
|
-
$[20] = t10;
|
|
220
|
-
} else {
|
|
221
|
-
t10 = $[20];
|
|
222
|
-
}
|
|
223
|
-
return t10;
|
|
224
|
-
}
|
|
225
|
-
function _temp2(step_0) {
|
|
226
|
-
return step_0.status === "running";
|
|
227
|
-
}
|
|
228
|
-
function _temp(step) {
|
|
229
|
-
return step.usage.costMicroUsd;
|
|
75
|
+
})]
|
|
76
|
+
});
|
|
230
77
|
}
|