Add streaming file APIs

This commit is contained in:
Jeremy Rose
2026-06-09 07:17:12 -07:00
parent 381f0de531
commit 5c8cfd4129
57 changed files with 3903 additions and 3 deletions
@@ -0,0 +1,14 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"description": "Close an open read handle.",
"properties": {
"handleId": {
"type": "string"
}
},
"required": [
"handleId"
],
"title": "FsReadFileCloseParams",
"type": "object"
}
@@ -0,0 +1,6 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"description": "Successful response for `fs/readFile/close`.",
"title": "FsReadFileCloseResponse",
"type": "object"
}
@@ -0,0 +1,30 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"definitions": {
"AbsolutePathBuf": {
"description": "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.",
"type": "string"
}
},
"description": "Open a file for bounded positional reads.",
"properties": {
"handleId": {
"description": "Client-supplied handle identifier scoped to this connection.",
"type": "string"
},
"path": {
"allOf": [
{
"$ref": "#/definitions/AbsolutePathBuf"
}
],
"description": "Absolute path to open."
}
},
"required": [
"handleId",
"path"
],
"title": "FsReadFileOpenParams",
"type": "object"
}
@@ -0,0 +1,17 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"description": "Successful response for `fs/readFile/open`.",
"properties": {
"maxChunkBytes": {
"description": "Maximum decoded bytes returned by one read.",
"format": "uint32",
"minimum": 0.0,
"type": "integer"
}
},
"required": [
"maxChunkBytes"
],
"title": "FsReadFileOpenResponse",
"type": "object"
}
@@ -0,0 +1,29 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"description": "Read a bounded chunk from an open file at an absolute byte offset.",
"properties": {
"handleId": {
"type": "string"
},
"maxBytes": {
"description": "Requested upper bound. Values above `maxChunkBytes` are capped.",
"format": "uint32",
"minimum": 0.0,
"type": [
"integer",
"null"
]
},
"offset": {
"format": "uint64",
"minimum": 0.0,
"type": "integer"
}
},
"required": [
"handleId",
"offset"
],
"title": "FsReadFileReadParams",
"type": "object"
}
@@ -0,0 +1,19 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"description": "Bounded bytes returned by `fs/readFile/read`.",
"properties": {
"dataBase64": {
"type": "string"
},
"eof": {
"description": "No bytes beyond this response were available at the time of the read.",
"type": "boolean"
}
},
"required": [
"dataBase64",
"eof"
],
"title": "FsReadFileReadResponse",
"type": "object"
}
@@ -0,0 +1,14 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"description": "Request metadata for an open read handle.",
"properties": {
"handleId": {
"type": "string"
}
},
"required": [
"handleId"
],
"title": "FsReadFileStatParams",
"type": "object"
}
@@ -0,0 +1,26 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"description": "Metadata for the opened file object.",
"properties": {
"createdAtMs": {
"format": "int64",
"type": "integer"
},
"modifiedAtMs": {
"format": "int64",
"type": "integer"
},
"sizeBytes": {
"format": "uint64",
"minimum": 0.0,
"type": "integer"
}
},
"required": [
"createdAtMs",
"modifiedAtMs",
"sizeBytes"
],
"title": "FsReadFileStatResponse",
"type": "object"
}
@@ -0,0 +1,14 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"description": "Close an open write handle and discard its temporary file.",
"properties": {
"handleId": {
"type": "string"
}
},
"required": [
"handleId"
],
"title": "FsWriteFileCloseParams",
"type": "object"
}
@@ -0,0 +1,6 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"description": "Successful response for `fs/writeFile/close`.",
"title": "FsWriteFileCloseResponse",
"type": "object"
}
@@ -0,0 +1,14 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"description": "Atomically publish an open write handle.",
"properties": {
"handleId": {
"type": "string"
}
},
"required": [
"handleId"
],
"title": "FsWriteFileCommitParams",
"type": "object"
}
@@ -0,0 +1,21 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"description": "Metadata returned after a successful write commit.",
"properties": {
"modifiedAtMs": {
"format": "int64",
"type": "integer"
},
"sizeBytes": {
"format": "uint64",
"minimum": 0.0,
"type": "integer"
}
},
"required": [
"modifiedAtMs",
"sizeBytes"
],
"title": "FsWriteFileCommitResponse",
"type": "object"
}
@@ -0,0 +1,30 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"definitions": {
"AbsolutePathBuf": {
"description": "A path that is guaranteed to be absolute and normalized (though it is not guaranteed to be canonicalized or exist on the filesystem).\n\nIMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set using [AbsolutePathBufGuard::new]. If no base path is set, the deserialization will fail unless the path being deserialized is already absolute.",
"type": "string"
}
},
"description": "Open a destination-local temporary file for streamed writes.",
"properties": {
"handleId": {
"description": "Client-supplied handle identifier scoped to this connection.",
"type": "string"
},
"path": {
"allOf": [
{
"$ref": "#/definitions/AbsolutePathBuf"
}
],
"description": "Absolute destination path."
}
},
"required": [
"handleId",
"path"
],
"title": "FsWriteFileOpenParams",
"type": "object"
}
@@ -0,0 +1,17 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"description": "Successful response for `fs/writeFile/open`.",
"properties": {
"maxChunkBytes": {
"description": "Maximum decoded bytes accepted by one write.",
"format": "uint32",
"minimum": 0.0,
"type": "integer"
}
},
"required": [
"maxChunkBytes"
],
"title": "FsWriteFileOpenResponse",
"type": "object"
}
@@ -0,0 +1,18 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"description": "Append one complete bounded chunk to an open write handle.",
"properties": {
"dataBase64": {
"type": "string"
},
"handleId": {
"type": "string"
}
},
"required": [
"dataBase64",
"handleId"
],
"title": "FsWriteFileWriteParams",
"type": "object"
}
@@ -0,0 +1,6 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"description": "Successful response for `fs/writeFile/write`.",
"title": "FsWriteFileWriteResponse",
"type": "object"
}