@flytedan/flytebot-design-system 0.89.0 → 0.90.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
@@ -1120,6 +1120,7 @@ __export(index_exports, {
1120
1120
  extensionOf: () => extensionOf,
1121
1121
  extractClipboardFiles: () => extractClipboardFiles,
1122
1122
  filterFiles: () => filterFiles,
1123
+ folderFiles: () => folderFiles,
1123
1124
  formatAbsolute: () => formatAbsolute,
1124
1125
  formatBytes: () => formatBytes,
1125
1126
  formatClock: () => formatClock,
@@ -1142,6 +1143,7 @@ __export(index_exports, {
1142
1143
  isUsStateCode: () => isUsStateCode,
1143
1144
  isWithinLayerTree: () => isWithinLayerTree,
1144
1145
  jobBucket: () => jobBucket,
1146
+ jsonPathPosition: () => jsonPathPosition,
1145
1147
  languageLabel: () => languageLabel,
1146
1148
  loadPrefs: () => loadPrefs,
1147
1149
  markdownToText: () => markdownToText,
@@ -3440,11 +3442,13 @@ function AppShell({
3440
3442
  );
3441
3443
  }
3442
3444
 
3445
+ // src/components/navigation/flytedeskLogo.ts
3446
+ var FLYTEDESK_LOGO_SRC = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iOTUiIGhlaWdodD0iMzYiIHZpZXdCb3g9IjAgMCA5NSAzNiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPGcgY2xpcC1wYXRoPSJ1cmwoI2NsaXAwXzg2NzNfNTU0KSI+CjxwYXRoIGQ9Ik01Ljg4OTk1IDEzLjU2NjNDNi4zNDU5NSAxMy41NjYzIDYuNjExOTUgMTMuNjMyNiA2Ljc1NDQ1IDEzLjY3MDRWMTEuMzYxOUM2LjUyNjQ1IDExLjI1NzkgNS45NjU5NSAxMS4xNTM4IDUuMzg2NDYgMTEuMTUzOEMzLjEzNDk4IDExLjE1MzggMS42OTA5OSAxMi42MzkyIDEuNjkwOTkgMTQu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nPgo8ZGVmcz4KPGNsaXBQYXRoIGlkPSJjbGlwMF84NjczXzU1NCI+CjxyZWN0IHdpZHRoPSI5NSIgaGVpZ2h0PSIzNiIgZmlsbD0id2hpdGUiLz4KPC9jbGlwUGF0aD4KPC9kZWZzPgo8L3N2Zz4K";
3447
+
3443
3448
  // src/components/navigation/FlytedeskBrand.tsx
3444
3449
  var import_jsx_runtime29 = require("react/jsx-runtime");
3445
- var LOGO_SRC = "https://cdn.prod.website-files.com/69a96def413819b7db64de8c/69ac8ec2ed84b986a5fb76dc_Logo%20(dark)%202.svg";
3446
3450
  function FlytedeskMark({ size = "md", className = "", ...rest }) {
3447
- return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: ["fd-brand-mark", size !== "md" ? "fd-brand-mark-" + size : "", className].filter(Boolean).join(" "), ...rest, children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("img", { src: LOGO_SRC, alt: "flytedesk" }) });
3451
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: ["fd-brand-mark", size !== "md" ? "fd-brand-mark-" + size : "", className].filter(Boolean).join(" "), ...rest, children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("img", { src: FLYTEDESK_LOGO_SRC, alt: "flytedesk" }) });
3448
3452
  }
3449
3453
  function FlytedeskBrand({ appName, size = "md", className = "", ...rest }) {
3450
3454
  return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("span", { className: ["fd-brand", size !== "md" ? "fd-brand-" + size : "", className].filter(Boolean).join(" "), ...rest, children: [
@@ -3515,28 +3519,28 @@ function Tabs({ tabs = [], value, onChange, className = "", ...rest }) {
3515
3519
  "data-more-end": more.end ? "true" : void 0,
3516
3520
  ...rest,
3517
3521
  children: tabs.map((t) => {
3518
- const item = typeof t === "string" ? { value: t, label: t } : t;
3522
+ const item2 = typeof t === "string" ? { value: t, label: t } : t;
3519
3523
  return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
3520
3524
  "button",
3521
3525
  {
3522
3526
  type: "button",
3523
3527
  role: "tab",
3524
3528
  className: "fd-tab",
3525
- "aria-selected": item.value === value,
3526
- onClick: onChange ? () => onChange(item.value) : void 0,
3529
+ "aria-selected": item2.value === value,
3530
+ onClick: onChange ? () => onChange(item2.value) : void 0,
3527
3531
  children: [
3528
- item.label,
3529
- item.count !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
3532
+ item2.label,
3533
+ item2.count !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
3530
3534
  "span",
3531
3535
  {
3532
- className: "fd-badge " + (item.tone === "attention" ? "fd-badge-warning" : "fd-badge-neutral"),
3536
+ className: "fd-badge " + (item2.tone === "attention" ? "fd-badge-warning" : "fd-badge-neutral"),
3533
3537
  style: { height: 20, padding: "0 7px" },
3534
- children: item.count
3538
+ children: item2.count
3535
3539
  }
3536
3540
  ) : null
3537
3541
  ]
3538
3542
  },
3539
- item.value
3543
+ item2.value
3540
3544
  );
3541
3545
  })
3542
3546
  }
@@ -3795,7 +3799,7 @@ function ToastProvider({ children }) {
3795
3799
  const timers = React28.useRef(/* @__PURE__ */ new Map());
3796
3800
  const nextId = React28.useRef(1);
3797
3801
  const dismiss = React28.useCallback((id) => {
3798
- setItems((current2) => current2.filter((item) => item.id !== id));
3802
+ setItems((current2) => current2.filter((item2) => item2.id !== id));
3799
3803
  const timer = timers.current.get(id);
3800
3804
  if (timer !== void 0) {
3801
3805
  clearTimeout(timer);
@@ -3821,7 +3825,7 @@ function ToastProvider({ children }) {
3821
3825
  const api = React28.useMemo(() => ({ show }), [show]);
3822
3826
  return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(ToastContext.Provider, { value: api, children: [
3823
3827
  children,
3824
- /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(CornerStackPortal, { slot: "toasts", children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "fd-toast-region", "aria-live": "polite", children: items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Toast, { title: item.title, tone: item.tone, onDismiss: () => dismiss(item.id) }, item.id)) }) })
3828
+ /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(CornerStackPortal, { slot: "toasts", children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "fd-toast-region", "aria-live": "polite", children: items.map((item2) => /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Toast, { title: item2.title, tone: item2.tone, onDismiss: () => dismiss(item2.id) }, item2.id)) }) })
3825
3829
  ] });
