@copilotkitnext/react 0.0.9-alpha.1 → 0.0.9-alpha.2
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/dist/index.d.mts +4 -6
- package/dist/index.d.ts +4 -6
- package/dist/index.js +5 -20
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +5 -20
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.d.mts
CHANGED
|
@@ -118,9 +118,8 @@ declare namespace CopilotChatInput {
|
|
|
118
118
|
type CopilotChatToolCallsViewProps = {
|
|
119
119
|
message: AssistantMessage;
|
|
120
120
|
messages?: Message[];
|
|
121
|
-
isRunning?: boolean;
|
|
122
121
|
};
|
|
123
|
-
declare function CopilotChatToolCallsView({ message, messages,
|
|
122
|
+
declare function CopilotChatToolCallsView({ message, messages, }: CopilotChatToolCallsViewProps): react_jsx_runtime.JSX.Element | null;
|
|
124
123
|
|
|
125
124
|
type CopilotChatAssistantMessageProps = WithSlots<{
|
|
126
125
|
markdownRenderer: typeof CopilotChatAssistantMessage.MarkdownRenderer;
|
|
@@ -265,7 +264,6 @@ declare function CopilotChat({ agentId, threadId, ...props }: CopilotChatProps):
|
|
|
265
264
|
interface UseRenderToolCallProps {
|
|
266
265
|
toolCall: ToolCall;
|
|
267
266
|
toolMessage?: ToolMessage;
|
|
268
|
-
isRunning: boolean;
|
|
269
267
|
}
|
|
270
268
|
/**
|
|
271
269
|
* Hook that returns a function to render tool calls based on the render functions
|
|
@@ -273,7 +271,7 @@ interface UseRenderToolCallProps {
|
|
|
273
271
|
*
|
|
274
272
|
* @returns A function that takes a tool call and optional tool message and returns the rendered component
|
|
275
273
|
*/
|
|
276
|
-
declare function useRenderToolCall(): ({ toolCall, toolMessage,
|
|
274
|
+
declare function useRenderToolCall(): ({ toolCall, toolMessage, }: UseRenderToolCallProps) => React__default.ReactElement | null;
|
|
277
275
|
|
|
278
276
|
interface ReactToolCallRender<T> {
|
|
279
277
|
name: string;
|
|
@@ -351,7 +349,7 @@ declare function useAgentContext(context: Context): void;
|
|
|
351
349
|
|
|
352
350
|
interface CopilotKitContextValue {
|
|
353
351
|
copilotkit: CopilotKitCore;
|
|
354
|
-
renderToolCalls: ReactToolCallRender<
|
|
352
|
+
renderToolCalls: ReactToolCallRender<any>[];
|
|
355
353
|
currentRenderToolCalls: ReactToolCallRender<unknown>[];
|
|
356
354
|
setCurrentRenderToolCalls: React__default.Dispatch<React__default.SetStateAction<ReactToolCallRender<unknown>[]>>;
|
|
357
355
|
}
|
|
@@ -361,7 +359,7 @@ interface CopilotKitProviderProps {
|
|
|
361
359
|
headers?: Record<string, string>;
|
|
362
360
|
properties?: Record<string, unknown>;
|
|
363
361
|
agents?: Record<string, AbstractAgent>;
|
|
364
|
-
renderToolCalls?: ReactToolCallRender<
|
|
362
|
+
renderToolCalls?: ReactToolCallRender<any>[];
|
|
365
363
|
frontendTools?: ReactFrontendTool[];
|
|
366
364
|
humanInTheLoop?: ReactHumanInTheLoop[];
|
|
367
365
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -118,9 +118,8 @@ declare namespace CopilotChatInput {
|
|
|
118
118
|
type CopilotChatToolCallsViewProps = {
|
|
119
119
|
message: AssistantMessage;
|
|
120
120
|
messages?: Message[];
|
|
121
|
-
isRunning?: boolean;
|
|
122
121
|
};
|
|
123
|
-
declare function CopilotChatToolCallsView({ message, messages,
|
|
122
|
+
declare function CopilotChatToolCallsView({ message, messages, }: CopilotChatToolCallsViewProps): react_jsx_runtime.JSX.Element | null;
|
|
124
123
|
|
|
125
124
|
type CopilotChatAssistantMessageProps = WithSlots<{
|
|
126
125
|
markdownRenderer: typeof CopilotChatAssistantMessage.MarkdownRenderer;
|
|
@@ -265,7 +264,6 @@ declare function CopilotChat({ agentId, threadId, ...props }: CopilotChatProps):
|
|
|
265
264
|
interface UseRenderToolCallProps {
|
|
266
265
|
toolCall: ToolCall;
|
|
267
266
|
toolMessage?: ToolMessage;
|
|
268
|
-
isRunning: boolean;
|
|
269
267
|
}
|
|
270
268
|
/**
|
|
271
269
|
* Hook that returns a function to render tool calls based on the render functions
|
|
@@ -273,7 +271,7 @@ interface UseRenderToolCallProps {
|
|
|
273
271
|
*
|
|
274
272
|
* @returns A function that takes a tool call and optional tool message and returns the rendered component
|
|
275
273
|
*/
|
|
276
|
-
declare function useRenderToolCall(): ({ toolCall, toolMessage,
|
|
274
|
+
declare function useRenderToolCall(): ({ toolCall, toolMessage, }: UseRenderToolCallProps) => React__default.ReactElement | null;
|
|
277
275
|
|
|
278
276
|
interface ReactToolCallRender<T> {
|
|
279
277
|
name: string;
|
|
@@ -351,7 +349,7 @@ declare function useAgentContext(context: Context): void;
|
|
|
351
349
|
|
|
352
350
|
interface CopilotKitContextValue {
|
|
353
351
|
copilotkit: CopilotKitCore;
|
|
354
|
-
renderToolCalls: ReactToolCallRender<
|
|
352
|
+
renderToolCalls: ReactToolCallRender<any>[];
|
|
355
353
|
currentRenderToolCalls: ReactToolCallRender<unknown>[];
|
|
356
354
|
setCurrentRenderToolCalls: React__default.Dispatch<React__default.SetStateAction<ReactToolCallRender<unknown>[]>>;
|
|
357
355
|
}
|
|
@@ -361,7 +359,7 @@ interface CopilotKitProviderProps {
|
|
|
361
359
|
headers?: Record<string, string>;
|
|
362
360
|
properties?: Record<string, unknown>;
|
|
363
361
|
agents?: Record<string, AbstractAgent>;
|
|
364
|
-
renderToolCalls?: ReactToolCallRender<
|
|
362
|
+
renderToolCalls?: ReactToolCallRender<any>[];
|
|
365
363
|
frontendTools?: ReactFrontendTool[];
|
|
366
364
|
humanInTheLoop?: ReactHumanInTheLoop[];
|
|
367
365
|
}
|
package/dist/index.js
CHANGED
|
@@ -1161,8 +1161,7 @@ function useRenderToolCall() {
|
|
|
1161
1161
|
const renderToolCall = (0, import_react6.useCallback)(
|
|
1162
1162
|
({
|
|
1163
1163
|
toolCall,
|
|
1164
|
-
toolMessage
|
|
1165
|
-
isRunning
|
|
1164
|
+
toolMessage
|
|
1166
1165
|
}) => {
|
|
1167
1166
|
const exactMatches = currentRenderToolCalls.filter(
|
|
1168
1167
|
(rc) => rc.name === toolCall.function.name
|
|
@@ -1196,7 +1195,7 @@ function useRenderToolCall() {
|
|
|
1196
1195
|
},
|
|
1197
1196
|
toolCall.id
|
|
1198
1197
|
);
|
|
1199
|
-
} else
|
|
1198
|
+
} else {
|
|
1200
1199
|
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1201
1200
|
RenderComponent,
|
|
1202
1201
|
{
|
|
@@ -1207,17 +1206,6 @@ function useRenderToolCall() {
|
|
|
1207
1206
|
},
|
|
1208
1207
|
toolCall.id
|
|
1209
1208
|
);
|
|
1210
|
-
} else {
|
|
1211
|
-
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1212
|
-
RenderComponent,
|
|
1213
|
-
{
|
|
1214
|
-
name: toolName,
|
|
1215
|
-
args,
|
|
1216
|
-
status: import_core2.ToolCallStatus.Complete,
|
|
1217
|
-
result: ""
|
|
1218
|
-
},
|
|
1219
|
-
toolCall.id
|
|
1220
|
-
);
|
|
1221
1209
|
}
|
|
1222
1210
|
},
|
|
1223
1211
|
[currentRenderToolCalls, executingToolCallIds, agentId]
|
|
@@ -1414,8 +1402,7 @@ var import_react12 = __toESM(require("react"));
|
|
|
1414
1402
|
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
1415
1403
|
function CopilotChatToolCallsView({
|
|
1416
1404
|
message,
|
|
1417
|
-
messages = []
|
|
1418
|
-
isRunning = false
|
|
1405
|
+
messages = []
|
|
1419
1406
|
}) {
|
|
1420
1407
|
const renderToolCall = useRenderToolCall();
|
|
1421
1408
|
if (!message.toolCalls || message.toolCalls.length === 0) {
|
|
@@ -1427,8 +1414,7 @@ function CopilotChatToolCallsView({
|
|
|
1427
1414
|
);
|
|
1428
1415
|
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react12.default.Fragment, { children: renderToolCall({
|
|
1429
1416
|
toolCall,
|
|
1430
|
-
toolMessage
|
|
1431
|
-
isRunning
|
|
1417
|
+
toolMessage
|
|
1432
1418
|
}) }, toolCall.id);
|
|
1433
1419
|
}) });
|
|
1434
1420
|
}
|
|
@@ -1527,8 +1513,7 @@ function CopilotChatAssistantMessage({
|
|
|
1527
1513
|
CopilotChatToolCallsView_default,
|
|
1528
1514
|
{
|
|
1529
1515
|
message,
|
|
1530
|
-
messages
|
|
1531
|
-
isRunning
|
|
1516
|
+
messages
|
|
1532
1517
|
}
|
|
1533
1518
|
);
|
|
1534
1519
|
const hasContent = !!(message.content && message.content.trim().length > 0);
|