adhdev 0.9.9 → 0.9.11
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 +63 -13
- package/dist/cli/index.js.map +1 -1
- package/dist/index.js +63 -13
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -8045,7 +8045,7 @@ function didProviderConfirmSend(result) {
|
|
|
8045
8045
|
}
|
|
8046
8046
|
async function readExtensionChatState(h) {
|
|
8047
8047
|
try {
|
|
8048
|
-
const evalResult = await h.evaluateProviderScript("readChat", void 0,
|
|
8048
|
+
const evalResult = await h.evaluateProviderScript("readChat", void 0, READ_CHAT_PROVIDER_EVAL_TIMEOUT_MS);
|
|
8049
8049
|
if (!evalResult?.result) return null;
|
|
8050
8050
|
const parsed = parseMaybeJson(evalResult.result);
|
|
8051
8051
|
return parsed && typeof parsed === "object" ? parsed : null;
|
|
@@ -8133,7 +8133,7 @@ async function handleReadChat(h, args) {
|
|
|
8133
8133
|
const title = typeof parsedRecord?.title === "string" ? parsedRecord.title : void 0;
|
|
8134
8134
|
const providerSessionId = typeof parsedRecord?.providerSessionId === "string" ? parsedRecord.providerSessionId : void 0;
|
|
8135
8135
|
if (status) {
|
|
8136
|
-
LOG.
|
|
8136
|
+
LOG.debug("Command", `[read_chat] cli-like resolved provider=${adapter.cliType} target=${String(args?.targetSessionId || "")} adapterStatus=${String(adapterStatus.status || "")} parsedStatus=${String(parsedRecord?.status || "")} shouldPreferAdapterMessages=${String(shouldPreferAdapterMessages)} adapterMsgCount=${Array.isArray(adapterStatus.messages) ? adapterStatus.messages.length : 0} parsedMsgCount=${Array.isArray(parsedRecord?.messages) ? parsedRecord.messages.length : 0} returnedMsgCount=${Array.isArray(status.messages) ? status.messages.length : 0}`);
|
|
8137
8137
|
return buildReadChatCommandResult({
|
|
8138
8138
|
messages: status.messages || [],
|
|
8139
8139
|
status: status.status,
|
|
@@ -8158,7 +8158,7 @@ async function handleReadChat(h, args) {
|
|
|
8158
8158
|
}
|
|
8159
8159
|
if (isExtensionTransport(transport)) {
|
|
8160
8160
|
try {
|
|
8161
|
-
const evalResult = await h.evaluateProviderScript("readChat", void 0,
|
|
8161
|
+
const evalResult = await h.evaluateProviderScript("readChat", void 0, READ_CHAT_PROVIDER_EVAL_TIMEOUT_MS);
|
|
8162
8162
|
if (evalResult?.result) {
|
|
8163
8163
|
let parsed = evalResult.result;
|
|
8164
8164
|
if (typeof parsed === "string") {
|
|
@@ -8262,7 +8262,7 @@ async function handleReadChat(h, args) {
|
|
|
8262
8262
|
const script = h.getProviderScript("readChat") || h.getProviderScript("read_chat");
|
|
8263
8263
|
if (script) {
|
|
8264
8264
|
try {
|
|
8265
|
-
const evalResult = await h.evaluateProviderScript("readChat", void 0,
|
|
8265
|
+
const evalResult = await h.evaluateProviderScript("readChat", void 0, READ_CHAT_PROVIDER_EVAL_TIMEOUT_MS);
|
|
8266
8266
|
if (evalResult?.result) {
|
|
8267
8267
|
let parsed = evalResult.result;
|
|
8268
8268
|
if (typeof parsed === "string") {
|
|
@@ -8966,7 +8966,7 @@ async function handleResolveAction(h, args) {
|
|
|
8966
8966
|
}
|
|
8967
8967
|
return { success: false, error: "resolveAction script not available for this provider" };
|
|
8968
8968
|
}
|
|
8969
|
-
var RECENT_SEND_WINDOW_MS, recentSendByTarget;
|
|
8969
|
+
var RECENT_SEND_WINDOW_MS, READ_CHAT_PROVIDER_EVAL_TIMEOUT_MS, recentSendByTarget;
|
|
8970
8970
|
var init_chat_commands = __esm({
|
|
8971
8971
|
"../../oss/packages/daemon-core/src/commands/chat-commands.ts"() {
|
|
8972
8972
|
"use strict";
|
|
@@ -8979,6 +8979,7 @@ var init_chat_commands = __esm({
|
|
|
8979
8979
|
init_chat_signatures();
|
|
8980
8980
|
init_chat_message_normalization();
|
|
8981
8981
|
RECENT_SEND_WINDOW_MS = 1200;
|
|
8982
|
+
READ_CHAT_PROVIDER_EVAL_TIMEOUT_MS = 25e3;
|
|
8982
8983
|
recentSendByTarget = /* @__PURE__ */ new Map();
|
|
8983
8984
|
}
|
|
8984
8985
|
});
|
|
@@ -12783,7 +12784,7 @@ var init_provider_cli_adapter = __esm({
|
|
|
12783
12784
|
sendDelayMs;
|
|
12784
12785
|
sendKey;
|
|
12785
12786
|
submitStrategy;
|
|
12786
|
-
static SCRIPT_STATUS_DEBOUNCE_MS =
|
|
12787
|
+
static SCRIPT_STATUS_DEBOUNCE_MS = 3e3;
|
|
12787
12788
|
/** Inject CLI scripts after construction (e.g. when resolved by ProviderLoader) */
|
|
12788
12789
|
setCliScripts(scripts) {
|
|
12789
12790
|
this.cliScripts = scripts;
|
|
@@ -14947,7 +14948,7 @@ var init_cli_provider_instance = __esm({
|
|
|
14947
14948
|
this.generatingDebouncePending = null;
|
|
14948
14949
|
}
|
|
14949
14950
|
this.generatingDebounceTimer = null;
|
|
14950
|
-
},
|
|
14951
|
+
}, 3e3);
|
|
14951
14952
|
} else if (newStatus === "waiting_approval") {
|
|
14952
14953
|
this.suppressIdleHistoryReplay = false;
|
|
14953
14954
|
if (this.generatingDebouncePending) {
|
|
@@ -15003,7 +15004,7 @@ var init_cli_provider_instance = __esm({
|
|
|
15003
15004
|
this.generatingStartedAt = 0;
|
|
15004
15005
|
}
|
|
15005
15006
|
this.completedDebounceTimer = null;
|
|
15006
|
-
},
|
|
15007
|
+
}, 3e3);
|
|
15007
15008
|
}
|
|
15008
15009
|
} else if (newStatus === "stopped") {
|
|
15009
15010
|
if (this.generatingDebounceTimer) {
|
|
@@ -78281,6 +78282,7 @@ var init_server_connection = __esm({
|
|
|
78281
78282
|
reconnectTimer = null;
|
|
78282
78283
|
pingTimer = null;
|
|
78283
78284
|
pongTimeout = null;
|
|
78285
|
+
authTimeout = null;
|
|
78284
78286
|
missedPongCount = 0;
|
|
78285
78287
|
messageHandlers = /* @__PURE__ */ new Map();
|
|
78286
78288
|
stateChangeCallbacks = [];
|
|
@@ -78290,6 +78292,9 @@ var init_server_connection = __esm({
|
|
|
78290
78292
|
iceServers = null;
|
|
78291
78293
|
planLimits = null;
|
|
78292
78294
|
compatBlocked = false;
|
|
78295
|
+
get authTimeoutMs() {
|
|
78296
|
+
return Math.max(1, this.options.authTimeoutMs ?? 15e3);
|
|
78297
|
+
}
|
|
78293
78298
|
constructor(options) {
|
|
78294
78299
|
this.options = options;
|
|
78295
78300
|
}
|
|
@@ -78392,6 +78397,7 @@ var init_server_connection = __esm({
|
|
|
78392
78397
|
},
|
|
78393
78398
|
timestamp: Date.now()
|
|
78394
78399
|
});
|
|
78400
|
+
this.startAuthTimeout();
|
|
78395
78401
|
}
|
|
78396
78402
|
onMessage(text) {
|
|
78397
78403
|
try {
|
|
@@ -78399,6 +78405,7 @@ var init_server_connection = __esm({
|
|
|
78399
78405
|
this.missedPongCount = 0;
|
|
78400
78406
|
const message = JSON.parse(text);
|
|
78401
78407
|
if (message.type === "auth_ok") {
|
|
78408
|
+
this.clearAuthTimeout();
|
|
78402
78409
|
this.reconnectAttempts = 0;
|
|
78403
78410
|
this.compatBlocked = false;
|
|
78404
78411
|
const payload = message.payload;
|
|
@@ -78413,6 +78420,7 @@ var init_server_connection = __esm({
|
|
|
78413
78420
|
LOG.info("Server", `[ServerConn] \u2713 Authenticated (plan: ${this.userPlan})`);
|
|
78414
78421
|
this.startHeartbeat();
|
|
78415
78422
|
} else if (message.type === "auth_error") {
|
|
78423
|
+
this.clearAuthTimeout();
|
|
78416
78424
|
LOG.error("Server", `Auth failed: ${message.payload.reason}`);
|
|
78417
78425
|
this.setState("error");
|
|
78418
78426
|
return;
|
|
@@ -78507,9 +78515,25 @@ var init_server_connection = __esm({
|
|
|
78507
78515
|
clearTimeout(this.reconnectTimer);
|
|
78508
78516
|
this.reconnectTimer = null;
|
|
78509
78517
|
}
|
|
78518
|
+
this.clearAuthTimeout();
|
|
78510
78519
|
this.stopHeartbeat();
|
|
78511
78520
|
this.missedPongCount = 0;
|
|
78512
78521
|
}
|
|
78522
|
+
startAuthTimeout() {
|
|
78523
|
+
this.clearAuthTimeout();
|
|
78524
|
+
this.authTimeout = setTimeout(() => {
|
|
78525
|
+
this.authTimeout = null;
|
|
78526
|
+
if (this.state !== "authenticating" || !this.ws) return;
|
|
78527
|
+
LOG.warn("Server", `[ServerConn] Auth timeout after ${(this.authTimeoutMs / 1e3).toFixed(1)}s \u2014 reconnecting`);
|
|
78528
|
+
this.ws.terminate();
|
|
78529
|
+
}, this.authTimeoutMs);
|
|
78530
|
+
}
|
|
78531
|
+
clearAuthTimeout() {
|
|
78532
|
+
if (this.authTimeout) {
|
|
78533
|
+
clearTimeout(this.authTimeout);
|
|
78534
|
+
this.authTimeout = null;
|
|
78535
|
+
}
|
|
78536
|
+
}
|
|
78513
78537
|
// ─── WS Heartbeat (ping/pong) ─────────────────────
|
|
78514
78538
|
startHeartbeat() {
|
|
78515
78539
|
this.stopHeartbeat();
|
|
@@ -87092,7 +87116,7 @@ var init_adhdev_daemon = __esm({
|
|
|
87092
87116
|
init_version();
|
|
87093
87117
|
init_src();
|
|
87094
87118
|
init_runtime_defaults();
|
|
87095
|
-
pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.
|
|
87119
|
+
pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.11" });
|
|
87096
87120
|
AdhdevDaemon = class _AdhdevDaemon {
|
|
87097
87121
|
localHttpServer = null;
|
|
87098
87122
|
localWss = null;
|
|
@@ -87116,6 +87140,7 @@ var init_adhdev_daemon = __esm({
|
|
|
87116
87140
|
mandatoryUpgradeInFlight = false;
|
|
87117
87141
|
debugConfig = resolveDebugRuntimeConfig();
|
|
87118
87142
|
recentInteractionIdsBySession = /* @__PURE__ */ new Map();
|
|
87143
|
+
ptyInputDropLogLastAt = /* @__PURE__ */ new Map();
|
|
87119
87144
|
static MANDATORY_UPDATE_BLOCKED_COMMANDS = /* @__PURE__ */ new Set([
|
|
87120
87145
|
"launch_ide",
|
|
87121
87146
|
"launch_cli",
|
|
@@ -87167,6 +87192,14 @@ var init_adhdev_daemon = __esm({
|
|
|
87167
87192
|
const mode = this.getCliPresentationMode(sessionId);
|
|
87168
87193
|
return mode === "chat" || mode === "terminal";
|
|
87169
87194
|
}
|
|
87195
|
+
logPtyInputDrop(sessionId, reason) {
|
|
87196
|
+
const key = `${sessionId || "(missing)"}:${reason}`;
|
|
87197
|
+
const now = Date.now();
|
|
87198
|
+
const last = this.ptyInputDropLogLastAt.get(key) || 0;
|
|
87199
|
+
if (now - last < 3e4) return;
|
|
87200
|
+
this.ptyInputDropLogLastAt.set(key, now);
|
|
87201
|
+
LOG.warn("P2P", `PTY input dropped: session=${sessionId || "(missing)"} reason=${reason}`);
|
|
87202
|
+
}
|
|
87170
87203
|
getUpgradePackageName() {
|
|
87171
87204
|
return process.argv[1]?.includes("daemon-standalone") ? "@adhdev/daemon-standalone" : "adhdev";
|
|
87172
87205
|
}
|
|
@@ -87279,9 +87312,13 @@ var init_adhdev_daemon = __esm({
|
|
|
87279
87312
|
});
|
|
87280
87313
|
}
|
|
87281
87314
|
getHotChatSessionIdsForP2PFlush() {
|
|
87282
|
-
const
|
|
87315
|
+
const sessions = buildSessionEntries(
|
|
87316
|
+
this.components.instanceManager.collectAllStates(),
|
|
87317
|
+
this.components.cdpManagers,
|
|
87318
|
+
{ profile: "live" }
|
|
87319
|
+
);
|
|
87283
87320
|
const hotSessions = classifyHotChatSessionsForSubscriptionFlush(
|
|
87284
|
-
|
|
87321
|
+
sessions,
|
|
87285
87322
|
this.hotP2PChatSessionIds
|
|
87286
87323
|
);
|
|
87287
87324
|
this.hotP2PChatSessionIds = hotSessions.active;
|
|
@@ -87606,10 +87643,23 @@ ${err?.stack || ""}`);
|
|
|
87606
87643
|
}
|
|
87607
87644
|
});
|
|
87608
87645
|
this.p2p.onPtyInput((sessionId, data) => {
|
|
87609
|
-
if (!this.isCliSession(sessionId))
|
|
87646
|
+
if (!this.isCliSession(sessionId)) {
|
|
87647
|
+
this.logPtyInputDrop(sessionId, "not_cli_session");
|
|
87648
|
+
return;
|
|
87649
|
+
}
|
|
87610
87650
|
const found = this.components.cliManager.findAdapter(sessionId, { instanceKey: sessionId });
|
|
87611
|
-
if (found
|
|
87651
|
+
if (!found) {
|
|
87652
|
+
this.logPtyInputDrop(sessionId, "adapter_not_found");
|
|
87653
|
+
return;
|
|
87654
|
+
}
|
|
87655
|
+
if (typeof found.adapter.writeRaw !== "function") {
|
|
87656
|
+
this.logPtyInputDrop(sessionId, "writeRaw_missing");
|
|
87657
|
+
return;
|
|
87658
|
+
}
|
|
87659
|
+
try {
|
|
87612
87660
|
found.adapter.writeRaw(data);
|
|
87661
|
+
} catch {
|
|
87662
|
+
this.logPtyInputDrop(sessionId, "write_failed");
|
|
87613
87663
|
}
|
|
87614
87664
|
});
|
|
87615
87665
|
this.p2p.onPtyResize((sessionId, cols, rows) => {
|