A Session with listen = true (the default) now listens on 127.0.0.1 with the ALPN crafter-debug/1 and writes its discovery record (port, token, protocol, source id, client path), which goes first when it ends. One request per stream the client opens: the request and a FIN in, zero or more stream lines and then the reply and a FIN out, one JSON object per line. It holds no thread while nothing arrives. Crafter.Network delivers a new stream on the pool, its bytes on msquic's worker through OnRecieve, and replies leave through SendAsync, which never waits. The handler, which takes the session's mutex, runs on a pool task rather than inside the stream's callback, so no msquic worker ever waits on the session, and the session's threads only send, which Network allows under any lock. Stream wrappers are let go outside every lock their callbacks take. The rules head the implementation. Limits: a request over 1 MiB is answered with an error, not buffered, and a log follower more than 8 MiB behind is reset. quit --force exits 200 ms after its reply was taken, from a thread of its own, since "sent" means msquic has the bytes, not that they left. A client killed without closing is let go at the 10 s idle timeout. The Session refuses a pool without a worker: Network hands it new streams there, and with Start(1) nothing would run them. The partition exports nothing, so an app's view of the module is unchanged and it does not see Crafter.Network's types. Crafter.Network comes from forgejo, unpinned, with the args unchanged; --local takes ../Crafter.Network, and $CRAFTER_DEBUG_NETWORK any project.cpp, for the branch the callback API is on until it lands. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
24 lines
881 B
C++
24 lines
881 B
C++
// SPDX-License-Identifier: LGPL-3.0-only
|
|
// SPDX-FileCopyrightText: Copyright (C) 2026 Catcrafts®
|
|
|
|
// Runtime debugging for AI agents: what an app imports. Commands, watches
|
|
// and samples (:Registry), the timeline with Log, Check and Emit
|
|
// (:Timeline), the conditions waits and pauses use (:Condition), and the
|
|
// session that serves them with Pump, Advance and pause control (:Session),
|
|
// over the core shared with the client.
|
|
export module Crafter.Debug;
|
|
export import Crafter.Debug.Core;
|
|
export import :Registry;
|
|
export import :Timeline;
|
|
export import :Condition;
|
|
export import :Session;
|
|
// Exports nothing: the session's QUIC end, here only because every
|
|
// interface partition is the primary interface's to export.
|
|
export import :Transport;
|
|
import std;
|
|
|
|
export namespace Crafter::Debug {
|
|
constexpr std::string_view Version() {
|
|
return libraryVersion;
|
|
}
|
|
}
|