ai-project-manage-cli 8.1.4 → 8.1.5

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 CHANGED
@@ -376,6 +376,66 @@ var requestConfig = {
376
376
  projectPackageEnsureContent: defineEndpoint({
377
377
  method: "PUT",
378
378
  path: "/cli/project-packages/ensure-content"
379
+ }),
380
+ cursorStoreUpsertAgent: defineEndpoint({
381
+ method: "PUT",
382
+ path: "/cli/cursor-store/agents"
383
+ }),
384
+ cursorStoreGetAgent: defineEndpoint({
385
+ method: "GET",
386
+ path: "/cli/cursor-store/agents/get"
387
+ }),
388
+ cursorStoreListAgents: defineEndpoint({
389
+ method: "POST",
390
+ path: "/cli/cursor-store/agents/list"
391
+ }),
392
+ cursorStoreDeleteAgents: defineEndpoint({
393
+ method: "POST",
394
+ path: "/cli/cursor-store/agents/delete"
395
+ }),
396
+ cursorStoreUpsertRun: defineEndpoint({
397
+ method: "PUT",
398
+ path: "/cli/cursor-store/runs"
399
+ }),
400
+ cursorStoreGetRun: defineEndpoint({
401
+ method: "GET",
402
+ path: "/cli/cursor-store/runs/get"
403
+ }),
404
+ cursorStoreListRuns: defineEndpoint({
405
+ method: "POST",
406
+ path: "/cli/cursor-store/runs/list"
407
+ }),
408
+ cursorStoreDeleteRuns: defineEndpoint({
409
+ method: "POST",
410
+ path: "/cli/cursor-store/runs/delete"
411
+ }),
412
+ cursorStoreAppendRunEvents: defineEndpoint({
413
+ method: "POST",
414
+ path: "/cli/cursor-store/run-events/append"
415
+ }),
416
+ cursorStoreListRunEvents: defineEndpoint({
417
+ method: "POST",
418
+ path: "/cli/cursor-store/run-events/list"
419
+ }),
420
+ cursorStoreDeleteRunEvents: defineEndpoint({
421
+ method: "POST",
422
+ path: "/cli/cursor-store/run-events/delete"
423
+ }),
424
+ cursorStorePutCheckpoint: defineEndpoint({
425
+ method: "PUT",
426
+ path: "/cli/cursor-store/checkpoints"
427
+ }),
428
+ cursorStoreGetCheckpoint: defineEndpoint({
429
+ method: "GET",
430
+ path: "/cli/cursor-store/checkpoints/get"
431
+ }),
432
+ cursorStoreListCheckpoints: defineEndpoint({
433
+ method: "POST",
434
+ path: "/cli/cursor-store/checkpoints/list"
435
+ }),
436
+ cursorStoreDeleteCheckpoints: defineEndpoint({
437
+ method: "POST",
438
+ path: "/cli/cursor-store/checkpoints/delete"
379
439
  })
380
440
  }
381
441
  };
