@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,28 +1,268 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { c as _c } from "react/compiler-runtime";
2
2
  import { Checkbox, Input, Label, NativeSelect, NativeSelectOption } from "@locusgraph/components";
3
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
4
  function describedBy(id, field, error) {
4
- const ids = [field.description && `${id}-hint`, error && `${id}-error`].filter(Boolean);
5
- return ids.length > 0 ? ids.join(" ") : undefined;
5
+ const ids = [field.description && `${id}-hint`, error && `${id}-error`].filter(Boolean);
6
+ return ids.length > 0 ? ids.join(" ") : undefined;
6
7
  }
7
- function FieldControl({ id, field, draft, error, onChange }) {
8
- const shared = {
9
- id,
10
- name: field.name,
11
- "aria-invalid": error ? true : undefined,
12
- "aria-describedby": describedBy(id, field, error),
13
- "aria-required": field.required || undefined,
8
+ function FieldControl(t0) {
9
+ const $ = _c(38);
10
+ const {
11
+ id,
12
+ field,
13
+ draft,
14
+ error,
15
+ onChange
16
+ } = t0;
17
+ const t1 = field.name;
18
+ const t2 = error ? true : undefined;
19
+ let t3;
20
+ if ($[0] !== error || $[1] !== field || $[2] !== id) {
21
+ t3 = describedBy(id, field, error);
22
+ $[0] = error;
23
+ $[1] = field;
24
+ $[2] = id;
25
+ $[3] = t3;
26
+ } else {
27
+ t3 = $[3];
28
+ }
29
+ const t4 = field.required || undefined;
30
+ let t5;
31
+ if ($[4] !== field.name || $[5] !== id || $[6] !== t2 || $[7] !== t3 || $[8] !== t4) {
32
+ t5 = {
33
+ id,
34
+ name: t1,
35
+ "aria-invalid": t2,
36
+ "aria-describedby": t3,
37
+ "aria-required": t4
14
38
  };
15
- if (field.type === "boolean") {
16
- return (_jsx(Checkbox, { ...shared, checked: draft === true, onCheckedChange: (checked) => onChange(checked === true) }));
39
+ $[4] = field.name;
40
+ $[5] = id;
41
+ $[6] = t2;
42
+ $[7] = t3;
43
+ $[8] = t4;
44
+ $[9] = t5;
45
+ } else {
46
+ t5 = $[9];
47
+ }
48
+ const shared = t5;
49
+ if (field.type === "boolean") {
50
+ const t6 = draft === true;
51
+ let t7;
52
+ if ($[10] !== onChange) {
53
+ t7 = checked => onChange(checked === true);
54
+ $[10] = onChange;
55
+ $[11] = t7;
56
+ } else {
57
+ t7 = $[11];
58
+ }
59
+ let t8;
60
+ if ($[12] !== shared || $[13] !== t6 || $[14] !== t7) {
61
+ t8 = /*#__PURE__*/_jsx(Checkbox, {
62
+ ...shared,
63
+ checked: t6,
64
+ onCheckedChange: t7
65
+ });
66
+ $[12] = shared;
67
+ $[13] = t6;
68
+ $[14] = t7;
69
+ $[15] = t8;
70
+ } else {
71
+ t8 = $[15];
72
+ }
73
+ return t8;
74
+ }
75
+ const text = typeof draft === "string" ? draft : "";
76
+ if (field.type === "select") {
77
+ let t6;
78
+ if ($[16] !== onChange) {
79
+ t6 = event => onChange(event.target.value);
80
+ $[16] = onChange;
81
+ $[17] = t6;
82
+ } else {
83
+ t6 = $[17];
17
84
  }
18
- const text = typeof draft === "string" ? draft : "";
19
- if (field.type === "select") {
20
- return (_jsxs(NativeSelect, { ...shared, value: text, onChange: (event) => onChange(event.target.value), children: [_jsx(NativeSelectOption, { value: "", children: "Choose\u2026" }), (field.options ?? []).map((option) => (_jsx(NativeSelectOption, { value: option.value, children: option.label }, option.value)))] }));
85
+ let t7;
86
+ if ($[18] === Symbol.for("react.memo_cache_sentinel")) {
87
+ t7 = /*#__PURE__*/_jsx(NativeSelectOption, {
88
+ value: "",
89
+ children: "Choose\u2026"
90
+ });
91
+ $[18] = t7;
92
+ } else {
93
+ t7 = $[18];
21
94
  }
22
- return (_jsx(Input, { ...shared, type: field.type === "number" ? "number" : "text", inputMode: field.type === "number" ? "decimal" : undefined, min: field.min, max: field.max, value: text, onChange: (event) => onChange(event.target.value) }));
95
+ let t8;
96
+ if ($[19] !== field.options) {
97
+ t8 = field.options ?? [];
98
+ $[19] = field.options;
99
+ $[20] = t8;
100
+ } else {
101
+ t8 = $[20];
102
+ }
103
+ let t9;
104
+ if ($[21] !== t8) {
105
+ t9 = t8.map(_temp);
106
+ $[21] = t8;
107
+ $[22] = t9;
108
+ } else {
109
+ t9 = $[22];
110
+ }
111
+ let t10;
112
+ if ($[23] !== shared || $[24] !== t6 || $[25] !== t9 || $[26] !== text) {
113
+ t10 = /*#__PURE__*/_jsxs(NativeSelect, {
114
+ ...shared,
115
+ value: text,
116
+ onChange: t6,
117
+ children: [t7, t9]
118
+ });
119
+ $[23] = shared;
120
+ $[24] = t6;
121
+ $[25] = t9;
122
+ $[26] = text;
123
+ $[27] = t10;
124
+ } else {
125
+ t10 = $[27];
126
+ }
127
+ return t10;
128
+ }
129
+ const t6 = field.type === "number" ? "number" : "text";
130
+ const t7 = field.type === "number" ? "decimal" : undefined;
131
+ let t8;
132
+ if ($[28] !== onChange) {
133
+ t8 = event_0 => onChange(event_0.target.value);
134
+ $[28] = onChange;
135
+ $[29] = t8;
136
+ } else {
137
+ t8 = $[29];
138
+ }
139
+ let t9;
140
+ if ($[30] !== field.max || $[31] !== field.min || $[32] !== shared || $[33] !== t6 || $[34] !== t7 || $[35] !== t8 || $[36] !== text) {
141
+ t9 = /*#__PURE__*/_jsx(Input, {
142
+ ...shared,
143
+ type: t6,
144
+ inputMode: t7,
145
+ min: field.min,
146
+ max: field.max,
147
+ value: text,
148
+ onChange: t8
149
+ });
150
+ $[30] = field.max;
151
+ $[31] = field.min;
152
+ $[32] = shared;
153
+ $[33] = t6;
154
+ $[34] = t7;
155
+ $[35] = t8;
156
+ $[36] = text;
157
+ $[37] = t9;
158
+ } else {
159
+ t9 = $[37];
160
+ }
161
+ return t9;
162
+ }
163
+ function _temp(option) {
164
+ return /*#__PURE__*/_jsx(NativeSelectOption, {
165
+ value: option.value,
166
+ children: option.label
167
+ }, option.value);
23
168
  }
24
169
  export function ArgsField(props) {
25
- const { id, field, error } = props;
26
- const inline = field.type === "boolean";
27
- return (_jsxs("div", { "data-slot": "args-field", "data-type": field.type, className: "flex flex-col gap-1.5 [&_[data-slot=native-select-wrapper]]:w-full", children: [_jsxs("div", { className: inline ? "flex flex-row-reverse items-center justify-end gap-2" : "contents", children: [_jsxs(Label, { htmlFor: id, children: [field.label, field.required && (_jsx("span", { className: "text-xs font-normal text-muted-foreground", children: "required" }))] }), _jsx(FieldControl, { ...props })] }), field.description && (_jsx("p", { id: `${id}-hint`, className: "text-xs text-muted-foreground", children: field.description })), error && (_jsx("p", { id: `${id}-error`, className: "text-xs text-destructive", children: error }))] }));
170
+ const $ = _c(23);
171
+ const {
172
+ id,
173
+ field,
174
+ error
175
+ } = props;
176
+ const inline = field.type === "boolean";
177
+ const t0 = inline ? "flex flex-row-reverse items-center justify-end gap-2" : "contents";
178
+ let t1;
179
+ if ($[0] !== field.required) {
180
+ t1 = field.required && /*#__PURE__*/_jsx("span", {
181
+ className: "text-xs font-normal text-muted-foreground",
182
+ children: "required"
183
+ });
184
+ $[0] = field.required;
185
+ $[1] = t1;
186
+ } else {
187
+ t1 = $[1];
188
+ }
189
+ let t2;
190
+ if ($[2] !== field.label || $[3] !== id || $[4] !== t1) {
191
+ t2 = /*#__PURE__*/_jsxs(Label, {
192
+ htmlFor: id,
193
+ children: [field.label, t1]
194
+ });
195
+ $[2] = field.label;
196
+ $[3] = id;
197
+ $[4] = t1;
198
+ $[5] = t2;
199
+ } else {
200
+ t2 = $[5];
201
+ }
202
+ let t3;
203
+ if ($[6] !== props) {
204
+ t3 = /*#__PURE__*/_jsx(FieldControl, {
205
+ ...props
206
+ });
207
+ $[6] = props;
208
+ $[7] = t3;
209
+ } else {
210
+ t3 = $[7];
211
+ }
212
+ let t4;
213
+ if ($[8] !== t0 || $[9] !== t2 || $[10] !== t3) {
214
+ t4 = /*#__PURE__*/_jsxs("div", {
215
+ className: t0,
216
+ children: [t2, t3]
217
+ });
218
+ $[8] = t0;
219
+ $[9] = t2;
220
+ $[10] = t3;
221
+ $[11] = t4;
222
+ } else {
223
+ t4 = $[11];
224
+ }
225
+ let t5;
226
+ if ($[12] !== field.description || $[13] !== id) {
227
+ t5 = field.description && /*#__PURE__*/_jsx("p", {
228
+ id: `${id}-hint`,
229
+ className: "text-xs text-muted-foreground",
230
+ children: field.description
231
+ });
232
+ $[12] = field.description;
233
+ $[13] = id;
234
+ $[14] = t5;
235
+ } else {
236
+ t5 = $[14];
237
+ }
238
+ let t6;
239
+ if ($[15] !== error || $[16] !== id) {
240
+ t6 = error && /*#__PURE__*/_jsx("p", {
241
+ id: `${id}-error`,
242
+ className: "text-xs text-destructive",
243
+ children: error
244
+ });
245
+ $[15] = error;
246
+ $[16] = id;
247
+ $[17] = t6;
248
+ } else {
249
+ t6 = $[17];
250
+ }
251
+ let t7;
252
+ if ($[18] !== field.type || $[19] !== t4 || $[20] !== t5 || $[21] !== t6) {
253
+ t7 = /*#__PURE__*/_jsxs("div", {
254
+ "data-slot": "args-field",
255
+ "data-type": field.type,
256
+ className: "flex flex-col gap-1.5 [&_[data-slot=native-select-wrapper]]:w-full",
257
+ children: [t4, t5, t6]
258
+ });
259
+ $[18] = field.type;
260
+ $[19] = t4;
261
+ $[20] = t5;
262
+ $[21] = t6;
263
+ $[22] = t7;
264
+ } else {
265
+ t7 = $[22];
266
+ }
267
+ return t7;
28
268
  }
@@ -1,59 +1,50 @@
1
1
  export function draftsFrom(fields, initialValues) {
2
- return Object.fromEntries(fields.map((field) => {
3
- const initial = initialValues[field.name];
4
- if (field.type === "boolean")
5
- return [field.name, initial === true];
6
- return [field.name, initial === undefined ? "" : String(initial)];
7
- }));
2
+ return Object.fromEntries(fields.map(field => {
3
+ const initial = initialValues[field.name];
4
+ if (field.type === "boolean") return [field.name, initial === true];
5
+ return [field.name, initial === undefined ? "" : String(initial)];
6
+ }));
8
7
  }
9
8
  function numberError(field, draft) {
10
- const value = Number(draft);
11
- if (!Number.isFinite(value))
12
- return `${field.label} must be a number.`;
13
- if (field.min !== undefined && value < field.min) {
14
- return `${field.label} must be at least ${field.min}.`;
15
- }
16
- if (field.max !== undefined && value > field.max) {
17
- return `${field.label} must be at most ${field.max}.`;
18
- }
19
- return undefined;
9
+ const value = Number(draft);
10
+ if (!Number.isFinite(value)) return `${field.label} must be a number.`;
11
+ if (field.min !== undefined && value < field.min) {
12
+ return `${field.label} must be at least ${field.min}.`;
13
+ }
14
+ if (field.max !== undefined && value > field.max) {
15
+ return `${field.label} must be at most ${field.max}.`;
16
+ }
17
+ return undefined;
20
18
  }
21
19
  export function fieldError(field, draft) {
22
- if (field.type === "boolean")
23
- return undefined;
24
- const text = typeof draft === "string" ? draft.trim() : "";
25
- if (text === "")
26
- return field.required ? `${field.label} is required.` : undefined;
27
- if (field.type === "number")
28
- return numberError(field, text);
29
- if (field.type === "select" && !field.options?.some((option) => option.value === text)) {
30
- return `Choose one of the listed ${field.label.toLowerCase()} options.`;
31
- }
32
- return undefined;
20
+ if (field.type === "boolean") return undefined;
21
+ const text = typeof draft === "string" ? draft.trim() : "";
22
+ if (text === "") return field.required ? `${field.label} is required.` : undefined;
23
+ if (field.type === "number") return numberError(field, text);
24
+ if (field.type === "select" && !field.options?.some(option => option.value === text)) {
25
+ return `Choose one of the listed ${field.label.toLowerCase()} options.`;
26
+ }
27
+ return undefined;
33
28
  }
34
29
  export function validateDrafts(fields, drafts) {
35
- const errors = {};
36
- for (const field of fields) {
37
- const error = fieldError(field, drafts[field.name]);
38
- if (error)
39
- errors[field.name] = error;
40
- }
41
- return errors;
30
+ const errors = {};
31
+ for (const field of fields) {
32
+ const error = fieldError(field, drafts[field.name]);
33
+ if (error) errors[field.name] = error;
34
+ }
35
+ return errors;
42
36
  }
43
37
  function valueFromDraft(field, draft) {
44
- if (field.type === "boolean")
45
- return draft === true;
46
- const text = typeof draft === "string" ? draft.trim() : "";
47
- if (text === "")
48
- return undefined;
49
- return field.type === "number" ? Number(text) : text;
38
+ if (field.type === "boolean") return draft === true;
39
+ const text = typeof draft === "string" ? draft.trim() : "";
40
+ if (text === "") return undefined;
41
+ return field.type === "number" ? Number(text) : text;
50
42
  }
51
43
  export function valuesFromDrafts(fields, drafts) {
52
- const values = {};
53
- for (const field of fields) {
54
- const value = valueFromDraft(field, drafts[field.name]);
55
- if (value !== undefined)
56
- values[field.name] = value;
57
- }
58
- return values;
44
+ const values = {};
45
+ for (const field of fields) {
46
+ const value = valueFromDraft(field, drafts[field.name]);
47
+ if (value !== undefined) values[field.name] = value;
48
+ }
49
+ return values;
59
50
  }
@@ -1,15 +1,135 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { c as _c } from "react/compiler-runtime";
2
2
  import { Button, Label, Textarea } from "@locusgraph/components";
3
3
  import { useId, useState } from "react";
4
4
  import { PanelBody, PanelFooter } from "../../shared/panel.js";
5
5
  import { useFocusOnMount } from "../shared/use-focus-on-mount.js";
6
- export function DenyForm({ onDeny, onBack }) {
7
- const [reason, setReason] = useState("");
8
- const reasonId = useId();
9
- const reasonRef = useFocusOnMount(true);
10
- const trimmed = reason.trim();
11
- return (_jsxs("form", { "data-slot": "deny-form", onSubmit: (event) => {
12
- event.preventDefault();
13
- onDeny(trimmed === "" ? undefined : trimmed);
14
- }, children: [_jsxs(PanelBody, { className: "gap-2 pt-0", children: [_jsx(Label, { htmlFor: reasonId, className: "text-xs font-normal text-muted-foreground", children: "Reason for the agent (optional)" }), _jsx(Textarea, { id: reasonId, ref: reasonRef, value: reason, placeholder: "Tell the agent what to do instead", onChange: (event) => setReason(event.target.value) })] }), _jsxs(PanelFooter, { children: [_jsx(Button, { type: "button", variant: "ghost", size: "sm", onClick: onBack, children: "Back" }), _jsx(Button, { type: "submit", variant: "destructive", size: "sm", children: "Send denial" })] })] }));
6
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
7
+ export function DenyForm(t0) {
8
+ const $ = _c(24);
9
+ const {
10
+ onDeny,
11
+ onBack
12
+ } = t0;
13
+ const [reason, setReason] = useState("");
14
+ const reasonId = useId();
15
+ const reasonRef = useFocusOnMount(true);
16
+ let t1;
17
+ if ($[0] !== reason) {
18
+ t1 = reason.trim();
19
+ $[0] = reason;
20
+ $[1] = t1;
21
+ } else {
22
+ t1 = $[1];
23
+ }
24
+ const trimmed = t1;
25
+ let t2;
26
+ if ($[2] !== onDeny || $[3] !== trimmed) {
27
+ t2 = event => {
28
+ event.preventDefault();
29
+ onDeny(trimmed === "" ? undefined : trimmed);
30
+ };
31
+ $[2] = onDeny;
32
+ $[3] = trimmed;
33
+ $[4] = t2;
34
+ } else {
35
+ t2 = $[4];
36
+ }
37
+ let t3;
38
+ if ($[5] !== reasonId) {
39
+ t3 = /*#__PURE__*/_jsx(Label, {
40
+ htmlFor: reasonId,
41
+ className: "text-xs font-normal text-muted-foreground",
42
+ children: "Reason for the agent (optional)"
43
+ });
44
+ $[5] = reasonId;
45
+ $[6] = t3;
46
+ } else {
47
+ t3 = $[6];
48
+ }
49
+ let t4;
50
+ if ($[7] === Symbol.for("react.memo_cache_sentinel")) {
51
+ t4 = event_0 => setReason(event_0.target.value);
52
+ $[7] = t4;
53
+ } else {
54
+ t4 = $[7];
55
+ }
56
+ let t5;
57
+ if ($[8] !== reason || $[9] !== reasonId || $[10] !== reasonRef) {
58
+ t5 = /*#__PURE__*/_jsx(Textarea, {
59
+ id: reasonId,
60
+ ref: reasonRef,
61
+ value: reason,
62
+ placeholder: "Tell the agent what to do instead",
63
+ onChange: t4
64
+ });
65
+ $[8] = reason;
66
+ $[9] = reasonId;
67
+ $[10] = reasonRef;
68
+ $[11] = t5;
69
+ } else {
70
+ t5 = $[11];
71
+ }
72
+ let t6;
73
+ if ($[12] !== t3 || $[13] !== t5) {
74
+ t6 = /*#__PURE__*/_jsxs(PanelBody, {
75
+ className: "gap-2 pt-0",
76
+ children: [t3, t5]
77
+ });
78
+ $[12] = t3;
79
+ $[13] = t5;
80
+ $[14] = t6;
81
+ } else {
82
+ t6 = $[14];
83
+ }
84
+ let t7;
85
+ if ($[15] !== onBack) {
86
+ t7 = /*#__PURE__*/_jsx(Button, {
87
+ type: "button",
88
+ variant: "ghost",
89
+ size: "sm",
90
+ onClick: onBack,
91
+ children: "Back"
92
+ });
93
+ $[15] = onBack;
94
+ $[16] = t7;
95
+ } else {
96
+ t7 = $[16];
97
+ }
98
+ let t8;
99
+ if ($[17] === Symbol.for("react.memo_cache_sentinel")) {
100
+ t8 = /*#__PURE__*/_jsx(Button, {
101
+ type: "submit",
102
+ variant: "destructive",
103
+ size: "sm",
104
+ children: "Send denial"
105
+ });
106
+ $[17] = t8;
107
+ } else {
108
+ t8 = $[17];
109
+ }
110
+ let t9;
111
+ if ($[18] !== t7) {
112
+ t9 = /*#__PURE__*/_jsxs(PanelFooter, {
113
+ children: [t7, t8]
114
+ });
115
+ $[18] = t7;
116
+ $[19] = t9;
117
+ } else {
118
+ t9 = $[19];
119
+ }
120
+ let t10;
121
+ if ($[20] !== t2 || $[21] !== t6 || $[22] !== t9) {
122
+ t10 = /*#__PURE__*/_jsxs("form", {
123
+ "data-slot": "deny-form",
124
+ onSubmit: t2,
125
+ children: [t6, t9]
126
+ });
127
+ $[20] = t2;
128
+ $[21] = t6;
129
+ $[22] = t9;
130
+ $[23] = t10;
131
+ } else {
132
+ t10 = $[23];
133
+ }
134
+ return t10;
15
135
  }