2026-02-14 18:37:15 +00:00
|
|
|
import { describe, expect, it } from "vitest";
|
2026-01-14 01:08:15 +00:00
|
|
|
import { splitSdkTools } from "./pi-embedded-runner.js";
|
2026-03-02 19:47:30 +00:00
|
|
|
import { createStubTool } from "./test-helpers/pi-tool-stubs.js";
|
2026-01-14 01:08:15 +00:00
|
|
|
|
|
|
|
|
describe("splitSdkTools", () => {
|
|
|
|
|
const tools = [
|
|
|
|
|
createStubTool("read"),
|
|
|
|
|
createStubTool("exec"),
|
|
|
|
|
createStubTool("edit"),
|
|
|
|
|
createStubTool("write"),
|
|
|
|
|
createStubTool("browser"),
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
it("routes all tools to customTools when sandboxed", () => {
|
|
|
|
|
const { builtInTools, customTools } = splitSdkTools({
|
|
|
|
|
tools,
|
|
|
|
|
sandboxEnabled: true,
|
|
|
|
|
});
|
|
|
|
|
expect(builtInTools).toEqual([]);
|
|
|
|
|
expect(customTools.map((tool) => tool.name)).toEqual([
|
|
|
|
|
"read",
|
|
|
|
|
"exec",
|
|
|
|
|
"edit",
|
|
|
|
|
"write",
|
|
|
|
|
"browser",
|
|
|
|
|
]);
|
|
|
|
|
});
|
2026-02-14 18:37:15 +00:00
|
|
|
|
2026-01-14 01:08:15 +00:00
|
|
|
it("routes all tools to customTools even when not sandboxed", () => {
|
|
|
|
|
const { builtInTools, customTools } = splitSdkTools({
|
|
|
|
|
tools,
|
|
|
|
|
sandboxEnabled: false,
|
|
|
|
|
});
|
|
|
|
|
expect(builtInTools).toEqual([]);
|
|
|
|
|
expect(customTools.map((tool) => tool.name)).toEqual([
|
|
|
|
|
"read",
|
|
|
|
|
"exec",
|
|
|
|
|
"edit",
|
|
|
|
|
"write",
|
|
|
|
|
"browser",
|
|
|
|
|
]);
|
|
|
|
|
});
|
|
|
|
|
});
|