feat: add bounded binary file writes

This commit is contained in:
2026-06-29 10:12:26 +08:00
parent df4538532f
commit fe91784a8e
12 changed files with 240 additions and 20 deletions
+7 -3
View File
@@ -442,6 +442,9 @@ contributions summary.
- `files.writeText(relativePath, content, options)` — atomically writes text via
temp-file-and-rename. `options.createIfMissing` and `options.overwrite`
control conflicts.
- `files.writeBytes(relativePath, dataBase64, options)` — decodes a base64
payload up to 8 MB and atomically writes bytes via temp-file-and-rename.
`options.createIfMissing` and `options.overwrite` control conflicts.
- `files.createFolder(relativePath)` — creates one folder when the parent exists.
- `files.move(from, to, options)` — moves a file or folder; rejects moving a
folder into itself and conflicts unless `options.overwrite` is true.
@@ -466,9 +469,9 @@ contributions summary.
- `files.metadata` may report a final symlink as `type: "symlink"`, but
`files.list` through a symlink directory and all read/write/move/trash
operations through symlinks are forbidden in Milestone 6a.
- Files API writes are text-only. `readText` is limited to UTF-8 regular files
up to 2 MB. `readBytes` is a bounded read-only byte contract up to 8 MB;
write streaming is deferred.
- `readText` is limited to UTF-8 regular files up to 2 MB. `readBytes` and
`writeBytes` are bounded byte contracts up to 8 MB; chunked streaming is
deferred.
- Live watcher refresh is active while Verstak is running and a vault is open.
It performs an initial no-event snapshot, then publishes `file.changed` for
external creates, updates, and deletes outside `.verstak/`. It does not keep a
@@ -558,6 +561,7 @@ bundled runtime. Это реальный runtime contract для cooperative bun
| `api.files.readText(relativePath)` | ✅ Работает | Читает UTF-8 regular file до 2 MB |
| `api.files.readBytes(relativePath)` | ✅ Работает | Читает regular file до 8 MB как base64 payload |
| `api.files.writeText(relativePath, content, options)` | ✅ Работает | Atomic text write с явным create/overwrite policy |
| `api.files.writeBytes(relativePath, dataBase64, options)` | ✅ Работает | Atomic bounded byte write до 8 MB с явным create/overwrite policy |
| `api.files.createFolder(relativePath)` | ✅ Работает | Создаёт vault-relative folder |
| `api.files.move(from, to, options)` | ✅ Работает | Move file/folder с conflict и path-policy checks |
| `api.files.trash(relativePath)` | ✅ Работает | Перемещает в internal trash, permanent delete нет |