feat: add bounded file byte reads
This commit is contained in:
+3
-2
@@ -85,12 +85,13 @@ Frontend bundles are mounted with a plugin-scoped API created by
|
||||
- `capabilities.list/get/has`
|
||||
- `commands.register/execute` for handlers declared in `contributes.commands`
|
||||
- `events.publish/subscribe` using the bundled frontend event bus
|
||||
- `files.list/metadata/readText/writeText/createFolder/move/trash/openExternal/showInFolder`
|
||||
- `files.list/metadata/readText/readBytes/writeText/createFolder/move/trash/openExternal/showInFolder`
|
||||
for canonical vault-relative slash paths guarded by `files.read`,
|
||||
`files.write`, `files.delete`, and `files.openExternal`. Backslashes,
|
||||
Windows absolute paths, UNC paths, traversal, `.verstak` variants, and
|
||||
symlink read/write/move/trash/external-open operations are rejected. Text
|
||||
read/write is UTF-8 only and limited to 2 MB for reads.
|
||||
read/write is UTF-8 only and limited to 2 MB for text reads; `readBytes`
|
||||
returns base64 for regular files up to 8 MB.
|
||||
- `workbench.openResource/editResource` for routing vault resources to
|
||||
contributed `openProviders`. Plugins must declare `workbench.open`; this is a
|
||||
policy/contract check. Files and Notes plugins call this API and do not import
|
||||
|
||||
@@ -437,6 +437,8 @@ contributions summary.
|
||||
- `files.list(relativeDir)` — list directory using a vault-relative path.
|
||||
- `files.metadata(relativePath)` — returns file/folder/symlink metadata.
|
||||
- `files.readText(relativePath)` — reads a UTF-8 regular file, with a size limit.
|
||||
- `files.readBytes(relativePath)` — reads a regular file up to 8 MB and returns
|
||||
`{ relativePath, size, mimeHint, dataBase64 }` for bounded binary preview use.
|
||||
- `files.writeText(relativePath, content, options)` — atomically writes text via
|
||||
temp-file-and-rename. `options.createIfMissing` and `options.overwrite`
|
||||
control conflicts.
|
||||
@@ -464,8 +466,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 is text-only for read/write in Milestone 6a. `readText` is limited
|
||||
to UTF-8 regular files up to 2 MB. Binary streaming is deferred.
|
||||
- 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.
|
||||
- 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
|
||||
@@ -540,6 +543,7 @@ bundled runtime. Это реальный runtime contract для cooperative bun
|
||||
| `api.files.list(relativeDir)` | ✅ Работает | Список vault-relative директории, `.verstak` скрыта |
|
||||
| `api.files.metadata(relativePath)` | ✅ Работает | Metadata для файла/папки/symlink без чтения содержимого |
|
||||
| `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.createFolder(relativePath)` | ✅ Работает | Создаёт vault-relative folder |
|
||||
| `api.files.move(from, to, options)` | ✅ Работает | Move file/folder с conflict и path-policy checks |
|
||||
|
||||
Reference in New Issue
Block a user