@copilotkit/react-core 1.57.1-canary.1778272612 → 1.57.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.
Files changed (33) hide show
  1. package/dist/{copilotkit-CBbSvze0.d.cts → copilotkit-BK9CVq9A.d.cts} +2 -1
  2. package/dist/{copilotkit-CBbSvze0.d.cts.map → copilotkit-BK9CVq9A.d.cts.map} +1 -1
  3. package/dist/{copilotkit-3XTEoVQO.mjs → copilotkit-CC8DjOiC.mjs} +3 -2
  4. package/dist/copilotkit-CC8DjOiC.mjs.map +1 -0
  5. package/dist/{copilotkit-Dnj9pi4m.cjs → copilotkit-CtXcs1ea.cjs} +3 -2
  6. package/dist/copilotkit-CtXcs1ea.cjs.map +1 -0
  7. package/dist/{copilotkit-BCJ2yvV6.d.mts → copilotkit-WlmeVijs.d.mts} +2 -1
  8. package/dist/{copilotkit-BCJ2yvV6.d.mts.map → copilotkit-WlmeVijs.d.mts.map} +1 -1
  9. package/dist/index.cjs +1 -1
  10. package/dist/index.d.cts +1 -1
  11. package/dist/index.d.mts +1 -1
  12. package/dist/index.mjs +1 -1
  13. package/dist/v2/headless.cjs +110 -3
  14. package/dist/v2/headless.cjs.map +1 -1
  15. package/dist/v2/headless.d.cts +142 -2
  16. package/dist/v2/headless.d.cts.map +1 -1
  17. package/dist/v2/headless.d.mts +142 -1
  18. package/dist/v2/headless.d.mts.map +1 -1
  19. package/dist/v2/headless.mjs +108 -4
  20. package/dist/v2/headless.mjs.map +1 -1
  21. package/dist/v2/index.cjs +1 -1
  22. package/dist/v2/index.d.cts +1 -1
  23. package/dist/v2/index.d.mts +1 -1
  24. package/dist/v2/index.mjs +1 -1
  25. package/dist/v2/index.umd.js +2 -1
  26. package/dist/v2/index.umd.js.map +1 -1
  27. package/package.json +6 -6
  28. package/src/v2/components/chat/__tests__/CopilotChatPerf.e2e.test.tsx +28 -0
  29. package/src/v2/headless.ts +23 -1
  30. package/src/v2/hooks/__tests__/use-component.test.tsx +4 -1
  31. package/src/v2/hooks/use-component.tsx +2 -0
  32. package/dist/copilotkit-3XTEoVQO.mjs.map +0 -1
  33. package/dist/copilotkit-Dnj9pi4m.cjs.map +0 -1
@@ -3,6 +3,7 @@ import { InferSchemaOutput, StandardSchemaV1 } from "@copilotkit/shared";
3
3
  import { AbstractAgent } from "@ag-ui/client";
4
4
  import { DynamicSuggestionsConfig, FrontendTool, StaticSuggestionsConfig, Suggestion, ToolCallStatus } from "@copilotkit/core";
5
5
  import { CopilotKitCoreReact, CopilotKitCoreReactConfig } from "./context";
6
+ import { AgentCapabilities } from "@ag-ui/core";
6
7
 
7
8
  //#region src/v2/providers/CopilotChatConfigurationProvider.d.ts
8
9
  declare const CopilotChatDefaultLabels: {
@@ -184,6 +185,7 @@ declare function useComponent<TSchema extends StandardSchemaV1 | undefined = und
184
185
  parameters?: TSchema;
185
186
  render: ComponentType<NoInfer<InferRenderProps<TSchema>>>;
186
187
  agentId?: string;
188
+ followUp?: boolean;
187
189
  }, deps?: ReadonlyArray<unknown>): void;
188
190
  //#endregion
189
191
  //#region src/v2/types/human-in-the-loop.d.ts
@@ -508,5 +510,144 @@ declare function useThreads({
508
510
  limit
509
511
  }: UseThreadsInput): UseThreadsResult;
510
512
  //#endregion
