@copilotkitnext/react 0.0.9-alpha.1 → 0.0.9-alpha.3
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 +9 -9
- package/dist/index.d.ts +9 -9
- package/dist/index.js +72 -21
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +71 -21
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +5 -5
package/dist/index.mjs
CHANGED
|
@@ -941,7 +941,7 @@ var CopilotKitProvider = ({
|
|
|
941
941
|
runtimeUrl,
|
|
942
942
|
headers = {},
|
|
943
943
|
properties = {},
|
|
944
|
-
agents = {},
|
|
944
|
+
agents__unsafe_dev_only: agents = {},
|
|
945
945
|
renderToolCalls,
|
|
946
946
|
frontendTools,
|
|
947
947
|
humanInTheLoop
|
|
@@ -1130,8 +1130,7 @@ function useRenderToolCall() {
|
|
|
1130
1130
|
const renderToolCall = useCallback(
|
|
1131
1131
|
({
|
|
1132
1132
|
toolCall,
|
|
1133
|
-
toolMessage
|
|
1134
|
-
isRunning
|
|
1133
|
+
toolMessage
|
|
1135
1134
|
}) => {
|
|
1136
1135
|
const exactMatches = currentRenderToolCalls.filter(
|
|
1137
1136
|
(rc) => rc.name === toolCall.function.name
|
|
@@ -1165,7 +1164,7 @@ function useRenderToolCall() {
|
|
|
1165
1164
|
},
|
|
1166
1165
|
toolCall.id
|
|
1167
1166
|
);
|
|
1168
|
-
} else
|
|
1167
|
+
} else {
|
|
1169
1168
|
return /* @__PURE__ */ jsx8(
|
|
1170
1169
|
RenderComponent,
|
|
1171
1170
|
{
|
|
@@ -1176,17 +1175,6 @@ function useRenderToolCall() {
|
|
|
1176
1175
|
},
|
|
1177
1176
|
toolCall.id
|
|
1178
1177
|
);
|
|
1179
|
-
} else {
|
|
1180
|
-
return /* @__PURE__ */ jsx8(
|
|
1181
|
-
RenderComponent,
|
|
1182
|
-
{
|
|
1183
|
-
name: toolName,
|
|
1184
|
-
args,
|
|
1185
|
-
status: ToolCallStatus.Complete,
|
|
1186
|
-
result: ""
|
|
1187
|
-
},
|
|
1188
|
-
toolCall.id
|
|
1189
|
-
);
|
|
1190
1178
|
}
|
|
1191
1179
|
},
|
|
1192
1180
|
[currentRenderToolCalls, executingToolCallIds, agentId]
|
|
@@ -1383,8 +1371,7 @@ import React7 from "react";
|
|
|
1383
1371
|
import { Fragment as Fragment2, jsx as jsx9 } from "react/jsx-runtime";
|
|
1384
1372
|
function CopilotChatToolCallsView({
|
|
1385
1373
|
message,
|
|
1386
|
-
messages = []
|
|
1387
|
-
isRunning = false
|
|
1374
|
+
messages = []
|
|
1388
1375
|
}) {
|
|
1389
1376
|
const renderToolCall = useRenderToolCall();
|
|
1390
1377
|
if (!message.toolCalls || message.toolCalls.length === 0) {
|
|
@@ -1396,8 +1383,7 @@ function CopilotChatToolCallsView({
|
|
|
1396
1383
|
);
|
|
1397
1384
|
return /* @__PURE__ */ jsx9(React7.Fragment, { children: renderToolCall({
|
|
1398
1385
|
toolCall,
|
|
1399
|
-
toolMessage
|
|
1400
|
-
isRunning
|
|
1386
|
+
toolMessage
|
|
1401
1387
|
}) }, toolCall.id);
|
|
1402
1388
|
}) });
|
|
1403
1389
|
}
|
|
@@ -1496,8 +1482,7 @@ function CopilotChatAssistantMessage({
|
|
|
1496
1482
|
CopilotChatToolCallsView_default,
|
|
1497
1483
|
{
|
|
1498
1484
|
message,
|
|
1499
|
-
messages
|
|
1500
|
-
isRunning
|
|
1485
|
+
messages
|
|
1501
1486
|
}
|
|
1502
1487
|
);
|
|
1503
1488
|
const hasContent = !!(message.content && message.content.trim().length > 0);
|
|
@@ -2410,6 +2395,70 @@ function defineToolCallRender(def) {
|
|
|
2410
2395
|
...def.agentId ? { agentId: def.agentId } : {}
|
|
2411
2396
|
};
|
|
2412
2397
|
}
|
|
2398
|
+
|
|
2399
|
+
// src/components/WildcardToolCallRender.tsx
|
|
2400
|
+
import { useState as useState8 } from "react";
|
|
2401
|
+
import { jsx as jsx15, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
2402
|
+
var WildcardToolCallRender = defineToolCallRender({
|
|
2403
|
+
name: "*",
|
|
2404
|
+
render: ({ args, result, name, status }) => {
|
|
2405
|
+
const [isExpanded, setIsExpanded] = useState8(false);
|
|
2406
|
+
const statusString = String(status);
|
|
2407
|
+
const isActive = statusString === "inProgress" || statusString === "executing";
|
|
2408
|
+
const isComplete = statusString === "complete";
|
|
2409
|
+
const statusStyles = isActive ? "bg-amber-100 text-amber-800 dark:bg-amber-500/15 dark:text-amber-400" : isComplete ? "bg-emerald-100 text-emerald-800 dark:bg-emerald-500/15 dark:text-emerald-400" : "bg-zinc-100 text-zinc-800 dark:bg-zinc-700/40 dark:text-zinc-300";
|
|
2410
|
+
return /* @__PURE__ */ jsx15("div", { className: "mt-2 pb-2", children: /* @__PURE__ */ jsxs8("div", { className: "rounded-xl border border-zinc-200/60 dark:border-zinc-800/60 bg-white/70 dark:bg-zinc-900/50 shadow-sm backdrop-blur p-4", children: [
|
|
2411
|
+
/* @__PURE__ */ jsxs8(
|
|
2412
|
+
"div",
|
|
2413
|
+
{
|
|
2414
|
+
className: "flex items-center justify-between gap-3 cursor-pointer",
|
|
2415
|
+
onClick: () => setIsExpanded(!isExpanded),
|
|
2416
|
+
children: [
|
|
2417
|
+
/* @__PURE__ */ jsxs8("div", { className: "flex items-center gap-2 min-w-0", children: [
|
|
2418
|
+
/* @__PURE__ */ jsx15(
|
|
2419
|
+
"svg",
|
|
2420
|
+
{
|
|
2421
|
+
className: `h-4 w-4 text-zinc-500 dark:text-zinc-400 transition-transform ${isExpanded ? "rotate-90" : ""}`,
|
|
2422
|
+
fill: "none",
|
|
2423
|
+
viewBox: "0 0 24 24",
|
|
2424
|
+
strokeWidth: 2,
|
|
2425
|
+
stroke: "currentColor",
|
|
2426
|
+
children: /* @__PURE__ */ jsx15(
|
|
2427
|
+
"path",
|
|
2428
|
+
{
|
|
2429
|
+
strokeLinecap: "round",
|
|
2430
|
+
strokeLinejoin: "round",
|
|
2431
|
+
d: "M8.25 4.5l7.5 7.5-7.5 7.5"
|
|
2432
|
+
}
|
|
2433
|
+
)
|
|
2434
|
+
}
|
|
2435
|
+
),
|
|
2436
|
+
/* @__PURE__ */ jsx15("span", { className: "inline-block h-2 w-2 rounded-full bg-blue-500" }),
|
|
2437
|
+
/* @__PURE__ */ jsx15("span", { className: "truncate text-sm font-medium text-zinc-900 dark:text-zinc-100", children: name })
|
|
2438
|
+
] }),
|
|
2439
|
+
/* @__PURE__ */ jsx15(
|
|
2440
|
+
"span",
|
|
2441
|
+
{
|
|
2442
|
+
className: `inline-flex items-center rounded-full px-2 py-1 text-xs font-medium ${statusStyles}`,
|
|
2443
|
+
children: String(status)
|
|
2444
|
+
}
|
|
2445
|
+
)
|
|
2446
|
+
]
|
|
2447
|
+
}
|
|
2448
|
+
),
|
|
2449
|
+
isExpanded && /* @__PURE__ */ jsxs8("div", { className: "mt-3 grid gap-4", children: [
|
|
2450
|
+
/* @__PURE__ */ jsxs8("div", { children: [
|
|
2451
|
+
/* @__PURE__ */ jsx15("div", { className: "text-xs uppercase tracking-wide text-zinc-500 dark:text-zinc-400", children: "Arguments" }),
|
|
2452
|
+
/* @__PURE__ */ jsx15("pre", { className: "mt-2 max-h-64 overflow-auto rounded-md bg-zinc-50 dark:bg-zinc-800/60 p-3 text-xs leading-relaxed text-zinc-800 dark:text-zinc-200 whitespace-pre-wrap break-words", children: JSON.stringify(args ?? {}, null, 2) })
|
|
2453
|
+
] }),
|
|
2454
|
+
result !== void 0 && /* @__PURE__ */ jsxs8("div", { children: [
|
|
2455
|
+
/* @__PURE__ */ jsx15("div", { className: "text-xs uppercase tracking-wide text-zinc-500 dark:text-zinc-400", children: "Result" }),
|
|
2456
|
+
/* @__PURE__ */ jsx15("pre", { className: "mt-2 max-h-64 overflow-auto rounded-md bg-zinc-50 dark:bg-zinc-800/60 p-3 text-xs leading-relaxed text-zinc-800 dark:text-zinc-200 whitespace-pre-wrap break-words", children: typeof result === "string" ? result : JSON.stringify(result, null, 2) })
|
|
2457
|
+
] })
|
|
2458
|
+
] })
|
|
2459
|
+
] }) });
|
|
2460
|
+
}
|
|
2461
|
+
});
|
|
2413
2462
|
export {
|
|
2414
2463
|
AudioRecorderError,
|
|
2415
2464
|
CopilotChat,
|
|
@@ -2422,6 +2471,7 @@ export {
|
|
|
2422
2471
|
CopilotChatUserMessage_default as CopilotChatUserMessage,
|
|
2423
2472
|
CopilotChatView_default as CopilotChatView,
|
|
2424
2473
|
CopilotKitProvider,
|
|
2474
|
+
WildcardToolCallRender,
|
|
2425
2475
|
defineToolCallRender,
|
|
2426
2476
|
useAgent,
|
|
2427
2477
|
useAgentContext,
|