@nimbus-sh/core 0.4.0 → 0.6.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 (156) hide show
  1. package/README.md +35 -7
  2. package/dist/_shared/cache-stats.d.ts +23 -1
  3. package/dist/_shared/cache-stats.d.ts.map +1 -1
  4. package/dist/_shared/cache-stats.js +13 -1
  5. package/dist/_shared/error-text.d.ts +15 -0
  6. package/dist/_shared/error-text.d.ts.map +1 -0
  7. package/dist/_shared/error-text.js +21 -0
  8. package/dist/_shared/exports-resolver.d.ts +19 -7
  9. package/dist/_shared/exports-resolver.d.ts.map +1 -1
  10. package/dist/_shared/exports-resolver.js +1 -1
  11. package/dist/_shared/retry.d.ts.map +1 -1
  12. package/dist/_shared/retry.js +4 -2
  13. package/dist/constants.d.ts +5 -11
  14. package/dist/constants.d.ts.map +1 -1
  15. package/dist/constants.js +23 -49
  16. package/dist/runtime/assets-loader.js +1 -1
  17. package/dist/runtime/esbuild-service.d.ts +4 -3
  18. package/dist/runtime/esbuild-service.d.ts.map +1 -1
  19. package/dist/runtime/esbuild-service.js +9 -4
  20. package/dist/runtime/installed-runtimes.d.ts +4 -3
  21. package/dist/runtime/installed-runtimes.d.ts.map +1 -1
  22. package/dist/runtime/long-running-handle.d.ts +3 -3
  23. package/dist/runtime/long-running-handle.d.ts.map +1 -1
  24. package/dist/runtime/os-contracts.d.ts +7 -5
  25. package/dist/runtime/os-contracts.d.ts.map +1 -1
  26. package/dist/runtime/port-registry.d.ts +28 -0
  27. package/dist/runtime/port-registry.d.ts.map +1 -1
  28. package/dist/runtime/port-registry.js +79 -9
  29. package/dist/runtime/process-logs.d.ts +9 -1
  30. package/dist/runtime/process-logs.d.ts.map +1 -1
  31. package/dist/runtime/project-detect.d.ts +6 -1
  32. package/dist/runtime/project-detect.d.ts.map +1 -1
  33. package/dist/runtime/require-resolver.d.ts.map +1 -1
  34. package/dist/runtime/require-resolver.js +3 -4
  35. package/dist/runtime/runtime-registry.d.ts +4 -3
  36. package/dist/runtime/runtime-registry.d.ts.map +1 -1
  37. package/dist/runtime/runtime-registry.js +2 -1
  38. package/dist/runtime/sqlite-runtime-fs-bridge.js +1 -5
  39. package/dist/runtime/virtual-socket-kernel.d.ts.map +1 -1
  40. package/dist/runtime/virtual-socket-kernel.generated.d.ts +2 -2
  41. package/dist/runtime/virtual-socket-kernel.generated.d.ts.map +1 -1
  42. package/dist/runtime/virtual-socket-kernel.generated.js +3 -3
  43. package/dist/runtime/virtual-socket-kernel.js +10 -5
  44. package/dist/runtime/wasm-runner.d.ts.map +1 -1
  45. package/dist/runtime/wasm-runner.js +22 -14
  46. package/dist/shell/features.d.ts.map +1 -1
  47. package/dist/shell/features.js +5 -4
  48. package/dist/shell/unix-commands.d.ts +14 -1
  49. package/dist/shell/unix-commands.d.ts.map +1 -1
  50. package/dist/shell/unix-commands.js +115 -69
  51. package/dist/substrate/lifo/commands/net/ip.d.ts.map +1 -1
  52. package/dist/substrate/lifo/commands/system/ps.d.ts +2 -1
  53. package/dist/substrate/lifo/commands/system/ps.d.ts.map +1 -1
  54. package/dist/substrate/lifo/kernel/ServiceManager.d.ts.map +1 -1
  55. package/dist/substrate/lifo/kernel/ServiceManager.js +0 -2
  56. package/dist/substrate/lifo/kernel/network/NetworkStack.d.ts +22 -11
  57. package/dist/substrate/lifo/kernel/network/NetworkStack.d.ts.map +1 -1
  58. package/dist/substrate/lifo/kernel/network/NetworkStack.js +0 -2
  59. package/dist/substrate/lifo/kernel/network/tunnel/WebSocketTunnel.d.ts +2 -1
  60. package/dist/substrate/lifo/kernel/network/tunnel/WebSocketTunnel.d.ts.map +1 -1
  61. package/dist/substrate/lifo/kernel/network/tunnel/WebSocketTunnel.js +3 -4
  62. package/dist/substrate/lifo/kernel/vfs/VFS.d.ts +17 -0
  63. package/dist/substrate/lifo/kernel/vfs/VFS.d.ts.map +1 -1
  64. package/dist/substrate/lifo/kernel/vfs/VFS.js +33 -0
  65. package/dist/substrate/lifo/node-compat/esbuild.d.ts.map +1 -1
  66. package/dist/substrate/lifo/node-compat/esbuild.js +2 -4
  67. package/dist/substrate/lifo/node-compat/index.d.ts.map +1 -1
  68. package/dist/substrate/lifo/node-compat/index.js +3 -2
  69. package/dist/substrate/lifo/node-compat/loose-equality.d.ts +19 -0
  70. package/dist/substrate/lifo/node-compat/loose-equality.d.ts.map +1 -0
  71. package/dist/substrate/lifo/node-compat/loose-equality.js +91 -0
  72. package/dist/substrate/lifo/node-compat/process.d.ts.map +1 -1
  73. package/dist/substrate/lifo/node-compat/process.js +6 -3
  74. package/dist/substrate/lifo/shell/Shell.d.ts +19 -0
  75. package/dist/substrate/lifo/shell/Shell.d.ts.map +1 -1
  76. package/dist/substrate/lifo/shell/Shell.js +86 -75
  77. package/dist/substrate/lifo/shell/lexer.d.ts +9 -0
  78. package/dist/substrate/lifo/shell/lexer.d.ts.map +1 -1
  79. package/dist/substrate/lifo/shell/lexer.js +40 -0
  80. package/dist/vfs/seed-project.d.ts.map +1 -1
  81. package/dist/vfs/seed-project.js +9 -3
  82. package/dist/vfs/sqlite-vfs.d.ts +63 -31
  83. package/dist/vfs/sqlite-vfs.d.ts.map +1 -1
  84. package/dist/vfs/sqlite-vfs.js +206 -41
  85. package/package.json +3 -2
  86. package/src/_shared/cache-stats.ts +27 -1
  87. package/src/_shared/error-text.ts +21 -0
  88. package/src/_shared/exports-resolver.ts +24 -4
  89. package/src/_shared/retry.ts +5 -3
  90. package/src/constants.ts +37 -53
  91. package/src/runtime/assets-loader.ts +1 -1
  92. package/src/runtime/esbuild-service.ts +16 -11
  93. package/src/runtime/installed-runtimes.ts +4 -3
  94. package/src/runtime/long-running-handle.ts +3 -3
  95. package/src/runtime/os-contracts.ts +7 -5
  96. package/src/runtime/port-registry.ts +97 -9
  97. package/src/runtime/process-logs.ts +12 -3
  98. package/src/runtime/project-detect.ts +7 -1
  99. package/src/runtime/require-resolver.ts +7 -7
  100. package/src/runtime/runtime-registry.ts +9 -7
  101. package/src/runtime/sqlite-runtime-fs-bridge.ts +9 -6
  102. package/src/runtime/virtual-socket-kernel.generated.ts +3 -3
  103. package/src/runtime/virtual-socket-kernel.ts +10 -5
  104. package/src/runtime/wasm-runner.ts +55 -29
  105. package/src/shell/features.ts +5 -4
  106. package/src/shell/unix-commands.ts +273 -128
  107. package/src/substrate/lifo/commands/net/ip.ts +15 -15
  108. package/src/substrate/lifo/commands/system/ps.ts +2 -1
  109. package/src/substrate/lifo/kernel/ServiceManager.ts +0 -2
  110. package/src/substrate/lifo/kernel/network/NetworkStack.ts +24 -17
  111. package/src/substrate/lifo/kernel/network/tunnel/WebSocketTunnel.ts +37 -12
  112. package/src/substrate/lifo/kernel/vfs/VFS.ts +34 -0
  113. package/src/substrate/lifo/node-compat/esbuild.ts +16 -8
  114. package/src/substrate/lifo/node-compat/index.ts +3 -2
  115. package/src/substrate/lifo/node-compat/loose-equality.ts +81 -0
  116. package/src/substrate/lifo/node-compat/process.ts +5 -2
  117. package/src/substrate/lifo/shell/Shell.ts +92 -70
  118. package/src/substrate/lifo/shell/lexer.ts +38 -0
  119. package/src/vfs/seed-project.ts +13 -6
  120. package/src/vfs/sqlite-vfs.ts +233 -77
  121. package/dist/_shared/install-phase.d.ts +0 -47
  122. package/dist/_shared/install-phase.d.ts.map +0 -1
  123. package/dist/_shared/install-phase.js +0 -1
  124. package/dist/_shared/rpc-dispose.d.ts +0 -4
  125. package/dist/_shared/rpc-dispose.d.ts.map +0 -1
  126. package/dist/_shared/rpc-dispose.js +0 -30
  127. package/dist/_shared/w7-frame.d.ts +0 -79
  128. package/dist/_shared/w7-frame.d.ts.map +0 -1
  129. package/dist/_shared/w7-frame.js +0 -839
  130. package/dist/_shared/weighted-credit-pool.d.ts +0 -61
  131. package/dist/_shared/weighted-credit-pool.d.ts.map +0 -1
  132. package/dist/_shared/weighted-credit-pool.js +0 -196
  133. package/dist/observability/diag-counters.d.ts +0 -236
  134. package/dist/observability/diag-counters.d.ts.map +0 -1
  135. package/dist/observability/diag-counters.js +0 -195
  136. package/dist/observability/heap-estimate.d.ts +0 -225
  137. package/dist/observability/heap-estimate.d.ts.map +0 -1
  138. package/dist/observability/heap-estimate.js +0 -185
  139. package/dist/observability/heavy-alloc-coord.d.ts +0 -93
  140. package/dist/observability/heavy-alloc-coord.d.ts.map +0 -1
  141. package/dist/observability/heavy-alloc-coord.js +0 -181
  142. package/dist/observability/oom-classify.d.ts +0 -138
  143. package/dist/observability/oom-classify.d.ts.map +0 -1
  144. package/dist/observability/oom-classify.js +0 -261
  145. package/dist/observability/oom-discriminator.d.ts +0 -176
  146. package/dist/observability/oom-discriminator.d.ts.map +0 -1
  147. package/dist/observability/oom-discriminator.js +0 -272
  148. package/src/_shared/install-phase.ts +0 -56
  149. package/src/_shared/rpc-dispose.ts +0 -31
  150. package/src/_shared/w7-frame.ts +0 -1012
  151. package/src/_shared/weighted-credit-pool.ts +0 -244
  152. package/src/observability/diag-counters.ts +0 -343
  153. package/src/observability/heap-estimate.ts +0 -331
  154. package/src/observability/heavy-alloc-coord.ts +0 -241
  155. package/src/observability/oom-classify.ts +0 -253
  156. package/src/observability/oom-discriminator.ts +0 -405
