summaryrefslogtreecommitdiff
path: root/libpanto-c/include/panto.h
diff options
context:
space:
mode:
Diffstat (limited to 'libpanto-c/include/panto.h')
-rw-r--r--libpanto-c/include/panto.h13
1 files changed, 11 insertions, 2 deletions
diff --git a/libpanto-c/include/panto.h b/libpanto-c/include/panto.h
index 3b4a22a..c79e77c 100644
--- a/libpanto-c/include/panto.h
+++ b/libpanto-c/include/panto.h
@@ -50,7 +50,11 @@ typedef struct { PantoContentBlockTag block_type; size_t index; } PantoBlockStar
typedef struct { size_t index; PantoSlice id, name; } PantoToolDetails;
typedef struct { size_t index; PantoSlice delta; } PantoContentDelta;
typedef struct { size_t index; PantoContentBlockTag block_type; } PantoBlockComplete;
-typedef struct { bool has_usage; PantoUsage usage; } PantoMessageComplete;
+/* One assistant message finished streaming. `message_index` indexes the
+ * agent's live conversation (`panto_agent_conversation`), whose tail is this
+ * message when the event is delivered; fetch its `block_count` blocks from
+ * there for full content. `usage` is the wire-reported token usage. */
+typedef struct { PantoMessageRole role; size_t message_index; size_t block_count; bool has_usage; PantoUsage usage; } PantoMessageComplete;
typedef struct { bool compacted; size_t kept_turns; size_t summarized_messages; } PantoCompactionResult;
typedef struct { size_t attempt, max_attempts; uint64_t delay_ms; PantoSlice error_name; bool has_status_code; uint16_t status_code; bool has_retry_after_ms; uint64_t retry_after_ms; PantoSlice message; bool compaction; } PantoProviderRetry;
typedef struct { size_t count; } PantoToolDispatchStart;
@@ -181,7 +185,12 @@ PANTO_EXPORT PantoStatus panto_agent_set_config(PantoAgent *agent, const PantoCo
PANTO_EXPORT PantoStatus panto_agent_add_system_message(PantoAgent *agent, const char *text);
PANTO_EXPORT PantoStatus panto_agent_set_system_prompt(PantoAgent *agent, const char *text);
PANTO_EXPORT PantoStatus panto_agent_compact(PantoAgent *agent, const char *override_system_prompt, const char *extra_instructions, PantoCompactionResult *out);
-PANTO_EXPORT PantoStatus panto_agent_run(PantoAgent *agent, const char *user_text, PantoStream **out);
+/* Open a turn from a user-role message built with the PantoMessageBuilder API
+ * (the same builder used to rebuild persisted messages): one `add_text` block
+ * for a plain chat turn, or `add_tool_result` blocks to resume after the
+ * embedder handled tool calls itself. Consumes `user_message` (the builder is
+ * destroyed); do not reuse or destroy it afterwards. */
+PANTO_EXPORT PantoStatus panto_agent_run(PantoAgent *agent, PantoMessageBuilder *user_message, PantoStream **out);
/* Reset a failed stream back to its turn-open boundary so the caller can
* resume panto_stream_next() after changing the agent config (e.g. catch a
* terminal bad-request, swap the provider config, and retry the SAME turn