@locusgraph/loop 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (115) hide show
  1. package/README.md +2 -0
  2. package/dist/agent/pulse/gradient-label.js +86 -15
  3. package/dist/agent/pulse/marks/bars-mark.js +46 -10
  4. package/dist/agent/pulse/marks/glyph-mark.js +56 -11
  5. package/dist/agent/pulse/marks/locus-mark.js +63 -28
  6. package/dist/agent/pulse/marks/orb-mark.js +31 -8
  7. package/dist/agent/pulse/marks/spinner-mark.js +29 -1
  8. package/dist/agent/pulse/pulse.js +150 -35
  9. package/dist/agent/pulse/use-loop-animation.js +36 -17
  10. package/dist/agent/steps/step-icon.js +110 -24
  11. package/dist/agent/steps/steps.js +235 -25
  12. package/dist/agent/thinking/thinking.js +203 -23
  13. package/dist/agent/thinking/thought-duration.js +7 -9
  14. package/dist/agent/tool/json-block.js +38 -11
  15. package/dist/agent/tool/tool-status.js +51 -18
  16. package/dist/agent/tool/tool.js +184 -6
  17. package/dist/approval/inbox/inbox-row.d.ts +3 -2
  18. package/dist/approval/inbox/inbox-row.js +321 -7
  19. package/dist/approval/inbox/inbox-selection.js +7 -13
  20. package/dist/approval/inbox/inbox.d.ts +2 -1
  21. package/dist/approval/inbox/inbox.js +250 -18
  22. package/dist/approval/inbox/virtual-inbox-list.d.ts +13 -0
  23. package/dist/approval/inbox/virtual-inbox-list.js +129 -0
  24. package/dist/approval/memory/memory-choices.js +27 -22
  25. package/dist/approval/memory/memory-review.js +242 -17
  26. package/dist/approval/memory/memory-row.js +215 -19
  27. package/dist/approval/plan/plan-review.js +279 -28
  28. package/dist/approval/plan/plan-step-row.js +194 -43
  29. package/dist/approval/plan/plan-steps.js +24 -23
  30. package/dist/approval/plan/question-choices.js +158 -39
  31. package/dist/approval/plan/question.d.ts +1 -1
  32. package/dist/approval/plan/question.js +223 -26
  33. package/dist/approval/run/run-bar.js +178 -22
  34. package/dist/approval/shared/decision-line.js +1 -1
  35. package/dist/approval/shared/risk-badge.js +47 -16
  36. package/dist/approval/shared/time.js +5 -8
  37. package/dist/approval/shared/use-focus-on-mount.js +23 -6
  38. package/dist/approval/spend/raise-cap-form.js +235 -17
  39. package/dist/approval/spend/spend-gate.js +239 -21
  40. package/dist/approval/spend/spend-math.js +7 -8
  41. package/dist/approval/spend/spend-meter.js +362 -34
  42. package/dist/approval/tool/approval.js +272 -27
  43. package/dist/approval/tool/args/args-editor.js +262 -26
  44. package/dist/approval/tool/args/args-field.js +259 -19
  45. package/dist/approval/tool/args/args-validation.js +38 -47
  46. package/dist/approval/tool/deny-form.js +130 -10
  47. package/dist/approval/tool/tool-inputs.js +127 -38
  48. package/dist/chat/chat/chat-item-spacing.d.ts +3 -0
  49. package/dist/chat/chat/chat-item-spacing.js +19 -0
  50. package/dist/chat/chat/chat.d.ts +2 -1
  51. package/dist/chat/chat/chat.js +181 -5
  52. package/dist/chat/chat/use-stick-to-bottom.js +123 -47
  53. package/dist/chat/chat/virtual-chat-items.d.ts +8 -0
  54. package/dist/chat/chat/virtual-chat-items.js +153 -0
  55. package/dist/chat/composer/composer-actions.js +151 -16
  56. package/dist/chat/composer/composer.js +330 -32
  57. package/dist/chat/composer/use-auto-grow.js +24 -9
  58. package/dist/chat/files/file-meta.js +19 -19
  59. package/dist/chat/files/files.js +316 -28
  60. package/dist/chat/reply/fenced-code.js +45 -21
  61. package/dist/chat/reply/markdown-components.js +137 -17
  62. package/dist/chat/reply/reply.js +105 -10
  63. package/dist/chat/turn/group-parts.js +43 -29
  64. package/dist/chat/turn/turn.js +238 -30
  65. package/dist/cost/context.js +321 -23
  66. package/dist/cost/cost-steps.js +220 -14
  67. package/dist/cost/cost.js +521 -27
  68. package/dist/cost/model-picker.js +181 -6
  69. package/dist/cost/shared/context-breakdown.js +299 -10
  70. package/dist/cost/shared/meter-marks.js +107 -9
  71. package/dist/cost/shared/model-option-row.js +178 -21
  72. package/dist/cost/shared/step-cost-row.js +248 -20
  73. package/dist/cost/shared/usage-totals.js +22 -18
  74. package/dist/memory/cite.js +182 -11
  75. package/dist/memory/memorized.js +217 -11
  76. package/dist/memory/recall.js +296 -17
  77. package/dist/memory/shared/host-label.js +19 -22
  78. package/dist/memory/shared/source-mark.js +39 -3
  79. package/dist/memory/sources.js +255 -13
  80. package/dist/shared/decision-summary.js +133 -14
  81. package/dist/shared/panel-empty.js +78 -3
  82. package/dist/shared/panel.js +243 -13
  83. package/dist/shared/status-dot.js +38 -8
  84. package/dist/shared/virtual/use-list-virtualizer.d.ts +24 -0
  85. package/dist/shared/virtual/use-list-virtualizer.js +68 -0
  86. package/dist/thread/actions/action-button.js +65 -3
  87. package/dist/thread/actions/actions.js +184 -13
  88. package/dist/thread/actions/branch-switcher.js +102 -5
  89. package/dist/thread/canvas/canvas.js +205 -5
  90. package/dist/thread/canvas/version-switcher.js +149 -8
  91. package/dist/thread/code/code.js +186 -24
  92. package/dist/thread/code/copy-code-button.js +61 -13
  93. package/dist/thread/code/highlight.js +30 -29
  94. package/dist/thread/history/history-rows.d.ts +16 -0
  95. package/dist/thread/history/history-rows.js +23 -0
  96. package/dist/thread/history/history.d.ts +3 -2
  97. package/dist/thread/history/history.js +174 -5
  98. package/dist/thread/history/{history-row.d.ts → row/history-row.d.ts} +3 -2
  99. package/dist/thread/history/row/history-row.js +137 -0
  100. package/dist/thread/history/row/thread-item-menu.js +84 -0
  101. package/dist/thread/history/row/thread-title-editor.js +81 -0
  102. package/dist/thread/history/thread-groups.d.ts +1 -1
  103. package/dist/thread/history/thread-groups.js +40 -34
  104. package/dist/thread/history/virtual-history-list.d.ts +11 -0
  105. package/dist/thread/history/virtual-history-list.js +107 -0
  106. package/dist/thread/index.d.ts +1 -1
  107. package/dist/thread/starters/starters.js +92 -7
  108. package/dist/thread/use-copied.js +45 -15
  109. package/dist/types.js +1 -1
  110. package/package.json +6 -4
  111. package/dist/thread/history/history-row.js +0 -17
  112. package/dist/thread/history/thread-item-menu.js +0 -6
  113. package/dist/thread/history/thread-title-editor.js +0 -25
  114. /package/dist/thread/history/{thread-item-menu.d.ts → row/thread-item-menu.d.ts} +0 -0
  115. /package/dist/thread/history/{thread-title-editor.d.ts → row/thread-title-editor.d.ts} +0 -0
