@ai4b-team/fsaos-gateway-sdk 4.2.1 → 4.2.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/index.d.cts CHANGED
@@ -1326,6 +1326,8 @@ declare function fetchChannelMessagesPage(channelPath: string, options?: {
1326
1326
  parentMessageId?: string;
1327
1327
  /** List conversation roots before pagination, using the chat audience rules. */
1328
1328
  conversationsOnly?: boolean;
1329
+ /** Page human channel messages; receive system activity separately. */
1330
+ transcriptOnly?: boolean;
1329
1331
  limit?: number;
1330
1332
  before_seq?: number;
1331
1333
  after_seq?: number;
@@ -2320,6 +2322,8 @@ interface InfiniteChannelMessagesOptions {
2320
2322
  parentMessageId?: string;
2321
2323
  /** Return conversation roots, excluding activity before the page limit. */
2322
2324
  conversationsOnly?: boolean;
2325
+ /** Page top-level human messages with a separate, bounded activity snapshot. */
2326
+ transcriptOnly?: boolean;
2323
2327
  /** Messages per page. Default 50, max 200. */
2324
2328
  limit?: number;
2325
2329
  /** Enable SSE-driven auto-refresh. Default: true. */
package/dist/index.d.ts CHANGED
@@ -1326,6 +1326,8 @@ declare function fetchChannelMessagesPage(channelPath: string, options?: {
1326
1326
  parentMessageId?: string;
1327
1327
  /** List conversation roots before pagination, using the chat audience rules. */
1328
1328
  conversationsOnly?: boolean;
1329
+ /** Page human channel messages; receive system activity separately. */
1330
+ transcriptOnly?: boolean;
1329
1331
  limit?: number;
1330
1332
  before_seq?: number;
1331
1333
  after_seq?: number;
@@ -2320,6 +2322,8 @@ interface InfiniteChannelMessagesOptions {
2320
2322
  parentMessageId?: string;
2321
2323
  /** Return conversation roots, excluding activity before the page limit. */
2322
2324
  conversationsOnly?: boolean;
2325
+ /** Page top-level human messages with a separate, bounded activity snapshot. */
2326
+ transcriptOnly?: boolean;
2323
2327
  /** Messages per page. Default 50, max 200. */
2324
2328
  limit?: number;
2325
2329
  /** Enable SSE-driven auto-refresh. Default: true. */
package/dist/index.js CHANGED
@@ -2129,6 +2129,7 @@ async function fetchChannelMessagesPage(channelPath, options) {
2129
2129
  const params = { channel_path: channelPath };
2130
2130
  if (options?.parentMessageId) params.parent_message_id = options.parentMessageId;
2131
2131
  if (options?.conversationsOnly) params.conversations_only = true;
2132
+ if (options?.transcriptOnly) params.transcript_only = true;
2132
2133
  if (options?.limit) params.limit = options.limit;
2133
2134
  if (options?.before_seq != null) params.before_seq = options.before_seq;
2134
2135
  if (options?.after_seq != null) params.after_seq = options.after_seq;
@@ -2137,6 +2138,9 @@ async function fetchChannelMessagesPage(channelPath, options) {
2137
2138
  if (options?.conversationsOnly && raw.conversations_only !== true) {
2138
2139
  throw new Error("This server does not support conversation history lists yet. Update the message reader.");
2139
2140
  }
2141
+ if (options?.transcriptOnly && raw.transcript_only !== true) {
2142
+ throw new Error("This server does not support channel transcript pages yet. Update the message reader.");
2143
+ }
2140
2144
  const items = raw.messages || [];
2141
2145
  const cards = parseChannelCards(items);
2142
2146
  const messageCards = /* @__PURE__ */ new Map();
@@ -3869,16 +3873,17 @@ function useChannelMessages(options) {
3869
3873
  }
3870
3874
  function useInfiniteChannelMessages(options) {
3871
3875
  useScopeKey();
3872
- const { channelPath, parentMessageId, limit = 50, realtime = true, enabled: enabled2 = true, conversationsOnly = false } = options;
3876
+ const { channelPath, parentMessageId, limit = 50, realtime = true, enabled: enabled2 = true, conversationsOnly = false, transcriptOnly = false } = options;
3873
3877
  const isThread = !!parentMessageId;
3874
3878
  const queryEnabled = enabled2 && !!channelPath;
3875
3879
  const query = useInfiniteQuery({
3876
- queryKey: [...vfsKeys.channelMessages(channelPath || "", parentMessageId), "infinite", limit, "latest-first", ...conversationsOnly ? ["conversations"] : []],
3880
+ queryKey: [...vfsKeys.channelMessages(channelPath || "", parentMessageId), "infinite", limit, "latest-first", ...conversationsOnly ? ["conversations"] : [], ...transcriptOnly ? ["transcript"] : []],
3877
3881
  queryFn: async ({ pageParam }) => {
3878
3882
  return fetchChannelMessagesPage(channelPath, {
3879
3883
  parentMessageId,
3880
3884
  limit,
3881
3885
  conversationsOnly,
3886
+ transcriptOnly,
3882
3887
  before_seq: pageParam?.before_seq,
3883
3888
  after_seq: pageParam?.after_seq
3884
3889
  });
@@ -3937,8 +3942,8 @@ function useInfiniteChannelMessages(options) {
3937
3942
  const qc = useQueryClient();
3938
3943
  const debounceRef = useRef(null);
3939
3944
  const stableKey = useMemo(
3940
- () => [...vfsKeys.channelMessages(channelPath || "", parentMessageId), "infinite", limit, "latest-first", ...conversationsOnly ? ["conversations"] : []],
3941
- [channelPath, parentMessageId, limit, conversationsOnly]
3945
+ () => [...vfsKeys.channelMessages(channelPath || "", parentMessageId), "infinite", limit, "latest-first", ...conversationsOnly ? ["conversations"] : [], ...transcriptOnly ? ["transcript"] : []],
3946
+ [channelPath, parentMessageId, limit, conversationsOnly, transcriptOnly]
3942
3947
  );
3943
3948
  useEffect(() => {
3944
3949
  if (!realtime || !channelPath || !queryEnabled) return;
@@ -3947,7 +3952,7 @@ function useInfiniteChannelMessages(options) {
3947
3952
  let tailAgain = false;
3948
3953
  let disposed = false;
3949
3954
  const tailOnce = async () => {
3950
- if (conversationsOnly) {
3955
+ if (conversationsOnly || transcriptOnly) {
3951
3956
  reload();
3952
3957
  return;
3953
3958
  }
@@ -4041,7 +4046,7 @@ function useInfiniteChannelMessages(options) {
4041
4046
  void tail();
4042
4047
  }, 500);
4043
4048
  },
4044
- (data) => conversationsOnly && data?.item_type === "message" && (qc.getQueryData(stableKey)?.pages ?? []).some((page) => page.messages.some((root) => root.id === data.parent_id)) || channelMessageChange(
4049
+ (data) => (conversationsOnly || transcriptOnly) && data?.item_type === "message" && (qc.getQueryData(stableKey)?.pages ?? []).some((page) => page.messages.some((root) => root.id === data.parent_id)) || channelMessageChange(
4045
4050
  data,
4046
4051
  channelPath,
4047
4052
  parentMessageId,
@@ -4053,10 +4058,10 @@ function useInfiniteChannelMessages(options) {
4053
4058
  unsub();
4054
4059
  if (debounceRef.current) clearTimeout(debounceRef.current);
4055
4060
  };
4056
- }, [realtime, channelPath, queryEnabled, stableKey, qc, parentMessageId, limit, conversationsOnly]);
4061
+ }, [realtime, channelPath, queryEnabled, stableKey, qc, parentMessageId, limit, conversationsOnly, transcriptOnly]);
4057
4062
  return {
4058
4063
  messages,
4059
- // Activity is a current thread snapshot, not another reply page.
4064
+ // Activity is a current snapshot, independent of transcript/reply pages.
4060
4065
  activityMessages: query.data?.pages[0]?.activityMessages ?? [],
4061
4066
  /** Cards grouped by parent message path (child cards of messages). */
4062
4067
  messageCards,