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.
Files changed (131) hide show
  1. package/CODEMAP.md +5 -6
  2. package/backend/.env +4 -0
  3. package/backend/dist/src/ai-actions/ai-action-batch.service.d.ts +10 -3
  4. package/backend/dist/src/ai-actions/ai-action-batch.service.js +134 -12
  5. package/backend/dist/src/ai-actions/ai-action-batch.service.js.map +1 -1
  6. package/backend/dist/src/ai-actions/ai-actions.module.js +2 -7
  7. package/backend/dist/src/ai-actions/ai-actions.module.js.map +1 -1
  8. package/backend/dist/src/ai-actions/ai-actions.service.d.ts +16 -3
  9. package/backend/dist/src/ai-actions/ai-actions.service.js +75 -11
  10. package/backend/dist/src/ai-actions/ai-actions.service.js.map +1 -1
  11. package/backend/dist/src/app.module.js +0 -4
  12. package/backend/dist/src/app.module.js.map +1 -1
  13. package/backend/dist/src/llm-orchestration/action-handlers/action-handler.interface.d.ts +7 -0
  14. package/backend/dist/src/llm-orchestration/action-handlers/action-handler.interface.js +3 -0
  15. package/backend/dist/src/llm-orchestration/action-handlers/action-handler.interface.js.map +1 -0
  16. package/backend/dist/src/llm-orchestration/action-handlers/create-file.handler.d.ts +11 -0
  17. package/backend/dist/src/llm-orchestration/action-handlers/create-file.handler.js +65 -0
  18. package/backend/dist/src/llm-orchestration/action-handlers/create-file.handler.js.map +1 -0
  19. package/backend/dist/src/llm-orchestration/action-handlers/delete-file.handler.d.ts +12 -0
  20. package/backend/dist/src/llm-orchestration/action-handlers/delete-file.handler.js +85 -0
  21. package/backend/dist/src/llm-orchestration/action-handlers/delete-file.handler.js.map +1 -0
  22. package/backend/dist/src/llm-orchestration/action-handlers/dto/create-file.args.dto.d.ts +4 -0
  23. package/backend/dist/src/llm-orchestration/action-handlers/dto/create-file.args.dto.js +29 -0
  24. package/backend/dist/src/llm-orchestration/action-handlers/dto/create-file.args.dto.js.map +1 -0
  25. package/backend/dist/src/llm-orchestration/action-handlers/dto/delete-file.args.dto.d.ts +3 -0
  26. package/backend/dist/src/llm-orchestration/action-handlers/dto/delete-file.args.dto.js +22 -0
  27. package/backend/dist/src/llm-orchestration/action-handlers/dto/delete-file.args.dto.js.map +1 -0
  28. package/backend/dist/src/llm-orchestration/action-handlers/dto/edit-file.args.dto.d.ts +4 -0
  29. package/backend/dist/src/llm-orchestration/action-handlers/dto/edit-file.args.dto.js +29 -0
  30. package/backend/dist/src/llm-orchestration/action-handlers/dto/edit-file.args.dto.js.map +1 -0
  31. package/backend/dist/src/llm-orchestration/action-handlers/dto/final.args.dto.d.ts +3 -0
  32. package/backend/dist/src/{llm-response-parser/llm-response-parser.module.js → llm-orchestration/action-handlers/dto/final.args.dto.js} +14 -13
  33. package/backend/dist/src/llm-orchestration/action-handlers/dto/final.args.dto.js.map +1 -0
  34. package/backend/dist/src/llm-orchestration/action-handlers/dto/new-session.args.dto.d.ts +3 -0
  35. package/backend/dist/src/llm-orchestration/action-handlers/dto/new-session.args.dto.js +22 -0
  36. package/backend/dist/src/llm-orchestration/action-handlers/dto/new-session.args.dto.js.map +1 -0
  37. package/backend/dist/src/llm-orchestration/action-handlers/dto/request-context.args.dto.d.ts +11 -0
  38. package/backend/dist/src/llm-orchestration/action-handlers/dto/request-context.args.dto.js +50 -0
  39. package/backend/dist/src/llm-orchestration/action-handlers/dto/request-context.args.dto.js.map +1 -0
  40. package/backend/dist/src/llm-orchestration/action-handlers/dto/run-command.args.dto.d.ts +4 -0
  41. package/backend/dist/src/llm-orchestration/action-handlers/dto/run-command.args.dto.js +27 -0
  42. package/backend/dist/src/llm-orchestration/action-handlers/dto/run-command.args.dto.js.map +1 -0
  43. package/backend/dist/src/llm-orchestration/action-handlers/dto/sanitizer.decorator.d.ts +1 -0
  44. package/backend/dist/src/llm-orchestration/action-handlers/dto/sanitizer.decorator.js +15 -0
  45. package/backend/dist/src/llm-orchestration/action-handlers/dto/sanitizer.decorator.js.map +1 -0
  46. package/backend/dist/src/llm-orchestration/action-handlers/dto/use-mcp-tool.args.dto.d.ts +5 -0
  47. package/backend/dist/src/llm-orchestration/action-handlers/dto/use-mcp-tool.args.dto.js +49 -0
  48. package/backend/dist/src/llm-orchestration/action-handlers/dto/use-mcp-tool.args.dto.js.map +1 -0
  49. package/backend/dist/src/llm-orchestration/action-handlers/edit-file.handler.d.ts +12 -0
  50. package/backend/dist/src/llm-orchestration/action-handlers/edit-file.handler.js +78 -0
  51. package/backend/dist/src/llm-orchestration/action-handlers/edit-file.handler.js.map +1 -0
  52. package/backend/dist/src/llm-orchestration/action-handlers/final.handler.d.ts +8 -0
  53. package/backend/dist/src/llm-orchestration/action-handlers/final.handler.js +40 -0
  54. package/backend/dist/src/llm-orchestration/action-handlers/final.handler.js.map +1 -0
  55. package/backend/dist/src/llm-orchestration/action-handlers/new-session.handler.d.ts +8 -0
  56. package/backend/dist/src/llm-orchestration/action-handlers/new-session.handler.js +45 -0
  57. package/backend/dist/src/llm-orchestration/action-handlers/new-session.handler.js.map +1 -0
  58. package/backend/dist/src/llm-orchestration/action-handlers/request-context.handler.d.ts +8 -0
  59. package/backend/dist/src/llm-orchestration/action-handlers/request-context.handler.js +49 -0
  60. package/backend/dist/src/llm-orchestration/action-handlers/request-context.handler.js.map +1 -0
  61. package/backend/dist/src/llm-orchestration/action-handlers/run-command.handler.d.ts +10 -0
  62. package/backend/dist/src/llm-orchestration/action-handlers/run-command.handler.js +73 -0
  63. package/backend/dist/src/llm-orchestration/action-handlers/run-command.handler.js.map +1 -0
  64. package/backend/dist/src/llm-orchestration/action-handlers/use-mcp-tool.handler.d.ts +12 -0
  65. package/backend/dist/src/llm-orchestration/action-handlers/use-mcp-tool.handler.js +61 -0
  66. package/backend/dist/src/llm-orchestration/action-handlers/use-mcp-tool.handler.js.map +1 -0
  67. package/backend/dist/src/llm-orchestration/errors/handler-validation.error.d.ts +4 -0
  68. package/backend/dist/src/llm-orchestration/errors/handler-validation.error.js +12 -0
  69. package/backend/dist/src/llm-orchestration/errors/handler-validation.error.js.map +1 -0
  70. package/backend/dist/src/llm-orchestration/hooks/follow-up-post-execution.hook.d.ts +25 -0
  71. package/backend/dist/src/llm-orchestration/hooks/follow-up-post-execution.hook.js +144 -0
  72. package/backend/dist/src/llm-orchestration/hooks/follow-up-post-execution.hook.js.map +1 -0
  73. package/backend/dist/src/llm-orchestration/hooks/frontend-notification.hook.d.ts +10 -0
  74. package/backend/dist/src/llm-orchestration/hooks/frontend-notification.hook.js +38 -0
  75. package/backend/dist/src/llm-orchestration/hooks/frontend-notification.hook.js.map +1 -0
  76. package/backend/dist/src/llm-orchestration/hooks/post-execution-hook.interface.d.ts +5 -0
  77. package/backend/dist/src/llm-orchestration/hooks/post-execution-hook.interface.js +3 -0
  78. package/backend/dist/src/llm-orchestration/hooks/post-execution-hook.interface.js.map +1 -0
  79. package/backend/dist/src/llm-orchestration/hooks/yolo-mode-post-execution.hook.d.ts +12 -0
  80. package/backend/dist/src/llm-orchestration/hooks/yolo-mode-post-execution.hook.js +55 -0
  81. package/backend/dist/src/llm-orchestration/hooks/yolo-mode-post-execution.hook.js.map +1 -0
  82. package/backend/dist/src/llm-orchestration/llm-orchestration.interfaces.d.ts +52 -0
  83. package/backend/dist/src/llm-orchestration/llm-orchestration.interfaces.js +13 -0
  84. package/backend/dist/src/llm-orchestration/llm-orchestration.interfaces.js.map +1 -0
  85. package/backend/dist/src/llm-orchestration/llm-orchestration.module.d.ts +2 -0
  86. package/backend/dist/src/llm-orchestration/llm-orchestration.module.js +88 -0
  87. package/backend/dist/src/llm-orchestration/llm-orchestration.module.js.map +1 -0
  88. package/backend/dist/src/llm-orchestration/llm-turn-processor.service.d.ts +20 -0
  89. package/backend/dist/src/llm-orchestration/llm-turn-processor.service.js +156 -0
  90. package/backend/dist/src/llm-orchestration/llm-turn-processor.service.js.map +1 -0
  91. package/backend/dist/src/llm-orchestration/parser/llm-output-parser.service.d.ts +5 -0
  92. package/backend/dist/src/llm-orchestration/parser/llm-output-parser.service.js +105 -0
  93. package/backend/dist/src/llm-orchestration/parser/llm-output-parser.service.js.map +1 -0
  94. package/backend/dist/src/llm-orchestration/parser/parsing.constants.d.ts +7 -0
  95. package/backend/dist/src/llm-orchestration/parser/parsing.constants.js +11 -0
  96. package/backend/dist/src/llm-orchestration/parser/parsing.constants.js.map +1 -0
  97. package/backend/dist/src/llm-responses/llm-responses.module.js +2 -0
  98. package/backend/dist/src/llm-responses/llm-responses.module.js.map +1 -1
  99. package/backend/dist/src/llm-responses/llm-responses.service.d.ts +3 -6
  100. package/backend/dist/src/llm-responses/llm-responses.service.js +9 -112
  101. package/backend/dist/src/llm-responses/llm-responses.service.js.map +1 -1
  102. package/backend/dist/src/seeding/data/system-prompts/carryover-agent.d.ts +1 -1
  103. package/backend/dist/src/seeding/data/system-prompts/carryover-agent.js +8 -8
  104. package/backend/dist/src/seeding/data/system-prompts/default_master-agent.d.ts +1 -1
  105. package/backend/dist/src/seeding/data/system-prompts/default_master-agent.js +77 -87
  106. package/backend/dist/src/seeding/data/system-prompts/default_master-agent.js.map +1 -1
  107. package/backend/dist/tsconfig.build.tsbuildinfo +1 -1
  108. package/package.json +1 -1
  109. package/backend/dist/src/action-execution/action-execution.module.d.ts +0 -2
  110. package/backend/dist/src/action-execution/action-execution.module.js +0 -23
  111. package/backend/dist/src/action-execution/action-execution.module.js.map +0 -1
  112. package/backend/dist/src/action-execution/action-execution.service.d.ts +0 -19
  113. package/backend/dist/src/action-execution/action-execution.service.js +0 -149
  114. package/backend/dist/src/action-execution/action-execution.service.js.map +0 -1
  115. package/backend/dist/src/ai-actions/ai-action-creation.service.d.ts +0 -29
  116. package/backend/dist/src/ai-actions/ai-action-creation.service.js +0 -416
  117. package/backend/dist/src/ai-actions/ai-action-creation.service.js.map +0 -1
  118. package/backend/dist/src/llm-response-parser/dto/ai-action.dto.d.ts +0 -30
  119. package/backend/dist/src/llm-response-parser/dto/ai-action.dto.js +0 -162
  120. package/backend/dist/src/llm-response-parser/dto/ai-action.dto.js.map +0 -1
  121. package/backend/dist/src/llm-response-parser/errors/parsing.error.d.ts +0 -4
  122. package/backend/dist/src/llm-response-parser/errors/parsing.error.js +0 -13
  123. package/backend/dist/src/llm-response-parser/errors/parsing.error.js.map +0 -1
  124. package/backend/dist/src/llm-response-parser/llm-response-parser.module.d.ts +0 -2
  125. package/backend/dist/src/llm-response-parser/llm-response-parser.module.js.map +0 -1
  126. package/backend/dist/src/llm-response-parser/llm-response-parser.service.d.ts +0 -9
  127. package/backend/dist/src/llm-response-parser/llm-response-parser.service.js +0 -215
  128. package/backend/dist/src/llm-response-parser/llm-response-parser.service.js.map +0 -1
  129. package/backend/dist/src/llm-response-parser/parsing.constants.d.ts +0 -20
  130. package/backend/dist/src/llm-response-parser/parsing.constants.js +0 -24
  131. package/backend/dist/src/llm-response-parser/parsing.constants.js.map +0 -1
