@axiom-lattice/pg-stores 3.1.1 → 3.1.2

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 (41) hide show
  1. package/.turbo/turbo-build.log +10 -10
  2. package/CHANGELOG.md +9 -0
  3. package/dist/index.d.mts +195 -15
  4. package/dist/index.d.ts +195 -15
  5. package/dist/index.js +1309 -199
  6. package/dist/index.js.map +1 -1
  7. package/dist/index.mjs +1295 -191
  8. package/dist/index.mjs.map +1 -1
  9. package/package.json +3 -3
  10. package/src/__tests__/ChannelBindingStore.test.ts +122 -0
  11. package/src/__tests__/PostgreSQLChannelInstallationStore.test.ts +16 -0
  12. package/src/__tests__/PostgreSQLProjectBotMembershipStore.test.ts +117 -0
  13. package/src/__tests__/PostgreSQLProjectMembershipStore.test.ts +235 -0
  14. package/src/__tests__/PostgreSQLProjectRoomMessageStore.test.ts +103 -0
  15. package/src/__tests__/PostgreSQLProjectRoomStore.migrations.test.ts +114 -0
  16. package/src/__tests__/PostgreSQLProjectRoomStore.test.ts +48 -0
  17. package/src/__tests__/PostgreSQLTaskStore.integration.test.ts +27 -0
  18. package/src/__tests__/PostgreSQLTaskStore.test.ts +57 -0
  19. package/src/__tests__/PostgreSQLTaskWorkItemStore.integration.test.ts +74 -0
  20. package/src/__tests__/PostgreSQLTaskWorkItemStore.migrations.test.ts +62 -0
  21. package/src/__tests__/PostgreSQLTaskWorkItemStore.test.ts +96 -0
  22. package/src/__tests__/ThreadMessageQueueStore.migrations.test.ts +63 -0
  23. package/src/__tests__/ThreadMessageQueueStore.test.ts +113 -0
  24. package/src/__tests__/migration-name-version-compatibility.test.ts +67 -0
  25. package/src/__tests__/task-files.test.ts +4 -3
  26. package/src/createPgStoreConfig.ts +14 -0
  27. package/src/index.ts +7 -0
  28. package/src/migrations/add_trusted_run_context_column.ts +18 -0
  29. package/src/migrations/migration.ts +2 -1
  30. package/src/migrations/project_room_migration.ts +128 -0
  31. package/src/migrations/task_migration.ts +15 -0
  32. package/src/migrations/task_work_items_migration.ts +29 -1
  33. package/src/stores/ChannelBindingStore.ts +99 -59
  34. package/src/stores/PostgreSQLChannelInstallationStore.ts +12 -30
  35. package/src/stores/PostgreSQLProjectBotMembershipStore.ts +199 -0
  36. package/src/stores/PostgreSQLProjectMembershipStore.ts +140 -0
  37. package/src/stores/PostgreSQLProjectRoomMessageStore.ts +177 -0
  38. package/src/stores/PostgreSQLProjectRoomStore.ts +57 -0
  39. package/src/stores/PostgreSQLTaskStore.ts +89 -3
  40. package/src/stores/PostgreSQLTaskWorkItemStore.ts +159 -8
  41. package/src/stores/ThreadMessageQueueStore.ts +38 -9
@@ -1,5 +1,5 @@
1
1
 
2
- > @axiom-lattice/pg-stores@3.1.1 build /home/runner/work/agentic/agentic/packages/pg-stores
2
+ > @axiom-lattice/pg-stores@3.1.2 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
- ESM dist/index.mjs 323.12 KB
12
- ESM dist/index.mjs.map 608.59 KB
13
- ESM ⚡️ Build success in 787ms
14
- CJS dist/index.js 330.16 KB
15
- CJS dist/index.js.map 608.90 KB
16
- CJS ⚡️ Build success in 787ms
11
+ ESM dist/index.mjs 372.32 KB
12
+ ESM dist/index.mjs.map 692.52 KB
13
+ ESM ⚡️ Build success in 1081ms
14
+ CJS dist/index.js 380.26 KB
15
+ CJS dist/index.js.map 692.90 KB
16
+ CJS ⚡️ Build success in 1137ms
17
17
  DTS Build start
18
- DTS ⚡️ Build success in 18255ms
19
- DTS dist/index.d.ts 69.14 KB
20
- DTS dist/index.d.mts 69.14 KB
18
+ DTS ⚡️ Build success in 18304ms
19
+ DTS dist/index.d.ts 78.61 KB
20
+ DTS dist/index.d.mts 78.61 KB
package/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # @axiom-lattice/pg-stores
2
2
 
