@aigne/afs-history 1.2.0-beta.3 → 1.2.0-beta.5

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 (40) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/lib/cjs/index.d.ts +8 -3
  3. package/lib/cjs/index.js +193 -21
  4. package/lib/cjs/storage/index.d.ts +11 -5
  5. package/lib/cjs/storage/index.js +67 -18
  6. package/lib/cjs/storage/migrate.d.ts +1 -1
  7. package/lib/cjs/storage/migrate.js +7 -5
  8. package/lib/cjs/storage/migrations/002-add-agent-id.d.ts +2 -0
  9. package/lib/cjs/storage/migrations/002-add-agent-id.js +13 -0
  10. package/lib/cjs/storage/migrations/003-add-compact-table.d.ts +2 -0
  11. package/lib/cjs/storage/migrations/003-add-compact-table.js +23 -0
  12. package/lib/cjs/storage/models/compact.d.ts +183 -0
  13. package/lib/cjs/storage/models/compact.js +27 -0
  14. package/lib/cjs/storage/models/entries.d.ts +19 -0
  15. package/lib/cjs/storage/models/entries.js +1 -0
  16. package/lib/cjs/storage/type.d.ts +18 -2
  17. package/lib/dts/index.d.ts +8 -3
  18. package/lib/dts/storage/index.d.ts +11 -5
  19. package/lib/dts/storage/migrate.d.ts +1 -1
  20. package/lib/dts/storage/migrations/002-add-agent-id.d.ts +2 -0
  21. package/lib/dts/storage/migrations/003-add-compact-table.d.ts +2 -0
  22. package/lib/dts/storage/models/compact.d.ts +183 -0
  23. package/lib/dts/storage/models/entries.d.ts +19 -0
  24. package/lib/dts/storage/type.d.ts +18 -2
  25. package/lib/esm/index.d.ts +8 -3
  26. package/lib/esm/index.js +193 -21
  27. package/lib/esm/storage/index.d.ts +11 -5
  28. package/lib/esm/storage/index.js +68 -19
  29. package/lib/esm/storage/migrate.d.ts +1 -1
  30. package/lib/esm/storage/migrate.js +7 -5
  31. package/lib/esm/storage/migrations/002-add-agent-id.d.ts +2 -0
  32. package/lib/esm/storage/migrations/002-add-agent-id.js +10 -0
  33. package/lib/esm/storage/migrations/003-add-compact-table.d.ts +2 -0
  34. package/lib/esm/storage/migrations/003-add-compact-table.js +20 -0
  35. package/lib/esm/storage/models/compact.d.ts +183 -0
  36. package/lib/esm/storage/models/compact.js +22 -0
  37. package/lib/esm/storage/models/entries.d.ts +19 -0
  38. package/lib/esm/storage/models/entries.js +1 -0
  39. package/lib/esm/storage/type.d.ts +18 -2
  40. package/package.json +4 -3
package/lib/esm/index.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import { v7 } from "@aigne/uuid";
2
+ import { createRouter } from "radix3";
2
3
  import { joinURL } from "ufo";
3
4
  import { SharedAFSStorage, } from "./storage/index.js";
4
5
  export * from "./storage/index.js";
@@ -9,34 +10,205 @@ export class AFSHistory {
9
10
  ? options.storage.withModule(this)
10
11
  : new SharedAFSStorage(options?.storage).withModule(this);
11
12
  }
12
- storage;
13
13
  name = "history";
