@axiom-lattice/local-stores 3.1.6 → 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/local-stores@3.1.6 build /home/runner/work/agentic/agentic/packages/local-stores
2
+ > @axiom-lattice/local-stores@3.1.8 build /home/runner/work/agentic/agentic/packages/local-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 216.48 KB
12
- CJS dist/index.js.map 392.76 KB
13
- CJS ⚡️ Build success in 583ms
14
- ESM dist/index.mjs 212.10 KB
15
- ESM dist/index.mjs.map 389.23 KB
16
- ESM ⚡️ Build success in 588ms
11
+ CJS dist/index.js 221.77 KB
12
+ CJS dist/index.js.map 401.85 KB
13
+ CJS ⚡️ Build success in 495ms
14
+ ESM dist/index.mjs 217.29 KB
15
+ ESM dist/index.mjs.map 398.23 KB
16
+ ESM ⚡️ Build success in 511ms
17
17
  DTS Build start
18
- DTS ⚡️ Build success in 18169ms
19
- DTS dist/index.d.ts 39.86 KB
20
- DTS dist/index.d.mts 39.86 KB
18
+ DTS ⚡️ Build success in 17712ms
19
+ DTS dist/index.d.ts 40.88 KB
20
+ DTS dist/index.d.mts 40.88 KB
package/CHANGELOG.md CHANGED
@@ -1,5 +1,25 @@
1
1
  # @axiom-lattice/local-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
+
3
23
  ## 3.1.6
4
24
 
5
25
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { SqlJsStatic, Database } from 'sql.js';
2
2
  import { SqliteSaver } from '@langchain/langgraph-checkpoint-sqlite';
3
- import { ThreadStore, Thread, CreateThreadRequest, AssistantStore, Assistant, CreateAssistantRequest, WorkspaceStore, Workspace, CreateWorkspaceRequest, UpdateWorkspaceRequest, ProjectStore, ProjectFilter, Project, CreateProjectRequest, UpdateProjectRequest, UpdateProjectCapabilityBundlesResult, ProjectRoomStore, ProjectRoom, ProjectMembershipStore, ProjectMembership, ProjectHumanRole, ProjectMembershipMutationResult, ProjectBotMembershipStore, ProjectBotMembership, ProjectRoomMessageStore, ProjectRoomMessage, UserStore, User, CreateUserRequest, UpdateUserRequest, TenantStore, Tenant, CreateTenantRequest, UpdateTenantRequest, UserTenantLinkStore, UserTenantLink, CreateUserTenantLinkRequest, UpdateUserTenantLinkRequest, DatabaseConfigStore, DatabaseConfigEntry, CreateDatabaseConfigRequest, UpdateDatabaseConfigRequest, ConnectionStore, ConnectionEntry, MetricsServerConfigStore, MetricsServerConfigEntry, CreateMetricsServerConfigRequest, UpdateMetricsServerConfigRequest, McpServerConfigStore, McpServerConfigEntry, CreateMcpServerConfigRequest, UpdateMcpServerConfigRequest, 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, SkillStore, SkillStoreContext, Skill, CreateSkillRequest, ScheduleStorage, ScheduledTaskDefinition, ScheduledTaskStatus, ScheduleExecutionType, TaskStore, CreateTaskRequest, TaskItem, TaskListFilter, TaskDependentListQuery, UpdateTaskRequest, TaskMutationSnapshot, TaskWorkItemStore, CreateWorkItemRequest, TaskWorkItem, CreateWorkItemIfAbsentRequest, TaskWorkItemListFilter, ProjectLifecycleEventQuery, CapabilityBundleStore, CapabilityBundle, InternalCreateCapabilityBundleInput, InternalUpdateCapabilityBundleInput, CapabilityBundleDeleteResult, IConversationStore, ConversationRecord, CreateConversationInput } from '@axiom-lattice/protocols';
3
+ import { ThreadStore, Thread, CreateThreadRequest, AssistantStore, Assistant, CreateAssistantRequest, WorkspaceStore, Workspace, CreateWorkspaceRequest, UpdateWorkspaceRequest, ProjectStore, ProjectFilter, Project, CreateProjectRequest, UpdateProjectRequest, UpdateProjectCapabilityBundlesResult, ProjectRoomStore, ProjectRoom, ProjectMembershipStore, ProjectMembership, ProjectHumanRole, ProjectMembershipMutationResult, ProjectBotMembershipStore, ProjectBotMembership, ProjectRoomMessageStore, ProjectRoomMessage, ProjectRoomReadStateStore, ProjectRoomReadState, UserStore, User, CreateUserRequest, UpdateUserRequest, TenantStore, Tenant, CreateTenantRequest, UpdateTenantRequest, UserTenantLinkStore, UserTenantLink, CreateUserTenantLinkRequest, UpdateUserTenantLinkRequest, DatabaseConfigStore, DatabaseConfigEntry, CreateDatabaseConfigRequest, UpdateDatabaseConfigRequest, ConnectionStore, ConnectionEntry, MetricsServerConfigStore, MetricsServerConfigEntry, CreateMetricsServerConfigRequest, UpdateMetricsServerConfigRequest, McpServerConfigStore, McpServerConfigEntry, CreateMcpServerConfigRequest, UpdateMcpServerConfigRequest, 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, SkillStore, SkillStoreContext, Skill, CreateSkillRequest, ScheduleStorage, ScheduledTaskDefinition, ScheduledTaskStatus, ScheduleExecutionType, TaskStore, CreateTaskRequest, TaskItem, TaskListFilter, TaskDependentListQuery, UpdateTaskRequest, TaskMutationSnapshot, TaskWorkItemStore, CreateWorkItemRequest, TaskWorkItem, CreateWorkItemIfAbsentRequest, TaskWorkItemListFilter, ProjectLifecycleEventQuery, CapabilityBundleStore, CapabilityBundle, InternalCreateCapabilityBundleInput, InternalUpdateCapabilityBundleInput, CapabilityBundleDeleteResult, IConversationStore, ConversationRecord, CreateConversationInput } from '@axiom-lattice/protocols';
4
4
  import { IMessageQueueStore, AddMessageParams, PendingMessage, QueueScope, ThreadInfo } from '@axiom-lattice/core';
