Skip to content

Commit 57ba392

Browse files
bundle work
1 parent 1ad5e28 commit 57ba392

File tree

13 files changed

+143
-23
lines changed

13 files changed

+143
-23
lines changed

packages/adapter-postgres/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"tsup": "^8.3.5"
1313
},
1414
"scripts": {
15-
"build": "echo 'No build step required'",
15+
"build": "tsup --format esm --dts",
1616
"dev": "tsup --watch"
1717
}
1818
}
+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"extends": "../../tsconfig.json",
3+
"compilerOptions": {
4+
"outDir": "dist",
5+
"rootDir": "./src"
6+
},
7+
"include": ["src"]
8+
}
+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import { defineConfig } from "tsup";
2+
3+
export default defineConfig({
4+
entry: ["src/index.ts"],
5+
outDir: "dist",
6+
sourcemap: true,
7+
clean: true,
8+
format: ["esm"], // Ensure you're targeting CommonJS
9+
external: [
10+
"dotenv", // Externalize dotenv to prevent bundling
11+
"fs", // Externalize fs to use Node.js built-in module
12+
"path", // Externalize other built-ins if necessary
13+
"@reflink/reflink",
14+
"@node-llama-cpp",
15+
"https",
16+
"http",
17+
"agentkeepalive",
18+
19+
// Add other modules you want to externalize
20+
],
21+
});

packages/adapter-sqlite/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"tsup": "^8.3.5"
1515
},
1616
"scripts": {
17-
"build": "echo 'No build step required'",
17+
"build": "tsup --format esm --dts",
1818
"dev": "tsup --watch"
1919
},
2020
"peerDependencies": {

packages/adapter-sqlite/src/index.ts

+23-19
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1-
import { DatabaseAdapter } from "@ai16z/eliza/src/database.ts";
2-
import { embeddingZeroVector } from "@ai16z/eliza/src/memory.ts";
1+
export * from "./sqliteTables.ts";
2+
export * from "./sqlite_vec.ts";
3+
4+
import { DatabaseAdapter } from "@ai16z/eliza";
5+
import { embeddingZeroVector } from "@ai16z/eliza";
36
import {
47
Account,
58
Actor,
@@ -9,7 +12,7 @@ import {
912
type Memory,
1013
type Relationship,
1114
type UUID,
12-
} from "@ai16z/eliza/src/types.ts";
15+
} from "@ai16z/eliza";
1316
import { Database } from "better-sqlite3";
1417
import { v4 } from "uuid";
1518
import { load } from "./sqlite_vec.ts";
@@ -277,7 +280,6 @@ export class SqliteDatabaseAdapter extends DatabaseAdapter {
277280
}));
278281
}
279282

280-
281283
async searchMemoriesByEmbedding(
282284
embedding: number[],
283285
params: {
@@ -369,22 +371,24 @@ export class SqliteDatabaseAdapter extends DatabaseAdapter {
369371
LIMIT ?
370372
`;
371373

372-
const rows = this.db.prepare(sql).all(
373-
opts.query_field_name,
374-
opts.query_field_sub_name,
375-
opts.query_table_name,
376-
opts.query_field_name,
377-
opts.query_field_sub_name,
378-
opts.query_input,
379-
opts.query_input,
380-
opts.query_input,
381-
opts.query_input,
382-
opts.query_match_count
383-
) as { embedding: Buffer; levenshtein_score: number }[];
384-
385-
return rows.map(row => ({
374+
const rows = this.db
375+
.prepare(sql)
376+
.all(
377+
opts.query_field_name,
378+
opts.query_field_sub_name,
379+
opts.query_table_name,
380+
opts.query_field_name,
381+
opts.query_field_sub_name,
382+
opts.query_input,
383+
opts.query_input,
384+
opts.query_input,
385+
opts.query_input,
386+
opts.query_match_count
387+
) as { embedding: Buffer; levenshtein_score: number }[];
388+
389+
return rows.map((row) => ({
386390
embedding: Array.from(new Float32Array(row.embedding as Buffer)),
387-
levenshtein_score: row.levenshtein_score
391+
levenshtein_score: row.levenshtein_score,
388392
}));
389393
}
390394

packages/adapter-sqlite/tsconfig.json

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"extends": "../../tsconfig.json",
3+
"compilerOptions": {
4+
"outDir": "dist",
5+
"rootDir": "."
6+
},
7+
"include": ["src"]
8+
}
+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import { defineConfig } from "tsup";
2+
3+
export default defineConfig({
4+
entry: ["src/index.ts"],
5+
outDir: "dist",
6+
sourcemap: true,
7+
clean: true,
8+
format: ["esm"], // Ensure you're targeting CommonJS
9+
external: [
10+
"dotenv", // Externalize dotenv to prevent bundling
11+
"fs", // Externalize fs to use Node.js built-in module
12+
"path", // Externalize other built-ins if necessary
13+
"@reflink/reflink",
14+
"@node-llama-cpp",
15+
"https",
16+
"http",
17+
"agentkeepalive",
18+
"@anush008/tokenizers",
19+
// Add other modules you want to externalize
20+
],
21+
});

packages/adapter-sqljs/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"tsup": "^8.3.5"
1515
},
1616
"scripts": {
17-
"build": "echo 'No build step required'",
17+
"build": "tsup --format esm --dts",
1818
"dev": "tsup --watch"
1919
},
2020
"peerDependencies": {

packages/adapter-sqljs/src/index.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
import { v4 } from "uuid";
1+
export * from "./sqliteTables.ts";
2+
export * from "./types.ts";
23

4+
import { v4 } from "uuid";
35
import { DatabaseAdapter } from "@ai16z/eliza/src/database.ts";
46
import {
57
Account,

packages/adapter-sqljs/tsconfig.json

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"extends": "../../tsconfig.json",
3+
"compilerOptions": {
4+
"outDir": "dist",
5+
"rootDir": "./src"
6+
},
7+
"include": ["src"]
8+
}

packages/adapter-sqljs/tsup.config.ts

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import { defineConfig } from "tsup";
2+
3+
export default defineConfig({
4+
entry: ["src/index.ts"],
5+
outDir: "dist",
6+
sourcemap: true,
7+
clean: true,
8+
format: ["esm"], // Ensure you're targeting CommonJS
9+
external: [
10+
"dotenv", // Externalize dotenv to prevent bundling
11+
"fs", // Externalize fs to use Node.js built-in module
12+
"path", // Externalize other built-ins if necessary
13+
"@reflink/reflink",
14+
"@node-llama-cpp",
15+
"https",
16+
"http",
17+
"agentkeepalive",
18+
// Add other modules you want to externalize
19+
],
20+
});
+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"extends": "../../tsconfig.json",
3+
"compilerOptions": {
4+
"outDir": "dist",
5+
"rootDir": "./src"
6+
},
7+
"include": ["src"]
8+
}
+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import { defineConfig } from "tsup";
2+
3+
export default defineConfig({
4+
entry: ["src/index.ts"],
5+
outDir: "dist",
6+
sourcemap: true,
7+
clean: true,
8+
format: ["esm"], // Ensure you're targeting CommonJS
9+
external: [
10+
"dotenv", // Externalize dotenv to prevent bundling
11+
"fs", // Externalize fs to use Node.js built-in module
12+
"path", // Externalize other built-ins if necessary
13+
"@reflink/reflink",
14+
"@node-llama-cpp",
15+
"https",
16+
"http",
17+
"agentkeepalive",
18+
// Add other modules you want to externalize
19+
],
20+
});

0 commit comments

Comments
 (0)