@axiom-lattice/pg-stores 1.0.85 → 1.0.86

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.85 build /home/runner/work/agentic/agentic/packages/pg-stores
2
+ > @axiom-lattice/pg-stores@1.0.86 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 248.30 KB
12
- CJS dist/index.js.map 465.09 KB
13
- CJS ⚡️ Build success in 632ms
14
- ESM dist/index.mjs 242.49 KB
15
- ESM dist/index.mjs.map 464.90 KB
16
- ESM ⚡️ Build success in 657ms
11
+ ESM dist/index.mjs 250.81 KB
12
+ ESM dist/index.mjs.map 480.82 KB
13
+ ESM ⚡️ Build success in 696ms
14
+ CJS dist/index.js 256.93 KB
15
+ CJS dist/index.js.map 481.04 KB
16
+ CJS ⚡️ Build success in 707ms
17
17
  DTS Build start
18
- DTS ⚡️ Build success in 16627ms
19
- DTS dist/index.d.ts 57.13 KB
20
- DTS dist/index.d.mts 57.13 KB
18
+ DTS ⚡️ Build success in 16062ms
19
+ DTS dist/index.d.ts 59.56 KB
20
+ DTS dist/index.d.mts 59.56 KB
package/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # @axiom-lattice/pg-stores
2
2
 
3
+ ## 1.0.86
4
+
5
+ ### Patch Changes
6
+
7
+ - f3bb4f1: huge update
8
+ - Updated dependencies [f3bb4f1]
9
+ - @axiom-lattice/core@2.1.95
10
+ - @axiom-lattice/protocols@2.1.49
11
+
3
12
  ## 1.0.85
4
13
 
5
14
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -1,10 +1,11 @@
1
1
  import { Pool, PoolConfig, PoolClient } from 'pg';
2
2
  export { Pool, PoolConfig } from 'pg';
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';
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, CollectionStore, Collection, CreateCollectionRequest, UpdateCollectionRequest, VectorStoreProvider, VectorStoreCreateParams, 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';
5
5
  import { IMessageQueueStore, AddMessageParams, PendingMessage, ThreadInfo } from '@axiom-lattice/core';
6
6
  export { AddMessageParams, PendingMessage, ThreadInfo } from '@axiom-lattice/core';
7
7
  import { PostgresSaver } from '@langchain/langgraph-checkpoint-postgres';
8
+ import { DocumentInterface } from '@langchain/core/documents';
8
9
 
