3efebf8805
- agent-loop: raise repetition-detection floor to 180 chars and clear thinking replay anchors when collapsing a detected loop. - providers/google: ignore empty text parts, retain terminal thoughtSignatures, and stop function-call signatures clobbering the prior block. - autolearn: capture goal-mode at the turn boundary; harden managed-skill writes against hard-links/symlinks (O_NOFOLLOW + nlink); refuse minting managed skills whose name an authored skill already claims. - eager tasks: thread agentKind through the session so a custom top-level agentId still gets always-mode delegation; split Eager Tasks prompt into hard vs soft. - title-generator: race the online title model against a local tiny-model fallback. - eager-todo: keep the soft reminder aligned with the todo init schema. - mcp/stdio: keep close() detaching the read loop instead of awaiting it. - stream loop: fix collapsing and tool-call thought-signature handling.
48 lines
1.5 KiB
TypeScript
48 lines
1.5 KiB
TypeScript
import { afterEach, beforeEach, describe, expect, it } from "bun:test";
|
|
import * as fs from "node:fs";
|
|
import * as os from "node:os";
|
|
import * as path from "node:path";
|
|
import { buildSystemPrompt } from "@oh-my-pi/pi-coding-agent/system-prompt";
|
|
import { cleanupTempHome } from "./helpers/temp-home-cleanup";
|
|
|
|
const EMPTY_TREE = {
|
|
rootPath: "",
|
|
rendered: "",
|
|
truncated: false,
|
|
totalLines: 0,
|
|
agentsMdFiles: [],
|
|
};
|
|
|
|
describe("system prompt mathematical formatting", () => {
|
|
let tempDir = "";
|
|
let tempHomeDir = "";
|
|
let originalHome: string | undefined;
|
|
|
|
beforeEach(() => {
|
|
tempDir = fs.mkdtempSync(path.join(os.tmpdir(), "pi-prompt-math-"));
|
|
tempHomeDir = fs.mkdtempSync(path.join(os.tmpdir(), "pi-prompt-math-home-"));
|
|
originalHome = process.env.HOME;
|
|
process.env.HOME = tempHomeDir;
|
|
});
|
|
|
|
afterEach(cleanupTempHome(() => ({ tempDir, tempHomeDir, originalHome })));
|
|
|
|
it("renders mathematical formatting constraints into the system prompt", async () => {
|
|
const { systemPrompt } = await buildSystemPrompt({
|
|
cwd: tempDir,
|
|
contextFiles: [],
|
|
skills: [],
|
|
rules: [],
|
|
toolNames: [],
|
|
workspaceTree: { ...EMPTY_TREE, rootPath: tempDir },
|
|
});
|
|
|
|
const promptText = systemPrompt.join("\n\n");
|
|
expect(promptText).toContain("In user-visible terminal prose and final chat");
|
|
expect(promptText).toContain("avoid LaTeX math delimiters");
|
|
expect(promptText).toContain("LaTeX math commands");
|
|
expect(promptText).toContain("plain text / Unicode");
|
|
expect(promptText).toContain("does NOT apply to tool output");
|
|
});
|
|
});
|