@locusgraph/loop 0.1.0 → 0.2.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 (115) hide show
  1. package/README.md +2 -0
  2. package/dist/agent/pulse/gradient-label.js +86 -15
  3. package/dist/agent/pulse/marks/bars-mark.js +46 -10
  4. package/dist/agent/pulse/marks/glyph-mark.js +56 -11
  5. package/dist/agent/pulse/marks/locus-mark.js +63 -28
  6. package/dist/agent/pulse/marks/orb-mark.js +31 -8
  7. package/dist/agent/pulse/marks/spinner-mark.js +29 -1
  8. package/dist/agent/pulse/pulse.js +150 -35
  9. package/dist/agent/pulse/use-loop-animation.js +36 -17
  10. package/dist/agent/steps/step-icon.js +110 -24
  11. package/dist/agent/steps/steps.js +235 -25
  12. package/dist/agent/thinking/thinking.js +203 -23
  13. package/dist/agent/thinking/thought-duration.js +7 -9
  14. package/dist/agent/tool/json-block.js +38 -11
  15. package/dist/agent/tool/tool-status.js +51 -18
  16. package/dist/agent/tool/tool.js +184 -6
  17. package/dist/approval/inbox/inbox-row.d.ts +3 -2
  18. package/dist/approval/inbox/inbox-row.js +321 -7
  19. package/dist/approval/inbox/inbox-selection.js +7 -13
  20. package/dist/approval/inbox/inbox.d.ts +2 -1
  21. package/dist/approval/inbox/inbox.js +250 -18
  22. package/dist/approval/inbox/virtual-inbox-list.d.ts +13 -0
  23. package/dist/approval/inbox/virtual-inbox-list.js +129 -0
  24. package/dist/approval/memory/memory-choices.js +27 -22
  25. package/dist/approval/memory/memory-review.js +242 -17
  26. package/dist/approval/memory/memory-row.js +215 -19
  27. package/dist/approval/plan/plan-review.js +279 -28
  28. package/dist/approval/plan/plan-step-row.js +194 -43
  29. package/dist/approval/plan/plan-steps.js +24 -23
  30. package/dist/approval/plan/question-choices.js +158 -39
  31. package/dist/approval/plan/question.d.ts +1 -1
  32. package/dist/approval/plan/question.js +223 -26
  33. package/dist/approval/run/run-bar.js +178 -22
  34. package/dist/approval/shared/decision-line.js +1 -1
  35. package/dist/approval/shared/risk-badge.js +47 -16
  36. package/dist/approval/shared/time.js +5 -8
  37. package/dist/approval/shared/use-focus-on-mount.js +23 -6
  38. package/dist/approval/spend/raise-cap-form.js +235 -17
  39. package/dist/approval/spend/spend-gate.js +239 -21
  40. package/dist/approval/spend/spend-math.js +7 -8
  41. package/dist/approval/spend/spend-meter.js +362 -34
  42. package/dist/approval/tool/approval.js +272 -27
  43. package/dist/approval/tool/args/args-editor.js +262 -26
  44. package/dist/approval/tool/args/args-field.js +259 -19
  45. package/dist/approval/tool/args/args-validation.js +38 -47
  46. package/dist/approval/tool/deny-form.js +130 -10
  47. package/dist/approval/tool/tool-inputs.js +127 -38
  48. package/dist/chat/chat/chat-item-spacing.d.ts +3 -0
  49. package/dist/chat/chat/chat-item-spacing.js +19 -0
  50. package/dist/chat/chat/chat.d.ts +2 -1
  51. package/dist/chat/chat/chat.js +181 -5
  52. package/dist/chat/chat/use-stick-to-bottom.js +123 -47
  53. package/dist/chat/chat/virtual-chat-items.d.ts +8 -0
  54. package/dist/chat/chat/virtual-chat-items.js +153 -0
  55. package/dist/chat/composer/composer-actions.js +151 -16
  56. package/dist/chat/composer/composer.js +330 -32
  57. package/dist/chat/composer/use-auto-grow.js +24 -9
  58. package/dist/chat/files/file-meta.js +19 -19
  59. package/dist/chat/files/files.js +316 -28
  60. package/dist/chat/reply/fenced-code.js +45 -21
  61. package/dist/chat/reply/markdown-components.js +137 -17
  62. package/dist/chat/reply/reply.js +105 -10
  63. package/dist/chat/turn/group-parts.js +43 -29
  64. package/dist/chat/turn/turn.js +238 -30
  65. package/dist/cost/context.js +321 -23
  66. package/dist/cost/cost-steps.js +220 -14
  67. package/dist/cost/cost.js +521 -27
  68. package/dist/cost/model-picker.js +181 -6
  69. package/dist/cost/shared/context-breakdown.js +299 -10
  70. package/dist/cost/shared/meter-marks.js +107 -9
  71. package/dist/cost/shared/model-option-row.js +178 -21
  72. package/dist/cost/shared/step-cost-row.js +248 -20
  73. package/dist/cost/shared/usage-totals.js +22 -18
  74. package/dist/memory/cite.js +182 -11
  75. package/dist/memory/memorized.js +217 -11
  76. package/dist/memory/recall.js +296 -17
  77. package/dist/memory/shared/host-label.js +19 -22
  78. package/dist/memory/shared/source-mark.js +39 -3
  79. package/dist/memory/sources.js +255 -13
  80. package/dist/shared/decision-summary.js +133 -14
  81. package/dist/shared/panel-empty.js +78 -3
  82. package/dist/shared/panel.js +243 -13
  83. package/dist/shared/status-dot.js +38 -8
  84. package/dist/shared/virtual/use-list-virtualizer.d.ts +24 -0
  85. package/dist/shared/virtual/use-list-virtualizer.js +68 -0
  86. package/dist/thread/actions/action-button.js +65 -3
  87. package/dist/thread/actions/actions.js +184 -13
  88. package/dist/thread/actions/branch-switcher.js +102 -5
  89. package/dist/thread/canvas/canvas.js +205 -5
  90. package/dist/thread/canvas/version-switcher.js +149 -8
  91. package/dist/thread/code/code.js +186 -24
  92. package/dist/thread/code/copy-code-button.js +61 -13
  93. package/dist/thread/code/highlight.js +30 -29
  94. package/dist/thread/history/history-rows.d.ts +16 -0
  95. package/dist/thread/history/history-rows.js +23 -0
  96. package/dist/thread/history/history.d.ts +3 -2
  97. package/dist/thread/history/history.js +174 -5
  98. package/dist/thread/history/{history-row.d.ts → row/history-row.d.ts} +3 -2
  99. package/dist/thread/history/row/history-row.js +137 -0
  100. package/dist/thread/history/row/thread-item-menu.js +84 -0
  101. package/dist/thread/history/row/thread-title-editor.js +81 -0
  102. package/dist/thread/history/thread-groups.d.ts +1 -1
  103. package/dist/thread/history/thread-groups.js +40 -34
  104. package/dist/thread/history/virtual-history-list.d.ts +11 -0
  105. package/dist/thread/history/virtual-history-list.js +107 -0
  106. package/dist/thread/index.d.ts +1 -1
  107. package/dist/thread/starters/starters.js +92 -7
  108. package/dist/thread/use-copied.js +45 -15
  109. package/dist/types.js +1 -1
  110. package/package.json +6 -4
  111. package/dist/thread/history/history-row.js +0 -17
  112. package/dist/thread/history/thread-item-menu.js +0 -6
  113. package/dist/thread/history/thread-title-editor.js +0 -25
  114. /package/dist/thread/history/{thread-item-menu.d.ts → row/thread-item-menu.d.ts} +0 -0
  115. /package/dist/thread/history/{thread-title-editor.d.ts → row/thread-title-editor.d.ts} +0 -0
