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,5 +1,6 @@
import z from "zod"
import { Identifier } from "../id/id"
import { SessionID } from "./schema"
import { Snapshot } from "../snapshot"
import { MessageV2 } from "./message-v2"
import { Session } from "."
@@ -15,7 +16,7 @@ export namespace SessionRevert {
const log = Log.create({ service: "session.revert" })
export const RevertInput = z.object({
sessionID: Identifier.schema("session"),
sessionID: SessionID.zod,
messageID: Identifier.schema("message"),
partID: Identifier.schema("part").optional(),
})
@@ -79,7 +80,7 @@ export namespace SessionRevert {
return session
}
export async function unrevert(input: { sessionID: string }) {
export async function unrevert(input: { sessionID: SessionID }) {
log.info("unreverting", input)
SessionPrompt.assertNotBusy(input.sessionID)
const session = await Session.get(input.sessionID)