Design: source-bound tool interoperability for policy extensions
Problem
Policy extensions that coordinate work or protect managed documents currently reject AFT's same-name tool replacements because their provenance is an extension rather than a built-in. Trusting every extension with a familiar tool name or matching a filesystem path pattern would weaken those policies. AFT already delegates native internal URLs, so another transport or renamed write tool is unnecessary.
Proposed design
Add an optional, synchronous v1 binding over the host extension event bus:
- A correlated request carries version, session ID and request ID.
- A response lists actually registered tools with explicit absolute source paths and finite capabilities, plus a non-mutating
project(toolName, input, cwd)function. - Consumers compare each call's live source exactly and retain their own operation-level policy. A capability claim alone grants no permission.
- Projection reuses AFT's real argument normalizers and authoritative engine preflights for hashline/safety operations, preserving the issuing session and move destinations. Compound AST scopes use literal-first expansion; ambiguous or incomplete scopes fail closed.
- No observational tool-call hook is added, avoiding a global speculative-execution penalty. Other harnesses are unchanged.
- Worker identity remains host-envelope metadata, not an extra hashline patch argument, in preflight and apply.
This is cooperation between loaded extensions, not a security sandbox against malicious in-process code. No new runtime dependency, persisted format, host feature probe or fuzzy-path trust is proposed.
Implementation and evidence
Draft implementation: https://github.com/cortexkit/aft/pull/963
Companion consumer: https://github.com/TheOrdinaryWow/wows-omp-plugins/pull/49
The extension build/typecheck, 1105 unit tests (2 platform skips), 14 native hashline regressions and real SDK integration at host versions 18.12.5 and 18.10.4 have passed. The SDK matrix covers both load orders and both edit modes. Independent review identified compound whitespace AST scope coverage; that defect is repaired with literal-first expansion and complete-root validation, and the updated real SDK matrix passes at both host endpoints.
Approval request
Please review the public binding/projection contract and its policy boundary. This issue requests maintainer design approval; no approval is implied. The implementation PR will remain a draft until this issue receives design-approved, as required by the contribution policy. Please keep the issue open until the change ships.
Thanks for the careful design, and for the time you spent working it through with us.
We've decided not to adopt a public tool-binding interface for Pi extensions. Once published, a binding becomes a promise that other extensions build on, and our review found cases where AFT can't yet report exactly which file a call will change: a write to a native internal address through the older filePath argument, a write through a symbolic link (the link path is reported, not the file it changes), and a malformed preview answer that turns into an empty file list. We'd rather not promise exact targets we can't always deliver, so we're closing this as not planned.
Your work on PR #963 also turned up a real bug: AFT refused every hashline patch edit from a worker, because a flag the tool pipeline adds was being checked as a patch argument. We've fixed that on our side, and the fix ships in the next release. Thank you for finding it.