@axiom-lattice/local-stores 5.4.1 → 5.5.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 +120 -0
- package/dist/index.d.mts +4 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.js +52 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +52 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
- package/src/__tests__/LocalChannelBindingStore.test.ts +19 -0
- package/src/__tests__/LocalChannelInstallationStore.test.ts +55 -0
- package/src/__tests__/LocalThreadStore.test.ts +58 -1
- package/src/stores/LocalChannelInstallationStore.ts +24 -2
- package/src/stores/LocalThreadStore.ts +34 -0
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @axiom-lattice/local-stores@5.
|
|
2
|
+
> @axiom-lattice/local-stores@5.5.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
|
+
[32mCJS[39m [1mdist/index.js [22m[32m304.13 KB[39m
|
|
12
|
+
[32mCJS[39m [1mdist/index.js.map [22m[32m556.26 KB[39m
|
|
13
|
+
[32mCJS[39m ⚡️ Build success in 796ms
|
|
14
|
+
[32mESM[39m [1mdist/index.mjs [22m[32m298.58 KB[39m
|
|
15
|
+
[32mESM[39m [1mdist/index.mjs.map [22m[32m551.87 KB[39m
|
|
16
|
+
[32mESM[39m ⚡️ Build success in 796ms
|
|
17
17
|
[34mDTS[39m Build start
|
|
18
|
-
[32mDTS[39m ⚡️ Build success in
|
|
19
|
-
[32mDTS[39m [1mdist/index.d.ts [22m[32m56.
|
|
20
|
-
[32mDTS[39m [1mdist/index.d.mts [22m[32m56.
|
|
18
|
+
[32mDTS[39m ⚡️ Build success in 11253ms
|
|
19
|
+
[32mDTS[39m [1mdist/index.d.ts [22m[32m56.40 KB[39m
|
|
20
|
+
[32mDTS[39m [1mdist/index.d.mts [22m[32m56.40 KB[39m
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,125 @@
|
|
|
1
1
|
# @axiom-lattice/local-stores
|
|
2
2
|
|
|
3
|
+
## 5.5.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 0d2e289: ## Channel scoping, integrations hub, sandbox admission, and platform execution limits
|
|
8
|
+
|
|
9
|
+
### Carry execution scope on channel installations
|
|
10
|
+
|
|
11
|
+
Channel installations route messages to `fallbackAgentId` without a persisted
|
|
12
|
+
binding (WeChat always does; Lark/WeCom do while "anyone can message" is on).
|
|
13
|
+
That fallback binding had no `workspaceId`/`projectId`, so personal-assistant
|
|
14
|
+
channel runs were unscoped: the Agent display fell back to `default`, no
|
|
15
|
+
`/project` named volume was mounted, and claw bootstrap hit the sandbox
|
|
16
|
+
image's `/project` (permission denied on images before `0.2.2`).
|
|
17
|
+
|
|
18
|
+
Installations now persist optional `workspaceId`/`projectId` (PG migration
|
|
19
|
+
v224, Local SQLite, InMemory, export/import), the PA channel modal fills them
|
|
20
|
+
from the personal assistant on create/update, and the router's fallback
|
|
21
|
+
binding applies them before dispatch. Legacy unscoped PA installations are
|
|
22
|
+
resolved from the assistant owner's personal project at dispatch time, so
|
|
23
|
+
existing WeChat configurations start working without being re-saved.
|
|
24
|
+
|
|
25
|
+
### Channel Integrations management menu
|
|
26
|
+
|
|
27
|
+
Add an owner/admin **Channel Integrations** workspace menu backed by a
|
|
28
|
+
tenant-wide `ChannelIntegrationsHub` with installation list/detail, routing,
|
|
29
|
+
sender bindings, recent-sender discovery, and per-installation connection
|
|
30
|
+
editing.
|
|
31
|
+
|
|
32
|
+
- **Scope precedence** is explicit and shared by UI and gateway: a binding's
|
|
33
|
+
explicit workspace/project wins, the installation's configured scope is the
|
|
34
|
+
fallback default, and PA-owned installations always resolve to the owner's
|
|
35
|
+
personal scope. Installations persist optional `workspaceId`/`projectId`
|
|
36
|
+
(PG migration v224, Local SQLite, InMemory, export/import).
|
|
37
|
+
- **Binding scope editing** and fallback-agent clearing (`fallbackAgentId:
|
|
38
|
+
null`) are supported end to end through protocols, stores, gateway, and
|
|
39
|
+
client SDK.
|
|
40
|
+
- **Recent sender discovery** uses a new `ThreadStore.listChannelSenders`
|
|
41
|
+
query (`ChannelSenderSummary`) implemented by the InMemory, local, and
|
|
42
|
+
PostgreSQL stores; PG v225 adds `idx_lattice_threads_channel_installation`.
|
|
43
|
+
- **Cascade delete** removes an installation's sender bindings (paged, no
|
|
44
|
+
skipped rows) instead of orphaning them.
|
|
45
|
+
- **Shared-installation authorization**: mutating a shared installation or
|
|
46
|
+
binding requires tenant owner/admin (members get 403), while PA-owned
|
|
47
|
+
installations stay owner-scoped.
|
|
48
|
+
- **WeChat is 1:1 and default-agent only** (no bindings-only mode or
|
|
49
|
+
per-sender agent choice); Lark/WeCom support bindings plus recent senders.
|
|
50
|
+
- `client-sdk` `Assistant` exposes `ownerUserId` so PA-owned vs shared scope
|
|
51
|
+
can be distinguished. The legacy Lark-only
|
|
52
|
+
`ChannelInstallationsDrawerContent` stays exported but is deprecated.
|
|
53
|
+
|
|
54
|
+
### Re-pin project scope for legacy execution paths
|
|
55
|
+
|
|
56
|
+
Legacy dispatch paths reuse the shared per-thread Agent instance. When a
|
|
57
|
+
legacy run (fallback streaming, collect/steer, commands, channels, Web App,
|
|
58
|
+
cron, scheduler, task comments, Open API, delegation, eval, or queue
|
|
59
|
+
recovery) carries a project scope, that scope is now applied before the next
|
|
60
|
+
sandbox is created; if a run is already active, the update is deferred until
|
|
61
|
+
it settles. This prevents legacy project runs from creating an unscoped
|
|
62
|
+
sandbox without `/project`, which caused claw bootstrap and
|
|
63
|
+
`/large_tool_results` writes to fail with permission errors.
|
|
64
|
+
|
|
65
|
+
The sandbox image is bumped separately to 0.2.2 so `/project`, `/agent`, and
|
|
66
|
+
`/large_tool_results` exist and are writable by `appuser` when no named volume
|
|
67
|
+
is mounted.
|
|
68
|
+
|
|
69
|
+
### Bound sandbox creation and widen lifecycle limits
|
|
70
|
+
|
|
71
|
+
- **Create admission**: `Sandbox.create` and the post-create `getInfo` now run
|
|
72
|
+
under a dedicated `createLimiter`
|
|
73
|
+
(`SANDBOX_CREATE_MAX_INFLIGHT_PER_SANDBOX` / `_TOTAL` / `_MAX_QUEUE` /
|
|
74
|
+
`_QUEUE_TIMEOUT_MS`), so a cold-start burst can no longer bypass the
|
|
75
|
+
lifecycle limiter or starve lease renewal.
|
|
76
|
+
- **Create deadline**: new `SANDBOX_CREATE_TIMEOUT_MS` bounds the gateway wait
|
|
77
|
+
and derives the SDK `readyTimeoutSeconds` (previously hardcoded 1800s).
|
|
78
|
+
- **Coverage**: cached `getInfo` (`GET /api/sandboxes/:name`, `.../status`),
|
|
79
|
+
`start` resume/getInfo, `stop` pause, and metadata reconnect now go through
|
|
80
|
+
the lifecycle limiter.
|
|
81
|
+
- **Per-sandbox keys**: lifecycle limiter keys use the bare sandbox name, so
|
|
82
|
+
`SANDBOX_LIFECYCLE_MAX_INFLIGHT_PER_SANDBOX` really is per sandbox.
|
|
83
|
+
- **Defaults**: data plane `256 / 256 / 10s`, lifecycle `8 / 128 / 60s`.
|
|
84
|
+
- **Deploy/config/docs**: configmap, README, capacity guide, ADR-307.
|
|
85
|
+
|
|
86
|
+
### Platform execution concurrency settings
|
|
87
|
+
|
|
88
|
+
Add a new platform settings **Execution** section so operators can tune run
|
|
89
|
+
concurrency from the Admin Center without a restart.
|
|
90
|
+
|
|
91
|
+
- **New `execution` section** with `maxConcurrentRunsPerWorker`,
|
|
92
|
+
`maxRunningRunsPerTenant`, and `maxActiveRunTasksPerTenant`.
|
|
93
|
+
- **Single resolver** in `PlatformSettingsService` with per-leaf precedence
|
|
94
|
+
`platform > env > default`; runtime code no longer reads the three
|
|
95
|
+
environment variables directly.
|
|
96
|
+
- **Live-applied** worker max and per-tenant caps: the dynamic limiter re-reads
|
|
97
|
+
the worker max and the worker re-reads the per-tenant cap each scan.
|
|
98
|
+
- **Shared document + ledger semantics**: config lives in the shared platform
|
|
99
|
+
settings document (converging via `platform.settings.changed` plus a 30 s
|
|
100
|
+
poll); per-tenant running/active caps are counted against the shared run
|
|
101
|
+
ledger.
|
|
102
|
+
- **Legacy key mapped**: persisted `rateLimits.maxActiveRunTasksPerTenant` is
|
|
103
|
+
read-mapped into `execution.maxActiveRunTasksPerTenant` and dropped on the
|
|
104
|
+
next settings write.
|
|
105
|
+
- **Effective settings**: remove `effective.rateLimits.maxActiveRunTasksPerTenant`
|
|
106
|
+
(moved to `effective.execution.maxActiveRunTasksPerTenant`).
|
|
107
|
+
- **Admin Center**: new **Execution** tab with unlimited toggles and a soft
|
|
108
|
+
warning when `maxActive < maxRunning`.
|
|
109
|
+
|
|
110
|
+
### Patch Changes
|
|
111
|
+
|
|
112
|
+
- Updated dependencies [0d2e289]
|
|
113
|
+
- @axiom-lattice/protocols@7.9.0
|
|
114
|
+
- @axiom-lattice/core@13.4.0
|
|
115
|
+
|
|
116
|
+
## 5.4.2
|
|
117
|
+
|
|
118
|
+
### Patch Changes
|
|
119
|
+
|
|
120
|
+
- Updated dependencies [350497e]
|
|
121
|
+
- @axiom-lattice/core@13.3.1
|
|
122
|
+
|
|
3
123
|
## 5.4.1
|
|
4
124
|
|
|
5
125
|
### 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, 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, SessionStore, SessionRecord, IConversationStore, ConversationRecord, CreateConversationInput } from '@axiom-lattice/protocols';
|
|
3
|
+
import { ThreadStore, Thread, ThreadMonitorQuery, ThreadMonitorRecord, ChannelSenderSummary, 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, SessionStore, SessionRecord, IConversationStore, ConversationRecord, CreateConversationInput } from '@axiom-lattice/protocols';
|
|
4
4
|
import { IMessageQueueStore, AddMessageParams, PendingMessage, QueueScope, ClaimMessagesOptions, ThreadInfo } from '@axiom-lattice/core';
|
|
5
5
|
|
|
6
6
|
/**
|
|
@@ -201,6 +201,7 @@ declare class LocalThreadStore implements ThreadStore {
|
|
|
201
201
|
records: ThreadMonitorRecord[];
|
|
202
202
|
total: number;
|
|
203
203
|
}>;
|
|
204
|
+
listChannelSenders(tenantId: string, channelInstallationId: string, limit: number): Promise<ChannelSenderSummary[]>;
|
|
204
205
|
getThreadById(tenantId: string, threadId: string): Promise<Thread | undefined>;
|
|
205
206
|
createThread(tenantId: string, assistantId: string, threadId: string, data: CreateThreadRequest): Promise<Thread>;
|
|
206
207
|
updateThread(tenantId: string, threadId: string, updates: Partial<CreateThreadRequest>): Promise<Thread | null>;
|
|
@@ -860,6 +861,8 @@ declare class LocalChannelInstallationStore implements ChannelInstallationStore
|
|
|
860
861
|
createInstallation(tenantId: string, installationId: string, data: CreateChannelInstallationInput): Promise<ChannelInstallation>;
|
|
861
862
|
updateInstallation(tenantId: string, installationId: string, updates: UpdateChannelInstallationRequest): Promise<ChannelInstallation | null>;
|
|
862
863
|
deleteInstallation(tenantId: string, installationId: string): Promise<boolean>;
|
|
864
|
+
/** Add a column if it does not exist (SQLite version compatible). */
|
|
865
|
+
private ensureColumn;
|
|
863
866
|
}
|
|
864
867
|
|
|
865
868
|
/**
|
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, 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, SessionStore, SessionRecord, IConversationStore, ConversationRecord, CreateConversationInput } from '@axiom-lattice/protocols';
|
|
3
|
+
import { ThreadStore, Thread, ThreadMonitorQuery, ThreadMonitorRecord, ChannelSenderSummary, 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, SessionStore, SessionRecord, IConversationStore, ConversationRecord, CreateConversationInput } from '@axiom-lattice/protocols';
|
|
4
4
|
import { IMessageQueueStore, AddMessageParams, PendingMessage, QueueScope, ClaimMessagesOptions, ThreadInfo } from '@axiom-lattice/core';
|
|
5
5
|
|
|
6
6
|
/**
|
|
@@ -201,6 +201,7 @@ declare class LocalThreadStore implements ThreadStore {
|
|
|
201
201
|
records: ThreadMonitorRecord[];
|
|
202
202
|
total: number;
|
|
203
203
|
}>;
|
|
204
|
+
listChannelSenders(tenantId: string, channelInstallationId: string, limit: number): Promise<ChannelSenderSummary[]>;
|
|
204
205
|
getThreadById(tenantId: string, threadId: string): Promise<Thread | undefined>;
|
|
205
206
|
createThread(tenantId: string, assistantId: string, threadId: string, data: CreateThreadRequest): Promise<Thread>;
|
|
206
207
|
updateThread(tenantId: string, threadId: string, updates: Partial<CreateThreadRequest>): Promise<Thread | null>;
|
|
@@ -860,6 +861,8 @@ declare class LocalChannelInstallationStore implements ChannelInstallationStore
|
|
|
860
861
|
createInstallation(tenantId: string, installationId: string, data: CreateChannelInstallationInput): Promise<ChannelInstallation>;
|
|
861
862
|
updateInstallation(tenantId: string, installationId: string, updates: UpdateChannelInstallationRequest): Promise<ChannelInstallation | null>;
|
|
862
863
|
deleteInstallation(tenantId: string, installationId: string): Promise<boolean>;
|
|
864
|
+
/** Add a column if it does not exist (SQLite version compatible). */
|
|
865
|
+
private ensureColumn;
|
|
863
866
|
}
|
|
864
867
|
|
|
865
868
|
/**
|
package/dist/index.js
CHANGED
|
@@ -434,6 +434,31 @@ var LocalThreadStore = class {
|
|
|
434
434
|
total: filtered.length
|
|
435
435
|
};
|
|
436
436
|
}
|
|
437
|
+
async listChannelSenders(tenantId, channelInstallationId, limit) {
|
|
438
|
+
const rows2 = this.db.prepare(
|
|
439
|
+
`SELECT * FROM lt_threads
|
|
440
|
+
WHERE tenant_id = ?
|
|
441
|
+
AND json_extract(metadata, '$.channelInstallationId') = ?
|
|
442
|
+
ORDER BY updated_at DESC, id DESC`
|
|
443
|
+
).all(tenantId, channelInstallationId);
|
|
444
|
+
const bySender = /* @__PURE__ */ new Map();
|
|
445
|
+
for (const row of rows2) {
|
|
446
|
+
const thread = mapRowToThread(row);
|
|
447
|
+
const metadata = thread.metadata ?? {};
|
|
448
|
+
if (typeof metadata.senderId !== "string" || !metadata.senderId) continue;
|
|
449
|
+
if (bySender.has(metadata.senderId)) continue;
|
|
450
|
+
bySender.set(metadata.senderId, {
|
|
451
|
+
senderId: metadata.senderId,
|
|
452
|
+
...typeof metadata.senderDisplayName === "string" && metadata.senderDisplayName ? { displayName: metadata.senderDisplayName } : {},
|
|
453
|
+
lastSeenAt: thread.updatedAt,
|
|
454
|
+
lastThreadId: thread.id
|
|
455
|
+
});
|
|
456
|
+
}
|
|
457
|
+
return [...bySender.values()].slice(
|
|
458
|
+
0,
|
|
459
|
+
Math.max(1, Math.min(200, Math.floor(limit)))
|
|
460
|
+
);
|
|
461
|
+
}
|
|
437
462
|
async getThreadById(tenantId, threadId) {
|
|
438
463
|
const row = this.db.prepare(
|
|
439
464
|
`SELECT * FROM lt_threads WHERE tenant_id = ? AND id = ?`
|
|
@@ -5610,6 +5635,8 @@ CREATE TABLE IF NOT EXISTS lt_channel_installations (
|
|
|
5610
5635
|
config TEXT NOT NULL,
|
|
5611
5636
|
enabled INTEGER NOT NULL DEFAULT 1,
|
|
5612
5637
|
fallback_agent_id TEXT,
|
|
5638
|
+
workspace_id TEXT,
|
|
5639
|
+
project_id TEXT,
|
|
5613
5640
|
reject_when_no_binding INTEGER NOT NULL DEFAULT 0,
|
|
5614
5641
|
created_at TEXT NOT NULL,
|
|
5615
5642
|
updated_at TEXT NOT NULL
|
|
@@ -5620,6 +5647,8 @@ var LocalChannelInstallationStore = class {
|
|
|
5620
5647
|
constructor(db) {
|
|
5621
5648
|
this.db = db;
|
|
5622
5649
|
ensureTable(db, DDL25);
|
|
5650
|
+
this.ensureColumn("lt_channel_installations", "workspace_id", "workspace_id TEXT");
|
|
5651
|
+
this.ensureColumn("lt_channel_installations", "project_id", "project_id TEXT");
|
|
5623
5652
|
}
|
|
5624
5653
|
async getInstallationById(installationId) {
|
|
5625
5654
|
const row = this.db.prepare(
|
|
@@ -5657,8 +5686,8 @@ var LocalChannelInstallationStore = class {
|
|
|
5657
5686
|
const now = nowISO();
|
|
5658
5687
|
this.db.prepare(
|
|
5659
5688
|
`INSERT INTO lt_channel_installations
|
|
5660
|
-
(id, tenant_id, channel, name, config, enabled, fallback_agent_id, reject_when_no_binding, created_at, updated_at)
|
|
5661
|
-
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`
|
|
5689
|
+
(id, tenant_id, channel, name, config, enabled, fallback_agent_id, workspace_id, project_id, reject_when_no_binding, created_at, updated_at)
|
|
5690
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`
|
|
5662
5691
|
).run(
|
|
5663
5692
|
installationId,
|
|
5664
5693
|
tenantId,
|
|
@@ -5667,6 +5696,8 @@ var LocalChannelInstallationStore = class {
|
|
|
5667
5696
|
JSON.stringify(data.config),
|
|
5668
5697
|
data.enabled !== false ? 1 : 0,
|
|
5669
5698
|
data.fallbackAgentId || null,
|
|
5699
|
+
data.workspaceId || null,
|
|
5700
|
+
data.projectId || null,
|
|
5670
5701
|
data.rejectWhenNoBinding ? 1 : 0,
|
|
5671
5702
|
now,
|
|
5672
5703
|
now
|
|
@@ -5679,6 +5710,8 @@ var LocalChannelInstallationStore = class {
|
|
|
5679
5710
|
config: { ...data.config },
|
|
5680
5711
|
enabled: data.enabled !== false,
|
|
5681
5712
|
fallbackAgentId: data.fallbackAgentId,
|
|
5713
|
+
workspaceId: data.workspaceId,
|
|
5714
|
+
projectId: data.projectId,
|
|
5682
5715
|
rejectWhenNoBinding: data.rejectWhenNoBinding ?? false,
|
|
5683
5716
|
createdAt: parseISO(now),
|
|
5684
5717
|
updatedAt: parseISO(now)
|
|
@@ -5705,6 +5738,14 @@ var LocalChannelInstallationStore = class {
|
|
|
5705
5738
|
setClauses.push("fallback_agent_id = ?");
|
|
5706
5739
|
values.push(updates.fallbackAgentId || null);
|
|
5707
5740
|
}
|
|
5741
|
+
if (updates.workspaceId !== void 0) {
|
|
5742
|
+
setClauses.push("workspace_id = ?");
|
|
5743
|
+
values.push(updates.workspaceId || null);
|
|
5744
|
+
}
|
|
5745
|
+
if (updates.projectId !== void 0) {
|
|
5746
|
+
setClauses.push("project_id = ?");
|
|
5747
|
+
values.push(updates.projectId || null);
|
|
5748
|
+
}
|
|
5708
5749
|
if (updates.rejectWhenNoBinding !== void 0) {
|
|
5709
5750
|
setClauses.push("reject_when_no_binding = ?");
|
|
5710
5751
|
values.push(updates.rejectWhenNoBinding ? 1 : 0);
|
|
@@ -5726,6 +5767,13 @@ var LocalChannelInstallationStore = class {
|
|
|
5726
5767
|
).run(installationId, tenantId);
|
|
5727
5768
|
return result.changes > 0;
|
|
5728
5769
|
}
|
|
5770
|
+
/** Add a column if it does not exist (SQLite version compatible). */
|
|
5771
|
+
ensureColumn(table, column, ddl2) {
|
|
5772
|
+
const cols = this.db.prepare(`PRAGMA table_info(${table})`).all();
|
|
5773
|
+
if (!cols.some((c) => c.name === column)) {
|
|
5774
|
+
this.db.exec(`ALTER TABLE ${table} ADD COLUMN ${ddl2}`);
|
|
5775
|
+
}
|
|
5776
|
+
}
|
|
5729
5777
|
};
|
|
5730
5778
|
function mapRow15(row) {
|
|
5731
5779
|
return {
|
|
@@ -5736,6 +5784,8 @@ function mapRow15(row) {
|
|
|
5736
5784
|
config: JSON.parse(row.config),
|
|
5737
5785
|
enabled: row.enabled === 1,
|
|
5738
5786
|
fallbackAgentId: row.fallback_agent_id || void 0,
|
|
5787
|
+
workspaceId: row.workspace_id || void 0,
|
|
5788
|
+
projectId: row.project_id || void 0,
|
|
5739
5789
|
rejectWhenNoBinding: row.reject_when_no_binding === 1,
|
|
5740
5790
|
createdAt: parseISO(row.created_at),
|
|
5741
5791
|
updatedAt: parseISO(row.updated_at)
|