ai-project-manage-cli 7.1.24 → 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 +62 -8
- 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);
|
|
@@ -3284,9 +3286,33 @@ async function ensureWebIdePullRequests(cfg, taskId, workdir) {
|
|
|
3284
3286
|
]
|
|
3285
3287
|
};
|
|
3286
3288
|
}
|
|
3289
|
+
let projectBaseBranch = "";
|
|
3290
|
+
try {
|
|
3291
|
+
const baseline = await api.cli.projectBaseBranch({ taskId });
|
|
3292
|
+
projectBaseBranch = baseline.baseBranch?.trim() ?? "";
|
|
3293
|
+
} catch (err) {
|
|
3294
|
+
const tip = `\u8BFB\u53D6\u9879\u76EE\u57FA\u7EBF\u5206\u652F\u5931\u8D25: ${err instanceof Error ? err.message : err}`;
|
|
3295
|
+
console.warn(`[apm] WebIDE PR\uFF1A${tip}`);
|
|
3296
|
+
return {
|
|
3297
|
+
...empty(),
|
|
3298
|
+
failed: 1,
|
|
3299
|
+
tips: [tip],
|
|
3300
|
+
items: [{ label: "\u5DE5\u4F5C\u533A", outcome: "failed", detail: tip }]
|
|
3301
|
+
};
|
|
3302
|
+
}
|
|
3303
|
+
if (!projectBaseBranch) {
|
|
3304
|
+
const tip = "\u9879\u76EE\u672A\u914D\u7F6E\u57FA\u7840\u5206\u652F\uFF0C\u65E0\u6CD5\u6309\u57FA\u7EBF\u5339\u914D\u5E73\u53F0\u4ED3\u5E93";
|
|
3305
|
+
console.warn(`[apm] WebIDE PR\uFF1A${tip}`);
|
|
3306
|
+
return {
|
|
3307
|
+
...empty(),
|
|
3308
|
+
failed: 1,
|
|
3309
|
+
tips: [tip],
|
|
3310
|
+
items: [{ label: "\u5DE5\u4F5C\u533A", outcome: "failed", detail: tip }]
|
|
3311
|
+
};
|
|
3312
|
+
}
|
|
3287
3313
|
const expectedHead = `feat/task-${taskId}`;
|
|
3288
3314
|
console.log(
|
|
3289
|
-
`[apm] WebIDE PR\uFF1A\u51C6\u5907\u68C0\u67E5 ${repoRoots.length} \u4E2A\u4ED3\u5E93\uFF08\u671F\u671B\u7279\u6027\u5206\u652F ${expectedHead}\uFF09`
|
|
3315
|
+
`[apm] WebIDE PR\uFF1A\u51C6\u5907\u68C0\u67E5 ${repoRoots.length} \u4E2A\u4ED3\u5E93\uFF08\u671F\u671B\u7279\u6027\u5206\u652F ${expectedHead}\uFF0C\u9879\u76EE\u57FA\u7EBF ${projectBaseBranch}\uFF09`
|
|
3290
3316
|
);
|
|
3291
3317
|
let ensured = 0;
|
|
3292
3318
|
let skipped = 0;
|
|
@@ -3339,10 +3365,13 @@ async function ensureWebIdePullRequests(cfg, taskId, workdir) {
|
|
|
3339
3365
|
});
|
|
3340
3366
|
continue;
|
|
3341
3367
|
}
|
|
3342
|
-
const matched = await api.cli.matchRepository({
|
|
3368
|
+
const matched = await api.cli.matchRepository({
|
|
3369
|
+
url: originUrl,
|
|
3370
|
+
baseBranch: projectBaseBranch
|
|
3371
|
+
});
|
|
3343
3372
|
const repositoryId = matched.repositoryId?.trim();
|
|
3344
3373
|
if (!repositoryId) {
|
|
3345
|
-
const tip = `${label}\uFF1A\u5E73\u53F0\u672A\
|
|
3374
|
+
const tip = `${label}\uFF1A\u5E73\u53F0\u672A\u627E\u5230\u4ED3\u5E93\uFF08remote=${originUrl}\uFF0C\u57FA\u7EBF=${projectBaseBranch}\uFF09`;
|
|
3346
3375
|
console.warn(`[apm] WebIDE PR\uFF1A\u8DF3\u8FC7 ${tip}`);
|
|
3347
3376
|
tips.push(tip);
|
|
3348
3377
|
skipped += 1;
|
|
@@ -3350,6 +3379,7 @@ async function ensureWebIdePullRequests(cfg, taskId, workdir) {
|
|
|
3350
3379
|
label,
|
|
3351
3380
|
outcome: "skipped",
|
|
3352
3381
|
headBranch,
|
|
3382
|
+
baseBranch: projectBaseBranch,
|
|
3353
3383
|
detail: tip
|
|
3354
3384
|
});
|
|
3355
3385
|
continue;
|
|
@@ -3876,16 +3906,35 @@ async function handleWebIdeInboundMessage(cfg, msg, signal, options) {
|
|
|
3876
3906
|
}
|
|
3877
3907
|
);
|
|
3878
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;
|
|
3879
3918
|
if (outcome.status === "error") {
|
|
3880
3919
|
const detail = formatCursorRunFailure(outcome.runId, {
|
|
3881
3920
|
resultText: outcome.result
|
|
3882
3921
|
});
|
|
3883
|
-
await logSyncRef.current?.markRun(
|
|
3922
|
+
await logSyncRef.current?.markRun(
|
|
3923
|
+
outcome.runId,
|
|
3924
|
+
"error",
|
|
3925
|
+
detail,
|
|
3926
|
+
tokenUsage
|
|
3927
|
+
);
|
|
3884
3928
|
await setError(cfg, messageId, detail);
|
|
3885
3929
|
return;
|
|
3886
3930
|
}
|
|
3887
3931
|
if (outcome.status === "cancelled" || signal.aborted) {
|
|
3888
|
-
await logSyncRef.current?.markRun(
|
|
3932
|
+
await logSyncRef.current?.markRun(
|
|
3933
|
+
outcome.runId,
|
|
3934
|
+
"cancelled",
|
|
3935
|
+
"\u5DF2\u53D6\u6D88",
|
|
3936
|
+
tokenUsage
|
|
3937
|
+
);
|
|
3889
3938
|
await updateStatus(cfg, messageId, "CANCELLED");
|
|
3890
3939
|
return;
|
|
3891
3940
|
}
|
|
@@ -3979,7 +4028,12 @@ async function handleWebIdeInboundMessage(cfg, msg, signal, options) {
|
|
|
3979
4028
|
);
|
|
3980
4029
|
}
|
|
3981
4030
|
}
|
|
3982
|
-
await logSyncRef.current?.markRun(
|
|
4031
|
+
await logSyncRef.current?.markRun(
|
|
4032
|
+
outcome.runId,
|
|
4033
|
+
"finished",
|
|
4034
|
+
null,
|
|
4035
|
+
tokenUsage
|
|
4036
|
+
);
|
|
3983
4037
|
await updateStatus(cfg, messageId, "SUCCESS");
|
|
3984
4038
|
console.log(
|
|
3985
4039
|
`[apm] webide-message \u5B8C\u6210 action=${msg.action} messageId=${messageId} agentId=${outcome.agentId}`
|