({ task, agentId, label, cleanup })
| 51 | } |
| 52 | |
| 53 | function renderSessionsSpawnCall({ task, agentId, label, cleanup }) { |
| 54 | const t = String(task || '').trim(); |
| 55 | if (!t) throw new Error('bridge: missing task'); |
| 56 | const a = String(agentId || 'main'); |
| 57 | const l = String(label || 'gep_bridge'); |
| 58 | const c = cleanup ? String(cleanup) : 'delete'; |
| 59 | |
| 60 | // Output valid JSON so consumers can parse with JSON.parse (not regex). |
| 61 | // The consumer side is extractFirstSpawnPayload()/parseFirstSpawnCall() below, |
| 62 | // which take the FIRST sessions_spawn( occurrence — see those functions for why. |
| 63 | const payload = JSON.stringify({ task: t, agentId: a, cleanup: c, label: l }); |
| 64 | return `sessions_spawn(${payload})`; |
| 65 | } |
| 66 | |
| 67 | const SPAWN_MARKER = 'sessions_spawn('; |
| 68 |
no outgoing calls
no test coverage detected