@axiom-lattice/pg-stores 1.0.46 → 1.0.48
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 +14 -0
- package/dist/index.d.mts +41 -3
- package/dist/index.d.ts +41 -3
- package/dist/index.js +354 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +352 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/src/index.ts +10 -0
- package/src/migrations/workflow_tracking_migrations.ts +79 -0
- package/src/stores/PostgreSQLWorkflowTrackingStore.ts +293 -0
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @axiom-lattice/pg-stores@1.0.
|
|
2
|
+
> @axiom-lattice/pg-stores@1.0.48 build /home/runner/work/agentic/agentic/packages/pg-stores
|
|
3
3
|
> tsup src/index.ts --format cjs,esm --dts --sourcemap
|
|
4
4
|
|
|
5
5
|
[34mCLI[39m Building entry: src/index.ts
|
|
@@ -8,13 +8,13 @@
|
|
|
8
8
|
[34mCLI[39m Target: es2020
|
|
9
9
|
[34mCJS[39m Build start
|
|
10
10
|
[34mESM[39m Build start
|
|
11
|
-
[
|
|
12
|
-
[
|
|
13
|
-
[
|
|
14
|
-
[
|
|
15
|
-
[
|
|
16
|
-
[
|
|
11
|
+
[32mESM[39m [1mdist/index.mjs [22m[32m156.69 KB[39m
|
|
12
|
+
[32mESM[39m [1mdist/index.mjs.map [22m[32m297.04 KB[39m
|
|
13
|
+
[32mESM[39m ⚡️ Build success in 478ms
|
|
14
|
+
[32mCJS[39m [1mdist/index.js [22m[32m161.08 KB[39m
|
|
15
|
+
[32mCJS[39m [1mdist/index.js.map [22m[32m297.13 KB[39m
|
|
16
|
+
[32mCJS[39m ⚡️ Build success in 485ms
|
|
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 11625ms
|
|
19
|
+
[32mDTS[39m [1mdist/index.d.ts [22m[32m40.25 KB[39m
|
|
20
|
+
[32mDTS[39m [1mdist/index.d.mts [22m[32m40.25 KB[39m
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @axiom-lattice/pg-stores
|
|
2
2
|
|
|
3
|
+
## 1.0.48
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [d2c6543]
|
|
8
|
+
- @axiom-lattice/core@2.1.58
|
|
9
|
+
|
|
10
|
+
## 1.0.47
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- Updated dependencies [df6bc19]
|
|
15
|
+
- @axiom-lattice/core@2.1.57
|
|
16
|
+
|
|
3
17
|
## 1.0.46
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
package/dist/index.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { PoolConfig, PoolClient, Pool } from 'pg';
|
|
2
2
|
export { Pool, PoolConfig } from 'pg';
|
|
3
|
-
import { ThreadStore, Thread, CreateThreadRequest, AssistantStore, Assistant, CreateAssistantRequest, ScheduleStorage, ScheduledTaskDefinition, ScheduledTaskStatus, ScheduleExecutionType, SkillStore, Skill, CreateSkillRequest, 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, ChannelInstallationStore, ChannelInstallation, CreateChannelInstallationRequest, UpdateChannelInstallationRequest } from '@axiom-lattice/protocols';
|
|
4
|
-
export { Assistant, AssistantStore, ChannelInstallation, ChannelInstallationStore, CreateAssistantRequest, CreateChannelInstallationRequest, CreateDatabaseConfigRequest, CreateMcpServerConfigRequest, CreateMetricsServerConfigRequest, CreateProjectRequest, CreateSkillRequest, CreateTenantRequest, CreateThreadRequest, CreateUserRequest, CreateUserTenantLinkRequest, CreateWorkspaceRequest, DatabaseConfig, DatabaseConfigEntry, DatabaseConfigStore, DatabaseType, LarkChannelInstallationConfig, McpServerConfigEntry, McpServerConfigStore, MetricsServerConfig, MetricsServerConfigEntry, MetricsServerConfigStore, Project, ProjectStore, ScheduleExecutionType, ScheduleStorage, ScheduledTaskDefinition, ScheduledTaskStatus, Skill, SkillStore, StorageType, Tenant, TenantStatus, TenantStore, Thread, ThreadStore, UpdateChannelInstallationRequest, UpdateDatabaseConfigRequest, UpdateMcpServerConfigRequest, UpdateMetricsServerConfigRequest, UpdateProjectRequest, UpdateTenantRequest, UpdateUserRequest, UpdateUserTenantLinkRequest, UpdateWorkspaceRequest, User, UserStore, UserTenantLink, UserTenantLinkStore, UserTenantRole, Workspace, WorkspaceStore } from '@axiom-lattice/protocols';
|
|
3
|
+
import { ThreadStore, Thread, CreateThreadRequest, AssistantStore, Assistant, CreateAssistantRequest, ScheduleStorage, ScheduledTaskDefinition, ScheduledTaskStatus, ScheduleExecutionType, SkillStore, Skill, CreateSkillRequest, 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, ChannelInstallationStore, ChannelInstallation, CreateChannelInstallationRequest, UpdateChannelInstallationRequest, WorkflowTrackingStore, CreateWorkflowRunRequest, WorkflowRun, UpdateWorkflowRunRequest, CreateRunStepRequest, RunStep, UpdateRunStepRequest, StepType } from '@axiom-lattice/protocols';
|
|
4
|
+
export { Assistant, AssistantStore, ChannelInstallation, ChannelInstallationStore, CreateAssistantRequest, CreateChannelInstallationRequest, CreateDatabaseConfigRequest, CreateMcpServerConfigRequest, CreateMetricsServerConfigRequest, CreateProjectRequest, CreateRunStepRequest, CreateSkillRequest, CreateTenantRequest, CreateThreadRequest, CreateUserRequest, CreateUserTenantLinkRequest, CreateWorkflowRunRequest, CreateWorkspaceRequest, DatabaseConfig, DatabaseConfigEntry, DatabaseConfigStore, DatabaseType, 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';
|
|
7
7
|
|
|
@@ -1090,6 +1090,12 @@ declare const createChannelIdentityMappingTables: Migration;
|
|
|
1090
1090
|
|
|
1091
1091
|
declare const createChannelInstallationsTable: Migration;
|
|
1092
1092
|
|
|
1093
|
+
/**
|
|
1094
|
+
* PostgreSQL migrations for workflow tracking tables
|
|
1095
|
+
*/
|
|
1096
|
+
|
|
1097
|
+
declare const createWorkflowTrackingTables: Migration;
|
|
1098
|
+
|
|
1093
1099
|
/**
|
|
1094
1100
|
* Thread Message Queue Store
|
|
1095
1101
|
*
|
|
@@ -1259,4 +1265,36 @@ declare class PostgreSQLChannelInstallationStore implements ChannelInstallationS
|
|
|
1259
1265
|
private decryptSecrets;
|
|
1260
1266
|
}
|
|
1261
1267
|
|
|
1262
|
-
|
|
1268
|
+
/**
|
|
1269
|
+
* PostgreSQL implementation of WorkflowTrackingStore
|
|
1270
|
+
*/
|
|
1271
|
+
|
|
1272
|
+
interface PostgreSQLWorkflowTrackingStoreOptions {
|
|
1273
|
+
poolConfig: string | PoolConfig;
|
|
1274
|
+
autoMigrate?: boolean;
|
|
1275
|
+
}
|
|
1276
|
+
declare class PostgreSQLWorkflowTrackingStore implements WorkflowTrackingStore {
|
|
1277
|
+
private pool;
|
|
1278
|
+
private migrationManager;
|
|
1279
|
+
private initialized;
|
|
1280
|
+
private initPromise;
|
|
1281
|
+
constructor(options: PostgreSQLWorkflowTrackingStoreOptions);
|
|
1282
|
+
dispose(): Promise<void>;
|
|
1283
|
+
initialize(): Promise<void>;
|
|
1284
|
+
private ensureInitialized;
|
|
1285
|
+
createWorkflowRun(request: CreateWorkflowRunRequest): Promise<WorkflowRun>;
|
|
1286
|
+
getWorkflowRun(runId: string): Promise<WorkflowRun | null>;
|
|
1287
|
+
updateWorkflowRun(runId: string, updates: UpdateWorkflowRunRequest): Promise<WorkflowRun | null>;
|
|
1288
|
+
getWorkflowRunsByThreadId(tenantId: string, threadId: string): Promise<WorkflowRun[]>;
|
|
1289
|
+
getWorkflowRunsByAssistantId(tenantId: string, assistantId: string): Promise<WorkflowRun[]>;
|
|
1290
|
+
getWorkflowRunsByTenantId(tenantId: string): Promise<WorkflowRun[]>;
|
|
1291
|
+
createRunStep(request: CreateRunStepRequest): Promise<RunStep>;
|
|
1292
|
+
updateRunStep(runId: string, stepId: string, updates: UpdateRunStepRequest): Promise<RunStep | null>;
|
|
1293
|
+
getRunSteps(runId: string): Promise<RunStep[]>;
|
|
1294
|
+
getRunStepsByType(runId: string, stepType: StepType): Promise<RunStep[]>;
|
|
1295
|
+
getInterruptedSteps(runId: string): Promise<RunStep[]>;
|
|
1296
|
+
private mapRowToWorkflowRun;
|
|
1297
|
+
private mapRowToRunStep;
|
|
1298
|
+
}
|
|
1299
|
+
|
|
1300
|
+
export { type ChannelIdentityMapping, ChannelIdentityMappingStore, type ChannelIdentityMappingStoreOptions, type CreateChannelIdentityMappingInput, type Migration, MigrationManager, PostgreSQLAssistantStore, type PostgreSQLAssistantStoreOptions, PostgreSQLChannelInstallationStore, type PostgreSQLChannelInstallationStoreOptions, PostgreSQLDatabaseConfigStore, type PostgreSQLDatabaseConfigStoreOptions, 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, changeAssistantPrimaryKey, changeSkillPrimaryKey, changeThreadPrimaryKey, createAssistantsTable, createChannelIdentityMappingTables, createChannelInstallationsTable, createDatabaseConfigsTable, createMcpServerConfigsTable, createMetricsConfigsTable, createProjectsTable, createScheduledTasksTable, createSkillsTable, createTenantsTable, createThreadMessageQueueTable, createThreadsTable, createUsersTable, createWorkflowTrackingTables, createWorkspacesTable, getThreadMessageQueueStore };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { PoolConfig, PoolClient, Pool } from 'pg';
|
|
2
2
|
export { Pool, PoolConfig } from 'pg';
|
|
3
|
-
import { ThreadStore, Thread, CreateThreadRequest, AssistantStore, Assistant, CreateAssistantRequest, ScheduleStorage, ScheduledTaskDefinition, ScheduledTaskStatus, ScheduleExecutionType, SkillStore, Skill, CreateSkillRequest, 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, ChannelInstallationStore, ChannelInstallation, CreateChannelInstallationRequest, UpdateChannelInstallationRequest } from '@axiom-lattice/protocols';
|
|
4
|
-
export { Assistant, AssistantStore, ChannelInstallation, ChannelInstallationStore, CreateAssistantRequest, CreateChannelInstallationRequest, CreateDatabaseConfigRequest, CreateMcpServerConfigRequest, CreateMetricsServerConfigRequest, CreateProjectRequest, CreateSkillRequest, CreateTenantRequest, CreateThreadRequest, CreateUserRequest, CreateUserTenantLinkRequest, CreateWorkspaceRequest, DatabaseConfig, DatabaseConfigEntry, DatabaseConfigStore, DatabaseType, LarkChannelInstallationConfig, McpServerConfigEntry, McpServerConfigStore, MetricsServerConfig, MetricsServerConfigEntry, MetricsServerConfigStore, Project, ProjectStore, ScheduleExecutionType, ScheduleStorage, ScheduledTaskDefinition, ScheduledTaskStatus, Skill, SkillStore, StorageType, Tenant, TenantStatus, TenantStore, Thread, ThreadStore, UpdateChannelInstallationRequest, UpdateDatabaseConfigRequest, UpdateMcpServerConfigRequest, UpdateMetricsServerConfigRequest, UpdateProjectRequest, UpdateTenantRequest, UpdateUserRequest, UpdateUserTenantLinkRequest, UpdateWorkspaceRequest, User, UserStore, UserTenantLink, UserTenantLinkStore, UserTenantRole, Workspace, WorkspaceStore } from '@axiom-lattice/protocols';
|
|
3
|
+
import { ThreadStore, Thread, CreateThreadRequest, AssistantStore, Assistant, CreateAssistantRequest, ScheduleStorage, ScheduledTaskDefinition, ScheduledTaskStatus, ScheduleExecutionType, SkillStore, Skill, CreateSkillRequest, 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, ChannelInstallationStore, ChannelInstallation, CreateChannelInstallationRequest, UpdateChannelInstallationRequest, WorkflowTrackingStore, CreateWorkflowRunRequest, WorkflowRun, UpdateWorkflowRunRequest, CreateRunStepRequest, RunStep, UpdateRunStepRequest, StepType } from '@axiom-lattice/protocols';
|
|
4
|
+
export { Assistant, AssistantStore, ChannelInstallation, ChannelInstallationStore, CreateAssistantRequest, CreateChannelInstallationRequest, CreateDatabaseConfigRequest, CreateMcpServerConfigRequest, CreateMetricsServerConfigRequest, CreateProjectRequest, CreateRunStepRequest, CreateSkillRequest, CreateTenantRequest, CreateThreadRequest, CreateUserRequest, CreateUserTenantLinkRequest, CreateWorkflowRunRequest, CreateWorkspaceRequest, DatabaseConfig, DatabaseConfigEntry, DatabaseConfigStore, DatabaseType, 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';
|
|
7
7
|
|
|
@@ -1090,6 +1090,12 @@ declare const createChannelIdentityMappingTables: Migration;
|
|
|
1090
1090
|
|
|
1091
1091
|
declare const createChannelInstallationsTable: Migration;
|
|
1092
1092
|
|
|
1093
|
+
/**
|
|
1094
|
+
* PostgreSQL migrations for workflow tracking tables
|
|
1095
|
+
*/
|
|
1096
|
+
|
|
1097
|
+
declare const createWorkflowTrackingTables: Migration;
|
|
1098
|
+
|
|
1093
1099
|
/**
|
|
1094
1100
|
* Thread Message Queue Store
|
|
1095
1101
|
*
|
|
@@ -1259,4 +1265,36 @@ declare class PostgreSQLChannelInstallationStore implements ChannelInstallationS
|
|
|
1259
1265
|
private decryptSecrets;
|
|
1260
1266
|
}
|
|
1261
1267
|
|
|
1262
|
-
|
|
1268
|
+
/**
|
|
1269
|
+
* PostgreSQL implementation of WorkflowTrackingStore
|
|
1270
|
+
*/
|
|
1271
|
+
|
|
1272
|
+
interface PostgreSQLWorkflowTrackingStoreOptions {
|
|
1273
|
+
poolConfig: string | PoolConfig;
|
|
1274
|
+
autoMigrate?: boolean;
|
|
1275
|
+
}
|
|
1276
|
+
declare class PostgreSQLWorkflowTrackingStore implements WorkflowTrackingStore {
|
|
1277
|
+
private pool;
|
|
1278
|
+
private migrationManager;
|
|
1279
|
+
private initialized;
|
|
1280
|
+
private initPromise;
|
|
1281
|
+
constructor(options: PostgreSQLWorkflowTrackingStoreOptions);
|
|
1282
|
+
dispose(): Promise<void>;
|
|
1283
|
+
initialize(): Promise<void>;
|
|
1284
|
+
private ensureInitialized;
|
|
1285
|
+
createWorkflowRun(request: CreateWorkflowRunRequest): Promise<WorkflowRun>;
|
|
1286
|
+
getWorkflowRun(runId: string): Promise<WorkflowRun | null>;
|
|
1287
|
+
updateWorkflowRun(runId: string, updates: UpdateWorkflowRunRequest): Promise<WorkflowRun | null>;
|
|
1288
|
+
getWorkflowRunsByThreadId(tenantId: string, threadId: string): Promise<WorkflowRun[]>;
|
|
1289
|
+
getWorkflowRunsByAssistantId(tenantId: string, assistantId: string): Promise<WorkflowRun[]>;
|
|
1290
|
+
getWorkflowRunsByTenantId(tenantId: string): Promise<WorkflowRun[]>;
|
|
1291
|
+
createRunStep(request: CreateRunStepRequest): Promise<RunStep>;
|
|
1292
|
+
updateRunStep(runId: string, stepId: string, updates: UpdateRunStepRequest): Promise<RunStep | null>;
|
|
1293
|
+
getRunSteps(runId: string): Promise<RunStep[]>;
|
|
1294
|
+
getRunStepsByType(runId: string, stepType: StepType): Promise<RunStep[]>;
|
|
1295
|
+
getInterruptedSteps(runId: string): Promise<RunStep[]>;
|
|
1296
|
+
private mapRowToWorkflowRun;
|
|
1297
|
+
private mapRowToRunStep;
|
|
1298
|
+
}
|
|
1299
|
+
|
|
1300
|
+
export { type ChannelIdentityMapping, ChannelIdentityMappingStore, type ChannelIdentityMappingStoreOptions, type CreateChannelIdentityMappingInput, type Migration, MigrationManager, PostgreSQLAssistantStore, type PostgreSQLAssistantStoreOptions, PostgreSQLChannelInstallationStore, type PostgreSQLChannelInstallationStoreOptions, PostgreSQLDatabaseConfigStore, type PostgreSQLDatabaseConfigStoreOptions, 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, changeAssistantPrimaryKey, changeSkillPrimaryKey, changeThreadPrimaryKey, createAssistantsTable, createChannelIdentityMappingTables, createChannelInstallationsTable, createDatabaseConfigsTable, createMcpServerConfigsTable, createMetricsConfigsTable, createProjectsTable, createScheduledTasksTable, createSkillsTable, createTenantsTable, createThreadMessageQueueTable, createThreadsTable, createUsersTable, createWorkflowTrackingTables, createWorkspacesTable, getThreadMessageQueueStore };
|
package/dist/index.js
CHANGED
|
@@ -32,7 +32,7 @@ var index_exports = {};
|
|
|
32
32
|
__export(index_exports, {
|
|
33
33
|
ChannelIdentityMappingStore: () => ChannelIdentityMappingStore,
|
|
34
34
|
MigrationManager: () => MigrationManager,
|
|
35
|
-
Pool: () =>
|
|
35
|
+
Pool: () => import_pg16.Pool,
|
|
36
36
|
PostgreSQLAssistantStore: () => PostgreSQLAssistantStore,
|
|
37
37
|
PostgreSQLChannelInstallationStore: () => PostgreSQLChannelInstallationStore,
|
|
38
38
|
PostgreSQLDatabaseConfigStore: () => PostgreSQLDatabaseConfigStore,
|
|
@@ -45,6 +45,7 @@ __export(index_exports, {
|
|
|
45
45
|
PostgreSQLThreadStore: () => PostgreSQLThreadStore,
|
|
46
46
|
PostgreSQLUserStore: () => PostgreSQLUserStore,
|
|
47
47
|
PostgreSQLUserTenantLinkStore: () => PostgreSQLUserTenantLinkStore,
|
|
48
|
+
PostgreSQLWorkflowTrackingStore: () => PostgreSQLWorkflowTrackingStore,
|
|
48
49
|
PostgreSQLWorkspaceStore: () => PostgreSQLWorkspaceStore,
|
|
49
50
|
ThreadMessageQueueStore: () => ThreadMessageQueueStore,
|
|
50
51
|
addAssistantTenantId: () => addAssistantTenantId,
|
|
@@ -67,11 +68,12 @@ __export(index_exports, {
|
|
|
67
68
|
createThreadMessageQueueTable: () => createThreadMessageQueueTable,
|
|
68
69
|
createThreadsTable: () => createThreadsTable,
|
|
69
70
|
createUsersTable: () => createUsersTable,
|
|
71
|
+
createWorkflowTrackingTables: () => createWorkflowTrackingTables,
|
|
70
72
|
createWorkspacesTable: () => createWorkspacesTable,
|
|
71
73
|
getThreadMessageQueueStore: () => getThreadMessageQueueStore
|
|
72
74
|
});
|
|
73
75
|
module.exports = __toCommonJS(index_exports);
|
|
74
|
-
var
|
|
76
|
+
var import_pg16 = require("pg");
|
|
75
77
|
|
|
76
78
|
// src/stores/PostgreSQLThreadStore.ts
|
|
77
79
|
var import_pg = require("pg");
|
|
@@ -4168,6 +4170,79 @@ var createChannelInstallationsTable = {
|
|
|
4168
4170
|
}
|
|
4169
4171
|
};
|
|
4170
4172
|
|
|
4173
|
+
// src/migrations/workflow_tracking_migrations.ts
|
|
4174
|
+
var createWorkflowTrackingTables = {
|
|
4175
|
+
name: "create_workflow_tracking_tables",
|
|
4176
|
+
version: 103,
|
|
4177
|
+
up: async (client) => {
|
|
4178
|
+
await client.query(`
|
|
4179
|
+
CREATE TABLE IF NOT EXISTS lattice_workflow_runs (
|
|
4180
|
+
id VARCHAR(255) PRIMARY KEY,
|
|
4181
|
+
tenant_id VARCHAR(255) NOT NULL,
|
|
4182
|
+
assistant_id VARCHAR(255) NOT NULL,
|
|
4183
|
+
thread_id VARCHAR(255) NOT NULL,
|
|
4184
|
+
status VARCHAR(50) NOT NULL DEFAULT 'running',
|
|
4185
|
+
topology_edges JSONB NOT NULL DEFAULT '[]',
|
|
4186
|
+
total_edges INTEGER NOT NULL DEFAULT 0,
|
|
4187
|
+
completed_edges INTEGER NOT NULL DEFAULT 0,
|
|
4188
|
+
error_message TEXT,
|
|
4189
|
+
metadata JSONB DEFAULT '{}',
|
|
4190
|
+
started_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
|
4191
|
+
completed_at TIMESTAMPTZ,
|
|
4192
|
+
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
|
4193
|
+
updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
|
|
4194
|
+
);
|
|
4195
|
+
|
|
4196
|
+
CREATE TABLE IF NOT EXISTS lattice_workflow_steps (
|
|
4197
|
+
id VARCHAR(255) NOT NULL,
|
|
4198
|
+
run_id VARCHAR(255) NOT NULL REFERENCES lattice_workflow_runs(id) ON DELETE CASCADE,
|
|
4199
|
+
tenant_id VARCHAR(255) NOT NULL,
|
|
4200
|
+
step_type VARCHAR(50) NOT NULL,
|
|
4201
|
+
step_name VARCHAR(255) NOT NULL,
|
|
4202
|
+
edge_from VARCHAR(255),
|
|
4203
|
+
edge_to VARCHAR(255),
|
|
4204
|
+
edge_purpose TEXT,
|
|
4205
|
+
input JSONB,
|
|
4206
|
+
output JSONB,
|
|
4207
|
+
status VARCHAR(50) NOT NULL DEFAULT 'running',
|
|
4208
|
+
error_message TEXT,
|
|
4209
|
+
started_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
|
4210
|
+
completed_at TIMESTAMPTZ,
|
|
4211
|
+
duration_ms INTEGER,
|
|
4212
|
+
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
|
4213
|
+
updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
|
4214
|
+
PRIMARY KEY (id, run_id)
|
|
4215
|
+
);
|
|
4216
|
+
|
|
4217
|
+
CREATE INDEX IF NOT EXISTS idx_workflow_runs_tenant
|
|
4218
|
+
ON lattice_workflow_runs (tenant_id);
|
|
4219
|
+
CREATE INDEX IF NOT EXISTS idx_workflow_runs_thread
|
|
4220
|
+
ON lattice_workflow_runs (tenant_id, thread_id);
|
|
4221
|
+
CREATE INDEX IF NOT EXISTS idx_workflow_runs_assistant
|
|
4222
|
+
ON lattice_workflow_runs (tenant_id, assistant_id);
|
|
4223
|
+
CREATE INDEX IF NOT EXISTS idx_workflow_runs_status
|
|
4224
|
+
ON lattice_workflow_runs (status);
|
|
4225
|
+
|
|
4226
|
+
CREATE INDEX IF NOT EXISTS idx_workflow_steps_run
|
|
4227
|
+
ON lattice_workflow_steps (run_id);
|
|
4228
|
+
CREATE INDEX IF NOT EXISTS idx_workflow_steps_type_status
|
|
4229
|
+
ON lattice_workflow_steps (run_id, step_type, status);
|
|
4230
|
+
`);
|
|
4231
|
+
},
|
|
4232
|
+
down: async (client) => {
|
|
4233
|
+
await client.query(`
|
|
4234
|
+
DROP INDEX IF EXISTS idx_workflow_steps_type_status;
|
|
4235
|
+
DROP INDEX IF EXISTS idx_workflow_steps_run;
|
|
4236
|
+
DROP INDEX IF EXISTS idx_workflow_runs_status;
|
|
4237
|
+
DROP INDEX IF EXISTS idx_workflow_runs_assistant;
|
|
4238
|
+
DROP INDEX IF EXISTS idx_workflow_runs_thread;
|
|
4239
|
+
DROP INDEX IF EXISTS idx_workflow_runs_tenant;
|
|
4240
|
+
DROP TABLE IF EXISTS lattice_workflow_steps;
|
|
4241
|
+
DROP TABLE IF EXISTS lattice_workflow_runs;
|
|
4242
|
+
`);
|
|
4243
|
+
}
|
|
4244
|
+
};
|
|
4245
|
+
|
|
4171
4246
|
// src/stores/ThreadMessageQueueStore.ts
|
|
4172
4247
|
var import_crypto = __toESM(require("crypto"));
|
|
4173
4248
|
|
|
@@ -4863,6 +4938,281 @@ var PostgreSQLChannelInstallationStore = class {
|
|
|
4863
4938
|
};
|
|
4864
4939
|
}
|
|
4865
4940
|
};
|
|
4941
|
+
|
|
4942
|
+
// src/stores/PostgreSQLWorkflowTrackingStore.ts
|
|
4943
|
+
var import_pg15 = require("pg");
|
|
4944
|
+
var PostgreSQLWorkflowTrackingStore = class {
|
|
4945
|
+
constructor(options) {
|
|
4946
|
+
this.initialized = false;
|
|
4947
|
+
this.initPromise = null;
|
|
4948
|
+
if (typeof options.poolConfig === "string") {
|
|
4949
|
+
this.pool = new import_pg15.Pool({ connectionString: options.poolConfig });
|
|
4950
|
+
} else {
|
|
4951
|
+
this.pool = new import_pg15.Pool(options.poolConfig);
|
|
4952
|
+
}
|
|
4953
|
+
this.migrationManager = new MigrationManager(this.pool);
|
|
4954
|
+
this.migrationManager.register(createWorkflowTrackingTables);
|
|
4955
|
+
if (options.autoMigrate !== false) {
|
|
4956
|
+
this.initialize().catch((error) => {
|
|
4957
|
+
console.error("Failed to initialize PostgreSQLWorkflowTrackingStore:", error);
|
|
4958
|
+
throw error;
|
|
4959
|
+
});
|
|
4960
|
+
}
|
|
4961
|
+
}
|
|
4962
|
+
async dispose() {
|
|
4963
|
+
await this.pool.end();
|
|
4964
|
+
}
|
|
4965
|
+
async initialize() {
|
|
4966
|
+
if (this.initialized) return;
|
|
4967
|
+
if (this.initPromise) return this.initPromise;
|
|
4968
|
+
this.initPromise = (async () => {
|
|
4969
|
+
try {
|
|
4970
|
+
await this.migrationManager.migrate();
|
|
4971
|
+
this.initialized = true;
|
|
4972
|
+
} finally {
|
|
4973
|
+
this.initPromise = null;
|
|
4974
|
+
}
|
|
4975
|
+
})();
|
|
4976
|
+
return this.initPromise;
|
|
4977
|
+
}
|
|
4978
|
+
async ensureInitialized() {
|
|
4979
|
+
if (!this.initialized) await this.initialize();
|
|
4980
|
+
}
|
|
4981
|
+
async createWorkflowRun(request) {
|
|
4982
|
+
await this.ensureInitialized();
|
|
4983
|
+
const now = /* @__PURE__ */ new Date();
|
|
4984
|
+
const id = `${request.threadId}_${Date.now()}`;
|
|
4985
|
+
await this.pool.query(
|
|
4986
|
+
`INSERT INTO lattice_workflow_runs (id, tenant_id, assistant_id, thread_id, status, topology_edges, total_edges, completed_edges, metadata, started_at, created_at, updated_at)
|
|
4987
|
+
VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12)`,
|
|
4988
|
+
[
|
|
4989
|
+
id,
|
|
4990
|
+
request.tenantId,
|
|
4991
|
+
request.assistantId,
|
|
4992
|
+
request.threadId,
|
|
4993
|
+
"running",
|
|
4994
|
+
JSON.stringify(request.topologyEdges),
|
|
4995
|
+
request.topologyEdges.length,
|
|
4996
|
+
0,
|
|
4997
|
+
JSON.stringify(request.metadata || {}),
|
|
4998
|
+
now,
|
|
4999
|
+
now,
|
|
5000
|
+
now
|
|
5001
|
+
]
|
|
5002
|
+
);
|
|
5003
|
+
return {
|
|
5004
|
+
id,
|
|
5005
|
+
status: "running",
|
|
5006
|
+
startedAt: now,
|
|
5007
|
+
completedAt: void 0,
|
|
5008
|
+
...request,
|
|
5009
|
+
completedEdges: 0,
|
|
5010
|
+
totalEdges: request.topologyEdges.length,
|
|
5011
|
+
createdAt: now,
|
|
5012
|
+
updatedAt: now
|
|
5013
|
+
};
|
|
5014
|
+
}
|
|
5015
|
+
async getWorkflowRun(runId) {
|
|
5016
|
+
await this.ensureInitialized();
|
|
5017
|
+
const result = await this.pool.query(
|
|
5018
|
+
`SELECT * FROM lattice_workflow_runs WHERE id = $1`,
|
|
5019
|
+
[runId]
|
|
5020
|
+
);
|
|
5021
|
+
if (result.rows.length === 0) return null;
|
|
5022
|
+
return this.mapRowToWorkflowRun(result.rows[0]);
|
|
5023
|
+
}
|
|
5024
|
+
async updateWorkflowRun(runId, updates) {
|
|
5025
|
+
await this.ensureInitialized();
|
|
5026
|
+
const now = /* @__PURE__ */ new Date();
|
|
5027
|
+
const setClauses = ["updated_at = $2"];
|
|
5028
|
+
const values = [runId, now];
|
|
5029
|
+
let paramIdx = 3;
|
|
5030
|
+
if (updates.status !== void 0) {
|
|
5031
|
+
setClauses.push(`status = $${paramIdx++}`);
|
|
5032
|
+
values.push(updates.status);
|
|
5033
|
+
}
|
|
5034
|
+
if (updates.completedEdges !== void 0) {
|
|
5035
|
+
setClauses.push(`completed_edges = $${paramIdx++}`);
|
|
5036
|
+
values.push(updates.completedEdges);
|
|
5037
|
+
}
|
|
5038
|
+
if (updates.errorMessage !== void 0) {
|
|
5039
|
+
setClauses.push(`error_message = $${paramIdx++}`);
|
|
5040
|
+
values.push(updates.errorMessage);
|
|
5041
|
+
}
|
|
5042
|
+
if (updates.completedAt !== void 0) {
|
|
5043
|
+
setClauses.push(`completed_at = $${paramIdx++}`);
|
|
5044
|
+
values.push(updates.completedAt);
|
|
5045
|
+
}
|
|
5046
|
+
if (updates.metadata !== void 0) {
|
|
5047
|
+
setClauses.push(`metadata = $${paramIdx++}`);
|
|
5048
|
+
values.push(JSON.stringify(updates.metadata));
|
|
5049
|
+
}
|
|
5050
|
+
const query = `UPDATE lattice_workflow_runs SET ${setClauses.join(", ")} WHERE id = $1`;
|
|
5051
|
+
await this.pool.query(query, values);
|
|
5052
|
+
return this.getWorkflowRun(runId);
|
|
5053
|
+
}
|
|
5054
|
+
async getWorkflowRunsByThreadId(tenantId, threadId) {
|
|
5055
|
+
await this.ensureInitialized();
|
|
5056
|
+
const result = await this.pool.query(
|
|
5057
|
+
`SELECT * FROM lattice_workflow_runs WHERE tenant_id = $1 AND thread_id = $2 ORDER BY created_at DESC`,
|
|
5058
|
+
[tenantId, threadId]
|
|
5059
|
+
);
|
|
5060
|
+
return result.rows.map(this.mapRowToWorkflowRun);
|
|
5061
|
+
}
|
|
5062
|
+
async getWorkflowRunsByAssistantId(tenantId, assistantId) {
|
|
5063
|
+
await this.ensureInitialized();
|
|
5064
|
+
const result = await this.pool.query(
|
|
5065
|
+
`SELECT * FROM lattice_workflow_runs WHERE tenant_id = $1 AND assistant_id = $2 ORDER BY created_at DESC`,
|
|
5066
|
+
[tenantId, assistantId]
|
|
5067
|
+
);
|
|
5068
|
+
return result.rows.map(this.mapRowToWorkflowRun);
|
|
5069
|
+
}
|
|
5070
|
+
async getWorkflowRunsByTenantId(tenantId) {
|
|
5071
|
+
await this.ensureInitialized();
|
|
5072
|
+
const result = await this.pool.query(
|
|
5073
|
+
`SELECT * FROM lattice_workflow_runs WHERE tenant_id = $1 ORDER BY created_at DESC`,
|
|
5074
|
+
[tenantId]
|
|
5075
|
+
);
|
|
5076
|
+
return result.rows.map(this.mapRowToWorkflowRun);
|
|
5077
|
+
}
|
|
5078
|
+
async createRunStep(request) {
|
|
5079
|
+
await this.ensureInitialized();
|
|
5080
|
+
const now = /* @__PURE__ */ new Date();
|
|
5081
|
+
const id = `step_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`;
|
|
5082
|
+
await this.pool.query(
|
|
5083
|
+
`INSERT INTO lattice_workflow_steps (id, run_id, tenant_id, step_type, step_name, edge_from, edge_to, edge_purpose, input, status, started_at, created_at, updated_at)
|
|
5084
|
+
VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13)`,
|
|
5085
|
+
[
|
|
5086
|
+
id,
|
|
5087
|
+
request.runId,
|
|
5088
|
+
request.tenantId,
|
|
5089
|
+
request.stepType,
|
|
5090
|
+
request.stepName,
|
|
5091
|
+
request.edgeFrom || null,
|
|
5092
|
+
request.edgeTo || null,
|
|
5093
|
+
request.edgePurpose || null,
|
|
5094
|
+
request.input ? JSON.stringify(request.input) : null,
|
|
5095
|
+
"running",
|
|
5096
|
+
now,
|
|
5097
|
+
now,
|
|
5098
|
+
now
|
|
5099
|
+
]
|
|
5100
|
+
);
|
|
5101
|
+
return {
|
|
5102
|
+
id,
|
|
5103
|
+
runId: request.runId,
|
|
5104
|
+
tenantId: request.tenantId,
|
|
5105
|
+
stepType: request.stepType,
|
|
5106
|
+
stepName: request.stepName,
|
|
5107
|
+
edgeFrom: request.edgeFrom,
|
|
5108
|
+
edgeTo: request.edgeTo,
|
|
5109
|
+
edgePurpose: request.edgePurpose,
|
|
5110
|
+
input: request.input,
|
|
5111
|
+
status: "running",
|
|
5112
|
+
startedAt: now,
|
|
5113
|
+
createdAt: now,
|
|
5114
|
+
updatedAt: now
|
|
5115
|
+
};
|
|
5116
|
+
}
|
|
5117
|
+
async updateRunStep(runId, stepId, updates) {
|
|
5118
|
+
await this.ensureInitialized();
|
|
5119
|
+
const now = /* @__PURE__ */ new Date();
|
|
5120
|
+
const setClauses = ["updated_at = $3"];
|
|
5121
|
+
const values = [runId, stepId, now];
|
|
5122
|
+
let paramIdx = 4;
|
|
5123
|
+
if (updates.status !== void 0) {
|
|
5124
|
+
setClauses.push(`status = $${paramIdx++}`);
|
|
5125
|
+
values.push(updates.status);
|
|
5126
|
+
}
|
|
5127
|
+
if (updates.output !== void 0) {
|
|
5128
|
+
setClauses.push(`output = $${paramIdx++}`);
|
|
5129
|
+
values.push(JSON.stringify(updates.output));
|
|
5130
|
+
}
|
|
5131
|
+
if (updates.errorMessage !== void 0) {
|
|
5132
|
+
setClauses.push(`error_message = $${paramIdx++}`);
|
|
5133
|
+
values.push(updates.errorMessage);
|
|
5134
|
+
}
|
|
5135
|
+
if (updates.completedAt !== void 0) {
|
|
5136
|
+
setClauses.push(`completed_at = $${paramIdx++}`);
|
|
5137
|
+
values.push(updates.completedAt);
|
|
5138
|
+
}
|
|
5139
|
+
if (updates.durationMs !== void 0) {
|
|
5140
|
+
setClauses.push(`duration_ms = $${paramIdx++}`);
|
|
5141
|
+
values.push(updates.durationMs);
|
|
5142
|
+
}
|
|
5143
|
+
const query = `UPDATE lattice_workflow_steps SET ${setClauses.join(", ")} WHERE run_id = $1 AND id = $2`;
|
|
5144
|
+
const result = await this.pool.query(query, values);
|
|
5145
|
+
if (result.rowCount === 0) return null;
|
|
5146
|
+
const row = await this.pool.query(
|
|
5147
|
+
`SELECT * FROM lattice_workflow_steps WHERE run_id = $1 AND id = $2`,
|
|
5148
|
+
[runId, stepId]
|
|
5149
|
+
);
|
|
5150
|
+
return row.rows.length > 0 ? this.mapRowToRunStep(row.rows[0]) : null;
|
|
5151
|
+
}
|
|
5152
|
+
async getRunSteps(runId) {
|
|
5153
|
+
await this.ensureInitialized();
|
|
5154
|
+
const result = await this.pool.query(
|
|
5155
|
+
`SELECT * FROM lattice_workflow_steps WHERE run_id = $1 ORDER BY created_at ASC`,
|
|
5156
|
+
[runId]
|
|
5157
|
+
);
|
|
5158
|
+
return result.rows.map(this.mapRowToRunStep);
|
|
5159
|
+
}
|
|
5160
|
+
async getRunStepsByType(runId, stepType) {
|
|
5161
|
+
await this.ensureInitialized();
|
|
5162
|
+
const result = await this.pool.query(
|
|
5163
|
+
`SELECT * FROM lattice_workflow_steps WHERE run_id = $1 AND step_type = $2 ORDER BY created_at ASC`,
|
|
5164
|
+
[runId, stepType]
|
|
5165
|
+
);
|
|
5166
|
+
return result.rows.map(this.mapRowToRunStep);
|
|
5167
|
+
}
|
|
5168
|
+
async getInterruptedSteps(runId) {
|
|
5169
|
+
await this.ensureInitialized();
|
|
5170
|
+
const result = await this.pool.query(
|
|
5171
|
+
`SELECT * FROM lattice_workflow_steps WHERE run_id = $1 AND status = 'interrupted' ORDER BY created_at ASC`,
|
|
5172
|
+
[runId]
|
|
5173
|
+
);
|
|
5174
|
+
return result.rows.map(this.mapRowToRunStep);
|
|
5175
|
+
}
|
|
5176
|
+
mapRowToWorkflowRun(row) {
|
|
5177
|
+
return {
|
|
5178
|
+
id: row.id,
|
|
5179
|
+
tenantId: row.tenant_id,
|
|
5180
|
+
assistantId: row.assistant_id,
|
|
5181
|
+
threadId: row.thread_id,
|
|
5182
|
+
status: row.status,
|
|
5183
|
+
topologyEdges: typeof row.topology_edges === "string" ? JSON.parse(row.topology_edges) : row.topology_edges || [],
|
|
5184
|
+
totalEdges: row.total_edges,
|
|
5185
|
+
completedEdges: row.completed_edges,
|
|
5186
|
+
errorMessage: row.error_message,
|
|
5187
|
+
metadata: typeof row.metadata === "string" ? JSON.parse(row.metadata) : row.metadata || {},
|
|
5188
|
+
startedAt: row.started_at,
|
|
5189
|
+
completedAt: row.completed_at,
|
|
5190
|
+
createdAt: row.created_at,
|
|
5191
|
+
updatedAt: row.updated_at
|
|
5192
|
+
};
|
|
5193
|
+
}
|
|
5194
|
+
mapRowToRunStep(row) {
|
|
5195
|
+
return {
|
|
5196
|
+
id: row.id,
|
|
5197
|
+
runId: row.run_id,
|
|
5198
|
+
tenantId: row.tenant_id,
|
|
5199
|
+
stepType: row.step_type,
|
|
5200
|
+
stepName: row.step_name,
|
|
5201
|
+
edgeFrom: row.edge_from,
|
|
5202
|
+
edgeTo: row.edge_to,
|
|
5203
|
+
edgePurpose: row.edge_purpose,
|
|
5204
|
+
input: typeof row.input === "string" ? JSON.parse(row.input) : row.input,
|
|
5205
|
+
output: typeof row.output === "string" ? JSON.parse(row.output) : row.output,
|
|
5206
|
+
status: row.status,
|
|
5207
|
+
errorMessage: row.error_message,
|
|
5208
|
+
startedAt: row.started_at,
|
|
5209
|
+
completedAt: row.completed_at,
|
|
5210
|
+
durationMs: row.duration_ms,
|
|
5211
|
+
createdAt: row.created_at,
|
|
5212
|
+
updatedAt: row.updated_at
|
|
5213
|
+
};
|
|
5214
|
+
}
|
|
5215
|
+
};
|
|
4866
5216
|
// Annotate the CommonJS export names for ESM import in node:
|
|
4867
5217
|
0 && (module.exports = {
|
|
4868
5218
|
ChannelIdentityMappingStore,
|
|
@@ -4880,6 +5230,7 @@ var PostgreSQLChannelInstallationStore = class {
|
|
|
4880
5230
|
PostgreSQLThreadStore,
|
|
4881
5231
|
PostgreSQLUserStore,
|
|
4882
5232
|
PostgreSQLUserTenantLinkStore,
|
|
5233
|
+
PostgreSQLWorkflowTrackingStore,
|
|
4883
5234
|
PostgreSQLWorkspaceStore,
|
|
4884
5235
|
ThreadMessageQueueStore,
|
|
4885
5236
|
addAssistantTenantId,
|
|
@@ -4902,6 +5253,7 @@ var PostgreSQLChannelInstallationStore = class {
|
|
|
4902
5253
|
createThreadMessageQueueTable,
|
|
4903
5254
|
createThreadsTable,
|
|
4904
5255
|
createUsersTable,
|
|
5256
|
+
createWorkflowTrackingTables,
|
|
4905
5257
|
createWorkspacesTable,
|
|
4906
5258
|
getThreadMessageQueueStore
|
|
4907
5259
|
});
|