@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,35 +1,232 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { ArrowRight as ArrowRightIcon, Help as MessageCircleQuestionIcon, } from "@carbon/icons-react";
1
+ import { c as _c } from "react/compiler-runtime";
2
+ import { ArrowRight as ArrowRightIcon, Help as MessageCircleQuestionIcon } from "@carbon/icons-react";
3
3
  import { Button, Input, Textarea } from "@locusgraph/components";
4
4
  import { useId, useState } from "react";
5
- import { ApprovalPanel, LiveStatus, PanelBody, PanelFooter, PanelHeader, PanelTitle, } from "../../shared/panel.js";
5
+ import { ApprovalPanel, LiveStatus, PanelBody, PanelFooter, PanelHeader, PanelTitle } from "../../shared/panel.js";
6
6
  import { DecisionSummary } from "../shared/decision-line.js";
7
7
  import { useFocusOnMount } from "../shared/use-focus-on-mount.js";
8
8
  import { QuestionChoices } from "./question-choices.js";
9
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
9
10
  function answerText(answer, options) {
10
- const option = options.find((item) => item.id === answer.optionId);
11
- return [option?.label, answer.text].filter(Boolean).join(" · ");
11
+ const option = options.find(item => item.id === answer.optionId);
12
+ return [option?.label, answer.text].filter(Boolean).join(" · ");
12
13
  }
