@locusgraph/loop 0.3.0 → 0.3.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 (52) hide show
  1. package/dist/agent/pulse/gradient-label.js +64 -12
  2. package/dist/agent/pulse/marks/bars-mark.js +39 -15
  3. package/dist/agent/pulse/marks/glyph-mark.js +56 -15
  4. package/dist/agent/pulse/marks/locus-mark.js +38 -12
  5. package/dist/agent/pulse/marks/orb-mark.js +21 -9
  6. package/dist/agent/pulse/use-loop-animation.js +35 -12
  7. package/dist/approval/inbox/inbox-row.js +303 -76
  8. package/dist/approval/inbox/inbox.js +192 -39
  9. package/dist/approval/inbox/virtual-inbox-list.js +104 -26
  10. package/dist/approval/memory/memory-review.js +172 -36
  11. package/dist/approval/memory/memory-row.js +187 -50
  12. package/dist/approval/plan/plan-review.js +225 -73
  13. package/dist/approval/plan/plan-step-row.js +182 -76
  14. package/dist/approval/plan/question-choices.js +132 -44
  15. package/dist/approval/plan/question.js +156 -38
  16. package/dist/approval/run/run-bar.js +125 -39
  17. package/dist/approval/shared/use-focus-on-mount.js +23 -5
  18. package/dist/approval/spend/raise-cap-form.js +223 -48
  19. package/dist/approval/spend/spend-gate.js +157 -40
  20. package/dist/approval/tool/approval.js +196 -35
  21. package/dist/approval/tool/args/args-editor.js +206 -46
  22. package/dist/approval/tool/args/args-field.js +240 -55
  23. package/dist/approval/tool/deny-form.js +125 -36
  24. package/dist/approval/tool/tool-inputs.js +90 -23
  25. package/dist/chat/chat/use-stick-to-bottom.js +115 -60
  26. package/dist/chat/chat/virtual-chat-items.js +129 -34
  27. package/dist/chat/composer/composer-actions.d.ts +1 -2
  28. package/dist/chat/composer/composer-actions.js +132 -49
  29. package/dist/chat/composer/composer-status.d.ts +2 -0
  30. package/dist/chat/composer/composer-status.js +3 -0
  31. package/dist/chat/composer/composer.d.ts +1 -1
  32. package/dist/chat/composer/composer.js +2 -1
  33. package/dist/chat/composer/use-auto-grow.js +25 -8
  34. package/dist/chat/files/files.js +293 -66
  35. package/dist/chat/index.d.ts +1 -1
  36. package/dist/chat/index.js +1 -1
  37. package/dist/cost/model-picker.js +174 -42
  38. package/dist/memory/cite.js +181 -58
  39. package/dist/memory/memorized.js +196 -42
  40. package/dist/memory/recall.js +265 -68
  41. package/dist/memory/sources.js +232 -52
  42. package/dist/shared/virtual/use-list-virtualizer.js +2 -0
  43. package/dist/thread/actions/branch-switcher.js +97 -21
  44. package/dist/thread/canvas/version-switcher.js +128 -31
  45. package/dist/thread/code/copy-code-button.js +58 -24
  46. package/dist/thread/history/row/history-row.js +99 -18
  47. package/dist/thread/history/row/thread-item-menu.js +74 -19
  48. package/dist/thread/history/row/thread-title-editor.js +74 -29
  49. package/dist/thread/history/virtual-history-list.js +84 -46
  50. package/dist/thread/starters/starters.js +89 -27
  51. package/dist/thread/use-copied.js +40 -10
  52. package/package.json +1 -1
@@ -1,3 +1,6 @@
1
+ "use client";
2
+
3
+ import { c as _c } from "react/compiler-runtime";
1
4
  import { Button, Input, Label } from "@locusgraph/components";
2
5
  import { formatMicroUsd } from "@locusgraph/utils";
3
6
  import { useId, useState } from "react";
@@ -8,64 +11,236 @@ function capError(next, capMicroUsd) {
8
11
  if (next <= capMicroUsd) return `The new cap must be above ${formatMicroUsd(capMicroUsd)}.`;
9
12
  return undefined;
10
13
  }