@@ -1,31 +1,211 @@
1
1
  "use client";
2
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+
3
+ import { c as _c } from "react/compiler-runtime";
3
4
  import { Idea as BrainIcon, ChevronRight as ChevronRightIcon } from "@carbon/icons-react";
4
5
  import { Collapsible, CollapsibleContent, CollapsibleTrigger, cn } from "@locusgraph/components";
5
6
  import { useEffect, useRef, useState } from "react";
6
7
  import { firstLineOf, thoughtDurationLabel } from "./thought-duration.js";
8
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
7
9
  function useThinkingOpen(streaming, defaultOpen) {
8
- const [open, setOpen] = useState(defaultOpen ?? streaming);
9
- const openedByUser = useRef(false);
10
- const wasStreaming = useRef(streaming);
11
- useEffect(() => {
12
- if (wasStreaming.current === streaming)
13
- return;
14
- wasStreaming.current = streaming;
15
- if (streaming)
16
- setOpen(true);
17
- else if (!openedByUser.current)
18
- setOpen(false);
19
- }, [streaming]);
20
- function toggle(next) {
21
- setOpen(next);
22
- openedByUser.current = next;
23
- }
24
- return [open, toggle];
10
+ const $ = _c(6);
11
+ const [open, setOpen] = useState(defaultOpen ?? streaming);
12
+ const openedByUser = useRef(false);
13
+ const wasStreaming = useRef(streaming);
14
+ let t0;
15
+ let t1;
16
+ if ($[0] !== streaming) {
17
+ t0 = () => {
18
+ if (wasStreaming.current === streaming) {
19
+ return;
20
+ }
21
+ wasStreaming.current = streaming;
22
+ if (streaming) {
23
+ setOpen(true);
24
+ } else {
25
+ if (!openedByUser.current) {
26
+ setOpen(false);
27
+ }
28
+ }
29
+ };
30
+ t1 = [streaming];
31
+ $[0] = streaming;
32
+ $[1] = t0;
33
+ $[2] = t1;
34
+ } else {
35
+ t0 = $[1];
36
+ t1 = $[2];
37
+ }
38
+ useEffect(t0, t1);
39
+ let t2;
40
+ if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
41
+ t2 = function toggle(next) {
42
+ setOpen(next);
43
+ openedByUser.current = next;
44
+ };
45
+ $[3] = t2;
46
+ } else {
47
+ t2 = $[3];
48
+ }
49
+ const toggle = t2;
50
+ let t3;
51
+ if ($[4] !== open) {
52
+ t3 = [open, toggle];
53
+ $[4] = open;
54
+ $[5] = t3;
55
+ } else {
56
+ t3 = $[5];
57
+ }
58
+ return t3;
25
59
  }
