daita-agents 0.2.0__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.
Files changed (69) hide show
  1. daita/__init__.py +216 -0
  2. daita/agents/__init__.py +33 -0
  3. daita/agents/base.py +743 -0
  4. daita/agents/substrate.py +1141 -0
  5. daita/cli/__init__.py +145 -0
  6. daita/cli/__main__.py +7 -0
  7. daita/cli/ascii_art.py +44 -0
  8. daita/cli/core/__init__.py +0 -0
  9. daita/cli/core/create.py +254 -0
  10. daita/cli/core/deploy.py +473 -0
  11. daita/cli/core/deployments.py +309 -0
  12. daita/cli/core/import_detector.py +219 -0
  13. daita/cli/core/init.py +481 -0
  14. daita/cli/core/logs.py +239 -0
  15. daita/cli/core/managed_deploy.py +709 -0
  16. daita/cli/core/run.py +648 -0
  17. daita/cli/core/status.py +421 -0
  18. daita/cli/core/test.py +239 -0
  19. daita/cli/core/webhooks.py +172 -0
  20. daita/cli/main.py +588 -0
  21. daita/cli/utils.py +541 -0
  22. daita/config/__init__.py +62 -0
  23. daita/config/base.py +159 -0
  24. daita/config/settings.py +184 -0
  25. daita/core/__init__.py +262 -0
  26. daita/core/decision_tracing.py +701 -0
  27. daita/core/exceptions.py +480 -0
  28. daita/core/focus.py +251 -0
  29. daita/core/interfaces.py +76 -0
  30. daita/core/plugin_tracing.py +550 -0
  31. daita/core/relay.py +779 -0
  32. daita/core/reliability.py +381 -0
  33. daita/core/scaling.py +459 -0
  34. daita/core/tools.py +554 -0
  35. daita/core/tracing.py +770 -0
  36. daita/core/workflow.py +1144 -0
  37. daita/display/__init__.py +1 -0
  38. daita/display/console.py +160 -0
  39. daita/execution/__init__.py +58 -0
  40. daita/execution/client.py +856 -0
  41. daita/execution/exceptions.py +92 -0
  42. daita/execution/models.py +317 -0
  43. daita/llm/__init__.py +60 -0
  44. daita/llm/anthropic.py +291 -0
  45. daita/llm/base.py +530 -0
  46. daita/llm/factory.py +101 -0
  47. daita/llm/gemini.py +355 -0
  48. daita/llm/grok.py +219 -0
  49. daita/llm/mock.py +172 -0
  50. daita/llm/openai.py +220 -0
  51. daita/plugins/__init__.py +141 -0
  52. daita/plugins/base.py +37 -0
  53. daita/plugins/base_db.py +167 -0
  54. daita/plugins/elasticsearch.py +849 -0
  55. daita/plugins/mcp.py +481 -0
  56. daita/plugins/mongodb.py +520 -0
  57. daita/plugins/mysql.py +362 -0
  58. daita/plugins/postgresql.py +342 -0
  59. daita/plugins/redis_messaging.py +500 -0
  60. daita/plugins/rest.py +537 -0
  61. daita/plugins/s3.py +770 -0
  62. daita/plugins/slack.py +729 -0
  63. daita/utils/__init__.py +18 -0
  64. daita_agents-0.2.0.dist-info/METADATA +409 -0
  65. daita_agents-0.2.0.dist-info/RECORD +69 -0
  66. daita_agents-0.2.0.dist-info/WHEEL +5 -0
  67. daita_agents-0.2.0.dist-info/entry_points.txt +2 -0
  68. daita_agents-0.2.0.dist-info/licenses/LICENSE +56 -0
  69. daita_agents-0.2.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,172 @@
