@trops/dash-core 0.1.551 → 0.1.553
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/electron/index.js +26 -202
- package/dist/electron/index.js.map +1 -1
- package/dist/index.esm.js +50 -0
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +50 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -63042,6 +63042,56 @@ function ChatCore(_ref) {
|
|
|
63042
63042
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
63043
63043
|
}, [initialMessage, mainApi, messages, isCliBackend, cliAvailable, isLoading]);
|
|
63044
63044
|
|
|
63045
|
+
// Slice 19H — external "send this message" hook.
|
|
63046
|
+
//
|
|
63047
|
+
// Some parent components (the widget builder modal's "Send error to AI"
|
|
63048
|
+
// banner, the Console tab's per-error Send-to-AI button) need to push
|
|
63049
|
+
// a user message into THIS chat conversation without rendering the
|
|
63050
|
+
// input themselves. They dispatch a window CustomEvent named
|
|
63051
|
+
// `dash:chat-core-send` with `detail: { persistKey, content, hidden? }`.
|
|
63052
|
+
//
|
|
63053
|
+
// Each ChatCore instance only reacts to events targeting its own
|
|
63054
|
+
// persistKey OR sessionKey OR uuid — so the dashboard's AssistantPanel
|
|
63055
|
+
// and the widget builder's chat don't cross-talk.
|
|
63056
|
+
//
|
|
63057
|
+
// Why a CustomEvent (not localStorage poll, not ref): the prior
|
|
63058
|
+
// approach was for parent code to write to localStorage directly,
|
|
63059
|
+
// hoping ChatCore would notice. ChatCore reads localStorage only at
|
|
63060
|
+
// mount — so externally-written messages were silently dropped.
|
|
63061
|
+
// CustomEvent is one-way + synchronous + zero-cost when nobody fires
|
|
63062
|
+
// it, and stays consistent with the existing
|
|
63063
|
+
// `dash:open-settings-create-provider` / `dash:provider-installed` /
|
|
63064
|
+
// `dash:open-widget-builder` event bus used elsewhere in the app.
|
|
63065
|
+
useEffect(function () {
|
|
63066
|
+
var myKey = persistKey || sessionKey || uuid || null;
|
|
63067
|
+
if (!myKey) return;
|
|
63068
|
+
if (typeof window === "undefined") return;
|
|
63069
|
+
var handler = function handler(event) {
|
|
63070
|
+
var detail = event && event.detail;
|
|
63071
|
+
if (!detail) return;
|
|
63072
|
+
var targetKey = detail.persistKey || detail.sessionKey || detail.uuid || null;
|
|
63073
|
+
if (targetKey !== myKey) return;
|
|
63074
|
+
var content = detail.content;
|
|
63075
|
+
if (typeof content !== "string" || content.length === 0) return;
|
|
63076
|
+
// hidden defaults to false — the user typically WANTS to see the
|
|
63077
|
+
// error-fix request in the chat history so it's clear what was
|
|
63078
|
+
// sent and what the AI responded to.
|
|
63079
|
+
var hidden = detail.hidden === true;
|
|
63080
|
+
try {
|
|
63081
|
+
handleSend(content, {
|
|
63082
|
+
hidden: hidden
|
|
63083
|
+
});
|
|
63084
|
+
} catch (e) {
|
|
63085
|
+
// Sending may fail (no API key, no CLI). Swallow — the parent
|
|
63086
|
+
// can't recover beyond surfacing its own error state.
|
|
63087
|
+
}
|
|
63088
|
+
};
|
|
63089
|
+
window.addEventListener("dash:chat-core-send", handler);
|
|
63090
|
+
return function () {
|
|
63091
|
+
return window.removeEventListener("dash:chat-core-send", handler);
|
|
63092
|
+
};
|
|
63093
|
+
}, [persistKey, sessionKey, uuid, handleSend]);
|
|
63094
|
+
|
|
63045
63095
|
// New chat
|
|
63046
63096
|
var handleNewChat = function handleNewChat() {
|
|
63047
63097
|
var _mainApi$llm3;
|