diff --git a/skills/rig/rig.ts b/skills/rig/rig.ts index 34ab2e0..1bf3059 100644 --- a/skills/rig/rig.ts +++ b/skills/rig/rig.ts @@ -1687,6 +1687,10 @@ function assertValidSchema(schema: Schema, agentName: string, slot: "input" | "o assertValidSchema(schema.additionalProperties, agentName, slot, `${path}.*`); return; } + if ("nullable" in schema && schema.nullable === true) { + assertValidSchema((schema as NullableSchema).inner, agentName, slot, path); + return; + } if ("properties" in schema) { for (const [key, value] of Object.entries(schema.properties) as [string, Schema][]) { assertValidSchema(value, agentName, slot, `${path}.${key}`); diff --git a/src/rig.test.ts b/src/rig.test.ts index 741323d..86ba91f 100644 --- a/src/rig.test.ts +++ b/src/rig.test.ts @@ -141,6 +141,11 @@ describe("agent", () => { name: "implicit-nested", input: s.object({ text: "go" as any }), })).toThrow(/input\.text/); + + expect(() => agent({ + name: "implicit-nullable-nested", + output: s.nullable(s.object({ score: "bad" as any })), + })).toThrow(/output\.score/); }); it("does not expose deprecated hook APIs in core", () => {