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
@@ -279,6 +279,45 @@ def test_mobile_manage_task_unknown_trace(temp_trace_env):
|
||||
assert "not found" in res["message"]
|
||||
|
||||
|
||||
def test_web_task_can_be_paused_and_guided_from_mcp(temp_trace_env, monkeypatch):
|
||||
import sqlite3
|
||||
from pathlib import Path
|
||||
|
||||
import artemis.runtime.task_control as control
|
||||
|
||||
monkeypatch.setattr(control, "TRACES_PATH", Path(temp_trace_env))
|
||||
monkeypatch.setattr("mcp_server.tools.task_manager._pid_alive", lambda pid: True)
|
||||
trace_id = str(uuid.uuid4())
|
||||
db = Path(temp_trace_env) / "data_engine.db"
|
||||
with sqlite3.connect(db) as conn:
|
||||
conn.execute(
|
||||
"CREATE TABLE sessions (session_id TEXT, status TEXT, pid INTEGER, "
|
||||
"start_time REAL, end_time REAL, device_info TEXT)"
|
||||
)
|
||||
conn.execute(
|
||||
"INSERT INTO sessions VALUES (?, 'running', 17, 1, NULL, ?)",
|
||||
(trace_id, '{"device_id":"test-device"}'),
|
||||
)
|
||||
|
||||
assert (
|
||||
mobile_manage_task(action="status", trace_id=trace_id)["device_serial"] == "test-device"
|
||||
)
|
||||
assert mobile_manage_task(action="pause", trace_id=trace_id)["status"] == "pausing"
|
||||
assert (Path(temp_trace_env) / trace_id / "pause.request").exists()
|
||||
control._write_atomic(
|
||||
control.control_dir(trace_id) / "task_control_state.json", {"status": "task_paused"}
|
||||
)
|
||||
guided = mobile_manage_task(
|
||||
action="inject_instruction", trace_id=trace_id, instruction="先确认当前画面"
|
||||
)
|
||||
assert guided["status"] == "task_paused"
|
||||
assert (Path(temp_trace_env) / trace_id / "resume.request").exists()
|
||||
assert (
|
||||
control.consume_instructions(control.control_dir(trace_id))["instruction"]
|
||||
== "先确认当前画面"
|
||||
)
|
||||
|
||||
|
||||
def test_mobile_manage_task_status_and_stop(temp_trace_env):
|
||||
trace_id = str(uuid.uuid4())
|
||||
trace_store.init_trace(trace_id, "Test task", "Flash", "conv-1", device_serial="device-xyz")
|
||||
|
||||
Reference in new issue
Block a user