@hydra-acp/cli 0.1.19 → 0.1.21
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 +36 -4
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -4076,10 +4076,8 @@ async function getPendingUpdate() {
|
|
|
4076
4076
|
const mod = await import("update-notifier");
|
|
4077
4077
|
const updateNotifier = mod.default ?? mod;
|
|
4078
4078
|
const notifier = updateNotifier({
|
|
4079
|
-
pkg: { name: PKG_NAME, version: HYDRA_VERSION }
|
|
4080
|
-
updateCheckInterval: 1e3 * 60 * 60 * 24
|
|
4079
|
+
pkg: { name: PKG_NAME, version: HYDRA_VERSION }
|
|
4081
4080
|
});
|
|
4082
|
-
notifier.check();
|
|
4083
4081
|
const u = notifier.update;
|
|
4084
4082
|
if (u && typeof u.latest === "string" && typeof u.current === "string" && u.latest !== u.current) {
|
|
4085
4083
|
try {
|
|
@@ -5519,11 +5517,14 @@ var init_screen = __esm({
|
|
|
5519
5517
|
if (!this.started) {
|
|
5520
5518
|
return;
|
|
5521
5519
|
}
|
|
5522
|
-
this.started = false;
|
|
5523
5520
|
if (this.bannerNotificationTimer) {
|
|
5524
5521
|
clearTimeout(this.bannerNotificationTimer);
|
|
5525
5522
|
this.bannerNotificationTimer = null;
|
|
5526
5523
|
}
|
|
5524
|
+
if (this.throttledRepaintTimer) {
|
|
5525
|
+
clearTimeout(this.throttledRepaintTimer);
|
|
5526
|
+
this.throttledRepaintTimer = null;
|
|
5527
|
+
}
|
|
5527
5528
|
this.uninstallBracketedPaste();
|
|
5528
5529
|
this.term.off("key", this.keyHandler);
|
|
5529
5530
|
if (this.mouseEnabled) {
|
|
@@ -5534,6 +5535,7 @@ var init_screen = __esm({
|
|
|
5534
5535
|
this.term.hideCursor(false);
|
|
5535
5536
|
process.stdout.write("\x1B[?7h");
|
|
5536
5537
|
this.writeProgressIndicator(0);
|
|
5538
|
+
this.started = false;
|
|
5537
5539
|
this.term.fullscreen(false);
|
|
5538
5540
|
this.term("\n");
|
|
5539
5541
|
}
|
|
@@ -5838,6 +5840,9 @@ var init_screen = __esm({
|
|
|
5838
5840
|
// by terminals that don't implement it. Disabled entirely when
|
|
5839
5841
|
// tui.progressIndicator is false.
|
|
5840
5842
|
writeProgressIndicator(state) {
|
|
5843
|
+
if (!this.started) {
|
|
5844
|
+
return;
|
|
5845
|
+
}
|
|
5841
5846
|
if (!this.progressIndicatorEnabled) {
|
|
5842
5847
|
return;
|
|
5843
5848
|
}
|
|
@@ -6352,6 +6357,9 @@ var init_screen = __esm({
|
|
|
6352
6357
|
// recently, schedule one for the remainder of the window. Setting the
|
|
6353
6358
|
// throttle to 0 disables coalescing entirely.
|
|
6354
6359
|
scheduleRepaint() {
|
|
6360
|
+
if (!this.started) {
|
|
6361
|
+
return;
|
|
6362
|
+
}
|
|
6355
6363
|
if (this.repaintPaused > 0) {
|
|
6356
6364
|
this.repaintPending = true;
|
|
6357
6365
|
return;
|
|
@@ -6384,6 +6392,9 @@ var init_screen = __esm({
|
|
|
6384
6392
|
// visible output for that row (width, FormattedLine fields, banner
|
|
6385
6393
|
// state, etc.) so identical sigs guarantee identical bytes.
|
|
6386
6394
|
paintRow(row, signature, paint) {
|
|
6395
|
+
if (!this.started) {
|
|
6396
|
+
return;
|
|
6397
|
+
}
|
|
6387
6398
|
if (row < 1 || row > this.term.height) {
|
|
6388
6399
|
return;
|
|
6389
6400
|
}
|
|
@@ -6395,6 +6406,9 @@ var init_screen = __esm({
|
|
|
6395
6406
|
paint();
|
|
6396
6407
|
}
|
|
6397
6408
|
repaint() {
|
|
6409
|
+
if (!this.started) {
|
|
6410
|
+
return;
|
|
6411
|
+
}
|
|
6398
6412
|
if (this.repaintPaused > 0) {
|
|
6399
6413
|
this.repaintPending = true;
|
|
6400
6414
|
return;
|
|
@@ -6813,6 +6827,9 @@ var init_screen = __esm({
|
|
|
6813
6827
|
});
|
|
6814
6828
|
}
|
|
6815
6829
|
placeCursor() {
|
|
6830
|
+
if (!this.started) {
|
|
6831
|
+
return;
|
|
6832
|
+
}
|
|
6816
6833
|
if (this.permissionPrompt) {
|
|
6817
6834
|
const rows = this.permissionRows();
|
|
6818
6835
|
const top2 = this.term.height - rows - BANNER_ROWS - SEPARATOR_ROWS - SESSIONBAR_ROWS + 1;
|
|
@@ -8400,6 +8417,7 @@ async function runSession(term, config, opts, exitHint) {
|
|
|
8400
8417
|
await stream.start();
|
|
8401
8418
|
let bufferedEvents = [];
|
|
8402
8419
|
let applyRenderEvent = null;
|
|
8420
|
+
let teardownStarted = false;
|
|
8403
8421
|
const appendRender = (event) => {
|
|
8404
8422
|
if (!event) {
|
|
8405
8423
|
return;
|
|
@@ -8450,6 +8468,9 @@ async function runSession(term, config, opts, exitHint) {
|
|
|
8450
8468
|
let screenRef = null;
|
|
8451
8469
|
let dispatcherRef = null;
|
|
8452
8470
|
conn.onNotification("session/update", (params) => {
|
|
8471
|
+
if (teardownStarted) {
|
|
8472
|
+
return;
|
|
8473
|
+
}
|
|
8453
8474
|
const { update } = params ?? {};
|
|
8454
8475
|
const event = mapUpdate(update);
|
|
8455
8476
|
debugLogUpdate(update, event);
|
|
@@ -8467,6 +8488,9 @@ async function runSession(term, config, opts, exitHint) {
|
|
|
8467
8488
|
maybeDismissPermissionByToolUpdate(update);
|
|
8468
8489
|
});
|
|
8469
8490
|
conn.onNotification("hydra-acp/session_closed", () => {
|
|
8491
|
+
if (teardownStarted) {
|
|
8492
|
+
return;
|
|
8493
|
+
}
|
|
8470
8494
|
if (pendingTurns > 0) {
|
|
8471
8495
|
adjustPendingTurns(-pendingTurns);
|
|
8472
8496
|
}
|
|
@@ -8542,6 +8566,9 @@ async function runSession(term, config, opts, exitHint) {
|
|
|
8542
8566
|
void options;
|
|
8543
8567
|
};
|
|
8544
8568
|
conn.onRequest("session/request_permission", async (params) => {
|
|
8569
|
+
if (teardownStarted) {
|
|
8570
|
+
return { outcome: { outcome: "cancelled" } };
|
|
8571
|
+
}
|
|
8545
8572
|
const p = params ?? {};
|
|
8546
8573
|
const rawOptions = Array.isArray(p.options) ? p.options : [];
|
|
8547
8574
|
const options = rawOptions.map((o) => ({
|
|
@@ -8973,7 +9000,12 @@ async function runSession(term, config, opts, exitHint) {
|
|
|
8973
9000
|
return true;
|
|
8974
9001
|
};
|
|
8975
9002
|
const teardown = () => {
|
|
9003
|
+
teardownStarted = true;
|
|
8976
9004
|
process.off("SIGINT", sigintHandler);
|
|
9005
|
+
if (sessionElapsedTimer !== null) {
|
|
9006
|
+
clearInterval(sessionElapsedTimer);
|
|
9007
|
+
sessionElapsedTimer = null;
|
|
9008
|
+
}
|
|
8977
9009
|
screen.clearWindowTitle();
|
|
8978
9010
|
screen.stop();
|
|
8979
9011
|
saveHistory(historyFile, history).catch(() => void 0);
|