@axiom-lattice/pg-stores 3.1.5 → 3.1.8

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@3.1.5 build /home/runner/work/agentic/agentic/packages/pg-stores
2
+ > @axiom-lattice/pg-stores@3.1.8 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 372.32 KB
12
- ESM dist/index.mjs.map 692.52 KB
13
- ESM ⚡️ Build success in 670ms
14
- CJS dist/index.js 380.26 KB
15
- CJS dist/index.js.map 692.90 KB
16
- CJS ⚡️ Build success in 684ms
11
+ CJS dist/index.js 386.24 KB
12
+ CJS dist/index.js.map 703.30 KB
13
+ CJS ⚡️ Build success in 1129ms
14
+ ESM dist/index.mjs 378.11 KB
15
+ ESM dist/index.mjs.map 702.91 KB
16
+ ESM ⚡️ Build success in 1130ms
17
17
  DTS Build start
18
- DTS ⚡️ Build success in 14498ms
19
- DTS dist/index.d.ts 78.61 KB
20
- DTS dist/index.d.mts 78.61 KB
18
+ DTS ⚡️ Build success in 18968ms
19
+ DTS dist/index.d.ts 79.89 KB
20
+ DTS dist/index.d.mts 79.89 KB
package/CHANGELOG.md CHANGED
@@ -1,5 +1,34 @@
1
1
  # @axiom-lattice/pg-stores
2
2
 
3
+ ## 3.1.8
4
+
5
+ ### Patch Changes
6
+
7
+ - a2a0615: feat: MCP server connection authentication — `McpServerConfig.headers` (http/sse, encrypted at rest) plumbed through stores, gateway connections, and the config form; env-variable editor for stdio; SSE deprecation hint in the form.
8
+ - af3dff0: fix web app
9
+ - Updated dependencies [a2a0615]
10
+ - Updated dependencies [af3dff0]
11
+ - @axiom-lattice/protocols@4.2.0
12
+ - @axiom-lattice/core@4.2.8
13
+
14
+ ## 3.1.7
15
+
16
+ ### Patch Changes
17
+
18
+ - 15d2469: fix issue
19
+ - Updated dependencies [15d2469]
20
+ - @axiom-lattice/core@4.2.7
21
+ - @axiom-lattice/protocols@4.1.5
22
+
23
+ ## 3.1.6
24
+
25
+ ### Patch Changes
26
+
27
+ - Updated dependencies [0ba5903]
28
+ - Updated dependencies [a787438]
29
+ - @axiom-lattice/core@4.2.6
30
+ - @axiom-lattice/protocols@4.1.4
31
+
3
32
  ## 3.1.5
4
33
 
5
34
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -1,6 +1,6 @@
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, 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';
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, ProjectRoomReadStateStore, ProjectRoomReadState, SkillStore, Skill, CreateSkillRequest } from '@axiom-lattice/protocols';
4
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';
@@ -1606,9 +1606,34 @@ declare class PostgreSQLProjectRoomMessageStore implements ProjectRoomMessageSto
1606
1606
  }): Promise<ProjectRoomMessage[]>;
1607
1607
  /** Finds a message by tenant-scoped ID. */
1608
1608
  findById(tenantId: string, id: string): Promise<ProjectRoomMessage | null>;
1609
+ /** Counts messages created strictly after a horizon, optionally excluding one human author. */
1610
+ countAfter(input: {
1611
+ tenantId: string;
1612
+ roomId: string;
1613
+ after: Date;
1614
+ excludeAuthorUserId?: string;
1615
+ }): Promise<number>;
1609
1616
  private parameters;
1610
1617
  }
1611
1618
 
