@bolt-foundry/gambit 0.8.3 → 0.8.5-rc.5

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 (289) hide show
  1. package/CHANGELOG.md +38 -2
  2. package/README.md +79 -16
  3. package/esm/_dnt.polyfills.d.ts +17 -0
  4. package/esm/_dnt.polyfills.d.ts.map +1 -1
  5. package/esm/_dnt.polyfills.js +122 -0
  6. package/esm/deps/jsr.io/@std/collections/1.1.5/deep_merge.d.ts +322 -0
  7. package/esm/deps/jsr.io/@std/collections/1.1.5/deep_merge.d.ts.map +1 -0
  8. package/esm/deps/jsr.io/@std/collections/1.1.5/deep_merge.js +105 -0
  9. package/esm/deps/jsr.io/@std/fs/1.0.22/_create_walk_entry.d.ts +14 -0
  10. package/esm/deps/jsr.io/@std/fs/1.0.22/_create_walk_entry.d.ts.map +1 -0
  11. package/esm/deps/jsr.io/@std/fs/1.0.22/_create_walk_entry.js +34 -0
  12. package/esm/deps/jsr.io/@std/fs/1.0.22/_get_file_info_type.d.ts +13 -0
  13. package/esm/deps/jsr.io/@std/fs/1.0.22/_get_file_info_type.d.ts.map +1 -0
  14. package/esm/deps/jsr.io/@std/fs/1.0.22/_get_file_info_type.js +18 -0
  15. package/esm/deps/jsr.io/@std/fs/1.0.22/_is_same_path.d.ts +10 -0
  16. package/esm/deps/jsr.io/@std/fs/1.0.22/_is_same_path.d.ts.map +1 -0
  17. package/esm/deps/jsr.io/@std/fs/1.0.22/_is_same_path.js +17 -0
  18. package/esm/deps/jsr.io/@std/fs/1.0.22/_is_subdir.d.ts +12 -0
  19. package/esm/deps/jsr.io/@std/fs/1.0.22/_is_subdir.d.ts.map +1 -0
  20. package/esm/deps/jsr.io/@std/fs/1.0.22/_is_subdir.js +25 -0
  21. package/esm/deps/jsr.io/@std/fs/1.0.22/_to_path_string.d.ts +9 -0
  22. package/esm/deps/jsr.io/@std/fs/1.0.22/_to_path_string.d.ts.map +1 -0
  23. package/esm/deps/jsr.io/@std/fs/1.0.22/_to_path_string.js +13 -0
  24. package/esm/deps/jsr.io/@std/fs/1.0.22/copy.d.ts +117 -0
  25. package/esm/deps/jsr.io/@std/fs/1.0.22/copy.d.ts.map +1 -0
  26. package/esm/deps/jsr.io/@std/fs/1.0.22/copy.js +313 -0
  27. package/esm/deps/jsr.io/@std/fs/1.0.22/empty_dir.d.ts +48 -0
  28. package/esm/deps/jsr.io/@std/fs/1.0.22/empty_dir.d.ts.map +1 -0
  29. package/esm/deps/jsr.io/@std/fs/1.0.22/empty_dir.js +87 -0
  30. package/esm/deps/jsr.io/@std/fs/1.0.22/ensure_dir.d.ts +49 -0
  31. package/esm/deps/jsr.io/@std/fs/1.0.22/ensure_dir.d.ts.map +1 -0
  32. package/esm/deps/jsr.io/@std/fs/1.0.22/ensure_dir.js +102 -0
  33. package/esm/deps/jsr.io/@std/fs/1.0.22/ensure_file.d.ts +47 -0
  34. package/esm/deps/jsr.io/@std/fs/1.0.22/ensure_file.d.ts.map +1 -0
  35. package/esm/deps/jsr.io/@std/fs/1.0.22/ensure_file.js +90 -0
  36. package/esm/deps/jsr.io/@std/fs/1.0.22/ensure_link.d.ts +49 -0
  37. package/esm/deps/jsr.io/@std/fs/1.0.22/ensure_link.d.ts.map +1 -0
  38. package/esm/deps/jsr.io/@std/fs/1.0.22/ensure_link.js +61 -0
  39. package/esm/deps/jsr.io/@std/fs/1.0.22/ensure_symlink.d.ts +70 -0
  40. package/esm/deps/jsr.io/@std/fs/1.0.22/ensure_symlink.d.ts.map +1 -0
  41. package/esm/deps/jsr.io/@std/fs/1.0.22/ensure_symlink.js +156 -0
  42. package/esm/deps/jsr.io/@std/fs/1.0.22/eol.d.ts +52 -0
  43. package/esm/deps/jsr.io/@std/fs/1.0.22/eol.d.ts.map +1 -0
  44. package/esm/deps/jsr.io/@std/fs/1.0.22/eol.js +67 -0
  45. package/esm/deps/jsr.io/@std/fs/1.0.22/exists.d.ts +218 -0
  46. package/esm/deps/jsr.io/@std/fs/1.0.22/exists.d.ts.map +1 -0
  47. package/esm/deps/jsr.io/@std/fs/1.0.22/exists.js +271 -0
  48. package/esm/deps/jsr.io/@std/fs/1.0.22/expand_glob.d.ts +267 -0
  49. package/esm/deps/jsr.io/@std/fs/1.0.22/expand_glob.d.ts.map +1 -0
  50. package/esm/deps/jsr.io/@std/fs/1.0.22/expand_glob.js +442 -0
  51. package/esm/deps/jsr.io/@std/fs/1.0.22/mod.d.ts +29 -0
  52. package/esm/deps/jsr.io/@std/fs/1.0.22/mod.d.ts.map +1 -0
  53. package/esm/deps/jsr.io/@std/fs/1.0.22/mod.js +29 -0
  54. package/esm/deps/jsr.io/@std/fs/1.0.22/move.d.ts +86 -0
  55. package/esm/deps/jsr.io/@std/fs/1.0.22/move.d.ts.map +1 -0
  56. package/esm/deps/jsr.io/@std/fs/1.0.22/move.js +142 -0
  57. package/esm/deps/jsr.io/@std/fs/1.0.22/walk.d.ts +777 -0
  58. package/esm/deps/jsr.io/@std/fs/1.0.22/walk.d.ts.map +1 -0
  59. package/esm/deps/jsr.io/@std/fs/1.0.22/walk.js +846 -0
  60. package/esm/deps/jsr.io/@std/json/1.0.2/types.d.ts +5 -0
  61. package/esm/deps/jsr.io/@std/json/1.0.2/types.d.ts.map +1 -0
  62. package/esm/deps/jsr.io/@std/json/1.0.2/types.js +3 -0
  63. package/esm/deps/jsr.io/@std/jsonc/1.0.2/mod.d.ts +20 -0
  64. package/esm/deps/jsr.io/@std/jsonc/1.0.2/mod.d.ts.map +1 -0
  65. package/esm/deps/jsr.io/@std/jsonc/1.0.2/mod.js +21 -0
  66. package/esm/deps/jsr.io/@std/jsonc/1.0.2/parse.d.ts +21 -0
  67. package/esm/deps/jsr.io/@std/jsonc/1.0.2/parse.d.ts.map +1 -0
  68. package/esm/deps/jsr.io/@std/jsonc/1.0.2/parse.js +320 -0
  69. package/esm/deps/jsr.io/@std/toml/1.0.11/_parser.d.ts +93 -0
  70. package/esm/deps/jsr.io/@std/toml/1.0.11/_parser.d.ts.map +1 -0
  71. package/esm/deps/jsr.io/@std/toml/1.0.11/_parser.js +753 -0
  72. package/esm/deps/jsr.io/@std/toml/1.0.11/mod.d.ts +109 -0
  73. package/esm/deps/jsr.io/@std/toml/1.0.11/mod.d.ts.map +1 -0
  74. package/esm/deps/jsr.io/@std/toml/1.0.11/mod.js +110 -0
  75. package/esm/deps/jsr.io/@std/toml/1.0.11/parse.d.ts +21 -0
  76. package/esm/deps/jsr.io/@std/toml/1.0.11/parse.d.ts.map +1 -0
  77. package/esm/deps/jsr.io/@std/toml/1.0.11/parse.js +25 -0
  78. package/esm/deps/jsr.io/@std/toml/1.0.11/stringify.d.ts +35 -0
  79. package/esm/deps/jsr.io/@std/toml/1.0.11/stringify.d.ts.map +1 -0
  80. package/esm/deps/jsr.io/@std/toml/1.0.11/stringify.js +283 -0
  81. package/esm/gambit/simulator-ui/dist/bundle.js +10639 -4629
  82. package/esm/gambit/simulator-ui/dist/bundle.js.map +4 -4
  83. package/esm/mod.d.ts +13 -3
  84. package/esm/mod.d.ts.map +1 -1
  85. package/esm/mod.js +8 -2
  86. package/esm/src/cli_utils.d.ts +1 -0
  87. package/esm/src/cli_utils.d.ts.map +1 -1
  88. package/esm/src/cli_utils.js +13 -1
  89. package/esm/src/default_runtime.d.ts +46 -0
  90. package/esm/src/default_runtime.d.ts.map +1 -0
  91. package/esm/src/default_runtime.js +415 -0
  92. package/esm/src/durable_streams.js +26 -1
  93. package/esm/src/model_matchers.d.ts +10 -0
  94. package/esm/src/model_matchers.d.ts.map +1 -0
  95. package/esm/src/model_matchers.js +26 -0
  96. package/esm/src/openai_compat.d.ts +12 -1
  97. package/esm/src/openai_compat.d.ts.map +1 -1
  98. package/esm/src/openai_compat.js +53 -1
  99. package/esm/src/project_config.d.ts +47 -0
  100. package/esm/src/project_config.d.ts.map +1 -0
  101. package/esm/src/project_config.js +134 -0
  102. package/esm/src/providers/codex.d.ts +37 -0
  103. package/esm/src/providers/codex.d.ts.map +1 -0
  104. package/esm/src/providers/codex.js +810 -0
  105. package/esm/src/providers/google.d.ts +3 -1
  106. package/esm/src/providers/google.d.ts.map +1 -1
  107. package/esm/src/providers/google.js +82 -6
  108. package/esm/src/providers/ollama.d.ts +3 -1
  109. package/esm/src/providers/ollama.d.ts.map +1 -1
  110. package/esm/src/providers/ollama.js +238 -15
  111. package/esm/src/providers/openrouter.d.ts +6 -2
  112. package/esm/src/providers/openrouter.d.ts.map +1 -1
  113. package/esm/src/providers/openrouter.js +260 -23
  114. package/esm/src/providers/router.d.ts +19 -0
  115. package/esm/src/providers/router.d.ts.map +1 -0
  116. package/esm/src/providers/router.js +93 -0
  117. package/esm/src/server.d.ts +9 -0
  118. package/esm/src/server.d.ts.map +1 -1
  119. package/esm/src/server.js +3186 -652
  120. package/esm/src/server_feedback_grading_routes.d.ts +32 -0
  121. package/esm/src/server_feedback_grading_routes.d.ts.map +1 -0
  122. package/esm/src/server_feedback_grading_routes.js +305 -0
  123. package/esm/src/server_helpers.d.ts +4 -0
  124. package/esm/src/server_helpers.d.ts.map +1 -0
  125. package/esm/src/server_helpers.js +46 -0
  126. package/esm/src/server_session_store.d.ts +87 -0
  127. package/esm/src/server_session_store.d.ts.map +1 -0
  128. package/esm/src/server_session_store.js +873 -0
  129. package/esm/src/server_types.d.ts +110 -0
  130. package/esm/src/server_types.d.ts.map +1 -0
  131. package/esm/src/server_types.js +1 -0
  132. package/esm/src/server_ui_routes.d.ts +33 -0
  133. package/esm/src/server_ui_routes.d.ts.map +1 -0
  134. package/esm/src/server_ui_routes.js +135 -0
  135. package/esm/src/session_artifacts.d.ts +22 -0
  136. package/esm/src/session_artifacts.d.ts.map +1 -0
  137. package/esm/src/session_artifacts.js +243 -0
  138. package/esm/src/trace.d.ts.map +1 -1
  139. package/esm/src/trace.js +6 -3
  140. package/esm/src/workspace.d.ts +19 -0
  141. package/esm/src/workspace.d.ts.map +1 -0
  142. package/esm/src/workspace.js +164 -0
  143. package/esm/src/workspace_contract.d.ts +76 -0
  144. package/esm/src/workspace_contract.d.ts.map +1 -0
  145. package/esm/src/workspace_contract.js +74 -0
  146. package/package.json +2 -2
  147. package/script/_dnt.polyfills.d.ts +17 -0
  148. package/script/_dnt.polyfills.d.ts.map +1 -1
  149. package/script/_dnt.polyfills.js +122 -0
  150. package/script/deps/jsr.io/@std/collections/1.1.5/deep_merge.d.ts +322 -0
  151. package/script/deps/jsr.io/@std/collections/1.1.5/deep_merge.d.ts.map +1 -0
  152. package/script/deps/jsr.io/@std/collections/1.1.5/deep_merge.js +108 -0
  153. package/script/deps/jsr.io/@std/fs/1.0.22/_create_walk_entry.d.ts +14 -0
  154. package/script/deps/jsr.io/@std/fs/1.0.22/_create_walk_entry.d.ts.map +1 -0
  155. package/script/deps/jsr.io/@std/fs/1.0.22/_create_walk_entry.js +71 -0
  156. package/script/deps/jsr.io/@std/fs/1.0.22/_get_file_info_type.d.ts +13 -0
  157. package/script/deps/jsr.io/@std/fs/1.0.22/_get_file_info_type.d.ts.map +1 -0
  158. package/script/deps/jsr.io/@std/fs/1.0.22/_get_file_info_type.js +21 -0
  159. package/script/deps/jsr.io/@std/fs/1.0.22/_is_same_path.d.ts +10 -0
  160. package/script/deps/jsr.io/@std/fs/1.0.22/_is_same_path.d.ts.map +1 -0
  161. package/script/deps/jsr.io/@std/fs/1.0.22/_is_same_path.js +20 -0
  162. package/script/deps/jsr.io/@std/fs/1.0.22/_is_subdir.d.ts +12 -0
  163. package/script/deps/jsr.io/@std/fs/1.0.22/_is_subdir.d.ts.map +1 -0
  164. package/script/deps/jsr.io/@std/fs/1.0.22/_is_subdir.js +28 -0
  165. package/script/deps/jsr.io/@std/fs/1.0.22/_to_path_string.d.ts +9 -0
  166. package/script/deps/jsr.io/@std/fs/1.0.22/_to_path_string.d.ts.map +1 -0
  167. package/script/deps/jsr.io/@std/fs/1.0.22/_to_path_string.js +16 -0
  168. package/script/deps/jsr.io/@std/fs/1.0.22/copy.d.ts +117 -0
  169. package/script/deps/jsr.io/@std/fs/1.0.22/copy.d.ts.map +1 -0
  170. package/script/deps/jsr.io/@std/fs/1.0.22/copy.js +350 -0
  171. package/script/deps/jsr.io/@std/fs/1.0.22/empty_dir.d.ts +48 -0
  172. package/script/deps/jsr.io/@std/fs/1.0.22/empty_dir.d.ts.map +1 -0
  173. package/script/deps/jsr.io/@std/fs/1.0.22/empty_dir.js +124 -0
  174. package/script/deps/jsr.io/@std/fs/1.0.22/ensure_dir.d.ts +49 -0
  175. package/script/deps/jsr.io/@std/fs/1.0.22/ensure_dir.d.ts.map +1 -0
  176. package/script/deps/jsr.io/@std/fs/1.0.22/ensure_dir.js +139 -0
  177. package/script/deps/jsr.io/@std/fs/1.0.22/ensure_file.d.ts +47 -0
  178. package/script/deps/jsr.io/@std/fs/1.0.22/ensure_file.d.ts.map +1 -0
  179. package/script/deps/jsr.io/@std/fs/1.0.22/ensure_file.js +127 -0
  180. package/script/deps/jsr.io/@std/fs/1.0.22/ensure_link.d.ts +49 -0
  181. package/script/deps/jsr.io/@std/fs/1.0.22/ensure_link.d.ts.map +1 -0
  182. package/script/deps/jsr.io/@std/fs/1.0.22/ensure_link.js +98 -0
  183. package/script/deps/jsr.io/@std/fs/1.0.22/ensure_symlink.d.ts +70 -0
  184. package/script/deps/jsr.io/@std/fs/1.0.22/ensure_symlink.d.ts.map +1 -0
  185. package/script/deps/jsr.io/@std/fs/1.0.22/ensure_symlink.js +193 -0
  186. package/script/deps/jsr.io/@std/fs/1.0.22/eol.d.ts +52 -0
  187. package/script/deps/jsr.io/@std/fs/1.0.22/eol.d.ts.map +1 -0
  188. package/script/deps/jsr.io/@std/fs/1.0.22/eol.js +105 -0
  189. package/script/deps/jsr.io/@std/fs/1.0.22/exists.d.ts +218 -0
  190. package/script/deps/jsr.io/@std/fs/1.0.22/exists.d.ts.map +1 -0
  191. package/script/deps/jsr.io/@std/fs/1.0.22/exists.js +308 -0
  192. package/script/deps/jsr.io/@std/fs/1.0.22/expand_glob.d.ts +267 -0
  193. package/script/deps/jsr.io/@std/fs/1.0.22/expand_glob.d.ts.map +1 -0
  194. package/script/deps/jsr.io/@std/fs/1.0.22/expand_glob.js +479 -0
  195. package/script/deps/jsr.io/@std/fs/1.0.22/mod.d.ts +29 -0
  196. package/script/deps/jsr.io/@std/fs/1.0.22/mod.d.ts.map +1 -0
  197. package/script/deps/jsr.io/@std/fs/1.0.22/mod.js +45 -0
  198. package/script/deps/jsr.io/@std/fs/1.0.22/move.d.ts +86 -0
  199. package/script/deps/jsr.io/@std/fs/1.0.22/move.d.ts.map +1 -0
  200. package/script/deps/jsr.io/@std/fs/1.0.22/move.js +179 -0
  201. package/script/deps/jsr.io/@std/fs/1.0.22/walk.d.ts +777 -0
  202. package/script/deps/jsr.io/@std/fs/1.0.22/walk.d.ts.map +1 -0
  203. package/script/deps/jsr.io/@std/fs/1.0.22/walk.js +883 -0
  204. package/script/deps/jsr.io/@std/json/1.0.2/types.d.ts +5 -0
  205. package/script/deps/jsr.io/@std/json/1.0.2/types.d.ts.map +1 -0
  206. package/script/deps/jsr.io/@std/json/1.0.2/types.js +4 -0
  207. package/script/deps/jsr.io/@std/jsonc/1.0.2/mod.d.ts +20 -0
  208. package/script/deps/jsr.io/@std/jsonc/1.0.2/mod.d.ts.map +1 -0
  209. package/script/deps/jsr.io/@std/jsonc/1.0.2/mod.js +37 -0
  210. package/script/deps/jsr.io/@std/jsonc/1.0.2/parse.d.ts +21 -0
  211. package/script/deps/jsr.io/@std/jsonc/1.0.2/parse.d.ts.map +1 -0
  212. package/script/deps/jsr.io/@std/jsonc/1.0.2/parse.js +323 -0
  213. package/script/deps/jsr.io/@std/toml/1.0.11/_parser.d.ts +93 -0
  214. package/script/deps/jsr.io/@std/toml/1.0.11/_parser.d.ts.map +1 -0
  215. package/script/deps/jsr.io/@std/toml/1.0.11/_parser.js +781 -0
  216. package/script/deps/jsr.io/@std/toml/1.0.11/mod.d.ts +109 -0
  217. package/script/deps/jsr.io/@std/toml/1.0.11/mod.d.ts.map +1 -0
  218. package/script/deps/jsr.io/@std/toml/1.0.11/mod.js +126 -0
  219. package/script/deps/jsr.io/@std/toml/1.0.11/parse.d.ts +21 -0
  220. package/script/deps/jsr.io/@std/toml/1.0.11/parse.d.ts.map +1 -0
  221. package/script/deps/jsr.io/@std/toml/1.0.11/parse.js +28 -0
  222. package/script/deps/jsr.io/@std/toml/1.0.11/stringify.d.ts +35 -0
  223. package/script/deps/jsr.io/@std/toml/1.0.11/stringify.d.ts.map +1 -0
  224. package/script/deps/jsr.io/@std/toml/1.0.11/stringify.js +286 -0
  225. package/script/gambit/simulator-ui/dist/bundle.js +10639 -4629
  226. package/script/gambit/simulator-ui/dist/bundle.js.map +4 -4
  227. package/script/mod.d.ts +13 -3
  228. package/script/mod.d.ts.map +1 -1
  229. package/script/mod.js +14 -5
  230. package/script/src/cli_utils.d.ts +1 -0
  231. package/script/src/cli_utils.d.ts.map +1 -1
  232. package/script/src/cli_utils.js +14 -1
  233. package/script/src/default_runtime.d.ts +46 -0
  234. package/script/src/default_runtime.d.ts.map +1 -0
  235. package/script/src/default_runtime.js +452 -0
  236. package/script/src/durable_streams.js +26 -1
  237. package/script/src/model_matchers.d.ts +10 -0
  238. package/script/src/model_matchers.d.ts.map +1 -0
  239. package/script/src/model_matchers.js +29 -0
  240. package/script/src/openai_compat.d.ts +12 -1
  241. package/script/src/openai_compat.d.ts.map +1 -1
  242. package/script/src/openai_compat.js +85 -0
  243. package/script/src/project_config.d.ts +47 -0
  244. package/script/src/project_config.d.ts.map +1 -0
  245. package/script/src/project_config.js +173 -0
  246. package/script/src/providers/codex.d.ts +37 -0
  247. package/script/src/providers/codex.d.ts.map +1 -0
  248. package/script/src/providers/codex.js +850 -0
  249. package/script/src/providers/google.d.ts +3 -1
  250. package/script/src/providers/google.d.ts.map +1 -1
  251. package/script/src/providers/google.js +82 -6
  252. package/script/src/providers/ollama.d.ts +3 -1
  253. package/script/src/providers/ollama.d.ts.map +1 -1
  254. package/script/src/providers/ollama.js +238 -15
  255. package/script/src/providers/openrouter.d.ts +6 -2
  256. package/script/src/providers/openrouter.d.ts.map +1 -1
  257. package/script/src/providers/openrouter.js +260 -23
  258. package/script/src/providers/router.d.ts +19 -0
  259. package/script/src/providers/router.d.ts.map +1 -0
  260. package/script/src/providers/router.js +96 -0
  261. package/script/src/server.d.ts +9 -0
  262. package/script/src/server.d.ts.map +1 -1
  263. package/script/src/server.js +3193 -659
  264. package/script/src/server_feedback_grading_routes.d.ts +32 -0
  265. package/script/src/server_feedback_grading_routes.d.ts.map +1 -0
  266. package/script/src/server_feedback_grading_routes.js +343 -0
  267. package/script/src/server_helpers.d.ts +4 -0
  268. package/script/src/server_helpers.d.ts.map +1 -0
  269. package/script/src/server_helpers.js +84 -0
  270. package/script/src/server_session_store.d.ts +87 -0
  271. package/script/src/server_session_store.d.ts.map +1 -0
  272. package/script/src/server_session_store.js +910 -0
  273. package/script/src/server_types.d.ts +110 -0
  274. package/script/src/server_types.d.ts.map +1 -0
  275. package/script/src/server_types.js +2 -0
  276. package/script/src/server_ui_routes.d.ts +33 -0
  277. package/script/src/server_ui_routes.d.ts.map +1 -0
  278. package/script/src/server_ui_routes.js +172 -0
  279. package/script/src/session_artifacts.d.ts +22 -0
  280. package/script/src/session_artifacts.d.ts.map +1 -0
  281. package/script/src/session_artifacts.js +279 -0
  282. package/script/src/trace.d.ts.map +1 -1
  283. package/script/src/trace.js +6 -3
  284. package/script/src/workspace.d.ts +19 -0
  285. package/script/src/workspace.d.ts.map +1 -0
  286. package/script/src/workspace.js +201 -0
  287. package/script/src/workspace_contract.d.ts +76 -0
  288. package/script/src/workspace_contract.d.ts.map +1 -0
  289. package/script/src/workspace_contract.js +82 -0