package/README.md CHANGED
@@ -38,14 +38,38 @@ await ws.fs.writeFile('/home/user/hello.txt', 'hi\n');
38
38
  const out = await ws.exec('cat /home/user/hello.txt | wc -c'); // { stdout: '3\n', exitCode: 0 }
39
39
  ```
40
40
 
41
- Inside a Cloudflare Durable Object the same call is:
41
+ Inside a Cloudflare Durable Object, complete:
42
42
 
43
43
  ```ts
44
- const ws = await NimbusWorkspace.create({
45
- sql: this.ctx.storage.sql,
46
- transactions: this.ctx,
47
- generation,
48
- });
44
+ import { DurableObject } from 'cloudflare:workers';
45
+ import { NimbusWorkspace } from '@nimbus-sh/core/workspace';
46
+
47
+ export class Workspace extends DurableObject {
48
+ private ws?: Promise<NimbusWorkspace>;
49
+
50
+ private workspace(): Promise<NimbusWorkspace> {
51
+ this.ws ??= (async () => {
52
+ // Bump a persisted counter once per instance. Never a constant and
53
+ // never Date.now(): pids derive from the generation, so a repeated
54
+ // one hands a dead process live write authority, and the platform
55
+ // re-instantiates this class far more often than it looks like it
56
+ // does (cold starts, hibernation wakes, resets). Use the bumped
57
+ // value only after the put resolves.
58
+ const generation = ((await this.ctx.storage.get<number>('generation')) ?? 0) + 1;
59
+ await this.ctx.storage.put('generation', generation);
60
+ return NimbusWorkspace.create({
61
+ sql: this.ctx.storage.sql,
62
+ transactions: this.ctx,
63
+ generation,
64
+ });
65
+ })();
66
+ return this.ws;
67
+ }
68
+
69
+ async exec(command: string) {
70
+ return (await this.workspace()).exec(command);
71
+ }
72
+ }
49
73
  ```
50
74
 
51
75
  Files written through `.fs` are owned by the session user (uid 1000), not
@@ -83,7 +107,11 @@ package carries the same manifest and the same sha256-verified blobs the
83
107
  hosted product serves from R2 — one publisher, two transports.
84
108
 
85
109
  Without `facets` and `runtimes` you still get the full shell and coreutils;
86
- the wasm runtimes are a dependency you add, not a mode you enable.
110
+ the wasm runtimes are a dependency you add, not a mode you enable. One caveat:
111
+ `localFacetHost()` covers bun and node only — on workerd the CSP forbids
112
+ request-time `WebAssembly.instantiate`, so wasm has to ride the Worker Loader
113
+ module map, which is the machinery in `@nimbus-sh/worker` and
114
+ `@nimbus-sh/fabric`; the shell, coreutils, and filesystem need none of it.
87
115
 
88
116
  ## Sharing a database with your own app
89
117
 
@@ -11,7 +11,7 @@
11
11
  * L4 — registry.npmjs.org origin ~100-300 ms cross-region
12
12
  *
13
13
  * Pre-cache metrics support: hit/miss counters lived in
14
- * src/observability/diag-counters.ts but only tracked the RPC-call
14
+ * @nimbus-sh/platform/diag-counters.js but only tracked the RPC-call
15
15
  * boundary, not per-tier. Those flat counters have since been removed.
16
16
  *
17
17
  * This module adds per-tier × per-kind counters. SAME singleton-per-
@@ -142,4 +142,26 @@ export declare function snapshot(): CacheStatsSnapshot;
142
142
  * were reset at Y" (the gap is intentional vs an isolate reboot).
143
143
  */
144
144
  export declare function reset(): void;
145
+ /**
146
+ * cache-obs-2: fold facet-collected per-tier cache events into the
147
+ * DO-side cache-stats singleton. Called from installer.ts after a
148
+ * batch-facet / resolve-facet returns — mirrors recordR2RaceCounters
149
+ * (the facet collects metrics in its result and the supervisor folds
150
+ * them into the DO isolate).
151
+ *
152
+ * Each event has shape:
153
+ * { kind: 'hit', tier: 'L2'|'L3'|'L4', cacheKind: 'tarball'|'packument'|'asset', bytes: number }
154
+ * { kind: 'miss', tier: ..., cacheKind: ... }
155
+ */
156
+ export type CacheStatEvent = {
157
+ kind: 'hit';
158
+ tier: CacheTier;
159
+ cacheKind: CacheKind;
160
+ bytes: number;
161
+ } | {
162
+ kind: 'miss';
163
+ tier: CacheTier;
164
+ cacheKind: CacheKind;
165
+ };
166
+ export declare function recordCacheStatEvents(events: readonly CacheStatEvent[] | undefined): void;
145
167
  //# sourceMappingURL=cache-stats.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"cache-stats.d.ts","sourceRoot":"","sources":["../../src/_shared/cache-stats.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAEH;;;;;GAKG;AACH,MAAM,MAAM,SAAS,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAElD;;;;;;;;;GASG;AACH,MAAM,MAAM,SAAS,GAAG,SAAS,GAAG,WAAW,GAAG,OAAO,CAAC;AAE1D;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,2EAA2E;IAC3E,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,kBAAkB;IACjC,qEAAqE;IACrE,MAAM,EAAE,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC,CAAC;IACxD;;;;OAIG;IACH,SAAS,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,WAAW,EAAE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C,SAAS,EAAE,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC,CAAC;CACvD;AAyCD;;;;;;;;;;GAUG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAO/E;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,GAAG,IAAI,CAGjE;AAED;;;;;GAKG;AACH,wBAAgB,QAAQ,IAAI,kBAAkB,CAqB7C;AAED;;;;;;;GAOG;AACH,wBAAgB,KAAK,IAAI,IAAI,CAS5B;AAED;;;;;;;;;;GAUG;AACH,MAAM,MAAM,cAAc,GACtB;IAAE,IAAI,EAAE,KAAK,CAAC;IAAC,IAAI,EAAE,SAAS,CAAC;IAAC,SAAS,EAAE,SAAS,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GACrE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,SAAS,CAAC;IAAC,SAAS,EAAE,SAAS,CAAA;CAAE,CAAC;AAE5D,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,SAAS,cAAc,EAAE,GAAG,SAAS,GAAG,IAAI,CASzF"}
@@ -11,7 +11,7 @@
11
11
  * L4 — registry.npmjs.org origin ~100-300 ms cross-region
12
12
  *
13
13
  * Pre-cache metrics support: hit/miss counters lived in
14
- * src/observability/diag-counters.ts but only tracked the RPC-call
14
+ * @nimbus-sh/platform/diag-counters.js but only tracked the RPC-call
15
15
  * boundary, not per-tier. Those flat counters have since been removed.
16
16
  *
17
17
  * This module adds per-tier × per-kind counters. SAME singleton-per-
@@ -159,3 +159,15 @@ export function reset() {
159
159
  }
160
160
  _lastResetAt = Date.now();
161
161
  }
162
+ export function recordCacheStatEvents(events) {
163
+ if (!events || events.length === 0)
164
+ return;
165
+ for (const e of events) {
166
+ if (e.kind === 'hit') {
167
+ recordHit(e.tier, e.cacheKind, e.bytes);
168
+ }
169
+ else {
170
+ recordMiss(e.tier, e.cacheKind);
171
+ }
172
+ }
173
+ }
@@ -0,0 +1,15 @@
1
+ /**
2
+ * error-text.ts — the text a caught value carries.
3
+ *
4
+ * A `catch` binding is `unknown`: the throw site may have thrown an Error, a
5
+ * string, or a plain object with a `message`, and the shell and runtime paths
6
+ * report all three the same way. This is that report, in one place, so a
7
+ * command's diagnostics do not depend on which of those a facet threw.
8
+ */
9
+ /**
10
+ * The message a thrown value names, or the value itself when it names none.
11
+ * Empty and other falsy messages fall through to the value, so an
12
+ * `new Error('')` still reports as `Error` rather than as nothing.
13
+ */
14
+ export declare function errorText(error: unknown): string;
15
+ //# sourceMappingURL=error-text.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"error-text.d.ts","sourceRoot":"","sources":["../../src/_shared/error-text.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAMhD"}
@@ -0,0 +1,21 @@
1
+ /**
2
+ * error-text.ts — the text a caught value carries.
3
+ *
4
+ * A `catch` binding is `unknown`: the throw site may have thrown an Error, a
5
+ * string, or a plain object with a `message`, and the shell and runtime paths
6
+ * report all three the same way. This is that report, in one place, so a
7
+ * command's diagnostics do not depend on which of those a facet threw.
8
+ */
9
+ /**
10
+ * The message a thrown value names, or the value itself when it names none.
11
+ * Empty and other falsy messages fall through to the value, so an
12
+ * `new Error('')` still reports as `Error` rather than as nothing.
13
+ */
14
+ export function errorText(error) {
15
+ if (typeof error === 'object' && error !== null && 'message' in error) {
16
+ const { message } = error;
17
+ if (message)
18
+ return String(message);
19
+ }
20
+ return String(error);
21
+ }
@@ -7,7 +7,7 @@
7
7
  * 1. Install-time supervisor (TS) — `src/npm-resolver.ts` re-exports the
8
8
  * typed functions for tree resolution.
9
9
  *
10
- * 2. NimbusLoaderPool isolates (JS string) — `src/loaders/pre-bundle-preamble.ts`
10
+ * 2. IsolatePool isolates (JS string) — `src/loaders/pre-bundle-preamble.ts`
11
11
  * embeds `getExportsResolverJS()` as part of the pool preamble so the
12
12
  * pre-bundle facet uses identical resolution semantics to the supervisor.
13
13
  *
@@ -34,6 +34,22 @@
34
34
  export declare const DEFAULT_ESM_CONDITIONS: string[];
35
35
  /** Default conditions for CJS runtime resolution (user-shell node). */
36
36
  export declare const DEFAULT_CJS_CONDITIONS: string[];
37
+ /**
38
+ * A `package.json#exports` / `#imports` value: a target path, an ordered list
39
+ * of fallbacks to try in turn, or a map keyed by subpath (`"./client"`) or by
40
+ * condition (`"import"`) whose values are the same shape again. `null` is the
41
+ * spec's "this subpath is not exported" marker, and blocks fallback.
42
+ */
43
+ export type ExportsField = string | null | ExportsField[] | {
44
+ [key: string]: ExportsField;
45
+ };
46
+ /** The package.json fields entry-point resolution reads. */
47
+ export interface ResolvablePackageJson {
48
+ exports?: ExportsField;
49
+ imports?: ExportsField;
50
+ main?: string;
51
+ module?: string;
52
+ }
37
53
  /**
38
54
  * Resolve `package.json#exports` (or `#imports`) per Node spec.
39
55
  *
@@ -42,18 +58,14 @@ export declare const DEFAULT_CJS_CONDITIONS: string[];
42
58
  * @param conditions Active conditions, in priority order
43
59
  * @returns Relative path target string, or null if not found / forbidden
44
60
  */
