@blocksdiy/react-common 1.58.0 → 1.59.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.
@@ -128,6 +128,11 @@ export interface AgentChatRootProps {
128
128
  noPersistency?: boolean;
129
129
  children?: ReactNode;
130
130
  chatId?: string;
131
+ /**
132
+ * What every run sends the agent as `chatContext`, serialized as the run starts — so a value
133
+ * whose `toJSON` reads live state (the floating agent chat's page context) is current on every
134
+ * run without re-rendering the chat.
135
+ */
131
136
  chatContext?: any;
132
137
  chatContextFiles?: Attachment[];
133
138
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"new-agent-chat.d.ts","sourceRoot":"","sources":["../../src/components/new-agent-chat.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAkB,KAAK,OAAO,EAAoB,WAAW,EAAE,KAAK,WAAW,EAAE,MAAM,eAAe,CAAC;AAI9G,OAAO,EAAiB,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC7E,OAAO,EAEL,SAAS,EACT,cAAc,EAQf,MAAM,OAAO,CAAC;AAKf,OAAO,EAGL,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EAqBtB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAiB,KAAK,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACzE,OAAO,EAA4B,KAAK,mBAAmB,EAAqB,MAAM,2BAA2B,CAAC;AAClH,OAAO,EAQL,KAAK,aAAa,EAGlB,KAAK,YAAY,EAClB,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AACxE,OAAO,EACL,KAAK,mBAAmB,EACxB,qBAAqB,EACrB,KAAK,aAAa,EAClB,KAAK,YAAY,EACjB,oBAAoB,EACpB,eAAe,EACf,eAAe,EACf,gBAAgB,EAChB,iBAAiB,EACjB,aAAa,EACb,oBAAoB,EACpB,gBAAgB,EAChB,KAAK,cAAc,GACpB,MAAM,2BAA2B,CAA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UAAU,EACV,OAAe,EACf,MAAM,EACN,OAAO,EACP,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,QAAQ,CAAC,GAAG,8BAA8B,+BAgBjE"}
@@ -230,7 +230,7 @@ const SessionReadables = () => {
230
230
  // });
231
231
  return null;
232
232
  };
233
- const ChatInitializer = ({ agentBlock, agentChatBlock, chatId, token, appId, components, componentsLoading, currentThreadId, setCurrentThreadId, children, onUserMessageSent, disableInitialPrompt, }) => {
233
+ const ChatInitializer = ({ agentBlock, agentChatBlock, chatId, token, appId, components, componentsLoading, currentThreadId, setCurrentThreadId, children, onUserMessageSent, disableInitialPrompt, readChatContext, }) => {
234
234
  const [agentChat, setAgentChat] = useState(null);
235
235
  const [agent, setAgent] = useState(null);
236
236
  // `isConfigLoaded` covers the (small, parallel) async fetch of the
@@ -468,7 +468,12 @@ const ChatInitializer = ({ agentBlock, agentChatBlock, chatId, token, appId, com
468
468
  },
469
469
  });
470
470
  try {
471
- await copilotkit.runAgent({ agent: agentToRun, forwardedProps, ...(resume ? { resume } : {}) });
471
+ await copilotkit.runAgent({
472
+ agent: agentToRun,
473
+ // The context as this run starts, over the one the runtime was given at render.
474
+ forwardedProps: { chatContext: readChatContext(), ...forwardedProps },
475
+ ...(resume ? { resume } : {}),
476
+ });
472
477
  if (runEventError) {
473
478
  throw runEventError;
474
479
  }
@@ -514,7 +519,7 @@ const ChatInitializer = ({ agentBlock, agentChatBlock, chatId, token, appId, com
514
519
  }
515
520
  // A reconnected run did not take effect as sent: callers must not record it as done.
516
521
  return !reconnected;
517
- }, [copilotkit, currentThreadId, resetInterrupts]);
522
+ }, [copilotkit, currentThreadId, resetInterrupts, readChatContext]);
518
523
  const sendMessage = useCallback(async (message) => {
519
524
  if (!canSendMessage || !copilotAgent || copilotAgent.isRunning || isRunningElsewhereRef.current) {
520
525
  return;
@@ -973,6 +978,8 @@ const ChatInitializer = ({ agentBlock, agentChatBlock, chatId, token, appId, com
973
978
  currentThreadId,
974
979
  }, children: _jsx(AgentChatOwnRunsContext.Provider, { value: ownRunsWithoutSend, children: children }) }));
975
980
  };