5
5
 
6
6
  /**
@@ -359,11 +359,34 @@ declare class LocalProjectRoomMessageStore implements ProjectRoomMessageStore {
359
359
  limit: number;
360
360
  }): Promise<ProjectRoomMessage[]>;
361
361
  findById(tenantId: string, id: string): Promise<ProjectRoomMessage | null>;
362
+ countAfter(input: {
363
+ tenantId: string;
364
+ roomId: string;
365
+ after: Date;
366
+ excludeAuthorUserId?: string;
367
+ }): Promise<number>;
362
368
  private insert;
363
369
  private byId;
364
370
  private byKey;
365
371
  }
366
372
 
373
+ /** Persists per-user project room read markers in the local SQLite store. */
374
+ declare class LocalProjectRoomReadStateStore implements ProjectRoomReadStateStore {
375
+ private readonly db;
376
+ /** Creates a store over a managed local database wrapper. */
377
+ constructor(db: DatabaseWrapper);
378
+ /** Returns the user's read marker for a room, or null when never reported. */
379
+ get(tenantId: string, roomId: string, userId: string): Promise<ProjectRoomReadState | null>;
380
+ /** Upserts the marker monotonically (an older report never regresses the horizon). */
381
+ markRead(input: {
382
+ tenantId: string;
383
+ roomId: string;
384
+ userId: string;
385
+ lastReadAt: Date;
386
+ }): Promise<ProjectRoomReadState>;
387
+ private byKey;
388
+ }
389
+
367
390
  /**
368
391
  * Local SQLite implementation of UserStore.
369
392
  */
@@ -849,6 +872,7 @@ declare function createLocalStoreConfig(options?: LocalStoreConfigOptions): Prom
849
872
  projectMembership: LocalProjectMembershipStore;
850
873
  projectBotMembership: LocalProjectBotMembershipStore;
851
874
  projectRoomMessage: LocalProjectRoomMessageStore;
875
+ projectRoomReadState: LocalProjectRoomReadStateStore;
852
876
  user: LocalUserStore;
853
877
  tenant: LocalTenantStore;
854
878
  userTenantLink: LocalUserTenantLinkStore;
@@ -886,4 +910,4 @@ declare class InMemoryConversationStore implements IConversationStore {
886
910
  deleteConversation(conversationId: string): Promise<void>;
887
911
  }
888
912
 
