copilotkit 0.1.92__tar.gz → 0.1.93__tar.gz
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.
- {copilotkit-0.1.92 → copilotkit-0.1.93}/PKG-INFO +1 -1
- {copilotkit-0.1.92 → copilotkit-0.1.93}/copilotkit/copilotkit_lg_middleware.py +28 -1
- {copilotkit-0.1.92 → copilotkit-0.1.93}/pyproject.toml +1 -1
- {copilotkit-0.1.92 → copilotkit-0.1.93}/README.md +0 -0
- {copilotkit-0.1.92 → copilotkit-0.1.93}/copilotkit/__init__.py +0 -0
- {copilotkit-0.1.92 → copilotkit-0.1.93}/copilotkit/a2ui.py +0 -0
- {copilotkit-0.1.92 → copilotkit-0.1.93}/copilotkit/action.py +0 -0
- {copilotkit-0.1.92 → copilotkit-0.1.93}/copilotkit/agent.py +0 -0
- {copilotkit-0.1.92 → copilotkit-0.1.93}/copilotkit/crewai/__init__.py +0 -0
- {copilotkit-0.1.92 → copilotkit-0.1.93}/copilotkit/crewai/copilotkit_integration.py +0 -0
- {copilotkit-0.1.92 → copilotkit-0.1.93}/copilotkit/crewai/crewai_agent.py +0 -0
- {copilotkit-0.1.92 → copilotkit-0.1.93}/copilotkit/crewai/crewai_sdk.py +0 -0
- {copilotkit-0.1.92 → copilotkit-0.1.93}/copilotkit/exc.py +0 -0
- {copilotkit-0.1.92 → copilotkit-0.1.93}/copilotkit/header_propagation.py +0 -0
- {copilotkit-0.1.92 → copilotkit-0.1.93}/copilotkit/html.py +0 -0
- {copilotkit-0.1.92 → copilotkit-0.1.93}/copilotkit/integrations/__init__.py +0 -0
- {copilotkit-0.1.92 → copilotkit-0.1.93}/copilotkit/integrations/fastapi.py +0 -0
- {copilotkit-0.1.92 → copilotkit-0.1.93}/copilotkit/langchain.py +0 -0
- {copilotkit-0.1.92 → copilotkit-0.1.93}/copilotkit/langgraph.py +0 -0
- {copilotkit-0.1.92 → copilotkit-0.1.93}/copilotkit/langgraph_agui_agent.py +0 -0
- {copilotkit-0.1.92 → copilotkit-0.1.93}/copilotkit/logging.py +0 -0
- {copilotkit-0.1.92 → copilotkit-0.1.93}/copilotkit/parameter.py +0 -0
- {copilotkit-0.1.92 → copilotkit-0.1.93}/copilotkit/protocol.py +0 -0
- {copilotkit-0.1.92 → copilotkit-0.1.93}/copilotkit/py.typed +0 -0
- {copilotkit-0.1.92 → copilotkit-0.1.93}/copilotkit/runloop.py +0 -0
- {copilotkit-0.1.92 → copilotkit-0.1.93}/copilotkit/sdk.py +0 -0
- {copilotkit-0.1.92 → copilotkit-0.1.93}/copilotkit/types.py +0 -0
- {copilotkit-0.1.92 → copilotkit-0.1.93}/copilotkit/utils.py +0 -0
|
@@ -154,6 +154,10 @@ _RESERVED_STATE_KEYS = frozenset(
|
|
|
154
154
|
{
|
|
155
155
|
"messages",
|
|
156
156
|
"copilotkit",
|
|
157
|
+
# Transport-layer plumbing: forwarded request headers conveyed via a
|
|
158
|
+
# separate ContextVar to the httpx hook. MUST never be rendered into
|
|
159
|
+
# the LLM prompt — neither via App Context nor via expose_state.
|
|
160
|
+
"copilotkit_forwarded_headers",
|
|
157
161
|
"ag-ui",
|
|
158
162
|
"tools",
|
|
159
163
|
"structured_response",
|
|
@@ -218,7 +222,17 @@ class CopilotKitMiddleware(AgentMiddleware[StateSchema, Any]):
|
|
|
218
222
|
if self._expose_state is False:
|
|
219
223
|
return None
|
|
220
224
|
if isinstance(self._expose_state, frozenset):
|
|
221
|
-
|
|
225
|
+
# Allowlist branch: honor user intent for other reserved keys
|
|
226
|
+
# (e.g. ``thread_id``) so the override test in this suite still
|
|
227
|
+
# passes, but hard-exclude ``copilotkit_forwarded_headers`` —
|
|
228
|
+
# rendering it would leak the raw forwarded request headers into
|
|
229
|
+
# the LLM prompt, which is what the reserved-keys comment above
|
|
230
|
+
# promises will never happen "via App Context nor via expose_state".
|
|
231
|
+
keys: list[str] = [
|
|
232
|
+
k
|
|
233
|
+
for k in self._expose_state
|
|
234
|
+
if k in state and k != "copilotkit_forwarded_headers"
|
|
235
|
+
]
|
|
222
236
|
else:
|
|
223
237
|
keys = [
|
|
224
238
|
k
|
|
@@ -487,6 +501,19 @@ class CopilotKitMiddleware(AgentMiddleware[StateSchema, Any]):
|
|
|
487
501
|
runtime, "context", None
|
|
488
502
|
)
|
|
489
503
|
|
|
504
|
+
# Strip the reserved transport-layer key ``copilotkit_forwarded_headers``
|
|
505
|
+
# so it is never rendered into the LLM prompt. langgraph-api auto-copies
|
|
506
|
+
# ``config.configurable`` into ``runtime.context``, which means the
|
|
507
|
+
# forwarded-headers wrapper dict shows up here even though it is only
|
|
508
|
+
# meant for the httpx hook (which reads it from a separate ContextVar
|
|
509
|
+
# via ``_extract_forwarded_headers_from_config``).
|
|
510
|
+
if isinstance(app_context, dict):
|
|
511
|
+
app_context = {
|
|
512
|
+
k: v
|
|
513
|
+
for k, v in app_context.items()
|
|
514
|
+
if k != "copilotkit_forwarded_headers"
|
|
515
|
+
}
|
|
516
|
+
|
|
490
517
|
# Check if app_context is missing or empty
|
|
491
518
|
if not app_context:
|
|
492
519
|
return None
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|