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.
Files changed (28) hide show
  1. {copilotkit-0.1.92 → copilotkit-0.1.93}/PKG-INFO +1 -1
  2. {copilotkit-0.1.92 → copilotkit-0.1.93}/copilotkit/copilotkit_lg_middleware.py +28 -1
  3. {copilotkit-0.1.92 → copilotkit-0.1.93}/pyproject.toml +1 -1
  4. {copilotkit-0.1.92 → copilotkit-0.1.93}/README.md +0 -0
  5. {copilotkit-0.1.92 → copilotkit-0.1.93}/copilotkit/__init__.py +0 -0
  6. {copilotkit-0.1.92 → copilotkit-0.1.93}/copilotkit/a2ui.py +0 -0
  7. {copilotkit-0.1.92 → copilotkit-0.1.93}/copilotkit/action.py +0 -0
  8. {copilotkit-0.1.92 → copilotkit-0.1.93}/copilotkit/agent.py +0 -0
  9. {copilotkit-0.1.92 → copilotkit-0.1.93}/copilotkit/crewai/__init__.py +0 -0
  10. {copilotkit-0.1.92 → copilotkit-0.1.93}/copilotkit/crewai/copilotkit_integration.py +0 -0
  11. {copilotkit-0.1.92 → copilotkit-0.1.93}/copilotkit/crewai/crewai_agent.py +0 -0
  12. {copilotkit-0.1.92 → copilotkit-0.1.93}/copilotkit/crewai/crewai_sdk.py +0 -0
  13. {copilotkit-0.1.92 → copilotkit-0.1.93}/copilotkit/exc.py +0 -0
  14. {copilotkit-0.1.92 → copilotkit-0.1.93}/copilotkit/header_propagation.py +0 -0
  15. {copilotkit-0.1.92 → copilotkit-0.1.93}/copilotkit/html.py +0 -0
  16. {copilotkit-0.1.92 → copilotkit-0.1.93}/copilotkit/integrations/__init__.py +0 -0
  17. {copilotkit-0.1.92 → copilotkit-0.1.93}/copilotkit/integrations/fastapi.py +0 -0
  18. {copilotkit-0.1.92 → copilotkit-0.1.93}/copilotkit/langchain.py +0 -0
  19. {copilotkit-0.1.92 → copilotkit-0.1.93}/copilotkit/langgraph.py +0 -0
  20. {copilotkit-0.1.92 → copilotkit-0.1.93}/copilotkit/langgraph_agui_agent.py +0 -0
  21. {copilotkit-0.1.92 → copilotkit-0.1.93}/copilotkit/logging.py +0 -0
  22. {copilotkit-0.1.92 → copilotkit-0.1.93}/copilotkit/parameter.py +0 -0
  23. {copilotkit-0.1.92 → copilotkit-0.1.93}/copilotkit/protocol.py +0 -0
  24. {copilotkit-0.1.92 → copilotkit-0.1.93}/copilotkit/py.typed +0 -0
  25. {copilotkit-0.1.92 → copilotkit-0.1.93}/copilotkit/runloop.py +0 -0
  26. {copilotkit-0.1.92 → copilotkit-0.1.93}/copilotkit/sdk.py +0 -0
  27. {copilotkit-0.1.92 → copilotkit-0.1.93}/copilotkit/types.py +0 -0
  28. {copilotkit-0.1.92 → copilotkit-0.1.93}/copilotkit/utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: copilotkit
3
- Version: 0.1.92
3
+ Version: 0.1.93
4
4
  Summary: CopilotKit python SDK
5
5
  License: MIT
6
6
  Keywords: copilot,copilotkit,langgraph,langchain,ai,langsmith,langserve
@@ -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
- keys: list[str] = [k for k in self._expose_state if k in state]
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
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "copilotkit"
3
- version = "0.1.92"
3
+ version = "0.1.93"
4
4
  description = "CopilotKit python SDK"
5
5
  authors = ["Markus Ecker <markus.ecker@gmail.com>"]
6
6
  license = "MIT"
File without changes