@copilotkitnext/runtime 0.0.11 → 0.0.12
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.js +19 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +19 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -42,7 +42,7 @@ module.exports = __toCommonJS(index_exports);
|
|
|
42
42
|
// package.json
|
|
43
43
|
var package_default = {
|
|
44
44
|
name: "@copilotkitnext/runtime",
|
|
45
|
-
version: "0.0.
|
|
45
|
+
version: "0.0.12",
|
|
46
46
|
description: "Server-side runtime package for CopilotKit2",
|
|
47
47
|
main: "dist/index.js",
|
|
48
48
|
types: "dist/index.d.ts",
|
|
@@ -529,7 +529,24 @@ async function handleRunAgent({
|
|
|
529
529
|
}
|
|
530
530
|
);
|
|
531
531
|
}
|
|
532
|
-
const
|
|
532
|
+
const registeredAgent = agents[agentId];
|
|
533
|
+
const agent = registeredAgent.clone();
|
|
534
|
+
if (agent && "headers" in agent) {
|
|
535
|
+
const shouldForward = (headerName) => {
|
|
536
|
+
const lower = headerName.toLowerCase();
|
|
537
|
+
return lower === "authorization" || lower.startsWith("x-");
|
|
538
|
+
};
|
|
539
|
+
const forwardableHeaders = {};
|
|
540
|
+
request.headers.forEach((value, key) => {
|
|
541
|
+
if (shouldForward(key)) {
|
|
542
|
+
forwardableHeaders[key] = value;
|
|
543
|
+
}
|
|
544
|
+
});
|
|
545
|
+
agent.headers = {
|
|
546
|
+
...agent.headers,
|
|
547
|
+
...forwardableHeaders
|
|
548
|
+
};
|
|
549
|
+
}
|
|
533
550
|
const stream = new TransformStream();
|
|
534
551
|
const writer = stream.writable.getWriter();
|
|
535
552
|
const encoder = new import_encoder.EventEncoder();
|