@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.umd.js
CHANGED
|
@@ -994,6 +994,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
994
994
|
_defineProperty(this, "_audioFileTranscriptionEnabled", false);
|
|
995
995
|
_defineProperty(this, "_runtimeMode", _copilotkit_shared.RUNTIME_MODE_SSE);
|
|
996
996
|
_defineProperty(this, "_intelligence", void 0);
|
|
997
|
+
_defineProperty(this, "_threadEndpoints", void 0);
|
|
997
998
|
_defineProperty(this, "_a2uiEnabled", false);
|
|
998
999
|
_defineProperty(this, "_a2uiAgents", void 0);
|
|
999
1000
|
_defineProperty(this, "_openGenerativeUIEnabled", false);
|
|
@@ -1027,6 +1028,9 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
1027
1028
|
get intelligence() {
|
|
1028
1029
|
return this._intelligence;
|
|
1029
1030
|
}
|
|
1031
|
+
get threadEndpoints() {
|
|
1032
|
+
return this._threadEndpoints;
|
|
1033
|
+
}
|
|
1030
1034
|
get a2uiEnabled() {
|
|
1031
1035
|
return this._a2uiEnabled;
|
|
1032
1036
|
}
|
|
@@ -1204,6 +1208,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
1204
1208
|
this._audioFileTranscriptionEnabled = false;
|
|
1205
1209
|
this._runtimeMode = _copilotkit_shared.RUNTIME_MODE_SSE;
|
|
1206
1210
|
this._intelligence = void 0;
|
|
1211
|
+
this._threadEndpoints = void 0;
|
|
1207
1212
|
this._a2uiEnabled = false;
|
|
1208
1213
|
this._a2uiAgents = void 0;
|
|
1209
1214
|
this._openGenerativeUIEnabled = false;
|
|
@@ -1223,6 +1228,12 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
1223
1228
|
const rawDebug = this.core.debug;
|
|
1224
1229
|
this.remoteAgents = Object.fromEntries(Object.entries(runtimeInfo.agents).map(([id, { description, capabilities }]) => {
|
|
1225
1230
|
var _runtimeInfoResponse$;
|
|
1231
|
+
const existing = Object.prototype.hasOwnProperty.call(this.remoteAgents, id) ? this.remoteAgents[id] : void 0;
|
|
1232
|
+
if (existing instanceof ProxiedCopilotRuntimeAgent) {
|
|
1233
|
+
this.applyHeadersToAgent(existing);
|
|
1234
|
+
this.applyCredentialsToAgent(existing);
|
|
1235
|
+
return [id, existing];
|
|
1236
|
+
}
|
|
1226
1237
|
const agent = new ProxiedCopilotRuntimeAgent({
|
|
1227
1238
|
runtimeUrl: this.runtimeUrl,
|
|
1228
1239
|
agentId: id,
|
|
@@ -1246,6 +1257,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
1246
1257
|
this._audioFileTranscriptionEnabled = (_runtimeInfoResponse$2 = runtimeInfoResponse.audioFileTranscriptionEnabled) !== null && _runtimeInfoResponse$2 !== void 0 ? _runtimeInfoResponse$2 : false;
|
|
1247
1258
|
this._runtimeMode = (_runtimeInfoResponse$3 = runtimeInfoResponse.mode) !== null && _runtimeInfoResponse$3 !== void 0 ? _runtimeInfoResponse$3 : _copilotkit_shared.RUNTIME_MODE_SSE;
|
|
1248
1259
|
this._intelligence = runtimeInfoResponse.intelligence;
|
|
1260
|
+
this._threadEndpoints = runtimeInfoResponse.threadEndpoints;
|
|
1249
1261
|
const a2uiInfo = runtimeInfoResponse.a2ui;
|
|
1250
1262
|
this._a2uiEnabled = (_ref = (_a2uiInfo$enabled = a2uiInfo === null || a2uiInfo === void 0 ? void 0 : a2uiInfo.enabled) !== null && _a2uiInfo$enabled !== void 0 ? _a2uiInfo$enabled : runtimeInfoResponse.a2uiEnabled) !== null && _ref !== void 0 ? _ref : false;
|
|
1251
1263
|
this._a2uiAgents = (a2uiInfo === null || a2uiInfo === void 0 ? void 0 : a2uiInfo.enabled) ? a2uiInfo.agents : void 0;
|
|
@@ -1260,6 +1272,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
1260
1272
|
this._audioFileTranscriptionEnabled = false;
|
|
1261
1273
|
this._runtimeMode = _copilotkit_shared.RUNTIME_MODE_SSE;
|
|
1262
1274
|
this._intelligence = void 0;
|
|
1275
|
+
this._threadEndpoints = void 0;
|
|
1263
1276
|
this._a2uiEnabled = false;
|
|
1264
1277
|
this._a2uiAgents = void 0;
|
|
1265
1278
|
this._openGenerativeUIEnabled = false;
|
|
@@ -2684,6 +2697,15 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
2684
2697
|
CopilotKitCoreRuntimeConnectionStatus["Error"] = "error";
|
|
2685
2698
|
return CopilotKitCoreRuntimeConnectionStatus;
|
|
2686
2699
|
}({});
|
|
2700
|
+
/**
|
|
2701
|
+
* Normalize a header map to the internal invariant: a `Record<string, string>`
|
|
2702
|
+
* with no `null`/`undefined` values. Entries whose value is `null`/`undefined`
|
|
2703
|
+
* are dropped (this is how a header is cleared). Shared by the constructor and
|
|
2704
|
+
* `setHeaders` so both write paths into `_headers` enforce the same invariant.
|
|
2705
|
+
*/
|
|
2706
|
+
function normalizeHeaders(headers) {
|
|
2707
|
+
return Object.fromEntries(Object.entries(headers).filter((entry) => entry[1] != null));
|
|
2708
|
+
}
|
|
2687
2709
|
var CopilotKitCore = class {
|
|
2688
2710
|
constructor({ runtimeUrl, runtimeTransport = "auto", headers = {}, credentials, properties = {}, agents__unsafe_dev_only = {}, tools = [], suggestionsConfig = [], debug }) {
|
|
2689
2711
|
_defineProperty(this, "_headers", void 0);
|
|
@@ -2699,7 +2721,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
2699
2721
|
_defineProperty(this, "stateManager", void 0);
|
|
2700
2722
|
_defineProperty(this, "threadStoreRegistry", void 0);
|
|
2701
2723
|
_defineProperty(this, "previousAgentIds", /* @__PURE__ */ new Set());
|
|
2702
|
-
this._headers = headers;
|
|
2724
|
+
this._headers = normalizeHeaders(headers);
|
|
2703
2725
|
this._credentials = credentials;
|
|
2704
2726
|
this._properties = properties;
|
|
2705
2727
|
this._debug = debug;
|
|
@@ -2853,6 +2875,9 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
2853
2875
|
get intelligence() {
|
|
2854
2876
|
return this.agentRegistry.intelligence;
|
|
2855
2877
|
}
|
|
2878
|
+
get threadEndpoints() {
|
|
2879
|
+
return this.agentRegistry.threadEndpoints;
|
|
2880
|
+
}
|
|
2856
2881
|
get a2uiEnabled() {
|
|
2857
2882
|
return this.agentRegistry.a2uiEnabled;
|
|
2858
2883
|
}
|
|
@@ -2875,8 +2900,27 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
2875
2900
|
/**
|
|
2876
2901
|
* Configuration updates
|
|
2877
2902
|
*/
|
|
2903
|
+
/**
|
|
2904
|
+
* Replace the headers sent with every runtime request.
|
|
2905
|
+
*
|
|
2906
|
+
* This is an overwrite, not a merge — the supplied object becomes the
|
|
2907
|
+
* complete header set. Entries whose value is `null` or `undefined` are
|
|
2908
|
+
* dropped, which is how you clear a header (e.g. removing `Authorization`
|
|
2909
|
+
* on logout) without leaving an empty-string value behind:
|
|
2910
|
+
*
|
|
2911
|
+
* ```ts
|
|
2912
|
+
* copilotkit.setHeaders({
|
|
2913
|
+
* ...copilotkit.headers,
|
|
2914
|
+
* Authorization: token ? `Bearer ${token}` : null,
|
|
2915
|
+
* });
|
|
2916
|
+
* ```
|
|
2917
|
+
*
|
|
2918
|
+
* The resulting header set is also re-applied to every registered
|
|
2919
|
+
* `HttpAgent`-derived agent (replacing its `headers`) and `onHeadersChanged`
|
|
2920
|
+
* subscribers are notified.
|
|
2921
|
+
*/
|
|
2878
2922
|
setHeaders(headers) {
|
|
2879
|
-
this._headers = headers;
|
|
2923
|
+
this._headers = normalizeHeaders(headers);
|
|
2880
2924
|
this.agentRegistry.applyHeadersToAgents(this.agentRegistry.agents);
|
|
2881
2925
|
this.notifySubscribers((subscriber) => {
|
|
2882
2926
|
var _subscriber$onHeaders;
|