(acc: RetoolAccount)
| 85 | // Retool API helpers |
| 86 | // ---------------------------------------------------------------------------- |
| 87 | async function retoolQueryAgents(acc: RetoolAccount) { |
| 88 | const url = `https://${acc.domain_name}/api/agents`; |
| 89 | const resp = await fetch(url, { |
| 90 | headers: { |
| 91 | "x-xsrf-token": acc.x_xsrf_token, |
| 92 | "Cookie": `accessToken=${acc.accessToken}`, |
| 93 | "User-Agent": "Rever-Deno-Port/1.0", |
| 94 | "Accept": "application/json", |
| 95 | }, |
| 96 | }); |
| 97 | if (!resp.ok) throw new Error(`Agent query failed ${resp.status}`); |
| 98 | const data = await resp.json(); |
| 99 | return data.agents as any[]; |
| 100 | } |
| 101 | async function retoolGetThreadId(acc: RetoolAccount, agentId: string) { |
| 102 | const url = `https://${acc.domain_name}/api/agents/${agentId}/threads`; |
| 103 | const resp = await fetch(url, { |
no test coverage detected