ai-project-manage-cli 6.0.73 → 6.0.74
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 +45 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4261,6 +4261,42 @@ async function runCursorAgent(cfg, ctx, options) {
|
|
|
4261
4261
|
}
|
|
4262
4262
|
}
|
|
4263
4263
|
|
|
4264
|
+
// src/commands/connect/ensure-message-reply.ts
|
|
4265
|
+
var DEFAULT_REPLY = "\u4EFB\u52A1\u5DF2\u5B8C\u6210\u3002";
|
|
4266
|
+
function resolveMessageReplyFallback(fallback) {
|
|
4267
|
+
for (const candidate of [
|
|
4268
|
+
fallback.assistantText,
|
|
4269
|
+
fallback.result,
|
|
4270
|
+
fallback.createPlan
|
|
4271
|
+
]) {
|
|
4272
|
+
const trimmed = candidate?.trim();
|
|
4273
|
+
if (trimmed) {
|
|
4274
|
+
return trimmed;
|
|
4275
|
+
}
|
|
4276
|
+
}
|
|
4277
|
+
return DEFAULT_REPLY;
|
|
4278
|
+
}
|
|
4279
|
+
async function fetchMessageContent(cfg, sessionId, messageId) {
|
|
4280
|
+
const api = createApmApiClient(cfg);
|
|
4281
|
+
const messages = await api.cli.listSessionMessages({ sessionId });
|
|
4282
|
+
const message = messages.find((item) => item.id === messageId);
|
|
4283
|
+
if (!message) {
|
|
4284
|
+
throw new Error(`\u6D88\u606F\u4E0D\u5B58\u5728: ${messageId}`);
|
|
4285
|
+
}
|
|
4286
|
+
return message.content.trim();
|
|
4287
|
+
}
|
|
4288
|
+
async function ensureMessageHasReply(cfg, sessionId, messageId, fallback) {
|
|
4289
|
+
const existing = await fetchMessageContent(cfg, sessionId, messageId);
|
|
4290
|
+
if (existing) {
|
|
4291
|
+
return;
|
|
4292
|
+
}
|
|
4293
|
+
const content = resolveMessageReplyFallback(fallback);
|
|
4294
|
+
await appendMessageContent(cfg, messageId, content);
|
|
4295
|
+
console.log(
|
|
4296
|
+
`[apm] \u6D88\u606F\u65E0\u56DE\u590D\u5185\u5BB9\uFF0C\u5DF2\u81EA\u52A8\u8FFD\u52A0: messageId=${messageId} len=${content.length}`
|
|
4297
|
+
);
|
|
4298
|
+
}
|
|
4299
|
+
|
|
4264
4300
|
// src/commands/connect/cli-version-sync.ts
|
|
4265
4301
|
import { existsSync as existsSync16, readFileSync as readFileSync14, writeFileSync as writeFileSync12 } from "fs";
|
|
4266
4302
|
import { join as join15 } from "path";
|
|
@@ -4454,7 +4490,7 @@ async function handleInboundMessage(cfg, msg, signal, ctx) {
|
|
|
4454
4490
|
() => syncRepositoryProjectDocumentsPull(workdir, apmRoot)
|
|
4455
4491
|
);
|
|
4456
4492
|
}
|
|
4457
|
-
await runStep(
|
|
4493
|
+
const agentResult = await runStep(
|
|
4458
4494
|
"cursor-agent",
|
|
4459
4495
|
() => runCursorAgent(
|
|
4460
4496
|
cfg,
|
|
@@ -4470,6 +4506,14 @@ async function handleInboundMessage(cfg, msg, signal, ctx) {
|
|
|
4470
4506
|
{ signal }
|
|
4471
4507
|
)
|
|
4472
4508
|
);
|
|
4509
|
+
await runStep(
|
|
4510
|
+
"ensure-reply",
|
|
4511
|
+
() => ensureMessageHasReply(cfg, msg.sessionId, messageId, {
|
|
4512
|
+
assistantText: agentResult.assistantText,
|
|
4513
|
+
result: agentResult.result,
|
|
4514
|
+
createPlan: agentResult.createPlan
|
|
4515
|
+
})
|
|
4516
|
+
);
|
|
4473
4517
|
await runStep(
|
|
4474
4518
|
"sync-documents",
|
|
4475
4519
|
() => syncSessionDocuments(cfg, msg.sessionId, apmRoot)
|