( client: ReturnType<typeof createApiClient>, clusterId: string, toolName: string, // eslint-disable-next-line @typescript-eslint/no-explicit-any input: any, )
| 307 | }; |
| 308 | |
| 309 | export const createAndPollJob = async ( |
| 310 | client: ReturnType<typeof createApiClient>, |
| 311 | clusterId: string, |
| 312 | toolName: string, |
| 313 | // eslint-disable-next-line @typescript-eslint/no-explicit-any |
| 314 | input: any, |
| 315 | ): Promise<{ |
| 316 | status: string; |
| 317 | result: string; |
| 318 | resultType: string; |
| 319 | }> => { |
| 320 | const createResult = await client.createJob({ |
| 321 | body: { |
| 322 | tool: toolName, |
| 323 | input, |
| 324 | }, |
| 325 | params: { clusterId }, |
| 326 | query: { |
| 327 | waitTime: 20, |
| 328 | }, |
| 329 | }); |
| 330 | |
| 331 | if (createResult.status !== 200) { |
| 332 | throw new AgentRPCError(`Failed to run tool: ${createResult.status}`); |
| 333 | } |
| 334 | |
| 335 | return pollForJobCompletion( |
| 336 | client, |
| 337 | clusterId, |
| 338 | createResult.body.id, |
| 339 | createResult.body.status, |
| 340 | createResult.body.result || "", |
| 341 | createResult.body.resultType || "rejection", |
| 342 | ); |
| 343 | }; |
no test coverage detected