@adecore/agents-react 0.40.2 → 0.40.3

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.
@@ -1,5 +1,5 @@
1
1
  import { type Ref } from 'react';
2
- import type { ChatInfo } from '@adecore/agent-contracts';
2
+ import { type ChatInfo } from '@adecore/agent-contracts';
3
3
  import { type Shortcut } from '@adecore/ui';
4
4
  import { type ComposerSendAction, type ComposerSendDraft } from '../../../host.js';
5
5
  import type { StashedPrompt } from '../../stash.js';
@@ -3,6 +3,7 @@ import { useRef, useState } from 'react';
3
3
  import { useTranslation } from 'react-i18next';
4
4
  import clsx from 'clsx';
5
5
  import { ArrowUp, ChevronDown, Play, Plus, Square } from 'lucide-react';
6
+ import { holdsConversation } from '@adecore/agent-contracts';
6
7
  import { Button, ErrorBoundary, Icon, Menu, Tooltip } from '@adecore/ui';
7
8
  import { useChatHost } from '../../../host.js';
8
9
  import { useChatScope } from '../../../scope.js';
@@ -219,7 +220,7 @@ function SendButton(t0) {
219
220
  }
220
221
  /* The row under the box: attach, the chat's settings, the stash, the app's own control, and stop and send. */
