@@ -3,12 +3,18 @@ import { z } from "zod";
33// Maximum content length (50KB) to prevent excessive file sizes
44const MAX_CONTENT_LENGTH = 50 * 1024 ;
55
6+ // ISO 8601 datetime that accepts timezone offsets (+00:00) in addition to Z suffix,
7+ // for compatibility with Python and other tools that agents may use to generate timestamps
8+ function flexibleDatetime ( ) {
9+ return z . string ( ) . datetime ( { offset : true } ) ;
10+ }
11+
612export const CommitMetadataSchema = z . object ( {
713 sha : z . string ( ) . min ( 1 ) ,
814 message : z . string ( ) . optional ( ) ,
915 branch : z . string ( ) . optional ( ) ,
1016 url : z . string ( ) . url ( ) . optional ( ) ,
11- timestamp : z . string ( ) . datetime ( ) . optional ( ) ,
17+ timestamp : flexibleDatetime ( ) . optional ( ) ,
1218} ) ;
1319
1420export type CommitMetadata = z . infer < typeof CommitMetadataSchema > ;
@@ -66,10 +72,10 @@ const TaskSchemaBase = z.object({
6672 . nullable ( )
6773 . default ( null ) ,
6874 metadata : TaskMetadataSchema . default ( null ) ,
69- created_at : z . string ( ) . datetime ( ) ,
70- updated_at : z . string ( ) . datetime ( ) ,
71- started_at : z . string ( ) . datetime ( ) . nullable ( ) . default ( null ) ,
72- completed_at : z . string ( ) . datetime ( ) . nullable ( ) . default ( null ) ,
75+ created_at : flexibleDatetime ( ) ,
76+ updated_at : flexibleDatetime ( ) ,
77+ started_at : flexibleDatetime ( ) . nullable ( ) . default ( null ) ,
78+ completed_at : flexibleDatetime ( ) . nullable ( ) . default ( null ) ,
7379 // Bidirectional blocking relationships
7480 blockedBy : z . array ( z . string ( ) . min ( 1 ) ) . default ( [ ] ) , // Tasks that block this one
7581 blocks : z . array ( z . string ( ) . min ( 1 ) ) . default ( [ ] ) , // Tasks this one blocks
@@ -146,10 +152,10 @@ export const CreateTaskInputSchema = z.object({
146152 . nullable ( )
147153 . optional ( ) ,
148154 metadata : TaskMetadataSchema . optional ( ) ,
149- created_at : z . string ( ) . datetime ( ) . optional ( ) ,
150- updated_at : z . string ( ) . datetime ( ) . optional ( ) ,
151- started_at : z . string ( ) . datetime ( ) . nullable ( ) . optional ( ) ,
152- completed_at : z . string ( ) . datetime ( ) . nullable ( ) . optional ( ) ,
155+ created_at : flexibleDatetime ( ) . optional ( ) ,
156+ updated_at : flexibleDatetime ( ) . optional ( ) ,
157+ started_at : flexibleDatetime ( ) . nullable ( ) . optional ( ) ,
158+ completed_at : flexibleDatetime ( ) . nullable ( ) . optional ( ) ,
153159} ) ;
154160
155161export type CreateTaskInput = z . infer < typeof CreateTaskInputSchema > ;
@@ -179,7 +185,7 @@ export const UpdateTaskInputSchema = z.object({
179185 . nullable ( )
180186 . optional ( ) ,
181187 metadata : TaskMetadataSchema . nullable ( ) . optional ( ) ,
182- started_at : z . string ( ) . datetime ( ) . nullable ( ) . optional ( ) ,
188+ started_at : flexibleDatetime ( ) . nullable ( ) . optional ( ) ,
183189 delete : z . boolean ( ) . optional ( ) ,
184190 add_blocked_by : z . array ( z . string ( ) . min ( 1 ) ) . optional ( ) ,
185191 remove_blocked_by : z . array ( z . string ( ) . min ( 1 ) ) . optional ( ) ,
@@ -218,8 +224,8 @@ export const ArchivedTaskSchema = z.object({
218224 name : z . string ( ) . min ( 1 , "Name is required" ) ,
219225 description : z . string ( ) . default ( "" ) ,
220226 result : z . string ( ) . nullable ( ) . default ( null ) ,
221- completed_at : z . string ( ) . datetime ( ) . nullable ( ) . default ( null ) ,
222- archived_at : z . string ( ) . datetime ( ) ,
227+ completed_at : flexibleDatetime ( ) . nullable ( ) . default ( null ) ,
228+ archived_at : flexibleDatetime ( ) ,
223229 metadata : z
224230 . object ( {
225231 github : GithubMetadataSchema . optional ( ) ,
0 commit comments