        // Evidence driver: invoke real MCP tools, with a file gate for the child.
        const evidence = process.env.EVIDENCE_DIR;
        if (evidence) {
          const fs = await import('node:fs/promises');
          const text = JSON.stringify(params.prompt);
          const say = (text) => send({method:'session/update',params:{sessionId,update:{sessionUpdate:'agent_message_chunk',content:{type:'text',text}}}});
          if (text.includes('EVIDENCE_CHILD_GATE')) {
            await fs.writeFile(`${evidence}/child-running`, 'running');
            say('Child running; awaiting explicit release.');
            while (true) {
              try { await fs.access(`${evidence}/release`); break; } catch {}
              await new Promise(resolve => setTimeout(resolve, 200));
            }
            say('Child completed.');
            return {stopReason:'end_turn'};
          }
          if (text.includes('EVIDENCE_PARENT_START') && session.promptCount === 0) {
            session.promptCount++;
            const endpoint = process.env.T3_ACP_MCP_ENDPOINT;
            const authorization = process.env.T3_ACP_MCP_AUTHORIZATION;
            await fs.writeFile(`${evidence}/access.json`,JSON.stringify({endpoint,authorization,threadId:process.env.T3CODE_THREAD_ID}),{mode:0o600});
            let sid;
            let id = 0;
            const rpc = async (method, params) => {
              const r = await fetch(endpoint,{method:'POST',headers:{'content-type':'application/json',accept:'application/json, text/event-stream',authorization,...(sid?{'mcp-session-id':sid}:{})},body:JSON.stringify({jsonrpc:'2.0',id:++id,method,params})});
              sid = r.headers.get('mcp-session-id') ?? sid;
              const raw = await r.text();
              const value = raw.startsWith('event:') || raw.startsWith('data:') ? JSON.parse(raw.split('\n').find(x=>x.startsWith('data:')).slice(5)) : JSON.parse(raw);
              if(value.error) throw new Error(JSON.stringify(value.error));
              return value.result;
            };
            await rpc('initialize',{protocolVersion:'2025-06-18',capabilities:{},clientInfo:{name:'evidence-driver',version:'1'}});
            await rpc('tools/call',{name:'orchestrator_capabilities',arguments:{}});
            const result = await rpc('tools/call',{name:'delegate_task',arguments:{task:'EVIDENCE_CHILD_GATE: wait for the release signal, then finish.',title:'Pending child',mode:'async',isolation:'shared'}});
            await fs.writeFile(`${evidence}/delegation.json`,JSON.stringify(result,null,2));
            if(result.isError) throw new Error(JSON.stringify(result));
            say('Delegated child asynchronously. Parent turn ends while the child continues.');
            return {stopReason:'end_turn'};
          }
          say('Child completion handled.');
          return {stopReason:'end_turn'};
        }
