@steerable/agent-shell-web 0.14.4 → 0.14.6
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/package.json +4 -4
- package/src/components/AgentSidebar.tsx +189 -46
- package/src/components/ChatHeader.tsx +12 -1
- package/src/components/SidebarAccount.tsx +33 -41
- package/src/components/chat/AssistantMessage.tsx +25 -4
- package/src/components/chat/ChatInput.tsx +169 -111
- package/src/components/chat/ChatProjectBadge.tsx +233 -88
- package/src/components/chat/ContextUsagePill.tsx +20 -5
- package/src/components/chat/ExecPolicyPicker.tsx +72 -67
- package/src/components/chat/LocalChatPanel.tsx +34 -34
- package/src/components/chat/MessageList.tsx +109 -19
- package/src/components/chat/ModelPicker.tsx +2 -2
- package/src/components/chat/SessionTodoList.tsx +63 -72
- package/src/components/chat/TurnFilesCard.tsx +270 -112
- package/src/components/chat/TurnProcessGroup.tsx +3 -0
- package/src/components/chat/TurnProcessTimeline.tsx +13 -0
- package/src/components/chat/UserMessage.tsx +8 -1
- package/src/components/chat/next-steps-tags.ts +13 -0
- package/src/components/chat/process-status.ts +112 -2
- package/src/components/chat/todo-list-model.ts +52 -4
- package/src/components/settings/AgentsSettingsPanel.tsx +3 -3
- package/src/components/settings/AppUpdateSettingsPanel.tsx +67 -43
- package/src/components/settings/AppearanceSettingsPanel.tsx +101 -134
- package/src/components/settings/CliInstallSettingsPanel.tsx +25 -23
- package/src/components/settings/DiagnoseSettingsPanel.tsx +3 -3
- package/src/components/settings/InsightsSettingsPanel.tsx +5 -7
- package/src/components/settings/LlmSettingsPanel.tsx +22 -2
- package/src/components/settings/McpSettingsPanel.tsx +4 -5
- package/src/components/settings/MemorySettingsPanel.tsx +210 -159
- package/src/components/settings/OrchestrationSettingsPanel.tsx +79 -121
- package/src/components/settings/PortableSettingsPanel.tsx +62 -49
- package/src/components/settings/PythonRunnerSettingsPanel.tsx +2 -4
- package/src/components/settings/SecuritySettingsPanel.tsx +91 -70
- package/src/components/settings/SettingsSidebar.tsx +238 -0
- package/src/components/settings/SkillsSettingsPanel.tsx +3 -4
- package/src/components/settings/TelemetrySettingsPanel.tsx +2 -7
- package/src/components/settings/UsagePanel.tsx +27 -35
- package/src/components/settings/WebSearchSettingsPanel.tsx +89 -88
- package/src/components/settings/primitives.tsx +302 -0
- package/src/components/settings/settings-registry.ts +371 -0
- package/src/layouts/AgentLayout.tsx +275 -12
- package/src/layouts/PanelToggleButton.tsx +27 -9
- package/src/layouts/conversation-preview.ts +3 -0
- package/src/layouts/request-chat-slot.ts +20 -0
- package/src/layouts/right-panel-tabs.ts +32 -0
- package/src/lib/chat-draft-store.ts +43 -0
- package/src/lib/file-preview-registry.ts +57 -0
- package/src/packs/registry.ts +2 -0
- package/src/pages/AgentPage.tsx +17 -4
- package/src/pages/SettingsPage.tsx +327 -489
- package/src/styles/index.css +6 -0
|
@@ -1,35 +1,16 @@
|
|
|
1
1
|
import { useEffect, useRef, useState } from 'react';
|
|
2
|
-
import { LuChevronDown,
|
|
2
|
+
import { LuChevronDown, LuShieldAlert, LuShieldCheck } from 'react-icons/lu';
|
|
3
3
|
import type { ExecPolicy } from '@/lib/exec-policy';
|
|
4
4
|
import { t } from '@/i18n';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
|
-
* ExecPolicyPicker —
|
|
7
|
+
* ExecPolicyPicker — WorkBuddy-style sandbox permission pill + Switch card.
|
|
8
8
|
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* = 不下发命令沙箱,本机路径(如 Downloads)不再被 Operation not permitted 拦住。
|
|
9
|
+
* Default (`workspace`) confines writes and shell commands to the current
|
|
10
|
+
* workspace/project folders and prompts before stepping outside; toggling
|
|
11
|
+
* `Allow full access` (`full`) turns off the command sandbox for this session.
|
|
13
12
|
*/
|
|
14
13
|
|
|
15
|
-
const OPTIONS: Array<{
|
|
16
|
-
id: ExecPolicy;
|
|
17
|
-
label: string;
|
|
18
|
-
description: string;
|
|
19
|
-
}> = [
|
|
20
|
-
{
|
|
21
|
-
id: 'workspace',
|
|
22
|
-
label: 'Workspace',
|
|
23
|
-
description: 'Can only write to the current workspace. Paths outside it are blocked.',
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
id: 'full',
|
|
27
|
-
label: 'Full access',
|
|
28
|
-
description:
|
|
29
|
-
'Turns off the command sandbox so any path on this computer can be written. Tool approvals still apply.',
|
|
30
|
-
},
|
|
31
|
-
];
|
|
32
|
-
|
|
33
14
|
export function ExecPolicyPicker({
|
|
34
15
|
policy,
|
|
35
16
|
disabled,
|
|
@@ -41,81 +22,105 @@ export function ExecPolicyPicker({
|
|
|
41
22
|
}) {
|
|
42
23
|
const [open, setOpen] = useState(false);
|
|
43
24
|
const rootRef = useRef<HTMLDivElement>(null);
|
|
44
|
-
const current = OPTIONS.find((option) => option.id === policy) ?? OPTIONS[0];
|
|
45
25
|
const isFull = policy === 'full';
|
|
46
26
|
|
|
47
27
|
useEffect(() => {
|
|
48
28
|
if (!open) return;
|
|
49
|
-
const onPointerDown = (event: MouseEvent) => {
|
|
29
|
+
const onPointerDown = (event: PointerEvent | MouseEvent) => {
|
|
50
30
|
if (rootRef.current && !rootRef.current.contains(event.target as Node)) {
|
|
51
31
|
setOpen(false);
|
|
52
32
|
}
|
|
53
33
|
};
|
|
54
|
-
|
|
55
|
-
|
|
34
|
+
const onKeyDown = (event: KeyboardEvent) => {
|
|
35
|
+
if (event.key === 'Escape') {
|
|
36
|
+
event.stopPropagation();
|
|
37
|
+
setOpen(false);
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
document.addEventListener('pointerdown', onPointerDown);
|
|
41
|
+
document.addEventListener('keydown', onKeyDown);
|
|
42
|
+
return () => {
|
|
43
|
+
document.removeEventListener('pointerdown', onPointerDown);
|
|
44
|
+
document.removeEventListener('keydown', onKeyDown);
|
|
45
|
+
};
|
|
56
46
|
}, [open]);
|
|
57
47
|
|
|
48
|
+
const descriptionText = isFull
|
|
49
|
+
? t(
|
|
50
|
+
'Full access is enabled. The command sandbox is off so any path on this computer can be accessed.',
|
|
51
|
+
)
|
|
52
|
+
: t(
|
|
53
|
+
'Running with default permissions. Operations stay within the safety sandbox and ask before going outside.',
|
|
54
|
+
);
|
|
55
|
+
|
|
58
56
|
return (
|
|
59
57
|
<div ref={rootRef} className="relative">
|
|
60
58
|
<button
|
|
61
59
|
type="button"
|
|
62
60
|
disabled={disabled}
|
|
63
|
-
aria-haspopup="
|
|
61
|
+
aria-haspopup="dialog"
|
|
64
62
|
aria-expanded={open}
|
|
65
63
|
aria-label={t('Command sandbox')}
|
|
66
64
|
data-testid="exec-policy-picker"
|
|
67
|
-
title={
|
|
65
|
+
title={descriptionText}
|
|
68
66
|
onClick={() => setOpen((next) => !next)}
|
|
69
67
|
className={[
|
|
70
|
-
'inline-flex h-6 max-w-[
|
|
68
|
+
'inline-flex h-6 max-w-[150px] items-center gap-1 rounded-full border px-2 text-[12px] leading-[1.45] transition-colors disabled:cursor-not-allowed disabled:opacity-70',
|
|
71
69
|
isFull
|
|
72
|
-
? 'border-amber-400/
|
|
70
|
+
? 'border-amber-400/55 bg-amber-400/12 font-medium text-amber-700 dark:text-amber-300'
|
|
73
71
|
: 'border-transparent bg-transparent text-agent-muted-foreground hover:bg-agent-foreground/5 hover:text-agent-foreground',
|
|
74
72
|
].join(' ')}
|
|
75
73
|
>
|
|
76
74
|
{isFull ? (
|
|
77
|
-
<
|
|
75
|
+
<LuShieldAlert className="h-3.5 w-3.5 shrink-0" />
|
|
78
76
|
) : (
|
|
79
|
-
<
|
|
77
|
+
<LuShieldCheck className="h-3.5 w-3.5 shrink-0" />
|
|
80
78
|
)}
|
|
81
|
-
<span className="truncate">
|
|
82
|
-
|
|
79
|
+
<span className="truncate">
|
|
80
|
+
{isFull ? t('Full access') : t('Default permissions')}
|
|
81
|
+
</span>
|
|
82
|
+
<LuChevronDown
|
|
83
|
+
className={`h-3 w-3 shrink-0 text-current opacity-75 transition-transform ${
|
|
84
|
+
open ? 'rotate-180' : ''
|
|
85
|
+
}`}
|
|
86
|
+
/>
|
|
83
87
|
</button>
|
|
88
|
+
|
|
84
89
|
{open && (
|
|
85
90
|
<div
|
|
86
|
-
role="
|
|
91
|
+
role="dialog"
|
|
87
92
|
aria-label={t('Command sandbox')}
|
|
88
|
-
className="absolute bottom-full left-0 z-
|
|
93
|
+
className="absolute bottom-full left-0 z-40 mb-1.5 w-64 rounded-agent-lg border border-agent-border bg-agent-canvas p-3 shadow-lg"
|
|
89
94
|
>
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
95
|
+
<p className="m-0 text-[11px] leading-relaxed text-agent-muted-foreground">
|
|
96
|
+
{descriptionText}
|
|
97
|
+
</p>
|
|
98
|
+
<div className="my-2.5 border-t border-agent-border/60" />
|
|
99
|
+
<button
|
|
100
|
+
type="button"
|
|
101
|
+
role="switch"
|
|
102
|
+
aria-checked={isFull}
|
|
103
|
+
data-testid="exec-policy-full"
|
|
104
|
+
onClick={() => {
|
|
105
|
+
onChange(isFull ? 'workspace' : 'full');
|
|
106
|
+
setOpen(false);
|
|
107
|
+
}}
|
|
108
|
+
className="flex w-full cursor-pointer items-center justify-between gap-2 rounded-agent-sm py-0.5 text-left text-[12px] font-medium text-agent-foreground transition-opacity hover:opacity-90"
|
|
109
|
+
>
|
|
110
|
+
<span>{t('Allow full access')}</span>
|
|
111
|
+
<span
|
|
112
|
+
aria-hidden="true"
|
|
113
|
+
className={`inline-flex h-5 w-9 shrink-0 items-center rounded-full p-0.5 transition-colors ${
|
|
114
|
+
isFull ? 'bg-amber-500' : 'bg-agent-muted-foreground/30'
|
|
115
|
+
}`}
|
|
116
|
+
>
|
|
117
|
+
<span
|
|
118
|
+
className={`h-4 w-4 rounded-full bg-white shadow-xs transition-transform ${
|
|
119
|
+
isFull ? 'translate-x-4' : 'translate-x-0'
|
|
120
|
+
}`}
|
|
121
|
+
/>
|
|
122
|
+
</span>
|
|
123
|
+
</button>
|
|
119
124
|
</div>
|
|
120
125
|
)}
|
|
121
126
|
</div>
|
|
@@ -24,8 +24,6 @@ import type { TurnFailureCardProps } from './TurnFailureCard';
|
|
|
24
24
|
import type { LlmSpeedSnapshot } from './process-status';
|
|
25
25
|
import { ComposerStatusStack } from './composer-status-stack';
|
|
26
26
|
import { t } from '@/i18n';
|
|
27
|
-
import { SessionTodoList } from './SessionTodoList';
|
|
28
|
-
import { resolveLatestSessionTodos, shouldShowComposerTodos } from './todo-list-model';
|
|
29
27
|
import { SessionOrchestrationFlow } from './SessionOrchestrationFlow';
|
|
30
28
|
import { resolveLatestSessionOrchestrationFlow } from './orchestration-flow-model';
|
|
31
29
|
import {
|
|
@@ -36,6 +34,7 @@ import {
|
|
|
36
34
|
type AttachmentFile,
|
|
37
35
|
} from '@/lib/attachments';
|
|
38
36
|
import { parseModeSlashCommand } from '@/lib/chat-mode-store';
|
|
37
|
+
import { clearChatDraft, getChatDraft, setChatDraft } from '@/lib/chat-draft-store';
|
|
39
38
|
|
|
40
39
|
/**
|
|
41
40
|
* LocalChatPanel — the product chat shell.
|
|
@@ -185,6 +184,8 @@ export interface LocalChatPanelProps {
|
|
|
185
184
|
*/
|
|
186
185
|
suggestedReplies?: string[];
|
|
187
186
|
onSelectSuggestion?: (text: string) => void;
|
|
187
|
+
/** 切去设置页或切换会话时在内存中保留未发送草稿文本。 */
|
|
188
|
+
preserveDraft?: boolean;
|
|
188
189
|
}
|
|
189
190
|
|
|
190
191
|
export function LocalChatPanel({
|
|
@@ -248,8 +249,27 @@ export function LocalChatPanel({
|
|
|
248
249
|
onShare,
|
|
249
250
|
suggestedReplies,
|
|
250
251
|
onSelectSuggestion,
|
|
252
|
+
preserveDraft = false,
|
|
251
253
|
}: LocalChatPanelProps) {
|
|
252
|
-
const [inputValue,
|
|
254
|
+
const [inputValue, setInputValueState] = useState(() =>
|
|
255
|
+
preserveDraft ? getChatDraft(chatId) : '',
|
|
256
|
+
);
|
|
257
|
+
const setInputValue = useCallback(
|
|
258
|
+
(next: string | ((prev: string) => string)) => {
|
|
259
|
+
setInputValueState((prev) => {
|
|
260
|
+
const resolved = typeof next === 'function' ? next(prev) : next;
|
|
261
|
+
if (preserveDraft) {
|
|
262
|
+
setChatDraft(chatId, resolved);
|
|
263
|
+
}
|
|
264
|
+
return resolved;
|
|
265
|
+
});
|
|
266
|
+
},
|
|
267
|
+
[preserveDraft, chatId],
|
|
268
|
+
);
|
|
269
|
+
useEffect(() => {
|
|
270
|
+
if (!preserveDraft) return;
|
|
271
|
+
setInputValueState(getChatDraft(chatId));
|
|
272
|
+
}, [preserveDraft, chatId]);
|
|
253
273
|
const [files, setFiles] = useState<AttachmentFile[]>([]);
|
|
254
274
|
const [attachmentError, setAttachmentError] = useState<string | null>(null);
|
|
255
275
|
const [mentionReferences, setMentionReferences] = useState<MentionReference[]>([]);
|
|
@@ -341,6 +361,9 @@ export function LocalChatPanel({
|
|
|
341
361
|
const submittedMentions = mentionReferences;
|
|
342
362
|
// 失败项留在输入框里,用户可以直接重试 / 移除;成功项随消息发出后清掉。
|
|
343
363
|
const failedFiles = failures.map((f) => f.file);
|
|
364
|
+
if (preserveDraft) {
|
|
365
|
+
clearChatDraft(chatId);
|
|
366
|
+
}
|
|
344
367
|
setInputValue('');
|
|
345
368
|
setFiles(failedFiles);
|
|
346
369
|
setMentionReferences([]);
|
|
@@ -370,24 +393,6 @@ export function LocalChatPanel({
|
|
|
370
393
|
selectedAgentId,
|
|
371
394
|
]);
|
|
372
395
|
|
|
373
|
-
const sessionTodos = useMemo(
|
|
374
|
-
() =>
|
|
375
|
-
resolveLatestSessionTodos({
|
|
376
|
-
messages,
|
|
377
|
-
executedActionsByMessageId,
|
|
378
|
-
currentTurnActions,
|
|
379
|
-
timelineByMessageId,
|
|
380
|
-
currentTurnTimeline,
|
|
381
|
-
}),
|
|
382
|
-
[
|
|
383
|
-
messages,
|
|
384
|
-
executedActionsByMessageId,
|
|
385
|
-
currentTurnActions,
|
|
386
|
-
timelineByMessageId,
|
|
387
|
-
currentTurnTimeline,
|
|
388
|
-
],
|
|
389
|
-
);
|
|
390
|
-
|
|
391
396
|
const sessionOrchestrationFlow = useMemo(
|
|
392
397
|
() =>
|
|
393
398
|
resolveLatestSessionOrchestrationFlow({
|
|
@@ -485,22 +490,17 @@ export function LocalChatPanel({
|
|
|
485
490
|
selectedAgentId={selectedAgentId}
|
|
486
491
|
onSelectAgent={onSelectAgent}
|
|
487
492
|
onOpenSettings={onOpenSettings}
|
|
488
|
-
|
|
493
|
+
layoutVariant={showEmptyHero ? 'hero' : 'chat'}
|
|
494
|
+
toolbarTrailing={inputToolbarExtras}
|
|
489
495
|
leadingChrome={inputLeadingChrome}
|
|
490
496
|
trailingChrome={
|
|
491
|
-
sessionOrchestrationFlow
|
|
492
|
-
shouldShowComposerTodos(sessionTodos, isStreaming) ? (
|
|
497
|
+
sessionOrchestrationFlow ? (
|
|
493
498
|
<ComposerStatusStack>
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
/>
|
|
500
|
-
) : null}
|
|
501
|
-
{shouldShowComposerTodos(sessionTodos, isStreaming) ? (
|
|
502
|
-
<SessionTodoList todos={sessionTodos} />
|
|
503
|
-
) : null}
|
|
499
|
+
<SessionOrchestrationFlow
|
|
500
|
+
flow={sessionOrchestrationFlow}
|
|
501
|
+
chatId={chatId}
|
|
502
|
+
onInspectTask={onInspectTask}
|
|
503
|
+
/>
|
|
504
504
|
</ComposerStatusStack>
|
|
505
505
|
) : undefined
|
|
506
506
|
}
|
|
@@ -28,6 +28,8 @@ import { inferDurationMs, readPersistedDurationMs } from './elapsed';
|
|
|
28
28
|
import type { LlmSpeedSnapshot } from './process-status';
|
|
29
29
|
import type { RetryState } from './RetryStatus';
|
|
30
30
|
import type { TurnFailureCardProps } from './TurnFailureCard';
|
|
31
|
+
import { TurnTodoStrip } from './SessionTodoList';
|
|
32
|
+
import { resolveTurnTodos, shouldShowTurnTodoStrip } from './todo-list-model';
|
|
31
33
|
|
|
32
34
|
/**
|
|
33
35
|
* MessageList — scrolling viewport that renders user/assistant message
|
|
@@ -327,39 +329,80 @@ export function MessageList({
|
|
|
327
329
|
}, [checkAtBottom]);
|
|
328
330
|
|
|
329
331
|
// 右侧预览跟着这一屏在看的回合。停在底部时用最近一份能打开的产物。
|
|
332
|
+
// 区分「历史会话水合」与「本会话活跃流式回合新产出的主交付物」:仅后者带 autoReveal: true 自动开栏。
|
|
333
|
+
const previewHistoryByChatRef = useRef<
|
|
334
|
+
Map<string, { hadLiveStream: boolean; seenPaths: Set<string> }>
|
|
335
|
+
>(new Map());
|
|
336
|
+
if (chatId) {
|
|
337
|
+
let entry = previewHistoryByChatRef.current.get(chatId);
|
|
338
|
+
if (!entry) {
|
|
339
|
+
entry = { hadLiveStream: false, seenPaths: new Set() };
|
|
340
|
+
previewHistoryByChatRef.current.set(chatId, entry);
|
|
341
|
+
}
|
|
342
|
+
if (isStreaming) {
|
|
343
|
+
entry.hadLiveStream = true;
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
|
|
330
347
|
useEffect(() => {
|
|
331
348
|
if (!chatId) return;
|
|
332
|
-
|
|
349
|
+
let entry = previewHistoryByChatRef.current.get(chatId);
|
|
350
|
+
if (!entry) {
|
|
351
|
+
entry = { hadLiveStream: isStreaming, seenPaths: new Set() };
|
|
352
|
+
previewHistoryByChatRef.current.set(chatId, entry);
|
|
353
|
+
}
|
|
354
|
+
if (isStreaming) {
|
|
355
|
+
entry.hadLiveStream = true;
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
const ordered = visibleMessages
|
|
359
|
+
.filter((message) => message.role === 'assistant')
|
|
360
|
+
.map((message) => ({
|
|
361
|
+
id: message.id,
|
|
362
|
+
files: message.id === lastAssistantId
|
|
363
|
+
? (turnFilesByMessageId?.[message.id] ?? currentTurnFiles)
|
|
364
|
+
: turnFilesByMessageId?.[message.id],
|
|
365
|
+
}));
|
|
366
|
+
|
|
367
|
+
// 首次未经历流式的静态水合:把既有产物全部记入基准集合,避免打开旧会话时突然弹开右侧栏。
|
|
368
|
+
if (!entry.hadLiveStream) {
|
|
369
|
+
for (const item of ordered) {
|
|
370
|
+
for (const file of item.files ?? []) {
|
|
371
|
+
if (file.path) entry.seenPaths.add(file.path);
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
const publish = (allowAutoReveal: boolean) => {
|
|
333
377
|
const el = containerRef.current;
|
|
334
378
|
if (!el) return;
|
|
335
379
|
const atBottom =
|
|
336
380
|
el.scrollHeight - el.scrollTop - el.clientHeight < NEAR_BOTTOM_THRESHOLD_PX;
|
|
337
|
-
const ordered = visibleMessages
|
|
338
|
-
.filter((message) => message.role === 'assistant')
|
|
339
|
-
.map((message) => ({
|
|
340
|
-
id: message.id,
|
|
341
|
-
files: message.id === lastAssistantId
|
|
342
|
-
? (turnFilesByMessageId?.[message.id] ?? currentTurnFiles)
|
|
343
|
-
: turnFilesByMessageId?.[message.id],
|
|
344
|
-
}));
|
|
345
381
|
const selected = followedPreviewPath(ordered, {
|
|
346
382
|
atBottom,
|
|
347
383
|
focusedId: atBottom ? null : assistantIdInView(el),
|
|
348
384
|
});
|
|
349
385
|
if (!selected) return;
|
|
386
|
+
const isNewLiveDeliverable =
|
|
387
|
+
allowAutoReveal &&
|
|
388
|
+
Boolean(entry?.hadLiveStream) &&
|
|
389
|
+
!entry!.seenPaths.has(selected.path);
|
|
390
|
+
entry?.seenPaths.add(selected.path);
|
|
350
391
|
publishConversationPreview({
|
|
351
392
|
chatId,
|
|
352
393
|
messageId: selected.messageId,
|
|
353
394
|
path: selected.path,
|
|
395
|
+
...(isNewLiveDeliverable ? { autoReveal: true } : {}),
|
|
354
396
|
});
|
|
355
397
|
};
|
|
356
|
-
publish();
|
|
398
|
+
publish(true);
|
|
399
|
+
const onScroll = () => publish(false);
|
|
357
400
|
const el = containerRef.current;
|
|
358
|
-
el?.addEventListener('scroll',
|
|
401
|
+
el?.addEventListener('scroll', onScroll, { passive: true });
|
|
359
402
|
return () => {
|
|
360
|
-
el?.removeEventListener('scroll',
|
|
403
|
+
el?.removeEventListener('scroll', onScroll);
|
|
361
404
|
};
|
|
362
|
-
}, [chatId, currentTurnFiles, lastAssistantId, messages, turnFilesByMessageId]);
|
|
405
|
+
}, [chatId, currentTurnFiles, isStreaming, lastAssistantId, messages, turnFilesByMessageId]);
|
|
363
406
|
|
|
364
407
|
// Snap to bottom on first paint, regardless of whether the user "was" at
|
|
365
408
|
// the bottom — there's no "before" on mount.
|
|
@@ -471,15 +514,44 @@ export function MessageList({
|
|
|
471
514
|
emptyState ?? null
|
|
472
515
|
) : (
|
|
473
516
|
<div className="mx-auto w-full max-w-3xl space-y-4">
|
|
474
|
-
{conversationTurns.map((turn) =>
|
|
517
|
+
{conversationTurns.map((turn, turnIndex) => {
|
|
518
|
+
const isLatestTurn = turnIndex === conversationTurns.length - 1;
|
|
519
|
+
const hasVisibleUserGroup = Boolean(
|
|
520
|
+
turn.userGroup &&
|
|
521
|
+
!turn.userGroup.messages.every((message) => internalTrigger(message) !== null),
|
|
522
|
+
);
|
|
523
|
+
const isSingleCompactionDivider = Boolean(
|
|
524
|
+
turn.userGroup &&
|
|
525
|
+
turn.userGroup.messages.length === 1 &&
|
|
526
|
+
turn.userGroup.messages[0].content.startsWith(COMPACTED_SUMMARY_PREFIX),
|
|
527
|
+
);
|
|
528
|
+
const turnTodos =
|
|
529
|
+
hasVisibleUserGroup && !isSingleCompactionDivider
|
|
530
|
+
? resolveTurnTodos({
|
|
531
|
+
assistantMessageIds: turn.assistants.map((item) => item.message.id),
|
|
532
|
+
isLatestTurn,
|
|
533
|
+
executedActionsByMessageId,
|
|
534
|
+
timelineByMessageId,
|
|
535
|
+
currentTurnActions,
|
|
536
|
+
currentTurnTimeline,
|
|
537
|
+
})
|
|
538
|
+
: null;
|
|
539
|
+
const showTurnTodoStrip =
|
|
540
|
+
hasVisibleUserGroup &&
|
|
541
|
+
!isSingleCompactionDivider &&
|
|
542
|
+
shouldShowTurnTodoStrip(turnTodos, {
|
|
543
|
+
isLatestTurn,
|
|
544
|
+
isTurnStreaming: isLatestTurn && isStreaming,
|
|
545
|
+
});
|
|
546
|
+
|
|
547
|
+
return (
|
|
475
548
|
<div
|
|
476
549
|
key={turn.key}
|
|
477
550
|
className="conversation-turn relative space-y-4"
|
|
478
551
|
data-conversation-turn={turn.key}
|
|
479
552
|
>
|
|
480
|
-
{turn.userGroup
|
|
481
|
-
|
|
482
|
-
<div className="sticky top-0 z-10 -mx-3 px-3 py-1 bg-agent-canvas/95 backdrop-blur-xs">
|
|
553
|
+
{hasVisibleUserGroup && turn.userGroup ? (
|
|
554
|
+
<div className="sticky top-0 z-20 -mx-3 px-3 py-1 bg-agent-canvas/95 backdrop-blur-xs">
|
|
483
555
|
{turn.userGroup.messages.length === 1 ? (
|
|
484
556
|
internalTrigger(turn.userGroup.messages[0]) ? (
|
|
485
557
|
null
|
|
@@ -494,6 +566,7 @@ export function MessageList({
|
|
|
494
566
|
message={turn.userGroup.messages[0]}
|
|
495
567
|
agents={agents}
|
|
496
568
|
chats={chats}
|
|
569
|
+
attachedBottom={showTurnTodoStrip}
|
|
497
570
|
onEdit={
|
|
498
571
|
turn.userGroup.messages[0].id === lastUserId && onEditUserMessage
|
|
499
572
|
? (nextText) => onEditUserMessage(turn.userGroup!.messages[0].id, nextText)
|
|
@@ -508,7 +581,13 @@ export function MessageList({
|
|
|
508
581
|
data-message-role="user-group"
|
|
509
582
|
>
|
|
510
583
|
<div className="flex justify-start">
|
|
511
|
-
<div
|
|
584
|
+
<div
|
|
585
|
+
className={`mx-auto w-full max-w-[var(--chat-input-box-width)] overflow-hidden ${
|
|
586
|
+
showTurnTodoStrip
|
|
587
|
+
? 'rounded-t-agent-lg rounded-b-none'
|
|
588
|
+
: 'rounded-agent-lg'
|
|
589
|
+
} border border-agent-border/80 bg-agent-muted/70 shadow-sm`}
|
|
590
|
+
>
|
|
512
591
|
{turn.userGroup.messages.map((msg, idx) => (
|
|
513
592
|
internalTrigger(msg) ? (
|
|
514
593
|
null
|
|
@@ -536,6 +615,11 @@ export function MessageList({
|
|
|
536
615
|
</div>
|
|
537
616
|
</div>
|
|
538
617
|
)}
|
|
618
|
+
{showTurnTodoStrip && turnTodos ? (
|
|
619
|
+
<div className="mx-auto w-full max-w-[var(--chat-input-box-width)]">
|
|
620
|
+
<TurnTodoStrip todos={turnTodos} attachedTop />
|
|
621
|
+
</div>
|
|
622
|
+
) : null}
|
|
539
623
|
</div>
|
|
540
624
|
) : null}
|
|
541
625
|
|
|
@@ -651,6 +735,11 @@ export function MessageList({
|
|
|
651
735
|
onInspectTask={onInspectTask}
|
|
652
736
|
onContinueChild={onContinueChild}
|
|
653
737
|
onStopChild={onStopChild}
|
|
738
|
+
hideInlineNextSteps={
|
|
739
|
+
isStreamingTail ||
|
|
740
|
+
(message.id === lastAssistantId &&
|
|
741
|
+
Boolean(suggestedReplies && suggestedReplies.length > 0 && onSelectSuggestion))
|
|
742
|
+
}
|
|
654
743
|
/>
|
|
655
744
|
{!isStreaming &&
|
|
656
745
|
message.id === lastAssistantId &&
|
|
@@ -666,7 +755,8 @@ export function MessageList({
|
|
|
666
755
|
);
|
|
667
756
|
})}
|
|
668
757
|
</div>
|
|
669
|
-
|
|
758
|
+
);
|
|
759
|
+
})}
|
|
670
760
|
{/* W7-1: 中断提示卡在消息列尾部、与最后一条用户消息同列——
|
|
671
761
|
视觉上隶属于被截断的那一轮,而非全局横幅。流式期间不显示
|
|
672
762
|
(进行中的流不是中断)。 */}
|
|
@@ -150,7 +150,7 @@ export function ModelPicker({
|
|
|
150
150
|
{modelMenuOpen && (
|
|
151
151
|
<div
|
|
152
152
|
role="menu"
|
|
153
|
-
className="absolute bottom-full
|
|
153
|
+
className="absolute bottom-full right-0 z-50 mb-1 max-h-72 w-80 max-w-[calc(100vw-2rem)] overflow-y-auto rounded-agent-md border border-agent-border bg-agent-canvas p-1 shadow-lg"
|
|
154
154
|
>
|
|
155
155
|
<div className="flex items-center justify-between gap-2 px-2 py-1">
|
|
156
156
|
<span className="text-[10px] font-semibold uppercase tracking-wider text-agent-muted-foreground">
|
|
@@ -275,7 +275,7 @@ export function ModelPicker({
|
|
|
275
275
|
{effortMenuOpen && (
|
|
276
276
|
<div
|
|
277
277
|
role="menu"
|
|
278
|
-
className="absolute bottom-full
|
|
278
|
+
className="absolute bottom-full right-0 z-50 mb-1 w-36 overflow-y-auto rounded-agent-md border border-agent-border bg-agent-canvas p-1 shadow-lg"
|
|
279
279
|
>
|
|
280
280
|
<button
|
|
281
281
|
type="button"
|