@hydra-acp/cli 0.1.18 → 0.1.20

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 +39 -1
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -4082,6 +4082,10 @@ async function getPendingUpdate() {
4082
4082
  notifier.check();
4083
4083
  const u = notifier.update;
4084
4084
  if (u && typeof u.latest === "string" && typeof u.current === "string" && u.latest !== u.current) {
4085
+ try {
4086
+ notifier.config?.set?.("update", u);
4087
+ } catch {
4088
+ }
4085
4089
  cached = {
4086
4090
  current: u.current,
4087
4091
  latest: u.latest,
@@ -5515,11 +5519,14 @@ var init_screen = __esm({
5515
5519
  if (!this.started) {
5516
5520
  return;
5517
5521
  }
5518
- this.started = false;
5519
5522
  if (this.bannerNotificationTimer) {
5520
5523
  clearTimeout(this.bannerNotificationTimer);
5521
5524
  this.bannerNotificationTimer = null;
5522
5525
  }
5526
+ if (this.throttledRepaintTimer) {
5527
+ clearTimeout(this.throttledRepaintTimer);
5528
+ this.throttledRepaintTimer = null;
5529
+ }
5523
5530
  this.uninstallBracketedPaste();
5524
5531
  this.term.off("key", this.keyHandler);
5525
5532
  if (this.mouseEnabled) {
@@ -5530,6 +5537,7 @@ var init_screen = __esm({
5530
5537
  this.term.hideCursor(false);
5531
5538
  process.stdout.write("\x1B[?7h");
5532
5539
  this.writeProgressIndicator(0);
5540
+ this.started = false;
5533
5541
  this.term.fullscreen(false);
5534
5542
  this.term("\n");
5535
5543
  }
@@ -5834,6 +5842,9 @@ var init_screen = __esm({
5834
5842
  // by terminals that don't implement it. Disabled entirely when
5835
5843
  // tui.progressIndicator is false.
5836
5844
  writeProgressIndicator(state) {
5845
+ if (!this.started) {
5846
+ return;
5847
+ }
5837
5848
  if (!this.progressIndicatorEnabled) {
5838
5849
  return;
5839
5850
  }
@@ -6348,6 +6359,9 @@ var init_screen = __esm({
6348
6359
  // recently, schedule one for the remainder of the window. Setting the
6349
6360
  // throttle to 0 disables coalescing entirely.
6350
6361
  scheduleRepaint() {
6362
+ if (!this.started) {
6363
+ return;
6364
+ }
6351
6365
  if (this.repaintPaused > 0) {
6352
6366
  this.repaintPending = true;
6353
6367
  return;
@@ -6380,6 +6394,9 @@ var init_screen = __esm({
6380
6394
  // visible output for that row (width, FormattedLine fields, banner
6381
6395
  // state, etc.) so identical sigs guarantee identical bytes.
6382
6396
  paintRow(row, signature, paint) {
6397
+ if (!this.started) {
6398
+ return;
6399
+ }
6383
6400
  if (row < 1 || row > this.term.height) {
6384
6401
  return;
6385
6402
  }
@@ -6391,6 +6408,9 @@ var init_screen = __esm({
6391
6408
  paint();
6392
6409
  }
6393
6410
  repaint() {
6411
+ if (!this.started) {
6412
+ return;
6413
+ }
6394
6414
  if (this.repaintPaused > 0) {
6395
6415
  this.repaintPending = true;
6396
6416
  return;
@@ -6809,6 +6829,9 @@ var init_screen = __esm({
6809
6829
  });
6810
6830
  }
6811
6831
  placeCursor() {
6832
+ if (!this.started) {
6833
+ return;
6834
+ }
6812
6835
  if (this.permissionPrompt) {
6813
6836
  const rows = this.permissionRows();
6814
6837
  const top2 = this.term.height - rows - BANNER_ROWS - SEPARATOR_ROWS - SESSIONBAR_ROWS + 1;
@@ -8396,6 +8419,7 @@ async function runSession(term, config, opts, exitHint) {
8396
8419
  await stream.start();
8397
8420
  let bufferedEvents = [];
8398
8421
  let applyRenderEvent = null;
8422
+ let teardownStarted = false;
8399
8423
  const appendRender = (event) => {
8400
8424
  if (!event) {
8401
8425
  return;
@@ -8446,6 +8470,9 @@ async function runSession(term, config, opts, exitHint) {
8446
8470
  let screenRef = null;
8447
8471
  let dispatcherRef = null;
8448
8472
  conn.onNotification("session/update", (params) => {
8473
+ if (teardownStarted) {
8474
+ return;
8475
+ }
8449
8476
  const { update } = params ?? {};
8450
8477
  const event = mapUpdate(update);
8451
8478
  debugLogUpdate(update, event);
@@ -8463,6 +8490,9 @@ async function runSession(term, config, opts, exitHint) {
8463
8490
  maybeDismissPermissionByToolUpdate(update);
8464
8491
  });
8465
8492
  conn.onNotification("hydra-acp/session_closed", () => {
8493
+ if (teardownStarted) {
8494
+ return;
8495
+ }
8466
8496
  if (pendingTurns > 0) {
8467
8497
  adjustPendingTurns(-pendingTurns);
8468
8498
  }
@@ -8538,6 +8568,9 @@ async function runSession(term, config, opts, exitHint) {
8538
8568
  void options;
8539
8569
  };
8540
8570
  conn.onRequest("session/request_permission", async (params) => {
8571
+ if (teardownStarted) {
8572
+ return { outcome: { outcome: "cancelled" } };
8573
+ }
8541
8574
  const p = params ?? {};
8542
8575
  const rawOptions = Array.isArray(p.options) ? p.options : [];
8543
8576
  const options = rawOptions.map((o) => ({
@@ -8969,7 +9002,12 @@ async function runSession(term, config, opts, exitHint) {
8969
9002
  return true;
8970
9003
  };
8971
9004
  const teardown = () => {
9005
+ teardownStarted = true;
8972
9006
  process.off("SIGINT", sigintHandler);
9007
+ if (sessionElapsedTimer !== null) {
9008
+ clearInterval(sessionElapsedTimer);
9009
+ sessionElapsedTimer = null;
9010
+ }
8973
9011
  screen.clearWindowTitle();
8974
9012
  screen.stop();
8975
9013
  saveHistory(historyFile, history).catch(() => void 0);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hydra-acp/cli",
3
- "version": "0.1.18",
3
+ "version": "0.1.20",
4
4
  "description": "Multi-client ACP session daemon: spawn agents, attach over WSS, multiplex sessions across editors.",
5
5
  "license": "MIT",
6
6
  "type": "module",