1619
+ /** Persists tenant-isolated per-user project room read markers in PostgreSQL. */
1620
+ declare class PostgreSQLProjectRoomReadStateStore implements ProjectRoomReadStateStore {
1621
+ /** Creates a store using an externally managed shared pool. */
1622
+ constructor(options: {
1623
+ pool: Pool;
1624
+ });
1625
+ private readonly pool;
1626
+ /** Returns the user's read marker for a room, or null when never reported. */
1627
+ get(tenantId: string, roomId: string, userId: string): Promise<ProjectRoomReadState | null>;
1628
+ /** Upserts the marker monotonically using GREATEST so older reports never regress it. */
1629
+ markRead(input: {
1630
+ tenantId: string;
1631
+ roomId: string;
1632
+ userId: string;
1633
+ lastReadAt: Date;
1634
+ }): Promise<ProjectRoomReadState>;
1635
+ }
1636
+
1612
1637
  declare function createPgStoreConfig(connectionString: string): Promise<{
1613
1638
  workspace: PostgreSQLWorkspaceStore;
1614
1639
  project: PostgreSQLProjectStore;
@@ -1639,6 +1664,7 @@ declare function createPgStoreConfig(connectionString: string): Promise<{
1639
1664
  projectMembership: PostgreSQLProjectMembershipStore;
1640
1665
  projectBotMembership: PostgreSQLProjectBotMembershipStore;
1641
1666
  projectRoomMessage: PostgreSQLProjectRoomMessageStore;
1667
+ projectRoomReadState: PostgreSQLProjectRoomReadStateStore;
1642
1668
  vectorStoreProvider: PGVectorStoreProvider;
1643
1669
  checkpoint: PostgresSaver;
1644
1670
  }>;
@@ -2126,5 +2152,7 @@ declare const createCollectionsTable: Migration;
2126
2152
 
2127
2153
  /** Creates the tenant-scoped project room, roster, and message tables. */
2128
2154
  declare const createProjectRoomTables: Migration;
2155
+ /** Adds per-user, per-room read markers for unread counts. */
2156
+ declare const createProjectRoomReadStates: Migration;
2129
2157
 
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 };
2158
+ 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, PostgreSQLProjectRoomReadStateStore, 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, createProjectRoomReadStates, createProjectRoomTables, createProjectsTable, createScheduledTasksTable, createSharedResourcesTable, createSkillsTable, createTenantsTable, createThreadMessageQueueTable, createThreadsTable, createUsersTable, createWorkflowTrackingTables, createWorkspacesTable, enforceUniqueEvalProjectName, evalMigrations, mapRowToRunStep, mapRowToWorkflowRun, safeParse };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
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, 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';
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, ProjectRoomReadStateStore, ProjectRoomReadState, SkillStore, Skill, CreateSkillRequest } from '@axiom-lattice/protocols';
4
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';
@@ -1606,9 +1606,34 @@ declare class PostgreSQLProjectRoomMessageStore implements ProjectRoomMessageSto
1606
1606
  }): Promise<ProjectRoomMessage[]>;
1607
1607
  /** Finds a message by tenant-scoped ID. */
1608
1608
  findById(tenantId: string, id: string): Promise<ProjectRoomMessage | null>;
1609
+ /** Counts messages created strictly after a horizon, optionally excluding one human author. */
1610
+ countAfter(input: {
1611
+ tenantId: string;
1612
+ roomId: string;
1613
+ after: Date;
1614
+ excludeAuthorUserId?: string;
1615
+ }): Promise<number>;
1609
1616
  private parameters;
1610
1617
  }
1611
1618
 
