Files
Agent-System/deploy/pi-agent/tests/pi-args.test.mjs
T
weichenandCursor 686f739b19 fix(pi-agent): enforce a no-tool reasoning profile
语义摘要、变更叙事和 U9 分段改为请求 reasoning。该 profile 的 argv 使用 --no-tools 且不加载搜索扩展;未知 profile 拒绝启动。文档生成仍保留读写工具。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-20 04:59:15 +00:00

41 lines
1.5 KiB
JavaScript

import assert from "node:assert/strict";
import test from "node:test";
import { buildPiLaunchArgs, reasoningArgvLeaksTools, TOOL_PROFILE_REASONING } from "../pi-args.mjs";
test("reasoning profile argv has no read, write, edit, search, or extension", () => {
const args = buildPiLaunchArgs({
toolProfile: TOOL_PROFILE_REASONING,
provider: "minimax",
model: "MiniMax-M3",
systemPromptFile: "INSTRUCTIONS.md",
extension: "/app/extensions/tavily-search.mjs",
workspaceTools: "read,write,edit,tavily_search,web_search",
});
assert.equal(args.includes("--no-tools"), true);
assert.equal(args.includes("-e"), false);
assert.equal(args.includes("--tools"), false);
assert.equal(args.includes("--approve"), false);
assert.equal(reasoningArgvLeaksTools(args), false);
});
test("default profile keeps the workspace tool list", () => {
const args = buildPiLaunchArgs({
provider: "minimax",
model: "MiniMax-M3",
extension: "/app/extensions/tavily-search.mjs",
workspaceTools: "read,write,edit,tavily_search,web_search",
});
assert.equal(args.includes("--no-tools"), false);
assert.deepEqual(args.slice(args.indexOf("--tools"), args.indexOf("--tools") + 2), [
"--tools",
"read,write,edit,tavily_search,web_search",
]);
});
test("unknown profile does not fall open", () => {
assert.throws(
() => buildPiLaunchArgs({ toolProfile: "full", provider: "minimax", model: "m" }),
(err) => err.code === "UNKNOWN_TOOL_PROFILE",
);
});