@adecore/agents-react 0.69.1 → 0.70.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.
@@ -15,7 +15,9 @@ export const PROVIDER_PATHS = {
15
15
  codex: 'M21.55 10.004a5.416 5.416 0 00-.478-4.501c-1.217-2.09-3.662-3.166-6.05-2.66A5.59 5.59 0 0010.831 1C8.39.995 6.224 2.546 5.473 4.838A5.553 5.553 0 001.76 7.496a5.487 5.487 0 00.691 6.5 5.416 5.416 0 00.477 4.502c1.217 2.09 3.662 3.165 6.05 2.66A5.586 5.586 0 0013.168 23c2.443.006 4.61-1.546 5.361-3.84a5.554 5.554 0 003.715-2.66 5.488 5.488 0 00-.693-6.497v.001zm-8.381 11.558a4.199 4.199 0 01-2.675-.954c.034-.018.093-.05.132-.074l4.44-2.53a.71.71 0 00.364-.623v-6.176l1.877 1.069c.02.01.033.029.036.05v5.115c-.003 2.274-1.87 4.118-4.174 4.123zM4.192 17.78a4.059 4.059 0 01-.498-2.763c.032.019.09.055.131.078l4.44 2.53c.225.13.504.13.73 0l5.42-3.088v2.138a.068.068 0 01-.027.057L9.9 19.288c-1.999 1.136-4.552.46-5.707-1.51h-.001zM3.023 8.216A4.15 4.15 0 015.198 6.41l-.002.151v5.06a.711.711 0 00.364.624l5.42 3.087-1.876 1.07a.067.067 0 01-.063.005l-4.489-2.559c-1.995-1.14-2.679-3.658-1.53-5.63h.001zm15.417 3.54l-5.42-3.088L14.896 7.6a.067.067 0 01.063-.006l4.489 2.557c1.998 1.14 2.683 3.662 1.529 5.633a4.163 4.163 0 01-2.174 1.807V12.38a.71.71 0 00-.363-.623zm1.867-2.773a6.04 6.04 0 00-.132-.078l-4.44-2.53a.731.731 0 00-.729 0l-5.42 3.088V7.325a.068.068 0 01.027-.057L14.1 4.713c2-1.137 4.555-.46 5.707 1.513.487.833.664 1.809.499 2.757h.001zm-11.741 3.81l-1.877-1.068a.065.065 0 01-.036-.051V6.559c.001-2.277 1.873-4.122 4.181-4.12.976 0 1.92.338 2.671.954-.034.018-.092.05-.131.073l-4.44 2.53a.71.71 0 00-.365.623l-.003 6.173v.001zm1.02-2.168L12 9.25l2.414 1.375v2.75L12 14.75l-2.415-1.375v-2.75z',
16
16
  nanogpt: 'M5 20V4h2.6l8.8 11.2V4H19v16h-2.6L7.6 8.8V20z',
17
17
  grok: 'M6.469 8.776 16.512 23h-4.464L2.005 8.776H6.47Zm-.004 7.9 2.233 3.164L6.467 23H2l4.465-6.324ZM22 2.582V23h-3.659V7.764L22 2.582ZM22 1l-9.952 14.095-2.233-3.163L17.533 1H22Z',
18
- copilot: siGithubcopilot.path
18
+ copilot: siGithubcopilot.path,
19
+ // The mark Google lists in the ACP registry (`antigravity-acp/icon.svg`), scaled from 16 to 24 units.
20
+ antigravity: 'M21.2178 22.0227C22.4906 22.9773 24.3996 22.341 22.6496 20.591C17.3997 15.4999 18.5132 1.5 11.9905 1.5C5.4678 1.5 6.5814 15.4999 1.3314 20.591C-0.5777 22.5 1.4905 22.9773 2.7632 22.0227C7.695 18.6818 7.3769 12.7955 11.9905 12.7955C16.6041 12.7955 16.286 18.6818 21.2178 22.0227Z'
19
21
  };
20
22
  /* The CLIs drawn with the logo of the usage page rather than their agent mark. */
