@axiom-lattice/pg-stores 1.0.90 → 1.0.93
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 +25 -0
- package/dist/index.d.mts +13 -1
- package/dist/index.d.ts +13 -1
- package/dist/index.js +220 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +220 -7
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
- package/src/__tests__/PostgreSQLWorkflowTrackingStore.test.ts +1 -1
- package/src/createPgStoreConfig.ts +10 -1
- package/src/migrations/task_migration.ts +31 -0
- package/src/migrations/task_work_items_migration.ts +51 -0
- package/src/stores/PostgreSQLConnectionStore.ts +8 -0
- package/src/stores/PostgreSQLEvalStore.ts +12 -0
- package/src/stores/PostgreSQLTaskStore.ts +60 -5
- package/src/stores/PostgreSQLTaskWorkItemStore.ts +67 -0
- package/src/stores/PostgreSQLTenantStore.ts +2 -2
- package/src/stores/PostgreSQLWorkflowTrackingStore.ts +3 -1
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.93 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
|
+
[32mCJS[39m [1mdist/index.js [22m[32m270.88 KB[39m
|
|
12
|
+
[32mCJS[39m [1mdist/index.js.map [22m[32m506.11 KB[39m
|
|
13
|
+
[32mCJS[39m ⚡️ Build success in 698ms
|
|
14
|
+
[32mESM[39m [1mdist/index.mjs [22m[32m264.57 KB[39m
|
|
15
|
+
[32mESM[39m [1mdist/index.mjs.map [22m[32m505.84 KB[39m
|
|
16
|
+
[32mESM[39m ⚡️ Build success in 738ms
|
|
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 16091ms
|
|
19
|
+
[32mDTS[39m [1mdist/index.d.ts [22m[32m61.16 KB[39m
|
|
20
|
+
[32mDTS[39m [1mdist/index.d.mts [22m[32m61.16 KB[39m
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,30 @@
|
|
|
1
1
|
# @axiom-lattice/pg-stores
|
|
2
2
|
|
|
3
|
+
## 1.0.93
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 075a384: add skill graph, tenant url
|
|
8
|
+
- Updated dependencies [075a384]
|
|
9
|
+
- @axiom-lattice/core@2.1.102
|
|
10
|
+
- @axiom-lattice/protocols@2.1.53
|
|
11
|
+
|
|
12
|
+
## 1.0.92
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- Updated dependencies [acdaec8]
|
|
17
|
+
- @axiom-lattice/core@2.1.101
|
|
18
|
+
- @axiom-lattice/protocols@2.1.52
|
|
19
|
+
|
|
20
|
+
## 1.0.91
|
|
21
|
+
|
|
22
|
+
### Patch Changes
|
|
23
|
+
|
|
24
|
+
- 2feab5c: add sse enhance
|
|
25
|
+
- Updated dependencies [2feab5c]
|
|
26
|
+
- @axiom-lattice/core@2.1.100
|
|
27
|
+
|
|
3
28
|
## 1.0.90
|
|
4
29
|
|
|
5
30
|
### Patch Changes
|
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Pool, PoolConfig, PoolClient } from 'pg';
|
|
2
2
|
export { Pool, PoolConfig } from 'pg';
|
|
3
|
-
import { ThreadStore, Thread, CreateThreadRequest, AssistantStore, Assistant, CreateAssistantRequest, DatabaseConfigStore, DatabaseConfigEntry, CreateDatabaseConfigRequest, UpdateDatabaseConfigRequest, ConnectionStore, ConnectionEntry, 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, QueryWorkflowRunsOptions, QueryWorkflowRunsResult, CreateRunStepRequest, RunStep, UpdateRunStepRequest, StepType, EvalStore, EvalProject, CreateEvalProjectRequest, EvalSuite, CreateEvalSuiteRequest, EvalCase, CreateEvalCaseRequest, EvalRun, CreateEvalRunRequest, EvalRunResult, EvalProjectReport, BindingRegistry, Binding, CreateBindingInput, ChannelInstallationStore, ChannelInstallation, ChannelInstallationType, CreateChannelInstallationRequest, UpdateChannelInstallationRequest, A2AApiKeyStore, A2AApiKeyRecord, CreateA2AApiKeyInput, A2AApiKeyEntry, ScheduleStorage, ScheduledTaskDefinition, ScheduledTaskStatus, ScheduleExecutionType, TaskStore, CreateTaskRequest, TaskItem, TaskListFilter, UpdateTaskRequest, MenuRegistry, MenuItem, CreateMenuItemInput, UpdateMenuItemInput, SharedResourceStore, ShareRecord, CollectionStore, Collection, CreateCollectionRequest, UpdateCollectionRequest, VectorStoreProvider, VectorStoreCreateParams, SkillStore, Skill, CreateSkillRequest } from '@axiom-lattice/protocols';
|
|
3
|
+
import { ThreadStore, Thread, CreateThreadRequest, AssistantStore, Assistant, CreateAssistantRequest, DatabaseConfigStore, DatabaseConfigEntry, CreateDatabaseConfigRequest, UpdateDatabaseConfigRequest, ConnectionStore, ConnectionEntry, 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, QueryWorkflowRunsOptions, QueryWorkflowRunsResult, CreateRunStepRequest, RunStep, UpdateRunStepRequest, StepType, EvalStore, EvalProject, CreateEvalProjectRequest, EvalSuite, CreateEvalSuiteRequest, EvalCase, CreateEvalCaseRequest, EvalRun, CreateEvalRunRequest, EvalRunResult, EvalProjectReport, BindingRegistry, Binding, CreateBindingInput, ChannelInstallationStore, ChannelInstallation, ChannelInstallationType, CreateChannelInstallationRequest, UpdateChannelInstallationRequest, A2AApiKeyStore, A2AApiKeyRecord, CreateA2AApiKeyInput, A2AApiKeyEntry, ScheduleStorage, ScheduledTaskDefinition, ScheduledTaskStatus, ScheduleExecutionType, TaskStore, CreateTaskRequest, TaskItem, TaskListFilter, UpdateTaskRequest, TaskWorkItemStore, CreateWorkItemRequest, TaskWorkItem, TaskWorkItemListFilter, MenuRegistry, MenuItem, CreateMenuItemInput, UpdateMenuItemInput, SharedResourceStore, ShareRecord, CollectionStore, Collection, CreateCollectionRequest, UpdateCollectionRequest, VectorStoreProvider, VectorStoreCreateParams, SkillStore, Skill, CreateSkillRequest } from '@axiom-lattice/protocols';
|
|
4
4
|
export { Assistant, AssistantStore, Binding, BindingRegistry, ChannelInstallation, ChannelInstallationStore, ConnectionEntry, ConnectionStore, CreateAssistantRequest, CreateBindingInput, CreateChannelInstallationRequest, CreateDatabaseConfigRequest, CreateEvalCaseRequest, CreateEvalProjectRequest, CreateEvalRunRequest, CreateEvalSuiteRequest, CreateMcpServerConfigRequest, CreateMenuItemInput, CreateMetricsServerConfigRequest, CreateProjectRequest, CreateRunStepRequest, CreateShareRequest, CreateSkillRequest, CreateTenantRequest, CreateThreadRequest, CreateUserRequest, CreateUserTenantLinkRequest, CreateWorkflowRunRequest, CreateWorkspaceRequest, DatabaseConfig, DatabaseConfigEntry, DatabaseConfigStore, DatabaseType, EvalCase, EvalProject, EvalProjectReport, EvalRun, EvalRunResult, EvalStore, EvalSuite, LarkChannelInstallationConfig, McpServerConfigEntry, McpServerConfigStore, MenuItem, MenuRegistry, MetricsServerConfig, MetricsServerConfigEntry, MetricsServerConfigStore, Project, ProjectStore, ResourceAddress, RunStep, ScheduleExecutionType, ScheduleStorage, ScheduledTaskDefinition, ScheduledTaskStatus, ShareRecord, ShareResult, ShareVisibility, SharedResourceStore, 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';
|
|
@@ -275,6 +275,7 @@ declare class PostgreSQLDatabaseConfigStore implements DatabaseConfigStore {
|
|
|
275
275
|
declare class PostgreSQLConnectionStore implements ConnectionStore {
|
|
276
276
|
private db;
|
|
277
277
|
constructor(db: Pool);
|
|
278
|
+
listByTenant(tenantId: string): Promise<ConnectionEntry[]>;
|
|
278
279
|
listByType(tenantId: string, type: string): Promise<ConnectionEntry[]>;
|
|
279
280
|
getByKey(tenantId: string, type: string, key: string): Promise<ConnectionEntry | null>;
|
|
280
281
|
create(entry: Omit<ConnectionEntry, "id" | "createdAt" | "updatedAt">): Promise<ConnectionEntry>;
|
|
@@ -879,6 +880,8 @@ declare class PostgreSQLEvalStore implements EvalStore {
|
|
|
879
880
|
createRunResult(tenantId: string, runId: string, id: string, data: Omit<EvalRunResult, "id" | "runId" | "createdAt">): Promise<EvalRunResult>;
|
|
880
881
|
/** Update a run result with tenant isolation via the parent run */
|
|
881
882
|
updateRunResult(tenantId: string, id: string, updates: Partial<EvalRunResult>): Promise<EvalRunResult | null>;
|
|
883
|
+
/** Delete a run result by ID */
|
|
884
|
+
deleteRunResult(tenantId: string, id: string): Promise<boolean>;
|
|
882
885
|
/** Get a single run result by ID with tenant isolation */
|
|
883
886
|
private getRunResultById;
|
|
884
887
|
/** Aggregate report for a project including all runs */
|
|
@@ -1196,6 +1199,14 @@ declare class PostgreSQLTaskStore implements TaskStore {
|
|
|
1196
1199
|
private ensureInitialized;
|
|
1197
1200
|
}
|
|
1198
1201
|
|
|
1202
|
+
declare class PostgreSQLTaskWorkItemStore implements TaskWorkItemStore {
|
|
1203
|
+
private pool;
|
|
1204
|
+
constructor(pool: Pool);
|
|
1205
|
+
create(params: CreateWorkItemRequest): Promise<TaskWorkItem>;
|
|
1206
|
+
list(filter: TaskWorkItemListFilter): Promise<TaskWorkItem[]>;
|
|
1207
|
+
private rowToItem;
|
|
1208
|
+
}
|
|
1209
|
+
|
|
1199
1210
|
interface MenuStoreOptions {
|
|
1200
1211
|
pool?: Pool;
|
|
1201
1212
|
poolConfig?: string | PoolConfig;
|
|
@@ -1321,6 +1332,7 @@ declare function createPgStoreConfig(connectionString: string): Promise<{
|
|
|
1321
1332
|
workflowTracking: PostgreSQLWorkflowTrackingStore;
|
|
1322
1333
|
threadMessageQueue: ThreadMessageQueueStore;
|
|
1323
1334
|
task: PostgreSQLTaskStore;
|
|
1335
|
+
taskWorkItem: PostgreSQLTaskWorkItemStore;
|
|
1324
1336
|
a2aApiKey: PostgreSQLA2AApiKeyStore;
|
|
1325
1337
|
schedule: PostgreSQLScheduleStorage;
|
|
1326
1338
|
menu: MenuStore;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Pool, PoolConfig, PoolClient } from 'pg';
|
|
2
2
|
export { Pool, PoolConfig } from 'pg';
|
|
3
|
-
import { ThreadStore, Thread, CreateThreadRequest, AssistantStore, Assistant, CreateAssistantRequest, DatabaseConfigStore, DatabaseConfigEntry, CreateDatabaseConfigRequest, UpdateDatabaseConfigRequest, ConnectionStore, ConnectionEntry, 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, QueryWorkflowRunsOptions, QueryWorkflowRunsResult, CreateRunStepRequest, RunStep, UpdateRunStepRequest, StepType, EvalStore, EvalProject, CreateEvalProjectRequest, EvalSuite, CreateEvalSuiteRequest, EvalCase, CreateEvalCaseRequest, EvalRun, CreateEvalRunRequest, EvalRunResult, EvalProjectReport, BindingRegistry, Binding, CreateBindingInput, ChannelInstallationStore, ChannelInstallation, ChannelInstallationType, CreateChannelInstallationRequest, UpdateChannelInstallationRequest, A2AApiKeyStore, A2AApiKeyRecord, CreateA2AApiKeyInput, A2AApiKeyEntry, ScheduleStorage, ScheduledTaskDefinition, ScheduledTaskStatus, ScheduleExecutionType, TaskStore, CreateTaskRequest, TaskItem, TaskListFilter, UpdateTaskRequest, MenuRegistry, MenuItem, CreateMenuItemInput, UpdateMenuItemInput, SharedResourceStore, ShareRecord, CollectionStore, Collection, CreateCollectionRequest, UpdateCollectionRequest, VectorStoreProvider, VectorStoreCreateParams, SkillStore, Skill, CreateSkillRequest } from '@axiom-lattice/protocols';
|
|
3
|
+
import { ThreadStore, Thread, CreateThreadRequest, AssistantStore, Assistant, CreateAssistantRequest, DatabaseConfigStore, DatabaseConfigEntry, CreateDatabaseConfigRequest, UpdateDatabaseConfigRequest, ConnectionStore, ConnectionEntry, 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, QueryWorkflowRunsOptions, QueryWorkflowRunsResult, CreateRunStepRequest, RunStep, UpdateRunStepRequest, StepType, EvalStore, EvalProject, CreateEvalProjectRequest, EvalSuite, CreateEvalSuiteRequest, EvalCase, CreateEvalCaseRequest, EvalRun, CreateEvalRunRequest, EvalRunResult, EvalProjectReport, BindingRegistry, Binding, CreateBindingInput, ChannelInstallationStore, ChannelInstallation, ChannelInstallationType, CreateChannelInstallationRequest, UpdateChannelInstallationRequest, A2AApiKeyStore, A2AApiKeyRecord, CreateA2AApiKeyInput, A2AApiKeyEntry, ScheduleStorage, ScheduledTaskDefinition, ScheduledTaskStatus, ScheduleExecutionType, TaskStore, CreateTaskRequest, TaskItem, TaskListFilter, UpdateTaskRequest, TaskWorkItemStore, CreateWorkItemRequest, TaskWorkItem, TaskWorkItemListFilter, MenuRegistry, MenuItem, CreateMenuItemInput, UpdateMenuItemInput, SharedResourceStore, ShareRecord, CollectionStore, Collection, CreateCollectionRequest, UpdateCollectionRequest, VectorStoreProvider, VectorStoreCreateParams, SkillStore, Skill, CreateSkillRequest } from '@axiom-lattice/protocols';
|
|
4
4
|
export { Assistant, AssistantStore, Binding, BindingRegistry, ChannelInstallation, ChannelInstallationStore, ConnectionEntry, ConnectionStore, CreateAssistantRequest, CreateBindingInput, CreateChannelInstallationRequest, CreateDatabaseConfigRequest, CreateEvalCaseRequest, CreateEvalProjectRequest, CreateEvalRunRequest, CreateEvalSuiteRequest, CreateMcpServerConfigRequest, CreateMenuItemInput, CreateMetricsServerConfigRequest, CreateProjectRequest, CreateRunStepRequest, CreateShareRequest, CreateSkillRequest, CreateTenantRequest, CreateThreadRequest, CreateUserRequest, CreateUserTenantLinkRequest, CreateWorkflowRunRequest, CreateWorkspaceRequest, DatabaseConfig, DatabaseConfigEntry, DatabaseConfigStore, DatabaseType, EvalCase, EvalProject, EvalProjectReport, EvalRun, EvalRunResult, EvalStore, EvalSuite, LarkChannelInstallationConfig, McpServerConfigEntry, McpServerConfigStore, MenuItem, MenuRegistry, MetricsServerConfig, MetricsServerConfigEntry, MetricsServerConfigStore, Project, ProjectStore, ResourceAddress, RunStep, ScheduleExecutionType, ScheduleStorage, ScheduledTaskDefinition, ScheduledTaskStatus, ShareRecord, ShareResult, ShareVisibility, SharedResourceStore, 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';
|
|
@@ -275,6 +275,7 @@ declare class PostgreSQLDatabaseConfigStore implements DatabaseConfigStore {
|
|
|
275
275
|
declare class PostgreSQLConnectionStore implements ConnectionStore {
|
|
276
276
|
private db;
|
|
277
277
|
constructor(db: Pool);
|
|
278
|
+
listByTenant(tenantId: string): Promise<ConnectionEntry[]>;
|
|
278
279
|
listByType(tenantId: string, type: string): Promise<ConnectionEntry[]>;
|
|
279
280
|
getByKey(tenantId: string, type: string, key: string): Promise<ConnectionEntry | null>;
|
|
280
281
|
create(entry: Omit<ConnectionEntry, "id" | "createdAt" | "updatedAt">): Promise<ConnectionEntry>;
|
|
@@ -879,6 +880,8 @@ declare class PostgreSQLEvalStore implements EvalStore {
|
|
|
879
880
|
createRunResult(tenantId: string, runId: string, id: string, data: Omit<EvalRunResult, "id" | "runId" | "createdAt">): Promise<EvalRunResult>;
|
|
880
881
|
/** Update a run result with tenant isolation via the parent run */
|
|
881
882
|
updateRunResult(tenantId: string, id: string, updates: Partial<EvalRunResult>): Promise<EvalRunResult | null>;
|
|
883
|
+
/** Delete a run result by ID */
|
|
884
|
+
deleteRunResult(tenantId: string, id: string): Promise<boolean>;
|
|
882
885
|
/** Get a single run result by ID with tenant isolation */
|
|
883
886
|
private getRunResultById;
|
|
884
887
|
/** Aggregate report for a project including all runs */
|
|
@@ -1196,6 +1199,14 @@ declare class PostgreSQLTaskStore implements TaskStore {
|
|
|
1196
1199
|
private ensureInitialized;
|
|
1197
1200
|
}
|
|
1198
1201
|
|
|
1202
|
+
declare class PostgreSQLTaskWorkItemStore implements TaskWorkItemStore {
|
|
1203
|
+
private pool;
|
|
1204
|
+
constructor(pool: Pool);
|
|
1205
|
+
create(params: CreateWorkItemRequest): Promise<TaskWorkItem>;
|
|
1206
|
+
list(filter: TaskWorkItemListFilter): Promise<TaskWorkItem[]>;
|
|
1207
|
+
private rowToItem;
|
|
1208
|
+
}
|
|
1209
|
+
|
|
1199
1210
|
interface MenuStoreOptions {
|
|
1200
1211
|
pool?: Pool;
|
|
1201
1212
|
poolConfig?: string | PoolConfig;
|
|
@@ -1321,6 +1332,7 @@ declare function createPgStoreConfig(connectionString: string): Promise<{
|
|
|
1321
1332
|
workflowTracking: PostgreSQLWorkflowTrackingStore;
|
|
1322
1333
|
threadMessageQueue: ThreadMessageQueueStore;
|
|
1323
1334
|
task: PostgreSQLTaskStore;
|
|
1335
|
+
taskWorkItem: PostgreSQLTaskWorkItemStore;
|
|
1324
1336
|
a2aApiKey: PostgreSQLA2AApiKeyStore;
|
|
1325
1337
|
schedule: PostgreSQLScheduleStorage;
|
|
1326
1338
|
menu: MenuStore;
|
package/dist/index.js
CHANGED
|
@@ -1356,6 +1356,13 @@ var PostgreSQLConnectionStore = class {
|
|
|
1356
1356
|
constructor(db) {
|
|
1357
1357
|
this.db = db;
|
|
1358
1358
|
}
|
|
1359
|
+
async listByTenant(tenantId) {
|
|
1360
|
+
const result = await this.db.query(
|
|
1361
|
+
`SELECT * FROM ${TABLE} WHERE tenant_id = $1 ORDER BY created_at`,
|
|
1362
|
+
[tenantId]
|
|
1363
|
+
);
|
|
1364
|
+
return result.rows.map((row) => this.mapRow(row));
|
|
1365
|
+
}
|
|
1359
1366
|
async listByType(tenantId, type) {
|
|
1360
1367
|
const result = await this.db.query(
|
|
1361
1368
|
`SELECT * FROM ${TABLE} WHERE tenant_id = $1 AND type = $2 ORDER BY created_at`,
|
|
@@ -3044,8 +3051,8 @@ var PostgreSQLTenantStore = class {
|
|
|
3044
3051
|
updateValues.push(updates.status);
|
|
3045
3052
|
}
|
|
3046
3053
|
if (updates.metadata !== void 0) {
|
|
3047
|
-
updateFields.push(`metadata = $${paramIndex++}`);
|
|
3048
|
-
updateValues.push(updates.metadata);
|
|
3054
|
+
updateFields.push(`metadata = COALESCE(lattice_tenants.metadata, '{}'::jsonb) || $${paramIndex++}::jsonb`);
|
|
3055
|
+
updateValues.push(JSON.stringify(updates.metadata));
|
|
3049
3056
|
}
|
|
3050
3057
|
if (updateFields.length === 0) {
|
|
3051
3058
|
return existing;
|
|
@@ -3762,7 +3769,7 @@ function mapRowToRunStep(row) {
|
|
|
3762
3769
|
edgeTo: row.edge_to,
|
|
3763
3770
|
edgePurpose: row.edge_purpose,
|
|
3764
3771
|
input: safeParse(row.input, void 0),
|
|
3765
|
-
output: safeParse(row.output, void 0
|
|
3772
|
+
output: typeof row.output === "string" ? safeParse(row.output, row.output) : row.output ?? void 0,
|
|
3766
3773
|
status: row.status,
|
|
3767
3774
|
errorMessage: row.error_message,
|
|
3768
3775
|
startedAt: row.started_at,
|
|
@@ -4657,6 +4664,17 @@ var PostgreSQLEvalStore = class {
|
|
|
4657
4664
|
);
|
|
4658
4665
|
return rows.length ? this.mapRowToRunResult(rows[0]) : null;
|
|
4659
4666
|
}
|
|
4667
|
+
/** Delete a run result by ID */
|
|
4668
|
+
async deleteRunResult(tenantId, id) {
|
|
4669
|
+
await this.ensureInitialized();
|
|
4670
|
+
const result = await this.pool.query(
|
|
4671
|
+
`DELETE FROM lattice_eval_run_results
|
|
4672
|
+
WHERE id = $1
|
|
4673
|
+
AND run_id IN (SELECT id FROM lattice_eval_runs WHERE tenant_id = $2)`,
|
|
4674
|
+
[id, tenantId]
|
|
4675
|
+
);
|
|
4676
|
+
return (result.rowCount ?? 0) > 0;
|
|
4677
|
+
}
|
|
4660
4678
|
/** Get a single run result by ID with tenant isolation */
|
|
4661
4679
|
async getRunResultById(tenantId, id) {
|
|
4662
4680
|
await this.ensureInitialized();
|
|
@@ -6444,6 +6462,34 @@ var createTasksTable = {
|
|
|
6444
6462
|
await client.query("DROP TABLE IF EXISTS lattice_tasks");
|
|
6445
6463
|
}
|
|
6446
6464
|
};
|
|
6465
|
+
var addTaskFieldsMigration = {
|
|
6466
|
+
version: 139,
|
|
6467
|
+
name: "add_task_fields_require_review_deps_result_failure",
|
|
6468
|
+
up: async (client) => {
|
|
6469
|
+
await client.query(`
|
|
6470
|
+
ALTER TABLE lattice_tasks
|
|
6471
|
+
ADD COLUMN IF NOT EXISTS require_review BOOLEAN DEFAULT FALSE,
|
|
6472
|
+
ADD COLUMN IF NOT EXISTS dependencies JSONB,
|
|
6473
|
+
ADD COLUMN IF NOT EXISTS result TEXT,
|
|
6474
|
+
ADD COLUMN IF NOT EXISTS failure_reason TEXT
|
|
6475
|
+
`);
|
|
6476
|
+
}
|
|
6477
|
+
};
|
|
6478
|
+
var addTaskProjectFieldsMigration = {
|
|
6479
|
+
version: 140,
|
|
6480
|
+
name: "add_task_project_workspace_fields",
|
|
6481
|
+
up: async (client) => {
|
|
6482
|
+
await client.query(`
|
|
6483
|
+
ALTER TABLE lattice_tasks
|
|
6484
|
+
ADD COLUMN IF NOT EXISTS workspace_id TEXT,
|
|
6485
|
+
ADD COLUMN IF NOT EXISTS project_id TEXT
|
|
6486
|
+
`);
|
|
6487
|
+
await client.query(`
|
|
6488
|
+
CREATE INDEX IF NOT EXISTS idx_tasks_project
|
|
6489
|
+
ON lattice_tasks (tenant_id, project_id)
|
|
6490
|
+
`);
|
|
6491
|
+
}
|
|
6492
|
+
};
|
|
6447
6493
|
|
|
6448
6494
|
// src/stores/PostgreSQLTaskStore.ts
|
|
6449
6495
|
var import_uuid3 = require("uuid");
|
|
@@ -6462,6 +6508,12 @@ function mapRowToTask(row) {
|
|
|
6462
6508
|
parentId: row.parent_id ?? void 0,
|
|
6463
6509
|
sourceId: row.source_id ?? void 0,
|
|
6464
6510
|
context: row.context ?? void 0,
|
|
6511
|
+
requireReview: row.require_review ?? void 0,
|
|
6512
|
+
dependencies: row.dependencies ?? void 0,
|
|
6513
|
+
result: row.result ?? void 0,
|
|
6514
|
+
failureReason: row.failure_reason ?? void 0,
|
|
6515
|
+
workspaceId: row.workspace_id ?? void 0,
|
|
6516
|
+
projectId: row.project_id ?? void 0,
|
|
6465
6517
|
createdAt: new Date(row.created_at),
|
|
6466
6518
|
updatedAt: new Date(row.updated_at)
|
|
6467
6519
|
};
|
|
@@ -6486,6 +6538,8 @@ var PostgreSQLTaskStore = class {
|
|
|
6486
6538
|
}
|
|
6487
6539
|
this.migrationManager = new MigrationManager(this.pool);
|
|
6488
6540
|
this.migrationManager.register(createTasksTable);
|
|
6541
|
+
this.migrationManager.register(addTaskFieldsMigration);
|
|
6542
|
+
this.migrationManager.register(addTaskProjectFieldsMigration);
|
|
6489
6543
|
if (options.autoMigrate !== false) {
|
|
6490
6544
|
this.initialize().catch((error) => {
|
|
6491
6545
|
console.error("Failed to initialize PostgreSQLTaskStore:", error);
|
|
@@ -6515,8 +6569,8 @@ var PostgreSQLTaskStore = class {
|
|
|
6515
6569
|
const id = (0, import_uuid3.v4)();
|
|
6516
6570
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
6517
6571
|
await this.pool.query(
|
|
6518
|
-
`INSERT INTO lattice_tasks (id, tenant_id, owner_type, owner_id, title, description, status, priority, due_date, metadata, parent_id, source_id, context, created_at, updated_at)
|
|
6519
|
-
VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15)`,
|
|
6572
|
+
`INSERT INTO lattice_tasks (id, tenant_id, owner_type, owner_id, title, description, status, priority, due_date, metadata, parent_id, source_id, context, require_review, dependencies, result, failure_reason, workspace_id, project_id, created_at, updated_at)
|
|
6573
|
+
VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19, $20, $21)`,
|
|
6520
6574
|
[
|
|
6521
6575
|
id,
|
|
6522
6576
|
params.tenantId,
|
|
@@ -6531,6 +6585,12 @@ var PostgreSQLTaskStore = class {
|
|
|
6531
6585
|
params.parentId || null,
|
|
6532
6586
|
params.sourceId || null,
|
|
6533
6587
|
params.context ? JSON.stringify(params.context) : null,
|
|
6588
|
+
params.requireReview ?? null,
|
|
6589
|
+
params.dependencies ? JSON.stringify(params.dependencies) : null,
|
|
6590
|
+
params.result ?? null,
|
|
6591
|
+
params.failureReason ?? null,
|
|
6592
|
+
params.workspaceId || null,
|
|
6593
|
+
params.projectId || null,
|
|
6534
6594
|
now,
|
|
6535
6595
|
now
|
|
6536
6596
|
]
|
|
@@ -6560,13 +6620,24 @@ var PostgreSQLTaskStore = class {
|
|
|
6560
6620
|
params.push(filter.ownerId);
|
|
6561
6621
|
}
|
|
6562
6622
|
if (filter.status) {
|
|
6563
|
-
|
|
6564
|
-
|
|
6623
|
+
const statuses = filter.status.split(",").map((s) => s.trim()).filter(Boolean);
|
|
6624
|
+
const placeholders = statuses.map((_, i) => `$${paramIndex + i}`).join(", ");
|
|
6625
|
+
conditions.push(`status IN (${placeholders})`);
|
|
6626
|
+
params.push(...statuses);
|
|
6627
|
+
paramIndex += statuses.length;
|
|
6565
6628
|
}
|
|
6566
6629
|
if (filter.priority) {
|
|
6567
6630
|
conditions.push(`priority = $${paramIndex++}`);
|
|
6568
6631
|
params.push(filter.priority);
|
|
6569
6632
|
}
|
|
6633
|
+
if (filter.workspaceId) {
|
|
6634
|
+
conditions.push(`workspace_id = $${paramIndex++}`);
|
|
6635
|
+
params.push(filter.workspaceId);
|
|
6636
|
+
}
|
|
6637
|
+
if (filter.projectId) {
|
|
6638
|
+
conditions.push(`project_id = $${paramIndex++}`);
|
|
6639
|
+
params.push(filter.projectId);
|
|
6640
|
+
}
|
|
6570
6641
|
if (filter.parentId) {
|
|
6571
6642
|
conditions.push(`parent_id = $${paramIndex++}`);
|
|
6572
6643
|
params.push(filter.parentId);
|
|
@@ -6644,6 +6715,30 @@ var PostgreSQLTaskStore = class {
|
|
|
6644
6715
|
setClauses.push(`owner_id = $${paramIndex++}`);
|
|
6645
6716
|
params.push(updates.ownerId);
|
|
6646
6717
|
}
|
|
6718
|
+
if (updates.requireReview !== void 0) {
|
|
6719
|
+
setClauses.push(`require_review = $${paramIndex++}`);
|
|
6720
|
+
params.push(updates.requireReview);
|
|
6721
|
+
}
|
|
6722
|
+
if (updates.dependencies !== void 0) {
|
|
6723
|
+
setClauses.push(`dependencies = $${paramIndex++}`);
|
|
6724
|
+
params.push(JSON.stringify(updates.dependencies));
|
|
6725
|
+
}
|
|
6726
|
+
if (updates.result !== void 0) {
|
|
6727
|
+
setClauses.push(`result = $${paramIndex++}`);
|
|
6728
|
+
params.push(updates.result);
|
|
6729
|
+
}
|
|
6730
|
+
if (updates.failureReason !== void 0) {
|
|
6731
|
+
setClauses.push(`failure_reason = $${paramIndex++}`);
|
|
6732
|
+
params.push(updates.failureReason);
|
|
6733
|
+
}
|
|
6734
|
+
if (updates.workspaceId !== void 0) {
|
|
6735
|
+
setClauses.push(`workspace_id = $${paramIndex++}`);
|
|
6736
|
+
params.push(updates.workspaceId);
|
|
6737
|
+
}
|
|
6738
|
+
if (updates.projectId !== void 0) {
|
|
6739
|
+
setClauses.push(`project_id = $${paramIndex++}`);
|
|
6740
|
+
params.push(updates.projectId);
|
|
6741
|
+
}
|
|
6647
6742
|
if (setClauses.length === 0) {
|
|
6648
6743
|
return existing;
|
|
6649
6744
|
}
|
|
@@ -6676,6 +6771,72 @@ var PostgreSQLTaskStore = class {
|
|
|
6676
6771
|
}
|
|
6677
6772
|
};
|
|
6678
6773
|
|
|
6774
|
+
// src/stores/PostgreSQLTaskWorkItemStore.ts
|
|
6775
|
+
var import_uuid4 = require("uuid");
|
|
6776
|
+
var PostgreSQLTaskWorkItemStore = class {
|
|
6777
|
+
constructor(pool) {
|
|
6778
|
+
this.pool = pool;
|
|
6779
|
+
}
|
|
6780
|
+
async create(params) {
|
|
6781
|
+
const id = (0, import_uuid4.v4)();
|
|
6782
|
+
const result = await this.pool.query(
|
|
6783
|
+
`INSERT INTO lattice_task_work_items
|
|
6784
|
+
(id, tenant_id, task_id, action, actor, thread_id, summary, detail, attempt, workspace_id, project_id)
|
|
6785
|
+
VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11)
|
|
6786
|
+
RETURNING *`,
|
|
6787
|
+
[
|
|
6788
|
+
id,
|
|
6789
|
+
params.tenantId,
|
|
6790
|
+
params.taskId,
|
|
6791
|
+
params.action,
|
|
6792
|
+
params.actor,
|
|
6793
|
+
params.threadId || null,
|
|
6794
|
+
params.summary || null,
|
|
6795
|
+
params.detail ? JSON.stringify(params.detail) : null,
|
|
6796
|
+
params.attempt || null,
|
|
6797
|
+
params.workspaceId || null,
|
|
6798
|
+
params.projectId || null
|
|
6799
|
+
]
|
|
6800
|
+
);
|
|
6801
|
+
return this.rowToItem(result.rows[0]);
|
|
6802
|
+
}
|
|
6803
|
+
async list(filter) {
|
|
6804
|
+
let query = `SELECT * FROM lattice_task_work_items WHERE tenant_id = $1 AND task_id = $2`;
|
|
6805
|
+
const params = [filter.tenantId, filter.taskId];
|
|
6806
|
+
if (filter.action) {
|
|
6807
|
+
query += ` AND action = $${params.length + 1}`;
|
|
6808
|
+
params.push(filter.action);
|
|
6809
|
+
}
|
|
6810
|
+
query += ` ORDER BY created_at ASC`;
|
|
6811
|
+
if (filter.limit) {
|
|
6812
|
+
query += ` LIMIT $${params.length + 1}`;
|
|
6813
|
+
params.push(filter.limit);
|
|
6814
|
+
}
|
|
6815
|
+
if (filter.offset) {
|
|
6816
|
+
query += ` OFFSET $${params.length + 1}`;
|
|
6817
|
+
params.push(filter.offset);
|
|
6818
|
+
}
|
|
6819
|
+
const result = await this.pool.query(query, params);
|
|
6820
|
+
return result.rows.map((row) => this.rowToItem(row));
|
|
6821
|
+
}
|
|
6822
|
+
rowToItem(row) {
|
|
6823
|
+
return {
|
|
6824
|
+
id: row.id,
|
|
6825
|
+
taskId: row.task_id,
|
|
6826
|
+
tenantId: row.tenant_id,
|
|
6827
|
+
action: row.action,
|
|
6828
|
+
actor: row.actor,
|
|
6829
|
+
threadId: row.thread_id,
|
|
6830
|
+
summary: row.summary,
|
|
6831
|
+
detail: row.detail,
|
|
6832
|
+
attempt: row.attempt,
|
|
6833
|
+
workspaceId: row.workspace_id,
|
|
6834
|
+
projectId: row.project_id,
|
|
6835
|
+
createdAt: new Date(row.created_at)
|
|
6836
|
+
};
|
|
6837
|
+
}
|
|
6838
|
+
};
|
|
6839
|
+
|
|
6679
6840
|
// src/stores/MenuStore.ts
|
|
6680
6841
|
var import_pg19 = require("pg");
|
|
6681
6842
|
|
|
@@ -7625,6 +7786,52 @@ var createCollectionsTable = {
|
|
|
7625
7786
|
}
|
|
7626
7787
|
};
|
|
7627
7788
|
|
|
7789
|
+
// src/migrations/task_work_items_migration.ts
|
|
7790
|
+
var createTaskWorkItemsMigration = {
|
|
7791
|
+
version: 138,
|
|
7792
|
+
name: "create_task_work_items_table",
|
|
7793
|
+
up: async (client) => {
|
|
7794
|
+
await client.query(`
|
|
7795
|
+
CREATE TABLE IF NOT EXISTS lattice_task_work_items (
|
|
7796
|
+
id TEXT NOT NULL,
|
|
7797
|
+
tenant_id TEXT NOT NULL,
|
|
7798
|
+
task_id TEXT NOT NULL,
|
|
7799
|
+
action TEXT NOT NULL,
|
|
7800
|
+
actor TEXT NOT NULL,
|
|
7801
|
+
thread_id TEXT,
|
|
7802
|
+
summary TEXT,
|
|
7803
|
+
detail JSONB,
|
|
7804
|
+
attempt INTEGER,
|
|
7805
|
+
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
|
7806
|
+
PRIMARY KEY (tenant_id, id)
|
|
7807
|
+
)
|
|
7808
|
+
`);
|
|
7809
|
+
await client.query(`
|
|
7810
|
+
CREATE INDEX IF NOT EXISTS idx_task_work_items_task_id
|
|
7811
|
+
ON lattice_task_work_items (tenant_id, task_id)
|
|
7812
|
+
`);
|
|
7813
|
+
await client.query(`
|
|
7814
|
+
CREATE INDEX IF NOT EXISTS idx_task_work_items_action
|
|
7815
|
+
ON lattice_task_work_items (tenant_id, task_id, action)
|
|
7816
|
+
`);
|
|
7817
|
+
}
|
|
7818
|
+
};
|
|
7819
|
+
var addWorkItemProjectFieldsMigration = {
|
|
7820
|
+
version: 140,
|
|
7821
|
+
name: "add_task_work_item_project_fields",
|
|
7822
|
+
up: async (client) => {
|
|
7823
|
+
await client.query(`
|
|
7824
|
+
ALTER TABLE lattice_task_work_items
|
|
7825
|
+
ADD COLUMN IF NOT EXISTS workspace_id TEXT,
|
|
7826
|
+
ADD COLUMN IF NOT EXISTS project_id TEXT
|
|
7827
|
+
`);
|
|
7828
|
+
await client.query(`
|
|
7829
|
+
CREATE INDEX IF NOT EXISTS idx_task_work_items_project
|
|
7830
|
+
ON lattice_task_work_items (tenant_id, project_id)
|
|
7831
|
+
`);
|
|
7832
|
+
}
|
|
7833
|
+
};
|
|
7834
|
+
|
|
7628
7835
|
// src/createPgStoreConfig.ts
|
|
7629
7836
|
async function createPgStoreConfig(connectionString) {
|
|
7630
7837
|
const pool = new import_pg23.Pool({ connectionString });
|
|
@@ -7672,6 +7879,10 @@ async function createPgStoreConfig(connectionString) {
|
|
|
7672
7879
|
mm.register(createSharedResourcesTable);
|
|
7673
7880
|
mm.register(addFileContentType);
|
|
7674
7881
|
mm.register(createCollectionsTable);
|
|
7882
|
+
mm.register(addTaskFieldsMigration);
|
|
7883
|
+
mm.register(createTaskWorkItemsMigration);
|
|
7884
|
+
mm.register(addTaskProjectFieldsMigration);
|
|
7885
|
+
mm.register(addWorkItemProjectFieldsMigration);
|
|
7675
7886
|
mm.register(createConnectionConfigsTable);
|
|
7676
7887
|
mm.register(addWorkflowRunsTenantStatusUpdatedIndex);
|
|
7677
7888
|
await mm.migrate();
|
|
@@ -7680,6 +7891,7 @@ async function createPgStoreConfig(connectionString) {
|
|
|
7680
7891
|
console.error("[pg-stores] Failed to setup checkpoint table:", err.message || err);
|
|
7681
7892
|
});
|
|
7682
7893
|
const opts = { pool };
|
|
7894
|
+
const taskWorkItemStore = new PostgreSQLTaskWorkItemStore(pool);
|
|
7683
7895
|
return {
|
|
7684
7896
|
workspace: new PostgreSQLWorkspaceStore(opts),
|
|
7685
7897
|
project: new PostgreSQLProjectStore(opts),
|
|
@@ -7698,6 +7910,7 @@ async function createPgStoreConfig(connectionString) {
|
|
|
7698
7910
|
workflowTracking: new PostgreSQLWorkflowTrackingStore(opts),
|
|
7699
7911
|
threadMessageQueue: new ThreadMessageQueueStore(opts),
|
|
7700
7912
|
task: new PostgreSQLTaskStore(opts),
|
|
7913
|
+
taskWorkItem: taskWorkItemStore,
|
|
7701
7914
|
a2aApiKey: new PostgreSQLA2AApiKeyStore(opts),
|
|
7702
7915
|
schedule: new PostgreSQLScheduleStorage(opts),
|
|
7703
7916
|
menu: new MenuStore(opts),
|