@locusgraph/loop 0.1.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 (115) hide show
  1. package/README.md +2 -0
  2. package/dist/agent/pulse/gradient-label.js +36 -15
  3. package/dist/agent/pulse/marks/bars-mark.js +24 -10
  4. package/dist/agent/pulse/marks/glyph-mark.js +17 -11
  5. package/dist/agent/pulse/marks/locus-mark.js +39 -28
  6. package/dist/agent/pulse/marks/orb-mark.js +21 -8
  7. package/dist/agent/pulse/marks/spinner-mark.js +20 -1
  8. package/dist/agent/pulse/pulse.js +63 -35
  9. package/dist/agent/pulse/use-loop-animation.js +14 -16
  10. package/dist/agent/steps/step-icon.js +40 -24
  11. package/dist/agent/steps/steps.js +72 -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 +18 -11
  15. package/dist/agent/tool/tool-status.js +28 -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 +96 -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 +99 -18
  22. package/dist/approval/inbox/virtual-inbox-list.d.ts +13 -0
  23. package/dist/approval/inbox/virtual-inbox-list.js +53 -0
  24. package/dist/approval/memory/memory-choices.js +27 -22
  25. package/dist/approval/memory/memory-review.js +108 -17
  26. package/dist/approval/memory/memory-row.js +80 -19
  27. package/dist/approval/plan/plan-review.js +129 -28
  28. package/dist/approval/plan/plan-step-row.js +91 -44
  29. package/dist/approval/plan/plan-steps.js +24 -23
  30. package/dist/approval/plan/question-choices.js +73 -40
  31. package/dist/approval/plan/question.d.ts +1 -1
  32. package/dist/approval/plan/question.js +108 -27
  33. package/dist/approval/run/run-bar.js +94 -22
  34. package/dist/approval/shared/decision-line.js +1 -1
  35. package/dist/approval/shared/risk-badge.js +32 -16
  36. package/dist/approval/shared/time.js +5 -8
  37. package/dist/approval/shared/use-focus-on-mount.js +7 -6
  38. package/dist/approval/spend/raise-cap-form.js +64 -19
  39. package/dist/approval/spend/spend-gate.js +124 -21
  40. package/dist/approval/spend/spend-math.js +7 -8
  41. package/dist/approval/spend/spend-meter.js +136 -35
  42. package/dist/approval/tool/approval.js +113 -27
  43. package/dist/approval/tool/args/args-editor.js +104 -26
  44. package/dist/approval/tool/args/args-field.js +79 -22
  45. package/dist/approval/tool/args/args-validation.js +38 -47
  46. package/dist/approval/tool/deny-form.js +43 -10
  47. package/dist/approval/tool/tool-inputs.js +62 -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 +71 -48
  53. package/dist/chat/chat/virtual-chat-items.d.ts +8 -0
  54. package/dist/chat/chat/virtual-chat-items.js +60 -0
  55. package/dist/chat/composer/composer-actions.js +69 -17
  56. package/dist/chat/composer/composer.js +330 -32
  57. package/dist/chat/composer/use-auto-grow.js +9 -9
  58. package/dist/chat/files/file-meta.js +19 -19
  59. package/dist/chat/files/files.js +92 -29
  60. package/dist/chat/reply/fenced-code.js +23 -21
  61. package/dist/chat/reply/markdown-components.js +137 -17
  62. package/dist/chat/reply/reply.js +30 -10
  63. package/dist/chat/turn/group-parts.js +43 -29
  64. package/dist/chat/turn/turn.js +87 -30
  65. package/dist/cost/context.js +104 -23
  66. package/dist/cost/cost-steps.js +67 -14
  67. package/dist/cost/cost.js +128 -23
  68. package/dist/cost/model-picker.js +51 -6
  69. package/dist/cost/shared/context-breakdown.js +83 -10
  70. package/dist/cost/shared/meter-marks.js +49 -9
  71. package/dist/cost/shared/model-option-row.js +56 -22
  72. package/dist/cost/shared/step-cost-row.js +65 -22
  73. package/dist/cost/shared/usage-totals.js +22 -18
  74. package/dist/memory/cite.js +62 -12
  75. package/dist/memory/memorized.js +65 -11
  76. package/dist/memory/recall.js +101 -17
  77. package/dist/memory/shared/host-label.js +19 -22
  78. package/dist/memory/shared/source-mark.js +11 -3
  79. package/dist/memory/sources.js +78 -14
  80. package/dist/shared/decision-summary.js +51 -14
  81. package/dist/shared/panel-empty.js +20 -3
  82. package/dist/shared/panel.js +69 -13
  83. package/dist/shared/status-dot.js +16 -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 +22 -3
  87. package/dist/thread/actions/actions.js +184 -13
  88. package/dist/thread/actions/branch-switcher.js +28 -5
  89. package/dist/thread/canvas/canvas.js +205 -5
  90. package/dist/thread/canvas/version-switcher.js +54 -8
  91. package/dist/thread/code/code.js +186 -24
  92. package/dist/thread/code/copy-code-button.js +30 -14
  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 +58 -0
  100. package/dist/thread/history/row/thread-item-menu.js +31 -0
  101. package/dist/thread/history/row/thread-title-editor.js +38 -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 +71 -0
  106. package/dist/thread/index.d.ts +1 -1
  107. package/dist/thread/starters/starters.js +33 -8
  108. package/dist/thread/use-copied.js +18 -16
  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,22 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