14
+ storage;
15
+ afs;
16
+ router = createRouter({
17
+ routes: {
18
+ "/new": { type: "root", id: "new-history" },
19
+ "/by-session": { type: "root", id: "by-session" },
20
+ "/by-session/:sessionId": { type: "list", id: "by-session" },
21
+ "/by-session/:sessionId/@metadata/compact": { type: "compact-list", id: "by-session" },
22
+ "/by-session/:sessionId/@metadata/compact/new": { type: "compact-new", id: "by-session" },
23
+ "/by-session/:sessionId/@metadata/compact/:compactId": {
24
+ type: "compact-detail",
25
+ id: "by-session",
26
+ },
27
+ "/by-session/:sessionId/:entryId": { type: "detail", id: "by-session" },
28
+ "/by-user": { type: "root", id: "by-user" },
29
+ "/by-user/:userId": { type: "list", id: "by-user" },
30
+ "/by-user/:userId/@metadata/compact": { type: "compact-list", id: "by-user" },
31
+ "/by-user/:userId/@metadata/compact/new": { type: "compact-new", id: "by-user" },
32
+ "/by-user/:userId/@metadata/compact/:compactId": { type: "compact-detail", id: "by-user" },
33
+ "/by-user/:userId/:entryId": { type: "detail", id: "by-user" },
34
+ "/by-agent": { type: "root", id: "by-agent" },
35
+ "/by-agent/:agentId": { type: "list", id: "by-agent" },
36
+ "/by-agent/:agentId/@metadata/compact": { type: "compact-list", id: "by-agent" },
37
+ "/by-agent/:agentId/@metadata/compact/new": { type: "compact-new", id: "by-agent" },
38
+ "/by-agent/:agentId/@metadata/compact/:compactId": { type: "compact-detail", id: "by-agent" },
39
+ "/by-agent/:agentId/:entryId": { type: "detail", id: "by-agent" },
40
+ },
41
+ });
42
+ rootEntries = [
43
+ {
44
+ id: "new-history",
45
+ path: "/new",
46
+ description: "Write to this path to create a new history entry, generating a UUID-based path.",
47
+ },
48
+ {
49
+ id: "by-session",
50
+ path: "/by-session",
51
+ description: "Retrieve history entries by session ID.",
52
+ },
53
+ {
54
+ id: "by-user",
55
+ path: "/by-user",
56
+ description: "Retrieve history entries by user ID.",
57
+ },
58
+ {
59
+ id: "by-agent",
60
+ path: "/by-agent",
61
+ description: "Retrieve history entries by agent ID.",
62
+ },
63
+ ];
14
64
  onMount(afs) {
15
- afs.on("agentSucceed", ({ input, output }) => {
16
- this.storage
17
- .create({
18
- path: joinURL("/", v7()),
19
- content: { input, output },
20
- })
21
- .then((entry) => {
22
- afs.emit("historyCreated", { entry });
23
- })
24
- .catch((error) => {
25
- console.error("Failed to store history entry", error);
26
- });
27
- });
65
+ this.afs = afs;
28
66
  }
29
67
  async list(path, options) {
30
- if (path !== "/")
68
+ if (path === "/")
69
+ return { data: this.rootEntries };
70
+ // Parse virtual path and extract filter conditions
71
+ const match = this.router.lookup(path);
72
+ // If path doesn't match any virtual path pattern, return empty
73
+ if (!match) {
31
74
  return { data: [] };
32
- return await this.storage.list(options);
75
+ }
76
+ const rootEntry = this.rootEntries.find((entry) => entry.path === `/${match.id}`);
77
+ if (!rootEntry)
78
+ return { data: [] };
79
+ if (match.type === "root") {
80
+ return { data: [rootEntry] };
81
+ }
82
+ const matchId = match.id;
83
+ if (match.type === "list" &&
84
+ (matchId === "by-session" || matchId === "by-user" || matchId === "by-agent")) {
85
+ // Merge virtual path filter with explicit filter options
86
+ const mergedFilter = {
87
+ ...options?.filter,
88
+ ...match.params,
89
+ };
90
+ const result = await this.storage.list({
91
+ ...options,
92
+ filter: mergedFilter,
93
+ });
94
+ // Add virtual path prefix to each entry's path
95
+ return {
96
+ ...result,
97
+ data: result.data.map((entry) => ({
98
+ ...entry,
99
+ path: this.normalizePath(entry, matchId),
100
+ })),
101
+ };
102
+ }
103
+ if (match.type === "compact-list" &&
104
+ (matchId === "by-session" || matchId === "by-user" || matchId === "by-agent")) {
105
+ const compactType = this.getCompactType(matchId);
106
+ const mergedFilter = {
107
+ ...options?.filter,
108
+ ...match.params,
109
+ };
110
+ const result = await this.storage.listCompact(compactType, {
111
+ ...options,
112
+ filter: mergedFilter,
113
+ });
114
+ return { data: result.data };
115
+ }
116
+ return { data: [] };
33
117
  }
