@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.
@@ -1,5 +1,5 @@
1
1
 
2
- > @axiom-lattice/pg-stores@1.0.4 build /home/runner/work/agentic/agentic/packages/pg-stores
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
  CLI Building entry: src/index.ts
@@ -8,13 +8,13 @@
8
8
  CLI Target: es2020
9
9
  CJS Build start
10
10
  ESM Build start
11
- CJS dist/index.js 34.68 KB
12
- CJS dist/index.js.map 61.72 KB
13
- CJS ⚡️ Build success in 199ms
14
- ESM dist/index.mjs 33.20 KB
15
- ESM dist/index.mjs.map 60.64 KB
16
- ESM ⚡️ Build success in 200ms
11
+ ESM dist/index.mjs 43.66 KB
12
+ ESM dist/index.mjs.map 81.24 KB
13
+ ESM ⚡️ Build success in 183ms
14
+ CJS dist/index.js 45.25 KB
15
+ CJS dist/index.js.map 82.54 KB
16
+ CJS ⚡️ Build success in 186ms
17
17
  DTS Build start
18
- DTS ⚡️ Build success in 6520ms
19
- DTS dist/index.d.ts 8.83 KB
20
- DTS dist/index.d.mts 8.83 KB
18
+ DTS ⚡️ Build success in 7742ms
19
+ DTS dist/index.d.ts 11.40 KB
20
+ DTS dist/index.d.mts 11.40 KB
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
- export { type Migration, MigrationManager, PostgreSQLAssistantStore, type PostgreSQLAssistantStoreOptions, PostgreSQLScheduleStorage, type PostgreSQLScheduleStorageOptions, PostgreSQLThreadStore, type PostgreSQLThreadStoreOptions, createAssistantsTable, createScheduledTasksTable, createThreadsTable };
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
- export { type Migration, MigrationManager, PostgreSQLAssistantStore, type PostgreSQLAssistantStoreOptions, PostgreSQLScheduleStorage, type PostgreSQLScheduleStorageOptions, PostgreSQLThreadStore, type PostgreSQLThreadStoreOptions, createAssistantsTable, createScheduledTasksTable, createThreadsTable };
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 };