1
  import { Code } from "../../thread/code/code.js";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
3
  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
- }
4
+ if (typeof value === "string") return value;
5
+ try {
6
+ return JSON.stringify(value, null, 2) ?? String(value);
7
+ } catch {
8
+ return String(value);
9
+ }
12
10
  }
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" }));
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
+ });
15
22
  }
@@ -1,26 +1,36 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
1
  import { StatusDot } from "../../shared/status-dot.js";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  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",
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"
11
11
  };
12
12
  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",
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"
20
20
  };
21
21
  export function isToolBusy(state) {
22
- return state === "input-streaming" || state === "input-available";
22
+ return state === "input-streaming" || state === "input-available";
23
23
  }
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]] }));
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
+ });
26
36
  }
@@ -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 {};
@@ -1,14 +1,103 @@
1
- import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
1
  import { Checkmark as CheckIcon, Locked as LockIcon, Close as XIcon } from "@carbon/icons-react";
3
2
  import { Button, Checkbox, cn } from "@locusgraph/components";
4
3
  import { riskLabels } from "../shared/risk-badge.js";
5
4
  import { formatWaiting, isoOf } from "../shared/time.js";
5
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
6
6
  const riskDot = {
7
- read: "bg-muted-foreground/50",
8
- write: "bg-warn",
9
- destructive: "bg-destructive",
7
+ read: "bg-muted-foreground/50",
8
+ write: "bg-warn",
9
+ destructive: "bg-destructive"
10
10
  };
