@copilotkit/react-core 1.6.0-next.5 → 1.6.0-next.7
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/CHANGELOG.md +15 -0
- package/dist/{chunk-HM7CCAUL.mjs → chunk-ADTDNMYG.mjs} +55 -46
- package/dist/chunk-ADTDNMYG.mjs.map +1 -0
- package/dist/hooks/index.js +53 -44
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/index.mjs +1 -1
- package/dist/hooks/use-coagent.js +53 -44
- package/dist/hooks/use-coagent.js.map +1 -1
- package/dist/hooks/use-coagent.mjs +1 -1
- package/dist/index.js +53 -44
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +3 -3
- package/src/hooks/use-coagent.ts +68 -55
- package/dist/chunk-HM7CCAUL.mjs.map +0 -1
package/dist/index.mjs
CHANGED
package/package.json
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"publishConfig": {
|
|
10
10
|
"access": "public"
|
|
11
11
|
},
|
|
12
|
-
"version": "1.6.0-next.
|
|
12
|
+
"version": "1.6.0-next.7",
|
|
13
13
|
"sideEffects": false,
|
|
14
14
|
"main": "./dist/index.js",
|
|
15
15
|
"module": "./dist/index.mjs",
|
|
@@ -43,8 +43,8 @@
|
|
|
43
43
|
"@scarf/scarf": "^1.3.0",
|
|
44
44
|
"react-markdown": "^8.0.7",
|
|
45
45
|
"untruncate-json": "^0.0.1",
|
|
46
|
-
"@copilotkit/runtime-client-gql": "1.6.0-next.
|
|
47
|
-
"@copilotkit/shared": "1.6.0-next.
|
|
46
|
+
"@copilotkit/runtime-client-gql": "1.6.0-next.7",
|
|
47
|
+
"@copilotkit/shared": "1.6.0-next.7"
|
|
48
48
|
},
|
|
49
49
|
"keywords": [
|
|
50
50
|
"copilotkit",
|
package/src/hooks/use-coagent.ts
CHANGED
|
@@ -88,7 +88,7 @@
|
|
|
88
88
|
* </PropertyReference>
|
|
89
89
|
*/
|
|
90
90
|
|
|
91
|
-
import { useEffect, useRef } from "react";
|
|
91
|
+
import { useCallback, useEffect, useMemo, useRef } from "react";
|
|
92
92
|
import {
|
|
93
93
|
CopilotContextParams,
|
|
94
94
|
CopilotMessagesContextParams,
|
|
@@ -223,12 +223,6 @@ export function useCoAgent<T = any>(options: UseCoagentOptions<T>): UseCoagentRe
|
|
|
223
223
|
const lastLoadedThreadId = useRef<string>();
|
|
224
224
|
const lastLoadedState = useRef<any>();
|
|
225
225
|
|
|
226
|
-
const isExternalStateManagement = (
|
|
227
|
-
options: UseCoagentOptions<T>,
|
|
228
|
-
): options is WithExternalStateManagement<T> => {
|
|
229
|
-
return "state" in options && "setState" in options;
|
|
230
|
-
};
|
|
231
|
-
|
|
232
226
|
const { name } = options;
|
|
233
227
|
useEffect(() => {
|
|
234
228
|
if (availableAgents?.length && !availableAgents.some((a) => a.name === name)) {
|
|
@@ -238,35 +232,12 @@ export function useCoAgent<T = any>(options: UseCoagentOptions<T>): UseCoagentRe
|
|
|
238
232
|
}
|
|
239
233
|
}, [availableAgents]);
|
|
240
234
|
|
|
241
|
-
const isInternalStateManagementWithInitial = (
|
|
242
|
-
options: UseCoagentOptions<T>,
|
|
243
|
-
): options is WithInternalStateManagementAndInitial<T> => {
|
|
244
|
-
return "initialState" in options;
|
|
245
|
-
};
|
|
246
|
-
|
|
247
235
|
const messagesContext = useCopilotMessagesContext();
|
|
248
236
|
const context = { ...generalContext, ...messagesContext };
|
|
249
237
|
const { coagentStates, coagentStatesRef, setCoagentStatesWithRef, threadId, copilotApiConfig } =
|
|
250
238
|
context;
|
|
251
239
|
const { appendMessage, runChatCompletion } = useCopilotChat();
|
|
252
240
|
|
|
253
|
-
const getCoagentState = (coagentStates: Record<string, CoagentState>, name: string) => {
|
|
254
|
-
if (coagentStates[name]) {
|
|
255
|
-
return coagentStates[name];
|
|
256
|
-
} else {
|
|
257
|
-
return {
|
|
258
|
-
name,
|
|
259
|
-
state: isInternalStateManagementWithInitial(options) ? options.initialState : {},
|
|
260
|
-
configurable: options.configurable ?? {},
|
|
261
|
-
running: false,
|
|
262
|
-
active: false,
|
|
263
|
-
threadId: undefined,
|
|
264
|
-
nodeName: undefined,
|
|
265
|
-
runId: undefined,
|
|
266
|
-
};
|
|
267
|
-
}
|
|
268
|
-
};
|
|
269
|
-
|
|
270
241
|
const runtimeClient = useCopilotRuntimeClient({
|
|
271
242
|
url: copilotApiConfig.chatApiEndpoint,
|
|
272
243
|
publicApiKey: copilotApiConfig.publicApiKey,
|
|
@@ -274,19 +245,23 @@ export function useCoAgent<T = any>(options: UseCoagentOptions<T>): UseCoagentRe
|
|
|
274
245
|
});
|
|
275
246
|
|
|
276
247
|
// if we manage state internally, we need to provide a function to set the state
|
|
277
|
-
const setState = (
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
248
|
+
const setState = useCallback(
|
|
249
|
+
(newState: T | ((prevState: T | undefined) => T)) => {
|
|
250
|
+
// coagentStatesRef.current || {}
|
|
251
|
+
let coagentState: CoagentState = getCoagentState({ coagentStates, name, options });
|
|
252
|
+
const updatedState =
|
|
253
|
+
typeof newState === "function" ? (newState as Function)(coagentState.state) : newState;
|
|
281
254
|
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
255
|
+
setCoagentStatesWithRef({
|
|
256
|
+
...coagentStatesRef.current,
|
|
257
|
+
[name]: {
|
|
258
|
+
...coagentState,
|
|
259
|
+
state: updatedState,
|
|
260
|
+
},
|
|
261
|
+
});
|
|
262
|
+
},
|
|
263
|
+
[coagentStates, name],
|
|
264
|
+
);
|
|
290
265
|
|
|
291
266
|
useEffect(() => {
|
|
292
267
|
const fetchAgentState = async () => {
|
|
@@ -312,8 +287,6 @@ export function useCoAgent<T = any>(options: UseCoagentOptions<T>): UseCoagentRe
|
|
|
312
287
|
void fetchAgentState();
|
|
313
288
|
}, [threadId]);
|
|
314
289
|
|
|
315
|
-
const coagentState = getCoagentState(coagentStates, name);
|
|
316
|
-
|
|
317
290
|
// Sync internal state with external state if state management is external
|
|
318
291
|
useEffect(() => {
|
|
319
292
|
if (isExternalStateManagement(options)) {
|
|
@@ -335,17 +308,20 @@ export function useCoAgent<T = any>(options: UseCoagentOptions<T>): UseCoagentRe
|
|
|
335
308
|
);
|
|
336
309
|
|
|
337
310
|
// Return the state and setState function
|
|
338
|
-
return {
|
|
339
|
-
name,
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
311
|
+
return useMemo(() => {
|
|
312
|
+
const coagentState = getCoagentState({ coagentStates, name, options });
|
|
313
|
+
return {
|
|
314
|
+
name,
|
|
315
|
+
nodeName: coagentState.nodeName,
|
|
316
|
+
threadId: coagentState.threadId,
|
|
317
|
+
running: coagentState.running,
|
|
318
|
+
state: coagentState.state,
|
|
319
|
+
setState: isExternalStateManagement(options) ? options.setState : setState,
|
|
320
|
+
start: () => startAgent(name, context),
|
|
321
|
+
stop: () => stopAgent(name, context),
|
|
322
|
+
run: runAgentCallback,
|
|
323
|
+
};
|
|
324
|
+
}, [name, coagentStates, options, setState, runAgentCallback]);
|
|
349
325
|
}
|
|
350
326
|
|
|
351
327
|
export function startAgent(name: string, context: CopilotContextParams) {
|
|
@@ -412,3 +388,40 @@ export async function runAgent(
|
|
|
412
388
|
await runChatCompletion();
|
|
413
389
|
}
|
|
414
390
|
}
|
|
391
|
+
|
|
392
|
+
const isExternalStateManagement = <T>(
|
|
393
|
+
options: UseCoagentOptions<T>,
|
|
394
|
+
): options is WithExternalStateManagement<T> => {
|
|
395
|
+
return "state" in options && "setState" in options;
|
|
396
|
+
};
|
|
397
|
+
|
|
398
|
+
const isInternalStateManagementWithInitial = <T>(
|
|
399
|
+
options: UseCoagentOptions<T>,
|
|
400
|
+
): options is WithInternalStateManagementAndInitial<T> => {
|
|
401
|
+
return "initialState" in options;
|
|
402
|
+
};
|
|
403
|
+
|
|
404
|
+
const getCoagentState = <T>({
|
|
405
|
+
coagentStates,
|
|
406
|
+
name,
|
|
407
|
+
options,
|
|
408
|
+
}: {
|
|
409
|
+
coagentStates: Record<string, CoagentState>;
|
|
410
|
+
name: string;
|
|
411
|
+
options: UseCoagentOptions<T>;
|
|
412
|
+
}) => {
|
|
413
|
+
if (coagentStates[name]) {
|
|
414
|
+
return coagentStates[name];
|
|
415
|
+
} else {
|
|
416
|
+
return {
|
|
417
|
+
name,
|
|
418
|
+
state: isInternalStateManagementWithInitial<T>(options) ? options.initialState : {},
|
|
419
|
+
configurable: options.configurable ?? {},
|
|
420
|
+
running: false,
|
|
421
|
+
active: false,
|
|
422
|
+
threadId: undefined,
|
|
423
|
+
nodeName: undefined,
|
|
424
|
+
runId: undefined,
|
|
425
|
+
};
|
|
426
|
+
}
|
|
427
|
+
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/hooks/use-coagent.ts"],"sourcesContent":["/**\n * <Callout type=\"info\">\n * Usage of this hook assumes some additional setup in your application, for more information\n * on that see the CoAgents <span className=\"text-blue-500\">[getting started guide](/coagents/quickstart/langgraph)</span>.\n * </Callout>\n * <Frame className=\"my-12\">\n * <img\n * src=\"/images/coagents/SharedStateCoAgents.gif\"\n * alt=\"CoAgents demonstration\"\n * className=\"w-auto\"\n * />\n * </Frame>\n *\n * This hook is used to integrate an agent into your application. With its use, you can\n * render and update the state of an agent, allowing for a dynamic and interactive experience.\n * We call these shared state experiences agentic copilots, or CoAgents for short.\n *\n * ## Usage\n *\n * ### Simple Usage\n *\n * ```tsx\n * import { useCoAgent } from \"@copilotkit/react-core\";\n *\n * type AgentState = {\n * count: number;\n * }\n *\n * const agent = useCoAgent<AgentState>({\n * name: \"my-agent\",\n * initialState: {\n * count: 0,\n * },\n * });\n *\n * ```\n *\n * `useCoAgent` returns an object with the following properties:\n *\n * ```tsx\n * const {\n * name, // The name of the agent currently being used.\n * nodeName, // The name of the current LangGraph node.\n * state, // The current state of the agent.\n * setState, // A function to update the state of the agent.\n * running, // A boolean indicating if the agent is currently running.\n * start, // A function to start the agent.\n * stop, // A function to stop the agent.\n * run, // A function to re-run the agent. Takes a HintFunction to inform the agent why it is being re-run.\n * } = agent;\n * ```\n *\n * Finally we can leverage these properties to create reactive experiences with the agent!\n *\n * ```tsx\n * const { state, setState } = useCoAgent<AgentState>({\n * name: \"my-agent\",\n * initialState: {\n * count: 0,\n * },\n * });\n *\n * return (\n * <div>\n * <p>Count: {state.count}</p>\n * <button onClick={() => setState({ count: state.count + 1 })}>Increment</button>\n * </div>\n * );\n * ```\n *\n * This reactivity is bidirectional, meaning that changes to the state from the agent will be reflected in the UI and vice versa.\n *\n * ## Parameters\n * <PropertyReference name=\"options\" type=\"UseCoagentOptions<T>\" required>\n * The options to use when creating the coagent.\n * <PropertyReference name=\"name\" type=\"string\" required>\n * The name of the agent to use.\n * </PropertyReference>\n * <PropertyReference name=\"initialState\" type=\"T | any\">\n * The initial state of the agent.\n * </PropertyReference>\n * <PropertyReference name=\"state\" type=\"T | any\">\n * State to manage externally if you are using this hook with external state management.\n * </PropertyReference>\n * <PropertyReference name=\"setState\" type=\"(newState: T | ((prevState: T | undefined) => T)) => void\">\n * A function to update the state of the agent if you are using this hook with external state management.\n * </PropertyReference>\n * </PropertyReference>\n */\n\nimport { useEffect, useRef } from \"react\";\nimport {\n CopilotContextParams,\n CopilotMessagesContextParams,\n useCopilotContext,\n useCopilotMessagesContext,\n} from \"../context\";\nimport { CoagentState } from \"../types/coagent-state\";\nimport { useCopilotChat } from \"./use-copilot-chat\";\nimport { Message } from \"@copilotkit/runtime-client-gql\";\nimport { useAsyncCallback } from \"../components/error-boundary/error-utils\";\nimport { useToast } from \"../components/toast/toast-provider\";\nimport { useCopilotRuntimeClient } from \"./use-copilot-runtime-client\";\nimport { parseJson } from \"@copilotkit/shared\";\n\ninterface WithInternalStateManagementAndInitial<T> {\n /**\n * The name of the agent being used.\n */\n name: string;\n /**\n * The initial state of the agent.\n */\n initialState: T;\n /**\n * Config to pass to a LangGraph Agent\n */\n configurable?: Record<string, any>;\n}\n\ninterface WithInternalStateManagement {\n /**\n * The name of the agent being used.\n */\n name: string;\n /**\n * Optional initialState with default type any\n */\n initialState?: any;\n /**\n * Config to pass to a LangGraph Agent\n */\n configurable?: Record<string, any>;\n}\n\ninterface WithExternalStateManagement<T> {\n /**\n * The name of the agent being used.\n */\n name: string;\n /**\n * The current state of the agent.\n */\n state: T;\n /**\n * A function to update the state of the agent.\n */\n setState: (newState: T | ((prevState: T | undefined) => T)) => void;\n /**\n * Config to pass to a LangGraph Agent\n */\n configurable?: Record<string, any>;\n}\n\ntype UseCoagentOptions<T> =\n | WithInternalStateManagementAndInitial<T>\n | WithInternalStateManagement\n | WithExternalStateManagement<T>;\n\nexport interface UseCoagentReturnType<T> {\n /**\n * The name of the agent being used.\n */\n name: string;\n /**\n * The name of the current LangGraph node.\n */\n nodeName?: string;\n /**\n * The ID of the thread the agent is running in.\n */\n threadId?: string;\n /**\n * A boolean indicating if the agent is currently running.\n */\n running: boolean;\n /**\n * The current state of the agent.\n */\n state: T;\n /**\n * A function to update the state of the agent.\n */\n setState: (newState: T | ((prevState: T | undefined) => T)) => void;\n /**\n * A function to start the agent.\n */\n start: () => void;\n /**\n * A function to stop the agent.\n */\n stop: () => void;\n /**\n * A function to re-run the agent. The hint function can be used to provide a hint to the agent\n * about why it is being re-run again.\n */\n run: (hint?: HintFunction) => Promise<void>;\n}\n\nexport interface HintFunctionParams {\n /**\n * The previous state of the agent.\n */\n previousState: any;\n /**\n * The current state of the agent.\n */\n currentState: any;\n}\n\nexport type HintFunction = (params: HintFunctionParams) => Message | undefined;\n\n/**\n * This hook is used to integrate an agent into your application. With its use, you can\n * render and update the state of the agent, allowing for a dynamic and interactive experience.\n * We call these shared state experiences \"agentic copilots\". To get started using agentic copilots, which\n * we refer to as CoAgents, checkout the documentation at https://docs.copilotkit.ai/coagents/quickstart/langgraph.\n */\nexport function useCoAgent<T = any>(options: UseCoagentOptions<T>): UseCoagentReturnType<T> {\n const generalContext = useCopilotContext();\n const { availableAgents } = generalContext;\n const { addToast } = useToast();\n const lastLoadedThreadId = useRef<string>();\n const lastLoadedState = useRef<any>();\n\n const isExternalStateManagement = (\n options: UseCoagentOptions<T>,\n ): options is WithExternalStateManagement<T> => {\n return \"state\" in options && \"setState\" in options;\n };\n\n const { name } = options;\n useEffect(() => {\n if (availableAgents?.length && !availableAgents.some((a) => a.name === name)) {\n const message = `(useCoAgent): Agent \"${name}\" not found. Make sure the agent exists and is properly configured.`;\n console.warn(message);\n addToast({ type: \"warning\", message });\n }\n }, [availableAgents]);\n\n const isInternalStateManagementWithInitial = (\n options: UseCoagentOptions<T>,\n ): options is WithInternalStateManagementAndInitial<T> => {\n return \"initialState\" in options;\n };\n\n const messagesContext = useCopilotMessagesContext();\n const context = { ...generalContext, ...messagesContext };\n const { coagentStates, coagentStatesRef, setCoagentStatesWithRef, threadId, copilotApiConfig } =\n context;\n const { appendMessage, runChatCompletion } = useCopilotChat();\n\n const getCoagentState = (coagentStates: Record<string, CoagentState>, name: string) => {\n if (coagentStates[name]) {\n return coagentStates[name];\n } else {\n return {\n name,\n state: isInternalStateManagementWithInitial(options) ? options.initialState : {},\n configurable: options.configurable ?? {},\n running: false,\n active: false,\n threadId: undefined,\n nodeName: undefined,\n runId: undefined,\n };\n }\n };\n\n const runtimeClient = useCopilotRuntimeClient({\n url: copilotApiConfig.chatApiEndpoint,\n publicApiKey: copilotApiConfig.publicApiKey,\n credentials: copilotApiConfig.credentials,\n });\n\n // if we manage state internally, we need to provide a function to set the state\n const setState = (newState: T | ((prevState: T | undefined) => T)) => {\n let coagentState: CoagentState = getCoagentState(coagentStatesRef.current || {}, name);\n const updatedState =\n typeof newState === \"function\" ? (newState as Function)(coagentState.state) : newState;\n\n setCoagentStatesWithRef({\n ...coagentStatesRef.current,\n [name]: {\n ...coagentState,\n state: updatedState,\n },\n });\n };\n\n useEffect(() => {\n const fetchAgentState = async () => {\n if (!threadId || threadId === lastLoadedThreadId.current) return;\n\n const result = await runtimeClient.loadAgentState({\n threadId,\n agentName: name,\n });\n\n const newState = result.data?.loadAgentState?.state;\n if (newState === lastLoadedState.current) return;\n\n if (result.data?.loadAgentState?.threadExists && newState && newState != \"{}\") {\n lastLoadedState.current = newState;\n lastLoadedThreadId.current = threadId;\n const fetchedState = parseJson(newState, {});\n isExternalStateManagement(options)\n ? options.setState(fetchedState)\n : setState(fetchedState);\n }\n };\n void fetchAgentState();\n }, [threadId]);\n\n const coagentState = getCoagentState(coagentStates, name);\n\n // Sync internal state with external state if state management is external\n useEffect(() => {\n if (isExternalStateManagement(options)) {\n setState(options.state);\n } else if (coagentStates[name] === undefined) {\n setState(options.initialState === undefined ? {} : options.initialState);\n }\n }, [\n isExternalStateManagement(options) ? JSON.stringify(options.state) : undefined,\n // reset initialstate on reset\n coagentStates[name] === undefined,\n ]);\n\n const runAgentCallback = useAsyncCallback(\n async (hint?: HintFunction) => {\n await runAgent(name, context, appendMessage, runChatCompletion, hint);\n },\n [name, context, appendMessage, runChatCompletion],\n );\n\n // Return the state and setState function\n return {\n name,\n nodeName: coagentState.nodeName,\n threadId: coagentState.threadId,\n running: coagentState.running,\n state: coagentState.state,\n setState: isExternalStateManagement(options) ? options.setState : setState,\n start: () => startAgent(name, context),\n stop: () => stopAgent(name, context),\n run: runAgentCallback,\n };\n}\n\nexport function startAgent(name: string, context: CopilotContextParams) {\n const { setAgentSession } = context;\n setAgentSession({\n agentName: name,\n });\n}\n\nexport function stopAgent(name: string, context: CopilotContextParams) {\n const { agentSession, setAgentSession } = context;\n if (agentSession && agentSession.agentName === name) {\n setAgentSession(null);\n context.setCoagentStates((prevAgentStates) => {\n return {\n ...prevAgentStates,\n [name]: {\n ...prevAgentStates[name],\n running: false,\n active: false,\n threadId: undefined,\n nodeName: undefined,\n runId: undefined,\n },\n };\n });\n } else {\n console.warn(`No agent session found for ${name}`);\n }\n}\n\nexport async function runAgent(\n name: string,\n context: CopilotContextParams & CopilotMessagesContextParams,\n appendMessage: (message: Message) => Promise<void>,\n runChatCompletion: () => Promise<Message[]>,\n hint?: HintFunction,\n) {\n const { agentSession, setAgentSession } = context;\n if (!agentSession || agentSession.agentName !== name) {\n setAgentSession({\n agentName: name,\n });\n }\n\n let previousState: any = null;\n for (let i = context.messages.length - 1; i >= 0; i--) {\n const message = context.messages[i];\n if (message.isAgentStateMessage() && message.agentName === name) {\n previousState = message.state;\n }\n }\n\n let state = context.coagentStatesRef.current?.[name]?.state || {};\n\n if (hint) {\n const hintMessage = hint({ previousState, currentState: state });\n if (hintMessage) {\n await appendMessage(hintMessage);\n } else {\n await runChatCompletion();\n }\n } else {\n await runChatCompletion();\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AA0FA,SAAS,WAAW,cAAc;AAalC,SAAS,iBAAiB;AAmHnB,SAAS,WAAoB,SAAwD;AAC1F,QAAM,iBAAiB,kBAAkB;AACzC,QAAM,EAAE,gBAAgB,IAAI;AAC5B,QAAM,EAAE,SAAS,IAAI,SAAS;AAC9B,QAAM,qBAAqB,OAAe;AAC1C,QAAM,kBAAkB,OAAY;AAEpC,QAAM,4BAA4B,CAChCA,aAC8C;AAC9C,WAAO,WAAWA,YAAW,cAAcA;AAAA,EAC7C;AAEA,QAAM,EAAE,KAAK,IAAI;AACjB,YAAU,MAAM;AACd,SAAI,mDAAiB,WAAU,CAAC,gBAAgB,KAAK,CAAC,MAAM,EAAE,SAAS,IAAI,GAAG;AAC5E,YAAM,UAAU,wBAAwB;AACxC,cAAQ,KAAK,OAAO;AACpB,eAAS,EAAE,MAAM,WAAW,QAAQ,CAAC;AAAA,IACvC;AAAA,EACF,GAAG,CAAC,eAAe,CAAC;AAEpB,QAAM,uCAAuC,CAC3CA,aACwD;AACxD,WAAO,kBAAkBA;AAAA,EAC3B;AAEA,QAAM,kBAAkB,0BAA0B;AAClD,QAAM,UAA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