repoburg 1.3.158 → 1.3.160
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/dist/src/interactive-chat/chat.service.d.ts +2 -2
- package/backend/dist/src/interactive-chat/chat.service.js +2 -2
- package/backend/dist/src/interactive-chat/chat.service.js.map +1 -1
- package/backend/dist/src/llm-orchestration/action-handlers/get-messages.handler.d.ts +11 -3
- package/backend/dist/src/llm-orchestration/action-handlers/get-messages.handler.js +35 -11
- package/backend/dist/src/llm-orchestration/action-handlers/get-messages.handler.js.map +1 -1
- package/backend/dist/src/llm-orchestration/action-handlers/session-status.handler.d.ts +23 -0
- package/backend/dist/src/llm-orchestration/action-handlers/session-status.handler.js +115 -0
- package/backend/dist/src/llm-orchestration/action-handlers/session-status.handler.js.map +1 -0
- package/backend/dist/src/llm-orchestration/llm-orchestration.module.js +5 -1
- 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 +7 -1
- package/backend/dist/src/llm-orchestration/llm-turn-processor.service.js +73 -10
- package/backend/dist/src/llm-orchestration/llm-turn-processor.service.js.map +1 -1
- package/backend/dist/src/llm-orchestration/session-status.util.d.ts +5 -0
- package/backend/dist/src/llm-orchestration/session-status.util.js +115 -0
- package/backend/dist/src/llm-orchestration/session-status.util.js.map +1 -0
- package/backend/dist/src/seeding/data/agents/control-repoburg.d.ts +1 -1
- package/backend/dist/src/seeding/data/agents/control-repoburg.js +1 -1
- package/backend/dist/src/seeding/data/agents/control-repoburg.js.map +1 -1
- package/backend/dist/src/seeding/data/sub-agents/control-repoburg.js +1 -0
- package/backend/dist/src/seeding/data/sub-agents/control-repoburg.js.map +1 -1
- package/backend/dist/src/seeding/data/system-prompts/control-repoburg-agent.d.ts +1 -1
- package/backend/dist/src/seeding/data/system-prompts/control-repoburg-agent.js +8 -4
- package/backend/dist/src/seeding/data/system-prompts/control-repoburg-agent.js.map +1 -1
- package/backend/dist/src/seeding/data/tool-hooks/eslint-hook.d.ts +1 -1
- package/backend/dist/src/seeding/data/tool-hooks/eslint-hook.js +47 -8
- package/backend/dist/src/seeding/data/tool-hooks/eslint-hook.js.map +1 -1
- package/backend/dist/src/seeding/data/tool-hooks/example-hook.d.ts +1 -1
- package/backend/dist/src/seeding/data/tool-hooks/example-hook.js +69 -7
- package/backend/dist/src/seeding/data/tool-hooks/example-hook.js.map +1 -1
- package/backend/dist/src/seeding/data/tool-hooks/readme.d.ts +1 -1
- package/backend/dist/src/seeding/data/tool-hooks/readme.js +96 -2
- package/backend/dist/src/seeding/data/tool-hooks/readme.js.map +1 -1
- package/backend/dist/src/system-prompts/system-prompts.service.d.ts +2 -2
- package/backend/dist/src/system-prompts/system-prompts.service.js +7 -5
- package/backend/dist/src/system-prompts/system-prompts.service.js.map +1 -1
- package/backend/dist/src/tool-hooks/hook-context.interface.d.ts +76 -0
- package/backend/dist/src/tool-hooks/hook-context.interface.js +3 -0
- package/backend/dist/src/tool-hooks/hook-context.interface.js.map +1 -0
- package/backend/dist/src/tool-hooks/hook-runtime.d.ts +26 -0
- package/backend/dist/src/tool-hooks/hook-runtime.js +105 -0
- package/backend/dist/src/tool-hooks/hook-runtime.js.map +1 -0
- package/backend/dist/src/tool-hooks/tool-hooks.module.js +3 -2
- package/backend/dist/src/tool-hooks/tool-hooks.module.js.map +1 -1
- package/backend/dist/src/tool-hooks/tool-hooks.service.d.ts +9 -2
- package/backend/dist/src/tool-hooks/tool-hooks.service.js +125 -33
- package/backend/dist/src/tool-hooks/tool-hooks.service.js.map +1 -1
- package/backend/dist/test-hooks/combo-hook.d.ts +1 -0
- package/backend/dist/test-hooks/combo-hook.js +18 -0
- package/backend/dist/test-hooks/combo-hook.js.map +1 -0
- package/backend/dist/test-hooks/context-size-hook.d.ts +1 -0
- package/backend/dist/test-hooks/context-size-hook.js +17 -0
- package/backend/dist/test-hooks/context-size-hook.js.map +1 -0
- package/backend/dist/test-hooks/error-hook.d.ts +1 -0
- package/backend/dist/test-hooks/error-hook.js +19 -0
- package/backend/dist/test-hooks/error-hook.js.map +1 -0
- package/backend/dist/test-hooks/sub-agent-hook.d.ts +1 -0
- package/backend/dist/test-hooks/sub-agent-hook.js +11 -0
- package/backend/dist/test-hooks/sub-agent-hook.js.map +1 -0
- package/backend/dist/tsconfig.build.tsbuildinfo +1 -1
- package/backend/test-hooks/combo-hook.ts +21 -0
- package/backend/test-hooks/context-size-hook.ts +19 -0
- package/backend/test-hooks/error-hook.ts +19 -0
- package/backend/test-hooks/sub-agent-hook.ts +12 -0
- package/package.json +1 -1
|
@@ -15,6 +15,7 @@ var LlmTurnProcessorService_1;
|
|
|
15
15
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
16
|
exports.LlmTurnProcessorService = void 0;
|
|
17
17
|
const common_1 = require("@nestjs/common");
|
|
18
|
+
const core_1 = require("@nestjs/core");
|
|
18
19
|
const typeorm_1 = require("@nestjs/typeorm");
|
|
19
20
|
const typeorm_2 = require("typeorm");
|
|
20
21
|
const core_entities_1 = require("../core-entities");
|
|
@@ -25,9 +26,11 @@ const ai_actions_service_1 = require("../ai-actions/ai-actions.service");
|
|
|
25
26
|
const application_state_service_1 = require("../application-state/application-state.service");
|
|
26
27
|
const execution_logs_service_1 = require("../execution-logs/execution-logs.service");
|
|
27
28
|
const tool_hooks_service_1 = require("../tool-hooks/tool-hooks.service");
|
|
29
|
+
const hook_runtime_1 = require("../tool-hooks/hook-runtime");
|
|
28
30
|
const mcp_service_1 = require("../mcp/mcp.service");
|
|
31
|
+
const session_status_util_1 = require("./session-status.util");
|
|
29
32
|
let LlmTurnProcessorService = LlmTurnProcessorService_1 = class LlmTurnProcessorService {
|
|
30
|
-
constructor(parser, handlerRegistry, postExecutionHooks, aiActionsRepository, sessionInputsRepository, sessionsRepository, applicationStateService, executionLogsService, toolHooksService, mcpService) {
|
|
33
|
+
constructor(parser, handlerRegistry, postExecutionHooks, aiActionsRepository, sessionInputsRepository, sessionsRepository, applicationStateService, executionLogsService, toolHooksService, hookRuntime, mcpService, moduleRef) {
|
|
31
34
|
this.parser = parser;
|
|
32
35
|
this.handlerRegistry = handlerRegistry;
|
|
33
36
|
this.postExecutionHooks = postExecutionHooks;
|
|
@@ -37,11 +40,45 @@ let LlmTurnProcessorService = LlmTurnProcessorService_1 = class LlmTurnProcessor
|
|
|
37
40
|
this.applicationStateService = applicationStateService;
|
|
38
41
|
this.executionLogsService = executionLogsService;
|
|
39
42
|
this.toolHooksService = toolHooksService;
|
|
43
|
+
this.hookRuntime = hookRuntime;
|
|
40
44
|
this.mcpService = mcpService;
|
|
45
|
+
this.moduleRef = moduleRef;
|
|
41
46
|
this.logger = new common_1.Logger(LlmTurnProcessorService_1.name);
|
|
47
|
+
this.hookRuntimeWired = false;
|
|
48
|
+
}
|
|
49
|
+
ensureHookRuntimeWired() {
|
|
50
|
+
if (this.hookRuntimeWired)
|
|
51
|
+
return;
|
|
52
|
+
try {
|
|
53
|
+
const { ChatService } = require('../interactive-chat/chat.service');
|
|
54
|
+
const chatService = this.moduleRef.get(ChatService, { strict: false });
|
|
55
|
+
this.hookRuntime.setHistoryProvider(async (sessionId) => {
|
|
56
|
+
return chatService.getHistory(sessionId);
|
|
57
|
+
});
|
|
58
|
+
this.hookRuntime.setSubAgentInvoker(async (agentName, prompt, parentSessionId, options) => {
|
|
59
|
+
const result = await chatService.runAgentSync(agentName, prompt, parentSessionId, options);
|
|
60
|
+
return {
|
|
61
|
+
content: result.content || '',
|
|
62
|
+
success: result.success !== false,
|
|
63
|
+
childSessionId: result.childSessionId || '',
|
|
64
|
+
iterations: result.iterations || 1,
|
|
65
|
+
};
|
|
66
|
+
});
|
|
67
|
+
const { HistoryCompressionService, } = require('./history-compression.service');
|
|
68
|
+
const historyCompressionService = this.moduleRef.get(HistoryCompressionService, { strict: false });
|
|
69
|
+
this.hookRuntime.setSessionStatusProvider(async (sessionId) => {
|
|
70
|
+
return (0, session_status_util_1.computeSessionStatus)(sessionId, this.sessionInputsRepository, historyCompressionService);
|
|
71
|
+
});
|
|
72
|
+
this.hookRuntimeWired = true;
|
|
73
|
+
}
|
|
74
|
+
catch (e) {
|
|
75
|
+
this.logger.warn(`Could not wire HookRuntime with ChatService: ${e.message}. Hook API methods will not be available.`);
|
|
76
|
+
}
|
|
42
77
|
}
|
|
43
78
|
async processTurn(sessionInput) {
|
|
44
79
|
this.logger.log(`Starting new orchestration for input ${sessionInput.id}`);
|
|
80
|
+
this.ensureHookRuntimeWired();
|
|
81
|
+
this.hookRuntime.setSessionId(sessionInput.session_id);
|
|
45
82
|
const session = await this.sessionsRepository.findOne({
|
|
46
83
|
where: { id: sessionInput.session_id },
|
|
47
84
|
select: ['id', 'system_prompt_id'],
|
|
@@ -80,6 +117,8 @@ let LlmTurnProcessorService = LlmTurnProcessorService_1 = class LlmTurnProcessor
|
|
|
80
117
|
executionContext.system_prompt_id = session?.system_prompt_id || null;
|
|
81
118
|
executionContext.originalParsedActions = parsedActions;
|
|
82
119
|
const createdActions = [];
|
|
120
|
+
const hookSession = { id: sessionInput.session_id };
|
|
121
|
+
const hookApi = this.hookRuntime.createApi();
|
|
83
122
|
for (const action of parsedActions) {
|
|
84
123
|
let handler = this.handlerRegistry.get(action.tool_name);
|
|
85
124
|
let result;
|
|
@@ -88,11 +127,22 @@ let LlmTurnProcessorService = LlmTurnProcessorService_1 = class LlmTurnProcessor
|
|
|
88
127
|
for (const hook of beforeHooks) {
|
|
89
128
|
try {
|
|
90
129
|
this.logger.log(`Running BEFORE hook: ${hook.script_filename} for tool ${action.tool_name}`);
|
|
91
|
-
const
|
|
130
|
+
const hookPayload = {
|
|
92
131
|
hook_type: 'before',
|
|
93
132
|
action: { tool_name: action.tool_name, args: action.arguments },
|
|
94
|
-
plan_context:
|
|
95
|
-
|
|
133
|
+
plan_context: {
|
|
134
|
+
originalParsedActions: executionContext.originalParsedActions,
|
|
135
|
+
feedback: executionContext.feedback,
|
|
136
|
+
flags: executionContext.flags,
|
|
137
|
+
},
|
|
138
|
+
session: hookSession,
|
|
139
|
+
api: hookApi,
|
|
140
|
+
};
|
|
141
|
+
const { result: hookResult, logs: hookLogs } = await this.toolHooksService.executeHookWithLogs(hook.script_filename, hookPayload);
|
|
142
|
+
if (hookLogs.length > 0) {
|
|
143
|
+
this.logger.log(`Hook ${hook.script_filename} output:\n${hookLogs.join('\n')}`);
|
|
144
|
+
}
|
|
145
|
+
this.logger.log(`Hook ${hook.script_filename} result: should_halt_plan=${hookResult.should_halt_plan}, message=${hookResult.message || '(none)'}`);
|
|
96
146
|
if (hookResult.should_halt_plan) {
|
|
97
147
|
this.logger.warn(`Hook ${hook.script_filename} halted execution.`);
|
|
98
148
|
executionContext.flags.should_halt = true;
|
|
@@ -102,7 +152,7 @@ let LlmTurnProcessorService = LlmTurnProcessorService_1 = class LlmTurnProcessor
|
|
|
102
152
|
}
|
|
103
153
|
}
|
|
104
154
|
catch (e) {
|
|
105
|
-
this.logger.error(`Before-hook failed: ${e.message}`);
|
|
155
|
+
this.logger.error(`Before-hook ${hook.script_filename} failed: ${e.message}`);
|
|
106
156
|
}
|
|
107
157
|
}
|
|
108
158
|
if (hookHalted) {
|
|
@@ -174,7 +224,7 @@ let LlmTurnProcessorService = LlmTurnProcessorService_1 = class LlmTurnProcessor
|
|
|
174
224
|
for (const hook of afterHooks) {
|
|
175
225
|
try {
|
|
176
226
|
this.logger.log(`Running AFTER hook: ${hook.script_filename} for tool ${action.tool_name}`);
|
|
177
|
-
|
|
227
|
+
const hookPayload = {
|
|
178
228
|
hook_type: 'after',
|
|
179
229
|
action: {
|
|
180
230
|
tool_name: action.tool_name,
|
|
@@ -185,11 +235,22 @@ let LlmTurnProcessorService = LlmTurnProcessorService_1 = class LlmTurnProcessor
|
|
|
185
235
|
error: result.error_message,
|
|
186
236
|
},
|
|
187
237
|
},
|
|
188
|
-
plan_context:
|
|
189
|
-
|
|
238
|
+
plan_context: {
|
|
239
|
+
originalParsedActions: executionContext.originalParsedActions,
|
|
240
|
+
feedback: executionContext.feedback,
|
|
241
|
+
flags: executionContext.flags,
|
|
242
|
+
},
|
|
243
|
+
session: hookSession,
|
|
244
|
+
api: hookApi,
|
|
245
|
+
};
|
|
246
|
+
const { result: hookResult, logs: hookLogs } = await this.toolHooksService.executeHookWithLogs(hook.script_filename, hookPayload);
|
|
247
|
+
if (hookLogs.length > 0) {
|
|
248
|
+
this.logger.log(`Hook ${hook.script_filename} output:\n${hookLogs.join('\n')}`);
|
|
249
|
+
}
|
|
250
|
+
this.logger.log(`Hook ${hook.script_filename} result: should_halt_plan=${hookResult.should_halt_plan}, message=${hookResult.message || '(none)'}`);
|
|
190
251
|
}
|
|
191
252
|
catch (e) {
|
|
192
|
-
this.logger.error(`After-hook failed: ${e.message}`);
|
|
253
|
+
this.logger.error(`After-hook ${hook.script_filename} failed: ${e.message}`);
|
|
193
254
|
}
|
|
194
255
|
}
|
|
195
256
|
}
|
|
@@ -277,6 +338,8 @@ exports.LlmTurnProcessorService = LlmTurnProcessorService = LlmTurnProcessorServ
|
|
|
277
338
|
application_state_service_1.ApplicationStateService,
|
|
278
339
|
execution_logs_service_1.ExecutionLogsService,
|
|
279
340
|
tool_hooks_service_1.ToolHooksService,
|
|
280
|
-
|
|
341
|
+
hook_runtime_1.HookRuntime,
|
|
342
|
+
mcp_service_1.McpService,
|
|
343
|
+
core_1.ModuleRef])
|
|
281
344
|
], LlmTurnProcessorService);
|
|
282
345
|
//# sourceMappingURL=llm-turn-processor.service.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"llm-turn-processor.service.js","sourceRoot":"","sources":["../../../src/llm-orchestration/llm-turn-processor.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAA4D;AAC5D,6CAAmD;AACnD,qCAAqC;AACrC,oDAAmE;AACnE,kFAA4E;AAC5E,iFAGwC;AAGxC,uFAAiF;AAEjF,yEAAkE;AAClE,8FAAyF;AACzF,qFAAgF;AAChF,yEAAoE;AAEp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AsB,CAAC;YAC/C;gBAEE,IAAI,CAAC,MAAM,CAAC,IAAI,CACd,gCAAgC,QAAQ,0CAA0C,CACnF,CAAC;gBACF,OAAO,mCAAc,CAAC,sBAAsB,CAAC;QACjD,CAAC;IACH,CAAC;CACF,CAAA;AA7UY,0DAAuB;kCAAvB,uBAAuB;IADnC,IAAA,mBAAU,GAAE;IAMR,WAAA,IAAA,eAAM,EAAC,yBAAyB,CAAC,CAAA;IAEjC,WAAA,IAAA,eAAM,EAAC,sBAAsB,CAAC,CAAA;IAE9B,WAAA,IAAA,0BAAgB,EAAC,wBAAQ,CAAC,CAAA;IAE1B,WAAA,IAAA,0BAAgB,EAAC,4BAAY,CAAC,CAAA;IAE9B,WAAA,IAAA,0BAAgB,EAAC,uBAAO,CAAC,CAAA;qCATD,kDAAsB;QAEb,GAAG,SAIC,oBAAU;QAEN,oBAAU;QAEf,oBAAU;QACL,mDAAuB;QAC1B,6CAAoB;QACxB,qCAAgB;QACtB,wBAAU;GAlB9B,uBAAuB,CA6UnC"}
|
|
1
|
+
{"version":3,"file":"llm-turn-processor.service.js","sourceRoot":"","sources":["../../../src/llm-orchestration/llm-turn-processor.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AACA,2CAA4D;AAC5D,uCAAyC;AACzC,6CAAmD;AACnD,qCAAqC;AACrC,oDAAmE;AACnE,kFAA4E;AAC5E,iFAGwC;AAGxC,uFAAiF;AAEjF,yEAAkE;AAClE,8FAAyF;AACzF,qFAAgF;AAChF,yEAAoE;AACpE,6DAAyD;AAGzD,oDAAgD;AAChD,+DAA6D;AAGtD,IAAM,uBAAuB,+BAA7B,MAAM,uBAAuB;IAIlC,YACmB,MAA8B,EAE/C,eAA4D,EAE5D,kBAAwD,EAExD,mBAA0D,EAE1D,uBAAkE,EAElE,kBAAwD,EACvC,uBAAgD,EAChD,oBAA0C,EAC1C,gBAAkC,EAClC,WAAwB,EACxB,UAAsB,EACtB,SAAoB;QAhBpB,WAAM,GAAN,MAAM,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AAI,8BAA8B,CAC5E,CAAC;gBACF,MAAM;YACR,CAAC;QACH,CAAC;QAED,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,oCAAoC,YAAY,CAAC,EAAE,GAAG,CAAC,CAAC;QACxE,OAAO,IAAI,CAAC,uBAAuB,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IACzD,CAAC;IAEO,2BAA2B,CAAC,QAAgB;QAClD,QAAQ,QAAQ,EAAE,CAAC;YACjB,KAAK,YAAY;gBACf,OAAO,mCAAc,CAAC,cAAc,CAAC;YACvC,KAAK,cAAc,CAAC;YACpB,KAAK,cAAc;gBAIjB,OAAO,mCAAc,CAAC,sBAAsB,CAAC;YAC/C;gBAEE,IAAI,CAAC,MAAM,CAAC,IAAI,CACd,gCAAgC,QAAQ,0CAA0C,CACnF,CAAC;gBACF,OAAO,mCAAc,CAAC,sBAAsB,CAAC;QACjD,CAAC;IACH,CAAC;CACF,CAAA;AAxcY,0DAAuB;kCAAvB,uBAAuB;IADnC,IAAA,mBAAU,GAAE;IAOR,WAAA,IAAA,eAAM,EAAC,yBAAyB,CAAC,CAAA;IAEjC,WAAA,IAAA,eAAM,EAAC,sBAAsB,CAAC,CAAA;IAE9B,WAAA,IAAA,0BAAgB,EAAC,wBAAQ,CAAC,CAAA;IAE1B,WAAA,IAAA,0BAAgB,EAAC,4BAAY,CAAC,CAAA;IAE9B,WAAA,IAAA,0BAAgB,EAAC,uBAAO,CAAC,CAAA;qCATD,kDAAsB;QAEb,GAAG,SAIC,oBAAU;QAEN,oBAAU;QAEf,oBAAU;QACL,mDAAuB;QAC1B,6CAAoB;QACxB,qCAAgB;QACrB,0BAAW;QACZ,wBAAU;QACX,gBAAS;GArB5B,uBAAuB,CAwcnC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Repository } from 'typeorm';
|
|
2
|
+
import { SessionInput } from '../core-entities';
|
|
3
|
+
import { HistoryCompressionService } from './history-compression.service';
|
|
4
|
+
import { HookSessionStatus } from '../tool-hooks/hook-context.interface';
|
|
5
|
+
export declare function computeSessionStatus(sessionId: string, sessionInputsRepository: Repository<SessionInput>, historyCompressionService: HistoryCompressionService): Promise<HookSessionStatus>;
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.computeSessionStatus = computeSessionStatus;
|
|
4
|
+
const get_messages_handler_1 = require("./action-handlers/get-messages.handler");
|
|
5
|
+
async function computeSessionStatus(sessionId, sessionInputsRepository, historyCompressionService) {
|
|
6
|
+
const inputs = await sessionInputsRepository.find({
|
|
7
|
+
where: { session: { id: sessionId }, is_discarded: false },
|
|
8
|
+
relations: ['aiActions', 'aiActions.executionLogs'],
|
|
9
|
+
order: { sequence_number: 'ASC' },
|
|
10
|
+
});
|
|
11
|
+
const { history, turnToInputIndex } = (0, get_messages_handler_1.buildHistory)(inputs);
|
|
12
|
+
const compressedHistory = await historyCompressionService.compress(history);
|
|
13
|
+
const compressedCharSizes = new Array(inputs.length).fill(0);
|
|
14
|
+
for (let i = 0; i < compressedHistory.length; i++) {
|
|
15
|
+
const turnCharSize = (0, get_messages_handler_1.computeTurnCharSize)(compressedHistory[i]);
|
|
16
|
+
const inputIdx = turnToInputIndex[i];
|
|
17
|
+
if (inputIdx >= 0 && inputIdx < inputs.length) {
|
|
18
|
+
compressedCharSizes[inputIdx] += turnCharSize;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
let ratio = get_messages_handler_1.DEFAULT_CHARS_PER_TOKEN;
|
|
22
|
+
let ratioInputIndex = -1;
|
|
23
|
+
for (let i = inputs.length - 1; i >= 0; i--) {
|
|
24
|
+
if (inputs[i].role === 'model' &&
|
|
25
|
+
inputs[i].input_token_count != null &&
|
|
26
|
+
inputs[i].input_token_count > 0) {
|
|
27
|
+
ratioInputIndex = i;
|
|
28
|
+
break;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
if (ratioInputIndex >= 0) {
|
|
32
|
+
let cumulativeChars = 0;
|
|
33
|
+
for (let i = 0; i <= ratioInputIndex; i++) {
|
|
34
|
+
cumulativeChars += compressedCharSizes[i];
|
|
35
|
+
}
|
|
36
|
+
if (cumulativeChars > 0) {
|
|
37
|
+
ratio = cumulativeChars / inputs[ratioInputIndex].input_token_count;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
const summaries = inputs.map((input, index) => {
|
|
41
|
+
let preview;
|
|
42
|
+
if (input.role === 'user') {
|
|
43
|
+
preview = (0, get_messages_handler_1.truncate)(input.user_prompt || '');
|
|
44
|
+
}
|
|
45
|
+
else if (input.aiActions && input.aiActions.length > 0) {
|
|
46
|
+
preview = input.aiActions
|
|
47
|
+
.sort((a, b) => a.order_of_execution - b.order_of_execution)
|
|
48
|
+
.map((a) => (0, get_messages_handler_1.buildActionPreview)(a))
|
|
49
|
+
.join(', ');
|
|
50
|
+
if (preview.length > get_messages_handler_1.PREVIEW_MAX_LENGTH) {
|
|
51
|
+
preview = preview.slice(0, get_messages_handler_1.PREVIEW_MAX_LENGTH - 3) + '...';
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
else if (input.error_message) {
|
|
55
|
+
preview = `error: ${(0, get_messages_handler_1.truncate)(input.error_message)}`;
|
|
56
|
+
}
|
|
57
|
+
else if (input.llm_response_explanation) {
|
|
58
|
+
preview = (0, get_messages_handler_1.truncate)(input.llm_response_explanation);
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
preview = '(empty response)';
|
|
62
|
+
}
|
|
63
|
+
const estTokens = compressedCharSizes[index] > 0
|
|
64
|
+
? Math.round(compressedCharSizes[index] / ratio)
|
|
65
|
+
: 0;
|
|
66
|
+
return {
|
|
67
|
+
role: input.role || 'user',
|
|
68
|
+
preview,
|
|
69
|
+
thoughts: input.thoughts || undefined,
|
|
70
|
+
est_tokens: estTokens,
|
|
71
|
+
};
|
|
72
|
+
});
|
|
73
|
+
const groups = [];
|
|
74
|
+
let currentGroup = [];
|
|
75
|
+
let currentLabel = '';
|
|
76
|
+
let currentGroupTokens = 0;
|
|
77
|
+
for (let i = 0; i < summaries.length; i++) {
|
|
78
|
+
const summary = summaries[i];
|
|
79
|
+
if (summary.role === 'user' && currentGroup.length > 0) {
|
|
80
|
+
groups.push({
|
|
81
|
+
label: currentLabel,
|
|
82
|
+
label_suffix: '',
|
|
83
|
+
message_count: currentGroup.length,
|
|
84
|
+
est_tokens: currentGroupTokens,
|
|
85
|
+
messages: currentGroup,
|
|
86
|
+
});
|
|
87
|
+
currentGroup = [];
|
|
88
|
+
currentGroupTokens = 0;
|
|
89
|
+
}
|
|
90
|
+
if (summary.role === 'user' || currentGroup.length === 0) {
|
|
91
|
+
currentLabel = summary.preview || 'User message';
|
|
92
|
+
}
|
|
93
|
+
currentGroup.push(summary);
|
|
94
|
+
currentGroupTokens += summary.est_tokens;
|
|
95
|
+
}
|
|
96
|
+
if (currentGroup.length > 0) {
|
|
97
|
+
groups.push({
|
|
98
|
+
label: currentLabel,
|
|
99
|
+
label_suffix: ' (ongoing)',
|
|
100
|
+
message_count: currentGroup.length,
|
|
101
|
+
est_tokens: currentGroupTokens,
|
|
102
|
+
messages: currentGroup,
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
for (let i = 0; i < groups.length - 1; i++) {
|
|
106
|
+
groups[i].label_suffix = '';
|
|
107
|
+
}
|
|
108
|
+
const totalEstTokens = summaries.reduce((sum, s) => sum + s.est_tokens, 0);
|
|
109
|
+
return {
|
|
110
|
+
message_count: summaries.length,
|
|
111
|
+
total_est_tokens: totalEstTokens,
|
|
112
|
+
groups,
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
//# sourceMappingURL=session-status.util.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session-status.util.js","sourceRoot":"","sources":["../../../src/llm-orchestration/session-status.util.ts"],"names":[],"mappings":";;AAoBA,oDAuIC;AAxJD,iFAOgD;AAUzC,K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"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export declare const name = "Control RepoBurg";
|
|
2
|
-
export declare const description = "Specialized agent for managing RepoBurg configuration \u2014 system prompts, context templates, snippets, variables, agents, sub-agents, MCP servers, and tool hooks.";
|
|
2
|
+
export declare const description = "Specialized agent for managing RepoBurg configuration \u2014 system prompts, context templates, snippets, variables, agents, sub-agents, MCP servers, and tool hooks (including wildcard hooks, Hook API with getContextSize/invokeSubAgent).";
|
|
3
3
|
export declare const system_prompt_name = "control-repoburg-agent";
|
|
4
4
|
export declare const context_template_name = "control-repoburg-initial-context";
|
|
5
5
|
export declare const followup_context_template_name = "control-repoburg-followup-context";
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.is_active = exports.reasoning_effort = exports.model_id = exports.followup_context_template_name = exports.context_template_name = exports.system_prompt_name = exports.description = exports.name = void 0;
|
|
4
4
|
exports.name = 'Control RepoBurg';
|
|
5
|
-
exports.description = 'Specialized agent for managing RepoBurg configuration — system prompts, context templates, snippets, variables, agents, sub-agents, MCP servers, and tool hooks.';
|
|
5
|
+
exports.description = 'Specialized agent for managing RepoBurg configuration — system prompts, context templates, snippets, variables, agents, sub-agents, MCP servers, and tool hooks (including wildcard hooks, Hook API with getContextSize/invokeSubAgent).';
|
|
6
6
|
exports.system_prompt_name = 'control-repoburg-agent';
|
|
7
7
|
exports.context_template_name = 'control-repoburg-initial-context';
|
|
8
8
|
exports.followup_context_template_name = 'control-repoburg-followup-context';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"control-repoburg.js","sourceRoot":"","sources":["../../../../../src/seeding/data/agents/control-repoburg.ts"],"names":[],"mappings":";;;AAAa,QAAA,IAAI,GAAG,kBAAkB,CAAC;AAC1B,QAAA,WAAW,GACtB,
|
|
1
|
+
{"version":3,"file":"control-repoburg.js","sourceRoot":"","sources":["../../../../../src/seeding/data/agents/control-repoburg.ts"],"names":[],"mappings":";;;AAAa,QAAA,IAAI,GAAG,kBAAkB,CAAC;AAC1B,QAAA,WAAW,GACtB,0OAA0O,CAAC;AAChO,QAAA,kBAAkB,GAAG,wBAAwB,CAAC;AAC9C,QAAA,qBAAqB,GAAG,kCAAkC,CAAC;AAC3D,QAAA,8BAA8B,GACzC,mCAAmC,CAAC;AACzB,QAAA,QAAQ,GAAG,IAAI,CAAC;AAChB,QAAA,gBAAgB,GAAG,IAAI,CAAC;AACxB,QAAA,SAAS,GAAG,IAAI,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"control-repoburg.js","sourceRoot":"","sources":["../../../../../src/seeding/data/sub-agents/control-repoburg.ts"],"names":[],"mappings":";;;AAAa,QAAA,IAAI,GAAG,kBAAkB,CAAC;AAC1B,QAAA,WAAW,GACtB,kKAAkK,CAAC;AACxJ,QAAA,kBAAkB,GAAG,wBAAwB,CAAC;AAC9C,QAAA,aAAa,GAAG;IAC3B,iBAAiB;IACjB,aAAa;IACb,YAAY;IACZ,uBAAuB;IACvB,0BAA0B;IAC1B,yBAAyB;IACzB,wBAAwB;IACxB,yBAAyB;IACzB,eAAe;IACf,mBAAmB;IACnB,oBAAoB;IACpB,mBAAmB;IACnB,OAAO;IACP,YAAY;IACZ,UAAU;IACV,cAAc;IACd,kBAAkB;CACnB,CAAC;AACW,QAAA,QAAQ,GAAG,IAAI,CAAC;AAChB,QAAA,SAAS,GAAG,IAAI,CAAC"}
|
|
1
|
+
{"version":3,"file":"control-repoburg.js","sourceRoot":"","sources":["../../../../../src/seeding/data/sub-agents/control-repoburg.ts"],"names":[],"mappings":";;;AAAa,QAAA,IAAI,GAAG,kBAAkB,CAAC;AAC1B,QAAA,WAAW,GACtB,kKAAkK,CAAC;AACxJ,QAAA,kBAAkB,GAAG,wBAAwB,CAAC;AAC9C,QAAA,aAAa,GAAG;IAC3B,iBAAiB;IACjB,aAAa;IACb,YAAY;IACZ,uBAAuB;IACvB,0BAA0B;IAC1B,yBAAyB;IACzB,wBAAwB;IACxB,yBAAyB;IACzB,eAAe;IACf,mBAAmB;IACnB,oBAAoB;IACpB,mBAAmB;IACnB,OAAO;IACP,YAAY;IACZ,UAAU;IACV,cAAc;IACd,gBAAgB;IAChB,kBAAkB;CACnB,CAAC;AACW,QAAA,QAAQ,GAAG,IAAI,CAAC;AAChB,QAAA,SAAS,GAAG,IAAI,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export declare const name = "Control RepoBurg";
|
|
2
2
|
export declare const enabled_tools: string[];
|
|
3
3
|
export declare const enabled_mcp_tools: any[];
|
|
4
|
-
export declare const content = "You are a RepoBurg Control Agent \u2014 a specialized agent for managing all aspects of the RepoBurg system configuration.\n\n## Role\nYou manage RepoBurg's own configuration: system prompts, context templates, context snippets, custom snippets, custom variables, agents, sub-agents, MCP servers, and tool hooks. Think of you as the admin panel agent.\n\n<% if (it.VAR && it.VAR.PLAN_MODE) { %>\n## STATUS: PLAN MODE (TASK MANAGEMENT ENABLED)\n- **Goal:** Create a detailed implementation plan (RFC) and maintain task lists.\n- **Constraint:** Configuration changes are FORBIDDEN. You may only read and plan.\n- **Available Tools:** `request_context`, `run_command`, `write_todo`, `ask_user`, `final`, `html_final`, `get_messages`, `discard_messages`.\n- **Process:** Gather context \u2192 Update TODOs (`write_todo`) \u2192 Output structured plan (Current State, Desired State, Implementation Steps).\n\n### Planning Rules\n- Do not make any config changes \u2014 only plan them.\n- Read before you plan: always list or get an entity before proposing changes.\n- Use `html_final` to present plans as structured HTML with tables and sections.\n- Use `ask_user` with selections when you need a decision before continuing.\n\n<% } else { %>\n## STATUS: CONFIG MODE (WRITE ENABLED)\n- **Goal:** Implement configuration changes requested by the user.\n- **Authority:** Full permission to manage all RepoBurg configuration entities.\n- **Strategy:** Use manage_* tools to create, update, and delete config entities.\n- **Process:** Read current state \u2192 Make changes \u2192 Verify with list/get \u2192 Present results.\n\n### Key Principles\n1. **Read before write:** Always list or get an entity before modifying it to understand the current state.\n2. **Preserve built-ins:** Built-in entities (is_builtin=true) cannot be updated or deleted. Duplicate them to create editable copies.\n3. **Be precise:** Use exact UUIDs when referencing entities by ID. Use exact names when referencing by name.\n4. **JSON data:** When creating or updating entities, provide the data as a structured object with the exact field names documented in each tool.\n5. **Present results clearly:** Use `html_final` for structured output (tables, comparisons, diffs). Use `final` only for simple plain text.\n\n<% } %>\n\n## Agents vs Sub-Agents \u2014 IMPORTANT\n- **Agents** are UI presets that users select from a dropdown. They group a system prompt, context templates, model, and reasoning effort together. Use `manage_agents` when the user says \"create an agent\", \"make a preset\", or wants something selectable in the UI.\n- **Sub-Agents** are LLM-delegated specialists invoked via `invoke_subagent`. They have their own system prompt, context templates, and restricted tool access. Use `manage_sub_agents` when creating a specialist for delegation.\n- **CRITICAL:** When the user says \"agent\" without the \"sub\" prefix, they mean an Agent (UI preset), NOT a Sub-Agent. Only use `manage_sub_agents` when explicitly creating a sub-agent for LLM delegation.\n\n## Creating System Prompts \u2014 IMPORTANT\nWhen creating a system prompt, ALWAYS specify `enabledTools` and `enabledMcpTools` in the `data` object:\n- `enabledTools`: Array of tool names (e.g., `[\"create_file\", \"overwrite_file\", \"delete_file\", \"request_context\", \"run_command\", \"final\"]`) or `\"all\"` to enable everything.\n- `enabledMcpTools`: Array of MCP tool identifiers (e.g., `[\"playwright__browser_navigate\"]`) or `\"all\"` to enable everything.\n- If the user doesn't specify, default to `\"all\"` for both.\n- Failing to set these means the system prompt will default to all tools, which may not be the intended behavior.\n\n## Context Window Management\nIn long sessions, use `get_messages` to check context usage. If total est_tokens exceeds 80,000, use `discard_messages` with short_ids of completed/irrelevant message groups. Never discard the most recent group (marked \"ongoing\"). This keeps your context window manageable and avoids truncation.\n\n## Available Tools\n\n### System Prompts (manage_system_prompts)\nSystem prompts define the AI's behavior. They are Eta templates that get rendered with tool definitions and variables.\n- Actions: list, get, get_raw, create, update, delete, duplicate, set_default, set_enabled_tools, set_enabled_mcp_tools, toggle_tool, toggle_mcp_tool, preview\n- Key fields: prompt_name, prompt_content (Eta template), is_default, url, followup_token_limit, enabledTools, enabledMcpTools\n\n### Context Templates (manage_context_templates)\nContext templates define how context (files, folders, tools) is assembled for LLM prompts. They use Eta syntax.\n- Actions: list, get, create, update, delete, duplicate, set_default_initial, set_default_followup, set_default_condensed\n- Key fields: template_name, template_content (Eta), context_definition (JSON), template_type (\"main\"|\"partial\")\n\n### Context Snippets (manage_context_snippets)\nContext snippets are reusable Eta template blocks accessible via it.snippets.handle in context templates.\n- Actions: list, get, create, update, delete\n- Key fields: handle (unique identifier), description, template_content (Eta)\n\n### Custom Snippets (manage_custom_snippets)\nCustom snippets are text expansion templates triggered by a prefix. Like VS Code snippets.\n- Actions: list, get, create, update, delete, duplicate\n- Key fields: prefix (trigger), description, body (expanded content), scope\n\n### Custom Variables (manage_custom_variables)\nCustom variables are key-value pairs available in templates via it.variables.KEY.\n- Actions: list, create, update, delete\n- Key fields: key (unique), value, enabled, is_freq_used, order_number\n\n### Agents (manage_agents)\nAgents are presets that group a system prompt, context templates, model, and reasoning effort together. Selecting an agent applies all its settings to a session at once.\n- Actions: list, get, create, update, delete, duplicate, set_default\n- Key fields: name, description, system_prompt_id, context_template_id, followup_context_template_id, model_id, reasoning_effort (\"low\"|\"medium\"|\"high\"), is_default, is_active, is_builtin\n- Built-in agents (is_builtin=true) can only have is_active, model_id, and reasoning_effort modified. Duplicate them to create fully editable copies.\n- Setting an agent as default clears the previous default.\n\n### Sub-Agents (manage_sub_agents)\nSub-agents are specialized agent configurations invoked by the master agent for specific tasks. They have their own system prompt, context templates, and restricted tool access.\n- Actions: list, get, create, update, delete, duplicate\n- Key fields: name, description, system_prompt_id, context_template_id, followup_context_template_id, enabled_tools, enabled_mcp_tools, is_active, model_id\n\n### MCP Servers (manage_mcp_servers)\nMCP servers provide external tools. Each active server's tools become available to the AI.\n- Actions: list, create, toggle_active, delete, toggle_tools\n- Key fields: server_name, command, args, env, is_active\n\n### Tool Hooks (manage_tool_hooks)\nTool hooks are
|
|
4
|
+
export declare const content = "You are a RepoBurg Control Agent \u2014 a specialized agent for managing all aspects of the RepoBurg system configuration.\n\n## Role\nYou manage RepoBurg's own configuration: system prompts, context templates, context snippets, custom snippets, custom variables, agents, sub-agents, MCP servers, and tool hooks. Think of you as the admin panel agent.\n\n<% if (it.VAR && it.VAR.PLAN_MODE) { %>\n## STATUS: PLAN MODE (TASK MANAGEMENT ENABLED)\n- **Goal:** Create a detailed implementation plan (RFC) and maintain task lists.\n- **Constraint:** Configuration changes are FORBIDDEN. You may only read and plan.\n- **Available Tools:** `request_context`, `run_command`, `write_todo`, `ask_user`, `final`, `html_final`, `get_messages`, `session_status`, `discard_messages`.\n- **Process:** Gather context \u2192 Update TODOs (`write_todo`) \u2192 Output structured plan (Current State, Desired State, Implementation Steps).\n\n### Planning Rules\n- Do not make any config changes \u2014 only plan them.\n- Read before you plan: always list or get an entity before proposing changes.\n- Use `html_final` to present plans as structured HTML with tables and sections.\n- Use `ask_user` with selections when you need a decision before continuing.\n\n<% } else { %>\n## STATUS: CONFIG MODE (WRITE ENABLED)\n- **Goal:** Implement configuration changes requested by the user.\n- **Authority:** Full permission to manage all RepoBurg configuration entities.\n- **Strategy:** Use manage_* tools to create, update, and delete config entities.\n- **Process:** Read current state \u2192 Make changes \u2192 Verify with list/get \u2192 Present results.\n\n### Key Principles\n1. **Read before write:** Always list or get an entity before modifying it to understand the current state.\n2. **Preserve built-ins:** Built-in entities (is_builtin=true) cannot be updated or deleted. Duplicate them to create editable copies.\n3. **Be precise:** Use exact UUIDs when referencing entities by ID. Use exact names when referencing by name.\n4. **JSON data:** When creating or updating entities, provide the data as a structured object with the exact field names documented in each tool.\n5. **Present results clearly:** Use `html_final` for structured output (tables, comparisons, diffs). Use `final` only for simple plain text.\n\n<% } %>\n\n## Agents vs Sub-Agents \u2014 IMPORTANT\n- **Agents** are UI presets that users select from a dropdown. They group a system prompt, context templates, model, and reasoning effort together. Use `manage_agents` when the user says \"create an agent\", \"make a preset\", or wants something selectable in the UI.\n- **Sub-Agents** are LLM-delegated specialists invoked via `invoke_subagent`. They have their own system prompt, context templates, and restricted tool access. Use `manage_sub_agents` when creating a specialist for delegation.\n- **CRITICAL:** When the user says \"agent\" without the \"sub\" prefix, they mean an Agent (UI preset), NOT a Sub-Agent. Only use `manage_sub_agents` when explicitly creating a sub-agent for LLM delegation.\n\n## Creating System Prompts \u2014 IMPORTANT\nWhen creating a system prompt, ALWAYS specify `enabledTools` and `enabledMcpTools` in the `data` object:\n- `enabledTools`: Array of tool names (e.g., `[\"create_file\", \"overwrite_file\", \"delete_file\", \"request_context\", \"run_command\", \"final\"]`) or `\"all\"` to enable everything.\n- `enabledMcpTools`: Array of MCP tool identifiers (e.g., `[\"playwright__browser_navigate\"]`) or `\"all\"` to enable everything.\n- If the user doesn't specify, default to `\"all\"` for both.\n- Failing to set these means the system prompt will default to all tools, which may not be the intended behavior.\n\n## Context Window Management\nIn long sessions, use `get_messages` to check context usage. If total est_tokens exceeds 80,000, use `discard_messages` with short_ids of completed/irrelevant message groups. Never discard the most recent group (marked \"ongoing\"). This keeps your context window manageable and avoids truncation. Use `session_status` when you need a quick overview of what happened in any session (provides message groups with topic labels, thoughts, and token estimates).\n\n## Available Tools\n\n### System Prompts (manage_system_prompts)\nSystem prompts define the AI's behavior. They are Eta templates that get rendered with tool definitions and variables.\n- Actions: list, get, get_raw, create, update, delete, duplicate, set_default, set_enabled_tools, set_enabled_mcp_tools, toggle_tool, toggle_mcp_tool, preview\n- Key fields: prompt_name, prompt_content (Eta template), is_default, url, followup_token_limit, enabledTools, enabledMcpTools\n\n### Context Templates (manage_context_templates)\nContext templates define how context (files, folders, tools) is assembled for LLM prompts. They use Eta syntax.\n- Actions: list, get, create, update, delete, duplicate, set_default_initial, set_default_followup, set_default_condensed\n- Key fields: template_name, template_content (Eta), context_definition (JSON), template_type (\"main\"|\"partial\")\n\n### Context Snippets (manage_context_snippets)\nContext snippets are reusable Eta template blocks accessible via it.snippets.handle in context templates.\n- Actions: list, get, create, update, delete\n- Key fields: handle (unique identifier), description, template_content (Eta)\n\n### Custom Snippets (manage_custom_snippets)\nCustom snippets are text expansion templates triggered by a prefix. Like VS Code snippets.\n- Actions: list, get, create, update, delete, duplicate\n- Key fields: prefix (trigger), description, body (expanded content), scope\n\n### Custom Variables (manage_custom_variables)\nCustom variables are key-value pairs available in templates via it.variables.KEY.\n- Actions: list, create, update, delete\n- Key fields: key (unique), value, enabled, is_freq_used, order_number\n\n### Agents (manage_agents)\nAgents are presets that group a system prompt, context templates, model, and reasoning effort together. Selecting an agent applies all its settings to a session at once.\n- Actions: list, get, create, update, delete, duplicate, set_default\n- Key fields: name, description, system_prompt_id, context_template_id, followup_context_template_id, model_id, reasoning_effort (\"low\"|\"medium\"|\"high\"), is_default, is_active, is_builtin\n- Built-in agents (is_builtin=true) can only have is_active, model_id, and reasoning_effort modified. Duplicate them to create fully editable copies.\n- Setting an agent as default clears the previous default.\n\n### Sub-Agents (manage_sub_agents)\nSub-agents are specialized agent configurations invoked by the master agent for specific tasks. They have their own system prompt, context templates, and restricted tool access.\n- Actions: list, get, create, update, delete, duplicate\n- Key fields: name, description, system_prompt_id, context_template_id, followup_context_template_id, enabled_tools, enabled_mcp_tools, is_active, model_id\n\n### MCP Servers (manage_mcp_servers)\nMCP servers provide external tools. Each active server's tools become available to the AI.\n- Actions: list, create, toggle_active, delete, toggle_tools\n- Key fields: server_name, command, args, env, is_active\n\n### Tool Hooks (manage_tool_hooks)\nTool hooks are TypeScript scripts that run before or after AI tool execution for validation, policy enforcement, logging, or context management.\n- Actions: list, create, update, delete, list_scripts, create_script, test\n- Key fields: tool_name (specific tool or \"*\" for wildcard \u2014 runs for every tool, executes before tool-specific hooks), timing (\"before\"|\"after\"), script_filename, is_active\n- Scripts export a default async function receiving HookContext (hook_type, action with tool_name/args/result, session, plan_context) and returning HookOutput (should_halt_plan to halt, message, update_context). Before hooks that return should_halt_plan:true block the tool. After hooks run regardless of success/failure.\n- HookContext.api provides: getContextSize() \u2192 token count; invokeSubAgent(agentName, prompt) \u2192 run a sub-agent; getSessionStatus() \u2192 message count, token estimates, grouped message summaries. Scripts are transpiled TypeScript with access to require/console/process.\n- Use create_script to write scripts (auto-generates template with full HookContext types), create to register the hook config, test to verify with a sample payload.\n\n";
|
|
@@ -19,6 +19,7 @@ exports.enabled_tools = [
|
|
|
19
19
|
'html_final',
|
|
20
20
|
'ask_user',
|
|
21
21
|
'get_messages',
|
|
22
|
+
'session_status',
|
|
22
23
|
'discard_messages',
|
|
23
24
|
];
|
|
24
25
|
exports.enabled_mcp_tools = [];
|
|
@@ -31,7 +32,7 @@ You manage RepoBurg's own configuration: system prompts, context templates, cont
|
|
|
31
32
|
## STATUS: PLAN MODE (TASK MANAGEMENT ENABLED)
|
|
32
33
|
- **Goal:** Create a detailed implementation plan (RFC) and maintain task lists.
|
|
33
34
|
- **Constraint:** Configuration changes are FORBIDDEN. You may only read and plan.
|
|
34
|
-
- **Available Tools:** \`request_context\`, \`run_command\`, \`write_todo\`, \`ask_user\`, \`final\`, \`html_final\`, \`get_messages\`, \`discard_messages\`.
|
|
35
|
+
- **Available Tools:** \`request_context\`, \`run_command\`, \`write_todo\`, \`ask_user\`, \`final\`, \`html_final\`, \`get_messages\`, \`session_status\`, \`discard_messages\`.
|
|
35
36
|
- **Process:** Gather context → Update TODOs (\`write_todo\`) → Output structured plan (Current State, Desired State, Implementation Steps).
|
|
36
37
|
|
|
37
38
|
### Planning Rules
|
|
@@ -69,7 +70,7 @@ When creating a system prompt, ALWAYS specify \`enabledTools\` and \`enabledMcpT
|
|
|
69
70
|
- Failing to set these means the system prompt will default to all tools, which may not be the intended behavior.
|
|
70
71
|
|
|
71
72
|
## Context Window Management
|
|
72
|
-
In long sessions, use \`get_messages\` to check context usage. If total est_tokens exceeds 80,000, use \`discard_messages\` with short_ids of completed/irrelevant message groups. Never discard the most recent group (marked "ongoing"). This keeps your context window manageable and avoids truncation.
|
|
73
|
+
In long sessions, use \`get_messages\` to check context usage. If total est_tokens exceeds 80,000, use \`discard_messages\` with short_ids of completed/irrelevant message groups. Never discard the most recent group (marked "ongoing"). This keeps your context window manageable and avoids truncation. Use \`session_status\` when you need a quick overview of what happened in any session (provides message groups with topic labels, thoughts, and token estimates).
|
|
73
74
|
|
|
74
75
|
## Available Tools
|
|
75
76
|
|
|
@@ -116,9 +117,12 @@ MCP servers provide external tools. Each active server's tools become available
|
|
|
116
117
|
- Key fields: server_name, command, args, env, is_active
|
|
117
118
|
|
|
118
119
|
### Tool Hooks (manage_tool_hooks)
|
|
119
|
-
Tool hooks are
|
|
120
|
+
Tool hooks are TypeScript scripts that run before or after AI tool execution for validation, policy enforcement, logging, or context management.
|
|
120
121
|
- Actions: list, create, update, delete, list_scripts, create_script, test
|
|
121
|
-
- Key fields: tool_name, timing ("before"|"after"), script_filename, is_active
|
|
122
|
+
- Key fields: tool_name (specific tool or "*" for wildcard — runs for every tool, executes before tool-specific hooks), timing ("before"|"after"), script_filename, is_active
|
|
123
|
+
- Scripts export a default async function receiving HookContext (hook_type, action with tool_name/args/result, session, plan_context) and returning HookOutput (should_halt_plan to halt, message, update_context). Before hooks that return should_halt_plan:true block the tool. After hooks run regardless of success/failure.
|
|
124
|
+
- HookContext.api provides: getContextSize() → token count; invokeSubAgent(agentName, prompt) → run a sub-agent; getSessionStatus() → message count, token estimates, grouped message summaries. Scripts are transpiled TypeScript with access to require/console/process.
|
|
125
|
+
- Use create_script to write scripts (auto-generates template with full HookContext types), create to register the hook config, test to verify with a sample payload.
|
|
122
126
|
|
|
123
127
|
`;
|
|
124
128
|
//# sourceMappingURL=control-repoburg-agent.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"control-repoburg-agent.js","sourceRoot":"","sources":["../../../../../src/seeding/data/system-prompts/control-repoburg-agent.ts"],"names":[],"mappings":";;;AAAa,QAAA,IAAI,GAAG,kBAAkB,CAAC;AAC1B,QAAA,aAAa,GAAG;IAC3B,iBAAiB;IACjB,aAAa;IACb,YAAY;IACZ,uBAAuB;IACvB,0BAA0B;IAC1B,yBAAyB;IACzB,wBAAwB;IACxB,yBAAyB;IACzB,eAAe;IACf,mBAAmB;IACnB,oBAAoB;IACpB,mBAAmB;IACnB,OAAO;IACP,YAAY;IACZ,UAAU;IACV,cAAc;IACd,kBAAkB;CACnB,CAAC;AACW,QAAA,iBAAiB,GAAG,EAAE,CAAC;AACvB,QAAA,OAAO,GAAG
|
|
1
|
+
{"version":3,"file":"control-repoburg-agent.js","sourceRoot":"","sources":["../../../../../src/seeding/data/system-prompts/control-repoburg-agent.ts"],"names":[],"mappings":";;;AAAa,QAAA,IAAI,GAAG,kBAAkB,CAAC;AAC1B,QAAA,aAAa,GAAG;IAC3B,iBAAiB;IACjB,aAAa;IACb,YAAY;IACZ,uBAAuB;IACvB,0BAA0B;IAC1B,yBAAyB;IACzB,wBAAwB;IACxB,yBAAyB;IACzB,eAAe;IACf,mBAAmB;IACnB,oBAAoB;IACpB,mBAAmB;IACnB,OAAO;IACP,YAAY;IACZ,UAAU;IACV,cAAc;IACd,gBAAgB;IAChB,kBAAkB;CACnB,CAAC;AACW,QAAA,iBAAiB,GAAG,EAAE,CAAC;AACvB,QAAA,OAAO,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqGtB,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export declare const filename = "eslint-hook.ts";
|
|
2
|
-
export declare const content = "/**\n * ESLint Validation Hook\n * \n * Usage: Attach as 'after' hook to 'create_file', 'overwrite_file', 'patch'.\n * \n * With native tool calling, errors should be returned in the result object\n * instead of pushing to validationErrors. This hook is kept for reference\n * but may need adjustment based on your use case.\n */\nimport { exec } from 'child_process';\nimport { promisify } from 'util';\n\nconst execAsync = promisify(exec);\n\
|
|
2
|
+
export declare const content = "/**\n * ESLint Validation Hook\n * \n * Usage: Attach as 'after' hook to 'create_file', 'overwrite_file', 'patch'.\n * \n * With native tool calling, errors should be returned in the result object\n * instead of pushing to validationErrors. This hook is kept for reference\n * but may need adjustment based on your use case.\n */\nimport { exec } from 'child_process';\nimport { promisify } from 'util';\n\nconst execAsync = promisify(exec);\n\nexport interface HookContext {\n hook_type: 'before' | 'after';\n action: {\n tool_name: string;\n args: { file_path?: string; [key: string]: any };\n result?: {\n status: 'SUCCESS' | 'FAILURE';\n output?: string;\n error?: string;\n };\n };\n plan_context: {\n originalParsedActions: Array<{ tool_name: string; arguments: any }>;\n feedback: {\n validationErrors: Array<{ tool_name: string; error: string }>;\n invalidToolErrors: Array<{ tool_name: string; arguments: any }>;\n };\n flags: {\n should_halt: boolean;\n halt_reason?: string;\n is_final?: boolean;\n follow_up_initiated?: boolean;\n };\n };\n session: {\n id: string;\n };\n api: {\n getContextSize(): Promise<number>;\n invokeSubAgent(agentName: string, prompt: string, options?: { sessionId?: string }): Promise<{\n content: string;\n success: boolean;\n childSessionId: string;\n iterations: number;\n }>;\n getSessionStatus(): Promise<{\n message_count: number;\n total_est_tokens: number;\n groups: Array<{\n label: string;\n label_suffix: string;\n message_count: number;\n est_tokens: number;\n messages: Array<{\n role: string;\n preview: string;\n thoughts?: string;\n est_tokens: number;\n }>;\n }>;\n }>;\n };\n}\n\nexport interface HookOutput {\n should_halt_plan?: boolean;\n message?: string;\n update_context?: Record<string, any>;\n}\n\nexport default async function(context: HookContext): Promise<HookOutput | void> {\n const filePath = context.action.args.file_path;\n if (!filePath) return;\n\n console.log(`[Hook] Running ESLint on ${filePath}`);\n\n try {\n // Adjust command as needed for your project structure\n // We use --no-color to keep error message clean for AI\n await execAsync(`npx eslint \"${filePath}\" --no-color`);\n console.log(`[Hook] ESLint passed for ${filePath}`);\n } catch (e: any) {\n const errorOutput = e.stdout || e.stderr || e.message;\n \n console.log(`[Hook] ESLint failed for ${filePath}`);\n console.error(`ESLint check failed:\\n${errorOutput}`);\n \n return {\n should_halt_plan: false,\n message: `ESLint check failed for ${filePath}: ${errorOutput.substring(0, 200)}`\n };\n }\n}\n";
|
|
@@ -16,8 +16,8 @@ import { promisify } from 'util';
|
|
|
16
16
|
|
|
17
17
|
const execAsync = promisify(exec);
|
|
18
18
|
|
|
19
|
-
// Redefining types locally since this runs in a standalone VM context
|
|
20
19
|
export interface HookContext {
|
|
20
|
+
hook_type: 'before' | 'after';
|
|
21
21
|
action: {
|
|
22
22
|
tool_name: string;
|
|
23
23
|
args: { file_path?: string; [key: string]: any };
|
|
@@ -28,14 +28,55 @@ export interface HookContext {
|
|
|
28
28
|
};
|
|
29
29
|
};
|
|
30
30
|
plan_context: {
|
|
31
|
+
originalParsedActions: Array<{ tool_name: string; arguments: any }>;
|
|
32
|
+
feedback: {
|
|
33
|
+
validationErrors: Array<{ tool_name: string; error: string }>;
|
|
34
|
+
invalidToolErrors: Array<{ tool_name: string; arguments: any }>;
|
|
35
|
+
};
|
|
31
36
|
flags: {
|
|
32
37
|
should_halt: boolean;
|
|
33
38
|
halt_reason?: string;
|
|
39
|
+
is_final?: boolean;
|
|
40
|
+
follow_up_initiated?: boolean;
|
|
34
41
|
};
|
|
35
42
|
};
|
|
43
|
+
session: {
|
|
44
|
+
id: string;
|
|
45
|
+
};
|
|
46
|
+
api: {
|
|
47
|
+
getContextSize(): Promise<number>;
|
|
48
|
+
invokeSubAgent(agentName: string, prompt: string, options?: { sessionId?: string }): Promise<{
|
|
49
|
+
content: string;
|
|
50
|
+
success: boolean;
|
|
51
|
+
childSessionId: string;
|
|
52
|
+
iterations: number;
|
|
53
|
+
}>;
|
|
54
|
+
getSessionStatus(): Promise<{
|
|
55
|
+
message_count: number;
|
|
56
|
+
total_est_tokens: number;
|
|
57
|
+
groups: Array<{
|
|
58
|
+
label: string;
|
|
59
|
+
label_suffix: string;
|
|
60
|
+
message_count: number;
|
|
61
|
+
est_tokens: number;
|
|
62
|
+
messages: Array<{
|
|
63
|
+
role: string;
|
|
64
|
+
preview: string;
|
|
65
|
+
thoughts?: string;
|
|
66
|
+
est_tokens: number;
|
|
67
|
+
}>;
|
|
68
|
+
}>;
|
|
69
|
+
}>;
|
|
70
|
+
};
|
|
36
71
|
}
|
|
37
72
|
|
|
38
|
-
export
|
|
73
|
+
export interface HookOutput {
|
|
74
|
+
should_halt_plan?: boolean;
|
|
75
|
+
message?: string;
|
|
76
|
+
update_context?: Record<string, any>;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export default async function(context: HookContext): Promise<HookOutput | void> {
|
|
39
80
|
const filePath = context.action.args.file_path;
|
|
40
81
|
if (!filePath) return;
|
|
41
82
|
|
|
@@ -50,14 +91,12 @@ export default async function(context: HookContext) {
|
|
|
50
91
|
const errorOutput = e.stdout || e.stderr || e.message;
|
|
51
92
|
|
|
52
93
|
console.log(\`[Hook] ESLint failed for \${filePath}\`);
|
|
53
|
-
|
|
54
|
-
// Log the error - it will be captured in execution logs
|
|
55
|
-
// The AI will see this in the tool result via native tool calling
|
|
56
94
|
console.error(\`ESLint check failed:\\n\${errorOutput}\`);
|
|
57
95
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
96
|
+
return {
|
|
97
|
+
should_halt_plan: false,
|
|
98
|
+
message: \`ESLint check failed for \${filePath}: \${errorOutput.substring(0, 200)}\`
|
|
99
|
+
};
|
|
61
100
|
}
|
|
62
101
|
}
|
|
63
102
|
`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"eslint-hook.js","sourceRoot":"","sources":["../../../../../src/seeding/data/tool-hooks/eslint-hook.ts"],"names":[],"mappings":";;;AAAa,QAAA,QAAQ,GAAG,gBAAgB,CAAC;AAC5B,QAAA,OAAO,GAAG
|
|
1
|
+
{"version":3,"file":"eslint-hook.js","sourceRoot":"","sources":["../../../../../src/seeding/data/tool-hooks/eslint-hook.ts"],"names":[],"mappings":";;;AAAa,QAAA,QAAQ,GAAG,gBAAgB,CAAC;AAC5B,QAAA,OAAO,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiGtB,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export declare const filename = "example-hook.ts";
|
|
2
|
-
export declare const content = "/**\n* Example Hook Script\n* \n* Usage: \n* 1. Attach to 'patch' or 'overwrite_file' tool as a 'before' hook.\n* 2. It will block edits to any file with 'lock' in the name.\n*/\n// --- Type Definitions ---\n\nexport interface HookAction {\n tool_name: string;\n args: Record<string, any>;\n // Only present for 'after' hooks\n result?: {\n status: 'SUCCESS' | 'FAILURE';\n output?: string;\n error?: string;\n };\n}\n\nexport interface HookContext {\n hook_type: 'before' | 'after';\n action: HookAction;\n plan_context:
|
|
2
|
+
export declare const content = "/**\n * Example Hook Script\n * \n * Usage: \n * 1. Attach to 'patch' or 'overwrite_file' tool as a 'before' hook.\n * 2. It will block edits to any file with 'lock' in the name.\n */\n// --- Type Definitions ---\n\nexport interface HookAction {\n tool_name: string;\n args: Record<string, any>;\n // Only present for 'after' hooks\n result?: {\n status: 'SUCCESS' | 'FAILURE';\n output?: string;\n error?: string;\n };\n}\n\nexport interface HookPlanContext {\n originalParsedActions: Array<{ tool_name: string; arguments: any }>;\n feedback: {\n validationErrors: Array<{ tool_name: string; error: string }>;\n invalidToolErrors: Array<{ tool_name: string; arguments: any }>;\n };\n flags: {\n should_halt: boolean;\n halt_reason?: string;\n is_final?: boolean;\n follow_up_initiated?: boolean;\n };\n}\n\nexport interface HookSession {\n id: string;\n}\n\nexport interface HookSubAgentResult {\n content: string;\n success: boolean;\n childSessionId: string;\n iterations: number;\n}\n\nexport interface HookSessionStatusGroup {\n label: string;\n label_suffix: string;\n message_count: number;\n est_tokens: number;\n messages: Array<{\n role: string;\n preview: string;\n thoughts?: string;\n est_tokens: number;\n }>;\n}\n\nexport interface HookSessionStatus {\n message_count: number;\n total_est_tokens: number;\n groups: HookSessionStatusGroup[];\n}\n\nexport interface HookApi {\n /** Get the current context size in tokens for the session */\n getContextSize(): Promise<number>;\n /** Invoke a sub-agent synchronously (blocks until complete) */\n invokeSubAgent(agentName: string, prompt: string, options?: { sessionId?: string }): Promise<HookSubAgentResult>;\n /** Get session status: message count, token estimates, grouped message summaries */\n getSessionStatus(): Promise<HookSessionStatus>;\n}\n\nexport interface HookContext {\n hook_type: 'before' | 'after';\n action: HookAction;\n plan_context: HookPlanContext;\n session: HookSession;\n api: HookApi;\n}\n\nexport interface HookOutput {\n // If true, AI plan stops immediately.\n should_halt_plan?: boolean;\n \n // Optional message to log in UI\n message?: string;\n \n // Optional data to merge back into plan context\n update_context?: Record<string, any>;\n}\n\n// --- Hook Logic ---\n\nexport default async function(context: HookContext): Promise<HookOutput | void> {\n // 1. Extract Data\n const filePath = context.action?.args?.file_path || '';\n \n // Log to console (appears in backend logs)\n console.log(`[Hook] analyzing action on: ${filePath}`);\n\n // Example: Check context size and compress if too large\n // const contextSize = await context.api.getContextSize();\n // if (contextSize > 70000) {\n // const result = await context.api.invokeSubAgent('compress-agent', 'Compress conversation history');\n // return { message: `Context was ${contextSize} tokens. Compress-agent result: ${result.content}` };\n // }\n\n // 2. Logic\n if (filePath.includes('lock')) {\n // Return Halt Signal\n return {\n should_halt_plan: true,\n message: `BLOCKED: Editing files with \"lock\" in the name is forbidden by policy. File: ${filePath}`\n };\n } else {\n // Return Pass Signal\n return {\n should_halt_plan: false,\n message: `Hook allowed action on ${filePath}`\n };\n }\n}\n";
|