@copilotkitnext/react 0.0.0-max-changeset-20260109200053 → 0.0.0-max-no-peerage-20260115011549

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
@@ -1,10 +1,9 @@
1
- import { AssistantMessage, Message, UserMessage, ToolCall, ToolMessage, ActivityMessage } from '@ag-ui/core';
2
- export * from '@ag-ui/core';
3
1
  import { AbstractAgent } from '@ag-ui/client';
4
2
  export * from '@ag-ui/client';
5
3
  import * as react_jsx_runtime from 'react/jsx-runtime';
6
4
  import * as React$1 from 'react';
7
5
  import React__default, { ReactNode } from 'react';
6
+ import { AssistantMessage, Message, UserMessage, ToolCall, ToolMessage, ActivityMessage } from '@ag-ui/core';
8
7
  import { Streamdown } from 'streamdown';
9
8
  import { Suggestion, CopilotKitCore, ToolCallStatus, FrontendTool, DynamicSuggestionsConfig, StaticSuggestionsConfig, CopilotKitCoreConfig, CopilotKitCoreSubscriber, CopilotKitCoreSubscription } from '@copilotkitnext/core';
10
9
  import { z } from 'zod';
@@ -418,50 +417,28 @@ declare const MCPAppsActivityContentSchema: z.ZodObject<{
418
417
  structuredContent?: any;
419
418
  isError?: boolean | undefined;
420
419
  }>;
421
- resource: z.ZodObject<{
422
- uri: z.ZodString;
423
- mimeType: z.ZodOptional<z.ZodString>;
424
- text: z.ZodOptional<z.ZodString>;
425
- blob: z.ZodOptional<z.ZodString>;
426
- }, "strip", z.ZodTypeAny, {
427
- uri: string;
428
- text?: string | undefined;
429
- mimeType?: string | undefined;
430
- blob?: string | undefined;
431
- }, {
432
- uri: string;
433
- text?: string | undefined;
434
- mimeType?: string | undefined;
435
- blob?: string | undefined;
436
- }>;
420
+ resourceUri: z.ZodString;
421
+ serverHash: z.ZodString;
437
422
  serverId: z.ZodOptional<z.ZodString>;
438
423
  toolInput: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
439
424
  }, "strip", z.ZodTypeAny, {
440
- resource: {
441
- uri: string;
442
- text?: string | undefined;
443
- mimeType?: string | undefined;
444
- blob?: string | undefined;
445
- };
446
425
  result: {
447
426
  content?: any[] | undefined;
448
427
  structuredContent?: any;
449
428
  isError?: boolean | undefined;
450
429
  };
430
+ resourceUri: string;
431
+ serverHash: string;
451
432
  serverId?: string | undefined;
452
433
  toolInput?: Record<string, unknown> | undefined;
453
434
  }, {
454
- resource: {
455
- uri: string;
456
- text?: string | undefined;
457
- mimeType?: string | undefined;
458
- blob?: string | undefined;
459
- };
460
435
  result: {
461
436
  content?: any[] | undefined;
462
437
  structuredContent?: any;
463
438
  isError?: boolean | undefined;
464
439
  };
440
+ resourceUri: string;
441
+ serverHash: string;
465
442
  serverId?: string | undefined;
466
443
  toolInput?: Record<string, unknown> | undefined;
467
444
  }>;
