@flytedan/flytebot-design-system 0.88.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.js CHANGED
@@ -2256,11 +2256,13 @@ function AppShell({
2256
2256
  );
2257
2257
  }
2258
2258
 
2259
+ // src/components/navigation/flytedeskLogo.ts
2260
+ var FLYTEDESK_LOGO_SRC = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iOTUiIGhlaWdodD0iMzYiIHZpZXdCb3g9IjAgMCA5NSAzNiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPGcgY2xpcC1wYXRoPSJ1cmwoI2NsaXAwXzg2NzNfNTU0KSI+CjxwYXRoIGQ9Ik01Ljg4OTk1IDEzLjU2NjNDNi4zNDU5NSAxMy41NjYzIDYuNjExOTUgMTMuNjMyNiA2Ljc1NDQ1IDEzLjY3MDRWMTEuMzYxOUM2LjUyNjQ1IDExLjI1NzkgNS45NjU5NSAxMS4xNTM4IDUuMzg2NDYgMTEuMTUzOEMzLjEzNDk4IDExLjE1MzggMS42OTA5OSAxMi42MzkyIDEuNjkwOTkgMTQuOTE5MlYxNi4wNzM1SDBWMTguNDE5N0gxLjY5MDk5VjI2LjE5NjZINC40NTU0N1YxOC40MTk3SDYuNzQ0OTVWMTYuMDczNUg0LjQ1NTQ3VjE0Ljk2NjVDNC40NTU0NyAxMy44MzEyIDUuMjYyOTYgMTMuNTY2MyA1Ljg4MDQ2IDEzLjU2NjNINS44ODk5NVoiIGZpbGw9IiMwNTJFNEEiLz4KPHBhdGggZD0iTTEwLjgxMDkgMjYuMTk2M1YxMS4zMDQ5SDguMDY1NDNWMjYuMjA1OEgxMC44MTA5VjI2LjE5NjNaIiBmaWxsPSIjMDUyRTRBIi8+CjxwYXRoIGQ9Ik0yNi45MTI1IDEzLjA0MzlIMjQuNDMzVjE0LjQ2MzFDMjQuNDMzIDE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zQxTDE2Ljg1MyAyMi45NDc5TDE5LjE0MjUgMTYuMDUxVjE2LjA0MTVaIiBmaWxsPSIjMDUyRTRBIi8+CjxwYXRoIGQ9Ik04NS4wNzI4IDEyLjUxNTVMOTUuMDAwMiAxLjE0MzU1Qzk1LjAwMDIgMS4xNDM1NSA5MS4xMDUyIDE2LjI5OTggOTAuMzkyNyAxNy4xMTM1Qzg5LjY5OTIgMTcuOTA4MiA4Ni4yMDMyIDE3LjY2MjIgODUuNjYxOCAxNy4xODkyQzg1LjEyMDMgMTYuNzE2MSA4NS4wODIzIDEyLjUwNiA4NS4wODIzIDEyLjUwNkw4NS4wNzI4IDEyLjUxNTVaIiBmaWxsPSIjODBCRkU5Ii8+CjxwYXRoIGQ9Ik04My43MDQ5IDExLjI3NDVMOTQuNzYyOCAxQzk0Ljc2MjggMSA3OS42OTU5IDUuNDA4NzYgNzguODk3OSA2LjE0NjdDNzguMTI4NCA2Ljg2NTczIDc4LjQ5ODkgMTAuMzM3OSA3OC45ODM0IDEwLjg1ODJDNzkuNDc3NCAxMS4zNzg2IDgzLjY5NTQgMTEuMjc0NSA4My42OTU0IDExLjI3NDVIODMuNzA0OVoiIGZpbGw9IiMyMjcyQkEiLz4KPC9nPgo8ZGVmcz4KPGNsaXBQYXRoIGlkPSJjbGlwMF84NjczXzU1NCI+CjxyZWN0IHdpZHRoPSI5NSIgaGVpZ2h0PSIzNiIgZmlsbD0id2hpdGUiLz4KPC9jbGlwUGF0aD4KPC9kZWZzPgo8L3N2Zz4K";
2261
+
2259
2262
  // src/components/navigation/FlytedeskBrand.tsx
2260
2263
  import { jsx as jsx29, jsxs as jsxs21 } from "react/jsx-runtime";
2261
- var LOGO_SRC = "https://cdn.prod.website-files.com/69a96def413819b7db64de8c/69ac8ec2ed84b986a5fb76dc_Logo%20(dark)%202.svg";
2262
2264
  function FlytedeskMark({ size = "md", className = "", ...rest }) {
2263
- return /* @__PURE__ */ jsx29("span", { className: ["fd-brand-mark", size !== "md" ? "fd-brand-mark-" + size : "", className].filter(Boolean).join(" "), ...rest, children: /* @__PURE__ */ jsx29("img", { src: LOGO_SRC, alt: "flytedesk" }) });
2265
+ return /* @__PURE__ */ jsx29("span", { className: ["fd-brand-mark", size !== "md" ? "fd-brand-mark-" + size : "", className].filter(Boolean).join(" "), ...rest, children: /* @__PURE__ */ jsx29("img", { src: FLYTEDESK_LOGO_SRC, alt: "flytedesk" }) });
2264
2266
  }
