Files
CST-agent/include/mm_tool.h
T
WHCandCursor 1f1fcba7ad Initial CST-Agent: portable Linux/Termux/Windows coding agent.
Vendored sashidown, OpenAI-compatible env (OPENAI_*), and bootstrap scripts.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 22:42:32 +08:00

52 lines
1.2 KiB
C

#ifndef MM_TOOL_H
#define MM_TOOL_H
#include "ctl.h"
#include <stddef.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
* Streaming CST scanner for MiniMax native tool XML:
*
* <minimax:tool_call>
* <invoke name="read_file">
* <parameter name="path">README.md</parameter>
* </invoke>
* </minimax:tool_call>
*
* Also accepts the dialect seen in the wild:
* <minimax:tool_call>
* invoke read_file
* <arg name="path">./README.md</arg>
* </minimax:tool_call>
*
* Confirmation: nothing executes until </minimax:tool_call>.
*/
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