mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-10-29 21:07:40 +01:00
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>
21 lines
1.2 KiB
TypeScript
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");
|
|
}
|
|
});
|
|
});
|