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
|
@@ -0,0 +1,144 @@
|
|
|
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 FollowUpPostExecutionHook_1;
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.FollowUpPostExecutionHook = void 0;
|
|
17
|
+
const common_1 = require("@nestjs/common");
|
|
18
|
+
const chat_service_1 = require("../../interactive-chat/chat.service");
|
|
19
|
+
const session_inputs_service_1 = require("../../session-inputs/session-inputs.service");
|
|
20
|
+
const events_gateway_1 = require("../../events/events.gateway");
|
|
21
|
+
const system_prompts_service_1 = require("../../system-prompts/system-prompts.service");
|
|
22
|
+
const sessions_service_1 = require("../../sessions/sessions.service");
|
|
23
|
+
const application_state_service_1 = require("../../application-state/application-state.service");
|
|
24
|
+
let FollowUpPostExecutionHook = FollowUpPostExecutionHook_1 = class FollowUpPostExecutionHook {
|
|
25
|
+
constructor(chatService, sessionInputsService, eventsGateway, systemPromptsService, sessionsService, applicationStateService) {
|
|
26
|
+
this.chatService = chatService;
|
|
27
|
+
this.sessionInputsService = sessionInputsService;
|
|
28
|
+
this.eventsGateway = eventsGateway;
|
|
29
|
+
this.systemPromptsService = systemPromptsService;
|
|
30
|
+
this.sessionsService = sessionsService;
|
|
31
|
+
this.applicationStateService = applicationStateService;
|
|
32
|
+
this.logger = new common_1.Logger(FollowUpPostExecutionHook_1.name);
|
|
33
|
+
}
|
|
34
|
+
async run(sessionInput, context) {
|
|
35
|
+
if (context.feedback.validationErrors.length > 0) {
|
|
36
|
+
await this.handleValidationFeedback(sessionInput, context);
|
|
37
|
+
context.flags.follow_up_initiated = true;
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
if (context.flags.should_halt && context.followUpAction) {
|
|
41
|
+
await this.handleHaltedPlan(sessionInput, context);
|
|
42
|
+
context.flags.follow_up_initiated = true;
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
if (context.outputs.commands.length > 0 ||
|
|
46
|
+
context.outputs.mcp_tools.length > 0) {
|
|
47
|
+
await this.handleCommandOutputs(sessionInput, context);
|
|
48
|
+
context.flags.follow_up_initiated = true;
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
this.logger.log('No follow-up action needed for this plan.');
|
|
52
|
+
}
|
|
53
|
+
async handleValidationFeedback(sessionInput, context) {
|
|
54
|
+
const validationErrors = context.feedback.validationErrors;
|
|
55
|
+
let feedbackMessage = `The plan could not be executed due to the following validation errors. Please correct your tool usage and regenerate the plan.\n\n`;
|
|
56
|
+
for (const err of validationErrors) {
|
|
57
|
+
feedbackMessage += `- Tool: \`${err.tool_name}\`\n - Error: ${err.error}\n`;
|
|
58
|
+
}
|
|
59
|
+
this.logger.log('Triggering self-correction AI call due to validation errors.');
|
|
60
|
+
const isManualFlow = await this.applicationStateService.getManualLlmEnabled();
|
|
61
|
+
await this.chatService.sendMessage(sessionInput.session_id, feedbackMessage, isManualFlow);
|
|
62
|
+
}
|
|
63
|
+
async handleHaltedPlan(sessionInput, context) {
|
|
64
|
+
this.logger.log(`Handling halted plan with follow-up action: ${context.followUpAction.type}`);
|
|
65
|
+
switch (context.followUpAction.type) {
|
|
66
|
+
case 'AUTO_CONTEXT_FETCH':
|
|
67
|
+
await this.handleAutoContextFetch(sessionInput, context.followUpAction.data);
|
|
68
|
+
break;
|
|
69
|
+
case 'NEW_SESSION':
|
|
70
|
+
await this.handleNewSession(context.followUpAction.data);
|
|
71
|
+
break;
|
|
72
|
+
default:
|
|
73
|
+
this.logger.warn(`Unknown follow-up action type: ${context.followUpAction.type}`);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
async handleAutoContextFetch(originalInput, data) {
|
|
77
|
+
const session = await this.sessionsService.findOne(originalInput.session_id);
|
|
78
|
+
const newDto = {
|
|
79
|
+
user_prompt: '',
|
|
80
|
+
execution_strategy: originalInput.execution_strategy,
|
|
81
|
+
ad_hoc_context_definition: JSON.stringify(data),
|
|
82
|
+
context_template_id: session.default_followup_context_template_id,
|
|
83
|
+
};
|
|
84
|
+
this.logger.log(`Auto Context Fetch is re-submitting for session ${originalInput.session_id}.`);
|
|
85
|
+
await this.sessionInputsService.create(originalInput.session_id, newDto);
|
|
86
|
+
}
|
|
87
|
+
async handleNewSession(data) {
|
|
88
|
+
this.eventsGateway.sendToAll('external-new-session', {});
|
|
89
|
+
const defaultSystemPrompt = await this.systemPromptsService.findDefault();
|
|
90
|
+
if (defaultSystemPrompt?.prompt_content) {
|
|
91
|
+
await new Promise((resolve) => setTimeout(resolve, 1000));
|
|
92
|
+
this.eventsGateway.sendToAll('system-prompt-update', {
|
|
93
|
+
content: defaultSystemPrompt.prompt_content,
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
const newSession = await this.sessionsService.create({
|
|
97
|
+
session_title: 'Handover Session',
|
|
98
|
+
});
|
|
99
|
+
if (data.handover_string) {
|
|
100
|
+
const executionStrategy = await this.applicationStateService.getExecutionStrategy();
|
|
101
|
+
await new Promise((resolve) => setTimeout(resolve, 1000));
|
|
102
|
+
this.sessionInputsService
|
|
103
|
+
.create(newSession.id, {
|
|
104
|
+
user_prompt: data.handover_string,
|
|
105
|
+
execution_strategy: executionStrategy,
|
|
106
|
+
context_template_id: newSession.default_initial_context_template_id,
|
|
107
|
+
})
|
|
108
|
+
.catch((err) => {
|
|
109
|
+
this.logger.error(`Error creating initial session input from handover: ${err.message}`, err.stack);
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
await new Promise((resolve) => setTimeout(resolve, 1000));
|
|
113
|
+
this.eventsGateway.sendToAll('session-created', {
|
|
114
|
+
sessionId: newSession.id,
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
async handleCommandOutputs(sessionInput, context) {
|
|
118
|
+
let followUpMessage = 'The previous plan produced the following outputs. Please analyze them and continue with the next logical step.\n\n';
|
|
119
|
+
for (const cmd of context.outputs.commands) {
|
|
120
|
+
followUpMessage += `--- Output from: \`run_command\` ---\n`;
|
|
121
|
+
followUpMessage += `Command: ${cmd.command}\nOutput:\n${cmd.output}\n\n`;
|
|
122
|
+
}
|
|
123
|
+
for (const tool of context.outputs.mcp_tools) {
|
|
124
|
+
followUpMessage += `--- Output from: \`use_mcp_tool\` ---\n`;
|
|
125
|
+
followUpMessage += `Tool: ${tool.tool_name}\nOutput:\n${tool.output}\n\n`;
|
|
126
|
+
}
|
|
127
|
+
this.logger.log('Triggering follow-up AI call with consolidated outputs.');
|
|
128
|
+
const isManualFlow = await this.applicationStateService.getManualLlmEnabled();
|
|
129
|
+
await this.chatService.sendMessage(sessionInput.session_id, followUpMessage, isManualFlow);
|
|
130
|
+
}
|
|
131
|
+
};
|
|
132
|
+
exports.FollowUpPostExecutionHook = FollowUpPostExecutionHook;
|
|
133
|
+
exports.FollowUpPostExecutionHook = FollowUpPostExecutionHook = FollowUpPostExecutionHook_1 = __decorate([
|
|
134
|
+
(0, common_1.Injectable)(),
|
|
135
|
+
__param(0, (0, common_1.Inject)((0, common_1.forwardRef)(() => chat_service_1.ChatService))),
|
|
136
|
+
__param(1, (0, common_1.Inject)((0, common_1.forwardRef)(() => session_inputs_service_1.SessionInputsService))),
|
|
137
|
+
__metadata("design:paramtypes", [chat_service_1.ChatService,
|
|
138
|
+
session_inputs_service_1.SessionInputsService,
|
|
139
|
+
events_gateway_1.EventsGateway,
|
|
140
|
+
system_prompts_service_1.SystemPromptsService,
|
|
141
|
+
sessions_service_1.SessionsService,
|
|
142
|
+
application_state_service_1.ApplicationStateService])
|
|
143
|
+
], FollowUpPostExecutionHook);
|
|
144
|
+
//# sourceMappingURL=follow-up-post-execution.hook.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"follow-up-post-execution.hook.js","sourceRoot":"","sources":["../../../../src/llm-orchestration/hooks/follow-up-post-execution.hook.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAwE;AAIxE,sEAAkE;AAClE,wFAAmF;AACnF,gEAA4D;AAC5D,wFAAmF;AACnF,sEAAkE;AAClE,iGAA4F;AAIrF,IAAM,yBAAyB,iCAA/B,MAAM,yBAAyB;IAGpC,YAEE,WAAyC,EAEzC,oBAA2D,EAC1C,aAA4B,EAC5B,oBAA0C,EAC1C,eAAgC,EAChC,uBAAgD;QANhD,gBAAW,GAAX,WAAW,CAAa;QAExB,yBAAoB,GAApB,oBAAoB,CAAsB;QAC1C,kBAAa,GAAb,aAAa,CAAe;QAC5B,yBAAoB,GAApB,oBAAoB,CAAsB;QAC1C,oBAAe,GAAf,eAAe,CAAiB;QAChC,4BAAuB,GAAvB,uBAAuB,CAAyB;QAVlD,WAAM,GAAG,IAAI,eAAM,CAAC,2BAAyB,CAAC,IAAI,CAAC,CAAC;IAWlE,CAAC;IAEJ,KAAK,CAAC,GAAG,CAC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C,CAAA;qCADjB,0BAAW;QAEF,6CAAoB;QAC3B,8BAAa;QACN,6CAAoB;QACzB,kCAAe;QACP,mDAAuB;GAXxD,yBAAyB,CAoLrC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { PostExecutionHook } from './post-execution-hook.interface';
|
|
2
|
+
import { PlanExecutionContext } from '../llm-orchestration.interfaces';
|
|
3
|
+
import { SessionInput } from '../../core-entities';
|
|
4
|
+
import { EventsGateway } from '../../events/events.gateway';
|
|
5
|
+
export declare class FrontendNotificationHook implements PostExecutionHook {
|
|
6
|
+
private readonly eventsGateway;
|
|
7
|
+
private readonly logger;
|
|
8
|
+
constructor(eventsGateway: EventsGateway);
|
|
9
|
+
run(sessionInput: SessionInput, context: PlanExecutionContext): Promise<void>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
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 FrontendNotificationHook_1;
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.FrontendNotificationHook = void 0;
|
|
14
|
+
const common_1 = require("@nestjs/common");
|
|
15
|
+
const events_gateway_1 = require("../../events/events.gateway");
|
|
16
|
+
let FrontendNotificationHook = FrontendNotificationHook_1 = class FrontendNotificationHook {
|
|
17
|
+
constructor(eventsGateway) {
|
|
18
|
+
this.eventsGateway = eventsGateway;
|
|
19
|
+
this.logger = new common_1.Logger(FrontendNotificationHook_1.name);
|
|
20
|
+
}
|
|
21
|
+
async run(sessionInput, context) {
|
|
22
|
+
if (context.flags.follow_up_initiated) {
|
|
23
|
+
this.logger.log('Skipping frontend notification because a follow-up action was initiated.');
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
this.logger.log('Notifying frontend that plan is ready for review.');
|
|
27
|
+
this.eventsGateway.sendToAll('plan-ready', {
|
|
28
|
+
sessionId: sessionInput.session_id,
|
|
29
|
+
inputId: sessionInput.id,
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
exports.FrontendNotificationHook = FrontendNotificationHook;
|
|
34
|
+
exports.FrontendNotificationHook = FrontendNotificationHook = FrontendNotificationHook_1 = __decorate([
|
|
35
|
+
(0, common_1.Injectable)(),
|
|
36
|
+
__metadata("design:paramtypes", [events_gateway_1.EventsGateway])
|
|
37
|
+
], FrontendNotificationHook);
|
|
38
|
+
//# sourceMappingURL=frontend-notification.hook.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"frontend-notification.hook.js","sourceRoot":"","sources":["../../../../src/llm-orchestration/hooks/frontend-notification.hook.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,2CAAoD;AAIpD,gEAA4D;AAGrD,IAAM,wBAAwB,gCAA9B,MAAM,wBAAwB;IAGnC,YAA6B,aAA4B;QAA5B,kBAAa,GAAb,aAAa,CAAe;QAFxC,WAAM,GAAG,IAAI,eAAM,CAAC,0BAAwB,CAAC,IAAI,CAAC,CAAC;IAER,CAAC;IAE7D,KAAK,CAAC,GAAG,CACP,YAA0B,EAC1B,OAA6B;QAI7B,IAAI,OAAO,CAAC,KAAK,CAAC,mBAAmB,EAAE,CAAC;YACtC,IAAI,CAAC,MAAM,CAAC,GAAG,CACb,0EAA0E,CAC3E,CAAC;YACF,OAAO;QACT,CAAC;QAED,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,mDAAmD,CAAC,CAAC;QACrE,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,YAAY,EAAE;YACzC,SAAS,EAAE,YAAY,CAAC,UAAU;YAClC,OAAO,EAAE,YAAY,CAAC,EAAE;SACzB,CAAC,CAAC;IACL,CAAC;CACF,CAAA;AAxBY,4DAAwB;mCAAxB,wBAAwB;IADpC,IAAA,mBAAU,GAAE;qCAIiC,8BAAa;GAH9C,wBAAwB,CAwBpC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"post-execution-hook.interface.js","sourceRoot":"","sources":["../../../../src/llm-orchestration/hooks/post-execution-hook.interface.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { PostExecutionHook } from './post-execution-hook.interface';
|
|
2
|
+
import { PlanExecutionContext } from '../llm-orchestration.interfaces';
|
|
3
|
+
import { SessionInput } from '../../core-entities';
|
|
4
|
+
import { ApplicationStateService } from '../../application-state/application-state.service';
|
|
5
|
+
import { ChatService } from '../../interactive-chat/chat.service';
|
|
6
|
+
export declare class YoloModePostExecutionHook implements PostExecutionHook {
|
|
7
|
+
private readonly appStateService;
|
|
8
|
+
private readonly chatService;
|
|
9
|
+
private readonly logger;
|
|
10
|
+
constructor(appStateService: ApplicationStateService, chatService: ChatService);
|
|
11
|
+
run(sessionInput: SessionInput, context: PlanExecutionContext): Promise<void>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
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 YoloModePostExecutionHook_1;
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.YoloModePostExecutionHook = void 0;
|
|
17
|
+
const common_1 = require("@nestjs/common");
|
|
18
|
+
const application_state_service_1 = require("../../application-state/application-state.service");
|
|
19
|
+
const chat_service_1 = require("../../interactive-chat/chat.service");
|
|
20
|
+
const FILE_MODIFICATION_ACTIONS = ['create_file', 'edit_file', 'delete_file'];
|
|
21
|
+
let YoloModePostExecutionHook = YoloModePostExecutionHook_1 = class YoloModePostExecutionHook {
|
|
22
|
+
constructor(appStateService, chatService) {
|
|
23
|
+
this.appStateService = appStateService;
|
|
24
|
+
this.chatService = chatService;
|
|
25
|
+
this.logger = new common_1.Logger(YoloModePostExecutionHook_1.name);
|
|
26
|
+
}
|
|
27
|
+
async run(sessionInput, context) {
|
|
28
|
+
const isYoloMode = await this.appStateService.getYoloModeEnabled();
|
|
29
|
+
if (!isYoloMode) {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
const hasFinalAction = context.originalParsedActions.some((a) => a.tool_name === 'final');
|
|
33
|
+
if (hasFinalAction) {
|
|
34
|
+
this.logger.log('YOLO mode: "final" action detected. Disabling YOLO mode.');
|
|
35
|
+
await this.appStateService.setYoloModeEnabled(false);
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
const hasFileModification = context.originalParsedActions.some((a) => FILE_MODIFICATION_ACTIONS.includes(a.tool_name));
|
|
39
|
+
if (hasFileModification) {
|
|
40
|
+
this.logger.log('YOLO mode: File modification detected. Triggering "yolo" prompt.');
|
|
41
|
+
const isManualFlow = await this.appStateService.getManualLlmEnabled();
|
|
42
|
+
this.chatService
|
|
43
|
+
.sendMessage(sessionInput.session_id, 'yolo', isManualFlow)
|
|
44
|
+
.catch((err) => this.logger.error(`YOLO follow-up failed: ${err.message}`));
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
exports.YoloModePostExecutionHook = YoloModePostExecutionHook;
|
|
49
|
+
exports.YoloModePostExecutionHook = YoloModePostExecutionHook = YoloModePostExecutionHook_1 = __decorate([
|
|
50
|
+
(0, common_1.Injectable)(),
|
|
51
|
+
__param(1, (0, common_1.Inject)((0, common_1.forwardRef)(() => chat_service_1.ChatService))),
|
|
52
|
+
__metadata("design:paramtypes", [application_state_service_1.ApplicationStateService,
|
|
53
|
+
chat_service_1.ChatService])
|
|
54
|
+
], YoloModePostExecutionHook);
|
|
55
|
+
//# sourceMappingURL=yolo-mode-post-execution.hook.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"yolo-mode-post-execution.hook.js","sourceRoot":"","sources":["../../../../src/llm-orchestration/hooks/yolo-mode-post-execution.hook.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAwE;AAIxE,iGAA4F;AAC5F,sEAAkE;AAElE,MAAM,yBAAyB,GAAG,CAAC,aAAa,EAAE,WAAW,EAAE,aAAa,CAAC,CAAC;AAGvE,IAAM,yBAAyB,iCAA/B,MAAM,yBAAyB;IAGpC,YACmB,eAAwC,EAEzD,WAAyC;QAFxB,oBAAe,GAAf,eAAe,CAAyB;QAExC,gBAAW,GAAX,WAAW,CAAa;QAL1B,WAAM,GAAG,IAAI,eAAM,CAAC,2BAAyB,CAAC,IAAI,CAAC,CAAC;I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,CAAC,CAAC,CAAA;qCADJ,mDAAuB;QAE3B,0BAAW;GANhC,yBAAyB,CA8CrC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
export interface Action {
|
|
2
|
+
tool_name: string;
|
|
3
|
+
arguments: {
|
|
4
|
+
[key: string]: any;
|
|
5
|
+
};
|
|
6
|
+
}
|
|
7
|
+
export interface ParsedLlmOutput {
|
|
8
|
+
explanation: string | null;
|
|
9
|
+
actions: Action[];
|
|
10
|
+
}
|
|
11
|
+
export interface ActionExecutionResult {
|
|
12
|
+
status: 'SUCCESS' | 'FAILURE';
|
|
13
|
+
summary: string;
|
|
14
|
+
persisted_args: {
|
|
15
|
+
[key: string]: any;
|
|
16
|
+
};
|
|
17
|
+
error_message?: string;
|
|
18
|
+
original_content_for_revert?: string | null;
|
|
19
|
+
execution_log?: {
|
|
20
|
+
output?: string;
|
|
21
|
+
error_message?: string;
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
export declare class PlanExecutionContext {
|
|
25
|
+
originalParsedActions: Action[];
|
|
26
|
+
outputs: {
|
|
27
|
+
commands: {
|
|
28
|
+
command: string;
|
|
29
|
+
output: string;
|
|
30
|
+
}[];
|
|
31
|
+
mcp_tools: {
|
|
32
|
+
tool_name: string;
|
|
33
|
+
output: string;
|
|
34
|
+
}[];
|
|
35
|
+
};
|
|
36
|
+
feedback: {
|
|
37
|
+
validationErrors: {
|
|
38
|
+
tool_name: string;
|
|
39
|
+
error: string;
|
|
40
|
+
}[];
|
|
41
|
+
};
|
|
42
|
+
flags: {
|
|
43
|
+
should_halt: boolean;
|
|
44
|
+
halt_reason?: 'CONTEXT_REQUESTED' | 'VALIDATION_FAILED' | 'NEW_SESSION';
|
|
45
|
+
is_final: boolean;
|
|
46
|
+
follow_up_initiated: boolean;
|
|
47
|
+
};
|
|
48
|
+
followUpAction?: {
|
|
49
|
+
type: 'AUTO_CONTEXT_FETCH' | 'NEW_SESSION';
|
|
50
|
+
data: any;
|
|
51
|
+
};
|
|
52
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PlanExecutionContext = void 0;
|
|
4
|
+
class PlanExecutionContext {
|
|
5
|
+
constructor() {
|
|
6
|
+
this.originalParsedActions = [];
|
|
7
|
+
this.outputs = { commands: [], mcp_tools: [] };
|
|
8
|
+
this.feedback = { validationErrors: [] };
|
|
9
|
+
this.flags = { should_halt: false, is_final: false, follow_up_initiated: false };
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
exports.PlanExecutionContext = PlanExecutionContext;
|
|
13
|
+
//# sourceMappingURL=llm-orchestration.interfaces.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"llm-orchestration.interfaces.js","sourceRoot":"","sources":["../../../src/llm-orchestration/llm-orchestration.interfaces.ts"],"names":[],"mappings":";;;AAqDA,MAAa,oBAAoB;IAAjC;QAEE,0BAAqB,GAAa,EAAE,CAAC;QAGrC,YAAO,GAGH,EAAE,QAAQ,EAAE,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC;QAGpC,aAAQ,GAEJ,EAAE,gBAAgB,EAAE,EAAE,EAAE,CAAC;QAG7B,UAAK,GAKD,EAAE,WAAW,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,mBAAmB,EAAE,KAAK,EAAE,CAAC;IAO1E,CAAC;CAAA;AA5BD,oDA4BC"}
|
|
@@ -0,0 +1,88 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.LlmOrchestrationModule = void 0;
|
|
10
|
+
const common_1 = require("@nestjs/common");
|
|
11
|
+
const typeorm_1 = require("@nestjs/typeorm");
|
|
12
|
+
const core_entities_1 = require("../core-entities");
|
|
13
|
+
const llm_output_parser_service_1 = require("./parser/llm-output-parser.service");
|
|
14
|
+
const llm_turn_processor_service_1 = require("./llm-turn-processor.service");
|
|
15
|
+
const follow_up_post_execution_hook_1 = require("./hooks/follow-up-post-execution.hook");
|
|
16
|
+
const yolo_mode_post_execution_hook_1 = require("./hooks/yolo-mode-post-execution.hook");
|
|
17
|
+
const application_state_module_1 = require("../application-state/application-state.module");
|
|
18
|
+
const chat_module_1 = require("../interactive-chat/chat.module");
|
|
19
|
+
const session_inputs_module_1 = require("../session-inputs/session-inputs.module");
|
|
20
|
+
const events_module_1 = require("../events/events.module");
|
|
21
|
+
const system_prompts_module_1 = require("../system-prompts/system-prompts.module");
|
|
22
|
+
const sessions_module_1 = require("../sessions/sessions.module");
|
|
23
|
+
const run_command_handler_1 = require("./action-handlers/run-command.handler");
|
|
24
|
+
const use_mcp_tool_handler_1 = require("./action-handlers/use-mcp-tool.handler");
|
|
25
|
+
const request_context_handler_1 = require("./action-handlers/request-context.handler");
|
|
26
|
+
const new_session_handler_1 = require("./action-handlers/new-session.handler");
|
|
27
|
+
const final_handler_1 = require("./action-handlers/final.handler");
|
|
28
|
+
const mcp_module_1 = require("../mcp/mcp.module");
|
|
29
|
+
const frontend_notification_hook_1 = require("./hooks/frontend-notification.hook");
|
|
30
|
+
const create_file_handler_1 = require("./action-handlers/create-file.handler");
|
|
31
|
+
const edit_file_handler_1 = require("./action-handlers/edit-file.handler");
|
|
32
|
+
const delete_file_handler_1 = require("./action-handlers/delete-file.handler");
|
|
33
|
+
const execution_logs_module_1 = require("../execution-logs/execution-logs.module");
|
|
34
|
+
const actionHandlers = [
|
|
35
|
+
create_file_handler_1.CreateFileHandler,
|
|
36
|
+
edit_file_handler_1.EditFileHandler,
|
|
37
|
+
delete_file_handler_1.DeleteFileHandler,
|
|
38
|
+
run_command_handler_1.RunCommandHandler,
|
|
39
|
+
use_mcp_tool_handler_1.UseMcpToolHandler,
|
|
40
|
+
request_context_handler_1.RequestContextHandler,
|
|
41
|
+
new_session_handler_1.NewSessionHandler,
|
|
42
|
+
final_handler_1.FinalHandler,
|
|
43
|
+
];
|
|
44
|
+
const postExecutionHooks = [
|
|
45
|
+
follow_up_post_execution_hook_1.FollowUpPostExecutionHook,
|
|
46
|
+
yolo_mode_post_execution_hook_1.YoloModePostExecutionHook,
|
|
47
|
+
frontend_notification_hook_1.FrontendNotificationHook,
|
|
48
|
+
];
|
|
49
|
+
let LlmOrchestrationModule = class LlmOrchestrationModule {
|
|
50
|
+
};
|
|
51
|
+
exports.LlmOrchestrationModule = LlmOrchestrationModule;
|
|
52
|
+
exports.LlmOrchestrationModule = LlmOrchestrationModule = __decorate([
|
|
53
|
+
(0, common_1.Module)({
|
|
54
|
+
imports: [
|
|
55
|
+
typeorm_1.TypeOrmModule.forFeature([core_entities_1.AIAction, core_entities_1.SessionInput]),
|
|
56
|
+
application_state_module_1.ApplicationStateModule,
|
|
57
|
+
(0, common_1.forwardRef)(() => chat_module_1.InteractiveChatModule),
|
|
58
|
+
(0, common_1.forwardRef)(() => session_inputs_module_1.SessionInputsModule),
|
|
59
|
+
events_module_1.EventsModule,
|
|
60
|
+
system_prompts_module_1.SystemPromptsModule,
|
|
61
|
+
sessions_module_1.SessionsModule,
|
|
62
|
+
mcp_module_1.McpModule,
|
|
63
|
+
execution_logs_module_1.ExecutionLogsModule,
|
|
64
|
+
],
|
|
65
|
+
providers: [
|
|
66
|
+
llm_output_parser_service_1.LlmOutputParserService,
|
|
67
|
+
llm_turn_processor_service_1.LlmTurnProcessorService,
|
|
68
|
+
...actionHandlers,
|
|
69
|
+
...postExecutionHooks,
|
|
70
|
+
{
|
|
71
|
+
provide: 'ACTION_HANDLER_REGISTRY',
|
|
72
|
+
useFactory: (...handlers) => {
|
|
73
|
+
const registry = new Map();
|
|
74
|
+
handlers.forEach((handler) => registry.set(handler.toolName, handler));
|
|
75
|
+
return registry;
|
|
76
|
+
},
|
|
77
|
+
inject: actionHandlers,
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
provide: 'POST_EXECUTION_HOOKS',
|
|
81
|
+
useFactory: (...hooks) => hooks,
|
|
82
|
+
inject: postExecutionHooks,
|
|
83
|
+
},
|
|
84
|
+
],
|
|
85
|
+
exports: [llm_turn_processor_service_1.LlmTurnProcessorService],
|
|
86
|
+
})
|
|
87
|
+
], LlmOrchestrationModule);
|
|
88
|
+
//# sourceMappingURL=llm-orchestration.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"llm-orchestration.module.js","sourceRoot":"","sources":["../../../src/llm-orchestration/llm-orchestration.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAoD;AACpD,6CAAgD;AAChD,oDAA0D;AAC1D,kFAA4E;AAC5E,6EAAuE;AACvE,yFAAkF;AAClF,yFAAkF;AAClF,4FAAuF;AACvF,iEAAwE;AACxE,mFAA8E;AAC9E,2DAAuD;AACvD,mFAA8E;AAC9E,iEAA6D;AAC7D,+EAA0E;AAC1E,iFAA2E;AAC3E,uFAAkF;AAClF,+EAA0E;AAC1E,mEAA+D;AAC/D,kDAA8C;AAE9C,mFAA8E;AAC9E,+EAA0E;AAC1E,2EAAsE;AACtE,+EAA0E;AAC1E,mFAA8E;AAG9E,MAAM,cAAc,GAAG;IACrB,uCAAiB;IACjB,mCAAe;IACf,uCAAiB;IACjB,uCAAiB;IACjB,wCAAiB;IACjB,+CAAqB;IACrB,uCAAiB;IACjB,4BAAY;CACb,CAAC;AAEF,MAAM,kBAAkB,GAAG;IACzB,yDAAyB;IACzB,yDAAyB;IACzB,qDAAwB;CACzB,CAAC;AAqCK,IAAM,sBAAsB,GAA5B,MAAM,sBAAsB;CAAG,CAAA;AAAzB,wDAAsB;iCAAtB,sBAAsB;IAlClC,IAAA,eAAM,EAAC;QACN,OAAO,EAAE;YACP,uBAAa,CAAC,UAAU,CAAC,CAAC,wBAAQ,EAAE,4BAAY,CAAC,CAAC;YAClD,iDAAsB;YACtB,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,mCAAqB,CAAC;YACvC,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,2CAAmB,CAAC;YACrC,4BAAY;YACZ,2CAAmB;YACnB,gCAAc;YACd,sBAAS;YACT,2CAAmB;SACpB;QACD,SAAS,EAAE;YACT,kDAAsB;YACtB,oDAAuB;YACvB,GAAG,cAAc;YACjB,GAAG,kBAAkB;YACrB;gBACE,OAAO,EAAE,yBAAyB;gBAClC,UAAU,EAAE,CAAC,GAAG,QAAyB,EAAE,EAAE;oBAC3C,MAAM,QAAQ,GAAG,IAAI,GAAG,EAAyB,CAAC;oBAClD,QAAQ,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAC;oBACvE,OAAO,QAAQ,CAAC;gBAClB,CAAC;gBACD,MAAM,EAAE,cAAc;aACvB;YACD;gBACE,OAAO,EAAE,sBAAsB;gBAC/B,UAAU,EAAE,CAAC,GAAG,KAAK,EAAE,EAAE,CAAC,KAAK;gBAC/B,MAAM,EAAE,kBAAkB;aAC3B;SACF;QACD,OAAO,EAAE,CAAC,oDAAuB,CAAC;KACnC,CAAC;GACW,sBAAsB,CAAG"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Repository } from 'typeorm';
|
|
2
|
+
import { AIAction, SessionInput } from '../core-entities';
|
|
3
|
+
import { LlmOutputParserService } from './parser/llm-output-parser.service';
|
|
4
|
+
import { ActionHandler } from './action-handlers/action-handler.interface';
|
|
5
|
+
import { PostExecutionHook } from './hooks/post-execution-hook.interface';
|
|
6
|
+
import { ApplicationStateService } from '../application-state/application-state.service';
|
|
7
|
+
import { ExecutionLogsService } from '../execution-logs/execution-logs.service';
|
|
8
|
+
export declare class LlmTurnProcessorService {
|
|
9
|
+
private readonly parser;
|
|
10
|
+
private readonly handlerRegistry;
|
|
11
|
+
private readonly postExecutionHooks;
|
|
12
|
+
private readonly aiActionsRepository;
|
|
13
|
+
private readonly sessionInputsRepository;
|
|
14
|
+
private readonly applicationStateService;
|
|
15
|
+
private readonly executionLogsService;
|
|
16
|
+
private readonly logger;
|
|
17
|
+
constructor(parser: LlmOutputParserService, handlerRegistry: Map<string, ActionHandler>, postExecutionHooks: PostExecutionHook[], aiActionsRepository: Repository<AIAction>, sessionInputsRepository: Repository<SessionInput>, applicationStateService: ApplicationStateService, executionLogsService: ExecutionLogsService);
|
|
18
|
+
processTurn(sessionInput: SessionInput): Promise<SessionInput>;
|
|
19
|
+
private getSuccessStatusForStrategy;
|
|
20
|
+
}
|