26
- export function Thinking({ text, state, durationMs, defaultOpen, className }) {
27
- const streaming = state === "streaming";
28
- const [open, setOpen] = useThinkingOpen(streaming, defaultOpen);
29
- const summary = firstLineOf(text);
30
- return (_jsxs(Collapsible, { "data-slot": "thinking", "data-state": streaming ? "streaming" : "done", open: open, onOpenChange: setOpen, className: cn("flex min-w-0 flex-col gap-2 text-sm text-muted-foreground", className), children: [_jsxs(CollapsibleTrigger, { "aria-expanded": open, className: "group eyebrow flex w-fit items-center gap-2 py-1 transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/70", children: [_jsx(BrainIcon, { className: "size-3.5 shrink-0", "aria-hidden": true }), _jsx("span", { "aria-live": "polite", className: cn(streaming && "motion-safe:shimmer"), children: streaming ? "Thinking…" : thoughtDurationLabel(durationMs) }), _jsx(ChevronRightIcon, { "aria-hidden": true, className: cn("size-3.5 shrink-0 opacity-70 motion-safe:transition-transform", open && "rotate-90") })] }), !open && summary && (_jsx("p", { "data-slot": "thinking-summary", className: "ml-[6.5px] truncate border-l border-border pl-4 text-muted-foreground/80", children: summary })), _jsx(CollapsibleContent, { "data-slot": "thinking-content", className: "ml-[6.5px] border-l border-border pl-4 leading-relaxed whitespace-pre-wrap", children: text })] }));
60
+ export function Thinking(t0) {
61
+ const $ = _c(34);
62
+ const {
63
+ text,
64
+ state,
65
+ durationMs,
66
+ defaultOpen,
67
+ className
68
+ } = t0;
69
+ const streaming = state === "streaming";
70
+ const [open, setOpen] = useThinkingOpen(streaming, defaultOpen);
71
+ let t1;
72
+ if ($[0] !== text) {
73
+ t1 = firstLineOf(text);
74
+ $[0] = text;
75
+ $[1] = t1;
76
+ } else {
77
+ t1 = $[1];
78
+ }
79
+ const summary = t1;
80
+ const t2 = streaming ? "streaming" : "done";
81
+ let t3;
82
+ if ($[2] !== className) {
83
+ t3 = cn("flex min-w-0 flex-col gap-2 text-sm text-muted-foreground", className);
84
+ $[2] = className;
85
+ $[3] = t3;
86
+ } else {
87
+ t3 = $[3];
88
+ }
89
+ let t4;
90
+ if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
91
+ t4 = /*#__PURE__*/_jsx(BrainIcon, {
92
+ className: "size-3.5 shrink-0",
93
+ "aria-hidden": true
94
+ });
95
+ $[4] = t4;
96
+ } else {
97
+ t4 = $[4];
98
+ }
99
+ const t5 = streaming && "motion-safe:shimmer";
100
+ let t6;
101
+ if ($[5] !== t5) {
102
+ t6 = cn(t5);
103
+ $[5] = t5;
104
+ $[6] = t6;
105
+ } else {
106
+ t6 = $[6];
107
+ }
108
+ let t7;
109
+ if ($[7] !== durationMs || $[8] !== streaming) {
110
+ t7 = streaming ? "Thinking\u2026" : thoughtDurationLabel(durationMs);
111
+ $[7] = durationMs;
112
+ $[8] = streaming;
113
+ $[9] = t7;
114
+ } else {
115
+ t7 = $[9];
116
+ }
117
+ let t8;
118
+ if ($[10] !== t6 || $[11] !== t7) {
119
+ t8 = /*#__PURE__*/_jsx("span", {
120
+ "aria-live": "polite",
121
+ className: t6,
122
+ children: t7
123
+ });
124
+ $[10] = t6;
125
+ $[11] = t7;
126
+ $[12] = t8;
127
+ } else {
128
+ t8 = $[12];
129
+ }
130
+ const t9 = open && "rotate-90";
131
+ let t10;
132
+ if ($[13] !== t9) {
133
+ t10 = cn("size-3.5 shrink-0 opacity-70 motion-safe:transition-transform", t9);
134
+ $[13] = t9;
135
+ $[14] = t10;
136
+ } else {
137
+ t10 = $[14];
138
+ }
139
+ let t11;
140
+ if ($[15] !== t10) {
141
+ t11 = /*#__PURE__*/_jsx(ChevronRightIcon, {
142
+ "aria-hidden": true,
143
+ className: t10
144
+ });
145
+ $[15] = t10;
146
+ $[16] = t11;
147
+ } else {
148
+ t11 = $[16];
149
+ }
150
+ let t12;
151
+ if ($[17] !== open || $[18] !== t11 || $[19] !== t8) {
152
+ t12 = /*#__PURE__*/_jsxs(CollapsibleTrigger, {
153
+ "aria-expanded": open,
154
+ className: "group eyebrow flex w-fit items-center gap-2 py-1 transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/70",
155
+ children: [t4, t8, t11]
156
+ });
157
+ $[17] = open;
158
+ $[18] = t11;
159
+ $[19] = t8;
160
+ $[20] = t12;
161
+ } else {
162
+ t12 = $[20];
163
+ }
164
+ let t13;
165
+ if ($[21] !== open || $[22] !== summary) {
166
+ t13 = !open && summary && /*#__PURE__*/_jsx("p", {
167
+ "data-slot": "thinking-summary",
168
+ className: "ml-[6.5px] truncate border-l border-border pl-4 text-muted-foreground/80",
169
+ children: summary
170
+ });
171
+ $[21] = open;
172
+ $[22] = summary;
173
+ $[23] = t13;
174
+ } else {
175
+ t13 = $[23];
176
+ }
177
+ let t14;
178
+ if ($[24] !== text) {
179
+ t14 = /*#__PURE__*/_jsx(CollapsibleContent, {
180
+ "data-slot": "thinking-content",
181
+ className: "ml-[6.5px] border-l border-border pl-4 leading-relaxed whitespace-pre-wrap",
182
+ children: text
183
+ });
184
+ $[24] = text;
185
+ $[25] = t14;
186
+ } else {
187
+ t14 = $[25];
188
+ }
189
+ let t15;
190
+ if ($[26] !== open || $[27] !== setOpen || $[28] !== t12 || $[29] !== t13 || $[30] !== t14 || $[31] !== t2 || $[32] !== t3) {
191
+ t15 = /*#__PURE__*/_jsxs(Collapsible, {
192
+ "data-slot": "thinking",
193
+ "data-state": t2,
194
+ open: open,
195
+ onOpenChange: setOpen,
196
+ className: t3,
197
+ children: [t12, t13, t14]
198
+ });
199
+ $[26] = open;
200
+ $[27] = setOpen;
201
+ $[28] = t12;
202
+ $[29] = t13;
203
+ $[30] = t14;
204
+ $[31] = t2;
205
+ $[32] = t3;
206
+ $[33] = t15;
207
+ } else {
208
+ t15 = $[33];
209
+ }
210
+ return t15;
31
211
  }
