@copilotkit/core 1.67.1 → 1.68.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
@@ -197,6 +197,45 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
197
197
  this.config = config;
198
198
  this.sharedState = sharedState;
199
199
  }
200
+ /**
201
+ * Headers sent with the REST join requests (`/connect`, `/run`).
202
+ *
203
+ * Deliberately a public accessor pair rather than a plain read of `config`.
204
+ * `ProxiedCopilotRuntimeAgent` builds its delegate once and caches it for the
205
+ * proxy's lifetime, so a header that changes later (a tenant switch, a
206
+ * rotated bearer) would otherwise never reach the gateway. The accessor is
207
+ * what closes that gap: `syncDelegate` refreshes the delegate before every
208
+ * join, and its `hasHeaders` probe is an `"headers" in agent` check — which a
209
+ * prototype accessor satisfies but a `private config` does not.
210
+ *
211
+ * The setter replaces the config object instead of mutating it because
212
+ * `clone()` hands the same config reference to the copy. An in-place write
213
+ * would therefore have a per-thread clone's headers land on the original's
214
+ * config too. The join path itself would survive that (`syncDelegate`
215
+ * rewrites the headers just before every join), but the re-acquisition inside
216
+ * an already-running pipeline does not go through `syncDelegate` — so a
217
+ * clone's tenant could ride out on the original's socket-error refresh. That
218
+ * is the same cross-tenant leak this accessor exists to prevent.
219
+ */
220
+ get headers() {
221
+ return this.config.headers;
222
+ }
223
+ set headers(headers) {
224
+ this.config = {
225
+ ...this.config,
226
+ headers
227
+ };
228
+ }
229
+ /** Credentials mode for the REST join requests. Live for the same reason as {@link headers}. */
230
+ get credentials() {
231
+ return this.config.credentials;
232
+ }
233
+ set credentials(credentials) {
234
+ this.config = {
235
+ ...this.config,
236
+ credentials
237
+ };
238
+ }
200
239
  clone() {
201
240
  return new IntelligenceAgent(this.config, this.sharedState);
202
241
  }
@@ -358,7 +397,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
358
397
  method: "POST",
359
398
  headers: {
360
399
  "Content-Type": "application/json",
361
- ...this.config.headers
400
+ ...this.headers
362
401
  },
363
402
  body: JSON.stringify({
364
403
  threadId: input.threadId,
@@ -370,7 +409,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
370
409
  forwardedProps: input.forwardedProps,
371
410
  ...mode === "connect" ? { lastSeenEventId: replayCursor === void 0 ? this.getReconnectCursor(input) : replayCursor } : {}
372
411
  }),
373
- ...this.config.credentials ? { credentials: this.config.credentials } : {}
412
+ ...this.credentials ? { credentials: this.credentials } : {}
374
413
  });
375
414
  if (response.status === 204 && mode === "connect") return null;
376
415
  if (response.status === 409 && mode === "run") throw new AgentThreadLockedError(input.threadId);
@@ -6042,7 +6081,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
6042
6081
  const mutableInterrupts = [...interrupts];
6043
6082
  const resume = (0, _ag_ui_client.buildResumeArray)(mutableInterrupts, _classPrivateFieldGet2(_responses, this));
6044
6083
  const toolResults = mutableInterrupts.flatMap((interrupt) => {
6045
- if (!interrupt.toolCallId) return [];
6084
+ if (!interrupt.toolCallId || interrupt.reason !== "tool_call") return [];
6046
6085
  return [{
6047
6086
  toolCallId: interrupt.toolCallId,
6048
6087
  content: toolResultContent(_classPrivateFieldGet2(_responses, this)[interrupt.id])