@axiom-lattice/pg-stores 1.0.4 → 1.0.6
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/.turbo/turbo-build.log +10 -10
- package/CHANGELOG.md +18 -0
- package/dist/index.d.mts +102 -3
- package/dist/index.d.ts +102 -3
- package/dist/index.js +387 -25
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +385 -25
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
- package/src/index.ts +6 -0
- package/src/migrations/migration.ts +45 -28
- package/src/migrations/skill_migrations.ts +65 -0
- package/src/stores/PostgreSQLSkillStore.ts +455 -0
- package/src/stores/PostgreSQLThreadStore.ts +20 -2
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @axiom-lattice/pg-stores@1.0.
|
|
2
|
+
> @axiom-lattice/pg-stores@1.0.6 build /home/runner/work/agentic/agentic/packages/pg-stores
|
|
3
3
|
> tsup src/index.ts --format cjs,esm --dts --sourcemap
|
|
4
4
|
|
|
5
5
|
[34mCLI[39m Building entry: src/index.ts
|
|
@@ -8,13 +8,13 @@
|
|
|
8
8
|
[34mCLI[39m Target: es2020
|
|
9
9
|
[34mCJS[39m Build start
|
|
10
10
|
[34mESM[39m Build start
|
|
11
|
-
[
|
|
12
|
-
[
|
|
13
|
-
[
|
|
14
|
-
[
|
|
15
|
-
[
|
|
16
|
-
[
|
|
11
|
+
[32mESM[39m [1mdist/index.mjs [22m[32m43.66 KB[39m
|
|
12
|
+
[32mESM[39m [1mdist/index.mjs.map [22m[32m81.24 KB[39m
|
|
13
|
+
[32mESM[39m ⚡️ Build success in 183ms
|
|
14
|
+
[32mCJS[39m [1mdist/index.js [22m[32m45.25 KB[39m
|
|
15
|
+
[32mCJS[39m [1mdist/index.js.map [22m[32m82.54 KB[39m
|
|
16
|
+
[32mCJS[39m ⚡️ Build success in 186ms
|
|
17
17
|
[34mDTS[39m Build start
|
|
18
|
-
[32mDTS[39m ⚡️ Build success in
|
|
19
|
-
[32mDTS[39m [1mdist/index.d.ts [22m[
|
|
20
|
-
[32mDTS[39m [1mdist/index.d.mts [22m[
|
|
18
|
+
[32mDTS[39m ⚡️ Build success in 7742ms
|
|
19
|
+
[32mDTS[39m [1mdist/index.d.ts [22m[32m11.40 KB[39m
|
|
20
|
+
[32mDTS[39m [1mdist/index.d.mts [22m[32m11.40 KB[39m
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @axiom-lattice/pg-stores
|
|
2
2
|
|
|
3
|
+
## 1.0.6
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 2422cbf: add sandbox and mcp
|
|
8
|
+
- Updated dependencies [2422cbf]
|
|
9
|
+
- @axiom-lattice/protocols@2.1.11
|
|
10
|
+
- @axiom-lattice/core@2.1.17
|
|
11
|
+
|
|
12
|
+
## 1.0.5
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- 773c03f: add skills
|
|
17
|
+
- Updated dependencies [773c03f]
|
|
18
|
+
- @axiom-lattice/protocols@2.1.10
|
|
19
|
+
- @axiom-lattice/core@2.1.16
|
|
20
|
+
|
|
3
21
|
## 1.0.4
|
|
4
22
|
|
|
5
23
|
### Patch Changes
|
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { PoolConfig, PoolClient, Pool } from 'pg';
|
|
2
|
-
import { ThreadStore, Thread, CreateThreadRequest, AssistantStore, Assistant, CreateAssistantRequest, ScheduleStorage, ScheduledTaskDefinition, ScheduledTaskStatus, ScheduleExecutionType } from '@axiom-lattice/protocols';
|
|
3
|
-
export { Assistant, AssistantStore, CreateAssistantRequest, CreateThreadRequest, ScheduleExecutionType, ScheduleStorage, ScheduledTaskDefinition, ScheduledTaskStatus, Thread, ThreadStore } from '@axiom-lattice/protocols';
|
|
2
|
+
import { ThreadStore, Thread, CreateThreadRequest, AssistantStore, Assistant, CreateAssistantRequest, ScheduleStorage, ScheduledTaskDefinition, ScheduledTaskStatus, ScheduleExecutionType, SkillStore, Skill, CreateSkillRequest } from '@axiom-lattice/protocols';
|
|
3
|
+
export { Assistant, AssistantStore, CreateAssistantRequest, CreateSkillRequest, CreateThreadRequest, ScheduleExecutionType, ScheduleStorage, ScheduledTaskDefinition, ScheduledTaskStatus, Skill, SkillStore, Thread, ThreadStore } from '@axiom-lattice/protocols';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* PostgreSQL implementation of ThreadStore
|
|
@@ -29,6 +29,7 @@ declare class PostgreSQLThreadStore implements ThreadStore {
|
|
|
29
29
|
private migrationManager;
|
|
30
30
|
private initialized;
|
|
31
31
|
private ownsPool;
|
|
32
|
+
private initPromise;
|
|
32
33
|
constructor(options: PostgreSQLThreadStoreOptions);
|
|
33
34
|
/**
|
|
34
35
|
* Dispose resources and close the connection pool
|
|
@@ -37,6 +38,7 @@ declare class PostgreSQLThreadStore implements ThreadStore {
|
|
|
37
38
|
dispose(): Promise<void>;
|
|
38
39
|
/**
|
|
39
40
|
* Initialize the store and run migrations
|
|
41
|
+
* Uses a promise-based lock to prevent concurrent initialization
|
|
40
42
|
*/
|
|
41
43
|
initialize(): Promise<void>;
|
|
42
44
|
/**
|
|
@@ -258,6 +260,93 @@ declare class PostgreSQLScheduleStorage implements ScheduleStorage {
|
|
|
258
260
|
private mapRowToTask;
|
|
259
261
|
}
|
|
260
262
|
|
|
263
|
+
/**
|
|
264
|
+
* PostgreSQL implementation of SkillStore
|
|
265
|
+
*/
|
|
266
|
+
|
|
267
|
+
/**
|
|
268
|
+
* PostgreSQL SkillStore options
|
|
269
|
+
*/
|
|
270
|
+
interface PostgreSQLSkillStoreOptions {
|
|
271
|
+
/**
|
|
272
|
+
* PostgreSQL connection pool configuration
|
|
273
|
+
* Can be a connection string or PoolConfig object
|
|
274
|
+
*/
|
|
275
|
+
poolConfig: string | PoolConfig;
|
|
276
|
+
/**
|
|
277
|
+
* Whether to run migrations automatically on initialization
|
|
278
|
+
* @default true
|
|
279
|
+
*/
|
|
280
|
+
autoMigrate?: boolean;
|
|
281
|
+
}
|
|
282
|
+
/**
|
|
283
|
+
* PostgreSQL implementation of SkillStore
|
|
284
|
+
*/
|
|
285
|
+
declare class PostgreSQLSkillStore implements SkillStore {
|
|
286
|
+
private pool;
|
|
287
|
+
private migrationManager;
|
|
288
|
+
private initialized;
|
|
289
|
+
private ownsPool;
|
|
290
|
+
constructor(options: PostgreSQLSkillStoreOptions);
|
|
291
|
+
/**
|
|
292
|
+
* Dispose resources and close the connection pool
|
|
293
|
+
* Should be called when the store is no longer needed
|
|
294
|
+
*/
|
|
295
|
+
dispose(): Promise<void>;
|
|
296
|
+
/**
|
|
297
|
+
* Initialize the store and run migrations
|
|
298
|
+
*/
|
|
299
|
+
initialize(): Promise<void>;
|
|
300
|
+
/**
|
|
301
|
+
* Ensure store is initialized
|
|
302
|
+
*/
|
|
303
|
+
private ensureInitialized;
|
|
304
|
+
/**
|
|
305
|
+
* Map database row to Skill object
|
|
306
|
+
*/
|
|
307
|
+
private mapRowToSkill;
|
|
308
|
+
/**
|
|
309
|
+
* Get all skills
|
|
310
|
+
*/
|
|
311
|
+
getAllSkills(): Promise<Skill[]>;
|
|
312
|
+
/**
|
|
313
|
+
* Get skill by ID
|
|
314
|
+
*/
|
|
315
|
+
getSkillById(id: string): Promise<Skill | null>;
|
|
316
|
+
/**
|
|
317
|
+
* Create a new skill
|
|
318
|
+
*/
|
|
319
|
+
createSkill(id: string, data: CreateSkillRequest): Promise<Skill>;
|
|
320
|
+
/**
|
|
321
|
+
* Update an existing skill
|
|
322
|
+
*/
|
|
323
|
+
updateSkill(id: string, updates: Partial<CreateSkillRequest>): Promise<Skill | null>;
|
|
324
|
+
/**
|
|
325
|
+
* Delete a skill by ID
|
|
326
|
+
*/
|
|
327
|
+
deleteSkill(id: string): Promise<boolean>;
|
|
328
|
+
/**
|
|
329
|
+
* Check if skill exists
|
|
330
|
+
*/
|
|
331
|
+
hasSkill(id: string): Promise<boolean>;
|
|
332
|
+
/**
|
|
333
|
+
* Search skills by metadata
|
|
334
|
+
*/
|
|
335
|
+
searchByMetadata(metadataKey: string, metadataValue: string): Promise<Skill[]>;
|
|
336
|
+
/**
|
|
337
|
+
* Filter skills by compatibility
|
|
338
|
+
*/
|
|
339
|
+
filterByCompatibility(compatibility: string): Promise<Skill[]>;
|
|
340
|
+
/**
|
|
341
|
+
* Filter skills by license
|
|
342
|
+
*/
|
|
343
|
+
filterByLicense(license: string): Promise<Skill[]>;
|
|
344
|
+
/**
|
|
345
|
+
* Get sub-skills of a parent skill
|
|
346
|
+
*/
|
|
347
|
+
getSubSkills(parentSkillName: string): Promise<Skill[]>;
|
|
348
|
+
}
|
|
349
|
+
|
|
261
350
|
/**
|
|
262
351
|
* Migration system for database schema management
|
|
263
352
|
*/
|
|
@@ -292,6 +381,7 @@ declare class MigrationManager {
|
|
|
292
381
|
private getAppliedMigrations;
|
|
293
382
|
/**
|
|
294
383
|
* Apply pending migrations
|
|
384
|
+
* Uses PostgreSQL advisory locks to prevent concurrent migrations
|
|
295
385
|
*/
|
|
296
386
|
migrate(): Promise<void>;
|
|
297
387
|
/**
|
|
@@ -331,4 +421,13 @@ declare const createAssistantsTable: Migration;
|
|
|
331
421
|
*/
|
|
332
422
|
declare const createScheduledTasksTable: Migration;
|
|
333
423
|
|
|
334
|
-
|
|
424
|
+
/**
|
|
425
|
+
* Skill table migrations
|
|
426
|
+
*/
|
|
427
|
+
|
|
428
|
+
/**
|
|
429
|
+
* Initial migration: Create skills table
|
|
430
|
+
*/
|
|
431
|
+
declare const createSkillsTable: Migration;
|
|
432
|
+
|
|
433
|
+
export { type Migration, MigrationManager, PostgreSQLAssistantStore, type PostgreSQLAssistantStoreOptions, PostgreSQLScheduleStorage, type PostgreSQLScheduleStorageOptions, PostgreSQLSkillStore, type PostgreSQLSkillStoreOptions, PostgreSQLThreadStore, type PostgreSQLThreadStoreOptions, createAssistantsTable, createScheduledTasksTable, createSkillsTable, createThreadsTable };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { PoolConfig, PoolClient, Pool } from 'pg';
|
|
2
|
-
import { ThreadStore, Thread, CreateThreadRequest, AssistantStore, Assistant, CreateAssistantRequest, ScheduleStorage, ScheduledTaskDefinition, ScheduledTaskStatus, ScheduleExecutionType } from '@axiom-lattice/protocols';
|
|
3
|
-
export { Assistant, AssistantStore, CreateAssistantRequest, CreateThreadRequest, ScheduleExecutionType, ScheduleStorage, ScheduledTaskDefinition, ScheduledTaskStatus, Thread, ThreadStore } from '@axiom-lattice/protocols';
|
|
2
|
+
import { ThreadStore, Thread, CreateThreadRequest, AssistantStore, Assistant, CreateAssistantRequest, ScheduleStorage, ScheduledTaskDefinition, ScheduledTaskStatus, ScheduleExecutionType, SkillStore, Skill, CreateSkillRequest } from '@axiom-lattice/protocols';
|
|
3
|
+
export { Assistant, AssistantStore, CreateAssistantRequest, CreateSkillRequest, CreateThreadRequest, ScheduleExecutionType, ScheduleStorage, ScheduledTaskDefinition, ScheduledTaskStatus, Skill, SkillStore, Thread, ThreadStore } from '@axiom-lattice/protocols';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* PostgreSQL implementation of ThreadStore
|
|
@@ -29,6 +29,7 @@ declare class PostgreSQLThreadStore implements ThreadStore {
|
|
|
29
29
|
private migrationManager;
|
|
30
30
|
private initialized;
|
|
31
31
|
private ownsPool;
|
|
32
|
+
private initPromise;
|
|
32
33
|
constructor(options: PostgreSQLThreadStoreOptions);
|
|
33
34
|
/**
|
|
34
35
|
* Dispose resources and close the connection pool
|
|
@@ -37,6 +38,7 @@ declare class PostgreSQLThreadStore implements ThreadStore {
|
|
|
37
38
|
dispose(): Promise<void>;
|
|
38
39
|
/**
|
|
39
40
|
* Initialize the store and run migrations
|
|
41
|
+
* Uses a promise-based lock to prevent concurrent initialization
|
|
40
42
|
*/
|
|
41
43
|
initialize(): Promise<void>;
|
|
42
44
|
/**
|
|
@@ -258,6 +260,93 @@ declare class PostgreSQLScheduleStorage implements ScheduleStorage {
|
|
|
258
260
|
private mapRowToTask;
|
|
259
261
|
}
|
|
260
262
|
|
|
263
|
+
/**
|
|
264
|
+
* PostgreSQL implementation of SkillStore
|
|
265
|
+
*/
|
|
266
|
+
|
|
267
|
+
/**
|
|
268
|
+
* PostgreSQL SkillStore options
|
|
269
|
+
*/
|
|
270
|
+
interface PostgreSQLSkillStoreOptions {
|
|
271
|
+
/**
|
|
272
|
+
* PostgreSQL connection pool configuration
|
|
273
|
+
* Can be a connection string or PoolConfig object
|
|
274
|
+
*/
|
|
275
|
+
poolConfig: string | PoolConfig;
|
|
276
|
+
/**
|
|
277
|
+
* Whether to run migrations automatically on initialization
|
|
278
|
+
* @default true
|
|
279
|
+
*/
|
|
280
|
+
autoMigrate?: boolean;
|
|
281
|
+
}
|
|
282
|
+
/**
|
|
283
|
+
* PostgreSQL implementation of SkillStore
|
|
284
|
+
*/
|
|
285
|
+
declare class PostgreSQLSkillStore implements SkillStore {
|
|
286
|
+
private pool;
|
|
287
|
+
private migrationManager;
|
|
288
|
+
private initialized;
|
|
289
|
+
private ownsPool;
|
|
290
|
+
constructor(options: PostgreSQLSkillStoreOptions);
|
|
291
|
+
/**
|
|
292
|
+
* Dispose resources and close the connection pool
|
|
293
|
+
* Should be called when the store is no longer needed
|
|
294
|
+
*/
|
|
295
|
+
dispose(): Promise<void>;
|
|
296
|
+
/**
|
|
297
|
+
* Initialize the store and run migrations
|
|
298
|
+
*/
|
|
299
|
+
initialize(): Promise<void>;
|
|
300
|
+
/**
|
|
301
|
+
* Ensure store is initialized
|
|
302
|
+
*/
|
|
303
|
+
private ensureInitialized;
|
|
304
|
+
/**
|
|
305
|
+
* Map database row to Skill object
|
|
306
|
+
*/
|
|
307
|
+
private mapRowToSkill;
|
|
308
|
+
/**
|
|
309
|
+
* Get all skills
|
|
310
|
+
*/
|
|
311
|
+
getAllSkills(): Promise<Skill[]>;
|
|
312
|
+
/**
|
|
313
|
+
* Get skill by ID
|
|
314
|
+
*/
|
|
315
|
+
getSkillById(id: string): Promise<Skill | null>;
|
|
316
|
+
/**
|
|
317
|
+
* Create a new skill
|
|
318
|
+
*/
|
|
319
|
+
createSkill(id: string, data: CreateSkillRequest): Promise<Skill>;
|
|
320
|
+
/**
|
|
321
|
+
* Update an existing skill
|
|
322
|
+
*/
|
|
323
|
+
updateSkill(id: string, updates: Partial<CreateSkillRequest>): Promise<Skill | null>;
|
|
324
|
+
/**
|
|
325
|
+
* Delete a skill by ID
|
|
326
|
+
*/
|
|
327
|
+
deleteSkill(id: string): Promise<boolean>;
|
|
328
|
+
/**
|
|
329
|
+
* Check if skill exists
|
|
330
|
+
*/
|
|
331
|
+
hasSkill(id: string): Promise<boolean>;
|
|
332
|
+
/**
|
|
333
|
+
* Search skills by metadata
|
|
334
|
+
*/
|
|
335
|
+
searchByMetadata(metadataKey: string, metadataValue: string): Promise<Skill[]>;
|
|
336
|
+
/**
|
|
337
|
+
* Filter skills by compatibility
|
|
338
|
+
*/
|
|
339
|
+
filterByCompatibility(compatibility: string): Promise<Skill[]>;
|
|
340
|
+
/**
|
|
341
|
+
* Filter skills by license
|
|
342
|
+
*/
|
|
343
|
+
filterByLicense(license: string): Promise<Skill[]>;
|
|
344
|
+
/**
|
|
345
|
+
* Get sub-skills of a parent skill
|
|
346
|
+
*/
|
|
347
|
+
getSubSkills(parentSkillName: string): Promise<Skill[]>;
|
|
348
|
+
}
|
|
349
|
+
|
|
261
350
|
/**
|
|
262
351
|
* Migration system for database schema management
|
|
263
352
|
*/
|
|
@@ -292,6 +381,7 @@ declare class MigrationManager {
|
|
|
292
381
|
private getAppliedMigrations;
|
|
293
382
|
/**
|
|
294
383
|
* Apply pending migrations
|
|
384
|
+
* Uses PostgreSQL advisory locks to prevent concurrent migrations
|
|
295
385
|
*/
|
|
296
386
|
migrate(): Promise<void>;
|
|
297
387
|
/**
|
|
@@ -331,4 +421,13 @@ declare const createAssistantsTable: Migration;
|
|
|
331
421
|
*/
|
|
332
422
|
declare const createScheduledTasksTable: Migration;
|
|
333
423
|
|
|
334
|
-
|
|
424
|
+
/**
|
|
425
|
+
* Skill table migrations
|
|
426
|
+
*/
|
|
427
|
+
|
|
428
|
+
/**
|
|
429
|
+
* Initial migration: Create skills table
|
|
430
|
+
*/
|
|
431
|
+
declare const createSkillsTable: Migration;
|
|
432
|
+
|
|
433
|
+
export { type Migration, MigrationManager, PostgreSQLAssistantStore, type PostgreSQLAssistantStoreOptions, PostgreSQLScheduleStorage, type PostgreSQLScheduleStorageOptions, PostgreSQLSkillStore, type PostgreSQLSkillStoreOptions, PostgreSQLThreadStore, type PostgreSQLThreadStoreOptions, createAssistantsTable, createScheduledTasksTable, createSkillsTable, createThreadsTable };
|