fix(tool-fs): leave sandbox decisions to providers and bound patch diffs

Drop the preflight sandbox fence. It derived writable roots in the local
process, so under the SSH provider it threw on remote additionalWritableRoots
and compared remote targets against local temp roots; write and edit never
fenced in the tool layer. The provider now refuses a denied operation at
commit, and a commit whose first operation failed without any change rejects
like a preflight refusal so the sandbox escalation path keeps its error code.

Classify FS_ABORTED as unknown: a cancelled remote request rejects while the
provider may still be writing, so no stat comparison can settle it. Document
that a cancelled call receives the registry's abort result like every tool.

Store no diff for creations, matching write, and bound the move source basis
by diffBasisMaxBytes so persisted metadata never holds whole files;
FsMoveOutcome.sourceBefore becomes nullable. Omit deletions from the call
preview and from result diffs without a basis instead of rendering them as
empty creations, and count distinct files in the preview title.

Reject a NUL byte beyond the read sampling window in preflight, name targets
by display path in atomic-write diagnostics, align the apply_patch guidance
with the edit wording and mention delete and move, read the stopped flag and
applied diffs tool-agnostically in the client models, skip the permission-bit
snapshot under root, list fs/delete-intent in the tool catalog, and refresh
the fs-patch description, group README, fs-sandbox summary, and ui-tool README.
This commit is contained in:
sjw1231 committed 2026-10-21 17:21:01 +08:00
1 parent 59ac56dfdd
commit 8f798da97d
186 files changed
+429 -409

No files matched your search

+1 -1
View File
@@ -93,7 +93,7 @@ const PACKAGE_LIBRARIES: Readonly<Record<string, string>> = {
'packages/util/deque': 'Zero-dependency circular deque utility.',
'packages/util/chunked-list': 'Persistent collection operations and checkpoint validation without a plugin surface.',
'packages/util/code-language': 'Zero-dependency file-extension to syntax-highlighting language table.',
'packages/fs/fs-patch': 'Pure patch parsing and path collection without plugin registration or filesystem I/O.',
'packages/fs/fs-patch': 'Pure patch parsing and hunk application without plugin registration or filesystem I/O.',
'packages/util/home-paths': 'Zero-dependency harness-home path resolver.',
'packages/util/launch-environment': 'Zero-dependency environment resolver.',
'packages/util/lazy-require': 'Caller-relative CommonJS-compatible dependency loader.',
+1 -1
View File
@@ -386,7 +386,7 @@ const TOOL_PACKAGES: ToolPackage[] = [
dir: 'tool-fs',
source: 'packages/fs/tool-fs/src/index.ts',
requires: ['ctx.workingDirectory', 'ctx.tools', 'ctx.fs', 'ctx.systemPrompt', 'ctx.attachments (image-tool registration)', 'ctx.llm + an image-capable route (image-tool execution)'],
writes: ['tool/call', 'fs/write-intent or fs/edit-intent for mutations', 'fs/observed after read presence/absence or successful file operation', 'durable attachment (read_image)', 'tool/result'],
writes: ['tool/call', 'fs/write-intent, fs/edit-intent, or fs/delete-intent for mutations', 'fs/observed after read presence/absence or successful file operation', 'durable attachment (read_image)', 'tool/result'],
async mount(ctx) {
// The catalog seam marker opts into
// the attachments-conditional image schema without attachment I/O.
@@ -30,7 +30,7 @@ interface SentenceContract {
* so an absent section cannot be mistaken for forgotten documentation.
*/
const NO_MODEL_EXPERIENCE_SECTION: Readonly<Record<string, string>> = {
'packages/fs/fs-patch': 'The pure parser only transforms caller-supplied patch text and collects paths; consumers own tools, execution, capture, and model output.',
'packages/fs/fs-patch': 'The pure library only parses caller-supplied patch text and applies hunks to text; consumers own tools, execution, capture, and model output.',
'packages/core/scope': 'The package is a model-agnostic registration and lifecycle primitive; model-facing consumers own any context selection.',
'packages/util/brand': 'The package only constructs plain string values and registers nothing model-facing.',
'packages/util/home-paths': 'The package only resolves harness-owned host paths; model-facing consumers own any rendered use.',