@adhdev/daemon-core 0.9.30 → 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 +35 -10
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +35 -10
- package/dist/index.mjs.map +1 -1
- package/node_modules/@adhdev/session-host-core/package.json +1 -1
- package/package.json +1 -1
- package/src/commands/chat-commands.ts +57 -17
package/dist/index.mjs
CHANGED
|
@@ -10547,6 +10547,7 @@ async function handleReadChat(h, args) {
|
|
|
10547
10547
|
return { success: false, error: `${transport} adapter not found` };
|
|
10548
10548
|
}
|
|
10549
10549
|
if (isExtensionTransport(transport)) {
|
|
10550
|
+
let extensionReadChatError = "";
|
|
10550
10551
|
try {
|
|
10551
10552
|
const evalResult = await h.evaluateProviderScript("readChat", void 0, READ_CHAT_PROVIDER_EVAL_TIMEOUT_MS);
|
|
10552
10553
|
if (evalResult?.result) {
|
|
@@ -10554,7 +10555,8 @@ async function handleReadChat(h, args) {
|
|
|
10554
10555
|
if (typeof parsed === "string") {
|
|
10555
10556
|
try {
|
|
10556
10557
|
parsed = JSON.parse(parsed);
|
|
10557
|
-
} catch {
|
|
10558
|
+
} catch (e) {
|
|
10559
|
+
extensionReadChatError = `extension read_chat parse failed: ${e?.message || String(e)}`;
|
|
10558
10560
|
}
|
|
10559
10561
|
}
|
|
10560
10562
|
if (parsed && typeof parsed === "object") {
|
|
@@ -10579,8 +10581,14 @@ async function handleReadChat(h, args) {
|
|
|
10579
10581
|
);
|
|
10580
10582
|
return buildReadChatCommandResult(validated, args);
|
|
10581
10583
|
}
|
|
10584
|
+
if (!extensionReadChatError) {
|
|
10585
|
+
extensionReadChatError = "extension read_chat returned a non-object payload";
|
|
10586
|
+
}
|
|
10587
|
+
} else {
|
|
10588
|
+
extensionReadChatError = "extension read_chat returned no payload";
|
|
10582
10589
|
}
|
|
10583
10590
|
} catch (e) {
|
|
10591
|
+
extensionReadChatError = `extension read_chat failed: ${e?.message || String(e)}`;
|
|
10584
10592
|
_log(`Extension error: ${e.message}`);
|
|
10585
10593
|
traceProviderEvent(args, "provider", "extension.read_chat.error", {
|
|
10586
10594
|
h,
|
|
@@ -10594,8 +10602,8 @@ async function handleReadChat(h, args) {
|
|
|
10594
10602
|
const parentSessionId = h.currentSession?.parentSessionId;
|
|
10595
10603
|
if (cdp2 && parentSessionId) {
|
|
10596
10604
|
const stream = await h.agentStream.collectActiveSession(cdp2, parentSessionId);
|
|
10597
|
-
if (stream
|
|
10598
|
-
return
|
|
10605
|
+
if (stream && stream.agentType !== provider?.type) {
|
|
10606
|
+
return { success: false, error: `extension read_chat stream agent mismatch for ${provider?.type || "unknown_extension"}` };
|
|
10599
10607
|
}
|
|
10600
10608
|
if (stream) {
|
|
10601
10609
|
h.historyWriter.appendNewMessages(
|
|
@@ -10613,12 +10621,13 @@ async function handleReadChat(h, args) {
|
|
|
10613
10621
|
}
|
|
10614
10622
|
}
|
|
10615
10623
|
}
|
|
10616
|
-
return
|
|
10624
|
+
return { success: false, error: extensionReadChatError || "extension read_chat unavailable" };
|
|
10617
10625
|
}
|
|
10618
10626
|
const cdp = h.getCdp();
|
|
10619
10627
|
if (!cdp?.isConnected) return { success: false, error: "CDP not connected" };
|
|
10620
10628
|
const webviewScript = h.getProviderScript("webviewReadChat") || h.getProviderScript("webview_read_chat");
|
|
10621
10629
|
if (webviewScript) {
|
|
10630
|
+
let webviewReadChatError = "";
|
|
10622
10631
|
try {
|
|
10623
10632
|
const matchText = provider?.webviewMatchText;
|
|
10624
10633
|
const matchFn = matchText ? (body) => body.includes(matchText) : void 0;
|
|
@@ -10628,7 +10637,8 @@ async function handleReadChat(h, args) {
|
|
|
10628
10637
|
if (typeof parsed === "string") {
|
|
10629
10638
|
try {
|
|
10630
10639
|
parsed = JSON.parse(parsed);
|
|
10631
|
-
} catch {
|
|
10640
|
+
} catch (e) {
|
|
10641
|
+
webviewReadChatError = `webview read_chat parse failed: ${e?.message || String(e)}`;
|
|
10632
10642
|
}
|
|
10633
10643
|
}
|
|
10634
10644
|
if (parsed && typeof parsed === "object") {
|
|
@@ -10643,14 +10653,21 @@ async function handleReadChat(h, args) {
|
|
|
10643
10653
|
);
|
|
10644
10654
|
return buildReadChatCommandResult(validated, args);
|
|
10645
10655
|
}
|
|
10656
|
+
if (!webviewReadChatError) {
|
|
10657
|
+
webviewReadChatError = "webview read_chat returned a non-object payload";
|
|
10658
|
+
}
|
|
10659
|
+
} else {
|
|
10660
|
+
webviewReadChatError = "webview read_chat returned no payload";
|
|
10646
10661
|
}
|
|
10647
10662
|
} catch (e) {
|
|
10663
|
+
webviewReadChatError = `webview read_chat failed: ${e?.message || String(e)}`;
|
|
10648
10664
|
_log(`Webview readChat error: ${e.message}`);
|
|
10649
10665
|
}
|
|
10650
|
-
return
|
|
10666
|
+
return { success: false, error: webviewReadChatError || "webview read_chat unavailable" };
|
|
10651
10667
|
}
|
|
10652
10668
|
const script = h.getProviderScript("readChat") || h.getProviderScript("read_chat");
|
|
10653
10669
|
if (script) {
|
|
10670
|
+
let ideReadChatError = "";
|
|
10654
10671
|
try {
|
|
10655
10672
|
const evalResult = await h.evaluateProviderScript("readChat", void 0, READ_CHAT_PROVIDER_EVAL_TIMEOUT_MS);
|
|
10656
10673
|
if (evalResult?.result) {
|
|
@@ -10658,12 +10675,13 @@ async function handleReadChat(h, args) {
|
|
|
10658
10675
|
if (typeof parsed === "string") {
|
|
10659
10676
|
try {
|
|
10660
10677
|
parsed = JSON.parse(parsed);
|
|
10661
|
-
} catch {
|
|
10678
|
+
} catch (e) {
|
|
10679
|
+
ideReadChatError = `ide read_chat parse failed: ${e?.message || String(e)}`;
|
|
10662
10680
|
}
|
|
10663
10681
|
}
|
|
10664
|
-
if (parsed && typeof parsed === "object"
|
|
10682
|
+
if (parsed && typeof parsed === "object") {
|
|
10665
10683
|
const validated = validateReadChatResultPayload(parsed, "ide read_chat");
|
|
10666
|
-
_log(`OK: ${validated.messages?.length} msgs`);
|
|
10684
|
+
_log(`OK: ${validated.messages?.length || 0} msgs`);
|
|
10667
10685
|
traceProviderEvent(args, "provider", "ide.read_chat.success", {
|
|
10668
10686
|
h,
|
|
10669
10687
|
provider,
|
|
@@ -10683,8 +10701,14 @@ async function handleReadChat(h, args) {
|
|
|
10683
10701
|
);
|
|
10684
10702
|
return buildReadChatCommandResult(validated, args);
|
|
10685
10703
|
}
|
|
10704
|
+
if (!ideReadChatError) {
|
|
10705
|
+
ideReadChatError = "ide read_chat returned a non-object payload";
|
|
10706
|
+
}
|
|
10707
|
+
} else {
|
|
10708
|
+
ideReadChatError = "ide read_chat returned no payload";
|
|
10686
10709
|
}
|
|
10687
10710
|
} catch (e) {
|
|
10711
|
+
ideReadChatError = `ide read_chat failed: ${e?.message || String(e)}`;
|
|
10688
10712
|
LOG.info("Command", `[read_chat] Script error: ${e.message}`);
|
|
10689
10713
|
traceProviderEvent(args, "provider", "ide.read_chat.error", {
|
|
10690
10714
|
h,
|
|
@@ -10693,8 +10717,9 @@ async function handleReadChat(h, args) {
|
|
|
10693
10717
|
payload: { method: "evaluate", error: e.message }
|
|
10694
10718
|
});
|
|
10695
10719
|
}
|
|
10720
|
+
return { success: false, error: ideReadChatError || "ide read_chat unavailable" };
|
|
10696
10721
|
}
|
|
10697
|
-
return
|
|
10722
|
+
return { success: false, error: "read_chat unavailable" };
|
|
10698
10723
|
}
|
|
10699
10724
|
async function handleSendChat(h, args) {
|
|
10700
10725
|
const input = getSendChatInputEnvelope(args);
|