mirror of
https://bitbucket.org/siakitem/my-pi.git
synced 2026-08-28 08:35:57 +00:00
Disable bundled subagents extension
This commit is contained in:
@@ -9,38 +9,19 @@ import test from "node:test";
|
||||
const repositoryRoot = resolve(dirname(fileURLToPath(import.meta.url)), "..");
|
||||
const hasPi = spawnSync("pi", ["--version"], { encoding: "utf8" }).status === 0;
|
||||
|
||||
test("enabled subagents wrapper loads with its bundle-owned mandatory permission entry", { skip: !hasPi }, async () => {
|
||||
test("subagents source is retained but disabled in the root bundle", async () => {
|
||||
const packageJson = JSON.parse(await readFile(join(repositoryRoot, "package.json"), "utf8")) as {
|
||||
dependencies: Record<string, string>;
|
||||
files: string[];
|
||||
pi: { extensions: string[] };
|
||||
};
|
||||
assert.ok(packageJson.files.includes("pi-subagents"));
|
||||
assert.equal(packageJson.dependencies["@tintinweb/pi-subagents"], "file:./pi-subagents");
|
||||
assert.ok(
|
||||
assert.ok(packageJson.files.includes("pi-subagents"), "the bundle must retain the maintained subagents source");
|
||||
assert.equal(packageJson.dependencies["@tintinweb/pi-subagents"], undefined);
|
||||
assert.equal(
|
||||
packageJson.pi.extensions.includes("./extensions/subagents.ts"),
|
||||
"the bundle must default-load the locally maintained subagents wrapper",
|
||||
false,
|
||||
"the bundle must not default-load the disabled subagents wrapper",
|
||||
);
|
||||
|
||||
const home = await mkdtemp(join(tmpdir(), "my-pi-subagents-wrapper-load-"));
|
||||
const result = spawnSync(
|
||||
"pi",
|
||||
["--no-extensions", "-e", join(repositoryRoot, "extensions", "subagents.ts"), "--mode", "rpc"],
|
||||
{
|
||||
encoding: "utf8",
|
||||
timeout: 60_000,
|
||||
env: {
|
||||
...process.env,
|
||||
HOME: home,
|
||||
XDG_CONFIG_HOME: join(home, ".config"),
|
||||
PI_CODING_AGENT_DIR: join(home, ".pi-agent"),
|
||||
PI_OFFLINE: "1",
|
||||
},
|
||||
},
|
||||
);
|
||||
|
||||
assert.equal(result.status, 0, `${result.stdout}\n${result.stderr}`);
|
||||
assert.doesNotMatch(`${result.stdout}\n${result.stderr}`, /Failed to load extension/u);
|
||||
});
|
||||
|
||||
test("all package extensions load together without global registration conflicts", { skip: !hasPi }, async () => {
|
||||
@@ -121,8 +102,8 @@ test("all package extensions load together without global registration conflicts
|
||||
"the packed bundle must include the locally maintained notification source",
|
||||
);
|
||||
assert.equal(packageJson.dependencies["@ogulcancelik/pi-minimal-footer"], "file:./pi-minimal-footer");
|
||||
assert.equal(packageJson.dependencies["@tintinweb/pi-subagents"], "file:./pi-subagents");
|
||||
assert.ok(packageJson.pi.extensions.includes("./extensions/subagents.ts"));
|
||||
assert.equal(packageJson.dependencies["@tintinweb/pi-subagents"], undefined);
|
||||
assert.equal(packageJson.pi.extensions.includes("./extensions/subagents.ts"), false);
|
||||
assert.equal(
|
||||
packageJson.pi.extensions.some((entry) => entry.includes("pi-hermes-memory") || entry.includes("the-forge-flow")),
|
||||
false,
|
||||
|
||||
Reference in New Issue
Block a user