@trops/dash-core 0.1.708 → 0.1.710
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 +61 -8
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +61 -8
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -51950,12 +51950,20 @@ function ListenersTab(_ref1) {
|
|
|
51950
51950
|
return m;
|
|
51951
51951
|
}, [receivers]);
|
|
51952
51952
|
if (receivers.length === 0) {
|
|
51953
|
+
// Bots are emitters too (component `bot:<ref>`) — count them apart.
|
|
51954
|
+
var botCount = emitters.filter(function (e) {
|
|
51955
|
+
return String(e.component || "").startsWith("bot:");
|
|
51956
|
+
}).length;
|
|
51957
|
+
var widgetCount = emitters.length - botCount;
|
|
51958
|
+
var senders = [widgetCount > 0 && "".concat(widgetCount, " widget").concat(widgetCount === 1 ? "" : "s"), botCount > 0 && "".concat(botCount, " bot").concat(botCount === 1 ? "" : "s")].filter(Boolean);
|
|
51953
51959
|
return /*#__PURE__*/jsx("div", {
|
|
51954
51960
|
className: "flex items-center justify-center h-full text-sm opacity-60 text-center",
|
|
51955
51961
|
children: /*#__PURE__*/jsxs("div", {
|
|
51956
|
-
children: [
|
|
51962
|
+
children: [/*#__PURE__*/jsx("div", {
|
|
51963
|
+
children: "No widget on this dashboard can listen for events yet."
|
|
51964
|
+
}), senders.length > 0 && /*#__PURE__*/jsx("div", {
|
|
51957
51965
|
className: "mt-2",
|
|
51958
|
-
children:
|
|
51966
|
+
children: "".concat(senders.join(" and "), " ").concat(emitters.length === 1 ? "sends" : "send", " events. Add a widget that listens to use them.")
|
|
51959
51967
|
})]
|
|
51960
51968
|
})
|
|
51961
51969
|
});
|
|
@@ -79228,6 +79236,41 @@ function renderSafeMarkdown(text) {
|
|
|
79228
79236
|
});
|
|
79229
79237
|
}
|
|
79230
79238
|
|
|
79239
|
+
/**
|
|
79240
|
+
* collapseCodeBlocks — for ChatCore's `hideCodeBlocks` option.
|
|
79241
|
+
*
|
|
79242
|
+
* Replaces each fenced code block (and the `File: path` marker line that
|
|
79243
|
+
* labels it) with a one-line italic note, so a chat whose code is shown
|
|
79244
|
+
* elsewhere (the Widget Builder's Code tab) stays readable. Back-to-back
|
|
79245
|
+
* blocks share one note. A block that is still streaming (no closing
|
|
79246
|
+
* fence yet) becomes "Writing code…". Inline `code` is untouched.
|
|
79247
|
+
*
|
|
79248
|
+
* @param {string} text assistant Markdown
|
|
79249
|
+
* @param {string} note what a hidden block says
|
|
79250
|
+
* @param {{ plain?: boolean }} [opts] plain: no Markdown italics (for the
|
|
79251
|
+
* streaming view, which shows raw text)
|
|
79252
|
+
* @returns {string}
|
|
79253
|
+
*/
|
|
79254
|
+
function collapseCodeBlocks(text, note) {
|
|
79255
|
+
var _ref = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
|
|
79256
|
+
_ref$plain = _ref.plain,
|
|
79257
|
+
plain = _ref$plain === void 0 ? false : _ref$plain;
|
|
79258
|
+
if (!text || typeof text !== "string" || !text.includes("```")) return text;
|
|
79259
|
+
var wrap = function wrap(t) {
|
|
79260
|
+
return plain ? t : "_".concat(t, "_");
|
|
79261
|
+
};
|
|
79262
|
+
var marker = wrap(note);
|
|
79263
|
+
var out = text
|
|
79264
|
+
// Complete blocks, with an optional "File: …" line just above.
|
|
79265
|
+
.replace(/(^|\n)(?:[ \t]*File:[^\n]*\n)?[ \t]*```[^\n]*\n[\s\S]*?\n[ \t]*```[ \t]*(?=\n|$)/g, "$1".concat(marker))
|
|
79266
|
+
// A block still being written: open fence with no close.
|
|
79267
|
+
.replace(/(^|\n)(?:[ \t]*File:[^\n]*\n)?[ \t]*```[^\n]*(?:\n[\s\S]*)?$/, "$1".concat(wrap("Writing code…")));
|
|
79268
|
+
// One note for back-to-back blocks.
|
|
79269
|
+
var escaped = marker.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
79270
|
+
out = out.replace(new RegExp("".concat(escaped, "(\\s*").concat(escaped, ")+"), "g"), marker);
|
|
79271
|
+
return out;
|
|
79272
|
+
}
|
|
79273
|
+
|
|
79231
79274
|
function ownKeys$6(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
79232
79275
|
function _objectSpread$6(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$6(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$6(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
79233
79276
|
function _createForOfIteratorHelper$5(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray$5(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
|
|
@@ -79252,7 +79295,9 @@ var MessageBubble = function MessageBubble(_ref2) {
|
|
|
79252
79295
|
isStreaming = _ref2.isStreaming,
|
|
79253
79296
|
streamingText = _ref2.streamingText,
|
|
79254
79297
|
_ref2$isLast = _ref2.isLast,
|
|
79255
|
-
isLast = _ref2$isLast === void 0 ? false : _ref2$isLast
|
|
79298
|
+
isLast = _ref2$isLast === void 0 ? false : _ref2$isLast,
|
|
79299
|
+
_ref2$codeNote = _ref2.codeNote,
|
|
79300
|
+
codeNote = _ref2$codeNote === void 0 ? null : _ref2$codeNote;
|
|
79256
79301
|
var role = message.role,
|
|
79257
79302
|
content = message.content,
|
|
79258
79303
|
toolCalls = message.toolCalls,
|
|
@@ -79390,11 +79435,13 @@ var MessageBubble = function MessageBubble(_ref2) {
|
|
|
79390
79435
|
className: "text-sm leading-relaxed px-3 py-2 rounded-lg ".concat(bubbleBg, " ").concat(bubbleText),
|
|
79391
79436
|
children: [isStreaming && /*#__PURE__*/jsx("div", {
|
|
79392
79437
|
children: /*#__PURE__*/jsx(StreamingText, {
|
|
79393
|
-
text: streamingText,
|
|
79438
|
+
text: codeNote ? collapseCodeBlocks(streamingText, codeNote, {
|
|
79439
|
+
plain: true
|
|
79440
|
+
}) : streamingText,
|
|
79394
79441
|
isStreaming: true
|
|
79395
79442
|
})
|
|
79396
79443
|
}), !isStreaming && _text && /*#__PURE__*/jsx(AssistantTextContent, {
|
|
79397
|
-
text: _text
|
|
79444
|
+
text: codeNote ? collapseCodeBlocks(_text, codeNote) : _text
|
|
79398
79445
|
}), toolBlocks.map(function (block) {
|
|
79399
79446
|
return /*#__PURE__*/jsx(ToolCallBlock, {
|
|
79400
79447
|
toolName: block.name,
|
|
@@ -79455,7 +79502,9 @@ var ChatMessages = function ChatMessages(_ref) {
|
|
|
79455
79502
|
streamingRequestId = _ref.streamingRequestId,
|
|
79456
79503
|
streamingText = _ref.streamingText,
|
|
79457
79504
|
_ref$isLoading = _ref.isLoading,
|
|
79458
|
-
isLoading = _ref$isLoading === void 0 ? false : _ref$isLoading
|
|
79505
|
+
isLoading = _ref$isLoading === void 0 ? false : _ref$isLoading,
|
|
79506
|
+
_ref$codeNote = _ref.codeNote,
|
|
79507
|
+
codeNote = _ref$codeNote === void 0 ? null : _ref$codeNote;
|
|
79459
79508
|
var scrollRef = useRef(null);
|
|
79460
79509
|
var _ref2 = useContext(ThemeContext) || {},
|
|
79461
79510
|
currentTheme = _ref2.currentTheme;
|
|
@@ -79493,7 +79542,8 @@ var ChatMessages = function ChatMessages(_ref) {
|
|
|
79493
79542
|
message: message,
|
|
79494
79543
|
isStreaming: isStreaming,
|
|
79495
79544
|
streamingText: isStreaming ? streamingText : "",
|
|
79496
|
-
isLast: index === messages.length - 1
|
|
79545
|
+
isLast: index === messages.length - 1,
|
|
79546
|
+
codeNote: codeNote
|
|
79497
79547
|
}, message.id || index);
|
|
79498
79548
|
}), isLoading && !streamingRequestId && ((_messages = messages[messages.length - 1]) === null || _messages === void 0 ? void 0 : _messages.role) === "user" && /*#__PURE__*/jsxs("div", {
|
|
79499
79549
|
className: "mb-4",
|
|
@@ -79948,6 +79998,8 @@ function ChatCore(_ref) {
|
|
|
79948
79998
|
onPublishEvent = _ref$onPublishEvent === void 0 ? null : _ref$onPublishEvent,
|
|
79949
79999
|
_ref$hideToolsBanner = _ref.hideToolsBanner,
|
|
79950
80000
|
hideToolsBanner = _ref$hideToolsBanner === void 0 ? false : _ref$hideToolsBanner,
|
|
80001
|
+
_ref$hideCodeBlocks = _ref.hideCodeBlocks,
|
|
80002
|
+
hideCodeBlocks = _ref$hideCodeBlocks === void 0 ? false : _ref$hideCodeBlocks,
|
|
79951
80003
|
_ref$cwd = _ref.cwd,
|
|
79952
80004
|
cwd = _ref$cwd === void 0 ? null : _ref$cwd,
|
|
79953
80005
|
_ref$initialMessage = _ref.initialMessage,
|
|
@@ -80745,7 +80797,8 @@ function ChatCore(_ref) {
|
|
|
80745
80797
|
messages: messages,
|
|
80746
80798
|
streamingRequestId: isLoading ? activeRequestId.current : null,
|
|
80747
80799
|
streamingText: streamingText,
|
|
80748
|
-
isLoading: isLoading
|
|
80800
|
+
isLoading: isLoading,
|
|
80801
|
+
codeNote: typeof hideCodeBlocks === "string" ? hideCodeBlocks : hideCodeBlocks ? "Code hidden." : null
|
|
80749
80802
|
}), enableLeadRecipients && leadNotice && /*#__PURE__*/jsx("div", {
|
|
80750
80803
|
className: "px-3 pt-2",
|
|
80751
80804
|
children: /*#__PURE__*/jsx(AlertBanner, {
|