fix(mobile): wire plugin catalog and session-scoped subagent controls
This commit is contained in:
1 parent
61d765e2df
commit
1acb5dd90f
27 files changed
+1573
-17
No files matched your search
@@ -3572,14 +3572,53 @@ def _(rid, params: dict) -> dict:
|
||||
return _ok(rid, {"paused": set_spawn_paused(paused)})
|
||||
|
||||
|
||||
@method("subagent.list")
|
||||
def _(rid, params: dict) -> dict:
|
||||
from tui_gateway.mobile_subagents import owned_records, roster
|
||||
_, err = _sess_nowait(params, rid)
|
||||
if err:
|
||||
return err
|
||||
session_id = str(params.get("session_id") or "").strip()
|
||||
transport, session = _current_session_steer_authority(session_id)
|
||||
if transport is None or session is None:
|
||||
return _err(rid, 4001, "session not found or not owned by this transport")
|
||||
return _ok(rid, roster(owned_records(session_id, transport, session, include_lineage=True)))
|
||||
|
||||
|
||||
@method("subagent.tail")
|
||||
def _(rid, params: dict) -> dict:
|
||||
from tui_gateway.mobile_subagents import owned_records, transcript_tail
|
||||
_, err = _sess_nowait(params, rid)
|
||||
if err:
|
||||
return err
|
||||
subagent_id = str(params.get("subagent_id") or "").strip()
|
||||
if not subagent_id:
|
||||
return _err(rid, 4000, "subagent_id required")
|
||||
session_id = str(params.get("session_id") or "").strip()
|
||||
transport, session = _current_session_steer_authority(session_id)
|
||||
if transport is None or session is None:
|
||||
return _err(rid, 4001, "session not found or not owned by this transport")
|
||||
with _session_home_scope(session):
|
||||
result = transcript_tail(owned_records(session_id, transport, session), subagent_id)
|
||||
return _ok(rid, result)
|
||||
|
||||
|
||||
@method("subagent.interrupt")
|
||||
def _(rid, params: dict) -> dict:
|
||||
from tools.delegate_tool import interrupt_subagent
|
||||
from tui_gateway.mobile_subagents import owned_records
|
||||
from agent.interrupt_compat import request_hard_interrupt
|
||||
|
||||
subagent_id = str(params.get("subagent_id") or "").strip()
|
||||
if not subagent_id:
|
||||
return _err(rid, 4000, "subagent_id required")
|
||||
ok = interrupt_subagent(subagent_id)
|
||||
session_id = str(params.get("session_id") or "").strip()
|
||||
transport, session = _current_session_steer_authority(session_id)
|
||||
if transport is None or session is None:
|
||||
return _err(rid, 4001, "session not found or not owned by this transport")
|
||||
record = next((r for r in owned_records(session_id, transport, session)
|
||||
if r.get("subagent_id") == subagent_id), None)
|
||||
child = record.get("agent") if record else None
|
||||
ok = bool(request_hard_interrupt(child, "Interrupted via mobile")) if child is not None else False
|
||||
return _ok(rid, {"found": ok, "subagent_id": subagent_id})
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user