@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.js
CHANGED
|
@@ -10700,6 +10700,7 @@ async function handleReadChat(h, args) {
|
|
|
10700
10700
|
return { success: false, error: `${transport} adapter not found` };
|
|
10701
10701
|
}
|
|
10702
10702
|
if (isExtensionTransport(transport)) {
|
|
10703
|
+
let extensionReadChatError = "";
|
|
10703
10704
|
try {
|
|
10704
10705
|
const evalResult = await h.evaluateProviderScript("readChat", void 0, READ_CHAT_PROVIDER_EVAL_TIMEOUT_MS);
|
|
10705
10706
|
if (evalResult?.result) {
|
|
@@ -10707,7 +10708,8 @@ async function handleReadChat(h, args) {
|
|
|
10707
10708
|
if (typeof parsed === "string") {
|
|
10708
10709
|
try {
|
|
10709
10710
|
parsed = JSON.parse(parsed);
|
|
10710
|
-
} catch {
|
|
10711
|
+
} catch (e) {
|
|
10712
|
+
extensionReadChatError = `extension read_chat parse failed: ${e?.message || String(e)}`;
|
|
10711
10713
|
}
|
|
10712
10714
|
}
|
|
10713
10715
|
if (parsed && typeof parsed === "object") {
|
|
@@ -10732,8 +10734,14 @@ async function handleReadChat(h, args) {
|
|
|
10732
10734
|
);
|
|
10733
10735
|
return buildReadChatCommandResult(validated, args);
|
|
10734
10736
|
}
|
|
10737
|
+
if (!extensionReadChatError) {
|
|
10738
|
+
extensionReadChatError = "extension read_chat returned a non-object payload";
|
|
10739
|
+
}
|
|
10740
|
+
} else {
|
|
10741
|
+
extensionReadChatError = "extension read_chat returned no payload";
|
|
10735
10742
|
}
|
|
10736
10743
|
} catch (e) {
|
|
10744
|
+
extensionReadChatError = `extension read_chat failed: ${e?.message || String(e)}`;
|
|
10737
10745
|
_log(`Extension error: ${e.message}`);
|
|
10738
10746
|
traceProviderEvent(args, "provider", "extension.read_chat.error", {
|
|
10739
10747
|
h,
|
|
@@ -10747,8 +10755,8 @@ async function handleReadChat(h, args) {
|
|
|
10747
10755
|
const parentSessionId = h.currentSession?.parentSessionId;
|
|
10748
10756
|
if (cdp2 && parentSessionId) {
|
|
10749
10757
|
const stream = await h.agentStream.collectActiveSession(cdp2, parentSessionId);
|
|
10750
|
-
if (stream
|
|
10751
|
-
return
|
|
10758
|
+
if (stream && stream.agentType !== provider?.type) {
|
|
10759
|
+
return { success: false, error: `extension read_chat stream agent mismatch for ${provider?.type || "unknown_extension"}` };
|
|
10752
10760
|
}
|
|
10753
10761
|
if (stream) {
|
|
10754
10762
|
h.historyWriter.appendNewMessages(
|
|
@@ -10766,12 +10774,13 @@ async function handleReadChat(h, args) {
|
|
|
10766
10774
|
}
|
|
10767
10775
|
}
|
|
10768
10776
|
}
|
|
10769
|
-
return
|
|
10777
|
+
return { success: false, error: extensionReadChatError || "extension read_chat unavailable" };
|
|
10770
10778
|
}
|
|
10771
10779
|
const cdp = h.getCdp();
|
|
10772
10780
|
if (!cdp?.isConnected) return { success: false, error: "CDP not connected" };
|
|
10773
10781
|
const webviewScript = h.getProviderScript("webviewReadChat") || h.getProviderScript("webview_read_chat");
|
|
10774
10782
|
if (webviewScript) {
|
|
10783
|
+
let webviewReadChatError = "";
|
|
10775
10784
|
try {
|
|
10776
10785
|
const matchText = provider?.webviewMatchText;
|
|
10777
10786
|
const matchFn = matchText ? (body) => body.includes(matchText) : void 0;
|
|
@@ -10781,7 +10790,8 @@ async function handleReadChat(h, args) {
|
|
|
10781
10790
|
if (typeof parsed === "string") {
|
|
10782
10791
|
try {
|
|
10783
10792
|
parsed = JSON.parse(parsed);
|
|
10784
|
-
} catch {
|
|
10793
|
+
} catch (e) {
|
|
10794
|
+
webviewReadChatError = `webview read_chat parse failed: ${e?.message || String(e)}`;
|
|
10785
10795
|
}
|
|
10786
10796
|
}
|
|
10787
10797
|
if (parsed && typeof parsed === "object") {
|
|
@@ -10796,14 +10806,21 @@ async function handleReadChat(h, args) {
|
|
|
10796
10806
|
);
|
|
10797
10807
|
return buildReadChatCommandResult(validated, args);
|
|
10798
10808
|
}
|
|
10809
|
+
if (!webviewReadChatError) {
|
|
10810
|
+
webviewReadChatError = "webview read_chat returned a non-object payload";
|
|
10811
|
+
}
|
|
10812
|
+
} else {
|
|
10813
|
+
webviewReadChatError = "webview read_chat returned no payload";
|
|
10799
10814
|
}
|
|
10800
10815
|
} catch (e) {
|
|
10816
|
+
webviewReadChatError = `webview read_chat failed: ${e?.message || String(e)}`;
|
|
10801
10817
|
_log(`Webview readChat error: ${e.message}`);
|
|
10802
10818
|
}
|
|
10803
|
-
return
|
|
10819
|
+
return { success: false, error: webviewReadChatError || "webview read_chat unavailable" };
|
|
10804
10820
|
}
|
|
10805
10821
|
const script = h.getProviderScript("readChat") || h.getProviderScript("read_chat");
|
|
10806
10822
|
if (script) {
|
|
10823
|
+
let ideReadChatError = "";
|
|
10807
10824
|
try {
|
|
10808
10825
|
const evalResult = await h.evaluateProviderScript("readChat", void 0, READ_CHAT_PROVIDER_EVAL_TIMEOUT_MS);
|
|
10809
10826
|
if (evalResult?.result) {
|
|
@@ -10811,12 +10828,13 @@ async function handleReadChat(h, args) {
|
|
|
10811
10828
|
if (typeof parsed === "string") {
|
|
10812
10829
|
try {
|
|
10813
10830
|
parsed = JSON.parse(parsed);
|
|
10814
|
-
} catch {
|
|
10831
|
+
} catch (e) {
|
|
10832
|
+
ideReadChatError = `ide read_chat parse failed: ${e?.message || String(e)}`;
|
|
10815
10833
|
}
|
|
10816
10834
|
}
|
|
10817
|
-
if (parsed && typeof parsed === "object"
|
|
10835
|
+
if (parsed && typeof parsed === "object") {
|
|
10818
10836
|
const validated = validateReadChatResultPayload(parsed, "ide read_chat");
|
|
10819
|
-
_log(`OK: ${validated.messages?.length} msgs`);
|
|
10837
|
+
_log(`OK: ${validated.messages?.length || 0} msgs`);
|
|
10820
10838
|
traceProviderEvent(args, "provider", "ide.read_chat.success", {
|
|
10821
10839
|
h,
|
|
10822
10840
|
provider,
|
|
@@ -10836,8 +10854,14 @@ async function handleReadChat(h, args) {
|
|
|
10836
10854
|
);
|
|
10837
10855
|
return buildReadChatCommandResult(validated, args);
|
|
10838
10856
|
}
|
|
10857
|
+
if (!ideReadChatError) {
|
|
10858
|
+
ideReadChatError = "ide read_chat returned a non-object payload";
|
|
10859
|
+
}
|
|
10860
|
+
} else {
|
|
10861
|
+
ideReadChatError = "ide read_chat returned no payload";
|
|
10839
10862
|
}
|
|
10840
10863
|
} catch (e) {
|
|
10864
|
+
ideReadChatError = `ide read_chat failed: ${e?.message || String(e)}`;
|
|
10841
10865
|
LOG.info("Command", `[read_chat] Script error: ${e.message}`);
|
|
10842
10866
|
traceProviderEvent(args, "provider", "ide.read_chat.error", {
|
|
10843
10867
|
h,
|
|
@@ -10846,8 +10870,9 @@ async function handleReadChat(h, args) {
|
|
|
10846
10870
|
payload: { method: "evaluate", error: e.message }
|
|
10847
10871
|
});
|
|
10848
10872
|
}
|
|
10873
|
+
return { success: false, error: ideReadChatError || "ide read_chat unavailable" };
|
|
10849
10874
|
}
|
|
10850
|
-
return
|
|
10875
|
+
return { success: false, error: "read_chat unavailable" };
|
|
10851
10876
|
}
|
|
10852
10877
|
async function handleSendChat(h, args) {
|
|
10853
10878
|
const input = getSendChatInputEnvelope(args);
|