21
23
  export function hasProviderLogo(kind) {
@@ -1,8 +1,10 @@
1
1
  import type { ChatThreadInfo } from '../chat-sink.js';
2
2
  export type ChatThreadBackgroundTask = NonNullable<ChatThreadInfo['background']>[number];
3
3
  export declare function backgroundTaskName(task: ChatThreadBackgroundTask): string;
4
+ export declare function backgroundTaskTime(task: ChatThreadBackgroundTask, now: number): string;
4
5
  export declare function backgroundCounts(tasks: readonly ChatThreadBackgroundTask[]): {
5
6
  shells: number;
6
7
  monitors: number;
8
+ wakeups: number;
7
9
  others: number;
8
10
  };
@@ -1,17 +1,31 @@
1
+ import { scheduledWakeupAt } from '@adecore/agent-contracts';
2
+ import { formatElapsedShort, formatMoment } from '@adecore/ui/format';
1
3
  import i18next from 'i18next';
2
- /* What a person reads for a task: what it does, else the command, else its kind. */
4
+ /* What a person reads for a task: what it does, else the command, else its kind. A wakeup reads as one in their words. */
3
5
  export function backgroundTaskName(task) {
6
+ if (scheduledWakeupAt(task) !== null) {
7
+ return i18next.t('agent-chat:activity.wakeup');
8
+ }
4
9
  if (task.description || task.command) {
5
10
  return task.description || task.command || '';
6
11
  }
7
12
  return task.kind === 'shell' || task.kind === 'monitor' ? i18next.t(`agent-chat:activity.${task.kind}`) : i18next.t('agent-chat:activity.other');
8
13
  }
14
+ /* How long a task has run, or for a wakeup when it fires. */
15
+ export function backgroundTaskTime(task, now) {
16
+ const wakesAt = scheduledWakeupAt(task);
17
+ return wakesAt === null ? formatElapsedShort(Math.max(0, now - task.startedAt)) : i18next.t('agent-chat:activity.wakesAt', {
18
+ time: formatMoment(wakesAt, now)
19
+ });
20
+ }
9
21
  export function backgroundCounts(tasks) {
10
- const shells = tasks.filter(task => task.kind === 'shell').length;
11
- const monitors = tasks.filter(task => task.kind === 'monitor').length;
22
+ const wakeups = tasks.filter(task => scheduledWakeupAt(task) !== null).length;
23
+ const shells = tasks.filter(task => task.kind === 'shell' && scheduledWakeupAt(task) === null).length;
24
+ const monitors = tasks.filter(task => task.kind === 'monitor' && scheduledWakeupAt(task) === null).length;
12
25
  return {
13
26
  shells,
14
27
  monitors,
15
- others: tasks.length - shells - monitors
28
+ wakeups,
29
+ others: tasks.length - shells - monitors - wakeups
16
30
  };
17
31
  }
@@ -176,6 +176,9 @@ export function agentTurnLabel(turn) {
176
176
  count: turn.messageFrom.length
177
177
  }));
178
178
  }
179
+ if (turn.wakeup === true) {
180
+ return i18next.t('agent-chat:activity.wakeup');
181
+ }
179
182
  if (!turn.label) {
180
183
  return i18next.t('agent-chat:turn.continued');
181
184
  }
@@ -22,6 +22,7 @@ export declare function exitCodeOf(output: string): {
22
22
  code: number | null;
23
23
  rest: string;
24
24
  };
25
+ export declare function toolFailed(tool: ChatToolItem): boolean;
25
26
  export declare function hasOutput(output: string | null): output is string;
26
27
  export declare function hasToolBody(tool: ChatToolItem): boolean;
27
28
  export declare function readImagePath(name: string, input: unknown): string | null;
@@ -91,6 +91,10 @@ export function exitCodeOf(output) {
91
91
  rest: output.slice(match[0].length)
92
92
  };
93
93
  }
94
+ /* A call a person stopped ended in error without failing, so it reads as neutral. */
95
+ export function toolFailed(tool) {
96
+ return tool.state === 'error' && tool.stopped !== true;
97
+ }
94
98
  export function hasOutput(output) {
95
99
  return output !== null && output.trim() !== '';
96
100
  }
@@ -1,9 +1,8 @@
1
1
  import { c as _c } from "react/compiler-runtime";
2
- import { taskIdOfRow } from '@adecore/agent-contracts';
2
+ import { scheduledWakeupAt, taskIdOfRow } from '@adecore/agent-contracts';
3
3
  import { Icon, IconButton, Popover, ScrollArea, Surface, useNow } from '@adecore/ui';
