feat(prompts): work-first envelope with spawn/followup tool calls at top and bottom
This commit is contained in:
@@ -163,7 +163,16 @@ def parse_tool_calls(text):
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
return calls
|
||||
# De-duplicate identical calls within one message (envelope repeats the spawn
|
||||
# call at top and bottom; an agent echoing both must not run it twice).
|
||||
seen, unique = set(), []
|
||||
for op, args in calls:
|
||||
key = (op, json.dumps(args, sort_keys=True, default=str))
|
||||
if key in seen:
|
||||
continue
|
||||
seen.add(key)
|
||||
unique.append((op, args))
|
||||
return unique
|
||||
|
||||
|
||||
def execute_agent_tool(agent, op, args, timeout=30):
|
||||
@@ -1065,12 +1074,19 @@ def maybe_nudge_untagged_sidechat(agent, thread_id, thread_name, mid, text, dry_
|
||||
# 1st turn: Strict rejection and tool invocation prompt
|
||||
if n_count == 0:
|
||||
thread_url = f"https://box.muse-dev.online/thread/{thread_id}"
|
||||
try:
|
||||
import prompt_envelope
|
||||
_spawn = prompt_envelope.spawn_call(
|
||||
matching_job_id, matching_job_id, prompt_envelope.pick_profile(matching_job_id))
|
||||
except Exception:
|
||||
_spawn = '[TOOL swarm.spawn {"count": 2, "task": "continue the job work"}]'
|
||||
nudge_msg = (
|
||||
f"{_spawn}\n"
|
||||
f"[STRICT ENFORCEMENT: Conversational commentary is rejected. Work requires active execution.]\n"
|
||||
f"Thread Console: {thread_url}\n"
|
||||
f"You must emit an executable tool call: [TOOL <op> <args>] or curl command against https://box.muse-dev.online/exec\n"
|
||||
f"Example: [TOOL service.status {{\"unit\": \"board.service\"}}] or [TOOL followup.create {{\"in_m\": 10, \"prompt\": \"continue\"}}]\n"
|
||||
f"When all operations are finished, close strictly with [RESULT {matching_job_id}] <outcome>."
|
||||
f"Emit executable tool calls now: [TOOL <op> <args>] or curl against https://box.muse-dev.online/exec\n"
|
||||
f"When all operations are finished, close strictly with [RESULT {matching_job_id}] <outcome>.\n"
|
||||
f"{_spawn}"
|
||||
)
|
||||
try:
|
||||
import muse_hybrid
|
||||
|
||||
Reference in New Issue
Block a user