221
222
  export function ComposerControls(t0) {
222
- const $ = _c(76);
223
+ const $ = _c(78);
223
224
  const {
224
225
  chatId,
225
226
  info,
@@ -253,22 +254,30 @@ export function ComposerControls(t0) {
253
254
  t1 = $[3];
254
255
  }
255
256
  const model = t1;
256
- const started = info.agentSessionId !== null || info.usage.turns > 0;
257
257
  let t2;
258
- if ($[4] !== info.provider || $[5] !== providerFixed || $[6] !== providers || $[7] !== started) {
259
- t2 = started || providerFixed ? providers.filter(entry_1 => entry_1.kind === info.provider) : providers.filter(_temp2);
260
- $[4] = info.provider;
261
- $[5] = providerFixed;
262
- $[6] = providers;
263
- $[7] = started;
264
- $[8] = t2;
258
+ if ($[4] !== info) {
259
+ t2 = holdsConversation(info);
260
+ $[4] = info;
261
+ $[5] = t2;
265
262
  } else {
266
- t2 = $[8];
263
+ t2 = $[5];
267
264
  }
268
- const pickable = t2;
265
+ const started = t2;
269
266
  let t3;
270
- if ($[9] !== attachable || $[10] !== t || $[11] !== writable) {
271
- t3 = attachable && /*#__PURE__*/_jsx(Tooltip, {
267
+ if ($[6] !== info.provider || $[7] !== providerFixed || $[8] !== providers || $[9] !== started) {
268
+ t3 = started || providerFixed ? providers.filter(entry_1 => entry_1.kind === info.provider) : providers.filter(_temp2);
269
+ $[6] = info.provider;
270
+ $[7] = providerFixed;
271
+ $[8] = providers;
272
+ $[9] = started;
273
+ $[10] = t3;
274
+ } else {
275
+ t3 = $[10];
276
+ }
277
+ const pickable = t3;
278
+ let t4;
279
+ if ($[11] !== attachable || $[12] !== t || $[13] !== writable) {
280
+ t4 = attachable && /*#__PURE__*/_jsx(Tooltip, {
272
281
  label: t("composer.attach"),
273
282
  name: true,
274
283
  children: /*#__PURE__*/_jsx("button", {
@@ -282,16 +291,16 @@ export function ComposerControls(t0) {
282
291
  })
283
292
  })
284
293
  });
285
- $[9] = attachable;
286
- $[10] = t;
287
- $[11] = writable;
288
- $[12] = t3;
294
+ $[11] = attachable;
295
+ $[12] = t;
296
+ $[13] = writable;
297
+ $[14] = t4;
289
298
  } else {
290
- t3 = $[12];
299
+ t4 = $[14];
291
300
  }
292
- let t4;
293
- if ($[13] !== onFiles) {
294
- t4 = /*#__PURE__*/_jsx("input", {
301
+ let t5;
302
+ if ($[15] !== onFiles) {
303
+ t5 = /*#__PURE__*/_jsx("input", {
295
304
  ref: fileInputRef,
296
305
  type: "file",
297
306
  multiple: true,
@@ -301,15 +310,15 @@ export function ComposerControls(t0) {
301
310
  e.target.value = "";
302
311
  }
303
312
  });
304
- $[13] = onFiles;
305
- $[14] = t4;
313
+ $[15] = onFiles;
314
+ $[16] = t5;
306
315
  } else {
307
- t4 = $[14];
316
+ t5 = $[16];
308
317
  }
309
- const t5 = controls.configurationPending || !writable;
310
- let t6;
311
- if ($[15] !== controls || $[16] !== info.selection) {
312
- t6 = (id, value) => controls.configure({
318
+ const t6 = controls.configurationPending || !writable;
319
+ let t7;
320
+ if ($[17] !== controls || $[18] !== info.selection) {
321
+ t7 = (id, value) => controls.configure({
313
322
  selection: {
314
323
  ...info.selection,
315
324
  options: {
@@ -318,41 +327,41 @@ export function ComposerControls(t0) {
318
327
  }
319
328
  }
320
329
  });
321
- $[15] = controls;
322
- $[16] = info.selection;
323
- $[17] = t6;
330
+ $[17] = controls;
331
+ $[18] = info.selection;
332
+ $[19] = t7;
324
333
  } else {
325
- t6 = $[17];
334
+ t7 = $[19];
326
335
  }
327
- let t7;
328
- if ($[18] !== controls) {
329
- t7 = runtimeMode => controls.configure({
336
+ let t8;
337
+ if ($[20] !== controls) {
338
+ t8 = runtimeMode => controls.configure({
330
339
  runtimeMode
331
340
  });
332
- $[18] = controls;
333
- $[19] = t7;
341
+ $[20] = controls;
342
+ $[21] = t8;
334
343
  } else {
335
- t7 = $[19];
344
+ t8 = $[21];
336
345
  }
337
- const t8 = busy || !writable;
338
- let t9;
339
- if ($[20] !== accountChoice || $[21] !== controls.chooseAccount || $[22] !== started) {
340
- t9 = accountChoice === null ? null : {
346
+ const t9 = busy || !writable;
347
+ let t10;
348
+ if ($[22] !== accountChoice || $[23] !== controls.chooseAccount || $[24] !== started) {
349
+ t10 = accountChoice === null ? null : {
341
350
  choice: accountChoice,
342
351
  started,
343
352
  onPick: controls.chooseAccount
344
353
  };
345
- $[20] = accountChoice;
346
- $[21] = controls.chooseAccount;
347
- $[22] = started;
348
- $[23] = t9;
354
+ $[22] = accountChoice;
355
+ $[23] = controls.chooseAccount;
356
+ $[24] = started;
357
+ $[25] = t10;
349
358
  } else {
350
- t9 = $[23];
359
+ t10 = $[25];
351
360
  }
352
- let t10;
353
- if ($[24] !== controls.chooseModel || $[25] !== controls.compact || $[26] !== controls.modelPickerOpen || $[27] !== controls.setModelPickerOpen || $[28] !== info.effectiveRuntimeMode || $[29] !== info.permissionMode || $[30] !== info.provider || $[31] !== info.runtimeMode || $[32] !== info.selection || $[33] !== info.usage || $[34] !== model || $[35] !== pickable || $[36] !== t5 || $[37] !== t6 || $[38] !== t7 || $[39] !== t8 || $[40] !== t9) {
354
- t10 = /*#__PURE__*/_jsx(RunSettings, {
355
- disabled: t5,
361
+ let t11;
362
+ if ($[26] !== controls.chooseModel || $[27] !== controls.compact || $[28] !== controls.modelPickerOpen || $[29] !== controls.setModelPickerOpen || $[30] !== info.effectiveRuntimeMode || $[31] !== info.permissionMode || $[32] !== info.provider || $[33] !== info.runtimeMode || $[34] !== info.selection || $[35] !== info.usage || $[36] !== model || $[37] !== pickable || $[38] !== t10 || $[39] !== t6 || $[40] !== t7 || $[41] !== t8 || $[42] !== t9) {
363
+ t11 = /*#__PURE__*/_jsx(RunSettings, {
364
+ disabled: t6,
356
365
  providers: pickable,
357
366
  provider: info.provider,
358
367
  selection: info.selection,
@@ -363,47 +372,47 @@ export function ComposerControls(t0) {
363
372
  open: controls.modelPickerOpen,
364
373
  onOpenChange: controls.setModelPickerOpen,
365
374
  onModel: controls.chooseModel,
366
- onOption: t6,
367
- onMode: t7,
375
+ onOption: t7,
376
+ onMode: t8,
368
377
  usage: info.usage,
369
- compactDisabled: t8,
378
+ compactDisabled: t9,
370
379
  onCompact: controls.compact,
371
- account: t9
372
- });
373
- $[24] = controls.chooseModel;
374
- $[25] = controls.compact;
375
- $[26] = controls.modelPickerOpen;
376
- $[27] = controls.setModelPickerOpen;
377
- $[28] = info.effectiveRuntimeMode;
378
- $[29] = info.permissionMode;
379
- $[30] = info.provider;
380
- $[31] = info.runtimeMode;
381
- $[32] = info.selection;
382
- $[33] = info.usage;
383
- $[34] = model;
384
- $[35] = pickable;
385
- $[36] = t5;
386
- $[37] = t6;
387
- $[38] = t7;
388
- $[39] = t8;
389
- $[40] = t9;
390
- $[41] = t10;
391
- } else {
392
- t10 = $[41];
393
- }
394
- let t11;
395
- if ($[42] !== onRestore) {
396
- t11 = /*#__PURE__*/_jsx(StashPicker, {
397
- onRestore: onRestore
380
+ account: t10
398
381
  });
399
- $[42] = onRestore;
382
+ $[26] = controls.chooseModel;
383
+ $[27] = controls.compact;
384
+ $[28] = controls.modelPickerOpen;
385
+ $[29] = controls.setModelPickerOpen;
386
+ $[30] = info.effectiveRuntimeMode;
387
+ $[31] = info.permissionMode;
388
+ $[32] = info.provider;
389
+ $[33] = info.runtimeMode;
390
+ $[34] = info.selection;
391
+ $[35] = info.usage;
392
+ $[36] = model;
393
+ $[37] = pickable;
394
+ $[38] = t10;
395
+ $[39] = t6;
396
+ $[40] = t7;
397
+ $[41] = t8;
398
+ $[42] = t9;
400
399
  $[43] = t11;
401
400
  } else {
402
401
  t11 = $[43];
403
402
  }
404
403
  let t12;
405
- if ($[44] !== Slot || $[45] !== chatId || $[46] !== insert || $[47] !== scope || $[48] !== t || $[49] !== writable) {
406
- t12 = Slot !== null && /*#__PURE__*/_jsx(ErrorBoundary, {
404
+ if ($[44] !== onRestore) {
405
+ t12 = /*#__PURE__*/_jsx(StashPicker, {
406
+ onRestore: onRestore
407
+ });
408
+ $[44] = onRestore;
409
+ $[45] = t12;
410
+ } else {
411
+ t12 = $[45];
412
+ }
413
+ let t13;
414
+ if ($[46] !== Slot || $[47] !== chatId || $[48] !== insert || $[49] !== scope || $[50] !== t || $[51] !== writable) {
415
+ t13 = Slot !== null && /*#__PURE__*/_jsx(ErrorBoundary, {
407
416
  label: t("composer.slotFailed"),
408
417
  resetKeys: [chatId],
409
418
  compact: true,
@@ -415,39 +424,39 @@ export function ComposerControls(t0) {
415
424
  insert: insert
416
425
  })
417
426
  });
418
- $[44] = Slot;
419
- $[45] = chatId;
420
- $[46] = insert;
421
- $[47] = scope;
422
- $[48] = t;
423
- $[49] = writable;
424
- $[50] = t12;
427
+ $[46] = Slot;
428
+ $[47] = chatId;
429
+ $[48] = insert;
430
+ $[49] = scope;
431
+ $[50] = t;
432
+ $[51] = writable;
433
+ $[52] = t13;
425
434
  } else {
426
- t12 = $[50];
435
+ t13 = $[52];
427
436
  }
428
- let t13;
429
- if ($[51] === Symbol.for("react.memo_cache_sentinel")) {
430
- t13 = /*#__PURE__*/_jsx("span", {
437
+ let t14;
438
+ if ($[53] === Symbol.for("react.memo_cache_sentinel")) {
439
+ t14 = /*#__PURE__*/_jsx("span", {
431
440
  className: "grow"
432
441
  });
433
- $[51] = t13;
442
+ $[53] = t14;
434
443
  } else {
435
- t13 = $[51];
444
+ t14 = $[53];
436
445
  }
437
- let t14;
438
- if ($[52] !== dictationToolbar) {
439
- t14 = /*#__PURE__*/_jsx("div", {
446
+ let t15;
447
+ if ($[54] !== dictationToolbar) {
448
+ t15 = /*#__PURE__*/_jsx("div", {
440
449
  ref: dictationToolbar,
441
450
  className: "flex items-center pl-1 empty:hidden [&_.icon-btn]:rounded-full"
442
451
  });
443
- $[52] = dictationToolbar;
444
- $[53] = t14;
452
+ $[54] = dictationToolbar;
453
+ $[55] = t15;
445
454
  } else {
446
- t14 = $[53];
455
+ t15 = $[55];
447
456
  }
448
- let t15;
449
- if ($[54] !== busy || $[55] !== controls) {
450
- t15 = busy && /*#__PURE__*/_jsx(Tooltip, {
457
+ let t16;
458
+ if ($[56] !== busy || $[57] !== controls) {
459
+ t16 = busy && /*#__PURE__*/_jsx(Tooltip, {
451
460
  label: composerStopLabel(),
452
461
  name: true,
453
462
  children: /*#__PURE__*/_jsx("button", {
@@ -459,15 +468,15 @@ export function ComposerControls(t0) {
459
468
  })
460
469
  })
461
470
  });
462
- $[54] = busy;
463
- $[55] = controls;
464
- $[56] = t15;
471
+ $[56] = busy;
472
+ $[57] = controls;
473
+ $[58] = t16;
465
474
  } else {
466
- t15 = $[56];
475
+ t16 = $[58];
467
476
  }
468
- let t16;
469
- if ($[57] !== controls.configurationPending || $[58] !== send.onContinue || $[59] !== t) {
470
- t16 = send.onContinue !== null && /*#__PURE__*/_jsx(Tooltip, {
477
+ let t17;
478
+ if ($[59] !== controls.configurationPending || $[60] !== send.onContinue || $[61] !== t) {
479
+ t17 = send.onContinue !== null && /*#__PURE__*/_jsx(Tooltip, {
471
480
  label: t("composer.continueHint"),
472
481
  children: /*#__PURE__*/_jsxs(Button, {
473
482
  variant: "primary",
@@ -480,56 +489,56 @@ export function ComposerControls(t0) {
480
489
  }), t("composer.continue")]
481
490
  })
482
491
  });
483
- $[57] = controls.configurationPending;
484
- $[58] = send.onContinue;
485
- $[59] = t;
486
- $[60] = t16;
492
+ $[59] = controls.configurationPending;
493
+ $[60] = send.onContinue;
494
+ $[61] = t;
495
+ $[62] = t17;
487
496
  } else {
488
- t16 = $[60];
497
+ t17 = $[62];
489
498
  }
490
- let t17;
491
- if ($[61] !== send || $[62] !== writable) {
492
- t17 = send.onContinue === null && send.visible && /*#__PURE__*/_jsx(SendButton, {
499
+ let t18;
500
+ if ($[63] !== send || $[64] !== writable) {
501
+ t18 = send.onContinue === null && send.visible && /*#__PURE__*/_jsx(SendButton, {
493
502
  send: send,
494
503
  writable: writable
495
504
  });
496
- $[61] = send;
497
- $[62] = writable;
498
- $[63] = t17;
505
+ $[63] = send;
506
+ $[64] = writable;
507
+ $[65] = t18;
499
508
  } else {
500
- t17 = $[63];
509
+ t18 = $[65];
501
510
  }
502
- let t18;
503
- if ($[64] !== t14 || $[65] !== t15 || $[66] !== t16 || $[67] !== t17) {
504
- t18 = /*#__PURE__*/_jsxs("div", {
511
+ let t19;
512
+ if ($[66] !== t15 || $[67] !== t16 || $[68] !== t17 || $[69] !== t18) {
513
+ t19 = /*#__PURE__*/_jsxs("div", {
505
514
  className: "flex h-9 shrink-0 items-center gap-0.5 rounded-full bg-surface-hover",
506
- children: [t14, t15, t16, t17]
515
+ children: [t15, t16, t17, t18]
507
516
  });
508
- $[64] = t14;
509
- $[65] = t15;
510
- $[66] = t16;
511
- $[67] = t17;
512
- $[68] = t18;
517
+ $[66] = t15;
518
+ $[67] = t16;
519
+ $[68] = t17;
520
+ $[69] = t18;
521
+ $[70] = t19;
513
522
  } else {
514
- t18 = $[68];
523
+ t19 = $[70];
515
524
  }
516
- let t19;
517
- if ($[69] !== t10 || $[70] !== t11 || $[71] !== t12 || $[72] !== t18 || $[73] !== t3 || $[74] !== t4) {
518
- t19 = /*#__PURE__*/_jsxs("div", {
525
+ let t20;
526
+ if ($[71] !== t11 || $[72] !== t12 || $[73] !== t13 || $[74] !== t19 || $[75] !== t4 || $[76] !== t5) {
527
+ t20 = /*#__PURE__*/_jsxs("div", {
519
528
  className: "flex items-center gap-2 pt-3 pr-3.5 pb-3.5 pl-5 @max-md/composer:gap-1.5 @max-md/composer:p-3 @max-md/composer:pt-2.5",
520
- children: [t3, t4, t10, t11, t12, t13, t18]
529
+ children: [t4, t5, t11, t12, t13, t14, t19]
521
530
  });
522
- $[69] = t10;
523
- $[70] = t11;
524
- $[71] = t12;
525
- $[72] = t18;
526
- $[73] = t3;
527
- $[74] = t4;
528
- $[75] = t19;
531
+ $[71] = t11;
532
+ $[72] = t12;
533
+ $[73] = t13;
534
+ $[74] = t19;
535
+ $[75] = t4;
536
+ $[76] = t5;
537
+ $[77] = t20;
529
538
  } else {
530
- t19 = $[75];
539
+ t20 = $[77];
531
540
  }
532
- return t19;
541
+ return t20;
533
542
  }
534
543
  function _temp2(entry_2) {
535
544
  return entry_2.installed && entry_2.capabilities.chat;
@@ -40,7 +40,7 @@ export function replyHeader(row, previous) {
40
40
  }
41
41
  // A transform also shifts a descendant's sticky position after it was resolved against the scrollport.
42
42
  export function rowPosition(kind, top) {
43
- return kind === 'visual' ? {
43
+ return kind === 'visual' || kind === 'app-card' ? {
44
44
  top
45
45
  } : {
46
46
  transform: `translateY(${top}px)`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adecore/agents-react",
3
- "version": "0.40.2",
3
+ "version": "0.40.3",
4
4
  "description": "React agent chat threads, composers, approvals, provider accounts and usage views.",
5
5
  "type": "module",
6
6
  "exports": {
@@ -67,11 +67,11 @@
67
67
  "test:visuals": "bun --config=integration.bunfig.toml --conditions=source test ./src/chat/visual-viewport.integration.test.ts"
68
68
  },
69
69
  "dependencies": {
70
- "@adecore/agent-contracts": "0.40.2",
71
- "@adecore/editor": "0.40.2",
72
- "@adecore/editor-react": "0.40.2",
73
- "@adecore/intelligent-ui": "0.40.2",
74
- "@adecore/merge": "0.40.2",
70
+ "@adecore/agent-contracts": "0.40.3",
71
+ "@adecore/editor": "0.40.3",
72
+ "@adecore/editor-react": "0.40.3",
73
+ "@adecore/intelligent-ui": "0.40.3",
74
+ "@adecore/merge": "0.40.3",
75
75
  "@codemirror/commands": "^6.11.1",
76
76
  "@codemirror/language": "^6.13.1",
77
77
  "@codemirror/state": "^6.7.6",
@@ -94,14 +94,14 @@
94
94
  "zustand": "^5.0.16"
95
95
  },
96
96
  "peerDependencies": {
97
- "@adecore/ui": "^0.40.2",
97
+ "@adecore/ui": "^0.40.3",
98
98
  "i18next": "^26.4.2",
99
99
  "react": "^19.3.0",
100
100
  "react-dom": "^19.3.0",
101
101
  "react-i18next": "^17.0.15"
102
102
  },
103
103
  "devDependencies": {
104
- "@adecore/ui": "0.40.2",
104
+ "@adecore/ui": "0.40.3",
105
105
  "@types/bun": "^1.4.4",
106
106
  "@types/react": "^19.3.0",
107
107
  "@types/react-dom": "^19.3.0",
@@ -2,7 +2,7 @@ import { useRef, useState, type Ref } from 'react';
2
2
  import { useTranslation } from 'react-i18next';
3
3
  import clsx from 'clsx';
4
4
  import { ArrowUp, ChevronDown, Play, Plus, Square } from 'lucide-react';
5
- import type { ChatInfo } from '@adecore/agent-contracts';
5
+ import { holdsConversation, type ChatInfo } from '@adecore/agent-contracts';
6
6
  import { Button, ErrorBoundary, Icon, Menu, Tooltip, type Shortcut } from '@adecore/ui';
7
7
  import { useChatHost, type ComposerSendAction, type ComposerSendDraft } from '../../../host';
8
8
  import { useChatScope } from '../../../scope';
@@ -124,8 +124,7 @@ export function ComposerControls({
124
124
  const fileInputRef = useRef<HTMLInputElement>(null);
125
125
  const busy = info.activeTurnId !== null;
126
126
  const model = providers.find((entry) => entry.kind === info.provider)?.models.find((entry) => entry.slug === info.selection.model);
127
- // The CLI announces its session on the first message, so anything before that is still a blank chat.
128
- const started = info.agentSessionId !== null || info.usage.turns > 0;
127
+ const started = holdsConversation(info);
129
128
 
130
129
  // A chat that has started keeps its provider (the CLI holds the thread), and so does one opened for a
131
130
  // named CLI; its models stay switchable, since the CLI takes a new one on the restart the next send does.
@@ -44,5 +44,5 @@ export function replyHeader(row: TimelineRow, previous: TimelineRow | null): { a
44
44
 
45
45
  // A transform also shifts a descendant's sticky position after it was resolved against the scrollport.
46
46
  export function rowPosition(kind: TimelineRow['kind'], top: number): CSSProperties {
47
- return kind === 'visual' ? { top } : { transform: `translateY(${top}px)` };
47
+ return kind === 'visual' || kind === 'app-card' ? { top } : { transform: `translateY(${top}px)` };
48
48
  }