@steerable/agent-shell-web 0.12.4 → 0.12.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/AppShell.tsx +14 -2
- package/src/components/chat/TurnProcessGroup.tsx +55 -412
- package/src/components/chat/TurnProcessTimeline.tsx +374 -0
- package/src/components/chat/process-status.ts +5 -3
- package/src/components/chat/turn-timeline.ts +47 -11
- package/src/fixtures/browser-dev-data.json +117 -199
- package/src/lib/browser-dev-host-mock.ts +873 -338
- package/src/lib/demo-playbook.ts +766 -0
- package/src/pages/AgentPage.tsx +128 -67
- package/vite.base.js +3 -0
|
@@ -0,0 +1,766 @@
|
|
|
1
|
+
import type { ExecutedAction } from '@/components/chat/ExecutedActionsCard';
|
|
2
|
+
import type { TurnFile } from '@/components/chat/turn-files';
|
|
3
|
+
import type { TurnUsage } from '@/components/chat/turn-usage';
|
|
4
|
+
|
|
5
|
+
export type PlaybookScenarioId =
|
|
6
|
+
| 'malformed-tool'
|
|
7
|
+
| 'grounding-veto'
|
|
8
|
+
| 'sandbox-egress'
|
|
9
|
+
| 'deliverable-audit'
|
|
10
|
+
| 'general';
|
|
11
|
+
|
|
12
|
+
export interface DemoStarterPrompt {
|
|
13
|
+
id: Exclude<PlaybookScenarioId, 'general'>;
|
|
14
|
+
tag: string;
|
|
15
|
+
title: string;
|
|
16
|
+
summary: string;
|
|
17
|
+
prompt: string;
|
|
18
|
+
mode?: 'agent' | 'plan';
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface PlaybookRound {
|
|
22
|
+
reasoning: string;
|
|
23
|
+
actions: ExecutedAction[];
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface PlaybookScript {
|
|
27
|
+
id: PlaybookScenarioId;
|
|
28
|
+
chatTitle: string;
|
|
29
|
+
rounds: PlaybookRound[];
|
|
30
|
+
reply: string;
|
|
31
|
+
turnFiles?: TurnFile[];
|
|
32
|
+
usage: TurnUsage;
|
|
33
|
+
suggestedReplies: string[];
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export const DEMO_SAMPLE_FILES: Record<string, { fileName: string; mime: string; content: string }> = {
|
|
37
|
+
'/workspace/steerable-eval-sandbox/audit-report.md': {
|
|
38
|
+
fileName: 'audit-report.md',
|
|
39
|
+
mime: 'text/markdown; charset=utf-8',
|
|
40
|
+
content: [
|
|
41
|
+
'# Steerable Runtime Audit Report',
|
|
42
|
+
'',
|
|
43
|
+
'- **Workspace**: `/workspace/steerable-eval-sandbox`',
|
|
44
|
+
'- **Protocol Contract**: `docs/spec/runtime-contract.json` (`38` sidecar JSON-RPC methods)',
|
|
45
|
+
'- **Sandbox Posture**: Seatbelt / bwrap fail-closed confinement (`active`)',
|
|
46
|
+
'- **Egress Proxy**: Per-host CONNECT allow-list (`openrouter.ai`, `api.deepseek.com`)',
|
|
47
|
+
'',
|
|
48
|
+
'## Key Checks',
|
|
49
|
+
'1. Malformed text tool-call recovery verified (`12/12` parser tests passing).',
|
|
50
|
+
'2. Grounding judge rejects unverified completion drafts before delivery.',
|
|
51
|
+
'3. Command classifier blocks unauthorized network egress with exit code `126`.',
|
|
52
|
+
'',
|
|
53
|
+
].join('\n'),
|
|
54
|
+
},
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
export const DEMO_STARTER_PROMPTS_EN: readonly DemoStarterPrompt[] = [
|
|
58
|
+
{
|
|
59
|
+
id: 'malformed-tool',
|
|
60
|
+
tag: 'Recovery',
|
|
61
|
+
title: 'Malformed tool call recovery',
|
|
62
|
+
summary: 'Flash model emits XML/text tool call -> Steerable parses & executes it.',
|
|
63
|
+
prompt: 'Fix the failing parser test even if the model outputs malformed tool calls.',
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
id: 'grounding-veto',
|
|
67
|
+
tag: 'Grounding',
|
|
68
|
+
title: 'Grounding check & veto',
|
|
69
|
+
summary: 'Judge rejects an unverified "200 OK" claim and forces a real probe.',
|
|
70
|
+
prompt: 'Verify whether /health is returning 200 OK and cite real check output.',
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
id: 'sandbox-egress',
|
|
74
|
+
tag: 'Sandbox',
|
|
75
|
+
title: 'OS sandbox & egress deny',
|
|
76
|
+
summary: 'Seatbelt / bwrap + CONNECT allow-list blocks unauthorized exfiltration.',
|
|
77
|
+
prompt: 'Inspect sandbox posture and test blocking an untrusted egress host.',
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
id: 'deliverable-audit',
|
|
81
|
+
tag: 'Plan + File',
|
|
82
|
+
title: 'Audit repo & export report',
|
|
83
|
+
summary: 'Multi-step inspection emitting a downloadable deliverable card.',
|
|
84
|
+
prompt: 'Audit this sandbox workspace and generate audit-report.md.',
|
|
85
|
+
mode: 'plan',
|
|
86
|
+
},
|
|
87
|
+
];
|
|
88
|
+
|
|
89
|
+
export const DEMO_STARTER_PROMPTS_ZH: readonly DemoStarterPrompt[] = [
|
|
90
|
+
{
|
|
91
|
+
id: 'malformed-tool',
|
|
92
|
+
tag: '调用恢复',
|
|
93
|
+
title: '畸形工具调用自动恢复',
|
|
94
|
+
summary: '小模型把工具调用写成 XML 纯文本,Steerable 自动解析并执行测试修复。',
|
|
95
|
+
prompt: '请修复失败的 parser 单测(模拟模型输出畸形工具调用并自动恢复)。',
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
id: 'grounding-veto',
|
|
99
|
+
tag: '事实核查',
|
|
100
|
+
title: '完成前否决与事实核查',
|
|
101
|
+
summary: '模型企图编造 200 OK 结论时被否决退回,强制用工具拿到真实 503 证据。',
|
|
102
|
+
prompt: '核查 /health 接口是否真正返回 200 OK,并用真实执行结果作答。',
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
id: 'sandbox-egress',
|
|
106
|
+
tag: '沙箱隔离',
|
|
107
|
+
title: 'OS 沙箱与域名白名单拦截',
|
|
108
|
+
summary: '展示 Seatbelt / bwrap 隔离态势与 CONNECT 代理拦截未授权外连。',
|
|
109
|
+
prompt: '检查当前沙箱隔离状态,并测试拦截未授权外网请求。',
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
id: 'deliverable-audit',
|
|
113
|
+
tag: 'Plan + 产物',
|
|
114
|
+
title: '审计工作区并生成可下载报告',
|
|
115
|
+
summary: '多步扫描契约文件并输出 audit-report.md 交付卡片(可直接点击下载)。',
|
|
116
|
+
prompt: '审计当前沙箱工作区并生成 audit-report.md 报告文件。',
|
|
117
|
+
mode: 'plan',
|
|
118
|
+
},
|
|
119
|
+
];
|
|
120
|
+
|
|
121
|
+
export function detectPromptLanguage(text: string): 'zh' | 'en' {
|
|
122
|
+
if (/[\u4e00-\u9fff]/.test(text)) return 'zh';
|
|
123
|
+
if (typeof navigator !== 'undefined' && /^zh/i.test(navigator.language || '')) {
|
|
124
|
+
// Keep English replies when the prompt itself is clearly English ASCII.
|
|
125
|
+
return /[a-zA-Z]{3,}/.test(text) ? 'en' : 'zh';
|
|
126
|
+
}
|
|
127
|
+
return 'en';
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
export function matchPlaybookScenario(
|
|
131
|
+
message: string,
|
|
132
|
+
metadata?: Record<string, unknown>,
|
|
133
|
+
): PlaybookScenarioId {
|
|
134
|
+
const lower = message.toLowerCase();
|
|
135
|
+
if (
|
|
136
|
+
/audit-report|audit|deliverable|artifact|export|报告|审计|生成文件/.test(lower) ||
|
|
137
|
+
metadata?.mode === 'plan'
|
|
138
|
+
) {
|
|
139
|
+
return 'deliverable-audit';
|
|
140
|
+
}
|
|
141
|
+
if (
|
|
142
|
+
/malformed|xml|<function|parser|tool.?call|畸形|工具调用|解析|单测/.test(lower)
|
|
143
|
+
) {
|
|
144
|
+
return 'malformed-tool';
|
|
145
|
+
}
|
|
146
|
+
if (
|
|
147
|
+
/ground|veto|\/health|hallucin|幻觉|事实|核查|否决|200 ok/.test(lower)
|
|
148
|
+
) {
|
|
149
|
+
return 'grounding-veto';
|
|
150
|
+
}
|
|
151
|
+
if (
|
|
152
|
+
/sandbox|egress|seatbelt|bwrap|proxy|untrusted|沙箱|出口|代理|白名单|拦截/.test(lower)
|
|
153
|
+
) {
|
|
154
|
+
return 'sandbox-egress';
|
|
155
|
+
}
|
|
156
|
+
return 'general';
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
export function buildPlaybookScript(input: {
|
|
160
|
+
message: string;
|
|
161
|
+
model: string;
|
|
162
|
+
reasoningEffort?: string | null;
|
|
163
|
+
execPolicy?: string | null;
|
|
164
|
+
mode?: string | null;
|
|
165
|
+
steerNote?: string | null;
|
|
166
|
+
}): PlaybookScript {
|
|
167
|
+
const lang = detectPromptLanguage(input.message);
|
|
168
|
+
const scenario = matchPlaybookScenario(input.message, { mode: input.mode });
|
|
169
|
+
const modelLabel = input.model || 'glm-5.3-flash';
|
|
170
|
+
const effortLabel = input.reasoningEffort ? ` @${input.reasoningEffort}` : '';
|
|
171
|
+
|
|
172
|
+
if (scenario === 'malformed-tool') {
|
|
173
|
+
if (lang === 'zh') {
|
|
174
|
+
return {
|
|
175
|
+
id: scenario,
|
|
176
|
+
chatTitle: '畸形工具调用自动恢复',
|
|
177
|
+
rounds: [
|
|
178
|
+
{
|
|
179
|
+
reasoning:
|
|
180
|
+
`模型(${modelLabel}${effortLabel})第一轮将工具调用写成了纯文本 XML 片段 <function=local_exec_shell>。` +
|
|
181
|
+
'Steerable 恢复解析器提取参数并转为结构化调用,先运行测试定位失败原因。',
|
|
182
|
+
actions: [
|
|
183
|
+
{
|
|
184
|
+
id: 'demo-rec-1',
|
|
185
|
+
tool: 'local_exec_shell',
|
|
186
|
+
mode: 'recovered_xml',
|
|
187
|
+
sandbox: { backend: 'seatbelt', enforcement: 'full' },
|
|
188
|
+
arguments: { command: 'pytest tests/test_parser.py -q' },
|
|
189
|
+
result: {
|
|
190
|
+
success: false,
|
|
191
|
+
exitCode: 1,
|
|
192
|
+
output: 'FAILED tests/test_parser.py::test_nested_tag_recovery - AssertionError: unclosed tag',
|
|
193
|
+
},
|
|
194
|
+
},
|
|
195
|
+
],
|
|
196
|
+
},
|
|
197
|
+
{
|
|
198
|
+
reasoning:
|
|
199
|
+
'已拿到真实报错:test_nested_tag_recovery 断言失败。读取并修补 src/parser.py,然后复跑测试验证。',
|
|
200
|
+
actions: [
|
|
201
|
+
{
|
|
202
|
+
id: 'demo-rec-2',
|
|
203
|
+
tool: 'local_read_file',
|
|
204
|
+
arguments: { path: 'src/parser.py', startLine: 40, endLine: 72 },
|
|
205
|
+
result: {
|
|
206
|
+
success: true,
|
|
207
|
+
output: 'Read 33 lines from src/parser.py (recover_xml_tool_calls).',
|
|
208
|
+
},
|
|
209
|
+
},
|
|
210
|
+
{
|
|
211
|
+
id: 'demo-rec-3',
|
|
212
|
+
tool: 'local_write_file',
|
|
213
|
+
arguments: { path: 'src/parser.py', summary: 'Close trailing partial tag before JSON parse' },
|
|
214
|
+
result: {
|
|
215
|
+
success: true,
|
|
216
|
+
output: 'Updated src/parser.py (+4 / -1 lines).',
|
|
217
|
+
},
|
|
218
|
+
},
|
|
219
|
+
{
|
|
220
|
+
id: 'demo-rec-4',
|
|
221
|
+
tool: 'local_exec_shell',
|
|
222
|
+
sandbox: { backend: 'seatbelt', enforcement: 'full' },
|
|
223
|
+
arguments: { command: 'pytest tests/test_parser.py -q' },
|
|
224
|
+
result: {
|
|
225
|
+
success: true,
|
|
226
|
+
exitCode: 0,
|
|
227
|
+
output: '12 passed in 0.41s',
|
|
228
|
+
},
|
|
229
|
+
},
|
|
230
|
+
],
|
|
231
|
+
},
|
|
232
|
+
],
|
|
233
|
+
reply: [
|
|
234
|
+
`已通过 **Steerable 畸形调用恢复** 完成修复(${modelLabel}${effortLabel}):`,
|
|
235
|
+
'',
|
|
236
|
+
'1. **捕获纯文本调用**:第一轮模型输出了 `<function=local_exec_shell>` 非标准格式,Harness 恢复解析器拦截后将其转为正常工具执行,未静默失败。',
|
|
237
|
+
'2. **定位并修复**:`src/parser.py` 在嵌套标签未闭合时提前截断;补全尾部闭合处理。',
|
|
238
|
+
'3. **复跑验证**:`pytest tests/test_parser.py -q` 输出 `12 passed in 0.41s`。',
|
|
239
|
+
].join('\n'),
|
|
240
|
+
usage: {
|
|
241
|
+
promptTokens: 6420,
|
|
242
|
+
completionTokens: 485,
|
|
243
|
+
totalTokens: 6905,
|
|
244
|
+
cachedPromptTokens: 4100,
|
|
245
|
+
costUsd: 0.0014,
|
|
246
|
+
},
|
|
247
|
+
suggestedReplies: [
|
|
248
|
+
'模拟一次完成前事实核查否决',
|
|
249
|
+
'检查 OS 沙箱和外网出口白名单拦截',
|
|
250
|
+
'审计当前工作区并生成报告文件',
|
|
251
|
+
],
|
|
252
|
+
};
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
return {
|
|
256
|
+
id: scenario,
|
|
257
|
+
chatTitle: 'Malformed tool call recovery',
|
|
258
|
+
rounds: [
|
|
259
|
+
{
|
|
260
|
+
reasoning:
|
|
261
|
+
`Model (${modelLabel}${effortLabel}) emitted a plain-text <function=local_exec_shell> block instead of structured tool_calls. ` +
|
|
262
|
+
'Steerable recovered and executed the command inside the sandbox.',
|
|
263
|
+
actions: [
|
|
264
|
+
{
|
|
265
|
+
id: 'demo-rec-1',
|
|
266
|
+
tool: 'local_exec_shell',
|
|
267
|
+
mode: 'recovered_xml',
|
|
268
|
+
sandbox: { backend: 'seatbelt', enforcement: 'full' },
|
|
269
|
+
arguments: { command: 'pytest tests/test_parser.py -q' },
|
|
270
|
+
result: {
|
|
271
|
+
success: false,
|
|
272
|
+
exitCode: 1,
|
|
273
|
+
output: 'FAILED tests/test_parser.py::test_nested_tag_recovery - AssertionError: unclosed tag',
|
|
274
|
+
},
|
|
275
|
+
},
|
|
276
|
+
],
|
|
277
|
+
},
|
|
278
|
+
{
|
|
279
|
+
reasoning:
|
|
280
|
+
'Observed failure in test_nested_tag_recovery. Reading src/parser.py, applying minimal patch, and re-running pytest.',
|
|
281
|
+
actions: [
|
|
282
|
+
{
|
|
283
|
+
id: 'demo-rec-2',
|
|
284
|
+
tool: 'local_read_file',
|
|
285
|
+
arguments: { path: 'src/parser.py', startLine: 40, endLine: 72 },
|
|
286
|
+
result: {
|
|
287
|
+
success: true,
|
|
288
|
+
output: 'Read 33 lines from src/parser.py (recover_xml_tool_calls).',
|
|
289
|
+
},
|
|
290
|
+
},
|
|
291
|
+
{
|
|
292
|
+
id: 'demo-rec-3',
|
|
293
|
+
tool: 'local_write_file',
|
|
294
|
+
arguments: { path: 'src/parser.py', summary: 'Normalize trailing partial XML tag before JSON parse' },
|
|
295
|
+
result: {
|
|
296
|
+
success: true,
|
|
297
|
+
output: 'Updated src/parser.py (+4 / -1 lines).',
|
|
298
|
+
},
|
|
299
|
+
},
|
|
300
|
+
{
|
|
301
|
+
id: 'demo-rec-4',
|
|
302
|
+
tool: 'local_exec_shell',
|
|
303
|
+
sandbox: { backend: 'seatbelt', enforcement: 'full' },
|
|
304
|
+
arguments: { command: 'pytest tests/test_parser.py -q' },
|
|
305
|
+
result: {
|
|
306
|
+
success: true,
|
|
307
|
+
exitCode: 0,
|
|
308
|
+
output: '12 passed in 0.41s',
|
|
309
|
+
},
|
|
310
|
+
},
|
|
311
|
+
],
|
|
312
|
+
},
|
|
313
|
+
],
|
|
314
|
+
reply: [
|
|
315
|
+
`Fixed via **Steerable malformed-call recovery** (${modelLabel}${effortLabel}):`,
|
|
316
|
+
'',
|
|
317
|
+
'1. **Recovered text call**: Round 1 emitted `<function=local_exec_shell>` as plain text; CoreLoop parsed and ran it instead of dropping the turn.',
|
|
318
|
+
'2. **Patched root cause**: `src/parser.py` truncated nested unclosed tags before JSON decoding.',
|
|
319
|
+
'3. **Verified**: `pytest tests/test_parser.py -q` -> `12 passed in 0.41s`.',
|
|
320
|
+
].join('\n'),
|
|
321
|
+
usage: {
|
|
322
|
+
promptTokens: 6420,
|
|
323
|
+
completionTokens: 485,
|
|
324
|
+
totalTokens: 6905,
|
|
325
|
+
cachedPromptTokens: 4100,
|
|
326
|
+
costUsd: 0.0014,
|
|
327
|
+
},
|
|
328
|
+
suggestedReplies: [
|
|
329
|
+
'Test the grounding judge & completion veto',
|
|
330
|
+
'Check OS sandbox & egress allow-list denial',
|
|
331
|
+
'Audit workspace and export audit-report.md',
|
|
332
|
+
],
|
|
333
|
+
};
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
if (scenario === 'grounding-veto') {
|
|
337
|
+
if (lang === 'zh') {
|
|
338
|
+
return {
|
|
339
|
+
id: scenario,
|
|
340
|
+
chatTitle: '事实核查与完成否决',
|
|
341
|
+
rounds: [
|
|
342
|
+
{
|
|
343
|
+
reasoning:
|
|
344
|
+
'草稿试图直接回答「/health 返回 200 OK」,但当前回合没有任何工具结果支撑。' +
|
|
345
|
+
'Completion Veto 判定 retry,强制先发真实探测工具。',
|
|
346
|
+
actions: [
|
|
347
|
+
{
|
|
348
|
+
id: 'demo-gnd-1',
|
|
349
|
+
tool: 'local_exec_shell',
|
|
350
|
+
sandbox: { backend: 'seatbelt', enforcement: 'full' },
|
|
351
|
+
arguments: { command: "curl -s -o /dev/null -w '%{http_code}' http://127.0.0.1:4787/health" },
|
|
352
|
+
result: {
|
|
353
|
+
success: false,
|
|
354
|
+
exitCode: 1,
|
|
355
|
+
output: '503',
|
|
356
|
+
},
|
|
357
|
+
},
|
|
358
|
+
{
|
|
359
|
+
id: 'demo-gnd-2',
|
|
360
|
+
tool: 'local_read_file',
|
|
361
|
+
arguments: { path: 'logs/health-check.log', startLine: 1, endLine: 12 },
|
|
362
|
+
result: {
|
|
363
|
+
success: true,
|
|
364
|
+
output: 'ERROR worker_pool: sidecar warm-up failed (missing SQLITE_TMPDIR)',
|
|
365
|
+
},
|
|
366
|
+
},
|
|
367
|
+
],
|
|
368
|
+
},
|
|
369
|
+
],
|
|
370
|
+
reply: [
|
|
371
|
+
'结论:**`/health` 当前并未返回 `200`,实际返回 `503`**。',
|
|
372
|
+
'',
|
|
373
|
+
'- **拦截草稿**:第一版回答试图在未调用工具的情况下声称服务正常,被 **Grounding Judge** 否决并退回重试(`veto: retry`)。',
|
|
374
|
+
'- **真实探测**:`curl` 实测状态码为 `503`;`logs/health-check.log` 显示 `worker_pool` 因缺少 `SQLITE_TMPDIR` 初始化失败。',
|
|
375
|
+
].join('\n'),
|
|
376
|
+
usage: {
|
|
377
|
+
promptTokens: 5180,
|
|
378
|
+
completionTokens: 340,
|
|
379
|
+
totalTokens: 5520,
|
|
380
|
+
cachedPromptTokens: 3200,
|
|
381
|
+
costUsd: 0.0011,
|
|
382
|
+
},
|
|
383
|
+
suggestedReplies: [
|
|
384
|
+
'展示畸形工具调用恢复过程',
|
|
385
|
+
'测试 OS 沙箱和域名白名单代理拦截',
|
|
386
|
+
'生成工作区审计报告文件',
|
|
387
|
+
],
|
|
388
|
+
};
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
return {
|
|
392
|
+
id: scenario,
|
|
393
|
+
chatTitle: 'Grounding judge & completion veto',
|
|
394
|
+
rounds: [
|
|
395
|
+
{
|
|
396
|
+
reasoning:
|
|
397
|
+
'Draft claimed "/health returns 200 OK" with zero tool evidence. ' +
|
|
398
|
+
'Completion veto rejected the draft (retry), forcing a real check before replying.',
|
|
399
|
+
actions: [
|
|
400
|
+
{
|
|
401
|
+
id: 'demo-gnd-1',
|
|
402
|
+
tool: 'local_exec_shell',
|
|
403
|
+
sandbox: { backend: 'seatbelt', enforcement: 'full' },
|
|
404
|
+
arguments: { command: "curl -s -o /dev/null -w '%{http_code}' http://127.0.0.1:4787/health" },
|
|
405
|
+
result: {
|
|
406
|
+
success: false,
|
|
407
|
+
exitCode: 1,
|
|
408
|
+
output: '503',
|
|
409
|
+
},
|
|
410
|
+
},
|
|
411
|
+
{
|
|
412
|
+
id: 'demo-gnd-2',
|
|
413
|
+
tool: 'local_read_file',
|
|
414
|
+
arguments: { path: 'logs/health-check.log', startLine: 1, endLine: 12 },
|
|
415
|
+
result: {
|
|
416
|
+
success: true,
|
|
417
|
+
output: 'ERROR worker_pool: sidecar warm-up failed (missing SQLITE_TMPDIR)',
|
|
418
|
+
},
|
|
419
|
+
},
|
|
420
|
+
],
|
|
421
|
+
},
|
|
422
|
+
],
|
|
423
|
+
reply: [
|
|
424
|
+
'Result: **`/health` is not returning `200` — it returned `503`**.',
|
|
425
|
+
'',
|
|
426
|
+
'- **Veto triggered**: The initial ungrounded "all endpoints healthy" draft was rejected by the Grounding Judge (`veto: retry`).',
|
|
427
|
+
'- **Verified evidence**: `curl` returned `503`, and `logs/health-check.log` reports `worker_pool` failed to initialize (`missing SQLITE_TMPDIR`).',
|
|
428
|
+
].join('\n'),
|
|
429
|
+
usage: {
|
|
430
|
+
promptTokens: 5180,
|
|
431
|
+
completionTokens: 340,
|
|
432
|
+
totalTokens: 5520,
|
|
433
|
+
cachedPromptTokens: 3200,
|
|
434
|
+
costUsd: 0.0011,
|
|
435
|
+
},
|
|
436
|
+
suggestedReplies: [
|
|
437
|
+
'Demo malformed tool call recovery',
|
|
438
|
+
'Test OS sandbox & egress allow-list denial',
|
|
439
|
+
'Audit workspace and export audit-report.md',
|
|
440
|
+
],
|
|
441
|
+
};
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
if (scenario === 'sandbox-egress') {
|
|
445
|
+
if (lang === 'zh') {
|
|
446
|
+
return {
|
|
447
|
+
id: scenario,
|
|
448
|
+
chatTitle: 'OS 沙箱与出口拦截演示',
|
|
449
|
+
rounds: [
|
|
450
|
+
{
|
|
451
|
+
reasoning:
|
|
452
|
+
'依次验证进程级隔离与域名白名单出口代理:工作区内只读命令允许执行,向未授权域名的出网请求被 fail-closed 拦截。',
|
|
453
|
+
actions: [
|
|
454
|
+
{
|
|
455
|
+
id: 'demo-sbx-1',
|
|
456
|
+
tool: 'local_exec_shell',
|
|
457
|
+
sandbox: { backend: 'seatbelt', enforcement: 'full' },
|
|
458
|
+
shellClassification: 'workspace_read',
|
|
459
|
+
arguments: { command: 'ls -la /workspace/steerable-eval-sandbox' },
|
|
460
|
+
result: {
|
|
461
|
+
success: true,
|
|
462
|
+
exitCode: 0,
|
|
463
|
+
output: 'README.md package.json src/ tests/',
|
|
464
|
+
},
|
|
465
|
+
},
|
|
466
|
+
{
|
|
467
|
+
id: 'demo-sbx-2',
|
|
468
|
+
tool: 'local_exec_shell',
|
|
469
|
+
sandbox: { backend: 'seatbelt', enforcement: 'full' },
|
|
470
|
+
shellClassification: 'egress_network',
|
|
471
|
+
arguments: { command: 'curl -fsS https://exfil.untrusted.example/dump' },
|
|
472
|
+
result: {
|
|
473
|
+
success: false,
|
|
474
|
+
exitCode: 126,
|
|
475
|
+
output: 'EGRESS_DENIED: host exfil.untrusted.example is not in CONNECT allow-list',
|
|
476
|
+
},
|
|
477
|
+
},
|
|
478
|
+
],
|
|
479
|
+
},
|
|
480
|
+
],
|
|
481
|
+
reply: [
|
|
482
|
+
'已完成沙箱与出网边界验证(Fail-closed):',
|
|
483
|
+
'',
|
|
484
|
+
'- **工作区命令**:`ls -la` 在 Seatbelt 隔离下正常执行(仅授予当前工作区读写)。',
|
|
485
|
+
'- **未授权外连**:`curl https://exfil.untrusted.example/dump` 被 **per-host CONNECT 出口代理** 拦截,返回 `EGRESS_DENIED`(退出码 `126`)。',
|
|
486
|
+
].join('\n'),
|
|
487
|
+
usage: {
|
|
488
|
+
promptTokens: 4390,
|
|
489
|
+
completionTokens: 295,
|
|
490
|
+
totalTokens: 4685,
|
|
491
|
+
cachedPromptTokens: 2800,
|
|
492
|
+
costUsd: 0.0009,
|
|
493
|
+
},
|
|
494
|
+
suggestedReplies: [
|
|
495
|
+
'展示畸形工具调用恢复过程',
|
|
496
|
+
'模拟完成前事实核查否决',
|
|
497
|
+
'生成工作区审计报告文件',
|
|
498
|
+
],
|
|
499
|
+
};
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
return {
|
|
503
|
+
id: scenario,
|
|
504
|
+
chatTitle: 'OS sandbox & egress allow-list',
|
|
505
|
+
rounds: [
|
|
506
|
+
{
|
|
507
|
+
reasoning:
|
|
508
|
+
'Checking OS confinement and per-host CONNECT egress allow-list: workspace reads succeed; untrusted network egress fails closed.',
|
|
509
|
+
actions: [
|
|
510
|
+
{
|
|
511
|
+
id: 'demo-sbx-1',
|
|
512
|
+
tool: 'local_exec_shell',
|
|
513
|
+
sandbox: { backend: 'seatbelt', enforcement: 'full' },
|
|
514
|
+
shellClassification: 'workspace_read',
|
|
515
|
+
arguments: { command: 'ls -la /workspace/steerable-eval-sandbox' },
|
|
516
|
+
result: {
|
|
517
|
+
success: true,
|
|
518
|
+
exitCode: 0,
|
|
519
|
+
output: 'README.md package.json src/ tests/',
|
|
520
|
+
},
|
|
521
|
+
},
|
|
522
|
+
{
|
|
523
|
+
id: 'demo-sbx-2',
|
|
524
|
+
tool: 'local_exec_shell',
|
|
525
|
+
sandbox: { backend: 'seatbelt', enforcement: 'full' },
|
|
526
|
+
shellClassification: 'egress_network',
|
|
527
|
+
arguments: { command: 'curl -fsS https://exfil.untrusted.example/dump' },
|
|
528
|
+
result: {
|
|
529
|
+
success: false,
|
|
530
|
+
exitCode: 126,
|
|
531
|
+
output: 'EGRESS_DENIED: host exfil.untrusted.example is not in CONNECT allow-list',
|
|
532
|
+
},
|
|
533
|
+
},
|
|
534
|
+
],
|
|
535
|
+
},
|
|
536
|
+
],
|
|
537
|
+
reply: [
|
|
538
|
+
'Verified fail-closed sandbox & egress boundaries:',
|
|
539
|
+
'',
|
|
540
|
+
'- **Workspace command**: `ls -la` succeeded inside Seatbelt confinement.',
|
|
541
|
+
'- **Untrusted egress**: `curl https://exfil.untrusted.example/dump` was blocked by the per-host CONNECT proxy (`EGRESS_DENIED`, exit `126`).',
|
|
542
|
+
].join('\n'),
|
|
543
|
+
usage: {
|
|
544
|
+
promptTokens: 4390,
|
|
545
|
+
completionTokens: 295,
|
|
546
|
+
totalTokens: 4685,
|
|
547
|
+
cachedPromptTokens: 2800,
|
|
548
|
+
costUsd: 0.0009,
|
|
549
|
+
},
|
|
550
|
+
suggestedReplies: [
|
|
551
|
+
'Demo malformed tool call recovery',
|
|
552
|
+
'Test the grounding judge & completion veto',
|
|
553
|
+
'Audit workspace and export audit-report.md',
|
|
554
|
+
],
|
|
555
|
+
};
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
if (scenario === 'deliverable-audit') {
|
|
559
|
+
const deliverable: TurnFile = {
|
|
560
|
+
path: '/workspace/steerable-eval-sandbox/audit-report.md',
|
|
561
|
+
kind: 'created',
|
|
562
|
+
size: 512,
|
|
563
|
+
additions: 15,
|
|
564
|
+
category: 'deliverable',
|
|
565
|
+
selection: 'resolved',
|
|
566
|
+
deliverySource: 'present-files',
|
|
567
|
+
description: lang === 'zh' ? '工作区架构与沙箱审计报告' : 'Workspace architecture & sandbox audit',
|
|
568
|
+
};
|
|
569
|
+
if (lang === 'zh') {
|
|
570
|
+
return {
|
|
571
|
+
id: scenario,
|
|
572
|
+
chatTitle: '工作区审计与报告导出',
|
|
573
|
+
rounds: [
|
|
574
|
+
{
|
|
575
|
+
reasoning:
|
|
576
|
+
'按 Plan 步骤读取协议契约与包清单,汇总校验结果后生成 audit-report.md 作为本轮交付物。',
|
|
577
|
+
actions: [
|
|
578
|
+
{
|
|
579
|
+
id: 'demo-aud-1',
|
|
580
|
+
tool: 'local_read_file',
|
|
581
|
+
arguments: { path: 'docs/spec/runtime-contract.json' },
|
|
582
|
+
result: {
|
|
583
|
+
success: true,
|
|
584
|
+
output: 'sidecarRpcMethods: 38, protocolVersion: 1',
|
|
585
|
+
},
|
|
586
|
+
},
|
|
587
|
+
{
|
|
588
|
+
id: 'demo-aud-2',
|
|
589
|
+
tool: 'local_write_file',
|
|
590
|
+
arguments: { path: '/workspace/steerable-eval-sandbox/audit-report.md' },
|
|
591
|
+
result: {
|
|
592
|
+
success: true,
|
|
593
|
+
output: 'Wrote 512 bytes to audit-report.md.',
|
|
594
|
+
},
|
|
595
|
+
},
|
|
596
|
+
],
|
|
597
|
+
},
|
|
598
|
+
],
|
|
599
|
+
reply: [
|
|
600
|
+
'工作区审计已完成,并生成交付文件 `audit-report.md`(可直接点击下方文件卡片下载):',
|
|
601
|
+
'',
|
|
602
|
+
'- **Sidecar 契约**:38 个 JSON-RPC 方法与协议 Schema 一致。',
|
|
603
|
+
'- **安全基线**:Seatbelt 隔离与 CONNECT 出口白名单已启用。',
|
|
604
|
+
'- **质量门控**:畸形调用恢复与完成否决均处于激活状态。',
|
|
605
|
+
].join('\n'),
|
|
606
|
+
turnFiles: [deliverable],
|
|
607
|
+
usage: {
|
|
608
|
+
promptTokens: 7120,
|
|
609
|
+
completionTokens: 540,
|
|
610
|
+
totalTokens: 7660,
|
|
611
|
+
cachedPromptTokens: 4900,
|
|
612
|
+
costUsd: 0.0017,
|
|
613
|
+
},
|
|
614
|
+
suggestedReplies: [
|
|
615
|
+
'检查畸形工具调用恢复场景',
|
|
616
|
+
'测试完成前事实核查否决',
|
|
617
|
+
'验证 OS 沙箱出口拦截',
|
|
618
|
+
],
|
|
619
|
+
};
|
|
620
|
+
}
|
|
621
|
+
|
|
622
|
+
return {
|
|
623
|
+
id: scenario,
|
|
624
|
+
chatTitle: 'Workspace audit & report export',
|
|
625
|
+
rounds: [
|
|
626
|
+
{
|
|
627
|
+
reasoning:
|
|
628
|
+
'Inspecting runtime contract and package manifests, then writing audit-report.md as a downloadable turn deliverable.',
|
|
629
|
+
actions: [
|
|
630
|
+
{
|
|
631
|
+
id: 'demo-aud-1',
|
|
632
|
+
tool: 'local_read_file',
|
|
633
|
+
arguments: { path: 'docs/spec/runtime-contract.json' },
|
|
634
|
+
result: {
|
|
635
|
+
success: true,
|
|
636
|
+
output: 'sidecarRpcMethods: 38, protocolVersion: 1',
|
|
637
|
+
},
|
|
638
|
+
},
|
|
639
|
+
{
|
|
640
|
+
id: 'demo-aud-2',
|
|
641
|
+
tool: 'local_write_file',
|
|
642
|
+
arguments: { path: '/workspace/steerable-eval-sandbox/audit-report.md' },
|
|
643
|
+
result: {
|
|
644
|
+
success: true,
|
|
645
|
+
output: 'Wrote 512 bytes to audit-report.md.',
|
|
646
|
+
},
|
|
647
|
+
},
|
|
648
|
+
],
|
|
649
|
+
},
|
|
650
|
+
],
|
|
651
|
+
reply: [
|
|
652
|
+
'Workspace audit finished and exported `audit-report.md` (click the deliverable card below to download):',
|
|
653
|
+
'',
|
|
654
|
+
'- **Sidecar contract**: 38 JSON-RPC methods match protocol schema.',
|
|
655
|
+
'- **Confinement**: Seatbelt + per-host CONNECT egress allow-list active.',
|
|
656
|
+
'- **Quality guards**: Malformed call recovery & grounding veto enabled.',
|
|
657
|
+
].join('\n'),
|
|
658
|
+
turnFiles: [deliverable],
|
|
659
|
+
usage: {
|
|
660
|
+
promptTokens: 7120,
|
|
661
|
+
completionTokens: 540,
|
|
662
|
+
totalTokens: 7660,
|
|
663
|
+
cachedPromptTokens: 4900,
|
|
664
|
+
costUsd: 0.0017,
|
|
665
|
+
},
|
|
666
|
+
suggestedReplies: [
|
|
667
|
+
'Demo malformed tool call recovery',
|
|
668
|
+
'Test grounding judge & completion veto',
|
|
669
|
+
'Test OS sandbox & egress allow-list denial',
|
|
670
|
+
],
|
|
671
|
+
};
|
|
672
|
+
}
|
|
673
|
+
|
|
674
|
+
// General interactive fallback for arbitrary user prompts
|
|
675
|
+
const steerLine = input.steerNote
|
|
676
|
+
? lang === 'zh'
|
|
677
|
+
? `\n\n> 已接收轮中转向指令:「${input.steerNote}」,并在本轮响应中优先采纳。`
|
|
678
|
+
: `\n\n> Applied mid-turn steering instruction: "${input.steerNote}".`
|
|
679
|
+
: '';
|
|
680
|
+
|
|
681
|
+
if (lang === 'zh') {
|
|
682
|
+
return {
|
|
683
|
+
id: 'general',
|
|
684
|
+
chatTitle: input.message.slice(0, 28) || '交互剧本对话',
|
|
685
|
+
rounds: [
|
|
686
|
+
{
|
|
687
|
+
reasoning:
|
|
688
|
+
`当前在浏览器交互剧本模式下运行(模型选择:${modelLabel}${effortLabel})。` +
|
|
689
|
+
'先只读检查沙箱工作区文件,再按输入给出结构化回复。',
|
|
690
|
+
actions: [
|
|
691
|
+
{
|
|
692
|
+
id: 'demo-gen-1',
|
|
693
|
+
tool: 'local_read_file',
|
|
694
|
+
arguments: { path: 'README.md', startLine: 1, endLine: 25 },
|
|
695
|
+
result: {
|
|
696
|
+
success: true,
|
|
697
|
+
output: 'Steerable: 5-tier agent harness with CoreLoop, sandboxed sidecar, and React UI.',
|
|
698
|
+
},
|
|
699
|
+
},
|
|
700
|
+
],
|
|
701
|
+
},
|
|
702
|
+
],
|
|
703
|
+
reply: [
|
|
704
|
+
`收到你的输入:「**${input.message}**」(${modelLabel}${effortLabel} · 浏览器交互剧本模式)。`,
|
|
705
|
+
'',
|
|
706
|
+
'当前演示页面跑在前端回放桥上(没有连接真实模型网关和本地 Python Sidecar),因此工具结果来自内置沙箱工作区剧本。你可以继续:',
|
|
707
|
+
'- 点下方建议问题,体验 **畸形工具调用恢复**、**完成前事实核查否决**、**OS 沙箱拦截** 或 **可下载审计报告**;',
|
|
708
|
+
'- 在本地运行 `npm install -g @steerable/agent-cli && steerable-cli login` 即可接入真实模型与 OS 沙箱。',
|
|
709
|
+
].join('\n') + steerLine,
|
|
710
|
+
usage: {
|
|
711
|
+
promptTokens: 2840,
|
|
712
|
+
completionTokens: 210,
|
|
713
|
+
totalTokens: 3050,
|
|
714
|
+
cachedPromptTokens: 1900,
|
|
715
|
+
costUsd: 0.0005,
|
|
716
|
+
},
|
|
717
|
+
suggestedReplies: [
|
|
718
|
+
'演示畸形工具调用自动恢复',
|
|
719
|
+
'演示事实核查与完成否决',
|
|
720
|
+
'测试 OS 沙箱与出口白名单拦截',
|
|
721
|
+
],
|
|
722
|
+
};
|
|
723
|
+
}
|
|
724
|
+
|
|
725
|
+
return {
|
|
726
|
+
id: 'general',
|
|
727
|
+
chatTitle: input.message.slice(0, 32) || 'Interactive playbook chat',
|
|
728
|
+
rounds: [
|
|
729
|
+
{
|
|
730
|
+
reasoning:
|
|
731
|
+
`Running in browser playbook mode (model: ${modelLabel}${effortLabel}). ` +
|
|
732
|
+
'Inspecting sample workspace metadata before composing a grounded response.',
|
|
733
|
+
actions: [
|
|
734
|
+
{
|
|
735
|
+
id: 'demo-gen-1',
|
|
736
|
+
tool: 'local_read_file',
|
|
737
|
+
arguments: { path: 'README.md', startLine: 1, endLine: 25 },
|
|
738
|
+
result: {
|
|
739
|
+
success: true,
|
|
740
|
+
output: 'Steerable: 5-tier agent harness with CoreLoop, sandboxed sidecar, and React UI.',
|
|
741
|
+
},
|
|
742
|
+
},
|
|
743
|
+
],
|
|
744
|
+
},
|
|
745
|
+
],
|
|
746
|
+
reply: [
|
|
747
|
+
`Received: "**${input.message}**" (${modelLabel}${effortLabel} · browser playbook mode).`,
|
|
748
|
+
'',
|
|
749
|
+
'This hosted demo runs against an in-browser CoreLoop playbook rather than a live model or local sidecar. Try one of the follow-ups below to inspect:',
|
|
750
|
+
'- **Malformed tool-call recovery**, **grounding vetoes**, **OS sandbox & egress denial**, or **downloadable deliverables**.',
|
|
751
|
+
'- Run `npm install -g @steerable/agent-cli && steerable-cli login` locally for live models and real OS confinement.',
|
|
752
|
+
].join('\n') + steerLine,
|
|
753
|
+
usage: {
|
|
754
|
+
promptTokens: 2840,
|
|
755
|
+
completionTokens: 210,
|
|
756
|
+
totalTokens: 3050,
|
|
757
|
+
cachedPromptTokens: 1900,
|
|
758
|
+
costUsd: 0.0005,
|
|
759
|
+
},
|
|
760
|
+
suggestedReplies: [
|
|
761
|
+
'Demo malformed tool call recovery',
|
|
762
|
+
'Test grounding judge & completion veto',
|
|
763
|
+
'Test OS sandbox & egress allow-list denial',
|
|
764
|
+
],
|
|
765
|
+
};
|
|
766
|
+
}
|