copilotkit 0.1.75a7__py3-none-any.whl → 0.1.75a8__py3-none-any.whl

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.
@@ -25,30 +25,19 @@ from langchain.agents.middleware import (
25
25
  )
26
26
  from langgraph.runtime import Runtime
27
27
 
28
- from .langgraph import CopilotContextItem
29
-
30
- class CopilotKitState:
31
- """Extended state schema for CopilotKit middleware."""
32
-
33
- # CopilotKit frontend tools passed via state
34
- actions: List[Any]
35
- context: List[CopilotContextItem]
36
-
37
- # Private state for CopilotKit middleware
38
- intercepted_tool_calls: Any
39
- original_ai_message_id: Any
28
+ from .langgraph import CopilotKitProperties
40
29
 
41
30
  class StateSchema(AgentState):
42
- copilotkit: CopilotKitState
31
+ copilotkit: CopilotKitProperties
43
32
 
44
33
 
45
- class CopilotKitMiddleware(AgentMiddleware[CopilotKitState, Any]):
34
+ class CopilotKitMiddleware(AgentMiddleware[StateSchema, Any]):
46
35
  """CopilotKit Middleware for LangGraph agents.
47
36
 
48
37
  Handles frontend tool injection and interception for CopilotKit.
49
38
  """
50
39
 
51
- state_schema = CopilotKitState
40
+ state_schema = StateSchema
52
41
  tools: ClassVar[list] = []
53
42
 
54
43
  @property
@@ -89,10 +78,10 @@ class CopilotKitMiddleware(AgentMiddleware[CopilotKitState, Any]):
89
78
  # Intercept frontend tool calls after model returns, before ToolNode executes
90
79
  def after_model(
91
80
  self,
92
- state: CopilotKitState,
81
+ state: StateSchema,
93
82
  runtime: Runtime[Any],
94
83
  ) -> dict[str, Any] | None:
95
- frontend_tools = state.get("copilotkit", {}).get("tools", [])
84
+ frontend_tools = state.get("copilotkit", {}).get("actions", [])
96
85
  if not frontend_tools:
97
86
  return None
98
87
 
@@ -143,7 +132,7 @@ class CopilotKitMiddleware(AgentMiddleware[CopilotKitState, Any]):
143
132
 
144
133
  async def aafter_model(
145
134
  self,
146
- state: CopilotKitState,
135
+ state: StateSchema,
147
136
  runtime: Runtime[Any],
148
137
  ) -> dict[str, Any] | None:
149
138
  # Delegate to sync implementation
@@ -152,7 +141,7 @@ class CopilotKitMiddleware(AgentMiddleware[CopilotKitState, Any]):
152
141
  # Restore frontend tool calls to AIMessage before agent exits
153
142
  def after_agent(
154
143
  self,
155
- state: CopilotKitState,
144
+ state: StateSchema,
156
145
  runtime: Runtime[Any],
157
146
  ) -> dict[str, Any] | None:
158
147
  copilotkit_state = state.get("copilotkit", {})
@@ -186,7 +175,7 @@ class CopilotKitMiddleware(AgentMiddleware[CopilotKitState, Any]):
186
175
 
187
176
  async def aafter_agent(
188
177
  self,
189
- state: CopilotKitState,
178
+ state: StateSchema,
190
179
  runtime: Runtime[Any],
191
180
  ) -> dict[str, Any] | None:
192
181
  # Delegate to sync implementation
copilotkit/langgraph.py CHANGED
@@ -37,6 +37,10 @@ class CopilotKitProperties(TypedDict):
37
37
  actions: List[Any]
38
38
  context: List[CopilotContextItem]
39
39
 
40
+ # Private state for CopilotKit middleware
41
+ intercepted_tool_calls: Any
42
+ original_ai_message_id: Any
43
+
40
44
  class CopilotKitState(MessagesState):
41
45
  """CopilotKit state"""
42
46
  copilotkit: CopilotKitProperties
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: copilotkit
3
- Version: 0.1.75a7
3
+ Version: 0.1.75a8
4
4
  Summary: CopilotKit python SDK
5
5
  License: MIT
6
6
  Keywords: copilot,copilotkit,langgraph,langchain,ai,langsmith,langserve
