Require non-empty session ids for agent event payloads
Co-authored-by: Theo Browne <[email protected]>
This commit is contained in:
1 parent
b0113d029e
commit
dd02660502
2 files changed
+22
-2
No files matched your search
@@ -45,6 +45,16 @@ describe("outputChunkSchema", () => {
|
||||
}),
|
||||
).toThrow();
|
||||
});
|
||||
|
||||
it("rejects empty output session ids", () => {
|
||||
expect(() =>
|
||||
outputChunkSchema.parse({
|
||||
sessionId: "",
|
||||
stream: "stdout",
|
||||
data: "hello",
|
||||
}),
|
||||
).toThrow();
|
||||
});
|
||||
});
|
||||
|
||||
describe("agentWriteInputSchema", () => {
|
||||
@@ -96,4 +106,14 @@ describe("agentExitSchema", () => {
|
||||
}),
|
||||
).toThrow();
|
||||
});
|
||||
|
||||
it("rejects empty exit session ids", () => {
|
||||
expect(() =>
|
||||
agentExitSchema.parse({
|
||||
sessionId: "",
|
||||
code: 0,
|
||||
signal: null,
|
||||
}),
|
||||
).toThrow();
|
||||
});
|
||||
});
|
||||
@@ -18,13 +18,13 @@ export const agentWriteInputSchema = z
|
||||
.strict();
|
||||
|
||||
export const outputChunkSchema = z.object({
|
||||
sessionId: z.string(),
|
||||
sessionId: agentSessionIdSchema,
|
||||
stream: z.enum(["stdout", "stderr"]),
|
||||
data: z.string(),
|
||||
}).strict();
|
||||
|
||||
export const agentExitSchema = z.object({
|
||||
sessionId: z.string(),
|
||||
sessionId: agentSessionIdSchema,
|
||||
code: z.number().nullable(),
|
||||
signal: z.string().nullable(),
|
||||
}).strict();
|
||||
|
||||
Reference in new issue
Block a user