Minimalist agentic harness in C
Something went wrong. Try again.
12345678910111213141516171819202122232425262728293031323334353637383940#pragma once
#include "lib.h"#include "str.h"#include <curl/curl.h>
// Wrapper around curl objects with the same lifetime to make managing their lifecycle easier.typedef struct httpClient { CURL* curl; struct curl_slist* headers_list; str base_url; str bearer;} httpClient;
typedef struct httpMeta { u64 status;} httpMeta;
typedef struct httpResponse { httpMeta meta; stromboni body;} httpResponse;typedef RESULT(httpResponse) result_httpResponse;
typedef struct httpSink { bool (*write)(void* ctx, str chunk); void* ctx;} httpSink;
#define client_setopt(httpClient, option, parameter) curl_easy_setopt((httpClient).curl, option, parameter)
RESULT(httpClient) httpClientNew(str base_url, str bearer);[[gnu::format(printf, 2, 3)]]error_t httpClientAddHeaderf(httpClient* client, const char* fmt, ...);error_t httpClientAddHeader(httpClient* client, str header);
result_httpResponse httpClientPost(httpClient client, str path, str body);result_httpResponse httpClientGet(httpClient client, str path);
void httpClientFree(httpClient* client);