langchain-trigger-server 0.2.0__tar.gz → 0.2.1__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 (17) hide show
  1. {langchain_trigger_server-0.2.0 → langchain_trigger_server-0.2.1}/PKG-INFO +1 -1
  2. {langchain_trigger_server-0.2.0 → langchain_trigger_server-0.2.1}/langchain_triggers/app.py +3 -6
  3. {langchain_trigger_server-0.2.0 → langchain_trigger_server-0.2.1}/langchain_triggers/database/interface.py +5 -0
  4. {langchain_trigger_server-0.2.0 → langchain_trigger_server-0.2.1}/langchain_triggers/database/supabase.py +25 -0
  5. {langchain_trigger_server-0.2.0 → langchain_trigger_server-0.2.1}/pyproject.toml +1 -1
  6. {langchain_trigger_server-0.2.0 → langchain_trigger_server-0.2.1}/.github/workflows/release.yml +0 -0
  7. {langchain_trigger_server-0.2.0 → langchain_trigger_server-0.2.1}/.vscode/settings.json +0 -0
  8. {langchain_trigger_server-0.2.0 → langchain_trigger_server-0.2.1}/README.md +0 -0
  9. {langchain_trigger_server-0.2.0 → langchain_trigger_server-0.2.1}/langchain_triggers/__init__.py +0 -0
  10. {langchain_trigger_server-0.2.0 → langchain_trigger_server-0.2.1}/langchain_triggers/core.py +0 -0
  11. {langchain_trigger_server-0.2.0 → langchain_trigger_server-0.2.1}/langchain_triggers/cron_manager.py +0 -0
  12. {langchain_trigger_server-0.2.0 → langchain_trigger_server-0.2.1}/langchain_triggers/database/__init__.py +0 -0
  13. {langchain_trigger_server-0.2.0 → langchain_trigger_server-0.2.1}/langchain_triggers/decorators.py +0 -0
  14. {langchain_trigger_server-0.2.0 → langchain_trigger_server-0.2.1}/langchain_triggers/triggers/__init__.py +0 -0
  15. {langchain_trigger_server-0.2.0 → langchain_trigger_server-0.2.1}/langchain_triggers/triggers/cron_trigger.py +0 -0
  16. {langchain_trigger_server-0.2.0 → langchain_trigger_server-0.2.1}/test_framework.py +0 -0
  17. {langchain_trigger_server-0.2.0 → langchain_trigger_server-0.2.1}/uv.lock +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: langchain-trigger-server
3
- Version: 0.2.0
3
+ Version: 0.2.1
4
4
  Summary: Generic event-driven triggers framework
5
5
  Project-URL: Homepage, https://github.com/langchain-ai/open-agent-platform
6
6
  Project-URL: Repository, https://github.com/langchain-ai/open-agent-platform
@@ -231,21 +231,18 @@ class TriggerServer:
231
231
  try:
232
232
  user_id = current_user["identity"]
233
233
 
234
- # Get user's trigger registrations using new schema
235
- user_registrations = await self.database.get_user_trigger_registrations(user_id)
234
+ # Get user's trigger registrations with linked agents in a single query
235
+ user_registrations = await self.database.get_user_trigger_registrations_with_agents(user_id)
236
236
 
237
237
  # Format response to match expected structure
238
238
  registrations = []
239
239
  for reg in user_registrations:
240
- # Get linked agent IDs
241
- linked_agent_ids = await self.database.get_agents_for_trigger(reg["id"])
242
-
243
240
  registrations.append({
244
241
  "id": reg["id"],
245
242
  "user_id": reg["user_id"],
246
243
  "template_id": reg.get("trigger_templates", {}).get("id"),
247
244
  "resource": reg["resource"],
248
- "linked_assistant_ids": linked_agent_ids, # For backward compatibility
245
+ "linked_agent_ids": reg.get("linked_agent_ids", []),
249
246
  "created_at": reg["created_at"]
250
247
  })
251
248
 
@@ -50,6 +50,11 @@ class TriggerDatabaseInterface(ABC):
50
50
  """Get all trigger registrations for a user."""
51
51
  pass
52
52
 
53
+ @abstractmethod
54
+ async def get_user_trigger_registrations_with_agents(self, user_id: str) -> List[Dict[str, Any]]:
55
+ """Get all trigger registrations for a user with linked agents in a single query."""
56
+ pass
57
+
53
58
  @abstractmethod
54
59
  async def get_trigger_registration(
55
60
  self,
@@ -162,6 +162,31 @@ class SupabaseTriggerDatabase(TriggerDatabaseInterface):
162
162
  except Exception as e:
163
163
  logger.error(f"Error getting user trigger registrations: {e}")
164
164
  return []
165
+
166
+ async def get_user_trigger_registrations_with_agents(self, user_id: str) -> List[Dict[str, Any]]:
167
+ """Get all trigger registrations for a user with linked agents in a single query."""
168
+ try:
169
+ response = self.client.table("trigger_registrations").select("""
170
+ *,
171
+ trigger_templates(id, name, description),
172
+ agent_trigger_links(agent_id)
173
+ """).eq("user_id", user_id).order("created_at", desc=True).execute()
174
+
175
+ # Process the results to extract linked agent IDs
176
+ if response.data:
177
+ for registration in response.data:
178
+ # Extract agent IDs from the agent_trigger_links
179
+ agent_links = registration.get("agent_trigger_links", [])
180
+ linked_agent_ids = [link.get("agent_id") for link in agent_links if link.get("agent_id")]
181
+ registration["linked_agent_ids"] = linked_agent_ids
182
+
183
+ # Clean up the raw agent_trigger_links data as it's no longer needed
184
+ registration.pop("agent_trigger_links", None)
185
+
186
+ return response.data or []
187
+ except Exception as e:
188
+ logger.error(f"Error getting user trigger registrations with agents: {e}")
189
+ return []
165
190
 
166
191
  async def get_trigger_registration(self, registration_id: str, user_id: str = None) -> Optional[Dict[str, Any]]:
167
192
  """Get a specific trigger registration."""
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "langchain-trigger-server"
7
- version = "0.2.0"
7
+ version = "0.2.1"
8
8
  description = "Generic event-driven triggers framework"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.9"