@trops/dash-core 0.1.552 → 0.1.554

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.esm.js CHANGED
@@ -12776,7 +12776,12 @@ var WidgetConfigPanel = function WidgetConfigPanel(_ref) {
12776
12776
  itemSelected = _useState2[0],
12777
12777
  setItemSelected = _useState2[1];
12778
12778
  useEffect(function () {
12779
- if (item !== itemSelected) {
12779
+ // Only sync from the parent when the data actually differs.
12780
+ // Identity-only comparison fired on every parent re-render
12781
+ // (each edit round-trips through onChange → parent setState →
12782
+ // new item reference) and reset the input mid-keystroke,
12783
+ // making the userConfig inputs effectively untypeable.
12784
+ if (JSON.stringify(item) !== JSON.stringify(itemSelected)) {
12780
12785
  setItemSelected(function () {
12781
12786
  return item;
12782
12787
  });
@@ -12842,7 +12847,15 @@ var WidgetConfigPanel = function WidgetConfigPanel(_ref) {
12842
12847
  newItem["userPrefs"] = {};
12843
12848
  }
12844
12849
  newItem["userPrefs"][key] = value;
12845
- //setItemSelected(() => newItem);
12850
+ // Update local state immediately so the input reflects each
12851
+ // keystroke without waiting for the parent round-trip to come
12852
+ // back through props. Without this the InputText's `value` prop
12853
+ // stays at the pre-keystroke value, the typed char visibly
12854
+ // snaps away, and typing more than ~1 char per second is
12855
+ // effectively impossible.
12856
+ setItemSelected(function () {
12857
+ return newItem;
12858
+ });
12846
12859
  onChange(null, newItem);
12847
12860
  }
12848
12861
 
@@ -63042,6 +63055,56 @@ function ChatCore(_ref) {
63042
63055
  // eslint-disable-next-line react-hooks/exhaustive-deps
63043
63056
  }, [initialMessage, mainApi, messages, isCliBackend, cliAvailable, isLoading]);
63044
63057
 
63058
+ // Slice 19H — external "send this message" hook.
63059
+ //
63060
+ // Some parent components (the widget builder modal's "Send error to AI"
63061
+ // banner, the Console tab's per-error Send-to-AI button) need to push
63062
+ // a user message into THIS chat conversation without rendering the
63063
+ // input themselves. They dispatch a window CustomEvent named
63064
+ // `dash:chat-core-send` with `detail: { persistKey, content, hidden? }`.
63065
+ //
63066
+ // Each ChatCore instance only reacts to events targeting its own
63067
+ // persistKey OR sessionKey OR uuid — so the dashboard's AssistantPanel
63068
+ // and the widget builder's chat don't cross-talk.
63069
+ //
63070
+ // Why a CustomEvent (not localStorage poll, not ref): the prior
63071
+ // approach was for parent code to write to localStorage directly,
63072
+ // hoping ChatCore would notice. ChatCore reads localStorage only at
63073
+ // mount — so externally-written messages were silently dropped.
63074
+ // CustomEvent is one-way + synchronous + zero-cost when nobody fires
63075
+ // it, and stays consistent with the existing
63076
+ // `dash:open-settings-create-provider` / `dash:provider-installed` /
63077
+ // `dash:open-widget-builder` event bus used elsewhere in the app.
63078
+ useEffect(function () {
63079
+ var myKey = persistKey || sessionKey || uuid || null;
63080
+ if (!myKey) return;
63081
+ if (typeof window === "undefined") return;
63082
+ var handler = function handler(event) {
63083
+ var detail = event && event.detail;
63084
+ if (!detail) return;
63085
+ var targetKey = detail.persistKey || detail.sessionKey || detail.uuid || null;
63086
+ if (targetKey !== myKey) return;
63087
+ var content = detail.content;
63088
+ if (typeof content !== "string" || content.length === 0) return;
63089
+ // hidden defaults to false — the user typically WANTS to see the
63090
+ // error-fix request in the chat history so it's clear what was
63091
+ // sent and what the AI responded to.
63092
+ var hidden = detail.hidden === true;
63093
+ try {
63094
+ handleSend(content, {
63095
+ hidden: hidden
63096
+ });
63097
+ } catch (e) {
63098
+ // Sending may fail (no API key, no CLI). Swallow — the parent
63099
+ // can't recover beyond surfacing its own error state.
63100
+ }
63101
+ };
63102
+ window.addEventListener("dash:chat-core-send", handler);
63103
+ return function () {
63104
+ return window.removeEventListener("dash:chat-core-send", handler);
63105
+ };
63106
+ }, [persistKey, sessionKey, uuid, handleSend]);
63107
+
63045
63108
  // New chat
63046
63109
  var handleNewChat = function handleNewChat() {
63047
63110
  var _mainApi$llm3;