@nimbus-sh/worker 0.9.0 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (286) hide show
  1. package/NOTICE.md +5 -0
  2. package/README.md +10 -0
  3. package/dist/_shared/session-router.d.ts +7 -0
  4. package/dist/_shared/session-router.d.ts.map +1 -1
  5. package/dist/_shared/session-router.js +7 -0
  6. package/dist/bindings/body.d.ts +6 -0
  7. package/dist/bindings/body.d.ts.map +1 -0
  8. package/dist/bindings/body.js +37 -0
  9. package/dist/bindings/kv.d.ts +0 -2
  10. package/dist/bindings/kv.d.ts.map +1 -1
  11. package/dist/bindings/kv.js +3 -42
  12. package/dist/bindings/r2.d.ts +0 -2
  13. package/dist/bindings/r2.d.ts.map +1 -1
  14. package/dist/bindings/r2.js +4 -44
  15. package/dist/esbuild-cli-artifact.generated.d.ts +18 -0
  16. package/dist/esbuild-cli-artifact.generated.d.ts.map +1 -0
  17. package/dist/esbuild-cli-artifact.generated.js +17 -0
  18. package/dist/esbuild-wasm-bundle.generated.d.ts +24 -24
  19. package/dist/esbuild-wasm-bundle.generated.d.ts.map +1 -1
  20. package/dist/esbuild-wasm-bundle.generated.js +24 -24
  21. package/dist/facets/cirrus-real.d.ts.map +1 -1
  22. package/dist/facets/cirrus-real.js +11 -6
  23. package/dist/facets/compose.d.ts +11 -7
  24. package/dist/facets/compose.d.ts.map +1 -1
  25. package/dist/facets/compose.js +8 -31
  26. package/dist/facets/data-plan.d.ts +79 -0
  27. package/dist/facets/data-plan.d.ts.map +1 -0
  28. package/dist/facets/data-plan.js +477 -0
  29. package/dist/facets/esbuild-bundle-pool.d.ts +1 -1
  30. package/dist/facets/esbuild-bundle-pool.js +3 -3
  31. package/dist/facets/esbuild-transform.d.ts +38 -8
  32. package/dist/facets/esbuild-transform.d.ts.map +1 -1
  33. package/dist/facets/esbuild-transform.js +219 -19
  34. package/dist/facets/exec-telemetry.d.ts +7 -3
  35. package/dist/facets/exec-telemetry.d.ts.map +1 -1
  36. package/dist/facets/manager.d.ts +198 -69
  37. package/dist/facets/manager.d.ts.map +1 -1
  38. package/dist/facets/manager.js +1276 -652
  39. package/dist/facets/opencode-staging.d.ts +0 -2
  40. package/dist/facets/opencode-staging.d.ts.map +1 -1
  41. package/dist/facets/opencode-staging.js +5 -11
  42. package/dist/facets/process.d.ts +4 -0
  43. package/dist/facets/process.d.ts.map +1 -1
  44. package/dist/facets/process.js +3 -0
  45. package/dist/facets/read-profile.d.ts +149 -0
  46. package/dist/facets/read-profile.d.ts.map +1 -0
  47. package/dist/facets/read-profile.js +483 -0
  48. package/dist/facets/real-vite-hmr.d.ts +2 -0
  49. package/dist/facets/real-vite-hmr.d.ts.map +1 -1
  50. package/dist/facets/real-vite-hmr.js +3 -2
  51. package/dist/facets/resident-identity.d.ts +0 -1
  52. package/dist/facets/resident-identity.d.ts.map +1 -1
  53. package/dist/facets/resident-identity.js +0 -3
  54. package/dist/facets/wasm-swap-registry.d.ts +34 -25
  55. package/dist/facets/wasm-swap-registry.d.ts.map +1 -1
  56. package/dist/facets/wasm-swap-registry.js +62 -56
  57. package/dist/facets/ws-terminal.d.ts +4 -4
  58. package/dist/facets/ws-terminal.d.ts.map +1 -1
  59. package/dist/facets/ws-terminal.js +4 -5
  60. package/dist/git/commands.d.ts +33 -10
  61. package/dist/git/commands.d.ts.map +1 -1
  62. package/dist/git/commands.js +1891 -197
  63. package/dist/git/network-facet.d.ts +12 -2
  64. package/dist/git/network-facet.d.ts.map +1 -1
  65. package/dist/git/network-facet.js +69 -18
  66. package/dist/git/unified-diff.d.ts +74 -0
  67. package/dist/git/unified-diff.d.ts.map +1 -0
  68. package/dist/git/unified-diff.js +676 -0
  69. package/dist/git-bundle.generated.d.ts +7 -11
  70. package/dist/git-bundle.generated.d.ts.map +1 -1
  71. package/dist/git-bundle.generated.js +7 -11
  72. package/dist/hosted/commands.d.ts.map +1 -1
  73. package/dist/hosted/commands.js +64 -245
  74. package/dist/hosted/runtime.d.ts +22 -15
  75. package/dist/hosted/runtime.d.ts.map +1 -1
  76. package/dist/hosted/runtime.js +72 -14
  77. package/dist/hosted/services.d.ts +8 -1
  78. package/dist/hosted/services.d.ts.map +1 -1
  79. package/dist/hosted/services.js +12 -13
  80. package/dist/hosted/session.d.ts +165 -0
  81. package/dist/hosted/session.d.ts.map +1 -0
  82. package/dist/hosted/session.js +132 -0
  83. package/dist/loaders/generated-workers.d.ts +6 -3
  84. package/dist/loaders/generated-workers.d.ts.map +1 -1
  85. package/dist/loaders/generated-workers.js +8 -5
  86. package/dist/loaders/npm-resolve-preamble.d.ts.map +1 -1
  87. package/dist/loaders/npm-resolve-preamble.js +0 -27
  88. package/dist/loaders/pre-bundle-preamble.d.ts +6 -3
  89. package/dist/loaders/pre-bundle-preamble.d.ts.map +1 -1
  90. package/dist/loaders/pre-bundle-preamble.js +13 -8
  91. package/dist/node-shims-artifact.generated.d.ts +13 -4
  92. package/dist/node-shims-artifact.generated.d.ts.map +1 -1
  93. package/dist/node-shims-artifact.generated.js +16 -7
  94. package/dist/npm/bin-links.d.ts +3 -1
  95. package/dist/npm/bin-links.d.ts.map +1 -1
  96. package/dist/npm/bin-links.js +32 -8
  97. package/dist/npm/cache.d.ts +11 -1
  98. package/dist/npm/cache.d.ts.map +1 -1
  99. package/dist/npm/cache.js +21 -7
  100. package/dist/npm/install-batch-facet.d.ts +4 -2
  101. package/dist/npm/install-batch-facet.d.ts.map +1 -1
  102. package/dist/npm/install-batch-facet.js +32 -18
  103. package/dist/npm/installer.d.ts +23 -3
  104. package/dist/npm/installer.d.ts.map +1 -1
  105. package/dist/npm/installer.js +330 -131
  106. package/dist/npm/npx-install.d.ts +3 -1
  107. package/dist/npm/npx-install.d.ts.map +1 -1
  108. package/dist/npm/npx-install.js +4 -1
  109. package/dist/npm/package-lock.d.ts +32 -0
  110. package/dist/npm/package-lock.d.ts.map +1 -0
  111. package/dist/npm/package-lock.js +65 -0
  112. package/dist/npm/placement.d.ts +16 -0
  113. package/dist/npm/placement.d.ts.map +1 -0
  114. package/dist/npm/placement.js +33 -0
  115. package/dist/npm/pre-bundle-facet.d.ts +1 -30
  116. package/dist/npm/pre-bundle-facet.d.ts.map +1 -1
  117. package/dist/npm/pre-bundle-facet.js +3 -5
  118. package/dist/npm/r2-cache.d.ts +12 -6
  119. package/dist/npm/r2-cache.d.ts.map +1 -1
  120. package/dist/npm/r2-cache.js +34 -16
  121. package/dist/npm/resolve-one-facet.d.ts +3 -0
  122. package/dist/npm/resolve-one-facet.d.ts.map +1 -1
  123. package/dist/npm/resolve-one-facet.js +15 -3
  124. package/dist/npm/resolver.d.ts +11 -13
  125. package/dist/npm/resolver.d.ts.map +1 -1
  126. package/dist/npm/resolver.js +12 -25
  127. package/dist/opencode-artifact.generated.js +2 -2
  128. package/dist/replica/routing.d.ts +2 -38
  129. package/dist/replica/routing.d.ts.map +1 -1
  130. package/dist/replica/routing.js +3 -55
  131. package/dist/router/index.d.ts.map +1 -1
  132. package/dist/router/index.js +15 -2
  133. package/dist/router/public-directory.d.ts +18 -0
  134. package/dist/router/public-directory.d.ts.map +1 -1
  135. package/dist/router/public-directory.js +1 -1
  136. package/dist/router/remote-api.d.ts +3 -1
  137. package/dist/router/remote-api.d.ts.map +1 -1
  138. package/dist/router/remote-api.js +42 -79
  139. package/dist/runtime/bash-repl.js +2 -2
  140. package/dist/runtime/bun-repl.d.ts.map +1 -1
  141. package/dist/runtime/bun-repl.js +2 -13
  142. package/dist/runtime/cpython-resident.d.ts.map +1 -1
  143. package/dist/runtime/cpython-resident.js +2 -10
  144. package/dist/runtime/esbuild-wasm-bytes.d.ts +37 -18
  145. package/dist/runtime/esbuild-wasm-bytes.d.ts.map +1 -1
  146. package/dist/runtime/esbuild-wasm-bytes.js +66 -92
  147. package/dist/runtime/facet-loader-host.d.ts.map +1 -1
  148. package/dist/runtime/facet-loader-host.js +0 -7
  149. package/dist/runtime/git-bundle-artifact.d.ts +17 -0
  150. package/dist/runtime/git-bundle-artifact.d.ts.map +1 -0
  151. package/dist/runtime/git-bundle-artifact.js +25 -0
  152. package/dist/runtime/node-repl.d.ts.map +1 -1
  153. package/dist/runtime/node-repl.js +2 -13
  154. package/dist/runtime/node-shims-artifact.d.ts +22 -23
  155. package/dist/runtime/node-shims-artifact.d.ts.map +1 -1
  156. package/dist/runtime/node-shims-artifact.js +48 -78
  157. package/dist/runtime/node-shims.d.ts.map +1 -1
  158. package/dist/runtime/node-shims.js +2358 -996
  159. package/dist/runtime/opencode-artifact.d.ts.map +1 -1
  160. package/dist/runtime/opencode-artifact.js +17 -53
  161. package/dist/runtime/opencode-facet-runner.d.ts +3 -6
  162. package/dist/runtime/opencode-facet-runner.d.ts.map +1 -1
  163. package/dist/runtime/opencode-facet-runner.js +45 -10
  164. package/dist/runtime/opentui-wasm-bytes.d.ts.map +1 -1
  165. package/dist/runtime/opentui-wasm-bytes.js +16 -49
  166. package/dist/runtime/package-manager.d.ts +0 -2
  167. package/dist/runtime/package-manager.d.ts.map +1 -1
  168. package/dist/runtime/package-manager.js +0 -3
  169. package/dist/runtime/python-repl.d.ts.map +1 -1
  170. package/dist/runtime/python-repl.js +4 -35
  171. package/dist/runtime/repl-session.d.ts +10 -0
  172. package/dist/runtime/repl-session.d.ts.map +1 -1
  173. package/dist/runtime/repl-session.js +7 -0
  174. package/dist/runtime/ruby-repl.d.ts.map +1 -1
  175. package/dist/runtime/ruby-repl.js +2 -2
  176. package/dist/runtime/ruby-resident.d.ts.map +1 -1
  177. package/dist/runtime/ruby-resident.js +41 -51
  178. package/dist/runtime/runtime-catalog.d.ts +10 -3
  179. package/dist/runtime/runtime-catalog.d.ts.map +1 -1
  180. package/dist/runtime/runtime-catalog.js +125 -15
  181. package/dist/runtime/sqlite-wasm-bytes.d.ts +4 -4
  182. package/dist/runtime/sqlite-wasm-bytes.d.ts.map +1 -1
  183. package/dist/runtime/sqlite-wasm-bytes.js +21 -57
  184. package/dist/runtime/staged-source.d.ts +67 -0
  185. package/dist/runtime/staged-source.d.ts.map +1 -0
  186. package/dist/runtime/staged-source.js +113 -0
  187. package/dist/runtime/wasi/preamble.d.ts +0 -22
  188. package/dist/runtime/wasi/preamble.d.ts.map +1 -1
  189. package/dist/runtime/wasi/preamble.js +98 -1425
  190. package/dist/runtime-catalog.generated.js +1 -1
  191. package/dist/session/agent.d.ts +14 -2
  192. package/dist/session/agent.d.ts.map +1 -1
  193. package/dist/session/agent.js +57 -19
  194. package/dist/session/ai.d.ts +0 -11
  195. package/dist/session/ai.d.ts.map +1 -1
  196. package/dist/session/ai.js +0 -4
  197. package/dist/session/fs-watch.d.ts +0 -11
  198. package/dist/session/fs-watch.d.ts.map +1 -1
  199. package/dist/session/fs-watch.js +0 -21
  200. package/dist/session/hibernation.d.ts +68 -2
  201. package/dist/session/hibernation.d.ts.map +1 -1
  202. package/dist/session/hibernation.js +95 -1
  203. package/dist/session/init-phases.d.ts +1 -2
  204. package/dist/session/init-phases.d.ts.map +1 -1
  205. package/dist/session/init-phases.js +1 -2
  206. package/dist/session/init.d.ts.map +1 -1
  207. package/dist/session/init.js +7 -20
  208. package/dist/session/keys.d.ts +0 -3
  209. package/dist/session/keys.d.ts.map +1 -1
  210. package/dist/session/keys.js +0 -3
  211. package/dist/session/legacy-reset.d.ts +11 -0
  212. package/dist/session/legacy-reset.d.ts.map +1 -0
  213. package/dist/session/legacy-reset.js +16 -0
  214. package/dist/session/nimbus-session.d.ts +50 -16
  215. package/dist/session/nimbus-session.d.ts.map +1 -1
  216. package/dist/session/nimbus-session.js +77 -71
  217. package/dist/session/npm-install-port.d.ts.map +1 -1
  218. package/dist/session/npm-install-port.js +2 -0
  219. package/dist/session/programmatic.d.ts +13 -18
  220. package/dist/session/programmatic.d.ts.map +1 -1
  221. package/dist/session/programmatic.js +53 -39
  222. package/dist/session/replica-routes.d.ts +2 -3
  223. package/dist/session/replica-routes.d.ts.map +1 -1
  224. package/dist/session/replica-routes.js +3 -10
  225. package/dist/session/routes.d.ts.map +1 -1
  226. package/dist/session/routes.js +11 -12
  227. package/dist/session/rpc.d.ts +108 -21
  228. package/dist/session/rpc.d.ts.map +1 -1
  229. package/dist/session/rpc.js +194 -39
  230. package/dist/session/start-real-vite.js +2 -2
  231. package/dist/session/state-store.d.ts +1 -17
  232. package/dist/session/state-store.d.ts.map +1 -1
  233. package/dist/session/state-store.js +3 -53
  234. package/dist/session/supervisor-op.d.ts +7 -0
  235. package/dist/session/supervisor-op.d.ts.map +1 -1
  236. package/dist/session/supervisor-op.js +6 -1
  237. package/dist/session/supervisor-rpc.d.ts +116 -19
  238. package/dist/session/supervisor-rpc.d.ts.map +1 -1
  239. package/dist/session/supervisor-rpc.js +194 -84
  240. package/dist/session/vite-command.d.ts.map +1 -1
  241. package/dist/session/vite-command.js +17 -14
  242. package/dist/session/ws.d.ts.map +1 -1
  243. package/dist/session/ws.js +20 -8
  244. package/dist/shell/npm-bin-entrypoints.d.ts.map +1 -1
  245. package/dist/shell/npm-bin-entrypoints.js +30 -5
  246. package/dist/vfs/facet-resident-limits.d.ts +33 -0
  247. package/dist/vfs/facet-resident-limits.d.ts.map +1 -0
  248. package/dist/vfs/facet-resident-limits.js +33 -0
  249. package/dist/vfs/facet-resident-store.d.ts +2 -10
  250. package/dist/vfs/facet-resident-store.d.ts.map +1 -1
  251. package/dist/vfs/facet-resident-store.js +1594 -219
  252. package/dist/workspace-host.d.ts +3 -1
  253. package/dist/workspace-host.d.ts.map +1 -1
  254. package/dist/workspace-host.js +2 -0
  255. package/dist/wrangler/nimbus-wrangler.d.ts +0 -2
  256. package/dist/wrangler/nimbus-wrangler.d.ts.map +1 -1
  257. package/dist/wrangler/nimbus-wrangler.js +8 -22
  258. package/package.json +34 -7
  259. package/public/_assets/esbuild-0.24.2.js +2380 -0
  260. package/public/_assets/opencode/1.16.2/index-attach.js +2 -2
  261. package/public/_assets/runtime/esbuild-cli-c4fda380d52befc1.js +6892 -0
  262. package/public/_assets/runtime/git-de3e60c9f3ff006a.js +103 -0
  263. package/public/_assets/runtime/{node-shims-acaa037e6d26ec0d.js → node-shims-06565b121555c194.js} +2879 -992
  264. package/public/_assets/runtime/resident-store-6ffb1939c53d982f.js +2264 -0
  265. package/public/_assets/runtime/vfs-write-ledger-e501e8fc793bc2c1.js +889 -0
  266. package/scripts/build-opencode-attach-entry.mjs +51 -1
  267. package/scripts/bundle-esbuild-wasm.mjs +55 -39
  268. package/scripts/bundle-facet-workers.mjs +159 -10
  269. package/scripts/bundle-git.mjs +88 -27
  270. package/scripts/bundle-node-shims.mjs +72 -46
  271. package/scripts/bundle-runtime.mjs +18 -421
  272. package/scripts/cf-git-patch.mjs +137 -0
  273. package/scripts/patch-install-deps.mjs +49 -96
  274. package/scripts/runtime-specs.mjs +435 -0
  275. package/vendor/git-http.generated.d.ts +82 -0
  276. package/vendor/git-upstream.generated.d.ts +4378 -0
  277. package/vendor/git.LICENSE +7 -0
  278. package/vendor/git.generated.d.mts +21 -0
  279. package/vendor/git.generated.mjs +103 -0
  280. package/dist/replica/suspension.d.ts +0 -36
  281. package/dist/replica/suspension.d.ts.map +0 -1
  282. package/dist/replica/suspension.js +0 -49
  283. package/dist/runtime/static-server.d.ts +0 -3
  284. package/dist/runtime/static-server.d.ts.map +0 -1
  285. package/dist/runtime/static-server.js +0 -133
  286. package/scripts/clean-dist.mjs +0 -7
