@copilotkitnext/react 0.0.9-alpha.2 → 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 CHANGED
@@ -2,8 +2,8 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import * as React$1 from 'react';
3
3
  import React__default, { ReactNode } from 'react';
4
4
  import { AssistantMessage, Message, UserMessage, ToolCall, ToolMessage } from '@ag-ui/core';
5
- import { ToolCallStatus, FrontendTool, CopilotKitCore } from '@copilotkitnext/core';
6
5
  import { z } from 'zod';
6
+ import { ToolCallStatus, FrontendTool, CopilotKitCore } from '@copilotkitnext/core';
7
7
  import { AbstractAgent, Context } from '@ag-ui/client';
8
8
 
9
9
  declare const CopilotChatDefaultLabels: {
@@ -261,6 +261,8 @@ type CopilotChatProps = Omit<CopilotChatViewProps, "messages"> & {
261
261
  };
262
262
  declare function CopilotChat({ agentId, threadId, ...props }: CopilotChatProps): react_jsx_runtime.JSX.Element;
263
263
 
264
+ declare const WildcardToolCallRender: ReactToolCallRender<any>;
265
+
264
266
  interface UseRenderToolCallProps {
265
267
  toolCall: ToolCall;
266
268
  toolMessage?: ToolMessage;
@@ -358,7 +360,7 @@ interface CopilotKitProviderProps {
358
360
  runtimeUrl?: string;
359
361
  headers?: Record<string, string>;
360
362
  properties?: Record<string, unknown>;
361
- agents?: Record<string, AbstractAgent>;
363
+ agents__unsafe_dev_only?: Record<string, AbstractAgent>;
362
364
  renderToolCalls?: ReactToolCallRender<any>[];
363
365
  frontendTools?: ReactFrontendTool[];
364
366
  humanInTheLoop?: ReactHumanInTheLoop[];
@@ -401,4 +403,4 @@ declare function defineToolCallRender<S extends z.ZodTypeAny>(def: {
401
403
  agentId?: string;
402
404
  }): ReactToolCallRender<z.infer<S>>;
403
405
 
404
- export { AudioRecorderError, type AudioRecorderState, CopilotChat, CopilotChatAssistantMessage, type CopilotChatAssistantMessageProps, CopilotChatAudioRecorder, CopilotChatConfigurationProvider, type CopilotChatConfigurationProviderProps, type CopilotChatConfigurationValue, CopilotChatInput, type CopilotChatInputProps, type CopilotChatLabels, CopilotChatMessageView, type CopilotChatMessageViewProps, type CopilotChatProps, CopilotChatToolCallsView, type CopilotChatToolCallsViewProps, CopilotChatUserMessage, type CopilotChatUserMessageProps, CopilotChatView, type CopilotChatViewProps, type CopilotKitContextValue, CopilotKitProvider, type CopilotKitProviderProps, type ReactFrontendTool, type ReactHumanInTheLoop, type ReactToolCallRender, type ToolsMenuItem, defineToolCallRender, useAgent, useAgentContext, useCopilotChatConfiguration, useCopilotKit, useFrontendTool, useHumanInTheLoop, useRenderToolCall };
406
+ export { AudioRecorderError, type AudioRecorderState, CopilotChat, CopilotChatAssistantMessage, type CopilotChatAssistantMessageProps, CopilotChatAudioRecorder, CopilotChatConfigurationProvider, type CopilotChatConfigurationProviderProps, type CopilotChatConfigurationValue, CopilotChatInput, type CopilotChatInputProps, type CopilotChatLabels, CopilotChatMessageView, type CopilotChatMessageViewProps, type CopilotChatProps, CopilotChatToolCallsView, type CopilotChatToolCallsViewProps, CopilotChatUserMessage, type CopilotChatUserMessageProps, CopilotChatView, type CopilotChatViewProps, type CopilotKitContextValue, CopilotKitProvider, type CopilotKitProviderProps, type ReactFrontendTool, type ReactHumanInTheLoop, type ReactToolCallRender, type ToolsMenuItem, WildcardToolCallRender, defineToolCallRender, useAgent, useAgentContext, useCopilotChatConfiguration, useCopilotKit, useFrontendTool, useHumanInTheLoop, useRenderToolCall };
package/dist/index.d.ts CHANGED
@@ -2,8 +2,8 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import * as React$1 from 'react';
3
3
  import React__default, { ReactNode } from 'react';
4
4
  import { AssistantMessage, Message, UserMessage, ToolCall, ToolMessage } from '@ag-ui/core';
5
- import { ToolCallStatus, FrontendTool, CopilotKitCore } from '@copilotkitnext/core';
6
5
  import { z } from 'zod';
6
+ import { ToolCallStatus, FrontendTool, CopilotKitCore } from '@copilotkitnext/core';
7
7
  import { AbstractAgent, Context } from '@ag-ui/client';
8
8
 
9
9
  declare const CopilotChatDefaultLabels: {
@@ -261,6 +261,8 @@ type CopilotChatProps = Omit<CopilotChatViewProps, "messages"> & {
261
261
  };
262
262
  declare function CopilotChat({ agentId, threadId, ...props }: CopilotChatProps): react_jsx_runtime.JSX.Element;
263
263
 
264
+ declare const WildcardToolCallRender: ReactToolCallRender<any>;
265
+
264
266
  interface UseRenderToolCallProps {
265
267
  toolCall: ToolCall;
266
268
  toolMessage?: ToolMessage;
@@ -358,7 +360,7 @@ interface CopilotKitProviderProps {
358
360
  runtimeUrl?: string;
359
361
  headers?: Record<string, string>;
360
362
  properties?: Record<string, unknown>;
361
- agents?: Record<string, AbstractAgent>;
363
+ agents__unsafe_dev_only?: Record<string, AbstractAgent>;
362
364
  renderToolCalls?: ReactToolCallRender<any>[];
363
365
  frontendTools?: ReactFrontendTool[];
364
366
  humanInTheLoop?: ReactHumanInTheLoop[];
@@ -401,4 +403,4 @@ declare function defineToolCallRender<S extends z.ZodTypeAny>(def: {
401
403
  agentId?: string;
402
404
  }): ReactToolCallRender<z.infer<S>>;
403
405
 
404
- export { AudioRecorderError, type AudioRecorderState, CopilotChat, CopilotChatAssistantMessage, type CopilotChatAssistantMessageProps, CopilotChatAudioRecorder, CopilotChatConfigurationProvider, type CopilotChatConfigurationProviderProps, type CopilotChatConfigurationValue, CopilotChatInput, type CopilotChatInputProps, type CopilotChatLabels, CopilotChatMessageView, type CopilotChatMessageViewProps, type CopilotChatProps, CopilotChatToolCallsView, type CopilotChatToolCallsViewProps, CopilotChatUserMessage, type CopilotChatUserMessageProps, CopilotChatView, type CopilotChatViewProps, type CopilotKitContextValue, CopilotKitProvider, type CopilotKitProviderProps, type ReactFrontendTool, type ReactHumanInTheLoop, type ReactToolCallRender, type ToolsMenuItem, defineToolCallRender, useAgent, useAgentContext, useCopilotChatConfiguration, useCopilotKit, useFrontendTool, useHumanInTheLoop, useRenderToolCall };
406
+ export { AudioRecorderError, type AudioRecorderState, CopilotChat, CopilotChatAssistantMessage, type CopilotChatAssistantMessageProps, CopilotChatAudioRecorder, CopilotChatConfigurationProvider, type CopilotChatConfigurationProviderProps, type CopilotChatConfigurationValue, CopilotChatInput, type CopilotChatInputProps, type CopilotChatLabels, CopilotChatMessageView, type CopilotChatMessageViewProps, type CopilotChatProps, CopilotChatToolCallsView, type CopilotChatToolCallsViewProps, CopilotChatUserMessage, type CopilotChatUserMessageProps, CopilotChatView, type CopilotChatViewProps, type CopilotKitContextValue, CopilotKitProvider, type CopilotKitProviderProps, type ReactFrontendTool, type ReactHumanInTheLoop, type ReactToolCallRender, type ToolsMenuItem, WildcardToolCallRender, defineToolCallRender, useAgent, useAgentContext, useCopilotChatConfiguration, useCopilotKit, useFrontendTool, useHumanInTheLoop, useRenderToolCall };
package/dist/index.js CHANGED
@@ -41,6 +41,7 @@ __export(index_exports, {
41
41
  CopilotChatUserMessage: () => CopilotChatUserMessage_default,
42
42
  CopilotChatView: () => CopilotChatView_default,
43
43
  CopilotKitProvider: () => CopilotKitProvider,
44
+ WildcardToolCallRender: () => WildcardToolCallRender,
44
45
  defineToolCallRender: () => defineToolCallRender,
45
46
  useAgent: () => useAgent,
46
47
  useAgentContext: () => useAgentContext,
@@ -972,7 +973,7 @@ var CopilotKitProvider = ({
972
973
  runtimeUrl,
973
974
  headers = {},
974
975
  properties = {},
975
- agents = {},
976
+ agents__unsafe_dev_only: agents = {},
976
977
  renderToolCalls,
977
978
  frontendTools,
978
979
  humanInTheLoop
@@ -2426,6 +2427,70 @@ function defineToolCallRender(def) {
2426
2427
  ...def.agentId ? { agentId: def.agentId } : {}
2427
2428
  };
2428
2429
  }
2430
+
2431
+ // src/components/WildcardToolCallRender.tsx
2432
+ var import_react17 = require("react");
2433
+ var import_jsx_runtime15 = require("react/jsx-runtime");
2434
+ var WildcardToolCallRender = defineToolCallRender({
2435
+ name: "*",
2436
+ render: ({ args, result, name, status }) => {
2437
+ const [isExpanded, setIsExpanded] = (0, import_react17.useState)(false);
2438
+ const statusString = String(status);
2439
+ const isActive = statusString === "inProgress" || statusString === "executing";
2440
+ const isComplete = statusString === "complete";
2441
+ 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";
2442
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "mt-2 pb-2", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("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: [
2443
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
2444
+ "div",
2445
+ {
2446
+ className: "flex items-center justify-between gap-3 cursor-pointer",
2447
+ onClick: () => setIsExpanded(!isExpanded),
2448
+ children: [
2449
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex items-center gap-2 min-w-0", children: [
2450
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
2451
+ "svg",
2452
+ {
2453
+ className: `h-4 w-4 text-zinc-500 dark:text-zinc-400 transition-transform ${isExpanded ? "rotate-90" : ""}`,
2454
+ fill: "none",
2455
+ viewBox: "0 0 24 24",
2456
+ strokeWidth: 2,
2457
+ stroke: "currentColor",
2458
+ children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
2459
+ "path",
2460
+ {
2461
+ strokeLinecap: "round",
2462
+ strokeLinejoin: "round",
2463
+ d: "M8.25 4.5l7.5 7.5-7.5 7.5"
2464
+ }
2465
+ )
2466
+ }
2467
+ ),
2468
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "inline-block h-2 w-2 rounded-full bg-blue-500" }),
2469
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "truncate text-sm font-medium text-zinc-900 dark:text-zinc-100", children: name })
2470
+ ] }),
2471
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
2472
+ "span",
2473
+ {
2474
+ className: `inline-flex items-center rounded-full px-2 py-1 text-xs font-medium ${statusStyles}`,
2475
+ children: String(status)
2476
+ }
2477
+ )
2478
+ ]
2479
+ }
2480
+ ),
2481
+ isExpanded && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "mt-3 grid gap-4", children: [
2482
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { children: [
2483
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "text-xs uppercase tracking-wide text-zinc-500 dark:text-zinc-400", children: "Arguments" }),
2484
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("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) })
2485
+ ] }),
2486
+ result !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { children: [
2487
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "text-xs uppercase tracking-wide text-zinc-500 dark:text-zinc-400", children: "Result" }),
2488
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("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) })
2489
+ ] })
2490
+ ] })
2491
+ ] }) });
2492
+ }
2493
+ });
2429
2494
  // Annotate the CommonJS export names for ESM import in node:
2430
2495
  0 && (module.exports = {
2431
2496
  AudioRecorderError,
@@ -2439,6 +2504,7 @@ function defineToolCallRender(def) {
2439
2504
  CopilotChatUserMessage,
2440
2505
  CopilotChatView,
2441
2506
  CopilotKitProvider,
2507
+ WildcardToolCallRender,
2442
2508
  defineToolCallRender,
2443
2509
  useAgent,
2444
2510
  useAgentContext,