511
- export { type AgentContextInput, CopilotChatConfigurationProvider, type CopilotChatConfigurationProviderProps, type CopilotChatConfigurationValue, CopilotChatDefaultLabels, type CopilotChatLabels, CopilotKitCoreReact, type CopilotKitCoreReactConfig, type JsonSerializable, type Thread, type UseAgentUpdate, type UseInterruptConfig, type UseThreadsInput, type UseThreadsResult, useAgent, useAgentContext, useComponent, useConfigureSuggestions, useCopilotChatConfiguration, useFrontendTool, useHumanInTheLoop, useInterrupt, useSuggestions, useThreads };
513
+ //#region src/v2/hooks/use-render-tool.d.ts
514
+ interface RenderToolInProgressProps<S extends StandardSchemaV1> {
515
+ name: string;
516
+ toolCallId: string;
517
+ parameters: Partial<InferSchemaOutput<S>>;
518
+ status: "inProgress";
519
+ result: undefined;
520
+ }
521
+ interface RenderToolExecutingProps<S extends StandardSchemaV1> {
522
+ name: string;
523
+ toolCallId: string;
524
+ parameters: InferSchemaOutput<S>;
525
+ status: "executing";
526
+ result: undefined;
527
+ }
528
+ interface RenderToolCompleteProps<S extends StandardSchemaV1> {
529
+ name: string;
530
+ toolCallId: string;
531
+ parameters: InferSchemaOutput<S>;
532
+ status: "complete";
533
+ result: string;
534
+ }
535
+ type RenderToolProps<S extends StandardSchemaV1> = RenderToolInProgressProps<S> | RenderToolExecutingProps<S> | RenderToolCompleteProps<S>;
536
+ /**
537
+ * Registers a wildcard (`"*"`) renderer for tool calls.
538
+ *
539
+ * The wildcard renderer is used as a fallback when no exact name-matched
540
+ * renderer is registered for a tool call.
541
+ *
542
+ * @param config - Wildcard renderer configuration.
543
+ * @param deps - Optional dependencies to refresh registration.
544
+ *
545
+ * @example
546
+ * ```tsx
547
+ * useRenderTool(
548
+ * {
549
+ * name: "*",
550
+ * render: ({ name, status }) => (
551
+ * <div>
552
+ * {status === "complete" ? "✓" : "⏳"} {name}
553
+ * </div>
554
+ * ),
555
+ * },
556
+ * [],
557
+ * );
558
+ * ```
559
+ */
560
+ declare function useRenderTool(config: {
561
+ name: "*";
562
+ render: (props: any) => React.ReactElement;
563
+ agentId?: string;
564
+ }, deps?: ReadonlyArray<unknown>): void;
565
+ /**
566
+ * Registers a name-scoped renderer for tool calls.
567
+ *
568
+ * The provided `parameters` schema defines the typed shape of `props.parameters`
569
+ * in `render` for `executing` and `complete` states. Accepts any Standard Schema V1
570
+ * compatible library (Zod, Valibot, ArkType, etc.).
571
+ *
572
+ * @typeParam S - Schema type describing tool call parameters.
573
+ * @param config - Named renderer configuration.
574
+ * @param deps - Optional dependencies to refresh registration.
575
+ *
576
+ * @example
577
+ * ```tsx
578
+ * useRenderTool(
579
+ * {
580
+ * name: "searchDocs",
581
+ * parameters: z.object({ query: z.string() }),
582
+ * render: ({ status, parameters, result }) => {
583
+ * if (status === "inProgress") return <div>Preparing...</div>;
584
+ * if (status === "executing") return <div>Searching {parameters.query}</div>;
585
+ * return <div>{result}</div>;
586
+ * },
587
+ * },
588
+ * [],
589
+ * );
590
+ * ```
591
+ */
592
+ declare function useRenderTool<S extends StandardSchemaV1>(config: {
593
+ name: string;
594
+ parameters: S;
595
+ render: (props: RenderToolProps<S>) => React.ReactElement;
596
+ agentId?: string;
597
+ }, deps?: ReadonlyArray<unknown>): void;
598
+ //#endregion
599
+ //#region src/v2/types/defineToolCallRenderer.d.ts
600
+ /**
601
+ * Helper to define a type-safe tool call renderer entry.
602
+ * - Accepts a single object whose keys match ReactToolCallRenderer's fields: { name, args, render, agentId? }.
603
+ * - Derives `args` type from the provided schema (any Standard Schema V1 compatible library).
604
+ * - Ensures the render function param type exactly matches ReactToolCallRenderer<T>["render"]'s param.
605
+ * - For wildcard tools (name: "*"), args is optional and defaults to z.any()
606
+ */
607
+ type RenderProps<T> = {
608
+ name: string;
609
+ toolCallId: string;
610
+ args: Partial<T>;
611
+ status: ToolCallStatus.InProgress;
612
+ result: undefined;
613
+ } | {
614
+ name: string;
615
+ toolCallId: string;
616
+ args: T;
617
+ status: ToolCallStatus.Executing;
618
+ result: undefined;
619
+ } | {
620
+ name: string;
621
+ toolCallId: string;
622
+ args: T;
623
+ status: ToolCallStatus.Complete;
624
+ result: string;
625
+ };
626
+ declare function defineToolCallRenderer(def: {
627
+ name: "*";
628
+ render: (props: RenderProps<any>) => React$1.ReactElement;
629
+ agentId?: string;
630
+ }): ReactToolCallRenderer<any>;
631
+ declare function defineToolCallRenderer<S extends StandardSchemaV1>(def: {
632
+ name: string;
633
+ args: S;
634
+ render: (props: RenderProps<InferSchemaOutput<S>>) => React$1.ReactElement;
635
+ agentId?: string;
636
+ }): ReactToolCallRenderer<InferSchemaOutput<S>>;
637
+ //#endregion
638
+ //#region src/v2/hooks/use-capabilities.d.ts
639
+ /**
640
+ * Returns the capabilities declared by the given agent (or the default agent).
641
+ * Capabilities are populated from the runtime `/info` response at connection
642
+ * time. The hook reads them synchronously from the agent instance — there is
643
+ * no separate loading state, but the value will be `undefined` until the
644
+ * runtime handshake completes.
645
+ *
646
+ * @param agentId - Optional agent ID. If omitted, uses the default agent.
647
+ * @returns The agent's capabilities, or `undefined` if the agent doesn't
648
+ * declare capabilities.
649
+ */
650
+ declare function useCapabilities(agentId?: string): AgentCapabilities | undefined;
651
+ //#endregion
652
+ export { type AgentContextInput, CopilotChatConfigurationProvider, type CopilotChatConfigurationProviderProps, type CopilotChatConfigurationValue, CopilotChatDefaultLabels, type CopilotChatLabels, CopilotKitCoreReact, type CopilotKitCoreReactConfig, type InterruptEvent, type InterruptHandlerProps, type InterruptRenderProps, type JsonSerializable, type ReactFrontendTool, type ReactHumanInTheLoop, type RenderToolCompleteProps, type RenderToolExecutingProps, type RenderToolInProgressProps, type RenderToolProps, type Thread, type UseAgentUpdate, type UseInterruptConfig, type UseThreadsInput, type UseThreadsResult, defineToolCallRenderer, useAgent, useAgentContext, useCapabilities, useComponent, useConfigureSuggestions, useCopilotChatConfiguration, useFrontendTool, useHumanInTheLoop, useInterrupt, useRenderTool, useSuggestions, useThreads };
512
653
  //# sourceMappingURL=headless.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"headless.d.mts","names":[],"sources":["../../src/v2/providers/CopilotChatConfigurationProvider.tsx","../../src/v2/hooks/use-agent.tsx","../../src/v2/types/react-tool-call-renderer.ts","../../src/v2/types/frontend-tool.ts","../../src/v2/hooks/use-frontend-tool.tsx","../../src/v2/hooks/use-component.tsx","../../src/v2/types/human-in-the-loop.ts","../../src/v2/hooks/use-human-in-the-loop.tsx","../../src/v2/types/interrupt.ts","../../src/v2/hooks/use-interrupt.tsx","../../src/v2/hooks/use-suggestions.tsx","../../src/v2/hooks/use-configure-suggestions.tsx","../../src/v2/hooks/use-agent-context.tsx","../../src/v2/hooks/use-threads.tsx"],"mappings":";;;;;;;cAca,wBAAA;;;;;;;;;;;;;;;;;;;;;;KAwBD,iBAAA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,CAAQ,IAAA,CAAK,UAAA;AAAA,KAEV,4BAAA,GAA+B,IAAA,CAClC,uBAAA;EAGA,WAAA,EAAa,qBAAA;AAAA;AAAA,KAGV,sBAAA,GACD,wBAAA,GACA,4BAAA;AAAA,iBAEY,uBAAA,CACd,MAAA,EAAQ,sBAAA,qBACR,IAAA,GAAO,aAAA;;;;;;KCrBG,gBAAA,sCAKR,gBAAA;EAAA,CACG,GAAA,WAAc,gBAAA;AAAA;;AZErB;;;UYIiB,iBAAA;;EAEf,WAAA;;EAEA,KAAA,EAAO,gBAAA;AAAA;AAAA,iBAGO,eAAA,CAAgB,OAAA,EAAS,iBAAA;;;;;;;;;UCCxB,MAAA;EACf,EAAA;EACA,OAAA;EACA,IAAA;EACA,QAAA;EACA,SAAA;EACA,SAAA;;;;;;;EAOA,SAAA;AAAA;;;;;;;UASe,eAAA;;EAEf,OAAA;;EAEA,eAAA;;EAEA,KAAA;AAAA;;;;AbbF;;;;UauBiB,gBAAA;EbtBP;;;;;Ea4BR,OAAA,EAAS,MAAA;EbnBT;;;AAQF;EagBE,SAAA;;;;;;EAMA,KAAA,EAAO,KAAA;EbrBP;;;;Ea0BA,cAAA;EbxBA;;;Ea4BA,qBAAA;EbpBkB;;AAIpB;;EaqBE,gBAAA;EbrBqD;;;;Ea0BrD,YAAA,GAAe,QAAA,UAAkB,IAAA,aAAiB,OAAA;EbzBb;AAoHvC;;;;EarFE,aAAA,GAAgB,QAAA,aAAqB,OAAA;;;;AZhGvC;;EYsGE,YAAA,GAAe,QAAA,aAAqB,OAAA;AAAA;;;;;;AZ1FtC;;;;;;;;;;AA4BA;;;;;;;;;;;;;;;;;;;;;;;;AC/CA;;iBWyKgB,UAAA,CAAA;EACd,OAAA;EACA,eAAA;EACA;AAAA,GACC,eAAA,GAAkB,gBAAA"}
