Add Beryl Agent and harness source

This commit is contained in:
2026-09-08 20:10:03 +08:00
parent 06d72d001c
commit 47cfbcd66a
70 changed files with 12558 additions and 0 deletions
@@ -0,0 +1,39 @@
import { describe, expect, it } from "vitest";
import {
ApiErrorSchema,
HarnessEventSchema,
MessageInputSchema,
ModelConnectionInputSchema,
} from "../src/index.js";
describe("shared schemas", () => {
it("validates a harness event", () =>
expect(
HarnessEventSchema.parse({
eventId: "e",
sessionId: "s",
timestamp: new Date().toISOString(),
sequence: 1,
type: "run.started",
payload: {},
}).type,
).toBe("run.started"));
it("requires message content", () =>
expect(() =>
MessageInputSchema.parse({ text: " ", attachmentIds: [] }),
).toThrow());
it("strictly validates model config", () =>
expect(() =>
ModelConnectionInputSchema.parse({
providerId: "p",
api: "bad",
modelId: "m",
supportsImages: false,
}),
).toThrow());
it("validates unified errors", () =>
expect(
ApiErrorSchema.parse({
error: { code: "X", message: "x", requestId: "r", details: {} },
}).error.code,
).toBe("X"));
});