@@ -1,13 +1,11 @@
1
1
  export function thoughtDurationLabel(durationMs) {
2
- if (durationMs === undefined)
3
- return "Thought for a few seconds";
4
- const totalSeconds = Math.max(1, Math.round(durationMs / 1000));
5
- if (totalSeconds < 60)
6
- return `Thought for ${totalSeconds}s`;
7
- const minutes = Math.floor(totalSeconds / 60);
8
- const seconds = totalSeconds % 60;
9
- return seconds === 0 ? `Thought for ${minutes}m` : `Thought for ${minutes}m ${seconds}s`;
2
+ if (durationMs === undefined) return "Thought for a few seconds";
3
+ const totalSeconds = Math.max(1, Math.round(durationMs / 1000));
4
+ if (totalSeconds < 60) return `Thought for ${totalSeconds}s`;
5
+ const minutes = Math.floor(totalSeconds / 60);
6
+ const seconds = totalSeconds % 60;
7
+ return seconds === 0 ? `Thought for ${minutes}m` : `Thought for ${minutes}m ${seconds}s`;
10
8
  }
11
9
  export function firstLineOf(text) {
12
- return text.trim().split("\n")[0]?.trim() ?? "";
10
+ return text.trim().split("\n")[0]?.trim() ?? "";
13
11
  }
