@axiom-lattice/pg-stores 1.0.91 → 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 +17 -0
- package/dist/index.d.mts +10 -1
- package/dist/index.d.ts +10 -1
- package/dist/index.js +201 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +201 -6
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
- 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/PostgreSQLTaskStore.ts +60 -5
- package/src/stores/PostgreSQLTaskWorkItemStore.ts +67 -0
- package/src/stores/PostgreSQLTenantStore.ts +2 -2
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
|
-
[32mCJS[39m [1mdist/index.js [22m[
|
|
12
|
-
[32mCJS[39m [1mdist/index.js.map [22m[
|
|
13
|
-
[32mCJS[39m ⚡️ Build success in
|
|
14
|
-
[32mESM[39m [1mdist/index.mjs [22m[
|
|
15
|
-
[32mESM[39m [1mdist/index.mjs.map [22m[
|
|
16
|
-
[32mESM[39m ⚡️ Build success in
|
|
11
|
+
[32mCJS[39m [1mdist/index.js [22m[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,22 @@
|
|
|
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
|
+
|
|
3
20
|
## 1.0.91
|
|
4
21
|
|
|
5
22
|
### 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';
|
|
@@ -1199,6 +1199,14 @@ declare class PostgreSQLTaskStore implements TaskStore {
|
|
|
1199
1199
|
private ensureInitialized;
|
|
1200
1200
|
}
|
|
1201
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
|
+
|
|
1202
1210
|
interface MenuStoreOptions {
|
|
1203
1211
|
pool?: Pool;
|
|
1204
1212
|
poolConfig?: string | PoolConfig;
|
|
@@ -1324,6 +1332,7 @@ declare function createPgStoreConfig(connectionString: string): Promise<{
|
|
|
1324
1332
|
workflowTracking: PostgreSQLWorkflowTrackingStore;
|
|
1325
1333
|
threadMessageQueue: ThreadMessageQueueStore;
|
|
1326
1334
|
task: PostgreSQLTaskStore;
|
|
1335
|
+
taskWorkItem: PostgreSQLTaskWorkItemStore;
|
|
1327
1336
|
a2aApiKey: PostgreSQLA2AApiKeyStore;
|
|
1328
1337
|
schedule: PostgreSQLScheduleStorage;
|
|
1329
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';
|
|
@@ -1199,6 +1199,14 @@ declare class PostgreSQLTaskStore implements TaskStore {
|
|
|
1199
1199
|
private ensureInitialized;
|
|
1200
1200
|
}
|
|
1201
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
|
+
|
|
1202
1210
|
interface MenuStoreOptions {
|
|
1203
1211
|
pool?: Pool;
|
|
1204
1212
|
poolConfig?: string | PoolConfig;
|
|
@@ -1324,6 +1332,7 @@ declare function createPgStoreConfig(connectionString: string): Promise<{
|
|
|
1324
1332
|
workflowTracking: PostgreSQLWorkflowTrackingStore;
|
|
1325
1333
|
threadMessageQueue: ThreadMessageQueueStore;
|
|
1326
1334
|
task: PostgreSQLTaskStore;
|
|
1335
|
+
taskWorkItem: PostgreSQLTaskWorkItemStore;
|
|
1327
1336
|
a2aApiKey: PostgreSQLA2AApiKeyStore;
|
|
1328
1337
|
schedule: PostgreSQLScheduleStorage;
|
|
1329
1338
|
menu: MenuStore;
|
package/dist/index.js
CHANGED
|
@@ -3051,8 +3051,8 @@ var PostgreSQLTenantStore = class {
|
|
|
3051
3051
|
updateValues.push(updates.status);
|
|
3052
3052
|
}
|
|
3053
3053
|
if (updates.metadata !== void 0) {
|
|
3054
|
-
updateFields.push(`metadata = $${paramIndex++}`);
|
|
3055
|
-
updateValues.push(updates.metadata);
|
|
3054
|
+
updateFields.push(`metadata = COALESCE(lattice_tenants.metadata, '{}'::jsonb) || $${paramIndex++}::jsonb`);
|
|
3055
|
+
updateValues.push(JSON.stringify(updates.metadata));
|
|
3056
3056
|
}
|
|
3057
3057
|
if (updateFields.length === 0) {
|
|
3058
3058
|
return existing;
|
|
@@ -6462,6 +6462,34 @@ var createTasksTable = {
|
|
|
6462
6462
|
await client.query("DROP TABLE IF EXISTS lattice_tasks");
|
|
6463
6463
|
}
|
|
6464
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
|
+
};
|
|
6465
6493
|
|
|
6466
6494
|
// src/stores/PostgreSQLTaskStore.ts
|
|
6467
6495
|
var import_uuid3 = require("uuid");
|
|
@@ -6480,6 +6508,12 @@ function mapRowToTask(row) {
|
|
|
6480
6508
|
parentId: row.parent_id ?? void 0,
|
|
6481
6509
|
sourceId: row.source_id ?? void 0,
|
|
6482
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,
|
|
6483
6517
|
createdAt: new Date(row.created_at),
|
|
6484
6518
|
updatedAt: new Date(row.updated_at)
|
|
6485
6519
|
};
|
|
@@ -6504,6 +6538,8 @@ var PostgreSQLTaskStore = class {
|
|
|
6504
6538
|
}
|
|
6505
6539
|
this.migrationManager = new MigrationManager(this.pool);
|
|
6506
6540
|
this.migrationManager.register(createTasksTable);
|
|
6541
|
+
this.migrationManager.register(addTaskFieldsMigration);
|
|
6542
|
+
this.migrationManager.register(addTaskProjectFieldsMigration);
|
|
6507
6543
|
if (options.autoMigrate !== false) {
|
|
6508
6544
|
this.initialize().catch((error) => {
|
|
6509
6545
|
console.error("Failed to initialize PostgreSQLTaskStore:", error);
|
|
@@ -6533,8 +6569,8 @@ var PostgreSQLTaskStore = class {
|
|
|
6533
6569
|
const id = (0, import_uuid3.v4)();
|
|
6534
6570
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
6535
6571
|
await this.pool.query(
|
|
6536
|
-
`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)
|
|
6537
|
-
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)`,
|
|
6538
6574
|
[
|
|
6539
6575
|
id,
|
|
6540
6576
|
params.tenantId,
|
|
@@ -6549,6 +6585,12 @@ var PostgreSQLTaskStore = class {
|
|
|
6549
6585
|
params.parentId || null,
|
|
6550
6586
|
params.sourceId || null,
|
|
6551
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,
|
|
6552
6594
|
now,
|
|
6553
6595
|
now
|
|
6554
6596
|
]
|
|
@@ -6578,13 +6620,24 @@ var PostgreSQLTaskStore = class {
|
|
|
6578
6620
|
params.push(filter.ownerId);
|
|
6579
6621
|
}
|
|
6580
6622
|
if (filter.status) {
|
|
6581
|
-
|
|
6582
|
-
|
|
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;
|
|
6583
6628
|
}
|
|
6584
6629
|
if (filter.priority) {
|
|
6585
6630
|
conditions.push(`priority = $${paramIndex++}`);
|
|
6586
6631
|
params.push(filter.priority);
|
|
6587
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
|
+
}
|
|
6588
6641
|
if (filter.parentId) {
|
|
6589
6642
|
conditions.push(`parent_id = $${paramIndex++}`);
|
|
6590
6643
|
params.push(filter.parentId);
|
|
@@ -6662,6 +6715,30 @@ var PostgreSQLTaskStore = class {
|
|
|
6662
6715
|
setClauses.push(`owner_id = $${paramIndex++}`);
|
|
6663
6716
|
params.push(updates.ownerId);
|
|
6664
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
|
+
}
|
|
6665
6742
|
if (setClauses.length === 0) {
|
|
6666
6743
|
return existing;
|
|
6667
6744
|
}
|
|
@@ -6694,6 +6771,72 @@ var PostgreSQLTaskStore = class {
|
|
|
6694
6771
|
}
|
|
6695
6772
|
};
|
|
6696
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
|
+
|
|
6697
6840
|
// src/stores/MenuStore.ts
|
|
6698
6841
|
var import_pg19 = require("pg");
|
|
6699
6842
|
|
|
@@ -7643,6 +7786,52 @@ var createCollectionsTable = {
|
|
|
7643
7786
|
}
|
|
7644
7787
|
};
|
|
7645
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
|
+
|
|
7646
7835
|
// src/createPgStoreConfig.ts
|
|
7647
7836
|
async function createPgStoreConfig(connectionString) {
|
|
7648
7837
|
const pool = new import_pg23.Pool({ connectionString });
|
|
@@ -7690,6 +7879,10 @@ async function createPgStoreConfig(connectionString) {
|
|
|
7690
7879
|
mm.register(createSharedResourcesTable);
|
|
7691
7880
|
mm.register(addFileContentType);
|
|
7692
7881
|
mm.register(createCollectionsTable);
|
|
7882
|
+
mm.register(addTaskFieldsMigration);
|
|
7883
|
+
mm.register(createTaskWorkItemsMigration);
|
|
7884
|
+
mm.register(addTaskProjectFieldsMigration);
|
|
7885
|
+
mm.register(addWorkItemProjectFieldsMigration);
|
|
7693
7886
|
mm.register(createConnectionConfigsTable);
|
|
7694
7887
|
mm.register(addWorkflowRunsTenantStatusUpdatedIndex);
|
|
7695
7888
|
await mm.migrate();
|
|
@@ -7698,6 +7891,7 @@ async function createPgStoreConfig(connectionString) {
|
|
|
7698
7891
|
console.error("[pg-stores] Failed to setup checkpoint table:", err.message || err);
|
|
7699
7892
|
});
|
|
7700
7893
|
const opts = { pool };
|
|
7894
|
+
const taskWorkItemStore = new PostgreSQLTaskWorkItemStore(pool);
|
|
7701
7895
|
return {
|
|
7702
7896
|
workspace: new PostgreSQLWorkspaceStore(opts),
|
|
7703
7897
|
project: new PostgreSQLProjectStore(opts),
|
|
@@ -7716,6 +7910,7 @@ async function createPgStoreConfig(connectionString) {
|
|
|
7716
7910
|
workflowTracking: new PostgreSQLWorkflowTrackingStore(opts),
|
|
7717
7911
|
threadMessageQueue: new ThreadMessageQueueStore(opts),
|
|
7718
7912
|
task: new PostgreSQLTaskStore(opts),
|
|
7913
|
+
taskWorkItem: taskWorkItemStore,
|
|
7719
7914
|
a2aApiKey: new PostgreSQLA2AApiKeyStore(opts),
|
|
7720
7915
|
schedule: new PostgreSQLScheduleStorage(opts),
|
|
7721
7916
|
menu: new MenuStore(opts),
|