1
+ {"version":3,"file":"headless.d.mts","names":[],"sources":["../../src/v2/providers/CopilotChatConfigurationProvider.tsx","../../src/v2/hooks/use-agent.tsx","../../src/v2/types/react-tool-call-renderer.ts","../../src/v2/types/frontend-tool.ts","../../src/v2/hooks/use-frontend-tool.tsx","../../src/v2/hooks/use-component.tsx","../../src/v2/types/human-in-the-loop.ts","../../src/v2/hooks/use-human-in-the-loop.tsx","../../src/v2/types/interrupt.ts","../../src/v2/hooks/use-interrupt.tsx","../../src/v2/hooks/use-suggestions.tsx","../../src/v2/hooks/use-configure-suggestions.tsx","../../src/v2/hooks/use-agent-context.tsx","../../src/v2/hooks/use-threads.tsx","../../src/v2/hooks/use-render-tool.tsx","../../src/v2/types/defineToolCallRenderer.ts","../../src/v2/hooks/use-capabilities.tsx"],"mappings":";;;;;;;;cAca,wBAAA;;;;;;;;;;;;;;;;;;;;;;KAwBD,iBAAA,UAA2B,wBAAA;AAAA,UAGtB,6BAAA;EACf,MAAA,EAAQ,iBAAA;EACR,OAAA;EACA,QAAA;EACA,WAAA;EACA,YAAA,GAAe,IAAA;EAKf,mBAAA;AAAA;AAAA,UAQe,qCAAA;EACf,QAAA,EAAU,SAAA;EACV,MAAA,GAAS,OAAA,CAAQ,iBAAA;EACjB,OAAA;EACA,QAAA;EAMA,mBAAA;EACA,kBAAA;AAAA;AAAA,cAIW,gCAAA,EAAkC,OAAA,CAAM,EAAA,CACnD,qCAAA;AAAA,cAoHW,2BAAA,QACP,6BAAA;;;aCtLM,cAAA;EACV,iBAAA;EACA,cAAA;EACA,kBAAA;AAAA;AAAA,UASe,aAAA;EACf,OAAA;EACA,OAAA,GAAU,cAAA;EDYX;;;;;;;;;;;;;;;;;;;;;;ECWC,UAAA;AAAA;AAAA,iBAGc,QAAA,CAAA;EAAW,OAAA;EAAS,OAAA;EAAS;AAAA,IAAc,aAAA;;;;;UC/C1C,qBAAA;EACf,IAAA;EACA,IAAA,EAAM,gBAAA,MAAsB,CAAA;;;;AFS9B;EEJE,OAAA;EACA,MAAA,EAAQ,KAAA,CAAM,aAAA;IAER,IAAA;IACA,UAAA;IACA,IAAA,EAAM,OAAA,CAAQ,CAAA;IACd,MAAA,E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EF,IAAA,GAAO,aAAA;;;;;;;AdhGT;;;KeDK,WAAA;EAEC,IAAA;EACA,UAAA;EACA,IAAA,EAAM,OAAA,CAAQ,CAAA;EACd,MAAA,EAAQ,cAAA,CAAe,UAAA;EACvB,MAAA;AAAA;EAGA,IAAA;EACA,UAAA;EACA,IAAA,EAAM,CAAA;EACN,MAAA,EAAQ,cAAA,CAAe,SAAA;EACvB,MAAA;AAAA;EAGA,IAAA;EACA,UAAA;EACA,IAAA,EAAM,CAAA;EACN,MAAA,EAAQ,cAAA,CAAe,QAAA;EACvB,MAAA;AAAA;AAAA,iBAIU,sBAAA,CAAuB,GAAA;EACrC,IAAA;EACA,MAAA,GAAS,KAAA,EAAO,WAAA,UAAqB,OAAA,CAAM,YAAA;EAC3C,OAAA;AAAA,IACE,qBAAA;AAAA,iBAGY,sBAAA,WAAiC,gBAAA,CAAA,CAAkB,GAAA;EACjE,IAAA;EACA,IAAA,EAAM,CAAA;EACN,MAAA,GAAS,KAAA,EAAO,WAAA,CAAY,iBAAA,CAAkB,CAAA,OAAQ,OAAA,CAAM,YAAA;EAC5D,OAAA;AAAA,IACE,qBAAA,CAAsB,iBAAA,CAAkB,CAAA;;;;;;;;;;AfnC5C;;;;iBgBAgB,eAAA,CACd,OAAA,YACC,iBAAA"}
@@ -5,6 +5,7 @@ import { twMerge } from "tailwind-merge";
5
5
  import { jsx } from "react/jsx-runtime";
