#ifndef MM_TOOL_H #define MM_TOOL_H #include "ctl.h" #include #ifdef __cplusplus extern "C" { #endif /* * Streaming CST scanner for MiniMax native tool XML: * * * * README.md * * * * Also accepts the dialect seen in the wild: * * invoke read_file * ./README.md * * * Confirmation: nothing executes until . */ typedef void (*mm_on_event_fn)(const ctl_event_t *ev, void *userdata); typedef struct mm_scan mm_scan_t; mm_scan_t *mm_scan_create(mm_on_event_fn on_event, void *userdata); void mm_scan_destroy(mm_scan_t *s); void mm_scan_reset(mm_scan_t *s); /* Feed bytes. Emits TEXT for confirmed non-tool regions and CALL_* for * completed tool blocks. Incomplete tool blocks stay pending. */ int mm_scan_feed(mm_scan_t *s, const char *data, size_t len); /* Flush: incomplete open tool block => emit remaining as TEXT (no execute). */ int mm_scan_finish(mm_scan_t *s); size_t mm_scan_pending(const mm_scan_t *s); #ifdef __cplusplus } #endif #endif