adhdev 0.6.23 → 0.6.25
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/index.js +27 -9
- package/dist/cli/index.js.map +1 -1
- package/dist/index.js +27 -9
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -29768,6 +29768,7 @@ var init_daemon_p2p = __esm({
|
|
|
29768
29768
|
commandHandler = null;
|
|
29769
29769
|
ptyInputHandler = null;
|
|
29770
29770
|
ptyResizeHandler = null;
|
|
29771
|
+
screenshotStartHandler = null;
|
|
29771
29772
|
_ssDebugDone = false;
|
|
29772
29773
|
// PTY scrollback buffer per cliType (send recent output on reconnect)
|
|
29773
29774
|
ptyScrollback = /* @__PURE__ */ new Map();
|
|
@@ -29910,7 +29911,7 @@ ${e?.stack || ""}`);
|
|
|
29910
29911
|
let token = "";
|
|
29911
29912
|
try {
|
|
29912
29913
|
const config2 = JSON.parse(fs10.readFileSync(configPath, "utf-8"));
|
|
29913
|
-
token = config2.
|
|
29914
|
+
token = config2.machineSecret || "";
|
|
29914
29915
|
} catch {
|
|
29915
29916
|
}
|
|
29916
29917
|
const http3 = esmRequire("https");
|
|
@@ -30175,6 +30176,7 @@ ${e?.stack || ""}`);
|
|
|
30175
30176
|
peer.screenshotIdeType = parsed.ideType;
|
|
30176
30177
|
peer.needsFirstFrame = true;
|
|
30177
30178
|
log(`screenshot_start: peer=${peerId}, ideType=${parsed.ideType}, channelOpen=${!!peer.dataChannel}, state=${peer.state}`);
|
|
30179
|
+
this.screenshotStartHandler?.();
|
|
30178
30180
|
} else {
|
|
30179
30181
|
log(`screenshot_start: peer ${peerId} NOT FOUND in peers map!`);
|
|
30180
30182
|
}
|
|
@@ -30326,6 +30328,9 @@ ${e?.stack || ""}`);
|
|
|
30326
30328
|
onPtyResize(handler) {
|
|
30327
30329
|
this.ptyResizeHandler = handler;
|
|
30328
30330
|
}
|
|
30331
|
+
onScreenshotStart(handler) {
|
|
30332
|
+
this.screenshotStartHandler = handler;
|
|
30333
|
+
}
|
|
30329
30334
|
// ─── P2P command/input/file handling ────────────────
|
|
30330
30335
|
async handleP2PCommand(peerId, msg) {
|
|
30331
30336
|
const { id, commandType, data } = msg;
|
|
@@ -30569,6 +30574,14 @@ var init_screenshot_controller = __esm({
|
|
|
30569
30574
|
this.timer = null;
|
|
30570
30575
|
}
|
|
30571
30576
|
}
|
|
30577
|
+
/** Force immediate tick — called when screenshot_start is received to minimize first-frame latency */
|
|
30578
|
+
triggerImmediate() {
|
|
30579
|
+
if (this.timer) {
|
|
30580
|
+
clearTimeout(this.timer);
|
|
30581
|
+
this.timer = null;
|
|
30582
|
+
}
|
|
30583
|
+
this.timer = setTimeout(() => this.tick(), 50);
|
|
30584
|
+
}
|
|
30572
30585
|
// ─── Core loop ────────────────────────────────
|
|
30573
30586
|
async tick() {
|
|
30574
30587
|
if (!this.deps.isRunning()) return;
|
|
@@ -30584,21 +30597,22 @@ var init_screenshot_controller = __esm({
|
|
|
30584
30597
|
this.checkBudgetReset();
|
|
30585
30598
|
if (this.dailyBudgetMs > 0) {
|
|
30586
30599
|
const now = Date.now();
|
|
30587
|
-
if (active && this.lastActiveTimestamp > 0) {
|
|
30600
|
+
if (active && isRelay && this.lastActiveTimestamp > 0) {
|
|
30588
30601
|
this.dailyUsedMs += now - this.lastActiveTimestamp;
|
|
30589
30602
|
}
|
|
30590
|
-
this.lastActiveTimestamp = active ? now : 0;
|
|
30603
|
+
this.lastActiveTimestamp = active && isRelay ? now : 0;
|
|
30591
30604
|
if (this.dailyUsedMs >= this.dailyBudgetMs && !this.budgetExhausted) {
|
|
30592
30605
|
this.budgetExhausted = true;
|
|
30593
30606
|
const usedMin = Math.round(this.dailyUsedMs / 6e4);
|
|
30594
|
-
LOG.info("Screenshot", `Daily budget exhausted: ${usedMin}/${this.dailyBudgetMinutes}min \u2014 pausing until midnight UTC`);
|
|
30607
|
+
LOG.info("Screenshot", `Daily TURN budget exhausted: ${usedMin}/${this.dailyBudgetMinutes}min \u2014 pausing relay until midnight UTC`);
|
|
30595
30608
|
}
|
|
30596
30609
|
}
|
|
30597
|
-
|
|
30610
|
+
const budgetBlocked = this.budgetExhausted && isRelay;
|
|
30611
|
+
if (!active || !cdp || budgetBlocked) {
|
|
30598
30612
|
this.staticFrameCount = 0;
|
|
30599
30613
|
this.currentInterval = profile.maxInterval;
|
|
30600
30614
|
if (!active) this.lastActiveTimestamp = 0;
|
|
30601
|
-
this.timer = setTimeout(() => this.tick(),
|
|
30615
|
+
this.timer = setTimeout(() => this.tick(), budgetBlocked ? 3e4 : this.currentInterval);
|
|
30602
30616
|
return;
|
|
30603
30617
|
}
|
|
30604
30618
|
this.debugCount++;
|
|
@@ -30734,7 +30748,7 @@ var init_adhdev_daemon = __esm({
|
|
|
30734
30748
|
fs11 = __toESM(require("fs"));
|
|
30735
30749
|
path14 = __toESM(require("path"));
|
|
30736
30750
|
import_chalk2 = __toESM(require("chalk"));
|
|
30737
|
-
pkgVersion = "0.6.
|
|
30751
|
+
pkgVersion = "0.6.25";
|
|
30738
30752
|
if (pkgVersion === "unknown") {
|
|
30739
30753
|
try {
|
|
30740
30754
|
const possiblePaths = [
|
|
@@ -30801,9 +30815,12 @@ ${err?.stack || ""}`);
|
|
|
30801
30815
|
}
|
|
30802
30816
|
writeDaemonPid(process.pid);
|
|
30803
30817
|
const config2 = loadConfig();
|
|
30804
|
-
const authToken = config2.machineSecret
|
|
30818
|
+
const authToken = config2.machineSecret;
|
|
30805
30819
|
if (!authToken) {
|
|
30806
|
-
console.log(import_chalk2.default.red("\n\u2717 No
|
|
30820
|
+
console.log(import_chalk2.default.red("\n\u2717 No machine secret found."));
|
|
30821
|
+
if (config2.connectionToken) {
|
|
30822
|
+
console.log(import_chalk2.default.yellow(" Legacy connectionToken detected \u2014 please re-run setup."));
|
|
30823
|
+
}
|
|
30807
30824
|
console.log(import_chalk2.default.gray(" Run `adhdev setup` first.\n"));
|
|
30808
30825
|
process.exit(1);
|
|
30809
30826
|
}
|
|
@@ -30923,6 +30940,7 @@ ${err?.stack || ""}`);
|
|
|
30923
30940
|
sendScreenshotBuffer: (buf) => this.p2p.sendScreenshotBuffer(buf)
|
|
30924
30941
|
}, planLimits ?? void 0);
|
|
30925
30942
|
this.screenshotController.start();
|
|
30943
|
+
this.p2p.onScreenshotStart(() => this.screenshotController?.triggerImmediate());
|
|
30926
30944
|
} else {
|
|
30927
30945
|
console.log(import_chalk2.default.gray(" \u26A0 P2P unavailable \u2014 using server relay"));
|
|
30928
30946
|
}
|