@axiom-lattice/local-stores 3.1.0 → 3.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +10 -10
- package/CHANGELOG.md +18 -0
- package/dist/index.d.mts +193 -22
- package/dist/index.d.ts +193 -22
- package/dist/index.js +1482 -242
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1479 -242
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
- package/src/__tests__/LocalCapabilityBundleStore.test.ts +216 -0
- package/src/__tests__/LocalChannelBindingStore.test.ts +183 -0
- package/src/__tests__/LocalChannelInstallationStore.test.ts +23 -0
- package/src/__tests__/LocalProjectRoomStores.test.ts +356 -0
- package/src/__tests__/LocalProjectStore.test.ts +39 -2
- package/src/__tests__/LocalTaskStore.test.ts +58 -0
- package/src/__tests__/LocalTaskWorkItemStore.test.ts +199 -0
- package/src/__tests__/LocalThreadMessageQueueStore.test.ts +201 -0
- package/src/createLocalStoreConfig.ts +10 -0
- package/src/index.ts +5 -0
- package/src/migrations/migration.ts +1 -1
- package/src/stores/LocalCapabilityBundleStore.ts +53 -0
- package/src/stores/LocalChannelBindingStore.ts +75 -41
- package/src/stores/LocalChannelInstallationStore.ts +6 -5
- package/src/stores/LocalProjectBotMembershipStore.ts +105 -0
- package/src/stores/LocalProjectMembershipStore.ts +72 -0
- package/src/stores/LocalProjectRoomMessageStore.ts +63 -0
- package/src/stores/LocalProjectRoomStore.ts +37 -0
- package/src/stores/LocalProjectStore.ts +67 -14
- package/src/stores/LocalTaskStore.ts +82 -2
- package/src/stores/LocalTaskWorkItemStore.ts +136 -1
- package/src/stores/LocalThreadMessageQueueStore.ts +136 -28
- package/src/stores/project-room-schema.ts +243 -0
- package/src/stores/room-channel-binding-index.ts +60 -0
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @axiom-lattice/local-stores@3.1.
|
|
2
|
+
> @axiom-lattice/local-stores@3.1.2 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
|
-
[32mCJS[39m [1mdist/index.js [22m[
|
|
12
|
-
[32mCJS[39m [1mdist/index.js.map [22m[
|
|
13
|
-
[32mCJS[39m ⚡️ Build success in
|
|
14
|
-
[32mESM[39m [1mdist/index.mjs [22m[
|
|
15
|
-
[32mESM[39m [1mdist/index.mjs.map [22m[
|
|
16
|
-
[32mESM[39m ⚡️ Build success in
|
|
11
|
+
[32mCJS[39m [1mdist/index.js [22m[32m216.48 KB[39m
|
|
12
|
+
[32mCJS[39m [1mdist/index.js.map [22m[32m392.76 KB[39m
|
|
13
|
+
[32mCJS[39m ⚡️ Build success in 555ms
|
|
14
|
+
[32mESM[39m [1mdist/index.mjs [22m[32m212.10 KB[39m
|
|
15
|
+
[32mESM[39m [1mdist/index.mjs.map [22m[32m389.23 KB[39m
|
|
16
|
+
[32mESM[39m ⚡️ Build success in 556ms
|
|
17
17
|
[34mDTS[39m Build start
|
|
18
|
-
[32mDTS[39m ⚡️ Build success in
|
|
19
|
-
[32mDTS[39m [1mdist/index.d.ts [22m[
|
|
20
|
-
[32mDTS[39m [1mdist/index.d.mts [22m[
|
|
18
|
+
[32mDTS[39m ⚡️ Build success in 16355ms
|
|
19
|
+
[32mDTS[39m [1mdist/index.d.ts [22m[32m39.86 KB[39m
|
|
20
|
+
[32mDTS[39m [1mdist/index.d.mts [22m[32m39.86 KB[39m
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @axiom-lattice/local-stores
|
|
2
2
|
|
|
3
|
+
## 3.1.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 08bf26a: update metric builder
|
|
8
|
+
- Updated dependencies [08bf26a]
|
|
9
|
+
- @axiom-lattice/core@4.2.2
|
|
10
|
+
- @axiom-lattice/protocols@4.1.2
|
|
11
|
+
|
|
12
|
+
## 3.1.1
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- 8db9937: huge enhance
|
|
17
|
+
- Updated dependencies [8db9937]
|
|
18
|
+
- @axiom-lattice/core@4.2.1
|
|
19
|
+
- @axiom-lattice/protocols@4.1.1
|
|
20
|
+
|
|
3
21
|
## 3.1.0
|
|
4
22
|
|
|
5
23
|
### Minor Changes
|
package/dist/index.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
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, 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, ChannelInstallationStore, ChannelInstallation, ChannelInstallationType,
|
|
4
|
-
import { IMessageQueueStore, AddMessageParams, PendingMessage, ThreadInfo } from '@axiom-lattice/core';
|
|
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';
|
|
4
|
+
import { IMessageQueueStore, AddMessageParams, PendingMessage, QueueScope, ThreadInfo } from '@axiom-lattice/core';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Shared SQLite database connection for local stores using sql.js (WASM).
|
|
@@ -244,10 +244,126 @@ declare class LocalProjectStore implements ProjectStore {
|
|
|
244
244
|
createProject(tenantId: string, workspaceId: string, id: string, data: CreateProjectRequest): Promise<Project>;
|
|
245
245
|
updateProject(tenantId: string, id: string, updates: UpdateProjectRequest): Promise<Project | null>;
|
|
246
246
|
deleteProject(tenantId: string, id: string): Promise<boolean>;
|
|
247
|
+
updateCapabilityBundleIds(tenantId: string, projectId: string, bundleIds: string[], expectedRevisions?: Record<string, string>): Promise<UpdateProjectCapabilityBundlesResult>;
|
|
248
|
+
isCapabilityBundleReferenced(tenantId: string, bundleId: string): Promise<boolean>;
|
|
247
249
|
/** Add a column if it does not exist (SQLite version compatible). */
|
|
248
250
|
private ensureColumn;
|
|
249
251
|
}
|
|
250
252
|
|
|
253
|
+
/** Persists canonical project main rooms in local SQLite. */
|
|
254
|
+
declare class LocalProjectRoomStore implements ProjectRoomStore {
|
|
255
|
+
private readonly db;
|
|
256
|
+
constructor(db: DatabaseWrapper);
|
|
257
|
+
ensureMainRoom(input: {
|
|
258
|
+
id: string;
|
|
259
|
+
tenantId: string;
|
|
260
|
+
workspaceId: string;
|
|
261
|
+
projectId: string;
|
|
262
|
+
name: string;
|
|
263
|
+
}): Promise<ProjectRoom>;
|
|
264
|
+
getMainRoom(tenantId: string, projectId: string): Promise<ProjectRoom | null>;
|
|
265
|
+
private getRow;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
declare class DuplicateProjectMembershipError extends Error {
|
|
269
|
+
constructor();
|
|
270
|
+
}
|
|
271
|
+
declare class ProjectMembershipIdConflictError extends Error {
|
|
272
|
+
constructor();
|
|
273
|
+
}
|
|
274
|
+
/** Persists human project memberships in local SQLite. */
|
|
275
|
+
declare class LocalProjectMembershipStore implements ProjectMembershipStore {
|
|
276
|
+
private readonly db;
|
|
277
|
+
constructor(db: DatabaseWrapper);
|
|
278
|
+
list(tenantId: string, projectId: string): Promise<ProjectMembership[]>;
|
|
279
|
+
findByUser(tenantId: string, projectId: string, userId: string): Promise<ProjectMembership | null>;
|
|
280
|
+
create(input: Omit<ProjectMembership, "joinedAt" | "updatedAt">): Promise<ProjectMembership>;
|
|
281
|
+
createInitialOwner(input: Omit<ProjectMembership, "role" | "status" | "joinedAt" | "updatedAt">): Promise<{
|
|
282
|
+
kind: "created" | "existing";
|
|
283
|
+
membership: ProjectMembership;
|
|
284
|
+
} | {
|
|
285
|
+
kind: "already_initialized";
|
|
286
|
+
}>;
|
|
287
|
+
updateRole(input: {
|
|
288
|
+
tenantId: string;
|
|
289
|
+
id: string;
|
|
290
|
+
role: ProjectHumanRole;
|
|
291
|
+
expectedUpdatedAt: Date;
|
|
292
|
+
}): Promise<ProjectMembershipMutationResult>;
|
|
293
|
+
remove(input: {
|
|
294
|
+
tenantId: string;
|
|
295
|
+
id: string;
|
|
296
|
+
expectedUpdatedAt: Date;
|
|
297
|
+
}): Promise<ProjectMembershipMutationResult>;
|
|
298
|
+
private mutate;
|
|
299
|
+
private byId;
|
|
300
|
+
private classifyUnique;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
type Conflict = "coordinator_conflict" | "mention_conflict";
|
|
304
|
+
declare class ProjectBotMembershipIdConflictError extends Error {
|
|
305
|
+
constructor(tenantId: string, id: string);
|
|
306
|
+
}
|
|
307
|
+
/** Persists durable project bot roster memberships in local SQLite. */
|
|
308
|
+
declare class LocalProjectBotMembershipStore implements ProjectBotMembershipStore {
|
|
309
|
+
private readonly db;
|
|
310
|
+
constructor(db: DatabaseWrapper);
|
|
311
|
+
list(tenantId: string, projectId: string): Promise<ProjectBotMembership[]>;
|
|
312
|
+
findById(tenantId: string, id: string): Promise<ProjectBotMembership | null>;
|
|
313
|
+
findByAssistant(tenantId: string, projectId: string, assistantId: string): Promise<ProjectBotMembership | null>;
|
|
314
|
+
save(input: Omit<ProjectBotMembership, "joinedAt" | "updatedAt">): Promise<{
|
|
315
|
+
kind: "created" | "updated" | "reactivated";
|
|
316
|
+
membership: ProjectBotMembership;
|
|
317
|
+
} | {
|
|
318
|
+
kind: Conflict;
|
|
319
|
+
}>;
|
|
320
|
+
update(input: {
|
|
321
|
+
tenantId: string;
|
|
322
|
+
id: string;
|
|
323
|
+
patch: Partial<Pick<ProjectBotMembership, "role" | "title" | "responsibility" | "mentionName" | "status">>;
|
|
324
|
+
expectedUpdatedAt: Date;
|
|
325
|
+
}): Promise<{
|
|
326
|
+
kind: "updated";
|
|
327
|
+
membership: ProjectBotMembership;
|
|
328
|
+
} | {
|
|
329
|
+
kind: "not_found" | "conflict" | Conflict;
|
|
330
|
+
}>;
|
|
331
|
+
private byId;
|
|
332
|
+
private byAssistant;
|
|
333
|
+
private reactivate;
|
|
334
|
+
private preflight;
|
|
335
|
+
private conflict;
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
declare class ProjectRoomMessageIdConflictError extends Error {
|
|
339
|
+
constructor(tenantId: string, id: string);
|
|
340
|
+
}
|
|
341
|
+
declare class DuplicateProjectRoomMessageIdempotencyKeyError extends Error {
|
|
342
|
+
constructor(tenantId: string, roomId: string, key: string);
|
|
343
|
+
}
|
|
344
|
+
/** Persists validated project room messages in local SQLite. */
|
|
345
|
+
declare class LocalProjectRoomMessageStore implements ProjectRoomMessageStore {
|
|
346
|
+
private readonly db;
|
|
347
|
+
constructor(db: DatabaseWrapper);
|
|
348
|
+
create(input: Omit<ProjectRoomMessage, "createdAt">): Promise<ProjectRoomMessage>;
|
|
349
|
+
createIdempotent(input: Omit<ProjectRoomMessage, "createdAt"> & {
|
|
350
|
+
idempotencyKey: string;
|
|
351
|
+
}): Promise<ProjectRoomMessage>;
|
|
352
|
+
list(input: {
|
|
353
|
+
tenantId: string;
|
|
354
|
+
roomId: string;
|
|
355
|
+
before?: {
|
|
356
|
+
createdAt: Date;
|
|
357
|
+
id: string;
|
|
358
|
+
};
|
|
359
|
+
limit: number;
|
|
360
|
+
}): Promise<ProjectRoomMessage[]>;
|
|
361
|
+
findById(tenantId: string, id: string): Promise<ProjectRoomMessage | null>;
|
|
362
|
+
private insert;
|
|
363
|
+
private byId;
|
|
364
|
+
private byKey;
|
|
365
|
+
}
|
|
366
|
+
|
|
251
367
|
/**
|
|
252
368
|
* Local SQLite implementation of UserStore.
|
|
253
369
|
*/
|
|
@@ -444,6 +560,13 @@ declare class LocalEvalStore implements EvalStore {
|
|
|
444
560
|
declare class LocalChannelBindingStore implements BindingRegistry {
|
|
445
561
|
private db;
|
|
446
562
|
constructor(db: DatabaseWrapper);
|
|
563
|
+
findById(tenantId: string, id: string): Promise<Binding | null>;
|
|
564
|
+
findBySubject(params: {
|
|
565
|
+
tenantId: string;
|
|
566
|
+
channel: string;
|
|
567
|
+
channelInstallationId: string;
|
|
568
|
+
senderId: string;
|
|
569
|
+
}): Promise<Binding | null>;
|
|
447
570
|
resolve(params: {
|
|
448
571
|
channel: string;
|
|
449
572
|
senderId: string;
|
|
@@ -451,17 +574,10 @@ declare class LocalChannelBindingStore implements BindingRegistry {
|
|
|
451
574
|
tenantId: string;
|
|
452
575
|
}): Promise<Binding | null>;
|
|
453
576
|
create(input: CreateBindingInput): Promise<Binding>;
|
|
454
|
-
update(id: string, patch:
|
|
455
|
-
delete(id: string): Promise<void>;
|
|
456
|
-
list(params:
|
|
457
|
-
|
|
458
|
-
agentId?: string;
|
|
459
|
-
tenantId: string;
|
|
460
|
-
channelInstallationId?: string;
|
|
461
|
-
limit?: number;
|
|
462
|
-
offset?: number;
|
|
463
|
-
}): Promise<Binding[]>;
|
|
464
|
-
import(bindings: CreateBindingInput[]): Promise<Binding[]>;
|
|
577
|
+
update(tenantId: string, id: string, patch: BindingMutablePatch): Promise<Binding>;
|
|
578
|
+
delete(tenantId: string, id: string): Promise<void>;
|
|
579
|
+
list(params: BindingListParams): Promise<Binding[]>;
|
|
580
|
+
import(tenantId: string, bindings: CreateBindingInput[]): Promise<Binding[]>;
|
|
465
581
|
export(params: {
|
|
466
582
|
tenantId: string;
|
|
467
583
|
}): Promise<Binding[]>;
|
|
@@ -478,7 +594,7 @@ declare class LocalChannelInstallationStore implements ChannelInstallationStore
|
|
|
478
594
|
getInstallationById(installationId: string): Promise<ChannelInstallation | null>;
|
|
479
595
|
getInstallationsByTenant(tenantId: string, channel?: ChannelInstallationType): Promise<ChannelInstallation[]>;
|
|
480
596
|
getAllInstallations(channel?: ChannelInstallationType): Promise<ChannelInstallation[]>;
|
|
481
|
-
createInstallation(tenantId: string, installationId: string, data:
|
|
597
|
+
createInstallation(tenantId: string, installationId: string, data: CreateChannelInstallationInput): Promise<ChannelInstallation>;
|
|
482
598
|
updateInstallation(tenantId: string, installationId: string, updates: UpdateChannelInstallationRequest): Promise<ChannelInstallation | null>;
|
|
483
599
|
deleteInstallation(tenantId: string, installationId: string): Promise<boolean>;
|
|
484
600
|
}
|
|
@@ -515,17 +631,19 @@ declare class LocalA2AApiKeyStore implements A2AApiKeyStore {
|
|
|
515
631
|
|
|
516
632
|
declare class LocalThreadMessageQueueStore implements IMessageQueueStore {
|
|
517
633
|
private db;
|
|
634
|
+
private capacityTail;
|
|
518
635
|
constructor(db: DatabaseWrapper);
|
|
519
636
|
addMessage(params: AddMessageParams): Promise<PendingMessage>;
|
|
637
|
+
addMessageIfCapacity(params: AddMessageParams, maxSize: number): Promise<boolean>;
|
|
520
638
|
addMessageAtHead(params: AddMessageParams): Promise<PendingMessage>;
|
|
521
|
-
getPendingMessages(threadId: string): Promise<PendingMessage[]>;
|
|
522
|
-
getProcessingMessages(threadId: string): Promise<PendingMessage[]>;
|
|
523
|
-
getQueueSize(threadId: string): Promise<number>;
|
|
639
|
+
getPendingMessages(threadId: string, scope?: QueueScope): Promise<PendingMessage[]>;
|
|
640
|
+
getProcessingMessages(threadId: string, scope?: QueueScope): Promise<PendingMessage[]>;
|
|
641
|
+
getQueueSize(threadId: string, scope?: QueueScope): Promise<number>;
|
|
524
642
|
getThreadsWithPendingMessages(): Promise<ThreadInfo[]>;
|
|
525
|
-
removeMessage(messageId: string): Promise<boolean>;
|
|
526
|
-
clearMessages(threadId: string): Promise<void>;
|
|
527
|
-
markProcessing(messageId: string): Promise<void>;
|
|
528
|
-
resetProcessingToPending(threadId: string): Promise<number>;
|
|
643
|
+
removeMessage(messageId: string, scope?: QueueScope): Promise<boolean>;
|
|
644
|
+
clearMessages(threadId: string, scope?: QueueScope): Promise<void>;
|
|
645
|
+
markProcessing(messageId: string, customRunConfig?: unknown, scope?: QueueScope): Promise<void>;
|
|
646
|
+
resetProcessingToPending(threadId: string, scope?: QueueScope): Promise<number>;
|
|
529
647
|
private getById;
|
|
530
648
|
}
|
|
531
649
|
|
|
@@ -604,6 +722,8 @@ declare class LocalTaskStore implements TaskStore {
|
|
|
604
722
|
}): Promise<TaskItem>;
|
|
605
723
|
getById(tenantId: string, id: string): Promise<TaskItem | null>;
|
|
606
724
|
list(filter: TaskListFilter): Promise<TaskItem[]>;
|
|
725
|
+
/** Lists exact project tasks containing a string dependency. */
|
|
726
|
+
listDependents(query: TaskDependentListQuery): Promise<TaskItem[]>;
|
|
607
727
|
update(tenantId: string, id: string, updates: UpdateTaskRequest): Promise<TaskItem | null>;
|
|
608
728
|
/**
|
|
609
729
|
* Atomically update a task unless its current status is blocked.
|
|
@@ -619,9 +739,13 @@ declare class LocalTaskStore implements TaskStore {
|
|
|
619
739
|
updateIfStatusIn(tenantId: string, id: string, updates: UpdateTaskRequest, expectedStatuses: TaskItem["status"][]): Promise<TaskItem | null>;
|
|
620
740
|
/** Atomically update a task only when status and updatedAt match a read snapshot. */
|
|
621
741
|
updateIfStatusAndUpdatedAt(tenantId: string, id: string, updates: UpdateTaskRequest, expectedStatuses: TaskItem["status"][], expectedUpdatedAt: Date | string): Promise<TaskItem | null>;
|
|
742
|
+
/** Atomically update only while status, timestamp, owner, and Project scope match. */
|
|
743
|
+
updateIfSnapshot(tenantId: string, id: string, updates: UpdateTaskRequest, snapshot: TaskMutationSnapshot): Promise<TaskItem | null>;
|
|
622
744
|
/** Atomically update a child only when both child and parent snapshots match. */
|
|
623
745
|
updateIfStatusUpdatedAtAndParentUpdatedAt(tenantId: string, id: string, updates: UpdateTaskRequest, expectedStatuses: TaskItem["status"][], expectedUpdatedAt: Date | string, parentId: string, expectedParentUpdatedAt: Date | string): Promise<TaskItem | null>;
|
|
624
746
|
delete(tenantId: string, id: string): Promise<boolean>;
|
|
747
|
+
/** Atomically delete only while status, timestamp, owner, and Project scope match. */
|
|
748
|
+
deleteIfSnapshot(tenantId: string, id: string, snapshot: TaskMutationSnapshot): Promise<boolean>;
|
|
625
749
|
}
|
|
626
750
|
|
|
627
751
|
/**
|
|
@@ -634,11 +758,53 @@ declare class LocalTaskWorkItemStore implements TaskWorkItemStore {
|
|
|
634
758
|
/** Add a column if it does not exist (SQLite version compatible). */
|
|
635
759
|
private ensureColumn;
|
|
636
760
|
create(params: CreateWorkItemRequest): Promise<TaskWorkItem>;
|
|
761
|
+
/** Atomically inserts a work item by selecting one exact task snapshot. */
|
|
762
|
+
createIfTaskSnapshot(params: CreateWorkItemRequest, snapshot: TaskMutationSnapshot): Promise<TaskWorkItem | null>;
|
|
637
763
|
/** Find an event by its tenant- and task-scoped key without pagination. */
|
|
638
764
|
findByEventKey(tenantId: string, taskId: string, eventKey: string): Promise<TaskWorkItem | null>;
|
|
639
765
|
/** Atomically return an existing event or create it once. */
|
|
640
766
|
createIfAbsentByEventKey(params: CreateWorkItemIfAbsentRequest): Promise<TaskWorkItem>;
|
|
641
767
|
list(filter: TaskWorkItemListFilter): Promise<TaskWorkItem[]>;
|
|
768
|
+
/** List pending execution results using one bounded SQLite anti-join query. */
|
|
769
|
+
listPendingExecutionResults(params: {
|
|
770
|
+
tenantId: string;
|
|
771
|
+
taskId: string;
|
|
772
|
+
limit: number;
|
|
773
|
+
}): Promise<TaskWorkItem[]>;
|
|
774
|
+
/** Lists canonical project lifecycle events with an exclusive cursor. */
|
|
775
|
+
listProjectLifecycleEvents(query: ProjectLifecycleEventQuery): Promise<TaskWorkItem[]>;
|
|
776
|
+
}
|
|
777
|
+
|
|
778
|
+
/**
|
|
779
|
+
* Persists tenant-scoped capability bundles in a shared local sql.js database.
|
|
780
|
+
*
|
|
781
|
+
* The constructor creates the required table and index idempotently. Database
|
|
782
|
+
* lifecycle remains owned by the caller through `initDatabase` and
|
|
783
|
+
* `closeDatabase`.
|
|
784
|
+
*
|
|
785
|
+
* @example
|
|
786
|
+
* ```ts
|
|
787
|
+
* const db = await initDatabase({ dbPath: "./lattice.db" });
|
|
788
|
+
* const store = new LocalCapabilityBundleStore(db);
|
|
789
|
+
* const bundles = await store.listByTenant("tenant-1");
|
|
790
|
+
* ```
|
|
791
|
+
*/
|
|
792
|
+
declare class LocalCapabilityBundleStore implements CapabilityBundleStore {
|
|
793
|
+
private readonly db;
|
|
794
|
+
/**
|
|
795
|
+
* Creates a capability bundle store over an initialized sql.js database.
|
|
796
|
+
*
|
|
797
|
+
* @param db - Shared local database wrapper used for persistence.
|
|
798
|
+
*/
|
|
799
|
+
constructor(db: DatabaseWrapper);
|
|
800
|
+
listByTenant(tenantId: string): Promise<CapabilityBundle[]>;
|
|
801
|
+
getById(tenantId: string, id: string): Promise<CapabilityBundle | null>;
|
|
802
|
+
getManyByIds(tenantId: string, ids: string[]): Promise<CapabilityBundle[]>;
|
|
803
|
+
create(tenantId: string, input: InternalCreateCapabilityBundleInput): Promise<CapabilityBundle>;
|
|
804
|
+
update(tenantId: string, id: string, input: InternalUpdateCapabilityBundleInput): Promise<CapabilityBundle | {
|
|
805
|
+
status: "conflict";
|
|
806
|
+
} | null>;
|
|
807
|
+
deleteIfUnreferenced(tenantId: string, id: string): Promise<CapabilityBundleDeleteResult>;
|
|
642
808
|
}
|
|
643
809
|
|
|
644
810
|
/**
|
|
@@ -679,6 +845,10 @@ declare function createLocalStoreConfig(options?: LocalStoreConfigOptions): Prom
|
|
|
679
845
|
assistant: LocalAssistantStore;
|
|
680
846
|
workspace: LocalWorkspaceStore;
|
|
681
847
|
project: LocalProjectStore;
|
|
848
|
+
projectRoom: LocalProjectRoomStore;
|
|
849
|
+
projectMembership: LocalProjectMembershipStore;
|
|
850
|
+
projectBotMembership: LocalProjectBotMembershipStore;
|
|
851
|
+
projectRoomMessage: LocalProjectRoomMessageStore;
|
|
682
852
|
user: LocalUserStore;
|
|
683
853
|
tenant: LocalTenantStore;
|
|
684
854
|
userTenantLink: LocalUserTenantLinkStore;
|
|
@@ -696,6 +866,7 @@ declare function createLocalStoreConfig(options?: LocalStoreConfigOptions): Prom
|
|
|
696
866
|
schedule: LocalScheduleStorage;
|
|
697
867
|
task: LocalTaskStore;
|
|
698
868
|
taskWorkItem: LocalTaskWorkItemStore;
|
|
869
|
+
capabilityBundle: LocalCapabilityBundleStore;
|
|
699
870
|
checkpoint: SqliteSaver;
|
|
700
871
|
}>;
|
|
701
872
|
|
|
@@ -715,4 +886,4 @@ declare class InMemoryConversationStore implements IConversationStore {
|
|
|
715
886
|
deleteConversation(conversationId: string): Promise<void>;
|
|
716
887
|
}
|
|
717
888
|
|
|
718
|
-
export { DatabaseWrapper, InMemoryConversationStore, LocalA2AApiKeyStore, LocalAssistantStore, LocalChannelBindingStore, LocalChannelInstallationStore, LocalConnectionStore, LocalDatabaseConfigStore, LocalEvalStore, LocalMcpServerConfigStore, LocalMetricsServerConfigStore, LocalProjectStore, LocalScheduleStorage, LocalSkillStore, type LocalStoreConfigOptions, type LocalStoreOptions, LocalTaskStore, LocalTaskWorkItemStore, LocalTenantStore, LocalThreadMessageQueueStore, LocalThreadStore, LocalUserStore, LocalUserTenantLinkStore, LocalWorkflowTrackingStore, LocalWorkspaceStore, type Migration, MigrationManager, RunResult, StatementWrapper, closeDatabase, createLocalStoreConfig, ensureTable, getDatabase, initDatabase, nowISO, parseISO };
|
|
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 };
|