Skip to content

Commit dc0d77e

Browse files
committed
refactor(core): migrate MessageV2 internal Cursor to Effect Schema
Tiny cleanup; Cursor is only used for paginated message queries, not on the SDK surface.
1 parent bc8ca4b commit dc0d77e

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

packages/opencode/src/session/message-v2.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -566,18 +566,20 @@ export type WithParts = {
566566
parts: Part[]
567567
}
568568

569-
const Cursor = z.object({
570-
id: MessageID.zod,
571-
time: z.number(),
569+
const Cursor = Schema.Struct({
570+
id: MessageID,
571+
time: Schema.Number,
572572
})
573-
type Cursor = z.infer<typeof Cursor>
573+
type Cursor = typeof Cursor.Type
574+
575+
const decodeCursor = Schema.decodeUnknownSync(Cursor)
574576

575577
export const cursor = {
576578
encode(input: Cursor) {
577579
return Buffer.from(JSON.stringify(input)).toString("base64url")
578580
},
579581
decode(input: string) {
580-
return Cursor.parse(JSON.parse(Buffer.from(input, "base64url").toString("utf8")))
582+
return decodeCursor(JSON.parse(Buffer.from(input, "base64url").toString("utf8")))
581583
},
582584
}
583585

0 commit comments

Comments
 (0)