@locusgraph/loop 0.1.0 → 0.2.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/README.md +2 -0
- package/dist/agent/pulse/gradient-label.js +86 -15
- package/dist/agent/pulse/marks/bars-mark.js +46 -10
- package/dist/agent/pulse/marks/glyph-mark.js +56 -11
- package/dist/agent/pulse/marks/locus-mark.js +63 -28
- package/dist/agent/pulse/marks/orb-mark.js +31 -8
- package/dist/agent/pulse/marks/spinner-mark.js +29 -1
- package/dist/agent/pulse/pulse.js +150 -35
- package/dist/agent/pulse/use-loop-animation.js +36 -17
- package/dist/agent/steps/step-icon.js +110 -24
- package/dist/agent/steps/steps.js +235 -25
- package/dist/agent/thinking/thinking.js +203 -23
- package/dist/agent/thinking/thought-duration.js +7 -9
- package/dist/agent/tool/json-block.js +38 -11
- package/dist/agent/tool/tool-status.js +51 -18
- package/dist/agent/tool/tool.js +184 -6
- package/dist/approval/inbox/inbox-row.d.ts +3 -2
- package/dist/approval/inbox/inbox-row.js +321 -7
- package/dist/approval/inbox/inbox-selection.js +7 -13
- package/dist/approval/inbox/inbox.d.ts +2 -1
- package/dist/approval/inbox/inbox.js +250 -18
- package/dist/approval/inbox/virtual-inbox-list.d.ts +13 -0
- package/dist/approval/inbox/virtual-inbox-list.js +129 -0
- package/dist/approval/memory/memory-choices.js +27 -22
- package/dist/approval/memory/memory-review.js +242 -17
- package/dist/approval/memory/memory-row.js +215 -19
- package/dist/approval/plan/plan-review.js +279 -28
- package/dist/approval/plan/plan-step-row.js +194 -43
- package/dist/approval/plan/plan-steps.js +24 -23
- package/dist/approval/plan/question-choices.js +158 -39
- package/dist/approval/plan/question.d.ts +1 -1
- package/dist/approval/plan/question.js +223 -26
- package/dist/approval/run/run-bar.js +178 -22
- package/dist/approval/shared/decision-line.js +1 -1
- package/dist/approval/shared/risk-badge.js +47 -16
- package/dist/approval/shared/time.js +5 -8
- package/dist/approval/shared/use-focus-on-mount.js +23 -6
- package/dist/approval/spend/raise-cap-form.js +235 -17
- package/dist/approval/spend/spend-gate.js +239 -21
- package/dist/approval/spend/spend-math.js +7 -8
- package/dist/approval/spend/spend-meter.js +362 -34
- package/dist/approval/tool/approval.js +272 -27
- package/dist/approval/tool/args/args-editor.js +262 -26
- package/dist/approval/tool/args/args-field.js +259 -19
- package/dist/approval/tool/args/args-validation.js +38 -47
- package/dist/approval/tool/deny-form.js +130 -10
- package/dist/approval/tool/tool-inputs.js +127 -38
- package/dist/chat/chat/chat-item-spacing.d.ts +3 -0
- package/dist/chat/chat/chat-item-spacing.js +19 -0
- package/dist/chat/chat/chat.d.ts +2 -1
- package/dist/chat/chat/chat.js +181 -5
- package/dist/chat/chat/use-stick-to-bottom.js +123 -47
- package/dist/chat/chat/virtual-chat-items.d.ts +8 -0
- package/dist/chat/chat/virtual-chat-items.js +153 -0
- package/dist/chat/composer/composer-actions.js +151 -16
- package/dist/chat/composer/composer.js +330 -32
- package/dist/chat/composer/use-auto-grow.js +24 -9
- package/dist/chat/files/file-meta.js +19 -19
- package/dist/chat/files/files.js +316 -28
- package/dist/chat/reply/fenced-code.js +45 -21
- package/dist/chat/reply/markdown-components.js +137 -17
- package/dist/chat/reply/reply.js +105 -10
- package/dist/chat/turn/group-parts.js +43 -29
- package/dist/chat/turn/turn.js +238 -30
- package/dist/cost/context.js +321 -23
- package/dist/cost/cost-steps.js +220 -14
- package/dist/cost/cost.js +521 -27
- package/dist/cost/model-picker.js +181 -6
- package/dist/cost/shared/context-breakdown.js +299 -10
- package/dist/cost/shared/meter-marks.js +107 -9
- package/dist/cost/shared/model-option-row.js +178 -21
- package/dist/cost/shared/step-cost-row.js +248 -20
- package/dist/cost/shared/usage-totals.js +22 -18
- package/dist/memory/cite.js +182 -11
- package/dist/memory/memorized.js +217 -11
- package/dist/memory/recall.js +296 -17
- package/dist/memory/shared/host-label.js +19 -22
- package/dist/memory/shared/source-mark.js +39 -3
- package/dist/memory/sources.js +255 -13
- package/dist/shared/decision-summary.js +133 -14
- package/dist/shared/panel-empty.js +78 -3
- package/dist/shared/panel.js +243 -13
- package/dist/shared/status-dot.js +38 -8
- package/dist/shared/virtual/use-list-virtualizer.d.ts +24 -0
- package/dist/shared/virtual/use-list-virtualizer.js +68 -0
- package/dist/thread/actions/action-button.js +65 -3
- package/dist/thread/actions/actions.js +184 -13
- package/dist/thread/actions/branch-switcher.js +102 -5
- package/dist/thread/canvas/canvas.js +205 -5
- package/dist/thread/canvas/version-switcher.js +149 -8
- package/dist/thread/code/code.js +186 -24
- package/dist/thread/code/copy-code-button.js +61 -13
- package/dist/thread/code/highlight.js +30 -29
- package/dist/thread/history/history-rows.d.ts +16 -0
- package/dist/thread/history/history-rows.js +23 -0
- package/dist/thread/history/history.d.ts +3 -2
- package/dist/thread/history/history.js +174 -5
- package/dist/thread/history/{history-row.d.ts → row/history-row.d.ts} +3 -2
- package/dist/thread/history/row/history-row.js +137 -0
- package/dist/thread/history/row/thread-item-menu.js +84 -0
- package/dist/thread/history/row/thread-title-editor.js +81 -0
- package/dist/thread/history/thread-groups.d.ts +1 -1
- package/dist/thread/history/thread-groups.js +40 -34
- package/dist/thread/history/virtual-history-list.d.ts +11 -0
- package/dist/thread/history/virtual-history-list.js +107 -0
- package/dist/thread/index.d.ts +1 -1
- package/dist/thread/starters/starters.js +92 -7
- package/dist/thread/use-copied.js +45 -15
- package/dist/types.js +1 -1
- package/package.json +6 -4
- package/dist/thread/history/history-row.js +0 -17
- package/dist/thread/history/thread-item-menu.js +0 -6
- package/dist/thread/history/thread-title-editor.js +0 -25
- /package/dist/thread/history/{thread-item-menu.d.ts → row/thread-item-menu.d.ts} +0 -0
- /package/dist/thread/history/{thread-title-editor.d.ts → row/thread-title-editor.d.ts} +0 -0
|
@@ -1,32 +1,189 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { c as _c } from "react/compiler-runtime";
|
|
2
2
|
import { Checkmark as CheckIcon } from "@carbon/icons-react";
|
|
3
3
|
import { DropdownMenuRadioItem } from "@locusgraph/components";
|
|
4
4
|
import { formatMicroUsd } from "@locusgraph/utils";
|
|
5
5
|
import { formatTokensShort } from "./usage-totals.js";
|
|
6
|
-
|
|
6
|
+
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
7
|
+
const speedLabel = {
|
|
8
|
+
fast: "Fast",
|
|
9
|
+
balanced: "Balanced",
|
|
10
|
+
deep: "Deep"
|
|
11
|
+
};
|
|
7
12
|
export function modelPriceLabel(model) {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
if (input === undefined)
|
|
15
|
-
return `${formatMicroUsd(output)} / 1M out`;
|
|
16
|
-
return `${formatMicroUsd(input)} in · ${formatMicroUsd(output)} out / 1M`;
|
|
13
|
+
const input = model.inputPerMillionMicroUsd;
|
|
14
|
+
const output = model.outputPerMillionMicroUsd;
|
|
15
|
+
if (input === undefined && output === undefined) return undefined;
|
|
16
|
+
if (output === undefined) return `${formatMicroUsd(input ?? 0)} / 1M in`;
|
|
17
|
+
if (input === undefined) return `${formatMicroUsd(output)} / 1M out`;
|
|
18
|
+
return `${formatMicroUsd(input)} in · ${formatMicroUsd(output)} out / 1M`;
|
|
17
19
|
}
|
|
18
20
|
function modelFacts(model) {
|
|
19
|
-
|
|
20
|
-
model.speed && speedLabel[model.speed],
|
|
21
|
-
model.contextTokens !== undefined && `${formatTokensShort(model.contextTokens)} context`,
|
|
22
|
-
].filter((fact) => typeof fact === "string");
|
|
21
|
+
return [model.speed && speedLabel[model.speed], model.contextTokens !== undefined && `${formatTokensShort(model.contextTokens)} context`].filter(fact => typeof fact === "string");
|
|
23
22
|
}
|
|
24
|
-
function PriceColumn(
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
23
|
+
function PriceColumn(t0) {
|
|
24
|
+
const $ = _c(7);
|
|
25
|
+
const {
|
|
26
|
+
model
|
|
27
|
+
} = t0;
|
|
28
|
+
const input = model.inputPerMillionMicroUsd;
|
|
29
|
+
const output = model.outputPerMillionMicroUsd;
|
|
30
|
+
let t1;
|
|
31
|
+
if ($[0] !== input) {
|
|
32
|
+
t1 = input !== undefined && /*#__PURE__*/_jsxs("span", {
|
|
33
|
+
children: [formatMicroUsd(input), " in"]
|
|
34
|
+
});
|
|
35
|
+
$[0] = input;
|
|
36
|
+
$[1] = t1;
|
|
37
|
+
} else {
|
|
38
|
+
t1 = $[1];
|
|
39
|
+
}
|
|
40
|
+
let t2;
|
|
41
|
+
if ($[2] !== output) {
|
|
42
|
+
t2 = output !== undefined && /*#__PURE__*/_jsxs("span", {
|
|
43
|
+
children: [formatMicroUsd(output), " out"]
|
|
44
|
+
});
|
|
45
|
+
$[2] = output;
|
|
46
|
+
$[3] = t2;
|
|
47
|
+
} else {
|
|
48
|
+
t2 = $[3];
|
|
49
|
+
}
|
|
50
|
+
let t3;
|
|
51
|
+
if ($[4] !== t1 || $[5] !== t2) {
|
|
52
|
+
t3 = /*#__PURE__*/_jsxs("span", {
|
|
53
|
+
className: "flex flex-col items-end font-mono text-[11px] text-muted-foreground tabular-nums",
|
|
54
|
+
children: [t1, t2]
|
|
55
|
+
});
|
|
56
|
+
$[4] = t1;
|
|
57
|
+
$[5] = t2;
|
|
58
|
+
$[6] = t3;
|
|
59
|
+
} else {
|
|
60
|
+
t3 = $[6];
|
|
61
|
+
}
|
|
62
|
+
return t3;
|
|
28
63
|
}
|
|
29
|
-
export function ModelOptionRow(
|
|
64
|
+
export function ModelOptionRow(t0) {
|
|
65
|
+
const $ = _c(29);
|
|
66
|
+
const {
|
|
67
|
+
model
|
|
68
|
+
} = t0;
|
|
69
|
+
let T0;
|
|
70
|
+
let t1;
|
|
71
|
+
let t2;
|
|
72
|
+
let t3;
|
|
73
|
+
let t4;
|
|
74
|
+
let t5;
|
|
75
|
+
let t6;
|
|
76
|
+
if ($[0] !== model) {
|
|
30
77
|
const facts = modelFacts(model);
|
|
31
|
-
|
|
78
|
+
T0 = DropdownMenuRadioItem;
|
|
79
|
+
t4 = model.id;
|
|
80
|
+
t5 = "model-picker-item";
|
|
81
|
+
t6 = "group grid grid-cols-[1fr_auto_1rem] items-center gap-x-3 rounded-none px-3 py-2.5 transition-colors duration-150 focus:bg-accent/50 data-[state=checked]:bg-accent motion-reduce:transition-none [&>span:first-child]:hidden";
|
|
82
|
+
t1 = "flex min-w-0 flex-col gap-0.5";
|
|
83
|
+
let t7;
|
|
84
|
+
if ($[8] !== model.name) {
|
|
85
|
+
t7 = /*#__PURE__*/_jsx("span", {
|
|
86
|
+
className: "truncate font-medium",
|
|
87
|
+
children: model.name
|
|
88
|
+
});
|
|
89
|
+
$[8] = model.name;
|
|
90
|
+
$[9] = t7;
|
|
91
|
+
} else {
|
|
92
|
+
t7 = $[9];
|
|
93
|
+
}
|
|
94
|
+
let t8;
|
|
95
|
+
if ($[10] !== model.provider) {
|
|
96
|
+
t8 = /*#__PURE__*/_jsx("span", {
|
|
97
|
+
className: "truncate text-xs text-muted-foreground",
|
|
98
|
+
children: model.provider
|
|
99
|
+
});
|
|
100
|
+
$[10] = model.provider;
|
|
101
|
+
$[11] = t8;
|
|
102
|
+
} else {
|
|
103
|
+
t8 = $[11];
|
|
104
|
+
}
|
|
105
|
+
if ($[12] !== t7 || $[13] !== t8) {
|
|
106
|
+
t2 = /*#__PURE__*/_jsxs("span", {
|
|
107
|
+
className: "flex items-baseline gap-2",
|
|
108
|
+
children: [t7, t8]
|
|
109
|
+
});
|
|
110
|
+
$[12] = t7;
|
|
111
|
+
$[13] = t8;
|
|
112
|
+
$[14] = t2;
|
|
113
|
+
} else {
|
|
114
|
+
t2 = $[14];
|
|
115
|
+
}
|
|
116
|
+
t3 = facts.length > 0 && /*#__PURE__*/_jsx("span", {
|
|
117
|
+
className: "font-mono text-[11px] text-muted-foreground tabular-nums",
|
|
118
|
+
children: facts.join(" \xB7 ")
|
|
119
|
+
});
|
|
120
|
+
$[0] = model;
|
|
121
|
+
$[1] = T0;
|
|
122
|
+
$[2] = t1;
|
|
123
|
+
$[3] = t2;
|
|
124
|
+
$[4] = t3;
|
|
125
|
+
$[5] = t4;
|
|
126
|
+
$[6] = t5;
|
|
127
|
+
$[7] = t6;
|
|
128
|
+
} else {
|
|
129
|
+
T0 = $[1];
|
|
130
|
+
t1 = $[2];
|
|
131
|
+
t2 = $[3];
|
|
132
|
+
t3 = $[4];
|
|
133
|
+
t4 = $[5];
|
|
134
|
+
t5 = $[6];
|
|
135
|
+
t6 = $[7];
|
|
136
|
+
}
|
|
137
|
+
let t7;
|
|
138
|
+
if ($[15] !== t1 || $[16] !== t2 || $[17] !== t3) {
|
|
139
|
+
t7 = /*#__PURE__*/_jsxs("span", {
|
|
140
|
+
className: t1,
|
|
141
|
+
children: [t2, t3]
|
|
142
|
+
});
|
|
143
|
+
$[15] = t1;
|
|
144
|
+
$[16] = t2;
|
|
145
|
+
$[17] = t3;
|
|
146
|
+
$[18] = t7;
|
|
147
|
+
} else {
|
|
148
|
+
t7 = $[18];
|
|
149
|
+
}
|
|
150
|
+
let t8;
|
|
151
|
+
if ($[19] !== model) {
|
|
152
|
+
t8 = /*#__PURE__*/_jsx(PriceColumn, {
|
|
153
|
+
model: model
|
|
154
|
+
});
|
|
155
|
+
$[19] = model;
|
|
156
|
+
$[20] = t8;
|
|
157
|
+
} else {
|
|
158
|
+
t8 = $[20];
|
|
159
|
+
}
|
|
160
|
+
let t9;
|
|
161
|
+
if ($[21] === Symbol.for("react.memo_cache_sentinel")) {
|
|
162
|
+
t9 = /*#__PURE__*/_jsx(CheckIcon, {
|
|
163
|
+
"aria-hidden": true,
|
|
164
|
+
className: "size-4 text-foreground opacity-0 group-data-[state=checked]:opacity-100"
|
|
165
|
+
});
|
|
166
|
+
$[21] = t9;
|
|
167
|
+
} else {
|
|
168
|
+
t9 = $[21];
|
|
169
|
+
}
|
|
170
|
+
let t10;
|
|
171
|
+
if ($[22] !== T0 || $[23] !== t4 || $[24] !== t5 || $[25] !== t6 || $[26] !== t7 || $[27] !== t8) {
|
|
172
|
+
t10 = /*#__PURE__*/_jsxs(T0, {
|
|
173
|
+
value: t4,
|
|
174
|
+
"data-slot": t5,
|
|
175
|
+
className: t6,
|
|
176
|
+
children: [t7, t8, t9]
|
|
177
|
+
});
|
|
178
|
+
$[22] = T0;
|
|
179
|
+
$[23] = t4;
|
|
180
|
+
$[24] = t5;
|
|
181
|
+
$[25] = t6;
|
|
182
|
+
$[26] = t7;
|
|
183
|
+
$[27] = t8;
|
|
184
|
+
$[28] = t10;
|
|
185
|
+
} else {
|
|
186
|
+
t10 = $[28];
|
|
187
|
+
}
|
|
188
|
+
return t10;
|
|
32
189
|
}
|
|
@@ -1,34 +1,262 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { c as _c } from "react/compiler-runtime";
|
|
2
2
|
import { cn } from "@locusgraph/components";
|
|
3
3
|
import { formatMicroUsd } from "@locusgraph/utils";
|
|
4
4
|
import { formatDuration } from "./usage-totals.js";
|
|
5
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
5
6
|
export function isWastedStep(step) {
|
|
6
|
-
|
|
7
|
+
return step.status === "failed" || step.usage.failed === true;
|
|
7
8
|
}
|
|
8
9
|
function barTone(step) {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
if (step.status === "running")
|
|
14
|
-
return "bg-warn/60 motion-safe:animate-pulse";
|
|
15
|
-
return "bg-primary/35";
|
|
10
|
+
if (isWastedStep(step)) return "bg-destructive";
|
|
11
|
+
if (step.status === "retried") return "bg-warn/40";
|
|
12
|
+
if (step.status === "running") return "bg-warn/60 motion-safe:animate-pulse";
|
|
13
|
+
return "bg-primary/35";
|
|
16
14
|
}
|
|
17
15
|
const statusMark = {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
16
|
+
failed: {
|
|
17
|
+
text: "Failed",
|
|
18
|
+
className: "text-destructive"
|
|
19
|
+
},
|
|
20
|
+
retried: {
|
|
21
|
+
text: "Retried",
|
|
22
|
+
className: "text-warn"
|
|
23
|
+
},
|
|
24
|
+
running: {
|
|
25
|
+
text: "Running",
|
|
26
|
+
className: "text-muted-foreground"
|
|
27
|
+
},
|
|
28
|
+
skipped: {
|
|
29
|
+
text: "Skipped",
|
|
30
|
+
className: "text-muted-foreground"
|
|
31
|
+
}
|
|
22
32
|
};
|
|
23
33
|
function barWidth(cost, maxCost) {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
return Math.max((cost / maxCost) * 100, cost > 0 ? 2 : 0);
|
|
34
|
+
if (maxCost <= 0) return 0;
|
|
35
|
+
return Math.max(cost / maxCost * 100, cost > 0 ? 2 : 0);
|
|
27
36
|
}
|
|
28
|
-
export function StepCostRow(
|
|
29
|
-
|
|
37
|
+
export function StepCostRow(t0) {
|
|
38
|
+
const $ = _c(59);
|
|
39
|
+
const {
|
|
40
|
+
step,
|
|
41
|
+
maxCost,
|
|
42
|
+
totalCost
|
|
43
|
+
} = t0;
|
|
44
|
+
const cost = step.usage.costMicroUsd;
|
|
45
|
+
let t1;
|
|
46
|
+
let t2;
|
|
47
|
+
let t3;
|
|
48
|
+
let t4;
|
|
49
|
+
let t5;
|
|
50
|
+
let t6;
|
|
51
|
+
let t7;
|
|
52
|
+
let t8;
|
|
53
|
+
let t9;
|
|
54
|
+
if ($[0] !== cost || $[1] !== maxCost || $[2] !== step || $[3] !== totalCost) {
|
|
30
55
|
const wasted = isWastedStep(step);
|
|
31
|
-
|
|
56
|
+
let t10;
|
|
57
|
+
if ($[13] !== cost || $[14] !== totalCost) {
|
|
58
|
+
t10 = totalCost > 0 ? Math.round(cost / totalCost * 100) : 0;
|
|
59
|
+
$[13] = cost;
|
|
60
|
+
$[14] = totalCost;
|
|
61
|
+
$[15] = t10;
|
|
62
|
+
} else {
|
|
63
|
+
t10 = $[15];
|
|
64
|
+
}
|
|
65
|
+
const share = t10;
|
|
32
66
|
const mark = wasted ? statusMark.failed : statusMark[step.status];
|
|
33
|
-
|
|
67
|
+
t2 = "step-cost-row";
|
|
68
|
+
t3 = step.status;
|
|
69
|
+
t4 = wasted || undefined;
|
|
70
|
+
const t11 = step.title;
|
|
71
|
+
let t12;
|
|
72
|
+
if ($[16] !== cost) {
|
|
73
|
+
t12 = formatMicroUsd(cost);
|
|
74
|
+
$[16] = cost;
|
|
75
|
+
$[17] = t12;
|
|
76
|
+
} else {
|
|
77
|
+
t12 = $[17];
|
|
78
|
+
}
|
|
79
|
+
let t13;
|
|
80
|
+
if ($[18] !== mark) {
|
|
81
|
+
t13 = mark ? `, ${mark.text.toLowerCase()}` : "";
|
|
82
|
+
$[18] = mark;
|
|
83
|
+
$[19] = t13;
|
|
84
|
+
} else {
|
|
85
|
+
t13 = $[19];
|
|
86
|
+
}
|
|
87
|
+
t5 = `${t11}: ${t12}, ${share}% of run${t13}`;
|
|
88
|
+
t6 = "grid grid-cols-[minmax(0,11rem)_1fr_3.5rem_4.5rem] items-center gap-x-4 gap-y-1.5 px-5 py-2.5 text-sm tabular-nums max-sm:grid-cols-[1fr_auto_auto]";
|
|
89
|
+
const t14 = step.status === "skipped" && "text-muted-foreground";
|
|
90
|
+
let t15;
|
|
91
|
+
if ($[20] !== t14) {
|
|
92
|
+
t15 = cn("truncate", t14);
|
|
93
|
+
$[20] = t14;
|
|
94
|
+
$[21] = t15;
|
|
95
|
+
} else {
|
|
96
|
+
t15 = $[21];
|
|
97
|
+
}
|
|
98
|
+
let t16;
|
|
99
|
+
if ($[22] !== step.title || $[23] !== t15) {
|
|
100
|
+
t16 = /*#__PURE__*/_jsx("span", {
|
|
101
|
+
className: t15,
|
|
102
|
+
children: step.title
|
|
103
|
+
});
|
|
104
|
+
$[22] = step.title;
|
|
105
|
+
$[23] = t15;
|
|
106
|
+
$[24] = t16;
|
|
107
|
+
} else {
|
|
108
|
+
t16 = $[24];
|
|
109
|
+
}
|
|
110
|
+
let t17;
|
|
111
|
+
if ($[25] !== mark) {
|
|
112
|
+
t17 = mark && /*#__PURE__*/_jsx("span", {
|
|
113
|
+
className: cn("shrink-0 font-mono text-[11px] tracking-wide uppercase", mark.className),
|
|
114
|
+
children: mark.text
|
|
115
|
+
});
|
|
116
|
+
$[25] = mark;
|
|
117
|
+
$[26] = t17;
|
|
118
|
+
} else {
|
|
119
|
+
t17 = $[26];
|
|
120
|
+
}
|
|
121
|
+
if ($[27] !== t16 || $[28] !== t17) {
|
|
122
|
+
t7 = /*#__PURE__*/_jsxs("span", {
|
|
123
|
+
className: "flex min-w-0 items-baseline gap-2",
|
|
124
|
+
children: [t16, t17]
|
|
125
|
+
});
|
|
126
|
+
$[27] = t16;
|
|
127
|
+
$[28] = t17;
|
|
128
|
+
$[29] = t7;
|
|
129
|
+
} else {
|
|
130
|
+
t7 = $[29];
|
|
131
|
+
}
|
|
132
|
+
let t18;
|
|
133
|
+
if ($[30] !== step) {
|
|
134
|
+
t18 = cn("absolute inset-y-0 left-0 transition-[width] duration-300 motion-reduce:transition-none", barTone(step));
|
|
135
|
+
$[30] = step;
|
|
136
|
+
$[31] = t18;
|
|
137
|
+
} else {
|
|
138
|
+
t18 = $[31];
|
|
139
|
+
}
|
|
140
|
+
let t19;
|
|
141
|
+
if ($[32] !== cost || $[33] !== maxCost) {
|
|
142
|
+
t19 = barWidth(cost, maxCost);
|
|
143
|
+
$[32] = cost;
|
|
144
|
+
$[33] = maxCost;
|
|
145
|
+
$[34] = t19;
|
|
146
|
+
} else {
|
|
147
|
+
t19 = $[34];
|
|
148
|
+
}
|
|
149
|
+
const t20 = `${t19}%`;
|
|
150
|
+
let t21;
|
|
151
|
+
if ($[35] !== t20) {
|
|
152
|
+
t21 = {
|
|
153
|
+
width: t20
|
|
154
|
+
};
|
|
155
|
+
$[35] = t20;
|
|
156
|
+
$[36] = t21;
|
|
157
|
+
} else {
|
|
158
|
+
t21 = $[36];
|
|
159
|
+
}
|
|
160
|
+
if ($[37] !== t18 || $[38] !== t21) {
|
|
161
|
+
t8 = /*#__PURE__*/_jsx("span", {
|
|
162
|
+
"aria-hidden": true,
|
|
163
|
+
className: "relative h-1.5 w-full bg-muted-foreground/10 max-sm:col-span-3 max-sm:row-start-2",
|
|
164
|
+
children: /*#__PURE__*/_jsx("span", {
|
|
165
|
+
className: t18,
|
|
166
|
+
style: t21
|
|
167
|
+
})
|
|
168
|
+
});
|
|
169
|
+
$[37] = t18;
|
|
170
|
+
$[38] = t21;
|
|
171
|
+
$[39] = t8;
|
|
172
|
+
} else {
|
|
173
|
+
t8 = $[39];
|
|
174
|
+
}
|
|
175
|
+
let t22;
|
|
176
|
+
if ($[40] !== step.durationMs) {
|
|
177
|
+
t22 = step.durationMs !== undefined ? formatDuration(step.durationMs) : "";
|
|
178
|
+
$[40] = step.durationMs;
|
|
179
|
+
$[41] = t22;
|
|
180
|
+
} else {
|
|
181
|
+
t22 = $[41];
|
|
182
|
+
}
|
|
183
|
+
if ($[42] !== t22) {
|
|
184
|
+
t9 = /*#__PURE__*/_jsx("span", {
|
|
185
|
+
className: "text-right font-mono text-[11px] text-muted-foreground",
|
|
186
|
+
children: t22
|
|
187
|
+
});
|
|
188
|
+
$[42] = t22;
|
|
189
|
+
$[43] = t9;
|
|
190
|
+
} else {
|
|
191
|
+
t9 = $[43];
|
|
192
|
+
}
|
|
193
|
+
t1 = cn("text-right font-mono text-xs", wasted && "text-destructive");
|
|
194
|
+
$[0] = cost;
|
|
195
|
+
$[1] = maxCost;
|
|
196
|
+
$[2] = step;
|
|
197
|
+
$[3] = totalCost;
|
|
198
|
+
$[4] = t1;
|
|
199
|
+
$[5] = t2;
|
|
200
|
+
$[6] = t3;
|
|
201
|
+
$[7] = t4;
|
|
202
|
+
$[8] = t5;
|
|
203
|
+
$[9] = t6;
|
|
204
|
+
$[10] = t7;
|
|
205
|
+
$[11] = t8;
|
|
206
|
+
$[12] = t9;
|
|
207
|
+
} else {
|
|
208
|
+
t1 = $[4];
|
|
209
|
+
t2 = $[5];
|
|
210
|
+
t3 = $[6];
|
|
211
|
+
t4 = $[7];
|
|
212
|
+
t5 = $[8];
|
|
213
|
+
t6 = $[9];
|
|
214
|
+
t7 = $[10];
|
|
215
|
+
t8 = $[11];
|
|
216
|
+
t9 = $[12];
|
|
217
|
+
}
|
|
218
|
+
let t10;
|
|
219
|
+
if ($[44] !== cost) {
|
|
220
|
+
t10 = formatMicroUsd(cost);
|
|
221
|
+
$[44] = cost;
|
|
222
|
+
$[45] = t10;
|
|
223
|
+
} else {
|
|
224
|
+
t10 = $[45];
|
|
225
|
+
}
|
|
226
|
+
let t11;
|
|
227
|
+
if ($[46] !== t1 || $[47] !== t10) {
|
|
228
|
+
t11 = /*#__PURE__*/_jsx("span", {
|
|
229
|
+
className: t1,
|
|
230
|
+
children: t10
|
|
231
|
+
});
|
|
232
|
+
$[46] = t1;
|
|
233
|
+
$[47] = t10;
|
|
234
|
+
$[48] = t11;
|
|
235
|
+
} else {
|
|
236
|
+
t11 = $[48];
|
|
237
|
+
}
|
|
238
|
+
let t12;
|
|
239
|
+
if ($[49] !== t11 || $[50] !== t2 || $[51] !== t3 || $[52] !== t4 || $[53] !== t5 || $[54] !== t6 || $[55] !== t7 || $[56] !== t8 || $[57] !== t9) {
|
|
240
|
+
t12 = /*#__PURE__*/_jsxs("li", {
|
|
241
|
+
"data-slot": t2,
|
|
242
|
+
"data-status": t3,
|
|
243
|
+
"data-wasted": t4,
|
|
244
|
+
"aria-label": t5,
|
|
245
|
+
className: t6,
|
|
246
|
+
children: [t7, t8, t9, t11]
|
|
247
|
+
});
|
|
248
|
+
$[49] = t11;
|
|
249
|
+
$[50] = t2;
|
|
250
|
+
$[51] = t3;
|
|
251
|
+
$[52] = t4;
|
|
252
|
+
$[53] = t5;
|
|
253
|
+
$[54] = t6;
|
|
254
|
+
$[55] = t7;
|
|
255
|
+
$[56] = t8;
|
|
256
|
+
$[57] = t9;
|
|
257
|
+
$[58] = t12;
|
|
258
|
+
} else {
|
|
259
|
+
t12 = $[58];
|
|
260
|
+
}
|
|
261
|
+
return t12;
|
|
34
262
|
}
|
|
@@ -1,26 +1,30 @@
|
|
|
1
1
|
export function sumUsage(attempts) {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
return attempts.reduce((totals, attempt) => ({
|
|
3
|
+
inputTokens: totals.inputTokens + attempt.inputTokens,
|
|
4
|
+
outputTokens: totals.outputTokens + attempt.outputTokens,
|
|
5
|
+
costMicroUsd: totals.costMicroUsd + attempt.costMicroUsd,
|
|
6
|
+
wastedMicroUsd: totals.wastedMicroUsd + (attempt.failed ? attempt.costMicroUsd : 0),
|
|
7
|
+
failedAttempts: totals.failedAttempts + (attempt.failed ? 1 : 0)
|
|
8
|
+
}), {
|
|
9
|
+
inputTokens: 0,
|
|
10
|
+
outputTokens: 0,
|
|
11
|
+
costMicroUsd: 0,
|
|
12
|
+
wastedMicroUsd: 0,
|
|
13
|
+
failedAttempts: 0
|
|
14
|
+
});
|
|
9
15
|
}
|
|
10
16
|
const compactCount = new Intl.NumberFormat("en-US", {
|
|
11
|
-
|
|
12
|
-
|
|
17
|
+
notation: "compact",
|
|
18
|
+
maximumFractionDigits: 1
|
|
13
19
|
});
|
|
14
20
|
export function formatTokensShort(tokens) {
|
|
15
|
-
|
|
21
|
+
return compactCount.format(tokens);
|
|
16
22
|
}
|
|
17
23
|
export function formatDuration(durationMs) {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
const remainder = Math.round(seconds % 60);
|
|
25
|
-
return `${minutes}m ${String(remainder).padStart(2, "0")}s`;
|
|
24
|
+
if (durationMs < 1000) return `${Math.round(durationMs)}ms`;
|
|
25
|
+
const seconds = durationMs / 1000;
|
|
26
|
+
if (seconds < 60) return `${seconds.toFixed(1)}s`;
|
|
27
|
+
const minutes = Math.floor(seconds / 60);
|
|
28
|
+
const remainder = Math.round(seconds % 60);
|
|
29
|
+
return `${minutes}m ${String(remainder).padStart(2, "0")}s`;
|
|
26
30
|
}
|