34
- async read(path) {
35
- const data = await this.storage.read(path);
36
- return { data };
118
+ async read(path, options) {
119
+ // Parse virtual path and extract filter conditions
120
+ const match = this.router.lookup(path);
121
+ if (!match)
122
+ return {};
123
+ const rootEntry = this.rootEntries.find((entry) => entry.path === `/${match.id}`);
124
+ if (!rootEntry)
125
+ return {};
126
+ if (match.type === "root") {
127
+ return { data: rootEntry };
128
+ }
129
+ if (match.type === "detail" &&
130
+ (match.id === "by-session" || match.id === "by-user" || match.id === "by-agent")) {
131
+ const entryId = match.params?.entryId;
132
+ if (!entryId)
133
+ throw new Error("Entry ID is required in the path to read detail.");
134
+ const data = await this.storage.read(entryId, {
135
+ filter: match.params,
136
+ });
137
+ return {
138
+ data: data && {
139
+ ...data,
140
+ path: this.normalizePath(data, match.id),
141
+ },
142
+ };
143
+ }
144
+ if (match.type === "compact-detail" &&
145
+ (match.id === "by-session" || match.id === "by-user" || match.id === "by-agent")) {
146
+ const compactId = match.params?.compactId;
147
+ if (!compactId)
148
+ throw new Error("Compact ID is required in the path to read compact detail.");
149
+ const compactType = this.getCompactType(match.id);
150
+ const mergedFilter = {
151
+ ...options?.filter,
152
+ ...match.params,
153
+ };
154
+ const data = await this.storage.readCompact(compactType, compactId, {
155
+ filter: mergedFilter,
156
+ });
157
+ return { data };
158
+ }
159
+ return {};
37
160
  }
38
161
  async write(path, content) {
39
- const data = await this.storage.create({ ...content, path });
40
- return { data };
162
+ const id = v7();
163
+ const match = this.router.lookup(path);
164
+ if (match?.type === "compact-new") {
165
+ const compactType = this.getCompactType(match.id);
166
+ const entry = await this.storage.createCompact(compactType, {
167
+ ...match.params,
168
+ ...content,
169
+ id,
170
+ path: joinURL("/", compactType, id),
171
+ });
172
+ return { data: entry };
173
+ }
174
+ if (match?.id !== "new-history") {
175
+ throw new Error("Can only write to /new or @metadata/compact/new paths.");
176
+ }
177
+ if (!content.sessionId)
178
+ throw new Error("sessionId is required to create a history entry.");
179
+ const entry = await this.storage.create({
180
+ ...content,
181
+ id,
182
+ path: joinURL("/", id),
183
+ });
184
+ this.afs?.emit("historyCreated", { entry });
185
+ return {
186
+ data: {
187
+ ...entry,
188
+ path: this.normalizePath(entry, "by-session"),
189
+ },
190
+ };
191
+ }
192
+ getCompactType(id) {
193
+ const mapping = {
194
+ "by-session": "session",
195
+ "by-user": "user",
196
+ "by-agent": "agent",
197
+ };
198
+ const type = mapping[id];
199
+ if (!type)
200
+ throw new Error(`Invalid compact type for id: ${id}`);
201
+ return type;
202
+ }
203
+ normalizePath(entry, type) {
204
+ const [prefix, scopeId] = {
205
+ "by-session": ["by-session", entry.sessionId],
206
+ "by-user": ["by-user", entry.userId],
207
+ "by-agent": ["by-agent", entry.agentId],
208
+ }[type] || [];
209
+ if (!prefix || !scopeId) {
210
+ throw new Error(`Cannot reset path for entry without ${type} info.`);
211
+ }
212
+ return joinURL("/", prefix, scopeId, entry.id);
41
213
  }
42
214
  }
