41 lines
1.1 KiB
C
41 lines
1.1 KiB
C
/*
|
|
* agent_tools.h — tool dispatch for agent browser automation
|
|
*
|
|
* Receives a JSON tool request and dispatches it to the appropriate
|
|
* tool implementation. Returns a JSON response.
|
|
*/
|
|
|
|
#ifndef AGENT_TOOLS_H
|
|
#define AGENT_TOOLS_H
|
|
|
|
#include "cjson/cJSON.h"
|
|
|
|
#include <libsoup/soup.h>
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
/*
|
|
* Process a tool request JSON and return response JSON.
|
|
* The caller frees the returned cJSON*.
|
|
*
|
|
* If the tool needs async JS evaluation, the response is sent directly
|
|
* through the WebSocket connection and this function returns NULL.
|
|
* Otherwise, the response is returned synchronously.
|
|
*
|
|
* conn: the WebSocket connection to send async responses through
|
|
* (may be NULL for testing without a real connection)
|
|
*
|
|
* Request format: {"id":1,"tool":"snapshot","params":{...}}
|
|
* Response format: {"id":1,"success":true,"data":{...}}
|
|
* or: {"id":1,"success":false,"error":{"code":"...","message":"..."}}
|
|
*/
|
|
cJSON *agent_tools_dispatch(cJSON *request, SoupWebsocketConnection *conn);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif /* AGENT_TOOLS_H */
|