@copilotkitnext/react 0.0.22-alpha.9 → 0.0.23

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,13 +1,15 @@
1
+ import { AssistantMessage, Message, UserMessage, ToolCall, ToolMessage, ActivityMessage } from '@ag-ui/core';
2
+ export * from '@ag-ui/core';
3
+ import { AbstractAgent, Context } from '@ag-ui/client';
4
+ export * from '@ag-ui/client';
1
5
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
6
  import * as React$1 from 'react';
3
7
  import React__default, { ReactNode } from 'react';
4
- import { AssistantMessage, Message, UserMessage, ToolCall, ToolMessage, ActivityMessage } from '@ag-ui/core';
5
8
  import { Streamdown } from 'streamdown';
6
- import { Suggestion, CopilotKitCore, ToolCallStatus, FrontendTool, DynamicSuggestionsConfig, StaticSuggestionsConfig, CopilotKitCoreConfig, CopilotKitCoreSubscriber } from '@copilotkitnext/core';
9
+ import { Suggestion, CopilotKitCore, ToolCallStatus, FrontendTool, DynamicSuggestionsConfig, StaticSuggestionsConfig, CopilotKitCoreConfig, CopilotKitCoreSubscriber, CopilotKitCoreSubscription } from '@copilotkitnext/core';
7
10
  import { z } from 'zod';
8
11
  import * as _lit_labs_react from '@lit-labs/react';
9
12
  import { WebInspectorElement } from '@copilotkitnext/web-inspector';
10
- import { AbstractAgent, Context } from '@ag-ui/client';
11
13
 
12
14
  declare const CopilotChatDefaultLabels: {
13
15
  chatInputPlaceholder: string;
@@ -260,16 +262,16 @@ type CopilotChatMessageViewProps = Omit<WithSlots<{
260
262
  }, {
261
263
  isRunning?: boolean;
262
264
  messages?: Message[];
263
- } & React.HTMLAttributes<HTMLDivElement>>, "children"> & {
265
+ } & React__default.HTMLAttributes<HTMLDivElement>>, "children"> & {
264
266
  children?: (props: {
265
267
  isRunning: boolean;
266
268
  messages: Message[];
267
- messageElements: React.ReactElement[];
268
- }) => React.ReactElement;
269
+ messageElements: React__default.ReactElement[];
270
+ }) => React__default.ReactElement;
269
271
  };
270
272
  declare function CopilotChatMessageView({ messages, assistantMessage, userMessage, cursor, isRunning, children, className, ...props }: CopilotChatMessageViewProps): react_jsx_runtime.JSX.Element;
271
273
  declare namespace CopilotChatMessageView {
272
- var Cursor: ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => react_jsx_runtime.JSX.Element;
274
+ var Cursor: ({ className, ...props }: React__default.HTMLAttributes<HTMLDivElement>) => react_jsx_runtime.JSX.Element;
273
275
  }
274
276
 