@@ -1,7 +1,6 @@
1
1
  import type { AFSEntry, AFSModule } from "@aigne/afs";
2
2
  import { initDatabase } from "@aigne/sqlite";
3
- import { entriesTable } from "./models/entries.js";
4
- import type { AFSStorage, AFSStorageCreatePayload, AFSStorageListOptions } from "./type.js";
3
+ import type { AFSStorage, AFSStorageCreatePayload, AFSStorageListOptions, AFSStorageReadOptions, CompactType } from "./type.js";
5
4
  export * from "./type.js";
6
5
  export interface SharedAFSStorageOptions {
7
6
  url?: string;
@@ -17,11 +16,18 @@ export declare class SharedAFSStorage {
17
16
  }
18
17
  export declare class AFSStorageWithModule implements AFSStorage {
19
18
  private db;
20
- private table;
21
- constructor(db: ReturnType<typeof initDatabase>, table: Promise<ReturnType<typeof entriesTable>>);
19
+ private module;
20
+ constructor(db: ReturnType<typeof initDatabase>, module: AFSModule);
21
+ private _tables?;
22
+ private get tables();
22
23
  list(options?: AFSStorageListOptions): Promise<{
23
24
  data: AFSEntry[];
24
25
  }>;
25
- read(path: string): Promise<AFSEntry | undefined>;
26
+ read(id: string, options?: AFSStorageReadOptions): Promise<AFSEntry | undefined>;
26
27
  create(entry: AFSStorageCreatePayload): Promise<AFSEntry>;
28
+ createCompact(type: CompactType, entry: AFSStorageCreatePayload): Promise<AFSEntry>;
29
+ listCompact(type: CompactType, options?: AFSStorageListOptions): Promise<{
30
+ data: AFSEntry[];
31
+ }>;
32
+ readCompact(type: CompactType, id: string, options?: AFSStorageReadOptions): Promise<AFSEntry | undefined>;
27
33
  }
@@ -1,5 +1,6 @@
1
- import { and, asc, desc, eq, initDatabase, sql } from "@aigne/sqlite";
1
+ import { and, asc, desc, eq, gt, initDatabase, lt, sql } from "@aigne/sqlite";
2
2
  import { migrate } from "./migrate.js";
3
+ import { compactTable } from "./models/compact.js";
3
4
  import { entriesTable } from "./models/entries.js";
4
5
  export * from "./type.js";
5
6
  const DEFAULT_AFS_STORAGE_LIST_LIMIT = 10;
@@ -14,55 +15,103 @@ export class SharedAFSStorage {
14
15
  return this._db;
15
16
  }
16
17
  withModule(module) {
17
- return new AFSStorageWithModule(this.db, migrate(this.db, module).then(() => entriesTable(module)));
18
+ return new AFSStorageWithModule(this.db, module);
18
19
  }
19
20
  }
