@ai4b-team/fsaos-gateway-sdk 5.6.0 → 5.6.2

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/iife/ui.js CHANGED
@@ -1,3 +1,3 @@
1
- /* @fsaos/ui v2.0.0 — FSAOS UI Primitives — 2026-11-15T22:54:03.463Z */
1
+ /* @fsaos/ui v2.0.0 — FSAOS UI Primitives — 2026-11-16T02:47:59.504Z */
2
2
  "use strict";var __FSAOS_UI__=(()=>{var m=Object.create;var r=Object.defineProperty;var g=Object.getOwnPropertyDescriptor;var u=Object.getOwnPropertyNames;var f=Object.getPrototypeOf,h=Object.prototype.hasOwnProperty;var y=(e,i)=>()=>(i||e((i={exports:{}}).exports,i),i.exports),N=(e,i)=>{for(var a in i)r(e,a,{get:i[a],enumerable:!0})},s=(e,i,a,l)=>{if(i&&typeof i=="object"||typeof i=="function")for(let t of u(i))!h.call(e,t)&&t!==a&&r(e,t,{get:()=>i[t],enumerable:!(l=g(i,t))||l.enumerable});return e};var x=(e,i,a)=>(a=e!=null?m(f(e)):{},s(i||!e||!e.__esModule?r(a,"default",{value:e,enumerable:!0}):a,e)),b=e=>s(r({},"__esModule",{value:!0}),e);var d=y((V,c)=>{c.exports=React});var P={};N(P,{Badge:()=>z,Breadcrumbs:()=>A,Button:()=>D,Card:()=>w,DataView:()=>R,Detail:()=>_,Empty:()=>I,FilePreview:()=>O,Form:()=>F,Grid:()=>k,Image:()=>G,Link:()=>E,Page:()=>v,Router:()=>T,Sidebar:()=>S,Spinner:()=>B,Stack:()=>C,Table:()=>j,Tabs:()=>W,Video:()=>H});var n=x(d(),1);function o(){return(typeof window<"u"&&window.__FSAOS_CONFIG__||{}).edgeBaseUrl||""}function v(e){return(0,n.createElement)("div",{style:{minHeight:"100vh",display:"flex",flexDirection:"column"},className:e.className||""},e.children)}function C(e){let i=e.direction||"vertical";return(0,n.createElement)("div",{style:{display:"flex",flexDirection:i==="horizontal"?"row":"column",gap:e.gap||"0.5rem",padding:e.padding||"0",alignItems:e.align||"stretch",justifyContent:e.justify||"flex-start",flex:e.flex||"initial"},className:e.className||""},e.children)}function k(e){return(0,n.createElement)("div",{style:{display:"grid",gridTemplateColumns:"repeat("+(e.columns||3)+", 1fr)",gap:e.gap||"1rem",padding:e.padding||"0"},className:e.className||""},e.children)}function S(e){return(0,n.createElement)("div",{style:{display:"flex",flexDirection:"row",minHeight:"100vh"},className:e.className||""},e.children)}function w(e){return(0,n.createElement)("div",{style:{border:"1px solid var(--color-border, #e5e7eb)",borderRadius:"var(--border-radius, 0.5rem)",padding:e.padding||"1rem",background:"var(--color-surface, #fff)"},className:e.className||"",onClick:e.onClick},e.children)}function z(e){return(0,n.createElement)("span",{style:{display:"inline-flex",alignItems:"center",padding:"0.125rem 0.5rem",fontSize:"0.75rem",fontWeight:"500",borderRadius:"9999px",background:e.color||"#e5e7eb",color:e.textColor||"#374151"},className:e.className||""},e.children||e.label)}function B(e){let i=e.size||"1.5rem";return(0,n.createElement)("div",{style:{width:i,height:i,border:"2px solid #e5e7eb",borderTopColor:"var(--color-primary, #3b82f6)",borderRadius:"50%",animation:"fsaos-spin 0.6s linear infinite"}})}function D(e){return(0,n.createElement)("button",{style:{display:"inline-flex",alignItems:"center",justifyContent:"center",padding:"0.5rem 1rem",fontSize:"0.875rem",fontWeight:"500",borderRadius:"var(--border-radius, 0.375rem)",border:e.variant==="outline"?"1px solid var(--color-border, #d1d5db)":"none",background:e.variant==="outline"||e.variant==="ghost"?"transparent":"var(--color-primary, #3b82f6)",color:e.variant==="outline"||e.variant==="ghost"?"var(--color-text, #1a1a1a)":"#fff",cursor:e.disabled?"not-allowed":"pointer",opacity:e.disabled?"0.5":"1",gap:"0.5rem"},className:e.className||"",onClick:e.onClick,disabled:e.disabled},e.children||e.label)}function I(e){return(0,n.createElement)("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",padding:"3rem",color:"var(--color-text-secondary, #6b7280)",textAlign:"center"}},e.icon?(0,n.createElement)("div",{style:{fontSize:"2rem",marginBottom:"0.5rem"}},e.icon):null,(0,n.createElement)("div",{style:{fontWeight:500,marginBottom:"0.25rem"}},e.title||e.message||e.children||"No items"),e.description?(0,n.createElement)("div",{style:{fontSize:"0.875rem",opacity:.7}},e.description):null)}function R(e){return(0,n.createElement)("div",{className:e.className||""},e.children)}function j(e){return(0,n.createElement)("table",{className:e.className||""},e.children)}function F(e){return(0,n.createElement)("form",{className:e.className||"",onSubmit:e.onSubmit},e.children)}function _(e){return(0,n.createElement)("div",{className:e.className||""},e.children)}function T(e){return(0,n.createElement)("div",null,e.children)}function E(e){return(0,n.createElement)("a",{href:e.href||e.to,className:e.className||"",onClick:e.onClick},e.children)}function W(e){return(0,n.createElement)("div",{className:e.className||""},e.children)}function A(e){return(0,n.createElement)("nav",{className:e.className||""},e.children)}function G(e){return(0,n.createElement)("img",{src:e.src||(e.path?o()+e.path:""),alt:e.alt||"",className:e.className||"",style:e.style})}function H(e){return(0,n.createElement)("video",{src:e.src||(e.path?o()+e.path:""),controls:!0,className:e.className||""})}function O(e){return(0,n.createElement)("div",{className:e.className||""},e.children||"File preview")}return b(P);})();
