@copilotkit/core 1.59.5-canary.1781104893 → 1.60.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.umd.js CHANGED
@@ -995,6 +995,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
995
995
  _defineProperty(this, "_runtimeMode", _copilotkit_shared.RUNTIME_MODE_SSE);
996
996
  _defineProperty(this, "_intelligence", void 0);
997
997
  _defineProperty(this, "_a2uiEnabled", false);
998
+ _defineProperty(this, "_a2uiAgents", void 0);
998
999
  _defineProperty(this, "_openGenerativeUIEnabled", false);
999
1000
  _defineProperty(this, "_licenseStatus", void 0);
1000
1001
  _defineProperty(this, "_telemetryDisabled", false);
@@ -1029,6 +1030,13 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
1029
1030
  get a2uiEnabled() {
1030
1031
  return this._a2uiEnabled;
1031
1032
  }
1033
+ /**
1034
+ * Agent ids the runtime applies A2UI to (#5369). `undefined` means A2UI
1035
+ * applies to every agent — or is disabled entirely; check `a2uiEnabled`.
1036
+ */
1037
+ get a2uiAgents() {
1038
+ return this._a2uiAgents;
1039
+ }
1032
1040
  get openGenerativeUIEnabled() {
1033
1041
  return this._openGenerativeUIEnabled;
1034
1042
  }
@@ -1197,6 +1205,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
1197
1205
  this._runtimeMode = _copilotkit_shared.RUNTIME_MODE_SSE;
1198
1206
  this._intelligence = void 0;
1199
1207
  this._a2uiEnabled = false;
1208
+ this._a2uiAgents = void 0;
1200
1209
  this._openGenerativeUIEnabled = false;
1201
1210
  this.remoteAgents = {};
1202
1211
  this._agents = this.localAgents;
@@ -1207,7 +1216,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
1207
1216
  this._runtimeConnectionStatus = CopilotKitCoreRuntimeConnectionStatus.Connecting;
1208
1217
  await this.notifyRuntimeStatusChanged(CopilotKitCoreRuntimeConnectionStatus.Connecting);
1209
1218
  try {
1210
- var _runtimeInfoResponse$2, _runtimeInfoResponse$3, _runtimeInfoResponse$4, _runtimeInfoResponse$5, _runtimeInfoResponse$6;
1219
+ var _runtimeInfoResponse$2, _runtimeInfoResponse$3, _ref, _a2uiInfo$enabled, _runtimeInfoResponse$4, _runtimeInfoResponse$5;
1211
1220
  const runtimeInfoResponse = await this.fetchRuntimeInfo();
1212
1221
  const { version, ...runtimeInfo } = runtimeInfoResponse;
1213
1222
  const credentials = this.core.credentials;
@@ -1237,10 +1246,12 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
1237
1246
  this._audioFileTranscriptionEnabled = (_runtimeInfoResponse$2 = runtimeInfoResponse.audioFileTranscriptionEnabled) !== null && _runtimeInfoResponse$2 !== void 0 ? _runtimeInfoResponse$2 : false;
1238
1247
  this._runtimeMode = (_runtimeInfoResponse$3 = runtimeInfoResponse.mode) !== null && _runtimeInfoResponse$3 !== void 0 ? _runtimeInfoResponse$3 : _copilotkit_shared.RUNTIME_MODE_SSE;
1239
1248
  this._intelligence = runtimeInfoResponse.intelligence;
1240
- this._a2uiEnabled = (_runtimeInfoResponse$4 = runtimeInfoResponse.a2uiEnabled) !== null && _runtimeInfoResponse$4 !== void 0 ? _runtimeInfoResponse$4 : false;
1241
- this._openGenerativeUIEnabled = (_runtimeInfoResponse$5 = runtimeInfoResponse.openGenerativeUIEnabled) !== null && _runtimeInfoResponse$5 !== void 0 ? _runtimeInfoResponse$5 : false;
1249
+ const a2uiInfo = runtimeInfoResponse.a2ui;
1250
+ 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
+ this._a2uiAgents = (a2uiInfo === null || a2uiInfo === void 0 ? void 0 : a2uiInfo.enabled) ? a2uiInfo.agents : void 0;
1252
+ this._openGenerativeUIEnabled = (_runtimeInfoResponse$4 = runtimeInfoResponse.openGenerativeUIEnabled) !== null && _runtimeInfoResponse$4 !== void 0 ? _runtimeInfoResponse$4 : false;
1242
1253
  this._licenseStatus = runtimeInfoResponse.licenseStatus;
1243
- this._telemetryDisabled = (_runtimeInfoResponse$6 = runtimeInfoResponse.telemetryDisabled) !== null && _runtimeInfoResponse$6 !== void 0 ? _runtimeInfoResponse$6 : false;
1254
+ this._telemetryDisabled = (_runtimeInfoResponse$5 = runtimeInfoResponse.telemetryDisabled) !== null && _runtimeInfoResponse$5 !== void 0 ? _runtimeInfoResponse$5 : false;
1244
1255
  await this.notifyRuntimeStatusChanged(CopilotKitCoreRuntimeConnectionStatus.Connected);
1245
1256
  await this.notifyAgentsChanged();
1246
1257
  } catch (error) {
@@ -1250,6 +1261,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
1250
1261
  this._runtimeMode = _copilotkit_shared.RUNTIME_MODE_SSE;
1251
1262
  this._intelligence = void 0;
1252
1263
  this._a2uiEnabled = false;
1264
+ this._a2uiAgents = void 0;
1253
1265
  this._openGenerativeUIEnabled = false;
1254
1266
  this.remoteAgents = {};
1255
1267
  this._agents = this.localAgents;
@@ -1369,19 +1381,32 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
1369
1381
  return this._context;
1370
1382
  }
