@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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update-agent-session.dto.js","sourceRoot":"","sources":["../../src/dtos/update-agent-session.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,qDAAkI;AAClI,6CAA8C;AAC9C,yDAAyC;AACzC,iEAA2D;AAC3D,qEAA+D;AAC/D,+FAAwF;AACxF,qFAA8E;AAE9E,MAAa,qBAAqB;;qXAiCxB,CAAC,QAAQ,EAAE,UAAU,CAAC;;CAqJ/B;AAtLD,sDAsLC;AAnLG;IAFC,IAAA,4BAAU,GAAE;IACZ,IAAA,uBAAK,GAAE;;iDACG;AAKX;IAHC,IAAA,4BAAU,GAAE;IACZ,IAAA,uBAA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AAA,qBAAW,GAAE;;6DACW;AAKzB;IAHC,IAAA,0BAAQ,GAAE;IACV,IAAA,4BAAU,GAAE;IACZ,IAAA,qBAAW,GAAE;;iEACa;AAO3B;IALC,IAAA,4BAAU,GAAE;IACZ,IAAA,qBAAW,GAAE;IACb,IAAA,yBAAO,GAAE;IACT,IAAA,gCAAc,EAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;IAC9B,IAAA,wBAAI,EAAC,GAAG,EAAE,CAAC,qEAA+B,CAAC;;sEACe;AAK3D;IAHC,IAAA,4BAAU,GAAE;IACZ,IAAA,yBAAO,GAAE;IACT,IAAA,qBAAW,GAAE;;yEACuB;AAKrC;IAHC,IAAA,0BAAQ,GAAE;IACV,IAAA,4BAAU,GAAE;IACZ,IAAA,qBAAW,GAAE;;6EACyB;AAOvC;IALC,IAAA,4BAAU,GAAE;IACZ,IAAA,qBAAW,GAAE;IACb,IAAA,yBAAO,GAAE;IACT,IAAA,gCAAc,EAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;IAC9B,IAAA,wBAAI,EAAC,GAAG,EAAE,CAAC,2DAA0B,CAAC;;iEACU;AAKjD;IAHC,IAAA,4BAAU,GAAE;IACZ,IAAA,yBAAO,GAAE;IACT,IAAA,qBAAW,GAAE;;oEACkB;AAKhC;IAHC,IAAA,0BAAQ,GAAE;IACV,IAAA,4BAAU,GAAE;IACZ,IAAA,qBAAW,GAAE;;wEACoB","sourcesContent":["import { IsInt,IsOptional, IsString, IsNotEmpty, IsJSON, IsNumber, IsDate, ValidateNested, IsArray, IsIn } from 'class-validator';\nimport { ApiProperty } from '@nestjs/swagger';\nimport { Type } from 'class-transformer';\nimport { UpdateAgentJobDto } from './update-agent-job.dto';\nimport { UpdateAgentEventDto } from './update-agent-event.dto';\nimport { UpdateAgentSessionCheckpointDto } from './update-agent-session-checkpoint.dto';\nimport { UpdateAgentHumanRequestDto } from './update-agent-human-request.dto';\n\nexport class UpdateAgentSessionDto {\n @IsOptional()\n @IsInt()\n id: number;\n\n @IsOptional()\n @IsInt()\n @ApiProperty()\n agentId: number;\n\n @IsString()\n @IsOptional()\n @ApiProperty()\n agentUserKey: string;\n\n @IsOptional()\n @IsInt()\n @ApiProperty()\n processId: number;\n\n @IsString()\n @IsOptional()\n @ApiProperty()\n processUserKey: string;\n\n @IsNotEmpty()\n @IsOptional()\n @IsString()\n @ApiProperty({ description: \"Original session entry point. Use api or webhook for the background jobs inbox.\" })\n trigger: string;\n\n @IsOptional()\n @IsString()\n @IsIn([\"solidx\", \"agentHub\"])\n @ApiProperty({ enum: [\"solidx\", \"agentHub\"], required: false })\n runtime: \"solidx\" | \"agentHub\";\n\n @IsOptional()\n @IsInt()\n @ApiProperty()\n userId: number;\n\n @IsString()\n @IsOptional()\n @ApiProperty()\n userUserKey: string;\n\n @IsNotEmpty()\n @IsOptional()\n @IsString()\n @ApiProperty({ description: \"queued: Background session waiting for its first job to be claimed; active: Interactive session open, waiting for the user's next message; running: A turn is executing; awaiting_input: Parked on a request_human_input question; awaiting_approval: Parked on a tool approval; completed, failed, cancelled, expired: Terminal.\" })\n status: string;\n\n @IsNotEmpty()\n @IsOptional()\n @IsString()\n @ApiProperty()\n inputs: string;\n\n @IsNotEmpty()\n @IsOptional()\n @IsInt()\n @ApiProperty()\n configVersion: number;\n\n @IsNotEmpty()\n @IsOptional()\n @IsInt()\n @ApiProperty()\n turnCount: number;\n\n @IsNotEmpty()\n @IsOptional()\n @IsInt()\n @ApiProperty()\n totalSteps: number;\n\n @IsNotEmpty()\n @IsOptional()\n @IsInt()\n @ApiProperty()\n totalInputTokens: number;\n\n @IsNotEmpty()\n @IsOptional()\n @IsInt()\n @ApiProperty()\n totalOutputTokens: number;\n\n @IsNotEmpty()\n @IsOptional()\n @IsNumber()\n @ApiProperty()\n totalCost: number;\n\n @IsOptional()\n @IsString()\n @ApiProperty()\n error: string;\n\n @IsOptional()\n @IsDate()\n @ApiProperty()\n endedAt: Date;\n\n @IsOptional()\n @IsString()\n @ApiProperty()\n reasoningModelKey: string;\n\n @IsOptional()\n @IsString()\n @ApiProperty()\n fastModelKey: string;\n\n @IsOptional()\n @ApiProperty()\n @IsArray()\n @ValidateNested({ each: true })\n @Type(() => UpdateAgentJobDto)\n agentJobs: UpdateAgentJobDto[];\n\n @IsOptional()\n @IsArray()\n @ApiProperty()\n agentJobsIds: number[];\n\n @IsString()\n @IsOptional()\n @ApiProperty()\n agentJobsCommand: string;\n\n @IsOptional()\n @ApiProperty()\n @IsArray()\n @ValidateNested({ each: true })\n @Type(() => UpdateAgentEventDto)\n agentEvents: UpdateAgentEventDto[];\n\n @IsOptional()\n @IsArray()\n @ApiProperty()\n agentEventsIds: number[];\n\n @IsString()\n @IsOptional()\n @ApiProperty()\n agentEventsCommand: string;\n\n @IsOptional()\n @ApiProperty()\n @IsArray()\n @ValidateNested({ each: true })\n @Type(() => UpdateAgentSessionCheckpointDto)\n agentSessionCheckpoints: UpdateAgentSessionCheckpointDto[];\n\n @IsOptional()\n @IsArray()\n @ApiProperty()\n agentSessionCheckpointsIds: number[];\n\n @IsString()\n @IsOptional()\n @ApiProperty()\n agentSessionCheckpointsCommand: string;\n\n @IsOptional()\n @ApiProperty()\n @IsArray()\n @ValidateNested({ each: true })\n @Type(() => UpdateAgentHumanRequestDto)\n agentHumanRequests: UpdateAgentHumanRequestDto[];\n\n @IsOptional()\n @IsArray()\n @ApiProperty()\n agentHumanRequestsIds: number[];\n\n @IsString()\n @IsOptional()\n @ApiProperty()\n agentHumanRequestsCommand: string;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-job.entity.d.ts","sourceRoot":"","sources":["../../src/entities/agent-job.entity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE1D,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAGjE,
|
|
1
|
+
{"version":3,"file":"agent-job.entity.d.ts","sourceRoot":"","sources":["../../src/entities/agent-job.entity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE1D,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAGjE,qBAEa,QAAS,SAAQ,YAAY;IAGtC,OAAO,EAAE,YAAY,CAAC;IAItB,KAAK,EAAE,aAAa,CAAC;IAGrB,IAAI,EAAE,MAAM,CAAW;IAGvB,KAAK,EAAE,MAAM,CAAC;IAGd,cAAc,EAAE,MAAM,CAAC;IAGvB,MAAM,EAAE,MAAM,CAAY;IAG1B,UAAU,EAAE,MAAM,CAAC;IAGnB,cAAc,EAAE,IAAI,CAAC;IAGrB,QAAQ,EAAE,MAAM,CAAK;IAGrB,cAAc,EAAE,MAAM,CAAC;IAGvB,UAAU,EAAE,MAAM,CAAC;IAGnB,aAAa,EAAE,MAAM,CAAC;IAGtB,cAAc,EAAE,MAAM,CAAC;IAGvB,QAAQ,EAAE,MAAM,CAAC;IAGjB,MAAM,EAAE,MAAM,CAAC;IAGf,KAAK,EAAE,MAAM,CAAC;IAGd,QAAQ,EAAE,IAAI,CAAc;IAG5B,YAAY,EAAE,IAAI,GAAG,IAAI,CAAC;IAG1B,SAAS,EAAE,IAAI,CAAC;IAGhB,UAAU,EAAE,IAAI,CAAC;IAGjB,kBAAkB,EAAE,iBAAiB,EAAE,CAAC;CAC3C"}
|
|
@@ -26,7 +26,7 @@ let AgentJob = class AgentJob extends common_entity_1.CommonEntity {
|
|
|
26
26
|
this.queuedAt = new Date();
|
|
27
27
|
}
|
|
28
28
|
static _OPENAPI_METADATA_FACTORY() {
|
|
29
|
-
return { session: { required: true, type: () => require("./agent-session.entity").AgentSession }, agent: { required: true, type: () => require("./agent-registry.entity").AgentRegistry }, kind: { required: true, type: () => String, default: "start" }, input: { required: true, type: () => String }, callerSnapshot: { required: true, type: () => String }, status: { required: true, type: () => String, default: "queued" }, leaseToken: { required: true, type: () => String }, leaseExpiresAt: { required: true, type: () => Date }, attempts: { required: true, type: () => Number, default: 0 }, idempotencyKey: { required: true, type: () => String }, webhookUrl: { required: true, type: () => String }, webhookSecret: { required: true, type: () => String }, timeoutSeconds: { required: true, type: () => Number }, maxSteps: { required: true, type: () => Number }, result: { required: true, type: () => String }, error: { required: true, type: () => String }, queuedAt: { required: true, type: () => Date, default: new Date() }, startedAt: { required: true, type: () => Date }, finishedAt: { required: true, type: () => Date }, agentHumanRequests: { required: true, type: () => [require("./agent-human-request.entity").AgentHumanRequest] } };
|
|
29
|
+
return { session: { required: true, type: () => require("./agent-session.entity").AgentSession }, agent: { required: true, type: () => require("./agent-registry.entity").AgentRegistry }, kind: { required: true, type: () => String, default: "start" }, input: { required: true, type: () => String }, callerSnapshot: { required: true, type: () => String }, status: { required: true, type: () => String, default: "queued" }, leaseToken: { required: true, type: () => String }, leaseExpiresAt: { required: true, type: () => Date }, attempts: { required: true, type: () => Number, default: 0 }, idempotencyKey: { required: true, type: () => String }, webhookUrl: { required: true, type: () => String }, webhookSecret: { required: true, type: () => String }, timeoutSeconds: { required: true, type: () => Number }, maxSteps: { required: true, type: () => Number }, result: { required: true, type: () => String }, error: { required: true, type: () => String }, queuedAt: { required: true, type: () => Date, default: new Date() }, dispatchedAt: { required: true, type: () => Date, nullable: true }, startedAt: { required: true, type: () => Date }, finishedAt: { required: true, type: () => Date }, agentHumanRequests: { required: true, type: () => [require("./agent-human-request.entity").AgentHumanRequest] } };
|
|
30
30
|
}
|
|
31
31
|
};
|
|
32
32
|
exports.AgentJob = AgentJob;
|
|
@@ -100,6 +100,10 @@ __decorate([
|
|
|
100
100
|
(0, typeorm_1.Column)({ ...(0, typeorm_db_helper_1.getColumnType)('datetimeWithTimezone'), default: () => (0, typeorm_db_helper_1.getCurrentTimestampDefault)() }),
|
|
101
101
|
__metadata("design:type", Date)
|
|
102
102
|
], AgentJob.prototype, "queuedAt", void 0);
|
|
103
|
+
__decorate([
|
|
104
|
+
(0, typeorm_1.Column)({ ...(0, typeorm_db_helper_1.getColumnType)('datetimeWithTimezone'), nullable: true }),
|
|
105
|
+
__metadata("design:type", Date)
|
|
106
|
+
], AgentJob.prototype, "dispatchedAt", void 0);
|
|
103
107
|
__decorate([
|
|
104
108
|
(0, typeorm_1.Column)({ ...(0, typeorm_db_helper_1.getColumnType)('datetimeWithTimezone'), nullable: true }),
|
|
105
109
|
__metadata("design:type", Date)
|
|
@@ -113,6 +117,7 @@ __decorate([
|
|
|
113
117
|
__metadata("design:type", Array)
|
|
114
118
|
], AgentJob.prototype, "agentHumanRequests", void 0);
|
|
115
119
|
exports.AgentJob = AgentJob = __decorate([
|
|
116
|
-
(0, typeorm_1.Entity)('ss_agent_job')
|
|
120
|
+
(0, typeorm_1.Entity)('ss_agent_job'),
|
|
121
|
+
(0, typeorm_1.Index)(['agent', 'status', 'queuedAt'])
|
|
117
122
|
], AgentJob);
|
|
118
123
|
//# sourceMappingURL=agent-job.entity.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-job.entity.js","sourceRoot":"","sources":["../../src/entities/agent-job.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,mDAA0D;AAC1D,
|
|
1
|
+
{"version":3,"file":"agent-job.entity.js","sourceRoot":"","sources":["../../src/entities/agent-job.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,mDAA0D;AAC1D,qCAAkF;AAClF,iEAAsD;AACtD,mEAAwD;AACxD,6EAAiE;AACjE,oEAA0F;AAInF,IAAM,QAAQ,GAAd,MAAM,QAAS,SAAQ,4BAAY;IAAnC;;QAUH,SAAI,GAAW,OAAO,CAAC;QASvB,WAAM,GAAW,QAAQ,CAAC;QA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,IAAI;4CAAC;AAGjB;IADC,IAAA,mBAAS,EAAC,GAAG,EAAE,CAAC,8CAAiB,EAAE,iBAAiB,CAAC,EAAE,CAAC,iBAAiB,CAAC,GAAG,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;;oDAC1D;mBAhE/B,QAAQ;IAFpB,IAAA,gBAAM,EAAC,cAAc,CAAC;IACtB,IAAA,eAAK,EAAC,CAAC,OAAO,EAAE,QAAQ,EAAE,UAAU,CAAC,CAAC;GAC1B,QAAQ,CAiEpB","sourcesContent":["import { CommonEntity } from 'src/entities/common.entity';\nimport { Entity, Index, JoinColumn, ManyToOne, Column, OneToMany } from 'typeorm';\nimport { AgentSession } from './agent-session.entity';\nimport { AgentRegistry } from './agent-registry.entity';\nimport { AgentHumanRequest } from './agent-human-request.entity';\nimport { getColumnType, getCurrentTimestampDefault } from 'src/helpers/typeorm-db-helper';\n\n@Entity('ss_agent_job')\n@Index(['agent', 'status', 'queuedAt'])\nexport class AgentJob extends CommonEntity {\n @ManyToOne(() => AgentSession, { onDelete: \"SET NULL\", nullable: true })\n @JoinColumn()\n session: AgentSession;\n\n @ManyToOne(() => AgentRegistry, { onDelete: \"SET NULL\", nullable: true })\n @JoinColumn()\n agent: AgentRegistry;\n\n @Column({ type: \"varchar\", default: \"start\" })\n kind: string = \"start\";\n\n @Column({ type: \"text\", nullable: true })\n input: string;\n\n @Column({ type: \"text\" })\n callerSnapshot: string;\n\n @Column({ type: \"varchar\", default: \"queued\" })\n status: string = \"queued\";\n\n @Column({ type: \"varchar\", nullable: true })\n leaseToken: string;\n\n @Column({ ...getColumnType('datetimeWithTimezone'), nullable: true })\n leaseExpiresAt: Date;\n\n @Column({ type: \"integer\", default: 0 })\n attempts: number = 0;\n\n @Column({ type: \"text\", nullable: true })\n idempotencyKey: string;\n\n @Column({ type: \"text\", nullable: true })\n webhookUrl: string;\n\n @Column({ type: \"text\", nullable: true })\n webhookSecret: string;\n\n @Column({ type: \"integer\", nullable: true })\n timeoutSeconds: number;\n\n @Column({ type: \"integer\", nullable: true })\n maxSteps: number;\n\n @Column({ type: \"text\", nullable: true })\n result: string;\n\n @Column({ type: \"text\", nullable: true })\n error: string;\n\n @Column({ ...getColumnType('datetimeWithTimezone'), default: () => getCurrentTimestampDefault() })\n queuedAt: Date = new Date();\n\n @Column({ ...getColumnType('datetimeWithTimezone'), nullable: true })\n dispatchedAt: Date | null;\n\n @Column({ ...getColumnType('datetimeWithTimezone'), nullable: true })\n startedAt: Date;\n\n @Column({ ...getColumnType('datetimeWithTimezone'), nullable: true })\n finishedAt: Date;\n\n @OneToMany(() => AgentHumanRequest, agentHumanRequest => agentHumanRequest.job, { cascade: true })\n agentHumanRequests: AgentHumanRequest[];\n}\n"]}
|
|
@@ -6,6 +6,14 @@ export declare class AgentProcess extends CommonEntity {
|
|
|
6
6
|
host: string;
|
|
7
7
|
port: number;
|
|
8
8
|
pid: number;
|
|
9
|
+
runner: string | null;
|
|
10
|
+
runnerRef: string | null;
|
|
11
|
+
internalUrl: string;
|
|
12
|
+
bootstrapTokenHash: string | null;
|
|
13
|
+
bootstrapExpiresAt: Date | null;
|
|
14
|
+
runtimeVersion: string | null;
|
|
15
|
+
cpu: number | null;
|
|
16
|
+
memory: number | null;
|
|
9
17
|
wsUrl: string;
|
|
10
18
|
status: string;
|
|
11
19
|
configVersion: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-process.entity.d.ts","sourceRoot":"","sources":["../../src/entities/agent-process.entity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"agent-process.entity.d.ts","sourceRoot":"","sources":["../../src/entities/agent-process.entity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAG1D,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAA;AAGrD,qBACa,YAAa,SAAQ,YAAY;IAG1C,KAAK,EAAE,aAAa,CAAC;IAGrB,IAAI,EAAE,MAAM,CAAC;IAGb,IAAI,EAAE,MAAM,CAAC;IAGb,GAAG,EAAE,MAAM,CAAC;IAGZ,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAGtB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IAIzB,WAAW,EAAE,MAAM,CAAM;IAIzB,kBAAkB,EAAE,MAAM,GAAG,IAAI,CAAC;IAIlC,kBAAkB,EAAE,IAAI,GAAG,IAAI,CAAC;IAGhC,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAG9B,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IAGnB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAGtB,KAAK,EAAE,MAAM,CAAM;IAGnB,MAAM,EAAE,MAAM,CAAc;IAG5B,aAAa,EAAE,MAAM,CAAK;IAG1B,YAAY,EAAE,MAAM,CAAK;IAGzB,YAAY,EAAE,MAAM,CAAK;IAGzB,WAAW,EAAE,MAAM,CAAM;IAGzB,eAAe,EAAE,MAAM,CAAK;IAG5B,UAAU,EAAE,MAAM,CAAQ;IAG1B,SAAS,EAAE,IAAI,CAAc;IAG7B,WAAW,EAAE,IAAI,CAAC;IAGlB,SAAS,EAAE,IAAI,CAAC;IAIhB,SAAS,EAAE,MAAM,CAAC;IAGlB,aAAa,EAAE,YAAY,EAAE,CAAC;CACjC"}
|
|
@@ -12,6 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.AgentProcess = void 0;
|
|
13
13
|
const openapi = require("@nestjs/swagger");
|
|
14
14
|
const common_entity_1 = require("./common.entity");
|
|
15
|
+
const class_transformer_1 = require("class-transformer");
|
|
15
16
|
const typeorm_1 = require("typeorm");
|
|
16
17
|
const agent_registry_entity_1 = require("./agent-registry.entity");
|
|
17
18
|
const agent_session_entity_1 = require("./agent-session.entity");
|
|
@@ -19,6 +20,7 @@ const typeorm_db_helper_1 = require("../helpers/typeorm-db-helper");
|
|
|
19
20
|
let AgentProcess = class AgentProcess extends common_entity_1.CommonEntity {
|
|
20
21
|
constructor() {
|
|
21
22
|
super(...arguments);
|
|
23
|
+
this.internalUrl = "";
|
|
22
24
|
this.wsUrl = "";
|
|
23
25
|
this.status = "starting";
|
|
24
26
|
this.configVersion = 0;
|
|
@@ -30,7 +32,7 @@ let AgentProcess = class AgentProcess extends common_entity_1.CommonEntity {
|
|
|
30
32
|
this.startedAt = new Date();
|
|
31
33
|
}
|
|
32
34
|
static _OPENAPI_METADATA_FACTORY() {
|
|
33
|
-
return { agent: { required: true, type: () => require("./agent-registry.entity").AgentRegistry }, host: { required: true, type: () => String }, port: { required: true, type: () => Number }, pid: { required: true, type: () => Number }, wsUrl: { required: true, type: () => String, default: "" }, status: { required: true, type: () => String, default: "starting" }, configVersion: { required: true, type: () => Number, default: 0 }, openSessions: { required: true, type: () => Number, default: 0 }, runningTurns: { required: true, type: () => Number, default: 0 }, maxSessions: { required: true, type: () => Number, default: 50 }, maxRunningTurns: { required: true, type: () => Number, default: 8 }, loadReport: { required: true, type: () => String, default: "{}" }, startedAt: { required: true, type: () => Date, default: new Date() }, heartbeatAt: { required: true, type: () => Date }, stoppedAt: { required: true, type: () => Date }, processId: { required: true, type: () => String }, agentSessions: { required: true, type: () => [require("./agent-session.entity").AgentSession] } };
|
|
35
|
+
return { agent: { required: true, type: () => require("./agent-registry.entity").AgentRegistry }, host: { required: true, type: () => String }, port: { required: true, type: () => Number }, pid: { required: true, type: () => Number }, runner: { required: true, type: () => String, nullable: true }, runnerRef: { required: true, type: () => String, nullable: true }, internalUrl: { required: true, type: () => String, default: "" }, bootstrapTokenHash: { required: true, type: () => String, nullable: true }, bootstrapExpiresAt: { required: true, type: () => Date, nullable: true }, runtimeVersion: { required: true, type: () => String, nullable: true }, cpu: { required: true, type: () => Number, nullable: true }, memory: { required: true, type: () => Number, nullable: true }, wsUrl: { required: true, type: () => String, default: "" }, status: { required: true, type: () => String, default: "starting" }, configVersion: { required: true, type: () => Number, default: 0 }, openSessions: { required: true, type: () => Number, default: 0 }, runningTurns: { required: true, type: () => Number, default: 0 }, maxSessions: { required: true, type: () => Number, default: 50 }, maxRunningTurns: { required: true, type: () => Number, default: 8 }, loadReport: { required: true, type: () => String, default: "{}" }, startedAt: { required: true, type: () => Date, default: new Date() }, heartbeatAt: { required: true, type: () => Date }, stoppedAt: { required: true, type: () => Date }, processId: { required: true, type: () => String }, agentSessions: { required: true, type: () => [require("./agent-session.entity").AgentSession] } };
|
|
34
36
|
}
|
|
35
37
|
};
|
|
36
38
|
exports.AgentProcess = AgentProcess;
|
|
@@ -51,6 +53,41 @@ __decorate([
|
|
|
51
53
|
(0, typeorm_1.Column)({ type: "integer", nullable: true }),
|
|
52
54
|
__metadata("design:type", Number)
|
|
53
55
|
], AgentProcess.prototype, "pid", void 0);
|
|
56
|
+
__decorate([
|
|
57
|
+
(0, typeorm_1.Column)({ type: "varchar", nullable: true }),
|
|
58
|
+
__metadata("design:type", String)
|
|
59
|
+
], AgentProcess.prototype, "runner", void 0);
|
|
60
|
+
__decorate([
|
|
61
|
+
(0, typeorm_1.Column)({ type: "varchar", length: 512, nullable: true }),
|
|
62
|
+
__metadata("design:type", String)
|
|
63
|
+
], AgentProcess.prototype, "runnerRef", void 0);
|
|
64
|
+
__decorate([
|
|
65
|
+
(0, class_transformer_1.Exclude)({ toPlainOnly: true }),
|
|
66
|
+
(0, typeorm_1.Column)({ type: "varchar", default: "", select: false, insert: false, update: false }),
|
|
67
|
+
__metadata("design:type", String)
|
|
68
|
+
], AgentProcess.prototype, "internalUrl", void 0);
|
|
69
|
+
__decorate([
|
|
70
|
+
(0, class_transformer_1.Exclude)({ toPlainOnly: true }),
|
|
71
|
+
(0, typeorm_1.Column)({ type: "varchar", length: 64, nullable: true, select: false, insert: false, update: false }),
|
|
72
|
+
__metadata("design:type", String)
|
|
73
|
+
], AgentProcess.prototype, "bootstrapTokenHash", void 0);
|
|
74
|
+
__decorate([
|
|
75
|
+
(0, class_transformer_1.Exclude)({ toPlainOnly: true }),
|
|
76
|
+
(0, typeorm_1.Column)({ ...(0, typeorm_db_helper_1.getColumnType)('datetimeWithTimezone'), nullable: true, select: false, insert: false, update: false }),
|
|
77
|
+
__metadata("design:type", Date)
|
|
78
|
+
], AgentProcess.prototype, "bootstrapExpiresAt", void 0);
|
|
79
|
+
__decorate([
|
|
80
|
+
(0, typeorm_1.Column)({ type: "varchar", nullable: true }),
|
|
81
|
+
__metadata("design:type", String)
|
|
82
|
+
], AgentProcess.prototype, "runtimeVersion", void 0);
|
|
83
|
+
__decorate([
|
|
84
|
+
(0, typeorm_1.Column)({ type: "integer", nullable: true }),
|
|
85
|
+
__metadata("design:type", Number)
|
|
86
|
+
], AgentProcess.prototype, "cpu", void 0);
|
|
87
|
+
__decorate([
|
|
88
|
+
(0, typeorm_1.Column)({ type: "integer", nullable: true }),
|
|
89
|
+
__metadata("design:type", Number)
|
|
90
|
+
], AgentProcess.prototype, "memory", void 0);
|
|
54
91
|
__decorate([
|
|
55
92
|
(0, typeorm_1.Column)({ type: "varchar" }),
|
|
56
93
|
__metadata("design:type", String)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-process.entity.js","sourceRoot":"","sources":["../../src/entities/agent-process.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,mDAA0D;AAC1D,qCAAkF;AAClF,mEAAwD;AACxD,iEAAqD;AACrD,oEAA0F;AAGnF,IAAM,YAAY,GAAlB,MAAM,YAAa,SAAQ,4BAAY;IAAvC;;
|
|
1
|
+
{"version":3,"file":"agent-process.entity.js","sourceRoot":"","sources":["../../src/entities/agent-process.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,mDAA0D;AAC1D,yDAA4C;AAC5C,qCAAkF;AAClF,mEAAwD;AACxD,iEAAqD;AACrD,oEAA0F;AAGnF,IAAM,YAAY,GAA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entity, JoinColumn, ManyToOne, Column, Index, OneToMany } from 'typeorm';\nimport { AgentRegistry } from './agent-registry.entity';\nimport { AgentSession } from './agent-session.entity'\nimport { getColumnType, getCurrentTimestampDefault } from 'src/helpers/typeorm-db-helper';\n\n@Entity('ss_agent_process')\nexport class AgentProcess extends CommonEntity {\n @ManyToOne(() => AgentRegistry, { onDelete: \"SET NULL\", nullable: true })\n @JoinColumn()\n agent: AgentRegistry;\n\n @Column({ type: \"varchar\" })\n host: string;\n\n @Column({ type: \"integer\" })\n port: number;\n\n @Column({ type: \"integer\", nullable: true })\n pid: number;\n\n @Column({ type: \"varchar\", nullable: true })\n runner: string | null;\n\n @Column({ type: \"varchar\", length: 512, nullable: true })\n runnerRef: string | null;\n\n @Exclude({ toPlainOnly: true })\n @Column({ type: \"varchar\", default: \"\", select: false, insert: false, update: false })\n internalUrl: string = \"\";\n\n @Exclude({ toPlainOnly: true })\n @Column({ type: \"varchar\", length: 64, nullable: true, select: false, insert: false, update: false })\n bootstrapTokenHash: string | null;\n\n @Exclude({ toPlainOnly: true })\n @Column({ ...getColumnType('datetimeWithTimezone'), nullable: true, select: false, insert: false, update: false })\n bootstrapExpiresAt: Date | null;\n\n @Column({ type: \"varchar\", nullable: true })\n runtimeVersion: string | null;\n\n @Column({ type: \"integer\", nullable: true })\n cpu: number | null;\n\n @Column({ type: \"integer\", nullable: true })\n memory: number | null;\n\n @Column({ type: \"varchar\" })\n wsUrl: string = \"\";\n\n @Column({ type: \"varchar\", default: \"starting\" })\n status: string = \"starting\";\n\n @Column({ type: \"integer\" })\n configVersion: number = 0;\n\n @Column({ type: \"integer\" })\n openSessions: number = 0;\n\n @Column({ type: \"integer\" })\n runningTurns: number = 0;\n\n @Column({ type: \"integer\" })\n maxSessions: number = 50;\n\n @Column({ type: \"integer\" })\n maxRunningTurns: number = 8;\n\n @Column({ type: \"text\", default: \"{}\" })\n loadReport: string = \"{}\";\n\n @Column({ ...getColumnType('datetimeWithTimezone'), default: () => getCurrentTimestampDefault() })\n startedAt: Date = new Date();\n\n @Column({ ...getColumnType('datetimeWithTimezone'), nullable: true })\n heartbeatAt: Date;\n\n @Column({ ...getColumnType('datetimeWithTimezone'), nullable: true })\n stoppedAt: Date;\n\n @Index({ unique: true })\n @Column({ type: \"varchar\", nullable: true })\n processId: string;\n\n @OneToMany(() => AgentSession, agentSession => agentSession.process, { cascade: true })\n agentSessions: AgentSession[];\n}\n"]}
|
|
@@ -23,6 +23,11 @@ export declare class AgentRegistry extends CommonEntity {
|
|
|
23
23
|
turnStepLimit: number;
|
|
24
24
|
costLimit: number;
|
|
25
25
|
configVersion?: number;
|
|
26
|
+
runner: string | null;
|
|
27
|
+
minProcesses: number;
|
|
28
|
+
maxProcesses: number | null;
|
|
29
|
+
processCpu: number | null;
|
|
30
|
+
processMemory: number | null;
|
|
26
31
|
module: ModuleMetadata;
|
|
27
32
|
tags: AgentHubTag[];
|
|
28
33
|
agentTools: AgentTool[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-registry.entity.d.ts","sourceRoot":"","sources":["../../src/entities/agent-registry.entity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE1D,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AACrE,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAA;AAC7C,OAAO,EAAE,k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IAGd,WAAW,EAAE,MAAM,CAAC;IAGpB,QAAQ,EAAE,MAAM,CAAC;IAGjB,YAAY,EAAE,MAAM,CAAC;IAIrB,cAAc,EAAE,MAAM,CAAQ;IAG9B,iBAAiB,EAAE,MAAM,CAAC;IAG1B,YAAY,EAAE,MAAM,CAAC;IAGrB,MAAM,EAAE,MAAM,CAAW;IAGzB,SAAS,EAAE,MAAM,CAAO;IAGxB,aAAa,EAAE,MAAM,CAAM;IAG3B,SAAS,EAAE,MAAM,CAAK;IAGtB,aAAa,CAAC,EAAE,MAAM,CAAK;IAG3B,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAGtB,YAAY,EAAE,MAAM,CAAK;IAGzB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAG5B,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAG1B,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAK7B,MAAM,EAAE,cAAc,CAAC;IAIvB,IAAI,EAAE,WAAW,EAAE,CAAC;IAGpB,UAAU,EAAE,SAAS,EAAE,CAAC;IAGxB,WAAW,EAAE,UAAU,EAAE,CAAC;IAG1B,UAAU,EAAE,SAAS,EAAE,CAAC;IAGxB,YAAY,EAAE,WAAW,EAAE,CAAC;IAG5B,cAAc,EAAE,YAAY,EAAE,CAAC;IAG/B,aAAa,EAAE,YAAY,EAAE,CAAC;IAG9B,SAAS,EAAE,QAAQ,EAAE,CAAC;IAGtB,cAAc,EAAE,kBAAkB,EAAE,CAAC;CACxC"}
|
|
@@ -32,9 +32,10 @@ let AgentRegistry = class AgentRegistry extends common_entity_1.CommonEntity {
|
|
|
32
32
|
this.turnStepLimit = 20;
|
|
33
33
|
this.costLimit = 3;
|
|
34
34
|
this.configVersion = 1;
|
|
35
|
+
this.minProcesses = 0;
|
|
35
36
|
}
|
|
36
37
|
static _OPENAPI_METADATA_FACTORY() {
|
|
37
|
-
return { name: { required: true, type: () => String }, title: { required: true, type: () => String }, description: { required: true, type: () => String }, iconName: { required: true, type: () => String }, systemPrompt: { required: true, type: () => String }, requiredInputs: { required: true, type: () => String, default: "[]" }, reasoningModelKey: { required: true, type: () => String }, fastModelKey: { required: true, type: () => String }, status: { required: true, type: () => String, default: "draft" }, stepLimit: { required: true, type: () => Number, default: 100 }, turnStepLimit: { required: true, type: () => Number, default: 20 }, costLimit: { required: true, type: () => Number, default: 3 }, configVersion: { required: false, type: () => Number, default: 1 }, module: { required: true, type: () => require("./module-metadata.entity").ModuleMetadata }, tags: { required: true, type: () => [require("./agent-hub-tag.entity").AgentHubTag] }, agentTools: { required: true, type: () => [require("./agent-tool.entity").AgentTool] }, agentSkills: { required: true, type: () => [require("./agent-skill.entity").AgentSkill] }, agentRoles: { required: true, type: () => [require("./agent-role.entity").AgentRole] }, agentSecrets: { required: true, type: () => [require("./agent-secret.entity").AgentSecret] }, agentProcesses: { required: true, type: () => [require("./agent-process.entity").AgentProcess] }, agentSessions: { required: true, type: () => [require("./agent-session.entity").AgentSession] }, agentJobs: { required: true, type: () => [require("./agent-job.entity").AgentJob] }, configVersions: { required: true, type: () => [require("./agent-config-version.entity").AgentConfigVersion] } };
|
|
38
|
+
return { name: { required: true, type: () => String }, title: { required: true, type: () => String }, description: { required: true, type: () => String }, iconName: { required: true, type: () => String }, systemPrompt: { required: true, type: () => String }, requiredInputs: { required: true, type: () => String, default: "[]" }, reasoningModelKey: { required: true, type: () => String }, fastModelKey: { required: true, type: () => String }, status: { required: true, type: () => String, default: "draft" }, stepLimit: { required: true, type: () => Number, default: 100 }, turnStepLimit: { required: true, type: () => Number, default: 20 }, costLimit: { required: true, type: () => Number, default: 3 }, configVersion: { required: false, type: () => Number, default: 1 }, runner: { required: true, type: () => String, nullable: true }, minProcesses: { required: true, type: () => Number, default: 0 }, maxProcesses: { required: true, type: () => Number, nullable: true }, processCpu: { required: true, type: () => Number, nullable: true }, processMemory: { required: true, type: () => Number, nullable: true }, module: { required: true, type: () => require("./module-metadata.entity").ModuleMetadata }, tags: { required: true, type: () => [require("./agent-hub-tag.entity").AgentHubTag] }, agentTools: { required: true, type: () => [require("./agent-tool.entity").AgentTool] }, agentSkills: { required: true, type: () => [require("./agent-skill.entity").AgentSkill] }, agentRoles: { required: true, type: () => [require("./agent-role.entity").AgentRole] }, agentSecrets: { required: true, type: () => [require("./agent-secret.entity").AgentSecret] }, agentProcesses: { required: true, type: () => [require("./agent-process.entity").AgentProcess] }, agentSessions: { required: true, type: () => [require("./agent-session.entity").AgentSession] }, agentJobs: { required: true, type: () => [require("./agent-job.entity").AgentJob] }, configVersions: { required: true, type: () => [require("./agent-config-version.entity").AgentConfigVersion] } };
|
|
38
39
|
}
|
|
39
40
|
};
|
|
40
41
|
exports.AgentRegistry = AgentRegistry;
|
|
@@ -91,6 +92,26 @@ __decorate([
|
|
|
91
92
|
(0, typeorm_1.Column)({ type: "integer", nullable: true, default: 1 }),
|
|
92
93
|
__metadata("design:type", Number)
|
|
93
94
|
], AgentRegistry.prototype, "configVersion", void 0);
|
|
95
|
+
__decorate([
|
|
96
|
+
(0, typeorm_1.Column)({ type: "varchar", nullable: true }),
|
|
97
|
+
__metadata("design:type", String)
|
|
98
|
+
], AgentRegistry.prototype, "runner", void 0);
|
|
99
|
+
__decorate([
|
|
100
|
+
(0, typeorm_1.Column)({ type: "integer", default: 0 }),
|
|
101
|
+
__metadata("design:type", Number)
|
|
102
|
+
], AgentRegistry.prototype, "minProcesses", void 0);
|
|
103
|
+
__decorate([
|
|
104
|
+
(0, typeorm_1.Column)({ type: "integer", nullable: true }),
|
|
105
|
+
__metadata("design:type", Number)
|
|
106
|
+
], AgentRegistry.prototype, "maxProcesses", void 0);
|
|
107
|
+
__decorate([
|
|
108
|
+
(0, typeorm_1.Column)({ type: "integer", nullable: true }),
|
|
109
|
+
__metadata("design:type", Number)
|
|
110
|
+
], AgentRegistry.prototype, "processCpu", void 0);
|
|
111
|
+
__decorate([
|
|
112
|
+
(0, typeorm_1.Column)({ type: "integer", nullable: true }),
|
|
113
|
+
__metadata("design:type", Number)
|
|
114
|
+
], AgentRegistry.prototype, "processMemory", void 0);
|
|
94
115
|
__decorate([
|
|
95
116
|
(0, typeorm_1.Index)(),
|
|
96
117
|
(0, typeorm_1.ManyToOne)(() => module_metadata_entity_1.ModuleMetadata, { onDelete: "RESTRICT", nullable: false }),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-registry.entity.js","sourceRoot":"","sources":["../../src/entities/agent-registry.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,mDAA0D;AAC1D,qCAAyG;AACzG,qEAAqE;AACrE,iEAAqD;AACrD,2DAAgD;AAChD,6DAAkD;AAClD,2DAAgD;AAChD,+DAAoD;AACpD,iEAAsD;AACtD,iEAAsD;AACtD,yDAA6C;AAC7C,+EAAmE;AAG5D,IAAM,aAAa,GAAnB,MAAM,aAAc,SAAQ,4BAAY;IAAxC;;QAmBH,mBAAc,GAAW,IAAI,CAAC;QAS9B,WAAM,GAAW,OAAO,CAAC;QAGzB,cAAS,GAAW,GAAG,CAAC;QAGxB,kBAAa,GAAW,EAAE,CAAC;QAG3B,cAAS,GAAW,CAAC,CAAC;QAGtB,kBAAa,GAAY,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"agent-registry.entity.js","sourceRoot":"","sources":["../../src/entities/agent-registry.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,mDAA0D;AAC1D,qCAAyG;AACzG,qEAAqE;AACrE,iEAAqD;AACrD,2DAAgD;AAChD,6DAAkD;AAClD,2DAAgD;AAChD,+DAAoD;AACpD,iEAAsD;AACtD,iEAAsD;AACtD,yDAA6C;AAC7C,+EAAmE;AAG5D,IAAM,aAAa,GAAnB,MAAM,aAAc,SAAQ,4BAAY;IAAxC;;QAmBH,mBAAc,GAAW,IAAI,CAAC;QAS9B,WAAM,GAAW,OAAO,CAAC;QAGzB,cAAS,GAAW,GAAG,CAAC;QAGxB,kBAAa,GAAW,EAAE,CAAC;QAG3B,cAAS,GAAW,CA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AAA,mBAAS,EAAC,GAAG,EAAE,CAAC,+BAAU,EAAE,UAAU,CAAC,EAAE,CAAC,UAAU,CAAC,aAAa,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;;kDAC7D;AAG1B;IADC,IAAA,mBAAS,EAAC,GAAG,EAAE,CAAC,6BAAS,EAAE,SAAS,CAAC,EAAE,CAAC,SAAS,CAAC,aAAa,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;;iDAC5D;AAGxB;IADC,IAAA,mBAAS,EAAC,GAAG,EAAE,CAAC,iCAAW,EAAE,WAAW,CAAC,EAAE,CAAC,WAAW,CAAC,aAAa,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;;mDAC9D;AAG5B;IADC,IAAA,mBAAS,EAAC,GAAG,EAAE,CAAC,mCAAY,EAAE,YAAY,CAAC,EAAE,CAAC,YAAY,CAAC,KAAK,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;;qDACtD;AAG/B;IADC,IAAA,mBAAS,EAAC,GAAG,EAAE,CAAC,mCAAY,EAAE,YAAY,CAAC,EAAE,CAAC,YAAY,CAAC,KAAK,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;;oDACvD;AAG9B;IADC,IAAA,mBAAS,EAAC,GAAG,EAAE,CAAC,2BAAQ,EAAE,QAAQ,CAAC,EAAE,CAAC,QAAQ,CAAC,KAAK,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;;gDACnD;AAGtB;IADC,IAAA,mBAAS,EAAC,GAAG,EAAE,CAAC,gDAAkB,EAAE,aAAa,CAAC,EAAE,CAAC,aAAa,CAAC,aAAa,CAAC;;qDAC7C;wBAxF5B,aAAa;IADzB,IAAA,gBAAM,EAAC,mBAAmB,CAAC;GACf,aAAa,CAyFzB","sourcesContent":["import { CommonEntity } from 'src/entities/common.entity';\nimport { Entity, Column, Index, JoinColumn, JoinTable, ManyToMany, ManyToOne, OneToMany } from 'typeorm';\nimport { ModuleMetadata } from 'src/entities/module-metadata.entity';\nimport { AgentHubTag } from './agent-hub-tag.entity';\nimport { AgentTool } from './agent-tool.entity';\nimport { AgentSkill } from './agent-skill.entity';\nimport { AgentRole } from './agent-role.entity';\nimport { AgentSecret } from './agent-secret.entity';\nimport { AgentProcess } from './agent-process.entity';\nimport { AgentSession } from './agent-session.entity';\nimport { AgentJob } from './agent-job.entity'\nimport { AgentConfigVersion } from './agent-config-version.entity';\n\n@Entity('ss_agent_registry')\nexport class AgentRegistry extends CommonEntity {\n @Index({ unique: true })\n @Column({ type: \"varchar\" })\n name: string;\n\n @Column({ type: \"varchar\" })\n title: string;\n\n @Column({ type: \"text\", nullable: true })\n description: string;\n\n @Column({ type: \"varchar\", nullable: true })\n iconName: string;\n\n @Column({ type: \"text\" })\n systemPrompt: string;\n\n /** JSON array of { name, description, dataType, defaultValue, optional } consumed by AgentHub. */\n @Column({ type: \"text\", default: \"[]\" })\n requiredInputs: string = \"[]\";\n\n @Column({ type: \"varchar\" })\n reasoningModelKey: string;\n\n @Column({ type: \"varchar\" })\n fastModelKey: string;\n\n @Column({ type: \"varchar\", default: \"draft\" })\n status: string = \"draft\";\n\n @Column({ type: \"integer\" })\n stepLimit: number = 100;\n\n @Column({ type: \"integer\" })\n turnStepLimit: number = 20;\n\n @Column({ type: \"decimal\", default: 3 })\n costLimit: number = 3;\n\n @Column({ type: \"integer\", nullable: true, default: 1 })\n configVersion?: number = 1;\n\n @Column({ type: \"varchar\", nullable: true })\n runner: string | null;\n\n @Column({ type: \"integer\", default: 0 })\n minProcesses: number = 0;\n\n @Column({ type: \"integer\", nullable: true })\n maxProcesses: number | null;\n\n @Column({ type: \"integer\", nullable: true })\n processCpu: number | null;\n\n @Column({ type: \"integer\", nullable: true })\n processMemory: number | null;\n\n @Index()\n @ManyToOne(() => ModuleMetadata, { onDelete: \"RESTRICT\", nullable: false })\n @JoinColumn({ name: 'module_id', referencedColumnName: 'id' })\n module: ModuleMetadata;\n\n @ManyToMany(() => AgentHubTag, tag => tag.agents, { cascade: ['insert', 'update'] })\n @JoinTable()\n tags: AgentHubTag[];\n\n @OneToMany(() => AgentTool, agentTool => agentTool.agentRegistry, { cascade: true })\n agentTools: AgentTool[];\n\n @OneToMany(() => AgentSkill, agentSkill => agentSkill.agentRegistry, { cascade: true })\n agentSkills: AgentSkill[];\n\n @OneToMany(() => AgentRole, agentRole => agentRole.agentRegistry, { cascade: true })\n agentRoles: AgentRole[];\n\n @OneToMany(() => AgentSecret, agentSecret => agentSecret.agentRegistry, { cascade: true })\n agentSecrets: AgentSecret[];\n\n @OneToMany(() => AgentProcess, agentProcess => agentProcess.agent, { cascade: true })\n agentProcesses: AgentProcess[];\n\n @OneToMany(() => AgentSession, agentSession => agentSession.agent, { cascade: true })\n agentSessions: AgentSession[];\n\n @OneToMany(() => AgentJob, agentJob => agentJob.agent, { cascade: true })\n agentJobs: AgentJob[];\n\n @OneToMany(() => AgentConfigVersion, configVersion => configVersion.agentRegistry)\n configVersions: AgentConfigVersion[];\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-session.entity.d.ts","sourceRoot":"","sources":["../../src/entities/agent-session.entity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AAEhD,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAC3E,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAGjE,
|
|
1
|
+
{"version":3,"file":"agent-session.entity.d.ts","sourceRoot":"","sources":["../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E,sBAAsB,EAAE,CAAC;IAGlD,kBAAkB,EAAE,iBAAiB,EAAE,CAAC;CAE3C"}
|
|
@@ -50,6 +50,7 @@ __decorate([
|
|
|
50
50
|
__metadata("design:type", agent_registry_entity_1.AgentRegistry)
|
|
51
51
|
], AgentSession.prototype, "agent", void 0);
|
|
52
52
|
__decorate([
|
|
53
|
+
(0, typeorm_1.Index)(),
|
|
53
54
|
(0, typeorm_1.ManyToOne)(() => agent_process_entity_1.AgentProcess, { onDelete: "SET NULL", nullable: true }),
|
|
54
55
|
(0, typeorm_1.JoinColumn)(),
|
|
55
56
|
__metadata("design:type", agent_process_entity_1.AgentProcess)
|
|
@@ -140,6 +141,7 @@ __decorate([
|
|
|
140
141
|
__metadata("design:type", Array)
|
|
141
142
|
], AgentSession.prototype, "agentHumanRequests", void 0);
|
|
142
143
|
exports.AgentSession = AgentSession = __decorate([
|
|
143
|
-
(0, typeorm_1.Entity)('ss_agent_session')
|
|
144
|
+
(0, typeorm_1.Entity)('ss_agent_session'),
|
|
145
|
+
(0, typeorm_1.Index)(['user', 'trigger', 'lastActiveAt'])
|
|
144
146
|
], AgentSession);
|
|
145
147
|
//# sourceMappingURL=agent-session.entity.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-session.entity.js","sourceRoot":"","sources":["../../src/entities/agent-session.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,mDAA0D;AAC1D,+CAAgD;AAChD,qCAAkF;AAClF,mEAAwD;AACxD,iEAAsD;AACtD,yDAA8C;AAC9C,6DAAkD;AAClD,uFAA2E;AAC3E,6EAAiE;AACjE,oEAA0F;
|
|
1
|
+
{"version":3,"file":"agent-session.entity.js","sourceRoot":"","sources":["../../src/entities/agent-session.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,mDAA0D;AAC1D,+CAAgD;AAChD,qCAAkF;AAClF,mEAAwD;AACxD,iEAAsD;AACtD,yDAA8C;AAC9C,6DAAkD;AAClD,uF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{ CommonEntity } from 'src/entities/common.entity';\nimport { User } from 'src/entities/user.entity';\nimport { Entity, Column, Index, JoinColumn, ManyToOne, OneToMany } from 'typeorm';\nimport { AgentRegistry } from './agent-registry.entity';\nimport { AgentProcess } from './agent-process.entity';\nimport { AgentJob } from './agent-job.entity';\nimport { AgentEvent } from './agent-event.entity';\nimport { AgentSessionCheckpoint } from './agent-session-checkpoint.entity';\nimport { AgentHumanRequest } from './agent-human-request.entity';\nimport { getColumnType, getCurrentTimestampDefault } from 'src/helpers/typeorm-db-helper';\n\n@Entity('ss_agent_session')\n@Index(['user', 'trigger', 'lastActiveAt'])\nexport class AgentSession extends CommonEntity {\n @Index({ unique: true })\n @Column({ type: \"varchar\", nullable: true })\n sessionId: string;\n\n @ManyToOne(() => AgentRegistry, { onDelete: \"SET NULL\", nullable: true })\n @JoinColumn()\n agent: AgentRegistry;\n\n // The most recent process that hosted this session; it remains linked after shutdown.\n @Index()\n @ManyToOne(() => AgentProcess, { onDelete: \"SET NULL\", nullable: true })\n @JoinColumn()\n process: AgentProcess;\n\n // The entry point that created the session. A later job or review does not change it.\n @Column({ type: \"varchar\" })\n trigger: string;\n\n // Runtime that created/hosted this session; nullable for legacy rows where it is unknown.\n @Column({ type: \"varchar\", nullable: true })\n runtime: \"solidx\" | \"agentHub\" | null;\n\n @ManyToOne(() => User, { onDelete: \"RESTRICT\", nullable: false })\n @JoinColumn()\n user: User;\n\n @Column({ type: \"varchar\", default: \"queued\" })\n status: string = \"queued\";\n\n @Column({ type: \"text\", default: \"{}\" })\n inputs: string = \"{}\";\n\n @Column({ type: \"integer\" })\n configVersion: number;\n\n @Column({ type: \"integer\", default: 0 })\n turnCount: number = 0;\n\n @Column({ type: \"integer\", default: 0 })\n totalSteps: number = 0;\n\n @Column({ type: \"integer\", default: 0 })\n totalInputTokens: number = 0;\n\n @Column({ type: \"integer\", default: 0 })\n totalOutputTokens: number = 0;\n\n @Column({ type: \"decimal\" })\n totalCost: number = 0;\n\n @Column({ type: \"text\", nullable: true })\n error: string;\n\n @Column({ ...getColumnType('datetimeWithTimezone'), default: () => getCurrentTimestampDefault() })\n startedAt: Date = new Date();\n\n @Column({ ...getColumnType('datetimeWithTimezone'), default: () => getCurrentTimestampDefault() })\n lastActiveAt: Date = new Date();\n\n @Column({ ...getColumnType('datetimeWithTimezone'), nullable: true })\n endedAt: Date;\n\n @Column({ type: \"varchar\", nullable: true })\n reasoningModelKey: string;\n\n @Column({ type: \"varchar\", nullable: true })\n fastModelKey: string;\n\n @OneToMany(() => AgentJob, agentJob => agentJob.session, { cascade: true })\n agentJobs: AgentJob[];\n\n @OneToMany(() => AgentEvent, agentEvent => agentEvent.session, { cascade: true })\n agentEvents: AgentEvent[];\n\n @OneToMany(() => AgentSessionCheckpoint, agentSessionCheckpoint => agentSessionCheckpoint.session, { cascade: true })\n agentSessionCheckpoints: AgentSessionCheckpoint[];\n\n @OneToMany(() => AgentHumanRequest, agentHumanRequest => agentHumanRequest.session, { cascade: true })\n agentHumanRequests: AgentHumanRequest[];\n\n}\n"]}
|
|
@@ -5,6 +5,7 @@ import { ClsService } from 'nestjs-cls';
|
|
|
5
5
|
import { ActiveSessionStorageService } from "../services/active-session-storage.service";
|
|
6
6
|
import { AccessTokenDenylistService } from "../services/access-token-denylist.service";
|
|
7
7
|
import { SettingService } from '../services/setting.service';
|
|
8
|
+
import { ApiKeyService } from '../services/api-key.service';
|
|
8
9
|
export declare class AccessTokenGuard implements CanActivate {
|
|
9
10
|
private readonly jwtService;
|
|
10
11
|
private readonly permissionsService;
|
|
@@ -12,7 +13,8 @@ export declare class AccessTokenGuard implements CanActivate {
|
|
|
12
13
|
private readonly accessTokenDenylist;
|
|
13
14
|
private readonly settingService;
|
|
14
15
|
private readonly cls;
|
|
15
|
-
|
|
16
|
+
private readonly apiKeyService;
|
|
17
|
+
constructor(jwtService: JwtService, permissionsService: PermissionMetadataService, activeSessionStorage: ActiveSessionStorageService, accessTokenDenylist: AccessTokenDenylistService, settingService: SettingService, cls: ClsService, apiKeyService: ApiKeyService);
|
|
16
18
|
canActivate(context: ExecutionContext): Promise<boolean>;
|
|
17
19
|
private extractTokenFromHeader;
|
|
18
20
|
private resolveSessionId;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"access-token.guard.d.ts","sourceRoot":"","sources":["../../src/guards/access-token.guard.ts"],"names":[],"mappings":"AACA,OAAO,EACL,WAAW,EACX,gBAAgB,EAGjB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAKzC,OAAO,EAAE,yBAAyB,EAAE,MAAM,yCAAyC,CAAC;AACpF,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,EAAE,2BAA2B,EAAE,MAAM,4CAA4C,CAAC;AACzF,OAAO,EAAE,0BAA0B,EAAE,MAAM,2CAA2C,CAAC;AACvF,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"access-token.guard.d.ts","sourceRoot":"","sources":["../../src/guards/access-token.guard.ts"],"names":[],"mappings":"AACA,OAAO,EACL,WAAW,EACX,gBAAgB,EAGjB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAKzC,OAAO,EAAE,yBAAyB,EAAE,MAAM,yCAAyC,CAAC;AACpF,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,EAAE,2BAA2B,EAAE,MAAM,4CAA4C,CAAC;AACzF,OAAO,EAAE,0BAA0B,EAAE,MAAM,2CAA2C,CAAC;AACvF,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAE7D,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAE5D,qBACa,gBAAiB,YAAW,WAAW;IAEhD,OAAO,CAAC,QAAQ,CAAC,UAAU;IAC3B,OAAO,CAAC,QAAQ,CAAC,kBAAkB;IACnC,OAAO,CAAC,QAAQ,CAAC,oBAAoB;IACrC,OAAO,CAAC,QAAQ,CAAC,mBAAmB;IACpC,OAAO,CAAC,QAAQ,CAAC,cAAc;IAC/B,OAAO,CAAC,QAAQ,CAAC,GAAG;IACpB,OAAO,CAAC,QAAQ,CAAC,aAAa;gBANb,UAAU,EAAE,UAAU,EACtB,kBAAkB,EAAE,yBAAyB,EAC7C,oBAAoB,EAAE,2BAA2B,EACjD,mBAAmB,EAAE,0BAA0B,EAC/C,cAAc,EAAE,cAAc,EAC9B,GAAG,EAAE,UAAU,EACf,aAAa,EAAE,aAAa;IAGzC,WAAW,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,OAAO,CAAC;IAuD9D,OAAO,CAAC,sBAAsB;IAO9B,OAAO,CAAC,gBAAgB;IAsBxB,OAAO,CAAC,oBAAoB;YAQd,kBAAkB;YAmBlB,8BAA8B;CAqB7C"}
|
|
@@ -20,14 +20,16 @@ const active_session_storage_service_1 = require("../services/active-session-sto
|
|
|
20
20
|
const access_token_denylist_service_1 = require("../services/access-token-denylist.service");
|
|
21
21
|
const setting_service_1 = require("../services/setting.service");
|
|
22
22
|
const crypto_1 = require("crypto");
|
|
23
|
+
const api_key_service_1 = require("../services/api-key.service");
|
|
23
24
|
let AccessTokenGuard = class AccessTokenGuard {
|
|
24
|
-
constructor(jwtService, permissionsService, activeSessionStorage, accessTokenDenylist, settingService, cls) {
|
|
25
|
+
constructor(jwtService, permissionsService, activeSessionStorage, accessTokenDenylist, settingService, cls, apiKeyService) {
|
|
25
26
|
this.jwtService = jwtService;
|
|
26
27
|
this.permissionsService = permissionsService;
|
|
27
28
|
this.activeSessionStorage = activeSessionStorage;
|
|
28
29
|
this.accessTokenDenylist = accessTokenDenylist;
|
|
29
30
|
this.settingService = settingService;
|
|
30
31
|
this.cls = cls;
|
|
32
|
+
this.apiKeyService = apiKeyService;
|
|
31
33
|
}
|
|
32
34
|
async canActivate(context) {
|
|
33
35
|
const request = context.switchToHttp().getRequest();
|
|
@@ -44,6 +46,12 @@ let AccessTokenGuard = class AccessTokenGuard {
|
|
|
44
46
|
refreshTokenTtl: this.settingService.getConfigValue("refreshTokenTtl")
|
|
45
47
|
};
|
|
46
48
|
const payload = await this.jwtService.verifyAsync(token, jwtConfiguration);
|
|
49
|
+
if (payload.portalApiKeyId !== undefined) {
|
|
50
|
+
const user = await this.apiKeyService.validatePortalSession(payload.portalApiKeyId, payload.sub);
|
|
51
|
+
request[constants_1.REQUEST_USER_KEY] = user;
|
|
52
|
+
this.cls.set(constants_1.REQUEST_USER_KEY, user);
|
|
53
|
+
return true;
|
|
54
|
+
}
|
|
47
55
|
await this.validateNotRevoked(payload, token);
|
|
48
56
|
await this.validateConcurrentLoginSession(payload, token);
|
|
49
57
|
const permissions = await this.permissionsService.findAllUsingRoles(payload.roles);
|
|
@@ -106,6 +114,7 @@ exports.AccessTokenGuard = AccessTokenGuard = __decorate([
|
|
|
106
114
|
active_session_storage_service_1.ActiveSessionStorageService,
|
|
107
115
|
access_token_denylist_service_1.AccessTokenDenylistService,
|
|
108
116
|
setting_service_1.SettingService,
|
|
109
|
-
nestjs_cls_1.ClsService
|
|
117
|
+
nestjs_cls_1.ClsService,
|
|
118
|
+
api_key_service_1.ApiKeyService])
|
|
110
119
|
], AccessTokenGuard);
|
|
111
120
|
//# sourceMappingURL=access-token.guard.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"access-token.guard.js","sourceRoot":"","sources":["../../src/guards/access-token.guard.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,2CAKwB;AACxB,qCAAyC;AAEzC,gEAA8D;AAE9D,4CAAgD;AAChD,yFAAoF;AACpF,2CAAwC;AACxC,+FAAyF;AACzF,6FAAuF;AACvF,iEAA6D;AAC7D,mCAAoC;AAG7B,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;IAC3B,YACmB,UAAsB,EACtB,kBAA6C,EAC7C,oBAAiD,EACjD,mBAA+C,EAC/C,cAA8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;YAC1C,OAAO;QACT,CAAC;QAED,MAAM,aAAa,GAAG,IAAI,CAAC,oBAAoB,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;QAChE,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,mBAAmB,CAAC,SAAS,CACtD,OAAO,CAAC,GAAG,EACX,aAAa,EACb,OAAO,CAAC,GAAG,CACZ,CAAC;QACF,IAAI,OAAO,EAAE,CAAC;YACZ,MAAM,IAAI,8BAAqB,CAAC,+BAAc,CAAC,eAAe,CAAC,CAAC;QAClE,CAAC;IACH,CAAC;IAEO,KAAK,CAAC,8BAA8B,CAAC,OAAuB,EAAE,KAAa;QACjF,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,cAAc,CAAmB,yBAAyB,CAAE,EAAE,CAAC;YACtF,OAAO;QACT,CAAC;QAED,MAAM,eAAe,GAAG,MAAM,IAAI,CAAC,oBAAoB,CAAC,gBAAgB,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QACtF,MAAM,gBAAgB,GAAG,IAAI,CAAC,gBAAgB,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;QAE/D,IAAI,CAAC,eAAe,EAAE,CAAC;YAKrB,MAAM,IAAI,CAAC,oBAAoB,CAAC,gBAAgB,CAAC,OAAO,CAAC,GAAG,EAAE,gBAAgB,CAAE,CAAC;YACjF,OAAO;QACT,CAAC;QAED,IAAI,gBAAgB,KAAK,eAAe,EAAE,CAAC;YACzC,MAAM,IAAI,8BAAqB,CAAC,+BAAc,CAAC,eAAe,CAAC,CAAC;QAClE,CAAC;IACH,CAAC;CACF,CAAA;AAtIY,4CAAgB;2BAAhB,gBAAgB;IAD5B,IAAA,mBAAU,GAAE;qCAGoB,gBAAU;QACF,uDAAyB;QACvB,4DAA2B;QAC5B,0DAA0B;QAC/B,gCAAc;QACzB,uBAAU;GAPvB,gBAAgB,CAsI5B","sourcesContent":["import type { SolidCoreSetting } from \"src/services/settings/default-settings-provider.service\";\nimport {\n CanActivate,\n ExecutionContext,\n Injectable,\n UnauthorizedException,\n} from '@nestjs/common';\nimport { JwtService } from '@nestjs/jwt';\nimport { Request } from 'express';\nimport { ERROR_MESSAGES } from \"src/constants/error-messages\";\nimport { ActiveUserData } from '../interfaces/active-user-data.interface';\nimport { REQUEST_USER_KEY } from \"../constants\";\nimport { PermissionMetadataService } from '../services/permission-metadata.service';\nimport { ClsService } from 'nestjs-cls';\nimport { ActiveSessionStorageService } from \"../services/active-session-storage.service\";\nimport { AccessTokenDenylistService } from \"../services/access-token-denylist.service\";\nimport { SettingService } from '../services/setting.service';\nimport { createHash } from \"crypto\";\n\n@Injectable()\nexport class AccessTokenGuard implements CanActivate {\n constructor(\n private readonly jwtService: JwtService,\n private readonly permissionsService: PermissionMetadataService,\n private readonly activeSessionStorage: ActiveSessionStorageService,\n private readonly accessTokenDenylist: AccessTokenDenylistService,\n private readonly settingService: SettingService,\n private readonly cls: ClsService\n ) { }\n\n async canActivate(context: ExecutionContext): Promise<boolean> {\n // 💡 NOTE: For GraphQL applications, you'd have to use the wrapper GqlExecutionContext here instead.\n const request = context.switchToHttp().getRequest();\n const token = this.extractTokenFromHeader(request);\n if (!token) {\n throw new UnauthorizedException();\n }\n try {\n\n const jwtConfiguration = {\n secret: this.settingService.getConfigValue<SolidCoreSetting>(\"secret\"),\n audience: this.settingService.getConfigValue<SolidCoreSetting>(\"audience\"),\n issuer: this.settingService.getConfigValue<SolidCoreSetting>(\"issuer\"),\n accessTokenTtl: this.settingService.getConfigValue<SolidCoreSetting>(\"accessTokenTtl\"),\n refreshTokenTtl: this.settingService.getConfigValue<SolidCoreSetting>(\"refreshTokenTtl\")\n }\n const payload: ActiveUserData = await this.jwtService.verifyAsync(\n token,\n jwtConfiguration\n );\n\n // Immediate access-token revocation. Runs BEFORE the concurrent-login\n // check on purpose: rejecting a revoked token first stops it reaching the\n // adopt-on-empty branch below and reclaiming the active session slot.\n // No setting check here - isRevoked short-circuits when the feature is\n // off, without touching the cache.\n await this.validateNotRevoked(payload, token);\n\n // Prevent Concurrent Login Feature\n await this.validateConcurrentLoginSession(payload, token);\n\n // Load permissions given the user. \n const permissions = await this.permissionsService.findAllUsingRoles(payload.roles);\n payload.permissions = permissions.map((permission) => permission.name);\n\n request[REQUEST_USER_KEY] = payload;\n this.cls.set(REQUEST_USER_KEY, payload);\n // console.log(`About to set payload in the request user key:`);\n // console.log(payload);\n } catch (err) {\n throw err instanceof UnauthorizedException\n ? err\n : new UnauthorizedException();\n }\n return true;\n }\n\n private extractTokenFromHeader(request: Request): string | undefined {\n // Since token is included in the Authorization header something like \n // Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOjEsImVtYWlsIjoidXNlcjFAbmVzdGpzLmNvbSIsImlhdCI6MTcwMDk5NTk1MywiZXhwIjoxNzAwOTk5NTUzLCJhdWQiOiJsb2NhbGhvc3Q6MzAwMCIsImlzcyI6ImxvY2FsaG9zdDozMDAwIn0.303Y04SZjKqoPjJRq4hXHcarHeZYS878gPGWmw2SoUc\n const [_, token] = request.headers.authorization?.split(' ') ?? [];\n return token;\n }\n\n private resolveSessionId(payload: ActiveUserData, token: string): string {\n if (payload.sessionId) {\n return payload.sessionId;\n }\n\n // Legacy tokens (issued before preventConcurrentLogins was enabled)\n // have no sessionId claim, so derive a stable fallback from the token.\n return createHash('sha256').update(token).digest('hex');\n }\n\n /**\n * The key this token's session is denylisted under.\n *\n * Deliberately NOT merged with resolveSessionId above, which differs only by\n * the deviceKey step. Merging them would change validateConcurrentLoginSession\n * for tokens issued while preventConcurrentLogins was off that are still live\n * when it is switched on: those resolve to sha256(token) today and would\n * resolve to deviceKey instead. The divergence is invisible in normal\n * operation - that check only runs while the setting is on, and tokens issued\n * in that state never carry a deviceKey - so the two formulas already agree\n * for every token it sees. Only toggle-crossover tokens tell them apart.\n */\n private resolveRevocationKey(payload: ActiveUserData, token: string): string {\n return (\n payload.sessionId ??\n payload.deviceKey ??\n createHash('sha256').update(token).digest('hex')\n );\n }\n\n private async validateNotRevoked(payload: ActiveUserData, token: string): Promise<void> {\n // isRevoked would short-circuit on its own, but resolving the key first can\n // cost a sha256 for a token carrying neither claim. Checking here keeps the\n // opted-out path genuinely free.\n if (!this.accessTokenDenylist.isEnabled()) {\n return;\n }\n\n const revocationKey = this.resolveRevocationKey(payload, token);\n const revoked = await this.accessTokenDenylist.isRevoked(\n payload.sub,\n revocationKey,\n payload.iat,\n );\n if (revoked) {\n throw new UnauthorizedException(ERROR_MESSAGES.SESSION_INVALID);\n }\n }\n\n private async validateConcurrentLoginSession(payload: ActiveUserData, token: string,): Promise<void> {\n if (!this.settingService.getConfigValue<SolidCoreSetting>(\"preventConcurrentLogins\",)) {\n return;\n }\n\n const activeSessionId = await this.activeSessionStorage.getActiveSession(payload.sub);\n const currentSessionId = this.resolveSessionId(payload, token);\n\n if (!activeSessionId) {\n // No active session recorded yet for this user — this is the first\n // request we've seen since the feature was enabled (or storage was\n // cleared). Adopt this request's session as the active one so this\n // browser stays logged in going forward.\n await this.activeSessionStorage.setActiveSession(payload.sub, currentSessionId,);\n return;\n }\n\n if (currentSessionId !== activeSessionId) {\n throw new UnauthorizedException(ERROR_MESSAGES.SESSION_INVALID);\n }\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"access-token.guard.js","sourceRoot":"","sources":["../../src/guards/access-token.guard.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,2CAKwB;AACxB,qCAAyC;AAEzC,gEAA8D;AAE9D,4CAAgD;AAChD,yFAAoF;AACpF,2CAAwC;AACxC,+FAAyF;AACzF,6FAAuF;AACvF,iEAA6D;AAC7D,mCAAoC;AACpC,iEAA4D;AAGrD,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;IAC3B,YACmB,UAAsB,EACtB,kBAA6C,EAC7C,oBAAiD,EACjD,mBAA+C,EAC/C,cAA8B,EAC9B,GAAe,EACf,aAA4B;QAN5B,eAAU,GAAV,UAAU,CAAY;QACtB,uBAAkB,GAAlB,kBAAkB,CAA2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eAAe,CAAC,CAAC;QAClE,CAAC;IACH,CAAC;CACF,CAAA;AA/IY,4CAAgB;2BAAhB,gBAAgB;IAD5B,IAAA,mBAAU,GAAE;qCAGoB,gBAAU;QACF,uDAAyB;QACvB,4DAA2B;QAC5B,0DAA0B;QAC/B,gCAAc;QACzB,uBAAU;QACA,+BAAa;GARpC,gBAAgB,CA+I5B","sourcesContent":["import type { SolidCoreSetting } from \"src/services/settings/default-settings-provider.service\";\nimport {\n CanActivate,\n ExecutionContext,\n Injectable,\n UnauthorizedException,\n} from '@nestjs/common';\nimport { JwtService } from '@nestjs/jwt';\nimport { Request } from 'express';\nimport { ERROR_MESSAGES } from \"src/constants/error-messages\";\nimport { ActiveUserData } from '../interfaces/active-user-data.interface';\nimport { REQUEST_USER_KEY } from \"../constants\";\nimport { PermissionMetadataService } from '../services/permission-metadata.service';\nimport { ClsService } from 'nestjs-cls';\nimport { ActiveSessionStorageService } from \"../services/active-session-storage.service\";\nimport { AccessTokenDenylistService } from \"../services/access-token-denylist.service\";\nimport { SettingService } from '../services/setting.service';\nimport { createHash } from \"crypto\";\nimport { ApiKeyService } from '../services/api-key.service';\n\n@Injectable()\nexport class AccessTokenGuard implements CanActivate {\n constructor(\n private readonly jwtService: JwtService,\n private readonly permissionsService: PermissionMetadataService,\n private readonly activeSessionStorage: ActiveSessionStorageService,\n private readonly accessTokenDenylist: AccessTokenDenylistService,\n private readonly settingService: SettingService,\n private readonly cls: ClsService,\n private readonly apiKeyService: ApiKeyService,\n ) { }\n\n async canActivate(context: ExecutionContext): Promise<boolean> {\n // 💡 NOTE: For GraphQL applications, you'd have to use the wrapper GqlExecutionContext here instead.\n const request = context.switchToHttp().getRequest();\n const token = this.extractTokenFromHeader(request);\n if (!token) {\n throw new UnauthorizedException();\n }\n try {\n\n const jwtConfiguration = {\n secret: this.settingService.getConfigValue<SolidCoreSetting>(\"secret\"),\n audience: this.settingService.getConfigValue<SolidCoreSetting>(\"audience\"),\n issuer: this.settingService.getConfigValue<SolidCoreSetting>(\"issuer\"),\n accessTokenTtl: this.settingService.getConfigValue<SolidCoreSetting>(\"accessTokenTtl\"),\n refreshTokenTtl: this.settingService.getConfigValue<SolidCoreSetting>(\"refreshTokenTtl\")\n }\n const payload: ActiveUserData = await this.jwtService.verifyAsync(\n token,\n jwtConfiguration\n );\n\n // Portal tokens follow the key lifecycle and never occupy a browser login slot.\n if (payload.portalApiKeyId !== undefined) {\n const user = await this.apiKeyService.validatePortalSession(payload.portalApiKeyId, payload.sub);\n request[REQUEST_USER_KEY] = user;\n this.cls.set(REQUEST_USER_KEY, user);\n return true;\n }\n\n // Immediate access-token revocation. Runs BEFORE the concurrent-login\n // check on purpose: rejecting a revoked token first stops it reaching the\n // adopt-on-empty branch below and reclaiming the active session slot.\n // No setting check here - isRevoked short-circuits when the feature is\n // off, without touching the cache.\n await this.validateNotRevoked(payload, token);\n\n // Prevent Concurrent Login Feature\n await this.validateConcurrentLoginSession(payload, token);\n\n // Load permissions given the user. \n const permissions = await this.permissionsService.findAllUsingRoles(payload.roles);\n payload.permissions = permissions.map((permission) => permission.name);\n\n request[REQUEST_USER_KEY] = payload;\n this.cls.set(REQUEST_USER_KEY, payload);\n // console.log(`About to set payload in the request user key:`);\n // console.log(payload);\n } catch (err) {\n throw err instanceof UnauthorizedException\n ? err\n : new UnauthorizedException();\n }\n return true;\n }\n\n private extractTokenFromHeader(request: Request): string | undefined {\n // Since token is included in the Authorization header something like \n // Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOjEsImVtYWlsIjoidXNlcjFAbmVzdGpzLmNvbSIsImlhdCI6MTcwMDk5NTk1MywiZXhwIjoxNzAwOTk5NTUzLCJhdWQiOiJsb2NhbGhvc3Q6MzAwMCIsImlzcyI6ImxvY2FsaG9zdDozMDAwIn0.303Y04SZjKqoPjJRq4hXHcarHeZYS878gPGWmw2SoUc\n const [_, token] = request.headers.authorization?.split(' ') ?? [];\n return token;\n }\n\n private resolveSessionId(payload: ActiveUserData, token: string): string {\n if (payload.sessionId) {\n return payload.sessionId;\n }\n\n // Legacy tokens (issued before preventConcurrentLogins was enabled)\n // have no sessionId claim, so derive a stable fallback from the token.\n return createHash('sha256').update(token).digest('hex');\n }\n\n /**\n * The key this token's session is denylisted under.\n *\n * Deliberately NOT merged with resolveSessionId above, which differs only by\n * the deviceKey step. Merging them would change validateConcurrentLoginSession\n * for tokens issued while preventConcurrentLogins was off that are still live\n * when it is switched on: those resolve to sha256(token) today and would\n * resolve to deviceKey instead. The divergence is invisible in normal\n * operation - that check only runs while the setting is on, and tokens issued\n * in that state never carry a deviceKey - so the two formulas already agree\n * for every token it sees. Only toggle-crossover tokens tell them apart.\n */\n private resolveRevocationKey(payload: ActiveUserData, token: string): string {\n return (\n payload.sessionId ??\n payload.deviceKey ??\n createHash('sha256').update(token).digest('hex')\n );\n }\n\n private async validateNotRevoked(payload: ActiveUserData, token: string): Promise<void> {\n // isRevoked would short-circuit on its own, but resolving the key first can\n // cost a sha256 for a token carrying neither claim. Checking here keeps the\n // opted-out path genuinely free.\n if (!this.accessTokenDenylist.isEnabled()) {\n return;\n }\n\n const revocationKey = this.resolveRevocationKey(payload, token);\n const revoked = await this.accessTokenDenylist.isRevoked(\n payload.sub,\n revocationKey,\n payload.iat,\n );\n if (revoked) {\n throw new UnauthorizedException(ERROR_MESSAGES.SESSION_INVALID);\n }\n }\n\n private async validateConcurrentLoginSession(payload: ActiveUserData, token: string,): Promise<void> {\n if (!this.settingService.getConfigValue<SolidCoreSetting>(\"preventConcurrentLogins\",)) {\n return;\n }\n\n const activeSessionId = await this.activeSessionStorage.getActiveSession(payload.sub);\n const currentSessionId = this.resolveSessionId(payload, token);\n\n if (!activeSessionId) {\n // No active session recorded yet for this user — this is the first\n // request we've seen since the feature was enabled (or storage was\n // cleared). Adopt this request's session as the active one so this\n // browser stays logged in going forward.\n await this.activeSessionStorage.setActiveSession(payload.sub, currentSessionId,);\n return;\n }\n\n if (currentSessionId !== activeSessionId) {\n throw new UnauthorizedException(ERROR_MESSAGES.SESSION_INVALID);\n }\n }\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-config-version-name.d.ts","sourceRoot":"","sources":["../../src/helpers/agent-config-version-name.ts"],"names":[],"mappings":"AAWA,wBAAgB,2BAA2B,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,EAAE,aAAa,EAAE,MAAM,EAAE,GAAG,GAAE,IAAiB,GAAG,MAAM,CAI3H"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.buildAgentConfigVersionName = buildAgentConfigVersionName;
|
|
7
|
+
const dayjs_1 = __importDefault(require("dayjs"));
|
|
8
|
+
const timezone_1 = __importDefault(require("dayjs/plugin/timezone"));
|
|
9
|
+
const utc_1 = __importDefault(require("dayjs/plugin/utc"));
|
|
10
|
+
dayjs_1.default.extend(utc_1.default);
|
|
11
|
+
dayjs_1.default.extend(timezone_1.default);
|
|
12
|
+
function buildAgentConfigVersionName(name, versionNumber, now = new Date()) {
|
|
13
|
+
const timeZone = process.env.SOLIDX_WALL_TIME_TIMEZONE || process.env.SOLIDX_TIMEZONE || 'UTC';
|
|
14
|
+
const baseName = name?.trim() || `v${versionNumber}`;
|
|
15
|
+
return `${baseName}_${(0, dayjs_1.default)(now).tz(timeZone).format('YYYYMMDD_HHmm')}`;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=agent-config-version-name.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-config-version-name.js","sourceRoot":"","sources":["../../src/helpers/agent-config-version-name.ts"],"names":[],"mappings":";;;;;AAWA,kEAIC;AAfD,kDAA0B;AAC1B,qEAA6C;AAC7C,2DAAmC;AAEnC,eAAK,CAAC,MAAM,CAAC,aAAG,CAAC,CAAC;AAClB,eAAK,CAAC,MAAM,CAAC,kBAAQ,CAAC,CAAC;AAMvB,SAAgB,2BAA2B,CAAC,IAAwB,EAAE,aAAqB,EAAE,MAAY,IAAI,IAAI,EAAE;IACjH,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,yBAAyB,IAAI,OAAO,CAAC,GAAG,CAAC,eAAe,IAAI,KAAK,CAAC;IAC/F,MAAM,QAAQ,GAAG,IAAI,EAAE,IAAI,EAAE,IAAI,IAAI,aAAa,EAAE,CAAC;IACrD,OAAO,GAAG,QAAQ,IAAI,IAAA,eAAK,EAAC,GAAG,CAAC,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,eAAe,CAAC,EAAE,CAAC;AAC1E,CAAC","sourcesContent":["import dayjs from 'dayjs';\nimport timezone from 'dayjs/plugin/timezone';\nimport utc from 'dayjs/plugin/utc';\n\ndayjs.extend(utc);\ndayjs.extend(timezone);\n\n/**\n * Builds the stored config version name: `<name>_YYYYMMDD_HHmm`, or `v<number>_YYYYMMDD_HHmm` when no\n * name was given. The timestamp uses the deployment's configured timezone, defaulting to UTC.\n */\nexport function buildAgentConfigVersionName(name: string | undefined, versionNumber: number, now: Date = new Date()): string {\n const timeZone = process.env.SOLIDX_WALL_TIME_TIMEZONE || process.env.SOLIDX_TIMEZONE || 'UTC';\n const baseName = name?.trim() || `v${versionNumber}`;\n return `${baseName}_${dayjs(now).tz(timeZone).format('YYYYMMDD_HHmm')}`;\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-config-version-name.spec.d.ts","sourceRoot":"","sources":["../../src/helpers/agent-config-version-name.spec.ts"],"names":[],"mappings":""}
|