Files
oh-my-pi/packages/coding-agent/test/tools/python-tool-mode.test.ts
T
can1357 79079e6ecd feat(coding-agent): added plan mode with approval workflow and tool gating
- Plan mode provides structured workflow where agents propose plans for user approval before execution.
- Added plan:// internal URL protocol for accessing plan files and injecting plan-mode context into subagent prompts.
- Added plan mode toggle shortcut and paused status indicator in status line.
- Fixed plan reference injection to properly pass workflow state to plan-mode system prompts.
- Improved autocomplete fuzzy matching to support subsequence matching for skill suggestions.
2026-01-25 19:35:26 +01:00

43 lines
1.3 KiB
TypeScript

import { describe, expect, it } from "bun:test";
import { createTools, type ToolSession } from "@oh-my-pi/pi-coding-agent/tools";
function createSession(overrides: Partial<ToolSession> = {}): ToolSession {
return {
cwd: "/tmp/test",
hasUI: false,
getSessionFile: () => null,
getSessionSpawns: () => "*",
settings: {
getImageAutoResize: () => true,
getLspFormatOnWrite: () => true,
getLspDiagnosticsOnWrite: () => true,
getLspDiagnosticsOnEdit: () => false,
getEditFuzzyMatch: () => true,
getBashInterceptorEnabled: () => true,
getBashInterceptorSimpleLsEnabled: () => true,
getBashInterceptorRules: () => [],
getPythonToolMode: () => "bash-only",
getPythonKernelMode: () => "session",
},
...overrides,
};
}
describe("createTools python fallback", () => {
it("falls back to bash when python is requested but disabled", async () => {
const previous = process.env.OMP_PYTHON_SKIP_CHECK;
process.env.OMP_PYTHON_SKIP_CHECK = "1";
const session = createSession();
const tools = await createTools(session, ["python"]);
const names = tools.map(tool => tool.name).sort();
expect(names).toEqual(["bash", "exit_plan_mode"]);
if (previous === undefined) {
delete process.env.OMP_PYTHON_SKIP_CHECK;
} else {
process.env.OMP_PYTHON_SKIP_CHECK = previous;
}
});
});