ai-project-manage-cli 7.1.8 → 7.1.9
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 +6 -4
- package/dist/webide-message-worker.js +14 -69
- package/package.json +1 -1
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 ? {
|
|
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
|
-
|
|
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 ? {
|
|
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
|
-
|
|
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,66 +2599,9 @@ 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
2602
|
// src/commands/connect/ensure-workspace-sandbox.ts
|
|
2658
|
-
import { mkdirSync as
|
|
2659
|
-
import { join as
|
|
2603
|
+
import { mkdirSync as mkdirSync7, writeFileSync as writeFileSync9, existsSync as existsSync6 } from "fs";
|
|
2604
|
+
import { join as join8 } from "path";
|
|
2660
2605
|
var DEFAULT_SANDBOX_JSON = `{
|
|
2661
2606
|
"type": "workspace_readwrite",
|
|
2662
2607
|
"networkPolicy": {
|
|
@@ -2665,11 +2610,11 @@ var DEFAULT_SANDBOX_JSON = `{
|
|
|
2665
2610
|
}
|
|
2666
2611
|
`;
|
|
2667
2612
|
function ensureWorkspaceSandboxConfig(workdir) {
|
|
2668
|
-
const cursorDir = toFsPath(
|
|
2669
|
-
const sandboxPath = toFsPath(
|
|
2670
|
-
if (
|
|
2671
|
-
|
|
2672
|
-
|
|
2613
|
+
const cursorDir = toFsPath(join8(workdir, ".cursor"));
|
|
2614
|
+
const sandboxPath = toFsPath(join8(cursorDir, "sandbox.json"));
|
|
2615
|
+
if (existsSync6(sandboxPath)) return;
|
|
2616
|
+
mkdirSync7(cursorDir, { recursive: true });
|
|
2617
|
+
writeFileSync9(sandboxPath, DEFAULT_SANDBOX_JSON, "utf8");
|
|
2673
2618
|
console.log(`[apm] \u5DF2\u5199\u5165\u5DE5\u4F5C\u533A sandbox \u914D\u7F6E\uFF1A${sandboxPath}`);
|
|
2674
2619
|
}
|
|
2675
2620
|
|
|
@@ -2702,7 +2647,6 @@ async function handleWebIdeInboundMessage(cfg, msg, signal) {
|
|
|
2702
2647
|
assertApmGitignoredInRepo(workdir);
|
|
2703
2648
|
}
|
|
2704
2649
|
ensureWorkspaceSandboxConfig(workdir);
|
|
2705
|
-
ensureWorkspacePermissionsConfig(workdir);
|
|
2706
2650
|
resolveWorkspaceRepos(workdir);
|
|
2707
2651
|
if (shouldRunBranch(branchCacheKey, workdir)) {
|
|
2708
2652
|
if (signal.aborted) throw new Error("\u4EFB\u52A1\u5DF2\u53D6\u6D88");
|
|
@@ -2743,6 +2687,7 @@ async function handleWebIdeInboundMessage(cfg, msg, signal) {
|
|
|
2743
2687
|
signal
|
|
2744
2688
|
}),
|
|
2745
2689
|
enableWebIdePlanTools: true,
|
|
2690
|
+
// sandbox:工作区 FS 硬隔离;自定义工具由 CLI createCursorCustomTools 注册
|
|
2746
2691
|
enableSandbox: true,
|
|
2747
2692
|
taskId,
|
|
2748
2693
|
createRemoteLogSync: (agentId) => {
|