1371
1383
  /**
1372
- * Add a new context entry
1384
+ * Add a new context entry. Pass `agentIds` to restrict the entry to runs of
1385
+ * specific agents (#5369); omit it for context every agent should receive.
1373
1386
  * @returns The ID of the created context entry
1374
1387
  */
1375
- addContext({ description, value }) {
1388
+ addContext({ description, value, agentIds }) {
1376
1389
  const id = (0, _copilotkit_shared.randomUUID)();
1377
1390
  this._context[id] = {
1378
1391
  description,
1379
- value
1392
+ value,
1393
+ ...agentIds ? { agentIds } : {}
1380
1394
  };
1381
1395
  this.notifySubscribers();
1382
1396
  return id;
1383
1397
  }
1384
1398
  /**
1399
+ * Build the context array for a run of the given agent: entries scoped to
1400
+ * other agents are dropped, and the scoping metadata is stripped so only
1401
+ * protocol-shaped `{ description, value }` entries go over the wire.
1402
+ */
1403
+ getContextForAgent(agentId) {
1404
+ return Object.values(this._context).filter((entry) => !entry.agentIds || agentId !== void 0 && entry.agentIds.includes(agentId)).map(({ description, value }) => ({
1405
+ description,
1406
+ value
1407
+ }));
1408
+ }
1409
+ /**
1385
1410
  * Remove a context entry by ID
1386
1411
  */
1387
1412
  removeContext(id) {
@@ -1515,7 +1540,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
1515
1540
  ].join("\n")
1516
1541
  });
1517
1542
  await agent.runAgent({
1518
- context: Object.values(this.core.context),
1543
+ context: this.core.getContextForAgent(consumerAgentId),
1519
1544
  forwardedProps: {
1520
1545
  ...this.core.properties,
1521
1546
  toolChoice: {
@@ -1818,7 +1843,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
1818
1843
  const runAgentResult = await agent.connectAgent({
1819
1844
  forwardedProps: this._internal.properties,
1820
1845
  tools: this.buildFrontendTools(agent.agentId),
1821
- context: Object.values(this._internal.context)
1846
+ context: this._internal.getContextForAgent(agent.agentId)
1822
1847
  }, this.createAgentErrorSubscriber(agent));
1823
1848
  return this.processAgentResult({
1824
1849
  runAgentResult,
@@ -1864,7 +1889,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
1864
1889
  ...forwardedProps
1865
1890
  },
1866
1891
  tools: this.buildFrontendTools(agent.agentId),
1867
- context: Object.values(this._internal.context)
1892
+ context: this._internal.getContextForAgent(agent.agentId)
1868
1893
  }, this.createAgentErrorSubscriber(agent));
1869
1894
  return await this.processAgentResult({
1870
1895
  runAgentResult,
@@ -2831,6 +2856,13 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2831
2856
  get a2uiEnabled() {
2832
2857
  return this.agentRegistry.a2uiEnabled;
2833
2858
  }
2859
+ /**
2860
+ * Agent ids the runtime applies A2UI to. `undefined` means A2UI applies to
2861
+ * every agent (or is disabled — check `a2uiEnabled`).
2862
+ */
2863
+ get a2uiAgents() {
2864
+ return this.agentRegistry.a2uiAgents;
2865
+ }
2834
2866
  get openGenerativeUIEnabled() {
2835
2867
  return this.agentRegistry.openGenerativeUIEnabled;
2836
2868
  }
@@ -2906,7 +2938,9 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2906
2938
  return this.agentRegistry.getAgent(id);
2907
2939
  }
2908
2940
  /**
2909
- * Context management (delegated to ContextStore)
2941
+ * Context management (delegated to ContextStore).
2942
+ * Pass `agentIds` to restrict the entry to runs of specific agents;
2943
+ * omit it for context every agent should receive.
2910
2944
  */
2911
2945
  addContext(context) {
2912
2946
  return this.contextStore.addContext(context);
@@ -2915,6 +2949,13 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2915
2949
  this.contextStore.removeContext(id);
2916
2950
  }
2917
2951
  /**
2952
+ * Build the context array for a run of the given agent, dropping entries
2953
+ * scoped to other agents and stripping the scoping metadata.
2954
+ */
2955
+ getContextForAgent(agentId) {
2956
+ return this.contextStore.getContextForAgent(agentId);
2957
+ }
2958
+ /**
2918
2959
  * Thread store registry (delegated to ThreadStoreRegistry)
2919
2960
  */
2920
2961
  registerThreadStore(agentId, store) {