repoburg 1.3.322 → 1.3.324
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/agent-pane/backend/dist/index.js +795 -351
- package/agent-pane/backend/dist/server.js +796 -352
- package/agent-pane/frontend/dist/assets/{TerminalView-Z7ZJ436H.js → TerminalView-DQaRNqT-.js} +1 -1
- package/agent-pane/frontend/dist/assets/index-CUuZmtId.css +1 -0
- package/agent-pane/frontend/dist/assets/index-kBNaARow.js +862 -0
- package/agent-pane/frontend/dist/index.html +2 -2
- package/backend/dist/src/agent-runtime/agent-runtime-event-emitter.d.ts +6 -1
- package/backend/dist/src/agent-runtime/agent-runtime-event-emitter.js +31 -0
- package/backend/dist/src/agent-runtime/agent-runtime-event-emitter.js.map +1 -1
- package/backend/dist/src/agent-runtime/agent-runtime.types.d.ts +22 -2
- package/backend/dist/src/ai-actions/ai-action-batch.service.d.ts +3 -1
- package/backend/dist/src/ai-actions/ai-action-batch.service.js +20 -6
- package/backend/dist/src/ai-actions/ai-action-batch.service.js.map +1 -1
- package/backend/dist/src/app.module.js +6 -0
- package/backend/dist/src/app.module.js.map +1 -1
- package/backend/dist/src/application-state/application-state.controller.d.ts +0 -6
- package/backend/dist/src/application-state/application-state.controller.js +0 -29
- package/backend/dist/src/application-state/application-state.controller.js.map +1 -1
- package/backend/dist/src/application-state/application-state.service.d.ts +1 -3
- package/backend/dist/src/application-state/application-state.service.js +8 -15
- package/backend/dist/src/application-state/application-state.service.js.map +1 -1
- package/backend/dist/src/background-tasks/background-tasks.controller.d.ts +9 -0
- package/backend/dist/src/background-tasks/background-tasks.controller.js +59 -0
- package/backend/dist/src/background-tasks/background-tasks.controller.js.map +1 -0
- package/backend/dist/src/background-tasks/background-tasks.module.d.ts +2 -0
- package/backend/dist/src/background-tasks/background-tasks.module.js +32 -0
- package/backend/dist/src/background-tasks/background-tasks.module.js.map +1 -0
- package/backend/dist/src/background-tasks/background-tasks.service.d.ts +62 -0
- package/backend/dist/src/background-tasks/background-tasks.service.js +415 -0
- package/backend/dist/src/background-tasks/background-tasks.service.js.map +1 -0
- package/backend/dist/src/command-hooks/command-hooks.module.d.ts +2 -0
- package/backend/dist/src/command-hooks/command-hooks.module.js +24 -0
- package/backend/dist/src/command-hooks/command-hooks.module.js.map +1 -0
- package/backend/dist/src/command-hooks/command-hooks.service.d.ts +39 -0
- package/backend/dist/src/command-hooks/command-hooks.service.js +367 -0
- package/backend/dist/src/command-hooks/command-hooks.service.js.map +1 -0
- package/backend/dist/src/context-generation/context-generation.service.d.ts +3 -0
- package/backend/dist/src/context-generation/context-generation.service.js +7 -1
- package/backend/dist/src/context-generation/context-generation.service.js.map +1 -1
- package/backend/dist/src/core-entities/session.entity.d.ts +1 -0
- package/backend/dist/src/core-entities/session.entity.js +7 -0
- package/backend/dist/src/core-entities/session.entity.js.map +1 -1
- package/backend/dist/src/file-read-registry/file-read-registry.module.d.ts +2 -0
- package/backend/dist/src/file-read-registry/file-read-registry.module.js +26 -0
- package/backend/dist/src/file-read-registry/file-read-registry.module.js.map +1 -0
- package/backend/dist/src/file-read-registry/file-read-registry.service.d.ts +28 -0
- package/backend/dist/src/file-read-registry/file-read-registry.service.js +199 -0
- package/backend/dist/src/file-read-registry/file-read-registry.service.js.map +1 -0
- package/backend/dist/src/global-config/dto/update-global-config.dto.d.ts +1 -1
- package/backend/dist/src/global-config/dto/update-global-config.dto.js +7 -5
- package/backend/dist/src/global-config/dto/update-global-config.dto.js.map +1 -1
- package/backend/dist/src/global-config/global-config.service.d.ts +1 -1
- package/backend/dist/src/global-config/global-config.service.js.map +1 -1
- package/backend/dist/src/interactive-chat/auto-compact.service.d.ts +3 -1
- package/backend/dist/src/interactive-chat/auto-compact.service.js +8 -2
- package/backend/dist/src/interactive-chat/auto-compact.service.js.map +1 -1
- package/backend/dist/src/interactive-chat/chat.service.d.ts +7 -1
- package/backend/dist/src/interactive-chat/chat.service.js +82 -2
- package/backend/dist/src/interactive-chat/chat.service.js.map +1 -1
- package/backend/dist/src/llm-orchestration/action-handlers/action-handler.interface.d.ts +1 -0
- package/backend/dist/src/llm-orchestration/action-handlers/dto/run-command.args.dto.d.ts +2 -0
- package/backend/dist/src/llm-orchestration/action-handlers/dto/run-command.args.dto.js +10 -0
- package/backend/dist/src/llm-orchestration/action-handlers/dto/run-command.args.dto.js.map +1 -1
- package/backend/dist/src/llm-orchestration/action-handlers/list-mcp-resources.handler.d.ts +11 -0
- package/backend/dist/src/llm-orchestration/action-handlers/list-mcp-resources.handler.js +100 -0
- package/backend/dist/src/llm-orchestration/action-handlers/list-mcp-resources.handler.js.map +1 -0
- package/backend/dist/src/llm-orchestration/action-handlers/list-mcp.handler.d.ts +4 -2
- package/backend/dist/src/llm-orchestration/action-handlers/list-mcp.handler.js +15 -4
- package/backend/dist/src/llm-orchestration/action-handlers/list-mcp.handler.js.map +1 -1
- package/backend/dist/src/llm-orchestration/action-handlers/list-tools.handler.d.ts +4 -2
- package/backend/dist/src/llm-orchestration/action-handlers/list-tools.handler.js +15 -4
- package/backend/dist/src/llm-orchestration/action-handlers/list-tools.handler.js.map +1 -1
- package/backend/dist/src/llm-orchestration/action-handlers/load-tool.handler.d.ts +3 -1
- package/backend/dist/src/llm-orchestration/action-handlers/load-tool.handler.js +11 -3
- package/backend/dist/src/llm-orchestration/action-handlers/load-tool.handler.js.map +1 -1
- package/backend/dist/src/llm-orchestration/action-handlers/mcp-tool-action.handler.d.ts +1 -1
- package/backend/dist/src/llm-orchestration/action-handlers/mcp-tool-action.handler.js.map +1 -1
- package/backend/dist/src/llm-orchestration/action-handlers/read-mcp-resource.handler.d.ts +11 -0
- package/backend/dist/src/llm-orchestration/action-handlers/read-mcp-resource.handler.js +94 -0
- package/backend/dist/src/llm-orchestration/action-handlers/read-mcp-resource.handler.js.map +1 -0
- package/backend/dist/src/llm-orchestration/action-handlers/request-context.handler.d.ts +18 -1
- package/backend/dist/src/llm-orchestration/action-handlers/request-context.handler.js +266 -25
- package/backend/dist/src/llm-orchestration/action-handlers/request-context.handler.js.map +1 -1
- package/backend/dist/src/llm-orchestration/action-handlers/run-command.handler.d.ts +4 -1
- package/backend/dist/src/llm-orchestration/action-handlers/run-command.handler.js +79 -2
- package/backend/dist/src/llm-orchestration/action-handlers/run-command.handler.js.map +1 -1
- package/backend/dist/src/llm-orchestration/action-handlers/task-output.handler.d.ts +16 -0
- package/backend/dist/src/llm-orchestration/action-handlers/task-output.handler.js +135 -0
- package/backend/dist/src/llm-orchestration/action-handlers/task-output.handler.js.map +1 -0
- package/backend/dist/src/llm-orchestration/action-handlers/task-stop.handler.d.ts +12 -0
- package/backend/dist/src/llm-orchestration/action-handlers/task-stop.handler.js +78 -0
- package/backend/dist/src/llm-orchestration/action-handlers/task-stop.handler.js.map +1 -0
- package/backend/dist/src/llm-orchestration/action-handlers/utils/local-web-fetch.d.ts +28 -0
- package/backend/dist/src/llm-orchestration/action-handlers/utils/local-web-fetch.js +208 -0
- package/backend/dist/src/llm-orchestration/action-handlers/utils/local-web-fetch.js.map +1 -0
- package/backend/dist/src/llm-orchestration/action-handlers/web-fetch.handler.d.ts +2 -0
- package/backend/dist/src/llm-orchestration/action-handlers/web-fetch.handler.js +85 -60
- package/backend/dist/src/llm-orchestration/action-handlers/web-fetch.handler.js.map +1 -1
- package/backend/dist/src/llm-orchestration/action-handlers/web-search.handler.d.ts +1 -0
- package/backend/dist/src/llm-orchestration/action-handlers/web-search.handler.js +3 -0
- package/backend/dist/src/llm-orchestration/action-handlers/web-search.handler.js.map +1 -1
- package/backend/dist/src/llm-orchestration/hooks/frontend-notification.hook.js +13 -5
- package/backend/dist/src/llm-orchestration/hooks/frontend-notification.hook.js.map +1 -1
- package/backend/dist/src/llm-orchestration/hooks/invalid-tool-feedback.hook.js +2 -0
- package/backend/dist/src/llm-orchestration/hooks/invalid-tool-feedback.hook.js.map +1 -1
- package/backend/dist/src/llm-orchestration/hooks/max-turns-post-execution.hook.d.ts +12 -0
- package/backend/dist/src/llm-orchestration/hooks/max-turns-post-execution.hook.js +52 -0
- package/backend/dist/src/llm-orchestration/hooks/max-turns-post-execution.hook.js.map +1 -0
- package/backend/dist/src/llm-orchestration/hooks/stop-command-hooks.post-execution.hook.d.ts +16 -0
- package/backend/dist/src/llm-orchestration/hooks/stop-command-hooks.post-execution.hook.js +79 -0
- package/backend/dist/src/llm-orchestration/hooks/stop-command-hooks.post-execution.hook.js.map +1 -0
- package/backend/dist/src/llm-orchestration/llm-orchestration.interfaces.d.ts +1 -0
- package/backend/dist/src/llm-orchestration/llm-orchestration.interfaces.js.map +1 -1
- package/backend/dist/src/llm-orchestration/llm-orchestration.module.js +49 -88
- 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 +9 -1
- package/backend/dist/src/llm-orchestration/llm-turn-processor.service.js +143 -5
- package/backend/dist/src/llm-orchestration/llm-turn-processor.service.js.map +1 -1
- package/backend/dist/src/llm-orchestration/tool-schema.service.d.ts +6 -1
- package/backend/dist/src/llm-orchestration/tool-schema.service.js +47 -8
- package/backend/dist/src/llm-orchestration/tool-schema.service.js.map +1 -1
- package/backend/dist/src/mcp/mcp.module.js +8 -4
- package/backend/dist/src/mcp/mcp.module.js.map +1 -1
- package/backend/dist/src/mcp/mcp.service.d.ts +3 -0
- package/backend/dist/src/mcp/mcp.service.js +9 -0
- package/backend/dist/src/mcp/mcp.service.js.map +1 -1
- package/backend/dist/src/mcp/session-mcp.controller.d.ts +11 -0
- package/backend/dist/src/mcp/session-mcp.controller.js +54 -0
- package/backend/dist/src/mcp/session-mcp.controller.js.map +1 -0
- package/backend/dist/src/mcp/session-mcp.service.d.ts +67 -0
- package/backend/dist/src/mcp/session-mcp.service.js +421 -0
- package/backend/dist/src/mcp/session-mcp.service.js.map +1 -0
- package/backend/dist/src/seeding/data/sub-agents/control-repoburg.js +4 -0
- package/backend/dist/src/seeding/data/sub-agents/control-repoburg.js.map +1 -1
- package/backend/dist/src/seeding/data/sub-agents/explore-codebase.js +4 -0
- package/backend/dist/src/seeding/data/sub-agents/explore-codebase.js.map +1 -1
- package/backend/dist/src/seeding/data/sub-agents/general-purpose.js +4 -0
- package/backend/dist/src/seeding/data/sub-agents/general-purpose.js.map +1 -1
- package/backend/dist/src/seeding/data/system-prompts/control-repoburg-agent.js +4 -0
- package/backend/dist/src/seeding/data/system-prompts/control-repoburg-agent.js.map +1 -1
- 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 +8 -0
- package/backend/dist/src/seeding/data/system-prompts/default_native_tool_agent.js.map +1 -1
- package/backend/dist/src/seeding/data/system-prompts/explore-codebase-agent.d.ts +1 -1
- package/backend/dist/src/seeding/data/system-prompts/explore-codebase-agent.js +5 -1
- package/backend/dist/src/seeding/data/system-prompts/explore-codebase-agent.js.map +1 -1
- package/backend/dist/src/seeding/data/system-prompts/general-purpose-agent.d.ts +1 -1
- package/backend/dist/src/seeding/data/system-prompts/general-purpose-agent.js +7 -2
- package/backend/dist/src/seeding/data/system-prompts/general-purpose-agent.js.map +1 -1
- package/backend/dist/src/session-cancellation/session-cancellation.service.d.ts +5 -0
- package/backend/dist/src/session-cancellation/session-cancellation.service.js +20 -0
- package/backend/dist/src/session-cancellation/session-cancellation.service.js.map +1 -1
- package/backend/dist/src/session-event-logs/session-event-logs.service.d.ts +1 -0
- package/backend/dist/src/session-event-logs/session-event-logs.service.js +4 -0
- package/backend/dist/src/session-event-logs/session-event-logs.service.js.map +1 -1
- package/backend/dist/src/session-inputs/dto/session-input.dto.d.ts +1 -0
- package/backend/dist/src/session-inputs/dto/session-input.dto.js +10 -0
- package/backend/dist/src/session-inputs/dto/session-input.dto.js.map +1 -1
- package/backend/dist/src/session-inputs/session-input-context.service.d.ts +5 -2
- package/backend/dist/src/session-inputs/session-input-context.service.js +20 -4
- package/backend/dist/src/session-inputs/session-input-context.service.js.map +1 -1
- package/backend/dist/src/session-inputs/session-inputs.controller.js +3 -1
- package/backend/dist/src/session-inputs/session-inputs.controller.js.map +1 -1
- package/backend/dist/src/session-inputs/session-inputs.service.d.ts +8 -2
- package/backend/dist/src/session-inputs/session-inputs.service.js +43 -8
- package/backend/dist/src/session-inputs/session-inputs.service.js.map +1 -1
- package/backend/dist/src/sessions/sessions.controller.d.ts +2 -2
- package/backend/dist/src/sessions/sessions.controller.js.map +1 -1
- package/backend/dist/src/sessions/sessions.service.d.ts +4 -1
- package/backend/dist/src/sessions/sessions.service.js +5 -1
- package/backend/dist/src/sessions/sessions.service.js.map +1 -1
- package/backend/dist/src/slash-commands/slash-commands.controller.d.ts +1 -1
- package/backend/dist/src/slash-commands/slash-commands.controller.js +7 -3
- package/backend/dist/src/slash-commands/slash-commands.controller.js.map +1 -1
- package/backend/dist/src/slash-commands/slash-commands.module.js +2 -0
- package/backend/dist/src/slash-commands/slash-commands.module.js.map +1 -1
- package/backend/dist/src/slash-commands/slash-commands.service.d.ts +12 -4
- package/backend/dist/src/slash-commands/slash-commands.service.js +279 -65
- package/backend/dist/src/slash-commands/slash-commands.service.js.map +1 -1
- package/backend/dist/src/system-prompts/system-prompts.service.js +4 -0
- package/backend/dist/src/system-prompts/system-prompts.service.js.map +1 -1
- package/backend/dist/src/utils/pdf-text.d.ts +16 -0
- package/backend/dist/src/utils/pdf-text.js +27 -0
- package/backend/dist/src/utils/pdf-text.js.map +1 -0
- package/backend/dist/src/utils/tool-images.d.ts +10 -0
- package/backend/dist/src/utils/tool-images.js +55 -0
- package/backend/dist/src/utils/tool-images.js.map +1 -0
- package/backend/dist/tsconfig.build.tsbuildinfo +1 -1
- package/backend/package.json +1 -0
- package/package.json +3 -1
- package/tabtape/extension/dist/build-info.json +3 -3
- package/tabtape/extension/dist/manifest.json +1 -1
- package/tabtape/ui/dist/build-info.json +3 -3
- package/agent-pane/frontend/dist/assets/index-C1m0abtH.css +0 -1
- package/agent-pane/frontend/dist/assets/index-CjwvHfxy.js +0 -862
- package/backend/dist/src/application-state/dto/set-websocket-enabled.dto.d.ts +0 -3
- package/backend/dist/src/application-state/dto/set-websocket-enabled.dto.js +0 -23
- package/backend/dist/src/application-state/dto/set-websocket-enabled.dto.js.map +0 -1
|
@@ -0,0 +1,421 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
+
};
|
|
14
|
+
var SessionMcpService_1;
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.SessionMcpService = void 0;
|
|
17
|
+
exports.normalizeSessionMcpServers = normalizeSessionMcpServers;
|
|
18
|
+
const common_1 = require("@nestjs/common");
|
|
19
|
+
const typeorm_1 = require("@nestjs/typeorm");
|
|
20
|
+
const typeorm_2 = require("typeorm");
|
|
21
|
+
const path = require("path");
|
|
22
|
+
const crypto_1 = require("crypto");
|
|
23
|
+
const index_js_1 = require("@modelcontextprotocol/sdk/client/index.js");
|
|
24
|
+
const stdio_js_1 = require("@modelcontextprotocol/sdk/client/stdio.js");
|
|
25
|
+
const streamableHttp_js_1 = require("@modelcontextprotocol/sdk/client/streamableHttp.js");
|
|
26
|
+
const sse_js_1 = require("@modelcontextprotocol/sdk/client/sse.js");
|
|
27
|
+
const session_entity_1 = require("../core-entities/session.entity");
|
|
28
|
+
const mcp_service_1 = require("./mcp.service");
|
|
29
|
+
const mcp_result_1 = require("./mcp-result");
|
|
30
|
+
const NAME = /^[A-Za-z0-9_-]{1,64}$/;
|
|
31
|
+
function projectRoot() {
|
|
32
|
+
return process.env.REPOBURG_PROJECT_PATH || process.cwd();
|
|
33
|
+
}
|
|
34
|
+
function configHash(config) {
|
|
35
|
+
const { instructions: _ignored, ...rest } = config;
|
|
36
|
+
return (0, crypto_1.createHash)('sha1').update(JSON.stringify(rest)).digest('hex');
|
|
37
|
+
}
|
|
38
|
+
function normalizeSessionMcpServers(servers) {
|
|
39
|
+
if (!Array.isArray(servers))
|
|
40
|
+
return [];
|
|
41
|
+
const seen = new Set();
|
|
42
|
+
const result = [];
|
|
43
|
+
for (const raw of servers) {
|
|
44
|
+
if (!raw || typeof raw !== 'object')
|
|
45
|
+
continue;
|
|
46
|
+
const s = raw;
|
|
47
|
+
if (typeof s.name !== 'string' || !NAME.test(s.name))
|
|
48
|
+
continue;
|
|
49
|
+
if (seen.has(s.name))
|
|
50
|
+
continue;
|
|
51
|
+
const type = s.type ?? (s.url ? 'http' : 'stdio');
|
|
52
|
+
if (type === 'stdio') {
|
|
53
|
+
if (typeof s.command !== 'string' || !s.command)
|
|
54
|
+
continue;
|
|
55
|
+
}
|
|
56
|
+
else if (type === 'http' || type === 'sse') {
|
|
57
|
+
if (typeof s.url !== 'string' || !/^https?:\/\//.test(s.url))
|
|
58
|
+
continue;
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
continue;
|
|
62
|
+
}
|
|
63
|
+
const stringRecord = (v) => v && typeof v === 'object'
|
|
64
|
+
? Object.fromEntries(Object.entries(v).filter(([, value]) => typeof value === 'string'))
|
|
65
|
+
: undefined;
|
|
66
|
+
seen.add(s.name);
|
|
67
|
+
result.push({
|
|
68
|
+
name: s.name,
|
|
69
|
+
type,
|
|
70
|
+
...(type === 'stdio'
|
|
71
|
+
? {
|
|
72
|
+
command: s.command,
|
|
73
|
+
args: Array.isArray(s.args) ? s.args.map(String) : [],
|
|
74
|
+
env: stringRecord(s.env),
|
|
75
|
+
}
|
|
76
|
+
: { url: s.url, headers: stringRecord(s.headers) }),
|
|
77
|
+
...(typeof s.instructions === 'string' && s.instructions.trim()
|
|
78
|
+
? { instructions: s.instructions.trim() }
|
|
79
|
+
: {}),
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
return result;
|
|
83
|
+
}
|
|
84
|
+
let SessionMcpService = SessionMcpService_1 = class SessionMcpService {
|
|
85
|
+
constructor(sessionRepository, mcpService) {
|
|
86
|
+
this.sessionRepository = sessionRepository;
|
|
87
|
+
this.mcpService = mcpService;
|
|
88
|
+
this.logger = new common_1.Logger(SessionMcpService_1.name);
|
|
89
|
+
this.connections = new Map();
|
|
90
|
+
this.reaper = null;
|
|
91
|
+
}
|
|
92
|
+
onModuleDestroy() {
|
|
93
|
+
if (this.reaper)
|
|
94
|
+
clearInterval(this.reaper);
|
|
95
|
+
this.reaper = null;
|
|
96
|
+
return this.closeWhere(() => true);
|
|
97
|
+
}
|
|
98
|
+
async setServers(sessionId, servers) {
|
|
99
|
+
const normalized = normalizeSessionMcpServers(servers);
|
|
100
|
+
await this.sessionRepository.update({ id: sessionId }, {
|
|
101
|
+
mcp_servers: normalized.length
|
|
102
|
+
? normalized
|
|
103
|
+
: null,
|
|
104
|
+
});
|
|
105
|
+
const hashes = new Map(normalized.map((s) => [s.name, configHash(s)]));
|
|
106
|
+
await this.closeWhere((c) => c.ownerId === sessionId && hashes.get(c.config.name) !== c.hash);
|
|
107
|
+
return normalized;
|
|
108
|
+
}
|
|
109
|
+
async serversFor(sessionId) {
|
|
110
|
+
let id = sessionId || null;
|
|
111
|
+
let userServers = null;
|
|
112
|
+
for (let depth = 0; id && depth < 16; depth++) {
|
|
113
|
+
const session = await this.sessionRepository
|
|
114
|
+
.findOne({
|
|
115
|
+
where: { id },
|
|
116
|
+
select: ['id', 'parent_session_id', 'mcp_servers'],
|
|
117
|
+
})
|
|
118
|
+
.catch(() => null);
|
|
119
|
+
if (!session)
|
|
120
|
+
return null;
|
|
121
|
+
let servers = normalizeSessionMcpServers(session.mcp_servers);
|
|
122
|
+
if (servers.length) {
|
|
123
|
+
userServers ??= new Set(await this.mcpService.activeServerNames());
|
|
124
|
+
const taken = userServers;
|
|
125
|
+
servers = servers.filter((s) => !taken.has(s.name));
|
|
126
|
+
}
|
|
127
|
+
if (servers.length)
|
|
128
|
+
return { ownerId: session.id, servers };
|
|
129
|
+
id = session.parent_session_id;
|
|
130
|
+
}
|
|
131
|
+
return null;
|
|
132
|
+
}
|
|
133
|
+
async promptSection(sessionId) {
|
|
134
|
+
const owned = await this.serversFor(sessionId);
|
|
135
|
+
if (!owned)
|
|
136
|
+
return '';
|
|
137
|
+
const lines = [
|
|
138
|
+
'## Session MCP Servers',
|
|
139
|
+
'This session also has these MCP servers. Use `list_tools({ server_name })` and `load_tool` to use them, like any other MCP server.',
|
|
140
|
+
];
|
|
141
|
+
for (const server of owned.servers) {
|
|
142
|
+
lines.push(`- \`${server.name}\`${server.instructions ? `: ${server.instructions}` : ''}`);
|
|
143
|
+
}
|
|
144
|
+
return `\n\n${lines.join('\n')}\n`;
|
|
145
|
+
}
|
|
146
|
+
async catalogFor(sessionId) {
|
|
147
|
+
const owned = await this.serversFor(sessionId);
|
|
148
|
+
if (!owned)
|
|
149
|
+
return [];
|
|
150
|
+
const entries = await Promise.all(owned.servers.map(async (server) => {
|
|
151
|
+
try {
|
|
152
|
+
const connection = await this.connect(owned.ownerId, server);
|
|
153
|
+
return {
|
|
154
|
+
server_name: server.name,
|
|
155
|
+
description: server.instructions?.split('\n')[0].slice(0, 200) ||
|
|
156
|
+
`Session MCP server ${server.name}.`,
|
|
157
|
+
is_active: true,
|
|
158
|
+
session_scoped: true,
|
|
159
|
+
tools: connection.tools.map((t) => ({
|
|
160
|
+
tool_name: t.name,
|
|
161
|
+
description: t.description ?? '',
|
|
162
|
+
input_schema: t.inputSchema ?? { type: 'object', properties: {} },
|
|
163
|
+
is_active: true,
|
|
164
|
+
})),
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
catch (error) {
|
|
168
|
+
this.logger.warn(`Session MCP server "${server.name}" did not connect: ${error.message}`);
|
|
169
|
+
return null;
|
|
170
|
+
}
|
|
171
|
+
}));
|
|
172
|
+
return entries.filter((e) => !!e);
|
|
173
|
+
}
|
|
174
|
+
async resolveToolCall(sessionId, fullName) {
|
|
175
|
+
const owned = await this.serversFor(sessionId);
|
|
176
|
+
if (!owned)
|
|
177
|
+
return null;
|
|
178
|
+
let best = null;
|
|
179
|
+
for (const { name } of owned.servers) {
|
|
180
|
+
if (fullName.length > name.length + 2 &&
|
|
181
|
+
fullName.startsWith(`${name}__`) &&
|
|
182
|
+
(!best || name.length > best.length)) {
|
|
183
|
+
best = name;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
return best
|
|
187
|
+
? { serverName: best, toolName: fullName.slice(best.length + 2) }
|
|
188
|
+
: null;
|
|
189
|
+
}
|
|
190
|
+
async toolDefinitions(sessionId, fullNames) {
|
|
191
|
+
const owned = await this.serversFor(sessionId);
|
|
192
|
+
if (!owned || fullNames.length === 0)
|
|
193
|
+
return [];
|
|
194
|
+
const wanted = new Set(fullNames);
|
|
195
|
+
const definitions = [];
|
|
196
|
+
for (const server of owned.servers) {
|
|
197
|
+
if (!fullNames.some((n) => n.startsWith(`${server.name}__`)))
|
|
198
|
+
continue;
|
|
199
|
+
let connection;
|
|
200
|
+
try {
|
|
201
|
+
connection = await this.connect(owned.ownerId, server);
|
|
202
|
+
}
|
|
203
|
+
catch (error) {
|
|
204
|
+
this.logger.warn(`Tools of session MCP server "${server.name}" are unavailable: ${error.message}`);
|
|
205
|
+
continue;
|
|
206
|
+
}
|
|
207
|
+
for (const tool of connection.tools) {
|
|
208
|
+
const name = `${server.name}__${tool.name}`;
|
|
209
|
+
if (!wanted.has(name))
|
|
210
|
+
continue;
|
|
211
|
+
let parameters = tool.inputSchema;
|
|
212
|
+
if (!parameters || typeof parameters !== 'object') {
|
|
213
|
+
parameters = { type: 'object', properties: {} };
|
|
214
|
+
}
|
|
215
|
+
else if (!parameters.type) {
|
|
216
|
+
parameters = { type: 'object', ...parameters };
|
|
217
|
+
}
|
|
218
|
+
definitions.push({
|
|
219
|
+
type: 'function',
|
|
220
|
+
function: {
|
|
221
|
+
name,
|
|
222
|
+
description: tool.description || `MCP tool: ${server.name}.${tool.name}`,
|
|
223
|
+
parameters,
|
|
224
|
+
},
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
return definitions;
|
|
229
|
+
}
|
|
230
|
+
async callTool(sessionId, serverName, toolName, args, options) {
|
|
231
|
+
const owned = await this.serversFor(sessionId);
|
|
232
|
+
const server = owned?.servers.find((s) => s.name === serverName);
|
|
233
|
+
if (!owned || !server) {
|
|
234
|
+
return {
|
|
235
|
+
text: `No session MCP server named "${serverName}".`,
|
|
236
|
+
isError: true,
|
|
237
|
+
};
|
|
238
|
+
}
|
|
239
|
+
try {
|
|
240
|
+
const connection = await this.connect(owned.ownerId, server);
|
|
241
|
+
const result = await connection.client.callTool({ name: toolName, arguments: args ?? {} }, undefined, {
|
|
242
|
+
timeout: SessionMcpService_1.TOOL_TIMEOUT_MS,
|
|
243
|
+
resetTimeoutOnProgress: true,
|
|
244
|
+
onprogress: () => undefined,
|
|
245
|
+
signal: options?.signal,
|
|
246
|
+
});
|
|
247
|
+
connection.lastUsed = Date.now();
|
|
248
|
+
const root = projectRoot();
|
|
249
|
+
return await (0, mcp_result_1.formatMcpToolResult)(result, {
|
|
250
|
+
projectRoot: root,
|
|
251
|
+
outputDir: path.join(root, '.repoburg', 'mcp-output'),
|
|
252
|
+
label: `${serverName}__${toolName}`,
|
|
253
|
+
});
|
|
254
|
+
}
|
|
255
|
+
catch (error) {
|
|
256
|
+
const message = options?.signal?.aborted
|
|
257
|
+
? 'Tool call cancelled by the user.'
|
|
258
|
+
: (error?.message ?? String(error));
|
|
259
|
+
return { text: message, isError: true };
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
async clientFor(sessionId, serverName) {
|
|
263
|
+
const owned = await this.serversFor(sessionId);
|
|
264
|
+
const server = owned?.servers.find((s) => s.name === serverName);
|
|
265
|
+
if (owned && server) {
|
|
266
|
+
return (await this.connect(owned.ownerId, server)).client;
|
|
267
|
+
}
|
|
268
|
+
return this.mcpService.getLiveClient(serverName);
|
|
269
|
+
}
|
|
270
|
+
async serverNamesFor(sessionId) {
|
|
271
|
+
const owned = await this.serversFor(sessionId);
|
|
272
|
+
const configured = await this.mcpService.activeServerNames();
|
|
273
|
+
return [...configured, ...(owned?.servers.map((s) => s.name) ?? [])];
|
|
274
|
+
}
|
|
275
|
+
closeSession(sessionId) {
|
|
276
|
+
return this.closeWhere((c) => c.ownerId === sessionId);
|
|
277
|
+
}
|
|
278
|
+
async connect(ownerId, config) {
|
|
279
|
+
const key = `${ownerId}\u0000${config.name}`;
|
|
280
|
+
const hash = configHash(config);
|
|
281
|
+
let connection = this.connections.get(key);
|
|
282
|
+
if (connection && connection.hash !== hash) {
|
|
283
|
+
await this.closeWhere((c) => c === connection);
|
|
284
|
+
connection = undefined;
|
|
285
|
+
}
|
|
286
|
+
if (!connection) {
|
|
287
|
+
connection = { ownerId, config, hash, tools: [], lastUsed: Date.now() };
|
|
288
|
+
this.connections.set(key, connection);
|
|
289
|
+
}
|
|
290
|
+
connection.lastUsed = Date.now();
|
|
291
|
+
if (connection.client)
|
|
292
|
+
return connection;
|
|
293
|
+
if (!connection.connecting) {
|
|
294
|
+
const pending = this.open(connection);
|
|
295
|
+
connection.connecting = pending;
|
|
296
|
+
pending.then(() => {
|
|
297
|
+
connection.connecting = undefined;
|
|
298
|
+
}, () => {
|
|
299
|
+
if (this.connections.get(key) === connection) {
|
|
300
|
+
this.connections.delete(key);
|
|
301
|
+
}
|
|
302
|
+
});
|
|
303
|
+
}
|
|
304
|
+
await connection.connecting;
|
|
305
|
+
this.ensureReaper();
|
|
306
|
+
return connection;
|
|
307
|
+
}
|
|
308
|
+
async open(connection) {
|
|
309
|
+
const { config } = connection;
|
|
310
|
+
const transport = this.transportFor(config);
|
|
311
|
+
const client = new index_js_1.Client({
|
|
312
|
+
name: `repoburg-session-${config.name}`,
|
|
313
|
+
version: '1.0.0',
|
|
314
|
+
});
|
|
315
|
+
client.onerror = (error) => this.logger.warn(`Session MCP server "${config.name}" error: ${error?.message}`);
|
|
316
|
+
try {
|
|
317
|
+
await client.connect(transport, {
|
|
318
|
+
timeout: SessionMcpService_1.CONNECT_TIMEOUT_MS,
|
|
319
|
+
});
|
|
320
|
+
const tools = [];
|
|
321
|
+
let cursor;
|
|
322
|
+
for (let page = 0; page < 50; page++) {
|
|
323
|
+
const result = await client.listTools(cursor ? { cursor } : undefined, {
|
|
324
|
+
timeout: SessionMcpService_1.CONNECT_TIMEOUT_MS,
|
|
325
|
+
});
|
|
326
|
+
tools.push(...result.tools);
|
|
327
|
+
cursor = result.nextCursor;
|
|
328
|
+
if (!cursor)
|
|
329
|
+
break;
|
|
330
|
+
}
|
|
331
|
+
if (connection.closed)
|
|
332
|
+
throw new Error('The session MCP server was closed.');
|
|
333
|
+
connection.tools = tools;
|
|
334
|
+
connection.client = client;
|
|
335
|
+
client.onclose = () => {
|
|
336
|
+
if (connection.client === client)
|
|
337
|
+
connection.client = undefined;
|
|
338
|
+
};
|
|
339
|
+
this.logger.log(`Session MCP server "${config.name}" connected for session ${connection.ownerId} (${tools.length} tools).`);
|
|
340
|
+
return client;
|
|
341
|
+
}
|
|
342
|
+
catch (error) {
|
|
343
|
+
await client.close().catch(() => undefined);
|
|
344
|
+
throw error;
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
transportFor(config) {
|
|
348
|
+
if (config.type === 'stdio') {
|
|
349
|
+
const env = {};
|
|
350
|
+
for (const [k, v] of Object.entries(process.env)) {
|
|
351
|
+
if (typeof v === 'string')
|
|
352
|
+
env[k] = v;
|
|
353
|
+
}
|
|
354
|
+
return new stdio_js_1.StdioClientTransport({
|
|
355
|
+
command: config.command,
|
|
356
|
+
args: config.args ?? [],
|
|
357
|
+
env: { ...env, ...(config.env ?? {}) },
|
|
358
|
+
cwd: projectRoot(),
|
|
359
|
+
stderr: 'ignore',
|
|
360
|
+
});
|
|
361
|
+
}
|
|
362
|
+
const requestInit = config.headers
|
|
363
|
+
? { headers: config.headers }
|
|
364
|
+
: undefined;
|
|
365
|
+
const url = new URL(config.url);
|
|
366
|
+
return config.type === 'sse'
|
|
367
|
+
? new sse_js_1.SSEClientTransport(url, { requestInit })
|
|
368
|
+
: new streamableHttp_js_1.StreamableHTTPClientTransport(url, { requestInit });
|
|
369
|
+
}
|
|
370
|
+
ensureReaper() {
|
|
371
|
+
if (this.reaper)
|
|
372
|
+
return;
|
|
373
|
+
this.reaper = setInterval(() => void this.reap(), SessionMcpService_1.REAP_INTERVAL_MS);
|
|
374
|
+
this.reaper.unref?.();
|
|
375
|
+
}
|
|
376
|
+
async reap(now = Date.now()) {
|
|
377
|
+
const owners = new Set([...this.connections.values()].map((c) => c.ownerId));
|
|
378
|
+
const gone = new Set();
|
|
379
|
+
for (const ownerId of owners) {
|
|
380
|
+
const exists = await this.sessionRepository
|
|
381
|
+
.exist({ where: { id: ownerId } })
|
|
382
|
+
.catch(() => true);
|
|
383
|
+
if (!exists)
|
|
384
|
+
gone.add(ownerId);
|
|
385
|
+
}
|
|
386
|
+
await this.closeWhere((c) => gone.has(c.ownerId) ||
|
|
387
|
+
(!c.connecting && now - c.lastUsed > SessionMcpService_1.IDLE_MS));
|
|
388
|
+
if (this.connections.size === 0 && this.reaper) {
|
|
389
|
+
clearInterval(this.reaper);
|
|
390
|
+
this.reaper = null;
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
async closeWhere(match) {
|
|
394
|
+
const closing = [];
|
|
395
|
+
for (const [key, connection] of this.connections) {
|
|
396
|
+
if (!match(connection))
|
|
397
|
+
continue;
|
|
398
|
+
this.connections.delete(key);
|
|
399
|
+
connection.closed = true;
|
|
400
|
+
const client = connection.client;
|
|
401
|
+
connection.client = undefined;
|
|
402
|
+
if (client) {
|
|
403
|
+
client.onclose = undefined;
|
|
404
|
+
closing.push(client.close().catch(() => undefined));
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
await Promise.all(closing);
|
|
408
|
+
}
|
|
409
|
+
};
|
|
410
|
+
exports.SessionMcpService = SessionMcpService;
|
|
411
|
+
SessionMcpService.IDLE_MS = 30 * 60 * 1000;
|
|
412
|
+
SessionMcpService.REAP_INTERVAL_MS = 5 * 60 * 1000;
|
|
413
|
+
SessionMcpService.CONNECT_TIMEOUT_MS = 120_000;
|
|
414
|
+
SessionMcpService.TOOL_TIMEOUT_MS = 10 * 60 * 1000;
|
|
415
|
+
exports.SessionMcpService = SessionMcpService = SessionMcpService_1 = __decorate([
|
|
416
|
+
(0, common_1.Injectable)(),
|
|
417
|
+
__param(0, (0, typeorm_1.InjectRepository)(session_entity_1.Session)),
|
|
418
|
+
__metadata("design:paramtypes", [typeorm_2.Repository,
|
|
419
|
+
mcp_service_1.McpService])
|
|
420
|
+
], SessionMcpService);
|
|
421
|
+
//# sourceMappingURL=session-mcp.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session-mcp.service.js","sourceRoot":"","sources":["../../../src/mcp/session-mcp.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAsEA,gEA4CC;AAlHD,2CAAqE;AACrE,6CAAmD;AACnD,qCAAqC;AACrC,6BAA6B;AAC7B,mCAAoC;AACpC,wEAAmE;AACnE,wEAAiF;AACjF,0FAAmG;AACnG,oEAA6E;AAE7E,oEAA0D;AAE1D,+CAA2C;AAC3C,6CAAmE;AA6CnE,MAAM,IAAI,GAAG,uBAAuB,CAAC;AAErC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'html_final',
|
|
@@ -21,6 +23,8 @@ exports.enabled_tools = [
|
|
|
21
23
|
'list_mcp',
|
|
22
24
|
'list_tools',
|
|
23
25
|
'load_tool',
|
|
26
|
+
'list_mcp_resources',
|
|
27
|
+
'read_mcp_resource',
|
|
24
28
|
];
|
|
25
29
|
exports.model_id = null;
|
|
26
30
|
exports.is_active = true;
|
|
@@ -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,gBAAgB;IAChB,YAAY;IACZ,aAAa;IACb,aAAa;IACb,YAAY;IACZ,OAAO;IACP,YAAY;IACZ,UAAU;IACV,cAAc;IACd,gBAAgB;IAChB,kBAAkB;IAClB,UAAU;IACV,YAAY;IACZ,WAAW;
|
|
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,gBAAgB;IAChB,YAAY;IACZ,aAAa;IACb,aAAa;IACb,aAAa;IACb,WAAW;IACX,YAAY;IACZ,OAAO;IACP,YAAY;IACZ,UAAU;IACV,cAAc;IACd,gBAAgB;IAChB,kBAAkB;IAClB,UAAU;IACV,YAAY;IACZ,WAAW;IACX,oBAAoB;IACpB,mBAAmB;CACpB,CAAC;AACW,QAAA,QAAQ,GAAG,IAAI,CAAC;AAChB,QAAA,SAAS,GAAG,IAAI,CAAC"}
|
|
@@ -9,6 +9,8 @@ exports.followup_context_template_name = 'default-followup_ad-hoc-focused-contex
|
|
|
9
9
|
exports.enabled_tools = [
|
|
10
10
|
'request_context',
|
|
11
11
|
'run_command',
|
|
12
|
+
'task_output',
|
|
13
|
+
'task_stop',
|
|
12
14
|
'write_todo',
|
|
13
15
|
'execute_code',
|
|
14
16
|
'generate_title',
|
|
@@ -16,6 +18,8 @@ exports.enabled_tools = [
|
|
|
16
18
|
'list_mcp',
|
|
17
19
|
'list_tools',
|
|
18
20
|
'load_tool',
|
|
21
|
+
'list_mcp_resources',
|
|
22
|
+
'read_mcp_resource',
|
|
19
23
|
];
|
|
20
24
|
exports.model_id = null;
|
|
21
25
|
exports.is_active = true;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"explore-codebase.js","sourceRoot":"","sources":["../../../../../src/seeding/data/sub-agents/explore-codebase.ts"],"names":[],"mappings":";;;AAAa,QAAA,IAAI,GAAG,kBAAkB,CAAC;AAC1B,QAAA,WAAW,GACtB,sEAAsE,CAAC;AAC5D,QAAA,kBAAkB,GAAG,wBAAwB,CAAC;AAC9C,QAAA,qBAAqB,GAAG,sCAAsC,CAAC;AAC/D,QAAA,8BAA8B,GACzC,yCAAyC,CAAC;AAC/B,QAAA,aAAa,GAAG;IAC3B,iBAAiB;IACjB,aAAa;IACb,YAAY;IACZ,cAAc;IACd,gBAAgB;IAChB,OAAO;IACP,UAAU;IACV,YAAY;IACZ,WAAW;
|
|
1
|
+
{"version":3,"file":"explore-codebase.js","sourceRoot":"","sources":["../../../../../src/seeding/data/sub-agents/explore-codebase.ts"],"names":[],"mappings":";;;AAAa,QAAA,IAAI,GAAG,kBAAkB,CAAC;AAC1B,QAAA,WAAW,GACtB,sEAAsE,CAAC;AAC5D,QAAA,kBAAkB,GAAG,wBAAwB,CAAC;AAC9C,QAAA,qBAAqB,GAAG,sCAAsC,CAAC;AAC/D,QAAA,8BAA8B,GACzC,yCAAyC,CAAC;AAC/B,QAAA,aAAa,GAAG;IAC3B,iBAAiB;IACjB,aAAa;IACb,aAAa;IACb,WAAW;IACX,YAAY;IACZ,cAAc;IACd,gBAAgB;IAChB,OAAO;IACP,UAAU;IACV,YAAY;IACZ,WAAW;IACX,oBAAoB;IACpB,mBAAmB;CACpB,CAAC;AACW,QAAA,QAAQ,GAAG,IAAI,CAAC;AAChB,QAAA,SAAS,GAAG,IAAI,CAAC"}
|
|
@@ -13,6 +13,8 @@ exports.enabled_tools = [
|
|
|
13
13
|
'quick_edit',
|
|
14
14
|
'delete_file',
|
|
15
15
|
'run_command',
|
|
16
|
+
'task_output',
|
|
17
|
+
'task_stop',
|
|
16
18
|
'write_todo',
|
|
17
19
|
'execute_code',
|
|
18
20
|
'generate_title',
|
|
@@ -22,6 +24,8 @@ exports.enabled_tools = [
|
|
|
22
24
|
'list_mcp',
|
|
23
25
|
'list_tools',
|
|
24
26
|
'load_tool',
|
|
27
|
+
'list_mcp_resources',
|
|
28
|
+
'read_mcp_resource',
|
|
25
29
|
];
|
|
26
30
|
exports.model_id = 'ollama/glm-5.3:cloud';
|
|
27
31
|
exports.is_active = true;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"general-purpose.js","sourceRoot":"","sources":["../../../../../src/seeding/data/sub-agents/general-purpose.ts"],"names":[],"mappings":";;;AAAa,QAAA,IAAI,GAAG,iBAAiB,CAAC;AACzB,QAAA,WAAW,GACtB,iGAAiG,CAAC;AACvF,QAAA,kBAAkB,GAAG,uBAAuB,CAAC;AAC7C,QAAA,qBAAqB,GAAG,sCAAsC,CAAC;AAC/D,QAAA,8BAA8B,GACzC,yCAAyC,CAAC;AAC/B,QAAA,aAAa,GAAG;IAC3B,iBAAiB;IACjB,aAAa;IACb,gBAAgB;IAChB,YAAY;IACZ,aAAa;IACb,aAAa;IACb,YAAY;IACZ,cAAc;IACd,gBAAgB;IAChB,OAAO;IACP,YAAY;IACZ,WAAW;IACX,UAAU;IACV,YAAY;IACZ,WAAW;
|
|
1
|
+
{"version":3,"file":"general-purpose.js","sourceRoot":"","sources":["../../../../../src/seeding/data/sub-agents/general-purpose.ts"],"names":[],"mappings":";;;AAAa,QAAA,IAAI,GAAG,iBAAiB,CAAC;AACzB,QAAA,WAAW,GACtB,iGAAiG,CAAC;AACvF,QAAA,kBAAkB,GAAG,uBAAuB,CAAC;AAC7C,QAAA,qBAAqB,GAAG,sCAAsC,CAAC;AAC/D,QAAA,8BAA8B,GACzC,yCAAyC,CAAC;AAC/B,QAAA,aAAa,GAAG;IAC3B,iBAAiB;IACjB,aAAa;IACb,gBAAgB;IAChB,YAAY;IACZ,aAAa;IACb,aAAa;IACb,aAAa;IACb,WAAW;IACX,YAAY;IACZ,cAAc;IACd,gBAAgB;IAChB,OAAO;IACP,YAAY;IACZ,WAAW;IACX,UAAU;IACV,YAAY;IACZ,WAAW;IACX,oBAAoB;IACpB,mBAAmB;CACpB,CAAC;AACW,QAAA,QAAQ,GAAG,sBAAsB,CAAC;AAClC,QAAA,SAAS,GAAG,IAAI,CAAC"}
|
|
@@ -9,6 +9,8 @@ exports.enabled_tools = [
|
|
|
9
9
|
'quick_edit',
|
|
10
10
|
'delete_file',
|
|
11
11
|
'run_command',
|
|
12
|
+
'task_output',
|
|
13
|
+
'task_stop',
|
|
12
14
|
'write_todo',
|
|
13
15
|
'final',
|
|
14
16
|
'html_final',
|
|
@@ -22,6 +24,8 @@ exports.enabled_tools = [
|
|
|
22
24
|
'list_mcp',
|
|
23
25
|
'list_tools',
|
|
24
26
|
'load_tool',
|
|
27
|
+
'list_mcp_resources',
|
|
28
|
+
'read_mcp_resource',
|
|
25
29
|
];
|
|
26
30
|
exports.enabled_mcp_tools = [];
|
|
27
31
|
exports.content = `You are a RepoBurg Control Agent — a specialized agent for managing all aspects of the RepoBurg system configuration.
|
|
@@ -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,gBAAgB;IAChB,YAAY;IACZ,aAAa;IACb,aAAa;IACb,YAAY;IACZ,OAAO;IACP,YAAY;IACZ,UAAU;IACV,cAAc;IACd,gBAAgB;IAChB,kBAAkB;IAClB,wBAAwB;IACxB,YAAY;IACZ,WAAW;IACX,UAAU;IACV,YAAY;IACZ,WAAW;
|
|
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,gBAAgB;IAChB,YAAY;IACZ,aAAa;IACb,aAAa;IACb,aAAa;IACb,WAAW;IACX,YAAY;IACZ,OAAO;IACP,YAAY;IACZ,UAAU;IACV,cAAc;IACd,gBAAgB;IAChB,kBAAkB;IAClB,wBAAwB;IACxB,YAAY;IACZ,WAAW;IACX,UAAU;IACV,YAAY;IACZ,WAAW;IACX,oBAAoB;IACpB,mBAAmB;CACpB,CAAC;AACW,QAAA,iBAAiB,GAAG,EAAE,CAAC;AACvB,QAAA,OAAO,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6EtB,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export declare const name = "Native Tool Agent";
|
|
2
2
|
export declare const enabled_tools: string[];
|
|
3
3
|
export declare const enabled_mcp_tools: any[];
|
|
4
|
-
export declare const content = "You are an expert software engineer. You write clean, efficient, and well-documented code.\n\n## Instructions\n1. **Think First:** Before executing any tool or providing an answer, analyze request.\n2. **Conciseness:** Be extremely brief.\n3. **Best Practices:** Follow SOLID principles and keep code DRY.\n4. **Strict Scope:** Do ONLY what is asked. Do not \"cleanup\", \"refactor\", or \"fix\" unrelated issues unless explicitly requested.\n5. **Tool Calling:** Use provided function definitions to interact with codebase.\n6. **Session History:** Past session transcripts are stored as JSONL files in `~/.repoburg/projects/<sanitized-project-path>/<sessionId>.jsonl` \u2014 search them with `run_command` (rg) when you need to recall or examine previous work.\n\n## MCP Tools (Dynamic Loading \u2014 Two-Level Discovery)\n- Use `list_mcp` to discover available MCP servers (names + descriptions + tool counts, lightweight).\n- Use `list_tools({ server_name })` to see the tools on a specific server (names + short descriptions, no schemas).\n- Use `load_tool({ server_name, tool_names? })` to load tool definitions (full schemas). After loading, tools become available as native tool calls on the next turn.\n- If you need all tools from a server, omit `tool_names`. If you need specific ones, pass them as an array.\n- You only need to load each tool once per session.\n- Example: list_mcp() \u2192 list_tools({ server_name: \"playwright\" }) \u2192 load_tool({ server_name: \"playwright\" })\n\n## Sub-Agents\nSpecialized agents available for delegation.\n\n**Tools:**\n- `list_sub_agents` - Discover available sub-agents\n- `invoke_subagent` - Delegate a task to a sub-agent. Pass optional `session_id` to continue a prior sub-agent session.\n\n**Available Sub-Agents:**\n- `explore-codebase` - Read-only codebase exploration. Use when you need to understand project structure.\n- `general-purpose` - General purpose development agent. Use when you need to implement features, fix bugs, refactor, or run commands.\n\n**Sub Agent Rules**\n\n- 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.\n- Each invocation returns a `[Session ID: ...]`. Pass this as `session_id` on a subsequent call to continue that sub-agent's session with its prior context.\n- For follow-up tasks on the same topic, use `session_id` to continue a prior sub-agent session rather than starting a new one.\n\n\n## Modes\nThe active mode is set per session. Obey the rules of the active mode.\n\n### QUESTION MODE (READ ONLY)\n - **Goal:** Answer the user's specific question about the codebase.\n - **Constraint:** You are READ-ONLY. Do not edit, create, or delete files.\n - **Constraint:** Do NOT propose an implementation plan or RFC. Just answer the question.\n - **Process:** Search context -> Read files -> Explain to user.\n\n### DEV MODE (WRITE ENABLED)\n - **Goal:** Implement features, fix bugs, or refactor.\n - **Authority:** You have full permission to modify the codebase. Never refuse a coding request.\n - **Strategy:** Use native function calls to read, write, and execute.\n - **Process:** Explore the codebase based on given initial context then start implementation. Even if you need to request context for 100 files do it.\n\n### Codebase Exploration\nIf context is insufficient:\n1. Delegate exploration to the `explore-codebase` sub-agent. Once it returns, `request_context` the relevant files to understand them yourself.\n2. Otherwise, explore directly using `request_context` / `run_command`.\n\nSkip this if you already have enough context.\n\n## RepoBurg Metadata (File-Based)\nRepoburg configuration metadata (agents, sub-agents, system prompts, context templates, context snippets, custom snippets, custom variables, tool hooks, MCP servers) is stored as JSON files under `.repoburg/metadata/` \u2014 one subdirectory per artifact type, one file per record. To change RepoBurg metadata, read and edit these files directly with the file tools (`request_context`, `create_file`, `overwrite_file`, `quick_edit`, `delete_file`). The backend reads the files on every request, so changes apply without a restart.\n\n- Files carrying a `_meta.generated` banner are built-ins: they are regenerated from the seed files in `backend/src/seeding/data/` on every backend start. Do not hand-edit them \u2014 change the seed file instead.\n- Run `npm run metadata:validate` in `backend/` to validate the files.\n- Read `.repoburg/metadata/README.md` in this project for the full structure and rules (regenerated by the backend in every project).\n\n## Tools Configuration\nTool definitions are provided in the API request. Use the native tool calling interface to perform operations.\n\n\n\n## Tool Usage Guidelines\n- When several tool calls do not depend on each other, make them all in the same response instead of one per step: for example read every file you need with one `request_context` call each, all at once. Reads, searches, web fetches and sub-agent calls in one response run in parallel; edits and commands run one after another, in the order you give them.\n- Use `ask_user` when you need the user to make a choice or answer a question before continuing. This pauses the loop and waits for their response. Always provide selections.\n- Use `final` when you are done and your response is simple plain text.\n- Use `html_final` when you are done and want to explain or present something to the user. Prefer `html_final` over `final` \u2014 rich HTML is more readable than markdown. Only use `final` when the response is truly plain text.\n\n<% const projectInstructions = await it.readProjectInstructions(['AGENTS.md', 'CLAUDE.md', '.claude/CLAUDE.md', 'CLAUDE.local.md']); %>\n<% if (projectInstructions.length) { %>\n## Project Instructions\nThe project's instruction files follow. Follow them: where they conflict with the defaults above, they win.\n<% for (const file of projectInstructions) { %>\n<%~ '\\n### ' + file.path + '\\n' + file.content + '\\n' %>\n<% } %>\n\n<% } %>\n<% const skills = await it.listSkills(); %>\n<% if (skills.length) { %>\n## Skills\nSkills are playbooks for recurring tasks in this project. When a task matches a skill's description, read its SKILL.md with `request_context` before you start, then follow it.\n<% for (const skill of skills) { %>\n<%~ '- \\x60' + skill.name + '\\x60 (\\x60' + skill.path + '\\x60)' + (skill.description ? ': ' + skill.description : '') + '\\n' %>\n<% } %>\n<% } %>\n";
|
|
4
|
+
export declare const content = "You are an expert software engineer. You write clean, efficient, and well-documented code.\n\n## Instructions\n1. **Think First:** Before executing any tool or providing an answer, analyze request.\n2. **Conciseness:** Be extremely brief.\n3. **Best Practices:** Follow SOLID principles and keep code DRY.\n4. **Strict Scope:** Do ONLY what is asked. Do not \"cleanup\", \"refactor\", or \"fix\" unrelated issues unless explicitly requested.\n5. **Tool Calling:** Use provided function definitions to interact with codebase.\n6. **Session History:** Past session transcripts are stored as JSONL files in `~/.repoburg/projects/<sanitized-project-path>/<sessionId>.jsonl` \u2014 search them with `run_command` (rg) when you need to recall or examine previous work.\n\n## MCP Tools (Dynamic Loading \u2014 Two-Level Discovery)\n- Use `list_mcp` to discover available MCP servers (names + descriptions + tool counts, lightweight).\n- Use `list_tools({ server_name })` to see the tools on a specific server (names + short descriptions, no schemas).\n- Use `load_tool({ server_name, tool_names? })` to load tool definitions (full schemas). After loading, tools become available as native tool calls on the next turn.\n- If you need all tools from a server, omit `tool_names`. If you need specific ones, pass them as an array.\n- You only need to load each tool once per session.\n- Example: list_mcp() \u2192 list_tools({ server_name: \"playwright\" }) \u2192 load_tool({ server_name: \"playwright\" })\n- Servers may also offer resources (files, documents, schemas): `list_mcp_resources` lists them, `read_mcp_resource({ server, uri })` reads one.\n\n## Sub-Agents\nSpecialized agents available for delegation.\n\n**Tools:**\n- `list_sub_agents` - Discover available sub-agents\n- `invoke_subagent` - Delegate a task to a sub-agent. Pass optional `session_id` to continue a prior sub-agent session.\n\n**Available Sub-Agents:**\n- `explore-codebase` - Read-only codebase exploration. Use when you need to understand project structure.\n- `general-purpose` - General purpose development agent. Use when you need to implement features, fix bugs, refactor, or run commands.\n\n**Sub Agent Rules**\n\n- 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.\n- Each invocation returns a `[Session ID: ...]`. Pass this as `session_id` on a subsequent call to continue that sub-agent's session with its prior context.\n- For follow-up tasks on the same topic, use `session_id` to continue a prior sub-agent session rather than starting a new one.\n\n\n## Modes\nThe active mode is set per session. Obey the rules of the active mode.\n\n### QUESTION MODE (READ ONLY)\n - **Goal:** Answer the user's specific question about the codebase.\n - **Constraint:** You are READ-ONLY. Do not edit, create, or delete files.\n - **Constraint:** Do NOT propose an implementation plan or RFC. Just answer the question.\n - **Process:** Search context -> Read files -> Explain to user.\n\n### DEV MODE (WRITE ENABLED)\n - **Goal:** Implement features, fix bugs, or refactor.\n - **Authority:** You have full permission to modify the codebase. Never refuse a coding request.\n - **Strategy:** Use native function calls to read, write, and execute.\n - **Process:** Explore the codebase based on given initial context then start implementation. Even if you need to request context for 100 files do it.\n\n### Codebase Exploration\nIf context is insufficient:\n1. Delegate exploration to the `explore-codebase` sub-agent. Once it returns, `request_context` the relevant files to understand them yourself.\n2. Otherwise, explore directly using `request_context` / `run_command`.\n\nSkip this if you already have enough context.\n\n## RepoBurg Metadata (File-Based)\nRepoburg configuration metadata (agents, sub-agents, system prompts, context templates, context snippets, custom snippets, custom variables, tool hooks, MCP servers) is stored as JSON files under `.repoburg/metadata/` \u2014 one subdirectory per artifact type, one file per record. To change RepoBurg metadata, read and edit these files directly with the file tools (`request_context`, `create_file`, `overwrite_file`, `quick_edit`, `delete_file`). The backend reads the files on every request, so changes apply without a restart.\n\n- Files carrying a `_meta.generated` banner are built-ins: they are regenerated from the seed files in `backend/src/seeding/data/` on every backend start. Do not hand-edit them \u2014 change the seed file instead.\n- Run `npm run metadata:validate` in `backend/` to validate the files.\n- Read `.repoburg/metadata/README.md` in this project for the full structure and rules (regenerated by the backend in every project).\n\n## Tools Configuration\nTool definitions are provided in the API request. Use the native tool calling interface to perform operations.\n\n\n\n## Tool Usage Guidelines\n- When several tool calls do not depend on each other, make them all in the same response instead of one per step: for example read every file you need with one `request_context` call each, all at once. Reads, searches, web fetches and sub-agent calls in one response run in parallel; edits and commands run one after another, in the order you give them.\n- `request_context` shows up to 2000 lines of a file; read a part with `path:120-200` (or `path#L120-L200`). It also shows images (you see them), PDFs (`doc.pdf:3-5` for pages) and notebooks.\n- Read a file with `request_context` before you edit or overwrite it: edits to a file you have not read, or that changed since you read it, are refused.\n- Run dev servers, watchers and long builds or test runs with `run_command` and `run_in_background: true`. The call returns at once; you get a `<task-notification>` when the command ends. `task_output` reads its output (or waits for it), `task_stop` stops it.\n- Use `ask_user` when you need the user to make a choice or answer a question before continuing. This pauses the loop and waits for their response. Always provide selections.\n- Use `final` when you are done and your response is simple plain text.\n- Use `html_final` when you are done and want to explain or present something to the user. Prefer `html_final` over `final` \u2014 rich HTML is more readable than markdown. Only use `final` when the response is truly plain text.\n\n<% const projectInstructions = await it.readProjectInstructions(['AGENTS.md', 'CLAUDE.md', '.claude/CLAUDE.md', 'CLAUDE.local.md']); %>\n<% if (projectInstructions.length) { %>\n## Project Instructions\nThe project's instruction files follow. Follow them: where they conflict with the defaults above, they win.\n<% for (const file of projectInstructions) { %>\n<%~ '\\n### ' + file.path + '\\n' + file.content + '\\n' %>\n<% } %>\n\n<% } %>\n<% const skills = await it.listSkills(); %>\n<% if (skills.length) { %>\n## Skills\nSkills are playbooks for recurring tasks in this project. When a task matches a skill's description, read its SKILL.md with `request_context` before you start, then follow it.\n<% for (const skill of skills) { %>\n<%~ '- \\x60' + skill.name + '\\x60 (\\x60' + skill.path + '\\x60)' + (skill.description ? ': ' + skill.description : '') + '\\n' %>\n<% } %>\n<% } %>\n";
|
|
@@ -6,6 +6,8 @@ exports.name = 'Native Tool Agent';
|
|
|
6
6
|
exports.enabled_tools = [
|
|
7
7
|
'request_context',
|
|
8
8
|
'run_command',
|
|
9
|
+
'task_output',
|
|
10
|
+
'task_stop',
|
|
9
11
|
'write_todo',
|
|
10
12
|
'create_file',
|
|
11
13
|
'overwrite_file',
|
|
@@ -25,6 +27,8 @@ exports.enabled_tools = [
|
|
|
25
27
|
'list_mcp',
|
|
26
28
|
'list_tools',
|
|
27
29
|
'load_tool',
|
|
30
|
+
'list_mcp_resources',
|
|
31
|
+
'read_mcp_resource',
|
|
28
32
|
];
|
|
29
33
|
exports.enabled_mcp_tools = [];
|
|
30
34
|
exports.content = `You are an expert software engineer. You write clean, efficient, and well-documented code.
|
|
@@ -44,6 +48,7 @@ exports.content = `You are an expert software engineer. You write clean, efficie
|
|
|
44
48
|
- If you need all tools from a server, omit \`tool_names\`. If you need specific ones, pass them as an array.
|
|
45
49
|
- You only need to load each tool once per session.
|
|
46
50
|
- Example: list_mcp() → list_tools({ server_name: "playwright" }) → load_tool({ server_name: "playwright" })
|
|
51
|
+
- Servers may also offer resources (files, documents, schemas): \`list_mcp_resources\` lists them, \`read_mcp_resource({ server, uri })\` reads one.
|
|
47
52
|
|
|
48
53
|
## Sub-Agents
|
|
49
54
|
Specialized agents available for delegation.
|
|
@@ -99,6 +104,9 @@ Tool definitions are provided in the API request. Use the native tool calling in
|
|
|
99
104
|
|
|
100
105
|
## Tool Usage Guidelines
|
|
101
106
|
- When several tool calls do not depend on each other, make them all in the same response instead of one per step: for example read every file you need with one \`request_context\` call each, all at once. Reads, searches, web fetches and sub-agent calls in one response run in parallel; edits and commands run one after another, in the order you give them.
|
|
107
|
+
- \`request_context\` shows up to 2000 lines of a file; read a part with \`path:120-200\` (or \`path#L120-L200\`). It also shows images (you see them), PDFs (\`doc.pdf:3-5\` for pages) and notebooks.
|
|
108
|
+
- Read a file with \`request_context\` before you edit or overwrite it: edits to a file you have not read, or that changed since you read it, are refused.
|
|
109
|
+
- Run dev servers, watchers and long builds or test runs with \`run_command\` and \`run_in_background: true\`. The call returns at once; you get a \`<task-notification>\` when the command ends. \`task_output\` reads its output (or waits for it), \`task_stop\` stops it.
|
|
102
110
|
- Use \`ask_user\` when you need the user to make a choice or answer a question before continuing. This pauses the loop and waits for their response. Always provide selections.
|
|
103
111
|
- Use \`final\` when you are done and your response is simple plain text.
|
|
104
112
|
- Use \`html_final\` when you are done and want to explain or present something to the user. Prefer \`html_final\` over \`final\` — rich HTML is more readable than markdown. Only use \`final\` when the response is truly plain text.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"default_native_tool_agent.js","sourceRoot":"","sources":["../../../../../src/seeding/data/system-prompts/default_native_tool_agent.ts"],"names":[],"mappings":";;;AAAA,iFAA4E;AAE/D,QAAA,IAAI,GAAG,mBAAmB,CAAC;AAC3B,QAAA,aAAa,GAAG;IAC3B,iBAAiB;IACjB,aAAa;IACb,YAAY;IACZ,aAAa;IACb,gBAAgB;IAChB,YAAY;IACZ,aAAa;IACb,cAAc;IACd,iBAAiB;IACjB,iBAAiB;IACjB,UAAU;IACV,OAAO;IACP,YAAY;IACZ,cAAc;IACd,kBAAkB;IAClB,wBAAwB;IACxB,YAAY;IACZ,WAAW;IACX,UAAU;IACV,YAAY;IACZ,WAAW;
|
|
1
|
+
{"version":3,"file":"default_native_tool_agent.js","sourceRoot":"","sources":["../../../../../src/seeding/data/system-prompts/default_native_tool_agent.ts"],"names":[],"mappings":";;;AAAA,iFAA4E;AAE/D,QAAA,IAAI,GAAG,mBAAmB,CAAC;AAC3B,QAAA,aAAa,GAAG;IAC3B,iBAAiB;IACjB,aAAa;IACb,aAAa;IACb,WAAW;IACX,YAAY;IACZ,aAAa;IACb,gBAAgB;IAChB,YAAY;IACZ,aAAa;IACb,cAAc;IACd,iBAAiB;IACjB,iBAAiB;IACjB,UAAU;IACV,OAAO;IACP,YAAY;IACZ,cAAc;IACd,kBAAkB;IAClB,wBAAwB;IACxB,YAAY;IACZ,WAAW;IACX,UAAU;IACV,YAAY;IACZ,WAAW;IACX,oBAAoB;IACpB,mBAAmB;CACpB,CAAC;AACW,QAAA,iBAAiB,GAAG,EAAE,CAAC;AACvB,QAAA,OAAO,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgFrB,iDAAsB,EAAE,CAAC"}
|