@locusgraph/loop 0.2.0 → 0.2.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 (68) hide show
  1. package/dist/agent/pulse/gradient-label.js +12 -62
  2. package/dist/agent/pulse/marks/bars-mark.js +15 -37
  3. package/dist/agent/pulse/marks/glyph-mark.js +15 -54
  4. package/dist/agent/pulse/marks/locus-mark.js +12 -36
  5. package/dist/agent/pulse/marks/orb-mark.js +9 -19
  6. package/dist/agent/pulse/marks/spinner-mark.js +20 -29
  7. package/dist/agent/pulse/pulse.js +36 -123
  8. package/dist/agent/pulse/use-loop-animation.js +12 -33
  9. package/dist/agent/steps/step-icon.js +26 -96
  10. package/dist/agent/steps/steps.js +47 -210
  11. package/dist/agent/tool/json-block.js +11 -31
  12. package/dist/agent/tool/tool-status.js +12 -35
  13. package/dist/approval/inbox/inbox-row.js +76 -301
  14. package/dist/approval/inbox/inbox.js +39 -190
  15. package/dist/approval/inbox/virtual-inbox-list.js +26 -102
  16. package/dist/approval/memory/memory-review.js +36 -170
  17. package/dist/approval/memory/memory-row.js +50 -185
  18. package/dist/approval/plan/plan-review.js +73 -223
  19. package/dist/approval/plan/plan-step-row.js +76 -180
  20. package/dist/approval/plan/question-choices.js +44 -130
  21. package/dist/approval/plan/question.js +38 -154
  22. package/dist/approval/run/run-bar.js +39 -123
  23. package/dist/approval/shared/risk-badge.js +9 -24
  24. package/dist/approval/shared/use-focus-on-mount.js +5 -21
  25. package/dist/approval/spend/raise-cap-form.js +48 -221
  26. package/dist/approval/spend/spend-gate.js +40 -155
  27. package/dist/approval/spend/spend-meter.js +85 -312
  28. package/dist/approval/tool/approval.js +35 -194
  29. package/dist/approval/tool/args/args-editor.js +46 -204
  30. package/dist/approval/tool/args/args-field.js +55 -238
  31. package/dist/approval/tool/deny-form.js +36 -123
  32. package/dist/approval/tool/tool-inputs.js +23 -88
  33. package/dist/chat/chat/use-stick-to-bottom.js +60 -113
  34. package/dist/chat/chat/virtual-chat-items.js +34 -127
  35. package/dist/chat/composer/composer-actions.js +46 -129
  36. package/dist/chat/composer/use-auto-grow.js +8 -23
  37. package/dist/chat/files/files.js +66 -291
  38. package/dist/chat/reply/fenced-code.js +10 -32
  39. package/dist/chat/reply/reply.js +24 -99
  40. package/dist/chat/turn/turn.js +46 -197
  41. package/dist/cost/context.js +65 -282
  42. package/dist/cost/cost-steps.js +42 -195
  43. package/dist/cost/cost.js +108 -497
  44. package/dist/cost/model-picker.js +42 -172
  45. package/dist/cost/shared/context-breakdown.js +64 -280
  46. package/dist/cost/shared/meter-marks.js +34 -92
  47. package/dist/cost/shared/model-option-row.js +35 -158
  48. package/dist/cost/shared/step-cost-row.js +37 -222
  49. package/dist/memory/cite.js +58 -179
  50. package/dist/memory/memorized.js +42 -194
  51. package/dist/memory/recall.js +68 -263
  52. package/dist/memory/shared/source-mark.js +10 -38
  53. package/dist/memory/sources.js +52 -230
  54. package/dist/shared/decision-summary.js +35 -117
  55. package/dist/shared/panel-empty.js +15 -73
  56. package/dist/shared/panel.js +65 -239
  57. package/dist/shared/status-dot.js +10 -32
  58. package/dist/thread/actions/action-button.js +10 -53
  59. package/dist/thread/actions/branch-switcher.js +21 -95
  60. package/dist/thread/canvas/version-switcher.js +31 -126
  61. package/dist/thread/code/copy-code-button.js +24 -56
  62. package/dist/thread/history/row/history-row.js +18 -97
  63. package/dist/thread/history/row/thread-item-menu.js +19 -72
  64. package/dist/thread/history/row/thread-title-editor.js +29 -72
  65. package/dist/thread/history/virtual-history-list.js +46 -82
  66. package/dist/thread/starters/starters.js +27 -87
  67. package/dist/thread/use-copied.js +10 -38
  68. package/package.json +3 -3
