@flytedan/flytebot-design-system 0.71.7 → 0.72.0
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.cjs +35 -15
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +35 -4
- package/dist/index.d.ts +35 -4
- package/dist/index.js +35 -15
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/styles/components.css +10 -5
package/dist/index.cjs
CHANGED
|
@@ -2083,7 +2083,7 @@ function Collapsible({
|
|
|
2083
2083
|
var React6 = __toESM(require("react"), 1);
|
|
2084
2084
|
var import_react_dom3 = require("react-dom");
|
|
2085
2085
|
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
2086
|
-
function Drawer({ open: open2 = true, title, onClose, footer, children, className = "", ...rest }) {
|
|
2086
|
+
function Drawer({ open: open2 = true, title, onClose, footer, bare = false, children, className = "", ...rest }) {
|
|
2087
2087
|
const asideRef = React6.useRef(null);
|
|
2088
2088
|
const [closing, setClosing] = React6.useState(false);
|
|
2089
2089
|
const close2 = React6.useCallback(() => {
|
|
@@ -2097,12 +2097,12 @@ function Drawer({ open: open2 = true, title, onClose, footer, children, classNam
|
|
|
2097
2097
|
return (0, import_react_dom3.createPortal)(
|
|
2098
2098
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(StackedLayerProvider, { layer, children: [
|
|
2099
2099
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "fd-scrim" + (closing ? " is-closing" : ""), style: { display: "block", zIndex: zIndex - LAYER_STEP }, onClick: close2 }),
|
|
2100
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("aside", { ref: asideRef, className: ["fd-drawer", closing ? "is-closing" : "", className].filter(Boolean).join(" "), role: "dialog", "aria-modal": "true", ...rest, style: { zIndex }, children: [
|
|
2101
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "fd-card-head", style: { flex: "none" }, children: [
|
|
2100
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("aside", { ref: asideRef, className: ["fd-drawer", bare ? "is-bare" : "", closing ? "is-closing" : "", className].filter(Boolean).join(" "), role: "dialog", "aria-modal": "true", "aria-label": bare && typeof title === "string" ? title : void 0, ...rest, style: { zIndex }, children: [
|
|
2101
|
+
bare ? null : /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "fd-card-head", style: { flex: "none" }, children: [
|
|
2102
2102
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "fd-card-head-title", title: truncationTitle(title), children: title }),
|
|
2103
2103
|
onClose ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("button", { type: "button", className: "fd-btn-icon", "aria-label": "Close", onClick: close2, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("i", { className: "ph ph-x" }) }) : null
|
|
2104
2104
|
] }),
|
|
2105
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { style: { flex: "1 1 auto", minHeight: 0, overflow: "auto", padding: 20 }, children }),
|
|
2105
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { style: bare ? { flex: "1 1 auto", minHeight: 0, display: "flex", flexDirection: "column" } : { flex: "1 1 auto", minHeight: 0, overflow: "auto", padding: 20 }, children: typeof children === "function" ? children(close2) : children }),
|
|
2106
2106
|
footer ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "fd-card-foot", style: { flex: "none" }, children: typeof footer === "function" ? footer(close2) : footer }) : null
|
|
2107
2107
|
] })
|
|
2108
2108
|
] }),
|
|
@@ -7070,7 +7070,8 @@ function StepList({
|
|
|
7070
7070
|
onToggle,
|
|
7071
7071
|
showDurations = true,
|
|
7072
7072
|
dense = false,
|
|
7073
|
-
className = ""
|
|
7073
|
+
className = "",
|
|
7074
|
+
active = false
|
|
7074
7075
|
}) {
|
|
7075
7076
|
const [openState, setOpenState] = React39.useState(defaultOpen);
|
|
7076
7077
|
const open2 = openProp == null ? openState : openProp;
|
|
@@ -7080,15 +7081,15 @@ function StepList({
|
|
|
7080
7081
|
const failed = steps.filter((s) => s.status === "error").length;
|
|
7081
7082
|
const total = steps.reduce((n, s) => n + (s.durationMs || 0), 0);
|
|
7082
7083
|
const current2 = steps.filter((s) => s.status === "running").slice(-1)[0];
|
|
7083
|
-
const summary = label || (running ? current2 ? current2.label : "Working" : total ? "Worked for " + formatDuration(total) : "Steps");
|
|
7084
|
+
const summary = label || (running ? current2 ? current2.label : "Working" : active ? "Steps so far" : total ? "Worked for " + formatDuration(total) : "Steps");
|
|
7084
7085
|
const toggle = () => {
|
|
7085
7086
|
const next = !open2;
|
|
7086
7087
|
if (openProp == null) setOpenState(next);
|
|
7087
7088
|
onToggle && onToggle(next);
|
|
7088
7089
|
};
|
|
7089
|
-
return /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("div", { className: ["fd-steps", dense ? "is-dense" : "", open2 ? "is-open" : "", className].filter(Boolean).join(" "), children: [
|
|
7090
|
+
return /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("div", { className: ["fd-steps", dense ? "is-dense" : "", active ? "is-active" : "", open2 ? "is-open" : "", className].filter(Boolean).join(" "), children: [
|
|
7090
7091
|
/* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("button", { type: "button", className: "fd-steps-head", onClick: toggle, "aria-expanded": open2, children: [
|
|
7091
|
-
running ? /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("span", { className: "fd-steps-spin", "aria-hidden": "true" }) : /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("i", { className: "ph ph-" + (failed ? "warning-circle" : "check-circle"), "aria-hidden": "true" }),
|
|
7092
|
+
running ? /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("span", { className: "fd-steps-spin", "aria-hidden": "true" }) : /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("i", { className: "ph ph-" + (failed ? "warning-circle" : active ? "list-checks" : "check-circle"), "aria-hidden": "true" }),
|
|
7092
7093
|
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)("span", { className: "fd-steps-title", title: truncationTitle(summary), children: summary }),
|
|
7093
7094
|
/* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("span", { className: "fd-steps-count fd-tabular", children: [
|
|
7094
7095
|
steps.length,
|
|
@@ -13605,6 +13606,20 @@ function jobBucket(status) {
|
|
|
13605
13606
|
if (JOB_SUCCESS.indexOf(s) !== -1) return "success";
|
|
13606
13607
|
return "failure";
|
|
13607
13608
|
}
|
|
13609
|
+
function defaultDescribeWaiting(pending) {
|
|
13610
|
+
return "Waiting on " + pending.length + " background " + (pending.length === 1 ? "task" : "tasks");
|
|
13611
|
+
}
|
|
13612
|
+
function withWaiting(list, describe) {
|
|
13613
|
+
const pending = list.filter((m) => m.taskPending);
|
|
13614
|
+
let turn = -1;
|
|
13615
|
+
list.forEach((m, i) => {
|
|
13616
|
+
if (m.working) turn = i;
|
|
13617
|
+
});
|
|
13618
|
+
return list.map((m, i) => {
|
|
13619
|
+
const want = i === turn && pending.length ? describe(pending) : void 0;
|
|
13620
|
+
return m.waitingFor === want ? m : Object.assign({}, m, { waitingFor: want });
|
|
13621
|
+
});
|
|
13622
|
+
}
|
|
13608
13623
|
function useChatEngine(opts) {
|
|
13609
13624
|
const {
|
|
13610
13625
|
contextType,
|
|
@@ -13614,6 +13629,7 @@ function useChatEngine(opts) {
|
|
|
13614
13629
|
threadId: threadIdProp,
|
|
13615
13630
|
pollIntervalMs = 1500,
|
|
13616
13631
|
pendingTimeoutMs = 18e4,
|
|
13632
|
+
describeWaiting = defaultDescribeWaiting,
|
|
13617
13633
|
store = safeStore,
|
|
13618
13634
|
onPacket,
|
|
13619
13635
|
onThreadReady,
|
|
@@ -13648,9 +13664,12 @@ function useChatEngine(opts) {
|
|
|
13648
13664
|
mounted.current = false;
|
|
13649
13665
|
};
|
|
13650
13666
|
}, []);
|
|
13667
|
+
const describeWaitingRef = React70.useRef(describeWaiting);
|
|
13668
|
+
describeWaitingRef.current = describeWaiting;
|
|
13651
13669
|
const commit = (next) => {
|
|
13652
|
-
|
|
13653
|
-
|
|
13670
|
+
const derived = withWaiting(next, (pending) => describeWaitingRef.current(pending));
|
|
13671
|
+
listRef.current = derived;
|
|
13672
|
+
if (mounted.current) setMessages(derived);
|
|
13654
13673
|
};
|
|
13655
13674
|
const patch = (id, p) => commit(listRef.current.map((m) => m.id === id ? Object.assign({}, m, typeof p === "function" ? p(m) : p) : m));
|
|
13656
13675
|
const push = (...msgs) => commit(listRef.current.concat(msgs));
|
|
@@ -14127,7 +14146,7 @@ function MessageBody({ message: m, ctx }) {
|
|
|
14127
14146
|
const showMd = ctx.markdown && !isUser;
|
|
14128
14147
|
return /* @__PURE__ */ (0, import_jsx_runtime102.jsxs)("div", { className: "fdc-body", children: [
|
|
14129
14148
|
m.thinking && ctx.showThinking ? /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(ThinkingBlock, { text: m.thinking, durationMs: m.thinkingMs, streaming: m.streaming && !m.text }) : null,
|
|
14130
|
-
m.steps && m.steps.length && ctx.showSteps ? /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(StepList, { steps: m.steps, defaultOpen: m.steps.some((s) => s.status === "running"), dense: true }) : null,
|
|
14149
|
+
m.steps && m.steps.length && ctx.showSteps ? /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(StepList, { steps: m.steps, defaultOpen: m.steps.some((s) => s.status === "running"), active: !!m.working, dense: true }) : null,
|
|
14131
14150
|
body ? /* @__PURE__ */ (0, import_jsx_runtime102.jsxs)("div", { className: "fdc-text" + (isUser ? " is-user" : ""), children: [
|
|
14132
14151
|
showMd ? /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(Markdown, { source: body, headingOffset: 2, codeProps: { collapseAfter: 22 }, renderCitation: ctx.renderCitation }) : /* @__PURE__ */ (0, import_jsx_runtime102.jsx)("div", { className: "fdc-plain", children: body }),
|
|
14133
14152
|
m.streaming ? /* @__PURE__ */ (0, import_jsx_runtime102.jsx)("span", { className: "fdc-caret", "aria-hidden": "true" }) : null
|
|
@@ -14159,8 +14178,8 @@ function MessageBody({ message: m, ctx }) {
|
|
|
14159
14178
|
/* @__PURE__ */ (0, import_jsx_runtime102.jsx)("span", {})
|
|
14160
14179
|
] }),
|
|
14161
14180
|
/* @__PURE__ */ (0, import_jsx_runtime102.jsxs)("span", { className: "fdc-working-label", children: [
|
|
14162
|
-
m.resumed ? "Resuming" : "Working",
|
|
14163
|
-
m.job && m.job.status ? /* @__PURE__ */ (0, import_jsx_runtime102.jsxs)("span", { className: "fdc-working-job", children: [
|
|
14181
|
+
m.waitingFor || (m.resumed ? "Resuming" : "Working"),
|
|
14182
|
+
!m.waitingFor && m.job && m.job.status ? /* @__PURE__ */ (0, import_jsx_runtime102.jsxs)("span", { className: "fdc-working-job", children: [
|
|
14164
14183
|
" \xB7 ",
|
|
14165
14184
|
m.job.status
|
|
14166
14185
|
] }) : null,
|
|
@@ -14168,8 +14187,7 @@ function MessageBody({ message: m, ctx }) {
|
|
|
14168
14187
|
" \xB7 ",
|
|
14169
14188
|
m.job.detail
|
|
14170
14189
|
] }) : null
|
|
14171
|
-
] })
|
|
14172
|
-
m.jobId ? /* @__PURE__ */ (0, import_jsx_runtime102.jsx)("span", { className: "fdc-working-id fd-mono", children: String(m.jobId).slice(0, 12) }) : null
|
|
14190
|
+
] })
|
|
14173
14191
|
] }) : null,
|
|
14174
14192
|
m.stopped ? /* @__PURE__ */ (0, import_jsx_runtime102.jsxs)("div", { className: "fdc-stopped", children: [
|
|
14175
14193
|
/* @__PURE__ */ (0, import_jsx_runtime102.jsx)("i", { className: "ph ph-stop-circle", "aria-hidden": "true" }),
|
|
@@ -14866,6 +14884,7 @@ function AgentChatPanel({
|
|
|
14866
14884
|
packetRenderers,
|
|
14867
14885
|
onApplyPacket,
|
|
14868
14886
|
pendingTimeoutMs,
|
|
14887
|
+
describeWaiting,
|
|
14869
14888
|
onOpenAttachment,
|
|
14870
14889
|
errorCopy,
|
|
14871
14890
|
/* composer */
|
|
@@ -14928,6 +14947,7 @@ function AgentChatPanel({
|
|
|
14928
14947
|
initialMessage,
|
|
14929
14948
|
threadId,
|
|
14930
14949
|
pendingTimeoutMs,
|
|
14950
|
+
describeWaiting,
|
|
14931
14951
|
onPacket,
|
|
14932
14952
|
onThreadReady,
|
|
14933
14953
|
onError,
|