3
+ ## 3.1.2
4
+
5
+ ### Patch Changes
6
+
7
+ - 08bf26a: update metric builder
8
+ - Updated dependencies [08bf26a]
9
+ - @axiom-lattice/core@4.2.2
10
+ - @axiom-lattice/protocols@4.1.2
11
+
3
12
  ## 3.1.1
4
13
 
5
14
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -1,7 +1,7 @@
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, ConnectionStore, ConnectionEntry, MetricsServerConfigStore, MetricsServerConfigEntry, CreateMetricsServerConfigRequest, UpdateMetricsServerConfigRequest, McpServerConfigStore, McpServerConfigEntry, CreateMcpServerConfigRequest, UpdateMcpServerConfigRequest, WorkspaceStore, Workspace, CreateWorkspaceRequest, UpdateWorkspaceRequest, ProjectStore, ProjectFilter, Project, CreateProjectRequest, UpdateProjectRequest, UpdateProjectCapabilityBundlesResult, UserStore, User, CreateUserRequest, UpdateUserRequest, TenantStore, Tenant, CreateTenantRequest, UpdateTenantRequest, UserTenantLinkStore, UserTenantLink, CreateUserTenantLinkRequest, UpdateUserTenantLinkRequest, WorkflowTrackingStore, CreateWorkflowRunRequest, WorkflowRun, UpdateWorkflowRunRequest, QueryWorkflowRunsOptions, QueryWorkflowRunsResult, 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, AgentWebAppStore, AgentWebApp, CreateAgentWebAppInput, AgentWebAppStorePatch, AgentWebAppUpdateOptions, ScheduleStorage, ScheduledTaskDefinition, ScheduledTaskStatus, ScheduleExecutionType, TaskStore, CreateTaskRequest, TaskItem, TaskListFilter, UpdateTaskRequest, TaskWorkItemStore, CreateWorkItemRequest, TaskWorkItem, CreateWorkItemIfAbsentRequest, TaskWorkItemListFilter, MenuRegistry, MenuItem, CreateMenuItemInput, UpdateMenuItemInput, SharedResourceStore, ShareRecord, CollectionStore, Collection, CreateCollectionRequest, UpdateCollectionRequest, VectorStoreProvider, VectorStoreCreateParams, CapabilityBundleStore, CapabilityBundle, InternalCreateCapabilityBundleInput, InternalUpdateCapabilityBundleInput, CapabilityBundleDeleteResult, SkillStore, Skill, CreateSkillRequest } from '@axiom-lattice/protocols';
4
- export { AgentWebApp, AgentWebAppAppearance, AgentWebAppFeatures, AgentWebAppScope, AgentWebAppStatus, AgentWebAppStore, Assistant, AssistantStore, Binding, BindingRegistry, CapabilityBundle, CapabilityBundleStore, ChannelInstallation, ChannelInstallationStore, ConnectionEntry, ConnectionStore, CreateAgentWebAppInput, CreateAssistantRequest, CreateBindingInput, CreateCapabilityBundleInput, 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, UpdateAgentWebAppInput, UpdateCapabilityBundleInput, UpdateChannelInstallationRequest, UpdateDatabaseConfigRequest, UpdateMcpServerConfigRequest, UpdateMetricsServerConfigRequest, UpdateProjectRequest, UpdateRunStepRequest, UpdateTenantRequest, UpdateUserRequest, UpdateUserTenantLinkRequest, UpdateWorkflowRunRequest, UpdateWorkspaceRequest, User, UserStore, UserTenantLink, UserTenantLinkStore, UserTenantRole, WorkflowRun, WorkflowTrackingStore, Workspace, WorkspaceStore } from '@axiom-lattice/protocols';
3
+ import { ThreadStore, Thread, CreateThreadRequest, AssistantStore, Assistant, CreateAssistantRequest, DatabaseConfigStore, DatabaseConfigEntry, CreateDatabaseConfigRequest, UpdateDatabaseConfigRequest, ConnectionStore, ConnectionEntry, MetricsServerConfigStore, MetricsServerConfigEntry, CreateMetricsServerConfigRequest, UpdateMetricsServerConfigRequest, McpServerConfigStore, McpServerConfigEntry, CreateMcpServerConfigRequest, UpdateMcpServerConfigRequest, WorkspaceStore, Workspace, CreateWorkspaceRequest, UpdateWorkspaceRequest, ProjectStore, ProjectFilter, Project, CreateProjectRequest, UpdateProjectRequest, UpdateProjectCapabilityBundlesResult, UserStore, User, CreateUserRequest, UpdateUserRequest, TenantStore, Tenant, CreateTenantRequest, UpdateTenantRequest, UserTenantLinkStore, UserTenantLink, CreateUserTenantLinkRequest, UpdateUserTenantLinkRequest, WorkflowTrackingStore, CreateWorkflowRunRequest, WorkflowRun, UpdateWorkflowRunRequest, QueryWorkflowRunsOptions, QueryWorkflowRunsResult, CreateRunStepRequest, RunStep, UpdateRunStepRequest, StepType, EvalStore, EvalProject, CreateEvalProjectRequest, EvalSuite, CreateEvalSuiteRequest, EvalCase, CreateEvalCaseRequest, EvalRun, CreateEvalRunRequest, EvalRunResult, EvalProjectReport, BindingRegistry, Binding, CreateBindingInput, BindingMutablePatch, BindingListParams, ChannelInstallationStore, ChannelInstallation, ChannelInstallationType, CreateChannelInstallationInput, UpdateChannelInstallationRequest, A2AApiKeyStore, A2AApiKeyRecord, CreateA2AApiKeyInput, A2AApiKeyEntry, AgentWebAppStore, AgentWebApp, CreateAgentWebAppInput, AgentWebAppStorePatch, AgentWebAppUpdateOptions, ScheduleStorage, ScheduledTaskDefinition, ScheduledTaskStatus, ScheduleExecutionType, TaskStore, CreateTaskRequest, TaskItem, TaskListFilter, TaskDependentListQuery, UpdateTaskRequest, TaskMutationSnapshot, TaskWorkItemStore, CreateWorkItemRequest, TaskWorkItem, CreateWorkItemIfAbsentRequest, TaskWorkItemListFilter, ProjectLifecycleEventQuery, MenuRegistry, MenuItem, CreateMenuItemInput, UpdateMenuItemInput, SharedResourceStore, ShareRecord, CollectionStore, Collection, CreateCollectionRequest, UpdateCollectionRequest, VectorStoreProvider, VectorStoreCreateParams, CapabilityBundleStore, CapabilityBundle, InternalCreateCapabilityBundleInput, InternalUpdateCapabilityBundleInput, CapabilityBundleDeleteResult, ProjectRoomStore, ProjectRoom, ProjectMembershipStore, ProjectMembership, ProjectHumanRole, ProjectMembershipMutationResult, ProjectBotMembershipStore, ProjectBotMembership, ProjectRoomMessageStore, ProjectRoomMessage, SkillStore, Skill, CreateSkillRequest } from '@axiom-lattice/protocols';
4
+ export { AgentWebApp, AgentWebAppAppearance, AgentWebAppFeatures, AgentWebAppScope, AgentWebAppStatus, AgentWebAppStore, Assistant, AssistantStore, Binding, BindingRegistry, CapabilityBundle, CapabilityBundleStore, ChannelInstallation, ChannelInstallationStore, ConnectionEntry, ConnectionStore, CreateAgentWebAppInput, CreateAssistantRequest, CreateBindingInput, CreateCapabilityBundleInput, CreateChannelInstallationInput, 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, UpdateAgentWebAppInput, UpdateCapabilityBundleInput, 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, QueueScope, ThreadInfo } from '@axiom-lattice/core';
6
6
  export { AddMessageParams, PendingMessage, ThreadInfo } from '@axiom-lattice/core';
