@adecore/agents-react 0.36.0 → 0.37.1

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 (56) hide show
  1. package/dist/agents/provider-paths.js +3 -1
  2. package/dist/chat/chat-client.d.ts +5 -0
  3. package/dist/chat/chat-client.js +91 -20
  4. package/dist/chat/index.d.ts +1 -0
  5. package/dist/chat/index.js +2 -1
  6. package/dist/chat/logic/picker-entries.js +11 -6
  7. package/dist/chat/logic/scrubber.d.ts +4 -2
  8. package/dist/chat/logic/scrubber.js +3 -3
  9. package/dist/chat/pending-prompts.d.ts +15 -0
  10. package/dist/chat/pending-prompts.js +93 -0
  11. package/dist/chat/reading-width.js +6 -2
  12. package/dist/chat/ui/PromptComposer.d.ts +2 -2
  13. package/dist/chat/ui/PromptComposer.js +92 -98
  14. package/dist/chat/ui/SubagentTimeline.js +128 -182
  15. package/dist/chat/ui/Timeline.js +86 -60
  16. package/dist/chat/ui/code-lines.d.ts +5 -0
  17. package/dist/chat/ui/code-lines.js +37 -0
  18. package/dist/chat/ui/composer/use-pending-requests.d.ts +2 -2
  19. package/dist/chat/ui/composer/use-pending-requests.js +29 -37
  20. package/dist/chat/ui/highlighter.d.ts +1 -1
  21. package/dist/chat/ui/highlighter.js +4 -2
  22. package/dist/locales/en/agent-chat.d.ts +1 -0
  23. package/dist/locales/en/agent-chat.js +1 -0
  24. package/dist/locales/nl/agent-chat.d.ts +1 -0
  25. package/dist/locales/nl/agent-chat.js +1 -0
  26. package/dist/prompts/logic/subjects.d.ts +5 -0
  27. package/dist/prompts/ui/PromptCard.js +1 -1
  28. package/dist/prompts/ui/PromptView.js +104 -95
  29. package/dist/providers/parts.js +2 -1
  30. package/dist/state/chats.d.ts +4 -0
  31. package/dist/state/chats.js +84 -48
  32. package/dist/theme.css +6 -2
  33. package/dist/usage/format.js +4 -2
  34. package/package.json +8 -8
  35. package/src/agents/provider-paths.ts +5 -1
  36. package/src/chat/chat-client.ts +92 -21
  37. package/src/chat/index.ts +2 -0
  38. package/src/chat/logic/picker-entries.ts +6 -4
  39. package/src/chat/logic/scrubber.ts +8 -6
  40. package/src/chat/pending-prompts.ts +108 -0
  41. package/src/chat/reading-width.ts +9 -2
  42. package/src/chat/ui/PromptComposer.tsx +10 -7
  43. package/src/chat/ui/SubagentTimeline.tsx +1 -24
  44. package/src/chat/ui/Timeline.tsx +66 -40
  45. package/src/chat/ui/code-lines.ts +37 -0
  46. package/src/chat/ui/composer/use-pending-requests.ts +13 -21
  47. package/src/chat/ui/highlighter.ts +4 -3
  48. package/src/locales/en/agent-chat.ts +1 -0
  49. package/src/locales/nl/agent-chat.ts +1 -0
  50. package/src/prompts/logic/subjects.ts +4 -1
  51. package/src/prompts/ui/PromptCard.tsx +1 -1
  52. package/src/prompts/ui/PromptView.tsx +7 -1
  53. package/src/providers/parts.tsx +2 -1
  54. package/src/state/chats.ts +63 -18
  55. package/src/theme.css +6 -2
  56. package/src/usage/format.ts +4 -2
@@ -1,5 +1,5 @@
1
1
  import { c as _c } from "react/compiler-runtime";
2
- import { useCallback, useEffect, useLayoutEffect, useRef, useState, useSyncExternalStore } from 'react';
2
+ import { useCallback, useEffect, useLayoutEffect, useRef, useState } from 'react';
3
3
  import { useTranslation } from 'react-i18next';
4
4
  import { Bot, LoaderCircle } from 'lucide-react';
5
5
  import { deriveTimelineRows } from '../logic/timeline.js';
@@ -10,8 +10,6 @@ import { EMPTY_TARGET, readTimelineTarget } from '../logic/timeline-target.js';
10
10
  import { openBelow, useSubagentTrail } from '../subagent-view.js';
11
11
  import { Row } from './rows/Rows.js';
