ai-project-manage-cli 7.1.25 → 7.1.26
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 +31 -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);
|
|
@@ -3904,16 +3906,35 @@ async function handleWebIdeInboundMessage(cfg, msg, signal, options) {
|
|
|
3904
3906
|
}
|
|
3905
3907
|
);
|
|
3906
3908
|
saveWebIdeAgentId(workdir, taskId, outcome.agentId);
|
|
3909
|
+
const tokenUsage = outcome.usage != null ? {
|
|
3910
|
+
modelId: outcome.modelId ?? (msg.model?.trim() || void 0),
|
|
3911
|
+
inputTokens: outcome.usage.inputTokens,
|
|
3912
|
+
outputTokens: outcome.usage.outputTokens,
|
|
3913
|
+
cacheReadTokens: outcome.usage.cacheReadTokens,
|
|
3914
|
+
cacheWriteTokens: outcome.usage.cacheWriteTokens,
|
|
3915
|
+
totalTokens: outcome.usage.totalTokens,
|
|
3916
|
+
...outcome.usage.reasoningTokens != null ? { reasoningTokens: outcome.usage.reasoningTokens } : {}
|
|
3917
|
+
} : void 0;
|
|
3907
3918
|
if (outcome.status === "error") {
|
|
3908
3919
|
const detail = formatCursorRunFailure(outcome.runId, {
|
|
3909
3920
|
resultText: outcome.result
|
|
3910
3921
|
});
|
|
3911
|
-
await logSyncRef.current?.markRun(
|
|
3922
|
+
await logSyncRef.current?.markRun(
|
|
3923
|
+
outcome.runId,
|
|
3924
|
+
"error",
|
|
3925
|
+
detail,
|
|
3926
|
+
tokenUsage
|
|
3927
|
+
);
|
|
3912
3928
|
await setError(cfg, messageId, detail);
|
|
3913
3929
|
return;
|
|
3914
3930
|
}
|
|
3915
3931
|
if (outcome.status === "cancelled" || signal.aborted) {
|
|
3916
|
-
await logSyncRef.current?.markRun(
|
|
3932
|
+
await logSyncRef.current?.markRun(
|
|
3933
|
+
outcome.runId,
|
|
3934
|
+
"cancelled",
|
|
3935
|
+
"\u5DF2\u53D6\u6D88",
|
|
3936
|
+
tokenUsage
|
|
3937
|
+
);
|
|
3917
3938
|
await updateStatus(cfg, messageId, "CANCELLED");
|
|
3918
3939
|
return;
|
|
3919
3940
|
}
|
|
@@ -4007,7 +4028,12 @@ async function handleWebIdeInboundMessage(cfg, msg, signal, options) {
|
|
|
4007
4028
|
);
|
|
4008
4029
|
}
|
|
4009
4030
|
}
|
|
4010
|
-
await logSyncRef.current?.markRun(
|
|
4031
|
+
await logSyncRef.current?.markRun(
|
|
4032
|
+
outcome.runId,
|
|
4033
|
+
"finished",
|
|
4034
|
+
null,
|
|
4035
|
+
tokenUsage
|
|
4036
|
+
);
|
|
4011
4037
|
await updateStatus(cfg, messageId, "SUCCESS");
|
|
4012
4038
|
console.log(
|
|
4013
4039
|
`[apm] webide-message \u5B8C\u6210 action=${msg.action} messageId=${messageId} agentId=${outcome.agentId}`
|