@steerable/agent-shell-web 0.14.2 → 0.14.3
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/chat/ApprovalModal.tsx +426 -124
- package/src/components/chat/AssistantMessage.tsx +27 -6
- package/src/components/chat/ChatInput.tsx +23 -41
- package/src/components/chat/ChatProjectBadge.tsx +4 -4
- package/src/components/chat/ContextUsagePill.tsx +73 -21
- package/src/components/chat/ExecPolicyPicker.tsx +2 -2
- package/src/components/chat/ExecutedActionsCard.tsx +886 -180
- package/src/components/chat/LocalChatPanel.tsx +6 -3
- package/src/components/chat/ModelPicker.tsx +5 -2
- package/src/components/chat/TurnProcessGroup.tsx +37 -3
- package/src/components/chat/TurnProcessTimeline.tsx +533 -50
- package/src/components/chat/executed-actions-model.ts +1103 -61
- package/src/components/chat/process-status.ts +72 -4
- package/src/components/chat/rich-tool-views.tsx +666 -0
- package/src/components/chat/todo-list-model.ts +15 -0
- package/src/components/chat/turn-timeline.ts +51 -4
- package/src/components/settings/LlmSettingsPanel.tsx +1 -1
- package/src/components/settings/llm-vendors.ts +1 -1
- package/src/lib/browser-dev-host-mock.ts +1 -1
- package/src/pages/AgentPage.tsx +1 -2
- package/src/styles/index.css +10 -25
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
import { t } from '@/i18n';
|
|
8
8
|
import { formatElapsedCompact } from './elapsed';
|
|
9
|
+
import { deriveActionStatusInfo } from './executed-actions-model';
|
|
9
10
|
import {
|
|
10
11
|
countProcessReasoning,
|
|
11
12
|
countProcessTools,
|
|
@@ -70,27 +71,94 @@ function formatElapsedPart(
|
|
|
70
71
|
return formatElapsedCompact(elapsedMs);
|
|
71
72
|
}
|
|
72
73
|
|
|
73
|
-
|
|
74
|
+
function countFailedProcessTools(process: ReadonlyArray<ProcessTimelineBlock<unknown>>): number {
|
|
75
|
+
let failed = 0;
|
|
76
|
+
for (const block of process) {
|
|
77
|
+
if (block.type !== 'tools') continue;
|
|
78
|
+
for (const raw of block.actions) {
|
|
79
|
+
if (!raw || typeof raw !== 'object') continue;
|
|
80
|
+
const candidate = raw as { tool?: unknown; arguments?: unknown; result?: unknown };
|
|
81
|
+
if (typeof candidate.tool !== 'string') continue;
|
|
82
|
+
if (candidate.result === undefined || candidate.result === null) continue;
|
|
83
|
+
const info = deriveActionStatusInfo({
|
|
84
|
+
tool: candidate.tool,
|
|
85
|
+
arguments: candidate.arguments,
|
|
86
|
+
result: candidate.result,
|
|
87
|
+
});
|
|
88
|
+
if (info.status === 'failed') failed += 1;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
return failed;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
function blockPhase(block: ProcessTimelineBlock<unknown>): number {
|
|
95
|
+
if (block.type === 'reasoning') return 0;
|
|
96
|
+
if (block.type === 'text') return 1;
|
|
97
|
+
return 2;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
function countHistoryStages(process: ReadonlyArray<ProcessTimelineBlock<unknown>>): number {
|
|
101
|
+
if (process.length === 0) return 0;
|
|
102
|
+
let stages = 1;
|
|
103
|
+
for (let i = 1; i < process.length; i += 1) {
|
|
104
|
+
if (blockPhase(process[i]!) <= blockPhase(process[i - 1]!)) {
|
|
105
|
+
stages += 1;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
return stages;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* L0 turn disclosure header (Codex `FinalMessageSeparator` / `TurnRow::Prompt` style):
|
|
113
|
+
* - Streaming: compact `Working`
|
|
114
|
+
* - Finished (`elapsed >= 1s`): concise `Worked for {elapsed}` (appending `· N failed` only when the turn failed)
|
|
115
|
+
* - Finished (`< 1s` or untimed): fallback to concise process counts
|
|
116
|
+
*/
|
|
74
117
|
export function processStatusLabel(input: {
|
|
75
118
|
process: ReadonlyArray<ProcessTimelineBlock<unknown>>;
|
|
76
119
|
isStreaming: boolean;
|
|
77
120
|
elapsedMs?: number;
|
|
78
121
|
hideThinking?: boolean;
|
|
122
|
+
turnFailed?: boolean;
|
|
79
123
|
}): string {
|
|
80
|
-
const { process, isStreaming, elapsedMs, hideThinking } = input;
|
|
124
|
+
const { process, isStreaming, elapsedMs, hideThinking, turnFailed } = input;
|
|
81
125
|
if (isStreaming) return t('Working');
|
|
82
126
|
|
|
127
|
+
const elapsed = formatElapsedPart(false, elapsedMs);
|
|
128
|
+
const failedCount = turnFailed ? countFailedProcessTools(process) : 0;
|
|
129
|
+
if (elapsed) {
|
|
130
|
+
const base = t('Worked for {elapsed}', { elapsed });
|
|
131
|
+
return failedCount > 0 ? `${base} · ${t('{count} failed', { count: failedCount })}` : base;
|
|
132
|
+
}
|
|
133
|
+
|
|
83
134
|
const parts: string[] = [];
|
|
84
135
|
const thinks = hideThinking ? 0 : countProcessReasoning(process);
|
|
85
136
|
const tools = countProcessTools(process);
|
|
86
|
-
const elapsed = formatElapsedPart(false, elapsedMs);
|
|
87
|
-
if (elapsed) parts.push(t('Worked {elapsed}', { elapsed }));
|
|
88
137
|
if (thinks > 0) parts.push(t('Thought {count} times', { count: thinks }));
|
|
89
138
|
if (tools > 0) parts.push(t('{count} tool calls', { count: tools }));
|
|
139
|
+
if (failedCount > 0) parts.push(t('{count} failed', { count: failedCount }));
|
|
90
140
|
if (parts.length === 0) return t('Run process');
|
|
91
141
|
return parts.join(' · ');
|
|
92
142
|
}
|
|
93
143
|
|
|
144
|
+
/**
|
|
145
|
+
* Single-line summary for folded prior process steps so only the latest stage
|
|
146
|
+
* (`thinking` / `output` / latest single tool) remains directly visible.
|
|
147
|
+
*/
|
|
148
|
+
export function completedHistoryLabel(
|
|
149
|
+
process: ReadonlyArray<ProcessTimelineBlock<unknown>>,
|
|
150
|
+
options?: { showFailedCount?: boolean },
|
|
151
|
+
): string {
|
|
152
|
+
const tools = countProcessTools(process);
|
|
153
|
+
const failedCount = options?.showFailedCount ? countFailedProcessTools(process) : 0;
|
|
154
|
+
const steps = tools > 0 ? tools : countHistoryStages(process);
|
|
155
|
+
const base =
|
|
156
|
+
steps === 1
|
|
157
|
+
? t('Completed 1 step')
|
|
158
|
+
: t('Completed {count} steps', { count: steps });
|
|
159
|
+
return failedCount > 0 ? `${base} · ${t('{count} failed', { count: failedCount })}` : base;
|
|
160
|
+
}
|
|
161
|
+
|
|
94
162
|
/** Per-round 思考 fold: live time, or frozen duration after that round ends. */
|
|
95
163
|
export function thinkingFoldLabel(input: {
|
|
96
164
|
content: string;
|