3826
3830
  }
3827
3831
  function useToast() {
@@ -4048,6 +4052,14 @@ var FileKit = {
4048
4052
  toAttachment,
4049
4053
  revokeAttachment
4050
4054
  };
4055
+ function folderFiles(files) {
4056
+ return files.map((file) => {
4057
+ const relative = file.webkitRelativePath;
4058
+ const slash = relative ? relative.indexOf("/") : -1;
4059
+ if (slash < 0) throw new Error(`folderFiles: ${file.name} has no folder path; it did not come from a folder pick.`);
4060
+ return { file, path: relative.slice(slash + 1) };
4061
+ });
4062
+ }
4051
4063
 
4052
4064
  // src/components/data/SegmentedMeter.tsx
4053
4065
  var import_jsx_runtime42 = require("react/jsx-runtime");
@@ -7832,8 +7844,8 @@ function VirtualList({
7832
7844
  const prev = lastKeysRef.current;
7833
7845
  if (!prev) return /* @__PURE__ */ new Set();
7834
7846
  const fresh = /* @__PURE__ */ new Set();
7835
- for (const item of items) {
7836
- const k = keyOf(item);
7847
+ for (const item2 of items) {
7848
+ const k = keyOf(item2);
7837
7849
  if (!prev.has(k)) fresh.add(k);
7838
7850
  }
7839
7851
  return fresh;
@@ -7847,16 +7859,16 @@ function VirtualList({
7847
7859
  }
7848
7860
  const rows = [];
7849
7861
  for (let i = win.startIndex; i <= win.endIndex; i++) {
7850
- const item = items[i - firstItemIndex];
7851
- if (item === void 0) continue;
7852
- const key = keyOf(item);
7862
+ const item2 = items[i - firstItemIndex];
7863
+ if (item2 === void 0) continue;
7864
+ const key = keyOf(item2);
7853
7865
  rows.push(
7854
7866
  /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
7855
7867
  "div",
7856
7868
  {
7857
7869
  className: "fd-vlist-row",
7858
7870
  style: { height: itemHeight, boxSizing: "border-box", transform: "translateY(" + i * itemHeight + "px)" },
7859
- children: /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("div", { className: newKeys.has(key) ? "fd-vlist-row-content fd-vlist-row-enter" : "fd-vlist-row-content", children: renderItem(item, i) })
7871
+ children: /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("div", { className: newKeys.has(key) ? "fd-vlist-row-content fd-vlist-row-enter" : "fd-vlist-row-content", children: renderItem(item2, i) })
7860
7872
  },
7861
7873
  key
7862
7874
  )
@@ -8112,15 +8124,15 @@ function TransferList({
8112
8124
  (side, key) => (side === "left" ? left.items : right.items).find((it) => keyOf(it) === key),
8113
8125
  [left.items, right.items, keyOf]
8114
8126
  );
8115
- const beginDrag = (e, item, from) => {
8127
+ const beginDrag = (e, item2, from) => {
8116
8128
  if (e.button !== 0) return;
8117
8129
  if (e.target.closest && e.target.closest("button")) return;
8118
8130
  e.preventDefault();
8119
8131
  const rect = e.currentTarget.getBoundingClientRect();
8120
8132
  armedRef.current = {
8121
- item,
8133
+ item: item2,
8122
8134
  from,
8123
- key: keyOf(item),
8135
+ key: keyOf(item2),
8124
8136
  pointerId: e.pointerId,
8125
8137
  startX: e.clientX,
8126
8138
  startY: e.clientY,
@@ -8170,8 +8182,8 @@ function TransferList({
8170
8182
  if (!wasDragging) return;
8171
8183
  const hit = hitTestSide(e.clientX, e.clientY);
8172
8184
  if (hit && hit !== armed.from) {
8173
- const item = findItem(armed.from, armed.key);
8174
- if (item !== void 0) onMove(item, armed.from, hit);
8185
+ const item2 = findItem(armed.from, armed.key);
8186
+ if (item2 !== void 0) onMove(item2, armed.from, hit);
8175
8187
  }
8176
8188
  };
8177
8189
  window.addEventListener("pointermove", onMovePointer);
@@ -8225,19 +8237,19 @@ function TransferList({
8225
8237
  totalCount: cfg.totalCount,
8226
8238
  onNeedMore: cfg.onNeedMore,
8227
8239
  emptyState: /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(EmptyState, { icon: "tray", title: "Nothing here" }),
8228
- renderItem: (item) => {
8229
- const isBeingDragged = drag != null && drag.from === side && drag.key === keyOf(item);
8240
+ renderItem: (item2) => {
8241
+ const isBeingDragged = drag != null && drag.from === side && drag.key === keyOf(item2);
8230
8242
  if (isBeingDragged) {
8231
8243
  return /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("div", { className: "fd-erow-placeholder", "aria-hidden": "true" });
8232
8244
  }
8233
- const content = renderRow(item);
8245
+ const content = renderRow(item2);
8234
8246
  const destination = (side === "left" ? right : left).label || "the other list";
8235
8247
  return /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
8236
8248
  EntityRow,
8237
8249
  {
8238
8250
  ...content,
8239
8251
  draggable: true,
8240
- onPointerDown: (e) => beginDrag(e, item, side),
8252
+ onPointerDown: (e) => beginDrag(e, item2, side),
8241
8253
  action: {
8242
8254
  icon: side === "left" ? "plus" : "minus",
8243
8255
  // Names the row AND where it goes. A list repeats this button on every
@@ -8245,7 +8257,7 @@ function TransferList({
8245
8257
  // over to a screen reader, with nothing to tell one button from the next.
8246
8258
  label: "Move " + content.title + " to " + destination,
8247
8259
  tone: side === "left" ? "add" : "remove",
8248
- onClick: () => onMove(item, side, opposite)
8260
+ onClick: () => onMove(item2, side, opposite)
8249
8261
  }
8250
8262
  }
8251
8263
  );
@@ -9291,6 +9303,8 @@ function Dropzone({
9291
9303
  }
9292
9304
  function FilePickButton({
9293
9305
  onFiles,
9306
+ onFolder,
9307
+ directory = false,
9294
9308
  onReject,
9295
9309
  accept,
9296
9310
  maxFileSize,
@@ -9323,10 +9337,14 @@ function FilePickButton({
9323
9337
  accept,
9324
9338
  multiple,
9325
9339
  className: "fd-sr",
9340
+ ...directory ? { webkitdirectory: "" } : {},
9326
9341
  onChange: (e) => {
9327
9342
  const { accepted, rejected } = filterFiles(e.target.files, { accept, maxFileSize });
9328
9343
  if (rejected.length && onReject) onReject(rejected);
9329
- if (accepted.length && onFiles) onFiles(accepted);
9344
+ if (accepted.length) {
9345
+ if (directory) onFolder?.(folderFiles(accepted));
9346
+ else onFiles?.(accepted);
9347
+ }
9330
9348
  e.target.value = "";
9331
9349
  }
9332
9350
  }
@@ -10271,6 +10289,75 @@ function CodeEditor({
10271
10289
  ] });
10272
10290
  }
10273
10291
 
10292
+ // src/components/forms/jsonPath.ts
10293
+ var import_state3 = require("@codemirror/state");
10294
+ var import_lang_json3 = require("@codemirror/lang-json");
10295
+ var VALUE_NODES = /* @__PURE__ */ new Set(["Object", "Array", "String", "Number", "True", "False", "Null"]);
10296
+ function valueChild(node) {
10297
+ for (let child = node.firstChild; child; child = child.nextSibling) {
10298
+ if (VALUE_NODES.has(child.name)) return child;
10299
+ }
10300
+ return null;
10301
+ }
10302
+ function member(text, object2, key) {
10303
+ let found = null;
10304
+ for (let prop = object2.firstChild; prop; prop = prop.nextSibling) {
10305
+ if (prop.name !== "Property") continue;
10306
+ const name = prop.getChild("PropertyName");
10307
+ const value = valueChild(prop);
10308
+ if (name && value && JSON.parse(text.slice(name.from, name.to)) === key) found = { name, value };
10309
+ }
10310
+ return found;
10311
+ }
10312
+ function item(array, index) {
10313
+ let at = 0;
10314
+ for (let child = array.firstChild; child; child = child.nextSibling) {
10315
+ if (VALUE_NODES.has(child.name) && at++ === index) return child;
10316
+ }
10317
+ return null;
10318
+ }
10319
+ function jsonPathPosition(text, path, anchor = "value") {
10320
+ try {
10321
+ JSON.parse(text);
10322
+ } catch (e) {
10323
+ if (e instanceof SyntaxError) return null;
10324
+ throw e;
10325
+ }
10326
+ const doc = import_state3.EditorState.create({ doc: text }).doc;
10327
+ const normalized = doc.toString();
10328
+ const root = valueChild((0, import_lang_json3.json)().language.parser.parse(normalized).topNode);
10329
+ if (!root) return null;
10330
+ let target = root;
10331
+ let key = null;
10332
+ let exact = true;
10333
+ for (const step of path) {
10334
+ let next = null;
10335
+ if (target.name === "Object" && typeof step === "string") next = member(normalized, target, step);
10336
+ else if (target.name === "Array" && typeof step === "number") {
10337
+ const value = item(target, step);
10338
+ next = value && { name: null, value };
10339
+ }
10340
+ if (!next) {
10341
+ exact = false;
10342
+ break;
10343
+ }
10344
+ target = next.value;
10345
+ key = next.name;
10346
+ }
10347
+ const span = anchor === "key" && exact && key ? key : target;
10348
+ const from = span.from;
10349
+ const to = span.name === "Object" || span.name === "Array" ? span.from + 1 : span.to;
10350
+ const start = doc.lineAt(from);
10351
+ const end = doc.lineAt(to);
10352
+ return {
10353
+ line: start.number,
10354
+ column: from - start.from + 1,
10355
+ endLine: end.number,
10356
+ endColumn: to - end.from + 1,
10357
+ exact
10358
+ };
10359
+ }
10360
+
10274
10361
  // src/components/forms/RadioGroup.tsx
10275
10362
  var React62 = __toESM(require("react"), 1);
10276
10363
  var import_jsx_runtime88 = require("react/jsx-runtime");
@@ -10326,18 +10413,18 @@ function useSessionContext() {
10326
10413
  var import_jsx_runtime90 = require("react/jsx-runtime");
10327
10414
  var DEFAULT_LINKS = [];
10328
10415
  var DEFAULT_GROUPS = [];
10329
- function Item({ item, onPick }) {
10416
+ function Item({ item: item2, onPick }) {
10330
10417
  return /* @__PURE__ */ (0, import_jsx_runtime90.jsxs)(
10331
10418
  "button",
10332
10419
  {
10333
10420
  type: "button",
10334
10421
  role: "menuitem",
10335
10422
  className: "fd-acct-item",
10336
- onClick: () => onPick(item),
10423
+ onClick: () => onPick(item2),
10337
10424
  children: [
10338
- item.icon ? /* @__PURE__ */ (0, import_jsx_runtime90.jsx)("i", { className: "ph ph-" + item.icon, "aria-hidden": "true" }) : null,
10339
- /* @__PURE__ */ (0, import_jsx_runtime90.jsx)("span", { style: { flex: 1 }, children: item.label }),
10340
- item.badge ? /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(Badge, { tone: "neutral", children: item.badge }) : null
10425
+ item2.icon ? /* @__PURE__ */ (0, import_jsx_runtime90.jsx)("i", { className: "ph ph-" + item2.icon, "aria-hidden": "true" }) : null,
10426
+ /* @__PURE__ */ (0, import_jsx_runtime90.jsx)("span", { style: { flex: 1 }, children: item2.label }),
10427
+ item2.badge ? /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(Badge, { tone: "neutral", children: item2.badge }) : null
10341
10428
  ]
10342
10429
  }
10343
10430
  );
@@ -10364,11 +10451,11 @@ function AccountMenu({
10364
10451
  setOpen(false);
10365
10452
  setSignOutError(null);
10366
10453
  };
10367
- const pick = (item) => {
10454
+ const pick = (item2) => {
10368
10455
  closeMenu();
10369
- if (item.onSelect) return item.onSelect();
10370
- if (onNavigate) return onNavigate(item.href, item);
10371
- if (item.href) window.location.href = item.href;
10456
+ if (item2.onSelect) return item2.onSelect();
10457
+ if (onNavigate) return onNavigate(item2.href, item2);
10458
+ if (item2.href) window.location.href = item2.href;
10372
10459
  };
10373
10460
  const signOut = async () => {
10374
10461
  const handler = onSignOut ?? ctxSignOut;
@@ -13026,41 +13113,41 @@ var fmtDate = (iso2) => {
13026
13113
  const d = /* @__PURE__ */ new Date(String(iso2) + "T00:00:00");
13027
13114
  return isNaN(d) ? iso2 : d.toLocaleDateString(void 0, { month: "short", day: "numeric", year: "numeric" });
13028
13115
  };
13029
- function RoadmapCard({ item, byKey, onOpenFlag }) {
13030
- const s = STATUS[item.status] || STATUS.planned;
13031
- const deps = (item.dependsOn || []).map((k) => byKey[k]).filter(Boolean);
13116
+ function RoadmapCard({ item: item2, byKey, onOpenFlag }) {
13117
+ const s = STATUS[item2.status] || STATUS.planned;
13118
+ const deps = (item2.dependsOn || []).map((k) => byKey[k]).filter(Boolean);
13032
13119
  const blocking = deps.filter((d) => !d.implemented);
13033
13120
  return /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(Card, { elevation: "flat", children: /* @__PURE__ */ (0, import_jsx_runtime97.jsxs)("div", { className: "fd-stack", style: { gap: 10 }, children: [
13034
13121
  /* @__PURE__ */ (0, import_jsx_runtime97.jsxs)("div", { className: "fd-row", style: { gap: 8, flexWrap: "wrap" }, children: [
13035
- /* @__PURE__ */ (0, import_jsx_runtime97.jsx)("span", { className: "fd-body", style: { fontWeight: 700, flex: 1, minWidth: 140 }, children: item.label }),
13036
- /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(Badge, { tone: "neutral", icon: PROJECT_ICON[item.project] || "squares-four", children: item.project }),
13122
+ /* @__PURE__ */ (0, import_jsx_runtime97.jsx)("span", { className: "fd-body", style: { fontWeight: 700, flex: 1, minWidth: 140 }, children: item2.label }),
13123
+ /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(Badge, { tone: "neutral", icon: PROJECT_ICON[item2.project] || "squares-four", children: item2.project }),
13037
13124
  /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(Badge, { tone: s.tone, icon: s.icon, children: s.label })
13038
13125
  ] }),
13039
- /* @__PURE__ */ (0, import_jsx_runtime97.jsx)("p", { className: "fd-body-sm fd-secondary", style: { margin: 0, textWrap: "pretty" }, children: item.description }),
13040
- item.backend ? /* @__PURE__ */ (0, import_jsx_runtime97.jsxs)("div", { className: "fd-row", style: { gap: 10, alignItems: "flex-start" }, children: [
13126
+ /* @__PURE__ */ (0, import_jsx_runtime97.jsx)("p", { className: "fd-body-sm fd-secondary", style: { margin: 0, textWrap: "pretty" }, children: item2.description }),
13127
+ item2.backend ? /* @__PURE__ */ (0, import_jsx_runtime97.jsxs)("div", { className: "fd-row", style: { gap: 10, alignItems: "flex-start" }, children: [
13041
13128
  /* @__PURE__ */ (0, import_jsx_runtime97.jsx)("span", { className: "fd-overline fd-muted", style: { width: 62, flex: "none", paddingTop: 2 }, children: "Backend" }),
13042
- /* @__PURE__ */ (0, import_jsx_runtime97.jsx)("span", { className: "fd-body-sm", style: { flex: 1, textWrap: "pretty" }, children: item.backend })
13129
+ /* @__PURE__ */ (0, import_jsx_runtime97.jsx)("span", { className: "fd-body-sm", style: { flex: 1, textWrap: "pretty" }, children: item2.backend })
13043
13130
  ] }) : null,
13044
13131
  /* @__PURE__ */ (0, import_jsx_runtime97.jsxs)("div", { className: "fd-row", style: { gap: 12, flexWrap: "wrap" }, children: [
13045
- item.effort ? /* @__PURE__ */ (0, import_jsx_runtime97.jsxs)("span", { className: "fd-body-sm fd-muted", children: [
13132
+ item2.effort ? /* @__PURE__ */ (0, import_jsx_runtime97.jsxs)("span", { className: "fd-body-sm fd-muted", children: [
13046
13133
  /* @__PURE__ */ (0, import_jsx_runtime97.jsx)("i", { className: "ph ph-hourglass-medium" }),
13047
13134
  " ",
13048
- item.effort
13135
+ item2.effort
13049
13136
  ] }) : null,
13050
13137
  /* @__PURE__ */ (0, import_jsx_runtime97.jsxs)("span", { className: "fd-body-sm fd-muted", children: [
13051
13138
  /* @__PURE__ */ (0, import_jsx_runtime97.jsx)("i", { className: "ph ph-user" }),
13052
13139
  " ",
13053
- item.owner
13140
+ item2.owner
13054
13141
  ] }),
13055
- item.screen ? /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(Badge, { tone: "neutral", icon: "browser", children: "screen" }) : null,
13142
+ item2.screen ? /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(Badge, { tone: "neutral", icon: "browser", children: "screen" }) : null,
13056
13143
  /* @__PURE__ */ (0, import_jsx_runtime97.jsx)("span", { style: { flex: 1 } }),
13057
13144
  /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(
13058
13145
  "button",
13059
13146
  {
13060
13147
  type: "button",
13061
- onClick: () => onOpenFlag && onOpenFlag(item.key),
13148
+ onClick: () => onOpenFlag && onOpenFlag(item2.key),
13062
13149
  style: { all: "unset", cursor: "pointer", display: "inline-flex", alignItems: "center", gap: 5 },
13063
- children: /* @__PURE__ */ (0, import_jsx_runtime97.jsx)("code", { className: "fd-mono", style: { fontSize: 11, color: "var(--brand)" }, children: item.key })
13150
+ children: /* @__PURE__ */ (0, import_jsx_runtime97.jsx)("code", { className: "fd-mono", style: { fontSize: 11, color: "var(--brand)" }, children: item2.key })
13064
13151
  }
13065
13152
  )
13066
13153
  ] }),
@@ -13068,7 +13155,7 @@ function RoadmapCard({ item, byKey, onOpenFlag }) {
13068
13155
  /* @__PURE__ */ (0, import_jsx_runtime97.jsx)("span", { className: "fd-overline fd-muted", style: { paddingTop: 3 }, children: "After" }),
13069
13156
  deps.map((d) => /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(Tag, { icon: d.implemented ? "check" : "clock", children: d.label }, d.key))
13070
13157
  ] }) : null,
13071
- blocking.length && !item.implemented ? /* @__PURE__ */ (0, import_jsx_runtime97.jsxs)("span", { className: "fd-body-sm", style: { color: "var(--warn-text)" }, children: [
13158
+ blocking.length && !item2.implemented ? /* @__PURE__ */ (0, import_jsx_runtime97.jsxs)("span", { className: "fd-body-sm", style: { color: "var(--warn-text)" }, children: [
13072
13159
  "Blocked until ",
13073
13160
  blocking.map((d) => d.label).join(" and "),
13074
13161
  " ",
@@ -13162,19 +13249,19 @@ function RoadmapTimeline({ onOpenFlag, title = "Roadmap", lede }) {
13162
13249
  ),
13163
13250
  /* @__PURE__ */ (0, import_jsx_runtime97.jsx)("div", { className: "fd-rm", children: /* @__PURE__ */ (0, import_jsx_runtime97.jsx)("div", { className: "fd-rm-scroll", ref: scrollRef, children: /* @__PURE__ */ (0, import_jsx_runtime97.jsxs)("div", { className: "fd-rm-track", children: [
13164
13251
  /* @__PURE__ */ (0, import_jsx_runtime97.jsx)("span", { className: "fd-rm-spine", children: /* @__PURE__ */ (0, import_jsx_runtime97.jsx)("span", { className: "fd-rm-spine-done", style: { height: items.length ? 100 * shippedShown / items.length + "%" : "0%" } }) }),
13165
- items.map((item, n) => {
13166
- const showPhase = item.phase !== lastPhase;
13167
- lastPhase = item.phase;
13168
- const inPhase = items.filter((i) => i.phase === item.phase).length;
13252
+ items.map((item2, n) => {
13253
+ const showPhase = item2.phase !== lastPhase;
13254
+ lastPhase = item2.phase;
13255
+ const inPhase = items.filter((i) => i.phase === item2.phase).length;
13169
13256
  const isBoundary = n === firstPending;
13170
13257
  return /* @__PURE__ */ (0, import_jsx_runtime97.jsxs)(React74.Fragment, { children: [
13171
13258
  showPhase ? /* @__PURE__ */ (0, import_jsx_runtime97.jsxs)("div", { className: "fd-rm-era", children: [
13172
13259
  /* @__PURE__ */ (0, import_jsx_runtime97.jsxs)("span", { className: "fd-row", style: { gap: 8, flexWrap: "wrap", alignItems: "baseline" }, children: [
13173
- /* @__PURE__ */ (0, import_jsx_runtime97.jsx)("span", { style: { fontWeight: 700 }, children: item.phase === 0 ? "Shipped" : "Phase " + item.phase + " \u2014 " + item.phaseName }),
13174
- item.phase === 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime97.jsxs)("span", { className: "fd-mono", style: { opacity: 0.7, fontWeight: 400 }, children: [
13175
- fmtDate(item.phaseStart),
13260
+ /* @__PURE__ */ (0, import_jsx_runtime97.jsx)("span", { style: { fontWeight: 700 }, children: item2.phase === 0 ? "Shipped" : "Phase " + item2.phase + " \u2014 " + item2.phaseName }),
13261
+ item2.phase === 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime97.jsxs)("span", { className: "fd-mono", style: { opacity: 0.7, fontWeight: 400 }, children: [
13262
+ fmtDate(item2.phaseStart),
13176
13263
  " \u2013 ",
13177
- fmtDate(item.date)
13264
+ fmtDate(item2.date)
13178
13265
  ] }),
13179
13266
  /* @__PURE__ */ (0, import_jsx_runtime97.jsxs)("span", { style: { opacity: 0.7, fontWeight: 400 }, children: [
13180
13267
  "\xB7 ",
@@ -13183,22 +13270,22 @@ function RoadmapTimeline({ onOpenFlag, title = "Roadmap", lede }) {
13183
13270
  inPhase === 1 ? "" : "s"
13184
13271
  ] })
13185
13272
  ] }),
13186
- item.phaseWhy ? /* @__PURE__ */ (0, import_jsx_runtime97.jsx)("p", { className: "fd-rm-era-why", children: item.phaseWhy }) : null
13273
+ item2.phaseWhy ? /* @__PURE__ */ (0, import_jsx_runtime97.jsx)("p", { className: "fd-rm-era-why", children: item2.phaseWhy }) : null
13187
13274
  ] }) : null,
13188
13275
  isBoundary ? /* @__PURE__ */ (0, import_jsx_runtime97.jsx)("div", { className: "fd-rm-now", ref: nowRef, children: /* @__PURE__ */ (0, import_jsx_runtime97.jsxs)("span", { className: "fd-rm-now-pill", children: [
13189
13276
  /* @__PURE__ */ (0, import_jsx_runtime97.jsx)("i", { className: "ph ph-map-pin" }),
13190
13277
  " You are here \u2014 everything above is wired"
13191
13278
  ] }) }) : null,
13192
13279
  /* @__PURE__ */ (0, import_jsx_runtime97.jsxs)("div", { className: "fd-rm-row", children: [
13193
- /* @__PURE__ */ (0, import_jsx_runtime97.jsx)("span", { className: "fd-rm-dot " + (item.implemented ? "is-shipped" : item.status === "next" ? "is-next" : "") }),
13280
+ /* @__PURE__ */ (0, import_jsx_runtime97.jsx)("span", { className: "fd-rm-dot " + (item2.implemented ? "is-shipped" : item2.status === "next" ? "is-next" : "") }),
13194
13281
  /* @__PURE__ */ (0, import_jsx_runtime97.jsxs)("div", { className: "fd-rm-date", children: [
13195
- fmtDate(item.date),
13282
+ fmtDate(item2.date),
13196
13283
  /* @__PURE__ */ (0, import_jsx_runtime97.jsx)("br", {}),
13197
- /* @__PURE__ */ (0, import_jsx_runtime97.jsx)("span", { style: { opacity: 0.75 }, children: item.implemented ? "shipped" : "phase " + item.phase })
13284
+ /* @__PURE__ */ (0, import_jsx_runtime97.jsx)("span", { style: { opacity: 0.75 }, children: item2.implemented ? "shipped" : "phase " + item2.phase })
13198
13285
  ] }),
13199
- /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(RoadmapCard, { item, byKey, onOpenFlag })
13286
+ /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(RoadmapCard, { item: item2, byKey, onOpenFlag })
13200
13287
  ] })
13201
- ] }, item.key);
13288
+ ] }, item2.key);
13202
13289
  }),
13203
13290
  !items.length ? /* @__PURE__ */ (0, import_jsx_runtime97.jsx)("p", { className: "fd-body-sm fd-muted", children: "Nothing matches that filter." }) : null
13204
13291
  ] }) }) }),
@@ -14495,13 +14582,15 @@ function useChatEngine(opts) {
14495
14582
  if (m.role === "assistant") ownAssistants.push(m);
14496
14583
  }
14497
14584
  }
14498
- const progress = ownAssistants.pop();
14585
+ const rowAt = turn?.stored ? ownAssistants.findIndex((m) => m.id === turn.holderId) : ownAssistants.length - 1;
14586
+ const progress = rowAt < 0 ? void 0 : ownAssistants.splice(rowAt, 1)[0];
14499
14587
  const cards = ownAssistants;
14500
14588
  const ids = new Set(server.map((m) => m.id));
14501
14589
  serverCount.current = server.length;
14502
14590
  serverIds.current = ids;
14503
14591
  const settled = server.filter((m) => !ownIds.has(m.id) && !retired.current.has(m.id));
14504
- const local = listRef.current.filter((m) => !ids.has(m.id));
14592
+ const turnOwn = (m) => !!turn?.stored && (m.id === turn.userId || m.id === turn.holderId);
14593
+ const local = listRef.current.filter((m) => turnOwn(m) || !ids.has(m.id));
14505
14594
  const at = local.findIndex((m) => m.id === turn?.holderId);
14506
14595
  const tail = at < 0 ? [...cards, ...local] : [...local.slice(0, at), ...cards, ...local.slice(at)];
14507
14596
  const next = [...settled, ...tail];
@@ -14671,7 +14760,15 @@ function useChatEngine(opts) {
14671
14760
  { id: userId, role: "user", text: turn.text || null, attachments: turn.attachments, pending: true, timestamp: (/* @__PURE__ */ new Date()).toISOString() },
14672
14761
  { id: holderId, role: "assistant", text: "", streaming: !!apiAdapter.streamMessage, working: !apiAdapter.streamMessage, timestamp: (/* @__PURE__ */ new Date()).toISOString() }
14673
14762
  );
14674
- liveTurn.current = { known: new Set(serverIds.current), holderId };
14763
+ const live = { known: new Set(serverIds.current), userId, holderId, stored: false };
14764
+ liveTurn.current = live;
14765
+ const adopt = (stored) => {
14766
+ if (live.stored) return;
14767
+ live.stored = true;
14768
+ commit(listRef.current.map((m) => m.id === live.userId ? { ...m, id: stored.user_message_id } : m.id === live.holderId ? { ...m, id: stored.assistant_message_id } : m));
14769
+ live.userId = stored.user_message_id;
14770
+ live.holderId = stored.assistant_message_id;
14771
+ };
14675
14772
  const ac = typeof AbortController !== "undefined" ? new AbortController() : { abort() {
14676
14773
  }, signal: void 0 };
14677
14774
  abortRef.current = ac;
@@ -14680,53 +14777,54 @@ function useChatEngine(opts) {
14680
14777
  let res;
14681
14778
  if (apiAdapter.streamMessage) {
14682
14779
  res = await apiAdapter.streamMessage(id, turn.text, {
14683
- onToken: (chunk) => patch(holderId, (m) => ({ text: (m.text || "") + chunk, streaming: true })),
14780
+ onAccepted: adopt,
14781
+ onToken: (chunk) => patch(live.holderId, (m) => ({ text: (m.text || "") + chunk, streaming: true })),
14684
14782
  // chunks append
14685
- onStep: (step) => patch(holderId, (m) => {
14783
+ onStep: (step) => patch(live.holderId, (m) => {
14686
14784
  const steps = (m.steps || []).slice();
14687
14785
  const at = steps.findIndex((s) => s.id === step.id);
14688
14786
  if (at === -1) steps.push(step);
14689
14787
  else steps[at] = Object.assign({}, steps[at], step);
14690
14788
  return { steps };
14691
14789
  }),
14692
- onThinking: (chunk) => patch(holderId, (m) => ({ thinking: (m.thinking || "") + chunk }))
14790
+ onThinking: (chunk) => patch(live.holderId, (m) => ({ thinking: (m.thinking || "") + chunk }))
14693
14791
  }, ac.signal, turn.attachments && turn.attachments.length ? turn.attachments : void 0);
14694
14792
  } else if (turn.attachments && turn.attachments.length) {
14695
14793
  res = await apiAdapter.sendMessage(id, turn.text, ac.signal, turn.attachments);
14696
14794
  } else {
14697
14795
  res = await apiAdapter.sendMessage(id, turn.text, ac.signal);
14698
14796
  }
14699
- patch(userId, { pending: false });
14797
+ patch(live.userId, { pending: false });
14700
14798
  if (!res) throw new Error("send_failed");
14701
14799
  const r = res;
14702
14800
  if (r.dispatched) {
14703
- patch(holderId, { streaming: false, working: true, jobId: r.job_id, text: r.reply || "" });
14704
- await pollJob(r.job_id, holderId);
14801
+ patch(live.holderId, { streaming: false, working: true, jobId: r.job_id, text: r.reply || "" });
14802
+ await pollJob(r.job_id, live.holderId);
14705
14803
  } else {
14706
- patch(holderId, {
14804
+ patch(live.holderId, {
14707
14805
  streaming: false,
14708
14806
  working: false,
14709
- text: r.reply != null ? r.reply : listRef.current.find((m) => m.id === holderId)?.text || "",
14807
+ text: r.reply != null ? r.reply : listRef.current.find((m) => m.id === live.holderId)?.text || "",
14710
14808
  packet: r.packet,
14711
- steps: r.steps || listRef.current.find((m) => m.id === holderId)?.steps,
14809
+ steps: r.steps || listRef.current.find((m) => m.id === live.holderId)?.steps,
14712
14810
  citations: r.citations,
14713
14811
  usage: r.usage,
14714
14812
  model: r.model,
14715
14813
  timestamp: (/* @__PURE__ */ new Date()).toISOString()
14716
14814
  });
14717
- commit(listRef.current.map((m) => m.id === userId ? { ...m, id: r.user_message_id } : m.id === holderId ? { ...m, id: r.assistant_message_id } : m));
14815
+ adopt(r);
14718
14816
  serverCount.current += 2;
14719
14817
  if (r.packet && onPacket) onPacket(r.packet);
14720
14818
  }
14721
14819
  } catch (err) {
14722
14820
  const aborted = err && (err.name === "AbortError" || err.message === "aborted") || stoppedRef.current;
14723
- patch(userId, { pending: false });
14821
+ patch(live.userId, { pending: false });
14724
14822
  if (aborted) {
14725
- patch(holderId, (m) => ({ streaming: false, working: false, stopped: true, retryable: true, text: m.text || null }));
14823
+ patch(live.holderId, (m) => ({ streaming: false, working: false, stopped: true, retryable: true, text: m.text || null }));
14726
14824
  } else if (!fail(err)) {
14727
- patch(holderId, { streaming: false, working: false, error: err?.message || "send_failed", retryable: true });
14825
+ patch(live.holderId, { streaming: false, working: false, error: err?.message || "send_failed", retryable: true });
14728
14826
  } else {
14729
- commit(listRef.current.filter((m) => m.id !== holderId));
14827
+ commit(listRef.current.filter((m) => m.id !== live.holderId));
14730
14828
  }
14731
14829
  } finally {
14732
14830
  const known = liveTurn.current.known;
@@ -15628,7 +15726,7 @@ function ModelControls({
15628
15726
  }
15629
15727
  flat.push(m);
15630
15728
  });
15631
- const item = (m) => ({
15729
+ const item2 = (m) => ({
15632
15730
  id: m.id,
15633
15731
  label: m.label,
15634
15732
  description: m.description,
@@ -15638,11 +15736,11 @@ function ModelControls({
15638
15736
  shortcut: m.shortcut ? /* @__PURE__ */ (0, import_jsx_runtime112.jsx)(KeyHint, { keys: m.shortcut, size: "sm" }) : void 0,
15639
15737
  onSelect: () => onModelChange && onModelChange(m.id)
15640
15738
  });
15641
- const items = [{ kind: "section", label: "Models" }].concat(flat.map(item));
15739
+ const items = [{ kind: "section", label: "Models" }].concat(flat.map(item2));
15642
15740
  Object.keys(grouped).forEach((g) => {
15643
- items.push({ id: "grp_" + g, label: g, icon: "stack", submenu: grouped[g].map(item) });
15741
+ items.push({ id: "grp_" + g, label: g, icon: "stack", submenu: grouped[g].map(item2) });
15644
15742
  });
15645
- if (moreModels && moreModels.length) items.push({ id: "more", label: "More models", submenu: moreModels.map(item) });
15743
+ if (moreModels && moreModels.length) items.push({ id: "more", label: "More models", submenu: moreModels.map(item2) });
15646
15744
  if (onFastModeChange) {
15647
15745
  items.push({ kind: "separator" });
15648
15746
  items.push({ kind: "section", label: "Fast mode" });
@@ -17469,6 +17567,7 @@ function createChatAdapter(transport, { onTurnStarted, deadlineMs = CHAT_CALL_DE
17469
17567
  onTurnStarted?.();
17470
17568
  };
17471
17569
  const accepting = {
17570
+ onAccepted: handlers.onAccepted && ((ids) => (markStarted(), handlers.onAccepted(ids))),
17472
17571
  onToken: (chunk) => (markStarted(), handlers.onToken(chunk)),
17473
17572
  onStep: handlers.onStep && ((step) => (markStarted(), handlers.onStep(step))),
17474
17573
  onThinking: handlers.onThinking && ((chunk) => (markStarted(), handlers.onThinking(chunk)))
@@ -17838,6 +17937,7 @@ function ExportTray({ exports: exports2, keptNote, onDownload, onDismiss }) {
17838
17937
  extensionOf,
17839
17938
  extractClipboardFiles,
17840
17939
  filterFiles,
17940
+ folderFiles,
17841
17941
  formatAbsolute,
17842
17942
  formatBytes,
17843
17943
  formatClock,
@@ -17860,6 +17960,7 @@ function ExportTray({ exports: exports2, keptNote, onDownload, onDismiss }) {
17860
17960
  isUsStateCode,
17861
17961
  isWithinLayerTree,
17862
17962
  jobBucket,
17963
+ jsonPathPosition,
17863
17964
  languageLabel,
17864
17965
  loadPrefs,
17865
17966
  markdownToText,