ai-project-manage-cli 7.1.25 → 7.1.27
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 +1 -0
- package/dist/webide-message-worker.js +33 -5
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -8448,6 +8448,7 @@ async function runCursorAgent(cfg, ctx, options) {
|
|
|
8448
8448
|
result: result.result,
|
|
8449
8449
|
durationMs: result.durationMs,
|
|
8450
8450
|
usage: result.usage,
|
|
8451
|
+
modelId: result.model?.id?.trim() || ctx.model?.trim() || void 0,
|
|
8451
8452
|
assistantText: eventSession.getAssistantText(),
|
|
8452
8453
|
createPlan: eventSession.getCreatePlanContent(),
|
|
8453
8454
|
artifacts,
|
|
@@ -2457,6 +2457,7 @@ async function runCursorAgent(cfg, ctx, options) {
|
|
|
2457
2457
|
result: result.result,
|
|
2458
2458
|
durationMs: result.durationMs,
|
|
2459
2459
|
usage: result.usage,
|
|
2460
|
+
modelId: result.model?.id?.trim() || ctx.model?.trim() || void 0,
|
|
2460
2461
|
assistantText: eventSession.getAssistantText(),
|
|
2461
2462
|
createPlan: eventSession.getCreatePlanContent(),
|
|
2462
2463
|
artifacts,
|
|
@@ -2751,12 +2752,13 @@ function createThrottledWebIdeMessageLogSync(cfg, ctx, onError) {
|
|
|
2751
2752
|
syncChain = syncChain.then(() => drainDirtyEvents(session));
|
|
2752
2753
|
};
|
|
2753
2754
|
return {
|
|
2754
|
-
async markRun(runId, runStatus, lastError) {
|
|
2755
|
+
async markRun(runId, runStatus, lastError, tokenUsage) {
|
|
2755
2756
|
try {
|
|
2756
2757
|
await upsertLogHeader(cfg, ctx, {
|
|
2757
2758
|
runId,
|
|
2758
2759
|
runStatus,
|
|
2759
|
-
lastError: lastError ?? null
|
|
2760
|
+
lastError: lastError ?? null,
|
|
2761
|
+
...tokenUsage ? { tokenUsage } : {}
|
|
2760
2762
|
});
|
|
2761
2763
|
} catch (err) {
|
|
2762
2764
|
onError(err);
|
|
@@ -3872,6 +3874,8 @@ async function handleWebIdeInboundMessage(cfg, msg, signal, options) {
|
|
|
3872
3874
|
},
|
|
3873
3875
|
{
|
|
3874
3876
|
signal,
|
|
3877
|
+
// IDE 重启/异常中断后 Cursor 可能仍认为旧 run active;强制清残留再 send
|
|
3878
|
+
forceSend: true,
|
|
3875
3879
|
appendMessageContent: (content) => appendContent(cfg, messageId, content),
|
|
3876
3880
|
askQuestionExecute: createWebIdeAskQuestionExecute({
|
|
3877
3881
|
cfg,
|
|
@@ -3904,16 +3908,35 @@ async function handleWebIdeInboundMessage(cfg, msg, signal, options) {
|
|
|
3904
3908
|
}
|
|
3905
3909
|
);
|
|
3906
3910
|
saveWebIdeAgentId(workdir, taskId, outcome.agentId);
|
|
3911
|
+
const tokenUsage = outcome.usage != null ? {
|
|
3912
|
+
modelId: outcome.modelId ?? (msg.model?.trim() || void 0),
|
|
3913
|
+
inputTokens: outcome.usage.inputTokens,
|
|
3914
|
+
outputTokens: outcome.usage.outputTokens,
|
|
3915
|
+
cacheReadTokens: outcome.usage.cacheReadTokens,
|
|
3916
|
+
cacheWriteTokens: outcome.usage.cacheWriteTokens,
|
|
3917
|
+
totalTokens: outcome.usage.totalTokens,
|
|
3918
|
+
...outcome.usage.reasoningTokens != null ? { reasoningTokens: outcome.usage.reasoningTokens } : {}
|
|
3919
|
+
} : void 0;
|
|
3907
3920
|
if (outcome.status === "error") {
|
|
3908
3921
|
const detail = formatCursorRunFailure(outcome.runId, {
|
|
3909
3922
|
resultText: outcome.result
|
|
3910
3923
|
});
|
|
3911
|
-
await logSyncRef.current?.markRun(
|
|
3924
|
+
await logSyncRef.current?.markRun(
|
|
3925
|
+
outcome.runId,
|
|
3926
|
+
"error",
|
|
3927
|
+
detail,
|
|
3928
|
+
tokenUsage
|
|
3929
|
+
);
|
|
3912
3930
|
await setError(cfg, messageId, detail);
|
|
3913
3931
|
return;
|
|
3914
3932
|
}
|
|
3915
3933
|
if (outcome.status === "cancelled" || signal.aborted) {
|
|
3916
|
-
await logSyncRef.current?.markRun(
|
|
3934
|
+
await logSyncRef.current?.markRun(
|
|
3935
|
+
outcome.runId,
|
|
3936
|
+
"cancelled",
|
|
3937
|
+
"\u5DF2\u53D6\u6D88",
|
|
3938
|
+
tokenUsage
|
|
3939
|
+
);
|
|
3917
3940
|
await updateStatus(cfg, messageId, "CANCELLED");
|
|
3918
3941
|
return;
|
|
3919
3942
|
}
|
|
@@ -4007,7 +4030,12 @@ async function handleWebIdeInboundMessage(cfg, msg, signal, options) {
|
|
|
4007
4030
|
);
|
|
4008
4031
|
}
|
|
4009
4032
|
}
|
|
4010
|
-
await logSyncRef.current?.markRun(
|
|
4033
|
+
await logSyncRef.current?.markRun(
|
|
4034
|
+
outcome.runId,
|
|
4035
|
+
"finished",
|
|
4036
|
+
null,
|
|
4037
|
+
tokenUsage
|
|
4038
|
+
);
|
|
4011
4039
|
await updateStatus(cfg, messageId, "SUCCESS");
|
|
4012
4040
|
console.log(
|
|
4013
4041
|
`[apm] webide-message \u5B8C\u6210 action=${msg.action} messageId=${messageId} agentId=${outcome.agentId}`
|