First Release of Claw3D (#11)

Co-authored-by: iamlukethedev <iamlukethedev@users.noreply.github.com>
This commit is contained in:
Luke The Dev
2026-03-19 23:14:04 -05:00
committed by GitHub
parent 5ea96b2650
commit 4fa4f13558
431 changed files with 105438 additions and 14 deletions
+45
View File
@@ -0,0 +1,45 @@
import { describe, expect, it, vi } from "vitest";
import { writeGatewayAgentFiles } from "@/lib/gateway/agentFiles";
import type { GatewayClient } from "@/lib/gateway/GatewayClient";
describe("writeGatewayAgentFiles", () => {
it("writes each provided file to agents.files.set", async () => {
const client = {
call: vi.fn(async () => ({ ok: true })),
} as unknown as GatewayClient;
await writeGatewayAgentFiles({
client,
agentId: "agent-1",
files: {
"AGENTS.md": "# mission",
"SOUL.md": "# tone",
},
});
expect(client.call).toHaveBeenCalledTimes(2);
expect((client.call as ReturnType<typeof vi.fn>).mock.calls[0]).toEqual([
"agents.files.set",
{ agentId: "agent-1", name: "AGENTS.md", content: "# mission" },
]);
expect((client.call as ReturnType<typeof vi.fn>).mock.calls[1]).toEqual([
"agents.files.set",
{ agentId: "agent-1", name: "SOUL.md", content: "# tone" },
]);
});
it("fails fast for empty agent id", async () => {
const client = {
call: vi.fn(async () => ({ ok: true })),
} as unknown as GatewayClient;
await expect(
writeGatewayAgentFiles({
client,
agentId: " ",
files: { "AGENTS.md": "# mission" },
})
).rejects.toThrow("agentId is required.");
expect(client.call).not.toHaveBeenCalled();
});
});