@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.
Files changed (214) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +37 -2
  3. package/dist/agent/index.d.ts +5 -0
  4. package/dist/agent/index.js +5 -0
  5. package/dist/agent/pulse/gradient-label.d.ts +7 -0
  6. package/dist/agent/pulse/gradient-label.js +94 -0
  7. package/dist/agent/pulse/marks/bars-mark.d.ts +1 -0
  8. package/dist/agent/pulse/marks/bars-mark.js +51 -0
  9. package/dist/agent/pulse/marks/glyph-mark.d.ts +4 -0
  10. package/dist/agent/pulse/marks/glyph-mark.js +62 -0
  11. package/dist/agent/pulse/marks/locus-mark.d.ts +1 -0
  12. package/dist/agent/pulse/marks/locus-mark.js +73 -0
  13. package/dist/agent/pulse/marks/orb-mark.d.ts +1 -0
  14. package/dist/agent/pulse/marks/orb-mark.js +34 -0
  15. package/dist/agent/pulse/marks/spinner-mark.d.ts +1 -0
  16. package/dist/agent/pulse/marks/spinner-mark.js +32 -0
  17. package/dist/agent/pulse/pulse-tone.d.ts +1 -0
  18. package/dist/agent/pulse/pulse-tone.js +1 -0
  19. package/dist/agent/pulse/pulse.d.ts +12 -0
  20. package/dist/agent/pulse/pulse.js +166 -0
  21. package/dist/agent/pulse/use-loop-animation.d.ts +2 -0
  22. package/dist/agent/pulse/use-loop-animation.js +40 -0
  23. package/dist/agent/shared/status-dot.d.ts +1 -0
  24. package/dist/agent/shared/status-dot.js +1 -0
  25. package/dist/agent/steps/step-icon.d.ts +8 -0
  26. package/dist/agent/steps/step-icon.js +117 -0
  27. package/dist/agent/steps/steps.d.ts +7 -0
  28. package/dist/agent/steps/steps.js +249 -0
  29. package/dist/agent/thinking/thinking.d.ts +6 -0
  30. package/dist/agent/thinking/thinking.js +211 -0
  31. package/dist/agent/thinking/thought-duration.d.ts +2 -0
  32. package/dist/agent/thinking/thought-duration.js +11 -0
  33. package/dist/agent/tool/json-block.d.ts +5 -0
  34. package/dist/agent/tool/json-block.js +42 -0
  35. package/dist/agent/tool/tool-status.d.ts +6 -0
  36. package/dist/agent/tool/tool-status.js +59 -0
  37. package/dist/agent/tool/tool.d.ts +7 -0
  38. package/dist/agent/tool/tool.js +192 -0
  39. package/dist/approval/inbox/inbox-row.d.ts +12 -0
  40. package/dist/approval/inbox/inbox-row.js +328 -0
  41. package/dist/approval/inbox/inbox-selection.d.ts +6 -0
  42. package/dist/approval/inbox/inbox-selection.js +15 -0
  43. package/dist/approval/inbox/inbox.d.ts +12 -0
  44. package/dist/approval/inbox/inbox.js +258 -0
  45. package/dist/approval/inbox/virtual-inbox-list.d.ts +13 -0
  46. package/dist/approval/inbox/virtual-inbox-list.js +129 -0
  47. package/dist/approval/index.d.ts +9 -0
  48. package/dist/approval/index.js +8 -0
  49. package/dist/approval/memory/memory-choices.d.ts +10 -0
  50. package/dist/approval/memory/memory-choices.js +35 -0
  51. package/dist/approval/memory/memory-review.d.ts +11 -0
  52. package/dist/approval/memory/memory-review.js +256 -0
  53. package/dist/approval/memory/memory-row.d.ts +9 -0
  54. package/dist/approval/memory/memory-row.js +226 -0
  55. package/dist/approval/plan/plan-review.d.ts +13 -0
  56. package/dist/approval/plan/plan-review.js +289 -0
  57. package/dist/approval/plan/plan-step-row.d.ts +13 -0
  58. package/dist/approval/plan/plan-step-row.js +201 -0
  59. package/dist/approval/plan/plan-steps.d.ts +8 -0
  60. package/dist/approval/plan/plan-steps.js +30 -0
  61. package/dist/approval/plan/question-choices.d.ts +10 -0
  62. package/dist/approval/plan/question-choices.js +166 -0
  63. package/dist/approval/plan/question.d.ts +18 -0
  64. package/dist/approval/plan/question.js +232 -0
  65. package/dist/approval/run/run-bar.d.ts +13 -0
  66. package/dist/approval/run/run-bar.js +189 -0
  67. package/dist/approval/shared/decision-line.d.ts +1 -0
  68. package/dist/approval/shared/decision-line.js +1 -0
  69. package/dist/approval/shared/risk-badge.d.ts +10 -0
  70. package/dist/approval/shared/risk-badge.js +57 -0
  71. package/dist/approval/shared/time.d.ts +3 -0
  72. package/dist/approval/shared/time.js +12 -0
  73. package/dist/approval/shared/use-focus-on-mount.d.ts +2 -0
  74. package/dist/approval/shared/use-focus-on-mount.js +26 -0
  75. package/dist/approval/spend/raise-cap-form.d.ts +8 -0
  76. package/dist/approval/spend/raise-cap-form.js +244 -0
  77. package/dist/approval/spend/spend-gate.d.ts +16 -0
  78. package/dist/approval/spend/spend-gate.js +250 -0
  79. package/dist/approval/spend/spend-math.d.ts +5 -0
  80. package/dist/approval/spend/spend-math.js +17 -0
  81. package/dist/approval/spend/spend-meter.d.ts +10 -0
  82. package/dist/approval/spend/spend-meter.js +377 -0
  83. package/dist/approval/tool/approval.d.ts +14 -0
  84. package/dist/approval/tool/approval.js +290 -0
  85. package/dist/approval/tool/args/args-editor.d.ts +16 -0
  86. package/dist/approval/tool/args/args-editor.js +273 -0
  87. package/dist/approval/tool/args/args-field.d.ts +11 -0
  88. package/dist/approval/tool/args/args-field.js +268 -0
  89. package/dist/approval/tool/args/args-validation.d.ts +8 -0
  90. package/dist/approval/tool/args/args-validation.js +50 -0
  91. package/dist/approval/tool/deny-form.d.ts +6 -0
  92. package/dist/approval/tool/deny-form.js +135 -0
  93. package/dist/approval/tool/tool-inputs.d.ts +6 -0
  94. package/dist/approval/tool/tool-inputs.js +142 -0
  95. package/dist/approval/types.d.ts +59 -0
  96. package/dist/approval/types.js +1 -0
  97. package/dist/chat/chat/chat-item-spacing.d.ts +3 -0
  98. package/dist/chat/chat/chat-item-spacing.js +19 -0
  99. package/dist/chat/chat/chat.d.ts +8 -0
  100. package/dist/chat/chat/chat.js +187 -0
  101. package/dist/chat/chat/use-stick-to-bottom.d.ts +7 -0
  102. package/dist/chat/chat/use-stick-to-bottom.js +133 -0
  103. package/dist/chat/chat/virtual-chat-items.d.ts +8 -0
  104. package/dist/chat/chat/virtual-chat-items.js +153 -0
  105. package/dist/chat/composer/composer-actions.d.ts +15 -0
  106. package/dist/chat/composer/composer-actions.js +158 -0
  107. package/dist/chat/composer/composer.d.ts +20 -0
  108. package/dist/chat/composer/composer.js +340 -0
  109. package/dist/chat/composer/use-auto-grow.d.ts +2 -0
  110. package/dist/chat/composer/use-auto-grow.js +29 -0
  111. package/dist/chat/files/file-meta.d.ts +13 -0
  112. package/dist/chat/files/file-meta.js +30 -0
  113. package/dist/chat/files/files.d.ts +9 -0
  114. package/dist/chat/files/files.js +327 -0
  115. package/dist/chat/index.d.ts +7 -0
  116. package/dist/chat/index.js +7 -0
  117. package/dist/chat/reply/fenced-code.d.ts +8 -0
  118. package/dist/chat/reply/fenced-code.js +53 -0
  119. package/dist/chat/reply/markdown-components.d.ts +2 -0
  120. package/dist/chat/reply/markdown-components.js +142 -0
  121. package/dist/chat/reply/reply.d.ts +8 -0
  122. package/dist/chat/reply/reply.js +116 -0
  123. package/dist/chat/turn/group-parts.d.ts +24 -0
  124. package/dist/chat/turn/group-parts.js +49 -0
  125. package/dist/chat/turn/turn.d.ts +11 -0
  126. package/dist/chat/turn/turn.js +253 -0
  127. package/dist/cost/context.d.ts +13 -0
  128. package/dist/cost/context.js +333 -0
  129. package/dist/cost/cost-steps.d.ts +17 -0
  130. package/dist/cost/cost-steps.js +230 -0
  131. package/dist/cost/cost.d.ts +8 -0
  132. package/dist/cost/cost.js +531 -0
  133. package/dist/cost/index.d.ts +4 -0
  134. package/dist/cost/index.js +4 -0
  135. package/dist/cost/model-picker.d.ts +11 -0
  136. package/dist/cost/model-picker.js +184 -0
  137. package/dist/cost/shared/context-breakdown.d.ts +15 -0
  138. package/dist/cost/shared/context-breakdown.js +306 -0
  139. package/dist/cost/shared/meter-marks.d.ts +9 -0
  140. package/dist/cost/shared/meter-marks.js +114 -0
  141. package/dist/cost/shared/model-option-row.d.ts +14 -0
  142. package/dist/cost/shared/model-option-row.js +189 -0
  143. package/dist/cost/shared/step-cost-row.d.ts +15 -0
  144. package/dist/cost/shared/step-cost-row.js +262 -0
  145. package/dist/cost/shared/usage-totals.d.ts +11 -0
  146. package/dist/cost/shared/usage-totals.js +30 -0
  147. package/dist/index.d.ts +7 -0
  148. package/dist/index.js +7 -0
  149. package/dist/memory/cite.d.ts +8 -0
  150. package/dist/memory/cite.js +190 -0
  151. package/dist/memory/index.d.ts +5 -0
  152. package/dist/memory/index.js +4 -0
  153. package/dist/memory/memorized.d.ts +14 -0
  154. package/dist/memory/memorized.js +225 -0
  155. package/dist/memory/recall.d.ts +9 -0
  156. package/dist/memory/recall.js +303 -0
  157. package/dist/memory/shared/disclosure.d.ts +6 -0
  158. package/dist/memory/shared/disclosure.js +6 -0
  159. package/dist/memory/shared/host-label.d.ts +6 -0
  160. package/dist/memory/shared/host-label.js +31 -0
  161. package/dist/memory/shared/source-mark.d.ts +5 -0
  162. package/dist/memory/shared/source-mark.js +42 -0
  163. package/dist/memory/sources.d.ts +9 -0
  164. package/dist/memory/sources.js +264 -0
  165. package/dist/shared/decision-summary.d.ts +18 -0
  166. package/dist/shared/decision-summary.js +144 -0
  167. package/dist/shared/panel-empty.d.ts +8 -0
  168. package/dist/shared/panel-empty.js +80 -0
  169. package/dist/shared/panel.d.ts +19 -0
  170. package/dist/shared/panel.js +251 -0
  171. package/dist/shared/status-dot.d.ts +6 -0
  172. package/dist/shared/status-dot.js +42 -0
  173. package/dist/shared/virtual/use-list-virtualizer.d.ts +24 -0
  174. package/dist/shared/virtual/use-list-virtualizer.js +68 -0
  175. package/dist/sources.css +1 -0
  176. package/dist/thread/actions/action-button.d.ts +8 -0
  177. package/dist/thread/actions/action-button.js +67 -0
  178. package/dist/thread/actions/actions.d.ts +13 -0
  179. package/dist/thread/actions/actions.js +192 -0
  180. package/dist/thread/actions/branch-switcher.d.ts +10 -0
  181. package/dist/thread/actions/branch-switcher.js +104 -0
  182. package/dist/thread/canvas/canvas.d.ts +14 -0
  183. package/dist/thread/canvas/canvas.js +212 -0
  184. package/dist/thread/canvas/version-switcher.d.ts +12 -0
  185. package/dist/thread/canvas/version-switcher.js +152 -0
  186. package/dist/thread/code/code.d.ts +10 -0
  187. package/dist/thread/code/code.js +195 -0
  188. package/dist/thread/code/copy-code-button.d.ts +6 -0
  189. package/dist/thread/code/copy-code-button.js +66 -0
  190. package/dist/thread/code/highlight.d.ts +1 -0
  191. package/dist/thread/code/highlight.js +40 -0
  192. package/dist/thread/history/history-rows.d.ts +16 -0
  193. package/dist/thread/history/history-rows.js +23 -0
  194. package/dist/thread/history/history.d.ts +16 -0
  195. package/dist/thread/history/history.js +179 -0
  196. package/dist/thread/history/row/history-row.d.ts +15 -0
  197. package/dist/thread/history/row/history-row.js +137 -0
  198. package/dist/thread/history/row/thread-item-menu.d.ts +7 -0
  199. package/dist/thread/history/row/thread-item-menu.js +84 -0
  200. package/dist/thread/history/row/thread-title-editor.d.ts +7 -0
  201. package/dist/thread/history/row/thread-title-editor.js +81 -0
  202. package/dist/thread/history/thread-groups.d.ts +8 -0
  203. package/dist/thread/history/thread-groups.js +52 -0
  204. package/dist/thread/history/virtual-history-list.d.ts +11 -0
  205. package/dist/thread/history/virtual-history-list.js +107 -0
  206. package/dist/thread/index.d.ts +8 -0
  207. package/dist/thread/index.js +5 -0
  208. package/dist/thread/starters/starters.d.ts +12 -0
  209. package/dist/thread/starters/starters.js +100 -0
  210. package/dist/thread/use-copied.d.ts +5 -0
  211. package/dist/thread/use-copied.js +52 -0
  212. package/dist/types.d.ts +70 -0
  213. package/dist/types.js +3 -0
  214. package/package.json +59 -3