889
- export { DatabaseWrapper, DuplicateProjectMembershipError, DuplicateProjectRoomMessageIdempotencyKeyError, InMemoryConversationStore, LocalA2AApiKeyStore, LocalAssistantStore, LocalCapabilityBundleStore, LocalChannelBindingStore, LocalChannelInstallationStore, LocalConnectionStore, LocalDatabaseConfigStore, LocalEvalStore, LocalMcpServerConfigStore, LocalMetricsServerConfigStore, LocalProjectBotMembershipStore, LocalProjectMembershipStore, LocalProjectRoomMessageStore, LocalProjectRoomStore, LocalProjectStore, LocalScheduleStorage, LocalSkillStore, type LocalStoreConfigOptions, type LocalStoreOptions, LocalTaskStore, LocalTaskWorkItemStore, LocalTenantStore, LocalThreadMessageQueueStore, LocalThreadStore, LocalUserStore, LocalUserTenantLinkStore, LocalWorkflowTrackingStore, LocalWorkspaceStore, type Migration, MigrationManager, ProjectBotMembershipIdConflictError, ProjectMembershipIdConflictError, ProjectRoomMessageIdConflictError, RunResult, StatementWrapper, closeDatabase, createLocalStoreConfig, ensureTable, getDatabase, initDatabase, nowISO, parseISO };
913
+ export { DatabaseWrapper, DuplicateProjectMembershipError, DuplicateProjectRoomMessageIdempotencyKeyError, InMemoryConversationStore, LocalA2AApiKeyStore, LocalAssistantStore, LocalCapabilityBundleStore, LocalChannelBindingStore, LocalChannelInstallationStore, LocalConnectionStore, LocalDatabaseConfigStore, LocalEvalStore, LocalMcpServerConfigStore, LocalMetricsServerConfigStore, LocalProjectBotMembershipStore, LocalProjectMembershipStore, LocalProjectRoomMessageStore, LocalProjectRoomReadStateStore, LocalProjectRoomStore, LocalProjectStore, LocalScheduleStorage, LocalSkillStore, type LocalStoreConfigOptions, type LocalStoreOptions, LocalTaskStore, LocalTaskWorkItemStore, LocalTenantStore, LocalThreadMessageQueueStore, LocalThreadStore, LocalUserStore, LocalUserTenantLinkStore, LocalWorkflowTrackingStore, LocalWorkspaceStore, type Migration, MigrationManager, ProjectBotMembershipIdConflictError, ProjectMembershipIdConflictError, ProjectRoomMessageIdConflictError, RunResult, StatementWrapper, closeDatabase, createLocalStoreConfig, ensureTable, getDatabase, initDatabase, nowISO, parseISO };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { SqlJsStatic, Database } from 'sql.js';
2
2
  import { SqliteSaver } from '@langchain/langgraph-checkpoint-sqlite';
3
- import { ThreadStore, Thread, CreateThreadRequest, AssistantStore, Assistant, CreateAssistantRequest, WorkspaceStore, Workspace, CreateWorkspaceRequest, UpdateWorkspaceRequest, ProjectStore, ProjectFilter, Project, CreateProjectRequest, UpdateProjectRequest, UpdateProjectCapabilityBundlesResult, ProjectRoomStore, ProjectRoom, ProjectMembershipStore, ProjectMembership, ProjectHumanRole, ProjectMembershipMutationResult, ProjectBotMembershipStore, ProjectBotMembership, ProjectRoomMessageStore, ProjectRoomMessage, UserStore, User, CreateUserRequest, UpdateUserRequest, TenantStore, Tenant, CreateTenantRequest, UpdateTenantRequest, UserTenantLinkStore, UserTenantLink, CreateUserTenantLinkRequest, UpdateUserTenantLinkRequest, DatabaseConfigStore, DatabaseConfigEntry, CreateDatabaseConfigRequest, UpdateDatabaseConfigRequest, ConnectionStore, ConnectionEntry, MetricsServerConfigStore, MetricsServerConfigEntry, CreateMetricsServerConfigRequest, UpdateMetricsServerConfigRequest, McpServerConfigStore, McpServerConfigEntry, CreateMcpServerConfigRequest, UpdateMcpServerConfigRequest, 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, SkillStore, SkillStoreContext, Skill, CreateSkillRequest, ScheduleStorage, ScheduledTaskDefinition, ScheduledTaskStatus, ScheduleExecutionType, TaskStore, CreateTaskRequest, TaskItem, TaskListFilter, TaskDependentListQuery, UpdateTaskRequest, TaskMutationSnapshot, TaskWorkItemStore, CreateWorkItemRequest, TaskWorkItem, CreateWorkItemIfAbsentRequest, TaskWorkItemListFilter, ProjectLifecycleEventQuery, CapabilityBundleStore, CapabilityBundle, InternalCreateCapabilityBundleInput, InternalUpdateCapabilityBundleInput, CapabilityBundleDeleteResult, IConversationStore, ConversationRecord, CreateConversationInput } from '@axiom-lattice/protocols';
3
+ import { ThreadStore, Thread, CreateThreadRequest, AssistantStore, Assistant, CreateAssistantRequest, WorkspaceStore, Workspace, CreateWorkspaceRequest, UpdateWorkspaceRequest, ProjectStore, ProjectFilter, Project, CreateProjectRequest, UpdateProjectRequest, UpdateProjectCapabilityBundlesResult, ProjectRoomStore, ProjectRoom, ProjectMembershipStore, ProjectMembership, ProjectHumanRole, ProjectMembershipMutationResult, ProjectBotMembershipStore, ProjectBotMembership, ProjectRoomMessageStore, ProjectRoomMessage, ProjectRoomReadStateStore, ProjectRoomReadState, UserStore, User, CreateUserRequest, UpdateUserRequest, TenantStore, Tenant, CreateTenantRequest, UpdateTenantRequest, UserTenantLinkStore, UserTenantLink, CreateUserTenantLinkRequest, UpdateUserTenantLinkRequest, DatabaseConfigStore, DatabaseConfigEntry, CreateDatabaseConfigRequest, UpdateDatabaseConfigRequest, ConnectionStore, ConnectionEntry, MetricsServerConfigStore, MetricsServerConfigEntry, CreateMetricsServerConfigRequest, UpdateMetricsServerConfigRequest, McpServerConfigStore, McpServerConfigEntry, CreateMcpServerConfigRequest, UpdateMcpServerConfigRequest, 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, SkillStore, SkillStoreContext, Skill, CreateSkillRequest, ScheduleStorage, ScheduledTaskDefinition, ScheduledTaskStatus, ScheduleExecutionType, TaskStore, CreateTaskRequest, TaskItem, TaskListFilter, TaskDependentListQuery, UpdateTaskRequest, TaskMutationSnapshot, TaskWorkItemStore, CreateWorkItemRequest, TaskWorkItem, CreateWorkItemIfAbsentRequest, TaskWorkItemListFilter, ProjectLifecycleEventQuery, CapabilityBundleStore, CapabilityBundle, InternalCreateCapabilityBundleInput, InternalUpdateCapabilityBundleInput, CapabilityBundleDeleteResult, IConversationStore, ConversationRecord, CreateConversationInput } from '@axiom-lattice/protocols';
4
4
  import { IMessageQueueStore, AddMessageParams, PendingMessage, QueueScope, ThreadInfo } from '@axiom-lattice/core';