@@ -1 +1 @@
1
- {"version":3,"file":"opencode-artifact.d.ts","sourceRoot":"","sources":["../../src/runtime/opencode-artifact.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAcH,kEAAkE;AAClE,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE;QAAE,KAAK,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAA;KAAE,CAAC;CACpD;AAwFD,oDAAoD;AACpD;;;;;;;;;GASG;AACH,eAAO,MAAM,2BAA2B,oBAAoB,CAAC;AAE7D,wBAAsB,mBAAmB,CACvC,GAAG,EAAE,gBAAgB,EACrB,IAAI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C,GAAG,EAAE,gBAAgB,EACrB,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAYjC"}
@@ -20,19 +20,9 @@
20
20
  * (see OPENCODE_TREE_SITTER_WASMS and FacetManager.treeSitterModuleEntries).
21
21
  */
22
22
  import { OPENCODE_ARTIFACT_BUILD_ID, OPENCODE_ARTIFACT_DIGESTS, OPENCODE_ARTIFACT_PRESENT, OPENCODE_ARTIFACT_VERSION, } from '../opencode-artifact.generated.js';
23
- import { disposeRpcResource } from '@nimbus-sh/platform/rpc-dispose.js';
24
- import { sha256Hex } from '@nimbus-sh/core/_shared/crypto.js';
23
+ import { fetchStagedBytes } from './staged-source.js';
25
24
  /** Base asset path of the staged opencode bundle directory. */
26
25
  const OPENCODE_ASSET_BASE = `/_assets/opencode/${OPENCODE_ARTIFACT_VERSION}`;
27
- // The build id (content hash of the staged dist) is part of the L2 key so a
28
- // same-version rebuild with different bytes never serves stale content from a
29
- // warm colo cache.
30
- function l2Key(file) {
31
- return `https://nimbus-cache.invalid${OPENCODE_ASSET_BASE}/${OPENCODE_ARTIFACT_BUILD_ID}/${file}`;
32
- }
33
- function assetUrl(file) {
34
- return `https://nimbus-internal.invalid${OPENCODE_ASSET_BASE}/${file}`;
35
- }
36
26
  /**
37
27
  * The pinned digest for a staged file. Unstaged builds carry an empty map, so
38
28
  * the two conditions are reported apart: "this build has no artifact at all"
@@ -54,48 +44,22 @@ function pinnedDigest(file) {
54
44
  }
55
45
  async function fetchAsset(env, file) {
56
46
  const expected = pinnedDigest(file);
57
- const caches = globalThis.caches;
58
- let ab = null;
59
- try {
60
- if (caches?.default) {
61
- const hit = await caches.default.match(new Request(l2Key(file)));
62
- if (hit && hit.ok)
63
- ab = await hit.arrayBuffer();
64
- }
65
- }
66
- catch { /* fall through to ASSETS */ }
67
- const fromCache = ab !== null;
68
- if (!ab) {
69
- const res = await env.ASSETS.fetch(new Request(assetUrl(file)));
70
- try {
71
- if (!res.ok) {
72
- throw new Error(`opencode asset fetch failed: ${res.status} ${res.statusText} for ` +
73
- `${OPENCODE_ASSET_BASE}/${file} — deploy is missing the staged opencode artifact`);
74
- }
75
- ab = await res.arrayBuffer();
76
- }
77
- finally {
78
- disposeRpcResource(res);
79
- }
80
- }
81
- const digest = await sha256Hex(ab);
82
- if (digest !== expected) {
83
- throw new Error(`opencode asset integrity check failed for ${OPENCODE_ASSET_BASE}/${file}: expected ` +
84
- `${expected}, got ${digest} (${fromCache ? 'L2 cache' : 'ASSETS'}) — the staged ` +
85
- 'artifact is corrupt or out of sync; rerun scripts/bundle-opencode.mjs and redeploy');
86
- }
87
- if (!fromCache) {
88
- try {
89
- if (caches?.default) {
90
- const writeBack = new Response(new Uint8Array(ab), {
91
- headers: { 'Cache-Control': 'public, max-age=31536000, immutable' },
92
- });
93
- await caches.default.put(new Request(l2Key(file)), writeBack);
94
- }
95
- }
96
- catch { /* silent */ }
97
- }
98
- return ab;
47
+ const path = `${OPENCODE_ASSET_BASE}/${file}`;
48
+ return fetchStagedBytes(env, {
49
+ path,
50
+ // The build id (content hash of the staged dist) is part of the key so a
51
+ // same-version rebuild with different bytes never serves stale content
52
+ // from a warm colo cache.
53
+ l2Key: `https://nimbus-cache.invalid${OPENCODE_ASSET_BASE}/${OPENCODE_ARTIFACT_BUILD_ID}/${file}`,
54
+ sha256: expected,
55
+ poisonedCache: 'reject',
56
+ missingBinding: `Nimbus: opencode requires an env.ASSETS binding (serves ${path})`,
57
+ fetchFailed: (res) => `opencode asset fetch failed: ${res.status} ${res.statusText} for ` +
58
+ `${path} — deploy is missing the staged opencode artifact`,
59
+ integrityFailed: (digest, from) => `opencode asset integrity check failed for ${path}: expected ` +
60
+ `${expected}, got ${digest} (${from}) — the staged ` +
61
+ 'artifact is corrupt or out of sync; rerun scripts/bundle-opencode.mjs and redeploy',
62
+ });
99
63
  }