@@ -1,4 +1,3 @@
1
- import { c as _c } from "react/compiler-runtime";
2
1
  import { Checkmark as CheckIcon, InProgress as LoaderCircleIcon, Subtract as MinusIcon, Close as XIcon } from "@carbon/icons-react";
3
2
  import { cn } from "@locusgraph/components";
4
3
  import { jsx as _jsx } from "react/jsx-runtime";
@@ -16,102 +15,33 @@ const stepIconFrames = {
16
15
  failed: "bg-destructive text-white",
17
16
  skipped: "bg-muted text-muted-foreground"
18
17
  };
19
- function StepGlyph(t0) {
20
- const $ = _c(4);
21
- const {
22
- status
23
- } = t0;
24
- if (status === "running") {
25
- let t1;
26
- if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
27
- t1 = /*#__PURE__*/_jsx(LoaderCircleIcon, {
28
- className: "size-4 motion-safe:animate-spin"
29
- });
30
- $[0] = t1;
31
- } else {
32
- t1 = $[0];
33
- }
34
- return t1;
35
- }
36
- if (status === "done") {
37
- let t1;
38
- if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
39
- t1 = /*#__PURE__*/_jsx(CheckIcon, {
40
- className: "size-2.5"
41
- });
42
- $[1] = t1;
43
- } else {
44
- t1 = $[1];
45
- }
46
- return t1;
47
- }
48
- if (status === "failed") {
49
- let t1;
50
- if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
51
- t1 = /*#__PURE__*/_jsx(XIcon, {
52
- className: "size-2.5"
53
- });
54
- $[2] = t1;
55
- } else {
56
- t1 = $[2];
57
- }
58
- return t1;
59
- }
60
- if (status === "skipped") {
61
- let t1;
62
- if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
63
- t1 = /*#__PURE__*/_jsx(MinusIcon, {
64
- className: "size-2.5"
65
- });
66
- $[3] = t1;
67
- } else {
68
- t1 = $[3];
69
- }
70
- return t1;
71
- }
18
+ function StepGlyph({
19
+ status
20
+ }) {
21
+ if (status === "running") return /*#__PURE__*/_jsx(LoaderCircleIcon, {
22
+ className: "size-4 motion-safe:animate-spin"
23
+ });
24
+ if (status === "done") return /*#__PURE__*/_jsx(CheckIcon, {
25
+ className: "size-2.5"
26
+ });
27
+ if (status === "failed") return /*#__PURE__*/_jsx(XIcon, {
28
+ className: "size-2.5"
29
+ });
30
+ if (status === "skipped") return /*#__PURE__*/_jsx(MinusIcon, {
31
+ className: "size-2.5"
32
+ });
72
33
  return null;
73
34
  }