12
12
  import { ReplyContext } from './reply-context.js';
13
- import { PromptComposer } from './PromptComposer.js';
14
- import { useProviders } from '../../state/providers.js';
15
13
  import { SubagentInfo } from './SubagentInfo.js';
16
14
  import { TimelineMenuPopup } from './TimelineMenu.js';
17
15
  import { FOLLOW_THRESHOLD_PX, rowRhythm } from './rows/row-rhythm.js';
@@ -30,7 +28,7 @@ const NO_TURNS = new Set();
30
28
  * stands in the chat's own place, read-only, and a sub-agent it opened goes one level further down.
31
29
  */
32
30
  export function SubagentTimeline(t0) {
33
- const $ = _c(56);
31
+ const $ = _c(44);
34
32
  const {
35
33
  chatId,
36
34
  toolUseId
@@ -42,60 +40,34 @@ export function SubagentTimeline(t0) {
42
40
  const {
43
41
  commandLooks
44
42
  } = useChatHost();
45
- let t1;
46
- if ($[0] !== scope.transport) {
47
- t1 = changed => scope.transport.subscribeStatus(changed);
48
- $[0] = scope.transport;
49
- $[1] = t1;
50
- } else {
51
- t1 = $[1];
52
- }
53
- let t2;
54
- if ($[2] !== scope.transport.status) {
55
- t2 = () => scope.transport.status === "open";
56
- $[2] = scope.transport.status;
57
- $[3] = t2;
58
- } else {
59
- t2 = $[3];
60
- }
61
- const connected = useSyncExternalStore(t1, t2, _temp);
62
43
  const {
63
44
  trail,
64
45
  show
65
46
  } = useSubagentTrail(chatId);
66
47
  const [state, setState] = useState(INITIAL_CONVERSATION);
67
- let t3;
68
- if ($[4] !== state.context?.provider) {
69
- t3 = row => row.providers.find(provider => provider.kind === state.context?.provider)?.capabilities.denyReason === true;
70
- $[4] = state.context?.provider;
71
- $[5] = t3;
72
- } else {
73
- t3 = $[5];
74
- }
75
- const denyReason = useProviders(t3);
76
48
  const controller = useRef(null);
77
49
  const scrollRef = useRef(null);
78
50
  const threadRef = useRef(null);
79
51
  const [target, setTarget] = useState(EMPTY_TARGET);
80
52
  const followRef = useRef(true);
81
- let t4;
82
- if ($[6] === Symbol.for("react.memo_cache_sentinel")) {
83
- t4 = () => {
53
+ let t1;
54
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
55
+ t1 = () => {
84
56
  followRef.current = false;
85
57
  };
86
- $[6] = t4;
58
+ $[0] = t1;
87
59
  } else {
88
- t4 = $[6];
60
+ t1 = $[0];
89
61
  }
90
- const stopFollowing = t4;
62
+ const stopFollowing = t1;
91
63
  const groups = useToggleSet(stopFollowing);
92
64
  const subagents = useToggleSet(stopFollowing);
93
65
  const anchorRef = useRef(null);
94
66
  const headRef = useRef(undefined);
95
- const cwd = useChatRow(chatId, _temp2);
96
- let t5;
97
- if ($[7] !== chatId || $[8] !== scope.transport || $[9] !== toolUseId) {
98
- t5 = () => {
67
+ const cwd = useChatRow(chatId, _temp);
68
+ let t2;
69
+ if ($[1] !== chatId || $[2] !== scope.transport || $[3] !== toolUseId) {
70
+ t2 = () => {
99
71
  const conversation = new SubagentConversation(scope.transport, chatId, toolUseId, setState);
100
72
  controller.current = conversation;
101
73
  conversation.start();
@@ -104,47 +76,47 @@ export function SubagentTimeline(t0) {
104
76
  controller.current = null;
105
77
  };
106
78
  };
107
- $[7] = chatId;
108
- $[8] = scope.transport;
109
- $[9] = toolUseId;
110
- $[10] = t5;
79
+ $[1] = chatId;
80
+ $[2] = scope.transport;
81
+ $[3] = toolUseId;
82
+ $[4] = t2;
111
83
  } else {
112
- t5 = $[10];
84
+ t2 = $[4];
113
85
  }
114
- let t6;
115
- if ($[11] !== chatId || $[12] !== scope || $[13] !== toolUseId) {
116
- t6 = [scope, chatId, toolUseId];
117
- $[11] = chatId;
118
- $[12] = scope;
119
- $[13] = toolUseId;
120
- $[14] = t6;
86
+ let t3;
87
+ if ($[5] !== chatId || $[6] !== scope || $[7] !== toolUseId) {
88
+ t3 = [scope, chatId, toolUseId];
89
+ $[5] = chatId;
90
+ $[6] = scope;
91
+ $[7] = toolUseId;
92
+ $[8] = t3;
121
93
  } else {
122
- t6 = $[14];
94
+ t3 = $[8];
123
95
  }
124
- useEffect(t5, t6);
125
- let t7;
126
- if ($[15] !== scope.id || $[16] !== state.unsupported) {
127
- t7 = () => {
96
+ useEffect(t2, t3);
97
+ let t4;
98
+ if ($[9] !== scope.id || $[10] !== state.unsupported) {
99
+ t4 = () => {
128
100
  if (state.unsupported) {
129
101
  useSubagentSupport.getState().markUnsupported(scope.id);
130
102
  }
131
103
  };
132
- $[15] = scope.id;
133
- $[16] = state.unsupported;
134
- $[17] = t7;
104
+ $[9] = scope.id;
105
+ $[10] = state.unsupported;
106
+ $[11] = t4;
135
107
  } else {
136
- t7 = $[17];
108
+ t4 = $[11];
137
109
  }
138
- let t8;
139
- if ($[18] !== scope || $[19] !== state.unsupported) {
140
- t8 = [state.unsupported, scope];
141
- $[18] = scope;
142
- $[19] = state.unsupported;
143
- $[20] = t8;
110
+ let t5;
111
+ if ($[12] !== scope || $[13] !== state.unsupported) {
112
+ t5 = [state.unsupported, scope];
113
+ $[12] = scope;
114
+ $[13] = state.unsupported;
115
+ $[14] = t5;
144
116
  } else {
145
- t8 = $[20];
117
+ t5 = $[14];
146
118
  }
147
- useEffect(t7, t8);
119
+ useEffect(t4, t5);
148
120
  const rows = deriveTimelineRows(state.items, {
149
121
  expandedGroups: groups.ids,
150
122
  expandedTurns: NO_TURNS,
@@ -152,9 +124,9 @@ export function SubagentTimeline(t0) {
152
124
  activeTurnId: null,
153
125
  commandLooks
154
126
  });
155
- let t9;
156
- if ($[21] !== state.items) {
157
- t9 = () => {
127
+ let t6;
128
+ if ($[15] !== state.items) {
129
+ t6 = () => {
158
130
  const element = scrollRef.current;
159
131
  if (element === null) {
160
132
  return;
@@ -173,15 +145,15 @@ export function SubagentTimeline(t0) {
173
145
  anchorRef.current = null;
174
146
  }
175
147
  };
176
- $[21] = state.items;
177
- $[22] = t9;
148
+ $[15] = state.items;
149
+ $[16] = t6;
178
150
  } else {
179
- t9 = $[22];
151
+ t6 = $[16];
180
152
  }
181
- useLayoutEffect(t9, [rows, state.live, state.items]);
182
- let t10;
183
- if ($[23] !== state.cursor) {
184
- t10 = () => {
153
+ useLayoutEffect(t6, [rows, state.live, state.items]);
154
+ let t7;
155
+ if ($[17] !== state.cursor) {
156
+ t7 = () => {
185
157
  const element_0 = scrollRef.current;
186
158
  if (element_0 === null || state.cursor === null || !wantsEarlier(element_0)) {
187
159
  return;
@@ -189,87 +161,87 @@ export function SubagentTimeline(t0) {
189
161
  anchorRef.current = firstRowInView(element_0);
190
162
  controller.current?.loadEarlier();
191
163
  };
192
- $[23] = state.cursor;
193
- $[24] = t10;
164
+ $[17] = state.cursor;
165
+ $[18] = t7;
194
166
  } else {
195
- t10 = $[24];
167
+ t7 = $[18];
196
168
  }
197
- const loadEarlier = t10;
198
- let t11;
199
- if ($[25] !== loadEarlier || $[26] !== state.status) {
200
- t11 = () => {
169
+ const loadEarlier = t7;
170
+ let t8;
171
+ if ($[19] !== loadEarlier || $[20] !== state.status) {
172
+ t8 = () => {
201
173
  if (state.status === "ready") {
202
174
  loadEarlier();
203
175
  }
204
176
  };
205
- $[25] = loadEarlier;
206
- $[26] = state.status;
207
- $[27] = t11;
177
+ $[19] = loadEarlier;
178
+ $[20] = state.status;
179
+ $[21] = t8;
208
180
  } else {
209
- t11 = $[27];
181
+ t8 = $[21];
210
182
  }
211
- useEffect(t11, [rows, state.status, loadEarlier]);
212
- const readingWidth = useChatPreferences(_temp3);
213
- let t12;
214
- if ($[28] !== show || $[29] !== trail) {
215
- t12 = step => {
183
+ useEffect(t8, [rows, state.status, loadEarlier]);
184
+ const readingWidth = useChatPreferences(_temp2);
185
+ let t9;
186
+ if ($[22] !== show || $[23] !== trail) {
187
+ t9 = step => {
216
188
  show(openBelow(trail, step));
217
189
  };
218
- $[28] = show;
219
- $[29] = trail;
220
- $[30] = t12;
190
+ $[22] = show;
191
+ $[23] = trail;
192
+ $[24] = t9;
221
193
  } else {
222
- t12 = $[30];
194
+ t9 = $[24];
223
195
  }
224
- const openChild = t12;
225
- const t13 = "flex h-full min-h-0 flex-col";
226
- let t14;
227
- if ($[31] !== readingWidth) {
228
- t14 = readingWidthStyle(readingWidth);
229
- $[31] = readingWidth;
230
- $[32] = t14;
196
+ const openChild = t9;
197
+ const t10 = "flex h-full min-h-0 flex-col";
198
+ let t11;
199
+ if ($[25] !== readingWidth) {
200
+ t11 = readingWidthStyle(readingWidth);
201
+ $[25] = readingWidth;
202
+ $[26] = t11;
231
203
  } else {
232
- t14 = $[32];
204
+ t11 = $[26];
233
205
  }
234
- let t15;
235
- if ($[33] !== chatId || $[34] !== toolUseId) {
236
- t15 = /*#__PURE__*/_jsx(SubagentInfo, {
206
+ let t12;
207
+ if ($[27] !== chatId || $[28] !== toolUseId) {
208
+ t12 = /*#__PURE__*/_jsx(SubagentInfo, {
237
209
  chatId: chatId,
238
210
  toolUseId: toolUseId
239
211
  });
240
- $[33] = chatId;
241
- $[34] = toolUseId;
242
- $[35] = t15;
212
+ $[27] = chatId;
213
+ $[28] = toolUseId;
214
+ $[29] = t12;
243
215
  } else {
244
- t15 = $[35];
216
+ t12 = $[29];
245
217
  }
246
- let t16;
247
- if ($[36] !== state.status || $[37] !== t) {
248
- t16 = state.status === "loading" && /*#__PURE__*/_jsx("div", {
218
+ let t13;
219
+ if ($[30] !== state.status || $[31] !== t) {
220
+ t13 = state.status === "loading" && /*#__PURE__*/_jsx("div", {
249
221
  className: "chat-column-content px-4 pt-4 text-xs text-text-faint",
250
222
  children: t("subagents.loading")
251
223
  });
252
- $[36] = state.status;
253
- $[37] = t;
254
- $[38] = t16;
224
+ $[30] = state.status;
225
+ $[31] = t;
226
+ $[32] = t13;
255
227
  } else {
256
- t16 = $[38];
228
+ t13 = $[32];
257
229
  }
258
- let t17;
259
- if ($[39] !== state.error || $[40] !== state.status || $[41] !== state.unsupported || $[42] !== t) {
260
- t17 = state.status === "failed" && /*#__PURE__*/_jsx(EmptyState, {
230
+ let t14;
231
+ if ($[33] !== state.error || $[34] !== state.status || $[35] !== state.unsupported || $[36] !== t) {
232
+ t14 = state.status === "failed" && /*#__PURE__*/_jsx(EmptyState, {
261
233
  icon: Bot,
262
234
  children: state.unsupported ? t("subagents.unsupported") : state.error ?? t("subagents.unreadable")
263
235
  });
264
- $[39] = state.error;
265
- $[40] = state.status;
266
- $[41] = state.unsupported;
267
- $[42] = t;
268
- $[43] = t17;
236
+ $[33] = state.error;
237
+ $[34] = state.status;
238
+ $[35] = state.unsupported;
239
+ $[36] = t;
240
+ $[37] = t14;
269
241
  } else {
270
- t17 = $[43];
242
+ t14 = $[37];
271
243
  }
272
- const t18 = state.status === "ready" && /*#__PURE__*/_jsx(FileLinkContext.Provider, {
244
+ const t15 = state.status === "ready" && /*#__PURE__*/_jsx(FileLinkContext.Provider, {
273
245
  value: state.context?.cwd ?? cwd,
274
246
  children: /*#__PURE__*/_jsx(ReplyContext.Provider, {
275
247
  value: state.context ?? {
@@ -307,21 +279,21 @@ export function SubagentTimeline(t0) {
307
279
  }), rows.length === 0 && !state.live && /*#__PURE__*/_jsx(EmptyState, {
308
280
  icon: Bot,
309
281
  children: t("rows.subagent.nothingYet")
310
- }), rows.map((row_1, index) => {
282
+ }), rows.map((row_0, index) => {
311
283
  const previous = index > 0 ? rows[index - 1] : null;
312
284
  return /*#__PURE__*/_jsx("div", {
313
- "data-item-id": row_1.id,
314
- className: rowRhythm(row_1, previous),
285
+ "data-item-id": row_0.id,
286
+ className: rowRhythm(row_0, previous),
315
287
  children: /*#__PURE__*/_jsx(Row, {
316
- row: row_1,
288
+ row: row_0,
317
289
  chatId: chatId,
318
290
  toggleGroup: groups.toggle,
319
- toggleTurn: _temp4,
291
+ toggleTurn: _temp3,
320
292
  toggleSubagent: subagents.toggle,
321
- openSubagent: _temp5,
293
+ openSubagent: _temp4,
322
294
  openConversation: openChild
323
295
  })
324
- }, row_1.id);
296
+ }, row_0.id);
325
297
  }), state.live && /*#__PURE__*/_jsx("div", {
326
298
  className: "chat-live-text pt-1 text-xs",
327
299
  children: t("subagents.working")
@@ -334,55 +306,29 @@ export function SubagentTimeline(t0) {
334
306
  })
335
307
  })
336
308
  });
337
- let t19;
338
- if ($[44] !== connected || $[45] !== denyReason || $[46] !== state.context || $[47] !== state.pending) {
339
- t19 = state.context?.chatId !== undefined && state.pending.length > 0 && /*#__PURE__*/_jsx("div", {
340
- className: "chat-column-content shrink-0",
341
- children: /*#__PURE__*/_jsx(PromptComposer, {
342
- chatId: state.context.chatId,
343
- pending: state.pending,
344
- focused: false,
345
- disabled: !connected,
346
- hasDraft: false,
347
- denyReason: denyReason,
348
- children: null
349
- }, state.context.chatId)
350
- });
351
- $[44] = connected;
352
- $[45] = denyReason;
353
- $[46] = state.context;
354
- $[47] = state.pending;
355
- $[48] = t19;
356
- } else {
357
- t19 = $[48];
358
- }
359
- let t20;
360
- if ($[49] !== t14 || $[50] !== t15 || $[51] !== t16 || $[52] !== t17 || $[53] !== t18 || $[54] !== t19) {
361
- t20 = /*#__PURE__*/_jsxs("div", {
362
- className: t13,
363
- style: t14,
364
- children: [t15, t16, t17, t18, t19]
309
+ let t16;
310
+ if ($[38] !== t11 || $[39] !== t12 || $[40] !== t13 || $[41] !== t14 || $[42] !== t15) {
311
+ t16 = /*#__PURE__*/_jsxs("div", {
312
+ className: t10,
313
+ style: t11,
314
+ children: [t12, t13, t14, t15]
365
315
  });
366
- $[49] = t14;
367
- $[50] = t15;
368
- $[51] = t16;
369
- $[52] = t17;
370
- $[53] = t18;
371
- $[54] = t19;
372
- $[55] = t20;
316
+ $[38] = t11;
317
+ $[39] = t12;
318
+ $[40] = t13;
319
+ $[41] = t14;
320
+ $[42] = t15;
321
+ $[43] = t16;
373
322
  } else {
374
- t20 = $[55];
323
+ t16 = $[43];
375
324
  }
376
- return t20;
325
+ return t16;
377
326
  }
378
- function _temp5() {}
379
327
  function _temp4() {}
380
- function _temp3(preferences) {
328
+ function _temp3() {}
329
+ function _temp2(preferences) {
381
330
  return preferences.readingWidth;
382
331
  }
383
- function _temp2(row_0) {
384
- return row_0?.info.cwd ?? null;
385
- }
386
- function _temp() {
387
- return false;
332
+ function _temp(row) {
333
+ return row?.info.cwd ?? null;
388
334
  }