Mercurial
view mrjunejune/test/inference_bridge_fake_sidecar.c @ 263:ee04e4e69fed
Add functional JRPG frame and tools
Add full-screen background_2 apertures, functional frame chrome, card-driven details, dual-window tools, live conversion workflows, and bounded cleanup for generated downloads.
Co-authored-by: Copilot <[email protected]>
| author | MrJuneJune <mrjunejune@users.noreply.github.com> |
|---|---|
| date | Thu, 06 Aug 2026 11:31:30 -0700 |
| parents | b401627fc49e |
| children | 056790c4fb0d |
line wrap: on
line source
#include "dowa/dowa.h" #include <stdio.h> #include <stdlib.h> #include <string.h> static const char *Get_String(Dowa_JSON_Entry *object, const char *key) { char *value = Dowa_JSON_Get_String(object, key); return value ? value : ""; } int main(void) { printf( "{\"type\":\"ready\",\"request_id\":null," "\"conversation_id\":null,\"status\":\"ok\"}\n"); fflush(stdout); char *line = NULL; size_t capacity = 0; while (getline(&line, &capacity, stdin) >= 0) { Dowa_Arena *p_arena = Dowa_Arena_Create(64 * 1024); Dowa_JSON_Value parsed = Dowa_JSON_Parse( line, (int32)strlen(line), p_arena); if (parsed.type != DOWA_JSON_OBJECT) { Dowa_Arena_Free(p_arena); continue; } Dowa_JSON_Entry *object = parsed.object_val; const char *command = Get_String(object, "command"); const char *request_id = Get_String(object, "request_id"); const char *conversation_id = Get_String(object, "conversation_id"); if (strcmp(command, "shutdown") == 0) { printf( "{\"type\":\"turn.done\",\"request_id\":\"%s\"," "\"conversation_id\":\"\"}\n", request_id); fflush(stdout); Dowa_Arena_Free(p_arena); break; } if (strcmp(command, "turn.start") == 0) { printf( "{\"type\":\"turn.accepted\",\"request_id\":\"%s\"," "\"conversation_id\":\"%s\"}\n", request_id, conversation_id); printf( "{\"type\":\"tool.started\",\"request_id\":\"%s\"," "\"conversation_id\":\"%s\"," "\"tool\":{\"name\":\"mock-search\"}}\n", request_id, conversation_id); printf( "{\"type\":\"assistant.delta\",\"request_id\":\"%s\"," "\"conversation_id\":\"%s\"," "\"delta\":\"hello \\\"traveler\\\"\\\\path\"}\n", request_id, conversation_id); printf( "{\"type\":\"assistant.completed\",\"request_id\":\"%s\"," "\"conversation_id\":\"%s\"," "\"content\":\"hello traveler\"}\n", request_id, conversation_id); printf( "{\"type\":\"assistant.usage\",\"request_id\":\"%s\"," "\"conversation_id\":\"%s\"," "\"usage\":{\"input_tokens\":7,\"output_tokens\":3}}\n", request_id, conversation_id); printf( "{\"type\":\"turn.done\",\"request_id\":\"%s\"," "\"conversation_id\":\"%s\"}\n", request_id, conversation_id); fflush(stdout); } Dowa_Arena_Free(p_arena); } free(line); return 0; }