@copilotkit/react-core 1.9.2-next.2 → 1.9.2-next.4
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 +20 -0
- package/dist/{chunk-FRZZPPIV.mjs → chunk-7G6RR4HE.mjs} +2 -2
- package/dist/{chunk-Q5D5XQFA.mjs → chunk-CMQV4XNY.mjs} +2 -2
- package/dist/{chunk-UHQMV2CE.mjs → chunk-ERXWDCY6.mjs} +2 -2
- package/dist/{chunk-4I7PLQF7.mjs → chunk-I4JPQECN.mjs} +4 -4
- package/dist/{chunk-RUY6MLHA.mjs → chunk-ISYBUDL4.mjs} +34 -3
- package/dist/chunk-ISYBUDL4.mjs.map +1 -0
- package/dist/{chunk-T42PN5VN.mjs → chunk-JHIZ5HAI.mjs} +2 -2
- package/dist/{chunk-C6F6EQNA.mjs → chunk-JPMIAGI6.mjs} +2 -2
- package/dist/{chunk-MGIXEJWG.mjs → chunk-JXF732XG.mjs} +5 -5
- package/dist/{chunk-L6QAOAE4.mjs → chunk-RN3ZRHI7.mjs} +13 -10
- package/dist/chunk-RN3ZRHI7.mjs.map +1 -0
- package/dist/{chunk-LDACFA2B.mjs → chunk-S4BOATBG.mjs} +3 -3
- package/dist/{chunk-2FW7HH6W.mjs → chunk-T4ZKC4X4.mjs} +2 -2
- package/dist/{chunk-LZDDYZEY.mjs → chunk-UBNRUXEK.mjs} +2 -2
- package/dist/{chunk-OUSWPVDT.mjs → chunk-VF6UPRKM.mjs} +3 -3
- package/dist/{chunk-NNSXCFQO.mjs → chunk-VJCHRQ7Q.mjs} +5 -4
- package/dist/chunk-VJCHRQ7Q.mjs.map +1 -0
- package/dist/{chunk-6KGEF242.mjs → chunk-XFOTNHYA.mjs} +3 -2
- package/dist/chunk-XFOTNHYA.mjs.map +1 -0
- package/dist/{chunk-CMKIDDQL.mjs → chunk-ZHEEHGLS.mjs} +6 -6
- package/dist/components/copilot-provider/copilot-messages.js +4 -2
- package/dist/components/copilot-provider/copilot-messages.js.map +1 -1
- package/dist/components/copilot-provider/copilot-messages.mjs +2 -2
- package/dist/components/copilot-provider/copilotkit-props.d.ts +21 -2
- package/dist/components/copilot-provider/copilotkit-props.js.map +1 -1
- package/dist/components/copilot-provider/copilotkit.d.ts +1 -1
- package/dist/components/copilot-provider/copilotkit.js +42 -7
- package/dist/components/copilot-provider/copilotkit.js.map +1 -1
- package/dist/components/copilot-provider/copilotkit.mjs +7 -7
- package/dist/components/copilot-provider/index.d.ts +1 -1
- package/dist/components/copilot-provider/index.js +42 -7
- package/dist/components/copilot-provider/index.js.map +1 -1
- package/dist/components/copilot-provider/index.mjs +7 -7
- package/dist/components/index.d.ts +1 -1
- package/dist/components/index.js +42 -7
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +7 -7
- package/dist/context/copilot-context.d.ts +1 -1
- package/dist/context/copilot-context.js +2 -1
- package/dist/context/copilot-context.js.map +1 -1
- package/dist/context/copilot-context.mjs +1 -1
- package/dist/context/index.d.ts +1 -1
- package/dist/context/index.js +2 -1
- package/dist/context/index.js.map +1 -1
- package/dist/context/index.mjs +1 -1
- package/dist/{copilot-context-f9b2b4c3.d.ts → copilot-context-3da805ab.d.ts} +5 -1
- package/dist/hooks/index.d.ts +1 -1
- package/dist/hooks/index.js +34 -3
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/index.mjs +30 -30
- package/dist/hooks/use-chat.d.ts +1 -1
- package/dist/hooks/use-chat.js +34 -3
- package/dist/hooks/use-chat.js.map +1 -1
- package/dist/hooks/use-chat.mjs +4 -4
- package/dist/hooks/use-coagent-state-render.js +2 -1
- package/dist/hooks/use-coagent-state-render.js.map +1 -1
- package/dist/hooks/use-coagent-state-render.mjs +2 -2
- package/dist/hooks/use-coagent.d.ts +1 -1
- package/dist/hooks/use-coagent.js +34 -3
- package/dist/hooks/use-coagent.js.map +1 -1
- package/dist/hooks/use-coagent.mjs +11 -11
- package/dist/hooks/use-copilot-action.js +2 -1
- package/dist/hooks/use-copilot-action.js.map +1 -1
- package/dist/hooks/use-copilot-action.mjs +2 -2
- package/dist/hooks/use-copilot-additional-instructions.js +2 -1
- package/dist/hooks/use-copilot-additional-instructions.js.map +1 -1
- package/dist/hooks/use-copilot-additional-instructions.mjs +2 -2
- package/dist/hooks/use-copilot-authenticated-action.js +2 -1
- package/dist/hooks/use-copilot-authenticated-action.js.map +1 -1
- package/dist/hooks/use-copilot-authenticated-action.mjs +3 -3
- package/dist/hooks/use-copilot-chat.d.ts +1 -1
- package/dist/hooks/use-copilot-chat.js +34 -3
- package/dist/hooks/use-copilot-chat.js.map +1 -1
- package/dist/hooks/use-copilot-chat.mjs +10 -10
- package/dist/hooks/use-copilot-readable.js +2 -1
- package/dist/hooks/use-copilot-readable.js.map +1 -1
- package/dist/hooks/use-copilot-readable.mjs +2 -2
- package/dist/hooks/use-copilot-runtime-client.d.ts +2 -0
- package/dist/hooks/use-copilot-runtime-client.js +52 -2
- package/dist/hooks/use-copilot-runtime-client.js.map +1 -1
- package/dist/hooks/use-copilot-runtime-client.mjs +1 -1
- package/dist/hooks/use-langgraph-interrupt-render.js +2 -1
- package/dist/hooks/use-langgraph-interrupt-render.js.map +1 -1
- package/dist/hooks/use-langgraph-interrupt-render.mjs +2 -2
- package/dist/hooks/use-langgraph-interrupt.d.ts +1 -1
- package/dist/hooks/use-langgraph-interrupt.js +34 -3
- package/dist/hooks/use-langgraph-interrupt.js.map +1 -1
- package/dist/hooks/use-langgraph-interrupt.mjs +11 -11
- package/dist/hooks/use-make-copilot-document-readable.js +2 -1
- package/dist/hooks/use-make-copilot-document-readable.js.map +1 -1
- package/dist/hooks/use-make-copilot-document-readable.mjs +2 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.js +42 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +31 -31
- package/dist/lib/copilot-task.d.ts +1 -1
- package/dist/lib/copilot-task.js.map +1 -1
- package/dist/lib/copilot-task.mjs +8 -8
- package/dist/lib/index.d.ts +1 -1
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/index.mjs +8 -8
- package/dist/types/interrupt-action.d.ts +1 -1
- package/dist/utils/extract.d.ts +1 -1
- package/dist/utils/extract.js.map +1 -1
- package/dist/utils/extract.mjs +7 -7
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/index.mjs +8 -8
- package/package.json +5 -5
- package/src/components/copilot-provider/__tests__/copilotkit-trace.test.tsx +74 -0
- package/src/components/copilot-provider/copilot-messages.tsx +4 -2
- package/src/components/copilot-provider/copilotkit-props.tsx +21 -0
- package/src/components/copilot-provider/copilotkit.tsx +5 -1
- package/src/context/copilot-context.tsx +7 -1
- package/src/hooks/use-copilot-runtime-client.ts +41 -2
- package/tsup.config.ts +6 -6
- package/dist/chunk-6KGEF242.mjs.map +0 -1
- package/dist/chunk-L6QAOAE4.mjs.map +0 -1
- package/dist/chunk-NNSXCFQO.mjs.map +0 -1
- package/dist/chunk-RUY6MLHA.mjs.map +0 -1
- package/dist/utils/utils.test.d.ts +0 -2
- package/dist/utils/utils.test.js +0 -9
- package/dist/utils/utils.test.js.map +0 -1
- package/dist/utils/utils.test.mjs +0 -7
- package/dist/utils/utils.test.mjs.map +0 -1
- /package/dist/{chunk-FRZZPPIV.mjs.map → chunk-7G6RR4HE.mjs.map} +0 -0
- /package/dist/{chunk-Q5D5XQFA.mjs.map → chunk-CMQV4XNY.mjs.map} +0 -0
- /package/dist/{chunk-UHQMV2CE.mjs.map → chunk-ERXWDCY6.mjs.map} +0 -0
- /package/dist/{chunk-4I7PLQF7.mjs.map → chunk-I4JPQECN.mjs.map} +0 -0
- /package/dist/{chunk-T42PN5VN.mjs.map → chunk-JHIZ5HAI.mjs.map} +0 -0
- /package/dist/{chunk-C6F6EQNA.mjs.map → chunk-JPMIAGI6.mjs.map} +0 -0
- /package/dist/{chunk-MGIXEJWG.mjs.map → chunk-JXF732XG.mjs.map} +0 -0
- /package/dist/{chunk-LDACFA2B.mjs.map → chunk-S4BOATBG.mjs.map} +0 -0
- /package/dist/{chunk-2FW7HH6W.mjs.map → chunk-T4ZKC4X4.mjs.map} +0 -0
- /package/dist/{chunk-LZDDYZEY.mjs.map → chunk-UBNRUXEK.mjs.map} +0 -0
- /package/dist/{chunk-OUSWPVDT.mjs.map → chunk-VF6UPRKM.mjs.map} +0 -0
- /package/dist/{chunk-CMKIDDQL.mjs.map → chunk-ZHEEHGLS.mjs.map} +0 -0
package/dist/hooks/index.mjs
CHANGED
|
@@ -1,56 +1,56 @@
|
|
|
1
1
|
import "../chunk-CQPYJIBH.mjs";
|
|
2
|
-
import {
|
|
3
|
-
useMakeCopilotDocumentReadable
|
|
4
|
-
} from "../chunk-UHQMV2CE.mjs";
|
|
5
|
-
import {
|
|
6
|
-
useCopilotAdditionalInstructions
|
|
7
|
-
} from "../chunk-C6F6EQNA.mjs";
|
|
8
|
-
import {
|
|
9
|
-
useCopilotAuthenticatedAction_c
|
|
10
|
-
} from "../chunk-LDACFA2B.mjs";
|
|
11
|
-
import {
|
|
12
|
-
useCopilotReadable
|
|
13
|
-
} from "../chunk-LZDDYZEY.mjs";
|
|
14
2
|
import {
|
|
15
3
|
useLangGraphInterruptRender
|
|
16
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-CMQV4XNY.mjs";
|
|
17
5
|
import {
|
|
18
6
|
useLangGraphInterrupt
|
|
19
|
-
} from "../chunk-
|
|
7
|
+
} from "../chunk-VF6UPRKM.mjs";
|
|
8
|
+
import {
|
|
9
|
+
useMakeCopilotDocumentReadable
|
|
10
|
+
} from "../chunk-ERXWDCY6.mjs";
|
|
20
11
|
import {
|
|
21
12
|
useCoAgentStateRender
|
|
22
|
-
} from "../chunk-
|
|
13
|
+
} from "../chunk-T4ZKC4X4.mjs";
|
|
23
14
|
import {
|
|
24
15
|
runAgent,
|
|
25
16
|
startAgent,
|
|
26
17
|
stopAgent,
|
|
27
18
|
useCoAgent
|
|
28
|
-
} from "../chunk-
|
|
19
|
+
} from "../chunk-ZHEEHGLS.mjs";
|
|
20
|
+
import {
|
|
21
|
+
useCopilotAdditionalInstructions
|
|
22
|
+
} from "../chunk-JPMIAGI6.mjs";
|
|
23
|
+
import {
|
|
24
|
+
useCopilotAuthenticatedAction_c
|
|
25
|
+
} from "../chunk-S4BOATBG.mjs";
|
|
26
|
+
import {
|
|
27
|
+
useCopilotAction
|
|
28
|
+
} from "../chunk-JHIZ5HAI.mjs";
|
|
29
29
|
import {
|
|
30
30
|
useCopilotChat
|
|
31
|
-
} from "../chunk-
|
|
32
|
-
import
|
|
33
|
-
|
|
31
|
+
} from "../chunk-I4JPQECN.mjs";
|
|
32
|
+
import {
|
|
33
|
+
useCopilotReadable
|
|
34
|
+
} from "../chunk-UBNRUXEK.mjs";
|
|
35
|
+
import "../chunk-RN3ZRHI7.mjs";
|
|
34
36
|
import "../chunk-QQZLIEXK.mjs";
|
|
35
|
-
import "../chunk-
|
|
37
|
+
import "../chunk-VJCHRQ7Q.mjs";
|
|
38
|
+
import "../chunk-5FHSUKQL.mjs";
|
|
36
39
|
import "../chunk-RKTVJRK7.mjs";
|
|
37
40
|
import "../chunk-PMAFHQ7P.mjs";
|
|
38
|
-
import "../chunk-5FHSUKQL.mjs";
|
|
39
|
-
import "../chunk-DCTJZ742.mjs";
|
|
40
41
|
import "../chunk-HD2GE3DK.mjs";
|
|
41
|
-
import "../chunk-
|
|
42
|
+
import "../chunk-YPSGKPDA.mjs";
|
|
43
|
+
import "../chunk-DCTJZ742.mjs";
|
|
44
|
+
import "../chunk-JXF732XG.mjs";
|
|
42
45
|
import "../chunk-4CEQJ2X6.mjs";
|
|
46
|
+
import "../chunk-CCESTGAM.mjs";
|
|
47
|
+
import "../chunk-O7ARI5CV.mjs";
|
|
43
48
|
import {
|
|
44
49
|
useCopilotRuntimeClient
|
|
45
|
-
} from "../chunk-
|
|
50
|
+
} from "../chunk-ISYBUDL4.mjs";
|
|
46
51
|
import "../chunk-GFJW4RIM.mjs";
|
|
47
|
-
import {
|
|
48
|
-
useCopilotAction
|
|
49
|
-
} from "../chunk-T42PN5VN.mjs";
|
|
50
|
-
import "../chunk-CCESTGAM.mjs";
|
|
51
|
-
import "../chunk-O7ARI5CV.mjs";
|
|
52
52
|
import "../chunk-VRXANACV.mjs";
|
|
53
|
-
import "../chunk-
|
|
53
|
+
import "../chunk-XFOTNHYA.mjs";
|
|
54
54
|
import "../chunk-SKC7AJIV.mjs";
|
|
55
55
|
export {
|
|
56
56
|
runAgent,
|
package/dist/hooks/use-chat.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { FunctionCallHandler, CoAgentStateRenderHandler } from '@copilotkit/shared';
|
|
3
3
|
import { Message, TextMessage, ForwardedParametersInput, ExtensionsInput } from '@copilotkit/runtime-client-gql';
|
|
4
|
-
import { c as CopilotApiConfig, A as AgentSession, L as LangGraphInterruptAction, d as LangGraphInterruptActionSetter } from '../copilot-context-
|
|
4
|
+
import { c as CopilotApiConfig, A as AgentSession, L as LangGraphInterruptAction, d as LangGraphInterruptActionSetter } from '../copilot-context-3da805ab.js';
|
|
5
5
|
import { FrontendAction } from '../types/frontend-action.js';
|
|
6
6
|
import { CoagentState } from '../types/coagent-state.js';
|
|
7
7
|
import './use-tree.js';
|
package/dist/hooks/use-chat.js
CHANGED
|
@@ -139,8 +139,35 @@ function shouldShowDevConsole(showDevConsole) {
|
|
|
139
139
|
// src/hooks/use-copilot-runtime-client.ts
|
|
140
140
|
var useCopilotRuntimeClient = (options) => {
|
|
141
141
|
const { setBannerError } = useToast();
|
|
142
|
-
const _a = options, { showDevConsole } = _a, runtimeOptions = __objRest(_a, ["showDevConsole"]);
|
|
142
|
+
const _a = options, { showDevConsole, onTrace } = _a, runtimeOptions = __objRest(_a, ["showDevConsole", "onTrace"]);
|
|
143
143
|
const lastStructuredErrorRef = (0, import_react2.useRef)(null);
|
|
144
|
+
const traceUIError = (error, originalError) => __async(void 0, null, function* () {
|
|
145
|
+
if (!onTrace || !runtimeOptions.publicApiKey)
|
|
146
|
+
return;
|
|
147
|
+
try {
|
|
148
|
+
const traceEvent = {
|
|
149
|
+
type: "error",
|
|
150
|
+
timestamp: Date.now(),
|
|
151
|
+
context: {
|
|
152
|
+
source: "ui",
|
|
153
|
+
request: {
|
|
154
|
+
operation: "runtimeClient",
|
|
155
|
+
url: runtimeOptions.url,
|
|
156
|
+
startTime: Date.now()
|
|
157
|
+
},
|
|
158
|
+
technical: {
|
|
159
|
+
environment: process.env.NODE_ENV,
|
|
160
|
+
userAgent: typeof navigator !== "undefined" ? navigator.userAgent : void 0,
|
|
161
|
+
stackTrace: originalError instanceof Error ? originalError.stack : void 0
|
|
162
|
+
}
|
|
163
|
+
},
|
|
164
|
+
error
|
|
165
|
+
};
|
|
166
|
+
yield onTrace(traceEvent);
|
|
167
|
+
} catch (traceError) {
|
|
168
|
+
console.error("Error in onTrace handler:", traceError);
|
|
169
|
+
}
|
|
170
|
+
});
|
|
144
171
|
const runtimeClient = (0, import_react2.useMemo)(() => {
|
|
145
172
|
return new import_runtime_client_gql2.CopilotRuntimeClient(__spreadProps(__spreadValues({}, runtimeOptions), {
|
|
146
173
|
handleGQLErrors: (error) => {
|
|
@@ -168,12 +195,14 @@ var useCopilotRuntimeClient = (options) => {
|
|
|
168
195
|
const ckError = createStructuredError(gqlError);
|
|
169
196
|
if (ckError) {
|
|
170
197
|
setBannerError(ckError);
|
|
198
|
+
traceUIError(ckError, gqlError);
|
|
171
199
|
} else {
|
|
172
200
|
const fallbackError = new import_shared3.CopilotKitError({
|
|
173
201
|
message: gqlError.message,
|
|
174
202
|
code: import_shared3.CopilotKitErrorCode.UNKNOWN
|
|
175
203
|
});
|
|
176
204
|
setBannerError(fallbackError);
|
|
205
|
+
traceUIError(fallbackError, gqlError);
|
|
177
206
|
}
|
|
178
207
|
};
|
|
179
208
|
graphQLErrors.forEach(routeError);
|
|
@@ -187,6 +216,7 @@ var useCopilotRuntimeClient = (options) => {
|
|
|
187
216
|
code: import_shared3.CopilotKitErrorCode.UNKNOWN
|
|
188
217
|
});
|
|
189
218
|
setBannerError(fallbackError);
|
|
219
|
+
traceUIError(fallbackError, error);
|
|
190
220
|
}
|
|
191
221
|
}
|
|
192
222
|
},
|
|
@@ -199,7 +229,7 @@ var useCopilotRuntimeClient = (options) => {
|
|
|
199
229
|
setBannerError(warningError);
|
|
200
230
|
}
|
|
201
231
|
}));
|
|
202
|
-
}, [runtimeOptions, setBannerError, showDevConsole]);
|
|
232
|
+
}, [runtimeOptions, setBannerError, showDevConsole, onTrace]);
|
|
203
233
|
return runtimeClient;
|
|
204
234
|
};
|
|
205
235
|
function createStructuredError(gqlError) {
|
|
@@ -299,7 +329,8 @@ var emptyCopilotContext = {
|
|
|
299
329
|
},
|
|
300
330
|
langGraphInterruptAction: null,
|
|
301
331
|
setLangGraphInterruptAction: () => null,
|
|
302
|
-
removeLangGraphInterruptAction: () => null
|
|
332
|
+
removeLangGraphInterruptAction: () => null,
|
|
333
|
+
onTrace: void 0
|
|
303
334
|
};
|
|
304
335
|
var CopilotContext = import_react3.default.createContext(emptyCopilotContext);
|
|
305
336
|
function useCopilotContext() {
|