@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.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { c as _c } from "react/compiler-runtime";
|
|
2
1
|
import { Money as CoinsIcon } from "@carbon/icons-react";
|
|
3
2
|
import { cn } from "@locusgraph/components";
|
|
4
3
|
import { formatCount, formatMicroUsd, pluralize } from "@locusgraph/utils";
|
|
@@ -12,520 +11,132 @@ function modelsOf(attempts) {
|
|
|
12
11
|
const models = [...new Set(attempts.map(attempt => attempt.model).filter(Boolean))];
|
|
13
12
|
return models.length > 0 ? models.join(", ") : undefined;
|
|
14
13
|
}
|
|
15
|
-
function WastedNote(
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
if ($[0] !== totals.failedAttempts) {
|
|
25
|
-
t1 = pluralize(totals.failedAttempts, "failed attempt");
|
|
26
|
-
$[0] = totals.failedAttempts;
|
|
27
|
-
$[1] = t1;
|
|
28
|
-
} else {
|
|
29
|
-
t1 = $[1];
|
|
30
|
-
}
|
|
31
|
-
let t2;
|
|
32
|
-
if ($[2] !== totals.wastedMicroUsd) {
|
|
33
|
-
t2 = formatMicroUsd(totals.wastedMicroUsd);
|
|
34
|
-
$[2] = totals.wastedMicroUsd;
|
|
35
|
-
$[3] = t2;
|
|
36
|
-
} else {
|
|
37
|
-
t2 = $[3];
|
|
38
|
-
}
|
|
39
|
-
let t3;
|
|
40
|
-
if ($[4] !== t1 || $[5] !== t2) {
|
|
41
|
-
t3 = /*#__PURE__*/_jsxs("span", {
|
|
42
|
-
"data-slot": "cost-wasted",
|
|
43
|
-
className: "text-destructive tabular-nums",
|
|
44
|
-
children: [t1, " \xB7 ", t2, " ", "wasted"]
|
|
45
|
-
});
|
|
46
|
-
$[4] = t1;
|
|
47
|
-
$[5] = t2;
|
|
48
|
-
$[6] = t3;
|
|
49
|
-
} else {
|
|
50
|
-
t3 = $[6];
|
|
51
|
-
}
|
|
52
|
-
return t3;
|
|
14
|
+
function WastedNote({
|
|
15
|
+
totals
|
|
16
|
+
}) {
|
|
17
|
+
if (totals.failedAttempts === 0) return null;
|
|
18
|
+
return /*#__PURE__*/_jsxs("span", {
|
|
19
|
+
"data-slot": "cost-wasted",
|
|
20
|
+
className: "text-destructive tabular-nums",
|
|
21
|
+
children: [pluralize(totals.failedAttempts, "failed attempt"), " \xB7 ", formatMicroUsd(totals.wastedMicroUsd), " ", "wasted"]
|
|
22
|
+
});
|
|
53
23
|
}
|
|
54
|
-
function CompactCost(
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
} else {
|
|
67
|
-
t1 = $[1];
|
|
68
|
-
}
|
|
69
|
-
const model = t1;
|
|
70
|
-
const t2 = totals.failedAttempts > 0 || undefined;
|
|
71
|
-
let t3;
|
|
72
|
-
if ($[2] !== className) {
|
|
73
|
-
t3 = cn("inline-flex flex-wrap items-baseline gap-x-3 gap-y-0.5 font-mono text-[11px] text-muted-foreground tabular-nums", className);
|
|
74
|
-
$[2] = className;
|
|
75
|
-
$[3] = t3;
|
|
76
|
-
} else {
|
|
77
|
-
t3 = $[3];
|
|
78
|
-
}
|
|
79
|
-
let t4;
|
|
80
|
-
if ($[4] !== totals.costMicroUsd) {
|
|
81
|
-
t4 = formatMicroUsd(totals.costMicroUsd);
|
|
82
|
-
$[4] = totals.costMicroUsd;
|
|
83
|
-
$[5] = t4;
|
|
84
|
-
} else {
|
|
85
|
-
t4 = $[5];
|
|
86
|
-
}
|
|
87
|
-
let t5;
|
|
88
|
-
if ($[6] !== t4) {
|
|
89
|
-
t5 = /*#__PURE__*/_jsx("span", {
|
|
24
|
+
function CompactCost({
|
|
25
|
+
attempts,
|
|
26
|
+
totals,
|
|
27
|
+
className
|
|
28
|
+
}) {
|
|
29
|
+
const model = modelsOf(attempts);
|
|
30
|
+
return /*#__PURE__*/_jsxs("span", {
|
|
31
|
+
"data-slot": "cost",
|
|
32
|
+
"data-variant": "compact",
|
|
33
|
+
"data-failed": totals.failedAttempts > 0 || undefined,
|
|
34
|
+
className: cn("inline-flex flex-wrap items-baseline gap-x-3 gap-y-0.5 font-mono text-[11px] text-muted-foreground tabular-nums", className),
|
|
35
|
+
children: [/*#__PURE__*/_jsx("span", {
|
|
90
36
|
className: "font-medium text-foreground",
|
|
91
|
-
children:
|
|
92
|
-
})
|
|
93
|
-
$[6] = t4;
|
|
94
|
-
$[7] = t5;
|
|
95
|
-
} else {
|
|
96
|
-
t5 = $[7];
|
|
97
|
-
}
|
|
98
|
-
let t6;
|
|
99
|
-
if ($[8] !== totals.inputTokens) {
|
|
100
|
-
t6 = formatCount(totals.inputTokens);
|
|
101
|
-
$[8] = totals.inputTokens;
|
|
102
|
-
$[9] = t6;
|
|
103
|
-
} else {
|
|
104
|
-
t6 = $[9];
|
|
105
|
-
}
|
|
106
|
-
let t7;
|
|
107
|
-
if ($[10] !== totals.outputTokens) {
|
|
108
|
-
t7 = formatCount(totals.outputTokens);
|
|
109
|
-
$[10] = totals.outputTokens;
|
|
110
|
-
$[11] = t7;
|
|
111
|
-
} else {
|
|
112
|
-
t7 = $[11];
|
|
113
|
-
}
|
|
114
|
-
let t8;
|
|
115
|
-
if ($[12] !== t6 || $[13] !== t7) {
|
|
116
|
-
t8 = /*#__PURE__*/_jsxs("span", {
|
|
37
|
+
children: formatMicroUsd(totals.costMicroUsd)
|
|
38
|
+
}), /*#__PURE__*/_jsxs("span", {
|
|
117
39
|
className: "whitespace-nowrap",
|
|
118
|
-
children: [
|
|
119
|
-
})
|
|
120
|
-
$[12] = t6;
|
|
121
|
-
$[13] = t7;
|
|
122
|
-
$[14] = t8;
|
|
123
|
-
} else {
|
|
124
|
-
t8 = $[14];
|
|
125
|
-
}
|
|
126
|
-
let t9;
|
|
127
|
-
if ($[15] !== model) {
|
|
128
|
-
t9 = model && /*#__PURE__*/_jsx("span", {
|
|
40
|
+
children: [formatCount(totals.inputTokens), " in \xB7 ", formatCount(totals.outputTokens), " out"]
|
|
41
|
+
}), model && /*#__PURE__*/_jsx("span", {
|
|
129
42
|
children: model
|
|
130
|
-
})
|
|
131
|
-
$[15] = model;
|
|
132
|
-
$[16] = t9;
|
|
133
|
-
} else {
|
|
134
|
-
t9 = $[16];
|
|
135
|
-
}
|
|
136
|
-
let t10;
|
|
137
|
-
if ($[17] !== totals) {
|
|
138
|
-
t10 = /*#__PURE__*/_jsx(WastedNote, {
|
|
43
|
+
}), /*#__PURE__*/_jsx(WastedNote, {
|
|
139
44
|
totals: totals
|
|
140
|
-
})
|
|
141
|
-
|
|
142
|
-
$[18] = t10;
|
|
143
|
-
} else {
|
|
144
|
-
t10 = $[18];
|
|
145
|
-
}
|
|
146
|
-
let t11;
|
|
147
|
-
if ($[19] !== t10 || $[20] !== t2 || $[21] !== t3 || $[22] !== t5 || $[23] !== t8 || $[24] !== t9) {
|
|
148
|
-
t11 = /*#__PURE__*/_jsxs("span", {
|
|
149
|
-
"data-slot": "cost",
|
|
150
|
-
"data-variant": "compact",
|
|
151
|
-
"data-failed": t2,
|
|
152
|
-
className: t3,
|
|
153
|
-
children: [t5, t8, t9, t10]
|
|
154
|
-
});
|
|
155
|
-
$[19] = t10;
|
|
156
|
-
$[20] = t2;
|
|
157
|
-
$[21] = t3;
|
|
158
|
-
$[22] = t5;
|
|
159
|
-
$[23] = t8;
|
|
160
|
-
$[24] = t9;
|
|
161
|
-
$[25] = t11;
|
|
162
|
-
} else {
|
|
163
|
-
t11 = $[25];
|
|
164
|
-
}
|
|
165
|
-
return t11;
|
|
45
|
+
})]
|
|
46
|
+
});
|
|
166
47
|
}
|
|
167
|
-
function AttemptRow(
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
if ($[0] !== t2) {
|
|
177
|
-
t3 = /*#__PURE__*/_jsxs("span", {
|
|
178
|
-
className: "eyebrow",
|
|
179
|
-
children: ["#", t2]
|
|
180
|
-
});
|
|
181
|
-
$[0] = t2;
|
|
182
|
-
$[1] = t3;
|
|
183
|
-
} else {
|
|
184
|
-
t3 = $[1];
|
|
185
|
-
}
|
|
186
|
-
const t4 = attempt.failed && "text-muted-foreground";
|
|
187
|
-
let t5;
|
|
188
|
-
if ($[2] !== t4) {
|
|
189
|
-
t5 = cn("truncate", t4);
|
|
190
|
-
$[2] = t4;
|
|
191
|
-
$[3] = t5;
|
|
192
|
-
} else {
|
|
193
|
-
t5 = $[3];
|
|
194
|
-
}
|
|
195
|
-
const t6 = attempt.model ?? "Attempt";
|
|
196
|
-
let t7;
|
|
197
|
-
if ($[4] !== t5 || $[5] !== t6) {
|
|
198
|
-
t7 = /*#__PURE__*/_jsx("span", {
|
|
199
|
-
className: t5,
|
|
200
|
-
children: t6
|
|
201
|
-
});
|
|
202
|
-
$[4] = t5;
|
|
203
|
-
$[5] = t6;
|
|
204
|
-
$[6] = t7;
|
|
205
|
-
} else {
|
|
206
|
-
t7 = $[6];
|
|
207
|
-
}
|
|
208
|
-
let t8;
|
|
209
|
-
if ($[7] !== attempt.failed) {
|
|
210
|
-
t8 = attempt.failed && /*#__PURE__*/_jsx("span", {
|
|
211
|
-
className: "font-mono text-[11px] tracking-wide text-destructive uppercase",
|
|
212
|
-
children: "Failed"
|
|
213
|
-
});
|
|
214
|
-
$[7] = attempt.failed;
|
|
215
|
-
$[8] = t8;
|
|
216
|
-
} else {
|
|
217
|
-
t8 = $[8];
|
|
218
|
-
}
|
|
219
|
-
let t9;
|
|
220
|
-
if ($[9] !== t3 || $[10] !== t7 || $[11] !== t8) {
|
|
221
|
-
t9 = /*#__PURE__*/_jsxs("span", {
|
|
48
|
+
function AttemptRow({
|
|
49
|
+
attempt,
|
|
50
|
+
position
|
|
51
|
+
}) {
|
|
52
|
+
return /*#__PURE__*/_jsxs("li", {
|
|
53
|
+
"data-slot": "cost-attempt",
|
|
54
|
+
"data-failed": attempt.failed || undefined,
|
|
55
|
+
className: "grid grid-cols-[1fr_auto_4.5rem] items-baseline gap-x-4 px-5 py-2.5 text-sm tabular-nums",
|
|
56
|
+
children: [/*#__PURE__*/_jsxs("span", {
|
|
222
57
|
className: "flex min-w-0 items-baseline gap-2",
|
|
223
|
-
children: [
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
t10 = formatCount(attempt.inputTokens);
|
|
235
|
-
$[13] = attempt.inputTokens;
|
|
236
|
-
$[14] = t10;
|
|
237
|
-
} else {
|
|
238
|
-
t10 = $[14];
|
|
239
|
-
}
|
|
240
|
-
let t11;
|
|
241
|
-
if ($[15] !== attempt.outputTokens) {
|
|
242
|
-
t11 = formatCount(attempt.outputTokens);
|
|
243
|
-
$[15] = attempt.outputTokens;
|
|
244
|
-
$[16] = t11;
|
|
245
|
-
} else {
|
|
246
|
-
t11 = $[16];
|
|
247
|
-
}
|
|
248
|
-
let t12;
|
|
249
|
-
if ($[17] !== t10 || $[18] !== t11) {
|
|
250
|
-
t12 = /*#__PURE__*/_jsxs("span", {
|
|
58
|
+
children: [/*#__PURE__*/_jsxs("span", {
|
|
59
|
+
className: "locus-eyebrow",
|
|
60
|
+
children: ["#", position + 1]
|
|
61
|
+
}), /*#__PURE__*/_jsx("span", {
|
|
62
|
+
className: cn("truncate", attempt.failed && "text-muted-foreground"),
|
|
63
|
+
children: attempt.model ?? "Attempt"
|
|
64
|
+
}), attempt.failed && /*#__PURE__*/_jsx("span", {
|
|
65
|
+
className: "font-mono text-[11px] tracking-wide text-destructive uppercase",
|
|
66
|
+
children: "Failed"
|
|
67
|
+
})]
|
|
68
|
+
}), /*#__PURE__*/_jsxs("span", {
|
|
251
69
|
className: "font-mono text-[11px] text-muted-foreground max-sm:hidden",
|
|
252
|
-
children: [
|
|
253
|
-
})
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
}
|
|
258
|
-
t12 = $[19];
|
|
259
|
-
}
|
|
260
|
-
const t13 = attempt.failed && "text-muted-foreground line-through";
|
|
261
|
-
let t14;
|
|
262
|
-
if ($[20] !== t13) {
|
|
263
|
-
t14 = cn("text-right font-mono text-xs", t13);
|
|
264
|
-
$[20] = t13;
|
|
265
|
-
$[21] = t14;
|
|
266
|
-
} else {
|
|
267
|
-
t14 = $[21];
|
|
268
|
-
}
|
|
269
|
-
let t15;
|
|
270
|
-
if ($[22] !== attempt.costMicroUsd) {
|
|
271
|
-
t15 = formatMicroUsd(attempt.costMicroUsd);
|
|
272
|
-
$[22] = attempt.costMicroUsd;
|
|
273
|
-
$[23] = t15;
|
|
274
|
-
} else {
|
|
275
|
-
t15 = $[23];
|
|
276
|
-
}
|
|
277
|
-
let t16;
|
|
278
|
-
if ($[24] !== t14 || $[25] !== t15) {
|
|
279
|
-
t16 = /*#__PURE__*/_jsx("span", {
|
|
280
|
-
className: t14,
|
|
281
|
-
children: t15
|
|
282
|
-
});
|
|
283
|
-
$[24] = t14;
|
|
284
|
-
$[25] = t15;
|
|
285
|
-
$[26] = t16;
|
|
286
|
-
} else {
|
|
287
|
-
t16 = $[26];
|
|
288
|
-
}
|
|
289
|
-
let t17;
|
|
290
|
-
if ($[27] !== t1 || $[28] !== t12 || $[29] !== t16 || $[30] !== t9) {
|
|
291
|
-
t17 = /*#__PURE__*/_jsxs("li", {
|
|
292
|
-
"data-slot": "cost-attempt",
|
|
293
|
-
"data-failed": t1,
|
|
294
|
-
className: "grid grid-cols-[1fr_auto_4.5rem] items-baseline gap-x-4 px-5 py-2.5 text-sm tabular-nums",
|
|
295
|
-
children: [t9, t12, t16]
|
|
296
|
-
});
|
|
297
|
-
$[27] = t1;
|
|
298
|
-
$[28] = t12;
|
|
299
|
-
$[29] = t16;
|
|
300
|
-
$[30] = t9;
|
|
301
|
-
$[31] = t17;
|
|
302
|
-
} else {
|
|
303
|
-
t17 = $[31];
|
|
304
|
-
}
|
|
305
|
-
return t17;
|
|
70
|
+
children: [formatCount(attempt.inputTokens), " in \xB7 ", formatCount(attempt.outputTokens), " out"]
|
|
71
|
+
}), /*#__PURE__*/_jsx("span", {
|
|
72
|
+
className: cn("text-right font-mono text-xs", attempt.failed && "text-muted-foreground line-through"),
|
|
73
|
+
children: formatMicroUsd(attempt.costMicroUsd)
|
|
74
|
+
})]
|
|
75
|
+
});
|
|
306
76
|
}
|
|
307
|
-
function DetailedCost(
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
className
|
|
314
|
-
} = t0;
|
|
77
|
+
function DetailedCost({
|
|
78
|
+
attempts,
|
|
79
|
+
totals,
|
|
80
|
+
label,
|
|
81
|
+
className
|
|
82
|
+
}) {
|
|
315
83
|
const failed = totals.failedAttempts > 0;
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
let t3;
|
|
327
|
-
if ($[1] !== attempts.length) {
|
|
328
|
-
t3 = pluralize(attempts.length, "attempt");
|
|
329
|
-
$[1] = attempts.length;
|
|
330
|
-
$[2] = t3;
|
|
331
|
-
} else {
|
|
332
|
-
t3 = $[2];
|
|
333
|
-
}
|
|
334
|
-
let t4;
|
|
335
|
-
if ($[3] !== label || $[4] !== t3) {
|
|
336
|
-
t4 = /*#__PURE__*/_jsx(PanelHeader, {
|
|
337
|
-
icon: t2,
|
|
84
|
+
return /*#__PURE__*/_jsxs(ApprovalPanel, {
|
|
85
|
+
"data-slot": "cost",
|
|
86
|
+
"data-variant": "detailed",
|
|
87
|
+
"data-failed": failed || undefined,
|
|
88
|
+
"aria-label": label,
|
|
89
|
+
className: className,
|
|
90
|
+
children: [/*#__PURE__*/_jsx(PanelHeader, {
|
|
91
|
+
icon: /*#__PURE__*/_jsx(CoinsIcon, {
|
|
92
|
+
"aria-hidden": true
|
|
93
|
+
}),
|
|
338
94
|
eyebrow: label,
|
|
339
|
-
aside:
|
|
340
|
-
})
|
|
341
|
-
$[3] = label;
|
|
342
|
-
$[4] = t3;
|
|
343
|
-
$[5] = t4;
|
|
344
|
-
} else {
|
|
345
|
-
t4 = $[5];
|
|
346
|
-
}
|
|
347
|
-
let t5;
|
|
348
|
-
if ($[6] !== totals.costMicroUsd) {
|
|
349
|
-
t5 = formatMicroUsd(totals.costMicroUsd);
|
|
350
|
-
$[6] = totals.costMicroUsd;
|
|
351
|
-
$[7] = t5;
|
|
352
|
-
} else {
|
|
353
|
-
t5 = $[7];
|
|
354
|
-
}
|
|
355
|
-
let t6;
|
|
356
|
-
if ($[8] !== t5) {
|
|
357
|
-
t6 = /*#__PURE__*/_jsx("span", {
|
|
358
|
-
className: "text-2xl font-semibold tracking-tight tabular-nums",
|
|
359
|
-
children: t5
|
|
360
|
-
});
|
|
361
|
-
$[8] = t5;
|
|
362
|
-
$[9] = t6;
|
|
363
|
-
} else {
|
|
364
|
-
t6 = $[9];
|
|
365
|
-
}
|
|
366
|
-
let t7;
|
|
367
|
-
if ($[10] !== totals.inputTokens) {
|
|
368
|
-
t7 = formatCount(totals.inputTokens);
|
|
369
|
-
$[10] = totals.inputTokens;
|
|
370
|
-
$[11] = t7;
|
|
371
|
-
} else {
|
|
372
|
-
t7 = $[11];
|
|
373
|
-
}
|
|
374
|
-
let t8;
|
|
375
|
-
if ($[12] !== totals.outputTokens) {
|
|
376
|
-
t8 = formatCount(totals.outputTokens);
|
|
377
|
-
$[12] = totals.outputTokens;
|
|
378
|
-
$[13] = t8;
|
|
379
|
-
} else {
|
|
380
|
-
t8 = $[13];
|
|
381
|
-
}
|
|
382
|
-
let t9;
|
|
383
|
-
if ($[14] !== t7 || $[15] !== t8) {
|
|
384
|
-
t9 = /*#__PURE__*/_jsxs("span", {
|
|
385
|
-
children: [t7, " in \xB7 ", t8, " out"]
|
|
386
|
-
});
|
|
387
|
-
$[14] = t7;
|
|
388
|
-
$[15] = t8;
|
|
389
|
-
$[16] = t9;
|
|
390
|
-
} else {
|
|
391
|
-
t9 = $[16];
|
|
392
|
-
}
|
|
393
|
-
let t10;
|
|
394
|
-
if ($[17] !== totals) {
|
|
395
|
-
t10 = /*#__PURE__*/_jsx(WastedNote, {
|
|
396
|
-
totals: totals
|
|
397
|
-
});
|
|
398
|
-
$[17] = totals;
|
|
399
|
-
$[18] = t10;
|
|
400
|
-
} else {
|
|
401
|
-
t10 = $[18];
|
|
402
|
-
}
|
|
403
|
-
let t11;
|
|
404
|
-
if ($[19] !== t10 || $[20] !== t9) {
|
|
405
|
-
t11 = /*#__PURE__*/_jsxs("span", {
|
|
406
|
-
className: "flex flex-wrap gap-x-3 gap-y-0.5 text-xs text-muted-foreground tabular-nums",
|
|
407
|
-
children: [t9, t10]
|
|
408
|
-
});
|
|
409
|
-
$[19] = t10;
|
|
410
|
-
$[20] = t9;
|
|
411
|
-
$[21] = t11;
|
|
412
|
-
} else {
|
|
413
|
-
t11 = $[21];
|
|
414
|
-
}
|
|
415
|
-
let t12;
|
|
416
|
-
if ($[22] !== t11 || $[23] !== t6) {
|
|
417
|
-
t12 = /*#__PURE__*/_jsxs("div", {
|
|
95
|
+
aside: pluralize(attempts.length, "attempt")
|
|
96
|
+
}), /*#__PURE__*/_jsxs("div", {
|
|
418
97
|
className: "flex flex-col gap-1 px-5 pt-2 pb-4",
|
|
419
|
-
children: [
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
$[26] = t13;
|
|
432
|
-
} else {
|
|
433
|
-
t13 = $[26];
|
|
434
|
-
}
|
|
435
|
-
let t14;
|
|
436
|
-
if ($[27] !== t13) {
|
|
437
|
-
t14 = /*#__PURE__*/_jsx("ol", {
|
|
98
|
+
children: [/*#__PURE__*/_jsx("span", {
|
|
99
|
+
className: "text-2xl font-semibold tracking-tight tabular-nums",
|
|
100
|
+
children: formatMicroUsd(totals.costMicroUsd)
|
|
101
|
+
}), /*#__PURE__*/_jsxs("span", {
|
|
102
|
+
className: "flex flex-wrap gap-x-3 gap-y-0.5 text-xs text-muted-foreground tabular-nums",
|
|
103
|
+
children: [/*#__PURE__*/_jsxs("span", {
|
|
104
|
+
children: [formatCount(totals.inputTokens), " in \xB7 ", formatCount(totals.outputTokens), " out"]
|
|
105
|
+
}), /*#__PURE__*/_jsx(WastedNote, {
|
|
106
|
+
totals: totals
|
|
107
|
+
})]
|
|
108
|
+
})]
|
|
109
|
+
}), /*#__PURE__*/_jsx("ol", {
|
|
438
110
|
className: "flex flex-col divide-y divide-border border-t border-border",
|
|
439
|
-
children:
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
t15 = /*#__PURE__*/_jsxs(ApprovalPanel, {
|
|
449
|
-
"data-slot": "cost",
|
|
450
|
-
"data-variant": "detailed",
|
|
451
|
-
"data-failed": t1,
|
|
452
|
-
"aria-label": label,
|
|
453
|
-
className: className,
|
|
454
|
-
children: [t4, t12, t14]
|
|
455
|
-
});
|
|
456
|
-
$[29] = className;
|
|
457
|
-
$[30] = label;
|
|
458
|
-
$[31] = t1;
|
|
459
|
-
$[32] = t12;
|
|
460
|
-
$[33] = t14;
|
|
461
|
-
$[34] = t4;
|
|
462
|
-
$[35] = t15;
|
|
463
|
-
} else {
|
|
464
|
-
t15 = $[35];
|
|
465
|
-
}
|
|
466
|
-
return t15;
|
|
467
|
-
}
|
|
468
|
-
function _temp(attempt, position) {
|
|
469
|
-
return /*#__PURE__*/_jsx(AttemptRow, {
|
|
470
|
-
attempt: attempt,
|
|
471
|
-
position: position
|
|
472
|
-
}, position);
|
|
111
|
+
children: attempts.map((attempt, position) =>
|
|
112
|
+
/*#__PURE__*/
|
|
113
|
+
// biome-ignore lint/suspicious/noArrayIndexKey: attempts carry no id and keep their order
|
|
114
|
+
_jsx(AttemptRow, {
|
|
115
|
+
attempt: attempt,
|
|
116
|
+
position: position
|
|
117
|
+
}, position))
|
|
118
|
+
})]
|
|
119
|
+
});
|
|
473
120
|
}
|
|
474
|
-
export function Cost(
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
const variant = t1 === undefined ? "compact" : t1;
|
|
483
|
-
const label = t2 === undefined ? "Run cost" : t2;
|
|
484
|
-
let attempts;
|
|
485
|
-
let t3;
|
|
486
|
-
if ($[0] !== usage) {
|
|
487
|
-
attempts = attemptsOf(usage);
|
|
488
|
-
t3 = sumUsage(attempts);
|
|
489
|
-
$[0] = usage;
|
|
490
|
-
$[1] = attempts;
|
|
491
|
-
$[2] = t3;
|
|
492
|
-
} else {
|
|
493
|
-
attempts = $[1];
|
|
494
|
-
t3 = $[2];
|
|
495
|
-
}
|
|
496
|
-
const totals = t3;
|
|
121
|
+
export function Cost({
|
|
122
|
+
usage,
|
|
123
|
+
variant = "compact",
|
|
124
|
+
label = "Run cost",
|
|
125
|
+
className
|
|
126
|
+
}) {
|
|
127
|
+
const attempts = attemptsOf(usage);
|
|
128
|
+
const totals = sumUsage(attempts);
|
|
497
129
|
if (variant === "detailed") {
|
|
498
|
-
|
|
499
|
-
if ($[3] !== attempts || $[4] !== className || $[5] !== label || $[6] !== totals) {
|
|
500
|
-
t4 = /*#__PURE__*/_jsx(DetailedCost, {
|
|
501
|
-
attempts: attempts,
|
|
502
|
-
totals: totals,
|
|
503
|
-
label: label,
|
|
504
|
-
className: className
|
|
505
|
-
});
|
|
506
|
-
$[3] = attempts;
|
|
507
|
-
$[4] = className;
|
|
508
|
-
$[5] = label;
|
|
509
|
-
$[6] = totals;
|
|
510
|
-
$[7] = t4;
|
|
511
|
-
} else {
|
|
512
|
-
t4 = $[7];
|
|
513
|
-
}
|
|
514
|
-
return t4;
|
|
515
|
-
}
|
|
516
|
-
let t4;
|
|
517
|
-
if ($[8] !== attempts || $[9] !== className || $[10] !== totals) {
|
|
518
|
-
t4 = /*#__PURE__*/_jsx(CompactCost, {
|
|
130
|
+
return /*#__PURE__*/_jsx(DetailedCost, {
|
|
519
131
|
attempts: attempts,
|
|
520
132
|
totals: totals,
|
|
133
|
+
label: label,
|
|
521
134
|
className: className
|
|
522
135
|
});
|
|
523
|
-
$[8] = attempts;
|
|
524
|
-
$[9] = className;
|
|
525
|
-
$[10] = totals;
|
|
526
|
-
$[11] = t4;
|
|
527
|
-
} else {
|
|
528
|
-
t4 = $[11];
|
|
529
136
|
}
|
|
530
|
-
return
|
|
137
|
+
return /*#__PURE__*/_jsx(CompactCost, {
|
|
138
|
+
attempts: attempts,
|
|
139
|
+
totals: totals,
|
|
140
|
+
className: className
|
|
141
|
+
});
|
|
531
142
|
}
|