100
64
  /** Fetch the opencode CLI bundle source as text. */
101
65
  /**
@@ -35,6 +35,7 @@
35
35
  * map (see SQLITE_WASM_MODULE_NAME) and is booted before opencode opens the
36
36
  * DB at ~/.local/share/opencode/*.db.
37
37
  */
38
+ import type { NodeFacetSources } from './node-shims-artifact.js';
38
39
  /** Map-module specifier for the opencode ESM bundle. */
39
40
  export declare const OPENCODE_BUNDLE_MODULE_NAME = "opencode-bundle.js";
40
41
  /**
@@ -75,18 +76,14 @@ export interface OpencodeRunnerOptions {
75
76
  };
76
77
  cwd: string;
77
78
  stdin: string;
78
- /** The node-compat shim source (fetchNodeShimsCode — the staged asset). */
79
- shimsCode: string;
79
+ /** The node-compat layer's sources (fetchNodeFacetSources — the staged assets). */
80
+ sources: NodeFacetSources;
80
81
  /**
81
82
  * Serialized VFS snapshot bundle (the `_serializeBundleForFacet` IIFE
82
83
  * string). Provides sync VFS reads; async writes/mkdir flush live through
83
84
  * the SUPERVISOR RPC binding.
84
85
  */
85
86
  vfsBundle: string;
