@vibesdotdev/host-bun 0.0.0-stage → 1.0.0-rc.2

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 (517) hide show
  1. package/LICENSE +18 -0
  2. package/README.md +222 -2
  3. package/dist/applet-serve-host/applet-serve-host.impl.bun.d.ts +6 -0
  4. package/dist/applet-serve-host/applet-serve-host.impl.bun.d.ts.map +1 -0
  5. package/dist/applet-serve-host/applet-serve-host.impl.bun.js +80 -0
  6. package/dist/applet-serve-host/applet-serve-host.impl.bun.js.map +1 -0
  7. package/dist/applet-serve-host/applet-serve-host.plugin.d.ts +22 -0
  8. package/dist/applet-serve-host/applet-serve-host.plugin.d.ts.map +1 -0
  9. package/dist/applet-serve-host/applet-serve-host.plugin.js +42 -0
  10. package/dist/applet-serve-host/applet-serve-host.plugin.js.map +1 -0
  11. package/dist/applet-serve-host/index.d.ts +7 -0
  12. package/dist/applet-serve-host/index.d.ts.map +1 -0
  13. package/dist/applet-serve-host/index.js +7 -0
  14. package/dist/applet-serve-host/index.js.map +1 -0
  15. package/dist/applet-serve-host/stylesheet.compiler.d.ts +7 -0
  16. package/dist/applet-serve-host/stylesheet.compiler.d.ts.map +1 -0
  17. package/dist/applet-serve-host/stylesheet.compiler.js +63 -0
  18. package/dist/applet-serve-host/stylesheet.compiler.js.map +1 -0
  19. package/dist/atlas-migrations/register-atlas-host-migrations.d.ts +21 -0
  20. package/dist/atlas-migrations/register-atlas-host-migrations.d.ts.map +1 -0
  21. package/dist/atlas-migrations/register-atlas-host-migrations.js +148 -0
  22. package/dist/atlas-migrations/register-atlas-host-migrations.js.map +1 -0
  23. package/dist/buffered-capture.d.ts +4 -0
  24. package/dist/buffered-capture.d.ts.map +1 -0
  25. package/dist/buffered-capture.impl.bun.d.ts +18 -0
  26. package/dist/buffered-capture.impl.bun.d.ts.map +1 -0
  27. package/dist/buffered-capture.impl.bun.js +148 -0
  28. package/dist/buffered-capture.impl.bun.js.map +1 -0
  29. package/dist/buffered-capture.js +5 -0
  30. package/dist/buffered-capture.js.map +1 -0
  31. package/dist/bun-environment.impl.bun.d.ts +231 -0
  32. package/dist/bun-environment.impl.bun.d.ts.map +1 -0
  33. package/dist/bun-environment.impl.bun.js +352 -0
  34. package/dist/bun-environment.impl.bun.js.map +1 -0
  35. package/dist/cache-redis/cache-redis-connector.impl.bun.d.ts +20 -0
  36. package/dist/cache-redis/cache-redis-connector.impl.bun.d.ts.map +1 -0
  37. package/dist/cache-redis/cache-redis-connector.impl.bun.js +30 -0
  38. package/dist/cache-redis/cache-redis-connector.impl.bun.js.map +1 -0
  39. package/dist/cache-redis/cache-redis-connector.plugin.d.ts +21 -0
  40. package/dist/cache-redis/cache-redis-connector.plugin.d.ts.map +1 -0
  41. package/dist/cache-redis/cache-redis-connector.plugin.js +32 -0
  42. package/dist/cache-redis/cache-redis-connector.plugin.js.map +1 -0
  43. package/dist/cli-checkout.impl.bun.d.ts +13 -0
  44. package/dist/cli-checkout.impl.bun.d.ts.map +1 -0
  45. package/dist/cli-checkout.impl.bun.js +26 -0
  46. package/dist/cli-checkout.impl.bun.js.map +1 -0
  47. package/dist/docs/runtime-environment-bun.docs.descriptor.d.ts +19 -0
  48. package/dist/docs/runtime-environment-bun.docs.descriptor.d.ts.map +1 -0
  49. package/dist/docs/runtime-environment-bun.docs.descriptor.js +116 -0
  50. package/dist/docs/runtime-environment-bun.docs.descriptor.js.map +1 -0
  51. package/dist/filesystem/adapter.impl.bun.d.ts +15 -0
  52. package/dist/filesystem/adapter.impl.bun.d.ts.map +1 -0
  53. package/dist/filesystem/adapter.impl.bun.js +11 -0
  54. package/dist/filesystem/adapter.impl.bun.js.map +1 -0
  55. package/dist/filesystem/host-primitives.impl.bun.d.ts +12 -0
  56. package/dist/filesystem/host-primitives.impl.bun.d.ts.map +1 -0
  57. package/dist/filesystem/host-primitives.impl.bun.js +96 -0
  58. package/dist/filesystem/host-primitives.impl.bun.js.map +1 -0
  59. package/dist/filesystem/register.d.ts +12 -0
  60. package/dist/filesystem/register.d.ts.map +1 -0
  61. package/dist/filesystem/register.js +6 -0
  62. package/dist/filesystem/register.js.map +1 -0
  63. package/dist/filesystem/rooted-exclusive.impl.bun.d.ts +4 -0
  64. package/dist/filesystem/rooted-exclusive.impl.bun.d.ts.map +1 -0
  65. package/dist/filesystem/rooted-exclusive.impl.bun.js +135 -0
  66. package/dist/filesystem/rooted-exclusive.impl.bun.js.map +1 -0
  67. package/dist/held-launch/abi.impl.bun.d.ts +175 -0
  68. package/dist/held-launch/abi.impl.bun.d.ts.map +1 -0
  69. package/dist/held-launch/abi.impl.bun.js +476 -0
  70. package/dist/held-launch/abi.impl.bun.js.map +1 -0
  71. package/dist/held-launch/execution.impl.bun.d.ts +48 -0
  72. package/dist/held-launch/execution.impl.bun.d.ts.map +1 -0
  73. package/dist/held-launch/execution.impl.bun.js +375 -0
  74. package/dist/held-launch/execution.impl.bun.js.map +1 -0
  75. package/dist/held-launch/library.impl.bun.d.ts +23 -0
  76. package/dist/held-launch/library.impl.bun.d.ts.map +1 -0
  77. package/dist/held-launch/library.impl.bun.js +178 -0
  78. package/dist/held-launch/library.impl.bun.js.map +1 -0
  79. package/dist/held-launch/schemas.d.ts +10 -0
  80. package/dist/held-launch/schemas.d.ts.map +1 -0
  81. package/dist/held-launch/schemas.js +3 -0
  82. package/dist/held-launch/schemas.js.map +1 -0
  83. package/dist/held-launch/streams.impl.bun.d.ts +38 -0
  84. package/dist/held-launch/streams.impl.bun.d.ts.map +1 -0
  85. package/dist/held-launch/streams.impl.bun.js +183 -0
  86. package/dist/held-launch/streams.impl.bun.js.map +1 -0
  87. package/dist/host-channel.impl.bun.d.ts +25 -0
  88. package/dist/host-channel.impl.bun.d.ts.map +1 -0
  89. package/dist/host-channel.impl.bun.js +40 -0
  90. package/dist/host-channel.impl.bun.js.map +1 -0
  91. package/dist/host-client.impl.bun.d.ts +31 -0
  92. package/dist/host-client.impl.bun.d.ts.map +1 -0
  93. package/dist/host-client.impl.bun.js +39 -0
  94. package/dist/host-client.impl.bun.js.map +1 -0
  95. package/dist/host-credentials.d.ts +38 -0
  96. package/dist/host-credentials.d.ts.map +1 -0
  97. package/dist/host-credentials.js +44 -0
  98. package/dist/host-credentials.js.map +1 -0
  99. package/dist/host-loader.impl.bun.d.ts +12 -0
  100. package/dist/host-loader.impl.bun.d.ts.map +1 -0
  101. package/dist/host-loader.impl.bun.js +83 -0
  102. package/dist/host-loader.impl.bun.js.map +1 -0
  103. package/dist/host-signal.impl.bun.d.ts +11 -0
  104. package/dist/host-signal.impl.bun.d.ts.map +1 -0
  105. package/dist/host-signal.impl.bun.js +28 -0
  106. package/dist/host-signal.impl.bun.js.map +1 -0
  107. package/dist/http-listener.impl.bun.d.ts +8 -0
  108. package/dist/http-listener.impl.bun.d.ts.map +1 -0
  109. package/dist/http-listener.impl.bun.js +44 -0
  110. package/dist/http-listener.impl.bun.js.map +1 -0
  111. package/dist/index.d.ts +38 -0
  112. package/dist/index.d.ts.map +1 -0
  113. package/dist/index.js +314 -0
  114. package/dist/index.js.map +1 -0
  115. package/dist/local-execution.impl.bun.d.ts +47 -0
  116. package/dist/local-execution.impl.bun.d.ts.map +1 -0
  117. package/dist/local-execution.impl.bun.js +150 -0
  118. package/dist/local-execution.impl.bun.js.map +1 -0
  119. package/dist/logging/file-host.impl.bun.d.ts +4 -0
  120. package/dist/logging/file-host.impl.bun.d.ts.map +1 -0
  121. package/dist/logging/file-host.impl.bun.js +36 -0
  122. package/dist/logging/file-host.impl.bun.js.map +1 -0
  123. package/dist/logging/logging.plugin.d.ts +12 -0
  124. package/dist/logging/logging.plugin.d.ts.map +1 -0
  125. package/dist/logging/logging.plugin.js +20 -0
  126. package/dist/logging/logging.plugin.js.map +1 -0
  127. package/dist/native/held-launch/aarch64-apple-darwin/libvibes_held_launch.dylib +0 -0
  128. package/dist/native/held-launch/aarch64-apple-darwin/manifest.json +237 -0
  129. package/dist/native/held-launch/aarch64-apple-darwin/vibes-held-launch +0 -0
  130. package/dist/native/held-launch/aarch64-unknown-linux-gnu/libvibes_held_launch.so +0 -0
  131. package/dist/native/held-launch/aarch64-unknown-linux-gnu/manifest.json +237 -0
  132. package/dist/native/held-launch/aarch64-unknown-linux-gnu/vibes-held-launch +0 -0
  133. package/dist/native/held-launch/x86_64-apple-darwin/libvibes_held_launch.dylib +0 -0
  134. package/dist/native/held-launch/x86_64-apple-darwin/manifest.json +237 -0
  135. package/dist/native/held-launch/x86_64-apple-darwin/vibes-held-launch +0 -0
  136. package/dist/native/held-launch/x86_64-unknown-linux-gnu/libvibes_held_launch.so +0 -0
  137. package/dist/native/held-launch/x86_64-unknown-linux-gnu/manifest.json +237 -0
  138. package/dist/native/held-launch/x86_64-unknown-linux-gnu/vibes-held-launch +0 -0
  139. package/dist/native-image.consumer.plugin.d.ts +4 -0
  140. package/dist/native-image.consumer.plugin.d.ts.map +1 -0
  141. package/dist/native-image.consumer.plugin.js +14 -0
  142. package/dist/native-image.consumer.plugin.js.map +1 -0
  143. package/dist/native-image.d.ts +79 -0
  144. package/dist/native-image.d.ts.map +1 -0
  145. package/dist/native-image.impl.consumer.d.ts +15 -0
  146. package/dist/native-image.impl.consumer.d.ts.map +1 -0
  147. package/dist/native-image.impl.consumer.js +86 -0
  148. package/dist/native-image.impl.consumer.js.map +1 -0
  149. package/dist/native-image.js +19 -0
  150. package/dist/native-image.js.map +1 -0
  151. package/dist/native-library.consumer.plugin.d.ts +6 -0
  152. package/dist/native-library.consumer.plugin.d.ts.map +1 -0
  153. package/dist/native-library.consumer.plugin.js +33 -0
  154. package/dist/native-library.consumer.plugin.js.map +1 -0
  155. package/dist/native-library.impl.consumer.d.ts +14 -0
  156. package/dist/native-library.impl.consumer.d.ts.map +1 -0
  157. package/dist/native-library.impl.consumer.js +46 -0
  158. package/dist/native-library.impl.consumer.js.map +1 -0
  159. package/dist/native-network/index.d.ts +3 -0
  160. package/dist/native-network/index.d.ts.map +1 -0
  161. package/dist/native-network/index.js +3 -0
  162. package/dist/native-network/index.js.map +1 -0
  163. package/dist/native-network/native-host.d.ts +4 -0
  164. package/dist/native-network/native-host.d.ts.map +1 -0
  165. package/dist/native-network/native-host.js +14 -0
  166. package/dist/native-network/native-host.js.map +1 -0
  167. package/dist/native-network/native-network.descriptor.d.ts +4 -0
  168. package/dist/native-network/native-network.descriptor.d.ts.map +1 -0
  169. package/dist/native-network/native-network.descriptor.js +11 -0
  170. package/dist/native-network/native-network.descriptor.js.map +1 -0
  171. package/dist/native-network/native-network.impl.bun.d.ts +19 -0
  172. package/dist/native-network/native-network.impl.bun.d.ts.map +1 -0
  173. package/dist/native-network/native-network.impl.bun.js +190 -0
  174. package/dist/native-network/native-network.impl.bun.js.map +1 -0
  175. package/dist/native-network/native-network.plugin.d.ts +6 -0
  176. package/dist/native-network/native-network.plugin.d.ts.map +1 -0
  177. package/dist/native-network/native-network.plugin.js +27 -0
  178. package/dist/native-network/native-network.plugin.js.map +1 -0
  179. package/dist/package-plugins/index.d.ts +11 -0
  180. package/dist/package-plugins/index.d.ts.map +1 -0
  181. package/dist/package-plugins/index.js +11 -0
  182. package/dist/package-plugins/index.js.map +1 -0
  183. package/dist/package-plugins/package-plugins.capability.bun.d.ts +11 -0
  184. package/dist/package-plugins/package-plugins.capability.bun.d.ts.map +1 -0
  185. package/dist/package-plugins/package-plugins.capability.bun.js +14 -0
  186. package/dist/package-plugins/package-plugins.capability.bun.js.map +1 -0
  187. package/dist/package-plugins/primitives.impl.bun.d.ts +11 -0
  188. package/dist/package-plugins/primitives.impl.bun.d.ts.map +1 -0
  189. package/dist/package-plugins/primitives.impl.bun.js +32 -0
  190. package/dist/package-plugins/primitives.impl.bun.js.map +1 -0
  191. package/dist/package-plugins/read-admission.impl.bun.d.ts +11 -0
  192. package/dist/package-plugins/read-admission.impl.bun.d.ts.map +1 -0
  193. package/dist/package-plugins/read-admission.impl.bun.js +224 -0
  194. package/dist/package-plugins/read-admission.impl.bun.js.map +1 -0
  195. package/dist/package-plugins/schemas.d.ts +28 -0
  196. package/dist/package-plugins/schemas.d.ts.map +1 -0
  197. package/dist/package-plugins/schemas.js +3 -0
  198. package/dist/package-plugins/schemas.js.map +1 -0
  199. package/dist/process/launch-artifacts.impl.bun.d.ts +11 -0
  200. package/dist/process/launch-artifacts.impl.bun.d.ts.map +1 -0
  201. package/dist/process/launch-artifacts.impl.bun.js +25 -0
  202. package/dist/process/launch-artifacts.impl.bun.js.map +1 -0
  203. package/dist/process/process-probe.impl.bun.d.ts +15 -0
  204. package/dist/process/process-probe.impl.bun.d.ts.map +1 -0
  205. package/dist/process/process-probe.impl.bun.js +35 -0
  206. package/dist/process/process-probe.impl.bun.js.map +1 -0
  207. package/dist/process/runtime-process.impl.bun.d.ts +20 -0
  208. package/dist/process/runtime-process.impl.bun.d.ts.map +1 -0
  209. package/dist/process/runtime-process.impl.bun.js +42 -0
  210. package/dist/process/runtime-process.impl.bun.js.map +1 -0
  211. package/dist/process/schemas.d.ts +9 -0
  212. package/dist/process/schemas.d.ts.map +1 -0
  213. package/dist/process/schemas.js +3 -0
  214. package/dist/process/schemas.js.map +1 -0
  215. package/dist/process/spawn.impl.bun.d.ts +31 -0
  216. package/dist/process/spawn.impl.bun.d.ts.map +1 -0
  217. package/dist/process/spawn.impl.bun.js +66 -0
  218. package/dist/process/spawn.impl.bun.js.map +1 -0
  219. package/dist/process/which.impl.bun.d.ts +16 -0
  220. package/dist/process/which.impl.bun.d.ts.map +1 -0
  221. package/dist/process/which.impl.bun.js +25 -0
  222. package/dist/process/which.impl.bun.js.map +1 -0
  223. package/dist/pty.adapter.impl.bun.d.ts +17 -0
  224. package/dist/pty.adapter.impl.bun.d.ts.map +1 -0
  225. package/dist/pty.adapter.impl.bun.js +102 -0
  226. package/dist/pty.adapter.impl.bun.js.map +1 -0
  227. package/dist/pty.darwin.impl.bun.d.ts +11 -0
  228. package/dist/pty.darwin.impl.bun.d.ts.map +1 -0
  229. package/dist/pty.darwin.impl.bun.js +200 -0
  230. package/dist/pty.darwin.impl.bun.js.map +1 -0
  231. package/dist/pty.node-host.impl.bun.d.ts +10 -0
  232. package/dist/pty.node-host.impl.bun.d.ts.map +1 -0
  233. package/dist/pty.node-host.impl.bun.js +42 -0
  234. package/dist/pty.node-host.impl.bun.js.map +1 -0
  235. package/dist/resolution-root.impl.bun.d.ts +170 -0
  236. package/dist/resolution-root.impl.bun.d.ts.map +1 -0
  237. package/dist/resolution-root.impl.bun.js +373 -0
  238. package/dist/resolution-root.impl.bun.js.map +1 -0
  239. package/dist/restricted-execute.darwin.impl.bun.d.ts +19 -0
  240. package/dist/restricted-execute.darwin.impl.bun.d.ts.map +1 -0
  241. package/dist/restricted-execute.darwin.impl.bun.js +459 -0
  242. package/dist/restricted-execute.darwin.impl.bun.js.map +1 -0
  243. package/dist/runtime-plugin-host/daemon-execution.worker-shim.bun.d.ts +2 -0
  244. package/dist/runtime-plugin-host/daemon-execution.worker-shim.bun.d.ts.map +1 -0
  245. package/dist/runtime-plugin-host/daemon-execution.worker-shim.bun.js +31 -0
  246. package/dist/runtime-plugin-host/daemon-execution.worker-shim.bun.js.map +1 -0
  247. package/dist/runtime-plugin-host/host-hot-reload.consumer.d.ts +20 -0
  248. package/dist/runtime-plugin-host/host-hot-reload.consumer.d.ts.map +1 -0
  249. package/dist/runtime-plugin-host/host-hot-reload.consumer.js +236 -0
  250. package/dist/runtime-plugin-host/host-hot-reload.consumer.js.map +1 -0
  251. package/dist/runtime-plugin-host/hot-plugin-build.worker.consumer.d.ts +2 -0
  252. package/dist/runtime-plugin-host/hot-plugin-build.worker.consumer.d.ts.map +1 -0
  253. package/dist/runtime-plugin-host/hot-plugin-build.worker.consumer.js +66 -0
  254. package/dist/runtime-plugin-host/hot-plugin-build.worker.consumer.js.map +1 -0
  255. package/dist/runtime-plugin-host/hot-plugin-module.consumer.d.ts +45 -0
  256. package/dist/runtime-plugin-host/hot-plugin-module.consumer.d.ts.map +1 -0
  257. package/dist/runtime-plugin-host/hot-plugin-module.consumer.js +490 -0
  258. package/dist/runtime-plugin-host/hot-plugin-module.consumer.js.map +1 -0
  259. package/dist/runtime-plugin-host/hot-reload.consumer.d.ts +83 -0
  260. package/dist/runtime-plugin-host/hot-reload.consumer.d.ts.map +1 -0
  261. package/dist/runtime-plugin-host/hot-reload.consumer.js +168 -0
  262. package/dist/runtime-plugin-host/hot-reload.consumer.js.map +1 -0
  263. package/dist/runtime-plugin-host/reclaim.impl.bun.d.ts +37 -0
  264. package/dist/runtime-plugin-host/reclaim.impl.bun.d.ts.map +1 -0
  265. package/dist/runtime-plugin-host/reclaim.impl.bun.js +159 -0
  266. package/dist/runtime-plugin-host/reclaim.impl.bun.js.map +1 -0
  267. package/dist/runtime-plugin-host/runtime-plugin-host.impl.bun.d.ts +4 -0
  268. package/dist/runtime-plugin-host/runtime-plugin-host.impl.bun.d.ts.map +1 -0
  269. package/dist/runtime-plugin-host/runtime-plugin-host.impl.bun.js +181 -0
  270. package/dist/runtime-plugin-host/runtime-plugin-host.impl.bun.js.map +1 -0
  271. package/dist/runtime-plugin-host/runtime-plugin-host.plugin.d.ts +17 -0
  272. package/dist/runtime-plugin-host/runtime-plugin-host.plugin.d.ts.map +1 -0
  273. package/dist/runtime-plugin-host/runtime-plugin-host.plugin.js +36 -0
  274. package/dist/runtime-plugin-host/runtime-plugin-host.plugin.js.map +1 -0
  275. package/dist/runtime-plugin-host/runtime-thread.impl.bun.d.ts +53 -0
  276. package/dist/runtime-plugin-host/runtime-thread.impl.bun.d.ts.map +1 -0
  277. package/dist/runtime-plugin-host/runtime-thread.impl.bun.js +249 -0
  278. package/dist/runtime-plugin-host/runtime-thread.impl.bun.js.map +1 -0
  279. package/dist/runtime-plugin-host/runtime-thread.shim.bun.d.ts +2 -0
  280. package/dist/runtime-plugin-host/runtime-thread.shim.bun.d.ts.map +1 -0
  281. package/dist/runtime-plugin-host/runtime-thread.shim.bun.js +56 -0
  282. package/dist/runtime-plugin-host/runtime-thread.shim.bun.js.map +1 -0
  283. package/dist/runtime-plugin-host/schemas.d.ts +437 -0
  284. package/dist/runtime-plugin-host/schemas.d.ts.map +1 -0
  285. package/dist/runtime-plugin-host/schemas.js +54 -0
  286. package/dist/runtime-plugin-host/schemas.js.map +1 -0
  287. package/dist/runtime-plugin-host/source-watcher.consumer.d.ts +109 -0
  288. package/dist/runtime-plugin-host/source-watcher.consumer.d.ts.map +1 -0
  289. package/dist/runtime-plugin-host/source-watcher.consumer.js +383 -0
  290. package/dist/runtime-plugin-host/source-watcher.consumer.js.map +1 -0
  291. package/dist/schemas/environment.d.ts +197 -0
  292. package/dist/schemas/environment.d.ts.map +1 -0
  293. package/dist/schemas/environment.js +7 -0
  294. package/dist/schemas/environment.js.map +1 -0
  295. package/dist/schemas/host-resources.d.ts +85 -0
  296. package/dist/schemas/host-resources.d.ts.map +1 -0
  297. package/dist/schemas/host-resources.js +22 -0
  298. package/dist/schemas/host-resources.js.map +1 -0
  299. package/dist/schemas/native-image.d.ts +128 -0
  300. package/dist/schemas/native-image.d.ts.map +1 -0
  301. package/dist/schemas/native-image.js +45 -0
  302. package/dist/schemas/native-image.js.map +1 -0
  303. package/dist/schemas/native-network.d.ts +56 -0
  304. package/dist/schemas/native-network.d.ts.map +1 -0
  305. package/dist/schemas/native-network.js +55 -0
  306. package/dist/schemas/native-network.js.map +1 -0
  307. package/dist/schemas/restricted-execute.d.ts +40 -0
  308. package/dist/schemas/restricted-execute.d.ts.map +1 -0
  309. package/dist/schemas/restricted-execute.js +14 -0
  310. package/dist/schemas/restricted-execute.js.map +1 -0
  311. package/dist/schemas/runtime-socket.d.ts +8 -0
  312. package/dist/schemas/runtime-socket.d.ts.map +1 -0
  313. package/dist/schemas/runtime-socket.js +7 -0
  314. package/dist/schemas/runtime-socket.js.map +1 -0
  315. package/dist/schemas/self-spawn.d.ts +11 -0
  316. package/dist/schemas/self-spawn.d.ts.map +1 -0
  317. package/dist/schemas/self-spawn.js +3 -0
  318. package/dist/schemas/self-spawn.js.map +1 -0
  319. package/dist/schemas/standard-output.d.ts +6 -0
  320. package/dist/schemas/standard-output.d.ts.map +1 -0
  321. package/dist/schemas/standard-output.js +2 -0
  322. package/dist/schemas/standard-output.js.map +1 -0
  323. package/dist/schemas/telemetry.d.ts +25 -0
  324. package/dist/schemas/telemetry.d.ts.map +1 -0
  325. package/dist/schemas/telemetry.js +10 -0
  326. package/dist/schemas/telemetry.js.map +1 -0
  327. package/dist/schemas/test-environment.d.ts +27 -0
  328. package/dist/schemas/test-environment.d.ts.map +1 -0
  329. package/dist/schemas/test-environment.js +2 -0
  330. package/dist/schemas/test-environment.js.map +1 -0
  331. package/dist/serve-stall-start.d.ts +8 -0
  332. package/dist/serve-stall-start.d.ts.map +1 -0
  333. package/dist/serve-stall-start.js +88 -0
  334. package/dist/serve-stall-start.js.map +1 -0
  335. package/dist/serve-stall.d.ts +11 -0
  336. package/dist/serve-stall.d.ts.map +1 -0
  337. package/dist/serve-stall.js +19 -0
  338. package/dist/serve-stall.js.map +1 -0
  339. package/dist/serve-stall.plugin.d.ts +10 -0
  340. package/dist/serve-stall.plugin.d.ts.map +1 -0
  341. package/dist/serve-stall.plugin.js +34 -0
  342. package/dist/serve-stall.plugin.js.map +1 -0
  343. package/dist/services/account-home.d.ts +39 -0
  344. package/dist/services/account-home.d.ts.map +1 -0
  345. package/dist/services/account-home.js +152 -0
  346. package/dist/services/account-home.js.map +1 -0
  347. package/dist/services/cli-process-host.d.ts +50 -0
  348. package/dist/services/cli-process-host.d.ts.map +1 -0
  349. package/dist/services/cli-process-host.js +88 -0
  350. package/dist/services/cli-process-host.js.map +1 -0
  351. package/dist/services/compatibility-host.impl.bun.d.ts +4 -0
  352. package/dist/services/compatibility-host.impl.bun.d.ts.map +1 -0
  353. package/dist/services/compatibility-host.impl.bun.js +24 -0
  354. package/dist/services/compatibility-host.impl.bun.js.map +1 -0
  355. package/dist/services/executable-identity.impl.bun.d.ts +164 -0
  356. package/dist/services/executable-identity.impl.bun.d.ts.map +1 -0
  357. package/dist/services/executable-identity.impl.bun.js +73 -0
  358. package/dist/services/executable-identity.impl.bun.js.map +1 -0
  359. package/dist/services/fatal-signals.impl.bun.d.ts +15 -0
  360. package/dist/services/fatal-signals.impl.bun.d.ts.map +1 -0
  361. package/dist/services/fatal-signals.impl.bun.js +61 -0
  362. package/dist/services/fatal-signals.impl.bun.js.map +1 -0
  363. package/dist/services/graph-freshness.impl.bun.d.ts +108 -0
  364. package/dist/services/graph-freshness.impl.bun.d.ts.map +1 -0
  365. package/dist/services/graph-freshness.impl.bun.js +49 -0
  366. package/dist/services/graph-freshness.impl.bun.js.map +1 -0
  367. package/dist/services/host-identity.capability.bun.d.ts +10 -0
  368. package/dist/services/host-identity.capability.bun.d.ts.map +1 -0
  369. package/dist/services/host-identity.capability.bun.js +27 -0
  370. package/dist/services/host-identity.capability.bun.js.map +1 -0
  371. package/dist/services/host-identity.impl.bun.d.ts +53 -0
  372. package/dist/services/host-identity.impl.bun.d.ts.map +1 -0
  373. package/dist/services/host-identity.impl.bun.js +76 -0
  374. package/dist/services/host-identity.impl.bun.js.map +1 -0
  375. package/dist/services/host-resources.impl.bun.d.ts +49 -0
  376. package/dist/services/host-resources.impl.bun.d.ts.map +1 -0
  377. package/dist/services/host-resources.impl.bun.js +144 -0
  378. package/dist/services/host-resources.impl.bun.js.map +1 -0
  379. package/dist/services/http-fetch.impl.bun.d.ts +10 -0
  380. package/dist/services/http-fetch.impl.bun.d.ts.map +1 -0
  381. package/dist/services/http-fetch.impl.bun.js +38 -0
  382. package/dist/services/http-fetch.impl.bun.js.map +1 -0
  383. package/dist/services/output-plane.impl.bun.d.ts +6 -0
  384. package/dist/services/output-plane.impl.bun.d.ts.map +1 -0
  385. package/dist/services/output-plane.impl.bun.js +26 -0
  386. package/dist/services/output-plane.impl.bun.js.map +1 -0
  387. package/dist/services/process-action-lifetime.consumer.d.ts +47 -0
  388. package/dist/services/process-action-lifetime.consumer.d.ts.map +1 -0
  389. package/dist/services/process-action-lifetime.consumer.js +68 -0
  390. package/dist/services/process-action-lifetime.consumer.js.map +1 -0
  391. package/dist/services/process-view.impl.bun.d.ts +18 -0
  392. package/dist/services/process-view.impl.bun.d.ts.map +1 -0
  393. package/dist/services/process-view.impl.bun.js +17 -0
  394. package/dist/services/process-view.impl.bun.js.map +1 -0
  395. package/dist/services/runtime-host-signals.impl.bun.d.ts +8 -0
  396. package/dist/services/runtime-host-signals.impl.bun.d.ts.map +1 -0
  397. package/dist/services/runtime-host-signals.impl.bun.js +29 -0
  398. package/dist/services/runtime-host-signals.impl.bun.js.map +1 -0
  399. package/dist/services/runtime-http-listener.impl.bun.d.ts +14 -0
  400. package/dist/services/runtime-http-listener.impl.bun.d.ts.map +1 -0
  401. package/dist/services/runtime-http-listener.impl.bun.js +463 -0
  402. package/dist/services/runtime-http-listener.impl.bun.js.map +1 -0
  403. package/dist/services/runtime-path.impl.bun.d.ts +16 -0
  404. package/dist/services/runtime-path.impl.bun.d.ts.map +1 -0
  405. package/dist/services/runtime-path.impl.bun.js +34 -0
  406. package/dist/services/runtime-path.impl.bun.js.map +1 -0
  407. package/dist/services/runtime-scoped-values.impl.bun.d.ts +4 -0
  408. package/dist/services/runtime-scoped-values.impl.bun.d.ts.map +1 -0
  409. package/dist/services/runtime-scoped-values.impl.bun.js +7 -0
  410. package/dist/services/runtime-scoped-values.impl.bun.js.map +1 -0
  411. package/dist/services/runtime-socket-datagram.impl.bun.d.ts +15 -0
  412. package/dist/services/runtime-socket-datagram.impl.bun.d.ts.map +1 -0
  413. package/dist/services/runtime-socket-datagram.impl.bun.js +19 -0
  414. package/dist/services/runtime-socket-datagram.impl.bun.js.map +1 -0
  415. package/dist/services/runtime-socket.impl.bun.d.ts +20 -0
  416. package/dist/services/runtime-socket.impl.bun.d.ts.map +1 -0
  417. package/dist/services/runtime-socket.impl.bun.js +47 -0
  418. package/dist/services/runtime-socket.impl.bun.js.map +1 -0
  419. package/dist/services/runtime-stdio.impl.bun.d.ts +11 -0
  420. package/dist/services/runtime-stdio.impl.bun.d.ts.map +1 -0
  421. package/dist/services/runtime-stdio.impl.bun.js +37 -0
  422. package/dist/services/runtime-stdio.impl.bun.js.map +1 -0
  423. package/dist/services/self-spawn.impl.bun.d.ts +39 -0
  424. package/dist/services/self-spawn.impl.bun.d.ts.map +1 -0
  425. package/dist/services/self-spawn.impl.bun.js +58 -0
  426. package/dist/services/self-spawn.impl.bun.js.map +1 -0
  427. package/dist/services/standard-output.d.ts +100 -0
  428. package/dist/services/standard-output.d.ts.map +1 -0
  429. package/dist/services/standard-output.js +35 -0
  430. package/dist/services/standard-output.js.map +1 -0
  431. package/dist/services/user-environment.impl.bun.d.ts +19 -0
  432. package/dist/services/user-environment.impl.bun.d.ts.map +1 -0
  433. package/dist/services/user-environment.impl.bun.js +117 -0
  434. package/dist/services/user-environment.impl.bun.js.map +1 -0
  435. package/dist/services/workspace-env.d.ts +30 -0
  436. package/dist/services/workspace-env.d.ts.map +1 -0
  437. package/dist/services/workspace-env.js +45 -0
  438. package/dist/services/workspace-env.js.map +1 -0
  439. package/dist/services/workspace-root-probe.impl.bun.d.ts +14 -0
  440. package/dist/services/workspace-root-probe.impl.bun.d.ts.map +1 -0
  441. package/dist/services/workspace-root-probe.impl.bun.js +27 -0
  442. package/dist/services/workspace-root-probe.impl.bun.js.map +1 -0
  443. package/dist/session-members.impl.bun.d.ts +22 -0
  444. package/dist/session-members.impl.bun.d.ts.map +1 -0
  445. package/dist/session-members.impl.bun.js +74 -0
  446. package/dist/session-members.impl.bun.js.map +1 -0
  447. package/dist/sqlite-driver/index.d.ts +7 -0
  448. package/dist/sqlite-driver/index.d.ts.map +1 -0
  449. package/dist/sqlite-driver/index.js +7 -0
  450. package/dist/sqlite-driver/index.js.map +1 -0
  451. package/dist/sqlite-driver/sqlite-driver.impl.bun.d.ts +6 -0
  452. package/dist/sqlite-driver/sqlite-driver.impl.bun.d.ts.map +1 -0
  453. package/dist/sqlite-driver/sqlite-driver.impl.bun.js +269 -0
  454. package/dist/sqlite-driver/sqlite-driver.impl.bun.js.map +1 -0
  455. package/dist/sqlite-driver/sqlite-driver.plugin.d.ts +22 -0
  456. package/dist/sqlite-driver/sqlite-driver.plugin.d.ts.map +1 -0
  457. package/dist/sqlite-driver/sqlite-driver.plugin.js +44 -0
  458. package/dist/sqlite-driver/sqlite-driver.plugin.js.map +1 -0
  459. package/dist/telemetry/telemetry.d.ts +34 -0
  460. package/dist/telemetry/telemetry.d.ts.map +1 -0
  461. package/dist/telemetry/telemetry.js +2 -0
  462. package/dist/telemetry/telemetry.js.map +1 -0
  463. package/dist/telemetry/telemetry.plugin.d.ts +4 -0
  464. package/dist/telemetry/telemetry.plugin.d.ts.map +1 -0
  465. package/dist/telemetry/telemetry.plugin.js +78 -0
  466. package/dist/telemetry/telemetry.plugin.js.map +1 -0
  467. package/dist/terminal-pty-bridge.impl.bun.d.ts +31 -0
  468. package/dist/terminal-pty-bridge.impl.bun.d.ts.map +1 -0
  469. package/dist/terminal-pty-bridge.impl.bun.js +333 -0
  470. package/dist/terminal-pty-bridge.impl.bun.js.map +1 -0
  471. package/dist/test-tooling/lazy-environment.impl.bun.d.ts +16 -0
  472. package/dist/test-tooling/lazy-environment.impl.bun.d.ts.map +1 -0
  473. package/dist/test-tooling/lazy-environment.impl.bun.js +36 -0
  474. package/dist/test-tooling/lazy-environment.impl.bun.js.map +1 -0
  475. package/dist/test-tooling/starttls-refusal.d.ts +7 -0
  476. package/dist/test-tooling/starttls-refusal.d.ts.map +1 -0
  477. package/dist/test-tooling/starttls-refusal.js +50 -0
  478. package/dist/test-tooling/starttls-refusal.js.map +1 -0
  479. package/dist/test-tooling/svelte-client-preload.impl.bun.d.ts +2 -0
  480. package/dist/test-tooling/svelte-client-preload.impl.bun.d.ts.map +1 -0
  481. package/dist/test-tooling/svelte-client-preload.impl.bun.js +4 -0
  482. package/dist/test-tooling/svelte-client-preload.impl.bun.js.map +1 -0
  483. package/dist/test-tooling/svelte-compiler.impl.bun.d.ts +10 -0
  484. package/dist/test-tooling/svelte-compiler.impl.bun.d.ts.map +1 -0
  485. package/dist/test-tooling/svelte-compiler.impl.bun.js +33 -0
  486. package/dist/test-tooling/svelte-compiler.impl.bun.js.map +1 -0
  487. package/dist/test-tooling/svelte-server-preload.impl.bun.d.ts +2 -0
  488. package/dist/test-tooling/svelte-server-preload.impl.bun.d.ts.map +1 -0
  489. package/dist/test-tooling/svelte-server-preload.impl.bun.js +4 -0
  490. package/dist/test-tooling/svelte-server-preload.impl.bun.js.map +1 -0
  491. package/dist/test-tooling/test-environment.impl.bun.d.ts +45 -0
  492. package/dist/test-tooling/test-environment.impl.bun.d.ts.map +1 -0
  493. package/dist/test-tooling/test-environment.impl.bun.js +163 -0
  494. package/dist/test-tooling/test-environment.impl.bun.js.map +1 -0
  495. package/dist/test-tooling/test-process-root.impl.bun.d.ts +4 -0
  496. package/dist/test-tooling/test-process-root.impl.bun.d.ts.map +1 -0
  497. package/dist/test-tooling/test-process-root.impl.bun.js +65 -0
  498. package/dist/test-tooling/test-process-root.impl.bun.js.map +1 -0
  499. package/dist/test-tooling/unix-http.impl.bun.d.ts +28 -0
  500. package/dist/test-tooling/unix-http.impl.bun.d.ts.map +1 -0
  501. package/dist/test-tooling/unix-http.impl.bun.js +181 -0
  502. package/dist/test-tooling/unix-http.impl.bun.js.map +1 -0
  503. package/dist/transpiler/transpiler.plugin.d.ts +10 -0
  504. package/dist/transpiler/transpiler.plugin.d.ts.map +1 -0
  505. package/dist/transpiler/transpiler.plugin.js +18 -0
  506. package/dist/transpiler/transpiler.plugin.js.map +1 -0
  507. package/native/held-launch/Cargo.toml +23 -0
  508. package/native/held-launch/abi-manifest.json +234 -0
  509. package/native/held-launch/src/bin/vibes-held-launch.rs +35 -0
  510. package/native/held-launch/src/events.rs +99 -0
  511. package/native/held-launch/src/lib.rs +528 -0
  512. package/native/held-launch/symbols.golden +21 -0
  513. package/package.json +313 -4
  514. package/resources/restricted-supervisor.impl.bun.d.mts +3 -0
  515. package/resources/restricted-supervisor.impl.bun.mjs +49 -0
  516. package/resources/serve-stall-watch.impl.bun.d.mts +3 -0
  517. package/resources/serve-stall-watch.impl.bun.mjs +51 -0
