@flytedan/flytebot-design-system 0.87.6 → 0.88.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 CHANGED
@@ -934,7 +934,6 @@ __export(index_exports, {
934
934
  CORNER_STACK_INSET_PROPERTY: () => CORNER_STACK_INSET_PROPERTY,
935
935
  CORNER_STACK_OFFSET_PROPERTY: () => CORNER_STACK_OFFSET_PROPERTY,
936
936
  CSV_FAILED_FALLBACK: () => CSV_FAILED_FALLBACK,
937
- CSV_KEPT_NOTE: () => CSV_KEPT_NOTE,
938
937
  Calendar: () => Calendar,
939
938
  CallDeadlineError: () => CallDeadlineError,
940
939
  Card: () => Card,
@@ -978,7 +977,6 @@ __export(index_exports, {
978
977
  ENTITY_ROW_METRIC_WIDTH: () => ENTITY_ROW_METRIC_WIDTH,
979
978
  EXPORT_FAILED_FALLBACK: () => EXPORT_FAILED_FALLBACK,
980
979
  EXPORT_IDLE_POLL_INTERVAL_MS: () => EXPORT_IDLE_POLL_INTERVAL_MS,
981
- EXPORT_KEPT_NOTE: () => EXPORT_KEPT_NOTE,
982
980
  EXPORT_POLL_INTERVAL_MS: () => EXPORT_POLL_INTERVAL_MS,
983
981
  EditableTitle: () => EditableTitle,
984
982
  EmptyState: () => EmptyState,
@@ -14636,8 +14634,9 @@ function useChatEngine(opts) {
14636
14634
  res = await apiAdapter.sendMessage(id, turn.text, ac.signal);
14637
14635
  }
14638
14636
  patch(userId, { pending: false });
14639
- const r = res || {};
14640
- if (r.dispatched && r.job_id) {
14637
+ if (!res) throw new Error("send_failed");
14638
+ const r = res;
14639
+ if (r.dispatched) {
14641
14640
  patch(holderId, { streaming: false, working: true, jobId: r.job_id, text: r.reply || "" });
14642
14641
  await pollJob(r.job_id, holderId);
14643
14642
  } else {
@@ -14652,6 +14651,7 @@ function useChatEngine(opts) {
14652
14651
  model: r.model,
14653
14652
  timestamp: (/* @__PURE__ */ new Date()).toISOString()
14654
14653
  });
14654
+ commit(listRef.current.map((m) => m.id === userId ? { ...m, id: r.user_message_id } : m.id === holderId ? { ...m, id: r.assistant_message_id } : m));
14655
14655
  serverCount.current += 2;
14656
14656
  if (r.packet && onPacket) onPacket(r.packet);
14657
14657
  }
@@ -16004,8 +16004,7 @@ var STATE = {
16004
16004
  failed: { label: "Failed", tone: "danger" }
16005
16005
  };
16006
16006
  var CSV_FAILED_FALLBACK = "The CSV could not be made.";
16007
- var CSV_KEPT_NOTE = "Kept 24 hours";
16008
- function CsvCard({ job, onDownload }) {
16007
+ function CsvCard({ job, keptNote, onDownload }) {
16009
16008
  const [downloading, setDownloading] = React88.useState(false);
16010
16009
  const now = useExpiryClock(job);
16011
16010
  const state = exportStateOf(job, now);
@@ -16022,7 +16021,7 @@ function CsvCard({ job, onDownload }) {
16022
16021
  ] }),
16023
16022
  state === "failed" ? /* @__PURE__ */ (0, import_jsx_runtime115.jsx)("p", { className: "fd-body-sm fd-danger", children: job.failureMessage ?? CSV_FAILED_FALLBACK }) : null,
16024
16023
  facts.length === 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime115.jsx)(FactList, { facts }),
16025
- state === "ready" ? /* @__PURE__ */ (0, import_jsx_runtime115.jsx)("p", { className: "fd-body-sm fd-muted", children: CSV_KEPT_NOTE }) : null,
16024
+ state === "ready" ? /* @__PURE__ */ (0, import_jsx_runtime115.jsx)("p", { className: "fd-body-sm fd-muted", children: keptNote }) : null,
16026
16025
  /* @__PURE__ */ (0, import_jsx_runtime115.jsx)("div", { className: "fd-row fd-wrap fd-gap-sm", children: /* @__PURE__ */ (0, import_jsx_runtime115.jsx)(
16027
16026
  Button,
16028
16027
  {
@@ -17418,7 +17417,7 @@ function createChatAdapter(transport, { onTurnStarted, deadlineMs = CHAT_CALL_DE
17418
17417
  if (err instanceof ChatUnreachableError) throw new Error(CHAT_UNAVAILABLE_MESSAGE);
17419
17418
  throw err;
17420
17419
  }
17421
- if (result.job_id) throw new Error("A streamed turn must end with its final result, not a job to poll.");
17420
+ if (result.dispatched) throw new Error("A streamed turn must end with its final result, not a job to poll.");
17422
17421
  markStarted();
17423
17422
  return result;
17424
17423
  }
@@ -17543,16 +17542,15 @@ function useExportJobs({ list, acknowledge }) {
17543
17542
  // src/kits/exports/ExportTray.tsx
17544
17543
  var React96 = __toESM(require("react"), 1);
17545
17544
  var import_jsx_runtime118 = require("react/jsx-runtime");
17546
- var EXPORT_KEPT_NOTE = "Kept for 24 hours";
17547
17545
  var EXPORT_FAILED_FALLBACK = "Unknown error.";
17548
- function exportToJob(job, onDownload) {
17546
+ function exportToJob(job, keptNote, onDownload) {
17549
17547
  const base = { id: job.id, title: job.title, note: job.note };
17550
17548
  if (job.status === "SUCCEEDED") {
17551
17549
  return {
17552
17550
  ...base,
17553
17551
  status: "done",
17554
17552
  action: { label: "Download", icon: "download-simple", onClick: () => onDownload(job.id) },
17555
- doneNote: EXPORT_KEPT_NOTE
17553
+ doneNote: keptNote
17556
17554
  };
17557
17555
  }
17558
17556
  if (job.status === "FAILED") {
@@ -17560,8 +17558,8 @@ function exportToJob(job, onDownload) {
17560
17558
  }
17561
17559
  return { ...base, status: "active" };
17562
17560
  }
17563
- function ExportTray({ exports: exports2, onDownload, onDismiss }) {
17564
- const jobs2 = React96.useMemo(() => exports2.map((job) => exportToJob(job, onDownload)), [exports2, onDownload]);
17561
+ function ExportTray({ exports: exports2, keptNote, onDownload, onDismiss }) {
17562
+ const jobs2 = React96.useMemo(() => exports2.map((job) => exportToJob(job, keptNote, onDownload)), [exports2, keptNote, onDownload]);
17565
17563
  return /* @__PURE__ */ (0, import_jsx_runtime118.jsx)(JobTray, { jobs: jobs2, onDismiss });
17566
17564
  }
17567
17565
  // Annotate the CommonJS export names for ESM import in node:
@@ -17591,7 +17589,6 @@ function ExportTray({ exports: exports2, onDownload, onDismiss }) {
17591
17589
  CORNER_STACK_INSET_PROPERTY,
17592
17590
  CORNER_STACK_OFFSET_PROPERTY,
17593
17591
  CSV_FAILED_FALLBACK,
17594
- CSV_KEPT_NOTE,
17595
17592
  Calendar,
17596
17593
  CallDeadlineError,
17597
17594
  Card,
@@ -17635,7 +17632,6 @@ function ExportTray({ exports: exports2, onDownload, onDismiss }) {
17635
17632
  ENTITY_ROW_METRIC_WIDTH,
17636
17633
  EXPORT_FAILED_FALLBACK,
17637
17634
  EXPORT_IDLE_POLL_INTERVAL_MS,
17638
- EXPORT_KEPT_NOTE,
17639
17635
  EXPORT_POLL_INTERVAL_MS,
17640
17636
  EditableTitle,
17641
17637
  EmptyState,