86
- /** Serialized VFS directory manifest (JSON) for readdir/stat coherence. */
87
- vfsManifest: string;
88
- /** Serialized VFS inode metadata (JSON) for stat and permission checks. */
89
- vfsMetadata: string;
90
87
  /** The coherence cursor the snapshot above was read at, as a JSON literal. */
91
88
  vfsCursor: string;
92
89
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"opencode-facet-runner.d.ts","sourceRoot":"","sources":["../../src/runtime/opencode-facet-runner.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AAkBH,wDAAwD;AACxD,eAAO,MAAM,2BAA2B,uBAAuB,CAAC;AAGhE;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,cAAc,CAAC;AAEjD,8DAA8D;AAC9D,eAAO,MAAM,uBAAuB,gBAAgB,CAAC;AAErD;;;;;;;;GAQG;AACH,eAAO,MAAM,6BAA6B,8BAA8B,CAAC;AA0JzE;;;;GAIG;AACH,wBAAgB,4BAA4B,CAAC,WAAW,UAAQ,GAAG,MAAM,CAAC,MAAM,EAAE;IAA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;;;GAiBG;AACH,eAAO,MAAM,yBAAyB,EAAE,MAevC,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,eAAO,MAAM,mBAAmB,EAAE,MAmOjC,CAAC;AA2BF;;;;GAIG;AACH,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,qBAAqB,GAAG,MAAM,CAwuB9E"}
@@ -37,13 +37,14 @@
37
37
  */
38
38
  import { generateSqliteFacetPreamble } from './sqlite-shim.js';
39
39
  import { VFS_CURSOR_SEED_SOURCE } from '@nimbus-sh/core/_shared/facet-vfs-cursor.js';
