Add task tool result bridge and evidence attachment workflow

This commit is contained in:
A R R R Associates
2026-08-31 15:24:09 +05:30
parent fbb8607842
commit a362cf438c
6 changed files with 497 additions and 6 deletions
+23
View File
@@ -1,6 +1,7 @@
from __future__ import annotations
from dataclasses import dataclass
from urllib.parse import urlencode
@dataclass(frozen=True)
@@ -46,3 +47,25 @@ def normalize_task_tool_code(code: str | None) -> str:
if value not in valid:
raise ValueError(f"Unsupported task tool: {value}")
return value
def build_task_tool_launch_url(
tool: TaskToolDefinition,
*,
client_id: int,
task_id: int,
tool_run_id: int,
) -> str:
if not tool.launch_url:
raise ValueError("This ERP task tool does not expose a launch URL.")
query = urlencode(
{
"client_id": int(client_id),
"task_id": int(task_id),
"task_tool_run_id": int(tool_run_id),
"task_return_url": f"/services/work-tracker/tasks/{int(task_id)}/edit",
"task_result_url": f"/services/work-tracker/tool-runs/{int(tool_run_id)}/result",
}
)
separator = "&" if "?" in tool.launch_url else "?"
return f"{tool.launch_url}{separator}{query}"