9
10
  /**
10
11
  * PostgreSQL implementation of ThreadStore
@@ -1231,6 +1232,61 @@ declare class PostgresSharedResourceStore implements SharedResourceStore {
1231
1232
  private _mapRow;
1232
1233
  }
1233
1234
 
1235
+ /**
1236
+ * PostgreSQL implementation of CollectionStore with tenant isolation
1237
+ */
1238
+
1239
+ interface PostgreSQLCollectionStoreOptions {
1240
+ pool?: Pool;
1241
+ poolConfig?: string | PoolConfig;
1242
+ autoMigrate?: boolean;
1243
+ }
1244
+ declare class PostgreSQLCollectionStore implements CollectionStore {
1245
+ private pool;
1246
+ private initialized;
1247
+ private ownsPool;
1248
+ private initPromise;
1249
+ constructor(options: PostgreSQLCollectionStoreOptions);
1250
+ initialize(): Promise<void>;
1251
+ private ensureInit;
1252
+ getAllCollections(tenantId: string): Promise<Collection[]>;
1253
+ getCollectionByName(tenantId: string, name: string): Promise<Collection | null>;
1254
+ createCollection(tenantId: string, data: CreateCollectionRequest): Promise<Collection>;
1255
+ updateCollection(tenantId: string, name: string, updates: UpdateCollectionRequest): Promise<Collection | null>;
1256
+ deleteCollection(tenantId: string, name: string): Promise<boolean>;
1257
+ dispose(): Promise<void>;
1258
+ private rowToCollection;
1259
+ }
1260
+
1261
+ /**
1262
+ * PGVectorStoreProvider
1263
+ *
1264
+ * VectorStoreProvider implementation using PostgreSQL with pgvector extension.
1265
+ * Each created VectorStore maps to a separate table with the vector column.
1266
+ */
1267
+
1268
+ declare class PGVectorStoreProvider implements VectorStoreProvider {
1269
+ private pool;
1270
+ private connectionString;
1271
+ constructor(pool: Pool, connectionString: string);
1272
+ create(params: VectorStoreCreateParams): Promise<any>;
1273
+ getEntryCount(tableName: string): Promise<number>;
1274
+ listEntries(tableName: string): Promise<DocumentInterface[]>;
1275
+ dropTable(tableName: string): Promise<void>;
1276
+ dispose(_name: string): Promise<void>;
1277
+ }
1278
+ /**
1279
+ * Create a PGVectorStoreProvider from a connection string.
1280
+ * Creates its own Pool — call pool.end() to clean up.
1281
+ *
1282
+ * @param connectionString PostgreSQL connection string
1283
+ * @returns PGVectorStoreProvider instance
1284
+ */
1285
+ declare function createPGVectorStoreProvider(connectionString: string): {
1286
+ provider: PGVectorStoreProvider;
1287
+ pool: Pool;
1288
+ };
1289
+
1234
1290
  declare function createPgStoreConfig(connectionString: string): Promise<{
1235
1291
  workspace: PostgreSQLWorkspaceStore;
1236
1292
  project: PostgreSQLProjectStore;
@@ -1252,6 +1308,8 @@ declare function createPgStoreConfig(connectionString: string): Promise<{
1252
1308
  schedule: PostgreSQLScheduleStorage;
1253
1309
  menu: MenuStore;
1254
1310
  sharedResource: PostgresSharedResourceStore;
1311
+ collection: PostgreSQLCollectionStore;
1312
+ vectorStoreProvider: PGVectorStoreProvider;
1255
1313
  checkpoint: PostgresSaver;
1256
1314
  }>;
1257
1315
 
@@ -1712,4 +1770,10 @@ declare const createMenuItemsTable: Migration;
1712
1770
 
1713
1771
  declare const addFileContentType: Migration;
1714
1772
 
1715
- export { ChannelBindingStore, type ChannelBindingStoreOptions, type ChannelIdentityMapping, ChannelIdentityMappingStore, type ChannelIdentityMappingStoreOptions, type CreateChannelIdentityMappingInput, MenuStore, type MenuStoreOptions, type Migration, MigrationManager, PostgreSQLA2AApiKeyStore, type PostgreSQLA2AApiKeyStoreOptions, PostgreSQLAssistantStore, type PostgreSQLAssistantStoreOptions, PostgreSQLChannelInstallationStore, type PostgreSQLChannelInstallationStoreOptions, PostgreSQLDatabaseConfigStore, type PostgreSQLDatabaseConfigStoreOptions, PostgreSQLEvalStore, type PostgreSQLEvalStoreOptions, PostgreSQLMcpServerConfigStore, type PostgreSQLMcpServerConfigStoreOptions, PostgreSQLMetricsServerConfigStore, type PostgreSQLMetricsServerConfigStoreOptions, PostgreSQLProjectStore, type PostgreSQLProjectStoreOptions, PostgreSQLScheduleStorage, type PostgreSQLScheduleStorageOptions, PostgreSQLSkillStore, type PostgreSQLSkillStoreOptions, PostgreSQLTenantStore, type PostgreSQLTenantStoreOptions, type PostgreSQLThreadMessageQueueStoreOptions, PostgreSQLThreadStore, type PostgreSQLThreadStoreOptions, PostgreSQLUserStore, type PostgreSQLUserStoreOptions, PostgreSQLUserTenantLinkStore, type PostgreSQLUserTenantLinkStoreOptions, PostgreSQLWorkflowTrackingStore, type PostgreSQLWorkflowTrackingStoreOptions, PostgreSQLWorkspaceStore, type PostgreSQLWorkspaceStoreOptions, PostgresSharedResourceStore, type PostgresSharedResourceStoreOptions, ThreadMessageQueueStore, addAssistantTenantId, addFileContentType, addProjectConfigColumn, addScheduleTenantId, addSkillTenantId, addStepThreadId, addThreadTenantId, alterChannelInstallationsTable, changeAssistantPrimaryKey, changeSkillPrimaryKey, changeThreadPrimaryKey, createA2AApiKeysTable, createAssistantsTable, createChannelBindingsTable, createChannelIdentityMappingTables, createChannelInstallationsTable, createDatabaseConfigsTable, createEvalCasesTable, createEvalProjectsTable, createEvalRunResultsTable, createEvalRunsTable, createEvalSuitesTable, createMcpServerConfigsTable, createMenuItemsTable, createMetricsConfigsTable, createPgStoreConfig, createProjectsTable, createScheduledTasksTable, createSharedResourcesTable, createSkillsTable, createTenantsTable, createThreadMessageQueueTable, createThreadsTable, createUsersTable, createWorkflowTrackingTables, createWorkspacesTable, evalMigrations, mapRowToRunStep, mapRowToWorkflowRun, safeParse };
1773
+ /**
1774
+ * Collection table migrations
1775
+ */
1776
+
1777
+ declare const createCollectionsTable: Migration;
1778
+
1779
+ export { ChannelBindingStore, type ChannelBindingStoreOptions, type ChannelIdentityMapping, ChannelIdentityMappingStore, type ChannelIdentityMappingStoreOptions, type CreateChannelIdentityMappingInput, MenuStore, type MenuStoreOptions, type Migration, MigrationManager, PGVectorStoreProvider, PostgreSQLA2AApiKeyStore, type PostgreSQLA2AApiKeyStoreOptions, PostgreSQLAssistantStore, type PostgreSQLAssistantStoreOptions, PostgreSQLChannelInstallationStore, type PostgreSQLChannelInstallationStoreOptions, PostgreSQLCollectionStore, type PostgreSQLCollectionStoreOptions, PostgreSQLDatabaseConfigStore, type PostgreSQLDatabaseConfigStoreOptions, PostgreSQLEvalStore, type PostgreSQLEvalStoreOptions, PostgreSQLMcpServerConfigStore, type PostgreSQLMcpServerConfigStoreOptions, PostgreSQLMetricsServerConfigStore, type PostgreSQLMetricsServerConfigStoreOptions, PostgreSQLProjectStore, type PostgreSQLProjectStoreOptions, PostgreSQLScheduleStorage, type PostgreSQLScheduleStorageOptions, PostgreSQLSkillStore, type PostgreSQLSkillStoreOptions, PostgreSQLTenantStore, type PostgreSQLTenantStoreOptions, type PostgreSQLThreadMessageQueueStoreOptions, PostgreSQLThreadStore, type PostgreSQLThreadStoreOptions, PostgreSQLUserStore, type PostgreSQLUserStoreOptions, PostgreSQLUserTenantLinkStore, type PostgreSQLUserTenantLinkStoreOptions, PostgreSQLWorkflowTrackingStore, type PostgreSQLWorkflowTrackingStoreOptions, PostgreSQLWorkspaceStore, type PostgreSQLWorkspaceStoreOptions, PostgresSharedResourceStore, type PostgresSharedResourceStoreOptions, ThreadMessageQueueStore, addAssistantTenantId, addFileContentType, addProjectConfigColumn, addScheduleTenantId, addSkillTenantId, addStepThreadId, addThreadTenantId, alterChannelInstallationsTable, changeAssistantPrimaryKey, changeSkillPrimaryKey, changeThreadPrimaryKey, createA2AApiKeysTable, createAssistantsTable, createChannelBindingsTable, createChannelIdentityMappingTables, createChannelInstallationsTable, createCollectionsTable, createDatabaseConfigsTable, createEvalCasesTable, createEvalProjectsTable, createEvalRunResultsTable, createEvalRunsTable, createEvalSuitesTable, createMcpServerConfigsTable, createMenuItemsTable, createMetricsConfigsTable, createPGVectorStoreProvider, createPgStoreConfig, createProjectsTable, createScheduledTasksTable, createSharedResourcesTable, createSkillsTable, createTenantsTable, createThreadMessageQueueTable, createThreadsTable, createUsersTable, createWorkflowTrackingTables, createWorkspacesTable, evalMigrations, mapRowToRunStep, mapRowToWorkflowRun, safeParse };
package/dist/index.d.ts CHANGED
@@ -1,10 +1,11 @@
1
1
  import { Pool, PoolConfig, PoolClient } from 'pg';
2
2
  export { Pool, PoolConfig } from 'pg';
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';
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, CollectionStore, Collection, CreateCollectionRequest, UpdateCollectionRequest, VectorStoreProvider, VectorStoreCreateParams, 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';
5
5
  import { IMessageQueueStore, AddMessageParams, PendingMessage, ThreadInfo } from '@axiom-lattice/core';
6
6
  export { AddMessageParams, PendingMessage, ThreadInfo } from '@axiom-lattice/core';
7
7
  import { PostgresSaver } from '@langchain/langgraph-checkpoint-postgres';
8
+ import { DocumentInterface } from '@langchain/core/documents';
8
9
 
9
10
  /**
10
11
  * PostgreSQL implementation of ThreadStore
@@ -1231,6 +1232,61 @@ declare class PostgresSharedResourceStore implements SharedResourceStore {
1231
1232
  private _mapRow;
1232
1233
  }
1233
1234
 
1235
+ /**
1236
+ * PostgreSQL implementation of CollectionStore with tenant isolation
1237
+ */
1238
+
1239
+ interface PostgreSQLCollectionStoreOptions {
1240
+ pool?: Pool;
1241
+ poolConfig?: string | PoolConfig;
1242
+ autoMigrate?: boolean;
1243
+ }
1244
+ declare class PostgreSQLCollectionStore implements CollectionStore {
1245
+ private pool;
1246
+ private initialized;
1247
+ private ownsPool;
1248
+ private initPromise;
1249
+ constructor(options: PostgreSQLCollectionStoreOptions);
1250
+ initialize(): Promise<void>;
1251
+ private ensureInit;
1252
+ getAllCollections(tenantId: string): Promise<Collection[]>;
1253
+ getCollectionByName(tenantId: string, name: string): Promise<Collection | null>;
1254
+ createCollection(tenantId: string, data: CreateCollectionRequest): Promise<Collection>;
1255
+ updateCollection(tenantId: string, name: string, updates: UpdateCollectionRequest): Promise<Collection | null>;
1256
+ deleteCollection(tenantId: string, name: string): Promise<boolean>;
1257
+ dispose(): Promise<void>;
1258
+ private rowToCollection;
1259
+ }
1260
+
1261
+ /**
1262
+ * PGVectorStoreProvider
1263
+ *
1264
+ * VectorStoreProvider implementation using PostgreSQL with pgvector extension.
1265
+ * Each created VectorStore maps to a separate table with the vector column.
1266
+ */
1267
+
1268
+ declare class PGVectorStoreProvider implements VectorStoreProvider {
1269
+ private pool;
1270
+ private connectionString;
1271
+ constructor(pool: Pool, connectionString: string);
1272
+ create(params: VectorStoreCreateParams): Promise<any>;
1273
+ getEntryCount(tableName: string): Promise<number>;
1274
+ listEntries(tableName: string): Promise<DocumentInterface[]>;
1275
+ dropTable(tableName: string): Promise<void>;
1276
+ dispose(_name: string): Promise<void>;
1277
+ }
1278
+ /**
1279
+ * Create a PGVectorStoreProvider from a connection string.
1280
+ * Creates its own Pool — call pool.end() to clean up.
1281
+ *
1282
+ * @param connectionString PostgreSQL connection string
1283
+ * @returns PGVectorStoreProvider instance
1284
+ */
1285
+ declare function createPGVectorStoreProvider(connectionString: string): {
1286
+ provider: PGVectorStoreProvider;
1287
+ pool: Pool;
1288
+ };
1289
+
1234
1290
  declare function createPgStoreConfig(connectionString: string): Promise<{
1235
1291
  workspace: PostgreSQLWorkspaceStore;
1236
1292
  project: PostgreSQLProjectStore;
@@ -1252,6 +1308,8 @@ declare function createPgStoreConfig(connectionString: string): Promise<{
1252
1308
  schedule: PostgreSQLScheduleStorage;
1253
1309
  menu: MenuStore;
1254
1310
  sharedResource: PostgresSharedResourceStore;
1311
+ collection: PostgreSQLCollectionStore;
1312
+ vectorStoreProvider: PGVectorStoreProvider;
1255
1313
  checkpoint: PostgresSaver;
1256
1314
  }>;
1257
1315
 
@@ -1712,4 +1770,10 @@ declare const createMenuItemsTable: Migration;
1712
1770
 
1713
1771
  declare const addFileContentType: Migration;
1714
1772
 
1715
- export { ChannelBindingStore, type ChannelBindingStoreOptions, type ChannelIdentityMapping, ChannelIdentityMappingStore, type ChannelIdentityMappingStoreOptions, type CreateChannelIdentityMappingInput, MenuStore, type MenuStoreOptions, type Migration, MigrationManager, PostgreSQLA2AApiKeyStore, type PostgreSQLA2AApiKeyStoreOptions, PostgreSQLAssistantStore, type PostgreSQLAssistantStoreOptions, PostgreSQLChannelInstallationStore, type PostgreSQLChannelInstallationStoreOptions, PostgreSQLDatabaseConfigStore, type PostgreSQLDatabaseConfigStoreOptions, PostgreSQLEvalStore, type PostgreSQLEvalStoreOptions, PostgreSQLMcpServerConfigStore, type PostgreSQLMcpServerConfigStoreOptions, PostgreSQLMetricsServerConfigStore, type PostgreSQLMetricsServerConfigStoreOptions, PostgreSQLProjectStore, type PostgreSQLProjectStoreOptions, PostgreSQLScheduleStorage, type PostgreSQLScheduleStorageOptions, PostgreSQLSkillStore, type PostgreSQLSkillStoreOptions, PostgreSQLTenantStore, type PostgreSQLTenantStoreOptions, type PostgreSQLThreadMessageQueueStoreOptions, PostgreSQLThreadStore, type PostgreSQLThreadStoreOptions, PostgreSQLUserStore, type PostgreSQLUserStoreOptions, PostgreSQLUserTenantLinkStore, type PostgreSQLUserTenantLinkStoreOptions, PostgreSQLWorkflowTrackingStore, type PostgreSQLWorkflowTrackingStoreOptions, PostgreSQLWorkspaceStore, type PostgreSQLWorkspaceStoreOptions, PostgresSharedResourceStore, type PostgresSharedResourceStoreOptions, ThreadMessageQueueStore, addAssistantTenantId, addFileContentType, addProjectConfigColumn, addScheduleTenantId, addSkillTenantId, addStepThreadId, addThreadTenantId, alterChannelInstallationsTable, changeAssistantPrimaryKey, changeSkillPrimaryKey, changeThreadPrimaryKey, createA2AApiKeysTable, createAssistantsTable, createChannelBindingsTable, createChannelIdentityMappingTables, createChannelInstallationsTable, createDatabaseConfigsTable, createEvalCasesTable, createEvalProjectsTable, createEvalRunResultsTable, createEvalRunsTable, createEvalSuitesTable, createMcpServerConfigsTable, createMenuItemsTable, createMetricsConfigsTable, createPgStoreConfig, createProjectsTable, createScheduledTasksTable, createSharedResourcesTable, createSkillsTable, createTenantsTable, createThreadMessageQueueTable, createThreadsTable, createUsersTable, createWorkflowTrackingTables, createWorkspacesTable, evalMigrations, mapRowToRunStep, mapRowToWorkflowRun, safeParse };
1773
+ /**
1774
+ * Collection table migrations
1775
+ */
1776
+
1777
+ declare const createCollectionsTable: Migration;
1778
+
1779
+ export { ChannelBindingStore, type ChannelBindingStoreOptions, type ChannelIdentityMapping, ChannelIdentityMappingStore, type ChannelIdentityMappingStoreOptions, type CreateChannelIdentityMappingInput, MenuStore, type MenuStoreOptions, type Migration, MigrationManager, PGVectorStoreProvider, PostgreSQLA2AApiKeyStore, type PostgreSQLA2AApiKeyStoreOptions, PostgreSQLAssistantStore, type PostgreSQLAssistantStoreOptions, PostgreSQLChannelInstallationStore, type PostgreSQLChannelInstallationStoreOptions, PostgreSQLCollectionStore, type PostgreSQLCollectionStoreOptions, PostgreSQLDatabaseConfigStore, type PostgreSQLDatabaseConfigStoreOptions, PostgreSQLEvalStore, type PostgreSQLEvalStoreOptions, PostgreSQLMcpServerConfigStore, type PostgreSQLMcpServerConfigStoreOptions, PostgreSQLMetricsServerConfigStore, type PostgreSQLMetricsServerConfigStoreOptions, PostgreSQLProjectStore, type PostgreSQLProjectStoreOptions, PostgreSQLScheduleStorage, type PostgreSQLScheduleStorageOptions, PostgreSQLSkillStore, type PostgreSQLSkillStoreOptions, PostgreSQLTenantStore, type PostgreSQLTenantStoreOptions, type PostgreSQLThreadMessageQueueStoreOptions, PostgreSQLThreadStore, type PostgreSQLThreadStoreOptions, PostgreSQLUserStore, type PostgreSQLUserStoreOptions, PostgreSQLUserTenantLinkStore, type PostgreSQLUserTenantLinkStoreOptions, PostgreSQLWorkflowTrackingStore, type PostgreSQLWorkflowTrackingStoreOptions, PostgreSQLWorkspaceStore, type PostgreSQLWorkspaceStoreOptions, PostgresSharedResourceStore, type PostgresSharedResourceStoreOptions, ThreadMessageQueueStore, addAssistantTenantId, addFileContentType, addProjectConfigColumn, addScheduleTenantId, addSkillTenantId, addStepThreadId, addThreadTenantId, alterChannelInstallationsTable, changeAssistantPrimaryKey, changeSkillPrimaryKey, changeThreadPrimaryKey, createA2AApiKeysTable, createAssistantsTable, createChannelBindingsTable, createChannelIdentityMappingTables, createChannelInstallationsTable, createCollectionsTable, createDatabaseConfigsTable, createEvalCasesTable, createEvalProjectsTable, createEvalRunResultsTable, createEvalRunsTable, createEvalSuitesTable, createMcpServerConfigsTable, createMenuItemsTable, createMetricsConfigsTable, createPGVectorStoreProvider, createPgStoreConfig, createProjectsTable, createScheduledTasksTable, createSharedResourcesTable, createSkillsTable, createTenantsTable, createThreadMessageQueueTable, createThreadsTable, createUsersTable, createWorkflowTrackingTables, createWorkspacesTable, evalMigrations, mapRowToRunStep, mapRowToWorkflowRun, safeParse };
package/dist/index.js CHANGED
@@ -34,10 +34,12 @@ __export(index_exports, {
34
34
  ChannelIdentityMappingStore: () => ChannelIdentityMappingStore,
35
35
  MenuStore: () => MenuStore,
36
36
  MigrationManager: () => MigrationManager,
37
- Pool: () => import_pg24.Pool,
37
+ PGVectorStoreProvider: () => PGVectorStoreProvider,
38
+ Pool: () => import_pg26.Pool,
38
39
  PostgreSQLA2AApiKeyStore: () => PostgreSQLA2AApiKeyStore,
39
40
  PostgreSQLAssistantStore: () => PostgreSQLAssistantStore,
40
41
  PostgreSQLChannelInstallationStore: () => PostgreSQLChannelInstallationStore,
42
+ PostgreSQLCollectionStore: () => PostgreSQLCollectionStore,
41
43
  PostgreSQLDatabaseConfigStore: () => PostgreSQLDatabaseConfigStore,
42
44
  PostgreSQLEvalStore: () => PostgreSQLEvalStore,
43
45
  PostgreSQLMcpServerConfigStore: () => PostgreSQLMcpServerConfigStore,
@@ -69,6 +71,7 @@ __export(index_exports, {
69
71
  createChannelBindingsTable: () => createChannelBindingsTable,
70
72
  createChannelIdentityMappingTables: () => createChannelIdentityMappingTables,
71
73
  createChannelInstallationsTable: () => createChannelInstallationsTable,
74
+ createCollectionsTable: () => createCollectionsTable,
72
75
  createDatabaseConfigsTable: () => createDatabaseConfigsTable,
73
76
  createEvalCasesTable: () => createEvalCasesTable,
74
77
  createEvalProjectsTable: () => createEvalProjectsTable,
@@ -78,6 +81,7 @@ __export(index_exports, {
78
81
  createMcpServerConfigsTable: () => createMcpServerConfigsTable,
79
82
  createMenuItemsTable: () => createMenuItemsTable,
80
83
  createMetricsConfigsTable: () => createMetricsConfigsTable,
84
+ createPGVectorStoreProvider: () => createPGVectorStoreProvider,
81
85
  createPgStoreConfig: () => createPgStoreConfig,
82
86
  createProjectsTable: () => createProjectsTable,
83
87
  createScheduledTasksTable: () => createScheduledTasksTable,
@@ -95,10 +99,10 @@ __export(index_exports, {
95
99
  safeParse: () => safeParse
96
100
  });
97
101
  module.exports = __toCommonJS(index_exports);
98
- var import_pg24 = require("pg");
102
+ var import_pg26 = require("pg");
99
103
 
100
104
  // src/createPgStoreConfig.ts
101
- var import_pg21 = require("pg");
105
+ var import_pg23 = require("pg");
102
106
 
103
107
  // src/migrations/migration.ts
104
108
  var MigrationManager = class {
@@ -1871,7 +1875,7 @@ var PostgreSQLMcpServerConfigStore = class {
1871
1875
  data.name || null,
1872
1876
  data.description || null,
1873
1877
  JSON.stringify(configWithEncryptedEnv),
1874
- data.selectedTools || [],
1878
+ JSON.stringify(data.selectedTools || []),
1875
1879
  isEnvEncrypted,
1876
1880
  "disconnected",
1877
1881
  nowString,
@@ -1917,7 +1921,7 @@ var PostgreSQLMcpServerConfigStore = class {
1917
1921
  updateData.is_env_encrypted = isEnvEncrypted;
1918
1922
  }
1919
1923
  if (updates.selectedTools !== void 0) {
1920
- updateData.selected_tools = updates.selectedTools;
1924
+ updateData.selected_tools = JSON.stringify(updates.selectedTools);
1921
1925
  }
1922
1926
  if (updates.status !== void 0) {
1923
1927
  updateData.status = updates.status;
@@ -6983,9 +6987,218 @@ var PostgresSharedResourceStore = class {
6983
6987
  }
6984
6988
  };
6985
6989
 
6990
+ // src/stores/PostgreSQLCollectionStore.ts
6991
+ var import_pg21 = require("pg");
6992
+ var PostgreSQLCollectionStore = class {
6993
+ constructor(options) {
6994
+ this.initialized = false;
6995
+ this.ownsPool = true;
6996
+ this.initPromise = null;
6997
+ if (options.pool) {
6998
+ this.pool = options.pool;
6999
+ this.ownsPool = false;
7000
+ this.initialized = true;
7001
+ return;
7002
+ }
7003
+ if (typeof options.poolConfig === "string") {
7004
+ this.pool = new import_pg21.Pool({ connectionString: options.poolConfig });
7005
+ } else if (options.poolConfig) {
7006
+ this.pool = new import_pg21.Pool(options.poolConfig);
7007
+ } else {
7008
+ throw new Error("Either pool or poolConfig must be provided");
7009
+ }
7010
+ if (options.autoMigrate !== false) {
7011
+ this.initialize().catch((error) => {
7012
+ console.error("Failed to initialize PostgreSQLCollectionStore:", error);
7013
+ });
7014
+ }
7015
+ }
7016
+ async initialize() {
7017
+ if (this.initialized) return;
7018
+ if (this.initPromise) return this.initPromise;
7019
+ this.initPromise = (async () => {
7020
+ this.initialized = true;
7021
+ })();
7022
+ return this.initPromise;
7023
+ }
7024
+ ensureInit() {
7025
+ if (!this.initialized) {
7026
+ throw new Error("PostgreSQLCollectionStore not initialized");
7027
+ }
7028
+ }
7029
+ async getAllCollections(tenantId) {
7030
+ this.ensureInit();
7031
+ const result = await this.pool.query(
7032
+ `SELECT id, name, tenant_id, label, embedding_key, schema, created_at, updated_at
7033
+ FROM lattice_collections WHERE tenant_id = $1 ORDER BY name`,
7034
+ [tenantId]
7035
+ );
7036
+ return result.rows.map(this.rowToCollection);
7037
+ }
7038
+ async getCollectionByName(tenantId, name) {
7039
+ this.ensureInit();
7040
+ const result = await this.pool.query(
7041
+ `SELECT id, name, tenant_id, label, embedding_key, schema, created_at, updated_at
7042
+ FROM lattice_collections WHERE tenant_id = $1 AND name = $2`,
7043
+ [tenantId, name]
7044
+ );
7045
+ return result.rows.length > 0 ? this.rowToCollection(result.rows[0]) : null;
7046
+ }
7047
+ async createCollection(tenantId, data) {
7048
+ this.ensureInit();
7049
+ const schema = JSON.stringify(data.schema || { fields: [] });
7050
+ const result = await this.pool.query(
7051
+ `INSERT INTO lattice_collections (name, tenant_id, label, embedding_key, schema)
7052
+ VALUES ($1, $2, $3, $4, $5)
7053
+ ON CONFLICT (tenant_id, name) DO NOTHING
7054
+ RETURNING id, name, tenant_id, label, embedding_key, schema, created_at, updated_at`,
7055
+ [data.name, tenantId, data.label, data.embeddingKey, schema]
7056
+ );
7057
+ if (result.rows.length === 0) {
7058
+ throw new Error(`Collection "${data.name}" already exists`);
7059
+ }
7060
+ return this.rowToCollection(result.rows[0]);
7061
+ }
7062
+ async updateCollection(tenantId, name, updates) {
7063
+ this.ensureInit();
7064
+ const setClauses = [];
7065
+ const values = [];
7066
+ let paramIndex = 1;
7067
+ if (updates.label !== void 0) {
7068
+ setClauses.push(`label = $${paramIndex++}`);
7069
+ values.push(updates.label);
7070
+ }
7071
+ if (updates.embeddingKey !== void 0) {
7072
+ setClauses.push(`embedding_key = $${paramIndex++}`);
7073
+ values.push(updates.embeddingKey);
7074
+ }
7075
+ if (updates.schema !== void 0) {
7076
+ setClauses.push(`schema = $${paramIndex++}`);
7077
+ values.push(JSON.stringify(updates.schema));
7078
+ }
7079
+ if (setClauses.length === 0) return this.getCollectionByName(tenantId, name);
7080
+ setClauses.push(`updated_at = NOW()`);
7081
+ values.push(tenantId, name);
7082
+ const result = await this.pool.query(
7083
+ `UPDATE lattice_collections SET ${setClauses.join(", ")}
7084
+ WHERE tenant_id = $${paramIndex++} AND name = $${paramIndex}
7085
+ RETURNING id, name, tenant_id, label, embedding_key, schema, created_at, updated_at`,
7086
+ values
7087
+ );
7088
+ return result.rows.length > 0 ? this.rowToCollection(result.rows[0]) : null;
7089
+ }
7090
+ async deleteCollection(tenantId, name) {
7091
+ this.ensureInit();
7092
+ const result = await this.pool.query(
7093
+ `DELETE FROM lattice_collections WHERE tenant_id = $1 AND name = $2`,
7094
+ [tenantId, name]
7095
+ );
7096
+ return (result.rowCount ?? 0) > 0;
7097
+ }
7098
+ async dispose() {
7099
+ if (this.ownsPool && this.pool) {
7100
+ await this.pool.end();
7101
+ }
7102
+ }
7103
+ rowToCollection(row) {
7104
+ return {
7105
+ id: row.id,
7106
+ name: row.name,
7107
+ tenantId: row.tenant_id,
7108
+ label: row.label,
7109
+ embeddingKey: row.embedding_key,
7110
+ schema: typeof row.schema === "string" ? JSON.parse(row.schema) : row.schema,
7111
+ createdAt: row.created_at,
7112
+ updatedAt: row.updated_at
7113
+ };
7114
+ }
7115
+ };
7116
+
6986
7117
  // src/createPgStoreConfig.ts
6987
7118
  var import_langgraph_checkpoint_postgres = require("@langchain/langgraph-checkpoint-postgres");
6988
7119
 
7120
+ // src/PGVectorStoreProvider.ts
7121
+ var import_pg22 = require("pg");
7122
+ var import_pgvector = require("@langchain/community/vectorstores/pgvector");
7123
+ var import_documents = require("@langchain/core/documents");
7124
+ var import_core6 = require("@axiom-lattice/core");
7125
+ function safeTableName(name) {
7126
+ if (!/^[a-z][a-z0-9_-]*$/.test(name)) {
7127
+ throw new Error(`Invalid table name: ${name}`);
7128
+ }
7129
+ return name;
7130
+ }
7131
+ var PGVectorStoreProvider = class {
7132
+ constructor(pool, connectionString) {
7133
+ this.pool = pool;
7134
+ this.connectionString = connectionString;
7135
+ }
7136
+ async create(params) {
7137
+ const { tableName, embeddingKey } = params;
7138
+ let embeddings;
7139
+ try {
7140
+ embeddings = import_core6.embeddingsLatticeManager.getEmbeddingsClient(embeddingKey);
7141
+ } catch {
7142
+ try {
7143
+ embeddings = import_core6.embeddingsLatticeManager.getEmbeddingsClient("default");
7144
+ } catch {
7145
+ throw new Error(
7146
+ `No embedding model registered. Register one first:
7147
+ import { registerEmbeddingsLattice } from "@axiom-lattice/core";
7148
+ registerEmbeddingsLattice("default", new SomeEmbeddings(...));`
7149
+ );
7150
+ }
7151
+ }
7152
+ return import_pgvector.PGVectorStore.initialize(embeddings, {
7153
+ postgresConnectionOptions: { connectionString: this.connectionString },
7154
+ tableName: safeTableName(tableName),
7155
+ columns: {
7156
+ idColumnName: "id",
7157
+ vectorColumnName: "vector",
7158
+ contentColumnName: "content",
7159
+ metadataColumnName: "metadata"
7160
+ },
7161
+ distanceStrategy: "cosine"
7162
+ });
7163
+ }
7164
+ async getEntryCount(tableName) {
7165
+ const name = safeTableName(tableName);
7166
+ try {
7167
+ const result = await this.pool.query(`SELECT COUNT(*) as count FROM "${name}"`);
7168
+ return parseInt(result.rows[0]?.count || "0", 10);
7169
+ } catch {
7170
+ return 0;
7171
+ }
7172
+ }
7173
+ async listEntries(tableName) {
7174
+ const name = safeTableName(tableName);
7175
+ try {
7176
+ const result = await this.pool.query(
7177
+ `SELECT content, metadata FROM "${name}" ORDER BY metadata->>'_created_at' DESC`
7178
+ );
7179
+ return result.rows.map((row) => new import_documents.Document({
7180
+ pageContent: row.content || "",
7181
+ metadata: typeof row.metadata === "string" ? JSON.parse(row.metadata) : row.metadata || {}
7182
+ }));
7183
+ } catch {
7184
+ return [];
7185
+ }
7186
+ }
7187
+ async dropTable(tableName) {
7188
+ const name = safeTableName(tableName);
7189
+ await this.pool.query(`DROP TABLE IF EXISTS "${name}"`);
7190
+ }
7191
+ async dispose(_name) {
7192
+ }
7193
+ };
7194
+ function createPGVectorStoreProvider(connectionString) {
7195
+ const pool = new import_pg22.Pool({ connectionString });
7196
+ return {
7197
+ provider: new PGVectorStoreProvider(pool, connectionString),
7198
+ pool
7199
+ };
7200
+ }
7201
+
6989
7202
  // src/migrations/skill_migrations.ts
6990
7203
  var createSkillsTable = {
6991
7204
  version: 4,
@@ -7194,9 +7407,43 @@ var createChannelIdentityMappingTables = {
7194
7407
  }
7195
7408
  };
7196
7409
 
7410
+ // src/migrations/collection_migrations.ts
7411
+ var createCollectionsTable = {
7412
+ version: 137,
7413
+ name: "create_collections_table",
7414
+ up: async (client) => {
7415
+ await client.query(`
7416
+ CREATE TABLE IF NOT EXISTS lattice_collections (
7417
+ id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
7418
+ name VARCHAR(255) NOT NULL,
7419
+ tenant_id VARCHAR(255) NOT NULL DEFAULT 'default',
7420
+ label VARCHAR(255) NOT NULL,
7421
+ embedding_key VARCHAR(255) NOT NULL DEFAULT 'default',
7422
+ schema JSONB DEFAULT '{"fields":[]}',
7423
+ created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
7424
+ updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
7425
+ UNIQUE(tenant_id, name)
7426
+ )
7427
+ `);
7428
+ await client.query(`
7429
+ CREATE INDEX IF NOT EXISTS idx_lattice_collections_tenant
7430
+ ON lattice_collections(tenant_id)
7431
+ `);
7432
+ await client.query(`
7433
+ CREATE INDEX IF NOT EXISTS idx_lattice_collections_name
7434
+ ON lattice_collections(name)
7435
+ `);
7436
+ },
7437
+ down: async (client) => {
7438
+ await client.query("DROP INDEX IF EXISTS idx_lattice_collections_name");
7439
+ await client.query("DROP INDEX IF EXISTS idx_lattice_collections_tenant");
7440
+ await client.query("DROP TABLE IF EXISTS lattice_collections");
7441
+ }
7442
+ };
7443
+
7197
7444
  // src/createPgStoreConfig.ts
7198
7445
  async function createPgStoreConfig(connectionString) {
7199
- const pool = new import_pg21.Pool({ connectionString });
7446
+ const pool = new import_pg23.Pool({ connectionString });
7200
7447
  const mm = new MigrationManager(pool);
7201
7448
  mm.register(createThreadsTable);
7202
7449
  mm.register(createScheduledTasksTable);
@@ -7240,6 +7487,7 @@ async function createPgStoreConfig(connectionString) {
7240
7487
  mm.register(createMenuItemsTable);
7241
7488
  mm.register(createSharedResourcesTable);
7242
7489
  mm.register(addFileContentType);
7490
+ mm.register(createCollectionsTable);
7243
7491
  await mm.migrate();
7244
7492
  const checkpoint = import_langgraph_checkpoint_postgres.PostgresSaver.fromConnString(connectionString);
7245
7493
  checkpoint.setup().catch((err) => {
@@ -7267,12 +7515,14 @@ async function createPgStoreConfig(connectionString) {
7267
7515
  schedule: new PostgreSQLScheduleStorage(opts),
7268
7516
  menu: new MenuStore(opts),
7269
7517
  sharedResource: new PostgresSharedResourceStore(opts),
7518
+ collection: new PostgreSQLCollectionStore(opts),
7519
+ vectorStoreProvider: new PGVectorStoreProvider(pool, connectionString),
7270
7520
  checkpoint
7271
7521
  };
7272
7522
  }
7273
7523
 
7274
7524
  // src/stores/PostgreSQLSkillStore.ts
7275
- var import_pg22 = require("pg");
7525
+ var import_pg24 = require("pg");
7276
7526
  var PostgreSQLSkillStore = class {
7277
7527
  constructor(options) {
7278
7528
  this.initialized = false;
@@ -7285,9 +7535,9 @@ var PostgreSQLSkillStore = class {
7285
7535
  return;
7286
7536
  }
7287
7537
  if (typeof options.poolConfig === "string") {
7288
- this.pool = new import_pg22.Pool({ connectionString: options.poolConfig });
7538
+ this.pool = new import_pg24.Pool({ connectionString: options.poolConfig });
7289
7539
  } else if (options.poolConfig) {
7290
- this.pool = new import_pg22.Pool(options.poolConfig);
7540
+ this.pool = new import_pg24.Pool(options.poolConfig);
7291
7541
  } else {
7292
7542
  throw new Error("Either pool or poolConfig must be provided");
7293
7543
  }
@@ -7588,7 +7838,7 @@ var PostgreSQLSkillStore = class {
7588
7838
  };
7589
7839
 
7590
7840
  // src/stores/ChannelIdentityMappingStore.ts
7591
- var import_pg23 = require("pg");
7841
+ var import_pg25 = require("pg");
7592
7842
  var ChannelIdentityMappingStore = class {
7593
7843
  constructor(options) {
7594
7844
  this.initialized = false;
@@ -7600,7 +7850,7 @@ var ChannelIdentityMappingStore = class {
7600
7850
  this.initialized = true;
7601
7851
  return;
7602
7852
  }
7603
- this.pool = typeof options.poolConfig === "string" ? new import_pg23.Pool({ connectionString: options.poolConfig }) : options.poolConfig ? new import_pg23.Pool(options.poolConfig) : (() => {
7853
+ this.pool = typeof options.poolConfig === "string" ? new import_pg25.Pool({ connectionString: options.poolConfig }) : options.poolConfig ? new import_pg25.Pool(options.poolConfig) : (() => {
7604
7854
  throw new Error("Either pool or poolConfig must be provided");
7605
7855
  })();
7606
7856
  this.migrationManager = new MigrationManager(this.pool);
@@ -7824,10 +8074,12 @@ function mapRowToChannelIdentityMapping(row) {
7824
8074
  ChannelIdentityMappingStore,
7825
8075
  MenuStore,
7826
8076
  MigrationManager,
8077
+ PGVectorStoreProvider,
7827
8078
  Pool,
7828
8079
  PostgreSQLA2AApiKeyStore,
7829
8080
  PostgreSQLAssistantStore,
7830
8081
  PostgreSQLChannelInstallationStore,
8082
+ PostgreSQLCollectionStore,
7831
8083
  PostgreSQLDatabaseConfigStore,
7832
8084
  PostgreSQLEvalStore,
7833
8085
  PostgreSQLMcpServerConfigStore,
@@ -7859,6 +8111,7 @@ function mapRowToChannelIdentityMapping(row) {
7859
8111
  createChannelBindingsTable,
7860
8112
  createChannelIdentityMappingTables,
7861
8113
  createChannelInstallationsTable,
8114
+ createCollectionsTable,
7862
8115
  createDatabaseConfigsTable,
7863
8116
  createEvalCasesTable,
7864
8117
  createEvalProjectsTable,
@@ -7868,6 +8121,7 @@ function mapRowToChannelIdentityMapping(row) {
7868
8121
  createMcpServerConfigsTable,
7869
8122
  createMenuItemsTable,
7870
8123
  createMetricsConfigsTable,
8124
+ createPGVectorStoreProvider,
7871
8125
  createPgStoreConfig,
7872
8126
  createProjectsTable,
7873
8127
  createScheduledTasksTable,