@locusgraph/loop 0.3.1 → 0.4.1

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 (119) hide show
  1. package/dist/agent/index.d.ts +1 -1
  2. package/dist/agent/pulse/gradient-label.js +6 -5
  3. package/dist/agent/pulse/marks/bars-mark.js +1 -1
  4. package/dist/agent/pulse/marks/glyph-mark.js +2 -2
  5. package/dist/agent/pulse/marks/locus-mark.js +1 -1
  6. package/dist/agent/pulse/pulse.js +1 -1
  7. package/dist/agent/pulse/use-loop-animation.d.ts +0 -1
  8. package/dist/agent/pulse/use-loop-animation.js +1 -3
  9. package/dist/agent/steps/step-icon.js +20 -13
  10. package/dist/agent/steps/steps.js +39 -37
  11. package/dist/agent/thinking/thinking.js +65 -62
  12. package/dist/agent/tool/json-block.js +10 -7
  13. package/dist/agent/tool/tool-status.d.ts +2 -0
  14. package/dist/agent/tool/tool-status.js +16 -13
  15. package/dist/agent/tool/tool.d.ts +8 -1
  16. package/dist/agent/tool/tool.js +238 -119
  17. package/dist/approval/inbox/inbox-row.d.ts +3 -3
  18. package/dist/approval/inbox/inbox-row.js +135 -200
  19. package/dist/approval/inbox/inbox.d.ts +3 -3
  20. package/dist/approval/inbox/inbox.js +180 -139
  21. package/dist/approval/inbox/virtual-inbox-list.d.ts +3 -3
  22. package/dist/approval/inbox/virtual-inbox-list.js +20 -21
  23. package/dist/approval/memory/memory-review.js +155 -154
  24. package/dist/approval/memory/memory-row.js +86 -87
  25. package/dist/approval/plan/plan-review.js +110 -129
  26. package/dist/approval/plan/plan-step-row.js +7 -6
  27. package/dist/approval/plan/plan-steps.d.ts +1 -1
  28. package/dist/approval/plan/plan-steps.js +2 -2
  29. package/dist/approval/plan/question-choices.js +10 -7
  30. package/dist/approval/plan/question.js +116 -112
  31. package/dist/approval/run/run-bar.js +43 -40
  32. package/dist/approval/shared/approval-line.d.ts +27 -0
  33. package/dist/approval/shared/approval-line.js +85 -0
  34. package/dist/approval/shared/risk-badge.d.ts +3 -5
  35. package/dist/approval/shared/risk-badge.js +11 -19
  36. package/dist/approval/shared/time.d.ts +0 -1
  37. package/dist/approval/shared/time.js +0 -1
  38. package/dist/approval/shared/use-focus-when-settled.d.ts +2 -0
  39. package/dist/approval/shared/use-focus-when-settled.js +18 -0
  40. package/dist/approval/spend/raise-cap-form.d.ts +2 -2
  41. package/dist/approval/spend/raise-cap-form.js +134 -126
  42. package/dist/approval/spend/spend-gate.js +133 -156
  43. package/dist/approval/spend/spend-math.d.ts +1 -0
  44. package/dist/approval/spend/spend-math.js +5 -2
  45. package/dist/approval/spend/spend-meter.js +5 -5
  46. package/dist/approval/tool/approval.js +114 -214
  47. package/dist/approval/tool/args/args-editor.js +147 -156
  48. package/dist/approval/tool/args/args-field.js +197 -109
  49. package/dist/approval/tool/deny-form.js +59 -66
  50. package/dist/approval/tool/tool-inputs.js +38 -45
  51. package/dist/chat/chat/chat.js +5 -4
  52. package/dist/chat/chat/use-stick-to-bottom.js +1 -3
  53. package/dist/chat/composer/composer-actions.js +4 -1
  54. package/dist/chat/composer/composer.js +4 -3
  55. package/dist/chat/composer/use-auto-grow.js +14 -10
  56. package/dist/chat/files/files.js +12 -10
  57. package/dist/chat/reply/fenced-code.js +1 -1
  58. package/dist/chat/reply/markdown-components.js +9 -116
  59. package/dist/chat/reply/reply.js +2 -2
  60. package/dist/chat/turn/group-parts.d.ts +1 -0
  61. package/dist/chat/turn/group-parts.js +6 -3
  62. package/dist/chat/turn/turn.js +13 -4
  63. package/dist/cost/context.js +3 -3
  64. package/dist/cost/cost-steps.js +31 -30
  65. package/dist/cost/cost.js +39 -39
  66. package/dist/cost/model-picker.js +5 -4
  67. package/dist/cost/shared/context-breakdown.js +10 -11
  68. package/dist/cost/shared/model-option-row.js +4 -3
  69. package/dist/cost/shared/step-cost-row.js +11 -12
  70. package/dist/cost/shared/usage-totals.d.ts +1 -0
  71. package/dist/cost/shared/usage-totals.js +19 -1
  72. package/dist/memory/cite.js +55 -47
  73. package/dist/memory/memorized.js +123 -108
  74. package/dist/memory/recall.js +136 -146
  75. package/dist/memory/shared/host-label.d.ts +1 -1
  76. package/dist/memory/shared/host-label.js +2 -2
  77. package/dist/memory/shared/source-mark.js +1 -1
  78. package/dist/memory/sources.d.ts +2 -1
  79. package/dist/memory/sources.js +135 -100
  80. package/dist/shared/decision-summary.js +2 -1
  81. package/dist/shared/line.d.ts +10 -0
  82. package/dist/shared/line.js +11 -0
  83. package/dist/shared/live-status.d.ts +3 -0
  84. package/dist/shared/live-status.js +11 -0
  85. package/dist/shared/reduced-motion.d.ts +1 -0
  86. package/dist/shared/reduced-motion.js +3 -0
  87. package/dist/thread/actions/action-button.js +1 -1
  88. package/dist/thread/actions/actions.d.ts +3 -1
  89. package/dist/thread/actions/actions.js +100 -81
  90. package/dist/thread/actions/branch-switcher.js +67 -37
  91. package/dist/thread/canvas/canvas-meta.d.ts +9 -0
  92. package/dist/thread/canvas/canvas-meta.js +35 -0
  93. package/dist/thread/canvas/canvas.d.ts +1 -1
  94. package/dist/thread/canvas/canvas.js +64 -74
  95. package/dist/thread/canvas/version-switcher.d.ts +1 -0
  96. package/dist/thread/canvas/version-switcher.js +106 -87
  97. package/dist/thread/code/code.js +4 -6
  98. package/dist/thread/code/copy-code-button.d.ts +2 -1
  99. package/dist/thread/code/copy-code-button.js +56 -25
  100. package/dist/thread/history/history.d.ts +1 -1
  101. package/dist/thread/history/history.js +104 -104
  102. package/dist/thread/history/row/history-row.js +8 -5
  103. package/dist/thread/history/row/thread-item-menu.js +13 -4
  104. package/dist/thread/history/row/thread-title-editor.js +1 -1
  105. package/dist/thread/history/virtual-history-list.js +1 -2
  106. package/dist/thread/index.d.ts +1 -0
  107. package/dist/thread/index.js +1 -0
  108. package/dist/thread/starters/starters.js +5 -4
  109. package/package.json +6 -6
  110. package/dist/agent/shared/status-dot.d.ts +0 -1
  111. package/dist/agent/shared/status-dot.js +0 -1
  112. package/dist/approval/shared/decision-line.d.ts +0 -1
  113. package/dist/approval/shared/decision-line.js +0 -1
  114. package/dist/memory/shared/disclosure.d.ts +0 -6
  115. package/dist/memory/shared/disclosure.js +0 -6
  116. package/dist/shared/panel.d.ts +0 -19
  117. package/dist/shared/panel.js +0 -77
  118. package/dist/shared/status-dot.d.ts +0 -6
  119. package/dist/shared/status-dot.js +0 -20
