deepdebug-local-agent 0.3.15 β 0.3.16
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/package.json +1 -1
- package/src/server.js +0 -53
package/package.json
CHANGED
package/src/server.js
CHANGED
|
@@ -27,11 +27,9 @@ import { startMCPHttpServer } from "./mcp-http-server.js";
|
|
|
27
27
|
|
|
28
28
|
const execAsync = promisify(exec);
|
|
29
29
|
|
|
30
|
-
// ============================================
|
|
31
30
|
// π§ AI VIBE CODING ENGINE
|
|
32
31
|
// Sistema universal de auto-healing que usa AI
|
|
33
32
|
// para resolver QUALQUER erro automaticamente
|
|
34
|
-
// ============================================
|
|
35
33
|
|
|
36
34
|
class AIVibeCodingEngine extends EventEmitter {
|
|
37
35
|
constructor(processManager, getWorkspaceRoot) {
|
|
@@ -557,10 +555,7 @@ app.use(cors({
|
|
|
557
555
|
// Cloud Run URLs (regex patterns)
|
|
558
556
|
/https:\/\/.*\.run\.app$/,
|
|
559
557
|
/https:\/\/.*\.web\.app$/,
|
|
560
|
-
<<<<<<< HEAD
|
|
561
558
|
// Production frontend
|
|
562
|
-
=======
|
|
563
|
-
>>>>>>> dd7d3ab (fix: add deepdebug.ai to CORS origins)
|
|
564
559
|
"https://deepdebug.ai",
|
|
565
560
|
"https://www.deepdebug.ai"
|
|
566
561
|
],
|
|
@@ -591,10 +586,8 @@ const MCP_PORT = process.env.MCP_PORT || 5056;
|
|
|
591
586
|
// π§ Inicializar AI Vibe Coding Engine
|
|
592
587
|
aiEngine = new AIVibeCodingEngine(processManager, () => WORKSPACE_ROOT);
|
|
593
588
|
|
|
594
|
-
// ============================================
|
|
595
589
|
// π BACKUP STORAGE (Sprint 1.3)
|
|
596
590
|
// In-memory backup storage with configurable max size
|
|
597
|
-
// ============================================
|
|
598
591
|
const BACKUPS = new Map();
|
|
599
592
|
const MAX_BACKUPS = 50;
|
|
600
593
|
const BACKUP_INDEX_PATH = path.join(os.tmpdir(), 'deepdebug-backups-index.json');
|
|
@@ -891,9 +884,7 @@ app.post("/workspace/batch-read", async (req, res) => {
|
|
|
891
884
|
}
|
|
892
885
|
});
|
|
893
886
|
|
|
894
|
-
// ============================================
|
|
895
887
|
// π FILE VALIDATION ENDPOINTS (Enhanced Analysis)
|
|
896
|
-
// ============================================
|
|
897
888
|
|
|
898
889
|
/**
|
|
899
890
|
* GET /workspace/file-exists
|
|
@@ -1253,9 +1244,7 @@ app.post("/workspace/find-field-definition", async (req, res) => {
|
|
|
1253
1244
|
});
|
|
1254
1245
|
|
|
1255
1246
|
|
|
1256
|
-
// ============================================
|
|
1257
1247
|
// π RUNTIME MANAGEMENT ENDPOINTS
|
|
1258
|
-
// ============================================
|
|
1259
1248
|
|
|
1260
1249
|
/** Detecta serviΓ§os no workspace */
|
|
1261
1250
|
app.get("/workspace/services/detect", async (_req, res) => {
|
|
@@ -1406,9 +1395,7 @@ app.get("/workspace/services/:serviceId/logs/stream", (req, res) => {
|
|
|
1406
1395
|
});
|
|
1407
1396
|
});
|
|
1408
1397
|
|
|
1409
|
-
// ============================================
|
|
1410
1398
|
// ENDPOINTS LEGADOS (manter compatibilidade)
|
|
1411
|
-
// ============================================
|
|
1412
1399
|
|
|
1413
1400
|
app.get("/workspace/files", async (req, res) => {
|
|
1414
1401
|
if (!WORKSPACE_ROOT) return res.status(400).json({ error: "workspace not set" });
|
|
@@ -1441,9 +1428,7 @@ app.post("/workspace/write", async (req, res) => {
|
|
|
1441
1428
|
}
|
|
1442
1429
|
});
|
|
1443
1430
|
|
|
1444
|
-
// ============================================
|
|
1445
1431
|
// β
CORRECTED: /workspace/patch endpoint
|
|
1446
|
-
// ============================================
|
|
1447
1432
|
app.post("/workspace/patch", async (req, res) => {
|
|
1448
1433
|
if (!WORKSPACE_ROOT) return res.status(400).json({ error: "workspace not set" });
|
|
1449
1434
|
const { diff, incidentId } = req.body || {};
|
|
@@ -1499,9 +1484,7 @@ app.post("/workspace/run", async (req, res) => {
|
|
|
1499
1484
|
res.json(out);
|
|
1500
1485
|
});
|
|
1501
1486
|
|
|
1502
|
-
// ============================================
|
|
1503
1487
|
// π TEST LOCAL ENDPOINTS
|
|
1504
|
-
// ============================================
|
|
1505
1488
|
|
|
1506
1489
|
/** Store test local state */
|
|
1507
1490
|
let TEST_LOCAL_STATE = {
|
|
@@ -1514,9 +1497,7 @@ let TEST_LOCAL_STATE = {
|
|
|
1514
1497
|
serverLogs: [] // Buffer circular de logs do servidor (ΓΊltimos 1000)
|
|
1515
1498
|
};
|
|
1516
1499
|
|
|
1517
|
-
// ============================================
|
|
1518
1500
|
// π TEST LOCAL STATE ENDPOINTS (ADDED)
|
|
1519
|
-
// ============================================
|
|
1520
1501
|
|
|
1521
1502
|
/**
|
|
1522
1503
|
* GET /workspace/test-local/state
|
|
@@ -2020,10 +2001,8 @@ app.get("/workspace/config", async (_req, res) => {
|
|
|
2020
2001
|
}
|
|
2021
2002
|
});
|
|
2022
2003
|
|
|
2023
|
-
// ============================================
|
|
2024
2004
|
// π BACKUP & ROLLBACK ENDPOINTS (Sprint 1.3)
|
|
2025
2005
|
// Added without modifying existing endpoints
|
|
2026
|
-
// ============================================
|
|
2027
2006
|
|
|
2028
2007
|
/**
|
|
2029
2008
|
* Helper: Validate diff format
|
|
@@ -2428,11 +2407,9 @@ app.delete("/workspace/backups/:backupId", (req, res) => {
|
|
|
2428
2407
|
});
|
|
2429
2408
|
});
|
|
2430
2409
|
|
|
2431
|
-
// ============================================
|
|
2432
2410
|
// π DIFF VIEWER ENDPOINT
|
|
2433
2411
|
// Returns before/after content for files modified by a patch
|
|
2434
2412
|
// Used by the frontend diff viewer
|
|
2435
|
-
// ============================================
|
|
2436
2413
|
|
|
2437
2414
|
/**
|
|
2438
2415
|
* GET /workspace/diff/by-incident/:incidentId
|
|
@@ -2612,10 +2589,8 @@ app.get("/workspace/diff/:backupId", async (req, res) => {
|
|
|
2612
2589
|
}
|
|
2613
2590
|
});
|
|
2614
2591
|
|
|
2615
|
-
// ============================================
|
|
2616
2592
|
// π DETECT PORT ENDPOINT (Sprint 1.2)
|
|
2617
2593
|
// Multi-language port detection
|
|
2618
|
-
// ============================================
|
|
2619
2594
|
|
|
2620
2595
|
/**
|
|
2621
2596
|
* GET /workspace/detect-port
|
|
@@ -2886,9 +2861,7 @@ async function detectDotNetPort(servicePath) {
|
|
|
2886
2861
|
return { port: 5000, method: 'dotnet-default' };
|
|
2887
2862
|
}
|
|
2888
2863
|
|
|
2889
|
-
// ============================================
|
|
2890
2864
|
// TEST LOCAL ENDPOINTS (existing)
|
|
2891
|
-
// ============================================
|
|
2892
2865
|
|
|
2893
2866
|
/** Prepare for testing: compile + discover endpoints */
|
|
2894
2867
|
app.post("/workspace/test-local/prepare", async (req, res) => {
|
|
@@ -3139,10 +3112,8 @@ app.get("/workspace/test-local/logs/stream", async (req, res) => {
|
|
|
3139
3112
|
}
|
|
3140
3113
|
});
|
|
3141
3114
|
|
|
3142
|
-
// ============================================
|
|
3143
3115
|
// π AUTO-TRAINING ENDPOINTS
|
|
3144
3116
|
// Escanear e ler arquivos para treinamento AI
|
|
3145
|
-
// ============================================
|
|
3146
3117
|
|
|
3147
3118
|
/**
|
|
3148
3119
|
* POST /workspace/scan-files
|
|
@@ -3361,10 +3332,8 @@ app.post("/workspace/read-files", async (req, res) => {
|
|
|
3361
3332
|
}
|
|
3362
3333
|
});
|
|
3363
3334
|
|
|
3364
|
-
// ============================================
|
|
3365
3335
|
// π SYSTEM FOLDER PICKER ENDPOINT
|
|
3366
3336
|
// Abre file picker nativo do SO (Windows/Mac/Linux)
|
|
3367
|
-
// ============================================
|
|
3368
3337
|
|
|
3369
3338
|
/**
|
|
3370
3339
|
* GET /system/folder-picker
|
|
@@ -3487,10 +3456,8 @@ app.get("/system/info", (req, res) => {
|
|
|
3487
3456
|
});
|
|
3488
3457
|
});
|
|
3489
3458
|
|
|
3490
|
-
// ============================================
|
|
3491
3459
|
// π API DOCS ENDPOINT
|
|
3492
3460
|
// Retorna endpoints detectados das controllers
|
|
3493
|
-
// ============================================
|
|
3494
3461
|
|
|
3495
3462
|
/**
|
|
3496
3463
|
* GET /workspace/api-docs
|
|
@@ -3670,9 +3637,7 @@ app.get("/workspace/api-docs/:controller", async (req, res) => {
|
|
|
3670
3637
|
}
|
|
3671
3638
|
});
|
|
3672
3639
|
|
|
3673
|
-
// ============================================
|
|
3674
3640
|
// π§ AI ENGINE ENDPOINTS
|
|
3675
|
-
// ============================================
|
|
3676
3641
|
|
|
3677
3642
|
/**
|
|
3678
3643
|
* GET /ai-engine/status
|
|
@@ -3878,10 +3843,8 @@ app.post("/workspace/test-local/restart", async (req, res) => {
|
|
|
3878
3843
|
}
|
|
3879
3844
|
});
|
|
3880
3845
|
|
|
3881
|
-
// ============================================
|
|
3882
3846
|
// π€ AGENTIC TOOLS ENDPOINTS
|
|
3883
3847
|
// Used by the agentic Claude loop for autonomous debugging
|
|
3884
|
-
// ============================================
|
|
3885
3848
|
|
|
3886
3849
|
/**
|
|
3887
3850
|
* POST /workspace/search
|
|
@@ -4051,10 +4014,8 @@ app.post("/workspace/exec", async (req, res) => {
|
|
|
4051
4014
|
}
|
|
4052
4015
|
});
|
|
4053
4016
|
|
|
4054
|
-
// ============================================
|
|
4055
4017
|
// π§ͺ ENDPOINT TESTING
|
|
4056
4018
|
// Execute curl-like requests and capture full request/response
|
|
4057
|
-
// ============================================
|
|
4058
4019
|
|
|
4059
4020
|
/**
|
|
4060
4021
|
* POST /workspace/test-endpoint
|
|
@@ -4145,10 +4106,8 @@ app.post("/workspace/test-endpoint", async (req, res) => {
|
|
|
4145
4106
|
}
|
|
4146
4107
|
});
|
|
4147
4108
|
|
|
4148
|
-
// ============================================
|
|
4149
4109
|
// π GIT INTEGRATION
|
|
4150
4110
|
// Create branch, commit, push for auto-fix PRs
|
|
4151
|
-
// ============================================
|
|
4152
4111
|
|
|
4153
4112
|
/**
|
|
4154
4113
|
* POST /workspace/git/create-fix-branch
|
|
@@ -4617,11 +4576,9 @@ app.get("/workspace/git/status", async (req, res) => {
|
|
|
4617
4576
|
}
|
|
4618
4577
|
});
|
|
4619
4578
|
|
|
4620
|
-
// ============================================
|
|
4621
4579
|
// π¬ PULL REQUEST COMMENTS ENDPOINTS
|
|
4622
4580
|
// Read, reply, and resolve PR comments via git providers
|
|
4623
4581
|
// Used by the frontend "Code Review" tab in incident detail
|
|
4624
|
-
// ============================================
|
|
4625
4582
|
|
|
4626
4583
|
/**
|
|
4627
4584
|
* GET /workspace/git/pr/comments
|
|
@@ -4941,10 +4898,8 @@ app.post("/workspace/git/pr/comments/:commentId/fix-and-resolve", async (req, re
|
|
|
4941
4898
|
});
|
|
4942
4899
|
|
|
4943
4900
|
|
|
4944
|
-
// ============================================
|
|
4945
4901
|
// π§ GIT PROVIDER HELPER (internal)
|
|
4946
4902
|
// Detects provider from remote URL and configures with token
|
|
4947
|
-
// ============================================
|
|
4948
4903
|
|
|
4949
4904
|
async function _getGitProvider() {
|
|
4950
4905
|
if (!WORKSPACE_ROOT) return null;
|
|
@@ -5007,9 +4962,7 @@ async function _getGitProvider() {
|
|
|
5007
4962
|
return null;
|
|
5008
4963
|
}
|
|
5009
4964
|
}
|
|
5010
|
-
// ============================================
|
|
5011
4965
|
// π MULTI-WORKSPACE ENDPOINTS
|
|
5012
|
-
// ============================================
|
|
5013
4966
|
|
|
5014
4967
|
/** Lista todos os workspaces abertos */
|
|
5015
4968
|
app.get("/workspaces", (_req, res) => {
|
|
@@ -5087,10 +5040,8 @@ app.post("/workspace/:workspaceId/run", async (req, res) => {
|
|
|
5087
5040
|
});
|
|
5088
5041
|
|
|
5089
5042
|
|
|
5090
|
-
// ============================================
|
|
5091
5043
|
// π WEBSOCKET REVERSE TUNNEL
|
|
5092
5044
|
// Connects Local Agent to Gateway β no public URL needed
|
|
5093
|
-
// ============================================
|
|
5094
5045
|
async function startWebSocketTunnel(port, gatewayUrl, apiKey, tenantId) {
|
|
5095
5046
|
if (!gatewayUrl || !apiKey || !tenantId) {
|
|
5096
5047
|
console.log('β οΈ WebSocket tunnel skipped: missing gatewayUrl, apiKey or tenantId in ~/.deepdebug/config.json');
|
|
@@ -5204,9 +5155,7 @@ async function startWebSocketTunnel(port, gatewayUrl, apiKey, tenantId) {
|
|
|
5204
5155
|
return await res.json();
|
|
5205
5156
|
}
|
|
5206
5157
|
|
|
5207
|
-
// ============================================
|
|
5208
5158
|
// MCP TOOLS β routed via MCP HTTP Bridge (port 5056)
|
|
5209
|
-
// ============================================
|
|
5210
5159
|
case 'mcp.read-file': {
|
|
5211
5160
|
const mcpBase = `http://localhost:5056`;
|
|
5212
5161
|
const res = await fetch(`${mcpBase}/mcp/read-file`, {
|
|
@@ -5329,9 +5278,7 @@ async function startWebSocketTunnel(port, gatewayUrl, apiKey, tenantId) {
|
|
|
5329
5278
|
connect();
|
|
5330
5279
|
}
|
|
5331
5280
|
|
|
5332
|
-
// ============================================
|
|
5333
5281
|
// START SERVER
|
|
5334
|
-
// ============================================
|
|
5335
5282
|
app.listen(PORT, '0.0.0.0', async () => {
|
|
5336
5283
|
console.log(`\nπ DeepDebug Local Agent listening on port ${PORT}`);
|
|
5337
5284
|
console.log(`π¦ Environment: ${process.env.NODE_ENV || 'development'}`);
|