41 lines
962 B
JavaScript
41 lines
962 B
JavaScript
#!/usr/bin/env node
|
|
// Direct WebSocket trigger for the upwork email pipeline cron
|
|
// Bypasses the Clawdbot CLI which has gateway timeout issues
|
|
|
|
import WebSocket from 'ws';
|
|
|
|
const GATEWAY_URL = 'ws://127.0.0.1:18789';
|
|
const JOB_ID = '2205ac65-cda1-45ca-a041-0849b352a177';
|
|
|
|
const ws = new WebSocket(GATEWAY_URL);
|
|
const timeout = setTimeout(() => {
|
|
console.error('Timeout connecting to gateway');
|
|
ws.close();
|
|
process.exit(1);
|
|
}, 8000);
|
|
|
|
ws.on('open', () => {
|
|
// Send cron run RPC
|
|
const msg = JSON.stringify({
|
|
type: 'rpc',
|
|
id: Date.now().toString(),
|
|
method: 'cron.run',
|
|
params: { jobId: JOB_ID }
|
|
});
|
|
ws.send(msg);
|
|
});
|
|
|
|
ws.on('message', (data) => {
|
|
const parsed = JSON.parse(data.toString());
|
|
console.log('Response:', JSON.stringify(parsed));
|
|
clearTimeout(timeout);
|
|
ws.close();
|
|
process.exit(0);
|
|
});
|
|
|
|
ws.on('error', (err) => {
|
|
console.error('WebSocket error:', err.message);
|
|
clearTimeout(timeout);
|
|
process.exit(1);
|
|
});
|