@copilotkit/react-core 1.5.0 → 1.5.1-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 +10 -0
- package/dist/{chunk-5FYKUKG3.mjs → chunk-6KHA5W5R.mjs} +2 -2
- package/dist/{chunk-QTDCEDOC.mjs → chunk-M3SYKJ3W.mjs} +3 -2
- package/dist/chunk-M3SYKJ3W.mjs.map +1 -0
- package/dist/{chunk-EUU6NNYU.mjs → chunk-MKEQ2MJG.mjs} +2 -2
- package/dist/{chunk-QX6V774L.mjs → chunk-NYBGR2NK.mjs} +10 -7
- package/dist/chunk-NYBGR2NK.mjs.map +1 -0
- package/dist/{chunk-BT6WK2JZ.mjs → chunk-OAF4ASJH.mjs} +6 -4
- package/dist/chunk-OAF4ASJH.mjs.map +1 -0
- package/dist/{chunk-35EN6BG4.mjs → chunk-ODAH4HNG.mjs} +2 -2
- package/dist/{chunk-TQN3EZWQ.mjs → chunk-STZUYPHJ.mjs} +2 -1
- package/dist/chunk-STZUYPHJ.mjs.map +1 -0
- package/dist/{chunk-V3PFWGIY.mjs → chunk-VPTC36RZ.mjs} +2 -2
- package/dist/{chunk-42N5VKIX.mjs → chunk-VQDGBYWQ.mjs} +3 -3
- package/dist/{chunk-VMP6JWBB.mjs → chunk-YL6V3QTN.mjs} +7 -5
- package/dist/chunk-YL6V3QTN.mjs.map +1 -0
- package/dist/components/copilot-provider/copilot-messages.d.ts +1 -0
- package/dist/components/copilot-provider/copilotkit-props.d.ts +5 -0
- package/dist/components/copilot-provider/copilotkit-props.js.map +1 -1
- package/dist/components/copilot-provider/copilotkit.d.ts +1 -0
- package/dist/components/copilot-provider/copilotkit.js +2 -0
- package/dist/components/copilot-provider/copilotkit.js.map +1 -1
- package/dist/components/copilot-provider/copilotkit.mjs +2 -2
- package/dist/components/copilot-provider/index.d.ts +1 -0
- package/dist/components/copilot-provider/index.js +2 -0
- package/dist/components/copilot-provider/index.js.map +1 -1
- package/dist/components/copilot-provider/index.mjs +2 -2
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +2 -0
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +2 -2
- package/dist/context/copilot-context.d.ts +5 -1
- package/dist/context/copilot-context.js +1 -0
- package/dist/context/copilot-context.js.map +1 -1
- package/dist/context/copilot-context.mjs +1 -1
- package/dist/context/index.js +1 -0
- package/dist/context/index.js.map +1 -1
- package/dist/context/index.mjs +1 -1
- package/dist/hooks/index.js +5 -1
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/index.mjs +9 -9
- package/dist/hooks/use-chat.d.ts +5 -1
- package/dist/hooks/use-chat.js +2 -1
- package/dist/hooks/use-chat.js.map +1 -1
- package/dist/hooks/use-chat.mjs +1 -1
- package/dist/hooks/use-coagent-state-render.js +1 -0
- 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.js +5 -1
- package/dist/hooks/use-coagent.js.map +1 -1
- package/dist/hooks/use-coagent.mjs +5 -5
- package/dist/hooks/use-copilot-action.js +1 -0
- package/dist/hooks/use-copilot-action.js.map +1 -1
- package/dist/hooks/use-copilot-action.mjs +2 -2
- package/dist/hooks/use-copilot-chat.js +5 -1
- package/dist/hooks/use-copilot-chat.js.map +1 -1
- package/dist/hooks/use-copilot-chat.mjs +4 -4
- package/dist/hooks/use-copilot-readable.js +1 -0
- package/dist/hooks/use-copilot-readable.js.map +1 -1
- package/dist/hooks/use-copilot-readable.mjs +2 -2
- package/dist/hooks/use-make-copilot-document-readable.js +1 -0
- 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 +15 -8
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +10 -10
- package/dist/lib/copilot-task.d.ts +6 -1
- package/dist/lib/copilot-task.js +22 -4
- package/dist/lib/copilot-task.js.map +1 -1
- package/dist/lib/copilot-task.mjs +3 -3
- package/dist/lib/index.d.ts +1 -1
- package/dist/lib/index.js +22 -4
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/index.mjs +3 -3
- package/dist/utils/extract.d.ts +3 -2
- package/dist/utils/extract.js +21 -3
- package/dist/utils/extract.js.map +1 -1
- package/dist/utils/extract.mjs +2 -2
- package/dist/utils/index.js +21 -3
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/index.mjs +2 -2
- package/package.json +3 -3
- package/src/components/copilot-provider/copilotkit-props.tsx +6 -0
- package/src/components/copilot-provider/copilotkit.tsx +1 -0
- package/src/context/copilot-context.tsx +7 -6
- package/src/hooks/use-chat.ts +13 -0
- package/src/hooks/use-copilot-chat.ts +2 -0
- package/src/lib/copilot-task.ts +10 -1
- package/src/utils/extract.ts +4 -0
- package/dist/chunk-BT6WK2JZ.mjs.map +0 -1
- package/dist/chunk-QTDCEDOC.mjs.map +0 -1
- package/dist/chunk-QX6V774L.mjs.map +0 -1
- package/dist/chunk-TQN3EZWQ.mjs.map +0 -1
- package/dist/chunk-VMP6JWBB.mjs.map +0 -1
- /package/dist/{chunk-5FYKUKG3.mjs.map → chunk-6KHA5W5R.mjs.map} +0 -0
- /package/dist/{chunk-EUU6NNYU.mjs.map → chunk-MKEQ2MJG.mjs.map} +0 -0
- /package/dist/{chunk-35EN6BG4.mjs.map → chunk-ODAH4HNG.mjs.map} +0 -0
- /package/dist/{chunk-V3PFWGIY.mjs.map → chunk-VPTC36RZ.mjs.map} +0 -0
- /package/dist/{chunk-42N5VKIX.mjs.map → chunk-VQDGBYWQ.mjs.map} +0 -0
package/dist/index.d.ts
CHANGED
|
@@ -18,9 +18,9 @@ export { CopilotTask, CopilotTaskConfig } from './lib/copilot-task.js';
|
|
|
18
18
|
export { extract } from './utils/extract.js';
|
|
19
19
|
export { shouldShowDevConsole } from './utils/dev-console.js';
|
|
20
20
|
import 'react/jsx-runtime';
|
|
21
|
+
import '@copilotkit/runtime-client-gql';
|
|
21
22
|
import 'react';
|
|
22
23
|
import '@copilotkit/shared';
|
|
23
24
|
import './hooks/use-tree.js';
|
|
24
25
|
import './types/coagent-action.js';
|
|
25
26
|
import './types/coagent-state.js';
|
|
26
|
-
import '@copilotkit/runtime-client-gql';
|
package/dist/index.js
CHANGED
|
@@ -161,6 +161,7 @@ var emptyCopilotContext = {
|
|
|
161
161
|
agentSession: null,
|
|
162
162
|
setAgentSession: () => {
|
|
163
163
|
},
|
|
164
|
+
forwardedParameters: {},
|
|
164
165
|
agentLock: null,
|
|
165
166
|
threadId: null,
|
|
166
167
|
setThreadId: () => {
|
|
@@ -708,7 +709,8 @@ function extract(_0) {
|
|
|
708
709
|
data,
|
|
709
710
|
abortSignal,
|
|
710
711
|
stream,
|
|
711
|
-
requestType = import_runtime_client_gql2.CopilotRequestType.Task
|
|
712
|
+
requestType = import_runtime_client_gql2.CopilotRequestType.Task,
|
|
713
|
+
forwardedParameters
|
|
712
714
|
}) {
|
|
713
715
|
var _a, _b;
|
|
714
716
|
const { messages } = context;
|
|
@@ -755,10 +757,10 @@ function extract(_0) {
|
|
|
755
757
|
metadata: {
|
|
756
758
|
requestType
|
|
757
759
|
},
|
|
758
|
-
forwardedParameters: {
|
|
760
|
+
forwardedParameters: __spreadProps(__spreadValues({}, forwardedParameters != null ? forwardedParameters : {}), {
|
|
759
761
|
toolChoice: "function",
|
|
760
762
|
toolChoiceFunctionName: action.name
|
|
761
|
-
}
|
|
763
|
+
})
|
|
762
764
|
},
|
|
763
765
|
properties: context.copilotApiConfig.properties,
|
|
764
766
|
signal: abortSignal
|
|
@@ -1093,6 +1095,7 @@ ${nonDocumentStrings}`;
|
|
|
1093
1095
|
agentSession,
|
|
1094
1096
|
setAgentSession,
|
|
1095
1097
|
runtimeClient,
|
|
1098
|
+
forwardedParameters: props.forwardedParameters || {},
|
|
1096
1099
|
agentLock: props.agent || null,
|
|
1097
1100
|
threadId,
|
|
1098
1101
|
setThreadId,
|
|
@@ -1248,7 +1251,8 @@ function useChat(options) {
|
|
|
1248
1251
|
agentStates: Object.values(coagentStatesRef.current).map((state) => ({
|
|
1249
1252
|
agentName: state.name,
|
|
1250
1253
|
state: JSON.stringify(state.state)
|
|
1251
|
-
}))
|
|
1254
|
+
})),
|
|
1255
|
+
forwardedParameters: options.forwardedParameters || {}
|
|
1252
1256
|
}),
|
|
1253
1257
|
properties: copilotConfig.properties,
|
|
1254
1258
|
signal: (_d = chatAbortControllerRef.current) == null ? void 0 : _d.signal
|
|
@@ -1540,6 +1544,7 @@ function useCopilotChat(_a = {}) {
|
|
|
1540
1544
|
coAgentStateRenders,
|
|
1541
1545
|
agentSession,
|
|
1542
1546
|
setAgentSession,
|
|
1547
|
+
forwardedParameters,
|
|
1543
1548
|
agentLock,
|
|
1544
1549
|
threadId,
|
|
1545
1550
|
setThreadId,
|
|
@@ -1596,6 +1601,7 @@ function useCopilotChat(_a = {}) {
|
|
|
1596
1601
|
setCoagentStatesWithRef,
|
|
1597
1602
|
agentSession,
|
|
1598
1603
|
setAgentSession,
|
|
1604
|
+
forwardedParameters,
|
|
1599
1605
|
threadId,
|
|
1600
1606
|
setThreadId,
|
|
1601
1607
|
runId,
|
|
@@ -2004,6 +2010,7 @@ var CopilotTask = class {
|
|
|
2004
2010
|
this.actions = config.actions || [];
|
|
2005
2011
|
this.includeCopilotReadable = config.includeCopilotReadable !== false;
|
|
2006
2012
|
this.includeCopilotActions = config.includeCopilotActions !== false;
|
|
2013
|
+
this.forwardedParameters = config.forwardedParameters;
|
|
2007
2014
|
}
|
|
2008
2015
|
/**
|
|
2009
2016
|
* Run the task.
|
|
@@ -2012,7 +2019,7 @@ var CopilotTask = class {
|
|
|
2012
2019
|
*/
|
|
2013
2020
|
run(context, data) {
|
|
2014
2021
|
return __async(this, null, function* () {
|
|
2015
|
-
var _a, _b;
|
|
2022
|
+
var _a, _b, _c;
|
|
2016
2023
|
const actions = this.includeCopilotActions ? Object.assign({}, context.actions) : {};
|
|
2017
2024
|
for (const fn of this.actions) {
|
|
2018
2025
|
actions[fn.name] = fn;
|
|
@@ -2045,15 +2052,15 @@ var CopilotTask = class {
|
|
|
2045
2052
|
metadata: {
|
|
2046
2053
|
requestType: import_runtime_client_gql7.CopilotRequestType.Task
|
|
2047
2054
|
},
|
|
2048
|
-
forwardedParameters: {
|
|
2055
|
+
forwardedParameters: __spreadProps(__spreadValues({}, (_a = this.forwardedParameters) != null ? _a : {}), {
|
|
2049
2056
|
toolChoice: "required"
|
|
2050
|
-
}
|
|
2057
|
+
})
|
|
2051
2058
|
},
|
|
2052
2059
|
properties: context.copilotApiConfig.properties
|
|
2053
2060
|
}).toPromise();
|
|
2054
2061
|
const functionCallHandler = context.getFunctionCallHandler(actions);
|
|
2055
2062
|
const functionCalls = (0, import_runtime_client_gql7.convertGqlOutputToMessages)(
|
|
2056
|
-
((
|
|
2063
|
+
((_c = (_b = response.data) == null ? void 0 : _b.generateCopilotResponse) == null ? void 0 : _c.messages) || []
|
|
2057
2064
|
).filter((m) => m.isActionExecutionMessage());
|
|
2058
2065
|
for (const functionCall of functionCalls) {
|
|
2059
2066
|
yield functionCallHandler({
|