ai-project-manage-cli 7.1.8 → 7.1.10

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
@@ -7039,7 +7039,11 @@ async function obtainAgent(ctx) {
7039
7039
  cwd: ctx.cwd,
7040
7040
  store: createWorkspaceLocalAgentStore(ctx.workdir),
7041
7041
  ...ctx.customTools ? { customTools: ctx.customTools } : {},
7042
- ...ctx.enableSandbox ? { sandboxOptions: { enabled: true } } : {}
7042
+ ...ctx.enableSandbox ? {
7043
+ sandboxOptions: { enabled: true },
7044
+ // 只加载项目级设置,避免 ~/.cursor/mcp.json 里需 OAuth/审批的 MCP 在无头沙箱被拒
7045
+ settingSources: ["project"]
7046
+ } : {}
7043
7047
  },
7044
7048
  ...ctx.mode ? { mode: ctx.mode } : {}
7045
7049
  // mcpServers: createPlaywrightMcpServers(),
@@ -7100,9 +7104,7 @@ async function runCursorAgent(cfg, ctx, options) {
7100
7104
  });
7101
7105
  const enableSandbox = Boolean(options?.enableSandbox);
7102
7106
  let prompt = withPlanModeToolHint(ctx.prompt, ctx.mode);
7103
- if (enableSandbox) {
7104
- prompt = withWorkspaceBoundaryHint(prompt);
7105
- }
7107
+ prompt = withWorkspaceBoundaryHint(prompt);
7106
7108
  console.log(
7107
7109
  `[apm] Cursor Agent \u5F00\u59CB messageId=${ctx.messageId} sessionId=${ctx.sessionId} cwd=${workdir} sandbox=${enableSandbox}`
7108
7110
  );
@@ -1759,7 +1759,11 @@ async function obtainAgent(ctx) {
1759
1759
  cwd: ctx.cwd,
1760
1760
  store: createWorkspaceLocalAgentStore(ctx.workdir),
1761
1761
  ...ctx.customTools ? { customTools: ctx.customTools } : {},
1762
- ...ctx.enableSandbox ? { sandboxOptions: { enabled: true } } : {}
1762
+ ...ctx.enableSandbox ? {
1763
+ sandboxOptions: { enabled: true },
1764
+ // 只加载项目级设置,避免 ~/.cursor/mcp.json 里需 OAuth/审批的 MCP 在无头沙箱被拒
1765
+ settingSources: ["project"]
1766
+ } : {}
1763
1767
  },
1764
1768
  ...ctx.mode ? { mode: ctx.mode } : {}
1765
1769
  // mcpServers: createPlaywrightMcpServers(),
@@ -1820,9 +1824,7 @@ async function runCursorAgent(cfg, ctx, options) {
1820
1824
  });
1821
1825
  const enableSandbox = Boolean(options?.enableSandbox);
1822
1826
  let prompt = withPlanModeToolHint(ctx.prompt, ctx.mode);
1823
- if (enableSandbox) {
1824
- prompt = withWorkspaceBoundaryHint(prompt);
1825
- }
1827
+ prompt = withWorkspaceBoundaryHint(prompt);
1826
1828
  console.log(
1827
1829
  `[apm] Cursor Agent \u5F00\u59CB messageId=${ctx.messageId} sessionId=${ctx.sessionId} cwd=${workdir} sandbox=${enableSandbox}`
1828
1830
  );
@@ -2597,82 +2599,6 @@ async function ensureWebIdeDraftPullRequests(cfg, taskId, workdir) {
2597
2599
  }
2598
2600
  }
2599
2601
 