7
7
  import { PostgresSaver } from '@langchain/langgraph-checkpoint-postgres';
@@ -977,18 +977,18 @@ declare class ChannelBindingStore implements BindingRegistry {
977
977
  channelInstallationId: string;
978
978
  tenantId: string;
979
979
  }): Promise<Binding | null>;
980
- create(input: CreateBindingInput): Promise<Binding>;
981
- update(id: string, patch: Partial<Binding>): Promise<Binding>;
982
- delete(id: string): Promise<void>;
983
- list(params: {
984
- channel?: string;
985
- agentId?: string;
980
+ findById(tenantId: string, id: string): Promise<Binding | null>;
981
+ findBySubject(params: {
986
982
  tenantId: string;
987
- channelInstallationId?: string;
988
- limit?: number;
989
- offset?: number;
990
- }): Promise<Binding[]>;
991
- import(bindings: CreateBindingInput[]): Promise<Binding[]>;
983
+ channel: string;
984
+ channelInstallationId: string;
985
+ senderId: string;
986
+ }): Promise<Binding | null>;
987
+ create(input: CreateBindingInput): Promise<Binding>;
988
+ update(tenantId: string, id: string, patch: BindingMutablePatch): Promise<Binding>;
989
+ delete(tenantId: string, id: string): Promise<void>;
990
+ list(params: BindingListParams): Promise<Binding[]>;
991
+ import(tenantId: string, bindings: CreateBindingInput[]): Promise<Binding[]>;
992
992
  export(params: {
993
993
  tenantId: string;
994
994
  }): Promise<Binding[]>;