40
- import { VFS_WRITE_LEDGER_SOURCE } from '@nimbus-sh/core/_shared/vfs-write-ledger.js';
40
+ import { ONE_SHOT_STORE_MEMORY_BYTES } from '../vfs/facet-resident-limits.js';
41
41
  import { OPENTUI_BACKEND_FACET_SRC, OPENTUI_BACKEND_GLOBAL, OPENTUI_WASM_MODULE_NAME, generateOpenTUIBackendBootCode, } from './opentui-facet-backend.js';
42
42
  import { OPENCODE_TREE_SITTER_WASMS, OPENCODE_YOGA_WASM } from '../opencode-artifact.generated.js';
43
- // The ~230 KiB node-compat shim source is staged as a static asset
44
- // (scripts/bundle-node-shims.mjs) — promoted out of the worker bundle for the
45
- // ≤6 MiB gate. The caller (FacetManager.execStagedArtifact) awaits the
46
- // memoized fetchNodeShimsCode and threads it in via opts.shimsCode.
43
+ // The node-compat layer's sources (the ~230 KiB shims and the VFS write ledger
44
+ // they write through) are staged as static assets (scripts/bundle-node-shims.mjs),
45
+ // promoted out of the worker bundle for its size gate. The caller
46
+ // (opencode-staging.ts) awaits the memoized fetchNodeFacetSources and threads
47
+ // them in via opts.sources.
47
48
  /** Map-module specifier for the opencode ESM bundle. */
48
49
  export const OPENCODE_BUNDLE_MODULE_NAME = 'opencode-bundle.js';