@@ -1,15 +1,42 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
1
+ import { c as _c } from "react/compiler-runtime";
2
2
  import { Code } from "../../thread/code/code.js";
3
+ import { jsx as _jsx } from "react/jsx-runtime";
3
4
  export function prettyJson(value) {
4
- if (typeof value === "string")
5
- return value;
6
- try {
7
- return JSON.stringify(value, null, 2) ?? String(value);
8
- }
9
- catch {
10
- return String(value);
11
- }
5
+ if (typeof value === "string") return value;
6
+ try {
7
+ return JSON.stringify(value, null, 2) ?? String(value);
8
+ } catch {
9
+ return String(value);
10
+ }
12
11
  }
13
- export function JsonBlock({ label, value }) {
14
- return (_jsx(Code, { "data-slot": "tool-json", code: prettyJson(value), language: "json", filename: label, className: "[&_[data-slot=code-area]]:max-h-72 [&_[data-slot=code-area]]:overflow-auto" }));
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;
15
42
  }
@@ -1,26 +1,59 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { c as _c } from "react/compiler-runtime";
2
2
  import { StatusDot } from "../../shared/status-dot.js";
3
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
4
  export const toolStateLabels = {
4
- "input-streaming": "Preparing",
5
- "input-available": "Running",
6
- "approval-requested": "Waiting for approval",
7
- "approval-responded": "Approved",
8
- "output-available": "Done",
9
- "output-error": "Failed",
10
- "output-denied": "Denied",
5
+ "input-streaming": "Preparing",
6
+ "input-available": "Running",
7
+ "approval-requested": "Waiting for approval",
8
+ "approval-responded": "Approved",
9
+ "output-available": "Done",
10
+ "output-error": "Failed",
11
+ "output-denied": "Denied"
11
12
  };
