@nimbus-sh/core 0.5.0 → 0.7.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 (145) hide show
  1. package/README.md +47 -26
  2. package/dist/_shared/byte-stream.d.ts +5 -4
  3. package/dist/_shared/byte-stream.d.ts.map +1 -1
  4. package/dist/_shared/cache-stats.d.ts +23 -1
  5. package/dist/_shared/cache-stats.d.ts.map +1 -1
  6. package/dist/_shared/cache-stats.js +13 -1
  7. package/dist/_shared/exports-resolver.d.ts +1 -1
  8. package/dist/_shared/exports-resolver.js +1 -1
  9. package/dist/_shared/real-node-imports.d.ts +7 -0
  10. package/dist/_shared/real-node-imports.d.ts.map +1 -1
  11. package/dist/_shared/real-node-imports.js +8 -0
  12. package/dist/_shared/retry.js +1 -1
  13. package/dist/_shared/tarball.d.ts +23 -5
  14. package/dist/_shared/tarball.d.ts.map +1 -1
  15. package/dist/_shared/tarball.js +38 -5
  16. package/dist/_shared/vfs-write-ledger.d.ts.map +1 -1
  17. package/dist/_shared/vfs-write-ledger.js +22 -16
  18. package/dist/constants.d.ts +5 -11
  19. package/dist/constants.d.ts.map +1 -1
  20. package/dist/constants.js +16 -56
  21. package/dist/runtime/assets-loader.js +1 -1
  22. package/dist/runtime/comment-strip.d.ts +0 -35
  23. package/dist/runtime/comment-strip.d.ts.map +1 -1
  24. package/dist/runtime/comment-strip.js +48 -20
  25. package/dist/runtime/esbuild-service.d.ts +38 -42
  26. package/dist/runtime/esbuild-service.d.ts.map +1 -1
  27. package/dist/runtime/esbuild-service.js +494 -197
  28. package/dist/runtime/javascript-ast.d.ts.map +1 -1
  29. package/dist/runtime/javascript-ast.js +45 -7
  30. package/dist/runtime/opentui-wasm-backend.d.ts.map +1 -1
  31. package/dist/runtime/opentui-wasm-backend.js +18 -16
  32. package/dist/runtime/port-registry.d.ts +4 -2
  33. package/dist/runtime/port-registry.d.ts.map +1 -1
  34. package/dist/runtime/port-registry.js +60 -8
  35. package/dist/runtime/virtual-socket-kernel.generated.d.ts +1 -1
  36. package/dist/runtime/virtual-socket-kernel.generated.js +1 -1
  37. package/dist/shell/stdin-adapter.d.ts +11 -0
  38. package/dist/shell/stdin-adapter.d.ts.map +1 -0
  39. package/dist/shell/stdin-adapter.js +59 -0
  40. package/dist/shell/unix-commands.d.ts +2 -1
  41. package/dist/shell/unix-commands.d.ts.map +1 -1
  42. package/dist/shell/unix-commands.js +1078 -50
  43. package/dist/substrate/lifo/commands/io/dd.js +1 -1
  44. package/dist/substrate/lifo/commands/net/curl.d.ts.map +1 -1
  45. package/dist/substrate/lifo/commands/net/curl.js +270 -54
  46. package/dist/substrate/lifo/commands/system/npm.d.ts +18 -1
  47. package/dist/substrate/lifo/commands/system/npm.d.ts.map +1 -1
  48. package/dist/substrate/lifo/commands/system/npm.js +26 -43
  49. package/dist/substrate/lifo/commands/text/head.d.ts.map +1 -1
  50. package/dist/substrate/lifo/commands/text/head.js +2 -1
  51. package/dist/substrate/lifo/commands/text/sed.d.ts.map +1 -1
  52. package/dist/substrate/lifo/commands/text/sed.js +499 -117
  53. package/dist/substrate/lifo/commands/types.d.ts +8 -4
  54. package/dist/substrate/lifo/commands/types.d.ts.map +1 -1
  55. package/dist/substrate/lifo/node-compat/zlib.d.ts +37 -18
  56. package/dist/substrate/lifo/node-compat/zlib.d.ts.map +1 -1
  57. package/dist/substrate/lifo/node-compat/zlib.js +122 -23
  58. package/dist/substrate/lifo/shell/interpreter.d.ts +9 -1
  59. package/dist/substrate/lifo/shell/interpreter.d.ts.map +1 -1
  60. package/dist/substrate/lifo/shell/interpreter.js +79 -29
  61. package/dist/substrate/lifo/shell/pipe.d.ts +16 -0
  62. package/dist/substrate/lifo/shell/pipe.d.ts.map +1 -1
  63. package/dist/substrate/lifo/shell/pipe.js +62 -18
  64. package/dist/substrate/lifo/shell/terminal-stdin.d.ts +20 -3
  65. package/dist/substrate/lifo/shell/terminal-stdin.d.ts.map +1 -1
  66. package/dist/substrate/lifo/shell/terminal-stdin.js +60 -24
  67. package/dist/vfs/seed-project.d.ts.map +1 -1
  68. package/dist/vfs/seed-project.js +1 -1
  69. package/dist/vfs/sqlite-vfs.d.ts +21 -30
  70. package/dist/vfs/sqlite-vfs.d.ts.map +1 -1
  71. package/dist/vfs/sqlite-vfs.js +113 -29
  72. package/dist/workspace/nimbus-workspace.d.ts +15 -0
  73. package/dist/workspace/nimbus-workspace.d.ts.map +1 -1
  74. package/dist/workspace/nimbus-workspace.js +20 -3
  75. package/dist/workspace/supervisor-op.d.ts +23 -0
  76. package/dist/workspace/supervisor-op.d.ts.map +1 -0
  77. package/dist/workspace/supervisor-op.js +92 -0
  78. package/package.json +3 -2
  79. package/src/_shared/byte-stream.ts +5 -4
  80. package/src/_shared/cache-stats.ts +27 -1
  81. package/src/_shared/exports-resolver.ts +1 -1
  82. package/src/_shared/real-node-imports.ts +8 -0
  83. package/src/_shared/retry.ts +1 -1
  84. package/src/_shared/tarball.ts +56 -5
  85. package/src/_shared/vfs-write-ledger.ts +22 -16
  86. package/src/constants.ts +30 -60
  87. package/src/runtime/assets-loader.ts +1 -1
  88. package/src/runtime/comment-strip.ts +42 -23
  89. package/src/runtime/esbuild-service.ts +566 -217
  90. package/src/runtime/javascript-ast.ts +40 -9
  91. package/src/runtime/opentui-wasm-backend.ts +19 -17
  92. package/src/runtime/port-registry.ts +66 -8
  93. package/src/runtime/virtual-socket-kernel.generated.ts +1 -1
  94. package/src/shell/stdin-adapter.ts +58 -0
  95. package/src/shell/unix-commands.ts +1054 -50
  96. package/src/substrate/lifo/commands/io/dd.ts +2 -2
  97. package/src/substrate/lifo/commands/net/curl.ts +310 -58
  98. package/src/substrate/lifo/commands/system/npm.ts +58 -38
  99. package/src/substrate/lifo/commands/text/head.ts +2 -1
  100. package/src/substrate/lifo/commands/text/sed.ts +519 -109
  101. package/src/substrate/lifo/commands/types.ts +8 -5
  102. package/src/substrate/lifo/node-compat/zlib.ts +155 -26
  103. package/src/substrate/lifo/shell/interpreter.ts +74 -27
  104. package/src/substrate/lifo/shell/pipe.ts +65 -24
  105. package/src/substrate/lifo/shell/terminal-stdin.ts +66 -30
  106. package/src/vfs/seed-project.ts +3 -3
  107. package/src/vfs/sqlite-vfs.ts +128 -64
  108. package/src/workspace/nimbus-workspace.ts +26 -2
  109. package/src/workspace/supervisor-op.ts +117 -0
  110. package/dist/_shared/install-phase.d.ts +0 -47
  111. package/dist/_shared/install-phase.d.ts.map +0 -1
  112. package/dist/_shared/install-phase.js +0 -1
  113. package/dist/_shared/rpc-dispose.d.ts +0 -4
  114. package/dist/_shared/rpc-dispose.d.ts.map +0 -1
  115. package/dist/_shared/rpc-dispose.js +0 -30
  116. package/dist/_shared/w7-frame.d.ts +0 -79
  117. package/dist/_shared/w7-frame.d.ts.map +0 -1
  118. package/dist/_shared/w7-frame.js +0 -840
  119. package/dist/_shared/weighted-credit-pool.d.ts +0 -61
  120. package/dist/_shared/weighted-credit-pool.d.ts.map +0 -1
  121. package/dist/_shared/weighted-credit-pool.js +0 -196
  122. package/dist/observability/diag-counters.d.ts +0 -236
  123. package/dist/observability/diag-counters.d.ts.map +0 -1
  124. package/dist/observability/diag-counters.js +0 -195
  125. package/dist/observability/heap-estimate.d.ts +0 -225
  126. package/dist/observability/heap-estimate.d.ts.map +0 -1
  127. package/dist/observability/heap-estimate.js +0 -185
  128. package/dist/observability/heavy-alloc-coord.d.ts +0 -93
  129. package/dist/observability/heavy-alloc-coord.d.ts.map +0 -1
  130. package/dist/observability/heavy-alloc-coord.js +0 -181
  131. package/dist/observability/oom-classify.d.ts +0 -138
  132. package/dist/observability/oom-classify.d.ts.map +0 -1
  133. package/dist/observability/oom-classify.js +0 -268
  134. package/dist/observability/oom-discriminator.d.ts +0 -176
  135. package/dist/observability/oom-discriminator.d.ts.map +0 -1
  136. package/dist/observability/oom-discriminator.js +0 -272
  137. package/src/_shared/install-phase.ts +0 -56
  138. package/src/_shared/rpc-dispose.ts +0 -31
  139. package/src/_shared/w7-frame.ts +0 -1013
  140. package/src/_shared/weighted-credit-pool.ts +0 -244
  141. package/src/observability/diag-counters.ts +0 -343
  142. package/src/observability/heap-estimate.ts +0 -331
  143. package/src/observability/heavy-alloc-coord.ts +0 -241
  144. package/src/observability/oom-classify.ts +0 -260
  145. package/src/observability/oom-discriminator.ts +0 -405