@@ -124,6 +124,66 @@ var requestConfig = {
124
124
  projectPackageEnsureContent: defineEndpoint({
125
125
  method: "PUT",
126
126
  path: "/cli/project-packages/ensure-content"
127
+ }),
128
+ cursorStoreUpsertAgent: defineEndpoint({
129
+ method: "PUT",
130
+ path: "/cli/cursor-store/agents"
131
+ }),
132
+ cursorStoreGetAgent: defineEndpoint({
133
+ method: "GET",
134
+ path: "/cli/cursor-store/agents/get"
135
+ }),
136
+ cursorStoreListAgents: defineEndpoint({
137
+ method: "POST",
138
+ path: "/cli/cursor-store/agents/list"
139
+ }),
140
+ cursorStoreDeleteAgents: defineEndpoint({
141
+ method: "POST",
142
+ path: "/cli/cursor-store/agents/delete"
143
+ }),
144
+ cursorStoreUpsertRun: defineEndpoint({
145
+ method: "PUT",
146
+ path: "/cli/cursor-store/runs"
147
+ }),
148
+ cursorStoreGetRun: defineEndpoint({
149
+ method: "GET",
150
+ path: "/cli/cursor-store/runs/get"
151
+ }),
152
+ cursorStoreListRuns: defineEndpoint({
153
+ method: "POST",
154
+ path: "/cli/cursor-store/runs/list"
155
+ }),
156
+ cursorStoreDeleteRuns: defineEndpoint({
157
+ method: "POST",
158
+ path: "/cli/cursor-store/runs/delete"
159
+ }),
160
+ cursorStoreAppendRunEvents: defineEndpoint({
161
+ method: "POST",
162
+ path: "/cli/cursor-store/run-events/append"
163
+ }),
164
+ cursorStoreListRunEvents: defineEndpoint({
165
+ method: "POST",
166
+ path: "/cli/cursor-store/run-events/list"
167
+ }),
168
+ cursorStoreDeleteRunEvents: defineEndpoint({
169
+ method: "POST",
170
+ path: "/cli/cursor-store/run-events/delete"
171
+ }),
172
+ cursorStorePutCheckpoint: defineEndpoint({
173
+ method: "PUT",
174
+ path: "/cli/cursor-store/checkpoints"
175
+ }),
176
+ cursorStoreGetCheckpoint: defineEndpoint({
177
+ method: "GET",
178
+ path: "/cli/cursor-store/checkpoints/get"
179
+ }),
180
+ cursorStoreListCheckpoints: defineEndpoint({
181
+ method: "POST",
182
+ path: "/cli/cursor-store/checkpoints/list"
183
+ }),
184
+ cursorStoreDeleteCheckpoints: defineEndpoint({
185
+ method: "POST",
186
+ path: "/cli/cursor-store/checkpoints/delete"
127
187
  })
128
188
  }
129
189
  };
@@ -2385,6 +2445,330 @@ function createPtySessionMcpServers(cfg2) {
2385
2445
  };
2386
2446
  }
2387
2447
 
