@trops/dash-core 0.1.757 → 0.1.758
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 +172 -346
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +171 -345
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -56769,70 +56769,6 @@ var PlanSketch = function PlanSketch(_ref) {
|
|
|
56769
56769
|
});
|
|
56770
56770
|
};
|
|
56771
56771
|
|
|
56772
|
-
function useBubbleTokens() {
|
|
56773
|
-
var _ref = React.useContext(DashReact.ThemeContext) || {},
|
|
56774
|
-
currentTheme = _ref.currentTheme;
|
|
56775
|
-
return {
|
|
56776
|
-
reply: (currentTheme === null || currentTheme === void 0 ? void 0 : currentTheme["bg-secondary-dark"]) || (currentTheme === null || currentTheme === void 0 ? void 0 : currentTheme["bg-primary-dark"]) || "",
|
|
56777
|
-
you: (currentTheme === null || currentTheme === void 0 ? void 0 : currentTheme["bg-primary-medium"]) || "",
|
|
56778
|
-
text: (currentTheme === null || currentTheme === void 0 ? void 0 : currentTheme["text-primary-medium"]) || ""
|
|
56779
|
-
};
|
|
56780
|
-
}
|
|
56781
|
-
|
|
56782
|
-
/** What the user said, right-aligned. */
|
|
56783
|
-
var YouBubble = function YouBubble(_ref2) {
|
|
56784
|
-
var children = _ref2.children;
|
|
56785
|
-
var t = useBubbleTokens();
|
|
56786
|
-
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
56787
|
-
className: "flex justify-end",
|
|
56788
|
-
children: /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
56789
|
-
className: "max-w-xl",
|
|
56790
|
-
children: [/*#__PURE__*/jsxRuntime.jsx(DashReact.Caption2, {
|
|
56791
|
-
block: true,
|
|
56792
|
-
className: "font-semibold uppercase tracking-wider mb-1 text-right",
|
|
56793
|
-
children: "You"
|
|
56794
|
-
}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
56795
|
-
className: "px-3 py-2 rounded-lg text-sm whitespace-pre-wrap break-words leading-relaxed ".concat(t.you, " ").concat(t.text),
|
|
56796
|
-
children: children
|
|
56797
|
-
})]
|
|
56798
|
-
})
|
|
56799
|
-
});
|
|
56800
|
-
};
|
|
56801
|
-
|
|
56802
|
-
/**
|
|
56803
|
-
* A team member's reply: its label ("Planner"), an optional meta line
|
|
56804
|
-
* (model · tokens), the text, and anything below it (a button).
|
|
56805
|
-
*/
|
|
56806
|
-
var TeamBubble = function TeamBubble(_ref3) {
|
|
56807
|
-
var _ref3$label = _ref3.label,
|
|
56808
|
-
label = _ref3$label === void 0 ? "Planner" : _ref3$label,
|
|
56809
|
-
_ref3$meta = _ref3.meta,
|
|
56810
|
-
meta = _ref3$meta === void 0 ? null : _ref3$meta,
|
|
56811
|
-
_ref3$muted = _ref3.muted,
|
|
56812
|
-
muted = _ref3$muted === void 0 ? false : _ref3$muted,
|
|
56813
|
-
testId = _ref3.testId,
|
|
56814
|
-
children = _ref3.children,
|
|
56815
|
-
_ref3$footer = _ref3.footer,
|
|
56816
|
-
footer = _ref3$footer === void 0 ? null : _ref3$footer;
|
|
56817
|
-
var t = useBubbleTokens();
|
|
56818
|
-
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
56819
|
-
className: "flex flex-col gap-1",
|
|
56820
|
-
"data-testid": testId,
|
|
56821
|
-
children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
56822
|
-
className: "flex flex-row items-center gap-2",
|
|
56823
|
-
children: [/*#__PURE__*/jsxRuntime.jsx(DashReact.Caption2, {
|
|
56824
|
-
className: "font-semibold uppercase tracking-wider",
|
|
56825
|
-
children: label
|
|
56826
|
-
}), meta ? /*#__PURE__*/jsxRuntime.jsx(DashReact.Caption2, {
|
|
56827
|
-
children: meta
|
|
56828
|
-
}) : null]
|
|
56829
|
-
}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
56830
|
-
className: "px-3 py-2 rounded-lg text-sm whitespace-pre-wrap break-words leading-relaxed ".concat(t.reply, " ").concat(t.text, " ").concat(muted ? "opacity-70 italic" : ""),
|
|
56831
|
-
children: children
|
|
56832
|
-
}), footer]
|
|
56833
|
-
});
|
|
56834
|
-
};
|
|
56835
|
-
|
|
56836
56772
|
function ownKeys$J(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; }
|
|
56837
56773
|
function _objectSpread$J(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$J(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$J(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
56838
56774
|
function reopenedRequest(original, plan, text) {
|
|
@@ -57406,19 +57342,30 @@ var CreatePlanStep = function CreatePlanStep(_ref2) {
|
|
|
57406
57342
|
children: /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
57407
57343
|
className: "mx-auto w-full max-w-3xl flex flex-col ".concat(compact ? "gap-3 px-3 py-3" : "gap-4 px-6 py-8"),
|
|
57408
57344
|
children: [messages.map(function (m, i) {
|
|
57409
|
-
return m.who === "you" ? /*#__PURE__*/jsxRuntime.jsx(
|
|
57345
|
+
return m.who === "you" ? /*#__PURE__*/jsxRuntime.jsx(DashReact.ChatMessage, {
|
|
57346
|
+
role: "you",
|
|
57410
57347
|
children: m.text
|
|
57411
|
-
}, i) : m.who === "note" ? /*#__PURE__*/jsxRuntime.jsx(
|
|
57412
|
-
|
|
57348
|
+
}, i) : m.who === "note" ? /*#__PURE__*/jsxRuntime.jsx(DashReact.ChatMessage, {
|
|
57349
|
+
role: "note",
|
|
57413
57350
|
children: m.text
|
|
57414
|
-
}, i) : /*#__PURE__*/jsxRuntime.jsx(
|
|
57351
|
+
}, i) : /*#__PURE__*/jsxRuntime.jsx(DashReact.ChatMessage, {
|
|
57352
|
+
role: "reply",
|
|
57353
|
+
label: "Planner",
|
|
57415
57354
|
meta: m.meta,
|
|
57416
57355
|
testId: "planner-message",
|
|
57417
|
-
children:
|
|
57356
|
+
children: /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
57357
|
+
className: "whitespace-pre-wrap",
|
|
57358
|
+
children: m.text
|
|
57359
|
+
})
|
|
57418
57360
|
}, i);
|
|
57419
|
-
}), busy ? /*#__PURE__*/jsxRuntime.jsx(
|
|
57420
|
-
|
|
57421
|
-
|
|
57361
|
+
}), busy ? /*#__PURE__*/jsxRuntime.jsx(DashReact.ChatMessage, {
|
|
57362
|
+
role: "reply",
|
|
57363
|
+
label: "Planner",
|
|
57364
|
+
streaming: true,
|
|
57365
|
+
children: /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
57366
|
+
className: "whitespace-pre-wrap",
|
|
57367
|
+
children: withoutPlan(soFar) || "Thinking…"
|
|
57368
|
+
})
|
|
57422
57369
|
}) : null, !busy && questions.length ? /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
57423
57370
|
className: "flex flex-col gap-3",
|
|
57424
57371
|
"data-testid": "plan-questions",
|
|
@@ -57682,33 +57629,22 @@ var CreatePlanStep = function CreatePlanStep(_ref2) {
|
|
|
57682
57629
|
setWalking(false);
|
|
57683
57630
|
}
|
|
57684
57631
|
}) : null, /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
57685
|
-
className: "flex-shrink-0
|
|
57686
|
-
children: /*#__PURE__*/jsxRuntime.
|
|
57687
|
-
className: "mx-auto w-full max-w-3xl
|
|
57688
|
-
children:
|
|
57689
|
-
|
|
57690
|
-
|
|
57691
|
-
|
|
57692
|
-
|
|
57693
|
-
|
|
57694
|
-
|
|
57695
|
-
},
|
|
57696
|
-
placeholder: busy ? "The Planner is working…" : "Answer, or ask for changes…",
|
|
57697
|
-
rows: 2,
|
|
57698
|
-
onKeyDown: function onKeyDown(e) {
|
|
57699
|
-
if (e.key === "Enter" && !e.shiftKey) {
|
|
57700
|
-
e.preventDefault();
|
|
57701
|
-
answer(reply);
|
|
57702
|
-
}
|
|
57703
|
-
}
|
|
57704
|
-
})
|
|
57705
|
-
}), /*#__PURE__*/jsxRuntime.jsx(DashReact.Button, {
|
|
57706
|
-
title: "Send",
|
|
57707
|
-
onClick: function onClick() {
|
|
57632
|
+
className: "flex-shrink-0",
|
|
57633
|
+
children: /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
57634
|
+
className: "mx-auto w-full max-w-3xl",
|
|
57635
|
+
children: /*#__PURE__*/jsxRuntime.jsx(DashReact.ChatComposer, {
|
|
57636
|
+
ariaLabel: "Reply to the Planner",
|
|
57637
|
+
value: reply,
|
|
57638
|
+
onChange: function onChange(v) {
|
|
57639
|
+
return setReply(v);
|
|
57640
|
+
},
|
|
57641
|
+
onSend: function onSend() {
|
|
57708
57642
|
return answer(reply);
|
|
57709
57643
|
},
|
|
57710
|
-
|
|
57711
|
-
|
|
57644
|
+
busy: busy,
|
|
57645
|
+
placeholder: busy ? "The Planner is working…" : "Answer, or ask for changes…",
|
|
57646
|
+
className: compact ? "" : "px-6 py-3"
|
|
57647
|
+
})
|
|
57712
57648
|
})
|
|
57713
57649
|
})]
|
|
57714
57650
|
});
|
|
@@ -58590,9 +58526,6 @@ var AskStep = function AskStep(_ref) {
|
|
|
58590
58526
|
recentId = _ref$recentId === void 0 ? null : _ref$recentId,
|
|
58591
58527
|
_ref$onOpenPlan = _ref.onOpenPlan,
|
|
58592
58528
|
onOpenPlan = _ref$onOpenPlan === void 0 ? null : _ref$onOpenPlan;
|
|
58593
|
-
var _useConfigTokens = useConfigTokens(),
|
|
58594
|
-
muted = _useConfigTokens.muted,
|
|
58595
|
-
hairline = _useConfigTokens.hairline;
|
|
58596
58529
|
// [{ who: "you" | "planner" | "note", text, meta?, plan? }]
|
|
58597
58530
|
var _useState = React.useState(recentId ? [] : [{
|
|
58598
58531
|
who: "you",
|
|
@@ -58776,56 +58709,51 @@ var AskStep = function AskStep(_ref) {
|
|
|
58776
58709
|
children: /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
58777
58710
|
className: "flex flex-col gap-3 px-3 py-3",
|
|
58778
58711
|
children: [messages.map(function (m, i) {
|
|
58779
|
-
return m.who === "you" ? /*#__PURE__*/jsxRuntime.jsx(
|
|
58712
|
+
return m.who === "you" ? /*#__PURE__*/jsxRuntime.jsx(DashReact.ChatMessage, {
|
|
58713
|
+
role: "you",
|
|
58780
58714
|
children: m.text
|
|
58781
|
-
}, i) : m.who === "note" ? /*#__PURE__*/jsxRuntime.jsx(
|
|
58782
|
-
|
|
58715
|
+
}, i) : m.who === "note" ? /*#__PURE__*/jsxRuntime.jsx(DashReact.ChatMessage, {
|
|
58716
|
+
role: "note",
|
|
58783
58717
|
children: m.text
|
|
58784
|
-
}, i) : /*#__PURE__*/jsxRuntime.jsx(
|
|
58718
|
+
}, i) : /*#__PURE__*/jsxRuntime.jsx(DashReact.ChatMessage, {
|
|
58719
|
+
role: "reply",
|
|
58720
|
+
label: "Planner",
|
|
58785
58721
|
meta: m.meta,
|
|
58786
58722
|
testId: "ask-answer",
|
|
58787
|
-
footer: m.plan && onOpenPlan ? /*#__PURE__*/jsxRuntime.jsx(
|
|
58788
|
-
|
|
58789
|
-
|
|
58790
|
-
|
|
58791
|
-
|
|
58792
|
-
|
|
58793
|
-
}
|
|
58794
|
-
})
|
|
58723
|
+
footer: m.plan && onOpenPlan ? /*#__PURE__*/jsxRuntime.jsx(DashReact.Button3, {
|
|
58724
|
+
size: "sm",
|
|
58725
|
+
title: "Open as a plan",
|
|
58726
|
+
onClick: function onClick() {
|
|
58727
|
+
return onOpenPlan(planSeed(m.asked, m.plan));
|
|
58728
|
+
}
|
|
58795
58729
|
}) : null,
|
|
58796
|
-
children:
|
|
58730
|
+
children: /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
58731
|
+
className: "whitespace-pre-wrap",
|
|
58732
|
+
children: m.text
|
|
58733
|
+
})
|
|
58797
58734
|
}, i);
|
|
58798
|
-
}), busy ? /*#__PURE__*/jsxRuntime.jsx(
|
|
58799
|
-
|
|
58800
|
-
|
|
58735
|
+
}), busy ? /*#__PURE__*/jsxRuntime.jsx(DashReact.ChatMessage, {
|
|
58736
|
+
role: "reply",
|
|
58737
|
+
label: "Planner",
|
|
58738
|
+
streaming: true,
|
|
58739
|
+
children: /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
58740
|
+
className: "whitespace-pre-wrap",
|
|
58741
|
+
children: withoutPlan(soFar) || "Looking…"
|
|
58742
|
+
})
|
|
58801
58743
|
}) : null]
|
|
58802
58744
|
})
|
|
58803
|
-
}), /*#__PURE__*/jsxRuntime.
|
|
58804
|
-
|
|
58805
|
-
|
|
58806
|
-
|
|
58807
|
-
|
|
58808
|
-
|
|
58809
|
-
|
|
58810
|
-
|
|
58811
|
-
|
|
58812
|
-
|
|
58813
|
-
|
|
58814
|
-
|
|
58815
|
-
onKeyDown: function onKeyDown(e) {
|
|
58816
|
-
if (e.key === "Enter" && !e.shiftKey) {
|
|
58817
|
-
e.preventDefault();
|
|
58818
|
-
send(reply);
|
|
58819
|
-
}
|
|
58820
|
-
}
|
|
58821
|
-
})
|
|
58822
|
-
}), /*#__PURE__*/jsxRuntime.jsx(DashReact.Button, {
|
|
58823
|
-
title: "Send",
|
|
58824
|
-
onClick: function onClick() {
|
|
58825
|
-
return send(reply);
|
|
58826
|
-
},
|
|
58827
|
-
disabled: busy || !reply.trim()
|
|
58828
|
-
})]
|
|
58745
|
+
}), /*#__PURE__*/jsxRuntime.jsx(DashReact.ChatComposer, {
|
|
58746
|
+
ariaLabel: "Ask a follow-up",
|
|
58747
|
+
value: reply,
|
|
58748
|
+
onChange: function onChange(v) {
|
|
58749
|
+
return setReply(v);
|
|
58750
|
+
},
|
|
58751
|
+
onSend: function onSend() {
|
|
58752
|
+
return send(reply);
|
|
58753
|
+
},
|
|
58754
|
+
busy: busy,
|
|
58755
|
+
placeholder: busy ? "The Planner is looking…" : "Ask a follow-up…",
|
|
58756
|
+
className: "flex-shrink-0"
|
|
58829
58757
|
})]
|
|
58830
58758
|
});
|
|
58831
58759
|
};
|
|
@@ -87823,6 +87751,15 @@ var StreamingText = function StreamingText(_ref) {
|
|
|
87823
87751
|
});
|
|
87824
87752
|
};
|
|
87825
87753
|
|
|
87754
|
+
/**
|
|
87755
|
+
* ToolCallBlock
|
|
87756
|
+
*
|
|
87757
|
+
* One MCP tool call in a chat, drawn with dash-react's ChatToolCall: status
|
|
87758
|
+
* dot, tool name, where it ran, and a disclosure with the input and result.
|
|
87759
|
+
*/
|
|
87760
|
+
var pretty = function pretty(v) {
|
|
87761
|
+
return typeof v === "string" ? v : JSON.stringify(v, null, 2);
|
|
87762
|
+
};
|
|
87826
87763
|
var ToolCallBlock = function ToolCallBlock(_ref) {
|
|
87827
87764
|
var toolName = _ref.toolName,
|
|
87828
87765
|
serverName = _ref.serverName,
|
|
@@ -87830,62 +87767,36 @@ var ToolCallBlock = function ToolCallBlock(_ref) {
|
|
|
87830
87767
|
result = _ref.result,
|
|
87831
87768
|
isError = _ref.isError,
|
|
87832
87769
|
isLoading = _ref.isLoading;
|
|
87833
|
-
var _useState = React.useState(false),
|
|
87834
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
87835
|
-
expanded = _useState2[0],
|
|
87836
|
-
setExpanded = _useState2[1];
|
|
87837
|
-
var _ref2 = React.useContext(DashReact.ThemeContext) || {},
|
|
87838
|
-
currentTheme = _ref2.currentTheme;
|
|
87839
87770
|
var statusTokens = DashReact.useStatusTokens();
|
|
87840
|
-
var
|
|
87841
|
-
|
|
87842
|
-
|
|
87843
|
-
|
|
87844
|
-
|
|
87845
|
-
|
|
87846
|
-
|
|
87847
|
-
|
|
87848
|
-
|
|
87849
|
-
|
|
87850
|
-
return setExpanded(!expanded);
|
|
87851
|
-
},
|
|
87852
|
-
className: "w-full flex items-center gap-2 px-2.5 py-1.5 transition-colors text-left ".concat(t("bg-primary-dark"), " ").concat(t("hover-bg-primary-dark")),
|
|
87853
|
-
children: [/*#__PURE__*/jsxRuntime.jsx("span", {
|
|
87854
|
-
className: "inline-block w-2 h-2 rounded-full ".concat(dotColor)
|
|
87855
|
-
}), /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
87856
|
-
className: "font-mono ".concat(t("text-secondary-medium")),
|
|
87857
|
-
children: toolName
|
|
87858
|
-
}), serverName && /*#__PURE__*/jsxRuntime.jsxs(DashReact.Caption2, {
|
|
87859
|
-
children: ["via ", serverName]
|
|
87860
|
-
}), /*#__PURE__*/jsxRuntime.jsx(DashReact.Caption2, {
|
|
87861
|
-
className: "ml-auto",
|
|
87862
|
-
children: expanded ? "▲" : "▼"
|
|
87863
|
-
})]
|
|
87864
|
-
}), expanded && /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
87865
|
-
className: "px-2.5 py-2 space-y-2 ".concat(t("bg-primary-dark")),
|
|
87866
|
-
children: [input && /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
87771
|
+
var status = isLoading ? "running" : isError ? "error" : "done";
|
|
87772
|
+
var hasDetails = input !== undefined || result !== undefined;
|
|
87773
|
+
var pre = "p-1.5 rounded overflow-auto font-mono text-xs";
|
|
87774
|
+
return /*#__PURE__*/jsxRuntime.jsx(DashReact.ChatToolCall, {
|
|
87775
|
+
name: toolName,
|
|
87776
|
+
source: serverName ? "via ".concat(serverName) : null,
|
|
87777
|
+
status: status,
|
|
87778
|
+
children: hasDetails ? /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
87779
|
+
className: "space-y-2",
|
|
87780
|
+
children: [input !== undefined && input !== null && input !== "" ? /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
87867
87781
|
children: [/*#__PURE__*/jsxRuntime.jsx(DashReact.Caption2, {
|
|
87868
87782
|
block: true,
|
|
87869
87783
|
className: "mb-0.5",
|
|
87870
87784
|
children: "Input:"
|
|
87871
87785
|
}), /*#__PURE__*/jsxRuntime.jsx("pre", {
|
|
87872
|
-
className: "".concat(
|
|
87873
|
-
children:
|
|
87786
|
+
className: "".concat(pre, " max-h-32"),
|
|
87787
|
+
children: pretty(input)
|
|
87874
87788
|
})]
|
|
87875
|
-
}), result !== undefined
|
|
87789
|
+
}) : null, result !== undefined ? /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
87876
87790
|
children: [/*#__PURE__*/jsxRuntime.jsx(DashReact.Caption2, {
|
|
87877
87791
|
block: true,
|
|
87878
87792
|
className: "mb-0.5",
|
|
87879
87793
|
children: "Result:"
|
|
87880
87794
|
}), /*#__PURE__*/jsxRuntime.jsx("pre", {
|
|
87881
|
-
className: "".concat(
|
|
87882
|
-
children:
|
|
87795
|
+
className: "".concat(pre, " max-h-48 ").concat(isError ? "".concat(statusTokens.error.bg, " ").concat(statusTokens.error.text) : ""),
|
|
87796
|
+
children: pretty(result)
|
|
87883
87797
|
})]
|
|
87884
|
-
})
|
|
87885
|
-
|
|
87886
|
-
children: "Running..."
|
|
87887
|
-
})]
|
|
87888
|
-
})]
|
|
87798
|
+
}) : null]
|
|
87799
|
+
}) : null
|
|
87889
87800
|
});
|
|
87890
87801
|
};
|
|
87891
87802
|
|
|
@@ -88007,18 +87918,7 @@ var MessageBubble = function MessageBubble(_ref2) {
|
|
|
88007
87918
|
content = message.content,
|
|
88008
87919
|
toolCalls = message.toolCalls,
|
|
88009
87920
|
hidden = message.hidden;
|
|
88010
|
-
var _ref3 = React.useContext(DashReact.ThemeContext) || {},
|
|
88011
|
-
currentTheme = _ref3.currentTheme;
|
|
88012
87921
|
var statusTokens = DashReact.useStatusTokens();
|
|
88013
|
-
// Theme-provided colors so the chat follows the active light/dark
|
|
88014
|
-
// theme. No hardcoded fallbacks — they only read correctly on dark.
|
|
88015
|
-
var bubbleBg = (currentTheme === null || currentTheme === void 0 ? void 0 : currentTheme["bg-secondary-dark"]) || (currentTheme === null || currentTheme === void 0 ? void 0 : currentTheme["bg-primary-dark"]) || "";
|
|
88016
|
-
// The user's bubble uses the primary surface so it stands apart from the
|
|
88017
|
-
// Assistant/lead bubbles (secondary). "bg-primary-medium" is a real
|
|
88018
|
-
// ThemeModel key; the old "bg-primary-bright"/"bg-primary" don't exist,
|
|
88019
|
-
// which left the user's text with no bubble at all.
|
|
88020
|
-
var userBubbleBg = (currentTheme === null || currentTheme === void 0 ? void 0 : currentTheme["bg-primary-medium"]) || "";
|
|
88021
|
-
var bubbleText = (currentTheme === null || currentTheme === void 0 ? void 0 : currentTheme["text-primary-medium"]) || "";
|
|
88022
87922
|
|
|
88023
87923
|
// App-injected priming messages (e.g. widget-builder "Hello…" seed)
|
|
88024
87924
|
// are kept in state for conversation continuity but suppressed from
|
|
@@ -88030,19 +87930,13 @@ var MessageBubble = function MessageBubble(_ref2) {
|
|
|
88030
87930
|
}).map(function (c) {
|
|
88031
87931
|
return c.text;
|
|
88032
87932
|
}).join("") : "";
|
|
88033
|
-
return /*#__PURE__*/jsxRuntime.
|
|
88034
|
-
|
|
88035
|
-
|
|
88036
|
-
|
|
88037
|
-
|
|
88038
|
-
|
|
88039
|
-
|
|
88040
|
-
children: message.to ? "You \u2192 ".concat(leadLabel(message.to)) : "You"
|
|
88041
|
-
}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
88042
|
-
className: "px-3 py-2 rounded-lg text-sm whitespace-pre-wrap break-words leading-relaxed ".concat(userBubbleBg, " ").concat(bubbleText),
|
|
88043
|
-
children: text
|
|
88044
|
-
})]
|
|
88045
|
-
})
|
|
87933
|
+
return /*#__PURE__*/jsxRuntime.jsxs(DashReact.ChatMessage, {
|
|
87934
|
+
role: "you",
|
|
87935
|
+
testId: "user-bubble",
|
|
87936
|
+
children: [message.to ? /*#__PURE__*/jsxRuntime.jsxs("span", {
|
|
87937
|
+
className: "block text-xs opacity-70 mb-0.5",
|
|
87938
|
+
children: ["To ", leadLabel(message.to)]
|
|
87939
|
+
}) : null, text]
|
|
88046
87940
|
});
|
|
88047
87941
|
}
|
|
88048
87942
|
if (role === "assistant") {
|
|
@@ -88113,51 +88007,39 @@ var MessageBubble = function MessageBubble(_ref2) {
|
|
|
88113
88007
|
// indicator so the user knows the AI is working.
|
|
88114
88008
|
if (!isStreaming && !_text && toolBlocks.length === 0) {
|
|
88115
88009
|
if (isLast) {
|
|
88116
|
-
return /*#__PURE__*/jsxRuntime.
|
|
88117
|
-
|
|
88118
|
-
|
|
88119
|
-
|
|
88120
|
-
|
|
88121
|
-
children: "Assistant"
|
|
88122
|
-
}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
88123
|
-
className: "text-sm leading-relaxed px-3 py-2 rounded-lg ".concat(bubbleBg),
|
|
88124
|
-
children: /*#__PURE__*/jsxRuntime.jsx(DashReact.Caption2, {
|
|
88125
|
-
className: "italic",
|
|
88126
|
-
children: "Thinking..."
|
|
88127
|
-
})
|
|
88128
|
-
})]
|
|
88010
|
+
return /*#__PURE__*/jsxRuntime.jsx(DashReact.ChatMessage, {
|
|
88011
|
+
role: "reply",
|
|
88012
|
+
label: "Assistant",
|
|
88013
|
+
streaming: true,
|
|
88014
|
+
children: "Thinking..."
|
|
88129
88015
|
});
|
|
88130
88016
|
}
|
|
88131
88017
|
return null;
|
|
88132
88018
|
}
|
|
88133
88019
|
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
88134
|
-
className: "
|
|
88135
|
-
children: [
|
|
88136
|
-
|
|
88137
|
-
|
|
88138
|
-
|
|
88139
|
-
|
|
88140
|
-
|
|
88141
|
-
|
|
88142
|
-
|
|
88143
|
-
|
|
88144
|
-
|
|
88145
|
-
|
|
88146
|
-
|
|
88147
|
-
|
|
88148
|
-
|
|
88020
|
+
className: "flex flex-col gap-2",
|
|
88021
|
+
children: [toolBlocks.map(function (block) {
|
|
88022
|
+
return /*#__PURE__*/jsxRuntime.jsx(ToolCallBlock, {
|
|
88023
|
+
toolName: block.name,
|
|
88024
|
+
serverName: block.serverName,
|
|
88025
|
+
input: block.input,
|
|
88026
|
+
result: block.result,
|
|
88027
|
+
isError: block.isError,
|
|
88028
|
+
isLoading: block.isLoading
|
|
88029
|
+
}, block.id);
|
|
88030
|
+
}), isStreaming || _text ? /*#__PURE__*/jsxRuntime.jsx(DashReact.ChatMessage, {
|
|
88031
|
+
role: "reply",
|
|
88032
|
+
label: "Assistant",
|
|
88033
|
+
streaming: isStreaming && !streamingText,
|
|
88034
|
+
children: isStreaming ? /*#__PURE__*/jsxRuntime.jsx(StreamingText, {
|
|
88035
|
+
text: codeNote ? collapseCodeBlocks(streamingText, codeNote, {
|
|
88036
|
+
plain: true
|
|
88037
|
+
}) : streamingText,
|
|
88038
|
+
isStreaming: true
|
|
88039
|
+
}) : /*#__PURE__*/jsxRuntime.jsx(AssistantTextContent, {
|
|
88149
88040
|
text: codeNote ? collapseCodeBlocks(_text, codeNote) : _text
|
|
88150
|
-
})
|
|
88151
|
-
|
|
88152
|
-
toolName: block.name,
|
|
88153
|
-
serverName: block.serverName,
|
|
88154
|
-
input: block.input,
|
|
88155
|
-
result: block.result,
|
|
88156
|
-
isError: block.isError,
|
|
88157
|
-
isLoading: block.isLoading
|
|
88158
|
-
}, block.id);
|
|
88159
|
-
})]
|
|
88160
|
-
})]
|
|
88041
|
+
})
|
|
88042
|
+
}) : null]
|
|
88161
88043
|
});
|
|
88162
88044
|
}
|
|
88163
88045
|
|
|
@@ -88165,25 +88047,20 @@ var MessageBubble = function MessageBubble(_ref2) {
|
|
|
88165
88047
|
// lead and its dashboard.
|
|
88166
88048
|
if (role === "lead") {
|
|
88167
88049
|
var _text2 = typeof content === "string" ? content : textOfContent(content);
|
|
88168
|
-
return /*#__PURE__*/jsxRuntime.
|
|
88169
|
-
|
|
88170
|
-
|
|
88171
|
-
|
|
88172
|
-
|
|
88173
|
-
|
|
88174
|
-
|
|
88175
|
-
|
|
88176
|
-
|
|
88177
|
-
|
|
88178
|
-
|
|
88179
|
-
|
|
88180
|
-
|
|
88181
|
-
|
|
88182
|
-
}) : /*#__PURE__*/jsxRuntime.jsx(DashReact.Caption2, {
|
|
88183
|
-
className: "italic",
|
|
88184
|
-
children: message.streaming ? "Working…" : "No answer."
|
|
88185
|
-
})
|
|
88186
|
-
})]
|
|
88050
|
+
return /*#__PURE__*/jsxRuntime.jsx(DashReact.ChatMessage, {
|
|
88051
|
+
role: "reply",
|
|
88052
|
+
label: leadLabel(message.from),
|
|
88053
|
+
streaming: !!message.streaming && !_text2,
|
|
88054
|
+
testId: "lead-bubble",
|
|
88055
|
+
children: message.error ? /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
88056
|
+
className: statusTokens.error.icon,
|
|
88057
|
+
children: message.error
|
|
88058
|
+
}) : _text2 ? /*#__PURE__*/jsxRuntime.jsx(AssistantTextContent, {
|
|
88059
|
+
text: _text2
|
|
88060
|
+
}) : /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
88061
|
+
className: "italic",
|
|
88062
|
+
children: message.streaming ? "Working…" : "No answer."
|
|
88063
|
+
})
|
|
88187
88064
|
});
|
|
88188
88065
|
}
|
|
88189
88066
|
return null;
|
|
@@ -88211,11 +88088,6 @@ var ChatMessages = function ChatMessages(_ref) {
|
|
|
88211
88088
|
_ref$codeNote = _ref.codeNote,
|
|
88212
88089
|
codeNote = _ref$codeNote === void 0 ? null : _ref$codeNote;
|
|
88213
88090
|
var scrollRef = React.useRef(null);
|
|
88214
|
-
var _ref2 = React.useContext(DashReact.ThemeContext) || {},
|
|
88215
|
-
currentTheme = _ref2.currentTheme;
|
|
88216
|
-
var t = function t(key) {
|
|
88217
|
-
return (currentTheme === null || currentTheme === void 0 ? void 0 : currentTheme[key]) || "";
|
|
88218
|
-
};
|
|
88219
88091
|
React.useEffect(function () {
|
|
88220
88092
|
if (scrollRef.current) {
|
|
88221
88093
|
scrollRef.current.scrollTop = scrollRef.current.scrollHeight;
|
|
@@ -88223,23 +88095,17 @@ var ChatMessages = function ChatMessages(_ref) {
|
|
|
88223
88095
|
}, [messages, streamingText]);
|
|
88224
88096
|
if (messages.length === 0) {
|
|
88225
88097
|
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
88226
|
-
className: "flex-1 flex items-center justify-center",
|
|
88227
|
-
children: /*#__PURE__*/jsxRuntime.
|
|
88228
|
-
|
|
88229
|
-
|
|
88230
|
-
|
|
88231
|
-
children: "\uD83D\uDCAC"
|
|
88232
|
-
}), /*#__PURE__*/jsxRuntime.jsx(DashReact.Caption2, {
|
|
88233
|
-
block: true,
|
|
88234
|
-
className: "text-sm",
|
|
88235
|
-
children: "Send a message to start chatting"
|
|
88236
|
-
})]
|
|
88098
|
+
className: "flex-1 flex items-center justify-center px-4",
|
|
88099
|
+
children: /*#__PURE__*/jsxRuntime.jsx(DashReact.Caption2, {
|
|
88100
|
+
block: true,
|
|
88101
|
+
className: "text-sm text-center",
|
|
88102
|
+
children: "Send a message to start chatting"
|
|
88237
88103
|
})
|
|
88238
88104
|
});
|
|
88239
88105
|
}
|
|
88240
88106
|
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
88241
88107
|
ref: scrollRef,
|
|
88242
|
-
className: "flex-1 overflow-y-auto px-4 py-3 scroll-smooth",
|
|
88108
|
+
className: "flex-1 overflow-y-auto px-4 py-3 scroll-smooth flex flex-col gap-3",
|
|
88243
88109
|
children: [messages.map(function (message, index) {
|
|
88244
88110
|
var isLastAssistant = message.role === "assistant" && index === messages.length - 1;
|
|
88245
88111
|
var isStreaming = isLastAssistant && streamingRequestId !== null;
|
|
@@ -88250,34 +88116,11 @@ var ChatMessages = function ChatMessages(_ref) {
|
|
|
88250
88116
|
isLast: index === messages.length - 1,
|
|
88251
88117
|
codeNote: codeNote
|
|
88252
88118
|
}, message.id || index);
|
|
88253
|
-
}), isLoading && !streamingRequestId && ((_messages = messages[messages.length - 1]) === null || _messages === void 0 ? void 0 : _messages.role) === "user" && /*#__PURE__*/jsxRuntime.
|
|
88254
|
-
|
|
88255
|
-
|
|
88256
|
-
|
|
88257
|
-
|
|
88258
|
-
children: "Assistant"
|
|
88259
|
-
}), /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
88260
|
-
className: "text-sm leading-relaxed px-3 py-2 rounded-lg italic flex items-center gap-2 opacity-70 ".concat(t("bg-primary-dark"), " ").concat(t("text-primary-medium")),
|
|
88261
|
-
children: [/*#__PURE__*/jsxRuntime.jsxs("span", {
|
|
88262
|
-
className: "inline-flex gap-0.5",
|
|
88263
|
-
children: [/*#__PURE__*/jsxRuntime.jsx("span", {
|
|
88264
|
-
className: "w-1.5 h-1.5 rounded-full animate-bounce ".concat(t("bg-primary-medium")),
|
|
88265
|
-
style: {
|
|
88266
|
-
animationDelay: "0ms"
|
|
88267
|
-
}
|
|
88268
|
-
}), /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
88269
|
-
className: "w-1.5 h-1.5 rounded-full animate-bounce ".concat(t("bg-primary-medium")),
|
|
88270
|
-
style: {
|
|
88271
|
-
animationDelay: "150ms"
|
|
88272
|
-
}
|
|
88273
|
-
}), /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
88274
|
-
className: "w-1.5 h-1.5 rounded-full animate-bounce ".concat(t("bg-primary-medium")),
|
|
88275
|
-
style: {
|
|
88276
|
-
animationDelay: "300ms"
|
|
88277
|
-
}
|
|
88278
|
-
})]
|
|
88279
|
-
}), "Thinking..."]
|
|
88280
|
-
})]
|
|
88119
|
+
}), isLoading && !streamingRequestId && ((_messages = messages[messages.length - 1]) === null || _messages === void 0 ? void 0 : _messages.role) === "user" && /*#__PURE__*/jsxRuntime.jsx(DashReact.ChatMessage, {
|
|
88120
|
+
role: "reply",
|
|
88121
|
+
label: "Assistant",
|
|
88122
|
+
streaming: true,
|
|
88123
|
+
children: "Thinking..."
|
|
88281
88124
|
})]
|
|
88282
88125
|
});
|
|
88283
88126
|
};
|
|
@@ -88341,11 +88184,6 @@ var ChatInput = function ChatInput(_ref) {
|
|
|
88341
88184
|
leads = _ref$leads === void 0 ? null : _ref$leads,
|
|
88342
88185
|
_ref$onPickRecipient = _ref.onPickRecipient,
|
|
88343
88186
|
onPickRecipient = _ref$onPickRecipient === void 0 ? null : _ref$onPickRecipient;
|
|
88344
|
-
var _ref2 = React.useContext(DashReact.ThemeContext) || {},
|
|
88345
|
-
currentTheme = _ref2.currentTheme;
|
|
88346
|
-
var t = function t(key) {
|
|
88347
|
-
return (currentTheme === null || currentTheme === void 0 ? void 0 : currentTheme[key]) || "";
|
|
88348
|
-
};
|
|
88349
88187
|
var _useState = React.useState(""),
|
|
88350
88188
|
_useState2 = _slicedToArray(_useState, 2),
|
|
88351
88189
|
input = _useState2[0],
|
|
@@ -88460,37 +88298,25 @@ var ChatInput = function ChatInput(_ref) {
|
|
|
88460
88298
|
handleSend();
|
|
88461
88299
|
}
|
|
88462
88300
|
};
|
|
88463
|
-
return /*#__PURE__*/jsxRuntime.
|
|
88464
|
-
|
|
88465
|
-
|
|
88301
|
+
return /*#__PURE__*/jsxRuntime.jsx(DashReact.ChatComposer, {
|
|
88302
|
+
ref: textareaRef,
|
|
88303
|
+
value: input,
|
|
88304
|
+
onChange: function onChange(_value, e) {
|
|
88305
|
+
return handleChange(e);
|
|
88306
|
+
},
|
|
88307
|
+
onKeyDown: handleKeyDown,
|
|
88308
|
+
onSend: handleSend,
|
|
88309
|
+
onStop: onStop,
|
|
88310
|
+
busy: !!isLoading,
|
|
88311
|
+
disabled: disabled,
|
|
88312
|
+
rows: 1,
|
|
88313
|
+
placeholder: "Type a message...",
|
|
88314
|
+
hint: queued ? "Sends when the current reply finishes" : "Enter to send · Shift+Enter for a new line",
|
|
88315
|
+
above: mentionOpen ? /*#__PURE__*/jsxRuntime.jsx(LeadMentionMenu, {
|
|
88466
88316
|
options: mentionOptions,
|
|
88467
88317
|
activeIndex: mentionIndex,
|
|
88468
88318
|
onPick: pickMention
|
|
88469
|
-
})
|
|
88470
|
-
className: "flex items-end gap-2",
|
|
88471
|
-
children: [/*#__PURE__*/jsxRuntime.jsx("textarea", {
|
|
88472
|
-
ref: textareaRef,
|
|
88473
|
-
value: input,
|
|
88474
|
-
onChange: handleChange,
|
|
88475
|
-
onKeyDown: handleKeyDown,
|
|
88476
|
-
placeholder: "Type a message...",
|
|
88477
|
-
disabled: disabled,
|
|
88478
|
-
rows: 1,
|
|
88479
|
-
className: "flex-1 px-3 py-2 border rounded-lg text-sm focus:outline-none resize-none disabled:opacity-50 ".concat(t("bg-primary-dark"), " ").concat(t("border-primary-dark"), " ").concat(t("text-primary-medium"))
|
|
88480
|
-
}), isLoading ? /*#__PURE__*/jsxRuntime.jsx(DashReact.Button, {
|
|
88481
|
-
title: "Stop",
|
|
88482
|
-
danger: true,
|
|
88483
|
-
onClick: onStop,
|
|
88484
|
-
className: "shrink-0"
|
|
88485
|
-
}) : /*#__PURE__*/jsxRuntime.jsx(DashReact.Button, {
|
|
88486
|
-
title: "Send",
|
|
88487
|
-
onClick: handleSend,
|
|
88488
|
-
disabled: !input.trim() || disabled,
|
|
88489
|
-
className: "shrink-0"
|
|
88490
|
-
})]
|
|
88491
|
-
}), queued && /*#__PURE__*/jsxRuntime.jsx(DashReact.Caption2, {
|
|
88492
|
-
children: "Sends when the current reply finishes"
|
|
88493
|
-
})]
|
|
88319
|
+
}) : null
|
|
88494
88320
|
});
|
|
88495
88321
|
};
|
|
88496
88322
|
|