@adecore/agents-react 0.63.2 → 0.64.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.
@@ -40,6 +40,12 @@ function transportActions(transport) {
40
40
  messageId
41
41
  });
42
42
  },
43
+ send: async (chatId, text) => {
44
+ await transport.request('chat.send', {
45
+ chatId,
46
+ text
47
+ });
48
+ },
43
49
  compact: async chatId => {
44
50
  await transport.request('chat.compact', {
45
51
  chatId
@@ -1,6 +1,6 @@
1
1
  import { c as _c } from "react/compiler-runtime";
2
2
  import { WAITING_NOTE_PREFIX } from '@adecore/agent-contracts';
3
- import { Icon, IconButton, MiddleTruncate, Tooltip, useTickingText } from '@adecore/ui';
3
+ import { Button, Icon, IconButton, MiddleTruncate, Tooltip, useTickingText } from '@adecore/ui';
4
4
  import { formatAgo, formatElapsedShort, formatMoment, formatTokens } from '@adecore/ui/format';
5
5
  import clsx from 'clsx';
6
6
  import { Bot, Brain, ChevronDown, CircleAlert, CircleCheck, CircleX, File, Info, MessageCircleQuestionMark, Reply, Send, SquareTerminal, TriangleAlert } from 'lucide-react';
@@ -11,6 +11,7 @@ import { useHostAttachmentUrl, useHostChatPlace, useHostReplyAuthor, useHostStre
11
11
  import { useChatScope } from '../../../scope.js';
12
12
  import { useChatRow, useCurrentItem } from '../../../state/chats.js';
13
13
  import { useProviders } from '../../../state/providers.js';
14
+ import { useChatActions } from '../../actions.js';
14
15
  import { fileBadge, formatBytes, isImageAttachment } from '../../attachments.js';
15
16
  import { referenceTokens } from '../../chat-references.js';
16
17
  import { selectionSwitchText } from '../../logic/selection-switch.js';
@@ -447,7 +448,7 @@ function _temp(e) {
447
448
  return copySelectionWithChips(e.nativeEvent);
448
449
  }
449
450
  export function SentMessageRow(t0) {
450
- const $ = _c(18);
451
+ const $ = _c(20);
451
452
  const {
452
453
  chatId,
453
454
  id,
@@ -497,29 +498,123 @@ export function SentMessageRow(t0) {
497
498
  t3 = $[10];
498
499
  }
499
500
  let t4;
500
- if ($[11] !== message.state || $[12] !== t) {
501
- t4 = message.state !== undefined && /*#__PURE__*/_jsx("div", {
501
+ if ($[11] !== chatId || $[12] !== message.limited || $[13] !== message.state || $[14] !== t) {
502
+ t4 = message.limited === true && message.state === "waiting" ? /*#__PURE__*/_jsx(LimitedMessageState, {
503
+ chatId: chatId
504
+ }) : message.state !== undefined && /*#__PURE__*/_jsx("div", {
502
505
  className: "mt-1 text-xs text-text-muted",
503
506
  children: t(`rows.message.${message.state}`)
504
507
  });
505
- $[11] = message.state;
508
+ $[11] = chatId;
509
+ $[12] = message.limited;
510
+ $[13] = message.state;
511
+ $[14] = t;
512
+ $[15] = t4;
513
+ } else {
514
+ t4 = $[15];
515
+ }
516
+ let t5;
517
+ if ($[16] !== lookup || $[17] !== t3 || $[18] !== t4) {
518
+ t5 = /*#__PURE__*/_jsxs(ReferenceLookupContext, {
519
+ value: lookup,
520
+ children: [t3, t4]
521
+ });
522
+ $[16] = lookup;
523
+ $[17] = t3;
524
+ $[18] = t4;
525
+ $[19] = t5;
526
+ } else {
527
+ t5 = $[19];
528
+ }
529
+ return t5;
530
+ }
531
+ /*
532
+ * A message that waits because messages opened all the turns they may in this chat this hour. A person
533
+ * hands it over with a prompt of their own, whose turn takes every waiting message in its preamble.
534
+ */
535
+ function LimitedMessageState(t0) {
536
+ const $ = _c(17);
537
+ const {
538
+ chatId
539
+ } = t0;
540
+ const {
541
+ t
542
+ } = useTranslation("agent-chat");
543
+ const {
544
+ send
545
+ } = useChatActions();
546
+ const host = useChatHost();
547
+ const [sending, setSending] = useState(false);
548
+ let t1;
549
+ if ($[0] !== chatId || $[1] !== host || $[2] !== send || $[3] !== t) {
550
+ t1 = () => {
551
+ if (send === undefined) {
552
+ return;
553
+ }
554
+ setSending(true);
555
+ send(chatId, t("rows.message.deliverPrompt")).catch(error => {
556
+ host.notify({
557
+ kind: "error",
558
+ title: t("rows.message.deliverFailed"),
559
+ description: error instanceof Error ? error.message : t("subagents.noAnswer")
560
+ });
561
+ }).finally(() => setSending(false));
562
+ };
563
+ $[0] = chatId;
564
+ $[1] = host;
565
+ $[2] = send;
566
+ $[3] = t;
567
+ $[4] = t1;
568
+ } else {
569
+ t1 = $[4];
570
+ }
571
+ const deliver = t1;
572
+ let t2;
573
+ if ($[5] !== t) {
574
+ t2 = t("rows.message.limited");
575
+ $[5] = t;
576
+ $[6] = t2;
577
+ } else {
578
+ t2 = $[6];
579
+ }
580
+ let t3;
581
+ if ($[7] !== t2) {
582
+ t3 = /*#__PURE__*/_jsx("span", {
583
+ children: t2
584
+ });
585
+ $[7] = t2;
586
+ $[8] = t3;
587
+ } else {
588
+ t3 = $[8];
589
+ }
590
+ let t4;
591
+ if ($[9] !== deliver || $[10] !== send || $[11] !== sending || $[12] !== t) {
592
+ t4 = send !== undefined && /*#__PURE__*/_jsx(Button, {
593
+ size: "xs",
594
+ variant: "secondary",
595
+ disabled: sending,
596
+ onClick: deliver,
597
+ children: t("rows.message.deliverNow")
598
+ });
599
+ $[9] = deliver;
600
+ $[10] = send;
601
+ $[11] = sending;
506
602
  $[12] = t;
507
603
  $[13] = t4;
508
604
  } else {
509
605
  t4 = $[13];
510
606
  }
511
607
  let t5;
512
- if ($[14] !== lookup || $[15] !== t3 || $[16] !== t4) {
513
- t5 = /*#__PURE__*/_jsxs(ReferenceLookupContext, {
514
- value: lookup,
608
+ if ($[14] !== t3 || $[15] !== t4) {
609
+ t5 = /*#__PURE__*/_jsxs("div", {
610
+ className: "mt-1 flex items-center gap-2 text-xs text-text-muted",
515
611
  children: [t3, t4]
516
612
  });
517
- $[14] = lookup;
518
- $[15] = t3;
519
- $[16] = t4;
520
- $[17] = t5;
613
+ $[14] = t3;
614
+ $[15] = t4;
615
+ $[16] = t5;
521
616
  } else {
522
- t5 = $[17];
617
+ t5 = $[16];
523
618
  }
524
619
  return t5;
525
620
  }
@@ -36,6 +36,7 @@ export interface ChatActions {
36
36
  stopTurn(chatId: string, subagents: boolean): Promise<void>;
37
37
  unqueue(chatId: string, messageId: string): Promise<void>;
38
38
  sendNow(chatId: string, messageId: string): Promise<void>;
39
+ send?(chatId: string, text: string): Promise<void>;
39
40
  compact(chatId: string): Promise<void>;
40
41
  configure(chatId: string, patch: Omit<ChatConfigurePayload, 'chatId'>): Promise<void>;
41
42
  continueOn(chatId: string, account: string): Promise<void>;
@@ -127,6 +127,10 @@ declare const _default: {
127
127
  unnamed: string;
128
128
  waiting: string;
129
129
  dropped: string;
130
+ limited: string;
131
+ deliverNow: string;
132
+ deliverPrompt: string;
133
+ deliverFailed: string;
130
134
  };
131
135
  sent: {
132
136
  heading: string;
@@ -126,7 +126,11 @@ export default {
126
126
  heading: 'Message from {{name}}',
127
127
  unnamed: 'another node',
128
128
  waiting: 'Waiting for the next turn',
129
- dropped: 'Expired before the agent read it'
129
+ dropped: 'Expired before the agent read it',
130
+ limited: 'Waiting: messages woke this chat as often as they may this hour',
131
+ deliverNow: 'Deliver now',
132
+ deliverPrompt: 'Read the waiting messages and act on them.',
133
+ deliverFailed: 'The messages could not be delivered'
130
134
  },
131
135
  sent: {
132
136
  heading: 'Message to {{name}}',
@@ -127,6 +127,10 @@ declare const _default: {
127
127
  unnamed: string;
128
128
  waiting: string;
129
129
  dropped: string;
130
+ limited: string;
131
+ deliverNow: string;
132
+ deliverPrompt: string;
133
+ deliverFailed: string;
130
134
  };
131
135
  sent: {
132
136
  heading: string;
@@ -126,7 +126,11 @@ export default {
126
126
  heading: 'Bericht van {{name}}',
127
127
  unnamed: 'een andere node',
128
128
  waiting: 'Wacht op de volgende turn',
129
- dropped: 'Vervallen voordat de agent het las'
129
+ dropped: 'Vervallen voordat de agent het las',
130
+ limited: 'Wacht: berichten wekten deze chat dit uur zo vaak als mag',
131
+ deliverNow: 'Nu bezorgen',
132
+ deliverPrompt: 'Lees de wachtende berichten en handel ernaar.',
133
+ deliverFailed: 'De berichten konden niet worden bezorgd'
130
134
  },
131
135
  sent: {
132
136
  heading: 'Bericht aan {{name}}',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adecore/agents-react",
3
- "version": "0.63.2",
3
+ "version": "0.64.1",
4
4
  "description": "React agent chat threads, composers, approvals, provider accounts and usage views.",
5
5
  "type": "module",
6
6
  "exports": {
@@ -72,12 +72,12 @@
72
72
  "test:visuals": "bun --config=integration.bunfig.toml --conditions=source test ./src/chat/visual-viewport.integration.test.ts"
73
73
  },
74
74
  "dependencies": {
75
- "@adecore/agent-contracts": "0.63.2",
76
- "@adecore/editor": "0.63.2",
77
- "@adecore/editor-react": "0.63.2",
78
- "@adecore/intelligent-ui": "0.63.2",
79
- "@adecore/merge": "0.63.2",
80
- "@adecore/utils": "0.63.2",
75
+ "@adecore/agent-contracts": "0.64.1",
76
+ "@adecore/editor": "0.64.1",
77
+ "@adecore/editor-react": "0.64.1",
78
+ "@adecore/intelligent-ui": "0.64.1",
79
+ "@adecore/merge": "0.64.1",
80
+ "@adecore/utils": "0.64.1",
81
81
  "@codemirror/commands": "^6.11.1",
82
82
  "@codemirror/language": "^6.13.1",
83
83
  "@codemirror/state": "^6.7.6",
@@ -101,14 +101,14 @@
101
101
  "zustand": "^5.0.16"
102
102
  },
103
103
  "peerDependencies": {
104
- "@adecore/ui": "^0.63.2",
104
+ "@adecore/ui": "^0.64.1",
105
105
  "i18next": "^26.4.2",
106
106
  "react": "^19.3.0",
107
107
  "react-dom": "^19.3.0",
108
108
  "react-i18next": "^17.0.15"
109
109
  },
110
110
  "devDependencies": {
111
- "@adecore/ui": "0.63.2",
111
+ "@adecore/ui": "0.64.1",
112
112
  "@types/bun": "^1.4.4",
113
113
  "@types/react": "^19.3.0",
114
114
  "@types/react-dom": "^19.3.0",
@@ -23,6 +23,9 @@ function transportActions(transport: ChatTransport): ChatActions {
23
23
  sendNow: async (chatId, messageId) => {
24
24
  await transport.request('chat.sendNow', { chatId, messageId });
25
25
  },
26
+ send: async (chatId, text) => {
27
+ await transport.request('chat.send', { chatId, text });
28
+ },
26
29
  compact: async (chatId) => {
27
30
  await transport.request('chat.compact', { chatId });
28
31
  },
@@ -11,7 +11,7 @@ import type {
11
11
  ModelSelection
12
12
  } from '@adecore/agent-contracts';
13
13
  import { WAITING_NOTE_PREFIX } from '@adecore/agent-contracts';
14
- import { Icon, IconButton, MiddleTruncate, Tooltip, useTickingText } from '@adecore/ui';
14
+ import { Button, Icon, IconButton, MiddleTruncate, Tooltip, useTickingText } from '@adecore/ui';
15
15
  import { formatAgo, formatElapsedShort, formatMoment, formatTokens } from '@adecore/ui/format';
16
16
  import clsx from 'clsx';
17
17
  import {
@@ -36,6 +36,7 @@ import { useHostAttachmentUrl, useHostChatPlace, useHostReplyAuthor, useHostStre
36
36
  import { useChatScope } from '../../../scope';
37
37
  import { useChatRow, useCurrentItem } from '../../../state/chats';
38
38
  import { useProviders } from '../../../state/providers';
39
+ import { useChatActions } from '../../actions';
39
40
  import { fileBadge, formatBytes, isImageAttachment } from '../../attachments';
40
41
  import { referenceTokens } from '../../chat-references';
41
42
  import { selectionSwitchText } from '../../logic/selection-switch';
@@ -222,11 +223,54 @@ export function SentMessageRow({ chatId, id, message }: { chatId: string; id: st
222
223
  chip={<ReferenceChip id={message.from} lastName={message.title} />}
223
224
  text={message.text}
224
225
  />
225
- {message.state !== undefined && <div className="mt-1 text-xs text-text-muted">{t(`rows.message.${message.state}`)}</div>}
226
+ {message.limited === true && message.state === 'waiting' ? (
227
+ <LimitedMessageState chatId={chatId} />
228
+ ) : (
229
+ message.state !== undefined && <div className="mt-1 text-xs text-text-muted">{t(`rows.message.${message.state}`)}</div>
230
+ )}
226
231
  </ReferenceLookupContext>
227
232
  );
228
233
  }
229
234
 
235
+ /*
236
+ * A message that waits because messages opened all the turns they may in this chat this hour. A person
237
+ * hands it over with a prompt of their own, whose turn takes every waiting message in its preamble.
238
+ */
239
+ function LimitedMessageState({ chatId }: { chatId: string }) {
240
+ const { t } = useTranslation('agent-chat');
241
+ const { send } = useChatActions();
242
+ const host = useChatHost();
243
+ const [sending, setSending] = useState(false);
244
+
245
+ const deliver = (): void => {
246
+ if (send === undefined) {
247
+ return;
248
+ }
249
+
250
+ setSending(true);
251
+ send(chatId, t('rows.message.deliverPrompt'))
252
+ .catch((error: unknown) => {
253
+ host.notify({
254
+ kind: 'error',
255
+ title: t('rows.message.deliverFailed'),
256
+ description: error instanceof Error ? error.message : t('subagents.noAnswer')
257
+ });
258
+ })
259
+ .finally(() => setSending(false));
260
+ };
261
+
262
+ return (
263
+ <div className="mt-1 flex items-center gap-2 text-xs text-text-muted">
264
+ <span>{t('rows.message.limited')}</span>
265
+ {send !== undefined && (
266
+ <Button size="xs" variant="secondary" disabled={sending} onClick={deliver}>
267
+ {t('rows.message.deliverNow')}
268
+ </Button>
269
+ )}
270
+ </div>
271
+ );
272
+ }
273
+
230
274
  /*
231
275
  * A message this chat's agent sent another node: said by the agent, so outlined rather than filled like what is
232
276
  * said to it, under a chip that names and opens where it went, with how it went and its call below.
package/src/host/host.ts CHANGED
@@ -76,6 +76,8 @@ export interface ChatActions {
76
76
  /* Refused with `request-not-found` when the message already went out. */
77
77
  unqueue(chatId: string, messageId: string): Promise<void>;
78
78
  sendNow(chatId: string, messageId: string): Promise<void>;
79
+ /* Sends a prompt as the person from outside the composer; absent where the host offers none, which leaves such a button out. */
80
+ send?(chatId: string, text: string): Promise<void>;
79
81
  compact(chatId: string): Promise<void>;
80
82
  configure(chatId: string, patch: Omit<ChatConfigurePayload, 'chatId'>): Promise<void>;
81
83
  continueOn(chatId: string, account: string): Promise<void>;
@@ -126,7 +126,11 @@ export default {
126
126
  heading: 'Message from {{name}}',
127
127
  unnamed: 'another node',
128
128
  waiting: 'Waiting for the next turn',
129
- dropped: 'Expired before the agent read it'
129
+ dropped: 'Expired before the agent read it',
130
+ limited: 'Waiting: messages woke this chat as often as they may this hour',
131
+ deliverNow: 'Deliver now',
132
+ deliverPrompt: 'Read the waiting messages and act on them.',
133
+ deliverFailed: 'The messages could not be delivered'
130
134
  },
131
135
  sent: {
132
136
  heading: 'Message to {{name}}',
@@ -126,7 +126,11 @@ export default {
126
126
  heading: 'Bericht van {{name}}',
127
127
  unnamed: 'een andere node',
128
128
  waiting: 'Wacht op de volgende turn',
129
- dropped: 'Vervallen voordat de agent het las'
129
+ dropped: 'Vervallen voordat de agent het las',
130
+ limited: 'Wacht: berichten wekten deze chat dit uur zo vaak als mag',
131
+ deliverNow: 'Nu bezorgen',
132
+ deliverPrompt: 'Lees de wachtende berichten en handel ernaar.',
133
+ deliverFailed: 'De berichten konden niet worden bezorgd'
130
134
  },
131
135
  sent: {
132
136
  heading: 'Bericht aan {{name}}',