@copilotkitnext/core 1.51.4 → 1.51.5-next.1

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.
@@ -0,0 +1,709 @@
1
+ import * as _ag_ui_client0 from "@ag-ui/client";
2
+ import { AbstractAgent, BaseEvent, Context, HttpAgent, HttpAgentConfig, Message, RunAgentInput, RunAgentResult, State, Tool, ToolCall } from "@ag-ui/client";
3
+ import { z } from "zod";
4
+ import { Observable } from "rxjs";
5
+
6
+ //#region src/types.d.ts
7
+ /**
8
+ * Status of a tool call execution
9
+ */
10
+ declare enum ToolCallStatus {
11
+ InProgress = "inProgress",
12
+ Executing = "executing",
13
+ Complete = "complete"
14
+ }
15
+ type CopilotRuntimeTransport = "rest" | "single";
16
+ /**
17
+ * Context passed to a frontend tool handler
18
+ */
19
+ type FrontendToolHandlerContext = {
20
+ toolCall: ToolCall;
21
+ agent: AbstractAgent;
22
+ };
23
+ type FrontendTool<T extends Record<string, unknown> = Record<string, unknown>> = {
24
+ name: string;
25
+ description?: string;
26
+ parameters?: z.ZodType<T>;
27
+ handler?: (args: T, context: FrontendToolHandlerContext) => Promise<unknown>;
28
+ followUp?: boolean;
29
+ /**
30
+ * Optional agent ID to constrain this tool to a specific agent.
31
+ * If specified, this tool will only be available to the specified agent.
32
+ */
33
+ agentId?: string;
34
+ /**
35
+ * Whether this tool is available to the agent.
36
+ * Set to false to hide the tool from the agent without unregistering it.
37
+ * Defaults to true when not specified.
38
+ */
39
+ available?: boolean;
40
+ };
41
+ type Suggestion = {
42
+ title: string;
43
+ message: string; /** Indicates whether this suggestion is still being generated. */
44
+ isLoading: boolean;
45
+ };
46
+ type SuggestionAvailability = "before-first-message" | "after-first-message" | "always" | "disabled";
47
+ type DynamicSuggestionsConfig = {
48
+ /**
49
+ * A prompt or instructions for the GPT to generate suggestions.
50
+ */
51
+ instructions: string;
52
+ /**
53
+ * The minimum number of suggestions to generate. Defaults to `1`.
54
+ * @default 1
55
+ */
56
+ minSuggestions?: number;
57
+ /**
58
+ * The maximum number of suggestions to generate. Defaults to `3`.
59
+ * @default 1
60
+ */
61
+ maxSuggestions?: number;
62
+ /**
63
+ * When the suggestions are available. Defaults to "after-first-message".
64
+ */
65
+ available?: SuggestionAvailability;
66
+ /**
67
+ * The agent ID of the provider of the suggestions. Defaults to `"default"`.
68
+ */
69
+ providerAgentId?: string;
70
+ /**
71
+ * The agent ID of the consumer of the suggestions. Defaults to `"*"` (all agents).
72
+ */
73
+ consumerAgentId?: string;
74
+ };
75
+ type StaticSuggestionsConfig = {
76
+ /**
77
+ * The suggestions to display.
78
+ */
79
+ suggestions: Omit<Suggestion, "isLoading">[];
80
+ /**
81
+ * When the suggestions are available. Defaults to "before-first-message".
82
+ */
83
+ available?: SuggestionAvailability;
84
+ /**
85
+ * The agent ID of the consumer of the suggestions. Defaults to `"*"` (all agents).
86
+ */
87
+ consumerAgentId?: string;
88
+ };
89
+ type SuggestionsConfig = DynamicSuggestionsConfig | StaticSuggestionsConfig;
90
+ //#endregion
91
+ //#region src/core/agent-registry.d.ts
92
+ interface CopilotKitCoreAddAgentParams {
93
+ id: string;
94
+ agent: AbstractAgent;
95
+ }
96
+ /**
97
+ * Manages agent registration, lifecycle, and runtime connectivity for CopilotKitCore.
98
+ * Handles both local development agents and remote runtime agents.
99
+ */
100
+ declare class AgentRegistry {
101
+ private core;
102
+ private _agents;
103
+ private localAgents;
104
+ private remoteAgents;
105
+ private _runtimeUrl?;
106
+ private _runtimeVersion?;
107
+ private _runtimeConnectionStatus;
108
+ private _runtimeTransport;
109
+ private _audioFileTranscriptionEnabled;
110
+ constructor(core: CopilotKitCore);
111
+ /**
112
+ * Get all agents as a readonly record
113
+ */
114
+ get agents(): Readonly<Record<string, AbstractAgent>>;
115
+ get runtimeUrl(): string | undefined;
116
+ get runtimeVersion(): string | undefined;
117
+ get runtimeConnectionStatus(): CopilotKitCoreRuntimeConnectionStatus;
118
+ get runtimeTransport(): CopilotRuntimeTransport;
119
+ get audioFileTranscriptionEnabled(): boolean;
120
+ /**
121
+ * Initialize agents from configuration
122
+ */
123
+ initialize(agents: Record<string, AbstractAgent>): void;
124
+ /**
125
+ * Set the runtime URL and update connection
126
+ */
127
+ setRuntimeUrl(runtimeUrl: string | undefined): void;
128
+ setRuntimeTransport(runtimeTransport: CopilotRuntimeTransport): void;
129
+ /**
130
+ * Set all agents at once (for development use)
131
+ */
132
+ setAgents__unsafe_dev_only(agents: Record<string, AbstractAgent>): void;
133
+ /**
134
+ * Add a single agent (for development use)
135
+ */
136
+ addAgent__unsafe_dev_only({
137
+ id,
138
+ agent
139
+ }: CopilotKitCoreAddAgentParams): void;
140
+ /**
141
+ * Remove an agent by ID (for development use)
142
+ */
143
+ removeAgent__unsafe_dev_only(id: string): void;
144
+ /**
145
+ * Get an agent by ID
146
+ */
147
+ getAgent(id: string): AbstractAgent | undefined;
148
+ /**
149
+ * Apply current headers to an agent
150
+ */
151
+ applyHeadersToAgent(agent: AbstractAgent): void;
152
+ /**
153
+ * Apply current headers to all agents
154
+ */
155
+ applyHeadersToAgents(agents: Record<string, AbstractAgent>): void;
156
+ /**
157
+ * Apply current credentials to an agent
158
+ */
159
+ applyCredentialsToAgent(agent: AbstractAgent): void;
160
+ /**
161
+ * Apply current credentials to all agents
162
+ */
163
+ applyCredentialsToAgents(agents: Record<string, AbstractAgent>): void;
164
+ /**
165
+ * Update runtime connection and fetch remote agents
166
+ */
167
+ private updateRuntimeConnection;
168
+ private fetchRuntimeInfo;
169
+ /**
170
+ * Assign agent IDs to a record of agents
171
+ */
172
+ private assignAgentIds;
173
+ /**
174
+ * Validate and assign an agent ID
175
+ */
176
+ private validateAndAssignAgentId;
177
+ /**
178
+ * Notify subscribers of runtime status changes
179
+ */
180
+ private notifyRuntimeStatusChanged;
181
+ /**
182
+ * Notify subscribers of agent changes
183
+ */
184
+ private notifyAgentsChanged;
185
+ }
186
+ //#endregion
187
+ //#region src/core/run-handler.d.ts
188
+ interface CopilotKitCoreRunAgentParams {
189
+ agent: AbstractAgent;
190
+ }
191
+ interface CopilotKitCoreConnectAgentParams {
192
+ agent: AbstractAgent;
193
+ }
194
+ interface CopilotKitCoreGetToolParams {
195
+ toolName: string;
196
+ agentId?: string;
197
+ }
198
+ /**
199
+ * Handles agent execution, tool calling, and agent connectivity for CopilotKitCore.
200
+ * Manages the complete lifecycle of agent runs including tool execution and follow-ups.
201
+ */
202
+ declare class RunHandler {
203
+ private core;
204
+ private _tools;
205
+ constructor(core: CopilotKitCore);
206
+ /**
207
+ * Get all tools as a readonly array
208
+ */
209
+ get tools(): Readonly<FrontendTool<any>[]>;
210
+ /**
211
+ * Initialize with tools
212
+ */
213
+ initialize(tools: FrontendTool<any>[]): void;
214
+ /**
215
+ * Add a tool to the registry
216
+ */
217
+ addTool<T extends Record<string, unknown> = Record<string, unknown>>(tool: FrontendTool<T>): void;
218
+ /**
219
+ * Remove a tool by name and optionally by agentId
220
+ */
221
+ removeTool(id: string, agentId?: string): void;
222
+ /**
223
+ * Get a tool by name and optionally by agentId.
224
+ * If agentId is provided, it will first look for an agent-specific tool,
225
+ * then fall back to a global tool with the same name.
226
+ */
227
+ getTool(params: CopilotKitCoreGetToolParams): FrontendTool<any> | undefined;
228
+ /**
229
+ * Set all tools at once. Replaces existing tools.
230
+ */
231
+ setTools(tools: FrontendTool<any>[]): void;
232
+ /**
233
+ * Connect an agent (establish initial connection)
234
+ */
235
+ connectAgent({
236
+ agent
237
+ }: CopilotKitCoreConnectAgentParams): Promise<RunAgentResult>;
238
+ /**
239
+ * Run an agent
240
+ */
241
+ runAgent({
242
+ agent
243
+ }: CopilotKitCoreRunAgentParams): Promise<RunAgentResult>;
244
+ /**
245
+ * Process agent result and execute tools
246
+ */
247
+ private processAgentResult;
248
+ /**
249
+ * Execute a specific tool
250
+ */
251
+ private executeSpecificTool;
252
+ /**
253
+ * Execute a wildcard tool
254
+ */
255
+ private executeWildcardTool;
256
+ /**
257
+ * Build frontend tools for an agent
258
+ */
259
+ buildFrontendTools(agentId?: string): Tool[];
260
+ /**
261
+ * Create an agent error subscriber
262
+ */
263
+ private createAgentErrorSubscriber;
264
+ }
265
+ //#endregion
266
+ //#region src/core/core.d.ts
267
+ /** Configuration options for `CopilotKitCore`. */
268
+ interface CopilotKitCoreConfig {
269
+ /** The endpoint of the CopilotRuntime. */
270
+ runtimeUrl?: string;
271
+ /** Transport style for CopilotRuntime endpoints. Defaults to REST. */
272
+ runtimeTransport?: CopilotRuntimeTransport;
273
+ /** Mapping from agent name to its `AbstractAgent` instance. For development only - production requires CopilotRuntime. */
274
+ agents__unsafe_dev_only?: Record<string, AbstractAgent>;
275
+ /** Headers appended to every HTTP request made by `CopilotKitCore`. */
276
+ headers?: Record<string, string>;
277
+ /** Credentials mode for fetch requests (e.g., "include" for HTTP-only cookies). */
278
+ credentials?: RequestCredentials;
279
+ /** Properties sent as `forwardedProps` to the AG-UI agent. */
280
+ properties?: Record<string, unknown>;
281
+ /** Ordered collection of frontend tools available to the core. */
282
+ tools?: FrontendTool<any>[];
283
+ /** Suggestions config for the core. */
284
+ suggestionsConfig?: SuggestionsConfig[];
285
+ }
286
+ interface CopilotKitCoreStopAgentParams {
287
+ agent: AbstractAgent;
288
+ }
289
+ type CopilotKitCoreGetSuggestionsResult = {
290
+ suggestions: Suggestion[];
291
+ isLoading: boolean;
292
+ };
293
+ declare enum CopilotKitCoreErrorCode {
294
+ RUNTIME_INFO_FETCH_FAILED = "runtime_info_fetch_failed",
295
+ AGENT_CONNECT_FAILED = "agent_connect_failed",
296
+ AGENT_RUN_FAILED = "agent_run_failed",
297
+ AGENT_RUN_FAILED_EVENT = "agent_run_failed_event",
298
+ AGENT_RUN_ERROR_EVENT = "agent_run_error_event",
299
+ TOOL_ARGUMENT_PARSE_FAILED = "tool_argument_parse_failed",
300
+ TOOL_HANDLER_FAILED = "tool_handler_failed",
301
+ TRANSCRIPTION_FAILED = "transcription_failed",
302
+ TRANSCRIPTION_SERVICE_NOT_CONFIGURED = "transcription_service_not_configured",
303
+ TRANSCRIPTION_INVALID_AUDIO = "transcription_invalid_audio",
304
+ TRANSCRIPTION_RATE_LIMITED = "transcription_rate_limited",
305
+ TRANSCRIPTION_AUTH_FAILED = "transcription_auth_failed",
306
+ TRANSCRIPTION_NETWORK_ERROR = "transcription_network_error"
307
+ }
308
+ interface CopilotKitCoreSubscriber {
309
+ onRuntimeConnectionStatusChanged?: (event: {
310
+ copilotkit: CopilotKitCore;
311
+ status: CopilotKitCoreRuntimeConnectionStatus;
312
+ }) => void | Promise<void>;
313
+ onToolExecutionStart?: (event: {
314
+ copilotkit: CopilotKitCore;
315
+ toolCallId: string;
316
+ agentId: string;
317
+ toolName: string;
318
+ args: unknown;
319
+ }) => void | Promise<void>;
320
+ onToolExecutionEnd?: (event: {
321
+ copilotkit: CopilotKitCore;
322
+ toolCallId: string;
323
+ agentId: string;
324
+ toolName: string;
325
+ result: string;
326
+ error?: string;
327
+ }) => void | Promise<void>;
328
+ onAgentsChanged?: (event: {
329
+ copilotkit: CopilotKitCore;
330
+ agents: Readonly<Record<string, AbstractAgent>>;
331
+ }) => void | Promise<void>;
332
+ onContextChanged?: (event: {
333
+ copilotkit: CopilotKitCore;
334
+ context: Readonly<Record<string, Context>>;
335
+ }) => void | Promise<void>;
336
+ onSuggestionsConfigChanged?: (event: {
337
+ copilotkit: CopilotKitCore;
338
+ suggestionsConfig: Readonly<Record<string, SuggestionsConfig>>;
339
+ }) => void | Promise<void>;
340
+ onSuggestionsChanged?: (event: {
341
+ copilotkit: CopilotKitCore;
342
+ agentId: string;
343
+ suggestions: Suggestion[];
344
+ }) => void | Promise<void>;
345
+ onSuggestionsStartedLoading?: (event: {
346
+ copilotkit: CopilotKitCore;
347
+ agentId: string;
348
+ }) => void | Promise<void>;
349
+ onSuggestionsFinishedLoading?: (event: {
350
+ copilotkit: CopilotKitCore;
351
+ agentId: string;
352
+ }) => void | Promise<void>;
353
+ onPropertiesChanged?: (event: {
354
+ copilotkit: CopilotKitCore;
355
+ properties: Readonly<Record<string, unknown>>;
356
+ }) => void | Promise<void>;
357
+ onHeadersChanged?: (event: {
358
+ copilotkit: CopilotKitCore;
359
+ headers: Readonly<Record<string, string>>;
360
+ }) => void | Promise<void>;
361
+ onError?: (event: {
362
+ copilotkit: CopilotKitCore;
363
+ error: Error;
364
+ code: CopilotKitCoreErrorCode;
365
+ context: Record<string, any>;
366
+ }) => void | Promise<void>;
367
+ }
368
+ interface CopilotKitCoreSubscription {
369
+ unsubscribe: () => void;
370
+ }
371
+ declare enum CopilotKitCoreRuntimeConnectionStatus {
372
+ Disconnected = "disconnected",
373
+ Connected = "connected",
374
+ Connecting = "connecting",
375
+ Error = "error"
376
+ }
377
+ /**
378
+ * Internal interface for delegate classes to access CopilotKitCore methods.
379
+ * This provides type safety while allowing controlled access to private functionality.
380
+ */
381
+ interface CopilotKitCoreFriendsAccess {
382
+ notifySubscribers(handler: (subscriber: CopilotKitCoreSubscriber) => void | Promise<void>, errorMessage: string): Promise<void>;
383
+ emitError(params: {
384
+ error: Error;
385
+ code: CopilotKitCoreErrorCode;
386
+ context?: Record<string, any>;
387
+ }): Promise<void>;
388
+ readonly headers: Readonly<Record<string, string>>;
389
+ readonly credentials: RequestCredentials | undefined;
390
+ readonly properties: Readonly<Record<string, unknown>>;
391
+ readonly context: Readonly<Record<string, Context>>;
392
+ buildFrontendTools(agentId?: string): _ag_ui_client0.Tool[];
393
+ getAgent(id: string): AbstractAgent | undefined;
394
+ readonly suggestionEngine: {
395
+ clearSuggestions(agentId: string): void;
396
+ reloadSuggestions(agentId: string): void;
397
+ };
398
+ }
399
+ declare class CopilotKitCore {
400
+ private _headers;
401
+ private _credentials?;
402
+ private _properties;
403
+ private subscribers;
404
+ private agentRegistry;
405
+ private contextStore;
406
+ private suggestionEngine;
407
+ private runHandler;
408
+ private stateManager;
409
+ constructor({
410
+ runtimeUrl,
411
+ runtimeTransport,
412
+ headers,
413
+ credentials,
414
+ properties,
415
+ agents__unsafe_dev_only,
416
+ tools,
417
+ suggestionsConfig
418
+ }: CopilotKitCoreConfig);
419
+ /**
420
+ * Internal method used by delegate classes and subclasses to notify subscribers
421
+ */
422
+ protected notifySubscribers(handler: (subscriber: CopilotKitCoreSubscriber) => void | Promise<void>, errorMessage: string): Promise<void>;
423
+ /**
424
+ * Internal method used by delegate classes to emit errors
425
+ */
426
+ private emitError;
427
+ /**
428
+ * Snapshot accessors
429
+ */
430
+ get context(): Readonly<Record<string, Context>>;
431
+ get agents(): Readonly<Record<string, AbstractAgent>>;
432
+ get tools(): Readonly<FrontendTool<any>[]>;
433
+ get runtimeUrl(): string | undefined;
434
+ setRuntimeUrl(runtimeUrl: string | undefined): void;
435
+ get runtimeTransport(): CopilotRuntimeTransport;
436
+ setRuntimeTransport(runtimeTransport: CopilotRuntimeTransport): void;
437
+ get runtimeVersion(): string | undefined;
438
+ get headers(): Readonly<Record<string, string>>;
439
+ get credentials(): RequestCredentials | undefined;
440
+ get properties(): Readonly<Record<string, unknown>>;
441
+ get runtimeConnectionStatus(): CopilotKitCoreRuntimeConnectionStatus;
442
+ get audioFileTranscriptionEnabled(): boolean;
443
+ /**
444
+ * Configuration updates
445
+ */
446
+ setHeaders(headers: Record<string, string>): void;
447
+ setCredentials(credentials: RequestCredentials | undefined): void;
448
+ setProperties(properties: Record<string, unknown>): void;
449
+ /**
450
+ * Agent management (delegated to AgentRegistry)
451
+ */
452
+ setAgents__unsafe_dev_only(agents: Record<string, AbstractAgent>): void;
453
+ addAgent__unsafe_dev_only(params: CopilotKitCoreAddAgentParams): void;
454
+ removeAgent__unsafe_dev_only(id: string): void;
455
+ getAgent(id: string): AbstractAgent | undefined;
456
+ /**
457
+ * Context management (delegated to ContextStore)
458
+ */
459
+ addContext(context: Context): string;
460
+ removeContext(id: string): void;
461
+ /**
462
+ * Suggestions management (delegated to SuggestionEngine)
463
+ */
464
+ addSuggestionsConfig(config: SuggestionsConfig): string;
465
+ removeSuggestionsConfig(id: string): void;
466
+ reloadSuggestions(agentId: string): void;
467
+ clearSuggestions(agentId: string): void;
468
+ getSuggestions(agentId: string): CopilotKitCoreGetSuggestionsResult;
469
+ /**
470
+ * Tool management (delegated to RunHandler)
471
+ */
472
+ addTool<T extends Record<string, unknown> = Record<string, unknown>>(tool: FrontendTool<T>): void;
473
+ removeTool(id: string, agentId?: string): void;
474
+ getTool(params: CopilotKitCoreGetToolParams): FrontendTool<any> | undefined;
475
+ setTools(tools: FrontendTool<any>[]): void;
476
+ /**
477
+ * Subscription lifecycle
478
+ */
479
+ subscribe(subscriber: CopilotKitCoreSubscriber): CopilotKitCoreSubscription;
480
+ /**
481
+ * Agent connectivity (delegated to RunHandler)
482
+ */
483
+ connectAgent(params: CopilotKitCoreConnectAgentParams): Promise<_ag_ui_client0.RunAgentResult>;
484
+ stopAgent(params: CopilotKitCoreStopAgentParams): void;
485
+ runAgent(params: CopilotKitCoreRunAgentParams): Promise<_ag_ui_client0.RunAgentResult>;
486
+ /**
487
+ * State management (delegated to StateManager)
488
+ */
489
+ getStateByRun(agentId: string, threadId: string, runId: string): State | undefined;
490
+ getRunIdForMessage(agentId: string, threadId: string, messageId: string): string | undefined;
491
+ getRunIdsForThread(agentId: string, threadId: string): string[];
492
+ /**
493
+ * Internal method used by RunHandler to build frontend tools
494
+ */
495
+ private buildFrontendTools;
496
+ }
497
+ //#endregion
498
+ //#region src/core/context-store.d.ts
499
+ /**
500
+ * Manages context storage and lifecycle for CopilotKitCore.
501
+ * Context represents additional information available to agents during execution.
502
+ */
503
+ declare class ContextStore {
504
+ private core;
505
+ private _context;
506
+ constructor(core: CopilotKitCore);
507
+ /**
508
+ * Get all context entries as a readonly record
509
+ */
510
+ get context(): Readonly<Record<string, Context>>;
511
+ /**
512
+ * Add a new context entry
513
+ * @returns The ID of the created context entry
514
+ */
515
+ addContext({
516
+ description,
517
+ value
518
+ }: Context): string;
519
+ /**
520
+ * Remove a context entry by ID
521
+ */
522
+ removeContext(id: string): void;
523
+ /**
524
+ * Notify all subscribers of context changes
525
+ */
526
+ private notifySubscribers;
527
+ }
528
+ //#endregion
529
+ //#region src/core/suggestion-engine.d.ts
530
+ /**
531
+ * Manages suggestion generation, streaming, and lifecycle for CopilotKitCore.
532
+ * Handles both dynamic (AI-generated) and static suggestions.
533
+ */
534
+ declare class SuggestionEngine {
535
+ private core;
536
+ private _suggestionsConfig;
537
+ private _suggestions;
538
+ private _runningSuggestions;
539
+ constructor(core: CopilotKitCore);
540
+ /**
541
+ * Initialize with suggestion configs
542
+ */
543
+ initialize(suggestionsConfig: SuggestionsConfig[]): void;
544
+ /**
545
+ * Add a suggestion configuration
546
+ * @returns The ID of the created config
547
+ */
548
+ addSuggestionsConfig(config: SuggestionsConfig): string;
549
+ /**
550
+ * Remove a suggestion configuration by ID
551
+ */
552
+ removeSuggestionsConfig(id: string): void;
553
+ /**
554
+ * Reload suggestions for a specific agent
555
+ * This triggers generation of new suggestions based on current configs
556
+ */
557
+ reloadSuggestions(agentId: string): void;
558
+ /**
559
+ * Clear all suggestions for a specific agent
560
+ */
561
+ clearSuggestions(agentId: string): void;
562
+ /**
563
+ * Get current suggestions for an agent
564
+ */
565
+ getSuggestions(agentId: string): CopilotKitCoreGetSuggestionsResult;
566
+ /**
567
+ * Generate suggestions using a provider agent
568
+ */
569
+ private generateSuggestions;
570
+ /**
571
+ * Finalize suggestions by marking them as no longer loading
572
+ */
573
+ private finalizeSuggestions;
574
+ /**
575
+ * Extract suggestions from messages (called during streaming)
576
+ */
577
+ extractSuggestions(messages: Message[], suggestionId: string, consumerAgentId: string, isRunning: boolean): void;
578
+ /**
579
+ * Notify subscribers of suggestions config changes
580
+ */
581
+ private notifySuggestionsConfigChanged;
582
+ /**
583
+ * Notify subscribers of suggestions changes
584
+ */
585
+ private notifySuggestionsChanged;
586
+ /**
587
+ * Notify subscribers that suggestions started loading
588
+ */
589
+ private notifySuggestionsStartedLoading;
590
+ /**
591
+ * Notify subscribers that suggestions finished loading
592
+ */
593
+ private notifySuggestionsFinishedLoading;
594
+ /**
595
+ * Check if suggestions should be shown based on availability and message count
596
+ */
597
+ private shouldShowSuggestions;
598
+ /**
599
+ * Add static suggestions directly without AI generation
600
+ */
601
+ private addStaticSuggestions;
602
+ }
603
+ //#endregion
604
+ //#region src/core/state-manager.d.ts
605
+ /**
606
+ * Manages state and message tracking by run for CopilotKitCore.
607
+ * Tracks agent state snapshots and message-to-run associations.
608
+ */
609
+ declare class StateManager {
610
+ private core;
611
+ private stateByRun;
612
+ private messageToRun;
613
+ private agentSubscriptions;
614
+ constructor(core: CopilotKitCore);
615
+ /**
616
+ * Initialize state tracking for an agent
617
+ */
618
+ initialize(): void;
619
+ /**
620
+ * Subscribe to an agent's events to track state and messages
621
+ */
622
+ subscribeToAgent(agent: AbstractAgent): void;
623
+ /**
624
+ * Unsubscribe from an agent's events
625
+ */
626
+ unsubscribeFromAgent(agentId: string): void;
627
+ /**
628
+ * Get state for a specific run
629
+ * Returns a deep copy to prevent external mutations
630
+ */
631
+ getStateByRun(agentId: string, threadId: string, runId: string): State | undefined;
632
+ /**
633
+ * Get runId associated with a message
634
+ */
635
+ getRunIdForMessage(agentId: string, threadId: string, messageId: string): string | undefined;
636
+ /**
637
+ * Get all states for an agent's thread
638
+ */
639
+ getStatesForThread(agentId: string, threadId: string): Map<string, State>;
640
+ /**
641
+ * Get all run IDs for an agent's thread
642
+ */
643
+ getRunIdsForThread(agentId: string, threadId: string): string[];
644
+ /**
645
+ * Handle run started event
646
+ */
647
+ private handleRunStarted;
648
+ /**
649
+ * Handle run finished event
650
+ */
651
+ private handleRunFinished;
652
+ /**
653
+ * Handle state snapshot event
654
+ */
655
+ private handleStateSnapshot;
656
+ /**
657
+ * Handle state delta event
658
+ */
659
+ private handleStateDelta;
660
+ /**
661
+ * Handle messages snapshot event
662
+ */
663
+ private handleMessagesSnapshot;
664
+ /**
665
+ * Handle new message event
666
+ */
667
+ private handleNewMessage;
668
+ /**
669
+ * Save state for a specific run
670
+ */
671
+ private saveState;
672
+ /**
673
+ * Associate a message with a run
674
+ */
675
+ private associateMessageWithRun;
676
+ /**
677
+ * Clear all state for an agent
678
+ */
679
+ clearAgentState(agentId: string): void;
680
+ /**
681
+ * Clear all state for a thread
682
+ */
683
+ clearThreadState(agentId: string, threadId: string): void;
684
+ }
685
+ //#endregion
686
+ //#region src/agent.d.ts
687
+ interface ProxiedCopilotRuntimeAgentConfig extends Omit<HttpAgentConfig, "url"> {
688
+ runtimeUrl?: string;
689
+ transport?: CopilotRuntimeTransport;
690
+ credentials?: RequestCredentials;
691
+ }
692
+ declare class ProxiedCopilotRuntimeAgent extends HttpAgent {
693
+ runtimeUrl?: string;
694
+ credentials?: RequestCredentials;
695
+ private transport;
696
+ private singleEndpointUrl?;
697
+ constructor(config: ProxiedCopilotRuntimeAgentConfig);
698
+ abortRun(): void;
699
+ connect(input: RunAgentInput): Observable<BaseEvent>;
700
+ run(input: RunAgentInput): Observable<BaseEvent>;
701
+ clone(): ProxiedCopilotRuntimeAgent;
702
+ private createSingleRouteRequestInit;
703
+ }
704
+ //#endregion
705
+ //#region src/utils/markdown.d.ts
706
+ declare function completePartialMarkdown(input: string): string;
707
+ //#endregion
708
+ export { AgentRegistry, ContextStore, CopilotKitCore, type CopilotKitCoreAddAgentParams, CopilotKitCoreConfig, type CopilotKitCoreConnectAgentParams, CopilotKitCoreErrorCode, CopilotKitCoreFriendsAccess, CopilotKitCoreGetSuggestionsResult, type CopilotKitCoreGetToolParams, type CopilotKitCoreRunAgentParams, CopilotKitCoreRuntimeConnectionStatus, CopilotKitCoreStopAgentParams, CopilotKitCoreSubscriber, CopilotKitCoreSubscription, CopilotRuntimeTransport, DynamicSuggestionsConfig, FrontendTool, FrontendToolHandlerContext, ProxiedCopilotRuntimeAgent, ProxiedCopilotRuntimeAgentConfig, RunHandler, StateManager, StaticSuggestionsConfig, Suggestion, SuggestionAvailability, SuggestionEngine, SuggestionsConfig, ToolCallStatus, completePartialMarkdown };
709
+ //# sourceMappingURL=index.d.cts.map