@@ -1,14 +1,17 @@
1
1
  "use client";
2
2
 
3
3
  import { c as _c } from "react/compiler-runtime";
4
- import { CurrencyDollar as CircleDollarSignIcon } from "@carbon/icons-react";
5
4
  import { Button, cn } from "@locusgraph/components";
6
5
  import { formatMicroUsd } from "@locusgraph/utils";
7
- import { ApprovalPanel, LiveStatus, PanelBody, PanelFooter, PanelHeader, PanelTitle } from "../../shared/panel.js";
8
- import { DecisionSummary } from "../shared/decision-line.js";
6
+ import { CurrencyCircleDollar as CircleDollarSignIcon } from "@phosphor-icons/react/ssr";
7
+ import { DecisionSummary } from "../../shared/decision-summary.js";
8
+ import { lineObjectClass } from "../../shared/line.js";
9
+ import { LiveStatus } from "../../shared/live-status.js";
10
+ import { PendingLine, SettledLine } from "../shared/approval-line.js";
9
11
  import { useFocusOnMount } from "../shared/use-focus-on-mount.js";
12
+ import { useFocusWhenSettled } from "../shared/use-focus-when-settled.js";
10
13
  import { RaiseCapForm } from "./raise-cap-form.js";
11
- import { spendSituation, suggestedCapMicroUsd } from "./spend-math.js";
14
+ import { minimumCapMicroUsd, spendSituation, suggestedCapMicroUsd } from "./spend-math.js";
12
15
  import { SpendMeter } from "./spend-meter.js";