6
6
  import { HttpAgent } from "@ag-ui/client";
7
7
  import { CopilotKitCoreRuntimeConnectionStatus, ProxiedCopilotRuntimeAgent, ɵcreateThreadStore, ɵselectHasNextPage, ɵselectIsFetchingNextPage, ɵselectThreads, ɵselectThreadsError, ɵselectThreadsIsLoading } from "@copilotkit/core";
8
+ import { z } from "zod";
8
9
 
9
10
  //#region src/v2/lib/slots.tsx
10
11
  /**
@@ -286,10 +287,10 @@ function useAgent({ agentId, updates, throttleMs } = {}) {
286
287
 
287
288
  //#endregion
288
289
  //#region src/v2/hooks/use-frontend-tool.tsx
289
- const EMPTY_DEPS = [];
290
+ const EMPTY_DEPS$1 = [];
290
291
  function useFrontendTool(tool, deps) {
291
292
  const { copilotkit } = useCopilotKit();
292
- const extraDeps = deps ?? EMPTY_DEPS;
293
+ const extraDeps = deps ?? EMPTY_DEPS$1;
293
294
  useEffect(() => {
294
295
  const name = tool.name;
295
296
  if (copilotkit.getTool({
@@ -380,7 +381,8 @@ function useComponent(config, deps) {
380
381
  const Component = config.render;
381
382
  return /* @__PURE__ */ jsx(Component, { ...args });