4
- import { formatElapsedShort } from '@adecore/ui/format';
5
4
  import clsx from 'clsx';
6
- import { Activity, MessageCircleQuestionMark, Square, SquareTerminal, TriangleAlert } from 'lucide-react';
5
+ import { Activity, Clock, MessageCircleQuestionMark, Square, SquareTerminal, TriangleAlert } from 'lucide-react';
7
6
  import { useState } from 'react';
8
7
  import { useTranslation } from 'react-i18next';
9
8
  import { useShallow } from 'zustand/shallow';
@@ -13,7 +12,7 @@ import { useHostTask, useHostTasks } from '../../host/host-hooks.js';
13
12
  import { useChatScope } from '../../scope.js';
14
13
  import { useChatRow, useChats } from '../../state/chats.js';
15
14
  import { useChatActions } from '../actions.js';
16
- import { backgroundCounts, backgroundTaskName } from '../activity.js';
15
+ import { backgroundCounts, backgroundTaskName, backgroundTaskTime } from '../activity.js';
17
16
  import { badgeCountOf, entryTimeOf, flyoutSubagents, progressOf, statusWordOf, subagentTitle, summaryWordOf, taskRowStateOf } from '../subagent-list.js';
18
17
  import { useSubagentSupport } from '../subagent-support.js';
19
18
  import { canOpenSubagent, crumbOf, openFromMain, useSubagentTrail } from '../subagent-view.js';
@@ -29,7 +28,7 @@ const ROW_BODY = 'flex min-h-9 min-w-0 grow items-center gap-2.5 rounded-md px-2
29
28
  * its workflows and what runs in the background. Without `workflows` an app shows them somewhere else.
30
29
  */
