@locusgraph/loop 0.0.0-stage → 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/LICENSE +21 -0
- package/README.md +37 -2
- package/dist/agent/index.d.ts +5 -0
- package/dist/agent/index.js +5 -0
- package/dist/agent/pulse/gradient-label.d.ts +7 -0
- package/dist/agent/pulse/gradient-label.js +94 -0
- package/dist/agent/pulse/marks/bars-mark.d.ts +1 -0
- package/dist/agent/pulse/marks/bars-mark.js +51 -0
- package/dist/agent/pulse/marks/glyph-mark.d.ts +4 -0
- package/dist/agent/pulse/marks/glyph-mark.js +62 -0
- package/dist/agent/pulse/marks/locus-mark.d.ts +1 -0
- package/dist/agent/pulse/marks/locus-mark.js +73 -0
- package/dist/agent/pulse/marks/orb-mark.d.ts +1 -0
- package/dist/agent/pulse/marks/orb-mark.js +34 -0
- package/dist/agent/pulse/marks/spinner-mark.d.ts +1 -0
- package/dist/agent/pulse/marks/spinner-mark.js +32 -0
- package/dist/agent/pulse/pulse-tone.d.ts +1 -0
- package/dist/agent/pulse/pulse-tone.js +1 -0
- package/dist/agent/pulse/pulse.d.ts +12 -0
- package/dist/agent/pulse/pulse.js +166 -0
- package/dist/agent/pulse/use-loop-animation.d.ts +2 -0
- package/dist/agent/pulse/use-loop-animation.js +40 -0
- package/dist/agent/shared/status-dot.d.ts +1 -0
- package/dist/agent/shared/status-dot.js +1 -0
- package/dist/agent/steps/step-icon.d.ts +8 -0
- package/dist/agent/steps/step-icon.js +117 -0
- package/dist/agent/steps/steps.d.ts +7 -0
- package/dist/agent/steps/steps.js +249 -0
- package/dist/agent/thinking/thinking.d.ts +6 -0
- package/dist/agent/thinking/thinking.js +211 -0
- package/dist/agent/thinking/thought-duration.d.ts +2 -0
- package/dist/agent/thinking/thought-duration.js +11 -0
- package/dist/agent/tool/json-block.d.ts +5 -0
- package/dist/agent/tool/json-block.js +42 -0
- package/dist/agent/tool/tool-status.d.ts +6 -0
- package/dist/agent/tool/tool-status.js +59 -0
- package/dist/agent/tool/tool.d.ts +7 -0
- package/dist/agent/tool/tool.js +192 -0
- package/dist/approval/inbox/inbox-row.d.ts +12 -0
- package/dist/approval/inbox/inbox-row.js +328 -0
- package/dist/approval/inbox/inbox-selection.d.ts +6 -0
- package/dist/approval/inbox/inbox-selection.js +15 -0
- package/dist/approval/inbox/inbox.d.ts +12 -0
- package/dist/approval/inbox/inbox.js +258 -0
- package/dist/approval/inbox/virtual-inbox-list.d.ts +13 -0
- package/dist/approval/inbox/virtual-inbox-list.js +129 -0
- package/dist/approval/index.d.ts +9 -0
- package/dist/approval/index.js +8 -0
- package/dist/approval/memory/memory-choices.d.ts +10 -0
- package/dist/approval/memory/memory-choices.js +35 -0
- package/dist/approval/memory/memory-review.d.ts +11 -0
- package/dist/approval/memory/memory-review.js +256 -0
- package/dist/approval/memory/memory-row.d.ts +9 -0
- package/dist/approval/memory/memory-row.js +226 -0
- package/dist/approval/plan/plan-review.d.ts +13 -0
- package/dist/approval/plan/plan-review.js +289 -0
- package/dist/approval/plan/plan-step-row.d.ts +13 -0
- package/dist/approval/plan/plan-step-row.js +201 -0
- package/dist/approval/plan/plan-steps.d.ts +8 -0
- package/dist/approval/plan/plan-steps.js +30 -0
- package/dist/approval/plan/question-choices.d.ts +10 -0
- package/dist/approval/plan/question-choices.js +166 -0
- package/dist/approval/plan/question.d.ts +18 -0
- package/dist/approval/plan/question.js +232 -0
- package/dist/approval/run/run-bar.d.ts +13 -0
- package/dist/approval/run/run-bar.js +189 -0
- package/dist/approval/shared/decision-line.d.ts +1 -0
- package/dist/approval/shared/decision-line.js +1 -0
- package/dist/approval/shared/risk-badge.d.ts +10 -0
- package/dist/approval/shared/risk-badge.js +57 -0
- package/dist/approval/shared/time.d.ts +3 -0
- package/dist/approval/shared/time.js +12 -0
- package/dist/approval/shared/use-focus-on-mount.d.ts +2 -0
- package/dist/approval/shared/use-focus-on-mount.js +26 -0
- package/dist/approval/spend/raise-cap-form.d.ts +8 -0
- package/dist/approval/spend/raise-cap-form.js +244 -0
- package/dist/approval/spend/spend-gate.d.ts +16 -0
- package/dist/approval/spend/spend-gate.js +250 -0
- package/dist/approval/spend/spend-math.d.ts +5 -0
- package/dist/approval/spend/spend-math.js +17 -0
- package/dist/approval/spend/spend-meter.d.ts +10 -0
- package/dist/approval/spend/spend-meter.js +377 -0
- package/dist/approval/tool/approval.d.ts +14 -0
- package/dist/approval/tool/approval.js +290 -0
- package/dist/approval/tool/args/args-editor.d.ts +16 -0
- package/dist/approval/tool/args/args-editor.js +273 -0
- package/dist/approval/tool/args/args-field.d.ts +11 -0
- package/dist/approval/tool/args/args-field.js +268 -0
- package/dist/approval/tool/args/args-validation.d.ts +8 -0
- package/dist/approval/tool/args/args-validation.js +50 -0
- package/dist/approval/tool/deny-form.d.ts +6 -0
- package/dist/approval/tool/deny-form.js +135 -0
- package/dist/approval/tool/tool-inputs.d.ts +6 -0
- package/dist/approval/tool/tool-inputs.js +142 -0
- package/dist/approval/types.d.ts +59 -0
- package/dist/approval/types.js +1 -0
- 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 +8 -0
- package/dist/chat/chat/chat.js +187 -0
- package/dist/chat/chat/use-stick-to-bottom.d.ts +7 -0
- package/dist/chat/chat/use-stick-to-bottom.js +133 -0
- 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.d.ts +15 -0
- package/dist/chat/composer/composer-actions.js +158 -0
- package/dist/chat/composer/composer.d.ts +20 -0
- package/dist/chat/composer/composer.js +340 -0
- package/dist/chat/composer/use-auto-grow.d.ts +2 -0
- package/dist/chat/composer/use-auto-grow.js +29 -0
- package/dist/chat/files/file-meta.d.ts +13 -0
- package/dist/chat/files/file-meta.js +30 -0
- package/dist/chat/files/files.d.ts +9 -0
- package/dist/chat/files/files.js +327 -0
- package/dist/chat/index.d.ts +7 -0
- package/dist/chat/index.js +7 -0
- package/dist/chat/reply/fenced-code.d.ts +8 -0
- package/dist/chat/reply/fenced-code.js +53 -0
- package/dist/chat/reply/markdown-components.d.ts +2 -0
- package/dist/chat/reply/markdown-components.js +142 -0
- package/dist/chat/reply/reply.d.ts +8 -0
- package/dist/chat/reply/reply.js +116 -0
- package/dist/chat/turn/group-parts.d.ts +24 -0
- package/dist/chat/turn/group-parts.js +49 -0
- package/dist/chat/turn/turn.d.ts +11 -0
- package/dist/chat/turn/turn.js +253 -0
- package/dist/cost/context.d.ts +13 -0
- package/dist/cost/context.js +333 -0
- package/dist/cost/cost-steps.d.ts +17 -0
- package/dist/cost/cost-steps.js +230 -0
- package/dist/cost/cost.d.ts +8 -0
- package/dist/cost/cost.js +531 -0
- package/dist/cost/index.d.ts +4 -0
- package/dist/cost/index.js +4 -0
- package/dist/cost/model-picker.d.ts +11 -0
- package/dist/cost/model-picker.js +184 -0
- package/dist/cost/shared/context-breakdown.d.ts +15 -0
- package/dist/cost/shared/context-breakdown.js +306 -0
- package/dist/cost/shared/meter-marks.d.ts +9 -0
- package/dist/cost/shared/meter-marks.js +114 -0
- package/dist/cost/shared/model-option-row.d.ts +14 -0
- package/dist/cost/shared/model-option-row.js +189 -0
- package/dist/cost/shared/step-cost-row.d.ts +15 -0
- package/dist/cost/shared/step-cost-row.js +262 -0
- package/dist/cost/shared/usage-totals.d.ts +11 -0
- package/dist/cost/shared/usage-totals.js +30 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +7 -0
- package/dist/memory/cite.d.ts +8 -0
- package/dist/memory/cite.js +190 -0
- package/dist/memory/index.d.ts +5 -0
- package/dist/memory/index.js +4 -0
- package/dist/memory/memorized.d.ts +14 -0
- package/dist/memory/memorized.js +225 -0
- package/dist/memory/recall.d.ts +9 -0
- package/dist/memory/recall.js +303 -0
- package/dist/memory/shared/disclosure.d.ts +6 -0
- package/dist/memory/shared/disclosure.js +6 -0
- package/dist/memory/shared/host-label.d.ts +6 -0
- package/dist/memory/shared/host-label.js +31 -0
- package/dist/memory/shared/source-mark.d.ts +5 -0
- package/dist/memory/shared/source-mark.js +42 -0
- package/dist/memory/sources.d.ts +9 -0
- package/dist/memory/sources.js +264 -0
- package/dist/shared/decision-summary.d.ts +18 -0
- package/dist/shared/decision-summary.js +144 -0
- package/dist/shared/panel-empty.d.ts +8 -0
- package/dist/shared/panel-empty.js +80 -0
- package/dist/shared/panel.d.ts +19 -0
- package/dist/shared/panel.js +251 -0
- package/dist/shared/status-dot.d.ts +6 -0
- package/dist/shared/status-dot.js +42 -0
- package/dist/shared/virtual/use-list-virtualizer.d.ts +24 -0
- package/dist/shared/virtual/use-list-virtualizer.js +68 -0
- package/dist/sources.css +1 -0
- package/dist/thread/actions/action-button.d.ts +8 -0
- package/dist/thread/actions/action-button.js +67 -0
- package/dist/thread/actions/actions.d.ts +13 -0
- package/dist/thread/actions/actions.js +192 -0
- package/dist/thread/actions/branch-switcher.d.ts +10 -0
- package/dist/thread/actions/branch-switcher.js +104 -0
- package/dist/thread/canvas/canvas.d.ts +14 -0
- package/dist/thread/canvas/canvas.js +212 -0
- package/dist/thread/canvas/version-switcher.d.ts +12 -0
- package/dist/thread/canvas/version-switcher.js +152 -0
- package/dist/thread/code/code.d.ts +10 -0
- package/dist/thread/code/code.js +195 -0
- package/dist/thread/code/copy-code-button.d.ts +6 -0
- package/dist/thread/code/copy-code-button.js +66 -0
- package/dist/thread/code/highlight.d.ts +1 -0
- package/dist/thread/code/highlight.js +40 -0
- 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 +16 -0
- package/dist/thread/history/history.js +179 -0
- package/dist/thread/history/row/history-row.d.ts +15 -0
- package/dist/thread/history/row/history-row.js +137 -0
- package/dist/thread/history/row/thread-item-menu.d.ts +7 -0
- package/dist/thread/history/row/thread-item-menu.js +84 -0
- package/dist/thread/history/row/thread-title-editor.d.ts +7 -0
- package/dist/thread/history/row/thread-title-editor.js +81 -0
- package/dist/thread/history/thread-groups.d.ts +8 -0
- package/dist/thread/history/thread-groups.js +52 -0
- 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 +8 -0
- package/dist/thread/index.js +5 -0
- package/dist/thread/starters/starters.d.ts +12 -0
- package/dist/thread/starters/starters.js +100 -0
- package/dist/thread/use-copied.d.ts +5 -0
- package/dist/thread/use-copied.js +52 -0
- package/dist/types.d.ts +70 -0
- package/dist/types.js +3 -0
- package/package.json +59 -3
|
@@ -0,0 +1,531 @@
|
|
|
1
|
+
import { c as _c } from "react/compiler-runtime";
|
|
2
|
+
import { Money as CoinsIcon } from "@carbon/icons-react";
|
|
3
|
+
import { cn } from "@locusgraph/components";
|
|
4
|
+
import { formatCount, formatMicroUsd, pluralize } from "@locusgraph/utils";
|
|
5
|
+
import { ApprovalPanel, PanelHeader } from "../shared/panel.js";
|
|
6
|
+
import { sumUsage } from "./shared/usage-totals.js";
|
|
7
|
+
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
8
|
+
function attemptsOf(usage) {
|
|
9
|
+
return Array.isArray(usage) ? usage : [usage];
|
|
10
|
+
}
|
|
11
|
+
function modelsOf(attempts) {
|
|
12
|
+
const models = [...new Set(attempts.map(attempt => attempt.model).filter(Boolean))];
|
|
13
|
+
return models.length > 0 ? models.join(", ") : undefined;
|
|
14
|
+
}
|
|
15
|
+
function WastedNote(t0) {
|
|
16
|
+
const $ = _c(7);
|
|
17
|
+
const {
|
|
18
|
+
totals
|
|
19
|
+
} = t0;
|
|
20
|
+
if (totals.failedAttempts === 0) {
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
let t1;
|
|
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;
|
|
53
|
+
}
|
|
54
|
+
function CompactCost(t0) {
|
|
55
|
+
const $ = _c(26);
|
|
56
|
+
const {
|
|
57
|
+
attempts,
|
|
58
|
+
totals,
|
|
59
|
+
className
|
|
60
|
+
} = t0;
|
|
61
|
+
let t1;
|
|
62
|
+
if ($[0] !== attempts) {
|
|
63
|
+
t1 = modelsOf(attempts);
|
|
64
|
+
$[0] = attempts;
|
|
65
|
+
$[1] = t1;
|
|
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", {
|
|
90
|
+
className: "font-medium text-foreground",
|
|
91
|
+
children: t4
|
|
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", {
|
|
117
|
+
className: "whitespace-nowrap",
|
|
118
|
+
children: [t6, " in \xB7 ", t7, " out"]
|
|
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", {
|
|
129
|
+
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, {
|
|
139
|
+
totals: totals
|
|
140
|
+
});
|
|
141
|
+
$[17] = totals;
|
|
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;
|
|
166
|
+
}
|
|
167
|
+
function AttemptRow(t0) {
|
|
168
|
+
const $ = _c(32);
|
|
169
|
+
const {
|
|
170
|
+
attempt,
|
|
171
|
+
position
|
|
172
|
+
} = t0;
|
|
173
|
+
const t1 = attempt.failed || undefined;
|
|
174
|
+
const t2 = position + 1;
|
|
175
|
+
let t3;
|
|
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", {
|
|
222
|
+
className: "flex min-w-0 items-baseline gap-2",
|
|
223
|
+
children: [t3, t7, t8]
|
|
224
|
+
});
|
|
225
|
+
$[9] = t3;
|
|
226
|
+
$[10] = t7;
|
|
227
|
+
$[11] = t8;
|
|
228
|
+
$[12] = t9;
|
|
229
|
+
} else {
|
|
230
|
+
t9 = $[12];
|
|
231
|
+
}
|
|
232
|
+
let t10;
|
|
233
|
+
if ($[13] !== attempt.inputTokens) {
|
|
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", {
|
|
251
|
+
className: "font-mono text-[11px] text-muted-foreground max-sm:hidden",
|
|
252
|
+
children: [t10, " in \xB7 ", t11, " out"]
|
|
253
|
+
});
|
|
254
|
+
$[17] = t10;
|
|
255
|
+
$[18] = t11;
|
|
256
|
+
$[19] = t12;
|
|
257
|
+
} else {
|
|
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;
|
|
306
|
+
}
|
|
307
|
+
function DetailedCost(t0) {
|
|
308
|
+
const $ = _c(36);
|
|
309
|
+
const {
|
|
310
|
+
attempts,
|
|
311
|
+
totals,
|
|
312
|
+
label,
|
|
313
|
+
className
|
|
314
|
+
} = t0;
|
|
315
|
+
const failed = totals.failedAttempts > 0;
|
|
316
|
+
const t1 = failed || undefined;
|
|
317
|
+
let t2;
|
|
318
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
319
|
+
t2 = /*#__PURE__*/_jsx(CoinsIcon, {
|
|
320
|
+
"aria-hidden": true
|
|
321
|
+
});
|
|
322
|
+
$[0] = t2;
|
|
323
|
+
} else {
|
|
324
|
+
t2 = $[0];
|
|
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,
|
|
338
|
+
eyebrow: label,
|
|
339
|
+
aside: t3
|
|
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", {
|
|
418
|
+
className: "flex flex-col gap-1 px-5 pt-2 pb-4",
|
|
419
|
+
children: [t6, t11]
|
|
420
|
+
});
|
|
421
|
+
$[22] = t11;
|
|
422
|
+
$[23] = t6;
|
|
423
|
+
$[24] = t12;
|
|
424
|
+
} else {
|
|
425
|
+
t12 = $[24];
|
|
426
|
+
}
|
|
427
|
+
let t13;
|
|
428
|
+
if ($[25] !== attempts) {
|
|
429
|
+
t13 = attempts.map(_temp);
|
|
430
|
+
$[25] = attempts;
|
|
431
|
+
$[26] = t13;
|
|
432
|
+
} else {
|
|
433
|
+
t13 = $[26];
|
|
434
|
+
}
|
|
435
|
+
let t14;
|
|
436
|
+
if ($[27] !== t13) {
|
|
437
|
+
t14 = /*#__PURE__*/_jsx("ol", {
|
|
438
|
+
className: "flex flex-col divide-y divide-border border-t border-border",
|
|
439
|
+
children: t13
|
|
440
|
+
});
|
|
441
|
+
$[27] = t13;
|
|
442
|
+
$[28] = t14;
|
|
443
|
+
} else {
|
|
444
|
+
t14 = $[28];
|
|
445
|
+
}
|
|
446
|
+
let t15;
|
|
447
|
+
if ($[29] !== className || $[30] !== label || $[31] !== t1 || $[32] !== t12 || $[33] !== t14 || $[34] !== t4) {
|
|
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);
|
|
473
|
+
}
|
|
474
|
+
export function Cost(t0) {
|
|
475
|
+
const $ = _c(12);
|
|
476
|
+
const {
|
|
477
|
+
usage,
|
|
478
|
+
variant: t1,
|
|
479
|
+
label: t2,
|
|
480
|
+
className
|
|
481
|
+
} = t0;
|
|
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;
|
|
497
|
+
if (variant === "detailed") {
|
|
498
|
+
let t4;
|
|
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, {
|
|
519
|
+
attempts: attempts,
|
|
520
|
+
totals: totals,
|
|
521
|
+
className: className
|
|
522
|
+
});
|
|
523
|
+
$[8] = attempts;
|
|
524
|
+
$[9] = className;
|
|
525
|
+
$[10] = totals;
|
|
526
|
+
$[11] = t4;
|
|
527
|
+
} else {
|
|
528
|
+
t4 = $[11];
|
|
529
|
+
}
|
|
530
|
+
return t4;
|
|
531
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type ModelOption } from "./shared/model-option-row.js";
|
|
2
|
+
export { type ModelOption, type ModelSpeed, modelPriceLabel, } from "./shared/model-option-row.js";
|
|
3
|
+
export type ModelPickerProps = {
|
|
4
|
+
models: ModelOption[];
|
|
5
|
+
value: string;
|
|
6
|
+
onChange: (id: string) => void;
|
|
7
|
+
label?: string;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
className?: string;
|
|
10
|
+
};
|
|
11
|
+
export declare function ModelPicker({ models, value, onChange, label, disabled, className, }: ModelPickerProps): import("react").JSX.Element;
|