@copilotkitnext/core 1.51.2 → 1.51.3-next.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +27 -2
- package/dist/index.d.ts +27 -2
- package/dist/index.js +59 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +59 -6
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
package/dist/index.d.mts
CHANGED
|
@@ -92,6 +92,7 @@ declare class AgentRegistry {
|
|
|
92
92
|
private _runtimeVersion?;
|
|
93
93
|
private _runtimeConnectionStatus;
|
|
94
94
|
private _runtimeTransport;
|
|
95
|
+
private _audioFileTranscriptionEnabled;
|
|
95
96
|
constructor(core: CopilotKitCore);
|
|
96
97
|
/**
|
|
97
98
|
* Get all agents as a readonly record
|
|
@@ -101,6 +102,7 @@ declare class AgentRegistry {
|
|
|
101
102
|
get runtimeVersion(): string | undefined;
|
|
102
103
|
get runtimeConnectionStatus(): CopilotKitCoreRuntimeConnectionStatus;
|
|
103
104
|
get runtimeTransport(): CopilotRuntimeTransport;
|
|
105
|
+
get audioFileTranscriptionEnabled(): boolean;
|
|
104
106
|
/**
|
|
105
107
|
* Initialize agents from configuration
|
|
106
108
|
*/
|
|
@@ -134,6 +136,14 @@ declare class AgentRegistry {
|
|
|
134
136
|
* Apply current headers to all agents
|
|
135
137
|
*/
|
|
136
138
|
applyHeadersToAgents(agents: Record<string, AbstractAgent>): void;
|
|
139
|
+
/**
|
|
140
|
+
* Apply current credentials to an agent
|
|
141
|
+
*/
|
|
142
|
+
applyCredentialsToAgent(agent: AbstractAgent): void;
|
|
143
|
+
/**
|
|
144
|
+
* Apply current credentials to all agents
|
|
145
|
+
*/
|
|
146
|
+
applyCredentialsToAgents(agents: Record<string, AbstractAgent>): void;
|
|
137
147
|
/**
|
|
138
148
|
* Update runtime connection and fetch remote agents
|
|
139
149
|
*/
|
|
@@ -241,6 +251,8 @@ interface CopilotKitCoreConfig {
|
|
|
241
251
|
agents__unsafe_dev_only?: Record<string, AbstractAgent>;
|
|
242
252
|
/** Headers appended to every HTTP request made by `CopilotKitCore`. */
|
|
243
253
|
headers?: Record<string, string>;
|
|
254
|
+
/** Credentials mode for fetch requests (e.g., "include" for HTTP-only cookies). */
|
|
255
|
+
credentials?: RequestCredentials;
|
|
244
256
|
/** Properties sent as `forwardedProps` to the AG-UI agent. */
|
|
245
257
|
properties?: Record<string, unknown>;
|
|
246
258
|
/** Ordered collection of frontend tools available to the core. */
|
|
@@ -263,7 +275,13 @@ declare enum CopilotKitCoreErrorCode {
|
|
|
263
275
|
AGENT_RUN_FAILED_EVENT = "agent_run_failed_event",
|
|
264
276
|
AGENT_RUN_ERROR_EVENT = "agent_run_error_event",
|
|
265
277
|
TOOL_ARGUMENT_PARSE_FAILED = "tool_argument_parse_failed",
|
|
266
|
-
TOOL_HANDLER_FAILED = "tool_handler_failed"
|
|
278
|
+
TOOL_HANDLER_FAILED = "tool_handler_failed",
|
|
279
|
+
TRANSCRIPTION_FAILED = "transcription_failed",
|
|
280
|
+
TRANSCRIPTION_SERVICE_NOT_CONFIGURED = "transcription_service_not_configured",
|
|
281
|
+
TRANSCRIPTION_INVALID_AUDIO = "transcription_invalid_audio",
|
|
282
|
+
TRANSCRIPTION_RATE_LIMITED = "transcription_rate_limited",
|
|
283
|
+
TRANSCRIPTION_AUTH_FAILED = "transcription_auth_failed",
|
|
284
|
+
TRANSCRIPTION_NETWORK_ERROR = "transcription_network_error"
|
|
267
285
|
}
|
|
268
286
|
interface CopilotKitCoreSubscriber {
|
|
269
287
|
onRuntimeConnectionStatusChanged?: (event: {
|
|
@@ -346,6 +364,7 @@ interface CopilotKitCoreFriendsAccess {
|
|
|
346
364
|
context?: Record<string, any>;
|
|
347
365
|
}): Promise<void>;
|
|
348
366
|
readonly headers: Readonly<Record<string, string>>;
|
|
367
|
+
readonly credentials: RequestCredentials | undefined;
|
|
349
368
|
readonly properties: Readonly<Record<string, unknown>>;
|
|
350
369
|
readonly context: Readonly<Record<string, Context>>;
|
|
351
370
|
buildFrontendTools(agentId?: string): _ag_ui_client.Tool[];
|
|
@@ -357,6 +376,7 @@ interface CopilotKitCoreFriendsAccess {
|
|
|
357
376
|
}
|
|
358
377
|
declare class CopilotKitCore {
|
|
359
378
|
private _headers;
|
|
379
|
+
private _credentials?;
|
|
360
380
|
private _properties;
|
|
361
381
|
private subscribers;
|
|
362
382
|
private agentRegistry;
|
|
@@ -364,7 +384,7 @@ declare class CopilotKitCore {
|
|
|
364
384
|
private suggestionEngine;
|
|
365
385
|
private runHandler;
|
|
366
386
|
private stateManager;
|
|
367
|
-
constructor({ runtimeUrl, runtimeTransport, headers, properties, agents__unsafe_dev_only, tools, suggestionsConfig, }: CopilotKitCoreConfig);
|
|
387
|
+
constructor({ runtimeUrl, runtimeTransport, headers, credentials, properties, agents__unsafe_dev_only, tools, suggestionsConfig, }: CopilotKitCoreConfig);
|
|
368
388
|
/**
|
|
369
389
|
* Internal method used by delegate classes and subclasses to notify subscribers
|
|
370
390
|
*/
|
|
@@ -385,12 +405,15 @@ declare class CopilotKitCore {
|
|
|
385
405
|
setRuntimeTransport(runtimeTransport: CopilotRuntimeTransport): void;
|
|
386
406
|
get runtimeVersion(): string | undefined;
|
|
387
407
|
get headers(): Readonly<Record<string, string>>;
|
|
408
|
+
get credentials(): RequestCredentials | undefined;
|
|
388
409
|
get properties(): Readonly<Record<string, unknown>>;
|
|
389
410
|
get runtimeConnectionStatus(): CopilotKitCoreRuntimeConnectionStatus;
|
|
411
|
+
get audioFileTranscriptionEnabled(): boolean;
|
|
390
412
|
/**
|
|
391
413
|
* Configuration updates
|
|
392
414
|
*/
|
|
393
415
|
setHeaders(headers: Record<string, string>): void;
|
|
416
|
+
setCredentials(credentials: RequestCredentials | undefined): void;
|
|
394
417
|
setProperties(properties: Record<string, unknown>): void;
|
|
395
418
|
/**
|
|
396
419
|
* Agent management (delegated to AgentRegistry)
|
|
@@ -626,9 +649,11 @@ declare class StateManager {
|
|
|
626
649
|
interface ProxiedCopilotRuntimeAgentConfig extends Omit<HttpAgentConfig, "url"> {
|
|
627
650
|
runtimeUrl?: string;
|
|
628
651
|
transport?: CopilotRuntimeTransport;
|
|
652
|
+
credentials?: RequestCredentials;
|
|
629
653
|
}
|
|
630
654
|
declare class ProxiedCopilotRuntimeAgent extends HttpAgent {
|
|
631
655
|
runtimeUrl?: string;
|
|
656
|
+
credentials?: RequestCredentials;
|
|
632
657
|
private transport;
|
|
633
658
|
private singleEndpointUrl?;
|
|
634
659
|
constructor(config: ProxiedCopilotRuntimeAgentConfig);
|
package/dist/index.d.ts
CHANGED
|
@@ -92,6 +92,7 @@ declare class AgentRegistry {
|
|
|
92
92
|
private _runtimeVersion?;
|
|
93
93
|
private _runtimeConnectionStatus;
|
|
94
94
|
private _runtimeTransport;
|
|
95
|
+
private _audioFileTranscriptionEnabled;
|
|
95
96
|
constructor(core: CopilotKitCore);
|
|
96
97
|
/**
|
|
97
98
|
* Get all agents as a readonly record
|
|
@@ -101,6 +102,7 @@ declare class AgentRegistry {
|
|
|
101
102
|
get runtimeVersion(): string | undefined;
|
|
102
103
|
get runtimeConnectionStatus(): CopilotKitCoreRuntimeConnectionStatus;
|
|
103
104
|
get runtimeTransport(): CopilotRuntimeTransport;
|
|
105
|
+
get audioFileTranscriptionEnabled(): boolean;
|
|
104
106
|
/**
|
|
105
107
|
* Initialize agents from configuration
|
|
106
108
|
*/
|
|
@@ -134,6 +136,14 @@ declare class AgentRegistry {
|
|
|
134
136
|
* Apply current headers to all agents
|
|
135
137
|
*/
|
|
136
138
|
applyHeadersToAgents(agents: Record<string, AbstractAgent>): void;
|
|
139
|
+
/**
|
|
140
|
+
* Apply current credentials to an agent
|
|
141
|
+
*/
|
|
142
|
+
applyCredentialsToAgent(agent: AbstractAgent): void;
|
|
143
|
+
/**
|
|
144
|
+
* Apply current credentials to all agents
|
|
145
|
+
*/
|
|
146
|
+
applyCredentialsToAgents(agents: Record<string, AbstractAgent>): void;
|
|
137
147
|
/**
|
|
138
148
|
* Update runtime connection and fetch remote agents
|
|
139
149
|
*/
|
|
@@ -241,6 +251,8 @@ interface CopilotKitCoreConfig {
|
|
|
241
251
|
agents__unsafe_dev_only?: Record<string, AbstractAgent>;
|
|
242
252
|
/** Headers appended to every HTTP request made by `CopilotKitCore`. */
|
|
243
253
|
headers?: Record<string, string>;
|
|
254
|
+
/** Credentials mode for fetch requests (e.g., "include" for HTTP-only cookies). */
|
|
255
|
+
credentials?: RequestCredentials;
|
|
244
256
|
/** Properties sent as `forwardedProps` to the AG-UI agent. */
|
|
245
257
|
properties?: Record<string, unknown>;
|
|
246
258
|
/** Ordered collection of frontend tools available to the core. */
|
|
@@ -263,7 +275,13 @@ declare enum CopilotKitCoreErrorCode {
|
|
|
263
275
|
AGENT_RUN_FAILED_EVENT = "agent_run_failed_event",
|
|
264
276
|
AGENT_RUN_ERROR_EVENT = "agent_run_error_event",
|
|
265
277
|
TOOL_ARGUMENT_PARSE_FAILED = "tool_argument_parse_failed",
|
|
266
|
-
TOOL_HANDLER_FAILED = "tool_handler_failed"
|
|
278
|
+
TOOL_HANDLER_FAILED = "tool_handler_failed",
|
|
279
|
+
TRANSCRIPTION_FAILED = "transcription_failed",
|
|
280
|
+
TRANSCRIPTION_SERVICE_NOT_CONFIGURED = "transcription_service_not_configured",
|
|
281
|
+
TRANSCRIPTION_INVALID_AUDIO = "transcription_invalid_audio",
|
|
282
|
+
TRANSCRIPTION_RATE_LIMITED = "transcription_rate_limited",
|
|
283
|
+
TRANSCRIPTION_AUTH_FAILED = "transcription_auth_failed",
|
|
284
|
+
TRANSCRIPTION_NETWORK_ERROR = "transcription_network_error"
|
|
267
285
|
}
|
|
268
286
|
interface CopilotKitCoreSubscriber {
|
|
269
287
|
onRuntimeConnectionStatusChanged?: (event: {
|
|
@@ -346,6 +364,7 @@ interface CopilotKitCoreFriendsAccess {
|
|
|
346
364
|
context?: Record<string, any>;
|
|
347
365
|
}): Promise<void>;
|
|
348
366
|
readonly headers: Readonly<Record<string, string>>;
|
|
367
|
+
readonly credentials: RequestCredentials | undefined;
|
|
349
368
|
readonly properties: Readonly<Record<string, unknown>>;
|
|
350
369
|
readonly context: Readonly<Record<string, Context>>;
|
|
351
370
|
buildFrontendTools(agentId?: string): _ag_ui_client.Tool[];
|
|
@@ -357,6 +376,7 @@ interface CopilotKitCoreFriendsAccess {
|
|
|
357
376
|
}
|
|
358
377
|
declare class CopilotKitCore {
|
|
359
378
|
private _headers;
|
|
379
|
+
private _credentials?;
|
|
360
380
|
private _properties;
|
|
361
381
|
private subscribers;
|
|
362
382
|
private agentRegistry;
|
|
@@ -364,7 +384,7 @@ declare class CopilotKitCore {
|
|
|
364
384
|
private suggestionEngine;
|
|
365
385
|
private runHandler;
|
|
366
386
|
private stateManager;
|
|
367
|
-
constructor({ runtimeUrl, runtimeTransport, headers, properties, agents__unsafe_dev_only, tools, suggestionsConfig, }: CopilotKitCoreConfig);
|
|
387
|
+
constructor({ runtimeUrl, runtimeTransport, headers, credentials, properties, agents__unsafe_dev_only, tools, suggestionsConfig, }: CopilotKitCoreConfig);
|
|
368
388
|
/**
|
|
369
389
|
* Internal method used by delegate classes and subclasses to notify subscribers
|
|
370
390
|
*/
|
|
@@ -385,12 +405,15 @@ declare class CopilotKitCore {
|
|
|
385
405
|
setRuntimeTransport(runtimeTransport: CopilotRuntimeTransport): void;
|
|
386
406
|
get runtimeVersion(): string | undefined;
|
|
387
407
|
get headers(): Readonly<Record<string, string>>;
|
|
408
|
+
get credentials(): RequestCredentials | undefined;
|
|
388
409
|
get properties(): Readonly<Record<string, unknown>>;
|
|
389
410
|
get runtimeConnectionStatus(): CopilotKitCoreRuntimeConnectionStatus;
|
|
411
|
+
get audioFileTranscriptionEnabled(): boolean;
|
|
390
412
|
/**
|
|
391
413
|
* Configuration updates
|
|
392
414
|
*/
|
|
393
415
|
setHeaders(headers: Record<string, string>): void;
|
|
416
|
+
setCredentials(credentials: RequestCredentials | undefined): void;
|
|
394
417
|
setProperties(properties: Record<string, unknown>): void;
|
|
395
418
|
/**
|
|
396
419
|
* Agent management (delegated to AgentRegistry)
|
|
@@ -626,9 +649,11 @@ declare class StateManager {
|
|
|
626
649
|
interface ProxiedCopilotRuntimeAgentConfig extends Omit<HttpAgentConfig, "url"> {
|
|
627
650
|
runtimeUrl?: string;
|
|
628
651
|
transport?: CopilotRuntimeTransport;
|
|
652
|
+
credentials?: RequestCredentials;
|
|
629
653
|
}
|
|
630
654
|
declare class ProxiedCopilotRuntimeAgent extends HttpAgent {
|
|
631
655
|
runtimeUrl?: string;
|
|
656
|
+
credentials?: RequestCredentials;
|
|
632
657
|
private transport;
|
|
633
658
|
private singleEndpointUrl?;
|
|
634
659
|
constructor(config: ProxiedCopilotRuntimeAgentConfig);
|
package/dist/index.js
CHANGED
|
@@ -42,6 +42,7 @@ var import_shared = require("@copilotkitnext/shared");
|
|
|
42
42
|
var import_client = require("@ag-ui/client");
|
|
43
43
|
var ProxiedCopilotRuntimeAgent = class extends import_client.HttpAgent {
|
|
44
44
|
runtimeUrl;
|
|
45
|
+
credentials;
|
|
45
46
|
transport;
|
|
46
47
|
singleEndpointUrl;
|
|
47
48
|
constructor(config) {
|
|
@@ -56,6 +57,7 @@ var ProxiedCopilotRuntimeAgent = class extends import_client.HttpAgent {
|
|
|
56
57
|
url: runUrl
|
|
57
58
|
});
|
|
58
59
|
this.runtimeUrl = normalizedRuntimeUrl ?? config.runtimeUrl;
|
|
60
|
+
this.credentials = config.credentials;
|
|
59
61
|
this.transport = transport;
|
|
60
62
|
if (this.transport === "single") {
|
|
61
63
|
this.singleEndpointUrl = this.runtimeUrl;
|
|
@@ -82,7 +84,8 @@ var ProxiedCopilotRuntimeAgent = class extends import_client.HttpAgent {
|
|
|
82
84
|
agentId: this.agentId,
|
|
83
85
|
threadId: this.threadId
|
|
84
86
|
}
|
|
85
|
-
})
|
|
87
|
+
}),
|
|
88
|
+
...this.credentials ? { credentials: this.credentials } : {}
|
|
86
89
|
}).catch((error) => {
|
|
87
90
|
console.error("ProxiedCopilotRuntimeAgent: stop request failed", error);
|
|
88
91
|
});
|
|
@@ -100,7 +103,8 @@ var ProxiedCopilotRuntimeAgent = class extends import_client.HttpAgent {
|
|
|
100
103
|
headers: {
|
|
101
104
|
"Content-Type": "application/json",
|
|
102
105
|
...this.headers
|
|
103
|
-
}
|
|
106
|
+
},
|
|
107
|
+
...this.credentials ? { credentials: this.credentials } : {}
|
|
104
108
|
}).catch((error) => {
|
|
105
109
|
console.error("ProxiedCopilotRuntimeAgent: stop request failed", error);
|
|
106
110
|
});
|
|
@@ -135,6 +139,7 @@ var ProxiedCopilotRuntimeAgent = class extends import_client.HttpAgent {
|
|
|
135
139
|
clone() {
|
|
136
140
|
const cloned = super.clone();
|
|
137
141
|
cloned.runtimeUrl = this.runtimeUrl;
|
|
142
|
+
cloned.credentials = this.credentials;
|
|
138
143
|
cloned.transport = this.transport;
|
|
139
144
|
cloned.singleEndpointUrl = this.singleEndpointUrl;
|
|
140
145
|
return cloned;
|
|
@@ -168,7 +173,8 @@ var ProxiedCopilotRuntimeAgent = class extends import_client.HttpAgent {
|
|
|
168
173
|
return {
|
|
169
174
|
...baseInit,
|
|
170
175
|
headers,
|
|
171
|
-
body: JSON.stringify(envelope)
|
|
176
|
+
body: JSON.stringify(envelope),
|
|
177
|
+
...this.credentials ? { credentials: this.credentials } : {}
|
|
172
178
|
};
|
|
173
179
|
}
|
|
174
180
|
};
|
|
@@ -185,6 +191,7 @@ var AgentRegistry = class {
|
|
|
185
191
|
_runtimeVersion;
|
|
186
192
|
_runtimeConnectionStatus = "disconnected" /* Disconnected */;
|
|
187
193
|
_runtimeTransport = "rest";
|
|
194
|
+
_audioFileTranscriptionEnabled = false;
|
|
188
195
|
/**
|
|
189
196
|
* Get all agents as a readonly record
|
|
190
197
|
*/
|
|
@@ -203,6 +210,9 @@ var AgentRegistry = class {
|
|
|
203
210
|
get runtimeTransport() {
|
|
204
211
|
return this._runtimeTransport;
|
|
205
212
|
}
|
|
213
|
+
get audioFileTranscriptionEnabled() {
|
|
214
|
+
return this._audioFileTranscriptionEnabled;
|
|
215
|
+
}
|
|
206
216
|
/**
|
|
207
217
|
* Initialize agents from configuration
|
|
208
218
|
*/
|
|
@@ -290,6 +300,22 @@ var AgentRegistry = class {
|
|
|
290
300
|
this.applyHeadersToAgent(agent);
|
|
291
301
|
});
|
|
292
302
|
}
|
|
303
|
+
/**
|
|
304
|
+
* Apply current credentials to an agent
|
|
305
|
+
*/
|
|
306
|
+
applyCredentialsToAgent(agent) {
|
|
307
|
+
if (agent instanceof ProxiedCopilotRuntimeAgent) {
|
|
308
|
+
agent.credentials = this.core.credentials;
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
/**
|
|
312
|
+
* Apply current credentials to all agents
|
|
313
|
+
*/
|
|
314
|
+
applyCredentialsToAgents(agents) {
|
|
315
|
+
Object.values(agents).forEach((agent) => {
|
|
316
|
+
this.applyCredentialsToAgent(agent);
|
|
317
|
+
});
|
|
318
|
+
}
|
|
293
319
|
/**
|
|
294
320
|
* Update runtime connection and fetch remote agents
|
|
295
321
|
*/
|
|
@@ -300,6 +326,7 @@ var AgentRegistry = class {
|
|
|
300
326
|
if (!this.runtimeUrl) {
|
|
301
327
|
this._runtimeConnectionStatus = "disconnected" /* Disconnected */;
|
|
302
328
|
this._runtimeVersion = void 0;
|
|
329
|
+
this._audioFileTranscriptionEnabled = false;
|
|
303
330
|
this.remoteAgents = {};
|
|
304
331
|
this._agents = this.localAgents;
|
|
305
332
|
await this.notifyRuntimeStatusChanged("disconnected" /* Disconnected */);
|
|
@@ -314,6 +341,7 @@ var AgentRegistry = class {
|
|
|
314
341
|
version,
|
|
315
342
|
...runtimeInfo
|
|
316
343
|
} = runtimeInfoResponse;
|
|
344
|
+
const credentials = this.core.credentials;
|
|
317
345
|
const agents = Object.fromEntries(
|
|
318
346
|
Object.entries(runtimeInfo.agents).map(([id, { description }]) => {
|
|
319
347
|
const agent = new ProxiedCopilotRuntimeAgent({
|
|
@@ -321,7 +349,8 @@ var AgentRegistry = class {
|
|
|
321
349
|
agentId: id,
|
|
322
350
|
// Runtime agents always have their ID set correctly
|
|
323
351
|
description,
|
|
324
|
-
transport: this._runtimeTransport
|
|
352
|
+
transport: this._runtimeTransport,
|
|
353
|
+
credentials
|
|
325
354
|
});
|
|
326
355
|
this.applyHeadersToAgent(agent);
|
|
327
356
|
return [id, agent];
|
|
@@ -331,11 +360,13 @@ var AgentRegistry = class {
|
|
|
331
360
|
this._agents = { ...this.localAgents, ...this.remoteAgents };
|
|
332
361
|
this._runtimeConnectionStatus = "connected" /* Connected */;
|
|
333
362
|
this._runtimeVersion = version;
|
|
363
|
+
this._audioFileTranscriptionEnabled = runtimeInfoResponse.audioFileTranscriptionEnabled ?? false;
|
|
334
364
|
await this.notifyRuntimeStatusChanged("connected" /* Connected */);
|
|
335
365
|
await this.notifyAgentsChanged();
|
|
336
366
|
} catch (error) {
|
|
337
367
|
this._runtimeConnectionStatus = "error" /* Error */;
|
|
338
368
|
this._runtimeVersion = void 0;
|
|
369
|
+
this._audioFileTranscriptionEnabled = false;
|
|
339
370
|
this.remoteAgents = {};
|
|
340
371
|
this._agents = this.localAgents;
|
|
341
372
|
await this.notifyRuntimeStatusChanged("error" /* Error */);
|
|
@@ -357,6 +388,7 @@ var AgentRegistry = class {
|
|
|
357
388
|
throw new Error("Runtime URL is not set");
|
|
358
389
|
}
|
|
359
390
|
const baseHeaders = this.core.headers;
|
|
391
|
+
const credentials = this.core.credentials;
|
|
360
392
|
const headers = {
|
|
361
393
|
...baseHeaders
|
|
362
394
|
};
|
|
@@ -367,7 +399,8 @@ var AgentRegistry = class {
|
|
|
367
399
|
const response2 = await fetch(this.runtimeUrl, {
|
|
368
400
|
method: "POST",
|
|
369
401
|
headers,
|
|
370
|
-
body: JSON.stringify({ method: "info" })
|
|
402
|
+
body: JSON.stringify({ method: "info" }),
|
|
403
|
+
...credentials ? { credentials } : {}
|
|
371
404
|
});
|
|
372
405
|
if ("ok" in response2 && !response2.ok) {
|
|
373
406
|
throw new Error(`Runtime info request failed with status ${response2.status}`);
|
|
@@ -375,7 +408,8 @@ var AgentRegistry = class {
|
|
|
375
408
|
return await response2.json();
|
|
376
409
|
}
|
|
377
410
|
const response = await fetch(`${this.runtimeUrl}/info`, {
|
|
378
|
-
headers
|
|
411
|
+
headers,
|
|
412
|
+
...credentials ? { credentials } : {}
|
|
379
413
|
});
|
|
380
414
|
if ("ok" in response && !response.ok) {
|
|
381
415
|
throw new Error(`Runtime info request failed with status ${response.status}`);
|
|
@@ -1476,6 +1510,12 @@ var CopilotKitCoreErrorCode = /* @__PURE__ */ ((CopilotKitCoreErrorCode2) => {
|
|
|
1476
1510
|
CopilotKitCoreErrorCode2["AGENT_RUN_ERROR_EVENT"] = "agent_run_error_event";
|
|
1477
1511
|
CopilotKitCoreErrorCode2["TOOL_ARGUMENT_PARSE_FAILED"] = "tool_argument_parse_failed";
|
|
1478
1512
|
CopilotKitCoreErrorCode2["TOOL_HANDLER_FAILED"] = "tool_handler_failed";
|
|
1513
|
+
CopilotKitCoreErrorCode2["TRANSCRIPTION_FAILED"] = "transcription_failed";
|
|
1514
|
+
CopilotKitCoreErrorCode2["TRANSCRIPTION_SERVICE_NOT_CONFIGURED"] = "transcription_service_not_configured";
|
|
1515
|
+
CopilotKitCoreErrorCode2["TRANSCRIPTION_INVALID_AUDIO"] = "transcription_invalid_audio";
|
|
1516
|
+
CopilotKitCoreErrorCode2["TRANSCRIPTION_RATE_LIMITED"] = "transcription_rate_limited";
|
|
1517
|
+
CopilotKitCoreErrorCode2["TRANSCRIPTION_AUTH_FAILED"] = "transcription_auth_failed";
|
|
1518
|
+
CopilotKitCoreErrorCode2["TRANSCRIPTION_NETWORK_ERROR"] = "transcription_network_error";
|
|
1479
1519
|
return CopilotKitCoreErrorCode2;
|
|
1480
1520
|
})(CopilotKitCoreErrorCode || {});
|
|
1481
1521
|
var CopilotKitCoreRuntimeConnectionStatus = /* @__PURE__ */ ((CopilotKitCoreRuntimeConnectionStatus2) => {
|
|
@@ -1487,6 +1527,7 @@ var CopilotKitCoreRuntimeConnectionStatus = /* @__PURE__ */ ((CopilotKitCoreRunt
|
|
|
1487
1527
|
})(CopilotKitCoreRuntimeConnectionStatus || {});
|
|
1488
1528
|
var CopilotKitCore = class {
|
|
1489
1529
|
_headers;
|
|
1530
|
+
_credentials;
|
|
1490
1531
|
_properties;
|
|
1491
1532
|
subscribers = /* @__PURE__ */ new Set();
|
|
1492
1533
|
// Delegate classes
|
|
@@ -1499,12 +1540,14 @@ var CopilotKitCore = class {
|
|
|
1499
1540
|
runtimeUrl,
|
|
1500
1541
|
runtimeTransport = "rest",
|
|
1501
1542
|
headers = {},
|
|
1543
|
+
credentials,
|
|
1502
1544
|
properties = {},
|
|
1503
1545
|
agents__unsafe_dev_only = {},
|
|
1504
1546
|
tools = [],
|
|
1505
1547
|
suggestionsConfig = []
|
|
1506
1548
|
}) {
|
|
1507
1549
|
this._headers = headers;
|
|
1550
|
+
this._credentials = credentials;
|
|
1508
1551
|
this._properties = properties;
|
|
1509
1552
|
this.agentRegistry = new AgentRegistry(this);
|
|
1510
1553
|
this.contextStore = new ContextStore(this);
|
|
@@ -1589,12 +1632,18 @@ var CopilotKitCore = class {
|
|
|
1589
1632
|
get headers() {
|
|
1590
1633
|
return this._headers;
|
|
1591
1634
|
}
|
|
1635
|
+
get credentials() {
|
|
1636
|
+
return this._credentials;
|
|
1637
|
+
}
|
|
1592
1638
|
get properties() {
|
|
1593
1639
|
return this._properties;
|
|
1594
1640
|
}
|
|
1595
1641
|
get runtimeConnectionStatus() {
|
|
1596
1642
|
return this.agentRegistry.runtimeConnectionStatus;
|
|
1597
1643
|
}
|
|
1644
|
+
get audioFileTranscriptionEnabled() {
|
|
1645
|
+
return this.agentRegistry.audioFileTranscriptionEnabled;
|
|
1646
|
+
}
|
|
1598
1647
|
/**
|
|
1599
1648
|
* Configuration updates
|
|
1600
1649
|
*/
|
|
@@ -1609,6 +1658,10 @@ var CopilotKitCore = class {
|
|
|
1609
1658
|
"Subscriber onHeadersChanged error:"
|
|
1610
1659
|
);
|
|
1611
1660
|
}
|
|
1661
|
+
setCredentials(credentials) {
|
|
1662
|
+
this._credentials = credentials;
|
|
1663
|
+
this.agentRegistry.applyCredentialsToAgents(this.agentRegistry.agents);
|
|
1664
|
+
}
|
|
1612
1665
|
setProperties(properties) {
|
|
1613
1666
|
this._properties = properties;
|
|
1614
1667
|
void this.notifySubscribers(
|