feat(runtime): embed box.muse-dev.online thread url and tool execution directives into followups, nudges, and dispatches
This commit is contained in:
+18
-10
@@ -658,17 +658,20 @@ def process_messages(raw_messages, agent, thread_id, thread_name, last_wm, follo
|
||||
if thread_id and re.fullmatch(r"[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}", thread_id.lower()):
|
||||
try:
|
||||
import muse_hybrid
|
||||
thread_url = f"https://box.muse-dev.online/thread/{thread_id}"
|
||||
tool_hint = (
|
||||
f"[Runtime Context: {thread_url}]\n"
|
||||
f"Tools available: [TOOL <op> <args>] or curl -sk -X POST https://box.muse-dev.online/exec\n"
|
||||
f" • [TOOL followup.create {{\"in_m\": 5, \"prompt\": \"<reminder>\"}}]\n"
|
||||
f" • [TOOL swarm.spawn {{\"count\": 1, \"task\": \"<task>\"}}]\n"
|
||||
f" • [TOOL health.check {{}}]\n\n"
|
||||
f"[Directive: Take next action or close with [RESULT <job_id>] <summary>]"
|
||||
)
|
||||
if t_ok:
|
||||
clean_msg = format_tool_result_for_chat(op, t_res)
|
||||
resp_text = (
|
||||
f"Tool result (`{op}`):\n{clean_msg}\n\n"
|
||||
f"[Directive: Review result and take next action. When complete, close with [RESULT <job_id>] <summary>]"
|
||||
)
|
||||
resp_text = f"Tool result (`{op}`):\n{clean_msg}\n\n{tool_hint}"
|
||||
else:
|
||||
resp_text = (
|
||||
f"Tool error (`{op}`): {t_res}\n\n"
|
||||
f"[Directive: Review error and retry or proceed. When complete, close with [RESULT <job_id>] <summary>]"
|
||||
)
|
||||
resp_text = f"Tool error (`{op}`): {t_res}\n\n{tool_hint}"
|
||||
muse_hybrid.send_message(agent, resp_text, thread_id=thread_id, wait=0)
|
||||
except Exception as te:
|
||||
sys.stderr.write(f"warning: failed to post tool response back to thread: {te}\n")
|
||||
@@ -1046,8 +1049,13 @@ def maybe_nudge_untagged_sidechat(agent, thread_id, thread_name, mid, text, dry_
|
||||
if rec.get("nudged_for_mid") == mid or rec.get("nudge_count", 0) >= 1:
|
||||
return
|
||||
|
||||
# Inject terse nudge footer
|
||||
nudge_msg = f"[Nudge: To advance the workflow, reply with [RESULT {matching_job_id}] <outcome>]"
|
||||
# Inject terse nudge footer with runtime & tool directive
|
||||
thread_url = f"https://box.muse-dev.online/thread/{thread_id}"
|
||||
nudge_msg = (
|
||||
f"[Nudge: Work thread active at {thread_url}]\n"
|
||||
f"Available Tools: [TOOL <op> <args>] or curl to https://box.muse-dev.online/exec\n"
|
||||
f"Reply with [TOOL <op> <args>] to execute or close with [RESULT {matching_job_id}] <outcome>."
|
||||
)
|
||||
try:
|
||||
import muse_hybrid
|
||||
print(f"[{agent}] Injecting 1-turn nudge into {thread_name or thread_id[:8]} for job {matching_job_id}")
|
||||
|
||||
Reference in New Issue
Block a user