@locusgraph/loop 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent/pulse/gradient-label.js +12 -62
- package/dist/agent/pulse/marks/bars-mark.js +15 -37
- package/dist/agent/pulse/marks/glyph-mark.js +15 -54
- package/dist/agent/pulse/marks/locus-mark.js +12 -36
- package/dist/agent/pulse/marks/orb-mark.js +9 -19
- package/dist/agent/pulse/marks/spinner-mark.js +20 -29
- package/dist/agent/pulse/pulse.js +36 -123
- package/dist/agent/pulse/use-loop-animation.js +12 -33
- package/dist/agent/steps/step-icon.js +26 -96
- package/dist/agent/steps/steps.js +47 -210
- package/dist/agent/thinking/thinking.js +2 -2
- package/dist/agent/tool/json-block.js +11 -31
- package/dist/agent/tool/tool-status.js +12 -35
- package/dist/approval/inbox/inbox-row.js +76 -301
- package/dist/approval/inbox/inbox.js +39 -190
- package/dist/approval/inbox/virtual-inbox-list.js +26 -102
- package/dist/approval/memory/memory-review.js +36 -170
- package/dist/approval/memory/memory-row.js +50 -185
- package/dist/approval/plan/plan-review.js +73 -223
- package/dist/approval/plan/plan-step-row.js +76 -180
- package/dist/approval/plan/question-choices.js +44 -130
- package/dist/approval/plan/question.js +38 -154
- package/dist/approval/run/run-bar.js +39 -123
- package/dist/approval/shared/risk-badge.js +9 -24
- package/dist/approval/shared/use-focus-on-mount.js +5 -21
- package/dist/approval/spend/raise-cap-form.js +48 -221
- package/dist/approval/spend/spend-gate.js +40 -155
- package/dist/approval/spend/spend-meter.js +86 -313
- package/dist/approval/tool/approval.js +35 -194
- package/dist/approval/tool/args/args-editor.js +46 -204
- package/dist/approval/tool/args/args-field.js +55 -238
- package/dist/approval/tool/deny-form.js +36 -123
- package/dist/approval/tool/tool-inputs.js +24 -89
- package/dist/chat/chat/use-stick-to-bottom.js +60 -113
- package/dist/chat/chat/virtual-chat-items.js +34 -127
- package/dist/chat/composer/composer-actions.js +46 -129
- package/dist/chat/composer/use-auto-grow.js +8 -23
- package/dist/chat/files/files.js +66 -291
- package/dist/chat/reply/fenced-code.js +10 -32
- package/dist/chat/reply/markdown-components.js +2 -2
- package/dist/chat/reply/reply.js +24 -99
- package/dist/chat/turn/turn.js +46 -197
- package/dist/cost/context.js +65 -282
- package/dist/cost/cost-steps.js +42 -195
- package/dist/cost/cost.js +108 -497
- package/dist/cost/model-picker.js +42 -172
- package/dist/cost/shared/context-breakdown.js +65 -281
- package/dist/cost/shared/meter-marks.js +34 -92
- package/dist/cost/shared/model-option-row.js +35 -158
- package/dist/cost/shared/step-cost-row.js +37 -222
- package/dist/memory/cite.js +58 -179
- package/dist/memory/memorized.js +43 -195
- package/dist/memory/recall.js +68 -263
- package/dist/memory/shared/disclosure.d.ts +2 -2
- package/dist/memory/shared/disclosure.js +1 -1
- package/dist/memory/shared/source-mark.js +10 -38
- package/dist/memory/sources.js +52 -230
- package/dist/shared/decision-summary.js +35 -117
- package/dist/shared/panel-empty.js +15 -73
- package/dist/shared/panel.js +65 -239
- package/dist/shared/status-dot.js +10 -32
- package/dist/thread/actions/action-button.js +10 -53
- package/dist/thread/actions/branch-switcher.js +21 -95
- package/dist/thread/canvas/canvas.js +1 -1
- package/dist/thread/canvas/version-switcher.js +31 -126
- package/dist/thread/code/code.js +2 -2
- package/dist/thread/code/copy-code-button.js +24 -56
- package/dist/thread/history/history.js +1 -1
- package/dist/thread/history/row/history-row.js +18 -97
- package/dist/thread/history/row/thread-item-menu.js +19 -72
- package/dist/thread/history/row/thread-title-editor.js +29 -72
- package/dist/thread/history/virtual-history-list.js +46 -82
- package/dist/thread/starters/starters.js +27 -87
- package/dist/thread/use-copied.js +10 -38
- package/package.json +3 -3
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { c as _c } from "react/compiler-runtime";
|
|
2
1
|
import { ShieldAlert as ShieldAlertIcon, Tools as WrenchIcon } from "@carbon/icons-react";
|
|
3
2
|
import { Button, cn } from "@locusgraph/components";
|
|
4
3
|
import { useState } from "react";
|
|
@@ -39,125 +38,45 @@ function headerStatus(awaiting, decision) {
|
|
|
39
38
|
function decidedResult(toolName, state, decision) {
|
|
40
39
|
return settledStateLabels[state] ?? `${toolName} ${decision.approved ? "approved" : "denied"}`;
|
|
41
40
|
}
|
|
42
|
-
export function Approval(
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
className
|
|
54
|
-
} = t0;
|
|
55
|
-
const risk = t1 === undefined ? "write" : t1;
|
|
56
|
-
const autoFocus = t2 === undefined ? true : t2;
|
|
41
|
+
export function Approval({
|
|
42
|
+
part,
|
|
43
|
+
risk = "write",
|
|
44
|
+
actionLabel,
|
|
45
|
+
description,
|
|
46
|
+
decision,
|
|
47
|
+
onApprove,
|
|
48
|
+
onDeny,
|
|
49
|
+
autoFocus = true,
|
|
50
|
+
className
|
|
51
|
+
}) {
|
|
57
52
|
const [denying, setDenying] = useState(false);
|
|
58
|
-
|
|
59
|
-
if ($[0] !== part) {
|
|
60
|
-
t3 = toolNameOf(part);
|
|
61
|
-
$[0] = part;
|
|
62
|
-
$[1] = t3;
|
|
63
|
-
} else {
|
|
64
|
-
t3 = $[1];
|
|
65
|
-
}
|
|
66
|
-
const toolName = t3;
|
|
53
|
+
const toolName = toolNameOf(part);
|
|
67
54
|
const awaiting = !decision && part.state === "approval-requested";
|
|
68
55
|
const approveRef = useFocusOnMount(autoFocus && awaiting);
|
|
69
56
|
const destructive = risk === "destructive";
|
|
70
57
|
const Icon = destructive ? ShieldAlertIcon : WrenchIcon;
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
let t8;
|
|
85
|
-
if ($[5] !== className || $[6] !== t7) {
|
|
86
|
-
t8 = cn(t7, className);
|
|
87
|
-
$[5] = className;
|
|
88
|
-
$[6] = t7;
|
|
89
|
-
$[7] = t8;
|
|
90
|
-
} else {
|
|
91
|
-
t8 = $[7];
|
|
92
|
-
}
|
|
93
|
-
let t9;
|
|
94
|
-
if ($[8] !== Icon) {
|
|
95
|
-
t9 = /*#__PURE__*/_jsx(Icon, {
|
|
96
|
-
"aria-hidden": true
|
|
97
|
-
});
|
|
98
|
-
$[8] = Icon;
|
|
99
|
-
$[9] = t9;
|
|
100
|
-
} else {
|
|
101
|
-
t9 = $[9];
|
|
102
|
-
}
|
|
103
|
-
const t10 = awaiting ? "Approval needed" : "Tool call";
|
|
104
|
-
const t11 = riskLabels[risk];
|
|
105
|
-
let t12;
|
|
106
|
-
if ($[10] !== header.status || $[11] !== header.tone || $[12] !== t10 || $[13] !== t11 || $[14] !== t9) {
|
|
107
|
-
t12 = /*#__PURE__*/_jsx(PanelHeader, {
|
|
108
|
-
icon: t9,
|
|
109
|
-
eyebrow: t10,
|
|
110
|
-
aside: t11,
|
|
58
|
+
const header = headerStatus(awaiting, decision);
|
|
59
|
+
return /*#__PURE__*/_jsxs(ApprovalPanel, {
|
|
60
|
+
"data-slot": "approval",
|
|
61
|
+
"data-risk": risk,
|
|
62
|
+
"data-state": decision ? decision.approved ? "approved" : "denied" : part.state,
|
|
63
|
+
"aria-label": `Approve ${toolName}`,
|
|
64
|
+
className: cn(awaiting && riskRing[risk], className),
|
|
65
|
+
children: [/*#__PURE__*/_jsx(PanelHeader, {
|
|
66
|
+
icon: /*#__PURE__*/_jsx(Icon, {
|
|
67
|
+
"aria-hidden": true
|
|
68
|
+
}),
|
|
69
|
+
eyebrow: awaiting ? "Approval needed" : "Tool call",
|
|
70
|
+
aside: riskLabels[risk],
|
|
111
71
|
status: header.status,
|
|
112
72
|
tone: header.tone
|
|
113
|
-
})
|
|
114
|
-
|
|
115
|
-
$[11] = header.tone;
|
|
116
|
-
$[12] = t10;
|
|
117
|
-
$[13] = t11;
|
|
118
|
-
$[14] = t9;
|
|
119
|
-
$[15] = t12;
|
|
120
|
-
} else {
|
|
121
|
-
t12 = $[15];
|
|
122
|
-
}
|
|
123
|
-
const t13 = !awaiting && "text-muted-foreground";
|
|
124
|
-
let t14;
|
|
125
|
-
if ($[16] !== t13) {
|
|
126
|
-
t14 = cn("truncate font-mono", t13);
|
|
127
|
-
$[16] = t13;
|
|
128
|
-
$[17] = t14;
|
|
129
|
-
} else {
|
|
130
|
-
t14 = $[17];
|
|
131
|
-
}
|
|
132
|
-
let t15;
|
|
133
|
-
if ($[18] !== t14 || $[19] !== toolName) {
|
|
134
|
-
t15 = /*#__PURE__*/_jsx(PanelTitle, {
|
|
135
|
-
className: t14,
|
|
73
|
+
}), /*#__PURE__*/_jsx(PanelTitle, {
|
|
74
|
+
className: cn("truncate font-mono", !awaiting && "text-muted-foreground"),
|
|
136
75
|
children: toolName
|
|
137
|
-
})
|
|
138
|
-
$[18] = t14;
|
|
139
|
-
$[19] = toolName;
|
|
140
|
-
$[20] = t15;
|
|
141
|
-
} else {
|
|
142
|
-
t15 = $[20];
|
|
143
|
-
}
|
|
144
|
-
let t16;
|
|
145
|
-
if ($[21] !== awaiting || $[22] !== description || $[23] !== risk || $[24] !== toolName) {
|
|
146
|
-
t16 = awaiting && /*#__PURE__*/_jsx("p", {
|
|
76
|
+
}), awaiting && /*#__PURE__*/_jsx("p", {
|
|
147
77
|
className: "px-5 pt-1 text-sm text-muted-foreground",
|
|
148
78
|
children: description ?? riskCopy[risk](toolName)
|
|
149
|
-
})
|
|
150
|
-
$[21] = awaiting;
|
|
151
|
-
$[22] = description;
|
|
152
|
-
$[23] = risk;
|
|
153
|
-
$[24] = toolName;
|
|
154
|
-
$[25] = t16;
|
|
155
|
-
} else {
|
|
156
|
-
t16 = $[25];
|
|
157
|
-
}
|
|
158
|
-
let t17;
|
|
159
|
-
if ($[26] !== actionLabel || $[27] !== approveRef || $[28] !== awaiting || $[29] !== denying || $[30] !== destructive || $[31] !== onApprove || $[32] !== part || $[33] !== toolName) {
|
|
160
|
-
t17 = awaiting && !denying && /*#__PURE__*/_jsxs(_Fragment, {
|
|
79
|
+
}), awaiting && !denying && /*#__PURE__*/_jsxs(_Fragment, {
|
|
161
80
|
children: [/*#__PURE__*/_jsx(PanelBody, {
|
|
162
81
|
children: /*#__PURE__*/_jsx(ToolInputs, {
|
|
163
82
|
input: part.input
|
|
@@ -185,22 +104,7 @@ export function Approval(t0) {
|
|
|
185
104
|
})]
|
|
186
105
|
})]
|
|
187
106
|
})]
|
|
188
|
-
})
|
|
189
|
-
$[26] = actionLabel;
|
|
190
|
-
$[27] = approveRef;
|
|
191
|
-
$[28] = awaiting;
|
|
192
|
-
$[29] = denying;
|
|
193
|
-
$[30] = destructive;
|
|
194
|
-
$[31] = onApprove;
|
|
195
|
-
$[32] = part;
|
|
196
|
-
$[33] = toolName;
|
|
197
|
-
$[34] = t17;
|
|
198
|
-
} else {
|
|
199
|
-
t17 = $[34];
|
|
200
|
-
}
|
|
201
|
-
let t18;
|
|
202
|
-
if ($[35] !== awaiting || $[36] !== denying || $[37] !== onDeny || $[38] !== part) {
|
|
203
|
-
t18 = awaiting && denying && /*#__PURE__*/_jsxs(_Fragment, {
|
|
107
|
+
}), awaiting && denying && /*#__PURE__*/_jsxs(_Fragment, {
|
|
204
108
|
children: [/*#__PURE__*/_jsx(PanelBody, {
|
|
205
109
|
className: "pb-4",
|
|
206
110
|
children: /*#__PURE__*/_jsx(ToolInputs, {
|
|
@@ -211,18 +115,7 @@ export function Approval(t0) {
|
|
|
211
115
|
onDeny: onDeny,
|
|
212
116
|
onBack: () => setDenying(false)
|
|
213
117
|
})]
|
|
214
|
-
})
|
|
215
|
-
$[35] = awaiting;
|
|
216
|
-
$[36] = denying;
|
|
217
|
-
$[37] = onDeny;
|
|
218
|
-
$[38] = part;
|
|
219
|
-
$[39] = t18;
|
|
220
|
-
} else {
|
|
221
|
-
t18 = $[39];
|
|
222
|
-
}
|
|
223
|
-
let t19;
|
|
224
|
-
if ($[40] !== awaiting || $[41] !== decision || $[42] !== part || $[43] !== toolName) {
|
|
225
|
-
t19 = !awaiting && /*#__PURE__*/_jsx(PanelBody, {
|
|
118
|
+
}), !awaiting && /*#__PURE__*/_jsx(PanelBody, {
|
|
226
119
|
className: "pt-3",
|
|
227
120
|
children: decision ? /*#__PURE__*/_jsx(DecisionSummary, {
|
|
228
121
|
decision: decision,
|
|
@@ -231,60 +124,8 @@ export function Approval(t0) {
|
|
|
231
124
|
className: "text-sm text-muted-foreground",
|
|
232
125
|
children: settledLabel(part.state)
|
|
233
126
|
})
|
|
234
|
-
})
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
$[43] = toolName;
|
|
239
|
-
$[44] = t19;
|
|
240
|
-
} else {
|
|
241
|
-
t19 = $[44];
|
|
242
|
-
}
|
|
243
|
-
let t20;
|
|
244
|
-
if ($[45] !== awaiting || $[46] !== decision || $[47] !== part || $[48] !== toolName) {
|
|
245
|
-
t20 = decision ? `${toolName} ${decision.approved ? "approved" : "denied"} by ${decision.by}` : awaiting ? `${toolName} is waiting for your approval` : settledLabel(part.state);
|
|
246
|
-
$[45] = awaiting;
|
|
247
|
-
$[46] = decision;
|
|
248
|
-
$[47] = part;
|
|
249
|
-
$[48] = toolName;
|
|
250
|
-
$[49] = t20;
|
|
251
|
-
} else {
|
|
252
|
-
t20 = $[49];
|
|
253
|
-
}
|
|
254
|
-
let t21;
|
|
255
|
-
if ($[50] !== t20) {
|
|
256
|
-
t21 = /*#__PURE__*/_jsx(LiveStatus, {
|
|
257
|
-
message: t20
|
|
258
|
-
});
|
|
259
|
-
$[50] = t20;
|
|
260
|
-
$[51] = t21;
|
|
261
|
-
} else {
|
|
262
|
-
t21 = $[51];
|
|
263
|
-
}
|
|
264
|
-
let t22;
|
|
265
|
-
if ($[52] !== risk || $[53] !== t12 || $[54] !== t15 || $[55] !== t16 || $[56] !== t17 || $[57] !== t18 || $[58] !== t19 || $[59] !== t21 || $[60] !== t5 || $[61] !== t6 || $[62] !== t8) {
|
|
266
|
-
t22 = /*#__PURE__*/_jsxs(ApprovalPanel, {
|
|
267
|
-
"data-slot": "approval",
|
|
268
|
-
"data-risk": risk,
|
|
269
|
-
"data-state": t5,
|
|
270
|
-
"aria-label": t6,
|
|
271
|
-
className: t8,
|
|
272
|
-
children: [t12, t15, t16, t17, t18, t19, t21]
|
|
273
|
-
});
|
|
274
|
-
$[52] = risk;
|
|
275
|
-
$[53] = t12;
|
|
276
|
-
$[54] = t15;
|
|
277
|
-
$[55] = t16;
|
|
278
|
-
$[56] = t17;
|
|
279
|
-
$[57] = t18;
|
|
280
|
-
$[58] = t19;
|
|
281
|
-
$[59] = t21;
|
|
282
|
-
$[60] = t5;
|
|
283
|
-
$[61] = t6;
|
|
284
|
-
$[62] = t8;
|
|
285
|
-
$[63] = t22;
|
|
286
|
-
} else {
|
|
287
|
-
t22 = $[63];
|
|
288
|
-
}
|
|
289
|
-
return t22;
|
|
127
|
+
}), /*#__PURE__*/_jsx(LiveStatus, {
|
|
128
|
+
message: decision ? `${toolName} ${decision.approved ? "approved" : "denied"} by ${decision.by}` : awaiting ? `${toolName} is waiting for your approval` : settledLabel(part.state)
|
|
129
|
+
})]
|
|
130
|
+
});
|
|
290
131
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { c as _c } from "react/compiler-runtime";
|
|
2
1
|
import { Edit as SquarePenIcon } from "@carbon/icons-react";
|
|
3
2
|
import { Button, cn } from "@locusgraph/components";
|
|
4
3
|
import { useId, useMemo, useState } from "react";
|
|
@@ -12,141 +11,45 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
12
11
|
function errorSummary(count) {
|
|
13
12
|
return count === 1 ? "1 field needs a fix." : `${count} fields need a fix.`;
|
|
14
13
|
}
|
|
15
|
-
export function ArgsEditor(
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
className
|
|
29
|
-
} = t0;
|
|
30
|
-
let t4;
|
|
31
|
-
if ($[0] !== t1) {
|
|
32
|
-
t4 = t1 === undefined ? {} : t1;
|
|
33
|
-
$[0] = t1;
|
|
34
|
-
$[1] = t4;
|
|
35
|
-
} else {
|
|
36
|
-
t4 = $[1];
|
|
37
|
-
}
|
|
38
|
-
const initialValues = t4;
|
|
39
|
-
const risk = t2 === undefined ? "write" : t2;
|
|
40
|
-
const autoFocus = t3 === undefined ? false : t3;
|
|
14
|
+
export function ArgsEditor({
|
|
15
|
+
toolName,
|
|
16
|
+
fields,
|
|
17
|
+
initialValues = {},
|
|
18
|
+
risk = "write",
|
|
19
|
+
actionLabel,
|
|
20
|
+
description,
|
|
21
|
+
decision,
|
|
22
|
+
onApprove,
|
|
23
|
+
onCancel,
|
|
24
|
+
autoFocus = false,
|
|
25
|
+
className
|
|
26
|
+
}) {
|
|
41
27
|
const baseId = useId();
|
|
42
|
-
|
|
43
|
-
if ($[2] !== fields || $[3] !== initialValues) {
|
|
44
|
-
t5 = () => draftsFrom(fields, initialValues);
|
|
45
|
-
$[2] = fields;
|
|
46
|
-
$[3] = initialValues;
|
|
47
|
-
$[4] = t5;
|
|
48
|
-
} else {
|
|
49
|
-
t5 = $[4];
|
|
50
|
-
}
|
|
51
|
-
const [drafts, setDrafts] = useState(t5);
|
|
28
|
+
const [drafts, setDrafts] = useState(() => draftsFrom(fields, initialValues));
|
|
52
29
|
const [showErrors, setShowErrors] = useState(false);
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
$[5] = drafts;
|
|
57
|
-
$[6] = fields;
|
|
58
|
-
$[7] = t6;
|
|
59
|
-
} else {
|
|
60
|
-
t6 = $[7];
|
|
61
|
-
}
|
|
62
|
-
const errors = t6;
|
|
63
|
-
let t7;
|
|
64
|
-
if ($[8] !== errors) {
|
|
65
|
-
t7 = Object.keys(errors);
|
|
66
|
-
$[8] = errors;
|
|
67
|
-
$[9] = t7;
|
|
68
|
-
} else {
|
|
69
|
-
t7 = $[9];
|
|
70
|
-
}
|
|
71
|
-
const errorCount = t7.length;
|
|
72
|
-
let t8;
|
|
73
|
-
if ($[10] !== errors || $[11] !== showErrors) {
|
|
74
|
-
t8 = showErrors ? errors : {};
|
|
75
|
-
$[10] = errors;
|
|
76
|
-
$[11] = showErrors;
|
|
77
|
-
$[12] = t8;
|
|
78
|
-
} else {
|
|
79
|
-
t8 = $[12];
|
|
80
|
-
}
|
|
81
|
-
const visibleErrors = t8;
|
|
30
|
+
const errors = useMemo(() => validateDrafts(fields, drafts), [fields, drafts]);
|
|
31
|
+
const errorCount = Object.keys(errors).length;
|
|
32
|
+
const visibleErrors = showErrors ? errors : {};
|
|
82
33
|
const destructive = risk === "destructive";
|
|
83
34
|
const submitRef = useFocusOnMount(autoFocus && !decision);
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
"
|
|
100
|
-
});
|
|
101
|
-
$[16] = t13;
|
|
102
|
-
} else {
|
|
103
|
-
t13 = $[16];
|
|
104
|
-
}
|
|
105
|
-
const t14 = decision ? "Tool call" : "Edit before approving";
|
|
106
|
-
const t15 = riskLabels[risk];
|
|
107
|
-
const t16 = decision ? decision.approved ? "Approved" : "Cancelled" : "Waiting for you";
|
|
108
|
-
const t17 = decision ? decision.approved ? "done" : "danger" : "waiting";
|
|
109
|
-
let t18;
|
|
110
|
-
if ($[17] !== t14 || $[18] !== t15 || $[19] !== t16 || $[20] !== t17) {
|
|
111
|
-
t18 = /*#__PURE__*/_jsx(PanelHeader, {
|
|
112
|
-
icon: t13,
|
|
113
|
-
eyebrow: t14,
|
|
114
|
-
aside: t15,
|
|
115
|
-
status: t16,
|
|
116
|
-
tone: t17
|
|
117
|
-
});
|
|
118
|
-
$[17] = t14;
|
|
119
|
-
$[18] = t15;
|
|
120
|
-
$[19] = t16;
|
|
121
|
-
$[20] = t17;
|
|
122
|
-
$[21] = t18;
|
|
123
|
-
} else {
|
|
124
|
-
t18 = $[21];
|
|
125
|
-
}
|
|
126
|
-
const t19 = decision && "text-muted-foreground";
|
|
127
|
-
let t20;
|
|
128
|
-
if ($[22] !== t19) {
|
|
129
|
-
t20 = cn("truncate font-mono", t19);
|
|
130
|
-
$[22] = t19;
|
|
131
|
-
$[23] = t20;
|
|
132
|
-
} else {
|
|
133
|
-
t20 = $[23];
|
|
134
|
-
}
|
|
135
|
-
let t21;
|
|
136
|
-
if ($[24] !== t20 || $[25] !== toolName) {
|
|
137
|
-
t21 = /*#__PURE__*/_jsx(PanelTitle, {
|
|
138
|
-
className: t20,
|
|
35
|
+
return /*#__PURE__*/_jsxs(ApprovalPanel, {
|
|
36
|
+
"data-slot": "args-editor",
|
|
37
|
+
"data-risk": risk,
|
|
38
|
+
"aria-label": `Edit ${toolName} inputs`,
|
|
39
|
+
"data-state": decision ? decision.approved ? "approved" : "denied" : "editing",
|
|
40
|
+
className: cn(!decision && riskRing[risk], className),
|
|
41
|
+
children: [/*#__PURE__*/_jsx(PanelHeader, {
|
|
42
|
+
icon: /*#__PURE__*/_jsx(SquarePenIcon, {
|
|
43
|
+
"aria-hidden": true
|
|
44
|
+
}),
|
|
45
|
+
eyebrow: decision ? "Tool call" : "Edit before approving",
|
|
46
|
+
aside: riskLabels[risk],
|
|
47
|
+
status: decision ? decision.approved ? "Approved" : "Cancelled" : "Waiting for you",
|
|
48
|
+
tone: decision ? decision.approved ? "done" : "danger" : "waiting"
|
|
49
|
+
}), /*#__PURE__*/_jsx(PanelTitle, {
|
|
50
|
+
className: cn("truncate font-mono", decision && "text-muted-foreground"),
|
|
139
51
|
children: toolName
|
|
140
|
-
})
|
|
141
|
-
$[24] = t20;
|
|
142
|
-
$[25] = toolName;
|
|
143
|
-
$[26] = t21;
|
|
144
|
-
} else {
|
|
145
|
-
t21 = $[26];
|
|
146
|
-
}
|
|
147
|
-
let t22;
|
|
148
|
-
if ($[27] !== actionLabel || $[28] !== baseId || $[29] !== decision || $[30] !== description || $[31] !== destructive || $[32] !== drafts || $[33] !== errorCount || $[34] !== errors || $[35] !== fields || $[36] !== onApprove || $[37] !== onCancel || $[38] !== risk || $[39] !== showErrors || $[40] !== submitRef || $[41] !== toolName || $[42] !== visibleErrors) {
|
|
149
|
-
t22 = decision ? /*#__PURE__*/_jsx(PanelBody, {
|
|
52
|
+
}), decision ? /*#__PURE__*/_jsx(PanelBody, {
|
|
150
53
|
className: "pt-3",
|
|
151
54
|
children: /*#__PURE__*/_jsx(DecisionSummary, {
|
|
152
55
|
decision: decision,
|
|
@@ -165,25 +68,23 @@ export function ArgsEditor(t0) {
|
|
|
165
68
|
if (firstInvalid) {
|
|
166
69
|
setShowErrors(true);
|
|
167
70
|
const control = event.currentTarget.elements.namedItem(firstInvalid.name);
|
|
168
|
-
if (control instanceof HTMLElement)
|
|
169
|
-
control.focus();
|
|
170
|
-
}
|
|
71
|
+
if (control instanceof HTMLElement) control.focus();
|
|
171
72
|
return;
|
|
172
73
|
}
|
|
173
74
|
onApprove(valuesFromDrafts(fields, drafts));
|
|
174
75
|
},
|
|
175
76
|
children: [/*#__PURE__*/_jsx(PanelBody, {
|
|
176
77
|
className: "gap-5 pt-5",
|
|
177
|
-
children: fields.map(
|
|
178
|
-
id: `${baseId}-${
|
|
179
|
-
field:
|
|
180
|
-
draft: drafts[
|
|
181
|
-
error: visibleErrors[
|
|
78
|
+
children: fields.map(field => /*#__PURE__*/_jsx(ArgsField, {
|
|
79
|
+
id: `${baseId}-${field.name}`,
|
|
80
|
+
field: field,
|
|
81
|
+
draft: drafts[field.name],
|
|
82
|
+
error: visibleErrors[field.name],
|
|
182
83
|
onChange: draft => setDrafts(current => ({
|
|
183
84
|
...current,
|
|
184
|
-
[
|
|
85
|
+
[field.name]: draft
|
|
185
86
|
}))
|
|
186
|
-
},
|
|
87
|
+
}, field.name))
|
|
187
88
|
}), /*#__PURE__*/_jsxs(PanelFooter, {
|
|
188
89
|
className: "justify-between",
|
|
189
90
|
children: [/*#__PURE__*/_jsx("span", {
|
|
@@ -207,67 +108,8 @@ export function ArgsEditor(t0) {
|
|
|
207
108
|
})]
|
|
208
109
|
})]
|
|
209
110
|
})]
|
|
210
|
-
})
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
$[30] = description;
|
|
215
|
-
$[31] = destructive;
|
|
216
|
-
$[32] = drafts;
|
|
217
|
-
$[33] = errorCount;
|
|
218
|
-
$[34] = errors;
|
|
219
|
-
$[35] = fields;
|
|
220
|
-
$[36] = onApprove;
|
|
221
|
-
$[37] = onCancel;
|
|
222
|
-
$[38] = risk;
|
|
223
|
-
$[39] = showErrors;
|
|
224
|
-
$[40] = submitRef;
|
|
225
|
-
$[41] = toolName;
|
|
226
|
-
$[42] = visibleErrors;
|
|
227
|
-
$[43] = t22;
|
|
228
|
-
} else {
|
|
229
|
-
t22 = $[43];
|
|
230
|
-
}
|
|
231
|
-
let t23;
|
|
232
|
-
if ($[44] !== errorCount || $[45] !== showErrors) {
|
|
233
|
-
t23 = showErrors && errorCount > 0 ? errorSummary(errorCount) : "";
|
|
234
|
-
$[44] = errorCount;
|
|
235
|
-
$[45] = showErrors;
|
|
236
|
-
$[46] = t23;
|
|
237
|
-
} else {
|
|
238
|
-
t23 = $[46];
|
|
239
|
-
}
|
|
240
|
-
let t24;
|
|
241
|
-
if ($[47] !== t23) {
|
|
242
|
-
t24 = /*#__PURE__*/_jsx(LiveStatus, {
|
|
243
|
-
message: t23
|
|
244
|
-
});
|
|
245
|
-
$[47] = t23;
|
|
246
|
-
$[48] = t24;
|
|
247
|
-
} else {
|
|
248
|
-
t24 = $[48];
|
|
249
|
-
}
|
|
250
|
-
let t25;
|
|
251
|
-
if ($[49] !== risk || $[50] !== t10 || $[51] !== t12 || $[52] !== t18 || $[53] !== t21 || $[54] !== t22 || $[55] !== t24 || $[56] !== t9) {
|
|
252
|
-
t25 = /*#__PURE__*/_jsxs(ApprovalPanel, {
|
|
253
|
-
"data-slot": "args-editor",
|
|
254
|
-
"data-risk": risk,
|
|
255
|
-
"aria-label": t9,
|
|
256
|
-
"data-state": t10,
|
|
257
|
-
className: t12,
|
|
258
|
-
children: [t18, t21, t22, t24]
|
|
259
|
-
});
|
|
260
|
-
$[49] = risk;
|
|
261
|
-
$[50] = t10;
|
|
262
|
-
$[51] = t12;
|
|
263
|
-
$[52] = t18;
|
|
264
|
-
$[53] = t21;
|
|
265
|
-
$[54] = t22;
|
|
266
|
-
$[55] = t24;
|
|
267
|
-
$[56] = t9;
|
|
268
|
-
$[57] = t25;
|
|
269
|
-
} else {
|
|
270
|
-
t25 = $[57];
|
|
271
|
-
}
|
|
272
|
-
return t25;
|
|
111
|
+
}), /*#__PURE__*/_jsx(LiveStatus, {
|
|
112
|
+
message: showErrors && errorCount > 0 ? errorSummary(errorCount) : ""
|
|
113
|
+
})]
|
|
114
|
+
});
|
|
273
115
|
}
|