5
5
 
6
6
  /**
@@ -359,11 +359,34 @@ declare class LocalProjectRoomMessageStore implements ProjectRoomMessageStore {
359
359
  limit: number;
360
360
  }): Promise<ProjectRoomMessage[]>;
361
361
  findById(tenantId: string, id: string): Promise<ProjectRoomMessage | null>;
362
+ countAfter(input: {
363
+ tenantId: string;
364
+ roomId: string;
365
+ after: Date;
366
+ excludeAuthorUserId?: string;
367
+ }): Promise<number>;
362
368
  private insert;
363
369
  private byId;
364
370
  private byKey;
365
371
  }
366
372
 
373
+ /** Persists per-user project room read markers in the local SQLite store. */
374
+ declare class LocalProjectRoomReadStateStore implements ProjectRoomReadStateStore {
375
+ private readonly db;
376
+ /** Creates a store over a managed local database wrapper. */
377
+ constructor(db: DatabaseWrapper);
378
+ /** Returns the user's read marker for a room, or null when never reported. */
379
+ get(tenantId: string, roomId: string, userId: string): Promise<ProjectRoomReadState | null>;
380
+ /** Upserts the marker monotonically (an older report never regresses the horizon). */
381
+ markRead(input: {
382
+ tenantId: string;
383
+ roomId: string;
384
+ userId: string;
385
+ lastReadAt: Date;
386
+ }): Promise<ProjectRoomReadState>;
387
+ private byKey;
388
+ }
389
+
367
390
  /**
368
391
  * Local SQLite implementation of UserStore.
369
392
  */
@@ -849,6 +872,7 @@ declare function createLocalStoreConfig(options?: LocalStoreConfigOptions): Prom
849
872
  projectMembership: LocalProjectMembershipStore;
850
873
  projectBotMembership: LocalProjectBotMembershipStore;
851
874
  projectRoomMessage: LocalProjectRoomMessageStore;
875
+ projectRoomReadState: LocalProjectRoomReadStateStore;
852
876
  user: LocalUserStore;
853
877
  tenant: LocalTenantStore;
854
878
  userTenantLink: LocalUserTenantLinkStore;
@@ -886,4 +910,4 @@ declare class InMemoryConversationStore implements IConversationStore {
886
910
  deleteConversation(conversationId: string): Promise<void>;
887
911
  }
888
912
 
