@snowyroad/arp 0.5.1 → 0.5.2

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 (2) hide show
  1. package/dist/cli.js +18 -1
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -336,6 +336,18 @@ var CTRL_RE = /[\u0000-\u0008\u000b-\u001f\u007f-\u009f]/g;
336
336
  function sanitizeForTty(s) {
337
337
  return s.replace(ANSI_RE, "").replace(CTRL_RE, "");
338
338
  }
339
+ var ESC = String.fromCharCode(27);
340
+ function restoreTerminal() {
341
+ const out = process.stdout;
342
+ if (!out.isTTY) return;
343
+ out.write(
344
+ `${ESC}[?1l${ESC}>${ESC}[?25h${ESC}[?1049l${ESC}[?2004l${ESC}[?1000l${ESC}[?1002l${ESC}[?1003l${ESC}[?1006l`
345
+ );
346
+ try {
347
+ if (process.stdin.isTTY) process.stdin.setRawMode(false);
348
+ } catch {
349
+ }
350
+ }
339
351
  function isShellSafeName(s) {
340
352
  return /^[A-Za-z0-9_.-]+$/.test(s);
341
353
  }
@@ -2838,7 +2850,10 @@ function withTimeout(p, ms) {
2838
2850
  // src/shutdown.ts
2839
2851
  var SHUTDOWN_TIMEOUT_MS = 8e3;
2840
2852
  async function drainAndExit(sessions, exitCode, relay, brokers) {
2841
- const force = setTimeout(() => process.exit(exitCode), SHUTDOWN_TIMEOUT_MS);
2853
+ const force = setTimeout(() => {
2854
+ restoreTerminal();
2855
+ process.exit(exitCode);
2856
+ }, SHUTDOWN_TIMEOUT_MS);
2842
2857
  force.unref?.();
2843
2858
  try {
2844
2859
  relay?.stop();
@@ -2857,9 +2872,11 @@ async function drainAndExit(sessions, exitCode, relay, brokers) {
2857
2872
  }
2858
2873
  }
2859
2874
  clearTimeout(force);
2875
+ restoreTerminal();
2860
2876
  process.exit(exitCode);
2861
2877
  }
2862
2878
  function installGracefulShutdown(bridge) {
2879
+ process.on("exit", () => restoreTerminal());
2863
2880
  let shuttingDown = false;
2864
2881
  const shutdown = async (sig) => {
2865
2882
  if (shuttingDown) return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@snowyroad/arp",
3
- "version": "0.5.1",
3
+ "version": "0.5.2",
4
4
  "description": "Connect your own coding agent (Claude Code, Codex, Gemini, Grok) to an Agent Relay Protocol channel and collaborate with other agents and humans.",
5
5
  "license": "SEE LICENSE IN LICENSE.md",
6
6
  "author": "SnowyRoad",