1
+ """
2
+ Webhook CLI commands for listing and managing webhook configurations.
3
+
4
+ Provides user-friendly access to webhook URLs and configurations
5
+ with organization-level security and optional API key filtering.
6
+ """
7
+ import os
8
+ import asyncio
9
+ import aiohttp
10
+ import ssl
11
+ from typing import Dict, Any, Optional
12
+ from ...config.settings import settings
13
+
14
+
15
+ def _get_secure_api_endpoint() -> str:
16
+ """Get validated API endpoint with security checks."""
17
+ # Use production API endpoint (can be overridden via environment)
18
+ endpoint = os.getenv("DAITA_API_ENDPOINT") or "https://ondk4sdyv0.execute-api.us-east-1.amazonaws.com"
19
+
20
+ try:
21
+ return settings.validate_endpoint(endpoint)
22
+ except ValueError as e:
23
+ raise ValueError(f"Invalid API endpoint configuration: {e}")
24
+
25
+
26
+ async def list_webhooks(api_key_only: bool = False, verbose: bool = False) -> bool:
27
+ """
28
+ List all webhook URLs for the authenticated organization.
29
+
30
+ Args:
31
+ api_key_only: If True, filter to webhooks created with current API key only
32
+ verbose: Enable verbose output
33
+
34
+ Returns:
35
+ bool: True if successful, False otherwise
36
+ """
37
+ # Check for DAITA_API_KEY
38
+ api_key = os.getenv("DAITA_API_KEY")
39
+ if not api_key:
40
+ print(" No DAITA_API_KEY found.")
41
+ print(" Get your API key at https://dashboard.daita-tech.io")
42
+ print(" Then: export DAITA_API_KEY='your-key-here'")
43
+ return False
44
+
45
+ try:
46
+ # Get secure API endpoint
47
+ api_endpoint = _get_secure_api_endpoint()
48
+ url = f"{api_endpoint}/api/v1/webhooks/list"
49
+
50
+ if api_key_only:
51
+ url += "?api_key_only=true"
52
+
53
+ headers = {
54
+ "Authorization": f"Bearer {api_key}",
55
+ "Content-Type": "application/json",
56
+ "User-Agent": "Daita-CLI/1.0.0"
57
+ }
58
+
59
+ # Create secure SSL context
60
+ ssl_context = ssl.create_default_context()
61
+ ssl_context.check_hostname = True
62
+ ssl_context.verify_mode = ssl.CERT_REQUIRED
63
+
64
+ connector = aiohttp.TCPConnector(ssl=ssl_context)
65
+
66
+ async with aiohttp.ClientSession(connector=connector) as session:
67
+ if verbose:
68
+ print(f"📡 Fetching webhooks from {url}")
69
+
70
+ async with session.get(url, headers=headers, timeout=30) as response:
71
+ if response.status == 200:
72
+ data = await response.json()
73
+ await _display_webhooks(data, verbose)
74
+ return True
75
+ elif response.status == 401:
76
+ print(" Authentication failed - check your DAITA_API_KEY")
77
+ print(" Get a new API key at https://dashboard.daita-tech.io")
78
+ return False
79
+ elif response.status == 404:
80
+ print(" No webhook configurations found.")
81
+ print(" Deploy a project with webhook configurations using 'daita push'")
82
+ return True
83
+ else:
84
+ error_text = await response.text()
85
+ print(f" Failed to fetch webhooks (HTTP {response.status})")
86
+ if verbose:
87
+ print(f" Details: {error_text}")
88
+ return False
89
+
90
+ except aiohttp.ClientConnectorError:
91
+ print(" Cannot connect to Daita API")
92
+ print(" Check your internet connection and try again")
93
+ return False
94
+ except asyncio.TimeoutError:
95
+ print(" Request timed out")
96
+ print(" Try again or check your internet connection")
97
+ return False
98
+ except Exception as e:
99
+ print(f" Error fetching webhooks: {str(e)}")
100
+ if verbose:
101
+ import traceback
102
+ traceback.print_exc()
103
+ return False
104
+
105
+
106
+ async def _display_webhooks(data: Dict[str, Any], verbose: bool = False) -> None:
107
+ """
108
+ Display webhook information in a user-friendly format.
109
+
110
+ Args:
111
+ data: Response data from the webhook list API
112
+ verbose: Enable verbose output
113
+ """
114
+ org_id = data.get("organization_id")
115
+ org_name = data.get("organization_name", f"Organization {org_id}")
116
+ total_webhooks = data.get("total_webhooks", 0)
117
+ agent_webhooks = data.get("agent_webhooks", {})
118
+ workflow_webhooks = data.get("workflow_webhooks", {})
119
+
120
+ if total_webhooks == 0:
121
+ print("")
122
+ print(" No webhook URLs found")
123
+ print("")
124
+ print("💡 To create webhooks:")
125
+ print(" 1. Add webhook configurations to your daita-project.yaml")
126
+ print(" 2. Deploy with 'daita push production'")
127
+ print("")
128
+ return
129
+
130
+ print("")
131
+ print(f" Webhook URLs (Organization: {org_name})")
132
+ print("")
133
+
134
+ # Display agent webhooks
135
+ if agent_webhooks:
136
+ print("Agent Webhooks:")
137
+ for agent_name, webhooks in agent_webhooks.items():
138
+ print(f" {agent_name}:")
139
+ for webhook in webhooks:
140
+ slug = webhook["webhook_slug"]
141
+ url = webhook["webhook_url"]
142
+ print(f" {slug:<20} → {url}")
143
+
144
+ if verbose and webhook.get("field_mapping"):
145
+ print(f" Field mapping: {webhook['field_mapping']}")
146
+ print("")
147
+
148
+ # Display workflow webhooks
149
+ if workflow_webhooks:
150
+ print("Workflow Webhooks:")
151
+ for workflow_name, webhooks in workflow_webhooks.items():
152
+ print(f" {workflow_name}:")
153
+ for webhook in webhooks:
154
+ slug = webhook["webhook_slug"]
155
+ url = webhook["webhook_url"]
156
+ print(f" {slug:<20} → {url}")
157
+
158
+ if verbose and webhook.get("field_mapping"):
159
+ print(f" Field mapping: {webhook['field_mapping']}")
160
+ print("")
161
+
162
+ # Add helpful usage information
163
+ print("💡 Usage:")
164
+ print(" • Copy webhook URLs to your external services (GitHub, Slack, etc.)")
165
+ print(" • Send HTTP POST requests with JSON payloads")
166
+ print(" • Field mapping will transform payloads automatically")
167
+ print("")
168
+ print("🔧 Example:")
169
+ print(" curl -X POST '<webhook-url>' \\")
170
+ print(" -H 'Content-Type: application/json' \\")
171
+ print(" -d '{\"your\": \"payload\"}'")
172
+ print("")