13
- export function Question({ question, options = [], allowText = options.length === 0, textLabel = options.length > 0 ? "Something else" : "Your answer", textPlaceholder = options.length > 0 ? "Something else…" : "Type an answer for the agent", submitLabel = "Send answer", answer, onAnswer, autoFocus = true, className, }) {
14
- const textId = useId();
15
- const [optionId, setOptionId] = useState();
16
- const [text, setText] = useState("");
17
- const trimmed = text.trim();
18
- const canSubmit = optionId !== undefined || trimmed !== "";
19
- const textOnly = options.length === 0;
20
- const textRef = useFocusOnMount(autoFocus && !answer && textOnly);
21
- const changeText = (value) => {
22
- setText(value);
23
- if (value.trim() !== "")
24
- setOptionId(undefined);
14
+ export function Question(t0) {
15
+ const $ = _c(42);
16
+ const {
17
+ question,
18
+ options: t1,
19
+ allowText: allowTextProp,
20
+ textLabel: textLabelProp,
21
+ textPlaceholder: textPlaceholderProp,
22
+ submitLabel: t2,
23
+ answer,
24
+ onAnswer,
25
+ autoFocus: t3,
26
+ className
27
+ } = t0;
28
+ let t4;
29
+ if ($[0] !== t1) {
30
+ t4 = t1 === undefined ? [] : t1;
31
+ $[0] = t1;
32
+ $[1] = t4;
33
+ } else {
34
+ t4 = $[1];
35
+ }
36
+ const options = t4;
37
+ const submitLabel = t2 === undefined ? "Send answer" : t2;
38
+ const autoFocus = t3 === undefined ? true : t3;
39
+ const hasOptions = options.length > 0;
40
+ const allowText = allowTextProp ?? !hasOptions;
41
+ const textLabel = textLabelProp ?? (hasOptions ? "Something else" : "Your answer");
42
+ const textPlaceholder = textPlaceholderProp ?? (hasOptions ? "Something else\u2026" : "Type an answer for the agent");
43
+ const textId = useId();
44
+ const [optionId, setOptionId] = useState();
45
+ const [text, setText] = useState("");
46
+ let t5;
47
+ if ($[2] !== text) {
48
+ t5 = text.trim();
49
+ $[2] = text;
50
+ $[3] = t5;
51
+ } else {
52
+ t5 = $[3];
53
+ }
54
+ const trimmed = t5;
55
+ const canSubmit = optionId !== undefined || trimmed !== "";
56
+ const textOnly = options.length === 0;
57
+ const textRef = useFocusOnMount(autoFocus && !answer && textOnly);
58
+ let t6;
59
+ if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
60
+ t6 = value => {
61
+ setText(value);
62
+ if (value.trim() !== "") {
63
+ setOptionId(undefined);
64
+ }
25
65
  };
26
- return (_jsxs(ApprovalPanel, { "data-slot": "question", "data-answered": answer ? true : undefined, className: className, children: [_jsx(PanelHeader, { icon: _jsx(MessageCircleQuestionIcon, { "aria-hidden": true }), eyebrow: "Agent question", status: answer ? "Answered" : "Waiting for you", tone: answer ? "done" : "waiting" }), _jsx(PanelTitle, { className: answer ? "text-muted-foreground" : undefined, children: question }), answer ? (_jsx(PanelBody, { children: _jsx(DecisionSummary, { decision: { approved: true, by: answer.by, at: answer.at }, approvedVerb: "Answered", result: answerText(answer, options) || "No answer" }) })) : (_jsxs("form", { onSubmit: (event) => {
27
- event.preventDefault();
28
- if (!canSubmit)
29
- return;
30
- onAnswer({ optionId, text: trimmed === "" ? undefined : trimmed });
31
- }, children: [_jsxs(PanelBody, { className: "gap-3", children: [!textOnly && (_jsx(QuestionChoices, { label: question, options: options, selectedId: optionId, onSelect: (id) => {
32
- setOptionId(id);
33
- setText("");
34
- }, autoFocus: autoFocus })), allowText && !textOnly && (_jsx(Input, { id: textId, "aria-label": textLabel, value: text, placeholder: textPlaceholder, onChange: (event) => changeText(event.target.value) })), textOnly && (_jsx(Textarea, { id: textId, ref: textRef, "aria-label": textLabel, value: text, placeholder: textPlaceholder, onChange: (event) => changeText(event.target.value) }))] }), _jsxs(PanelFooter, { className: "justify-between", children: [_jsx("span", { className: "hidden font-mono text-[11px] text-muted-foreground sm:inline", children: textOnly ? "The run is paused" : `Press 1–${options.length} to pick` }), _jsxs(Button, { type: "submit", size: "sm", disabled: !canSubmit, children: [submitLabel, _jsx(ArrowRightIcon, { "aria-hidden": true })] })] })] })), _jsx(LiveStatus, { message: answer ? `Answered: ${answerText(answer, options)}` : `The agent asks: ${question}` })] }));
66
+ $[4] = t6;
67
+ } else {
68
+ t6 = $[4];
69
+ }
70
+ const changeText = t6;
71
+ const t7 = answer ? true : undefined;
72
+ let t8;
73
+ if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
74
+ t8 = /*#__PURE__*/_jsx(MessageCircleQuestionIcon, {
75
+ "aria-hidden": true
76
+ });
77
+ $[5] = t8;
78
+ } else {
79
+ t8 = $[5];
80
+ }
81
+ const t9 = answer ? "Answered" : "Waiting for you";
82
+ const t10 = answer ? "done" : "waiting";
83
+ let t11;
84
+ if ($[6] !== t10 || $[7] !== t9) {
85
+ t11 = /*#__PURE__*/_jsx(PanelHeader, {
86
+ icon: t8,
87
+ eyebrow: "Agent question",
88
+ status: t9,
89
+ tone: t10
90
+ });
91
+ $[6] = t10;
92
+ $[7] = t9;
93
+ $[8] = t11;
94
+ } else {
95
+ t11 = $[8];
96
+ }
97
+ const t12 = answer ? "text-muted-foreground" : undefined;
98
+ let t13;
99
+ if ($[9] !== question || $[10] !== t12) {
100
+ t13 = /*#__PURE__*/_jsx(PanelTitle, {
101
+ className: t12,
102
+ children: question
103
+ });
104
+ $[9] = question;
105
+ $[10] = t12;
106
+ $[11] = t13;
107
+ } else {
108
+ t13 = $[11];
109
+ }
110
+ let t14;
111
+ if ($[12] !== allowText || $[13] !== answer || $[14] !== autoFocus || $[15] !== canSubmit || $[16] !== onAnswer || $[17] !== optionId || $[18] !== options || $[19] !== question || $[20] !== submitLabel || $[21] !== text || $[22] !== textId || $[23] !== textLabel || $[24] !== textOnly || $[25] !== textPlaceholder || $[26] !== textRef || $[27] !== trimmed) {
112
+ t14 = answer ? /*#__PURE__*/_jsx(PanelBody, {
113
+ children: /*#__PURE__*/_jsx(DecisionSummary, {
114
+ decision: {
115
+ approved: true,
116
+ by: answer.by,
117
+ at: answer.at
118
+ },
119
+ approvedVerb: "Answered",
120
+ result: answerText(answer, options) || "No answer"
121
+ })
122
+ }) : /*#__PURE__*/_jsxs("form", {
123
+ onSubmit: event => {
124
+ event.preventDefault();
125
+ if (!canSubmit) {
126
+ return;
127
+ }
128
+ onAnswer({
129
+ optionId,
130
+ text: trimmed === "" ? undefined : trimmed
131
+ });
132
+ },
133
+ children: [/*#__PURE__*/_jsxs(PanelBody, {
134
+ className: "gap-3",
135
+ children: [!textOnly && /*#__PURE__*/_jsx(QuestionChoices, {
136
+ label: question,
137
+ options: options,
138
+ selectedId: optionId,
139
+ onSelect: id => {
140
+ setOptionId(id);
141
+ setText("");
142
+ },
143
+ autoFocus: autoFocus
144
+ }), allowText && !textOnly && /*#__PURE__*/_jsx(Input, {
145
+ id: textId,
146
+ "aria-label": textLabel,
147
+ value: text,
148
+ placeholder: textPlaceholder,
149
+ onChange: event_0 => changeText(event_0.target.value)
150
+ }), textOnly && /*#__PURE__*/_jsx(Textarea, {
151
+ id: textId,
152
+ ref: textRef,
153
+ "aria-label": textLabel,
154
+ value: text,
155
+ placeholder: textPlaceholder,
156
+ onChange: event_1 => changeText(event_1.target.value)
157
+ })]
158
+ }), /*#__PURE__*/_jsxs(PanelFooter, {
159
+ className: "justify-between",
160
+ children: [/*#__PURE__*/_jsx("span", {
161
+ className: "hidden font-mono text-[11px] text-muted-foreground sm:inline",
162
+ children: textOnly ? "The run is paused" : `Press 1–${options.length} to pick`
163
+ }), /*#__PURE__*/_jsxs(Button, {
164
+ type: "submit",
165
+ size: "sm",
166
+ disabled: !canSubmit,
167
+ children: [submitLabel, /*#__PURE__*/_jsx(ArrowRightIcon, {
168
+ "aria-hidden": true
169
+ })]
170
+ })]
171
+ })]
172
+ });
173
+ $[12] = allowText;
174
+ $[13] = answer;
175
+ $[14] = autoFocus;
176
+ $[15] = canSubmit;
177
+ $[16] = onAnswer;
178
+ $[17] = optionId;
179
+ $[18] = options;
180
+ $[19] = question;
181
+ $[20] = submitLabel;
182
+ $[21] = text;
183
+ $[22] = textId;
184
+ $[23] = textLabel;
185
+ $[24] = textOnly;
186
+ $[25] = textPlaceholder;
187
+ $[26] = textRef;
188
+ $[27] = trimmed;
189
+ $[28] = t14;
190
+ } else {
191
+ t14 = $[28];
192
+ }
193
+ let t15;
194
+ if ($[29] !== answer || $[30] !== options || $[31] !== question) {
195
+ t15 = answer ? `Answered: ${answerText(answer, options)}` : `The agent asks: ${question}`;
196
+ $[29] = answer;
197
+ $[30] = options;
198
+ $[31] = question;
199
+ $[32] = t15;
200
+ } else {
201
+ t15 = $[32];
202
+ }
203
+ let t16;
204
+ if ($[33] !== t15) {
205
+ t16 = /*#__PURE__*/_jsx(LiveStatus, {
206
+ message: t15
207
+ });
208
+ $[33] = t15;
209
+ $[34] = t16;
210
+ } else {
211
+ t16 = $[34];
212
+ }
213
+ let t17;
214
+ if ($[35] !== className || $[36] !== t11 || $[37] !== t13 || $[38] !== t14 || $[39] !== t16 || $[40] !== t7) {
215
+ t17 = /*#__PURE__*/_jsxs(ApprovalPanel, {
216
+ "data-slot": "question",
217
+ "data-answered": t7,
218
+ className: className,
219
+ children: [t11, t13, t14, t16]
220
+ });
221
+ $[35] = className;
222
+ $[36] = t11;
223
+ $[37] = t13;
224
+ $[38] = t14;
225
+ $[39] = t16;
226
+ $[40] = t7;
227
+ $[41] = t17;
228
+ } else {
229
+ t17 = $[41];
230
+ }
231
+ return t17;
35
232
  }
