@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 { ChevronRight as ChevronRightIcon, RecentlyViewed as HistoryIcon } from "@carbon/icons-react";
3
2
  import { Collapsible, CollapsibleContent, CollapsibleTrigger, cn } from "@locusgraph/components";
4
3
  import { pluralize } from "@locusgraph/utils";
@@ -7,235 +6,77 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
7
6
  export function relevancePercent(relevance) {
8
7
  return Math.round(Math.min(Math.max(relevance, 0), 1) * 100);
9
8
  }
10
- export function Recall(t0) {
11
- const $ = _c(20);
12
- const {
13
- memories,
14
- onOpenMemory,
15
- defaultOpen: t1,
16
- className
17
- } = t0;
18
- const defaultOpen = t1 === undefined ? false : t1;
19
- if (memories.length === 0) {
20
- return null;
21
- }
22
- let t2;
23
- if ($[0] !== className) {
24
- t2 = cn("flex min-w-0 flex-col gap-2", className);
25
- $[0] = className;
26
- $[1] = t2;
27
- } else {
28
- t2 = $[1];
29
- }
30
- let t3;
31
- if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
32
- t3 = /*#__PURE__*/_jsx(HistoryIcon, {
33
- "aria-hidden": true
34
- });
35
- $[2] = t3;
36
- } else {
37
- t3 = $[2];
38
- }
39
- let t4;
40
- if ($[3] !== memories.length) {
41
- t4 = pluralize(memories.length, "memory", "memories");
42
- $[3] = memories.length;
43
- $[4] = t4;
44
- } else {
45
- t4 = $[4];
46
- }
47
- let t5;
48
- if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
49
- t5 = /*#__PURE__*/_jsx(ChevronRightIcon, {
50
- "aria-hidden": true,
51
- className: chevronClass
52
- });
53
- $[5] = t5;
54
- } else {
55
- t5 = $[5];
56
- }
57
- let t6;
58
- if ($[6] !== t4) {
59
- t6 = /*#__PURE__*/_jsxs(CollapsibleTrigger, {
9
+ export function Recall({
10
+ memories,
11
+ onOpenMemory,
12
+ defaultOpen = false,
13
+ className
14
+ }) {
15
+ if (memories.length === 0) return null;
16
+ return /*#__PURE__*/_jsxs(Collapsible, {
17
+ "data-slot": "recall",
18
+ defaultOpen: defaultOpen,
19
+ className: cn("flex min-w-0 flex-col gap-2", className),
20
+ children: [/*#__PURE__*/_jsxs(CollapsibleTrigger, {
60
21
  className: collapsibleTriggerClass,
61
- children: [t3, "Recalled ", t4, t5]
62
- });
63
- $[6] = t4;
64
- $[7] = t6;
65
- } else {
66
- t6 = $[7];
67
- }
68
- let t7;
69
- if ($[8] !== memories || $[9] !== onOpenMemory) {
70
- let t8;
71
- if ($[11] !== onOpenMemory) {
72
- t8 = memory => /*#__PURE__*/_jsx(RecallRow, {
73
- memory: memory,
74
- onOpenMemory: onOpenMemory
75
- }, memory.id);
76
- $[11] = onOpenMemory;
77
- $[12] = t8;
78
- } else {
79
- t8 = $[12];
80
- }
81
- t7 = memories.map(t8);
82
- $[8] = memories;
83
- $[9] = onOpenMemory;
84
- $[10] = t7;
85
- } else {
86
- t7 = $[10];
87
- }
88
- let t8;
89
- if ($[13] !== t7) {
90
- t8 = /*#__PURE__*/_jsx(CollapsibleContent, {
22
+ children: [/*#__PURE__*/_jsx(HistoryIcon, {
23
+ "aria-hidden": true
24
+ }), "Recalled ", pluralize(memories.length, "memory", "memories"), /*#__PURE__*/_jsx(ChevronRightIcon, {
25
+ "aria-hidden": true,
26
+ className: chevronClass
27
+ })]
28
+ }), /*#__PURE__*/_jsx(CollapsibleContent, {
91
29
  children: /*#__PURE__*/_jsx("ul", {
92
30
  className: ruledListClass,
93
- children: t7
31
+ children: memories.map(memory => /*#__PURE__*/_jsx(RecallRow, {
32
+ memory: memory,
33
+ onOpenMemory: onOpenMemory
34
+ }, memory.id))
94
35
  })
95
- });
96
- $[13] = t7;
97
- $[14] = t8;
98
- } else {
99
- t8 = $[14];
100
- }
101
- let t9;
102
- if ($[15] !== defaultOpen || $[16] !== t2 || $[17] !== t6 || $[18] !== t8) {
103
- t9 = /*#__PURE__*/_jsxs(Collapsible, {
104
- "data-slot": "recall",
105
- defaultOpen: defaultOpen,
106
- className: t2,
107
- children: [t6, t8]
108
- });
109
- $[15] = defaultOpen;
110
- $[16] = t2;
111
- $[17] = t6;
112
- $[18] = t8;
113
- $[19] = t9;
114
- } else {
115
- t9 = $[19];
116
- }
117
- return t9;
36
+ })]
37
+ });
118
38
  }
