@bpinhosilva/agent-orchestrator 1.0.0-alpha.29 → 1.0.0-alpha.30
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 +9 -0
- package/dist/agents/agent-emoji.constants.d.ts +5 -0
- package/dist/agents/agent-emoji.constants.js +21 -0
- package/dist/agents/agents.service.js +1 -0
- package/dist/agents/dto/agent-attributes.dto.d.ts +14 -0
- package/dist/agents/dto/agent-attributes.dto.js +42 -0
- package/dist/agents/dto/create-agent.dto.d.ts +4 -0
- package/dist/agents/dto/create-agent.dto.js +18 -1
- package/dist/agents/entities/agent.entity.d.ts +4 -0
- package/dist/agents/entities/agent.entity.js +12 -1
- package/dist/agents/implementations/claude.agent.d.ts +1 -0
- package/dist/agents/implementations/claude.agent.js +5 -0
- package/dist/agents/implementations/gemini.agent.d.ts +1 -0
- package/dist/agents/implementations/gemini.agent.js +5 -0
- package/dist/agents/personality.util.d.ts +8 -0
- package/dist/agents/personality.util.js +81 -0
- package/dist/app.module.js +2 -0
- package/dist/auth/guards/roles.guard.js +1 -1
- package/dist/common/common.module.js +10 -2
- package/dist/common/filesystem-storage.service.d.ts +17 -0
- package/dist/common/filesystem-storage.service.js +131 -0
- package/dist/common/storage-path.helper.d.ts +21 -0
- package/dist/common/storage-path.helper.js +96 -0
- package/dist/common/storage.service.d.ts +6 -22
- package/dist/common/storage.service.js +2 -127
- package/dist/migrations/1775271000000-AddAgentEmoji.d.ts +6 -0
- package/dist/migrations/1775271000000-AddAgentEmoji.js +21 -0
- package/dist/migrations/1775272000000-CreateSystemSettings.d.ts +5 -0
- package/dist/migrations/1775272000000-CreateSystemSettings.js +41 -0
- package/dist/migrations/1775290000000-AddAgentAttributes.d.ts +6 -0
- package/dist/migrations/1775290000000-AddAgentAttributes.js +20 -0
- package/dist/projects/projects.controller.d.ts +1 -1
- package/dist/projects/projects.controller.js +8 -3
- package/dist/projects/projects.service.d.ts +2 -1
- package/dist/projects/projects.service.js +30 -7
- package/dist/system-settings/dto/update-system-settings.dto.d.ts +3 -0
- package/dist/system-settings/dto/update-system-settings.dto.js +25 -0
- package/dist/system-settings/entities/system-settings.entity.d.ts +6 -0
- package/dist/system-settings/entities/system-settings.entity.js +43 -0
- package/dist/system-settings/system-settings.controller.d.ts +8 -0
- package/dist/system-settings/system-settings.controller.js +57 -0
- package/dist/system-settings/system-settings.module.d.ts +2 -0
- package/dist/system-settings/system-settings.module.js +25 -0
- package/dist/system-settings/system-settings.service.d.ts +33 -0
- package/dist/system-settings/system-settings.service.js +72 -0
- package/dist/tasks/task-scheduler.service.d.ts +3 -1
- package/dist/tasks/task-scheduler.service.js +13 -3
- package/dist/ui/assets/AgentFleet-BC7f8zM2.js +1 -0
- package/dist/ui/assets/ConfirmDialog-CkcwaNQU.js +1 -0
- package/dist/ui/assets/{MarkdownField-CYto7bYs.js → MarkdownField-CctdTNGJ.js} +1 -1
- package/dist/ui/assets/Profile-Dt9Cr9ID.js +1 -0
- package/dist/ui/assets/ProjectDetail-qH2AAZTi.js +1 -0
- package/dist/ui/assets/Providers-B54XMRse.js +1 -0
- package/dist/ui/assets/Scheduler-nEIrwyM5.js +1 -0
- package/dist/ui/assets/Settings-Docpy4vj.js +1 -0
- package/dist/ui/assets/TaskDetail-DcoOOrcL.js +1 -0
- package/dist/ui/assets/TaskManager-CKrFNDP3.js +8 -0
- package/dist/ui/assets/UserDetail-B0BX-fYw.js +1 -0
- package/dist/ui/assets/Users-i0A2bsB0.js +1 -0
- package/dist/ui/assets/activity-D2aBFbnN.js +1 -0
- package/dist/ui/assets/box-3f35ZKNV.js +1 -0
- package/dist/ui/assets/brain-DwFWAhZ9.js +1 -0
- package/dist/ui/assets/check-BhOeS9mA.js +1 -0
- package/dist/ui/assets/chevron-down-DOfOMDZp.js +1 -0
- package/dist/ui/assets/chevron-left-QkqjdeR4.js +1 -0
- package/dist/ui/assets/chevron-right-KmgHEojr.js +1 -0
- package/dist/ui/assets/{useNotification-DK-pV16c.js → client-CylGrWpP.js} +1 -1
- package/dist/ui/assets/clock-BTNXfvPT.js +1 -0
- package/dist/ui/assets/database-DCvzb1Ln.js +1 -0
- package/dist/ui/assets/eye-CYZnDMed.js +1 -0
- package/dist/ui/assets/file-text-CPTKEcvU.js +1 -0
- package/dist/ui/assets/index-B2axrOIs.js +2 -0
- package/dist/ui/assets/index-CbC4BxZg.css +2 -0
- package/dist/ui/assets/layers-Cv5Kbvy2.js +1 -0
- package/dist/ui/assets/loader-circle-C8SRxjl2.js +1 -0
- package/dist/ui/assets/providers-BLAJFnS4.js +1 -0
- package/dist/ui/assets/rocket-D_szyz9E.js +1 -0
- package/dist/ui/assets/save-DZKbCHc6.js +1 -0
- package/dist/ui/assets/search-CS7DFiLw.js +1 -0
- package/dist/ui/assets/send-OVfBL10t.js +1 -0
- package/dist/ui/assets/shield-alert-BqmiwlAJ.js +1 -0
- package/dist/ui/assets/shield-check-DCdshyB-.js +1 -0
- package/dist/ui/assets/sparkles-BYfDbPNH.js +1 -0
- package/dist/ui/assets/taskFormSchemas-DdMj5uS7.js +10 -0
- package/dist/ui/assets/tasks-QGA3THUZ.js +1 -0
- package/dist/ui/assets/terminal-C1KxpLUh.js +1 -0
- package/dist/ui/assets/trash-2-BxFsrfIN.js +1 -0
- package/dist/ui/assets/trending-up-B1iQTY5i.js +1 -0
- package/dist/ui/assets/user-Dp-h-An5.js +1 -0
- package/dist/ui/assets/user-plus-CrYvStM7.js +1 -0
- package/dist/ui/assets/users-B8mDcSH_.js +1 -0
- package/dist/ui/assets/zap-Dqr_5eJO.js +1 -0
- package/dist/ui/index.html +5 -5
- package/dist/uploads/parse-filepath.pipe.d.ts +5 -0
- package/dist/uploads/parse-filepath.pipe.js +26 -0
- package/dist/uploads/uploads.controller.d.ts +1 -1
- package/dist/uploads/uploads.controller.js +34 -21
- package/dist/users/dto/list-users-query.dto.d.ts +5 -0
- package/dist/users/dto/list-users-query.dto.js +49 -0
- package/dist/users/users.controller.d.ts +7 -1
- package/dist/users/users.controller.js +10 -4
- package/dist/users/users.service.d.ts +7 -1
- package/dist/users/users.service.js +49 -2
- package/package.json +4 -3
- package/dist/ui/assets/AgentFleet-BK16qSVb.js +0 -1
- package/dist/ui/assets/ConfirmDialog-CAb4bA6D.js +0 -10
- package/dist/ui/assets/InitialsAvatar-B_nsCs58.js +0 -1
- package/dist/ui/assets/Profile-CR2v0N6L.js +0 -1
- package/dist/ui/assets/ProjectDetail-KyqWvAT1.js +0 -1
- package/dist/ui/assets/Providers-CUSKu0A6.js +0 -1
- package/dist/ui/assets/Scheduler-DLC1PTRB.js +0 -1
- package/dist/ui/assets/TaskDetail-O6ZsA0nQ.js +0 -1
- package/dist/ui/assets/TaskManager-CDN6O6Yh.js +0 -8
- package/dist/ui/assets/activity-CIlCK2jL.js +0 -1
- package/dist/ui/assets/box-CsCoq7gr.js +0 -1
- package/dist/ui/assets/brain-_N041Xks.js +0 -1
- package/dist/ui/assets/check-DgCfni6J.js +0 -1
- package/dist/ui/assets/chevron-down-g12gVicW.js +0 -1
- package/dist/ui/assets/clock-R052yhHC.js +0 -1
- package/dist/ui/assets/eye-l4Yx91ui.js +0 -1
- package/dist/ui/assets/index-BfqRKMgT.css +0 -2
- package/dist/ui/assets/index-tztXTZhU.js +0 -2
- package/dist/ui/assets/layers-DmKVnI8y.js +0 -1
- package/dist/ui/assets/providers-CVpZdX9Z.js +0 -1
- package/dist/ui/assets/rocket-DvvoumQL.js +0 -1
- package/dist/ui/assets/send-CaBqcm_I.js +0 -1
- package/dist/ui/assets/shield-check-Vujd3EPc.js +0 -1
- package/dist/ui/assets/sparkles-DfBrsYtR.js +0 -1
- package/dist/ui/assets/tasks-9h6EhJqU.js +0 -1
- package/dist/ui/assets/trash-2-Dj3ML80c.js +0 -1
- package/dist/ui/assets/trending-up-BqKi8IJf.js +0 -1
- package/dist/ui/assets/user-r_WwM0uQ.js +0 -1
- package/dist/ui/assets/zap-Vy8-GCO1.js +0 -1
- /package/dist/ui/assets/{cn-w7-BIiZy.js → cn-DKjtbpik.js} +0 -0
- /package/dist/ui/assets/{vendor-forms-BhyC9zH1.js → vendor-forms-Djx-6_sr.js} +0 -0
- /package/dist/ui/assets/{vendor-motion-CYM51UOz.js → vendor-motion-DUzX9EJL.js} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
# [1.0.0-alpha.30](https://github.com/bpinhosilva/agent-orchestrator/compare/v1.0.0-alpha.29...v1.0.0-alpha.30) (2026-04-05)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* add UsersPage component with user management features and tests ([bb46646](https://github.com/bpinhosilva/agent-orchestrator/commit/bb466468849b01dd30bc228e3c0375b6aea874e8))
|
|
7
|
+
* integrate Personality Matrix component, refactor storage service ([2aa80d3](https://github.com/bpinhosilva/agent-orchestrator/commit/2aa80d3b64cd6431ba0113182dcb5d871075fcfd))
|
|
8
|
+
* integrate wait-on for improved dev workflow ([af26318](https://github.com/bpinhosilva/agent-orchestrator/commit/af2631820f5fc95b7b85c9f6ec52157b7df74264))
|
|
9
|
+
|
|
1
10
|
# [1.0.0-alpha.29](https://github.com/bpinhosilva/agent-orchestrator/compare/v1.0.0-alpha.28...v1.0.0-alpha.29) (2026-04-04)
|
|
2
11
|
|
|
3
12
|
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const AGENT_EMOJI_VALUES: readonly ["🧠", "🤖", "🧪", "🛠️", "📊", "🔍", "🧭", "📝", "⚙️", "🚀"];
|
|
2
|
+
export type AgentEmojiValue = (typeof AGENT_EMOJI_VALUES)[number];
|
|
3
|
+
export declare const DEFAULT_AGENT_EMOJI: AgentEmojiValue;
|
|
4
|
+
export declare const isAgentEmojiValue: (value: unknown) => value is AgentEmojiValue;
|
|
5
|
+
export declare const normalizeAgentEmoji: (value?: string | null) => AgentEmojiValue;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.normalizeAgentEmoji = exports.isAgentEmojiValue = exports.DEFAULT_AGENT_EMOJI = exports.AGENT_EMOJI_VALUES = void 0;
|
|
4
|
+
exports.AGENT_EMOJI_VALUES = [
|
|
5
|
+
'🧠',
|
|
6
|
+
'🤖',
|
|
7
|
+
'🧪',
|
|
8
|
+
'🛠️',
|
|
9
|
+
'📊',
|
|
10
|
+
'🔍',
|
|
11
|
+
'🧭',
|
|
12
|
+
'📝',
|
|
13
|
+
'⚙️',
|
|
14
|
+
'🚀',
|
|
15
|
+
];
|
|
16
|
+
exports.DEFAULT_AGENT_EMOJI = '🧠';
|
|
17
|
+
const isAgentEmojiValue = (value) => typeof value === 'string' &&
|
|
18
|
+
exports.AGENT_EMOJI_VALUES.includes(value);
|
|
19
|
+
exports.isAgentEmojiValue = isAgentEmojiValue;
|
|
20
|
+
const normalizeAgentEmoji = (value) => (0, exports.isAgentEmojiValue)(value) ? value : exports.DEFAULT_AGENT_EMOJI;
|
|
21
|
+
exports.normalizeAgentEmoji = normalizeAgentEmoji;
|
|
@@ -72,6 +72,7 @@ let AgentsService = AgentsService_1 = class AgentsService {
|
|
|
72
72
|
role: agentEntity.role,
|
|
73
73
|
provider: providerName,
|
|
74
74
|
model: agentEntity.model?.name,
|
|
75
|
+
attributes: agentEntity.attributes,
|
|
75
76
|
});
|
|
76
77
|
this.agentInstances.set(agentEntity.id, instance);
|
|
77
78
|
this.logger.debug(`Synchronized agent instance #${agentEntity.id}`);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare const ATTRIBUTES_MIN = 1;
|
|
2
|
+
export declare const ATTRIBUTES_MAX = 5;
|
|
3
|
+
export declare const BALANCED_ATTRIBUTES: {
|
|
4
|
+
readonly creativity: 3;
|
|
5
|
+
readonly strictness: 3.5;
|
|
6
|
+
};
|
|
7
|
+
export declare class AgentAttributesDto {
|
|
8
|
+
creativity?: number;
|
|
9
|
+
strictness?: number;
|
|
10
|
+
}
|
|
11
|
+
export interface AgentAttributes {
|
|
12
|
+
creativity?: number;
|
|
13
|
+
strictness?: number;
|
|
14
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.AgentAttributesDto = exports.BALANCED_ATTRIBUTES = exports.ATTRIBUTES_MAX = exports.ATTRIBUTES_MIN = void 0;
|
|
13
|
+
const openapi = require("@nestjs/swagger");
|
|
14
|
+
const class_validator_1 = require("class-validator");
|
|
15
|
+
exports.ATTRIBUTES_MIN = 1;
|
|
16
|
+
exports.ATTRIBUTES_MAX = 5;
|
|
17
|
+
exports.BALANCED_ATTRIBUTES = {
|
|
18
|
+
creativity: 3.0,
|
|
19
|
+
strictness: 3.5,
|
|
20
|
+
};
|
|
21
|
+
class AgentAttributesDto {
|
|
22
|
+
creativity;
|
|
23
|
+
strictness;
|
|
24
|
+
static _OPENAPI_METADATA_FACTORY() {
|
|
25
|
+
return { creativity: { required: false, type: () => Number, minimum: exports.ATTRIBUTES_MIN, maximum: exports.ATTRIBUTES_MAX }, strictness: { required: false, type: () => Number, minimum: exports.ATTRIBUTES_MIN, maximum: exports.ATTRIBUTES_MAX } };
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
exports.AgentAttributesDto = AgentAttributesDto;
|
|
29
|
+
__decorate([
|
|
30
|
+
(0, class_validator_1.IsOptional)(),
|
|
31
|
+
(0, class_validator_1.IsNumber)({ maxDecimalPlaces: 2 }),
|
|
32
|
+
(0, class_validator_1.Min)(exports.ATTRIBUTES_MIN),
|
|
33
|
+
(0, class_validator_1.Max)(exports.ATTRIBUTES_MAX),
|
|
34
|
+
__metadata("design:type", Number)
|
|
35
|
+
], AgentAttributesDto.prototype, "creativity", void 0);
|
|
36
|
+
__decorate([
|
|
37
|
+
(0, class_validator_1.IsOptional)(),
|
|
38
|
+
(0, class_validator_1.IsNumber)({ maxDecimalPlaces: 2 }),
|
|
39
|
+
(0, class_validator_1.Min)(exports.ATTRIBUTES_MIN),
|
|
40
|
+
(0, class_validator_1.Max)(exports.ATTRIBUTES_MAX),
|
|
41
|
+
__metadata("design:type", Number)
|
|
42
|
+
], AgentAttributesDto.prototype, "strictness", void 0);
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { type AgentEmojiValue } from '../agent-emoji.constants';
|
|
2
|
+
import { AgentAttributesDto } from './agent-attributes.dto';
|
|
1
3
|
export declare class CreateAgentDto {
|
|
2
4
|
name: string;
|
|
3
5
|
description?: string;
|
|
@@ -5,5 +7,7 @@ export declare class CreateAgentDto {
|
|
|
5
7
|
systemInstructions?: string;
|
|
6
8
|
modelId: string;
|
|
7
9
|
status?: string;
|
|
10
|
+
emoji?: AgentEmojiValue;
|
|
8
11
|
providerId: string;
|
|
12
|
+
attributes?: AgentAttributesDto;
|
|
9
13
|
}
|
|
@@ -12,6 +12,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.CreateAgentDto = void 0;
|
|
13
13
|
const openapi = require("@nestjs/swagger");
|
|
14
14
|
const class_validator_1 = require("class-validator");
|
|
15
|
+
const class_transformer_1 = require("class-transformer");
|
|
16
|
+
const agent_emoji_constants_1 = require("../agent-emoji.constants");
|
|
17
|
+
const agent_attributes_dto_1 = require("./agent-attributes.dto");
|
|
15
18
|
class CreateAgentDto {
|
|
16
19
|
name;
|
|
17
20
|
description;
|
|
@@ -19,9 +22,11 @@ class CreateAgentDto {
|
|
|
19
22
|
systemInstructions;
|
|
20
23
|
modelId;
|
|
21
24
|
status;
|
|
25
|
+
emoji;
|
|
22
26
|
providerId;
|
|
27
|
+
attributes;
|
|
23
28
|
static _OPENAPI_METADATA_FACTORY() {
|
|
24
|
-
return { name: { required: true, type: () => String, maxLength: 200 }, description: { required: false, type: () => String, maxLength: 2000 }, role: { required: false, type: () => String, maxLength: 200 }, systemInstructions: { required: false, type: () => String, maxLength: 10000 }, modelId: { required: true, type: () => String }, status: { required: false, type: () => String, enum: ['active', 'inactive'] }, providerId: { required: true, type: () => String, format: "uuid" } };
|
|
29
|
+
return { name: { required: true, type: () => String, maxLength: 200 }, description: { required: false, type: () => String, maxLength: 2000 }, role: { required: false, type: () => String, maxLength: 200 }, systemInstructions: { required: false, type: () => String, maxLength: 10000 }, modelId: { required: true, type: () => String }, status: { required: false, type: () => String, enum: ['active', 'inactive'] }, emoji: { required: false, type: () => Object, enum: agent_emoji_constants_1.AGENT_EMOJI_VALUES }, providerId: { required: true, type: () => String, format: "uuid" }, attributes: { required: false, type: () => require("./agent-attributes.dto").AgentAttributesDto } };
|
|
25
30
|
}
|
|
26
31
|
}
|
|
27
32
|
exports.CreateAgentDto = CreateAgentDto;
|
|
@@ -60,8 +65,20 @@ __decorate([
|
|
|
60
65
|
(0, class_validator_1.IsIn)(['active', 'inactive']),
|
|
61
66
|
__metadata("design:type", String)
|
|
62
67
|
], CreateAgentDto.prototype, "status", void 0);
|
|
68
|
+
__decorate([
|
|
69
|
+
(0, class_validator_1.IsString)(),
|
|
70
|
+
(0, class_validator_1.IsOptional)(),
|
|
71
|
+
(0, class_validator_1.IsIn)(agent_emoji_constants_1.AGENT_EMOJI_VALUES),
|
|
72
|
+
__metadata("design:type", String)
|
|
73
|
+
], CreateAgentDto.prototype, "emoji", void 0);
|
|
63
74
|
__decorate([
|
|
64
75
|
(0, class_validator_1.IsUUID)(),
|
|
65
76
|
(0, class_validator_1.IsNotEmpty)(),
|
|
66
77
|
__metadata("design:type", String)
|
|
67
78
|
], CreateAgentDto.prototype, "providerId", void 0);
|
|
79
|
+
__decorate([
|
|
80
|
+
(0, class_validator_1.IsOptional)(),
|
|
81
|
+
(0, class_validator_1.ValidateNested)(),
|
|
82
|
+
(0, class_transformer_1.Type)(() => agent_attributes_dto_1.AgentAttributesDto),
|
|
83
|
+
__metadata("design:type", agent_attributes_dto_1.AgentAttributesDto)
|
|
84
|
+
], CreateAgentDto.prototype, "attributes", void 0);
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { Model } from '../../models/entities/model.entity';
|
|
2
2
|
import { Provider } from '../../providers/entities/provider.entity';
|
|
3
|
+
import { type AgentEmojiValue } from '../agent-emoji.constants';
|
|
4
|
+
import { type AgentAttributes } from '../dto/agent-attributes.dto';
|
|
3
5
|
export declare class AgentEntity {
|
|
4
6
|
id: string;
|
|
5
7
|
name: string;
|
|
@@ -7,6 +9,8 @@ export declare class AgentEntity {
|
|
|
7
9
|
systemInstructions: string;
|
|
8
10
|
role: string | null;
|
|
9
11
|
status: string | null;
|
|
12
|
+
emoji: AgentEmojiValue;
|
|
13
|
+
attributes: AgentAttributes | null;
|
|
10
14
|
provider: Provider | null;
|
|
11
15
|
model: Model | null;
|
|
12
16
|
createdAt: Date;
|
|
@@ -14,6 +14,7 @@ const openapi = require("@nestjs/swagger");
|
|
|
14
14
|
const typeorm_1 = require("typeorm");
|
|
15
15
|
const model_entity_1 = require("../../models/entities/model.entity");
|
|
16
16
|
const provider_entity_1 = require("../../providers/entities/provider.entity");
|
|
17
|
+
const agent_emoji_constants_1 = require("../agent-emoji.constants");
|
|
17
18
|
let AgentEntity = class AgentEntity {
|
|
18
19
|
id;
|
|
19
20
|
name;
|
|
@@ -21,12 +22,14 @@ let AgentEntity = class AgentEntity {
|
|
|
21
22
|
systemInstructions;
|
|
22
23
|
role;
|
|
23
24
|
status;
|
|
25
|
+
emoji;
|
|
26
|
+
attributes;
|
|
24
27
|
provider;
|
|
25
28
|
model;
|
|
26
29
|
createdAt;
|
|
27
30
|
updatedAt;
|
|
28
31
|
static _OPENAPI_METADATA_FACTORY() {
|
|
29
|
-
return { id: { required: true, type: () => String }, name: { required: true, type: () => String }, description: { required: true, type: () => String }, systemInstructions: { required: true, type: () => String }, role: { required: true, type: () => String, nullable: true }, status: { required: true, type: () => String, nullable: true }, provider: { required: true, type: () => require("../../providers/entities/provider.entity").Provider, nullable: true }, model: { required: true, type: () => require("../../models/entities/model.entity").Model, nullable: true }, createdAt: { required: true, type: () => Date }, updatedAt: { required: true, type: () => Date } };
|
|
32
|
+
return { id: { required: true, type: () => String }, name: { required: true, type: () => String }, description: { required: true, type: () => String }, systemInstructions: { required: true, type: () => String }, role: { required: true, type: () => String, nullable: true }, status: { required: true, type: () => String, nullable: true }, emoji: { required: true, type: () => Object }, attributes: { required: true, type: () => Object, nullable: true }, provider: { required: true, type: () => require("../../providers/entities/provider.entity").Provider, nullable: true }, model: { required: true, type: () => require("../../models/entities/model.entity").Model, nullable: true }, createdAt: { required: true, type: () => Date }, updatedAt: { required: true, type: () => Date } };
|
|
30
33
|
}
|
|
31
34
|
};
|
|
32
35
|
exports.AgentEntity = AgentEntity;
|
|
@@ -54,6 +57,14 @@ __decorate([
|
|
|
54
57
|
(0, typeorm_1.Column)({ type: 'text', nullable: true }),
|
|
55
58
|
__metadata("design:type", Object)
|
|
56
59
|
], AgentEntity.prototype, "status", void 0);
|
|
60
|
+
__decorate([
|
|
61
|
+
(0, typeorm_1.Column)({ type: 'text', default: agent_emoji_constants_1.DEFAULT_AGENT_EMOJI }),
|
|
62
|
+
__metadata("design:type", String)
|
|
63
|
+
], AgentEntity.prototype, "emoji", void 0);
|
|
64
|
+
__decorate([
|
|
65
|
+
(0, typeorm_1.Column)({ type: 'simple-json', nullable: true }),
|
|
66
|
+
__metadata("design:type", Object)
|
|
67
|
+
], AgentEntity.prototype, "attributes", void 0);
|
|
57
68
|
__decorate([
|
|
58
69
|
(0, typeorm_1.Index)(),
|
|
59
70
|
(0, typeorm_1.ManyToOne)(() => provider_entity_1.Provider, {
|
|
@@ -19,6 +19,7 @@ const common_1 = require("@nestjs/common");
|
|
|
19
19
|
const config_1 = require("@nestjs/config");
|
|
20
20
|
const default_provider_models_1 = require("../default-provider-models");
|
|
21
21
|
const agent_registry_1 = require("../registry/agent.registry");
|
|
22
|
+
const personality_util_1 = require("../personality.util");
|
|
22
23
|
let ClaudeAgent = ClaudeAgent_1 = class ClaudeAgent {
|
|
23
24
|
configService;
|
|
24
25
|
logger = new common_1.Logger(ClaudeAgent_1.name);
|
|
@@ -28,6 +29,7 @@ let ClaudeAgent = ClaudeAgent_1 = class ClaudeAgent {
|
|
|
28
29
|
role;
|
|
29
30
|
provider = 'anthropic';
|
|
30
31
|
model;
|
|
32
|
+
attributes;
|
|
31
33
|
constructor(configService, model = default_provider_models_1.DEFAULT_MODEL_BY_PROVIDER.anthropic) {
|
|
32
34
|
this.configService = configService;
|
|
33
35
|
this.model = model;
|
|
@@ -71,6 +73,8 @@ let ClaudeAgent = ClaudeAgent_1 = class ClaudeAgent {
|
|
|
71
73
|
this.provider = config['provider'];
|
|
72
74
|
if (config['model'])
|
|
73
75
|
this.model = config['model'];
|
|
76
|
+
if ('attributes' in config)
|
|
77
|
+
this.attributes = config['attributes'];
|
|
74
78
|
}
|
|
75
79
|
buildSystemPrompt() {
|
|
76
80
|
return [
|
|
@@ -80,6 +84,7 @@ let ClaudeAgent = ClaudeAgent_1 = class ClaudeAgent {
|
|
|
80
84
|
this.systemInstructions
|
|
81
85
|
? `Instructions:\n${this.systemInstructions}`
|
|
82
86
|
: '',
|
|
87
|
+
(0, personality_util_1.buildPersonalitySection)(this.attributes),
|
|
83
88
|
]
|
|
84
89
|
.filter(Boolean)
|
|
85
90
|
.join('\n');
|
|
@@ -19,6 +19,7 @@ const common_1 = require("@nestjs/common");
|
|
|
19
19
|
const config_1 = require("@nestjs/config");
|
|
20
20
|
const default_provider_models_1 = require("../default-provider-models");
|
|
21
21
|
const agent_registry_1 = require("../registry/agent.registry");
|
|
22
|
+
const personality_util_1 = require("../personality.util");
|
|
22
23
|
let GeminiAgent = GeminiAgent_1 = class GeminiAgent {
|
|
23
24
|
configService;
|
|
24
25
|
logger = new common_1.Logger(GeminiAgent_1.name);
|
|
@@ -30,6 +31,7 @@ let GeminiAgent = GeminiAgent_1 = class GeminiAgent {
|
|
|
30
31
|
provider = 'google';
|
|
31
32
|
model;
|
|
32
33
|
enableGrounding = true;
|
|
34
|
+
attributes;
|
|
33
35
|
constructor(configService, model = default_provider_models_1.DEFAULT_MODEL_BY_PROVIDER.google) {
|
|
34
36
|
this.configService = configService;
|
|
35
37
|
this.model = model;
|
|
@@ -78,6 +80,8 @@ let GeminiAgent = GeminiAgent_1 = class GeminiAgent {
|
|
|
78
80
|
this.model = config['model'];
|
|
79
81
|
if (config['enableGrounding'] !== undefined)
|
|
80
82
|
this.enableGrounding = !!config['enableGrounding'];
|
|
83
|
+
if ('attributes' in config)
|
|
84
|
+
this.attributes = config['attributes'];
|
|
81
85
|
}
|
|
82
86
|
async processText(input) {
|
|
83
87
|
const isGrounded = this.isGroundingSupported();
|
|
@@ -102,6 +106,7 @@ let GeminiAgent = GeminiAgent_1 = class GeminiAgent {
|
|
|
102
106
|
this.systemInstructions
|
|
103
107
|
? `Instructions:\n${this.systemInstructions}`
|
|
104
108
|
: '',
|
|
109
|
+
(0, personality_util_1.buildPersonalitySection)(this.attributes),
|
|
105
110
|
]
|
|
106
111
|
.filter(Boolean)
|
|
107
112
|
.join('\n'),
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { AgentAttributes } from './dto/agent-attributes.dto';
|
|
2
|
+
export interface PersonalityDescriptor {
|
|
3
|
+
label: string;
|
|
4
|
+
directive: string;
|
|
5
|
+
}
|
|
6
|
+
export declare function getCreativityDescriptor(value: number): PersonalityDescriptor;
|
|
7
|
+
export declare function getStrictnessDescriptor(value: number): PersonalityDescriptor;
|
|
8
|
+
export declare function buildPersonalitySection(attributes: AgentAttributes | null | undefined): string;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getCreativityDescriptor = getCreativityDescriptor;
|
|
4
|
+
exports.getStrictnessDescriptor = getStrictnessDescriptor;
|
|
5
|
+
exports.buildPersonalitySection = buildPersonalitySection;
|
|
6
|
+
function getCreativityDescriptor(value) {
|
|
7
|
+
if (value < 2.0) {
|
|
8
|
+
return {
|
|
9
|
+
label: 'Analytical',
|
|
10
|
+
directive: 'Prioritize verifiable facts and established methods. Avoid speculation, metaphors, or novel framings. Deliver direct, evidence-based answers.',
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
if (value < 3.0) {
|
|
14
|
+
return {
|
|
15
|
+
label: 'Conservative',
|
|
16
|
+
directive: 'Stick to proven approaches and well-established patterns. Introduce creative elements only when they provide clear, demonstrable value.',
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
if (value < 4.0) {
|
|
20
|
+
return {
|
|
21
|
+
label: 'Balanced',
|
|
22
|
+
directive: 'Mix analytical precision with creative insight. Use examples, analogies, and varied perspectives where they add clarity or engagement.',
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
if (value < 5.0) {
|
|
26
|
+
return {
|
|
27
|
+
label: 'Inventive',
|
|
28
|
+
directive: 'Actively explore novel approaches and generate multiple perspectives. Use vivid analogies, thought experiments, and lateral thinking to enrich responses.',
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
return {
|
|
32
|
+
label: 'Imaginative',
|
|
33
|
+
directive: 'Embrace unconventional thinking and maximum creative exploration. Freely use thought experiments, metaphors, and imaginative reframings to inspire and surprise.',
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
function getStrictnessDescriptor(value) {
|
|
37
|
+
if (value < 2.0) {
|
|
38
|
+
return {
|
|
39
|
+
label: 'Flexible',
|
|
40
|
+
directive: 'Adapt tone and structure freely to the context. Allow ambiguity, be conversational, and interpret requests generously.',
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
if (value < 3.0) {
|
|
44
|
+
return {
|
|
45
|
+
label: 'Relaxed',
|
|
46
|
+
directive: 'Maintain a loose but coherent structure. Respond naturally and informally when appropriate; precision is secondary to clarity.',
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
if (value < 4.0) {
|
|
50
|
+
return {
|
|
51
|
+
label: 'Structured',
|
|
52
|
+
directive: 'Organize all responses clearly and follow instructions precisely. Balance thoroughness with approachability.',
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
if (value < 5.0) {
|
|
56
|
+
return {
|
|
57
|
+
label: 'Rigorous',
|
|
58
|
+
directive: 'Apply strict formatting and boundary adherence in every response. Minimize deviation from stated constraints; flag any ambiguities before proceeding.',
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
return {
|
|
62
|
+
label: 'Exacting',
|
|
63
|
+
directive: 'Enforce all rules and constraints absolutely. Use precise, formal language. Never deviate from defined parameters; reject or escalate any out-of-scope requests.',
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
function buildPersonalitySection(attributes) {
|
|
67
|
+
if (!attributes)
|
|
68
|
+
return '';
|
|
69
|
+
const lines = [];
|
|
70
|
+
if (attributes.creativity !== undefined) {
|
|
71
|
+
const { label, directive } = getCreativityDescriptor(attributes.creativity);
|
|
72
|
+
lines.push(`- Creativity: ${attributes.creativity.toFixed(2)}/5 (${label}) — ${directive}`);
|
|
73
|
+
}
|
|
74
|
+
if (attributes.strictness !== undefined) {
|
|
75
|
+
const { label, directive } = getStrictnessDescriptor(attributes.strictness);
|
|
76
|
+
lines.push(`- Strictness: ${attributes.strictness.toFixed(2)}/5 (${label}) — ${directive}`);
|
|
77
|
+
}
|
|
78
|
+
if (lines.length === 0)
|
|
79
|
+
return '';
|
|
80
|
+
return ['[PERSONALITY MATRIX]', ...lines].join('\n');
|
|
81
|
+
}
|
package/dist/app.module.js
CHANGED
|
@@ -29,6 +29,7 @@ const core_1 = require("@nestjs/core");
|
|
|
29
29
|
const auth_module_1 = require("./auth/auth.module");
|
|
30
30
|
const jwt_auth_guard_1 = require("./auth/guards/jwt-auth.guard");
|
|
31
31
|
const roles_guard_1 = require("./auth/guards/roles.guard");
|
|
32
|
+
const system_settings_module_1 = require("./system-settings/system-settings.module");
|
|
32
33
|
const typeorm_2 = require("./config/typeorm");
|
|
33
34
|
const runtime_paths_1 = require("./config/runtime-paths");
|
|
34
35
|
(0, runtime_paths_1.loadRuntimeEnv)();
|
|
@@ -88,6 +89,7 @@ exports.AppModule = AppModule = __decorate([
|
|
|
88
89
|
projects_module_1.ProjectsModule,
|
|
89
90
|
users_module_1.UsersModule,
|
|
90
91
|
auth_module_1.AuthModule,
|
|
92
|
+
system_settings_module_1.SystemSettingsModule,
|
|
91
93
|
],
|
|
92
94
|
controllers: [app_controller_1.AppController],
|
|
93
95
|
providers: [
|
|
@@ -39,7 +39,7 @@ let RolesGuard = class RolesGuard {
|
|
|
39
39
|
throw new common_1.ForbiddenException('Insufficient permissions');
|
|
40
40
|
}
|
|
41
41
|
if (!requiredRoles.includes(user.role)) {
|
|
42
|
-
throw new common_1.ForbiddenException(
|
|
42
|
+
throw new common_1.ForbiddenException(`Insufficient permissions. Role '${user.role}' not found in allowed roles: [${requiredRoles.join(', ')}]`);
|
|
43
43
|
}
|
|
44
44
|
return true;
|
|
45
45
|
}
|
|
@@ -9,13 +9,21 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
9
9
|
exports.CommonModule = void 0;
|
|
10
10
|
const common_1 = require("@nestjs/common");
|
|
11
11
|
const storage_service_1 = require("./storage.service");
|
|
12
|
+
const filesystem_storage_service_1 = require("./filesystem-storage.service");
|
|
13
|
+
const storage_path_helper_1 = require("./storage-path.helper");
|
|
12
14
|
let CommonModule = class CommonModule {
|
|
13
15
|
};
|
|
14
16
|
exports.CommonModule = CommonModule;
|
|
15
17
|
exports.CommonModule = CommonModule = __decorate([
|
|
16
18
|
(0, common_1.Global)(),
|
|
17
19
|
(0, common_1.Module)({
|
|
18
|
-
providers: [
|
|
19
|
-
|
|
20
|
+
providers: [
|
|
21
|
+
{
|
|
22
|
+
provide: storage_service_1.StorageService,
|
|
23
|
+
useClass: filesystem_storage_service_1.FileSystemStorageService,
|
|
24
|
+
},
|
|
25
|
+
storage_path_helper_1.StoragePathHelper,
|
|
26
|
+
],
|
|
27
|
+
exports: [storage_service_1.StorageService, storage_path_helper_1.StoragePathHelper],
|
|
20
28
|
})
|
|
21
29
|
], CommonModule);
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { StorageService } from './storage.service';
|
|
2
|
+
export declare class FileSystemStorageService extends StorageService {
|
|
3
|
+
private readonly logger;
|
|
4
|
+
private readonly baseDir;
|
|
5
|
+
private readonly defaultBucket;
|
|
6
|
+
constructor();
|
|
7
|
+
getBucketPath(bucket: string): string;
|
|
8
|
+
getFullPath(relativePath: string, bucket?: string): string;
|
|
9
|
+
saveBase64(base64: string, mimeType: string, filePath: string, bucket?: string): Promise<void>;
|
|
10
|
+
save(buffer: Buffer, mimeType: string, filePath: string, bucket?: string): Promise<void>;
|
|
11
|
+
delete(relativePath: string, bucket?: string): Promise<void>;
|
|
12
|
+
private ensureDir;
|
|
13
|
+
private normalizeLegacyPath;
|
|
14
|
+
private assertSafePath;
|
|
15
|
+
private validateMimeType;
|
|
16
|
+
private validateFileSize;
|
|
17
|
+
}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
19
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
20
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
21
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
22
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
23
|
+
};
|
|
24
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
25
|
+
var ownKeys = function(o) {
|
|
26
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
27
|
+
var ar = [];
|
|
28
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
29
|
+
return ar;
|
|
30
|
+
};
|
|
31
|
+
return ownKeys(o);
|
|
32
|
+
};
|
|
33
|
+
return function (mod) {
|
|
34
|
+
if (mod && mod.__esModule) return mod;
|
|
35
|
+
var result = {};
|
|
36
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
37
|
+
__setModuleDefault(result, mod);
|
|
38
|
+
return result;
|
|
39
|
+
};
|
|
40
|
+
})();
|
|
41
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
42
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
43
|
+
};
|
|
44
|
+
var FileSystemStorageService_1;
|
|
45
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
46
|
+
exports.FileSystemStorageService = void 0;
|
|
47
|
+
const common_1 = require("@nestjs/common");
|
|
48
|
+
const path = __importStar(require("path"));
|
|
49
|
+
const fs = __importStar(require("fs"));
|
|
50
|
+
const promises_1 = require("fs/promises");
|
|
51
|
+
const storage_service_1 = require("./storage.service");
|
|
52
|
+
const storage_path_helper_1 = require("./storage-path.helper");
|
|
53
|
+
const MAX_FILE_SIZE_BYTES = 10 * 1024 * 1024;
|
|
54
|
+
let FileSystemStorageService = FileSystemStorageService_1 = class FileSystemStorageService extends storage_service_1.StorageService {
|
|
55
|
+
logger = new common_1.Logger(FileSystemStorageService_1.name);
|
|
56
|
+
baseDir;
|
|
57
|
+
defaultBucket = 'artifacts';
|
|
58
|
+
constructor() {
|
|
59
|
+
super();
|
|
60
|
+
this.baseDir =
|
|
61
|
+
process.env.AGENT_ORCHESTRATOR_HOME ||
|
|
62
|
+
path.join(process.cwd(), '.agent-orchestrator');
|
|
63
|
+
this.ensureDir(this.baseDir);
|
|
64
|
+
this.ensureDir(path.join(this.baseDir, this.defaultBucket));
|
|
65
|
+
}
|
|
66
|
+
getBucketPath(bucket) {
|
|
67
|
+
return path.join(this.baseDir, bucket);
|
|
68
|
+
}
|
|
69
|
+
getFullPath(relativePath, bucket = this.defaultBucket) {
|
|
70
|
+
return path.join(this.getBucketPath(bucket), relativePath);
|
|
71
|
+
}
|
|
72
|
+
async saveBase64(base64, mimeType, filePath, bucket) {
|
|
73
|
+
this.validateMimeType(mimeType);
|
|
74
|
+
const buffer = Buffer.from(base64, 'base64');
|
|
75
|
+
return this.save(buffer, mimeType, filePath, bucket);
|
|
76
|
+
}
|
|
77
|
+
async save(buffer, mimeType, filePath, bucket = this.defaultBucket) {
|
|
78
|
+
this.validateMimeType(mimeType);
|
|
79
|
+
this.validateFileSize(buffer.length);
|
|
80
|
+
this.assertSafePath(filePath);
|
|
81
|
+
const fullDir = path.join(this.getBucketPath(bucket), path.dirname(filePath));
|
|
82
|
+
const filename = path.basename(filePath);
|
|
83
|
+
this.ensureDir(fullDir);
|
|
84
|
+
await (0, promises_1.writeFile)(path.join(fullDir, filename), buffer);
|
|
85
|
+
this.logger.debug(`Saved artifact: bucket=${bucket} path=${filePath}`);
|
|
86
|
+
}
|
|
87
|
+
async delete(relativePath, bucket = this.defaultBucket) {
|
|
88
|
+
const normalized = this.normalizeLegacyPath(relativePath);
|
|
89
|
+
this.assertSafePath(normalized);
|
|
90
|
+
const fullPath = this.getFullPath(normalized, bucket);
|
|
91
|
+
if (fs.existsSync(fullPath)) {
|
|
92
|
+
await (0, promises_1.unlink)(fullPath);
|
|
93
|
+
this.logger.debug(`Deleted artifact file: ${fullPath}`);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
ensureDir(dir) {
|
|
97
|
+
if (!fs.existsSync(dir)) {
|
|
98
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
99
|
+
this.logger.log(`Created directory: ${dir}`);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
normalizeLegacyPath(relativePath) {
|
|
103
|
+
const legacyPrefix = `uploads/${this.defaultBucket}/`;
|
|
104
|
+
if (relativePath.startsWith(legacyPrefix)) {
|
|
105
|
+
return path.basename(relativePath);
|
|
106
|
+
}
|
|
107
|
+
return relativePath;
|
|
108
|
+
}
|
|
109
|
+
assertSafePath(inputPath) {
|
|
110
|
+
const normalized = path.normalize(inputPath);
|
|
111
|
+
if (path.isAbsolute(normalized) ||
|
|
112
|
+
normalized.split(path.sep).includes('..')) {
|
|
113
|
+
throw new common_1.BadRequestException(`Invalid path: ${inputPath}`);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
validateMimeType(mimeType) {
|
|
117
|
+
if (!storage_path_helper_1.ALLOWED_MIME_TYPES.has(mimeType)) {
|
|
118
|
+
throw new common_1.BadRequestException(`File type '${mimeType}' is not allowed. Allowed types: ${[...storage_path_helper_1.ALLOWED_MIME_TYPES].join(', ')}`);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
validateFileSize(sizeInBytes) {
|
|
122
|
+
if (sizeInBytes > MAX_FILE_SIZE_BYTES) {
|
|
123
|
+
throw new common_1.BadRequestException(`File size (${Math.round(sizeInBytes / 1024 / 1024)}MB) exceeds the maximum allowed size of ${MAX_FILE_SIZE_BYTES / 1024 / 1024}MB`);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
exports.FileSystemStorageService = FileSystemStorageService;
|
|
128
|
+
exports.FileSystemStorageService = FileSystemStorageService = FileSystemStorageService_1 = __decorate([
|
|
129
|
+
(0, common_1.Injectable)(),
|
|
130
|
+
__metadata("design:paramtypes", [])
|
|
131
|
+
], FileSystemStorageService);
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export declare enum StorageContext {
|
|
2
|
+
TASKS = "tasks",
|
|
3
|
+
AGENTS = "agents",
|
|
4
|
+
COMMENTS = "comments"
|
|
5
|
+
}
|
|
6
|
+
export interface StorageObjectPath {
|
|
7
|
+
id: string;
|
|
8
|
+
filePath: string;
|
|
9
|
+
originalName: string;
|
|
10
|
+
mimeType: string;
|
|
11
|
+
}
|
|
12
|
+
export declare const ALLOWED_MIME_TYPES: Set<string>;
|
|
13
|
+
export interface GenerateOptions {
|
|
14
|
+
context: StorageContext;
|
|
15
|
+
contextId: string;
|
|
16
|
+
mimeType: string;
|
|
17
|
+
originalName: string;
|
|
18
|
+
}
|
|
19
|
+
export declare class StoragePathHelper {
|
|
20
|
+
generate(options: GenerateOptions): StorageObjectPath;
|
|
21
|
+
}
|