@@ -1,33 +1,189 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Pause as PauseIcon, Play as PlayIcon, SkipForward as SkipForwardIcon, StopFilledAlt as SquareIcon, } from "@carbon/icons-react";
1
+ import { c as _c } from "react/compiler-runtime";
2
+ import { Pause as PauseIcon, Play as PlayIcon, SkipForward as SkipForwardIcon, StopFilledAlt as SquareIcon } from "@carbon/icons-react";
3
3
  import { Button, cn } from "@locusgraph/components";
4
4
  import { StatusDot } from "../../shared/status-dot.js";
5
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
5
6
  const statusLabels = {
6
- running: "Running",
7
- paused: "Paused",
8
- stopped: "Stopped",
9
- done: "Done",
7
+ running: "Running",
8
+ paused: "Paused",
9
+ stopped: "Stopped",
10
+ done: "Done"
10
11
  };
11
12
  const statusTone = {
12
- running: "running",
13
- paused: "waiting",
14
- stopped: "danger",
15
- done: "done",
13
+ running: "running",
14
+ paused: "waiting",
15
+ stopped: "danger",
16
+ done: "done"
16
17
  };
17
18
  function twoDigits(value) {
18
- return String(value).padStart(2, "0");
19
+ return String(value).padStart(2, "0");
19
20
  }
