@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.js CHANGED
@@ -12794,7 +12794,12 @@ var WidgetConfigPanel = function WidgetConfigPanel(_ref) {
12794
12794
  itemSelected = _useState2[0],
12795
12795
  setItemSelected = _useState2[1];
12796
12796
  React.useEffect(function () {
12797
- if (item !== itemSelected) {
12797
+ // Only sync from the parent when the data actually differs.
12798
+ // Identity-only comparison fired on every parent re-render
12799
+ // (each edit round-trips through onChange → parent setState →
12800
+ // new item reference) and reset the input mid-keystroke,
12801
+ // making the userConfig inputs effectively untypeable.
12802
+ if (JSON.stringify(item) !== JSON.stringify(itemSelected)) {
12798
12803
  setItemSelected(function () {
12799
12804
  return item;
12800
12805
  });
@@ -12860,7 +12865,15 @@ var WidgetConfigPanel = function WidgetConfigPanel(_ref) {
12860
12865
  newItem["userPrefs"] = {};
12861
12866
  }
12862
12867
  newItem["userPrefs"][key] = value;
12863
- //setItemSelected(() => newItem);
12868
+ // Update local state immediately so the input reflects each
12869
+ // keystroke without waiting for the parent round-trip to come
12870
+ // back through props. Without this the InputText's `value` prop
12871
+ // stays at the pre-keystroke value, the typed char visibly
12872
+ // snaps away, and typing more than ~1 char per second is
12873
+ // effectively impossible.
12874
+ setItemSelected(function () {
12875
+ return newItem;
12876
+ });
12864
12877
  onChange(null, newItem);
12865
12878
  }
12866
12879
 
@@ -63060,6 +63073,56 @@ function ChatCore(_ref) {
63060
63073
  // eslint-disable-next-line react-hooks/exhaustive-deps
63061
63074
  }, [initialMessage, mainApi, messages, isCliBackend, cliAvailable, isLoading]);
63062
63075
 
63076
+ // Slice 19H — external "send this message" hook.
63077
+ //
63078
+ // Some parent components (the widget builder modal's "Send error to AI"
63079
+ // banner, the Console tab's per-error Send-to-AI button) need to push
63080
+ // a user message into THIS chat conversation without rendering the
63081
+ // input themselves. They dispatch a window CustomEvent named
63082
+ // `dash:chat-core-send` with `detail: { persistKey, content, hidden? }`.
63083
+ //
63084
+ // Each ChatCore instance only reacts to events targeting its own
63085
+ // persistKey OR sessionKey OR uuid — so the dashboard's AssistantPanel
63086
+ // and the widget builder's chat don't cross-talk.
63087
+ //
63088
+ // Why a CustomEvent (not localStorage poll, not ref): the prior
63089
+ // approach was for parent code to write to localStorage directly,
63090
+ // hoping ChatCore would notice. ChatCore reads localStorage only at
63091
+ // mount — so externally-written messages were silently dropped.
63092
+ // CustomEvent is one-way + synchronous + zero-cost when nobody fires
63093
+ // it, and stays consistent with the existing
63094
+ // `dash:open-settings-create-provider` / `dash:provider-installed` /
63095
+ // `dash:open-widget-builder` event bus used elsewhere in the app.
63096
+ React.useEffect(function () {
63097
+ var myKey = persistKey || sessionKey || uuid || null;
63098
+ if (!myKey) return;
63099
+ if (typeof window === "undefined") return;
63100
+ var handler = function handler(event) {
63101
+ var detail = event && event.detail;
63102
+ if (!detail) return;
63103
+ var targetKey = detail.persistKey || detail.sessionKey || detail.uuid || null;
63104
+ if (targetKey !== myKey) return;
63105
+ var content = detail.content;
63106
+ if (typeof content !== "string" || content.length === 0) return;
63107
+ // hidden defaults to false — the user typically WANTS to see the
63108
+ // error-fix request in the chat history so it's clear what was
63109
+ // sent and what the AI responded to.
63110
+ var hidden = detail.hidden === true;
63111
+ try {
63112
+ handleSend(content, {
63113
+ hidden: hidden
63114
+ });
63115
+ } catch (e) {
63116
+ // Sending may fail (no API key, no CLI). Swallow — the parent
63117
+ // can't recover beyond surfacing its own error state.
63118
+ }
63119
+ };
63120
+ window.addEventListener("dash:chat-core-send", handler);
63121
+ return function () {
63122
+ return window.removeEventListener("dash:chat-core-send", handler);
63123
+ };
63124
+ }, [persistKey, sessionKey, uuid, handleSend]);
63125
+
63063
63126
  // New chat
63064
63127
  var handleNewChat = function handleNewChat() {
63065
63128
  var _mainApi$llm3;