@gobing-ai/ts-llm-jsonl-importer 0.3.19 → 0.3.21
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.
- package/dist/importer.js +2 -19
- package/package.json +4 -4
- package/src/importer.ts +2 -18
package/dist/importer.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createNodeFileSystem,
|
|
1
|
+
import { createNodeFileSystem, resolvePath, walkDir } from '@gobing-ai/ts-runtime';
|
|
2
2
|
import { HistoryImportError } from './errors.js';
|
|
3
3
|
import { sha256 } from './hash.js';
|
|
4
4
|
import { redactRecord } from './redaction.js';
|
|
@@ -170,30 +170,13 @@ async function discoverFiles(definition, roots, files, fileSystem) {
|
|
|
170
170
|
found.add(root);
|
|
171
171
|
continue;
|
|
172
172
|
}
|
|
173
|
-
for (const file of await
|
|
173
|
+
for (const file of await walkDir(root, fileSystem)) {
|
|
174
174
|
if (matchesPattern(file, definition.filePatterns))
|
|
175
175
|
found.add(file);
|
|
176
176
|
}
|
|
177
177
|
}
|
|
178
178
|
return [...found].sort();
|
|
179
179
|
}
|
|
180
|
-
async function walkFiles(fileSystem, root) {
|
|
181
|
-
const entries = [...(await fileSystem.readDir(root))].sort();
|
|
182
|
-
const found = [];
|
|
183
|
-
for (const entry of entries) {
|
|
184
|
-
const path = joinPath(root, entry);
|
|
185
|
-
const stat = await fileSystem.stat(path);
|
|
186
|
-
if (stat === null)
|
|
187
|
-
continue;
|
|
188
|
-
if (stat.isDirectory()) {
|
|
189
|
-
found.push(...(await walkFiles(fileSystem, path)));
|
|
190
|
-
continue;
|
|
191
|
-
}
|
|
192
|
-
if (stat.isFile())
|
|
193
|
-
found.push(path);
|
|
194
|
-
}
|
|
195
|
-
return found;
|
|
196
|
-
}
|
|
197
180
|
function matchesPattern(path, patterns) {
|
|
198
181
|
return patterns.some((pattern) => {
|
|
199
182
|
if (pattern === '*.jsonl')
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gobing-ai/ts-llm-jsonl-importer",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.21",
|
|
4
4
|
"description": "@gobing-ai/ts-llm-jsonl-importer — Generic JSONL importer for LLM agent history files.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"typescript",
|
|
@@ -47,9 +47,9 @@
|
|
|
47
47
|
"release": "echo 'Manual publish is disabled. Releases go through GitHub Actions via Trusted Publishing — push a tag: git tag @gobing-ai/ts-llm-jsonl-importer-v<version> && git push --tags' && exit 1"
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
|
-
"@gobing-ai/ts-db": "^0.3.
|
|
51
|
-
"@gobing-ai/ts-runtime": "^0.3.
|
|
52
|
-
"@gobing-ai/ts-utils": "^0.3.
|
|
50
|
+
"@gobing-ai/ts-db": "^0.3.21",
|
|
51
|
+
"@gobing-ai/ts-runtime": "^0.3.21",
|
|
52
|
+
"@gobing-ai/ts-utils": "^0.3.21",
|
|
53
53
|
"zod": "^4.1.0"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
package/src/importer.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createNodeFileSystem, type FileSystem,
|
|
1
|
+
import { createNodeFileSystem, type FileSystem, resolvePath, walkDir } from '@gobing-ai/ts-runtime';
|
|
2
2
|
import { HistoryImportError } from './errors';
|
|
3
3
|
import { sha256 } from './hash';
|
|
4
4
|
import { redactRecord } from './redaction';
|
|
@@ -227,29 +227,13 @@ async function discoverFiles(
|
|
|
227
227
|
if (matchesPattern(root, definition.filePatterns)) found.add(root);
|
|
228
228
|
continue;
|
|
229
229
|
}
|
|
230
|
-
for (const file of await
|
|
230
|
+
for (const file of await walkDir(root, fileSystem)) {
|
|
231
231
|
if (matchesPattern(file, definition.filePatterns)) found.add(file);
|
|
232
232
|
}
|
|
233
233
|
}
|
|
234
234
|
return [...found].sort();
|
|
235
235
|
}
|
|
236
236
|
|
|
237
|
-
async function walkFiles(fileSystem: FileSystem, root: string): Promise<readonly string[]> {
|
|
238
|
-
const entries = [...(await fileSystem.readDir(root))].sort();
|
|
239
|
-
const found: string[] = [];
|
|
240
|
-
for (const entry of entries) {
|
|
241
|
-
const path = joinPath(root, entry);
|
|
242
|
-
const stat = await fileSystem.stat(path);
|
|
243
|
-
if (stat === null) continue;
|
|
244
|
-
if (stat.isDirectory()) {
|
|
245
|
-
found.push(...(await walkFiles(fileSystem, path)));
|
|
246
|
-
continue;
|
|
247
|
-
}
|
|
248
|
-
if (stat.isFile()) found.push(path);
|
|
249
|
-
}
|
|
250
|
-
return found;
|
|
251
|
-
}
|
|
252
|
-
|
|
253
237
|
function matchesPattern(path: string, patterns: readonly string[]): boolean {
|
|
254
238
|
return patterns.some((pattern) => {
|
|
255
239
|
if (pattern === '*.jsonl') return path.endsWith('.jsonl');
|