@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,42 @@
|
|
|
1
|
+
import { Type, TemplateRef } from "@angular/core";
|
|
2
|
+
import { Message } from "@ag-ui/client";
|
|
3
|
+
/**
|
|
4
|
+
* Props for CopilotChatView component
|
|
5
|
+
*/
|
|
6
|
+
export interface CopilotChatViewProps {
|
|
7
|
+
messages?: Message[];
|
|
8
|
+
autoScroll?: boolean;
|
|
9
|
+
messageViewComponent?: Type<any>;
|
|
10
|
+
messageViewTemplate?: TemplateRef<any>;
|
|
11
|
+
messageViewClass?: string;
|
|
12
|
+
scrollViewComponent?: Type<any>;
|
|
13
|
+
scrollViewTemplate?: TemplateRef<any>;
|
|
14
|
+
scrollViewClass?: string;
|
|
15
|
+
scrollToBottomButtonComponent?: Type<any>;
|
|
16
|
+
scrollToBottomButtonTemplate?: TemplateRef<any>;
|
|
17
|
+
scrollToBottomButtonClass?: string;
|
|
18
|
+
inputComponent?: Type<any>;
|
|
19
|
+
inputTemplate?: TemplateRef<any>;
|
|
20
|
+
inputContainerComponent?: Type<any>;
|
|
21
|
+
inputContainerTemplate?: TemplateRef<any>;
|
|
22
|
+
inputContainerClass?: string;
|
|
23
|
+
featherComponent?: Type<any>;
|
|
24
|
+
featherTemplate?: TemplateRef<any>;
|
|
25
|
+
featherClass?: string;
|
|
26
|
+
disclaimerComponent?: Type<any>;
|
|
27
|
+
disclaimerTemplate?: TemplateRef<any>;
|
|
28
|
+
disclaimerClass?: string;
|
|
29
|
+
disclaimerText?: string;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Context for custom layout template
|
|
33
|
+
*/
|
|
34
|
+
export interface CopilotChatViewLayoutContext {
|
|
35
|
+
messageView: any;
|
|
36
|
+
input: any;
|
|
37
|
+
scrollView: any;
|
|
38
|
+
scrollToBottomButton: any;
|
|
39
|
+
feather: any;
|
|
40
|
+
inputContainer: any;
|
|
41
|
+
disclaimer: any;
|
|
42
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { ChangeDetectorRef, Injector, Type } from "@angular/core";
|
|
2
|
+
import { ChatState } from "../../chat-state";
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
/**
|
|
5
|
+
* CopilotChat component - Angular equivalent of React's <CopilotChat>
|
|
6
|
+
* Provides a complete chat interface that wires an agent to the chat view
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```html
|
|
10
|
+
* <copilot-chat [agentId]="'default'" [threadId]="'abc123'"></copilot-chat>
|
|
11
|
+
* ```
|
|
12
|
+
*/
|
|
13
|
+
export declare class CopilotChat implements ChatState {
|
|
14
|
+
readonly inputValue: import("@angular/core").WritableSignal<string>;
|
|
15
|
+
readonly agentId: import("@angular/core").InputSignal<string>;
|
|
16
|
+
readonly threadId: import("@angular/core").InputSignal<string>;
|
|
17
|
+
readonly inputComponent: import("@angular/core").InputSignal<Type<any>>;
|
|
18
|
+
private readonly resolvedAgentId;
|
|
19
|
+
readonly agentStore: import("@angular/core").Signal<import("../../agent").AgentStore>;
|
|
20
|
+
readonly cdr: ChangeDetectorRef;
|
|
21
|
+
readonly injector: Injector;
|
|
22
|
+
protected messages: import("@angular/core").Signal<({
|
|
23
|
+
id: string;
|
|
24
|
+
role: "developer";
|
|
25
|
+
content: string;
|
|
26
|
+
name?: string;
|
|
27
|
+
} | {
|
|
28
|
+
id: string;
|
|
29
|
+
role: "system";
|
|
30
|
+
content: string;
|
|
31
|
+
name?: string;
|
|
32
|
+
} | {
|
|
33
|
+
id: string;
|
|
34
|
+
role: "assistant";
|
|
35
|
+
name?: string;
|
|
36
|
+
content?: string;
|
|
37
|
+
toolCalls?: {
|
|
38
|
+
function: {
|
|
39
|
+
name: string;
|
|
40
|
+
arguments: string;
|
|
41
|
+
};
|
|
42
|
+
type: "function";
|
|
43
|
+
id: string;
|
|
44
|
+
}[];
|
|
45
|
+
} | {
|
|
46
|
+
id: string;
|
|
47
|
+
role: "user";
|
|
48
|
+
content: string | ({
|
|
49
|
+
type: "text";
|
|
50
|
+
text: string;
|
|
51
|
+
} | {
|
|
52
|
+
type: "binary";
|
|
53
|
+
mimeType: string;
|
|
54
|
+
id?: string;
|
|
55
|
+
url?: string;
|
|
56
|
+
data?: string;
|
|
57
|
+
filename?: string;
|
|
58
|
+
})[];
|
|
59
|
+
name?: string;
|
|
60
|
+
} | {
|
|
61
|
+
id: string;
|
|
62
|
+
role: "tool";
|
|
63
|
+
content: string;
|
|
64
|
+
toolCallId: string;
|
|
65
|
+
error?: string;
|
|
66
|
+
} | {
|
|
67
|
+
id: string;
|
|
68
|
+
role: "activity";
|
|
69
|
+
content: Record<string, any>;
|
|
70
|
+
activityType: string;
|
|
71
|
+
})[]>;
|
|
72
|
+
protected isRunning: import("@angular/core").Signal<boolean>;
|
|
73
|
+
protected showCursor: import("@angular/core").WritableSignal<boolean>;
|
|
74
|
+
private generatedThreadId;
|
|
75
|
+
private hasConnectedOnce;
|
|
76
|
+
constructor();
|
|
77
|
+
private connectToAgent;
|
|
78
|
+
submitInput(value: string): Promise<void>;
|
|
79
|
+
changeInput(value: string): void;
|
|
80
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<CopilotChat, never>;
|
|
81
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<CopilotChat, "copilot-chat", never, { "agentId": { "alias": "agentId"; "required": false; "isSignal": true; }; "threadId": { "alias": "threadId"; "required": false; "isSignal": true; }; "inputComponent": { "alias": "inputComponent"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
82
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { InjectionToken, Provider } from "@angular/core";
|
|
2
|
+
import { AbstractAgent } from "@ag-ui/client";
|
|
3
|
+
import { ClientTool, FrontendToolConfig, HumanInTheLoopConfig, RenderToolCallConfig } from "./tools";
|
|
4
|
+
export interface CopilotKitConfig {
|
|
5
|
+
runtimeUrl?: string;
|
|
6
|
+
headers?: Record<string, string>;
|
|
7
|
+
properties?: Record<string, unknown>;
|
|
8
|
+
agents?: Record<string, AbstractAgent>;
|
|
9
|
+
tools?: ClientTool[];
|
|
10
|
+
renderToolCalls?: RenderToolCallConfig[];
|
|
11
|
+
frontendTools?: FrontendToolConfig[];
|
|
12
|
+
humanInTheLoop?: HumanInTheLoopConfig[];
|
|
13
|
+
}
|
|
14
|
+
export declare const COPILOT_KIT_CONFIG: InjectionToken<CopilotKitConfig>;
|
|
15
|
+
export declare function injectCopilotKitConfig(): CopilotKitConfig;
|
|
16
|
+
export declare function provideCopilotKit(config: CopilotKitConfig): Provider;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { AbstractAgent } from "@ag-ui/client";
|
|
2
|
+
import { CopilotKitCore } from "@copilotkitnext/core";
|
|
3
|
+
import { Injector, Signal } from "@angular/core";
|
|
4
|
+
import { FrontendToolConfig, HumanInTheLoopConfig, RenderToolCallConfig } from "./tools";
|
|
5
|
+
import * as i0 from "@angular/core";
|
|
6
|
+
export declare class CopilotKit {
|
|
7
|
+
#private;
|
|
8
|
+
readonly agents: Signal<Record<string, AbstractAgent>>;
|
|
9
|
+
readonly core: CopilotKitCore;
|
|
10
|
+
readonly toolCallRenderConfigs: Signal<RenderToolCallConfig[]>;
|
|
11
|
+
readonly clientToolCallRenderConfigs: Signal<FrontendToolConfig[]>;
|
|
12
|
+
readonly humanInTheLoopToolRenderConfigs: Signal<HumanInTheLoopConfig[]>;
|
|
13
|
+
constructor();
|
|
14
|
+
addFrontendTool(clientToolWithInjector: FrontendToolConfig & {
|
|
15
|
+
injector: Injector;
|
|
16
|
+
}): void;
|
|
17
|
+
addRenderToolCall(renderConfig: RenderToolCallConfig): void;
|
|
18
|
+
addHumanInTheLoop(humanInTheLoopTool: HumanInTheLoopConfig): void;
|
|
19
|
+
removeTool(toolName: string, agentId?: string): void;
|
|
20
|
+
getAgent(agentId: string): AbstractAgent | undefined;
|
|
21
|
+
updateRuntime(options: {
|
|
22
|
+
runtimeUrl?: string;
|
|
23
|
+
headers?: Record<string, string>;
|
|
24
|
+
properties?: Record<string, unknown>;
|
|
25
|
+
agents?: Record<string, AbstractAgent>;
|
|
26
|
+
}): void;
|
|
27
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<CopilotKit, never>;
|
|
28
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<CopilotKit>;
|
|
29
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { OnInit, OnChanges, OnDestroy, SimpleChanges } from "@angular/core";
|
|
2
|
+
import { CopilotKit } from "../copilotkit";
|
|
3
|
+
import type { Context } from "@ag-ui/client";
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
/**
|
|
6
|
+
* Directive to manage agent context in CopilotKit.
|
|
7
|
+
* Automatically adds context on init, updates on changes, and removes on destroy.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```html
|
|
11
|
+
* <!-- With separate inputs -->
|
|
12
|
+
* <div copilotkitAgentContext
|
|
13
|
+
* [description]="'User preferences'"
|
|
14
|
+
* [value]="userSettings">
|
|
15
|
+
* </div>
|
|
16
|
+
*
|
|
17
|
+
* <!-- With context object -->
|
|
18
|
+
* <div [copilotkitAgentContext]="contextObject">
|
|
19
|
+
* </div>
|
|
20
|
+
*
|
|
21
|
+
* <!-- With dynamic values -->
|
|
22
|
+
* <div copilotkitAgentContext
|
|
23
|
+
* description="Form state"
|
|
24
|
+
* [value]="formData$ | async">
|
|
25
|
+
* </div>
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
export declare class CopilotKitAgentContext implements OnInit, OnChanges, OnDestroy {
|
|
29
|
+
private readonly copilotkit;
|
|
30
|
+
private contextId?;
|
|
31
|
+
constructor(copilotkit: CopilotKit);
|
|
32
|
+
/**
|
|
33
|
+
* Context object containing both description and value.
|
|
34
|
+
* If provided, this takes precedence over individual inputs.
|
|
35
|
+
*/
|
|
36
|
+
context?: Context;
|
|
37
|
+
/**
|
|
38
|
+
* Description of the context.
|
|
39
|
+
* Used when context object is not provided.
|
|
40
|
+
*/
|
|
41
|
+
description?: string;
|
|
42
|
+
/**
|
|
43
|
+
* Value of the context.
|
|
44
|
+
* Used when context object is not provided.
|
|
45
|
+
*/
|
|
46
|
+
value?: any;
|
|
47
|
+
ngOnInit(): void;
|
|
48
|
+
ngOnChanges(changes: SimpleChanges): void;
|
|
49
|
+
ngOnDestroy(): void;
|
|
50
|
+
/**
|
|
51
|
+
* Adds the context to CopilotKit
|
|
52
|
+
*/
|
|
53
|
+
private addContext;
|
|
54
|
+
/**
|
|
55
|
+
* Updates the context by removing the old one and adding a new one
|
|
56
|
+
*/
|
|
57
|
+
private updateContext;
|
|
58
|
+
/**
|
|
59
|
+
* Removes the current context from CopilotKit
|
|
60
|
+
*/
|
|
61
|
+
private removeContext;
|
|
62
|
+
/**
|
|
63
|
+
* Gets the context object from inputs
|
|
64
|
+
*/
|
|
65
|
+
private getContext;
|
|
66
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<CopilotKitAgentContext, never>;
|
|
67
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<CopilotKitAgentContext, "[copilotkitAgentContext]", never, { "context": { "alias": "copilotkitAgentContext"; "required": false; }; "description": { "alias": "description"; "required": false; }; "value": { "alias": "value"; "required": false; }; }, {}, never, never, true, never>;
|
|
68
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { OnInit, OnDestroy, AfterViewInit } from "@angular/core";
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
export type ScrollBehavior = "smooth" | "instant" | "auto";
|
|
4
|
+
/**
|
|
5
|
+
* Directive for implementing stick-to-bottom scroll behavior
|
|
6
|
+
* Similar to the React use-stick-to-bottom library
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```html
|
|
10
|
+
* <div copilotStickToBottom
|
|
11
|
+
* [enabled]="true"
|
|
12
|
+
* [threshold]="10"
|
|
13
|
+
* [initialBehavior]="'smooth'"
|
|
14
|
+
* [resizeBehavior]="'smooth'"
|
|
15
|
+
* (isAtBottomChange)="onBottomChange($event)">
|
|
16
|
+
* <!-- Content -->
|
|
17
|
+
* </div>
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
export declare class StickToBottom implements OnInit, AfterViewInit, OnDestroy {
|
|
21
|
+
enabled: import("@angular/core").InputSignal<boolean>;
|
|
22
|
+
threshold: import("@angular/core").InputSignal<number>;
|
|
23
|
+
initialBehavior: import("@angular/core").InputSignal<ScrollBehavior>;
|
|
24
|
+
resizeBehavior: import("@angular/core").InputSignal<ScrollBehavior>;
|
|
25
|
+
debounceMs: import("@angular/core").InputSignal<number>;
|
|
26
|
+
isAtBottomChange: import("@angular/core").OutputEmitterRef<boolean>;
|
|
27
|
+
scrollToBottomRequested: import("@angular/core").OutputEmitterRef<void>;
|
|
28
|
+
private elementRef;
|
|
29
|
+
private scrollService;
|
|
30
|
+
private resizeService;
|
|
31
|
+
private destroy$;
|
|
32
|
+
private contentElement?;
|
|
33
|
+
private wasAtBottom;
|
|
34
|
+
private hasInitialized;
|
|
35
|
+
private userHasScrolled;
|
|
36
|
+
ngOnInit(): void;
|
|
37
|
+
ngAfterViewInit(): void;
|
|
38
|
+
private setupScrollMonitoring;
|
|
39
|
+
private setupResizeMonitoring;
|
|
40
|
+
private setupContentMutationObserver;
|
|
41
|
+
/**
|
|
42
|
+
* Public method to scroll to bottom
|
|
43
|
+
* Can be called from parent component
|
|
44
|
+
*/
|
|
45
|
+
scrollToBottom(behavior?: ScrollBehavior): void;
|
|
46
|
+
/**
|
|
47
|
+
* Check if currently at bottom
|
|
48
|
+
*/
|
|
49
|
+
isAtBottom(): boolean;
|
|
50
|
+
/**
|
|
51
|
+
* Get current scroll state
|
|
52
|
+
*/
|
|
53
|
+
getScrollState(): {
|
|
54
|
+
scrollTop: any;
|
|
55
|
+
scrollHeight: any;
|
|
56
|
+
clientHeight: any;
|
|
57
|
+
isAtBottom: boolean;
|
|
58
|
+
};
|
|
59
|
+
ngOnDestroy(): void;
|
|
60
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<StickToBottom, never>;
|
|
61
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<StickToBottom, "[copilotStickToBottom]", never, { "enabled": { "alias": "enabled"; "required": false; "isSignal": true; }; "threshold": { "alias": "threshold"; "required": false; "isSignal": true; }; "initialBehavior": { "alias": "initialBehavior"; "required": false; "isSignal": true; }; "resizeBehavior": { "alias": "resizeBehavior"; "required": false; "isSignal": true; }; "debounceMs": { "alias": "debounceMs"; "required": false; "isSignal": true; }; }, { "isAtBottomChange": "isAtBottomChange"; "scrollToBottomRequested": "scrollToBottomRequested"; }, never, never, true, never>;
|
|
62
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { OnDestroy } from "@angular/core";
|
|
2
|
+
import { ChangeDetectorRef } from "@angular/core";
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
export declare class TooltipContent {
|
|
5
|
+
private cdr;
|
|
6
|
+
text: string;
|
|
7
|
+
private _position;
|
|
8
|
+
get position(): "above" | "below" | "left" | "right";
|
|
9
|
+
set position(value: "above" | "below" | "left" | "right");
|
|
10
|
+
constructor(cdr: ChangeDetectorRef);
|
|
11
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<TooltipContent, never>;
|
|
12
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<TooltipContent, "copilot-tooltip-content", never, {}, {}, never, never, true, never>;
|
|
13
|
+
}
|
|
14
|
+
export declare class CopilotTooltip implements OnDestroy {
|
|
15
|
+
tooltipText: string;
|
|
16
|
+
tooltipPosition: "above" | "below" | "left" | "right";
|
|
17
|
+
tooltipDelay: number;
|
|
18
|
+
private overlay;
|
|
19
|
+
private overlayPositionBuilder;
|
|
20
|
+
private elementRef;
|
|
21
|
+
private viewContainerRef;
|
|
22
|
+
private overlayRef?;
|
|
23
|
+
private tooltipTimeout?;
|
|
24
|
+
private originalTitle?;
|
|
25
|
+
onMouseEnter(): void;
|
|
26
|
+
onMouseLeave(): void;
|
|
27
|
+
private show;
|
|
28
|
+
private hide;
|
|
29
|
+
private getPositions;
|
|
30
|
+
ngOnDestroy(): void;
|
|
31
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<CopilotTooltip, never>;
|
|
32
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<CopilotTooltip, "[copilotTooltip]", never, { "tooltipText": { "alias": "copilotTooltip"; "required": false; }; "tooltipPosition": { "alias": "tooltipPosition"; "required": false; }; "tooltipDelay": { "alias": "tooltipDelay"; "required": false; }; }, {}, never, never, true, never>;
|
|
33
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Subject } from "rxjs";
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
export declare class HumanInTheLoop {
|
|
4
|
+
results: Subject<{
|
|
5
|
+
toolCallId: string;
|
|
6
|
+
toolName: string;
|
|
7
|
+
result: unknown;
|
|
8
|
+
}>;
|
|
9
|
+
addResult(toolCallId: string, toolName: string, result: unknown): void;
|
|
10
|
+
onResult(toolCallId: string, toolName: string): Promise<unknown>;
|
|
11
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<HumanInTheLoop, never>;
|
|
12
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<HumanInTheLoop>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { ToolCall } from "@ag-ui/client";
|
|
2
|
+
import { FrontendToolConfig, HumanInTheLoopToolCall, HumanInTheLoopConfig, AngularToolCall, RenderToolCallConfig } from "./tools";
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
type RendererToolCallHandler = {
|
|
5
|
+
type: "renderer";
|
|
6
|
+
config: RenderToolCallConfig;
|
|
7
|
+
};
|
|
8
|
+
type ClientToolCallHandler = {
|
|
9
|
+
type: "clientTool";
|
|
10
|
+
config: FrontendToolConfig;
|
|
11
|
+
};
|
|
12
|
+
type HumanInTheLoopToolCallHandler = {
|
|
13
|
+
type: "humanInTheLoopTool";
|
|
14
|
+
config: HumanInTheLoopConfig;
|
|
15
|
+
};
|
|
16
|
+
type ToolCallHandler = RendererToolCallHandler | ClientToolCallHandler | HumanInTheLoopToolCallHandler;
|
|
17
|
+
export declare class RenderToolCalls {
|
|
18
|
+
#private;
|
|
19
|
+
readonly message: import("@angular/core").InputSignal<{
|
|
20
|
+
id: string;
|
|
21
|
+
role: "assistant";
|
|
22
|
+
name?: string;
|
|
23
|
+
content?: string;
|
|
24
|
+
toolCalls?: {
|
|
25
|
+
function: {
|
|
26
|
+
name: string;
|
|
27
|
+
arguments: string;
|
|
28
|
+
};
|
|
29
|
+
type: "function";
|
|
30
|
+
id: string;
|
|
31
|
+
}[];
|
|
32
|
+
}>;
|
|
33
|
+
readonly messages: import("@angular/core").InputSignal<({
|
|
34
|
+
id: string;
|
|
35
|
+
role: "developer";
|
|
36
|
+
content: string;
|
|
37
|
+
name?: string;
|
|
38
|
+
} | {
|
|
39
|
+
id: string;
|
|
40
|
+
role: "system";
|
|
41
|
+
content: string;
|
|
42
|
+
name?: string;
|
|
43
|
+
} | {
|
|
44
|
+
id: string;
|
|
45
|
+
role: "assistant";
|
|
46
|
+
name?: string;
|
|
47
|
+
content?: string;
|
|
48
|
+
toolCalls?: {
|
|
49
|
+
function: {
|
|
50
|
+
name: string;
|
|
51
|
+
arguments: string;
|
|
52
|
+
};
|
|
53
|
+
type: "function";
|
|
54
|
+
id: string;
|
|
55
|
+
}[];
|
|
56
|
+
} | {
|
|
57
|
+
id: string;
|
|
58
|
+
role: "user";
|
|
59
|
+
content: string | ({
|
|
60
|
+
type: "text";
|
|
61
|
+
text: string;
|
|
62
|
+
} | {
|
|
63
|
+
type: "binary";
|
|
64
|
+
mimeType: string;
|
|
65
|
+
id?: string;
|
|
66
|
+
url?: string;
|
|
67
|
+
data?: string;
|
|
68
|
+
filename?: string;
|
|
69
|
+
})[];
|
|
70
|
+
name?: string;
|
|
71
|
+
} | {
|
|
72
|
+
id: string;
|
|
73
|
+
role: "tool";
|
|
74
|
+
content: string;
|
|
75
|
+
toolCallId: string;
|
|
76
|
+
error?: string;
|
|
77
|
+
} | {
|
|
78
|
+
id: string;
|
|
79
|
+
role: "activity";
|
|
80
|
+
content: Record<string, any>;
|
|
81
|
+
activityType: string;
|
|
82
|
+
})[]>;
|
|
83
|
+
readonly isLoading: import("@angular/core").InputSignal<boolean>;
|
|
84
|
+
protected pickRenderer(name: string): ToolCallHandler | undefined;
|
|
85
|
+
protected buildToolCall<Args extends Record<string, unknown>>(toolCall: ToolCall): AngularToolCall<Args>;
|
|
86
|
+
protected buildHumanInTheLoopToolCall<Args extends Record<string, unknown>>(toolCall: ToolCall): HumanInTheLoopToolCall<Args>;
|
|
87
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<RenderToolCalls, never>;
|
|
88
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<RenderToolCalls, "copilot-render-tool-calls", never, { "message": { "alias": "message"; "required": true; "isSignal": true; }; "messages": { "alias": "messages"; "required": true; "isSignal": true; }; "isLoading": { "alias": "isLoading"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
89
|
+
}
|
|
90
|
+
export {};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { ElementRef, NgZone, OnDestroy } from "@angular/core";
|
|
2
|
+
import { Observable } from "rxjs";
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
export interface ResizeState {
|
|
5
|
+
width: number;
|
|
6
|
+
height: number;
|
|
7
|
+
isResizing: boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare class ResizeObserverService implements OnDestroy {
|
|
10
|
+
private ngZone;
|
|
11
|
+
private destroy$;
|
|
12
|
+
private observers;
|
|
13
|
+
private resizeStates;
|
|
14
|
+
private resizeTimeouts;
|
|
15
|
+
constructor(ngZone: NgZone);
|
|
16
|
+
/**
|
|
17
|
+
* Observe element resize with debouncing and resizing state
|
|
18
|
+
* @param element Element to observe
|
|
19
|
+
* @param debounceMs Debounce time (default 250ms)
|
|
20
|
+
* @param resizingDurationMs How long to show "isResizing" state (default 250ms)
|
|
21
|
+
*/
|
|
22
|
+
observeElement(element: ElementRef<HTMLElement> | HTMLElement, debounceMs?: number, resizingDurationMs?: number): Observable<ResizeState>;
|
|
23
|
+
/**
|
|
24
|
+
* Stop observing an element
|
|
25
|
+
* @param element Element to stop observing
|
|
26
|
+
*/
|
|
27
|
+
unobserve(element: ElementRef<HTMLElement> | HTMLElement): void;
|
|
28
|
+
/**
|
|
29
|
+
* Get current size of element
|
|
30
|
+
* @param element Element to measure
|
|
31
|
+
*/
|
|
32
|
+
getCurrentSize(element: ElementRef<HTMLElement> | HTMLElement): {
|
|
33
|
+
width: number;
|
|
34
|
+
height: number;
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* Get current resize state of element
|
|
38
|
+
* @param element Element to check
|
|
39
|
+
*/
|
|
40
|
+
getCurrentState(element: ElementRef<HTMLElement> | HTMLElement): ResizeState | null;
|
|
41
|
+
ngOnDestroy(): void;
|
|
42
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ResizeObserverService, never>;
|
|
43
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<ResizeObserverService>;
|
|
44
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { ElementRef, NgZone, OnDestroy } from "@angular/core";
|
|
2
|
+
import { ScrollDispatcher, ViewportRuler } from "@angular/cdk/scrolling";
|
|
3
|
+
import { Observable } from "rxjs";
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
export interface ScrollState {
|
|
6
|
+
isAtBottom: boolean;
|
|
7
|
+
scrollTop: number;
|
|
8
|
+
scrollHeight: number;
|
|
9
|
+
clientHeight: number;
|
|
10
|
+
}
|
|
11
|
+
export declare class ScrollPosition implements OnDestroy {
|
|
12
|
+
private scrollDispatcher;
|
|
13
|
+
private viewportRuler;
|
|
14
|
+
private ngZone;
|
|
15
|
+
private destroy$;
|
|
16
|
+
private scrollStateSubject;
|
|
17
|
+
scrollState$: Observable<ScrollState>;
|
|
18
|
+
constructor(scrollDispatcher: ScrollDispatcher, viewportRuler: ViewportRuler, ngZone: NgZone);
|
|
19
|
+
/**
|
|
20
|
+
* Monitor scroll position of an element
|
|
21
|
+
* @param element The element to monitor
|
|
22
|
+
* @param threshold Pixels from bottom to consider "at bottom" (default 10)
|
|
23
|
+
*/
|
|
24
|
+
monitorScrollPosition(element: ElementRef<HTMLElement> | HTMLElement, threshold?: number): Observable<ScrollState>;
|
|
25
|
+
/**
|
|
26
|
+
* Scroll element to bottom with smooth animation
|
|
27
|
+
* @param element The element to scroll
|
|
28
|
+
* @param smooth Whether to use smooth scrolling
|
|
29
|
+
*/
|
|
30
|
+
scrollToBottom(element: ElementRef<HTMLElement> | HTMLElement, smooth?: boolean): void;
|
|
31
|
+
/**
|
|
32
|
+
* Check if element is at bottom
|
|
33
|
+
* @param element The element to check
|
|
34
|
+
* @param threshold Pixels from bottom to consider "at bottom"
|
|
35
|
+
*/
|
|
36
|
+
isAtBottom(element: ElementRef<HTMLElement> | HTMLElement, threshold?: number): boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Get current scroll state of element
|
|
39
|
+
*/
|
|
40
|
+
getScrollState(element: HTMLElement, threshold: number): ScrollState;
|
|
41
|
+
/**
|
|
42
|
+
* Create a ResizeObserver for element size changes
|
|
43
|
+
* @param element The element to observe
|
|
44
|
+
* @param debounceMs Debounce time in milliseconds
|
|
45
|
+
*/
|
|
46
|
+
observeResize(element: ElementRef<HTMLElement> | HTMLElement, debounceMs?: number): Observable<ResizeObserverEntry>;
|
|
47
|
+
ngOnDestroy(): void;
|
|
48
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ScrollPosition, never>;
|
|
49
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<ScrollPosition>;
|
|
50
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { TemplateRef, ViewContainerRef, OnInit, OnChanges, SimpleChanges, ChangeDetectorRef } from "@angular/core";
|
|
2
|
+
import { Type } from "@angular/core";
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
/**
|
|
5
|
+
* @internal - This component is for internal use only.
|
|
6
|
+
* Simple slot component for rendering custom content or defaults.
|
|
7
|
+
* Supports templates and components only.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```html
|
|
11
|
+
* <!-- With template -->
|
|
12
|
+
* <copilot-slot [slot]="sendButtonTemplate" [context]="buttonContext">
|
|
13
|
+
* <button class="default-btn">Default</button>
|
|
14
|
+
* </copilot-slot>
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
export declare class CopilotSlot implements OnInit, OnChanges {
|
|
18
|
+
private viewContainer;
|
|
19
|
+
private cdr;
|
|
20
|
+
slot: import("@angular/core").InputSignal<Type<any> | TemplateRef<any>>;
|
|
21
|
+
context: import("@angular/core").InputSignal<any>;
|
|
22
|
+
defaultComponent: import("@angular/core").InputSignal<Type<any>>;
|
|
23
|
+
outputs: import("@angular/core").InputSignal<Record<string, (event: any) => void>>;
|
|
24
|
+
private slotContainer;
|
|
25
|
+
private componentRef?;
|
|
26
|
+
constructor(viewContainer: ViewContainerRef, cdr: ChangeDetectorRef);
|
|
27
|
+
ngOnInit(): void;
|
|
28
|
+
ngOnChanges(changes: SimpleChanges): void;
|
|
29
|
+
isTemplate(value: any): value is TemplateRef<any>;
|
|
30
|
+
private renderSlot;
|
|
31
|
+
private updateComponentProps;
|
|
32
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<CopilotSlot, never>;
|
|
33
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<CopilotSlot, "copilot-slot", never, { "slot": { "alias": "slot"; "required": false; "isSignal": true; }; "context": { "alias": "context"; "required": false; "isSignal": true; }; "defaultComponent": { "alias": "defaultComponent"; "required": false; "isSignal": true; }; "outputs": { "alias": "outputs"; "required": false; "isSignal": true; }; }, {}, never, ["*"], true, never>;
|
|
34
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { Type, TemplateRef, InjectionToken } from "@angular/core";
|
|
2
|
+
/**
|
|
3
|
+
* Represents a value that can be used as a slot override.
|
|
4
|
+
* Can be a component type or template reference only.
|
|
5
|
+
* @internal - This type is for internal use only
|
|
6
|
+
*/
|
|
7
|
+
export type SlotValue<T = any> = Type<T> | TemplateRef<T>;
|
|
8
|
+
/**
|
|
9
|
+
* Configuration for a slot
|
|
10
|
+
* @internal - This interface is for internal use only
|
|
11
|
+
*/
|
|
12
|
+
export interface SlotConfig<T = any> {
|
|
13
|
+
value?: SlotValue<T>;
|
|
14
|
+
default?: Type<T>;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Context passed to slot templates
|
|
18
|
+
*/
|
|
19
|
+
export interface SlotContext<T = any> {
|
|
20
|
+
$implicit: T;
|
|
21
|
+
props?: Partial<T>;
|
|
22
|
+
[key: string]: any;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Slot registry entry
|
|
26
|
+
* @internal - This interface is for internal use only
|
|
27
|
+
*/
|
|
28
|
+
export interface SlotRegistryEntry<T = any> {
|
|
29
|
+
component?: Type<T>;
|
|
30
|
+
template?: TemplateRef<T>;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Options for rendering a slot
|
|
34
|
+
*/
|
|
35
|
+
export interface RenderSlotOptions<T = any> {
|
|
36
|
+
slot?: SlotValue<T>;
|
|
37
|
+
defaultComponent: Type<T>;
|
|
38
|
+
props?: Partial<T>;
|
|
39
|
+
injector?: any;
|
|
40
|
+
outputs?: Record<string, (event: any) => void>;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Injection token for slot configuration
|
|
44
|
+
*/
|
|
45
|
+
export declare const SLOT_CONFIG: InjectionToken<ReadonlyMap<string, SlotRegistryEntry<any>>>;
|
|
46
|
+
/**
|
|
47
|
+
* Type for components with slots
|
|
48
|
+
*/
|
|
49
|
+
export type WithSlots<S extends Record<string, Type<any>>, Rest = object> = {
|
|
50
|
+
[K in keyof S as `${string & K}Component`]?: Type<any>;
|
|
51
|
+
} & {
|
|
52
|
+
[K in keyof S as `${string & K}Template`]?: TemplateRef<any>;
|
|
53
|
+
} & {
|
|
54
|
+
[K in keyof S as `${string & K}Class`]?: string;
|
|
55
|
+
} & Rest;
|