@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.
- package/README.md +2 -0
- package/dist/agent/pulse/gradient-label.js +86 -15
- package/dist/agent/pulse/marks/bars-mark.js +46 -10
- package/dist/agent/pulse/marks/glyph-mark.js +56 -11
- package/dist/agent/pulse/marks/locus-mark.js +63 -28
- package/dist/agent/pulse/marks/orb-mark.js +31 -8
- package/dist/agent/pulse/marks/spinner-mark.js +29 -1
- package/dist/agent/pulse/pulse.js +150 -35
- package/dist/agent/pulse/use-loop-animation.js +36 -17
- package/dist/agent/steps/step-icon.js +110 -24
- package/dist/agent/steps/steps.js +235 -25
- package/dist/agent/thinking/thinking.js +203 -23
- package/dist/agent/thinking/thought-duration.js +7 -9
- package/dist/agent/tool/json-block.js +38 -11
- package/dist/agent/tool/tool-status.js +51 -18
- package/dist/agent/tool/tool.js +184 -6
- package/dist/approval/inbox/inbox-row.d.ts +3 -2
- package/dist/approval/inbox/inbox-row.js +321 -7
- package/dist/approval/inbox/inbox-selection.js +7 -13
- package/dist/approval/inbox/inbox.d.ts +2 -1
- package/dist/approval/inbox/inbox.js +250 -18
- package/dist/approval/inbox/virtual-inbox-list.d.ts +13 -0
- package/dist/approval/inbox/virtual-inbox-list.js +129 -0
- package/dist/approval/memory/memory-choices.js +27 -22
- package/dist/approval/memory/memory-review.js +242 -17
- package/dist/approval/memory/memory-row.js +215 -19
- package/dist/approval/plan/plan-review.js +279 -28
- package/dist/approval/plan/plan-step-row.js +194 -43
- package/dist/approval/plan/plan-steps.js +24 -23
- package/dist/approval/plan/question-choices.js +158 -39
- package/dist/approval/plan/question.d.ts +1 -1
- package/dist/approval/plan/question.js +223 -26
- package/dist/approval/run/run-bar.js +178 -22
- package/dist/approval/shared/decision-line.js +1 -1
- package/dist/approval/shared/risk-badge.js +47 -16
- package/dist/approval/shared/time.js +5 -8
- package/dist/approval/shared/use-focus-on-mount.js +23 -6
- package/dist/approval/spend/raise-cap-form.js +235 -17
- package/dist/approval/spend/spend-gate.js +239 -21
- package/dist/approval/spend/spend-math.js +7 -8
- package/dist/approval/spend/spend-meter.js +362 -34
- package/dist/approval/tool/approval.js +272 -27
- package/dist/approval/tool/args/args-editor.js +262 -26
- package/dist/approval/tool/args/args-field.js +259 -19
- package/dist/approval/tool/args/args-validation.js +38 -47
- package/dist/approval/tool/deny-form.js +130 -10
- package/dist/approval/tool/tool-inputs.js +127 -38
- package/dist/chat/chat/chat-item-spacing.d.ts +3 -0
- package/dist/chat/chat/chat-item-spacing.js +19 -0
- package/dist/chat/chat/chat.d.ts +2 -1
- package/dist/chat/chat/chat.js +181 -5
- package/dist/chat/chat/use-stick-to-bottom.js +123 -47
- package/dist/chat/chat/virtual-chat-items.d.ts +8 -0
- package/dist/chat/chat/virtual-chat-items.js +153 -0
- package/dist/chat/composer/composer-actions.js +151 -16
- package/dist/chat/composer/composer.js +330 -32
- package/dist/chat/composer/use-auto-grow.js +24 -9
- package/dist/chat/files/file-meta.js +19 -19
- package/dist/chat/files/files.js +316 -28
- package/dist/chat/reply/fenced-code.js +45 -21
- package/dist/chat/reply/markdown-components.js +137 -17
- package/dist/chat/reply/reply.js +105 -10
- package/dist/chat/turn/group-parts.js +43 -29
- package/dist/chat/turn/turn.js +238 -30
- package/dist/cost/context.js +321 -23
- package/dist/cost/cost-steps.js +220 -14
- package/dist/cost/cost.js +521 -27
- package/dist/cost/model-picker.js +181 -6
- package/dist/cost/shared/context-breakdown.js +299 -10
- package/dist/cost/shared/meter-marks.js +107 -9
- package/dist/cost/shared/model-option-row.js +178 -21
- package/dist/cost/shared/step-cost-row.js +248 -20
- package/dist/cost/shared/usage-totals.js +22 -18
- package/dist/memory/cite.js +182 -11
- package/dist/memory/memorized.js +217 -11
- package/dist/memory/recall.js +296 -17
- package/dist/memory/shared/host-label.js +19 -22
- package/dist/memory/shared/source-mark.js +39 -3
- package/dist/memory/sources.js +255 -13
- package/dist/shared/decision-summary.js +133 -14
- package/dist/shared/panel-empty.js +78 -3
- package/dist/shared/panel.js +243 -13
- package/dist/shared/status-dot.js +38 -8
- package/dist/shared/virtual/use-list-virtualizer.d.ts +24 -0
- package/dist/shared/virtual/use-list-virtualizer.js +68 -0
- package/dist/thread/actions/action-button.js +65 -3
- package/dist/thread/actions/actions.js +184 -13
- package/dist/thread/actions/branch-switcher.js +102 -5
- package/dist/thread/canvas/canvas.js +205 -5
- package/dist/thread/canvas/version-switcher.js +149 -8
- package/dist/thread/code/code.js +186 -24
- package/dist/thread/code/copy-code-button.js +61 -13
- package/dist/thread/code/highlight.js +30 -29
- package/dist/thread/history/history-rows.d.ts +16 -0
- package/dist/thread/history/history-rows.js +23 -0
- package/dist/thread/history/history.d.ts +3 -2
- package/dist/thread/history/history.js +174 -5
- package/dist/thread/history/{history-row.d.ts → row/history-row.d.ts} +3 -2
- package/dist/thread/history/row/history-row.js +137 -0
- package/dist/thread/history/row/thread-item-menu.js +84 -0
- package/dist/thread/history/row/thread-title-editor.js +81 -0
- package/dist/thread/history/thread-groups.d.ts +1 -1
- package/dist/thread/history/thread-groups.js +40 -34
- package/dist/thread/history/virtual-history-list.d.ts +11 -0
- package/dist/thread/history/virtual-history-list.js +107 -0
- package/dist/thread/index.d.ts +1 -1
- package/dist/thread/starters/starters.js +92 -7
- package/dist/thread/use-copied.js +45 -15
- package/dist/types.js +1 -1
- package/package.json +6 -4
- package/dist/thread/history/history-row.js +0 -17
- package/dist/thread/history/thread-item-menu.js +0 -6
- package/dist/thread/history/thread-title-editor.js +0 -25
- /package/dist/thread/history/{thread-item-menu.d.ts → row/thread-item-menu.d.ts} +0 -0
- /package/dist/thread/history/{thread-title-editor.d.ts → row/thread-title-editor.d.ts} +0 -0
|
@@ -1,35 +1,232 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { ArrowRight as ArrowRightIcon, Help as MessageCircleQuestionIcon
|
|
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
|
|
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
|
-
|
|
11
|
-
|
|
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(
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
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
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
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 {
|
|
2
|
-
import { Pause as PauseIcon, Play as PlayIcon, SkipForward as SkipForwardIcon, StopFilledAlt as SquareIcon
|
|
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
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
running: "Running",
|
|
8
|
+
paused: "Paused",
|
|
9
|
+
stopped: "Stopped",
|
|
10
|
+
done: "Done"
|
|
10
11
|
};
|
|
11
12
|
const statusTone = {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
running: "running",
|
|
14
|
+
paused: "waiting",
|
|
15
|
+
stopped: "danger",
|
|
16
|
+
done: "done"
|
|
16
17
|
};
|
|
17
18
|
function twoDigits(value) {
|
|
18
|
-
|
|
19
|
+
return String(value).padStart(2, "0");
|
|
19
20
|
}
|
|
20
21
|
function formatElapsed(elapsedMs) {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
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(
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
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
|
|
1
|
+
export { DecisionSummary } from "../../shared/decision-summary.js";
|
|
@@ -1,26 +1,57 @@
|
|
|
1
|
-
import {
|
|
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
|
-
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
read: "Read only",
|
|
6
|
+
write: "Writes data",
|
|
7
|
+
destructive: "Destructive"
|
|
7
8
|
};
|
|
8
9
|
export const riskRing = {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
read: "ring-border",
|
|
11
|
+
write: "ring-border",
|
|
12
|
+
destructive: "ring-destructive/60"
|
|
12
13
|
};
|
|
13
14
|
export const riskTone = {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
read: "idle",
|
|
16
|
+
write: "waiting",
|
|
17
|
+
destructive: "danger"
|
|
17
18
|
};
|
|
18
19
|
export const riskCopy = {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
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 = {
|
|
24
|
-
|
|
25
|
-
|
|
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
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
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
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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
|
}
|