feat(pi-workflow): reuse standard agent profiles
This commit is contained in:
@@ -29,6 +29,13 @@ test("configuration defaults to concurrency 8 with immutable ceiling 32", async
|
||||
});
|
||||
assert.deepEqual(config, DEFAULT_WORKFLOW_CONFIG);
|
||||
assert.equal(config.concurrency.ceiling, MAX_CONCURRENCY);
|
||||
assert.deepEqual(config.standardAgents, {
|
||||
enabled: true,
|
||||
roles: {
|
||||
scout: ["discover"],
|
||||
worker: ["implement"],
|
||||
},
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -106,6 +113,60 @@ test("untrusted project configuration is never applied", async () => {
|
||||
});
|
||||
});
|
||||
|
||||
test("trusted configuration can replace or disable standard-agent role overlays", async () => {
|
||||
await withTempDir(async (directory) => {
|
||||
const agentDir = path.join(directory, "agent");
|
||||
await writeJson(path.join(agentDir, "pi-workflow.json"), {
|
||||
standardAgents: {
|
||||
roles: {
|
||||
"codebase-analyzer": ["discover"],
|
||||
worker: ["implement", "verify"],
|
||||
},
|
||||
},
|
||||
});
|
||||
let config = await loadWorkflowConfig({
|
||||
cwd: directory,
|
||||
agentDir,
|
||||
projectTrusted: false,
|
||||
});
|
||||
assert.deepEqual(config.standardAgents.roles, {
|
||||
"codebase-analyzer": ["discover"],
|
||||
worker: ["implement", "verify"],
|
||||
});
|
||||
|
||||
await writeJson(path.join(directory, ".pi", "pi-workflow.json"), {
|
||||
standardAgents: { enabled: false },
|
||||
});
|
||||
config = await loadWorkflowConfig({
|
||||
cwd: directory,
|
||||
agentDir,
|
||||
projectTrusted: true,
|
||||
});
|
||||
assert.equal(config.standardAgents.enabled, false);
|
||||
});
|
||||
});
|
||||
|
||||
test("invalid standard-agent names and roles fail before a run starts", async () => {
|
||||
await withTempDir(async (directory) => {
|
||||
const agentDir = path.join(directory, "agent");
|
||||
await writeJson(path.join(agentDir, "pi-workflow.json"), {
|
||||
standardAgents: { roles: { Worker: ["implement"] } },
|
||||
});
|
||||
await assert.rejects(
|
||||
loadWorkflowConfig({ cwd: directory, agentDir, projectTrusted: false }),
|
||||
/lowercase kebab case/,
|
||||
);
|
||||
|
||||
await writeJson(path.join(agentDir, "pi-workflow.json"), {
|
||||
standardAgents: { roles: { worker: ["remediate"] } },
|
||||
});
|
||||
await assert.rejects(
|
||||
loadWorkflowConfig({ cwd: directory, agentDir, projectTrusted: false }),
|
||||
/unsupported role remediate/,
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
test("configuration cannot raise ceilings or activate unaudited tools", async () => {
|
||||
await withTempDir(async (directory) => {
|
||||
const agentDir = path.join(directory, "agent");
|
||||
|
||||
Reference in New Issue
Block a user