@adecore/agents-react 0.65.2 → 0.66.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 (116) hide show
  1. package/dist/chat/activity.d.ts +5 -2
  2. package/dist/chat/activity.js +13 -2
  3. package/dist/chat/logic/bookmarks.d.ts +3 -2
  4. package/dist/chat/logic/continue-after-stop.d.ts +2 -2
  5. package/dist/chat/logic/fork.d.ts +7 -6
  6. package/dist/chat/logic/goal.d.ts +8 -3
  7. package/dist/chat/logic/goal.js +7 -1
  8. package/dist/chat/logic/handback.d.ts +2 -2
  9. package/dist/chat/logic/limit.d.ts +2 -2
  10. package/dist/chat/logic/limit.js +8 -0
  11. package/dist/chat/logic/resume-compaction.d.ts +4 -3
  12. package/dist/chat/logic/scrubber.d.ts +3 -2
  13. package/dist/chat/logic/timeline-target.d.ts +4 -3
  14. package/dist/chat/logic/timeline.d.ts +5 -4
  15. package/dist/chat/logic/timeline.js +9 -0
  16. package/dist/chat/recent-messages.d.ts +3 -3
  17. package/dist/chat/runtime-modes.d.ts +2 -1
  18. package/dist/chat/runtime-modes.js +5 -1
  19. package/dist/chat/subagent-conversation.d.ts +5 -4
  20. package/dist/chat/subagent-conversation.js +3 -2
  21. package/dist/chat/subagent-list.d.ts +4 -3
  22. package/dist/chat/subagent-view.d.ts +4 -3
  23. package/dist/chat/ui/ChatActivity.js +19 -15
  24. package/dist/chat/ui/Composer.d.ts +3 -2
  25. package/dist/chat/ui/GoalDock.d.ts +3 -2
  26. package/dist/chat/ui/GoalDock.js +19 -28
  27. package/dist/chat/ui/LimitState.d.ts +2 -2
  28. package/dist/chat/ui/RunSettings.d.ts +3 -2
  29. package/dist/chat/ui/RunSettings.js +318 -298
  30. package/dist/chat/ui/composer/ComposerControls.d.ts +2 -2
  31. package/dist/chat/ui/composer/use-chat-controls.d.ts +3 -2
  32. package/dist/chat/ui/composer/use-compaction-offer.d.ts +3 -2
  33. package/dist/chat/ui/composer/use-composer-menus.d.ts +3 -2
  34. package/dist/chat/ui/composer/use-continuable-turn.d.ts +2 -2
  35. package/dist/chat/ui/composer/use-effort-stepper.d.ts +3 -2
  36. package/dist/chat/ui/reply-context.d.ts +2 -2
  37. package/dist/chat/ui/rows/MessageRows.d.ts +4 -0
  38. package/dist/chat/ui/rows/MessageRows.js +61 -1
  39. package/dist/chat/ui/rows/Rows.js +42 -26
  40. package/dist/chat/ui/rows/SubagentRow.d.ts +3 -2
  41. package/dist/chat/ui/rows/WorkRows.d.ts +3 -2
  42. package/dist/chat/waiting-on.d.ts +5 -4
  43. package/dist/chat/waiting-on.js +2 -1
  44. package/dist/chat/workflow-list.d.ts +3 -2
  45. package/dist/chat-client.d.ts +2 -1
  46. package/dist/chat-sink.d.ts +16 -9
  47. package/dist/host/host-hooks.d.ts +2 -1
  48. package/dist/host/host-hooks.js +5 -0
  49. package/dist/host/host.d.ts +8 -2
  50. package/dist/host/timeline-row.d.ts +10 -4
  51. package/dist/index.d.ts +2 -2
  52. package/dist/locales/en/agent-chat.d.ts +16 -0
  53. package/dist/locales/en/agent-chat.js +17 -1
  54. package/dist/locales/nl/agent-chat.d.ts +16 -0
  55. package/dist/locales/nl/agent-chat.js +17 -1
  56. package/dist/port-transport.d.ts +10 -1
  57. package/dist/port-transport.js +14 -3
  58. package/dist/state/chats.d.ts +17 -15
  59. package/dist/state/chats.js +7 -0
  60. package/dist/state/index.d.ts +1 -1
  61. package/dist/state/usage.d.ts +3 -2
  62. package/dist/state/usage.js +34 -3
  63. package/dist/transport.d.ts +3 -2
  64. package/dist/usage/limit-groups.js +1 -1
  65. package/package.json +9 -9
  66. package/src/chat/activity.ts +19 -6
  67. package/src/chat/forks.ts +3 -3
  68. package/src/chat/logic/bookmarks.ts +3 -2
  69. package/src/chat/logic/continue-after-stop.ts +3 -2
  70. package/src/chat/logic/fork.ts +8 -7
  71. package/src/chat/logic/goal.ts +13 -4
  72. package/src/chat/logic/handback.ts +2 -3
  73. package/src/chat/logic/limit.ts +7 -2
  74. package/src/chat/logic/resume-compaction.ts +7 -6
  75. package/src/chat/logic/scrubber.ts +4 -3
  76. package/src/chat/logic/timeline-target.ts +4 -3
  77. package/src/chat/logic/timeline.ts +22 -16
  78. package/src/chat/pending-prompts.ts +3 -2
  79. package/src/chat/recent-messages.ts +5 -6
  80. package/src/chat/runtime-modes.ts +7 -2
  81. package/src/chat/subagent-conversation.ts +12 -9
  82. package/src/chat/subagent-list.ts +4 -3
  83. package/src/chat/subagent-view.ts +4 -3
  84. package/src/chat/ui/ChatActivity.tsx +11 -7
  85. package/src/chat/ui/Composer.tsx +3 -2
  86. package/src/chat/ui/GoalDock.tsx +6 -5
  87. package/src/chat/ui/LimitState.tsx +5 -5
  88. package/src/chat/ui/RunSettings.tsx +17 -9
  89. package/src/chat/ui/composer/ComposerControls.tsx +3 -2
  90. package/src/chat/ui/composer/use-chat-controls.ts +3 -2
  91. package/src/chat/ui/composer/use-compaction-offer.ts +4 -3
  92. package/src/chat/ui/composer/use-composer-menus.ts +3 -2
  93. package/src/chat/ui/composer/use-continuable-turn.ts +3 -3
  94. package/src/chat/ui/composer/use-effort-stepper.ts +3 -2
  95. package/src/chat/ui/reply-context.ts +2 -2
  96. package/src/chat/ui/rows/MessageRows.tsx +17 -1
  97. package/src/chat/ui/rows/Rows.tsx +3 -0
  98. package/src/chat/ui/rows/SubagentRow.tsx +5 -4
  99. package/src/chat/ui/rows/WorkRows.tsx +3 -2
  100. package/src/chat/ui/thread-references.ts +3 -3
  101. package/src/chat/waiting-on.ts +8 -7
  102. package/src/chat/workflow-list.ts +3 -2
  103. package/src/chat-client.ts +3 -2
  104. package/src/chat-sink.ts +21 -9
  105. package/src/host/host-hooks.ts +9 -1
  106. package/src/host/host.ts +13 -2
  107. package/src/host/timeline-row.ts +7 -5
  108. package/src/index.ts +2 -1
  109. package/src/locales/en/agent-chat.ts +17 -1
  110. package/src/locales/nl/agent-chat.ts +17 -1
  111. package/src/port-transport.ts +20 -3
  112. package/src/state/chats.ts +34 -35
  113. package/src/state/index.ts +1 -1
  114. package/src/state/usage.ts +45 -5
  115. package/src/transport.ts +4 -2
  116. package/src/usage/limit-groups.ts +1 -1
