repoburg 1.3.319 → 1.3.321

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (195) hide show
  1. package/agent-pane/backend/dist/index.js +510 -159
  2. package/agent-pane/backend/dist/server.js +510 -159
  3. package/agent-pane/frontend/dist/assets/{TerminalView-D5Hg3Fzf.js → TerminalView-Z7ZJ436H.js} +1 -1
  4. package/agent-pane/frontend/dist/assets/{index-Cckb2tlY.js → index-CjwvHfxy.js} +12 -2
  5. package/agent-pane/frontend/dist/index.html +1 -1
  6. package/backend/dist/src/agent-runtime/agent-runtime-event-emitter.d.ts +2 -1
  7. package/backend/dist/src/agent-runtime/agent-runtime-event-emitter.js +10 -0
  8. package/backend/dist/src/agent-runtime/agent-runtime-event-emitter.js.map +1 -1
  9. package/backend/dist/src/agent-runtime/agent-runtime.types.d.ts +12 -1
  10. package/backend/dist/src/ai-actions/ai-action-batch.service.js +6 -3
  11. package/backend/dist/src/ai-actions/ai-action-batch.service.js.map +1 -1
  12. package/backend/dist/src/app.module.js +2 -9
  13. package/backend/dist/src/app.module.js.map +1 -1
  14. package/backend/dist/src/application-state/application-state.service.d.ts +3 -4
  15. package/backend/dist/src/application-state/application-state.service.js +21 -25
  16. package/backend/dist/src/application-state/application-state.service.js.map +1 -1
  17. package/backend/dist/src/context-generation/context-generation.service.js +3 -0
  18. package/backend/dist/src/context-generation/context-generation.service.js.map +1 -1
  19. package/backend/dist/src/context-generation/project-guidance.d.ts +12 -0
  20. package/backend/dist/src/context-generation/project-guidance.js +103 -0
  21. package/backend/dist/src/context-generation/project-guidance.js.map +1 -0
  22. package/backend/dist/src/core-entities/mcp-config.entity.d.ts +3 -1
  23. package/backend/dist/src/core-entities/mcp-config.entity.js +17 -1
  24. package/backend/dist/src/core-entities/mcp-config.entity.js.map +1 -1
  25. package/backend/dist/src/global-config/dto/update-global-config.dto.d.ts +2 -0
  26. package/backend/dist/src/global-config/dto/update-global-config.dto.js +12 -0
  27. package/backend/dist/src/global-config/dto/update-global-config.dto.js.map +1 -1
  28. package/backend/dist/src/global-config/global-config.service.d.ts +2 -0
  29. package/backend/dist/src/global-config/global-config.service.js.map +1 -1
  30. package/backend/dist/src/interactive-chat/auto-compact.service.d.ts +34 -0
  31. package/backend/dist/src/interactive-chat/auto-compact.service.js +259 -0
  32. package/backend/dist/src/interactive-chat/auto-compact.service.js.map +1 -0
  33. package/backend/dist/src/interactive-chat/chat.module.js +2 -5
  34. package/backend/dist/src/interactive-chat/chat.module.js.map +1 -1
  35. package/backend/dist/src/interactive-chat/chat.service.d.ts +12 -4
  36. package/backend/dist/src/interactive-chat/chat.service.js +102 -39
  37. package/backend/dist/src/interactive-chat/chat.service.js.map +1 -1
  38. package/backend/dist/src/llm-orchestration/action-handlers/execute-code.handler.d.ts +1 -1
  39. package/backend/dist/src/llm-orchestration/action-handlers/execute-code.handler.js +8 -2
  40. package/backend/dist/src/llm-orchestration/action-handlers/execute-code.handler.js.map +1 -1
  41. package/backend/dist/src/llm-orchestration/action-handlers/mcp-tool-action.handler.d.ts +5 -2
  42. package/backend/dist/src/llm-orchestration/action-handlers/mcp-tool-action.handler.js +50 -17
  43. package/backend/dist/src/llm-orchestration/action-handlers/mcp-tool-action.handler.js.map +1 -1
  44. package/backend/dist/src/llm-orchestration/action-handlers/run-command.handler.js +9 -1
  45. package/backend/dist/src/llm-orchestration/action-handlers/run-command.handler.js.map +1 -1
  46. package/backend/dist/src/llm-orchestration/hooks/follow-up-post-execution.hook.js +8 -0
  47. package/backend/dist/src/llm-orchestration/hooks/follow-up-post-execution.hook.js.map +1 -1
  48. package/backend/dist/src/llm-orchestration/hooks/yolo-mode-post-execution.hook.js +2 -1
  49. package/backend/dist/src/llm-orchestration/hooks/yolo-mode-post-execution.hook.js.map +1 -1
  50. package/backend/dist/src/llm-orchestration/llm-orchestration.interfaces.d.ts +2 -0
  51. package/backend/dist/src/llm-orchestration/llm-orchestration.interfaces.js.map +1 -1
  52. package/backend/dist/src/llm-orchestration/llm-orchestration.module.js +0 -2
  53. package/backend/dist/src/llm-orchestration/llm-orchestration.module.js.map +1 -1
  54. package/backend/dist/src/llm-orchestration/llm-turn-processor.service.d.ts +8 -1
  55. package/backend/dist/src/llm-orchestration/llm-turn-processor.service.js +237 -194
  56. package/backend/dist/src/llm-orchestration/llm-turn-processor.service.js.map +1 -1
  57. package/backend/dist/src/llm-orchestration/turn-execution-plan.d.ts +18 -0
  58. package/backend/dist/src/llm-orchestration/turn-execution-plan.js +53 -0
  59. package/backend/dist/src/llm-orchestration/turn-execution-plan.js.map +1 -0
  60. package/backend/dist/src/llm-provider/ollama-llm.provider.d.ts +1 -0
  61. package/backend/dist/src/llm-provider/ollama-llm.provider.js +21 -5
  62. package/backend/dist/src/llm-provider/ollama-llm.provider.js.map +1 -1
  63. package/backend/dist/src/llm-provider/openrouter-llm.provider.d.ts +3 -0
  64. package/backend/dist/src/llm-provider/openrouter-llm.provider.js +8 -0
  65. package/backend/dist/src/llm-provider/openrouter-llm.provider.js.map +1 -1
  66. package/backend/dist/src/llm-responses/llm-responses.module.js +0 -4
  67. package/backend/dist/src/llm-responses/llm-responses.module.js.map +1 -1
  68. package/backend/dist/src/llm-responses/llm-responses.service.d.ts +12 -4
  69. package/backend/dist/src/llm-responses/llm-responses.service.js +4 -45
  70. package/backend/dist/src/llm-responses/llm-responses.service.js.map +1 -1
  71. package/backend/dist/src/main.js +4 -0
  72. package/backend/dist/src/main.js.map +1 -1
  73. package/backend/dist/src/mcp/marketplace/dto/initiate-connect.dto.d.ts +3 -1
  74. package/backend/dist/src/mcp/marketplace/dto/initiate-connect.dto.js +19 -0
  75. package/backend/dist/src/mcp/marketplace/dto/initiate-connect.dto.js.map +1 -1
  76. package/backend/dist/src/mcp/marketplace/marketplace.controller.js +7 -0
  77. package/backend/dist/src/mcp/marketplace/marketplace.controller.js.map +1 -1
  78. package/backend/dist/src/mcp/marketplace/marketplace.service.d.ts +9 -0
  79. package/backend/dist/src/mcp/marketplace/marketplace.service.js +68 -13
  80. package/backend/dist/src/mcp/marketplace/marketplace.service.js.map +1 -1
  81. package/backend/dist/src/mcp/marketplace/oauth-provider.d.ts +3 -0
  82. package/backend/dist/src/mcp/marketplace/oauth-provider.js.map +1 -1
  83. package/backend/dist/src/mcp/mcp-result.d.ts +12 -0
  84. package/backend/dist/src/mcp/mcp-result.js +125 -0
  85. package/backend/dist/src/mcp/mcp-result.js.map +1 -0
  86. package/backend/dist/src/mcp/mcp.service.d.ts +33 -1
  87. package/backend/dist/src/mcp/mcp.service.js +364 -79
  88. package/backend/dist/src/mcp/mcp.service.js.map +1 -1
  89. package/backend/dist/src/metadata-store/schemas/metadata-schemas.d.ts +3 -1
  90. package/backend/dist/src/metadata-store/schemas/metadata-schemas.js +11 -1
  91. package/backend/dist/src/metadata-store/schemas/metadata-schemas.js.map +1 -1
  92. package/backend/dist/src/seeding/data/shared/project-guidance-section.d.ts +1 -0
  93. package/backend/dist/src/seeding/data/shared/project-guidance-section.js +22 -0
  94. package/backend/dist/src/seeding/data/shared/project-guidance-section.js.map +1 -0
  95. package/backend/dist/src/seeding/data/system-prompts/default_native_tool_agent.d.ts +1 -1
  96. package/backend/dist/src/seeding/data/system-prompts/default_native_tool_agent.js +10 -38
  97. package/backend/dist/src/seeding/data/system-prompts/default_native_tool_agent.js.map +1 -1
  98. package/backend/dist/src/seeding/data/system-prompts/explore-codebase-agent.d.ts +1 -1
  99. package/backend/dist/src/seeding/data/system-prompts/explore-codebase-agent.js +3 -1
  100. package/backend/dist/src/seeding/data/system-prompts/explore-codebase-agent.js.map +1 -1
  101. package/backend/dist/src/seeding/data/system-prompts/general-purpose-agent.d.ts +1 -1
  102. package/backend/dist/src/seeding/data/system-prompts/general-purpose-agent.js +3 -1
  103. package/backend/dist/src/seeding/data/system-prompts/general-purpose-agent.js.map +1 -1
  104. package/backend/dist/src/session-cancellation/session-cancellation.module.d.ts +2 -0
  105. package/backend/dist/src/{message-bus/message-bus.module.js → session-cancellation/session-cancellation.module.js} +10 -11
  106. package/backend/dist/src/session-cancellation/session-cancellation.module.js.map +1 -0
  107. package/backend/dist/src/session-cancellation/session-cancellation.service.d.ts +13 -0
  108. package/backend/dist/src/session-cancellation/session-cancellation.service.js +75 -0
  109. package/backend/dist/src/session-cancellation/session-cancellation.service.js.map +1 -0
  110. package/backend/dist/src/session-inputs/session-inputs.service.js +3 -1
  111. package/backend/dist/src/session-inputs/session-inputs.service.js.map +1 -1
  112. package/backend/dist/src/sessions/sessions.module.js +0 -2
  113. package/backend/dist/src/sessions/sessions.module.js.map +1 -1
  114. package/backend/dist/src/sessions/sessions.service.d.ts +1 -3
  115. package/backend/dist/src/sessions/sessions.service.js +1 -5
  116. package/backend/dist/src/sessions/sessions.service.js.map +1 -1
  117. package/backend/dist/src/tool-hooks/hook-runtime.d.ts +1 -1
  118. package/backend/dist/src/tool-hooks/hook-runtime.js +17 -16
  119. package/backend/dist/src/tool-hooks/hook-runtime.js.map +1 -1
  120. package/backend/dist/src/utils/spawn-with-kill.d.ts +2 -0
  121. package/backend/dist/src/utils/spawn-with-kill.js +18 -3
  122. package/backend/dist/src/utils/spawn-with-kill.js.map +1 -1
  123. package/backend/dist/tsconfig.build.tsbuildinfo +1 -1
  124. package/daemon/dist/index.js +1 -17
  125. package/package.json +2 -8
  126. package/platform-cli.js +0 -316
  127. package/tabtape/extension/dist/build-info.json +3 -3
  128. package/tabtape/extension/dist/manifest.json +1 -1
  129. package/tabtape/ui/dist/build-info.json +3 -3
  130. package/backend/dist/src/llm-responses/dto/submit-llm-response.dto.d.ts +0 -9
  131. package/backend/dist/src/llm-responses/dto/submit-llm-response.dto.js +0 -80
  132. package/backend/dist/src/llm-responses/dto/submit-llm-response.dto.js.map +0 -1
  133. package/backend/dist/src/llm-responses/llm-responses.controller.d.ts +0 -8
  134. package/backend/dist/src/llm-responses/llm-responses.controller.js +0 -51
  135. package/backend/dist/src/llm-responses/llm-responses.controller.js.map +0 -1
  136. package/backend/dist/src/mcp-server/mcp-internal.controller.d.ts +0 -12
  137. package/backend/dist/src/mcp-server/mcp-internal.controller.js +0 -50
  138. package/backend/dist/src/mcp-server/mcp-internal.controller.js.map +0 -1
  139. package/backend/dist/src/mcp-server/mcp-server.bootstrap.d.ts +0 -2
  140. package/backend/dist/src/mcp-server/mcp-server.bootstrap.js +0 -166
  141. package/backend/dist/src/mcp-server/mcp-server.bootstrap.js.map +0 -1
  142. package/backend/dist/src/mcp-server/mcp-server.constants.d.ts +0 -8
  143. package/backend/dist/src/mcp-server/mcp-server.constants.js +0 -12
  144. package/backend/dist/src/mcp-server/mcp-server.constants.js.map +0 -1
  145. package/backend/dist/src/mcp-server/mcp-server.controller.d.ts +0 -19
  146. package/backend/dist/src/mcp-server/mcp-server.controller.js +0 -72
  147. package/backend/dist/src/mcp-server/mcp-server.controller.js.map +0 -1
  148. package/backend/dist/src/mcp-server/mcp-server.module.d.ts +0 -2
  149. package/backend/dist/src/mcp-server/mcp-server.module.js +0 -29
  150. package/backend/dist/src/mcp-server/mcp-server.module.js.map +0 -1
  151. package/backend/dist/src/mcp-server/mcp-server.process.service.d.ts +0 -23
  152. package/backend/dist/src/mcp-server/mcp-server.process.service.js +0 -130
  153. package/backend/dist/src/mcp-server/mcp-server.process.service.js.map +0 -1
  154. package/backend/dist/src/mcp-server/mcp-server.service.d.ts +0 -34
  155. package/backend/dist/src/mcp-server/mcp-server.service.js +0 -260
  156. package/backend/dist/src/mcp-server/mcp-server.service.js.map +0 -1
  157. package/backend/dist/src/message-bus/dto/submit-message.dto.d.ts +0 -4
  158. package/backend/dist/src/message-bus/dto/submit-message.dto.js +0 -22
  159. package/backend/dist/src/message-bus/dto/submit-message.dto.js.map +0 -1
  160. package/backend/dist/src/message-bus/message-bus.controller.d.ts +0 -13
  161. package/backend/dist/src/message-bus/message-bus.controller.js +0 -50
  162. package/backend/dist/src/message-bus/message-bus.controller.js.map +0 -1
  163. package/backend/dist/src/message-bus/message-bus.module.d.ts +0 -2
  164. package/backend/dist/src/message-bus/message-bus.module.js.map +0 -1
  165. package/backend/dist/src/message-bus/message-bus.service.d.ts +0 -7
  166. package/backend/dist/src/message-bus/message-bus.service.js +0 -32
  167. package/backend/dist/src/message-bus/message-bus.service.js.map +0 -1
  168. package/backend/dist/src/visual-editor/visual-editor.controller.d.ts +0 -14
  169. package/backend/dist/src/visual-editor/visual-editor.controller.js +0 -101
  170. package/backend/dist/src/visual-editor/visual-editor.controller.js.map +0 -1
  171. package/backend/dist/src/visual-editor/visual-editor.dto.d.ts +0 -5
  172. package/backend/dist/src/visual-editor/visual-editor.dto.js +0 -32
  173. package/backend/dist/src/visual-editor/visual-editor.dto.js.map +0 -1
  174. package/backend/dist/src/visual-editor/visual-editor.module.d.ts +0 -2
  175. package/backend/dist/src/visual-editor/visual-editor.module.js +0 -24
  176. package/backend/dist/src/visual-editor/visual-editor.module.js.map +0 -1
  177. package/daemon/dist/mcp-gateway.js +0 -401
  178. package/daemon/dist/mcp-gateway.spec.js +0 -295
  179. package/visual-editor-proxy/client/dist/main.js +0 -89
  180. package/visual-editor-proxy/client/tsconfig.json +0 -14
  181. package/visual-editor-proxy/dist/client/src/inspector.d.ts +0 -9
  182. package/visual-editor-proxy/dist/client/src/inspector.js +0 -96
  183. package/visual-editor-proxy/dist/client/src/inspector.js.map +0 -1
  184. package/visual-editor-proxy/dist/client/src/main.d.ts +0 -6
  185. package/visual-editor-proxy/dist/client/src/main.js +0 -108
  186. package/visual-editor-proxy/dist/client/src/main.js.map +0 -1
  187. package/visual-editor-proxy/dist/client/src/ui.d.ts +0 -6
  188. package/visual-editor-proxy/dist/client/src/ui.js +0 -153
  189. package/visual-editor-proxy/dist/client/src/ui.js.map +0 -1
  190. package/visual-editor-proxy/dist/src/main.d.ts +0 -1
  191. package/visual-editor-proxy/dist/src/main.js +0 -61
  192. package/visual-editor-proxy/dist/src/main.js.map +0 -1
  193. package/visual-editor-proxy/dist/tsconfig.tsbuildinfo +0 -1
  194. package/visual-editor-proxy/package.json +0 -21
  195. package/visual-editor-proxy/tsconfig.json +0 -21
