@copilotkit/core 1.55.1 → 1.55.2-next.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 CHANGED
@@ -313,7 +313,7 @@ var IntelligenceAgent = class IntelligenceAgent extends _ag_ui_client.AbstractAg
313
313
  return { joinToken: payload.joinToken };
314
314
  } catch (error) {
315
315
  if (error instanceof AgentThreadLockedError) throw error;
316
- throw new Error(`REST ${mode} request failed: ${error instanceof Error ? error.message : String(error)}`);
316
+ throw new Error(`REST ${mode} request failed: ${error instanceof Error ? error.message : String(error)}`, { cause: error });
317
317
  }
318
318
  });
319
319
  }
@@ -345,7 +345,7 @@ var IntelligenceAgent = class IntelligenceAgent extends _ag_ui_client.AbstractAg
345
345
  }
346
346
  return this.normalizeConnectPlan(await response.json());
347
347
  } catch (error) {
348
- throw new Error(`REST connect request failed: ${error instanceof Error ? error.message : String(error)}`);
348
+ throw new Error(`REST connect request failed: ${error instanceof Error ? error.message : String(error)}`, { cause: error });
349
349
  }
350
350
  });
351
351
  }
@@ -375,7 +375,7 @@ var IntelligenceAgent = class IntelligenceAgent extends _ag_ui_client.AbstractAg
375
375
  url: this.config.url,
376
376
  options: {
377
377
  params: {
378
- ...this.config.socketParams ?? {},
378
+ ...this.config.socketParams,
379
379
  join_token: credentials.joinToken
380
380
  },
381
381
  reconnectAfterMs: (0, _copilotkit_shared.phoenixExponentialBackoff)(100, 1e4),
@@ -605,6 +605,9 @@ var ProxiedCopilotRuntimeAgent = class ProxiedCopilotRuntimeAgent extends _ag_ui
605
605
  },
606
606
  onRunFailed: () => {
607
607
  this.isRunning = false;
608
+ },
609
+ onRunErrorEvent: () => {
610
+ this.isRunning = false;
608
611
  }
609
612
  });
610
613
  const forwardedSubs = this.subscribers.map((s) => delegate.subscribe(s));
@@ -1238,7 +1241,7 @@ var SuggestionEngine = class {
1238
1241
  agent.messages = JSON.parse(JSON.stringify(suggestionsConsumerAgent.messages));
1239
1242
  agent.state = JSON.parse(JSON.stringify(suggestionsConsumerAgent.state));
1240
1243
  this._suggestions[consumerAgentId] = {
1241
- ...this._suggestions[consumerAgentId] ?? {},
1244
+ ...this._suggestions[consumerAgentId],
1242
1245
  [suggestionId]: []
1243
1246
  };
1244
1247
  this._runningSuggestions[consumerAgentId] = [...this._runningSuggestions[consumerAgentId] ?? [], agent];
@@ -1389,7 +1392,7 @@ var SuggestionEngine = class {
1389
1392
  isLoading: false
1390
1393
  }));
1391
1394
  this._suggestions[consumerAgentId] = {
1392
- ...this._suggestions[consumerAgentId] ?? {},
1395
+ ...this._suggestions[consumerAgentId],
1393
1396
  [suggestionId]: suggestions
1394
1397
  };
1395
1398
  const allSuggestions = Object.values(this._suggestions[consumerAgentId] ?? {}).flat();
@@ -2085,6 +2088,11 @@ var StateManager = class {
2085
2088
  runFinished = true;
2086
2089
  this.handleRunFinished(agent, effectiveInput(input), state);
2087
2090
  },
2091
+ onRunErrorEvent: ({ input, state }) => {
2092
+ if (revoked) return;
2093
+ runFinished = true;
2094
+ this.handleRunFinished(agent, effectiveInput(input), state);
2095
+ },
2088
2096
  onStateSnapshotEvent: ({ event, input, state }) => {
2089
2097
  if (revoked) return;
2090
2098
  this.handleStateSnapshot(agent, event, effectiveInput(input), state);