@bpinhosilva/agent-orchestrator 1.0.0-alpha.31 → 1.0.0-alpha.32
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/CHANGELOG.md +7 -0
- package/dist/system-settings/dto/update-system-settings.dto.d.ts +14 -1
- package/dist/system-settings/dto/update-system-settings.dto.js +77 -4
- package/dist/system-settings/entities/system-settings.entity.d.ts +12 -1
- package/dist/system-settings/system-settings.service.d.ts +0 -23
- package/dist/system-settings/system-settings.service.js +8 -20
- package/dist/tasks/recurrent-task-scheduler.service.d.ts +7 -1
- package/dist/tasks/recurrent-task-scheduler.service.js +40 -7
- package/dist/tasks/task-scheduler.service.d.ts +10 -3
- package/dist/tasks/task-scheduler.service.js +39 -12
- package/dist/tasks/tasks.module.js +2 -0
- package/dist/ui/assets/AgentFleet-B9ZQHHad.js +1 -0
- package/dist/ui/assets/{ConfirmDialog-CkcwaNQU.js → ConfirmDialog-BaFe6hWm.js} +1 -1
- package/dist/ui/assets/{MarkdownField-CctdTNGJ.js → MarkdownField-Cth9aFTE.js} +1 -1
- package/dist/ui/assets/{Profile-Dt9Cr9ID.js → Profile-Dy_gmcSy.js} +1 -1
- package/dist/ui/assets/{ProjectDetail-qH2AAZTi.js → ProjectDetail-CE4h0Hhe.js} +1 -1
- package/dist/ui/assets/Providers-CJkMiYXs.js +1 -0
- package/dist/ui/assets/Scheduler-CsrAlyah.js +1 -0
- package/dist/ui/assets/Settings-C_xisf8p.js +1 -0
- package/dist/ui/assets/{TaskDetail-DcoOOrcL.js → TaskDetail-BQ7gWS-A.js} +1 -1
- package/dist/ui/assets/{TaskManager-CKrFNDP3.js → TaskManager-DSC1aVcJ.js} +1 -1
- package/dist/ui/assets/UserDetail-CYkZ1V6I.js +1 -0
- package/dist/ui/assets/Users-S2ODYJFx.js +1 -0
- package/dist/ui/assets/{database-DCvzb1Ln.js → cpu-C3sglvsN.js} +1 -1
- package/dist/ui/assets/{index-B2axrOIs.js → index-BImV2VVd.js} +3 -2
- package/dist/ui/assets/index-C2UQMCHQ.css +2 -0
- package/dist/ui/assets/{search-CS7DFiLw.js → refresh-cw-DDDq6wp6.js} +1 -1
- package/dist/ui/assets/search-BgZtnvG9.js +1 -0
- package/dist/ui/assets/{taskFormSchemas-DdMj5uS7.js → taskFormSchemas--j-EqGsF.js} +1 -1
- package/dist/ui/assets/terminal-DXcWSHx9.js +1 -0
- package/dist/ui/assets/trending-up-Bh_TRzth.js +1 -0
- package/dist/ui/index.html +3 -3
- package/package.json +1 -1
- package/dist/ui/assets/AgentFleet-BC7f8zM2.js +0 -1
- package/dist/ui/assets/Providers-B54XMRse.js +0 -1
- package/dist/ui/assets/Scheduler-nEIrwyM5.js +0 -1
- package/dist/ui/assets/Settings-Docpy4vj.js +0 -1
- package/dist/ui/assets/UserDetail-B0BX-fYw.js +0 -1
- package/dist/ui/assets/Users-i0A2bsB0.js +0 -1
- package/dist/ui/assets/index-CbC4BxZg.css +0 -2
- package/dist/ui/assets/terminal-C1KxpLUh.js +0 -1
- package/dist/ui/assets/trending-up-B1iQTY5i.js +0 -1
- /package/dist/ui/assets/{cn-DKjtbpik.js → cn-CA_aDFCn.js} +0 -0
- /package/dist/ui/assets/{eye-CYZnDMed.js → eye-FxxhkvZm.js} +0 -0
- /package/dist/ui/assets/{file-text-CPTKEcvU.js → file-text-BIOLTys3.js} +0 -0
- /package/dist/ui/assets/{layers-Cv5Kbvy2.js → layers-B8HRXy0p.js} +0 -0
- /package/dist/ui/assets/{loader-circle-C8SRxjl2.js → loader-circle-DlEV81d2.js} +0 -0
- /package/dist/ui/assets/{rocket-D_szyz9E.js → rocket-Cc0CU430.js} +0 -0
- /package/dist/ui/assets/{save-DZKbCHc6.js → save-BzJ6U33U.js} +0 -0
- /package/dist/ui/assets/{send-OVfBL10t.js → send-u-K1dVSf.js} +0 -0
- /package/dist/ui/assets/{shield-alert-BqmiwlAJ.js → shield-alert-BMQRu-dz.js} +0 -0
- /package/dist/ui/assets/{shield-check-DCdshyB-.js → shield-check-CbBQS6Ds.js} +0 -0
- /package/dist/ui/assets/{tasks-QGA3THUZ.js → tasks-De5SRWOL.js} +0 -0
- /package/dist/ui/assets/{trash-2-BxFsrfIN.js → trash-2-DdCnfswe.js} +0 -0
- /package/dist/ui/assets/{user-Dp-h-An5.js → user-D04GkTX2.js} +0 -0
- /package/dist/ui/assets/{user-plus-CrYvStM7.js → user-plus-QYoMM0_m.js} +0 -0
- /package/dist/ui/assets/{users-B8mDcSH_.js → users-C1voiRNF.js} +0 -0
- /package/dist/ui/assets/{vendor-forms-Djx-6_sr.js → vendor-forms-8omdf67B.js} +0 -0
- /package/dist/ui/assets/{vendor-motion-DUzX9EJL.js → vendor-motion-g6T1ev3V.js} +0 -0
- /package/dist/ui/assets/{zap-Dqr_5eJO.js → zap-DAeeT5Rj.js} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
# [1.0.0-alpha.32](https://github.com/bpinhosilva/agent-orchestrator/compare/v1.0.0-alpha.31...v1.0.0-alpha.32) (2026-04-06)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* enhance task scheduling with dynamic settings and improved error handling ([cbb5097](https://github.com/bpinhosilva/agent-orchestrator/commit/cbb50979f8e79e6cdc581ed29fa0933f82c3e4ee))
|
|
7
|
+
|
|
1
8
|
# [1.0.0-alpha.31](https://github.com/bpinhosilva/agent-orchestrator/compare/v1.0.0-alpha.30...v1.0.0-alpha.31) (2026-04-06)
|
|
2
9
|
|
|
3
10
|
|
|
@@ -1,3 +1,16 @@
|
|
|
1
|
+
export declare class TaskSchedulerSettingsDto {
|
|
2
|
+
pollIntervalInMs: number;
|
|
3
|
+
maxTaskPerExecution: number;
|
|
4
|
+
}
|
|
5
|
+
export declare class RecurrentTasksSchedulerSettingsDto {
|
|
6
|
+
pollIntervalInMs: number;
|
|
7
|
+
executionTimeout: number;
|
|
8
|
+
maxActiveTasks: number;
|
|
9
|
+
}
|
|
10
|
+
export declare class SystemSettingsDataDto {
|
|
11
|
+
taskScheduler: TaskSchedulerSettingsDto;
|
|
12
|
+
recurrentTasksScheduler: RecurrentTasksSchedulerSettingsDto;
|
|
13
|
+
}
|
|
1
14
|
export declare class UpdateSystemSettingsDto {
|
|
2
|
-
data:
|
|
15
|
+
data: SystemSettingsDataDto;
|
|
3
16
|
}
|
|
@@ -9,17 +9,90 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
9
9
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.UpdateSystemSettingsDto = void 0;
|
|
12
|
+
exports.UpdateSystemSettingsDto = exports.SystemSettingsDataDto = exports.RecurrentTasksSchedulerSettingsDto = exports.TaskSchedulerSettingsDto = void 0;
|
|
13
13
|
const openapi = require("@nestjs/swagger");
|
|
14
|
+
const class_transformer_1 = require("class-transformer");
|
|
14
15
|
const class_validator_1 = require("class-validator");
|
|
16
|
+
class TaskSchedulerSettingsDto {
|
|
17
|
+
pollIntervalInMs;
|
|
18
|
+
maxTaskPerExecution;
|
|
19
|
+
static _OPENAPI_METADATA_FACTORY() {
|
|
20
|
+
return { pollIntervalInMs: { required: true, type: () => Number, minimum: 10000 }, maxTaskPerExecution: { required: true, type: () => Number, minimum: 1, maximum: 15 } };
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
exports.TaskSchedulerSettingsDto = TaskSchedulerSettingsDto;
|
|
24
|
+
__decorate([
|
|
25
|
+
(0, class_validator_1.IsInt)(),
|
|
26
|
+
(0, class_validator_1.Min)(10000, {
|
|
27
|
+
message: 'pollIntervalInMs must not be less than 10000 (10 seconds)',
|
|
28
|
+
}),
|
|
29
|
+
__metadata("design:type", Number)
|
|
30
|
+
], TaskSchedulerSettingsDto.prototype, "pollIntervalInMs", void 0);
|
|
31
|
+
__decorate([
|
|
32
|
+
(0, class_validator_1.IsInt)(),
|
|
33
|
+
(0, class_validator_1.Min)(1, { message: 'maxTaskPerExecution must be at least 1' }),
|
|
34
|
+
(0, class_validator_1.Max)(15, { message: 'maxTaskPerExecution must not exceed 15' }),
|
|
35
|
+
__metadata("design:type", Number)
|
|
36
|
+
], TaskSchedulerSettingsDto.prototype, "maxTaskPerExecution", void 0);
|
|
37
|
+
class RecurrentTasksSchedulerSettingsDto {
|
|
38
|
+
pollIntervalInMs;
|
|
39
|
+
executionTimeout;
|
|
40
|
+
maxActiveTasks;
|
|
41
|
+
static _OPENAPI_METADATA_FACTORY() {
|
|
42
|
+
return { pollIntervalInMs: { required: true, type: () => Number, minimum: 15000 }, executionTimeout: { required: true, type: () => Number, minimum: 60000 }, maxActiveTasks: { required: true, type: () => Number, minimum: 1, maximum: 5 } };
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
exports.RecurrentTasksSchedulerSettingsDto = RecurrentTasksSchedulerSettingsDto;
|
|
46
|
+
__decorate([
|
|
47
|
+
(0, class_validator_1.IsInt)(),
|
|
48
|
+
(0, class_validator_1.Min)(15000, {
|
|
49
|
+
message: 'pollIntervalInMs must not be less than 15000 (15 seconds)',
|
|
50
|
+
}),
|
|
51
|
+
__metadata("design:type", Number)
|
|
52
|
+
], RecurrentTasksSchedulerSettingsDto.prototype, "pollIntervalInMs", void 0);
|
|
53
|
+
__decorate([
|
|
54
|
+
(0, class_validator_1.IsInt)(),
|
|
55
|
+
(0, class_validator_1.Min)(60000, {
|
|
56
|
+
message: 'executionTimeout must not be less than 60000 (1 minute)',
|
|
57
|
+
}),
|
|
58
|
+
__metadata("design:type", Number)
|
|
59
|
+
], RecurrentTasksSchedulerSettingsDto.prototype, "executionTimeout", void 0);
|
|
60
|
+
__decorate([
|
|
61
|
+
(0, class_validator_1.IsInt)(),
|
|
62
|
+
(0, class_validator_1.Min)(1, { message: 'maxActiveTasks must be at least 1' }),
|
|
63
|
+
(0, class_validator_1.Max)(5, { message: 'maxActiveTasks must not exceed 5' }),
|
|
64
|
+
__metadata("design:type", Number)
|
|
65
|
+
], RecurrentTasksSchedulerSettingsDto.prototype, "maxActiveTasks", void 0);
|
|
66
|
+
class SystemSettingsDataDto {
|
|
67
|
+
taskScheduler;
|
|
68
|
+
recurrentTasksScheduler;
|
|
69
|
+
static _OPENAPI_METADATA_FACTORY() {
|
|
70
|
+
return { taskScheduler: { required: true, type: () => require("./update-system-settings.dto").TaskSchedulerSettingsDto }, recurrentTasksScheduler: { required: true, type: () => require("./update-system-settings.dto").RecurrentTasksSchedulerSettingsDto } };
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
exports.SystemSettingsDataDto = SystemSettingsDataDto;
|
|
74
|
+
__decorate([
|
|
75
|
+
(0, class_validator_1.IsNotEmpty)(),
|
|
76
|
+
(0, class_validator_1.ValidateNested)(),
|
|
77
|
+
(0, class_transformer_1.Type)(() => TaskSchedulerSettingsDto),
|
|
78
|
+
__metadata("design:type", TaskSchedulerSettingsDto)
|
|
79
|
+
], SystemSettingsDataDto.prototype, "taskScheduler", void 0);
|
|
80
|
+
__decorate([
|
|
81
|
+
(0, class_validator_1.IsNotEmpty)(),
|
|
82
|
+
(0, class_validator_1.ValidateNested)(),
|
|
83
|
+
(0, class_transformer_1.Type)(() => RecurrentTasksSchedulerSettingsDto),
|
|
84
|
+
__metadata("design:type", RecurrentTasksSchedulerSettingsDto)
|
|
85
|
+
], SystemSettingsDataDto.prototype, "recurrentTasksScheduler", void 0);
|
|
15
86
|
class UpdateSystemSettingsDto {
|
|
16
87
|
data;
|
|
17
88
|
static _OPENAPI_METADATA_FACTORY() {
|
|
18
|
-
return { data: { required: true, type: () =>
|
|
89
|
+
return { data: { required: true, type: () => require("./update-system-settings.dto").SystemSettingsDataDto } };
|
|
19
90
|
}
|
|
20
91
|
}
|
|
21
92
|
exports.UpdateSystemSettingsDto = UpdateSystemSettingsDto;
|
|
22
93
|
__decorate([
|
|
23
|
-
(0, class_validator_1.
|
|
24
|
-
|
|
94
|
+
(0, class_validator_1.IsNotEmpty)(),
|
|
95
|
+
(0, class_validator_1.ValidateNested)(),
|
|
96
|
+
(0, class_transformer_1.Type)(() => SystemSettingsDataDto),
|
|
97
|
+
__metadata("design:type", SystemSettingsDataDto)
|
|
25
98
|
], UpdateSystemSettingsDto.prototype, "data", void 0);
|
|
@@ -1,6 +1,17 @@
|
|
|
1
|
+
export interface SystemSettingsData {
|
|
2
|
+
taskScheduler: {
|
|
3
|
+
pollIntervalInMs: number;
|
|
4
|
+
maxTaskPerExecution: number;
|
|
5
|
+
};
|
|
6
|
+
recurrentTasksScheduler: {
|
|
7
|
+
pollIntervalInMs: number;
|
|
8
|
+
executionTimeout: number;
|
|
9
|
+
maxActiveTasks: number;
|
|
10
|
+
};
|
|
11
|
+
}
|
|
1
12
|
export declare class SystemSettings {
|
|
2
13
|
id: string;
|
|
3
|
-
data:
|
|
14
|
+
data: SystemSettingsData;
|
|
4
15
|
createdAt: Date;
|
|
5
16
|
updatedAt: Date;
|
|
6
17
|
}
|
|
@@ -1,29 +1,6 @@
|
|
|
1
1
|
import { Repository } from 'typeorm';
|
|
2
2
|
import { SystemSettings } from './entities/system-settings.entity';
|
|
3
3
|
import { UpdateSystemSettingsDto } from './dto/update-system-settings.dto';
|
|
4
|
-
export interface SystemSettingsData {
|
|
5
|
-
scheduler: {
|
|
6
|
-
pollInterval: number;
|
|
7
|
-
watchdogTimeout: number;
|
|
8
|
-
queueFlushFrequency: number;
|
|
9
|
-
heartbeatPeriod: number;
|
|
10
|
-
retryBackoffMultiplier: string;
|
|
11
|
-
maxExecutionWindow: number;
|
|
12
|
-
};
|
|
13
|
-
cluster: {
|
|
14
|
-
broadcastFrequency: number;
|
|
15
|
-
defaultLlmProvider: string;
|
|
16
|
-
systemAliasId: string;
|
|
17
|
-
};
|
|
18
|
-
persistence: {
|
|
19
|
-
retentionDays: number;
|
|
20
|
-
};
|
|
21
|
-
ui: {
|
|
22
|
-
darkModeEnabled: boolean;
|
|
23
|
-
primaryHexAccent: string;
|
|
24
|
-
};
|
|
25
|
-
[key: string]: any;
|
|
26
|
-
}
|
|
27
4
|
export declare class SystemSettingsService {
|
|
28
5
|
private readonly repository;
|
|
29
6
|
constructor(repository: Repository<SystemSettings>);
|
|
@@ -23,25 +23,14 @@ let SystemSettingsService = class SystemSettingsService {
|
|
|
23
23
|
this.repository = repository;
|
|
24
24
|
}
|
|
25
25
|
defaultSettings = {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
queueFlushFrequency: 1500,
|
|
30
|
-
heartbeatPeriod: 10,
|
|
31
|
-
retryBackoffMultiplier: '1.5x',
|
|
32
|
-
maxExecutionWindow: 45000,
|
|
26
|
+
taskScheduler: {
|
|
27
|
+
pollIntervalInMs: 20000,
|
|
28
|
+
maxTaskPerExecution: 5,
|
|
33
29
|
},
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
},
|
|
39
|
-
persistence: {
|
|
40
|
-
retentionDays: 30,
|
|
41
|
-
},
|
|
42
|
-
ui: {
|
|
43
|
-
darkModeEnabled: true,
|
|
44
|
-
primaryHexAccent: '#adc6ff',
|
|
30
|
+
recurrentTasksScheduler: {
|
|
31
|
+
pollIntervalInMs: 15000,
|
|
32
|
+
executionTimeout: 120000,
|
|
33
|
+
maxActiveTasks: 5,
|
|
45
34
|
},
|
|
46
35
|
};
|
|
47
36
|
async getSettings() {
|
|
@@ -54,8 +43,7 @@ let SystemSettingsService = class SystemSettingsService {
|
|
|
54
43
|
async updateSettings(updateDto) {
|
|
55
44
|
const settings = await this.repository.findOne({ where: {} });
|
|
56
45
|
if (!settings) {
|
|
57
|
-
const
|
|
58
|
-
const newSettings = this.repository.create({ data });
|
|
46
|
+
const newSettings = this.repository.create({ data: updateDto.data });
|
|
59
47
|
return this.repository.save(newSettings);
|
|
60
48
|
}
|
|
61
49
|
else {
|
|
@@ -4,17 +4,23 @@ import { SchedulerRegistry } from '@nestjs/schedule';
|
|
|
4
4
|
import { RecurrentTask } from './entities/recurrent-task.entity';
|
|
5
5
|
import { RecurrentTaskExec } from './entities/recurrent-task-exec.entity';
|
|
6
6
|
import { AgentsService } from '../agents/agents.service';
|
|
7
|
+
import { SystemSettingsService } from '../system-settings/system-settings.service';
|
|
7
8
|
export declare class RecurrentTaskSchedulerService implements OnApplicationBootstrap, OnModuleDestroy {
|
|
8
9
|
private readonly recurrentTaskRepository;
|
|
9
10
|
private readonly execRepository;
|
|
10
11
|
private readonly schedulerRegistry;
|
|
11
12
|
private readonly agentsService;
|
|
13
|
+
private readonly systemSettingsService;
|
|
12
14
|
private readonly logger;
|
|
13
15
|
private runningTasks;
|
|
14
16
|
private syncInterval;
|
|
15
|
-
|
|
17
|
+
private pollIntervalInMs;
|
|
18
|
+
private executionTimeout;
|
|
19
|
+
private maxActiveTasks;
|
|
20
|
+
constructor(recurrentTaskRepository: Repository<RecurrentTask>, execRepository: Repository<RecurrentTaskExec>, schedulerRegistry: SchedulerRegistry, agentsService: AgentsService, systemSettingsService: SystemSettingsService);
|
|
16
21
|
onApplicationBootstrap(): Promise<void>;
|
|
17
22
|
onModuleDestroy(): void;
|
|
23
|
+
private scheduleSyncInterval;
|
|
18
24
|
unregisterTasks(taskId: string): void;
|
|
19
25
|
private registerActiveTasks;
|
|
20
26
|
executeTask(taskId: string): Promise<void>;
|
|
@@ -22,26 +22,30 @@ const cron_1 = require("cron");
|
|
|
22
22
|
const recurrent_task_entity_1 = require("./entities/recurrent-task.entity");
|
|
23
23
|
const recurrent_task_exec_entity_1 = require("./entities/recurrent-task-exec.entity");
|
|
24
24
|
const agents_service_1 = require("../agents/agents.service");
|
|
25
|
+
const system_settings_service_1 = require("../system-settings/system-settings.service");
|
|
25
26
|
let RecurrentTaskSchedulerService = RecurrentTaskSchedulerService_1 = class RecurrentTaskSchedulerService {
|
|
26
27
|
recurrentTaskRepository;
|
|
27
28
|
execRepository;
|
|
28
29
|
schedulerRegistry;
|
|
29
30
|
agentsService;
|
|
31
|
+
systemSettingsService;
|
|
30
32
|
logger = new common_1.Logger(RecurrentTaskSchedulerService_1.name);
|
|
31
33
|
runningTasks = new Map();
|
|
32
34
|
syncInterval = null;
|
|
33
|
-
|
|
35
|
+
pollIntervalInMs = 15000;
|
|
36
|
+
executionTimeout = 120000;
|
|
37
|
+
maxActiveTasks = 5;
|
|
38
|
+
constructor(recurrentTaskRepository, execRepository, schedulerRegistry, agentsService, systemSettingsService) {
|
|
34
39
|
this.recurrentTaskRepository = recurrentTaskRepository;
|
|
35
40
|
this.execRepository = execRepository;
|
|
36
41
|
this.schedulerRegistry = schedulerRegistry;
|
|
37
42
|
this.agentsService = agentsService;
|
|
43
|
+
this.systemSettingsService = systemSettingsService;
|
|
38
44
|
}
|
|
39
45
|
async onApplicationBootstrap() {
|
|
40
46
|
this.logger.log('Initializing Recurrent Task Scheduler...');
|
|
41
|
-
this.syncInterval = setInterval(() => {
|
|
42
|
-
void this.registerActiveTasks();
|
|
43
|
-
}, 15000);
|
|
44
47
|
await this.registerActiveTasks();
|
|
48
|
+
this.scheduleSyncInterval();
|
|
45
49
|
}
|
|
46
50
|
onModuleDestroy() {
|
|
47
51
|
if (this.syncInterval) {
|
|
@@ -49,6 +53,13 @@ let RecurrentTaskSchedulerService = RecurrentTaskSchedulerService_1 = class Recu
|
|
|
49
53
|
this.syncInterval = null;
|
|
50
54
|
}
|
|
51
55
|
}
|
|
56
|
+
scheduleSyncInterval() {
|
|
57
|
+
if (this.syncInterval)
|
|
58
|
+
clearInterval(this.syncInterval);
|
|
59
|
+
this.syncInterval = setInterval(() => {
|
|
60
|
+
void this.registerActiveTasks();
|
|
61
|
+
}, this.pollIntervalInMs);
|
|
62
|
+
}
|
|
52
63
|
unregisterTasks(taskId) {
|
|
53
64
|
const jobName = `recurrent-task-${taskId}`;
|
|
54
65
|
if (this.schedulerRegistry.doesExist('cron', jobName)) {
|
|
@@ -59,6 +70,23 @@ let RecurrentTaskSchedulerService = RecurrentTaskSchedulerService_1 = class Recu
|
|
|
59
70
|
}
|
|
60
71
|
}
|
|
61
72
|
async registerActiveTasks() {
|
|
73
|
+
const prevInterval = this.pollIntervalInMs;
|
|
74
|
+
try {
|
|
75
|
+
const settings = await this.systemSettingsService.getSettings();
|
|
76
|
+
this.pollIntervalInMs =
|
|
77
|
+
settings.data.recurrentTasksScheduler.pollIntervalInMs;
|
|
78
|
+
this.executionTimeout =
|
|
79
|
+
settings.data.recurrentTasksScheduler.executionTimeout;
|
|
80
|
+
this.maxActiveTasks =
|
|
81
|
+
settings.data.recurrentTasksScheduler.maxActiveTasks;
|
|
82
|
+
}
|
|
83
|
+
catch (error) {
|
|
84
|
+
this.logger.warn(`Could not refresh settings, using current values (pollIntervalInMs=${this.pollIntervalInMs}, executionTimeout=${this.executionTimeout}, maxActiveTasks=${this.maxActiveTasks}). Error: ${error instanceof Error ? error.message : String(error)}`);
|
|
85
|
+
}
|
|
86
|
+
if (this.pollIntervalInMs !== prevInterval && this.syncInterval !== null) {
|
|
87
|
+
this.logger.log(`Poll interval changed from ${prevInterval}ms to ${this.pollIntervalInMs}ms. Rescheduling.`);
|
|
88
|
+
this.scheduleSyncInterval();
|
|
89
|
+
}
|
|
62
90
|
const activeTasks = await this.recurrentTaskRepository.find({
|
|
63
91
|
where: { status: recurrent_task_entity_1.RecurrentTaskStatus.ACTIVE },
|
|
64
92
|
relations: ['assignee'],
|
|
@@ -99,11 +127,15 @@ let RecurrentTaskSchedulerService = RecurrentTaskSchedulerService_1 = class Recu
|
|
|
99
127
|
}
|
|
100
128
|
}
|
|
101
129
|
async executeTask(taskId) {
|
|
130
|
+
if (this.runningTasks.size >= this.maxActiveTasks) {
|
|
131
|
+
this.logger.debug(`Max active tasks (${this.maxActiveTasks}) reached. Skipping ${taskId}.`);
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
102
134
|
const running = this.runningTasks.get(taskId);
|
|
103
135
|
if (running) {
|
|
104
136
|
const elapsed = Date.now() - running.startTime;
|
|
105
|
-
if (elapsed >
|
|
106
|
-
this.logger.warn(`Task ${taskId} running for >
|
|
137
|
+
if (elapsed > this.executionTimeout) {
|
|
138
|
+
this.logger.warn(`Task ${taskId} running for > ${this.executionTimeout}ms. Canceling.`);
|
|
107
139
|
await this.execRepository.update(running.execId, {
|
|
108
140
|
status: recurrent_task_exec_entity_1.ExecStatus.CANCELED,
|
|
109
141
|
result: 'Canceled due to timeout (> 2 mins)',
|
|
@@ -165,5 +197,6 @@ exports.RecurrentTaskSchedulerService = RecurrentTaskSchedulerService = Recurren
|
|
|
165
197
|
__metadata("design:paramtypes", [typeorm_2.Repository,
|
|
166
198
|
typeorm_2.Repository,
|
|
167
199
|
schedule_1.SchedulerRegistry,
|
|
168
|
-
agents_service_1.AgentsService
|
|
200
|
+
agents_service_1.AgentsService,
|
|
201
|
+
system_settings_service_1.SystemSettingsService])
|
|
169
202
|
], RecurrentTaskSchedulerService);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { OnApplicationBootstrap } from '@nestjs/common';
|
|
1
|
+
import { OnApplicationBootstrap, OnModuleDestroy } from '@nestjs/common';
|
|
2
2
|
import { Repository } from 'typeorm';
|
|
3
3
|
import { ConfigService } from '@nestjs/config';
|
|
4
4
|
import { Project } from '../projects/entities/project.entity';
|
|
@@ -8,7 +8,8 @@ import { TaskComment } from './entities/comment.entity';
|
|
|
8
8
|
import { StorageService } from '../common/storage.service';
|
|
9
9
|
import { StoragePathHelper } from '../common/storage-path.helper';
|
|
10
10
|
import { TasksService } from './tasks.service';
|
|
11
|
-
|
|
11
|
+
import { SystemSettingsService } from '../system-settings/system-settings.service';
|
|
12
|
+
export declare class TaskSchedulerService implements OnApplicationBootstrap, OnModuleDestroy {
|
|
12
13
|
private readonly projectRepository;
|
|
13
14
|
private readonly taskRepository;
|
|
14
15
|
private readonly commentRepository;
|
|
@@ -17,10 +18,16 @@ export declare class TaskSchedulerService implements OnApplicationBootstrap {
|
|
|
17
18
|
private readonly storagePathHelper;
|
|
18
19
|
private readonly tasksService;
|
|
19
20
|
private readonly configService;
|
|
21
|
+
private readonly systemSettingsService;
|
|
20
22
|
private readonly logger;
|
|
21
23
|
private readonly schedulerEnabled;
|
|
22
|
-
|
|
24
|
+
private pollIntervalInMs;
|
|
25
|
+
private maxTaskPerExecution;
|
|
26
|
+
private intervalRef;
|
|
27
|
+
constructor(projectRepository: Repository<Project>, taskRepository: Repository<Task>, commentRepository: Repository<TaskComment>, agentsService: AgentsService, storageService: StorageService, storagePathHelper: StoragePathHelper, tasksService: TasksService, configService: ConfigService, systemSettingsService: SystemSettingsService);
|
|
23
28
|
onApplicationBootstrap(): Promise<void>;
|
|
29
|
+
onModuleDestroy(): void;
|
|
30
|
+
private scheduleInterval;
|
|
24
31
|
handleTaskScheduling(): Promise<void>;
|
|
25
32
|
private processProject;
|
|
26
33
|
private assignTask;
|
|
@@ -17,7 +17,6 @@ exports.TaskSchedulerService = void 0;
|
|
|
17
17
|
const common_1 = require("@nestjs/common");
|
|
18
18
|
const typeorm_1 = require("@nestjs/typeorm");
|
|
19
19
|
const typeorm_2 = require("typeorm");
|
|
20
|
-
const schedule_1 = require("@nestjs/schedule");
|
|
21
20
|
const config_1 = require("@nestjs/config");
|
|
22
21
|
const project_entity_1 = require("../projects/entities/project.entity");
|
|
23
22
|
const task_entity_1 = require("./entities/task.entity");
|
|
@@ -26,6 +25,7 @@ const comment_entity_1 = require("./entities/comment.entity");
|
|
|
26
25
|
const storage_service_1 = require("../common/storage.service");
|
|
27
26
|
const storage_path_helper_1 = require("../common/storage-path.helper");
|
|
28
27
|
const tasks_service_1 = require("./tasks.service");
|
|
28
|
+
const system_settings_service_1 = require("../system-settings/system-settings.service");
|
|
29
29
|
let TaskSchedulerService = TaskSchedulerService_1 = class TaskSchedulerService {
|
|
30
30
|
projectRepository;
|
|
31
31
|
taskRepository;
|
|
@@ -35,9 +35,13 @@ let TaskSchedulerService = TaskSchedulerService_1 = class TaskSchedulerService {
|
|
|
35
35
|
storagePathHelper;
|
|
36
36
|
tasksService;
|
|
37
37
|
configService;
|
|
38
|
+
systemSettingsService;
|
|
38
39
|
logger = new common_1.Logger(TaskSchedulerService_1.name);
|
|
39
40
|
schedulerEnabled;
|
|
40
|
-
|
|
41
|
+
pollIntervalInMs = 20000;
|
|
42
|
+
maxTaskPerExecution = 5;
|
|
43
|
+
intervalRef = null;
|
|
44
|
+
constructor(projectRepository, taskRepository, commentRepository, agentsService, storageService, storagePathHelper, tasksService, configService, systemSettingsService) {
|
|
41
45
|
this.projectRepository = projectRepository;
|
|
42
46
|
this.taskRepository = taskRepository;
|
|
43
47
|
this.commentRepository = commentRepository;
|
|
@@ -46,6 +50,7 @@ let TaskSchedulerService = TaskSchedulerService_1 = class TaskSchedulerService {
|
|
|
46
50
|
this.storagePathHelper = storagePathHelper;
|
|
47
51
|
this.tasksService = tasksService;
|
|
48
52
|
this.configService = configService;
|
|
53
|
+
this.systemSettingsService = systemSettingsService;
|
|
49
54
|
this.schedulerEnabled =
|
|
50
55
|
this.configService.get('SCHEDULER_ENABLED') !== false;
|
|
51
56
|
}
|
|
@@ -54,12 +59,40 @@ let TaskSchedulerService = TaskSchedulerService_1 = class TaskSchedulerService {
|
|
|
54
59
|
this.logger.log('Task Scheduler is disabled (SCHEDULER_ENABLED=false). Skipping.');
|
|
55
60
|
return;
|
|
56
61
|
}
|
|
57
|
-
this.logger.log('Task Scheduler
|
|
62
|
+
this.logger.log('Task Scheduler initializing. First run starting...');
|
|
58
63
|
await this.handleTaskScheduling();
|
|
64
|
+
this.scheduleInterval();
|
|
65
|
+
}
|
|
66
|
+
onModuleDestroy() {
|
|
67
|
+
if (this.intervalRef) {
|
|
68
|
+
clearInterval(this.intervalRef);
|
|
69
|
+
this.intervalRef = null;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
scheduleInterval() {
|
|
73
|
+
if (this.intervalRef)
|
|
74
|
+
clearInterval(this.intervalRef);
|
|
75
|
+
this.intervalRef = setInterval(() => {
|
|
76
|
+
void this.handleTaskScheduling();
|
|
77
|
+
}, this.pollIntervalInMs);
|
|
59
78
|
}
|
|
60
79
|
async handleTaskScheduling() {
|
|
61
80
|
if (!this.schedulerEnabled)
|
|
62
81
|
return;
|
|
82
|
+
const prevInterval = this.pollIntervalInMs;
|
|
83
|
+
try {
|
|
84
|
+
const settings = await this.systemSettingsService.getSettings();
|
|
85
|
+
this.pollIntervalInMs = settings.data.taskScheduler.pollIntervalInMs;
|
|
86
|
+
this.maxTaskPerExecution =
|
|
87
|
+
settings.data.taskScheduler.maxTaskPerExecution;
|
|
88
|
+
}
|
|
89
|
+
catch (error) {
|
|
90
|
+
this.logger.warn(`Could not refresh settings, using current values (pollIntervalInMs=${this.pollIntervalInMs}, maxTaskPerExecution=${this.maxTaskPerExecution}). Error: ${error instanceof Error ? error.message : String(error)}`);
|
|
91
|
+
}
|
|
92
|
+
if (this.pollIntervalInMs !== prevInterval && this.intervalRef !== null) {
|
|
93
|
+
this.logger.log(`Poll interval changed from ${prevInterval}ms to ${this.pollIntervalInMs}ms. Rescheduling.`);
|
|
94
|
+
this.scheduleInterval();
|
|
95
|
+
}
|
|
63
96
|
this.logger.debug('Running Task Scheduler job...');
|
|
64
97
|
try {
|
|
65
98
|
const activeProjects = await this.projectRepository.find({
|
|
@@ -87,8 +120,7 @@ let TaskSchedulerService = TaskSchedulerService_1 = class TaskSchedulerService {
|
|
|
87
120
|
}
|
|
88
121
|
let hasMoreTasks = true;
|
|
89
122
|
let iterationCount = 0;
|
|
90
|
-
|
|
91
|
-
while (hasMoreTasks && iterationCount < MAX_TASKS_PER_RUN) {
|
|
123
|
+
while (hasMoreTasks && iterationCount < this.maxTaskPerExecution) {
|
|
92
124
|
const tasks = await this.taskRepository.find({
|
|
93
125
|
where: {
|
|
94
126
|
project: { id: project.id },
|
|
@@ -259,12 +291,6 @@ If no agent is suitable, return your own ID: "${ownerAgent.id}".
|
|
|
259
291
|
}
|
|
260
292
|
};
|
|
261
293
|
exports.TaskSchedulerService = TaskSchedulerService;
|
|
262
|
-
__decorate([
|
|
263
|
-
(0, schedule_1.Cron)('*/45 * * * * *'),
|
|
264
|
-
__metadata("design:type", Function),
|
|
265
|
-
__metadata("design:paramtypes", []),
|
|
266
|
-
__metadata("design:returntype", Promise)
|
|
267
|
-
], TaskSchedulerService.prototype, "handleTaskScheduling", null);
|
|
268
294
|
exports.TaskSchedulerService = TaskSchedulerService = TaskSchedulerService_1 = __decorate([
|
|
269
295
|
(0, common_1.Injectable)(),
|
|
270
296
|
__param(0, (0, typeorm_1.InjectRepository)(project_entity_1.Project)),
|
|
@@ -277,5 +303,6 @@ exports.TaskSchedulerService = TaskSchedulerService = TaskSchedulerService_1 = _
|
|
|
277
303
|
storage_service_1.StorageService,
|
|
278
304
|
storage_path_helper_1.StoragePathHelper,
|
|
279
305
|
tasks_service_1.TasksService,
|
|
280
|
-
config_1.ConfigService
|
|
306
|
+
config_1.ConfigService,
|
|
307
|
+
system_settings_service_1.SystemSettingsService])
|
|
281
308
|
], TaskSchedulerService);
|
|
@@ -26,6 +26,7 @@ const recurrent_task_exec_entity_1 = require("./entities/recurrent-task-exec.ent
|
|
|
26
26
|
const recurrent_tasks_controller_1 = require("./recurrent-tasks.controller");
|
|
27
27
|
const recurrent_tasks_service_1 = require("./recurrent-tasks.service");
|
|
28
28
|
const recurrent_task_scheduler_service_1 = require("./recurrent-task-scheduler.service");
|
|
29
|
+
const system_settings_module_1 = require("../system-settings/system-settings.module");
|
|
29
30
|
let TasksModule = class TasksModule {
|
|
30
31
|
};
|
|
31
32
|
exports.TasksModule = TasksModule;
|
|
@@ -43,6 +44,7 @@ exports.TasksModule = TasksModule = __decorate([
|
|
|
43
44
|
]),
|
|
44
45
|
agents_module_1.AgentsModule,
|
|
45
46
|
projects_module_1.ProjectsModule,
|
|
47
|
+
system_settings_module_1.SystemSettingsModule,
|
|
46
48
|
],
|
|
47
49
|
controllers: [tasks_controller_1.TasksController, comments_controller_1.CommentsController, recurrent_tasks_controller_1.RecurrentTasksController],
|
|
48
50
|
providers: [
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{g as t}from"./vendor-dnd-CxfOy4-Z.js";import{i as n,n as r,t as i}from"./vendor-query-DQlZ8h7P.js";import{r as a}from"./vendor-markdown-Dl_1qnne.js";import{i as o}from"./client-CylGrWpP.js";import{t as s}from"./activity-D2aBFbnN.js";import{t as c}from"./box-3f35ZKNV.js";import{t as l}from"./brain-DwFWAhZ9.js";import{t as u}from"./check-BhOeS9mA.js";import{t as d}from"./chevron-down-DOfOMDZp.js";import{n as f,t as p}from"./terminal-DXcWSHx9.js";import{n as m,t as h}from"./sparkles-BYfDbPNH.js";import{i as g,r as _,t as v}from"./providers-BLAJFnS4.js";import{t as y}from"./layers-B8HRXy0p.js";import{t as b}from"./loader-circle-DlEV81d2.js";import{t as x}from"./send-u-K1dVSf.js";import{t as S}from"./trash-2-DdCnfswe.js";import{t as C}from"./ConfirmDialog-BaFe6hWm.js";import{n as w,t as T}from"./vendor-motion-g6T1ev3V.js";import{C as E,S as ee,_ as D,c as te,h as O,l as k,u as A,y as j}from"./index-BImV2VVd.js";import{t as ne}from"./MarkdownField-Cth9aFTE.js";import{c as M,l as N,o as P,r as F,s as I,t as L}from"./taskFormSchemas--j-EqGsF.js";import{a as R,c as z,o as B,s as re}from"./vendor-forms-8omdf67B.js";import"./tasks-De5SRWOL.js";var V=o(`grid-2x2`,[[`path`,{d:`M12 3v18`,key:`108xh3`}],[`path`,{d:`M3 12h18`,key:`1i2n21`}],[`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`,key:`h1oib`}]]),H=o(`image`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}],[`circle`,{cx:`9`,cy:`9`,r:`2`,key:`af1f0g`}],[`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`,key:`1xmnt7`}]]),U=o(`list`,[[`path`,{d:`M3 5h.01`,key:`18ugdj`}],[`path`,{d:`M3 12h.01`,key:`nlz23k`}],[`path`,{d:`M3 19h.01`,key:`noohij`}],[`path`,{d:`M8 5h13`,key:`1pao27`}],[`path`,{d:`M8 12h13`,key:`1za7za`}],[`path`,{d:`M8 19h13`,key:`m83p4d`}]]),ie=o(`pen`,[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}]]),ae=o(`shield`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}]]),W=e(t(),1),G=a(),K=({id:e,name:t,emoji:n,expertise:r,model:i,status:a,metricLabel:o,metricValue:c,onProbe:u,onConfigure:d,onDelete:m,onActivate:g})=>{let[v,y]=(0,W.useState)(!1),b=(0,W.useRef)(null),x={active:{color:`text-secondary`,bg:`bg-secondary/10`,dot:`bg-secondary`,animate:`animate-pulse`,icon:l},idle:{color:`text-on-surface-variant`,bg:`bg-on-surface-variant/10`,dot:`bg-on-surface-variant`,animate:``,icon:h},updating:{color:`text-primary`,bg:`bg-primary/10`,dot:`bg-primary`,animate:`animate-ping`,icon:s},inactive:{color:`text-error/60`,bg:`bg-error/5`,dot:`bg-error/40`,animate:``,icon:f}}[a];return(0,W.useEffect)(()=>{let e=e=>{b.current&&!b.current.contains(e.target)&&y(!1)};return v&&document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[v]),(0,G.jsxs)(`div`,{className:`group relative bg-surface-container-low rounded-xl p-6 transition-all duration-300 hover:translate-y-[-4px] shadow-lg border border-transparent hover:border-outline-variant/20`,children:[(0,G.jsxs)(`div`,{className:`absolute top-4 right-4 flex items-center gap-1.5 px-2.5 py-1 rounded-full ${x.bg} ${x.color} text-[10px] font-bold tracking-widest uppercase`,children:[(0,G.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full ${x.dot} ${x.animate}`}),a]}),(0,G.jsxs)(`div`,{className:`flex gap-5`,children:[(0,G.jsx)(`div`,{className:`w-16 h-16 rounded-xl bg-surface-container-high flex items-center justify-center ring-1 ring-outline-variant/30 group-hover:ring-primary/50 transition-all text-3xl`,children:(0,G.jsx)(`span`,{"aria-hidden":`true`,children:n??`🧠`})}),(0,G.jsxs)(`div`,{className:`flex-1`,children:[(0,G.jsx)(`h3`,{className:`text-lg font-bold font-headline text-white`,children:t}),(0,G.jsx)(`p`,{className:`text-on-surface-variant text-xs mt-1`,children:r}),(0,G.jsxs)(`div`,{className:`mt-4 flex items-center gap-4`,children:[(0,G.jsxs)(`div`,{className:`flex flex-col`,children:[(0,G.jsx)(`span`,{className:`text-[10px] text-on-surface-variant/60 uppercase tracking-tighter`,children:`Model`}),(0,G.jsx)(`span`,{className:`text-xs font-semibold text-primary`,children:i})]}),(0,G.jsxs)(`div`,{className:`flex flex-col`,children:[(0,G.jsx)(`span`,{className:`text-[10px] text-on-surface-variant/60 uppercase tracking-tighter`,children:o}),(0,G.jsx)(`span`,{className:`text-xs font-semibold ${x.color}`,children:c})]})]})]})]}),(0,G.jsxs)(`div`,{className:`mt-6 flex gap-2`,children:[(0,G.jsx)(`button`,{onClick:t=>{t.stopPropagation(),d?.(e)},className:`flex-1 py-2 rounded bg-surface-container-high text-xs font-semibold text-on-surface hover:bg-surface-container-highest transition-colors`,children:`Configure`}),(0,G.jsxs)(`div`,{className:`relative`,ref:b,children:[(0,G.jsx)(`button`,{onClick:e=>{e.stopPropagation(),y(!v)},"aria-label":`Agent actions menu`,className:`px-3 py-2 rounded bg-surface-container-high text-on-surface-variant hover:text-white transition-colors h-full ${v?`bg-surface-container-highest text-white`:``}`,children:(0,G.jsx)(_,{size:16,"aria-hidden":`true`})}),v&&(0,G.jsxs)(`div`,{className:`absolute bottom-full right-0 mb-2 w-48 bg-surface-container-highest rounded-lg shadow-2xl py-2 ring-1 ring-outline-variant/20 animate-in fade-in slide-in-from-bottom-2 duration-200 z-20`,children:[(0,G.jsxs)(`button`,{onClick:t=>{t.stopPropagation(),u?.(e),y(!1)},disabled:a===`inactive`,className:`w-full flex items-center gap-3 px-4 py-2.5 text-xs text-on-surface-variant hover:text-white hover:bg-primary/10 transition-colors group disabled:opacity-30 disabled:grayscale disabled:cursor-not-allowed`,children:[(0,G.jsx)(p,{size:14,className:`group-hover:text-primary`}),`Probe Agent`]}),(0,G.jsxs)(`button`,{onClick:t=>{t.stopPropagation(),d?.(e),y(!1)},className:`w-full flex items-center gap-3 px-4 py-2.5 text-xs text-on-surface-variant hover:text-white hover:bg-white/5 transition-colors`,children:[(0,G.jsx)(D,{size:14}),`Control Matrix`]}),(0,G.jsx)(`div`,{className:`my-1 border-t border-outline-variant/10`}),a===`inactive`?(0,G.jsxs)(`button`,{onClick:t=>{t.stopPropagation(),g?.(e),y(!1)},className:`w-full flex items-center gap-3 px-4 py-2.5 text-xs text-secondary/60 hover:text-secondary hover:bg-secondary/10 transition-colors`,children:[(0,G.jsx)(l,{size:14}),`Activate Node`]}):(0,G.jsxs)(`button`,{onClick:t=>{t.stopPropagation(),m?.(e),y(!1)},className:`w-full flex items-center gap-3 px-4 py-2.5 text-xs text-error/60 hover:text-error hover:bg-error/10 transition-colors`,children:[(0,G.jsx)(S,{size:14}),`Decommission`]})]})]})]})]})},oe=({isOpen:e,selectedEmoji:t,currentEmoji:n,isSaving:r,onSelect:i,onClose:a,onConfirm:o})=>((0,W.useEffect)(()=>{if(!e)return;let t=e=>{e.key===`Escape`&&!r&&a()};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[e,r,a]),e?(0,G.jsxs)(`div`,{className:`fixed inset-0 z-[110] flex items-center justify-center bg-black/70 px-4 py-8 backdrop-blur-md`,children:[(0,G.jsx)(`div`,{className:`absolute inset-0`,"aria-hidden":`true`,onClick:()=>{r||a()}}),(0,G.jsxs)(`div`,{role:`dialog`,"aria-modal":`true`,"aria-labelledby":`agent-emoji-picker-title`,className:`relative w-full max-w-3xl overflow-hidden rounded-[28px] border border-outline-variant/20 bg-surface shadow-[0_35px_120px_rgba(0,0,0,0.55)]`,children:[(0,G.jsx)(`div`,{className:`absolute inset-0 bg-[radial-gradient(circle_at_top_left,rgba(173,198,255,0.16),transparent_35%),radial-gradient(circle_at_bottom_right,rgba(197,255,191,0.12),transparent_32%)]`}),(0,G.jsx)(`div`,{className:`relative border-b border-outline-variant/10 px-6 py-5`,children:(0,G.jsxs)(`div`,{className:`mb-3 flex items-start justify-between gap-4`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`div`,{className:`mb-2 inline-flex items-center gap-2 rounded-full border border-primary/20 bg-primary/10 px-3 py-1 text-[10px] font-black uppercase tracking-[0.32em] text-primary`,children:[(0,G.jsx)(h,{size:12}),`Agent identity`]}),(0,G.jsx)(`h2`,{id:`agent-emoji-picker-title`,className:`font-headline text-2xl font-black tracking-tight text-on-surface`,children:`Choose an emoji signature`}),(0,G.jsx)(`p`,{className:`mt-2 max-w-xl text-sm leading-relaxed text-on-surface-variant`,children:`Pick one of the built-in native emojis to mark this agent across the fleet, tasks, and comments.`})]}),(0,G.jsx)(`button`,{type:`button`,onClick:a,disabled:r,"aria-label":`Close emoji picker`,className:`rounded-full border border-outline-variant/20 p-2 text-on-surface-variant transition-colors hover:bg-surface-container-high hover:text-on-surface disabled:cursor-not-allowed disabled:opacity-50`,children:(0,G.jsx)(O,{size:18})})]})}),(0,G.jsxs)(`div`,{className:`relative p-6`,children:[(0,G.jsx)(`div`,{className:`grid grid-cols-2 gap-4 md:grid-cols-5`,children:P.map(e=>{let r=e.value===t,a=e.value===n;return(0,G.jsxs)(`button`,{type:`button`,onClick:()=>i(e.value),className:`group relative overflow-hidden rounded-3xl border p-4 text-left transition-all duration-200 ${r?`border-primary bg-primary/10 shadow-[0_18px_35px_rgba(173,198,255,0.16)]`:`border-outline-variant/20 bg-surface-container-low/80 hover:-translate-y-0.5 hover:border-primary/35 hover:bg-surface-container-high`}`,"aria-pressed":r,"aria-label":`${e.label} emoji ${e.value}`,children:[(0,G.jsx)(`div`,{className:`mb-4 flex h-16 w-16 items-center justify-center rounded-2xl border border-white/5 bg-surface-container-high text-4xl shadow-inner shadow-black/20`,children:(0,G.jsx)(`span`,{"aria-hidden":`true`,children:e.value})}),(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`text-sm font-bold text-on-surface`,children:e.label}),(0,G.jsx)(`p`,{className:`mt-1 text-xs text-on-surface-variant`,children:e.hint})]}),r?(0,G.jsx)(`span`,{className:`inline-flex h-6 w-6 items-center justify-center rounded-full bg-primary text-on-primary`,children:(0,G.jsx)(u,{size:14})}):null]}),(0,G.jsx)(`p`,{className:`mt-3 text-[11px] font-bold uppercase tracking-[0.24em] text-on-surface-variant/60`,children:a?`Current`:`Available`})]},e.value)})}),(0,G.jsxs)(`div`,{className:`mt-6 flex justify-end gap-3`,children:[(0,G.jsx)(`button`,{type:`button`,onClick:a,disabled:r,className:`rounded-lg border border-outline-variant/20 px-5 py-2.5 text-sm font-bold text-on-surface-variant transition-colors hover:bg-surface-container-high disabled:cursor-not-allowed disabled:opacity-50`,children:`Cancel`}),(0,G.jsxs)(`button`,{type:`button`,onClick:()=>void o(),disabled:r||t===n,className:`flex items-center gap-2 rounded-lg bg-primary px-5 py-2.5 text-sm font-bold text-on-primary transition-all hover:brightness-110 disabled:cursor-not-allowed disabled:opacity-60`,children:[r?(0,G.jsx)(`span`,{className:`h-4 w-4 animate-spin rounded-full border-2 border-on-primary/30 border-t-on-primary`}):null,`Save emoji`]})]})]})]})]}):null),q=[{label:`AI Optimized`,values:{creativity:3,strictness:3.5}},{label:`Creative`,values:{creativity:4.5,strictness:2}},{label:`Analyst`,values:{creativity:1.5,strictness:4.5}},{label:`Assistant`,values:{creativity:3,strictness:2.5}},{label:`Strict Expert`,values:{creativity:2,strictness:5}}],J=1,Y=5,X=.01,Z=e=>(e??k.creativity).toFixed(2),se=({value:e,onChange:t,readonly:n=!1})=>{let r=e.creativity??k.creativity,i=e.strictness??k.strictness,a=n=>{t({...e,creativity:parseFloat(n.target.value)})},o=n=>{t({...e,strictness:parseFloat(n.target.value)})};return(0,G.jsxs)(`section`,{className:`space-y-4`,children:[(0,G.jsx)(`label`,{className:`text-[10px] font-bold uppercase tracking-tight text-on-surface-variant/60`,children:`Personality Matrix`}),(0,G.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:q.map(e=>(0,G.jsx)(`button`,{type:`button`,onClick:()=>t({...e.values}),disabled:n,"aria-label":e.label,className:`text-[10px] px-2 py-0.5 rounded bg-surface-container-highest hover:bg-tertiary/20 hover:text-tertiary border border-outline/20 transition-colors disabled:pointer-events-none disabled:opacity-50`,children:e.label},e.label))}),(0,G.jsxs)(`div`,{className:`space-y-5`,children:[(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsxs)(`div`,{className:`flex justify-between text-xs`,children:[(0,G.jsx)(`span`,{className:`text-on-surface-variant`,children:`Creativity`}),(0,G.jsx)(`span`,{"data-testid":`creativity-value`,className:`text-primary font-mono font-bold`,children:Z(r)})]}),(0,G.jsx)(`input`,{type:`range`,min:J,max:Y,step:X,value:r,onChange:a,disabled:n,"aria-label":`Creativity`,"aria-valuemin":J,"aria-valuemax":Y,"aria-valuenow":r,className:`w-full accent-primary h-1 bg-surface-container-highest rounded-full appearance-none cursor-pointer disabled:cursor-not-allowed disabled:opacity-50`})]}),(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsxs)(`div`,{className:`flex justify-between text-xs`,children:[(0,G.jsx)(`span`,{className:`text-on-surface-variant`,children:`Strictness`}),(0,G.jsx)(`span`,{"data-testid":`strictness-value`,className:`text-secondary font-mono font-bold`,children:Z(i)})]}),(0,G.jsx)(`input`,{type:`range`,min:J,max:Y,step:X,value:i,onChange:o,disabled:n,"aria-label":`Strictness`,"aria-valuemin":J,"aria-valuemax":Y,"aria-valuenow":i,className:`w-full accent-secondary h-1 bg-surface-container-highest rounded-full appearance-none cursor-pointer disabled:cursor-not-allowed disabled:opacity-50`})]})]})]})},Q=({isOpen:e,onClose:t,onUpdated:n,agent:r})=>{let{notifyError:i,notifySuccess:a}=te(),[o,s]=(0,W.useState)(!1),[c,l]=(0,W.useState)(!1),[f,p]=(0,W.useState)(!1),[m,h]=(0,W.useState)(!1),[_,y]=(0,W.useState)(``),[x,S]=(0,W.useState)(``),[C,w]=(0,W.useState)(``),[T,E]=(0,W.useState)(``),[ee,D]=(0,W.useState)([]),[j,P]=(0,W.useState)(``),[F,I]=(0,W.useState)([]),[L,R]=(0,W.useState)(``),[z,B]=(0,W.useState)(`🧠`),[re,V]=(0,W.useState)(!1),[H,U]=(0,W.useState)({...k});(0,W.useEffect)(()=>{e&&r&&(y(r.name||``),S(r.role||``),w(r.description||``),E(r.systemInstructions||``),R(r.model?.id||``),B(N(r.emoji)),P(r.provider?.id??r.model?.provider?.id??``),U(r.attributes??{...k}))},[e,r]),(0,W.useEffect)(()=>{e&&(async()=>{try{p(!0);let{data:e}=await v.findAll();D(e)}catch{}finally{p(!1)}})()},[e]),(0,W.useEffect)(()=>{if(!j){I([]);return}(async()=>{try{l(!0);let{data:e}=await v.findModels(j);I(e),L&&!e.find(e=>e.id===L)&&R(e[0]?.id??``)}catch{I([])}finally{l(!1)}})()},[j,L]);let ae=()=>{r?.id&&(navigator.clipboard.writeText(r.id),h(!0),a(`Copied`,`Agent ID copied to clipboard`),setTimeout(()=>h(!1),2e3))},K=async()=>{if(r?.id)try{s(!0),await A.update(r.id,{name:_,emoji:z,role:x,description:C,systemInstructions:T,providerId:j||void 0,modelId:L||void 0,attributes:H}),n?.(),t()}catch{i(`Update Failed`,`An error occurred while saving the configuration.`)}finally{s(!1)}};return(0,W.useEffect)(()=>{let n=e=>{e.key===`Escape`&&!re&&t()};return e&&window.addEventListener(`keydown`,n),()=>window.removeEventListener(`keydown`,n)},[re,e,t]),e?(0,G.jsxs)(`div`,{className:`fixed inset-y-0 right-0 w-[420px] bg-surface-container-low shadow-2xl z-[60] flex flex-col ring-1 ring-outline-variant/10 animate-in slide-in-from-right duration-300`,children:[(0,G.jsxs)(`div`,{className:`p-6 border-b border-outline-variant/10 flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h3`,{className:`text-lg font-bold font-headline text-white`,children:`Agent Configuration`}),(0,G.jsxs)(`p`,{className:`text-[10px] text-on-surface-variant uppercase tracking-widest mt-0.5`,children:[`Edit Profile: `,r?.name||`Logic Specialist`]})]}),(0,G.jsx)(`button`,{onClick:t,className:`text-on-surface-variant hover:text-white transition-colors`,children:(0,G.jsx)(O,{size:20})})]}),(0,G.jsxs)(`div`,{className:`flex-1 overflow-y-auto p-6 space-y-8 scrollbar-hide`,children:[(0,G.jsxs)(`section`,{className:`space-y-4`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,G.jsxs)(`button`,{type:`button`,onClick:()=>V(!0),className:`relative flex h-20 w-20 items-center justify-center overflow-hidden rounded-2xl bg-surface-container-high ring-1 ring-outline-variant/50 transition-all hover:ring-primary/40`,"aria-label":`Change agent emoji`,children:[(0,G.jsx)(`span`,{className:`text-4xl text-secondary`,children:z}),(0,G.jsx)(`span`,{className:`absolute inset-0 flex items-center justify-center bg-black/60 opacity-0 transition-opacity hover:opacity-100 text-white`,children:(0,G.jsx)(ie,{size:16})})]}),(0,G.jsxs)(`div`,{className:`flex-1 space-y-3`,children:[(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`label`,{className:`text-[10px] font-bold uppercase tracking-tight text-on-surface-variant/60`,children:`Emoji Signature`}),(0,G.jsx)(`p`,{className:`text-xs font-semibold text-on-surface`,children:M(z).label}),(0,G.jsx)(`p`,{className:`text-[11px] text-on-surface-variant/70`,children:M(z).hint})]}),(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`label`,{className:`text-[10px] font-bold uppercase tracking-tight text-on-surface-variant/60`,children:`Agent Name`}),(0,G.jsx)(`input`,{className:`w-full bg-surface-container-lowest border-none rounded-md text-sm text-on-surface focus:ring-1 focus:ring-primary h-9 px-3`,type:`text`,value:_,onChange:e=>y(e.target.value)})]}),(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`label`,{className:`text-[10px] font-bold uppercase tracking-tight text-on-surface-variant/60`,children:`Agent ID`}),(0,G.jsxs)(`div`,{className:`flex gap-2`,children:[(0,G.jsx)(`input`,{className:`flex-1 bg-surface-container-lowest/50 border-none rounded-md text-[10px] font-mono text-on-surface-variant focus:ring-0 h-8 px-3 cursor-default`,type:`text`,value:r?.id||``,readOnly:!0}),(0,G.jsx)(`button`,{onClick:ae,className:`p-1.5 rounded bg-surface-container-highest hover:bg-surface-container-highest/80 text-on-surface-variant transition-colors flex items-center justify-center aspect-square h-8`,title:`Copy ID`,children:m?(0,G.jsx)(u,{size:14,className:`text-primary`}):(0,G.jsx)(g,{size:14})})]})]})]})]}),(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`label`,{className:`text-[10px] font-bold uppercase tracking-tight text-on-surface-variant/60`,children:`Role`}),(0,G.jsx)(`input`,{className:`w-full bg-surface-container-lowest border-none rounded-md text-sm text-on-surface focus:ring-1 focus:ring-primary h-9 px-3 placeholder:text-on-surface-variant/30`,type:`text`,placeholder:`e.g. Researcher, Developer...`,value:x,onChange:e=>S(e.target.value)})]})]}),(0,G.jsx)(ne,{label:`Description`,value:C,onChange:w,placeholder:`Detailed agent profile...`,height:`h-32`,maxLength:1e3}),(0,G.jsxs)(`section`,{className:`space-y-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsx)(`label`,{className:`text-[10px] font-bold uppercase tracking-tight text-on-surface-variant/60`,children:`Provider`}),f&&(0,G.jsx)(b,{size:12,className:`animate-spin text-primary`})]}),(0,G.jsxs)(`div`,{className:`relative`,children:[(0,G.jsxs)(`select`,{className:`w-full bg-surface-container-lowest border-none rounded-md text-sm text-on-surface focus:ring-1 focus:ring-primary h-11 appearance-none px-4 disabled:opacity-50`,value:j,onChange:e=>P(e.target.value),disabled:f,children:[(0,G.jsx)(`option`,{value:``,children:`Select a provider...`}),ee.map(e=>(0,G.jsx)(`option`,{value:e.id,children:e.name},e.id))]}),(0,G.jsx)(d,{className:`absolute right-3 top-3 pointer-events-none text-on-surface-variant/60`,size:18})]})]}),(0,G.jsxs)(`section`,{className:`space-y-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsx)(`label`,{className:`text-[10px] font-bold uppercase tracking-tight text-on-surface-variant/60`,children:`Model Engine`}),c&&(0,G.jsx)(b,{size:12,className:`animate-spin text-primary`})]}),(0,G.jsxs)(`div`,{className:`relative`,children:[(0,G.jsxs)(`select`,{className:`w-full bg-surface-container-lowest border-none rounded-md text-sm text-on-surface focus:ring-1 focus:ring-primary h-11 appearance-none px-4 disabled:opacity-50`,value:L,onChange:e=>R(e.target.value),disabled:c||F.length===0,children:[F.length===0&&!c&&(0,G.jsx)(`option`,{value:``,children:`No models available for this provider`}),F.map(e=>(0,G.jsx)(`option`,{value:e.id,children:e.name},e.id))]}),(0,G.jsx)(d,{className:`absolute right-3 top-3 pointer-events-none text-on-surface-variant/60`,size:18})]})]}),(0,G.jsx)(se,{value:H,onChange:U}),(0,G.jsx)(ne,{label:`System Instructions`,value:T,onChange:E,placeholder:`Define operational logic...`,height:`h-64`,maxLength:2e3})]}),(0,G.jsxs)(`div`,{className:`p-6 bg-surface-container-high border-t border-outline-variant/10 flex gap-3`,children:[(0,G.jsx)(`button`,{onClick:()=>{K()},disabled:o,className:`flex-1 bg-primary text-on-primary py-2.5 rounded font-bold text-sm shadow-lg shadow-primary/10 hover:shadow-primary/20 transition-all flex items-center justify-center gap-2 active:scale-95 disabled:opacity-50`,children:o?(0,G.jsx)(`span`,{className:`w-4 h-4 border-2 border-on-primary/30 border-t-on-primary rounded-full animate-spin`}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(u,{size:16}),`Save Changes`]})}),(0,G.jsx)(`button`,{onClick:t,className:`px-4 py-2.5 rounded border border-outline-variant text-on-surface-variant hover:text-white transition-all`,children:`Reset`})]}),(0,G.jsx)(oe,{isOpen:re,selectedEmoji:z,currentEmoji:N(r?.emoji),isSaving:o,onSelect:B,onClose:()=>V(!1),onConfirm:()=>V(!1)})]}):null},ce={name:``,role:``,description:``,emoji:I,providerId:``,modelId:``,instructions:L,attributes:{...k}},le=[{id:1,title:`Essential Config`,subtitle:`ID, ROLE & MODEL`},{id:2,title:`Intelligence Tuning`,subtitle:`COGNITIVE MATRIX`},{id:3,title:`Instructions`,subtitle:`KNOWLEDGE BASE`}],ue=({isOpen:e,onClose:t,onCreated:a})=>{let o=n(),{notifyApiError:s,notifyError:l,notifySuccess:u}=te(),[f,p]=(0,W.useState)(1),[g,_]=(0,W.useState)(!1),b=(0,W.useId)(),x=(0,W.useId)(),S=(0,W.useId)(),C=(0,W.useId)(),E=(0,W.useId)(),ee=(0,W.useId)(),D=(0,W.useId)(),O=(0,W.useId)(),{control:j,formState:{errors:P},handleSubmit:L,register:V,reset:H,setValue:U}=re({resolver:R(F),defaultValues:ce,mode:`onBlur`}),K=z({control:j,name:`providerId`}),q=z({control:j,name:`modelId`}),J=z({control:j,name:`emoji`}),Y=r({queryKey:[`providers`],enabled:e,queryFn:async()=>(await v.findAll()).data}),X=r({queryKey:[`provider-models`,K],enabled:e&&!!K,queryFn:async()=>(await v.findModels(K)).data});(0,W.useEffect)(()=>{if(!e){H(ce);return}let n=e=>{e.key===`Escape`&&t()};return window.addEventListener(`keydown`,n),()=>window.removeEventListener(`keydown`,n)},[e,t,H]),(0,W.useEffect)(()=>{e&&Y.error&&s(Y.error,`Providers Load Failed`)},[e,s,Y.error]),(0,W.useEffect)(()=>{e&&X.error&&s(X.error,`Models Load Failed`)},[e,X.error,s]);let Z=(0,W.useMemo)(()=>Y.data??[],[Y.data]),Q=(0,W.useMemo)(()=>X.data??[],[X.data]);(0,W.useEffect)(()=>{if(e){if(Z.length===0){K&&U(`providerId`,``,{shouldDirty:!1,shouldValidate:!0});return}(!K||!Z.some(e=>e.id===K))&&U(`providerId`,Z[0].id,{shouldDirty:!1,shouldValidate:!0})}},[e,K,Z,U]),(0,W.useEffect)(()=>{if(e){if(!K){q&&U(`modelId`,``,{shouldDirty:!1,shouldValidate:!0});return}if(Q.length===0){q&&U(`modelId`,``,{shouldDirty:!1,shouldValidate:!0});return}(!q||!Q.some(e=>e.id===q))&&U(`modelId`,Q[0].id,{shouldDirty:!1,shouldValidate:!0})}},[Q,e,q,K,U]);let ue=i({mutationFn:async e=>(await A.create({name:e.name,emoji:e.emoji,role:e.role,description:e.description,systemInstructions:e.instructions,providerId:e.providerId,modelId:e.modelId,status:`active`,attributes:e.attributes}),e),onSuccess:e=>{o.invalidateQueries({queryKey:[`agents`]}),u(`Agent Deployed`,`Successfully commissioned ${e.name} into the fleet.`),a?.(),t(),H(ce),p(1)},onError:e=>{s(e,`Deployment Failed`)}}),$=ue.isPending,de=Y.isPending||X.isPending,fe=L(async e=>{await ue.mutateAsync(e)},()=>{l(`Validation Error`,`Please review the highlighted fields before deploying the agent.`)}),pe=()=>{$||(p(1),t())};return e?(0,G.jsx)(w,{children:(0,G.jsxs)(`div`,{className:`fixed inset-0 z-[100] flex items-center justify-center p-4 md:p-8`,children:[(0,G.jsx)(T.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:pe,className:`absolute inset-0 bg-surface/80 backdrop-blur-xl`,"aria-hidden":`true`}),(0,G.jsxs)(T.div,{initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:20},role:`dialog`,"aria-modal":`true`,"aria-labelledby":b,"aria-describedby":x,"aria-busy":$||de,className:`relative w-full max-w-5xl h-full max-h-[850px] bg-surface-container-low rounded-2xl shadow-2xl overflow-hidden flex flex-col ring-1 ring-outline-variant/10`,children:[(0,G.jsxs)(`div`,{className:`px-8 py-6 border-b border-outline-variant/10 flex items-center justify-between bg-surface-container-low/50 backdrop-blur-md sticky top-0 z-10`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h2`,{id:b,className:`text-2xl font-black font-headline text-white tracking-tight`,children:`Create New Agent`}),(0,G.jsx)(`p`,{id:x,className:`text-sm text-on-surface-variant/80 mt-1`,children:`Configure a specialized AI persona to handle specific nodes in your automation flows.`})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,G.jsx)(`button`,{type:`button`,onClick:pe,disabled:$,className:`px-6 py-2.5 rounded-md text-sm font-bold text-on-surface-variant hover:text-white transition-all disabled:opacity-50 disabled:cursor-not-allowed`,children:`Cancel`}),(0,G.jsx)(`button`,{type:`button`,onClick:fe,disabled:$||Z.length===0||Q.length===0,className:`px-8 py-2.5 rounded-md bg-primary text-on-primary text-sm font-bold shadow-lg shadow-primary/20 hover:scale-[1.02] active:scale-[0.98] transition-all disabled:opacity-50 disabled:grayscale disabled:cursor-not-allowed disabled:hover:scale-100`,children:$?`Deploying...`:`Deploy Agent`})]})]}),(0,G.jsxs)(`div`,{className:`flex-1 flex overflow-hidden`,children:[(0,G.jsxs)(`div`,{className:`w-72 bg-surface-container-low/30 border-r border-outline-variant/5 p-8 flex flex-col gap-10`,children:[(0,G.jsx)(`div`,{className:`space-y-8`,children:le.map(e=>(0,G.jsxs)(`button`,{type:`button`,className:`flex gap-4 group cursor-pointer text-left w-full`,onClick:()=>p(e.id),"aria-pressed":f===e.id,children:[(0,G.jsx)(`div`,{className:`w-8 h-8 rounded-full flex items-center justify-center text-[10px] font-black transition-all ${f===e.id?`bg-secondary text-surface`:`bg-surface-container-highest text-on-surface-variant`}`,children:e.id.toString().padStart(2,`0`)}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h4`,{className:`text-xs font-bold font-headline transition-colors ${f===e.id?`text-white`:`text-on-surface-variant`}`,children:e.title}),(0,G.jsx)(`p`,{className:`text-[9px] font-bold tracking-widest text-on-surface-variant/50 mt-0.5`,children:e.subtitle})]})]},e.id))}),(0,G.jsxs)(`div`,{className:`mt-auto bg-tertiary/10 rounded-xl p-5 ring-1 ring-tertiary/20 backdrop-blur-sm relative overflow-hidden group`,children:[(0,G.jsx)(`div`,{className:`absolute -right-4 -top-4 w-16 h-16 bg-tertiary/10 rounded-full blur-2xl group-hover:bg-tertiary/20 transition-all duration-700`}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2 mb-3 text-tertiary`,children:[(0,G.jsx)(h,{size:14,"aria-hidden":`true`}),(0,G.jsx)(`span`,{className:`text-[10px] font-black uppercase tracking-widest`,children:`AI Suggestion`})]}),(0,G.jsxs)(`p`,{className:`text-[11px] text-on-surface-variant leading-relaxed italic`,children:[`"Try selecting `,(0,G.jsx)(`span`,{className:`text-tertiary font-bold`,children:`Researcher`}),` role for high-depth data synthesis tasks."`]})]})]}),(0,G.jsxs)(`div`,{className:`flex-1 overflow-y-auto p-10 space-y-12 custom-scrollbar`,children:[(0,G.jsxs)(`section`,{className:`space-y-8`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsx)(`div`,{className:`w-1 bg-secondary h-6 rounded-full`}),(0,G.jsx)(`h3`,{className:`text-lg font-bold font-headline text-white`,children:`Basic Configuration`})]}),(0,G.jsxs)(`button`,{type:`button`,onClick:()=>_(!0),className:`group flex w-full items-center justify-between rounded-[24px] border border-outline-variant/10 bg-surface-container-highest/20 p-5 text-left transition-all hover:border-primary/30 hover:bg-surface-container-highest/35`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,G.jsx)(`div`,{className:`flex h-20 w-20 items-center justify-center rounded-[20px] border border-primary/20 bg-surface-container-high text-5xl shadow-[inset_0_1px_0_rgba(255,255,255,0.05)]`,children:(0,G.jsx)(`span`,{"aria-hidden":`true`,children:N(J)})}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`text-[10px] font-black uppercase tracking-[0.32em] text-primary/80`,children:`Emoji signature`}),(0,G.jsx)(`h4`,{className:`mt-2 font-headline text-xl font-black text-white`,children:M(J).label}),(0,G.jsx)(`p`,{className:`mt-1 text-sm text-on-surface-variant`,children:M(J).hint})]})]}),(0,G.jsx)(`span`,{className:`inline-flex h-10 w-10 items-center justify-center rounded-full border border-outline-variant/20 bg-surface-container-high text-on-surface-variant transition-colors group-hover:text-on-surface`,children:(0,G.jsx)(ie,{size:16,"aria-hidden":`true`})})]}),(0,G.jsxs)(`div`,{className:`grid grid-cols-2 gap-6`,children:[(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(`label`,{htmlFor:`create-agent-name`,className:`text-[10px] font-black uppercase tracking-widest text-on-surface-variant/60`,children:`Agent Name`}),(0,G.jsx)(`div`,{className:`bg-surface-container-highest/30 rounded-lg p-0.5 ring-1 ring-outline-variant/10 focus-within:ring-primary/40 transition-all`,children:(0,G.jsx)(`input`,{id:`create-agent-name`,type:`text`,placeholder:`e.g. Researcher-X`,"aria-invalid":!!P.name,"aria-describedby":P.name?S:void 0,className:`w-full bg-transparent border-none text-sm text-on-surface h-10 px-3 focus:outline-none placeholder:text-on-surface-variant/30`,...V(`name`)})}),P.name&&(0,G.jsx)(`p`,{id:S,className:`text-xs text-error font-semibold`,children:P.name.message})]}),(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(`label`,{htmlFor:`create-agent-role`,className:`text-[10px] font-black uppercase tracking-widest text-on-surface-variant/60`,children:`Primary Role`}),(0,G.jsx)(`div`,{className:`bg-surface-container-highest/30 rounded-lg p-0.5 ring-1 ring-outline-variant/10 focus-within:ring-primary/40 transition-all text-on-surface`,children:(0,G.jsx)(`input`,{id:`create-agent-role`,type:`text`,placeholder:`e.g. Researcher`,"aria-invalid":!!P.role,"aria-describedby":P.role?C:void 0,className:`w-full bg-transparent border-none text-sm text-on-surface h-10 px-4 focus:outline-none placeholder:text-on-surface-variant/30`,...V(`role`)})}),P.role&&(0,G.jsx)(`p`,{id:C,className:`text-xs text-error font-semibold`,children:P.role.message})]})]}),(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(B,{control:j,name:`description`,render:({field:e})=>(0,G.jsx)(ne,{label:`Description`,value:e.value,onChange:e.onChange,placeholder:`Define what this agent aims to achieve... You can use markdown for formatting.`,height:`h-32`,maxLength:1e3})}),P.description&&(0,G.jsx)(`p`,{id:E,className:`text-xs text-error font-semibold`,children:P.description.message})]}),(0,G.jsxs)(`div`,{className:`pt-4 space-y-8 border-t border-outline-variant/10`,children:[(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsx)(`label`,{className:`text-[10px] font-black uppercase tracking-widest text-on-surface-variant/60`,children:`Select Provider`}),de&&(0,G.jsx)(`span`,{className:`text-[10px] text-primary animate-pulse font-bold uppercase tracking-widest`,children:`Updating...`})]}),(0,G.jsxs)(`div`,{className:`grid grid-cols-4 gap-4`,children:[Z.map(e=>(0,G.jsxs)(`button`,{type:`button`,"aria-pressed":K===e.id,onClick:()=>{K!==e.id&&(U(`providerId`,e.id,{shouldDirty:!0,shouldValidate:!0}),U(`modelId`,``,{shouldDirty:!0,shouldValidate:!1}))},className:`p-4 rounded-xl flex flex-col items-center gap-3 transition-all ${K===e.id?`bg-primary/10 ring-2 ring-primary shadow-[0_0_20px_rgba(173,198,255,0.15)]`:`bg-surface-container-highest/30 ring-1 ring-outline-variant/10 hover:bg-surface-container-highest/50`}`,children:[(0,G.jsx)(`div`,{className:`w-10 h-10 rounded-lg flex items-center justify-center transition-colors ${K===e.id?`bg-primary text-surface`:`bg-surface-container-high text-on-surface-variant`}`,children:(0,G.jsx)(c,{size:20,"aria-hidden":`true`})}),(0,G.jsx)(`div`,{className:`text-center`,children:(0,G.jsx)(`h4`,{className:`text-xs font-black uppercase tracking-wider ${K===e.id?`text-white`:`text-on-surface-variant`}`,children:e.name})})]},e.id)),Z.length===0&&!Y.isPending&&(0,G.jsxs)(`div`,{className:`col-span-4 py-8 border-2 border-dashed border-outline-variant/10 rounded-xl flex flex-col items-center justify-center text-on-surface-variant/40 gap-2`,children:[(0,G.jsx)(y,{size:24,"aria-hidden":`true`}),(0,G.jsx)(`span`,{className:`text-[10px] font-bold uppercase tracking-widest`,children:`No providers registered`})]})]}),P.providerId&&(0,G.jsx)(`p`,{id:ee,className:`text-xs text-error font-semibold`,children:P.providerId.message})]}),(0,G.jsx)(w,{mode:`wait`,children:K&&(0,G.jsxs)(T.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:`space-y-4 pt-4 border-t border-outline-variant/5`,children:[(0,G.jsx)(`label`,{htmlFor:`create-agent-model`,className:`text-[10px] font-black uppercase tracking-widest text-on-surface-variant/60`,children:`Model Variant Selection`}),(0,G.jsxs)(`div`,{className:`bg-surface-container-highest/30 rounded-lg p-0.5 ring-1 ring-outline-variant/10 focus-within:ring-primary/40 transition-all relative`,children:[(0,G.jsxs)(`select`,{id:`create-agent-model`,value:q,onChange:e=>U(`modelId`,e.target.value,{shouldDirty:!0,shouldValidate:!0}),"aria-invalid":!!P.modelId,"aria-describedby":P.modelId?D:void 0,className:`w-full bg-transparent border-none text-sm text-on-surface h-10 px-3 focus:outline-none appearance-none cursor-pointer`,children:[(0,G.jsx)(`option`,{value:``,disabled:!0,className:`bg-surface-container-low text-on-surface`,children:`Select a model...`}),Q.map(e=>(0,G.jsx)(`option`,{value:e.id,className:`bg-surface-container-low text-on-surface`,children:e.name},e.id))]}),(0,G.jsx)(`div`,{className:`absolute right-3 top-1/2 -translate-y-1/2 pointer-events-none text-on-surface-variant/60`,children:(0,G.jsx)(d,{size:18,"aria-hidden":`true`})})]}),P.modelId&&(0,G.jsx)(`p`,{id:D,className:`text-xs text-error font-semibold`,children:P.modelId.message}),Q.length===0&&!X.isPending&&(0,G.jsx)(`div`,{className:`py-6 text-center bg-error/5 rounded-xl border border-error/10`,children:(0,G.jsx)(`span`,{className:`text-[10px] font-bold text-error uppercase tracking-widest opacity-60`,children:`No model variants found for this provider`})})]},K)})]})]}),(0,G.jsxs)(`section`,{className:`space-y-10`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsx)(`div`,{className:`w-1 bg-primary h-6 rounded-full`}),(0,G.jsx)(`h3`,{className:`text-lg font-bold font-headline text-white`,children:`Intelligence Tuning`})]}),(0,G.jsx)(B,{control:j,name:`attributes`,render:({field:e})=>(0,G.jsx)(se,{value:e.value??{...k},onChange:e.onChange})})]}),(0,G.jsxs)(`section`,{className:`space-y-8`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsx)(`div`,{className:`w-1 bg-tertiary h-6 rounded-full`}),(0,G.jsx)(`h3`,{className:`text-lg font-bold font-headline text-white`,children:`Operational Directives`})]}),(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(B,{control:j,name:`instructions`,render:({field:e})=>(0,G.jsx)(ne,{label:`System Instructions`,value:e.value,onChange:e.onChange,height:`h-64`,helperText:`Prompt Engineering Active`,maxLength:1e3})}),P.instructions&&(0,G.jsx)(`p`,{id:O,className:`text-xs text-error font-semibold`,children:P.instructions.message})]}),(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsx)(`label`,{className:`text-[10px] font-black uppercase tracking-widest text-on-surface-variant/60`,children:`Knowledge Integration`}),(0,G.jsxs)(`div`,{className:`grid grid-cols-2 gap-4`,children:[(0,G.jsxs)(`button`,{type:`button`,className:`border-2 border-dashed border-outline-variant/10 rounded-xl p-6 flex flex-col items-center justify-center gap-2 group cursor-pointer hover:border-primary/30 transition-all`,children:[(0,G.jsx)(`div`,{className:`w-10 h-10 rounded-full bg-surface-container-high flex items-center justify-center text-on-surface-variant group-hover:text-primary transition-colors`,children:(0,G.jsx)(m,{size:18,"aria-hidden":`true`})}),(0,G.jsx)(`span`,{className:`text-[10px] font-bold uppercase tracking-widest text-on-surface-variant`,children:`Connect Repo`})]}),(0,G.jsxs)(`button`,{type:`button`,className:`border-2 border-dashed border-outline-variant/10 rounded-xl p-6 flex flex-col items-center justify-center gap-2 group cursor-pointer hover:border-primary/30 transition-all`,children:[(0,G.jsx)(`div`,{className:`w-10 h-10 rounded-full bg-surface-container-high flex items-center justify-center text-on-surface-variant group-hover:text-primary transition-colors`,children:(0,G.jsx)(ae,{size:18,"aria-hidden":`true`})}),(0,G.jsx)(`span`,{className:`text-[10px] font-bold uppercase tracking-widest text-on-surface-variant`,children:`Access Policies`})]})]})]})]})]})]})]}),(0,G.jsx)(oe,{isOpen:g,selectedEmoji:N(J),currentEmoji:I,isSaving:$,onSelect:e=>U(`emoji`,e,{shouldDirty:!0,shouldValidate:!0}),onClose:()=>_(!1),onConfirm:()=>_(!1)})]})}):null},$=({isOpen:e,onClose:t,agent:n})=>{let r=`Wake up, who are you?`,[i,a]=(0,W.useState)(r),[o,c]=(0,W.useState)(``),[u,d]=(0,W.useState)(),[f,m]=(0,W.useState)(!1),[h,g]=(0,W.useState)(`idle`);return(0,W.useEffect)(()=>{let n=e=>{e.key===`Escape`&&t()};return e&&(window.addEventListener(`keydown`,n),c(``),d(void 0),g(`idle`),a(r)),()=>window.removeEventListener(`keydown`,n)},[e,t]),e?(0,G.jsx)(w,{children:(0,G.jsxs)(`div`,{className:`fixed inset-0 z-[100] flex items-center justify-center p-4`,children:[(0,G.jsx)(T.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:t,className:`absolute inset-0 bg-surface/80 backdrop-blur-xl`}),(0,G.jsxs)(T.div,{initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:20},className:`relative w-full max-w-2xl bg-surface-container-low rounded-2xl shadow-2xl overflow-hidden flex flex-col ring-1 ring-outline-variant/10`,children:[(0,G.jsxs)(`div`,{className:`px-6 py-4 border-b border-outline-variant/10 flex items-center justify-between bg-surface-container-low/50 backdrop-blur-md`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsx)(`div`,{className:`w-10 h-10 rounded-xl bg-primary/10 flex items-center justify-center text-primary`,children:(0,G.jsx)(l,{size:20})}),(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`h2`,{className:`text-xl font-black font-headline text-white tracking-tight`,children:[`Probe: `,n?.name]}),(0,G.jsx)(`p`,{className:`text-[10px] text-on-surface-variant uppercase tracking-widest font-bold`,children:`Neural Direct Message`})]})]}),(0,G.jsx)(`button`,{onClick:t,className:`text-on-surface-variant hover:text-white transition-colors p-2`,children:(0,G.jsx)(O,{size:20})})]}),(0,G.jsxs)(`div`,{className:`p-6 space-y-6 max-h-[80vh] overflow-y-auto scrollbar-hide`,children:[(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsxs)(`label`,{className:`text-[10px] font-black uppercase tracking-widest text-on-surface-variant/60 flex items-center gap-2`,children:[(0,G.jsx)(p,{size:12}),`Command Input`]}),(0,G.jsxs)(`div`,{className:`relative group`,children:[(0,G.jsx)(`textarea`,{value:i,onChange:e=>a(e.target.value),placeholder:`Type your command...`,className:`w-full bg-surface-container-highest/30 rounded-xl p-4 text-sm text-on-surface h-32 focus:outline-none focus:ring-2 focus:ring-primary/40 transition-all resize-none border border-outline-variant/10 group-hover:border-outline-variant/30`}),(0,G.jsx)(`button`,{onClick:async()=>{if(!(!n?.id||!i.trim()))try{m(!0),g(`idle`),c(`Awaiting response from neural node...`),d(void 0);let{data:e}=await A.probe(n.id,i);c(e.content),d(e.image),g(`success`)}catch(e){console.error(`Probe failed:`,e);let t=`An unexpected error occurred during the probe.`;if(e&&typeof e==`object`&&`response`in e){let n=e;t=n.response?.data?.message||n.message||t}else e instanceof Error&&(t=e.message);c(`ERROR: ${t}`),g(`error`)}finally{m(!1)}},disabled:f||!i.trim(),className:`absolute bottom-3 right-3 p-2.5 rounded-lg bg-primary text-on-primary shadow-lg shadow-primary/20 hover:scale-[1.05] active:scale-[0.95] transition-all disabled:opacity-50 disabled:grayscale disabled:cursor-not-allowed group`,children:f?(0,G.jsx)(b,{size:18,className:`animate-spin`}):(0,G.jsx)(x,{size:18})})]})]}),(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`label`,{className:`text-[10px] font-black uppercase tracking-widest text-on-surface-variant/60 flex items-center gap-2`,children:[(0,G.jsx)(s,{size:12,className:f?`animate-pulse`:``}),`Neural Response`]}),h===`success`&&(0,G.jsxs)(`span`,{className:`flex items-center gap-1 text-[9px] font-black text-secondary uppercase bg-secondary/10 px-2 py-0.5 rounded`,children:[(0,G.jsx)(ee,{size:10}),` Sync Complete`]}),h===`error`&&(0,G.jsxs)(`span`,{className:`flex items-center gap-1 text-[9px] font-black text-error uppercase bg-error/10 px-2 py-0.5 rounded`,children:[(0,G.jsx)(E,{size:10}),` Link Severed`]})]}),(0,G.jsx)(`div`,{className:`w-full min-h-[100px] bg-black/40 rounded-xl p-5 border border-outline-variant/5 font-mono text-sm leading-relaxed transition-all duration-500 whitespace-pre-wrap ${h===`error`?`text-error/80 border-error/20`:h===`success`?`text-secondary/90 border-secondary/20 shadow-[inset_0_0_20px_rgba(102,231,175,0.05)]`:`text-on-surface-variant/60`}`,children:o||`Enter a command and initiate the probe to see the agent response.`}),(0,G.jsx)(w,{children:u&&(0,G.jsxs)(T.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:`space-y-2`,children:[(0,G.jsxs)(`label`,{className:`text-[10px] font-black uppercase tracking-widest text-on-surface-variant/60 flex items-center gap-2`,children:[(0,G.jsx)(H,{size:12}),`Visual Output`]}),(0,G.jsxs)(`div`,{className:`relative rounded-xl overflow-hidden border border-outline-variant/10 bg-surface-container-highest/20 group`,children:[(0,G.jsx)(`img`,{src:`data:image/png;base64,${u}`,alt:`Neural Output`,className:`w-full h-auto max-h-[400px] object-contain mx-auto`}),(0,G.jsx)(`div`,{className:`absolute inset-x-0 bottom-0 p-3 bg-gradient-to-t from-black/60 to-transparent opacity-0 group-hover:opacity-100 transition-opacity`,children:(0,G.jsx)(`span`,{className:`text-[10px] font-bold text-white uppercase tracking-wider`,children:`Generated Content`})})]})]})})]})]}),(0,G.jsx)(`div`,{className:`px-6 py-4 bg-surface-container-high/50 border-t border-outline-variant/10 flex justify-end`,children:(0,G.jsx)(`button`,{onClick:t,className:`px-6 py-2 rounded-lg text-sm font-bold text-on-surface hover:bg-surface-container-highest transition-all`,children:`Close Terminal`})})]})]})}):null},de=()=>{let{notifySuccess:e,notifyApiError:t}=te(),a=n(),[o,s]=(0,W.useState)(null),[c,l]=(0,W.useState)(!1),[u,d]=(0,W.useState)(!1),[f,p]=(0,W.useState)(!1),[m,h]=(0,W.useState)(!1),[g,_]=(0,W.useState)(`grid`),{data:v=[],isLoading:y}=r({queryKey:[`agents`],queryFn:async()=>{let{data:e}=await A.findAll();return e}}),x=()=>a.invalidateQueries({queryKey:[`agents`]}),S=i({mutationFn:e=>A.delete(e),onSuccess:()=>{e(`Agent Inactivated`,`Neural node has been marked as inactive.`),h(!1),x()},onError:e=>t(e,`Operation Failed`)}),w=i({mutationFn:e=>A.update(e,{status:`active`}),onSuccess:()=>{e(`Neural Link Restored`,`The agent has been reactivated and synchronized.`),x()},onError:e=>t(e,`Activation Failed`)}),T=e=>{s(e),l(!0)},E=e=>{s(e),p(!0)},ee=e=>{s(e),h(!0)},D=()=>{o&&S.mutate(o.id)},O=e=>{w.mutate(e)};return(0,G.jsxs)(`div`,{className:`space-y-8`,children:[(0,G.jsxs)(`div`,{className:`flex items-end justify-between`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h2`,{className:`text-4xl font-extrabold font-headline tracking-tight text-white`,children:`Agent Fleet`}),(0,G.jsxs)(`p`,{className:`text-on-surface-variant mt-2 font-body text-sm`,children:[`Commanding `,(0,G.jsx)(`span`,{className:`text-secondary font-bold`,children:v.filter(e=>e.status!==`inactive`).length}),` active neural nodes across the network.`]})]}),(0,G.jsxs)(`div`,{className:`flex gap-2`,children:[(0,G.jsx)(`button`,{onClick:()=>_(`grid`),"aria-label":`Grid view`,"aria-pressed":g===`grid`,className:`p-2 rounded transition-colors ${g===`grid`?`bg-surface-container-high text-white`:`text-on-surface-variant hover:text-white`}`,children:(0,G.jsx)(V,{size:20,"aria-hidden":`true`})}),(0,G.jsx)(`button`,{onClick:()=>_(`list`),"aria-label":`List view`,"aria-pressed":g===`list`,className:`p-2 rounded transition-colors ${g===`list`?`bg-surface-container-high text-white`:`text-on-surface-variant hover:text-white`}`,children:(0,G.jsx)(U,{size:20,"aria-hidden":`true`})})]})]}),y?(0,G.jsx)(`div`,{className:`flex items-center justify-center h-64`,children:(0,G.jsx)(b,{className:`w-12 h-12 text-primary animate-spin`})}):(0,G.jsxs)(`div`,{className:g===`grid`?`grid grid-cols-1 xl:grid-cols-2 2xl:grid-cols-3 gap-6`:`flex flex-col gap-4`,children:[v.map(e=>(0,G.jsx)(`div`,{onClick:()=>T(e),className:e.status===`inactive`?`opacity-50 grayscale hover:grayscale-0 transition-all`:``,children:(0,G.jsx)(K,{id:e.id,name:e.name,emoji:e.emoji,expertise:e.role||`General Assistant`,model:e.model?.name||`Unknown`,status:e.status||`active`,metricLabel:`Provider`,metricValue:e.provider?.name||`Unknown`,onConfigure:()=>T(e),onProbe:()=>E(e),onDelete:()=>ee(e),onActivate:()=>O(e.id)})},e.id)),(0,G.jsxs)(`div`,{onClick:()=>d(!0),className:`border-2 border-dashed border-outline-variant/30 rounded-xl p-6 flex flex-col items-center justify-center text-center group cursor-pointer hover:border-primary/50 transition-all hover:bg-primary/5`,children:[(0,G.jsx)(`div`,{className:`w-12 h-12 rounded-full bg-surface-container-low flex items-center justify-center mb-4 group-hover:scale-110 transition-transform`,children:(0,G.jsx)(j,{size:24,className:`text-primary`})}),(0,G.jsx)(`span`,{className:`text-sm font-bold font-headline text-on-surface-variant group-hover:text-on-surface`,children:`Deploy New Agent`}),(0,G.jsx)(`p`,{className:`text-xs text-on-surface-variant/60 mt-1 max-w-[200px]`,children:`Expand your fleet with specialized intelligence units.`})]})]}),(0,G.jsx)(Q,{isOpen:c,onClose:()=>l(!1),onUpdated:x,agent:o},o?.id||`none`),(0,G.jsx)($,{isOpen:f,onClose:()=>p(!1),agent:o}),(0,G.jsx)(ue,{isOpen:u,onClose:()=>d(!1),onCreated:x}),(0,G.jsx)(C,{isOpen:m,onClose:()=>h(!1),onConfirm:D,title:`Decommission Neural Node?`,message:`This will mark ${o?.name} as inactive. The agent will remain in the database but will no longer be available for automated tasks or direct neural connection.`,confirmText:`Decommission`,variant:`danger`})]})};export{de as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./rolldown-runtime-COnpUsM8.js";import{g as e}from"./vendor-dnd-CxfOy4-Z.js";import{r as t}from"./vendor-markdown-Dl_1qnne.js";import{i as n}from"./client-CylGrWpP.js";import{n as r,t as i}from"./vendor-motion-
|
|
1
|
+
import"./rolldown-runtime-COnpUsM8.js";import{g as e}from"./vendor-dnd-CxfOy4-Z.js";import{r as t}from"./vendor-markdown-Dl_1qnne.js";import{i as n}from"./client-CylGrWpP.js";import{n as r,t as i}from"./vendor-motion-g6T1ev3V.js";import{S as a,h as o,x as s}from"./index-BImV2VVd.js";var c=n(`triangle-alert`,[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`,key:`wmoenq`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]);e();var l=t(),u=({isOpen:e,onClose:t,onConfirm:n,title:u,message:d,confirmText:f=`Confirm`,cancelText:p=`Cancel`,variant:m=`primary`,loading:h=!1,showCheckbox:g=!1,checkboxLabel:_=`Don't show this again`,onCheckboxChange:v})=>{let y={danger:{icon:c,iconBg:`bg-error/10`,iconColor:`text-error`,buttonBg:`bg-error hover:bg-error/90`,buttonText:`text-on-error`,ring:`ring-error/20`},primary:{icon:s,iconBg:`bg-primary/10`,iconColor:`text-primary`,buttonBg:`bg-primary hover:bg-primary/90`,buttonText:`text-on-primary`,ring:`ring-primary/20`},success:{icon:a,iconBg:`bg-secondary/10`,iconColor:`text-secondary`,buttonBg:`bg-secondary hover:bg-secondary/90`,buttonText:`text-surface`,ring:`ring-secondary/20`},warning:{icon:c,iconBg:`bg-tertiary/10`,iconColor:`text-tertiary`,buttonBg:`bg-tertiary hover:bg-tertiary/90`,buttonText:`text-surface`,ring:`ring-tertiary/20`}}[m],b=y.icon;return e?(0,l.jsx)(r,{children:(0,l.jsxs)(`div`,{className:`fixed inset-0 z-[200] flex items-center justify-center p-4`,children:[(0,l.jsx)(i.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:t,className:`absolute inset-0 bg-surface/60 backdrop-blur-md`}),(0,l.jsxs)(i.div,{initial:{opacity:0,scale:.95,y:10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:10},className:`relative w-full max-w-md bg-surface-container-low rounded-2xl shadow-2xl overflow-hidden ring-1 ring-outline-variant/10 p-6 flex flex-col gap-6`,children:[(0,l.jsxs)(`div`,{className:`flex gap-4`,children:[(0,l.jsx)(`div`,{className:`w-12 h-12 rounded-xl flex-shrink-0 flex items-center justify-center ${y.iconBg} ${y.iconColor}`,children:(0,l.jsx)(b,{size:24})}),(0,l.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,l.jsx)(`h3`,{className:`text-xl font-black font-headline text-white tracking-tight mb-2`,children:u}),(0,l.jsx)(`p`,{className:`text-sm text-on-surface-variant leading-relaxed`,children:d})]}),(0,l.jsx)(`button`,{onClick:t,className:`text-on-surface-variant hover:text-white transition-colors h-fit p-1`,children:(0,l.jsx)(o,{size:20})})]}),g&&(0,l.jsx)(`div`,{className:`flex items-center gap-3 px-1 mt-[-12px]`,children:(0,l.jsxs)(`label`,{className:`flex items-center gap-3 cursor-pointer group`,children:[(0,l.jsxs)(`div`,{className:`relative flex items-center`,children:[(0,l.jsx)(`input`,{type:`checkbox`,onChange:e=>v?.(e.target.checked),className:`peer appearance-none w-5 h-5 rounded border border-outline-variant/30 bg-surface-container-highest checked:bg-primary checked:border-primary transition-all cursor-pointer`}),(0,l.jsx)(a,{size:14,className:`absolute inset-0 m-auto text-on-primary opacity-0 peer-checked:opacity-100 transition-opacity pointer-events-none`})]}),(0,l.jsx)(`span`,{className:`text-xs font-bold text-on-surface-variant group-hover:text-white transition-colors uppercase tracking-wider`,children:_})]})}),(0,l.jsxs)(`div`,{className:`flex items-center justify-end gap-3 mt-2`,children:[(0,l.jsx)(`button`,{onClick:t,disabled:h,className:`px-5 py-2.5 rounded-lg text-sm font-bold text-on-surface-variant hover:text-white hover:bg-surface-container-highest transition-all disabled:opacity-50`,children:p}),(0,l.jsx)(`button`,{onClick:n,disabled:h,className:`px-6 py-2.5 rounded-lg text-sm font-bold shadow-lg transition-all ${y.buttonBg} ${y.buttonText} ${y.ring} hover:scale-[1.02] active:scale-[0.98] disabled:opacity-50 disabled:grayscale disabled:cursor-not-allowed`,children:h?`Processing...`:f})]})]})]})}):null};export{u as t};
|