Files
PaperClipAI/server/src/services/native-runtime/agent-instruction-tools.test.ts
T
DottaandPaperclip 5774c98d50 feat(runner): expose canonical instruction revision tools
Add native read, update, history, and restore operations with server-bound identity and revision compare-and-swap safety. Register the default catalog and API discovery paths; cover real authority authorization and exact revision restore.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-09-27 16:18:54 -05:00

21 lines
1.2 KiB
TypeScript

import { describe, expect, it } from "vitest";
import type { Db } from "@paperclipai/db";
import { PaperclipRunnerToolAuthority } from "./paperclip-runner-tool-authority.js";
const binding = { companyId: "00000000-0000-4000-8000-000000000001", agentId: "00000000-0000-4000-8000-000000000002", issueId: "00000000-0000-4000-8000-000000000003", runId: "00000000-0000-4000-8000-000000000004" };
describe("dedicated canonical instruction tools", () => {
it("advertises read, CAS update, history, and restore on ordinary native runs", () => {
const authority = new PaperclipRunnerToolAuthority({} as Db, binding);
const tools = authority.definitions();
expect(tools.map((tool) => tool.name)).toEqual(expect.arrayContaining([
"read_agent_instructions", "update_agent_instructions", "get_agent_instruction_history", "restore_agent_instructions",
]));
for (const name of ["update_agent_instructions", "restore_agent_instructions"]) {
const tool = tools.find((candidate) => candidate.name === name)!;
expect(tool.inputSchema).toMatchObject({ required: expect.arrayContaining(["baseRevisionId"]), additionalProperties: false });
expect(tool.inputSchema).not.toHaveProperty("properties.responsibleUserId");
}
});
});