ecb46fc72b
Document the `role` parameter in the task-tool description (both the batch and single-spawn shapes) and make tailored specialists the default rule, not the exception. Direct a recursing worker to pass a `role` for each sub-specialist. Activates the role field from #2467 for the model. Refs #2468 Op: extend
40 lines
1.4 KiB
TypeScript
40 lines
1.4 KiB
TypeScript
import { describe, expect, it } from "bun:test";
|
|
import { prompt } from "@oh-my-pi/pi-utils";
|
|
import taskDescriptionTemplate from "../../src/prompts/tools/task.md" with { type: "text" };
|
|
|
|
// Contract: the task tool description the model sees advertises the `role`
|
|
// parameter (in both the batch and flat shapes) and steers toward tailored
|
|
// specialists. Without this the `role` field added in #2467 stays dormant.
|
|
|
|
function render(batchEnabled: boolean): string {
|
|
return prompt.render(taskDescriptionTemplate, {
|
|
agents: [{ name: "explore", description: "scout", readOnly: true }],
|
|
spawningDisabled: false,
|
|
MAX_CONCURRENCY: 32,
|
|
isolationEnabled: true,
|
|
batchEnabled,
|
|
asyncEnabled: true,
|
|
ircEnabled: true,
|
|
});
|
|
}
|
|
|
|
describe("task tool description: role parameter", () => {
|
|
it("documents `role` in the batch parameter list", () => {
|
|
const out = render(true);
|
|
expect(out).toContain("`role`:");
|
|
expect(out).toMatch(/specialist identity/i);
|
|
});
|
|
|
|
it("documents `role` in the flat (single-spawn) parameter list", () => {
|
|
const out = render(false);
|
|
expect(out).toContain("`role`:");
|
|
});
|
|
|
|
it("makes tailored specialists the default, not the exception, in the rules", () => {
|
|
const out = render(true);
|
|
// Stable invariant — tailoring tied to `role` on one directive line —
|
|
// rather than the exact copy-edited wording/capitalization.
|
|
expect(out).toMatch(/tailor[^\n]*role/i);
|
|
});
|
|
});
|