mirror of
https://github.com/logos-co/logos-protocol.git
synced 2026-08-31 14:01:14 +00:00
* Extract the Logos protocol layer from logos-cpp-sdk
Transports (plain TCP/TLS, qt_local, qt_remote/QRO, mock), token manager,
consumer core (LogosAPIClient/LogosAPIConsumer incl. the capability
auto-requestModule flow), ModuleProxy, the abstract LogosProviderObject
interface, and the canonical QVariant<->JSON conversion — now behind the
language-neutral lp_* C ABI (logos_protocol.h) carrying the protocol
semver (LOGOS_PROTOCOL_VERSION_*, lp_protocol_version()).
Bytes crossing the ABI use the lossless {"_bytes": base64url} tagging
(NUL-safe), matching the plain wire encoding.
Provider lp_* surface is compiled groundwork; serving lands with module
authoring.
* consumer: typed requestModule for the capability flow
Port of logos-cpp-sdk master f5a127dd ('use updated capability module',
cpp-sdk#85, Iuri Matias) — the touched files (logos_api_client.cpp,
logos_api_consumer.{h,cpp}) moved into this repo in the P1 extraction.
The capability auto-requestModule path now calls a typed std::string
helper on the consumer (which acquires the capability object directly)
instead of a stringly invokeRemoteMethod round-trip. 111/111 tests.
45 lines
1.8 KiB
C++
45 lines
1.8 KiB
C++
#ifndef LOGOS_TRANSPORT_CONFIG_JSON_H
|
|
#define LOGOS_TRANSPORT_CONFIG_JSON_H
|
|
|
|
#include "logos_transport_config.h"
|
|
|
|
#include <string>
|
|
|
|
// JSON (de)serialization for LogosTransportSet — used to pass per-module
|
|
// transport configuration across the parent → child subprocess boundary
|
|
// when the daemon launches `logos_host_qt` for capability_module (and
|
|
// any other module that needs a non-default transport set). Kept
|
|
// separate from logos_transport_config.h so consumers that only want
|
|
// the value type don't pay for the JSON parse / nlohmann include.
|
|
//
|
|
// Wire shape mirrors daemon.json's per-module transport list:
|
|
// [
|
|
// {"protocol": "local"},
|
|
// {"protocol": "tcp", "host": "127.0.0.1", "port": 6001, "codec": "json"},
|
|
// {"protocol": "tcp_ssl", "host": "0.0.0.0", "port": 6443,
|
|
// "codec": "cbor", "ca_file": "/p/ca", "cert_file": "/p/c",
|
|
// "key_file": "/p/k", "verify_peer": true}
|
|
// ]
|
|
//
|
|
// Cert/key paths *are* included on the wire here (unlike the on-disk
|
|
// daemon.json connection file): this serialization is for the parent
|
|
// telling the child "here's the cert you should bind your TLS
|
|
// listener with", which is the one place those paths legitimately
|
|
// need to flow over IPC.
|
|
|
|
namespace logos {
|
|
|
|
// Serialize a LogosTransportSet to a single-line JSON string suitable
|
|
// for passing as a CLI argument or environment variable to a child
|
|
// process. Returns "[]" for an empty set.
|
|
std::string transportSetToJsonString(const LogosTransportSet& set);
|
|
|
|
// Inverse of transportSetToJsonString. Returns an empty set on parse
|
|
// error (and leaves diagnostics to the caller — pass through the
|
|
// command-line parser's existing error machinery).
|
|
LogosTransportSet transportSetFromJsonString(const std::string& json);
|
|
|
|
} // namespace logos
|
|
|
|
#endif // LOGOS_TRANSPORT_CONFIG_JSON_H
|