ai-project-manage-cli 3.0.21 → 3.0.22
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 +22 -7
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -241,6 +241,12 @@ import { appendFileSync } from "fs";
|
|
|
241
241
|
import { resolve as resolve2 } from "path";
|
|
242
242
|
var EventSession = class {
|
|
243
243
|
events = [];
|
|
244
|
+
constructor(prompt) {
|
|
245
|
+
this.events.push({
|
|
246
|
+
type: "input",
|
|
247
|
+
content: prompt
|
|
248
|
+
});
|
|
249
|
+
}
|
|
244
250
|
addEvent(event) {
|
|
245
251
|
const latestEvent = this.events[this.events.length - 1];
|
|
246
252
|
const formatedEvent = this.formatEvent(event);
|
|
@@ -330,17 +336,26 @@ var EventSession = class {
|
|
|
330
336
|
this.events.forEach((event) => {
|
|
331
337
|
const type = event.type;
|
|
332
338
|
const content = (function(type2) {
|
|
333
|
-
if (type2 === "
|
|
334
|
-
return `##
|
|
339
|
+
if (type2 === "input") {
|
|
340
|
+
return `## \u7528\u6237\u8F93\u5165
|
|
341
|
+
|
|
342
|
+
${event.content}
|
|
343
|
+
`;
|
|
344
|
+
}
|
|
345
|
+
if (type2 === "assistant") {
|
|
346
|
+
return `## \u6A21\u578B\u8F93\u51FA
|
|
347
|
+
|
|
348
|
+
${event.content}
|
|
349
|
+
`;
|
|
350
|
+
}
|
|
351
|
+
if (type2 === "thinking") {
|
|
352
|
+
return `## \u6A21\u578B\u601D\u8003
|
|
335
353
|
|
|
336
354
|
${event.content}
|
|
337
355
|
`;
|
|
338
356
|
}
|
|
339
357
|
if (type2 === "tool_call") {
|
|
340
|
-
return
|
|
341
|
-
### \u53C2\u6570
|
|
342
|
-
\`\`\`json
|
|
343
|
-
` + JSON.stringify(event.args, null, 2) + "\n```\n### \u7ED3\u679C\n```json\n" + JSON.stringify(event.result, null, 2) + "\n```\n";
|
|
358
|
+
return "````toolcall\n" + JSON.stringify(event, null, 2) + "\n````\n";
|
|
344
359
|
}
|
|
345
360
|
return `## \u672A\u77E5\u4E8B\u4EF6\uFF1A${type2}
|
|
346
361
|
|
|
@@ -647,7 +662,7 @@ function runConnect(opts) {
|
|
|
647
662
|
agentId: agent.agentId
|
|
648
663
|
});
|
|
649
664
|
let IN_PROGRESS = false;
|
|
650
|
-
const session = new EventSession();
|
|
665
|
+
const session = new EventSession(payload.prompt);
|
|
651
666
|
const run = await agent.send(payload.prompt);
|
|
652
667
|
for await (const event of run.stream()) {
|
|
653
668
|
if (!IN_PROGRESS) {
|