11
- export function RaiseCapForm({
12
- capMicroUsd,
13
- suggestedMicroUsd,
14
- disabled = false,
15
- onRaiseCap
16
- }) {
14
+ export function RaiseCapForm(t0) {
15
+ const $ = _c(59);
16
+ const {
17
+ capMicroUsd,
18
+ suggestedMicroUsd,
19
+ disabled: t1,
20
+ onRaiseCap
21
+ } = t0;
22
+ const disabled = t1 === undefined ? false : t1;
17
23
  const inputId = useId();
18
- const [dollars, setDollars] = useState(() => microUsdToDollarsInput(suggestedMicroUsd));
24
+ let t2;
25
+ if ($[0] !== suggestedMicroUsd) {
26
+ t2 = () => microUsdToDollarsInput(suggestedMicroUsd);
27
+ $[0] = suggestedMicroUsd;
28
+ $[1] = t2;
29
+ } else {
30
+ t2 = $[1];
31
+ }
32
+ const [dollars, setDollars] = useState(t2);
19
33
  const [touched, setTouched] = useState(false);
20
- const next = dollarsToMicroUsd(dollars);
21
- const error = capError(next, capMicroUsd);
22
- const visibleError = touched ? error : undefined;
23
- return /*#__PURE__*/_jsxs("form", {
24
- "data-slot": "raise-cap-form",
25
- noValidate: true,
26
- className: "flex flex-col gap-1.5 border-t pt-4",
27
- onSubmit: event => {
34
+ let T0;
35
+ let t10;
36
+ let t11;
37
+ let t12;
38
+ let t13;
39
+ let t14;
40
+ let t15;
41
+ let t3;
42
+ let t4;
43
+ let t5;
44
+ let t6;
45
+ let t7;
46
+ let t8;
47
+ let t9;
48
+ let visibleError;
49
+ if ($[2] !== capMicroUsd || $[3] !== disabled || $[4] !== dollars || $[5] !== inputId || $[6] !== onRaiseCap || $[7] !== touched) {
50
+ const next = dollarsToMicroUsd(dollars);
51
+ const error = capError(next, capMicroUsd);
52
+ visibleError = touched ? error : undefined;
53
+ t12 = "raise-cap-form";
54
+ t13 = true;
55
+ t14 = "flex flex-col gap-1.5 border-t pt-4";
56
+ t15 = event => {
28
57
  event.preventDefault();
29
58
  setTouched(true);
30
- if (next !== null && !error) onRaiseCap(next);
31
- },
32
- children: [/*#__PURE__*/_jsxs("div", {
33
- className: "flex flex-wrap items-center justify-between gap-x-4 gap-y-2",
34
- children: [/*#__PURE__*/_jsx(Label, {
59
+ if (next !== null && !error) {
60
+ onRaiseCap(next);
61
+ }
62
+ };
63
+ t10 = "flex flex-wrap items-center justify-between gap-x-4 gap-y-2";
64
+ if ($[23] !== inputId) {
65
+ t11 = /*#__PURE__*/_jsx(Label, {
35
66
  htmlFor: inputId,
36
67
  className: "text-xs font-normal text-muted-foreground",
37
68
  children: "Or raise the cap for this run"
38
- }), /*#__PURE__*/_jsxs("div", {
39
- className: "flex flex-wrap items-center gap-2",
40
- children: [/*#__PURE__*/_jsxs("div", {
41
- className: "relative w-32",
42
- children: [/*#__PURE__*/_jsx("span", {
43
- "aria-hidden": true,
44
- className: "pointer-events-none absolute top-1/2 left-3 -translate-y-1/2 text-sm text-muted-foreground",
45
- children: "$"
46
- }), /*#__PURE__*/_jsx(Input, {
47
- id: inputId,
48
- inputMode: "decimal",
49
- className: "pl-6 tabular-nums",
50
- value: dollars,
51
- disabled: disabled,
52
- "aria-invalid": visibleError ? true : undefined,
53
- "aria-describedby": visibleError ? `${inputId}-error` : undefined,
54
- onChange: event => setDollars(event.target.value),
55
- onBlur: () => setTouched(true)
56
- })]
57
- }), /*#__PURE__*/_jsx(Button, {
58
- type: "submit",
59
- size: "sm",
60
- variant: "outline",
69
+ });
70
+ $[23] = inputId;
71
+ $[24] = t11;
72
+ } else {
73
+ t11 = $[24];
74
+ }
75
+ t8 = "flex flex-wrap items-center gap-2";
76
+ let t16;
77
+ if ($[25] === Symbol.for("react.memo_cache_sentinel")) {
78
+ t16 = /*#__PURE__*/_jsx("span", {
79
+ "aria-hidden": true,
80
+ className: "pointer-events-none absolute top-1/2 left-3 -translate-y-1/2 text-sm text-muted-foreground",
81
+ children: "$"
82
+ });
83
+ $[25] = t16;
84
+ } else {
85
+ t16 = $[25];
86
+ }
87
+ const t17 = visibleError ? true : undefined;
88
+ const t18 = visibleError ? `${inputId}-error` : undefined;
89
+ let t19;
90
+ let t20;
91
+ if ($[26] === Symbol.for("react.memo_cache_sentinel")) {
92
+ t19 = event_0 => setDollars(event_0.target.value);
93
+ t20 = () => setTouched(true);
94
+ $[26] = t19;
95
+ $[27] = t20;
96
+ } else {
97
+ t19 = $[26];
98
+ t20 = $[27];
99
+ }
100
+ if ($[28] !== disabled || $[29] !== dollars || $[30] !== inputId || $[31] !== t17 || $[32] !== t18) {
101
+ t9 = /*#__PURE__*/_jsxs("div", {
102
+ className: "relative w-32",
103
+ children: [t16, /*#__PURE__*/_jsx(Input, {
104
+ id: inputId,
105
+ inputMode: "decimal",
106
+ className: "pl-6 tabular-nums",
107
+ value: dollars,
61
108
  disabled: disabled,
62
- children: next !== null && !error ? `Raise cap to ${formatMicroUsd(next)}` : "Raise cap"
109
+ "aria-invalid": t17,
110
+ "aria-describedby": t18,
111
+ onChange: t19,
112
+ onBlur: t20
63
113
  })]
64
- })]
65
- }), visibleError && /*#__PURE__*/_jsx("p", {
114
+ });
115
+ $[28] = disabled;
116
+ $[29] = dollars;
117
+ $[30] = inputId;
118
+ $[31] = t17;
119
+ $[32] = t18;
120
+ $[33] = t9;
121
+ } else {
122
+ t9 = $[33];
123
+ }
124
+ T0 = Button;
125
+ t3 = "submit";
126
+ t4 = "sm";
127
+ t5 = "outline";
128
+ t6 = disabled;
129
+ t7 = next !== null && !error ? `Raise cap to ${formatMicroUsd(next)}` : "Raise cap";
130
+ $[2] = capMicroUsd;
131
+ $[3] = disabled;
132
+ $[4] = dollars;
133
+ $[5] = inputId;
134
+ $[6] = onRaiseCap;
135
+ $[7] = touched;
136
+ $[8] = T0;
137
+ $[9] = t10;
138
+ $[10] = t11;
139
+ $[11] = t12;
140
+ $[12] = t13;
141
+ $[13] = t14;
142
+ $[14] = t15;
143
+ $[15] = t3;
144
+ $[16] = t4;
145
+ $[17] = t5;
146
+ $[18] = t6;
147
+ $[19] = t7;
148
+ $[20] = t8;
149
+ $[21] = t9;
150
+ $[22] = visibleError;
151
+ } else {
152
+ T0 = $[8];
153
+ t10 = $[9];
154
+ t11 = $[10];
155
+ t12 = $[11];
156
+ t13 = $[12];
157
+ t14 = $[13];
158
+ t15 = $[14];
159
+ t3 = $[15];
160
+ t4 = $[16];
161
+ t5 = $[17];
162
+ t6 = $[18];
163
+ t7 = $[19];
164
+ t8 = $[20];
165
+ t9 = $[21];
166
+ visibleError = $[22];
167
+ }
168
+ let t16;
169
+ if ($[34] !== T0 || $[35] !== t3 || $[36] !== t4 || $[37] !== t5 || $[38] !== t6 || $[39] !== t7) {
170
+ t16 = /*#__PURE__*/_jsx(T0, {
171
+ type: t3,
172
+ size: t4,
173
+ variant: t5,
174
+ disabled: t6,
175
+ children: t7
176
+ });
177
+ $[34] = T0;
178
+ $[35] = t3;
179
+ $[36] = t4;
180
+ $[37] = t5;
181
+ $[38] = t6;
182
+ $[39] = t7;
183
+ $[40] = t16;
184
+ } else {
185
+ t16 = $[40];
186
+ }
187
+ let t17;
188
+ if ($[41] !== t16 || $[42] !== t8 || $[43] !== t9) {
189
+ t17 = /*#__PURE__*/_jsxs("div", {
190
+ className: t8,
191
+ children: [t9, t16]
192
+ });
193
+ $[41] = t16;
194
+ $[42] = t8;
195
+ $[43] = t9;
196
+ $[44] = t17;
197
+ } else {
198
+ t17 = $[44];
199
+ }
200
+ let t18;
201
+ if ($[45] !== t10 || $[46] !== t11 || $[47] !== t17) {
202
+ t18 = /*#__PURE__*/_jsxs("div", {
203
+ className: t10,
204
+ children: [t11, t17]
205
+ });
206
+ $[45] = t10;
207
+ $[46] = t11;
208
+ $[47] = t17;
209
+ $[48] = t18;
210
+ } else {
211
+ t18 = $[48];
212
+ }
213
+ let t19;
214
+ if ($[49] !== inputId || $[50] !== visibleError) {
215
+ t19 = visibleError && /*#__PURE__*/_jsx("p", {
66
216
  id: `${inputId}-error`,
67
217
  className: "text-right text-xs text-destructive",
68
218
  children: visibleError
69
- })]
70
- });
219
+ });
220
+ $[49] = inputId;
221
+ $[50] = visibleError;
222
+ $[51] = t19;
223
+ } else {
224
+ t19 = $[51];
225
+ }
226
+ let t20;
227
+ if ($[52] !== t12 || $[53] !== t13 || $[54] !== t14 || $[55] !== t15 || $[56] !== t18 || $[57] !== t19) {
228
+ t20 = /*#__PURE__*/_jsxs("form", {
229
+ "data-slot": t12,
230
+ noValidate: t13,
231
+ className: t14,
232
+ onSubmit: t15,
233
+ children: [t18, t19]
234
+ });
235
+ $[52] = t12;
236
+ $[53] = t13;
237
+ $[54] = t14;
238
+ $[55] = t15;
239
+ $[56] = t18;
240
+ $[57] = t19;
241
+ $[58] = t20;
242
+ } else {
243
+ t20 = $[58];
244
+ }
245
+ return t20;
71
246
  }
@@ -1,3 +1,6 @@
1
+ "use client";
2
+
3
+ import { c as _c } from "react/compiler-runtime";
1
4
  import { CurrencyDollar as CircleDollarSignIcon } from "@carbon/icons-react";
2
5
  import { Button, cn } from "@locusgraph/components";
3
6
  import { formatMicroUsd } from "@locusgraph/utils";
@@ -22,48 +25,116 @@ const situationStatus = {
22
25
  "over-cap": "Over cap",
23
26
  "out-of-credits": "Out of credits"
24
27
  };
25
- export function SpendGate({
26
- spentMicroUsd,
27
- estimateMicroUsd,
28
- capMicroUsd,
29
- balanceMicroUsd,
30
- runName,
31
- decision,
32
- onAllowOnce,
33
- onRaiseCap,
34
- onStop,
35
- onBuyCredits,
36
- autoFocus = true,
37
- className
38
- }) {
39
- const situation = spendSituation(balanceMicroUsd, estimateMicroUsd);
40
- const outOfCredits = situation === "out-of-credits";
41
- const projected = spentMicroUsd + estimateMicroUsd;
42
- const copy = situationCopy[situation];
43
- const primaryRef = useFocusOnMount(autoFocus && !decision);
44
- const meter = {
28
+ export function SpendGate(t0) {
29
+ const $ = _c(45);
30
+ const {
45
31
  spentMicroUsd,
46
32
  estimateMicroUsd,
47
33
  capMicroUsd,
48
34
  balanceMicroUsd,
49
- outOfCredits
50
- };
51
- return /*#__PURE__*/_jsxs(ApprovalPanel, {
52
- "data-slot": "spend-gate",
53
- "data-situation": situation,
54
- "aria-label": copy.title,
55
- className: cn(!decision && outOfCredits && "ring-destructive/60", className),
56
- children: [/*#__PURE__*/_jsx(PanelHeader, {
57
- icon: /*#__PURE__*/_jsx(CircleDollarSignIcon, {
58
- "aria-hidden": true
59
- }),
35
+ runName,
36
+ decision,
37
+ onAllowOnce,
38
+ onRaiseCap,
39
+ onStop,
40
+ onBuyCredits,
41
+ autoFocus: t1,
42
+ className
43
+ } = t0;
44
+ const autoFocus = t1 === undefined ? true : t1;
45
+ let t2;
46
+ if ($[0] !== balanceMicroUsd || $[1] !== estimateMicroUsd) {
47
+ t2 = spendSituation(balanceMicroUsd, estimateMicroUsd);
48
+ $[0] = balanceMicroUsd;
49
+ $[1] = estimateMicroUsd;
50
+ $[2] = t2;
51
+ } else {
52
+ t2 = $[2];
53
+ }
54
+ const situation = t2;
55
+ const outOfCredits = situation === "out-of-credits";
56
+ const projected = spentMicroUsd + estimateMicroUsd;
57
+ const copy = situationCopy[situation];
58
+ const primaryRef = useFocusOnMount(autoFocus && !decision);
59
+ let t3;
60
+ if ($[3] !== balanceMicroUsd || $[4] !== capMicroUsd || $[5] !== estimateMicroUsd || $[6] !== outOfCredits || $[7] !== spentMicroUsd) {
61
+ t3 = {
62
+ spentMicroUsd,
63
+ estimateMicroUsd,
64
+ capMicroUsd,
65
+ balanceMicroUsd,
66
+ outOfCredits
67
+ };
68
+ $[3] = balanceMicroUsd;
69
+ $[4] = capMicroUsd;
70
+ $[5] = estimateMicroUsd;
71
+ $[6] = outOfCredits;
72
+ $[7] = spentMicroUsd;
73
+ $[8] = t3;
74
+ } else {
75
+ t3 = $[8];
76
+ }
77
+ 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, {
92
+ "aria-hidden": true
93
+ });
94
+ $[12] = t7;
95
+ } else {
96
+ t7 = $[12];
97
+ }
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,
60
104
  eyebrow: "Spend approval",
61
- status: decision ? decision.approved ? "Allowed" : "Stopped" : situationStatus[situation],
62
- tone: decision ? decision.approved ? "done" : "danger" : outOfCredits ? "danger" : "waiting"
63
- }), /*#__PURE__*/_jsx(PanelTitle, {
64
- className: cn(decision && "text-muted-foreground"),
105
+ status: t8,
106
+ tone: t9
107
+ });
108
+ $[13] = t8;
109
+ $[14] = t9;
110
+ $[15] = t10;
111
+ } else {
112
+ t10 = $[15];
113
+ }
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,
65
127
  children: copy.title
66
- }), decision ? /*#__PURE__*/_jsxs(PanelBody, {
128
+ });
129
+ $[18] = copy.title;
130
+ $[19] = t12;
131
+ $[20] = t13;
132
+ } else {
133
+ t13 = $[20];
134
+ }
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, {
67
138
  className: "pt-3",
68
139
  children: [/*#__PURE__*/_jsx(DecisionSummary, {
69
140
  decision: decision,
@@ -128,8 +199,54 @@ export function SpendGate({
128
199
  })]
129
200
  })]
130
201
  })]
131
- }), /*#__PURE__*/_jsx(LiveStatus, {
132
- message: decision ? decision.approved ? "Spend allowed" : "Run stopped" : copy.title
133
- })]
134
- });
202
+ });
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;
217
+ } else {
218
+ t14 = $[34];
219
+ }
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
225
+ });
226
+ $[35] = t15;
227
+ $[36] = t16;
228
+ } else {
229
+ t16 = $[36];
230
+ }
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, {
234
+ "data-slot": "spend-gate",
235
+ "data-situation": situation,
236
+ "aria-label": t4,
237
+ className: t6,
238
+ children: [t10, t13, t14, t16]
239
+ });
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;
248
+ } else {
249
+ t17 = $[44];
250
+ }
251
+ return t17;
135
252
  }