45
- export declare function resolveExports(exportsField: any, subpath?: string, conditions?: string[]): string | null;
61
+ export declare function resolveExports(exportsField: ExportsField | undefined, subpath?: string, conditions?: string[]): string | null;
46
62
  /**
47
63
  * Resolve a package's entry-point file relative to its directory.
48
64
  * Priority: exports → module → main → null.
49
65
  * For non-root subpaths without an `exports` field, returns the subpath
50
66
  * itself (caller probes filesystem with extension-list).
51
67
  */
52
- export declare function resolvePackageEntry(pkg: {
53
- exports?: any;
54
- module?: string;
55
- main?: string;
56
- }, subpath?: string, conditions?: string[]): string | null;
68
+ export declare function resolvePackageEntry(pkg: ResolvablePackageJson, subpath?: string, conditions?: string[]): string | null;
57
69
  /**
58
70
  * Returns the resolver source as plain JavaScript (no TypeScript syntax),
59
71
  * suitable for embedding into a generated worker preamble or shim string.
@@ -1 +1 @@
1
- {"version":3,"file":"exports-resolver.d.ts","sourceRoot":"","sources":["../../src/_shared/exports-resolver.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,6DAA6D;AAC7D,eAAO,MAAM,sBAAsB,UAA6C,CAAC;AAEjF,uEAAuE;AACvE,eAAO,MAAM,sBAAsB,UAAiC,CAAC;AAErE;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAC5B,YAAY,EAAE,GAAG,EACjB,OAAO,GAAE,MAAY,EACrB,UAAU,GAAE,MAAM,EAA2B,GAC5C,MAAM,GAAG,IAAI,CAkEf;AAwCD;;;;;GAKG;AACH,wBAAgB,mBAAmB,CACjC,GAAG,EAAE;IAAE,OAAO,CAAC,EAAE,GAAG,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,EACtD,OAAO,GAAE,MAAY,EACrB,UAAU,GAAE,MAAM,EAA2B,GAC5C,MAAM,GAAG,IAAI,CAsBf;AAID;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,oBAAoB,IAAI,MAAM,CAkG7C"}
1
+ {"version":3,"file":"exports-resolver.d.ts","sourceRoot":"","sources":["../../src/_shared/exports-resolver.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,6DAA6D;AAC7D,eAAO,MAAM,sBAAsB,UAA6C,CAAC;AAEjF,uEAAuE;AACvE,eAAO,MAAM,sBAAsB,UAAiC,CAAC;AAErE;;;;;GAKG;AACH,MAAM,MAAM,YAAY,GACpB,MAAM,GACN,IAAI,GACJ,YAAY,EAAE,GACd;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,YAAY,CAAA;CAAE,CAAC;AAEpC,4DAA4D;AAC5D,MAAM,WAAW,qBAAqB;IACpC,OAAO,CAAC,EAAE,YAAY,CAAC;IACvB,OAAO,CAAC,EAAE,YAAY,CAAC;IACvB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAC5B,YAAY,EAAE,YAAY,GAAG,SAAS,EACtC,OAAO,GAAE,MAAY,EACrB,UAAU,GAAE,MAAM,EAA2B,GAC5C,MAAM,GAAG,IAAI,CAkEf;AAwCD;;;;;GAKG;AACH,wBAAgB,mBAAmB,CACjC,GAAG,EAAE,qBAAqB,EAC1B,OAAO,GAAE,MAAY,EACrB,UAAU,GAAE,MAAM,EAA2B,GAC5C,MAAM,GAAG,IAAI,CAsBf;AAID;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,oBAAoB,IAAI,MAAM,CAkG7C"}
@@ -7,7 +7,7 @@
7
7
  * 1. Install-time supervisor (TS) — `src/npm-resolver.ts` re-exports the
8
8
  * typed functions for tree resolution.
9
9
  *
10
- * 2. NimbusLoaderPool isolates (JS string) — `src/loaders/pre-bundle-preamble.ts`
10
+ * 2. IsolatePool isolates (JS string) — `src/loaders/pre-bundle-preamble.ts`
11
11
  * embeds `getExportsResolverJS()` as part of the pool preamble so the
12
12
  * pre-bundle facet uses identical resolution semantics to the supervisor.
13
13
  *
@@ -1 +1 @@
1
- {"version":3,"file":"retry.d.ts","sourceRoot":"","sources":["../../src/_shared/retry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAIH,gFAAgF;AAChF,eAAO,MAAM,eAAe,IAAI,CAAC;AAEjC,oEAAoE;AACpE,eAAO,MAAM,UAAU,EAAE,SAAS,MAAM,EAAsB,CAAC;AAE/D,4DAA4D;AAC5D,wBAAgB,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAM/C;AAED,qDAAqD;AACrD,wBAAgB,iBAAiB,C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AAE,WAAW,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC;AAEnF,MAAM,WAAW,qBAAqB;IACpC;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;;OAIG;IACH,SAAS,CAAC,EAAE,aAAa,CAAC;IAC1B;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;;;;;;OAQG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B;;;;;;;OAOG;IACH,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;CAC5F;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,cAAc,CAClC,GAAG,EAAE,MAAM,EACX,IAAI,CAAC,EAAE,WAAW,EAClB,IAAI,CAAC,EAAE,qBAAqB,GAC3B,OAAO,CAAC,QAAQ,CAAC,CAsFnB"}
@@ -22,7 +22,8 @@
22
22
  * helper. resolve-one-facet.ts and install-batch-facet.ts therefore keep
23
23
  * equivalent retry loops inside their isolated function bodies.
24
24
  */
