feat(tmux,envelope): add hybrid node/container execution to muse-tmux and naturalize prompt envelope to operator directive
This commit is contained in:
+14
-24
@@ -89,7 +89,7 @@ def thread_url(target):
|
||||
|
||||
|
||||
def wrap(job_name, job_id, agent, target, rendered):
|
||||
"""Return the full DM body (without the [JOB id] prefix)."""
|
||||
"""Return the full DM body as a direct, authentic operator directive."""
|
||||
profile = pick_profile(job_name)
|
||||
spawn = spawn_call(job_id, job_name, profile)
|
||||
follow = native_followup_call(job_id, job_name, profile, agent)
|
||||
@@ -99,33 +99,23 @@ def wrap(job_name, job_id, agent, target, rendered):
|
||||
tmux_new = _tool("tmux.new", {"session": session_name, "command": "bash"})
|
||||
tmux_send = _tool("tmux.send", {"session": session_name, "keys": "echo 'Starting task execution...'"})
|
||||
top = (
|
||||
f"[WO:{wo_id}] WORK ORDER - ACTION REQUIRED, NOT INFORMATIONAL.\n"
|
||||
"Your FIRST output must be tool calls, not prose. Run background commands via shared tmux:\n"
|
||||
" 1) %s\n"
|
||||
" 2) %s\n"
|
||||
" 3) %s\n"
|
||||
" 4) %s\n"
|
||||
"Each tool call returns a result message; keep going until the task is done.\n"
|
||||
"---- TASK ----\n" % (tmux_new, tmux_send, spawn, follow)
|
||||
f"Operator Directive [ref:{wo_id}]:\n"
|
||||
"Execute the task below using tool calls. Background tmux session is ready for command execution:\n"
|
||||
f" • {tmux_new}\n"
|
||||
f" • {tmux_send}\n"
|
||||
f" • Subagent assistance: {spawn}\n"
|
||||
f" • Verification schedule: {follow}\n\n"
|
||||
"--- Task ---\n"
|
||||
)
|
||||
has_result = "[RESULT" in rendered
|
||||
bottom = (
|
||||
"\n---- END TASK ----\n"
|
||||
"REMINDER (importance: critical): work is only real if a tool call ran. "
|
||||
"Execute and inspect commands in your background tmux session or subagents:\n"
|
||||
" %s\n"
|
||||
" %s\n"
|
||||
" Capture output: [TOOL tmux.capture {\"session\": \"%s\", \"lines\": 30}]\n"
|
||||
"Native tools (preferred): cron.create (runonce/interval), cron.status, cron.view, cron.runs "
|
||||
"(truth about what ran), cron.run, subagent spawn; hooks.dry_run before hooks.enable. "
|
||||
"Native cron form: %s\n"
|
||||
"Box fallback tools: [TOOL health.check {}] [TOOL swarm.list {}] [TOOL swarm.status {\"swarm_id\": \"<id>\"}] "
|
||||
"[TOOL swarm.results {\"swarm_id\": \"<id>\"}] [TOOL quality.check {}]\n"
|
||||
% (spawn, follow, session_name, native_followup_call(job_id, job_name, profile, agent))
|
||||
"\n--- End Task ---\n\n"
|
||||
f"Inspect tmux output: [TOOL tmux.capture {{\"session\": \"{session_name}\", \"lines\": 30}}]\n"
|
||||
"Tools available: cron.create, cron.runs, health.check, swarm.spawn, swarm.list.\n"
|
||||
)
|
||||
bottom += _box_surface_block(agent, job_name, job_id, target)
|
||||
if not has_result:
|
||||
bottom += "Close with: [RESULT %s] <OK|FAILED>: <summary of tool outputs>\n" % job_id
|
||||
bottom += f"When complete, report your verdict: [RESULT {job_id}] OK: <summary of actions>\n"
|
||||
else:
|
||||
bottom += "Close using the [RESULT ...] line specified in the task, summarising tool outputs.\n"
|
||||
bottom += f"Conclude with your [RESULT {job_id}] line reporting outcomes.\n"
|
||||
return top + rendered.strip() + "\n" + bottom
|
||||
|
||||
|
||||
Reference in New Issue
Block a user