terminal-pilot 0.0.21 → 0.0.22

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 (58) hide show
  1. package/dist/cli.js +467 -193
  2. package/dist/cli.js.map +4 -4
  3. package/dist/commands/close-session.js +6 -4
  4. package/dist/commands/close-session.js.map +3 -3
  5. package/dist/commands/create-session.js +6 -4
  6. package/dist/commands/create-session.js.map +3 -3
  7. package/dist/commands/fill.js +6 -4
  8. package/dist/commands/fill.js.map +3 -3
  9. package/dist/commands/get-session.js +6 -4
  10. package/dist/commands/get-session.js.map +3 -3
  11. package/dist/commands/index.js +79 -33
  12. package/dist/commands/index.js.map +4 -4
  13. package/dist/commands/install.js +64 -20
  14. package/dist/commands/install.js.map +4 -4
  15. package/dist/commands/installer.js +36 -2
  16. package/dist/commands/installer.js.map +4 -4
  17. package/dist/commands/list-sessions.js +6 -4
  18. package/dist/commands/list-sessions.js.map +3 -3
  19. package/dist/commands/press-key.js +6 -4
  20. package/dist/commands/press-key.js.map +3 -3
  21. package/dist/commands/read-history.js +6 -4
  22. package/dist/commands/read-history.js.map +3 -3
  23. package/dist/commands/read-screen.js +6 -4
  24. package/dist/commands/read-screen.js.map +3 -3
  25. package/dist/commands/resize.js +6 -4
  26. package/dist/commands/resize.js.map +3 -3
  27. package/dist/commands/runtime.js +6 -4
  28. package/dist/commands/runtime.js.map +3 -3
  29. package/dist/commands/screenshot.js +17 -8
  30. package/dist/commands/screenshot.js.map +3 -3
  31. package/dist/commands/send-signal.js +6 -4
  32. package/dist/commands/send-signal.js.map +3 -3
  33. package/dist/commands/type.js +6 -4
  34. package/dist/commands/type.js.map +3 -3
  35. package/dist/commands/uninstall.js +39 -5
  36. package/dist/commands/uninstall.js.map +4 -4
  37. package/dist/commands/wait-for-exit.js +6 -4
  38. package/dist/commands/wait-for-exit.js.map +3 -3
  39. package/dist/commands/wait-for.js +6 -4
  40. package/dist/commands/wait-for.js.map +3 -3
  41. package/dist/errors.d.ts +1 -0
  42. package/dist/errors.js +8 -0
  43. package/dist/errors.js.map +7 -0
  44. package/dist/index.js +8 -4
  45. package/dist/index.js.map +3 -3
  46. package/dist/terminal-pilot.js +6 -4
  47. package/dist/terminal-pilot.js.map +3 -3
  48. package/dist/terminal-session.js +6 -4
  49. package/dist/terminal-session.js.map +3 -3
  50. package/dist/testing/cli-repl.js +467 -193
  51. package/dist/testing/cli-repl.js.map +4 -4
  52. package/dist/testing/qa-cli.js +467 -193
  53. package/dist/testing/qa-cli.js.map +4 -4
  54. package/node_modules/@poe-code/agent-skill-config/dist/apply.js +4 -1
  55. package/node_modules/@poe-code/agent-skill-config/dist/bridge-active-skills.js +1 -1
  56. package/node_modules/@poe-code/agent-skill-config/dist/git-exclude.js +17 -9
  57. package/node_modules/@poe-code/agent-skill-config/dist/templates.js +4 -1
  58. package/package.json +1 -1
@@ -1353,20 +1353,27 @@ async function renderTerminalPng(ansiText, options = {}) {
1353
1353
  const png = renderPng(svg);
1354
1354
  if (options.output) {
1355
1355
  const temporaryPath = `${options.output}.${randomUUID()}.tmp`;
1356
+ let temporaryCreated = false;
1356
1357
  try {
1357
1358
  await writeFile(temporaryPath, png, { flag: "wx" });
1359
+ temporaryCreated = true;
1358
1360
  await rename(temporaryPath, options.output);
1359
1361
  } catch (error) {
1360
- try {
1361
- await rm(temporaryPath, { force: true });
1362
- } catch (cleanupError) {
1363
- void cleanupError;
1362
+ if (temporaryCreated || !isAlreadyExistsError(error)) {
1363
+ try {
1364
+ await rm(temporaryPath, { force: true });
1365
+ } catch (cleanupError) {
1366
+ void cleanupError;
1367
+ }
1364
1368
  }
1365
1369
  throw error;
1366
1370
  }
1367
1371
  }
1368
1372
  return png;
1369
1373
  }
1374
+ function isAlreadyExistsError(error) {
1375
+ return error instanceof Error && Object.prototype.hasOwnProperty.call(error, "code") && error.code === "EEXIST";
1376
+ }
1370
1377
 
1371
1378
  // src/terminal-pilot.ts
1372
1379
  import { randomUUID as randomUUID2 } from "node:crypto";
@@ -1451,6 +1458,11 @@ function consumeTerminatedString(input, index, allowBellTerminator) {
1451
1458
  return input.length;
1452
1459
  }
1453
1460
 
1461
+ // src/errors.ts
1462
+ function hasOwnErrorCode(error, code) {
1463
+ return error instanceof Error && Object.prototype.hasOwnProperty.call(error, "code") && error.code === code;
1464
+ }
1465
+
1454
1466
  // src/terminal-buffer.ts
1455
1467
  var RESET_SGR = "\x1B[0m";
1456
1468
  var DEC_SPECIAL_GRAPHICS = {
@@ -2550,10 +2562,7 @@ function ensureSpawnHelperExecutable() {
2550
2562
  }
2551
2563
  }
2552
2564
  function isMissingFileError(error) {
2553
- if (!(error instanceof Error)) {
2554
- return false;
2555
- }
2556
- return "code" in error && error.code === "ENOENT";
2565
+ return hasOwnErrorCode(error, "ENOENT");
2557
2566
  }
2558
2567
  function matchPattern(buffer, pattern) {
2559
2568
  const clean = normalizeHistoryBuffer(stripAnsi(buffer));