@solidxai/core 0.1.22-beta.3 → 0.1.22-beta.5
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 +44 -0
- package/dist/constants/error-messages.d.ts +1 -1
- package/dist/constants/error-messages.d.ts.map +1 -1
- package/dist/constants/error-messages.js +1 -1
- package/dist/constants/error-messages.js.map +1 -1
- package/dist/controllers/admin-embed.controller.d.ts +5 -0
- package/dist/controllers/admin-embed.controller.d.ts.map +1 -0
- package/dist/controllers/admin-embed.controller.js +58 -0
- package/dist/controllers/admin-embed.controller.js.map +1 -0
- package/dist/controllers/agent-registry.controller.d.ts +2 -0
- package/dist/controllers/agent-registry.controller.d.ts.map +1 -1
- package/dist/controllers/agent-registry.controller.js +14 -0
- package/dist/controllers/agent-registry.controller.js.map +1 -1
- package/dist/controllers/agent-session.controller.d.ts +8 -1
- package/dist/controllers/agent-session.controller.d.ts.map +1 -1
- package/dist/controllers/agent-session.controller.js +88 -2
- package/dist/controllers/agent-session.controller.js.map +1 -1
- package/dist/controllers/authentication.controller.d.ts +12 -1
- package/dist/controllers/authentication.controller.d.ts.map +1 -1
- package/dist/controllers/authentication.controller.js +26 -2
- package/dist/controllers/authentication.controller.js.map +1 -1
- package/dist/controllers/test-data.controller.d.ts +12 -0
- package/dist/controllers/test-data.controller.d.ts.map +1 -0
- package/dist/controllers/test-data.controller.js +66 -0
- package/dist/controllers/test-data.controller.js.map +1 -0
- package/dist/controllers/test-data.controller.spec.d.ts +2 -0
- package/dist/controllers/test-data.controller.spec.d.ts.map +1 -0
- package/dist/controllers/test-data.controller.spec.js +78 -0
- package/dist/controllers/test-data.controller.spec.js.map +1 -0
- package/dist/dtos/create-agent-job.dto.d.ts +1 -0
- package/dist/dtos/create-agent-job.dto.d.ts.map +1 -1
- package/dist/dtos/create-agent-job.dto.js +8 -1
- package/dist/dtos/create-agent-job.dto.js.map +1 -1
- package/dist/dtos/create-agent-process.dto.d.ts +5 -0
- package/dist/dtos/create-agent-process.dto.d.ts.map +1 -1
- package/dist/dtos/create-agent-process.dto.js +37 -1
- package/dist/dtos/create-agent-process.dto.js.map +1 -1
- package/dist/dtos/create-agent-registry.dto.d.ts +5 -0
- package/dist/dtos/create-agent-registry.dto.d.ts.map +1 -1
- package/dist/dtos/create-agent-registry.dto.js +39 -1
- package/dist/dtos/create-agent-registry.dto.js.map +1 -1
- package/dist/dtos/create-agent-session.dto.js +1 -1
- package/dist/dtos/create-agent-session.dto.js.map +1 -1
- package/dist/dtos/test-run-request.dto.d.ts +1 -0
- package/dist/dtos/test-run-request.dto.d.ts.map +1 -1
- package/dist/dtos/test-run-request.dto.js +7 -1
- package/dist/dtos/test-run-request.dto.js.map +1 -1
- package/dist/dtos/update-agent-deployment.dto.d.ts +8 -0
- package/dist/dtos/update-agent-deployment.dto.d.ts.map +1 -0
- package/dist/dtos/update-agent-deployment.dto.js +60 -0
- package/dist/dtos/update-agent-deployment.dto.js.map +1 -0
- package/dist/dtos/update-agent-job.dto.d.ts +1 -0
- package/dist/dtos/update-agent-job.dto.d.ts.map +1 -1
- package/dist/dtos/update-agent-job.dto.js +8 -1
- package/dist/dtos/update-agent-job.dto.js.map +1 -1
- package/dist/dtos/update-agent-process.dto.d.ts +5 -0
- package/dist/dtos/update-agent-process.dto.d.ts.map +1 -1
- package/dist/dtos/update-agent-process.dto.js +37 -1
- package/dist/dtos/update-agent-process.dto.js.map +1 -1
- package/dist/dtos/update-agent-registry.dto.d.ts +5 -0
- package/dist/dtos/update-agent-registry.dto.d.ts.map +1 -1
- package/dist/dtos/update-agent-registry.dto.js +39 -1
- package/dist/dtos/update-agent-registry.dto.js.map +1 -1
- package/dist/dtos/update-agent-session.dto.js +1 -1
- package/dist/dtos/update-agent-session.dto.js.map +1 -1
- package/dist/entities/agent-job.entity.d.ts +1 -0
- package/dist/entities/agent-job.entity.d.ts.map +1 -1
- package/dist/entities/agent-job.entity.js +7 -2
- package/dist/entities/agent-job.entity.js.map +1 -1
- package/dist/entities/agent-process.entity.d.ts +8 -0
- package/dist/entities/agent-process.entity.d.ts.map +1 -1
- package/dist/entities/agent-process.entity.js +38 -1
- package/dist/entities/agent-process.entity.js.map +1 -1
- package/dist/entities/agent-registry.entity.d.ts +5 -0
- package/dist/entities/agent-registry.entity.d.ts.map +1 -1
- package/dist/entities/agent-registry.entity.js +22 -1
- package/dist/entities/agent-registry.entity.js.map +1 -1
- package/dist/entities/agent-session.entity.d.ts.map +1 -1
- package/dist/entities/agent-session.entity.js +3 -1
- package/dist/entities/agent-session.entity.js.map +1 -1
- package/dist/guards/access-token.guard.d.ts +3 -1
- package/dist/guards/access-token.guard.d.ts.map +1 -1
- package/dist/guards/access-token.guard.js +11 -2
- package/dist/guards/access-token.guard.js.map +1 -1
- package/dist/helpers/agent-config-version-name.d.ts +2 -0
- package/dist/helpers/agent-config-version-name.d.ts.map +1 -0
- package/dist/helpers/agent-config-version-name.js +17 -0
- package/dist/helpers/agent-config-version-name.js.map +1 -0
- package/dist/helpers/agent-config-version-name.spec.d.ts +2 -0
- package/dist/helpers/agent-config-version-name.spec.d.ts.map +1 -0
- package/dist/helpers/agent-config-version-name.spec.js +31 -0
- package/dist/helpers/agent-config-version-name.spec.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/interfaces/active-user-data.interface.d.ts +1 -0
- package/dist/interfaces/active-user-data.interface.d.ts.map +1 -1
- package/dist/interfaces/active-user-data.interface.js.map +1 -1
- package/dist/jobs/database/test-run-queue-subscriber-database.service.d.ts.map +1 -1
- package/dist/jobs/database/test-run-queue-subscriber-database.service.js +8 -4
- package/dist/jobs/database/test-run-queue-subscriber-database.service.js.map +1 -1
- package/dist/resources/admin-embed/solid-admin-embed.js +133 -0
- package/dist/resources/agent-embed/solid-agent-embed.js +243 -4
- package/dist/seeders/module-test-data.service.d.ts +19 -0
- package/dist/seeders/module-test-data.service.d.ts.map +1 -1
- package/dist/seeders/module-test-data.service.js +95 -15
- package/dist/seeders/module-test-data.service.js.map +1 -1
- package/dist/seeders/module-test-data.service.spec.d.ts +2 -0
- package/dist/seeders/module-test-data.service.spec.d.ts.map +1 -0
- package/dist/seeders/module-test-data.service.spec.js +158 -0
- package/dist/seeders/module-test-data.service.spec.js.map +1 -0
- package/dist/seeders/seed-data/solid-core-metadata.json +375 -11
- package/dist/services/agent-hub-process-manager.service.d.ts +16 -0
- package/dist/services/agent-hub-process-manager.service.d.ts.map +1 -1
- package/dist/services/agent-hub-process-manager.service.js +27 -3
- package/dist/services/agent-hub-process-manager.service.js.map +1 -1
- package/dist/services/agent-registry.service.d.ts +2 -0
- package/dist/services/agent-registry.service.d.ts.map +1 -1
- package/dist/services/agent-registry.service.js +36 -1
- package/dist/services/agent-registry.service.js.map +1 -1
- package/dist/services/api-key-portal-session.spec.d.ts +2 -0
- package/dist/services/api-key-portal-session.spec.d.ts.map +1 -0
- package/dist/services/api-key-portal-session.spec.js +71 -0
- package/dist/services/api-key-portal-session.spec.js.map +1 -0
- package/dist/services/api-key.service.d.ts +12 -0
- package/dist/services/api-key.service.d.ts.map +1 -1
- package/dist/services/api-key.service.js +58 -0
- package/dist/services/api-key.service.js.map +1 -1
- package/dist/services/authentication.service.d.ts +1 -0
- package/dist/services/authentication.service.d.ts.map +1 -1
- package/dist/services/authentication.service.js +14 -1
- package/dist/services/authentication.service.js.map +1 -1
- package/dist/services/crud.service.d.ts +1 -0
- package/dist/services/crud.service.d.ts.map +1 -1
- package/dist/services/crud.service.js +26 -2
- package/dist/services/crud.service.js.map +1 -1
- package/dist/services/settings/default-settings-provider.service.d.ts +16 -6
- package/dist/services/settings/default-settings-provider.service.d.ts.map +1 -1
- package/dist/services/settings/default-settings-provider.service.js +9 -3
- package/dist/services/settings/default-settings-provider.service.js.map +1 -1
- package/dist/solid-core.module.d.ts.map +1 -1
- package/dist/solid-core.module.js +5 -0
- package/dist/solid-core.module.js.map +1 -1
- package/dist/testing/adapters/ui/browser-provisioner.d.ts +11 -0
- package/dist/testing/adapters/ui/browser-provisioner.d.ts.map +1 -1
- package/dist/testing/adapters/ui/browser-provisioner.js +51 -1
- package/dist/testing/adapters/ui/browser-provisioner.js.map +1 -1
- package/dist/testing/adapters/ui/browser-provisioner.spec.d.ts +2 -0
- package/dist/testing/adapters/ui/browser-provisioner.spec.d.ts.map +1 -0
- package/dist/testing/adapters/ui/browser-provisioner.spec.js +137 -0
- package/dist/testing/adapters/ui/browser-provisioner.spec.js.map +1 -0
- package/dist/testing/adapters/ui/playwright-adapter.d.ts +7 -0
- package/dist/testing/adapters/ui/playwright-adapter.d.ts.map +1 -1
- package/dist/testing/adapters/ui/playwright-adapter.js +40 -9
- package/dist/testing/adapters/ui/playwright-adapter.js.map +1 -1
- package/dist/testing/adapters/ui/run-video.d.ts +40 -0
- package/dist/testing/adapters/ui/run-video.d.ts.map +1 -0
- package/dist/testing/adapters/ui/run-video.js +113 -0
- package/dist/testing/adapters/ui/run-video.js.map +1 -0
- package/dist/testing/adapters/ui/run-video.spec.d.ts +2 -0
- package/dist/testing/adapters/ui/run-video.spec.d.ts.map +1 -0
- package/dist/testing/adapters/ui/run-video.spec.js +62 -0
- package/dist/testing/adapters/ui/run-video.spec.js.map +1 -0
- package/dist/testing/contracts/runtime-context.types.d.ts +7 -0
- package/dist/testing/contracts/runtime-context.types.d.ts.map +1 -1
- package/dist/testing/contracts/runtime-context.types.js.map +1 -1
- package/dist/testing/contracts/testing-metadata.types.d.ts +1 -0
- package/dist/testing/contracts/testing-metadata.types.d.ts.map +1 -1
- package/dist/testing/contracts/testing-metadata.types.js.map +1 -1
- package/dist/testing/core/interpolation.d.ts.map +1 -1
- package/dist/testing/core/interpolation.js +14 -2
- package/dist/testing/core/interpolation.js.map +1 -1
- package/dist/testing/core/step-data.d.ts +5 -0
- package/dist/testing/core/step-data.d.ts.map +1 -0
- package/dist/testing/core/step-data.js +14 -0
- package/dist/testing/core/step-data.js.map +1 -0
- package/dist/testing/core/step-data.spec.d.ts +2 -0
- package/dist/testing/core/step-data.spec.d.ts.map +1 -0
- package/dist/testing/core/step-data.spec.js +48 -0
- package/dist/testing/core/step-data.spec.js.map +1 -0
- package/dist/testing/core/testing-engine.d.ts +1 -1
- package/dist/testing/core/testing-engine.d.ts.map +1 -1
- package/dist/testing/core/testing-engine.js +27 -4
- package/dist/testing/core/testing-engine.js.map +1 -1
- package/dist/testing/reporter/lifecycle-events.types.d.ts +3 -2
- package/dist/testing/reporter/lifecycle-events.types.d.ts.map +1 -1
- package/dist/testing/reporter/lifecycle-events.types.js.map +1 -1
- package/dist/testing/reporter/lifecycle-webhook-reporter.d.ts +2 -1
- package/dist/testing/reporter/lifecycle-webhook-reporter.d.ts.map +1 -1
- package/dist/testing/reporter/lifecycle-webhook-reporter.js +3 -0
- package/dist/testing/reporter/lifecycle-webhook-reporter.js.map +1 -1
- package/dist/testing/reporter/reporter.types.d.ts +2 -1
- package/dist/testing/reporter/reporter.types.d.ts.map +1 -1
- package/dist/testing/reporter/reporter.types.js.map +1 -1
- package/dist/testing/runner/read-scenarios-file.d.ts +1 -0
- package/dist/testing/runner/read-scenarios-file.d.ts.map +1 -1
- package/dist/testing/runner/read-scenarios-file.js +20 -0
- package/dist/testing/runner/read-scenarios-file.js.map +1 -1
- package/dist/testing/runner/run-from-metadata.d.ts.map +1 -1
- package/dist/testing/runner/run-from-metadata.js +48 -10
- package/dist/testing/runner/run-from-metadata.js.map +1 -1
- package/dist/testing/runner/run-from-metadata.spec.js +41 -1
- package/dist/testing/runner/run-from-metadata.spec.js.map +1 -1
- package/dist/testing/runner/scenario-graph.d.ts +9 -0
- package/dist/testing/runner/scenario-graph.d.ts.map +1 -1
- package/dist/testing/runner/scenario-graph.js +47 -13
- package/dist/testing/runner/scenario-graph.js.map +1 -1
- package/dist/testing/steps/ui/navigation.step.d.ts.map +1 -1
- package/dist/testing/steps/ui/navigation.step.js +4 -1
- package/dist/testing/steps/ui/navigation.step.js.map +1 -1
- package/dist/testing/steps/util/random.step.d.ts.map +1 -1
- package/dist/testing/steps/util/random.step.js +4 -1
- package/dist/testing/steps/util/random.step.js.map +1 -1
- package/package.json +1 -1
- package/resources/admin-embed/solid-admin-embed.js +133 -0
- package/resources/agent-embed/solid-agent-embed.js +243 -4
- package/src/constants/error-messages.ts +2 -1
- package/src/controllers/admin-embed.controller.ts +34 -0
- package/src/controllers/agent-registry.controller.ts +8 -1
- package/src/controllers/agent-session.controller.ts +53 -2
- package/src/controllers/authentication.controller.ts +20 -1
- package/src/controllers/test-data.controller.spec.ts +94 -0
- package/src/controllers/test-data.controller.ts +58 -0
- package/src/dtos/create-agent-job.dto.ts +6 -0
- package/src/dtos/create-agent-process.dto.ts +32 -1
- package/src/dtos/create-agent-registry.dto.ts +34 -1
- package/src/dtos/create-agent-session.dto.ts +1 -1
- package/src/dtos/test-run-request.dto.ts +6 -0
- package/src/dtos/update-agent-deployment.dto.ts +37 -0
- package/src/dtos/update-agent-job.dto.ts +6 -0
- package/src/dtos/update-agent-process.dto.ts +32 -1
- package/src/dtos/update-agent-registry.dto.ts +34 -1
- package/src/dtos/update-agent-session.dto.ts +1 -1
- package/src/entities/agent-job.entity.ts +5 -1
- package/src/entities/agent-process.entity.ts +28 -0
- package/src/entities/agent-registry.entity.ts +15 -0
- package/src/entities/agent-session.entity.ts +3 -0
- package/src/guards/access-token.guard.ts +11 -1
- package/src/helpers/agent-config-version-name.spec.ts +35 -0
- package/src/helpers/agent-config-version-name.ts +16 -0
- package/src/index.ts +5 -0
- package/src/interfaces/active-user-data.interface.ts +3 -0
- package/src/jobs/database/test-run-queue-subscriber-database.service.ts +10 -6
- package/src/seeders/module-test-data.service.spec.ts +184 -0
- package/src/seeders/module-test-data.service.ts +136 -20
- package/src/seeders/seed-data/solid-core-metadata.json +376 -12
- package/src/services/agent-hub-process-manager.service.ts +35 -4
- package/src/services/agent-registry.service.ts +38 -2
- package/src/services/api-key-portal-session.spec.ts +75 -0
- package/src/services/api-key.service.ts +61 -0
- package/src/services/authentication.service.ts +16 -2
- package/src/services/crud.service.ts +30 -2
- package/src/services/settings/default-settings-provider.service.ts +13 -3
- package/src/solid-core.module.ts +5 -0
- package/src/testing/adapters/ui/browser-provisioner.spec.ts +131 -0
- package/src/testing/adapters/ui/browser-provisioner.ts +85 -2
- package/src/testing/adapters/ui/playwright-adapter.ts +53 -11
- package/src/testing/adapters/ui/run-video.spec.ts +72 -0
- package/src/testing/adapters/ui/run-video.ts +122 -0
- package/src/testing/contracts/runtime-context.types.ts +16 -0
- package/src/testing/contracts/testing-metadata.types.ts +5 -0
- package/src/testing/core/interpolation.ts +11 -2
- package/src/testing/core/step-data.spec.ts +59 -0
- package/src/testing/core/step-data.ts +14 -0
- package/src/testing/core/testing-engine.ts +33 -5
- package/src/testing/reporter/lifecycle-events.types.ts +5 -2
- package/src/testing/reporter/lifecycle-webhook-reporter.ts +4 -1
- package/src/testing/reporter/reporter.types.ts +3 -1
- package/src/testing/runner/read-scenarios-file.ts +24 -0
- package/src/testing/runner/run-from-metadata.spec.ts +48 -1
- package/src/testing/runner/run-from-metadata.ts +66 -21
- package/src/testing/runner/scenario-graph.ts +55 -12
- package/src/testing/steps/ui/navigation.step.ts +4 -1
- package/src/testing/steps/util/random.step.ts +4 -1
|
@@ -71,7 +71,8 @@ export const ERROR_MESSAGES = {
|
|
|
71
71
|
// CRUD service errors
|
|
72
72
|
RELATION_TYPE_NOT_SUPPORTED: 'Relation type not supported in CRUD service.',
|
|
73
73
|
NO_SOFT_DELETED_RECORD_FOUND: 'No soft-deleted record found with the given ID.',
|
|
74
|
-
CONFLICTING_RECORD_ON_UNARCHIVE:
|
|
74
|
+
CONFLICTING_RECORD_ON_UNARCHIVE: (conflictDetails = 'the same details') =>
|
|
75
|
+
`A record with ${conflictDetails} already exists. Update or delete the active record before restoring this one.`,
|
|
75
76
|
NO_SOFT_DELETED_RECORDS_FOUND: 'No matching soft-deleted records found.',
|
|
76
77
|
EMPTY_PATH_PARTS: 'Path parts cannot be empty',
|
|
77
78
|
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { Controller, Get, Res } from '@nestjs/common';
|
|
2
|
+
import { Response } from 'express';
|
|
3
|
+
import { existsSync, readFileSync } from 'fs';
|
|
4
|
+
import { resolve } from 'path';
|
|
5
|
+
import { Public } from '../decorators/public.decorator';
|
|
6
|
+
|
|
7
|
+
@Controller('admin-embed')
|
|
8
|
+
export class AdminEmbedController {
|
|
9
|
+
@Public()
|
|
10
|
+
@Get('sdk.js')
|
|
11
|
+
sdk(@Res() response: Response): void {
|
|
12
|
+
let embedUrl: URL;
|
|
13
|
+
try {
|
|
14
|
+
// Falls back to the agent embed's UI URL: both point at the same hosted SolidX UI.
|
|
15
|
+
const ui = new URL(process.env.ADMIN_EMBED_UI_URL || process.env.AGENT_EMBED_UI_URL || '');
|
|
16
|
+
if (!['http:', 'https:'].includes(ui.protocol) || ui.username || ui.password || ui.search || ui.hash) {
|
|
17
|
+
throw new Error('Invalid admin embed UI URL');
|
|
18
|
+
}
|
|
19
|
+
ui.pathname = `${ui.pathname.replace(/\/$/, '')}/embed/admin`;
|
|
20
|
+
embedUrl = ui;
|
|
21
|
+
} catch {
|
|
22
|
+
response.status(503).type('text/plain').send('Admin embed UI is not configured.');
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const packaged = resolve(__dirname, '../resources/admin-embed/solid-admin-embed.js');
|
|
27
|
+
const source = resolve(__dirname, '../../resources/admin-embed/solid-admin-embed.js');
|
|
28
|
+
const sdk = readFileSync(existsSync(packaged) ? packaged : source, 'utf8');
|
|
29
|
+
response.type('application/javascript');
|
|
30
|
+
response.setHeader('Cache-Control', 'no-cache');
|
|
31
|
+
response.setHeader('Cross-Origin-Resource-Policy', 'cross-origin');
|
|
32
|
+
response.send(sdk.replace('__SOLIDX_ADMIN_EMBED_UI_URL__', () => JSON.stringify(embedUrl.href)));
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { Controller, Post, Body, Param, UploadedFiles, UseInterceptors, Put, Get, Query, Delete, Patch } from '@nestjs/common';
|
|
1
|
+
import { Controller, Post, Body, Param, UploadedFiles, UseInterceptors, Put, Get, Query, Delete, Patch, ParseIntPipe } from '@nestjs/common';
|
|
2
2
|
import { AnyFilesInterceptor } from "@nestjs/platform-express";
|
|
3
3
|
import { ApiBearerAuth, ApiQuery, ApiTags } from '@nestjs/swagger';
|
|
4
4
|
import { AgentRegistryService } from '../services/agent-registry.service';
|
|
5
5
|
import { CreateAgentRegistryDto } from '../dtos/create-agent-registry.dto';
|
|
6
6
|
import { UpdateAgentRegistryDto } from '../dtos/update-agent-registry.dto';
|
|
7
7
|
import { ActivateAgentRegistryDto } from '../dtos/activate-agent-registry.dto';
|
|
8
|
+
import { UpdateAgentDeploymentDto } from '../dtos/update-agent-deployment.dto';
|
|
8
9
|
import { ShowSoftDeleted } from '../enums/show-soft-deleted.enum';
|
|
9
10
|
|
|
10
11
|
@ApiTags('Agent Hub')
|
|
@@ -41,6 +42,12 @@ export class AgentRegistryController {
|
|
|
41
42
|
return this.service.update(id, updateDto, files, true);
|
|
42
43
|
}
|
|
43
44
|
|
|
45
|
+
@ApiBearerAuth("jwt")
|
|
46
|
+
@Patch(':id/deployment')
|
|
47
|
+
updateDeployment(@Param('id', ParseIntPipe) id: number, @Body() dto: UpdateAgentDeploymentDto) {
|
|
48
|
+
return this.service.updateDeployment(id, dto);
|
|
49
|
+
}
|
|
50
|
+
|
|
44
51
|
@ApiBearerAuth("jwt")
|
|
45
52
|
@Post(':id/activate')
|
|
46
53
|
activate(@Param('id') id: number, @Body() dto: ActivateAgentRegistryDto) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Controller, Post, Body, Param, UploadedFiles, UseInterceptors, Put, Get, Query, Delete, Patch, ParseIntPipe } from '@nestjs/common';
|
|
1
|
+
import { Controller, Post, Body, Param, UploadedFiles, UseInterceptors, Put, Get, Query, Delete, Patch, ParseIntPipe, Headers, UnauthorizedException, Header } from '@nestjs/common';
|
|
2
2
|
import { AnyFilesInterceptor } from "@nestjs/platform-express";
|
|
3
3
|
import { ApiBearerAuth, ApiQuery, ApiTags } from '@nestjs/swagger';
|
|
4
4
|
import { AgentSessionService } from '../services/agent-session.service';
|
|
@@ -7,11 +7,62 @@ import { UpdateAgentSessionDto } from '../dtos/update-agent-session.dto';
|
|
|
7
7
|
import { ShowSoftDeleted } from '../enums/show-soft-deleted.enum';
|
|
8
8
|
import { ActiveUser } from '../decorators/active-user.decorator';
|
|
9
9
|
import { ActiveUserData } from '../interfaces/active-user-data.interface';
|
|
10
|
+
import { AgentHubProcessManagerService } from '../services/agent-hub-process-manager.service';
|
|
10
11
|
|
|
11
12
|
@ApiTags('Agent Hub')
|
|
12
13
|
@Controller('agent-session')
|
|
13
14
|
export class AgentSessionController {
|
|
14
|
-
constructor(private readonly service: AgentSessionService) {}
|
|
15
|
+
constructor(private readonly service: AgentSessionService, private readonly manager: AgentHubProcessManagerService) {}
|
|
16
|
+
|
|
17
|
+
private bearer(authorization?: string) {
|
|
18
|
+
if (!authorization?.startsWith('Bearer ')) throw new UnauthorizedException();
|
|
19
|
+
return authorization;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
@ApiBearerAuth('jwt')
|
|
23
|
+
@Get('inbox')
|
|
24
|
+
listInbox(@Headers('authorization') authorization: string, @Query('review') review: string,
|
|
25
|
+
@Query('offset') offset: string, @Query('limit') limit: string,
|
|
26
|
+
@Query('agent') agent: string, @Query('status') status: string,
|
|
27
|
+
@Query('trigger') trigger: string, @Query('runtime') runtime: string,
|
|
28
|
+
@Query('startedFrom') startedFrom: string, @Query('startedTo') startedTo: string,
|
|
29
|
+
@Query('q') search: string, @Query('sort') sort: string) {
|
|
30
|
+
const start = Number(offset);
|
|
31
|
+
const pageSize = Number(limit);
|
|
32
|
+
return this.manager.listJobSessions(this.bearer(authorization), {
|
|
33
|
+
review: review === 'true',
|
|
34
|
+
offset: Number.isSafeInteger(start) && start > 0 ? start : 0,
|
|
35
|
+
limit: Number.isSafeInteger(pageSize) && pageSize > 0 ? Math.min(pageSize, 100) : 25,
|
|
36
|
+
agent: agent?.trim() || undefined,
|
|
37
|
+
status: status?.trim() || undefined,
|
|
38
|
+
trigger: trigger?.trim() || undefined,
|
|
39
|
+
runtime: runtime?.trim() || undefined,
|
|
40
|
+
startedFrom: startedFrom?.trim() || undefined,
|
|
41
|
+
startedTo: startedTo?.trim() || undefined,
|
|
42
|
+
search: search?.trim() || undefined,
|
|
43
|
+
sort: sort?.trim() || undefined,
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
@ApiBearerAuth('jwt')
|
|
48
|
+
@Get('inbox/:sessionId')
|
|
49
|
+
getInboxRun(@Headers('authorization') authorization: string, @Param('sessionId') sessionId: string) {
|
|
50
|
+
return this.manager.getJobSession(this.bearer(authorization), sessionId);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
@ApiBearerAuth('jwt')
|
|
54
|
+
@Header('Cache-Control', 'no-store')
|
|
55
|
+
@Post('inbox/:sessionId/connect')
|
|
56
|
+
connectInboxRun(@Headers('authorization') authorization: string, @Param('sessionId') sessionId: string) {
|
|
57
|
+
return this.manager.connectJobSession(this.bearer(authorization), sessionId);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
@ApiBearerAuth('jwt')
|
|
61
|
+
@Post('inbox/:sessionId/requests/:requestId/answer')
|
|
62
|
+
answerInboxRun(@Headers('authorization') authorization: string, @Param('sessionId') sessionId: string,
|
|
63
|
+
@Param('requestId', ParseIntPipe) requestId: number, @Body() answer: unknown) {
|
|
64
|
+
return this.manager.answerJobSession(this.bearer(authorization), sessionId, requestId, answer);
|
|
65
|
+
}
|
|
15
66
|
|
|
16
67
|
@ApiBearerAuth("jwt")
|
|
17
68
|
@Post()
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Body, Controller, Get, HttpCode, HttpStatus, Logger, Param, ParseIntPipe, Patch, Post, Res, Headers } from '@nestjs/common';
|
|
1
|
+
import { Body, Controller, ForbiddenException, Get, Header, HttpCode, HttpStatus, Logger, Param, ParseIntPipe, Patch, Post, Res, Headers } from '@nestjs/common';
|
|
2
2
|
import { ApiBearerAuth, ApiHeader, ApiTags } from '@nestjs/swagger';
|
|
3
3
|
import { Response } from 'express';
|
|
4
4
|
import { ActiveUser } from "../decorators/active-user.decorator";
|
|
@@ -32,6 +32,12 @@ export class AuthenticationController {
|
|
|
32
32
|
private readonly apiKeyService: ApiKeyService,
|
|
33
33
|
) { }
|
|
34
34
|
|
|
35
|
+
private requireInteractiveSession(user: ActiveUserData) {
|
|
36
|
+
if (user?.portalApiKeyId) {
|
|
37
|
+
throw new ForbiddenException('This operation requires an interactive session');
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
35
41
|
@Public()
|
|
36
42
|
// @SkipThrottle({ login: false, short: true, burst: true, sustained: true }) //Enable the login throttle only
|
|
37
43
|
@Post('register')
|
|
@@ -95,6 +101,7 @@ export class AuthenticationController {
|
|
|
95
101
|
@ApiBearerAuth("jwt")
|
|
96
102
|
@Post('change-password')
|
|
97
103
|
changePassword(@Body() changePasswordDto: ChangePasswordDto, @ActiveUser() activeUser: ActiveUserData) {
|
|
104
|
+
this.requireInteractiveSession(activeUser);
|
|
98
105
|
return this.authService.changePassword(changePasswordDto, activeUser);
|
|
99
106
|
}
|
|
100
107
|
|
|
@@ -124,6 +131,7 @@ export class AuthenticationController {
|
|
|
124
131
|
@Body() dto: CreateApiKeyDto,
|
|
125
132
|
@ActiveUser() activeUser: ActiveUserData,
|
|
126
133
|
) {
|
|
134
|
+
this.requireInteractiveSession(activeUser);
|
|
127
135
|
return this.apiKeyService.generate(activeUser.sub, dto);
|
|
128
136
|
}
|
|
129
137
|
|
|
@@ -133,7 +141,9 @@ export class AuthenticationController {
|
|
|
133
141
|
generateApiKeyForUser(
|
|
134
142
|
@Param('userId', ParseIntPipe) userId: number,
|
|
135
143
|
@Body() dto: CreateApiKeyDto,
|
|
144
|
+
@ActiveUser() activeUser: ActiveUserData,
|
|
136
145
|
) {
|
|
146
|
+
this.requireInteractiveSession(activeUser);
|
|
137
147
|
return this.apiKeyService.generate(userId, dto);
|
|
138
148
|
}
|
|
139
149
|
|
|
@@ -155,6 +165,15 @@ export class AuthenticationController {
|
|
|
155
165
|
return this.apiKeyService.apiKeyMe(apiKey);
|
|
156
166
|
}
|
|
157
167
|
|
|
168
|
+
@Public()
|
|
169
|
+
@ApiHeader({ name: 'solidx-api-key', required: true, description: 'API key held by the embedding application server' })
|
|
170
|
+
@Header('Cache-Control', 'no-store')
|
|
171
|
+
@HttpCode(HttpStatus.OK)
|
|
172
|
+
@Post('api-keys/portal-session')
|
|
173
|
+
createPortalSession(@Headers('solidx-api-key') apiKey: string) {
|
|
174
|
+
return this.apiKeyService.createPortalSession(apiKey);
|
|
175
|
+
}
|
|
176
|
+
|
|
158
177
|
@Post('sso/code')
|
|
159
178
|
@HttpCode(HttpStatus.OK)
|
|
160
179
|
generateSsoCode(
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { BadRequestException, ConflictException, NotFoundException, UnprocessableEntityException } from '@nestjs/common';
|
|
2
|
+
import { SolidCoreDefaultSettingsProvider } from 'src/services/settings/default-settings-provider.service';
|
|
3
|
+
import { TestDataController } from './test-data.controller';
|
|
4
|
+
|
|
5
|
+
describe('TestDataController', () => {
|
|
6
|
+
const summary = { rolesProcessed: 0, usersProcessed: 0, data: { created: 1, updated: 0, skipped: 0 } };
|
|
7
|
+
let loadTestData: jest.Mock;
|
|
8
|
+
let settings: Record<string, unknown>;
|
|
9
|
+
let controller: TestDataController;
|
|
10
|
+
|
|
11
|
+
beforeEach(() => {
|
|
12
|
+
settings = { testDataEndpointEnabled: true };
|
|
13
|
+
loadTestData = jest.fn(async () => summary);
|
|
14
|
+
const settingService = { getConfigValue: jest.fn((key: string) => settings[key] ?? null) };
|
|
15
|
+
controller = new TestDataController({ loadTestData } as any, settingService as any);
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
it('returns the load summary', async () => {
|
|
19
|
+
const testing = { data: [] };
|
|
20
|
+
await expect(controller.load({ testing })).resolves.toBe(summary);
|
|
21
|
+
expect(loadTestData).toHaveBeenCalledWith(testing);
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
it('responds 404 and loads nothing when the setting is off', async () => {
|
|
25
|
+
settings.testDataEndpointEnabled = false;
|
|
26
|
+
|
|
27
|
+
await expect(controller.load({ testing: {} })).rejects.toBeInstanceOf(NotFoundException);
|
|
28
|
+
expect(loadTestData).not.toHaveBeenCalled();
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
it('responds 404 when the setting is not present', async () => {
|
|
32
|
+
delete settings.testDataEndpointEnabled;
|
|
33
|
+
|
|
34
|
+
await expect(controller.load({ testing: {} })).rejects.toBeInstanceOf(NotFoundException);
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
it('responds 400 when the body has no testing object', async () => {
|
|
38
|
+
await expect(controller.load({} as any)).rejects.toBeInstanceOf(BadRequestException);
|
|
39
|
+
await expect(controller.load(undefined as any)).rejects.toBeInstanceOf(BadRequestException);
|
|
40
|
+
expect(loadTestData).not.toHaveBeenCalled();
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
it('responds 409 to a second load while one is running, and accepts a new one afterwards', async () => {
|
|
44
|
+
let finish!: (value: typeof summary) => void;
|
|
45
|
+
loadTestData.mockImplementationOnce(() => new Promise((resolve) => { finish = resolve; }));
|
|
46
|
+
|
|
47
|
+
const first = controller.load({ testing: { data: [] } });
|
|
48
|
+
await expect(controller.load({ testing: { data: [] } })).rejects.toBeInstanceOf(ConflictException);
|
|
49
|
+
finish(summary);
|
|
50
|
+
await first;
|
|
51
|
+
|
|
52
|
+
await expect(controller.load({ testing: { data: [] } })).resolves.toBe(summary);
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
it('releases the lock when a load fails', async () => {
|
|
56
|
+
loadTestData.mockRejectedValueOnce(new Error('boom'));
|
|
57
|
+
await expect(controller.load({ testing: { data: [] } })).rejects.toBeInstanceOf(UnprocessableEntityException);
|
|
58
|
+
|
|
59
|
+
await expect(controller.load({ testing: { data: [] } })).resolves.toBe(summary);
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
it('responds 422 with the message when the load fails', async () => {
|
|
63
|
+
loadTestData.mockRejectedValueOnce(new Error('Test data relation not found: author.authorCode=A9'));
|
|
64
|
+
|
|
65
|
+
const failure = controller.load({ testing: { data: [] } });
|
|
66
|
+
await expect(failure).rejects.toBeInstanceOf(UnprocessableEntityException);
|
|
67
|
+
await expect(failure).rejects.toThrow('Test data relation not found: author.authorCode=A9');
|
|
68
|
+
});
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
describe('testDataEndpointEnabled setting', () => {
|
|
72
|
+
const find = () =>
|
|
73
|
+
new SolidCoreDefaultSettingsProvider().getSettings().find((s: any) => s.key === 'testDataEndpointEnabled') as any;
|
|
74
|
+
const original = process.env.SOLIDX_TEST_DATA_ENDPOINT_ENABLED;
|
|
75
|
+
afterEach(() => {
|
|
76
|
+
if (original === undefined) delete process.env.SOLIDX_TEST_DATA_ENDPOINT_ENABLED;
|
|
77
|
+
else process.env.SOLIDX_TEST_DATA_ENDPOINT_ENABLED = original;
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
it('is on only when SOLIDX_TEST_DATA_ENDPOINT_ENABLED is "true"', () => {
|
|
81
|
+
process.env.SOLIDX_TEST_DATA_ENDPOINT_ENABLED = 'true';
|
|
82
|
+
expect(find().value).toBe(true);
|
|
83
|
+
|
|
84
|
+
process.env.SOLIDX_TEST_DATA_ENDPOINT_ENABLED = 'yes';
|
|
85
|
+
expect(find().value).toBe(false);
|
|
86
|
+
|
|
87
|
+
delete process.env.SOLIDX_TEST_DATA_ENDPOINT_ENABLED;
|
|
88
|
+
expect(find().value).toBe(false);
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
it('is SystemEnv, so the settings screen and settings API never return it', () => {
|
|
92
|
+
expect(find().level).toBe('system-env');
|
|
93
|
+
});
|
|
94
|
+
});
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import {
|
|
2
|
+
BadRequestException,
|
|
3
|
+
Body,
|
|
4
|
+
ConflictException,
|
|
5
|
+
Controller,
|
|
6
|
+
HttpCode,
|
|
7
|
+
HttpStatus,
|
|
8
|
+
NotFoundException,
|
|
9
|
+
Post,
|
|
10
|
+
UnprocessableEntityException,
|
|
11
|
+
} from '@nestjs/common';
|
|
12
|
+
import { ApiTags } from '@nestjs/swagger';
|
|
13
|
+
|
|
14
|
+
import { ModuleTestDataService, TestDataSpec } from 'src/seeders/module-test-data.service';
|
|
15
|
+
import { SettingService } from 'src/services/setting.service';
|
|
16
|
+
import { SolidCoreSetting } from 'src/services/settings/default-settings-provider.service';
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Loads `testing` roles, users and data into this application's database, idempotently.
|
|
20
|
+
* Test Hub calls this before a run so seed data is present for the run. Disabled unless the
|
|
21
|
+
* testDataEndpointEnabled setting is on, which comes from SOLIDX_TEST_DATA_ENDPOINT_ENABLED=true. Uses the default auth guards, so the caller needs
|
|
22
|
+
* a Bearer token or API key whose role has TestDataController.load. One load runs at a time per process: a
|
|
23
|
+
* second request while one is running gets 409, so two loads can never both create the same record.
|
|
24
|
+
*/
|
|
25
|
+
@Controller('test-data')
|
|
26
|
+
@ApiTags('Solid Core')
|
|
27
|
+
export class TestDataController {
|
|
28
|
+
private static loadInProgress = false;
|
|
29
|
+
|
|
30
|
+
constructor(
|
|
31
|
+
private readonly moduleTestDataService: ModuleTestDataService,
|
|
32
|
+
private readonly settingService: SettingService,
|
|
33
|
+
) {}
|
|
34
|
+
|
|
35
|
+
@Post('load')
|
|
36
|
+
@HttpCode(HttpStatus.OK)
|
|
37
|
+
async load(@Body() body: { testing?: TestDataSpec }) {
|
|
38
|
+
if (this.settingService.getConfigValue<SolidCoreSetting>('testDataEndpointEnabled') !== true) {
|
|
39
|
+
throw new NotFoundException();
|
|
40
|
+
}
|
|
41
|
+
if (!body || typeof body.testing !== 'object' || body.testing === null) {
|
|
42
|
+
throw new BadRequestException('Request body must contain a "testing" object.');
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
if (TestDataController.loadInProgress) {
|
|
46
|
+
throw new ConflictException('A test data load is already in progress.');
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
TestDataController.loadInProgress = true;
|
|
50
|
+
try {
|
|
51
|
+
return await this.moduleTestDataService.loadTestData(body.testing);
|
|
52
|
+
} catch (error) {
|
|
53
|
+
throw new UnprocessableEntityException(error instanceof Error ? error.message : 'Test data load failed.');
|
|
54
|
+
} finally {
|
|
55
|
+
TestDataController.loadInProgress = false;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
@@ -56,6 +56,12 @@ export class CreateAgentJobDto {
|
|
|
56
56
|
@ApiProperty()
|
|
57
57
|
leaseExpiresAt: Date;
|
|
58
58
|
|
|
59
|
+
@IsOptional()
|
|
60
|
+
@Type(() => Date)
|
|
61
|
+
@IsDate()
|
|
62
|
+
@ApiProperty({ required: false, nullable: true, type: Date })
|
|
63
|
+
dispatchedAt?: Date | null;
|
|
64
|
+
|
|
59
65
|
@IsNotEmpty()
|
|
60
66
|
@IsInt()
|
|
61
67
|
@ApiProperty()
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ApiProperty } from '@nestjs/swagger';
|
|
2
2
|
import { IsInt } from 'class-validator';
|
|
3
3
|
import { IsOptional } from 'class-validator';
|
|
4
|
-
import { IsString, IsNotEmpty, IsJSON, IsDate, ValidateNested, IsArray } from 'class-validator';
|
|
4
|
+
import { IsString, IsNotEmpty, IsJSON, IsDate, ValidateNested, IsArray, MaxLength, Min } from 'class-validator';
|
|
5
5
|
import { Type } from 'class-transformer';
|
|
6
6
|
import { UpdateAgentSessionDto } from './update-agent-session.dto';
|
|
7
7
|
|
|
@@ -31,6 +31,37 @@ export class CreateAgentProcessDto {
|
|
|
31
31
|
@ApiProperty()
|
|
32
32
|
pid: number;
|
|
33
33
|
|
|
34
|
+
@IsOptional()
|
|
35
|
+
@IsString()
|
|
36
|
+
@IsNotEmpty()
|
|
37
|
+
@ApiProperty({ required: false, nullable: true, type: String })
|
|
38
|
+
runner?: string | null;
|
|
39
|
+
|
|
40
|
+
@IsOptional()
|
|
41
|
+
@IsString()
|
|
42
|
+
@MaxLength(512)
|
|
43
|
+
@ApiProperty({ required: false, nullable: true, type: String, maxLength: 512 })
|
|
44
|
+
runnerRef?: string | null;
|
|
45
|
+
|
|
46
|
+
@IsOptional()
|
|
47
|
+
@IsString()
|
|
48
|
+
@ApiProperty({ required: false, nullable: true, type: String })
|
|
49
|
+
runtimeVersion?: string | null;
|
|
50
|
+
|
|
51
|
+
@IsOptional()
|
|
52
|
+
@Type(() => Number)
|
|
53
|
+
@IsInt()
|
|
54
|
+
@Min(1)
|
|
55
|
+
@ApiProperty({ required: false, nullable: true, type: Number, minimum: 1 })
|
|
56
|
+
cpu?: number | null;
|
|
57
|
+
|
|
58
|
+
@IsOptional()
|
|
59
|
+
@Type(() => Number)
|
|
60
|
+
@IsInt()
|
|
61
|
+
@Min(1)
|
|
62
|
+
@ApiProperty({ required: false, nullable: true, type: Number, minimum: 1 })
|
|
63
|
+
memory?: number | null;
|
|
64
|
+
|
|
34
65
|
@IsNotEmpty()
|
|
35
66
|
@IsString()
|
|
36
67
|
@ApiProperty()
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ApiProperty } from '@nestjs/swagger';
|
|
2
2
|
import { IsString } from 'class-validator';
|
|
3
|
-
import { IsNotEmpty, IsJSON, IsInt, IsNumber, ValidateNested, IsArray, IsOptional } from 'class-validator';
|
|
3
|
+
import { IsNotEmpty, IsJSON, IsInt, IsNumber, ValidateNested, IsArray, IsOptional, Min, ValidateIf } from 'class-validator';
|
|
4
4
|
import { Type } from 'class-transformer';
|
|
5
5
|
import { UpdateAgentToolDto } from './update-agent-tool.dto';
|
|
6
6
|
import { UpdateAgentSkillDto } from './update-agent-skill.dto';
|
|
@@ -77,6 +77,39 @@ export class CreateAgentRegistryDto {
|
|
|
77
77
|
@ApiProperty({ required: false })
|
|
78
78
|
configVersion?: number;
|
|
79
79
|
|
|
80
|
+
@IsOptional()
|
|
81
|
+
@IsString()
|
|
82
|
+
@IsNotEmpty()
|
|
83
|
+
@ApiProperty({ required: false, nullable: true, type: String })
|
|
84
|
+
runner?: string | null;
|
|
85
|
+
|
|
86
|
+
@ValidateIf((_object, value) => value !== undefined)
|
|
87
|
+
@IsInt()
|
|
88
|
+
@Min(0)
|
|
89
|
+
@ApiProperty({ required: false, minimum: 0 })
|
|
90
|
+
minProcesses?: number;
|
|
91
|
+
|
|
92
|
+
@IsOptional()
|
|
93
|
+
@Type(() => Number)
|
|
94
|
+
@IsInt()
|
|
95
|
+
@Min(1)
|
|
96
|
+
@ApiProperty({ required: false, nullable: true, type: Number, minimum: 1 })
|
|
97
|
+
maxProcesses?: number | null;
|
|
98
|
+
|
|
99
|
+
@IsOptional()
|
|
100
|
+
@Type(() => Number)
|
|
101
|
+
@IsInt()
|
|
102
|
+
@Min(1)
|
|
103
|
+
@ApiProperty({ required: false, nullable: true, type: Number, minimum: 1 })
|
|
104
|
+
processCpu?: number | null;
|
|
105
|
+
|
|
106
|
+
@IsOptional()
|
|
107
|
+
@Type(() => Number)
|
|
108
|
+
@IsInt()
|
|
109
|
+
@Min(1)
|
|
110
|
+
@ApiProperty({ required: false, nullable: true, type: Number, minimum: 1 })
|
|
111
|
+
processMemory?: number | null;
|
|
112
|
+
|
|
80
113
|
@IsOptional()
|
|
81
114
|
@IsInt()
|
|
82
115
|
@ApiProperty({ required: false })
|
|
@@ -45,6 +45,12 @@ export class TestRunRequestDto {
|
|
|
45
45
|
@IsString()
|
|
46
46
|
scenariosPath?: string;
|
|
47
47
|
|
|
48
|
+
/** One file per scenario, in run order (each holds one scenario's JSON). Takes precedence over `scenariosPath`. */
|
|
49
|
+
@IsOptional()
|
|
50
|
+
@IsArray()
|
|
51
|
+
@IsString({ each: true })
|
|
52
|
+
scenarioPaths?: string[];
|
|
53
|
+
|
|
48
54
|
@IsOptional()
|
|
49
55
|
@IsArray()
|
|
50
56
|
data?: TestingDataRecord[];
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { ApiPropertyOptional } from '@nestjs/swagger';
|
|
2
|
+
import { Type } from 'class-transformer';
|
|
3
|
+
import { IsIn, IsInt, IsOptional, Min, ValidateIf } from 'class-validator';
|
|
4
|
+
|
|
5
|
+
export class UpdateAgentDeploymentDto {
|
|
6
|
+
@ApiPropertyOptional({ enum: ['local', 'docker', 'ecs'], nullable: true })
|
|
7
|
+
@IsOptional()
|
|
8
|
+
@IsIn(['local', 'docker', 'ecs'])
|
|
9
|
+
runner?: 'local' | 'docker' | 'ecs' | null;
|
|
10
|
+
|
|
11
|
+
@ApiPropertyOptional({ minimum: 0 })
|
|
12
|
+
@ValidateIf((_object, value) => value !== undefined)
|
|
13
|
+
@IsInt()
|
|
14
|
+
@Min(0)
|
|
15
|
+
minProcesses?: number;
|
|
16
|
+
|
|
17
|
+
@ApiPropertyOptional({ nullable: true, minimum: 1, type: Number })
|
|
18
|
+
@IsOptional()
|
|
19
|
+
@Type(() => Number)
|
|
20
|
+
@IsInt()
|
|
21
|
+
@Min(1)
|
|
22
|
+
maxProcesses?: number | null;
|
|
23
|
+
|
|
24
|
+
@ApiPropertyOptional({ nullable: true, minimum: 1, type: Number })
|
|
25
|
+
@IsOptional()
|
|
26
|
+
@Type(() => Number)
|
|
27
|
+
@IsInt()
|
|
28
|
+
@Min(1)
|
|
29
|
+
processCpu?: number | null;
|
|
30
|
+
|
|
31
|
+
@ApiPropertyOptional({ nullable: true, minimum: 1, type: Number })
|
|
32
|
+
@IsOptional()
|
|
33
|
+
@Type(() => Number)
|
|
34
|
+
@IsInt()
|
|
35
|
+
@Min(1)
|
|
36
|
+
processMemory?: number | null;
|
|
37
|
+
}
|
|
@@ -61,6 +61,12 @@ export class UpdateAgentJobDto {
|
|
|
61
61
|
@ApiProperty()
|
|
62
62
|
leaseExpiresAt: Date;
|
|
63
63
|
|
|
64
|
+
@IsOptional()
|
|
65
|
+
@Type(() => Date)
|
|
66
|
+
@IsDate()
|
|
67
|
+
@ApiProperty({ required: false, nullable: true, type: Date })
|
|
68
|
+
dispatchedAt?: Date | null;
|
|
69
|
+
|
|
64
70
|
@IsNotEmpty()
|
|
65
71
|
@IsOptional()
|
|
66
72
|
@IsInt()
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IsInt,IsOptional, IsString, IsNotEmpty, IsJSON, IsDate, ValidateNested, IsArray } from 'class-validator';
|
|
1
|
+
import { IsInt,IsOptional, IsString, IsNotEmpty, IsJSON, IsDate, ValidateNested, IsArray, MaxLength, Min } from 'class-validator';
|
|
2
2
|
import { ApiProperty } from '@nestjs/swagger';
|
|
3
3
|
import { Type } from 'class-transformer';
|
|
4
4
|
import { UpdateAgentSessionDto } from './update-agent-session.dto';
|
|
@@ -35,6 +35,37 @@ export class UpdateAgentProcessDto {
|
|
|
35
35
|
@ApiProperty()
|
|
36
36
|
pid: number;
|
|
37
37
|
|
|
38
|
+
@IsOptional()
|
|
39
|
+
@IsString()
|
|
40
|
+
@IsNotEmpty()
|
|
41
|
+
@ApiProperty({ required: false, nullable: true, type: String })
|
|
42
|
+
runner?: string | null;
|
|
43
|
+
|
|
44
|
+
@IsOptional()
|
|
45
|
+
@IsString()
|
|
46
|
+
@MaxLength(512)
|
|
47
|
+
@ApiProperty({ required: false, nullable: true, type: String, maxLength: 512 })
|
|
48
|
+
runnerRef?: string | null;
|
|
49
|
+
|
|
50
|
+
@IsOptional()
|
|
51
|
+
@IsString()
|
|
52
|
+
@ApiProperty({ required: false, nullable: true, type: String })
|
|
53
|
+
runtimeVersion?: string | null;
|
|
54
|
+
|
|
55
|
+
@IsOptional()
|
|
56
|
+
@Type(() => Number)
|
|
57
|
+
@IsInt()
|
|
58
|
+
@Min(1)
|
|
59
|
+
@ApiProperty({ required: false, nullable: true, type: Number, minimum: 1 })
|
|
60
|
+
cpu?: number | null;
|
|
61
|
+
|
|
62
|
+
@IsOptional()
|
|
63
|
+
@Type(() => Number)
|
|
64
|
+
@IsInt()
|
|
65
|
+
@Min(1)
|
|
66
|
+
@ApiProperty({ required: false, nullable: true, type: Number, minimum: 1 })
|
|
67
|
+
memory?: number | null;
|
|
68
|
+
|
|
38
69
|
@IsNotEmpty()
|
|
39
70
|
@IsOptional()
|
|
40
71
|
@IsString()
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IsInt,IsOptional, IsString, IsNotEmpty, IsJSON, IsNumber, ValidateNested, IsArray } from 'class-validator';
|
|
1
|
+
import { IsInt,IsOptional, IsString, IsNotEmpty, IsJSON, IsNumber, ValidateNested, IsArray, Min, ValidateIf } from 'class-validator';
|
|
2
2
|
import { ApiProperty } from '@nestjs/swagger';
|
|
3
3
|
import { Type } from 'class-transformer';
|
|
4
4
|
import { UpdateAgentToolDto } from './update-agent-tool.dto';
|
|
@@ -90,6 +90,39 @@ export class UpdateAgentRegistryDto {
|
|
|
90
90
|
@ApiProperty({ required: false })
|
|
91
91
|
configVersion?: number;
|
|
92
92
|
|
|
93
|
+
@IsOptional()
|
|
94
|
+
@IsString()
|
|
95
|
+
@IsNotEmpty()
|
|
96
|
+
@ApiProperty({ required: false, nullable: true, type: String })
|
|
97
|
+
runner?: string | null;
|
|
98
|
+
|
|
99
|
+
@ValidateIf((_object, value) => value !== undefined)
|
|
100
|
+
@IsInt()
|
|
101
|
+
@Min(0)
|
|
102
|
+
@ApiProperty({ required: false, minimum: 0 })
|
|
103
|
+
minProcesses?: number;
|
|
104
|
+
|
|
105
|
+
@IsOptional()
|
|
106
|
+
@Type(() => Number)
|
|
107
|
+
@IsInt()
|
|
108
|
+
@Min(1)
|
|
109
|
+
@ApiProperty({ required: false, nullable: true, type: Number, minimum: 1 })
|
|
110
|
+
maxProcesses?: number | null;
|
|
111
|
+
|
|
112
|
+
@IsOptional()
|
|
113
|
+
@Type(() => Number)
|
|
114
|
+
@IsInt()
|
|
115
|
+
@Min(1)
|
|
116
|
+
@ApiProperty({ required: false, nullable: true, type: Number, minimum: 1 })
|
|
117
|
+
processCpu?: number | null;
|
|
118
|
+
|
|
119
|
+
@IsOptional()
|
|
120
|
+
@Type(() => Number)
|
|
121
|
+
@IsInt()
|
|
122
|
+
@Min(1)
|
|
123
|
+
@ApiProperty({ required: false, nullable: true, type: Number, minimum: 1 })
|
|
124
|
+
processMemory?: number | null;
|
|
125
|
+
|
|
93
126
|
@IsOptional()
|
|
94
127
|
@IsInt()
|
|
95
128
|
@ApiProperty({ required: false })
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { CommonEntity } from 'src/entities/common.entity';
|
|
2
|
-
import { Entity, JoinColumn, ManyToOne, Column, OneToMany } from 'typeorm';
|
|
2
|
+
import { Entity, Index, JoinColumn, ManyToOne, Column, OneToMany } from 'typeorm';
|
|
3
3
|
import { AgentSession } from './agent-session.entity';
|
|
4
4
|
import { AgentRegistry } from './agent-registry.entity';
|
|
5
5
|
import { AgentHumanRequest } from './agent-human-request.entity';
|
|
6
6
|
import { getColumnType, getCurrentTimestampDefault } from 'src/helpers/typeorm-db-helper';
|
|
7
7
|
|
|
8
8
|
@Entity('ss_agent_job')
|
|
9
|
+
@Index(['agent', 'status', 'queuedAt'])
|
|
9
10
|
export class AgentJob extends CommonEntity {
|
|
10
11
|
@ManyToOne(() => AgentSession, { onDelete: "SET NULL", nullable: true })
|
|
11
12
|
@JoinColumn()
|
|
@@ -60,6 +61,9 @@ export class AgentJob extends CommonEntity {
|
|
|
60
61
|
@Column({ ...getColumnType('datetimeWithTimezone'), default: () => getCurrentTimestampDefault() })
|
|
61
62
|
queuedAt: Date = new Date();
|
|
62
63
|
|
|
64
|
+
@Column({ ...getColumnType('datetimeWithTimezone'), nullable: true })
|
|
65
|
+
dispatchedAt: Date | null;
|
|
66
|
+
|
|
63
67
|
@Column({ ...getColumnType('datetimeWithTimezone'), nullable: true })
|
|
64
68
|
startedAt: Date;
|
|
65
69
|
|