@@ -1013,7 +1013,7 @@ declare class PostgreSQLChannelInstallationStore implements ChannelInstallationS
1013
1013
  getInstallationById(installationId: string): Promise<ChannelInstallation | null>;
1014
1014
  getInstallationsByTenant(tenantId: string, channel?: ChannelInstallationType): Promise<ChannelInstallation[]>;
1015
1015
  getAllInstallations(channel?: ChannelInstallationType): Promise<ChannelInstallation[]>;
1016
- createInstallation(tenantId: string, installationId: string, data: CreateChannelInstallationRequest): Promise<ChannelInstallation>;
1016
+ createInstallation(tenantId: string, installationId: string, data: CreateChannelInstallationInput): Promise<ChannelInstallation>;
1017
1017
  updateInstallation(tenantId: string, installationId: string, updates: UpdateChannelInstallationRequest): Promise<ChannelInstallation | null>;
1018
1018
  deleteInstallation(tenantId: string, installationId: string): Promise<boolean>;
1019
1019
  private ensureInitialized;
@@ -1222,6 +1222,8 @@ declare class PostgreSQLTaskStore implements TaskStore {
1222
1222
  }): Promise<TaskItem>;
1223
1223
  getById(tenantId: string, id: string): Promise<TaskItem | null>;
1224
1224
  list(filter: TaskListFilter): Promise<TaskItem[]>;
1225
+ /** Lists exact project tasks containing a JSON string dependency. */
1226
+ listDependents(query: TaskDependentListQuery): Promise<TaskItem[]>;
1225
1227
  update(tenantId: string, id: string, updates: UpdateTaskRequest): Promise<TaskItem | null>;
1226
1228
  /**
1227
1229
  * Atomically update a task unless its current status is blocked.
@@ -1237,17 +1239,44 @@ declare class PostgreSQLTaskStore implements TaskStore {
1237
1239
  updateIfStatusIn(tenantId: string, id: string, updates: UpdateTaskRequest, expectedStatuses: TaskItem["status"][]): Promise<TaskItem | null>;
1238
1240
  /** Atomically update a task only when status and updatedAt match a read snapshot. */
1239
1241
  updateIfStatusAndUpdatedAt(tenantId: string, id: string, updates: UpdateTaskRequest, expectedStatuses: TaskItem["status"][], expectedUpdatedAt: Date | string): Promise<TaskItem | null>;
1242
+ /** Atomically update only while status, timestamp, owner, and Project scope match. */
1243
+ updateIfSnapshot(tenantId: string, id: string, updates: UpdateTaskRequest, snapshot: TaskMutationSnapshot): Promise<TaskItem | null>;
1240
1244
  /** Atomically update a child only when both child and parent snapshots match. */
1241
1245
  updateIfStatusUpdatedAtAndParentUpdatedAt(tenantId: string, id: string, updates: UpdateTaskRequest, expectedStatuses: TaskItem["status"][], expectedUpdatedAt: Date | string, parentId: string, expectedParentUpdatedAt: Date | string): Promise<TaskItem | null>;
1242
1246
  delete(tenantId: string, id: string): Promise<boolean>;
1247
+ /** Atomically delete only while status, timestamp, owner, and Project scope match. */
1248
+ deleteIfSnapshot(tenantId: string, id: string, snapshot: TaskMutationSnapshot): Promise<boolean>;
1243
1249
  dispose(): Promise<void>;
1244
1250
  private ensureInitialized;
1245
1251
  }
1246
1252
 
