INNER CODE UNIT · TypeScript
sendTask
AmrDab/clawdcursor · src/surface/cli.ts:917
const sendTask = async (taskText: string) => {
try {
console.log(`\n${e('🐾', '>')} Sending: ${taskText}`);
const res = await fetch(url, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Accept: 'application/json, text/event-stream',
...authHeaders(),
},
body: JSON.stringify({
jsonrpc: '2.0',
id: 1,
method: 'tools/call',
params: { name: 'submit_task', arguments: { task: taskText } },
}),
});
if (res.status === 401) {