adhdev 0.9.23 → 0.9.24
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 +41 -11
- package/dist/cli/index.js.map +1 -1
- package/dist/index.js +41 -11
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -13622,8 +13622,10 @@ var init_provider_cli_adapter = __esm({
|
|
|
13622
13622
|
if (buttonIndex in this.approvalKeys) {
|
|
13623
13623
|
this.ptyProcess.write(this.approvalKeys[buttonIndex]);
|
|
13624
13624
|
} else {
|
|
13625
|
+
const buttonCount = Array.isArray(modal?.buttons) ? modal.buttons.length : 0;
|
|
13626
|
+
const clampedIndex = buttonCount > 0 ? Math.min(Math.max(0, buttonIndex), buttonCount - 1) : Math.max(0, buttonIndex);
|
|
13625
13627
|
const DOWN = "\x1B[B";
|
|
13626
|
-
const keys = DOWN.repeat(
|
|
13628
|
+
const keys = DOWN.repeat(clampedIndex) + "\r";
|
|
13627
13629
|
this.ptyProcess.write(keys);
|
|
13628
13630
|
}
|
|
13629
13631
|
}
|
|
@@ -45414,8 +45416,8 @@ var init_session_host_transport = __esm({
|
|
|
45414
45416
|
}
|
|
45415
45417
|
try {
|
|
45416
45418
|
await this.client.close();
|
|
45417
|
-
} catch {
|
|
45418
|
-
if (destroy) throw new Error(`Failed to close session host client: ${this.options.runtimeId}`);
|
|
45419
|
+
} catch (err) {
|
|
45420
|
+
if (destroy) throw err instanceof Error ? err : new Error(`Failed to close session host client: ${this.options.runtimeId}`);
|
|
45419
45421
|
}
|
|
45420
45422
|
}
|
|
45421
45423
|
};
|
|
@@ -46971,7 +46973,7 @@ var init_screenshot_sender = __esm({
|
|
|
46971
46973
|
});
|
|
46972
46974
|
let sentAny = false;
|
|
46973
46975
|
for (const peer of peers.values()) {
|
|
46974
|
-
if (peer.state !== "connected" || !peer.dataChannel) continue;
|
|
46976
|
+
if (peer.state !== "connected" || !peer.dataChannel?.isOpen()) continue;
|
|
46975
46977
|
try {
|
|
46976
46978
|
peer.dataChannel.sendMessage(payload);
|
|
46977
46979
|
sentAny = true;
|
|
@@ -46988,7 +46990,7 @@ var init_screenshot_sender = __esm({
|
|
|
46988
46990
|
});
|
|
46989
46991
|
let sentAny = false;
|
|
46990
46992
|
for (const peer of peers.values()) {
|
|
46991
|
-
if (peer.state !== "connected" || !peer.dataChannel) continue;
|
|
46993
|
+
if (peer.state !== "connected" || !peer.dataChannel?.isOpen()) continue;
|
|
46992
46994
|
try {
|
|
46993
46995
|
peer.dataChannel.sendMessage(payload);
|
|
46994
46996
|
sentAny = true;
|
|
@@ -46998,7 +47000,7 @@ var init_screenshot_sender = __esm({
|
|
|
46998
47000
|
return sentAny;
|
|
46999
47001
|
}
|
|
47000
47002
|
sendTopicUpdateToPeer(peer, update) {
|
|
47001
|
-
if (!peer?.dataChannel || peer.state !== "connected") return false;
|
|
47003
|
+
if (!peer?.dataChannel || peer.state !== "connected" || !peer.dataChannel.isOpen()) return false;
|
|
47002
47004
|
try {
|
|
47003
47005
|
peer.dataChannel.sendMessage(JSON.stringify({
|
|
47004
47006
|
type: "topic_update",
|
|
@@ -47014,7 +47016,7 @@ var init_screenshot_sender = __esm({
|
|
|
47014
47016
|
const msg = JSON.stringify({ type: "session_output", sessionId, data });
|
|
47015
47017
|
let sentAny = false;
|
|
47016
47018
|
for (const peer of peers.values()) {
|
|
47017
|
-
if (peer.state !== "connected" || !peer.dataChannel) continue;
|
|
47019
|
+
if (peer.state !== "connected" || !peer.dataChannel?.isOpen()) continue;
|
|
47018
47020
|
try {
|
|
47019
47021
|
peer.dataChannel.sendMessage(msg);
|
|
47020
47022
|
sentAny = true;
|
|
@@ -47540,7 +47542,7 @@ ${e?.stack || ""}`);
|
|
|
47540
47542
|
}
|
|
47541
47543
|
get isConnected() {
|
|
47542
47544
|
for (const peer of this.peers.values()) {
|
|
47543
|
-
if (peer.state === "connected" && peer.dataChannel) return true;
|
|
47545
|
+
if (peer.state === "connected" && peer.dataChannel?.isOpen()) return true;
|
|
47544
47546
|
}
|
|
47545
47547
|
return false;
|
|
47546
47548
|
}
|
|
@@ -47718,7 +47720,22 @@ ${e?.stack || ""}`);
|
|
|
47718
47720
|
if (!update) return;
|
|
47719
47721
|
this.screenshotSender.sendTopicUpdateToPeer(peer, update);
|
|
47720
47722
|
} catch (error48) {
|
|
47721
|
-
log(`chat_tail flush
|
|
47723
|
+
log(`chat_tail flush error: peer=${peer.peerId} session=${subscription.params.targetSessionId} error=${error48?.message || error48}`);
|
|
47724
|
+
const errorUpdate = {
|
|
47725
|
+
topic: "session.chat_tail",
|
|
47726
|
+
key: subscription.key,
|
|
47727
|
+
sessionId: subscription.params.targetSessionId,
|
|
47728
|
+
seq: subscription.seq,
|
|
47729
|
+
timestamp: Date.now(),
|
|
47730
|
+
syncMode: "noop",
|
|
47731
|
+
messages: [],
|
|
47732
|
+
status: "",
|
|
47733
|
+
replaceFrom: 0,
|
|
47734
|
+
totalMessages: 0,
|
|
47735
|
+
lastMessageSignature: "",
|
|
47736
|
+
error: error48?.message || "chat_tail build failed"
|
|
47737
|
+
};
|
|
47738
|
+
this.screenshotSender.sendTopicUpdateToPeer(peer, errorUpdate);
|
|
47722
47739
|
}
|
|
47723
47740
|
}, { concurrency: 4 });
|
|
47724
47741
|
}
|
|
@@ -55717,7 +55734,7 @@ var init_adhdev_daemon = __esm({
|
|
|
55717
55734
|
init_version();
|
|
55718
55735
|
init_src();
|
|
55719
55736
|
init_runtime_defaults();
|
|
55720
|
-
pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.
|
|
55737
|
+
pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.24" });
|
|
55721
55738
|
AdhdevDaemon = class _AdhdevDaemon {
|
|
55722
55739
|
localHttpServer = null;
|
|
55723
55740
|
localWss = null;
|
|
@@ -55731,6 +55748,8 @@ var init_adhdev_daemon = __esm({
|
|
|
55731
55748
|
pendingP2PChatFlush = false;
|
|
55732
55749
|
pendingP2PChatFlushOnlyActive = true;
|
|
55733
55750
|
hotP2PChatSessionIds = /* @__PURE__ */ new Set();
|
|
55751
|
+
hotChatSnapshotCache = null;
|
|
55752
|
+
static HOT_CHAT_SNAPSHOT_CACHE_TTL_MS = 1500;
|
|
55734
55753
|
components = null;
|
|
55735
55754
|
sessionHostEndpoint = null;
|
|
55736
55755
|
sessionHostController = null;
|
|
@@ -55912,8 +55931,17 @@ var init_adhdev_daemon = __esm({
|
|
|
55912
55931
|
profile: "live"
|
|
55913
55932
|
});
|
|
55914
55933
|
}
|
|
55934
|
+
invalidateHotChatSnapshotCache() {
|
|
55935
|
+
this.hotChatSnapshotCache = null;
|
|
55936
|
+
}
|
|
55915
55937
|
getHotChatSessionIdsForP2PFlush() {
|
|
55916
|
-
const
|
|
55938
|
+
const now = Date.now();
|
|
55939
|
+
const cached2 = this.hotChatSnapshotCache;
|
|
55940
|
+
const sessions = cached2 && now - cached2.builtAt < _AdhdevDaemon.HOT_CHAT_SNAPSHOT_CACHE_TTL_MS ? cached2.sessions : (() => {
|
|
55941
|
+
const built = this.buildLiveStatusSnapshot().sessions || [];
|
|
55942
|
+
this.hotChatSnapshotCache = { sessions: built, builtAt: now };
|
|
55943
|
+
return built;
|
|
55944
|
+
})();
|
|
55917
55945
|
const hotSessions = classifyHotChatSessionsForSubscriptionFlush(
|
|
55918
55946
|
sessions,
|
|
55919
55947
|
this.hotP2PChatSessionIds
|
|
@@ -56145,6 +56173,7 @@ ${err?.stack || ""}`);
|
|
|
56145
56173
|
}
|
|
56146
56174
|
}),
|
|
56147
56175
|
onStatusChange: () => {
|
|
56176
|
+
this.invalidateHotChatSnapshotCache();
|
|
56148
56177
|
this.statusReporter?.onStatusChange();
|
|
56149
56178
|
void this.flushP2PChatSubscriptions({ onlyActive: true });
|
|
56150
56179
|
},
|
|
@@ -56174,6 +56203,7 @@ ${err?.stack || ""}`);
|
|
|
56174
56203
|
statusInstanceId: instanceId,
|
|
56175
56204
|
statusVersion: pkgVersion,
|
|
56176
56205
|
onStatusChange: () => {
|
|
56206
|
+
this.invalidateHotChatSnapshotCache();
|
|
56177
56207
|
this.statusReporter?.onStatusChange();
|
|
56178
56208
|
void this.flushP2PChatSubscriptions({ onlyActive: true });
|
|
56179
56209
|
},
|