@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,184 @@
1
+ import { c as _c } from "react/compiler-runtime";
2
+ import { ChevronDown as ChevronDownIcon } from "@carbon/icons-react";
3
+ import { cn, DropdownMenu, DropdownMenuContent, DropdownMenuLabel, DropdownMenuRadioGroup, DropdownMenuTrigger } from "@locusgraph/components";
4
+ import { ModelOptionRow } from "./shared/model-option-row.js";
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);
184
+ }
@@ -0,0 +1,15 @@
1
+ import { type MeterStatus } from "./meter-marks.js";
2
+ export type ContextSegment = {
3
+ label: string;
4
+ tokens: number;
5
+ };
6
+ type ContextBreakdownProps = {
7
+ label: string;
8
+ usedTokens: number;
9
+ limitTokens: number;
10
+ percent: number;
11
+ status: MeterStatus;
12
+ breakdown: ContextSegment[];
13
+ };
14
+ export declare function ContextBreakdown({ label, usedTokens, limitTokens, percent, status, breakdown, }: ContextBreakdownProps): import("react").JSX.Element;
15
+ export {};
@@ -0,0 +1,306 @@
1
+ import { c as _c } from "react/compiler-runtime";
2
+ import { cn } from "@locusgraph/components";
3
+ import { formatCount, quotaPercent } from "@locusgraph/utils";
4
+ import { MeterBar } from "./meter-marks.js";
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
+ };
11
+ const statusDot = {
12
+ ok: "bg-good",
13
+ near: "bg-warn",
14
+ full: "bg-destructive"
15
+ };
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;
102
+ }
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;
306
+ }
@@ -0,0 +1,9 @@
1
+ export type MeterStatus = "ok" | "near" | "full";
2
+ export declare function MeterRing({ percent, status }: {
3
+ percent: number;
4
+ status: MeterStatus;
5
+ }): import("react").JSX.Element;
6
+ export declare function MeterBar({ percent, status }: {
7
+ percent: number;
8
+ status: MeterStatus;
9
+ }): import("react").JSX.Element;
@@ -0,0 +1,114 @@
1
+ import { c as _c } from "react/compiler-runtime";
2
+ import { cn } from "@locusgraph/components";
3
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
4
+ const ringRadius = 7;
5
+ const ringCircumference = 2 * Math.PI * ringRadius;
6
+ const ringStroke = {
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"
15
+ };
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;
70
+ }
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;
114
+ }
@@ -0,0 +1,14 @@
1
+ export type ModelSpeed = "fast" | "balanced" | "deep";
2
+ export type ModelOption = {
3
+ id: string;
4
+ name: string;
5
+ provider: string;
6
+ inputPerMillionMicroUsd?: number;
7
+ outputPerMillionMicroUsd?: number;
8
+ speed?: ModelSpeed;
9
+ contextTokens?: number;
10
+ };
11
+ export declare function modelPriceLabel(model: ModelOption): string | undefined;
12
+ export declare function ModelOptionRow({ model }: {
13
+ model: ModelOption;
14
+ }): import("react").JSX.Element;