48 lines
1.4 KiB
C
48 lines
1.4 KiB
C
/*
|
|
* agent_chat.h — high-level entry point for the embedded agent chat
|
|
*
|
|
* Bridges the URL bar to the agent loop and the chat UI page. When the
|
|
* user types "; <message>" in the URL bar, tab_manager calls
|
|
* agent_chat_route_input(), which navigates the active tab to
|
|
* sovereign://agents/chat and kicks off the agent loop.
|
|
*/
|
|
|
|
#ifndef AGENT_CHAT_H
|
|
#define AGENT_CHAT_H
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
/*
|
|
* Route a user message from the URL bar to the embedded agent.
|
|
* Called when the user types "; <message>" in the URL bar.
|
|
*
|
|
* Sidebar-aware behavior:
|
|
* 1. If the agent sidebar is not visible, toggle it on (this opens the
|
|
* chat page in a narrow sidebar alongside the current web page).
|
|
* 2. If message is non-NULL and non-empty, starts the agent loop with
|
|
* that message. The sidebar webview polls for messages and shows
|
|
* the agent's responses.
|
|
* 3. If message is NULL or empty, just opens the sidebar (no message
|
|
* sent).
|
|
*
|
|
* This lets the user chat about the page they're viewing without
|
|
* navigating away from it.
|
|
*
|
|
* Returns 0 on success, -1 on error.
|
|
*/
|
|
int agent_chat_route_input(const char *message);
|
|
|
|
/*
|
|
* Get the current session ID (for the chat UI to use).
|
|
* Returns NULL if no session exists. The string is owned by the chat store.
|
|
*/
|
|
const char *agent_chat_session_id(void);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif /* AGENT_CHAT_H */
|