25
- import { disposeRpcResource } from './rpc-dispose.js';
25
+ import { disposeRpcResource } from '@nimbus-sh/platform/rpc-dispose.js';
26
+ import { errorText } from './error-text.js';
26
27
  /** Default retry count AFTER the first attempt (3 = up to 4 total attempts). */
27
28
  export const DEFAULT_RETRIES = 3;
28
29
  /** Base backoff delays in ms. Index = retry attempt (0-indexed). */
@@ -142,7 +143,8 @@ export async function retryableFetch(url, init, opts) {
142
143
  throw e;
143
144
  }
144
145
  const delayMs = jittered(BACKOFF_MS[Math.min(attempt, BACKOFF_MS.length - 1)]);
145
- const reason = e?.name === 'AbortError' ? 'timeout' : (e?.message || String(e));
146
+ const isAbort = typeof e === 'object' && e !== null && 'name' in e && e.name === 'AbortError';
147
+ const reason = isAbort ? 'timeout' : errorText(e);
146
148
  opts?.onRetry?.(attempt + 1, totalRetries, delayMs, reason);
147
149
  await new Promise((r) => setTimeout(r, delayMs));
148
150
  }
@@ -1,6 +1,11 @@
1
1
  /**
2
2
  * constants.ts — Single source of truth for all Nimbus configuration.
3
+ *
4
+ * Nimbus POLICY only. The measured platform limits these policies are
5
+ * derived from (tx bounds, the RPC envelope, supervisor budgets) live in
6
+ * `@nimbus-sh/platform/limits.js`.
3
7
  */
