repoburg 1.2.13 → 1.3.0
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/CODEMAP.md +5 -6
- package/backend/.env +4 -0
- package/backend/dist/src/ai-actions/ai-action-batch.service.d.ts +10 -3
- package/backend/dist/src/ai-actions/ai-action-batch.service.js +134 -12
- package/backend/dist/src/ai-actions/ai-action-batch.service.js.map +1 -1
- package/backend/dist/src/ai-actions/ai-actions.module.js +2 -7
- package/backend/dist/src/ai-actions/ai-actions.module.js.map +1 -1
- package/backend/dist/src/ai-actions/ai-actions.service.d.ts +16 -3
- package/backend/dist/src/ai-actions/ai-actions.service.js +75 -11
- package/backend/dist/src/ai-actions/ai-actions.service.js.map +1 -1
- package/backend/dist/src/app.module.js +0 -4
- package/backend/dist/src/app.module.js.map +1 -1
- package/backend/dist/src/llm-orchestration/action-handlers/action-handler.interface.d.ts +7 -0
- package/backend/dist/src/llm-orchestration/action-handlers/action-handler.interface.js +3 -0
- package/backend/dist/src/llm-orchestration/action-handlers/action-handler.interface.js.map +1 -0
- package/backend/dist/src/llm-orchestration/action-handlers/create-file.handler.d.ts +11 -0
- package/backend/dist/src/llm-orchestration/action-handlers/create-file.handler.js +65 -0
- package/backend/dist/src/llm-orchestration/action-handlers/create-file.handler.js.map +1 -0
- package/backend/dist/src/llm-orchestration/action-handlers/delete-file.handler.d.ts +12 -0
- package/backend/dist/src/llm-orchestration/action-handlers/delete-file.handler.js +85 -0
- package/backend/dist/src/llm-orchestration/action-handlers/delete-file.handler.js.map +1 -0
- package/backend/dist/src/llm-orchestration/action-handlers/dto/create-file.args.dto.d.ts +4 -0
- package/backend/dist/src/llm-orchestration/action-handlers/dto/create-file.args.dto.js +29 -0
- package/backend/dist/src/llm-orchestration/action-handlers/dto/create-file.args.dto.js.map +1 -0
- package/backend/dist/src/llm-orchestration/action-handlers/dto/delete-file.args.dto.d.ts +3 -0
- package/backend/dist/src/llm-orchestration/action-handlers/dto/delete-file.args.dto.js +22 -0
- package/backend/dist/src/llm-orchestration/action-handlers/dto/delete-file.args.dto.js.map +1 -0
- package/backend/dist/src/llm-orchestration/action-handlers/dto/edit-file.args.dto.d.ts +4 -0
- package/backend/dist/src/llm-orchestration/action-handlers/dto/edit-file.args.dto.js +29 -0
- package/backend/dist/src/llm-orchestration/action-handlers/dto/edit-file.args.dto.js.map +1 -0
- package/backend/dist/src/llm-orchestration/action-handlers/dto/final.args.dto.d.ts +3 -0
- package/backend/dist/src/{llm-response-parser/llm-response-parser.module.js → llm-orchestration/action-handlers/dto/final.args.dto.js} +14 -13
- package/backend/dist/src/llm-orchestration/action-handlers/dto/final.args.dto.js.map +1 -0
- package/backend/dist/src/llm-orchestration/action-handlers/dto/new-session.args.dto.d.ts +3 -0
- package/backend/dist/src/llm-orchestration/action-handlers/dto/new-session.args.dto.js +22 -0
- package/backend/dist/src/llm-orchestration/action-handlers/dto/new-session.args.dto.js.map +1 -0
- package/backend/dist/src/llm-orchestration/action-handlers/dto/request-context.args.dto.d.ts +11 -0
- package/backend/dist/src/llm-orchestration/action-handlers/dto/request-context.args.dto.js +50 -0
- package/backend/dist/src/llm-orchestration/action-handlers/dto/request-context.args.dto.js.map +1 -0
- package/backend/dist/src/llm-orchestration/action-handlers/dto/run-command.args.dto.d.ts +4 -0
- package/backend/dist/src/llm-orchestration/action-handlers/dto/run-command.args.dto.js +27 -0
- package/backend/dist/src/llm-orchestration/action-handlers/dto/run-command.args.dto.js.map +1 -0
- package/backend/dist/src/llm-orchestration/action-handlers/dto/sanitizer.decorator.d.ts +1 -0
- package/backend/dist/src/llm-orchestration/action-handlers/dto/sanitizer.decorator.js +15 -0
- package/backend/dist/src/llm-orchestration/action-handlers/dto/sanitizer.decorator.js.map +1 -0
- package/backend/dist/src/llm-orchestration/action-handlers/dto/use-mcp-tool.args.dto.d.ts +5 -0
- package/backend/dist/src/llm-orchestration/action-handlers/dto/use-mcp-tool.args.dto.js +49 -0
- package/backend/dist/src/llm-orchestration/action-handlers/dto/use-mcp-tool.args.dto.js.map +1 -0
- package/backend/dist/src/llm-orchestration/action-handlers/edit-file.handler.d.ts +12 -0
- package/backend/dist/src/llm-orchestration/action-handlers/edit-file.handler.js +78 -0
- package/backend/dist/src/llm-orchestration/action-handlers/edit-file.handler.js.map +1 -0
- package/backend/dist/src/llm-orchestration/action-handlers/final.handler.d.ts +8 -0
- package/backend/dist/src/llm-orchestration/action-handlers/final.handler.js +40 -0
- package/backend/dist/src/llm-orchestration/action-handlers/final.handler.js.map +1 -0
- package/backend/dist/src/llm-orchestration/action-handlers/new-session.handler.d.ts +8 -0
- package/backend/dist/src/llm-orchestration/action-handlers/new-session.handler.js +45 -0
- package/backend/dist/src/llm-orchestration/action-handlers/new-session.handler.js.map +1 -0
- package/backend/dist/src/llm-orchestration/action-handlers/request-context.handler.d.ts +8 -0
- package/backend/dist/src/llm-orchestration/action-handlers/request-context.handler.js +49 -0
- package/backend/dist/src/llm-orchestration/action-handlers/request-context.handler.js.map +1 -0
- package/backend/dist/src/llm-orchestration/action-handlers/run-command.handler.d.ts +10 -0
- package/backend/dist/src/llm-orchestration/action-handlers/run-command.handler.js +73 -0
- package/backend/dist/src/llm-orchestration/action-handlers/run-command.handler.js.map +1 -0
- package/backend/dist/src/llm-orchestration/action-handlers/use-mcp-tool.handler.d.ts +12 -0
- package/backend/dist/src/llm-orchestration/action-handlers/use-mcp-tool.handler.js +61 -0
- package/backend/dist/src/llm-orchestration/action-handlers/use-mcp-tool.handler.js.map +1 -0
- package/backend/dist/src/llm-orchestration/errors/handler-validation.error.d.ts +4 -0
- package/backend/dist/src/llm-orchestration/errors/handler-validation.error.js +12 -0
- package/backend/dist/src/llm-orchestration/errors/handler-validation.error.js.map +1 -0
- package/backend/dist/src/llm-orchestration/hooks/follow-up-post-execution.hook.d.ts +25 -0
- package/backend/dist/src/llm-orchestration/hooks/follow-up-post-execution.hook.js +144 -0
- package/backend/dist/src/llm-orchestration/hooks/follow-up-post-execution.hook.js.map +1 -0
- package/backend/dist/src/llm-orchestration/hooks/frontend-notification.hook.d.ts +10 -0
- package/backend/dist/src/llm-orchestration/hooks/frontend-notification.hook.js +38 -0
- package/backend/dist/src/llm-orchestration/hooks/frontend-notification.hook.js.map +1 -0
- package/backend/dist/src/llm-orchestration/hooks/post-execution-hook.interface.d.ts +5 -0
- package/backend/dist/src/llm-orchestration/hooks/post-execution-hook.interface.js +3 -0
- package/backend/dist/src/llm-orchestration/hooks/post-execution-hook.interface.js.map +1 -0
- package/backend/dist/src/llm-orchestration/hooks/yolo-mode-post-execution.hook.d.ts +12 -0
- package/backend/dist/src/llm-orchestration/hooks/yolo-mode-post-execution.hook.js +55 -0
- package/backend/dist/src/llm-orchestration/hooks/yolo-mode-post-execution.hook.js.map +1 -0
- package/backend/dist/src/llm-orchestration/llm-orchestration.interfaces.d.ts +52 -0
- package/backend/dist/src/llm-orchestration/llm-orchestration.interfaces.js +13 -0
- package/backend/dist/src/llm-orchestration/llm-orchestration.interfaces.js.map +1 -0
- package/backend/dist/src/llm-orchestration/llm-orchestration.module.d.ts +2 -0
- package/backend/dist/src/llm-orchestration/llm-orchestration.module.js +88 -0
- package/backend/dist/src/llm-orchestration/llm-orchestration.module.js.map +1 -0
- package/backend/dist/src/llm-orchestration/llm-turn-processor.service.d.ts +20 -0
- package/backend/dist/src/llm-orchestration/llm-turn-processor.service.js +156 -0
- package/backend/dist/src/llm-orchestration/llm-turn-processor.service.js.map +1 -0
- package/backend/dist/src/llm-orchestration/parser/llm-output-parser.service.d.ts +5 -0
- package/backend/dist/src/llm-orchestration/parser/llm-output-parser.service.js +105 -0
- package/backend/dist/src/llm-orchestration/parser/llm-output-parser.service.js.map +1 -0
- package/backend/dist/src/llm-orchestration/parser/parsing.constants.d.ts +7 -0
- package/backend/dist/src/llm-orchestration/parser/parsing.constants.js +11 -0
- package/backend/dist/src/llm-orchestration/parser/parsing.constants.js.map +1 -0
- package/backend/dist/src/llm-responses/llm-responses.module.js +2 -0
- package/backend/dist/src/llm-responses/llm-responses.module.js.map +1 -1
- package/backend/dist/src/llm-responses/llm-responses.service.d.ts +3 -6
- package/backend/dist/src/llm-responses/llm-responses.service.js +9 -112
- package/backend/dist/src/llm-responses/llm-responses.service.js.map +1 -1
- package/backend/dist/src/seeding/data/system-prompts/carryover-agent.d.ts +1 -1
- package/backend/dist/src/seeding/data/system-prompts/carryover-agent.js +8 -8
- package/backend/dist/src/seeding/data/system-prompts/default_master-agent.d.ts +1 -1
- package/backend/dist/src/seeding/data/system-prompts/default_master-agent.js +77 -87
- package/backend/dist/src/seeding/data/system-prompts/default_master-agent.js.map +1 -1
- package/backend/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/backend/dist/src/action-execution/action-execution.module.d.ts +0 -2
- package/backend/dist/src/action-execution/action-execution.module.js +0 -23
- package/backend/dist/src/action-execution/action-execution.module.js.map +0 -1
- package/backend/dist/src/action-execution/action-execution.service.d.ts +0 -19
- package/backend/dist/src/action-execution/action-execution.service.js +0 -149
- package/backend/dist/src/action-execution/action-execution.service.js.map +0 -1
- package/backend/dist/src/ai-actions/ai-action-creation.service.d.ts +0 -29
- package/backend/dist/src/ai-actions/ai-action-creation.service.js +0 -416
- package/backend/dist/src/ai-actions/ai-action-creation.service.js.map +0 -1
- package/backend/dist/src/llm-response-parser/dto/ai-action.dto.d.ts +0 -30
- package/backend/dist/src/llm-response-parser/dto/ai-action.dto.js +0 -162
- package/backend/dist/src/llm-response-parser/dto/ai-action.dto.js.map +0 -1
- package/backend/dist/src/llm-response-parser/errors/parsing.error.d.ts +0 -4
- package/backend/dist/src/llm-response-parser/errors/parsing.error.js +0 -13
- package/backend/dist/src/llm-response-parser/errors/parsing.error.js.map +0 -1
- package/backend/dist/src/llm-response-parser/llm-response-parser.module.d.ts +0 -2
- package/backend/dist/src/llm-response-parser/llm-response-parser.module.js.map +0 -1
- package/backend/dist/src/llm-response-parser/llm-response-parser.service.d.ts +0 -9
- package/backend/dist/src/llm-response-parser/llm-response-parser.service.js +0 -215
- package/backend/dist/src/llm-response-parser/llm-response-parser.service.js.map +0 -1
- package/backend/dist/src/llm-response-parser/parsing.constants.d.ts +0 -20
- package/backend/dist/src/llm-response-parser/parsing.constants.js +0 -24
- package/backend/dist/src/llm-response-parser/parsing.constants.js.map +0 -1
|
@@ -15,7 +15,6 @@ const core_entities_1 = require("./core-entities");
|
|
|
15
15
|
const projects_module_1 = require("./projects/projects.module");
|
|
16
16
|
const sessions_module_1 = require("./sessions/sessions.module");
|
|
17
17
|
const session_inputs_module_1 = require("./session-inputs/session-inputs.module");
|
|
18
|
-
const llm_response_parser_module_1 = require("./llm-response-parser/llm-response-parser.module");
|
|
19
18
|
const ai_actions_module_1 = require("./ai-actions/ai-actions.module");
|
|
20
19
|
const execution_logs_module_1 = require("./execution-logs/execution-logs.module");
|
|
21
20
|
const context_templates_module_1 = require("./context-templates/context-templates.module");
|
|
@@ -26,7 +25,6 @@ const workspace_module_1 = require("./workspace/workspace.module");
|
|
|
26
25
|
const custom_snippets_module_1 = require("./custom-snippets/custom-snippets.module");
|
|
27
26
|
const path = require("path");
|
|
28
27
|
const fs = require("fs");
|
|
29
|
-
const action_execution_module_1 = require("./action-execution/action-execution.module");
|
|
30
28
|
const session_transfer_module_1 = require("./session-transfer/session-transfer.module");
|
|
31
29
|
const session_followup_module_1 = require("./session-followup/session-followup.module");
|
|
32
30
|
const application_state_module_1 = require("./application-state/application-state.module");
|
|
@@ -77,7 +75,6 @@ exports.AppModule = AppModule = __decorate([
|
|
|
77
75
|
projects_module_1.ProjectsModule,
|
|
78
76
|
sessions_module_1.SessionsModule,
|
|
79
77
|
session_inputs_module_1.SessionInputsModule,
|
|
80
|
-
llm_response_parser_module_1.LlmResponseParserModule,
|
|
81
78
|
ai_actions_module_1.AIActionsModule,
|
|
82
79
|
execution_logs_module_1.ExecutionLogsModule,
|
|
83
80
|
context_templates_module_1.ContextTemplatesModule,
|
|
@@ -86,7 +83,6 @@ exports.AppModule = AppModule = __decorate([
|
|
|
86
83
|
seeding_module_1.SeedingModule,
|
|
87
84
|
workspace_module_1.WorkspaceModule,
|
|
88
85
|
custom_snippets_module_1.CustomSnippetsModule,
|
|
89
|
-
action_execution_module_1.ActionExecutionModule,
|
|
90
86
|
session_transfer_module_1.SessionTransferModule,
|
|
91
87
|
session_followup_module_1.SessionFollowupModule,
|
|
92
88
|
application_state_module_1.ApplicationStateModule,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app.module.js","sourceRoot":"","sources":["../../src/app.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAwC;AACxC,qDAAiD;AACjD,+CAA2C;AAC3C,6CAAgD;AAChD,mDAcyB;AACzB,gEAA4D;AAC5D,gEAA4D;AAC5D,kFAA6E;AAC7E,
|
|
1
|
+
{"version":3,"file":"app.module.js","sourceRoot":"","sources":["../../src/app.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAwC;AACxC,qDAAiD;AACjD,+CAA2C;AAC3C,6CAAgD;AAChD,mDAcyB;AACzB,gEAA4D;AAC5D,gEAA4D;AAC5D,kFAA6E;AAC7E,sEAAiE;AACjE,kFAA6E;AAC7E,2FAAsF;AACtF,8FAAyF;AACzF,kFAA6E;AAC7E,6DAAyD;AACzD,mEAA+D;AAC/D,qFAAgF;AAChF,6BAA6B;AAC7B,yBAAyB;AACzB,wFAAmF;AACnF,wFAAmF;AACnF,2FAAsF;AACtF,+EAA0E;AAC1E,0DAAsD;AACtD,wFAAmF;AACnF,gEAAuE;AACvE,iDAA6C;AAC7C,+EAA0E;AAC1E,wFAAmF;AAEnF,IAAI,MAAM,GAAG,UAAU,CAAC;AAExB,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,EAAE,CAAC;IAC1C,MAAM,WAAW,GAAG,OAAO,CAAC,GAAG,CAAC,qBAAqB,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC;IACvE,MAAM,KAAK,GAAG,IAAI,CAAC,IAAI,CAA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 @@
|
|
|
1
|
+
import { ActionExecutionResult, PlanExecutionContext } from '../llm-orchestration.interfaces';
|
|
2
|
+
export interface ActionHandler {
|
|
3
|
+
readonly toolName: string;
|
|
4
|
+
execute(args: {
|
|
5
|
+
[key: string]: any;
|
|
6
|
+
}, context: PlanExecutionContext): Promise<ActionExecutionResult>;
|
|
7
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"action-handler.interface.js","sourceRoot":"","sources":["../../../../src/llm-orchestration/action-handlers/action-handler.interface.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ActionHandler } from './action-handler.interface';
|
|
2
|
+
import { ActionExecutionResult, PlanExecutionContext } from '../llm-orchestration.interfaces';
|
|
3
|
+
export declare class CreateFileHandler implements ActionHandler {
|
|
4
|
+
readonly toolName = "create_file";
|
|
5
|
+
private readonly logger;
|
|
6
|
+
private readonly projectRoot;
|
|
7
|
+
private resolveAndValidatePath;
|
|
8
|
+
execute(args: {
|
|
9
|
+
[key: string]: any;
|
|
10
|
+
}, _context: PlanExecutionContext): Promise<ActionExecutionResult>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
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 CreateFileHandler_1;
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.CreateFileHandler = void 0;
|
|
11
|
+
const common_1 = require("@nestjs/common");
|
|
12
|
+
const fs = require("fs/promises");
|
|
13
|
+
const path = require("path");
|
|
14
|
+
const class_transformer_1 = require("class-transformer");
|
|
15
|
+
const class_validator_1 = require("class-validator");
|
|
16
|
+
const handler_validation_error_1 = require("../errors/handler-validation.error");
|
|
17
|
+
const create_file_args_dto_1 = require("./dto/create-file.args.dto");
|
|
18
|
+
let CreateFileHandler = CreateFileHandler_1 = class CreateFileHandler {
|
|
19
|
+
constructor() {
|
|
20
|
+
this.toolName = 'create_file';
|
|
21
|
+
this.logger = new common_1.Logger(CreateFileHandler_1.name);
|
|
22
|
+
this.projectRoot = process.env.REPOBURG_PROJECT_PATH || process.cwd();
|
|
23
|
+
}
|
|
24
|
+
resolveAndValidatePath(unsafePath) {
|
|
25
|
+
const normalizedPath = path.normalize(unsafePath);
|
|
26
|
+
if (path.isAbsolute(normalizedPath)) {
|
|
27
|
+
throw new common_1.BadRequestException(`Absolute paths are not allowed: ${unsafePath}`);
|
|
28
|
+
}
|
|
29
|
+
const resolvedPath = path.resolve(this.projectRoot, normalizedPath);
|
|
30
|
+
if (!resolvedPath.startsWith(this.projectRoot)) {
|
|
31
|
+
throw new common_1.BadRequestException(`Path traversal is not allowed: ${unsafePath}`);
|
|
32
|
+
}
|
|
33
|
+
return resolvedPath;
|
|
34
|
+
}
|
|
35
|
+
async execute(args, _context) {
|
|
36
|
+
const validatedArgs = (0, class_transformer_1.plainToClass)(create_file_args_dto_1.CreateFileArgsDto, args);
|
|
37
|
+
const errors = await (0, class_validator_1.validate)(validatedArgs);
|
|
38
|
+
if (errors.length > 0) {
|
|
39
|
+
const errorMessages = errors
|
|
40
|
+
.map((err) => Object.values(err.constraints || {}).join(', '))
|
|
41
|
+
.join('; ');
|
|
42
|
+
throw new handler_validation_error_1.HandlerValidationError(errorMessages);
|
|
43
|
+
}
|
|
44
|
+
const { file_path, content } = validatedArgs;
|
|
45
|
+
const safePath = this.resolveAndValidatePath(file_path);
|
|
46
|
+
try {
|
|
47
|
+
await fs.mkdir(path.dirname(safePath), { recursive: true });
|
|
48
|
+
await fs.writeFile(safePath, content, 'utf8');
|
|
49
|
+
return {
|
|
50
|
+
status: 'SUCCESS',
|
|
51
|
+
summary: `File "${file_path}" created.`,
|
|
52
|
+
persisted_args: { file_path, content },
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
catch (error) {
|
|
56
|
+
this.logger.error(`Failed to create file at ${file_path}: ${error.message}`);
|
|
57
|
+
throw new common_1.InternalServerErrorException(`Failed to create file "${file_path}": ${error.message}`);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
exports.CreateFileHandler = CreateFileHandler;
|
|
62
|
+
exports.CreateFileHandler = CreateFileHandler = CreateFileHandler_1 = __decorate([
|
|
63
|
+
(0, common_1.Injectable)()
|
|
64
|
+
], CreateFileHandler);
|
|
65
|
+
//# sourceMappingURL=create-file.handler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-file.handler.js","sourceRoot":"","sources":["../../../../src/llm-orchestration/action-handlers/create-file.handler.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,2CAKwB;AACxB,kCAAkC;AAClC,6BAA6B;AAC7B,yDAAiD;AACjD,qDAA2C;AAM3C,iFAA4E;AAC5E,qEAA+D;AAGxD,IAAM,iBAAiB,yBAAvB,MAAM,iBAAiB;IAAvB;QACI,aAAQ,GAAG,aAAa,CAAC;QACjB,WAAM,GAAG,IAAI,eAAM,CAAC,mBAAiB,CAAC,IAAI,CAAC,CAAC;QAC5C,gBAAW,GAC1B,OAAO,CAAC,GAAG,CAAC,qBAAqB,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC;IAoDvD,CAAC;IAlDS,sBAAsB,CAAC,UAAkB;QAC/C,MAAM,cAAc,GAAG,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;QAClD,IAAI,IAAI,CAAC,UAAU,CAAC,cAAc,CAA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,MAAM,CAAC,CAAC;YAC9C,OAAO;gBACL,MAAM,EAAE,SAAS;gBACjB,OAAO,EAAE,SAAS,SAAS,YAAY;gBACvC,cAAc,EAAE,EAAE,SAAS,EAAE,OAAO,EAAE;aACvC,CAAC;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,CAAC,MAAM,CAAC,KAAK,CACf,4BAA4B,SAAS,KAAK,KAAK,CAAC,OAAO,EAAE,CAC1D,CAAC;YACF,MAAM,IAAI,qCAA4B,CACpC,0BAA0B,SAAS,MAAM,KAAK,CAAC,OAAO,EAAE,CACzD,CAAC;QACJ,CAAC;IACH,CAAC;CACF,CAAA;AAxDY,8CAAiB;4BAAjB,iBAAiB;IAD7B,IAAA,mBAAU,GAAE;GACA,iBAAiB,CAwD7B"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ActionHandler } from './action-handler.interface';
|
|
2
|
+
import { ActionExecutionResult, PlanExecutionContext } from '../llm-orchestration.interfaces';
|
|
3
|
+
export declare class DeleteFileHandler implements ActionHandler {
|
|
4
|
+
readonly toolName = "delete_file";
|
|
5
|
+
private readonly logger;
|
|
6
|
+
private readonly projectRoot;
|
|
7
|
+
private resolveAndValidatePath;
|
|
8
|
+
private readFileContent;
|
|
9
|
+
execute(args: {
|
|
10
|
+
[key: string]: any;
|
|
11
|
+
}, _context: PlanExecutionContext): Promise<ActionExecutionResult>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
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 DeleteFileHandler_1;
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.DeleteFileHandler = void 0;
|
|
11
|
+
const common_1 = require("@nestjs/common");
|
|
12
|
+
const fs = require("fs/promises");
|
|
13
|
+
const path = require("path");
|
|
14
|
+
const class_transformer_1 = require("class-transformer");
|
|
15
|
+
const class_validator_1 = require("class-validator");
|
|
16
|
+
const handler_validation_error_1 = require("../errors/handler-validation.error");
|
|
17
|
+
const delete_file_args_dto_1 = require("./dto/delete-file.args.dto");
|
|
18
|
+
let DeleteFileHandler = DeleteFileHandler_1 = class DeleteFileHandler {
|
|
19
|
+
constructor() {
|
|
20
|
+
this.toolName = 'delete_file';
|
|
21
|
+
this.logger = new common_1.Logger(DeleteFileHandler_1.name);
|
|
22
|
+
this.projectRoot = process.env.REPOBURG_PROJECT_PATH || process.cwd();
|
|
23
|
+
}
|
|
24
|
+
resolveAndValidatePath(unsafePath) {
|
|
25
|
+
const normalizedPath = path.normalize(unsafePath);
|
|
26
|
+
if (path.isAbsolute(normalizedPath)) {
|
|
27
|
+
throw new common_1.BadRequestException(`Absolute paths are not allowed: ${unsafePath}`);
|
|
28
|
+
}
|
|
29
|
+
const resolvedPath = path.resolve(this.projectRoot, normalizedPath);
|
|
30
|
+
if (!resolvedPath.startsWith(this.projectRoot)) {
|
|
31
|
+
throw new common_1.BadRequestException(`Path traversal is not allowed: ${unsafePath}`);
|
|
32
|
+
}
|
|
33
|
+
return resolvedPath;
|
|
34
|
+
}
|
|
35
|
+
async readFileContent(filePath) {
|
|
36
|
+
try {
|
|
37
|
+
return await fs.readFile(filePath, 'utf8');
|
|
38
|
+
}
|
|
39
|
+
catch (error) {
|
|
40
|
+
if (error.code === 'ENOENT') {
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
throw error;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
async execute(args, _context) {
|
|
47
|
+
const validatedArgs = (0, class_transformer_1.plainToClass)(delete_file_args_dto_1.DeleteFileArgsDto, args);
|
|
48
|
+
const errors = await (0, class_validator_1.validate)(validatedArgs);
|
|
49
|
+
if (errors.length > 0) {
|
|
50
|
+
const errorMessages = errors
|
|
51
|
+
.map((err) => Object.values(err.constraints || {}).join(', '))
|
|
52
|
+
.join('; ');
|
|
53
|
+
throw new handler_validation_error_1.HandlerValidationError(errorMessages);
|
|
54
|
+
}
|
|
55
|
+
const { file_path } = validatedArgs;
|
|
56
|
+
const safePath = this.resolveAndValidatePath(file_path);
|
|
57
|
+
const originalContent = await this.readFileContent(safePath);
|
|
58
|
+
try {
|
|
59
|
+
await fs.unlink(safePath);
|
|
60
|
+
return {
|
|
61
|
+
status: 'SUCCESS',
|
|
62
|
+
summary: `File "${file_path}" deleted.`,
|
|
63
|
+
persisted_args: { file_path },
|
|
64
|
+
original_content_for_revert: originalContent,
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
catch (error) {
|
|
68
|
+
if (error.code === 'ENOENT') {
|
|
69
|
+
return {
|
|
70
|
+
status: 'SUCCESS',
|
|
71
|
+
summary: `File "${file_path}" did not exist, considered deleted.`,
|
|
72
|
+
persisted_args: { file_path },
|
|
73
|
+
original_content_for_revert: null,
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
this.logger.error(`Failed to delete file at ${file_path}: ${error.message}`);
|
|
77
|
+
throw new common_1.InternalServerErrorException(`Failed to delete file "${file_path}": ${error.message}`);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
exports.DeleteFileHandler = DeleteFileHandler;
|
|
82
|
+
exports.DeleteFileHandler = DeleteFileHandler = DeleteFileHandler_1 = __decorate([
|
|
83
|
+
(0, common_1.Injectable)()
|
|
84
|
+
], DeleteFileHandler);
|
|
85
|
+
//# sourceMappingURL=delete-file.handler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delete-file.handler.js","sourceRoot":"","sources":["../../../../src/llm-orchestration/action-handlers/delete-file.handler.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,2CAKwB;AACxB,kCAAkC;AAClC,6BAA6B;AAC7B,yDAAiD;AACjD,qDAA2C;AAM3C,iFAA4E;AAC5E,qEAA+D;AAGxD,IAAM,iBAAiB,yBAAvB,MAAM,iBAAiB;IAAvB;QACI,aAAQ,GAAG,aAAa,CAAC;QACjB,WAAM,GAAG,IAAI,eAAM,CAAC,mBAAiB,CAAC,IAAI,CAAC,CAAC;QAC5C,gBAAW,GAC1B,OAAO,CAAC,GAAG,CAAC,qBAAqB,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC;IAyEvD,CAAC;IAvES,sBAAsB,CAAC,UAAkB;QAC/C,MAAM,cAAc,GAAG,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;QAClD,IAAI,IAAI,CAAC,UAAU,CAAC,cAAc,CAAC,EAAE,CAAC;YACpC,MAAM,IAAI,4BAAmB,CAC3B,mCAAmC,UAAU,EAAE,CAChD,CAAC;QACJ,CAAC;QACD,MAAM,YAAY,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE,cAAc,CAAC,CAAC;QACpE,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,CAAC;YAC/C,MAAM,IAAI,4BAAmB,CAC3B,kCAAkC,UAAU,EAAE,CAC/C,CAAC;QACJ,CAAC;QACD,OAAO,YAAY,CAAC;IACtB,CAAC;IAEO,KAAK,CAAC,eAAe,CAAC,QAAgB;QAC5C,IAAI,CAAC;YACH,OAAO,MAAM,EAAE,CAAC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;QAC7C,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,KAAK,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;g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AAE;oBAC7B,2BAA2B,EAAE,IAAI;iBAClC,CAAC;YACJ,CAAC;YACD,IAAI,CAAC,MAAM,CAAC,KAAK,CACf,4BAA4B,SAAS,KAAK,KAAK,CAAC,OAAO,EAAE,CAC1D,CAAC;YACF,MAAM,IAAI,qCAA4B,CACpC,0BAA0B,SAAS,MAAM,KAAK,CAAC,OAAO,EAAE,CACzD,CAAC;QACJ,CAAC;IACH,CAAC;CACF,CAAA;AA7EY,8CAAiB;4BAAjB,iBAAiB;IAD7B,IAAA,mBAAU,GAAE;GACA,iBAAiB,CA6E7B"}
|
|
@@ -0,0 +1,29 @@
|
|
|
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.CreateFileArgsDto = void 0;
|
|
13
|
+
const class_validator_1 = require("class-validator");
|
|
14
|
+
const sanitizer_decorator_1 = require("./sanitizer.decorator");
|
|
15
|
+
class CreateFileArgsDto {
|
|
16
|
+
}
|
|
17
|
+
exports.CreateFileArgsDto = CreateFileArgsDto;
|
|
18
|
+
__decorate([
|
|
19
|
+
(0, class_validator_1.IsString)({ message: 'file_path must be a string.' }),
|
|
20
|
+
(0, class_validator_1.IsNotEmpty)({ message: 'file_path must not be empty.' }),
|
|
21
|
+
__metadata("design:type", String)
|
|
22
|
+
], CreateFileArgsDto.prototype, "file_path", void 0);
|
|
23
|
+
__decorate([
|
|
24
|
+
(0, sanitizer_decorator_1.SanitizeCodeBlock)(),
|
|
25
|
+
(0, class_validator_1.IsString)({ message: 'content must be a string.' }),
|
|
26
|
+
(0, class_validator_1.IsDefined)({ message: 'content is a required field for creating a file.' }),
|
|
27
|
+
__metadata("design:type", String)
|
|
28
|
+
], CreateFileArgsDto.prototype, "content", void 0);
|
|
29
|
+
//# sourceMappingURL=create-file.args.dto.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-file.args.dto.js","sourceRoot":"","sources":["../../../../../src/llm-orchestration/action-handlers/dto/create-file.args.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAAkE;AAClE,+DAA0D;AAE1D,MAAa,iBAAiB;CAS7B;AATD,8CASC;AANC;IAFC,IAAA,0BAAQ,EAAC,EAAE,OAAO,EAAE,6BAA6B,EAAE,CAAC;IACpD,IAAA,4BAAU,EAAC,EAAE,OAAO,EAAE,8BAA8B,EAAE,CAAC;;oDACtC;AAKlB;IAHC,IAAA,uCAAiB,GAAE;IACnB,IAAA,0BAAQ,EAAC,EAAE,OAAO,EAAE,2BAA2B,EAAE,CAAC;IAClD,IAAA,2BAAS,EAAC,EAAE,OAAO,EAAE,kDAAkD,EAAE,CAAC;;kDAC3D"}
|
|
@@ -0,0 +1,22 @@
|
|
|
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.DeleteFileArgsDto = void 0;
|
|
13
|
+
const class_validator_1 = require("class-validator");
|
|
14
|
+
class DeleteFileArgsDto {
|
|
15
|
+
}
|
|
16
|
+
exports.DeleteFileArgsDto = DeleteFileArgsDto;
|
|
17
|
+
__decorate([
|
|
18
|
+
(0, class_validator_1.IsString)({ message: 'file_path must be a string.' }),
|
|
19
|
+
(0, class_validator_1.IsNotEmpty)({ message: 'file_path must not be empty.' }),
|
|
20
|
+
__metadata("design:type", String)
|
|
21
|
+
], DeleteFileArgsDto.prototype, "file_path", void 0);
|
|
22
|
+
//# sourceMappingURL=delete-file.args.dto.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delete-file.args.dto.js","sourceRoot":"","sources":["../../../../../src/llm-orchestration/action-handlers/dto/delete-file.args.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAAuD;AAEvD,MAAa,iBAAiB;CAI7B;AAJD,8CAIC;AADC;IAFC,IAAA,0BAAQ,EAAC,EAAE,OAAO,EAAE,6BAA6B,EAAE,CAAC;IACpD,IAAA,4BAAU,EAAC,EAAE,OAAO,EAAE,8BAA8B,EAAE,CAAC;;oDACtC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
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.EditFileArgsDto = void 0;
|
|
13
|
+
const class_validator_1 = require("class-validator");
|
|
14
|
+
const sanitizer_decorator_1 = require("./sanitizer.decorator");
|
|
15
|
+
class EditFileArgsDto {
|
|
16
|
+
}
|
|
17
|
+
exports.EditFileArgsDto = EditFileArgsDto;
|
|
18
|
+
__decorate([
|
|
19
|
+
(0, class_validator_1.IsString)({ message: 'file_path must be a string.' }),
|
|
20
|
+
(0, class_validator_1.IsNotEmpty)({ message: 'file_path must not be empty.' }),
|
|
21
|
+
__metadata("design:type", String)
|
|
22
|
+
], EditFileArgsDto.prototype, "file_path", void 0);
|
|
23
|
+
__decorate([
|
|
24
|
+
(0, sanitizer_decorator_1.SanitizeCodeBlock)(),
|
|
25
|
+
(0, class_validator_1.IsString)({ message: 'content must be a string.' }),
|
|
26
|
+
(0, class_validator_1.IsDefined)({ message: 'content is a required field for editing a file.' }),
|
|
27
|
+
__metadata("design:type", String)
|
|
28
|
+
], EditFileArgsDto.prototype, "content", void 0);
|
|
29
|
+
//# sourceMappingURL=edit-file.args.dto.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"edit-file.args.dto.js","sourceRoot":"","sources":["../../../../../src/llm-orchestration/action-handlers/dto/edit-file.args.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAAkE;AAClE,+DAA0D;AAE1D,MAAa,eAAe;CAS3B;AATD,0CASC;AANC;IAFC,IAAA,0BAAQ,EAAC,EAAE,OAAO,EAAE,6BAA6B,EAAE,CAAC;IACpD,IAAA,4BAAU,EAAC,EAAE,OAAO,EAAE,8BAA8B,EAAE,CAAC;;kDACtC;AAKlB;IAHC,IAAA,uCAAiB,GAAE;IACnB,IAAA,0BAAQ,EAAC,EAAE,OAAO,EAAE,2BAA2B,EAAE,CAAC;IAClD,IAAA,2BAAS,EAAC,EAAE,OAAO,EAAE,iDAAiD,EAAE,CAAC;;gDAC1D"}
|
|
@@ -5,17 +5,18 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
5
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
6
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
7
|
};
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const common_1 = require("@nestjs/common");
|
|
11
|
-
const llm_response_parser_service_1 = require("./llm-response-parser.service");
|
|
12
|
-
let LlmResponseParserModule = class LlmResponseParserModule {
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
13
10
|
};
|
|
14
|
-
exports
|
|
15
|
-
exports.
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.FinalArgsDto = void 0;
|
|
13
|
+
const class_validator_1 = require("class-validator");
|
|
14
|
+
class FinalArgsDto {
|
|
15
|
+
}
|
|
16
|
+
exports.FinalArgsDto = FinalArgsDto;
|
|
17
|
+
__decorate([
|
|
18
|
+
(0, class_validator_1.IsOptional)(),
|
|
19
|
+
(0, class_validator_1.IsString)(),
|
|
20
|
+
__metadata("design:type", String)
|
|
21
|
+
], FinalArgsDto.prototype, "plain", void 0);
|
|
22
|
+
//# sourceMappingURL=final.args.dto.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"final.args.dto.js","sourceRoot":"","sources":["../../../../../src/llm-orchestration/action-handlers/dto/final.args.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAAuD;AAEvD,MAAa,YAAY;CAIxB;AAJD,oCAIC;AADC;IAFC,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,GAAE;;2CACI"}
|
|
@@ -0,0 +1,22 @@
|
|
|
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.NewSessionArgsDto = void 0;
|
|
13
|
+
const class_validator_1 = require("class-validator");
|
|
14
|
+
class NewSessionArgsDto {
|
|
15
|
+
}
|
|
16
|
+
exports.NewSessionArgsDto = NewSessionArgsDto;
|
|
17
|
+
__decorate([
|
|
18
|
+
(0, class_validator_1.IsString)({ message: 'handover_string must be a string.' }),
|
|
19
|
+
(0, class_validator_1.IsNotEmpty)({ message: 'handover_string must not be empty.' }),
|
|
20
|
+
__metadata("design:type", String)
|
|
21
|
+
], NewSessionArgsDto.prototype, "handover_string", void 0);
|
|
22
|
+
//# sourceMappingURL=new-session.args.dto.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"new-session.args.dto.js","sourceRoot":"","sources":["../../../../../src/llm-orchestration/action-handlers/dto/new-session.args.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAAuD;AAEvD,MAAa,iBAAiB;CAI7B;AAJD,8CAIC;AADC;IAFC,IAAA,0BAAQ,EAAC,EAAE,OAAO,EAAE,mCAAmC,EAAE,CAAC;IAC1D,IAAA,4BAAU,EAAC,EAAE,OAAO,EAAE,oCAAoC,EAAE,CAAC;;0DACtC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ValidatorConstraintInterface, ValidationArguments } from 'class-validator';
|
|
2
|
+
export declare class IsAtLeastOneOf implements ValidatorConstraintInterface {
|
|
3
|
+
validate(value: any, args: ValidationArguments): boolean;
|
|
4
|
+
defaultMessage(args: ValidationArguments): string;
|
|
5
|
+
}
|
|
6
|
+
export declare class RequestContextArgsDto {
|
|
7
|
+
files?: string;
|
|
8
|
+
folders?: string;
|
|
9
|
+
reason?: string;
|
|
10
|
+
_validation: undefined;
|
|
11
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
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.RequestContextArgsDto = exports.IsAtLeastOneOf = void 0;
|
|
13
|
+
const class_validator_1 = require("class-validator");
|
|
14
|
+
const class_validator_2 = require("class-validator");
|
|
15
|
+
let IsAtLeastOneOf = class IsAtLeastOneOf {
|
|
16
|
+
validate(value, args) {
|
|
17
|
+
const object = args.object;
|
|
18
|
+
return args.constraints.some((prop) => object[prop] !== undefined && object[prop] !== '');
|
|
19
|
+
}
|
|
20
|
+
defaultMessage(args) {
|
|
21
|
+
return `At least one of the following must be provided and not empty: ${args.constraints.join(', ')}.`;
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
exports.IsAtLeastOneOf = IsAtLeastOneOf;
|
|
25
|
+
exports.IsAtLeastOneOf = IsAtLeastOneOf = __decorate([
|
|
26
|
+
(0, class_validator_2.ValidatorConstraint)({ name: 'atLeastOneRequired', async: false })
|
|
27
|
+
], IsAtLeastOneOf);
|
|
28
|
+
class RequestContextArgsDto {
|
|
29
|
+
}
|
|
30
|
+
exports.RequestContextArgsDto = RequestContextArgsDto;
|
|
31
|
+
__decorate([
|
|
32
|
+
(0, class_validator_1.IsOptional)(),
|
|
33
|
+
(0, class_validator_1.IsString)(),
|
|
34
|
+
__metadata("design:type", String)
|
|
35
|
+
], RequestContextArgsDto.prototype, "files", void 0);
|
|
36
|
+
__decorate([
|
|
37
|
+
(0, class_validator_1.IsOptional)(),
|
|
38
|
+
(0, class_validator_1.IsString)(),
|
|
39
|
+
__metadata("design:type", String)
|
|
40
|
+
], RequestContextArgsDto.prototype, "folders", void 0);
|
|
41
|
+
__decorate([
|
|
42
|
+
(0, class_validator_1.IsOptional)(),
|
|
43
|
+
(0, class_validator_1.IsString)(),
|
|
44
|
+
__metadata("design:type", String)
|
|
45
|
+
], RequestContextArgsDto.prototype, "reason", void 0);
|
|
46
|
+
__decorate([
|
|
47
|
+
(0, class_validator_1.Validate)(IsAtLeastOneOf, ['files', 'folders']),
|
|
48
|
+
__metadata("design:type", void 0)
|
|
49
|
+
], RequestContextArgsDto.prototype, "_validation", void 0);
|
|
50
|
+
//# sourceMappingURL=request-context.args.dto.js.map
|
package/backend/dist/src/llm-orchestration/action-handlers/dto/request-context.args.dto.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"request-context.args.dto.js","sourceRoot":"","sources":["../../../../../src/llm-orchestration/action-handlers/dto/request-context.args.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAAiE;AACjE,qDAIyB;AAGlB,IAAM,cAAc,GAApB,MAAM,cAAc;IACzB,QAAQ,CAAC,KAAU,EAAE,IAAyB;QAC5C,MAAM,MAAM,GAAG,IAAI,CAAC,MAAa,CAAC;QAElC,OAAO,IAAI,CAAC,WAAW,CAAC,IAAI,CAC1B,CAAC,IAAY,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,SAAS,IAAI,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,CACpE,CAAC;IACJ,CAAC;IAED,cAAc,CAAC,IAAyB;QACtC,OAAO,iEAAiE,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC;IACzG,CAAC;CACF,CAAA;AAZY,wCAAc;yBAAd,cAAc;IAD1B,IAAA,qCAAmB,EAAC,EAAE,IAAI,EAAE,oBAAoB,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC;GACrD,cAAc,CAY1B;AAED,MAAa,qBAAqB;CAgBjC;AAhBD,sDAgBC;AAbC;IAFC,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,GAAE;;oDACI;AAIf;IAFC,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,GAAE;;sDACM;AAIjB;IAFC,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,GAAE;;qDACK;AAIhB;IADC,IAAA,0BAAQ,EAAC,cAAc,EAAE,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;;0DACxB"}
|
|
@@ -0,0 +1,27 @@
|
|
|
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.RunCommandArgsDto = void 0;
|
|
13
|
+
const class_validator_1 = require("class-validator");
|
|
14
|
+
class RunCommandArgsDto {
|
|
15
|
+
}
|
|
16
|
+
exports.RunCommandArgsDto = RunCommandArgsDto;
|
|
17
|
+
__decorate([
|
|
18
|
+
(0, class_validator_1.IsString)({ message: 'command_string must be a string.' }),
|
|
19
|
+
(0, class_validator_1.IsNotEmpty)({ message: 'command_string must not be empty.' }),
|
|
20
|
+
__metadata("design:type", String)
|
|
21
|
+
], RunCommandArgsDto.prototype, "command_string", void 0);
|
|
22
|
+
__decorate([
|
|
23
|
+
(0, class_validator_1.IsOptional)(),
|
|
24
|
+
(0, class_validator_1.IsString)({ message: 'reason must be a string.' }),
|
|
25
|
+
__metadata("design:type", String)
|
|
26
|
+
], RunCommandArgsDto.prototype, "reason", void 0);
|
|
27
|
+
//# sourceMappingURL=run-command.args.dto.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run-command.args.dto.js","sourceRoot":"","sources":["../../../../../src/llm-orchestration/action-handlers/dto/run-command.args.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAAmE;AAEnE,MAAa,iBAAiB;CAQ7B;AARD,8CAQC;AALC;IAFC,IAAA,0BAAQ,EAAC,EAAE,OAAO,EAAE,kCAAkC,EAAE,CAAC;IACzD,IAAA,4BAAU,EAAC,EAAE,OAAO,EAAE,mCAAmC,EAAE,CAAC;;yDACtC;AAIvB;IAFC,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,EAAC,EAAE,OAAO,EAAE,0BAA0B,EAAE,CAAC;;iDAClC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function SanitizeCodeBlock(): PropertyDecorator;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SanitizeCodeBlock = SanitizeCodeBlock;
|
|
4
|
+
const class_transformer_1 = require("class-transformer");
|
|
5
|
+
function SanitizeCodeBlock() {
|
|
6
|
+
return (0, class_transformer_1.Transform)(({ value }) => {
|
|
7
|
+
if (typeof value !== 'string') {
|
|
8
|
+
return value;
|
|
9
|
+
}
|
|
10
|
+
const trimmedValue = value.trim();
|
|
11
|
+
const codeMatch = trimmedValue.match(/^```(?:\w*\n)?([\s\S]*)```$/);
|
|
12
|
+
return codeMatch ? codeMatch[1].trim() : trimmedValue;
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=sanitizer.decorator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sanitizer.decorator.js","sourceRoot":"","sources":["../../../../../src/llm-orchestration/action-handlers/dto/sanitizer.decorator.ts"],"names":[],"mappings":";;AAgBA,8CAeC;AA/BD,yDAA8C;AAgB9C,SAAgB,iBAAiB;IAC/B,OAAO,IAAA,6BAAS,EAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE;QAC7B,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;YAC9B,OAAO,KAAK,CAAC;QACf,CAAC;QAED,MAAM,YAAY,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC;QAGlC,MAAM,SAAS,GAAG,YAAY,CAAC,KAAK,CAAC,6BAA6B,CAAC,CAAC;QAIpE,OAAO,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,YAAY,CAAC;IACxD,CAAC,CAAC,CAAC;AACL,CAAC"}
|