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