49
50
  /**
@@ -705,12 +706,18 @@ let stdout = "";
705
706
  let stderr = "";
706
707
  let exitCode = 0;
707
708
  let __supervisor = null;
708
- const __vfsBundle = ${opts.vfsBundle};
709
- const __vfsManifest = ${opts.vfsManifest};
710
- const __vfsMetadata = ${opts.vfsMetadata};
709
+ // The process's view of the filesystem: the same store and namespace a node
710
+ // process boots on (vfs/facet-resident-store.ts), in this facet's heap and
711
+ // bounded there. An opencode facet has no storage allowance of the session's
712
+ // ledger to grow a SQLite store under. Bound and booted by __ocBootStore
713
+ // before the opencode bundle is imported; the shims read it through
714
+ // __nimbusResidentBundle.
715
+ let __MODULE_VFS_BUNDLE = ${opts.vfsBundle};
711
716
  const __MODULE_VFS_CURSOR = ${opts.vfsCursor};
717
+ ${opts.sources.residentStore}
718
+ const __vfsBundle = __nimbusResidentBundle;
712
719
  ${VFS_CURSOR_SEED_SOURCE}
713
- ${VFS_WRITE_LEDGER_SOURCE}
720
+ ${opts.sources.ledger}
714
721
  const __vfsDirs = {};
715
722
  const __nimbusDeferProcessExitReport = true;
716
723
  // Ledger of in-flight facet I/O the teardown drain must await. The shims push
@@ -739,7 +746,7 @@ class __ProcessExit extends Error {
739
746
  constructor(code) { super("process.exit(" + code + ")"); this.code = code; }
740
747
  }
741
748
 
742
- ${opts.shimsCode}
749
+ ${opts.sources.shims}
743
750
 
744
751
  globalThis.${BUILTINS_GLOBAL} = builtins;
745
752
  // Capture workerd's real process.memoryUsage BEFORE the shim process takes over
@@ -1182,9 +1189,33 @@ async function __ocDispatchHttp(request) {
1182
1189
  return globalThis.__nimbusServeHttp(request);
1183
1190
  }
1184
1191
 
1192
+ /**
1193
+ * Bind and boot the store, and require its namespace, before any opencode code
1194
+ * runs: every synchronous stat, exists and readdir reads it. Resolves to null,
1195
+ * or to the launch's failure naming why.
1196
+ */
1197
+ async function __ocBootStore() {
1198
+ __residentBindInMemory(${ONE_SHOT_STORE_MEMORY_BYTES});
1199
+ __residentSetStorage(undefined, __supervisor);
1200
+ __nsSetCred(cred);
1201
+ __residentSetPlan([]);
1202
+ __residentSetPushRoots([cwd || "/home/user", "/tmp"]);
1203
+ const __booted = await __residentBoot(
1204
+ () => { const __bundle = __MODULE_VFS_BUNDLE; __MODULE_VFS_BUNDLE = null; return __bundle; },
1205
+ __MODULE_VFS_CURSOR,
1206
+ __supervisor,
1207
+ );
1208
+ if (__booted.cursor) {
1209
+ globalThis.__nimbusVfsCursor = { epoch: __booted.cursor.epoch, rev: __booted.cursor.rev };
1210
+ }
1211
+ return __residentRequireNamespace(__supervisor, __booted.failure);
1212
+ }
1213
+
1185
1214
  export class NimbusProcess extends __NimbusDurableObject {
1186
1215
  async startProcess() {
1187
1216
  __supervisor = (this.env && this.env.SUPERVISOR) || null;
1217
+ const __bootFailure = await __ocBootStore();
1218
+ if (__bootFailure) throw new Error(__bootFailure);
1188
1219
  // Run the resident lifecycle and hold THIS RPC open until it exits — the
1189
1220
  // same contract the long-running node path uses (its startProcess awaits
1190
1221
  // the resident lifecycle). The open call keeps the caller's stubs live for
@@ -1267,6 +1298,10 @@ async function __ocRunServe() {
1267
1298
 
1268
1299
  async function __ocOneShotFetch(request, workerEnv) {
1269
1300
  __supervisor = (workerEnv && workerEnv.SUPERVISOR) || null;
1301
+ const __bootFailure = await __ocBootStore();
1302
+ if (__bootFailure) {
1303
+ return __ocHostResponse.json({ exitCode: 1, stdout: "", stderr: __bootFailure + "\\n", vfsWrites: {} });
1304
+ }
1270
1305
  try {
1271
1306
  const __ocBundle = await import("${OPENCODE_BUNDLE_MODULE_NAME}");
1272
1307
  if (argv[2] === "${OPENCODE_TREE_SITTER_DIAG_ARG}") {
@@ -1 +1 @@
1
- {"version":3,"file":"opentui-wasm-bytes.d.ts","sourceRoot":"","sources":["../../src/runtime/opentui-wasm-bytes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAUH,kEAAkE;AAClE,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE;QAAE,KAAK,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAA;KAAE,CAAC;CACpD;AASD;;;;;;;GAOG;AACH,wBAAsB,qBAAqB,CAAC,GAAG,EAAE,mBAAmB,GAAG,OAAO,CAAC,WAAW,CAAC,CAqD1F"}
1
+ {"version":3,"file":"opentui-wasm-bytes.d.ts","sourceRoot":"","sources":["../../src/runtime/opentui-wasm-bytes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AASH,kEAAkE;AAClE,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE;QAAE,KAAK,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAA;KAAE,CAAC;CACpD;AAyBD;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,mBAAmB,GAAG,OAAO,CAAC,WAAW,CAAC,CAEpF"}
@@ -16,14 +16,26 @@
16
16
  * the backend.
17
17
  */
18
18
  import { OPENTUI_WASM_BUILD_ID, OPENTUI_WASM_ENTRY, OPENTUI_WASM_SHA256, } from '../opentui-wasm-artifact.generated.js';
19
- import { disposeRpcResource } from '@nimbus-sh/platform/rpc-dispose.js';
20
- import { sha256Hex } from '@nimbus-sh/core/_shared/crypto.js';
19
+ import { fetchStagedBytes } from './staged-source.js';
21
20
  /**
22
21
  * Synthetic L2 cache key for the OpenTUI wasm asset. Build-id-pinned so a
23
22
  * same-version rebuild with different bytes lands a fresh entry instead of
24
23
  * serving stale content from a warm colo cache.
25
24
  */
26
25
  const OPENTUI_WASM_L2_KEY = `https://nimbus-cache.invalid${OPENTUI_WASM_ENTRY}?build=${OPENTUI_WASM_BUILD_ID}`;
26
+ const OPENTUI_WASM_ASSET = {
27
+ path: OPENTUI_WASM_ENTRY,
28
+ l2Key: OPENTUI_WASM_L2_KEY,
29
+ sha256: OPENTUI_WASM_SHA256,
30
+ contentType: 'application/wasm',
31
+ poisonedCache: 'reject',
32
+ missingBinding: `Nimbus: the OpenTUI backend requires an env.ASSETS binding (serves ${OPENTUI_WASM_ENTRY})`,
33
+ fetchFailed: (res) => `OpenTUI wasm asset fetch failed: ${res.status} ${res.statusText} for ` +
34
+ `${OPENTUI_WASM_ENTRY} — deploy is missing the staged opentui artifact`,
35
+ integrityFailed: (digest, from) => `OpenTUI wasm integrity check failed: expected ${OPENTUI_WASM_SHA256}, got ` +
36
+ `${digest} (${from}) — the staged artifact is ` +
37
+ `corrupt or out of sync with opentui-wasm-artifact.generated.ts`,
38
+ };
27
39
  /**
28
40
  * Fetch the staged OpenTUI wasm bytes and verify their SHA-256 against the
29
41
  * generated digest.
@@ -32,51 +44,6 @@ const OPENTUI_WASM_L2_KEY = `https://nimbus-cache.invalid${OPENTUI_WASM_ENTRY}?b
32
44
  * failures are silent — ASSETS is always the source of truth. A non-200 from
33
45
  * ASSETS, or a digest mismatch, throws.
34
46
  */
35
- export async function fetchOpenTUIWasmBytes(env) {
36
- const caches = globalThis.caches;
37
- let bytes = null;
38
- try {
39
- if (caches?.default) {
40
- const hit = await caches.default.match(new Request(OPENTUI_WASM_L2_KEY));
41
- if (hit && hit.ok)
42
- bytes = await hit.arrayBuffer();
43
- }
44
- }
45
- catch { /* fall through to ASSETS */ }
46
- let fromCache = bytes !== null;
47
- if (!bytes) {
48
- const url = `https://nimbus-internal.invalid${OPENTUI_WASM_ENTRY}`;
49
- const res = await env.ASSETS.fetch(new Request(url));
50
- try {
51
- if (!res.ok) {
52
- throw new Error(`OpenTUI wasm asset fetch failed: ${res.status} ${res.statusText} for ` +
53
- `${OPENTUI_WASM_ENTRY} — deploy is missing the staged opentui artifact`);
54
- }
55
- bytes = await res.arrayBuffer();
56
- }
57
- finally {
58
- disposeRpcResource(res);
59
- }
60
- }
61
- const digest = await sha256Hex(bytes);
62
- if (digest !== OPENTUI_WASM_SHA256) {
63
- throw new Error(`OpenTUI wasm integrity check failed: expected ${OPENTUI_WASM_SHA256}, got ` +
64
- `${digest} (${fromCache ? 'L2 cache' : 'ASSETS'}) — the staged artifact is ` +
65
- `corrupt or out of sync with opentui-wasm-artifact.generated.ts`);
66
- }
67
- if (!fromCache) {
68
- try {
69
- if (caches?.default) {
70
- const writeBack = new Response(new Uint8Array(bytes), {
71
- headers: {
72
- 'Content-Type': 'application/wasm',
73
- 'Cache-Control': 'public, max-age=31536000, immutable',
74
- },
75
- });
76
- await caches.default.put(new Request(OPENTUI_WASM_L2_KEY), writeBack);
77
- }
78
- }
79
- catch { /* silent */ }
80
- }
81
- return bytes;
47
+ export function fetchOpenTUIWasmBytes(env) {
48
+ return fetchStagedBytes(env, OPENTUI_WASM_ASSET);
82
49
  }
@@ -14,7 +14,6 @@
14
14
  import { runtimeCatalogSource, type RuntimeCatalogEnv } from './runtime-catalog.js';
15
15
  import type { CredentialedVfs } from '@nimbus-sh/core/vfs/sqlite-vfs.js';
16
16
  import type { RuntimeManager } from '@nimbus-sh/core/runtime/runtime-manager.js';
17
- import type { RuntimeAvailability } from '@nimbus-sh/core/runtime/runtime-package.js';
18
17
  import { type RuntimeWarmHook } from '@nimbus-sh/core/runtime/nimbus-command.js';
19
18
  import type { MinShellRegistry } from '@nimbus-sh/core/runtime/installed-runtimes.js';
20
19
  export { runtimeCatalogSource };
@@ -54,7 +53,6 @@ export declare function ensureRuntimesProgrammatic(deps: {
54
53
  }, specs: string[], opts?: {
55
54
  force?: boolean;
56
55
  }): Promise<RuntimeInstallSummary[]>;
57
- export declare function listAvailableRuntimes(env: RuntimeCatalogEnv): Promise<RuntimeAvailability[]>;
58
56
  /**
59
57
  * Command-not-found hints, catalog-driven: a bare name the shell could not
60
58
  * resolve is answered with the runtime that provides it, so `python3` hints
@@ -1 +1 @@
1
- {"version":3,"file":"package-manager.d.ts","sourceRoot":"","sources":["../../src/runtime/package-manager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAGL,oBAAoB,EACpB,KAAK,iBAAiB,EACvB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AAEzE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4CAA4C,CAAC;AAC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M,EAAE,IAAI,GAAE;IAAE,KAAK,CAAC,EAAE,OAAO,CAAA;CAAO,GAAG,OAAO,CAAC,qBAAqB,CAAC,CA6B/E;AAED,wBAAsB,0BAA0B,CAAC,IAAI,EAAE;IACrD,QAAQ,EAAE,cAAc,CAAC;IACzB,QAAQ,EAAE,gBAAgB,CAAC;IAC3B,GAAG,EAAE,eAAe,CAAC;IACrB,OAAO,IAAI,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,eAAe,CAAC;CAC/B,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,IAAI,GAAE;IAAE,KAAK,CAAC,EAAE,OAAO,CAAA;CAAO,GAAG,OAAO,CAAC,qBAAqB,EAAE,CAAC,CAMpF;AAID;;;;;GAKG;AACH,wBAAgB,gCAAgC,CAAC,GAAG,EAAE,iBAAiB,GAAG,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,kBAAkB,GAAG,IAAI,CAAC,CAyChI"}
@@ -59,9 +59,6 @@ export async function ensureRuntimesProgrammatic(deps, specs, opts = {}) {
59
59
  }
60
60
  return results;
61
61
  }
62
- export async function listAvailableRuntimes(env) {
63
- return runtimeCatalogSource(env).list();
64
- }
65
62
  /**
66
63
  * Command-not-found hints, catalog-driven: a bare name the shell could not
67
64
  * resolve is answered with the runtime that provides it, so `python3` hints
@@ -1 +1 @@
1
- {"version":3,"file":"python-repl.d.ts","sourceRoot":"","sources":["../../src/runtime/python-repl.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,+CAA+C,CAAC;AAE3E;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6CAA6C,CAAC;AAMnF,OAAO,EAAe,KAAK,yBAAyB,EAAE,MAAM,yCAAyC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IAC1B;;;;;;;;;OASG;IACH,KAAK,CAAC,EAAE,IAAI,CAAC,KAAK,EAAE,iBAAiB,CAAC,CAAC;IACvC;;;;;;;;OAQG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAgRD,wBAAsB,aAAa,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CAIzE;AAED;;;GAGG;AACH,wBAAsB,cAAc,CAClC,IAAI,EAAE,IAAI,CAAC,cAAc,EAAE,UAAU,GAAG,WAAW,GAAG,aAAa,GAAG,UAAU,CAAC,GAChF,OAAO,CAAC,IAAI,CAAC,CAIf"}
@@ -1,6 +1,5 @@
1
1
  import { IsolatePool } from '@nimbus-sh/fabric/isolate-pool.js';
2
- import { manifestVfs } from '@nimbus-sh/core/runtime/vfs-manifest.js';
3
- import { withHostFilesystem } from '@nimbus-sh/core/shell/execution-fs.js';
2
+ import { withHostView } from '@nimbus-sh/core/runtime/process-files.js';
4
3
  import { z } from 'zod/v4';
5
4
  import { ReplSession } from './repl-session.js';
6
5
  import { sessionUsesSciVariant } from '@nimbus-sh/core/runtime/python-pip.js';
@@ -76,7 +75,6 @@ class PythonReplAdapter {
76
75
  poolUsesSci = false;
77
76
  deps;
78
77
  wasmBytes = null;
79
- fsSnapshot = null;
80
78
  pythonHome = '/usr/local';
81
79
  ps1 = '>>> ';
82
80
  ps2 = '... ';
@@ -151,7 +149,6 @@ class PythonReplAdapter {
151
149
  const pool = this.pool;
152
150
  this.pool = null;
153
151
  this.wasmBytes = null;
154
- this.fsSnapshot = null;
155
152
  pool?.dispose();
156
153
  }
157
154
  async interrupt() {
@@ -165,7 +162,7 @@ class PythonReplAdapter {
165
162
  }
166
163
  }
167
164
  async ensurePool() {
168
- await withHostFilesystem(this.deps.authority, CRED_KERNEL, (vfs) => this.ensurePoolFrom(vfs));
165
+ await withHostView(this.deps.authority, CRED_KERNEL, (vfs) => this.ensurePoolFrom(vfs));
169
166
  }
170
167
  async ensurePoolFrom(vfs) {
171
168
  const sciPath = `${this.deps.installRoot}/${CPYTHON_SCI_WASM_REL}`;
@@ -189,25 +186,6 @@ class PythonReplAdapter {
189
186
  throw new Error(`python313.zip missing at ${stdlibPath} (run 'nimbus install python')`);
190
187
  }
191
188
  this.wasmBytes = toArrayBuffer(await vfs.readFile(wasmPath));
192
- // The install root is the Python prefix, so the manifest covers lib/ and
193
- // etc/ as they are — nothing is aliased into a path the supervisor could
194
- // not serve.
195
- const built = await manifestVfs(vfs.authority, CRED_KERNEL, 'home/user', { extraRoots: [installRoot.replace(/^\/+/, '')] });
196
- if ('error' in built)
197
- throw new Error(built.error);
198
- // Same workaround as cpython-runner, and it belongs to the same open
199
- // defect: the guest cannot consume the stdlib as a manifest-only
200
- // demand-load, though the transport delivers it byte-identically. Seeding
201
- // it by value is what makes the interpreter start. Remove both together.
202
- const snapshot = built.snapshot;
203
- const zipBytes = await vfs.readFile(stdlibPath);
204
- let bin = '';
205
- const CH = 32768;
206
- for (let i = 0; i < zipBytes.length; i += CH) {
207
- bin += String.fromCharCode.apply(null, Array.from(zipBytes.subarray(i, i + CH)));
208
- }
209
- snapshot.files[stdlibPath.replace(/^\/+/, '')] = btoa(bin);
210
- this.fsSnapshot = snapshot;
211
189
  this.pythonHome = `/${installRoot.replace(/^\/+/, '')}`;
212
190
  const host = getFacetManagerLoaderHost(facetMgr);
213
191
  // A prompt where `open(path, "w")` silently does nothing is worse than one
@@ -236,7 +214,7 @@ class PythonReplAdapter {
236
214
  active = null;
237
215
  async submit(userCode, signal) {
238
216
  const pool = this.pool;
239
- if (!pool || !this.fsSnapshot)
217
+ if (!pool)
240
218
  throw new Error('Python REPL is not initialized');
241
219
  const response = await pool.submitRequest(pythonReplStepRequestFn, new Request('https://facet.internal/python-repl-step', {
242
220
  method: 'POST',
@@ -247,7 +225,6 @@ class PythonReplAdapter {
247
225
  userEnv: { HOME: '/home/user', PYTHONUNBUFFERED: '1' },
248
226
  progName: 'python',
249
227
  cwd: '/home/user',
250
- fsSnapshot: this.fsSnapshot,
251
228
  }),
252
229
  signal,
253
230
  }), { timeoutMs: 60_000 });
@@ -281,7 +258,6 @@ async function pythonReplStepRequestFn(request, facetEnv) {
281
258
  });
282
259
  }
283
260
  const adopt = Reflect.get(globalThis, '__wasiAdoptSupervisor');
284
- const drain = Reflect.get(globalThis, '__wasiDrainPersist');
285
261
  const supervisor = facetEnv && facetEnv.SUPERVISOR;
286
262
  // Published where the boot re-adopts it after the mount, because
287
263
  // __wasiInitFS clears the adoption on purpose. Omitting this here — while
@@ -291,14 +267,7 @@ async function pythonReplStepRequestFn(request, facetEnv) {
291
267
  Reflect.set(globalThis, '__nimbusPySupervisor', supervisor);
292
268
  if (typeof adopt === 'function')
293
269
  Reflect.apply(adopt, undefined, [supervisor ?? null]);
294
- try {
295
- return Response.json(await run(args));
296
- }
297
- finally {
298
- // A line that wrote a file and then raised still wrote the file.
299
- if (typeof drain === 'function')
300
- await drain();
301
- }
270
+ return Response.json(await run(args));
302
271
  }
303
272
  export async function runPythonRepl(deps) {
304
273
  const adapter = new PythonReplAdapter(deps);
@@ -53,6 +53,16 @@ export type ReplPushResult = {
53
53
  kind: 'error';
54
54
  stderr: string;
55
55
  };
56
+ /** The result of one Node/Bun facet evaluation. */
57
+ export interface ReplFacetResult {
58
+ stdout: string;
59
+ stderr: string;
60
+ incomplete?: boolean;
61
+ exit?: boolean;
62
+ exitCode?: number;
63
+ error?: string;
64
+ }
65
+ export declare function replPushResult(result: ReplFacetResult): ReplPushResult;
56
66
  export declare class ReplSession {
57
67
  private adapter;
58
68
  private detachRepl;
@@ -1 +1 @@
1
- {"version":3,"file":"repl-session.d.ts","sourceRoot":"","sources":["../../src/runtime/repl-session.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,+CAA+C,CAAC;AAI3E;;;GAGG;AACH,MA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D,OAAO,CAAC,aAAa,CAAgB;IACrC,OAAO,CAAC,gBAAgB,CAA0C;IAClE,OAAO,CAAC,UAAU,CAAwC;IAC1D,OAAO,CAAC,MAAM,CAA8B;IAE5C,4DAA4D;IAC5D,OAAO,CAAC,QAAQ,CAAa;IAC7B;;;;;;;;;;;;;;;OAeG;IACH,OAAO,CAAC,UAAU,CAAc;IAChC,OAAO,CAAC,QAAQ,CAAkB;gBAEtB,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,iBAAiB,EAAE,KAAK,CAAC,EAAE,IAAI,CAAC,KAAK,EAAE,iBAAiB,CAAC;IAUrG;4EACwE;IAClE,GAAG,IAAI,OAAO,CAAC,MAAM,CAAC;YAuCd,UAAU;IAiBxB;;qCAEiC;YACnB,WAAW;IA0EzB,OAAO,CAAC,aAAa;YAiBP,UAAU;IA0FxB,6CAA6C;IAC7C,OAAO,CAAC,SAAS;IAMjB,mDAAmD;IACnD,OAAO,CAAC,WAAW;IAUnB,gEAAgE;IAChE,OAAO,CAAC,kBAAkB;IAU1B,OAAO,CAAC,UAAU;CAwBnB"}
@@ -13,6 +13,13 @@
13
13
  */
14
14
  import { errorText } from '@nimbus-sh/core/_shared/error-text.js';
15
15
  import { normalizeTerminalNewlines } from '@nimbus-sh/core/_shared/terminal.js';
16
+ export function replPushResult(result) {
17
+ if (result.exit)
18
+ return { kind: 'exit', exitCode: result.exitCode || 0, stdout: result.stdout, stderr: result.stderr };
19
+ if (result.incomplete)
20
+ return { kind: 'incomplete' };
21
+ return { kind: 'output', stdout: result.stdout || '', stderr: result.stderr || '' };
22
+ }
16
23
  export class ReplSession {
17
24
  adapter;
18
25
  detachRepl = null;
@@ -1 +1 @@
1
- {"version":3,"file":"ruby-repl.d.ts","sourceRoot":"","sources":["../../src/runtime/ruby-repl.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAIlE,OAAO,EAAe,KAAK,yBAAyB,EAAE,MAAM,yCAAyC,CAAC;AAGtG,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE,YAAY,CAAC;IACvB,qEAAqE;IACrE,SAAS,EAAE,yBAAyB,CAAC;IACrC,QAAQ,EAAE,iBAAiB,CAAC;IAC5B,kDAAkD;IAClD,WAAW,EAAE,MAAM,CAAC;CACrB;AA8MD;;;;GAIG;AACH,wBAAsB,WAAW,CAAC,IAAI,EAAE,YAAY,GAAG,OAAO,CAAC,MAAM,CAAC,CAIrE"}
1
+ {"version":3,"file":"ruby-repl.d.ts","sourceRoot":"","sources":["../../src/runtime/ruby-repl.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAIlE,OAAO,EAAe,KAAK,yBAAyB,EAAE,MAAM,yCAAyC,CAAC;AAItG,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE,YAAY,CAAC;IACvB,qEAAqE;IACrE,SAAS,EAAE,yBAAyB,CAAC;IACrC,QAAQ,EAAE,iBAAiB,CAAC;IAC5B,kDAAkD;IAClD,WAAW,EAAE,MAAM,CAAC;CACrB;AA8MD;;;;GAIG;AACH,wBAAsB,WAAW,CAAC,IAAI,EAAE,YAAY,GAAG,OAAO,CAAC,MAAM,CAAC,CAIrE"}
@@ -27,7 +27,7 @@
27
27
  import { ReplSession } from './repl-session.js';
28
28
  import { buildRubyPreamble } from '@nimbus-sh/core/runtime/ruby-runner.js';
29
29
  import { CRED_KERNEL } from '@nimbus-sh/core/runtime/os-contracts.js';
30
- import { withHostFilesystem } from '@nimbus-sh/core/shell/execution-fs.js';
30
+ import { withHostView } from '@nimbus-sh/core/runtime/process-files.js';
31
31
  class RubyReplAdapter {
32
32
  pool = null;
33
33
  deps;
@@ -147,7 +147,7 @@ class RubyReplAdapter {
147
147
  return;
148
148
  const { installRoot, facetMgr } = this.deps;
149
149
  const wasmPath = `${installRoot}/share/ruby/ruby+stdlib.wasm`;
150
- this.wasmBytesAB = toAB(await withHostFilesystem(this.deps.authority, CRED_KERNEL, async (vfs) => {
150
+ this.wasmBytesAB = toAB(await withHostView(this.deps.authority, CRED_KERNEL, async (vfs) => {
151
151
  if (!(await vfs.exists(wasmPath))) {
152
152
  throw new Error(`ruby+stdlib.wasm missing at ${wasmPath} (run 'nimbus install ruby')`);
153
153
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ruby-resident.d.ts","sourceRoot":"","sources":["../../src/runtime/ruby-resident.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,EAIL,KAAK,iBAAiB,EACvB,MAAM,wCAAwC,CAAC;AAEhD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAezD;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,YAAY,GAAG,iBAAiB,CAgF3E;AAED,wBAAgB,4BAA4B,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAiLrE"}
1
+ {"version":3,"file":"ruby-resident.d.ts","sourceRoot":"","sources":["../../src/runtime/ruby-resident.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,EAIL,KAAK,iBAAiB,EACvB,MAAM,wCAAwC,CAAC;AAEhD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAezD;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,YAAY,GAAG,iBAAiB,CA+D3E;AAED,wBAAgB,4BAA4B,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAqLrE"}