| 1 | import type { OrchestratorFixtureInput } from "../shared.ts"; |
| 2 | |
| 3 | export const GROK_BACKGROUND_SUBAGENT_PROMPT = |
| 4 | "Spawn one background subagent (run it in the background, do not wait for it) whose task is: run the shell command 'sleep 20' and then reply exactly SUBAGENT_DONE. As soon as the subagent is launched, end your turn by replying exactly ROOT_DONE without waiting for it."; |
| 5 | |
| 6 | /** Grok's own reply once the subagent finished (its `subagent-completed-<id>` wake turn). */ |
| 7 | const GROK_SUBAGENT_WAKE_LABEL = |
| 8 | "notification:session/update:agent_message_chunk:subagent-completed-00000000-0000-4000-8000-000000000002"; |
| 9 | |
| 10 | // The root prompt settles while the subagent still runs, so run 1 is held open |
| 11 | // until `subagent_finished`, then finishes through the adapter's debounce. |
| 12 | // Grok's own reply to the finished subagent is held until run 1 settled and |
| 13 | // replays as a continuation run, like Claude and Codex background wakes. |
| 14 | export function grokBackgroundSubagentInput(): OrchestratorFixtureInput { |
| 15 | return { |
| 16 | steps: [ |
| 17 | { type: "message", text: GROK_BACKGROUND_SUBAGENT_PROMPT }, |
| 18 | { type: "finish_held_run", targetRunIndex: 1, status: "completed" }, |
| 19 | { type: "release_replay_gate", label: GROK_SUBAGENT_WAKE_LABEL }, |
| 20 | { type: "finish_held_run", targetRunIndex: 2, status: "completed" }, |
| 21 | ], |
| 22 | }; |
| 23 | } |