TraceMaker
C++ API of the engine
Loading...
Searching...
No Matches
transport.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: GPL-3.0-or-later
2#pragma once
3// The two ways to talk to a Session (design doc 19 ยง6). Both call Session::call, so they cannot differ.
4//
5// MCP over standard input and output: JSON-RPC 2.0, one message per line, `initialize`, `tools/list`, `tools/call`, `ping`, and the
6// `notifications/initialized` notification. Any MCP client can be the agent. Standard output carries protocol messages only.
7// JSON lines: one request {"tool": NAME, "args": {...}} per line, one response per line (the tool's result, or {"error": ...}).
8#include <istream>
9#include <ostream>
10
11#include "session/session.hpp"
12
13namespace tmk::session {
14
15inline constexpr std::size_t kMaxRequestBytes = 1 << 20; // a line longer than this is refused (the rest of the line is skipped)
16
17// Return when the input ends. Never throw for a bad request: it is answered.
18void run_mcp(Session& s, std::istream& in, std::ostream& out);
19void run_jsonl(Session& s, std::istream& in, std::ostream& out);
20
21} // namespace tmk::session
void run_jsonl(Session &s, std::istream &in, std::ostream &out)
constexpr std::size_t kMaxRequestBytes
a line longer than this is refused (the rest of the line is skipped)
Definition transport.hpp:15
void run_mcp(Session &s, std::istream &in, std::ostream &out)
Return when the input ends. Never throw for a bad request: it is answered.
A board session an agent can drive (design doc 19, milestone M18).