1253
+ /** PostgreSQL TaskWorkItem store connection and migration options. */
1254
+ interface PostgreSQLTaskWorkItemStoreOptions {
1255
+ /** External caller-owned pool; central migrations must already be applied. */
1256
+ pool?: Pool;
1257
+ /** Connection configuration for a standalone, store-owned pool. */
1258
+ poolConfig?: string | PoolConfig;
1259
+ /** Whether a standalone store eagerly applies migrations. Defaults to true. */
1260
+ autoMigrate?: boolean;
1261
+ }
1262
+ /** PostgreSQL TaskWorkItem persistence with optional standalone migrations. */
1247
1263
  declare class PostgreSQLTaskWorkItemStore implements TaskWorkItemStore {
1248
1264
  private pool;
1265
+ private migrationManager;
1266
+ private initialized;
1267
+ private ownsPool;
1268
+ private initPromise;
1249
1269
  constructor(pool: Pool);
1270
+ constructor(options: PostgreSQLTaskWorkItemStoreOptions);
1271
+ /** Applies the complete standalone TaskWorkItem migration chain once. */
1272
+ initialize(): Promise<void>;
1273
+ /** Closes the pool only when this store created it from connection configuration. */
1274
+ dispose(): Promise<void>;
1275
+ private startInitialization;
1276
+ private ensureInitialized;
1250
1277
  create(params: CreateWorkItemRequest): Promise<TaskWorkItem>;
1278
+ /** Atomically inserts a work item by selecting one exact task snapshot. */
1279
+ createIfTaskSnapshot(params: CreateWorkItemRequest, snapshot: TaskMutationSnapshot): Promise<TaskWorkItem | null>;
1251
1280
  /** Find an event by its tenant- and task-scoped key without pagination. */
1252
1281
  findByEventKey(tenantId: string, taskId: string, eventKey: string): Promise<TaskWorkItem | null>;
1253
1282
  /** Atomically return an existing event or create it once. */
@@ -1259,6 +1288,9 @@ declare class PostgreSQLTaskWorkItemStore implements TaskWorkItemStore {
1259
1288
  taskId: string;
1260
1289
  limit: number;
1261
1290
  }): Promise<TaskWorkItem[]>;
1291
+ /** Lists canonical project lifecycle events with an exclusive cursor. */
1292
+ listProjectLifecycleEvents(query: ProjectLifecycleEventQuery): Promise<TaskWorkItem[]>;
1293
+ private assertProjectLifecycleEvent;
1262
1294
  private rowToItem;
1263
1295
  }
1264
1296
 
@@ -1436,6 +1468,147 @@ declare class PostgreSQLCapabilityBundleStore implements CapabilityBundleStore {
1436
1468
  deleteIfUnreferenced(tenantId: string, id: string): Promise<CapabilityBundleDeleteResult>;
1437
1469
  }
1438
1470
 
