@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,5 @@
1
+ export interface DockerBuildContextFile {
2
+ relativePath: string;
3
+ bytes: Buffer;
4
+ }
5
+ export declare function readDockerBuildContextFiles(buildContext: string): Promise<DockerBuildContextFile[]>;
@@ -0,0 +1,3 @@
1
+ import type { Engine } from "../types.js";
2
+ export declare function detectContext(): string | null;
3
+ export declare function buildContextArgs(engine: Engine, context: string | null): string[];
@@ -0,0 +1,28 @@
1
+ import type { DockerMount, Engine, ExecutionState, ExecutionEnvFactory, Runner } from "../types.js";
2
+ interface DockerRuntime {
3
+ type: "docker";
4
+ image?: string;
5
+ dockerfile?: string;
6
+ build_context?: string;
7
+ build_args?: Record<string, string>;
8
+ mounts?: DockerMount[];
9
+ engine?: Engine;
10
+ network?: string;
11
+ extra_args?: string[];
12
+ }
13
+ export interface BuildDockerRuntimeTemplateInput {
14
+ cwd: string;
15
+ runtime: DockerRuntime;
16
+ state?: ExecutionState;
17
+ runner?: Runner;
18
+ force?: boolean;
19
+ }
20
+ export interface BuildDockerRuntimeTemplateResult {
21
+ backend: "docker";
22
+ hash: string;
23
+ image: string;
24
+ cached: boolean;
25
+ }
26
+ export declare const dockerExecutionEnvFactory: ExecutionEnvFactory;
27
+ export declare function buildDockerRuntimeTemplate(input: BuildDockerRuntimeTemplateInput): Promise<BuildDockerRuntimeTemplateResult>;
28
+ export {};
@@ -0,0 +1,2 @@
1
+ import type { DockerRunnerOptions, Runner } from "../types.js";
2
+ export declare function createDockerRunner(options: DockerRunnerOptions): Runner;
@@ -0,0 +1,3 @@
1
+ import type { Engine } from "../types.js";
2
+ export declare function detectEngine(): Engine;
3
+ export declare function isEngineAvailable(engine: Engine): boolean;
@@ -0,0 +1,2 @@
1
+ import type { ExecutionEnvFactory } from "../types.js";
2
+ export declare const hostExecutionEnvFactory: ExecutionEnvFactory;
@@ -0,0 +1,3 @@
1
+ import type { Runner } from "../types.js";
2
+ import type { HostRunnerOptions } from "../types.js";
3
+ export declare function createHostRunner(options?: HostRunnerOptions): Runner;
@@ -0,0 +1,10 @@
1
+ export { buildContextArgs, detectContext } from "./docker/context.js";
2
+ export { readDockerBuildContextFiles, type DockerBuildContextFile } from "./docker/build-context.js";
3
+ export { detectEngine, isEngineAvailable } from "./docker/engine.js";
4
+ export { createDockerRunner } from "./docker/docker-runner.js";
5
+ export { buildDockerRuntimeTemplate, dockerExecutionEnvFactory } from "./docker/docker-execution-env.js";
6
+ export { hostExecutionEnvFactory } from "./host/host-execution-env.js";
7
+ export { createHostRunner } from "./host/host-runner.js";
8
+ export { createMockRunner, createMockRunnerByCommand } from "./testing/index.js";
9
+ export { downloadWorkspace, uploadWorkspace, type WorkspaceDownloadOptions, type WorkspaceTransferDirent, type WorkspaceTransferEnv, type WorkspaceTransferFileSystem, type WorkspaceTransferOptions, type WorkspaceTransferRunnerOptions, type WorkspaceTransferStats } from "./workspace-transfer.js";
10
+ export type { DownloadResult, DockerMount, DockerPortMapping, DockerRunArgs, DockerRunnerOptions, Engine, ExecutionState, ExecutionEnvFactory, ExecutionEnvType, HostRunnerOptions, JobHandle, JobStatus, LogChunk, MockRunBehavior, OpenedEnv, OpenSpec, RunHandle, RunResult, Runner, RunSpec, TemplateEntry, UploadResult } from "./types.js";
@@ -0,0 +1,2 @@
1
+ export { createMockRunner, createMockRunnerByCommand } from "./mock-runner.js";
2
+ export type { MockRunBehavior } from "../types.js";
@@ -0,0 +1,3 @@
1
+ import type { MockRunBehavior, Runner } from "../types.js";
2
+ export declare function createMockRunner(behaviors: MockRunBehavior[]): Runner;
3
+ export declare function createMockRunnerByCommand(behaviorsByCommand: Record<string, MockRunBehavior>): Runner;
@@ -0,0 +1,191 @@
1
+ import type { Readable, Writable } from "node:stream";
2
+ export interface RunHandle {
3
+ readonly pid: number | null;
4
+ readonly stdout: Readable | null;
5
+ readonly stderr: Readable | null;
6
+ readonly stdin: Writable | null;
7
+ readonly result: Promise<RunResult>;
8
+ kill(signal?: NodeJS.Signals): void;
9
+ }
10
+ export interface RunResult {
11
+ exitCode: number;
12
+ }
13
+ export interface RunSpec {
14
+ command: string;
15
+ args?: string[];
16
+ cwd?: string;
17
+ env?: Record<string, string>;
18
+ stdin?: "pipe" | "inherit" | "ignore";
19
+ stdout?: "pipe" | "inherit";
20
+ stderr?: "pipe" | "inherit";
21
+ tty?: boolean;
22
+ signal?: AbortSignal;
23
+ /** Start in a separate process group so kill() can signal the full group where supported. */
24
+ killProcessGroup?: boolean;
25
+ }
26
+ export interface Runner {
27
+ exec(spec: RunSpec): RunHandle;
28
+ readonly name: string;
29
+ }
30
+ export interface HostRunnerOptions {
31
+ detached?: boolean;
32
+ }
33
+ export type ExecutionEnvType = "host" | "docker";
34
+ export type JobStatus = "running" | "exited" | "killed" | "lost";
35
+ export interface ExecutionEnvFactory {
36
+ readonly type: ExecutionEnvType;
37
+ readonly supportsDetach?: boolean;
38
+ /** Whether uploadWorkspace/downloadWorkspace move real files, i.e. whether runner.sync means anything. */
39
+ readonly supportsWorkspaceTransfer?: boolean;
40
+ open(spec: OpenSpec): Promise<OpenedEnv>;
41
+ attach(envId: string, context?: AttachedJobContext): Promise<OpenedEnv>;
42
+ }
43
+ export interface OpenSpec {
44
+ cwd: string;
45
+ runtime: unknown;
46
+ runner?: unknown;
47
+ state?: ExecutionState;
48
+ hostRunner?: Runner;
49
+ env: Record<string, string>;
50
+ uploadIgnoreFiles: string[];
51
+ jobLabel: {
52
+ tool: string;
53
+ argv: string[];
54
+ };
55
+ execution?: {
56
+ wrapForLogTee?: boolean;
57
+ stdin?: RunSpec["stdin"];
58
+ stdout?: RunSpec["stdout"];
59
+ stderr?: RunSpec["stderr"];
60
+ env?: RunSpec["env"];
61
+ tty?: boolean;
62
+ input?: string | Buffer;
63
+ captureOutput?: boolean;
64
+ activityTimeoutMs?: number;
65
+ onStdout?(chunk: string): void;
66
+ onStderr?(chunk: string): void;
67
+ };
68
+ shellSpec?: RunSpec;
69
+ }
70
+ export interface ExecutionState {
71
+ templates: {
72
+ get(backend: "docker", hash: string): Promise<TemplateEntry | null>;
73
+ put(backend: "docker", entry: TemplateEntry): Promise<void>;
74
+ };
75
+ }
76
+ export interface TemplateEntry {
77
+ hash: string;
78
+ template_id?: string;
79
+ image?: string;
80
+ runtime_type: string;
81
+ dockerfile_path: string;
82
+ built_at: string;
83
+ }
84
+ export interface UploadResult {
85
+ files: number;
86
+ bytes: number;
87
+ skipped: {
88
+ path: string;
89
+ bytes: number;
90
+ reason: "max_size";
91
+ }[];
92
+ }
93
+ export interface DownloadResult {
94
+ files: number;
95
+ bytes: number;
96
+ conflicts: {
97
+ path: string;
98
+ reason: "local_modified";
99
+ }[];
100
+ }
101
+ export interface LogChunk {
102
+ byteOffset: number;
103
+ data: string;
104
+ }
105
+ export interface AttachedJobContext {
106
+ jobId: string;
107
+ tool: string;
108
+ argv: string[];
109
+ cwd: string;
110
+ reattachContext?: Record<string, unknown>;
111
+ }
112
+ export interface OpenedEnv {
113
+ readonly id: string;
114
+ readonly job: JobHandle | null;
115
+ readonly reattachContext?: Record<string, unknown>;
116
+ uploadWorkspace(): Promise<UploadResult>;
117
+ downloadWorkspace(opts: {
118
+ conflictPolicy: "refuse" | "overwrite";
119
+ }): Promise<DownloadResult>;
120
+ exec(spec: RunSpec): RunHandle;
121
+ detach(): Promise<JobHandle>;
122
+ shell(): RunHandle;
123
+ close(): Promise<void>;
124
+ }
125
+ export interface JobHandle {
126
+ readonly id: string;
127
+ readonly envId: string;
128
+ readonly tool: string;
129
+ readonly argv: string[];
130
+ status(opts?: {
131
+ signal?: AbortSignal;
132
+ }): Promise<JobStatus>;
133
+ stream(opts?: {
134
+ sinceByte?: number;
135
+ since?: Date;
136
+ follow?: boolean;
137
+ signal?: AbortSignal;
138
+ }): AsyncIterable<LogChunk>;
139
+ wait(): Promise<{
140
+ exitCode: number;
141
+ }>;
142
+ kill(signal?: NodeJS.Signals): Promise<void>;
143
+ }
144
+ export type Engine = "docker" | "podman";
145
+ export interface DockerMount {
146
+ source: string;
147
+ target: string;
148
+ readonly?: boolean;
149
+ }
150
+ export interface DockerPortMapping {
151
+ host: number;
152
+ container: number;
153
+ protocol?: "tcp" | "udp";
154
+ }
155
+ export interface DockerRunnerOptions {
156
+ image: string;
157
+ engine?: Engine;
158
+ context?: string;
159
+ mounts?: DockerMount[];
160
+ ports?: DockerPortMapping[];
161
+ network?: string;
162
+ extraArgs?: string[];
163
+ containerName?: string;
164
+ }
165
+ export interface DockerRunArgs {
166
+ engine: Engine;
167
+ context: string | null;
168
+ image: string;
169
+ command: string;
170
+ args: string[];
171
+ cwd?: string;
172
+ env?: Record<string, string>;
173
+ envFilePath?: string;
174
+ mounts: DockerMount[];
175
+ ports: DockerPortMapping[];
176
+ network?: string;
177
+ containerName: string;
178
+ detached: boolean;
179
+ interactive: boolean;
180
+ tty: boolean;
181
+ rm: boolean;
182
+ extraArgs: string[];
183
+ }
184
+ export interface MockRunBehavior {
185
+ pid?: number;
186
+ exitCode: number;
187
+ exitAfterMs?: number;
188
+ stdout?: string[];
189
+ stderr?: string[];
190
+ stdoutInterval?: number;
191
+ }
@@ -0,0 +1,61 @@
1
+ import type { DownloadResult, UploadResult } from "./types.js";
2
+ export type { DownloadResult, UploadResult } from "./types.js";
3
+ export interface WorkspaceTransferDirent {
4
+ name: string;
5
+ isFile(): boolean;
6
+ isDirectory(): boolean;
7
+ isSymbolicLink?(): boolean;
8
+ }
9
+ export interface WorkspaceTransferStats {
10
+ isFile(): boolean;
11
+ isDirectory(): boolean;
12
+ isSymbolicLink?(): boolean;
13
+ size: number;
14
+ }
15
+ export interface WorkspaceTransferFileSystem {
16
+ mkdir(path: string, options?: {
17
+ recursive?: boolean;
18
+ }): Promise<void>;
19
+ readdir(path: string, options: {
20
+ withFileTypes: true;
21
+ }): Promise<WorkspaceTransferDirent[]>;
22
+ readFile(path: string): Promise<Buffer>;
23
+ readFile(path: string, encoding: BufferEncoding): Promise<string>;
24
+ writeFile(path: string, data: string | Buffer, options?: {
25
+ flag?: string;
26
+ mode?: number;
27
+ }): Promise<void>;
28
+ stat(path: string): Promise<WorkspaceTransferStats>;
29
+ lstat?(path: string): Promise<WorkspaceTransferStats>;
30
+ rename?(oldPath: string, newPath: string): Promise<void>;
31
+ rm?(path: string, options?: {
32
+ recursive?: boolean;
33
+ force?: boolean;
34
+ }): Promise<void>;
35
+ unlink?(path: string): Promise<void>;
36
+ rmdir?(path: string): Promise<void>;
37
+ }
38
+ export interface WorkspaceTransferEnv {
39
+ cwd: string;
40
+ uploadDir: string;
41
+ workspaceDir?: string;
42
+ fs?: WorkspaceTransferFileSystem;
43
+ remoteFs?: WorkspaceTransferFileSystem;
44
+ }
45
+ export interface WorkspaceTransferOptions {
46
+ runner?: WorkspaceTransferRunnerOptions;
47
+ uploadMaxFileMb?: number;
48
+ workspaceExclude?: string[];
49
+ warn?: (message: string) => void;
50
+ }
51
+ export interface WorkspaceTransferRunnerOptions {
52
+ upload_max_file_mb?: number;
53
+ workspace?: {
54
+ exclude?: string[];
55
+ };
56
+ }
57
+ export interface WorkspaceDownloadOptions {
58
+ conflictPolicy: "refuse" | "overwrite";
59
+ }
60
+ export declare function uploadWorkspace(env: WorkspaceTransferEnv, opts: WorkspaceTransferOptions): Promise<UploadResult>;
61
+ export declare function downloadWorkspace(env: WorkspaceTransferEnv, opts: WorkspaceDownloadOptions): Promise<DownloadResult>;
@@ -0,0 +1,5 @@
1
+ import type { AuthStrategy } from "./types.js";
2
+ export interface ApiKeyLoginOptions {
3
+ apiKey?: string;
4
+ }
5
+ export declare const apiKeyAuthStrategy: AuthStrategy<ApiKeyLoginOptions>;
@@ -0,0 +1,14 @@
1
+ import type { SecretStore } from "../../auth-store/index.js";
2
+ import type { ApiKeyPrompt, AuthProvider } from "../types.js";
3
+ export type PromptForSecret = (prompt: ApiKeyPrompt) => Promise<string | undefined>;
4
+ export interface AuthStrategyContext {
5
+ secretStore: SecretStore;
6
+ promptForSecret?: PromptForSecret;
7
+ readOnly?: boolean;
8
+ }
9
+ export interface AuthStrategy<TLoginOptions> {
10
+ login(provider: AuthProvider, options: TLoginOptions, context: AuthStrategyContext): Promise<string>;
11
+ logout(provider: AuthProvider, context: AuthStrategyContext): Promise<void>;
12
+ isLoggedIn(provider: AuthProvider, context: AuthStrategyContext): Promise<boolean>;
13
+ resolveCredential(provider: AuthProvider, context: AuthStrategyContext): Promise<string>;
14
+ }
@@ -0,0 +1,4 @@
1
+ import type { ApiShapeId, AuthProvider } from "./types.js";
2
+ export declare function resolveApiShape(provider: AuthProvider, agent: {
3
+ apiShapes?: readonly ApiShapeId[];
4
+ }): ApiShapeId | undefined;
@@ -0,0 +1,8 @@
1
+ export type { ApiShapeBinding, ApiShapeId, ApiKeyAuth, ApiKeyPrompt, AuthMethod, AuthProvider, EnvValueSource, OAuthAuth, ProviderModelInput } from "./types.js";
2
+ export { ProviderRegistry } from "./registry.js";
3
+ export type { AuthStrategy, AuthStrategyContext, PromptForSecret } from "./auth/types.js";
4
+ export { resolveApiShape } from "./compatibility.js";
5
+ export { apiKeyAuthStrategy } from "./auth/api-key.js";
6
+ export type { ApiKeyLoginOptions } from "./auth/api-key.js";
7
+ export { POE_PROVIDER_ID } from "./providers/poe.js";
8
+ export * from "./providers/generated.js";
@@ -0,0 +1 @@
1
+ export declare const anthropicProvider: import("../types.js").AuthProvider;
@@ -0,0 +1 @@
1
+ export declare const cloudflareProvider: import("../types.js").AuthProvider;
@@ -0,0 +1,5 @@
1
+ export * from "./anthropic.js";
2
+ export * from "./cloudflare.js";
3
+ export * from "./openai.js";
4
+ export * from "./poe.js";
5
+ export declare const allAuthProviders: readonly import("../types.js").AuthProvider[];
@@ -0,0 +1 @@
1
+ export declare const openaiProvider: import("../types.js").AuthProvider;
@@ -0,0 +1,2 @@
1
+ export declare const POE_PROVIDER_ID: "poe";
2
+ export declare const poeProvider: import("../types.js").AuthProvider;
@@ -0,0 +1,44 @@
1
+ import type { ApiShapeId, AuthProvider } from "./types.js";
2
+ import type { SecretStore } from "../auth-store/index.js";
3
+ import type { ApiKeyLoginOptions } from "./auth/api-key.js";
4
+ import type { PromptForSecret } from "./auth/types.js";
5
+ export interface LoginContext {
6
+ promptForSecret?: PromptForSecret;
7
+ envVars?: Record<string, string | undefined>;
8
+ store?: SecretStore;
9
+ resolvePreferredLogin?: (input: {
10
+ provider: AuthProvider;
11
+ apiKey?: string;
12
+ envValue?: string;
13
+ }) => Promise<string>;
14
+ }
15
+ export type ProviderStoreFactory = (provider: AuthProvider) => SecretStore;
16
+ export interface ProviderRegistryOptions {
17
+ envVars?: Record<string, string | undefined>;
18
+ }
19
+ export interface ProviderAgent {
20
+ id: string;
21
+ apiShapes?: readonly ApiShapeId[];
22
+ }
23
+ export declare class ProviderRegistry {
24
+ private readonly providers;
25
+ private readonly byId;
26
+ private readonly storeFactory?;
27
+ private readonly envVars;
28
+ constructor(providers: readonly AuthProvider[], storeFactory?: ProviderStoreFactory, options?: ProviderRegistryOptions);
29
+ list(): readonly AuthProvider[];
30
+ get(id: string): AuthProvider | undefined;
31
+ forAgent(agent: ProviderAgent): readonly AuthProvider[];
32
+ isLoggedIn(id: string, options?: {
33
+ readOnly?: boolean;
34
+ }): Promise<boolean>;
35
+ login(id: string, options: ApiKeyLoginOptions, context?: LoginContext): Promise<void>;
36
+ resolveCredential(id: string, options?: ApiKeyLoginOptions, context?: Pick<LoginContext, "envVars"> & {
37
+ readOnly?: boolean;
38
+ }): Promise<string>;
39
+ logout(id: string, options?: {
40
+ store?: SecretStore;
41
+ }): Promise<void>;
42
+ private requireProvider;
43
+ private requireStore;
44
+ }
@@ -0,0 +1,54 @@
1
+ import type { ApiShapeId } from "../agent-defs/index.js";
2
+ export type { ApiShapeId } from "../agent-defs/index.js";
3
+ export type EnvValueSource = {
4
+ kind: "literal";
5
+ value: string;
6
+ } | {
7
+ kind: "providerCredential";
8
+ prefix?: string;
9
+ } | {
10
+ kind: "providerBaseUrl";
11
+ } | {
12
+ kind: "providerField";
13
+ path: string;
14
+ };
15
+ export interface ApiKeyPrompt {
16
+ title: string;
17
+ placeholder?: string;
18
+ }
19
+ export interface ApiKeyAuth {
20
+ kind: "api-key";
21
+ envVar: string;
22
+ storageKey: string;
23
+ prompt: ApiKeyPrompt;
24
+ preferredLogin?: "oauth";
25
+ }
26
+ export interface OAuthAuth {
27
+ kind: "oauth";
28
+ }
29
+ export type AuthMethod = ApiKeyAuth | OAuthAuth;
30
+ export interface ApiShapeBinding {
31
+ readonly id: ApiShapeId;
32
+ readonly baseUrlPath?: string;
33
+ readonly envBaseUrlPath?: string;
34
+ readonly defaultBaseUrl?: string;
35
+ }
36
+ export interface ProviderModelInput {
37
+ readonly kind: "freeform";
38
+ }
39
+ export interface AuthProvider {
40
+ readonly id: string;
41
+ readonly label: string;
42
+ readonly summary?: string;
43
+ readonly baseUrl?: string;
44
+ readonly agentBaseUrl?: string;
45
+ readonly baseUrlEnvVar?: string;
46
+ readonly baseUrlEnvPath?: string;
47
+ readonly agentBaseUrlPath?: string;
48
+ readonly requiresBaseUrl?: boolean;
49
+ readonly modelInput?: ProviderModelInput;
50
+ readonly auth: AuthMethod;
51
+ readonly apiShapes?: readonly ApiShapeBinding[];
52
+ readonly env?: Readonly<Record<string, EnvValueSource>>;
53
+ }
54
+ export declare function defineProvider(provider: AuthProvider): AuthProvider;
@@ -0,0 +1,88 @@
1
+ import type { FileSystem } from "../contracts/filesystem.js";
2
+ import type { BridgePrimitives, BufferEncodingOption, FsBridgeDirent, FsBridgeEncoding, FsBridgeStats, MakeDirectoryOptions, Mode, ObjectEncodingOptions, StatOptions } from "./types.js";
3
+ type Encoding = FsBridgeEncoding | "buffer";
4
+ type ReadOptions = ObjectEncodingOptions & {
5
+ flag?: string | number | undefined;
6
+ signal?: AbortSignal | undefined;
7
+ };
8
+ type DirectoryOptions = {
9
+ encoding?: Encoding | null | undefined;
10
+ recursive?: boolean | undefined;
11
+ withFileTypes?: boolean | undefined;
12
+ };
13
+ export declare class FileSystemBridge<Binary extends Uint8Array> {
14
+ #private;
15
+ constructor(fs: FileSystem, options: {
16
+ readonly cwd?: string;
17
+ readonly signal?: AbortSignal;
18
+ }, primitives: BridgePrimitives<Binary>);
19
+ readFile(path: unknown, options?: {
20
+ encoding?: null | undefined;
21
+ flag?: string | number | undefined;
22
+ signal?: AbortSignal | undefined;
23
+ } | null): Promise<Binary>;
24
+ readFile(path: unknown, options: FsBridgeEncoding | (ReadOptions & {
25
+ encoding: FsBridgeEncoding;
26
+ })): Promise<string>;
27
+ readFile(path: unknown, options?: ReadOptions | FsBridgeEncoding | null): Promise<string | Binary>;
28
+ writeFile(path: unknown, data: unknown, options?: unknown): Promise<void>;
29
+ appendFile(path: unknown, data: unknown, options?: unknown): Promise<void>;
30
+ stat(path: unknown, options?: StatOptions & {
31
+ bigint?: false | undefined;
32
+ }): Promise<FsBridgeStats>;
33
+ stat(path: unknown, options: StatOptions & {
34
+ bigint: true;
35
+ }): Promise<never>;
36
+ stat(path: unknown, options?: StatOptions): Promise<FsBridgeStats>;
37
+ lstat(path: unknown, options?: StatOptions & {
38
+ bigint?: false | undefined;
39
+ }): Promise<FsBridgeStats>;
40
+ lstat(path: unknown, options: StatOptions & {
41
+ bigint: true;
42
+ }): Promise<never>;
43
+ lstat(path: unknown, options?: StatOptions): Promise<FsBridgeStats>;
44
+ readdir(path: unknown, options?: FsBridgeEncoding | (ObjectEncodingOptions & {
45
+ withFileTypes?: false | undefined;
46
+ recursive?: boolean | undefined;
47
+ }) | null): Promise<string[]>;
48
+ readdir(path: unknown, options: "buffer" | (DirectoryOptions & {
49
+ encoding: "buffer";
50
+ withFileTypes?: false | undefined;
51
+ })): Promise<Binary[]>;
52
+ readdir(path: unknown, options: ObjectEncodingOptions & {
53
+ withFileTypes: true;
54
+ recursive?: boolean | undefined;
55
+ }): Promise<FsBridgeDirent[]>;
56
+ readdir(path: unknown, options: DirectoryOptions & {
57
+ encoding: "buffer";
58
+ withFileTypes: true;
59
+ }): Promise<FsBridgeDirent<Binary>[]>;
60
+ mkdir(path: unknown, options: MakeDirectoryOptions & {
61
+ recursive: true;
62
+ }): Promise<string | undefined>;
63
+ mkdir(path: unknown, options?: Mode | (MakeDirectoryOptions & {
64
+ recursive?: false | undefined;
65
+ }) | null): Promise<void>;
66
+ mkdir(path: unknown, options?: Mode | MakeDirectoryOptions | null): Promise<string | undefined>;
67
+ access(path: unknown, mode?: number): Promise<void>;
68
+ rm(path: unknown, value?: unknown): Promise<void>;
69
+ rmdir(path: unknown, value?: unknown): Promise<void>;
70
+ rename(source: unknown, destination: unknown): Promise<void>;
71
+ copyFile(source: unknown, destination: unknown, mode?: number): Promise<void>;
72
+ cp(source: unknown, destination: unknown, value?: unknown): Promise<void>;
73
+ readlink(path: unknown, options?: ObjectEncodingOptions | FsBridgeEncoding | null): Promise<string>;
74
+ readlink(path: unknown, options: BufferEncodingOption): Promise<Binary>;
75
+ readlink(path: unknown, options?: ObjectEncodingOptions | BufferEncodingOption | string | null): Promise<string | Binary>;
76
+ realpath(path: unknown, options?: ObjectEncodingOptions | FsBridgeEncoding | null): Promise<string>;
77
+ realpath(path: unknown, options: BufferEncodingOption): Promise<Binary>;
78
+ realpath(path: unknown, options?: ObjectEncodingOptions | BufferEncodingOption | string | null): Promise<string | Binary>;
79
+ mkdtemp(prefix: string, options?: ObjectEncodingOptions | FsBridgeEncoding | null): Promise<string>;
80
+ mkdtemp(prefix: string, options: BufferEncodingOption): Promise<Binary>;
81
+ mkdtemp(prefix: string, options?: ObjectEncodingOptions | BufferEncodingOption | string | null): Promise<string | Binary>;
82
+ symlink(target: unknown, path: unknown, type?: unknown): Promise<void>;
83
+ link(existing: unknown, path: unknown): Promise<void>;
84
+ chmod(path: unknown, value: unknown): Promise<void>;
85
+ utimes(path: unknown, atime: unknown, mtime: unknown): Promise<void>;
86
+ truncate(path: unknown, length?: number): Promise<void>;
87
+ }
88
+ export {};
@@ -0,0 +1,6 @@
1
+ import type { FileSystem } from "../contracts/filesystem.js";
2
+ import { FileSystemBridge } from "./filesystem.js";
3
+ import type { FsBridgeOptions } from "./types.js";
4
+ export type { FsBridgeCodec, FsBridgeDirent, FsBridgeEncoding, FsBridgeFileSystem, FsBridgeOptions, FsBridgeStats } from "./types.js";
5
+ export type FsBridge = FileSystemBridge<Uint8Array<ArrayBuffer>>;
6
+ export declare function createFsBridge(fs: FileSystem, options: FsBridgeOptions): FsBridge;
@@ -0,0 +1,75 @@
1
+ import type { FileSystem, FsOptions } from "../contracts/filesystem.js";
2
+ export interface FsBridgeCodec {
3
+ isEncoding(encoding: string): boolean;
4
+ encode(text: string, encoding: string): Uint8Array;
5
+ decode(bytes: Uint8Array, encoding: string): string;
6
+ }
7
+ export interface FsBridgeOptions {
8
+ readonly codec: FsBridgeCodec;
9
+ readonly cwd?: string;
10
+ readonly signal?: AbortSignal;
11
+ }
12
+ export interface FsBridgeFileSystem extends FileSystem {
13
+ rmdir?(path: string, options?: FsOptions): Promise<void>;
14
+ }
15
+ export type FsBridgeEncoding = "ascii" | "utf8" | "utf-8" | "utf16le" | "utf-16le" | "ucs2" | "ucs-2" | "base64" | "base64url" | "latin1" | "binary" | "hex";
16
+ export interface ObjectEncodingOptions {
17
+ encoding?: FsBridgeEncoding | null | undefined;
18
+ }
19
+ export type BufferEncodingOption = "buffer" | {
20
+ encoding: "buffer";
21
+ };
22
+ export type Mode = number | string;
23
+ export interface MakeDirectoryOptions {
24
+ recursive?: boolean | undefined;
25
+ mode?: Mode | undefined;
26
+ }
27
+ export interface StatOptions {
28
+ bigint?: boolean | undefined;
29
+ }
30
+ export interface FsBridgePredicates {
31
+ isFile(): boolean;
32
+ isDirectory(): boolean;
33
+ isSymbolicLink(): boolean;
34
+ isBlockDevice(): boolean;
35
+ isCharacterDevice(): boolean;
36
+ isFIFO(): boolean;
37
+ isSocket(): boolean;
38
+ }
39
+ export interface FsBridgeStats extends FsBridgePredicates {
40
+ dev: number;
41
+ ino: number;
42
+ mode: number;
43
+ nlink: number;
44
+ uid: number;
45
+ gid: number;
46
+ rdev: number;
47
+ size: number;
48
+ blksize: number;
49
+ blocks: number;
50
+ atimeMs: number;
51
+ mtimeMs: number;
52
+ ctimeMs: number;
53
+ birthtimeMs: number;
54
+ atime: Date;
55
+ mtime: Date;
56
+ ctime: Date;
57
+ birthtime: Date;
58
+ }
59
+ export interface FsBridgeDirent<Name extends string | Uint8Array = string> extends FsBridgePredicates {
60
+ name: Name;
61
+ parentPath: string;
62
+ path: string;
63
+ }
64
+ export interface BridgePrimitives<Binary extends Uint8Array> {
65
+ readonly codec: FsBridgeCodec;
66
+ copyBytes(bytes: Uint8Array): Binary;
67
+ pathValue?(value: unknown): unknown;
68
+ randomSuffix(): string;
69
+ readonly paths: {
70
+ isAbsolute(path: string): boolean;
71
+ dirname(path: string): string;
72
+ relative(from: string, to: string): string;
73
+ resolve(cwd: string, ...paths: string[]): string;
74
+ };
75
+ }