@adhdev/daemon-standalone 0.9.29 → 0.9.31

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/index.js CHANGED
@@ -38483,6 +38483,7 @@ ${effect.notification.body || ""}`.trim();
38483
38483
  return { success: false, error: `${transport} adapter not found` };
38484
38484
  }
38485
38485
  if (isExtensionTransport(transport)) {
38486
+ let extensionReadChatError = "";
38486
38487
  try {
38487
38488
  const evalResult = await h.evaluateProviderScript("readChat", void 0, READ_CHAT_PROVIDER_EVAL_TIMEOUT_MS);
38488
38489
  if (evalResult?.result) {
@@ -38490,7 +38491,8 @@ ${effect.notification.body || ""}`.trim();
38490
38491
  if (typeof parsed === "string") {
38491
38492
  try {
38492
38493
  parsed = JSON.parse(parsed);
38493
- } catch {
38494
+ } catch (e) {
38495
+ extensionReadChatError = `extension read_chat parse failed: ${e?.message || String(e)}`;
38494
38496
  }
38495
38497
  }
38496
38498
  if (parsed && typeof parsed === "object") {
@@ -38515,8 +38517,14 @@ ${effect.notification.body || ""}`.trim();
38515
38517
  );
38516
38518
  return buildReadChatCommandResult(validated, args);
38517
38519
  }
38520
+ if (!extensionReadChatError) {
38521
+ extensionReadChatError = "extension read_chat returned a non-object payload";
38522
+ }
38523
+ } else {
38524
+ extensionReadChatError = "extension read_chat returned no payload";
38518
38525
  }
38519
38526
  } catch (e) {
38527
+ extensionReadChatError = `extension read_chat failed: ${e?.message || String(e)}`;
38520
38528
  _log(`Extension error: ${e.message}`);
38521
38529
  traceProviderEvent(args, "provider", "extension.read_chat.error", {
38522
38530
  h,
@@ -38530,8 +38538,8 @@ ${effect.notification.body || ""}`.trim();
38530
38538
  const parentSessionId = h.currentSession?.parentSessionId;
38531
38539
  if (cdp2 && parentSessionId) {
38532
38540
  const stream = await h.agentStream.collectActiveSession(cdp2, parentSessionId);
38533
- if (stream?.agentType !== provider?.type) {
38534
- return buildReadChatCommandResult({ messages: [], status: "idle" }, args);
38541
+ if (stream && stream.agentType !== provider?.type) {
38542
+ return { success: false, error: `extension read_chat stream agent mismatch for ${provider?.type || "unknown_extension"}` };
38535
38543
  }
38536
38544
  if (stream) {
38537
38545
  h.historyWriter.appendNewMessages(
@@ -38549,12 +38557,13 @@ ${effect.notification.body || ""}`.trim();
38549
38557
  }
38550
38558
  }
38551
38559
  }
38552
- return buildReadChatCommandResult({ messages: [], status: "idle" }, args);
38560
+ return { success: false, error: extensionReadChatError || "extension read_chat unavailable" };
38553
38561
  }
38554
38562
  const cdp = h.getCdp();
38555
38563
  if (!cdp?.isConnected) return { success: false, error: "CDP not connected" };
38556
38564
  const webviewScript = h.getProviderScript("webviewReadChat") || h.getProviderScript("webview_read_chat");
38557
38565
  if (webviewScript) {
38566
+ let webviewReadChatError = "";
38558
38567
  try {
38559
38568
  const matchText = provider?.webviewMatchText;
38560
38569
  const matchFn = matchText ? (body) => body.includes(matchText) : void 0;
@@ -38564,7 +38573,8 @@ ${effect.notification.body || ""}`.trim();
38564
38573
  if (typeof parsed === "string") {
38565
38574
  try {
38566
38575
  parsed = JSON.parse(parsed);
38567
- } catch {
38576
+ } catch (e) {
38577
+ webviewReadChatError = `webview read_chat parse failed: ${e?.message || String(e)}`;
38568
38578
  }
38569
38579
  }
38570
38580
  if (parsed && typeof parsed === "object") {
@@ -38579,14 +38589,21 @@ ${effect.notification.body || ""}`.trim();
38579
38589
  );
38580
38590
  return buildReadChatCommandResult(validated, args);
38581
38591
  }
38592
+ if (!webviewReadChatError) {
38593
+ webviewReadChatError = "webview read_chat returned a non-object payload";
38594
+ }
38595
+ } else {
38596
+ webviewReadChatError = "webview read_chat returned no payload";
38582
38597
  }
38583
38598
  } catch (e) {
38599
+ webviewReadChatError = `webview read_chat failed: ${e?.message || String(e)}`;
38584
38600
  _log(`Webview readChat error: ${e.message}`);
38585
38601
  }
38586
- return buildReadChatCommandResult({ messages: [], status: "idle" }, args);
38602
+ return { success: false, error: webviewReadChatError || "webview read_chat unavailable" };
38587
38603
  }
38588
38604
  const script = h.getProviderScript("readChat") || h.getProviderScript("read_chat");
38589
38605
  if (script) {
38606
+ let ideReadChatError = "";
38590
38607
  try {
38591
38608
  const evalResult = await h.evaluateProviderScript("readChat", void 0, READ_CHAT_PROVIDER_EVAL_TIMEOUT_MS);
38592
38609
  if (evalResult?.result) {
@@ -38594,12 +38611,13 @@ ${effect.notification.body || ""}`.trim();
38594
38611
  if (typeof parsed === "string") {
38595
38612
  try {
38596
38613
  parsed = JSON.parse(parsed);
38597
- } catch {
38614
+ } catch (e) {
38615
+ ideReadChatError = `ide read_chat parse failed: ${e?.message || String(e)}`;
38598
38616
  }
38599
38617
  }
38600
- if (parsed && typeof parsed === "object" && parsed.messages?.length > 0) {
38618
+ if (parsed && typeof parsed === "object") {
38601
38619
  const validated = validateReadChatResultPayload(parsed, "ide read_chat");
38602
- _log(`OK: ${validated.messages?.length} msgs`);
38620
+ _log(`OK: ${validated.messages?.length || 0} msgs`);
38603
38621
  traceProviderEvent(args, "provider", "ide.read_chat.success", {
38604
38622
  h,
38605
38623
  provider,
@@ -38619,8 +38637,14 @@ ${effect.notification.body || ""}`.trim();
38619
38637
  );
38620
38638
  return buildReadChatCommandResult(validated, args);
38621
38639
  }
38640
+ if (!ideReadChatError) {
38641
+ ideReadChatError = "ide read_chat returned a non-object payload";
38642
+ }
38643
+ } else {
38644
+ ideReadChatError = "ide read_chat returned no payload";
38622
38645
  }
38623
38646
  } catch (e) {
38647
+ ideReadChatError = `ide read_chat failed: ${e?.message || String(e)}`;
38624
38648
  LOG2.info("Command", `[read_chat] Script error: ${e.message}`);
38625
38649
  traceProviderEvent(args, "provider", "ide.read_chat.error", {
38626
38650
  h,
@@ -38629,8 +38653,9 @@ ${effect.notification.body || ""}`.trim();
38629
38653
  payload: { method: "evaluate", error: e.message }
38630
38654
  });
38631
38655
  }
38656
+ return { success: false, error: ideReadChatError || "ide read_chat unavailable" };
38632
38657
  }
38633
- return buildReadChatCommandResult({ messages: [], status: "idle" }, args);
38658
+ return { success: false, error: "read_chat unavailable" };
38634
38659
  }
38635
38660
  async function handleSendChat(h, args) {
38636
38661
  const input = getSendChatInputEnvelope(args);
@@ -45801,7 +45826,11 @@ Run 'adhdev doctor' for detailed diagnostics.`
45801
45826
  icon: provider.icon || "\u{1F4BB}",
45802
45827
  category: provider.category,
45803
45828
  ...provider.installed !== void 0 ? { installed: provider.installed } : {},
45804
- ...provider.detectedPath !== void 0 ? { detectedPath: provider.detectedPath } : {}
45829
+ ...provider.detectedPath !== void 0 ? { detectedPath: provider.detectedPath } : {},
45830
+ ...provider.enabled !== void 0 ? { enabled: provider.enabled } : {},
45831
+ ...provider.machineStatus !== void 0 ? { machineStatus: provider.machineStatus } : {},
45832
+ ...provider.lastDetection !== void 0 ? { lastDetection: provider.lastDetection } : {},
45833
+ ...provider.lastVerification !== void 0 ? { lastVerification: provider.lastVerification } : {}
45805
45834
  }));
45806
45835
  }
45807
45836
  function buildMachineInfo2(profile = "full") {