@poe-platform/safe-js 0.1.0

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.
Files changed (326) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +206 -0
  3. package/dist/agent-defs/agents/claude-code.d.ts +2 -0
  4. package/dist/agent-defs/agents/claude-desktop.d.ts +2 -0
  5. package/dist/agent-defs/agents/codex.d.ts +2 -0
  6. package/dist/agent-defs/agents/cursor.d.ts +2 -0
  7. package/dist/agent-defs/agents/gemini-cli.d.ts +2 -0
  8. package/dist/agent-defs/agents/goose.d.ts +2 -0
  9. package/dist/agent-defs/agents/index.d.ts +10 -0
  10. package/dist/agent-defs/agents/kimi.d.ts +2 -0
  11. package/dist/agent-defs/agents/opencode.d.ts +2 -0
  12. package/dist/agent-defs/agents/pi.d.ts +2 -0
  13. package/dist/agent-defs/agents/poe-agent.d.ts +2 -0
  14. package/dist/agent-defs/capabilities.d.ts +14 -0
  15. package/dist/agent-defs/index.d.ts +6 -0
  16. package/dist/agent-defs/registry.d.ts +3 -0
  17. package/dist/agent-defs/specifier.d.ts +7 -0
  18. package/dist/agent-defs/types.d.ts +35 -0
  19. package/dist/agent-harness-tools/binary-exists.d.ts +10 -0
  20. package/dist/agent-harness-tools/execution-env.d.ts +108 -0
  21. package/dist/agent-harness-tools/hooks.d.ts +30 -0
  22. package/dist/agent-harness-tools/index.d.ts +18 -0
  23. package/dist/agent-harness-tools/log-stream.d.ts +28 -0
  24. package/dist/agent-harness-tools/participant.d.ts +10 -0
  25. package/dist/agent-harness-tools/paths.d.ts +14 -0
  26. package/dist/agent-harness-tools/plan-readiness.d.ts +7 -0
  27. package/dist/agent-harness-tools/plans.d.ts +35 -0
  28. package/dist/agent-harness-tools/poe-command-execution.d.ts +37 -0
  29. package/dist/agent-harness-tools/run-logs.d.ts +17 -0
  30. package/dist/agent-harness-tools/run-poe-command.d.ts +33 -0
  31. package/dist/agent-harness-tools/runner.d.ts +33 -0
  32. package/dist/agent-harness-tools/select-agent.d.ts +18 -0
  33. package/dist/agent-harness-tools/sequence.d.ts +7 -0
  34. package/dist/agent-harness-tools/skill-config.d.ts +1 -0
  35. package/dist/agent-harness-tools/stage.d.ts +22 -0
  36. package/dist/agent-harness-tools/workspace-transfer.d.ts +3 -0
  37. package/dist/agent-spawn/acp/middleware.d.ts +38 -0
  38. package/dist/agent-spawn/acp/types.d.ts +180 -0
  39. package/dist/agent-spawn/adapters/claude.d.ts +3 -0
  40. package/dist/agent-spawn/adapters/codex.d.ts +2 -0
  41. package/dist/agent-spawn/adapters/cursor.d.ts +2 -0
  42. package/dist/agent-spawn/adapters/index.d.ts +12 -0
  43. package/dist/agent-spawn/adapters/kimi.d.ts +2 -0
  44. package/dist/agent-spawn/adapters/native.d.ts +5 -0
  45. package/dist/agent-spawn/adapters/opencode.d.ts +2 -0
  46. package/dist/agent-spawn/adapters/pi.d.ts +2 -0
  47. package/dist/agent-spawn/environment.d.ts +2 -0
  48. package/dist/agent-spawn/parallel.d.ts +30 -0
  49. package/dist/agent-spawn/retry.d.ts +26 -0
  50. package/dist/agent-spawn/types.d.ts +272 -0
  51. package/dist/auth-store/create-secret-store.d.ts +2 -0
  52. package/dist/auth-store/encrypted-file-store.d.ts +47 -0
  53. package/dist/auth-store/index.d.ts +7 -0
  54. package/dist/auth-store/keychain-store.d.ts +25 -0
  55. package/dist/auth-store/provider-store.d.ts +14 -0
  56. package/dist/auth-store/types.d.ts +22 -0
  57. package/dist/config-mutations/execution/run-mutations.d.ts +7 -0
  58. package/dist/config-mutations/fs-utils.d.ts +18 -0
  59. package/dist/config-mutations/index.d.ts +8 -0
  60. package/dist/config-mutations/mutations/config-mutation.d.ts +47 -0
  61. package/dist/config-mutations/mutations/file-mutation.d.ts +62 -0
  62. package/dist/config-mutations/mutations/template-mutation.d.ts +40 -0
  63. package/dist/config-mutations/template/render.d.ts +6 -0
  64. package/dist/config-mutations/types.d.ts +168 -0
  65. package/dist/poe-code-config/compile/schema-compiler.d.ts +11 -0
  66. package/dist/poe-code-config/config.d.ts +2 -0
  67. package/dist/poe-code-config/configured-services.d.ts +29 -0
  68. package/dist/poe-code-config/index.d.ts +16 -0
  69. package/dist/poe-code-config/inspect.d.ts +13 -0
  70. package/dist/poe-code-config/memory.d.ts +14 -0
  71. package/dist/poe-code-config/merge-callbacks.d.ts +38 -0
  72. package/dist/poe-code-config/merge.d.ts +2 -0
  73. package/dist/poe-code-config/plan-scope.d.ts +8 -0
  74. package/dist/poe-code-config/provider-config.d.ts +16 -0
  75. package/dist/poe-code-config/resolve.d.ts +2 -0
  76. package/dist/poe-code-config/runtime.d.ts +114 -0
  77. package/dist/poe-code-config/schema.d.ts +14 -0
  78. package/dist/poe-code-config/state/fs.d.ts +24 -0
  79. package/dist/poe-code-config/state/index.d.ts +12 -0
  80. package/dist/poe-code-config/state/jobs.d.ts +34 -0
  81. package/dist/poe-code-config/state/templates.d.ts +18 -0
  82. package/dist/poe-code-config/store.d.ts +12 -0
  83. package/dist/poe-code-config/types.d.ts +88 -0
  84. package/dist/process-runner/docker/build-context.d.ts +5 -0
  85. package/dist/process-runner/docker/context.d.ts +3 -0
  86. package/dist/process-runner/docker/docker-execution-env.d.ts +28 -0
  87. package/dist/process-runner/docker/docker-runner.d.ts +2 -0
  88. package/dist/process-runner/docker/engine.d.ts +3 -0
  89. package/dist/process-runner/host/host-execution-env.d.ts +2 -0
  90. package/dist/process-runner/host/host-runner.d.ts +3 -0
  91. package/dist/process-runner/index.d.ts +10 -0
  92. package/dist/process-runner/testing/index.d.ts +2 -0
  93. package/dist/process-runner/testing/mock-runner.d.ts +3 -0
  94. package/dist/process-runner/types.d.ts +191 -0
  95. package/dist/process-runner/workspace-transfer.d.ts +61 -0
  96. package/dist/providers/auth/api-key.d.ts +5 -0
  97. package/dist/providers/auth/types.d.ts +14 -0
  98. package/dist/providers/compatibility.d.ts +4 -0
  99. package/dist/providers/index.d.ts +8 -0
  100. package/dist/providers/providers/anthropic.d.ts +1 -0
  101. package/dist/providers/providers/cloudflare.d.ts +1 -0
  102. package/dist/providers/providers/generated.d.ts +5 -0
  103. package/dist/providers/providers/openai.d.ts +1 -0
  104. package/dist/providers/providers/poe.d.ts +2 -0
  105. package/dist/providers/registry.d.ts +44 -0
  106. package/dist/providers/types.d.ts +54 -0
  107. package/dist/safe-fs/bridge/filesystem.d.ts +88 -0
  108. package/dist/safe-fs/bridge/index.d.ts +6 -0
  109. package/dist/safe-fs/bridge/types.d.ts +75 -0
  110. package/dist/safe-fs/config.d.ts +15 -0
  111. package/dist/safe-fs/config.node.d.ts +2 -0
  112. package/dist/safe-fs/contracts/errors.d.ts +50 -0
  113. package/dist/safe-fs/contracts/filesystem.d.ts +96 -0
  114. package/dist/safe-fs/contracts/index.d.ts +4 -0
  115. package/dist/safe-fs/contracts/io.d.ts +8 -0
  116. package/dist/safe-fs/contracts/path.d.ts +8 -0
  117. package/dist/safe-fs/contracts/portable-path.d.ts +13 -0
  118. package/dist/safe-fs/contracts/virtual-path.d.ts +7 -0
  119. package/dist/safe-fs/core.d.ts +12 -0
  120. package/dist/safe-fs/fs/memory/index.d.ts +58 -0
  121. package/dist/safe-fs/fs/mount/comparison.d.ts +19 -0
  122. package/dist/safe-fs/fs/mount/index.d.ts +44 -0
  123. package/dist/safe-fs/fs/overlay/index.d.ts +73 -0
  124. package/dist/safe-fs/fs/readonly/index.d.ts +31 -0
  125. package/dist/safe-fs/fs/real/index.d.ts +76 -0
  126. package/dist/safe-fs/fs/s3/filesystem.d.ts +93 -0
  127. package/dist/safe-fs/fs/s3/http/index.d.ts +2 -0
  128. package/dist/safe-fs/fs/s3/http/transport.d.ts +3 -0
  129. package/dist/safe-fs/fs/s3/http/types.d.ts +30 -0
  130. package/dist/safe-fs/fs/s3/index.d.ts +6 -0
  131. package/dist/safe-fs/fs/s3/mock.d.ts +48 -0
  132. package/dist/safe-fs/fs/s3/transport.d.ts +103 -0
  133. package/dist/safe-fs/fs/webdav/index.d.ts +2 -0
  134. package/dist/safe-fs/fs/webdav/webdav.d.ts +101 -0
  135. package/dist/safe-fs/index.d.ts +14 -0
  136. package/dist/safe-fs/node/filesystem.d.ts +11 -0
  137. package/dist/safe-fs/node/index.d.ts +2 -0
  138. package/dist/safe-fs/node-host.d.ts +1 -0
  139. package/dist/safe-fs/node-unavailable.d.ts +1 -0
  140. package/dist/safe-fs/platform/browser.d.ts +12 -0
  141. package/dist/safe-fs/platform/node.d.ts +13 -0
  142. package/dist/safe-js/browser/chunks/chunk-QGN6DKT5.js +4335 -0
  143. package/dist/safe-js/browser/chunks/chunk-QGN6DKT5.js.map +7 -0
  144. package/dist/safe-js/browser/safe-fs-core.js +67 -0
  145. package/dist/safe-js/browser/safe-fs-core.js.map +7 -0
  146. package/dist/safe-js/browser/safe-fs.js +67 -0
  147. package/dist/safe-js/browser/safe-fs.js.map +7 -0
  148. package/dist/safe-js/chunks/chunk-2QRYPKQQ.js +4315 -0
  149. package/dist/safe-js/chunks/chunk-2QRYPKQQ.js.map +7 -0
  150. package/dist/safe-js/chunks/chunk-4YIDX44G.js +40 -0
  151. package/dist/safe-js/chunks/chunk-4YIDX44G.js.map +7 -0
  152. package/dist/safe-js/chunks/chunk-7M2SJPSZ.js +2613 -0
  153. package/dist/safe-js/chunks/chunk-7M2SJPSZ.js.map +7 -0
  154. package/dist/safe-js/chunks/chunk-DC5B3GYM.js +8248 -0
  155. package/dist/safe-js/chunks/chunk-DC5B3GYM.js.map +7 -0
  156. package/dist/safe-js/chunks/chunk-Z3D76J4U.js +30732 -0
  157. package/dist/safe-js/chunks/chunk-Z3D76J4U.js.map +7 -0
  158. package/dist/safe-js/cli.d.ts +36 -0
  159. package/dist/safe-js/cli.js +724 -0
  160. package/dist/safe-js/cli.js.map +7 -0
  161. package/dist/safe-js/core.d.ts +6 -0
  162. package/dist/safe-js/core.js +14 -0
  163. package/dist/safe-js/core.js.map +7 -0
  164. package/dist/safe-js/dump.d.ts +2 -0
  165. package/dist/safe-js/error/format.d.ts +15 -0
  166. package/dist/safe-js/error/shape.d.ts +28 -0
  167. package/dist/safe-js/index.d.ts +56 -0
  168. package/dist/safe-js/index.js +454 -0
  169. package/dist/safe-js/index.js.map +7 -0
  170. package/dist/safe-js/interp/arguments.d.ts +10 -0
  171. package/dist/safe-js/interp/async.d.ts +56 -0
  172. package/dist/safe-js/interp/budget.d.ts +95 -0
  173. package/dist/safe-js/interp/exceptions.d.ts +45 -0
  174. package/dist/safe-js/interp/generator.d.ts +16 -0
  175. package/dist/safe-js/interp/globals/console-json.d.ts +14 -0
  176. package/dist/safe-js/interp/host-bridge.d.ts +29 -0
  177. package/dist/safe-js/interp/host-call.d.ts +130 -0
  178. package/dist/safe-js/interp/interpreter.d.ts +63 -0
  179. package/dist/safe-js/interp/promise-replay.d.ts +70 -0
  180. package/dist/safe-js/interp/regex/compile-guard.d.ts +33 -0
  181. package/dist/safe-js/interp/regex/parse.d.ts +62 -0
  182. package/dist/safe-js/interp/scope.d.ts +43 -0
  183. package/dist/safe-js/interp/values.d.ts +136 -0
  184. package/dist/safe-js/lint/index.d.ts +38 -0
  185. package/dist/safe-js/lint/rules/AS-export-import-meta.d.ts +21 -0
  186. package/dist/safe-js/lint/rules/module-registry.d.ts +33 -0
  187. package/dist/safe-js/lint.d.ts +1 -0
  188. package/dist/safe-js/loader/extract-block.d.ts +10 -0
  189. package/dist/safe-js/loader/find-exported.d.ts +2 -0
  190. package/dist/safe-js/loader/frontmatter.d.ts +5 -0
  191. package/dist/safe-js/migrate.d.ts +33 -0
  192. package/dist/safe-js/migration-file.d.ts +55 -0
  193. package/dist/safe-js/modules/agent.d.ts +132 -0
  194. package/dist/safe-js/modules/env.d.ts +14 -0
  195. package/dist/safe-js/modules/fail.d.ts +6 -0
  196. package/dist/safe-js/modules/fs-config.d.ts +12 -0
  197. package/dist/safe-js/modules/fs.d.ts +82 -0
  198. package/dist/safe-js/modules/harness.d.ts +19 -0
  199. package/dist/safe-js/modules/log.d.ts +16 -0
  200. package/dist/safe-js/modules/mcp-transport.d.ts +26 -0
  201. package/dist/safe-js/modules/mcp.d.ts +63 -0
  202. package/dist/safe-js/modules/metric.d.ts +4 -0
  203. package/dist/safe-js/modules/registry.d.ts +16 -0
  204. package/dist/safe-js/modules/time.d.ts +12 -0
  205. package/dist/safe-js/observability/otel.d.ts +21 -0
  206. package/dist/safe-js/output-stream.d.ts +12 -0
  207. package/dist/safe-js/parse/parse-export.d.ts +36 -0
  208. package/dist/safe-js/parse/parser.d.ts +356 -0
  209. package/dist/safe-js/parse/tokenizer.d.ts +26 -0
  210. package/dist/safe-js/parse.d.ts +4 -0
  211. package/dist/safe-js/random.d.ts +9 -0
  212. package/dist/safe-js/restore.d.ts +26 -0
  213. package/dist/safe-js/run.d.ts +74 -0
  214. package/dist/safe-js/runner/run-harness.d.ts +32 -0
  215. package/dist/safe-js/safe-fs-core.js +130 -0
  216. package/dist/safe-js/safe-fs-core.js.map +7 -0
  217. package/dist/safe-js/safe-fs-node.js +94 -0
  218. package/dist/safe-js/safe-fs-node.js.map +7 -0
  219. package/dist/safe-js/safe-fs.js +94 -0
  220. package/dist/safe-js/safe-fs.js.map +7 -0
  221. package/dist/safe-js/snapshot/arguments.d.ts +17 -0
  222. package/dist/safe-js/snapshot/backend.d.ts +19 -0
  223. package/dist/safe-js/snapshot/dump-format.d.ts +7 -0
  224. package/dist/safe-js/snapshot/dump.d.ts +23 -0
  225. package/dist/safe-js/snapshot/float32array.d.ts +12 -0
  226. package/dist/safe-js/snapshot/migration.d.ts +35 -0
  227. package/dist/safe-js/snapshot/policy.d.ts +49 -0
  228. package/dist/safe-js/snapshot/replay-data.d.ts +71 -0
  229. package/dist/safe-js/snapshot/validation.d.ts +15 -0
  230. package/dist/task-list/backends/gh-issues-client.d.ts +19 -0
  231. package/dist/task-list/backends/gh-issues-sync.d.ts +46 -0
  232. package/dist/task-list/backends/gh-issues.d.ts +21 -0
  233. package/dist/task-list/index.d.ts +9 -0
  234. package/dist/task-list/move.d.ts +2 -0
  235. package/dist/task-list/open.d.ts +5 -0
  236. package/dist/task-list/state-machine.d.ts +16 -0
  237. package/dist/task-list/state.d.ts +29 -0
  238. package/dist/task-list/types.d.ts +206 -0
  239. package/dist/tiny-mcp-client/index.d.ts +662 -0
  240. package/dist/tiny-stdio-mcp-server/content/audio.d.ts +15 -0
  241. package/dist/tiny-stdio-mcp-server/content/convert.d.ts +16 -0
  242. package/dist/tiny-stdio-mcp-server/content/file-type.d.ts +11 -0
  243. package/dist/tiny-stdio-mcp-server/content/file.d.ts +28 -0
  244. package/dist/tiny-stdio-mcp-server/content/image.d.ts +15 -0
  245. package/dist/tiny-stdio-mcp-server/content/index.d.ts +7 -0
  246. package/dist/tiny-stdio-mcp-server/content/mime.d.ts +7 -0
  247. package/dist/tiny-stdio-mcp-server/content/remote.d.ts +5 -0
  248. package/dist/tiny-stdio-mcp-server/index.d.ts +9 -0
  249. package/dist/tiny-stdio-mcp-server/schema.d.ts +20 -0
  250. package/dist/tiny-stdio-mcp-server/server.d.ts +35 -0
  251. package/dist/tiny-stdio-mcp-server/types.d.ts +247 -0
  252. package/dist/toolcraft-design/acp/components.d.ts +19 -0
  253. package/dist/toolcraft-design/acp/index.d.ts +4 -0
  254. package/dist/toolcraft-design/acp/writer.d.ts +13 -0
  255. package/dist/toolcraft-design/components/browser.d.ts +15 -0
  256. package/dist/toolcraft-design/components/catalog.d.ts +26 -0
  257. package/dist/toolcraft-design/components/color.d.ts +31 -0
  258. package/dist/toolcraft-design/components/command-errors.d.ts +18 -0
  259. package/dist/toolcraft-design/components/detail-card.d.ts +22 -0
  260. package/dist/toolcraft-design/components/file-changes.d.ts +16 -0
  261. package/dist/toolcraft-design/components/help-formatter-plain.d.ts +5 -0
  262. package/dist/toolcraft-design/components/help-formatter.d.ts +50 -0
  263. package/dist/toolcraft-design/components/inspector-card.d.ts +21 -0
  264. package/dist/toolcraft-design/components/logger.d.ts +11 -0
  265. package/dist/toolcraft-design/components/resource-browser.d.ts +21 -0
  266. package/dist/toolcraft-design/components/symbols.d.ts +12 -0
  267. package/dist/toolcraft-design/components/table.d.ts +16 -0
  268. package/dist/toolcraft-design/components/template.d.ts +19 -0
  269. package/dist/toolcraft-design/components/text.d.ts +16 -0
  270. package/dist/toolcraft-design/dashboard/buffer.d.ts +25 -0
  271. package/dist/toolcraft-design/dashboard/components/footer.d.ts +8 -0
  272. package/dist/toolcraft-design/dashboard/dashboard.d.ts +20 -0
  273. package/dist/toolcraft-design/dashboard/index.d.ts +8 -0
  274. package/dist/toolcraft-design/dashboard/should-use-dashboard.d.ts +10 -0
  275. package/dist/toolcraft-design/dashboard/snapshot.d.ts +10 -0
  276. package/dist/toolcraft-design/dashboard/terminal.d.ts +37 -0
  277. package/dist/toolcraft-design/dashboard/types.d.ts +38 -0
  278. package/dist/toolcraft-design/explorer/events.d.ts +77 -0
  279. package/dist/toolcraft-design/explorer/index.d.ts +8 -0
  280. package/dist/toolcraft-design/explorer/keymap.d.ts +31 -0
  281. package/dist/toolcraft-design/explorer/runtime.d.ts +2 -0
  282. package/dist/toolcraft-design/explorer/state.d.ts +224 -0
  283. package/dist/toolcraft-design/index.d.ts +62 -0
  284. package/dist/toolcraft-design/internal/output-format.d.ts +6 -0
  285. package/dist/toolcraft-design/internal/strip-ansi.d.ts +1 -0
  286. package/dist/toolcraft-design/internal/theme-detect.d.ts +12 -0
  287. package/dist/toolcraft-design/internal/theme-state.d.ts +12 -0
  288. package/dist/toolcraft-design/prompts/index.d.ts +91 -0
  289. package/dist/toolcraft-design/prompts/interactive/cancel-symbol.d.ts +2 -0
  290. package/dist/toolcraft-design/prompts/interactive/select.d.ts +18 -0
  291. package/dist/toolcraft-design/prompts/primitives/cancel.d.ts +2 -0
  292. package/dist/toolcraft-design/prompts/primitives/intro.d.ts +1 -0
  293. package/dist/toolcraft-design/prompts/primitives/log.d.ts +18 -0
  294. package/dist/toolcraft-design/prompts/primitives/note.d.ts +1 -0
  295. package/dist/toolcraft-design/prompts/primitives/outro.d.ts +1 -0
  296. package/dist/toolcraft-design/prompts/primitives/spinner.d.ts +6 -0
  297. package/dist/toolcraft-design/prompts/theme.d.ts +11 -0
  298. package/dist/toolcraft-design/screen/screen.d.ts +40 -0
  299. package/dist/toolcraft-design/screen/style.d.ts +16 -0
  300. package/dist/toolcraft-design/static/index.d.ts +4 -0
  301. package/dist/toolcraft-design/static/menu.d.ts +11 -0
  302. package/dist/toolcraft-design/static/spinner.d.ts +14 -0
  303. package/dist/toolcraft-design/terminal/driver.d.ts +34 -0
  304. package/dist/toolcraft-design/terminal/input.d.ts +25 -0
  305. package/dist/toolcraft-design/terminal-markdown/ast.d.ts +98 -0
  306. package/dist/toolcraft-design/terminal-markdown/html-renderer.d.ts +7 -0
  307. package/dist/toolcraft-design/terminal-markdown/index.d.ts +12 -0
  308. package/dist/toolcraft-design/terminal-markdown/parser.d.ts +5 -0
  309. package/dist/toolcraft-design/terminal-markdown/plaintext-renderer.d.ts +11 -0
  310. package/dist/toolcraft-design/terminal-markdown/renderer.d.ts +7 -0
  311. package/dist/toolcraft-design/tokens/brand.d.ts +5 -0
  312. package/dist/toolcraft-design/tokens/colors.d.ts +37 -0
  313. package/dist/toolcraft-design/tokens/index.d.ts +6 -0
  314. package/dist/toolcraft-design/tokens/spacing.d.ts +6 -0
  315. package/dist/toolcraft-design/tokens/typography.d.ts +7 -0
  316. package/dist/toolcraft-design/tokens/widths.d.ts +5 -0
  317. package/dist/toolcraft-schema/index.d.ts +184 -0
  318. package/dist/toolcraft-schema/json-schema/index.d.ts +5 -0
  319. package/dist/toolcraft-schema/json-schema/types.d.ts +33 -0
  320. package/dist/toolcraft-schema/json-schema-document.d.ts +14 -0
  321. package/dist/toolcraft-schema/json.d.ts +10 -0
  322. package/dist/toolcraft-schema/oneof.d.ts +15 -0
  323. package/dist/toolcraft-schema/record.d.ts +5 -0
  324. package/dist/toolcraft-schema/union.d.ts +8 -0
  325. package/dist/toolcraft-schema/validate.d.ts +17 -0
  326. package/package.json +89 -0