@@ -0,0 +1,117 @@
1
+ import type { SqliteVFS } from '../vfs/sqlite-vfs.js';
2
+ import { CRED_SESSION_USER, type VfsCred } from '../runtime/os-contracts.js';
3
+ import { SqliteRuntimeFsBridge } from '../runtime/sqlite-runtime-fs-bridge.js';
4
+ import { getSymlinkRegistry } from '../vfs/symlink-registry.js';
5
+ import type { SessionProcessSupervisor } from '../runtime/session-process-supervisor.js';
6
+
7
+ /** Identity comes from the supervisor binding, never from facet arguments. */
8
+ export interface SupervisorOpEnvelope {
9
+ readonly op: string;
10
+ readonly args?: readonly unknown[];
11
+ readonly pid?: number;
12
+ readonly writerId?: string;
13
+ readonly mutationOwner?: string;
14
+ readonly stream?: ReadableStream<Uint8Array>;
15
+ }
16
+
17
+ export type SupervisorOpHandler = (envelope: SupervisorOpEnvelope) => unknown;
18
+
19
+ export interface SupervisorOpDeps {
20
+ readonly vfs: SqliteVFS;
21
+ /** Absent a process table, operations use the unprivileged session user. */
22
+ readonly processes?: SessionProcessSupervisor;
23
+ readonly output?: (stream: 'stdout' | 'stderr', pid: number, data: string) => void;
24
+ /** Host handlers override defaults, for example to account for stream drains. */
25
+ readonly extend?: Readonly<Record<string, SupervisorOpHandler>>;
26
+ }
27
+
28
+ function stringArg(envelope: SupervisorOpEnvelope, index: number): string {
29
+ const value = envelope.args?.[index];
30
+ if (typeof value !== 'string') {
31
+ throw new Error(`supervisor op ${envelope.op}: argument ${index} must be a string`);
32
+ }
33
+ return value;
34
+ }
35
+
36
+ function numberArg(envelope: SupervisorOpEnvelope, index: number): number {
37
+ const value = envelope.args?.[index];
38
+ if (typeof value !== 'number' || !Number.isFinite(value)) {
39
+ throw new Error(`supervisor op ${envelope.op}: argument ${index} must be a number`);
40
+ }
41
+ return value;
42
+ }
43
+
44
+ function contentArg(envelope: SupervisorOpEnvelope, index: number): string | Uint8Array {
45
+ const value = envelope.args?.[index];
46
+ if (typeof value === 'string' || value instanceof Uint8Array) return value;
47
+ if (value instanceof ArrayBuffer) return new Uint8Array(value);
48
+ throw new Error(`supervisor op ${envelope.op}: argument ${index} must be bytes or text`);
49
+ }
50
+
51
+ function credFor(deps: SupervisorOpDeps, pid: number | undefined): VfsCred {
52
+ if (pid === undefined) return CRED_SESSION_USER;
53
+ if (!Number.isInteger(pid) || pid <= 0) {
54
+ throw new Error('supervisor op: filesystem operation requires a valid process pid');
55
+ }
56
+ return deps.processes ? deps.processes.cred(pid) : CRED_SESSION_USER;
57
+ }
58
+
59
+ /** One dispatch method lets any host serve its workspace to process facets. */
60
+ export function createSupervisorOpHandler(
61
+ deps: SupervisorOpDeps,
62
+ ): (envelope: SupervisorOpEnvelope) => Promise<unknown> {
63
+ const bridges = new Map<number, SqliteRuntimeFsBridge>();
64
+ const bridgeFor = (pid: number | undefined): SqliteRuntimeFsBridge => {
65
+ const key = pid ?? 0;
66
+ const credentialed = deps.vfs.as(credFor(deps, pid));
67
+ const held = bridges.get(key);
68
+ if (held) {
69
+ held.updateCredential(credentialed);
70
+ return held;
71
+ }
72
+ const built = new SqliteRuntimeFsBridge(credentialed, deps.vfs);
73
+ bridges.set(key, built);
74
+ return built;
75
+ };
76
+ const ops: Readonly<Record<string, SupervisorOpHandler>> = {
77
+ readFile: async (e) => {
78
+ const bytes = await bridgeFor(e.pid).readFile(stringArg(e, 0));
79
+ return bytes === null ? null : new TextDecoder().decode(bytes);
80
+ },
81
+ readFileBytes: (e) => bridgeFor(e.pid).readFile(stringArg(e, 0)),
82
+ stat: (e) => bridgeFor(e.pid).stat(stringArg(e, 0)),
83
+ lstat: (e) => bridgeFor(e.pid).stat(stringArg(e, 0), { followSymlinks: false }),
84
+ exists: async (e) => (await bridgeFor(e.pid).stat(stringArg(e, 0))) !== null,
85
+ readdir: (e) => bridgeFor(e.pid).readdir(stringArg(e, 0)),
86
+ readlink: (e) => bridgeFor(e.pid).readlink(stringArg(e, 0)),
87
+ fsReadRange: (e) => bridgeFor(e.pid).readRange(stringArg(e, 0), numberArg(e, 1), numberArg(e, 2)),
88
+ fsReadRangeUncached: (e) => bridgeFor(e.pid).readRange(stringArg(e, 0), numberArg(e, 1), numberArg(e, 2), { cached: false }),
89
+ fsRevision: (e) => bridgeFor(e.pid).revision(e.args?.[0] === undefined ? undefined : stringArg(e, 0)),
90
+ hasLegacySymlinkUnder: (e) => getSymlinkRegistry(deps.vfs).hasAtOrBelow(stringArg(e, 0)),
91
+ writeFile: (e) => bridgeFor(e.pid).writeFile(stringArg(e, 0), contentArg(e, 1)),
92
+ mkdir: (e) => bridgeFor(e.pid).mkdir(stringArg(e, 0), { recursive: true }),
93
+ rmdir: (e) => bridgeFor(e.pid).rmdir(stringArg(e, 0)),
94
+ unlink: (e) => bridgeFor(e.pid).unlink(stringArg(e, 0)),
95
+ rename: (e) => bridgeFor(e.pid).rename(stringArg(e, 0), stringArg(e, 1)),
96
+ symlink: (e) => bridgeFor(e.pid).symlink(stringArg(e, 0), stringArg(e, 1)),
97
+ chmod: (e) => bridgeFor(e.pid).chmod(stringArg(e, 0), numberArg(e, 1)),
98
+ utimes: (e) => bridgeFor(e.pid).utimes(stringArg(e, 0), numberArg(e, 1), numberArg(e, 2)),
99
+ fsTruncate: (e) => bridgeFor(e.pid).truncate(stringArg(e, 0), numberArg(e, 1)),
100
+ writeBatchStream: (e) => {
101
+ if (!e.stream) throw new Error('supervisor op writeBatchStream: no stream');
102
+ return deps.vfs.as(credFor(deps, e.pid)).writeStream(e.stream, { mutationOwner: e.mutationOwner });
103
+ },
104
+ stdout: (e) => { deps.output?.('stdout', e.pid ?? 0, stringArg(e, 0)); },
105
+ stderr: (e) => { deps.output?.('stderr', e.pid ?? 0, stringArg(e, 0)); },
106
+ };
107
+ const extend = deps.extend ?? {};
108
+ return async (envelope) => {
109
+ if (!envelope || typeof envelope.op !== 'string') {
110
+ throw new Error('supervisor op: envelope names no operation');
111
+ }
112
+ const handler = Object.hasOwn(extend, envelope.op) ? extend[envelope.op]
113
+ : Object.hasOwn(ops, envelope.op) ? ops[envelope.op] : undefined;
114
+ if (!handler) throw new Error(`supervisor op: '${envelope.op}' is not served by this host`);
115
+ return handler(envelope);
116
+ };
117
+ }
@@ -1,47 +0,0 @@
1
- /**
2
- * _shared/install-phase.ts — single source of truth for the npm-install
3
- * state-machine phase enum.
4
- *
5
- * History: CLN-1 (2026-05-11) — consolidated from two diverged copies.
6
- * - `npm/installer.ts:93-95` was the progress-event variant. Included
7
- * 'lock-check' (a real progress event emitted while parsing
8
- * package-lock.json) but lacked 'idle'.
9
- * - `observability/diag-counters.ts:33-35` was the counter-state variant.
10
- * Included 'idle' (the resting state when no install is in flight)
11
- * but lacked 'lock-check'. The diag-counter's `setInstallPhase()`
12
- * was actually called with 'idle' (installer.ts:184,201) — passing
13
- * a value not declared in installer.ts's local type. The type check
14
- * fell through to diag-counters' type because installer.ts imports
15
- * setInstallPhase from there; the local `InstallPhase` definition
16
- * in installer.ts was only used by `InstallProgress.phase`.
17
- *
18
- * Going forward both consumers import from this module; any new phase
19
- * value added here is automatically available everywhere.
20
- *
21
- * Phase semantics (chronological order for a single install run):
22
- *
23
- * idle resting state, no install in flight
24
- * ↓
25
- * lock-check parsing existing package-lock.json (if present)
26
- * ↓
27
- * resolve walking the dep tree, fetching packuments
28
- * ↓
29
- * hoist hoisting peer-deps + flattening node_modules
30
- * ↓
31
- * diff comparing target tree against current install state
32
- * ↓
33
- * fetch downloading missing tarballs
34
- * ↓
35
- * write extracting tarballs into the VFS
36
- * ↓
37
- * link-bins creating bin/ symlinks
38
- * ↓
39
- * bundle (post-install) pre-bundling for esbuild fast path
40
- * ↓
41
- * done install complete; about to return to 'idle'
42
- *
43
- * The phase strings are surfaced via /api/_diag/install-pipeline and
44
- * displayed in the install-progress UI; treat them as a public API.
45
- */
46
- export type InstallPhase = 'idle' | 'lock-check' | 'resolve' | 'hoist' | 'diff' | 'fetch' | 'write' | 'link-bins' | 'bundle' | 'done';
47
- //# sourceMappingURL=install-phase.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"install-phase.d.ts","sourceRoot":"","sources":["../../src/_shared/install-phase.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AACH,MAAM,MAAM,YAAY,GACpB,MAAM,GACN,YAAY,GACZ,SAAS,GACT,OAAO,GACP,MAAM,GACN,OAAO,GACP,OAAO,GACP,WAAW,GACX,QAAQ,GACR,MAAM,CAAC"}
@@ -1 +0,0 @@
1
- export {};
@@ -1,4 +0,0 @@
1
- export declare function disposeRpcResource(value: unknown): boolean;
2
- export declare function disposeRpcResources(values: Iterable<unknown>): void;
3
- export declare function useRpcResource<T, R>(promise: Promise<T>, use: (value: T) => R | Promise<R>): Promise<R>;
4
- //# sourceMappingURL=rpc-dispose.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"rpc-dispose.d.ts","sourceRoot":"","sources":["../../src/_shared/rpc-dispose.ts"],"names":[],"mappings":"AAEA,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAY1D;AAED,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,QAAQ,CAAC,OAAO,CAAC,GAAG,IAAI,CAEnE;AAED,wBAAsB,cAAc,CAAC,CAAC,EAAE,CAAC,EACvC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,EACnB,GAAG,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,GAChC,OAAO,CAAC,CAAC,CAAC,CAOZ"}
@@ -1,30 +0,0 @@
1
- export function disposeRpcResource(value) {
2
- if ((typeof value !== 'object' && typeof value !== 'function') || value === null)
3
- return false;
4
- const disposerKey = Symbol.dispose;
5
- if (!disposerKey)
6
- return false;
7
- const disposer = Reflect.get(value, disposerKey);
8
- if (typeof disposer !== 'function')
9
- return false;
10
- try {
11
- Reflect.apply(disposer, value, []);
12
- return true;
13
- }
14
- catch {
15
- return false;
16
- }
17
- }
18
- export function disposeRpcResources(values) {
19
- for (const value of values)
20
- disposeRpcResource(value);
21
- }
22
- export async function useRpcResource(promise, use) {
23
- const value = await promise;
24
- try {
25
- return await use(value);
26
- }
27
- finally {
28
- disposeRpcResource(value);
29
- }
30
- }
@@ -1,79 +0,0 @@
1
- /**
2
- * W7 v3 — incremental typed records for streamed bulk filesystem writes.
3
- * The format is internal: every producer and consumer deploys together.
4
- */
5
- import type { BatchInodeEntry, BatchWritePayload } from '../vfs/sqlite-vfs.js';
6
- export declare const W7_MAGIC: Uint8Array<ArrayBuffer>;
7
- export declare const W7_MAX_PATHS_PER_BATCH = 128;
8
- export declare const W7_MAX_OWNED_PATH_BYTES: number;
9
- export declare const W7_MAX_RECORD_BYTES: number;
10
- declare const MODE: "path-atomic-committed-prefix";
11
- export interface W7BatchSummary {
12
- recordCount: number;
13
- pathCount: number;
14
- deleteCount: number;
15
- directoryCount: number;
16
- fileCount: number;
17
- chunkCount: number;
18
- byteCount: number;
19
- check: number;
20
- }
21
- export interface W7ChunkRetention {
22
- readonly bytes: number;
23
- release(): void;
24
- }
25
- export interface W7DecodeOptions {
26
- signal?: AbortSignal;
27
- retainChunk?: (byteLength: number, signal?: AbortSignal) => Promise<W7ChunkRetention>;
28
- }
29
- type W7DirectoryInode = BatchInodeEntry & {
30
- kind: 'directory';
31
- isDir: true;
32
- };
33
- type W7ContentInode = BatchInodeEntry & {
34
- kind: 'file' | 'symlink';
35
- isDir: false;
36
- };
37
- export type W7DecodedRecord = {
38
- type: 'delete';
39
- path: string;
40
- } | {
41
- type: 'directory';
42
- inode: W7DirectoryInode;
43
- } | {
44
- type: 'file-begin';
45
- streamContentId: string;
46
- inode: W7ContentInode;
47
- } | {
48
- type: 'file-chunk';
49
- streamContentId: string;
50
- path: string;
51
- chunkId: number;
52
- data: Uint8Array;
53
- retention: W7ChunkRetention;
54
- } | {
55
- type: 'file-end';
56
- streamContentId: string;
57
- path: string;
58
- size: number;
59
- chunkCount: number;
60
- check: number;
61
- } | {
62
- type: 'batch-end';
63
- summary: W7BatchSummary;
64
- };
65
- export interface W7DecodedStream {
66
- readonly batchId: string;
67
- readonly mode: typeof MODE;
68
- readonly records: AsyncIterable<W7DecodedRecord>;
69
- }
70
- /** Encode one bounded record per pull; no batch-sized metadata header exists. */
71
- export declare function encodeWriteBatchStream(payload: BatchWritePayload): ReadableStream<Uint8Array>;
72
- /**
73
- * Parse the v3 preamble eagerly, then expose validated operation records
74
- * incrementally. Chunk credit is acquired after its bounded header validates
75
- * and before its payload bytes are read or copied.
76
- */
77
- export declare function decodeWriteBatchStream(stream: ReadableStream<Uint8Array>, options?: W7DecodeOptions): Promise<W7DecodedStream>;
78
- export {};
79
- //# sourceMappingURL=w7-frame.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"w7-frame.d.ts","sourceRoot":"","sources":["../../src/_shared/w7-frame.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAEV,eAAe,EACf,iBAAiB,EAElB,MAAM,sBAAsB,CAAC;AAE9B,eAAO,MAAM,QAAQ,yBAA2C,CAAC;AAOjE,eAAO,MAAM,sBAAsB,MAAM,CAAC;AAC1C,eAAO,MAAM,uBAAuB,QAAY,CAAC;AACjD,eAAO,MAAM,mBAAmB,QAAgD,CAAC;AAYjF,QAAA,MAAM,IAAI,EAAG,8BAAuC,CAAC;AAoCrD,MAAM,WAAW,cAAc;IAC7B,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,MAAM,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,C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