@copilotkitnext/angular 0.0.9-alpha.3 → 0.0.10

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 (210) hide show
  1. package/dist/esm2022/index.mjs +2 -70
  2. package/dist/esm2022/lib/agent.mjs +73 -0
  3. package/dist/esm2022/lib/chat-config.mjs +35 -0
  4. package/dist/esm2022/lib/chat-state.mjs +18 -0
  5. package/dist/esm2022/lib/components/chat/copilot-chat-assistant-message-buttons.mjs +344 -0
  6. package/dist/esm2022/lib/components/chat/copilot-chat-assistant-message-renderer.mjs +260 -0
  7. package/dist/esm2022/lib/components/chat/copilot-chat-assistant-message-toolbar.mjs +22 -0
  8. package/dist/esm2022/{components/chat/copilot-chat-assistant-message.component.mjs → lib/components/chat/copilot-chat-assistant-message.mjs} +216 -240
  9. package/dist/esm2022/lib/components/chat/copilot-chat-assistant-message.types.mjs +2 -0
  10. package/dist/esm2022/lib/components/chat/copilot-chat-audio-recorder.mjs +196 -0
  11. package/dist/esm2022/lib/components/chat/copilot-chat-buttons.mjs +299 -0
  12. package/dist/esm2022/lib/components/chat/copilot-chat-input-defaults.mjs +39 -0
  13. package/dist/esm2022/lib/components/chat/copilot-chat-input.mjs +634 -0
  14. package/dist/esm2022/lib/components/chat/copilot-chat-input.types.mjs +10 -0
  15. package/dist/esm2022/lib/components/chat/copilot-chat-message-view-cursor.mjs +27 -0
  16. package/dist/esm2022/lib/components/chat/copilot-chat-message-view.mjs +268 -0
  17. package/dist/esm2022/lib/components/chat/copilot-chat-message-view.types.mjs +2 -0
  18. package/dist/esm2022/lib/components/chat/copilot-chat-textarea.mjs +139 -0
  19. package/dist/esm2022/lib/components/chat/copilot-chat-tool-calls-view.mjs +36 -0
  20. package/dist/esm2022/lib/components/chat/copilot-chat-toolbar.mjs +20 -0
  21. package/dist/esm2022/lib/components/chat/copilot-chat-tools-menu.mjs +203 -0
  22. package/dist/esm2022/lib/components/chat/copilot-chat-user-message-branch-navigation.mjs +118 -0
  23. package/dist/esm2022/lib/components/chat/copilot-chat-user-message-buttons.mjs +182 -0
  24. package/dist/esm2022/lib/components/chat/copilot-chat-user-message-renderer.mjs +28 -0
  25. package/dist/esm2022/lib/components/chat/copilot-chat-user-message-toolbar.mjs +25 -0
  26. package/dist/esm2022/lib/components/chat/copilot-chat-user-message.mjs +306 -0
  27. package/dist/esm2022/lib/components/chat/copilot-chat-user-message.types.mjs +2 -0
  28. package/dist/esm2022/lib/components/chat/copilot-chat-view-disclaimer.mjs +48 -0
  29. package/dist/esm2022/lib/components/chat/copilot-chat-view-feather.mjs +41 -0
  30. package/dist/esm2022/lib/components/chat/copilot-chat-view-handlers.mjs +19 -0
  31. package/dist/esm2022/lib/components/chat/copilot-chat-view-input-container.mjs +96 -0
  32. package/dist/esm2022/lib/components/chat/copilot-chat-view-scroll-to-bottom-button.mjs +89 -0
  33. package/dist/esm2022/lib/components/chat/copilot-chat-view-scroll-view.mjs +456 -0
  34. package/dist/esm2022/lib/components/chat/copilot-chat-view.mjs +404 -0
  35. package/dist/esm2022/lib/components/chat/copilot-chat-view.types.mjs +2 -0
  36. package/dist/esm2022/lib/components/chat/copilot-chat.mjs +167 -0
  37. package/dist/esm2022/lib/config.mjs +9 -0
  38. package/dist/esm2022/lib/copilotkit.mjs +124 -0
  39. package/dist/esm2022/lib/directives/copilotkit-agent-context.mjs +130 -0
  40. package/dist/esm2022/lib/directives/stick-to-bottom.mjs +170 -0
  41. package/dist/esm2022/lib/directives/tooltip.mjs +217 -0
  42. package/dist/esm2022/lib/human-in-the-loop.mjs +19 -0
  43. package/dist/esm2022/lib/render-tool-calls.mjs +131 -0
  44. package/dist/esm2022/lib/resize-observer.mjs +152 -0
  45. package/dist/esm2022/lib/scroll-position.mjs +124 -0
  46. package/dist/esm2022/lib/slots/copilot-slot.mjs +156 -0
  47. package/dist/esm2022/lib/slots/index.mjs +4 -0
  48. package/dist/esm2022/lib/slots/slot.types.mjs +3 -3
  49. package/dist/esm2022/lib/slots/slot.utils.mjs +19 -15
  50. package/dist/esm2022/lib/tools.mjs +31 -0
  51. package/dist/esm2022/lib/utils.mjs +3 -3
  52. package/dist/esm2022/public-api.mjs +47 -0
  53. package/dist/fesm2022/copilotkitnext-angular.mjs +5249 -8271
  54. package/dist/fesm2022/copilotkitnext-angular.mjs.map +1 -1
  55. package/dist/index.d.ts +1 -55
  56. package/dist/lib/agent.d.ts +53 -0
  57. package/dist/{core/chat-configuration/chat-configuration.types.d.ts → lib/chat-config.d.ts} +4 -8
  58. package/dist/lib/chat-state.d.ts +10 -0
  59. package/dist/lib/components/chat/copilot-chat-assistant-message-buttons.d.ts +68 -0
  60. package/dist/lib/components/chat/copilot-chat-assistant-message-renderer.d.ts +26 -0
  61. package/dist/lib/components/chat/copilot-chat-assistant-message-toolbar.d.ts +7 -0
  62. package/dist/lib/components/chat/copilot-chat-assistant-message.d.ts +178 -0
  63. package/dist/{components → lib/components}/chat/copilot-chat-assistant-message.types.d.ts +1 -1
  64. package/dist/{components/chat/copilot-chat-audio-recorder.component.d.ts → lib/components/chat/copilot-chat-audio-recorder.d.ts} +10 -10
  65. package/dist/lib/components/chat/copilot-chat-buttons.d.ts +65 -0
  66. package/dist/lib/components/chat/copilot-chat-input-defaults.d.ts +38 -0
  67. package/dist/lib/components/chat/copilot-chat-input.d.ts +133 -0
  68. package/dist/{components → lib/components}/chat/copilot-chat-input.types.d.ts +11 -11
  69. package/dist/lib/components/chat/copilot-chat-message-view-cursor.d.ts +11 -0
  70. package/dist/{components/chat/copilot-chat-message-view.component.d.ts → lib/components/chat/copilot-chat-message-view.d.ts} +68 -36
  71. package/dist/{components → lib/components}/chat/copilot-chat-message-view.types.d.ts +2 -2
  72. package/dist/lib/components/chat/copilot-chat-textarea.d.ts +41 -0
  73. package/dist/lib/components/chat/copilot-chat-tool-calls-view.d.ts +55 -0
  74. package/dist/lib/components/chat/copilot-chat-toolbar.d.ts +7 -0
  75. package/dist/lib/components/chat/copilot-chat-tools-menu.d.ts +20 -0
  76. package/dist/lib/components/chat/copilot-chat-user-message-branch-navigation.d.ts +20 -0
  77. package/dist/lib/components/chat/copilot-chat-user-message-buttons.d.ts +35 -0
  78. package/dist/lib/components/chat/copilot-chat-user-message-renderer.d.ts +8 -0
  79. package/dist/lib/components/chat/copilot-chat-user-message-toolbar.d.ts +7 -0
  80. package/dist/lib/components/chat/copilot-chat-user-message.d.ts +55 -0
  81. package/dist/{components → lib/components}/chat/copilot-chat-user-message.types.d.ts +2 -2
  82. package/dist/lib/components/chat/copilot-chat-view-disclaimer.d.ts +15 -0
  83. package/dist/{components/chat/copilot-chat-view-feather.component.d.ts → lib/components/chat/copilot-chat-view-feather.d.ts} +6 -6
  84. package/dist/{components/chat/copilot-chat-view-handlers.service.d.ts → lib/components/chat/copilot-chat-view-handlers.d.ts} +3 -3
  85. package/dist/lib/components/chat/copilot-chat-view-input-container.d.ts +23 -0
  86. package/dist/lib/components/chat/copilot-chat-view-scroll-to-bottom-button.d.ts +16 -0
  87. package/dist/lib/components/chat/copilot-chat-view-scroll-view.d.ts +114 -0
  88. package/dist/lib/components/chat/copilot-chat-view.d.ts +239 -0
  89. package/dist/{components → lib/components}/chat/copilot-chat-view.types.d.ts +2 -2
  90. package/dist/lib/components/chat/copilot-chat.d.ts +67 -0
  91. package/dist/lib/config.d.ts +16 -0
  92. package/dist/lib/copilotkit.d.ts +29 -0
  93. package/dist/{directives/copilotkit-agent-context.directive.d.ts → lib/directives/copilotkit-agent-context.d.ts} +5 -5
  94. package/dist/lib/directives/stick-to-bottom.d.ts +62 -0
  95. package/dist/lib/directives/tooltip.d.ts +33 -0
  96. package/dist/lib/human-in-the-loop.d.ts +13 -0
  97. package/dist/lib/render-tool-calls.d.ts +75 -0
  98. package/dist/{services/resize-observer.service.d.ts → lib/resize-observer.d.ts} +2 -2
  99. package/dist/{services/scroll-position.service.d.ts → lib/scroll-position.d.ts} +6 -6
  100. package/dist/lib/slots/copilot-slot.d.ts +34 -0
  101. package/dist/lib/slots/index.d.ts +3 -0
  102. package/dist/lib/slots/slot.types.d.ts +1 -1
  103. package/dist/lib/slots/slot.utils.d.ts +6 -4
  104. package/dist/lib/tools.d.ts +63 -0
  105. package/dist/lib/utils.d.ts +1 -1
  106. package/dist/public-api.d.ts +46 -0
  107. package/dist/styles.css +0 -69
  108. package/package.json +3 -3
  109. package/dist/components/chat/copilot-chat-assistant-message-buttons.component.d.ts +0 -75
  110. package/dist/components/chat/copilot-chat-assistant-message-renderer.component.d.ts +0 -31
  111. package/dist/components/chat/copilot-chat-assistant-message-toolbar.component.d.ts +0 -8
  112. package/dist/components/chat/copilot-chat-assistant-message.component.d.ts +0 -132
  113. package/dist/components/chat/copilot-chat-buttons.component.d.ts +0 -66
  114. package/dist/components/chat/copilot-chat-input-defaults.d.ts +0 -37
  115. package/dist/components/chat/copilot-chat-input.component.d.ts +0 -133
  116. package/dist/components/chat/copilot-chat-message-view-cursor.component.d.ts +0 -15
  117. package/dist/components/chat/copilot-chat-textarea.component.d.ts +0 -45
  118. package/dist/components/chat/copilot-chat-tool-calls-view.component.d.ts +0 -35
  119. package/dist/components/chat/copilot-chat-toolbar.component.d.ts +0 -8
  120. package/dist/components/chat/copilot-chat-tools-menu.component.d.ts +0 -20
  121. package/dist/components/chat/copilot-chat-user-message-branch-navigation.component.d.ts +0 -23
  122. package/dist/components/chat/copilot-chat-user-message-buttons.component.d.ts +0 -39
  123. package/dist/components/chat/copilot-chat-user-message-renderer.component.d.ts +0 -9
  124. package/dist/components/chat/copilot-chat-user-message-toolbar.component.d.ts +0 -8
  125. package/dist/components/chat/copilot-chat-user-message.component.d.ts +0 -55
  126. package/dist/components/chat/copilot-chat-view-disclaimer.component.d.ts +0 -15
  127. package/dist/components/chat/copilot-chat-view-input-container.component.d.ts +0 -23
  128. package/dist/components/chat/copilot-chat-view-scroll-to-bottom-button.component.d.ts +0 -17
  129. package/dist/components/chat/copilot-chat-view-scroll-view.component.d.ts +0 -84
  130. package/dist/components/chat/copilot-chat-view.component.d.ts +0 -205
  131. package/dist/components/chat/copilot-chat.component.d.ts +0 -36
  132. package/dist/components/copilotkit-tool-render.component.d.ts +0 -25
  133. package/dist/core/chat-configuration/chat-configuration.providers.d.ts +0 -54
  134. package/dist/core/chat-configuration/chat-configuration.service.d.ts +0 -75
  135. package/dist/core/copilotkit.providers.d.ts +0 -13
  136. package/dist/core/copilotkit.service.d.ts +0 -119
  137. package/dist/core/copilotkit.types.d.ts +0 -81
  138. package/dist/directives/copilotkit-agent.directive.d.ts +0 -106
  139. package/dist/directives/copilotkit-chat-config.directive.d.ts +0 -84
  140. package/dist/directives/copilotkit-config.directive.d.ts +0 -44
  141. package/dist/directives/copilotkit-frontend-tool.directive.d.ts +0 -25
  142. package/dist/directives/copilotkit-human-in-the-loop.directive.d.ts +0 -124
  143. package/dist/directives/stick-to-bottom.directive.d.ts +0 -62
  144. package/dist/esm2022/components/chat/copilot-chat-assistant-message-buttons.component.mjs +0 -384
  145. package/dist/esm2022/components/chat/copilot-chat-assistant-message-renderer.component.mjs +0 -286
  146. package/dist/esm2022/components/chat/copilot-chat-assistant-message-toolbar.component.mjs +0 -27
  147. package/dist/esm2022/components/chat/copilot-chat-assistant-message.types.mjs +0 -2
  148. package/dist/esm2022/components/chat/copilot-chat-audio-recorder.component.mjs +0 -202
  149. package/dist/esm2022/components/chat/copilot-chat-buttons.component.mjs +0 -321
  150. package/dist/esm2022/components/chat/copilot-chat-input-defaults.mjs +0 -38
  151. package/dist/esm2022/components/chat/copilot-chat-input.component.mjs +0 -666
  152. package/dist/esm2022/components/chat/copilot-chat-input.types.mjs +0 -10
  153. package/dist/esm2022/components/chat/copilot-chat-message-view-cursor.component.mjs +0 -45
  154. package/dist/esm2022/components/chat/copilot-chat-message-view.component.mjs +0 -296
  155. package/dist/esm2022/components/chat/copilot-chat-message-view.types.mjs +0 -2
  156. package/dist/esm2022/components/chat/copilot-chat-textarea.component.mjs +0 -188
  157. package/dist/esm2022/components/chat/copilot-chat-tool-calls-view.component.mjs +0 -222
  158. package/dist/esm2022/components/chat/copilot-chat-toolbar.component.mjs +0 -25
  159. package/dist/esm2022/components/chat/copilot-chat-tools-menu.component.mjs +0 -199
  160. package/dist/esm2022/components/chat/copilot-chat-user-message-branch-navigation.component.mjs +0 -137
  161. package/dist/esm2022/components/chat/copilot-chat-user-message-buttons.component.mjs +0 -207
  162. package/dist/esm2022/components/chat/copilot-chat-user-message-renderer.component.mjs +0 -35
  163. package/dist/esm2022/components/chat/copilot-chat-user-message-toolbar.component.mjs +0 -34
  164. package/dist/esm2022/components/chat/copilot-chat-user-message.component.mjs +0 -341
  165. package/dist/esm2022/components/chat/copilot-chat-user-message.types.mjs +0 -2
  166. package/dist/esm2022/components/chat/copilot-chat-view-disclaimer.component.mjs +0 -52
  167. package/dist/esm2022/components/chat/copilot-chat-view-feather.component.mjs +0 -55
  168. package/dist/esm2022/components/chat/copilot-chat-view-handlers.service.mjs +0 -19
  169. package/dist/esm2022/components/chat/copilot-chat-view-input-container.component.mjs +0 -110
  170. package/dist/esm2022/components/chat/copilot-chat-view-scroll-to-bottom-button.component.mjs +0 -93
  171. package/dist/esm2022/components/chat/copilot-chat-view-scroll-view.component.mjs +0 -443
  172. package/dist/esm2022/components/chat/copilot-chat-view.component.mjs +0 -479
  173. package/dist/esm2022/components/chat/copilot-chat-view.types.mjs +0 -2
  174. package/dist/esm2022/components/chat/copilot-chat.component.mjs +0 -220
  175. package/dist/esm2022/components/copilotkit-tool-render.component.mjs +0 -150
  176. package/dist/esm2022/core/chat-configuration/chat-configuration.providers.mjs +0 -65
  177. package/dist/esm2022/core/chat-configuration/chat-configuration.service.mjs +0 -145
  178. package/dist/esm2022/core/chat-configuration/chat-configuration.types.mjs +0 -26
  179. package/dist/esm2022/core/copilotkit.providers.mjs +0 -34
  180. package/dist/esm2022/core/copilotkit.service.mjs +0 -411
  181. package/dist/esm2022/core/copilotkit.types.mjs +0 -13
  182. package/dist/esm2022/directives/copilotkit-agent-context.directive.mjs +0 -130
  183. package/dist/esm2022/directives/copilotkit-agent.directive.mjs +0 -221
  184. package/dist/esm2022/directives/copilotkit-chat-config.directive.mjs +0 -218
  185. package/dist/esm2022/directives/copilotkit-config.directive.mjs +0 -94
  186. package/dist/esm2022/directives/copilotkit-frontend-tool.directive.mjs +0 -128
  187. package/dist/esm2022/directives/copilotkit-human-in-the-loop.directive.mjs +0 -265
  188. package/dist/esm2022/directives/stick-to-bottom.directive.mjs +0 -181
  189. package/dist/esm2022/lib/directives/tooltip.directive.mjs +0 -211
  190. package/dist/esm2022/lib/slots/copilot-slot.component.mjs +0 -154
  191. package/dist/esm2022/services/resize-observer.service.mjs +0 -152
  192. package/dist/esm2022/services/scroll-position.service.mjs +0 -124
  193. package/dist/esm2022/types/frontend-tool.mjs +0 -2
  194. package/dist/esm2022/types/human-in-the-loop.mjs +0 -2
  195. package/dist/esm2022/utils/agent-context.utils.mjs +0 -114
  196. package/dist/esm2022/utils/agent.utils.mjs +0 -212
  197. package/dist/esm2022/utils/chat-config.utils.mjs +0 -186
  198. package/dist/esm2022/utils/copilotkit.utils.mjs +0 -20
  199. package/dist/esm2022/utils/frontend-tool.utils.mjs +0 -224
  200. package/dist/esm2022/utils/human-in-the-loop.utils.mjs +0 -293
  201. package/dist/lib/directives/tooltip.directive.d.ts +0 -33
  202. package/dist/lib/slots/copilot-slot.component.d.ts +0 -34
  203. package/dist/types/frontend-tool.d.ts +0 -37
  204. package/dist/types/human-in-the-loop.d.ts +0 -44
  205. package/dist/utils/agent-context.utils.d.ts +0 -75
  206. package/dist/utils/agent.utils.d.ts +0 -108
  207. package/dist/utils/chat-config.utils.d.ts +0 -166
  208. package/dist/utils/copilotkit.utils.d.ts +0 -16
  209. package/dist/utils/frontend-tool.utils.d.ts +0 -119
  210. package/dist/utils/human-in-the-loop.utils.d.ts +0 -92