889
- export { DatabaseWrapper, DuplicateProjectMembershipError, DuplicateProjectRoomMessageIdempotencyKeyError, InMemoryConversationStore, LocalA2AApiKeyStore, LocalAssistantStore, LocalCapabilityBundleStore, LocalChannelBindingStore, LocalChannelInstallationStore, LocalConnectionStore, LocalDatabaseConfigStore, LocalEvalStore, LocalMcpServerConfigStore, LocalMetricsServerConfigStore, LocalProjectBotMembershipStore, LocalProjectMembershipStore, LocalProjectRoomMessageStore, LocalProjectRoomStore, LocalProjectStore, LocalScheduleStorage, LocalSkillStore, type LocalStoreConfigOptions, type LocalStoreOptions, LocalTaskStore, LocalTaskWorkItemStore, LocalTenantStore, LocalThreadMessageQueueStore, LocalThreadStore, LocalUserStore, LocalUserTenantLinkStore, LocalWorkflowTrackingStore, LocalWorkspaceStore, type Migration, MigrationManager, ProjectBotMembershipIdConflictError, ProjectMembershipIdConflictError, ProjectRoomMessageIdConflictError, RunResult, StatementWrapper, closeDatabase, createLocalStoreConfig, ensureTable, getDatabase, initDatabase, nowISO, parseISO };
913
+ export { DatabaseWrapper, DuplicateProjectMembershipError, DuplicateProjectRoomMessageIdempotencyKeyError, InMemoryConversationStore, LocalA2AApiKeyStore, LocalAssistantStore, LocalCapabilityBundleStore, LocalChannelBindingStore, LocalChannelInstallationStore, LocalConnectionStore, LocalDatabaseConfigStore, LocalEvalStore, LocalMcpServerConfigStore, LocalMetricsServerConfigStore, LocalProjectBotMembershipStore, LocalProjectMembershipStore, LocalProjectRoomMessageStore, LocalProjectRoomReadStateStore, LocalProjectRoomStore, LocalProjectStore, LocalScheduleStorage, LocalSkillStore, type LocalStoreConfigOptions, type LocalStoreOptions, LocalTaskStore, LocalTaskWorkItemStore, LocalTenantStore, LocalThreadMessageQueueStore, LocalThreadStore, LocalUserStore, LocalUserTenantLinkStore, LocalWorkflowTrackingStore, LocalWorkspaceStore, type Migration, MigrationManager, ProjectBotMembershipIdConflictError, ProjectMembershipIdConflictError, ProjectRoomMessageIdConflictError, RunResult, StatementWrapper, closeDatabase, createLocalStoreConfig, ensureTable, getDatabase, initDatabase, nowISO, parseISO };
package/dist/index.js CHANGED
@@ -47,6 +47,7 @@ __export(index_exports, {
47
47
  LocalProjectBotMembershipStore: () => LocalProjectBotMembershipStore,
48
48
  LocalProjectMembershipStore: () => LocalProjectMembershipStore,
49
49
  LocalProjectRoomMessageStore: () => LocalProjectRoomMessageStore,
50
+ LocalProjectRoomReadStateStore: () => LocalProjectRoomReadStateStore,
50
51
  LocalProjectRoomStore: () => LocalProjectRoomStore,
51
52
  LocalProjectStore: () => LocalProjectStore,
52
53
  LocalScheduleStorage: () => LocalScheduleStorage,
@@ -886,12 +887,20 @@ CREATE UNIQUE INDEX IF NOT EXISTS uq_lt_project_room_messages_idempotency
886
887
  ON lt_project_room_messages (tenant_id, room_id, idempotency_key) WHERE idempotency_key IS NOT NULL;
887
888
  CREATE INDEX IF NOT EXISTS idx_lt_project_room_messages_room_created
888
889
  ON lt_project_room_messages (tenant_id, room_id, created_at DESC, id DESC);
890
+ CREATE TABLE IF NOT EXISTS lt_project_room_read_states (
891
+ tenant_id TEXT NOT NULL, room_id TEXT NOT NULL, user_id TEXT NOT NULL,
892
+ last_read_at TEXT NOT NULL, updated_at TEXT NOT NULL,
893
+ PRIMARY KEY (tenant_id, room_id, user_id)
894
+ );
895
+ CREATE INDEX IF NOT EXISTS idx_lt_project_room_read_states_user
896
+ ON lt_project_room_read_states (tenant_id, user_id);
889
897
  `;
890
898
  var tableColumns = {
891
899
  lt_project_rooms: ["id", "tenant_id", "workspace_id", "project_id", "type", "name", "created_at", "updated_at"],
892
900
  lt_project_memberships: ["id", "tenant_id", "project_id", "user_id", "role", "status", "joined_at", "updated_at"],
893
901
  lt_project_bot_memberships: ["id", "tenant_id", "workspace_id", "project_id", "room_id", "assistant_id", "role", "title", "responsibility", "mention_name", "status", "room_thread_id", "joined_at", "updated_at"],
894
- lt_project_room_messages: ["id", "tenant_id", "workspace_id", "project_id", "room_id", "author", "content", "mentions", "reply_to_message_id", "source", "source_id", "idempotency_key", "created_at"]
902
+ lt_project_room_messages: ["id", "tenant_id", "workspace_id", "project_id", "room_id", "author", "content", "mentions", "reply_to_message_id", "source", "source_id", "idempotency_key", "created_at"],
903
+ lt_project_room_read_states: ["tenant_id", "room_id", "user_id", "last_read_at", "updated_at"]
895
904
  };
896
905
  var indexes = {
897
906
  idx_lt_project_memberships_project: { table: "lt_project_memberships", columns: ["tenant_id", "project_id"], unique: false, partial: false },
@@ -900,13 +909,15 @@ var indexes = {
900
909
  idx_lt_project_bot_memberships_project: { table: "lt_project_bot_memberships", columns: ["tenant_id", "project_id"], unique: false, partial: false },
901
910
  idx_lt_project_bot_memberships_room: { table: "lt_project_bot_memberships", columns: ["tenant_id", "room_id"], unique: false, partial: false },
902
911
  uq_lt_project_room_messages_idempotency: { table: "lt_project_room_messages", columns: ["tenant_id", "room_id", "idempotency_key"], unique: true, partial: true, sql: ["idempotency_key is not null"] },
903
- idx_lt_project_room_messages_room_created: { table: "lt_project_room_messages", columns: ["tenant_id", "room_id", "created_at", "id"], unique: false, partial: false, sql: ["created_at desc", "id desc"] }
912
+ idx_lt_project_room_messages_room_created: { table: "lt_project_room_messages", columns: ["tenant_id", "room_id", "created_at", "id"], unique: false, partial: false, sql: ["created_at desc", "id desc"] },
913
+ idx_lt_project_room_read_states_user: { table: "lt_project_room_read_states", columns: ["tenant_id", "user_id"], unique: false, partial: false }
904
914
  };
905
915
  var uniqueConstraints = {
906
916
  lt_project_rooms: [["tenant_id", "id"], ["tenant_id", "project_id", "type"]],
907
917
  lt_project_memberships: [["tenant_id", "id"], ["tenant_id", "project_id", "user_id"]],
908
918
  lt_project_bot_memberships: [["tenant_id", "id"], ["tenant_id", "project_id", "assistant_id"]],
909
- lt_project_room_messages: [["tenant_id", "id"]]
919
+ lt_project_room_messages: [["tenant_id", "id"]],
920
+ lt_project_room_read_states: [["tenant_id", "room_id", "user_id"]]
910
921
  };
911
922
  var checkConstraints = {
912
923
  lt_project_rooms: [{ name: "type", fragment: "type='main'" }],
@@ -918,7 +929,8 @@ var checkConstraints = {
918
929
  { name: "role", fragment: "role in ('coordinator','specialist')" },
919
930
  { name: "status", fragment: "status in ('active','paused','removed')" }
920
931
  ],
921
- lt_project_room_messages: [{ name: "source", fragment: "source in ('user','agent','task','routine','system')" }]
932
+ lt_project_room_messages: [{ name: "source", fragment: "source in ('user','agent','task','routine','system')" }],
933
+ lt_project_room_read_states: []
922
934
  };
923
935
  function rows(db, sql) {
924
936
  const result = db.getRawDb().exec(sql);
@@ -990,10 +1002,10 @@ function validateProjectRoomSchema(db) {
990
1002
  }
991
1003
  for (const [name, expected] of Object.entries(indexes)) {
992
1004
  const listed = rows(db, `PRAGMA index_list(${expected.table})`).find((index) => index.name === name);
993
- const columns5 = rows(db, `PRAGMA index_info(${name})`).map((column) => column.name);
1005
+ const columns6 = rows(db, `PRAGMA index_info(${name})`).map((column) => column.name);
994
1006
  const definition = rows(db, `SELECT sql FROM sqlite_master WHERE type = 'index' AND name = '${name}'`)[0]?.sql;
995
1007
  const normalized = typeof definition === "string" ? definition.toLowerCase().replace(/\s+/g, " ") : "";
996
- if (!listed || listed.unique !== Number(expected.unique) || listed.partial !== Number(expected.partial) || columns5.join(",") !== expected.columns.join(",") || expected.sql?.some((fragment) => !normalized.includes(fragment))) {
1008
+ if (!listed || listed.unique !== Number(expected.unique) || listed.partial !== Number(expected.partial) || columns6.join(",") !== expected.columns.join(",") || expected.sql?.some((fragment) => !normalized.includes(fragment))) {
997
1009
  throw new Error(`Invalid project room schema: index '${name}' is incompatible`);
998
1010
  }
999
1011
  }
@@ -1006,6 +1018,30 @@ function ensureProjectRoomSchema(db) {
1006
1018
  const applied = hasMigrationTable ? rows(db, `SELECT name, version FROM lattice_schema_migrations WHERE store_name = 'project_room' AND name = '${migrationName}'`)[0] : void 0;
1007
1019
  if (applied) {
1008
1020
  if (applied.version !== 1) throw new Error(`Invalid project room schema migration version: ${String(applied.version)}`);
1021
+ const hasReadStates = rows(db, "SELECT name FROM sqlite_master WHERE type = 'table' AND name = 'lt_project_room_read_states'").length > 0;
1022
+ if (!hasReadStates) {
1023
+ raw.exec("BEGIN IMMEDIATE");
1024
+ try {
1025
+ raw.exec(`CREATE TABLE IF NOT EXISTS lt_project_room_read_states (
1026
+ tenant_id TEXT NOT NULL, room_id TEXT NOT NULL, user_id TEXT NOT NULL,
1027
+ last_read_at TEXT NOT NULL, updated_at TEXT NOT NULL,
1028
+ PRIMARY KEY (tenant_id, room_id, user_id)
1029
+ ); CREATE INDEX IF NOT EXISTS idx_lt_project_room_read_states_user
1030
+ ON lt_project_room_read_states (tenant_id, user_id);`);
1031
+ raw.run(
1032
+ "INSERT INTO lattice_schema_migrations (store_name, name, version, applied_at) VALUES (?, ?, ?, ?)",
1033
+ ["project_room", "create_project_room_read_states", 2, (/* @__PURE__ */ new Date()).toISOString()]
1034
+ );
1035
+ raw.exec("COMMIT");
1036
+ db.save();
1037
+ } catch (error) {
1038
+ try {
1039
+ raw.exec("ROLLBACK");
1040
+ } catch {
1041
+ }
1042
+ throw error;
1043
+ }
1044
+ }
1009
1045
  validateProjectRoomSchema(db);
1010
1046
  marked[schemaMarker] = true;
1011
1047
  return;
@@ -1445,6 +1481,18 @@ var LocalProjectRoomMessageStore = class {
1445
1481
  const row = this.byId(tenantId, id);
1446
1482
  return row ? mapRow4(row) : null;
1447
1483
  }
1484
+ async countAfter(input) {
1485
+ if (!validDate(input.after)) throw new RangeError("Project room message count horizon date is invalid");
1486
+ const rows2 = this.db.prepare(
1487
+ `SELECT author FROM lt_project_room_messages
1488
+ WHERE tenant_id = ? AND room_id = ? AND created_at > ?`
1489
+ ).all(input.tenantId, input.roomId, input.after.toISOString());
1490
+ return rows2.filter((row) => {
1491
+ if (input.excludeAuthorUserId === void 0) return true;
1492
+ const parsed = parseJson(row.author);
1493
+ return !(record(parsed) && parsed.type === "human" && parsed.userId === input.excludeAuthorUserId);
1494
+ }).length;
1495
+ }
1448
1496
  insert(input, idempotent) {
1449
1497
  return transaction(this.db, () => {
1450
1498
  if (idempotent && input.idempotencyKey) {
@@ -1475,6 +1523,50 @@ var LocalProjectRoomMessageStore = class {
1475
1523
  }
1476
1524
  };
1477
1525
 
1526
+ // src/stores/LocalProjectRoomReadStateStore.ts
1527
+ var columns5 = "tenant_id, room_id, user_id, last_read_at, updated_at";
1528
+ function mapRow5(row) {
1529
+ const lastReadAt = new Date(row.last_read_at);
1530
+ const updatedAt = new Date(row.updated_at);
1531
+ if (Number.isNaN(lastReadAt.getTime()) || Number.isNaN(updatedAt.getTime())) throw new Error("Invalid project room read state row");
1532
+ return { tenantId: row.tenant_id, roomId: row.room_id, userId: row.user_id, lastReadAt, updatedAt };
1533
+ }
1534
+ var LocalProjectRoomReadStateStore = class {
1535
+ /** Creates a store over a managed local database wrapper. */
1536
+ constructor(db) {
1537
+ this.db = db;
1538
+ ensureProjectRoomSchema(db);
1539
+ }
1540
+ /** Returns the user's read marker for a room, or null when never reported. */
1541
+ async get(tenantId, roomId, userId) {
1542
+ const row = this.byKey(tenantId, roomId, userId);
1543
+ return row ? mapRow5(row) : null;
1544
+ }
1545
+ /** Upserts the marker monotonically (an older report never regresses the horizon). */
1546
+ async markRead(input) {
1547
+ if (!validDate(input.lastReadAt)) throw new RangeError("Project room read state lastReadAt is invalid");
1548
+ return transaction(this.db, () => {
1549
+ const existing = this.byKey(input.tenantId, input.roomId, input.userId);
1550
+ const lastReadAt = existing !== void 0 && new Date(existing.last_read_at).getTime() > input.lastReadAt.getTime() ? new Date(existing.last_read_at) : input.lastReadAt;
1551
+ write(
1552
+ this.db,
1553
+ `INSERT INTO lt_project_room_read_states (${columns5})
1554
+ VALUES (?, ?, ?, ?, ?)
1555
+ ON CONFLICT (tenant_id, room_id, user_id) DO UPDATE
1556
+ SET last_read_at = excluded.last_read_at, updated_at = excluded.updated_at`,
1557
+ [input.tenantId, input.roomId, input.userId, lastReadAt.toISOString(), timestamp()]
1558
+ );
1559
+ const row = this.byKey(input.tenantId, input.roomId, input.userId);
1560
+ return mapRow5(row);
1561
+ });
1562
+ }
1563
+ byKey(tenantId, roomId, userId) {
1564
+ return this.db.prepare(
1565
+ `SELECT ${columns5} FROM lt_project_room_read_states WHERE tenant_id = ? AND room_id = ? AND user_id = ?`
1566
+ ).get(tenantId, roomId, userId);
1567
+ }
1568
+ };
1569
+
1478
1570
  // src/stores/LocalUserStore.ts
1479
1571
  var DDL5 = `
1480
1572
  CREATE TABLE IF NOT EXISTS lt_users (
@@ -2302,6 +2394,18 @@ function mapRowToEntry3(row) {
2302
2394
  throw new Error("Failed to decrypt MCP server configuration");
2303
2395
  }
2304
2396
  }
2397
+ if (config.headers && row.is_env_encrypted) {
2398
+ try {
2399
+ const decryptedHeaders = {};
2400
+ for (const [key, value] of Object.entries(config.headers)) {
2401
+ decryptedHeaders[key] = (0, import_core2.decrypt)(value);
2402
+ }
2403
+ config.headers = decryptedHeaders;
2404
+ } catch (error) {
2405
+ console.error("Failed to decrypt MCP server headers:", error);
2406
+ throw new Error("Failed to decrypt MCP server configuration");
2407
+ }
2408
+ }
2305
2409
  return {
2306
2410
  id: row.id,
2307
2411
  tenantId: row.tenant_id,
@@ -2327,6 +2431,14 @@ function encryptEnvInConfig(config) {
2327
2431
  configCopy.env = encryptedEnv;
2328
2432
  isEnvEncrypted = true;
2329
2433
  }
2434
+ if (configCopy.headers && Object.keys(configCopy.headers).length > 0) {
2435
+ const encryptedHeaders = {};
2436
+ for (const [key, value] of Object.entries(configCopy.headers)) {
2437
+ encryptedHeaders[key] = (0, import_core2.encrypt)(value);
2438
+ }
2439
+ configCopy.headers = encryptedHeaders;
2440
+ isEnvEncrypted = true;
2441
+ }
2330
2442
  return { config: configCopy, isEnvEncrypted };
2331
2443
  }
2332
2444
 
@@ -3636,7 +3748,7 @@ var LocalChannelInstallationStore = class {
3636
3748
  const row = this.db.prepare(
3637
3749
  `SELECT * FROM lt_channel_installations WHERE id = ?`
3638
3750
  ).get(installationId);
3639
- return row ? mapRow5(row) : null;
3751
+ return row ? mapRow6(row) : null;
3640
3752
  }
3641
3753
  async getInstallationsByTenant(tenantId, channel) {
3642
3754
  let rows2;
@@ -3649,7 +3761,7 @@ var LocalChannelInstallationStore = class {
3649
3761
  `SELECT * FROM lt_channel_installations WHERE tenant_id = ? ORDER BY created_at DESC`
3650
3762
  ).all(tenantId);
3651
3763
  }
3652
- return rows2.map(mapRow5);
3764
+ return rows2.map(mapRow6);
3653
3765
  }
3654
3766
  async getAllInstallations(channel) {
3655
3767
  let rows2;
@@ -3662,7 +3774,7 @@ var LocalChannelInstallationStore = class {
3662
3774
  `SELECT * FROM lt_channel_installations ORDER BY created_at DESC`
3663
3775
  ).all();
3664
3776
  }
3665
- return rows2.map(mapRow5);
3777
+ return rows2.map(mapRow6);
3666
3778
  }