@@ -0,0 +1,218 @@
1
+ export interface ExistsOptions {
2
+ /**
3
+ * When `true`, will check if the path is readable by the user as well.
4
+ *
5
+ * @default {false}
6
+ */
7
+ isReadable?: boolean;
8
+ /**
9
+ * When `true`, will check if the path is a directory as well. Directory
10
+ * symlinks are included.
11
+ *
12
+ * @default {false}
13
+ */
14
+ isDirectory?: boolean;
15
+ /**
16
+ * When `true`, will check if the path is a file as well. File symlinks are
17
+ * included.
18
+ *
19
+ * @default {false}
20
+ */
21
+ isFile?: boolean;
22
+ }
23
+ /**
24
+ * Asynchronously test whether or not the given path exists by checking with
25
+ * the file system.
26
+ *
27
+ * Note: Do not use this function if performing a check before another operation
28
+ * on that file. Doing so creates a race condition. Instead, perform the actual
29
+ * file operation directly. This function is not recommended for this use case.
30
+ * See the recommended method below.
31
+ *
32
+ * @see {@link https://en.wikipedia.org/wiki/Time-of-check_to_time-of-use} for
33
+ * more information on the time-of-check to time-of-use bug.
34
+ *
35
+ * Requires `--allow-read` permissions, and in some cases, `--allow-sys`
36
+ * permissions if `options.isReadable` is `true`.
37
+ *
38
+ * @see {@link https://docs.deno.com/runtime/manual/basics/permissions#file-system-access}
39
+ * for more information on Deno's permissions system.
40
+ *
41
+ * @param path The path to the file or directory, as a string or URL.
42
+ * @param options Additional options for the check.
43
+ *
44
+ * @returns A promise that resolves with `true` if the path exists, `false`
45
+ * otherwise.
46
+ *
47
+ * @example Recommended method
48
+ * ```ts ignore
49
+ * // Notice no use of exists
50
+ * try {
51
+ * await Deno.remove("./foo", { recursive: true });
52
+ * } catch (error) {
53
+ * if (!(error instanceof Deno.errors.NotFound)) {
54
+ * throw error;
55
+ * }
56
+ * // Do nothing...
57
+ * }
58
+ * ```
59
+ *
60
+ * Notice that `exists()` is not used in the above example. Doing so avoids a
61
+ * possible race condition. See the above note for details.
62
+ *
63
+ * @example Basic usage
64
+ * ```ts ignore
65
+ * import { exists } from "@std/fs/exists";
66
+ *
67
+ * await exists("./exists"); // true
68
+ * await exists("./does_not_exist"); // false
69
+ * ```
70
+ *
71
+ * @example Check if a path is readable
72
+ *
73
+ * Requires `--allow-sys` permissions in some cases.
74
+ *
75
+ * ```ts ignore
76
+ * import { exists } from "@std/fs/exists";
77
+ *
78
+ * await exists("./readable", { isReadable: true }); // true
79
+ * await exists("./not_readable", { isReadable: true }); // false
80
+ * ```
81
+ *
82
+ * @example Check if a path is a directory
83
+ * ```ts ignore
84
+ * import { exists } from "@std/fs/exists";
85
+ *
86
+ * await exists("./directory", { isDirectory: true }); // true
87
+ * await exists("./file", { isDirectory: true }); // false
88
+ * ```
89
+ *
90
+ * @example Check if a path is a file
91
+ * ```ts ignore
92
+ * import { exists } from "@std/fs/exists";
93
+ *
94
+ * await exists("./file", { isFile: true }); // true
95
+ * await exists("./directory", { isFile: true }); // false
96
+ * ```
97
+ *
98
+ * @example Check if a path is a readable directory
99
+ *
100
+ * Requires `--allow-sys` permissions in some cases.
101
+ *
102
+ * ```ts ignore
103
+ * import { exists } from "@std/fs/exists";
104
+ *
105
+ * await exists("./readable_directory", { isReadable: true, isDirectory: true }); // true
106
+ * await exists("./not_readable_directory", { isReadable: true, isDirectory: true }); // false
107
+ * ```
108
+ *
109
+ * @example Check if a path is a readable file
110
+ *
111
+ * Requires `--allow-sys` permissions in some cases.
112
+ *
113
+ * ```ts ignore
114
+ * import { exists } from "@std/fs/exists";
115
+ *
116
+ * await exists("./readable_file", { isReadable: true, isFile: true }); // true
117
+ * await exists("./not_readable_file", { isReadable: true, isFile: true }); // false
118
+ * ```
119
+ */
120
+ export declare function exists(path: string | URL, options?: ExistsOptions): Promise<boolean>;
121
+ /**
122
+ * Synchronously test whether or not the given path exists by checking with
123
+ * the file system.
124
+ *
125
+ * Note: Do not use this function if performing a check before another operation
126
+ * on that file. Doing so creates a race condition. Instead, perform the actual
127
+ * file operation directly. This function is not recommended for this use case.
128
+ * See the recommended method below.
129
+ *
130
+ * @see {@link https://en.wikipedia.org/wiki/Time-of-check_to_time-of-use} for
131
+ * more information on the time-of-check to time-of-use bug.
132
+ *
133
+ * Requires `--allow-read` permissions, and in some cases, `--allow-sys`
134
+ * permissions if `options.isReadable` is `true`.
135
+ *
136
+ * @see {@link https://docs.deno.com/runtime/manual/basics/permissions#file-system-access}
137
+ * for more information on Deno's permissions system.
138
+ *
139
+ * @param path The path to the file or directory, as a string or URL.
140
+ * @param options Additional options for the check.
141
+ *
142
+ * @returns `true` if the path exists, `false` otherwise.
143
+ *
144
+ * @example Recommended method
145
+ * ```ts ignore
146
+ * // Notice no use of exists
147
+ * try {
148
+ * Deno.removeSync("./foo", { recursive: true });
149
+ * } catch (error) {
150
+ * if (!(error instanceof Deno.errors.NotFound)) {
151
+ * throw error;
152
+ * }
153
+ * // Do nothing...
154
+ * }
155
+ * ```
156
+ *
157
+ * Notice that `existsSync()` is not used in the above example. Doing so avoids
158
+ * a possible race condition. See the above note for details.
159
+ *
160
+ * @example Basic usage
161
+ * ```ts ignore
162
+ * import { existsSync } from "@std/fs/exists";
163
+ *
164
+ * existsSync("./exists"); // true
165
+ * existsSync("./does_not_exist"); // false
166
+ * ```
167
+ *
168
+ * @example Check if a path is readable
169
+ *
170
+ * Requires `--allow-sys` permissions in some cases.
171
+ *
172
+ * ```ts ignore
173
+ * import { existsSync } from "@std/fs/exists";
174
+ *
175
+ * existsSync("./readable", { isReadable: true }); // true
176
+ * existsSync("./not_readable", { isReadable: true }); // false
177
+ * ```
178
+ *
179
+ * @example Check if a path is a directory
180
+ * ```ts ignore
181
+ * import { existsSync } from "@std/fs/exists";
182
+ *
183
+ * existsSync("./directory", { isDirectory: true }); // true
184
+ * existsSync("./file", { isDirectory: true }); // false
185
+ * ```
186
+ *
187
+ * @example Check if a path is a file
188
+ * ```ts ignore
189
+ * import { existsSync } from "@std/fs/exists";
190
+ *
191
+ * existsSync("./file", { isFile: true }); // true
192
+ * existsSync("./directory", { isFile: true }); // false
193
+ * ```
194
+ *
195
+ * @example Check if a path is a readable directory
196
+ *
197
+ * Requires `--allow-sys` permissions in some cases.
198
+ *
199
+ * ```ts ignore
200
+ * import { existsSync } from "@std/fs/exists";
201
+ *
202
+ * existsSync("./readable_directory", { isReadable: true, isDirectory: true }); // true
203
+ * existsSync("./not_readable_directory", { isReadable: true, isDirectory: true }); // false
204
+ * ```
205
+ *
206
+ * @example Check if a path is a readable file
207
+ *
208
+ * Requires `--allow-sys` permissions in some cases.
209
+ *
210
+ * ```ts ignore
211
+ * import { existsSync } from "@std/fs/exists";
212
+ *
213
+ * existsSync("./readable_file", { isReadable: true, isFile: true }); // true
214
+ * existsSync("./not_readable_file", { isReadable: true, isFile: true }); // false
215
+ * ```
216
+ */
217
+ export declare function existsSync(path: string | URL, options?: ExistsOptions): boolean;
218
+ //# sourceMappingURL=exists.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"exists.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/fs/1.0.22/exists.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,aAAa;IAC5B;;;;OAIG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;;;OAKG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;;;;OAKG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgGG;AACH,wBAAsB,MAAM,CAC1B,IAAI,EAAE,MAAM,GAAG,GAAG,EAClB,OAAO,CAAC,EAAE,aAAa,GACtB,OAAO,CAAC,OAAO,CAAC,CAsClB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+FG;AACH,wBAAgB,UAAU,CACxB,IAAI,EAAE,MAAM,GAAG,GAAG,EAClB,OAAO,CAAC,EAAE,aAAa,GACtB,OAAO,CAqCT"}
@@ -0,0 +1,271 @@
1
+ // Copyright 2018-2026 the Deno authors. MIT license.
2
+ /** Options for {@linkcode exists} and {@linkcode existsSync.} */
3
+ import * as dntShim from "../../../../../_dnt.shims.js";
4
+ /**
5
+ * Asynchronously test whether or not the given path exists by checking with
6
+ * the file system.
7
+ *
8
+ * Note: Do not use this function if performing a check before another operation
9
+ * on that file. Doing so creates a race condition. Instead, perform the actual
10
+ * file operation directly. This function is not recommended for this use case.
11
+ * See the recommended method below.
12
+ *
13
+ * @see {@link https://en.wikipedia.org/wiki/Time-of-check_to_time-of-use} for
14
+ * more information on the time-of-check to time-of-use bug.
15
+ *
16
+ * Requires `--allow-read` permissions, and in some cases, `--allow-sys`
17
+ * permissions if `options.isReadable` is `true`.
18
+ *
19
+ * @see {@link https://docs.deno.com/runtime/manual/basics/permissions#file-system-access}
20
+ * for more information on Deno's permissions system.
21
+ *
22
+ * @param path The path to the file or directory, as a string or URL.
23
+ * @param options Additional options for the check.
24
+ *
25
+ * @returns A promise that resolves with `true` if the path exists, `false`
26
+ * otherwise.
27
+ *
28
+ * @example Recommended method
29
+ * ```ts ignore
30
+ * // Notice no use of exists
31
+ * try {
32
+ * await Deno.remove("./foo", { recursive: true });
33
+ * } catch (error) {
34
+ * if (!(error instanceof Deno.errors.NotFound)) {
35
+ * throw error;
36
+ * }
37
+ * // Do nothing...
38
+ * }
39
+ * ```
40
+ *
41
+ * Notice that `exists()` is not used in the above example. Doing so avoids a
42
+ * possible race condition. See the above note for details.
43
+ *
44
+ * @example Basic usage
45
+ * ```ts ignore
46
+ * import { exists } from "@std/fs/exists";
47
+ *
48
+ * await exists("./exists"); // true
49
+ * await exists("./does_not_exist"); // false
50
+ * ```
51
+ *
52
+ * @example Check if a path is readable
53
+ *
54
+ * Requires `--allow-sys` permissions in some cases.
55
+ *
56
+ * ```ts ignore
57
+ * import { exists } from "@std/fs/exists";
58
+ *
59
+ * await exists("./readable", { isReadable: true }); // true
60
+ * await exists("./not_readable", { isReadable: true }); // false
61
+ * ```
62
+ *
63
+ * @example Check if a path is a directory
64
+ * ```ts ignore
65
+ * import { exists } from "@std/fs/exists";
66
+ *
67
+ * await exists("./directory", { isDirectory: true }); // true
68
+ * await exists("./file", { isDirectory: true }); // false
69
+ * ```
70
+ *
71
+ * @example Check if a path is a file
72
+ * ```ts ignore
73
+ * import { exists } from "@std/fs/exists";
74
+ *
75
+ * await exists("./file", { isFile: true }); // true
76
+ * await exists("./directory", { isFile: true }); // false
77
+ * ```
78
+ *
79
+ * @example Check if a path is a readable directory
80
+ *
81
+ * Requires `--allow-sys` permissions in some cases.
82
+ *
83
+ * ```ts ignore
84
+ * import { exists } from "@std/fs/exists";
85
+ *
86
+ * await exists("./readable_directory", { isReadable: true, isDirectory: true }); // true
87
+ * await exists("./not_readable_directory", { isReadable: true, isDirectory: true }); // false
88
+ * ```
89
+ *
90
+ * @example Check if a path is a readable file
91
+ *
92
+ * Requires `--allow-sys` permissions in some cases.
93
+ *
94
+ * ```ts ignore
95
+ * import { exists } from "@std/fs/exists";
96
+ *
97
+ * await exists("./readable_file", { isReadable: true, isFile: true }); // true
98
+ * await exists("./not_readable_file", { isReadable: true, isFile: true }); // false
99
+ * ```
100
+ */
101
+ export async function exists(path, options) {
102
+ try {
103
+ const stat = await dntShim.Deno.stat(path);
104
+ if (options &&
105
+ (options.isReadable || options.isDirectory || options.isFile)) {
106
+ if (options.isDirectory && options.isFile) {
107
+ throw new TypeError("ExistsOptions.options.isDirectory and ExistsOptions.options.isFile must not be true together");
108
+ }
109
+ if ((options.isDirectory && !stat.isDirectory) ||
110
+ (options.isFile && !stat.isFile)) {
111
+ return false;
112
+ }
113
+ if (options.isReadable) {
114
+ return fileIsReadable(stat);
115
+ }
116
+ }
117
+ return true;
118
+ }
119
+ catch (error) {
120
+ if (error instanceof dntShim.Deno.errors.NotFound) {
121
+ return false;
122
+ }
123
+ if (error instanceof dntShim.Deno.errors.PermissionDenied) {
124
+ if ((await dntShim.Deno.permissions.query({ name: "read", path })).state ===
125
+ "granted") {
126
+ // --allow-read not missing
127
+ return !options?.isReadable; // PermissionDenied was raised by file system, so the item exists, but can't be read
128
+ }
129
+ }
130
+ throw error;
131
+ }
132
+ }
133
+ /**
134
+ * Synchronously test whether or not the given path exists by checking with
135
+ * the file system.
136
+ *
137
+ * Note: Do not use this function if performing a check before another operation
138
+ * on that file. Doing so creates a race condition. Instead, perform the actual
139
+ * file operation directly. This function is not recommended for this use case.
140
+ * See the recommended method below.
141
+ *
142
+ * @see {@link https://en.wikipedia.org/wiki/Time-of-check_to_time-of-use} for
143
+ * more information on the time-of-check to time-of-use bug.
144
+ *
145
+ * Requires `--allow-read` permissions, and in some cases, `--allow-sys`
146
+ * permissions if `options.isReadable` is `true`.
147
+ *
148
+ * @see {@link https://docs.deno.com/runtime/manual/basics/permissions#file-system-access}
149
+ * for more information on Deno's permissions system.
150
+ *
151
+ * @param path The path to the file or directory, as a string or URL.
152
+ * @param options Additional options for the check.
153
+ *
154
+ * @returns `true` if the path exists, `false` otherwise.
155
+ *
156
+ * @example Recommended method
157
+ * ```ts ignore
158
+ * // Notice no use of exists
159
+ * try {
160
+ * Deno.removeSync("./foo", { recursive: true });
161
+ * } catch (error) {
162
+ * if (!(error instanceof Deno.errors.NotFound)) {
163
+ * throw error;
164
+ * }
165
+ * // Do nothing...
166
+ * }
167
+ * ```
168
+ *
169
+ * Notice that `existsSync()` is not used in the above example. Doing so avoids
170
+ * a possible race condition. See the above note for details.
171
+ *
172
+ * @example Basic usage
173
+ * ```ts ignore
174
+ * import { existsSync } from "@std/fs/exists";
175
+ *
176
+ * existsSync("./exists"); // true
177
+ * existsSync("./does_not_exist"); // false
178
+ * ```
179
+ *
180
+ * @example Check if a path is readable
181
+ *
182
+ * Requires `--allow-sys` permissions in some cases.
183
+ *
184
+ * ```ts ignore
185
+ * import { existsSync } from "@std/fs/exists";
186
+ *
187
+ * existsSync("./readable", { isReadable: true }); // true
188
+ * existsSync("./not_readable", { isReadable: true }); // false
189
+ * ```
190
+ *
191
+ * @example Check if a path is a directory
192
+ * ```ts ignore
193
+ * import { existsSync } from "@std/fs/exists";
194
+ *
195
+ * existsSync("./directory", { isDirectory: true }); // true
196
+ * existsSync("./file", { isDirectory: true }); // false
197
+ * ```
198
+ *
199
+ * @example Check if a path is a file
200
+ * ```ts ignore
201
+ * import { existsSync } from "@std/fs/exists";
202
+ *
203
+ * existsSync("./file", { isFile: true }); // true
204
+ * existsSync("./directory", { isFile: true }); // false
205
+ * ```
206
+ *
207
+ * @example Check if a path is a readable directory
208
+ *
209
+ * Requires `--allow-sys` permissions in some cases.
210
+ *
211
+ * ```ts ignore
212
+ * import { existsSync } from "@std/fs/exists";
213
+ *
214
+ * existsSync("./readable_directory", { isReadable: true, isDirectory: true }); // true
215
+ * existsSync("./not_readable_directory", { isReadable: true, isDirectory: true }); // false
216
+ * ```
217
+ *
218
+ * @example Check if a path is a readable file
219
+ *
220
+ * Requires `--allow-sys` permissions in some cases.
221
+ *
222
+ * ```ts ignore
223
+ * import { existsSync } from "@std/fs/exists";
224
+ *
225
+ * existsSync("./readable_file", { isReadable: true, isFile: true }); // true
226
+ * existsSync("./not_readable_file", { isReadable: true, isFile: true }); // false
227
+ * ```
228
+ */
229
+ export function existsSync(path, options) {
230
+ try {
231
+ const stat = dntShim.Deno.statSync(path);
232
+ if (options &&
233
+ (options.isReadable || options.isDirectory || options.isFile)) {
234
+ if (options.isDirectory && options.isFile) {
235
+ throw new TypeError("ExistsOptions.options.isDirectory and ExistsOptions.options.isFile must not be true together");
236
+ }
237
+ if ((options.isDirectory && !stat.isDirectory) ||
238
+ (options.isFile && !stat.isFile)) {
239
+ return false;
240
+ }
241
+ if (options.isReadable) {
242
+ return fileIsReadable(stat);
243
+ }
244
+ }
245
+ return true;
246
+ }
247
+ catch (error) {
248
+ if (error instanceof dntShim.Deno.errors.NotFound) {
249
+ return false;
250
+ }
251
+ if (error instanceof dntShim.Deno.errors.PermissionDenied) {
252
+ if (dntShim.Deno.permissions.querySync({ name: "read", path }).state === "granted") {
253
+ // --allow-read not missing
254
+ return !options?.isReadable; // PermissionDenied was raised by file system, so the item exists, but can't be read
255
+ }
256
+ }
257
+ throw error;
258
+ }
259
+ }
260
+ function fileIsReadable(stat) {
261
+ if (stat.mode === null) {
262
+ return true; // Exclusive on Non-POSIX systems
263
+ }
264
+ else if (dntShim.Deno.uid() === stat.uid) {
265
+ return (stat.mode & 0o400) === 0o400; // User is owner and can read?
266
+ }
267
+ else if (dntShim.Deno.gid() === stat.gid) {
268
+ return (stat.mode & 0o040) === 0o040; // User group is owner and can read?
269
+ }
270
+ return (stat.mode & 0o004) === 0o004; // Others can read?
271
+ }