ai-project-manage-cli 8.1.15 → 8.1.17
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/worker-script.js +79 -26
- package/package.json +1 -1
package/dist/worker-script.js
CHANGED
|
@@ -536,14 +536,6 @@ function taskIdFromFeatureBranch(branch) {
|
|
|
536
536
|
const id = match?.[1]?.trim() ?? "";
|
|
537
537
|
return id || null;
|
|
538
538
|
}
|
|
539
|
-
async function hasUpstream(cwd) {
|
|
540
|
-
try {
|
|
541
|
-
await execGit(cwd, ["rev-parse", "--abbrev-ref", "@{upstream}"], true);
|
|
542
|
-
return true;
|
|
543
|
-
} catch {
|
|
544
|
-
return false;
|
|
545
|
-
}
|
|
546
|
-
}
|
|
547
539
|
async function pushCurrentBranch(cwd) {
|
|
548
540
|
if (!await isGitRepo(cwd)) {
|
|
549
541
|
return false;
|
|
@@ -553,11 +545,7 @@ async function pushCurrentBranch(cwd) {
|
|
|
553
545
|
console.log("[apm] \u672A\u914D\u7F6E remote.origin\uFF0C\u8DF3\u8FC7 push");
|
|
554
546
|
return false;
|
|
555
547
|
}
|
|
556
|
-
|
|
557
|
-
await execGit(cwd, ["push"]);
|
|
558
|
-
} else {
|
|
559
|
-
await execGit(cwd, ["push", "-u", "origin", "HEAD"]);
|
|
560
|
-
}
|
|
548
|
+
await execGit(cwd, ["push", "-u", "origin", "HEAD"]);
|
|
561
549
|
return true;
|
|
562
550
|
}
|
|
563
551
|
|
|
@@ -895,6 +883,7 @@ async function ensureFeatureBranch(branch, baselineBranch, options) {
|
|
|
895
883
|
try {
|
|
896
884
|
await execGit(gitRoot, [
|
|
897
885
|
"checkout",
|
|
886
|
+
"--no-track",
|
|
898
887
|
"-b",
|
|
899
888
|
branch,
|
|
900
889
|
`origin/${baselineBranch}`
|
|
@@ -2457,7 +2446,9 @@ function createPtySessionMcpServers(cfg2) {
|
|
|
2457
2446
|
}
|
|
2458
2447
|
|
|
2459
2448
|
// src/commands/connect/local-sqlite-agent-store.ts
|
|
2460
|
-
import {
|
|
2449
|
+
import {
|
|
2450
|
+
composeLocalAgentStore
|
|
2451
|
+
} from "@cursor/sdk";
|
|
2461
2452
|
import { SqliteLocalAgentStore } from "@cursor/sdk/sqlite";
|
|
2462
2453
|
|
|
2463
2454
|
// src/commands/connect/remote-local-agent-store.ts
|
|
@@ -2701,6 +2692,43 @@ async function openSqliteLocalAgentStore(workspaceRef) {
|
|
|
2701
2692
|
sqliteByKey.set(cwd, pending2);
|
|
2702
2693
|
return pending2;
|
|
2703
2694
|
}
|
|
2695
|
+
function mirrorRunEventsForVisualization(cfg2, local) {
|
|
2696
|
+
const api = createApmApiClient(cfg2);
|
|
2697
|
+
return {
|
|
2698
|
+
async append(input) {
|
|
2699
|
+
const row = await local.append(input);
|
|
2700
|
+
void api.cli.cursorStoreAppendRunEvents({
|
|
2701
|
+
events: [
|
|
2702
|
+
{
|
|
2703
|
+
runId: input.runId,
|
|
2704
|
+
eventType: input.eventType,
|
|
2705
|
+
payload: input.payload,
|
|
2706
|
+
payloadRef: input.payloadRef ?? null,
|
|
2707
|
+
idempotencyKey: input.idempotencyKey ?? null
|
|
2708
|
+
}
|
|
2709
|
+
]
|
|
2710
|
+
}).catch((err) => {
|
|
2711
|
+
console.warn(
|
|
2712
|
+
`[apm] runEvents \u53EF\u89C6\u5316\u540C\u6B65\u5931\u8D25 runId=${input.runId}:`,
|
|
2713
|
+
err instanceof Error ? err.message : err
|
|
2714
|
+
);
|
|
2715
|
+
});
|
|
2716
|
+
return row;
|
|
2717
|
+
},
|
|
2718
|
+
list: (input) => local.list(input),
|
|
2719
|
+
async delete(input) {
|
|
2720
|
+
await local.delete(input);
|
|
2721
|
+
const runIds = input.filter.runIds?.map((id) => id.trim()).filter(Boolean);
|
|
2722
|
+
if (!runIds?.length) return;
|
|
2723
|
+
void api.cli.cursorStoreDeleteRunEvents({ runIds }).catch((err) => {
|
|
2724
|
+
console.warn(
|
|
2725
|
+
`[apm] runEvents \u53EF\u89C6\u5316\u6E05\u7406\u5931\u8D25:`,
|
|
2726
|
+
err instanceof Error ? err.message : err
|
|
2727
|
+
);
|
|
2728
|
+
});
|
|
2729
|
+
}
|
|
2730
|
+
};
|
|
2731
|
+
}
|
|
2704
2732
|
async function createApmCursorAgentStore(cfg2, workspaceRef) {
|
|
2705
2733
|
const cwd = workspaceRef.trim();
|
|
2706
2734
|
const [sqlite, remote] = await Promise.all([
|
|
@@ -2711,7 +2739,7 @@ async function createApmCursorAgentStore(cfg2, workspaceRef) {
|
|
|
2711
2739
|
agents: remote.agents,
|
|
2712
2740
|
runs: remote.runs,
|
|
2713
2741
|
checkpoints: sqlite.checkpoints,
|
|
2714
|
-
runEvents: sqlite.runEvents
|
|
2742
|
+
runEvents: mirrorRunEventsForVisualization(cfg2, sqlite.runEvents)
|
|
2715
2743
|
});
|
|
2716
2744
|
}
|
|
2717
2745
|
async function purgeLocalSqliteAgentData(input) {
|
|
@@ -4094,6 +4122,17 @@ async function purgeCursorAgentStoreForAgent(cfg2, agentId, workspaceRef) {
|
|
|
4094
4122
|
runIds
|
|
4095
4123
|
});
|
|
4096
4124
|
}
|
|
4125
|
+
if (runIds.length > 0) {
|
|
4126
|
+
try {
|
|
4127
|
+
const api = createApmApiClient(cfg2);
|
|
4128
|
+
await api.cli.cursorStoreDeleteRunEvents({ runIds });
|
|
4129
|
+
} catch (err) {
|
|
4130
|
+
console.warn(
|
|
4131
|
+
`[apm] \u6E05\u7406\u5E73\u53F0 runEvents \u5931\u8D25 agentId=${trimmedAgentId}:`,
|
|
4132
|
+
err instanceof Error ? err.message : err
|
|
4133
|
+
);
|
|
4134
|
+
}
|
|
4135
|
+
}
|
|
4097
4136
|
return true;
|
|
4098
4137
|
}
|
|
4099
4138
|
async function cleanWebIdeWorkspaceCache(taskId, workdir, cfg2) {
|
|
@@ -5288,18 +5327,32 @@ ${assumptionAnswersText}` : msg2.content,
|
|
|
5288
5327
|
}
|
|
5289
5328
|
if (shouldCommitAfterWebIdeMessage(effectiveAction)) {
|
|
5290
5329
|
if (signal.aborted) throw new Error("\u4EFB\u52A1\u5DF2\u53D6\u6D88");
|
|
5291
|
-
|
|
5292
|
-
|
|
5293
|
-
|
|
5294
|
-
|
|
5295
|
-
|
|
5296
|
-
|
|
5297
|
-
|
|
5330
|
+
try {
|
|
5331
|
+
const committed = await commitWorkspaceReposIfDirty(
|
|
5332
|
+
workdir,
|
|
5333
|
+
`chore(webide): sync after ${effectiveAction} (${taskId})`
|
|
5334
|
+
);
|
|
5335
|
+
console.log(
|
|
5336
|
+
`[apm] webide \u515C\u5E95 commit action=${effectiveAction} repos=${committed}`
|
|
5337
|
+
);
|
|
5338
|
+
} catch (err) {
|
|
5339
|
+
console.warn(
|
|
5340
|
+
`[apm] webide \u515C\u5E95 commit \u5931\u8D25\uFF08\u4E0D\u963B\u65AD\u5B8C\u6210\uFF09 action=${effectiveAction}:`,
|
|
5341
|
+
err instanceof Error ? err.message : err
|
|
5342
|
+
);
|
|
5343
|
+
}
|
|
5298
5344
|
if (signal.aborted) throw new Error("\u4EFB\u52A1\u5DF2\u53D6\u6D88");
|
|
5299
|
-
|
|
5300
|
-
|
|
5301
|
-
|
|
5302
|
-
|
|
5345
|
+
try {
|
|
5346
|
+
const pushed = await pushWorkspaceRepos(workdir);
|
|
5347
|
+
console.log(
|
|
5348
|
+
`[apm] webide \u81EA\u52A8 push action=${effectiveAction} repos=${pushed}`
|
|
5349
|
+
);
|
|
5350
|
+
} catch (err) {
|
|
5351
|
+
console.warn(
|
|
5352
|
+
`[apm] webide \u81EA\u52A8 push \u5931\u8D25\uFF08\u4E0D\u963B\u65AD\u5B8C\u6210\uFF09 action=${effectiveAction}:`,
|
|
5353
|
+
err instanceof Error ? err.message : err
|
|
5354
|
+
);
|
|
5355
|
+
}
|
|
5303
5356
|
}
|
|
5304
5357
|
if (shouldEnsureWebIdePullRequestsAfterAgent(effectiveAction)) {
|
|
5305
5358
|
if (signal.aborted) throw new Error("\u4EFB\u52A1\u5DF2\u53D6\u6D88");
|