ecd1554eba
- Renamed subagent completion flow from `submit_result` to `yield` across SDK tools, prompts, and docs. - Updated executor/task handling to require and parse `yield` calls, replacing legacy submit-result extraction and state flags. - Added `subagent-yield-reminder` and updated system prompts to require `yield` with `result.data` or `result.error`. - Renamed hidden-tool and registration plumbing to `yield`, including discovery helpers and renderer/test surface.
70 lines
1.6 KiB
TypeScript
70 lines
1.6 KiB
TypeScript
import { describe, expect, test } from "bun:test";
|
|
import { Effort } from "@oh-my-pi/pi-ai";
|
|
import { parseAgentFields } from "../../src/discovery/helpers";
|
|
|
|
describe("parseAgentFields", () => {
|
|
test("parses blocking from boolean frontmatter", () => {
|
|
const fields = parseAgentFields({
|
|
name: "reviewer",
|
|
description: "desc",
|
|
blocking: true,
|
|
});
|
|
|
|
expect(fields).toBeDefined();
|
|
expect(fields?.blocking).toBe(true);
|
|
});
|
|
|
|
test("parses blocking from string frontmatter", () => {
|
|
const fields = parseAgentFields({
|
|
name: "reviewer",
|
|
description: "desc",
|
|
blocking: "false",
|
|
});
|
|
|
|
expect(fields).toBeDefined();
|
|
expect(fields?.blocking).toBe(false);
|
|
});
|
|
|
|
test("ignores invalid blocking values", () => {
|
|
const fields = parseAgentFields({
|
|
name: "reviewer",
|
|
description: "desc",
|
|
blocking: "sometimes",
|
|
});
|
|
|
|
expect(fields).toBeDefined();
|
|
expect(fields?.blocking).toBeUndefined();
|
|
});
|
|
test("parses legacy thinking key", () => {
|
|
const fields = parseAgentFields({
|
|
name: "reviewer",
|
|
description: "desc",
|
|
thinking: "medium",
|
|
});
|
|
|
|
expect(fields).toBeDefined();
|
|
expect(fields?.thinkingLevel).toBe(Effort.Medium);
|
|
});
|
|
|
|
test("prefers thinking-level over legacy thinking", () => {
|
|
const fields = parseAgentFields({
|
|
name: "reviewer",
|
|
description: "desc",
|
|
thinking: "minimal",
|
|
thinkingLevel: Effort.High,
|
|
});
|
|
|
|
expect(fields?.thinkingLevel).toBe(Effort.High);
|
|
});
|
|
|
|
test("lowercases tool names", () => {
|
|
const fields = parseAgentFields({
|
|
name: "reviewer",
|
|
description: "desc",
|
|
tools: ["Read", "Grep"],
|
|
});
|
|
|
|
expect(fields?.tools).toEqual(["read", "grep", "yield"]);
|
|
});
|
|
});
|