@copilotkit/core 1.60.2 → 1.61.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.
- package/dist/index.cjs +46 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +25 -3
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +25 -3
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +46 -2
- package/dist/index.mjs.map +1 -1
- package/dist/index.umd.js +46 -2
- package/dist/index.umd.js.map +1 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -876,6 +876,7 @@ var AgentRegistry = class {
|
|
|
876
876
|
_audioFileTranscriptionEnabled = false;
|
|
877
877
|
_runtimeMode = _copilotkit_shared.RUNTIME_MODE_SSE;
|
|
878
878
|
_intelligence;
|
|
879
|
+
_threadEndpoints;
|
|
879
880
|
_a2uiEnabled = false;
|
|
880
881
|
_a2uiAgents;
|
|
881
882
|
_openGenerativeUIEnabled = false;
|
|
@@ -911,6 +912,9 @@ var AgentRegistry = class {
|
|
|
911
912
|
get intelligence() {
|
|
912
913
|
return this._intelligence;
|
|
913
914
|
}
|
|
915
|
+
get threadEndpoints() {
|
|
916
|
+
return this._threadEndpoints;
|
|
917
|
+
}
|
|
914
918
|
get a2uiEnabled() {
|
|
915
919
|
return this._a2uiEnabled;
|
|
916
920
|
}
|
|
@@ -1088,6 +1092,7 @@ var AgentRegistry = class {
|
|
|
1088
1092
|
this._audioFileTranscriptionEnabled = false;
|
|
1089
1093
|
this._runtimeMode = _copilotkit_shared.RUNTIME_MODE_SSE;
|
|
1090
1094
|
this._intelligence = void 0;
|
|
1095
|
+
this._threadEndpoints = void 0;
|
|
1091
1096
|
this._a2uiEnabled = false;
|
|
1092
1097
|
this._a2uiAgents = void 0;
|
|
1093
1098
|
this._openGenerativeUIEnabled = false;
|
|
@@ -1105,6 +1110,12 @@ var AgentRegistry = class {
|
|
|
1105
1110
|
const credentials = this.core.credentials;
|
|
1106
1111
|
const rawDebug = this.core.debug;
|
|
1107
1112
|
this.remoteAgents = Object.fromEntries(Object.entries(runtimeInfo.agents).map(([id, { description, capabilities }]) => {
|
|
1113
|
+
const existing = Object.prototype.hasOwnProperty.call(this.remoteAgents, id) ? this.remoteAgents[id] : void 0;
|
|
1114
|
+
if (existing instanceof ProxiedCopilotRuntimeAgent) {
|
|
1115
|
+
this.applyHeadersToAgent(existing);
|
|
1116
|
+
this.applyCredentialsToAgent(existing);
|
|
1117
|
+
return [id, existing];
|
|
1118
|
+
}
|
|
1108
1119
|
const agent = new ProxiedCopilotRuntimeAgent({
|
|
1109
1120
|
runtimeUrl: this.runtimeUrl,
|
|
1110
1121
|
agentId: id,
|
|
@@ -1128,6 +1139,7 @@ var AgentRegistry = class {
|
|
|
1128
1139
|
this._audioFileTranscriptionEnabled = runtimeInfoResponse.audioFileTranscriptionEnabled ?? false;
|
|
1129
1140
|
this._runtimeMode = runtimeInfoResponse.mode ?? _copilotkit_shared.RUNTIME_MODE_SSE;
|
|
1130
1141
|
this._intelligence = runtimeInfoResponse.intelligence;
|
|
1142
|
+
this._threadEndpoints = runtimeInfoResponse.threadEndpoints;
|
|
1131
1143
|
const a2uiInfo = runtimeInfoResponse.a2ui;
|
|
1132
1144
|
this._a2uiEnabled = a2uiInfo?.enabled ?? runtimeInfoResponse.a2uiEnabled ?? false;
|
|
1133
1145
|
this._a2uiAgents = a2uiInfo?.enabled ? a2uiInfo.agents : void 0;
|
|
@@ -1142,6 +1154,7 @@ var AgentRegistry = class {
|
|
|
1142
1154
|
this._audioFileTranscriptionEnabled = false;
|
|
1143
1155
|
this._runtimeMode = _copilotkit_shared.RUNTIME_MODE_SSE;
|
|
1144
1156
|
this._intelligence = void 0;
|
|
1157
|
+
this._threadEndpoints = void 0;
|
|
1145
1158
|
this._a2uiEnabled = false;
|
|
1146
1159
|
this._a2uiAgents = void 0;
|
|
1147
1160
|
this._openGenerativeUIEnabled = false;
|
|
@@ -2528,6 +2541,15 @@ let CopilotKitCoreRuntimeConnectionStatus = /* @__PURE__ */ function(CopilotKitC
|
|
|
2528
2541
|
CopilotKitCoreRuntimeConnectionStatus["Error"] = "error";
|
|
2529
2542
|
return CopilotKitCoreRuntimeConnectionStatus;
|
|
2530
2543
|
}({});
|
|
2544
|
+
/**
|
|
2545
|
+
* Normalize a header map to the internal invariant: a `Record<string, string>`
|
|
2546
|
+
* with no `null`/`undefined` values. Entries whose value is `null`/`undefined`
|
|
2547
|
+
* are dropped (this is how a header is cleared). Shared by the constructor and
|
|
2548
|
+
* `setHeaders` so both write paths into `_headers` enforce the same invariant.
|
|
2549
|
+
*/
|
|
2550
|
+
function normalizeHeaders(headers) {
|
|
2551
|
+
return Object.fromEntries(Object.entries(headers).filter((entry) => entry[1] != null));
|
|
2552
|
+
}
|
|
2531
2553
|
var CopilotKitCore = class {
|
|
2532
2554
|
_headers;
|
|
2533
2555
|
_credentials;
|
|
@@ -2549,7 +2571,7 @@ var CopilotKitCore = class {
|
|
|
2549
2571
|
*/
|
|
2550
2572
|
previousAgentIds = /* @__PURE__ */ new Set();
|
|
2551
2573
|
constructor({ runtimeUrl, runtimeTransport = "auto", headers = {}, credentials, properties = {}, agents__unsafe_dev_only = {}, tools = [], suggestionsConfig = [], debug }) {
|
|
2552
|
-
this._headers = headers;
|
|
2574
|
+
this._headers = normalizeHeaders(headers);
|
|
2553
2575
|
this._credentials = credentials;
|
|
2554
2576
|
this._properties = properties;
|
|
2555
2577
|
this._debug = debug;
|
|
@@ -2700,6 +2722,9 @@ var CopilotKitCore = class {
|
|
|
2700
2722
|
get intelligence() {
|
|
2701
2723
|
return this.agentRegistry.intelligence;
|
|
2702
2724
|
}
|
|
2725
|
+
get threadEndpoints() {
|
|
2726
|
+
return this.agentRegistry.threadEndpoints;
|
|
2727
|
+
}
|
|
2703
2728
|
get a2uiEnabled() {
|
|
2704
2729
|
return this.agentRegistry.a2uiEnabled;
|
|
2705
2730
|
}
|
|
@@ -2722,8 +2747,27 @@ var CopilotKitCore = class {
|
|
|
2722
2747
|
/**
|
|
2723
2748
|
* Configuration updates
|
|
2724
2749
|
*/
|
|
2750
|
+
/**
|
|
2751
|
+
* Replace the headers sent with every runtime request.
|
|
2752
|
+
*
|
|
2753
|
+
* This is an overwrite, not a merge — the supplied object becomes the
|
|
2754
|
+
* complete header set. Entries whose value is `null` or `undefined` are
|
|
2755
|
+
* dropped, which is how you clear a header (e.g. removing `Authorization`
|
|
2756
|
+
* on logout) without leaving an empty-string value behind:
|
|
2757
|
+
*
|
|
2758
|
+
* ```ts
|
|
2759
|
+
* copilotkit.setHeaders({
|
|
2760
|
+
* ...copilotkit.headers,
|
|
2761
|
+
* Authorization: token ? `Bearer ${token}` : null,
|
|
2762
|
+
* });
|
|
2763
|
+
* ```
|
|
2764
|
+
*
|
|
2765
|
+
* The resulting header set is also re-applied to every registered
|
|
2766
|
+
* `HttpAgent`-derived agent (replacing its `headers`) and `onHeadersChanged`
|
|
2767
|
+
* subscribers are notified.
|
|
2768
|
+
*/
|
|
2725
2769
|
setHeaders(headers) {
|
|
2726
|
-
this._headers = headers;
|
|
2770
|
+
this._headers = normalizeHeaders(headers);
|
|
2727
2771
|
this.agentRegistry.applyHeadersToAgents(this.agentRegistry.agents);
|
|
2728
2772
|
this.notifySubscribers((subscriber) => subscriber.onHeadersChanged?.({
|
|
2729
2773
|
copilotkit: this,
|