@bpinhosilva/agent-orchestrator 1.0.0-alpha.35 → 1.0.0-alpha.36

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.
Files changed (45) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/dist/agents/agents.service.js +5 -11
  3. package/dist/agents/dto/create-agent.dto.js +1 -7
  4. package/dist/agents/entities/agent.entity.js +3 -14
  5. package/dist/auth/auth.service.js +2 -2
  6. package/dist/auth/dto/register.dto.js +3 -3
  7. package/dist/auth/dto/update-profile.dto.js +3 -3
  8. package/dist/auth/entities/refresh-token.entity.js +2 -1
  9. package/dist/cli/setup/admin.js +1 -1
  10. package/dist/config/typeorm.js +6 -1
  11. package/dist/migrations/1775935855172-MigrateSimpleJsonToJsonb.js +22 -0
  12. package/dist/migrations/1775936433494-RenameSnakeCaseColumnsToCamelCase.js +17 -0
  13. package/dist/migrations/1775938708731-ConvertIdsToUuid.js +77 -0
  14. package/dist/migrations/1775939208983-RemoveProviderIdFromAgents.js +30 -0
  15. package/dist/projects/entities/project-member.entity.js +0 -1
  16. package/dist/system-settings/entities/system-settings.entity.js +2 -1
  17. package/dist/tasks/entities/comment.entity.js +2 -1
  18. package/dist/tasks/entities/recurrent-task-exec.entity.js +4 -2
  19. package/dist/tasks/entities/recurrent-task.entity.js +1 -0
  20. package/dist/tasks/entities/task.entity.js +6 -5
  21. package/dist/tasks/task-scheduler.service.js +2 -2
  22. package/dist/ui/assets/AgentFleet-CMdfKF4L.js +1 -0
  23. package/dist/ui/assets/{ConfirmDialog-BC4kXR-v.js → ConfirmDialog-BiPWFYdx.js} +1 -1
  24. package/dist/ui/assets/{CreateRecurrentTaskModal-3i2kvJ7D.js → CreateRecurrentTaskModal-BsVRuvR2.js} +1 -1
  25. package/dist/ui/assets/Profile-seY6wWr2.js +1 -0
  26. package/dist/ui/assets/{ProjectDetail-D9GECicH.js → ProjectDetail-v5rQQk2o.js} +1 -1
  27. package/dist/ui/assets/{Providers-e_57YNh2.js → Providers-DK-acBgM.js} +1 -1
  28. package/dist/ui/assets/Scheduler-DflIuJxr.js +1 -0
  29. package/dist/ui/assets/{Settings-CPWN7Z5a.js → Settings-DbnrEvZM.js} +1 -1
  30. package/dist/ui/assets/{TaskDetail-DmbJFnj7.js → TaskDetail-C1bdyprq.js} +1 -1
  31. package/dist/ui/assets/{TaskExecutions-DSqVbwe_.js → TaskExecutions-B28kes6l.js} +1 -1
  32. package/dist/ui/assets/{TaskManager-A75O4y6b.js → TaskManager-DAQNB4Q5.js} +1 -1
  33. package/dist/ui/assets/UserDetail-CyKBaqAe.js +1 -0
  34. package/dist/ui/assets/Users-g6D9mZQc.js +1 -0
  35. package/dist/ui/assets/{index-B-2XAA2C.js → index-4X4zupUS.js} +3 -3
  36. package/dist/ui/index.html +1 -1
  37. package/dist/users/dto/create-user.dto.js +3 -3
  38. package/dist/users/entities/user.entity.js +1 -1
  39. package/dist/users/users.service.js +2 -2
  40. package/package.json +1 -1
  41. package/dist/ui/assets/AgentFleet-eDOzJ1ln.js +0 -1
  42. package/dist/ui/assets/Profile-CIVwII8X.js +0 -1
  43. package/dist/ui/assets/Scheduler-D8kBg7x3.js +0 -1
  44. package/dist/ui/assets/UserDetail-DQxuKynZ.js +0 -1
  45. package/dist/ui/assets/Users-BLJjzn5Z.js +0 -1