13
16
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
14
17
  const situationCopy = {
@@ -26,7 +29,7 @@ const situationStatus = {
26
29
  "out-of-credits": "Out of credits"
27
30
  };
28
31
  export function SpendGate(t0) {
29
- const $ = _c(45);
32
+ const $ = _c(39);
30
33
  const {
31
34
  spentMicroUsd,
32
35
  estimateMicroUsd,
@@ -56,6 +59,7 @@ export function SpendGate(t0) {
56
59
  const projected = spentMicroUsd + estimateMicroUsd;
57
60
  const copy = situationCopy[situation];
58
61
  const primaryRef = useFocusOnMount(autoFocus && !decision);
62
+ const settleRef = useFocusWhenSettled(!decision);
59
63
  let t3;
60
64
  if ($[3] !== balanceMicroUsd || $[4] !== capMicroUsd || $[5] !== estimateMicroUsd || $[6] !== outOfCredits || $[7] !== spentMicroUsd) {
61
65
  t3 = {
@@ -75,178 +79,151 @@ export function SpendGate(t0) {
75
79
  t3 = $[8];
76
80
  }
77
81
  const meter = t3;
78
- const t4 = copy.title;
79
- const t5 = !decision && outOfCredits && "ring-destructive/60";
80
- let t6;
81
- if ($[9] !== className || $[10] !== t5) {
82
- t6 = cn(t5, className);
83
- $[9] = className;
84
- $[10] = t5;
85
- $[11] = t6;
86
- } else {
87
- t6 = $[11];
88
- }
89
- let t7;
90
- if ($[12] === Symbol.for("react.memo_cache_sentinel")) {
91
- t7 = /*#__PURE__*/_jsx(CircleDollarSignIcon, {
82
+ let t4;
83
+ if ($[9] === Symbol.for("react.memo_cache_sentinel")) {
84
+ t4 = /*#__PURE__*/_jsx(CircleDollarSignIcon, {
85
+ weight: "bold",
92
86
  "aria-hidden": true
93
87
  });
94
- $[12] = t7;
88
+ $[9] = t4;
95
89
  } else {
96
- t7 = $[12];
90
+ t4 = $[9];
97
91
  }
98
- const t8 = decision ? decision.approved ? "Allowed" : "Stopped" : situationStatus[situation];
99
- const t9 = decision ? decision.approved ? "done" : "danger" : outOfCredits ? "danger" : "waiting";
100
- let t10;
101
- if ($[13] !== t8 || $[14] !== t9) {
102
- t10 = /*#__PURE__*/_jsx(PanelHeader, {
103
- icon: t7,
104
- eyebrow: "Spend approval",
105
- status: t8,
106
- tone: t9
107
- });
108
- $[13] = t8;
109
- $[14] = t9;
110
- $[15] = t10;
92
+ const icon = t4;
93
+ let t5;
94
+ if ($[10] !== estimateMicroUsd) {
95
+ t5 = formatMicroUsd(estimateMicroUsd);
96
+ $[10] = estimateMicroUsd;
97
+ $[11] = t5;
111
98
  } else {
112
- t10 = $[15];
99
+ t5 = $[11];
113
100
  }
114
- const t11 = decision && "text-muted-foreground";
115
- let t12;
116
- if ($[16] !== t11) {
117
- t12 = cn(t11);
118
- $[16] = t11;
119
- $[17] = t12;
120
- } else {
121
- t12 = $[17];
122
- }
123
- let t13;
124
- if ($[18] !== copy.title || $[19] !== t12) {
125
- t13 = /*#__PURE__*/_jsx(PanelTitle, {
126
- className: t12,
127
- children: copy.title
128
- });
129
- $[18] = copy.title;
130
- $[19] = t12;
131
- $[20] = t13;
101
+ const estimate = t5;
102
+ const t6 = copy.title;
103
+ const t7 = !decision && "gap-3";
104
+ let t8;
105
+ if ($[12] !== className || $[13] !== t7) {
106
+ t8 = cn("flex min-w-0 flex-col outline-none", t7, className);
107
+ $[12] = className;
108
+ $[13] = t7;
109
+ $[14] = t8;
132
110
  } else {
133
- t13 = $[20];
111
+ t8 = $[14];
134
112
  }
135
- let t14;
136
- if ($[21] !== capMicroUsd || $[22] !== copy || $[23] !== decision || $[24] !== estimateMicroUsd || $[25] !== meter || $[26] !== onAllowOnce || $[27] !== onBuyCredits || $[28] !== onRaiseCap || $[29] !== onStop || $[30] !== outOfCredits || $[31] !== primaryRef || $[32] !== projected || $[33] !== runName) {
137
- t14 = decision ? /*#__PURE__*/_jsxs(PanelBody, {
138
- className: "pt-3",
139
- children: [/*#__PURE__*/_jsx(DecisionSummary, {
140
- decision: decision,
141
- approvedVerb: "Allowed",
142
- deniedVerb: "Stopped",
143
- result: decision.approved ? `Allowed ${formatMicroUsd(estimateMicroUsd)} once` : `${runName ?? "The run"} stopped`
144
- }), /*#__PURE__*/_jsx(SpendMeter, {
145
- ...meter,
146
- muted: true
147
- })]
148
- }) : /*#__PURE__*/_jsxs(_Fragment, {
149
- children: [/*#__PURE__*/_jsx("p", {
150
- className: "px-5 pt-1 text-sm text-muted-foreground",
151
- children: copy.body(runName ?? "The agent")
152
- }), /*#__PURE__*/_jsxs(PanelBody, {
153
- className: "gap-5",
154
- children: [/*#__PURE__*/_jsxs("div", {
155
- className: "flex flex-col gap-0.5",
156
- children: [/*#__PURE__*/_jsx("p", {
157
- className: "text-2xl font-semibold tracking-tight tabular-nums",
158
- children: formatMicroUsd(estimateMicroUsd)
159
- }), /*#__PURE__*/_jsxs("p", {
160
- className: "text-xs text-muted-foreground",
161
- children: ["Next step, estimated. The run would reach", " ", /*#__PURE__*/_jsx("span", {
162
- className: "tabular-nums",
163
- children: formatMicroUsd(projected)
164
- }), "."]
165
- })]
113
+ let t9;
114
+ if ($[15] !== capMicroUsd || $[16] !== copy || $[17] !== decision || $[18] !== estimate || $[19] !== meter || $[20] !== onAllowOnce || $[21] !== onBuyCredits || $[22] !== onRaiseCap || $[23] !== onStop || $[24] !== outOfCredits || $[25] !== primaryRef || $[26] !== projected || $[27] !== runName || $[28] !== situation) {
115
+ t9 = decision ? /*#__PURE__*/_jsx(SettledLine, {
116
+ name: estimate,
117
+ verb: "Asked to spend",
118
+ icon: icon,
119
+ children: /*#__PURE__*/_jsxs("div", {
120
+ className: "flex flex-col gap-3",
121
+ children: [/*#__PURE__*/_jsx(DecisionSummary, {
122
+ decision: decision,
123
+ approvedVerb: "Allowed",
124
+ deniedVerb: "Stopped",
125
+ result: decision.approved ? `Allowed ${estimate} once` : `${runName ?? "The run"} stopped`
166
126
  }), /*#__PURE__*/_jsx(SpendMeter, {
167
- ...meter
168
- }), !outOfCredits && /*#__PURE__*/_jsx(RaiseCapForm, {
169
- capMicroUsd: capMicroUsd,
170
- suggestedMicroUsd: suggestedCapMicroUsd(projected, capMicroUsd),
171
- onRaiseCap: onRaiseCap
127
+ ...meter,
128
+ muted: true
172
129
  })]
173
- }), /*#__PURE__*/_jsxs(PanelFooter, {
174
- className: "justify-between",
175
- children: [/*#__PURE__*/_jsx("span", {
176
- className: "hidden font-mono text-[11px] text-muted-foreground sm:inline",
177
- children: "The run is paused"
178
- }), /*#__PURE__*/_jsxs("span", {
179
- className: "flex flex-wrap gap-2",
180
- children: [/*#__PURE__*/_jsx(Button, {
181
- ref: outOfCredits && !onBuyCredits ? primaryRef : undefined,
182
- type: "button",
183
- size: "sm",
184
- variant: outOfCredits && !onBuyCredits ? "destructive" : "ghost",
185
- onClick: onStop,
186
- children: "Stop the run"
187
- }), outOfCredits ? onBuyCredits && /*#__PURE__*/_jsx(Button, {
188
- ref: primaryRef,
189
- type: "button",
190
- size: "sm",
191
- onClick: onBuyCredits,
192
- children: "Buy credits"
193
- }) : /*#__PURE__*/_jsxs(Button, {
194
- ref: primaryRef,
195
- type: "button",
196
- size: "sm",
197
- onClick: onAllowOnce,
198
- children: ["Allow ", formatMicroUsd(estimateMicroUsd), " once"]
199
- })]
130
+ })
131
+ }) : /*#__PURE__*/_jsxs(_Fragment, {
132
+ children: [/*#__PURE__*/_jsxs(PendingLine, {
133
+ icon: icon,
134
+ status: situationStatus[situation],
135
+ tone: outOfCredits ? "destructive" : "warn",
136
+ iconClassName: outOfCredits ? "text-destructive" : undefined,
137
+ children: ["\xB7 next step costs ", /*#__PURE__*/_jsx("span", {
138
+ className: lineObjectClass,
139
+ children: estimate
200
140
  })]
141
+ }), /*#__PURE__*/_jsxs("p", {
142
+ className: "-mt-2 text-sm text-faint",
143
+ children: [copy.body(runName ?? "The agent"), " The run would reach", " ", /*#__PURE__*/_jsx("span", {
144
+ className: "tabular-nums",
145
+ children: formatMicroUsd(projected)
146
+ }), "."]
147
+ }), /*#__PURE__*/_jsx(SpendMeter, {
148
+ ...meter
149
+ }), /*#__PURE__*/_jsxs("div", {
150
+ className: "flex flex-wrap items-center gap-2 pt-1",
151
+ children: [outOfCredits ? onBuyCredits && /*#__PURE__*/_jsx(Button, {
152
+ ref: primaryRef,
153
+ type: "button",
154
+ size: "sm",
155
+ onClick: onBuyCredits,
156
+ children: "Buy credits"
157
+ }) : /*#__PURE__*/_jsxs(Button, {
158
+ ref: primaryRef,
159
+ type: "button",
160
+ size: "sm",
161
+ onClick: onAllowOnce,
162
+ children: ["Allow ", estimate, " once"]
163
+ }), /*#__PURE__*/_jsx(Button, {
164
+ ref: outOfCredits && !onBuyCredits ? primaryRef : undefined,
165
+ type: "button",
166
+ size: "sm",
167
+ variant: outOfCredits && !onBuyCredits ? "destructive" : "ghost",
168
+ className: outOfCredits && !onBuyCredits ? undefined : "hover:bg-transparent hover:text-destructive",
169
+ onClick: onStop,
170
+ children: "Stop the run"
171
+ })]
172
+ }), !outOfCredits && /*#__PURE__*/_jsx(RaiseCapForm, {
173
+ minimumMicroUsd: minimumCapMicroUsd(projected, capMicroUsd),
174
+ suggestedMicroUsd: suggestedCapMicroUsd(projected, capMicroUsd),
175
+ onRaiseCap: onRaiseCap
201
176
  })]
202
177
  });
203
- $[21] = capMicroUsd;
204
- $[22] = copy;
205
- $[23] = decision;
206
- $[24] = estimateMicroUsd;
207
- $[25] = meter;
208
- $[26] = onAllowOnce;
209
- $[27] = onBuyCredits;
210
- $[28] = onRaiseCap;
211
- $[29] = onStop;
212
- $[30] = outOfCredits;
213
- $[31] = primaryRef;
214
- $[32] = projected;
215
- $[33] = runName;
216
- $[34] = t14;
178
+ $[15] = capMicroUsd;
179
+ $[16] = copy;
180
+ $[17] = decision;
181
+ $[18] = estimate;
182
+ $[19] = meter;
183
+ $[20] = onAllowOnce;
184
+ $[21] = onBuyCredits;
185
+ $[22] = onRaiseCap;
186
+ $[23] = onStop;
187
+ $[24] = outOfCredits;
188
+ $[25] = primaryRef;
189
+ $[26] = projected;
190
+ $[27] = runName;
191
+ $[28] = situation;
192
+ $[29] = t9;
217
193
  } else {
218
- t14 = $[34];
194
+ t9 = $[29];
219
195
  }
220
- const t15 = decision ? decision.approved ? "Spend allowed" : "Run stopped" : copy.title;
221
- let t16;
222
- if ($[35] !== t15) {
223
- t16 = /*#__PURE__*/_jsx(LiveStatus, {
224
- message: t15
196
+ const t10 = decision ? decision.approved ? "Spend allowed" : "Run stopped" : copy.title;
197
+ let t11;
198
+ if ($[30] !== t10) {
199
+ t11 = /*#__PURE__*/_jsx(LiveStatus, {
200
+ message: t10
225
201
  });
226
- $[35] = t15;
227
- $[36] = t16;
202
+ $[30] = t10;
203
+ $[31] = t11;
228
204
  } else {
229
- t16 = $[36];
205
+ t11 = $[31];
230
206
  }
231
- let t17;
232
- if ($[37] !== copy.title || $[38] !== situation || $[39] !== t10 || $[40] !== t13 || $[41] !== t14 || $[42] !== t16 || $[43] !== t6) {
233
- t17 = /*#__PURE__*/_jsxs(ApprovalPanel, {
207
+ let t12;
208
+ if ($[32] !== copy.title || $[33] !== settleRef || $[34] !== situation || $[35] !== t11 || $[36] !== t8 || $[37] !== t9) {
209
+ t12 = /*#__PURE__*/_jsxs("section", {
210
+ ref: settleRef,
211
+ tabIndex: -1,
234
212
  "data-slot": "spend-gate",
235
213
  "data-situation": situation,
236
- "aria-label": t4,
237
- className: t6,
238
- children: [t10, t13, t14, t16]
214
+ "aria-label": t6,
215
+ className: t8,
216
+ children: [t9, t11]
239
217
  });
240
- $[37] = copy.title;
241
- $[38] = situation;
242
- $[39] = t10;
243
- $[40] = t13;
244
- $[41] = t14;
245
- $[42] = t16;
246
- $[43] = t6;
247
- $[44] = t17;
218
+ $[32] = copy.title;
219
+ $[33] = settleRef;
220
+ $[34] = situation;
221
+ $[35] = t11;
222
+ $[36] = t8;
223
+ $[37] = t9;
224
+ $[38] = t12;
248
225
  } else {
249
- t17 = $[44];
226
+ t12 = $[38];
250
227
  }
251
- return t17;
228
+ return t12;
252
229
  }
@@ -1,5 +1,6 @@
1
1
  export type SpendSituation = "over-cap" | "out-of-credits";
2
2
  export declare function spendSituation(balanceMicroUsd: number, estimateMicroUsd: number): SpendSituation;
3
+ export declare function minimumCapMicroUsd(projectedMicroUsd: number, capMicroUsd: number): number;
3
4
  export declare function suggestedCapMicroUsd(projectedMicroUsd: number, capMicroUsd: number): number;
4
5
  export declare function dollarsToMicroUsd(dollars: string): number | null;
5
6
  export declare function microUsdToDollarsInput(microUsd: number): string;
@@ -3,9 +3,12 @@ const microUsdPerCent = 10_000;
3
3
  export function spendSituation(balanceMicroUsd, estimateMicroUsd) {
4
4
  return balanceMicroUsd <= 0 || balanceMicroUsd < estimateMicroUsd ? "out-of-credits" : "over-cap";
5
5
  }
6
+ export function minimumCapMicroUsd(projectedMicroUsd, capMicroUsd) {
7
+ return Math.max(projectedMicroUsd, capMicroUsd + microUsdPerCent);
8
+ }
6
9
  export function suggestedCapMicroUsd(projectedMicroUsd, capMicroUsd) {
7
- const target = Math.max(projectedMicroUsd, capMicroUsd + microUsdPerCent);
8
- return Math.ceil(target / microUsdPerDollar) * microUsdPerDollar;
10
+ const minimum = minimumCapMicroUsd(projectedMicroUsd, capMicroUsd);
11
+ return Math.ceil(minimum / microUsdPerDollar) * microUsdPerDollar;
9
12
  }
10
13
  export function dollarsToMicroUsd(dollars) {
11
14
  const value = Number(dollars.trim());
@@ -54,7 +54,7 @@ function MeterLegend(props) {
54
54
  muted
55
55
  } = props;
56
56
  return /*#__PURE__*/_jsx("div", {
57
- className: "flex flex-wrap justify-between gap-x-4 gap-y-1 text-xs text-muted-foreground tabular-nums",
57
+ className: "flex flex-wrap justify-between gap-x-4 gap-y-1 text-xs text-faint tabular-nums",
58
58
  children: outOfCredits ? /*#__PURE__*/_jsxs(_Fragment, {
59
59
  children: [/*#__PURE__*/_jsxs("span", {
60
60
  children: ["Next step needs ", /*#__PURE__*/_jsx(Amount, {
@@ -105,7 +105,7 @@ export function SpendMeter(props) {
105
105
  "aria-hidden": true,
106
106
  className: "relative h-4",
107
107
  children: /*#__PURE__*/_jsxs("span", {
108
- className: cn("locus-eyebrow absolute bottom-0 whitespace-nowrap", labelAlignment(limitPosition)),
108
+ className: cn("absolute bottom-0 text-xs whitespace-nowrap text-faint tabular-nums", labelAlignment(limitPosition)),
109
109
  style: {
110
110
  left: `${limitPosition}%`
111
111
  },
@@ -118,10 +118,10 @@ export function SpendMeter(props) {
118
118
  "aria-valuemax": scale,
119
119
  "aria-valuenow": projected,
120
120
  "aria-valuetext": `${formatMicroUsd(projected)} after the next step, ${limitLabel.toLowerCase()} ${formatMicroUsd(limit)}`,
121
- className: "relative h-1.5 bg-muted-foreground/20",
121
+ className: "relative h-1 rounded-full bg-muted-foreground/15",
122
122
  children: [/*#__PURE__*/_jsx("span", {
123
123
  "aria-hidden": true,
124
- className: cn("absolute inset-y-0 left-0", muted ? "bg-muted-foreground/40" : "bg-foreground/70"),
124
+ className: cn("absolute inset-y-0 left-0 rounded-l-full", muted ? "bg-muted-foreground/30" : "bg-muted-foreground/60"),
125
125
  style: {
126
126
  width: `${baseWidth}%`
127
127
  }
@@ -134,7 +134,7 @@ export function SpendMeter(props) {
134
134
  }
135
135
  }), /*#__PURE__*/_jsx("span", {
136
136
  "aria-hidden": true,
137
- className: "absolute -inset-y-1 -ml-px w-px bg-foreground",
137
+ className: "absolute -inset-y-1 -ml-px w-px bg-foreground/70",
138
138
  style: {
139
139
  left: `${limitPosition}%`
140
140
  }