From 6d725a9e35c3086f61cb6579d2840f5a09be450a Mon Sep 17 00:00:00 2001 From: t Date: Thu, 11 Jun 2026 11:16:25 -0600 Subject: expand libpanto-go and -c to the full libpanto API surface --- libpanto-c/include/panto.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'libpanto-c/include') diff --git a/libpanto-c/include/panto.h b/libpanto-c/include/panto.h index 0772e6e..94ddcb9 100644 --- a/libpanto-c/include/panto.h +++ b/libpanto-c/include/panto.h @@ -119,6 +119,21 @@ PANTO_EXPORT void panto_stream_destroy(PantoStream *stream); PANTO_EXPORT PantoNextStatus panto_stream_next(PantoStream *stream, PantoEvent *out); PANTO_EXPORT void panto_event_free(PantoEvent *event); +/* Go/callback-oriented tool ABI. */ +typedef struct { PantoSlice name, description, schema_json; } PantoToolDecl; +typedef struct { PantoSlice media_type; bool has_media_type; PantoSlice data; } PantoMediaPart; +typedef enum { PANTO_RESULT_TEXT = 0, PANTO_RESULT_MEDIA = 1 } PantoResultPartTag; +typedef struct { PantoResultPartTag tag; union { PantoSlice text; PantoMediaPart media; } data; } PantoResultPart; +typedef struct { PantoResultPart *ptr; size_t len; } PantoResultParts; +typedef struct { PantoSlice tool_name, input; } PantoToolCall; +typedef struct { bool ok; PantoResultParts parts; PantoSlice error; } PantoToolCallResult; +typedef PantoStatus (*PantoToolInvokeFn)(void *ctx, PantoSlice input, PantoResultParts *out); +typedef PantoStatus (*PantoToolSourceInvokeBatchFn)(void *ctx, const PantoToolCall *calls, PantoToolCallResult *results, size_t len); +typedef void (*PantoToolDestroyFn)(void *ctx); +PANTO_EXPORT PantoStatus panto_agent_register_tool(PantoAgent *agent, PantoToolDecl decl, void *ctx, PantoToolInvokeFn invoke, PantoToolDestroyFn destroy); +PANTO_EXPORT PantoStatus panto_agent_register_tool_source(PantoAgent *agent, PantoSlice name, const PantoToolDecl *decls, size_t len, void *ctx, PantoToolSourceInvokeBatchFn invoke_batch, PantoToolDestroyFn destroy); +PANTO_EXPORT PantoResultParts panto_result_parts_text(const char *text); +PANTO_EXPORT void panto_result_parts_destroy(PantoResultParts parts); #ifdef __cplusplus } #endif -- cgit v1.3