@locusgraph/loop 0.3.1 → 0.4.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 (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
@@ -26,7 +26,7 @@ function RingContent({
26
26
  percent: percent,
27
27
  status: status
28
28
  }), /*#__PURE__*/_jsxs("span", {
29
- className: "font-mono text-[11px] tabular-nums",
29
+ className: "font-mono text-2xs tabular-nums",
30
30
  children: [percent, "%"]
31
31
  })]
32
32
  });
@@ -40,7 +40,7 @@ function BarContent({
40
40
  }) {
41
41
  return /*#__PURE__*/_jsxs(_Fragment, {
42
42
  children: [/*#__PURE__*/_jsxs("span", {
43
- className: "flex items-baseline justify-between gap-4 font-mono text-[11px] tabular-nums",
43
+ className: "flex items-baseline justify-between gap-4 font-mono text-2xs tabular-nums",
44
44
  children: [/*#__PURE__*/_jsx("span", {
45
45
  className: "locus-eyebrow",
46
46
  children: label
@@ -80,7 +80,7 @@ export function Context({
80
80
  "aria-valuenow": percent,
81
81
  "aria-valuetext": `${percent}%, ${summary}`,
82
82
  tabIndex: hasBreakdown ? 0 : undefined,
83
- className: cn("outline-none focus-visible:ring-2 focus-visible:ring-ring/70", statusTone[status], variant === "ring" ? "inline-flex h-6 items-center gap-1.5 rounded-full px-2 transition-colors duration-150 motion-reduce:transition-none" : "flex w-full flex-col gap-2", variant === "ring" && hasBreakdown && "cursor-default hover:bg-accent", className),
83
+ className: cn("locus-focus-ring", statusTone[status], variant === "ring" ? "inline-flex h-control-xs items-center gap-1.5 rounded-full px-2 transition-colors duration-150 motion-reduce:transition-none" : "flex w-full flex-col gap-2", variant === "ring" && hasBreakdown && "cursor-default hover:bg-accent", className),
84
84
  children: variant === "ring" ? /*#__PURE__*/_jsx(RingContent, {
85
85
  percent: percent,
86
86
  status: status
@@ -1,9 +1,9 @@
1
- import { Roadmap as ChartNoAxesGanttIcon } from "@carbon/icons-react";
2
- import { formatCount, formatMicroUsd, pluralize } from "@locusgraph/utils";
3
- import { ApprovalPanel, PanelHeader } from "../shared/panel.js";
4
- import { PanelEmpty } from "../shared/panel-empty.js";
1
+ import { cn } from "@locusgraph/components";
2
+ import { formatMicroUsd } from "@locusgraph/utils";
3
+ import { ChartBarHorizontal as ChartNoAxesGanttIcon } from "@phosphor-icons/react/ssr";
4
+ import { lineIconClass, lineRowClass } from "../shared/line.js";
5
5
  import { isWastedStep, StepCostRow } from "./shared/step-cost-row.js";
6
- import { formatDuration, sumUsage } from "./shared/usage-totals.js";
6
+ import { formatDuration, formatTokensShort, sumUsage } from "./shared/usage-totals.js";
7
7
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
8
8
  export function stepCostTotals(steps) {
9
9
  const totals = sumUsage(steps.map(step => step.usage));
@@ -20,18 +20,13 @@ function Totals({
20
20
  }) {
21
21
  return /*#__PURE__*/_jsxs("div", {
22
22
  "data-slot": "step-cost-totals",
23
- className: "flex flex-col gap-1 px-5 pt-2 pb-4",
23
+ className: "flex items-baseline gap-3 pb-2 pl-6 tabular-nums",
24
24
  children: [/*#__PURE__*/_jsx("span", {
25
- className: "text-2xl font-semibold tracking-tight tabular-nums",
25
+ className: "text-xl font-semibold tracking-tight text-foreground",
26
26
  children: formatMicroUsd(totals.costMicroUsd)
27
27
  }), /*#__PURE__*/_jsxs("span", {
28
- className: "flex flex-wrap gap-x-3 gap-y-0.5 text-xs text-muted-foreground tabular-nums",
29
- children: [/*#__PURE__*/_jsxs("span", {
30
- children: [formatCount(totals.inputTokens), " in \xB7 ", formatCount(totals.outputTokens), " out", totals.durationMs > 0 && ` · ${formatDuration(totals.durationMs)}`]
31
- }), totals.wastedMicroUsd > 0 && /*#__PURE__*/_jsxs("span", {
32
- className: "text-destructive",
33
- children: ["Wasted on failures ", formatMicroUsd(totals.wastedMicroUsd)]
34
- })]
28
+ className: "text-xs text-faint",
29
+ children: [formatTokensShort(totals.inputTokens), " in \xB7 ", formatTokensShort(totals.outputTokens), " out", totals.durationMs > 0 && ` · ${formatDuration(totals.durationMs)}`]
35
30
  })]
36
31
  });
37
32
  }
@@ -44,28 +39,34 @@ export function CostSteps({
44
39
  const totals = stepCostTotals(steps);
45
40
  const maxCost = Math.max(0, ...steps.map(step => step.usage.costMicroUsd));
46
41
  const running = steps.some(step => step.status === "running");
47
- return /*#__PURE__*/_jsxs(ApprovalPanel, {
42
+ return /*#__PURE__*/_jsxs("section", {
48
43
  "data-slot": "cost-steps",
49
44
  "aria-label": label,
50
- className: className,
51
- children: [/*#__PURE__*/_jsx(PanelHeader, {
52
- icon: /*#__PURE__*/_jsx(ChartNoAxesGanttIcon, {
53
- "aria-hidden": true
54
- }),
55
- eyebrow: label,
56
- aside: steps.length > 0 ? pluralize(steps.length, "step") : undefined,
57
- status: running ? "Running" : undefined,
58
- tone: "running"
59
- }), steps.length === 0 ? /*#__PURE__*/_jsx(PanelEmpty, {
60
- icon: /*#__PURE__*/_jsx(ChartNoAxesGanttIcon, {
61
- "aria-hidden": true
62
- }),
63
- title: emptyText
45
+ className: cn("flex min-w-0 flex-col", className),
46
+ children: [/*#__PURE__*/_jsxs("header", {
47
+ className: lineRowClass,
48
+ children: [/*#__PURE__*/_jsx("span", {
49
+ "aria-hidden": true,
50
+ className: lineIconClass,
51
+ children: /*#__PURE__*/_jsx(ChartNoAxesGanttIcon, {
52
+ weight: "bold",
53
+ "aria-hidden": true
54
+ })
55
+ }), /*#__PURE__*/_jsx("span", {
56
+ className: "truncate",
57
+ children: label
58
+ }), running && /*#__PURE__*/_jsx("span", {
59
+ className: "shrink-0 text-warn motion-safe:locus-shimmer",
60
+ children: "Running"
61
+ })]
62
+ }), steps.length === 0 ? /*#__PURE__*/_jsx("p", {
63
+ className: "pl-6 text-sm text-faint",
64
+ children: emptyText
64
65
  }) : /*#__PURE__*/_jsxs(_Fragment, {
65
66
  children: [/*#__PURE__*/_jsx(Totals, {
66
67
  totals: totals
67
68
  }), /*#__PURE__*/_jsx("ol", {
68
- className: "flex flex-col divide-y divide-border border-t border-border",
69
+ className: "flex flex-col pl-6",
69
70
  children: steps.map(step => /*#__PURE__*/_jsx(StepCostRow, {
70
71
  step: step,
71
72
  maxCost: maxCost,
package/dist/cost/cost.js CHANGED
@@ -1,8 +1,8 @@
1
- import { Money as CoinsIcon } from "@carbon/icons-react";
2
1
  import { cn } from "@locusgraph/components";
3
- import { formatCount, formatMicroUsd, pluralize } from "@locusgraph/utils";
4
- import { ApprovalPanel, PanelHeader } from "../shared/panel.js";
5
- import { sumUsage } from "./shared/usage-totals.js";
2
+ import { formatMicroUsd, pluralize } from "@locusgraph/utils";
3
+ import { Coins as CoinsIcon } from "@phosphor-icons/react/ssr";
4
+ import { lineIconClass, lineRowClass } from "../shared/line.js";
5
+ import { formatTokensShort, sumUsage } from "./shared/usage-totals.js";
6
6
  import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
7
7
  function attemptsOf(usage) {
8
8
  return Array.isArray(usage) ? usage : [usage];
@@ -31,13 +31,13 @@ function CompactCost({
31
31
  "data-slot": "cost",
32
32
  "data-variant": "compact",
33
33
  "data-failed": totals.failedAttempts > 0 || undefined,
34
- className: cn("inline-flex flex-wrap items-baseline gap-x-3 gap-y-0.5 font-mono text-[11px] text-muted-foreground tabular-nums", className),
34
+ className: cn("inline-flex flex-wrap items-baseline gap-x-3 gap-y-0.5 text-xs text-faint tabular-nums", className),
35
35
  children: [/*#__PURE__*/_jsx("span", {
36
- className: "font-medium text-foreground",
36
+ className: "font-medium text-muted-foreground",
37
37
  children: formatMicroUsd(totals.costMicroUsd)
38
38
  }), /*#__PURE__*/_jsxs("span", {
39
39
  className: "whitespace-nowrap",
40
- children: [formatCount(totals.inputTokens), " in \xB7 ", formatCount(totals.outputTokens), " out"]
40
+ children: [formatTokensShort(totals.inputTokens), " in \xB7 ", formatTokensShort(totals.outputTokens), " out"]
41
41
  }), model && /*#__PURE__*/_jsx("span", {
42
42
  children: model
43
43
  }), /*#__PURE__*/_jsx(WastedNote, {
@@ -46,30 +46,26 @@ function CompactCost({
46
46
  });
47
47
  }
48
48
  function AttemptRow({
49
- attempt,
50
- position
49
+ attempt
51
50
  }) {
52
51
  return /*#__PURE__*/_jsxs("li", {
53
52
  "data-slot": "cost-attempt",
54
53
  "data-failed": attempt.failed || undefined,
55
- className: "grid grid-cols-[1fr_auto_4.5rem] items-baseline gap-x-4 px-5 py-2.5 text-sm tabular-nums",
54
+ className: "flex items-baseline justify-between gap-4 py-0.5 text-sm tabular-nums",
56
55
  children: [/*#__PURE__*/_jsxs("span", {
57
56
  className: "flex min-w-0 items-baseline gap-2",
58
- children: [/*#__PURE__*/_jsxs("span", {
59
- className: "locus-eyebrow",
60
- children: ["#", position + 1]
61
- }), /*#__PURE__*/_jsx("span", {
62
- className: cn("truncate", attempt.failed && "text-muted-foreground"),
57
+ children: [/*#__PURE__*/_jsx("span", {
58
+ className: cn("truncate normal-nums", attempt.failed ? "text-muted-foreground" : "text-foreground"),
63
59
  children: attempt.model ?? "Attempt"
64
60
  }), attempt.failed && /*#__PURE__*/_jsx("span", {
65
- className: "font-mono text-[11px] tracking-wide text-destructive uppercase",
61
+ className: "text-xs font-medium text-destructive",
66
62
  children: "Failed"
67
63
  })]
68
64
  }), /*#__PURE__*/_jsxs("span", {
69
- className: "font-mono text-[11px] text-muted-foreground max-sm:hidden",
70
- children: [formatCount(attempt.inputTokens), " in \xB7 ", formatCount(attempt.outputTokens), " out"]
65
+ className: "ml-auto text-xs text-faint",
66
+ children: [formatTokensShort(attempt.inputTokens), " in \xB7 ", formatTokensShort(attempt.outputTokens), " out"]
71
67
  }), /*#__PURE__*/_jsx("span", {
72
- className: cn("text-right font-mono text-xs", attempt.failed && "text-muted-foreground line-through"),
68
+ className: cn("shrink-0", attempt.failed ? "text-faint line-through decoration-faint" : "text-foreground"),
73
69
  children: formatMicroUsd(attempt.costMicroUsd)
74
70
  })]
75
71
  });
@@ -81,39 +77,43 @@ function DetailedCost({
81
77
  className
82
78
  }) {
83
79
  const failed = totals.failedAttempts > 0;
84
- return /*#__PURE__*/_jsxs(ApprovalPanel, {
80
+ return /*#__PURE__*/_jsxs("section", {
85
81
  "data-slot": "cost",
86
82
  "data-variant": "detailed",
87
83
  "data-failed": failed || undefined,
88
84
  "aria-label": label,
89
- className: className,
90
- children: [/*#__PURE__*/_jsx(PanelHeader, {
91
- icon: /*#__PURE__*/_jsx(CoinsIcon, {
92
- "aria-hidden": true
93
- }),
94
- eyebrow: label,
95
- aside: pluralize(attempts.length, "attempt")
85
+ className: cn("flex min-w-0 flex-col", className),
86
+ children: [/*#__PURE__*/_jsxs("header", {
87
+ className: lineRowClass,
88
+ children: [/*#__PURE__*/_jsx("span", {
89
+ "aria-hidden": true,
90
+ className: lineIconClass,
91
+ children: /*#__PURE__*/_jsx(CoinsIcon, {
92
+ weight: "bold",
93
+ "aria-hidden": true
94
+ })
95
+ }), /*#__PURE__*/_jsx("span", {
96
+ className: "truncate",
97
+ children: label
98
+ })]
96
99
  }), /*#__PURE__*/_jsxs("div", {
97
- className: "flex flex-col gap-1 px-5 pt-2 pb-4",
100
+ className: "flex flex-wrap items-baseline gap-x-3 gap-y-0.5 pb-2 pl-6 text-xs tabular-nums",
98
101
  children: [/*#__PURE__*/_jsx("span", {
99
- className: "text-2xl font-semibold tracking-tight tabular-nums",
102
+ className: "text-xl font-semibold tracking-tight text-foreground",
100
103
  children: formatMicroUsd(totals.costMicroUsd)
101
104
  }), /*#__PURE__*/_jsxs("span", {
102
- className: "flex flex-wrap gap-x-3 gap-y-0.5 text-xs text-muted-foreground tabular-nums",
103
- children: [/*#__PURE__*/_jsxs("span", {
104
- children: [formatCount(totals.inputTokens), " in \xB7 ", formatCount(totals.outputTokens), " out"]
105
- }), /*#__PURE__*/_jsx(WastedNote, {
106
- totals: totals
107
- })]
105
+ className: "text-faint",
106
+ children: [formatTokensShort(totals.inputTokens), " in \xB7 ", formatTokensShort(totals.outputTokens), " out"]
107
+ }), /*#__PURE__*/_jsx(WastedNote, {
108
+ totals: totals
108
109
  })]
109
- }), /*#__PURE__*/_jsx("ol", {
110
- className: "flex flex-col divide-y divide-border border-t border-border",
110
+ }), attempts.length > 1 && /*#__PURE__*/_jsx("ol", {
111
+ className: "flex max-w-sm flex-col pl-6",
111
112
  children: attempts.map((attempt, position) =>
112
113
  /*#__PURE__*/
113
114
  // biome-ignore lint/suspicious/noArrayIndexKey: attempts carry no id and keep their order
114
115
  _jsx(AttemptRow, {
115
- attempt: attempt,
116
- position: position
116
+ attempt: attempt
117
117
  }, position))
118
118
  })]
119
119
  });
@@ -1,8 +1,8 @@
1
1
  "use client";
2
2
 
3
3
  import { c as _c } from "react/compiler-runtime";
4
- import { ChevronDown as ChevronDownIcon } from "@carbon/icons-react";
5
4
  import { cn, DropdownMenu, DropdownMenuContent, DropdownMenuLabel, DropdownMenuRadioGroup, DropdownMenuTrigger } from "@locusgraph/components";
5
+ import { CaretDown as ChevronDownIcon } from "@phosphor-icons/react/ssr";
6
6
  import { ModelOptionRow } from "./shared/model-option-row.js";
7
7
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
8
8
  export { modelPriceLabel } from "./shared/model-option-row.js";
@@ -39,7 +39,7 @@ export function ModelPicker(t0) {
39
39
  const t4 = `${label}: ${selected?.name ?? "none selected"}`;
40
40
  let t5;
41
41
  if ($[5] !== className) {
42
- t5 = cn("group inline-flex h-7 max-w-full items-center gap-1.5 rounded-full px-2.5 text-xs outline-none transition-colors duration-150 hover:bg-accent focus-visible:ring-2 focus-visible:ring-ring/70 disabled:pointer-events-none disabled:opacity-50 data-[state=open]:bg-accent motion-reduce:transition-none", className);
42
+ t5 = cn("group inline-flex h-control-sm max-w-full items-center gap-1.5 rounded-full px-2.5 text-xs locus-focus-ring transition-colors duration-150 hover:bg-accent disabled:pointer-events-none disabled:opacity-50 data-[state=open]:bg-accent motion-reduce:transition-none", className);
43
43
  $[5] = className;
44
44
  $[6] = t5;
45
45
  } else {
@@ -71,6 +71,7 @@ export function ModelPicker(t0) {
71
71
  let t9;
72
72
  if ($[11] === Symbol.for("react.memo_cache_sentinel")) {
73
73
  t9 = /*#__PURE__*/_jsx(ChevronDownIcon, {
74
+ weight: "bold",
74
75
  "aria-hidden": true,
75
76
  className: "size-3 shrink-0 text-muted-foreground transition-transform duration-150 group-data-[state=open]:rotate-180 motion-reduce:transition-none"
76
77
  });
@@ -121,7 +122,7 @@ export function ModelPicker(t0) {
121
122
  let t13;
122
123
  if ($[22] !== t11) {
123
124
  t13 = /*#__PURE__*/_jsxs(DropdownMenuLabel, {
124
- className: "locus-eyebrow flex justify-between gap-3 border-b border-border px-3 py-2 font-normal",
125
+ className: "locus-eyebrow flex justify-between gap-3 px-3 pt-2.5 pb-1 font-normal",
125
126
  children: [t11, t12]
126
127
  });
127
128
  $[22] = t11;
@@ -142,7 +143,7 @@ export function ModelPicker(t0) {
142
143
  t15 = /*#__PURE__*/_jsx(DropdownMenuRadioGroup, {
143
144
  value: value,
144
145
  onValueChange: onChange,
145
- className: "flex flex-col divide-y divide-border",
146
+ className: "flex flex-col pb-1",
146
147
  children: t14
147
148
  });
148
149
  $[26] = onChange;
@@ -1,6 +1,7 @@
1
1
  import { cn } from "@locusgraph/components";
2
- import { formatCount, quotaPercent } from "@locusgraph/utils";
2
+ import { formatCount } from "@locusgraph/utils";
3
3
  import { MeterBar } from "./meter-marks.js";
4
+ import { wholePercentsOf } from "./usage-totals.js";
4
5
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
5
6
  const statusWord = {
6
7
  ok: "Room left",
@@ -15,11 +16,11 @@ const statusDot = {
15
16
  function SegmentRow({
16
17
  label,
17
18
  tokens,
18
- limitTokens,
19
+ percent,
19
20
  muted = false
20
21
  }) {
21
22
  return /*#__PURE__*/_jsxs("li", {
22
- className: cn("grid grid-cols-[1fr_auto_3rem] items-baseline gap-x-3 px-4 py-2 text-xs tabular-nums", muted && "text-muted-foreground"),
23
+ className: cn("grid grid-cols-[1fr_auto_3rem] items-baseline gap-x-3 px-4 py-1.5 text-xs tabular-nums", muted && "text-muted-foreground"),
23
24
  children: [/*#__PURE__*/_jsx("span", {
24
25
  className: "truncate",
25
26
  children: label
@@ -28,10 +29,7 @@ function SegmentRow({
28
29
  children: formatCount(tokens)
29
30
  }), /*#__PURE__*/_jsxs("span", {
30
31
  className: "text-right font-mono text-muted-foreground",
31
- children: [quotaPercent({
32
- used: tokens,
33
- included: limitTokens
34
- }), "%"]
32
+ children: [percent, "%"]
35
33
  })]
36
34
  });
37
35
  }
@@ -44,6 +42,7 @@ export function ContextBreakdown({
44
42
  breakdown
45
43
  }) {
46
44
  const freeTokens = Math.max(limitTokens - usedTokens, 0);
45
+ const shares = wholePercentsOf([...breakdown.map(segment => segment.tokens), freeTokens], limitTokens);
47
46
  return /*#__PURE__*/_jsxs("div", {
48
47
  "data-slot": "context-breakdown",
49
48
  className: "flex flex-col",
@@ -74,15 +73,15 @@ export function ContextBreakdown({
74
73
  status: status
75
74
  })]
76
75
  }), /*#__PURE__*/_jsxs("ul", {
77
- className: "flex flex-col divide-y divide-border border-t border-border",
78
- children: [breakdown.map(segment => /*#__PURE__*/_jsx(SegmentRow, {
76
+ className: "flex flex-col pb-2",
77
+ children: [breakdown.map((segment, index) => /*#__PURE__*/_jsx(SegmentRow, {
79
78
  label: segment.label,
80
79
  tokens: segment.tokens,
81
- limitTokens: limitTokens
80
+ percent: shares[index] ?? 0
82
81
  }, segment.label)), /*#__PURE__*/_jsx(SegmentRow, {
83
82
  label: "Free",
84
83
  tokens: freeTokens,
85
- limitTokens: limitTokens,
84
+ percent: shares.at(-1) ?? 0,
86
85
  muted: true
87
86
  })]
88
87
  })]
@@ -1,6 +1,6 @@
1
- import { Checkmark as CheckIcon } from "@carbon/icons-react";
2
1
  import { DropdownMenuRadioItem } from "@locusgraph/components";
3
2
  import { formatMicroUsd } from "@locusgraph/utils";
3
+ import { Check as CheckIcon } from "@phosphor-icons/react/ssr";
4
4
  import { formatTokensShort } from "./usage-totals.js";
5
5
  import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
6
6
  const speedLabel = {
@@ -25,7 +25,7 @@ function PriceColumn({
25
25
  const input = model.inputPerMillionMicroUsd;
26
26
  const output = model.outputPerMillionMicroUsd;
27
27
  return /*#__PURE__*/_jsxs("span", {
28
- className: "flex flex-col items-end font-mono text-[11px] text-muted-foreground tabular-nums",
28
+ className: "flex flex-col items-end font-mono text-2xs text-muted-foreground tabular-nums",
29
29
  children: [input !== undefined && /*#__PURE__*/_jsxs("span", {
30
30
  children: [formatMicroUsd(input), " in"]
31
31
  }), output !== undefined && /*#__PURE__*/_jsxs("span", {
@@ -53,12 +53,13 @@ export function ModelOptionRow({
53
53
  children: model.provider
54
54
  })]
55
55
  }), facts.length > 0 && /*#__PURE__*/_jsx("span", {
56
- className: "font-mono text-[11px] text-muted-foreground tabular-nums",
56
+ className: "font-mono text-2xs text-muted-foreground tabular-nums",
57
57
  children: facts.join(" · ")
58
58
  })]
59
59
  }), /*#__PURE__*/_jsx(PriceColumn, {
60
60
  model: model
61
61
  }), /*#__PURE__*/_jsx(CheckIcon, {
62
+ weight: "bold",
62
63
  "aria-hidden": true,
63
64
  className: "size-4 text-foreground opacity-0 group-data-[state=checked]:opacity-100"
64
65
  })]
@@ -7,9 +7,8 @@ export function isWastedStep(step) {
7
7
  }
8
8
  function barTone(step) {
9
9
  if (isWastedStep(step)) return "bg-destructive";
10
- if (step.status === "retried") return "bg-warn/40";
11
10
  if (step.status === "running") return "bg-warn/60 motion-safe:animate-pulse";
12
- return "bg-primary/35";
11
+ return "bg-muted-foreground/50";
13
12
  }
14
13
  const statusMark = {
15
14
  failed: {
@@ -22,11 +21,11 @@ const statusMark = {
22
21
  },
23
22
  running: {
24
23
  text: "Running",
25
- className: "text-muted-foreground"
24
+ className: "text-muted-foreground motion-safe:locus-shimmer"
26
25
  },
27
26
  skipped: {
28
27
  text: "Skipped",
29
- className: "text-muted-foreground"
28
+ className: "font-normal text-faint"
30
29
  }
31
30
  };
32
31
  function barWidth(cost, maxCost) {
@@ -47,30 +46,30 @@ export function StepCostRow({
47
46
  "data-status": step.status,
48
47
  "data-wasted": wasted || undefined,
49
48
  "aria-label": `${step.title}: ${formatMicroUsd(cost)}, ${share}% of run${mark ? `, ${mark.text.toLowerCase()}` : ""}`,
50
- className: "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]",
49
+ className: "grid grid-cols-[minmax(0,11rem)_1fr_3.5rem_4.5rem] items-center gap-x-4 gap-y-1.5 py-1 text-sm tabular-nums max-sm:grid-cols-[1fr_auto_auto]",
51
50
  children: [/*#__PURE__*/_jsxs("span", {
52
- className: "flex min-w-0 items-baseline gap-2",
51
+ className: "flex min-w-0 items-baseline gap-x-2 max-sm:flex-wrap",
53
52
  children: [/*#__PURE__*/_jsx("span", {
54
- className: cn("truncate", step.status === "skipped" && "text-muted-foreground"),
53
+ className: cn("text-foreground normal-nums sm:truncate", step.status === "skipped" && "text-faint"),
55
54
  children: step.title
56
55
  }), mark && /*#__PURE__*/_jsx("span", {
57
- className: cn("shrink-0 font-mono text-[11px] tracking-wide uppercase", mark.className),
56
+ className: cn("shrink-0 text-xs font-medium", mark.className),
58
57
  children: mark.text
59
58
  })]
60
59
  }), /*#__PURE__*/_jsx("span", {
61
60
  "aria-hidden": true,
62
- className: "relative h-1.5 w-full bg-muted-foreground/10 max-sm:col-span-3 max-sm:row-start-2",
61
+ className: "relative h-1 w-full overflow-hidden rounded-full bg-muted-foreground/10 max-sm:col-span-3 max-sm:row-start-2",
63
62
  children: /*#__PURE__*/_jsx("span", {
64
- className: cn("absolute inset-y-0 left-0 transition-[width] duration-300 motion-reduce:transition-none", barTone(step)),
63
+ className: cn("absolute inset-y-0 left-0 rounded-full transition-[width] duration-300 motion-reduce:transition-none", barTone(step)),
65
64
  style: {
66
65
  width: `${barWidth(cost, maxCost)}%`
67
66
  }
68
67
  })
69
68
  }), /*#__PURE__*/_jsx("span", {
70
- className: "text-right font-mono text-[11px] text-muted-foreground",
69
+ className: "text-right text-xs text-faint",
71
70
  children: step.durationMs !== undefined ? formatDuration(step.durationMs) : ""
72
71
  }), /*#__PURE__*/_jsx("span", {
73
- className: cn("text-right font-mono text-xs", wasted && "text-destructive"),
72
+ className: cn("text-right", wasted ? "text-destructive" : "text-foreground"),
74
73
  children: formatMicroUsd(cost)
75
74
  })]
76
75
  });
@@ -9,3 +9,4 @@ export type UsageTotals = {
9
9
  export declare function sumUsage(attempts: RunUsage[]): UsageTotals;
10
10
  export declare function formatTokensShort(tokens: number): string;
11
11
  export declare function formatDuration(durationMs: number): string;
12
+ export declare function wholePercentsOf(parts: number[], whole: number): number[];
@@ -18,7 +18,7 @@ const compactCount = new Intl.NumberFormat("en-US", {
18
18
  maximumFractionDigits: 1
19
19
  });
20
20
  export function formatTokensShort(tokens) {
21
- return compactCount.format(tokens);
21
+ return compactCount.format(tokens).replace("K", "k");
22
22
  }
23
23
  export function formatDuration(durationMs) {
24
24
  if (durationMs < 1000) return `${Math.round(durationMs)}ms`;
@@ -28,3 +28,21 @@ export function formatDuration(durationMs) {
28
28
  const remainder = Math.round(seconds % 60);
29
29
  return `${minutes}m ${String(remainder).padStart(2, "0")}s`;
30
30
  }
31
+ export function wholePercentsOf(parts, whole) {
32
+ if (whole <= 0) return parts.map(() => 0);
33
+ const exact = parts.map(part => part / whole * 100);
34
+ const sum = parts.reduce((total, part) => total + part, 0);
35
+ if (sum !== whole) return exact.map(percent => Math.round(percent));
36
+ const floors = exact.map(percent => Math.floor(percent));
37
+ const missing = 100 - floors.reduce((total, percent) => total + percent, 0);
38
+ const byLargestRemainder = exact.map((percent, index) => ({
39
+ index,
40
+ remainder: percent - Math.floor(percent)
41
+ })).sort((first, second) => second.remainder - first.remainder);
42
+ for (const {
43
+ index
44
+ } of byLargestRemainder.slice(0, missing)) {
45
+ floors[index] = (floors[index] ?? 0) + 1;
46
+ }
47
+ return floors;
48
+ }