ai-project-manage-cli 3.0.11 → 3.0.13

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.
Files changed (2) hide show
  1. package/dist/index.js +43 -37
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -306,20 +306,19 @@ function runConnect(opts) {
306
306
  });
307
307
  IN_PROGRESS = true;
308
308
  }
309
- data2 = {};
310
309
  if (event.type === "assistant") {
311
310
  const output = event.message.content[0].text;
312
311
  console.log(`[Output]`, output);
313
- if (data2.type && data2.type !== "output") {
312
+ if (data2.type && data2.type !== "assistant") {
314
313
  events.push(data2);
315
314
  data2 = {};
316
- } else {
317
- data2.type = "output";
318
- if (!data2.content) {
319
- data2.content = "";
320
- }
321
- data2.content += output;
322
315
  }
316
+ data2.type = "output";
317
+ if (!data2.content) {
318
+ data2.content = "";
319
+ }
320
+ data2.content += output;
321
+ continue;
323
322
  }
324
323
  if (event.type === "thinking") {
325
324
  const thinking = event.text;
@@ -327,31 +326,31 @@ 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;
335
+ continue;
337
336
  }
338
- if (event.type === "tool_call") {
339
- if (event.status === "completed" || event.status === "error") {
340
- console.log(`[ToolCall(${event.call_id}) Result]`);
341
- console.log(JSON.stringify(event.args));
342
- console.log(JSON.stringify(event.result, null, 2));
343
- console.log("---------------\u8C03\u7528\u5B8C\u6210-----------------");
344
- if (data2.type && data2.type !== "tool_call") {
345
- events.push(data2);
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
- }
337
+ if (event.type === "tool_call" && (event.status === "completed" || event.status === "error")) {
338
+ console.log(`[ToolCall(${event.call_id}) Result]`);
339
+ console.log(JSON.stringify(event.args));
340
+ console.log(JSON.stringify(event.result, null, 2));
341
+ console.log("---------------\u8C03\u7528\u5B8C\u6210-----------------");
342
+ if (data2.type && data2.type !== "tool_call") {
343
+ events.push(data2);
344
+ data2 = {};
354
345
  }
346
+ data2.type = "tool_call";
347
+ data2.call_id = event.call_id;
348
+ data2.args = event.args;
349
+ data2.result = event.result;
350
+ data2.status = event.status;
351
+ events.push(data2);
352
+ data2 = {};
353
+ continue;
355
354
  }
356
355
  if (event.type === "task") {
357
356
  console.log(`[Task:${event.status}]`);
@@ -361,21 +360,25 @@ function runConnect(opts) {
361
360
  if (data2.type && data2.type !== "task") {
362
361
  events.push(data2);
363
362
  data2 = {};
364
- } else {
365
- data2.type = "task";
366
- data2.status = event.status;
367
- data2.text = event.text;
368
363
  }
364
+ data2.type = "task";
365
+ data2.status = event.status;
366
+ data2.text = event.text;
367
+ events.push(data2);
368
+ data2 = {};
369
+ continue;
369
370
  }
370
371
  if (event.type === "request") {
371
372
  console.log(JSON.stringify(event, null, 2));
372
373
  if (data2.type && data2.type !== "request") {
373
374
  events.push(data2);
374
375
  data2 = {};
375
- } else {
376
- data2 = event;
377
376
  }
377
+ data2 = event;
378
+ continue;
378
379
  }
380
+ console.log("\u672A\u77E5\u4E8B\u4EF6:", JSON.stringify(event, null, 2));
381
+ continue;
379
382
  }
380
383
  if (data2.type) {
381
384
  events.push(data2);
@@ -398,7 +401,10 @@ function runConnect(opts) {
398
401
  ensureDirExists(sessionsDir);
399
402
  const sessionFile = resolve2(sessionsDir, `${run.agentId}.md`);
400
403
  for (const event of events) {
401
- appendFileSync(sessionFile, JSON.stringify(event, null, 2) + "\n=====================================================\n");
404
+ appendFileSync(
405
+ sessionFile,
406
+ JSON.stringify(event, null, 2) + "\n=====================================================\n"
407
+ );
402
408
  }
403
409
  } catch {
404
410
  console.error("[apm] \u65E0\u6CD5\u89E3\u6790 WebSocket \u6D88\u606F:", text);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ai-project-manage-cli",
3
- "version": "3.0.11",
3
+ "version": "3.0.13",
4
4
  "description": "命令行工具:后续用于调用平台后端 API 完成运维与自动化操作",
5
5
  "type": "module",
6
6
  "private": false,