2265
2267
  function FlytedeskBrand({ appName, size = "md", className = "", ...rest }) {
2266
2268
  return /* @__PURE__ */ jsxs21("span", { className: ["fd-brand", size !== "md" ? "fd-brand-" + size : "", className].filter(Boolean).join(" "), ...rest, children: [
@@ -2331,28 +2333,28 @@ function Tabs({ tabs = [], value, onChange, className = "", ...rest }) {
2331
2333
  "data-more-end": more.end ? "true" : void 0,
2332
2334
  ...rest,
2333
2335
  children: tabs.map((t) => {
2334
- const item = typeof t === "string" ? { value: t, label: t } : t;
2336
+ const item2 = typeof t === "string" ? { value: t, label: t } : t;
2335
2337
  return /* @__PURE__ */ jsxs22(
2336
2338
  "button",
2337
2339
  {
2338
2340
  type: "button",
2339
2341
  role: "tab",
2340
2342
  className: "fd-tab",
2341
- "aria-selected": item.value === value,
2342
- onClick: onChange ? () => onChange(item.value) : void 0,
2343
+ "aria-selected": item2.value === value,
2344
+ onClick: onChange ? () => onChange(item2.value) : void 0,
2343
2345
  children: [
2344
- item.label,
2345
- item.count !== void 0 ? /* @__PURE__ */ jsx30(
2346
+ item2.label,
2347
+ item2.count !== void 0 ? /* @__PURE__ */ jsx30(
2346
2348
  "span",
2347
2349
  {
2348
- className: "fd-badge " + (item.tone === "attention" ? "fd-badge-warning" : "fd-badge-neutral"),
2350
+ className: "fd-badge " + (item2.tone === "attention" ? "fd-badge-warning" : "fd-badge-neutral"),
2349
2351
  style: { height: 20, padding: "0 7px" },
2350
- children: item.count
2352
+ children: item2.count
2351
2353
  }
2352
2354
  ) : null
2353
2355
  ]
2354
2356
  },
2355
- item.value
2357
+ item2.value
2356
2358
  );
2357
2359
  })
2358
2360
  }
@@ -2611,7 +2613,7 @@ function ToastProvider({ children }) {
2611
2613
  const timers = React28.useRef(/* @__PURE__ */ new Map());
2612
2614
  const nextId = React28.useRef(1);
2613
2615
  const dismiss = React28.useCallback((id) => {
2614
- setItems((current2) => current2.filter((item) => item.id !== id));
2616
+ setItems((current2) => current2.filter((item2) => item2.id !== id));
2615
2617
  const timer = timers.current.get(id);
2616
2618
  if (timer !== void 0) {
2617
2619
  clearTimeout(timer);
@@ -2637,7 +2639,7 @@ function ToastProvider({ children }) {
2637
2639
  const api = React28.useMemo(() => ({ show }), [show]);
2638
2640
  return /* @__PURE__ */ jsxs31(ToastContext.Provider, { value: api, children: [
2639
2641
  children,
2640
- /* @__PURE__ */ jsx40(CornerStackPortal, { slot: "toasts", children: /* @__PURE__ */ jsx40("div", { className: "fd-toast-region", "aria-live": "polite", children: items.map((item) => /* @__PURE__ */ jsx40(Toast, { title: item.title, tone: item.tone, onDismiss: () => dismiss(item.id) }, item.id)) }) })
2642
+ /* @__PURE__ */ jsx40(CornerStackPortal, { slot: "toasts", children: /* @__PURE__ */ jsx40("div", { className: "fd-toast-region", "aria-live": "polite", children: items.map((item2) => /* @__PURE__ */ jsx40(Toast, { title: item2.title, tone: item2.tone, onDismiss: () => dismiss(item2.id) }, item2.id)) }) })
2641
2643
  ] });
2642
2644
  }
2643
2645
  function useToast() {
@@ -2864,6 +2866,14 @@ var FileKit = {
2864
2866
  toAttachment,
2865
2867
  revokeAttachment
2866
2868
  };
2869
+ function folderFiles(files) {
2870
+ return files.map((file) => {
2871
+ const relative = file.webkitRelativePath;
2872
+ const slash = relative ? relative.indexOf("/") : -1;
2873
+ if (slash < 0) throw new Error(`folderFiles: ${file.name} has no folder path; it did not come from a folder pick.`);
2874
+ return { file, path: relative.slice(slash + 1) };
2875
+ });
2876
+ }
2867
2877
 
2868
2878
  // src/components/data/SegmentedMeter.tsx
2869
2879
  import { jsx as jsx42, jsxs as jsxs32 } from "react/jsx-runtime";
@@ -6618,8 +6628,8 @@ function VirtualList({
6618
6628
  const prev = lastKeysRef.current;
6619
6629
  if (!prev) return /* @__PURE__ */ new Set();
6620
6630
  const fresh = /* @__PURE__ */ new Set();
6621
- for (const item of items) {
6622
- const k = keyOf(item);
6631
+ for (const item2 of items) {
6632
+ const k = keyOf(item2);
6623
6633
  if (!prev.has(k)) fresh.add(k);
6624
6634
  }
6625
6635
  return fresh;
@@ -6633,16 +6643,16 @@ function VirtualList({
6633
6643
  }
6634
6644
  const rows = [];
6635
6645
  for (let i = win.startIndex; i <= win.endIndex; i++) {
6636
- const item = items[i - firstItemIndex];
6637
- if (item === void 0) continue;
6638
- const key = keyOf(item);
6646
+ const item2 = items[i - firstItemIndex];
6647
+ if (item2 === void 0) continue;
6648
+ const key = keyOf(item2);
6639
6649
  rows.push(
6640
6650
  /* @__PURE__ */ jsx68(
6641
6651
  "div",
6642
6652
  {
6643
6653
  className: "fd-vlist-row",
6644
6654
  style: { height: itemHeight, boxSizing: "border-box", transform: "translateY(" + i * itemHeight + "px)" },
6645
- children: /* @__PURE__ */ jsx68("div", { className: newKeys.has(key) ? "fd-vlist-row-content fd-vlist-row-enter" : "fd-vlist-row-content", children: renderItem(item, i) })
6655
+ children: /* @__PURE__ */ jsx68("div", { className: newKeys.has(key) ? "fd-vlist-row-content fd-vlist-row-enter" : "fd-vlist-row-content", children: renderItem(item2, i) })
6646
6656
  },
6647
6657
  key
6648
6658
  )
@@ -6898,15 +6908,15 @@ function TransferList({
6898
6908
  (side, key) => (side === "left" ? left.items : right.items).find((it) => keyOf(it) === key),
6899
6909
  [left.items, right.items, keyOf]
6900
6910
  );
6901
- const beginDrag = (e, item, from) => {
6911
+ const beginDrag = (e, item2, from) => {
6902
6912
  if (e.button !== 0) return;
6903
6913
  if (e.target.closest && e.target.closest("button")) return;
6904
6914
  e.preventDefault();
6905
6915
  const rect = e.currentTarget.getBoundingClientRect();
6906
6916
  armedRef.current = {
6907
- item,
6917
+ item: item2,
6908
6918
  from,
6909
- key: keyOf(item),
6919
+ key: keyOf(item2),
6910
6920
  pointerId: e.pointerId,
6911
6921
  startX: e.clientX,
6912
6922
  startY: e.clientY,
@@ -6956,8 +6966,8 @@ function TransferList({
6956
6966
  if (!wasDragging) return;
6957
6967
  const hit = hitTestSide(e.clientX, e.clientY);
6958
6968
  if (hit && hit !== armed.from) {
6959
- const item = findItem(armed.from, armed.key);
6960
- if (item !== void 0) onMove(item, armed.from, hit);
6969
+ const item2 = findItem(armed.from, armed.key);
6970
+ if (item2 !== void 0) onMove(item2, armed.from, hit);
6961
6971
  }
6962
6972
  };
6963
6973
  window.addEventListener("pointermove", onMovePointer);
@@ -7011,19 +7021,19 @@ function TransferList({
7011
7021
  totalCount: cfg.totalCount,
7012
7022
  onNeedMore: cfg.onNeedMore,
7013
7023
  emptyState: /* @__PURE__ */ jsx72(EmptyState, { icon: "tray", title: "Nothing here" }),
7014
- renderItem: (item) => {
7015
- const isBeingDragged = drag != null && drag.from === side && drag.key === keyOf(item);
7024
+ renderItem: (item2) => {
7025
+ const isBeingDragged = drag != null && drag.from === side && drag.key === keyOf(item2);
7016
7026
  if (isBeingDragged) {
7017
7027
  return /* @__PURE__ */ jsx72("div", { className: "fd-erow-placeholder", "aria-hidden": "true" });
7018
7028
  }
7019
- const content = renderRow(item);
7029
+ const content = renderRow(item2);
7020
7030
  const destination = (side === "left" ? right : left).label || "the other list";
7021
7031
  return /* @__PURE__ */ jsx72(
7022
7032
  EntityRow,
7023
7033
  {
7024
7034
  ...content,
7025
7035
  draggable: true,
7026
- onPointerDown: (e) => beginDrag(e, item, side),
7036
+ onPointerDown: (e) => beginDrag(e, item2, side),
7027
7037
  action: {
7028
7038
  icon: side === "left" ? "plus" : "minus",
7029
7039
  // Names the row AND where it goes. A list repeats this button on every
@@ -7031,7 +7041,7 @@ function TransferList({
7031
7041
  // over to a screen reader, with nothing to tell one button from the next.
7032
7042
  label: "Move " + content.title + " to " + destination,
7033
7043
  tone: side === "left" ? "add" : "remove",
7034
- onClick: () => onMove(item, side, opposite)
7044
+ onClick: () => onMove(item2, side, opposite)
7035
7045
  }
7036
7046
  }
7037
7047
  );
@@ -8072,6 +8082,8 @@ function Dropzone({
8072
8082
  }
8073
8083
  function FilePickButton({
8074
8084
  onFiles,
8085
+ onFolder,
8086
+ directory = false,
8075
8087
  onReject,
8076
8088
  accept,
8077
8089
  maxFileSize,
@@ -8104,10 +8116,14 @@ function FilePickButton({
8104
8116
  accept,
8105
8117
  multiple,
8106
8118
  className: "fd-sr",
8119
+ ...directory ? { webkitdirectory: "" } : {},
8107
8120
  onChange: (e) => {
8108
8121
  const { accepted, rejected } = filterFiles(e.target.files, { accept, maxFileSize });
8109
8122
  if (rejected.length && onReject) onReject(rejected);
8110
- if (accepted.length && onFiles) onFiles(accepted);
8123
+ if (accepted.length) {
8124
+ if (directory) onFolder?.(folderFiles(accepted));
8125
+ else onFiles?.(accepted);
8126
+ }
8111
8127
  e.target.value = "";
8112
8128
  }
8113
8129
  }
@@ -8749,11 +8765,59 @@ var MarkdownEditor = React60.forwardRef(function MarkdownEditor2({
8749
8765
  // src/components/forms/CodeEditor.tsx
8750
8766
  import * as React61 from "react";
8751
8767
  import { EditorView, keymap, lineNumbers, placeholder as cmPlaceholder, drawSelection, Decoration } from "@codemirror/view";
8752
- import { EditorState, StateEffect, StateField, Compartment } from "@codemirror/state";
8768
+ import { EditorState as EditorState2, StateEffect, StateField, Compartment } from "@codemirror/state";
8753
8769
  import { defaultKeymap, history, historyKeymap, indentMore, indentLess } from "@codemirror/commands";
8754
8770
  import { sql as sqlLang } from "@codemirror/lang-sql";
8771
+ import { json as jsonLang } from "@codemirror/lang-json";
8755
8772
  import { syntaxHighlighting, HighlightStyle, indentOnInput, bracketMatching } from "@codemirror/language";
8756
8773
  import { tags } from "@lezer/highlight";
8774
+
8775
+ // src/components/forms/jsonDiagnostics.ts
8776
+ import { EditorState } from "@codemirror/state";
8777
+ import { json } from "@codemirror/lang-json";
8778
+ import { ensureSyntaxTree } from "@codemirror/language";
8779
+ var PARSE_BUDGET_MS = 1e3;
8780
+ function firstErrorOffset(state) {
8781
+ const tree = ensureSyntaxTree(state, state.doc.length, PARSE_BUDGET_MS);
8782
+ let at = -1;
8783
+ tree?.iterate({
8784
+ enter(node) {
8785
+ if (at >= 0) return false;
8786
+ if (node.type.isError) {
8787
+ at = node.from;
8788
+ return false;
8789
+ }
8790
+ return void 0;
8791
+ }
8792
+ });
8793
+ return at;
8794
+ }
8795
+ function jsonSyntaxDiagnostics(text) {
8796
+ if (!text.trim()) return [];
8797
+ try {
8798
+ JSON.parse(text);
8799
+ return [];
8800
+ } catch (e) {
8801
+ if (!(e instanceof SyntaxError)) throw e;
8802
+ const state = EditorState.create({ doc: text, extensions: [json()] });
8803
+ const offset = firstErrorOffset(state);
8804
+ const line = state.doc.lineAt(offset < 0 ? state.doc.length : offset);
8805
+ const at = offset < 0 ? state.doc.length : offset;
8806
+ return [{
8807
+ line: line.number,
8808
+ column: at - line.from + 1,
8809
+ message: e.message.replace(/, ".*" is not valid JSON$/s, ""),
8810
+ severity: "error"
8811
+ }];
8812
+ }
8813
+ }
8814
+ function jsonModeDiagnostics(text, validate) {
8815
+ const syntax = jsonSyntaxDiagnostics(text);
8816
+ if (syntax.length || !validate) return syntax;
8817
+ return validate(text);
8818
+ }
8819
+
8820
+ // src/components/forms/CodeEditor.tsx
8757
8821
  import { jsx as jsx86, jsxs as jsxs73 } from "react/jsx-runtime";
8758
8822
  function clampOffset(state, line, column) {
8759
8823
  const total = state.doc.lines;
@@ -8840,7 +8904,9 @@ function CodeEditor({
8840
8904
  disabled = false,
8841
8905
  readOnly = false,
8842
8906
  placeholder: placeholderText = "",
8843
- diagnostics = [],
8907
+ diagnostics: passedDiagnostics,
8908
+ language = "sql",
8909
+ validate,
8844
8910
  showEscapeHint = true,
8845
8911
  minHeight = 160,
8846
8912
  id,
@@ -8849,6 +8915,13 @@ function CodeEditor({
8849
8915
  autoFocus = false
8850
8916
  }) {
8851
8917
  const fieldId = useFieldId(id);
8918
+ const diagnostics = React61.useMemo(
8919
+ () => [
8920
+ ...passedDiagnostics ?? [],
8921
+ ...language === "json" ? jsonModeDiagnostics(value, validate) : []
8922
+ ],
8923
+ [passedDiagnostics, language, value, validate]
8924
+ );
8852
8925
  const descId = fieldId + "-desc";
8853
8926
  const liveId = fieldId + "-live";
8854
8927
  const hostRef = React61.useRef(null);
@@ -8857,6 +8930,7 @@ function CodeEditor({
8857
8930
  const onChangeRef = React61.useRef(onChange);
8858
8931
  onChangeRef.current = onChange;
8859
8932
  const editableCompartment = React61.useRef(new Compartment()).current;
8933
+ const languageCompartment = React61.useRef(new Compartment()).current;
8860
8934
  const readOnlyCompartment = React61.useRef(new Compartment()).current;
8861
8935
  const attributesCompartment = React61.useRef(new Compartment()).current;
8862
8936
  const errorRef = React61.useRef(error);
@@ -8880,7 +8954,7 @@ function CodeEditor({
8880
8954
  valueRef.current = next;
8881
8955
  onChangeRef.current && onChangeRef.current(next);
8882
8956
  });
8883
- const state = EditorState.create({
8957
+ const state = EditorState2.create({
8884
8958
  doc: value,
8885
8959
  extensions: [
8886
8960
  lineNumbers(),
@@ -8888,7 +8962,7 @@ function CodeEditor({
8888
8962
  drawSelection(),
8889
8963
  indentOnInput(),
8890
8964
  bracketMatching(),
8891
- sqlLang(),
8965
+ languageCompartment.of(language === "json" ? jsonLang() : sqlLang()),
8892
8966
  syntaxHighlighting(tokenHighlight),
8893
8967
  diagnosticsField,
8894
8968
  decorationsFromDiagnostics(),
@@ -8900,7 +8974,7 @@ function CodeEditor({
8900
8974
  ...historyKeymap
8901
8975
  ]),
8902
8976
  editableCompartment.of(EditorView.editable.of(!disabled)),
8903
- readOnlyCompartment.of(EditorState.readOnly.of(readOnly)),
8977
+ readOnlyCompartment.of(EditorState2.readOnly.of(readOnly)),
8904
8978
  updateListener,
8905
8979
  attributesCompartment.of(EditorView.contentAttributes.of(contentAttributes()))
8906
8980
  ]
@@ -8930,7 +9004,12 @@ function CodeEditor({
8930
9004
  React61.useEffect(() => {
8931
9005
  const view = viewRef.current;
8932
9006
  if (!view) return;
8933
- view.dispatch({ effects: readOnlyCompartment.reconfigure(EditorState.readOnly.of(readOnly)) });
9007
+ view.dispatch({ effects: languageCompartment.reconfigure(language === "json" ? jsonLang() : sqlLang()) });
9008
+ }, [language, languageCompartment]);
9009
+ React61.useEffect(() => {
9010
+ const view = viewRef.current;
9011
+ if (!view) return;
9012
+ view.dispatch({ effects: readOnlyCompartment.reconfigure(EditorState2.readOnly.of(readOnly)) });
8934
9013
  }, [readOnly, readOnlyCompartment]);
8935
9014
  React61.useEffect(() => {
8936
9015
  const view = viewRef.current;
@@ -8989,6 +9068,75 @@ function CodeEditor({
8989
9068
  ] });
8990
9069
  }
8991
9070
 
9071
+ // src/components/forms/jsonPath.ts
9072
+ import { EditorState as EditorState3 } from "@codemirror/state";
9073
+ import { json as json2 } from "@codemirror/lang-json";
9074
+ var VALUE_NODES = /* @__PURE__ */ new Set(["Object", "Array", "String", "Number", "True", "False", "Null"]);
9075
+ function valueChild(node) {
9076
+ for (let child = node.firstChild; child; child = child.nextSibling) {
9077
+ if (VALUE_NODES.has(child.name)) return child;
9078
+ }
9079
+ return null;
9080
+ }
9081
+ function member(text, object, key) {
9082
+ let found = null;
9083
+ for (let prop = object.firstChild; prop; prop = prop.nextSibling) {
9084
+ if (prop.name !== "Property") continue;
9085
+ const name = prop.getChild("PropertyName");
9086
+ const value = valueChild(prop);
9087
+ if (name && value && JSON.parse(text.slice(name.from, name.to)) === key) found = { name, value };
9088
+ }
9089
+ return found;
9090
+ }
9091
+ function item(array, index) {
9092
+ let at = 0;
9093
+ for (let child = array.firstChild; child; child = child.nextSibling) {
9094
+ if (VALUE_NODES.has(child.name) && at++ === index) return child;
9095
+ }
9096
+ return null;
9097
+ }
9098
+ function jsonPathPosition(text, path, anchor = "value") {
9099
+ try {
9100
+ JSON.parse(text);
9101
+ } catch (e) {
9102
+ if (e instanceof SyntaxError) return null;
9103
+ throw e;
9104
+ }
9105
+ const doc = EditorState3.create({ doc: text }).doc;
9106
+ const normalized = doc.toString();
9107
+ const root = valueChild(json2().language.parser.parse(normalized).topNode);
9108
+ if (!root) return null;
9109
+ let target = root;
9110
+ let key = null;
9111
+ let exact = true;
9112
+ for (const step of path) {
9113
+ let next = null;
9114
+ if (target.name === "Object" && typeof step === "string") next = member(normalized, target, step);
9115
+ else if (target.name === "Array" && typeof step === "number") {
9116
+ const value = item(target, step);
9117
+ next = value && { name: null, value };
9118
+ }
9119
+ if (!next) {
9120
+ exact = false;
9121
+ break;
9122
+ }
9123
+ target = next.value;
9124
+ key = next.name;
9125
+ }
9126
+ const span = anchor === "key" && exact && key ? key : target;
9127
+ const from = span.from;
9128
+ const to = span.name === "Object" || span.name === "Array" ? span.from + 1 : span.to;
9129
+ const start = doc.lineAt(from);
9130
+ const end = doc.lineAt(to);
9131
+ return {
9132
+ line: start.number,
9133
+ column: from - start.from + 1,
9134
+ endLine: end.number,
9135
+ endColumn: to - end.from + 1,
9136
+ exact
9137
+ };
9138
+ }
9139
+
8992
9140
  // src/components/forms/RadioGroup.tsx
8993
9141
  import * as React62 from "react";
8994
9142
  import { jsx as jsx87, jsxs as jsxs74 } from "react/jsx-runtime";
@@ -9044,18 +9192,18 @@ function useSessionContext() {
9044
9192
  import { Fragment as Fragment22, jsx as jsx89, jsxs as jsxs75 } from "react/jsx-runtime";
9045
9193
  var DEFAULT_LINKS = [];
9046
9194
  var DEFAULT_GROUPS = [];
9047
- function Item({ item, onPick }) {
9195
+ function Item({ item: item2, onPick }) {
9048
9196
  return /* @__PURE__ */ jsxs75(
9049
9197
  "button",
9050
9198
  {
9051
9199
  type: "button",
9052
9200
  role: "menuitem",
9053
9201
  className: "fd-acct-item",
9054
- onClick: () => onPick(item),
9202
+ onClick: () => onPick(item2),
9055
9203
  children: [
9056
- item.icon ? /* @__PURE__ */ jsx89("i", { className: "ph ph-" + item.icon, "aria-hidden": "true" }) : null,
9057
- /* @__PURE__ */ jsx89("span", { style: { flex: 1 }, children: item.label }),
9058
- item.badge ? /* @__PURE__ */ jsx89(Badge, { tone: "neutral", children: item.badge }) : null
9204
+ item2.icon ? /* @__PURE__ */ jsx89("i", { className: "ph ph-" + item2.icon, "aria-hidden": "true" }) : null,
9205
+ /* @__PURE__ */ jsx89("span", { style: { flex: 1 }, children: item2.label }),
9206
+ item2.badge ? /* @__PURE__ */ jsx89(Badge, { tone: "neutral", children: item2.badge }) : null
9059
9207
  ]
9060
9208
  }
9061
9209
  );
@@ -9082,11 +9230,11 @@ function AccountMenu({
9082
9230
  setOpen(false);
9083
9231
  setSignOutError(null);
9084
9232
  };
9085
- const pick = (item) => {
9233
+ const pick = (item2) => {
9086
9234
  closeMenu();
9087
- if (item.onSelect) return item.onSelect();
9088
- if (onNavigate) return onNavigate(item.href, item);
9089
- if (item.href) window.location.href = item.href;
9235
+ if (item2.onSelect) return item2.onSelect();
9236
+ if (onNavigate) return onNavigate(item2.href, item2);
9237
+ if (item2.href) window.location.href = item2.href;
9090
9238
  };
9091
9239
  const signOut = async () => {
9092
9240
  const handler = onSignOut ?? ctxSignOut;
@@ -11744,41 +11892,41 @@ var fmtDate = (iso2) => {
11744
11892
  const d = /* @__PURE__ */ new Date(String(iso2) + "T00:00:00");
11745
11893
  return isNaN(d) ? iso2 : d.toLocaleDateString(void 0, { month: "short", day: "numeric", year: "numeric" });
11746
11894
  };
11747
- function RoadmapCard({ item, byKey, onOpenFlag }) {
11748
- const s = STATUS[item.status] || STATUS.planned;
11749
- const deps = (item.dependsOn || []).map((k) => byKey[k]).filter(Boolean);
11895
+ function RoadmapCard({ item: item2, byKey, onOpenFlag }) {
11896
+ const s = STATUS[item2.status] || STATUS.planned;
11897
+ const deps = (item2.dependsOn || []).map((k) => byKey[k]).filter(Boolean);
11750
11898
  const blocking = deps.filter((d) => !d.implemented);
11751
11899
  return /* @__PURE__ */ jsx96(Card, { elevation: "flat", children: /* @__PURE__ */ jsxs81("div", { className: "fd-stack", style: { gap: 10 }, children: [
11752
11900
  /* @__PURE__ */ jsxs81("div", { className: "fd-row", style: { gap: 8, flexWrap: "wrap" }, children: [
11753
- /* @__PURE__ */ jsx96("span", { className: "fd-body", style: { fontWeight: 700, flex: 1, minWidth: 140 }, children: item.label }),
11754
- /* @__PURE__ */ jsx96(Badge, { tone: "neutral", icon: PROJECT_ICON[item.project] || "squares-four", children: item.project }),
11901
+ /* @__PURE__ */ jsx96("span", { className: "fd-body", style: { fontWeight: 700, flex: 1, minWidth: 140 }, children: item2.label }),
11902
+ /* @__PURE__ */ jsx96(Badge, { tone: "neutral", icon: PROJECT_ICON[item2.project] || "squares-four", children: item2.project }),
11755
11903
  /* @__PURE__ */ jsx96(Badge, { tone: s.tone, icon: s.icon, children: s.label })
11756
11904
  ] }),
11757
- /* @__PURE__ */ jsx96("p", { className: "fd-body-sm fd-secondary", style: { margin: 0, textWrap: "pretty" }, children: item.description }),
11758
- item.backend ? /* @__PURE__ */ jsxs81("div", { className: "fd-row", style: { gap: 10, alignItems: "flex-start" }, children: [
11905
+ /* @__PURE__ */ jsx96("p", { className: "fd-body-sm fd-secondary", style: { margin: 0, textWrap: "pretty" }, children: item2.description }),
11906
+ item2.backend ? /* @__PURE__ */ jsxs81("div", { className: "fd-row", style: { gap: 10, alignItems: "flex-start" }, children: [
11759
11907
  /* @__PURE__ */ jsx96("span", { className: "fd-overline fd-muted", style: { width: 62, flex: "none", paddingTop: 2 }, children: "Backend" }),
11760
- /* @__PURE__ */ jsx96("span", { className: "fd-body-sm", style: { flex: 1, textWrap: "pretty" }, children: item.backend })
11908
+ /* @__PURE__ */ jsx96("span", { className: "fd-body-sm", style: { flex: 1, textWrap: "pretty" }, children: item2.backend })
11761
11909
  ] }) : null,
11762
11910
  /* @__PURE__ */ jsxs81("div", { className: "fd-row", style: { gap: 12, flexWrap: "wrap" }, children: [
11763
- item.effort ? /* @__PURE__ */ jsxs81("span", { className: "fd-body-sm fd-muted", children: [
11911
+ item2.effort ? /* @__PURE__ */ jsxs81("span", { className: "fd-body-sm fd-muted", children: [
11764
11912
  /* @__PURE__ */ jsx96("i", { className: "ph ph-hourglass-medium" }),
11765
11913
  " ",
11766
- item.effort
11914
+ item2.effort
11767
11915
  ] }) : null,
11768
11916
  /* @__PURE__ */ jsxs81("span", { className: "fd-body-sm fd-muted", children: [
11769
11917
  /* @__PURE__ */ jsx96("i", { className: "ph ph-user" }),
11770
11918
  " ",
11771
- item.owner
11919
+ item2.owner
11772
11920
  ] }),
11773
- item.screen ? /* @__PURE__ */ jsx96(Badge, { tone: "neutral", icon: "browser", children: "screen" }) : null,
11921
+ item2.screen ? /* @__PURE__ */ jsx96(Badge, { tone: "neutral", icon: "browser", children: "screen" }) : null,
11774
11922
  /* @__PURE__ */ jsx96("span", { style: { flex: 1 } }),
11775
11923
  /* @__PURE__ */ jsx96(
11776
11924
  "button",
11777
11925
  {
11778
11926
  type: "button",
11779
- onClick: () => onOpenFlag && onOpenFlag(item.key),
11927
+ onClick: () => onOpenFlag && onOpenFlag(item2.key),
11780
11928
  style: { all: "unset", cursor: "pointer", display: "inline-flex", alignItems: "center", gap: 5 },
11781
- children: /* @__PURE__ */ jsx96("code", { className: "fd-mono", style: { fontSize: 11, color: "var(--brand)" }, children: item.key })
11929
+ children: /* @__PURE__ */ jsx96("code", { className: "fd-mono", style: { fontSize: 11, color: "var(--brand)" }, children: item2.key })
11782
11930
  }
11783
11931
  )
11784
11932
  ] }),
@@ -11786,7 +11934,7 @@ function RoadmapCard({ item, byKey, onOpenFlag }) {
11786
11934
  /* @__PURE__ */ jsx96("span", { className: "fd-overline fd-muted", style: { paddingTop: 3 }, children: "After" }),
11787
11935
  deps.map((d) => /* @__PURE__ */ jsx96(Tag, { icon: d.implemented ? "check" : "clock", children: d.label }, d.key))
11788
11936
  ] }) : null,
11789
- blocking.length && !item.implemented ? /* @__PURE__ */ jsxs81("span", { className: "fd-body-sm", style: { color: "var(--warn-text)" }, children: [
11937
+ blocking.length && !item2.implemented ? /* @__PURE__ */ jsxs81("span", { className: "fd-body-sm", style: { color: "var(--warn-text)" }, children: [
11790
11938
  "Blocked until ",
11791
11939
  blocking.map((d) => d.label).join(" and "),
11792
11940
  " ",
@@ -11880,19 +12028,19 @@ function RoadmapTimeline({ onOpenFlag, title = "Roadmap", lede }) {
11880
12028
  ),
11881
12029
  /* @__PURE__ */ jsx96("div", { className: "fd-rm", children: /* @__PURE__ */ jsx96("div", { className: "fd-rm-scroll", ref: scrollRef, children: /* @__PURE__ */ jsxs81("div", { className: "fd-rm-track", children: [
11882
12030
  /* @__PURE__ */ jsx96("span", { className: "fd-rm-spine", children: /* @__PURE__ */ jsx96("span", { className: "fd-rm-spine-done", style: { height: items.length ? 100 * shippedShown / items.length + "%" : "0%" } }) }),
11883
- items.map((item, n) => {
11884
- const showPhase = item.phase !== lastPhase;
11885
- lastPhase = item.phase;
11886
- const inPhase = items.filter((i) => i.phase === item.phase).length;
12031
+ items.map((item2, n) => {
12032
+ const showPhase = item2.phase !== lastPhase;
12033
+ lastPhase = item2.phase;
12034
+ const inPhase = items.filter((i) => i.phase === item2.phase).length;
11887
12035
  const isBoundary = n === firstPending;
11888
12036
  return /* @__PURE__ */ jsxs81(React74.Fragment, { children: [
11889
12037
  showPhase ? /* @__PURE__ */ jsxs81("div", { className: "fd-rm-era", children: [
11890
12038
  /* @__PURE__ */ jsxs81("span", { className: "fd-row", style: { gap: 8, flexWrap: "wrap", alignItems: "baseline" }, children: [
11891
- /* @__PURE__ */ jsx96("span", { style: { fontWeight: 700 }, children: item.phase === 0 ? "Shipped" : "Phase " + item.phase + " \u2014 " + item.phaseName }),
11892
- item.phase === 0 ? null : /* @__PURE__ */ jsxs81("span", { className: "fd-mono", style: { opacity: 0.7, fontWeight: 400 }, children: [
11893
- fmtDate(item.phaseStart),
12039
+ /* @__PURE__ */ jsx96("span", { style: { fontWeight: 700 }, children: item2.phase === 0 ? "Shipped" : "Phase " + item2.phase + " \u2014 " + item2.phaseName }),
12040
+ item2.phase === 0 ? null : /* @__PURE__ */ jsxs81("span", { className: "fd-mono", style: { opacity: 0.7, fontWeight: 400 }, children: [
12041
+ fmtDate(item2.phaseStart),
11894
12042
  " \u2013 ",
11895
- fmtDate(item.date)
12043
+ fmtDate(item2.date)
11896
12044
  ] }),
11897
12045
  /* @__PURE__ */ jsxs81("span", { style: { opacity: 0.7, fontWeight: 400 }, children: [
11898
12046
  "\xB7 ",
@@ -11901,22 +12049,22 @@ function RoadmapTimeline({ onOpenFlag, title = "Roadmap", lede }) {
11901
12049
  inPhase === 1 ? "" : "s"
11902
12050
  ] })
11903
12051
  ] }),
11904
- item.phaseWhy ? /* @__PURE__ */ jsx96("p", { className: "fd-rm-era-why", children: item.phaseWhy }) : null
12052
+ item2.phaseWhy ? /* @__PURE__ */ jsx96("p", { className: "fd-rm-era-why", children: item2.phaseWhy }) : null
11905
12053
  ] }) : null,
11906
12054
  isBoundary ? /* @__PURE__ */ jsx96("div", { className: "fd-rm-now", ref: nowRef, children: /* @__PURE__ */ jsxs81("span", { className: "fd-rm-now-pill", children: [
11907
12055
  /* @__PURE__ */ jsx96("i", { className: "ph ph-map-pin" }),
11908
12056
  " You are here \u2014 everything above is wired"
11909
12057
  ] }) }) : null,
11910
12058
  /* @__PURE__ */ jsxs81("div", { className: "fd-rm-row", children: [
11911
- /* @__PURE__ */ jsx96("span", { className: "fd-rm-dot " + (item.implemented ? "is-shipped" : item.status === "next" ? "is-next" : "") }),
12059
+ /* @__PURE__ */ jsx96("span", { className: "fd-rm-dot " + (item2.implemented ? "is-shipped" : item2.status === "next" ? "is-next" : "") }),
11912
12060
  /* @__PURE__ */ jsxs81("div", { className: "fd-rm-date", children: [
11913
- fmtDate(item.date),
12061
+ fmtDate(item2.date),
11914
12062
  /* @__PURE__ */ jsx96("br", {}),
11915
- /* @__PURE__ */ jsx96("span", { style: { opacity: 0.75 }, children: item.implemented ? "shipped" : "phase " + item.phase })
12063
+ /* @__PURE__ */ jsx96("span", { style: { opacity: 0.75 }, children: item2.implemented ? "shipped" : "phase " + item2.phase })
11916
12064
  ] }),
11917
- /* @__PURE__ */ jsx96(RoadmapCard, { item, byKey, onOpenFlag })
12065
+ /* @__PURE__ */ jsx96(RoadmapCard, { item: item2, byKey, onOpenFlag })
11918
12066
  ] })
11919
- ] }, item.key);
12067
+ ] }, item2.key);
11920
12068
  }),
11921
12069
  !items.length ? /* @__PURE__ */ jsx96("p", { className: "fd-body-sm fd-muted", children: "Nothing matches that filter." }) : null
11922
12070
  ] }) }) }),
@@ -13213,13 +13361,15 @@ function useChatEngine(opts) {
13213
13361
  if (m.role === "assistant") ownAssistants.push(m);
13214
13362
  }
13215
13363
  }
13216
- const progress = ownAssistants.pop();
13364
+ const rowAt = turn?.stored ? ownAssistants.findIndex((m) => m.id === turn.holderId) : ownAssistants.length - 1;
13365
+ const progress = rowAt < 0 ? void 0 : ownAssistants.splice(rowAt, 1)[0];
13217
13366
  const cards = ownAssistants;
13218
13367
  const ids = new Set(server.map((m) => m.id));
13219
13368
  serverCount.current = server.length;
13220
13369
  serverIds.current = ids;
13221
13370
  const settled = server.filter((m) => !ownIds.has(m.id) && !retired.current.has(m.id));
13222
- const local = listRef.current.filter((m) => !ids.has(m.id));
13371
+ const turnOwn = (m) => !!turn?.stored && (m.id === turn.userId || m.id === turn.holderId);
13372
+ const local = listRef.current.filter((m) => turnOwn(m) || !ids.has(m.id));
13223
13373
  const at = local.findIndex((m) => m.id === turn?.holderId);
13224
13374
  const tail = at < 0 ? [...cards, ...local] : [...local.slice(0, at), ...cards, ...local.slice(at)];
13225
13375
  const next = [...settled, ...tail];
@@ -13389,7 +13539,15 @@ function useChatEngine(opts) {
13389
13539
  { id: userId, role: "user", text: turn.text || null, attachments: turn.attachments, pending: true, timestamp: (/* @__PURE__ */ new Date()).toISOString() },
13390
13540
  { id: holderId, role: "assistant", text: "", streaming: !!apiAdapter.streamMessage, working: !apiAdapter.streamMessage, timestamp: (/* @__PURE__ */ new Date()).toISOString() }
13391
13541
  );
13392
- liveTurn.current = { known: new Set(serverIds.current), holderId };
13542
+ const live = { known: new Set(serverIds.current), userId, holderId, stored: false };
13543
+ liveTurn.current = live;
13544
+ const adopt = (stored) => {
13545
+ if (live.stored) return;
13546
+ live.stored = true;
13547
+ 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));
13548
+ live.userId = stored.user_message_id;
13549
+ live.holderId = stored.assistant_message_id;
13550
+ };
13393
13551
  const ac = typeof AbortController !== "undefined" ? new AbortController() : { abort() {
13394
13552
  }, signal: void 0 };
13395
13553
  abortRef.current = ac;
@@ -13398,53 +13556,54 @@ function useChatEngine(opts) {
13398
13556
  let res;
13399
13557
  if (apiAdapter.streamMessage) {
13400
13558
  res = await apiAdapter.streamMessage(id, turn.text, {
13401
- onToken: (chunk) => patch(holderId, (m) => ({ text: (m.text || "") + chunk, streaming: true })),
13559
+ onAccepted: adopt,
13560
+ onToken: (chunk) => patch(live.holderId, (m) => ({ text: (m.text || "") + chunk, streaming: true })),
13402
13561
  // chunks append
13403
- onStep: (step) => patch(holderId, (m) => {
13562
+ onStep: (step) => patch(live.holderId, (m) => {
13404
13563
  const steps = (m.steps || []).slice();
13405
13564
  const at = steps.findIndex((s) => s.id === step.id);
13406
13565
  if (at === -1) steps.push(step);
13407
13566
  else steps[at] = Object.assign({}, steps[at], step);
13408
13567
  return { steps };
13409
13568
  }),
13410
- onThinking: (chunk) => patch(holderId, (m) => ({ thinking: (m.thinking || "") + chunk }))
13569
+ onThinking: (chunk) => patch(live.holderId, (m) => ({ thinking: (m.thinking || "") + chunk }))
13411
13570
  }, ac.signal, turn.attachments && turn.attachments.length ? turn.attachments : void 0);
13412
13571
  } else if (turn.attachments && turn.attachments.length) {
13413
13572
  res = await apiAdapter.sendMessage(id, turn.text, ac.signal, turn.attachments);
13414
13573
  } else {
13415
13574
  res = await apiAdapter.sendMessage(id, turn.text, ac.signal);
13416
13575
  }
13417
- patch(userId, { pending: false });
13576
+ patch(live.userId, { pending: false });
13418
13577
  if (!res) throw new Error("send_failed");
13419
13578
  const r = res;
13420
13579
  if (r.dispatched) {
13421
- patch(holderId, { streaming: false, working: true, jobId: r.job_id, text: r.reply || "" });
13422
- await pollJob(r.job_id, holderId);
13580
+ patch(live.holderId, { streaming: false, working: true, jobId: r.job_id, text: r.reply || "" });
13581
+ await pollJob(r.job_id, live.holderId);
13423
13582
  } else {
13424
- patch(holderId, {
13583
+ patch(live.holderId, {
13425
13584
  streaming: false,
13426
13585
  working: false,
13427
- text: r.reply != null ? r.reply : listRef.current.find((m) => m.id === holderId)?.text || "",
13586
+ text: r.reply != null ? r.reply : listRef.current.find((m) => m.id === live.holderId)?.text || "",
13428
13587
  packet: r.packet,
13429
- steps: r.steps || listRef.current.find((m) => m.id === holderId)?.steps,
13588
+ steps: r.steps || listRef.current.find((m) => m.id === live.holderId)?.steps,
13430
13589
  citations: r.citations,
13431
13590
  usage: r.usage,
13432
13591
  model: r.model,
13433
13592
  timestamp: (/* @__PURE__ */ new Date()).toISOString()
13434
13593
  });
13435
- commit(listRef.current.map((m) => m.id === userId ? { ...m, id: r.user_message_id } : m.id === holderId ? { ...m, id: r.assistant_message_id } : m));
13594
+ adopt(r);
13436
13595
  serverCount.current += 2;
13437
13596
  if (r.packet && onPacket) onPacket(r.packet);
13438
13597
  }
13439
13598
  } catch (err) {
13440
13599
  const aborted = err && (err.name === "AbortError" || err.message === "aborted") || stoppedRef.current;
13441
- patch(userId, { pending: false });
13600
+ patch(live.userId, { pending: false });
13442
13601
  if (aborted) {
13443
- patch(holderId, (m) => ({ streaming: false, working: false, stopped: true, retryable: true, text: m.text || null }));
13602
+ patch(live.holderId, (m) => ({ streaming: false, working: false, stopped: true, retryable: true, text: m.text || null }));
13444
13603
  } else if (!fail(err)) {
13445
- patch(holderId, { streaming: false, working: false, error: err?.message || "send_failed", retryable: true });
13604
+ patch(live.holderId, { streaming: false, working: false, error: err?.message || "send_failed", retryable: true });
13446
13605
  } else {
13447
- commit(listRef.current.filter((m) => m.id !== holderId));
13606
+ commit(listRef.current.filter((m) => m.id !== live.holderId));
13448
13607
  }
13449
13608
  } finally {
13450
13609
  const known = liveTurn.current.known;
@@ -14346,7 +14505,7 @@ function ModelControls({
14346
14505
  }
14347
14506
  flat.push(m);
14348
14507
  });
14349
- const item = (m) => ({
14508
+ const item2 = (m) => ({
14350
14509
  id: m.id,
14351
14510
  label: m.label,
14352
14511
  description: m.description,
@@ -14356,11 +14515,11 @@ function ModelControls({
14356
14515
  shortcut: m.shortcut ? /* @__PURE__ */ jsx111(KeyHint, { keys: m.shortcut, size: "sm" }) : void 0,
14357
14516
  onSelect: () => onModelChange && onModelChange(m.id)
14358
14517
  });
14359
- const items = [{ kind: "section", label: "Models" }].concat(flat.map(item));
14518
+ const items = [{ kind: "section", label: "Models" }].concat(flat.map(item2));
14360
14519
  Object.keys(grouped).forEach((g) => {
14361
- items.push({ id: "grp_" + g, label: g, icon: "stack", submenu: grouped[g].map(item) });
14520
+ items.push({ id: "grp_" + g, label: g, icon: "stack", submenu: grouped[g].map(item2) });
14362
14521
  });
14363
- if (moreModels && moreModels.length) items.push({ id: "more", label: "More models", submenu: moreModels.map(item) });
14522
+ if (moreModels && moreModels.length) items.push({ id: "more", label: "More models", submenu: moreModels.map(item2) });
14364
14523
  if (onFastModeChange) {
14365
14524
  items.push({ kind: "separator" });
14366
14525
  items.push({ kind: "section", label: "Fast mode" });
@@ -16187,6 +16346,7 @@ function createChatAdapter(transport, { onTurnStarted, deadlineMs = CHAT_CALL_DE
16187
16346
  onTurnStarted?.();
16188
16347
  };
16189
16348
  const accepting = {
16349
+ onAccepted: handlers.onAccepted && ((ids) => (markStarted(), handlers.onAccepted(ids))),
16190
16350
  onToken: (chunk) => (markStarted(), handlers.onToken(chunk)),
16191
16351
  onStep: handlers.onStep && ((step) => (markStarted(), handlers.onStep(step))),
16192
16352
  onThinking: handlers.onThinking && ((chunk) => (markStarted(), handlers.onThinking(chunk)))
@@ -16555,6 +16715,7 @@ export {
16555
16715
  extensionOf,
16556
16716
  extractClipboardFiles,
16557
16717
  filterFiles,
16718
+ folderFiles,
16558
16719
  formatAbsolute,
16559
16720
  formatBytes,
16560
16721
  formatClock,
@@ -16577,6 +16738,7 @@ export {
16577
16738
  isUsStateCode,
16578
16739
  isWithinLayerTree,
16579
16740
  jobBucket,
16741
+ jsonPathPosition,
16580
16742
  languageLabel,
16581
16743
  loadPrefs,
16582
16744
  markdownToText,