275
277
  type CopilotChatViewProps = WithSlots<{
@@ -296,7 +298,7 @@ declare function CopilotChatView({ messageView, input, scrollView, scrollToBotto
296
298
  declare namespace CopilotChatView {
297
299
  const ScrollView: React__default.FC<React__default.HTMLAttributes<HTMLDivElement> & {
298
300
  autoScroll?: boolean;
299
- scrollToBottomButton?: React__default.FC<React__default.ButtonHTMLAttributes<HTMLButtonElement>>;
301
+ scrollToBottomButton?: SlotValue<React__default.FC<React__default.ButtonHTMLAttributes<HTMLButtonElement>>>;
300
302
  inputContainerHeight?: number;
301
303
  isResizing?: boolean;
302
304
  }>;
@@ -464,7 +466,7 @@ type ReactFrontendTool<T extends Record<string, unknown> = Record<string, unknow
464
466
  render?: ReactToolCallRenderer<T>["render"];
465
467
  };
466
468
 
467
- declare function useFrontendTool<T extends Record<string, unknown> = Record<string, unknown>>(tool: ReactFrontendTool<T>): void;
469
+ declare function useFrontendTool<T extends Record<string, unknown> = Record<string, unknown>>(tool: ReactFrontendTool<T>, deps?: ReadonlyArray<unknown>): void;
468
470
 
469
471
  type ReactHumanInTheLoop<T extends Record<string, unknown> = Record<string, unknown>> = Omit<FrontendTool<T>, "handler"> & {
470
472
  render: React__default.ComponentType<{
@@ -491,7 +493,7 @@ type ReactHumanInTheLoop<T extends Record<string, unknown> = Record<string, unkn
491
493
  }>;
492
494
  };
493
495
 
494
- declare function useHumanInTheLoop<T extends Record<string, unknown> = Record<string, unknown>>(tool: ReactHumanInTheLoop<T>): void;
496
+ declare function useHumanInTheLoop<T extends Record<string, unknown> = Record<string, unknown>>(tool: ReactHumanInTheLoop<T>, deps?: ReadonlyArray<unknown>): void;
495
497
 
496
498
  declare enum UseAgentUpdate {
497
499
  OnMessagesChanged = "OnMessagesChanged",
@@ -503,7 +505,7 @@ interface UseAgentProps {
503
505
  updates?: UseAgentUpdate[];
504
506
  }
505
507
  declare function useAgent({ agentId, updates }?: UseAgentProps): {
506
- agent: AbstractAgent | undefined;
508
+ agent: AbstractAgent;
507
509
  };
508
510
 
509
511
  declare function useAgentContext(context: Context): void;
@@ -524,10 +526,7 @@ type StaticSuggestionsConfigInput = Omit<StaticSuggestionsConfig, "suggestions">
524
526
  suggestions: StaticSuggestionInput[];
525
527
  };
526
528
  type SuggestionsConfigInput = DynamicSuggestionsConfig | StaticSuggestionsConfigInput;
527
- interface UseConfigureSuggestionsOptions {
528
- deps?: ReadonlyArray<unknown>;
529
- }
530
- declare function useConfigureSuggestions(config: SuggestionsConfigInput | null | undefined, options?: UseConfigureSuggestionsOptions): void;
529
+ declare function useConfigureSuggestions(config: SuggestionsConfigInput | null | undefined, deps?: ReadonlyArray<unknown>): void;
531
530
 
532
531
  interface ReactActivityMessageRenderer<TActivityContent> {
533
532
  /**
@@ -608,8 +607,7 @@ declare class CopilotKitCoreReact extends CopilotKitCore {
608
607
  get renderActivityMessages(): Readonly<ReactActivityMessageRenderer<any>>[];
609
608
  get renderToolCalls(): Readonly<ReactToolCallRenderer<any>>[];
610
609
  setRenderToolCalls(renderToolCalls: ReactToolCallRenderer<any>[]): void;
611
- subscribe(subscriber: CopilotKitCoreReactSubscriber): () => void;
612
- unsubscribe(subscriber: CopilotKitCoreReactSubscriber): void;
610
+ subscribe(subscriber: CopilotKitCoreReactSubscriber): CopilotKitCoreSubscription;
613
611
  }
614
612
 
615
613
  interface CopilotKitContextValue {
package/dist/index.d.ts CHANGED
@@ -1,13 +1,15 @@
1
+ import { AssistantMessage, Message, UserMessage, ToolCall, ToolMessage, ActivityMessage } from '@ag-ui/core';
2
+ export * from '@ag-ui/core';
3
+ import { AbstractAgent, Context } from '@ag-ui/client';
4
+ export * from '@ag-ui/client';
1
5
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
6
  import * as React$1 from 'react';
3
7
  import React__default, { ReactNode } from 'react';
4
- import { AssistantMessage, Message, UserMessage, ToolCall, ToolMessage, ActivityMessage } from '@ag-ui/core';
5
8
  import { Streamdown } from 'streamdown';
6
- import { Suggestion, CopilotKitCore, ToolCallStatus, FrontendTool, DynamicSuggestionsConfig, StaticSuggestionsConfig, CopilotKitCoreConfig, CopilotKitCoreSubscriber } from '@copilotkitnext/core';
9
+ import { Suggestion, CopilotKitCore, ToolCallStatus, FrontendTool, DynamicSuggestionsConfig, StaticSuggestionsConfig, CopilotKitCoreConfig, CopilotKitCoreSubscriber, CopilotKitCoreSubscription } from '@copilotkitnext/core';
7
10
  import { z } from 'zod';
8
11
  import * as _lit_labs_react from '@lit-labs/react';
9
12
  import { WebInspectorElement } from '@copilotkitnext/web-inspector';
10
- import { AbstractAgent, Context } from '@ag-ui/client';
11
13
 
12
14
  declare const CopilotChatDefaultLabels: {
13
15
  chatInputPlaceholder: string;
@@ -260,16 +262,16 @@ type CopilotChatMessageViewProps = Omit<WithSlots<{
260
262
  }, {
261
263
  isRunning?: boolean;
262
264
  messages?: Message[];
263
- } & React.HTMLAttributes<HTMLDivElement>>, "children"> & {
265
+ } & React__default.HTMLAttributes<HTMLDivElement>>, "children"> & {
264
266
  children?: (props: {
265
267
  isRunning: boolean;
266
268
  messages: Message[];
267
- messageElements: React.ReactElement[];
268
- }) => React.ReactElement;
269
+ messageElements: React__default.ReactElement[];
270
+ }) => React__default.ReactElement;
269
271
  };
270
272
  declare function CopilotChatMessageView({ messages, assistantMessage, userMessage, cursor, isRunning, children, className, ...props }: CopilotChatMessageViewProps): react_jsx_runtime.JSX.Element;
271
273
  declare namespace CopilotChatMessageView {
272
- var Cursor: ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => react_jsx_runtime.JSX.Element;
274
+ var Cursor: ({ className, ...props }: React__default.HTMLAttributes<HTMLDivElement>) => react_jsx_runtime.JSX.Element;
273
275
  }
274
276
 
275
277
  type CopilotChatViewProps = WithSlots<{
@@ -296,7 +298,7 @@ declare function CopilotChatView({ messageView, input, scrollView, scrollToBotto
296
298
  declare namespace CopilotChatView {
297
299
  const ScrollView: React__default.FC<React__default.HTMLAttributes<HTMLDivElement> & {
298
300
  autoScroll?: boolean;
299
- scrollToBottomButton?: React__default.FC<React__default.ButtonHTMLAttributes<HTMLButtonElement>>;
301
+ scrollToBottomButton?: SlotValue<React__default.FC<React__default.ButtonHTMLAttributes<HTMLButtonElement>>>;
300
302
  inputContainerHeight?: number;
301
303
  isResizing?: boolean;
302
304
  }>;
@@ -464,7 +466,7 @@ type ReactFrontendTool<T extends Record<string, unknown> = Record<string, unknow
464
466
  render?: ReactToolCallRenderer<T>["render"];
465
467
  };
466
468
 
467
- declare function useFrontendTool<T extends Record<string, unknown> = Record<string, unknown>>(tool: ReactFrontendTool<T>): void;
469
+ declare function useFrontendTool<T extends Record<string, unknown> = Record<string, unknown>>(tool: ReactFrontendTool<T>, deps?: ReadonlyArray<unknown>): void;
468
470
 
469
471
  type ReactHumanInTheLoop<T extends Record<string, unknown> = Record<string, unknown>> = Omit<FrontendTool<T>, "handler"> & {
470
472
  render: React__default.ComponentType<{
@@ -491,7 +493,7 @@ type ReactHumanInTheLoop<T extends Record<string, unknown> = Record<string, unkn
491
493
  }>;
492
494
  };
493
495
 
494
- declare function useHumanInTheLoop<T extends Record<string, unknown> = Record<string, unknown>>(tool: ReactHumanInTheLoop<T>): void;
496
+ declare function useHumanInTheLoop<T extends Record<string, unknown> = Record<string, unknown>>(tool: ReactHumanInTheLoop<T>, deps?: ReadonlyArray<unknown>): void;
495
497
 
496
498
  declare enum UseAgentUpdate {
497
499
  OnMessagesChanged = "OnMessagesChanged",
@@ -503,7 +505,7 @@ interface UseAgentProps {
503
505
  updates?: UseAgentUpdate[];
504
506
  }
505
507
  declare function useAgent({ agentId, updates }?: UseAgentProps): {
506
- agent: AbstractAgent | undefined;
508
+ agent: AbstractAgent;
507
509
  };
508
510
 
509
511
  declare function useAgentContext(context: Context): void;
@@ -524,10 +526,7 @@ type StaticSuggestionsConfigInput = Omit<StaticSuggestionsConfig, "suggestions">
524
526
  suggestions: StaticSuggestionInput[];
525
527
  };
526
528
  type SuggestionsConfigInput = DynamicSuggestionsConfig | StaticSuggestionsConfigInput;
527
- interface UseConfigureSuggestionsOptions {
528
- deps?: ReadonlyArray<unknown>;
529
- }
530
- declare function useConfigureSuggestions(config: SuggestionsConfigInput | null | undefined, options?: UseConfigureSuggestionsOptions): void;
529
+ declare function useConfigureSuggestions(config: SuggestionsConfigInput | null | undefined, deps?: ReadonlyArray<unknown>): void;
531
530
 
532
531
  interface ReactActivityMessageRenderer<TActivityContent> {
533
532
  /**
@@ -608,8 +607,7 @@ declare class CopilotKitCoreReact extends CopilotKitCore {
608
607
  get renderActivityMessages(): Readonly<ReactActivityMessageRenderer<any>>[];
609
608
  get renderToolCalls(): Readonly<ReactToolCallRenderer<any>>[];
610
609
  setRenderToolCalls(renderToolCalls: ReactToolCallRenderer<any>[]): void;
611
- subscribe(subscriber: CopilotKitCoreReactSubscriber): () => void;
612
- unsubscribe(subscriber: CopilotKitCoreReactSubscriber): void;
610
+ subscribe(subscriber: CopilotKitCoreReactSubscriber): CopilotKitCoreSubscription;
613
611
  }
614
612
 
615
613
  interface CopilotKitContextValue {