@@ -1,9 +1,184 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { c as _c } from "react/compiler-runtime";
2
2
  import { ChevronDown as ChevronDownIcon } from "@carbon/icons-react";
3
- import { cn, DropdownMenu, DropdownMenuContent, DropdownMenuLabel, DropdownMenuRadioGroup, DropdownMenuTrigger, } from "@locusgraph/components";
3
+ import { cn, DropdownMenu, DropdownMenuContent, DropdownMenuLabel, DropdownMenuRadioGroup, DropdownMenuTrigger } from "@locusgraph/components";
4
4
  import { ModelOptionRow } from "./shared/model-option-row.js";
5
- export { modelPriceLabel, } from "./shared/model-option-row.js";
6
- export function ModelPicker({ models, value, onChange, label = "Model", disabled = false, className, }) {
7
- const selected = models.find((model) => model.id === value);
8
- return (_jsxs(DropdownMenu, { children: [_jsxs(DropdownMenuTrigger, { "data-slot": "model-picker", "data-value": value, disabled: disabled, "aria-label": `${label}: ${selected?.name ?? "none selected"}`, className: 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), children: [_jsx("span", { className: "truncate font-medium", children: selected?.name ?? label }), selected && (_jsx("span", { className: "truncate text-muted-foreground max-sm:hidden", children: selected.provider })), _jsx(ChevronDownIcon, { "aria-hidden": true, className: "size-3 shrink-0 text-muted-foreground transition-transform duration-150 group-data-[state=open]:rotate-180 motion-reduce:transition-none" })] }), _jsxs(DropdownMenuContent, { align: "start", sideOffset: 6, className: "w-80 rounded-none border-0 bg-popover p-0 shadow-overlay ring-1 ring-border", children: [_jsxs(DropdownMenuLabel, { className: "eyebrow flex justify-between gap-3 border-b border-border px-3 py-2 font-normal", children: [_jsx("span", { children: label }), _jsx("span", { className: "pr-7", children: "Per 1M tokens" })] }), _jsx(DropdownMenuRadioGroup, { value: value, onValueChange: onChange, className: "flex flex-col divide-y divide-border", children: models.map((model) => (_jsx(ModelOptionRow, { model: model }, model.id))) })] })] }));
5
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
6
+ export { modelPriceLabel } from "./shared/model-option-row.js";
7
+ export function ModelPicker(t0) {
8
+ const $ = _c(36);
9
+ const {
10
+ models,
11
+ value,
12
+ onChange,
13
+ label: t1,
14
+ disabled: t2,
15
+ className
16
+ } = t0;
17
+ const label = t1 === undefined ? "Model" : t1;
18
+ const disabled = t2 === undefined ? false : t2;
19
+ let t3;
20
+ if ($[0] !== models || $[1] !== value) {
21
+ let t4;
22
+ if ($[3] !== value) {
23
+ t4 = model => model.id === value;
24
+ $[3] = value;
25
+ $[4] = t4;
26
+ } else {
27
+ t4 = $[4];
28
+ }
29
+ t3 = models.find(t4);
30
+ $[0] = models;
31
+ $[1] = value;
32
+ $[2] = t3;
33
+ } else {
34
+ t3 = $[2];
35
+ }
36
+ const selected = t3;
37
+ const t4 = `${label}: ${selected?.name ?? "none selected"}`;
38
+ let t5;
39
+ if ($[5] !== className) {
40
+ 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);
41
+ $[5] = className;
42
+ $[6] = t5;
43
+ } else {
44
+ t5 = $[6];
45
+ }
46
+ const t6 = selected?.name ?? label;
47
+ let t7;
48
+ if ($[7] !== t6) {
49
+ t7 = /*#__PURE__*/_jsx("span", {
50
+ className: "truncate font-medium",
51
+ children: t6
52
+ });
53
+ $[7] = t6;
54
+ $[8] = t7;
55
+ } else {
56
+ t7 = $[8];
57
+ }
58
+ let t8;
59
+ if ($[9] !== selected) {
60
+ t8 = selected && /*#__PURE__*/_jsx("span", {
61
+ className: "truncate text-muted-foreground max-sm:hidden",
62
+ children: selected.provider
63
+ });
64
+ $[9] = selected;
65
+ $[10] = t8;
66
+ } else {
67
+ t8 = $[10];
68
+ }
69
+ let t9;
70
+ if ($[11] === Symbol.for("react.memo_cache_sentinel")) {
71
+ t9 = /*#__PURE__*/_jsx(ChevronDownIcon, {
72
+ "aria-hidden": true,
73
+ className: "size-3 shrink-0 text-muted-foreground transition-transform duration-150 group-data-[state=open]:rotate-180 motion-reduce:transition-none"
74
+ });
75
+ $[11] = t9;
76
+ } else {
77
+ t9 = $[11];
78
+ }
79
+ let t10;
80
+ if ($[12] !== disabled || $[13] !== t4 || $[14] !== t5 || $[15] !== t7 || $[16] !== t8 || $[17] !== value) {
81
+ t10 = /*#__PURE__*/_jsxs(DropdownMenuTrigger, {
82
+ "data-slot": "model-picker",
83
+ "data-value": value,
84
+ disabled: disabled,
85
+ "aria-label": t4,
86
+ className: t5,
87
+ children: [t7, t8, t9]
88
+ });
89
+ $[12] = disabled;
90
+ $[13] = t4;
91
+ $[14] = t5;
92
+ $[15] = t7;
93
+ $[16] = t8;
94
+ $[17] = value;
95
+ $[18] = t10;
96
+ } else {
97
+ t10 = $[18];
98
+ }
99
+ let t11;
100
+ if ($[19] !== label) {
101
+ t11 = /*#__PURE__*/_jsx("span", {
102
+ children: label
103
+ });
104
+ $[19] = label;
105
+ $[20] = t11;
106
+ } else {
107
+ t11 = $[20];
108
+ }
109
+ let t12;
110
+ if ($[21] === Symbol.for("react.memo_cache_sentinel")) {
111
+ t12 = /*#__PURE__*/_jsx("span", {
112
+ className: "pr-7",
113
+ children: "Per 1M tokens"
114
+ });
115
+ $[21] = t12;
116
+ } else {
117
+ t12 = $[21];
118
+ }
119
+ let t13;
120
+ if ($[22] !== t11) {
121
+ t13 = /*#__PURE__*/_jsxs(DropdownMenuLabel, {
122
+ className: "eyebrow flex justify-between gap-3 border-b border-border px-3 py-2 font-normal",
123
+ children: [t11, t12]
124
+ });
125
+ $[22] = t11;
126
+ $[23] = t13;
127
+ } else {
128
+ t13 = $[23];
129
+ }
130
+ let t14;
131
+ if ($[24] !== models) {
132
+ t14 = models.map(_temp);
133
+ $[24] = models;
134
+ $[25] = t14;
135
+ } else {
136
+ t14 = $[25];
137
+ }
138
+ let t15;
139
+ if ($[26] !== onChange || $[27] !== t14 || $[28] !== value) {
140
+ t15 = /*#__PURE__*/_jsx(DropdownMenuRadioGroup, {
141
+ value: value,
142
+ onValueChange: onChange,
143
+ className: "flex flex-col divide-y divide-border",
144
+ children: t14
145
+ });
146
+ $[26] = onChange;
147
+ $[27] = t14;
148
+ $[28] = value;
149
+ $[29] = t15;
150
+ } else {
151
+ t15 = $[29];
152
+ }
153
+ let t16;
154
+ if ($[30] !== t13 || $[31] !== t15) {
155
+ t16 = /*#__PURE__*/_jsxs(DropdownMenuContent, {
156
+ align: "start",
157
+ sideOffset: 6,
158
+ className: "w-80 rounded-none border-0 bg-popover p-0 shadow-overlay ring-1 ring-border",
159
+ children: [t13, t15]
160
+ });
161
+ $[30] = t13;
162
+ $[31] = t15;
163
+ $[32] = t16;
164
+ } else {
165
+ t16 = $[32];
166
+ }
167
+ let t17;
168
+ if ($[33] !== t10 || $[34] !== t16) {
169
+ t17 = /*#__PURE__*/_jsxs(DropdownMenu, {
170
+ children: [t10, t16]
171
+ });
172
+ $[33] = t10;
173
+ $[34] = t16;
174
+ $[35] = t17;
175
+ } else {
176
+ t17 = $[35];
177
+ }
178
+ return t17;
179
+ }
180
+ function _temp(model_0) {
181
+ return /*#__PURE__*/_jsx(ModelOptionRow, {
182
+ model: model_0
183
+ }, model_0.id);
9
184
  }
