@axiom-lattice/pg-stores 1.0.83 → 1.0.84

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 (34) hide show
  1. package/.turbo/turbo-build.log +10 -10
  2. package/CHANGELOG.md +9 -0
  3. package/dist/index.d.mts +124 -44
  4. package/dist/index.d.ts +124 -44
  5. package/dist/index.js +472 -162
  6. package/dist/index.js.map +1 -1
  7. package/dist/index.mjs +472 -162
  8. package/dist/index.mjs.map +1 -1
  9. package/package.json +3 -3
  10. package/scripts/check-migration-versions.mjs +42 -9
  11. package/src/createPgStoreConfig.ts +97 -3
  12. package/src/migrations/migration.ts +91 -60
  13. package/src/stores/ChannelBindingStore.ts +21 -3
  14. package/src/stores/ChannelIdentityMappingStore.ts +21 -3
  15. package/src/stores/MenuStore.ts +21 -3
  16. package/src/stores/PostgreSQLA2AApiKeyStore.ts +21 -3
  17. package/src/stores/PostgreSQLAssistantStore.ts +19 -3
  18. package/src/stores/PostgreSQLChannelInstallationStore.ts +21 -3
  19. package/src/stores/PostgreSQLDatabaseConfigStore.ts +23 -4
  20. package/src/stores/PostgreSQLEvalStore.ts +15 -3
  21. package/src/stores/PostgreSQLMcpServerConfigStore.ts +23 -4
  22. package/src/stores/PostgreSQLMetricsServerConfigStore.ts +23 -4
  23. package/src/stores/PostgreSQLProjectStore.ts +19 -3
  24. package/src/stores/PostgreSQLScheduleStorage.ts +21 -4
  25. package/src/stores/PostgreSQLSkillStore.ts +14 -3
  26. package/src/stores/PostgreSQLTaskStore.ts +14 -3
  27. package/src/stores/PostgreSQLTenantStore.ts +19 -3
  28. package/src/stores/PostgreSQLThreadStore.ts +19 -3
  29. package/src/stores/PostgreSQLUserStore.ts +18 -4
  30. package/src/stores/PostgreSQLUserTenantLinkStore.ts +18 -4
  31. package/src/stores/PostgreSQLWorkflowTrackingStore.ts +18 -4
  32. package/src/stores/PostgreSQLWorkspaceStore.ts +19 -3
  33. package/src/stores/PostgresSharedResourceStore.ts +21 -3
  34. package/src/stores/ThreadMessageQueueStore.ts +14 -3
@@ -1,5 +1,5 @@
1
1
 
2
- > @axiom-lattice/pg-stores@1.0.83 build /home/runner/work/agentic/agentic/packages/pg-stores
2
+ > @axiom-lattice/pg-stores@1.0.84 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 238.68 KB
12
- CJS dist/index.js.map 441.54 KB
13
- CJS ⚡️ Build success in 627ms
14
- ESM dist/index.mjs 232.87 KB
15
- ESM dist/index.mjs.map 441.35 KB
16
- ESM ⚡️ Build success in 671ms
11
+ ESM dist/index.mjs 242.31 KB
12
+ ESM dist/index.mjs.map 464.46 KB
13
+ ESM ⚡️ Build success in 734ms
14
+ CJS dist/index.js 248.12 KB
15
+ CJS dist/index.js.map 464.65 KB
16
+ CJS ⚡️ Build success in 734ms
17
17
  DTS Build start
18
- DTS ⚡️ Build success in 14039ms
19
- DTS dist/index.d.ts 54.51 KB
20
- DTS dist/index.d.mts 54.51 KB
18
+ DTS ⚡️ Build success in 17396ms
19
+ DTS dist/index.d.ts 57.13 KB
20
+ DTS dist/index.d.mts 57.13 KB
package/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # @axiom-lattice/pg-stores
2
2
 
3
+ ## 1.0.84
4
+
5
+ ### Patch Changes
6
+
7
+ - 9608076: fix issues
8
+ - Updated dependencies [9608076]
9
+ - @axiom-lattice/core@2.1.93
10
+ - @axiom-lattice/protocols@2.1.47
11
+
3
12
  ## 1.0.83
