@axiom-lattice/pg-stores 1.0.66 → 1.0.68
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 +16 -0
- package/README.md +76 -309
- package/dist/index.d.mts +491 -474
- package/dist/index.d.ts +491 -474
- package/dist/index.js +3987 -3982
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3999 -3994
- package/dist/index.mjs.map +1 -1
- package/examples/database-config-store.example.ts +1 -3
- package/package.json +3 -3
- package/src/__tests__/ThreadMessageQueueStore.test.ts +5 -53
- package/src/createPgStoreConfig.ts +47 -0
- package/src/index.ts +2 -0
- package/src/stores/ThreadMessageQueueStore.ts +57 -79
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { PoolConfig, PoolClient, Pool } from 'pg';
|
|
2
2
|
export { Pool, PoolConfig } from 'pg';
|
|
3
|
-
import { ThreadStore, Thread, CreateThreadRequest, AssistantStore, Assistant, CreateAssistantRequest,
|
|
3
|
+
import { ThreadStore, Thread, CreateThreadRequest, AssistantStore, Assistant, CreateAssistantRequest, DatabaseConfigStore, DatabaseConfigEntry, CreateDatabaseConfigRequest, UpdateDatabaseConfigRequest, MetricsServerConfigStore, MetricsServerConfigEntry, CreateMetricsServerConfigRequest, UpdateMetricsServerConfigRequest, McpServerConfigStore, McpServerConfigEntry, CreateMcpServerConfigRequest, UpdateMcpServerConfigRequest, WorkspaceStore, Workspace, CreateWorkspaceRequest, UpdateWorkspaceRequest, ProjectStore, Project, CreateProjectRequest, UpdateProjectRequest, UserStore, User, CreateUserRequest, UpdateUserRequest, TenantStore, Tenant, CreateTenantRequest, UpdateTenantRequest, UserTenantLinkStore, UserTenantLink, CreateUserTenantLinkRequest, UpdateUserTenantLinkRequest, WorkflowTrackingStore, CreateWorkflowRunRequest, WorkflowRun, UpdateWorkflowRunRequest, CreateRunStepRequest, RunStep, UpdateRunStepRequest, StepType, EvalStore, EvalProject, CreateEvalProjectRequest, EvalSuite, CreateEvalSuiteRequest, EvalCase, CreateEvalCaseRequest, EvalRun, CreateEvalRunRequest, EvalRunResult, EvalProjectReport, BindingRegistry, Binding, CreateBindingInput, ChannelInstallationStore, ChannelInstallation, ChannelInstallationType, CreateChannelInstallationRequest, UpdateChannelInstallationRequest, ScheduleStorage, ScheduledTaskDefinition, ScheduledTaskStatus, ScheduleExecutionType, SkillStore, Skill, CreateSkillRequest } from '@axiom-lattice/protocols';
|
|
4
4
|
export { Assistant, AssistantStore, Binding, BindingRegistry, ChannelInstallation, ChannelInstallationStore, CreateAssistantRequest, CreateBindingInput, CreateChannelInstallationRequest, CreateDatabaseConfigRequest, CreateEvalCaseRequest, CreateEvalProjectRequest, CreateEvalRunRequest, CreateEvalSuiteRequest, CreateMcpServerConfigRequest, CreateMetricsServerConfigRequest, CreateProjectRequest, CreateRunStepRequest, CreateSkillRequest, CreateTenantRequest, CreateThreadRequest, CreateUserRequest, CreateUserTenantLinkRequest, CreateWorkflowRunRequest, CreateWorkspaceRequest, DatabaseConfig, DatabaseConfigEntry, DatabaseConfigStore, DatabaseType, EvalCase, EvalProject, EvalProjectReport, EvalRun, EvalRunResult, EvalStore, EvalSuite, LarkChannelInstallationConfig, McpServerConfigEntry, McpServerConfigStore, MetricsServerConfig, MetricsServerConfigEntry, MetricsServerConfigStore, Project, ProjectStore, RunStep, ScheduleExecutionType, ScheduleStorage, ScheduledTaskDefinition, ScheduledTaskStatus, Skill, SkillStore, StorageType, Tenant, TenantStatus, TenantStore, Thread, ThreadStore, UpdateChannelInstallationRequest, UpdateDatabaseConfigRequest, UpdateMcpServerConfigRequest, UpdateMetricsServerConfigRequest, UpdateProjectRequest, UpdateRunStepRequest, UpdateTenantRequest, UpdateUserRequest, UpdateUserTenantLinkRequest, UpdateWorkflowRunRequest, UpdateWorkspaceRequest, User, UserStore, UserTenantLink, UserTenantLinkStore, UserTenantRole, WorkflowRun, WorkflowTrackingStore, Workspace, WorkspaceStore } from '@axiom-lattice/protocols';
|
|
5
5
|
import { IMessageQueueStore, AddMessageParams, PendingMessage, ThreadInfo } from '@axiom-lattice/core';
|
|
6
6
|
export { AddMessageParams, PendingMessage, ThreadInfo } from '@axiom-lattice/core';
|
|
@@ -157,197 +157,6 @@ declare class PostgreSQLAssistantStore implements AssistantStore {
|
|
|
157
157
|
private mapRowToAssistant;
|
|
158
158
|
}
|
|
159
159
|
|
|
160
|
-
/**
|
|
161
|
-
* PostgreSQL implementation of ScheduleStorage
|
|
162
|
-
*
|
|
163
|
-
* Provides persistent storage for scheduled tasks
|
|
164
|
-
* Data survives service restarts
|
|
165
|
-
*/
|
|
166
|
-
|
|
167
|
-
/**
|
|
168
|
-
* PostgreSQL ScheduleStorage options
|
|
169
|
-
*/
|
|
170
|
-
interface PostgreSQLScheduleStorageOptions {
|
|
171
|
-
/**
|
|
172
|
-
* PostgreSQL connection pool configuration
|
|
173
|
-
* Can be a connection string or PoolConfig object
|
|
174
|
-
*/
|
|
175
|
-
poolConfig: string | PoolConfig;
|
|
176
|
-
/**
|
|
177
|
-
* Whether to run migrations automatically on initialization
|
|
178
|
-
* @default true
|
|
179
|
-
*/
|
|
180
|
-
autoMigrate?: boolean;
|
|
181
|
-
}
|
|
182
|
-
/**
|
|
183
|
-
* PostgreSQL implementation of ScheduleStorage
|
|
184
|
-
*/
|
|
185
|
-
declare class PostgreSQLScheduleStorage implements ScheduleStorage {
|
|
186
|
-
private pool;
|
|
187
|
-
private migrationManager;
|
|
188
|
-
private initialized;
|
|
189
|
-
constructor(options: PostgreSQLScheduleStorageOptions);
|
|
190
|
-
/**
|
|
191
|
-
* Dispose resources and close the connection pool
|
|
192
|
-
*/
|
|
193
|
-
dispose(): Promise<void>;
|
|
194
|
-
/**
|
|
195
|
-
* Initialize the store and run migrations
|
|
196
|
-
*/
|
|
197
|
-
initialize(): Promise<void>;
|
|
198
|
-
/**
|
|
199
|
-
* Ensure store is initialized
|
|
200
|
-
*/
|
|
201
|
-
private ensureInitialized;
|
|
202
|
-
/**
|
|
203
|
-
* Save a new task
|
|
204
|
-
*/
|
|
205
|
-
save(task: ScheduledTaskDefinition): Promise<void>;
|
|
206
|
-
/**
|
|
207
|
-
* Get task by ID
|
|
208
|
-
*/
|
|
209
|
-
get(taskId: string): Promise<ScheduledTaskDefinition | null>;
|
|
210
|
-
/**
|
|
211
|
-
* Update task
|
|
212
|
-
*/
|
|
213
|
-
update(taskId: string, updates: Partial<ScheduledTaskDefinition>): Promise<void>;
|
|
214
|
-
/**
|
|
215
|
-
* Delete task
|
|
216
|
-
*/
|
|
217
|
-
delete(taskId: string): Promise<void>;
|
|
218
|
-
/**
|
|
219
|
-
* Get all active tasks (pending or paused)
|
|
220
|
-
*/
|
|
221
|
-
getActiveTasks(): Promise<ScheduledTaskDefinition[]>;
|
|
222
|
-
/**
|
|
223
|
-
* Get tasks by type
|
|
224
|
-
*/
|
|
225
|
-
getTasksByType(taskType: string): Promise<ScheduledTaskDefinition[]>;
|
|
226
|
-
/**
|
|
227
|
-
* Get tasks by status
|
|
228
|
-
*/
|
|
229
|
-
getTasksByStatus(status: ScheduledTaskStatus): Promise<ScheduledTaskDefinition[]>;
|
|
230
|
-
/**
|
|
231
|
-
* Get tasks by execution type
|
|
232
|
-
*/
|
|
233
|
-
getTasksByExecutionType(executionType: ScheduleExecutionType): Promise<ScheduledTaskDefinition[]>;
|
|
234
|
-
/**
|
|
235
|
-
* Get tasks by assistant ID
|
|
236
|
-
*/
|
|
237
|
-
getTasksByAssistantId(assistantId: string): Promise<ScheduledTaskDefinition[]>;
|
|
238
|
-
/**
|
|
239
|
-
* Get tasks by thread ID
|
|
240
|
-
*/
|
|
241
|
-
getTasksByThreadId(threadId: string): Promise<ScheduledTaskDefinition[]>;
|
|
242
|
-
/**
|
|
243
|
-
* Get all tasks with optional filters
|
|
244
|
-
*/
|
|
245
|
-
getAllTasks(filters?: {
|
|
246
|
-
tenantId?: string;
|
|
247
|
-
status?: ScheduledTaskStatus;
|
|
248
|
-
executionType?: ScheduleExecutionType;
|
|
249
|
-
taskType?: string;
|
|
250
|
-
assistantId?: string;
|
|
251
|
-
threadId?: string;
|
|
252
|
-
limit?: number;
|
|
253
|
-
offset?: number;
|
|
254
|
-
}): Promise<ScheduledTaskDefinition[]>;
|
|
255
|
-
/**
|
|
256
|
-
* Count tasks with optional filters
|
|
257
|
-
*/
|
|
258
|
-
countTasks(filters?: {
|
|
259
|
-
tenantId?: string;
|
|
260
|
-
status?: ScheduledTaskStatus;
|
|
261
|
-
executionType?: ScheduleExecutionType;
|
|
262
|
-
taskType?: string;
|
|
263
|
-
assistantId?: string;
|
|
264
|
-
threadId?: string;
|
|
265
|
-
}): Promise<number>;
|
|
266
|
-
/**
|
|
267
|
-
* Delete completed/cancelled/failed tasks older than specified time
|
|
268
|
-
*/
|
|
269
|
-
deleteOldTasks(olderThanMs: number): Promise<number>;
|
|
270
|
-
/**
|
|
271
|
-
* Map database row to ScheduledTaskDefinition
|
|
272
|
-
*/
|
|
273
|
-
private mapRowToTask;
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
/**
|
|
277
|
-
* PostgreSQL implementation of SkillStore with tenant isolation
|
|
278
|
-
*/
|
|
279
|
-
|
|
280
|
-
interface PostgreSQLSkillStoreOptions {
|
|
281
|
-
poolConfig: string | PoolConfig;
|
|
282
|
-
autoMigrate?: boolean;
|
|
283
|
-
}
|
|
284
|
-
/**
|
|
285
|
-
* PostgreSQL implementation of SkillStore with tenant isolation
|
|
286
|
-
*
|
|
287
|
-
* Features:
|
|
288
|
-
* - Multi-tenant isolation via tenant_id
|
|
289
|
-
*/
|
|
290
|
-
declare class PostgreSQLSkillStore implements SkillStore {
|
|
291
|
-
private pool;
|
|
292
|
-
private migrationManager;
|
|
293
|
-
private initialized;
|
|
294
|
-
private ownsPool;
|
|
295
|
-
private initPromise;
|
|
296
|
-
constructor(options: PostgreSQLSkillStoreOptions);
|
|
297
|
-
/**
|
|
298
|
-
* Initialize the store and run migrations
|
|
299
|
-
* Uses a promise-based lock to prevent concurrent initialization
|
|
300
|
-
*/
|
|
301
|
-
initialize(): Promise<void>;
|
|
302
|
-
dispose(): Promise<void>;
|
|
303
|
-
private ensureInitialized;
|
|
304
|
-
/**
|
|
305
|
-
* Map database row to Skill object
|
|
306
|
-
*/
|
|
307
|
-
private mapRowToSkill;
|
|
308
|
-
/**
|
|
309
|
-
* Get all skills for a tenant
|
|
310
|
-
*/
|
|
311
|
-
getAllSkills(tenantId: string): Promise<Skill[]>;
|
|
312
|
-
/**
|
|
313
|
-
* Get skill by ID for a tenant
|
|
314
|
-
*/
|
|
315
|
-
getSkillById(tenantId: string, id: string): Promise<Skill | null>;
|
|
316
|
-
/**
|
|
317
|
-
* Create a new skill for a tenant
|
|
318
|
-
*/
|
|
319
|
-
createSkill(tenantId: string, id: string, data: CreateSkillRequest): Promise<Skill>;
|
|
320
|
-
/**
|
|
321
|
-
* Update an existing skill for a tenant
|
|
322
|
-
*/
|
|
323
|
-
updateSkill(tenantId: string, id: string, updates: Partial<CreateSkillRequest>): Promise<Skill | null>;
|
|
324
|
-
/**
|
|
325
|
-
* Delete a skill by ID for a tenant
|
|
326
|
-
*/
|
|
327
|
-
deleteSkill(tenantId: string, id: string): Promise<boolean>;
|
|
328
|
-
/**
|
|
329
|
-
* Check if skill exists for a tenant
|
|
330
|
-
*/
|
|
331
|
-
hasSkill(tenantId: string, id: string): Promise<boolean>;
|
|
332
|
-
/**
|
|
333
|
-
* Search skills by metadata within a tenant
|
|
334
|
-
*/
|
|
335
|
-
searchByMetadata(tenantId: string, metadataKey: string, metadataValue: string): Promise<Skill[]>;
|
|
336
|
-
/**
|
|
337
|
-
* Filter skills by compatibility within a tenant
|
|
338
|
-
*/
|
|
339
|
-
filterByCompatibility(tenantId: string, compatibility: string): Promise<Skill[]>;
|
|
340
|
-
/**
|
|
341
|
-
* Filter skills by license within a tenant
|
|
342
|
-
*/
|
|
343
|
-
filterByLicense(tenantId: string, license: string): Promise<Skill[]>;
|
|
344
|
-
/**
|
|
345
|
-
* Get sub-skills of a parent skill within a tenant
|
|
346
|
-
* Note: This searches for skills that have the parent skill name in their subSkills array
|
|
347
|
-
*/
|
|
348
|
-
getSubSkills(tenantId: string, parentSkillName: string): Promise<Skill[]>;
|
|
349
|
-
}
|
|
350
|
-
|
|
351
160
|
/**
|
|
352
161
|
* PostgreSQL implementation of DatabaseConfigStore
|
|
353
162
|
*/
|
|
@@ -861,28 +670,504 @@ declare class PostgreSQLUserTenantLinkStore implements UserTenantLinkStore {
|
|
|
861
670
|
}
|
|
862
671
|
|
|
863
672
|
/**
|
|
864
|
-
*
|
|
673
|
+
* PostgreSQL implementation of WorkflowTrackingStore
|
|
865
674
|
*/
|
|
866
675
|
|
|
676
|
+
interface PostgreSQLWorkflowTrackingStoreOptions {
|
|
677
|
+
poolConfig: string | PoolConfig;
|
|
678
|
+
autoMigrate?: boolean;
|
|
679
|
+
}
|
|
680
|
+
declare class PostgreSQLWorkflowTrackingStore implements WorkflowTrackingStore {
|
|
681
|
+
private pool;
|
|
682
|
+
private migrationManager;
|
|
683
|
+
private initialized;
|
|
684
|
+
private initPromise;
|
|
685
|
+
constructor(options: PostgreSQLWorkflowTrackingStoreOptions);
|
|
686
|
+
dispose(): Promise<void>;
|
|
687
|
+
initialize(): Promise<void>;
|
|
688
|
+
private ensureInitialized;
|
|
689
|
+
createWorkflowRun(request: CreateWorkflowRunRequest): Promise<WorkflowRun>;
|
|
690
|
+
getWorkflowRun(runId: string): Promise<WorkflowRun | null>;
|
|
691
|
+
updateWorkflowRun(runId: string, updates: UpdateWorkflowRunRequest): Promise<WorkflowRun | null>;
|
|
692
|
+
deleteWorkflowRun(runId: string): Promise<void>;
|
|
693
|
+
getWorkflowRunsByThreadId(tenantId: string, threadId: string): Promise<WorkflowRun[]>;
|
|
694
|
+
getWorkflowRunsByAssistantId(tenantId: string, assistantId: string): Promise<WorkflowRun[]>;
|
|
695
|
+
getWorkflowRunsByTenantId(tenantId: string): Promise<WorkflowRun[]>;
|
|
696
|
+
createRunStep(request: CreateRunStepRequest): Promise<RunStep>;
|
|
697
|
+
updateRunStep(runId: string, stepId: string, updates: UpdateRunStepRequest): Promise<RunStep | null>;
|
|
698
|
+
getRunSteps(runId: string): Promise<RunStep[]>;
|
|
699
|
+
getRunStepsByType(runId: string, stepType: StepType): Promise<RunStep[]>;
|
|
700
|
+
getInterruptedSteps(runId: string): Promise<RunStep[]>;
|
|
701
|
+
private mapRowToWorkflowRun;
|
|
702
|
+
private mapRowToRunStep;
|
|
703
|
+
}
|
|
704
|
+
|
|
867
705
|
/**
|
|
868
|
-
*
|
|
706
|
+
* PostgreSQL implementation of EvalStore
|
|
869
707
|
*/
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
708
|
+
|
|
709
|
+
/** PostgreSQL EvalStore options */
|
|
710
|
+
interface PostgreSQLEvalStoreOptions {
|
|
711
|
+
/** PostgreSQL connection pool configuration */
|
|
712
|
+
poolConfig: string | PoolConfig;
|
|
713
|
+
/** Whether to run migrations automatically on initialization @default true */
|
|
714
|
+
autoMigrate?: boolean;
|
|
875
715
|
}
|
|
876
716
|
/**
|
|
877
|
-
*
|
|
717
|
+
* PostgreSQL implementation of EvalStore
|
|
718
|
+
*
|
|
719
|
+
* Features:
|
|
720
|
+
* - Multi-tenant isolation via tenant_id
|
|
721
|
+
* - Full CRUD for projects, suites, cases, runs, run results
|
|
722
|
+
* - Project report aggregation
|
|
878
723
|
*/
|
|
879
|
-
declare class
|
|
724
|
+
declare class PostgreSQLEvalStore implements EvalStore {
|
|
880
725
|
private pool;
|
|
881
|
-
private
|
|
882
|
-
|
|
726
|
+
private migrationManager;
|
|
727
|
+
private initialized;
|
|
728
|
+
private ownsPool;
|
|
729
|
+
private initPromise;
|
|
730
|
+
constructor(options: PostgreSQLEvalStoreOptions);
|
|
731
|
+
/** Dispose resources and close the connection pool */
|
|
732
|
+
dispose(): Promise<void>;
|
|
883
733
|
/**
|
|
884
|
-
*
|
|
885
|
-
|
|
734
|
+
* Initialize the store and run migrations
|
|
735
|
+
* Uses a promise-based lock to prevent concurrent initialization
|
|
736
|
+
*/
|
|
737
|
+
initialize(): Promise<void>;
|
|
738
|
+
/** Ensure store is initialized */
|
|
739
|
+
private ensureInitialized;
|
|
740
|
+
private mapRowToProject;
|
|
741
|
+
private mapRowToSuite;
|
|
742
|
+
private mapRowToCase;
|
|
743
|
+
private mapRowToRun;
|
|
744
|
+
private mapRowToRunResult;
|
|
745
|
+
private parseRequiredJson;
|
|
746
|
+
private parseOptionalJson;
|
|
747
|
+
/** Get all eval projects for a tenant */
|
|
748
|
+
getProjectsByTenant(tenantId: string): Promise<EvalProject[]>;
|
|
749
|
+
/** Get a single eval project by ID for a tenant */
|
|
750
|
+
getProjectById(tenantId: string, id: string): Promise<EvalProject | null>;
|
|
751
|
+
/** Create a new eval project */
|
|
752
|
+
createProject(tenantId: string, id: string, data: CreateEvalProjectRequest): Promise<EvalProject>;
|
|
753
|
+
/** Update an eval project */
|
|
754
|
+
updateProject(tenantId: string, id: string, updates: Partial<CreateEvalProjectRequest>): Promise<EvalProject | null>;
|
|
755
|
+
/** Delete an eval project */
|
|
756
|
+
deleteProject(tenantId: string, id: string): Promise<boolean>;
|
|
757
|
+
/** Get all suites in a project with case counts */
|
|
758
|
+
getSuitesByProject(tenantId: string, projectId: string): Promise<EvalSuite[]>;
|
|
759
|
+
/** Get a single suite by ID with case count */
|
|
760
|
+
getSuiteById(tenantId: string, id: string): Promise<EvalSuite | null>;
|
|
761
|
+
/** Create a new eval suite */
|
|
762
|
+
createSuite(tenantId: string, projectId: string, id: string, data: CreateEvalSuiteRequest): Promise<EvalSuite>;
|
|
763
|
+
/** Update a suite's name */
|
|
764
|
+
updateSuite(tenantId: string, id: string, updates: Partial<CreateEvalSuiteRequest>): Promise<EvalSuite | null>;
|
|
765
|
+
/** Delete a suite */
|
|
766
|
+
deleteSuite(tenantId: string, id: string): Promise<boolean>;
|
|
767
|
+
/** Get all test cases in a suite */
|
|
768
|
+
getCasesBySuite(tenantId: string, suiteId: string): Promise<EvalCase[]>;
|
|
769
|
+
/** Get a single test case by ID */
|
|
770
|
+
getCaseById(tenantId: string, id: string): Promise<EvalCase | null>;
|
|
771
|
+
/** Create a new test case */
|
|
772
|
+
createCase(tenantId: string, suiteId: string, id: string, data: CreateEvalCaseRequest): Promise<EvalCase>;
|
|
773
|
+
/** Update a test case */
|
|
774
|
+
updateCase(tenantId: string, id: string, updates: Partial<CreateEvalCaseRequest>): Promise<EvalCase | null>;
|
|
775
|
+
/** Delete a test case */
|
|
776
|
+
deleteCase(tenantId: string, id: string): Promise<boolean>;
|
|
777
|
+
/** Get all runs for a tenant, optionally filtered by project or status */
|
|
778
|
+
getRunsByTenant(tenantId: string, opts?: {
|
|
779
|
+
projectId?: string;
|
|
780
|
+
status?: string;
|
|
781
|
+
}): Promise<EvalRun[]>;
|
|
782
|
+
/** Get a single run by ID */
|
|
783
|
+
getRunById(tenantId: string, id: string): Promise<EvalRun | null>;
|
|
784
|
+
/** Create a new eval run */
|
|
785
|
+
createRun(tenantId: string, projectId: string, id: string, data: CreateEvalRunRequest): Promise<EvalRun>;
|
|
786
|
+
/** Update a run's status and aggregate fields */
|
|
787
|
+
updateRunStatus(tenantId: string, id: string, updates: {
|
|
788
|
+
status?: EvalRun["status"];
|
|
789
|
+
passedCases?: number;
|
|
790
|
+
failedCases?: number;
|
|
791
|
+
avgScore?: number;
|
|
792
|
+
error?: string;
|
|
793
|
+
completedAt?: Date;
|
|
794
|
+
}): Promise<EvalRun | null>;
|
|
795
|
+
/** Delete a run and its results */
|
|
796
|
+
deleteRun(tenantId: string, id: string): Promise<boolean>;
|
|
797
|
+
/** Get all results belonging to a run */
|
|
798
|
+
getResultsByRun(tenantId: string, runId: string): Promise<EvalRunResult[]>;
|
|
799
|
+
/** Create a result for a case within a run */
|
|
800
|
+
createRunResult(tenantId: string, runId: string, id: string, data: Omit<EvalRunResult, "id" | "runId" | "createdAt">): Promise<EvalRunResult>;
|
|
801
|
+
/** Update a run result with tenant isolation via the parent run */
|
|
802
|
+
updateRunResult(tenantId: string, id: string, updates: Partial<EvalRunResult>): Promise<EvalRunResult | null>;
|
|
803
|
+
/** Get a single run result by ID with tenant isolation */
|
|
804
|
+
private getRunResultById;
|
|
805
|
+
/** Aggregate report for a project including all runs */
|
|
806
|
+
getProjectReport(tenantId: string, projectId: string): Promise<EvalProjectReport | null>;
|
|
807
|
+
}
|
|
808
|
+
|
|
809
|
+
/**
|
|
810
|
+
* Thread Message Queue Store
|
|
811
|
+
*
|
|
812
|
+
* Provides PostgreSQL storage for thread message queues
|
|
813
|
+
*/
|
|
814
|
+
|
|
815
|
+
interface PostgreSQLThreadMessageQueueStoreOptions {
|
|
816
|
+
poolConfig: string | PoolConfig;
|
|
817
|
+
autoMigrate?: boolean;
|
|
818
|
+
}
|
|
819
|
+
declare class ThreadMessageQueueStore implements IMessageQueueStore {
|
|
820
|
+
private pool;
|
|
821
|
+
private ownsPool;
|
|
822
|
+
private initialized;
|
|
823
|
+
private initPromise;
|
|
824
|
+
private migrationManager;
|
|
825
|
+
constructor(options: PostgreSQLThreadMessageQueueStoreOptions);
|
|
826
|
+
initialize(): Promise<void>;
|
|
827
|
+
dispose(): Promise<void>;
|
|
828
|
+
/**
|
|
829
|
+
* Add message to queue
|
|
830
|
+
*/
|
|
831
|
+
addMessage(params: AddMessageParams): Promise<PendingMessage>;
|
|
832
|
+
/**
|
|
833
|
+
* Add message at head of queue (high priority, e.g., STEER/Command messages)
|
|
834
|
+
* Uses priority=100 to ensure message is processed first
|
|
835
|
+
*/
|
|
836
|
+
addMessageAtHead(params: AddMessageParams): Promise<PendingMessage>;
|
|
837
|
+
/**
|
|
838
|
+
* Get pending messages for thread
|
|
839
|
+
*/
|
|
840
|
+
getPendingMessages(threadId: string): Promise<PendingMessage[]>;
|
|
841
|
+
/**
|
|
842
|
+
* Get processing messages for a thread
|
|
843
|
+
*/
|
|
844
|
+
getProcessingMessages(threadId: string): Promise<PendingMessage[]>;
|
|
845
|
+
/**
|
|
846
|
+
* Get queue size
|
|
847
|
+
*/
|
|
848
|
+
getQueueSize(threadId: string): Promise<number>;
|
|
849
|
+
/**
|
|
850
|
+
* Get all threads with pending or processing messages
|
|
851
|
+
*/
|
|
852
|
+
getThreadsWithPendingMessages(): Promise<ThreadInfo[]>;
|
|
853
|
+
/**
|
|
854
|
+
* Remove message
|
|
855
|
+
*/
|
|
856
|
+
removeMessage(messageId: string): Promise<boolean>;
|
|
857
|
+
/**
|
|
858
|
+
* Clear all messages for thread
|
|
859
|
+
*/
|
|
860
|
+
clearMessages(threadId: string): Promise<void>;
|
|
861
|
+
/**
|
|
862
|
+
* Mark message as processing
|
|
863
|
+
*/
|
|
864
|
+
markProcessing(messageId: string): Promise<void>;
|
|
865
|
+
/**
|
|
866
|
+
* Reset all processing messages to pending state for a thread
|
|
867
|
+
* Returns the number of messages reset
|
|
868
|
+
*/
|
|
869
|
+
resetProcessingToPending(threadId: string): Promise<number>;
|
|
870
|
+
private rowToMessage;
|
|
871
|
+
}
|
|
872
|
+
|
|
873
|
+
interface ChannelBindingStoreOptions {
|
|
874
|
+
poolConfig: string | PoolConfig;
|
|
875
|
+
autoMigrate?: boolean;
|
|
876
|
+
}
|
|
877
|
+
declare class ChannelBindingStore implements BindingRegistry {
|
|
878
|
+
private pool;
|
|
879
|
+
private migrationManager;
|
|
880
|
+
private initialized;
|
|
881
|
+
private initPromise;
|
|
882
|
+
constructor(options: ChannelBindingStoreOptions);
|
|
883
|
+
initialize(): Promise<void>;
|
|
884
|
+
resolve(params: {
|
|
885
|
+
channel: string;
|
|
886
|
+
senderId: string;
|
|
887
|
+
channelInstallationId: string;
|
|
888
|
+
tenantId: string;
|
|
889
|
+
}): Promise<Binding | null>;
|
|
890
|
+
create(input: CreateBindingInput): Promise<Binding>;
|
|
891
|
+
update(id: string, patch: Partial<Binding>): Promise<Binding>;
|
|
892
|
+
delete(id: string): Promise<void>;
|
|
893
|
+
list(params: {
|
|
894
|
+
channel?: string;
|
|
895
|
+
agentId?: string;
|
|
896
|
+
tenantId: string;
|
|
897
|
+
channelInstallationId?: string;
|
|
898
|
+
limit?: number;
|
|
899
|
+
offset?: number;
|
|
900
|
+
}): Promise<Binding[]>;
|
|
901
|
+
import(bindings: CreateBindingInput[]): Promise<Binding[]>;
|
|
902
|
+
export(params: {
|
|
903
|
+
tenantId: string;
|
|
904
|
+
}): Promise<Binding[]>;
|
|
905
|
+
private ensureInitialized;
|
|
906
|
+
private mapRowToBinding;
|
|
907
|
+
}
|
|
908
|
+
|
|
909
|
+
interface PostgreSQLChannelInstallationStoreOptions {
|
|
910
|
+
poolConfig: string | PoolConfig;
|
|
911
|
+
autoMigrate?: boolean;
|
|
912
|
+
}
|
|
913
|
+
declare class PostgreSQLChannelInstallationStore implements ChannelInstallationStore {
|
|
914
|
+
private pool;
|
|
915
|
+
private migrationManager;
|
|
916
|
+
private initialized;
|
|
917
|
+
private initPromise;
|
|
918
|
+
constructor(options: PostgreSQLChannelInstallationStoreOptions);
|
|
919
|
+
initialize(): Promise<void>;
|
|
920
|
+
getInstallationById(installationId: string): Promise<ChannelInstallation | null>;
|
|
921
|
+
getInstallationsByTenant(tenantId: string, channel?: ChannelInstallationType): Promise<ChannelInstallation[]>;
|
|
922
|
+
createInstallation(tenantId: string, installationId: string, data: CreateChannelInstallationRequest): Promise<ChannelInstallation>;
|
|
923
|
+
updateInstallation(tenantId: string, installationId: string, updates: UpdateChannelInstallationRequest): Promise<ChannelInstallation | null>;
|
|
924
|
+
deleteInstallation(tenantId: string, installationId: string): Promise<boolean>;
|
|
925
|
+
private ensureInitialized;
|
|
926
|
+
private mapRowToInstallation;
|
|
927
|
+
private encryptSecrets;
|
|
928
|
+
private decryptSecrets;
|
|
929
|
+
}
|
|
930
|
+
|
|
931
|
+
/**
|
|
932
|
+
* PostgreSQL implementation of ScheduleStorage
|
|
933
|
+
*
|
|
934
|
+
* Provides persistent storage for scheduled tasks
|
|
935
|
+
* Data survives service restarts
|
|
936
|
+
*/
|
|
937
|
+
|
|
938
|
+
/**
|
|
939
|
+
* PostgreSQL ScheduleStorage options
|
|
940
|
+
*/
|
|
941
|
+
interface PostgreSQLScheduleStorageOptions {
|
|
942
|
+
/**
|
|
943
|
+
* PostgreSQL connection pool configuration
|
|
944
|
+
* Can be a connection string or PoolConfig object
|
|
945
|
+
*/
|
|
946
|
+
poolConfig: string | PoolConfig;
|
|
947
|
+
/**
|
|
948
|
+
* Whether to run migrations automatically on initialization
|
|
949
|
+
* @default true
|
|
950
|
+
*/
|
|
951
|
+
autoMigrate?: boolean;
|
|
952
|
+
}
|
|
953
|
+
/**
|
|
954
|
+
* PostgreSQL implementation of ScheduleStorage
|
|
955
|
+
*/
|
|
956
|
+
declare class PostgreSQLScheduleStorage implements ScheduleStorage {
|
|
957
|
+
private pool;
|
|
958
|
+
private migrationManager;
|
|
959
|
+
private initialized;
|
|
960
|
+
constructor(options: PostgreSQLScheduleStorageOptions);
|
|
961
|
+
/**
|
|
962
|
+
* Dispose resources and close the connection pool
|
|
963
|
+
*/
|
|
964
|
+
dispose(): Promise<void>;
|
|
965
|
+
/**
|
|
966
|
+
* Initialize the store and run migrations
|
|
967
|
+
*/
|
|
968
|
+
initialize(): Promise<void>;
|
|
969
|
+
/**
|
|
970
|
+
* Ensure store is initialized
|
|
971
|
+
*/
|
|
972
|
+
private ensureInitialized;
|
|
973
|
+
/**
|
|
974
|
+
* Save a new task
|
|
975
|
+
*/
|
|
976
|
+
save(task: ScheduledTaskDefinition): Promise<void>;
|
|
977
|
+
/**
|
|
978
|
+
* Get task by ID
|
|
979
|
+
*/
|
|
980
|
+
get(taskId: string): Promise<ScheduledTaskDefinition | null>;
|
|
981
|
+
/**
|
|
982
|
+
* Update task
|
|
983
|
+
*/
|
|
984
|
+
update(taskId: string, updates: Partial<ScheduledTaskDefinition>): Promise<void>;
|
|
985
|
+
/**
|
|
986
|
+
* Delete task
|
|
987
|
+
*/
|
|
988
|
+
delete(taskId: string): Promise<void>;
|
|
989
|
+
/**
|
|
990
|
+
* Get all active tasks (pending or paused)
|
|
991
|
+
*/
|
|
992
|
+
getActiveTasks(): Promise<ScheduledTaskDefinition[]>;
|
|
993
|
+
/**
|
|
994
|
+
* Get tasks by type
|
|
995
|
+
*/
|
|
996
|
+
getTasksByType(taskType: string): Promise<ScheduledTaskDefinition[]>;
|
|
997
|
+
/**
|
|
998
|
+
* Get tasks by status
|
|
999
|
+
*/
|
|
1000
|
+
getTasksByStatus(status: ScheduledTaskStatus): Promise<ScheduledTaskDefinition[]>;
|
|
1001
|
+
/**
|
|
1002
|
+
* Get tasks by execution type
|
|
1003
|
+
*/
|
|
1004
|
+
getTasksByExecutionType(executionType: ScheduleExecutionType): Promise<ScheduledTaskDefinition[]>;
|
|
1005
|
+
/**
|
|
1006
|
+
* Get tasks by assistant ID
|
|
1007
|
+
*/
|
|
1008
|
+
getTasksByAssistantId(assistantId: string): Promise<ScheduledTaskDefinition[]>;
|
|
1009
|
+
/**
|
|
1010
|
+
* Get tasks by thread ID
|
|
1011
|
+
*/
|
|
1012
|
+
getTasksByThreadId(threadId: string): Promise<ScheduledTaskDefinition[]>;
|
|
1013
|
+
/**
|
|
1014
|
+
* Get all tasks with optional filters
|
|
1015
|
+
*/
|
|
1016
|
+
getAllTasks(filters?: {
|
|
1017
|
+
tenantId?: string;
|
|
1018
|
+
status?: ScheduledTaskStatus;
|
|
1019
|
+
executionType?: ScheduleExecutionType;
|
|
1020
|
+
taskType?: string;
|
|
1021
|
+
assistantId?: string;
|
|
1022
|
+
threadId?: string;
|
|
1023
|
+
limit?: number;
|
|
1024
|
+
offset?: number;
|
|
1025
|
+
}): Promise<ScheduledTaskDefinition[]>;
|
|
1026
|
+
/**
|
|
1027
|
+
* Count tasks with optional filters
|
|
1028
|
+
*/
|
|
1029
|
+
countTasks(filters?: {
|
|
1030
|
+
tenantId?: string;
|
|
1031
|
+
status?: ScheduledTaskStatus;
|
|
1032
|
+
executionType?: ScheduleExecutionType;
|
|
1033
|
+
taskType?: string;
|
|
1034
|
+
assistantId?: string;
|
|
1035
|
+
threadId?: string;
|
|
1036
|
+
}): Promise<number>;
|
|
1037
|
+
/**
|
|
1038
|
+
* Delete completed/cancelled/failed tasks older than specified time
|
|
1039
|
+
*/
|
|
1040
|
+
deleteOldTasks(olderThanMs: number): Promise<number>;
|
|
1041
|
+
/**
|
|
1042
|
+
* Map database row to ScheduledTaskDefinition
|
|
1043
|
+
*/
|
|
1044
|
+
private mapRowToTask;
|
|
1045
|
+
}
|
|
1046
|
+
|
|
1047
|
+
/**
|
|
1048
|
+
* createPgStoreConfig
|
|
1049
|
+
*
|
|
1050
|
+
* Creates a map of all PG store instances from a single connection string,
|
|
1051
|
+
* ready to pass directly to configureStores().
|
|
1052
|
+
*/
|
|
1053
|
+
|
|
1054
|
+
declare function createPgStoreConfig(connectionString: string): {
|
|
1055
|
+
workspace: PostgreSQLWorkspaceStore;
|
|
1056
|
+
project: PostgreSQLProjectStore;
|
|
1057
|
+
eval: PostgreSQLEvalStore;
|
|
1058
|
+
user: PostgreSQLUserStore;
|
|
1059
|
+
tenant: PostgreSQLTenantStore;
|
|
1060
|
+
userTenantLink: PostgreSQLUserTenantLinkStore;
|
|
1061
|
+
channelBinding: ChannelBindingStore;
|
|
1062
|
+
channelInstallation: PostgreSQLChannelInstallationStore;
|
|
1063
|
+
thread: PostgreSQLThreadStore;
|
|
1064
|
+
database: PostgreSQLDatabaseConfigStore;
|
|
1065
|
+
metrics: PostgreSQLMetricsServerConfigStore;
|
|
1066
|
+
mcp: PostgreSQLMcpServerConfigStore;
|
|
1067
|
+
assistant: PostgreSQLAssistantStore;
|
|
1068
|
+
workflowTracking: PostgreSQLWorkflowTrackingStore;
|
|
1069
|
+
threadMessageQueue: ThreadMessageQueueStore;
|
|
1070
|
+
schedule: PostgreSQLScheduleStorage;
|
|
1071
|
+
};
|
|
1072
|
+
|
|
1073
|
+
/**
|
|
1074
|
+
* PostgreSQL implementation of SkillStore with tenant isolation
|
|
1075
|
+
*/
|
|
1076
|
+
|
|
1077
|
+
interface PostgreSQLSkillStoreOptions {
|
|
1078
|
+
poolConfig: string | PoolConfig;
|
|
1079
|
+
autoMigrate?: boolean;
|
|
1080
|
+
}
|
|
1081
|
+
/**
|
|
1082
|
+
* PostgreSQL implementation of SkillStore with tenant isolation
|
|
1083
|
+
*
|
|
1084
|
+
* Features:
|
|
1085
|
+
* - Multi-tenant isolation via tenant_id
|
|
1086
|
+
*/
|
|
1087
|
+
declare class PostgreSQLSkillStore implements SkillStore {
|
|
1088
|
+
private pool;
|
|
1089
|
+
private migrationManager;
|
|
1090
|
+
private initialized;
|
|
1091
|
+
private ownsPool;
|
|
1092
|
+
private initPromise;
|
|
1093
|
+
constructor(options: PostgreSQLSkillStoreOptions);
|
|
1094
|
+
/**
|
|
1095
|
+
* Initialize the store and run migrations
|
|
1096
|
+
* Uses a promise-based lock to prevent concurrent initialization
|
|
1097
|
+
*/
|
|
1098
|
+
initialize(): Promise<void>;
|
|
1099
|
+
dispose(): Promise<void>;
|
|
1100
|
+
private ensureInitialized;
|
|
1101
|
+
/**
|
|
1102
|
+
* Map database row to Skill object
|
|
1103
|
+
*/
|
|
1104
|
+
private mapRowToSkill;
|
|
1105
|
+
/**
|
|
1106
|
+
* Get all skills for a tenant
|
|
1107
|
+
*/
|
|
1108
|
+
getAllSkills(tenantId: string): Promise<Skill[]>;
|
|
1109
|
+
/**
|
|
1110
|
+
* Get skill by ID for a tenant
|
|
1111
|
+
*/
|
|
1112
|
+
getSkillById(tenantId: string, id: string): Promise<Skill | null>;
|
|
1113
|
+
/**
|
|
1114
|
+
* Create a new skill for a tenant
|
|
1115
|
+
*/
|
|
1116
|
+
createSkill(tenantId: string, id: string, data: CreateSkillRequest): Promise<Skill>;
|
|
1117
|
+
/**
|
|
1118
|
+
* Update an existing skill for a tenant
|
|
1119
|
+
*/
|
|
1120
|
+
updateSkill(tenantId: string, id: string, updates: Partial<CreateSkillRequest>): Promise<Skill | null>;
|
|
1121
|
+
/**
|
|
1122
|
+
* Delete a skill by ID for a tenant
|
|
1123
|
+
*/
|
|
1124
|
+
deleteSkill(tenantId: string, id: string): Promise<boolean>;
|
|
1125
|
+
/**
|
|
1126
|
+
* Check if skill exists for a tenant
|
|
1127
|
+
*/
|
|
1128
|
+
hasSkill(tenantId: string, id: string): Promise<boolean>;
|
|
1129
|
+
/**
|
|
1130
|
+
* Search skills by metadata within a tenant
|
|
1131
|
+
*/
|
|
1132
|
+
searchByMetadata(tenantId: string, metadataKey: string, metadataValue: string): Promise<Skill[]>;
|
|
1133
|
+
/**
|
|
1134
|
+
* Filter skills by compatibility within a tenant
|
|
1135
|
+
*/
|
|
1136
|
+
filterByCompatibility(tenantId: string, compatibility: string): Promise<Skill[]>;
|
|
1137
|
+
/**
|
|
1138
|
+
* Filter skills by license within a tenant
|
|
1139
|
+
*/
|
|
1140
|
+
filterByLicense(tenantId: string, license: string): Promise<Skill[]>;
|
|
1141
|
+
/**
|
|
1142
|
+
* Get sub-skills of a parent skill within a tenant
|
|
1143
|
+
* Note: This searches for skills that have the parent skill name in their subSkills array
|
|
1144
|
+
*/
|
|
1145
|
+
getSubSkills(tenantId: string, parentSkillName: string): Promise<Skill[]>;
|
|
1146
|
+
}
|
|
1147
|
+
|
|
1148
|
+
/**
|
|
1149
|
+
* Migration system for database schema management
|
|
1150
|
+
*/
|
|
1151
|
+
|
|
1152
|
+
/**
|
|
1153
|
+
* Migration definition
|
|
1154
|
+
*/
|
|
1155
|
+
interface Migration {
|
|
1156
|
+
version: number;
|
|
1157
|
+
name: string;
|
|
1158
|
+
up: (client: PoolClient) => Promise<void>;
|
|
1159
|
+
down?: (client: PoolClient) => Promise<void>;
|
|
1160
|
+
}
|
|
1161
|
+
/**
|
|
1162
|
+
* Migration manager
|
|
1163
|
+
*/
|
|
1164
|
+
declare class MigrationManager {
|
|
1165
|
+
private pool;
|
|
1166
|
+
private migrations;
|
|
1167
|
+
constructor(pool: Pool);
|
|
1168
|
+
/**
|
|
1169
|
+
* Register a migration
|
|
1170
|
+
*/
|
|
886
1171
|
register(migration: Migration): void;
|
|
887
1172
|
/**
|
|
888
1173
|
* Initialize migrations table if it doesn't exist
|
|
@@ -1100,115 +1385,6 @@ declare const createChannelBindingsTable: Migration;
|
|
|
1100
1385
|
|
|
1101
1386
|
declare const createWorkflowTrackingTables: Migration;
|
|
1102
1387
|
|
|
1103
|
-
interface ChannelBindingStoreOptions {
|
|
1104
|
-
poolConfig: string | PoolConfig;
|
|
1105
|
-
autoMigrate?: boolean;
|
|
1106
|
-
}
|
|
1107
|
-
declare class ChannelBindingStore implements BindingRegistry {
|
|
1108
|
-
private pool;
|
|
1109
|
-
private migrationManager;
|
|
1110
|
-
private initialized;
|
|
1111
|
-
private initPromise;
|
|
1112
|
-
constructor(options: ChannelBindingStoreOptions);
|
|
1113
|
-
initialize(): Promise<void>;
|
|
1114
|
-
resolve(params: {
|
|
1115
|
-
channel: string;
|
|
1116
|
-
senderId: string;
|
|
1117
|
-
channelInstallationId: string;
|
|
1118
|
-
tenantId: string;
|
|
1119
|
-
}): Promise<Binding | null>;
|
|
1120
|
-
create(input: CreateBindingInput): Promise<Binding>;
|
|
1121
|
-
update(id: string, patch: Partial<Binding>): Promise<Binding>;
|
|
1122
|
-
delete(id: string): Promise<void>;
|
|
1123
|
-
list(params: {
|
|
1124
|
-
channel?: string;
|
|
1125
|
-
agentId?: string;
|
|
1126
|
-
tenantId: string;
|
|
1127
|
-
channelInstallationId?: string;
|
|
1128
|
-
limit?: number;
|
|
1129
|
-
offset?: number;
|
|
1130
|
-
}): Promise<Binding[]>;
|
|
1131
|
-
import(bindings: CreateBindingInput[]): Promise<Binding[]>;
|
|
1132
|
-
export(params: {
|
|
1133
|
-
tenantId: string;
|
|
1134
|
-
}): Promise<Binding[]>;
|
|
1135
|
-
private ensureInitialized;
|
|
1136
|
-
private mapRowToBinding;
|
|
1137
|
-
}
|
|
1138
|
-
|
|
1139
|
-
/**
|
|
1140
|
-
* Thread Message Queue Store
|
|
1141
|
-
*
|
|
1142
|
-
* Provides PostgreSQL storage for thread message queues
|
|
1143
|
-
*/
|
|
1144
|
-
|
|
1145
|
-
declare class ThreadMessageQueueStore implements IMessageQueueStore {
|
|
1146
|
-
private static _instance;
|
|
1147
|
-
private pool;
|
|
1148
|
-
private initialized;
|
|
1149
|
-
static getInstance(): ThreadMessageQueueStore;
|
|
1150
|
-
private constructor();
|
|
1151
|
-
/**
|
|
1152
|
-
* Initialize with PostgreSQL pool
|
|
1153
|
-
* @param pool - PostgreSQL connection pool
|
|
1154
|
-
* @param autoMigrate - Whether to run migrations automatically (default: true)
|
|
1155
|
-
*/
|
|
1156
|
-
initialize(pool: Pool, autoMigrate?: boolean): Promise<void>;
|
|
1157
|
-
private getPool;
|
|
1158
|
-
/**
|
|
1159
|
-
* Add message to queue
|
|
1160
|
-
*/
|
|
1161
|
-
addMessage(params: AddMessageParams): Promise<PendingMessage>;
|
|
1162
|
-
/**
|
|
1163
|
-
* Add message at head of queue (high priority, e.g., STEER/Command messages)
|
|
1164
|
-
* Uses priority=100 to ensure message is processed first
|
|
1165
|
-
*/
|
|
1166
|
-
addMessageAtHead(params: AddMessageParams): Promise<PendingMessage>;
|
|
1167
|
-
/**
|
|
1168
|
-
* Get pending messages for thread
|
|
1169
|
-
*/
|
|
1170
|
-
getPendingMessages(threadId: string): Promise<PendingMessage[]>;
|
|
1171
|
-
/**
|
|
1172
|
-
* Get processing messages for a thread
|
|
1173
|
-
*/
|
|
1174
|
-
getProcessingMessages(threadId: string): Promise<PendingMessage[]>;
|
|
1175
|
-
/**
|
|
1176
|
-
* Get queue size
|
|
1177
|
-
*/
|
|
1178
|
-
getQueueSize(threadId: string): Promise<number>;
|
|
1179
|
-
/**
|
|
1180
|
-
* Get all threads with pending or processing messages
|
|
1181
|
-
*/
|
|
1182
|
-
getThreadsWithPendingMessages(): Promise<ThreadInfo[]>;
|
|
1183
|
-
/**
|
|
1184
|
-
* Remove message
|
|
1185
|
-
*/
|
|
1186
|
-
removeMessage(messageId: string): Promise<boolean>;
|
|
1187
|
-
/**
|
|
1188
|
-
* Clear all messages for thread
|
|
1189
|
-
*/
|
|
1190
|
-
clearMessages(threadId: string): Promise<void>;
|
|
1191
|
-
/**
|
|
1192
|
-
* Mark message as processing
|
|
1193
|
-
*/
|
|
1194
|
-
markProcessing(messageId: string): Promise<void>;
|
|
1195
|
-
/**
|
|
1196
|
-
* Mark message as completed
|
|
1197
|
-
*/
|
|
1198
|
-
markCompleted(messageId: string): Promise<void>;
|
|
1199
|
-
/**
|
|
1200
|
-
* Clear completed messages for thread
|
|
1201
|
-
*/
|
|
1202
|
-
clearCompletedMessages(threadId: string): Promise<void>;
|
|
1203
|
-
/**
|
|
1204
|
-
* Reset all processing messages to pending state for a thread
|
|
1205
|
-
* Returns the number of messages reset
|
|
1206
|
-
*/
|
|
1207
|
-
resetProcessingToPending(threadId: string): Promise<number>;
|
|
1208
|
-
private rowToMessage;
|
|
1209
|
-
}
|
|
1210
|
-
declare const getThreadMessageQueueStore: () => ThreadMessageQueueStore;
|
|
1211
|
-
|
|
1212
1388
|
interface ChannelIdentityMappingStoreOptions {
|
|
1213
1389
|
poolConfig: string | PoolConfig;
|
|
1214
1390
|
autoMigrate?: boolean;
|
|
@@ -1283,165 +1459,6 @@ declare class ChannelIdentityMappingStore {
|
|
|
1283
1459
|
private ensureInitialized;
|
|
1284
1460
|
}
|
|
1285
1461
|
|
|
1286
|
-
interface PostgreSQLChannelInstallationStoreOptions {
|
|
1287
|
-
poolConfig: string | PoolConfig;
|
|
1288
|
-
autoMigrate?: boolean;
|
|
1289
|
-
}
|
|
1290
|
-
declare class PostgreSQLChannelInstallationStore implements ChannelInstallationStore {
|
|
1291
|
-
private pool;
|
|
1292
|
-
private migrationManager;
|
|
1293
|
-
private initialized;
|
|
1294
|
-
private initPromise;
|
|
1295
|
-
constructor(options: PostgreSQLChannelInstallationStoreOptions);
|
|
1296
|
-
initialize(): Promise<void>;
|
|
1297
|
-
getInstallationById(installationId: string): Promise<ChannelInstallation | null>;
|
|
1298
|
-
getInstallationsByTenant(tenantId: string, channel?: ChannelInstallationType): Promise<ChannelInstallation[]>;
|
|
1299
|
-
createInstallation(tenantId: string, installationId: string, data: CreateChannelInstallationRequest): Promise<ChannelInstallation>;
|
|
1300
|
-
updateInstallation(tenantId: string, installationId: string, updates: UpdateChannelInstallationRequest): Promise<ChannelInstallation | null>;
|
|
1301
|
-
deleteInstallation(tenantId: string, installationId: string): Promise<boolean>;
|
|
1302
|
-
private ensureInitialized;
|
|
1303
|
-
private mapRowToInstallation;
|
|
1304
|
-
private encryptSecrets;
|
|
1305
|
-
private decryptSecrets;
|
|
1306
|
-
}
|
|
1307
|
-
|
|
1308
|
-
/**
|
|
1309
|
-
* PostgreSQL implementation of WorkflowTrackingStore
|
|
1310
|
-
*/
|
|
1311
|
-
|
|
1312
|
-
interface PostgreSQLWorkflowTrackingStoreOptions {
|
|
1313
|
-
poolConfig: string | PoolConfig;
|
|
1314
|
-
autoMigrate?: boolean;
|
|
1315
|
-
}
|
|
1316
|
-
declare class PostgreSQLWorkflowTrackingStore implements WorkflowTrackingStore {
|
|
1317
|
-
private pool;
|
|
1318
|
-
private migrationManager;
|
|
1319
|
-
private initialized;
|
|
1320
|
-
private initPromise;
|
|
1321
|
-
constructor(options: PostgreSQLWorkflowTrackingStoreOptions);
|
|
1322
|
-
dispose(): Promise<void>;
|
|
1323
|
-
initialize(): Promise<void>;
|
|
1324
|
-
private ensureInitialized;
|
|
1325
|
-
createWorkflowRun(request: CreateWorkflowRunRequest): Promise<WorkflowRun>;
|
|
1326
|
-
getWorkflowRun(runId: string): Promise<WorkflowRun | null>;
|
|
1327
|
-
updateWorkflowRun(runId: string, updates: UpdateWorkflowRunRequest): Promise<WorkflowRun | null>;
|
|
1328
|
-
deleteWorkflowRun(runId: string): Promise<void>;
|
|
1329
|
-
getWorkflowRunsByThreadId(tenantId: string, threadId: string): Promise<WorkflowRun[]>;
|
|
1330
|
-
getWorkflowRunsByAssistantId(tenantId: string, assistantId: string): Promise<WorkflowRun[]>;
|
|
1331
|
-
getWorkflowRunsByTenantId(tenantId: string): Promise<WorkflowRun[]>;
|
|
1332
|
-
createRunStep(request: CreateRunStepRequest): Promise<RunStep>;
|
|
1333
|
-
updateRunStep(runId: string, stepId: string, updates: UpdateRunStepRequest): Promise<RunStep | null>;
|
|
1334
|
-
getRunSteps(runId: string): Promise<RunStep[]>;
|
|
1335
|
-
getRunStepsByType(runId: string, stepType: StepType): Promise<RunStep[]>;
|
|
1336
|
-
getInterruptedSteps(runId: string): Promise<RunStep[]>;
|
|
1337
|
-
private mapRowToWorkflowRun;
|
|
1338
|
-
private mapRowToRunStep;
|
|
1339
|
-
}
|
|
1340
|
-
|
|
1341
|
-
/**
|
|
1342
|
-
* PostgreSQL implementation of EvalStore
|
|
1343
|
-
*/
|
|
1344
|
-
|
|
1345
|
-
/** PostgreSQL EvalStore options */
|
|
1346
|
-
interface PostgreSQLEvalStoreOptions {
|
|
1347
|
-
/** PostgreSQL connection pool configuration */
|
|
1348
|
-
poolConfig: string | PoolConfig;
|
|
1349
|
-
/** Whether to run migrations automatically on initialization @default true */
|
|
1350
|
-
autoMigrate?: boolean;
|
|
1351
|
-
}
|
|
1352
|
-
/**
|
|
1353
|
-
* PostgreSQL implementation of EvalStore
|
|
1354
|
-
*
|
|
1355
|
-
* Features:
|
|
1356
|
-
* - Multi-tenant isolation via tenant_id
|
|
1357
|
-
* - Full CRUD for projects, suites, cases, runs, run results
|
|
1358
|
-
* - Project report aggregation
|
|
1359
|
-
*/
|
|
1360
|
-
declare class PostgreSQLEvalStore implements EvalStore {
|
|
1361
|
-
private pool;
|
|
1362
|
-
private migrationManager;
|
|
1363
|
-
private initialized;
|
|
1364
|
-
private ownsPool;
|
|
1365
|
-
private initPromise;
|
|
1366
|
-
constructor(options: PostgreSQLEvalStoreOptions);
|
|
1367
|
-
/** Dispose resources and close the connection pool */
|
|
1368
|
-
dispose(): Promise<void>;
|
|
1369
|
-
/**
|
|
1370
|
-
* Initialize the store and run migrations
|
|
1371
|
-
* Uses a promise-based lock to prevent concurrent initialization
|
|
1372
|
-
*/
|
|
1373
|
-
initialize(): Promise<void>;
|
|
1374
|
-
/** Ensure store is initialized */
|
|
1375
|
-
private ensureInitialized;
|
|
1376
|
-
private mapRowToProject;
|
|
1377
|
-
private mapRowToSuite;
|
|
1378
|
-
private mapRowToCase;
|
|
1379
|
-
private mapRowToRun;
|
|
1380
|
-
private mapRowToRunResult;
|
|
1381
|
-
private parseRequiredJson;
|
|
1382
|
-
private parseOptionalJson;
|
|
1383
|
-
/** Get all eval projects for a tenant */
|
|
1384
|
-
getProjectsByTenant(tenantId: string): Promise<EvalProject[]>;
|
|
1385
|
-
/** Get a single eval project by ID for a tenant */
|
|
1386
|
-
getProjectById(tenantId: string, id: string): Promise<EvalProject | null>;
|
|
1387
|
-
/** Create a new eval project */
|
|
1388
|
-
createProject(tenantId: string, id: string, data: CreateEvalProjectRequest): Promise<EvalProject>;
|
|
1389
|
-
/** Update an eval project */
|
|
1390
|
-
updateProject(tenantId: string, id: string, updates: Partial<CreateEvalProjectRequest>): Promise<EvalProject | null>;
|
|
1391
|
-
/** Delete an eval project */
|
|
1392
|
-
deleteProject(tenantId: string, id: string): Promise<boolean>;
|
|
1393
|
-
/** Get all suites in a project with case counts */
|
|
1394
|
-
getSuitesByProject(tenantId: string, projectId: string): Promise<EvalSuite[]>;
|
|
1395
|
-
/** Get a single suite by ID with case count */
|
|
1396
|
-
getSuiteById(tenantId: string, id: string): Promise<EvalSuite | null>;
|
|
1397
|
-
/** Create a new eval suite */
|
|
1398
|
-
createSuite(tenantId: string, projectId: string, id: string, data: CreateEvalSuiteRequest): Promise<EvalSuite>;
|
|
1399
|
-
/** Update a suite's name */
|
|
1400
|
-
updateSuite(tenantId: string, id: string, updates: Partial<CreateEvalSuiteRequest>): Promise<EvalSuite | null>;
|
|
1401
|
-
/** Delete a suite */
|
|
1402
|
-
deleteSuite(tenantId: string, id: string): Promise<boolean>;
|
|
1403
|
-
/** Get all test cases in a suite */
|
|
1404
|
-
getCasesBySuite(tenantId: string, suiteId: string): Promise<EvalCase[]>;
|
|
1405
|
-
/** Get a single test case by ID */
|
|
1406
|
-
getCaseById(tenantId: string, id: string): Promise<EvalCase | null>;
|
|
1407
|
-
/** Create a new test case */
|
|
1408
|
-
createCase(tenantId: string, suiteId: string, id: string, data: CreateEvalCaseRequest): Promise<EvalCase>;
|
|
1409
|
-
/** Update a test case */
|
|
1410
|
-
updateCase(tenantId: string, id: string, updates: Partial<CreateEvalCaseRequest>): Promise<EvalCase | null>;
|
|
1411
|
-
/** Delete a test case */
|
|
1412
|
-
deleteCase(tenantId: string, id: string): Promise<boolean>;
|
|
1413
|
-
/** Get all runs for a tenant, optionally filtered by project or status */
|
|
1414
|
-
getRunsByTenant(tenantId: string, opts?: {
|
|
1415
|
-
projectId?: string;
|
|
1416
|
-
status?: string;
|
|
1417
|
-
}): Promise<EvalRun[]>;
|
|
1418
|
-
/** Get a single run by ID */
|
|
1419
|
-
getRunById(tenantId: string, id: string): Promise<EvalRun | null>;
|
|
1420
|
-
/** Create a new eval run */
|
|
1421
|
-
createRun(tenantId: string, projectId: string, id: string, data: CreateEvalRunRequest): Promise<EvalRun>;
|
|
1422
|
-
/** Update a run's status and aggregate fields */
|
|
1423
|
-
updateRunStatus(tenantId: string, id: string, updates: {
|
|
1424
|
-
status?: EvalRun["status"];
|
|
1425
|
-
passedCases?: number;
|
|
1426
|
-
failedCases?: number;
|
|
1427
|
-
avgScore?: number;
|
|
1428
|
-
error?: string;
|
|
1429
|
-
completedAt?: Date;
|
|
1430
|
-
}): Promise<EvalRun | null>;
|
|
1431
|
-
/** Delete a run and its results */
|
|
1432
|
-
deleteRun(tenantId: string, id: string): Promise<boolean>;
|
|
1433
|
-
/** Get all results belonging to a run */
|
|
1434
|
-
getResultsByRun(tenantId: string, runId: string): Promise<EvalRunResult[]>;
|
|
1435
|
-
/** Create a result for a case within a run */
|
|
1436
|
-
createRunResult(tenantId: string, runId: string, id: string, data: Omit<EvalRunResult, "id" | "runId" | "createdAt">): Promise<EvalRunResult>;
|
|
1437
|
-
/** Update a run result with tenant isolation via the parent run */
|
|
1438
|
-
updateRunResult(tenantId: string, id: string, updates: Partial<EvalRunResult>): Promise<EvalRunResult | null>;
|
|
1439
|
-
/** Get a single run result by ID with tenant isolation */
|
|
1440
|
-
private getRunResultById;
|
|
1441
|
-
/** Aggregate report for a project including all runs */
|
|
1442
|
-
getProjectReport(tenantId: string, projectId: string): Promise<EvalProjectReport | null>;
|
|
1443
|
-
}
|
|
1444
|
-
|
|
1445
1462
|
/**
|
|
1446
1463
|
* Eval table migrations
|
|
1447
1464
|
*/
|
|
@@ -1459,4 +1476,4 @@ declare const createEvalRunResultsTable: Migration;
|
|
|
1459
1476
|
/** All eval migrations in version order */
|
|
1460
1477
|
declare const evalMigrations: Migration[];
|
|
1461
1478
|
|
|
1462
|
-
export { ChannelBindingStore, type ChannelBindingStoreOptions, type ChannelIdentityMapping, ChannelIdentityMappingStore, type ChannelIdentityMappingStoreOptions, type CreateChannelIdentityMappingInput, type Migration, MigrationManager, PostgreSQLAssistantStore, type PostgreSQLAssistantStoreOptions, PostgreSQLChannelInstallationStore, type PostgreSQLChannelInstallationStoreOptions, PostgreSQLDatabaseConfigStore, type PostgreSQLDatabaseConfigStoreOptions, PostgreSQLEvalStore, type PostgreSQLEvalStoreOptions, PostgreSQLMcpServerConfigStore, type PostgreSQLMcpServerConfigStoreOptions, PostgreSQLMetricsServerConfigStore, type PostgreSQLMetricsServerConfigStoreOptions, PostgreSQLProjectStore, type PostgreSQLProjectStoreOptions, PostgreSQLScheduleStorage, type PostgreSQLScheduleStorageOptions, PostgreSQLSkillStore, type PostgreSQLSkillStoreOptions, PostgreSQLTenantStore, type PostgreSQLTenantStoreOptions, PostgreSQLThreadStore, type PostgreSQLThreadStoreOptions, PostgreSQLUserStore, type PostgreSQLUserStoreOptions, PostgreSQLUserTenantLinkStore, type PostgreSQLUserTenantLinkStoreOptions, PostgreSQLWorkflowTrackingStore, type PostgreSQLWorkflowTrackingStoreOptions, PostgreSQLWorkspaceStore, type PostgreSQLWorkspaceStoreOptions, ThreadMessageQueueStore, addAssistantTenantId, addScheduleTenantId, addSkillTenantId, addThreadTenantId, alterChannelInstallationsTable, changeAssistantPrimaryKey, changeSkillPrimaryKey, changeThreadPrimaryKey, createAssistantsTable, createChannelBindingsTable, createChannelIdentityMappingTables, createChannelInstallationsTable, createDatabaseConfigsTable, createEvalCasesTable, createEvalProjectsTable, createEvalRunResultsTable, createEvalRunsTable, createEvalSuitesTable, createMcpServerConfigsTable, createMetricsConfigsTable, createProjectsTable, createScheduledTasksTable, createSkillsTable, createTenantsTable, createThreadMessageQueueTable, createThreadsTable, createUsersTable, createWorkflowTrackingTables, createWorkspacesTable, evalMigrations
|
|
1479
|
+
export { ChannelBindingStore, type ChannelBindingStoreOptions, type ChannelIdentityMapping, ChannelIdentityMappingStore, type ChannelIdentityMappingStoreOptions, type CreateChannelIdentityMappingInput, type Migration, MigrationManager, PostgreSQLAssistantStore, type PostgreSQLAssistantStoreOptions, PostgreSQLChannelInstallationStore, type PostgreSQLChannelInstallationStoreOptions, PostgreSQLDatabaseConfigStore, type PostgreSQLDatabaseConfigStoreOptions, PostgreSQLEvalStore, type PostgreSQLEvalStoreOptions, PostgreSQLMcpServerConfigStore, type PostgreSQLMcpServerConfigStoreOptions, PostgreSQLMetricsServerConfigStore, type PostgreSQLMetricsServerConfigStoreOptions, PostgreSQLProjectStore, type PostgreSQLProjectStoreOptions, PostgreSQLScheduleStorage, type PostgreSQLScheduleStorageOptions, PostgreSQLSkillStore, type PostgreSQLSkillStoreOptions, PostgreSQLTenantStore, type PostgreSQLTenantStoreOptions, type PostgreSQLThreadMessageQueueStoreOptions, PostgreSQLThreadStore, type PostgreSQLThreadStoreOptions, PostgreSQLUserStore, type PostgreSQLUserStoreOptions, PostgreSQLUserTenantLinkStore, type PostgreSQLUserTenantLinkStoreOptions, PostgreSQLWorkflowTrackingStore, type PostgreSQLWorkflowTrackingStoreOptions, PostgreSQLWorkspaceStore, type PostgreSQLWorkspaceStoreOptions, ThreadMessageQueueStore, addAssistantTenantId, addScheduleTenantId, addSkillTenantId, addThreadTenantId, alterChannelInstallationsTable, changeAssistantPrimaryKey, changeSkillPrimaryKey, changeThreadPrimaryKey, createAssistantsTable, createChannelBindingsTable, createChannelIdentityMappingTables, createChannelInstallationsTable, createDatabaseConfigsTable, createEvalCasesTable, createEvalProjectsTable, createEvalRunResultsTable, createEvalRunsTable, createEvalSuitesTable, createMcpServerConfigsTable, createMetricsConfigsTable, createPgStoreConfig, createProjectsTable, createScheduledTasksTable, createSkillsTable, createTenantsTable, createThreadMessageQueueTable, createThreadsTable, createUsersTable, createWorkflowTrackingTables, createWorkspacesTable, evalMigrations };
|