@copilotkitnext/angular 0.0.0-max-changeset-20260109174803
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/LICENSE +10 -0
- package/README.md +530 -0
- package/dist/LICENSE +10 -0
- package/dist/README.md +530 -0
- package/dist/esm2022/copilotkitnext-angular.mjs +5 -0
- package/dist/esm2022/index.mjs +2 -0
- package/dist/esm2022/lib/agent-context.mjs +25 -0
- package/dist/esm2022/lib/agent.mjs +73 -0
- package/dist/esm2022/lib/chat-config.mjs +35 -0
- package/dist/esm2022/lib/chat-state.mjs +18 -0
- package/dist/esm2022/lib/components/chat/copilot-chat-assistant-message-buttons.mjs +344 -0
- package/dist/esm2022/lib/components/chat/copilot-chat-assistant-message-renderer.mjs +260 -0
- package/dist/esm2022/lib/components/chat/copilot-chat-assistant-message-toolbar.mjs +22 -0
- package/dist/esm2022/lib/components/chat/copilot-chat-assistant-message.mjs +415 -0
- package/dist/esm2022/lib/components/chat/copilot-chat-assistant-message.types.mjs +2 -0
- package/dist/esm2022/lib/components/chat/copilot-chat-audio-recorder.mjs +196 -0
- package/dist/esm2022/lib/components/chat/copilot-chat-buttons.mjs +299 -0
- package/dist/esm2022/lib/components/chat/copilot-chat-input-defaults.mjs +39 -0
- package/dist/esm2022/lib/components/chat/copilot-chat-input.mjs +634 -0
- package/dist/esm2022/lib/components/chat/copilot-chat-input.types.mjs +10 -0
- package/dist/esm2022/lib/components/chat/copilot-chat-message-view-cursor.mjs +27 -0
- package/dist/esm2022/lib/components/chat/copilot-chat-message-view.mjs +268 -0
- package/dist/esm2022/lib/components/chat/copilot-chat-message-view.types.mjs +2 -0
- package/dist/esm2022/lib/components/chat/copilot-chat-textarea.mjs +139 -0
- package/dist/esm2022/lib/components/chat/copilot-chat-tool-calls-view.mjs +36 -0
- package/dist/esm2022/lib/components/chat/copilot-chat-toolbar.mjs +20 -0
- package/dist/esm2022/lib/components/chat/copilot-chat-tools-menu.mjs +203 -0
- package/dist/esm2022/lib/components/chat/copilot-chat-user-message-branch-navigation.mjs +98 -0
- package/dist/esm2022/lib/components/chat/copilot-chat-user-message-buttons.mjs +182 -0
- package/dist/esm2022/lib/components/chat/copilot-chat-user-message-renderer.mjs +28 -0
- package/dist/esm2022/lib/components/chat/copilot-chat-user-message-toolbar.mjs +25 -0
- package/dist/esm2022/lib/components/chat/copilot-chat-user-message.mjs +308 -0
- package/dist/esm2022/lib/components/chat/copilot-chat-user-message.types.mjs +2 -0
- package/dist/esm2022/lib/components/chat/copilot-chat-view-disclaimer.mjs +48 -0
- package/dist/esm2022/lib/components/chat/copilot-chat-view-feather.mjs +41 -0
- package/dist/esm2022/lib/components/chat/copilot-chat-view-handlers.mjs +19 -0
- package/dist/esm2022/lib/components/chat/copilot-chat-view-input-container.mjs +96 -0
- package/dist/esm2022/lib/components/chat/copilot-chat-view-scroll-to-bottom-button.mjs +89 -0
- package/dist/esm2022/lib/components/chat/copilot-chat-view-scroll-view.mjs +456 -0
- package/dist/esm2022/lib/components/chat/copilot-chat-view.mjs +404 -0
- package/dist/esm2022/lib/components/chat/copilot-chat-view.types.mjs +2 -0
- package/dist/esm2022/lib/components/chat/copilot-chat.mjs +167 -0
- package/dist/esm2022/lib/config.mjs +9 -0
- package/dist/esm2022/lib/copilotkit.mjs +115 -0
- package/dist/esm2022/lib/directives/copilotkit-agent-context.mjs +130 -0
- package/dist/esm2022/lib/directives/stick-to-bottom.mjs +170 -0
- package/dist/esm2022/lib/directives/tooltip.mjs +217 -0
- package/dist/esm2022/lib/human-in-the-loop.mjs +19 -0
- package/dist/esm2022/lib/render-tool-calls.mjs +138 -0
- package/dist/esm2022/lib/resize-observer.mjs +152 -0
- package/dist/esm2022/lib/scroll-position.mjs +124 -0
- package/dist/esm2022/lib/slots/copilot-slot.mjs +156 -0
- package/dist/esm2022/lib/slots/index.mjs +4 -0
- package/dist/esm2022/lib/slots/slot.types.mjs +6 -0
- package/dist/esm2022/lib/slots/slot.utils.mjs +235 -0
- package/dist/esm2022/lib/tools.mjs +31 -0
- package/dist/esm2022/lib/utils.mjs +10 -0
- package/dist/esm2022/public-api.mjs +48 -0
- package/dist/fesm2022/copilotkitnext-angular.mjs +6310 -0
- package/dist/fesm2022/copilotkitnext-angular.mjs.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/lib/agent-context.d.ts +12 -0
- package/dist/lib/agent.d.ts +68 -0
- package/dist/lib/chat-config.d.ts +23 -0
- package/dist/lib/chat-state.d.ts +10 -0
- package/dist/lib/components/chat/copilot-chat-assistant-message-buttons.d.ts +68 -0
- package/dist/lib/components/chat/copilot-chat-assistant-message-renderer.d.ts +26 -0
- package/dist/lib/components/chat/copilot-chat-assistant-message-toolbar.d.ts +7 -0
- package/dist/lib/components/chat/copilot-chat-assistant-message.d.ts +208 -0
- package/dist/lib/components/chat/copilot-chat-assistant-message.types.d.ts +31 -0
- package/dist/lib/components/chat/copilot-chat-audio-recorder.d.ts +40 -0
- package/dist/lib/components/chat/copilot-chat-buttons.d.ts +65 -0
- package/dist/lib/components/chat/copilot-chat-input-defaults.d.ts +38 -0
- package/dist/lib/components/chat/copilot-chat-input.d.ts +133 -0
- package/dist/lib/components/chat/copilot-chat-input.types.d.ts +129 -0
- package/dist/lib/components/chat/copilot-chat-message-view-cursor.d.ts +11 -0
- package/dist/lib/components/chat/copilot-chat-message-view.d.ts +430 -0
- package/dist/lib/components/chat/copilot-chat-message-view.types.d.ts +24 -0
- package/dist/lib/components/chat/copilot-chat-textarea.d.ts +41 -0
- package/dist/lib/components/chat/copilot-chat-tool-calls-view.d.ts +70 -0
- package/dist/lib/components/chat/copilot-chat-toolbar.d.ts +7 -0
- package/dist/lib/components/chat/copilot-chat-tools-menu.d.ts +20 -0
- package/dist/lib/components/chat/copilot-chat-user-message-branch-navigation.d.ts +35 -0
- package/dist/lib/components/chat/copilot-chat-user-message-buttons.d.ts +35 -0
- package/dist/lib/components/chat/copilot-chat-user-message-renderer.d.ts +8 -0
- package/dist/lib/components/chat/copilot-chat-user-message-toolbar.d.ts +7 -0
- package/dist/lib/components/chat/copilot-chat-user-message.d.ts +71 -0
- package/dist/lib/components/chat/copilot-chat-user-message.types.d.ts +27 -0
- package/dist/lib/components/chat/copilot-chat-view-disclaimer.d.ts +15 -0
- package/dist/lib/components/chat/copilot-chat-view-feather.d.ts +15 -0
- package/dist/lib/components/chat/copilot-chat-view-handlers.d.ts +11 -0
- package/dist/lib/components/chat/copilot-chat-view-input-container.d.ts +23 -0
- package/dist/lib/components/chat/copilot-chat-view-scroll-to-bottom-button.d.ts +16 -0
- package/dist/lib/components/chat/copilot-chat-view-scroll-view.d.ts +129 -0
- package/dist/lib/components/chat/copilot-chat-view.d.ts +284 -0
- package/dist/lib/components/chat/copilot-chat-view.types.d.ts +42 -0
- package/dist/lib/components/chat/copilot-chat.d.ts +82 -0
- package/dist/lib/config.d.ts +16 -0
- package/dist/lib/copilotkit.d.ts +29 -0
- package/dist/lib/directives/copilotkit-agent-context.d.ts +68 -0
- package/dist/lib/directives/stick-to-bottom.d.ts +62 -0
- package/dist/lib/directives/tooltip.d.ts +33 -0
- package/dist/lib/human-in-the-loop.d.ts +13 -0
- package/dist/lib/render-tool-calls.d.ts +90 -0
- package/dist/lib/resize-observer.d.ts +44 -0
- package/dist/lib/scroll-position.d.ts +50 -0
- package/dist/lib/slots/copilot-slot.d.ts +34 -0
- package/dist/lib/slots/index.d.ts +3 -0
- package/dist/lib/slots/slot.types.d.ts +55 -0
- package/dist/lib/slots/slot.utils.d.ts +110 -0
- package/dist/lib/tools.d.ts +65 -0
- package/dist/lib/utils.d.ts +6 -0
- package/dist/public-api.d.ts +47 -0
- package/dist/styles.css +1882 -0
- package/eslint.config.mjs +20 -0
- package/package.json +101 -0
- package/tsconfig.json +33 -0
- package/vitest.config.mts +45 -0
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { Type, ViewContainerRef, ComponentRef, EmbeddedViewRef } from "@angular/core";
|
|
2
|
+
import { SlotValue, RenderSlotOptions, SlotRegistryEntry } from "./slot.types";
|
|
3
|
+
/**
|
|
4
|
+
* Renders a slot value into a ViewContainerRef.
|
|
5
|
+
* This is the core utility for slot rendering.
|
|
6
|
+
*
|
|
7
|
+
* @param viewContainer - The ViewContainerRef to render into
|
|
8
|
+
* @param options - Options for rendering the slot
|
|
9
|
+
* @returns The created component or embedded view reference
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```typescript
|
|
13
|
+
* export class MyComponent {
|
|
14
|
+
* @ViewChild('container', { read: ViewContainerRef }) container!: ViewContainerRef;
|
|
15
|
+
*
|
|
16
|
+
* renderButton() {
|
|
17
|
+
* renderSlot(this.container, {
|
|
18
|
+
* slot: this.buttonOverride,
|
|
19
|
+
* defaultComponent: DefaultButton,
|
|
20
|
+
* props: { text: 'Click me' },
|
|
21
|
+
* outputs: { click: (event) => this.handleClick(event) }
|
|
22
|
+
* });
|
|
23
|
+
* }
|
|
24
|
+
* }
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
export declare function renderSlot<T = any>(viewContainer: ViewContainerRef, options: RenderSlotOptions<T>): ComponentRef<T> | EmbeddedViewRef<T> | null;
|
|
28
|
+
/**
|
|
29
|
+
* Checks if a value is a component type.
|
|
30
|
+
* Simplified check - rely on try/catch for actual validation.
|
|
31
|
+
*/
|
|
32
|
+
export declare function isComponentType(value: any): boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Checks if a value is a valid slot value.
|
|
35
|
+
*/
|
|
36
|
+
export declare function isSlotValue(value: any): value is SlotValue;
|
|
37
|
+
/**
|
|
38
|
+
* Normalizes a slot value to a consistent format.
|
|
39
|
+
*/
|
|
40
|
+
export declare function normalizeSlotValue<T = any>(value: SlotValue<T> | undefined, defaultComponent: Type<T> | undefined): SlotRegistryEntry<T>;
|
|
41
|
+
/**
|
|
42
|
+
* Creates a slot configuration map for a component.
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* ```typescript
|
|
46
|
+
* const slots = createSlotConfig({
|
|
47
|
+
standalone: true,
|
|
48
|
+
* sendButton: CustomSendButton,
|
|
49
|
+
* toolbar: 'custom-toolbar-class',
|
|
50
|
+
* footer: footerTemplate
|
|
51
|
+
* }, {
|
|
52
|
+
* sendButton: DefaultSendButton,
|
|
53
|
+
* toolbar: DefaultToolbar,
|
|
54
|
+
* footer: DefaultFooter
|
|
55
|
+
* });
|
|
56
|
+
* ```
|
|
57
|
+
*/
|
|
58
|
+
export declare function createSlotConfig<T extends Record<string, Type<any>>>(overrides: Partial<Record<keyof T, SlotValue>>, defaults: T): Map<keyof T, SlotRegistryEntry>;
|
|
59
|
+
/**
|
|
60
|
+
* Provides slot configuration to child components via DI.
|
|
61
|
+
*
|
|
62
|
+
* @example
|
|
63
|
+
* ```typescript
|
|
64
|
+
* @Component({
|
|
65
|
+
standalone: true,
|
|
66
|
+
* providers: [
|
|
67
|
+
* provideSlots({
|
|
68
|
+
* sendButton: CustomSendButton,
|
|
69
|
+
* toolbar: CustomToolbar
|
|
70
|
+
* })
|
|
71
|
+
* ]
|
|
72
|
+
* })
|
|
73
|
+
* ```
|
|
74
|
+
*/
|
|
75
|
+
export declare function provideSlots(slots: Record<string, Type<any>>): {
|
|
76
|
+
provide: import("@angular/core").InjectionToken<ReadonlyMap<string, SlotRegistryEntry<any>>>;
|
|
77
|
+
useValue: Map<string, SlotRegistryEntry<any>>;
|
|
78
|
+
};
|
|
79
|
+
/**
|
|
80
|
+
* Gets slot configuration from DI.
|
|
81
|
+
* Must be called within an injection context.
|
|
82
|
+
*
|
|
83
|
+
* @example
|
|
84
|
+
* ```typescript
|
|
85
|
+
* export class MyComponent {
|
|
86
|
+
* slots = getSlotConfig();
|
|
87
|
+
*
|
|
88
|
+
* ngOnInit() {
|
|
89
|
+
* const sendButton = this.slots?.get('sendButton');
|
|
90
|
+
* }
|
|
91
|
+
* }
|
|
92
|
+
* ```
|
|
93
|
+
*/
|
|
94
|
+
export declare function getSlotConfig(): ReadonlyMap<string, SlotRegistryEntry> | null;
|
|
95
|
+
/**
|
|
96
|
+
* Creates a render function for a specific slot.
|
|
97
|
+
* Useful for creating reusable slot renderers.
|
|
98
|
+
*
|
|
99
|
+
* @example
|
|
100
|
+
* ```typescript
|
|
101
|
+
* const renderSendButton = createSlotRenderer(
|
|
102
|
+
* DefaultSendButton,
|
|
103
|
+
* 'sendButton'
|
|
104
|
+
* );
|
|
105
|
+
*
|
|
106
|
+
* // Later in template
|
|
107
|
+
* renderSendButton(this.viewContainer, this.sendButtonOverride);
|
|
108
|
+
* ```
|
|
109
|
+
*/
|
|
110
|
+
export declare function createSlotRenderer<T>(defaultComponent: Type<T>, slotName?: string): (viewContainer: ViewContainerRef, slot?: SlotValue<T>, props?: Partial<T>, outputs?: Record<string, (event: any) => void>) => ComponentRef<T> | EmbeddedViewRef<T>;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { Signal, Type } from "@angular/core";
|
|
2
|
+
import { FrontendTool } from "@copilotkitnext/core";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
export type AngularToolCall<Args extends Record<string, unknown> = Record<string, unknown>> = {
|
|
5
|
+
args: Partial<Args>;
|
|
6
|
+
status: "in-progress";
|
|
7
|
+
result: undefined;
|
|
8
|
+
} | {
|
|
9
|
+
args: Args;
|
|
10
|
+
status: "executing";
|
|
11
|
+
result: undefined;
|
|
12
|
+
} | {
|
|
13
|
+
args: Args;
|
|
14
|
+
status: "complete";
|
|
15
|
+
result: string;
|
|
16
|
+
};
|
|
17
|
+
export type HumanInTheLoopToolCall<Args extends Record<string, unknown> = Record<string, unknown>> = {
|
|
18
|
+
args: Partial<Args>;
|
|
19
|
+
status: "in-progress";
|
|
20
|
+
result: undefined;
|
|
21
|
+
respond: (result: unknown) => void;
|
|
22
|
+
} | {
|
|
23
|
+
args: Args;
|
|
24
|
+
status: "executing";
|
|
25
|
+
result: undefined;
|
|
26
|
+
respond: (result: unknown) => void;
|
|
27
|
+
} | {
|
|
28
|
+
args: Args;
|
|
29
|
+
status: "complete";
|
|
30
|
+
result: string;
|
|
31
|
+
respond: (result: unknown) => void;
|
|
32
|
+
};
|
|
33
|
+
export interface ToolRenderer<Args extends Record<string, unknown> = Record<string, unknown>> {
|
|
34
|
+
toolCall: Signal<AngularToolCall<Args>>;
|
|
35
|
+
}
|
|
36
|
+
export interface HumanInTheLoopToolRenderer<Args extends Record<string, unknown> = Record<string, unknown>> {
|
|
37
|
+
toolCall: Signal<HumanInTheLoopToolCall<Args>>;
|
|
38
|
+
}
|
|
39
|
+
export type ClientTool<Args extends Record<string, unknown> = Record<string, unknown>> = Omit<FrontendTool<Args>, "handler"> & {
|
|
40
|
+
renderer?: Type<ToolRenderer<Args>>;
|
|
41
|
+
};
|
|
42
|
+
export interface RenderToolCallConfig<Args extends Record<string, unknown> = Record<string, unknown>> {
|
|
43
|
+
name: string;
|
|
44
|
+
args: z.ZodType<Args>;
|
|
45
|
+
component: Type<ToolRenderer<Args>>;
|
|
46
|
+
agentId?: string;
|
|
47
|
+
}
|
|
48
|
+
export interface FrontendToolConfig<Args extends Record<string, unknown> = Record<string, unknown>> {
|
|
49
|
+
name: string;
|
|
50
|
+
description: string;
|
|
51
|
+
parameters: z.ZodType<Args>;
|
|
52
|
+
component?: Type<ToolRenderer<Args>>;
|
|
53
|
+
handler: (args: Args) => Promise<unknown>;
|
|
54
|
+
agentId?: string;
|
|
55
|
+
}
|
|
56
|
+
export interface HumanInTheLoopConfig<Args extends Record<string, unknown> = Record<string, unknown>> {
|
|
57
|
+
name: string;
|
|
58
|
+
description: string;
|
|
59
|
+
parameters: z.ZodType<Args>;
|
|
60
|
+
component: Type<HumanInTheLoopToolRenderer<Args>>;
|
|
61
|
+
agentId?: string;
|
|
62
|
+
}
|
|
63
|
+
export declare function registerRenderToolCall<Args extends Record<string, unknown> = Record<string, unknown>>(renderToolCall: RenderToolCallConfig<Args>): void;
|
|
64
|
+
export declare function registerFrontendTool<Args extends Record<string, unknown> = Record<string, unknown>>(frontendTool: FrontendToolConfig<Args>): void;
|
|
65
|
+
export declare function registerHumanInTheLoop<Args extends Record<string, unknown> = Record<string, unknown>>(humanInTheLoop: HumanInTheLoopConfig<Args>): void;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
export * from "./lib/config";
|
|
2
|
+
export * from "./lib/copilotkit";
|
|
3
|
+
export * from "./lib/tools";
|
|
4
|
+
export * from "./lib/render-tool-calls";
|
|
5
|
+
export * from "./lib/agent";
|
|
6
|
+
export * from "./lib/chat-config";
|
|
7
|
+
export * from "./lib/chat-state";
|
|
8
|
+
export * from "./lib/scroll-position";
|
|
9
|
+
export * from "./lib/resize-observer";
|
|
10
|
+
export * from "./lib/utils";
|
|
11
|
+
export * from "./lib/agent-context";
|
|
12
|
+
export * from "./lib/slots";
|
|
13
|
+
export * from "./lib/directives/copilotkit-agent-context";
|
|
14
|
+
export * from "./lib/directives/stick-to-bottom";
|
|
15
|
+
export * from "./lib/directives/tooltip";
|
|
16
|
+
export * from "./lib/components/chat/copilot-chat";
|
|
17
|
+
export * from "./lib/components/chat/copilot-chat-assistant-message";
|
|
18
|
+
export * from "./lib/components/chat/copilot-chat-assistant-message-buttons";
|
|
19
|
+
export * from "./lib/components/chat/copilot-chat-assistant-message-renderer";
|
|
20
|
+
export * from "./lib/components/chat/copilot-chat-assistant-message-toolbar";
|
|
21
|
+
export * from "./lib/components/chat/copilot-chat-assistant-message.types";
|
|
22
|
+
export * from "./lib/components/chat/copilot-chat-audio-recorder";
|
|
23
|
+
export * from "./lib/components/chat/copilot-chat-buttons";
|
|
24
|
+
export * from "./lib/components/chat/copilot-chat-input";
|
|
25
|
+
export * from "./lib/components/chat/copilot-chat-input-defaults";
|
|
26
|
+
export * from "./lib/components/chat/copilot-chat-input.types";
|
|
27
|
+
export * from "./lib/components/chat/copilot-chat-message-view";
|
|
28
|
+
export * from "./lib/components/chat/copilot-chat-message-view-cursor";
|
|
29
|
+
export * from "./lib/components/chat/copilot-chat-message-view.types";
|
|
30
|
+
export * from "./lib/components/chat/copilot-chat-textarea";
|
|
31
|
+
export * from "./lib/components/chat/copilot-chat-tool-calls-view";
|
|
32
|
+
export * from "./lib/components/chat/copilot-chat-toolbar";
|
|
33
|
+
export * from "./lib/components/chat/copilot-chat-tools-menu";
|
|
34
|
+
export * from "./lib/components/chat/copilot-chat-user-message";
|
|
35
|
+
export * from "./lib/components/chat/copilot-chat-user-message-branch-navigation";
|
|
36
|
+
export * from "./lib/components/chat/copilot-chat-user-message-buttons";
|
|
37
|
+
export * from "./lib/components/chat/copilot-chat-user-message-renderer";
|
|
38
|
+
export * from "./lib/components/chat/copilot-chat-user-message-toolbar";
|
|
39
|
+
export * from "./lib/components/chat/copilot-chat-user-message.types";
|
|
40
|
+
export * from "./lib/components/chat/copilot-chat-view";
|
|
41
|
+
export * from "./lib/components/chat/copilot-chat-view-disclaimer";
|
|
42
|
+
export * from "./lib/components/chat/copilot-chat-view-feather";
|
|
43
|
+
export * from "./lib/components/chat/copilot-chat-view-handlers";
|
|
44
|
+
export * from "./lib/components/chat/copilot-chat-view-input-container";
|
|
45
|
+
export * from "./lib/components/chat/copilot-chat-view-scroll-to-bottom-button";
|
|
46
|
+
export * from "./lib/components/chat/copilot-chat-view-scroll-view";
|
|
47
|
+
export * from "./lib/components/chat/copilot-chat-view.types";
|