@deepagents/text2sql 7.2.0 → 7.3.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.
- package/dist/bin/sql.js +8 -9
- package/dist/finetune/convert-to-gguf.d.ts +0 -16
- package/dist/finetune/convert-to-gguf.d.ts.map +1 -1
- package/dist/index.js +26 -15
- package/dist/index.js.map +2 -2
- package/dist/lib/checkpoint.d.ts +6 -0
- package/dist/lib/checkpoint.d.ts.map +1 -1
- package/dist/lib/file-cache.d.ts.map +1 -1
- package/package.json +13 -9
package/dist/bin/sql.js
CHANGED
|
@@ -10,9 +10,10 @@ import {
|
|
|
10
10
|
} from "@deepagents/context";
|
|
11
11
|
|
|
12
12
|
// packages/text2sql/src/lib/file-cache.ts
|
|
13
|
-
import {
|
|
13
|
+
import { atomicWrite } from "@zukhruf/fs";
|
|
14
|
+
import { createHash } from "node:crypto";
|
|
14
15
|
import { existsSync } from "node:fs";
|
|
15
|
-
import { mkdir, readFile
|
|
16
|
+
import { mkdir, readFile } from "node:fs/promises";
|
|
16
17
|
import { tmpdir } from "node:os";
|
|
17
18
|
import path from "node:path";
|
|
18
19
|
var FileCache = class {
|
|
@@ -29,9 +30,7 @@ var FileCache = class {
|
|
|
29
30
|
}
|
|
30
31
|
async set(content) {
|
|
31
32
|
await mkdir(path.dirname(this.path), { recursive: true });
|
|
32
|
-
|
|
33
|
-
await writeFile(tempPath, content, "utf-8");
|
|
34
|
-
await rename(tempPath, this.path);
|
|
33
|
+
await atomicWrite(this.path, content);
|
|
35
34
|
}
|
|
36
35
|
};
|
|
37
36
|
var JsonCache = class extends FileCache {
|
|
@@ -555,7 +554,7 @@ import {
|
|
|
555
554
|
mkdir as mkdir2,
|
|
556
555
|
open,
|
|
557
556
|
stat,
|
|
558
|
-
writeFile
|
|
557
|
+
writeFile
|
|
559
558
|
} from "node:fs/promises";
|
|
560
559
|
import * as path3 from "node:path";
|
|
561
560
|
import { finished } from "node:stream/promises";
|
|
@@ -621,7 +620,7 @@ var IndexCommand = class extends SqlCommand {
|
|
|
621
620
|
names,
|
|
622
621
|
onProgress: createProgressHandler(eventsStream, verbose, ctx.stderr)
|
|
623
622
|
});
|
|
624
|
-
await
|
|
623
|
+
await writeFile(fragmentsPath, JSON.stringify(fragments, null, 2));
|
|
625
624
|
const manifest = {
|
|
626
625
|
fragmentsPath,
|
|
627
626
|
eventsPath,
|
|
@@ -734,7 +733,7 @@ function dedupe(values) {
|
|
|
734
733
|
}
|
|
735
734
|
|
|
736
735
|
// packages/text2sql/src/bin/commands/run.ts
|
|
737
|
-
import { mkdir as mkdir3, writeFile as
|
|
736
|
+
import { mkdir as mkdir3, writeFile as writeFile2 } from "node:fs/promises";
|
|
738
737
|
import * as path4 from "node:path";
|
|
739
738
|
import { v7 as v72 } from "uuid";
|
|
740
739
|
var RunCommand = class extends SqlQueryCommand {
|
|
@@ -749,7 +748,7 @@ var RunCommand = class extends SqlQueryCommand {
|
|
|
749
748
|
const outPath = path4.join(outputDir, `${v72()}.json`);
|
|
750
749
|
try {
|
|
751
750
|
await mkdir3(outputDir, { recursive: true });
|
|
752
|
-
await
|
|
751
|
+
await writeFile2(outPath, JSON.stringify(rows, null, 2));
|
|
753
752
|
} catch (error) {
|
|
754
753
|
this.fail(errorMessage2(error));
|
|
755
754
|
}
|
|
@@ -1,18 +1,2 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Convert HuggingFace model to GGUF format using Docker
|
|
3
|
-
* Uses the official llama.cpp image - no local installation needed
|
|
4
|
-
*
|
|
5
|
-
* Usage: node convert-to-gguf.ts <model_dir> <output.gguf> [quantization]
|
|
6
|
-
*
|
|
7
|
-
* Arguments:
|
|
8
|
-
* model_dir Path to HuggingFace model directory (contains model.safetensors)
|
|
9
|
-
* output.gguf Output path for the GGUF file
|
|
10
|
-
* quantization Quantization type (default: q8_0)
|
|
11
|
-
* Options: f32, f16, bf16, q8_0, q4_0, q4_1, q5_0, q5_1
|
|
12
|
-
*
|
|
13
|
-
* Examples:
|
|
14
|
-
* node convert-to-gguf.ts ./qwen3-sql-final ./qwen3-sql.gguf
|
|
15
|
-
* node convert-to-gguf.ts ./qwen3-sql-final ./qwen3-sql-q4.gguf q4_0
|
|
16
|
-
*/
|
|
17
1
|
export {};
|
|
18
2
|
//# sourceMappingURL=convert-to-gguf.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"convert-to-gguf.d.ts","sourceRoot":"","sources":["../../src/finetune/convert-to-gguf.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"convert-to-gguf.d.ts","sourceRoot":"","sources":["../../src/finetune/convert-to-gguf.ts"],"names":[],"mappings":""}
|
package/dist/index.js
CHANGED
|
@@ -1129,9 +1129,10 @@ import {
|
|
|
1129
1129
|
} from "@deepagents/context";
|
|
1130
1130
|
|
|
1131
1131
|
// packages/text2sql/src/lib/file-cache.ts
|
|
1132
|
-
import {
|
|
1132
|
+
import { atomicWrite } from "@zukhruf/fs";
|
|
1133
|
+
import { createHash } from "node:crypto";
|
|
1133
1134
|
import { existsSync } from "node:fs";
|
|
1134
|
-
import { mkdir, readFile
|
|
1135
|
+
import { mkdir, readFile } from "node:fs/promises";
|
|
1135
1136
|
import { tmpdir } from "node:os";
|
|
1136
1137
|
import path from "node:path";
|
|
1137
1138
|
var FileCache = class {
|
|
@@ -1148,9 +1149,7 @@ var FileCache = class {
|
|
|
1148
1149
|
}
|
|
1149
1150
|
async set(content) {
|
|
1150
1151
|
await mkdir(path.dirname(this.path), { recursive: true });
|
|
1151
|
-
|
|
1152
|
-
await writeFile(tempPath, content, "utf-8");
|
|
1153
|
-
await rename(tempPath, this.path);
|
|
1152
|
+
await atomicWrite(this.path, content);
|
|
1154
1153
|
}
|
|
1155
1154
|
};
|
|
1156
1155
|
var JsonCache = class extends FileCache {
|
|
@@ -1367,8 +1366,9 @@ function errorMessage(error) {
|
|
|
1367
1366
|
}
|
|
1368
1367
|
|
|
1369
1368
|
// packages/text2sql/src/lib/checkpoint.ts
|
|
1369
|
+
import { durableWrite } from "@zukhruf/fs";
|
|
1370
1370
|
import { createHash as createHash2 } from "node:crypto";
|
|
1371
|
-
import { existsSync as existsSync2, readFileSync
|
|
1371
|
+
import { existsSync as existsSync2, readFileSync } from "node:fs";
|
|
1372
1372
|
import pLimit from "p-limit";
|
|
1373
1373
|
import z4 from "zod";
|
|
1374
1374
|
function jsonCodec(schema) {
|
|
@@ -1388,6 +1388,9 @@ var Checkpoint = class _Checkpoint {
|
|
|
1388
1388
|
points;
|
|
1389
1389
|
path;
|
|
1390
1390
|
configHash;
|
|
1391
|
+
#writes = pLimit(1);
|
|
1392
|
+
#changes = 0;
|
|
1393
|
+
#writtenChanges = 0;
|
|
1391
1394
|
constructor(path6, configHash, points) {
|
|
1392
1395
|
this.points = points;
|
|
1393
1396
|
this.path = path6;
|
|
@@ -1484,15 +1487,23 @@ var Checkpoint = class _Checkpoint {
|
|
|
1484
1487
|
getPath() {
|
|
1485
1488
|
return this.path;
|
|
1486
1489
|
}
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1490
|
+
/**
|
|
1491
|
+
* Writes one snapshot at a time, so an older snapshot never lands after a
|
|
1492
|
+
* newer one. Each write takes the snapshot when it starts, so a save that
|
|
1493
|
+
* waited behind a write that already holds its change writes nothing.
|
|
1494
|
+
*/
|
|
1495
|
+
save() {
|
|
1496
|
+
this.#changes += 1;
|
|
1497
|
+
return this.#writes(async () => {
|
|
1498
|
+
const changes = this.#changes;
|
|
1499
|
+
if (changes === this.#writtenChanges) return;
|
|
1500
|
+
const file = {
|
|
1501
|
+
configHash: this.configHash,
|
|
1502
|
+
points: this.points
|
|
1503
|
+
};
|
|
1504
|
+
await durableWrite(this.path, JSON.stringify(file, null, 2));
|
|
1505
|
+
this.#writtenChanges = changes;
|
|
1506
|
+
});
|
|
1496
1507
|
}
|
|
1497
1508
|
};
|
|
1498
1509
|
function hash(value) {
|