@axiom-lattice/local-stores 5.2.4 → 5.3.0
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.
- package/.turbo/turbo-build.log +10 -10
- package/CHANGELOG.md +26 -0
- package/dist/index.d.mts +7 -2
- package/dist/index.d.ts +7 -2
- package/dist/index.js +105 -53
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +57 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
- package/src/__tests__/LocalOpenAuditStore.test.ts +43 -0
- package/src/__tests__/LocalThreadMessageQueueStore.monitor.test.ts +31 -0
- package/src/__tests__/LocalThreadStore.monitor.test.ts +29 -0
- package/src/stores/LocalOpenAuditStore.ts +30 -1
- package/src/stores/LocalThreadMessageQueueStore.ts +3 -2
- package/src/stores/LocalThreadStore.ts +47 -4
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @axiom-lattice/local-stores@5.
|
|
2
|
+
> @axiom-lattice/local-stores@5.3.0 build /home/runner/work/agentic/agentic/packages/local-stores
|
|
3
3
|
> tsup src/index.ts --format cjs,esm --dts --sourcemap
|
|
4
4
|
|
|
5
5
|
[34mCLI[39m Building entry: src/index.ts
|
|
@@ -8,13 +8,13 @@
|
|
|
8
8
|
[34mCLI[39m Target: es2020
|
|
9
9
|
[34mCJS[39m Build start
|
|
10
10
|
[34mESM[39m Build start
|
|
11
|
-
[
|
|
12
|
-
[
|
|
13
|
-
[
|
|
14
|
-
[
|
|
15
|
-
[
|
|
16
|
-
[
|
|
11
|
+
[32mESM[39m [1mdist/index.mjs [22m[32m291.77 KB[39m
|
|
12
|
+
[32mESM[39m [1mdist/index.mjs.map [22m[32m539.21 KB[39m
|
|
13
|
+
[32mESM[39m ⚡️ Build success in 879ms
|
|
14
|
+
[32mCJS[39m [1mdist/index.js [22m[32m297.28 KB[39m
|
|
15
|
+
[32mCJS[39m [1mdist/index.js.map [22m[32m543.54 KB[39m
|
|
16
|
+
[32mCJS[39m ⚡️ Build success in 884ms
|
|
17
17
|
[34mDTS[39m Build start
|
|
18
|
-
[32mDTS[39m ⚡️ Build success in
|
|
19
|
-
[32mDTS[39m [1mdist/index.d.ts [22m[32m55.
|
|
20
|
-
[32mDTS[39m [1mdist/index.d.mts [22m[32m55.
|
|
18
|
+
[32mDTS[39m ⚡️ Build success in 13238ms
|
|
19
|
+
[32mDTS[39m [1mdist/index.d.ts [22m[32m55.45 KB[39m
|
|
20
|
+
[32mDTS[39m [1mdist/index.d.mts [22m[32m55.45 KB[39m
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,31 @@
|
|
|
1
1
|
# @axiom-lattice/local-stores
|
|
2
2
|
|
|
3
|
+
## 5.3.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- a27596a: ## Audit surfaces: sandbox query API and Open Audit parity
|
|
8
|
+
|
|
9
|
+
### Sandbox Gateway
|
|
10
|
+
|
|
11
|
+
- Add a queryable sandbox audit API: exec/file operations append to a process-local ring buffer (`SANDBOX_AUDIT_BUFFER_SIZE`, default 1000) while still emitting the existing `sandbox.audit` JSON stdout line. `GET /api/audit` supports `sandboxName`/`operation`/`outcome`/`from`/`to`/`limit`/`offset`; `GET /api/audit/:id` returns one event. Nothing is persisted and nothing is written into the Agent Gateway Open Audit store; stdout log shipping remains the durable audit record.
|
|
12
|
+
- Default the sandbox data plane to direct/ingress (`OPEN_SANDBOX_USE_SERVER_PROXY=false`) and keep the server proxy as an explicit fallback.
|
|
13
|
+
- Add lease-based admission, per-tenant/global sandbox limits, queueing metrics, and hard idle handling (`kill` by default; `pause` only when the controller advertises snapshot support).
|
|
14
|
+
- Split the runtime service into config/lease/file/exec/lifecycle modules without changing the public HTTP contract.
|
|
15
|
+
|
|
16
|
+
### Open Audit parity
|
|
17
|
+
|
|
18
|
+
- Align Open Audit record semantics with Platform Audit: shared deep redaction and 16 KiB request/response capture, initiator/executor attribution, project/action filters, and a `cancelled` outcome.
|
|
19
|
+
- Restrict Open Audit reads to tenant owner/admin.
|
|
20
|
+
- Add single-record reads (`GET /api/open/audit/:auditId`), SDK `open.auditLog(id)`, and filter support in the Console audit list with a redacted detail drawer.
|
|
21
|
+
- Core/local/PG stores implement the matching `get(id)` read path.
|
|
22
|
+
|
|
23
|
+
### Patch Changes
|
|
24
|
+
|
|
25
|
+
- Updated dependencies [a27596a]
|
|
26
|
+
- @axiom-lattice/protocols@7.7.0
|
|
27
|
+
- @axiom-lattice/core@13.1.0
|
|
28
|
+
|
|
3
29
|
## 5.2.4
|
|
4
30
|
|
|
5
31
|
### 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, StoreProtocol, StorePutInput, StoreItem, StoreSearchInput, 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, UserExternalIdentityStore, UserExternalIdentity, OidcProviderConfigStore, OidcProviderConfig, CreateOidcProviderConfigInput, UpdateOidcProviderConfigInput, PlatformMemberStore, PlatformMember, PlatformInvitationStore, PlatformInvitation, OidcIdentityClaimStore, OidcIdentityClaimStatus, OidcIdentityClaim, CreateOidcIdentityClaimInput, UpdateOidcIdentityClaimInput, OidcIdentityClaimApproval, InviteLinkStore, InviteLink, CreateInviteLinkInput, PlatformSettingsStore, PlatformSettingsRecord, PlatformSettingsDocument, PlatformAuditStore, PlatformAuditAppendInput, PlatformAuditRecord, PlatformAuditQuery, DatabaseConfigStore, DatabaseConfigEntry, CreateDatabaseConfigRequest, UpdateDatabaseConfigRequest, ConnectionStore, ConnectionEntry, MetricsServerConfigStore, MetricsServerConfigEntry, CreateMetricsServerConfigRequest, UpdateMetricsServerConfigRequest, McpServerConfigStore, PersonalMcpServerConfigStore, McpServerConfigEntry, CreateMcpServerConfigRequest, UpdateMcpServerConfigRequest, PersonalMcpServerConfigEntry, ModelProviderStore, ModelProviderEntry, CreateModelProviderRequest, UpdateModelProviderRequest, ModelProviderStatus, ModelProviderModelEntry, ProviderModelInput, 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, UpdateA2AApiKeyInput, A2AApiKeyEntry, OpenAuditStore,
|
|
3
|
+
import { ThreadStore, Thread, ThreadMonitorQuery, ThreadMonitorRecord, CreateThreadRequest, StoreProtocol, StorePutInput, StoreItem, StoreSearchInput, 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, UserExternalIdentityStore, UserExternalIdentity, OidcProviderConfigStore, OidcProviderConfig, CreateOidcProviderConfigInput, UpdateOidcProviderConfigInput, PlatformMemberStore, PlatformMember, PlatformInvitationStore, PlatformInvitation, OidcIdentityClaimStore, OidcIdentityClaimStatus, OidcIdentityClaim, CreateOidcIdentityClaimInput, UpdateOidcIdentityClaimInput, OidcIdentityClaimApproval, InviteLinkStore, InviteLink, CreateInviteLinkInput, PlatformSettingsStore, PlatformSettingsRecord, PlatformSettingsDocument, PlatformAuditStore, PlatformAuditAppendInput, PlatformAuditRecord, PlatformAuditQuery, DatabaseConfigStore, DatabaseConfigEntry, CreateDatabaseConfigRequest, UpdateDatabaseConfigRequest, ConnectionStore, ConnectionEntry, MetricsServerConfigStore, MetricsServerConfigEntry, CreateMetricsServerConfigRequest, UpdateMetricsServerConfigRequest, McpServerConfigStore, PersonalMcpServerConfigStore, McpServerConfigEntry, CreateMcpServerConfigRequest, UpdateMcpServerConfigRequest, PersonalMcpServerConfigEntry, ModelProviderStore, ModelProviderEntry, CreateModelProviderRequest, UpdateModelProviderRequest, ModelProviderStatus, ModelProviderModelEntry, ProviderModelInput, 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, UpdateA2AApiKeyInput, A2AApiKeyEntry, OpenAuditStore, OpenAuditRecord, OpenAuditQuery, OpenAuditAppendInput, 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, ClaimMessagesOptions, ThreadInfo } from '@axiom-lattice/core';
|
|
5
5
|
|
|
6
6
|
/**
|
|
@@ -197,6 +197,10 @@ declare class LocalThreadStore implements ThreadStore {
|
|
|
197
197
|
/** Add a column if it does not exist (SQLite version compatible). */
|
|
198
198
|
private ensureColumn;
|
|
199
199
|
getThreadsByAssistantId(tenantId: string, assistantId: string, metadataFilter?: Record<string, string>): Promise<Thread[]>;
|
|
200
|
+
listThreadsByTenant(tenantId: string, query?: ThreadMonitorQuery): Promise<{
|
|
201
|
+
records: ThreadMonitorRecord[];
|
|
202
|
+
total: number;
|
|
203
|
+
}>;
|
|
200
204
|
getThreadById(tenantId: string, threadId: string): Promise<Thread | undefined>;
|
|
201
205
|
createThread(tenantId: string, assistantId: string, threadId: string, data: CreateThreadRequest): Promise<Thread>;
|
|
202
206
|
updateThread(tenantId: string, threadId: string, updates: Partial<CreateThreadRequest>): Promise<Thread | null>;
|
|
@@ -893,6 +897,7 @@ declare class LocalA2AApiKeyStore implements A2AApiKeyStore {
|
|
|
893
897
|
declare class LocalOpenAuditStore implements OpenAuditStore {
|
|
894
898
|
private db;
|
|
895
899
|
constructor(db: DatabaseWrapper);
|
|
900
|
+
get(tenantId: string, id: string): Promise<OpenAuditRecord | null>;
|
|
896
901
|
query(params: OpenAuditQuery): Promise<OpenAuditRecord[]>;
|
|
897
902
|
append(record: OpenAuditAppendInput): Promise<void>;
|
|
898
903
|
}
|
|
@@ -913,7 +918,7 @@ declare class LocalThreadMessageQueueStore implements IMessageQueueStore {
|
|
|
913
918
|
claimPendingMessages(threadId: string, scope: QueueScope | undefined, options: ClaimMessagesOptions): Promise<PendingMessage[]>;
|
|
914
919
|
reclaimExpiredProcessing(threadId: string, scope?: QueueScope): Promise<number>;
|
|
915
920
|
getQueueSize(threadId: string, scope?: QueueScope): Promise<number>;
|
|
916
|
-
getThreadsWithPendingMessages(): Promise<ThreadInfo[]>;
|
|
921
|
+
getThreadsWithPendingMessages(tenantId?: string): Promise<ThreadInfo[]>;
|
|
917
922
|
removeMessage(messageId: string, scope?: QueueScope): Promise<boolean>;
|
|
918
923
|
clearMessages(threadId: string, scope?: QueueScope): Promise<void>;
|
|
919
924
|
markProcessing(messageId: string, customRunConfig?: unknown, scope?: QueueScope): Promise<void>;
|
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, StoreProtocol, StorePutInput, StoreItem, StoreSearchInput, 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, UserExternalIdentityStore, UserExternalIdentity, OidcProviderConfigStore, OidcProviderConfig, CreateOidcProviderConfigInput, UpdateOidcProviderConfigInput, PlatformMemberStore, PlatformMember, PlatformInvitationStore, PlatformInvitation, OidcIdentityClaimStore, OidcIdentityClaimStatus, OidcIdentityClaim, CreateOidcIdentityClaimInput, UpdateOidcIdentityClaimInput, OidcIdentityClaimApproval, InviteLinkStore, InviteLink, CreateInviteLinkInput, PlatformSettingsStore, PlatformSettingsRecord, PlatformSettingsDocument, PlatformAuditStore, PlatformAuditAppendInput, PlatformAuditRecord, PlatformAuditQuery, DatabaseConfigStore, DatabaseConfigEntry, CreateDatabaseConfigRequest, UpdateDatabaseConfigRequest, ConnectionStore, ConnectionEntry, MetricsServerConfigStore, MetricsServerConfigEntry, CreateMetricsServerConfigRequest, UpdateMetricsServerConfigRequest, McpServerConfigStore, PersonalMcpServerConfigStore, McpServerConfigEntry, CreateMcpServerConfigRequest, UpdateMcpServerConfigRequest, PersonalMcpServerConfigEntry, ModelProviderStore, ModelProviderEntry, CreateModelProviderRequest, UpdateModelProviderRequest, ModelProviderStatus, ModelProviderModelEntry, ProviderModelInput, 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, UpdateA2AApiKeyInput, A2AApiKeyEntry, OpenAuditStore,
|
|
3
|
+
import { ThreadStore, Thread, ThreadMonitorQuery, ThreadMonitorRecord, CreateThreadRequest, StoreProtocol, StorePutInput, StoreItem, StoreSearchInput, 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, UserExternalIdentityStore, UserExternalIdentity, OidcProviderConfigStore, OidcProviderConfig, CreateOidcProviderConfigInput, UpdateOidcProviderConfigInput, PlatformMemberStore, PlatformMember, PlatformInvitationStore, PlatformInvitation, OidcIdentityClaimStore, OidcIdentityClaimStatus, OidcIdentityClaim, CreateOidcIdentityClaimInput, UpdateOidcIdentityClaimInput, OidcIdentityClaimApproval, InviteLinkStore, InviteLink, CreateInviteLinkInput, PlatformSettingsStore, PlatformSettingsRecord, PlatformSettingsDocument, PlatformAuditStore, PlatformAuditAppendInput, PlatformAuditRecord, PlatformAuditQuery, DatabaseConfigStore, DatabaseConfigEntry, CreateDatabaseConfigRequest, UpdateDatabaseConfigRequest, ConnectionStore, ConnectionEntry, MetricsServerConfigStore, MetricsServerConfigEntry, CreateMetricsServerConfigRequest, UpdateMetricsServerConfigRequest, McpServerConfigStore, PersonalMcpServerConfigStore, McpServerConfigEntry, CreateMcpServerConfigRequest, UpdateMcpServerConfigRequest, PersonalMcpServerConfigEntry, ModelProviderStore, ModelProviderEntry, CreateModelProviderRequest, UpdateModelProviderRequest, ModelProviderStatus, ModelProviderModelEntry, ProviderModelInput, 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, UpdateA2AApiKeyInput, A2AApiKeyEntry, OpenAuditStore, OpenAuditRecord, OpenAuditQuery, OpenAuditAppendInput, 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, ClaimMessagesOptions, ThreadInfo } from '@axiom-lattice/core';
|
|
5
5
|
|
|
6
6
|
/**
|
|
@@ -197,6 +197,10 @@ declare class LocalThreadStore implements ThreadStore {
|
|
|
197
197
|
/** Add a column if it does not exist (SQLite version compatible). */
|
|
198
198
|
private ensureColumn;
|
|
199
199
|
getThreadsByAssistantId(tenantId: string, assistantId: string, metadataFilter?: Record<string, string>): Promise<Thread[]>;
|
|
200
|
+
listThreadsByTenant(tenantId: string, query?: ThreadMonitorQuery): Promise<{
|
|
201
|
+
records: ThreadMonitorRecord[];
|
|
202
|
+
total: number;
|
|
203
|
+
}>;
|
|
200
204
|
getThreadById(tenantId: string, threadId: string): Promise<Thread | undefined>;
|
|
201
205
|
createThread(tenantId: string, assistantId: string, threadId: string, data: CreateThreadRequest): Promise<Thread>;
|
|
202
206
|
updateThread(tenantId: string, threadId: string, updates: Partial<CreateThreadRequest>): Promise<Thread | null>;
|
|
@@ -893,6 +897,7 @@ declare class LocalA2AApiKeyStore implements A2AApiKeyStore {
|
|
|
893
897
|
declare class LocalOpenAuditStore implements OpenAuditStore {
|
|
894
898
|
private db;
|
|
895
899
|
constructor(db: DatabaseWrapper);
|
|
900
|
+
get(tenantId: string, id: string): Promise<OpenAuditRecord | null>;
|
|
896
901
|
query(params: OpenAuditQuery): Promise<OpenAuditRecord[]>;
|
|
897
902
|
append(record: OpenAuditAppendInput): Promise<void>;
|
|
898
903
|
}
|
|
@@ -913,7 +918,7 @@ declare class LocalThreadMessageQueueStore implements IMessageQueueStore {
|
|
|
913
918
|
claimPendingMessages(threadId: string, scope: QueueScope | undefined, options: ClaimMessagesOptions): Promise<PendingMessage[]>;
|
|
914
919
|
reclaimExpiredProcessing(threadId: string, scope?: QueueScope): Promise<number>;
|
|
915
920
|
getQueueSize(threadId: string, scope?: QueueScope): Promise<number>;
|
|
916
|
-
getThreadsWithPendingMessages(): Promise<ThreadInfo[]>;
|
|
921
|
+
getThreadsWithPendingMessages(tenantId?: string): Promise<ThreadInfo[]>;
|
|
917
922
|
removeMessage(messageId: string, scope?: QueueScope): Promise<boolean>;
|
|
918
923
|
clearMessages(threadId: string, scope?: QueueScope): Promise<void>;
|
|
919
924
|
markProcessing(messageId: string, customRunConfig?: unknown, scope?: QueueScope): Promise<void>;
|
package/dist/index.js
CHANGED
|
@@ -359,6 +359,7 @@ var MigrationManager = class {
|
|
|
359
359
|
var import_langgraph_checkpoint_sqlite = require("@langchain/langgraph-checkpoint-sqlite");
|
|
360
360
|
|
|
361
361
|
// src/stores/LocalThreadStore.ts
|
|
362
|
+
var import_protocols = require("@axiom-lattice/protocols");
|
|
362
363
|
var STORE_NAME = "lt_threads";
|
|
363
364
|
var DDL = `
|
|
364
365
|
CREATE TABLE IF NOT EXISTS lt_threads (
|
|
@@ -408,6 +409,30 @@ var LocalThreadStore = class {
|
|
|
408
409
|
}
|
|
409
410
|
return threads;
|
|
410
411
|
}
|
|
412
|
+
async listThreadsByTenant(tenantId, query = {}) {
|
|
413
|
+
const limit = Math.min(200, Math.max(1, Math.floor(query.limit ?? 50)));
|
|
414
|
+
const offset = Math.max(0, Math.floor(query.offset ?? 0));
|
|
415
|
+
const createdAfter = query.createdAfter ? Date.parse(query.createdAfter) : void 0;
|
|
416
|
+
const rows2 = this.db.prepare(
|
|
417
|
+
`SELECT * FROM lt_threads WHERE tenant_id = ? ORDER BY created_at DESC, id DESC`
|
|
418
|
+
).all(tenantId);
|
|
419
|
+
const filtered = rows2.map(mapRowToThread).filter((thread) => {
|
|
420
|
+
if (query.assistantId && thread.assistantId !== query.assistantId) {
|
|
421
|
+
return false;
|
|
422
|
+
}
|
|
423
|
+
if (createdAfter !== void 0 && Number.isFinite(createdAfter) && thread.createdAt.getTime() < createdAfter) {
|
|
424
|
+
return false;
|
|
425
|
+
}
|
|
426
|
+
if (query.kind && (0, import_protocols.classifyThreadMetadata)(thread.metadata) !== query.kind) {
|
|
427
|
+
return false;
|
|
428
|
+
}
|
|
429
|
+
return true;
|
|
430
|
+
});
|
|
431
|
+
return {
|
|
432
|
+
records: filtered.slice(offset, offset + limit).map(import_protocols.toThreadMonitorRecord),
|
|
433
|
+
total: filtered.length
|
|
434
|
+
};
|
|
435
|
+
}
|
|
411
436
|
async getThreadById(tenantId, threadId) {
|
|
412
437
|
const row = this.db.prepare(
|
|
413
438
|
`SELECT * FROM lt_threads WHERE tenant_id = ? AND id = ?`
|
|
@@ -490,9 +515,9 @@ function mapRowToThread(row) {
|
|
|
490
515
|
}
|
|
491
516
|
|
|
492
517
|
// src/stores/LocalStore.ts
|
|
493
|
-
var
|
|
518
|
+
var import_protocols2 = require("@axiom-lattice/protocols");
|
|
494
519
|
var STORE_NAME2 = "lt_store_items";
|
|
495
|
-
var NAMESPACE_SEPARATOR =
|
|
520
|
+
var NAMESPACE_SEPARATOR = import_protocols2.STORE_IDENTITY_SEPARATOR;
|
|
496
521
|
var DDL2 = `
|
|
497
522
|
CREATE TABLE IF NOT EXISTS lt_store_items (
|
|
498
523
|
tenant_id TEXT NOT NULL,
|
|
@@ -555,13 +580,13 @@ var LocalStore = class {
|
|
|
555
580
|
mm.migrate();
|
|
556
581
|
}
|
|
557
582
|
async put(tenantId, input) {
|
|
558
|
-
(0,
|
|
583
|
+
(0, import_protocols2.assertStoreIdentity)(input.namespace, input.key);
|
|
559
584
|
const now = nowISO();
|
|
560
585
|
const path2 = namespacePath(input.namespace);
|
|
561
586
|
const existing = this.db.prepare(
|
|
562
587
|
`SELECT created_at FROM lt_store_items WHERE tenant_id = ? AND namespace_path = ? AND key = ?`
|
|
563
588
|
).get(tenantId, path2, input.key);
|
|
564
|
-
const expiresAt = (0,
|
|
589
|
+
const expiresAt = (0, import_protocols2.storeExpiresAt)(input.ttlMinutes)?.toISOString() ?? null;
|
|
565
590
|
this.db.prepare(
|
|
566
591
|
`INSERT INTO lt_store_items
|
|
567
592
|
(tenant_id, namespace_path, key, value, created_at, updated_at, expires_at)
|
|
@@ -589,7 +614,7 @@ var LocalStore = class {
|
|
|
589
614
|
};
|
|
590
615
|
}
|
|
591
616
|
async get(tenantId, namespace, key) {
|
|
592
|
-
(0,
|
|
617
|
+
(0, import_protocols2.assertStoreIdentity)(namespace, key);
|
|
593
618
|
const now = nowISO();
|
|
594
619
|
const row = this.db.prepare(
|
|
595
620
|
`SELECT * FROM lt_store_items
|
|
@@ -599,7 +624,7 @@ var LocalStore = class {
|
|
|
599
624
|
return row ? mapRow(row) : null;
|
|
600
625
|
}
|
|
601
626
|
async delete(tenantId, namespace, key) {
|
|
602
|
-
(0,
|
|
627
|
+
(0, import_protocols2.assertStoreIdentity)(namespace, key);
|
|
603
628
|
const result = this.db.prepare(
|
|
604
629
|
`DELETE FROM lt_store_items WHERE tenant_id = ? AND namespace_path = ? AND key = ?`
|
|
605
630
|
).run(tenantId, namespacePath(namespace), key);
|
|
@@ -608,10 +633,10 @@ var LocalStore = class {
|
|
|
608
633
|
async search(tenantId, input) {
|
|
609
634
|
const now = nowISO();
|
|
610
635
|
const prefix = input.namespacePrefix ?? [];
|
|
611
|
-
(0,
|
|
636
|
+
(0, import_protocols2.assertStoreNamespacePrefix)(prefix);
|
|
612
637
|
const query = input.query?.toLowerCase();
|
|
613
|
-
const limit = (0,
|
|
614
|
-
const offset = (0,
|
|
638
|
+
const limit = (0, import_protocols2.storePaginationValue)(input.limit, 10);
|
|
639
|
+
const offset = (0, import_protocols2.storePaginationValue)(input.offset, 0);
|
|
615
640
|
const rows2 = this.db.prepare(
|
|
616
641
|
`SELECT * FROM lt_store_items
|
|
617
642
|
WHERE tenant_id = ? AND (expires_at IS NULL OR expires_at > ?)`
|
|
@@ -619,7 +644,7 @@ var LocalStore = class {
|
|
|
619
644
|
return rows2.map(mapRow).filter((item) => hasPrefix(item.namespace, prefix)).filter((item) => input.filter === void 0 || matchesFilter(item.value, input.filter)).filter((item) => query === void 0 || JSON.stringify(item.value).toLowerCase().includes(query)).sort((left, right) => right.updatedAt.getTime() - left.updatedAt.getTime() || namespacePath(left.namespace).localeCompare(namespacePath(right.namespace)) || left.key.localeCompare(right.key)).slice(offset, offset + limit);
|
|
620
645
|
}
|
|
621
646
|
async listNamespaces(tenantId, prefix = [], limit = 100) {
|
|
622
|
-
(0,
|
|
647
|
+
(0, import_protocols2.assertStoreNamespacePrefix)(prefix);
|
|
623
648
|
const rows2 = this.db.prepare(
|
|
624
649
|
`SELECT DISTINCT namespace_path FROM lt_store_items
|
|
625
650
|
WHERE tenant_id = ? AND (expires_at IS NULL OR expires_at > ?)`
|
|
@@ -629,14 +654,14 @@ var LocalStore = class {
|
|
|
629
654
|
const namespace = row.namespace_path.split(NAMESPACE_SEPARATOR);
|
|
630
655
|
if (hasPrefix(namespace, prefix)) namespaces.set(row.namespace_path, namespace);
|
|
631
656
|
}
|
|
632
|
-
return Array.from(namespaces.entries()).sort(([left], [right]) => left.localeCompare(right)).slice(0, (0,
|
|
657
|
+
return Array.from(namespaces.entries()).sort(([left], [right]) => left.localeCompare(right)).slice(0, (0, import_protocols2.storePaginationValue)(limit, 100)).map(([, namespace]) => namespace);
|
|
633
658
|
}
|
|
634
659
|
async deleteExpired(now, limit) {
|
|
635
660
|
const rows2 = this.db.prepare(
|
|
636
661
|
`SELECT tenant_id, namespace_path, key FROM lt_store_items
|
|
637
662
|
WHERE expires_at IS NOT NULL AND expires_at <= ?
|
|
638
663
|
LIMIT ?`
|
|
639
|
-
).all(now.toISOString(), (0,
|
|
664
|
+
).all(now.toISOString(), (0, import_protocols2.storePaginationValue)(limit, 0));
|
|
640
665
|
const statement = this.db.prepare(
|
|
641
666
|
`DELETE FROM lt_store_items WHERE tenant_id = ? AND namespace_path = ? AND key = ?`
|
|
642
667
|
);
|
|
@@ -863,7 +888,7 @@ function mapRowToWorkspace(row) {
|
|
|
863
888
|
}
|
|
864
889
|
|
|
865
890
|
// src/stores/LocalProjectStore.ts
|
|
866
|
-
var
|
|
891
|
+
var import_protocols3 = require("@axiom-lattice/protocols");
|
|
867
892
|
var DDL5 = `
|
|
868
893
|
CREATE TABLE IF NOT EXISTS lt_projects (
|
|
869
894
|
id TEXT NOT NULL,
|
|
@@ -904,7 +929,7 @@ var LocalProjectStore = class {
|
|
|
904
929
|
return row ? mapRowToProject(row) : null;
|
|
905
930
|
}
|
|
906
931
|
async createProject(tenantId, workspaceId, id, data) {
|
|
907
|
-
(0,
|
|
932
|
+
(0, import_protocols3.assertGenericProjectConfig)(data.config);
|
|
908
933
|
const now = nowISO();
|
|
909
934
|
const kind = data.kind || "business";
|
|
910
935
|
this.db.prepare(
|
|
@@ -925,7 +950,7 @@ var LocalProjectStore = class {
|
|
|
925
950
|
return await this.getProjectById(tenantId, id);
|
|
926
951
|
}
|
|
927
952
|
async updateProject(tenantId, id, updates) {
|
|
928
|
-
(0,
|
|
953
|
+
(0, import_protocols3.assertGenericProjectConfig)(updates.config);
|
|
929
954
|
const existing = await this.getProjectById(tenantId, id);
|
|
930
955
|
if (!existing) return null;
|
|
931
956
|
const setClauses = [];
|
|
@@ -2028,7 +2053,7 @@ function mapRowToTenant(row) {
|
|
|
2028
2053
|
}
|
|
2029
2054
|
|
|
2030
2055
|
// src/stores/LocalUserTenantLinkStore.ts
|
|
2031
|
-
var
|
|
2056
|
+
var import_protocols4 = require("@axiom-lattice/protocols");
|
|
2032
2057
|
var DDL8 = `
|
|
2033
2058
|
CREATE TABLE IF NOT EXISTS lt_user_tenant_links (
|
|
2034
2059
|
user_id TEXT NOT NULL,
|
|
@@ -2065,7 +2090,7 @@ var LocalUserTenantLinkStore = class {
|
|
|
2065
2090
|
return row ? mapRowToLink(row) : null;
|
|
2066
2091
|
}
|
|
2067
2092
|
async createLink(data) {
|
|
2068
|
-
(0,
|
|
2093
|
+
(0, import_protocols4.assertNotPlatformTenant)(data.tenantId);
|
|
2069
2094
|
const now = nowISO();
|
|
2070
2095
|
const role2 = data.role || "member";
|
|
2071
2096
|
const metadata = JSON.stringify(data.metadata || {});
|
|
@@ -2128,7 +2153,7 @@ function mapRowToLink(row) {
|
|
|
2128
2153
|
}
|
|
2129
2154
|
|
|
2130
2155
|
// src/stores/LocalUserExternalIdentityStore.ts
|
|
2131
|
-
var
|
|
2156
|
+
var import_protocols5 = require("@axiom-lattice/protocols");
|
|
2132
2157
|
var DDL9 = `
|
|
2133
2158
|
CREATE TABLE IF NOT EXISTS lt_user_identities (
|
|
2134
2159
|
user_id TEXT NOT NULL,
|
|
@@ -2187,14 +2212,14 @@ var LocalUserExternalIdentityStore = class {
|
|
|
2187
2212
|
identity.subject
|
|
2188
2213
|
);
|
|
2189
2214
|
if (!existing) {
|
|
2190
|
-
throw new
|
|
2215
|
+
throw new import_protocols5.ExternalIdentityPersistError(
|
|
2191
2216
|
identity.providerId,
|
|
2192
2217
|
identity.issuer,
|
|
2193
2218
|
identity.subject
|
|
2194
2219
|
);
|
|
2195
2220
|
}
|
|
2196
2221
|
if (existing.userId !== identity.userId) {
|
|
2197
|
-
throw new
|
|
2222
|
+
throw new import_protocols5.ExternalIdentityConflictError(
|
|
2198
2223
|
identity.providerId,
|
|
2199
2224
|
identity.issuer,
|
|
2200
2225
|
identity.subject
|
|
@@ -2217,7 +2242,7 @@ var LocalUserExternalIdentityStore = class {
|
|
|
2217
2242
|
|
|
2218
2243
|
// src/stores/LocalOidcProviderConfigStore.ts
|
|
2219
2244
|
var import_core = require("@axiom-lattice/core");
|
|
2220
|
-
var
|
|
2245
|
+
var import_protocols6 = require("@axiom-lattice/protocols");
|
|
2221
2246
|
var DDL10 = `
|
|
2222
2247
|
CREATE TABLE IF NOT EXISTS lattice_oidc_provider_configs (
|
|
2223
2248
|
id TEXT NOT NULL PRIMARY KEY,
|
|
@@ -2303,7 +2328,7 @@ var LocalOidcProviderConfigStore = class {
|
|
|
2303
2328
|
}
|
|
2304
2329
|
async create(id, input) {
|
|
2305
2330
|
if (this.db.prepare(`SELECT 1 FROM lattice_oidc_provider_configs WHERE id = ?`).get(id)) {
|
|
2306
|
-
throw new
|
|
2331
|
+
throw new import_protocols6.OidcProviderConfigConflictError(id);
|
|
2307
2332
|
}
|
|
2308
2333
|
const now = nowISO();
|
|
2309
2334
|
const tenantId = normalizeTenantId(input.defaultTenantId);
|
|
@@ -2331,7 +2356,7 @@ var LocalOidcProviderConfigStore = class {
|
|
|
2331
2356
|
);
|
|
2332
2357
|
} catch (error) {
|
|
2333
2358
|
if (error instanceof Error && /UNIQUE constraint failed/.test(error.message)) {
|
|
2334
|
-
throw new
|
|
2359
|
+
throw new import_protocols6.OidcProviderConfigConflictError(id);
|
|
2335
2360
|
}
|
|
2336
2361
|
throw error;
|
|
2337
2362
|
}
|
|
@@ -2474,7 +2499,7 @@ var LocalPlatformMemberStore = class {
|
|
|
2474
2499
|
};
|
|
2475
2500
|
|
|
2476
2501
|
// src/stores/LocalPlatformInvitationStore.ts
|
|
2477
|
-
var
|
|
2502
|
+
var import_protocols7 = require("@axiom-lattice/protocols");
|
|
2478
2503
|
var DDL12 = `
|
|
2479
2504
|
CREATE TABLE IF NOT EXISTS lattice_platform_invitations (
|
|
2480
2505
|
email TEXT NOT NULL PRIMARY KEY,
|
|
@@ -2507,7 +2532,7 @@ var LocalPlatformInvitationStore = class {
|
|
|
2507
2532
|
}
|
|
2508
2533
|
/** Returns the invitation for an email, or null. */
|
|
2509
2534
|
async get(email) {
|
|
2510
|
-
const row = this.db.prepare(`SELECT * FROM lattice_platform_invitations WHERE email = ?`).get((0,
|
|
2535
|
+
const row = this.db.prepare(`SELECT * FROM lattice_platform_invitations WHERE email = ?`).get((0, import_protocols7.normalizePlatformInvitationEmail)(email));
|
|
2511
2536
|
return row ? mapRow10(row) : null;
|
|
2512
2537
|
}
|
|
2513
2538
|
/**
|
|
@@ -2517,7 +2542,7 @@ var LocalPlatformInvitationStore = class {
|
|
|
2517
2542
|
* including `expiresAt` and `consumedAt`.
|
|
2518
2543
|
*/
|
|
2519
2544
|
async upsert(invitation) {
|
|
2520
|
-
const email = (0,
|
|
2545
|
+
const email = (0, import_protocols7.normalizePlatformInvitationEmail)(invitation.email);
|
|
2521
2546
|
this.db.prepare(
|
|
2522
2547
|
`INSERT INTO lattice_platform_invitations
|
|
2523
2548
|
(email, role, invited_by, created_at, expires_at, consumed_at)
|
|
@@ -2544,7 +2569,7 @@ var LocalPlatformInvitationStore = class {
|
|
|
2544
2569
|
}
|
|
2545
2570
|
/** Deletes an invitation. Returns whether a row was removed. */
|
|
2546
2571
|
async delete(email) {
|
|
2547
|
-
const result = this.db.prepare(`DELETE FROM lattice_platform_invitations WHERE email = ?`).run((0,
|
|
2572
|
+
const result = this.db.prepare(`DELETE FROM lattice_platform_invitations WHERE email = ?`).run((0, import_protocols7.normalizePlatformInvitationEmail)(email));
|
|
2548
2573
|
return result.changes > 0;
|
|
2549
2574
|
}
|
|
2550
2575
|
/**
|
|
@@ -2554,7 +2579,7 @@ var LocalPlatformInvitationStore = class {
|
|
|
2554
2579
|
* consumed, or expired.
|
|
2555
2580
|
*/
|
|
2556
2581
|
async consume(email, at) {
|
|
2557
|
-
const normalized = (0,
|
|
2582
|
+
const normalized = (0, import_protocols7.normalizePlatformInvitationEmail)(email);
|
|
2558
2583
|
const timestamp2 = at.toISOString();
|
|
2559
2584
|
const result = this.db.prepare(
|
|
2560
2585
|
`UPDATE lattice_platform_invitations
|
|
@@ -2569,7 +2594,7 @@ var LocalPlatformInvitationStore = class {
|
|
|
2569
2594
|
};
|
|
2570
2595
|
|
|
2571
2596
|
// src/stores/LocalOidcIdentityClaimStore.ts
|
|
2572
|
-
var
|
|
2597
|
+
var import_protocols8 = require("@axiom-lattice/protocols");
|
|
2573
2598
|
var DDL13 = `
|
|
2574
2599
|
CREATE TABLE IF NOT EXISTS lattice_oidc_identity_claims (
|
|
2575
2600
|
id TEXT NOT NULL PRIMARY KEY,
|
|
@@ -2669,7 +2694,7 @@ var LocalOidcIdentityClaimStore = class {
|
|
|
2669
2694
|
).get(input.providerId, input.issuer, input.subject);
|
|
2670
2695
|
if (existing) {
|
|
2671
2696
|
if (parseISO(existing.expires_at).getTime() > now.getTime()) {
|
|
2672
|
-
throw new
|
|
2697
|
+
throw new import_protocols8.OidcIdentityClaimConflictError(
|
|
2673
2698
|
input.providerId,
|
|
2674
2699
|
input.issuer,
|
|
2675
2700
|
input.subject
|
|
@@ -2696,7 +2721,7 @@ var LocalOidcIdentityClaimStore = class {
|
|
|
2696
2721
|
input.providerId,
|
|
2697
2722
|
input.issuer,
|
|
2698
2723
|
input.subject,
|
|
2699
|
-
(0,
|
|
2724
|
+
(0, import_protocols8.normalizeOidcIdentityEmail)(input.email),
|
|
2700
2725
|
input.name ?? null,
|
|
2701
2726
|
input.picture ?? null,
|
|
2702
2727
|
timestamp2,
|
|
@@ -2712,7 +2737,7 @@ var LocalOidcIdentityClaimStore = class {
|
|
|
2712
2737
|
} catch (error) {
|
|
2713
2738
|
const message = error instanceof Error ? error.message : String(error);
|
|
2714
2739
|
if (message.toLowerCase().includes("unique")) {
|
|
2715
|
-
throw new
|
|
2740
|
+
throw new import_protocols8.OidcIdentityClaimConflictError(
|
|
2716
2741
|
input.providerId,
|
|
2717
2742
|
input.issuer,
|
|
2718
2743
|
input.subject
|
|
@@ -2729,7 +2754,7 @@ var LocalOidcIdentityClaimStore = class {
|
|
|
2729
2754
|
const params = [];
|
|
2730
2755
|
if (updates.email !== void 0) {
|
|
2731
2756
|
sets.push("email = ?");
|
|
2732
|
-
params.push((0,
|
|
2757
|
+
params.push((0, import_protocols8.normalizeOidcIdentityEmail)(updates.email));
|
|
2733
2758
|
}
|
|
2734
2759
|
if (updates.name !== void 0) {
|
|
2735
2760
|
sets.push("name = ?");
|
|
@@ -2779,7 +2804,7 @@ var LocalOidcIdentityClaimStore = class {
|
|
|
2779
2804
|
|
|
2780
2805
|
// src/stores/LocalInviteLinkStore.ts
|
|
2781
2806
|
var import_core2 = require("@axiom-lattice/core");
|
|
2782
|
-
var
|
|
2807
|
+
var import_protocols9 = require("@axiom-lattice/protocols");
|
|
2783
2808
|
var DDL14 = `
|
|
2784
2809
|
CREATE TABLE IF NOT EXISTS lattice_invite_links (
|
|
2785
2810
|
id TEXT NOT NULL PRIMARY KEY,
|
|
@@ -2856,7 +2881,7 @@ var LocalInviteLinkStore = class {
|
|
|
2856
2881
|
input.scope,
|
|
2857
2882
|
input.tokenHash,
|
|
2858
2883
|
(0, import_core2.encrypt)(input.token),
|
|
2859
|
-
input.email ? (0,
|
|
2884
|
+
input.email ? (0, import_protocols9.normalizeInviteLinkEmail)(input.email) : null,
|
|
2860
2885
|
input.platformRole ?? null,
|
|
2861
2886
|
input.tenantId ?? null,
|
|
2862
2887
|
input.tenantRole ?? null,
|
|
@@ -2892,7 +2917,7 @@ var LocalInviteLinkStore = class {
|
|
|
2892
2917
|
};
|
|
2893
2918
|
|
|
2894
2919
|
// src/stores/LocalPlatformSettingsStore.ts
|
|
2895
|
-
var
|
|
2920
|
+
var import_protocols10 = require("@axiom-lattice/protocols");
|
|
2896
2921
|
var SETTINGS_ID = "default";
|
|
2897
2922
|
var COLUMNS = "id, document, version, updated_by, updated_at";
|
|
2898
2923
|
function normalizeUpdatedBy(updatedBy) {
|
|
@@ -2956,7 +2981,7 @@ var LocalPlatformSettingsStore = class {
|
|
|
2956
2981
|
);
|
|
2957
2982
|
if (result.changes === 0) {
|
|
2958
2983
|
const actual = this.db.prepare(`SELECT version FROM lattice_platform_settings WHERE id = ?`).get(SETTINGS_ID);
|
|
2959
|
-
throw new
|
|
2984
|
+
throw new import_protocols10.PlatformSettingsVersionConflictError(
|
|
2960
2985
|
expectedVersion,
|
|
2961
2986
|
actual ? Number(actual.version) : 0
|
|
2962
2987
|
);
|
|
@@ -5319,11 +5344,11 @@ var LocalEvalStore = class {
|
|
|
5319
5344
|
};
|
|
5320
5345
|
|
|
5321
5346
|
// src/stores/LocalChannelBindingStore.ts
|
|
5322
|
-
var
|
|
5347
|
+
var import_protocols12 = require("@axiom-lattice/protocols");
|
|
5323
5348
|
var import_crypto2 = require("crypto");
|
|
5324
5349
|
|
|
5325
5350
|
// src/stores/room-channel-binding-index.ts
|
|
5326
|
-
var
|
|
5351
|
+
var import_protocols11 = require("@axiom-lattice/protocols");
|
|
5327
5352
|
var UNIQUE_INDEX_SQL = `CREATE UNIQUE INDEX IF NOT EXISTS idx_lt_cb_subject_unique
|
|
5328
5353
|
ON lt_channel_bindings(channel, channel_installation_id, tenant_id, sender_id)`;
|
|
5329
5354
|
var LOOKUP_INDEX_SQL = `CREATE INDEX IF NOT EXISTS idx_lt_cb_resolve
|
|
@@ -5337,7 +5362,7 @@ function ensureChannelBindingSubjectIndex(db) {
|
|
|
5337
5362
|
HAVING COUNT(*) > 1
|
|
5338
5363
|
ORDER BY tenant_id, channel, channel_installation_id, sender_id`).all();
|
|
5339
5364
|
if (conflicts.length > 0) {
|
|
5340
|
-
throw new
|
|
5365
|
+
throw new import_protocols11.ChannelBindingMigrationConflictError(conflicts.map(mapConflict));
|
|
5341
5366
|
}
|
|
5342
5367
|
db.exec("DROP INDEX IF EXISTS idx_lt_cb_room_subject");
|
|
5343
5368
|
db.exec(UNIQUE_INDEX_SQL);
|
|
@@ -5435,7 +5460,7 @@ var LocalChannelBindingStore = class {
|
|
|
5435
5460
|
);
|
|
5436
5461
|
} catch (error) {
|
|
5437
5462
|
if (error instanceof Error && /UNIQUE constraint failed/.test(error.message)) {
|
|
5438
|
-
throw new
|
|
5463
|
+
throw new import_protocols12.DuplicateChannelBindingSubjectError();
|
|
5439
5464
|
}
|
|
5440
5465
|
throw error;
|
|
5441
5466
|
}
|
|
@@ -5949,6 +5974,24 @@ var LocalOpenAuditStore = class {
|
|
|
5949
5974
|
this.db = db;
|
|
5950
5975
|
ensureTable(db, DDL27);
|
|
5951
5976
|
}
|
|
5977
|
+
async get(tenantId, id) {
|
|
5978
|
+
const row = this.db.prepare("SELECT * FROM lt_open_audit WHERE tenant_id = ? AND id = ?").get(tenantId, id);
|
|
5979
|
+
if (!row) return null;
|
|
5980
|
+
return {
|
|
5981
|
+
id: row.id,
|
|
5982
|
+
tenantId: row.tenant_id,
|
|
5983
|
+
credentialId: row.credential_id,
|
|
5984
|
+
credentialKind: row.credential_kind,
|
|
5985
|
+
projectId: row.project_id,
|
|
5986
|
+
domain: row.domain,
|
|
5987
|
+
action: row.action,
|
|
5988
|
+
args: row.args ? JSON.parse(row.args) : void 0,
|
|
5989
|
+
status: row.status,
|
|
5990
|
+
errorCode: row.error_code ?? void 0,
|
|
5991
|
+
durationMs: row.duration_ms,
|
|
5992
|
+
createdAt: parseISO(row.created_at)
|
|
5993
|
+
};
|
|
5994
|
+
}
|
|
5952
5995
|
async query(params) {
|
|
5953
5996
|
const clauses = ["tenant_id = ?"];
|
|
5954
5997
|
const values = [params.tenantId];
|
|
@@ -5956,10 +5999,18 @@ var LocalOpenAuditStore = class {
|
|
|
5956
5999
|
clauses.push("credential_id = ?");
|
|
5957
6000
|
values.push(params.credentialId);
|
|
5958
6001
|
}
|
|
6002
|
+
if (params.projectId) {
|
|
6003
|
+
clauses.push("project_id = ?");
|
|
6004
|
+
values.push(params.projectId);
|
|
6005
|
+
}
|
|
5959
6006
|
if (params.domain) {
|
|
5960
6007
|
clauses.push("domain = ?");
|
|
5961
6008
|
values.push(params.domain);
|
|
5962
6009
|
}
|
|
6010
|
+
if (params.action) {
|
|
6011
|
+
clauses.push("action = ?");
|
|
6012
|
+
values.push(params.action);
|
|
6013
|
+
}
|
|
5963
6014
|
if (params.status) {
|
|
5964
6015
|
clauses.push("status = ?");
|
|
5965
6016
|
values.push(params.status);
|
|
@@ -6017,7 +6068,7 @@ var LocalOpenAuditStore = class {
|
|
|
6017
6068
|
};
|
|
6018
6069
|
|
|
6019
6070
|
// src/stores/LocalThreadMessageQueueStore.ts
|
|
6020
|
-
var
|
|
6071
|
+
var import_protocols13 = require("@axiom-lattice/protocols");
|
|
6021
6072
|
var import_crypto5 = require("crypto");
|
|
6022
6073
|
var DDL28 = `
|
|
6023
6074
|
CREATE TABLE IF NOT EXISTS lt_thread_message_queue (
|
|
@@ -6229,15 +6280,16 @@ var LocalThreadMessageQueueStore = class {
|
|
|
6229
6280
|
).get(threadId, ...filter.params);
|
|
6230
6281
|
return row.count;
|
|
6231
6282
|
}
|
|
6232
|
-
async getThreadsWithPendingMessages() {
|
|
6283
|
+
async getThreadsWithPendingMessages(tenantId) {
|
|
6233
6284
|
const rows2 = this.db.prepare(
|
|
6234
6285
|
`SELECT tenant_id, assistant_id, thread_id, workspace_id, project_id,
|
|
6235
6286
|
MAX(status = 'pending') AS has_pending
|
|
6236
6287
|
FROM lt_thread_message_queue
|
|
6237
6288
|
WHERE status IN ('pending', 'processing')
|
|
6289
|
+
${tenantId ? "AND tenant_id = ?" : ""}
|
|
6238
6290
|
GROUP BY tenant_id, assistant_id, thread_id, workspace_id, project_id
|
|
6239
6291
|
ORDER BY thread_id`
|
|
6240
|
-
).all();
|
|
6292
|
+
).all(...tenantId ? [tenantId] : []);
|
|
6241
6293
|
return rows2.map((r) => ({
|
|
6242
6294
|
tenantId: r.tenant_id,
|
|
6243
6295
|
assistantId: r.assistant_id,
|
|
@@ -6280,8 +6332,8 @@ var LocalThreadMessageQueueStore = class {
|
|
|
6280
6332
|
};
|
|
6281
6333
|
function validateQueueTrust(params) {
|
|
6282
6334
|
return {
|
|
6283
|
-
trustedRunContext: params.trusted_run_context === void 0 ? void 0 : (0,
|
|
6284
|
-
executionMode: params.execution_mode === void 0 ? void 0 : (0,
|
|
6335
|
+
trustedRunContext: params.trusted_run_context === void 0 ? void 0 : (0, import_protocols13.parseTrustedRunContext)(params.trusted_run_context),
|
|
6336
|
+
executionMode: params.execution_mode === void 0 ? void 0 : (0, import_protocols13.parseQueuedExecutionMode)(params.execution_mode)
|
|
6285
6337
|
};
|
|
6286
6338
|
}
|
|
6287
6339
|
function scopeClause(scope) {
|
|
@@ -6302,8 +6354,8 @@ function rowToMessage(row) {
|
|
|
6302
6354
|
priority: row.priority || 0,
|
|
6303
6355
|
command: row.command ? JSON.parse(row.command) : void 0,
|
|
6304
6356
|
custom_run_config: row.custom_run_config ? JSON.parse(row.custom_run_config) : void 0,
|
|
6305
|
-
trusted_run_context: row.trusted_run_context ? (0,
|
|
6306
|
-
execution_mode: row.execution_mode == null ? void 0 : (0,
|
|
6357
|
+
trusted_run_context: row.trusted_run_context ? (0, import_protocols13.parseTrustedRunContext)(JSON.parse(row.trusted_run_context)) : void 0,
|
|
6358
|
+
execution_mode: row.execution_mode == null ? void 0 : (0, import_protocols13.parseQueuedExecutionMode)(row.execution_mode)
|
|
6307
6359
|
};
|
|
6308
6360
|
}
|
|
6309
6361
|
|
|
@@ -6827,7 +6879,7 @@ function mapRowToTask(row) {
|
|
|
6827
6879
|
}
|
|
6828
6880
|
|
|
6829
6881
|
// src/stores/LocalTaskStore.ts
|
|
6830
|
-
var
|
|
6882
|
+
var import_protocols14 = require("@axiom-lattice/protocols");
|
|
6831
6883
|
var import_crypto6 = require("crypto");
|
|
6832
6884
|
var MAX_CANONICAL_TASK_TIME = "9999-12-31T23:59:59.999Z";
|
|
6833
6885
|
var TASK_STATUSES = /* @__PURE__ */ new Set([
|
|
@@ -7016,7 +7068,7 @@ var LocalTaskStore = class {
|
|
|
7016
7068
|
if (filter.metadata) {
|
|
7017
7069
|
for (const [key, value] of Object.entries(filter.metadata)) {
|
|
7018
7070
|
const safeKey = key.replace(/[^a-zA-Z0-9_]/g, "");
|
|
7019
|
-
const expected = (0,
|
|
7071
|
+
const expected = (0, import_protocols14.normalizeTaskMetadataScalar)(value);
|
|
7020
7072
|
if (!safeKey || expected === void 0) continue;
|
|
7021
7073
|
if (expected === "true" || expected === "false") {
|
|
7022
7074
|
conditions.push(
|
|
@@ -7591,7 +7643,7 @@ var LocalTaskStore = class {
|
|
|
7591
7643
|
};
|
|
7592
7644
|
|
|
7593
7645
|
// src/stores/LocalTaskWorkItemStore.ts
|
|
7594
|
-
var
|
|
7646
|
+
var import_protocols15 = require("@axiom-lattice/protocols");
|
|
7595
7647
|
var import_uuid2 = require("uuid");
|
|
7596
7648
|
var PROJECT_LIFECYCLE_ACTIONS = /* @__PURE__ */ new Set([
|
|
7597
7649
|
"in_progress",
|
|
@@ -7816,8 +7868,8 @@ var LocalTaskWorkItemStore = class {
|
|
|
7816
7868
|
}
|
|
7817
7869
|
/** List pending execution results using one bounded SQLite anti-join query. */
|
|
7818
7870
|
async listPendingExecutionResults(params) {
|
|
7819
|
-
if (!Number.isSafeInteger(params.limit) || params.limit < 0 || params.limit >
|
|
7820
|
-
const error = new RangeError(`limit must be a safe integer between 0 and ${
|
|
7871
|
+
if (!Number.isSafeInteger(params.limit) || params.limit < 0 || params.limit > import_protocols15.MAX_PENDING_EXECUTION_RESULTS_LIMIT) {
|
|
7872
|
+
const error = new RangeError(`limit must be a safe integer between 0 and ${import_protocols15.MAX_PENDING_EXECUTION_RESULTS_LIMIT}`);
|
|
7821
7873
|
error.code = "INVALID_LIMIT";
|
|
7822
7874
|
throw error;
|
|
7823
7875
|
}
|