@locusgraph/loop 0.2.1 → 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 (66) 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/pulse.js +1 -1
  7. package/dist/agent/pulse/use-loop-animation.js +35 -12
  8. package/dist/agent/thinking/thinking.js +2 -2
  9. package/dist/agent/tool/tool-status.js +1 -1
  10. package/dist/approval/inbox/inbox-row.js +303 -76
  11. package/dist/approval/inbox/inbox.js +192 -39
  12. package/dist/approval/inbox/virtual-inbox-list.js +104 -26
  13. package/dist/approval/memory/memory-review.js +172 -36
  14. package/dist/approval/memory/memory-row.js +187 -50
  15. package/dist/approval/plan/plan-review.js +225 -73
  16. package/dist/approval/plan/plan-step-row.js +182 -76
  17. package/dist/approval/plan/question-choices.js +132 -44
  18. package/dist/approval/plan/question.js +156 -38
  19. package/dist/approval/run/run-bar.js +125 -39
  20. package/dist/approval/shared/use-focus-on-mount.js +23 -5
  21. package/dist/approval/spend/raise-cap-form.js +223 -48
  22. package/dist/approval/spend/spend-gate.js +157 -40
  23. package/dist/approval/spend/spend-meter.js +1 -1
  24. package/dist/approval/tool/approval.js +196 -35
  25. package/dist/approval/tool/args/args-editor.js +206 -46
  26. package/dist/approval/tool/args/args-field.js +240 -55
  27. package/dist/approval/tool/deny-form.js +125 -36
  28. package/dist/approval/tool/tool-inputs.js +91 -24
  29. package/dist/chat/chat/use-stick-to-bottom.js +115 -60
  30. package/dist/chat/chat/virtual-chat-items.js +129 -34
  31. package/dist/chat/composer/composer-actions.d.ts +1 -2
  32. package/dist/chat/composer/composer-actions.js +132 -49
  33. package/dist/chat/composer/composer-status.d.ts +2 -0
  34. package/dist/chat/composer/composer-status.js +3 -0
  35. package/dist/chat/composer/composer.d.ts +1 -1
  36. package/dist/chat/composer/composer.js +2 -1
  37. package/dist/chat/composer/use-auto-grow.js +25 -8
  38. package/dist/chat/files/files.js +293 -66
  39. package/dist/chat/index.d.ts +1 -1
  40. package/dist/chat/index.js +1 -1
  41. package/dist/chat/reply/markdown-components.js +2 -2
  42. package/dist/cost/context.js +1 -1
  43. package/dist/cost/cost.js +1 -1
  44. package/dist/cost/model-picker.js +174 -42
  45. package/dist/cost/shared/context-breakdown.js +1 -1
  46. package/dist/memory/cite.js +181 -58
  47. package/dist/memory/memorized.js +197 -43
  48. package/dist/memory/recall.js +265 -68
  49. package/dist/memory/shared/disclosure.d.ts +2 -2
  50. package/dist/memory/shared/disclosure.js +1 -1
  51. package/dist/memory/sources.js +232 -52
  52. package/dist/shared/panel.js +1 -1
  53. package/dist/shared/virtual/use-list-virtualizer.js +2 -0
  54. package/dist/thread/actions/branch-switcher.js +97 -21
  55. package/dist/thread/canvas/canvas.js +1 -1
  56. package/dist/thread/canvas/version-switcher.js +128 -31
  57. package/dist/thread/code/code.js +2 -2
  58. package/dist/thread/code/copy-code-button.js +58 -24
  59. package/dist/thread/history/history.js +1 -1
  60. package/dist/thread/history/row/history-row.js +99 -18
  61. package/dist/thread/history/row/thread-item-menu.js +74 -19
  62. package/dist/thread/history/row/thread-title-editor.js +74 -29
  63. package/dist/thread/history/virtual-history-list.js +84 -46
  64. package/dist/thread/starters/starters.js +89 -27
  65. package/dist/thread/use-copied.js +40 -10
  66. package/package.json +3 -3