12
13
  const toolStateTones = {
13
- "input-streaming": "waiting",
14
- "input-available": "waiting",
15
- "approval-requested": "waiting",
16
- "approval-responded": "done",
17
- "output-available": "done",
18
- "output-error": "danger",
19
- "output-denied": "idle",
14
+ "input-streaming": "waiting",
15
+ "input-available": "waiting",
16
+ "approval-requested": "waiting",
17
+ "approval-responded": "done",
18
+ "output-available": "done",
19
+ "output-error": "danger",
20
+ "output-denied": "idle"
20
21
  };
21
22
  export function isToolBusy(state) {
22
- return state === "input-streaming" || state === "input-available";
23
+ return state === "input-streaming" || state === "input-available";
23
24
  }
24
- export function ToolStatus({ state }) {
25
- return (_jsxs("span", { "data-slot": "tool-status", "data-state": state, "aria-live": "polite", className: "eyebrow flex shrink-0 items-center gap-1.5", children: [_jsx(StatusDot, { tone: toolStateTones[state] }), toolStateLabels[state]] }));
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;
26
59
  }
@@ -1,14 +1,192 @@
1
1
  "use client";
2
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+
3
+ import { c as _c } from "react/compiler-runtime";
3
4
  import { ChevronRight as ChevronRightIcon, Tools as WrenchIcon } from "@carbon/icons-react";
4
5
  import { Collapsible, CollapsibleContent, CollapsibleTrigger, cn } from "@locusgraph/components";
5
6
  import { useState } from "react";
6
7
  import { toolNameOf } from "../../types.js";
7
8
  import { JsonBlock } from "./json-block.js";
8
9
  import { ToolStatus } from "./tool-status.js";
