(task, opts)
| 107 | } |
| 108 | |
| 109 | function _buildSpawnTask(task, opts) { |
| 110 | const capabilities = Array.isArray(task.capabilities) ? task.capabilities.slice(0, 8) : []; |
| 111 | const signalsCsv = task.signals ? String(task.signals) : ''; |
| 112 | const answerPath = _answerFilePath(task.id); |
| 113 | const question = _clipQuestion(task.user_question_body || task.description || task.title); |
| 114 | |
| 115 | const evolverExec = opts && opts.evolverExec ? opts.evolverExec : 'node index.js'; |
| 116 | |
| 117 | const lines = [ |
| 118 | 'You are an ATP merchant sub-agent. A buyer has paid credits for your node to answer their request.', |
| 119 | '', |
| 120 | '# Task', |
| 121 | '- Task ID: ' + task.id, |
| 122 | '- ATP Order ID: ' + task.atp_order_id, |
| 123 | '- Title: ' + String(task.title || '(no title)').slice(0, 200), |
| 124 | '- Capabilities requested: ' + (capabilities.length ? capabilities.join(', ') : '(none)'), |
| 125 | '- Signals: ' + (signalsCsv || '(none)'), |
| 126 | '', |
| 127 | '# Buyer question', |
| 128 | question, |
| 129 | '', |
| 130 | '# Your job', |
| 131 | '1. Produce a concrete, useful answer to the buyer question above.', |
| 132 | ' - Use your existing tools (web search, code read, reasoning) as appropriate.', |
| 133 | ' - Keep the answer focused and actionable; do not invent facts.', |
| 134 | ' - If the question is ambiguous, answer the most reasonable interpretation and state your assumption.', |
| 135 | '2. Write the full answer to this file (plain text or markdown):', |
| 136 | ' ' + answerPath, |
| 137 | '3. Settle the order by running EXACTLY this command from the Evolver install dir:', |
| 138 | ' ' + evolverExec + ' atp-complete \\', |
| 139 | ' --task-id=' + task.id + ' \\', |
| 140 | ' --order-id=' + task.atp_order_id + ' \\', |
| 141 | ' --answer-file=' + answerPath + |
| 142 | (capabilities.length ? ' \\\n --capabilities=' + capabilities.join(',') : '') + |
| 143 | (signalsCsv ? ' \\\n --signals=' + signalsCsv : ''), |
| 144 | '4. If atp-complete prints "[ATP-Complete] OK asset_id=...", you are done.', |
| 145 | ' If it prints "FAILED", read the stage= field. Safe to retry the same command.', |
| 146 | '', |
| 147 | '# Hard rules', |
| 148 | '- Do NOT commit or push any repo changes -- this is a per-order side task, not a code evolution.', |
| 149 | '- Do NOT run `node index.js solidify` or `node index.js run`.', |
| 150 | '- Do NOT fabricate the answer; if you cannot answer, still run atp-complete with a short', |
| 151 | ' honest explanation so the buyer is not left waiting for 7 days.', |
| 152 | '- Keep the answer under 12k characters.', |
| 153 | ]; |
| 154 | return lines.join('\n'); |
| 155 | } |
| 156 | |
| 157 | /** |
| 158 | * Fetch a pickup action if one is due. Idempotent -- safe to call from the |
no test coverage detected