119
- function RelevanceMeter(t0) {
120
- const $ = _c(14);
121
- const {
122
- memory
123
- } = t0;
124
- if (memory.relevance === undefined) {
125
- return null;
126
- }
127
- let t1;
128
- if ($[0] !== memory.relevance) {
129
- t1 = relevancePercent(memory.relevance);
130
- $[0] = memory.relevance;
131
- $[1] = t1;
132
- } else {
133
- t1 = $[1];
134
- }
135
- const percent = t1;
136
- const t2 = `Relevance of ${memory.label}`;
137
- const t3 = `${percent}% relevant`;
138
- const t4 = `${percent}%`;
139
- let t5;
140
- if ($[2] !== t4) {
141
- t5 = /*#__PURE__*/_jsx("span", {
142
- className: "absolute inset-y-0 left-0 bg-foreground/60 transition-[width] duration-300 motion-reduce:transition-none",
143
- style: {
144
- width: t4
145
- }
146
- });
147
- $[2] = t4;
148
- $[3] = t5;
149
- } else {
150
- t5 = $[3];
151
- }
152
- let t6;
153
- if ($[4] !== percent || $[5] !== t2 || $[6] !== t3 || $[7] !== t5) {
154
- t6 = /*#__PURE__*/_jsx("span", {
39
+ function RelevanceMeter({
40
+ memory
41
+ }) {
42
+ if (memory.relevance === undefined) return null;
43
+ const percent = relevancePercent(memory.relevance);
44
+ return /*#__PURE__*/_jsxs("span", {
45
+ className: "flex shrink-0 items-center gap-2",
46
+ children: [/*#__PURE__*/_jsx("span", {
155
47
  role: "meter",
156
- "aria-label": t2,
48
+ "aria-label": `Relevance of ${memory.label}`,
157
49
  "aria-valuemin": 0,
158
50
  "aria-valuemax": 100,
159
51
  "aria-valuenow": percent,
160
- "aria-valuetext": t3,
52
+ "aria-valuetext": `${percent}% relevant`,
161
53
  className: "relative h-[3px] w-10 overflow-hidden bg-muted",
162
- children: t5
163
- });
164
- $[4] = percent;
165
- $[5] = t2;
166
- $[6] = t3;
167
- $[7] = t5;
168
- $[8] = t6;
169
- } else {
170
- t6 = $[8];
171
- }
172
- let t7;
173
- if ($[9] !== percent) {
174
- t7 = /*#__PURE__*/_jsxs("span", {
54
+ children: /*#__PURE__*/_jsx("span", {
55
+ className: "absolute inset-y-0 left-0 bg-foreground/60 transition-[width] duration-300 motion-reduce:transition-none",
56
+ style: {
57
+ width: `${percent}%`
58
+ }
59
+ })
60
+ }), /*#__PURE__*/_jsxs("span", {
175
61
  className: "w-8 text-right font-mono text-xs text-muted-foreground tabular-nums",
176
62
  children: [percent, "%"]
177
- });
178
- $[9] = percent;
179
- $[10] = t7;
180
- } else {
181
- t7 = $[10];
182
- }
183
- let t8;
184
- if ($[11] !== t6 || $[12] !== t7) {
185
- t8 = /*#__PURE__*/_jsxs("span", {
186
- className: "flex shrink-0 items-center gap-2",
187
- children: [t6, t7]
188
- });
189
- $[11] = t6;
190
- $[12] = t7;
191
- $[13] = t8;
192
- } else {
193
- t8 = $[13];
194
- }
195
- return t8;
63
+ })]
64
+ });
196
65
  }
197
- function RecallRow(t0) {
198
- const $ = _c(21);
199
- const {
200
- memory,
201
- onOpenMemory
202
- } = t0;
203
- let t1;
204
- if ($[0] !== memory.label) {
205
- t1 = /*#__PURE__*/_jsx("span", {
206
- className: "min-w-0 flex-1 truncate text-sm font-medium",
207
- children: memory.label
208
- });
209
- $[0] = memory.label;
210
- $[1] = t1;
211
- } else {
212
- t1 = $[1];
213
- }
214
- let t2;
215
- if ($[2] !== memory) {
216
- t2 = /*#__PURE__*/_jsx(RelevanceMeter, {
217
- memory: memory
218
- });
219
- $[2] = memory;
220
- $[3] = t2;
221
- } else {
222
- t2 = $[3];
223
- }
224
- let t3;
225
- if ($[4] !== t1 || $[5] !== t2) {
226
- t3 = /*#__PURE__*/_jsxs("span", {
66
+ function RecallRow({
67
+ memory,
68
+ onOpenMemory
69
+ }) {
70
+ const content = /*#__PURE__*/_jsxs(_Fragment, {
71
+ children: [/*#__PURE__*/_jsxs("span", {
227
72
  className: "flex w-full items-baseline gap-3",
228
- children: [t1, t2]
229
- });
230
- $[4] = t1;
231
- $[5] = t2;
232
- $[6] = t3;
233
- } else {
234
- t3 = $[6];
235
- }
236
- let t4;
237
- if ($[7] !== memory.kind || $[8] !== memory.snippet) {
238
- t4 = (memory.kind || memory.snippet) && /*#__PURE__*/_jsxs("span", {
73
+ children: [/*#__PURE__*/_jsx("span", {
74
+ className: "min-w-0 flex-1 truncate text-sm font-medium",
75
+ children: memory.label
76
+ }), /*#__PURE__*/_jsx(RelevanceMeter, {
77
+ memory: memory
78
+ })]
79
+ }), (memory.kind || memory.snippet) && /*#__PURE__*/_jsxs("span", {
239
80
  className: "flex w-full gap-2 text-xs text-muted-foreground",
240
81
  children: [memory.kind && /*#__PURE__*/_jsx("span", {
241
82
  className: "shrink-0 font-mono",
@@ -247,57 +88,21 @@ function RecallRow(t0) {
247
88
  className: "line-clamp-2 min-w-0",
248
89
  children: memory.snippet
249
90
  })]
250
- });
251
- $[7] = memory.kind;
252
- $[8] = memory.snippet;
253
- $[9] = t4;
254
- } else {
255
- t4 = $[9];
256
- }
257
- let t5;
258
- if ($[10] !== t3 || $[11] !== t4) {
259
- t5 = /*#__PURE__*/_jsxs(_Fragment, {
260
- children: [t3, t4]
261
- });
262
- $[10] = t3;
263
- $[11] = t4;
264
- $[12] = t5;
265
- } else {
266
- t5 = $[12];
267
- }
268
- const content = t5;
269
- let t6;
270
- if ($[13] !== content || $[14] !== memory.id || $[15] !== memory.label || $[16] !== onOpenMemory) {
271
- t6 = onOpenMemory ? /*#__PURE__*/_jsx("button", {
91
+ })]
92
+ });
93
+ const rowClass = "flex w-full flex-col items-start gap-1 px-3 py-2.5 text-left";
94
+ return /*#__PURE__*/_jsx("li", {
95
+ "data-slot": "recall-item",
96
+ "data-id": memory.id,
97
+ children: onOpenMemory ? /*#__PURE__*/_jsx("button", {
272
98
  type: "button",
273
99
  "aria-label": `Open memory ${memory.label}`,
274
100
  onClick: () => onOpenMemory(memory.id),
275
- className: cn("flex w-full flex-col items-start gap-1 px-3 py-2.5 text-left", interactiveRowClass),
101
+ className: cn(rowClass, interactiveRowClass),
276
102
  children: content
277
103
  }) : /*#__PURE__*/_jsx("div", {
278
- className: "flex w-full flex-col items-start gap-1 px-3 py-2.5 text-left",
104
+ className: rowClass,
279
105
  children: content
280
- });
281
- $[13] = content;
282
- $[14] = memory.id;
283
- $[15] = memory.label;
284
- $[16] = onOpenMemory;
285
- $[17] = t6;
286
- } else {
287
- t6 = $[17];
288
- }
289
- let t7;
290
- if ($[18] !== memory.id || $[19] !== t6) {
291
- t7 = /*#__PURE__*/_jsx("li", {
292
- "data-slot": "recall-item",
293
- "data-id": memory.id,
294
- children: t6
295
- });
296
- $[18] = memory.id;
297
- $[19] = t6;
298
- $[20] = t7;
299
- } else {
300
- t7 = $[20];
301
- }
302
- return t7;
106
+ })
107
+ });
303
108
  }
@@ -1,42 +1,14 @@
1
- import { c as _c } from "react/compiler-runtime";
2
1
  import { cn } from "@locusgraph/components";
3
2
  import { sourceInitial } from "./host-label.js";
4
3
  import { jsx as _jsx } from "react/jsx-runtime";
5
- export function SourceMark(t0) {
6
- const $ = _c(7);
7
- const {
8
- citation,
9
- className
10
- } = t0;
11
- let t1;
12
- if ($[0] !== className) {
13
- t1 = cn("flex size-4 shrink-0 items-center justify-center bg-muted font-mono text-[11px] leading-none font-medium text-muted-foreground ring-1 ring-border", className);
14
- $[0] = className;
15
- $[1] = t1;
16
- } else {
17
- t1 = $[1];
18
- }
19
- let t2;
20
- if ($[2] !== citation) {
21
- t2 = sourceInitial(citation);
22
- $[2] = citation;
23
- $[3] = t2;
24
- } else {
25
- t2 = $[3];
26
- }
27
- let t3;
28
- if ($[4] !== t1 || $[5] !== t2) {
29
- t3 = /*#__PURE__*/_jsx("span", {
30
- "aria-hidden": true,
31
- "data-slot": "source-mark",
32
- className: t1,
33
- children: t2
34
- });
35
- $[4] = t1;
36
- $[5] = t2;
37
- $[6] = t3;
38
- } else {
39
- t3 = $[6];
40
- }
41
- return t3;
4
+ export function SourceMark({
5
+ citation,
6
+ className
7
+ }) {
8
+ return /*#__PURE__*/_jsx("span", {
9
+ "aria-hidden": true,
10
+ "data-slot": "source-mark",
11
+ className: cn("flex size-4 shrink-0 items-center justify-center bg-muted font-mono text-[11px] leading-none font-medium text-muted-foreground ring-1 ring-border", className),
12
+ children: sourceInitial(citation)
13
+ });
42
14
  }