31
30
  export function ChatActivity(t0) {
32
- const $ = _c(30);
31
+ const $ = _c(31);
33
32
  const {
34
33
  chatId,
35
34
  workflows: t1
@@ -112,6 +111,7 @@ export function ChatActivity(t0) {
112
111
  const {
113
112
  shells,
114
113
  monitors,
114
+ wakeups,
115
115
  others
116
116
  } = t6;
117
117
  const Slot = host.SubagentSlot;
@@ -158,16 +158,18 @@ export function ChatActivity(t0) {
158
158
  t9 = $[18];
159
159
  }
160
160
  let t10;
161
- if ($[19] !== background || $[20] !== chatId || $[21] !== monitors || $[22] !== others || $[23] !== shells || $[24] !== t) {
161
+ if ($[19] !== background || $[20] !== chatId || $[21] !== monitors || $[22] !== others || $[23] !== shells || $[24] !== t || $[25] !== wakeups) {
162
162
  t10 = background.length > 0 && /*#__PURE__*/_jsx(Flyout, {
163
163
  icon: /*#__PURE__*/_jsx(Icon, {
164
- icon: shells > 0 ? SquareTerminal : Activity,
164
+ icon: shells > 0 ? SquareTerminal : wakeups === background.length ? Clock : Activity,
165
165
  size: 14
166
166
  }),
167
167
  label: [shells > 0 && t("activity.shells", {
168
168
  count: shells
169
169
  }), monitors > 0 && t("activity.monitors", {
170
170
  count: monitors
171
+ }), wakeups > 0 && t("activity.wakeups", {
172
+ count: wakeups
171
173
  }), others > 0 && t("activity.others", {
172
174
  count: others
173
175
  })].filter(Boolean).join(" \xB7 "),
@@ -182,22 +184,23 @@ export function ChatActivity(t0) {
182
184
  $[22] = others;
183
185
  $[23] = shells;
184
186
  $[24] = t;
185
- $[25] = t10;
187
+ $[25] = wakeups;
188
+ $[26] = t10;
186
189
  } else {
187
- t10 = $[25];
190
+ t10 = $[26];
188
191
  }
189
192
  let t11;
190
- if ($[26] !== t10 || $[27] !== t8 || $[28] !== t9) {
193
+ if ($[27] !== t10 || $[28] !== t8 || $[29] !== t9) {
191
194
  t11 = /*#__PURE__*/_jsxs("div", {
192
195
  className: t7,
193
196
  children: [t8, t9, t10]
194
197
  });
195
- $[26] = t10;
196
- $[27] = t8;
197
- $[28] = t9;
198
- $[29] = t11;
198
+ $[27] = t10;
199
+ $[28] = t8;
200
+ $[29] = t9;
201
+ $[30] = t11;
199
202
  } else {
200
- t11 = $[29];
203
+ t11 = $[30];
201
204
  }
202
205
  return t11;
203
206
  }
@@ -887,13 +890,13 @@ function BackgroundTaskRows(t0) {
887
890
  if ($[10] !== now || $[11] !== stop || $[12] !== t) {
888
891
  t3 = task => /*#__PURE__*/_jsx(ActivityRow, {
889
892
  icon: /*#__PURE__*/_jsx(Icon, {
890
- icon: task.kind === "shell" ? SquareTerminal : Activity,
893
+ icon: scheduledWakeupAt(task) !== null ? Clock : task.kind === "shell" ? SquareTerminal : Activity,
891
894
  size: 14,
892
895
  className: "shrink-0 text-text-faint"
893
896
  }),
894
897
  title: backgroundTaskName(task),
895
898
  detail: task.description ? task.command : null,
896
- time: formatElapsedShort(now - task.startedAt),
899
+ time: backgroundTaskTime(task, now),
897
900
  children: /*#__PURE__*/_jsx(IconButton, {
898
901
  icon: Square,
899
902
  size: "xs",
@@ -46,8 +46,9 @@ export declare function UnknownRow({ id, waits }: {
46
46
  id: string;
47
47
  waits: boolean;
48
48
  }): import("react").JSX.Element;
49
- export declare function AgentTurnRow({ label, onOpen }: {
49
+ export declare function AgentTurnRow({ label, wakeup, onOpen }: {
50
50
  label: string;
51
+ wakeup?: boolean;
51
52
  onOpen?: () => void;
52
53
  }): import("react").JSX.Element;
53
54
  export declare function CompactionRow({ preTokens, postTokens }: {
@@ -3,7 +3,7 @@ import { WAITING_NOTE_PREFIX } from '@adecore/agent-contracts';
3
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
- import { Bot, Brain, ChevronDown, CircleAlert, CircleCheck, CircleX, File, Info, MessageCircleQuestionMark, Reply, Send, SquareTerminal, TriangleAlert } from 'lucide-react';
6
+ import { Bot, Brain, ChevronDown, CircleAlert, CircleCheck, CircleX, Clock, File, Info, MessageCircleQuestionMark, Reply, Send, SquareTerminal, TriangleAlert } from 'lucide-react';
7
7
  import { useContext, useState } from 'react';
8
8
  import { useTranslation } from 'react-i18next';
9
9
  import { useChatHost } from '../../../host/host.js';
@@ -2246,83 +2246,96 @@ function OpenChatButton(t0) {
2246
2246
  * sub-agent came back with lives on its own row, which the header opens when the CLI named it.
2247
2247
  */
2248
2248
  export function AgentTurnRow(t0) {
2249
- const $ = _c(12);
2249
+ const $ = _c(16);
2250
2250
  const {
2251
2251
  label,
2252
+ wakeup: t1,
2252
2253
  onOpen
2253
2254
  } = t0;
2254
- let t1;
2255
- if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
2256
- t1 = /*#__PURE__*/_jsx("span", {
2255
+ const wakeup = t1 === undefined ? false : t1;
2256
+ const t2 = wakeup ? Clock : Bot;
2257
+ let t3;
2258
+ if ($[0] !== t2) {
2259
+ t3 = /*#__PURE__*/_jsx("span", {
2257
2260
  className: ROW_GUTTER,
2258
2261
  children: /*#__PURE__*/_jsx(Icon, {
2259
- icon: Bot,
2262
+ icon: t2,
2260
2263
  size: 12
2261
2264
  })
2262
2265
  });
2263
- $[0] = t1;
2266
+ $[0] = t2;
2267
+ $[1] = t3;
2264
2268
  } else {
2265
- t1 = $[0];
2269
+ t3 = $[1];
2266
2270
  }
2267
- const t2 = onOpen === undefined && "select-text";
2268
- let t3;
2269
- if ($[1] !== t2) {
2270
- t3 = clsx("min-w-0 truncate", t2);
2271
- $[1] = t2;
2272
- $[2] = t3;
2271
+ const t4 = onOpen === undefined && "select-text";
2272
+ let t5;
2273
+ if ($[2] !== t4) {
2274
+ t5 = clsx("min-w-0 truncate", t4);
2275
+ $[2] = t4;
2276
+ $[3] = t5;
2273
2277
  } else {
2274
- t3 = $[2];
2278
+ t5 = $[3];
2275
2279
  }
2276
- let t4;
2277
- if ($[3] !== label || $[4] !== t3) {
2278
- t4 = /*#__PURE__*/_jsxs(_Fragment, {
2279
- children: [t1, /*#__PURE__*/_jsx("span", {
2280
- className: t3,
2281
- children: label
2282
- })]
2280
+ let t6;
2281
+ if ($[4] !== label || $[5] !== t5) {
2282
+ t6 = /*#__PURE__*/_jsx("span", {
2283
+ className: t5,
2284
+ children: label
2283
2285
  });
2284
- $[3] = label;
2285
- $[4] = t3;
2286
- $[5] = t4;
2286
+ $[4] = label;
2287
+ $[5] = t5;
2288
+ $[6] = t6;
2287
2289
  } else {
2288
- t4 = $[5];
2290
+ t6 = $[6];
2289
2291
  }
2290
- const content = t4;
2292
+ let t7;
2293
+ if ($[7] !== t3 || $[8] !== t6) {
2294
+ t7 = /*#__PURE__*/_jsxs(_Fragment, {
2295
+ children: [t3, t6]
2296
+ });
2297
+ $[7] = t3;
2298
+ $[8] = t6;
2299
+ $[9] = t7;
2300
+ } else {
2301
+ t7 = $[9];
2302
+ }
2303
+ const content = t7;
2291
2304
  if (onOpen === undefined) {
2292
- let t5;
2293
- if ($[6] !== content) {
2294
- t5 = /*#__PURE__*/_jsx("div", {
2305
+ let t8;
2306
+ if ($[10] !== content) {
2307
+ t8 = /*#__PURE__*/_jsx("div", {
2295
2308
  className: "mb-0.5 flex h-7 w-full items-center gap-2 text-left text-xs text-text-muted",
2296
2309
  children: content
2297
2310
  });
2298
- $[6] = content;
2299
- $[7] = t5;
2311
+ $[10] = content;
2312
+ $[11] = t8;
2300
2313
  } else {
2301
- t5 = $[7];
2314
+ t8 = $[11];
2302
2315
  }
2303
- return t5;
2316
+ return t8;
2304
2317
  }
2305
- let t5;
2306
- if ($[8] === Symbol.for("react.memo_cache_sentinel")) {
2307
- t5 = clsx("mb-0.5 flex h-7 w-full items-center gap-2 text-left text-xs text-text-muted", "hover:text-text");
2308
- $[8] = t5;
2318
+ let t8;
2319
+ if ($[12] === Symbol.for("react.memo_cache_sentinel")) {
2320
+ t8 = clsx("mb-0.5 flex h-7 w-full items-center gap-2 text-left text-xs text-text-muted", "hover:text-text");
2321
+ $[12] = t8;
2309
2322
  } else {
2310
- t5 = $[8];
2323
+ t8 = $[12];
2311
2324
  }
2312
- let t6;
2313
- if ($[9] !== content || $[10] !== onOpen) {
2314
- t6 = /*#__PURE__*/_jsx("button", {
2315
- className: t5,
2325
+ let t9;
2326
+ if ($[13] !== content || $[14] !== onOpen) {
2327
+ t9 = /*#__PURE__*/_jsx("button", {
2328
+ className: t8,
2316
2329
  onClick: onOpen,
2317
2330
  children: content
2318
2331
  });
2319
- $[9] = content;
2320
- $[10] = onOpen;
2321
- $[11] = t6;
2332
+ $[13] = content;
2333
+ $[14] = onOpen;
2334
+ $[15] = t9;
2322
2335
  } else {
2323
- t6 = $[11];
2336
+ t9 = $[15];
2324
2337
  }
2325
- return t6;
2338
+ return t9;
2326
2339
  }
2327
2340
  /* A dashed line, since what stands above it is still there for the reader but only a summary to the agent. */
2328
2341
  export function CompactionRow(t0) {