@hydra-acp/cli 0.1.19 → 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.
- package/dist/cli.js +35 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -5519,11 +5519,14 @@ var init_screen = __esm({
|
|
|
5519
5519
|
if (!this.started) {
|
|
5520
5520
|
return;
|
|
5521
5521
|
}
|
|
5522
|
-
this.started = false;
|
|
5523
5522
|
if (this.bannerNotificationTimer) {
|
|
5524
5523
|
clearTimeout(this.bannerNotificationTimer);
|
|
5525
5524
|
this.bannerNotificationTimer = null;
|
|
5526
5525
|
}
|
|
5526
|
+
if (this.throttledRepaintTimer) {
|
|
5527
|
+
clearTimeout(this.throttledRepaintTimer);
|
|
5528
|
+
this.throttledRepaintTimer = null;
|
|
5529
|
+
}
|
|
5527
5530
|
this.uninstallBracketedPaste();
|
|
5528
5531
|
this.term.off("key", this.keyHandler);
|
|
5529
5532
|
if (this.mouseEnabled) {
|
|
@@ -5534,6 +5537,7 @@ var init_screen = __esm({
|
|
|
5534
5537
|
this.term.hideCursor(false);
|
|
5535
5538
|
process.stdout.write("\x1B[?7h");
|
|
5536
5539
|
this.writeProgressIndicator(0);
|
|
5540
|
+
this.started = false;
|
|
5537
5541
|
this.term.fullscreen(false);
|
|
5538
5542
|
this.term("\n");
|
|
5539
5543
|
}
|
|
@@ -5838,6 +5842,9 @@ var init_screen = __esm({
|
|
|
5838
5842
|
// by terminals that don't implement it. Disabled entirely when
|
|
5839
5843
|
// tui.progressIndicator is false.
|
|
5840
5844
|
writeProgressIndicator(state) {
|
|
5845
|
+
if (!this.started) {
|
|
5846
|
+
return;
|
|
5847
|
+
}
|
|
5841
5848
|
if (!this.progressIndicatorEnabled) {
|
|
5842
5849
|
return;
|
|
5843
5850
|
}
|
|
@@ -6352,6 +6359,9 @@ var init_screen = __esm({
|
|
|
6352
6359
|
// recently, schedule one for the remainder of the window. Setting the
|
|
6353
6360
|
// throttle to 0 disables coalescing entirely.
|
|
6354
6361
|
scheduleRepaint() {
|
|
6362
|
+
if (!this.started) {
|
|
6363
|
+
return;
|
|
6364
|
+
}
|
|
6355
6365
|
if (this.repaintPaused > 0) {
|
|
6356
6366
|
this.repaintPending = true;
|
|
6357
6367
|
return;
|
|
@@ -6384,6 +6394,9 @@ var init_screen = __esm({
|
|
|
6384
6394
|
// visible output for that row (width, FormattedLine fields, banner
|
|
6385
6395
|
// state, etc.) so identical sigs guarantee identical bytes.
|
|
6386
6396
|
paintRow(row, signature, paint) {
|
|
6397
|
+
if (!this.started) {
|
|
6398
|
+
return;
|
|
6399
|
+
}
|
|
6387
6400
|
if (row < 1 || row > this.term.height) {
|
|
6388
6401
|
return;
|
|
6389
6402
|
}
|
|
@@ -6395,6 +6408,9 @@ var init_screen = __esm({
|
|
|
6395
6408
|
paint();
|
|
6396
6409
|
}
|
|
6397
6410
|
repaint() {
|
|
6411
|
+
if (!this.started) {
|
|
6412
|
+
return;
|
|
6413
|
+
}
|
|
6398
6414
|
if (this.repaintPaused > 0) {
|
|
6399
6415
|
this.repaintPending = true;
|
|
6400
6416
|
return;
|
|
@@ -6813,6 +6829,9 @@ var init_screen = __esm({
|
|
|
6813
6829
|
});
|
|
6814
6830
|
}
|
|
6815
6831
|
placeCursor() {
|
|
6832
|
+
if (!this.started) {
|
|
6833
|
+
return;
|
|
6834
|
+
}
|
|
6816
6835
|
if (this.permissionPrompt) {
|
|
6817
6836
|
const rows = this.permissionRows();
|
|
6818
6837
|
const top2 = this.term.height - rows - BANNER_ROWS - SEPARATOR_ROWS - SESSIONBAR_ROWS + 1;
|
|
@@ -8400,6 +8419,7 @@ async function runSession(term, config, opts, exitHint) {
|
|
|
8400
8419
|
await stream.start();
|
|
8401
8420
|
let bufferedEvents = [];
|
|
8402
8421
|
let applyRenderEvent = null;
|
|
8422
|
+
let teardownStarted = false;
|
|
8403
8423
|
const appendRender = (event) => {
|
|
8404
8424
|
if (!event) {
|
|
8405
8425
|
return;
|
|
@@ -8450,6 +8470,9 @@ async function runSession(term, config, opts, exitHint) {
|
|
|
8450
8470
|
let screenRef = null;
|
|
8451
8471
|
let dispatcherRef = null;
|
|
8452
8472
|
conn.onNotification("session/update", (params) => {
|
|
8473
|
+
if (teardownStarted) {
|
|
8474
|
+
return;
|
|
8475
|
+
}
|
|
8453
8476
|
const { update } = params ?? {};
|
|
8454
8477
|
const event = mapUpdate(update);
|
|
8455
8478
|
debugLogUpdate(update, event);
|
|
@@ -8467,6 +8490,9 @@ async function runSession(term, config, opts, exitHint) {
|
|
|
8467
8490
|
maybeDismissPermissionByToolUpdate(update);
|
|
8468
8491
|
});
|
|
8469
8492
|
conn.onNotification("hydra-acp/session_closed", () => {
|
|
8493
|
+
if (teardownStarted) {
|
|
8494
|
+
return;
|
|
8495
|
+
}
|
|
8470
8496
|
if (pendingTurns > 0) {
|
|
8471
8497
|
adjustPendingTurns(-pendingTurns);
|
|
8472
8498
|
}
|
|
@@ -8542,6 +8568,9 @@ async function runSession(term, config, opts, exitHint) {
|
|
|
8542
8568
|
void options;
|
|
8543
8569
|
};
|
|
8544
8570
|
conn.onRequest("session/request_permission", async (params) => {
|
|
8571
|
+
if (teardownStarted) {
|
|
8572
|
+
return { outcome: { outcome: "cancelled" } };
|
|
8573
|
+
}
|
|
8545
8574
|
const p = params ?? {};
|
|
8546
8575
|
const rawOptions = Array.isArray(p.options) ? p.options : [];
|
|
8547
8576
|
const options = rawOptions.map((o) => ({
|
|
@@ -8973,7 +9002,12 @@ async function runSession(term, config, opts, exitHint) {
|
|
|
8973
9002
|
return true;
|
|
8974
9003
|
};
|
|
8975
9004
|
const teardown = () => {
|
|
9005
|
+
teardownStarted = true;
|
|
8976
9006
|
process.off("SIGINT", sigintHandler);
|
|
9007
|
+
if (sessionElapsedTimer !== null) {
|
|
9008
|
+
clearInterval(sessionElapsedTimer);
|
|
9009
|
+
sessionElapsedTimer = null;
|
|
9010
|
+
}
|
|
8977
9011
|
screen.clearWindowTitle();
|
|
8978
9012
|
screen.stop();
|
|
8979
9013
|
saveHistory(historyFile, history).catch(() => void 0);
|