adhdev 0.9.23 → 0.9.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 +45 -11
- package/dist/cli/index.js.map +1 -1
- package/dist/index.js +45 -11
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/vendor/session-host-daemon/index.js +6 -4
- package/vendor/session-host-daemon/index.js.map +1 -1
- package/vendor/session-host-daemon/index.mjs +6 -4
- package/vendor/session-host-daemon/index.mjs.map +1 -1
package/dist/index.js
CHANGED
|
@@ -9510,6 +9510,7 @@ var init_handler = __esm({
|
|
|
9510
9510
|
init_stream_commands();
|
|
9511
9511
|
init_workspace_commands();
|
|
9512
9512
|
COMMAND_DEBUG_LEVELS = /* @__PURE__ */ new Set([
|
|
9513
|
+
"read_chat",
|
|
9513
9514
|
"pty_input",
|
|
9514
9515
|
"pty_resize",
|
|
9515
9516
|
"cdp_eval",
|
|
@@ -13622,8 +13623,10 @@ var init_provider_cli_adapter = __esm({
|
|
|
13622
13623
|
if (buttonIndex in this.approvalKeys) {
|
|
13623
13624
|
this.ptyProcess.write(this.approvalKeys[buttonIndex]);
|
|
13624
13625
|
} else {
|
|
13626
|
+
const buttonCount = Array.isArray(modal?.buttons) ? modal.buttons.length : 0;
|
|
13627
|
+
const clampedIndex = buttonCount > 0 ? Math.min(Math.max(0, buttonIndex), buttonCount - 1) : Math.max(0, buttonIndex);
|
|
13625
13628
|
const DOWN = "\x1B[B";
|
|
13626
|
-
const keys = DOWN.repeat(
|
|
13629
|
+
const keys = DOWN.repeat(clampedIndex) + "\r";
|
|
13627
13630
|
this.ptyProcess.write(keys);
|
|
13628
13631
|
}
|
|
13629
13632
|
}
|
|
@@ -37529,6 +37532,9 @@ var init_router = __esm({
|
|
|
37529
37532
|
if (logs.length > 0) {
|
|
37530
37533
|
return { success: true, logs, totalBuffered: logs.length };
|
|
37531
37534
|
}
|
|
37535
|
+
if (sinceTs > 0) {
|
|
37536
|
+
return { success: true, logs: [], totalBuffered: 0 };
|
|
37537
|
+
}
|
|
37532
37538
|
if (fs9.existsSync(LOG_PATH)) {
|
|
37533
37539
|
const content = fs9.readFileSync(LOG_PATH, "utf-8");
|
|
37534
37540
|
const allLines = content.split("\n");
|
|
@@ -45414,8 +45420,8 @@ var init_session_host_transport = __esm({
|
|
|
45414
45420
|
}
|
|
45415
45421
|
try {
|
|
45416
45422
|
await this.client.close();
|
|
45417
|
-
} catch {
|
|
45418
|
-
if (destroy) throw new Error(`Failed to close session host client: ${this.options.runtimeId}`);
|
|
45423
|
+
} catch (err) {
|
|
45424
|
+
if (destroy) throw err instanceof Error ? err : new Error(`Failed to close session host client: ${this.options.runtimeId}`);
|
|
45419
45425
|
}
|
|
45420
45426
|
}
|
|
45421
45427
|
};
|
|
@@ -46971,7 +46977,7 @@ var init_screenshot_sender = __esm({
|
|
|
46971
46977
|
});
|
|
46972
46978
|
let sentAny = false;
|
|
46973
46979
|
for (const peer of peers.values()) {
|
|
46974
|
-
if (peer.state !== "connected" || !peer.dataChannel) continue;
|
|
46980
|
+
if (peer.state !== "connected" || !peer.dataChannel?.isOpen()) continue;
|
|
46975
46981
|
try {
|
|
46976
46982
|
peer.dataChannel.sendMessage(payload);
|
|
46977
46983
|
sentAny = true;
|
|
@@ -46988,7 +46994,7 @@ var init_screenshot_sender = __esm({
|
|
|
46988
46994
|
});
|
|
46989
46995
|
let sentAny = false;
|
|
46990
46996
|
for (const peer of peers.values()) {
|
|
46991
|
-
if (peer.state !== "connected" || !peer.dataChannel) continue;
|
|
46997
|
+
if (peer.state !== "connected" || !peer.dataChannel?.isOpen()) continue;
|
|
46992
46998
|
try {
|
|
46993
46999
|
peer.dataChannel.sendMessage(payload);
|
|
46994
47000
|
sentAny = true;
|
|
@@ -46998,7 +47004,7 @@ var init_screenshot_sender = __esm({
|
|
|
46998
47004
|
return sentAny;
|
|
46999
47005
|
}
|
|
47000
47006
|
sendTopicUpdateToPeer(peer, update) {
|
|
47001
|
-
if (!peer?.dataChannel || peer.state !== "connected") return false;
|
|
47007
|
+
if (!peer?.dataChannel || peer.state !== "connected" || !peer.dataChannel.isOpen()) return false;
|
|
47002
47008
|
try {
|
|
47003
47009
|
peer.dataChannel.sendMessage(JSON.stringify({
|
|
47004
47010
|
type: "topic_update",
|
|
@@ -47014,7 +47020,7 @@ var init_screenshot_sender = __esm({
|
|
|
47014
47020
|
const msg = JSON.stringify({ type: "session_output", sessionId, data });
|
|
47015
47021
|
let sentAny = false;
|
|
47016
47022
|
for (const peer of peers.values()) {
|
|
47017
|
-
if (peer.state !== "connected" || !peer.dataChannel) continue;
|
|
47023
|
+
if (peer.state !== "connected" || !peer.dataChannel?.isOpen()) continue;
|
|
47018
47024
|
try {
|
|
47019
47025
|
peer.dataChannel.sendMessage(msg);
|
|
47020
47026
|
sentAny = true;
|
|
@@ -47540,7 +47546,7 @@ ${e?.stack || ""}`);
|
|
|
47540
47546
|
}
|
|
47541
47547
|
get isConnected() {
|
|
47542
47548
|
for (const peer of this.peers.values()) {
|
|
47543
|
-
if (peer.state === "connected" && peer.dataChannel) return true;
|
|
47549
|
+
if (peer.state === "connected" && peer.dataChannel?.isOpen()) return true;
|
|
47544
47550
|
}
|
|
47545
47551
|
return false;
|
|
47546
47552
|
}
|
|
@@ -47718,7 +47724,22 @@ ${e?.stack || ""}`);
|
|
|
47718
47724
|
if (!update) return;
|
|
47719
47725
|
this.screenshotSender.sendTopicUpdateToPeer(peer, update);
|
|
47720
47726
|
} catch (error48) {
|
|
47721
|
-
log(`chat_tail flush
|
|
47727
|
+
log(`chat_tail flush error: peer=${peer.peerId} session=${subscription.params.targetSessionId} error=${error48?.message || error48}`);
|
|
47728
|
+
const errorUpdate = {
|
|
47729
|
+
topic: "session.chat_tail",
|
|
47730
|
+
key: subscription.key,
|
|
47731
|
+
sessionId: subscription.params.targetSessionId,
|
|
47732
|
+
seq: subscription.seq,
|
|
47733
|
+
timestamp: Date.now(),
|
|
47734
|
+
syncMode: "noop",
|
|
47735
|
+
messages: [],
|
|
47736
|
+
status: "",
|
|
47737
|
+
replaceFrom: 0,
|
|
47738
|
+
totalMessages: 0,
|
|
47739
|
+
lastMessageSignature: "",
|
|
47740
|
+
error: error48?.message || "chat_tail build failed"
|
|
47741
|
+
};
|
|
47742
|
+
this.screenshotSender.sendTopicUpdateToPeer(peer, errorUpdate);
|
|
47722
47743
|
}
|
|
47723
47744
|
}, { concurrency: 4 });
|
|
47724
47745
|
}
|
|
@@ -55717,7 +55738,7 @@ var init_adhdev_daemon = __esm({
|
|
|
55717
55738
|
init_version();
|
|
55718
55739
|
init_src();
|
|
55719
55740
|
init_runtime_defaults();
|
|
55720
|
-
pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.
|
|
55741
|
+
pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.25" });
|
|
55721
55742
|
AdhdevDaemon = class _AdhdevDaemon {
|
|
55722
55743
|
localHttpServer = null;
|
|
55723
55744
|
localWss = null;
|
|
@@ -55731,6 +55752,8 @@ var init_adhdev_daemon = __esm({
|
|
|
55731
55752
|
pendingP2PChatFlush = false;
|
|
55732
55753
|
pendingP2PChatFlushOnlyActive = true;
|
|
55733
55754
|
hotP2PChatSessionIds = /* @__PURE__ */ new Set();
|
|
55755
|
+
hotChatSnapshotCache = null;
|
|
55756
|
+
static HOT_CHAT_SNAPSHOT_CACHE_TTL_MS = 1500;
|
|
55734
55757
|
components = null;
|
|
55735
55758
|
sessionHostEndpoint = null;
|
|
55736
55759
|
sessionHostController = null;
|
|
@@ -55912,8 +55935,17 @@ var init_adhdev_daemon = __esm({
|
|
|
55912
55935
|
profile: "live"
|
|
55913
55936
|
});
|
|
55914
55937
|
}
|
|
55938
|
+
invalidateHotChatSnapshotCache() {
|
|
55939
|
+
this.hotChatSnapshotCache = null;
|
|
55940
|
+
}
|
|
55915
55941
|
getHotChatSessionIdsForP2PFlush() {
|
|
55916
|
-
const
|
|
55942
|
+
const now = Date.now();
|
|
55943
|
+
const cached2 = this.hotChatSnapshotCache;
|
|
55944
|
+
const sessions = cached2 && now - cached2.builtAt < _AdhdevDaemon.HOT_CHAT_SNAPSHOT_CACHE_TTL_MS ? cached2.sessions : (() => {
|
|
55945
|
+
const built = this.buildLiveStatusSnapshot().sessions || [];
|
|
55946
|
+
this.hotChatSnapshotCache = { sessions: built, builtAt: now };
|
|
55947
|
+
return built;
|
|
55948
|
+
})();
|
|
55917
55949
|
const hotSessions = classifyHotChatSessionsForSubscriptionFlush(
|
|
55918
55950
|
sessions,
|
|
55919
55951
|
this.hotP2PChatSessionIds
|
|
@@ -56145,6 +56177,7 @@ ${err?.stack || ""}`);
|
|
|
56145
56177
|
}
|
|
56146
56178
|
}),
|
|
56147
56179
|
onStatusChange: () => {
|
|
56180
|
+
this.invalidateHotChatSnapshotCache();
|
|
56148
56181
|
this.statusReporter?.onStatusChange();
|
|
56149
56182
|
void this.flushP2PChatSubscriptions({ onlyActive: true });
|
|
56150
56183
|
},
|
|
@@ -56174,6 +56207,7 @@ ${err?.stack || ""}`);
|
|
|
56174
56207
|
statusInstanceId: instanceId,
|
|
56175
56208
|
statusVersion: pkgVersion,
|
|
56176
56209
|
onStatusChange: () => {
|
|
56210
|
+
this.invalidateHotChatSnapshotCache();
|
|
56177
56211
|
this.statusReporter?.onStatusChange();
|
|
56178
56212
|
void this.flushP2PChatSubscriptions({ onlyActive: true });
|
|
56179
56213
|
},
|