2448
+ // src/commands/connect/remote-local-agent-store.ts
2449
+ function asCheckpointRef(value) {
2450
+ if (value === void 0) return void 0;
2451
+ if (value === null) return null;
2452
+ if (!value || typeof value !== "object") return null;
2453
+ const row = value;
2454
+ if (typeof row.rootBlobId !== "string" || !row.rootBlobId.trim()) {
2455
+ return null;
2456
+ }
2457
+ return {
2458
+ schemaVersion: 1,
2459
+ rootBlobId: row.rootBlobId
2460
+ };
2461
+ }
2462
+ function toApiCheckpointRef(ref) {
2463
+ if (ref === void 0) return void 0;
2464
+ if (ref === null) return null;
2465
+ return {
2466
+ schemaVersion: ref.schemaVersion,
2467
+ rootBlobId: ref.rootBlobId
2468
+ };
2469
+ }
2470
+ function fromApiAgent(row) {
2471
+ return {
2472
+ agentId: row.agentId,
2473
+ cwd: row.cwd,
2474
+ status: row.status,
2475
+ activeRunId: row.activeRunId,
2476
+ name: row.name,
2477
+ createdAt: row.createdAt,
2478
+ updatedAt: row.updatedAt,
2479
+ latestCheckpoint: asCheckpointRef(row.latestCheckpoint) ?? null,
2480
+ sdkMetadata: row.sdkMetadata ?? void 0
2481
+ };
2482
+ }
2483
+ function fromApiRun(row) {
2484
+ return {
2485
+ runId: row.runId,
2486
+ requestId: row.requestId,
2487
+ agentId: row.agentId,
2488
+ turnNumber: row.turnNumber,
2489
+ status: row.status,
2490
+ model: row.model ?? null,
2491
+ result: row.result,
2492
+ error: row.error,
2493
+ usageRef: row.usageRef,
2494
+ usage: row.usage ?? null,
2495
+ createdAt: row.createdAt,
2496
+ updatedAt: row.updatedAt,
2497
+ startedAt: row.startedAt,
2498
+ endedAt: row.endedAt,
2499
+ startCheckpointRef: asCheckpointRef(row.startCheckpointRef) ?? null,
2500
+ latestCheckpointRef: asCheckpointRef(row.latestCheckpointRef) ?? null
2501
+ };
2502
+ }
2503
+ function fromApiEvent(row) {
2504
+ return {
2505
+ runId: row.runId,
2506
+ seq: row.seq,
2507
+ offset: row.offset,
2508
+ eventType: row.eventType,
2509
+ payload: row.payload,
2510
+ payloadRef: row.payloadRef,
2511
+ idempotencyKey: row.idempotencyKey,
2512
+ createdAt: row.createdAt
2513
+ };
2514
+ }
2515
+ function bytesToBase64(data) {
2516
+ return Buffer.from(data).toString("base64");
2517
+ }
2518
+ function base64ToBytes(dataBase64) {
2519
+ return new Uint8Array(Buffer.from(dataBase64, "base64"));
2520
+ }
2521
+ function createRemoteLocalAgentStore(cfg2) {
2522
+ const api = createApmApiClient(cfg2);
2523
+ async function upsertAgent(agent) {
2524
+ const row = await api.cli.cursorStoreUpsertAgent({
2525
+ agentId: agent.agentId,
2526
+ cwd: agent.cwd,
2527
+ status: agent.status,
2528
+ activeRunId: agent.activeRunId ?? null,
2529
+ name: agent.name ?? null,
2530
+ latestCheckpoint: toApiCheckpointRef(agent.latestCheckpoint) ?? null,
2531
+ sdkMetadata: agent.sdkMetadata ?? null,
2532
+ createdAt: agent.createdAt,
2533
+ updatedAt: agent.updatedAt
2534
+ });
2535
+ return fromApiAgent(row);
2536
+ }
2537
+ async function upsertRun(run) {
2538
+ const row = await api.cli.cursorStoreUpsertRun({
2539
+ runId: run.runId,
2540
+ agentId: run.agentId,
2541
+ requestId: run.requestId ?? null,
2542
+ turnNumber: run.turnNumber,
2543
+ status: run.status,
2544
+ model: run.model ?? null,
2545
+ result: run.result ?? null,
2546
+ error: run.error ?? null,
2547
+ usageRef: run.usageRef ?? null,
2548
+ usage: run.usage ?? null,
2549
+ startCheckpointRef: toApiCheckpointRef(run.startCheckpointRef) ?? null,
2550
+ latestCheckpointRef: toApiCheckpointRef(run.latestCheckpointRef) ?? null,
2551
+ createdAt: run.createdAt,
2552
+ updatedAt: run.updatedAt,
2553
+ startedAt: run.startedAt ?? null,
2554
+ endedAt: run.endedAt ?? null
2555
+ });
2556
+ return fromApiRun(row);
2557
+ }
2558
+ async function putCheckpoint(input) {
2559
+ await api.cli.cursorStorePutCheckpoint({
2560
+ agentId: input.agentId,
2561
+ blobId: input.blobId,
2562
+ dataBase64: bytesToBase64(input.data),
2563
+ byteSize: input.data.byteLength,
2564
+ createdAt: Date.now()
2565
+ });
2566
+ }
2567
+ return {
2568
+ agents: {
2569
+ async get(input) {
2570
+ const row = await api.cli.cursorStoreGetAgent({
2571
+ agentId: input.agentId
2572
+ });
2573
+ return row ? fromApiAgent(row) : null;
2574
+ },
2575
+ async create(input) {
2576
+ return upsertAgent(input.agent);
2577
+ },
2578
+ async update(input) {
2579
+ return upsertAgent(input.agent);
2580
+ },
2581
+ async delete(input) {
2582
+ const agentIds = input.filter.agentIds?.map((id) => id.trim()).filter(Boolean);
2583
+ const cwd = input.filter.cwd?.trim();
2584
+ if (agentIds && agentIds.length > 0) {
2585
+ await api.cli.cursorStoreDeleteAgents({ agentIds, cwd });
2586
+ return;
2587
+ }
2588
+ if (cwd) {
2589
+ await api.cli.cursorStoreDeleteAgents({ cwd });
2590
+ return;
2591
+ }
2592
+ let cursor;
2593
+ for (; ; ) {
2594
+ const page = await api.cli.cursorStoreListAgents({
2595
+ cursor,
2596
+ limit: 200
2597
+ });
2598
+ if (page.items.length === 0) break;
2599
+ await api.cli.cursorStoreDeleteAgents({
2600
+ agentIds: page.items.map((item) => item.agentId)
2601
+ });
2602
+ if (!page.nextCursor) break;
2603
+ cursor = page.nextCursor;
2604
+ }
2605
+ },
2606
+ async list(input) {
2607
+ const page = await api.cli.cursorStoreListAgents({
2608
+ cursor: input?.filter?.cursor,
2609
+ limit: input?.filter?.limit,
2610
+ cwd: input?.filter?.cwd
2611
+ });
2612
+ const result = {
2613
+ items: page.items.map(fromApiAgent),
2614
+ ...page.nextCursor ? { nextCursor: page.nextCursor } : {}
2615
+ };
2616
+ return result;
2617
+ }
2618
+ },
2619
+ runs: {
2620
+ async get(input) {
2621
+ const row = await api.cli.cursorStoreGetRun({
2622
+ agentId: input.agentId,
2623
+ runId: input.runId
2624
+ });
2625
+ return row ? fromApiRun(row) : null;
2626
+ },
2627
+ async create(input) {
2628
+ return upsertRun(input.run);
2629
+ },
2630
+ async update(input) {
2631
+ return upsertRun(input.run);
2632
+ },
2633
+ async delete(input) {
2634
+ const agentIds = input.filter.agentIds?.map((id) => id.trim()).filter(Boolean);
2635
+ const runIds = input.filter.runIds?.map((id) => id.trim()).filter(Boolean);
2636
+ if (agentIds && agentIds.length > 0 || runIds && runIds.length > 0) {
2637
+ await api.cli.cursorStoreDeleteRuns({ agentIds, runIds });
2638
+ return;
2639
+ }
2640
+ let cursor;
2641
+ for (; ; ) {
2642
+ const page = await api.cli.cursorStoreListRuns({
2643
+ cursor,
2644
+ limit: 200
2645
+ });
2646
+ if (page.items.length === 0) break;
2647
+ await api.cli.cursorStoreDeleteRuns({
2648
+ runIds: page.items.map((item) => item.runId)
2649
+ });
2650
+ if (!page.nextCursor) break;
2651
+ cursor = page.nextCursor;
2652
+ }
2653
+ },
2654
+ async list(input) {
2655
+ const page = await api.cli.cursorStoreListRuns({
2656
+ agentIds: input?.filter?.agentIds ? [...input.filter.agentIds] : void 0,
2657
+ runIds: input?.filter?.runIds ? [...input.filter.runIds] : void 0,
2658
+ cursor: input?.filter?.cursor,
2659
+ limit: input?.filter?.limit
2660
+ });
2661
+ const result = {
2662
+ items: page.items.map(fromApiRun),
2663
+ ...page.nextCursor ? { nextCursor: page.nextCursor } : {}
2664
+ };
2665
+ return result;
2666
+ }
2667
+ },
2668
+ runEvents: {
2669
+ async append(input) {
2670
+ const { items } = await api.cli.cursorStoreAppendRunEvents({
2671
+ events: [
2672
+ {
2673
+ runId: input.runId,
2674
+ eventType: input.eventType,
2675
+ payload: input.payload,
2676
+ payloadRef: input.payloadRef ?? null,
2677
+ idempotencyKey: input.idempotencyKey ?? null
2678
+ }
2679
+ ]
2680
+ });
2681
+ const row = items[0];
2682
+ if (!row) {
2683
+ throw new Error("cursor-store append run event \u672A\u8FD4\u56DE\u7ED3\u679C");
2684
+ }
2685
+ return fromApiEvent(row);
2686
+ },
2687
+ async list(input) {
2688
+ const page = await api.cli.cursorStoreListRunEvents({
2689
+ runId: input.runId,
2690
+ afterOffset: input.afterOffset ?? null,
2691
+ limit: input.limit
2692
+ });
2693
+ return {
2694
+ items: page.items.map(fromApiEvent),
2695
+ ...page.nextOffset ? { nextOffset: page.nextOffset } : {}
2696
+ };
2697
+ },
2698
+ async delete(input) {
2699
+ const runIds = input.filter.runIds?.map((id) => id.trim()).filter(Boolean);
2700
+ if (runIds && runIds.length > 0) {
2701
+ await api.cli.cursorStoreDeleteRunEvents({ runIds });
2702
+ return;
2703
+ }
2704
+ let cursor;
2705
+ for (; ; ) {
2706
+ const page = await api.cli.cursorStoreListRuns({
2707
+ cursor,
2708
+ limit: 200
2709
+ });
2710
+ if (page.items.length === 0) break;
2711
+ await api.cli.cursorStoreDeleteRunEvents({
2712
+ runIds: page.items.map((item) => item.runId)
2713
+ });
2714
+ if (!page.nextCursor) break;
2715
+ cursor = page.nextCursor;
2716
+ }
2717
+ }
2718
+ },
2719
+ checkpoints: {
2720
+ async get(input) {
2721
+ const row = await api.cli.cursorStoreGetCheckpoint({
2722
+ agentId: input.agentId,
2723
+ blobId: input.blobId
2724
+ });
2725
+ if (!row?.dataBase64) return null;
2726
+ return base64ToBytes(row.dataBase64);
2727
+ },
2728
+ async create(input) {
2729
+ await putCheckpoint(input);
2730
+ },
2731
+ async update(input) {
2732
+ await putCheckpoint(input);
2733
+ },
2734
+ async delete(input) {
2735
+ const agentIds = input.filter.agentIds?.map((id) => id.trim()).filter(Boolean);
2736
+ const blobIds = input.filter.blobIds?.map((id) => id.trim()).filter(Boolean);
2737
+ if (agentIds && agentIds.length > 0 || blobIds && blobIds.length > 0) {
2738
+ await api.cli.cursorStoreDeleteCheckpoints({ agentIds, blobIds });
2739
+ return;
2740
+ }
2741
+ let cursor;
2742
+ for (; ; ) {
2743
+ const page = await api.cli.cursorStoreListCheckpoints({
2744
+ cursor,
2745
+ limit: 200
2746
+ });
2747
+ if (page.items.length === 0) break;
2748
+ await api.cli.cursorStoreDeleteCheckpoints({
2749
+ agentIds: [...new Set(page.items.map((item) => item.agentId))],
2750
+ blobIds: page.items.map((item) => item.blobId)
2751
+ });
2752
+ if (!page.nextCursor) break;
2753
+ cursor = page.nextCursor;
2754
+ }
2755
+ },
2756
+ async list(input) {
2757
+ const page = await api.cli.cursorStoreListCheckpoints({
2758
+ agentIds: input?.filter?.agentIds ? [...input.filter.agentIds] : void 0,
2759
+ blobIds: input?.filter?.blobIds ? [...input.filter.blobIds] : void 0,
2760
+ cursor: input?.filter?.cursor,
2761
+ limit: input?.filter?.limit
2762
+ });
2763
+ return {
2764
+ items: page.items.map((item) => item.blobId),
2765
+ ...page.nextCursor ? { nextCursor: page.nextCursor } : {}
2766
+ };
2767
+ }
2768
+ }
2769
+ };
2770
+ }
2771
+
2388
2772
  // src/commands/connect/cursor-agent.ts