9
- export function Tool({ part, defaultOpen = false, className }) {
10
- const [open, setOpen] = useState(defaultOpen);
11
- const hasInput = part.input !== undefined;
12
- const hasOutput = part.state === "output-available" && part.output !== undefined;
13
- return (_jsxs(Collapsible, { "data-slot": "tool", "data-state": part.state, "data-tool-call-id": part.toolCallId, open: open, onOpenChange: setOpen, className: cn("flex min-w-0 flex-col bg-card text-card-foreground ring-1 ring-border", className), children: [_jsxs(CollapsibleTrigger, { "aria-expanded": open, className: "flex w-full items-center gap-2.5 px-3 py-2.5 text-left transition-colors hover:bg-accent/50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/70 focus-visible:ring-inset", children: [_jsx(WrenchIcon, { "aria-hidden": true, className: "size-3.5 shrink-0 text-muted-foreground" }), _jsx("span", { className: "min-w-0 flex-1 truncate font-mono text-sm font-medium", children: toolNameOf(part) }), _jsx(ToolStatus, { state: part.state }), _jsx(ChevronRightIcon, { "aria-hidden": true, className: cn("size-3.5 shrink-0 text-muted-foreground motion-safe:transition-transform", open && "rotate-90") })] }), part.errorText && (_jsx("p", { "data-slot": "tool-error", role: "alert", className: "border-t border-border px-3 py-2.5 text-sm text-destructive", children: part.errorText })), _jsxs(CollapsibleContent, { "data-slot": "tool-content", className: "flex flex-col gap-4 border-t border-border px-3 pt-3 pb-4", children: [hasInput && _jsx(JsonBlock, { label: "Input", value: part.input }), hasOutput && _jsx(JsonBlock, { label: "Output", value: part.output }), !hasInput && !hasOutput && (_jsx("span", { className: "text-sm text-muted-foreground", children: "No input yet." }))] })] }));
10
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
11
+ export function Tool(t0) {
12
+ const $ = _c(41);
13
+ const {
14
+ part,
15
+ defaultOpen: t1,
16
+ className
17
+ } = t0;
18
+ const defaultOpen = t1 === undefined ? false : t1;
19
+ const [open, setOpen] = useState(defaultOpen);
20
+ const hasInput = part.input !== undefined;
21
+ const hasOutput = part.state === "output-available" && part.output !== undefined;
22
+ const t2 = part.state;
23
+ const t3 = part.toolCallId;
24
+ let t4;
25
+ if ($[0] !== className) {
26
+ t4 = cn("flex min-w-0 flex-col bg-card text-card-foreground ring-1 ring-border", className);
27
+ $[0] = className;
28
+ $[1] = t4;
29
+ } else {
30
+ t4 = $[1];
31
+ }
32
+ let t5;
33
+ if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
34
+ t5 = /*#__PURE__*/_jsx(WrenchIcon, {
35
+ "aria-hidden": true,
36
+ className: "size-3.5 shrink-0 text-muted-foreground"
37
+ });
38
+ $[2] = t5;
39
+ } else {
40
+ t5 = $[2];
41
+ }
42
+ let t6;
43
+ if ($[3] !== part) {
44
+ t6 = toolNameOf(part);
45
+ $[3] = part;
46
+ $[4] = t6;
47
+ } else {
48
+ t6 = $[4];
49
+ }
50
+ let t7;
51
+ if ($[5] !== t6) {
52
+ t7 = /*#__PURE__*/_jsx("span", {
53
+ className: "min-w-0 flex-1 truncate font-mono text-sm font-medium",
54
+ children: t6
55
+ });
56
+ $[5] = t6;
57
+ $[6] = t7;
58
+ } else {
59
+ t7 = $[6];
60
+ }
61
+ let t8;
62
+ if ($[7] !== part.state) {
63
+ t8 = /*#__PURE__*/_jsx(ToolStatus, {
64
+ state: part.state
65
+ });
66
+ $[7] = part.state;
67
+ $[8] = t8;
68
+ } else {
69
+ t8 = $[8];
70
+ }
71
+ const t9 = open && "rotate-90";
72
+ let t10;
73
+ if ($[9] !== t9) {
74
+ t10 = cn("size-3.5 shrink-0 text-muted-foreground motion-safe:transition-transform", t9);
75
+ $[9] = t9;
76
+ $[10] = t10;
77
+ } else {
78
+ t10 = $[10];
79
+ }
80
+ let t11;
81
+ if ($[11] !== t10) {
82
+ t11 = /*#__PURE__*/_jsx(ChevronRightIcon, {
83
+ "aria-hidden": true,
84
+ className: t10
85
+ });
86
+ $[11] = t10;
87
+ $[12] = t11;
88
+ } else {
89
+ t11 = $[12];
90
+ }
91
+ let t12;
92
+ if ($[13] !== open || $[14] !== t11 || $[15] !== t7 || $[16] !== t8) {
93
+ t12 = /*#__PURE__*/_jsxs(CollapsibleTrigger, {
94
+ "aria-expanded": open,
95
+ className: "flex w-full items-center gap-2.5 px-3 py-2.5 text-left transition-colors hover:bg-accent/50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/70 focus-visible:ring-inset",
96
+ children: [t5, t7, t8, t11]
97
+ });
98
+ $[13] = open;
99
+ $[14] = t11;
100
+ $[15] = t7;
101
+ $[16] = t8;
102
+ $[17] = t12;
103
+ } else {
104
+ t12 = $[17];
105
+ }
106
+ let t13;
107
+ if ($[18] !== part.errorText) {
108
+ t13 = part.errorText && /*#__PURE__*/_jsx("p", {
109
+ "data-slot": "tool-error",
110
+ role: "alert",
111
+ className: "border-t border-border px-3 py-2.5 text-sm text-destructive",
112
+ children: part.errorText
113
+ });
114
+ $[18] = part.errorText;
115
+ $[19] = t13;
116
+ } else {
117
+ t13 = $[19];
118
+ }
119
+ let t14;
120
+ if ($[20] !== hasInput || $[21] !== part.input) {
121
+ t14 = hasInput && /*#__PURE__*/_jsx(JsonBlock, {
122
+ label: "Input",
123
+ value: part.input
124
+ });
125
+ $[20] = hasInput;
126
+ $[21] = part.input;
127
+ $[22] = t14;
128
+ } else {
129
+ t14 = $[22];
130
+ }
131
+ let t15;
132
+ if ($[23] !== hasOutput || $[24] !== part.output) {
133
+ t15 = hasOutput && /*#__PURE__*/_jsx(JsonBlock, {
134
+ label: "Output",
135
+ value: part.output
136
+ });
137
+ $[23] = hasOutput;
138
+ $[24] = part.output;
139
+ $[25] = t15;
140
+ } else {
141
+ t15 = $[25];
142
+ }
143
+ let t16;
144
+ if ($[26] !== hasInput || $[27] !== hasOutput) {
145
+ t16 = !hasInput && !hasOutput && /*#__PURE__*/_jsx("span", {
146
+ className: "text-sm text-muted-foreground",
147
+ children: "No input yet."
148
+ });
149
+ $[26] = hasInput;
150
+ $[27] = hasOutput;
151
+ $[28] = t16;
152
+ } else {
153
+ t16 = $[28];
154
+ }
155
+ let t17;
156
+ if ($[29] !== t14 || $[30] !== t15 || $[31] !== t16) {
157
+ t17 = /*#__PURE__*/_jsxs(CollapsibleContent, {
158
+ "data-slot": "tool-content",
159
+ className: "flex flex-col gap-4 border-t border-border px-3 pt-3 pb-4",
160
+ children: [t14, t15, t16]
161
+ });
162
+ $[29] = t14;
163
+ $[30] = t15;
164
+ $[31] = t16;
165
+ $[32] = t17;
166
+ } else {
167
+ t17 = $[32];
168
+ }
169
+ let t18;
170
+ if ($[33] !== open || $[34] !== part.state || $[35] !== part.toolCallId || $[36] !== t12 || $[37] !== t13 || $[38] !== t17 || $[39] !== t4) {
171
+ t18 = /*#__PURE__*/_jsxs(Collapsible, {
172
+ "data-slot": "tool",
173
+ "data-state": t2,
174
+ "data-tool-call-id": t3,
175
+ open: open,
176
+ onOpenChange: setOpen,
177
+ className: t4,
178
+ children: [t12, t13, t17]
179
+ });
180
+ $[33] = open;
181
+ $[34] = part.state;
182
+ $[35] = part.toolCallId;
183
+ $[36] = t12;
184
+ $[37] = t13;
185
+ $[38] = t17;
186
+ $[39] = t4;
187
+ $[40] = t18;
188
+ } else {
189
+ t18 = $[40];
190
+ }
191
+ return t18;
14
192
  }
@@ -1,5 +1,6 @@
1
+ import type { ComponentProps } from "react";
1
2
  import type { PendingApproval } from "../types.js";
2
- type InboxRowProps = {
3
+ type InboxRowProps = Omit<ComponentProps<"li">, "onSelect"> & {
3
4
  item: PendingApproval;
4
5
  now: number;
5
6
  selected: boolean;
@@ -7,5 +8,5 @@ type InboxRowProps = {
7
8
  onApprove: () => void;
8
9
  onDeny: () => void;
9
10
  };
10
- export declare function InboxRow({ item, now, selected, onSelect, onApprove, onDeny }: InboxRowProps): import("react").JSX.Element;
11
+ export declare function InboxRow({ item, now, selected, onSelect, onApprove, onDeny, className, ...props }: InboxRowProps): import("react").JSX.Element;
11
12
  export {};