feat(prompts): work-first envelope with spawn/followup tool calls at top and bottom

This commit is contained in:
operator
2026-10-05 05:43:26 +00:00
parent dad33dcaa3
commit 74d093d259
3 changed files with 115 additions and 26 deletions
+4 -22
View File
@@ -528,28 +528,10 @@ 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
# Work-first envelope: executable swarm.spawn/followup.create at TOP and BOTTOM
# (see bin/prompt_envelope.py). Always applied, even if the template has its own [RESULT.
import prompt_envelope
rendered = prompt_envelope.wrap(job_name, job_id, agent, target, rendered)
# Format as JOB DM
dm_message = f"[JOB {job_id}] {rendered}"