ai-project-manage-cli 3.0.11 → 3.0.12
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/index.js +32 -36
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -310,16 +310,15 @@ function runConnect(opts) {
|
|
|
310
310
|
if (event.type === "assistant") {
|
|
311
311
|
const output = event.message.content[0].text;
|
|
312
312
|
console.log(`[Output]`, output);
|
|
313
|
-
if (data2.type && data2.type !== "
|
|
313
|
+
if (data2.type && data2.type !== "assistant") {
|
|
314
314
|
events.push(data2);
|
|
315
315
|
data2 = {};
|
|
316
|
-
} else {
|
|
317
|
-
data2.type = "output";
|
|
318
|
-
if (!data2.content) {
|
|
319
|
-
data2.content = "";
|
|
320
|
-
}
|
|
321
|
-
data2.content += output;
|
|
322
316
|
}
|
|
317
|
+
data2.type = "output";
|
|
318
|
+
if (!data2.content) {
|
|
319
|
+
data2.content = "";
|
|
320
|
+
}
|
|
321
|
+
data2.content += output;
|
|
323
322
|
}
|
|
324
323
|
if (event.type === "thinking") {
|
|
325
324
|
const thinking = event.text;
|
|
@@ -327,31 +326,27 @@ function runConnect(opts) {
|
|
|
327
326
|
if (data2.type && data2.type !== "thinking") {
|
|
328
327
|
events.push(data2);
|
|
329
328
|
data2 = {};
|
|
330
|
-
} else {
|
|
331
|
-
data2.type = "thinking";
|
|
332
|
-
if (!data2.content) {
|
|
333
|
-
data2.content = "";
|
|
334
|
-
}
|
|
335
|
-
data2.content += thinking;
|
|
336
329
|
}
|
|
330
|
+
data2.type = "thinking";
|
|
331
|
+
if (!data2.content) {
|
|
332
|
+
data2.content = "";
|
|
333
|
+
}
|
|
334
|
+
data2.content += thinking;
|
|
337
335
|
}
|
|
338
|
-
if (event.type === "tool_call") {
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
data2 = {};
|
|
347
|
-
} else {
|
|
348
|
-
data2.type = "tool_call";
|
|
349
|
-
data2.call_id = event.call_id;
|
|
350
|
-
data2.args = event.args;
|
|
351
|
-
data2.result = event.result;
|
|
352
|
-
data2.status = event.status;
|
|
353
|
-
}
|
|
336
|
+
if (event.type === "tool_call" && (event.status === "completed" || event.status === "error")) {
|
|
337
|
+
console.log(`[ToolCall(${event.call_id}) Result]`);
|
|
338
|
+
console.log(JSON.stringify(event.args));
|
|
339
|
+
console.log(JSON.stringify(event.result, null, 2));
|
|
340
|
+
console.log("---------------\u8C03\u7528\u5B8C\u6210-----------------");
|
|
341
|
+
if (data2.type && data2.type !== "tool_call") {
|
|
342
|
+
events.push(data2);
|
|
343
|
+
data2 = {};
|
|
354
344
|
}
|
|
345
|
+
data2.type = "tool_call";
|
|
346
|
+
data2.call_id = event.call_id;
|
|
347
|
+
data2.args = event.args;
|
|
348
|
+
data2.result = event.result;
|
|
349
|
+
data2.status = event.status;
|
|
355
350
|
}
|
|
356
351
|
if (event.type === "task") {
|
|
357
352
|
console.log(`[Task:${event.status}]`);
|
|
@@ -361,20 +356,18 @@ function runConnect(opts) {
|
|
|
361
356
|
if (data2.type && data2.type !== "task") {
|
|
362
357
|
events.push(data2);
|
|
363
358
|
data2 = {};
|
|
364
|
-
} else {
|
|
365
|
-
data2.type = "task";
|
|
366
|
-
data2.status = event.status;
|
|
367
|
-
data2.text = event.text;
|
|
368
359
|
}
|
|
360
|
+
data2.type = "task";
|
|
361
|
+
data2.status = event.status;
|
|
362
|
+
data2.text = event.text;
|
|
369
363
|
}
|
|
370
364
|
if (event.type === "request") {
|
|
371
365
|
console.log(JSON.stringify(event, null, 2));
|
|
372
366
|
if (data2.type && data2.type !== "request") {
|
|
373
367
|
events.push(data2);
|
|
374
368
|
data2 = {};
|
|
375
|
-
} else {
|
|
376
|
-
data2 = event;
|
|
377
369
|
}
|
|
370
|
+
data2 = event;
|
|
378
371
|
}
|
|
379
372
|
}
|
|
380
373
|
if (data2.type) {
|
|
@@ -398,7 +391,10 @@ function runConnect(opts) {
|
|
|
398
391
|
ensureDirExists(sessionsDir);
|
|
399
392
|
const sessionFile = resolve2(sessionsDir, `${run.agentId}.md`);
|
|
400
393
|
for (const event of events) {
|
|
401
|
-
appendFileSync(
|
|
394
|
+
appendFileSync(
|
|
395
|
+
sessionFile,
|
|
396
|
+
JSON.stringify(event, null, 2) + "\n=====================================================\n"
|
|
397
|
+
);
|
|
402
398
|
}
|
|
403
399
|
} catch {
|
|
404
400
|
console.error("[apm] \u65E0\u6CD5\u89E3\u6790 WebSocket \u6D88\u606F:", text);
|