feat: add prompt-first batches and pausable task guidance
This commit is contained in:
1 parent
cec9898e4c
commit
057f0c3050
44 files changed
+1080
-191
No files matched your search
@@ -184,7 +184,10 @@ async def mobile_batch(
|
||||
"""Create, execute and manage durable batches on the unified device queue.
|
||||
|
||||
create requires a unique request_id and batch={name,device_serial,cases:[{name,goal,
|
||||
expected?,app?,preconditions?,parameters?:{key:primitive},tags?}],profile?:flash|pro,
|
||||
case_id?,category?,subcategory?,preconditions?,task_config?:{profile?,model?,
|
||||
reasoning_effort?,device_serial?,verification_level?,explorer_mode?,
|
||||
locked_app_package?,record_video?,analyze_video?,request_timeout_seconds?,
|
||||
max_retries?,retry_interval_seconds?,timeout_seconds?}}],profile?:flash|pro,
|
||||
formats?:[docx,xlsx],stop_on_failure?:false,timeout_seconds?:1800}. Required device
|
||||
must be user-selected. Creation validates and saves a DRAFT; start executes it.
|
||||
Reuse the same request_id and exact payload after a connection failure; never invent
|
||||
@@ -225,7 +228,7 @@ async def mobile_search_history(
|
||||
page: int = 1,
|
||||
size: int = 30,
|
||||
) -> dict:
|
||||
"""Search ALL persisted terminal tasks by name, goal, ID or tags, with pagination.
|
||||
"""Search ALL persisted terminal tasks by name, prompt, ID or case metadata, with pagination.
|
||||
|
||||
start/end are Unix seconds, inclusive/exclusive; convert the user's local dates
|
||||
before calling. Status: completed/success/failed/cancelled/interrupted/skipped.
|
||||
@@ -243,11 +246,12 @@ async def mobile_search_history(
|
||||
async def mobile_export_report(
|
||||
session_id: str | None = None,
|
||||
batch_id: str | None = None,
|
||||
formats: list[Literal["docx", "xlsx"]] | None = None,
|
||||
formats: list[Literal["docx", "xlsx", "screenshots", "video", "all"]] | None = None,
|
||||
) -> dict:
|
||||
"""Export a task's Word/Excel reports or a batch ZIP to local files on the MCP host.
|
||||
"""Export Word/Excel, ordered screenshots, saved recording segments or all task material.
|
||||
|
||||
Provide exactly one of session_id/batch_id. Task formats omitted uses saved defaults;
|
||||
screenshots/video/all produce ZIPs; video requires recording to have been enabled.
|
||||
batch ZIP uses its frozen formats and includes summary + individual case reports.
|
||||
Returns absolute paths, download URLs and sizes; task results also include structured
|
||||
verdict/evidence. Running exports are snapshots. 'completed' is not proof of PASS;
|
||||
@@ -269,11 +273,18 @@ async def mobile_export_report(
|
||||
if formats is not None
|
||||
else (await _request("GET", "/api/automation/preferences"))["formats"]
|
||||
)
|
||||
if not chosen or len(chosen) > 2 or any(fmt not in {"docx", "xlsx"} for fmt in chosen):
|
||||
raise ValueError("formats 至少选择 docx 或 xlsx,最多两项")
|
||||
if (
|
||||
not chosen
|
||||
or len(chosen) > 5
|
||||
or any(fmt not in {"docx", "xlsx", "screenshots", "video", "all"} for fmt in chosen)
|
||||
):
|
||||
raise ValueError("formats 需选择 docx、xlsx、screenshots、video 或 all")
|
||||
report = await _request("GET", f"/api/automation/reports/{sid}")
|
||||
files = [
|
||||
await _download(f"/api/automation/reports/{sid}/{fmt}", f"task-{sid}.{fmt}")
|
||||
await _download(
|
||||
f"/api/automation/reports/{sid}/{fmt}",
|
||||
f"task-{sid}.{fmt}" if fmt in {"docx", "xlsx"} else f"task-{sid}-{fmt}.zip",
|
||||
)
|
||||
for fmt in dict.fromkeys(chosen)
|
||||
]
|
||||
return {"report": report, "files": files}
|
||||
Reference in new issue
Block a user