2600
- // src/commands/connect/ensure-workspace-permissions.ts
2601
- import { existsSync as existsSync6, mkdirSync as mkdirSync7, readFileSync as readFileSync8, writeFileSync as writeFileSync9 } from "fs";
2602
- import { join as join8 } from "path";
2603
- var WEBIDE_MCP_ALLOWLIST = ["custom-user-tools:*"];
2604
- function parsePermissionsConfig(raw) {
2605
- try {
2606
- const parsed = JSON.parse(raw);
2607
- if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
2608
- return void 0;
2609
- }
2610
- return parsed;
2611
- } catch {
2612
- return void 0;
2613
- }
2614
- }
2615
- function mergeMcpAllowlist(existing) {
2616
- const merged = /* @__PURE__ */ new Set([
2617
- ...existing ?? [],
2618
- ...WEBIDE_MCP_ALLOWLIST
2619
- ]);
2620
- return [...merged];
2621
- }
2622
- function needsMcpAllowlistUpdate(existing) {
2623
- const current = existing ?? [];
2624
- return WEBIDE_MCP_ALLOWLIST.some((entry) => !current.includes(entry));
2625
- }
2626
- function ensureWorkspacePermissionsConfig(workdir) {
2627
- const cursorDir = toFsPath(join8(workdir, ".cursor"));
2628
- const permissionsPath = toFsPath(join8(cursorDir, "permissions.json"));
2629
- let config = {};
2630
- if (existsSync6(permissionsPath)) {
2631
- const raw = readFileSync8(permissionsPath, "utf8");
2632
- const parsed = parsePermissionsConfig(raw);
2633
- if (!parsed) {
2634
- console.warn(
2635
- `[apm] \u5DE5\u4F5C\u533A permissions.json \u65E0\u6CD5\u89E3\u6790\uFF0C\u8DF3\u8FC7\u5199\u5165\uFF1A${permissionsPath}`
2636
- );
2637
- return;
2638
- }
2639
- config = parsed;
2640
- }
2641
- if (!needsMcpAllowlistUpdate(config.mcpAllowlist)) {
2642
- return;
2643
- }
2644
- config.mcpAllowlist = mergeMcpAllowlist(config.mcpAllowlist);
2645
- mkdirSync7(cursorDir, { recursive: true });
2646
- writeFileSync9(
2647
- permissionsPath,
2648
- `${JSON.stringify(config, null, 2)}
2649
- `,
2650
- "utf8"
2651
- );
2652
- console.log(
2653
- `[apm] \u5DF2\u66F4\u65B0\u5DE5\u4F5C\u533A permissions \u914D\u7F6E\uFF08mcpAllowlist\uFF09\uFF1A${permissionsPath}`
2654
- );
2655
- }
2656
-
2657
- // src/commands/connect/ensure-workspace-sandbox.ts
2658
- import { mkdirSync as mkdirSync8, writeFileSync as writeFileSync10, existsSync as existsSync7 } from "fs";
2659
- import { join as join9 } from "path";
2660
- var DEFAULT_SANDBOX_JSON = `{
2661
- "type": "workspace_readwrite",
2662
- "networkPolicy": {
2663
- "default": "allow"
2664
- }
2665
- }
2666
- `;
2667
- function ensureWorkspaceSandboxConfig(workdir) {
2668
- const cursorDir = toFsPath(join9(workdir, ".cursor"));
2669
- const sandboxPath = toFsPath(join9(cursorDir, "sandbox.json"));
2670
- if (existsSync7(sandboxPath)) return;
2671
- mkdirSync8(cursorDir, { recursive: true });
2672
- writeFileSync10(sandboxPath, DEFAULT_SANDBOX_JSON, "utf8");
2673
- console.log(`[apm] \u5DF2\u5199\u5165\u5DE5\u4F5C\u533A sandbox \u914D\u7F6E\uFF1A${sandboxPath}`);
2674
- }
2675
-
2676
2602
  // src/commands/connect/handle-webide-message.ts
2677
2603
  async function updateStatus(cfg, messageId, status) {
2678
2604
  const api = createApmApiClient(cfg);
@@ -2701,8 +2627,6 @@ async function handleWebIdeInboundMessage(cfg, msg, signal) {
2701
2627
  if (!didInit) {
2702
2628
  assertApmGitignoredInRepo(workdir);
2703
2629
  }
2704
- ensureWorkspaceSandboxConfig(workdir);
2705
- ensureWorkspacePermissionsConfig(workdir);
2706
2630
  resolveWorkspaceRepos(workdir);
2707
2631
  if (shouldRunBranch(branchCacheKey, workdir)) {
2708
2632
  if (signal.aborted) throw new Error("\u4EFB\u52A1\u5DF2\u53D6\u6D88");
@@ -2743,7 +2667,8 @@ async function handleWebIdeInboundMessage(cfg, msg, signal) {
2743
2667
  signal
2744
2668
  }),
2745
2669
  enableWebIdePlanTools: true,
2746
- enableSandbox: true,
2670
+ // 本地 SDK sandbox 会拦截 custom-user-tools MCP,WebIDE 先关闭
2671
+ enableSandbox: false,
2747
2672
  taskId,
2748
2673
  createRemoteLogSync: (agentId) => {
2749
2674
  saveWebIdeAgentId(workdir, taskId, agentId);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ai-project-manage-cli",
3
- "version": "7.1.8",
3
+ "version": "7.1.10",
4
4
  "description": "命令行工具:后续用于调用平台后端 API 完成运维与自动化操作",
5
5
  "type": "module",
6
6
  "private": false,