@@ -1,17 +1,306 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { c as _c } from "react/compiler-runtime";
2
2
  import { cn } from "@locusgraph/components";
3
3
  import { formatCount, quotaPercent } from "@locusgraph/utils";
4
4
  import { MeterBar } from "./meter-marks.js";
5
- const statusWord = { ok: "Room left", near: "Near limit", full: "Full" };
5
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
6
+ const statusWord = {
7
+ ok: "Room left",
8
+ near: "Near limit",
9
+ full: "Full"
10
+ };
6
11
  const statusDot = {
7
- ok: "bg-good",
8
- near: "bg-warn",
9
- full: "bg-destructive",
12
+ ok: "bg-good",
13
+ near: "bg-warn",
14
+ full: "bg-destructive"
10
15
  };
11
- function SegmentRow({ label, tokens, limitTokens, muted = false, }) {
12
- return (_jsxs("li", { 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"), children: [_jsx("span", { className: "truncate", children: label }), _jsx("span", { className: "font-mono", children: formatCount(tokens) }), _jsxs("span", { className: "text-right font-mono text-muted-foreground", children: [quotaPercent({ used: tokens, included: limitTokens }), "%"] })] }));
16
+ function SegmentRow(t0) {
17
+ const $ = _c(18);
18
+ const {
19
+ label,
20
+ tokens,
21
+ limitTokens,
22
+ muted: t1
23
+ } = t0;
24
+ const muted = t1 === undefined ? false : t1;
25
+ const t2 = muted && "text-muted-foreground";
26
+ let t3;
27
+ if ($[0] !== t2) {
28
+ t3 = cn("grid grid-cols-[1fr_auto_3rem] items-baseline gap-x-3 px-4 py-2 text-xs tabular-nums", t2);
29
+ $[0] = t2;
30
+ $[1] = t3;
31
+ } else {
32
+ t3 = $[1];
33
+ }
34
+ let t4;
35
+ if ($[2] !== label) {
36
+ t4 = /*#__PURE__*/_jsx("span", {
37
+ className: "truncate",
38
+ children: label
39
+ });
40
+ $[2] = label;
41
+ $[3] = t4;
42
+ } else {
43
+ t4 = $[3];
44
+ }
45
+ let t5;
46
+ if ($[4] !== tokens) {
47
+ t5 = formatCount(tokens);
48
+ $[4] = tokens;
49
+ $[5] = t5;
50
+ } else {
51
+ t5 = $[5];
52
+ }
53
+ let t6;
54
+ if ($[6] !== t5) {
55
+ t6 = /*#__PURE__*/_jsx("span", {
56
+ className: "font-mono",
57
+ children: t5
58
+ });
59
+ $[6] = t5;
60
+ $[7] = t6;
61
+ } else {
62
+ t6 = $[7];
63
+ }
64
+ let t7;
65
+ if ($[8] !== limitTokens || $[9] !== tokens) {
66
+ t7 = quotaPercent({
67
+ used: tokens,
68
+ included: limitTokens
69
+ });
70
+ $[8] = limitTokens;
71
+ $[9] = tokens;
72
+ $[10] = t7;
73
+ } else {
74
+ t7 = $[10];
75
+ }
76
+ let t8;
77
+ if ($[11] !== t7) {
78
+ t8 = /*#__PURE__*/_jsxs("span", {
79
+ className: "text-right font-mono text-muted-foreground",
80
+ children: [t7, "%"]
81
+ });
82
+ $[11] = t7;
83
+ $[12] = t8;
84
+ } else {
85
+ t8 = $[12];
86
+ }
87
+ let t9;
88
+ if ($[13] !== t3 || $[14] !== t4 || $[15] !== t6 || $[16] !== t8) {
89
+ t9 = /*#__PURE__*/_jsxs("li", {
90
+ className: t3,
91
+ children: [t4, t6, t8]
92
+ });
93
+ $[13] = t3;
94
+ $[14] = t4;
95
+ $[15] = t6;
96
+ $[16] = t8;
97
+ $[17] = t9;
98
+ } else {
99
+ t9 = $[17];
100
+ }
101
+ return t9;
13
102
  }
14
- export function ContextBreakdown({ label, usedTokens, limitTokens, percent, status, breakdown, }) {
15
- const freeTokens = Math.max(limitTokens - usedTokens, 0);
16
- return (_jsxs("div", { "data-slot": "context-breakdown", className: "flex flex-col", children: [_jsxs("div", { className: "eyebrow flex items-center gap-2 px-4 pt-3", children: [_jsx("span", { children: label }), _jsxs("span", { className: "ml-auto flex items-center gap-1.5", children: [_jsx("span", { "aria-hidden": true, className: cn("size-1.5 rounded-full", statusDot[status]) }), statusWord[status]] })] }), _jsxs("div", { className: "flex flex-col gap-2 px-4 pt-2 pb-3", children: [_jsxs("span", { className: "flex items-baseline gap-1.5 tabular-nums", children: [_jsxs("span", { className: "text-lg font-semibold tracking-tight", children: [percent, "%"] }), _jsxs("span", { className: "text-xs text-muted-foreground", children: [formatCount(usedTokens), " of ", formatCount(limitTokens), " tokens"] })] }), _jsx(MeterBar, { percent: percent, status: status })] }), _jsxs("ul", { className: "flex flex-col divide-y divide-border border-t border-border", children: [breakdown.map((segment) => (_jsx(SegmentRow, { label: segment.label, tokens: segment.tokens, limitTokens: limitTokens }, segment.label))), _jsx(SegmentRow, { label: "Free", tokens: freeTokens, limitTokens: limitTokens, muted: true })] })] }));
103
+ export function ContextBreakdown(t0) {
104
+ const $ = _c(45);
105
+ const {
106
+ label,
107
+ usedTokens,
108
+ limitTokens,
109
+ percent,
110
+ status,
111
+ breakdown
112
+ } = t0;
113
+ const freeTokens = Math.max(limitTokens - usedTokens, 0);
114
+ let t1;
115
+ if ($[0] !== label) {
116
+ t1 = /*#__PURE__*/_jsx("span", {
117
+ children: label
118
+ });
119
+ $[0] = label;
120
+ $[1] = t1;
121
+ } else {
122
+ t1 = $[1];
123
+ }
124
+ const t2 = statusDot[status];
125
+ let t3;
126
+ if ($[2] !== t2) {
127
+ t3 = cn("size-1.5 rounded-full", t2);
128
+ $[2] = t2;
129
+ $[3] = t3;
130
+ } else {
131
+ t3 = $[3];
132
+ }
133
+ let t4;
134
+ if ($[4] !== t3) {
135
+ t4 = /*#__PURE__*/_jsx("span", {
136
+ "aria-hidden": true,
137
+ className: t3
138
+ });
139
+ $[4] = t3;
140
+ $[5] = t4;
141
+ } else {
142
+ t4 = $[5];
143
+ }
144
+ const t5 = statusWord[status];
145
+ let t6;
146
+ if ($[6] !== t4 || $[7] !== t5) {
147
+ t6 = /*#__PURE__*/_jsxs("span", {
148
+ className: "ml-auto flex items-center gap-1.5",
149
+ children: [t4, t5]
150
+ });
151
+ $[6] = t4;
152
+ $[7] = t5;
153
+ $[8] = t6;
154
+ } else {
155
+ t6 = $[8];
156
+ }
157
+ let t7;
158
+ if ($[9] !== t1 || $[10] !== t6) {
159
+ t7 = /*#__PURE__*/_jsxs("div", {
160
+ className: "eyebrow flex items-center gap-2 px-4 pt-3",
161
+ children: [t1, t6]
162
+ });
163
+ $[9] = t1;
164
+ $[10] = t6;
165
+ $[11] = t7;
166
+ } else {
167
+ t7 = $[11];
168
+ }
169
+ let t8;
170
+ if ($[12] !== percent) {
171
+ t8 = /*#__PURE__*/_jsxs("span", {
172
+ className: "text-lg font-semibold tracking-tight",
173
+ children: [percent, "%"]
174
+ });
175
+ $[12] = percent;
176
+ $[13] = t8;
177
+ } else {
178
+ t8 = $[13];
179
+ }
180
+ let t9;
181
+ if ($[14] !== usedTokens) {
182
+ t9 = formatCount(usedTokens);
183
+ $[14] = usedTokens;
184
+ $[15] = t9;
185
+ } else {
186
+ t9 = $[15];
187
+ }
188
+ let t10;
189
+ if ($[16] !== limitTokens) {
190
+ t10 = formatCount(limitTokens);
191
+ $[16] = limitTokens;
192
+ $[17] = t10;
193
+ } else {
194
+ t10 = $[17];
195
+ }
196
+ let t11;
197
+ if ($[18] !== t10 || $[19] !== t9) {
198
+ t11 = /*#__PURE__*/_jsxs("span", {
199
+ className: "text-xs text-muted-foreground",
200
+ children: [t9, " of ", t10, " tokens"]
201
+ });
202
+ $[18] = t10;
203
+ $[19] = t9;
204
+ $[20] = t11;
205
+ } else {
206
+ t11 = $[20];
207
+ }
208
+ let t12;
209
+ if ($[21] !== t11 || $[22] !== t8) {
210
+ t12 = /*#__PURE__*/_jsxs("span", {
211
+ className: "flex items-baseline gap-1.5 tabular-nums",
212
+ children: [t8, t11]
213
+ });
214
+ $[21] = t11;
215
+ $[22] = t8;
216
+ $[23] = t12;
217
+ } else {
218
+ t12 = $[23];
219
+ }
220
+ let t13;
221
+ if ($[24] !== percent || $[25] !== status) {
222
+ t13 = /*#__PURE__*/_jsx(MeterBar, {
223
+ percent: percent,
224
+ status: status
225
+ });
226
+ $[24] = percent;
227
+ $[25] = status;
228
+ $[26] = t13;
229
+ } else {
230
+ t13 = $[26];
231
+ }
232
+ let t14;
233
+ if ($[27] !== t12 || $[28] !== t13) {
234
+ t14 = /*#__PURE__*/_jsxs("div", {
235
+ className: "flex flex-col gap-2 px-4 pt-2 pb-3",
236
+ children: [t12, t13]
237
+ });
238
+ $[27] = t12;
239
+ $[28] = t13;
240
+ $[29] = t14;
241
+ } else {
242
+ t14 = $[29];
243
+ }
244
+ let t15;
245
+ if ($[30] !== breakdown || $[31] !== limitTokens) {
246
+ let t16;
247
+ if ($[33] !== limitTokens) {
248
+ t16 = segment => /*#__PURE__*/_jsx(SegmentRow, {
249
+ label: segment.label,
250
+ tokens: segment.tokens,
251
+ limitTokens: limitTokens
252
+ }, segment.label);
253
+ $[33] = limitTokens;
254
+ $[34] = t16;
255
+ } else {
256
+ t16 = $[34];
257
+ }
258
+ t15 = breakdown.map(t16);
259
+ $[30] = breakdown;
260
+ $[31] = limitTokens;
261
+ $[32] = t15;
262
+ } else {
263
+ t15 = $[32];
264
+ }
265
+ let t16;
266
+ if ($[35] !== freeTokens || $[36] !== limitTokens) {
267
+ t16 = /*#__PURE__*/_jsx(SegmentRow, {
268
+ label: "Free",
269
+ tokens: freeTokens,
270
+ limitTokens: limitTokens,
271
+ muted: true
272
+ });
273
+ $[35] = freeTokens;
274
+ $[36] = limitTokens;
275
+ $[37] = t16;
276
+ } else {
277
+ t16 = $[37];
278
+ }
279
+ let t17;
280
+ if ($[38] !== t15 || $[39] !== t16) {
281
+ t17 = /*#__PURE__*/_jsxs("ul", {
282
+ className: "flex flex-col divide-y divide-border border-t border-border",
283
+ children: [t15, t16]
284
+ });
285
+ $[38] = t15;
286
+ $[39] = t16;
287
+ $[40] = t17;
288
+ } else {
289
+ t17 = $[40];
290
+ }
291
+ let t18;
292
+ if ($[41] !== t14 || $[42] !== t17 || $[43] !== t7) {
293
+ t18 = /*#__PURE__*/_jsxs("div", {
294
+ "data-slot": "context-breakdown",
295
+ className: "flex flex-col",
296
+ children: [t7, t14, t17]
297
+ });
298
+ $[41] = t14;
299
+ $[42] = t17;
300
+ $[43] = t7;
301
+ $[44] = t18;
302
+ } else {
303
+ t18 = $[44];
304
+ }
305
+ return t18;
17
306
  }
@@ -1,16 +1,114 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { c as _c } from "react/compiler-runtime";
2
2
  import { cn } from "@locusgraph/components";
3
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
4
  const ringRadius = 7;
4
5
  const ringCircumference = 2 * Math.PI * ringRadius;
5
6
  const ringStroke = {
6
- ok: "stroke-primary",
7
- near: "stroke-warn",
8
- full: "stroke-destructive",
7
+ ok: "stroke-primary",
8
+ near: "stroke-warn",
9
+ full: "stroke-destructive"
10
+ };
11
+ const barFill = {
12
+ ok: "bg-primary",
13
+ near: "bg-warn",
14
+ full: "bg-destructive"
9
15
  };
10
- const barFill = { ok: "bg-primary", near: "bg-warn", full: "bg-destructive" };
11
- export function MeterRing({ percent, status }) {
12
- return (_jsxs("svg", { viewBox: "0 0 18 18", "aria-hidden": true, className: "size-3.5 shrink-0 -rotate-90", children: [_jsx("circle", { cx: "9", cy: "9", r: ringRadius, fill: "none", strokeWidth: "2.5", className: "stroke-muted-foreground/20" }), _jsx("circle", { cx: "9", cy: "9", r: ringRadius, fill: "none", strokeWidth: "2.5", strokeDasharray: ringCircumference, strokeDashoffset: ringCircumference * (1 - percent / 100), className: cn("transition-[stroke-dashoffset] duration-300 motion-reduce:transition-none", ringStroke[status]) })] }));
16
+ export function MeterRing(t0) {
17
+ const $ = _c(6);
18
+ const {
19
+ percent,
20
+ status
21
+ } = t0;
22
+ let t1;
23
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
24
+ t1 = /*#__PURE__*/_jsx("circle", {
25
+ cx: "9",
26
+ cy: "9",
27
+ r: ringRadius,
28
+ fill: "none",
29
+ strokeWidth: "2.5",
30
+ className: "stroke-muted-foreground/20"
31
+ });
32
+ $[0] = t1;
33
+ } else {
34
+ t1 = $[0];
35
+ }
36
+ const t2 = ringCircumference * (1 - percent / 100);
37
+ const t3 = ringStroke[status];
38
+ let t4;
39
+ if ($[1] !== t3) {
40
+ t4 = cn("transition-[stroke-dashoffset] duration-300 motion-reduce:transition-none", t3);
41
+ $[1] = t3;
42
+ $[2] = t4;
43
+ } else {
44
+ t4 = $[2];
45
+ }
46
+ let t5;
47
+ if ($[3] !== t2 || $[4] !== t4) {
48
+ t5 = /*#__PURE__*/_jsxs("svg", {
49
+ viewBox: "0 0 18 18",
50
+ "aria-hidden": true,
51
+ className: "size-3.5 shrink-0 -rotate-90",
52
+ children: [t1, /*#__PURE__*/_jsx("circle", {
53
+ cx: "9",
54
+ cy: "9",
55
+ r: ringRadius,
56
+ fill: "none",
57
+ strokeWidth: "2.5",
58
+ strokeDasharray: ringCircumference,
59
+ strokeDashoffset: t2,
60
+ className: t4
61
+ })]
62
+ });
63
+ $[3] = t2;
64
+ $[4] = t4;
65
+ $[5] = t5;
66
+ } else {
67
+ t5 = $[5];
68
+ }
69
+ return t5;
13
70
  }
14
- export function MeterBar({ percent, status }) {
15
- return (_jsx("span", { "aria-hidden": true, className: "relative block h-1 w-full overflow-hidden bg-muted-foreground/20", children: _jsx("span", { className: cn("absolute inset-y-0 left-0 transition-[width] duration-300 motion-reduce:transition-none", barFill[status]), style: { width: `${percent}%` } }) }));
71
+ export function MeterBar(t0) {
72
+ const $ = _c(7);
73
+ const {
74
+ percent,
75
+ status
76
+ } = t0;
77
+ const t1 = barFill[status];
78
+ let t2;
79
+ if ($[0] !== t1) {
80
+ t2 = cn("absolute inset-y-0 left-0 transition-[width] duration-300 motion-reduce:transition-none", t1);
81
+ $[0] = t1;
82
+ $[1] = t2;
83
+ } else {
84
+ t2 = $[1];
85
+ }
86
+ const t3 = `${percent}%`;
87
+ let t4;
88
+ if ($[2] !== t3) {
89
+ t4 = {
90
+ width: t3
91
+ };
92
+ $[2] = t3;
93
+ $[3] = t4;
94
+ } else {
95
+ t4 = $[3];
96
+ }
97
+ let t5;
98
+ if ($[4] !== t2 || $[5] !== t4) {
99
+ t5 = /*#__PURE__*/_jsx("span", {
100
+ "aria-hidden": true,
101
+ className: "relative block h-1 w-full overflow-hidden bg-muted-foreground/20",
102
+ children: /*#__PURE__*/_jsx("span", {
103
+ className: t2,
104
+ style: t4
105
+ })
106
+ });
107
+ $[4] = t2;
108
+ $[5] = t4;
109
+ $[6] = t5;
110
+ } else {
111
+ t5 = $[6];
112
+ }
113
+ return t5;
16
114
  }