INNER CODE UNIT · TypeScript

RPC_ID

AmrDab/clawdcursor · src/surface/cli.ts:1040

    RPC_ID=$((RPC_ID + 1))
    # JSON-encode the task by piping through python; falls back to naive escape if python missing
    BODY=$(python3 -c "import json,sys; print(json.dumps({'jsonrpc':'2.0','id':$RPC_ID,'method':'tools/call','params':{'name':'submit_task','arguments':{'task':sys.argv[1]}}}))" "$task" 2>/dev/null) || BODY="{\\"jsonrpc\\":\\"2.0\\",\\"id\\":$RPC_ID,\\"method\\":\\"tools/call\\",\\"params\\":{\\"name\\":\\"submit_task\\",\\"arguments\\":{\\"task\\":\\"$task\\"}}}"
    curl -s -X POST http://127.0.0.1:${opts.port}/mcp \\
      -H "Content-Type: application/json" \\
      -H "Accept: application/json, text/event-stream"${token ? ' \\\n      -H "$AUTH_HEADER"' : ''} \\
      -d "$BODY" \\
      | python3 -c "import json,sys; r=json.load(sys.stdin); content=r.get('result',{}).get('content',[]); [print(b.get('text','')) for b in content if b.get('type')=='text']" 2>/dev/null \\
      || echo "Failed to connect. Is clawdcursor agent running?"
    echo ""
done
`;

      if (platform === 'win32') {
        // Write temp PS1 and open in new Windows Terminal / PowerShell window
        const fs = await import('fs');
        const path = await import('path');
        // Private 0700 temp dir (mkdtemp, unguessable suffix) — this script is

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…