@@ -1,37 +0,0 @@
1
- import { Type, TemplateRef } from "@angular/core";
2
- import type { z } from "zod";
3
- /**
4
- * Angular-specific frontend tool definition.
5
- * Provides a handler function that executes on the frontend when the tool is called.
6
- */
7
- export interface AngularFrontendTool<T extends Record<string, any> = Record<string, any>> {
8
- /**
9
- * The name of the tool - must be unique
10
- */
11
- name: string;
12
- /**
13
- * Description of what the tool does
14
- */
15
- description?: string;
16
- /**
17
- * Zod schema defining the parameters for the tool
18
- */
19
- parameters?: z.ZodSchema<T>;
20
- /**
21
- * Handler function that executes when the tool is called
22
- */
23
- handler?: (args: T) => Promise<any>;
24
- /**
25
- * Optional Angular component or template to render when the tool is called
26
- */
27
- render?: Type<any> | TemplateRef<any>;
28
- /**
29
- * Whether the agent should follow up after this tool completes.
30
- * Defaults to true if not specified.
31
- */
32
- followUp?: boolean;
33
- /**
34
- * Optional agent ID to constrain this tool to a specific agent
35
- */
36
- agentId?: string;
37
- }
@@ -1,44 +0,0 @@
1
- import { Type, TemplateRef } from "@angular/core";
2
- import type { z } from "zod";
3
- import { AngularFrontendTool } from "./frontend-tool";
4
- import { ToolCallStatus } from "@copilotkitnext/core";
5
- /**
6
- * Props passed to human-in-the-loop render components - discriminated union matching React
7
- */
8
- export type HumanInTheLoopProps<T = unknown> = {
9
- name: string;
10
- description: string;
11
- args: Partial<T>;
12
- status: ToolCallStatus.InProgress;
13
- result: undefined;
14
- respond: undefined;
15
- } | {
16
- name: string;
17
- description: string;
18
- args: T;
19
- status: ToolCallStatus.Executing;
20
- result: undefined;
21
- respond: (result: unknown) => Promise<void>;
22
- } | {
23
- name: string;
24
- description: string;
25
- args: T;
26
- status: ToolCallStatus.Complete;
27
- result: string;
28
- respond: undefined;
29
- };
30
- /**
31
- * Angular human-in-the-loop tool definition.
32
- * Similar to frontend tools but designed for interactive user input scenarios.
33
- */
34
- export interface AngularHumanInTheLoop<T extends Record<string, any> = Record<string, any>> extends Omit<AngularFrontendTool<T>, "handler" | "render"> {
35
- /**
36
- * Angular component or template to render for user interaction.
37
- * Required for human-in-the-loop tools.
38
- */
39
- render: Type<HumanInTheLoopProps<T>> | TemplateRef<HumanInTheLoopProps<T>>;
40
- /**
41
- * Parameters schema is required for human-in-the-loop tools
42
- */
43
- parameters: z.ZodType<T>;
44
- }
@@ -1,75 +0,0 @@
1
- import { CopilotKitService } from '../core/copilotkit.service';
2
- import { Context } from '@ag-ui/client';
3
- /**
4
- * Programmatically adds an agent context to CopilotKit and returns a cleanup function.
5
- *
6
- * @param context - The context to add
7
- * @returns A cleanup function that removes the context
8
- *
9
- * @example
10
- * ```typescript
11
- * export class MyComponent implements OnInit {
12
- * private copilotkit = injectCopilotKit();
13
- *
14
- * ngOnInit() {
15
- * const cleanup = addAgentContext(this.copilotkit, {
16
- * description: 'User preferences',
17
- * value: this.userSettings
18
- * });
19
- *
20
- * // Store cleanup for later or register with DestroyRef
21
- * this.cleanupFns.push(cleanup);
22
- * }
23
- * }
24
- * ```
25
- */
26
- export declare function addAgentContext(copilotkit: CopilotKitService, context: Context): () => void;
27
- /**
28
- * Registers an agent context with CopilotKit and automatically removes it when the component/service is destroyed.
29
- * Must be called within an injection context.
30
- *
31
- * @param context - The context to add
32
- * @returns The context ID
33
- *
34
- * @example
35
- * ```typescript
36
- * export class MyComponent implements OnInit {
37
- * ngOnInit() {
38
- * // Automatically cleaned up on component destroy
39
- * registerAgentContext({
40
- * description: 'Component state',
41
- * value: this.state
42
- * });
43
- * }
44
- * }
45
- * ```
46
- */
47
- export declare function registerAgentContext(context: Context): string;
48
- /**
49
- * Creates a reactive context that updates whenever the value changes.
50
- * Uses Angular signals for reactivity.
51
- *
52
- * @param description - Static or signal-based description
53
- * @param value - Signal that provides the context value
54
- * @returns Object with update and destroy methods
55
- *
56
- * @example
57
- * ```typescript
58
- * export class MyComponent {
59
- * private userSettings = signal({ theme: 'dark' });
60
- *
61
- * ngOnInit() {
62
- * const context = createReactiveContext(
63
- * 'User settings',
64
- * computed(() => this.userSettings())
65
- * );
66
- *
67
- * // Updates automatically when userSettings signal changes
68
- * }
69
- * }
70
- * ```
71
- */
72
- export declare function createReactiveContext(description: string | (() => string), value: () => any): {
73
- update: () => void;
74
- destroy: () => void;
75
- };
@@ -1,108 +0,0 @@
1
- import { Injector } from "@angular/core";
2
- import { CopilotKitService } from "../core/copilotkit.service";
3
- import { AgentSubscriptionCallbacks, AgentWatchResult } from "../core/copilotkit.types";
4
- import { AbstractAgent } from "@ag-ui/client";
5
- /**
6
- * Watches an agent and provides reactive signals for its state.
7
- * Must be called within an injection context.
8
- * Automatically cleans up when the component/service is destroyed.
9
- *
10
- * @param config - Optional configuration with agentId
11
- * @returns Object with agent, messages, and isRunning signals plus observables
12
- *
13
- * @example
14
- * ```typescript
15
- * export class MyComponent {
16
- * // Automatically tracks agent state
17
- * agentState = watchAgent({ agentId: 'my-agent' });
18
- *
19
- * constructor() {
20
- * effect(() => {
21
- * const messages = this.agentState.messages();
22
- * const isRunning = this.agentState.isRunning();
23
- * console.log('Messages:', messages.length, 'Running:', isRunning);
24
- * });
25
- * }
26
- * }
27
- * ```
28
- */
29
- export declare function watchAgent(config?: {
30
- agentId?: string;
31
- }): AgentWatchResult;
32
- /**
33
- * Gets an agent by ID without subscribing to changes.
34
- *
35
- * @param service - The CopilotKitService instance
36
- * @param agentId - Optional agent ID (defaults to DEFAULT_AGENT_ID)
37
- * @returns The agent or undefined if not found
38
- *
39
- * @example
40
- * ```typescript
41
- * export class MyComponent {
42
- * constructor(private copilotkit: CopilotKitService) {}
43
- *
44
- * getCurrentAgent() {
45
- * return getAgent(this.copilotkit, 'my-agent');
46
- * }
47
- * }
48
- * ```
49
- */
50
- export declare function getAgent(service: CopilotKitService, agentId?: string): AbstractAgent | undefined;
51
- export type { AgentWatchResult } from "../core/copilotkit.types";
52
- /**
53
- * Convenience wrapper for watchAgent that handles injection context.
54
- * Useful when you need to call watchAgent outside of a constructor or field initializer.
55
- *
56
- * @param injector - The Angular Injector to use for injection context
57
- * @param config - Optional configuration with agentId
58
- * @returns Object with agent, messages, and isRunning signals plus observables
59
- *
60
- * @example
61
- * ```typescript
62
- * export class MyComponent {
63
- * constructor(private injector: Injector) {}
64
- *
65
- * switchAgent(newAgentId: string) {
66
- * // Can call outside of constructor using watchAgentWith
67
- * const watcher = watchAgentWith(this.injector, { agentId: newAgentId });
68
- * this.agent = watcher.agent;
69
- * this.messages = watcher.messages;
70
- * this.isRunning = watcher.isRunning;
71
- * }
72
- * }
73
- * ```
74
- */
75
- export declare function watchAgentWith(injector: Injector, config?: {
76
- agentId?: string;
77
- }): AgentWatchResult;
78
- /**
79
- * Subscribes to an agent's events with custom callbacks.
80
- * Returns a cleanup function that should be called to unsubscribe.
81
- *
82
- * @param service - The CopilotKitService instance
83
- * @param agentId - Optional agent ID (defaults to DEFAULT_AGENT_ID)
84
- * @param callbacks - Event callbacks
85
- * @returns Cleanup function to unsubscribe
86
- *
87
- * @example
88
- * ```typescript
89
- * export class MyComponent implements OnInit, OnDestroy {
90
- * private unsubscribe?: () => void;
91
- *
92
- * constructor(private copilotkit: CopilotKitService) {}
93
- *
94
- * ngOnInit() {
95
- * this.unsubscribe = subscribeToAgent(this.copilotkit, 'my-agent', {
96
- * onRunInitialized: () => console.log('Run started'),
97
- * onRunFinalized: () => console.log('Run completed'),
98
- * onRunFailed: (error) => console.error('Run failed', error),
99
- * });
100
- * }
101
- *
102
- * ngOnDestroy() {
103
- * this.unsubscribe?.();
104
- * }
105
- * }
106
- * ```
107
- */
108
- export declare function subscribeToAgent(service: CopilotKitService, agentId?: string, callbacks?: AgentSubscriptionCallbacks): () => void;
@@ -1,166 +0,0 @@
1
- import { Signal } from '@angular/core';
2
- import { CopilotChatConfigurationService } from '../core/chat-configuration/chat-configuration.service';
3
- import { CopilotChatConfiguration, CopilotChatLabels } from '../core/chat-configuration/chat-configuration.types';
4
- /**
5
- * Watches chat configuration and provides reactive access to all configuration values.
6
- * Must be called within an injection context.
7
- *
8
- * @returns Object with reactive signals and handler functions
9
- *
10
- * @example
11
- * ```typescript
12
- * export class ChatInputComponent {
13
- * config = watchChatConfig();
14
- *
15
- * constructor() {
16
- * effect(() => {
17
- * const placeholder = this.config.labels().chatInputPlaceholder;
18
- * console.log('Placeholder:', placeholder);
19
- * });
20
- * }
21
- *
22
- * handleSubmit(value: string) {
23
- * this.config.submitInput(value);
24
- * }
25
- * }
26
- * ```
27
- */
28
- export declare function watchChatConfig(): {
29
- labels: Signal<CopilotChatLabels>;
30
- inputValue: Signal<string | undefined>;
31
- submitInput: (value: string) => void;
32
- changeInput: (value: string) => void;
33
- };
34
- /**
35
- * Registers chat configuration within an injection context.
36
- * Automatically updates the configuration when called.
37
- *
38
- * @param config - The configuration to register
39
- *
40
- * @example
41
- * ```typescript
42
- * export class ChatComponent {
43
- * constructor() {
44
- * registerChatConfig({
45
- * labels: {
46
- * chatInputPlaceholder: "How can I help?"
47
- * },
48
- * onSubmitInput: (value) => this.handleSubmit(value)
49
- * });
50
- * }
51
- * }
52
- * ```
53
- */
54
- export declare function registerChatConfig(config: CopilotChatConfiguration): void;
55
- /**
56
- * Gets the current chat labels signal.
57
- *
58
- * @param service - The CopilotChatConfigurationService instance
59
- * @returns Signal containing the current labels
60
- *
61
- * @example
62
- * ```typescript
63
- * export class ChatComponent {
64
- * constructor(private chatConfig: CopilotChatConfigurationService) {
65
- * const labels = getChatLabels(this.chatConfig);
66
- * effect(() => {
67
- * console.log('Current labels:', labels());
68
- * });
69
- * }
70
- * }
71
- * ```
72
- */
73
- export declare function getChatLabels(service: CopilotChatConfigurationService): Signal<CopilotChatLabels>;
74
- /**
75
- * Updates chat labels.
76
- *
77
- * @param service - The CopilotChatConfigurationService instance
78
- * @param labels - Partial labels to merge with defaults
79
- *
80
- * @example
81
- * ```typescript
82
- * export class ChatComponent {
83
- * updatePlaceholder(text: string) {
84
- * setChatLabels(this.chatConfig, {
85
- * chatInputPlaceholder: text
86
- * });
87
- * }
88
- * }
89
- * ```
90
- */
91
- export declare function setChatLabels(service: CopilotChatConfigurationService, labels: Partial<CopilotChatLabels>): void;
92
- /**
93
- * Gets the current input value signal.
94
- *
95
- * @param service - The CopilotChatConfigurationService instance
96
- * @returns Signal containing the current input value
97
- *
98
- * @example
99
- * ```typescript
100
- * export class ChatInputComponent {
101
- * inputValue = getChatInputValue(this.chatConfig);
102
- *
103
- * constructor(private chatConfig: CopilotChatConfigurationService) {
104
- * effect(() => {
105
- * const value = this.inputValue();
106
- * if (value) {
107
- * this.updateTextarea(value);
108
- * }
109
- * });
110
- * }
111
- * }
112
- * ```
113
- */
114
- export declare function getChatInputValue(service: CopilotChatConfigurationService): Signal<string | undefined>;
115
- /**
116
- * Sets the current input value.
117
- *
118
- * @param service - The CopilotChatConfigurationService instance
119
- * @param value - The new input value
120
- *
121
- * @example
122
- * ```typescript
123
- * export class ChatInputComponent {
124
- * onInputChange(event: Event) {
125
- * const value = (event.target as HTMLInputElement).value;
126
- * setChatInputValue(this.chatConfig, value);
127
- * }
128
- * }
129
- * ```
130
- */
131
- export declare function setChatInputValue(service: CopilotChatConfigurationService, value: string | undefined): void;
132
- /**
133
- * Creates a chat configuration controller with dynamic update capabilities.
134
- * This is useful when you need to programmatically manage configuration.
135
- *
136
- * @param service - The CopilotChatConfigurationService instance
137
- * @param initialConfig - Optional initial configuration
138
- * @returns Controller object with update and reset methods
139
- *
140
- * @example
141
- * ```typescript
142
- * export class ChatManagerComponent {
143
- * chatController = createChatConfigController(this.chatConfig, {
144
- * labels: { chatInputPlaceholder: "Ask me..." }
145
- * });
146
- *
147
- * constructor(private chatConfig: CopilotChatConfigurationService) {}
148
- *
149
- * updateForSupportMode() {
150
- * this.chatController.update({
151
- * labels: { chatInputPlaceholder: "Describe your issue..." }
152
- * });
153
- * }
154
- *
155
- * resetToDefaults() {
156
- * this.chatController.reset();
157
- * }
158
- * }
159
- * ```
160
- */
161
- export declare function createChatConfigController(service: CopilotChatConfigurationService, initialConfig?: CopilotChatConfiguration): {
162
- update: (config: CopilotChatConfiguration) => void;
163
- reset: () => void;
164
- getLabels: () => CopilotChatLabels;
165
- getInputValue: () => string | undefined;
166
- };
@@ -1,16 +0,0 @@
1
- import { CopilotKitService } from "../core/copilotkit.service";
2
- /**
3
- * Utility function to inject the CopilotKit service in a component or directive.
4
- *
5
- * @example
6
- * ```typescript
7
- * export class MyComponent {
8
- * private copilotkit = injectCopilotKit();
9
- *
10
- * sendMessage() {
11
- * this.copilotkit.copilotkit.sendMessage(...);
12
- * }
13
- * }
14
- * ```
15
- */
16
- export declare function injectCopilotKit(): CopilotKitService;
@@ -1,119 +0,0 @@
1
- import { CopilotKitService } from '../core/copilotkit.service';
2
- import { AngularFrontendTool } from '../core/copilotkit.types';
3
- import type { z } from 'zod';
4
- /**
5
- * Explicitly adds a frontend tool to CopilotKit.
6
- * Requires CopilotKitService to be passed as a parameter.
7
- *
8
- * @param service - The CopilotKitService instance
9
- * @param tool - The tool to add
10
- * @returns A cleanup function that removes the tool
11
- *
12
- * @example
13
- * ```typescript
14
- * export class MyComponent implements OnInit, OnDestroy {
15
- * private cleanupFns: Array<() => void> = [];
16
- *
17
- * constructor(private copilotkit: CopilotKitService) {}
18
- *
19
- * ngOnInit() {
20
- * const cleanup = addFrontendTool(this.copilotkit, {
21
- * name: 'calculator',
22
- * description: 'Performs calculations',
23
- * parameters: z.object({
24
- * expression: z.string()
25
- * }),
26
- * handler: async (args) => {
27
- * return eval(args.expression);
28
- * }
29
- * });
30
- *
31
- * this.cleanupFns.push(cleanup);
32
- * }
33
- *
34
- * ngOnDestroy() {
35
- * this.cleanupFns.forEach(fn => fn());
36
- * }
37
- * }
38
- * ```
39
- */
40
- export declare function addFrontendTool<T extends Record<string, any> = Record<string, any>>(service: CopilotKitService, tool: AngularFrontendTool<T>): () => void;
41
- /**
42
- * Registers a frontend tool with CopilotKit and automatically removes it when the component/service is destroyed.
43
- * Must be called within an injection context.
44
- *
45
- * @param tool - The tool to register
46
- * @returns The tool name
47
- *
48
- * @example
49
- * ```typescript
50
- * export class MyComponent implements OnInit {
51
- * ngOnInit() {
52
- * // Automatically cleaned up on component destroy
53
- * registerFrontendTool({
54
- * name: 'search',
55
- * description: 'Search for items',
56
- * parameters: z.object({
57
- * query: z.string()
58
- * }),
59
- * handler: async (args) => {
60
- * return this.searchService.search(args.query);
61
- * },
62
- * render: SearchResultsComponent
63
- * });
64
- * }
65
- * }
66
- * ```
67
- */
68
- export declare function registerFrontendTool<T extends Record<string, any> = Record<string, any>>(tool: AngularFrontendTool<T>): string;
69
- /**
70
- * Explicitly removes a frontend tool from CopilotKit.
71
- *
72
- * @param service - The CopilotKitService instance
73
- * @param toolName - The name of the tool to remove
74
- *
75
- * @example
76
- * ```typescript
77
- * removeFrontendTool(this.copilotkit, 'calculator');
78
- * ```
79
- */
80
- export declare function removeFrontendTool(service: CopilotKitService, toolName: string): void;
81
- /**
82
- * Creates a frontend tool with dynamic parameters that can change over time.
83
- * Uses Angular signals for reactivity.
84
- *
85
- * @param name - Tool name
86
- * @param description - Tool description
87
- * @param parameters - Zod schema for parameters
88
- * @param handler - Signal or function that provides the handler
89
- * @param render - Optional render component or template
90
- * @returns Object with update and destroy methods
91
- *
92
- * @example
93
- * ```typescript
94
- * export class MyComponent {
95
- * private toolConfig = signal({
96
- * handler: async (args: any) => this.processDefault(args)
97
- * });
98
- *
99
- * ngOnInit() {
100
- * const tool = createDynamicFrontendTool(
101
- * 'processor',
102
- * 'Processes data',
103
- * z.object({ data: z.string() }),
104
- * () => this.toolConfig().handler
105
- * );
106
- *
107
- * // Later, update the handler
108
- * this.toolConfig.set({
109
- * handler: async (args: any) => this.processAdvanced(args)
110
- * });
111
- * tool.update();
112
- * }
113
- * }
114
- * ```
115
- */
116
- export declare function createDynamicFrontendTool<T extends Record<string, any> = Record<string, any>>(name: string, description: string | (() => string), parameters: z.ZodSchema<T>, handler: () => ((args: T) => Promise<any>), render?: () => any): {
117
- update: () => void;
118
- destroy: () => void;
119
- };
@@ -1,92 +0,0 @@
1
- import { CopilotKitService } from '../core/copilotkit.service';
2
- import { AngularHumanInTheLoop, ToolCallStatus, HumanInTheLoopState, HumanInTheLoopProps } from '../core/copilotkit.types';
3
- /**
4
- * Registers a human-in-the-loop tool that requires user interaction.
5
- * Must be called within an injection context.
6
- * Automatically cleans up when the component/service is destroyed.
7
- *
8
- * @param tool - The human-in-the-loop tool configuration
9
- * @returns The tool ID
10
- *
11
- * @example
12
- * ```typescript
13
- * export class ApprovalComponent {
14
- * toolId = registerHumanInTheLoop({
15
- * name: 'requireApproval',
16
- * description: 'Requires user approval',
17
- * args: z.object({ action: z.string() }),
18
- * render: ApprovalDialogComponent
19
- * });
20
- * }
21
- * ```
22
- */
23
- export declare function registerHumanInTheLoop<T extends Record<string, any> = Record<string, any>>(tool: AngularHumanInTheLoop<T>): string;
24
- /**
25
- * Adds a human-in-the-loop tool with explicit service parameter.
26
- * Returns a cleanup function.
27
- *
28
- * @param service - The CopilotKitService instance
29
- * @param tool - The human-in-the-loop tool configuration
30
- * @returns Cleanup function to remove the tool
31
- *
32
- * @example
33
- * ```typescript
34
- * export class MyComponent implements OnInit, OnDestroy {
35
- * private cleanup?: () => void;
36
- *
37
- * constructor(private copilotkit: CopilotKitService) {}
38
- *
39
- * ngOnInit() {
40
- * this.cleanup = addHumanInTheLoop(this.copilotkit, {
41
- * name: 'requireApproval',
42
- * description: 'Requires user approval',
43
- * args: z.object({ action: z.string() }),
44
- * render: ApprovalDialogComponent
45
- * });
46
- * }
47
- *
48
- * ngOnDestroy() {
49
- * this.cleanup?.();
50
- * }
51
- * }
52
- * ```
53
- */
54
- export declare function addHumanInTheLoop<T extends Record<string, any> = Record<string, any>>(service: CopilotKitService, tool: AngularHumanInTheLoop<T>): () => void;
55
- /**
56
- * Creates a human-in-the-loop tool with dynamic update capabilities.
57
- *
58
- * @param service - The CopilotKitService instance
59
- * @param tool - The human-in-the-loop tool configuration
60
- * @returns Object with status signal, update and destroy methods
61
- *
62
- * @example
63
- * ```typescript
64
- * export class MyComponent {
65
- * humanInTheLoop = createHumanInTheLoop(this.copilotkit, {
66
- * name: 'requireApproval',
67
- * description: 'Requires user approval',
68
- * args: z.object({ action: z.string() }),
69
- * render: ApprovalDialogComponent
70
- * });
71
- *
72
- * updateDescription(newDesc: string) {
73
- * this.humanInTheLoop.update({ description: newDesc });
74
- * }
75
- *
76
- * ngOnDestroy() {
77
- * this.humanInTheLoop.destroy();
78
- * }
79
- * }
80
- * ```
81
- */
82
- export declare function createHumanInTheLoop<T extends Record<string, any> = Record<string, any>>(service: CopilotKitService, tool: AngularHumanInTheLoop<T>): HumanInTheLoopState & {
83
- update: (updates: Partial<AngularHumanInTheLoop<T>>) => void;
84
- };
85
- /**
86
- * Enhanced component wrapper for human-in-the-loop.
87
- * This would be used internally by the tool render component to inject
88
- * the respond function based on status.
89
- *
90
- * @internal
91
- */
92
- export declare function enhancePropsForHumanInTheLoop<T>(props: HumanInTheLoopProps<T>, status: ToolCallStatus, respond?: (result: unknown) => Promise<void>): HumanInTheLoopProps<T>;