1471
+ /** Persists tenant-isolated canonical project main rooms in PostgreSQL. */
1472
+ declare class PostgreSQLProjectRoomStore implements ProjectRoomStore {
1473
+ /** Creates a store using an externally managed pool; the pool is not migrated or closed. */
1474
+ constructor(options: {
1475
+ pool: Pool;
1476
+ });
1477
+ private readonly pool;
1478
+ /** Creates or returns the single persisted main room for a project. */
1479
+ ensureMainRoom(input: {
1480
+ id: string;
1481
+ tenantId: string;
1482
+ workspaceId: string;
1483
+ projectId: string;
1484
+ name: string;
1485
+ }): Promise<ProjectRoom>;
1486
+ /** Finds a tenant-scoped project's main room, or returns null. */
1487
+ getMainRoom(tenantId: string, projectId: string): Promise<ProjectRoom | null>;
1488
+ }
1489
+
1490
+ /** Indicates that a tenant/project/user membership already exists. */
1491
+ declare class DuplicateProjectMembershipError extends Error {
1492
+ constructor();
1493
+ }
1494
+ /** Indicates that a membership ID already exists in the tenant. */
1495
+ declare class ProjectMembershipIdConflictError extends Error {
1496
+ constructor();
1497
+ }
1498
+ /** Persists tenant-isolated human project memberships in PostgreSQL. */
1499
+ declare class PostgreSQLProjectMembershipStore implements ProjectMembershipStore {
1500
+ /** Creates a store using an externally managed pool; the pool is not migrated or closed. */
1501
+ constructor(options: {
1502
+ pool: Pool;
1503
+ });
1504
+ private readonly pool;
1505
+ /** Lists memberships in stable joined-time and ID order. */
1506
+ list(tenantId: string, projectId: string): Promise<ProjectMembership[]>;
1507
+ /** Finds a membership by exact tenant, project, and user identity. */
1508
+ findByUser(tenantId: string, projectId: string, userId: string): Promise<ProjectMembership | null>;
1509
+ /** Inserts a membership and maps database uniqueness errors to stable typed errors. */
1510
+ create(input: Omit<ProjectMembership, "joinedAt" | "updatedAt">): Promise<ProjectMembership>;
1511
+ /** Atomically creates the first active owner while serializing the project scope. */
1512
+ createInitialOwner(input: Omit<ProjectMembership, "role" | "status" | "joinedAt" | "updatedAt">): Promise<{
1513
+ kind: "created" | "existing";
1514
+ membership: ProjectMembership;
1515
+ } | {
1516
+ kind: "already_initialized";
1517
+ }>;
1518
+ /** Updates a role under a project lock with exact timestamp and owner safeguards. */
1519
+ updateRole(input: {
1520
+ tenantId: string;
1521
+ id: string;
1522
+ role: ProjectHumanRole;
1523
+ expectedUpdatedAt: Date;
1524
+ }): Promise<ProjectMembershipMutationResult>;
1525
+ /** Marks a membership removed under a project lock with exact timestamp and owner safeguards. */
1526
+ remove(input: {
1527
+ tenantId: string;
1528
+ id: string;
1529
+ expectedUpdatedAt: Date;
1530
+ }): Promise<ProjectMembershipMutationResult>;
1531
+ private mutate;
1532
+ }
1533
+
1534
+ type ConstraintConflict = "coordinator_conflict" | "mention_conflict";
1535
+ /** Indicates that a new bot membership ID already exists in the tenant. */
1536
+ declare class ProjectBotMembershipIdConflictError extends Error {
1537
+ /** Creates an accurate tenant-scoped membership ID collision error. */
1538
+ constructor(tenantId: string, id: string);
1539
+ }
1540
+ /** Persists tenant-isolated project bot roster memberships in PostgreSQL. */
1541
+ declare class PostgreSQLProjectBotMembershipStore implements ProjectBotMembershipStore {
1542
+ /** Creates a store using an externally managed shared pool. */
1543
+ constructor(options: {
1544
+ pool: Pool;
1545
+ });
1546
+ private readonly pool;
1547
+ /** Lists retained memberships in stable join order. */
1548
+ list(tenantId: string, projectId: string): Promise<ProjectBotMembership[]>;
1549
+ /** Finds a membership by tenant-scoped ID. */
1550
+ findById(tenantId: string, id: string): Promise<ProjectBotMembership | null>;
1551
+ /** Finds an assistant's durable membership in a tenant-scoped project. */
1552
+ findByAssistant(tenantId: string, projectId: string, assistantId: string): Promise<ProjectBotMembership | null>;
1553
+ /** Inserts a new membership or reactivates the assistant's durable membership atomically. */
1554
+ save(input: Omit<ProjectBotMembership, "joinedAt" | "updatedAt">): Promise<{
1555
+ kind: "created" | "updated" | "reactivated";
1556
+ membership: ProjectBotMembership;
1557
+ } | {
1558
+ kind: ConstraintConflict;
1559
+ }>;
1560
+ /** Applies a mutable-field patch with project serialization and millisecond-safe optimistic concurrency. */
1561
+ update(input: {
1562
+ tenantId: string;
1563
+ id: string;
1564
+ patch: Partial<Pick<ProjectBotMembership, "role" | "title" | "responsibility" | "mentionName" | "status">>;
1565
+ expectedUpdatedAt: Date;
1566
+ }): Promise<{
1567
+ kind: "updated";
1568
+ membership: ProjectBotMembership;
1569
+ } | {
1570
+ kind: "not_found" | "conflict" | ConstraintConflict;
1571
+ }>;
1572
+ }
1573
+
1574
+ /** Indicates that a tenant-scoped room message ID already exists. */
1575
+ declare class ProjectRoomMessageIdConflictError extends Error {
1576
+ /** Creates an accurate tenant-scoped message ID collision error. */
1577
+ constructor(tenantId: string, id: string);
1578
+ }
1579
+ /** Indicates that ordinary creation reused a room-scoped idempotency key. */
1580
+ declare class DuplicateProjectRoomMessageIdempotencyKeyError extends Error {
1581
+ /** Creates an accurate tenant and room-scoped idempotency collision error. */
1582
+ constructor(tenantId: string, roomId: string, idempotencyKey: string);
1583
+ }
1584
+ /** Persists tenant-isolated project room messages in PostgreSQL. */
1585
+ declare class PostgreSQLProjectRoomMessageStore implements ProjectRoomMessageStore {
1586
+ /** Creates a store using an externally managed shared pool. */
1587
+ constructor(options: {
1588
+ pool: Pool;
1589
+ });
1590
+ private readonly pool;
1591
+ /** Creates a room message and maps known uniqueness failures to typed errors. */
1592
+ create(input: Omit<ProjectRoomMessage, "createdAt">): Promise<ProjectRoomMessage>;
1593
+ /** Atomically creates or returns the canonical message for a room-scoped idempotency key. */
1594
+ createIdempotent(input: Omit<ProjectRoomMessage, "createdAt"> & {
1595
+ idempotencyKey: string;
1596
+ }): Promise<ProjectRoomMessage>;
1597
+ /** Lists messages newest first using an exclusive stable cursor and a clamped limit. */
1598
+ list(input: {
1599
+ tenantId: string;
1600
+ roomId: string;
1601
+ before?: {
1602
+ createdAt: Date;
1603
+ id: string;
1604
+ };
1605
+ limit: number;
1606
+ }): Promise<ProjectRoomMessage[]>;
1607
+ /** Finds a message by tenant-scoped ID. */
1608
+ findById(tenantId: string, id: string): Promise<ProjectRoomMessage | null>;
1609
+ private parameters;
1610
+ }
1611
+
1439
1612
  declare function createPgStoreConfig(connectionString: string): Promise<{
1440
1613
  workspace: PostgreSQLWorkspaceStore;
1441
1614
  project: PostgreSQLProjectStore;
@@ -1462,6 +1635,10 @@ declare function createPgStoreConfig(connectionString: string): Promise<{
1462
1635
  menu: MenuStore;
1463
1636
  sharedResource: PostgresSharedResourceStore;
1464
1637
  collection: PostgreSQLCollectionStore;
1638
+ projectRoom: PostgreSQLProjectRoomStore;
1639
+ projectMembership: PostgreSQLProjectMembershipStore;
1640
+ projectBotMembership: PostgreSQLProjectBotMembershipStore;
1641
+ projectRoomMessage: PostgreSQLProjectRoomMessageStore;
1465
1642
  vectorStoreProvider: PGVectorStoreProvider;
1466
1643
  checkpoint: PostgresSaver;
1467
1644
  }>;
@@ -1947,4 +2124,7 @@ declare const addFileContentType: Migration;
1947
2124
 
1948
2125
  declare const createCollectionsTable: Migration;
1949
2126
 
1950
- export { ChannelBindingStore, type ChannelBindingStoreOptions, type ChannelIdentityMapping, ChannelIdentityMappingStore, type ChannelIdentityMappingStoreOptions, type CreateChannelIdentityMappingInput, MenuStore, type MenuStoreOptions, type Migration, MigrationManager, PGVectorStoreProvider, PostgreSQLA2AApiKeyStore, type PostgreSQLA2AApiKeyStoreOptions, PostgreSQLAgentWebAppStore, type PostgreSQLAgentWebAppStoreOptions, PostgreSQLAssistantStore, type PostgreSQLAssistantStoreOptions, PostgreSQLCapabilityBundleStore, type PostgreSQLCapabilityBundleStoreOptions, PostgreSQLChannelInstallationStore, type PostgreSQLChannelInstallationStoreOptions, PostgreSQLCollectionStore, type PostgreSQLCollectionStoreOptions, PostgreSQLConnectionStore, 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, addEnvToEvalRuns, addFileContentType, addHoldoutToEvalRuns, addInterruptColumnsToEval, addInterruptPolicyToEvalCases, addProjectConfigColumn, addScheduleTenantId, addSkillTenantId, addStepThreadId, addTaskIdToEvalRuns, addThreadTenantId, addWorkflowRunsTenantStatusUpdatedIndex, alterChannelInstallationsTable, changeAssistantPrimaryKey, changeSkillPrimaryKey, changeThreadPrimaryKey, createA2AApiKeysTable, createAgentWebAppsTable, createAssistantsTable, createCapabilityBundlesTable, 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, enforceUniqueEvalProjectName, evalMigrations, mapRowToRunStep, mapRowToWorkflowRun, safeParse };
2127
+ /** Creates the tenant-scoped project room, roster, and message tables. */
2128
+ declare const createProjectRoomTables: Migration;
2129
+
2130
+ export { ChannelBindingStore, type ChannelBindingStoreOptions, type ChannelIdentityMapping, ChannelIdentityMappingStore, type ChannelIdentityMappingStoreOptions, type CreateChannelIdentityMappingInput, DuplicateProjectMembershipError, DuplicateProjectRoomMessageIdempotencyKeyError, MenuStore, type MenuStoreOptions, type Migration, MigrationManager, PGVectorStoreProvider, PostgreSQLA2AApiKeyStore, type PostgreSQLA2AApiKeyStoreOptions, PostgreSQLAgentWebAppStore, type PostgreSQLAgentWebAppStoreOptions, PostgreSQLAssistantStore, type PostgreSQLAssistantStoreOptions, PostgreSQLCapabilityBundleStore, type PostgreSQLCapabilityBundleStoreOptions, PostgreSQLChannelInstallationStore, type PostgreSQLChannelInstallationStoreOptions, PostgreSQLCollectionStore, type PostgreSQLCollectionStoreOptions, PostgreSQLConnectionStore, PostgreSQLDatabaseConfigStore, type PostgreSQLDatabaseConfigStoreOptions, PostgreSQLEvalStore, type PostgreSQLEvalStoreOptions, PostgreSQLMcpServerConfigStore, type PostgreSQLMcpServerConfigStoreOptions, PostgreSQLMetricsServerConfigStore, type PostgreSQLMetricsServerConfigStoreOptions, PostgreSQLProjectBotMembershipStore, PostgreSQLProjectMembershipStore, PostgreSQLProjectRoomMessageStore, PostgreSQLProjectRoomStore, PostgreSQLProjectStore, type PostgreSQLProjectStoreOptions, PostgreSQLScheduleStorage, type PostgreSQLScheduleStorageOptions, PostgreSQLSkillStore, type PostgreSQLSkillStoreOptions, PostgreSQLTaskWorkItemStore, type PostgreSQLTaskWorkItemStoreOptions, PostgreSQLTenantStore, type PostgreSQLTenantStoreOptions, type PostgreSQLThreadMessageQueueStoreOptions, PostgreSQLThreadStore, type PostgreSQLThreadStoreOptions, PostgreSQLUserStore, type PostgreSQLUserStoreOptions, PostgreSQLUserTenantLinkStore, type PostgreSQLUserTenantLinkStoreOptions, PostgreSQLWorkflowTrackingStore, type PostgreSQLWorkflowTrackingStoreOptions, PostgreSQLWorkspaceStore, type PostgreSQLWorkspaceStoreOptions, PostgresSharedResourceStore, type PostgresSharedResourceStoreOptions, ProjectBotMembershipIdConflictError, ProjectMembershipIdConflictError, ProjectRoomMessageIdConflictError, ThreadMessageQueueStore, addAssistantTenantId, addEnvToEvalRuns, addFileContentType, addHoldoutToEvalRuns, addInterruptColumnsToEval, addInterruptPolicyToEvalCases, addProjectConfigColumn, addScheduleTenantId, addSkillTenantId, addStepThreadId, addTaskIdToEvalRuns, addThreadTenantId, addWorkflowRunsTenantStatusUpdatedIndex, alterChannelInstallationsTable, changeAssistantPrimaryKey, changeSkillPrimaryKey, changeThreadPrimaryKey, createA2AApiKeysTable, createAgentWebAppsTable, createAssistantsTable, createCapabilityBundlesTable, createChannelBindingsTable, createChannelIdentityMappingTables, createChannelInstallationsTable, createCollectionsTable, createDatabaseConfigsTable, createEvalCasesTable, createEvalProjectsTable, createEvalRunResultsTable, createEvalRunsTable, createEvalSuitesTable, createMcpServerConfigsTable, createMenuItemsTable, createMetricsConfigsTable, createPGVectorStoreProvider, createPgStoreConfig, createProjectRoomTables, createProjectsTable, createScheduledTasksTable, createSharedResourcesTable, createSkillsTable, createTenantsTable, createThreadMessageQueueTable, createThreadsTable, createUsersTable, createWorkflowTrackingTables, createWorkspacesTable, enforceUniqueEvalProjectName, evalMigrations, mapRowToRunStep, mapRowToWorkflowRun, safeParse };