package/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ # [1.0.0-alpha.36](https://github.com/bpinhosilva/agent-orchestrator/compare/v1.0.0-alpha.35...v1.0.0-alpha.36) (2026-04-13)
2
+
3
+
4
+ ### Performance Improvements
5
+
6
+ * **db:** optimize schema with composite and missing indexes ([091d7c4](https://github.com/bpinhosilva/agent-orchestrator/commit/091d7c417d9b3291d704754f8cd0b22924aec871))
7
+
1
8
  # [1.0.0-alpha.35](https://github.com/bpinhosilva/agent-orchestrator/compare/v1.0.0-alpha.34...v1.0.0-alpha.35) (2026-04-11)
2
9
 
3
10
 
@@ -20,7 +20,7 @@ const typeorm_2 = require("typeorm");
20
20
  const agent_entity_1 = require("./entities/agent.entity");
21
21
  const agent_registry_1 = require("./registry/agent.registry");
22
22
  const core_1 = require("@nestjs/core");
23
- const AGENT_RELATIONS = ['model', 'provider'];
23
+ const AGENT_RELATIONS = ['model'];
24
24
  let AgentsService = AgentsService_1 = class AgentsService {
25
25
  agentRepository;
26
26
  moduleRef;
@@ -53,9 +53,9 @@ let AgentsService = AgentsService_1 = class AgentsService {
53
53
  this.agentInstances.delete(agentEntity.id);
54
54
  return;
55
55
  }
56
- const providerName = agentEntity.provider?.name?.toLowerCase();
56
+ const providerName = agentEntity.model?.provider?.name?.toLowerCase();
57
57
  if (!providerName) {
58
- this.logger.warn(`No provider found for agent #${agentEntity.id}. Skipping instance creation.`);
58
+ this.logger.warn(`No provider found for agent #${agentEntity.id} (via model). Skipping instance creation.`);
59
59
  return;
60
60
  }
61
61
  const AgentClass = (0, agent_registry_1.getAgentImplementation)(providerName);
@@ -84,14 +84,11 @@ let AgentsService = AgentsService_1 = class AgentsService {
84
84
  }
85
85
  }
86
86
  async create(createAgentDto) {
87
- const { modelId, providerId, ...rest } = createAgentDto;
87
+ const { modelId, ...rest } = createAgentDto;
88
88
  const agentData = { ...rest };
89
89
  if (modelId) {
90
90
  agentData.model = { id: modelId };
91
91
  }
92
- if (providerId) {
93
- agentData.provider = { id: providerId };
94
- }
95
92
  return await this.agentRepository.manager.transaction(async (manager) => {
96
93
  const agent = manager.create(agent_entity_1.AgentEntity, agentData);
97
94
  const savedAgent = await manager.save(agent);
@@ -120,14 +117,11 @@ let AgentsService = AgentsService_1 = class AgentsService {
120
117
  return agent;
121
118
  }
122
119
  async update(id, updateAgentDto) {
123
- const { modelId, providerId, ...rest } = updateAgentDto;
120
+ const { modelId, ...rest } = updateAgentDto;
124
121
  const updateData = { ...rest };
125
122
  if (modelId) {
126
123
  updateData.model = { id: modelId };
127
124
  }
128
- if (providerId) {
129
- updateData.provider = { id: providerId };
130
- }
131
125
  return await this.agentRepository.manager.transaction(async (manager) => {
132
126
  await manager.update(agent_entity_1.AgentEntity, id, updateData);
133
127
  const updatedAgent = await manager.findOne(agent_entity_1.AgentEntity, {
@@ -23,10 +23,9 @@ class CreateAgentDto {
23
23
  modelId;
24
24
  status;
25
25
  emoji;
26
- providerId;
27
26
  attributes;
28
27
  static _OPENAPI_METADATA_FACTORY() {
29
- return { name: { required: true, type: () => String, maxLength: 200 }, description: { required: false, type: () => String, maxLength: 2000 }, role: { required: false, type: () => String, maxLength: 200 }, systemInstructions: { required: false, type: () => String, maxLength: 10000 }, modelId: { required: true, type: () => String }, status: { required: false, type: () => String, enum: ['active', 'inactive'] }, emoji: { required: false, type: () => Object, enum: agent_emoji_constants_1.AGENT_EMOJI_VALUES }, providerId: { required: true, type: () => String, format: "uuid" }, attributes: { required: false, type: () => require("./agent-attributes.dto").AgentAttributesDto } };
28
+ return { name: { required: true, type: () => String, maxLength: 200 }, description: { required: false, type: () => String, maxLength: 2000 }, role: { required: false, type: () => String, maxLength: 200 }, systemInstructions: { required: false, type: () => String, maxLength: 10000 }, modelId: { required: true, type: () => String }, status: { required: false, type: () => String, enum: ['active', 'inactive'] }, emoji: { required: false, type: () => Object, enum: agent_emoji_constants_1.AGENT_EMOJI_VALUES }, attributes: { required: false, type: () => require("./agent-attributes.dto").AgentAttributesDto } };
30
29
  }
31
30
  }
32
31
  exports.CreateAgentDto = CreateAgentDto;
@@ -71,11 +70,6 @@ __decorate([
71
70
  (0, class_validator_1.IsIn)(agent_emoji_constants_1.AGENT_EMOJI_VALUES),
72
71
  __metadata("design:type", String)
73
72
  ], CreateAgentDto.prototype, "emoji", void 0);
74
- __decorate([
75
- (0, class_validator_1.IsUUID)(),
76
- (0, class_validator_1.IsNotEmpty)(),
77
- __metadata("design:type", String)
78
- ], CreateAgentDto.prototype, "providerId", void 0);
79
73
  __decorate([
80
74
  (0, class_validator_1.IsOptional)(),
81
75
  (0, class_validator_1.ValidateNested)(),
@@ -13,8 +13,8 @@ exports.AgentEntity = void 0;
13
13
  const openapi = require("@nestjs/swagger");
14
14
  const typeorm_1 = require("typeorm");
15
15
  const model_entity_1 = require("../../models/entities/model.entity");
16
- const provider_entity_1 = require("../../providers/entities/provider.entity");
17
16
  const agent_emoji_constants_1 = require("../agent-emoji.constants");
17
+ const typeorm_2 = require("../../config/typeorm");
18
18
  let AgentEntity = class AgentEntity {
19
19
  id;
20
20
  name;
@@ -24,12 +24,11 @@ let AgentEntity = class AgentEntity {
24
24
  status;
25
25
  emoji;
26
26
  attributes;
27
- provider;
28
27
  model;
29
28
  createdAt;
30
29
  updatedAt;
31
30
  static _OPENAPI_METADATA_FACTORY() {
32
- return { id: { required: true, type: () => String }, name: { required: true, type: () => String }, description: { required: true, type: () => String }, systemInstructions: { required: true, type: () => String }, role: { required: true, type: () => String, nullable: true }, status: { required: true, type: () => String, nullable: true }, emoji: { required: true, type: () => Object }, attributes: { required: true, type: () => Object, nullable: true }, provider: { required: true, type: () => require("../../providers/entities/provider.entity").Provider, nullable: true }, model: { required: true, type: () => require("../../models/entities/model.entity").Model, nullable: true }, createdAt: { required: true, type: () => Date }, updatedAt: { required: true, type: () => Date } };
31
+ return { id: { required: true, type: () => String }, name: { required: true, type: () => String }, description: { required: true, type: () => String }, systemInstructions: { required: true, type: () => String }, role: { required: true, type: () => String, nullable: true }, status: { required: true, type: () => String, nullable: true }, emoji: { required: true, type: () => Object }, attributes: { required: true, type: () => Object, nullable: true }, model: { required: true, type: () => require("../../models/entities/model.entity").Model, nullable: true }, createdAt: { required: true, type: () => Date }, updatedAt: { required: true, type: () => Date } };
33
32
  }
34
33
  };
35
34
  exports.AgentEntity = AgentEntity;
@@ -62,19 +61,9 @@ __decorate([
62
61
  __metadata("design:type", String)
63
62
  ], AgentEntity.prototype, "emoji", void 0);
64
63
  __decorate([
65
- (0, typeorm_1.Column)({ type: 'simple-json', nullable: true }),
64
+ (0, typeorm_1.Column)({ type: typeorm_2.JSON_COLUMN_TYPE, nullable: true }),
66
65
  __metadata("design:type", Object)
67
66
  ], AgentEntity.prototype, "attributes", void 0);
68
- __decorate([
69
- (0, typeorm_1.Index)(),
70
- (0, typeorm_1.ManyToOne)(() => provider_entity_1.Provider, {
71
- nullable: true,
72
- eager: true,
73
- onDelete: 'SET NULL',
74
- }),
75
- (0, typeorm_1.JoinColumn)({ name: 'providerId' }),
76
- __metadata("design:type", Object)
77
- ], AgentEntity.prototype, "provider", void 0);
78
67
  __decorate([
79
68
  (0, typeorm_1.Index)(),
80
69
  (0, typeorm_1.ManyToOne)(() => model_entity_1.Model, (model) => model.agents, {
@@ -229,8 +229,8 @@ let AuthService = class AuthService {
229
229
  const updateData = {};
230
230
  if (dto.name !== undefined)
231
231
  updateData.name = dto.name;
232
- if (dto.last_name !== undefined)
233
- updateData.last_name = dto.last_name;
232
+ if (dto.lastName !== undefined)
233
+ updateData.lastName = dto.lastName;
234
234
  if (dto.email !== undefined)
235
235
  updateData.email = dto.email;
236
236
  if (dto.avatar !== undefined)
@@ -15,12 +15,12 @@ const class_validator_1 = require("class-validator");
15
15
  const avatar_constants_1 = require("../../users/avatar.constants");
16
16
  class RegisterDto {
17
17
  name;
18
- last_name;
18
+ lastName;
19
19
  email;
20
20
  password;
21
21
  avatar;
22
22
  static _OPENAPI_METADATA_FACTORY() {
23
- return { name: { required: true, type: () => String, maxLength: 100 }, last_name: { required: true, type: () => String, maxLength: 100 }, email: { required: true, type: () => String, maxLength: 255, format: "email" }, password: { required: true, type: () => String, minLength: 8, maxLength: 72 }, avatar: { required: false, type: () => Object, enum: avatar_constants_1.USER_AVATAR_KEYS } };
23
+ return { name: { required: true, type: () => String, maxLength: 100 }, lastName: { required: true, type: () => String, maxLength: 100 }, email: { required: true, type: () => String, maxLength: 255, format: "email" }, password: { required: true, type: () => String, minLength: 8, maxLength: 72 }, avatar: { required: false, type: () => Object, enum: avatar_constants_1.USER_AVATAR_KEYS } };
24
24
  }
25
25
  }
26
26
  exports.RegisterDto = RegisterDto;
@@ -35,7 +35,7 @@ __decorate([
35
35
  (0, class_validator_1.IsNotEmpty)(),
36
36
  (0, class_validator_1.MaxLength)(100),
37
37
  __metadata("design:type", String)
38
- ], RegisterDto.prototype, "last_name", void 0);
38
+ ], RegisterDto.prototype, "lastName", void 0);
39
39
  __decorate([
40
40
  (0, class_validator_1.IsEmail)(),
41
41
  (0, class_validator_1.MaxLength)(255),
@@ -15,13 +15,13 @@ const class_validator_1 = require("class-validator");
15
15
  const avatar_constants_1 = require("../../users/avatar.constants");
16
16
  class UpdateProfileDto {
17
17
  name;
18
- last_name;
18
+ lastName;
19
19
  email;
20
20
  currentPassword;
21
21
  newPassword;
22
22
  avatar;
23
23
  static _OPENAPI_METADATA_FACTORY() {
24
- return { name: { required: false, type: () => String, maxLength: 100 }, last_name: { required: false, type: () => String, maxLength: 100 }, email: { required: false, type: () => String, maxLength: 255, format: "email" }, currentPassword: { required: false, type: () => String, minLength: 8, maxLength: 72 }, newPassword: { required: false, type: () => String, minLength: 8, maxLength: 72 }, avatar: { required: false, type: () => Object, enum: avatar_constants_1.USER_AVATAR_KEYS } };
24
+ return { name: { required: false, type: () => String, maxLength: 100 }, lastName: { required: false, type: () => String, maxLength: 100 }, email: { required: false, type: () => String, maxLength: 255, format: "email" }, currentPassword: { required: false, type: () => String, minLength: 8, maxLength: 72 }, newPassword: { required: false, type: () => String, minLength: 8, maxLength: 72 }, avatar: { required: false, type: () => Object, enum: avatar_constants_1.USER_AVATAR_KEYS } };
25
25
  }
26
26
  }
27
27
  exports.UpdateProfileDto = UpdateProfileDto;
@@ -36,7 +36,7 @@ __decorate([
36
36
  (0, class_validator_1.IsString)(),
37
37
  (0, class_validator_1.MaxLength)(100),
38
38
  __metadata("design:type", String)
39
- ], UpdateProfileDto.prototype, "last_name", void 0);
39
+ ], UpdateProfileDto.prototype, "lastName", void 0);
40
40
  __decorate([
41
41
  (0, class_validator_1.IsOptional)(),
42
42
  (0, class_validator_1.IsEmail)(),
@@ -13,6 +13,7 @@ exports.RefreshToken = void 0;
13
13
  const openapi = require("@nestjs/swagger");
14
14
  const typeorm_1 = require("typeorm");
15
15
  const user_entity_1 = require("../../users/entities/user.entity");
16
+ const typeorm_2 = require("../../config/typeorm");
16
17
  let RefreshToken = class RefreshToken {
17
18
  id;
18
19
  userId;
@@ -33,7 +34,7 @@ __decorate([
33
34
  __metadata("design:type", String)
34
35
  ], RefreshToken.prototype, "id", void 0);
35
36
  __decorate([
36
- (0, typeorm_1.Column)(),
37
+ (0, typeorm_1.Column)({ type: typeorm_2.UUID_COLUMN_TYPE }),
37
38
  __metadata("design:type", String)
38
39
  ], RefreshToken.prototype, "userId", void 0);
39
40
  __decorate([
@@ -103,7 +103,7 @@ bcryptDep = require('bcrypt')) {
103
103
  const hashedPassword = await bcryptDep.hash(response.password, 10);
104
104
  const user = userRepository.create({
105
105
  name: response.name,
106
- last_name: 'User',
106
+ lastName: 'User',
107
107
  email: response.email,
108
108
  password: hashedPassword,
109
109
  avatar: avatar_constants_1.DEFAULT_USER_AVATAR,
@@ -1,12 +1,17 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createDataSource = exports.getTypeOrmConfig = void 0;
3
+ exports.createDataSource = exports.getTypeOrmConfig = exports.UUID_COLUMN_TYPE = exports.JSON_COLUMN_TYPE = void 0;
4
4
  exports.resolveDataSourceType = resolveDataSourceType;
5
5
  exports.isSqliteDriver = isSqliteDriver;
6
6
  const typeorm_1 = require("typeorm");
7
7
  const config_1 = require("@nestjs/config");
8
8
  const path_1 = require("path");
9
9
  const runtime_paths_1 = require("./runtime-paths");
10
+ (0, runtime_paths_1.loadRuntimeEnv)();
11
+ const dbType = process.env.DB_TYPE;
12
+ const databaseUrl = process.env.DATABASE_URL;
13
+ exports.JSON_COLUMN_TYPE = dbType === 'sqlite' || (!dbType && !databaseUrl) ? 'simple-json' : 'jsonb';
14
+ exports.UUID_COLUMN_TYPE = dbType === 'sqlite' || (!dbType && !databaseUrl) ? 'varchar' : 'uuid';
10
15
  function resolveDataSourceType(dbType) {
11
16
  return dbType === 'sqlite' ? 'better-sqlite3' : 'postgres';
12
17
  }
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MigrateSimpleJsonToJsonb1775935855172 = void 0;
4
+ const typeorm_1 = require("../config/typeorm");
5
+ class MigrateSimpleJsonToJsonb1775935855172 {
6
+ name = 'MigrateSimpleJsonToJsonb1775935855172';
7
+ async up(queryRunner) {
8
+ const isSqlite = (0, typeorm_1.isSqliteDriver)(queryRunner.connection.options.type);
9
+ if (!isSqlite) {
10
+ await queryRunner.query(`ALTER TABLE "task_comments" ALTER COLUMN "artifacts" TYPE jsonb USING "artifacts"::jsonb`);
11
+ await queryRunner.query(`ALTER TABLE "recurrent_task_execs" ALTER COLUMN "artifacts" TYPE jsonb USING "artifacts"::jsonb`);
12
+ }
13
+ }
14
+ async down(queryRunner) {
15
+ const isSqlite = (0, typeorm_1.isSqliteDriver)(queryRunner.connection.options.type);
16
+ if (!isSqlite) {
17
+ await queryRunner.query(`ALTER TABLE "task_comments" ALTER COLUMN "artifacts" TYPE text USING "artifacts"::text`);
18
+ await queryRunner.query(`ALTER TABLE "recurrent_task_execs" ALTER COLUMN "artifacts" TYPE text USING "artifacts"::text`);
19
+ }
20
+ }
21
+ }
22
+ exports.MigrateSimpleJsonToJsonb1775935855172 = MigrateSimpleJsonToJsonb1775935855172;
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RenameSnakeCaseColumnsToCamelCase1775936433494 = void 0;
4
+ class RenameSnakeCaseColumnsToCamelCase1775936433494 {
5
+ name = 'RenameSnakeCaseColumnsToCamelCase1775936433494';
6
+ async up(queryRunner) {
7
+ await queryRunner.query(`ALTER TABLE "users" RENAME COLUMN "last_name" TO "lastName"`);
8
+ await queryRunner.query(`ALTER TABLE "tasks" RENAME COLUMN "cost_estimate" TO "costEstimate"`);
9
+ await queryRunner.query(`ALTER TABLE "tasks" RENAME COLUMN "llm_latency" TO "llmLatency"`);
10
+ }
11
+ async down(queryRunner) {
12
+ await queryRunner.query(`ALTER TABLE "users" RENAME COLUMN "lastName" TO "last_name"`);
13
+ await queryRunner.query(`ALTER TABLE "tasks" RENAME COLUMN "costEstimate" TO "cost_estimate"`);
14
+ await queryRunner.query(`ALTER TABLE "tasks" RENAME COLUMN "llmLatency" TO "llm_latency"`);
15
+ }
16
+ }
17
+ exports.RenameSnakeCaseColumnsToCamelCase1775936433494 = RenameSnakeCaseColumnsToCamelCase1775936433494;
@@ -0,0 +1,77 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ConvertIdsToUuid1775938708731 = void 0;
4
+ const typeorm_1 = require("../config/typeorm");
5
+ class ConvertIdsToUuid1775938708731 {
6
+ name = 'ConvertIdsToUuid1775938708731';
7
+ async up(queryRunner) {
8
+ const isSqlite = (0, typeorm_1.isSqliteDriver)(queryRunner.connection.options.type);
9
+ if (isSqlite) {
10
+ return;
11
+ }
12
+ await queryRunner.query(`ALTER TABLE "models" DROP CONSTRAINT "FK_2ce64b8d909a4385f26bcd363b3"`);
13
+ await queryRunner.query(`ALTER TABLE "agents" DROP CONSTRAINT "FK_e927e225423f493fb58dc146cf0"`);
14
+ await queryRunner.query(`ALTER TABLE "agents" DROP CONSTRAINT "FK_ef998451a458221d3c409b37923"`);
15
+ await queryRunner.query(`ALTER TABLE "projects" DROP CONSTRAINT "FK_6cb68059ab1223de4f03f9a7268"`);
16
+ await queryRunner.query(`ALTER TABLE "project_members" DROP CONSTRAINT "FK_d19892d8f03928e5bfc7313780c"`);
17
+ await queryRunner.query(`ALTER TABLE "project_members" DROP CONSTRAINT "FK_08d1346ff91abba68e5a637cfdb"`);
18
+ await queryRunner.query(`ALTER TABLE "tasks" DROP CONSTRAINT "FK_9a16d2c86252529f622fa53f1e3"`);
19
+ await queryRunner.query(`ALTER TABLE "tasks" DROP CONSTRAINT "FK_e08fca67ca8966e6b9914bf2956"`);
20
+ await queryRunner.query(`ALTER TABLE "task_comments" DROP CONSTRAINT "FK_ba265816ca1d93f51083e06c520"`);
21
+ await queryRunner.query(`ALTER TABLE "task_comments" DROP CONSTRAINT "FK_70a6d3ec52a15e0ff43d4ad3532"`);
22
+ await queryRunner.query(`ALTER TABLE "task_comments" DROP CONSTRAINT "FK_c2d5d4e5e1e33278318fa6b2b05"`);
23
+ await queryRunner.query(`ALTER TABLE "recurrent_tasks" DROP CONSTRAINT "FK_9ec101b70a5f9612b0757d87c83"`);
24
+ await queryRunner.query(`ALTER TABLE "recurrent_tasks" DROP CONSTRAINT "FK_0f9f543bd40419122e69aeff006"`);
25
+ await queryRunner.query(`ALTER TABLE "recurrent_task_execs" DROP CONSTRAINT "FK_f5bb7be33ddb87ac0f04807b4ab"`);
26
+ await queryRunner.query(`ALTER TABLE "refresh_tokens" DROP CONSTRAINT "FK_610102b60fea1455310ccd299de"`);
27
+ const tables = [
28
+ { name: 'users', ids: ['id'] },
29
+ { name: 'providers', ids: ['id'] },
30
+ { name: 'models', ids: ['id', 'providerId'] },
31
+ { name: 'agents', ids: ['id', 'providerId', 'modelId'] },
32
+ { name: 'projects', ids: ['id', 'ownerAgentId'] },
33
+ { name: 'project_members', ids: ['id', 'projectId', 'userId'] },
34
+ { name: 'tasks', ids: ['id', 'assigneeId', 'projectId'] },
35
+ {
36
+ name: 'task_comments',
37
+ ids: ['id', 'taskId', 'authorUserId', 'authorAgentId'],
38
+ },
39
+ { name: 'recurrent_tasks', ids: ['id', 'assigneeId', 'projectId'] },
40
+ { name: 'recurrent_task_execs', ids: ['id', 'recurrentTaskId'] },
41
+ { name: 'artifacts', ids: ['id'] },
42
+ { name: 'refresh_tokens', ids: ['id', 'userId'] },
43
+ { name: 'system_settings', ids: ['id'] },
44
+ ];
45
+ for (const table of tables) {
46
+ for (const col of table.ids) {
47
+ await queryRunner.query(`ALTER TABLE "${table.name}" ALTER COLUMN "${col}" TYPE uuid USING "${col}"::uuid`);
48
+ if (col === 'id') {
49
+ await queryRunner.query(`ALTER TABLE "${table.name}" ALTER COLUMN "${col}" SET DEFAULT gen_random_uuid()`);
50
+ }
51
+ }
52
+ }
53
+ await queryRunner.query(`ALTER TABLE "models" ADD CONSTRAINT "FK_2ce64b8d909a4385f26bcd363b3" FOREIGN KEY ("providerId") REFERENCES "providers"("id") ON DELETE CASCADE ON UPDATE NO ACTION`);
54
+ await queryRunner.query(`ALTER TABLE "agents" ADD CONSTRAINT "FK_e927e225423f493fb58dc146cf0" FOREIGN KEY ("providerId") REFERENCES "providers"("id") ON DELETE SET NULL ON UPDATE NO ACTION`);
55
+ await queryRunner.query(`ALTER TABLE "agents" ADD CONSTRAINT "FK_ef998451a458221d3c409b37923" FOREIGN KEY ("modelId") REFERENCES "models"("id") ON DELETE SET NULL ON UPDATE NO ACTION`);
56
+ await queryRunner.query(`ALTER TABLE "projects" ADD CONSTRAINT "FK_6cb68059ab1223de4f03f9a7268" FOREIGN KEY ("ownerAgentId") REFERENCES "agents"("id") ON DELETE SET NULL ON UPDATE NO ACTION`);
57
+ await queryRunner.query(`ALTER TABLE "project_members" ADD CONSTRAINT "FK_d19892d8f03928e5bfc7313780c" FOREIGN KEY ("projectId") REFERENCES "projects"("id") ON DELETE CASCADE ON UPDATE NO ACTION`);
58
+ await queryRunner.query(`ALTER TABLE "project_members" ADD CONSTRAINT "FK_08d1346ff91abba68e5a637cfdb" FOREIGN KEY ("userId") REFERENCES "users"("id") ON DELETE CASCADE ON UPDATE NO ACTION`);
59
+ await queryRunner.query(`ALTER TABLE "tasks" ADD CONSTRAINT "FK_9a16d2c86252529f622fa53f1e3" FOREIGN KEY ("assigneeId") REFERENCES "agents"("id") ON DELETE SET NULL ON UPDATE NO ACTION`);
60
+ await queryRunner.query(`ALTER TABLE "tasks" ADD CONSTRAINT "FK_e08fca67ca8966e6b9914bf2956" FOREIGN KEY ("projectId") REFERENCES "projects"("id") ON DELETE CASCADE ON UPDATE NO ACTION`);
61
+ await queryRunner.query(`ALTER TABLE "task_comments" ADD CONSTRAINT "FK_ba265816ca1d93f51083e06c520" FOREIGN KEY ("taskId") REFERENCES "tasks"("id") ON DELETE CASCADE ON UPDATE NO ACTION`);
62
+ await queryRunner.query(`ALTER TABLE "task_comments" ADD CONSTRAINT "FK_70a6d3ec52a15e0ff43d4ad3532" FOREIGN KEY ("authorUserId") REFERENCES "users"("id") ON DELETE SET NULL ON UPDATE NO ACTION`);
63
+ await queryRunner.query(`ALTER TABLE "task_comments" ADD CONSTRAINT "FK_c2d5d4e5e1e33278318fa6b2b05" FOREIGN KEY ("authorAgentId") REFERENCES "agents"("id") ON DELETE SET NULL ON UPDATE NO ACTION`);
64
+ await queryRunner.query(`ALTER TABLE "recurrent_tasks" ADD CONSTRAINT "FK_9ec101b70a5f9612b0757d87c83" FOREIGN KEY ("assigneeId") REFERENCES "agents"("id") ON DELETE CASCADE ON UPDATE NO ACTION`);
65
+ await queryRunner.query(`ALTER TABLE "recurrent_tasks" ADD CONSTRAINT "FK_0f9f543bd40419122e69aeff006" FOREIGN KEY ("projectId") REFERENCES "projects"("id") ON DELETE CASCADE ON UPDATE NO ACTION`);
66
+ await queryRunner.query(`ALTER TABLE "recurrent_task_execs" ADD CONSTRAINT "FK_f5bb7be33ddb87ac0f04807b4ab" FOREIGN KEY ("recurrentTaskId") REFERENCES "recurrent_tasks"("id") ON DELETE CASCADE ON UPDATE NO ACTION`);
67
+ await queryRunner.query(`ALTER TABLE "refresh_tokens" ADD CONSTRAINT "FK_610102b60fea1455310ccd299de" FOREIGN KEY ("userId") REFERENCES "users"("id") ON DELETE CASCADE ON UPDATE NO ACTION`);
68
+ }
69
+ down(queryRunner) {
70
+ const isSqlite = (0, typeorm_1.isSqliteDriver)(queryRunner.connection.options.type);
71
+ if (isSqlite) {
72
+ return Promise.resolve();
73
+ }
74
+ return Promise.resolve();
75
+ }
76
+ }
77
+ exports.ConvertIdsToUuid1775938708731 = ConvertIdsToUuid1775938708731;
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RemoveProviderIdFromAgents1775939208983 = void 0;
4
+ const typeorm_1 = require("../config/typeorm");
5
+ class RemoveProviderIdFromAgents1775939208983 {
6
+ name = 'RemoveProviderIdFromAgents1775939208983';
7
+ async up(queryRunner) {
8
+ const isSqlite = (0, typeorm_1.isSqliteDriver)(queryRunner.connection.options.type);
9
+ if (isSqlite) {
10
+ await queryRunner.dropColumn('agents', 'providerId');
11
+ }
12
+ else {
13
+ await queryRunner.query(`ALTER TABLE "agents" DROP CONSTRAINT "FK_e927e225423f493fb58dc146cf0"`);
14
+ await queryRunner.query(`DROP INDEX "IDX_e927e225423f493fb58dc146cf"`);
15
+ await queryRunner.query(`ALTER TABLE "agents" DROP COLUMN "providerId"`);
16
+ }
17
+ }
18
+ async down(queryRunner) {
19
+ const isSqlite = (0, typeorm_1.isSqliteDriver)(queryRunner.connection.options.type);
20
+ if (isSqlite) {
21
+ await queryRunner.query(`ALTER TABLE "agents" ADD COLUMN "providerId" varchar`);
22
+ }
23
+ else {
24
+ await queryRunner.query(`ALTER TABLE "agents" ADD COLUMN "providerId" uuid`);
25
+ await queryRunner.query(`CREATE INDEX "IDX_e927e225423f493fb58dc146cf" ON "agents" ("providerId")`);
26
+ await queryRunner.query(`ALTER TABLE "agents" ADD CONSTRAINT "FK_e927e225423f493fb58dc146cf0" FOREIGN KEY ("providerId") REFERENCES "providers"("id") ON DELETE SET NULL ON UPDATE NO ACTION`);
27
+ }
28
+ }
29
+ }
30
+ exports.RemoveProviderIdFromAgents1775939208983 = RemoveProviderIdFromAgents1775939208983;
@@ -35,7 +35,6 @@ __decorate([
35
35
  __metadata("design:type", String)
36
36
  ], ProjectMember.prototype, "id", void 0);
37
37
  __decorate([
38
- (0, typeorm_1.Index)(),
39
38
  (0, typeorm_1.ManyToOne)(() => project_entity_1.Project, (project) => project.members, {
40
39
  onDelete: 'CASCADE',
41
40
  }),
@@ -12,6 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.SystemSettings = void 0;
13
13
  const openapi = require("@nestjs/swagger");
14
14
  const typeorm_1 = require("typeorm");
15
+ const typeorm_2 = require("../../config/typeorm");
15
16
  let SystemSettings = class SystemSettings {
16
17
  id;
17
18
  data;
@@ -27,7 +28,7 @@ __decorate([
27
28
  __metadata("design:type", String)
28
29
  ], SystemSettings.prototype, "id", void 0);
29
30
  __decorate([
30
- (0, typeorm_1.Column)({ type: 'simple-json' }),
31
+ (0, typeorm_1.Column)({ type: typeorm_2.JSON_COLUMN_TYPE }),
31
32
  __metadata("design:type", Object)
32
33
  ], SystemSettings.prototype, "data", void 0);
33
34
  __decorate([
@@ -15,6 +15,7 @@ const typeorm_1 = require("typeorm");
15
15
  const task_entity_1 = require("./task.entity");
16
16
  const agent_entity_1 = require("../../agents/entities/agent.entity");
17
17
  const user_entity_1 = require("../../users/entities/user.entity");
18
+ const typeorm_2 = require("../../config/typeorm");
18
19
  var CommentAuthorType;
19
20
  (function (CommentAuthorType) {
20
21
  CommentAuthorType["USER"] = "user";
@@ -76,7 +77,7 @@ __decorate([
76
77
  __metadata("design:type", Object)
77
78
  ], TaskComment.prototype, "authorAgent", void 0);
78
79
  __decorate([
79
- (0, typeorm_1.Column)({ type: 'simple-json', nullable: true }),
80
+ (0, typeorm_1.Column)({ type: typeorm_2.JSON_COLUMN_TYPE, nullable: true }),
80
81
  __metadata("design:type", Object)
81
82
  ], TaskComment.prototype, "artifacts", void 0);
82
83
  __decorate([
@@ -13,6 +13,7 @@ exports.RecurrentTaskExec = exports.ExecStatus = void 0;
13
13
  const openapi = require("@nestjs/swagger");
14
14
  const typeorm_1 = require("typeorm");
15
15
  const recurrent_task_entity_1 = require("./recurrent-task.entity");
16
+ const typeorm_2 = require("../../config/typeorm");
16
17
  var ExecStatus;
17
18
  (function (ExecStatus) {
18
19
  ExecStatus["RUNNING"] = "running";
@@ -63,7 +64,7 @@ __decorate([
63
64
  __metadata("design:type", Number)
64
65
  ], RecurrentTaskExec.prototype, "latencyMs", void 0);
65
66
  __decorate([
66
- (0, typeorm_1.Column)({ type: 'simple-json', nullable: true }),
67
+ (0, typeorm_1.Column)({ type: typeorm_2.JSON_COLUMN_TYPE, nullable: true }),
67
68
  __metadata("design:type", Object)
68
69
  ], RecurrentTaskExec.prototype, "artifacts", void 0);
69
70
  __decorate([
@@ -75,5 +76,6 @@ __decorate([
75
76
  __metadata("design:type", Date)
76
77
  ], RecurrentTaskExec.prototype, "updatedAt", void 0);
77
78
  exports.RecurrentTaskExec = RecurrentTaskExec = __decorate([
78
- (0, typeorm_1.Entity)('recurrent_task_execs')
79
+ (0, typeorm_1.Entity)('recurrent_task_execs'),
80
+ (0, typeorm_1.Index)(['recurrentTask', 'createdAt'])
79
81
  ], RecurrentTaskExec);
@@ -72,6 +72,7 @@ __decorate([
72
72
  __metadata("design:type", String)
73
73
  ], RecurrentTask.prototype, "cronExpression", void 0);
74
74
  __decorate([
75
+ (0, typeorm_1.Index)(),
75
76
  (0, typeorm_1.ManyToOne)(() => agent_entity_1.AgentEntity, {
76
77
  nullable: false,
77
78
  eager: true,
@@ -36,8 +36,8 @@ let Task = class Task {
36
36
  description;
37
37
  status;
38
38
  priority;
39
- cost_estimate;
40
- llm_latency;
39
+ costEstimate;
40
+ llmLatency;
41
41
  assignee;
42
42
  project;
43
43
  projectId;
@@ -45,7 +45,7 @@ let Task = class Task {
45
45
  createdAt;
46
46
  updatedAt;
47
47
  static _OPENAPI_METADATA_FACTORY() {
48
- return { id: { required: true, type: () => String }, title: { required: true, type: () => String }, description: { required: true, type: () => String }, status: { required: true, enum: require("./task.entity").TaskStatus }, priority: { required: true, enum: require("./task.entity").TaskPriority }, cost_estimate: { required: true, type: () => Number }, llm_latency: { required: true, type: () => Number }, assignee: { required: true, type: () => require("../../agents/entities/agent.entity").AgentEntity, nullable: true }, project: { required: true, type: () => require("../../projects/entities/project.entity").Project }, projectId: { required: true, type: () => String }, comments: { required: true, type: () => [require("./comment.entity").TaskComment] }, createdAt: { required: true, type: () => Date }, updatedAt: { required: true, type: () => Date } };
48
+ return { id: { required: true, type: () => String }, title: { required: true, type: () => String }, description: { required: true, type: () => String }, status: { required: true, enum: require("./task.entity").TaskStatus }, priority: { required: true, enum: require("./task.entity").TaskPriority }, costEstimate: { required: true, type: () => Number }, llmLatency: { required: true, type: () => Number }, assignee: { required: true, type: () => require("../../agents/entities/agent.entity").AgentEntity, nullable: true }, project: { required: true, type: () => require("../../projects/entities/project.entity").Project }, projectId: { required: true, type: () => String }, comments: { required: true, type: () => [require("./comment.entity").TaskComment] }, createdAt: { required: true, type: () => Date }, updatedAt: { required: true, type: () => Date } };
49
49
  }
50
50
  };
51
51
  exports.Task = Task;
@@ -80,11 +80,11 @@ __decorate([
80
80
  __decorate([
81
81
  (0, typeorm_1.Column)('float', { default: 0 }),
82
82
  __metadata("design:type", Number)
83
- ], Task.prototype, "cost_estimate", void 0);
83
+ ], Task.prototype, "costEstimate", void 0);
84
84
  __decorate([
85
85
  (0, typeorm_1.Column)('int', { default: 0 }),
86
86
  __metadata("design:type", Number)
87
- ], Task.prototype, "llm_latency", void 0);
87
+ ], Task.prototype, "llmLatency", void 0);
88
88
  __decorate([
89
89
  (0, typeorm_1.Index)(),
90
90
  (0, typeorm_1.ManyToOne)(() => agent_entity_1.AgentEntity, {
@@ -120,6 +120,7 @@ __decorate([
120
120
  ], Task.prototype, "updatedAt", void 0);
121
121
  exports.Task = Task = __decorate([
122
122
  (0, typeorm_1.Entity)('tasks'),
123
+ (0, typeorm_1.Index)(['project', 'status', 'priority']),
123
124
  (0, typeorm_1.Index)(['project', 'status', 'updatedAt']),
124
125
  (0, typeorm_1.Index)(['project', 'updatedAt'])
125
126
  ], Task);
@@ -268,8 +268,8 @@ If no agent is suitable, return your own ID: "${ownerAgent.id}".
268
268
  if (!t)
269
269
  throw new Error(`Task ${task.id} not found for final update`);
270
270
  t.status = task_entity_1.TaskStatus.REVIEW;
271
- t.llm_latency = latency;
272
- t.cost_estimate = (t.cost_estimate || 0) + iterationCost;
271
+ t.llmLatency = latency;
272
+ t.costEstimate = (t.costEstimate || 0) + iterationCost;
273
273
  const savedTask = await manager.save(t);
274
274
  const comment = manager.create(comment_entity_1.TaskComment, {
275
275
  content: response.content,