Lines 71-111javascript
71 promptFileFlag: process.env.SYNCEFFORTS_AGENT_PROMPT_FILE_FLAG || '--prompt-file',
72 argFlag: process.env.SYNCEFFORTS_AGENT_PROMPT_ARG_FLAG || '-p',
75const adapter = ADAPTERS[AGENT] || ADAPTERS.claude
77const log = (m) => console.log(`[runner ${new Date().toISOString().slice(11, 19)}] ${m}`)
78const isImplement = (job) => job.type === 'implement'
79const isRadar = (job) => job.type === 'radar'
80let lastHead = '' // for auto-Radar: the commit HEAD we last saw
81let lastBlockMsg = '' // dedup for claim-blocked (limit/lease) log lines
83// Pull a JSON object out of an LLM reply (handles surrounding prose / fences).
84function extractJson(s) {
85 const a = s.indexOf('{'), b = s.lastIndexOf('}')
86 if (a < 0 || b <= a) return null
87 try { return JSON.parse(s.slice(a, b + 1)) } catch { return null }
89const SEV_RANK = { advisory: 'low', warning: 'medium', blocking: 'high' }
91async function api(method, path, body) {
92 const res = await fetch(API + path, { method, headers: { 'x-api-key': KEY, 'content-type': 'application/json' }, body: body ? JSON.stringify(body) : undefined })
93 const json = await res.json().catch(() => ({}))
94 return { ok: res.ok, status: res.status, json }
97// Run a command, capture stdout; resolve '' on error (git may not be present / not a repo).
98function sh(cmd, args, cwd) {
99 return new Promise((resolve) => {
100 const cp = spawn(cmd, args, { cwd, shell: WIN })
101 let out = ''
HighCommand Output Exfiltration
Source combines command execution, command-output handling, and outbound requests; review data flow before blocking.
runner.mjsView on unpkg · L91 102 cp.stdout.on('data', (d) => (out += d))
103 cp.on('error', () => resolve(''))
104 cp.on('close', () => resolve(out.trim()))
107const git = (args) => sh('git', args, REPO)
109// Render a job's chat thread (falls back to the single prompt for pre-thread jobs).
110function conversation(job) {
111 const msgs = Array.isArray(job.messages) && job.messages.length ? job.messages : [{ role: 'user', content: job.prompt || '' }]