@@ -0,0 +1,189 @@
1
+ import { c as _c } from "react/compiler-runtime";
2
+ import { Checkmark as CheckIcon } from "@carbon/icons-react";
3
+ import { DropdownMenuRadioItem } from "@locusgraph/components";
4
+ import { formatMicroUsd } from "@locusgraph/utils";
5
+ import { formatTokensShort } from "./usage-totals.js";
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
+ };
12
+ export function modelPriceLabel(model) {
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`;
19
+ }
20
+ function modelFacts(model) {
21
+ return [model.speed && speedLabel[model.speed], model.contextTokens !== undefined && `${formatTokensShort(model.contextTokens)} context`].filter(fact => typeof fact === "string");
22
+ }
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;
63
+ }
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) {
77
+ const facts = modelFacts(model);
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;
189
+ }
@@ -0,0 +1,15 @@
1
+ import type { RunUsage, StepStatus } from "../../types.js";
2
+ export type CostStepStatus = StepStatus | "retried";
3
+ export type CostStep = {
4
+ id: string;
5
+ title: string;
6
+ status: CostStepStatus;
7
+ usage: RunUsage;
8
+ durationMs?: number;
9
+ };
10
+ export declare function isWastedStep(step: CostStep): boolean;
11
+ export declare function StepCostRow({ step, maxCost, totalCost, }: {
12
+ step: CostStep;
13
+ maxCost: number;
14
+ totalCost: number;
15
+ }): import("react").JSX.Element;
@@ -0,0 +1,262 @@
1
+ import { c as _c } from "react/compiler-runtime";
2
+ import { cn } from "@locusgraph/components";
3
+ import { formatMicroUsd } from "@locusgraph/utils";
4
+ import { formatDuration } from "./usage-totals.js";
5
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
6
+ export function isWastedStep(step) {
7
+ return step.status === "failed" || step.usage.failed === true;
8
+ }
9
+ function barTone(step) {
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";
14
+ }
15
+ const statusMark = {
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
+ }
32
+ };
33
+ function barWidth(cost, maxCost) {
34
+ if (maxCost <= 0) return 0;
35
+ return Math.max(cost / maxCost * 100, cost > 0 ? 2 : 0);
36
+ }
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) {
55
+ const wasted = isWastedStep(step);
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;
66
+ const mark = wasted ? statusMark.failed : statusMark[step.status];
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;
262
+ }
@@ -0,0 +1,11 @@
1
+ import type { RunUsage } from "../../types.js";
2
+ export type UsageTotals = {
3
+ inputTokens: number;
4
+ outputTokens: number;
5
+ costMicroUsd: number;
6
+ wastedMicroUsd: number;
7
+ failedAttempts: number;
8
+ };
9
+ export declare function sumUsage(attempts: RunUsage[]): UsageTotals;
10
+ export declare function formatTokensShort(tokens: number): string;
11
+ export declare function formatDuration(durationMs: number): string;
@@ -0,0 +1,30 @@
1
+ export function sumUsage(attempts) {
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
+ });
15
+ }
16
+ const compactCount = new Intl.NumberFormat("en-US", {
17
+ notation: "compact",
18
+ maximumFractionDigits: 1
19
+ });
20
+ export function formatTokensShort(tokens) {
21
+ return compactCount.format(tokens);
22
+ }
23
+ export function formatDuration(durationMs) {
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`;
30
+ }
@@ -0,0 +1,7 @@
1
+ export * from "./agent/index.js";
2
+ export * from "./approval/index.js";
3
+ export * from "./chat/index.js";
4
+ export * from "./cost/index.js";
5
+ export * from "./memory/index.js";
6
+ export * from "./thread/index.js";
7
+ export * from "./types.js";
package/dist/index.js ADDED
@@ -0,0 +1,7 @@
1
+ export * from "./agent/index.js";
2
+ export * from "./approval/index.js";
3
+ export * from "./chat/index.js";
4
+ export * from "./cost/index.js";
5
+ export * from "./memory/index.js";
6
+ export * from "./thread/index.js";
7
+ export * from "./types.js";
@@ -0,0 +1,8 @@
1
+ import type { Citation } from "../types.js";
2
+ export type CiteProps = {
3
+ citation: Citation;
4
+ onOpen?: (citation: Citation) => void;
5
+ className?: string;
6
+ };
7
+ export declare function citationLabel(citation: Citation): string;
8
+ export declare function Cite({ citation, onOpen, className }: CiteProps): import("react").JSX.Element;