981
+ /** `chatContext` as a run sends it: serialized now, so a `toJSON` in it reads its state as of now. */
982
+ const chatContextString = (chatContext) => chatContext == null ? undefined : typeof chatContext === "string" ? chatContext : JSON.stringify(chatContext);
976
983
  export const AgentChatRoot = ({ ...props
977
984
  // agentChatData,
978
985
  // memoryEnabled = false,
@@ -985,6 +992,12 @@ export const AgentChatRoot = ({ ...props
985
992
  useEffect(() => {
986
993
  onLoadErrorRef.current = onLoadError;
987
994
  });
995
+ // Each run serializes the context as it starts, through a ref set before any effect can start one.
996
+ const chatContextRef = useRef(chatContext);
997
+ useIsomorphicLayoutEffect(() => {
998
+ chatContextRef.current = chatContext;
999
+ });
1000
+ const readChatContext = useCallback(() => chatContextString(chatContextRef.current), []);
988
1001
  const socketId = websocketsService.getSocketId();
989
1002
  const headers = useMemo(() => ({
990
1003
  ...(token ? { Authorization: `Bearer ${token}` } : {}),
@@ -1023,7 +1036,7 @@ export const AgentChatRoot = ({ ...props
1023
1036
  const serverInterruptComponentIds = useMemo(() => supportsServerInterrupt
1024
1037
  ? components.filter((component) => component.userInterrupt).map((component) => component.id)
1025
1038
  : [], [components, supportsServerInterrupt]);
1026
- const chatContextStr = chatContext == null ? undefined : typeof chatContext === "string" ? chatContext : JSON.stringify(chatContext);
1039
+ const chatContextStr = chatContextString(chatContext);
1027
1040
  const getAgentChatBlock = useCallback(async () => {
1028
1041
  if (!agentChatId) {
1029
1042
  return null;
@@ -1140,7 +1153,7 @@ export const AgentChatRoot = ({ ...props
1140
1153
  },
1141
1154
  // Explicit false: when undefined, CopilotKit auto-enables its inspector
1142
1155
  // devtools on localhost hostnames.
1143
- enableInspector: false, children: [_jsx(SessionReadables, {}), _jsx(ChatInitializer, { agentBlock: agentBlock, agentChatBlock: agentChatBlock, chatId: chatId, noPersistency: noPersistency, token: token, appId: appId, components: components, componentsLoading: componentsLoading, currentThreadId: currentThreadId, setCurrentThreadId: setCurrentThreadId, onUserMessageSent: props.onUserMessageSent, disableInitialPrompt: props.disableInitialPrompt, children: children })] }));
1156
+ enableInspector: false, children: [_jsx(SessionReadables, {}), _jsx(ChatInitializer, { agentBlock: agentBlock, agentChatBlock: agentChatBlock, chatId: chatId, noPersistency: noPersistency, token: token, appId: appId, components: components, componentsLoading: componentsLoading, currentThreadId: currentThreadId, setCurrentThreadId: setCurrentThreadId, onUserMessageSent: props.onUserMessageSent, disableInitialPrompt: props.disableInitialPrompt, readChatContext: readChatContext, children: children })] }));
1144
1157
  };
1145
1158
  export function AgentChatMessage({ message, index, ...props }) {
1146
1159
  if (message.role === "user" && message.name === HIDDEN_INITIAL_PROMPT_MESSAGE_NAME) {
@@ -0,0 +1,33 @@
1
+ /**
2
+ * What a component shares: an object whose keys name what they hold (`{ total: 42 }`) — the key
3
+ * is the agent's description of it. JSON-serializable, like any chat context.
4
+ */
5
+ export type AgentContext = Readonly<Record<string, unknown>>;
6
+ /** One mounted component's share: under `name` (the component's) in the agent's context. */
7
+ export interface AgentContextShare {
8
+ name: string;
9
+ context: AgentContext;
10
+ }
11
+ /** What one entity read has on screen: the table and what it asked for. */
12
+ export interface AgentScreenRead {
13
+ table: string;
14
+ /** What the read asked for, as given: a query, key/value filters, or nothing (every row). */
15
+ query?: unknown;
16
+ }
17
+ export interface AgentContextStore<T> {
18
+ /** Registers `value` under `id`, or replaces what `id` holds; the same content changes nothing. */
19
+ set: (id: string, value: T) => void;
20
+ remove: (id: string) => void;
21
+ subscribe: (listener: () => void) => () => void;
22
+ /** The values in registration order — the same array until something changes. */
23
+ getSnapshot: () => readonly T[];
24
+ }
25
+ export declare const createAgentContextStore: <T>() => AgentContextStore<T>;
26
+ /**
27
+ * Registers `value` while the caller is mounted, following its content (an inline literal is
28
+ * fine); `null` registers nothing (and withdraws what was registered).
29
+ */
30
+ export declare const useAgentContextRegistration: <T>(store: AgentContextStore<T>, value: T | null) => void;
31
+ /** The registered values, in registration order, live. */
32
+ export declare const useAgentContextValues: <T>(store: AgentContextStore<T>) => readonly T[];
33
+ //# sourceMappingURL=agent-context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-context.d.ts","sourceRoot":"","sources":["../../src/hooks/agent-context.ts"],"names":[],"mappings":"AAUA;;;GAGG;AACH,MAAM,MAAM,YAAY,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;AAE7D,4FAA4F;AAC5F,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,YAAY,CAAC;CACvB;AAED,2EAA2E;AAC3E,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,6FAA6F;IAC7F,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,MAAM,WAAW,iBAAiB,CAAC,CAAC;IAClC,mGAAmG;IACnG,GAAG,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,KAAK,IAAI,CAAC;IACpC,MAAM,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7B,SAAS,EAAE,CAAC,QAAQ,EAAE,MAAM,IAAI,KAAK,MAAM,IAAI,CAAC;IAChD,iFAAiF;IACjF,WAAW,EAAE,MAAM,SAAS,CAAC,EAAE,CAAC;CACjC;AAED,eAAO,MAAM,uBAAuB,GAAI,CAAC,OAAK,iBAAiB,CAAC,CAAC,CA0ChE,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,2BAA2B,GAAI,CAAC,EAAE,OAAO,iBAAiB,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,GAAG,IAAI,KAAG,IAU7F,CAAC;AAEF,0DAA0D;AAC1D,eAAO,MAAM,qBAAqB,GAAI,CAAC,EAAE,OAAO,iBAAiB,CAAC,CAAC,CAAC,KAAG,SAAS,CAAC,EACJ,CAAC"}
@@ -0,0 +1,70 @@
1
+ // What the app's pages tell its agents, headless: a store the SDK's provider owns — every mounted
2
+ // registration is one entry, in mount order, replaced when its content changes and gone on
3
+ // unmount — the hook that registers into it and the hook that reads it. The SDK keeps two: what a
4
+ // component shares on purpose, under its name (`useAgentContext`), and the data the page's reads
5
+ // have on screen (every `useEntityGetAll` / `useEntityGetOne`). The floating agent chat (the
6
+ // agent-chat registry item) sends both with every turn. The store is pure and tested; the hooks
7
+ // are the thin React shell.
8
+ import { useEffect, useId, useSyncExternalStore } from "react";
9
+ export const createAgentContextStore = () => {
10
+ const entries = new Map();
11
+ const listeners = new Set();
12
+ let snapshot = Object.freeze([]);
13
+ const changed = () => {
14
+ snapshot = Object.freeze([...entries.values()].map((entry) => entry.value));
15
+ listeners.forEach((listener) => listener());
16
+ };
17
+ const remove = (id) => {
18
+ if (entries.delete(id)) {
19
+ changed();
20
+ }
21
+ };
22
+ return {
23
+ set: (id, value) => {
24
+ let json;
25
+ try {
26
+ json = JSON.stringify(value);
27
+ }
28
+ catch (error) {
29
+ // A value no chat could send (a circular object, a BigInt) is left out rather than
30
+ // breaking the page that shared it.
31
+ console.warn("Agent context: left out a value that is not JSON-serializable", error);
32
+ remove(id);
33
+ return;
34
+ }
35
+ // Content, not identity: a page re-rendering with an equal literal changes nothing.
36
+ if (entries.get(id)?.json === json) {
37
+ return;
38
+ }
39
+ // A replacement keeps its place (a Map keeps an existing key's order).
40
+ entries.set(id, { value, json });
41
+ changed();
42
+ },
43
+ remove,
44
+ subscribe: (listener) => {
45
+ listeners.add(listener);
46
+ return () => {
47
+ listeners.delete(listener);
48
+ };
49
+ },
50
+ getSnapshot: () => snapshot,
51
+ };
52
+ };
53
+ /**
54
+ * Registers `value` while the caller is mounted, following its content (an inline literal is
55
+ * fine); `null` registers nothing (and withdraws what was registered).
56
+ */
57
+ export const useAgentContextRegistration = (store, value) => {
58
+ const id = useId();
59
+ useEffect(() => {
60
+ if (value === null) {
61
+ store.remove(id);
62
+ }
63
+ else {
64
+ store.set(id, value);
65
+ }
66
+ }, [store, id, value]);
67
+ useEffect(() => () => store.remove(id), [store, id]);
68
+ };
69
+ /** The registered values, in registration order, live. */
70
+ export const useAgentContextValues = (store) => useSyncExternalStore(store.subscribe, store.getSnapshot, store.getSnapshot);
@@ -1,3 +1,4 @@
1
+ import type { AgentContextShare, AgentScreenRead } from "./agent-context.js";
1
2
  export type FloatingAgentChatEnginePhase = "loading" | "ready" | "error";
2
3
  export interface FloatingAgentChatEngineState {
3
4
  /** Which engine this is: the agent's chat and the load attempt ({@link floatingAgentChatEngineKey}). */
@@ -35,30 +36,40 @@ export interface FloatingAgentChatUrlContext {
35
36
  }
36
37
  /** The query as an object: a key's value, or its values when the key repeats. */
37
38
  export declare const floatingAgentChatSearchParams: (params: URLSearchParams) => FloatingAgentChatUrlContext["searchParams"];
38
- /**
39
- * The context the engine sends: the provider's (the app's, for every floating conversation), the
40
- * opener's over it (a sidebar pick's layout context, `open`'s or `openPrompt`'s — key by key),
41
- * and `urlContext` beside them. A plain object's keys stay at the top level (an agent's initial
42
- * messages read `{{chatContext.<key>}}`); anything else goes under `context`.
43
- */
44
- export declare const floatingAgentChatContext: (provided: unknown, opener: unknown, urlContext: FloatingAgentChatUrlContext) => {
45
- urlContext: FloatingAgentChatUrlContext;
46
- };
47
- export interface UseFloatingAgentChatContextOptions {
39
+ export interface FloatingAgentChatContextLayers {
48
40
  /** The provider's context: the app's, for every floating conversation. */
49
41
  provided: unknown;
50
- /** The opener's context, over the provider's. */
42
+ /** The opener's context (a sidebar pick's layout context, `open`'s or `openPrompt`'s), over the provider's. */
51
43
  opener: unknown;
44
+ /**
45
+ * What the components on screen share (the SDK's `useAgentContext`, in mount order), over
46
+ * both: it is live, where the opener's was captured once at the open.
47
+ */
48
+ shared?: readonly AgentContextShare[];
49
+ /** What the pages' entity reads have on screen (the SDK's read hooks, in mount order). */
50
+ onScreen?: readonly AgentScreenRead[];
51
+ urlContext: FloatingAgentChatUrlContext;
52
+ }
53
+ /**
54
+ * The context the engine sends: the provider's, the opener's over it, each sharing component's
55
+ * list under its name over both, and beside them `onScreen` (what the pages' reads hold, when
56
+ * they hold anything) and `urlContext`. A plain object's keys stay at the top level (an agent's
57
+ * initial messages read `{{chatContext.<key>}}`); anything else goes under `context`.
58
+ */
59
+ export declare const floatingAgentChatContext: ({ provided, opener, shared, onScreen, urlContext, }: FloatingAgentChatContextLayers) => Record<string, unknown>;
60
+ export interface UseFloatingAgentChatContextOptions extends Omit<FloatingAgentChatContextLayers, "urlContext"> {
52
61
  /** The router's values — react-common knows no router; the host passes `useParams()`'s and `useSearchParams()`'s. */
53
62
  routeParams: FloatingAgentChatUrlContext["routeParams"];
54
63
  searchParams: URLSearchParams;
55
64
  }
56
65
  /**
57
- * The context the engine sends with every turn, memoized on the URL's content (the router hands
58
- * out a fresh params object on every render of its host) and the contexts' identity: the engine
59
- * re-renders for a change of the URL or of a context, never for one of the surface or its host.
66
+ * The context the engine sends with every turn, as one object that never changes: what it
67
+ * serializes to (`toJSON`, read by `AgentChatRoot` as each turn starts) is the context of that
68
+ * moment, so the engine never re-renders for the page's context, the URL or its host. The merge
69
+ * itself is memoized on the URL's content (the router hands out a fresh params object on every
70
+ * render of its host) and the contexts' identity.
60
71
  */
61
- export declare const useFloatingAgentChatContext: ({ provided, opener, routeParams, searchParams, }: UseFloatingAgentChatContextOptions) => {
62
- urlContext: FloatingAgentChatUrlContext;
72
+ export declare const useFloatingAgentChatContext: ({ provided, opener, shared, onScreen, routeParams, searchParams, }: UseFloatingAgentChatContextOptions) => {
73
+ toJSON: () => Record<string, unknown>;
63
74
  };
64
75
  //# sourceMappingURL=floating-agent-chat-engine.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"floating-agent-chat-engine.d.ts","sourceRoot":"","sources":["../../src/hooks/floating-agent-chat-engine.ts"],"names":[],"mappings":"AAQA,MAAM,MAAM,4BAA4B,GAAG,SAAS,GAAG,OAAO,GAAG,OAAO,CAAC;AAEzE,MAAM,WAAW,4BAA4B;IAC3C,wGAAwG;IACx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BAA2B,CAAC,cAAc,CAQjH,CAAC;AASF;;;;;GAKG;AACH,eAAO,MAAM,wBAAwB,GACnC,UAAU,OAAO,EACjB,QAAQ,OAAO,EACf,YAAY,2BAA2B;;CAKvC,CAAC;AAEH,MAAM,WAAW,kCAAkC;IACjD,0EAA0E;IAC1E,QAAQ,EAAE,OAAO,CAAC;IAClB,iDAAiD;IACjD,MAAM,EAAE,OAAO,CAAC;IAChB,qHAAqH;IACrH,WAAW,EAAE,2BAA2B,CAAC,aAAa,CAAC,CAAC;IACxD,YAAY,EAAE,eAAe,CAAC;CAC/B;AAED;;;;GAIG;AACH,eAAO,MAAM,2BAA2B,GAAI,kDAKzC,kCAAkC;;CAWpC,CAAC"}
1
+ {"version":3,"file":"floating-agent-chat-engine.d.ts","sourceRoot":"","sources":["../../src/hooks/floating-agent-chat-engine.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAgB,iBAAiB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAExF,MAAM,MAAM,4BAA4B,GAAG,SAAS,GAAG,OAAO,GAAG,OAAO,CAAC;AAEzE,MAAM,WAAW,4BAA4B;IAC3C,wGAAwG;IACxG,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,KAAK,GAAG,IAAI,CAAC;CACzB;AAED,eAAO,MAAM,0BAA0B,GAAI,aAAa,MAAM,EAAE,SAAS,MAAM,KAAG,MAAqC,CAAC;AAExH,4CAA4C;AAC5C,eAAO,MAAM,0BAA0B,GAAI,KAAK,MAAM,KAAG,4BAIvD,CAAC;AAEH,8FAA8F;AAC9F,eAAO,MAAM,4BAA4B,GACvC,MAAM,4BAA4B,EAClC,KAAK,MAAM,KACV,4BAAsF,CAAC;AAE1F,uGAAuG;AACvG,eAAO,MAAM,6BAA6B,GACxC,MAAM,4BAA4B,EAClC,KAAK,MAAM,EACX,WAAW,KAAK,KACf,4BAAkF,CAAC;AAEtF,sEAAsE;AACtE,eA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BAA2B,CAAC,aAAa,CAAC,CAAC;IACxD,YAAY,EAAE,eAAe,CAAC;CAC/B;AAKD;;;;;;GAMG;AACH,eAAO,MAAM,2BAA2B,GAAI,oEAOzC,kCAAkC;;CAuBpC,CAAC"}
@@ -1,9 +1,10 @@
1
1
  // The floating chat's engine, headless: one chat runtime per agent the session shows (and per
2
2
  // retry of a failed load), what it reports — up, or failed — is its own, never a previous
3
- // engine's, and the context it sends with every turn: the app's and the opener's with what the
4
- // URL on screen tells beside them. The agent-chat registry item mounts the runtime under the
5
- // key and renders the phase. The reducers are pure and tested; the hooks are the thin React shell.
6
- import { useCallback, useMemo, useState } from "react";
3
+ // engine's, and the context it sends with every turn: the app's, the opener's and what the
4
+ // pages on screen share, with what the URL tells beside them. The agent-chat registry item
5
+ // mounts the runtime under the key and renders the phase. The reducers are pure and tested; the
6
+ // hooks are the thin React shell.
7
+ import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from "react";
7
8
  export const floatingAgentChatEngineKey = (agentChatId, attempt) => `${agentChatId}:${attempt}`;
8
9
  /** A fresh engine: nothing reported yet. */
9
10
  export const floatingAgentChatEngineFor = (key) => ({
@@ -46,27 +47,75 @@ export const floatingAgentChatSearchParams = (params) => {
46
47
  const isPlainObject = (value) => typeof value === "object" && value !== null && Object.getPrototypeOf(value) === Object.prototype;
47
48
  /** A context as top-level keys: a plain object's own; anything else under `context`; none for none. */
48
49
  const asTopLevelContext = (context) => isPlainObject(context) ? context : context == null ? {} : { context };
50
+ const NO_SHARES = [];
51
+ const NOTHING_ON_SCREEN = [];
52
+ /** Each component's shares under its name: a list, one entry per mounted instance, in mount order. */
53
+ const sharesByName = (shared) => {
54
+ // No prototype: a component named `constructor` or `toString` is a name, not an inherited member.
55
+ const byName = Object.create(null);
56
+ for (const { name, context } of shared) {
57
+ (byName[name] ??= []).push(context);
58
+ }
59
+ return byName;
60
+ };
61
+ /** Each read once: the same table and query mounted twice is one entry. */
62
+ const distinctReads = (onScreen) => {
63
+ const seen = new Set();
64
+ return onScreen.filter((entry) => {
65
+ const json = JSON.stringify(entry);
66
+ if (seen.has(json)) {
67
+ return false;
68
+ }
69
+ seen.add(json);
70
+ return true;
71
+ });
72
+ };
49
73
  /**
50
- * The context the engine sends: the provider's (the app's, for every floating conversation), the
51
- * opener's over it (a sidebar pick's layout context, `open`'s or `openPrompt`'s — key by key),
52
- * and `urlContext` beside them. A plain object's keys stay at the top level (an agent's initial
53
- * messages read `{{chatContext.<key>}}`); anything else goes under `context`.
74
+ * The context the engine sends: the provider's, the opener's over it, each sharing component's
75
+ * list under its name over both, and beside them `onScreen` (what the pages' reads hold, when
76
+ * they hold anything) and `urlContext`. A plain object's keys stay at the top level (an agent's
77
+ * initial messages read `{{chatContext.<key>}}`); anything else goes under `context`.
54
78
  */
55
- export const floatingAgentChatContext = (provided, opener, urlContext) => ({
56
- ...asTopLevelContext(provided),
57
- ...asTopLevelContext(opener),
58
- urlContext,
59
- });
79
+ export const floatingAgentChatContext = ({ provided, opener, shared = NO_SHARES, onScreen = NOTHING_ON_SCREEN, urlContext, }) => {
80
+ const context = {
81
+ ...asTopLevelContext(provided),
82
+ ...asTopLevelContext(opener),
83
+ ...sharesByName(shared),
84
+ };
85
+ // Always the reads' own, as `urlContext` is always the URL's: a key of that name in a context is dropped.
86
+ delete context.onScreen;
87
+ if (onScreen.length > 0) {
88
+ context.onScreen = distinctReads(onScreen);
89
+ }
90
+ context.urlContext = urlContext;
91
+ return context;
92
+ };
93
+ // Client-only `useLayoutEffect`, falls back to `useEffect` during SSR.
94
+ const useIsomorphicLayoutEffect = typeof window !== "undefined" ? useLayoutEffect : useEffect;
60
95
  /**
61
- * The context the engine sends with every turn, memoized on the URL's content (the router hands
62
- * out a fresh params object on every render of its host) and the contexts' identity: the engine
63
- * re-renders for a change of the URL or of a context, never for one of the surface or its host.
96
+ * The context the engine sends with every turn, as one object that never changes: what it
97
+ * serializes to (`toJSON`, read by `AgentChatRoot` as each turn starts) is the context of that
98
+ * moment, so the engine never re-renders for the page's context, the URL or its host. The merge
99
+ * itself is memoized on the URL's content (the router hands out a fresh params object on every
100
+ * render of its host) and the contexts' identity.
64
101
  */
65
- export const useFloatingAgentChatContext = ({ provided, opener, routeParams, searchParams, }) => {
102
+ export const useFloatingAgentChatContext = ({ provided, opener, shared = NO_SHARES, onScreen = NOTHING_ON_SCREEN, routeParams, searchParams, }) => {
66
103
  const routeParamsJson = JSON.stringify(routeParams);
67
104
  const search = searchParams.toString();
68
- return useMemo(() => floatingAgentChatContext(provided, opener, {
69
- routeParams: JSON.parse(routeParamsJson),
70
- searchParams: floatingAgentChatSearchParams(new URLSearchParams(search)),
71
- }), [provided, opener, routeParamsJson, search]);
105
+ const context = useMemo(() => floatingAgentChatContext({
106
+ provided,
107
+ opener,
108
+ shared,
109
+ onScreen,
110
+ urlContext: {
111
+ routeParams: JSON.parse(routeParamsJson),
112
+ searchParams: floatingAgentChatSearchParams(new URLSearchParams(search)),
113
+ },
114
+ }), [provided, opener, shared, onScreen, routeParamsJson, search]);
115
+ // What the one object serializes to, set before any effect can start a turn.
116
+ const latest = useRef(context);
117
+ useIsomorphicLayoutEffect(() => {
118
+ latest.current = context;
119
+ });
120
+ return useMemo(() => ({ toJSON: () => latest.current }), []);
72
121
  };
@@ -17,7 +17,7 @@ export type FloatingAgentChatFace = "prompt" | "panel";
17
17
  /**
18
18
  * Where the panel's expand goes for the conversation it shows — the opener knows the full route
19
19
  * (an agent mini-app's thread page); `null` hides the expand control. Never asked for a draft:
20
- * an unsent new chat has no page, so the panel shows no expand for it.
20
+ * an unsent new chat has no thread page — its expand goes to the opener's `newChatHref`.
21
21
  */
22
22
  export type FloatingAgentChatExpandHref = (conversation: AgentConversationRef) => string | null;
23
23
  export interface FloatingAgentChatOpenOptions<Handle extends FloatingAgentChatHandle = FloatingAgentChatHandle> {
@@ -26,6 +26,11 @@ export interface FloatingAgentChatOpenOptions<Handle extends FloatingAgentChatHa
26
26
  /** A conversation to pick up, or the new chat (the default). */
27
27
  target?: FloatingAgentChatTarget;
28
28
  expandHref?: FloatingAgentChatExpandHref;
29
+ /**
30
+ * Where the panel's expand goes for the new chat, nothing sent on it yet: the full-page new
31
+ * chat (an agent mini-app's `/new`). Without it the new chat has no expand.
32
+ */
33
+ newChatHref?: string;
29
34
  /** Extra context handed to the agent on every turn (like `AgentChat`'s `chatContext`). */
30
35
  chatContext?: unknown;
31
36
  /** The face to open with — the panel by default; the prompt always opens the new chat. */
@@ -49,6 +54,7 @@ export interface FloatingAgentChatState<Handle extends FloatingAgentChatHandle =
49
54
  draftSent: boolean;
50
55
  face: FloatingAgentChatFace;
51
56
  expandHref?: FloatingAgentChatExpandHref;
57
+ newChatHref?: string;
52
58
  chatContext?: unknown;
53
59
  }
54
60
  /** The panel shows the new chat, nothing sent on it yet. */
@@ -57,8 +63,8 @@ export declare const isFloatingAgentChatDraft: (state: FloatingAgentChatState) =
57
63
  * The state after an open. Within one agent the draft's bookkeeping carries over — the new chat
58
64
  * is kept while untouched, stands by while a thread is open, and is minted afresh once sent;
59
65
  * another agent starts clean. Opening what is already shown changes nothing but the opener's
60
- * `expandHref` / `chatContext` (and the face). The prompt face is the new chat by definition:
61
- * a prompt open with a thread target opens the new chat.
66
+ * `expandHref` / `newChatHref` / `chatContext` (and the face). The prompt face is the new chat
67
+ * by definition: a prompt open with a thread target opens the new chat.
62
68
  */
63
69
  export declare const floatingAgentChatAfterOpen: <Handle extends FloatingAgentChatHandle>(prev: FloatingAgentChatState<Handle> | null, request: FloatingAgentChatOpenRequest<Handle>, mintThreadId: () => string) => FloatingAgentChatState<Handle>;
64
70
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"floating-agent-chat.d.ts","sourceRoot":"","sources":["../../src/hooks/floating-agent-chat.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAGrE,8FAA8F;AAC9F,MAAM,WAAW,uBAAuB;IACtC,0BAA0B,IAAI;QAAE,WAAW,E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,MAAM,KAAK,IAAI,CAAC;IAC7C,6FAA6F;IAC7F,aAAa,EAAE,MAAM,IAAI,CAAC;CAC3B;AAED;;;;GAIG;AACH,eAAO,MAAM,8BAA8B,GACzC,MAAM,SAAS,uBAAuB,GAAG,uBAAuB,OAC7D,oCAAoC,CAAC,MAAM,CAyD/C,CAAC"}
@@ -13,8 +13,8 @@ export const isFloatingAgentChatDraft = (state) => state.conversation.chatThread
13
13
  * The state after an open. Within one agent the draft's bookkeeping carries over — the new chat
14
14
  * is kept while untouched, stands by while a thread is open, and is minted afresh once sent;
15
15
  * another agent starts clean. Opening what is already shown changes nothing but the opener's
16
- * `expandHref` / `chatContext` (and the face). The prompt face is the new chat by definition:
17
- * a prompt open with a thread target opens the new chat.
16
+ * `expandHref` / `newChatHref` / `chatContext` (and the face). The prompt face is the new chat
17
+ * by definition: a prompt open with a thread target opens the new chat.
18
18
  */
19
19
  export const floatingAgentChatAfterOpen = (prev, request, mintThreadId) => {
20
20
  const sameAgent = prev !== null && prev.agentChatId === request.agentChatId;
@@ -27,6 +27,7 @@ export const floatingAgentChatAfterOpen = (prev, request, mintThreadId) => {
27
27
  ownChatId: request.ownChatId,
28
28
  face: request.face,
29
29
  expandHref: request.expandHref,
30
+ newChatHref: request.newChatHref,
30
31
  chatContext: request.chatContext,
31
32
  };
32
33
  const target = request.face === "prompt" ? "new" : request.target;
@@ -86,6 +87,7 @@ export const useFloatingAgentChatController = () => {
86
87
  target: options.target ?? "new",
87
88
  face: options.face ?? "panel",
88
89
  expandHref: options.expandHref,
90
+ newChatHref: options.newChatHref,
89
91
  chatContext: options.chatContext,
90
92
  }, () => crypto.randomUUID());
91
93
  });
@@ -1 +1 @@
1
- {"version":3,"file":"floating-agent-prompt.d.ts","sourceRoot":"","sources":["../../src/hooks/floating-agent-prompt.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EACV,2BAA2B,EAC3B,uBAAuB,EACvB,oCAAoC,EACrC,MAAM,uBAAuB,CAAC;AAG/B;;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CAAC;CACvB;AAED,MAAM,WAAW,uCAAuC,CACtD,MAAM,SAAS,uBAAuB,GAAG,uBAAuB;IAEhE,4DAA4D;IAC5D,OAAO,EAAE,oCAAoC,CAAC,MAAM,CAAC,CAAC;IACtD,MAAM,EAAE,SAAS,6BAA6B,CAAC,MAAM,CAAC,EAAE,CAAC;IACzD,+FAA+F;IAC/F,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,sCAAsC;IACrD,yCAAyC;IACzC,MAAM,EAAE,OAAO,CAAC;IAChB,yGAAyG;IACzG,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,iHAAiH;IACjH,UAAU,EAAE,CAAC,OAAO,CAAC,EAAE,8BAA8B,KAAK,OAAO,CAAC;IAClE,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAChC,8EAA8E;IAC9E,SAAS,EAAE,MAAM,CAAC;IAClB,4CAA4C;IAC5C,OAAO,EAAE,OAAO,CAAC;IACjB,2FAA2F;IAC3F,IAAI,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IAChC,iGAAiG;IACjG,OAAO,EAAE,CAAC,IAAI,EAAE,uBAAuB,GAAG,IAAI,KAAK,IAAI,CAAC;CACzD;AAED;;;;GAIG;AACH,eAAO,MAAM,gCAAgC,GAAI,MAAM,SAAS,uBAAuB,GAAG,uBAAuB,EAAE,+BAIhH,uCAAuC,CAAC,MAAM,CAAC,KAAG,sCAwDpD,CAAC"}
@@ -29,6 +29,7 @@ export const useFloatingAgentPromptController = ({ session, agents, canOpen, })
29
29
  setText("");
30
30
  }
31
31
  setOpenCount((count) => count + 1);
32
+ // No `newChatHref`: the prompt has no header, and its first send makes the new chat a thread.
32
33
  open({ agentChat: entry.handle, face: "prompt", expandHref: entry.expandHref, chatContext });
33
34
  return true;
34
35
  }, [agents, canOpen, isOpen, open]);
@@ -7,7 +7,8 @@ export { type AgentConversationContextValue, AgentConversationProvider, type Age
7
7
  export { useAgentThread, type UseAgentThreadOptions, type UseAgentThreadResult } from "./use-agent-thread.js";
8
8
  export { useMediaQuery } from "./use-media-query.js";
9
9
  export { type FloatingAgentChatExpandHref, type FloatingAgentChatFace, type FloatingAgentChatHandle, type FloatingAgentChatOpenOptions, type FloatingAgentChatOpenRequest, type FloatingAgentChatState, type FloatingAgentChatTarget, floatingAgentChatAfterDraftSent, floatingAgentChatAfterOpen, isFloatingAgentChatDraft, useFloatingAgentChatController, type UseFloatingAgentChatControllerResult, } from "./floating-agent-chat.js";
10
- export { type FloatingAgentChatEnginePhase, type FloatingAgentChatUrlContext, useFloatingAgentChatContext, useFloatingAgentChatEngine, type UseFloatingAgentChatEngineResult, } from "./floating-agent-chat-engine.js";
10
+ export { type FloatingAgentChatContextLayers, type FloatingAgentChatEnginePhase, type FloatingAgentChatUrlContext, useFloatingAgentChatContext, type UseFloatingAgentChatContextOptions, useFloatingAgentChatEngine, type UseFloatingAgentChatEngineResult, } from "./floating-agent-chat-engine.js";
11
+ export { type AgentContext, type AgentContextShare, type AgentContextStore, type AgentScreenRead, createAgentContextStore, useAgentContextRegistration, useAgentContextValues, } from "./agent-context.js";
11
12
  export { type FloatingAgentPromptAgentEntry, type FloatingAgentPromptChat, type FloatingAgentPromptOpenOptions, useFloatingAgentPromptController, type UseFloatingAgentPromptControllerOptions, type UseFloatingAgentPromptControllerResult, } from "./floating-agent-prompt.js";
12
13
  export { type FloatingAgentPromptListener, type FloatingAgentPromptRequest, postFloatingAgentPromptRequest, subscribeFloatingAgentPromptRequests, } from "./floating-agent-prompt-requests.js";
13
14
  export { clampPanelSize, type PanelResizeAxis, type PanelResizeBounds, type PanelResizeHandleProps, type PanelSize, parseStoredPanelSize, useResizablePanel, type UseResizablePanelOptions, type UseResizablePanelResult, } from "./use-resizable-panel.js";
@@ -1 +1 @@
1
- {"version":3,"file":"use-agent-threads.d.ts","sourceRoot":"","sources":["../../src/hooks/use-agent-threads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,CAAC,IAAI,CAAC,CAAC;IAC9B,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC9B;AAED,eAAO,MAAM,uBAAuB,iBAAiB,CAAC;AACtD,eAAO,MAAM,gBAAgB,GAAI,SAAS,MAAM,KAAG,MAAgD,CAAC;AAEpG,eAAO,MAAM,qBAAqB,GAAI,QAAQ,IAAI,CAAC,eAAe,EAAE,QAAQ,GAAG,cAAc,CAAC,KAAG,MAIhG,CAAC;AAEF,eAAO,MAAM,uBAAuB,GAAI,QAAQ,IAAI,CAAC,eAAe,EAAE,QAAQ,GAAG,cAAc,GAAG,OAAO,CAAC,KAAG,MACpD,CAAC;AAuC1D,0FAA0F;AAC1F,eAAO,MAAM,eAAe,GAAI,SAAS,sBAAsB,KAAG,qBA+SjE,CAAC;AAEF,eAAe,eAAe,CAAC"}
@@ -11,6 +11,7 @@ export { useAgentThread } from "./use-agent-thread.js";
11
11
  export { useMediaQuery } from "./use-media-query.js";
12
12
  export { floatingAgentChatAfterDraftSent, floatingAgentChatAfterOpen, isFloatingAgentChatDraft, useFloatingAgentChatController, } from "./floating-agent-chat.js";
13
13
  export { useFloatingAgentChatContext, useFloatingAgentChatEngine, } from "./floating-agent-chat-engine.js";
14
+ export { createAgentContextStore, useAgentContextRegistration, useAgentContextValues, } from "./agent-context.js";
14
15
  export { useFloatingAgentPromptController, } from "./floating-agent-prompt.js";
15
16
  export { postFloatingAgentPromptRequest, subscribeFloatingAgentPromptRequests, } from "./floating-agent-prompt-requests.js";
16
17
  export { clampPanelSize, parseStoredPanelSize, useResizablePanel, } from "./use-resizable-panel.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blocksdiy/react-common",
3
- "version": "1.58.0",
3
+ "version": "1.59.0",
4
4
  "type": "module",
5
5
  "description": "React common",
6
6
  "keywords": [],
@@ -33,7 +33,7 @@
33
33
  },
34
34
  "dependencies": {
35
35
  "@ag-ui/client": "0.0.59",
36
- "@blocksdiy/blocks-client-api": "1.5.0",
36
+ "@blocksdiy/blocks-client-api": "1.26.1",
37
37
  "@copilotkit/react-core": "1.70.2",
38
38
  "@radix-ui/react-slot": "^1.2.3",
39
39
  "@vapi-ai/web": "^2.5.2",