74
- export function StepIcon(t0) {
75
- const $ = _c(8);
76
- const {
77
- status,
78
- current: t1
79
- } = t0;
80
- const current = t1 === undefined ? false : t1;
81
- const t2 = stepIconFrames[status];
82
- const t3 = current && status === "pending" && "ring-foreground/60";
83
- let t4;
84
- if ($[0] !== t2 || $[1] !== t3) {
85
- t4 = cn("relative z-10 mt-0.5 flex size-4 shrink-0 items-center justify-center rounded-full", t2, t3);
86
- $[0] = t2;
87
- $[1] = t3;
88
- $[2] = t4;
89
- } else {
90
- t4 = $[2];
91
- }
92
- let t5;
93
- if ($[3] !== status) {
94
- t5 = /*#__PURE__*/_jsx(StepGlyph, {
35
+ export function StepIcon({
36
+ status,
37
+ current = false
38
+ }) {
39
+ return /*#__PURE__*/_jsx("span", {
40
+ "aria-hidden": true,
41
+ "data-slot": "step-icon",
42
+ className: cn("relative z-10 mt-0.5 flex size-4 shrink-0 items-center justify-center rounded-full", stepIconFrames[status], current && status === "pending" && "ring-foreground/60"),
43
+ children: /*#__PURE__*/_jsx(StepGlyph, {
95
44
  status: status
96
- });
97
- $[3] = status;
98
- $[4] = t5;
99
- } else {
100
- t5 = $[4];
101
- }
102
- let t6;
103
- if ($[5] !== t4 || $[6] !== t5) {
104
- t6 = /*#__PURE__*/_jsx("span", {
105
- "aria-hidden": true,
106
- "data-slot": "step-icon",
107
- className: t4,
108
- children: t5
109
- });
110
- $[5] = t4;
111
- $[6] = t5;
112
- $[7] = t6;
113
- } else {
114
- t6 = $[7];
115
- }
116
- return t6;
45
+ })
46
+ });
117
47
  }
@@ -1,4 +1,3 @@
1
- import { c as _c } from "react/compiler-runtime";
2
1
  import { ListChecked as ListChecksIcon } from "@carbon/icons-react";
3
2
  import { cn } from "@locusgraph/components";
4
3
  import { ApprovalPanel, PanelHeader } from "../../shared/panel.js";
@@ -27,223 +26,61 @@ function progressTone(steps) {
27
26
  const settled = steps.every(step => step.status === "done" || step.status === "skipped");
28
27
  return steps.length > 0 && settled ? "done" : "idle";
29
28
  }
30
- function StepRow(t0) {
31
- const $ = _c(26);
32
- const {
33
- step,
34
- current,
35
- last
36
- } = t0;
37
- const t1 = step.status;
38
- const t2 = current ? "step" : undefined;
39
- let t3;
40
- if ($[0] !== last) {
41
- t3 = !last && /*#__PURE__*/_jsx("span", {
29
+ function StepRow({
30
+ step,
31
+ current,
32
+ last
33
+ }) {
34
+ return /*#__PURE__*/_jsxs("li", {
35
+ "data-slot": "step",
36
+ "data-status": step.status,
37
+ "aria-current": current ? "step" : undefined,
38
+ className: "relative flex gap-3 pb-4 last:pb-0",
39
+ children: [!last && /*#__PURE__*/_jsx("span", {
42
40
  "aria-hidden": true,
43
41
  className: "absolute top-5 bottom-0.5 left-[7.5px] w-px bg-border"
44
- });
45
- $[0] = last;
46
- $[1] = t3;
47
- } else {
48
- t3 = $[1];
49
- }
50
- let t4;
51
- if ($[2] !== current || $[3] !== step.status) {
52
- t4 = /*#__PURE__*/_jsx(StepIcon, {
42
+ }), /*#__PURE__*/_jsx(StepIcon, {
53
43
  status: step.status,
54
44
  current: current
55
- });
56
- $[2] = current;
57
- $[3] = step.status;
58
- $[4] = t4;
59
- } else {
60
- t4 = $[4];
61
- }
62
- const t5 = stepTitleTones[step.status];
63
- const t6 = current && step.status === "pending" && "text-foreground";
64
- let t7;
65
- if ($[5] !== t5 || $[6] !== t6) {
66
- t7 = cn("text-sm leading-snug", t5, t6);
67
- $[5] = t5;
68
- $[6] = t6;
69
- $[7] = t7;
70
- } else {
71
- t7 = $[7];
72
- }
73
- const t8 = stepStatusLabels[step.status];
74
- let t9;
75
- if ($[8] !== t8) {
76
- t9 = /*#__PURE__*/_jsxs("span", {
77
- className: "sr-only",
78
- children: [" (", t8, ")"]
79
- });
80
- $[8] = t8;
81
- $[9] = t9;
82
- } else {
83
- t9 = $[9];
84
- }
85
- let t10;
86
- if ($[10] !== step.title || $[11] !== t7 || $[12] !== t9) {
87
- t10 = /*#__PURE__*/_jsxs("span", {
88
- className: t7,
89
- children: [step.title, t9]
90
- });
91
- $[10] = step.title;
92
- $[11] = t7;
93
- $[12] = t9;
94
- $[13] = t10;
95
- } else {
96
- t10 = $[13];
97
- }
98
- let t11;
99
- if ($[14] !== step.detail || $[15] !== step.status) {
100
- t11 = step.detail && /*#__PURE__*/_jsx("span", {
101
- className: cn("font-mono text-xs text-muted-foreground", step.status === "failed" && "font-sans text-destructive"),
102
- children: step.detail
103
- });
104
- $[14] = step.detail;
105
- $[15] = step.status;
106
- $[16] = t11;
107
- } else {
108
- t11 = $[16];
109
- }
110
- let t12;
111
- if ($[17] !== t10 || $[18] !== t11) {
112
- t12 = /*#__PURE__*/_jsxs("div", {
45
+ }), /*#__PURE__*/_jsxs("div", {
113
46
  className: "flex min-w-0 flex-col gap-0.5",
114
- children: [t10, t11]
115
- });
116
- $[17] = t10;
117
- $[18] = t11;
118
- $[19] = t12;
119
- } else {
120
- t12 = $[19];
121
- }
122
- let t13;
123
- if ($[20] !== step.status || $[21] !== t12 || $[22] !== t2 || $[23] !== t3 || $[24] !== t4) {
124
- t13 = /*#__PURE__*/_jsxs("li", {
125
- "data-slot": "step",
126
- "data-status": t1,
127
- "aria-current": t2,
128
- className: "relative flex gap-3 pb-4 last:pb-0",
129
- children: [t3, t4, t12]
130
- });
131
- $[20] = step.status;
132
- $[21] = t12;
133
- $[22] = t2;
134
- $[23] = t3;
135
- $[24] = t4;
136
- $[25] = t13;
137
- } else {
138
- t13 = $[25];
139
- }
140
- return t13;
47
+ children: [/*#__PURE__*/_jsxs("span", {
48
+ className: cn("text-sm leading-snug", stepTitleTones[step.status], current && step.status === "pending" && "text-foreground"),
49
+ children: [step.title, /*#__PURE__*/_jsxs("span", {
50
+ className: "sr-only",
51
+ children: [" (", stepStatusLabels[step.status], ")"]
52
+ })]
53
+ }), step.detail && /*#__PURE__*/_jsx("span", {
54
+ className: cn("font-mono text-xs text-muted-foreground", step.status === "failed" && "font-sans text-destructive"),
55
+ children: step.detail
56
+ })]
57
+ })]
58
+ });
141
59
  }
142
- export function Steps(t0) {
143
- const $ = _c(24);
144
- const {
145
- steps,
146
- title: t1,
147
- className
148
- } = t0;
149
- const title = t1 === undefined ? "Plan" : t1;
150
- let t2;
151
- if ($[0] !== steps) {
152
- t2 = currentStepId(steps);
153
- $[0] = steps;
154
- $[1] = t2;
155
- } else {
156
- t2 = $[1];
157
- }
158
- const currentId = t2;
159
- let t3;
160
- if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
161
- t3 = /*#__PURE__*/_jsx(ListChecksIcon, {
162
- "aria-hidden": true
163
- });
164
- $[2] = t3;
165
- } else {
166
- t3 = $[2];
167
- }
168
- let t4;
169
- if ($[3] !== steps) {
170
- t4 = progressLabel(steps);
171
- $[3] = steps;
172
- $[4] = t4;
173
- } else {
174
- t4 = $[4];
175
- }
176
- let t5;
177
- if ($[5] !== steps) {
178
- t5 = progressTone(steps);
179
- $[5] = steps;
180
- $[6] = t5;
181
- } else {
182
- t5 = $[6];
183
- }
184
- let t6;
185
- if ($[7] !== t4 || $[8] !== t5 || $[9] !== title) {
186
- t6 = /*#__PURE__*/_jsx(PanelHeader, {
187
- icon: t3,
60
+ export function Steps({
61
+ steps,
62
+ title = "Plan",
63
+ className
64
+ }) {
65
+ const currentId = currentStepId(steps);
66
+ return /*#__PURE__*/_jsxs(ApprovalPanel, {
67
+ "data-slot": "steps",
68
+ "aria-label": title,
69
+ className: className,
70
+ children: [/*#__PURE__*/_jsx(PanelHeader, {
71
+ icon: /*#__PURE__*/_jsx(ListChecksIcon, {
72
+ "aria-hidden": true
73
+ }),
188
74
  eyebrow: title,
189
- status: t4,
190
- tone: t5
191
- });
192
- $[7] = t4;
193
- $[8] = t5;
194
- $[9] = title;
195
- $[10] = t6;
196
- } else {
197
- t6 = $[10];
198
- }
199
- let t7;
200
- if ($[11] !== currentId || $[12] !== steps) {
201
- let t8;
202
- if ($[14] !== currentId || $[15] !== steps.length) {
203
- t8 = (step, position) => /*#__PURE__*/_jsx(StepRow, {
75
+ status: progressLabel(steps),
76
+ tone: progressTone(steps)
77
+ }), /*#__PURE__*/_jsx("ol", {
78
+ className: "flex flex-col px-5 pt-4 pb-5",
79
+ children: steps.map((step, position) => /*#__PURE__*/_jsx(StepRow, {
204
80
  step: step,
205
81
  current: step.id === currentId,
206
82
  last: position === steps.length - 1
207
- }, step.id);
208
- $[14] = currentId;
209
- $[15] = steps.length;
210
- $[16] = t8;
211
- } else {
212
- t8 = $[16];
213
- }
214
- t7 = steps.map(t8);
215
- $[11] = currentId;
216
- $[12] = steps;
217
- $[13] = t7;
218
- } else {
219
- t7 = $[13];
220
- }
221
- let t8;
222
- if ($[17] !== t7) {
223
- t8 = /*#__PURE__*/_jsx("ol", {
224
- className: "flex flex-col px-5 pt-4 pb-5",
225
- children: t7
226
- });
227
- $[17] = t7;
228
- $[18] = t8;
229
- } else {
230
- t8 = $[18];
231
- }
232
- let t9;
233
- if ($[19] !== className || $[20] !== t6 || $[21] !== t8 || $[22] !== title) {
234
- t9 = /*#__PURE__*/_jsxs(ApprovalPanel, {
235
- "data-slot": "steps",
236
- "aria-label": title,
237
- className: className,
238
- children: [t6, t8]
239
- });
240
- $[19] = className;
241
- $[20] = t6;
242
- $[21] = t8;
243
- $[22] = title;
244
- $[23] = t9;
245
- } else {
246
- t9 = $[23];
247
- }
248
- return t9;
83
+ }, step.id))
84
+ })]
85
+ });
249
86
  }
@@ -1,4 +1,3 @@
1
- import { c as _c } from "react/compiler-runtime";
2
1
  import { Code } from "../../thread/code/code.js";
3
2
  import { jsx as _jsx } from "react/jsx-runtime";
4
3
  export function prettyJson(value) {
@@ -9,34 +8,15 @@ export function prettyJson(value) {
9
8
  return String(value);
10
9
  }
11
10
  }
12
- export function JsonBlock(t0) {
13
- const $ = _c(5);
14
- const {
15
- label,
16
- value
17
- } = t0;
18
- let t1;
19
- if ($[0] !== value) {
20
- t1 = prettyJson(value);
21
- $[0] = value;
22
- $[1] = t1;
23
- } else {
24
- t1 = $[1];
25
- }
26
- let t2;
27
- if ($[2] !== label || $[3] !== t1) {
28
- t2 = /*#__PURE__*/_jsx(Code, {
29
- "data-slot": "tool-json",
30
- code: t1,
31
- language: "json",
32
- filename: label,
33
- className: "[&_[data-slot=code-area]]:max-h-72 [&_[data-slot=code-area]]:overflow-auto"
34
- });
35
- $[2] = label;
36
- $[3] = t1;
37
- $[4] = t2;
38
- } else {
39
- t2 = $[4];
40
- }
41
- return t2;
11
+ export function JsonBlock({
12
+ label,
13
+ value
14
+ }) {
15
+ return /*#__PURE__*/_jsx(Code, {
16
+ "data-slot": "tool-json",
17
+ code: prettyJson(value),
18
+ language: "json",
19
+ filename: label,
20
+ className: "[&_[data-slot=code-area]]:max-h-72 [&_[data-slot=code-area]]:overflow-auto"
21
+ });
42
22
  }
@@ -1,4 +1,3 @@
1
- import { c as _c } from "react/compiler-runtime";
2
1
  import { StatusDot } from "../../shared/status-dot.js";
3
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
4
3
  export const toolStateLabels = {
@@ -22,38 +21,16 @@ const toolStateTones = {
22
21
  export function isToolBusy(state) {
23
22
  return state === "input-streaming" || state === "input-available";
24
23
  }
25
- export function ToolStatus(t0) {
26
- const $ = _c(6);
27
- const {
28
- state
29
- } = t0;
30
- const t1 = toolStateTones[state];
31
- let t2;
32
- if ($[0] !== t1) {
33
- t2 = /*#__PURE__*/_jsx(StatusDot, {
34
- tone: t1
35
- });
36
- $[0] = t1;
37
- $[1] = t2;
38
- } else {
39
- t2 = $[1];
40
- }
41
- const t3 = toolStateLabels[state];
42
- let t4;
43
- if ($[2] !== state || $[3] !== t2 || $[4] !== t3) {
44
- t4 = /*#__PURE__*/_jsxs("span", {
45
- "data-slot": "tool-status",
46
- "data-state": state,
47
- "aria-live": "polite",
48
- className: "eyebrow flex shrink-0 items-center gap-1.5",
49
- children: [t2, t3]
50
- });
51
- $[2] = state;
52
- $[3] = t2;
53
- $[4] = t3;
54
- $[5] = t4;
55
- } else {
56
- t4 = $[5];
57
- }
58
- return t4;
24
+ export function ToolStatus({
25
+ state
26
+ }) {
27
+ return /*#__PURE__*/_jsxs("span", {
28
+ "data-slot": "tool-status",
29
+ "data-state": state,
30
+ "aria-live": "polite",
31
+ className: "eyebrow flex shrink-0 items-center gap-1.5",
32
+ children: [/*#__PURE__*/_jsx(StatusDot, {
33
+ tone: toolStateTones[state]
34
+ }), toolStateLabels[state]]
35
+ });
59
36
  }