feat: add google stt and tts. add folders to organize agents

This commit is contained in:
Abhishek Kumar 2026-05-22 14:36:50 +05:30
parent 21951eca18
commit ad2fa07058
52 changed files with 3412 additions and 621 deletions

View file

@ -34,6 +34,10 @@ from api.mcp_server.ts_bridge import TsBridgeError, parse_code
from api.services.posthog_client import capture_event
from api.services.workflow.dto import ReactFlowDTO
from api.services.workflow.layout import reconcile_positions
from api.services.workflow.trigger_paths import (
extract_trigger_paths,
validate_trigger_paths,
)
from api.services.workflow.workflow_graph import WorkflowGraph
@ -53,20 +57,6 @@ def _format_errors(errors: list[dict[str, Any]]) -> str:
return "\n".join(parts)
def _extract_trigger_paths(workflow_definition: dict) -> list[str]:
"""Mirror of `routes.workflow.extract_trigger_paths` — kept local so the
MCP layer doesn't depend on the route module."""
if not workflow_definition:
return []
paths: list[str] = []
for node in workflow_definition.get("nodes") or []:
if node.get("type") == "trigger":
trigger_path = (node.get("data") or {}).get("trigger_path")
if trigger_path:
paths.append(trigger_path)
return paths
@traced_tool
async def create_workflow(code: str) -> dict[str, Any]:
"""Parse SDK TypeScript and create a new published workflow.
@ -129,6 +119,12 @@ async def create_workflow(code: str) -> dict[str, Any]:
# 1b. New workflow — no prior version to reconcile against; layout
# places new nodes adjacent to their first incoming neighbor.
payload = reconcile_positions(payload, None)
trigger_path_issues = validate_trigger_paths(payload)
if trigger_path_issues:
return _error_result(
"validation_error",
"\n".join(issue.message for issue in trigger_path_issues),
)
# 2. Pydantic shape check (defence in depth — parser is spec-driven).
try:
@ -144,7 +140,7 @@ async def create_workflow(code: str) -> dict[str, Any]:
# 4. Reject upfront if any trigger path collides with another workflow's
# trigger in this org so we don't leave an orphan workflow record.
trigger_paths = _extract_trigger_paths(payload)
trigger_paths = extract_trigger_paths(payload)
if trigger_paths:
try:
await db_client.assert_trigger_paths_available(