3
3
  //# sourceMappingURL=ui.js.map
package/dist/index.cjs CHANGED
@@ -1771,7 +1771,7 @@ function normalizeItem(raw) {
1771
1771
  const path = raw.path || raw.item_path || "";
1772
1772
  const segments = path.split("/");
1773
1773
  segments.pop();
1774
- const parentPath = segments.join("/");
1774
+ const parentPath2 = segments.join("/");
1775
1775
  const typeData = raw.type_data || {};
1776
1776
  if (typeData.allowed_parent_types && !typeData.accepts) {
1777
1777
  typeData.accepts = typeData.allowed_parent_types;
@@ -1782,7 +1782,7 @@ function normalizeItem(raw) {
1782
1782
  name: raw.name || raw.item_name || "",
1783
1783
  item_type: raw.item_type || "unknown",
1784
1784
  path,
1785
- parent_path: parentPath,
1785
+ parent_path: parentPath2,
1786
1786
  is_active: raw.is_active !== false,
1787
1787
  has_children: raw.has_children ?? false,
1788
1788
  created_at: raw.created_at || nowISO(),
@@ -2413,9 +2413,9 @@ function invalidatePathAndParent(path, fallbackParent) {
2413
2413
  invalidateChildren(path);
2414
2414
  const segments = path.split("/");
2415
2415
  segments.pop();
2416
- const parentPath = segments.join("/") || fallbackParent;
2417
- if (parentPath) {
2418
- invalidateChildren(parentPath);
2416
+ const parentPath2 = segments.join("/") || fallbackParent;
2417
+ if (parentPath2) {
2418
+ invalidateChildren(parentPath2);
2419
2419
  }
2420
2420
  }
2421
2421
  function invalidateSubtree(path) {
@@ -2553,22 +2553,22 @@ function handleVfsChange(data) {
2553
2553
  if (!path) return;
2554
2554
  const segments = path.split("/");
2555
2555
  segments.pop();
2556
- const parentPath = segments.join("/") || "/root";
2557
- let changes = pendingChanges.get(parentPath);
2556
+ const parentPath2 = segments.join("/") || "/root";
2557
+ let changes = pendingChanges.get(parentPath2);
2558
2558
  if (!changes) {
2559
2559
  changes = /* @__PURE__ */ new Map();
2560
- pendingChanges.set(parentPath, changes);
2560
+ pendingChanges.set(parentPath2, changes);
2561
2561
  }
2562
2562
  changes.set(path, { action, itemId: typeof data.item_id === "string" ? data.item_id : void 0 });
2563
- const existing = debounceTimers.get(parentPath);
2563
+ const existing = debounceTimers.get(parentPath2);
2564
2564
  if (existing) clearTimeout(existing);
2565
2565
  const timer = setTimeout(() => {
2566
- debounceTimers.delete(parentPath);
2567
- const flushed = pendingChanges.get(parentPath);
2568
- pendingChanges.delete(parentPath);
2569
- if (flushed) applyInvalidation(parentPath, flushed);
2566
+ debounceTimers.delete(parentPath2);
2567
+ const flushed = pendingChanges.get(parentPath2);
2568
+ pendingChanges.delete(parentPath2);
2569
+ if (flushed) applyInvalidation(parentPath2, flushed);
2570
2570
  }, DEBOUNCE_MS);
2571
- debounceTimers.set(parentPath, timer);
2571
+ debounceTimers.set(parentPath2, timer);
2572
2572
  }
2573
2573
  function handleCcmChange(data) {
2574
2574
  if (!data || typeof data !== "object") return;
@@ -2590,7 +2590,7 @@ function handleCcmChange(data) {
2590
2590
  }, DEBOUNCE_MS);
2591
2591
  debounceTimers.set(debounceKey, timer);
2592
2592
  }
2593
- function applyInvalidation(parentPath, changes) {
2593
+ function applyInvalidation(parentPath2, changes) {
2594
2594
  const client2 = getQueryClient();
2595
2595
  for (const [path, change] of changes) {
2596
2596
  if ((change.action || "").toUpperCase() === "DELETE") {
@@ -2604,7 +2604,7 @@ function applyInvalidation(parentPath, changes) {
2604
2604
  client2.invalidateQueries({ queryKey: vfsKeys.itemById(change.itemId) });
2605
2605
  }
2606
2606
  }
2607
- client2.invalidateQueries({ queryKey: vfsKeys.children(parentPath) });
2607
+ client2.invalidateQueries({ queryKey: vfsKeys.children(parentPath2) });
2608
2608
  const changed = [...changes.keys()];
2609
2609
  client2.invalidateQueries({
2610
2610
  predicate: (query) => {
@@ -2979,9 +2979,57 @@ function channelMessageChange(event, channelPath, parentId, messages) {
2979
2979
  });
2980
2980
  }
2981
2981
 
2982
- // src/channel-realtime.ts
2982
+ // src/channel-transcript-realtime.ts
2983
2983
  var watches = /* @__PURE__ */ new WeakMap();
2984
- function watchChannels(client2, key, normalize) {
2984
+ var parentPath = (path) => path.slice(0, path.lastIndexOf("/"));
2985
+ var actionOf = (change) => change.action?.toLowerCase();
2986
+ function isNewPost(change, channel) {
2987
+ return change.item_type === "message" && actionOf(change) === "insert" && parentPath(change.path) === channel && !change.old_path;
2988
+ }
2989
+ function affectedMessages(page, ids, paths) {
2990
+ return page.messages.filter((message) => ids.has(message.id) || paths.has(message.path));
2991
+ }
2992
+ function updateTranscript(cached, targets, revised, tail) {
2993
+ const pages = cached.pages.slice();
2994
+ const replacements = new Map(revised?.messages.map((message) => [message.id, message]));
2995
+ for (const [index, affected] of targets) {
2996
+ const page = pages[index];
2997
+ const wanted = new Set(affected.map((message) => message.id));
2998
+ const messageCards2 = new Map(page.messageCards);
2999
+ for (const message of affected) {
3000
+ messageCards2.delete(message.path);
3001
+ const replacement = replacements.get(message.id);
3002
+ const cards = replacement && revised?.messageCards.get(replacement.path);
3003
+ if (replacement && cards?.length) messageCards2.set(replacement.path, cards);
3004
+ }
3005
+ pages[index] = {
3006
+ ...page,
3007
+ messages: page.messages.flatMap((message) => {
3008
+ if (!wanted.has(message.id)) return [message];
3009
+ const replacement = replacements.get(message.id);
3010
+ return replacement ? [replacement] : [];
3011
+ }),
3012
+ messageCards: messageCards2
3013
+ };
3014
+ }
3015
+ const snapshot = tail ?? revised;
3016
+ const latest = pages[0];
3017
+ const messageCards = new Map(latest.messageCards);
3018
+ for (const message of latest.activityMessages ?? []) messageCards.delete(message.path);
3019
+ for (const message of [...snapshot.activityMessages ?? [], ...tail?.messages ?? []]) {
3020
+ const cards = snapshot.messageCards.get(message.path);
3021
+ if (cards?.length) messageCards.set(message.path, cards);
3022
+ }
3023
+ pages[0] = {
3024
+ ...latest,
3025
+ messages: tail ? [...latest.messages, ...tail.messages] : latest.messages,
3026
+ activityMessages: snapshot.activityMessages,
3027
+ siblingCards: snapshot.siblingCards,
3028
+ messageCards
3029
+ };
3030
+ return { ...cached, pages };
3031
+ }
3032
+ function watchChannelTranscript(client2, key, channel, limit) {
2985
3033
  let entries = watches.get(client2);
2986
3034
  if (!entries) {
2987
3035
  entries = /* @__PURE__ */ new Map();
@@ -2989,6 +3037,133 @@ function watchChannels(client2, key, normalize) {
2989
3037
  }
2990
3038
  const hash = JSON.stringify(key);
2991
3039
  let watch = entries.get(hash);
3040
+ if (!watch) {
3041
+ let timer;
3042
+ let running2 = false;
3043
+ let stopped = false;
3044
+ const pending4 = /* @__PURE__ */ new Map();
3045
+ const current = () => client2.getQueryData(key);
3046
+ const query = () => client2.getQueryCache().find({ queryKey: key, exact: true });
3047
+ const reload = () => refreshQuery(client2, key, { exact: true });
3048
+ const read = (after_seq, before_seq) => fetchChannelMessagesPage(channel, { transcriptOnly: true, limit, after_seq, before_seq });
3049
+ const schedule2 = () => {
3050
+ if (stopped || running2 || timer || !pending4.size) return;
3051
+ timer = setTimeout(() => {
3052
+ timer = void 0;
3053
+ void flush();
3054
+ }, 500);
3055
+ };
3056
+ const flush = async () => {
3057
+ running2 = true;
3058
+ const changes = [...pending4.values()];
3059
+ pending4.clear();
3060
+ const owner = query();
3061
+ try {
3062
+ if (owner?.state.fetchStatus === "fetching") await owner.promise?.catch(() => void 0);
3063
+ if (stopped || owner !== query()) return;
3064
+ const cached = current();
3065
+ if (!cached?.pages.length) {
3066
+ await reload();
3067
+ return;
3068
+ }
3069
+ const ids = /* @__PURE__ */ new Set();
3070
+ const paths = /* @__PURE__ */ new Set();
3071
+ const possiblyAdmitted = /* @__PURE__ */ new Set();
3072
+ let append = false;
3073
+ for (const change of changes) {
3074
+ if (isNewPost(change, channel)) {
3075
+ append = true;
3076
+ continue;
3077
+ }
3078
+ if (change.inserted) append = true;
3079
+ if (change.item_type === "message" && parentPath(change.path) === channel && !change.inserted && actionOf(change) !== "delete") possiblyAdmitted.add(change.path);
3080
+ if (change.item_id) ids.add(change.item_id);
3081
+ if (change.parent_id) ids.add(change.parent_id);
3082
+ for (const path of [change.path, change.old_path]) {
3083
+ if (path && isChannelPath(path, channel)) {
3084
+ paths.add(path);
3085
+ paths.add(parentPath(path));
3086
+ }
3087
+ }
3088
+ }
3089
+ const targets = /* @__PURE__ */ new Map();
3090
+ let low = Infinity;
3091
+ let high = 0;
3092
+ if (ids.size || paths.size) {
3093
+ cached.pages.forEach((page, index) => {
3094
+ const affected = affectedMessages(page, ids, paths);
3095
+ if (affected.length) targets.set(index, affected);
3096
+ for (const message of affected) {
3097
+ possiblyAdmitted.delete(message.path);
3098
+ low = Math.min(low, message.seq);
3099
+ high = Math.max(high, message.seq);
3100
+ }
3101
+ });
3102
+ }
3103
+ for (const activity of cached.pages[0].activityMessages ?? []) possiblyAdmitted.delete(activity.path);
3104
+ if (possiblyAdmitted.size) {
3105
+ await reload();
3106
+ return;
3107
+ }
3108
+ if (targets.size && (!Number.isSafeInteger(low) || low < 1 || !Number.isSafeInteger(high + 1))) {
3109
+ await reload();
3110
+ return;
3111
+ }
3112
+ const latest = cached.pages.find((page) => page.messages.length)?.messages.at(-1)?.seq ?? 0;
3113
+ const [revised, tail] = await Promise.all([
3114
+ targets.size ? read(low - 1, high + 1) : void 0,
3115
+ append || !targets.size ? read(latest) : void 0
3116
+ ]);
3117
+ if (stopped || owner !== query()) return;
3118
+ const settled = current();
3119
+ if (owner?.state.fetchStatus === "fetching" || cached.pages.some((page, index) => settled?.pages[index] !== page) || revised && revised.messages.length >= limit && (revised.messages.at(-1)?.seq ?? 0) < high || tail && tail.messages.length >= limit) {
3120
+ await reload();
3121
+ return;
3122
+ }
3123
+ client2.setQueryData(key, (data) => data && updateTranscript(data, targets, revised, tail));
3124
+ } catch {
3125
+ if (!stopped && owner === query()) await reload();
3126
+ } finally {
3127
+ running2 = false;
3128
+ schedule2();
3129
+ }
3130
+ };
3131
+ const stop = subscribeToEvents("vfs_change", (change) => {
3132
+ const id = change.item_id ?? change.path;
3133
+ const previous = pending4.get(id);
3134
+ pending4.set(id, previous && (previous.inserted || isNewPost(previous, channel)) && actionOf(change) === "update" && previous.path === change.path ? { ...change, inserted: true } : change);
3135
+ schedule2();
3136
+ }, (change) => channelMessageChange(change, channel, void 0, []) || !!change.old_path && channelMessageChange({ ...change, path: change.old_path }, channel, void 0, []) || change.item_type === "message" && !!change.parent_id && isChannelPath(change.path, channel) && !!current()?.pages.some((page) => page.messages.some((root) => root.id === change.parent_id)));
3137
+ watch = { users: 0, stop: () => {
3138
+ stopped = true;
3139
+ stop();
3140
+ if (timer) clearTimeout(timer);
3141
+ pending4.clear();
3142
+ } };
3143
+ entries.set(hash, watch);
3144
+ }
3145
+ watch.users++;
3146
+ let released = false;
3147
+ return () => {
3148
+ if (released) return;
3149
+ released = true;
3150
+ if (--watch.users === 0) {
3151
+ watch.stop();
3152
+ entries.delete(hash);
3153
+ }
3154
+ };
3155
+ }
3156
+
3157
+ // src/channel-realtime.ts
3158
+ var watches2 = /* @__PURE__ */ new WeakMap();
3159
+ function watchChannels(client2, key, normalize) {
3160
+ let entries = watches2.get(client2);
3161
+ if (!entries) {
3162
+ entries = /* @__PURE__ */ new Map();
3163
+ watches2.set(client2, entries);
3164
+ }
3165
+ const hash = JSON.stringify(key);
3166
+ let watch = entries.get(hash);
2992
3167
  if (!watch) {
2993
3168
  let stopped = false;
2994
3169
  let timer;
@@ -3104,12 +3279,12 @@ function watchChannels(client2, key, normalize) {
3104
3279
  }
3105
3280
 
3106
3281
  // src/message-replies-realtime.ts
3107
- var watches2 = /* @__PURE__ */ new WeakMap();
3282
+ var watches3 = /* @__PURE__ */ new WeakMap();
3108
3283
  function watchMessageReplies(client2, key, target) {
3109
- let entries = watches2.get(client2);
3284
+ let entries = watches3.get(client2);
3110
3285
  if (!entries) {
3111
3286
  entries = /* @__PURE__ */ new Map();
3112
- watches2.set(client2, entries);
3287
+ watches3.set(client2, entries);
3113
3288
  }
3114
3289
  const hash = JSON.stringify(key);
3115
3290
  let watch = entries.get(hash);
@@ -4581,24 +4756,25 @@ function useMessageReplies(options) {
4581
4756
  [active, realtime, client2, key, messageId]
4582
4757
  );
4583
4758
  const messages = React.useMemo(() => {
4759
+ if (!active || query.isError) return [];
4584
4760
  const seen = /* @__PURE__ */ new Set();
4585
4761
  return (query.data?.pages ?? []).flatMap((page) => page.messages).filter((message) => {
4586
4762
  if (seen.has(message.id)) return false;
4587
4763
  seen.add(message.id);
4588
4764
  return true;
4589
4765
  });
4590
- }, [query.data]);
4766
+ }, [active, query.data, query.isError]);
4591
4767
  return { ...query, messages };
4592
4768
  }
4593
4769
  function useInfiniteChannelMessages(options) {
4594
- useScopeKey();
4770
+ const scopeKey = useScopeKey();
4595
4771
  const { channelPath, parentMessageId, limit = 50, realtime = true, enabled: enabled2 = true, conversationsOnly = false, transcriptOnly = false } = options;
4596
4772
  const isThread = !!parentMessageId;
4597
4773
  const queryEnabled = enabled2 && !!channelPath;
4598
4774
  const query = reactQuery.useInfiniteQuery({
4599
4775
  queryKey: [...vfsKeys.channelMessages(channelPath || "", parentMessageId), "infinite", limit, "latest-first", ...conversationsOnly ? ["conversations"] : [], ...transcriptOnly ? ["transcript"] : []],
4600
4776
  queryFn: async ({ pageParam }) => {
4601
- return fetchChannelMessagesPage(channelPath, {
4777
+ const page = await fetchChannelMessagesPage(channelPath, {
4602
4778
  parentMessageId,
4603
4779
  limit,
4604
4780
  conversationsOnly,
@@ -4606,6 +4782,7 @@ function useInfiniteChannelMessages(options) {
4606
4782
  before_seq: pageParam?.before_seq,
4607
4783
  after_seq: pageParam?.after_seq
4608
4784
  });
4785
+ return transcriptOnly && page.messages.length >= limit ? { ...page, olderBefore: page.messages[0]?.seq } : page;
4609
4786
  },
4610
4787
  initialPageParam: void 0,
4611
4788
  getPreviousPageParam: (lastPage) => {
@@ -4615,6 +4792,7 @@ function useInfiniteChannelMessages(options) {
4615
4792
  return maxSeq == null ? void 0 : { after_seq: maxSeq };
4616
4793
  },
4617
4794
  getNextPageParam: (firstPage) => {
4795
+ if (transcriptOnly) return firstPage.olderBefore == null ? void 0 : { before_seq: firstPage.olderBefore };
4618
4796
  if (firstPage.messages.length < limit) return void 0;
4619
4797
  const minSeq = firstPage.messages[0]?.seq;
4620
4798
  return minSeq == null ? void 0 : { before_seq: minSeq };
@@ -4640,8 +4818,10 @@ function useInfiniteChannelMessages(options) {
4640
4818
  const sc = [];
4641
4819
  if (!query.data?.pages) return { messageCards: mc, siblingCards: sc };
4642
4820
  const seenCards = /* @__PURE__ */ new Set();
4643
- for (const page of query.data.pages) {
4821
+ for (const [index, page] of query.data.pages.entries()) {
4822
+ const pagePaths = transcriptOnly && index > 0 ? new Set(page.messages.map((message) => message.path)) : null;
4644
4823
  for (const [path, cards] of page.messageCards) {
4824
+ if (pagePaths && !pagePaths.has(path)) continue;
4645
4825
  for (const card of cards) {
4646
4826
  if (seenCards.has(card.id)) continue;
4647
4827
  seenCards.add(card.id);
@@ -4650,6 +4830,7 @@ function useInfiniteChannelMessages(options) {
4650
4830
  mc.set(path, existing);
4651
4831
  }
4652
4832
  }
4833
+ if (transcriptOnly && index > 0) continue;
4653
4834
  for (const card of page.siblingCards) {
4654
4835
  if (seenCards.has(card.id)) continue;
4655
4836
  seenCards.add(card.id);
@@ -4657,21 +4838,22 @@ function useInfiniteChannelMessages(options) {
4657
4838
  }
4658
4839
  }
4659
4840
  return { messageCards: mc, siblingCards: sc };
4660
- }, [query.data?.pages]);
4841
+ }, [query.data?.pages, transcriptOnly]);
4661
4842
  const qc = reactQuery.useQueryClient();
4662
4843
  const debounceRef = React.useRef(null);
4663
4844
  const stableKey = React.useMemo(
4664
4845
  () => [...vfsKeys.channelMessages(channelPath || "", parentMessageId), "infinite", limit, "latest-first", ...conversationsOnly ? ["conversations"] : [], ...transcriptOnly ? ["transcript"] : []],
4665
- [channelPath, parentMessageId, limit, conversationsOnly, transcriptOnly]
4846
+ [channelPath, parentMessageId, limit, conversationsOnly, transcriptOnly, scopeKey]
4666
4847
  );
4667
4848
  React.useEffect(() => {
4668
4849
  if (!realtime || !channelPath || !queryEnabled) return;
4850
+ if (transcriptOnly) return watchChannelTranscript(qc, stableKey, channelPath, limit);
4669
4851
  const reload = () => void refreshQuery(qc, stableKey, { exact: true });
4670
4852
  let tailRunning = false;
4671
4853
  let tailAgain = false;
4672
4854
  let disposed = false;
4673
4855
  const tailOnce = async () => {
4674
- if (conversationsOnly || transcriptOnly) {
4856
+ if (conversationsOnly) {
4675
4857
  reload();
4676
4858
  return;
4677
4859
  }
@@ -4765,7 +4947,7 @@ function useInfiniteChannelMessages(options) {
4765
4947
  void tail();
4766
4948
  }, 500);
4767
4949
  },
4768
- (data) => (conversationsOnly || transcriptOnly) && data?.item_type === "message" && (qc.getQueryData(stableKey)?.pages ?? []).some((page) => page.messages.some((root) => root.id === data.parent_id)) || channelMessageChange(
4950
+ (data) => conversationsOnly && data?.item_type === "message" && (qc.getQueryData(stableKey)?.pages ?? []).some((page) => page.messages.some((root) => root.id === data.parent_id)) || channelMessageChange(
4769
4951
  data,
4770
4952
  channelPath,
4771
4953
  parentMessageId,
@@ -4996,9 +5178,9 @@ function useCreate() {
4996
5178
  return reactQuery.useMutation({
4997
5179
  mutationFn: (params) => gatewayCall("create", params),
4998
5180
  onSuccess: (_data, variables) => {
4999
- const parentPath = variables.parent_path;
5000
- if (parentPath) {
5001
- qc.invalidateQueries({ queryKey: vfsKeys.children(parentPath) });
5181
+ const parentPath2 = variables.parent_path;
5182
+ if (parentPath2) {
5183
+ qc.invalidateQueries({ queryKey: vfsKeys.children(parentPath2) });
5002
5184
  }
5003
5185
  }
5004
5186
  });
@@ -5013,9 +5195,9 @@ function useUpdate() {
5013
5195
  qc.invalidateQueries({ queryKey: vfsKeys.item(path) });
5014
5196
  const segments = path.split("/");
5015
5197
  segments.pop();
5016
- const parentPath = segments.join("/");
5017
- if (parentPath) {
5018
- qc.invalidateQueries({ queryKey: vfsKeys.children(parentPath) });
5198
+ const parentPath2 = segments.join("/");
5199
+ if (parentPath2) {
5200
+ qc.invalidateQueries({ queryKey: vfsKeys.children(parentPath2) });
5019
5201
  }
5020
5202
  }
5021
5203
  }
@@ -5051,9 +5233,9 @@ function useDelete() {
5051
5233
  qc.removeQueries({ queryKey: vfsKeys.item(path) });
5052
5234
  const segments = path.split("/");
5053
5235
  segments.pop();
5054
- const parentPath = segments.join("/");
5055
- if (parentPath) {
5056
- qc.invalidateQueries({ queryKey: vfsKeys.children(parentPath) });
5236
+ const parentPath2 = segments.join("/");
5237
+ if (parentPath2) {
5238
+ qc.invalidateQueries({ queryKey: vfsKeys.children(parentPath2) });
5057
5239
  }
5058
5240
  }
5059
5241
  }