deepdebug-local-agent 0.3.16 → 0.3.18

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "deepdebug-local-agent",
3
- "version": "0.3.16",
3
+ "version": "0.3.18",
4
4
  "description": "Insptech AI — DeepDebug Local Agent. Autonomous code debugging agent for production environments.",
5
5
  "type": "module",
6
6
  "main": "src/server.js",
@@ -161,7 +161,7 @@ export function startMCPHttpServer(workspaceManager, port = 5056) {
161
161
 
162
162
  try {
163
163
  const root = workspaceManager.resolveRoot(workspaceId);
164
- const results = await grepWorkspace(root, query, filePattern, maxResults);
164
+ const results = await grepWorkspaceX(root, query, filePattern, maxResults);
165
165
  res.json({ ok: true, query, matches: results.length, results });
166
166
  } catch (e) {
167
167
  res.status(400).json({ error: e.message });
@@ -183,7 +183,7 @@ export function startMCPHttpServer(workspaceManager, port = 5056) {
183
183
 
184
184
  try {
185
185
  const root = workspaceManager.resolveRoot(workspaceId);
186
- const result = await execInWorkspace(root, command, timeout);
186
+ const result = await execInWorkspaceX(root, command, timeout);
187
187
  res.json({ ok: result.exitCode === 0, ...result });
188
188
  } catch (e) {
189
189
  res.status(400).json({ error: e.message });
@@ -310,4 +310,100 @@ function execInWorkspace(root, command, timeoutSec) {
310
310
  resolve({ exitCode: code, stdout, stderr: stderr.substring(0, 5000), timedOut: false });
311
311
  });
312
312
  });
313
- }
313
+ }
314
+ // ========================================
315
+ // WINDOWS IMPLEMENTATIONS
316
+ // ========================================
317
+
318
+ import fs from "fs";
319
+ const { promises: fsp } = fs;
320
+
321
+ /**
322
+ * grepWorkspaceWindows — Pure Node.js search, no grep required.
323
+ * Used automatically on Windows (process.platform === "win32").
324
+ */
325
+ async function grepWorkspaceWindows(root, query, filePattern, maxResults) {
326
+ const results = [];
327
+ const queryLower = query.toLowerCase();
328
+
329
+ let fileRegex = null;
330
+ if (filePattern && filePattern !== "*") {
331
+ const escaped = filePattern
332
+ .replace(/[.+^${}()|[\]\\]/g, "\\$&")
333
+ .replace(/\*/g, ".*");
334
+ fileRegex = new RegExp(escaped + "$", "i");
335
+ }
336
+
337
+ async function searchDir(dir) {
338
+ if (results.length >= maxResults) return;
339
+ let entries;
340
+ try { entries = await fsp.readdir(dir, { withFileTypes: true }); }
341
+ catch { return; }
342
+
343
+ for (const entry of entries) {
344
+ if (results.length >= maxResults) break;
345
+ const fullPath = path.join(dir, entry.name);
346
+ const relPath = path.relative(root, fullPath).replace(/\\/g, "/");
347
+
348
+ if (entry.isDirectory()) {
349
+ if (IGNORE_DIRS.includes(entry.name)) continue;
350
+ await searchDir(fullPath);
351
+ } else if (entry.isFile()) {
352
+ if (fileRegex && !fileRegex.test(entry.name)) continue;
353
+ const stat = await fsp.stat(fullPath).catch(() => null);
354
+ if (!stat || stat.size > 500000) continue;
355
+
356
+ try {
357
+ const content = await fsp.readFile(fullPath, "utf8");
358
+ const lines = content.split("\n");
359
+ for (let i = 0; i < lines.length && results.length < maxResults; i++) {
360
+ if (lines[i].toLowerCase().includes(queryLower)) {
361
+ results.push({ file: relPath, line: i + 1, content: lines[i].trim() });
362
+ }
363
+ }
364
+ } catch { /* skip unreadable */ }
365
+ }
366
+ }
367
+ }
368
+
369
+ await searchDir(root);
370
+ return results;
371
+ }
372
+
373
+ /**
374
+ * execInWorkspaceWindows — Uses cmd.exe instead of sh.
375
+ * Used automatically on Windows.
376
+ */
377
+ function execInWorkspaceWindows(root, command, timeoutSec) {
378
+ return new Promise((resolve) => {
379
+ const child = spawn("cmd.exe", ["/c", command], { cwd: root });
380
+ let stdout = "";
381
+ let stderr = "";
382
+
383
+ child.stdout.on("data", d => stdout += d.toString());
384
+ child.stderr.on("data", d => stderr += d.toString());
385
+
386
+ child.on("error", (err) => {
387
+ resolve({ exitCode: -1, stdout: "", stderr: err.message, timedOut: false });
388
+ });
389
+
390
+ const timer = setTimeout(() => {
391
+ try { child.kill("SIGKILL"); } catch {}
392
+ resolve({ exitCode: -1, stdout, stderr, timedOut: true });
393
+ }, timeoutSec * 1000);
394
+
395
+ child.on("close", (code) => {
396
+ clearTimeout(timer);
397
+ const maxLen = 10000;
398
+ if (stdout.length > maxLen) {
399
+ stdout = stdout.substring(0, maxLen / 2) + "\n...(truncated)...\n" + stdout.substring(stdout.length - maxLen / 2);
400
+ }
401
+ resolve({ exitCode: code ?? 0, stdout, stderr: stderr.substring(0, 5000), timedOut: false });
402
+ });
403
+ });
404
+ }
405
+
406
+ // Platform dispatchers — original functions unchanged above
407
+ const IS_WINDOWS = process.platform === "win32";
408
+ const grepWorkspaceX = IS_WINDOWS ? grepWorkspaceWindows : grepWorkspace;
409
+ const execInWorkspaceX = IS_WINDOWS ? execInWorkspaceWindows : execInWorkspace;
package/src/server.js CHANGED
@@ -5133,6 +5133,16 @@ async function startWebSocketTunnel(port, gatewayUrl, apiKey, tenantId) {
5133
5133
  }
5134
5134
  }
5135
5135
 
5136
+ case 'workspace.git.create-fix-branch': {
5137
+ const fetch2 = (await import('node-fetch')).default;
5138
+ const r = await fetch2(`http://localhost:5055/workspace/git/create-fix-branch`, {
5139
+ method: 'POST',
5140
+ headers: { 'Content-Type': 'application/json' },
5141
+ body: JSON.stringify(params)
5142
+ });
5143
+ return await r.json();
5144
+ }
5145
+
5136
5146
  case 'workspace.safe-patch':
5137
5147
  case 'workspace.compile':
5138
5148
  case 'workspace.rollback':