@adecore/agents-react 0.35.5 → 0.37.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/chat/chat-client.d.ts +5 -0
- package/dist/chat/chat-client.js +91 -20
- package/dist/chat/index.d.ts +1 -0
- package/dist/chat/index.js +2 -1
- package/dist/chat/logic/picker-entries.js +11 -6
- package/dist/chat/logic/scrubber.d.ts +4 -2
- package/dist/chat/logic/scrubber.js +3 -3
- package/dist/chat/pending-prompts.d.ts +15 -0
- package/dist/chat/pending-prompts.js +93 -0
- package/dist/chat/reading-width.js +6 -2
- package/dist/chat/ui/Pickers.js +6 -3
- package/dist/chat/ui/PromptComposer.d.ts +2 -2
- package/dist/chat/ui/PromptComposer.js +92 -98
- package/dist/chat/ui/RunSettings.js +2 -2
- package/dist/chat/ui/SubagentTimeline.js +128 -182
- package/dist/chat/ui/Timeline.js +86 -60
- package/dist/chat/ui/code-lines.d.ts +5 -0
- package/dist/chat/ui/code-lines.js +37 -0
- package/dist/chat/ui/composer/ComposerControls.js +1 -1
- package/dist/chat/ui/composer/use-pending-requests.d.ts +2 -2
- package/dist/chat/ui/composer/use-pending-requests.js +29 -37
- package/dist/chat/ui/highlighter.d.ts +1 -1
- package/dist/chat/ui/highlighter.js +4 -2
- package/dist/chat/ui/rows/MessageRows.js +1 -1
- package/dist/locales/en/agent-chat.d.ts +1 -0
- package/dist/locales/en/agent-chat.js +1 -0
- package/dist/locales/nl/agent-chat.d.ts +1 -0
- package/dist/locales/nl/agent-chat.js +1 -0
- package/dist/prompts/logic/subjects.d.ts +5 -0
- package/dist/prompts/ui/PromptCard.js +1 -1
- package/dist/prompts/ui/PromptView.js +104 -95
- package/dist/state/chats.d.ts +4 -0
- package/dist/state/chats.js +84 -48
- package/dist/theme.css +1 -1
- package/package.json +8 -8
- package/src/chat/chat-client.ts +92 -21
- package/src/chat/index.ts +2 -0
- package/src/chat/logic/picker-entries.ts +6 -4
- package/src/chat/logic/scrubber.ts +8 -6
- package/src/chat/pending-prompts.ts +108 -0
- package/src/chat/reading-width.ts +9 -2
- package/src/chat/ui/Pickers.tsx +3 -6
- package/src/chat/ui/PromptComposer.tsx +10 -7
- package/src/chat/ui/RunSettings.tsx +2 -2
- package/src/chat/ui/SubagentTimeline.tsx +1 -24
- package/src/chat/ui/Timeline.tsx +66 -40
- package/src/chat/ui/code-lines.ts +37 -0
- package/src/chat/ui/composer/ComposerControls.tsx +1 -1
- package/src/chat/ui/composer/use-pending-requests.ts +13 -21
- package/src/chat/ui/highlighter.ts +4 -3
- package/src/chat/ui/rows/MessageRows.tsx +1 -1
- package/src/locales/en/agent-chat.ts +1 -0
- package/src/locales/nl/agent-chat.ts +1 -0
- package/src/prompts/logic/subjects.ts +4 -1
- package/src/prompts/ui/PromptCard.tsx +1 -1
- package/src/prompts/ui/PromptView.tsx +7 -1
- package/src/state/chats.ts +63 -18
- package/src/theme.css +1 -1
|
@@ -12,6 +12,7 @@ import { useChatHost } from '../../host.js';
|
|
|
12
12
|
import { useChatScope } from '../../scope.js';
|
|
13
13
|
import { useChatActions } from '../actions.js';
|
|
14
14
|
import { Button, Icon } from '@adecore/ui';
|
|
15
|
+
import { useProviders } from '../../state/providers.js';
|
|
15
16
|
import { useHostExtraPrompts } from '../../host-hooks.js';
|
|
16
17
|
/* The one being read stays in front; otherwise blocking before optional, oldest first, as everywhere else. */
|
|
17
18
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
@@ -19,7 +20,7 @@ function pickSubject(waiting, activeId) {
|
|
|
19
20
|
return waiting.find(subject => promptIdOf(subject) === activeId) ?? orderPrompts(waiting, isBlockingSubject, promptCreatedAt)[0] ?? null;
|
|
20
21
|
}
|
|
21
22
|
export function PromptComposer(t0) {
|
|
22
|
-
const $ = _c(
|
|
23
|
+
const $ = _c(64);
|
|
23
24
|
const {
|
|
24
25
|
chatId,
|
|
25
26
|
pending,
|
|
@@ -40,35 +41,24 @@ export function PromptComposer(t0) {
|
|
|
40
41
|
} = useChatScope();
|
|
41
42
|
const host = useChatHost();
|
|
42
43
|
const actions = useChatActions();
|
|
44
|
+
const providers = useProviders(_temp);
|
|
43
45
|
const elsewhere = onShowElsewhere !== undefined;
|
|
44
46
|
const extra = useHostExtraPrompts(id, chatId);
|
|
45
47
|
let t1;
|
|
46
48
|
if ($[0] !== chatId || $[1] !== extra || $[2] !== pending) {
|
|
47
49
|
let t2;
|
|
48
50
|
if ($[4] !== chatId) {
|
|
49
|
-
t2 =
|
|
50
|
-
kind: "
|
|
51
|
+
t2 = prompt => ({
|
|
52
|
+
kind: "host",
|
|
51
53
|
nodeId: chatId,
|
|
52
|
-
|
|
54
|
+
prompt
|
|
53
55
|
});
|
|
54
56
|
$[4] = chatId;
|
|
55
57
|
$[5] = t2;
|
|
56
58
|
} else {
|
|
57
59
|
t2 = $[5];
|
|
58
60
|
}
|
|
59
|
-
|
|
60
|
-
if ($[6] !== chatId) {
|
|
61
|
-
t3 = prompt => ({
|
|
62
|
-
kind: "host",
|
|
63
|
-
nodeId: chatId,
|
|
64
|
-
prompt
|
|
65
|
-
});
|
|
66
|
-
$[6] = chatId;
|
|
67
|
-
$[7] = t3;
|
|
68
|
-
} else {
|
|
69
|
-
t3 = $[7];
|
|
70
|
-
}
|
|
71
|
-
t1 = [...pending.map(t2), ...extra.map(t3)];
|
|
61
|
+
t1 = [...pending, ...extra.map(t2)];
|
|
72
62
|
$[0] = chatId;
|
|
73
63
|
$[1] = extra;
|
|
74
64
|
$[2] = pending;
|
|
@@ -78,18 +68,18 @@ export function PromptComposer(t0) {
|
|
|
78
68
|
}
|
|
79
69
|
const subjects = t1;
|
|
80
70
|
let t2;
|
|
81
|
-
if ($[
|
|
71
|
+
if ($[6] !== disabled || $[7] !== subjects) {
|
|
82
72
|
t2 = {
|
|
83
73
|
prompts: subjects,
|
|
84
74
|
idOf: promptIdOf,
|
|
85
75
|
pick: pickSubject,
|
|
86
76
|
disabled
|
|
87
77
|
};
|
|
88
|
-
$[
|
|
89
|
-
$[
|
|
90
|
-
$[
|
|
78
|
+
$[6] = disabled;
|
|
79
|
+
$[7] = subjects;
|
|
80
|
+
$[8] = t2;
|
|
91
81
|
} else {
|
|
92
|
-
t2 = $[
|
|
82
|
+
t2 = $[8];
|
|
93
83
|
}
|
|
94
84
|
const session = usePromptSession(t2);
|
|
95
85
|
const ref = useRef(null);
|
|
@@ -102,34 +92,34 @@ export function PromptComposer(t0) {
|
|
|
102
92
|
const expanded = !!active && !held;
|
|
103
93
|
const heldKey = useRef(null);
|
|
104
94
|
let t3;
|
|
105
|
-
if ($[
|
|
95
|
+
if ($[9] !== onAllAnswered) {
|
|
106
96
|
t3 = () => onAllAnswered?.();
|
|
107
|
-
$[
|
|
108
|
-
$[
|
|
97
|
+
$[9] = onAllAnswered;
|
|
98
|
+
$[10] = t3;
|
|
109
99
|
} else {
|
|
110
|
-
t3 = $[
|
|
100
|
+
t3 = $[10];
|
|
111
101
|
}
|
|
112
102
|
const refocus = useFocusAfterAnswer(activeKey, ref, t3);
|
|
113
103
|
let t4;
|
|
114
104
|
let t5;
|
|
115
|
-
if ($[
|
|
105
|
+
if ($[11] !== activeKey || $[12] !== held) {
|
|
116
106
|
t4 = () => {
|
|
117
107
|
if (held) {
|
|
118
108
|
heldKey.current = activeKey;
|
|
119
109
|
}
|
|
120
110
|
};
|
|
121
111
|
t5 = [held, activeKey];
|
|
122
|
-
$[
|
|
123
|
-
$[
|
|
124
|
-
$[
|
|
125
|
-
$[
|
|
112
|
+
$[11] = activeKey;
|
|
113
|
+
$[12] = held;
|
|
114
|
+
$[13] = t4;
|
|
115
|
+
$[14] = t5;
|
|
126
116
|
} else {
|
|
127
|
-
t4 = $[
|
|
128
|
-
t5 = $[
|
|
117
|
+
t4 = $[13];
|
|
118
|
+
t5 = $[14];
|
|
129
119
|
}
|
|
130
120
|
useEffect(t4, t5);
|
|
131
121
|
let t6;
|
|
132
|
-
if ($[
|
|
122
|
+
if ($[15] !== activeKey || $[16] !== elsewhere || $[17] !== expanded || $[18] !== focused || $[19] !== hasDraft || $[20] !== hold?.releasedBy) {
|
|
133
123
|
t6 = () => {
|
|
134
124
|
if (hold?.releasedBy === "blur" && heldKey.current === activeKey) {
|
|
135
125
|
return;
|
|
@@ -142,33 +132,33 @@ export function PromptComposer(t0) {
|
|
|
142
132
|
}
|
|
143
133
|
}
|
|
144
134
|
};
|
|
145
|
-
$[
|
|
146
|
-
$[
|
|
147
|
-
$[
|
|
148
|
-
$[
|
|
149
|
-
$[
|
|
150
|
-
$[
|
|
151
|
-
$[
|
|
135
|
+
$[15] = activeKey;
|
|
136
|
+
$[16] = elsewhere;
|
|
137
|
+
$[17] = expanded;
|
|
138
|
+
$[18] = focused;
|
|
139
|
+
$[19] = hasDraft;
|
|
140
|
+
$[20] = hold?.releasedBy;
|
|
141
|
+
$[21] = t6;
|
|
152
142
|
} else {
|
|
153
|
-
t6 = $[
|
|
143
|
+
t6 = $[21];
|
|
154
144
|
}
|
|
155
145
|
const t7 = hold?.releasedBy;
|
|
156
146
|
let t8;
|
|
157
|
-
if ($[
|
|
147
|
+
if ($[22] !== activeKey || $[23] !== elsewhere || $[24] !== expanded || $[25] !== focused || $[26] !== hasDraft || $[27] !== t7) {
|
|
158
148
|
t8 = [activeKey, expanded, focused, elsewhere, hasDraft, t7];
|
|
159
|
-
$[
|
|
160
|
-
$[
|
|
161
|
-
$[
|
|
162
|
-
$[
|
|
163
|
-
$[
|
|
164
|
-
$[
|
|
165
|
-
$[
|
|
149
|
+
$[22] = activeKey;
|
|
150
|
+
$[23] = elsewhere;
|
|
151
|
+
$[24] = expanded;
|
|
152
|
+
$[25] = focused;
|
|
153
|
+
$[26] = hasDraft;
|
|
154
|
+
$[27] = t7;
|
|
155
|
+
$[28] = t8;
|
|
166
156
|
} else {
|
|
167
|
-
t8 = $[
|
|
157
|
+
t8 = $[28];
|
|
168
158
|
}
|
|
169
159
|
useEffect(t6, t8);
|
|
170
160
|
let t9;
|
|
171
|
-
if ($[
|
|
161
|
+
if ($[29] !== active || $[30] !== asksApproval || $[31] !== elsewhere || $[32] !== onShowElsewhere || $[33] !== t) {
|
|
172
162
|
t9 = active && elsewhere && /*#__PURE__*/_jsxs("button", {
|
|
173
163
|
type: "button",
|
|
174
164
|
className: "flex w-full items-center gap-2 px-3.5 py-3 text-left text-sm text-text-muted hover:text-text",
|
|
@@ -186,17 +176,17 @@ export function PromptComposer(t0) {
|
|
|
186
176
|
className: "shrink-0"
|
|
187
177
|
})]
|
|
188
178
|
});
|
|
189
|
-
$[
|
|
190
|
-
$[
|
|
191
|
-
$[
|
|
192
|
-
$[
|
|
193
|
-
$[
|
|
194
|
-
$[
|
|
179
|
+
$[29] = active;
|
|
180
|
+
$[30] = asksApproval;
|
|
181
|
+
$[31] = elsewhere;
|
|
182
|
+
$[32] = onShowElsewhere;
|
|
183
|
+
$[33] = t;
|
|
184
|
+
$[34] = t9;
|
|
195
185
|
} else {
|
|
196
|
-
t9 = $[
|
|
186
|
+
t9 = $[34];
|
|
197
187
|
}
|
|
198
188
|
let t10;
|
|
199
|
-
if ($[
|
|
189
|
+
if ($[35] !== actions || $[36] !== active || $[37] !== activeKey || $[38] !== denyReason || $[39] !== disabled || $[40] !== elsewhere || $[41] !== expanded || $[42] !== hasDraft || $[43] !== host || $[44] !== providers || $[45] !== refocus || $[46] !== session) {
|
|
200
190
|
t10 = active && !elsewhere && /*#__PURE__*/_jsx("div", {
|
|
201
191
|
hidden: !expanded,
|
|
202
192
|
children: /*#__PURE__*/_jsx(PromptView, {
|
|
@@ -213,29 +203,30 @@ export function PromptComposer(t0) {
|
|
|
213
203
|
},
|
|
214
204
|
more: session.waiting.length - 1,
|
|
215
205
|
hasDraft: hasDraft,
|
|
216
|
-
denyReason: denyReason,
|
|
206
|
+
denyReason: active.kind === "chat" && active.source?.provider !== undefined ? providers.find(provider => provider.kind === active.source?.provider)?.capabilities.denyReason === true : denyReason,
|
|
217
207
|
disabled: disabled,
|
|
218
208
|
sending: session.sending,
|
|
219
209
|
error: session.errorOf(promptIdOf(active))
|
|
220
210
|
}, activeKey)
|
|
221
211
|
});
|
|
222
|
-
$[
|
|
223
|
-
$[
|
|
224
|
-
$[
|
|
225
|
-
$[
|
|
226
|
-
$[
|
|
227
|
-
$[
|
|
228
|
-
$[
|
|
229
|
-
$[
|
|
230
|
-
$[
|
|
231
|
-
$[
|
|
232
|
-
$[
|
|
233
|
-
$[
|
|
212
|
+
$[35] = actions;
|
|
213
|
+
$[36] = active;
|
|
214
|
+
$[37] = activeKey;
|
|
215
|
+
$[38] = denyReason;
|
|
216
|
+
$[39] = disabled;
|
|
217
|
+
$[40] = elsewhere;
|
|
218
|
+
$[41] = expanded;
|
|
219
|
+
$[42] = hasDraft;
|
|
220
|
+
$[43] = host;
|
|
221
|
+
$[44] = providers;
|
|
222
|
+
$[45] = refocus;
|
|
223
|
+
$[46] = session;
|
|
224
|
+
$[47] = t10;
|
|
234
225
|
} else {
|
|
235
|
-
t10 = $[
|
|
226
|
+
t10 = $[47];
|
|
236
227
|
}
|
|
237
228
|
let t11;
|
|
238
|
-
if ($[
|
|
229
|
+
if ($[48] !== active || $[49] !== asksApproval || $[50] !== held || $[51] !== hold || $[52] !== t) {
|
|
239
230
|
t11 = held && active && /*#__PURE__*/_jsxs("div", {
|
|
240
231
|
role: "status",
|
|
241
232
|
className: "flex items-center gap-2 border-b border-border px-3.5 py-2.5",
|
|
@@ -248,52 +239,55 @@ export function PromptComposer(t0) {
|
|
|
248
239
|
children: t(asksApproval ? "composer.held.approval" : "composer.held.question")
|
|
249
240
|
}), /*#__PURE__*/_jsx(Button, {
|
|
250
241
|
size: "sm",
|
|
251
|
-
onMouseDown:
|
|
242
|
+
onMouseDown: _temp2,
|
|
252
243
|
onClick: () => hold?.release("show"),
|
|
253
244
|
children: t("composer.held.show")
|
|
254
245
|
})]
|
|
255
246
|
});
|
|
256
|
-
$[
|
|
257
|
-
$[
|
|
258
|
-
$[
|
|
259
|
-
$[
|
|
260
|
-
$[
|
|
261
|
-
$[
|
|
247
|
+
$[48] = active;
|
|
248
|
+
$[49] = asksApproval;
|
|
249
|
+
$[50] = held;
|
|
250
|
+
$[51] = hold;
|
|
251
|
+
$[52] = t;
|
|
252
|
+
$[53] = t11;
|
|
262
253
|
} else {
|
|
263
|
-
t11 = $[
|
|
254
|
+
t11 = $[53];
|
|
264
255
|
}
|
|
265
256
|
let t12;
|
|
266
|
-
if ($[
|
|
257
|
+
if ($[54] !== children || $[55] !== expanded) {
|
|
267
258
|
t12 = /*#__PURE__*/_jsx("div", {
|
|
268
259
|
hidden: expanded,
|
|
269
260
|
children: children
|
|
270
261
|
});
|
|
271
|
-
$[
|
|
272
|
-
$[
|
|
273
|
-
$[
|
|
262
|
+
$[54] = children;
|
|
263
|
+
$[55] = expanded;
|
|
264
|
+
$[56] = t12;
|
|
274
265
|
} else {
|
|
275
|
-
t12 = $[
|
|
266
|
+
t12 = $[56];
|
|
276
267
|
}
|
|
277
268
|
let t13;
|
|
278
|
-
if ($[
|
|
269
|
+
if ($[57] !== session.onClickCapture || $[58] !== session.onPointerDownCapture || $[59] !== t10 || $[60] !== t11 || $[61] !== t12 || $[62] !== t9) {
|
|
279
270
|
t13 = /*#__PURE__*/_jsxs("div", {
|
|
280
271
|
ref: ref,
|
|
281
272
|
onPointerDownCapture: session.onPointerDownCapture,
|
|
282
273
|
onClickCapture: session.onClickCapture,
|
|
283
274
|
children: [t9, t10, t11, t12]
|
|
284
275
|
});
|
|
285
|
-
$[
|
|
286
|
-
$[
|
|
287
|
-
$[
|
|
288
|
-
$[
|
|
289
|
-
$[
|
|
290
|
-
$[
|
|
291
|
-
$[
|
|
276
|
+
$[57] = session.onClickCapture;
|
|
277
|
+
$[58] = session.onPointerDownCapture;
|
|
278
|
+
$[59] = t10;
|
|
279
|
+
$[60] = t11;
|
|
280
|
+
$[61] = t12;
|
|
281
|
+
$[62] = t9;
|
|
282
|
+
$[63] = t13;
|
|
292
283
|
} else {
|
|
293
|
-
t13 = $[
|
|
284
|
+
t13 = $[63];
|
|
294
285
|
}
|
|
295
286
|
return t13;
|
|
296
287
|
}
|
|
297
|
-
function
|
|
288
|
+
function _temp2(e) {
|
|
298
289
|
return e.preventDefault();
|
|
290
|
+
}
|
|
291
|
+
function _temp(row) {
|
|
292
|
+
return row.providers;
|
|
299
293
|
}
|
|
@@ -422,7 +422,7 @@ export function RunSettings(t0) {
|
|
|
422
422
|
} else {
|
|
423
423
|
t19 = $[56];
|
|
424
424
|
}
|
|
425
|
-
const t20 = open ? "border-accent bg-accent-soft" : "border-border hover:bg-surface-hover";
|
|
425
|
+
const t20 = open ? "border-accent bg-accent-soft" : "border-border hover:bg-surface-hover-edged";
|
|
426
426
|
let t21;
|
|
427
427
|
if ($[57] !== t20) {
|
|
428
428
|
t21 = clsx("flex h-8 min-w-0 items-center gap-2 rounded-full border pr-3 pl-2.5 text-xs whitespace-nowrap text-text-muted @max-xl/composer:gap-1.5 @max-sm/composer:pr-2.5", t20);
|
|
@@ -1611,7 +1611,7 @@ function OptionRow(t0) {
|
|
|
1611
1611
|
value: value,
|
|
1612
1612
|
onValueChange: t4,
|
|
1613
1613
|
"aria-label": t5,
|
|
1614
|
-
className: "flex gap-0.5 rounded-md bg-surface-sunken p-0.5",
|
|
1614
|
+
className: "flex gap-0.5 rounded-md bg-surface-sunken p-0.5 dark:bg-surface-idle",
|
|
1615
1615
|
children: t6
|
|
1616
1616
|
});
|
|
1617
1617
|
$[45] = option.label;
|