@xcanwin/manyoyo 6.0.2 → 6.0.4
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/lib/web/frontend/app.js +20 -0
- package/lib/web/server.js +20 -46
- package/package.json +1 -1
package/lib/web/frontend/app.js
CHANGED
|
@@ -423,6 +423,12 @@
|
|
|
423
423
|
} else if (event.status) {
|
|
424
424
|
bodyParts.push({ label: '状态', value: event.status });
|
|
425
425
|
}
|
|
426
|
+
if (event.result) {
|
|
427
|
+
bodyParts.push({ label: '结果', value: event.result });
|
|
428
|
+
}
|
|
429
|
+
if (event.error) {
|
|
430
|
+
bodyParts.push({ label: '错误', value: event.error });
|
|
431
|
+
}
|
|
426
432
|
}
|
|
427
433
|
if (event.kind === 'mcp') {
|
|
428
434
|
if (event.server || event.tool) {
|
|
@@ -444,6 +450,20 @@
|
|
|
444
450
|
if (event.kind === 'tool' && event.toolName) {
|
|
445
451
|
bodyParts.push({ label: '工具', value: event.toolName });
|
|
446
452
|
}
|
|
453
|
+
if (event.kind === 'tool') {
|
|
454
|
+
if (event.argumentSummary) {
|
|
455
|
+
bodyParts.push({ label: '参数摘要', value: event.argumentSummary });
|
|
456
|
+
}
|
|
457
|
+
if (event.arguments) {
|
|
458
|
+
bodyParts.push({ label: '参数', value: event.arguments });
|
|
459
|
+
}
|
|
460
|
+
if (event.result) {
|
|
461
|
+
bodyParts.push({ label: '结果', value: event.result });
|
|
462
|
+
}
|
|
463
|
+
if (event.error) {
|
|
464
|
+
bodyParts.push({ label: '错误', value: event.error });
|
|
465
|
+
}
|
|
466
|
+
}
|
|
447
467
|
if ((event.kind === 'agent_message' || event.kind === 'status' || event.kind === 'error') && event.detail) {
|
|
448
468
|
bodyParts.push({ label: '详情', value: event.detail });
|
|
449
469
|
}
|
package/lib/web/server.js
CHANGED
|
@@ -1266,27 +1266,20 @@ function prepareGeminiTraceEvents(payload, state) {
|
|
|
1266
1266
|
|
|
1267
1267
|
function prepareOpenCodeTraceEvents(payload, state) {
|
|
1268
1268
|
const eventType = pickFirstString(payload.type);
|
|
1269
|
-
const
|
|
1270
|
-
const
|
|
1271
|
-
const toolNamesById = state.toolNamesById;
|
|
1269
|
+
const part = toPlainObject(payload.part);
|
|
1270
|
+
const partState = toPlainObject(part.state);
|
|
1272
1271
|
const events = [];
|
|
1273
1272
|
|
|
1274
|
-
if (eventType === '
|
|
1275
|
-
events.push(createStructuredTraceEvent('opencode', '
|
|
1273
|
+
if (eventType === 'step_start' && part.type === 'step-start') {
|
|
1274
|
+
events.push(createStructuredTraceEvent('opencode', 'turn', eventType, '[回合] 开始生成响应', {
|
|
1276
1275
|
phase: 'started',
|
|
1277
1276
|
status: 'started',
|
|
1278
|
-
sessionId: pickFirstString(payload.
|
|
1277
|
+
sessionId: pickFirstString(payload.sessionID, part.sessionID)
|
|
1279
1278
|
}));
|
|
1280
1279
|
return events.filter(Boolean);
|
|
1281
1280
|
}
|
|
1282
|
-
if (eventType === '
|
|
1283
|
-
|
|
1284
|
-
return [];
|
|
1285
|
-
}
|
|
1286
|
-
if (payload.delta === true) {
|
|
1287
|
-
return [];
|
|
1288
|
-
}
|
|
1289
|
-
const detail = collectStructuredText(message.content || payload.content || payload.text || payload);
|
|
1281
|
+
if (eventType === 'text' && part.type === 'text') {
|
|
1282
|
+
const detail = collectStructuredText(part.text);
|
|
1290
1283
|
if (!detail) {
|
|
1291
1284
|
return [];
|
|
1292
1285
|
}
|
|
@@ -1297,48 +1290,28 @@ function prepareOpenCodeTraceEvents(payload, state) {
|
|
|
1297
1290
|
}));
|
|
1298
1291
|
return events.filter(Boolean);
|
|
1299
1292
|
}
|
|
1300
|
-
if (eventType === 'tool_use'
|
|
1301
|
-
const toolName = pickFirstString(
|
|
1302
|
-
const toolId = pickFirstString(
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
}
|
|
1306
|
-
const argumentsValue = toPlainObject(payload.parameters || payload.input || payload.arguments);
|
|
1293
|
+
if (eventType === 'tool_use' && part.type === 'tool') {
|
|
1294
|
+
const toolName = pickFirstString(part.tool, part.callID, 'tool');
|
|
1295
|
+
const toolId = pickFirstString(part.callID, part.id);
|
|
1296
|
+
const status = pickFirstString(partState.status, 'completed');
|
|
1297
|
+
const argumentsValue = toPlainObject(partState.input);
|
|
1307
1298
|
const summary = summarizeTraceArguments(argumentsValue);
|
|
1308
|
-
events.push(createStructuredTraceEvent(
|
|
1309
|
-
'opencode',
|
|
1310
|
-
'tool',
|
|
1311
|
-
eventType,
|
|
1312
|
-
summary ? `[工具开始] ${toolName} (${summary})` : `[工具开始] ${toolName}`,
|
|
1313
|
-
{
|
|
1314
|
-
phase: 'started',
|
|
1315
|
-
status: pickFirstString(payload.status, 'in_progress'),
|
|
1316
|
-
toolName,
|
|
1317
|
-
toolId,
|
|
1318
|
-
arguments: argumentsValue,
|
|
1319
|
-
argumentSummary: summary
|
|
1320
|
-
}
|
|
1321
|
-
));
|
|
1322
|
-
return events.filter(Boolean);
|
|
1323
|
-
}
|
|
1324
|
-
if (eventType === 'tool_result' || eventType === 'step_finish') {
|
|
1325
|
-
const toolId = pickFirstString(payload.tool_id, payload.id);
|
|
1326
|
-
const toolName = pickFirstString(toolNamesById.get(toolId), payload.tool_name, payload.name, payload.tool, toolId, 'tool');
|
|
1327
|
-
const status = pickFirstString(payload.status, payload.state, 'completed');
|
|
1328
1299
|
events.push(createStructuredTraceEvent('opencode', 'tool', eventType, `[工具完成] ${toolName} (${status})`, {
|
|
1329
1300
|
phase: 'completed',
|
|
1330
1301
|
status,
|
|
1331
1302
|
toolName,
|
|
1332
1303
|
toolId,
|
|
1333
|
-
|
|
1334
|
-
|
|
1304
|
+
arguments: argumentsValue,
|
|
1305
|
+
argumentSummary: summary,
|
|
1306
|
+
result: collectStructuredText(partState.output),
|
|
1307
|
+
error: collectStructuredText(partState.error)
|
|
1335
1308
|
}));
|
|
1336
1309
|
return events.filter(Boolean);
|
|
1337
1310
|
}
|
|
1338
|
-
if (eventType === '
|
|
1311
|
+
if (eventType === 'step_finish' && part.type === 'step-finish') {
|
|
1339
1312
|
events.push(createStructuredTraceEvent('opencode', 'turn', eventType, '[回合] 响应完成', {
|
|
1340
1313
|
phase: 'completed',
|
|
1341
|
-
status: pickFirstString(
|
|
1314
|
+
status: pickFirstString(part.reason, 'completed')
|
|
1342
1315
|
}));
|
|
1343
1316
|
return events.filter(Boolean);
|
|
1344
1317
|
}
|
|
@@ -1582,7 +1555,8 @@ function prepareCodexTraceEvent(payload) {
|
|
|
1582
1555
|
phase: 'completed',
|
|
1583
1556
|
status: pickDisplayStatus(suffix),
|
|
1584
1557
|
command: commandText || 'command_execution',
|
|
1585
|
-
exitCode: typeof item.exit_code === 'number' ? item.exit_code : null
|
|
1558
|
+
exitCode: typeof item.exit_code === 'number' ? item.exit_code : null,
|
|
1559
|
+
result: item.aggregated_output !== undefined ? item.aggregated_output : null
|
|
1586
1560
|
});
|
|
1587
1561
|
}
|
|
1588
1562
|
if (itemType === 'mcp_tool_call') {
|