@adecore/agents-react 0.65.1 → 0.66.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.
- package/dist/chat/activity.d.ts +5 -2
- package/dist/chat/activity.js +13 -2
- package/dist/chat/logic/bookmarks.d.ts +3 -2
- package/dist/chat/logic/continue-after-stop.d.ts +2 -2
- package/dist/chat/logic/fork.d.ts +7 -6
- package/dist/chat/logic/goal.d.ts +8 -3
- package/dist/chat/logic/goal.js +7 -1
- package/dist/chat/logic/handback.d.ts +2 -2
- package/dist/chat/logic/limit.d.ts +2 -2
- package/dist/chat/logic/limit.js +8 -0
- package/dist/chat/logic/resume-compaction.d.ts +4 -3
- package/dist/chat/logic/scrubber.d.ts +3 -2
- package/dist/chat/logic/timeline-target.d.ts +4 -3
- package/dist/chat/logic/timeline.d.ts +5 -4
- package/dist/chat/logic/timeline.js +9 -0
- package/dist/chat/recent-messages.d.ts +3 -3
- package/dist/chat/runtime-modes.d.ts +2 -1
- package/dist/chat/runtime-modes.js +5 -1
- package/dist/chat/subagent-conversation.d.ts +5 -4
- package/dist/chat/subagent-conversation.js +3 -2
- package/dist/chat/subagent-list.d.ts +4 -3
- package/dist/chat/subagent-view.d.ts +4 -3
- package/dist/chat/ui/ChatActivity.js +19 -15
- package/dist/chat/ui/Composer.d.ts +3 -2
- package/dist/chat/ui/GoalDock.d.ts +3 -2
- package/dist/chat/ui/GoalDock.js +19 -28
- package/dist/chat/ui/LimitState.d.ts +2 -2
- package/dist/chat/ui/RunSettings.d.ts +3 -2
- package/dist/chat/ui/RunSettings.js +318 -298
- package/dist/chat/ui/composer/ComposerControls.d.ts +2 -2
- package/dist/chat/ui/composer/use-chat-controls.d.ts +3 -2
- package/dist/chat/ui/composer/use-compaction-offer.d.ts +3 -2
- package/dist/chat/ui/composer/use-composer-menus.d.ts +3 -2
- package/dist/chat/ui/composer/use-continuable-turn.d.ts +2 -2
- package/dist/chat/ui/composer/use-effort-stepper.d.ts +3 -2
- package/dist/chat/ui/reply-context.d.ts +2 -2
- package/dist/chat/ui/rows/MessageRows.d.ts +4 -0
- package/dist/chat/ui/rows/MessageRows.js +61 -1
- package/dist/chat/ui/rows/Rows.js +42 -26
- package/dist/chat/ui/rows/SubagentRow.d.ts +3 -2
- package/dist/chat/ui/rows/WorkRows.d.ts +3 -2
- package/dist/chat/waiting-on.d.ts +5 -4
- package/dist/chat/waiting-on.js +2 -1
- package/dist/chat/workflow-list.d.ts +3 -2
- package/dist/chat-client.d.ts +2 -1
- package/dist/chat-sink.d.ts +16 -9
- package/dist/host/host-hooks.d.ts +2 -1
- package/dist/host/host-hooks.js +5 -0
- package/dist/host/host.d.ts +8 -2
- package/dist/host/timeline-row.d.ts +10 -4
- package/dist/index.d.ts +2 -2
- package/dist/locales/en/agent-chat.d.ts +16 -0
- package/dist/locales/en/agent-chat.js +17 -1
- package/dist/locales/en/agent-usage.d.ts +0 -2
- package/dist/locales/en/agent-usage.js +0 -2
- package/dist/locales/nl/agent-chat.d.ts +16 -0
- package/dist/locales/nl/agent-chat.js +17 -1
- package/dist/locales/nl/agent-usage.d.ts +0 -2
- package/dist/locales/nl/agent-usage.js +0 -2
- package/dist/port-transport.d.ts +10 -1
- package/dist/port-transport.js +14 -3
- package/dist/state/chats.d.ts +17 -15
- package/dist/state/chats.js +7 -0
- package/dist/state/index.d.ts +1 -1
- package/dist/state/usage.d.ts +3 -2
- package/dist/state/usage.js +34 -3
- package/dist/transport.d.ts +3 -2
- package/dist/usage/limit-groups.js +2 -4
- package/package.json +9 -9
- package/src/chat/activity.ts +19 -6
- package/src/chat/forks.ts +3 -3
- package/src/chat/logic/bookmarks.ts +3 -2
- package/src/chat/logic/continue-after-stop.ts +3 -2
- package/src/chat/logic/fork.ts +8 -7
- package/src/chat/logic/goal.ts +13 -4
- package/src/chat/logic/handback.ts +2 -3
- package/src/chat/logic/limit.ts +7 -2
- package/src/chat/logic/resume-compaction.ts +7 -6
- package/src/chat/logic/scrubber.ts +4 -3
- package/src/chat/logic/timeline-target.ts +4 -3
- package/src/chat/logic/timeline.ts +22 -16
- package/src/chat/pending-prompts.ts +3 -2
- package/src/chat/recent-messages.ts +5 -6
- package/src/chat/runtime-modes.ts +7 -2
- package/src/chat/subagent-conversation.ts +12 -9
- package/src/chat/subagent-list.ts +4 -3
- package/src/chat/subagent-view.ts +4 -3
- package/src/chat/ui/ChatActivity.tsx +11 -7
- package/src/chat/ui/Composer.tsx +3 -2
- package/src/chat/ui/GoalDock.tsx +6 -5
- package/src/chat/ui/LimitState.tsx +5 -5
- package/src/chat/ui/RunSettings.tsx +17 -9
- package/src/chat/ui/composer/ComposerControls.tsx +3 -2
- package/src/chat/ui/composer/use-chat-controls.ts +3 -2
- package/src/chat/ui/composer/use-compaction-offer.ts +4 -3
- package/src/chat/ui/composer/use-composer-menus.ts +3 -2
- package/src/chat/ui/composer/use-continuable-turn.ts +3 -3
- package/src/chat/ui/composer/use-effort-stepper.ts +3 -2
- package/src/chat/ui/reply-context.ts +2 -2
- package/src/chat/ui/rows/MessageRows.tsx +17 -1
- package/src/chat/ui/rows/Rows.tsx +3 -0
- package/src/chat/ui/rows/SubagentRow.tsx +5 -4
- package/src/chat/ui/rows/WorkRows.tsx +3 -2
- package/src/chat/ui/thread-references.ts +3 -3
- package/src/chat/waiting-on.ts +8 -7
- package/src/chat/workflow-list.ts +3 -2
- package/src/chat-client.ts +3 -2
- package/src/chat-sink.ts +21 -9
- package/src/host/host-hooks.ts +9 -1
- package/src/host/host.ts +13 -2
- package/src/host/timeline-row.ts +7 -5
- package/src/index.ts +2 -1
- package/src/locales/en/agent-chat.ts +17 -1
- package/src/locales/en/agent-usage.ts +0 -2
- package/src/locales/nl/agent-chat.ts +17 -1
- package/src/locales/nl/agent-usage.ts +0 -2
- package/src/port-transport.ts +20 -3
- package/src/state/chats.ts +34 -35
- package/src/state/index.ts +1 -1
- package/src/state/usage.ts +45 -5
- package/src/transport.ts +4 -2
- package/src/usage/limit-groups.ts +2 -2
package/src/chat/ui/GoalDock.tsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ChatGoalAction, ProviderCapabilities } from '@adecore/agent-contracts';
|
|
2
2
|
import { Button, Icon, Pill, Tooltip } from '@adecore/ui';
|
|
3
3
|
import { formatTokens, useFormatLocale } from '@adecore/ui/format';
|
|
4
4
|
import clsx from 'clsx';
|
|
@@ -6,15 +6,16 @@ import type { TFunction } from 'i18next';
|
|
|
6
6
|
import { Target } from 'lucide-react';
|
|
7
7
|
import { useState } from 'react';
|
|
8
8
|
import { useTranslation } from 'react-i18next';
|
|
9
|
+
import type { ChatThreadInfo } from '../../chat-sink';
|
|
9
10
|
import { useChatHost } from '../../host/host';
|
|
10
11
|
import { useChatScope } from '../../scope';
|
|
11
12
|
import { useChats } from '../../state/chats';
|
|
12
13
|
import { errorMessage } from '../../transport';
|
|
13
14
|
import { useChatActions } from '../actions';
|
|
14
|
-
import { goalView } from '../logic/goal';
|
|
15
|
+
import { goalView, knownGoalStatus } from '../logic/goal';
|
|
15
16
|
|
|
16
17
|
/* How far the goal got, in what its CLI counts: the checks that sent the agent on, or the tokens it spent. */
|
|
17
|
-
function progressOf(goal:
|
|
18
|
+
function progressOf(goal: NonNullable<ChatThreadInfo['goal']>, t: TFunction<'agent-chat'>): string | null {
|
|
18
19
|
const parts: string[] = [];
|
|
19
20
|
|
|
20
21
|
if (goal.checks !== undefined && goal.checks > 0) {
|
|
@@ -36,7 +37,7 @@ function progressOf(goal: ChatGoal, t: TFunction<'agent-chat'>): string | null {
|
|
|
36
37
|
* At the top of the composer while the chat has a goal: where it stands, the objective, how far it got,
|
|
37
38
|
* and what a person may do to it. The whole objective and what the last check said are in the tooltip.
|
|
38
39
|
*/
|
|
39
|
-
export function GoalDock({ chatId, info, goals }: { chatId: string; info:
|
|
40
|
+
export function GoalDock({ chatId, info, goals }: { chatId: string; info: ChatThreadInfo; goals: ProviderCapabilities['goals'] }) {
|
|
40
41
|
const host = useChatHost();
|
|
41
42
|
const { t } = useTranslation('agent-chat');
|
|
42
43
|
useFormatLocale();
|
|
@@ -68,7 +69,7 @@ export function GoalDock({ chatId, info, goals }: { chatId: string; info: ChatIn
|
|
|
68
69
|
<div className="flex items-center gap-2 border-b border-border px-3.5 py-2.5">
|
|
69
70
|
<Icon icon={Target} size={16} className={clsx('shrink-0', goal.status === 'active' ? 'text-accent' : 'text-text-faint')} />
|
|
70
71
|
<span className="flex min-w-0 grow flex-col">
|
|
71
|
-
<span className="truncate text-sm text-text">{t(`goal.status.${goal.status}`)}</span>
|
|
72
|
+
<span className="truncate text-sm text-text">{knownGoalStatus(goal) ? t(`goal.status.${goal.status}`) : t('goal.status.unknown')}</span>
|
|
72
73
|
<Tooltip
|
|
73
74
|
label={
|
|
74
75
|
goal.lastCheck === undefined ? (
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { ChatInfo } from '@adecore/agent-contracts';
|
|
2
1
|
import { Switch, Button, ButtonGroup, Icon, Menu, Pill, Tooltip, useNow } from '@adecore/ui';
|
|
3
2
|
import { useFormatLocale } from '@adecore/ui/format';
|
|
4
3
|
import clsx from 'clsx';
|
|
@@ -8,6 +7,7 @@ import { useTranslation } from 'react-i18next';
|
|
|
8
7
|
import { continueTargets, hasUnreadAccount, limitsOfAccount, sessionWindow } from '../../agents/account-limits';
|
|
9
8
|
import { AccountDot } from '../../agents/AccountDot';
|
|
10
9
|
import { canContinueOn, type AccountEntry } from '../../agents/accounts';
|
|
10
|
+
import type { ChatThreadInfo } from '../../chat-sink';
|
|
11
11
|
import { useChatHost } from '../../host/host';
|
|
12
12
|
import { useHostResumeAtReset } from '../../host/host-hooks';
|
|
13
13
|
import { useChatScope, type ChatScope } from '../../scope';
|
|
@@ -50,7 +50,7 @@ function readUnreadAccounts(scope: ChatScope): void {
|
|
|
50
50
|
* The chat's own "Resume at reset". It only counts while the host allows it, so with the host's
|
|
51
51
|
* switch off it stands off and says where that switch is.
|
|
52
52
|
*/
|
|
53
|
-
function ResumeAtResetToggle({ chatId, info }: { chatId: string; info:
|
|
53
|
+
function ResumeAtResetToggle({ chatId, info }: { chatId: string; info: ChatThreadInfo }) {
|
|
54
54
|
const { t } = useTranslation('agent-chat');
|
|
55
55
|
const { id } = useChatScope();
|
|
56
56
|
const actions = useChatActions();
|
|
@@ -74,7 +74,7 @@ function ResumeAtResetToggle({ chatId, info }: { chatId: string; info: ChatInfo
|
|
|
74
74
|
* Another account of the chat's CLI with room, only ever offered since it spends someone's other plan, and
|
|
75
75
|
* never remembered. One that reads the chat's conversation takes it over; any other goes on in a fork.
|
|
76
76
|
*/
|
|
77
|
-
function ContinueOn({ chatId, info, choice }: { chatId: string; info:
|
|
77
|
+
function ContinueOn({ chatId, info, choice }: { chatId: string; info: ChatThreadInfo; choice: AccountChoice }) {
|
|
78
78
|
const host = useChatHost();
|
|
79
79
|
const { t } = useTranslation('agent-chat');
|
|
80
80
|
const scope = useChatScope();
|
|
@@ -165,7 +165,7 @@ function ContinueOnRows({
|
|
|
165
165
|
onPick
|
|
166
166
|
}: {
|
|
167
167
|
targets: AccountEntry[];
|
|
168
|
-
info:
|
|
168
|
+
info: ChatThreadInfo;
|
|
169
169
|
choice: AccountChoice;
|
|
170
170
|
onPick(entry: AccountEntry): void;
|
|
171
171
|
}) {
|
|
@@ -199,7 +199,7 @@ function ContinueOnRows({
|
|
|
199
199
|
}
|
|
200
200
|
|
|
201
201
|
/* At the top of the composer while the last turn stopped on a limit: what stopped it, when it goes on, and the switch. */
|
|
202
|
-
export function LimitDock({ chatId, info }: { chatId: string; info:
|
|
202
|
+
export function LimitDock({ chatId, info }: { chatId: string; info: ChatThreadInfo }) {
|
|
203
203
|
const { t } = useTranslation('agent-chat');
|
|
204
204
|
useFormatLocale();
|
|
205
205
|
const now = useNow(MINUTE_MS, info.limit !== undefined);
|
|
@@ -26,6 +26,7 @@ import {
|
|
|
26
26
|
Settings,
|
|
27
27
|
Shield,
|
|
28
28
|
ShieldAlert,
|
|
29
|
+
ShieldQuestionMark,
|
|
29
30
|
SlidersHorizontal,
|
|
30
31
|
Star,
|
|
31
32
|
type LucideIcon
|
|
@@ -38,6 +39,7 @@ import { accountColor, canContinueOn } from '../../agents/accounts';
|
|
|
38
39
|
import { AgentIcon } from '../../agents/AgentIcon';
|
|
39
40
|
import { modelName } from '../../agents/model-name';
|
|
40
41
|
import { localizedOption } from '../../agents/option-words';
|
|
42
|
+
import type { ChatThreadInfo } from '../../chat-sink';
|
|
41
43
|
import { useChatHost } from '../../host/host';
|
|
42
44
|
import { PROVIDER_COLORS } from '../../usage/format';
|
|
43
45
|
import { useUsageLimits } from '../../usage/limits';
|
|
@@ -46,7 +48,7 @@ import { CONTEXT_OPTION, contextFraction, contextSegments, orderOptions, type Co
|
|
|
46
48
|
import { EFFORT_OPTION } from '../logic/effort';
|
|
47
49
|
import { favoritesFirst, searchModels, shortlistOf, wantsModelSearch } from '../logic/picker-entries';
|
|
48
50
|
import { favoriteModelsOf, toggleFavoriteModel, useChatPreferences } from '../preferences';
|
|
49
|
-
import { RUNTIME_MODES } from '../runtime-modes';
|
|
51
|
+
import { isKnownRuntimeMode, RUNTIME_MODES } from '../runtime-modes';
|
|
50
52
|
import { ModelMarks } from './ModelMarks';
|
|
51
53
|
import { SessionLine } from './SessionLine';
|
|
52
54
|
|
|
@@ -59,6 +61,10 @@ const MODE_ICONS: Record<RuntimeMode, LucideIcon> = {
|
|
|
59
61
|
'full-access': ShieldAlert
|
|
60
62
|
};
|
|
61
63
|
|
|
64
|
+
function modeIcon(mode: string): LucideIcon {
|
|
65
|
+
return isKnownRuntimeMode(mode) ? MODE_ICONS[mode] : ShieldQuestionMark;
|
|
66
|
+
}
|
|
67
|
+
|
|
62
68
|
// More choices than this do not fit beside the label, so they go in a submenu of their own.
|
|
63
69
|
const INLINE_CHOICES = 3;
|
|
64
70
|
|
|
@@ -79,8 +85,9 @@ interface RunSettingsProps {
|
|
|
79
85
|
provider: AgentKind;
|
|
80
86
|
selection: ModelSelection;
|
|
81
87
|
model: ModelInfo | undefined;
|
|
82
|
-
|
|
83
|
-
|
|
88
|
+
/* As the host reports it, so possibly a mode of a newer host that this version shows as set there. */
|
|
89
|
+
runtimeMode: ChatThreadInfo['runtimeMode'];
|
|
90
|
+
effectiveRuntimeMode?: ChatThreadInfo['effectiveRuntimeMode'];
|
|
84
91
|
permissionMode?: string;
|
|
85
92
|
/* Controlled, so `/model` in the composer can open the same menu a click on the pill does. */
|
|
86
93
|
open: boolean;
|
|
@@ -199,8 +206,9 @@ export function RunSettings({
|
|
|
199
206
|
const shownMode = effectiveRuntimeMode ?? runtimeMode;
|
|
200
207
|
const fullAccess = shownMode === 'full-access';
|
|
201
208
|
const permissionFallback = permissionMode !== undefined && effectiveRuntimeMode !== runtimeMode;
|
|
202
|
-
const
|
|
203
|
-
const
|
|
209
|
+
const modeWord = (mode: string, form: 'label' | 'short'): string => (isKnownRuntimeMode(mode) ? t(`modes.${mode}.${form}`) : t(`modes.unknown.${form}`));
|
|
210
|
+
const effectiveLabel = effectiveRuntimeMode === undefined ? permissionMode : modeWord(effectiveRuntimeMode, 'label');
|
|
211
|
+
const permissionHint = permissionFallback ? t('pickers.mode.effective', { effective: effectiveLabel, requested: modeWord(runtimeMode, 'label') }) : null;
|
|
204
212
|
|
|
205
213
|
const chooseModel = (value: string): void => {
|
|
206
214
|
const slash = value.indexOf('/');
|
|
@@ -393,9 +401,9 @@ export function RunSettings({
|
|
|
393
401
|
)}
|
|
394
402
|
<span className="shrink-0 text-text-faint">·</span>
|
|
395
403
|
<span className={clsx('flex shrink-0 items-center gap-1', fullAccess && 'text-status-needs-you')}>
|
|
396
|
-
<Icon icon={
|
|
404
|
+
<Icon icon={modeIcon(shownMode)} size={12} className="shrink-0" />
|
|
397
405
|
<span className="@max-xl/composer:hidden">
|
|
398
|
-
{effectiveRuntimeMode === undefined && permissionMode !== undefined ? permissionMode :
|
|
406
|
+
{effectiveRuntimeMode === undefined && permissionMode !== undefined ? permissionMode : modeWord(shownMode, 'short')}
|
|
399
407
|
</span>
|
|
400
408
|
{permissionFallback && <Icon icon={TriangleAlert} size={12} className="shrink-0 text-status-needs-you" />}
|
|
401
409
|
</span>
|
|
@@ -464,12 +472,12 @@ export function RunSettings({
|
|
|
464
472
|
<Menu.SubmenuRoot>
|
|
465
473
|
<Menu.SubmenuTrigger className="text-text-muted">
|
|
466
474
|
<Icon
|
|
467
|
-
icon={
|
|
475
|
+
icon={modeIcon(runtimeMode)}
|
|
468
476
|
size={14}
|
|
469
477
|
className={clsx('shrink-0', fullAccess ? 'text-status-needs-you' : 'text-text-faint')}
|
|
470
478
|
/>
|
|
471
479
|
<span className="min-w-0 grow truncate">{t('pickers.mode.label')}</span>
|
|
472
|
-
<Menu.Hint className="truncate">{
|
|
480
|
+
<Menu.Hint className="truncate">{modeWord(runtimeMode, 'label')}</Menu.Hint>
|
|
473
481
|
</Menu.SubmenuTrigger>
|
|
474
482
|
<Menu.Popup className="w-72">
|
|
475
483
|
{permissionHint !== null && <p className="px-2.5 py-2 text-xs text-text-muted">{permissionHint}</p>}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { holdsConversation
|
|
1
|
+
import { holdsConversation } from '@adecore/agent-contracts';
|
|
2
2
|
import { Button, ErrorBoundary, Icon, Tooltip, type Shortcut } from '@adecore/ui';
|
|
3
3
|
import { ArrowUp, Play, Square } from 'lucide-react';
|
|
4
4
|
import { useRef, type Ref } from 'react';
|
|
5
5
|
import { useTranslation } from 'react-i18next';
|
|
6
|
+
import type { ChatThreadInfo } from '../../../chat-sink';
|
|
6
7
|
import { useChatHost } from '../../../host/host';
|
|
7
8
|
import { useChatScope } from '../../../scope';
|
|
8
9
|
import { useProviders } from '../../../state/providers';
|
|
@@ -40,7 +41,7 @@ function SendButton({ send }: { send: SendProps }) {
|
|
|
40
41
|
|
|
41
42
|
interface ComposerControlsProps {
|
|
42
43
|
chatId: string;
|
|
43
|
-
info:
|
|
44
|
+
info: ChatThreadInfo;
|
|
44
45
|
providerFixed: boolean;
|
|
45
46
|
writable: boolean;
|
|
46
47
|
attachable: boolean;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import type { AgentKind,
|
|
1
|
+
import type { AgentKind, ModelSelection, RuntimeMode } from '@adecore/agent-contracts';
|
|
2
2
|
import { useRef, useState } from 'react';
|
|
3
3
|
import { useTranslation } from 'react-i18next';
|
|
4
|
+
import type { ChatThreadInfo } from '../../../chat-sink';
|
|
4
5
|
import { useChatHost } from '../../../host/host';
|
|
5
6
|
import { useHostCanReorderAccounts } from '../../../host/host-hooks';
|
|
6
7
|
import { useChatScope } from '../../../scope';
|
|
@@ -12,7 +13,7 @@ import type { ComposerNotice } from './use-notice';
|
|
|
12
13
|
|
|
13
14
|
interface ControlsInput {
|
|
14
15
|
chatId: string;
|
|
15
|
-
info:
|
|
16
|
+
info: ChatThreadInfo;
|
|
16
17
|
notice: ComposerNotice;
|
|
17
18
|
onRetarget(provider: AgentKind, selection: ModelSelection): Promise<void>;
|
|
18
19
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ProviderCapabilities } from '@adecore/agent-contracts';
|
|
2
2
|
import { useEffect, useState } from 'react';
|
|
3
|
+
import type { ChatThreadInfo, ChatThreadItem } from '../../../chat-sink';
|
|
3
4
|
import { useChatRow } from '../../../state/chats';
|
|
4
5
|
import { RESUME_COMPACTION_TOKENS, resumeCompactionDueAt, resumeCompactionOffer, watchDueAt, type DueClock } from '../../logic/resume-compaction';
|
|
5
6
|
import { useResumeCompactionDismissal } from '../../resume-compaction-dismissals';
|
|
@@ -24,14 +25,14 @@ const PAGE_CLOCK: DueClock = {
|
|
|
24
25
|
};
|
|
25
26
|
|
|
26
27
|
/* The offer to fold a long context before a chat whose cache went cold goes on, or null when there is none. */
|
|
27
|
-
export function useCompactionOffer(chatId: string, info:
|
|
28
|
+
export function useCompactionOffer(chatId: string, info: ChatThreadInfo, compaction: ProviderCapabilities['compaction'] | undefined) {
|
|
28
29
|
const order = useChatRow(chatId, (row) => row?.order);
|
|
29
30
|
const structure = useChatRow(chatId, (row) => row?.structure);
|
|
30
31
|
const dismissedTurnId = useResumeCompactionDismissal(chatId);
|
|
31
32
|
const [now, setNow] = useState(Date.now);
|
|
32
33
|
// The cheap half of the offer, so a chat that can never make one walks no thread.
|
|
33
34
|
const couldOffer = compaction !== undefined && compaction !== 'none' && info.usage.contextTokens >= RESUME_COMPACTION_TOKENS;
|
|
34
|
-
const items = couldOffer ? (order ?? []).map((id) => structure?.[id]).filter((item): item is
|
|
35
|
+
const items = couldOffer ? (order ?? []).map((id) => structure?.[id]).filter((item): item is ChatThreadItem => item !== undefined) : [];
|
|
35
36
|
const input = { info, compaction, items, dismissedTurnId };
|
|
36
37
|
const dueAt = couldOffer ? resumeCompactionDueAt(input) : null;
|
|
37
38
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ChatSkill, ProviderCapabilities } from '@adecore/agent-contracts';
|
|
2
2
|
import { useEffect, useState, type RefObject } from 'react';
|
|
3
3
|
import { useTranslation } from 'react-i18next';
|
|
4
|
+
import type { ChatThreadInfo } from '../../../chat-sink';
|
|
4
5
|
import { useHostAccountRule, useHostReferables } from '../../../host/host-hooks';
|
|
5
6
|
import { useChatScope } from '../../../scope';
|
|
6
7
|
import type { ComposerInputHandle } from '../ComposerInput';
|
|
@@ -14,7 +15,7 @@ const LOCAL_COMMANDS = ['model', 'compact', 'clear'];
|
|
|
14
15
|
|
|
15
16
|
interface MenusInput {
|
|
16
17
|
chatId: string;
|
|
17
|
-
info:
|
|
18
|
+
info: ChatThreadInfo;
|
|
18
19
|
capabilities: ProviderCapabilities | undefined;
|
|
19
20
|
providerName: string | undefined;
|
|
20
21
|
draft: ComposerDraft;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ChatThreadInfo, ChatThreadItem } from '../../../chat-sink';
|
|
2
2
|
import { useChatRow } from '../../../state/chats';
|
|
3
3
|
import { continuableTurn } from '../../logic/continue-after-stop';
|
|
4
4
|
|
|
5
|
-
export function useContinuableTurn(chatId: string, info:
|
|
5
|
+
export function useContinuableTurn(chatId: string, info: ChatThreadInfo): string | null {
|
|
6
6
|
const order = useChatRow(chatId, (row) => row?.order);
|
|
7
7
|
const structure = useChatRow(chatId, (row) => row?.structure);
|
|
8
|
-
const items = (order ?? []).map((id) => structure?.[id]).filter((item): item is
|
|
8
|
+
const items = (order ?? []).map((id) => structure?.[id]).filter((item): item is ChatThreadItem => item !== undefined);
|
|
9
9
|
|
|
10
10
|
return continuableTurn(info, items);
|
|
11
11
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ModelInfo } from '@adecore/agent-contracts';
|
|
2
2
|
import { useEffect, useRef } from 'react';
|
|
3
3
|
import { useTranslation } from 'react-i18next';
|
|
4
4
|
import { choiceWord } from '../../../agents/option-words';
|
|
5
|
+
import type { ChatThreadInfo } from '../../../chat-sink';
|
|
5
6
|
import { useChatScope } from '../../../scope';
|
|
6
7
|
import { registerEffortStepper } from '../../composer-effort';
|
|
7
8
|
import { EFFORT_OPTION, stepEffort, type EffortStep } from '../../logic/effort';
|
|
@@ -10,7 +11,7 @@ import type { ComposerNotice } from './use-notice';
|
|
|
10
11
|
|
|
11
12
|
interface EffortStepperInput {
|
|
12
13
|
chatId: string;
|
|
13
|
-
info:
|
|
14
|
+
info: ChatThreadInfo;
|
|
14
15
|
model: ModelInfo | undefined;
|
|
15
16
|
writable: boolean;
|
|
16
17
|
controls: ChatControls;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { ChatInfo } from '@adecore/agent-contracts';
|
|
2
1
|
import { createContext } from 'react';
|
|
2
|
+
import type { ChatThreadInfo } from '../../chat-sink';
|
|
3
3
|
import type { UiReplyTarget } from '../logic/timeline-target';
|
|
4
4
|
|
|
5
|
-
export const ReplyContext = createContext<{ provider:
|
|
5
|
+
export const ReplyContext = createContext<{ provider: ChatThreadInfo['provider']; chatId?: string } | null>(null);
|
|
6
6
|
|
|
7
7
|
export const UiReplyNavigationContext = createContext<{
|
|
8
8
|
chatId: string;
|
|
@@ -32,7 +32,7 @@ import {
|
|
|
32
32
|
import { useContext, useState, type ReactNode } from 'react';
|
|
33
33
|
import { useTranslation } from 'react-i18next';
|
|
34
34
|
import { useChatHost, type CommandLookSent, type ReplyAuthor } from '../../../host/host';
|
|
35
|
-
import { useHostAttachmentUrl, useHostChatPlace, useHostReplyAuthor, useHostStreaming } from '../../../host/host-hooks';
|
|
35
|
+
import { useHostAttachmentUrl, useHostChatPlace, useHostReplyAuthor, useHostStreaming, useHostUnknownItemWords } from '../../../host/host-hooks';
|
|
36
36
|
import { useChatScope } from '../../../scope';
|
|
37
37
|
import { useChatRow, useCurrentItem } from '../../../state/chats';
|
|
38
38
|
import { useProviders } from '../../../state/providers';
|
|
@@ -664,6 +664,22 @@ export function NoteRow({ id, level, text, from, said }: { id: string; level: 'i
|
|
|
664
664
|
return <NoteLine id={id} level={level} text={text} from={from} />;
|
|
665
665
|
}
|
|
666
666
|
|
|
667
|
+
/* An item of a newer host this version cannot read: one muted line in its place, with nothing on it to act on. */
|
|
668
|
+
export function UnknownRow({ id, waits }: { id: string; waits: boolean }) {
|
|
669
|
+
const { t } = useTranslation('agent-chat');
|
|
670
|
+
const words = useHostUnknownItemWords();
|
|
671
|
+
const text = waits ? (words?.request ?? t('rows.unknown.request')) : (words?.item ?? t('rows.unknown.item'));
|
|
672
|
+
|
|
673
|
+
return (
|
|
674
|
+
<div data-find-item={id} className="-mx-1 mb-0.5 flex min-h-7 items-start gap-2 px-1 py-1 text-xs text-text-faint">
|
|
675
|
+
<span className={ROW_GUTTER}>{NOTE_ICON.info}</span>
|
|
676
|
+
<span data-find-field="summary" className="min-w-0 flex-1 select-text">
|
|
677
|
+
{text}
|
|
678
|
+
</span>
|
|
679
|
+
</div>
|
|
680
|
+
);
|
|
681
|
+
}
|
|
682
|
+
|
|
667
683
|
function NoteLine({ id, level, text, from }: { id: string; level: 'info' | 'warning' | 'error'; text: string; from?: string }) {
|
|
668
684
|
const { t } = useTranslation('agent-chat');
|
|
669
685
|
const [open, setOpen] = useState(false);
|
|
@@ -19,6 +19,7 @@ import {
|
|
|
19
19
|
SentByAgentRow,
|
|
20
20
|
SentMessageRow,
|
|
21
21
|
ThinkingRow,
|
|
22
|
+
UnknownRow,
|
|
22
23
|
UserRow
|
|
23
24
|
} from './MessageRows';
|
|
24
25
|
import { SubagentBranchRow } from './SubagentRow';
|
|
@@ -117,6 +118,8 @@ export function Row({ row, chatId, toggleGroup, toggleTurn, toggleSubagent, open
|
|
|
117
118
|
return <SentByAgentRow chatId={chatId} id={row.id} tool={row.tool} sent={row.sent} />;
|
|
118
119
|
case 'compaction':
|
|
119
120
|
return <CompactionRow preTokens={row.preTokens} postTokens={row.postTokens} />;
|
|
121
|
+
case 'unknown':
|
|
122
|
+
return <UnknownRow id={row.id} waits={row.waits} />;
|
|
120
123
|
case 'selection-switch':
|
|
121
124
|
return <SelectionSwitchRow chatId={chatId} from={row.from} to={row.to} />;
|
|
122
125
|
case 'working':
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { HOST_TASK_ORIGIN, taskIdOfRow, type ChatAssistantItem, type
|
|
1
|
+
import { HOST_TASK_ORIGIN, taskIdOfRow, type ChatAssistantItem, type ChatSubagentItem } from '@adecore/agent-contracts';
|
|
2
2
|
import { Icon, ScrollArea, useNow } from '@adecore/ui';
|
|
3
3
|
import { formatElapsedShort } from '@adecore/ui/format';
|
|
4
4
|
import clsx from 'clsx';
|
|
5
5
|
import { Bot, ChevronDown } from 'lucide-react';
|
|
6
6
|
import { useLayoutEffect, useRef, useState } from 'react';
|
|
7
7
|
import { useTranslation } from 'react-i18next';
|
|
8
|
+
import type { ChatThreadItem } from '../../../chat-sink';
|
|
8
9
|
import { type SubagentTask } from '../../../host/host';
|
|
9
10
|
import { useHostHidesToolCalls, useHostTask } from '../../../host/host-hooks';
|
|
10
11
|
import type { SubagentBranch } from '../../../host/timeline-row';
|
|
@@ -28,7 +29,7 @@ const CHILDREN_MAX_PX = 320;
|
|
|
28
29
|
* but off a timeline it has already grouped and folded, and it writes an answer at the size of a
|
|
29
30
|
* message; here every step is a line and the text is the aside under it.
|
|
30
31
|
*/
|
|
31
|
-
function ChildRow({ chatId, item }: { chatId: string; item:
|
|
32
|
+
function ChildRow({ chatId, item }: { chatId: string; item: ChatThreadItem }) {
|
|
32
33
|
if (item.kind === 'tool') {
|
|
33
34
|
if (isImageGeneration(item)) {
|
|
34
35
|
return <GeneratedImageRow chatId={chatId} tool={item} />;
|
|
@@ -78,7 +79,7 @@ function StatusPill({ item, task }: { item: ChatSubagentItem; task: SubagentTask
|
|
|
78
79
|
);
|
|
79
80
|
}
|
|
80
81
|
|
|
81
|
-
function SubagentWork({ chatId, item, work }: { chatId: string; item: ChatSubagentItem; work:
|
|
82
|
+
function SubagentWork({ chatId, item, work }: { chatId: string; item: ChatSubagentItem; work: ChatThreadItem[] }) {
|
|
82
83
|
const { t } = useTranslation('agent-chat');
|
|
83
84
|
const { id } = useChatScope();
|
|
84
85
|
const hideTools = useHostHidesToolCalls(id, chatId);
|
|
@@ -150,7 +151,7 @@ export function SubagentRow({
|
|
|
150
151
|
}: {
|
|
151
152
|
chatId: string;
|
|
152
153
|
item: ChatSubagentItem;
|
|
153
|
-
work:
|
|
154
|
+
work: ChatThreadItem[];
|
|
154
155
|
expanded: boolean;
|
|
155
156
|
onToggle(): void;
|
|
156
157
|
/* Opens everything it did in the thread's place, for a view that has somewhere to open it. */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ChatCheckpointDiff, ChatCheckpointFile, ChatFileChange, ChatToolItem
|
|
1
|
+
import type { ChatCheckpointDiff, ChatCheckpointFile, ChatFileChange, ChatToolItem } from '@adecore/agent-contracts';
|
|
2
2
|
import { Button, Icon, LazyBoundary, MiddleTruncate, ScrollArea, Spinner, lazyNamed, useTickingText } from '@adecore/ui';
|
|
3
3
|
import { formatClockDuration, formatElapsedShort } from '@adecore/ui/format';
|
|
4
4
|
import clsx from 'clsx';
|
|
@@ -6,6 +6,7 @@ import i18next from 'i18next';
|
|
|
6
6
|
import { ChevronRight, FileDiff, X } from 'lucide-react';
|
|
7
7
|
import { Fragment, useContext, useEffect, useState, type Dispatch, type ReactNode, type SetStateAction } from 'react';
|
|
8
8
|
import { useTranslation } from 'react-i18next';
|
|
9
|
+
import type { ChatThreadTurn } from '../../../chat-sink';
|
|
9
10
|
import { useChatHost, type CommandLook, type ToolLook } from '../../../host/host';
|
|
10
11
|
import { useCommandNames } from '../../../host/host-hooks';
|
|
11
12
|
import { type Look } from '../../../host/timeline-row';
|
|
@@ -614,7 +615,7 @@ export function TurnFoldRow({
|
|
|
614
615
|
expandable,
|
|
615
616
|
onToggle
|
|
616
617
|
}: {
|
|
617
|
-
turn:
|
|
618
|
+
turn: ChatThreadTurn;
|
|
618
619
|
label: string;
|
|
619
620
|
work: readonly string[];
|
|
620
621
|
expanded: boolean;
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ChatThreadItem } from '../../chat-sink';
|
|
2
2
|
import { useChatHost } from '../../host/host';
|
|
3
3
|
import { useHostReferables } from '../../host/host-hooks';
|
|
4
4
|
import { useChatScope } from '../../scope';
|
|
5
5
|
import { useChatRow } from '../../state/chats';
|
|
6
6
|
import type { ReferenceLookup } from './reference-lookup';
|
|
7
7
|
|
|
8
|
-
const referencedOf = new WeakMap<Record<string,
|
|
8
|
+
const referencedOf = new WeakMap<Record<string, ChatThreadItem>, string>();
|
|
9
9
|
|
|
10
10
|
/*
|
|
11
11
|
* The ids a person pointed at with `#` in a thread, one per line. A string, so the selector that reads
|
|
12
12
|
* it answers the same value until a message with another one comes; the structure a streamed word
|
|
13
13
|
* leaves alone is what it is cached on.
|
|
14
14
|
*/
|
|
15
|
-
function threadReferencedKey(structure: Record<string,
|
|
15
|
+
function threadReferencedKey(structure: Record<string, ChatThreadItem> | undefined): string {
|
|
16
16
|
if (structure === undefined) {
|
|
17
17
|
return '';
|
|
18
18
|
}
|
package/src/chat/waiting-on.ts
CHANGED
|
@@ -1,21 +1,22 @@
|
|
|
1
|
-
import type { ChatBackgroundTask, ChatInfo } from '@adecore/agent-contracts';
|
|
2
1
|
import { formatElapsedShort, formatMoment } from '@adecore/ui/format';
|
|
3
2
|
import i18next from 'i18next';
|
|
3
|
+
import type { ChatThreadInfo } from '../chat-sink';
|
|
4
|
+
import { backgroundTaskName, type ChatThreadBackgroundTask } from './activity';
|
|
4
5
|
|
|
5
6
|
/* An open task the chat delegated: whether its child waits out a limit, and that child's info where the client has it. */
|
|
6
7
|
export interface WaitingChild {
|
|
7
8
|
paused?: { until?: number };
|
|
8
|
-
child?: Pick<
|
|
9
|
+
child?: Pick<ChatThreadInfo, 'status' | 'requests'>;
|
|
9
10
|
}
|
|
10
11
|
|
|
11
12
|
/* What a chat has that it may be waiting on, as every client already holds it. */
|
|
12
13
|
export interface WaitingOnInput {
|
|
13
14
|
children?: readonly WaitingChild[];
|
|
14
|
-
background?: readonly
|
|
15
|
+
background?: readonly ChatThreadBackgroundTask[];
|
|
15
16
|
/* Background subagents and workflows of the CLI's own, counted where the thread is loaded. */
|
|
16
17
|
subagents?: number;
|
|
17
18
|
workflows?: number;
|
|
18
|
-
/* `
|
|
19
|
+
/* `ChatThreadInfo.delegating`, for a client that has only the info and so no counts. */
|
|
19
20
|
delegating?: boolean;
|
|
20
21
|
/* The status line of the plan the chat works on. */
|
|
21
22
|
planStatus?: string;
|
|
@@ -24,7 +25,7 @@ export interface WaitingOnInput {
|
|
|
24
25
|
export type WaitingOn =
|
|
25
26
|
| { kind: 'needs-you'; count: number }
|
|
26
27
|
| { kind: 'paused'; until?: number }
|
|
27
|
-
| { kind: 'command'; task:
|
|
28
|
+
| { kind: 'command'; task: ChatThreadBackgroundTask }
|
|
28
29
|
| { kind: 'background'; subagents: number; workflows: number }
|
|
29
30
|
| { kind: 'plan'; text: string };
|
|
30
31
|
|
|
@@ -49,7 +50,7 @@ export function waitingOnOf(input: WaitingOnInput): WaitingOn | null {
|
|
|
49
50
|
return times.length === 0 ? { kind: 'paused' } : { kind: 'paused', until: Math.min(...times) };
|
|
50
51
|
}
|
|
51
52
|
|
|
52
|
-
const oldest = (input.background ?? []).reduce<
|
|
53
|
+
const oldest = (input.background ?? []).reduce<ChatThreadBackgroundTask | null>(
|
|
53
54
|
(found, task) => (found === null || task.startedAt < found.startedAt ? task : found),
|
|
54
55
|
null
|
|
55
56
|
);
|
|
@@ -81,7 +82,7 @@ export function waitingOnLabel(waiting: WaitingOn, now: number): string {
|
|
|
81
82
|
return waiting.until === undefined ? t('waitingOn.paused') : t('waitingOn.pausedUntil', { time: formatMoment(waiting.until, now) });
|
|
82
83
|
case 'command':
|
|
83
84
|
return t('waitingOn.command', {
|
|
84
|
-
command:
|
|
85
|
+
command: backgroundTaskName(waiting.task),
|
|
85
86
|
age: formatElapsedShort(Math.max(0, now - waiting.task.startedAt))
|
|
86
87
|
});
|
|
87
88
|
case 'background':
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { activeWorkflows, type
|
|
1
|
+
import { activeWorkflows, type ChatToolItem, type ChatWorkflow } from '@adecore/agent-contracts';
|
|
2
2
|
import i18next from 'i18next';
|
|
3
|
+
import type { ChatThreadItem } from '../chat-sink';
|
|
3
4
|
import { workflowCounts, workflowPhases } from './logic/workflow';
|
|
4
5
|
|
|
5
6
|
/* A Workflow call that reported what it runs, which is every one `activeWorkflows` keeps. */
|
|
@@ -14,7 +15,7 @@ interface WorkflowPill {
|
|
|
14
15
|
}
|
|
15
16
|
|
|
16
17
|
/* What the workflow pill over the composer lists (`activeWorkflows`); `order` puts the calls from before the page first. */
|
|
17
|
-
export function flyoutWorkflows(order: readonly string[], structure: Readonly<Record<string,
|
|
18
|
+
export function flyoutWorkflows(order: readonly string[], structure: Readonly<Record<string, ChatThreadItem>>): WorkflowCall[] {
|
|
18
19
|
return activeWorkflows(
|
|
19
20
|
order.flatMap((id) => {
|
|
20
21
|
const item = structure[id];
|
package/src/chat-client.ts
CHANGED
|
@@ -11,6 +11,7 @@ import type {
|
|
|
11
11
|
ProviderInfo,
|
|
12
12
|
RuntimeMode
|
|
13
13
|
} from '@adecore/agent-contracts';
|
|
14
|
+
import type { Tolerant } from '@adecore/agent-contracts/tolerance';
|
|
14
15
|
import type { ChatSink } from './chat-sink';
|
|
15
16
|
import { MountedRegistry, type MountedEntry } from './mounted-registry';
|
|
16
17
|
import { errorCode, isConnectionError, type ChatTransport, type ChatTransportStatus } from './transport';
|
|
@@ -70,7 +71,7 @@ export class ChatClient {
|
|
|
70
71
|
private readonly unsubscribe: Array<() => void> = [];
|
|
71
72
|
private readonly earlier = new Map<string, Promise<void>>();
|
|
72
73
|
private readonly observers = new Map<string, number>();
|
|
73
|
-
private readonly inspections = new Map<string, Promise<ChatAttachResult
|
|
74
|
+
private readonly inspections = new Map<string, Promise<Tolerant<ChatAttachResult>>>();
|
|
74
75
|
private preferences: ChatPreferencesPayload | null = null;
|
|
75
76
|
private checkpoints = new WeakMap<object, number>();
|
|
76
77
|
|
|
@@ -101,7 +102,7 @@ export class ChatClient {
|
|
|
101
102
|
}
|
|
102
103
|
}
|
|
103
104
|
|
|
104
|
-
inspect(chatId: string): Promise<ChatAttachResult
|
|
105
|
+
inspect(chatId: string): Promise<Tolerant<ChatAttachResult>> {
|
|
105
106
|
const pending = this.inspections.get(chatId);
|
|
106
107
|
|
|
107
108
|
if (pending) {
|
package/src/chat-sink.ts
CHANGED
|
@@ -1,4 +1,16 @@
|
|
|
1
1
|
import type { ChatBookmark, ChatEvent, ChatHistoryResult, ChatInfo, ChatItem, ChatSubagentItem, ChatToolItem, ChatVisual } from '@adecore/agent-contracts';
|
|
2
|
+
import type { Tolerant } from '@adecore/agent-contracts/tolerance';
|
|
3
|
+
|
|
4
|
+
/* An item as a client holds it: one of a newer host that this version cannot read stays in its place as `unknown`. */
|
|
5
|
+
export type ChatThreadItem = Tolerant<ChatItem>;
|
|
6
|
+
|
|
7
|
+
export type ChatThreadTurn = Extract<ChatThreadItem, { kind: 'turn' }>;
|
|
8
|
+
|
|
9
|
+
/* A chat's info as a client holds it: a state word of a newer host is kept as it came. */
|
|
10
|
+
export type ChatThreadInfo = Tolerant<ChatInfo>;
|
|
11
|
+
|
|
12
|
+
/* An event as a client applies it; one of a type this version cannot read changes nothing. */
|
|
13
|
+
export type ChatThreadEvent = Tolerant<ChatEvent>;
|
|
2
14
|
|
|
3
15
|
export type ChatHistoryPage = ChatHistoryResult['history'];
|
|
4
16
|
|
|
@@ -6,13 +18,13 @@ export type ChatHistoryPage = ChatHistoryResult['history'];
|
|
|
6
18
|
export interface ChatPage {
|
|
7
19
|
history: ChatHistoryPage;
|
|
8
20
|
/* Every request of the chat that still waits, wherever in the thread it is. */
|
|
9
|
-
pending:
|
|
21
|
+
pending: ChatThreadItem[];
|
|
10
22
|
/* The active sub-agents from before the page; absent from a host that sends none. */
|
|
11
|
-
subagents?: ChatSubagentItem[];
|
|
23
|
+
subagents?: Tolerant<ChatSubagentItem>[];
|
|
12
24
|
/* The active Workflow calls from before the page; absent from a host that sends none. */
|
|
13
|
-
workflows?: ChatToolItem[];
|
|
25
|
+
workflows?: Tolerant<ChatToolItem>[];
|
|
14
26
|
/* The outline of the thread before the page; absent from a host that sends none. */
|
|
15
|
-
outline?:
|
|
27
|
+
outline?: ChatThreadItem[];
|
|
16
28
|
}
|
|
17
29
|
|
|
18
30
|
/* What a chat client writes. It owns one host's link, so it speaks in chat ids alone. */
|
|
@@ -23,14 +35,14 @@ export interface ChatSink {
|
|
|
23
35
|
*/
|
|
24
36
|
historyIdentity?(chatId: string): object | undefined;
|
|
25
37
|
/* Without a page the items are the whole thread. */
|
|
26
|
-
reset(chatId: string, info:
|
|
38
|
+
reset(chatId: string, info: ChatThreadInfo, items: ChatThreadItem[], page?: ChatPage): void;
|
|
27
39
|
/* The page before the one the chat holds, read with `cursor`. */
|
|
28
|
-
prepend(chatId: string, cursor: string, page: ChatHistoryResult): void;
|
|
29
|
-
apply(chatId: string, event:
|
|
40
|
+
prepend(chatId: string, cursor: string, page: Tolerant<ChatHistoryResult>): void;
|
|
41
|
+
apply(chatId: string, event: ChatThreadEvent): void;
|
|
30
42
|
/* A reconnect can publish its complete replay at once; absent sinks receive each event through apply. */
|
|
31
|
-
replay?(chatId: string, events: readonly
|
|
43
|
+
replay?(chatId: string, events: readonly ChatThreadEvent[]): void;
|
|
32
44
|
/* What a chat is doing, for a thread nobody in this window has open. */
|
|
33
|
-
status(chatId: string, info:
|
|
45
|
+
status(chatId: string, info: ChatThreadInfo): void;
|
|
34
46
|
bookmarks(chatId: string, bookmarks: ChatBookmark[]): void;
|
|
35
47
|
visuals(chatId: string, visuals: ChatVisual[]): void;
|
|
36
48
|
forget(chatId: string): void;
|
package/src/host/host-hooks.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import type { ProviderPlatform } from '@adecore/agent-contracts';
|
|
7
7
|
import type { AccountRule } from './host';
|
|
8
|
-
import { useChatHost, type ChatHost, type CommandLook, type ComposerStatusItem } from './host';
|
|
8
|
+
import { useChatHost, type ChatHost, type CommandLook, type ComposerStatusItem, type UnknownItemWords } from './host';
|
|
9
9
|
import { referablesOfChats, type Referables } from './references';
|
|
10
10
|
|
|
11
11
|
export function useHostCodeMode(): 'light' | 'dark' {
|
|
@@ -32,6 +32,14 @@ export function useHostExtraPrompts(...args: Parameters<ChatHost['prompts']['use
|
|
|
32
32
|
return useChatHost().prompts.useExtra(...args);
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
+
const useNoUnknownItemWords = (): UnknownItemWords | null => null;
|
|
36
|
+
|
|
37
|
+
export function useHostUnknownItemWords(): UnknownItemWords | null {
|
|
38
|
+
const useWords = useChatHost().useUnknownItemWords ?? useNoUnknownItemWords;
|
|
39
|
+
|
|
40
|
+
return useWords();
|
|
41
|
+
}
|
|
42
|
+
|
|
35
43
|
export function useHostStreaming(): ReturnType<ChatHost['useStreaming']> {
|
|
36
44
|
return useChatHost().useStreaming();
|
|
37
45
|
}
|