4
13
 
5
14
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { PoolConfig, PoolClient, Pool } from 'pg';
1
+ import { Pool, PoolConfig, PoolClient } from 'pg';
2
2
  export { Pool, PoolConfig } from 'pg';
3
3
  import { ThreadStore, Thread, CreateThreadRequest, AssistantStore, Assistant, CreateAssistantRequest, DatabaseConfigStore, DatabaseConfigEntry, CreateDatabaseConfigRequest, UpdateDatabaseConfigRequest, MetricsServerConfigStore, MetricsServerConfigEntry, CreateMetricsServerConfigRequest, UpdateMetricsServerConfigRequest, McpServerConfigStore, McpServerConfigEntry, CreateMcpServerConfigRequest, UpdateMcpServerConfigRequest, WorkspaceStore, Workspace, CreateWorkspaceRequest, UpdateWorkspaceRequest, ProjectStore, Project, CreateProjectRequest, UpdateProjectRequest, UserStore, User, CreateUserRequest, UpdateUserRequest, TenantStore, Tenant, CreateTenantRequest, UpdateTenantRequest, UserTenantLinkStore, UserTenantLink, CreateUserTenantLinkRequest, UpdateUserTenantLinkRequest, WorkflowTrackingStore, CreateWorkflowRunRequest, WorkflowRun, UpdateWorkflowRunRequest, CreateRunStepRequest, RunStep, UpdateRunStepRequest, StepType, EvalStore, EvalProject, CreateEvalProjectRequest, EvalSuite, CreateEvalSuiteRequest, EvalCase, CreateEvalCaseRequest, EvalRun, CreateEvalRunRequest, EvalRunResult, EvalProjectReport, BindingRegistry, Binding, CreateBindingInput, ChannelInstallationStore, ChannelInstallation, ChannelInstallationType, CreateChannelInstallationRequest, UpdateChannelInstallationRequest, A2AApiKeyStore, A2AApiKeyRecord, CreateA2AApiKeyInput, A2AApiKeyEntry, ScheduleStorage, ScheduledTaskDefinition, ScheduledTaskStatus, ScheduleExecutionType, TaskStore, CreateTaskRequest, TaskItem, TaskListFilter, UpdateTaskRequest, MenuRegistry, MenuItem, CreateMenuItemInput, UpdateMenuItemInput, SharedResourceStore, ShareRecord, SkillStore, Skill, CreateSkillRequest } from '@axiom-lattice/protocols';
4
4
  export { Assistant, AssistantStore, Binding, BindingRegistry, ChannelInstallation, ChannelInstallationStore, CreateAssistantRequest, CreateBindingInput, CreateChannelInstallationRequest, CreateDatabaseConfigRequest, CreateEvalCaseRequest, CreateEvalProjectRequest, CreateEvalRunRequest, CreateEvalSuiteRequest, CreateMcpServerConfigRequest, CreateMenuItemInput, CreateMetricsServerConfigRequest, CreateProjectRequest, CreateRunStepRequest, CreateShareRequest, CreateSkillRequest, CreateTenantRequest, CreateThreadRequest, CreateUserRequest, CreateUserTenantLinkRequest, CreateWorkflowRunRequest, CreateWorkspaceRequest, DatabaseConfig, DatabaseConfigEntry, DatabaseConfigStore, DatabaseType, EvalCase, EvalProject, EvalProjectReport, EvalRun, EvalRunResult, EvalStore, EvalSuite, LarkChannelInstallationConfig, McpServerConfigEntry, McpServerConfigStore, MenuItem, MenuRegistry, MetricsServerConfig, MetricsServerConfigEntry, MetricsServerConfigStore, Project, ProjectStore, ResourceAddress, RunStep, ScheduleExecutionType, ScheduleStorage, ScheduledTaskDefinition, ScheduledTaskStatus, ShareRecord, ShareResult, ShareVisibility, SharedResourceStore, Skill, SkillStore, StorageType, Tenant, TenantStatus, TenantStore, Thread, ThreadStore, UpdateChannelInstallationRequest, UpdateDatabaseConfigRequest, UpdateMcpServerConfigRequest, UpdateMetricsServerConfigRequest, UpdateProjectRequest, UpdateRunStepRequest, UpdateTenantRequest, UpdateUserRequest, UpdateUserTenantLinkRequest, UpdateWorkflowRunRequest, UpdateWorkspaceRequest, User, UserStore, UserTenantLink, UserTenantLinkStore, UserTenantRole, WorkflowRun, WorkflowTrackingStore, Workspace, WorkspaceStore } from '@axiom-lattice/protocols';
