Mercurial
view mrjunejune/inference_bridge.h @ 267:a78f5986011f
discover bundled production runtimes
Locate Bazel-packaged Copilot and Python binaries by stable suffix instead of hardcoding an external repository prefix.
Co-authored-by: Copilot <[email protected]>
| author | MrJuneJune <me@mrjunejune.com> |
|---|---|
| date | Fri, 07 Aug 2026 12:58:55 -0700 |
| parents | 056790c4fb0d |
| children |
line wrap: on
line source
#ifndef MRJUNEJUNE_INFERENCE_BRIDGE_H #define MRJUNEJUNE_INFERENCE_BRIDGE_H #include "dowa/dowa.h" typedef struct Inference_Bridge Inference_Bridge; #define INFERENCE_BRIDGE_HISTORY_MAX 20 /* A single prior-turn entry for transcript rehydration. */ typedef struct { const char *role; /* must be "user" or "assistant"; never NULL */ const char *content; /* non-NULL; may be empty string */ } Inference_Bridge_History_Message; typedef enum { INFERENCE_PROMPT_PROFILE_PUBLIC_VISITOR = 0, INFERENCE_PROMPT_PROFILE_INVITED_FRIEND = 1, INFERENCE_PROMPT_PROFILE_JUNE_ADMIN = 2, } Inference_Prompt_Profile; typedef struct { const char *type; const char *request_id; const char *conversation_id; const char *delta; const char *content; const char *error_code; const char *error_message; const char *raw_json; size_t raw_json_length; int64 input_tokens; int64 output_tokens; boolean failed; boolean aborted; } Inference_Event; typedef void (*Inference_Event_Handler)( const Inference_Event *p_event, void *p_user_data); Inference_Bridge *Inference_Bridge_Create( const char *sidecar_path, const char *copilot_cli_path, Inference_Event_Handler handler, void *p_user_data); boolean Inference_Bridge_Start(Inference_Bridge *p_bridge); boolean Inference_Bridge_Is_Ready(const Inference_Bridge *p_bridge); /* * Start an inference turn. * * p_history / history_count: optional bounded history for transcript * rehydration. Pass NULL / 0 if no prior context is available. * history_count must not exceed INFERENCE_BRIDGE_HISTORY_MAX (20). * Every entry must have role "user" or "assistant" and a non-NULL content. * Returns FALSE and writes nothing if any validation constraint is violated. */ boolean Inference_Bridge_Start_Turn( Inference_Bridge *p_bridge, const char *request_id, const char *conversation_id, const char *prompt, Inference_Prompt_Profile prompt_profile, uint32 prompt_version, uint32 knowledge_version, const Inference_Bridge_History_Message *p_history, uint32 history_count); boolean Inference_Bridge_Abort_Turn( Inference_Bridge *p_bridge, const char *request_id, const char *conversation_id); boolean Inference_Bridge_Delete_Conversation( Inference_Bridge *p_bridge, const char *request_id, const char *conversation_id); void Inference_Bridge_Destroy(Inference_Bridge *p_bridge); #endif