382
383
  },
383
- agentId: config.agentId
384
+ agentId: config.agentId,
385
+ followUp: config.followUp
384
386
  }, deps);
385
387
  }
386
388
 
@@ -993,5 +995,107 @@ function useThreads({ agentId, includeArchived, limit }) {
993
995
  }
994
996
 
995
997
  //#endregion
996
- export { CopilotChatConfigurationProvider, CopilotChatDefaultLabels, CopilotKitCoreReact, useAgent, useAgentContext, useComponent, useConfigureSuggestions, useCopilotChatConfiguration, useFrontendTool, useHumanInTheLoop, useInterrupt, useSuggestions, useThreads };
998
+ //#region src/v2/types/defineToolCallRenderer.ts
999
+ function defineToolCallRenderer(def) {
1000
+ const argsSchema = def.name === "*" && !def.args ? z.any() : def.args;
1001
+ return {
1002
+ name: def.name,
1003
+ args: argsSchema,
1004
+ render: def.render,
1005
+ ...def.agentId ? { agentId: def.agentId } : {}
1006
+ };
1007
+ }
1008
+
1009
+ //#endregion
1010
+ //#region src/v2/hooks/use-render-tool.tsx
1011
+ const EMPTY_DEPS = [];
1012
+ /**
1013
+ * Registers a renderer entry in CopilotKit's `renderToolCalls` registry.
1014
+ *
1015
+ * Key behavior:
1016
+ * - deduplicates by `agentId:name` (latest registration wins),
1017
+ * - keeps renderer entries on cleanup so historical chat tool calls can still render,
1018
+ * - refreshes registration when `deps` change.
1019
+ *
1020
+ * @typeParam S - Schema type describing tool call parameters.
1021
+ * @param config - Renderer config for wildcard or named tools.
1022
+ * @param deps - Optional dependencies to refresh registration.
1023
+ *
1024
+ * @example
1025
+ * ```tsx
1026
+ * useRenderTool(
1027
+ * {
1028
+ * name: "searchDocs",
1029
+ * parameters: z.object({ query: z.string() }),
1030
+ * render: ({ status, parameters, result }) => {
1031
+ * if (status === "executing") return <div>Searching {parameters.query}</div>;
1032
+ * if (status === "complete") return <div>{result}</div>;
1033
+ * return <div>Preparing...</div>;
1034
+ * },
1035
+ * },
1036
+ * [],
1037
+ * );
1038
+ * ```
1039
+ *
1040
+ * @example
1041
+ * ```tsx
1042
+ * useRenderTool(
1043
+ * {
1044
+ * name: "summarize",
1045
+ * parameters: z.object({ text: z.string() }),
1046
+ * agentId: "research-agent",
1047
+ * render: ({ name, status }) => <div>{name}: {status}</div>,
1048
+ * },
1049
+ * [selectedAgentId],
1050
+ * );
1051
+ * ```
1052
+ */
1053
+ function useRenderTool(config, deps) {
1054
+ const { copilotkit } = useCopilotKit();
1055
+ const extraDeps = deps ?? EMPTY_DEPS;
1056
+ useEffect(() => {
1057
+ const renderer = config.name === "*" && !config.parameters ? defineToolCallRenderer({
1058
+ name: "*",
1059
+ render: (props) => config.render({
1060
+ ...props,
1061
+ parameters: props.args
1062
+ }),
1063
+ ...config.agentId ? { agentId: config.agentId } : {}
1064
+ }) : defineToolCallRenderer({
1065
+ name: config.name,
1066
+ args: config.parameters,
1067
+ render: (props) => config.render({
1068
+ ...props,
1069
+ parameters: props.args
1070
+ }),
1071
+ ...config.agentId ? { agentId: config.agentId } : {}
1072
+ });
1073
+ copilotkit.addHookRenderToolCall(renderer);
1074
+ }, [
1075
+ config.name,
1076
+ copilotkit,
1077
+ JSON.stringify(extraDeps)
1078
+ ]);
1079
+ }
1080
+
1081
+ //#endregion
1082
+ //#region src/v2/hooks/use-capabilities.tsx
1083
+ /**
1084
+ * Returns the capabilities declared by the given agent (or the default agent).
1085
+ * Capabilities are populated from the runtime `/info` response at connection
1086
+ * time. The hook reads them synchronously from the agent instance — there is
1087
+ * no separate loading state, but the value will be `undefined` until the
1088
+ * runtime handshake completes.
1089
+ *
1090
+ * @param agentId - Optional agent ID. If omitted, uses the default agent.
1091
+ * @returns The agent's capabilities, or `undefined` if the agent doesn't
1092
+ * declare capabilities.
1093
+ */
1094
+ function useCapabilities(agentId) {
1095
+ const { agent } = useAgent({ agentId });
1096
+ if (agent && "capabilities" in agent) return agent.capabilities;
1097
+ }
1098
+
1099
+ //#endregion
1100
+ export { CopilotChatConfigurationProvider, CopilotChatDefaultLabels, CopilotKitCoreReact, defineToolCallRenderer, useAgent, useAgentContext, useCapabilities, useComponent, useConfigureSuggestions, useCopilotChatConfiguration, useFrontendTool, useHumanInTheLoop, useInterrupt, useRenderTool, useSuggestions, useThreads };
997
1101
  //# sourceMappingURL=headless.mjs.map