@gobing-ai/ts-runtime 0.5.28 → 0.5.30

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.
@@ -1 +1 @@
1
- {"version":3,"file":"file-system-node.d.ts","sourceRoot":"","sources":["../src/file-system-node.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAmBH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAEpD;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,YAAY,GAAG,UAAU,CA+EpF;AAWD;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAaxD"}
1
+ {"version":3,"file":"file-system-node.d.ts","sourceRoot":"","sources":["../src/file-system-node.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAmBH,OAAO,KAAK,EAAE,UAAU,EAAkB,MAAM,eAAe,CAAC;AAChE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAEpD;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,YAAY,GAAG,UAAU,CAiFpF;AAWD;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAaxD"}
@@ -27,7 +27,9 @@ export function createNodeFileSystem(root, paths) {
27
27
  readFileStream: async function* (path) {
28
28
  // WHY: large JSONL history files (100MB+) must not be loaded into memory
29
29
  // all at once. createReadStream + manual line splitting lets the importer
30
- // process records incrementally with constant memory.
30
+ // process records incrementally with constant memory. The final buffer is
31
+ // yielded with terminated:false when non-empty so consumers can tell a
32
+ // torn/unterminated tail from a newline-terminated line.
31
33
  const stream = createReadStream(path, { encoding: 'utf-8' });
32
34
  let buffer = '';
33
35
  for await (const chunk of stream) {
@@ -36,11 +38,11 @@ export function createNodeFileSystem(root, paths) {
36
38
  // Keep the last (possibly partial) line in the buffer.
37
39
  buffer = lines.pop() ?? '';
38
40
  for (const line of lines) {
39
- yield line;
41
+ yield { text: line, terminated: true };
40
42
  }
41
43
  }
42
44
  if (buffer.length > 0)
43
- yield buffer;
45
+ yield { text: buffer, terminated: false };
44
46
  },
45
47
  writeFile: (path, content) => {
46
48
  ensureParentDir(path);
@@ -5,6 +5,12 @@ export interface FileStat {
5
5
  size: number;
6
6
  mtimeMs: number;
7
7
  }
8
+ /** One streamed line plus whether the producer's newline terminator was present. */
9
+ export interface ReadStreamLine {
10
+ text: string;
11
+ /** False only for the file's final segment when the file lacks a trailing newline. */
12
+ terminated: boolean;
13
+ }
8
14
  /**
9
15
  * Runtime-agnostic file system abstraction.
10
16
  *
@@ -23,15 +29,18 @@ export interface FileSystem {
23
29
  /**
24
30
  * Read file contents as a stream of UTF-8 text lines.
25
31
  *
26
- * Returns an async iterable yielding one line per iteration (without
27
- * trailing newline). This is the streaming counterpart of `readFile`
28
- * for large files that should not be loaded into memory all at once.
32
+ * Yields one {@link ReadStreamLine} per iteration. `terminated` reports
33
+ * whether the producer's newline was present: false only for a file's final
34
+ * segment when the file does not end with a newline — a write still in
35
+ * progress or a crash-teared tail. Consumers (e.g. the JSONL importer) use
36
+ * it to keep checkpoints below an incomplete line instead of recording a
37
+ * parse error for it.
29
38
  *
30
39
  * Optional: Cloudflare Workers and other stubs may omit this method.
31
40
  * Callers must check for its presence before use and fall back to
32
41
  * `readFile` + `split` when unavailable.
33
42
  */
34
- readFileStream?(path: string): AsyncIterable<string>;
43
+ readFileStream?(path: string): AsyncIterable<ReadStreamLine>;
35
44
  /** Write file contents, creating parent directories as needed. */
36
45
  writeFile(path: string, content: string): void | Promise<void>;
37
46
  /** Append content to a file, creating it if it doesn't exist. */
@@ -1 +1 @@
1
- {"version":3,"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AUG;IACH,QAAQ,CAAC,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;IAEhC,0DAA0D;IAC1D,OAAO,CAAC,GAAG,QAAQ,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC;IAEvC,2CAA2C;IAC3C,cAAc,IAAI,MAAM,CAAC;CAC5B"}
package/dist/index.d.ts CHANGED
@@ -2,7 +2,7 @@ export * from './config';
2
2
  export * from './context';
3
3
  export { createRuntimeContextFromFactory } from './context';
4
4
  export { D1NotConfiguredError, DbModuleNotInstalledError } from './db-errors';
5
- export type { FileStat, FileSystem } from './file-system';
5
+ export type { FileStat, FileSystem, ReadStreamLine } from './file-system';
6
6
  export { createCfFileSystem } from './file-system-cf';
7
7
  export { createNodeFileSystem, findProjectRoot } from './file-system-node';
8
8
  export { atomicWriteFile, atomicWriteJson, createLogStream, ensureDirForFile, readJsonFile, walkDir, writeJsonFile, } from './fs';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,OAAO,EAAE,+BAA+B,EAAE,MAAM,WAAW,CAAC;AAC5D,OAAO,EAAE,oBAAoB,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAC;AAC9E,YAAY,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAC3E,OAAO,EACH,eAAe,EACf,eAAe,EACf,eAAe,EACf,gBAAgB,EAChB,YAAY,EACZ,OAAO,EACP,aAAa,GAChB,MAAM,MAAM,CAAC;AACd,cAAc,QAAQ,CAAC;AACvB,OAAO,EAAE,oBAAoB,EAAE,yBAAyB,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AACjG,YAAY,EACR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AE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACtD,cAAc,qBAAqB,CAAC;AACpC,cAAc,SAAS,CAAC;AAIxB,uIAAuI;AACvI,YAAY,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAE5G;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG,YAAY,CAAC,cAAc,oBAAoB,EAAE,qBAAqB,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gobing-ai/ts-runtime",
3
- "version": "0.5.28",
3
+ "version": "0.5.30",
4
4
  "description": "@gobing-ai/ts-runtime — Runtime abstractions for Bun, Node, and Cloudflare Workers.",
5
5
  "keywords": [
6
6
  "typescript",
@@ -58,17 +58,17 @@
58
58
  "release": "echo 'Manual publish is disabled. Releases go through GitHub Actions via Trusted Publishing — push a tag: git tag @gobing-ai/ts-runtime-v<version> && git push --tags' && exit 1"
59
59
  },
60
60
  "dependencies": {
61
- "@gobing-ai/ts-utils": "^0.5.28",
61
+ "@gobing-ai/ts-utils": "^0.5.30",
62
62
  "execa": "^9.5.0",
63
63
  "yaml": "^2.7.0",
64
64
  "zod": "^4.1.0"
65
65
  },
66
66
  "devDependencies": {
67
- "@gobing-ai/ts-db": "^0.5.28",
67
+ "@gobing-ai/ts-db": "^0.5.30",
68
68
  "@types/bun": "1.4.3"
69
69
  },
70
70
  "peerDependencies": {
71
- "@gobing-ai/ts-db": "^0.5.28"
71
+ "@gobing-ai/ts-db": "^0.5.30"
72
72
  },
73
73
  "peerDependenciesMeta": {
74
74
  "@gobing-ai/ts-db": {
@@ -27,7 +27,7 @@ import {
27
27
  } from 'node:fs';
28
28
  import { dirname, resolve as resolvePath } from 'node:path';
29
29
 
30
- import type { FileSystem } from './file-system';
30
+ import type { FileSystem, ReadStreamLine } from './file-system';
31
31
  import type { RuntimePaths } from './runtime-paths';
32
32
 
33
33
  /**
@@ -48,10 +48,12 @@ export function createNodeFileSystem(root?: string, paths?: RuntimePaths): FileS
48
48
 
49
49
  readFile: (path: string) => readFileSync(path, 'utf-8'),
50
50
 
51
- readFileStream: async function* (path: string): AsyncIterable<string> {
51
+ readFileStream: async function* (path: string): AsyncIterable<ReadStreamLine> {
52
52
  // WHY: large JSONL history files (100MB+) must not be loaded into memory
53
53
  // all at once. createReadStream + manual line splitting lets the importer
54
- // process records incrementally with constant memory.
54
+ // process records incrementally with constant memory. The final buffer is
55
+ // yielded with terminated:false when non-empty so consumers can tell a
56
+ // torn/unterminated tail from a newline-terminated line.
55
57
  const stream = createReadStream(path, { encoding: 'utf-8' });
56
58
  let buffer = '';
57
59
  for await (const chunk of stream) {
@@ -60,10 +62,10 @@ export function createNodeFileSystem(root?: string, paths?: RuntimePaths): FileS
60
62
  // Keep the last (possibly partial) line in the buffer.
61
63
  buffer = lines.pop() ?? '';
62
64
  for (const line of lines) {
63
- yield line;
65
+ yield { text: line, terminated: true };
64
66
  }
65
67
  }
66
- if (buffer.length > 0) yield buffer;
68
+ if (buffer.length > 0) yield { text: buffer, terminated: false };
67
69
  },
68
70
 
69
71
  writeFile: (path: string, content: string) => {
@@ -6,6 +6,13 @@ export interface FileStat {
6
6
  mtimeMs: number;
7
7
  }
8
8
 
9
+ /** One streamed line plus whether the producer's newline terminator was present. */
10
+ export interface ReadStreamLine {
11
+ text: string;
12
+ /** False only for the file's final segment when the file lacks a trailing newline. */
13
+ terminated: boolean;
14
+ }
15
+
9
16
  /**
10
17
  * Runtime-agnostic file system abstraction.
11
18
  *
@@ -25,15 +32,18 @@ export interface FileSystem {
25
32
  /**
26
33
  * Read file contents as a stream of UTF-8 text lines.
27
34
  *
28
- * Returns an async iterable yielding one line per iteration (without
29
- * trailing newline). This is the streaming counterpart of `readFile`
30
- * for large files that should not be loaded into memory all at once.
35
+ * Yields one {@link ReadStreamLine} per iteration. `terminated` reports
36
+ * whether the producer's newline was present: false only for a file's final
37
+ * segment when the file does not end with a newline — a write still in
38
+ * progress or a crash-teared tail. Consumers (e.g. the JSONL importer) use
39
+ * it to keep checkpoints below an incomplete line instead of recording a
40
+ * parse error for it.
31
41
  *
32
42
  * Optional: Cloudflare Workers and other stubs may omit this method.
33
43
  * Callers must check for its presence before use and fall back to
34
44
  * `readFile` + `split` when unavailable.
35
45
  */
36
- readFileStream?(path: string): AsyncIterable<string>;
46
+ readFileStream?(path: string): AsyncIterable<ReadStreamLine>;
37
47
 
38
48
  /** Write file contents, creating parent directories as needed. */
39
49
  writeFile(path: string, content: string): void | Promise<void>;
package/src/index.ts CHANGED
@@ -2,7 +2,7 @@ export * from './config';
2
2
  export * from './context';
3
3
  export { createRuntimeContextFromFactory } from './context';
4
4
  export { D1NotConfiguredError, DbModuleNotInstalledError } from './db-errors';
5
- export type { FileStat, FileSystem } from './file-system';
5
+ export type { FileStat, FileSystem, ReadStreamLine } from './file-system';
6
6
  export { createCfFileSystem } from './file-system-cf';
7
7
  export { createNodeFileSystem, findProjectRoot } from './file-system-node';
8
8
  export {