20
21
  function formatElapsed(elapsedMs) {
21
- const totalSeconds = Math.max(0, Math.floor(elapsedMs / 1000));
22
- const hours = Math.floor(totalSeconds / 3600);
23
- const minutes = Math.floor((totalSeconds % 3600) / 60);
24
- const seconds = totalSeconds % 60;
25
- if (hours > 0)
26
- return `${hours}:${twoDigits(minutes)}:${twoDigits(seconds)}`;
27
- return `${minutes}:${twoDigits(seconds)}`;
22
+ const totalSeconds = Math.max(0, Math.floor(elapsedMs / 1000));
23
+ const hours = Math.floor(totalSeconds / 3600);
24
+ const minutes = Math.floor(totalSeconds % 3600 / 60);
25
+ const seconds = totalSeconds % 60;
26
+ if (hours > 0) return `${hours}:${twoDigits(minutes)}:${twoDigits(seconds)}`;
27
+ return `${minutes}:${twoDigits(seconds)}`;
28
28
  }
29
- export function RunBar({ status, runName, elapsedMs, onPause, onResume, onStop, onStep, pending = false, className, }) {
30
- const live = status === "running" || status === "paused";
31
- const paused = status === "paused";
32
- return (_jsxs("div", { role: "toolbar", "aria-label": runName ? `Controls for ${runName}` : "Run controls", "data-slot": "run-bar", "data-status": status, className: cn("flex min-h-10 min-w-0 flex-wrap items-center gap-x-3 gap-y-2 bg-card py-2 pr-2 pl-3 text-card-foreground ring-1 ring-border", className), children: [_jsxs("span", { className: "flex min-w-0 flex-1 items-center gap-2.5 text-sm", children: [_jsx(StatusDot, { tone: statusTone[status], className: "size-2" }), runName && _jsx("span", { className: "truncate font-medium", children: runName }), _jsx("span", { role: "status", "aria-live": "polite", className: "eyebrow shrink-0", children: statusLabels[status] }), elapsedMs !== undefined && (_jsxs("span", { className: "shrink-0 font-mono text-xs text-muted-foreground tabular-nums", children: [_jsx("span", { className: "sr-only", children: "Elapsed " }), formatElapsed(elapsedMs)] }))] }), live && (_jsxs("span", { className: "ml-auto flex shrink-0 items-center gap-1", children: [_jsxs(Button, { type: "button", size: "xs", variant: paused ? "default" : "outline", disabled: pending, onClick: paused ? onResume : onPause, children: [paused ? _jsx(PlayIcon, { "aria-hidden": true }) : _jsx(PauseIcon, { "aria-hidden": true }), paused ? "Resume" : "Pause"] }), onStep && (_jsxs(Button, { type: "button", size: "xs", variant: "ghost", "aria-label": "Run one step", title: "Run one step", disabled: !paused || pending, onClick: onStep, children: [_jsx(SkipForwardIcon, { "aria-hidden": true }), "Step"] })), _jsxs(Button, { type: "button", size: "xs", variant: "ghost", className: "text-muted-foreground hover:bg-destructive/10 hover:text-destructive dark:hover:bg-destructive/15", disabled: pending, onClick: onStop, children: [_jsx(SquareIcon, { "aria-hidden": true, className: "size-2.5 fill-current" }), "Stop"] })] }))] }));
29
+ export function RunBar(t0) {
30
+ const $ = _c(29);
31
+ const {
32
+ status,
33
+ runName,
34
+ elapsedMs,
35
+ onPause,
36
+ onResume,
37
+ onStop,
38
+ onStep,
39
+ pending: t1,
40
+ className
41
+ } = t0;
42
+ const pending = t1 === undefined ? false : t1;
43
+ const live = status === "running" || status === "paused";
44
+ const paused = status === "paused";
45
+ const t2 = runName ? `Controls for ${runName}` : "Run controls";
46
+ let t3;
47
+ if ($[0] !== className) {
48
+ t3 = cn("flex min-h-10 min-w-0 flex-wrap items-center gap-x-3 gap-y-2 bg-card py-2 pr-2 pl-3 text-card-foreground ring-1 ring-border", className);
49
+ $[0] = className;
50
+ $[1] = t3;
51
+ } else {
52
+ t3 = $[1];
53
+ }
54
+ const t4 = statusTone[status];
55
+ let t5;
56
+ if ($[2] !== t4) {
57
+ t5 = /*#__PURE__*/_jsx(StatusDot, {
58
+ tone: t4,
59
+ className: "size-2"
60
+ });
61
+ $[2] = t4;
62
+ $[3] = t5;
63
+ } else {
64
+ t5 = $[3];
65
+ }
66
+ let t6;
67
+ if ($[4] !== runName) {
68
+ t6 = runName && /*#__PURE__*/_jsx("span", {
69
+ className: "truncate font-medium",
70
+ children: runName
71
+ });
72
+ $[4] = runName;
73
+ $[5] = t6;
74
+ } else {
75
+ t6 = $[5];
76
+ }
77
+ const t7 = statusLabels[status];
78
+ let t8;
79
+ if ($[6] !== t7) {
80
+ t8 = /*#__PURE__*/_jsx("span", {
81
+ role: "status",
82
+ "aria-live": "polite",
83
+ className: "eyebrow shrink-0",
84
+ children: t7
85
+ });
86
+ $[6] = t7;
87
+ $[7] = t8;
88
+ } else {
89
+ t8 = $[7];
90
+ }
91
+ let t9;
92
+ if ($[8] !== elapsedMs) {
93
+ t9 = elapsedMs !== undefined && /*#__PURE__*/_jsxs("span", {
94
+ className: "shrink-0 font-mono text-xs text-muted-foreground tabular-nums",
95
+ children: [/*#__PURE__*/_jsx("span", {
96
+ className: "sr-only",
97
+ children: "Elapsed "
98
+ }), formatElapsed(elapsedMs)]
99
+ });
100
+ $[8] = elapsedMs;
101
+ $[9] = t9;
102
+ } else {
103
+ t9 = $[9];
104
+ }
105
+ let t10;
106
+ if ($[10] !== t5 || $[11] !== t6 || $[12] !== t8 || $[13] !== t9) {
107
+ t10 = /*#__PURE__*/_jsxs("span", {
108
+ className: "flex min-w-0 flex-1 items-center gap-2.5 text-sm",
109
+ children: [t5, t6, t8, t9]
110
+ });
111
+ $[10] = t5;
112
+ $[11] = t6;
113
+ $[12] = t8;
114
+ $[13] = t9;
115
+ $[14] = t10;
116
+ } else {
117
+ t10 = $[14];
118
+ }
119
+ let t11;
120
+ if ($[15] !== live || $[16] !== onPause || $[17] !== onResume || $[18] !== onStep || $[19] !== onStop || $[20] !== paused || $[21] !== pending) {
121
+ t11 = live && /*#__PURE__*/_jsxs("span", {
122
+ className: "ml-auto flex shrink-0 items-center gap-1",
123
+ children: [/*#__PURE__*/_jsxs(Button, {
124
+ type: "button",
125
+ size: "xs",
126
+ variant: paused ? "default" : "outline",
127
+ disabled: pending,
128
+ onClick: paused ? onResume : onPause,
129
+ children: [paused ? /*#__PURE__*/_jsx(PlayIcon, {
130
+ "aria-hidden": true
131
+ }) : /*#__PURE__*/_jsx(PauseIcon, {
132
+ "aria-hidden": true
133
+ }), paused ? "Resume" : "Pause"]
134
+ }), onStep && /*#__PURE__*/_jsxs(Button, {
135
+ type: "button",
136
+ size: "xs",
137
+ variant: "ghost",
138
+ "aria-label": "Run one step",
139
+ title: "Run one step",
140
+ disabled: !paused || pending,
141
+ onClick: onStep,
142
+ children: [/*#__PURE__*/_jsx(SkipForwardIcon, {
143
+ "aria-hidden": true
144
+ }), "Step"]
145
+ }), /*#__PURE__*/_jsxs(Button, {
146
+ type: "button",
147
+ size: "xs",
148
+ variant: "ghost",
149
+ className: "text-muted-foreground hover:bg-destructive/10 hover:text-destructive dark:hover:bg-destructive/15",
150
+ disabled: pending,
151
+ onClick: onStop,
152
+ children: [/*#__PURE__*/_jsx(SquareIcon, {
153
+ "aria-hidden": true,
154
+ className: "size-2.5 fill-current"
155
+ }), "Stop"]
156
+ })]
157
+ });
158
+ $[15] = live;
159
+ $[16] = onPause;
160
+ $[17] = onResume;
161
+ $[18] = onStep;
162
+ $[19] = onStop;
163
+ $[20] = paused;
164
+ $[21] = pending;
165
+ $[22] = t11;
166
+ } else {
167
+ t11 = $[22];
168
+ }
169
+ let t12;
170
+ if ($[23] !== status || $[24] !== t10 || $[25] !== t11 || $[26] !== t2 || $[27] !== t3) {
171
+ t12 = /*#__PURE__*/_jsxs("div", {
172
+ role: "toolbar",
173
+ "aria-label": t2,
174
+ "data-slot": "run-bar",
175
+ "data-status": status,
176
+ className: t3,
177
+ children: [t10, t11]
178
+ });
179
+ $[23] = status;
180
+ $[24] = t10;
181
+ $[25] = t11;
182
+ $[26] = t2;
183
+ $[27] = t3;
184
+ $[28] = t12;
185
+ } else {
186
+ t12 = $[28];
187
+ }
188
+ return t12;
33
189
  }
@@ -1 +1 @@
1
- export { DecisionSummary, } from "../../shared/decision-summary.js";
1
+ export { DecisionSummary } from "../../shared/decision-summary.js";
@@ -1,26 +1,57 @@
1
- import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { c as _c } from "react/compiler-runtime";
2
2
  import { Badge } from "@locusgraph/components";
3
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
3
4
  export const riskLabels = {
4
- read: "Read only",
5
- write: "Writes data",
6
- destructive: "Destructive",
5
+ read: "Read only",
6
+ write: "Writes data",
7
+ destructive: "Destructive"
7
8
  };
8
9
  export const riskRing = {
9
- read: "ring-border",
10
- write: "ring-border",
11
- destructive: "ring-destructive/60",
10
+ read: "ring-border",
11
+ write: "ring-border",
12
+ destructive: "ring-destructive/60"
12
13
  };
13
14
  export const riskTone = {
14
- read: "idle",
15
- write: "waiting",
16
- destructive: "danger",
15
+ read: "idle",
16
+ write: "waiting",
17
+ destructive: "danger"
17
18
  };
18
19
  export const riskCopy = {
19
- read: (tool) => `${tool} only reads data. Nothing changes if you approve.`,
20
- write: (tool) => `${tool} wants to make a change. Check the inputs before you approve.`,
21
- destructive: (tool) => (_jsxs(_Fragment, { children: [tool, " will permanently delete or overwrite data.", " ", _jsx("span", { className: "font-medium text-destructive", children: "This can't be undone." })] })),
20
+ read: tool => `${tool} only reads data. Nothing changes if you approve.`,
21
+ write: tool => `${tool} wants to make a change. Check the inputs before you approve.`,
22
+ destructive: tool => /*#__PURE__*/_jsxs(_Fragment, {
23
+ children: [tool, " will permanently delete or overwrite data.", " ", /*#__PURE__*/_jsx("span", {
24
+ className: "font-medium text-destructive",
25
+ children: "This can't be undone."
26
+ })]
27
+ })
22
28
  };
23
- const riskVariant = { read: "outline", write: "secondary", destructive: "destructive" };
24
- export function RiskBadge({ risk }) {
25
- return (_jsx(Badge, { "data-slot": "risk-badge", "data-risk": risk, variant: riskVariant[risk], children: riskLabels[risk] }));
29
+ const riskVariant = {
30
+ read: "outline",
31
+ write: "secondary",
32
+ destructive: "destructive"
33
+ };
34
+ export function RiskBadge(t0) {
35
+ const $ = _c(4);
36
+ const {
37
+ risk
38
+ } = t0;
39
+ const t1 = riskVariant[risk];
40
+ const t2 = riskLabels[risk];
41
+ let t3;
42
+ if ($[0] !== risk || $[1] !== t1 || $[2] !== t2) {
43
+ t3 = /*#__PURE__*/_jsx(Badge, {
44
+ "data-slot": "risk-badge",
45
+ "data-risk": risk,
46
+ variant: t1,
47
+ children: t2
48
+ });
49
+ $[0] = risk;
50
+ $[1] = t1;
51
+ $[2] = t2;
52
+ $[3] = t3;
53
+ } else {
54
+ t3 = $[3];
55
+ }
56
+ return t3;
26
57
  }
@@ -4,12 +4,9 @@ const minuteMs = 60_000;
4
4
  const hourMs = 60 * minuteMs;
5
5
  const dayMs = 24 * hourMs;
6
6
  export function formatWaiting(since, now) {
7
- const waitedMs = Math.max(0, now - toDate(since).getTime());
8
- if (waitedMs < minuteMs)
9
- return "just now";
10
- if (waitedMs < hourMs)
11
- return `${Math.floor(waitedMs / minuteMs)} min`;
12
- if (waitedMs < dayMs)
13
- return `${Math.floor(waitedMs / hourMs)} h`;
14
- return `${Math.floor(waitedMs / dayMs)} d`;
7
+ const waitedMs = Math.max(0, now - toDate(since).getTime());
8
+ if (waitedMs < minuteMs) return "just now";
9
+ if (waitedMs < hourMs) return `${Math.floor(waitedMs / minuteMs)} min`;
10
+ if (waitedMs < dayMs) return `${Math.floor(waitedMs / hourMs)} h`;
11
+ return `${Math.floor(waitedMs / dayMs)} d`;
15
12
  }
@@ -1,9 +1,26 @@
1
+ import { c as _c } from "react/compiler-runtime";
1
2
  import { useEffect, useRef } from "react";
2
3
  export function useFocusOnMount(enabled) {
3
- const ref = useRef(null);
4
- useEffect(() => {
5
- if (enabled)
6
- ref.current?.focus({ preventScroll: true });
7
- }, [enabled]);
8
- return ref;
4
+ const $ = _c(3);
5
+ const ref = useRef(null);
6
+ let t0;
7
+ let t1;
8
+ if ($[0] !== enabled) {
9
+ t0 = () => {
10
+ if (enabled) {
11
+ ref.current?.focus({
12
+ preventScroll: true
13
+ });
14
+ }
15
+ };
16
+ t1 = [enabled];
17
+ $[0] = enabled;
18
+ $[1] = t0;
19
+ $[2] = t1;
20
+ } else {
21
+ t0 = $[1];
22
+ t1 = $[2];
23
+ }
24
+ useEffect(t0, t1);
25
+ return ref;
9
26
  }