@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.cjs +49 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +70 -35
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +70 -35
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +49 -8
- package/dist/index.mjs.map +1 -1
- package/dist/index.umd.js +52 -11
- package/dist/index.umd.js.map +1 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -877,6 +877,7 @@ var AgentRegistry = class {
|
|
|
877
877
|
_runtimeMode = _copilotkit_shared.RUNTIME_MODE_SSE;
|
|
878
878
|
_intelligence;
|
|
879
879
|
_a2uiEnabled = false;
|
|
880
|
+
_a2uiAgents;
|
|
880
881
|
_openGenerativeUIEnabled = false;
|
|
881
882
|
_licenseStatus;
|
|
882
883
|
_telemetryDisabled = false;
|
|
@@ -913,6 +914,13 @@ var AgentRegistry = class {
|
|
|
913
914
|
get a2uiEnabled() {
|
|
914
915
|
return this._a2uiEnabled;
|
|
915
916
|
}
|
|
917
|
+
/**
|
|
918
|
+
* Agent ids the runtime applies A2UI to (#5369). `undefined` means A2UI
|
|
919
|
+
* applies to every agent — or is disabled entirely; check `a2uiEnabled`.
|
|
920
|
+
*/
|
|
921
|
+
get a2uiAgents() {
|
|
922
|
+
return this._a2uiAgents;
|
|
923
|
+
}
|
|
916
924
|
get openGenerativeUIEnabled() {
|
|
917
925
|
return this._openGenerativeUIEnabled;
|
|
918
926
|
}
|
|
@@ -1081,6 +1089,7 @@ var AgentRegistry = class {
|
|
|
1081
1089
|
this._runtimeMode = _copilotkit_shared.RUNTIME_MODE_SSE;
|
|
1082
1090
|
this._intelligence = void 0;
|
|
1083
1091
|
this._a2uiEnabled = false;
|
|
1092
|
+
this._a2uiAgents = void 0;
|
|
1084
1093
|
this._openGenerativeUIEnabled = false;
|
|
1085
1094
|
this.remoteAgents = {};
|
|
1086
1095
|
this._agents = this.localAgents;
|
|
@@ -1119,7 +1128,9 @@ var AgentRegistry = class {
|
|
|
1119
1128
|
this._audioFileTranscriptionEnabled = runtimeInfoResponse.audioFileTranscriptionEnabled ?? false;
|
|
1120
1129
|
this._runtimeMode = runtimeInfoResponse.mode ?? _copilotkit_shared.RUNTIME_MODE_SSE;
|
|
1121
1130
|
this._intelligence = runtimeInfoResponse.intelligence;
|
|
1122
|
-
|
|
1131
|
+
const a2uiInfo = runtimeInfoResponse.a2ui;
|
|
1132
|
+
this._a2uiEnabled = a2uiInfo?.enabled ?? runtimeInfoResponse.a2uiEnabled ?? false;
|
|
1133
|
+
this._a2uiAgents = a2uiInfo?.enabled ? a2uiInfo.agents : void 0;
|
|
1123
1134
|
this._openGenerativeUIEnabled = runtimeInfoResponse.openGenerativeUIEnabled ?? false;
|
|
1124
1135
|
this._licenseStatus = runtimeInfoResponse.licenseStatus;
|
|
1125
1136
|
this._telemetryDisabled = runtimeInfoResponse.telemetryDisabled ?? false;
|
|
@@ -1132,6 +1143,7 @@ var AgentRegistry = class {
|
|
|
1132
1143
|
this._runtimeMode = _copilotkit_shared.RUNTIME_MODE_SSE;
|
|
1133
1144
|
this._intelligence = void 0;
|
|
1134
1145
|
this._a2uiEnabled = false;
|
|
1146
|
+
this._a2uiAgents = void 0;
|
|
1135
1147
|
this._openGenerativeUIEnabled = false;
|
|
1136
1148
|
this.remoteAgents = {};
|
|
1137
1149
|
this._agents = this.localAgents;
|
|
@@ -1245,19 +1257,32 @@ var ContextStore = class {
|
|
|
1245
1257
|
return this._context;
|
|
1246
1258
|
}
|
|
1247
1259
|
/**
|
|
1248
|
-
* Add a new context entry
|
|
1260
|
+
* Add a new context entry. Pass `agentIds` to restrict the entry to runs of
|
|
1261
|
+
* specific agents (#5369); omit it for context every agent should receive.
|
|
1249
1262
|
* @returns The ID of the created context entry
|
|
1250
1263
|
*/
|
|
1251
|
-
addContext({ description, value }) {
|
|
1264
|
+
addContext({ description, value, agentIds }) {
|
|
1252
1265
|
const id = (0, _copilotkit_shared.randomUUID)();
|
|
1253
1266
|
this._context[id] = {
|
|
1254
1267
|
description,
|
|
1255
|
-
value
|
|
1268
|
+
value,
|
|
1269
|
+
...agentIds ? { agentIds } : {}
|
|
1256
1270
|
};
|
|
1257
1271
|
this.notifySubscribers();
|
|
1258
1272
|
return id;
|
|
1259
1273
|
}
|
|
1260
1274
|
/**
|
|
1275
|
+
* Build the context array for a run of the given agent: entries scoped to
|
|
1276
|
+
* other agents are dropped, and the scoping metadata is stripped so only
|
|
1277
|
+
* protocol-shaped `{ description, value }` entries go over the wire.
|
|
1278
|
+
*/
|
|
1279
|
+
getContextForAgent(agentId) {
|
|
1280
|
+
return Object.values(this._context).filter((entry) => !entry.agentIds || agentId !== void 0 && entry.agentIds.includes(agentId)).map(({ description, value }) => ({
|
|
1281
|
+
description,
|
|
1282
|
+
value
|
|
1283
|
+
}));
|
|
1284
|
+
}
|
|
1285
|
+
/**
|
|
1261
1286
|
* Remove a context entry by ID
|
|
1262
1287
|
*/
|
|
1263
1288
|
removeContext(id) {
|
|
@@ -1385,7 +1410,7 @@ var SuggestionEngine = class {
|
|
|
1385
1410
|
].join("\n")
|
|
1386
1411
|
});
|
|
1387
1412
|
await agent.runAgent({
|
|
1388
|
-
context:
|
|
1413
|
+
context: this.core.getContextForAgent(consumerAgentId),
|
|
1389
1414
|
forwardedProps: {
|
|
1390
1415
|
...this.core.properties,
|
|
1391
1416
|
toolChoice: {
|
|
@@ -1695,7 +1720,7 @@ var RunHandler = class {
|
|
|
1695
1720
|
const runAgentResult = await agent.connectAgent({
|
|
1696
1721
|
forwardedProps: this._internal.properties,
|
|
1697
1722
|
tools: this.buildFrontendTools(agent.agentId),
|
|
1698
|
-
context:
|
|
1723
|
+
context: this._internal.getContextForAgent(agent.agentId)
|
|
1699
1724
|
}, this.createAgentErrorSubscriber(agent));
|
|
1700
1725
|
return this.processAgentResult({
|
|
1701
1726
|
runAgentResult,
|
|
@@ -1741,7 +1766,7 @@ var RunHandler = class {
|
|
|
1741
1766
|
...forwardedProps
|
|
1742
1767
|
},
|
|
1743
1768
|
tools: this.buildFrontendTools(agent.agentId),
|
|
1744
|
-
context:
|
|
1769
|
+
context: this._internal.getContextForAgent(agent.agentId)
|
|
1745
1770
|
}, this.createAgentErrorSubscriber(agent));
|
|
1746
1771
|
return await this.processAgentResult({
|
|
1747
1772
|
runAgentResult,
|
|
@@ -2678,6 +2703,13 @@ var CopilotKitCore = class {
|
|
|
2678
2703
|
get a2uiEnabled() {
|
|
2679
2704
|
return this.agentRegistry.a2uiEnabled;
|
|
2680
2705
|
}
|
|
2706
|
+
/**
|
|
2707
|
+
* Agent ids the runtime applies A2UI to. `undefined` means A2UI applies to
|
|
2708
|
+
* every agent (or is disabled — check `a2uiEnabled`).
|
|
2709
|
+
*/
|
|
2710
|
+
get a2uiAgents() {
|
|
2711
|
+
return this.agentRegistry.a2uiAgents;
|
|
2712
|
+
}
|
|
2681
2713
|
get openGenerativeUIEnabled() {
|
|
2682
2714
|
return this.agentRegistry.openGenerativeUIEnabled;
|
|
2683
2715
|
}
|
|
@@ -2747,7 +2779,9 @@ var CopilotKitCore = class {
|
|
|
2747
2779
|
return this.agentRegistry.getAgent(id);
|
|
2748
2780
|
}
|
|
2749
2781
|
/**
|
|
2750
|
-
* Context management (delegated to ContextStore)
|
|
2782
|
+
* Context management (delegated to ContextStore).
|
|
2783
|
+
* Pass `agentIds` to restrict the entry to runs of specific agents;
|
|
2784
|
+
* omit it for context every agent should receive.
|
|
2751
2785
|
*/
|
|
2752
2786
|
addContext(context) {
|
|
2753
2787
|
return this.contextStore.addContext(context);
|
|
@@ -2756,6 +2790,13 @@ var CopilotKitCore = class {
|
|
|
2756
2790
|
this.contextStore.removeContext(id);
|
|
2757
2791
|
}
|
|
2758
2792
|
/**
|
|
2793
|
+
* Build the context array for a run of the given agent, dropping entries
|
|
2794
|
+
* scoped to other agents and stripping the scoping metadata.
|
|
2795
|
+
*/
|
|
2796
|
+
getContextForAgent(agentId) {
|
|
2797
|
+
return this.contextStore.getContextForAgent(agentId);
|
|
2798
|
+
}
|
|
2799
|
+
/**
|
|
2759
2800
|
* Thread store registry (delegated to ThreadStoreRegistry)
|
|
2760
2801
|
*/
|
|
2761
2802
|
registerThreadStore(agentId, store) {
|