@copilotkit/react-core 1.51.2 → 1.51.3-next.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.
- package/CHANGELOG.md +9 -0
- package/dist/{chunk-4YZA2BZC.mjs → chunk-2VA5EV2P.mjs} +2 -2
- package/dist/{chunk-3V5TOYKW.mjs → chunk-4MLKBZGB.mjs} +2 -2
- package/dist/{chunk-6PUNP7CD.mjs → chunk-BVBFFI7K.mjs} +3 -3
- package/dist/chunk-BVBFFI7K.mjs.map +1 -0
- package/dist/{chunk-LHERIF3L.mjs → chunk-FJEI7IBX.mjs} +2 -2
- package/dist/{chunk-53K6WNJG.mjs → chunk-M7U7RZLU.mjs} +2 -2
- package/dist/{chunk-LSHFN2Y5.mjs → chunk-OBXQSB7S.mjs} +2 -2
- package/dist/{chunk-FQFXYAV7.mjs → chunk-W5BKJN46.mjs} +2 -2
- package/dist/components/copilot-provider/copilotkit-props.d.ts +20 -0
- package/dist/components/copilot-provider/copilotkit-props.js.map +1 -1
- package/dist/components/copilot-provider/copilotkit.mjs +3 -3
- package/dist/components/copilot-provider/index.mjs +3 -3
- package/dist/components/error-boundary/error-boundary.js +2 -2
- package/dist/components/error-boundary/error-boundary.js.map +1 -1
- package/dist/components/error-boundary/error-boundary.mjs +2 -2
- package/dist/components/error-boundary/error-utils.js +2 -12
- package/dist/components/error-boundary/error-utils.js.map +1 -1
- package/dist/components/error-boundary/error-utils.mjs +1 -1
- package/dist/components/index.mjs +3 -3
- package/dist/hooks/index.js +2 -2
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/index.mjs +4 -4
- package/dist/hooks/use-copilot-chat-headless_c.js +2 -2
- package/dist/hooks/use-copilot-chat-headless_c.js.map +1 -1
- package/dist/hooks/use-copilot-chat-headless_c.mjs +3 -3
- package/dist/hooks/use-copilot-chat.js +2 -2
- package/dist/hooks/use-copilot-chat.js.map +1 -1
- package/dist/hooks/use-copilot-chat.mjs +3 -3
- package/dist/hooks/use-copilot-chat_internal.js +2 -2
- package/dist/hooks/use-copilot-chat_internal.js.map +1 -1
- package/dist/hooks/use-copilot-chat_internal.mjs +2 -2
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +7 -7
- package/dist/lib/copilot-task.mjs +4 -4
- package/dist/lib/index.mjs +4 -4
- package/jest.config.js +1 -1
- package/package.json +6 -6
- package/src/components/copilot-provider/copilotkit-props.tsx +20 -0
- package/src/components/error-boundary/error-utils.tsx +2 -2
- package/dist/chunk-6PUNP7CD.mjs.map +0 -1
- /package/dist/{chunk-4YZA2BZC.mjs.map → chunk-2VA5EV2P.mjs.map} +0 -0
- /package/dist/{chunk-3V5TOYKW.mjs.map → chunk-4MLKBZGB.mjs.map} +0 -0
- /package/dist/{chunk-LHERIF3L.mjs.map → chunk-FJEI7IBX.mjs.map} +0 -0
- /package/dist/{chunk-53K6WNJG.mjs.map → chunk-M7U7RZLU.mjs.map} +0 -0
- /package/dist/{chunk-LSHFN2Y5.mjs.map → chunk-OBXQSB7S.mjs.map} +0 -0
- /package/dist/{chunk-FQFXYAV7.mjs.map → chunk-W5BKJN46.mjs.map} +0 -0
package/dist/index.mjs
CHANGED
|
@@ -5,7 +5,7 @@ import "./chunk-36KQV2NA.mjs";
|
|
|
5
5
|
import "./chunk-LUGEI4YQ.mjs";
|
|
6
6
|
import {
|
|
7
7
|
CopilotTask
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-4MLKBZGB.mjs";
|
|
9
9
|
import "./chunk-4CEQJ2X6.mjs";
|
|
10
10
|
import "./chunk-A6NKSGH3.mjs";
|
|
11
11
|
import {
|
|
@@ -40,16 +40,16 @@ import {
|
|
|
40
40
|
} from "./chunk-7DTB7S5V.mjs";
|
|
41
41
|
import {
|
|
42
42
|
useCopilotChatHeadless_c
|
|
43
|
-
} from "./chunk-
|
|
43
|
+
} from "./chunk-W5BKJN46.mjs";
|
|
44
44
|
import {
|
|
45
45
|
useCopilotChatSuggestions
|
|
46
46
|
} from "./chunk-XDFVCQD3.mjs";
|
|
47
47
|
import {
|
|
48
48
|
useCopilotChat
|
|
49
|
-
} from "./chunk-
|
|
49
|
+
} from "./chunk-M7U7RZLU.mjs";
|
|
50
50
|
import {
|
|
51
51
|
useCopilotChatInternal
|
|
52
|
-
} from "./chunk-
|
|
52
|
+
} from "./chunk-OBXQSB7S.mjs";
|
|
53
53
|
import {
|
|
54
54
|
useLangGraphInterruptRender
|
|
55
55
|
} from "./chunk-VV56AVPB.mjs";
|
|
@@ -71,8 +71,8 @@ import "./chunk-SPCZTZCY.mjs";
|
|
|
71
71
|
import {
|
|
72
72
|
CopilotKit,
|
|
73
73
|
defaultCopilotContextCategories
|
|
74
|
-
} from "./chunk-
|
|
75
|
-
import "./chunk-
|
|
74
|
+
} from "./chunk-2VA5EV2P.mjs";
|
|
75
|
+
import "./chunk-FJEI7IBX.mjs";
|
|
76
76
|
import "./chunk-CYDWEPFL.mjs";
|
|
77
77
|
import {
|
|
78
78
|
SUGGESTION_RETRY_CONFIG
|
|
@@ -84,7 +84,7 @@ import {
|
|
|
84
84
|
import "./chunk-RKTVJRK7.mjs";
|
|
85
85
|
import "./chunk-PMAFHQ7P.mjs";
|
|
86
86
|
import "./chunk-YYN33GSG.mjs";
|
|
87
|
-
import "./chunk-
|
|
87
|
+
import "./chunk-BVBFFI7K.mjs";
|
|
88
88
|
import "./chunk-O7ARI5CV.mjs";
|
|
89
89
|
import "./chunk-QNUAXSDP.mjs";
|
|
90
90
|
import "./chunk-NB2FKV2V.mjs";
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CopilotTask
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-4MLKBZGB.mjs";
|
|
4
4
|
import "../chunk-4CEQJ2X6.mjs";
|
|
5
5
|
import "../chunk-JD7BAH7U.mjs";
|
|
6
6
|
import "../chunk-SPCZTZCY.mjs";
|
|
7
|
-
import "../chunk-
|
|
8
|
-
import "../chunk-
|
|
7
|
+
import "../chunk-2VA5EV2P.mjs";
|
|
8
|
+
import "../chunk-FJEI7IBX.mjs";
|
|
9
9
|
import "../chunk-CYDWEPFL.mjs";
|
|
10
10
|
import "../chunk-2IDV5OHF.mjs";
|
|
11
11
|
import "../chunk-HE22TZMF.mjs";
|
|
@@ -13,7 +13,7 @@ import "../chunk-ICIK2BSB.mjs";
|
|
|
13
13
|
import "../chunk-RKTVJRK7.mjs";
|
|
14
14
|
import "../chunk-PMAFHQ7P.mjs";
|
|
15
15
|
import "../chunk-YYN33GSG.mjs";
|
|
16
|
-
import "../chunk-
|
|
16
|
+
import "../chunk-BVBFFI7K.mjs";
|
|
17
17
|
import "../chunk-O7ARI5CV.mjs";
|
|
18
18
|
import "../chunk-QNUAXSDP.mjs";
|
|
19
19
|
import "../chunk-NB2FKV2V.mjs";
|
package/dist/lib/index.mjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import "../chunk-LUGEI4YQ.mjs";
|
|
2
2
|
import {
|
|
3
3
|
CopilotTask
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-4MLKBZGB.mjs";
|
|
5
5
|
import "../chunk-4CEQJ2X6.mjs";
|
|
6
6
|
import "../chunk-JD7BAH7U.mjs";
|
|
7
7
|
import "../chunk-SPCZTZCY.mjs";
|
|
8
|
-
import "../chunk-
|
|
9
|
-
import "../chunk-
|
|
8
|
+
import "../chunk-2VA5EV2P.mjs";
|
|
9
|
+
import "../chunk-FJEI7IBX.mjs";
|
|
10
10
|
import "../chunk-CYDWEPFL.mjs";
|
|
11
11
|
import "../chunk-2IDV5OHF.mjs";
|
|
12
12
|
import "../chunk-HE22TZMF.mjs";
|
|
@@ -14,7 +14,7 @@ import "../chunk-ICIK2BSB.mjs";
|
|
|
14
14
|
import "../chunk-RKTVJRK7.mjs";
|
|
15
15
|
import "../chunk-PMAFHQ7P.mjs";
|
|
16
16
|
import "../chunk-YYN33GSG.mjs";
|
|
17
|
-
import "../chunk-
|
|
17
|
+
import "../chunk-BVBFFI7K.mjs";
|
|
18
18
|
import "../chunk-O7ARI5CV.mjs";
|
|
19
19
|
import "../chunk-QNUAXSDP.mjs";
|
|
20
20
|
import "../chunk-NB2FKV2V.mjs";
|
package/jest.config.js
CHANGED
|
@@ -12,7 +12,7 @@ module.exports = {
|
|
|
12
12
|
"\\.(css|less|scss|sass)$": "identity-obj-proxy",
|
|
13
13
|
},
|
|
14
14
|
transformIgnorePatterns: [
|
|
15
|
-
"node_modules/(?!(
|
|
15
|
+
"node_modules/(?!(streamdown|@copilotkitnext)/)",
|
|
16
16
|
],
|
|
17
17
|
transform: {
|
|
18
18
|
"^.+\\.(ts|tsx)$": "ts-jest",
|
package/package.json
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"publishConfig": {
|
|
10
10
|
"access": "public"
|
|
11
11
|
},
|
|
12
|
-
"version": "1.51.
|
|
12
|
+
"version": "1.51.3-next.0",
|
|
13
13
|
"sideEffects": [
|
|
14
14
|
"**/*.css"
|
|
15
15
|
],
|
|
@@ -57,12 +57,12 @@
|
|
|
57
57
|
"dependencies": {
|
|
58
58
|
"@ag-ui/client": "^0.0.42",
|
|
59
59
|
"@scarf/scarf": "^1.3.0",
|
|
60
|
-
"
|
|
60
|
+
"streamdown": "^1.6.10",
|
|
61
61
|
"untruncate-json": "^0.0.1",
|
|
62
|
-
"@copilotkit/runtime-client-gql": "1.51.
|
|
63
|
-
"@copilotkit/shared": "1.51.
|
|
64
|
-
"@copilotkitnext/core": "1.51.
|
|
65
|
-
"@copilotkitnext/react": "1.51.
|
|
62
|
+
"@copilotkit/runtime-client-gql": "1.51.3-next.0",
|
|
63
|
+
"@copilotkit/shared": "1.51.3-next.0",
|
|
64
|
+
"@copilotkitnext/core": "1.51.3-next.0",
|
|
65
|
+
"@copilotkitnext/react": "1.51.3-next.0"
|
|
66
66
|
},
|
|
67
67
|
"keywords": [
|
|
68
68
|
"copilotkit",
|
|
@@ -102,6 +102,26 @@ export interface CopilotKitProps extends Omit<CopilotKitProviderProps, "children
|
|
|
102
102
|
/**
|
|
103
103
|
* Indicates whether the user agent should send or receive cookies from the other domain
|
|
104
104
|
* in the case of cross-origin requests.
|
|
105
|
+
*
|
|
106
|
+
* To enable HTTP-only cookie authentication, set `credentials="include"` and configure
|
|
107
|
+
* CORS on your runtime endpoint:
|
|
108
|
+
*
|
|
109
|
+
* ```tsx
|
|
110
|
+
* // Frontend (https://myapp.com)
|
|
111
|
+
* <CopilotKit runtimeUrl="https://api.myapp.com/copilotkit" credentials="include">
|
|
112
|
+
* {children}
|
|
113
|
+
* </CopilotKit>
|
|
114
|
+
*
|
|
115
|
+
* // Backend (https://api.myapp.com)
|
|
116
|
+
* copilotRuntimeNextJSAppRouterEndpoint({
|
|
117
|
+
* runtime,
|
|
118
|
+
* endpoint: "/copilotkit",
|
|
119
|
+
* cors: {
|
|
120
|
+
* origin: "https://myapp.com",
|
|
121
|
+
* credentials: true,
|
|
122
|
+
* },
|
|
123
|
+
* });
|
|
124
|
+
* ```
|
|
105
125
|
*/
|
|
106
126
|
credentials?: RequestCredentials;
|
|
107
127
|
|
|
@@ -2,7 +2,7 @@ import React, { useCallback } from "react";
|
|
|
2
2
|
import { GraphQLError } from "@copilotkit/runtime-client-gql";
|
|
3
3
|
import { useToast } from "../toast/toast-provider";
|
|
4
4
|
import { ExclamationMarkIcon } from "../toast/exclamation-mark-icon";
|
|
5
|
-
import
|
|
5
|
+
import { Streamdown } from "streamdown";
|
|
6
6
|
|
|
7
7
|
interface OriginalError {
|
|
8
8
|
message?: string;
|
|
@@ -37,7 +37,7 @@ export function ErrorToast({ errors }: { errors: (Error | GraphQLError)[] }) {
|
|
|
37
37
|
<span style={{ fontFamily: "monospace", fontWeight: "normal" }}>{code}</span>
|
|
38
38
|
</div>
|
|
39
39
|
)}
|
|
40
|
-
<
|
|
40
|
+
<Streamdown>{message}</Streamdown>
|
|
41
41
|
</div>
|
|
42
42
|
);
|
|
43
43
|
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/error-boundary/error-utils.tsx"],"sourcesContent":["import React, { useCallback } from \"react\";\nimport { GraphQLError } from \"@copilotkit/runtime-client-gql\";\nimport { useToast } from \"../toast/toast-provider\";\nimport { ExclamationMarkIcon } from \"../toast/exclamation-mark-icon\";\nimport ReactMarkdown from \"react-markdown\";\n\ninterface OriginalError {\n message?: string;\n stack?: string;\n}\n\nexport function ErrorToast({ errors }: { errors: (Error | GraphQLError)[] }) {\n const errorsToRender = errors.map((error, idx) => {\n const originalError =\n \"extensions\" in error ? (error.extensions?.originalError as undefined | OriginalError) : {};\n const message = originalError?.message ?? error.message;\n const code = \"extensions\" in error ? (error.extensions?.code as string) : null;\n\n return (\n <div\n key={idx}\n style={{\n marginTop: idx === 0 ? 0 : 10,\n marginBottom: 14,\n }}\n >\n <ExclamationMarkIcon style={{ marginBottom: 4 }} />\n\n {code && (\n <div\n style={{\n fontWeight: \"600\",\n marginBottom: 4,\n }}\n >\n Copilot Runtime Error:{\" \"}\n <span style={{ fontFamily: \"monospace\", fontWeight: \"normal\" }}>{code}</span>\n </div>\n )}\n <ReactMarkdown>{message}</ReactMarkdown>\n </div>\n );\n });\n return (\n <div\n style={{\n fontSize: \"13px\",\n maxWidth: \"600px\",\n }}\n >\n {errorsToRender}\n <div style={{ fontSize: \"11px\", opacity: 0.75 }}>\n NOTE: This error only displays during local development.\n </div>\n </div>\n );\n}\n\nexport function useErrorToast() {\n const { addToast } = useToast();\n\n return useCallback(\n (errors: (Error | GraphQLError)[]) => {\n const errorId = errors\n .map((err) => {\n const message =\n \"extensions\" in err\n ? (err.extensions?.originalError as any)?.message || err.message\n : err.message;\n const stack = err.stack || \"\";\n return btoa(message + stack).slice(0, 32); // Create hash from message + stack\n })\n .join(\"|\");\n\n addToast({\n type: \"error\",\n id: errorId, // Toast libraries typically dedupe by id\n message: <ErrorToast errors={errors} />,\n });\n },\n [addToast],\n );\n}\n\nexport function useAsyncCallback<T extends (...args: any[]) => Promise<any>>(\n callback: T,\n deps: Parameters<typeof useCallback>[1],\n) {\n const addErrorToast = useErrorToast();\n return useCallback(async (...args: Parameters<T>) => {\n try {\n return await callback(...args);\n } catch (error) {\n console.error(\"Error in async callback:\", error);\n // @ts-ignore\n addErrorToast([error]);\n throw error;\n }\n }, deps);\n}\n"],"mappings":";;;;;;;;;;;AAAA,SAAgB,mBAAmB;AAInC,OAAO,mBAAmB;AAsBlB,cAGE,YAHF;AAfD,SAAS,WAAW,EAAE,OAAO,GAAyC;AAC3E,QAAM,iBAAiB,OAAO,IAAI,CAAC,OAAO,QAAQ;AAZpD;AAaI,UAAM,gBACJ,gBAAgB,SAAS,WAAM,eAAN,mBAAkB,gBAA8C,CAAC;AAC5F,UAAM,WAAU,oDAAe,YAAf,YAA0B,MAAM;AAChD,UAAM,OAAO,gBAAgB,SAAS,WAAM,eAAN,mBAAkB,OAAkB;AAE1E,WACE;AAAA,MAAC;AAAA;AAAA,QAEC,OAAO;AAAA,UACL,WAAW,QAAQ,IAAI,IAAI;AAAA,UAC3B,cAAc;AAAA,QAChB;AAAA,QAEA;AAAA,8BAAC,uBAAoB,OAAO,EAAE,cAAc,EAAE,GAAG;AAAA,UAEhD,QACC;AAAA,YAAC;AAAA;AAAA,cACC,OAAO;AAAA,gBACL,YAAY;AAAA,gBACZ,cAAc;AAAA,cAChB;AAAA,cACD;AAAA;AAAA,gBACwB;AAAA,gBACvB,oBAAC,UAAK,OAAO,EAAE,YAAY,aAAa,YAAY,SAAS,GAAI,gBAAK;AAAA;AAAA;AAAA,UACxE;AAAA,UAEF,oBAAC,iBAAe,mBAAQ;AAAA;AAAA;AAAA,MAnBnB;AAAA,IAoBP;AAAA,EAEJ,CAAC;AACD,SACE;AAAA,IAAC;AAAA;AAAA,MACC,OAAO;AAAA,QACL,UAAU;AAAA,QACV,UAAU;AAAA,MACZ;AAAA,MAEC;AAAA;AAAA,QACD,oBAAC,SAAI,OAAO,EAAE,UAAU,QAAQ,SAAS,KAAK,GAAG,sEAEjD;AAAA;AAAA;AAAA,EACF;AAEJ;AAEO,SAAS,gBAAgB;AAC9B,QAAM,EAAE,SAAS,IAAI,SAAS;AAE9B,SAAO;AAAA,IACL,CAAC,WAAqC;AACpC,YAAM,UAAU,OACb,IAAI,CAAC,QAAQ;AAhEtB;AAiEU,cAAM,UACJ,gBAAgB,QACX,eAAI,eAAJ,mBAAgB,kBAAhB,mBAAuC,YAAW,IAAI,UACvD,IAAI;AACV,cAAM,QAAQ,IAAI,SAAS;AAC3B,eAAO,KAAK,UAAU,KAAK,EAAE,MAAM,GAAG,EAAE;AAAA,MAC1C,CAAC,EACA,KAAK,GAAG;AAEX,eAAS;AAAA,QACP,MAAM;AAAA,QACN,IAAI;AAAA;AAAA,QACJ,SAAS,oBAAC,cAAW,QAAgB;AAAA,MACvC,CAAC;AAAA,IACH;AAAA,IACA,CAAC,QAAQ;AAAA,EACX;AACF;AAEO,SAAS,iBACd,UACA,MACA;AACA,QAAM,gBAAgB,cAAc;AACpC,SAAO,YAAY,IAAU,SAAwB;AACnD,QAAI;AACF,aAAO,MAAM,SAAS,GAAG,IAAI;AAAA,IAC/B,SAAS,OAAP;AACA,cAAQ,MAAM,4BAA4B,KAAK;AAE/C,oBAAc,CAAC,KAAK,CAAC;AACrB,YAAM;AAAA,IACR;AAAA,EACF,IAAG,IAAI;AACT;","names":[]}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|