@@ -1,7 +1,7 @@
1
1
  copilotkit/__init__.py,sha256=22bUXudklMop9r1DYkecCaTiHbj_m0Wf4txOU-yfSI4,859
2
2
  copilotkit/action.py,sha256=bg_bPusEfN8TMQV1B3lVyMLbHyLn1E7yVYAvfE2_PXA,1691
3
3
  copilotkit/agent.py,sha256=e-jPsUQo18FOYUPdE3YNmSLcb5FEfWL6ARScOntyvb8,1663
4
- copilotkit/copilotkit_lg_middleware.py,sha256=QyOGRFhJK6I8Qxm8qRzRRQ4TppiV2l9qVtVjgUaDGwQ,5837
4
+ copilotkit/copilotkit_lg_middleware.py,sha256=7MIiMfdKp9TuwmL0k7dIvTYYob6InxQbOUqICowYRDs,5517
5
5
  copilotkit/crewai/__init__.py,sha256=RAkBTwDpFuvD5prULUnoWdl5d8W373cm1ZlqOMeSGbY,1034
6
6
  copilotkit/crewai/copilotkit_integration.py,sha256=vd1LVhXo-cpA4PQ_-cZHdKgm67MvrHpx4VJweUvCzPE,14550
7
7
  copilotkit/crewai/crewai_agent.py,sha256=maoMnl0WIHUnFAK5ALUKD9z0GvjtfNGi31zi37LyyaE,15323
@@ -11,7 +11,7 @@ copilotkit/html.py,sha256=IHnY4cx89LuYuPPf8Tady2DXfr3MyRWilMHpZ7d8bFk,4357
11
11
  copilotkit/integrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
12
12
  copilotkit/integrations/fastapi.py,sha256=3DAAFbpFqL0cJ22sE6JDz3HbTjYerDqn4ZJhYhCvwZs,10487
13
13
  copilotkit/langchain.py,sha256=QFIHnhhAzCKO16F6aFYh_gsCEfm-eaCUPZm-yMTczxU,752
14
- copilotkit/langgraph.py,sha256=Y8VSZ-0vCijppf_0PrHtyT24wC6L16gETbsKwVX4F6g,14992
14
+ copilotkit/langgraph.py,sha256=wfAqp1P2KfMQw5X1AL2BJtXrQBgT02U3KoJh54--uXA,15103
15
15
  copilotkit/langgraph_agent.py,sha256=WPg45s3ITOU2exgE_sW1u-rgnYY4WherAzTVLscBkBk,29668
16
16
  copilotkit/langgraph_agui_agent.py,sha256=t6Vpdiod6-iIGRI303-ipN6FfakpB5So2gaYKYZ6zlY,7798
17
17
  copilotkit/logging.py,sha256=lpPEZbI6LMaQLzSgiQMYV4qHrNk-MuO2qZ3zcaHl1nA,499
@@ -21,6 +21,6 @@ copilotkit/runloop.py,sha256=9pBqWeu4QCRPOizz00se1d0_BvCX3ZIABzNeiXhdyNM,10641
21
21
  copilotkit/sdk.py,sha256=VEQqA9QAXJS5MDLxtJJdtfrApX9EawCHzp-IXnat5vw,11882
22
22
  copilotkit/types.py,sha256=_YQluiHpJGGXYB4eWLk0EocDZp5C8rs3ZsMNFhmXEYU,972
23
23
  copilotkit/utils.py,sha256=rOAaaFBXgb3iv_cLH9S2steyGwHmnTjaxQTA53qdtQo,203
24
- copilotkit-0.1.75a7.dist-info/METADATA,sha256=KkmmXPRzE_Ojmfqg0DTs6PuQiJ0v3kDL-RPZfCQBVoo,2606
25
- copilotkit-0.1.75a7.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
26
- copilotkit-0.1.75a7.dist-info/RECORD,,
24
+ copilotkit-0.1.75a8.dist-info/METADATA,sha256=3NGADg3OXLOLV_IcWmRzTaVrlNqI8wbq1UTqg3bEKq0,2606
25
+ copilotkit-0.1.75a8.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
26
+ copilotkit-0.1.75a8.dist-info/RECORD,,