@agentforge/tools 0.16.76 → 0.16.78
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +21 -0
- package/dist/index.cjs +479 -119
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +148 -63
- package/dist/index.d.ts +148 -63
- package/dist/index.js +468 -118
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -204,6 +204,27 @@ Tools for file system operations.
|
|
|
204
204
|
- **`pathRelative`** - Get relative path
|
|
205
205
|
- **`pathNormalize`** - Normalize paths
|
|
206
206
|
|
|
207
|
+
#### Filesystem Confinement
|
|
208
|
+
|
|
209
|
+
The standalone filesystem tool exports are intentionally powerful for trusted local automation. For model-exposed tools, configure a shared policy on the factory functions so every file and directory operation uses the same allowed roots and symlink checks:
|
|
210
|
+
|
|
211
|
+
```typescript
|
|
212
|
+
import {
|
|
213
|
+
createDirectoryOperationTools,
|
|
214
|
+
createFileOperationTools,
|
|
215
|
+
createFileSystemPolicy,
|
|
216
|
+
} from '@agentforge/tools';
|
|
217
|
+
|
|
218
|
+
const policy = createFileSystemPolicy({
|
|
219
|
+
workspaceRoot: process.cwd(),
|
|
220
|
+
});
|
|
221
|
+
|
|
222
|
+
const safeFileTools = createFileOperationTools({ policy });
|
|
223
|
+
const safeDirectoryTools = createDirectoryOperationTools({ policy });
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
The policy rejects `..` traversal, resolved symlink escapes, paths outside configured roots, and recursive deletion of a configured root. Use `allowedRoots` for multiple roots. Keep the default unrestricted exports for trusted local automation only; `allowOutsideRoots: true` is an explicit privileged opt-out when a configured factory must access the wider host filesystem. The `file-exists` tool preserves its legacy result shape for successful and missing-path checks, while policy violations return `{ success: false, error }`. Detailed `directory-list` results use non-following `lstat` metadata for symlink entries under both default and confined policies.
|
|
227
|
+
|
|
207
228
|
### Utility Tools (22 tools)
|
|
208
229
|
|
|
209
230
|
General utility tools for common operations.
|