@copilotkit/react-core 1.4.0-pre-1-4-0.0 → 1.4.0-pre-1-4-0.10

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.
@@ -7,11 +7,23 @@ type CoAgentStateRenderHandlerArguments<T> = {
7
7
  nodeName: string;
8
8
  state: T;
9
9
  };
10
- type CoAgentStateRender<T = any> = {
10
+ interface CoAgentStateRender<T = any> {
11
+ /**
12
+ * The name of the coagent.
13
+ */
11
14
  name: string;
15
+ /**
16
+ * The node name of the coagent.
17
+ */
12
18
  nodeName?: string;
19
+ /**
20
+ * The handler function to handle the state of the agent.
21
+ */
13
22
  handler?: (props: CoAgentStateRenderHandlerArguments<T>) => void | Promise<void>;
23
+ /**
24
+ * The render function to handle the state of the agent.
25
+ */
14
26
  render?: ((props: CoAgentStateRenderProps<T>) => string | React.ReactElement | undefined | null) | string;
15
- };
27
+ }
16
28
 
17
29
  export { CoAgentStateRender, CoAgentStateRenderHandlerArguments, CoAgentStateRenderProps };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/types/coagent-action.ts"],"sourcesContent":["export type CoAgentStateRenderProps<T> = {\n state: T;\n nodeName: string;\n status: \"inProgress\" | \"complete\";\n};\n\nexport type CoAgentStateRenderHandlerArguments<T> = {\n nodeName: string;\n state: T;\n};\n\nexport type CoAgentStateRender<T = any> = {\n name: string;\n nodeName?: string;\n handler?: (props: CoAgentStateRenderHandlerArguments<T>) => void | Promise<void>;\n render?:\n | ((props: CoAgentStateRenderProps<T>) => string | React.ReactElement | undefined | null)\n | string;\n};\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
1
+ {"version":3,"sources":["../../src/types/coagent-action.ts"],"sourcesContent":["export type CoAgentStateRenderProps<T> = {\n state: T;\n nodeName: string;\n status: \"inProgress\" | \"complete\";\n};\n\nexport type CoAgentStateRenderHandlerArguments<T> = {\n nodeName: string;\n state: T;\n};\n\nexport interface CoAgentStateRender<T = any> {\n /**\n * The name of the coagent.\n */\n name: string;\n /**\n * The node name of the coagent.\n */\n nodeName?: string;\n /**\n * The handler function to handle the state of the agent.\n */\n handler?: (props: CoAgentStateRenderHandlerArguments<T>) => void | Promise<void>;\n /**\n * The render function to handle the state of the agent.\n */\n render?:\n | ((props: CoAgentStateRenderProps<T>) => string | React.ReactElement | undefined | null)\n | string;\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  "publishConfig": {
10
10
  "access": "public"
11
11
  },
12
- "version": "1.4.0-pre-1-4-0.0",
12
+ "version": "1.4.0-pre-1-4-0.10",
13
13
  "sideEffects": false,
14
14
  "main": "./dist/index.js",
15
15
  "module": "./dist/index.mjs",
@@ -36,14 +36,14 @@
36
36
  "tsup": "^6.7.0",
37
37
  "typescript": "^5.2.3",
38
38
  "@types/react-dom": "^18.2.4",
39
- "eslint-config-custom": "1.4.0-pre-1-4-0.0",
40
- "tsconfig": "1.4.0-pre-1-4-0.0"
39
+ "eslint-config-custom": "1.4.0-pre-1-4-0.10",
40
+ "tsconfig": "1.4.0-pre-1-4-0.10"
41
41
  },
42
42
  "dependencies": {
43
43
  "@scarf/scarf": "^1.3.0",
44
44
  "untruncate-json": "^0.0.1",
45
- "@copilotkit/runtime-client-gql": "1.4.0-pre-1-4-0.0",
46
- "@copilotkit/shared": "1.4.0-pre-1-4-0.0"
45
+ "@copilotkit/runtime-client-gql": "1.4.0-pre-1-4-0.10",
46
+ "@copilotkit/shared": "1.4.0-pre-1-4-0.10"
47
47
  },
48
48
  "keywords": [
49
49
  "copilotkit",
@@ -1,8 +1,64 @@
1
+ /**
2
+ * <Callout type="info">
3
+ * Usage of this hook assumes some additional setup in your application, for more information
4
+ * on that see the CoAgents <span className="text-blue-500">[Agentic Generative UI documentation](/coagents/chat-ui/render-agent-state)</span>.
5
+ * </Callout>
6
+ *
7
+ * The useCoAgentStateRender hook allows you to render UI components or text based on a CoAgent's state.
8
+ * This is particularly useful for showing intermediate state or progress during CoAgent operations.
9
+ *
10
+ * ## Usage
11
+ *
12
+ * ### Simple Usage
13
+ *
14
+ * ```tsx
15
+ * import { useCoagentStateRender } from "@copilotkit/react-core";
16
+ *
17
+ * type YourAgentState = {
18
+ * agent_state_property: string;
19
+ * }
20
+ *
21
+ * useCoagentStateRender<YourAgentState>({
22
+ * name: "basic_agent",
23
+ * nodeName: "optionally_specify_a_specific_node",
24
+ * render: ({ status, state, nodeName }) => {
25
+ * return (
26
+ * <YourComponent
27
+ * agentStateProperty={state.agent_state_property}
28
+ * status={status}
29
+ * nodeName={nodeName}
30
+ * />
31
+ * );
32
+ * },
33
+ * });
34
+ * ```
35
+ *
36
+ * This allows for you to render UI components or text based on what is happening within the agent.
37
+ *
38
+ * ### Example
39
+ * A great example of this is in our Perplexity Clone where we render the progress of an agent's internet search as it is happening.
40
+ * You can play around with it below or learn how to build it with its [demo](/coagents/demos/perplexity-clone).
41
+ *
42
+ * <Callout type="info">
43
+ * This example is hosted on Vercel and may take a few seconds to load.
44
+ * </Callout>
45
+ *
46
+ * <iframe src="https://examples-coagents-ai-researcher-ui.vercel.app/" className="w-full rounded-lg border h-[700px] my-4" />
47
+ */
48
+
1
49
  import { useRef, useContext, useEffect } from "react";
2
50
  import { CopilotContext } from "../context/copilot-context";
3
51
  import { randomId } from "@copilotkit/shared";
4
52
  import { CoAgentStateRender } from "../types/coagent-action";
5
53
 
54
+ /**
55
+ * This hook is used to render agent state with custom UI components or text. This is particularly
56
+ * useful for showing intermediate state or progress during CoAgent operations.
57
+ * To get started using rendering intermediate state through this hook, checkout the documentation.
58
+ *
59
+ * https://docs.copilotkit.ai/coagents/chat-ui/render-agent-state.
60
+ */
61
+
6
62
  // We implement useCoAgentStateRender dependency handling so that
7
63
  // the developer has the option to not provide any dependencies.
8
64
  // see useCopilotAction for more details about this approach.
@@ -1,3 +1,93 @@
1
+ /**
2
+ * <Callout type="info">
3
+ * Usage of this hook assumes some additional setup in your application, for more information
4
+ * on that see the CoAgents <span className="text-blue-500">[getting started guide](/coagents/getting-started)</span>.
5
+ * </Callout>
6
+ * <Frame className="my-12">
7
+ * <img
8
+ * src="/images/coagents/SharedStateCoAgents.gif"
9
+ * alt="CoAgents demonstration"
10
+ * className="w-auto"
11
+ * />
12
+ * </Frame>
13
+ *
14
+ * This hook is used to integrate an agent into your application. With its use, you can
15
+ * render and update the state of an agent, allowing for a dynamic and interactive experience.
16
+ * We call these shared state experiences "CoAgents".
17
+ *
18
+ * ## Usage
19
+ *
20
+ * ### Simple Usage
21
+ *
22
+ * ```tsx
23
+ * import { useCoAgent } from "@copilotkit/react-core";
24
+ *
25
+ * type AgentState = {
26
+ * count: number;
27
+ * }
28
+ *
29
+ * const agent = useCoAgent<AgentState>({
30
+ * name: "my-agent",
31
+ * initialState: {
32
+ * count: 0,
33
+ * },
34
+ * });
35
+ *
36
+ * ```
37
+ *
38
+ * `useCoAgent` returns an object with the following properties:
39
+ *
40
+ * ```tsx
41
+ * const {
42
+ * name, // The name of the agent currently being used.
43
+ * nodeName, // The name of the current LangGraph node.
44
+ * state, // The current state of the agent.
45
+ * setState, // A function to update the state of the agent.
46
+ * running, // A boolean indicating if the agent is currently running.
47
+ * start, // A function to start the agent.
48
+ * stop, // A function to stop the agent.
49
+ * run, // A function to re-run the agent. Takes a HintFunction to inform the agent why it is being re-run.
50
+ * } = agent;
51
+ * ```
52
+ *
53
+ * Finally we can leverage these properties to create reactive experiences with the agent!
54
+ *
55
+ * ```tsx
56
+ * const { state, setState } = useCoAgent<AgentState>({
57
+ * name: "my-agent",
58
+ * initialState: {
59
+ * count: 0,
60
+ * },
61
+ * });
62
+ *
63
+ * return (
64
+ * <div>
65
+ * <p>Count: {state.count}</p>
66
+ * <button onClick={() => setState({ count: state.count + 1 })}>Increment</button>
67
+ * </div>
68
+ * );
69
+ * ```
70
+ *
71
+ * This reactivity is bidirectional, meaning that changes to the state from the agent will be reflected in the UI and vice versa.
72
+ *
73
+ * ## Parameters
74
+ * <PropertyReference name="options" type="UseCoagentOptions<T>" required>
75
+ * The options to use when creating the coagent.
76
+ * <PropertyReference name="name" type="string" required>
77
+ * The name of the agent to use.
78
+ * </PropertyReference>
79
+ * <PropertyReference name="initialState" type="T | any">
80
+ * The initial state of the agent.
81
+ * </PropertyReference>
82
+ * <PropertyReference name="state" type="T | any">
83
+ * State to manage externally if you are using this hook with external state management.
84
+ * </PropertyReference>
85
+ * <PropertyReference name="setState" type="(newState: T | ((prevState: T | undefined) => T)) => void">
86
+ * A function to update the state of the agent if you are using this hook with external state management.
87
+ * </PropertyReference>
88
+ * </PropertyReference>
89
+ */
90
+
1
91
  import { useEffect } from "react";
2
92
  import {
3
93
  CopilotContextParams,
@@ -10,18 +100,39 @@ import { useCopilotChat } from "./use-copilot-chat";
10
100
  import { AgentStateMessage, Message, Role, TextMessage } from "@copilotkit/runtime-client-gql";
11
101
 
12
102
  interface WithInternalStateManagementAndInitial<T> {
103
+ /**
104
+ * The name of the agent being used.
105
+ */
13
106
  name: string;
107
+ /**
108
+ * The initial state of the agent.
109
+ */
14
110
  initialState: T;
15
111
  }
16
112
 
17
113
  interface WithInternalStateManagement {
114
+ /**
115
+ * The name of the agent being used.
116
+ */
18
117
  name: string;
19
- initialState?: any; // Optional initialState with default type any
118
+ /**
119
+ * Optional initialState with default type any
120
+ */
121
+ initialState?: any;
20
122
  }
21
123
 
22
124
  interface WithExternalStateManagement<T> {
125
+ /**
126
+ * The name of the agent being used.
127
+ */
23
128
  name: string;
129
+ /**
130
+ * The current state of the agent.
131
+ */
24
132
  state: T;
133
+ /**
134
+ * A function to update the state of the agent.
135
+ */
25
136
  setState: (newState: T | ((prevState: T | undefined) => T)) => void;
26
137
  }
27
138
 
@@ -31,24 +142,64 @@ type UseCoagentOptions<T> =
31
142
  | WithExternalStateManagement<T>;
32
143
 
33
144
  export interface UseCoagentReturnType<T> {
145
+ /**
146
+ * The name of the agent being used.
147
+ */
34
148
  name: string;
149
+ /**
150
+ * The name of the current LangGraph node.
151
+ */
35
152
  nodeName?: string;
153
+ /**
154
+ * The ID of the thread the agent is running in.
155
+ */
36
156
  threadId?: string;
157
+ /**
158
+ * A boolean indicating if the agent is currently running.
159
+ */
37
160
  running: boolean;
161
+ /**
162
+ * The current state of the agent.
163
+ */
38
164
  state: T;
165
+ /**
166
+ * A function to update the state of the agent.
167
+ */
39
168
  setState: (newState: T | ((prevState: T | undefined) => T)) => void;
169
+ /**
170
+ * A function to start the agent.
171
+ */
40
172
  start: () => void;
173
+ /**
174
+ * A function to stop the agent.
175
+ */
41
176
  stop: () => void;
177
+ /**
178
+ * A function to re-run the agent. The hint function can be used to provide a hint to the agent
179
+ * about why it is being re-run again.
180
+ */
42
181
  run: (hint?: HintFunction) => Promise<void>;
43
182
  }
44
183
 
45
184
  export interface HintFunctionParams {
185
+ /**
186
+ * The previous state of the agent.
187
+ */
46
188
  previousState: any;
189
+ /**
190
+ * The current state of the agent.
191
+ */
47
192
  currentState: any;
48
193
  }
49
194
 
50
195
  export type HintFunction = (params: HintFunctionParams) => Message | undefined;
51
196
 
197
+ /**
198
+ * This hook is used to integrate an agent into your application. With its use, you can
199
+ * render and update the state of the agent, allowing for a dynamic and interactive experience.
200
+ * We call these shared state experiences "CoAgents". To get started using CoAgents through this
201
+ * hook, checkout the documentation at https://docs.copilotkit.ai/coagents/getting-started.
202
+ */
52
203
  export function useCoAgent<T = any>(options: UseCoagentOptions<T>): UseCoagentReturnType<T> {
53
204
  const isExternalStateManagement = (
54
205
  options: UseCoagentOptions<T>,
@@ -9,11 +9,23 @@ export type CoAgentStateRenderHandlerArguments<T> = {
9
9
  state: T;
10
10
  };
11
11
 
12
- export type CoAgentStateRender<T = any> = {
12
+ export interface CoAgentStateRender<T = any> {
13
+ /**
14
+ * The name of the coagent.
15
+ */
13
16
  name: string;
17
+ /**
18
+ * The node name of the coagent.
19
+ */
14
20
  nodeName?: string;
21
+ /**
22
+ * The handler function to handle the state of the agent.
23
+ */
15
24
  handler?: (props: CoAgentStateRenderHandlerArguments<T>) => void | Promise<void>;
25
+ /**
26
+ * The render function to handle the state of the agent.
27
+ */
16
28
  render?:
17
29
  | ((props: CoAgentStateRenderProps<T>) => string | React.ReactElement | undefined | null)
18
30
  | string;
19
- };
31
+ }
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/hooks/use-coagent-state-render.ts"],"sourcesContent":["import { useRef, useContext, useEffect } from \"react\";\nimport { CopilotContext } from \"../context/copilot-context\";\nimport { randomId } from \"@copilotkit/shared\";\nimport { CoAgentStateRender } from \"../types/coagent-action\";\n\n// We implement useCoAgentStateRender dependency handling so that\n// the developer has the option to not provide any dependencies.\n// see useCopilotAction for more details about this approach.\nexport function useCoAgentStateRender<T = any>(\n action: CoAgentStateRender<T>,\n dependencies?: any[],\n): void {\n const {\n setCoAgentStateRender,\n removeCoAgentStateRender,\n coAgentStateRenders,\n chatComponentsCache,\n } = useContext(CopilotContext);\n const idRef = useRef<string>(randomId());\n\n const key = `${action.name}-${action.nodeName || \"global\"}`;\n\n if (dependencies === undefined) {\n if (coAgentStateRenders[idRef.current]) {\n coAgentStateRenders[idRef.current].handler = action.handler as any;\n if (typeof action.render === \"function\") {\n if (chatComponentsCache.current !== null) {\n chatComponentsCache.current.coAgentStateRenders[key] = action.render;\n }\n }\n }\n }\n\n useEffect(() => {\n setCoAgentStateRender(idRef.current, action as any);\n if (chatComponentsCache.current !== null && action.render !== undefined) {\n chatComponentsCache.current.coAgentStateRenders[key] = action.render;\n }\n return () => {\n removeCoAgentStateRender(idRef.current);\n };\n }, [\n setCoAgentStateRender,\n removeCoAgentStateRender,\n action.name,\n // include render only if it's a string\n typeof action.render === \"string\" ? action.render : undefined,\n // dependencies set by the developer\n ...(dependencies || []),\n ]);\n}\n"],"mappings":";;;;;AAAA,SAAS,QAAQ,YAAY,iBAAiB;AAE9C,SAAS,gBAAgB;AAMlB,SAAS,sBACd,QACA,cACM;AACN,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI,WAAW,cAAc;AAC7B,QAAM,QAAQ,OAAe,SAAS,CAAC;AAEvC,QAAM,MAAM,GAAG,OAAO,QAAQ,OAAO,YAAY;AAEjD,MAAI,iBAAiB,QAAW;AAC9B,QAAI,oBAAoB,MAAM,OAAO,GAAG;AACtC,0BAAoB,MAAM,OAAO,EAAE,UAAU,OAAO;AACpD,UAAI,OAAO,OAAO,WAAW,YAAY;AACvC,YAAI,oBAAoB,YAAY,MAAM;AACxC,8BAAoB,QAAQ,oBAAoB,GAAG,IAAI,OAAO;AAAA,QAChE;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAEA,YAAU,MAAM;AACd,0BAAsB,MAAM,SAAS,MAAa;AAClD,QAAI,oBAAoB,YAAY,QAAQ,OAAO,WAAW,QAAW;AACvE,0BAAoB,QAAQ,oBAAoB,GAAG,IAAI,OAAO;AAAA,IAChE;AACA,WAAO,MAAM;AACX,+BAAyB,MAAM,OAAO;AAAA,IACxC;AAAA,EACF,GAAG;AAAA,IACD;AAAA,IACA;AAAA,IACA,OAAO;AAAA;AAAA,IAEP,OAAO,OAAO,WAAW,WAAW,OAAO,SAAS;AAAA;AAAA,IAEpD,GAAI,gBAAgB,CAAC;AAAA,EACvB,CAAC;AACH;","names":[]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/hooks/use-coagent.ts"],"sourcesContent":["import { useEffect } 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 { AgentStateMessage, Message, Role, TextMessage } from \"@copilotkit/runtime-client-gql\";\n\ninterface WithInternalStateManagementAndInitial<T> {\n name: string;\n initialState: T;\n}\n\ninterface WithInternalStateManagement {\n name: string;\n initialState?: any; // Optional initialState with default type any\n}\n\ninterface WithExternalStateManagement<T> {\n name: string;\n state: T;\n setState: (newState: T | ((prevState: T | undefined) => T)) => void;\n}\n\ntype UseCoagentOptions<T> =\n | WithInternalStateManagementAndInitial<T>\n | WithInternalStateManagement\n | WithExternalStateManagement<T>;\n\nexport interface UseCoagentReturnType<T> {\n name: string;\n nodeName?: string;\n threadId?: string;\n running: boolean;\n state: T;\n setState: (newState: T | ((prevState: T | undefined) => T)) => void;\n start: () => void;\n stop: () => void;\n run: (hint?: HintFunction) => Promise<void>;\n}\n\nexport interface HintFunctionParams {\n previousState: any;\n currentState: any;\n}\n\nexport type HintFunction = (params: HintFunctionParams) => Message | undefined;\n\nexport function useCoAgent<T = any>(options: UseCoagentOptions<T>): UseCoagentReturnType<T> {\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\n const isInternalStateManagementWithInitial = (\n options: UseCoagentOptions<T>,\n ): options is WithInternalStateManagementAndInitial<T> => {\n return \"initialState\" in options;\n };\n\n const generalContext = useCopilotContext();\n const messagesContext = useCopilotMessagesContext();\n const context = { ...generalContext, ...messagesContext };\n const { coagentStates, setCoagentStates } = context;\n const { appendMessage } = 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 running: false,\n active: false,\n threadId: undefined,\n nodeName: undefined,\n runId: undefined,\n };\n }\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 setCoagentStates((prevAgentStates) => {\n let coagentState: CoagentState = getCoagentState(prevAgentStates, name);\n\n const updatedState =\n typeof newState === \"function\" ? (newState as Function)(coagentState.state) : newState;\n\n return {\n ...prevAgentStates,\n [name]: {\n ...coagentState,\n state: updatedState,\n },\n };\n });\n };\n\n const coagentState = getCoagentState(coagentStates, name);\n\n const state = isExternalStateManagement(options) ? options.state : coagentState.state;\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 }, [isExternalStateManagement(options) ? JSON.stringify(options.state) : undefined]);\n\n // Return the state and setState function\n return {\n name,\n nodeName: coagentState.nodeName,\n state,\n setState,\n running: coagentState.running,\n start: () => {\n startAgent(name, context);\n },\n stop: () => {\n stopAgent(name, context);\n },\n run: (hint?: HintFunction) => {\n return runAgent(name, context, appendMessage, hint);\n },\n };\n}\n\nfunction startAgent(name: string, context: CopilotContextParams) {\n const { setAgentSession } = context;\n setAgentSession({\n agentName: name,\n });\n}\n\nfunction stopAgent(name: string, context: CopilotContextParams) {\n const { agentSession, setAgentSession } = context;\n if (agentSession && agentSession.agentName === name) {\n setAgentSession(null);\n } else {\n console.warn(`No agent session found for ${name}`);\n }\n}\n\nasync function runAgent(\n name: string,\n context: CopilotContextParams & CopilotMessagesContextParams,\n appendMessage: (message: Message) => Promise<void>,\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.coagentStates?.[name]?.state || {};\n\n if (hint) {\n const hintMessage = hint({ previousState, currentState: state });\n if (hintMessage) {\n await appendMessage(hintMessage);\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAAA,SAAS,iBAAiB;AAmDnB,SAAS,WAAoB,SAAwD;AAC1F,QAAM,4BAA4B,CAChCA,aAC8C;AAC9C,WAAO,WAAWA,YAAW,cAAcA;AAAA,EAC7C;AAEA,QAAM,EAAE,KAAK,IAAI;AAEjB,QAAM,uCAAuC,CAC3CA,aACwD;AACxD,WAAO,kBAAkBA;AAAA,EAC3B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