@@ -0,0 +1,15 @@
1
+ import type { FileSystem, FileSystemFactory } from "./contracts/filesystem.js";
2
+ export type FileSystemConfig = {
3
+ readonly type: string;
4
+ readonly options?: Readonly<Record<string, unknown>>;
5
+ };
6
+ export type FileSystemAdapterDescriptor = {
7
+ readonly validateOptions: (options: Readonly<Record<string, unknown>>) => void;
8
+ readonly create: FileSystemFactory;
9
+ };
10
+ export type FileSystemAdapterRegistry = ReadonlyMap<string, FileSystemAdapterDescriptor>;
11
+ export declare function readConfigRecord(value: unknown, label: string, keys?: readonly string[]): Readonly<Record<string, unknown>>;
12
+ export declare function validateFileSystemConfig(value: unknown): FileSystemConfig;
13
+ export declare function createFileSystem(config: FileSystemConfig, options: {
14
+ registry: FileSystemAdapterRegistry;
15
+ }): Promise<FileSystem>;
@@ -0,0 +1,2 @@
1
+ import type { FileSystemAdapterRegistry } from "./config.js";
2
+ export declare function createNodeFileSystemAdapterRegistry(extensions?: FileSystemAdapterRegistry): FileSystemAdapterRegistry;
@@ -0,0 +1,50 @@
1
+ import type { PlatformErrno } from "#safe-fs-platform";
2
+ export type { PlatformErrno } from "#safe-fs-platform";
3
+ declare const descriptions: {
4
+ readonly EACCES: "permission denied";
5
+ readonly EAGAIN: "resource temporarily unavailable";
6
+ readonly EBADF: "bad file descriptor";
7
+ readonly EBUSY: "resource busy or locked";
8
+ readonly ECANCELED: "operation canceled";
9
+ readonly EEXIST: "file already exists";
10
+ readonly EFBIG: "file too large";
11
+ readonly EINTR: "interrupted system call";
12
+ readonly EINVAL: "invalid argument";
13
+ readonly EIO: "input/output error";
14
+ readonly EISDIR: "illegal operation on a directory";
15
+ readonly ELOOP: "too many symbolic links encountered";
16
+ readonly EMFILE: "too many open files";
17
+ readonly ENAMETOOLONG: "name too long";
18
+ readonly ENFILE: "file table overflow";
19
+ readonly ENOENT: "no such file or directory";
20
+ readonly ENOMEM: "not enough memory";
21
+ readonly ENOSPC: "no space left on device";
22
+ readonly ENOSYS: "function not implemented";
23
+ readonly ENOTDIR: "not a directory";
24
+ readonly ENOTEMPTY: "directory not empty";
25
+ readonly ENOTSUP: "operation not supported";
26
+ readonly EOPNOTSUPP: "operation not supported";
27
+ readonly EPERM: "operation not permitted";
28
+ readonly EPIPE: "broken pipe";
29
+ readonly EROFS: "read-only file system";
30
+ readonly ETIMEDOUT: "operation timed out";
31
+ readonly EXDEV: "cross-device link not permitted";
32
+ };
33
+ export type ErrnoCode = keyof typeof descriptions;
34
+ export interface FsErrorOptions extends ErrorOptions {
35
+ readonly syscall?: string;
36
+ readonly path?: string;
37
+ readonly dest?: string;
38
+ readonly message?: string;
39
+ }
40
+ export declare class FsError extends Error {
41
+ readonly code: ErrnoCode;
42
+ readonly errno: PlatformErrno;
43
+ readonly syscall?: string;
44
+ readonly path?: string;
45
+ readonly dest?: string;
46
+ constructor(code: ErrnoCode, options?: FsErrorOptions);
47
+ }
48
+ export declare function isErrnoCode(code: unknown): code is ErrnoCode;
49
+ export declare function isFsError(error: unknown, code?: ErrnoCode): error is FsError;
50
+ export declare function toFsError(error: unknown, options?: FsErrorOptions): FsError;
@@ -0,0 +1,96 @@
1
+ import type { ByteSource } from "./io.js";
2
+ export type FileType = "file" | "directory" | "symlink";
3
+ export type EntryComparison = "same" | "distinct" | "unknown";
4
+ export interface FileStat {
5
+ readonly type: FileType;
6
+ readonly size: number;
7
+ readonly allocatedBytes?: number;
8
+ readonly mode: number;
9
+ readonly mtimeMs: number;
10
+ readonly atimeMs: number;
11
+ readonly ctimeMs: number;
12
+ readonly birthtimeMs?: number;
13
+ readonly identityScope?: object | symbol;
14
+ readonly ino?: number;
15
+ readonly dev?: number;
16
+ readonly nlink?: number;
17
+ readonly uid?: number;
18
+ readonly gid?: number;
19
+ }
20
+ export interface DirectoryEntry {
21
+ readonly name: string;
22
+ readonly type: FileType;
23
+ }
24
+ export interface FileSystemCapabilities {
25
+ readonly readOnly?: boolean;
26
+ readonly symlinks?: boolean;
27
+ readonly hardlinks?: boolean;
28
+ readonly permissions?: boolean;
29
+ readonly timestamps?: boolean;
30
+ readonly atomicRename?: boolean;
31
+ readonly snapshotRmdir?: boolean;
32
+ readonly streamingRead?: boolean;
33
+ readonly streamingWrite?: boolean;
34
+ readonly [capability: string]: boolean | undefined;
35
+ }
36
+ export interface FsOptions {
37
+ readonly signal?: AbortSignal;
38
+ }
39
+ export interface ReadFileOptions extends FsOptions {
40
+ readonly maxBytes?: number;
41
+ }
42
+ export interface WriteFileOptions extends FsOptions {
43
+ readonly flag?: "w" | "wx" | "a" | "ax";
44
+ readonly mode?: number;
45
+ }
46
+ export interface AppendFileOptions extends FsOptions {
47
+ readonly mode?: number;
48
+ }
49
+ export interface MkdirOptions extends FsOptions {
50
+ readonly recursive?: boolean;
51
+ readonly mode?: number;
52
+ }
53
+ export interface RemoveOptions extends FsOptions {
54
+ readonly recursive?: boolean;
55
+ readonly force?: boolean;
56
+ }
57
+ export interface CopyFileOptions extends FsOptions {
58
+ readonly exclusive?: boolean;
59
+ }
60
+ export interface ReadStreamOptions extends FsOptions {
61
+ readonly start?: number;
62
+ readonly endExclusive?: number;
63
+ readonly chunkSize?: number;
64
+ }
65
+ export interface FileSystem {
66
+ readonly capabilities: FileSystemCapabilities;
67
+ readFile(path: string, options?: ReadFileOptions): Promise<Uint8Array>;
68
+ writeFile(path: string, data: Uint8Array, options?: WriteFileOptions): Promise<void>;
69
+ appendFile(path: string, data: Uint8Array, options?: AppendFileOptions): Promise<void>;
70
+ stat(path: string, options?: FsOptions): Promise<FileStat>;
71
+ lstat(path: string, options?: FsOptions): Promise<FileStat>;
72
+ compareEntry?(path: string, peer: FileSystem, peerPath: string, options?: FsOptions): Promise<EntryComparison>;
73
+ readdir(path: string, options?: FsOptions): Promise<DirectoryEntry[]>;
74
+ mkdir(path: string, options?: MkdirOptions): Promise<void>;
75
+ rm(path: string, options?: RemoveOptions): Promise<void>;
76
+ rmdir?(path: string, options?: FsOptions): Promise<void>;
77
+ rename(source: string, destination: string, options?: FsOptions): Promise<void>;
78
+ copyFile(source: string, destination: string, options?: CopyFileOptions): Promise<void>;
79
+ realpath(path: string, options?: FsOptions): Promise<string>;
80
+ access(path: string, mode?: number, options?: FsOptions): Promise<void>;
81
+ readlink?(path: string, options?: FsOptions): Promise<string>;
82
+ symlink?(target: string, path: string, options?: FsOptions): Promise<void>;
83
+ link?(existingPath: string, newPath: string, options?: FsOptions): Promise<void>;
84
+ chmod?(path: string, mode: number, options?: FsOptions): Promise<void>;
85
+ utimes?(path: string, atimeMs: number, mtimeMs: number, options?: FsOptions): Promise<void>;
86
+ truncate?(path: string, length?: number, options?: FsOptions): Promise<void>;
87
+ readStream?(path: string, options?: ReadStreamOptions): ByteSource;
88
+ writeStream?(path: string, source: ByteSource, options?: WriteFileOptions): Promise<void>;
89
+ }
90
+ export type FileSystemFactory = (options: Readonly<Record<string, unknown>>) => FileSystem | Promise<FileSystem>;
91
+ export declare const ACCESS_MODES: Readonly<{
92
+ F_OK: 0;
93
+ R_OK: 4;
94
+ W_OK: 2;
95
+ X_OK: 1;
96
+ }>;
@@ -0,0 +1,4 @@
1
+ export * from "./errors.js";
2
+ export * from "./filesystem.js";
3
+ export * from "./io.js";
4
+ export * from "./path.js";
@@ -0,0 +1,8 @@
1
+ export type ByteSource = AsyncIterable<Uint8Array>;
2
+ export interface CollectOptions {
3
+ readonly maxBytes: number;
4
+ readonly signal?: AbortSignal;
5
+ }
6
+ export declare function toByteSource(input: string | Uint8Array): ByteSource;
7
+ export declare function collectBytes(source: ByteSource, options: CollectOptions): Promise<Uint8Array>;
8
+ export declare function readBytes(source: ByteSource, signal?: AbortSignal): AsyncGenerator<Uint8Array>;
@@ -0,0 +1,8 @@
1
+ import { posix } from "node:path";
2
+ export { assertPathWithin, isPathWithin, normalizePath, relativePath, resolvePath, validatePath } from "./virtual-path.js";
3
+ export declare const posixPath: typeof posix;
4
+ export declare const basename: typeof posix.basename;
5
+ export declare const dirname: typeof posix.dirname;
6
+ export declare const extname: typeof posix.extname;
7
+ export declare const joinPath: typeof posix.join;
8
+ export declare const isAbsolutePath: typeof posix.isAbsolute;
@@ -0,0 +1,13 @@
1
+ import { dirname as virtualDirname } from "./virtual-path.js";
2
+ export declare function basename(path: string, suffix?: string): string;
3
+ export declare const dirname: typeof virtualDirname;
4
+ export declare function extname(path: string): string;
5
+ export declare function isAbsolutePath(path: string): boolean;
6
+ export declare function joinPath(...paths: string[]): string;
7
+ export declare const posixPath: Readonly<{
8
+ basename: typeof basename;
9
+ dirname: typeof virtualDirname;
10
+ extname: typeof extname;
11
+ join: typeof joinPath;
12
+ isAbsolute: typeof isAbsolutePath;
13
+ }>;
@@ -0,0 +1,7 @@
1
+ export declare function validatePath(path: string): void;
2
+ export declare function resolvePath(cwd: string, ...paths: string[]): string;
3
+ export declare function normalizePath(path: string, cwd?: string): string;
4
+ export declare function dirname(path: string): string;
5
+ export declare function relativePath(from: string, to: string): string;
6
+ export declare function isPathWithin(root: string, path: string): boolean;
7
+ export declare function assertPathWithin(root: string, path: string): string;
@@ -0,0 +1,12 @@
1
+ export * from "./contracts/errors.js";
2
+ export * from "./contracts/filesystem.js";
3
+ export * from "./contracts/io.js";
4
+ export { assertPathWithin, isPathWithin, normalizePath, relativePath, resolvePath, validatePath } from "./contracts/virtual-path.js";
5
+ export { basename, dirname, extname, isAbsolutePath, joinPath, posixPath } from "./contracts/portable-path.js";
6
+ export * from "./fs/memory/index.js";
7
+ export * from "./fs/readonly/index.js";
8
+ export * from "./fs/mount/index.js";
9
+ export * from "./fs/overlay/index.js";
10
+ export * from "./fs/webdav/index.js";
11
+ export * from "./bridge/index.js";
12
+ export { compareEntries } from "./fs/mount/comparison.js";
@@ -0,0 +1,58 @@
1
+ import type { AppendFileOptions, CopyFileOptions, DirectoryEntry, EntryComparison, FileStat, FileSystem, FsOptions, MkdirOptions, ReadFileOptions, ReadStreamOptions, RemoveOptions, WriteFileOptions } from "../../contracts/filesystem.js";
2
+ import type { ByteSource } from "../../contracts/io.js";
3
+ export declare class MemoryFileSystem implements FileSystem {
4
+ readonly capabilities: Readonly<{
5
+ readOnly: false;
6
+ symlinks: true;
7
+ hardlinks: true;
8
+ permissions: true;
9
+ timestamps: true;
10
+ atomicRename: true;
11
+ streamingRead: true;
12
+ streamingWrite: true;
13
+ }>;
14
+ private readonly identityScope;
15
+ private nextInode;
16
+ private readonly root;
17
+ constructor();
18
+ compareEntry(path: string, peer: FileSystem, peerPath: string, options?: FsOptions): Promise<EntryComparison>;
19
+ private metadata;
20
+ private directory;
21
+ private fail;
22
+ private validatePath;
23
+ private permission;
24
+ private mode;
25
+ private integer;
26
+ private changed;
27
+ private resolve;
28
+ private file;
29
+ private entry;
30
+ private terminalDot;
31
+ private snapshot;
32
+ private bytes;
33
+ private allocate;
34
+ private openWrite;
35
+ private append;
36
+ readFile(path: string, options?: ReadFileOptions): Promise<Uint8Array>;
37
+ writeFile(path: string, data: Uint8Array, options?: WriteFileOptions): Promise<void>;
38
+ appendFile(path: string, data: Uint8Array, options?: AppendFileOptions): Promise<void>;
39
+ stat(path: string, options?: FsOptions): Promise<FileStat>;
40
+ lstat(path: string, options?: FsOptions): Promise<FileStat>;
41
+ readdir(path: string, options?: FsOptions): Promise<DirectoryEntry[]>;
42
+ mkdir(path: string, options?: MkdirOptions): Promise<void>;
43
+ rmdir(path: string, options?: FsOptions): Promise<void>;
44
+ rm(path: string, options?: RemoveOptions): Promise<void>;
45
+ rename(source: string, destination: string, options?: FsOptions): Promise<void>;
46
+ copyFile(source: string, destination: string, options?: CopyFileOptions): Promise<void>;
47
+ realpath(path: string, options?: FsOptions): Promise<string>;
48
+ access(path: string, mode?: number, options?: FsOptions): Promise<void>;
49
+ readlink(path: string, options?: FsOptions): Promise<string>;
50
+ symlink(target: string, path: string, options?: FsOptions): Promise<void>;
51
+ link(existingPath: string, newPath: string, options?: FsOptions): Promise<void>;
52
+ chmod(path: string, mode: number, options?: FsOptions): Promise<void>;
53
+ utimes(path: string, atimeMs: number, mtimeMs: number, options?: FsOptions): Promise<void>;
54
+ truncate(path: string, length?: number, options?: FsOptions): Promise<void>;
55
+ readStream(path: string, options?: ReadStreamOptions): ByteSource;
56
+ writeStream(path: string, source: ByteSource, options?: WriteFileOptions): Promise<void>;
57
+ }
58
+ export declare function createMemoryFileSystem(): MemoryFileSystem;
@@ -0,0 +1,19 @@
1
+ import type { EntryComparison, FileStat, FileSystem, FsOptions } from "../../contracts/filesystem.js";
2
+ export interface EntryLocation {
3
+ readonly filesystem: FileSystem;
4
+ readonly path: string;
5
+ readonly readOnly?: boolean;
6
+ readonly stat?: FileStat;
7
+ }
8
+ export interface EntryView extends EntryLocation {
9
+ readonly stat: FileStat;
10
+ readonly readOnly: boolean;
11
+ }
12
+ export type EntryViewResolver = (path: string, options: FsOptions) => Promise<EntryLocation>;
13
+ export type EntryAuthority = (own: EntryView, peer: EntryView, options: FsOptions) => Promise<EntryComparison>;
14
+ export declare function assertCallbackAuthorityAllowed(): void;
15
+ export declare function registerEntryView(filesystem: FileSystem, resolver: EntryViewResolver): void;
16
+ export declare function registerEntryAuthority(filesystem: FileSystem, authority: EntryAuthority): void;
17
+ export declare function resolveEntryView(filesystem: FileSystem, path: string, options?: FsOptions): Promise<EntryView>;
18
+ export declare function compareResolvedEntries(own: EntryView, peer: EntryView, options?: FsOptions): Promise<EntryComparison>;
19
+ export declare function compareEntries(filesystem: FileSystem, path: string, peer: FileSystem, peerPath: string, options?: FsOptions): Promise<EntryComparison>;
@@ -0,0 +1,44 @@
1
+ import type { AppendFileOptions, CopyFileOptions, DirectoryEntry, FileStat, FileSystem, FileSystemCapabilities, FsOptions, MkdirOptions, ReadFileOptions, ReadStreamOptions, RemoveOptions, WriteFileOptions } from "../../contracts/filesystem.js";
2
+ import type { ByteSource } from "../../contracts/io.js";
3
+ export interface MountFileSystemOptions {
4
+ readonly root: FileSystem;
5
+ readonly mounts?: Readonly<Record<string, FileSystem>>;
6
+ }
7
+ export declare class MountFileSystem implements FileSystem {
8
+ readonly capabilities: FileSystemCapabilities;
9
+ private readonly mounts;
10
+ constructor(options: MountFileSystemOptions);
11
+ private select;
12
+ private protected;
13
+ private error;
14
+ private operation;
15
+ private components;
16
+ private lookup;
17
+ private resolve;
18
+ private mutable;
19
+ private entryPath;
20
+ private optional;
21
+ readFile(path: string, options?: ReadFileOptions): Promise<Uint8Array>;
22
+ writeFile(path: string, data: Uint8Array, options?: WriteFileOptions): Promise<void>;
23
+ appendFile(path: string, data: Uint8Array, options?: AppendFileOptions): Promise<void>;
24
+ stat(path: string, options?: FsOptions): Promise<FileStat>;
25
+ lstat(path: string, options?: FsOptions): Promise<FileStat>;
26
+ readdir(path: string, options?: FsOptions): Promise<DirectoryEntry[]>;
27
+ mkdir(path: string, options?: MkdirOptions): Promise<void>;
28
+ rmdir(path: string, options?: FsOptions): Promise<void>;
29
+ rm(path: string, options?: RemoveOptions): Promise<void>;
30
+ rename(source: string, destination: string, options?: FsOptions): Promise<void>;
31
+ copyFile(source: string, destination: string, options?: CopyFileOptions): Promise<void>;
32
+ realpath(path: string, options?: FsOptions): Promise<string>;
33
+ compareEntry(path: string, peer: FileSystem, peerPath: string, options?: FsOptions): Promise<import("../../contracts/filesystem.js").EntryComparison>;
34
+ access(path: string, mode?: number, options?: FsOptions): Promise<void>;
35
+ readlink(path: string, options?: FsOptions): Promise<string>;
36
+ symlink(target: string, path: string, options?: FsOptions): Promise<void>;
37
+ link(existingPath: string, newPath: string, options?: FsOptions): Promise<void>;
38
+ chmod(path: string, mode: number, options?: FsOptions): Promise<void>;
39
+ utimes(path: string, atimeMs: number, mtimeMs: number, options?: FsOptions): Promise<void>;
40
+ truncate(path: string, length?: number, options?: FsOptions): Promise<void>;
41
+ readStream(path: string, options?: ReadStreamOptions): ByteSource;
42
+ writeStream(path: string, source: ByteSource, options?: WriteFileOptions): Promise<void>;
43
+ }
44
+ export declare function createMountFileSystem(options: MountFileSystemOptions): MountFileSystem;
@@ -0,0 +1,73 @@
1
+ import type { ByteSource } from "../../contracts/io.js";
2
+ import type { AppendFileOptions, CopyFileOptions, DirectoryEntry, FileStat, FileSystem, FileSystemCapabilities, FsOptions, MkdirOptions, ReadFileOptions, ReadStreamOptions, RemoveOptions, WriteFileOptions } from "../../contracts/filesystem.js";
3
+ export interface OverlayFileSystemOptions {
4
+ readonly upper: FileSystem;
5
+ readonly lower: FileSystem;
6
+ readonly maxBufferBytes?: number;
7
+ }
8
+ export declare class OverlayFileSystem implements FileSystem {
9
+ #private;
10
+ readonly capabilities: FileSystemCapabilities;
11
+ private readonly maxBufferBytes;
12
+ private readonly whiteouts;
13
+ private readonly opaque;
14
+ private readonly garbage;
15
+ private readonly activeStages;
16
+ private readonly linkMetadata;
17
+ private readonly linkOrigins;
18
+ private queue;
19
+ constructor(options: OverlayFileSystemOptions);
20
+ private run;
21
+ private writable;
22
+ private permission;
23
+ private maybeStat;
24
+ private hidden;
25
+ private lowerVisible;
26
+ private lookup;
27
+ private resolve;
28
+ private linkTarget;
29
+ private movableLinkTarget;
30
+ private required;
31
+ private listing;
32
+ private bytes;
33
+ private cleanGarbage;
34
+ cleanup(options?: FsOptions): Promise<void>;
35
+ private staged;
36
+ private preserve;
37
+ private clone;
38
+ private rememberLink;
39
+ private ensureDirectory;
40
+ private copyUp;
41
+ private parent;
42
+ private makeDirectory;
43
+ private writeOptions;
44
+ private writeLocation;
45
+ private replace;
46
+ readFile(path: string, options?: ReadFileOptions): Promise<Uint8Array>;
47
+ writeFile(path: string, data: Uint8Array, options?: WriteFileOptions): Promise<void>;
48
+ appendFile(path: string, data: Uint8Array, options?: AppendFileOptions): Promise<void>;
49
+ stat(path: string, options?: FsOptions): Promise<FileStat>;
50
+ lstat(path: string, options?: FsOptions): Promise<FileStat>;
51
+ compareEntry(path: string, peer: FileSystem, peerPath: string, options?: FsOptions): Promise<import("../../contracts/filesystem.js").EntryComparison>;
52
+ readdir(path: string, options?: FsOptions): Promise<DirectoryEntry[]>;
53
+ realpath(path: string, options?: FsOptions): Promise<string>;
54
+ access(path: string, requestedMode?: number, options?: FsOptions): Promise<void>;
55
+ mkdir(path: string, options?: MkdirOptions): Promise<void>;
56
+ rmdir(path: string, options?: FsOptions): Promise<void>;
57
+ rm(path: string, options?: RemoveOptions): Promise<void>;
58
+ private materialize;
59
+ rename(source: string, destination: string, options?: FsOptions): Promise<void>;
60
+ copyFile(source: string, destination: string, options?: CopyFileOptions): Promise<void>;
61
+ readlink(path: string, options?: FsOptions): Promise<string>;
62
+ symlink(target: string, path: string, options?: FsOptions): Promise<void>;
63
+ link(_existingPath: string, newPath: string, options?: FsOptions): Promise<void>;
64
+ private metadata;
65
+ chmod(path: string, permissions: number, options?: FsOptions): Promise<void>;
66
+ utimes(path: string, atimeMs: number, mtimeMs: number, options?: FsOptions): Promise<void>;
67
+ truncate(path: string, length?: number, options?: FsOptions): Promise<void>;
68
+ readStream(path: string, options?: ReadStreamOptions): ByteSource;
69
+ private bounded;
70
+ private streamToUpper;
71
+ writeStream(path: string, source: ByteSource, options?: WriteFileOptions): Promise<void>;
72
+ }
73
+ export declare function createOverlayFileSystem(options: OverlayFileSystemOptions): OverlayFileSystem;
@@ -0,0 +1,31 @@
1
+ import type { ByteSource } from "../../contracts/io.js";
2
+ import type { AppendFileOptions, CopyFileOptions, DirectoryEntry, FileStat, FileSystem, FileSystemCapabilities, FsOptions, MkdirOptions, ReadFileOptions, ReadStreamOptions, RemoveOptions, WriteFileOptions } from "../../contracts/filesystem.js";
3
+ export declare class ReadOnlyFileSystem implements FileSystem {
4
+ #private;
5
+ constructor(filesystem: FileSystem);
6
+ get capabilities(): FileSystemCapabilities;
7
+ readFile(path: string, options?: ReadFileOptions): Promise<Uint8Array>;
8
+ stat(path: string, options?: FsOptions): Promise<FileStat>;
9
+ lstat(path: string, options?: FsOptions): Promise<FileStat>;
10
+ compareEntry(path: string, peer: FileSystem, peerPath: string, options?: FsOptions): Promise<import("../../contracts/filesystem.js").EntryComparison>;
11
+ readdir(path: string, options?: FsOptions): Promise<DirectoryEntry[]>;
12
+ realpath(path: string, options?: FsOptions): Promise<string>;
13
+ access(path: string, mode?: number, options?: FsOptions): Promise<void>;
14
+ readlink(path: string, options?: FsOptions): Promise<string>;
15
+ readStream(path: string, options?: ReadStreamOptions): ByteSource;
16
+ writeFile(path: string, _data: Uint8Array, _options?: WriteFileOptions): Promise<void>;
17
+ appendFile(path: string, _data: Uint8Array, _options?: AppendFileOptions): Promise<void>;
18
+ writeStream(path: string, _source: ByteSource, _options?: WriteFileOptions): Promise<void>;
19
+ mkdir(path: string, _options?: MkdirOptions): Promise<void>;
20
+ rm(path: string, _options?: RemoveOptions): Promise<void>;
21
+ unlink(path: string, _options?: FsOptions): Promise<void>;
22
+ rmdir(path: string, _options?: FsOptions): Promise<void>;
23
+ rename(source: string, destination: string, _options?: FsOptions): Promise<void>;
24
+ copyFile(source: string, destination: string, _options?: CopyFileOptions): Promise<void>;
25
+ symlink(target: string, path: string, _options?: FsOptions): Promise<void>;
26
+ link(existingPath: string, newPath: string, _options?: FsOptions): Promise<void>;
27
+ chmod(path: string, _mode: number, _options?: FsOptions): Promise<void>;
28
+ utimes(path: string, _atimeMs: number, _mtimeMs: number, _options?: FsOptions): Promise<void>;
29
+ truncate(path: string, _length?: number, _options?: FsOptions): Promise<void>;
30
+ }
31
+ export declare function createReadOnlyFileSystem(filesystem: FileSystem): ReadOnlyFileSystem;
@@ -0,0 +1,76 @@
1
+ import type { AppendFileOptions, ByteSource, CopyFileOptions, DirectoryEntry, FileStat, FileSystem, FileSystemCapabilities, FsOptions, MkdirOptions, ReadFileOptions, ReadStreamOptions, RemoveOptions, WriteFileOptions } from "../../contracts/index.js";
2
+ export interface RealFileSystemOptions {
3
+ /** An existing, absolute host directory. It is never created implicitly. */
4
+ readonly root: string;
5
+ }
6
+ /**
7
+ * Async byte filesystem for trusted POSIX hosts (Windows is unsupported).
8
+ * Both relative and absolute input paths are virtual POSIX paths rooted at `/`;
9
+ * components resolve in order, following symlinks before subsequent `..` and
10
+ * preserving trailing directory requirements. Empty paths are ENOENT. Excess
11
+ * input `..` clamps at the virtual root; symlink targets may never cross it.
12
+ * There is no process cwd dependency. The configured host root must already
13
+ * exist; its canonical location is pinned on first use or by the async factory.
14
+ *
15
+ * Absolute symlink targets created here are virtual paths, stored as rooted
16
+ * host targets without lexical normalization. Relative targets retain their
17
+ * text; safe dangling, non-directory, and looping targets may be created.
18
+ * Existing host symlinks are
19
+ * followed only when every traversed component remains beneath the root, with
20
+ * a 40-link traversal limit. Existing absolute host targets must start with the
21
+ * canonical root, not a different host alias of that root. lstat, removal, and
22
+ * rename inspect or modify a final symlink itself rather than its target. Absolute readlink results are
23
+ * translated back into virtual paths; external absolute targets are refused.
24
+ *
25
+ * SECURITY LIMIT: containment checks and subsequent Node path operations are
26
+ * not atomic. O_NOFOLLOW narrows final-file open races, but ancestor swaps,
27
+ * concurrent renames, mount changes, and preexisting hardlinks cannot be made
28
+ * safe by these APIs. This is NOT a race-proof sandbox or an isolation boundary
29
+ * against another process modifying the tree. Use an OS sandbox for that.
30
+ *
31
+ * Only regular files, directories, and symlinks are represented. Permissions,
32
+ * ownership, timestamp precision, case sensitivity, umask, and rename behavior
33
+ * are those of the host filesystem. Copy is not atomic; rename can fail EXDEV.
34
+ * Cancellation is cooperative between operations/chunks, not rollback: failed
35
+ * or canceled writes/copies may leave partial data. No native commands execute.
36
+ * Destructive rm/rename operands ending in `.` or `..` are refused with EINVAL,
37
+ * including native recursive-rm edge cases that could otherwise delete content.
38
+ * Public filesystem errors carry only virtual operands; native causes are
39
+ * intentionally omitted so host paths cannot escape through nested errors.
40
+ */
41
+ export declare class RealFileSystem implements FileSystem {
42
+ readonly capabilities: FileSystemCapabilities;
43
+ private readonly configuredRoot;
44
+ private rootPromise;
45
+ constructor(options: RealFileSystemOptions | string);
46
+ private root;
47
+ private absoluteTarget;
48
+ private walk;
49
+ private path;
50
+ private operation;
51
+ private protectRoot;
52
+ private protectTerminal;
53
+ readFile(path: string, options?: ReadFileOptions): Promise<Uint8Array>;
54
+ writeFile(path: string, data: Uint8Array, options?: WriteFileOptions): Promise<void>;
55
+ appendFile(path: string, data: Uint8Array, options?: AppendFileOptions): Promise<void>;
56
+ stat(path: string, options?: FsOptions): Promise<FileStat>;
57
+ lstat(path: string, options?: FsOptions): Promise<FileStat>;
58
+ readdir(path: string, options?: FsOptions): Promise<DirectoryEntry[]>;
59
+ mkdir(path: string, options?: MkdirOptions): Promise<void>;
60
+ rmdir(path: string, options?: FsOptions): Promise<void>;
61
+ rm(path: string, options?: RemoveOptions): Promise<void>;
62
+ rename(source: string, destination: string, options?: FsOptions): Promise<void>;
63
+ copyFile(source: string, destination: string, options?: CopyFileOptions): Promise<void>;
64
+ realpath(path: string, options?: FsOptions): Promise<string>;
65
+ access(path: string, mode?: number, options?: FsOptions): Promise<void>;
66
+ readlink(path: string, options?: FsOptions): Promise<string>;
67
+ symlink(target: string, path: string, options?: FsOptions): Promise<void>;
68
+ link(existingPath: string, newPath: string, options?: FsOptions): Promise<void>;
69
+ chmod(path: string, mode: number, options?: FsOptions): Promise<void>;
70
+ utimes(path: string, atimeMs: number, mtimeMs: number, options?: FsOptions): Promise<void>;
71
+ truncate(path: string, length?: number, options?: FsOptions): Promise<void>;
72
+ readStream(path: string, options?: ReadStreamOptions): ByteSource;
73
+ writeStream(path: string, source: ByteSource, options?: WriteFileOptions): Promise<void>;
74
+ }
75
+ /** Construct and validate an existing root before returning the backend. */
76
+ export declare function createRealFileSystem(options: RealFileSystemOptions | string): Promise<RealFileSystem>;
@@ -0,0 +1,93 @@
1
+ import { FsError } from "../../contracts/errors.js";
2
+ import type { AppendFileOptions, CopyFileOptions, DirectoryEntry, EntryComparison, FileStat, FileSystem, FsOptions, MkdirOptions, ReadFileOptions, ReadStreamOptions, RemoveOptions, WriteFileOptions } from "../../contracts/filesystem.js";
3
+ import type { ByteSource } from "../../contracts/io.js";
4
+ import type { S3Transport } from "./transport.js";
5
+ export interface S3FileSystemOptions {
6
+ readonly transport: S3Transport;
7
+ readonly bucket: string;
8
+ readonly prefix?: string;
9
+ readonly compareEntry?: (this: FileSystem, ...args: Parameters<NonNullable<FileSystem["compareEntry"]>>) => ReturnType<NonNullable<FileSystem["compareEntry"]>>;
10
+ readonly readOnly?: boolean;
11
+ readonly allowNonAtomicRename?: boolean;
12
+ readonly pageSize?: number;
13
+ readonly maxReadBytes?: number;
14
+ readonly maxStreamBytes?: number;
15
+ readonly maxListEntries?: number;
16
+ }
17
+ export declare class S3RenameError extends FsError {
18
+ readonly phase: "copy" | "delete";
19
+ readonly copiedKeys: readonly string[];
20
+ readonly deletedKeys: readonly string[];
21
+ constructor(source: string, destination: string, phase: "copy" | "delete", copied: string[], deleted: string[], cause: FsError);
22
+ }
23
+ export declare class S3FileSystem implements FileSystem {
24
+ readonly capabilities: Readonly<{
25
+ readOnly: boolean;
26
+ symlinks: false;
27
+ hardlinks: false;
28
+ permissions: false;
29
+ timestamps: boolean;
30
+ atomicRename: false;
31
+ snapshotRmdir: true;
32
+ streamingRead: boolean;
33
+ streamingWrite: boolean;
34
+ }>;
35
+ readonly readStream?: (path: string, options?: ReadStreamOptions) => ByteSource;
36
+ readonly writeStream?: (path: string, source: ByteSource, options?: WriteFileOptions) => Promise<void>;
37
+ private readonly transport;
38
+ private readonly bucket;
39
+ private readonly prefix;
40
+ private readonly allowRename;
41
+ private readonly pageSize;
42
+ private readonly maxReadBytes;
43
+ private readonly maxStreamBytes;
44
+ private readonly maxListEntries;
45
+ constructor(options: S3FileSystemOptions);
46
+ compareEntry(path: string, peer: FileSystem, peerPath: string, options?: FsOptions): Promise<EntryComparison>;
47
+ private path;
48
+ private key;
49
+ private directoryKey;
50
+ private checkAbort;
51
+ private requestOptions;
52
+ private call;
53
+ private writable;
54
+ private unsupported;
55
+ private head;
56
+ private makeStat;
57
+ private page;
58
+ private validateKey;
59
+ private validateObject;
60
+ private pages;
61
+ private inspect;
62
+ private lookup;
63
+ private requireDirectorySuffix;
64
+ stat(input: string, options?: FsOptions): Promise<FileStat>;
65
+ lstat(path: string, options?: FsOptions): Promise<FileStat>;
66
+ private body;
67
+ private get;
68
+ readFile(input: string, options?: ReadFileOptions): Promise<Uint8Array>;
69
+ private etag;
70
+ writeFile(input: string, data: Uint8Array, options?: WriteFileOptions): Promise<void>;
71
+ private writeMetadata;
72
+ appendFile(path: string, data: Uint8Array, options?: AppendFileOptions): Promise<void>;
73
+ mkdir(input: string, options?: MkdirOptions): Promise<void>;
74
+ readdir(input: string, options?: FsOptions): Promise<DirectoryEntry[]>;
75
+ private tree;
76
+ rmdir(input: string, options?: FsOptions): Promise<void>;
77
+ rm(input: string, options?: RemoveOptions): Promise<void>;
78
+ private copy;
79
+ copyFile(sourceInput: string, destinationInput: string, options?: CopyFileOptions): Promise<void>;
80
+ rename(sourceInput: string, destinationInput: string, options?: FsOptions): Promise<void>;
81
+ private copyWithPut;
82
+ realpath(input: string, options?: FsOptions): Promise<string>;
83
+ access(path: string, mode?: number, options?: FsOptions): Promise<void>;
84
+ readlink(path: string): Promise<string>;
85
+ symlink(_target: string, path: string): Promise<void>;
86
+ link(_existingPath: string, path: string): Promise<void>;
87
+ chmod(path: string, _mode: number): Promise<void>;
88
+ utimes(input: string, atimeMs: number, mtimeMs: number, options?: FsOptions): Promise<void>;
89
+ truncate(input: string, length?: number, options?: FsOptions): Promise<void>;
90
+ private streamRead;
91
+ private dispose;
92
+ private streamWrite;
93
+ }
@@ -0,0 +1,2 @@
1
+ export { createS3HttpTransport } from "./transport.js";
2
+ export type { S3HttpCredentials, S3HttpCredentialProvider, S3HttpRequestFactory, S3HttpTransportOptions } from "./types.js";
@@ -0,0 +1,3 @@
1
+ import type { S3Transport } from "../transport.js";
2
+ import type { S3HttpTransportOptions } from "./types.js";
3
+ export declare function createS3HttpTransport(options: S3HttpTransportOptions): S3Transport;