@@ -0,0 +1,383 @@
1
+ /**
2
+ * Source Watcher
3
+ *
4
+ * Watches the source files that were compiled into a tracked plugin's current
5
+ * generation and reports changes. Sibling of `storage-watcher` and
6
+ * `config-watcher`: same construct/start/stop/watch/unwatch shape, injected
7
+ * logger, and no ownership of what a change *means*.
8
+ *
9
+ * Directories are watched rather than individual files, because editors and
10
+ * formatters replace files by atomic rename — a per-file watch goes deaf the
11
+ * first time a save happens that way. Events for files outside the tracked set
12
+ * are dropped.
13
+ *
14
+ * ## ENOENT re-arm
15
+ *
16
+ * A directory can be absent when `watch()` is called, or can be REMOVED and
17
+ * recreated underneath a live watcher — `bun install` rebuilds a member's
18
+ * `node_modules` symlink farm exactly this way, `git checkout` of a branch that
19
+ * does not contain a directory does it, and so does any tool that writes a tree
20
+ * by "rename the old one away, move the new one in". Both cases used to end the
21
+ * same way: one `warn` line and a permanently deaf watcher, so HMR silently
22
+ * stopped reloading and the body drifted while claiming to be hot. Silence is
23
+ * the worst possible failure mode for a freshness mechanism.
24
+ *
25
+ * So a missing directory is not a terminal state. `armMissing` retries on a
26
+ * bounded interval until the directory exists (or the watch set changes), and a
27
+ * live watcher that errors is torn down and put back into the same retry queue.
28
+ * The timer is `unref`'d, so it never holds a process open.
29
+ *
30
+ * Platforms disagree on how a replaced directory looks to a live watcher:
31
+ * macOS FSEvents reports an error, while Linux inotify keeps following the
32
+ * moved-away inode and only reports a `rename`. So each armed directory
33
+ * records its identity (device + inode); a `rename` event, `watch()` and
34
+ * `rearm()` all compare it with the path's current identity, and a missing or
35
+ * replaced directory is torn down and re-armed like an errored one.
36
+ *
37
+ * `fs.watch` can drop a write that lands while the watch is arming. Arm and
38
+ * rearm stat each tracked file and report a change when its device, inode or
39
+ * mtime differs from the stamp already recorded. The first observation only
40
+ * records the stamp.
41
+ */
42
+ import { watch, existsSync, statSync } from 'node:fs';
43
+ import { dirname, join, resolve } from 'node:path';
44
+ import { getLogger } from '@vibesdotdev/logging';
45
+ import { CaughtFailureSchema, isCapabilityError, settle, settleNow, valueFreeFailure } from '@vibesdotdev/kernel';
46
+ import z from 'zod/v4';
47
+ function isRepeatStopped(error) {
48
+ return isCapabilityError(error) && (error.reason === 'wait-aborted' || error.reason === 'runtime-disposed');
49
+ }
50
+ /** Same cadence as the feature's lifecycle repeat. This host copy does not import the feature package. */
51
+ function startLifecycleRepeat(runtime, lifecycle, ms, tick) {
52
+ const started = settleNow(() => lifecycle.interval(tick, ms));
53
+ if (started.ok)
54
+ return started.value;
55
+ if (!(isCapabilityError(started.cause) && started.cause.reason === 'lifecycle-interval-finite'))
56
+ throw started.cause;
57
+ const abort = new AbortController();
58
+ const loop = (async () => {
59
+ while (!abort.signal.aborted) {
60
+ const waited = await settle(() => lifecycle.delay(ms, abort.signal));
61
+ if (!waited.ok) {
62
+ if (isRepeatStopped(waited.cause))
63
+ return;
64
+ throw waited.cause;
65
+ }
66
+ if (abort.signal.aborted)
67
+ return;
68
+ tick();
69
+ }
70
+ })();
71
+ void settle(() => loop).then((settled) => {
72
+ if (settled.ok || isRepeatStopped(settled.cause))
73
+ return;
74
+ const logger = getLogger('runtime-plugin.lifecycle-repeat', runtime);
75
+ logger.error('lifecycle.delay repeat failed', { error: valueFreeFailure(settled.cause) });
76
+ });
77
+ return () => {
78
+ abort.abort();
79
+ };
80
+ }
81
+ const DEFAULT_REARM_INTERVAL_MS = 2_000;
82
+ /**
83
+ * Device + inode of a directory, or null when nothing (or a non-directory)
84
+ * is at the path. Other stat failures (EACCES, EMFILE…) propagate.
85
+ */
86
+ function directoryIdentity(directory) {
87
+ const stat = statSync(directory, { throwIfNoEntry: false });
88
+ return stat?.isDirectory() ? `${stat.dev}:${stat.ino}` : null;
89
+ }
90
+ export class SourceWatcher {
91
+ watchers = new Map();
92
+ tracked = new Map();
93
+ onChange = null;
94
+ log;
95
+ /** Directories that should be watched but currently are not (ENOENT, EMFILE…). */
96
+ pending = new Set();
97
+ /** Last device, inode and mtime stat recorded for a tracked file. */
98
+ stamps = new Map();
99
+ rearmTimer = null;
100
+ rearmIntervalMs;
101
+ runtime;
102
+ constructor(options) {
103
+ this.log = options.logger ?? createNoopLogger('source-watcher');
104
+ this.rearmIntervalMs = options.rearmIntervalMs ?? DEFAULT_REARM_INTERVAL_MS;
105
+ this.runtime = options.runtime;
106
+ }
107
+ /** Directories currently waiting to be (re-)armed. Diagnostic. */
108
+ getPending() {
109
+ return new Set(this.pending);
110
+ }
111
+ /** Try once to arm every pending directory. Exposed so tests need no timer. */
112
+ rearm() {
113
+ for (const directory of Array.from(this.watchers.keys()))
114
+ this.verifyArmed(directory);
115
+ if (this.pending.size > 0) {
116
+ for (const directory of Array.from(this.pending)) {
117
+ if (!existsSync(directory))
118
+ continue;
119
+ if (this.armDirectory(directory)) {
120
+ this.log.info('re-armed source watch after the directory reappeared', { directory });
121
+ }
122
+ }
123
+ }
124
+ for (const directory of this.watchers.keys())
125
+ this.syncTracked(directory);
126
+ if (this.pending.size === 0)
127
+ this.stopRearmTimer();
128
+ }
129
+ startRearmTimer() {
130
+ if (this.rearmTimer || this.pending.size === 0)
131
+ return;
132
+ this.rearmTimer = startLifecycleRepeat(this.runtime, this.runtime.lifecycle, this.rearmIntervalMs, () => this.rearm());
133
+ }
134
+ stopRearmTimer() {
135
+ if (!this.rearmTimer)
136
+ return;
137
+ this.rearmTimer();
138
+ this.rearmTimer = null;
139
+ }
140
+ /** Close one armed watcher and, if the directory is still wanted, queue it for re-arm. */
141
+ disarm(directory) {
142
+ const armed = this.watchers.get(directory);
143
+ if (!armed)
144
+ return;
145
+ armed.watcher.close();
146
+ this.watchers.delete(directory);
147
+ if (this.wantedDirectories().has(directory)) {
148
+ this.pending.add(directory);
149
+ this.startRearmTimer();
150
+ }
151
+ }
152
+ /**
153
+ * Re-arm an armed directory whose path no longer names the directory the
154
+ * watcher was opened on (removed, or replaced by rename). Returns true when
155
+ * the existing watcher is still valid.
156
+ */
157
+ verifyArmed(directory) {
158
+ const armed = this.watchers.get(directory);
159
+ if (!armed)
160
+ return false;
161
+ const inspected = settleNow(() => directoryIdentity(directory));
162
+ if (!inspected.ok) {
163
+ this.log.warn('cannot inspect watched directory — requeueing for re-arm', {
164
+ directory,
165
+ error: valueFreeFailure(inspected.cause)
166
+ });
167
+ this.disarm(directory);
168
+ return false;
169
+ }
170
+ const identity = inspected.value;
171
+ if (identity === armed.identity)
172
+ return true;
173
+ this.log.info('watched directory was replaced — re-arming', { directory });
174
+ this.disarm(directory);
175
+ if (existsSync(directory))
176
+ this.armDirectory(directory);
177
+ return false;
178
+ }
179
+ /**
180
+ * Arm one directory. Returns true when a watcher is now installed; false
181
+ * leaves the directory in `pending` for the re-arm loop.
182
+ */
183
+ armDirectory(directory) {
184
+ if (this.watchers.has(directory) && this.verifyArmed(directory)) {
185
+ this.pending.delete(directory);
186
+ return true;
187
+ }
188
+ if (this.watchers.has(directory))
189
+ return true;
190
+ const armed = settleNow(() => {
191
+ const identity = directoryIdentity(directory);
192
+ if (identity === null) {
193
+ this.pending.add(directory);
194
+ this.startRearmTimer();
195
+ return false;
196
+ }
197
+ const watcher = watch(directory, (event, filename) => {
198
+ if (event === 'rename')
199
+ this.verifyArmed(directory);
200
+ if (!filename)
201
+ return;
202
+ const absolute = join(directory, filename.toString());
203
+ if (!this.tracked.get(directory)?.has(absolute))
204
+ return;
205
+ this.remember(absolute);
206
+ this.onChange?.(absolute);
207
+ });
208
+ watcher.on('error', (cause) => {
209
+ // A live watcher whose directory was replaced (rename-in) reports
210
+ // here and then never fires again. Tear it down and requeue rather
211
+ // than logging once and going deaf.
212
+ this.log.warn('watch error — requeueing directory for re-arm', {
213
+ directory,
214
+ error: valueFreeFailure(cause)
215
+ });
216
+ this.disarm(directory);
217
+ return cause;
218
+ });
219
+ if ('unref' in watcher)
220
+ watcher.unref();
221
+ this.watchers.set(directory, { watcher, identity });
222
+ this.pending.delete(directory);
223
+ this.syncTracked(directory);
224
+ return true;
225
+ });
226
+ if (armed.ok)
227
+ return armed.value;
228
+ this.pending.add(directory);
229
+ this.startRearmTimer();
230
+ this.log.warn('failed to watch directory — will retry', {
231
+ directory,
232
+ retryMs: this.rearmIntervalMs,
233
+ error: valueFreeFailure(armed.cause)
234
+ });
235
+ return false;
236
+ }
237
+ wantedDirectories() {
238
+ return new Set(this.tracked.keys());
239
+ }
240
+ /** Replace the tracked file set. Directories no longer needed are released. */
241
+ watch(files, onChange) {
242
+ this.onChange = onChange;
243
+ this.tracked.clear();
244
+ for (const file of files) {
245
+ const absolute = resolve(file);
246
+ const directory = dirname(absolute);
247
+ let sources = this.tracked.get(directory);
248
+ if (!sources) {
249
+ sources = new Set();
250
+ this.tracked.set(directory, sources);
251
+ }
252
+ sources.add(absolute);
253
+ }
254
+ for (const file of this.stamps.keys()) {
255
+ if (!this.tracked.get(dirname(file))?.has(file))
256
+ this.stamps.delete(file);
257
+ }
258
+ const wanted = this.wantedDirectories();
259
+ for (const [directory, armed] of this.watchers) {
260
+ if (wanted.has(directory))
261
+ continue;
262
+ armed.watcher.close();
263
+ this.watchers.delete(directory);
264
+ }
265
+ for (const directory of Array.from(this.pending)) {
266
+ if (!wanted.has(directory))
267
+ this.pending.delete(directory);
268
+ }
269
+ for (const directory of wanted) {
270
+ this.armDirectory(directory);
271
+ }
272
+ if (this.pending.size === 0)
273
+ this.stopRearmTimer();
274
+ }
275
+ /** Directories currently held open. */
276
+ getWatched() {
277
+ return new Set(this.watchers.keys());
278
+ }
279
+ /** Files currently eligible to raise a change. */
280
+ getTracked() {
281
+ const tracked = new Set();
282
+ for (const files of this.tracked.values()) {
283
+ for (const file of files)
284
+ tracked.add(file);
285
+ }
286
+ return tracked;
287
+ }
288
+ unwatchAll() {
289
+ for (const armed of this.watchers.values())
290
+ armed.watcher.close();
291
+ this.watchers.clear();
292
+ this.pending.clear();
293
+ this.stopRearmTimer();
294
+ this.tracked.clear();
295
+ this.stamps.clear();
296
+ this.onChange = null;
297
+ }
298
+ /** Stat one tracked file. A missing path is a null stamp; other stat failures propagate. */
299
+ readStamp(file) {
300
+ try {
301
+ const stat = statSync(file);
302
+ if (!stat.isFile())
303
+ return null;
304
+ return { dev: stat.dev, ino: stat.ino, mtimeMs: stat.mtimeMs };
305
+ }
306
+ catch (error) {
307
+ if (valueFreeFailure(CaughtFailureSchema.parse(error)).code === 'ENOENT')
308
+ return null;
309
+ throw error;
310
+ }
311
+ }
312
+ sameStamp(previous, next) {
313
+ if (previous === null || next === null)
314
+ return previous === next;
315
+ return previous.dev === next.dev && previous.ino === next.ino && previous.mtimeMs === next.mtimeMs;
316
+ }
317
+ /** Record the stamp `fs.watch` just delivered so a later rearm does not report it again. */
318
+ remember(file) {
319
+ const settled = settleNow(() => {
320
+ this.stamps.set(file, this.readStamp(file));
321
+ });
322
+ if (settled.ok)
323
+ return;
324
+ this.log.warn('cannot stat tracked source file', {
325
+ file,
326
+ failure: valueFreeFailure(settled.cause)
327
+ });
328
+ }
329
+ /**
330
+ * Report tracked files in `directory` whose device, inode or mtime moved
331
+ * since the stamp on record. The first observation only records the stamp.
332
+ */
333
+ syncTracked(directory) {
334
+ const files = this.tracked.get(directory);
335
+ if (!files)
336
+ return;
337
+ for (const file of files) {
338
+ const settled = settleNow(() => this.readStamp(file));
339
+ if (!settled.ok) {
340
+ this.log.warn('cannot stat tracked source file', {
341
+ file,
342
+ failure: valueFreeFailure(settled.cause)
343
+ });
344
+ continue;
345
+ }
346
+ const next = settled.value;
347
+ const previous = this.stamps.get(file);
348
+ if (previous === undefined) {
349
+ this.stamps.set(file, next);
350
+ continue;
351
+ }
352
+ if (this.sameStamp(previous, next))
353
+ continue;
354
+ this.stamps.set(file, next);
355
+ this.onChange?.(file);
356
+ }
357
+ }
358
+ /** Alias matching the sibling watchers' lifecycle vocabulary. */
359
+ stop() {
360
+ this.unwatchAll();
361
+ }
362
+ }
363
+ function createNoopLogger(namespace) {
364
+ const noop = () => { };
365
+ return {
366
+ namespace,
367
+ fullNamespace: namespace,
368
+ debug: noop,
369
+ info: noop,
370
+ warn: noop,
371
+ error: noop,
372
+ child: (opts) => {
373
+ const text = z.string().safeParse(opts);
374
+ if (text.success)
375
+ return createNoopLogger(`${namespace}:${text.data}`);
376
+ const named = z.object({ namespace: z.string().optional() }).safeParse(opts);
377
+ const suffix = named.success ? (named.data.namespace ?? 'child') : 'child';
378
+ return createNoopLogger(`${namespace}:${suffix}`);
379
+ },
380
+ withContext: () => createNoopLogger(namespace)
381
+ };
382
+ }
383
+ //# sourceMappingURL=source-watcher.consumer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"source-watcher.consumer.js","sourceRoot":"","sources":["../../src/runtime-plugin-host/source-watcher.consumer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AAEH,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAkB,MAAM,SAAS,CAAC;AACtE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,EAAE,SAAS,EAAE,gBAAgB,EAA6E,MAAM,qBAAqB,CAAC;AAC7L,OAAO,CAAC,MAAM,QAAQ,CAAC;AAEvB,SAAS,eAAe,CAAC,KAAoB;IAC5C,OAAO,iBAAiB,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,KAAK,cAAc,IAAI,KAAK,CAAC,MAAM,KAAK,kBAAkB,CAAC,CAAC;AAC7G,CAAC;AAED,0GAA0G;AAC1G,SAAS,oBAAoB,CAC5B,OAAmB,EACnB,SAAuD,EACvD,EAAU,EACV,IAAgB;IAEhB,MAAM,OAAO,GAAG,SAAS,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,C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CAAC,IAAI,CAAC,CAAC;YACxC,IAAI,IAAI,CAAC,OAAO;gBAAE,OAAO,gBAAgB,CAAC,GAAG,SAAS,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;YACvE,MAAM,KAAK,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;YAC7E,MAAM,MAAM,GAAG,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,IAAI,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;YAC3E,OAAO,gBAAgB,CAAC,GAAG,SAAS,IAAI,MAAM,EAAE,CAAC,CAAC;QACnD,CAAC;QACD,WAAW,EAAE,GAAG,EAAE,CAAC,gBAAgB,CAAC,SAAS,CAAC;KAC9C,CAAC;AACH,CAAC"}
@@ -0,0 +1,197 @@
1
+ /** The Bun host's declarations: its environment options and the plugin options around them. */
2
+ import * as z from 'zod/v4';
3
+ import type { HostFileLoggingOptions } from '@vibesdotdev/logging/host-files';
4
+ import type { PathRootsOrigin } from '@vibesdotdev/paths';
5
+ import type { RuntimeExecutionLocalPluginOptions } from '@vibesdotdev/execution-local';
6
+ import type { BunHostDeclaration } from '../host-channel.impl.bun.ts';
7
+ /** What a host reads about its machine: the CPUs it reports and its total memory. */
8
+ export interface BunSystemResourceReading {
9
+ readonly cpus: readonly {
10
+ readonly model: string;
11
+ }[];
12
+ readonly totalMemoryBytes: number;
13
+ }
14
+ export declare const BunScopeSchema: z.ZodObject<{
15
+ hardware: z.ZodEnum<{
16
+ consumer: "consumer";
17
+ cloud: "cloud";
18
+ }>;
19
+ workspace: z.ZodOptional<z.ZodObject<{
20
+ root: z.ZodOptional<z.ZodString>;
21
+ access: z.ZodOptional<z.ZodEnum<{
22
+ read: "read";
23
+ write: "write";
24
+ }>>;
25
+ }, z.core.$strict>>;
26
+ hosting: z.ZodObject<{
27
+ mode: z.ZodUnion<readonly [z.ZodEnum<{
28
+ local: "local";
29
+ hosted: "hosted";
30
+ "managed-cloud": "managed-cloud";
31
+ }>, z.ZodString]>;
32
+ owner: z.ZodUnion<readonly [z.ZodEnum<{
33
+ consumer: "consumer";
34
+ customer: "customer";
35
+ vibes: "vibes";
36
+ }>, z.ZodString]>;
37
+ venue: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
38
+ "user-device": "user-device";
39
+ "ipc-worker": "ipc-worker";
40
+ doks: "doks";
41
+ "cloudflare-workers": "cloudflare-workers";
42
+ "digitalocean-functions": "digitalocean-functions";
43
+ }>, z.ZodString]>>;
44
+ provider: z.ZodOptional<z.ZodString>;
45
+ }, z.core.$strip>;
46
+ capabilities: z.ZodOptional<z.ZodObject<{
47
+ requestPrincipals: z.ZodOptional<z.ZodBoolean>;
48
+ interactiveSession: z.ZodOptional<z.ZodBoolean>;
49
+ hostCredentials: z.ZodOptional<z.ZodBoolean>;
50
+ sharedHost: z.ZodOptional<z.ZodBoolean>;
51
+ }, z.core.$strict>>;
52
+ purpose: z.ZodEnum<{
53
+ agent: "agent";
54
+ worker: "worker";
55
+ mcp: "mcp";
56
+ direct: "direct";
57
+ projection: "projection";
58
+ }>;
59
+ surface: z.ZodEnum<{
60
+ agent: "agent";
61
+ browser: "browser";
62
+ ssr: "ssr";
63
+ cli: "cli";
64
+ tui: "tui";
65
+ worker: "worker";
66
+ mcp: "mcp";
67
+ bridge: "bridge";
68
+ }>;
69
+ lifecycle: z.ZodEnum<{
70
+ finite: "finite";
71
+ persistent: "persistent";
72
+ }>;
73
+ qualifiers: z.ZodOptional<z.ZodObject<{
74
+ dev: z.ZodOptional<z.ZodBoolean>;
75
+ building: z.ZodOptional<z.ZodBoolean>;
76
+ environmentTier: z.ZodOptional<z.ZodEnum<{
77
+ local: "local";
78
+ dev: "dev";
79
+ staging: "staging";
80
+ production: "production";
81
+ }>>;
82
+ profile: z.ZodOptional<z.ZodString>;
83
+ os: z.ZodOptional<z.ZodString>;
84
+ cef: z.ZodOptional<z.ZodBoolean>;
85
+ trustedOrigin: z.ZodOptional<z.ZodString>;
86
+ rendererGeneration: z.ZodOptional<z.ZodNumber>;
87
+ filesystem: z.ZodOptional<z.ZodString>;
88
+ browserBackend: z.ZodOptional<z.ZodString>;
89
+ workspaceSessionId: z.ZodOptional<z.ZodString>;
90
+ workspaceTarget: z.ZodOptional<z.ZodString>;
91
+ repositoryId: z.ZodOptional<z.ZodString>;
92
+ remoteHostId: z.ZodOptional<z.ZodString>;
93
+ connectionMode: z.ZodOptional<z.ZodString>;
94
+ outreachExportsDir: z.ZodOptional<z.ZodString>;
95
+ serve: z.ZodOptional<z.ZodString>;
96
+ hotReload: z.ZodOptional<z.ZodEnum<{
97
+ on: "on";
98
+ off: "off";
99
+ }>>;
100
+ loaderTimeoutMs: z.ZodOptional<z.ZodNumber>;
101
+ }, z.core.$strict>>;
102
+ }, z.core.$strict>;
103
+ export type BunScopeDeclaration = z.infer<typeof BunScopeSchema>;
104
+ /** The facts a scope resolver is handed beside the capture: the platform this environment captured. */
105
+ export interface BunScopeHostFacts {
106
+ readonly platform: string;
107
+ }
108
+ export type BunScopeResolver = (captured: Readonly<Record<string, string>>, host: BunScopeHostFacts) => BunScopeDeclaration;
109
+ export interface BunPathSelection {
110
+ /** Explicit absolute home selected by the surface. Test isolation uses this seam. */
111
+ vibesHome?: string;
112
+ profileName?: string;
113
+ configDir?: string;
114
+ logDir?: string;
115
+ tempDir?: string;
116
+ origin?: PathRootsOrigin;
117
+ }
118
+ export interface BunEnvironmentOptions {
119
+ /** The host's file logging (`{ files: false }` opts out); this host's own logging plugin supplies it. */
120
+ logging?: HostFileLoggingOptions;
121
+ /**
122
+ * The host's declared scope. The environment adds only the facts it owns:
123
+ * `qualifiers.os` and `qualifiers.dev` (source mode is dev, a compiled
124
+ * executable is not), unless the declaration names them.
125
+ *
126
+ * A function receives this environment's capture and returns the
127
+ * declaration. It runs once, right after the capture, so a host declares
128
+ * facts it learns from its own environment (the CLI's `hostCredentials`
129
+ * capability from a live `VIBES_HOST_CREDENTIALS` manifest) without
130
+ * reading `process.env` itself, and the hardware the shim baked).
131
+ */
132
+ scope: unknown | BunScopeResolver;
133
+ /**
134
+ * Host facts the host declares; validated at capture. `shimChannel: true`
135
+ * takes R, the entry and self-spawn from the captured shim channel; any other
136
+ * host has no R unless it passes `root` (D1).
137
+ */
138
+ host?: BunHostDeclaration;
139
+ /** Filesystem selection published as the immutable paths/roots descriptor. */
140
+ paths?: BunPathSelection;
141
+ /**
142
+ * The host's system-resource read, called once at construction. Absent, the
143
+ * environment reads the machine it runs on. A declared reading is validated
144
+ * exactly like the native one: memory must be a positive finite number and
145
+ * each CPU must name a model; no CPUs publishes a null model.
146
+ */
147
+ systemResources?: () => BunSystemResourceReading;
148
+ }
149
+ /** A Bun host's declaration: its environment, plus what it composes around it. */
150
+ export interface RuntimeEnvironmentBunPluginOptions extends BunEnvironmentOptions {
151
+ /** Physical streams and fatal source shared explicitly by composed runtimes. */
152
+ hostResources?: import('./host-resources.ts').BunHostResources;
153
+ /** Lazy, runtime-local native artifacts for explicitly requested child resource enforcement. */
154
+ nativeLaunch?: RuntimeExecutionLocalPluginOptions['nativeLaunch'];
155
+ /**
156
+ * The host's admission for restricted execution: the one writable base a
157
+ * restricted workload may write under. Declared by the host, never read
158
+ * from the environment, and passed to the local execution plugin. Absent,
159
+ * the host composes today's local execution and a restricted request
160
+ * refuses `restricted-base-undeclared`.
161
+ */
162
+ restrictedExecution?: {
163
+ writableBase: string;
164
+ };
165
+ /**
166
+ * The host's installed B7 held-launch artifacts: the exact absolute path of
167
+ * their `manifest.json` (a bundle stages the paired library, helper and
168
+ * manifest under `<hostRoot>/native/held-launch/manifest.json`). Declared by the host and
169
+ * passed to local execution; never resolved from a package tree, a
170
+ * directory walk or the environment.
171
+ */
172
+ heldLaunch?: {
173
+ manifestPath: string;
174
+ };
175
+ /**
176
+ * The host's budget in milliseconds for the native endpoint probe that proves a local socket file
177
+ * unowned before the socket service removes it. Absent, the probe's own default (5 s); a host on a
178
+ * loaded machine declares more, because the tool walks every process.
179
+ */
180
+ socketProbeTimeoutMs?: number;
181
+ /**
182
+ * The host's budget in milliseconds for each process-table probe (`ps`, `lsof`) the runtime process
183
+ * service runs to read a process's identity. Absent, the probe's own default; a host on a loaded
184
+ * machine declares more. Forwarded to the node process service, which refuses a value that is not
185
+ * a positive integer (`process-probe-timeout-invalid`).
186
+ */
187
+ processProbeTimeoutMs?: number;
188
+ /**
189
+ * Whether this environment registers the `filesystem/adapter` kind with
190
+ * this host's adapter (default `true`). A host that composes its own filesystem
191
+ * provider, or none (a probe that must fail closed without one), declares
192
+ * `false`; LocalDB then refuses `localdb-filesystem-unavailable` unless the
193
+ * composition supplies a provider.
194
+ */
195
+ hostFileSystem?: boolean;
196
+ }
197
+ //# sourceMappingURL=environment.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"environment.d.ts","sourceRoot":"","sources":["../../src/schemas/environment.ts"],"names":[],"mappings":"AAAA,+FAA+F;AAE/F,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAC5B,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AAC9E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,KAAK,EAAE,kCAAkC,EAAE,MAAM,8BAA8B,CAAC;AAEvF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AAEtE,qFAAqF;AACrF,MAAM,WAAW,wBAAwB;IACxC,QAAQ,CAAC,IAAI,EAAE,SAAS;QAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IACrD,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;CAClC;AAED,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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,YAAY,EAAE,MAAM,CAAA;KAAE,CAAC;IAC/C;;;;;;OAMG;IACH,UAAU,CAAC,EAAE;QAAE,YAAY,EAAE,MAAM,CAAA;KAAE,CAAC;IACtC;;;;OAIG;IACH,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B;;;;;OAKG;IACH,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B;;;;;;OAMG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;CACzB"}
@@ -0,0 +1,7 @@
1
+ /** The Bun host's declarations: its environment options and the plugin options around them. */
2
+ import * as z from 'zod/v4';
3
+ import { DeclaredRuntimeScopeSchema } from '@vibesdotdev/kernel/schemas/scope';
4
+ export const BunScopeSchema = DeclaredRuntimeScopeSchema.extend({
5
+ qualifiers: DeclaredRuntimeScopeSchema.shape.qualifiers.partial({ dev: true }).optional()
6
+ });
7
+ //# sourceMappingURL=environment.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"environment.js","sourceRoot":"","sources":["../../src/schemas/environment.ts"],"names":[],"mappings":"AAAA,+FAA+F;AAE/F,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAI5B,OAAO,EAAE,0BAA0B,EAAE,MAAM,mCAAmC,CAAC;AAS/E,MAAM,CAAC,MAAM,cAAc,GAAG,0BAA0B,CAAC,MAAM,CAAC;IAC/D,UAAU,EAAE,0BAA0B,CAAC,KAAK,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC,CAAC,QAAQ,EAAE;CACzF,CAAC,CAAC"}