@@ -1,416 +0,0 @@
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
- var __param = (this && this.__param) || function (paramIndex, decorator) {
12
- return function (target, key) { decorator(target, key, paramIndex); }
13
- };
14
- var AIActionCreationService_1;
15
- Object.defineProperty(exports, "__esModule", { value: true });
16
- exports.AIActionCreationService = void 0;
17
- const common_1 = require("@nestjs/common");
18
- const typeorm_1 = require("@nestjs/typeorm");
19
- const typeorm_2 = require("typeorm");
20
- const fs = require("fs/promises");
21
- const core_entities_1 = require("../core-entities");
22
- const llm_response_parser_service_1 = require("../llm-response-parser/llm-response-parser.service");
23
- const execution_logs_service_1 = require("../execution-logs/execution-logs.service");
24
- const ai_action_dto_1 = require("../llm-response-parser/dto/ai-action.dto");
25
- const ai_actions_service_1 = require("./ai-actions.service");
26
- const action_execution_service_1 = require("../action-execution/action-execution.service");
27
- const application_state_service_1 = require("../application-state/application-state.service");
28
- const chat_service_1 = require("../interactive-chat/chat.service");
29
- const llm_responses_service_1 = require("../llm-responses/llm-responses.service");
30
- let AIActionCreationService = AIActionCreationService_1 = class AIActionCreationService {
31
- constructor(aiActionsRepository, sessionInputsRepository, llmResponseParserService, executionLogsService, actionExecutionService, applicationStateService, chatService, llmResponsesService) {
32
- this.aiActionsRepository = aiActionsRepository;
33
- this.sessionInputsRepository = sessionInputsRepository;
34
- this.llmResponseParserService = llmResponseParserService;
35
- this.executionLogsService = executionLogsService;
36
- this.actionExecutionService = actionExecutionService;
37
- this.applicationStateService = applicationStateService;
38
- this.chatService = chatService;
39
- this.llmResponsesService = llmResponsesService;
40
- this.logger = new common_1.Logger(AIActionCreationService_1.name);
41
- }
42
- async handleYoloMode(sessionInput, actionDtos) {
43
- const isYoloMode = await this.applicationStateService.getYoloModeEnabled();
44
- if (!isYoloMode) {
45
- return;
46
- }
47
- this.logger.log(`YOLO mode is active for session ${sessionInput.session_id}.`);
48
- const hasFinalAction = actionDtos.some((dto) => dto.action_type === ai_action_dto_1.AIActionType.FINAL);
49
- if (hasFinalAction) {
50
- this.logger.log('YOLO mode: "final" action detected. Disabling YOLO mode.');
51
- await this.applicationStateService.setYoloModeEnabled(false);
52
- return;
53
- }
54
- const hasFileModification = actionDtos.some((dto) => [
55
- ai_action_dto_1.AIActionType.CREATE_FILE,
56
- ai_action_dto_1.AIActionType.EDIT_FILE,
57
- ai_action_dto_1.AIActionType.DELETE_FILE,
58
- ].includes(dto.action_type));
59
- if (hasFileModification) {
60
- this.logger.log('YOLO mode: File modification detected. Triggering "yolo" prompt via ChatService.');
61
- const isManualFlow = await this.applicationStateService.getManualLlmEnabled();
62
- this.chatService
63
- .sendMessage(sessionInput.session_id, 'yolo', isManualFlow)
64
- .catch((err) => {
65
- this.logger.error(`YOLO mode failed to send "yolo" message: ${err.message}`);
66
- });
67
- }
68
- }
69
- async handleRequestContext(sessionInput, actionDtos) {
70
- const requestContextDto = actionDtos.find((d) => d.action_type === ai_action_dto_1.AIActionType.REQUEST_CONTEXT);
71
- if (requestContextDto) {
72
- if (actionDtos.length > 1) {
73
- this.logger.warn(`Request context action found with other actions for input ${sessionInput.id}. Only the context request will be processed.`);
74
- }
75
- const newAction = this.aiActionsRepository.create({
76
- sessionInput: { id: sessionInput.id },
77
- input_id: sessionInput.id,
78
- action_type: requestContextDto.action_type,
79
- files: requestContextDto.files,
80
- folders: requestContextDto.folders,
81
- reason: requestContextDto.reason,
82
- order_of_execution: requestContextDto.order_of_execution ?? 0,
83
- status: ai_actions_service_1.AIActionStatus.AWAITING_CONTEXT,
84
- });
85
- const savedAction = await this.aiActionsRepository.save(newAction);
86
- this.logger.log(`Created context request action for SessionInput ID ${sessionInput.id}.`);
87
- return [savedAction];
88
- }
89
- return null;
90
- }
91
- async handleNewSession(sessionInput, actionDtos) {
92
- const newSessionDto = actionDtos.find((d) => d.action_type === ai_action_dto_1.AIActionType.NEW_SESSION);
93
- if (newSessionDto) {
94
- if (actionDtos.length > 1) {
95
- this.logger.warn(`New session action found with other actions for input ${sessionInput.id}. Only the new session action will be processed.`);
96
- }
97
- const newAction = this.aiActionsRepository.create({
98
- sessionInput: { id: sessionInput.id },
99
- input_id: sessionInput.id,
100
- action_type: newSessionDto.action_type,
101
- handover_string: newSessionDto.handover_string,
102
- order_of_execution: newSessionDto.order_of_execution ?? 0,
103
- status: ai_actions_service_1.AIActionStatus.AWAITING_HANDOVER,
104
- });
105
- const savedAction = await this.aiActionsRepository.save(newAction);
106
- this.logger.log(`Created new session action for SessionInput ID ${sessionInput.id}.`);
107
- return [savedAction];
108
- }
109
- return null;
110
- }
111
- async createActionsFromLlmResponse(sessionInput, initialStatus) {
112
- if (!sessionInput.raw_llm_response) {
113
- this.logger.warn(`No raw_llm_response in SessionInput ID ${sessionInput.id}. Cannot create actions.`);
114
- return [];
115
- }
116
- const { dtos: actionDtos, explanation } = await this.llmResponseParserService.parse(sessionInput.raw_llm_response);
117
- this.handleYoloMode(sessionInput, actionDtos);
118
- if (explanation && explanation !== sessionInput.llm_response_explanation) {
119
- sessionInput.llm_response_explanation = explanation;
120
- await this.sessionInputsRepository.save(sessionInput);
121
- }
122
- const contextRequestResult = await this.handleRequestContext(sessionInput, actionDtos);
123
- if (contextRequestResult) {
124
- return contextRequestResult;
125
- }
126
- const newSessionResult = await this.handleNewSession(sessionInput, actionDtos);
127
- if (newSessionResult) {
128
- return newSessionResult;
129
- }
130
- const createdActions = [];
131
- for (const dto of actionDtos) {
132
- const newAction = this.aiActionsRepository.create({
133
- sessionInput: { id: sessionInput.id },
134
- input_id: sessionInput.id,
135
- action_type: dto.action_type,
136
- file_path: dto.file_path,
137
- content: dto.content,
138
- command_string: dto.command_string,
139
- files: dto.files,
140
- folders: dto.folders,
141
- reason: dto.reason,
142
- handover_string: dto.handover_string,
143
- order_of_execution: dto.order_of_execution ?? 0,
144
- status: initialStatus,
145
- original_content_for_revert: null,
146
- server_name: dto.server_name,
147
- tool_name: dto.tool_name,
148
- arguments: dto.arguments ? JSON.stringify(dto.arguments) : undefined,
149
- });
150
- const savedAction = await this.aiActionsRepository.save(newAction);
151
- createdActions.push(savedAction);
152
- }
153
- this.logger.log(`Created ${createdActions.length} actions for SessionInput ID ${sessionInput.id} with status ${initialStatus}.`);
154
- return createdActions;
155
- }
156
- async readFileContent(filePath) {
157
- if (!filePath) {
158
- return null;
159
- }
160
- try {
161
- return await fs.readFile(filePath, 'utf8');
162
- }
163
- catch (error) {
164
- if (error.code === 'ENOENT') {
165
- this.logger.log(`File not found when reading for revert: ${filePath}`);
166
- return null;
167
- }
168
- this.logger.error(`Error reading file ${filePath} for revert: ${error.message}`);
169
- return null;
170
- }
171
- }
172
- async createAndTentativelyApplyActions(sessionInput) {
173
- if (!sessionInput.raw_llm_response) {
174
- this.logger.warn(`No raw_llm_response in SessionInput ID ${sessionInput.id}. Cannot create/apply actions.`);
175
- return [];
176
- }
177
- const { dtos: actionDtos, explanation } = await this.llmResponseParserService.parse(sessionInput.raw_llm_response);
178
- this.handleYoloMode(sessionInput, actionDtos);
179
- if (explanation && explanation !== sessionInput.llm_response_explanation) {
180
- sessionInput.llm_response_explanation = explanation;
181
- await this.sessionInputsRepository.save(sessionInput);
182
- }
183
- const contextRequestResult = await this.handleRequestContext(sessionInput, actionDtos);
184
- if (contextRequestResult) {
185
- return contextRequestResult;
186
- }
187
- const newSessionResult = await this.handleNewSession(sessionInput, actionDtos);
188
- if (newSessionResult) {
189
- return newSessionResult;
190
- }
191
- const processedAIActions = [];
192
- for (const dto of actionDtos) {
193
- const action = this.aiActionsRepository.create({
194
- sessionInput: { id: sessionInput.id },
195
- input_id: sessionInput.id,
196
- action_type: dto.action_type,
197
- file_path: dto.file_path,
198
- content: dto.content,
199
- command_string: dto.command_string,
200
- files: dto.files,
201
- folders: dto.folders,
202
- reason: dto.reason,
203
- handover_string: dto.handover_string,
204
- order_of_execution: dto.order_of_execution ?? 0,
205
- server_name: dto.server_name,
206
- tool_name: dto.tool_name,
207
- arguments: dto.arguments ? JSON.stringify(dto.arguments) : undefined,
208
- });
209
- if (dto.action_type === 'edit_file' ||
210
- dto.action_type === 'delete_file') {
211
- action.original_content_for_revert = await this.readFileContent(dto.file_path);
212
- }
213
- let actionSucceeded = false;
214
- let outcomeMessage = `Action type: ${action.action_type}`;
215
- let errorMessage = undefined;
216
- try {
217
- this.logger.log(`Tentatively applying action for SessionInput ${sessionInput.id}, type ${action.action_type}, target ${action.file_path || action.command_string}`);
218
- switch (action.action_type) {
219
- case 'create_file':
220
- if (!action.file_path || action.content === null)
221
- throw new Error('Missing file_path or content for create_file.');
222
- await this.actionExecutionService.createFile(action.file_path, action.content);
223
- outcomeMessage = `File "${action.file_path}" created.`;
224
- break;
225
- case 'edit_file':
226
- if (!action.file_path || action.content === null)
227
- throw new Error('Missing file_path or content for edit_file.');
228
- await this.actionExecutionService.editFile(action.file_path, action.content);
229
- outcomeMessage = `File "${action.file_path}" edited.`;
230
- break;
231
- case 'delete_file':
232
- if (!action.file_path)
233
- throw new Error('Missing file_path for delete_file.');
234
- try {
235
- await this.actionExecutionService.deleteFile(action.file_path);
236
- outcomeMessage = `File "${action.file_path}" deleted.`;
237
- }
238
- catch (delError) {
239
- if (delError instanceof common_1.NotFoundException) {
240
- outcomeMessage = `File "${action.file_path}" not found, considered deleted.`;
241
- }
242
- else {
243
- throw delError;
244
- }
245
- }
246
- break;
247
- case 'run_command': {
248
- if (!action.command_string)
249
- throw new Error('Missing command_string for run_command.');
250
- const cmdResult = await this.actionExecutionService.runCommand(action.command_string);
251
- outcomeMessage = `Command "${action.command_string}" executed. Output: ${cmdResult.stdout || '(no stdout)'}`;
252
- if (cmdResult.stderr)
253
- outcomeMessage += `\nStderr: ${cmdResult.stderr}`;
254
- const isManualFlow = await this.applicationStateService.getManualLlmEnabled();
255
- const message = `The previous 'run_command' action produced this output. Please analyze it and continue with the next logical step based on the original request. Do not just describe the output; use it to proceed.\n\nOUTPUT:\n${cmdResult.stdout}`;
256
- this.chatService
257
- .sendMessage(sessionInput.session_id, message, isManualFlow)
258
- .catch((err) => {
259
- this.logger.error(`Follow-up LLM call from run_command failed: ${err.message}`, err.stack);
260
- });
261
- break;
262
- }
263
- case 'use_mcp_tool': {
264
- if (!action.server_name || !action.tool_name || !action.arguments)
265
- throw new Error('Missing server_name, tool_name, or arguments for use_mcp_tool.');
266
- const toolResult = await this.actionExecutionService.useMcpTool(action.server_name, action.tool_name, JSON.parse(action.arguments));
267
- outcomeMessage = `MCP Tool "${action.server_name}.${action.tool_name}" executed. Output: ${toolResult.stdout || '(no stdout)'}`;
268
- if (toolResult.stderr)
269
- outcomeMessage += `\nStderr: ${toolResult.stderr}`;
270
- const isManualFlow = await this.applicationStateService.getManualLlmEnabled();
271
- const message = `The previous 'use_mcp_tool' action produced this output. Please analyze it and continue with the next logical step based on the original request. Do not just describe the output; use it to proceed.\n\nOUTPUT:\n${toolResult.stdout}`;
272
- this.chatService
273
- .sendMessage(sessionInput.session_id, message, isManualFlow)
274
- .catch((err) => {
275
- this.logger.error(`Follow-up LLM call from use_mcp_tool failed: ${err.message}`, err.stack);
276
- });
277
- break;
278
- }
279
- default:
280
- throw new Error(`Unsupported action_type: "${action.action_type}"`);
281
- }
282
- action.status = ai_actions_service_1.AIActionStatus.APPLIED_PENDING_REVIEW;
283
- actionSucceeded = true;
284
- this.logger.log(`Action (input ${sessionInput.id}, type ${action.action_type}) tentatively applied successfully. Status: ${action.status}`);
285
- }
286
- catch (error) {
287
- action.status = ai_actions_service_1.AIActionStatus.EXECUTION_FAILED;
288
- errorMessage = error.message;
289
- outcomeMessage = `Failed tentative application: ${error.message}`;
290
- this.logger.error(`Failed tentatively applying action (input ${sessionInput.id}, type ${action.action_type}): ${errorMessage}`, error.stack);
291
- }
292
- const savedAction = await this.aiActionsRepository.save(action);
293
- const log = await this.executionLogsService.createLog({
294
- action_id: savedAction.id,
295
- output: actionSucceeded ? outcomeMessage : undefined,
296
- error_message: errorMessage,
297
- });
298
- savedAction.executionLogs = [log];
299
- processedAIActions.push(savedAction);
300
- }
301
- this.logger.log(`Created and tentatively processed ${processedAIActions.length} actions for SessionInput ID ${sessionInput.id}.`);
302
- return processedAIActions;
303
- }
304
- async createAndAutoApplyActions(sessionInput) {
305
- if (!sessionInput.raw_llm_response) {
306
- this.logger.warn(`No raw_llm_response in SessionInput ID ${sessionInput.id}. Cannot auto-apply actions.`);
307
- return [];
308
- }
309
- const { dtos: actionDtos, explanation } = await this.llmResponseParserService.parse(sessionInput.raw_llm_response);
310
- this.handleYoloMode(sessionInput, actionDtos);
311
- if (explanation) {
312
- sessionInput.llm_response_explanation = explanation;
313
- await this.sessionInputsRepository.save(sessionInput);
314
- }
315
- const contextRequestResult = await this.handleRequestContext(sessionInput, actionDtos);
316
- if (contextRequestResult) {
317
- return contextRequestResult;
318
- }
319
- const newSessionResult = await this.handleNewSession(sessionInput, actionDtos);
320
- if (newSessionResult) {
321
- return newSessionResult;
322
- }
323
- const processedActions = [];
324
- for (const dto of actionDtos) {
325
- const action = this.aiActionsRepository.create({
326
- ...dto,
327
- input_id: sessionInput.id,
328
- sessionInput: { id: sessionInput.id },
329
- order_of_execution: dto.order_of_execution ?? 0,
330
- arguments: dto.arguments ? JSON.stringify(dto.arguments) : undefined,
331
- });
332
- if (dto.action_type === 'edit_file' ||
333
- dto.action_type === 'delete_file') {
334
- action.original_content_for_revert = await this.readFileContent(dto.file_path);
335
- }
336
- try {
337
- this.logger.log(`Auto-applying action for input ${sessionInput.id}`);
338
- const { outcomeMessage, commandStdout } = await this.executeActionDto(dto);
339
- action.status = ai_actions_service_1.AIActionStatus.CONFIRMED_KEPT;
340
- const savedAction = await this.aiActionsRepository.save(action);
341
- await this.executionLogsService.createLog({
342
- action_id: savedAction.id,
343
- output: outcomeMessage,
344
- });
345
- if (commandStdout) {
346
- const isManualFlow = await this.applicationStateService.getManualLlmEnabled();
347
- const message = `The previous 'run_command' action produced this output. Please analyze it and continue with the next logical step based on the original request. Do not just describe the output; use it to proceed.\n\nOUTPUT:\n${commandStdout}`;
348
- this.chatService
349
- .sendMessage(sessionInput.session_id, message, isManualFlow)
350
- .catch((err) => {
351
- this.logger.error(`Follow-up LLM call from run_command failed: ${err.message}`, err.stack);
352
- });
353
- }
354
- processedActions.push(savedAction);
355
- }
356
- catch (error) {
357
- action.status = ai_actions_service_1.AIActionStatus.EXECUTION_FAILED;
358
- const savedAction = await this.aiActionsRepository.save(action);
359
- await this.executionLogsService.createLog({
360
- action_id: savedAction.id,
361
- error_message: error.message,
362
- });
363
- processedActions.push(savedAction);
364
- this.logger.error(`Failed to auto-apply action for input ${sessionInput.id}: ${error.message}`, error.stack);
365
- throw error;
366
- }
367
- }
368
- return processedActions;
369
- }
370
- async executeActionDto(dto) {
371
- switch (dto.action_type) {
372
- case ai_action_dto_1.AIActionType.CREATE_FILE:
373
- await this.actionExecutionService.createFile(dto.file_path, dto.content);
374
- return { outcomeMessage: `File "${dto.file_path}" created.` };
375
- case ai_action_dto_1.AIActionType.EDIT_FILE:
376
- await this.actionExecutionService.editFile(dto.file_path, dto.content);
377
- return { outcomeMessage: `File "${dto.file_path}" edited.` };
378
- case ai_action_dto_1.AIActionType.DELETE_FILE:
379
- await this.actionExecutionService.deleteFile(dto.file_path);
380
- return { outcomeMessage: `File "${dto.file_path}" deleted.` };
381
- case ai_action_dto_1.AIActionType.RUN_COMMAND: {
382
- const result = await this.actionExecutionService.runCommand(dto.command_string);
383
- return {
384
- outcomeMessage: `Command executed. STDOUT: ${result.stdout || 'N/A'}, STDERR: ${result.stderr || 'N/A'}`,
385
- commandStdout: result.stdout,
386
- };
387
- }
388
- case ai_action_dto_1.AIActionType.USE_MCP_TOOL: {
389
- const result = await this.actionExecutionService.useMcpTool(dto.server_name, dto.tool_name, dto.arguments);
390
- return {
391
- outcomeMessage: `MCP Tool executed. STDOUT: ${result.stdout || 'N/A'}, STDERR: ${result.stderr || 'N/A'}`,
392
- commandStdout: result.stdout,
393
- };
394
- }
395
- default:
396
- throw new Error(`Unsupported action type for auto-apply: ${dto.action_type}`);
397
- }
398
- }
399
- };
400
- exports.AIActionCreationService = AIActionCreationService;
401
- exports.AIActionCreationService = AIActionCreationService = AIActionCreationService_1 = __decorate([
402
- (0, common_1.Injectable)(),
403
- __param(0, (0, typeorm_1.InjectRepository)(core_entities_1.AIAction)),
404
- __param(1, (0, typeorm_1.InjectRepository)(core_entities_1.SessionInput)),
405
- __param(6, (0, common_1.Inject)((0, common_1.forwardRef)(() => chat_service_1.ChatService))),
406
- __param(7, (0, common_1.Inject)((0, common_1.forwardRef)(() => llm_responses_service_1.LlmResponsesService))),
407
- __metadata("design:paramtypes", [typeorm_2.Repository,
408
- typeorm_2.Repository,
409
- llm_response_parser_service_1.LlmResponseParserService,
410
- execution_logs_service_1.ExecutionLogsService,
411
- action_execution_service_1.ActionExecutionService,
412
- application_state_service_1.ApplicationStateService,
413
- chat_service_1.ChatService,
414
- llm_responses_service_1.LlmResponsesService])
415
- ], AIActionCreationService);
416
- //# sourceMappingURL=ai-action-creation.service.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ai-action-creation.service.js","sourceRoot":"","sources":["../../../src/ai-actions/ai-action-creation.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAMwB;AACxB,6CAAmD;AACnD,qCAAqC;AACrC,kCAAkC;AAClC,oDAA0D;AAC1D,oGAA8F;AAC9F,qFAAgF;AAChF,4EAGkD;AAClD,6DAAsD;AACtD,2FAAsF;AACtF,8FAAyF;AACzF,mEAA+D;AAC/D,kFAA6E;AAGtE,IAAM,uBAAuB,+BAA7B,MAAM,uBAAuB;IAGlC,YAEE,mBAAiD,EAEjD,uBAAyD,EACjD,wBAAkD,EAClD,oBAA0C,EACjC,sBAA8C,EAC9C,uBAAgD,EAEjE,WAAyC,EAEzC,mBAAyD;QAVjD,wBAAmB,GAAnB,mBAAmB,CAAsB;QAEzC,4BAAuB,GAAvB,uBAAuB,CAA0B;QACjD,6BAAwB,GAAxB,wBAAwB,CAA0B;QAClD,yBAAoB,GAApB,oBAAoB,CAAsB;QACjC,2BAAsB,GAAtB,sBAAsB,CAAwB;QAC9C,4BAAuB,GAAvB,uBAAuB,CAAyB;QAEhD,gBAAW,GAAX,WAAW,CAAa;QAExB,wBAAmB,GAAnB,mBAAmB,CAAqB;QAd1C,WAAM,GAAG,IAAI,eAAM,CAAC,yBAAuB,CAAC,IAAI,CAAC,CAAC;IAehE,CAAC;IAEI,KAAK,CAAC,cAAc,CAC1B,YAA0B,EAC1B,UAAyB;QAEzB,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,uBAAuB,CAAC,kBAAkB,EAAE,CAAC;QAC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AC,GAAG,EAAE,CAAC,0BAAW,CAAC,CAAC,CAAA;IAErC,WAAA,IAAA,eAAM,EAAC,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,2CAAmB,CAAC,CAAC,CAAA;qCATjB,oBAAU;QAEN,oBAAU;QACT,sDAAwB;QAC5B,6CAAoB;QACT,iDAAsB;QACrB,mDAAuB;QAEnC,0BAAW;QAEH,2CAAmB;GAfhD,uBAAuB,CAokBnC"}
@@ -1,30 +0,0 @@
1
- export declare enum AIActionType {
2
- CREATE_FILE = "create_file",
3
- EDIT_FILE = "edit_file",
4
- DELETE_FILE = "delete_file",
5
- RUN_COMMAND = "run_command",
6
- REQUEST_CONTEXT = "request_context",
7
- FINAL = "final",
8
- NEW_SESSION = "new_session",
9
- USE_MCP_TOOL = "use_mcp_tool"
10
- }
11
- export declare class AIActionDto {
12
- action_type: AIActionType;
13
- file_path?: string;
14
- content?: string;
15
- command_string?: string;
16
- files?: string;
17
- folders?: string;
18
- reason?: string;
19
- handover_string?: string;
20
- order_of_execution?: number;
21
- server_name?: string;
22
- tool_name?: string;
23
- arguments?: any;
24
- static validateFilePath(dto: AIActionDto): void;
25
- static validateContentForFileOps(dto: AIActionDto): void;
26
- static validateCommandString(dto: AIActionDto): void;
27
- static validateRequestContext(dto: AIActionDto): void;
28
- static validateHandoverString(dto: AIActionDto): void;
29
- static validateMcpTool(dto: AIActionDto): void;
30
- }
@@ -1,162 +0,0 @@
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.AIActionDto = exports.AIActionType = void 0;
13
- const class_validator_1 = require("class-validator");
14
- var AIActionType;
15
- (function (AIActionType) {
16
- AIActionType["CREATE_FILE"] = "create_file";
17
- AIActionType["EDIT_FILE"] = "edit_file";
18
- AIActionType["DELETE_FILE"] = "delete_file";
19
- AIActionType["RUN_COMMAND"] = "run_command";
20
- AIActionType["REQUEST_CONTEXT"] = "request_context";
21
- AIActionType["FINAL"] = "final";
22
- AIActionType["NEW_SESSION"] = "new_session";
23
- AIActionType["USE_MCP_TOOL"] = "use_mcp_tool";
24
- })(AIActionType || (exports.AIActionType = AIActionType = {}));
25
- class AIActionDto {
26
- static validateFilePath(dto) {
27
- if ((dto.action_type === AIActionType.CREATE_FILE ||
28
- dto.action_type === AIActionType.EDIT_FILE ||
29
- dto.action_type === AIActionType.DELETE_FILE) &&
30
- !dto.file_path) {
31
- throw new Error(`file_path is required for action_type: ${dto.action_type}`);
32
- }
33
- }
34
- static validateContentForFileOps(dto) {
35
- if ((dto.action_type === AIActionType.CREATE_FILE ||
36
- dto.action_type === AIActionType.EDIT_FILE) &&
37
- dto.content === undefined) {
38
- throw new Error(`content is required for action_type: ${dto.action_type}`);
39
- }
40
- }
41
- static validateCommandString(dto) {
42
- if (dto.action_type === AIActionType.RUN_COMMAND && !dto.command_string) {
43
- throw new Error(`command_string is required for action_type: ${dto.action_type}`);
44
- }
45
- }
46
- static validateRequestContext(dto) {
47
- if (dto.action_type === AIActionType.REQUEST_CONTEXT &&
48
- !dto.files &&
49
- !dto.folders) {
50
- throw new Error(`files or folders is required for action_type: ${dto.action_type}`);
51
- }
52
- }
53
- static validateHandoverString(dto) {
54
- if (dto.action_type === AIActionType.NEW_SESSION && !dto.handover_string) {
55
- throw new Error(`handover_string is required for action_type: ${dto.action_type}`);
56
- }
57
- }
58
- static validateMcpTool(dto) {
59
- if (dto.action_type === AIActionType.USE_MCP_TOOL &&
60
- (!dto.server_name || !dto.tool_name || !dto.arguments)) {
61
- throw new Error(`server_name, tool_name, and arguments are required for action_type: ${dto.action_type}`);
62
- }
63
- }
64
- }
65
- exports.AIActionDto = AIActionDto;
66
- __decorate([
67
- (0, class_validator_1.IsEnum)(AIActionType),
68
- (0, class_validator_1.IsNotEmpty)(),
69
- __metadata("design:type", String)
70
- ], AIActionDto.prototype, "action_type", void 0);
71
- __decorate([
72
- (0, class_validator_1.IsOptional)(),
73
- (0, class_validator_1.IsString)(),
74
- __metadata("design:type", String)
75
- ], AIActionDto.prototype, "file_path", void 0);
76
- __decorate([
77
- (0, class_validator_1.IsOptional)(),
78
- (0, class_validator_1.IsString)(),
79
- __metadata("design:type", String)
80
- ], AIActionDto.prototype, "content", void 0);
81
- __decorate([
82
- (0, class_validator_1.IsOptional)(),
83
- (0, class_validator_1.IsString)(),
84
- __metadata("design:type", String)
85
- ], AIActionDto.prototype, "command_string", void 0);
86
- __decorate([
87
- (0, class_validator_1.IsOptional)(),
88
- (0, class_validator_1.IsString)(),
89
- __metadata("design:type", String)
90
- ], AIActionDto.prototype, "files", void 0);
91
- __decorate([
92
- (0, class_validator_1.IsOptional)(),
93
- (0, class_validator_1.IsString)(),
94
- __metadata("design:type", String)
95
- ], AIActionDto.prototype, "folders", void 0);
96
- __decorate([
97
- (0, class_validator_1.IsOptional)(),
98
- (0, class_validator_1.IsString)(),
99
- __metadata("design:type", String)
100
- ], AIActionDto.prototype, "reason", void 0);
101
- __decorate([
102
- (0, class_validator_1.IsOptional)(),
103
- (0, class_validator_1.IsString)(),
104
- __metadata("design:type", String)
105
- ], AIActionDto.prototype, "handover_string", void 0);
106
- __decorate([
107
- (0, class_validator_1.IsNumber)(),
108
- (0, class_validator_1.IsOptional)(),
109
- __metadata("design:type", Number)
110
- ], AIActionDto.prototype, "order_of_execution", void 0);
111
- __decorate([
112
- (0, class_validator_1.IsOptional)(),
113
- (0, class_validator_1.IsString)(),
114
- __metadata("design:type", String)
115
- ], AIActionDto.prototype, "server_name", void 0);
116
- __decorate([
117
- (0, class_validator_1.IsOptional)(),
118
- (0, class_validator_1.IsString)(),
119
- __metadata("design:type", String)
120
- ], AIActionDto.prototype, "tool_name", void 0);
121
- __decorate([
122
- (0, class_validator_1.IsOptional)(),
123
- (0, class_validator_1.IsObject)(),
124
- __metadata("design:type", Object)
125
- ], AIActionDto.prototype, "arguments", void 0);
126
- __decorate([
127
- (0, class_validator_1.ValidateNested)(),
128
- __metadata("design:type", Function),
129
- __metadata("design:paramtypes", [AIActionDto]),
130
- __metadata("design:returntype", void 0)
131
- ], AIActionDto, "validateFilePath", null);
132
- __decorate([
133
- (0, class_validator_1.ValidateNested)(),
134
- __metadata("design:type", Function),
135
- __metadata("design:paramtypes", [AIActionDto]),
136
- __metadata("design:returntype", void 0)
137
- ], AIActionDto, "validateContentForFileOps", null);
138
- __decorate([
139
- (0, class_validator_1.ValidateNested)(),
140
- __metadata("design:type", Function),
141
- __metadata("design:paramtypes", [AIActionDto]),
142
- __metadata("design:returntype", void 0)
143
- ], AIActionDto, "validateCommandString", null);
144
- __decorate([
145
- (0, class_validator_1.ValidateNested)(),
146
- __metadata("design:type", Function),
147
- __metadata("design:paramtypes", [AIActionDto]),
148
- __metadata("design:returntype", void 0)
149
- ], AIActionDto, "validateRequestContext", null);
150
- __decorate([
151
- (0, class_validator_1.ValidateNested)(),
152
- __metadata("design:type", Function),
153
- __metadata("design:paramtypes", [AIActionDto]),
154
- __metadata("design:returntype", void 0)
155
- ], AIActionDto, "validateHandoverString", null);
156
- __decorate([
157
- (0, class_validator_1.ValidateNested)(),
158
- __metadata("design:type", Function),
159
- __metadata("design:paramtypes", [AIActionDto]),
160
- __metadata("design:returntype", void 0)
161
- ], AIActionDto, "validateMcpTool", null);
162
- //# sourceMappingURL=ai-action.dto.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ai-action.dto.js","sour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AAQ,GAAE;;4CACM;AAIjB;IAFC,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,GAAE;;2CACK;AAIhB;IAFC,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,GAAE;;oDACc;AAIzB;IAFC,IAAA,0BAAQ,GAAE;IACV,IAAA,4BAAU,GAAE;;uDACe;AAK5B;IAFC,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,GAAE;;gDACU;AAIrB;IAFC,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,GAAE;;8CACQ;AAInB;IAFC,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,GAAE;;8CACK;AAIF;IADb,IAAA,gCAAc,GAAE;;qCACmB,WAAW;;yCAW9C;AAIa;IADb,IAAA,gCAAc,GAAE;;qCAC4B,WAAW;;kDAUvD;AAIa;IADb,IAAA,gCAAc,GAAE;;qCACwB,WAAW;;8CAMnD;AAIa;IADb,IAAA,gCAAc,GAAE;;qCACyB,WAAW;;+CAUpD;AAIa;IADb,IAAA,gCAAc,GAAE;;qCACyB,WAAW;;+CAMpD;AAIa;IADb,IAAA,gCAAc,GAAE;;qCACkB,WAAW;;wCAS7C"}
@@ -1,4 +0,0 @@
1
- export declare class ParsingError extends Error {
2
- readonly originalError?: any;
3
- constructor(message: string, originalError?: any);
4
- }