1619
+ /** Persists tenant-isolated per-user project room read markers in PostgreSQL. */
1620
+ declare class PostgreSQLProjectRoomReadStateStore implements ProjectRoomReadStateStore {
1621
+ /** Creates a store using an externally managed shared pool. */
1622
+ constructor(options: {
1623
+ pool: Pool;
1624
+ });
1625
+ private readonly pool;
1626
+ /** Returns the user's read marker for a room, or null when never reported. */
1627
+ get(tenantId: string, roomId: string, userId: string): Promise<ProjectRoomReadState | null>;
1628
+ /** Upserts the marker monotonically using GREATEST so older reports never regress it. */
1629
+ markRead(input: {
1630
+ tenantId: string;
1631
+ roomId: string;
1632
+ userId: string;
1633
+ lastReadAt: Date;
1634
+ }): Promise<ProjectRoomReadState>;
1635
+ }
1636
+
1612
1637
  declare function createPgStoreConfig(connectionString: string): Promise<{
1613
1638
  workspace: PostgreSQLWorkspaceStore;
1614
1639
  project: PostgreSQLProjectStore;
@@ -1639,6 +1664,7 @@ declare function createPgStoreConfig(connectionString: string): Promise<{
1639
1664
  projectMembership: PostgreSQLProjectMembershipStore;
1640
1665
  projectBotMembership: PostgreSQLProjectBotMembershipStore;
1641
1666
  projectRoomMessage: PostgreSQLProjectRoomMessageStore;
1667
+ projectRoomReadState: PostgreSQLProjectRoomReadStateStore;
1642
1668
  vectorStoreProvider: PGVectorStoreProvider;
1643
1669
  checkpoint: PostgresSaver;
1644
1670
  }>;
@@ -2126,5 +2152,7 @@ declare const createCollectionsTable: Migration;
2126
2152
 
2127
2153
  /** Creates the tenant-scoped project room, roster, and message tables. */
2128
2154
  declare const createProjectRoomTables: Migration;
2155
+ /** Adds per-user, per-room read markers for unread counts. */
2156
+ declare const createProjectRoomReadStates: Migration;
2129
2157
 
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 };
2158
+ 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, PostgreSQLProjectRoomReadStateStore, 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, createProjectRoomReadStates, createProjectRoomTables, createProjectsTable, createScheduledTasksTable, createSharedResourcesTable, createSkillsTable, createTenantsTable, createThreadMessageQueueTable, createThreadsTable, createUsersTable, createWorkflowTrackingTables, createWorkspacesTable, enforceUniqueEvalProjectName, evalMigrations, mapRowToRunStep, mapRowToWorkflowRun, safeParse };
package/dist/index.js CHANGED
@@ -52,6 +52,7 @@ __export(index_exports, {
52
52
  PostgreSQLProjectBotMembershipStore: () => PostgreSQLProjectBotMembershipStore,
53
53
  PostgreSQLProjectMembershipStore: () => PostgreSQLProjectMembershipStore,
54
54
  PostgreSQLProjectRoomMessageStore: () => PostgreSQLProjectRoomMessageStore,
55
+ PostgreSQLProjectRoomReadStateStore: () => PostgreSQLProjectRoomReadStateStore,
55
56
  PostgreSQLProjectRoomStore: () => PostgreSQLProjectRoomStore,
56
57
  PostgreSQLProjectStore: () => PostgreSQLProjectStore,
57
58
  PostgreSQLScheduleStorage: () => PostgreSQLScheduleStorage,
@@ -104,6 +105,7 @@ __export(index_exports, {
104
105
  createMetricsConfigsTable: () => createMetricsConfigsTable,
105
106
  createPGVectorStoreProvider: () => createPGVectorStoreProvider,
106
107
  createPgStoreConfig: () => createPgStoreConfig,
108
+ createProjectRoomReadStates: () => createProjectRoomReadStates,
107
109
  createProjectRoomTables: () => createProjectRoomTables,
108
110
  createProjectsTable: () => createProjectsTable,
109
111
  createScheduledTasksTable: () => createScheduledTasksTable,
@@ -2139,6 +2141,18 @@ var PostgreSQLMcpServerConfigStore = class {
2139
2141
  throw new Error("Failed to decrypt MCP server configuration");
2140
2142
  }
2141
2143
  }
2144
+ if (config.headers && row.is_env_encrypted) {
2145
+ try {
2146
+ const decryptedHeaders = {};
2147
+ for (const [key, value] of Object.entries(config.headers)) {
2148
+ decryptedHeaders[key] = (0, import_core3.decrypt)(value);
2149
+ }
2150
+ config.headers = decryptedHeaders;
2151
+ } catch (error) {
2152
+ console.error("Failed to decrypt MCP server headers:", error);
2153
+ throw new Error("Failed to decrypt MCP server configuration");
2154
+ }
2155
+ }
2142
2156
  return {
2143
2157
  id: row.id,
2144
2158
  tenantId: row.tenant_id,
@@ -2167,6 +2181,14 @@ var PostgreSQLMcpServerConfigStore = class {
2167
2181
  configCopy.env = encryptedEnv;
2168
2182
  isEnvEncrypted = true;
2169
2183
  }
2184
+ if (configCopy.headers && Object.keys(configCopy.headers).length > 0) {
2185
+ const encryptedHeaders = {};
2186
+ for (const [key, value] of Object.entries(configCopy.headers)) {
2187
+ encryptedHeaders[key] = (0, import_core3.encrypt)(value);
2188
+ }
2189
+ configCopy.headers = encryptedHeaders;
2190
+ isEnvEncrypted = true;
2191
+ }
2170
2192
  return { config: configCopy, isEnvEncrypted };
2171
2193
  }
2172
2194
  };
@@ -6436,6 +6458,22 @@ var createAgentWebAppsTable = {
6436
6458
  }
6437
6459
  };
6438
6460
 
6461
+ // src/migrations/add_agent_web_apps_identity_migration.ts
6462
+ var addAgentWebAppsIdentity = {
6463
+ version: 176,
6464
+ name: "add_agent_web_apps_identity",
6465
+ up: async (client) => {
6466
+ await client.query(
6467
+ "ALTER TABLE lattice_agent_web_apps ADD COLUMN IF NOT EXISTS identity JSONB"
6468
+ );
6469
+ },
6470
+ down: async (client) => {
6471
+ await client.query(
6472
+ "ALTER TABLE lattice_agent_web_apps DROP COLUMN IF EXISTS identity"
6473
+ );
6474
+ }
6475
+ };
6476
+
6439
6477
  // src/stores/PostgreSQLAgentWebAppStore.ts
6440
6478
  function isRecord(value) {
6441
6479
  return typeof value === "object" && value !== null && !Array.isArray(value);
@@ -6450,16 +6488,23 @@ function isScope(value) {
6450
6488
  return isRecord(value) && typeof value.defaultProjectId === "string" && isStringArray(value.allowedProjectIds) && (value.defaultModelKey === void 0 || typeof value.defaultModelKey === "string") && (value.allowedModelKeys === void 0 || isStringArray(value.allowedModelKeys));
6451
6489
  }
6452
6490
  function isFeatures(value) {
6453
- return isRecord(value) && typeof value.projectSelector === "boolean" && typeof value.modelSelector === "boolean" && typeof value.threadManagement === "boolean" && typeof value.attachments === "boolean" && typeof value.hitl === "boolean" && typeof value.genUI === "boolean";
6491
+ return isRecord(value) && typeof value.projectSelector === "boolean" && typeof value.modelSelector === "boolean" && typeof value.threadManagement === "boolean" && typeof value.attachments === "boolean" && typeof value.hitl === "boolean" && typeof value.genUI === "boolean" && (value.files === void 0 || typeof value.files === "boolean");
6454
6492
  }
6455
6493
  function isAppearance(value) {
6456
6494
  return isRecord(value) && (value.title === void 0 || typeof value.title === "string") && (value.welcomeMessage === void 0 || typeof value.welcomeMessage === "string") && (value.primaryColor === void 0 || typeof value.primaryColor === "string");
6457
6495
  }
6496
+ function isIdentity(value) {
6497
+ if (value === null || value === void 0) return true;
6498
+ if (!isRecord(value)) return false;
6499
+ const policyOk = value.policy === "unverified" || value.policy === "verified" || value.policy === "both";
6500
+ const issuersOk = Array.isArray(value.issuers) && value.issuers.every((issuer) => isRecord(issuer) && typeof issuer.iss === "string" && typeof issuer.aud === "string" && (issuer.alg === "HS256" || issuer.alg === "RS256"));
6501
+ return policyOk && issuersOk;
6502
+ }
6458
6503
  function isStatus(value) {
6459
6504
  return value === "draft" || value === "active" || value === "disabled";
6460
6505
  }
6461
6506
  function mapRow(row) {
6462
- if (!isStatus(row.status) || !isIntegration(row.integration) || !isScope(row.scope) || !isFeatures(row.features) || !isAppearance(row.appearance)) {
6507
+ if (!isStatus(row.status) || !isIntegration(row.integration) || !isScope(row.scope) || !isFeatures(row.features) || !isAppearance(row.appearance) || !isIdentity(row.identity)) {
6463
6508
  throw new Error(`Invalid agent web app row: ${row.id}`);
6464
6509
  }
6465
6510
  return {
@@ -6473,6 +6518,7 @@ function mapRow(row) {
6473
6518
  scope: row.scope,
6474
6519
  features: row.features,
6475
6520
  appearance: row.appearance,
6521
+ identity: row.identity === null ? void 0 : row.identity,
6476
6522
  createdAt: row.created_at,
6477
6523
  updatedAt: row.updated_at
6478
6524
  };
@@ -6493,6 +6539,7 @@ var PostgreSQLAgentWebAppStore = class {
6493
6539
  })();
6494
6540
  this.migrationManager = new MigrationManager(this.pool);
6495
6541
  this.migrationManager.register(createAgentWebAppsTable);
6542
+ this.migrationManager.register(addAgentWebAppsIdentity);
6496
6543
  if (options.autoMigrate !== false) {
6497
6544
  this.startInitialization();
6498
6545
  }
@@ -6553,8 +6600,8 @@ var PostgreSQLAgentWebAppStore = class {
6553
6600
  const id = `webapp_${(0, import_crypto3.randomUUID)().replace(/-/g, "")}`;
6554
6601
  const result = await this.pool.query(
6555
6602
  `INSERT INTO lattice_agent_web_apps
6556
- (id, tenant_id, assistant_id, name, description, status, integration, scope, features, appearance)
6557
- VALUES ($1, $2, $3, $4, $5, $6, $7::jsonb, $8::jsonb, $9::jsonb, $10::jsonb)
6603
+ (id, tenant_id, assistant_id, name, description, status, integration, scope, features, appearance, identity)
6604
+ VALUES ($1, $2, $3, $4, $5, $6, $7::jsonb, $8::jsonb, $9::jsonb, $10::jsonb, $11::jsonb)
6558
6605
  RETURNING *`,
6559
6606
  [
6560
6607
  id,
@@ -6566,7 +6613,8 @@ var PostgreSQLAgentWebAppStore = class {
6566
6613
  JSON.stringify(input.integration),
6567
6614
  JSON.stringify(input.scope),
6568
6615
  JSON.stringify(input.features),
6569
- JSON.stringify(input.appearance)
6616
+ JSON.stringify(input.appearance),
6617
+ input.identity ? JSON.stringify(input.identity) : null
6570
6618
  ]
6571
6619
  );
6572
6620
  return mapRow(result.rows[0]);
@@ -6592,6 +6640,9 @@ var PostgreSQLAgentWebAppStore = class {
6592
6640
  if (patch.appearance !== void 0) {
6593
6641
  add("appearance", JSON.stringify(patch.appearance));
6594
6642
  }
6643
+ if (patch.identity !== void 0) {
6644
+ add("identity", JSON.stringify(patch.identity));
6645
+ }
6595
6646
  if (patch.status !== void 0) add("status", patch.status);
6596
6647
  if (assignments.length === 0) return this.getById(tenantId, webAppId);
6597
6648
  values.push(tenantId, webAppId);
@@ -9671,6 +9722,30 @@ var createProjectRoomTables = {
9671
9722
  await client.query("DROP TABLE IF EXISTS lattice_project_rooms");
9672
9723
  }
9673
9724
  };
9725
+ var createProjectRoomReadStates = {
9726
+ version: 177,
9727
+ name: "create_project_room_read_states",
9728
+ up: async (client) => {
9729
+ await client.query(`
9730
+ CREATE TABLE IF NOT EXISTS lattice_project_room_read_states (
9731
+ tenant_id VARCHAR(255) NOT NULL,
9732
+ room_id VARCHAR(255) NOT NULL,
9733
+ user_id VARCHAR(255) NOT NULL,
9734
+ last_read_at TIMESTAMPTZ NOT NULL,
9735
+ updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
9736
+ PRIMARY KEY (tenant_id, room_id, user_id)
9737
+ )
9738
+ `);
9739
+ await client.query(`
9740
+ CREATE INDEX IF NOT EXISTS idx_lattice_project_room_read_states_user
9741
+ ON lattice_project_room_read_states (tenant_id, user_id)
9742
+ `);
9743
+ },
9744
+ down: async (client) => {
9745
+ await client.query("DROP INDEX IF EXISTS idx_lattice_project_room_read_states_user");
9746
+ await client.query("DROP TABLE IF EXISTS lattice_project_room_read_states");
9747
+ }
9748
+ };
9674
9749
 
9675
9750
  // src/stores/PostgreSQLCapabilityBundleStore.ts
9676
9751
  var import_crypto4 = require("crypto");
@@ -10458,6 +10533,19 @@ var PostgreSQLProjectRoomMessageStore = class {
10458
10533
  );
10459
10534
  return result.rows[0] ? mapRow5(result.rows[0]) : null;
10460
10535
  }
10536
+ /** Counts messages created strictly after a horizon, optionally excluding one human author. */
10537
+ async countAfter(input) {
10538
+ if (!(input.after instanceof Date) || Number.isNaN(input.after.getTime())) {
10539
+ throw new RangeError("Project room message count horizon date is invalid");
10540
+ }
10541
+ const result = await this.pool.query(
10542
+ `SELECT COUNT(*)::int AS count FROM lattice_project_room_messages
10543
+ WHERE tenant_id = $1 AND room_id = $2 AND created_at > $3
10544
+ AND ($4::text IS NULL OR author->>'type' <> 'human' OR author->>'userId' <> $4)`,
10545
+ [input.tenantId, input.roomId, input.after, input.excludeAuthorUserId ?? null]
10546
+ );
10547
+ return result.rows[0]?.count ?? 0;
10548
+ }
10461
10549
  parameters(input) {
10462
10550
  return [
10463
10551
  input.id,
@@ -10476,6 +10564,45 @@ var PostgreSQLProjectRoomMessageStore = class {
10476
10564
  }
10477
10565
  };
10478
10566
 
10567
+ // src/stores/PostgreSQLProjectRoomReadStateStore.ts
10568
+ function mapRow6(row) {
10569
+ if (typeof row.tenant_id !== "string" || typeof row.room_id !== "string" || typeof row.user_id !== "string" || !(row.last_read_at instanceof Date) || Number.isNaN(row.last_read_at.getTime()) || !(row.updated_at instanceof Date) || Number.isNaN(row.updated_at.getTime())) {
10570
+ throw new Error("Invalid project room read state row");
10571
+ }
10572
+ return { tenantId: row.tenant_id, roomId: row.room_id, userId: row.user_id, lastReadAt: row.last_read_at, updatedAt: row.updated_at };
10573
+ }
10574
+ var PostgreSQLProjectRoomReadStateStore = class {
10575
+ /** Creates a store using an externally managed shared pool. */
10576
+ constructor(options) {
10577
+ this.pool = options.pool;
10578
+ }
10579
+ /** Returns the user's read marker for a room, or null when never reported. */
10580
+ async get(tenantId, roomId, userId) {
10581
+ const result = await this.pool.query(
10582
+ `SELECT tenant_id, room_id, user_id, last_read_at, updated_at
10583
+ FROM lattice_project_room_read_states WHERE tenant_id = $1 AND room_id = $2 AND user_id = $3`,
10584
+ [tenantId, roomId, userId]
10585
+ );
10586
+ return result.rows[0] ? mapRow6(result.rows[0]) : null;
10587
+ }
10588
+ /** Upserts the marker monotonically using GREATEST so older reports never regress it. */
10589
+ async markRead(input) {
10590
+ if (!(input.lastReadAt instanceof Date) || Number.isNaN(input.lastReadAt.getTime())) {
10591
+ throw new RangeError("Project room read state lastReadAt is invalid");
10592
+ }
10593
+ const result = await this.pool.query(
10594
+ `INSERT INTO lattice_project_room_read_states (tenant_id, room_id, user_id, last_read_at, updated_at)
10595
+ VALUES ($1, $2, $3, $4, NOW())
10596
+ ON CONFLICT (tenant_id, room_id, user_id) DO UPDATE
10597
+ SET last_read_at = GREATEST(lattice_project_room_read_states.last_read_at, EXCLUDED.last_read_at),
10598
+ updated_at = NOW()
10599
+ RETURNING tenant_id, room_id, user_id, last_read_at, updated_at`,
10600
+ [input.tenantId, input.roomId, input.userId, input.lastReadAt]
10601
+ );
10602
+ return mapRow6(result.rows[0]);
10603
+ }
10604
+ };
10605
+
10479
10606
  // src/createPgStoreConfig.ts
10480
10607
  async function createPgStoreConfig(connectionString) {
10481
10608
  const pool = new import_pg26.Pool({ connectionString });
@@ -10538,6 +10665,8 @@ async function createPgStoreConfig(connectionString) {
10538
10665
  mm.register(createProjectRoomTables);
10539
10666
  mm.register(addTrustedRunContextColumn);
10540
10667
  mm.register(addProjectLifecycleEventIndex);
10668
+ mm.register(addAgentWebAppsIdentity);
10669
+ mm.register(createProjectRoomReadStates);
10541
10670
  await mm.migrate();
10542
10671
  const checkpoint = import_langgraph_checkpoint_postgres.PostgresSaver.fromConnString(connectionString);
10543
10672
  checkpoint.setup().catch((err) => {
@@ -10575,6 +10704,7 @@ async function createPgStoreConfig(connectionString) {
10575
10704
  projectMembership: new PostgreSQLProjectMembershipStore(opts),
10576
10705
  projectBotMembership: new PostgreSQLProjectBotMembershipStore(opts),
10577
10706
  projectRoomMessage: new PostgreSQLProjectRoomMessageStore(opts),
10707
+ projectRoomReadState: new PostgreSQLProjectRoomReadStateStore(opts),
10578
10708
  vectorStoreProvider: new PGVectorStoreProvider(pool, connectionString),
10579
10709
  checkpoint
10580
10710
  };
@@ -11151,6 +11281,7 @@ function mapRowToChannelIdentityMapping(row) {
11151
11281
  PostgreSQLProjectBotMembershipStore,
11152
11282
  PostgreSQLProjectMembershipStore,
11153
11283
  PostgreSQLProjectRoomMessageStore,
11284
+ PostgreSQLProjectRoomReadStateStore,
11154
11285
  PostgreSQLProjectRoomStore,
11155
11286
  PostgreSQLProjectStore,
11156
11287
  PostgreSQLScheduleStorage,
@@ -11203,6 +11334,7 @@ function mapRowToChannelIdentityMapping(row) {
11203
11334
  createMetricsConfigsTable,
11204
11335
  createPGVectorStoreProvider,
11205
11336
  createPgStoreConfig,
11337
+ createProjectRoomReadStates,
11206
11338
  createProjectRoomTables,
11207
11339
  createProjectsTable,
11208
11340
  createScheduledTasksTable,