11
- export function InboxRow({ item, now, selected, onSelect, onApprove, onDeny }) {
12
- const destructive = item.risk === "destructive";
13
- return (_jsxs("li", { "data-slot": "inbox-item", "data-risk": item.risk, "data-selected": selected || undefined, className: cn("group flex items-center gap-3 px-5 py-2.5 motion-safe:transition-colors", selected ? "bg-accent" : "hover:bg-accent/50"), children: [destructive ? (_jsxs("span", { className: "flex size-4 shrink-0 items-center justify-center text-muted-foreground", children: [_jsx(LockIcon, { "aria-hidden": true, className: "size-3.5" }), _jsxs("span", { className: "sr-only", children: [item.title, " must be approved on its own"] })] })) : (_jsx(Checkbox, { "aria-label": `Select ${item.title}`, checked: selected, onCheckedChange: (checked) => onSelect(checked === true) })), _jsxs("div", { className: "flex min-w-0 flex-1 flex-col gap-0.5", children: [_jsxs("p", { className: "flex min-w-0 items-baseline gap-2 text-sm", children: [_jsx("span", { className: "truncate font-medium", children: item.title }), _jsx("span", { className: "hidden shrink-0 truncate text-xs text-muted-foreground sm:inline", children: item.runName })] }), _jsxs("p", { className: "flex min-w-0 items-center gap-1.5 text-xs text-muted-foreground", children: [_jsx("span", { "aria-hidden": true, className: cn("size-1.5 shrink-0 rounded-full", riskDot[item.risk]) }), _jsx("span", { className: "shrink-0", children: riskLabels[item.risk] }), item.summary && (_jsxs(_Fragment, { children: [_jsx("span", { "aria-hidden": true, children: "\u00B7" }), _jsx("span", { className: "truncate", children: item.summary })] }))] }), _jsx("p", { className: "truncate text-xs text-muted-foreground sm:hidden", children: item.runName })] }), _jsx("time", { dateTime: isoOf(item.requestedAt), className: "w-12 shrink-0 text-right font-mono text-[11px] text-muted-foreground tabular-nums", children: formatWaiting(item.requestedAt, now) }), _jsxs("span", { className: "flex shrink-0 gap-1", children: [_jsx(Button, { type: "button", size: "icon-xs", variant: "outline", "aria-label": `Approve ${item.title}`, title: "Approve", onClick: onApprove, children: _jsx(CheckIcon, { "aria-hidden": true }) }), _jsx(Button, { type: "button", size: "icon-xs", variant: "ghost", "aria-label": `Deny ${item.title}`, title: "Deny", className: "text-muted-foreground hover:text-foreground", onClick: onDeny, children: _jsx(XIcon, { "aria-hidden": true }) })] })] }));
11
+ export function InboxRow({
12
+ item,
13
+ now,
14
+ selected,
15
+ onSelect,
16
+ onApprove,
17
+ onDeny,
18
+ className,
19
+ ...props
20
+ }) {
21
+ const destructive = item.risk === "destructive";
22
+ return /*#__PURE__*/_jsxs("li", {
23
+ "data-slot": "inbox-item",
24
+ "data-risk": item.risk,
25
+ "data-selected": selected || undefined,
26
+ className: cn("group flex items-center gap-3 px-5 py-2.5 motion-safe:transition-colors", selected ? "bg-accent" : "hover:bg-accent/50", className),
27
+ ...props,
28
+ children: [destructive ? /*#__PURE__*/_jsxs("span", {
29
+ className: "flex size-4 shrink-0 items-center justify-center text-muted-foreground",
30
+ children: [/*#__PURE__*/_jsx(LockIcon, {
31
+ "aria-hidden": true,
32
+ className: "size-3.5"
33
+ }), /*#__PURE__*/_jsxs("span", {
34
+ className: "sr-only",
35
+ children: [item.title, " must be approved on its own"]
36
+ })]
37
+ }) : /*#__PURE__*/_jsx(Checkbox, {
38
+ "aria-label": `Select ${item.title}`,
39
+ checked: selected,
40
+ onCheckedChange: checked => onSelect(checked === true)
41
+ }), /*#__PURE__*/_jsxs("div", {
42
+ className: "flex min-w-0 flex-1 flex-col gap-0.5",
43
+ children: [/*#__PURE__*/_jsxs("p", {
44
+ className: "flex min-w-0 items-baseline gap-2 text-sm",
45
+ children: [/*#__PURE__*/_jsx("span", {
46
+ className: "truncate font-medium",
47
+ children: item.title
48
+ }), /*#__PURE__*/_jsx("span", {
49
+ className: "hidden shrink-0 truncate text-xs text-muted-foreground sm:inline",
50
+ children: item.runName
51
+ })]
52
+ }), /*#__PURE__*/_jsxs("p", {
53
+ className: "flex min-w-0 items-center gap-1.5 text-xs text-muted-foreground",
54
+ children: [/*#__PURE__*/_jsx("span", {
55
+ "aria-hidden": true,
56
+ className: cn("size-1.5 shrink-0 rounded-full", riskDot[item.risk])
57
+ }), /*#__PURE__*/_jsx("span", {
58
+ className: "shrink-0",
59
+ children: riskLabels[item.risk]
60
+ }), item.summary && /*#__PURE__*/_jsxs(_Fragment, {
61
+ children: [/*#__PURE__*/_jsx("span", {
62
+ "aria-hidden": true,
63
+ children: "\xB7"
64
+ }), /*#__PURE__*/_jsx("span", {
65
+ className: "truncate",
66
+ children: item.summary
67
+ })]
68
+ })]
69
+ }), /*#__PURE__*/_jsx("p", {
70
+ className: "truncate text-xs text-muted-foreground sm:hidden",
71
+ children: item.runName
72
+ })]
73
+ }), /*#__PURE__*/_jsx("time", {
74
+ dateTime: isoOf(item.requestedAt),
75
+ className: "w-12 shrink-0 text-right font-mono text-[11px] text-muted-foreground tabular-nums",
76
+ children: formatWaiting(item.requestedAt, now)
77
+ }), /*#__PURE__*/_jsxs("span", {
78
+ className: "flex shrink-0 gap-1",
79
+ children: [/*#__PURE__*/_jsx(Button, {
80
+ type: "button",
81
+ size: "icon-xs",
82
+ variant: "outline",
83
+ "aria-label": `Approve ${item.title}`,
84
+ title: "Approve",
85
+ onClick: onApprove,
86
+ children: /*#__PURE__*/_jsx(CheckIcon, {
87
+ "aria-hidden": true
88
+ })
89
+ }), /*#__PURE__*/_jsx(Button, {
90
+ type: "button",
91
+ size: "icon-xs",
92
+ variant: "ghost",
93
+ "aria-label": `Deny ${item.title}`,
94
+ title: "Deny",
95
+ className: "text-muted-foreground hover:text-foreground",
96
+ onClick: onDeny,
97
+ children: /*#__PURE__*/_jsx(XIcon, {
98
+ "aria-hidden": true
99
+ })
100
+ })]
101
+ })]
102
+ });
14
103
  }