@copilotkit/core 1.55.1 → 1.55.2-canary.test-01
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 +13 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +13 -5
- package/dist/index.mjs.map +1 -1
- package/dist/index.umd.js +20 -13
- package/dist/index.umd.js.map +1 -1
- package/package.json +3 -3
package/dist/index.umd.js
CHANGED
|
@@ -354,7 +354,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
354
354
|
return { joinToken: payload.joinToken };
|
|
355
355
|
} catch (error) {
|
|
356
356
|
if (error instanceof AgentThreadLockedError) throw error;
|
|
357
|
-
throw new Error(`REST ${mode} request failed: ${error instanceof Error ? error.message : String(error)}
|
|
357
|
+
throw new Error(`REST ${mode} request failed: ${error instanceof Error ? error.message : String(error)}`, { cause: error });
|
|
358
358
|
}
|
|
359
359
|
});
|
|
360
360
|
}
|
|
@@ -386,7 +386,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
386
386
|
}
|
|
387
387
|
return this.normalizeConnectPlan(await response.json());
|
|
388
388
|
} catch (error) {
|
|
389
|
-
throw new Error(`REST connect request failed: ${error instanceof Error ? error.message : String(error)}
|
|
389
|
+
throw new Error(`REST connect request failed: ${error instanceof Error ? error.message : String(error)}`, { cause: error });
|
|
390
390
|
}
|
|
391
391
|
});
|
|
392
392
|
}
|
|
@@ -410,14 +410,13 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
410
410
|
}
|
|
411
411
|
observeThread$(input, credentials, options) {
|
|
412
412
|
return (0, rxjs.defer)(() => {
|
|
413
|
-
var _this$config$socketPa;
|
|
414
413
|
let ownSocket = null;
|
|
415
414
|
let ownChannel = null;
|
|
416
415
|
const socket$ = ɵphoenixSocket$({
|
|
417
416
|
url: this.config.url,
|
|
418
417
|
options: {
|
|
419
418
|
params: {
|
|
420
|
-
...
|
|
419
|
+
...this.config.socketParams,
|
|
421
420
|
join_token: credentials.joinToken
|
|
422
421
|
},
|
|
423
422
|
reconnectAfterMs: (0, _copilotkit_shared.phoenixExponentialBackoff)(100, 1e4),
|
|
@@ -709,6 +708,9 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
709
708
|
},
|
|
710
709
|
onRunFailed: () => {
|
|
711
710
|
this.isRunning = false;
|
|
711
|
+
},
|
|
712
|
+
onRunErrorEvent: () => {
|
|
713
|
+
this.isRunning = false;
|
|
712
714
|
}
|
|
713
715
|
});
|
|
714
716
|
const forwardedSubs = this.subscribers.map((s) => delegate.subscribe(s));
|
|
@@ -1351,7 +1353,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
1351
1353
|
async generateSuggestions(suggestionId, config, consumerAgentId, consumerAgent) {
|
|
1352
1354
|
let agent = void 0;
|
|
1353
1355
|
try {
|
|
1354
|
-
var _config$providerAgent, _this$
|
|
1356
|
+
var _config$providerAgent, _this$_runningSuggest3, _config$minSuggestion, _config$maxSuggestion;
|
|
1355
1357
|
const suggestionsProviderAgent = this.core.getAgent((_config$providerAgent = config.providerAgentId) !== null && _config$providerAgent !== void 0 ? _config$providerAgent : "default");
|
|
1356
1358
|
if (!suggestionsProviderAgent) throw new Error(`Suggestions provider agent not found: ${config.providerAgentId}`);
|
|
1357
1359
|
const suggestionsConsumerAgent = consumerAgent !== null && consumerAgent !== void 0 ? consumerAgent : this.core.getAgent(consumerAgentId);
|
|
@@ -1361,7 +1363,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
1361
1363
|
agent.messages = JSON.parse(JSON.stringify(suggestionsConsumerAgent.messages));
|
|
1362
1364
|
agent.state = JSON.parse(JSON.stringify(suggestionsConsumerAgent.state));
|
|
1363
1365
|
this._suggestions[consumerAgentId] = {
|
|
1364
|
-
...
|
|
1366
|
+
...this._suggestions[consumerAgentId],
|
|
1365
1367
|
[suggestionId]: []
|
|
1366
1368
|
};
|
|
1367
1369
|
this._runningSuggestions[consumerAgentId] = [...(_this$_runningSuggest3 = this._runningSuggestions[consumerAgentId]) !== null && _this$_runningSuggest3 !== void 0 ? _this$_runningSuggest3 : [], agent];
|
|
@@ -1410,14 +1412,14 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
1410
1412
|
const agentSuggestions = this._suggestions[consumerAgentId];
|
|
1411
1413
|
const currentSuggestions = agentSuggestions === null || agentSuggestions === void 0 ? void 0 : agentSuggestions[suggestionId];
|
|
1412
1414
|
if (agentSuggestions && currentSuggestions && currentSuggestions.length > 0) {
|
|
1413
|
-
var _this$_suggestions$
|
|
1415
|
+
var _this$_suggestions$co;
|
|
1414
1416
|
const finalizedSuggestions = currentSuggestions.filter((suggestion) => suggestion.title !== "" || suggestion.message !== "").map((suggestion) => ({
|
|
1415
1417
|
...suggestion,
|
|
1416
1418
|
isLoading: false
|
|
1417
1419
|
}));
|
|
1418
1420
|
if (finalizedSuggestions.length > 0) agentSuggestions[suggestionId] = finalizedSuggestions;
|
|
1419
1421
|
else delete agentSuggestions[suggestionId];
|
|
1420
|
-
const allSuggestions = Object.values((_this$_suggestions$
|
|
1422
|
+
const allSuggestions = Object.values((_this$_suggestions$co = this._suggestions[consumerAgentId]) !== null && _this$_suggestions$co !== void 0 ? _this$_suggestions$co : {}).flat();
|
|
1421
1423
|
this.notifySuggestionsChanged(consumerAgentId, allSuggestions, "finalized");
|
|
1422
1424
|
}
|
|
1423
1425
|
}
|
|
@@ -1450,9 +1452,9 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
1450
1452
|
if (isRunning && suggestions.length > 0) suggestions[suggestions.length - 1].isLoading = true;
|
|
1451
1453
|
const agentSuggestions = this._suggestions[consumerAgentId];
|
|
1452
1454
|
if (agentSuggestions) {
|
|
1453
|
-
var _this$_suggestions$
|
|
1455
|
+
var _this$_suggestions$co2;
|
|
1454
1456
|
agentSuggestions[suggestionId] = suggestions;
|
|
1455
|
-
const allSuggestions = Object.values((_this$_suggestions$
|
|
1457
|
+
const allSuggestions = Object.values((_this$_suggestions$co2 = this._suggestions[consumerAgentId]) !== null && _this$_suggestions$co2 !== void 0 ? _this$_suggestions$co2 : {}).flat();
|
|
1456
1458
|
this.notifySuggestionsChanged(consumerAgentId, allSuggestions, "suggestions changed");
|
|
1457
1459
|
}
|
|
1458
1460
|
}
|
|
@@ -1524,16 +1526,16 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
1524
1526
|
* Add static suggestions directly without AI generation
|
|
1525
1527
|
*/
|
|
1526
1528
|
addStaticSuggestions(suggestionId, config, consumerAgentId) {
|
|
1527
|
-
var _this$_suggestions$
|
|
1529
|
+
var _this$_suggestions$co3;
|
|
1528
1530
|
const suggestions = config.suggestions.map((s) => ({
|
|
1529
1531
|
...s,
|
|
1530
1532
|
isLoading: false
|
|
1531
1533
|
}));
|
|
1532
1534
|
this._suggestions[consumerAgentId] = {
|
|
1533
|
-
...
|
|
1535
|
+
...this._suggestions[consumerAgentId],
|
|
1534
1536
|
[suggestionId]: suggestions
|
|
1535
1537
|
};
|
|
1536
|
-
const allSuggestions = Object.values((_this$_suggestions$
|
|
1538
|
+
const allSuggestions = Object.values((_this$_suggestions$co3 = this._suggestions[consumerAgentId]) !== null && _this$_suggestions$co3 !== void 0 ? _this$_suggestions$co3 : {}).flat();
|
|
1537
1539
|
this.notifySuggestionsChanged(consumerAgentId, allSuggestions, "static suggestions added");
|
|
1538
1540
|
}
|
|
1539
1541
|
};
|
|
@@ -2237,6 +2239,11 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
2237
2239
|
runFinished = true;
|
|
2238
2240
|
this.handleRunFinished(agent, effectiveInput(input), state);
|
|
2239
2241
|
},
|
|
2242
|
+
onRunErrorEvent: ({ input, state }) => {
|
|
2243
|
+
if (revoked) return;
|
|
2244
|
+
runFinished = true;
|
|
2245
|
+
this.handleRunFinished(agent, effectiveInput(input), state);
|
|
2246
|
+
},
|
|
2240
2247
|
onStateSnapshotEvent: ({ event, input, state }) => {
|
|
2241
2248
|
if (revoked) return;
|
|
2242
2249
|
this.handleStateSnapshot(agent, event, effectiveInput(input), state);
|