@@ -1,5 +1,8 @@
1
- import type { ChatBackgroundTask } from '@adecore/agent-contracts';
2
- export declare function backgroundCounts(tasks: readonly ChatBackgroundTask[]): {
1
+ import type { ChatThreadInfo } from '../chat-sink.js';
2
+ export type ChatThreadBackgroundTask = NonNullable<ChatThreadInfo['background']>[number];
3
+ export declare function backgroundTaskName(task: ChatThreadBackgroundTask): string;
4
+ export declare function backgroundCounts(tasks: readonly ChatThreadBackgroundTask[]): {
3
5
  shells: number;
4
6
  monitors: number;
7
+ others: number;
5
8
  };
@@ -1,6 +1,17 @@
1
+ import i18next from 'i18next';
2
+ /* What a person reads for a task: what it does, else the command, else its kind. */
3
+ export function backgroundTaskName(task) {
4
+ if (task.description || task.command) {
5
+ return task.description || task.command || '';
6
+ }
7
+ return task.kind === 'shell' || task.kind === 'monitor' ? i18next.t(`agent-chat:activity.${task.kind}`) : i18next.t('agent-chat:activity.other');
8
+ }
1
9
  export function backgroundCounts(tasks) {
10
+ const shells = tasks.filter(task => task.kind === 'shell').length;
11
+ const monitors = tasks.filter(task => task.kind === 'monitor').length;
2
12
  return {
3
- shells: tasks.filter(task => task.kind === 'shell').length,
4
- monitors: tasks.filter(task => task.kind === 'monitor').length
13
+ shells,
14
+ monitors,
15
+ others: tasks.length - shells - monitors
5
16
  };
6
17
  }
@@ -1,5 +1,6 @@
1
- import type { ChatBookmark, ChatItem } from '@adecore/agent-contracts';
1
+ import type { ChatBookmark } from '@adecore/agent-contracts';
2
+ import type { ChatThreadItem } from '../../chat-sink.js';
2
3
  import type { TimelineRow } from '../../host/timeline-row.js';
3
4
  export declare function bookmarkLabel(bookmark: ChatBookmark): string;
4
5
  export declare function bookmarksInThreadOrder(bookmarks: readonly ChatBookmark[], order: readonly string[]): ChatBookmark[];
5
- export declare function bookmarkRows(rows: readonly TimelineRow[], bookmarks: readonly ChatBookmark[], items: Readonly<Record<string, ChatItem>>): Map<string, ChatBookmark>;
6
+ export declare function bookmarkRows(rows: readonly TimelineRow[], bookmarks: readonly ChatBookmark[], items: Readonly<Record<string, ChatThreadItem>>): Map<string, ChatBookmark>;
@@ -1,3 +1,3 @@
1
- import { type ChatInfo, type ChatItem } from '@adecore/agent-contracts';
1
+ import type { ChatThreadInfo, ChatThreadItem } from '../../chat-sink.js';
2
2
  export declare const CONTINUE_PROMPT = "Continue.";
3
- export declare function continuableTurn(info: ChatInfo, items: readonly ChatItem[]): string | null;
3
+ export declare function continuableTurn(info: ChatThreadInfo, items: readonly ChatThreadItem[]): string | null;
@@ -1,4 +1,5 @@
1
- import type { AgentKind, ChatForkPayload, ChatInfo, ChatItem, ModelSelection, ProviderInfo } from '@adecore/agent-contracts';
1
+ import type { AgentKind, ChatForkPayload, ModelSelection, ProviderInfo } from '@adecore/agent-contracts';
2
+ import type { ChatThreadInfo, ChatThreadItem } from '../../chat-sink.js';
2
3
  import type { TimelineRow } from '../../host/timeline-row.js';
3
4
  interface HostProviders {
4
5
  readonly providers: readonly ProviderInfo[];
@@ -13,15 +14,15 @@ interface ForkPoint {
13
14
  last: boolean;
14
15
  prompt: string | null;
15
16
  }
16
- export declare function forkRefusal(info: ChatInfo | null, turn: ChatItem | undefined, host: HostProviders): string | null;
17
+ export declare function forkRefusal(info: ChatThreadInfo | null, turn: ChatThreadItem | undefined, host: HostProviders): string | null;
17
18
  export declare function summaryRefusal(state: {
18
19
  busy: boolean;
19
20
  originalPresent: boolean;
20
21
  }): string | null;
21
- export declare function forkIdsAfter(infos: Iterable<ChatInfo>, chatId: string, turnId: string): string[];
22
- export declare function forkedTurnIds(infos: Iterable<ChatInfo>, chatId: string): Set<string>;
23
- export declare function lastSettledTurn(items: Record<string, ChatItem>, order: readonly string[]): string | null;
24
- export declare function forkPointOf(items: Record<string, ChatItem>, order: readonly string[], turnId: string, whole: boolean): ForkPoint | null;
22
+ export declare function forkIdsAfter(infos: Iterable<ChatThreadInfo>, chatId: string, turnId: string): string[];
23
+ export declare function forkedTurnIds(infos: Iterable<ChatThreadInfo>, chatId: string): Set<string>;
24
+ export declare function lastSettledTurn(items: Record<string, ChatThreadItem>, order: readonly string[]): string | null;
25
+ export declare function forkPointOf(items: Record<string, ChatThreadItem>, order: readonly string[], turnId: string, whole: boolean): ForkPoint | null;
25
26
  export declare function forkPointLabel(point: ForkPoint, maxPrompt?: number): string;
26
27
  export declare function turnIdOfRow(row: TimelineRow): string | null;
27
28
  export type ForkShape = 'node' | 'view';
@@ -1,7 +1,12 @@
1
- import type { ChatGoal, ChatGoalAction, ChatInfo, ProviderCapabilities } from '@adecore/agent-contracts';
1
+ import { type ChatGoalAction, type ChatGoalStatus, type ProviderCapabilities } from '@adecore/agent-contracts';
2
+ import type { ChatThreadInfo } from '../../chat-sink.js';
3
+ type Goal = NonNullable<ChatThreadInfo['goal']>;
4
+ export declare function knownGoalStatus(goal: Goal): goal is Goal & {
5
+ status: ChatGoalStatus;
6
+ };
2
7
  interface GoalView {
3
- goal: ChatGoal;
8
+ goal: Goal;
4
9
  actions: ChatGoalAction[];
5
10
  }
6
- export declare function goalView(info: Pick<ChatInfo, 'goal' | 'activeTurnId'>, goals: ProviderCapabilities['goals'], canAct: boolean): GoalView | null;
11
+ export declare function goalView(info: Pick<ChatThreadInfo, 'goal' | 'activeTurnId'>, goals: ProviderCapabilities['goals'], canAct: boolean): GoalView | null;
7
12
  export {};
@@ -1,3 +1,8 @@
1
+ import { ChatGoalStatusSchema } from '@adecore/agent-contracts';
2
+ /* Whether this version knows the goal's state, so it can word it and say what may be done to it. */
3
+ export function knownGoalStatus(goal) {
4
+ return ChatGoalStatusSchema.options.includes(goal.status);
5
+ }
1
6
  /*
2
7
  * The row above the composer while the chat has a goal. A CLI with calls for goals pauses, resumes and
3
8
  * clears it at any time; one that only reads `/goal` clears it with a turn of its own, so only between
@@ -21,9 +26,10 @@ export function goalView(info, goals, canAct) {
21
26
  };
22
27
  }
23
28
  const actions = [];
29
+ // A state of a newer host may mean either, so only a clear is offered for it.
24
30
  if (goal.status === 'active') {
25
31
  actions.push('pause');
26
- } else if (goal.status !== 'complete') {
32
+ } else if (knownGoalStatus(goal) && goal.status !== 'complete') {
27
33
  actions.push('resume');
28
34
  }
29
35
  actions.push('clear');
@@ -1,2 +1,2 @@
1
- import type { ChatItem } from '@adecore/agent-contracts';
2
- export declare function handbackReportOf(item: ChatItem): string | null;
1
+ export declare function handbackReportOf(item: ChatThreadItem): string | null;
2
+ import type { ChatThreadItem } from '../../chat-sink.js';
@@ -1,8 +1,8 @@
1
- import type { ChatInfo } from '@adecore/agent-contracts';
1
+ import type { ChatThreadInfo } from '../../chat-sink.js';
2
2
  interface LimitView {
3
3
  pill: string;
4
4
  title: string;
5
5
  detail: string | null;
6
6
  }
7
- export declare function limitView(info: Pick<ChatInfo, 'limit' | 'resumeAt' | 'activeTurnId'>, now: number): LimitView | null;
7
+ export declare function limitView(info: Pick<ChatThreadInfo, 'limit' | 'resumeAt' | 'activeTurnId'>, now: number): LimitView | null;
8
8
  export {};
@@ -21,6 +21,14 @@ export function limitView(info, now) {
21
21
  })
22
22
  };
23
23
  }
24
+ // A kind of a newer host says only that the turn stopped, never which limit it was.
25
+ if (limit.kind !== 'usage') {
26
+ return {
27
+ pill: i18next.t('agent-chat:limit.other.pill'),
28
+ title: i18next.t('agent-chat:limit.other.title'),
29
+ detail: null
30
+ };
31
+ }
24
32
  const title = i18next.t('agent-chat:limit.usage.title');
25
33
  if (resumes !== null) {
26
34
  return {
@@ -1,4 +1,5 @@
1
- import type { ChatInfo, ChatItem, ProviderCapabilities } from '@adecore/agent-contracts';
1
+ import type { ProviderCapabilities } from '@adecore/agent-contracts';
2
+ import type { ChatThreadInfo, ChatThreadItem } from '../../chat-sink.js';
2
3
  export declare const RESUME_COMPACTION_TOKENS = 100000;
3
4
  export declare const RESUME_COMPACTION_IDLE_MS: number;
4
5
  export type ResumeCompactionReason = 'cache-expired' | 'idle';
@@ -8,9 +9,9 @@ export interface ResumeCompactionOffer {
8
9
  reason: ResumeCompactionReason;
9
10
  }
10
11
  interface OfferInput {
11
- info: ChatInfo;
12
+ info: ChatThreadInfo;
12
13
  compaction: ProviderCapabilities['compaction'] | undefined;
13
- items: readonly ChatItem[];
14
+ items: readonly ChatThreadItem[];
14
15
  dismissedTurnId: string | null;
15
16
  }
16
17
  export declare function resumeCompactionDueAt(input: OfferInput): number | null;
@@ -1,4 +1,5 @@
1
- import type { ChatBookmark, ChatItem } from '@adecore/agent-contracts';
1
+ import type { ChatBookmark } from '@adecore/agent-contracts';
2
+ import type { ChatThreadItem } from '../../chat-sink.js';
2
3
  import { type TimelineRow } from '../../host/timeline-row.js';
3
4
  export type TickKind = 'person' | 'wake' | 'bookmark';
4
5
  export interface ScrubberTick {
@@ -16,7 +17,7 @@ export declare const STRIP_WIDTH_PX = 24;
16
17
  export declare const STRIP_INSET_PX = 8;
17
18
  export declare const STRIP_CLEARANCE_PX: number;
18
19
  export declare const EARLIER_ROW = -1;
19
- export declare function ticksOf(rows: readonly TimelineRow[], marks?: ReadonlyMap<string, ChatBookmark>, earlier?: readonly ChatItem[], bookmarks?: readonly ChatBookmark[]): ScrubberTick[];
20
+ export declare function ticksOf(rows: readonly TimelineRow[], marks?: ReadonlyMap<string, ChatBookmark>, earlier?: readonly ChatThreadItem[], bookmarks?: readonly ChatBookmark[]): ScrubberTick[];
20
21
  interface TickSlot {
21
22
  first: number;
22
23
  last: number;
@@ -1,4 +1,5 @@
1
- import type { ChatItem, ChatUiChoiceOrigin } from '@adecore/agent-contracts';
1
+ import type { ChatUiChoiceOrigin } from '@adecore/agent-contracts';
2
+ import type { ChatThreadItem } from '../../chat-sink.js';
2
3
  import type { FileRef } from '../../host/host.js';
3
4
  import type { TimelineRow } from '../../host/timeline-row.js';
4
5
  export interface TimelineTarget {
@@ -14,7 +15,7 @@ export interface TimelineTarget {
14
15
  } | null;
15
16
  }
16
17
  export declare const EMPTY_TARGET: TimelineTarget;
17
- export declare function withCurrentText(rows: TimelineRow[], items: Record<string, ChatItem> | undefined): TimelineRow[];
18
+ export declare function withCurrentText(rows: TimelineRow[], items: Record<string, ChatThreadItem> | undefined): TimelineRow[];
18
19
  export declare function readTimelineTarget(element: HTMLElement, scroller: HTMLElement | null, rows: TimelineRow[]): TimelineTarget;
19
20
  export type UiReplyTarget = Pick<ChatUiChoiceOrigin, 'itemId' | 'blockId' | 'revision'>;
20
21
  type UiReplyJump = {
@@ -26,6 +27,6 @@ type UiReplyJump = {
26
27
  kind: 'row';
27
28
  index: number;
28
29
  };
29
- export declare function uiReplyJump(target: UiReplyTarget, rows: readonly TimelineRow[], items: Record<string, ChatItem> | undefined, expandedTurns: ReadonlySet<string>, hasEarlier: boolean): UiReplyJump;
30
+ export declare function uiReplyJump(target: UiReplyTarget, rows: readonly TimelineRow[], items: Record<string, ChatThreadItem> | undefined, expandedTurns: ReadonlySet<string>, hasEarlier: boolean): UiReplyJump;
30
31
  export declare function revealUiReplyBlock(scroller: HTMLElement, target: UiReplyTarget): boolean;
31
32
  export {};
@@ -1,4 +1,5 @@
1
- import type { ChatItem, ChatToolItem, ChatTurnItem } from '@adecore/agent-contracts';
1
+ import type { ChatToolItem } from '@adecore/agent-contracts';
2
+ import type { ChatThreadItem, ChatThreadTurn } from '../../chat-sink.js';
2
3
  import type { CommandLook, ToolLook } from '../../host/host.js';
3
4
  import type { SubagentBranch, TimelineRow } from '../../host/timeline-row.js';
4
5
  interface TimelineOptions {
@@ -14,11 +15,11 @@ interface TimelineOptions {
14
15
  export declare function isBlock(row: TimelineRow): boolean;
15
16
  export declare function summarizeGroup(tools: ChatToolItem[], looks?: readonly CommandLook[], toolLooks?: readonly ToolLook[]): string;
16
17
  export declare function summarizeTurn(tools: readonly ChatToolItem[], looks?: readonly CommandLook[], toolLooks?: readonly ToolLook[]): string[];
17
- export declare function agentTurnLabel(turn: ChatTurnItem): string;
18
- export declare function turnLabel(turn: ChatTurnItem, items?: readonly ChatItem[]): string;
18
+ export declare function agentTurnLabel(turn: ChatThreadTurn): string;
19
+ export declare function turnLabel(turn: ChatThreadTurn, items?: readonly ChatThreadItem[]): string;
19
20
  export declare function findSubagentBranch(rows: readonly TimelineRow[], toolUseId: string): {
20
21
  index: number;
21
22
  branch: SubagentBranch;
22
23
  } | null;
23
- export declare function deriveTimelineRows(items: ChatItem[], options: TimelineOptions): TimelineRow[];
24
+ export declare function deriveTimelineRows(items: ChatThreadItem[], options: TimelineOptions): TimelineRow[];
24
25
  export {};
@@ -1,6 +1,7 @@
1
1
  import { abortedByMachine } from '@adecore/agent-contracts';
2
2
  import { formatElapsedShort } from '@adecore/ui/format';
3
3
  import i18next from 'i18next';
4
+ import { waitsOnTheHost } from '../../state/chats.js';
4
5
  import { lookKey, lookRunOf, sentMessageOf } from './command-looks.js';
5
6
  import { isImageGeneration } from './generated-image.js';
6
7
  import { handbackReportOf } from './handback.js';
@@ -434,6 +435,14 @@ function rowsForItems(items, options, children) {
434
435
  })
435
436
  });
436
437
  break;
438
+ case 'unknown':
439
+ rows.push({
440
+ kind: 'unknown',
441
+ id: item.id,
442
+ item,
443
+ waits: waitsOnTheHost(item)
444
+ });
445
+ break;
437
446
  case 'turn':
438
447
  break;
439
448
  }
@@ -1,4 +1,3 @@
1
- import type { ChatItem } from '@adecore/agent-contracts';
2
1
  interface RecentChatMessage {
3
2
  role: 'user' | 'assistant';
4
3
  text: string;
@@ -8,6 +7,7 @@ interface RecentChatMessages {
8
7
  messages: RecentChatMessage[];
9
8
  truncated: boolean;
10
9
  }
11
- export declare function recentChatMessages(items: Record<string, ChatItem>, order: readonly string[], limit: number): RecentChatMessages;
12
- export declare function recentSubagentMessages(items: readonly ChatItem[], limit: number): RecentChatMessages;
10
+ export declare function recentChatMessages(items: Record<string, ChatThreadItem>, order: readonly string[], limit: number): RecentChatMessages;
11
+ export declare function recentSubagentMessages(items: readonly ChatThreadItem[], limit: number): RecentChatMessages;
12
+ import type { ChatThreadItem } from '../chat-sink.js';
13
13
  export {};
@@ -1,4 +1,5 @@
1
1
  import { type RuntimeMode } from '@adecore/agent-contracts';
2
2
  export declare const RUNTIME_MODES: readonly RuntimeMode[];
3
- export declare function runtimeModeLabel(mode: RuntimeMode): string;
3
+ export declare function isKnownRuntimeMode(mode: string): mode is RuntimeMode;
4
+ export declare function runtimeModeLabel(mode: string): string;
4
5
  export declare function runtimeModeHint(mode: RuntimeMode): string;
@@ -5,8 +5,12 @@ import i18next from 'i18next';
5
5
  * from narrowest to widest. Their words are read when a view draws one, not when this module loads.
6
6
  */
7
7
  export const RUNTIME_MODES = RuntimeModeSchema.options;
8
+ /* Whether this version knows a mode a host reports; a newer host's mode is shown as set there and never sent back as another. */
9
+ export function isKnownRuntimeMode(mode) {
10
+ return RUNTIME_MODES.includes(mode);
11
+ }
8
12
  export function runtimeModeLabel(mode) {
9
- return i18next.t(`agent-chat:modes.${mode}.label`);
13
+ return isKnownRuntimeMode(mode) ? i18next.t(`agent-chat:modes.${mode}.label`) : i18next.t('agent-chat:modes.unknown.label');
10
14
  }
11
15
  export function runtimeModeHint(mode) {
12
16
  return i18next.t(`agent-chat:modes.${mode}.hint`);
@@ -1,8 +1,9 @@
1
- import type { ChatApprovalItem, ChatItem, ChatQuestionItem, ChatSubagentResult } from '@adecore/agent-contracts';
1
+ import type { ChatApprovalItem, ChatQuestionItem, ChatSubagentResult } from '@adecore/agent-contracts';
2
+ import type { ChatThreadItem } from '../chat-sink.js';
2
3
  import { type ChatTransport } from '../transport.js';
3
4
  export interface SubagentConversationState {
4
5
  status: 'loading' | 'ready' | 'failed';
5
- items: ChatItem[];
6
+ items: ChatThreadItem[];
6
7
  pending: Array<ChatApprovalItem | ChatQuestionItem>;
7
8
  source: ChatSubagentResult['source'] | null;
8
9
  context: NonNullable<ChatSubagentResult['context']> | null;
@@ -13,8 +14,8 @@ export interface SubagentConversationState {
13
14
  unsupported: boolean;
14
15
  }
15
16
  export declare const INITIAL_CONVERSATION: SubagentConversationState;
16
- export declare function mergeNewest(current: ChatItem[], currentCursor: string | null, page: ChatItem[], pageCursor: string | null): {
17
- items: ChatItem[];
17
+ export declare function mergeNewest(current: ChatThreadItem[], currentCursor: string | null, page: ChatThreadItem[], pageCursor: string | null): {
18
+ items: ChatThreadItem[];
18
19
  cursor: string | null;
19
20
  };
20
21
  export declare class SubagentConversation {
@@ -116,7 +116,7 @@ export class SubagentConversation {
116
116
  const items = [...page.items, ...this.state.items];
117
117
  this.set({
118
118
  items,
119
- pending: page.pending ?? pendingOf(items),
119
+ pending: pendingOf(page.pending ?? items),
120
120
  cursor: page.history.cursor,
121
121
  live: page.live,
122
122
  loadingEarlier: false
@@ -171,7 +171,8 @@ export class SubagentConversation {
171
171
  this.set({
172
172
  status: 'ready',
173
173
  items: merged.items,
174
- pending: page.pending ?? pendingOf(merged.items),
174
+ // A request this version cannot read is never answered from here; its row in the thread says where to.
175
+ pending: pendingOf(page.pending ?? merged.items),
175
176
  cursor: merged.cursor,
176
177
  live: page.live,
177
178
  source: page.source,
@@ -1,17 +1,18 @@
1
- import { type ChatInfo, type ChatItem, type ChatSubagentItem } from '@adecore/agent-contracts';
1
+ import { type ChatSubagentItem } from '@adecore/agent-contracts';
2
2
  import type { StatusWord } from '../agents/status-look.js';
3
+ import type { ChatThreadInfo, ChatThreadItem } from '../chat-sink.js';
3
4
  import type { SubagentTask } from '../host/host.js';
4
5
  export declare function subagentTitle(item: ChatSubagentItem): string;
5
6
  export declare function statusWordOf(item: ChatSubagentItem, task: SubagentTask | null): StatusWord;
6
7
  export type TaskRowState = StatusWord | 'waiting';
7
- export declare function taskRowStateOf(item: ChatSubagentItem, task: SubagentTask | null, child: ChatInfo | undefined): TaskRowState;
8
+ export declare function taskRowStateOf(item: ChatSubagentItem, task: SubagentTask | null, child: ChatThreadInfo | undefined): TaskRowState;
8
9
  export declare function progressOf(states: readonly TaskRowState[]): {
9
10
  done: number;
10
11
  total: number;
11
12
  waiting: number;
12
13
  active: number;
13
14
  };
14
- export declare function flyoutSubagents(order: readonly string[], structure: Readonly<Record<string, ChatItem>>): ChatSubagentItem[];
15
+ export declare function flyoutSubagents(order: readonly string[], structure: Readonly<Record<string, ChatThreadItem>>): ChatSubagentItem[];
15
16
  export declare function summaryWordOf(words: readonly StatusWord[]): StatusWord;
16
17
  export declare function badgeCountOf(words: readonly StatusWord[]): number;
17
18
  export declare function entryTimeOf(item: ChatSubagentItem, task: SubagentTask | null, now: number): string;
@@ -1,4 +1,5 @@
1
- import type { ChatItem, ChatSubagentItem } from '@adecore/agent-contracts';
1
+ import type { ChatSubagentItem } from '@adecore/agent-contracts';
2
+ import type { ChatThreadItem } from '../chat-sink.js';
2
3
  export interface SubagentStep {
3
4
  toolUseId: string;
4
5
  description: string;
@@ -18,8 +19,8 @@ export declare function stepBack(trail: SubagentTrail): SubagentTrail;
18
19
  export declare function composerWrites(trail: SubagentTrail): boolean;
19
20
  export declare function breadcrumbOf(trail: SubagentTrail): BreadcrumbStep[];
20
21
  export declare function canOpenSubagent(item: ChatSubagentItem, machineRefused: boolean): boolean;
21
- export declare function subagentOf(structure: Readonly<Record<string, ChatItem>>, toolUseId: string): ChatSubagentItem | null;
22
- export declare function openableSubagents(order: readonly string[], structure: Record<string, ChatItem>, machineRefused: boolean): ChatSubagentItem[];
22
+ export declare function subagentOf(structure: Readonly<Record<string, ChatThreadItem>>, toolUseId: string): ChatSubagentItem | null;
23
+ export declare function openableSubagents(order: readonly string[], structure: Record<string, ChatThreadItem>, machineRefused: boolean): ChatSubagentItem[];
23
24
  interface SubagentViewStore {
24
25
  trails: Record<string, SubagentTrail>;
25
26
  show(key: string, trail: SubagentTrail): void;
@@ -13,7 +13,7 @@ import { useHostTask, useHostTasks } from '../../host/host-hooks.js';
13
13
  import { useChatScope } from '../../scope.js';
14
14
  import { useChatRow, useChats } from '../../state/chats.js';
15
15
  import { useChatActions } from '../actions.js';
16
- import { backgroundCounts } from '../activity.js';
16
+ import { backgroundCounts, backgroundTaskName } from '../activity.js';
17
17
  import { badgeCountOf, entryTimeOf, flyoutSubagents, progressOf, statusWordOf, subagentTitle, summaryWordOf, taskRowStateOf } from '../subagent-list.js';
18
18
  import { useSubagentSupport } from '../subagent-support.js';
19
19
  import { canOpenSubagent, crumbOf, openFromMain, useSubagentTrail } from '../subagent-view.js';
@@ -29,7 +29,7 @@ const ROW_BODY = 'flex min-h-9 min-w-0 grow items-center gap-2.5 rounded-md px-2
29
29
  * its workflows and what runs in the background. Without `workflows` an app shows them somewhere else.
30
30
  */
31
31
  export function ChatActivity(t0) {
32
- const $ = _c(29);
32
+ const $ = _c(30);
33
33
  const {
34
34
  chatId,
35
35
  workflows: t1
@@ -111,7 +111,8 @@ export function ChatActivity(t0) {
111
111
  }
112
112
  const {
113
113
  shells,
114
- monitors
114
+ monitors,
115
+ others
115
116
  } = t6;
116
117
  const Slot = host.SubagentSlot;
117
118
  const counting = progress.active > 0 && progress.total > 1;
@@ -157,7 +158,7 @@ export function ChatActivity(t0) {
157
158
  t9 = $[18];
158
159
  }
159
160
  let t10;
160
- if ($[19] !== background || $[20] !== chatId || $[21] !== monitors || $[22] !== shells || $[23] !== t) {
161
+ if ($[19] !== background || $[20] !== chatId || $[21] !== monitors || $[22] !== others || $[23] !== shells || $[24] !== t) {
161
162
  t10 = background.length > 0 && /*#__PURE__*/_jsx(Flyout, {
162
163
  icon: /*#__PURE__*/_jsx(Icon, {
163
164
  icon: shells > 0 ? SquareTerminal : Activity,
@@ -167,6 +168,8 @@ export function ChatActivity(t0) {
167
168
  count: shells
168
169
  }), monitors > 0 && t("activity.monitors", {
169
170
  count: monitors
171
+ }), others > 0 && t("activity.others", {
172
+ count: others
170
173
  })].filter(Boolean).join(" \xB7 "),
171
174
  children: /*#__PURE__*/_jsx(BackgroundTaskRows, {
172
175
  chatId: chatId,
@@ -176,24 +179,25 @@ export function ChatActivity(t0) {
176
179
  $[19] = background;
177
180
  $[20] = chatId;
178
181
  $[21] = monitors;
179
- $[22] = shells;
180
- $[23] = t;
181
- $[24] = t10;
182
+ $[22] = others;
183
+ $[23] = shells;
184
+ $[24] = t;
185
+ $[25] = t10;
182
186
  } else {
183
- t10 = $[24];
187
+ t10 = $[25];
184
188
  }
185
189
  let t11;
186
- if ($[25] !== t10 || $[26] !== t8 || $[27] !== t9) {
190
+ if ($[26] !== t10 || $[27] !== t8 || $[28] !== t9) {
187
191
  t11 = /*#__PURE__*/_jsxs("div", {
188
192
  className: t7,
189
193
  children: [t8, t9, t10]
190
194
  });
191
- $[25] = t10;
192
- $[26] = t8;
193
- $[27] = t9;
194
- $[28] = t11;
195
+ $[26] = t10;
196
+ $[27] = t8;
197
+ $[28] = t9;
198
+ $[29] = t11;
195
199
  } else {
196
- t11 = $[28];
200
+ t11 = $[29];
197
201
  }
198
202
  return t11;
199
203
  }
@@ -887,7 +891,7 @@ function BackgroundTaskRows(t0) {
887
891
  size: 14,
888
892
  className: "shrink-0 text-text-faint"
889
893
  }),
890
- title: task.description || task.command || t(`activity.${task.kind}`),
894
+ title: backgroundTaskName(task),
891
895
  detail: task.description ? task.command : null,
892
896
  time: formatElapsedShort(now - task.startedAt),
893
897
  children: /*#__PURE__*/_jsx(IconButton, {
@@ -1,8 +1,9 @@
1
- import type { AgentKind, ChatInfo, ModelSelection } from '@adecore/agent-contracts';
1
+ import type { AgentKind, ModelSelection } from '@adecore/agent-contracts';
2
2
  import type { ChatSendExtras } from '../../chat-client.js';
3
+ import type { ChatThreadInfo } from '../../chat-sink.js';
3
4
  interface ComposerProps {
4
5
  chatId: string;
5
- info: ChatInfo;
6
+ info: ChatThreadInfo;
6
7
  focused: boolean;
7
8
  answerPromptsElsewhere?: () => void;
8
9
  disabled: boolean;
@@ -1,7 +1,8 @@
1
- import type { ChatInfo, ProviderCapabilities } from '@adecore/agent-contracts';
1
+ import type { ProviderCapabilities } from '@adecore/agent-contracts';
2
+ import type { ChatThreadInfo } from '../../chat-sink.js';
2
3
  export declare function GoalDock({ chatId, info, goals }: {
3
4
  chatId: string;
4
- info: ChatInfo;
5
+ info: ChatThreadInfo;
5
6
  goals: ProviderCapabilities['goals'];
6
7
  }): import("react").JSX.Element | null;
7
8
  export declare function GoalPill({ chatId }: {
@@ -10,7 +10,7 @@ import { useChatScope } from '../../scope.js';
10
10
  import { useChats } from '../../state/chats.js';
11
11
  import { errorMessage } from '../../transport.js';
12
12
  import { useChatActions } from '../actions.js';
13
- import { goalView } from '../logic/goal.js';
13
+ import { goalView, knownGoalStatus } from '../logic/goal.js';
14
14
  /* How far the goal got, in what its CLI counts: the checks that sent the agent on, or the tokens it spent. */
15
15
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
16
16
  function progressOf(goal, t) {
@@ -35,7 +35,7 @@ function progressOf(goal, t) {
35
35
  * and what a person may do to it. The whole objective and what the last check said are in the tooltip.
36
36
  */
37
37
  export function GoalDock(t0) {
38
- const $ = _c(27);
38
+ const $ = _c(24);
39
39
  const {
40
40
  chatId,
41
41
  info,
@@ -105,47 +105,38 @@ export function GoalDock(t0) {
105
105
  } else {
106
106
  t6 = $[17];
107
107
  }
108
- const t7 = `goal.status.${goal.status}`;
108
+ const t7 = knownGoalStatus(goal) ? t(`goal.status.${goal.status}`) : t("goal.status.unknown");
109
109
  let t8;
110
- if ($[18] !== t || $[19] !== t7) {
111
- t8 = t(t7);
112
- $[18] = t;
113
- $[19] = t7;
114
- $[20] = t8;
115
- } else {
116
- t8 = $[20];
117
- }
118
- let t9;
119
- if ($[21] !== t8) {
120
- t9 = /*#__PURE__*/_jsx("span", {
110
+ if ($[18] !== t7) {
111
+ t8 = /*#__PURE__*/_jsx("span", {
121
112
  className: "truncate text-sm text-text",
122
- children: t8
113
+ children: t7
123
114
  });
124
- $[21] = t8;
125
- $[22] = t9;
115
+ $[18] = t7;
116
+ $[19] = t8;
126
117
  } else {
127
- t9 = $[22];
118
+ t8 = $[19];
128
119
  }
129
- let t10;
130
- if ($[23] !== act || $[24] !== changing || $[25] !== t) {
131
- t10 = action_0 => /*#__PURE__*/_jsx(Button, {
120
+ let t9;
121
+ if ($[20] !== act || $[21] !== changing || $[22] !== t) {
122
+ t9 = action_0 => /*#__PURE__*/_jsx(Button, {
132
123
  size: "sm",
133
124
  disabled: changing,
134
125
  onClick: () => act(action_0),
135
126
  children: t(`goal.${action_0}`)
136
127
  }, action_0);
137
- $[23] = act;
138
- $[24] = changing;
139
- $[25] = t;
140
- $[26] = t10;
128
+ $[20] = act;
129
+ $[21] = changing;
130
+ $[22] = t;
131
+ $[23] = t9;
141
132
  } else {
142
- t10 = $[26];
133
+ t9 = $[23];
143
134
  }
144
135
  t1 = /*#__PURE__*/_jsxs("div", {
145
136
  className: "flex items-center gap-2 border-b border-border px-3.5 py-2.5",
146
137
  children: [t6, /*#__PURE__*/_jsxs("span", {
147
138
  className: "flex min-w-0 grow flex-col",
148
- children: [t9, /*#__PURE__*/_jsx(Tooltip, {
139
+ children: [t8, /*#__PURE__*/_jsx(Tooltip, {
149
140
  label: goal.lastCheck === undefined ? goal.objective : /*#__PURE__*/_jsxs(_Fragment, {
150
141
  children: [goal.objective, /*#__PURE__*/_jsx("br", {}), t("goal.lastCheck", {
151
142
  check: goal.lastCheck
@@ -156,7 +147,7 @@ export function GoalDock(t0) {
156
147
  children: progress === null ? goal.objective : `${goal.objective} · ${progress}`
157
148
  })
158
149
  })]
159
- }), view.actions.map(t10)]
150
+ }), view.actions.map(t9)]
160
151
  });
161
152
  }
162
153
  $[0] = actions;
@@ -1,7 +1,7 @@
1
- import type { ChatInfo } from '@adecore/agent-contracts';
1
+ import type { ChatThreadInfo } from '../../chat-sink.js';
2
2
  export declare function LimitDock({ chatId, info }: {
3
3
  chatId: string;
4
- info: ChatInfo;
4
+ info: ChatThreadInfo;
5
5
  }): import("react").JSX.Element | null;
6
6
  export declare function LimitPill({ chatId }: {
7
7
  chatId: string;
@@ -1,4 +1,5 @@
1
1
  import { type AgentKind, type ChatUsage, type ModelInfo, type ModelSelection, type ProviderInfo, type RuntimeMode } from '@adecore/agent-contracts';
2
+ import type { ChatThreadInfo } from '../../chat-sink.js';
2
3
  import type { AccountChoice } from '../account-choice.js';
3
4
  interface RunSettingsProps {
4
5
  disabled?: boolean;
@@ -6,8 +7,8 @@ interface RunSettingsProps {
6
7
  provider: AgentKind;
7
8
  selection: ModelSelection;
8
9
  model: ModelInfo | undefined;
9
- runtimeMode: RuntimeMode;
10
- effectiveRuntimeMode?: RuntimeMode;
10
+ runtimeMode: ChatThreadInfo['runtimeMode'];
11
+ effectiveRuntimeMode?: ChatThreadInfo['effectiveRuntimeMode'];
11
12
  permissionMode?: string;
12
13
  open: boolean;
13
14
  onOpenChange(open: boolean): void;