@@ -112,6 +112,22 @@ const filesListCommand = z.object({
112112 payload : z . object ( { path : z . string ( ) } ) ,
113113 type : z . literal ( "FILES_LIST" ) ,
114114} ) ;
115+ const filesReadCommand = z . object ( {
116+ id : z . string ( ) . min ( 1 ) ,
117+ issuedAt : z . string ( ) . datetime ( ) ,
118+ payload : z . object ( { path : z . string ( ) . min ( 1 ) } ) ,
119+ type : z . literal ( "FILES_READ" ) ,
120+ } ) ;
121+ const filesWriteCommand = z . object ( {
122+ id : z . string ( ) . min ( 1 ) ,
123+ issuedAt : z . string ( ) . datetime ( ) ,
124+ payload : z . object ( {
125+ content : z . string ( ) ,
126+ encoding : z . enum ( [ "utf-8" , "base64" ] ) . default ( "utf-8" ) ,
127+ path : z . string ( ) . min ( 1 ) ,
128+ } ) ,
129+ type : z . literal ( "FILES_WRITE" ) ,
130+ } ) ;
115131const filesDeleteCommand = z . object ( {
116132 id : z . string ( ) . min ( 1 ) ,
117133 issuedAt : z . string ( ) . datetime ( ) ,
@@ -141,6 +157,8 @@ export const commandSchema = z.discriminatedUnion("type", [
141157 uploadBackupCommand ,
142158 fetchLogsCommand ,
143159 filesListCommand ,
160+ filesReadCommand ,
161+ filesWriteCommand ,
144162 filesDeleteCommand ,
145163 filesInstallFromUrlCommand ,
146164] ) ;
@@ -158,6 +176,16 @@ export const filesListResultSchema = z.object({
158176 path : z . string ( ) ,
159177} ) ;
160178export type FilesListResult = z . infer < typeof filesListResultSchema > ;
179+
180+ export const filesReadResultSchema = z . object ( {
181+ content : z . string ( ) ,
182+ encoding : z . enum ( [ "utf-8" , "base64" ] ) ,
183+ path : z . string ( ) ,
184+ size : z . number ( ) . int ( ) . nonnegative ( ) ,
185+ truncated : z . boolean ( ) ,
186+ } ) ;
187+ export type FilesReadResult = z . infer < typeof filesReadResultSchema > ;
188+
161189export type Command = z . infer < typeof commandSchema > ;
162190
163191export const commandEnvelopeSchema = z . object ( {
0 commit comments