3667
3779
  async createInstallation(tenantId, installationId, data) {
3668
3780
  const now = nowISO();
@@ -3738,7 +3850,7 @@ var LocalChannelInstallationStore = class {
3738
3850
  return result.changes > 0;
3739
3851
  }
3740
3852
  };
3741
- function mapRow5(row) {
3853
+ function mapRow6(row) {
3742
3854
  return {
3743
3855
  id: row.id,
3744
3856
  tenantId: row.tenant_id,
@@ -3965,8 +4077,8 @@ var LocalThreadMessageQueueStore = class {
3965
4077
  this.capacityTail = Promise.resolve();
3966
4078
  this.db = db;
3967
4079
  ensureTable(db, DDL17);
3968
- const columns5 = db.prepare("PRAGMA table_info(lt_thread_message_queue)").all();
3969
- const names = new Set(columns5.map(({ name }) => name));
4080
+ const columns6 = db.prepare("PRAGMA table_info(lt_thread_message_queue)").all();
4081
+ const names = new Set(columns6.map(({ name }) => name));
3970
4082
  if (!names.has("trusted_run_context")) {
3971
4083
  db.run("ALTER TABLE lt_thread_message_queue ADD COLUMN trusted_run_context TEXT");
3972
4084
  }
@@ -5817,6 +5929,7 @@ async function createLocalStoreConfig(options = {}) {
5817
5929
  projectMembership: new LocalProjectMembershipStore(db),
5818
5930
  projectBotMembership: new LocalProjectBotMembershipStore(db),
5819
5931
  projectRoomMessage: new LocalProjectRoomMessageStore(db),
5932
+ projectRoomReadState: new LocalProjectRoomReadStateStore(db),
5820
5933
  user: new LocalUserStore(db),
5821
5934
  tenant: new LocalTenantStore(db),
5822
5935
  userTenantLink: new LocalUserTenantLinkStore(db),
@@ -5894,6 +6007,7 @@ var InMemoryConversationStore = class {
5894
6007
  LocalProjectBotMembershipStore,
5895
6008
  LocalProjectMembershipStore,
5896
6009
  LocalProjectRoomMessageStore,
6010
+ LocalProjectRoomReadStateStore,
5897
6011
  LocalProjectRoomStore,
5898
6012
  LocalProjectStore,
5899
6013
  LocalScheduleStorage,