2389
2773
  var noopRemoteLogSync = {
2390
2774
  schedule(_session) {
@@ -2406,11 +2790,13 @@ function formatCursorRunFailure(runId, options) {
2406
2790
  return `Cursor run \u5931\u8D25: ${runId} \u2014 ${details.join("\uFF1B")}`;
2407
2791
  }
2408
2792
  async function obtainAgent(ctx) {
2793
+ const store = createRemoteLocalAgentStore(ctx.cfg);
2409
2794
  const agentOptions = {
2410
2795
  apiKey: ctx.apiKey,
2411
2796
  model: { id: ctx.model || "default" },
2412
2797
  local: {
2413
2798
  cwd: ctx.cwd,
2799
+ store,
2414
2800
  ...ctx.customTools ? { customTools: ctx.customTools } : {},
2415
2801
  ...ctx.enableSandbox ? {
2416
2802
  sandboxOptions: { enabled: true },
@@ -2481,6 +2867,7 @@ async function runCursorAgent(cfg2, ctx, options) {
2481
2867
  `[apm] Cursor Agent \u5F00\u59CB messageId=${ctx.messageId} cwd=${workdir} sandbox=${enableSandbox}`
2482
2868
  );
2483
2869
  const { agent, resumed } = await obtainAgent({
2870
+ cfg: cfg2,
2484
2871
  apiKey,
2485
2872
  model: ctx.model,
2486
2873
  cwd: workdir,
@@ -3681,48 +4068,34 @@ function clearWebIdeDesignAgentId(workdir, taskId) {
3681
4068
  // src/commands/clean-webide-cache.ts
3682
4069
  import { existsSync as existsSync8, rmSync as rmSync2 } from "node:fs";
3683
4070
  import { resolve as resolve7 } from "node:path";
3684
- import { getDefaultSdkStateRoot } from "@cursor/sdk";
3685
- async function purgeCursorAgentStoreForAgent(workdir, agentId) {
4071
+ async function purgeCursorAgentStoreForAgent(cfg2, agentId) {
3686
4072
  const trimmedAgentId = agentId.trim();
3687
- const trimmedWorkdir = workdir.trim();
3688
- if (!trimmedAgentId || !trimmedWorkdir) return false;
3689
- const stateRoot = getDefaultSdkStateRoot(trimmedWorkdir);
3690
- if (!existsSync8(stateRoot)) return false;
3691
- const { SqliteLocalAgentStore } = await import(
3692
- /* @vite-ignore */
3693
- "@cursor/sdk/sqlite"
3694
- );
3695
- const store = await SqliteLocalAgentStore.open({
3696
- workspaceRef: trimmedWorkdir
3697
- });
3698
- try {
3699
- const runIds = [];
3700
- let cursor;
3701
- do {
3702
- const page = await store.runs.list({
3703
- filter: {
3704
- agentIds: [trimmedAgentId],
3705
- ...cursor ? { cursor } : {},
3706
- limit: 200
3707
- }
3708
- });
3709
- for (const run of page.items) {
3710
- runIds.push(run.runId);
4073
+ if (!trimmedAgentId) return false;
4074
+ const store = createRemoteLocalAgentStore(cfg2);
4075
+ const runIds = [];
4076
+ let cursor;
4077
+ do {
4078
+ const page = await store.runs.list({
4079
+ filter: {
4080
+ agentIds: [trimmedAgentId],
4081
+ ...cursor ? { cursor } : {},
4082
+ limit: 200
3711
4083
  }
3712
- cursor = page.nextCursor;
3713
- } while (cursor);
3714
- if (runIds.length > 0) {
3715
- await store.runEvents.delete({ filter: { runIds } });
4084
+ });
4085
+ for (const run of page.items) {
4086
+ runIds.push(run.runId);
3716
4087
  }
3717
- await store.runs.delete({ filter: { agentIds: [trimmedAgentId] } });
3718
- await store.checkpoints.delete({ filter: { agentIds: [trimmedAgentId] } });
3719
- await store.agents.delete({ filter: { agentIds: [trimmedAgentId] } });
3720
- } finally {
3721
- await store.dispose();
3722
- }
4088
+ cursor = page.nextCursor;
4089
+ } while (cursor);
4090
+ if (runIds.length > 0) {
4091
+ await store.runEvents.delete({ filter: { runIds } });
4092
+ }
4093
+ await store.runs.delete({ filter: { agentIds: [trimmedAgentId] } });
4094
+ await store.checkpoints.delete({ filter: { agentIds: [trimmedAgentId] } });
4095
+ await store.agents.delete({ filter: { agentIds: [trimmedAgentId] } });
3723
4096
  return true;
3724
4097
  }
3725
- async function cleanWebIdeWorkspaceCache(taskId, workdir) {
4098
+ async function cleanWebIdeWorkspaceCache(taskId, workdir, cfg2) {
3726
4099
  const trimmedTaskId = taskId.trim();
3727
4100
  const trimmedWorkdir = workdir.trim();
3728
4101
  if (!trimmedTaskId || !trimmedWorkdir) {
@@ -3731,10 +4104,7 @@ async function cleanWebIdeWorkspaceCache(taskId, workdir) {
3731
4104
  const agentId = loadWebIdeAgentId(trimmedWorkdir, trimmedTaskId);
3732
4105
  if (agentId) {
3733
4106
  try {
3734
- const purged = await purgeCursorAgentStoreForAgent(
3735
- trimmedWorkdir,
3736
- agentId
3737
- );
4107
+ const purged = await purgeCursorAgentStoreForAgent(cfg2, agentId);
3738
4108
  if (purged) {
3739
4109
  console.log(
3740
4110
  `[apm] \u5DF2\u6E05\u7406 Cursor agent store agentId=${agentId} taskId=${trimmedTaskId}`
@@ -4925,7 +5295,7 @@ ${assumptionAnswersText}` : msg2.content,
4925
5295
  );
4926
5296
  if (msg2.action === "request-accept") {
4927
5297
  try {
4928
- await cleanWebIdeWorkspaceCache(taskId, workdir);
5298
+ await cleanWebIdeWorkspaceCache(taskId, workdir, cfg2);
4929
5299
  } catch (err) {
4930
5300
  console.warn(
4931
5301
  "[apm] \u5408\u5E76 PR \u540E\u6E05\u7406 WebIDE agent \u7F13\u5B58\u5931\u8D25:",
@@ -4948,14 +5318,9 @@ ${assumptionAnswersText}` : msg2.content,
4948
5318
  );
4949
5319
  }
4950
5320
  const completeAction = completeActionForInbound(msg2.action);
4951
- if (completeAction && !pausedForAssumptions) {
5321
+ if (completeAction === "complete-assessment" && !pausedForAssumptions) {
4952
5322
  try {
4953
- await webIdeRunAction(
4954
- cfg2,
4955
- taskId,
4956
- completeAction,
4957
- completeAction === "complete-assessment" ? { force: true } : void 0
4958
- );
5323
+ await webIdeRunAction(cfg2, taskId, completeAction, { force: true });
4959
5324
  } catch (completeErr) {
4960
5325
  console.warn(
4961
5326
  `[apm] \u5931\u8D25\u540E\u56DE\u5199 complete \u8DF3\u8FC7 action=${completeAction}:`,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ai-project-manage-cli",
3
- "version": "8.1.4",
3
+ "version": "8.1.5",
4
4
  "description": "命令行工具:后续用于调用平台后端 API 完成运维与自动化操作",
5
5
  "type": "module",
6
6
  "private": false,