@nexrall/code-core 1.4.17 → 1.4.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.
@@ -1 +1 @@
1
- {"version":3,"file":"executor.d.ts","sourceRoot":"","sources":["../../src/tools/executor.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAC3C,OAAO,EAAyB,KAAK,aAAa,EAAE,MAAM,WAAW,CAAC;AA4kEtE,wBAAsB,WAAW,CAC/B,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC9B,WAAW,CAAC,EAAE;IAAE,OAAO,EAAE,OAAO,CAAA;CAAE,EAClC,OAAO,CAAC,EAAE,aAAa,EACvB,OAAO,CAAC,EAAE,MAAM,EAChB,UAAU,CAAC,EAAE,MAAM,GAClB,OAAO,CAAC,UAAU,CAAC,CAiBrB"}
1
+ {"version":3,"file":"executor.d.ts","sourceRoot":"","sources":["../../src/tools/executor.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAC3C,OAAO,EAAyB,KAAK,aAAa,EAAE,MAAM,WAAW,CAAC;AAwlEtE,wBAAsB,WAAW,CAC/B,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC9B,WAAW,CAAC,EAAE;IAAE,OAAO,EAAE,OAAO,CAAA;CAAE,EAClC,OAAO,CAAC,EAAE,aAAa,EACvB,OAAO,CAAC,EAAE,MAAM,EAChB,UAAU,CAAC,EAAE,MAAM,GAClB,OAAO,CAAC,UAAU,CAAC,CAiBrB"}
@@ -437,6 +437,22 @@ async function listDirectory(input, workDir) {
437
437
  const dirPath = typeof input.path === 'string' ? input.path : '.';
438
438
  try {
439
439
  const resolved = resolvePath(dirPath, workDir);
440
+ // Give an actionable error when the path is a FILE, not a directory — the
441
+ // inverse of deleteFile/copyFile/preflightEdit's "path is a directory, not
442
+ // a file" guard. Without this, fs.readdirSync throws Node's raw system
443
+ // error verbatim (`ENOTDIR: not a directory, scandir '<path>'`), which
444
+ // names an obscure libuv syscall the model has never heard of and gives
445
+ // no hint that read_file is the right tool for that path.
446
+ let stat;
447
+ try {
448
+ stat = fs.statSync(resolved);
449
+ }
450
+ catch {
451
+ return { error: `Path not found: ${resolved}.` };
452
+ }
453
+ if (!stat.isDirectory()) {
454
+ return { error: `Path is a file, not a directory: ${resolved}. Use read_file to view its contents.` };
455
+ }
440
456
  const entries = fs.readdirSync(resolved, { withFileTypes: true });
441
457
  // Sort: directories first, then files, each group alphabetically
442
458
  const dirs = entries
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nexrall/code-core",
3
- "version": "1.4.17",
3
+ "version": "1.4.18",
4
4
  "description": "Core agent loop, tools, and extension primitives for Nexrall Code — embed an AI coding agent in any Node.js application.",
5
5
  "license": "MIT",
6
6
  "author": "Nexrall <support@nexrall.com> (https://nexrall.com)",