@@ -14,11 +14,16 @@ import { PostgresSaver } from '@langchain/langgraph-checkpoint-postgres';
14
14
  * PostgreSQL ThreadStore options
15
15
  */
16
16
  interface PostgreSQLThreadStoreOptions {
17
+ /**
18
+ * External pool instance. When provided, poolConfig is not required and the
19
+ * caller is responsible for pool lifecycle and migrations.
20
+ */
21
+ pool?: Pool;
17
22
  /**
18
23
  * PostgreSQL connection pool configuration
19
24
  * Can be a connection string or PoolConfig object
20
25
  */
21
- poolConfig: string | PoolConfig;
26
+ poolConfig?: string | PoolConfig;
22
27
  /**
23
28
  * Whether to run migrations automatically on initialization
24
29
  * @default true
@@ -90,11 +95,16 @@ declare class PostgreSQLThreadStore implements ThreadStore {
90
95
  * PostgreSQL AssistantStore options
91
96
  */
92
97
  interface PostgreSQLAssistantStoreOptions {
98
+ /**
99
+ * External pool instance. When provided, poolConfig is not required and the
100
+ * caller is responsible for pool lifecycle and migrations.
101
+ */
102
+ pool?: Pool;
93
103
  /**
94
104
  * PostgreSQL connection pool configuration
95
105
  * Can be a connection string or PoolConfig object
96
106
  */
97
- poolConfig: string | PoolConfig;
107
+ poolConfig?: string | PoolConfig;
98
108
  /**
99
109
  * Whether to run migrations automatically on initialization
100
110
  * @default true
@@ -170,11 +180,16 @@ declare class PostgreSQLAssistantStore implements AssistantStore {
170
180
  * PostgreSQL DatabaseConfigStore options
171
181
  */
172
182
  interface PostgreSQLDatabaseConfigStoreOptions {
183
+ /**
184
+ * External pool instance. When provided, poolConfig is not required and the
185
+ * caller is responsible for pool lifecycle and migrations.
186
+ */
187
+ pool?: Pool;
173
188
  /**
174
189
  * PostgreSQL connection pool configuration
175
190
  * Can be a connection string or PoolConfig object
176
191
  */
177
- poolConfig: string | PoolConfig;
192
+ poolConfig?: string | PoolConfig;
178
193
  /**
179
194
  * Whether to run migrations automatically on initialization
180
195
  * @default true
@@ -193,6 +208,7 @@ declare class PostgreSQLDatabaseConfigStore implements DatabaseConfigStore {
193
208
  private pool;
194
209
  private migrationManager;
195
210
  private initialized;
211
+ private ownsPool;
196
212
  private initPromise;
197
213
  constructor(options: PostgreSQLDatabaseConfigStoreOptions);
198
214
  /**
@@ -259,11 +275,16 @@ declare class PostgreSQLDatabaseConfigStore implements DatabaseConfigStore {
259
275
  * PostgreSQL MetricsServerConfigStore options
260
276
  */
261
277
  interface PostgreSQLMetricsServerConfigStoreOptions {
278
+ /**
279
+ * External pool instance. When provided, poolConfig is not required and the
280
+ * caller is responsible for pool lifecycle and migrations.
281
+ */
282
+ pool?: Pool;
262
283
  /**
263
284
  * PostgreSQL connection pool configuration
264
285
  * Can be a connection string or PoolConfig object
265
286
  */
266
- poolConfig: string | PoolConfig;
287
+ poolConfig?: string | PoolConfig;
267
288
  /**
268
289
  * Whether to run migrations automatically on initialization
269
290
  * @default true
@@ -282,6 +303,7 @@ declare class PostgreSQLMetricsServerConfigStore implements MetricsServerConfigS
282
303
  private pool;
283
304
  private migrationManager;
284
305
  private initialized;
306
+ private ownsPool;
285
307
  private initPromise;
286
308
  constructor(options: PostgreSQLMetricsServerConfigStoreOptions);
287
309
  /**
@@ -348,11 +370,16 @@ declare class PostgreSQLMetricsServerConfigStore implements MetricsServerConfigS
348
370
  * PostgreSQL McpServerConfigStore options
349
371
  */
350
372
  interface PostgreSQLMcpServerConfigStoreOptions {
373
+ /**
374
+ * External pool instance. When provided, poolConfig is not required and the
375
+ * caller is responsible for pool lifecycle and migrations.
376
+ */
377
+ pool?: Pool;
351
378
  /**
352
379
  * PostgreSQL connection pool configuration
353
380
  * Can be a connection string or PoolConfig object
354
381
  */
355
- poolConfig: string | PoolConfig;
382
+ poolConfig?: string | PoolConfig;
356
383
  /**
357
384
  * Whether to run migrations automatically on initialization
358
385
  * @default true
@@ -371,6 +398,7 @@ declare class PostgreSQLMcpServerConfigStore implements McpServerConfigStore {
371
398
  private pool;
372
399
  private migrationManager;
373
400
  private initialized;
401
+ private ownsPool;
374
402
  private initPromise;
375
403
  constructor(options: PostgreSQLMcpServerConfigStoreOptions);
376
404
  /**
@@ -437,11 +465,16 @@ declare class PostgreSQLMcpServerConfigStore implements McpServerConfigStore {
437
465
  * PostgreSQL WorkspaceStore options
438
466
  */
439
467
  interface PostgreSQLWorkspaceStoreOptions {
468
+ /**
469
+ * External pool instance. When provided, poolConfig is not required and the
470
+ * caller is responsible for pool lifecycle and migrations.
471
+ */
472
+ pool?: Pool;
440
473
  /**
441
474
  * PostgreSQL connection pool configuration
442
475
  * Can be a connection string or PoolConfig object
443
476
  */
444
- poolConfig: string | PoolConfig;
477
+ poolConfig?: string | PoolConfig;
445
478
  /**
446
479
  * Whether to run migrations automatically on initialization
447
480
  * @default true
@@ -504,11 +537,16 @@ declare class PostgreSQLWorkspaceStore implements WorkspaceStore {
504
537
  * PostgreSQL ProjectStore options
505
538
  */
506
539
  interface PostgreSQLProjectStoreOptions {
540
+ /**
541
+ * External pool instance. When provided, poolConfig is not required and the
542
+ * caller is responsible for pool lifecycle and migrations.
543
+ */
544
+ pool?: Pool;
507
545
  /**
508
546
  * PostgreSQL connection pool configuration
509
547
  * Can be a connection string or PoolConfig object
510
548
  */
511
- poolConfig: string | PoolConfig;
549
+ poolConfig?: string | PoolConfig;
512
550
  /**
513
551
  * Whether to run migrations automatically on initialization
514
552
  * @default true
@@ -568,13 +606,15 @@ declare class PostgreSQLProjectStore implements ProjectStore {
568
606
  }
569
607
 
570
608
  interface PostgreSQLUserStoreOptions {
571
- poolConfig: string | PoolConfig;
609
+ pool?: Pool;
610
+ poolConfig?: string | PoolConfig;
572
611
  autoMigrate?: boolean;
573
612
  }
574
613
  declare class PostgreSQLUserStore implements UserStore {
575
614
  private pool;
576
615
  private migrationManager;
577
616
  private initialized;
617
+ private ownsPool;
578
618
  constructor(options: PostgreSQLUserStoreOptions);
579
619
  dispose(): Promise<void>;
580
620
  initialize(): Promise<void>;
@@ -596,11 +636,16 @@ declare class PostgreSQLUserStore implements UserStore {
596
636
  * PostgreSQL TenantStore options
597
637
  */
598
638
  interface PostgreSQLTenantStoreOptions {
639
+ /**
640
+ * External pool instance. When provided, poolConfig is not required and the
641
+ * caller is responsible for pool lifecycle and migrations.
642
+ */
643
+ pool?: Pool;
599
644
  /**
600
645
  * PostgreSQL connection pool configuration
601
646
  * Can be a connection string or PoolConfig object
602
647
  */
603
- poolConfig: string | PoolConfig;
648
+ poolConfig?: string | PoolConfig;
604
649
  /**
605
650
  * Whether to run migrations automatically on initialization
606
651
  * @default true
@@ -657,13 +702,15 @@ declare class PostgreSQLTenantStore implements TenantStore {
657
702
  }
658
703
 
659
704
  interface PostgreSQLUserTenantLinkStoreOptions {
660
- poolConfig: string | PoolConfig;
705
+ pool?: Pool;
706
+ poolConfig?: string | PoolConfig;
661
707
  autoMigrate?: boolean;
662
708
  }
663
709
  declare class PostgreSQLUserTenantLinkStore implements UserTenantLinkStore {
664
710
  private pool;
665
711
  private migrationManager;
666
712
  private initialized;
713
+ private ownsPool;
667
714
  constructor(options: PostgreSQLUserTenantLinkStoreOptions);
668
715
  dispose(): Promise<void>;
669
716
  initialize(): Promise<void>;
@@ -683,13 +730,15 @@ declare class PostgreSQLUserTenantLinkStore implements UserTenantLinkStore {
683
730
  */
684
731
 
685
732
  interface PostgreSQLWorkflowTrackingStoreOptions {
686
- poolConfig: string | PoolConfig;
733
+ pool?: Pool;
734
+ poolConfig?: string | PoolConfig;
687
735
  autoMigrate?: boolean;
688
736
  }
689
737
  declare class PostgreSQLWorkflowTrackingStore implements WorkflowTrackingStore {
690
738
  private pool;
691
739
  private migrationManager;
692
740
  private initialized;
741
+ private ownsPool;
693
742
  private initPromise;
694
743
  constructor(options: PostgreSQLWorkflowTrackingStoreOptions);
695
744
  dispose(): Promise<void>;
@@ -719,8 +768,10 @@ declare function mapRowToRunStep(row: any): RunStep;
719
768
 
720
769
  /** PostgreSQL EvalStore options */
721
770
  interface PostgreSQLEvalStoreOptions {
771
+ /** External pool instance. When provided, poolConfig is not required. */
772
+ pool?: Pool;
722
773
  /** PostgreSQL connection pool configuration */
723
- poolConfig: string | PoolConfig;
774
+ poolConfig?: string | PoolConfig;
724
775
  /** Whether to run migrations automatically on initialization @default true */
725
776
  autoMigrate?: boolean;
726
777
  }
@@ -824,7 +875,8 @@ declare class PostgreSQLEvalStore implements EvalStore {
824
875
  */
825
876
 
826
877
  interface PostgreSQLThreadMessageQueueStoreOptions {
827
- poolConfig: string | PoolConfig;
878
+ pool?: Pool;
879
+ poolConfig?: string | PoolConfig;
828
880
  autoMigrate?: boolean;
829
881
  }
830
882
  declare class ThreadMessageQueueStore implements IMessageQueueStore {
@@ -882,16 +934,19 @@ declare class ThreadMessageQueueStore implements IMessageQueueStore {
882
934
  }
883
935
 
884
936
  interface ChannelBindingStoreOptions {
885
- poolConfig: string | PoolConfig;
937
+ pool?: Pool;
938
+ poolConfig?: string | PoolConfig;
886
939
  autoMigrate?: boolean;
887
940
  }
888
941
  declare class ChannelBindingStore implements BindingRegistry {
889
942
  private pool;
890
943
  private migrationManager;
891
944
  private initialized;
945
+ private ownsPool;
892
946
  private initPromise;
893
947
  constructor(options: ChannelBindingStoreOptions);
894
948
  initialize(): Promise<void>;
949
+ dispose(): Promise<void>;
895
950
  resolve(params: {
896
951
  channel: string;
897
952
  senderId: string;
@@ -918,16 +973,19 @@ declare class ChannelBindingStore implements BindingRegistry {
918
973
  }
919
974
 
920
975
  interface PostgreSQLChannelInstallationStoreOptions {
921
- poolConfig: string | PoolConfig;
976
+ pool?: Pool;
977
+ poolConfig?: string | PoolConfig;
922
978
  autoMigrate?: boolean;
923
979
  }
924
980
  declare class PostgreSQLChannelInstallationStore implements ChannelInstallationStore {
925
981
  private pool;
926
982
  private migrationManager;
927
983
  private initialized;
984
+ private ownsPool;
928
985
  private initPromise;
929
986
  constructor(options: PostgreSQLChannelInstallationStoreOptions);
930
987
  initialize(): Promise<void>;
988
+ dispose(): Promise<void>;
931
989
  getInstallationById(installationId: string): Promise<ChannelInstallation | null>;
932
990
  getInstallationsByTenant(tenantId: string, channel?: ChannelInstallationType): Promise<ChannelInstallation[]>;
933
991
  getAllInstallations(channel?: ChannelInstallationType): Promise<ChannelInstallation[]>;
@@ -941,16 +999,19 @@ declare class PostgreSQLChannelInstallationStore implements ChannelInstallationS
941
999
  }
942
1000
 
943
1001
  interface PostgreSQLA2AApiKeyStoreOptions {
944
- poolConfig: string | PoolConfig;
1002
+ pool?: Pool;
1003
+ poolConfig?: string | PoolConfig;
945
1004
  autoMigrate?: boolean;
946
1005
  }
947
1006
  declare class PostgreSQLA2AApiKeyStore implements A2AApiKeyStore {
948
1007
  private pool;
949
1008
  private migrationManager;
950
1009
  private initialized;
1010
+ private ownsPool;
951
1011
  private initPromise;
952
1012
  constructor(options: PostgreSQLA2AApiKeyStoreOptions);
953
1013
  initialize(): Promise<void>;
1014
+ dispose(): Promise<void>;
954
1015
  private ensureInitialized;
955
1016
  findByKey(key: string): Promise<A2AApiKeyRecord | null>;
956
1017
  list(params: {
@@ -977,11 +1038,16 @@ declare class PostgreSQLA2AApiKeyStore implements A2AApiKeyStore {
977
1038
  * PostgreSQL ScheduleStorage options
978
1039
  */
979
1040
  interface PostgreSQLScheduleStorageOptions {
1041
+ /**
1042
+ * External pool instance. When provided, poolConfig is not required and the
1043
+ * caller is responsible for pool lifecycle and migrations.
1044
+ */
1045
+ pool?: Pool;
980
1046
  /**
981
1047
  * PostgreSQL connection pool configuration
982
1048
  * Can be a connection string or PoolConfig object
983
1049
  */
984
- poolConfig: string | PoolConfig;
1050
+ poolConfig?: string | PoolConfig;
985
1051
  /**
986
1052
  * Whether to run migrations automatically on initialization
987
1053
  * @default true
@@ -995,6 +1061,7 @@ declare class PostgreSQLScheduleStorage implements ScheduleStorage {
995
1061
  private pool;
996
1062
  private migrationManager;
997
1063
  private initialized;
1064
+ private ownsPool;
998
1065
  constructor(options: PostgreSQLScheduleStorageOptions);
999
1066
  /**
1000
1067
  * Dispose resources and close the connection pool
@@ -1087,7 +1154,8 @@ declare class PostgreSQLScheduleStorage implements ScheduleStorage {
1087
1154
  */
1088
1155
 
1089
1156
  interface PostgreSQLTaskStoreOptions {
1090
- poolConfig: string | PoolConfig;
1157
+ pool?: Pool;
1158
+ poolConfig?: string | PoolConfig;
1091
1159
  autoMigrate?: boolean;
1092
1160
  }
1093
1161
  declare class PostgreSQLTaskStore implements TaskStore {
@@ -1112,16 +1180,19 @@ declare class PostgreSQLTaskStore implements TaskStore {
1112
1180
  }
1113
1181
 
1114
1182
  interface MenuStoreOptions {
1115
- poolConfig: string | PoolConfig;
1183
+ pool?: Pool;
1184
+ poolConfig?: string | PoolConfig;
1116
1185
  autoMigrate?: boolean;
1117
1186
  }
1118
1187
  declare class MenuStore implements MenuRegistry {
1119
1188
  private pool;
1120
1189
  private migrationManager;
1121
1190
  private initialized;
1191
+ private ownsPool;
1122
1192
  private initPromise;
1123
1193
  constructor(options: MenuStoreOptions);
1124
1194
  initialize(): Promise<void>;
1195
+ dispose(): Promise<void>;
1125
1196
  list(params: {
1126
1197
  tenantId: string;
1127
1198
  menuTarget?: string;
@@ -1137,16 +1208,19 @@ declare class MenuStore implements MenuRegistry {
1137
1208
  }
1138
1209
 
1139
1210
  interface PostgresSharedResourceStoreOptions {
1140
- poolConfig: string | PoolConfig;
1211
+ pool?: Pool;
1212
+ poolConfig?: string | PoolConfig;
1141
1213
  autoMigrate?: boolean;
1142
1214
  }
1143
1215
  declare class PostgresSharedResourceStore implements SharedResourceStore {
1144
1216
  private pool;
1145
1217
  private migrationManager;
1146
1218
  private initialized;
1219
+ private ownsPool;
1147
1220
  private initPromise;
1148
1221
  constructor(options: PostgresSharedResourceStoreOptions);
1149
1222
  initialize(): Promise<void>;
1223
+ dispose(): Promise<void>;
1150
1224
  findByToken(token: string): Promise<ShareRecord | null>;
1151
1225
  create(record: Omit<ShareRecord, "accessCount" | "createdAt" | "version">): Promise<ShareRecord>;
1152
1226
  update(token: string, patch: Record<string, unknown>): Promise<void>;
@@ -1157,7 +1231,7 @@ declare class PostgresSharedResourceStore implements SharedResourceStore {
1157
1231
  private _mapRow;
1158
1232
  }
1159
1233
 
1160
- declare function createPgStoreConfig(connectionString: string): {
1234
+ declare function createPgStoreConfig(connectionString: string): Promise<{
1161
1235
  workspace: PostgreSQLWorkspaceStore;
1162
1236
  project: PostgreSQLProjectStore;
1163
1237
  eval: PostgreSQLEvalStore;
@@ -1179,14 +1253,15 @@ declare function createPgStoreConfig(connectionString: string): {
1179
1253
  menu: MenuStore;
1180
1254
  sharedResource: PostgresSharedResourceStore;
1181
1255
  checkpoint: PostgresSaver;
1182
- };
1256
+ }>;
1183
1257
 
1184
1258
  /**
1185
1259
  * PostgreSQL implementation of SkillStore with tenant isolation
1186
1260
  */
1187
1261
 
1188
1262
  interface PostgreSQLSkillStoreOptions {
1189
- poolConfig: string | PoolConfig;
1263
+ pool?: Pool;
1264
+ poolConfig?: string | PoolConfig;
1190
1265
  autoMigrate?: boolean;
1191
1266
  }
1192
1267
  /**
@@ -1259,30 +1334,29 @@ declare class PostgreSQLSkillStore implements SkillStore {
1259
1334
  /**
1260
1335
  * Migration system for database schema management
1261
1336
  *
1262
- * ## Migration Version Rules
1337
+ * ## Identity vs Ordering
1263
1338
  *
1264
- * Version numbers are globally unique across all migrations applied to the same
1265
- * database. They are NOT auto-assigned you must pick one manually.
1339
+ * **name = identity** each migration is uniquely identified by its name.
1340
+ * Two migrations MAY share the same version number; they are tracked
1341
+ * independently by name and will both execute.
1266
1342
  *
1267
- * ### Numbering scheme
1343
+ * **version = ordering** — migrations are sorted and applied in ascending
1344
+ * version order. Sharing a version simply means two migrations are at the
1345
+ * same position in the dependency chain (they operate on different tables).
1346
+ *
1347
+ * ### Version numbering scheme
1268
1348
  *
1269
1349
  * | Range | Purpose |
1270
1350
  * |---------|--------------------------------------|
1271
1351
  * | 1–99 | Core table creation + column changes |
1272
1352
  * | 100+ | Independent feature modules |
1273
1353
  *
1274
- * ### How to pick a version
1275
- *
1276
- * 1. Run `grep -rn "version:" src/migrations/ | sort -t: -k3 -n` to list all versions
1277
- * 2. For a core column change: find the next unused number in the 1–99 range
1278
- * 3. For a new feature module: find the next unused number in the 100+ range
1279
- * 4. Verify your chosen version is NOT in the grep output
1280
- *
1281
1354
  * @remarks
1282
- * - Migrations are sorted and applied in version order on startup
1355
+ * - Migrations are applied in version order on startup
1283
1356
  * - The version must be strictly greater than any migration it depends on
1284
1357
  * - Use `IF NOT EXISTS` / `IF EXISTS` in SQL to keep migrations idempotent
1285
- * - A version number collision will cause one migration to be silently skipped
1358
+ * - Duplicate **names** are rejected at registration time
1359
+ * - Duplicate **versions** are allowed (different features, different tables)
1286
1360
  */
1287
1361
 
1288
1362
  /**
@@ -1302,28 +1376,31 @@ declare class MigrationManager {
1302
1376
  private migrations;
1303
1377
  constructor(pool: Pool);
1304
1378
  /**
1305
- * Register a migration
1379
+ * Register a migration.
1380
+ * Duplicate names are rejected immediately (name = identity).
1381
+ * Duplicate versions are allowed (version = ordering only).
1306
1382
  */
1307
1383
  register(migration: Migration): void;
1308
1384
  /**
1309
- * Initialize migrations table if it doesn't exist
1385
+ * Ensure the tracking table exists with the correct schema.
1386
+ * Handles migration from old schema (PK on version) to new schema (PK on name).
1310
1387
  */
1311
1388
  private ensureMigrationsTable;
1312
1389
  /**
1313
- * Get applied migrations from database
1390
+ * Get the set of already-applied migration names from the tracking table.
1314
1391
  */
1315
- private getAppliedMigrations;
1392
+ private getAppliedNames;
1316
1393
  /**
1317
1394
  * Apply pending migrations
1318
1395
  * Uses PostgreSQL advisory locks to prevent concurrent migrations
1319
1396
  */
1320
1397
  migrate(): Promise<void>;
1321
1398
  /**
1322
- * Rollback last migration
1399
+ * Rollback the last-applied migration (highest version).
1323
1400
  */
1324
1401
  rollback(): Promise<void>;
1325
1402
  /**
1326
- * Get current migration version
1403
+ * Get the highest applied migration version.
1327
1404
  */
1328
1405
  getCurrentVersion(): Promise<number>;
1329
1406
  }
@@ -1538,7 +1615,8 @@ declare const createWorkflowTrackingTables: Migration;
1538
1615
  declare const addStepThreadId: Migration;
1539
1616
 
1540
1617
  interface ChannelIdentityMappingStoreOptions {
1541
- poolConfig: string | PoolConfig;
1618
+ pool?: Pool;
1619
+ poolConfig?: string | PoolConfig;
1542
1620
  autoMigrate?: boolean;
1543
1621
  }
1544
1622
  interface CreateChannelIdentityMappingInput {
@@ -1575,9 +1653,11 @@ declare class ChannelIdentityMappingStore {
1575
1653
  private pool;
1576
1654
  private migrationManager;
1577
1655
  private initialized;
1656
+ private ownsPool;
1578
1657
  private initPromise;
1579
1658
  constructor(options: ChannelIdentityMappingStoreOptions);
1580
1659
  initialize(): Promise<void>;
1660
+ dispose(): Promise<void>;
1581
1661
  createMapping(input: CreateChannelIdentityMappingInput): Promise<ChannelIdentityMapping>;
1582
1662
  getMappingBySubject(input: {
1583
1663
  channel: string;