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/cli/index.js
CHANGED
|
@@ -30208,6 +30208,7 @@ var init_daemon_p2p = __esm({
|
|
|
30208
30208
|
commandHandler = null;
|
|
30209
30209
|
ptyInputHandler = null;
|
|
30210
30210
|
ptyResizeHandler = null;
|
|
30211
|
+
screenshotStartHandler = null;
|
|
30211
30212
|
_ssDebugDone = false;
|
|
30212
30213
|
// PTY scrollback buffer per cliType (send recent output on reconnect)
|
|
30213
30214
|
ptyScrollback = /* @__PURE__ */ new Map();
|
|
@@ -30350,7 +30351,7 @@ ${e?.stack || ""}`);
|
|
|
30350
30351
|
let token = "";
|
|
30351
30352
|
try {
|
|
30352
30353
|
const config2 = JSON.parse(fs10.readFileSync(configPath, "utf-8"));
|
|
30353
|
-
token = config2.
|
|
30354
|
+
token = config2.machineSecret || "";
|
|
30354
30355
|
} catch {
|
|
30355
30356
|
}
|
|
30356
30357
|
const http3 = esmRequire("https");
|
|
@@ -30615,6 +30616,7 @@ ${e?.stack || ""}`);
|
|
|
30615
30616
|
peer.screenshotIdeType = parsed.ideType;
|
|
30616
30617
|
peer.needsFirstFrame = true;
|
|
30617
30618
|
log(`screenshot_start: peer=${peerId}, ideType=${parsed.ideType}, channelOpen=${!!peer.dataChannel}, state=${peer.state}`);
|
|
30619
|
+
this.screenshotStartHandler?.();
|
|
30618
30620
|
} else {
|
|
30619
30621
|
log(`screenshot_start: peer ${peerId} NOT FOUND in peers map!`);
|
|
30620
30622
|
}
|
|
@@ -30766,6 +30768,9 @@ ${e?.stack || ""}`);
|
|
|
30766
30768
|
onPtyResize(handler) {
|
|
30767
30769
|
this.ptyResizeHandler = handler;
|
|
30768
30770
|
}
|
|
30771
|
+
onScreenshotStart(handler) {
|
|
30772
|
+
this.screenshotStartHandler = handler;
|
|
30773
|
+
}
|
|
30769
30774
|
// ─── P2P command/input/file handling ────────────────
|
|
30770
30775
|
async handleP2PCommand(peerId, msg) {
|
|
30771
30776
|
const { id, commandType, data } = msg;
|
|
@@ -31009,6 +31014,14 @@ var init_screenshot_controller = __esm({
|
|
|
31009
31014
|
this.timer = null;
|
|
31010
31015
|
}
|
|
31011
31016
|
}
|
|
31017
|
+
/** Force immediate tick — called when screenshot_start is received to minimize first-frame latency */
|
|
31018
|
+
triggerImmediate() {
|
|
31019
|
+
if (this.timer) {
|
|
31020
|
+
clearTimeout(this.timer);
|
|
31021
|
+
this.timer = null;
|
|
31022
|
+
}
|
|
31023
|
+
this.timer = setTimeout(() => this.tick(), 50);
|
|
31024
|
+
}
|
|
31012
31025
|
// ─── Core loop ────────────────────────────────
|
|
31013
31026
|
async tick() {
|
|
31014
31027
|
if (!this.deps.isRunning()) return;
|
|
@@ -31024,21 +31037,22 @@ var init_screenshot_controller = __esm({
|
|
|
31024
31037
|
this.checkBudgetReset();
|
|
31025
31038
|
if (this.dailyBudgetMs > 0) {
|
|
31026
31039
|
const now = Date.now();
|
|
31027
|
-
if (active && this.lastActiveTimestamp > 0) {
|
|
31040
|
+
if (active && isRelay && this.lastActiveTimestamp > 0) {
|
|
31028
31041
|
this.dailyUsedMs += now - this.lastActiveTimestamp;
|
|
31029
31042
|
}
|
|
31030
|
-
this.lastActiveTimestamp = active ? now : 0;
|
|
31043
|
+
this.lastActiveTimestamp = active && isRelay ? now : 0;
|
|
31031
31044
|
if (this.dailyUsedMs >= this.dailyBudgetMs && !this.budgetExhausted) {
|
|
31032
31045
|
this.budgetExhausted = true;
|
|
31033
31046
|
const usedMin = Math.round(this.dailyUsedMs / 6e4);
|
|
31034
|
-
LOG.info("Screenshot", `Daily budget exhausted: ${usedMin}/${this.dailyBudgetMinutes}min \u2014 pausing until midnight UTC`);
|
|
31047
|
+
LOG.info("Screenshot", `Daily TURN budget exhausted: ${usedMin}/${this.dailyBudgetMinutes}min \u2014 pausing relay until midnight UTC`);
|
|
31035
31048
|
}
|
|
31036
31049
|
}
|
|
31037
|
-
|
|
31050
|
+
const budgetBlocked = this.budgetExhausted && isRelay;
|
|
31051
|
+
if (!active || !cdp || budgetBlocked) {
|
|
31038
31052
|
this.staticFrameCount = 0;
|
|
31039
31053
|
this.currentInterval = profile.maxInterval;
|
|
31040
31054
|
if (!active) this.lastActiveTimestamp = 0;
|
|
31041
|
-
this.timer = setTimeout(() => this.tick(),
|
|
31055
|
+
this.timer = setTimeout(() => this.tick(), budgetBlocked ? 3e4 : this.currentInterval);
|
|
31042
31056
|
return;
|
|
31043
31057
|
}
|
|
31044
31058
|
this.debugCount++;
|
|
@@ -31174,7 +31188,7 @@ var init_adhdev_daemon = __esm({
|
|
|
31174
31188
|
fs11 = __toESM(require("fs"));
|
|
31175
31189
|
path14 = __toESM(require("path"));
|
|
31176
31190
|
import_chalk2 = __toESM(require("chalk"));
|
|
31177
|
-
pkgVersion = "0.6.
|
|
31191
|
+
pkgVersion = "0.6.25";
|
|
31178
31192
|
if (pkgVersion === "unknown") {
|
|
31179
31193
|
try {
|
|
31180
31194
|
const possiblePaths = [
|
|
@@ -31241,9 +31255,12 @@ ${err?.stack || ""}`);
|
|
|
31241
31255
|
}
|
|
31242
31256
|
writeDaemonPid(process.pid);
|
|
31243
31257
|
const config2 = loadConfig();
|
|
31244
|
-
const authToken = config2.machineSecret
|
|
31258
|
+
const authToken = config2.machineSecret;
|
|
31245
31259
|
if (!authToken) {
|
|
31246
|
-
console.log(import_chalk2.default.red("\n\u2717 No
|
|
31260
|
+
console.log(import_chalk2.default.red("\n\u2717 No machine secret found."));
|
|
31261
|
+
if (config2.connectionToken) {
|
|
31262
|
+
console.log(import_chalk2.default.yellow(" Legacy connectionToken detected \u2014 please re-run setup."));
|
|
31263
|
+
}
|
|
31247
31264
|
console.log(import_chalk2.default.gray(" Run `adhdev setup` first.\n"));
|
|
31248
31265
|
process.exit(1);
|
|
31249
31266
|
}
|
|
@@ -31363,6 +31380,7 @@ ${err?.stack || ""}`);
|
|
|
31363
31380
|
sendScreenshotBuffer: (buf) => this.p2p.sendScreenshotBuffer(buf)
|
|
31364
31381
|
}, planLimits ?? void 0);
|
|
31365
31382
|
this.screenshotController.start();
|
|
31383
|
+
this.p2p.onScreenshotStart(() => this.screenshotController?.triggerImmediate());
|
|
31366
31384
|
} else {
|
|
31367
31385
|
console.log(import_chalk2.default.gray(" \u26A0 P2P unavailable \u2014 using server relay"));
|
|
31368
31386
|
}
|