@@ -1456,8 +1456,8 @@ export type CompleteWaitpointTokenRequestBody = z.infer<typeof CompleteWaitpoint
14561456export const CreateSessionRequestBody = z . object ( {
14571457 /** Plain string discriminator — e.g. `"chat.agent"`. Not validated against an enum on the server. */
14581458 type : z . string ( ) . min ( 1 ) . max ( 64 ) ,
1459- /** User-supplied idempotency key. Unique per environment. */
1460- externalId : z . string ( ) . max ( 256 ) . optional ( ) ,
1459+ /** User-supplied idempotency key. Unique per environment. Empty strings are rejected. */
1460+ externalId : z . string ( ) . trim ( ) . min ( 1 ) . max ( 256 ) . optional ( ) ,
14611461 /** Optional pointer for task-owned session types. */
14621462 taskIdentifier : z . string ( ) . max ( 128 ) . optional ( ) ,
14631463 /** Up to 10 tags for dashboard filtering. */
@@ -1495,7 +1495,10 @@ export type RetrieveSessionResponseBody = z.infer<typeof RetrieveSessionResponse
14951495export const UpdateSessionRequestBody = z . object ( {
14961496 tags : z . array ( z . string ( ) . max ( 128 ) ) . max ( 10 ) . optional ( ) ,
14971497 metadata : z . record ( z . unknown ( ) ) . nullable ( ) . optional ( ) ,
1498- externalId : z . string ( ) . max ( 256 ) . nullable ( ) . optional ( ) ,
1498+ // Null explicitly clears the externalId; non-null values must be non-empty.
1499+ externalId : z
1500+ . union ( [ z . literal ( null ) , z . string ( ) . trim ( ) . min ( 1 ) . max ( 256 ) ] )
1501+ . optional ( ) ,
14991502} ) ;
15001503export type UpdateSessionRequestBody = z . infer < typeof UpdateSessionRequestBody > ;
15011504
@@ -1514,19 +1517,27 @@ export type SessionStatus = z.infer<typeof SessionStatus>;
15141517 * narrowing fields — both produced automatically by `zodfetchCursorPage`
15151518 * and the matching client-side search-query helper.
15161519 */
1517- export const ListSessionsQueryParams = z . object ( {
1518- "page[size]" : z . coerce . number ( ) . int ( ) . min ( 1 ) . max ( 100 ) . default ( 20 ) ,
1519- "page[after]" : z . string ( ) . optional ( ) ,
1520- "page[before]" : z . string ( ) . optional ( ) ,
1521- "filter[type]" : z . union ( [ z . string ( ) , z . array ( z . string ( ) ) ] ) . optional ( ) ,
1522- "filter[tags]" : z . union ( [ z . string ( ) , z . array ( z . string ( ) ) ] ) . optional ( ) ,
1523- "filter[taskIdentifier]" : z . union ( [ z . string ( ) , z . array ( z . string ( ) ) ] ) . optional ( ) ,
1524- "filter[externalId]" : z . string ( ) . optional ( ) ,
1525- "filter[status]" : z . union ( [ SessionStatus , z . array ( SessionStatus ) ] ) . optional ( ) ,
1526- "filter[createdAt][period]" : z . string ( ) . optional ( ) ,
1527- "filter[createdAt][from]" : z . coerce . number ( ) . int ( ) . optional ( ) ,
1528- "filter[createdAt][to]" : z . coerce . number ( ) . int ( ) . optional ( ) ,
1529- } ) ;
1520+ export const ListSessionsQueryParams = z
1521+ . object ( {
1522+ "page[size]" : z . coerce . number ( ) . int ( ) . min ( 1 ) . max ( 100 ) . default ( 20 ) ,
1523+ "page[after]" : z . string ( ) . optional ( ) ,
1524+ "page[before]" : z . string ( ) . optional ( ) ,
1525+ "filter[type]" : z . union ( [ z . string ( ) , z . array ( z . string ( ) ) ] ) . optional ( ) ,
1526+ "filter[tags]" : z . union ( [ z . string ( ) , z . array ( z . string ( ) ) ] ) . optional ( ) ,
1527+ "filter[taskIdentifier]" : z . union ( [ z . string ( ) , z . array ( z . string ( ) ) ] ) . optional ( ) ,
1528+ "filter[externalId]" : z . string ( ) . optional ( ) ,
1529+ "filter[status]" : z . union ( [ SessionStatus , z . array ( SessionStatus ) ] ) . optional ( ) ,
1530+ "filter[createdAt][period]" : z . string ( ) . optional ( ) ,
1531+ "filter[createdAt][from]" : z . coerce . number ( ) . int ( ) . optional ( ) ,
1532+ "filter[createdAt][to]" : z . coerce . number ( ) . int ( ) . optional ( ) ,
1533+ } )
1534+ . refine (
1535+ ( value ) => ! ( value [ "page[after]" ] && value [ "page[before]" ] ) ,
1536+ {
1537+ message : "Cannot pass both page[after] and page[before] on the same request" ,
1538+ path : [ "page[before]" ] ,
1539+ }
1540+ ) ;
15301541export type ListSessionsQueryParams = z . infer < typeof ListSessionsQueryParams > ;
15311542
15321543/**
0 commit comments