8
+ export { CHUNK_SIZE, MAX_GLOBAL_WRITE_STREAM_CREDIT_BYTES, MAX_RPC_SAFE_PAYLOAD_BYTES, MAX_TX_BLOB_BYTES, MAX_TX_LOGICAL_ROWS, MAX_TX_SQL_EXECS, PRE_BUNDLE_CONCURRENCY, PRE_BUNDLE_SLICE_CAP_BYTES, SUPERVISOR_HEAP_CEILING_BYTES, SUPERVISOR_IN_FLIGHT_ALLOCATION_BUDGET_BYTES, SUPERVISOR_READ_RESERVE_BYTES, } from '@nimbus-sh/platform/limits.js';
4
9
  export declare const NIMBUS_VERSION = "2.0.0";
5
10
  export declare const NODE_VERSION = "v22.19.0";
6
11
  export declare const NODE_VERSIONS: {
@@ -11,15 +16,9 @@ export declare const NODE_VERSIONS: {
11
16
  export declare const ESBUILD_VERSION = "0.24.2";
12
17
  export declare const SQLJS_VERSION = "1.14.1";
13
18
  export declare const OPENCODE_VERSION = "1.16.2";
14
- export declare const CHUNK_SIZE = 65536;
15
19
  export declare const LRU_MAX_ENTRIES = 512;
16
20
  export declare const BATCH_SIZE = 64;
17
21
  export declare const VFS_CAPACITY: number;
18
- export declare const MAX_TX_BLOB_BYTES: number;
19
- export declare const MAX_TX_LOGICAL_ROWS = 256;
20
- export declare const MAX_TX_SQL_EXECS = 64;
21
- export declare const MAX_GLOBAL_WRITE_STREAM_CREDIT_BYTES: number;
22
- export declare const MAX_RPC_SAFE_PAYLOAD_BYTES: number;
23
22
  export declare const FS_READ_BATCH_PATH_LIMIT = 1024;
24
23
  export declare const FS_READ_BATCH_REQUEST_BYTES: number;
25
24
  export declare const FS_LIST_PAGE_LIMIT = 8192;
@@ -43,17 +42,12 @@ export declare const CWD_SNAPSHOT_MAX_FILE_BYTES: number;
43
42
  export declare const NPM_REGISTRY = "https://registry.npmjs.org";
44
43
  export declare const NPM_CONCURRENCY = 12;
45
44
  export declare const NPM_DECOMPRESS_TIMEOUT = 15000;
46
- export declare const PRE_BUNDLE_SLICE_CAP_BYTES: number;
47
- export declare const PRE_BUNDLE_CONCURRENCY = 1;
48
45
  export declare const DEFAULT_VITE_PORT = 5173;
49
46
  export declare const DEFAULT_PREVIEW_BASE = "/preview";
50
47
  export declare const DEFAULT_WORKER_BASE = "/worker";
51
48
  export declare const WRANGLER_DEBOUNCE_MS = 250;
52
49
  export declare const NIMBUS_AI_GATEWAY_PORT = 8790;
53
50
  export declare const CF_COMPAT_DATE = "2026-04-01";
54
- export declare const SUPERVISOR_HEAP_CEILING_BYTES: number;
55
- export declare const SUPERVISOR_IN_FLIGHT_ALLOCATION_BUDGET_BYTES: number;
56
- export declare const SUPERVISOR_READ_RESERVE_BYTES: number;
57
51
  export declare const DEFAULT_HOSTNAME = "nimbus";
58
52
  export declare const DEFAULT_HOME = "/home/user";
59
53
  export declare const DEFAULT_USER = "user";
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,eAAO,MAAM,cAAc,UAAU,CAAC;AA+BtC,eAAO,MAAM,YAAY,aAAa,CAAC;AACvC,eAAO,MAAM,aAAa;;;;CAAyD,CAAC;AACpF,eAAO,MAAM,eAAe,WAAW,CAAC;AAQxC,eAAO,MAAM,aAAa,WAAW,CAAC;AAQtC,eAAO,MAAM,gBAAgB,WAAW,CAAC;AAGzC,eAAO,MAAM,UAAU,QAAS,CAAC;AACjC,eAAO,MAAM,eAAe,MAAM,CAAC;AACnC,eAAO,MAAM,UAAU,KAAK,CAAC;AAC7B,eAAO,MAAM,YAAY,QAA0B,CAAC;AACpD,eAAO,MAAM,iBAAiB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B,OAAO,CAAC;AACzC,eAAO,MAAM,oBAAoB,QAAmB,CAAC;AACrD,eAAO,MAAM,wBAAwB,QAAmB,CAAC;AAiBzD,eAAO,MAAM,wBAAwB,QAAmB,CAAC;AAoBzD,eAAO,MAAM,2BAA2B,QAAkB,CAAC;AAM3D,eAAO,MAAM,YAAY,+BAA+B,CAAC;AACzD,eAAO,MAAM,eAAe,KAAK,CAAC;AAClC,eAAO,MAAM,sBAAsB,QAAS,CAAC;AAG7C,eAAO,MAAM,iBAAiB,OAAO,CAAC;AACtC,eAAO,MAAM,oBAAoB,aAAa,CAAC;AAC/C,eAAO,MAAM,mBAAmB,YAAY,CAAC;AAC7C,eAAO,MAAM,oBAAoB,MAAM,CAAC;AASxC,eAAO,MAAM,sBAAsB,OAAO,CAAC;AAG3C,eAAO,MAAM,cAAc,eAAe,CAAC;AAG3C,eAAO,MAAM,gBAAgB,WAAW,CAAC;AACzC,eAAO,MAAM,YAAY,eAAe,CAAC;AACzC,eAAO,MAAM,YAAY,SAAS,CAAC;AACnC,eAAO,MAAM,aAAa,YAAY,CAAC;AACvC,eAAO,MAAM,YAAY,2EAA2E,CAAC;AACrG,eAAO,MAAM,oBAAoB,UAAqD,CAAC;AAiBvF,eAAO,MAAM,uBAAuB,EAAE,SAAS,MAAM,EAAe,CAAC"}
package/dist/constants.js CHANGED
@@ -1,6 +1,17 @@
1
1
  /**
2
2
  * constants.ts — Single source of truth for all Nimbus configuration.
3
+ *
4
+ * Nimbus POLICY only. The measured platform limits these policies are
5
+ * derived from (tx bounds, the RPC envelope, supervisor budgets) live in
6
+ * `@nimbus-sh/platform/limits.js`.
3
7
  */
8
+ import { MAX_RPC_SAFE_PAYLOAD_BYTES } from '@nimbus-sh/platform/limits.js';
9
+ // Published-surface forwarding: @nimbus-sh/core@0.5.0 exports these from
10
+ // this module and real consumers import them here (Proteus merge-back.ts
11
+ // pulls CHUNK_SIZE and the MAX_TX_* set). The platform split moved the
12
+ // definitions to @nimbus-sh/platform/limits.js, which stays the single
13
+ // source of truth; core's own modules import platform directly.
14
+ export { CHUNK_SIZE, MAX_GLOBAL_WRITE_STREAM_CREDIT_BYTES, MAX_RPC_SAFE_PAYLOAD_BYTES, MAX_TX_BLOB_BYTES, MAX_TX_LOGICAL_ROWS, MAX_TX_SQL_EXECS, PRE_BUNDLE_CONCURRENCY, PRE_BUNDLE_SLICE_CAP_BYTES, SUPERVISOR_HEAP_CEILING_BYTES, SUPERVISOR_IN_FLIGHT_ALLOCATION_BUDGET_BYTES, SUPERVISOR_READ_RESERVE_BYTES, } from '@nimbus-sh/platform/limits.js';
4
15
  // ── Versions ────────────────────────────────────────────────────────────
5
16
  export const NIMBUS_VERSION = '2.0.0';
6
17
  //
@@ -52,18 +63,11 @@ export const SQLJS_VERSION = '1.14.1';
52
63
  // runtime/opencode-artifact.ts and served as the package's `opencode` bin.
53
64
  export const OPENCODE_VERSION = '1.16.2';
54
65
  // ── VFS Constants ───────────────────────────────────────────────────────
55
- export const CHUNK_SIZE = 65_536; // 64KB per content chunk
66
+ // The chunk size itself (CHUNK_SIZE) and the transaction bounds are
67
+ // platform limits — see @nimbus-sh/platform/limits.js.
56
68
  export const LRU_MAX_ENTRIES = 512; // 512 × 64KB = 32MB hot cache
57
69
  export const BATCH_SIZE = 64; // rows per batch INSERT
58
70
  export const VFS_CAPACITY = 10 * 1024 * 1024 * 1024; // 10 GB
59
- export const MAX_TX_BLOB_BYTES = 1 * 1024 * 1024;
60
- export const MAX_TX_LOGICAL_ROWS = 256;
61
- export const MAX_TX_SQL_EXECS = 64;
62
- export const MAX_GLOBAL_WRITE_STREAM_CREDIT_BYTES = 8 * 1024 * 1024;
63
- // Largest byte payload Nimbus sends through an ordinary Workers RPC value.
64
- // The platform limit is 32 MiB; 28 MiB leaves room for structured-clone
65
- // metadata and matches the proven on-demand facet transfer envelope.
66
- export const MAX_RPC_SAFE_PAYLOAD_BYTES = 28 * 1024 * 1024;
67
71
  // ── Batched filesystem reads ────────────────────────────────────────────
68
72
  // A round trip costs an order of magnitude more than the SQLite lookup
69
73
  // behind it, so a program that touches many files pays for round trips and
@@ -132,10 +136,13 @@ export const FACET_TIMEOUT_MS = 30_000; // 30s execution timeout
132
136
  // JavaScript, so workerd's per-module text-size limit applies to the
133
137
  // JSON-escaped form (each `\n` / `\"` / `\u` adds bytes, plus the
134
138
  // per-key string-quote overhead).
135
- // raw → boots, 8 MiB raw fails. Encoded as JSON that's roughly 18-25 MiB
136
- // of module text. We target 22 MiB encoded as the hard ceiling, leaving
137
- // ~2-3 MiB of headroom for the rest of the worker module (shims, runner
138
- // boot code) and any minor drift in the eviction loop's accounting.
139
+ // Measured: 8 MiB raw failed to boot; the passing raw bound was measured
140
+ // too, but the number was lost to comment truncation before it ever
141
+ // reached git, so only the failing side is known. Encoded as JSON that's
142
+ // roughly 18-25 MiB of module text. We target 22 MiB encoded as the hard
143
+ // ceiling, leaving ~2-3 MiB of headroom for the rest of the worker module
144
+ // (shims, runner boot code) and any minor drift in the eviction loop's
145
+ // accounting.
139
146
  //
140
147
  // facet-manager.ts:buildPrefetchBundle uses TextEncoder().encode().length
141
148
  // to measure exact UTF-8 bytes (not JS string .length, which counts UTF-16
@@ -185,11 +192,12 @@ export const PREFETCH_CACHE_MAX_BYTES = 16 * 1024 * 1024;
185
192
  // it now raises ENOENT instead of costing the session.
186
193
  export const CWD_SNAPSHOT_MAX_FILE_BYTES = 2 * 1024 * 1024;
187
194
  // ── npm Constants ───────────────────────────────────────────────────────
195
+ // The pre-bundle admission envelope (PRE_BUNDLE_SLICE_CAP_BYTES,
196
+ // PRE_BUNDLE_CONCURRENCY) is a measured platform envelope — see
197
+ // @nimbus-sh/platform/limits.js.
188
198
  export const NPM_REGISTRY = 'https://registry.npmjs.org';
189
199
  export const NPM_CONCURRENCY = 12;
190
200
  export const NPM_DECOMPRESS_TIMEOUT = 15_000;
191
- export const PRE_BUNDLE_SLICE_CAP_BYTES = MAX_RPC_SAFE_PAYLOAD_BYTES;
192
- export const PRE_BUNDLE_CONCURRENCY = 1;
193
201
  // ── Dev Server Constants ────────────────────────────────────────────────
194
202
  export const DEFAULT_VITE_PORT = 5173;
195
203
  export const DEFAULT_PREVIEW_BASE = '/preview';
@@ -205,40 +213,6 @@ export const WRANGLER_DEBOUNCE_MS = 250;
205
213
  export const NIMBUS_AI_GATEWAY_PORT = 8790;
206
214
  // ── Compatibility ───────────────────────────────────────────────────────
207
215
  export const CF_COMPAT_DATE = '2026-04-01';
208
- // ── Supervisor heap budget [C'.1] ───────────────────────────────────────
209
- //
210
- // The supervisor isolate's 128 MiB workerd cap is a HARD platform ceiling
211
- // (per docs/research/cf-primitives-dossier.md §6 invariant I1 — 128 MiB
212
- // per V8 isolate, may be shared across same-class peer DOs co-tenanting in
213
- // one process). Nimbus targets HALF of that as a self-imposed soft ceiling
214
- // so the supervisor always has runway when workerd LRU-evicts neighbours
215
- // or AIR (Asynchronous Isolate Recreation) folds growing isolates.
216
- //
217
- // 64 MiB is a budget, not a measurement, and nothing enforces it.
218
- // src/observability/heap-estimate.ts sums the INSTRUMENTED contributors —
219
- // the supervisor baseline, VFS LRU and in-flight writes, pre-bundle slices,
220
- // and streaming RPC buffers — which is a lower bound, not full coverage.
221
- // The prefetch-bundle path in facets/manager.ts allocates against this
222
- // budget without accounting for it; see HEAP_BLIND_SPOTS for the current
223
- // gap. Read a low percentOfCeiling accordingly.
224
- export const SUPERVISOR_HEAP_CEILING_BYTES = 64 * 1024 * 1024;
225
- // Shared allowance for transient allocations in the supervisor DO. With the
226
- // VFS LRU shrunk to 8 MiB during an active reservation, 40 MiB of admitted
227
- // payload plus the 9 MiB bundle baseline stays below the 64 MiB soft ceiling
228
- // with 7 MiB left for metadata, structured-clone overhead, and runtime state.
229
- // This is 31.25% of the platform's 128 MiB hard isolate ceiling.
230
- export const SUPERVISOR_IN_FLIGHT_ALLOCATION_BUDGET_BYTES = 40 * 1024 * 1024;
231
- // Reserved slice of that allowance for chunk-sized filesystem reads, so a
232
- // read is never queued behind a multi-megabyte owner for a wait that has
233
- // nothing to do with its own cost. A read only draws on this when the shared
234
- // budget is already contended — which is exactly when the VFS LRU is shrunk
235
- // to 8 MiB — so peak accounting is 40 + 1 admitted, 8 LRU, 9 bundle baseline:
236
- // 58 MiB, still under the 64 MiB soft ceiling.
237
- //
238
- // 1 MiB is 16 concurrent READ_STREAM_CHUNK_BYTES reads. The point is not
239
- // depth, it is that a read loop keeps moving while a heavy owner works
240
- // instead of stopping dead for the duration.
241
- export const SUPERVISOR_READ_RESERVE_BYTES = 1024 * 1024;
242
216
  // ── OS Defaults ─────────────────────────────────────────────────────────
243
217
  export const DEFAULT_HOSTNAME = 'nimbus';
244
218
  export const DEFAULT_HOME = '/home/user';
@@ -34,7 +34,7 @@
34
34
  * Within a single isolate's lifetime, the same path always returns the
35
35
  * same content.
36
36
  */
37
- import { disposeRpcResource } from '../_shared/rpc-dispose.js';
37
+ import { disposeRpcResource } from '@nimbus-sh/platform/rpc-dispose.js';
38
38
  /**
39
39
  * Per-isolate cache. Keys are asset paths (e.g. `/_assets/foo.js`).
40
40
  * Values are settled promises so concurrent callers share the same
@@ -100,12 +100,13 @@ export declare function getSharedRuntimeExternals(specifier: string): string[];
100
100
  * Unicode identifier tables.
101
101
  */
102
102
  export declare function hasTopLevelAwait(src: string): boolean;
103
+ import type * as esbuild from 'esbuild-wasm';
103
104
  export interface TransformResult {
104
105
  code: string;
105
106
  map: string;
106
107
  warnings: {
107
108
  text: string;
108
- location?: any;
109
+ location?: esbuild.Location | null;
109
110
  }[];
110
111
  }
111
112
  export interface BuildOutputFile {
@@ -116,11 +117,11 @@ export interface BuildResult {
116
117
  outputFiles: BuildOutputFile[];
117
118
  errors: {
118
119
  text: string;
119
- location?: any;
120
+ location?: esbuild.Location | null;
120
121
  }[];
121
122
  warnings: {
122
123
  text: string;
123
- location?: any;
124
+ location?: esbuild.Location | null;
124
125
  }[];
125
126
  }
126
127
  export declare class EsbuildService {
@@ -1 +1 @@
1
- {"version":3,"file":"esbuild-service.d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,OAAO,CAAC,EAAE;QACR,MAAM,CAAC,EAAE,OAAO,CAAC;QACjB,MAAM,CAAC,EAAE,KAAK,GAAG,KAAK,GAAG,MAAM,CAAC;QAChC,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,QAAQ,CAAC,EAAE,SAAS,GAAG,MAAM,GAAG,SAAS,CAAC;QAC1C,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,SAAS,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,UAAU,CAAC;QAC5C,MAAM,CAAC,EAAE,OAAO,CAAC;QACjB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;QACpB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAChC,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAC/B,SAAS,CAAC,EAAE,OAAO,CAAC;KACrB,GACA,OAAO,CAAC,WAAW,CAAC;IA0CvB;;;;OAIG;IACH,OAAO,CAAC,aAAa;IA4UrB,IAAI,aAAa,YAA+B;CACjD"}
@@ -19,6 +19,7 @@
19
19
  import { CRED_KERNEL } from './os-contracts.js';
20
20
  import { resolvePackageEntry, resolveExports } from '../_shared/exports-resolver.js';
21
21
  import { normalizeVfsPath, stripLeadingSlashes } from '../vfs/path.js';
22
+ import { errorText } from '../_shared/error-text.js';
22
23
  /**
23
24
  * Bundler version tag. BUMP THIS whenever bundling semantics change —
24
25
  * the esbuild plugin's resolver logic, the shared-externals rules, the
@@ -174,7 +175,6 @@ export function hasTopLevelAwait(src) {
174
175
  // inside `(...)`; a `{` only opens a function body when a `function`/
175
176
  // `=>` is pending AND we're at parenDepth 0 (past the param list).
176
177
  const re = /\b(await|function|class)\b|=>|\{|\}|\(|\)/g;
177
- let m;
178
178
  const fnEntryDepths = [];
179
179
  let depth = 0;
180
180
  let parenDepth = 0;
@@ -188,7 +188,7 @@ export function hasTopLevelAwait(src) {
188
188
  // `x => ({ ... })` (object-returning expression body, `{` at parenDepth
189
189
  // 1) does not leak a body slot onto a later top-level block.
190
190
  let arrowPending = false;
191
- while ((m = re.exec(stripped)) !== null) {
191
+ for (let m = re.exec(stripped); m !== null; m = re.exec(stripped)) {
192
192
  const tok = m[0];
193
193
  if (arrowPending && tok !== '{')
194
194
  arrowPending = false;
@@ -892,6 +892,10 @@ export class EsbuildService {
892
892
  let initTimeout = null;
893
893
  await Promise.race([
894
894
  esb.initialize({
895
+ // wrangler resolves this static `.wasm` import to a compiled
896
+ // module at bundle time; the asset stub for a `.wasm` module can
897
+ // only declare its default export as a string, and the guard
898
+ // above is what checks the resolution actually happened.
895
899
  wasmModule: esbuildWasmUrl,
896
900
  worker: false,
897
901
  }),
@@ -907,13 +911,14 @@ export class EsbuildService {
907
911
  this.initialized = true;
908
912
  }
909
913
  catch (e) {
914
+ const message = errorText(e);
910
915
  // "Cannot call initialize more than once" means it's already ready
911
- if (e?.message?.includes('more than once')) {
916
+ if (message.includes('more than once')) {
912
917
  this.initialized = true;
913
918
  return;
914
919
  }
915
920
  this.initPromise = null;
916
- throw new Error('esbuild init failed: ' + (e?.message || e));
921
+ throw new Error('esbuild init failed: ' + message);
917
922
  }
918
923
  })();
919
924
  return this.initPromise;
@@ -16,19 +16,20 @@
16
16
  * tree itself gets working commands out of this with nothing else in play.
17
17
  */
18
18
  import type { CredentialedVfs, SqliteVFS } from '../vfs/sqlite-vfs.js';
19
+ import type { Command } from '../substrate/lifo/commands/types.js';
19
20
  import { type RuntimePackageAbi } from './os-contracts.js';
20
21
  import { type ManifestEntrypoint, type RuntimeManifest } from './runtime-manifest.js';
21
22
  /** Minimal shell-registry shape we depend on. */
22
23
  export interface MinShellRegistry {
23
- register(name: string, handler: (ctx: any) => Promise<number>): void;
24
+ register(name: string, handler: Command): void;
24
25
  unregister?(name: string): void;
25
- resolve?(name: string): any;
26
+ resolve?(name: string): Promise<Command | null | undefined> | Command | null | undefined;
26
27
  }
27
28
  /** Runner-factory contract. Each registered runner produces a shell-
28
29
  * command handler given the manifest + the installed root dir. The
29
30
  * package manager invokes the factory at install-time + at boot-time
30
31
  * rehydration. */
31
- export type RunnerFactory = (manifest: RuntimeManifest, installRoot: string, binName: string, binKind: string | undefined) => (ctx: any) => Promise<number>;
32
+ export type RunnerFactory = (manifest: RuntimeManifest, installRoot: string, binName: string, binKind: string | undefined) => Command;
32
33
  /**
33
34
  * How a manifest entrypoint's `runner` key is resolved to code.
34
35
  *
@@ -1 +1 @@
1
- {"version":3,"file":"installed-runtimes.d.ts","sourceRoot":"","sources":["../../src/runtime/installed-runtimes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACvE,OAAO,EAKL,KAAK,iBAAiB,EACvB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAEL,KAAK,kBAAkB,EACvB,KAAK,eAAe,EACrB,MAAM,uBAAuB,CAAC;AAE/B,iDAAiD;AACjD,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,OAAO,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC;IACrE,UAAU,CAAC,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,OAAO,CAAC,CAAC,IAAI,EAAE,MAAM,GAAG,GAAG,CAAC;CAC7B;AAED;;;mBAGmB;AACnB,MAAM,MAAM,aAAa,GAAG,CAC1B,QAAQ,EAAE,eAAe,EACzB,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,GAAG,SAAS,KACxB,CAAC,GAAG,EAAE,GAAG,KAAK,OAAO,CAAC,MAAM,CA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,MAAM,GAAG,MAAM,CAKlF;AAED;iCACiC;AACjC,wBAAgB,sBAAsB,CACpC,GAAG,EAAE,SAAS,EACd,OAAO,EAAE,MAAM,GACd,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,eAAe,CAAA;CAAE,CAAC,CAEpD;AAED,wBAAgB,0BAA0B,CACxC,EAAE,EAAE,eAAe,EACnB,OAAO,EAAE,MAAM,GACd,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,eAAe,CAAA;CAAE,CAAC,CAyBpD;AAED;;;;GAIG;AACH,wBAAgB,0BAA0B,CACxC,GAAG,EAAE,SAAS,EACd,QAAQ,EAAE,gBAAgB,EAC1B,OAAO,EAAE,MAAM,GACd;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,EAAE,CAAA;CAAE,CAEnC;AAED,wBAAgB,8BAA8B,CAC5C,GAAG,EAAE,eAAe,EACpB,QAAQ,EAAE,gBAAgB,EAC1B,OAAO,EAAE,MAAM,EACf,SAAS,EAAE,YAAY,GACtB;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,EAAE,CAAA;CAAE,CAYnC;AAED,wBAAgB,qBAAqB,CACnC,GAAG,EAAE,SAAS,EACd,OAAO,EAAE,MAAM,GACd,cAAc,EAAE,CAUlB"}
@@ -79,7 +79,7 @@ export declare function parsePortFromArgv(argv: string[]): number | null;
79
79
  */
80
80
  export declare function resolveLongRunningPort(opts: {
81
81
  argv?: string[];
82
- env?: Record<string, any> | undefined;
82
+ env?: Record<string, string> | undefined;
83
83
  configPort?: number | undefined;
84
84
  fallback: number;
85
85
  }): number;
@@ -109,11 +109,11 @@ export declare function resolveLongRunningPort(opts: {
109
109
  * That is intentional — full shell semantics belong in the shell, not
110
110
  * the argv expander; this helper covers ~95% of dev-script usage.
111
111
  */
112
- export declare function expandShellDefaults(token: string, env: Record<string, any> | undefined): string;
112
+ export declare function expandShellDefaults(token: string, env: Record<string, string> | undefined): string;
113
113
  /**
114
114
  * Apply `expandShellDefaults` to every argv token. Used at the top of
115
115
  * a long-running handler before argv parsing so flag values are
116
116
  * fully resolved.
117
117
  */
118
- export declare function expandArgvShellDefaults(argv: ReadonlyArray<string>, env: Record<string, any> | undefined): string[];
118
+ export declare function expandArgvShellDefaults(argv: ReadonlyArray<string>, env: Record<string, string> | undefined): string[];
119
119
  //# sourceMappingURL=long-running-handle.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"long-running-handle.d.ts","sourceRoot":"","sources":["../../src/runtime/long-running-handle.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAEH;;;;;;GAMG;AACH,MAAM,WAAW,sBAAsB;IACrC,aAAa,CAAC,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;CACvE;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,sBAAsB;+BAElC,OAAO,GAAG,OAAO,CAAC,QAAQ,CAAC;EAM/D;AAED;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,GAAG,IAAI,CAkB/D;AAED;;;;;;;;GAQG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE;IAC3C,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,SAAS,CAAC;IACtC,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAChC,QAAQ,EAAE,MAAM,CAAC;CAClB,GAAG,MAAM,CAYT;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,MAAM,EACb,GAAG,EAAE,MAAM,CA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