@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.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
  }
@@ -9968,11 +9986,59 @@ var MarkdownEditor = React60.forwardRef(function MarkdownEditor2({
9968
9986
  // src/components/forms/CodeEditor.tsx
9969
9987
  var React61 = __toESM(require("react"), 1);
9970
9988
  var import_view = require("@codemirror/view");
9971
- var import_state = require("@codemirror/state");
9989
+ var import_state2 = require("@codemirror/state");
9972
9990
  var import_commands = require("@codemirror/commands");
9973
9991
  var import_lang_sql = require("@codemirror/lang-sql");
9974
- var import_language = require("@codemirror/language");
9992
+ var import_lang_json2 = require("@codemirror/lang-json");
9993
+ var import_language2 = require("@codemirror/language");
9975
9994
  var import_highlight = require("@lezer/highlight");
9995
+
9996
+ // src/components/forms/jsonDiagnostics.ts
9997
+ var import_state = require("@codemirror/state");
9998
+ var import_lang_json = require("@codemirror/lang-json");
9999
+ var import_language = require("@codemirror/language");
10000
+ var PARSE_BUDGET_MS = 1e3;
10001
+ function firstErrorOffset(state) {
10002
+ const tree = (0, import_language.ensureSyntaxTree)(state, state.doc.length, PARSE_BUDGET_MS);
10003
+ let at = -1;
10004
+ tree?.iterate({
10005
+ enter(node) {
10006
+ if (at >= 0) return false;
10007
+ if (node.type.isError) {
10008
+ at = node.from;
10009
+ return false;
10010
+ }
10011
+ return void 0;
10012
+ }
10013
+ });
10014
+ return at;
10015
+ }
10016
+ function jsonSyntaxDiagnostics(text) {
10017
+ if (!text.trim()) return [];
10018
+ try {
10019
+ JSON.parse(text);
10020
+ return [];
10021
+ } catch (e) {
10022
+ if (!(e instanceof SyntaxError)) throw e;
10023
+ const state = import_state.EditorState.create({ doc: text, extensions: [(0, import_lang_json.json)()] });
10024
+ const offset = firstErrorOffset(state);
10025
+ const line = state.doc.lineAt(offset < 0 ? state.doc.length : offset);
10026
+ const at = offset < 0 ? state.doc.length : offset;
10027
+ return [{
10028
+ line: line.number,
10029
+ column: at - line.from + 1,
10030
+ message: e.message.replace(/, ".*" is not valid JSON$/s, ""),
10031
+ severity: "error"
10032
+ }];
10033
+ }
10034
+ }
10035
+ function jsonModeDiagnostics(text, validate) {
10036
+ const syntax = jsonSyntaxDiagnostics(text);
10037
+ if (syntax.length || !validate) return syntax;
10038
+ return validate(text);
10039
+ }
10040
+
10041
+ // src/components/forms/CodeEditor.tsx
9976
10042
  var import_jsx_runtime87 = require("react/jsx-runtime");
9977
10043
  function clampOffset(state, line, column) {
9978
10044
  const total = state.doc.lines;
@@ -9990,8 +10056,8 @@ function toCmDiagnostics(state, diags) {
9990
10056
  return { from, to, severity: d.severity || "error", message: d.message, source: void 0 };
9991
10057
  });
9992
10058
  }
9993
- var setDiagnosticsEffect = import_state.StateEffect.define();
9994
- var diagnosticsField = import_state.StateField.define({
10059
+ var setDiagnosticsEffect = import_state2.StateEffect.define();
10060
+ var diagnosticsField = import_state2.StateField.define({
9995
10061
  create: () => [],
9996
10062
  update(value, tr) {
9997
10063
  for (const e of tr.effects) if (e.is(setDiagnosticsEffect)) return e.value;
@@ -9999,7 +10065,7 @@ var diagnosticsField = import_state.StateField.define({
9999
10065
  return value.map((d) => ({ ...d, from: tr.changes.mapPos(d.from), to: tr.changes.mapPos(d.to) }));
10000
10066
  }
10001
10067
  });
10002
- var tokenHighlight = import_language.HighlightStyle.define([
10068
+ var tokenHighlight = import_language2.HighlightStyle.define([
10003
10069
  { tag: import_highlight.tags.keyword, class: "tok-kw" },
10004
10070
  { tag: import_highlight.tags.string, class: "tok-str" },
10005
10071
  { tag: [import_highlight.tags.number, import_highlight.tags.bool], class: "tok-num" },
@@ -10059,7 +10125,9 @@ function CodeEditor({
10059
10125
  disabled = false,
10060
10126
  readOnly = false,
10061
10127
  placeholder: placeholderText = "",
10062
- diagnostics = [],
10128
+ diagnostics: passedDiagnostics,
10129
+ language = "sql",
10130
+ validate,
10063
10131
  showEscapeHint = true,
10064
10132
  minHeight = 160,
10065
10133
  id,
@@ -10068,6 +10136,13 @@ function CodeEditor({
10068
10136
  autoFocus = false
10069
10137
  }) {
10070
10138
  const fieldId = useFieldId(id);
10139
+ const diagnostics = React61.useMemo(
10140
+ () => [
10141
+ ...passedDiagnostics ?? [],
10142
+ ...language === "json" ? jsonModeDiagnostics(value, validate) : []
10143
+ ],
10144
+ [passedDiagnostics, language, value, validate]
10145
+ );
10071
10146
  const descId = fieldId + "-desc";
10072
10147
  const liveId = fieldId + "-live";
10073
10148
  const hostRef = React61.useRef(null);
@@ -10075,9 +10150,10 @@ function CodeEditor({
10075
10150
  const valueRef = React61.useRef(value);
10076
10151
  const onChangeRef = React61.useRef(onChange);
10077
10152
  onChangeRef.current = onChange;
10078
- const editableCompartment = React61.useRef(new import_state.Compartment()).current;
10079
- const readOnlyCompartment = React61.useRef(new import_state.Compartment()).current;
10080
- const attributesCompartment = React61.useRef(new import_state.Compartment()).current;
10153
+ const editableCompartment = React61.useRef(new import_state2.Compartment()).current;
10154
+ const languageCompartment = React61.useRef(new import_state2.Compartment()).current;
10155
+ const readOnlyCompartment = React61.useRef(new import_state2.Compartment()).current;
10156
+ const attributesCompartment = React61.useRef(new import_state2.Compartment()).current;
10081
10157
  const errorRef = React61.useRef(error);
10082
10158
  errorRef.current = error;
10083
10159
  const diagnosticsCountRef = React61.useRef(diagnostics.length);
@@ -10099,16 +10175,16 @@ function CodeEditor({
10099
10175
  valueRef.current = next;
10100
10176
  onChangeRef.current && onChangeRef.current(next);
10101
10177
  });
10102
- const state = import_state.EditorState.create({
10178
+ const state = import_state2.EditorState.create({
10103
10179
  doc: value,
10104
10180
  extensions: [
10105
10181
  (0, import_view.lineNumbers)(),
10106
10182
  (0, import_commands.history)(),
10107
10183
  (0, import_view.drawSelection)(),
10108
- (0, import_language.indentOnInput)(),
10109
- (0, import_language.bracketMatching)(),
10110
- (0, import_lang_sql.sql)(),
10111
- (0, import_language.syntaxHighlighting)(tokenHighlight),
10184
+ (0, import_language2.indentOnInput)(),
10185
+ (0, import_language2.bracketMatching)(),
10186
+ languageCompartment.of(language === "json" ? (0, import_lang_json2.json)() : (0, import_lang_sql.sql)()),
10187
+ (0, import_language2.syntaxHighlighting)(tokenHighlight),
10112
10188
  diagnosticsField,
10113
10189
  decorationsFromDiagnostics(),
10114
10190
  editorTheme,
@@ -10119,7 +10195,7 @@ function CodeEditor({
10119
10195
  ...import_commands.historyKeymap
10120
10196
  ]),
10121
10197
  editableCompartment.of(import_view.EditorView.editable.of(!disabled)),
10122
- readOnlyCompartment.of(import_state.EditorState.readOnly.of(readOnly)),
10198
+ readOnlyCompartment.of(import_state2.EditorState.readOnly.of(readOnly)),
10123
10199
  updateListener,
10124
10200
  attributesCompartment.of(import_view.EditorView.contentAttributes.of(contentAttributes()))
10125
10201
  ]
@@ -10149,7 +10225,12 @@ function CodeEditor({
10149
10225
  React61.useEffect(() => {
10150
10226
  const view = viewRef.current;
10151
10227
  if (!view) return;
10152
- view.dispatch({ effects: readOnlyCompartment.reconfigure(import_state.EditorState.readOnly.of(readOnly)) });
10228
+ view.dispatch({ effects: languageCompartment.reconfigure(language === "json" ? (0, import_lang_json2.json)() : (0, import_lang_sql.sql)()) });
10229
+ }, [language, languageCompartment]);
10230
+ React61.useEffect(() => {
10231
+ const view = viewRef.current;
10232
+ if (!view) return;
10233
+ view.dispatch({ effects: readOnlyCompartment.reconfigure(import_state2.EditorState.readOnly.of(readOnly)) });
10153
10234
  }, [readOnly, readOnlyCompartment]);
10154
10235
  React61.useEffect(() => {
10155
10236
  const view = viewRef.current;
@@ -10208,6 +10289,75 @@ function CodeEditor({
10208
10289
  ] });
10209
10290
  }
10210
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
+
10211
10361
  // src/components/forms/RadioGroup.tsx
10212
10362
  var React62 = __toESM(require("react"), 1);
10213
10363
  var import_jsx_runtime88 = require("react/jsx-runtime");
@@ -10263,18 +10413,18 @@ function useSessionContext() {
10263
10413
  var import_jsx_runtime90 = require("react/jsx-runtime");
10264
10414
  var DEFAULT_LINKS = [];
10265
10415
  var DEFAULT_GROUPS = [];
10266
- function Item({ item, onPick }) {
10416
+ function Item({ item: item2, onPick }) {
10267
10417
  return /* @__PURE__ */ (0, import_jsx_runtime90.jsxs)(
10268
10418
  "button",
10269
10419
  {
10270
10420
  type: "button",
10271
10421
  role: "menuitem",
10272
10422
  className: "fd-acct-item",
10273
- onClick: () => onPick(item),
10423
+ onClick: () => onPick(item2),
10274
10424
  children: [
10275
- item.icon ? /* @__PURE__ */ (0, import_jsx_runtime90.jsx)("i", { className: "ph ph-" + item.icon, "aria-hidden": "true" }) : null,
10276
- /* @__PURE__ */ (0, import_jsx_runtime90.jsx)("span", { style: { flex: 1 }, children: item.label }),
10277
- 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
10278
10428
  ]
10279
10429
  }
10280
10430
  );
@@ -10301,11 +10451,11 @@ function AccountMenu({
10301
10451
  setOpen(false);
10302
10452
  setSignOutError(null);
10303
10453
  };
10304
- const pick = (item) => {
10454
+ const pick = (item2) => {
10305
10455
  closeMenu();
10306
- if (item.onSelect) return item.onSelect();
10307
- if (onNavigate) return onNavigate(item.href, item);
10308
- 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;
10309
10459
  };
10310
10460
  const signOut = async () => {
10311
10461
  const handler = onSignOut ?? ctxSignOut;
@@ -12963,41 +13113,41 @@ var fmtDate = (iso2) => {
12963
13113
  const d = /* @__PURE__ */ new Date(String(iso2) + "T00:00:00");
12964
13114
  return isNaN(d) ? iso2 : d.toLocaleDateString(void 0, { month: "short", day: "numeric", year: "numeric" });
12965
13115
  };
12966
- function RoadmapCard({ item, byKey, onOpenFlag }) {
12967
- const s = STATUS[item.status] || STATUS.planned;
12968
- 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);
12969
13119
  const blocking = deps.filter((d) => !d.implemented);
12970
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: [
12971
13121
  /* @__PURE__ */ (0, import_jsx_runtime97.jsxs)("div", { className: "fd-row", style: { gap: 8, flexWrap: "wrap" }, children: [
12972
- /* @__PURE__ */ (0, import_jsx_runtime97.jsx)("span", { className: "fd-body", style: { fontWeight: 700, flex: 1, minWidth: 140 }, children: item.label }),
12973
- /* @__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 }),
12974
13124
  /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(Badge, { tone: s.tone, icon: s.icon, children: s.label })
12975
13125
  ] }),
12976
- /* @__PURE__ */ (0, import_jsx_runtime97.jsx)("p", { className: "fd-body-sm fd-secondary", style: { margin: 0, textWrap: "pretty" }, children: item.description }),
12977
- 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: [
12978
13128
  /* @__PURE__ */ (0, import_jsx_runtime97.jsx)("span", { className: "fd-overline fd-muted", style: { width: 62, flex: "none", paddingTop: 2 }, children: "Backend" }),
12979
- /* @__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 })
12980
13130
  ] }) : null,
12981
13131
  /* @__PURE__ */ (0, import_jsx_runtime97.jsxs)("div", { className: "fd-row", style: { gap: 12, flexWrap: "wrap" }, children: [
12982
- 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: [
12983
13133
  /* @__PURE__ */ (0, import_jsx_runtime97.jsx)("i", { className: "ph ph-hourglass-medium" }),
12984
13134
  " ",
12985
- item.effort
13135
+ item2.effort
12986
13136
  ] }) : null,
12987
13137
  /* @__PURE__ */ (0, import_jsx_runtime97.jsxs)("span", { className: "fd-body-sm fd-muted", children: [
12988
13138
  /* @__PURE__ */ (0, import_jsx_runtime97.jsx)("i", { className: "ph ph-user" }),
12989
13139
  " ",
12990
- item.owner
13140
+ item2.owner
12991
13141
  ] }),
12992
- 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,
12993
13143
  /* @__PURE__ */ (0, import_jsx_runtime97.jsx)("span", { style: { flex: 1 } }),
12994
13144
  /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(
12995
13145
  "button",
12996
13146
  {
12997
13147
  type: "button",
12998
- onClick: () => onOpenFlag && onOpenFlag(item.key),
13148
+ onClick: () => onOpenFlag && onOpenFlag(item2.key),
12999
13149
  style: { all: "unset", cursor: "pointer", display: "inline-flex", alignItems: "center", gap: 5 },
13000
- 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 })
13001
13151
  }
13002
13152
  )
13003
13153
  ] }),
@@ -13005,7 +13155,7 @@ function RoadmapCard({ item, byKey, onOpenFlag }) {
13005
13155
  /* @__PURE__ */ (0, import_jsx_runtime97.jsx)("span", { className: "fd-overline fd-muted", style: { paddingTop: 3 }, children: "After" }),
13006
13156
  deps.map((d) => /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(Tag, { icon: d.implemented ? "check" : "clock", children: d.label }, d.key))
13007
13157
  ] }) : null,
13008
- 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: [
13009
13159
  "Blocked until ",
13010
13160
  blocking.map((d) => d.label).join(" and "),
13011
13161
  " ",
@@ -13099,19 +13249,19 @@ function RoadmapTimeline({ onOpenFlag, title = "Roadmap", lede }) {
13099
13249
  ),
13100
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: [
13101
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%" } }) }),
13102
- items.map((item, n) => {
13103
- const showPhase = item.phase !== lastPhase;
13104
- lastPhase = item.phase;
13105
- 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;
13106
13256
  const isBoundary = n === firstPending;
13107
13257
  return /* @__PURE__ */ (0, import_jsx_runtime97.jsxs)(React74.Fragment, { children: [
13108
13258
  showPhase ? /* @__PURE__ */ (0, import_jsx_runtime97.jsxs)("div", { className: "fd-rm-era", children: [
13109
13259
  /* @__PURE__ */ (0, import_jsx_runtime97.jsxs)("span", { className: "fd-row", style: { gap: 8, flexWrap: "wrap", alignItems: "baseline" }, children: [
13110
- /* @__PURE__ */ (0, import_jsx_runtime97.jsx)("span", { style: { fontWeight: 700 }, children: item.phase === 0 ? "Shipped" : "Phase " + item.phase + " \u2014 " + item.phaseName }),
13111
- item.phase === 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime97.jsxs)("span", { className: "fd-mono", style: { opacity: 0.7, fontWeight: 400 }, children: [
13112
- 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),
13113
13263
  " \u2013 ",
13114
- fmtDate(item.date)
13264
+ fmtDate(item2.date)
13115
13265
  ] }),
13116
13266
  /* @__PURE__ */ (0, import_jsx_runtime97.jsxs)("span", { style: { opacity: 0.7, fontWeight: 400 }, children: [
13117
13267
  "\xB7 ",
@@ -13120,22 +13270,22 @@ function RoadmapTimeline({ onOpenFlag, title = "Roadmap", lede }) {
13120
13270
  inPhase === 1 ? "" : "s"
13121
13271
  ] })
13122
13272
  ] }),
13123
- 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
13124
13274
  ] }) : null,
13125
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: [
13126
13276
  /* @__PURE__ */ (0, import_jsx_runtime97.jsx)("i", { className: "ph ph-map-pin" }),
13127
13277
  " You are here \u2014 everything above is wired"
13128
13278
  ] }) }) : null,
13129
13279
  /* @__PURE__ */ (0, import_jsx_runtime97.jsxs)("div", { className: "fd-rm-row", children: [
13130
- /* @__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" : "") }),
13131
13281
  /* @__PURE__ */ (0, import_jsx_runtime97.jsxs)("div", { className: "fd-rm-date", children: [
13132
- fmtDate(item.date),
13282
+ fmtDate(item2.date),
13133
13283
  /* @__PURE__ */ (0, import_jsx_runtime97.jsx)("br", {}),
13134
- /* @__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 })
13135
13285
  ] }),
13136
- /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(RoadmapCard, { item, byKey, onOpenFlag })
13286
+ /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(RoadmapCard, { item: item2, byKey, onOpenFlag })
13137
13287
  ] })
13138
- ] }, item.key);
13288
+ ] }, item2.key);
13139
13289
  }),
13140
13290
  !items.length ? /* @__PURE__ */ (0, import_jsx_runtime97.jsx)("p", { className: "fd-body-sm fd-muted", children: "Nothing matches that filter." }) : null
13141
13291
  ] }) }) }),
@@ -14432,13 +14582,15 @@ function useChatEngine(opts) {
14432
14582
  if (m.role === "assistant") ownAssistants.push(m);
14433
14583
  }
14434
14584
  }
14435
- 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];
14436
14587
  const cards = ownAssistants;
14437
14588
  const ids = new Set(server.map((m) => m.id));
14438
14589
  serverCount.current = server.length;
14439
14590
  serverIds.current = ids;
14440
14591
  const settled = server.filter((m) => !ownIds.has(m.id) && !retired.current.has(m.id));
14441
- 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));
14442
14594
  const at = local.findIndex((m) => m.id === turn?.holderId);
14443
14595
  const tail = at < 0 ? [...cards, ...local] : [...local.slice(0, at), ...cards, ...local.slice(at)];
14444
14596
  const next = [...settled, ...tail];
@@ -14608,7 +14760,15 @@ function useChatEngine(opts) {
14608
14760
  { id: userId, role: "user", text: turn.text || null, attachments: turn.attachments, pending: true, timestamp: (/* @__PURE__ */ new Date()).toISOString() },
14609
14761
  { id: holderId, role: "assistant", text: "", streaming: !!apiAdapter.streamMessage, working: !apiAdapter.streamMessage, timestamp: (/* @__PURE__ */ new Date()).toISOString() }
14610
14762
  );
14611
- 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
+ };
14612
14772
  const ac = typeof AbortController !== "undefined" ? new AbortController() : { abort() {
14613
14773
  }, signal: void 0 };
14614
14774
  abortRef.current = ac;
@@ -14617,53 +14777,54 @@ function useChatEngine(opts) {
14617
14777
  let res;
14618
14778
  if (apiAdapter.streamMessage) {
14619
14779
  res = await apiAdapter.streamMessage(id, turn.text, {
14620
- 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 })),
14621
14782
  // chunks append
14622
- onStep: (step) => patch(holderId, (m) => {
14783
+ onStep: (step) => patch(live.holderId, (m) => {
14623
14784
  const steps = (m.steps || []).slice();
14624
14785
  const at = steps.findIndex((s) => s.id === step.id);
14625
14786
  if (at === -1) steps.push(step);
14626
14787
  else steps[at] = Object.assign({}, steps[at], step);
14627
14788
  return { steps };
14628
14789
  }),
14629
- onThinking: (chunk) => patch(holderId, (m) => ({ thinking: (m.thinking || "") + chunk }))
14790
+ onThinking: (chunk) => patch(live.holderId, (m) => ({ thinking: (m.thinking || "") + chunk }))
14630
14791
  }, ac.signal, turn.attachments && turn.attachments.length ? turn.attachments : void 0);
14631
14792
  } else if (turn.attachments && turn.attachments.length) {
14632
14793
  res = await apiAdapter.sendMessage(id, turn.text, ac.signal, turn.attachments);
14633
14794
  } else {
14634
14795
  res = await apiAdapter.sendMessage(id, turn.text, ac.signal);
14635
14796
  }
14636
- patch(userId, { pending: false });
14797
+ patch(live.userId, { pending: false });
14637
14798
  if (!res) throw new Error("send_failed");
14638
14799
  const r = res;
14639
14800
  if (r.dispatched) {
14640
- patch(holderId, { streaming: false, working: true, jobId: r.job_id, text: r.reply || "" });
14641
- 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);
14642
14803
  } else {
14643
- patch(holderId, {
14804
+ patch(live.holderId, {
14644
14805
  streaming: false,
14645
14806
  working: false,
14646
- 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 || "",
14647
14808
  packet: r.packet,
14648
- steps: r.steps || listRef.current.find((m) => m.id === holderId)?.steps,
14809
+ steps: r.steps || listRef.current.find((m) => m.id === live.holderId)?.steps,
14649
14810
  citations: r.citations,
14650
14811
  usage: r.usage,
14651
14812
  model: r.model,
14652
14813
  timestamp: (/* @__PURE__ */ new Date()).toISOString()
14653
14814
  });
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));
14815
+ adopt(r);
14655
14816
  serverCount.current += 2;
14656
14817
  if (r.packet && onPacket) onPacket(r.packet);
14657
14818
  }
14658
14819
  } catch (err) {
14659
14820
  const aborted = err && (err.name === "AbortError" || err.message === "aborted") || stoppedRef.current;
14660
- patch(userId, { pending: false });
14821
+ patch(live.userId, { pending: false });
14661
14822
  if (aborted) {
14662
- 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 }));
14663
14824
  } else if (!fail(err)) {
14664
- 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 });
14665
14826
  } else {
14666
- commit(listRef.current.filter((m) => m.id !== holderId));
14827
+ commit(listRef.current.filter((m) => m.id !== live.holderId));
14667
14828
  }
14668
14829
  } finally {
14669
14830
  const known = liveTurn.current.known;
@@ -15565,7 +15726,7 @@ function ModelControls({
15565
15726
  }
15566
15727
  flat.push(m);
15567
15728
  });
15568
- const item = (m) => ({
15729
+ const item2 = (m) => ({
15569
15730
  id: m.id,
15570
15731
  label: m.label,
15571
15732
  description: m.description,
@@ -15575,11 +15736,11 @@ function ModelControls({
15575
15736
  shortcut: m.shortcut ? /* @__PURE__ */ (0, import_jsx_runtime112.jsx)(KeyHint, { keys: m.shortcut, size: "sm" }) : void 0,
15576
15737
  onSelect: () => onModelChange && onModelChange(m.id)
15577
15738
  });
15578
- const items = [{ kind: "section", label: "Models" }].concat(flat.map(item));
15739
+ const items = [{ kind: "section", label: "Models" }].concat(flat.map(item2));
15579
15740
  Object.keys(grouped).forEach((g) => {
15580
- 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) });
15581
15742
  });
15582
- 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) });
15583
15744
  if (onFastModeChange) {
15584
15745
  items.push({ kind: "separator" });
15585
15746
  items.push({ kind: "section", label: "Fast mode" });
@@ -17406,6 +17567,7 @@ function createChatAdapter(transport, { onTurnStarted, deadlineMs = CHAT_CALL_DE
17406
17567
  onTurnStarted?.();
17407
17568
  };
17408
17569
  const accepting = {
17570
+ onAccepted: handlers.onAccepted && ((ids) => (markStarted(), handlers.onAccepted(ids))),
17409
17571
  onToken: (chunk) => (markStarted(), handlers.onToken(chunk)),
17410
17572
  onStep: handlers.onStep && ((step) => (markStarted(), handlers.onStep(step))),
17411
17573
  onThinking: handlers.onThinking && ((chunk) => (markStarted(), handlers.onThinking(chunk)))
@@ -17775,6 +17937,7 @@ function ExportTray({ exports: exports2, keptNote, onDownload, onDismiss }) {
17775
17937
  extensionOf,
17776
17938
  extractClipboardFiles,
17777
17939
  filterFiles,
17940
+ folderFiles,
17778
17941
  formatAbsolute,
17779
17942
  formatBytes,
17780
17943
  formatClock,
@@ -17797,6 +17960,7 @@ function ExportTray({ exports: exports2, keptNote, onDownload, onDismiss }) {
17797
17960
  isUsStateCode,
17798
17961
  isWithinLayerTree,
17799
17962
  jobBucket,
17963
+ jsonPathPosition,
17800
17964
  languageLabel,
17801
17965
  loadPrefs,
17802
17966
  markdownToText,