@@ -479,6 +456,7 @@ interface MCPAppsActivityRendererProps {
479
456
  * MCP Apps Extension Activity Renderer
480
457
  *
481
458
  * Renders MCP Apps UI in a sandboxed iframe with full protocol support.
459
+ * Fetches resource content on-demand via proxied MCP requests.
482
460
  */
483
461
  declare const MCPAppsActivityRenderer: React__default.FC<MCPAppsActivityRendererProps>;
484
462
 
@@ -515,8 +493,6 @@ interface UseRenderCustomMessagesParams {
515
493
  }
516
494
  declare function useRenderCustomMessages(): ((params: UseRenderCustomMessagesParams) => react_jsx_runtime.JSX.Element | null) | null;
517
495
 
518
- declare function useRenderActivityMessage(): (message: ActivityMessage) => React.ReactElement | null;
519
-
520
496
  interface ReactToolCallRenderer<T> {
521
497
  name: string;
522
498
  args: z.ZodSchema<T>;
@@ -543,12 +519,34 @@ interface ReactToolCallRenderer<T> {
543
519
  }>;
544
520
  }
545
521
 
522
+ interface ReactActivityMessageRenderer<TActivityContent> {
523
+ /**
524
+ * Activity type to match when rendering. Use "*" as a wildcard renderer.
525
+ */
526
+ activityType: string;
527
+ /**
528
+ * Optional agent ID to scope the renderer to a particular agent.
529
+ */
530
+ agentId?: string;
531
+ /**
532
+ * Schema describing the activity content payload.
533
+ */
534
+ content: z.ZodSchema<TActivityContent>;
535
+ /**
536
+ * React component invoked to render the activity message.
537
+ */
538
+ render: React.ComponentType<{
539
+ activityType: string;
540
+ content: TActivityContent;
541
+ message: ActivityMessage;
542
+ agent: AbstractAgent | undefined;
543
+ }>;
544
+ }
545
+
546
546
  type ReactFrontendTool<T extends Record<string, unknown> = Record<string, unknown>> = FrontendTool<T> & {
547
547
  render?: ReactToolCallRenderer<T>["render"];
548
548
  };
549
549
 
550
- declare function useFrontendTool<T extends Record<string, unknown> = Record<string, unknown>>(tool: ReactFrontendTool<T>, deps?: ReadonlyArray<unknown>): void;
551
-
552
550
  type ReactHumanInTheLoop<T extends Record<string, unknown> = Record<string, unknown>> = Omit<FrontendTool<T>, "handler"> & {
553
551
  render: React__default.ComponentType<{
554
552
  name: string;
@@ -574,6 +572,48 @@ type ReactHumanInTheLoop<T extends Record<string, unknown> = Record<string, unkn
574
572
  }>;
575
573
  };
576
574
 
575
+ /**
576
+ * Helper to define a type-safe tool call renderer entry.
577
+ * - Accepts a single object whose keys match ReactToolCallRenderer's fields: { name, args, render, agentId? }.
578
+ * - Derives `args` type from the provided Zod schema.
579
+ * - Ensures the render function param type exactly matches ReactToolCallRenderer<T>["render"]'s param.
580
+ * - For wildcard tools (name: "*"), args is optional and defaults to z.any()
581
+ */
582
+ type RenderProps<T> = {
583
+ name: string;
584
+ args: Partial<T>;
585
+ status: ToolCallStatus.InProgress;
586
+ result: undefined;
587
+ } | {
588
+ name: string;
589
+ args: T;
590
+ status: ToolCallStatus.Executing;
591
+ result: undefined;
592
+ } | {
593
+ name: string;
594
+ args: T;
595
+ status: ToolCallStatus.Complete;
596
+ result: string;
597
+ };
598
+ declare function defineToolCallRenderer(def: {
599
+ name: "*";
600
+ render: (props: RenderProps<any>) => React__default.ReactElement;
601
+ agentId?: string;
602
+ }): ReactToolCallRenderer<any>;
603
+ declare function defineToolCallRenderer<S extends z.ZodTypeAny>(def: {
604
+ name: string;
605
+ args: S;
606
+ render: (props: RenderProps<z.infer<S>>) => React__default.ReactElement;
607
+ agentId?: string;
608
+ }): ReactToolCallRenderer<z.infer<S>>;
609
+
610
+ declare function useRenderActivityMessage(): {
611
+ renderActivityMessage: (message: ActivityMessage) => React.ReactElement | null;
612
+ findRenderer: (activityType: string) => ReactActivityMessageRenderer<unknown> | null;
613
+ };
614
+
615
+ declare function useFrontendTool<T extends Record<string, unknown> = Record<string, unknown>>(tool: ReactFrontendTool<T>, deps?: ReadonlyArray<unknown>): void;
616
+
577
617
  declare function useHumanInTheLoop<T extends Record<string, unknown> = Record<string, unknown>>(tool: ReactHumanInTheLoop<T>, deps?: ReadonlyArray<unknown>): void;
578
618
 
579
619
  declare enum UseAgentUpdate {
@@ -625,65 +665,6 @@ type StaticSuggestionsConfigInput = Omit<StaticSuggestionsConfig, "suggestions">
625
665
  type SuggestionsConfigInput = DynamicSuggestionsConfig | StaticSuggestionsConfigInput;
626
666
  declare function useConfigureSuggestions(config: SuggestionsConfigInput | null | undefined, deps?: ReadonlyArray<unknown>): void;
627
667
 
628
- interface ReactActivityMessageRenderer<TActivityContent> {
629
- /**
630
- * Activity type to match when rendering. Use "*" as a wildcard renderer.
631
- */
632
- activityType: string;
633
- /**
634
- * Optional agent ID to scope the renderer to a particular agent.
635
- */
636
- agentId?: string;
637
- /**
638
- * Schema describing the activity content payload.
639
- */
640
- content: z.ZodSchema<TActivityContent>;
641
- /**
642
- * React component invoked to render the activity message.
643
- */
644
- render: React.ComponentType<{
645
- activityType: string;
646
- content: TActivityContent;
647
- message: ActivityMessage;
648
- agent: AbstractAgent | undefined;
649
- }>;
650
- }
651
-
652
- /**
653
- * Helper to define a type-safe tool call renderer entry.
654
- * - Accepts a single object whose keys match ReactToolCallRenderer's fields: { name, args, render, agentId? }.
655
- * - Derives `args` type from the provided Zod schema.
656
- * - Ensures the render function param type exactly matches ReactToolCallRenderer<T>["render"]'s param.
657
- * - For wildcard tools (name: "*"), args is optional and defaults to z.any()
658
- */
659
- type RenderProps<T> = {
660
- name: string;
661
- args: Partial<T>;
662
- status: ToolCallStatus.InProgress;
663
- result: undefined;
664
- } | {
665
- name: string;
666
- args: T;
667
- status: ToolCallStatus.Executing;
668
- result: undefined;
669
- } | {
670
- name: string;
671
- args: T;
672
- status: ToolCallStatus.Complete;
673
- result: string;
674
- };
675
- declare function defineToolCallRenderer(def: {
676
- name: "*";
677
- render: (props: RenderProps<any>) => React__default.ReactElement;
678
- agentId?: string;
679
- }): ReactToolCallRenderer<any>;
680
- declare function defineToolCallRenderer<S extends z.ZodTypeAny>(def: {
681
- name: string;
682
- args: S;
683
- render: (props: RenderProps<z.infer<S>>) => React__default.ReactElement;
684
- agentId?: string;
685
- }): ReactToolCallRenderer<z.infer<S>>;
686
-
687
668
  interface CopilotKitCoreReactConfig extends CopilotKitCoreConfig {
688
669
  renderToolCalls?: ReactToolCallRenderer<any>[];
689
670
  renderActivityMessages?: ReactActivityMessageRenderer<any>[];
package/dist/index.d.ts CHANGED
@@ -1,10 +1,9 @@
1
- import { AssistantMessage, Message, UserMessage, ToolCall, ToolMessage, ActivityMessage } from '@ag-ui/core';
2
- export * from '@ag-ui/core';
3
1
  import { AbstractAgent } from '@ag-ui/client';
4
2
  export * from '@ag-ui/client';
5
3
  import * as react_jsx_runtime from 'react/jsx-runtime';
6
4
  import * as React$1 from 'react';
7
5
  import React__default, { ReactNode } from 'react';
6
+ import { AssistantMessage, Message, UserMessage, ToolCall, ToolMessage, ActivityMessage } from '@ag-ui/core';
8
7
  import { Streamdown } from 'streamdown';
9
8
  import { Suggestion, CopilotKitCore, ToolCallStatus, FrontendTool, DynamicSuggestionsConfig, StaticSuggestionsConfig, CopilotKitCoreConfig, CopilotKitCoreSubscriber, CopilotKitCoreSubscription } from '@copilotkitnext/core';
10
9
  import { z } from 'zod';
@@ -418,50 +417,28 @@ declare const MCPAppsActivityContentSchema: z.ZodObject<{
418
417
  structuredContent?: any;
419
418
  isError?: boolean | undefined;
420
419
  }>;
421
- resource: z.ZodObject<{
422
- uri: z.ZodString;
423
- mimeType: z.ZodOptional<z.ZodString>;
424
- text: z.ZodOptional<z.ZodString>;
425
- blob: z.ZodOptional<z.ZodString>;
426
- }, "strip", z.ZodTypeAny, {
427
- uri: string;
428
- text?: string | undefined;
429
- mimeType?: string | undefined;
430
- blob?: string | undefined;
431
- }, {
432
- uri: string;
433
- text?: string | undefined;
434
- mimeType?: string | undefined;
435
- blob?: string | undefined;
436
- }>;
420
+ resourceUri: z.ZodString;
421
+ serverHash: z.ZodString;
437
422
  serverId: z.ZodOptional<z.ZodString>;
438
423
  toolInput: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
439
424
  }, "strip", z.ZodTypeAny, {
440
- resource: {
441
- uri: string;
442
- text?: string | undefined;
443
- mimeType?: string | undefined;
444
- blob?: string | undefined;
445
- };
446
425
  result: {
447
426
  content?: any[] | undefined;
448
427
  structuredContent?: any;
449
428
  isError?: boolean | undefined;
450
429
  };
430
+ resourceUri: string;
431
+ serverHash: string;
451
432
  serverId?: string | undefined;
452
433
  toolInput?: Record<string, unknown> | undefined;
453
434
  }, {
454
- resource: {
455
- uri: string;
456
- text?: string | undefined;
457
- mimeType?: string | undefined;
458
- blob?: string | undefined;
459
- };
460
435
  result: {
461
436
  content?: any[] | undefined;
462
437
  structuredContent?: any;
463
438
  isError?: boolean | undefined;
464
439
  };
440
+ resourceUri: string;
441
+ serverHash: string;
465
442
  serverId?: string | undefined;
466
443
  toolInput?: Record<string, unknown> | undefined;
467
444
  }>;
@@ -479,6 +456,7 @@ interface MCPAppsActivityRendererProps {
479
456
  * MCP Apps Extension Activity Renderer
480
457
  *
481
458
  * Renders MCP Apps UI in a sandboxed iframe with full protocol support.
459
+ * Fetches resource content on-demand via proxied MCP requests.
482
460
  */
483
461
  declare const MCPAppsActivityRenderer: React__default.FC<MCPAppsActivityRendererProps>;
484
462
 
@@ -515,8 +493,6 @@ interface UseRenderCustomMessagesParams {
515
493
  }
516
494
  declare function useRenderCustomMessages(): ((params: UseRenderCustomMessagesParams) => react_jsx_runtime.JSX.Element | null) | null;
517
495
 
518
- declare function useRenderActivityMessage(): (message: ActivityMessage) => React.ReactElement | null;
519
-
520
496
  interface ReactToolCallRenderer<T> {
521
497
  name: string;
522
498
  args: z.ZodSchema<T>;
@@ -543,12 +519,34 @@ interface ReactToolCallRenderer<T> {
543
519
  }>;
544
520
  }
545
521
 
522
+ interface ReactActivityMessageRenderer<TActivityContent> {
523
+ /**
524
+ * Activity type to match when rendering. Use "*" as a wildcard renderer.
525
+ */
526
+ activityType: string;
527
+ /**
528
+ * Optional agent ID to scope the renderer to a particular agent.
529
+ */
530
+ agentId?: string;
531
+ /**
532
+ * Schema describing the activity content payload.
533
+ */
534
+ content: z.ZodSchema<TActivityContent>;
535
+ /**
536
+ * React component invoked to render the activity message.
537
+ */
538
+ render: React.ComponentType<{
539
+ activityType: string;
540
+ content: TActivityContent;
541
+ message: ActivityMessage;
542
+ agent: AbstractAgent | undefined;
543
+ }>;
544
+ }
545
+
546
546
  type ReactFrontendTool<T extends Record<string, unknown> = Record<string, unknown>> = FrontendTool<T> & {
547
547
  render?: ReactToolCallRenderer<T>["render"];
548
548
  };
549
549
 
550
- declare function useFrontendTool<T extends Record<string, unknown> = Record<string, unknown>>(tool: ReactFrontendTool<T>, deps?: ReadonlyArray<unknown>): void;
551
-
552
550
  type ReactHumanInTheLoop<T extends Record<string, unknown> = Record<string, unknown>> = Omit<FrontendTool<T>, "handler"> & {
553
551
  render: React__default.ComponentType<{
554
552
  name: string;
@@ -574,6 +572,48 @@ type ReactHumanInTheLoop<T extends Record<string, unknown> = Record<string, unkn
574
572
  }>;
575
573
  };
576
574
 
575
+ /**
576
+ * Helper to define a type-safe tool call renderer entry.
577
+ * - Accepts a single object whose keys match ReactToolCallRenderer's fields: { name, args, render, agentId? }.
578
+ * - Derives `args` type from the provided Zod schema.
579
+ * - Ensures the render function param type exactly matches ReactToolCallRenderer<T>["render"]'s param.
580
+ * - For wildcard tools (name: "*"), args is optional and defaults to z.any()
581
+ */
582
+ type RenderProps<T> = {
583
+ name: string;
584
+ args: Partial<T>;
585
+ status: ToolCallStatus.InProgress;
586
+ result: undefined;
587
+ } | {
588
+ name: string;
589
+ args: T;
590
+ status: ToolCallStatus.Executing;
591
+ result: undefined;
592
+ } | {
593
+ name: string;
594
+ args: T;
595
+ status: ToolCallStatus.Complete;
596
+ result: string;
597
+ };
598
+ declare function defineToolCallRenderer(def: {
599
+ name: "*";
600
+ render: (props: RenderProps<any>) => React__default.ReactElement;
601
+ agentId?: string;
602
+ }): ReactToolCallRenderer<any>;
603
+ declare function defineToolCallRenderer<S extends z.ZodTypeAny>(def: {
604
+ name: string;
605
+ args: S;
606
+ render: (props: RenderProps<z.infer<S>>) => React__default.ReactElement;
607
+ agentId?: string;
608
+ }): ReactToolCallRenderer<z.infer<S>>;
609
+
610
+ declare function useRenderActivityMessage(): {
611
+ renderActivityMessage: (message: ActivityMessage) => React.ReactElement | null;
612
+ findRenderer: (activityType: string) => ReactActivityMessageRenderer<unknown> | null;
613
+ };
614
+
615
+ declare function useFrontendTool<T extends Record<string, unknown> = Record<string, unknown>>(tool: ReactFrontendTool<T>, deps?: ReadonlyArray<unknown>): void;
616
+
577
617
  declare function useHumanInTheLoop<T extends Record<string, unknown> = Record<string, unknown>>(tool: ReactHumanInTheLoop<T>, deps?: ReadonlyArray<unknown>): void;
578
618
 
579
619
  declare enum UseAgentUpdate {
@@ -625,65 +665,6 @@ type StaticSuggestionsConfigInput = Omit<StaticSuggestionsConfig, "suggestions">
625
665
  type SuggestionsConfigInput = DynamicSuggestionsConfig | StaticSuggestionsConfigInput;
626
666
  declare function useConfigureSuggestions(config: SuggestionsConfigInput | null | undefined, deps?: ReadonlyArray<unknown>): void;
627
667
 
628
- interface ReactActivityMessageRenderer<TActivityContent> {
629
- /**
630
- * Activity type to match when rendering. Use "*" as a wildcard renderer.
631
- */
632
- activityType: string;
633
- /**
634
- * Optional agent ID to scope the renderer to a particular agent.
635
- */
636
- agentId?: string;
637
- /**
638
- * Schema describing the activity content payload.
639
- */
640
- content: z.ZodSchema<TActivityContent>;
641
- /**
642
- * React component invoked to render the activity message.
643
- */
644
- render: React.ComponentType<{
645
- activityType: string;
646
- content: TActivityContent;
647
- message: ActivityMessage;
648
- agent: AbstractAgent | undefined;
649
- }>;
650
- }
651
-
652
- /**
653
- * Helper to define a type-safe tool call renderer entry.
654
- * - Accepts a single object whose keys match ReactToolCallRenderer's fields: { name, args, render, agentId? }.
655
- * - Derives `args` type from the provided Zod schema.
656
- * - Ensures the render function param type exactly matches ReactToolCallRenderer<T>["render"]'s param.
657
- * - For wildcard tools (name: "*"), args is optional and defaults to z.any()
658
- */
659
- type RenderProps<T> = {
660
- name: string;
661
- args: Partial<T>;
662
- status: ToolCallStatus.InProgress;
663
- result: undefined;
664
- } | {
665
- name: string;
666
- args: T;
667
- status: ToolCallStatus.Executing;
668
- result: undefined;
669
- } | {
670
- name: string;
671
- args: T;
672
- status: ToolCallStatus.Complete;
673
- result: string;
674
- };
675
- declare function defineToolCallRenderer(def: {
676
- name: "*";
677
- render: (props: RenderProps<any>) => React__default.ReactElement;
678
- agentId?: string;
679
- }): ReactToolCallRenderer<any>;
680
- declare function defineToolCallRenderer<S extends z.ZodTypeAny>(def: {
681
- name: string;
682
- args: S;
683
- render: (props: RenderProps<z.infer<S>>) => React__default.ReactElement;
684
- agentId?: string;
685
- }): ReactToolCallRenderer<z.infer<S>>;
686
-
687
668
  interface CopilotKitCoreReactConfig extends CopilotKitCoreConfig {
688
669
  renderToolCalls?: ReactToolCallRenderer<any>[];
689
670
  renderActivityMessages?: ReactActivityMessageRenderer<any>[];