@@ -1,295 +0,0 @@
1
- "use strict";
2
- /**
3
- * Tests for the MCP gateway — the daemon-hosted single MCP entry point that
4
- * manages all Repoburg instances.
5
- *
6
- * Tests focus on:
7
- * - Tool cache refresh (fetch from running instance, augment with instance_name)
8
- * - Cache invalidation
9
- * - getGatewayInfo() shape
10
- * - Daemon-level tool routing (list_instances, start_instance, stop_instance)
11
- * - manage_* proxy routing (missing instance_name, unknown instance, not running,
12
- * valid POST, fetch failure, result mapping)
13
- */
14
- Object.defineProperty(exports, "__esModule", { value: true });
15
- // Mock dependencies before importing the gateway.
16
- jest.mock('./stateManager', () => ({
17
- stateManager: {
18
- getServices: jest.fn(),
19
- getService: jest.fn(),
20
- },
21
- }));
22
- jest.mock('./serviceManager', () => ({
23
- serviceManager: {
24
- start: jest.fn(),
25
- stop: jest.fn(),
26
- },
27
- }));
28
- // Mock MCP SDK — we test the gateway's logic, not the SDK.
29
- jest.mock('@modelcontextprotocol/sdk/server/index.js', () => ({
30
- Server: jest.fn().mockImplementation(() => ({
31
- setRequestHandler: jest.fn(),
32
- connect: jest.fn(),
33
- close: jest.fn(),
34
- })),
35
- }));
36
- jest.mock('@modelcontextprotocol/sdk/server/streamableHttp.js', () => ({
37
- StreamableHTTPServerTransport: jest.fn(),
38
- }));
39
- jest.mock('@modelcontextprotocol/sdk/types.js', () => ({
40
- CallToolRequestSchema: 'callTool',
41
- ListToolsRequestSchema: 'listTools',
42
- isInitializeRequest: jest.fn(),
43
- }));
44
- const mcp_gateway_1 = require("./mcp-gateway");
45
- const stateManager_1 = require("./stateManager");
46
- const serviceManager_1 = require("./serviceManager");
47
- const mockStateManager = stateManager_1.stateManager;
48
- const mockServiceManager = serviceManager_1.serviceManager;
49
- // Helper: create a mock Service object.
50
- function mockService(name, status = 'running') {
51
- return { name, path: `/projects/${name}`, port: 3400, status, pid: 12345 };
52
- }
53
- // Helper: raw tool definition as returned by backend's GET /mcp-internal/tools.
54
- function rawToolDef(name, description, required = []) {
55
- return {
56
- tool_name: name,
57
- description,
58
- input_schema: {
59
- type: 'object',
60
- properties: required.reduce((acc, r) => {
61
- acc[r] = { type: 'string', description: `${r} param` };
62
- return acc;
63
- }, {}),
64
- required: required.length > 0 ? required : undefined,
65
- },
66
- };
67
- }
68
- describe('McpGateway', () => {
69
- beforeEach(() => {
70
- jest.clearAllMocks();
71
- // Reset gateway state between tests.
72
- mcp_gateway_1.mcpGateway.invalidateToolCache();
73
- // Default: no instances.
74
- mockStateManager.getServices.mockReturnValue([]);
75
- mockStateManager.getService.mockReturnValue(undefined);
76
- mockServiceManager.start.mockReset();
77
- mockServiceManager.stop.mockReset();
78
- });
79
- describe('refreshToolCache', () => {
80
- it('should fetch tools from a running instance and augment with instance_name', async () => {
81
- mockStateManager.getServices.mockReturnValue([mockService('alpha', 'running')]);
82
- global.fetch = jest.fn().mockResolvedValue({
83
- ok: true,
84
- json: async () => [rawToolDef('manage_agents', 'Manage agents', ['action'])],
85
- });
86
- await mcp_gateway_1.mcpGateway.refreshToolCache();
87
- const info = await mcp_gateway_1.mcpGateway.getGatewayInfo();
88
- const manageTools = info.tools.filter((t) => t.name.startsWith('manage_'));
89
- expect(manageTools).toHaveLength(1);
90
- expect(manageTools[0].name).toBe('manage_agents');
91
- expect(manageTools[0].inputSchema.properties).toHaveProperty('instance_name');
92
- expect(manageTools[0].inputSchema.required).toContain('instance_name');
93
- });
94
- it('should leave cache null when no instance is running', async () => {
95
- mockStateManager.getServices.mockReturnValue([mockService('alpha', 'stopped')]);
96
- await mcp_gateway_1.mcpGateway.refreshToolCache();
97
- const info = await mcp_gateway_1.mcpGateway.getGatewayInfo();
98
- // Only daemon-level tools, no manage_* tools.
99
- const manageTools = info.tools.filter((t) => t.name.startsWith('manage_'));
100
- expect(manageTools).toHaveLength(0);
101
- });
102
- it('should skip refresh when cache is already populated', async () => {
103
- mockStateManager.getServices.mockReturnValue([mockService('alpha', 'running')]);
104
- const fetchMock = jest.fn().mockResolvedValue({
105
- ok: true,
106
- json: async () => [rawToolDef('manage_agents', 'Manage agents')],
107
- });
108
- global.fetch = fetchMock;
109
- await mcp_gateway_1.mcpGateway.refreshToolCache();
110
- await mcp_gateway_1.mcpGateway.refreshToolCache(); // second call
111
- // fetch should only be called once (cache hit on second call).
112
- expect(fetchMock).toHaveBeenCalledTimes(1);
113
- });
114
- it('should handle fetch failure gracefully (cache stays null)', async () => {
115
- mockStateManager.getServices.mockReturnValue([mockService('alpha', 'running')]);
116
- global.fetch = jest.fn().mockResolvedValue({ ok: false, status: 500 });
117
- await mcp_gateway_1.mcpGateway.refreshToolCache();
118
- const info = await mcp_gateway_1.mcpGateway.getGatewayInfo();
119
- const manageTools = info.tools.filter((t) => t.name.startsWith('manage_'));
120
- expect(manageTools).toHaveLength(0);
121
- });
122
- });
123
- describe('invalidateToolCache', () => {
124
- it('should clear cache so next refresh re-fetches', async () => {
125
- mockStateManager.getServices.mockReturnValue([mockService('alpha', 'running')]);
126
- const fetchMock = jest.fn().mockResolvedValue({
127
- ok: true,
128
- json: async () => [rawToolDef('manage_agents', 'Manage agents')],
129
- });
130
- global.fetch = fetchMock;
131
- await mcp_gateway_1.mcpGateway.refreshToolCache();
132
- expect(fetchMock).toHaveBeenCalledTimes(1);
133
- mcp_gateway_1.mcpGateway.invalidateToolCache();
134
- await mcp_gateway_1.mcpGateway.refreshToolCache();
135
- expect(fetchMock).toHaveBeenCalledTimes(2);
136
- });
137
- });
138
- describe('getGatewayInfo', () => {
139
- it('should return descriptor with server_name, url, instances, tools, client_config', async () => {
140
- mockStateManager.getServices.mockReturnValue([
141
- mockService('alpha', 'running'),
142
- mockService('beta', 'stopped'),
143
- ]);
144
- const info = await mcp_gateway_1.mcpGateway.getGatewayInfo();
145
- expect(info.server_name).toBe('repoburg-gateway');
146
- expect(info.url).toBe('http://localhost:9998/mcp');
147
- expect(info.instances).toHaveLength(2);
148
- expect(info.instances[0].name).toBe('alpha');
149
- expect(info.instances[0].status).toBe('running');
150
- expect(info.client_config).toContain('http://localhost:9998/mcp');
151
- // Should always include daemon-level tools.
152
- const toolNames = info.tools.map((t) => t.name);
153
- expect(toolNames).toContain('list_instances');
154
- expect(toolNames).toContain('start_instance');
155
- expect(toolNames).toContain('stop_instance');
156
- });
157
- });
158
- describe('daemon-level tool routing', () => {
159
- it('list_instances should return text with instance info', () => {
160
- mockStateManager.getServices.mockReturnValue([
161
- mockService('alpha', 'running'),
162
- mockService('beta', 'stopped'),
163
- ]);
164
- const result = mcp_gateway_1.mcpGateway.handleListInstances();
165
- const text = result.content[0].text;
166
- expect(text).toContain('alpha');
167
- expect(text).toContain('running');
168
- expect(text).toContain('beta');
169
- expect(text).toContain('stopped');
170
- expect(result.isError).toBeUndefined();
171
- });
172
- it('list_instances should show message when no instances', () => {
173
- mockStateManager.getServices.mockReturnValue([]);
174
- const result = mcp_gateway_1.mcpGateway.handleListInstances();
175
- expect(result.content[0].text).toContain('No Repoburg instances');
176
- });
177
- it('start_instance should call serviceManager.start and invalidate cache', async () => {
178
- mockServiceManager.start.mockResolvedValue(mockService('gamma', 'running'));
179
- const result = await mcp_gateway_1.mcpGateway.handleStartInstance({
180
- path: '/projects/gamma',
181
- name: 'gamma',
182
- });
183
- expect(mockServiceManager.start).toHaveBeenCalledWith('/projects/gamma', 'gamma');
184
- expect(result.content[0].text).toContain('gamma');
185
- expect(result.isError).toBeUndefined();
186
- });
187
- it('start_instance should error when path is missing', async () => {
188
- const result = await mcp_gateway_1.mcpGateway.handleStartInstance({});
189
- expect(result.isError).toBe(true);
190
- expect(result.content[0].text).toContain('Missing required parameter: path');
191
- });
192
- it('stop_instance should call serviceManager.stop', async () => {
193
- const result = await mcp_gateway_1.mcpGateway.handleStopInstance({ name: 'alpha' });
194
- expect(mockServiceManager.stop).toHaveBeenCalledWith('alpha');
195
- expect(result.content[0].text).toContain('alpha');
196
- expect(result.isError).toBeUndefined();
197
- });
198
- it('stop_instance should error when name is missing', async () => {
199
- const result = await mcp_gateway_1.mcpGateway.handleStopInstance({});
200
- expect(result.isError).toBe(true);
201
- expect(result.content[0].text).toContain('Missing required parameter: name');
202
- });
203
- });
204
- describe('manage_* proxy routing', () => {
205
- it('should error when instance_name is missing', async () => {
206
- const result = await mcp_gateway_1.mcpGateway.handleManageTool('manage_agents', {
207
- action: 'create',
208
- });
209
- expect(result.isError).toBe(true);
210
- expect(result.content[0].text).toContain('instance_name');
211
- });
212
- it('should error when instance is not found', async () => {
213
- mockStateManager.getService.mockReturnValue(undefined);
214
- const result = await mcp_gateway_1.mcpGateway.handleManageTool('manage_agents', {
215
- instance_name: 'unknown',
216
- action: 'create',
217
- });
218
- expect(result.isError).toBe(true);
219
- expect(result.content[0].text).toContain("not found");
220
- });
221
- it('should error when instance is not running', async () => {
222
- mockStateManager.getService.mockReturnValue(mockService('alpha', 'stopped'));
223
- const result = await mcp_gateway_1.mcpGateway.handleManageTool('manage_agents', {
224
- instance_name: 'alpha',
225
- action: 'create',
226
- });
227
- expect(result.isError).toBe(true);
228
- expect(result.content[0].text).toContain('not running');
229
- });
230
- it('should strip instance_name and POST to the instance backend', async () => {
231
- mockStateManager.getService.mockReturnValue(mockService('alpha', 'running'));
232
- const fetchMock = jest.fn().mockResolvedValue({
233
- ok: true,
234
- json: async () => ({
235
- status: 'SUCCESS',
236
- summary: 'Agent created',
237
- execution_log: { output: 'Created agent "test"' },
238
- }),
239
- });
240
- global.fetch = fetchMock;
241
- const result = await mcp_gateway_1.mcpGateway.handleManageTool('manage_agents', {
242
- instance_name: 'alpha',
243
- action: 'create',
244
- name: 'test',
245
- });
246
- expect(fetchMock).toHaveBeenCalledWith('http://localhost:3400/mcp-internal/execute-tool', expect.objectContaining({
247
- method: 'POST',
248
- body: JSON.stringify({
249
- tool_name: 'manage_agents',
250
- arguments: { action: 'create', name: 'test' }, // instance_name stripped
251
- }),
252
- }));
253
- expect(result.isError).toBeUndefined();
254
- expect(result.content[0].text).toContain('Created agent "test"');
255
- });
256
- it('should map FAILURE result to isError: true', async () => {
257
- mockStateManager.getService.mockReturnValue(mockService('alpha', 'running'));
258
- global.fetch = jest.fn().mockResolvedValue({
259
- ok: true,
260
- json: async () => ({
261
- status: 'FAILURE',
262
- summary: 'Validation error',
263
- error_message: 'Name is required',
264
- execution_log: { output: '', error_message: 'Name is required' },
265
- }),
266
- });
267
- const result = await mcp_gateway_1.mcpGateway.handleManageTool('manage_agents', {
268
- instance_name: 'alpha',
269
- action: 'create',
270
- });
271
- expect(result.isError).toBe(true);
272
- expect(result.content[0].text).toContain('Name is required');
273
- });
274
- it('should error when fetch to backend fails', async () => {
275
- mockStateManager.getService.mockReturnValue(mockService('alpha', 'running'));
276
- global.fetch = jest.fn().mockRejectedValue(new Error('ECONNREFUSED'));
277
- const result = await mcp_gateway_1.mcpGateway.handleManageTool('manage_agents', {
278
- instance_name: 'alpha',
279
- action: 'create',
280
- });
281
- expect(result.isError).toBe(true);
282
- expect(result.content[0].text).toContain('ECONNREFUSED');
283
- });
284
- it('should error when backend returns non-ok HTTP status', async () => {
285
- mockStateManager.getService.mockReturnValue(mockService('alpha', 'running'));
286
- global.fetch = jest.fn().mockResolvedValue({ ok: false, status: 500 });
287
- const result = await mcp_gateway_1.mcpGateway.handleManageTool('manage_agents', {
288
- instance_name: 'alpha',
289
- action: 'create',
290
- });
291
- expect(result.isError).toBe(true);
292
- expect(result.content[0].text).toContain('500');
293
- });
294
- });
295
- });
@@ -1,89 +0,0 @@
1
- "use strict";(()=>{function m(e,t=new WeakSet){if(e==null)return e;if(typeof e=="function")return`[Function: ${e.name||"anonymous"}]`;if(typeof e!="object")return e;if(e.$$typeof&&typeof e.$$typeof=="symbol")return`[ReactElement: <${e.type?.displayName||e.type?.name||(typeof e.type=="string"?e.type:"ReactElement")}>]`;if(t.has(e))return"[Circular Reference]";if(t.add(e),Array.isArray(e))return e.map(o=>m(o,t));let n={};for(let o in e)if(Object.prototype.hasOwnProperty.call(e,o)){if(o==="className")continue;n[o]=m(e[o],t)}return n}function g(e){if(e===null||typeof e!="object")return e;if(Array.isArray(e))return e.map(g);let t={};for(let n in e)if(Object.prototype.hasOwnProperty.call(e,n)){let o=e[n];o!==null&&(t[n]=g(o))}return t}function $(e){let t=Object.keys(e).find(n=>n.startsWith("__reactFiber$"));return t?e[t]:null}function I(e){let t=e.elementType;return t?typeof t=="string"?t:t.displayName||t.name||"Anonymous":"FiberRoot"}function y(e){let t=$(e);if(!t)return{error:"Could not find React Fiber for the selected element."};let n=[];for(;t;){let s=t.elementType;if(typeof s=="function"||typeof s=="string"){let d=I(t);n.push({name:d,props:m(t.memoizedProps),state:m(t.memoizedState)})}t=t.return}return n.length===0?{error:"Could not identify any components or elements in this element's hierarchy."}:{hierarchy:n.map(s=>({...s,props:g(s.props),state:g(s.state)}))}}var x;function v(){let e=document.createElement("style");e.textContent=`
2
- #repoburg-float-btn {
3
- position: fixed;
4
- bottom: 20px;
5
- right: 20px;
6
- background-color: #7c3aed;
7
- color: white;
8
- border: none;
9
- border-radius: 50%;
10
- width: 60px;
11
- height: 60px;
12
- font-size: 12px;
13
- font-weight: bold;
14
- cursor: pointer;
15
- box-shadow: 0 4px 12px rgba(0,0,0,0.2);
16
- z-index: 999999;
17
- display: flex;
18
- align-items: center;
19
- justify-content: center;
20
- transition: transform 0.2s ease, background-color 0.2s ease;
21
- }
22
- #repoburg-float-btn:hover {
23
- transform: scale(1.1);
24
- }
25
- #repoburg-float-btn:disabled {
26
- background-color: #585858;
27
- cursor: not-allowed;
28
- transform: none;
29
- }
30
- #repoburg-float-btn.active {
31
- background-color: #c026d3;
32
- }
33
- .repoburg-highlight {
34
- outline: 2px dashed #c026d3 !important;
35
- box-shadow: 0 0 10px rgba(192, 38, 211, 0.5) !important;
36
- background-color: rgba(192, 38, 211, 0.1) !important;
37
- }
38
- #repoburg-modal-overlay {
39
- position: fixed;
40
- top: 0; left: 0; width: 100%; height: 100%;
41
- background-color: rgba(0,0,0,0.5);
42
- z-index: 1000000;
43
- display: flex;
44
- align-items: center;
45
- justify-content: center;
46
- }
47
- #repoburg-modal {
48
- background-color: #2d3748;
49
- color: #e2e8f0;
50
- padding: 24px;
51
- border-radius: 8px;
52
- width: 90%;
53
- max-width: 600px;
54
- box-shadow: 0 5px 15px rgba(0,0,0,0.3);
55
- }
56
- #repoburg-modal-header { font-size: 1.25rem; font-weight: bold; margin-bottom: 16px; }
57
- #repoburg-modal-textarea { width: 100%; background-color: #1a202c; color: white; border-radius: 4px; padding: 8px; min-height: 150px; border: 1px solid #4a5568; margin-bottom: 16px; }
58
- #repoburg-modal-footer { display: flex; justify-content: flex-end; gap: 8px; }
59
- .repoburg-modal-btn { padding: 8px 16px; border-radius: 4px; border: none; cursor: pointer; }
60
- .repoburg-modal-btn-primary { background-color: #7c3aed; color: white; }
61
- .repoburg-modal-btn-secondary { background-color: #4a5568; color: white; }
62
- #repoburg-toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background-color: #1a202c; color: white; padding: 12px 20px; border-radius: 6px; z-index: 1000001; opacity: 0; transition: opacity 0.3s ease; text-align: center; }
63
- #repoburg-toast.show { opacity: 1; }
64
- #repoburg-toast.error { background-color: #c53030; }
65
- `,document.head.appendChild(e)}function w(e){let t=document.createElement("button");return t.id="repoburg-float-btn",t.textContent="Repo",t.onclick=e,document.body.appendChild(t),t}function E(){let e=document.createElement("div");e.id="repoburg-toast",document.body.appendChild(e)}function k(e,t,n){let o=document.createElement("div");o.id="repoburg-modal-overlay";let s=e[0],d=e.length>1?e[1]:void 0,b=d?d.name:"N/A",h=e.map(a=>a.name).reverse().join(" > ");o.innerHTML=`
66
- <div id="repoburg-modal">
67
- <div id="repoburg-modal-header">Edit Component</div>
68
- <p style="font-size: 0.9rem; margin-bottom: 8px;"><strong>Component:</strong> ${s.name}</p>
69
- <p style="font-size: 0.9rem; margin-bottom: 16px;"><strong>Parent Context:</strong> ${b}</p>
70
- <p style="font-size: 0.8rem; margin-bottom: 8px; word-break: break-all; opacity: 0.7;"><strong>Path:</strong> ${h}</p>
71
- <p style="font-size: 0.8rem; margin-bottom: 16px; word-break: break-all; opacity: 0.7;"><strong>URL:</strong> ${t}</p>
72
- <textarea id="repoburg-modal-textarea" placeholder="Enter your prompt... (e.g., 'add a confirmation icon to this button')"></textarea>
73
- <div id="repoburg-modal-footer">
74
- <button id="repoburg-modal-cancel" class="repoburg-modal-btn repoburg-modal-btn-secondary">Cancel</button>
75
- <button id="repoburg-modal-submit" class="repoburg-modal-btn repoburg-modal-btn-primary">Submit</button>
76
- </div>
77
- </div>
78
- `,document.body.appendChild(o);let u=document.getElementById("repoburg-modal-textarea"),r=document.getElementById("repoburg-modal-submit");u.focus();let c=a=>{a.key==="Escape"&&l(),a.key==="Enter"&&(a.metaKey||a.ctrlKey)&&(a.preventDefault(),r.click())};document.addEventListener("keydown",c);let l=()=>{document.removeEventListener("keydown",c),o.remove()};document.getElementById("repoburg-modal-cancel").onclick=l,o.onclick=a=>{a.target===o&&l()},r.onclick=async()=>{let a=u.value;a.trim()&&(await n(a,e,t),l())}}function p(e,t="success",n=3e3){let o=document.getElementById("repoburg-toast");o&&(o.textContent=e,o.className=t==="error"?"error":"",o.classList.add("show"),clearTimeout(x),x=window.setTimeout(()=>{o.classList.remove("show")},n))}var f=!1,i=null;function C(e){i&&i.classList.remove("repoburg-highlight"),i=e.target,i.classList.add("repoburg-highlight")}function T(){i&&(i.classList.remove("repoburg-highlight"),i=null)}function L(e){if(e.preventDefault(),e.stopPropagation(),P(),!i)return;let t=y(i);t.error||!t.hierarchy?p(t.error||"Unknown error","error"):k(t.hierarchy,window.location.href,O)}function P(){f=!f;let e=document.getElementById("repoburg-float-btn");f?(e.classList.add("active"),e.textContent="Exit",document.addEventListener("mouseover",C),document.addEventListener("mouseout",T),document.addEventListener("click",L,!0)):(e.classList.remove("active"),e.textContent="Repo",i&&i.classList.remove("repoburg-highlight"),document.removeEventListener("mouseover",C),document.removeEventListener("mouseout",T),document.removeEventListener("click",L,!0))}async function O(e,t,n){let o=window.REPOBURG_BACKEND_PORT;if(!o){p("Repoburg backend port not found.","error");return}let s=t.slice().reverse().map((r,c)=>{let l=" ".repeat(c),a=JSON.stringify(r.props),R=r.state&&Object.keys(r.state).length>0?`, state: ${JSON.stringify(r.state)}`:"";return`${l}- ${r.name} (props: ${a}${R})`}).join(`
79
- `),u={prompt:`${`--- Visual Inspector Context ---
80
- URL: ${n}
81
-
82
- This data structure is a React Component Tree, representing the hierarchy of components from the application's root down to the element the user selected. The indentation signifies the parent-child nesting relationship. Each line contains the component/element name, its 'props' (data passed down to it), and its 'state' (internal data it manages). As an AI agent, use this structural and data context to understand the application's architecture and the flow of information related to the user's request. The last element in the list is the user's direct target.
83
-
84
- Component Hierarchy:
85
- ${s}
86
-
87
- --- User Prompt ---`}
88
-
89
- ${e}`,componentPath:"",parentComponentPath:void 0};try{let r=await fetch(`http://localhost:${o}/visual-editor/submit`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(u)});if(!r.ok){let c=await r.json().catch(()=>({message:"Failed to submit prompt"}));throw new Error(c.message)}p("Prompt submitted successfully!")}catch(r){console.error("Repoburg Error:",r),p(r instanceof Error?r.message:String(r),"error")}}function B(){document.getElementById("repoburg-float-btn")||(console.log("Repoburg Visual Editor: Initializing UI."),console.log("Repoburg Backend Port:",window.REPOBURG_BACKEND_PORT||"Not Set"),v(),E(),w(P))}B();})();
@@ -1,14 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "target": "ESNext",
4
- "module": "ESNext",
5
- "strict": true,
6
- "esModuleInterop": true,
7
- "skipLibCheck": true,
8
- "forceConsistentCasingInFileNames": true,
9
- "outDir": "./dist",
10
- "rootDir": "./src",
11
- "lib": ["DOM", "ESNext"]
12
- },
13
- "include": ["src/**/*.ts"]
14
- }
@@ -1,9 +0,0 @@
1
- export interface ComponentInfo {
2
- name: string;
3
- props: any;
4
- state: any;
5
- }
6
- export declare function getComponentTreeFromElement(element: HTMLElement): {
7
- hierarchy?: ComponentInfo[];
8
- error?: string;
9
- };
@@ -1,96 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getComponentTreeFromElement = getComponentTreeFromElement;
4
- function serializeComplexObject(obj, seen = new WeakSet()) {
5
- if (obj === null || obj === undefined) {
6
- return obj;
7
- }
8
- if (typeof obj === 'function') {
9
- return `[Function: ${obj.name || 'anonymous'}]`;
10
- }
11
- if (typeof obj !== 'object') {
12
- return obj;
13
- }
14
- if (obj.$$typeof && typeof obj.$$typeof === 'symbol') {
15
- const componentName = obj.type?.displayName || obj.type?.name || (typeof obj.type === 'string' ? obj.type : 'ReactElement');
16
- return `[ReactElement: <${componentName}>]`;
17
- }
18
- if (seen.has(obj)) {
19
- return '[Circular Reference]';
20
- }
21
- seen.add(obj);
22
- if (Array.isArray(obj)) {
23
- return obj.map(item => serializeComplexObject(item, seen));
24
- }
25
- const newObj = {};
26
- for (const key in obj) {
27
- if (Object.prototype.hasOwnProperty.call(obj, key)) {
28
- if (key === 'className') {
29
- continue;
30
- }
31
- newObj[key] = serializeComplexObject(obj[key], seen);
32
- }
33
- }
34
- return newObj;
35
- }
36
- function cleanupNullValues(obj) {
37
- if (obj === null || typeof obj !== 'object') {
38
- return obj;
39
- }
40
- if (Array.isArray(obj)) {
41
- return obj.map(cleanupNullValues);
42
- }
43
- const newObj = {};
44
- for (const key in obj) {
45
- if (Object.prototype.hasOwnProperty.call(obj, key)) {
46
- const value = obj[key];
47
- if (value !== null) {
48
- newObj[key] = cleanupNullValues(value);
49
- }
50
- }
51
- }
52
- return newObj;
53
- }
54
- function getFiberFromElement(element) {
55
- const fiberKey = Object.keys(element).find(key => key.startsWith('__reactFiber$'));
56
- return fiberKey ? element[fiberKey] : null;
57
- }
58
- function getComponentName(fiber) {
59
- const componentType = fiber.elementType;
60
- if (!componentType) {
61
- return 'FiberRoot';
62
- }
63
- if (typeof componentType === 'string') {
64
- return componentType;
65
- }
66
- return componentType.displayName || componentType.name || 'Anonymous';
67
- }
68
- function getComponentTreeFromElement(element) {
69
- let fiber = getFiberFromElement(element);
70
- if (!fiber) {
71
- return { error: 'Could not find React Fiber for the selected element.' };
72
- }
73
- const hierarchy = [];
74
- while (fiber) {
75
- const elementType = fiber.elementType;
76
- if (typeof elementType === 'function' || typeof elementType === 'string') {
77
- const name = getComponentName(fiber);
78
- hierarchy.push({
79
- name,
80
- props: serializeComplexObject(fiber.memoizedProps),
81
- state: serializeComplexObject(fiber.memoizedState),
82
- });
83
- }
84
- fiber = fiber.return;
85
- }
86
- if (hierarchy.length === 0) {
87
- return { error: 'Could not identify any components or elements in this element\'s hierarchy.' };
88
- }
89
- const cleanedHierarchy = hierarchy.map(item => ({
90
- ...item,
91
- props: cleanupNullValues(item.props),
92
- state: cleanupNullValues(item.state),
93
- }));
94
- return { hierarchy: cleanedHierarchy };
95
- }
96
- //# sourceMappingURL=inspector.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"inspector.js","sourceRoot":"","sources":["../../../client/src/inspector.ts"],"names":[],"mappings":";;AAyGA,kEAsCC;AApID,SAAS,sBAAsB,CAAC,GAAQ,EAAE,IAAI,GAAG,IAAI,OAAO,EAAE;IAC1D,IAAI,GAAG,KAAK,IAAI,IAAI,GAAG,KAAK,SAAS,EAAE,CAAC;QACpC,OAAO,GAAG,CAAC;IACf,CAAC;IAGD,IAAI,OAAO,GAAG,KAAK,UAAU,EAAE,CAAC;QAC5B,OAAO,cAAc,GAAG,CAAC,IAAI,IAAI,WAAW,GAAG,CAAC;IACpD,CAAC;IAGD,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE,CAAC;QAC1B,OAAO,GAAG,CAAC;IACf,CAAC;IAGD,IAAI,GAAG,CAAC,QAAQ,IAAI,OAAO,GAAG,CAAC,QAAQ,KAAK,QAAQ,EAAE,CAAC;QACnD,MAAM,aAAa,GAAG,GAAG,CAAC,IAAI,EAAE,WAAW,IAAI,GAAG,CAAC,IAAI,EAAE,IAAI,IAAI,CAAC,OAAO,GAAG,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,GA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WAAW,KAAK,UAAU,IAAI,OAAO,WAAW,KAAK,QAAQ,EAAE,CAAC;YACvE,MAAM,IAAI,GAAG,gBAAgB,CAAC,KAAK,CAAC,CAAC;YAErC,SAAS,CAAC,IAAI,CAAC;gBACX,IAAI;gBACJ,KAAK,EAAE,sBAAsB,CAAC,KAAK,CAAC,aAAa,CAAC;gBAClD,KAAK,EAAE,sBAAsB,CAAC,KAAK,CAAC,aAAa,CAAC;aACrD,CAAC,CAAC;QACP,CAAC;QAED,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC;IACzB,CAAC;IAED,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACzB,OAAO,EAAE,KAAK,EAAE,6EAA6E,EAAE,CAAC;IACpG,CAAC;IAGD,MAAM,gBAAgB,GAAG,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAC5C,GAAG,IAAI;QACP,KAAK,EAAE,iBAAiB,CAAC,IAAI,CAAC,KAAK,CAAC;QACpC,KAAK,EAAE,iBAAiB,CAAC,IAAI,CAAC,KAAK,CAAC;KACvC,CAAC,CAAC,CAAC;IAEJ,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,CAAC;AAC3C,CAAC"}
@@ -1,6 +0,0 @@
1
- declare global {
2
- interface Window {
3
- REPOBURG_BACKEND_PORT?: number;
4
- }
5
- }
6
- export {};
@@ -1,108 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const inspector_1 = require("./inspector");
4
- const ui_1 = require("./ui");
5
- let isSelectorModeActive = false;
6
- let currentHoveredElement = null;
7
- function handleMouseOver(e) {
8
- if (currentHoveredElement) {
9
- currentHoveredElement.classList.remove('repoburg-highlight');
10
- }
11
- currentHoveredElement = e.target;
12
- currentHoveredElement.classList.add('repoburg-highlight');
13
- }
14
- function handleMouseOut() {
15
- if (currentHoveredElement) {
16
- currentHoveredElement.classList.remove('repoburg-highlight');
17
- currentHoveredElement = null;
18
- }
19
- }
20
- function handleClick(e) {
21
- e.preventDefault();
22
- e.stopPropagation();
23
- toggleSelectorMode();
24
- if (!currentHoveredElement)
25
- return;
26
- const result = (0, inspector_1.getComponentTreeFromElement)(currentHoveredElement);
27
- if (result.error || !result.hierarchy) {
28
- (0, ui_1.showToast)(result.error || 'Unknown error', 'error');
29
- }
30
- else {
31
- (0, ui_1.showPromptModal)(result.hierarchy, window.location.href, submitPrompt);
32
- }
33
- }
34
- function toggleSelectorMode() {
35
- isSelectorModeActive = !isSelectorModeActive;
36
- const button = document.getElementById('repoburg-float-btn');
37
- if (isSelectorModeActive) {
38
- button.classList.add('active');
39
- button.textContent = 'Exit';
40
- document.addEventListener('mouseover', handleMouseOver);
41
- document.addEventListener('mouseout', handleMouseOut);
42
- document.addEventListener('click', handleClick, true);
43
- }
44
- else {
45
- button.classList.remove('active');
46
- button.textContent = 'Repo';
47
- if (currentHoveredElement) {
48
- currentHoveredElement.classList.remove('repoburg-highlight');
49
- }
50
- document.removeEventListener('mouseover', handleMouseOver);
51
- document.removeEventListener('mouseout', handleMouseOut);
52
- document.removeEventListener('click', handleClick, true);
53
- }
54
- }
55
- async function submitPrompt(prompt, hierarchy, url) {
56
- const backendPort = window.REPOBURG_BACKEND_PORT;
57
- if (!backendPort) {
58
- (0, ui_1.showToast)('Repoburg backend port not found.', 'error');
59
- return;
60
- }
61
- const hierarchyText = hierarchy
62
- .slice()
63
- .reverse()
64
- .map((component, index) => {
65
- const indent = ' '.repeat(index);
66
- const propsString = JSON.stringify(component.props);
67
- const stateString = component.state && Object.keys(component.state).length > 0
68
- ? `, state: ${JSON.stringify(component.state)}`
69
- : '';
70
- return `${indent}- ${component.name} (props: ${propsString}${stateString})`;
71
- })
72
- .join('\n');
73
- const explanationForAI = `This data structure is a React Component Tree, representing the hierarchy of components from the application's root down to the element the user selected. The indentation signifies the parent-child nesting relationship. Each line contains the component/element name, its 'props' (data passed down to it), and its 'state' (internal data it manages). As an AI agent, use this structural and data context to understand the application's architecture and the flow of information related to the user's request. The last element in the list is the user's direct target.`;
74
- const contextHeader = `--- Visual Inspector Context ---\nURL: ${url}\n\n${explanationForAI}\n\nComponent Hierarchy:\n${hierarchyText}\n\n--- User Prompt ---`;
75
- const fullPrompt = `${contextHeader}\n\n${prompt}`;
76
- const payload = {
77
- prompt: fullPrompt,
78
- componentPath: '',
79
- parentComponentPath: undefined,
80
- };
81
- try {
82
- const response = await fetch(`http://localhost:${backendPort}/visual-editor/submit`, {
83
- method: 'POST',
84
- headers: { 'Content-Type': 'application/json' },
85
- body: JSON.stringify(payload),
86
- });
87
- if (!response.ok) {
88
- const errorData = await response.json().catch(() => ({ message: 'Failed to submit prompt' }));
89
- throw new Error(errorData.message);
90
- }
91
- (0, ui_1.showToast)('Prompt submitted successfully!');
92
- }
93
- catch (error) {
94
- console.error('Repoburg Error:', error);
95
- (0, ui_1.showToast)(error instanceof Error ? error.message : String(error), 'error');
96
- }
97
- }
98
- function initialize() {
99
- if (document.getElementById('repoburg-float-btn'))
100
- return;
101
- console.log('Repoburg Visual Editor: Initializing UI.');
102
- console.log('Repoburg Backend Port:', window.REPOBURG_BACKEND_PORT || 'Not Set');
103
- (0, ui_1.injectStyles)();
104
- (0, ui_1.createToast)();
105
- (0, ui_1.createFloatingButton)(toggleSelectorMode);
106
- }
107
- initialize();
108
- //# sourceMappingURL=main.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"main.js","sourceRoot":"","sources":["../../../client/src/main.ts"],"names":[],"mappings":";;AAAA,2CAAyE;AACzE,6BAAmG;AAUnG,IAAI,oBAAoB,GAAG,KAAK,CAAC;AACjC,IAAI,qBAAqB,GAAuB,IAAI,CAAC;AAIrD,SAAS,eAAe,CAAC,CAAa;IAClC,IAAI,qBAAqB,EAAE,CAAC;QACxB,qBAAqB,CAAC,SAAS,CAAC,MAAM,CAAC,oBAAoB,CAAC,CAAC;IACjE,CAAC;IACD,qBAAqB,GAAG,CAAC,CAAC,MAAqB,CAAC;IAChD,q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AAC;AAKD,SAAS,UAAU;IAEf,IAAI,QAAQ,CAAC,cAAc,CAAC,oBAAoB,CAAC;QAAE,OAAO;IAE1D,OAAO,CAAC,GAAG,CAAC,0CAA0C,CAAC,CAAC;IACxD,OAAO,CAAC,GAAG,CAAC,wBAAwB,EAAE,MAAM,CAAC,qBAAqB,IAAI,SAAS,CAAC,CAAC;IAEjF,IAAA,iBAAY,GAAE,CAAC;IACf,IAAA,gBAAW,GAAE,CAAC;IACd,IAAA,yBAAoB,EAAC,kBAAkB,CAAC,CAAC;AAC7C,CAAC;AAGD,UAAU,EAAE,CAAC"}
@@ -1,6 +0,0 @@
1
- import { ComponentInfo } from './inspector';
2
- export declare function injectStyles(): void;
3
- export declare function createFloatingButton(onClick: () => void): HTMLButtonElement;
4
- export declare function createToast(): void;
5
- export declare function showPromptModal(hierarchy: ComponentInfo[], url: string, submitCallback: (prompt: string, hierarchy: ComponentInfo[], url: string) => Promise<void>): void;
6
- export declare function showToast(message: string, type?: 'success' | 'error', duration?: number): void;