adhdev 0.9.9 → 0.9.10

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 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, 5e4);
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.info("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}`);
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, 5e4);
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, 5e4);
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 = 1e3;
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
- }, 1e3);
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
- }, 2e3);
15007
+ }, 3e3);
15007
15008
  }
15008
15009
  } else if (newStatus === "stopped") {
15009
15010
  if (this.generatingDebounceTimer) {
@@ -87092,7 +87093,7 @@ var init_adhdev_daemon = __esm({
87092
87093
  init_version();
87093
87094
  init_src();
87094
87095
  init_runtime_defaults();
87095
- pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.9" });
87096
+ pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.10" });
87096
87097
  AdhdevDaemon = class _AdhdevDaemon {
87097
87098
  localHttpServer = null;
87098
87099
  localWss = null;
@@ -87116,6 +87117,7 @@ var init_adhdev_daemon = __esm({
87116
87117
  mandatoryUpgradeInFlight = false;
87117
87118
  debugConfig = resolveDebugRuntimeConfig();
87118
87119
  recentInteractionIdsBySession = /* @__PURE__ */ new Map();
87120
+ ptyInputDropLogLastAt = /* @__PURE__ */ new Map();
87119
87121
  static MANDATORY_UPDATE_BLOCKED_COMMANDS = /* @__PURE__ */ new Set([
87120
87122
  "launch_ide",
87121
87123
  "launch_cli",
@@ -87167,6 +87169,14 @@ var init_adhdev_daemon = __esm({
87167
87169
  const mode = this.getCliPresentationMode(sessionId);
87168
87170
  return mode === "chat" || mode === "terminal";
87169
87171
  }
87172
+ logPtyInputDrop(sessionId, reason) {
87173
+ const key = `${sessionId || "(missing)"}:${reason}`;
87174
+ const now = Date.now();
87175
+ const last = this.ptyInputDropLogLastAt.get(key) || 0;
87176
+ if (now - last < 3e4) return;
87177
+ this.ptyInputDropLogLastAt.set(key, now);
87178
+ LOG.warn("P2P", `PTY input dropped: session=${sessionId || "(missing)"} reason=${reason}`);
87179
+ }
87170
87180
  getUpgradePackageName() {
87171
87181
  return process.argv[1]?.includes("daemon-standalone") ? "@adhdev/daemon-standalone" : "adhdev";
87172
87182
  }
@@ -87279,9 +87289,13 @@ var init_adhdev_daemon = __esm({
87279
87289
  });
87280
87290
  }
87281
87291
  getHotChatSessionIdsForP2PFlush() {
87282
- const snapshot = this.buildLiveStatusSnapshot();
87292
+ const sessions = buildSessionEntries(
87293
+ this.components.instanceManager.collectAllStates(),
87294
+ this.components.cdpManagers,
87295
+ { profile: "live" }
87296
+ );
87283
87297
  const hotSessions = classifyHotChatSessionsForSubscriptionFlush(
87284
- snapshot.sessions,
87298
+ sessions,
87285
87299
  this.hotP2PChatSessionIds
87286
87300
  );
87287
87301
  this.hotP2PChatSessionIds = hotSessions.active;
@@ -87606,10 +87620,23 @@ ${err?.stack || ""}`);
87606
87620
  }
87607
87621
  });
87608
87622
  this.p2p.onPtyInput((sessionId, data) => {
87609
- if (!this.isCliSession(sessionId)) return;
87623
+ if (!this.isCliSession(sessionId)) {
87624
+ this.logPtyInputDrop(sessionId, "not_cli_session");
87625
+ return;
87626
+ }
87610
87627
  const found = this.components.cliManager.findAdapter(sessionId, { instanceKey: sessionId });
87611
- if (found && typeof found.adapter.writeRaw === "function") {
87628
+ if (!found) {
87629
+ this.logPtyInputDrop(sessionId, "adapter_not_found");
87630
+ return;
87631
+ }
87632
+ if (typeof found.adapter.writeRaw !== "function") {
87633
+ this.logPtyInputDrop(sessionId, "writeRaw_missing");
87634
+ return;
87635
+ }
87636
+ try {
87612
87637
  found.adapter.writeRaw(data);
87638
+ } catch {
87639
+ this.logPtyInputDrop(sessionId, "write_failed");
87613
87640
  }
87614
87641
  });
87615
87642
  this.p2p.onPtyResize((sessionId, cols, rows) => {