feat(id): brand SessionID through Drizzle and Zod schemas (#16953)

This commit is contained in:
Kit Langton
2026-03-11 19:16:56 -04:00
committed by GitHub
parent 4e73473119
commit cb67465675
44 changed files with 226 additions and 158 deletions

View File

@@ -1,6 +1,7 @@
import { Bus } from "@/bus"
import { BusEvent } from "@/bus/bus-event"
import { Identifier } from "@/id/id"
import { SessionID } from "@/session/schema"
import { Instance } from "@/project/instance"
import { Log } from "@/util/log"
import z from "zod"
@@ -34,7 +35,7 @@ export namespace Question {
export const Request = z
.object({
id: Identifier.schema("question"),
sessionID: Identifier.schema("session"),
sessionID: SessionID.zod,
questions: z.array(Info).describe("Questions to ask"),
tool: z
.object({
@@ -65,7 +66,7 @@ export namespace Question {
Replied: BusEvent.define(
"question.replied",
z.object({
sessionID: z.string(),
sessionID: SessionID.zod,
requestID: z.string(),
answers: z.array(Answer),
}),
@@ -73,7 +74,7 @@ export namespace Question {
Rejected: BusEvent.define(
"question.rejected",
z.object({
sessionID: z.string(),
sessionID: SessionID.zod,
requestID: z.string(),
}),
),
@@ -95,7 +96,7 @@ export namespace Question {
})
export async function ask(input: {
sessionID: string
sessionID: SessionID
questions: Info[]
tool?: { messageID: string; callID: string }
}): Promise<Answer[]> {