repoburg 1.3.126 → 1.3.128
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/backend/.env +3 -1
- package/backend/dist/src/core-entities/system-prompt.entity.d.ts +1 -0
- package/backend/dist/src/core-entities/system-prompt.entity.js +8 -0
- package/backend/dist/src/core-entities/system-prompt.entity.js.map +1 -1
- package/backend/dist/src/llm-orchestration/action-handlers/invoke-subagent.handler.d.ts +3 -13
- package/backend/dist/src/llm-orchestration/action-handlers/invoke-subagent.handler.js +65 -187
- package/backend/dist/src/llm-orchestration/action-handlers/invoke-subagent.handler.js.map +1 -1
- package/backend/dist/src/llm-orchestration/action-handlers/mcp-tool-action.handler.js +2 -0
- package/backend/dist/src/llm-orchestration/action-handlers/mcp-tool-action.handler.js.map +1 -1
- package/backend/dist/src/llm-orchestration/llm-orchestration.module.js +3 -12
- package/backend/dist/src/llm-orchestration/llm-orchestration.module.js.map +1 -1
- package/backend/dist/src/llm-orchestration/llm-turn-processor.service.d.ts +1 -3
- package/backend/dist/src/llm-orchestration/llm-turn-processor.service.js +2 -33
- package/backend/dist/src/llm-orchestration/llm-turn-processor.service.js.map +1 -1
- package/backend/dist/src/llm-orchestration/tool-schema.service.js +8 -4
- package/backend/dist/src/llm-orchestration/tool-schema.service.js.map +1 -1
- package/backend/dist/src/mcp/mcp.service.d.ts +1 -0
- package/backend/dist/src/mcp/mcp.service.js +16 -0
- package/backend/dist/src/mcp/mcp.service.js.map +1 -1
- package/backend/dist/src/seeding/data/sub-agents/browser-use.d.ts +9 -0
- package/backend/dist/src/seeding/data/sub-agents/browser-use.js +13 -0
- package/backend/dist/src/seeding/data/sub-agents/browser-use.js.map +1 -0
- package/backend/dist/src/seeding/data/sub-agents/explore-codebase.d.ts +3 -3
- package/backend/dist/src/seeding/data/sub-agents/explore-codebase.js +3 -3
- package/backend/dist/src/seeding/data/sub-agents/explore-codebase.js.map +1 -1
- package/backend/dist/src/seeding/data/system-prompts/browser-use-agent.d.ts +3 -0
- package/backend/dist/src/seeding/data/system-prompts/browser-use-agent.js +39 -0
- package/backend/dist/src/seeding/data/system-prompts/browser-use-agent.js.map +1 -0
- package/backend/dist/src/seeding/data/system-prompts/default_native_tool_agent.d.ts +1 -1
- package/backend/dist/src/seeding/data/system-prompts/default_native_tool_agent.js +5 -5
- package/backend/dist/src/seeding/data/system-prompts/master-agent.d.ts +1 -1
- package/backend/dist/src/seeding/data/system-prompts/master-agent.js +14 -3
- package/backend/dist/src/seeding/data/system-prompts/master-agent.js.map +1 -1
- package/backend/dist/src/seeding/sub-agent-seeding.service.js +14 -1
- package/backend/dist/src/seeding/sub-agent-seeding.service.js.map +1 -1
- package/backend/dist/src/sub-agents/dto/create-sub-agent.dto.d.ts +1 -0
- package/backend/dist/src/sub-agents/dto/create-sub-agent.dto.js +8 -0
- package/backend/dist/src/sub-agents/dto/create-sub-agent.dto.js.map +1 -1
- package/backend/dist/src/sub-agents/dto/update-sub-agent.dto.d.ts +1 -0
- package/backend/dist/src/sub-agents/dto/update-sub-agent.dto.js +7 -0
- package/backend/dist/src/sub-agents/dto/update-sub-agent.dto.js.map +1 -1
- package/backend/dist/src/sub-agents/sub-agent-runner.service.d.ts +47 -0
- package/backend/dist/src/sub-agents/sub-agent-runner.service.js +523 -0
- package/backend/dist/src/sub-agents/sub-agent-runner.service.js.map +1 -0
- package/backend/dist/src/sub-agents/sub-agent-runs.controller.d.ts +4 -3
- package/backend/dist/src/sub-agents/sub-agent-runs.controller.js +10 -5
- package/backend/dist/src/sub-agents/sub-agent-runs.controller.js.map +1 -1
- package/backend/dist/src/sub-agents/sub-agent.entity.d.ts +1 -0
- package/backend/dist/src/sub-agents/sub-agent.entity.js +8 -0
- package/backend/dist/src/sub-agents/sub-agent.entity.js.map +1 -1
- package/backend/dist/src/sub-agents/sub-agents.module.js +16 -5
- package/backend/dist/src/sub-agents/sub-agents.module.js.map +1 -1
- package/backend/dist/src/sub-agents/sub-agents.service.d.ts +2 -0
- package/backend/dist/src/sub-agents/sub-agents.service.js +42 -2
- package/backend/dist/src/sub-agents/sub-agents.service.js.map +1 -1
- package/backend/dist/src/system-prompts/dto/set-enabled-mcp-tools.dto.d.ts +4 -0
- package/backend/dist/src/system-prompts/dto/set-enabled-mcp-tools.dto.js +38 -0
- package/backend/dist/src/system-prompts/dto/set-enabled-mcp-tools.dto.js.map +1 -0
- package/backend/dist/src/system-prompts/dto/system-prompt.dto.d.ts +2 -0
- package/backend/dist/src/system-prompts/dto/system-prompt.dto.js +16 -0
- package/backend/dist/src/system-prompts/dto/system-prompt.dto.js.map +1 -1
- package/backend/dist/src/system-prompts/dto/toggle-mcp-tool.dto.d.ts +3 -0
- package/backend/dist/src/system-prompts/dto/toggle-mcp-tool.dto.js +27 -0
- package/backend/dist/src/system-prompts/dto/toggle-mcp-tool.dto.js.map +1 -0
- package/backend/dist/src/system-prompts/system-prompts.controller.d.ts +17 -0
- package/backend/dist/src/system-prompts/system-prompts.controller.js +83 -0
- package/backend/dist/src/system-prompts/system-prompts.controller.js.map +1 -1
- package/backend/dist/src/system-prompts/system-prompts.service.d.ts +11 -0
- package/backend/dist/src/system-prompts/system-prompts.service.js +115 -1
- package/backend/dist/src/system-prompts/system-prompts.service.js.map +1 -1
- package/backend/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/backend/dist/src/llm-orchestration/hooks/sub-agent-final-response.hook.d.ts +0 -14
- package/backend/dist/src/llm-orchestration/hooks/sub-agent-final-response.hook.js +0 -80
- package/backend/dist/src/llm-orchestration/hooks/sub-agent-final-response.hook.js.map +0 -1
- package/backend/dist/src/seeding/data/sub-agents/handover-session.d.ts +0 -8
- package/backend/dist/src/seeding/data/sub-agents/handover-session.js +0 -18
- package/backend/dist/src/seeding/data/sub-agents/handover-session.js.map +0 -1
- package/backend/dist/src/seeding/data/system-prompts/handover-agent.d.ts +0 -3
- package/backend/dist/src/seeding/data/system-prompts/handover-agent.js +0 -69
- package/backend/dist/src/seeding/data/system-prompts/handover-agent.js.map +0 -1
package/backend/.env
CHANGED
|
@@ -12,12 +12,14 @@
|
|
|
12
12
|
# webcoder
|
|
13
13
|
# REPOBURG_PROJECT_PATH=/Users/celalertug/github/webcoder
|
|
14
14
|
|
|
15
|
-
REPOBURG_PROJECT_PATH=/Users/celalertug/tmp/randomproject
|
|
15
|
+
# REPOBURG_PROJECT_PATH=/Users/celalertug/tmp/randomproject
|
|
16
16
|
# REPOBURG_PROJECT_PATH=/Users/celalertug/repoburg-projects/simple-erp
|
|
17
17
|
|
|
18
18
|
# appdev
|
|
19
19
|
# REPOBURG_PROJECT_PATH=/Users/celalertug/everest/tmpappdev2
|
|
20
20
|
# REPOBURG_PROJECT_PATH=/Users/celalertug/everest/tmpappdev2-session2
|
|
21
|
+
|
|
22
|
+
REPOBURG_PROJECT_PATH=/Users/celalertug/repoburg-projects/isgorusmetakip
|
|
21
23
|
|
|
22
24
|
|
|
23
25
|
QUICK_EDIT_LOG_DIR=/Users/celalertug/.repoburg/quick-edit-logs
|
|
@@ -57,6 +57,14 @@ __decorate([
|
|
|
57
57
|
(0, typeorm_1.Column)({ type: 'text', nullable: true }),
|
|
58
58
|
__metadata("design:type", String)
|
|
59
59
|
], SystemPrompt.prototype, "enabledTools", void 0);
|
|
60
|
+
__decorate([
|
|
61
|
+
(0, swagger_1.ApiPropertyOptional)({
|
|
62
|
+
description: 'Enabled MCP tools: "all" or JSON array of serverName__toolName identifiers. "all" inherits globally active MCP tools.',
|
|
63
|
+
example: 'all',
|
|
64
|
+
}),
|
|
65
|
+
(0, typeorm_1.Column)({ type: 'text', nullable: true }),
|
|
66
|
+
__metadata("design:type", String)
|
|
67
|
+
], SystemPrompt.prototype, "enabledMcpTools", void 0);
|
|
60
68
|
__decorate([
|
|
61
69
|
(0, swagger_1.ApiPropertyOptional)({
|
|
62
70
|
description: 'Token limit for follow-up context generation',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"system-prompt.entity.js","sourceRoot":"","sources":["../../../src/core-entities/system-prompt.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCAAoD;AACpD,6CAAmE;AACnE,+CAA2C;AAC3C,qDAA2C;AAWpC,IAAM,YAAY,GAAlB,MAAM,YAAa,SAAQ,wBAAU;
|
|
1
|
+
{"version":3,"file":"system-prompt.entity.js","sourceRoot":"","sources":["../../../src/core-entities/system-prompt.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCAAoD;AACpD,6CAAmE;AACnE,+CAA2C;AAC3C,qDAA2C;AAWpC,IAAM,YAAY,GAAlB,MAAM,YAAa,SAAQ,wBAAU;CAyE3C,CAAA;AAzEY,oCAAY;AAMvB;IALC,IAAA,qBAAW,EAAC;QACX,WAAW,EAAE,4CAA4C;QACzD,OAAO,EAAE,mBAAmB;KAC7B,CAAC;IACD,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;iDACL;AAOpB;IALC,IAAA,qBAAW,EAAC;QACX,WAAW,EACT,8FAA8F;KACjG,CAAC;IACD,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;oDACF;AAQvB;IANC,IAAA,qBAAW,EAAC;QACX,WAAW,EAAE,4DAA4D;QACzE,OAAO,EAAE,IAAI;QACb,OAAO,EAAE,KAAK;KACf,CAAC;IACD,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;;gDACxB;AAOpB;IALC,IAAA,6BAAmB,EAAC;QACnB,WAAW,EAAE,qDAAqD;QAClE,OAAO,EAAE,6BAA6B;KACvC,CAAC;IACD,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;yCAC7B;AAOZ;IALC,IAAA,6BAAmB,EAAC;QACnB,WAAW,EAAE,kDAAkD;QAC/D,OAAO,EAAE,KAAK;KACf,CAAC;IACD,IAAA,gBAAM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ActionHandler } from './action-handler.interface';
|
|
2
2
|
import { ActionExecutionResult, PlanExecutionContext, ToolMetadata } from '../llm-orchestration.interfaces';
|
|
3
|
-
import {
|
|
4
|
-
import { SubAgentRunsService } from '../../sub-agents/sub-agent-runs.service';
|
|
5
|
-
import { SessionsService } from '../../sessions/sessions.service';
|
|
6
|
-
import { SessionInputsService } from '../../session-inputs/session-inputs.service';
|
|
7
|
-
import { MessageBusService } from '../../message-bus/message-bus.service';
|
|
3
|
+
import { SubAgentRunner } from '../../sub-agents/sub-agent-runner.service';
|
|
8
4
|
export declare class InvokeSubAgentHandler implements ActionHandler {
|
|
9
|
-
private readonly
|
|
10
|
-
private readonly subAgentRunsService;
|
|
11
|
-
private readonly sessionsService;
|
|
12
|
-
private readonly sessionInputsService;
|
|
13
|
-
private readonly messageBusService;
|
|
5
|
+
private readonly subAgentRunner;
|
|
14
6
|
readonly toolName = "invoke_subagent";
|
|
15
7
|
private readonly logger;
|
|
16
|
-
constructor(
|
|
8
|
+
constructor(subAgentRunner: SubAgentRunner);
|
|
17
9
|
getMetadata(): ToolMetadata;
|
|
18
10
|
getDefinition(): string;
|
|
19
11
|
execute(args: Record<string, any>, context: PlanExecutionContext): Promise<ActionExecutionResult>;
|
|
20
|
-
private handleNewDelegation;
|
|
21
|
-
private handleFollowUp;
|
|
22
12
|
}
|
|
@@ -12,54 +12,34 @@ var InvokeSubAgentHandler_1;
|
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
13
|
exports.InvokeSubAgentHandler = void 0;
|
|
14
14
|
const common_1 = require("@nestjs/common");
|
|
15
|
-
const
|
|
16
|
-
const sub_agent_runs_service_1 = require("../../sub-agents/sub-agent-runs.service");
|
|
17
|
-
const sessions_service_1 = require("../../sessions/sessions.service");
|
|
18
|
-
const session_inputs_service_1 = require("../../session-inputs/session-inputs.service");
|
|
19
|
-
const message_bus_service_1 = require("../../message-bus/message-bus.service");
|
|
15
|
+
const sub_agent_runner_service_1 = require("../../sub-agents/sub-agent-runner.service");
|
|
20
16
|
let InvokeSubAgentHandler = InvokeSubAgentHandler_1 = class InvokeSubAgentHandler {
|
|
21
|
-
constructor(
|
|
22
|
-
this.
|
|
23
|
-
this.subAgentRunsService = subAgentRunsService;
|
|
24
|
-
this.sessionsService = sessionsService;
|
|
25
|
-
this.sessionInputsService = sessionInputsService;
|
|
26
|
-
this.messageBusService = messageBusService;
|
|
17
|
+
constructor(subAgentRunner) {
|
|
18
|
+
this.subAgentRunner = subAgentRunner;
|
|
27
19
|
this.toolName = 'invoke_subagent';
|
|
28
20
|
this.logger = new common_1.Logger(InvokeSubAgentHandler_1.name);
|
|
29
21
|
}
|
|
30
22
|
getMetadata() {
|
|
31
23
|
return {
|
|
32
24
|
name: this.toolName,
|
|
33
|
-
description: 'Delegate a task to a specialized sub-agent. The sub-agent
|
|
25
|
+
description: 'Delegate a task to a specialized sub-agent. The sub-agent runs synchronously and returns its result directly.',
|
|
34
26
|
arguments: [
|
|
35
27
|
{
|
|
36
28
|
name: 'agent_name',
|
|
37
29
|
type: 'string',
|
|
38
|
-
description: 'The name of sub-agent to invoke',
|
|
30
|
+
description: 'The name of the sub-agent to invoke',
|
|
39
31
|
required: true,
|
|
40
32
|
},
|
|
41
33
|
{
|
|
42
34
|
name: 'prompt',
|
|
43
35
|
type: 'string',
|
|
44
|
-
description: 'The task or question to pass to sub-agent',
|
|
36
|
+
description: 'The task or question to pass to the sub-agent',
|
|
45
37
|
required: true,
|
|
46
38
|
},
|
|
47
|
-
{
|
|
48
|
-
name: 'pass_context',
|
|
49
|
-
type: 'boolean',
|
|
50
|
-
description: 'Whether to pass current master session context to sub-agent (default: false)',
|
|
51
|
-
required: false,
|
|
52
|
-
},
|
|
53
|
-
{
|
|
54
|
-
name: 'context_files',
|
|
55
|
-
type: 'array',
|
|
56
|
-
description: 'Optional: specific files or folders to include in sub-agent context',
|
|
57
|
-
required: false,
|
|
58
|
-
},
|
|
59
39
|
{
|
|
60
40
|
name: 'session_id',
|
|
61
41
|
type: 'string',
|
|
62
|
-
description: 'Optional
|
|
42
|
+
description: 'Optional existing session ID to reuse. If provided, the sub-agent continues in that session with its prior history.',
|
|
63
43
|
required: false,
|
|
64
44
|
},
|
|
65
45
|
],
|
|
@@ -68,193 +48,95 @@ let InvokeSubAgentHandler = InvokeSubAgentHandler_1 = class InvokeSubAgentHandle
|
|
|
68
48
|
getDefinition() {
|
|
69
49
|
return `## invoke_subagent
|
|
70
50
|
|
|
71
|
-
Delegate a task to a specialized sub-agent. The sub-agent
|
|
51
|
+
Delegate a task to a specialized sub-agent. The sub-agent runs synchronously and returns its result directly.
|
|
72
52
|
|
|
73
53
|
### Behavior:
|
|
74
|
-
-
|
|
75
|
-
-
|
|
76
|
-
-
|
|
77
|
-
- You
|
|
54
|
+
- The sub-agent runs inline — this tool call blocks until the sub-agent completes.
|
|
55
|
+
- The sub-agent has its own system prompt, enabled tools, and LLM loop.
|
|
56
|
+
- Results are returned directly as the tool response — no follow-up needed.
|
|
57
|
+
- **Parallel invocation:** You can invoke multiple sub-agents in the same tool call block to run them in parallel. Use this when tasks are independent of each other.
|
|
58
|
+
- **Follow-up:** Each invocation returns a \`[Session ID: ...]\` in the output. Pass this as the \`session_id\` parameter on a subsequent call to continue that sub-agent's session with its prior history.
|
|
78
59
|
|
|
79
60
|
### Parameters:
|
|
80
|
-
- **agent_name** (required): The name of sub-agent to invoke
|
|
81
|
-
- **prompt** (required): The task or question to pass to sub-agent
|
|
82
|
-
- **
|
|
83
|
-
- **context_files** (optional): Specific files or folders to include in sub-agent's context
|
|
84
|
-
- **session_id** (optional): For follow-ups, specify existing sub-agent session ID to continue
|
|
61
|
+
- **agent_name** (required): The name of the sub-agent to invoke (e.g., "explore-codebase")
|
|
62
|
+
- **prompt** (required): The task or question to pass to the sub-agent
|
|
63
|
+
- **session_id** (optional): An existing session ID to reuse. If provided, the sub-agent continues in that session with its prior history instead of creating a new one.
|
|
85
64
|
|
|
86
|
-
### Example:
|
|
65
|
+
### Example (single invocation):
|
|
87
66
|
\`\`\`typescript
|
|
88
67
|
tool: invoke_subagent
|
|
89
68
|
args: {
|
|
90
|
-
agent_name: "
|
|
91
|
-
prompt: "
|
|
92
|
-
pass_context: true,
|
|
93
|
-
context_files: ["src/auth/**/*.ts"]
|
|
69
|
+
agent_name: "explore-codebase",
|
|
70
|
+
prompt: "Find all files related to authentication in the codebase"
|
|
94
71
|
}
|
|
95
72
|
\`\`\`
|
|
96
73
|
|
|
97
|
-
|
|
74
|
+
### Example (parallel invocation):
|
|
98
75
|
\`\`\`typescript
|
|
76
|
+
// Invoke two independent sub-agents in the same tool call block:
|
|
99
77
|
tool: invoke_subagent
|
|
100
|
-
args: {
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
}
|
|
78
|
+
args: { agent_name: "explore-codebase", prompt: "Find auth files" }
|
|
79
|
+
|
|
80
|
+
tool: invoke_subagent
|
|
81
|
+
args: { agent_name: "explore-codebase", prompt: "Find database models" }
|
|
82
|
+
\`\`\`
|
|
83
|
+
|
|
84
|
+
### Example (follow-up with session_id):
|
|
85
|
+
\`\`\`typescript
|
|
86
|
+
// Continue a prior sub-agent session using the Session ID from a previous result:
|
|
87
|
+
tool: invoke_subagent
|
|
88
|
+
args: { agent_name: "explore-codebase", prompt: "Now find the tests for those files", session_id: "abc-123" }
|
|
104
89
|
\`\`\``;
|
|
105
90
|
}
|
|
106
91
|
async execute(args, context) {
|
|
107
|
-
const { agent_name, prompt,
|
|
108
|
-
this.logger.log(
|
|
109
|
-
this.logger.log(`args: ${JSON.stringify(args)}`);
|
|
110
|
-
this.logger.log(`context_files: ${JSON.stringify(context_files)}`);
|
|
111
|
-
if (session_id) {
|
|
112
|
-
return this.handleFollowUp(session_id, prompt, context);
|
|
113
|
-
}
|
|
114
|
-
return this.handleNewDelegation(agent_name, prompt, pass_context || false, context_files, context);
|
|
115
|
-
}
|
|
116
|
-
async handleNewDelegation(agentName, prompt, passContext, contextFiles, context) {
|
|
92
|
+
const { agent_name, prompt, session_id } = args;
|
|
93
|
+
this.logger.log(`Invoking sub-agent "${agent_name}" from session ${context.session_id}${session_id ? ` (reusing session ${session_id})` : ''}`);
|
|
117
94
|
try {
|
|
118
|
-
this.
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
this.logger.log(`contextFiles: ${JSON.stringify(contextFiles)}`);
|
|
122
|
-
const subAgent = await this.subAgentsService.getAgentByName(agentName);
|
|
123
|
-
if (!subAgent) {
|
|
124
|
-
const availableAgents = (await this.subAgentsService.findActive())
|
|
125
|
-
.map((a) => a.name)
|
|
126
|
-
.join(', ');
|
|
95
|
+
const result = await this.subAgentRunner.runAgent(agent_name, prompt, context.session_id, session_id ? { sessionId: session_id } : undefined);
|
|
96
|
+
const outputWithSessionId = `${result.content}\n\n[Session ID: ${result.childSessionId}]`;
|
|
97
|
+
if (result.success) {
|
|
127
98
|
return {
|
|
128
|
-
status: '
|
|
129
|
-
summary: `Sub-agent "${
|
|
130
|
-
|
|
99
|
+
status: 'SUCCESS',
|
|
100
|
+
summary: `Sub-agent "${agent_name}" completed successfully in ${result.iterations} iteration(s).`,
|
|
101
|
+
persisted_args: {
|
|
102
|
+
arguments: JSON.stringify(args),
|
|
103
|
+
agentName: agent_name,
|
|
104
|
+
prompt,
|
|
105
|
+
childSessionId: result.childSessionId,
|
|
106
|
+
plain: result.content,
|
|
107
|
+
reason: `Sub-agent session: ${result.childSessionId}`,
|
|
108
|
+
},
|
|
131
109
|
execution_log: {
|
|
132
|
-
output:
|
|
133
|
-
error_message:
|
|
110
|
+
output: outputWithSessionId,
|
|
111
|
+
error_message: '',
|
|
134
112
|
},
|
|
135
113
|
};
|
|
136
114
|
}
|
|
137
|
-
|
|
138
|
-
session_title: `Sub-Agent: ${agentName}`,
|
|
139
|
-
system_prompt_id: subAgent.system_prompt_id || undefined,
|
|
140
|
-
default_initial_context_template_id: subAgent.context_template_id || undefined,
|
|
141
|
-
default_followup_context_template_id: subAgent.followup_context_template_id || undefined,
|
|
142
|
-
model_id: subAgent.model_id || undefined,
|
|
143
|
-
sub_agent_id: subAgent.id,
|
|
144
|
-
parent_session_id: context.session_id,
|
|
145
|
-
});
|
|
146
|
-
this.logger.log(`Created session: ${subAgentSession.id}`);
|
|
147
|
-
await this.subAgentRunsService.create({
|
|
148
|
-
parent_session_id: context.session_id,
|
|
149
|
-
child_session_id: subAgentSession.id,
|
|
150
|
-
sub_agent_id: subAgent.id,
|
|
151
|
-
agent_name: agentName,
|
|
152
|
-
initial_prompt: prompt,
|
|
153
|
-
});
|
|
154
|
-
this.logger.log(`Created SubAgentRun for parent ${context.session_id} -> child ${subAgentSession.id}`);
|
|
155
|
-
const adHocContextDef = passContext
|
|
156
|
-
? context.masterContextDefinition
|
|
157
|
-
: undefined;
|
|
158
|
-
const contextFilesDef = contextFiles
|
|
159
|
-
? { files: contextFiles, folders: [] }
|
|
160
|
-
: undefined;
|
|
161
|
-
this.logger.log(`adHocContextDef: ${JSON.stringify(adHocContextDef)}`);
|
|
162
|
-
this.logger.log(`contextFilesDef: ${JSON.stringify(contextFilesDef)}`);
|
|
163
|
-
let finalAdHocContextDef = undefined;
|
|
164
|
-
if (adHocContextDef && contextFilesDef) {
|
|
165
|
-
finalAdHocContextDef = {
|
|
166
|
-
...adHocContextDef,
|
|
167
|
-
files: [...(adHocContextDef.files || []), ...contextFilesDef.files],
|
|
168
|
-
folders: [
|
|
169
|
-
...(adHocContextDef.folders || []),
|
|
170
|
-
...contextFilesDef.folders,
|
|
171
|
-
],
|
|
172
|
-
};
|
|
173
|
-
}
|
|
174
|
-
else if (adHocContextDef) {
|
|
175
|
-
finalAdHocContextDef = adHocContextDef;
|
|
176
|
-
}
|
|
177
|
-
else if (contextFilesDef) {
|
|
178
|
-
finalAdHocContextDef = contextFilesDef;
|
|
179
|
-
}
|
|
180
|
-
this.logger.log(`finalAdHocContextDef: ${JSON.stringify(finalAdHocContextDef)}`);
|
|
181
|
-
const createInputDto = {
|
|
182
|
-
user_prompt: prompt,
|
|
183
|
-
context_template_id: subAgent.context_template_id || undefined,
|
|
184
|
-
ad_hoc_context_definition: finalAdHocContextDef
|
|
185
|
-
? JSON.stringify(finalAdHocContextDef)
|
|
186
|
-
: undefined,
|
|
187
|
-
execution_strategy: 'auto_apply',
|
|
188
|
-
};
|
|
189
|
-
this.logger.log(`createInputDto: ${JSON.stringify(createInputDto)}`);
|
|
190
|
-
await this.sessionInputsService.create(subAgentSession.id, createInputDto);
|
|
191
|
-
return {
|
|
192
|
-
status: 'SUCCESS',
|
|
193
|
-
summary: `Invoked sub-agent "${agentName}" - session ID: ${subAgentSession.id}`,
|
|
194
|
-
persisted_args: {
|
|
195
|
-
sub_agent_session_id: subAgentSession.id,
|
|
196
|
-
agentName,
|
|
197
|
-
prompt,
|
|
198
|
-
},
|
|
199
|
-
execution_log: {
|
|
200
|
-
output: `Sub-agent "${agentName}" spawned successfully.\n\nSession ID: ${subAgentSession.id}\n\nNote: You may spawn additional subagents for parallel execution. Regular tools (create_file, run_command, etc.) will be blocked until all subagent results are received.`,
|
|
201
|
-
error_message: '',
|
|
202
|
-
},
|
|
203
|
-
};
|
|
204
|
-
}
|
|
205
|
-
catch (error) {
|
|
206
|
-
return {
|
|
207
|
-
status: 'FAILURE',
|
|
208
|
-
summary: 'Failed to invoke sub-agent',
|
|
209
|
-
error_message: error.message,
|
|
210
|
-
execution_log: {
|
|
211
|
-
output: '',
|
|
212
|
-
error_message: error.message,
|
|
213
|
-
},
|
|
214
|
-
};
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
async handleFollowUp(sessionId, prompt, _context) {
|
|
218
|
-
try {
|
|
219
|
-
const childSession = await this.sessionsService.findOne(sessionId);
|
|
220
|
-
if (!childSession || !childSession.parent_session_id) {
|
|
115
|
+
else {
|
|
221
116
|
return {
|
|
222
117
|
status: 'FAILURE',
|
|
223
|
-
summary:
|
|
224
|
-
error_message:
|
|
118
|
+
summary: `Sub-agent "${agent_name}" failed or could not complete.`,
|
|
119
|
+
error_message: result.content,
|
|
120
|
+
persisted_args: {
|
|
121
|
+
arguments: JSON.stringify(args),
|
|
122
|
+
agentName: agent_name,
|
|
123
|
+
prompt,
|
|
124
|
+
childSessionId: result.childSessionId,
|
|
125
|
+
plain: result.content,
|
|
126
|
+
reason: `Sub-agent session: ${result.childSessionId}`,
|
|
127
|
+
},
|
|
225
128
|
execution_log: {
|
|
226
|
-
output:
|
|
227
|
-
error_message:
|
|
129
|
+
output: outputWithSessionId,
|
|
130
|
+
error_message: result.content,
|
|
228
131
|
},
|
|
229
132
|
};
|
|
230
133
|
}
|
|
231
|
-
const createInputDto = {
|
|
232
|
-
user_prompt: prompt,
|
|
233
|
-
context_template_id: childSession.default_followup_context_template_id || undefined,
|
|
234
|
-
execution_strategy: 'auto_apply',
|
|
235
|
-
};
|
|
236
|
-
const sessionInput = await this.sessionInputsService.create(sessionId, createInputDto);
|
|
237
|
-
this.messageBusService.submit({
|
|
238
|
-
event: 'plan-ready',
|
|
239
|
-
data: {
|
|
240
|
-
sessionId,
|
|
241
|
-
sessionInputId: sessionInput.id,
|
|
242
|
-
},
|
|
243
|
-
});
|
|
244
|
-
return {
|
|
245
|
-
status: 'SUCCESS',
|
|
246
|
-
summary: 'Continuing conversation with sub-agent',
|
|
247
|
-
persisted_args: { sessionId, prompt },
|
|
248
|
-
execution_log: {
|
|
249
|
-
output: `Follow-up sent to sub-agent session ${sessionId}.\n\nNote: Regular tools remain blocked until all subagent results are received.`,
|
|
250
|
-
error_message: '',
|
|
251
|
-
},
|
|
252
|
-
};
|
|
253
134
|
}
|
|
254
135
|
catch (error) {
|
|
136
|
+
this.logger.error(`Sub-agent "${agent_name}" execution error: ${error.message}`, error.stack);
|
|
255
137
|
return {
|
|
256
138
|
status: 'FAILURE',
|
|
257
|
-
summary:
|
|
139
|
+
summary: `Failed to invoke sub-agent "${agent_name}"`,
|
|
258
140
|
error_message: error.message,
|
|
259
141
|
execution_log: {
|
|
260
142
|
output: '',
|
|
@@ -267,10 +149,6 @@ args: {
|
|
|
267
149
|
exports.InvokeSubAgentHandler = InvokeSubAgentHandler;
|
|
268
150
|
exports.InvokeSubAgentHandler = InvokeSubAgentHandler = InvokeSubAgentHandler_1 = __decorate([
|
|
269
151
|
(0, common_1.Injectable)(),
|
|
270
|
-
__metadata("design:paramtypes", [
|
|
271
|
-
sub_agent_runs_service_1.SubAgentRunsService,
|
|
272
|
-
sessions_service_1.SessionsService,
|
|
273
|
-
session_inputs_service_1.SessionInputsService,
|
|
274
|
-
message_bus_service_1.MessageBusService])
|
|
152
|
+
__metadata("design:paramtypes", [sub_agent_runner_service_1.SubAgentRunner])
|
|
275
153
|
], InvokeSubAgentHandler);
|
|
276
154
|
//# sourceMappingURL=invoke-subagent.handler.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"invoke-subagent.handler.js","sourceRoot":"","sources":["../../../../src/llm-orchestration/action-handlers/invoke-subagent.handler.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,2CAAoD;AAQpD,
|
|
1
|
+
{"version":3,"file":"invoke-subagent.handler.js","sourceRoot":"","sources":["../../../../src/llm-orchestration/action-handlers/invoke-subagent.handler.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,2CAAoD;AAQpD,wFAA2E;AAGpE,IAAM,qBAAqB,6BAA3B,MAAM,qBAAqB;IAIhC,YAA6B,cAA8B;QAA9B,mBAAc,GAAd,cAAc,CAAgB;QAHlD,aAAQ,GAAG,iBAAiB,CAAC;QACrB,WAAM,GAAG,IAAI,eAAM,CAAC,uBAAqB,CAAC,IAAI,CAAC,CAAC;IAEH,CAAC;IAE/D,WAAW;QACT,OAAO;YACL,IAAI,EAAE,IAAI,CAAC,QAAQ;YACnB,WAAW,EACT,+GAA+G;YACjH,SAAS,EAAE;gBACT;oBACE,IAAI,EAAE,YAAY;oBAClB,IAAI,EAAE,QAAiB;oBACvB,WAAW,EAAE,qCAAqC;oBAClD,QAAQ,EAAE,IAAI;iBACf;gBACD;oBACE,IAAI,EAAE,QAAQ;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serverName}", tool "${this.toolNameRaw}".`;
|
|
|
36
36
|
server_name: this.serverName,
|
|
37
37
|
tool_name: this.toolNameRaw,
|
|
38
38
|
arguments: JSON.stringify(args),
|
|
39
|
+
plain: unifiedOutput,
|
|
39
40
|
},
|
|
40
41
|
execution_log: {
|
|
41
42
|
output: unifiedOutput,
|
|
@@ -51,6 +52,7 @@ Executed via MCP server "${this.serverName}", tool "${this.toolNameRaw}".`;
|
|
|
51
52
|
server_name: this.serverName,
|
|
52
53
|
tool_name: this.toolNameRaw,
|
|
53
54
|
arguments: JSON.stringify(args),
|
|
55
|
+
plain: `Error: ${error.message}`,
|
|
54
56
|
},
|
|
55
57
|
execution_log: {
|
|
56
58
|
output: '',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-tool-action.handler.js","sourceRoot":"","sources":["../../../../src/llm-orchestration/action-handlers/mcp-tool-action.handler.ts"],"names":[],"mappings":";;;AAAA,2CAAwC;AAiBxC,MAAa,oBAAoB;IAI/B,YACmB,UAAkB,EAClB,WAAmB,EACnB,UAAsB,EACtB,eAAuB;QAHvB,eAAU,GAAV,UAAU,CAAQ;QAClB,gBAAW,GAAX,WAAW,CAAQ;QACnB,eAAU,GAAV,UAAU,CAAY;QACtB,oBAAe,GAAf,eAAe,CAAQ;QANzB,WAAM,GAAG,IAAI,eAAM,CAAC,oBAAoB,CAAC,IAAI,CAAC,CAAC;QAQ9D,IAAI,CAAC,QAAQ,GAAG,GAAG,UAAU,KAAK,WAAW,EAAE,CAAC;IAClD,CAAC;IAED,WAAW;QACT,OAAO;YACL,IAAI,EAAE,IAAI,CAAC,QAAQ;YACnB,WAAW,EAAE,IAAI,CAAC,eAAe;YACjC,SAAS,EAAE,EAAE;SACd,CAAC;IACJ,CAAC;IAED,aAAa;QACX,OAAO,MAAM,IAAI,CAAC,QAAQ;;EAE5B,IAAI,CAAC,eAAe;;2BAEK,IAAI,CAAC,UAAU,YAAY,IAAI,CAAC,WAAW,IAAI,CAAC;IACzE,CAAC;IAED,KAAK,CAAC,OAAO,CACX,IAAyB,EACzB,QAA8B;QAE9B,IAAI,CAAC;YACH,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,cAAc,CAC7D,IAAI,CAAC,UAAU,EACf,IAAI,CAAC,WAAW,EAChB,IAAI,CACL,CAAC;YAEF,MAAM,aAAa,GAAG,MAAM,IAAI,MAAM,IAAI,2BAA2B,CAAC;YAEtE,OAAO;gBACL,MAAM,EAAE,SAAS;gBACjB,OAAO,EAAE,aAAa,IAAI,CAAC,UAAU,IAAI,IAAI,CAAC,WAAW,aAAa;gBACtE,cAAc,EAAE;oBACd,WAAW,EAAE,IAAI,CAAC,UAAU;oBAC5B,SAAS,EAAE,IAAI,CAAC,WAAW;oBAC3B,SAAS,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"mcp-tool-action.handler.js","sourceRoot":"","sources":["../../../../src/llm-orchestration/action-handlers/mcp-tool-action.handler.ts"],"names":[],"mappings":";;;AAAA,2CAAwC;AAiBxC,MAAa,oBAAoB;IAI/B,YACmB,UAAkB,EAClB,WAAmB,EACnB,UAAsB,EACtB,eAAuB;QAHvB,eAAU,GAAV,UAAU,CAAQ;QAClB,gBAAW,GAAX,WAAW,CAAQ;QACnB,eAAU,GAAV,UAAU,CAAY;QACtB,oBAAe,GAAf,eAAe,CAAQ;QANzB,WAAM,GAAG,IAAI,eAAM,CAAC,oBAAoB,CAAC,IAAI,CAAC,CAAC;QAQ9D,IAAI,CAAC,QAAQ,GAAG,GAAG,UAAU,KAAK,WAAW,EAAE,CAAC;IAClD,CAAC;IAED,WAAW;QACT,OAAO;YACL,IAAI,EAAE,IAAI,CAAC,QAAQ;YACnB,WAAW,EAAE,IAAI,CAAC,eAAe;YACjC,SAAS,EAAE,EAAE;SACd,CAAC;IACJ,CAAC;IAED,aAAa;QACX,OAAO,MAAM,IAAI,CAAC,QA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,CAAC;QACJ,CAAC;IACH,CAAC;CACF;AAzED,oDAyEC"}
|
|
@@ -50,7 +50,6 @@ const ask_user_handler_1 = require("./action-handlers/ask-user.handler");
|
|
|
50
50
|
const get_messages_handler_1 = require("./action-handlers/get-messages.handler");
|
|
51
51
|
const discard_messages_handler_1 = require("./action-handlers/discard-messages.handler");
|
|
52
52
|
const invalid_tool_feedback_hook_1 = require("./hooks/invalid-tool-feedback.hook");
|
|
53
|
-
const sub_agent_final_response_hook_1 = require("./hooks/sub-agent-final-response.hook");
|
|
54
53
|
const frontend_notification_hook_1 = require("./hooks/frontend-notification.hook");
|
|
55
54
|
const follow_up_post_execution_hook_1 = require("./hooks/follow-up-post-execution.hook");
|
|
56
55
|
const yolo_mode_post_execution_hook_1 = require("./hooks/yolo-mode-post-execution.hook");
|
|
@@ -60,7 +59,7 @@ exports.LlmOrchestrationModule = LlmOrchestrationModule;
|
|
|
60
59
|
exports.LlmOrchestrationModule = LlmOrchestrationModule = __decorate([
|
|
61
60
|
(0, common_1.Module)({
|
|
62
61
|
imports: [
|
|
63
|
-
typeorm_1.TypeOrmModule.forFeature([core_entities_1.AIAction, core_entities_1.SessionInput, core_entities_1.
|
|
62
|
+
typeorm_1.TypeOrmModule.forFeature([core_entities_1.AIAction, core_entities_1.SessionInput, core_entities_1.Session, core_entities_1.SystemPrompt]),
|
|
64
63
|
(0, common_1.forwardRef)(() => ai_actions_module_1.AIActionsModule),
|
|
65
64
|
(0, common_1.forwardRef)(() => session_inputs_module_1.SessionInputsModule),
|
|
66
65
|
(0, common_1.forwardRef)(() => chat_module_1.InteractiveChatModule),
|
|
@@ -106,7 +105,6 @@ exports.LlmOrchestrationModule = LlmOrchestrationModule = __decorate([
|
|
|
106
105
|
frontend_notification_hook_1.FrontendNotificationHook,
|
|
107
106
|
follow_up_post_execution_hook_1.FollowUpPostExecutionHook,
|
|
108
107
|
yolo_mode_post_execution_hook_1.YoloModePostExecutionHook,
|
|
109
|
-
sub_agent_final_response_hook_1.SubAgentFinalResponseHook,
|
|
110
108
|
{
|
|
111
109
|
provide: 'ACTION_HANDLER_REGISTRY',
|
|
112
110
|
useFactory: (createFile, deleteFile, overwriteFile, runCommand, requestContext, final, quickEdit, applyDiff, patch, newSession, writeTodo, executeCode, howto, invokeSubAgent, listSubAgents, getSessionHistory, generateTitle, askUser, getMessages, discardMessages) => {
|
|
@@ -158,21 +156,14 @@ exports.LlmOrchestrationModule = LlmOrchestrationModule = __decorate([
|
|
|
158
156
|
},
|
|
159
157
|
{
|
|
160
158
|
provide: 'POST_EXECUTION_HOOKS',
|
|
161
|
-
useFactory: (invalidTool, frontendNotification, followUp, yoloMode
|
|
162
|
-
return [
|
|
163
|
-
invalidTool,
|
|
164
|
-
yoloMode,
|
|
165
|
-
subAgentFinalResponse,
|
|
166
|
-
followUp,
|
|
167
|
-
frontendNotification,
|
|
168
|
-
];
|
|
159
|
+
useFactory: (invalidTool, frontendNotification, followUp, yoloMode) => {
|
|
160
|
+
return [invalidTool, yoloMode, followUp, frontendNotification];
|
|
169
161
|
},
|
|
170
162
|
inject: [
|
|
171
163
|
invalid_tool_feedback_hook_1.InvalidToolFeedbackHook,
|
|
172
164
|
frontend_notification_hook_1.FrontendNotificationHook,
|
|
173
165
|
follow_up_post_execution_hook_1.FollowUpPostExecutionHook,
|
|
174
166
|
yolo_mode_post_execution_hook_1.YoloModePostExecutionHook,
|
|
175
|
-
sub_agent_final_response_hook_1.SubAgentFinalResponseHook,
|
|
176
167
|
],
|
|
177
168
|
},
|
|
178
169
|
],
|
|
@@ -1 +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,kFAA4E;AAC5E,6EAAuE;AACvE,+DAA0D;AAC1D,+EAA0E;AAC1E,uEAAkE;AAClE,mFAA8E;AAC9E,iEAAwE;AAExE,2DAAuD;AACvD,4FAAuF;AACvF,0EAAqE;AACrE,oDAK0B;AAC1B,mFAA8E;AAE9E,mFAA8E;AAC9E,iEAA6D;AAC7D,oEAAgE;AAChE,kDAA8C;AAC9C,uEAAkE;AAClE,uEAAkE;AAClE,4FAAuF;AACvF,+FAA0F;AAG1F,+EAA0E;AAC1E,+EAA0E;AAC1E,qFAAgF;AAChF,+EAA0E;AAC1E,uFAAkF;AAClF,mEAA+D;AAC/D,6EAAwE;AACxE,6EAAwE;AACxE,mEAA+D;AAC/D,+EAA0E;AAC1E,6EAAwE;AACxE,iFAA4E;AAC5E,mEAA+D;AAC/D,uFAAkF;AAClF,uFAAiF;AACjF,+FAAyF;AACzF,qFAAgF;AAChF,yEAAoE;AACpE,iFAA4E;AAC5E,yFAAoF;AAGpF,mFAA6E;AAC7E,
|
|
1
|
+
{"version":3,"file":"llm-orchestration.module.js","sourceRoot":"","sources":["../../../src/llm-orchestration/llm-orchestration.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAoD;AACpD,6CAAgD;AAChD,kFAA4E;AAC5E,6EAAuE;AACvE,+DAA0D;AAC1D,+EAA0E;AAC1E,uEAAkE;AAClE,mFAA8E;AAC9E,iEAAwE;AAExE,2DAAuD;AACvD,4FAAuF;AACvF,0EAAqE;AACrE,oDAK0B;AAC1B,mFAA8E;AAE9E,mFAA8E;AAC9E,iEAA6D;AAC7D,oEAAgE;AAChE,kDAA8C;AAC9C,uEAAkE;AAClE,uEAAkE;AAClE,4FAAuF;AACvF,+FAA0F;AAG1F,+EAA0E;AAC1E,+EAA0E;AAC1E,qFAAgF;AAChF,+EAA0E;AAC1E,uFAAkF;AAClF,mEAA+D;AAC/D,6EAAwE;AACxE,6EAAwE;AACxE,mEAA+D;AAC/D,+EAA0E;AAC1E,6EAAwE;AACxE,iFAA4E;AAC5E,mEAA+D;AAC/D,uFAAkF;AAClF,uFAAiF;AACjF,+FAAyF;AACzF,qFAAgF;AAChF,yEAAoE;AACpE,iFAA4E;AAC5E,y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ACF;QACD,OAAO,EAAE;YACP,oDAAuB;YACvB,uCAAiB;YACjB,uDAAyB;YACzB,yBAAyB;SAC1B;KACF,CAAC;GACW,sBAAsB,CAAG"}
|
|
@@ -6,7 +6,6 @@ import { PostExecutionHook } from './hooks/post-execution-hook.interface';
|
|
|
6
6
|
import { ApplicationStateService } from '../application-state/application-state.service';
|
|
7
7
|
import { ExecutionLogsService } from '../execution-logs/execution-logs.service';
|
|
8
8
|
import { ToolHooksService } from '../tool-hooks/tool-hooks.service';
|
|
9
|
-
import { SubAgentRunsService } from '../sub-agents/sub-agent-runs.service';
|
|
10
9
|
import { McpService } from '../mcp/mcp.service';
|
|
11
10
|
export declare class LlmTurnProcessorService {
|
|
12
11
|
private readonly parser;
|
|
@@ -18,10 +17,9 @@ export declare class LlmTurnProcessorService {
|
|
|
18
17
|
private readonly applicationStateService;
|
|
19
18
|
private readonly executionLogsService;
|
|
20
19
|
private readonly toolHooksService;
|
|
21
|
-
private readonly subAgentRunsService;
|
|
22
20
|
private readonly mcpService;
|
|
23
21
|
private readonly logger;
|
|
24
|
-
constructor(parser: LlmOutputParserService, handlerRegistry: Map<string, ActionHandler>, postExecutionHooks: PostExecutionHook[], aiActionsRepository: Repository<AIAction>, sessionInputsRepository: Repository<SessionInput>, sessionsRepository: Repository<Session>, applicationStateService: ApplicationStateService, executionLogsService: ExecutionLogsService, toolHooksService: ToolHooksService,
|
|
22
|
+
constructor(parser: LlmOutputParserService, handlerRegistry: Map<string, ActionHandler>, postExecutionHooks: PostExecutionHook[], aiActionsRepository: Repository<AIAction>, sessionInputsRepository: Repository<SessionInput>, sessionsRepository: Repository<Session>, applicationStateService: ApplicationStateService, executionLogsService: ExecutionLogsService, toolHooksService: ToolHooksService, mcpService: McpService);
|
|
25
23
|
processTurn(sessionInput: SessionInput): Promise<SessionInput>;
|
|
26
24
|
private getSuccessStatusForStrategy;
|
|
27
25
|
}
|
|
@@ -25,10 +25,9 @@ const ai_actions_service_1 = require("../ai-actions/ai-actions.service");
|
|
|
25
25
|
const application_state_service_1 = require("../application-state/application-state.service");
|
|
26
26
|
const execution_logs_service_1 = require("../execution-logs/execution-logs.service");
|
|
27
27
|
const tool_hooks_service_1 = require("../tool-hooks/tool-hooks.service");
|
|
28
|
-
const sub_agent_runs_service_1 = require("../sub-agents/sub-agent-runs.service");
|
|
29
28
|
const mcp_service_1 = require("../mcp/mcp.service");
|
|
30
29
|
let LlmTurnProcessorService = LlmTurnProcessorService_1 = class LlmTurnProcessorService {
|
|
31
|
-
constructor(parser, handlerRegistry, postExecutionHooks, aiActionsRepository, sessionInputsRepository, sessionsRepository, applicationStateService, executionLogsService, toolHooksService,
|
|
30
|
+
constructor(parser, handlerRegistry, postExecutionHooks, aiActionsRepository, sessionInputsRepository, sessionsRepository, applicationStateService, executionLogsService, toolHooksService, mcpService) {
|
|
32
31
|
this.parser = parser;
|
|
33
32
|
this.handlerRegistry = handlerRegistry;
|
|
34
33
|
this.postExecutionHooks = postExecutionHooks;
|
|
@@ -38,7 +37,6 @@ let LlmTurnProcessorService = LlmTurnProcessorService_1 = class LlmTurnProcessor
|
|
|
38
37
|
this.applicationStateService = applicationStateService;
|
|
39
38
|
this.executionLogsService = executionLogsService;
|
|
40
39
|
this.toolHooksService = toolHooksService;
|
|
41
|
-
this.subAgentRunsService = subAgentRunsService;
|
|
42
40
|
this.mcpService = mcpService;
|
|
43
41
|
this.logger = new common_1.Logger(LlmTurnProcessorService_1.name);
|
|
44
42
|
}
|
|
@@ -157,35 +155,7 @@ let LlmTurnProcessorService = LlmTurnProcessorService_1 = class LlmTurnProcessor
|
|
|
157
155
|
}
|
|
158
156
|
else {
|
|
159
157
|
try {
|
|
160
|
-
|
|
161
|
-
if (hasActiveRuns &&
|
|
162
|
-
![
|
|
163
|
-
'final',
|
|
164
|
-
'ask_user',
|
|
165
|
-
'invoke_subagent',
|
|
166
|
-
'list_sub_agents',
|
|
167
|
-
].includes(action.tool_name)) {
|
|
168
|
-
result = {
|
|
169
|
-
status: 'FAILURE',
|
|
170
|
-
summary: `There is ongoing subagent activity. Cannot execute tool '${action.tool_name}' until subagent results are in.`,
|
|
171
|
-
error_message: `There is ongoing subagent activity. Cannot execute tool '${action.tool_name}' until subagent results are in. wait for their results before proceeding.`,
|
|
172
|
-
persisted_args: action.arguments,
|
|
173
|
-
execution_log: {
|
|
174
|
-
output: '',
|
|
175
|
-
error_message: `There is ongoing subagent activity. Cannot execute tool '${action.tool_name}' until subagent results are in. wait for their results before proceeding.`,
|
|
176
|
-
},
|
|
177
|
-
};
|
|
178
|
-
if (action.toolCallId) {
|
|
179
|
-
executionContext.toolResults.push({
|
|
180
|
-
toolCallId: action.toolCallId,
|
|
181
|
-
toolName: action.tool_name,
|
|
182
|
-
result: result.error_message,
|
|
183
|
-
});
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
else {
|
|
187
|
-
result = await handler.execute(action.arguments, executionContext);
|
|
188
|
-
}
|
|
158
|
+
result = await handler.execute(action.arguments, executionContext);
|
|
189
159
|
}
|
|
190
160
|
catch (error) {
|
|
191
161
|
this.logger.error(`Handler for ${action.tool_name} failed during execution: ${error.message}`, error.stack);
|
|
@@ -307,7 +277,6 @@ exports.LlmTurnProcessorService = LlmTurnProcessorService = LlmTurnProcessorServ
|
|
|
307
277
|
application_state_service_1.ApplicationStateService,
|
|
308
278
|
execution_logs_service_1.ExecutionLogsService,
|
|
309
279
|
tool_hooks_service_1.ToolHooksService,
|
|
310
|
-
sub_agent_runs_service_1.SubAgentRunsService,
|
|
311
280
|
mcp_service_1.McpService])
|
|
312
281
|
], LlmTurnProcessorService);
|
|
313
282
|
//# sourceMappingURL=llm-turn-processor.service.js.map
|