20
21
  export class AFSStorageWithModule {
21
22
  db;
22
- table;
23
- constructor(db, table) {
23
+ module;
24
+ constructor(db, module) {
24
25
  this.db = db;
25
- this.table = table;
26
+ this.module = module;
27
+ }
28
+ _tables;
29
+ get tables() {
30
+ if (!this._tables) {
31
+ this._tables = this.db.then((db) => migrate(db, this.module).then(() => ({
32
+ db,
33
+ entries: entriesTable(this.module),
34
+ compact: compactTable(this.module),
35
+ })));
36
+ }
37
+ return this._tables;
26
38
  }
27
39
  async list(options = {}) {
28
40
  const { filter, limit = DEFAULT_AFS_STORAGE_LIST_LIMIT } = options;
29
- const db = await this.db;
30
- const table = await this.table;
41
+ const { db, entries } = await this.tables;
31
42
  const data = await db
32
43
  .select()
33
- .from(table)
34
- .where(and(filter?.userId ? eq(table.userId, filter.userId) : undefined, filter?.sessionId ? eq(table.sessionId, filter.sessionId) : undefined))
44
+ .from(entries)
45
+ .where(and(filter?.agentId ? eq(entries.agentId, filter.agentId) : undefined, filter?.userId ? eq(entries.userId, filter.userId) : undefined, filter?.sessionId ? eq(entries.sessionId, filter.sessionId) : undefined, filter?.before ? lt(entries.createdAt, new Date(filter.before)) : undefined, filter?.after ? gt(entries.createdAt, new Date(filter.after)) : undefined))
35
46
  .orderBy(...(options.orderBy ?? []).map((item) => (item[1] === "asc" ? asc : desc)(sql.identifier(item[0]))))
36
47
  .limit(limit)
37
48
  .execute();
38
49
  return { data };
39
50
  }
40
- async read(path) {
41
- const db = await this.db;
42
- const table = await this.table;
51
+ async read(id, options) {
52
+ const { db, entries } = await this.tables;
43
53
  return db
44
54
  .select()
45
- .from(table)
46
- .where(eq(table.path, path))
55
+ .from(entries)
56
+ .where(and(eq(entries.id, id), options?.filter?.agentId ? eq(entries.agentId, options.filter.agentId) : undefined, options?.filter?.userId ? eq(entries.userId, options.filter.userId) : undefined, options?.filter?.sessionId ? eq(entries.sessionId, options.filter.sessionId) : undefined))
47
57
  .limit(1)
48
58
  .execute()
49
59
  .then((memory) => memory.at(0));
50
60
  }
51
61
  async create(entry) {
52
- const db = await this.db;
53
- const table = await this.table;
62
+ const { db, entries } = await this.tables;
54
63
  let result = await db
55
- .update(table)
64
+ .update(entries)
56
65
  .set(entry)
57
- .where(eq(table.path, entry.path))
66
+ .where(eq(entries.id, entry.id))
58
67
  .returning()
59
68
  .execute();
60
69
  if (!result.length) {
61
- result = await db.insert(table).values(entry).returning().execute();
70
+ result = await db.insert(entries).values(entry).returning().execute();
62
71
  }
63
72
  const [res] = result;
64
73
  if (!res)
65
74
  throw new Error("Failed to create AFS entry, no result");
66
75
  return res;
67
76
  }
77
+ async createCompact(type, entry) {
78
+ const { db, compact } = await this.tables;
79
+ const result = await db
80
+ .insert(compact)
81
+ .values({
82
+ ...entry,
83
+ metadata: {
84
+ ...entry.metadata,
85
+ type,
86
+ },
87
+ })
88
+ .returning()
89
+ .execute();
90
+ const [res] = result;
91
+ if (!res)
92
+ throw new Error(`Failed to create ${type} compact entry, no result`);
93
+ return res;
94
+ }
95
+ async listCompact(type, options = {}) {
96
+ const { db, compact } = await this.tables;
97
+ const { filter, limit = DEFAULT_AFS_STORAGE_LIST_LIMIT } = options;
98
+ const data = await db
99
+ .select()
100
+ .from(compact)
101
+ .where(and(eq(sql `json_extract(${compact.metadata}, '$.type')`, type), filter?.agentId ? eq(compact.agentId, filter.agentId) : undefined, filter?.userId ? eq(compact.userId, filter.userId) : undefined, filter?.sessionId ? eq(compact.sessionId, filter.sessionId) : undefined, filter?.before ? lt(compact.createdAt, new Date(filter.before)) : undefined, filter?.after ? gt(compact.createdAt, new Date(filter.after)) : undefined))
102
+ .orderBy(...(options.orderBy ?? []).map((item) => (item[1] === "asc" ? asc : desc)(sql.identifier(item[0]))))
103
+ .limit(limit)
104
+ .execute();
105
+ return { data };
106
+ }
107
+ async readCompact(type, id, options) {
108
+ const { db, compact } = await this.tables;
109
+ return db
110
+ .select()
111
+ .from(compact)
112
+ .where(and(eq(sql `json_extract(${compact.metadata}, '$.type')`, type), eq(compact.id, id), options?.filter?.agentId ? eq(compact.agentId, options.filter.agentId) : undefined, options?.filter?.userId ? eq(compact.userId, options.filter.userId) : undefined, options?.filter?.sessionId ? eq(compact.sessionId, options.filter.sessionId) : undefined))
113
+ .limit(1)
114
+ .execute()
115
+ .then((rows) => rows.at(0));
116
+ }
68
117
  }
@@ -1,3 +1,3 @@
1
1
  import type { AFSModule } from "@aigne/afs";
2
2
  import { type initDatabase } from "@aigne/sqlite";
3
- export declare function migrate(db: ReturnType<typeof initDatabase>, module: AFSModule): Promise<void>;
3
+ export declare function migrate(db: Awaited<ReturnType<typeof initDatabase>>, module: AFSModule): Promise<void>;
@@ -1,8 +1,10 @@
1
1
  import { sql } from "@aigne/sqlite";
2
2
  import { v7 } from "@aigne/uuid";
3
3
  import { init } from "./migrations/001-init.js";
4
+ import { addAgentId } from "./migrations/002-add-agent-id.js";
5
+ import { addCompactTable } from "./migrations/003-add-compact-table.js";
4
6
  export async function migrate(db, module) {
5
- const migrations = [init];
7
+ const migrations = [init, addAgentId, addCompactTable];
6
8
  const migrationsTable = "__drizzle_migrations";
7
9
  const migrationTableCreate = sql `
8
10
  CREATE TABLE IF NOT EXISTS ${sql.identifier(migrationsTable)} (
@@ -11,18 +13,18 @@ export async function migrate(db, module) {
11
13
  "hash" TEXT NOT NULL
12
14
  )
13
15
  `;
14
- await (await db).run(migrationTableCreate).execute();
15
- const dbMigrations = await (await db)
16
+ await db.run(migrationTableCreate).execute();
17
+ const dbMigrations = await db
16
18
  .values(sql `SELECT "id", "moduleId", "hash" FROM ${sql.identifier(migrationsTable)} WHERE "moduleId" = ${sql.param(module.name)} ORDER BY id DESC LIMIT 1`)
17
19
  .execute();
18
20
  const lastDbMigration = dbMigrations[0];
19
21
  const queriesToRun = [];
20
22
  for (const migration of migrations) {
21
- if (!lastDbMigration || lastDbMigration[1] < migration.hash) {
23
+ if (!lastDbMigration || lastDbMigration[2] < migration.hash) {
22
24
  queriesToRun.push(...migration.sql(module), sql `INSERT INTO ${sql.identifier(migrationsTable)} ("id", "moduleId", "hash") VALUES(${sql.param(v7())}, ${sql.param(module.name)}, ${sql.param(migration.hash)})`);
23
25
  }
24
26
  }
25
27
  for (const query of queriesToRun) {
26
- await (await db).run(query).execute();
28
+ await db.run(query).execute();
27
29
  }
28
30
  }
@@ -0,0 +1,2 @@
1
+ import type { AFSStorageMigrations } from "../type.js";
2
+ export declare const addAgentId: AFSStorageMigrations;
@@ -0,0 +1,10 @@
1
+ import { sql } from "@aigne/sqlite";
2
+ import { entriesTableName } from "../models/entries.js";
3
+ export const addAgentId = {
4
+ hash: "002-add-agent-id",
5
+ sql: (module) => [
6
+ sql `\
7
+ ALTER TABLE ${sql.identifier(entriesTableName(module))} ADD COLUMN "agentId" TEXT;
8
+ `,
9
+ ],
10
+ };
@@ -0,0 +1,2 @@
1
+ import type { AFSStorageMigrations } from "../type.js";
2
+ export declare const addCompactTable: AFSStorageMigrations;
@@ -0,0 +1,20 @@
1
+ import { sql } from "@aigne/sqlite";
2
+ import { compactTableName } from "../models/compact.js";
3
+ export const addCompactTable = {
4
+ hash: "003-add-compact-table",
5
+ sql: (module) => [
6
+ sql `\
7
+ CREATE TABLE IF NOT EXISTS ${sql.identifier(compactTableName(module))} (
8
+ "id" TEXT NOT NULL PRIMARY KEY,
9
+ "createdAt" DATETIME NOT NULL,
10
+ "updatedAt" DATETIME NOT NULL,
11
+ "path" TEXT NOT NULL,
12
+ "sessionId" TEXT,
13
+ "userId" TEXT,
14
+ "agentId" TEXT,
15
+ "metadata" JSON,
16
+ "content" JSON
17
+ )
18
+ `,
19
+ ],
20
+ };
@@ -0,0 +1,183 @@
1
+ import type { AFSModule } from "@aigne/afs";
2
+ export declare const compactTableName: (module: AFSModule) => string;
3
+ export declare const compactTable: (module: AFSModule) => import("@aigne/sqlite").SQLiteTableWithColumns<{
4
+ name: string;
5
+ schema: undefined;
6
+ columns: {
7
+ id: import("@aigne/sqlite").SQLiteColumn<{
8
+ name: "id";
9
+ tableName: string;
10
+ dataType: "string";
11
+ columnType: "SQLiteText";
12
+ data: string;
13
+ driverParam: string;
14
+ notNull: true;
15
+ hasDefault: true;
16
+ isPrimaryKey: true;
17
+ isAutoincrement: false;
18
+ hasRuntimeDefault: true;
19
+ enumValues: [string, ...string[]];
20
+ baseColumn: never;
21
+ identity: undefined;
22
+ generated: undefined;
23
+ }, {}, {
24
+ length: number | undefined;
25
+ }>;
26
+ createdAt: import("@aigne/sqlite").SQLiteColumn<{
27
+ name: "createdAt";
28
+ tableName: string;
29
+ dataType: "custom";
30
+ columnType: "SQLiteCustomColumn";
31
+ data: Date;
32
+ driverParam: string;
33
+ notNull: true;
34
+ hasDefault: true;
35
+ isPrimaryKey: false;
36
+ isAutoincrement: false;
37
+ hasRuntimeDefault: true;
38
+ enumValues: undefined;
39
+ baseColumn: never;
40
+ identity: undefined;
41
+ generated: undefined;
42
+ }, {}, {
43
+ sqliteColumnBuilderBrand: "SQLiteCustomColumnBuilderBrand";
44
+ }>;
45
+ updatedAt: import("@aigne/sqlite").SQLiteColumn<{
46
+ name: "updatedAt";
47
+ tableName: string;
48
+ dataType: "custom";
49
+ columnType: "SQLiteCustomColumn";
50
+ data: Date;
51
+ driverParam: string;
52
+ notNull: true;
53
+ hasDefault: true;
54
+ isPrimaryKey: false;
55
+ isAutoincrement: false;
56
+ hasRuntimeDefault: true;
57
+ enumValues: undefined;
58
+ baseColumn: never;
59
+ identity: undefined;
60
+ generated: undefined;
61
+ }, {}, {
62
+ sqliteColumnBuilderBrand: "SQLiteCustomColumnBuilderBrand";
63
+ }>;
64
+ path: import("@aigne/sqlite").SQLiteColumn<{
65
+ name: "path";
66
+ tableName: string;
67
+ dataType: "string";
68
+ columnType: "SQLiteText";
69
+ data: string;
70
+ driverParam: string;
71
+ notNull: true;
72
+ hasDefault: false;
73
+ isPrimaryKey: false;
74
+ isAutoincrement: false;
75
+ hasRuntimeDefault: false;
76
+ enumValues: [string, ...string[]];
77
+ baseColumn: never;
78
+ identity: undefined;
79
+ generated: undefined;
80
+ }, {}, {
81
+ length: number | undefined;
82
+ }>;
83
+ userId: import("@aigne/sqlite").SQLiteColumn<{
84
+ name: "userId";
85
+ tableName: string;
86
+ dataType: "string";
87
+ columnType: "SQLiteText";
88
+ data: string;
89
+ driverParam: string;
90
+ notNull: false;
91
+ hasDefault: false;
92
+ isPrimaryKey: false;
93
+ isAutoincrement: false;
94
+ hasRuntimeDefault: false;
95
+ enumValues: [string, ...string[]];
96
+ baseColumn: never;
97
+ identity: undefined;
98
+ generated: undefined;
99
+ }, {}, {
100
+ length: number | undefined;
101
+ }>;
102
+ sessionId: import("@aigne/sqlite").SQLiteColumn<{
103
+ name: "sessionId";
104
+ tableName: string;
105
+ dataType: "string";
106
+ columnType: "SQLiteText";
107
+ data: string;
108
+ driverParam: string;
109
+ notNull: false;
110
+ hasDefault: false;
111
+ isPrimaryKey: false;
112
+ isAutoincrement: false;
113
+ hasRuntimeDefault: false;
114
+ enumValues: [string, ...string[]];
115
+ baseColumn: never;
116
+ identity: undefined;
117
+ generated: undefined;
118
+ }, {}, {
119
+ length: number | undefined;
120
+ }>;
121
+ agentId: import("@aigne/sqlite").SQLiteColumn<{
122
+ name: "agentId";
123
+ tableName: string;
124
+ dataType: "string";
125
+ columnType: "SQLiteText";
126
+ data: string;
127
+ driverParam: string;
128
+ notNull: false;
129
+ hasDefault: false;
130
+ isPrimaryKey: false;
131
+ isAutoincrement: false;
132
+ hasRuntimeDefault: false;
133
+ enumValues: [string, ...string[]];
134
+ baseColumn: never;
135
+ identity: undefined;
136
+ generated: undefined;
137
+ }, {}, {
138
+ length: number | undefined;
139
+ }>;
140
+ metadata: import("@aigne/sqlite").SQLiteColumn<{
141
+ name: string;
142
+ tableName: string;
143
+ dataType: "custom";
144
+ columnType: "SQLiteCustomColumn";
145
+ data: {
146
+ type?: string;
147
+ latestEntryId?: string;
148
+ } & Record<string, unknown>;
149
+ driverParam: string;
150
+ notNull: false;
151
+ hasDefault: false;
152
+ isPrimaryKey: false;
153
+ isAutoincrement: false;
154
+ hasRuntimeDefault: false;
155
+ enumValues: undefined;
156
+ baseColumn: never;
157
+ identity: undefined;
158
+ generated: undefined;
159
+ }, {}, {
160
+ sqliteColumnBuilderBrand: "SQLiteCustomColumnBuilderBrand";
161
+ }>;
162
+ content: import("@aigne/sqlite").SQLiteColumn<{
163
+ name: string;
164
+ tableName: string;
165
+ dataType: "custom";
166
+ columnType: "SQLiteCustomColumn";
167
+ data: unknown;
168
+ driverParam: string;
169
+ notNull: false;
170
+ hasDefault: false;
171
+ isPrimaryKey: false;
172
+ isAutoincrement: false;
173
+ hasRuntimeDefault: false;
174
+ enumValues: undefined;
175
+ baseColumn: never;
176
+ identity: undefined;
177
+ generated: undefined;
178
+ }, {}, {
179
+ sqliteColumnBuilderBrand: "SQLiteCustomColumnBuilderBrand";
180
+ }>;
181
+ };
182
+ dialect: "sqlite";
183
+ }>;