@@ -1,3 +1,6 @@
1
+ "use client";
2
+
3
+ import { c as _c } from "react/compiler-runtime";
1
4
  import { cn, HoverCard, HoverCardContent, HoverCardTrigger } from "@locusgraph/components";
2
5
  import { hostLabel } from "./shared/host-label.js";
3
6
  import { SourceMark } from "./shared/source-mark.js";
@@ -6,64 +9,184 @@ const pillClass = "inline-flex h-4 min-w-4 items-center justify-center bg-muted
6
9
  export function citationLabel(citation) {
7
10
  return `Source ${citation.index}: ${citation.title}`;
8
11
  }
9
- export function Cite({
10
- citation,
11
- onOpen,
12
- className
13
- }) {
14
- const host = hostLabel(citation.url);
15
- const label = citationLabel(citation);
16
- const open = event => {
17
- if (!onOpen) return;
18
- event.preventDefault();
19
- onOpen(citation);
20
- };
21
- return /*#__PURE__*/_jsx("sup", {
22
- "data-slot": "cite",
23
- "data-index": citation.index,
24
- className: cn("relative -top-1 ml-0.5 align-baseline leading-none", className),
25
- children: /*#__PURE__*/_jsxs(HoverCard, {
12
+ export function Cite(t0) {
13
+ const $ = _c(36);
14
+ const {
15
+ citation,
16
+ onOpen,
17
+ className
18
+ } = t0;
19
+ let t1;
20
+ if ($[0] !== citation.url) {
21
+ t1 = hostLabel(citation.url);
22
+ $[0] = citation.url;
23
+ $[1] = t1;
24
+ } else {
25
+ t1 = $[1];
26
+ }
27
+ const host = t1;
28
+ let t2;
29
+ if ($[2] !== citation) {
30
+ t2 = citationLabel(citation);
31
+ $[2] = citation;
32
+ $[3] = t2;
33
+ } else {
34
+ t2 = $[3];
35
+ }
36
+ const label = t2;
37
+ let t3;
38
+ if ($[4] !== citation || $[5] !== onOpen) {
39
+ t3 = event => {
40
+ if (!onOpen) {
41
+ return;
42
+ }
43
+ event.preventDefault();
44
+ onOpen(citation);
45
+ };
46
+ $[4] = citation;
47
+ $[5] = onOpen;
48
+ $[6] = t3;
49
+ } else {
50
+ t3 = $[6];
51
+ }
52
+ const open = t3;
53
+ const t4 = citation.index;
54
+ let t5;
55
+ if ($[7] !== className) {
56
+ t5 = cn("relative -top-1 ml-0.5 align-baseline leading-none", className);
57
+ $[7] = className;
58
+ $[8] = t5;
59
+ } else {
60
+ t5 = $[8];
61
+ }
62
+ let t6;
63
+ if ($[9] !== citation.index || $[10] !== citation.url || $[11] !== label || $[12] !== open) {
64
+ t6 = /*#__PURE__*/_jsx(HoverCardTrigger, {
65
+ asChild: true,
66
+ children: citation.url ? /*#__PURE__*/_jsx("a", {
67
+ href: citation.url,
68
+ target: "_blank",
69
+ rel: "noreferrer",
70
+ "aria-label": label,
71
+ onClick: open,
72
+ className: pillClass,
73
+ children: citation.index
74
+ }) : /*#__PURE__*/_jsx("button", {
75
+ type: "button",
76
+ "aria-label": label,
77
+ onClick: open,
78
+ className: pillClass,
79
+ children: citation.index
80
+ })
81
+ });
82
+ $[9] = citation.index;
83
+ $[10] = citation.url;
84
+ $[11] = label;
85
+ $[12] = open;
86
+ $[13] = t6;
87
+ } else {
88
+ t6 = $[13];
89
+ }
90
+ let t7;
91
+ if ($[14] !== citation) {
92
+ t7 = /*#__PURE__*/_jsx(SourceMark, {
93
+ citation: citation
94
+ });
95
+ $[14] = citation;
96
+ $[15] = t7;
97
+ } else {
98
+ t7 = $[15];
99
+ }
100
+ const t8 = host ?? "Source";
101
+ let t9;
102
+ if ($[16] !== t8) {
103
+ t9 = /*#__PURE__*/_jsx("span", {
104
+ className: "truncate",
105
+ children: t8
106
+ });
107
+ $[16] = t8;
108
+ $[17] = t9;
109
+ } else {
110
+ t9 = $[17];
111
+ }
112
+ let t10;
113
+ if ($[18] !== t7 || $[19] !== t9) {
114
+ t10 = /*#__PURE__*/_jsxs("span", {
115
+ className: "locus-eyebrow flex min-w-0 items-center gap-2",
116
+ children: [t7, t9]
117
+ });
118
+ $[18] = t7;
119
+ $[19] = t9;
120
+ $[20] = t10;
121
+ } else {
122
+ t10 = $[20];
123
+ }
124
+ let t11;
125
+ if ($[21] !== citation.title) {
126
+ t11 = /*#__PURE__*/_jsx("span", {
127
+ className: "text-sm leading-snug font-medium",
128
+ children: citation.title
129
+ });
130
+ $[21] = citation.title;
131
+ $[22] = t11;
132
+ } else {
133
+ t11 = $[22];
134
+ }
135
+ let t12;
136
+ if ($[23] !== citation.snippet) {
137
+ t12 = citation.snippet && /*#__PURE__*/_jsx("p", {
138
+ className: "line-clamp-4 text-xs leading-relaxed text-muted-foreground",
139
+ children: citation.snippet
140
+ });
141
+ $[23] = citation.snippet;
142
+ $[24] = t12;
143
+ } else {
144
+ t12 = $[24];
145
+ }
146
+ let t13;
147
+ if ($[25] !== t10 || $[26] !== t11 || $[27] !== t12) {
148
+ t13 = /*#__PURE__*/_jsxs(HoverCardContent, {
149
+ "data-slot": "cite-card",
150
+ side: "bottom",
151
+ align: "start",
152
+ sideOffset: 6,
153
+ className: "flex w-72 flex-col gap-2 rounded-none border-0 p-4 ring-1 ring-border",
154
+ children: [t10, t11, t12]
155
+ });
156
+ $[25] = t10;
157
+ $[26] = t11;
158
+ $[27] = t12;
159
+ $[28] = t13;
160
+ } else {
161
+ t13 = $[28];
162
+ }
163
+ let t14;
164
+ if ($[29] !== t13 || $[30] !== t6) {
165
+ t14 = /*#__PURE__*/_jsxs(HoverCard, {
26
166
  openDelay: 150,
27
167
  closeDelay: 100,
28
- children: [/*#__PURE__*/_jsx(HoverCardTrigger, {
29
- asChild: true,
30
- children: citation.url ? /*#__PURE__*/_jsx("a", {
31
- href: citation.url,
32
- target: "_blank",
33
- rel: "noreferrer",
34
- "aria-label": label,
35
- onClick: open,
36
- className: pillClass,
37
- children: citation.index
38
- }) : /*#__PURE__*/_jsx("button", {
39
- type: "button",
40
- "aria-label": label,
41
- onClick: open,
42
- className: pillClass,
43
- children: citation.index
44
- })
45
- }), /*#__PURE__*/_jsxs(HoverCardContent, {
46
- "data-slot": "cite-card",
47
- side: "bottom",
48
- align: "start",
49
- sideOffset: 6,
50
- className: "flex w-72 flex-col gap-2 rounded-none border-0 p-4 ring-1 ring-border",
51
- children: [/*#__PURE__*/_jsxs("span", {
52
- className: "eyebrow flex min-w-0 items-center gap-2",
53
- children: [/*#__PURE__*/_jsx(SourceMark, {
54
- citation: citation
55
- }), /*#__PURE__*/_jsx("span", {
56
- className: "truncate",
57
- children: host ?? "Source"
58
- })]
59
- }), /*#__PURE__*/_jsx("span", {
60
- className: "text-sm leading-snug font-medium",
61
- children: citation.title
62
- }), citation.snippet && /*#__PURE__*/_jsx("p", {
63
- className: "line-clamp-4 text-xs leading-relaxed text-muted-foreground",
64
- children: citation.snippet
65
- })]
66
- })]
67
- })
68
- });
168
+ children: [t6, t13]
169
+ });
170
+ $[29] = t13;
171
+ $[30] = t6;
172
+ $[31] = t14;
173
+ } else {
174
+ t14 = $[31];
175
+ }
176
+ let t15;
177
+ if ($[32] !== citation.index || $[33] !== t14 || $[34] !== t5) {
178
+ t15 = /*#__PURE__*/_jsx("sup", {
179
+ "data-slot": "cite",
180
+ "data-index": t4,
181
+ className: t5,
182
+ children: t14
183
+ });
184
+ $[32] = citation.index;
185
+ $[33] = t14;
186
+ $[34] = t5;
187
+ $[35] = t15;
188
+ } else {
189
+ t15 = $[35];
190
+ }
191
+ return t15;
69
192
  }
@@ -1,3 +1,6 @@
1
+ "use client";
2
+
3
+ import { c as _c } from "react/compiler-runtime";
1
4
  import { BookmarkAdd as BookmarkPlusIcon, Checkmark as CheckIcon, Undo as Undo2Icon } from "@carbon/icons-react";
2
5
  import { Button, cn } from "@locusgraph/components";
3
6
  import { pluralize } from "@locusgraph/utils";
@@ -8,54 +11,181 @@ export function memorizedSummary(items) {
8
11
  const saved = items.filter(item => item.status === "saved").length;
9
12
  return `Saved ${pluralize(saved, "memory", "memories")}`;
10
13
  }
11
- export function Memorized({
12
- items,
13
- onUndo,
14
- className
15
- }) {
16
- if (items.length === 0) return null;
17
- return /*#__PURE__*/_jsxs("section", {
18
- "data-slot": "memorized",
19
- "aria-label": "Saved to memory",
20
- className: cn("flex min-w-0 flex-col gap-2", className),
21
- children: [/*#__PURE__*/_jsxs("header", {
14
+ export function Memorized(t0) {
15
+ const $ = _c(19);
16
+ const {
17
+ items,
18
+ onUndo,
19
+ className
20
+ } = t0;
21
+ if (items.length === 0) {
22
+ return null;
23
+ }
24
+ let t1;
25
+ if ($[0] !== className) {
26
+ t1 = cn("flex min-w-0 flex-col gap-2", className);
27
+ $[0] = className;
28
+ $[1] = t1;
29
+ } else {
30
+ t1 = $[1];
31
+ }
32
+ let t2;
33
+ let t3;
34
+ if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
35
+ t2 = cn("flex items-center gap-2 py-1", eyebrowClass);
36
+ t3 = /*#__PURE__*/_jsx(BookmarkPlusIcon, {
37
+ "aria-hidden": true
38
+ });
39
+ $[2] = t2;
40
+ $[3] = t3;
41
+ } else {
42
+ t2 = $[2];
43
+ t3 = $[3];
44
+ }
45
+ let t4;
46
+ if ($[4] !== items) {
47
+ t4 = memorizedSummary(items);
48
+ $[4] = items;
49
+ $[5] = t4;
50
+ } else {
51
+ t4 = $[5];
52
+ }
53
+ let t5;
54
+ if ($[6] !== t4) {
55
+ t5 = /*#__PURE__*/_jsxs("header", {
22
56
  "aria-live": "polite",
23
- className: cn("flex items-center gap-2 py-1", eyebrowClass),
24
- children: [/*#__PURE__*/_jsx(BookmarkPlusIcon, {
25
- "aria-hidden": true
26
- }), memorizedSummary(items)]
27
- }), /*#__PURE__*/_jsx("ul", {
28
- className: ruledListClass,
29
- children: items.map(item => /*#__PURE__*/_jsx(MemorizedRow, {
57
+ className: t2,
58
+ children: [t3, t4]
59
+ });
60
+ $[6] = t4;
61
+ $[7] = t5;
62
+ } else {
63
+ t5 = $[7];
64
+ }
65
+ let t6;
66
+ if ($[8] !== items || $[9] !== onUndo) {
67
+ let t7;
68
+ if ($[11] !== onUndo) {
69
+ t7 = item => /*#__PURE__*/_jsx(MemorizedRow, {
30
70
  item: item,
31
71
  onUndo: onUndo
32
- }, item.id))
33
- })]
34
- });
72
+ }, item.id);
73
+ $[11] = onUndo;
74
+ $[12] = t7;
75
+ } else {
76
+ t7 = $[12];
77
+ }
78
+ t6 = items.map(t7);
79
+ $[8] = items;
80
+ $[9] = onUndo;
81
+ $[10] = t6;
82
+ } else {
83
+ t6 = $[10];
84
+ }
85
+ let t7;
86
+ if ($[13] !== t6) {
87
+ t7 = /*#__PURE__*/_jsx("ul", {
88
+ className: ruledListClass,
89
+ children: t6
90
+ });
91
+ $[13] = t6;
92
+ $[14] = t7;
93
+ } else {
94
+ t7 = $[14];
95
+ }
96
+ let t8;
97
+ if ($[15] !== t1 || $[16] !== t5 || $[17] !== t7) {
98
+ t8 = /*#__PURE__*/_jsxs("section", {
99
+ "data-slot": "memorized",
100
+ "aria-label": "Saved to memory",
101
+ className: t1,
102
+ children: [t5, t7]
103
+ });
104
+ $[15] = t1;
105
+ $[16] = t5;
106
+ $[17] = t7;
107
+ $[18] = t8;
108
+ } else {
109
+ t8 = $[18];
110
+ }
111
+ return t8;
35
112
  }
36
- function MemorizedRow({
37
- item,
38
- onUndo
39
- }) {
113
+ function MemorizedRow(t0) {
114
+ const $ = _c(24);
115
+ const {
116
+ item,
117
+ onUndo
118
+ } = t0;
40
119
  const undone = item.status === "undone";
41
- return /*#__PURE__*/_jsxs("li", {
42
- "data-slot": "memorized-item",
43
- "data-status": item.status,
44
- className: "flex min-h-11 items-center gap-3 px-3 py-2.5",
45
- children: [/*#__PURE__*/_jsx(CheckIcon, {
120
+ const t1 = item.status;
121
+ const t2 = undone ? "text-muted-foreground/40" : "text-good";
122
+ let t3;
123
+ if ($[0] !== t2) {
124
+ t3 = cn("size-3.5 shrink-0", t2);
125
+ $[0] = t2;
126
+ $[1] = t3;
127
+ } else {
128
+ t3 = $[1];
129
+ }
130
+ let t4;
131
+ if ($[2] !== t3) {
132
+ t4 = /*#__PURE__*/_jsx(CheckIcon, {
46
133
  "aria-hidden": true,
47
- className: cn("size-3.5 shrink-0", undone ? "text-muted-foreground/40" : "text-good")
48
- }), /*#__PURE__*/_jsxs("span", {
134
+ className: t3
135
+ });
136
+ $[2] = t3;
137
+ $[3] = t4;
138
+ } else {
139
+ t4 = $[3];
140
+ }
141
+ const t5 = undone && "font-normal text-muted-foreground line-through decoration-muted-foreground";
142
+ let t6;
143
+ if ($[4] !== t5) {
144
+ t6 = cn("text-sm font-medium", t5);
145
+ $[4] = t5;
146
+ $[5] = t6;
147
+ } else {
148
+ t6 = $[5];
149
+ }
150
+ let t7;
151
+ if ($[6] !== item.text || $[7] !== t6) {
152
+ t7 = /*#__PURE__*/_jsx("span", {
153
+ className: t6,
154
+ children: item.text
155
+ });
156
+ $[6] = item.text;
157
+ $[7] = t6;
158
+ $[8] = t7;
159
+ } else {
160
+ t7 = $[8];
161
+ }
162
+ let t8;
163
+ if ($[9] !== item.kind) {
164
+ t8 = item.kind && /*#__PURE__*/_jsx("span", {
165
+ className: "font-mono text-xs text-muted-foreground",
166
+ children: item.kind
167
+ });
168
+ $[9] = item.kind;
169
+ $[10] = t8;
170
+ } else {
171
+ t8 = $[10];
172
+ }
173
+ let t9;
174
+ if ($[11] !== t7 || $[12] !== t8) {
175
+ t9 = /*#__PURE__*/_jsxs("span", {
49
176
  className: "flex min-w-0 flex-1 flex-col gap-0.5",
50
- children: [/*#__PURE__*/_jsx("span", {
51
- className: cn("text-sm font-medium", undone && "font-normal text-muted-foreground line-through decoration-muted-foreground"),
52
- children: item.text
53
- }), item.kind && /*#__PURE__*/_jsx("span", {
54
- className: "font-mono text-xs text-muted-foreground",
55
- children: item.kind
56
- })]
57
- }), undone ? /*#__PURE__*/_jsxs("span", {
58
- className: "eyebrow flex shrink-0 items-center gap-1.5",
177
+ children: [t7, t8]
178
+ });
179
+ $[11] = t7;
180
+ $[12] = t8;
181
+ $[13] = t9;
182
+ } else {
183
+ t9 = $[13];
184
+ }
185
+ let t10;
186
+ if ($[14] !== item.id || $[15] !== item.text || $[16] !== onUndo || $[17] !== undone) {
187
+ t10 = undone ? /*#__PURE__*/_jsxs("span", {
188
+ className: "locus-eyebrow flex shrink-0 items-center gap-1.5",
59
189
  children: [/*#__PURE__*/_jsx(StatusDot, {
60
190
  tone: "idle"
61
191
  }), "Undone"]
@@ -68,6 +198,30 @@ function MemorizedRow({
68
198
  children: [/*#__PURE__*/_jsx(Undo2Icon, {
69
199
  "aria-hidden": true
70
200
  }), "Undo"]
71
- })]
72
- });
201
+ });
202
+ $[14] = item.id;
203
+ $[15] = item.text;
204
+ $[16] = onUndo;
205
+ $[17] = undone;
206
+ $[18] = t10;
207
+ } else {
208
+ t10 = $[18];
209
+ }
210
+ let t11;
211
+ if ($[19] !== item.status || $[20] !== t10 || $[21] !== t4 || $[22] !== t9) {
212
+ t11 = /*#__PURE__*/_jsxs("li", {
213
+ "data-slot": "memorized-item",
214
+ "data-status": t1,
215
+ className: "flex min-h-11 items-center gap-3 px-3 py-2.5",
216
+ children: [t4, t9, t10]
217
+ });
218
+ $[19] = item.status;
219
+ $[20] = t10;
220
+ $[21] = t4;
221
+ $[22] = t9;
222
+ $[23] = t11;
223
+ } else {
224
+ t11 = $[23];
225
+ }
226
+ return t11;
73
227
  }