feat(runtime): embed box.muse-dev.online thread url and tool execution directives into followups, nudges, and dispatches

This commit is contained in:
operator
2026-10-05 05:27:47 +00:00
parent f78d540d73
commit c0add2a4ce
2 changed files with 44 additions and 17 deletions
+26 -7
View File
@@ -437,13 +437,6 @@ def main():
rendered = render_prompt(prompt_template, variables)
# Standard completion envelope: guarantee agents know how to report completion
if "[RESULT" not in rendered:
rendered = rendered.rstrip() + f"\n\nWhen finished, end your response with:\n[RESULT {job_id}] <OK|FAILED>: <summary of output>"
# Format as JOB DM
dm_message = f"[JOB {job_id}] {rendered}"
# Determine recipient agent and target
agent = job.get("agent", "muse")
target = "main"
@@ -535,6 +528,32 @@ def main():
"step_n": step_n,
})
# Determine thread url / context for the runtime envelope
target_clean = str(target)
thread_url = f"https://box.muse-dev.online/thread/{target_clean}" if re.fullmatch(r"[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}", target_clean.lower()) else f"https://box.muse-dev.online/sidechat/{target_clean}"
# Build active tool calling envelope for https://box.muse-dev.online/
tool_envelope = (
f"\n\n--- NetVM Runtime & Tools ({agent} on {target_clean}) ---\n"
f"Thread Console: {thread_url}\n"
f"Available Tools via [TOOL <op> <json_args>] or curl to https://box.muse-dev.online/exec:\n"
f" • Status: [TOOL health.check {{}}]\n"
f" • Service: [TOOL service.status {{\"unit\": \"board.service\"}}]\n"
f" • Follow-up: [TOOL followup.create {{\"in_m\": 10, \"prompt\": \"check progress\"}}]\n"
f" • Swarm: [TOOL swarm.spawn {{\"count\": 2, \"task\": \"parallel work\"}}]\n"
f"Direct Curl (Agent Bearer Auth):\n"
f" curl -sk -X POST https://box.muse-dev.online/exec -H \"Authorization: Bearer <token>\" "
f"-H \"Content-Type: application/json\" -d '{{\"op\":\"<op>\",\"args\":{{...}}}}'\n\n"
f"When finished, end your response with:\n"
f"[RESULT {job_id}] <OK|FAILED>: <summary of output>"
)
if "[RESULT" not in rendered:
rendered = rendered.rstrip() + tool_envelope
# Format as JOB DM
dm_message = f"[JOB {job_id}] {rendered}"
# Dispatch via dm.py (handles main or sidechat with auto-provisioning and verification)
msg_id = send_dm(agent, target, dm_message,
dry_run=dry_run, followup_tags=followup_tags,