Commit Graph
66 Commits
Author SHA1 Message Date
Iuri Matias f5e9e46504 include authToken on requestModule 2026-06-12 17:27:40 -04:00
Iuri Matias f5a127dd11 use updated capability module (#85)
* use refactored capability module

use refactored capability module

remove unneded comments

* use cpp types
2026-06-11 15:44:37 -04:00
Dario LipicarandClaude Opus 4.8 bb6d87b6ec fix: parse declarations on same line as logos_events: / access specifier (#76) (#81)
* fix: parse declarations on same line as logos_events/access specifier (#76)

The impl header parser updated its section state and immediately broke out
of line processing when it matched `logos_events:` (or `public:`/`private:`),
discarding any declaration on the same physical line. This meant clang-format
/ prettier output like

    logos_events : void versionReady(const std::string &version);

silently dropped the event, while the newline-separated form parsed fine —
the same valid C++ was handled differently based on formatting.

Strip any leading section specifiers in a loop, updating the section state,
then let the remainder of the line fall through to the declaration parser.
Brace counting still happens once per physical line and blank-line doc-comment
reset is preserved.

Adds a regression test (SameLineSectionSpecifiers) with a fixture covering the
exact prettier form from the issue, a follow-on same-line event, the newline
form alongside it, and the symmetric inline `public:` method case.

Fixes #76

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* fix: attach doc comments to same-line logos_events/access-specifier decls

Address review feedback: the first pass cleared pendingDoc on every
specifier match, so a `///` comment above a collapsed
`logos_events : void foo();` did not attach to the event. In the collapsed
form there is nowhere else to put the doc comment, so this left
documentation formatting-dependent — the same bug class as #76, one level up.

Only clear pendingDoc for a *bare* specifier (a section boundary, matching
Qt `signals:` semantics); when a declaration shares the line, keep the
pending doc so the declaration parser attaches it.

Extend the fixture with a `///`-documented same-line event and assert the
description is captured.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-09 14:46:15 -03:00
Dario LipicarandClaude Opus 4.8 40e7631402 Marshal inter-module calls to the owner thread (#79)
* Marshal inter-module calls to the owner thread

Logos inter-module calls go over Qt Remote Objects, whose replicas only
work on the thread that created them (the module's main/event-loop thread).
A module that makes calls from a worker thread — e.g. an embedded HTTP
server serving /metrics — would otherwise hang on replica acquisition.

Make LogosAPIClient transparently marshal to its owner thread when called
off-thread (guarded so same-thread calls run directly with no overhead):
- LogosAPI::getClient creates the client/consumer/replicas on the owner thread
- LogosAPIClient::invokeRemoteMethod / requestObject / onEvent run there too

New header logos_thread_marshal.h (runOnOwnerThread). No new data members —
ABI-safe for statically-linked plugins.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* Add regression test for worker-thread inter-module calls

A provider records the thread its method runs on; a consumer calls it from
a worker thread via LogosAPIClient::invokeRemoteMethod. The call must execute
on the owner (main/event-loop) thread, not the worker thread.

Fails without the marshaling change (the call runs on the worker thread —
0x..d80d0 vs owner 0x..c53e0, "executed on the worker thread instead of the
owner thread"); passes with it (511/511).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* Address review: async marshaling, helper constraints, test ownership

- invokeRemoteMethodAsync now also marshals to the owner thread (non-blocking
  QueuedConnection) — the async path acquires a replica too, so calling it from
  a worker thread previously re-introduced the off-thread bug.
- runOnOwnerThread: document the return-type constraints (void or
  default-constructible, non-reference) and static_assert against references.
- test: declare the provider before its LogosAPI so the ModuleProxy (which
  holds a raw pointer to it) is torn down first — removes the leak and the
  inaccurate comment.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* doctest: call a module from a worker thread (HTTP server)

Adds cpp-sdk-worker-thread-http.test.yaml: builds a sensor_module callee and
an http_module caller that embeds a libmicrohttpd server, runs them in
logoscore, starts the server, and curls it. The HTTP handler calls
sensor_module.readTemperature() from the server's worker thread — which only
works because the SDK marshals the cross-module call onto the module's owner
thread. The module stays pure C++.

Wired into doctests/run.sh and the doctests CI workflow. Validated locally
(23/23 steps pass): `curl` returns `temperature 42`.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-08 16:47:24 -03:00
Iuri MatiasandCopilot Autofix powered by AI d142262436 Fix: F-007: add function to redact logged tokens (#80)
* add function to redact logged tokens

* Potential fix for pull request finding

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
2026-06-08 15:22:27 -04:00
Iuri MatiasandCopilot Autofix powered by AI 448aa9002c fix: F-002: only allow core and capability module to call informTokenModule (#78)
* only allow core and capability module to call informTokenModule

* Potential fix for pull request finding

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
2026-06-08 14:27:07 -04:00
Dario LipicarandClaude Opus 4.7 42a8b9ed5c feat: LIDL interface IR — --header-to-lidl frontend + --dep backend (#77)
* feat: LIDL as the interface IR — --header-to-lidl frontend + --dep backend

Make the generator pivot around LIDL so every binding flows source -> LIDL ->
C++ (and a future Rust module plugs into the same backend via Rust -> LIDL):

- --header-to-lidl <impl.h> --impl-class X --metadata m.json -o out.lidl: the
  standalone C++ frontend. Runs parseImplHeader -> lidlSerialize and emits ONLY
  the <name>.lidl contract (no Qt glue/dispatch), so a module can publish a
  cheap `lidl` artifact without compiling its plugin.
- --dep <name>=<lidl>: the LIDL backend for concrete dependencies. Reuses the
  interface-wrapper path with BindMode::Static, emitting the name-baked
  modules().<dep> wrapper from the dep's published LIDL. Deduped vs each other
  and vs --interface names.
- generateInterfaceWrappers gains a BindMode param (default Bound); --interface
  stays Bound, --dep is Static. parseInterfaceFlags generalized to
  parseSpecFlags(args, flag) for both --interface and --dep.

The umbrella already emits a `<dep>` member per metadata dependency, so no
umbrella change is needed.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* address review: strip leading '@' in --header-to-lidl paths; fix doc comment

- --header-to-lidl now strips a leading '@' from the header/metadata/output
  path args (matches legacy_main; some build drivers pass @/abs/path).
- Remove the stale "bound wrapper" doc comment above generateInterfaceWrappers
  (it now generates Static dep wrappers too via BindMode).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-06-08 11:43:10 -03:00
Dario LipicarandClaude Opus 4.7 eb71a1aa90 feat: dependency interfaces — SDK code generator (bound wrappers) (#74)
* feat: dependency interfaces — runtime-bound typed wrappers

Turn a declared "interface" (a .lidl file or a pure-C++ header with a
logos_events: block) into a BOUND client wrapper: the target module name
is a constructor argument instead of a baked-in literal, so one interface
can be bound to any satisfying module at runtime.

- generator_lib: new BindMode { Static, Bound }. In Bound mode the ctor
  takes (LogosAPI*, const QString& moduleName) and every invokeRemoteMethod*
  / ensureReplica routes through m_moduleName. Default Static leaves existing
  name-baked output byte-for-byte unchanged.
- legacy/main.cpp: repeatable --interface <name>=<path>[=<impl_class>] flag,
  consumed in --general-only. Parses .lidl via lidlParse and .h via
  parseImplHeader, emits the bound <name>_api.{h,cpp}, and adds
  bind_<name>(moduleName) factories (QString + std::string) to the
  LogosModules umbrella. Also self-resolves local interface_dependencies
  from metadata.json for non-nix builds.
- experimental/lidl_gen_client: same BindMode parity for the --lidl path.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* address review: dedup and validate --interface specs

A repeated --interface <name>=... would emit duplicate #include and
bind_<name>(...) into logos_sdk.h and fail to compile; empty name/path were
silently accepted. Dedup the flag-derived specs by name and drop malformed
ones with an explanatory message on stderr. (Copilot review, PR #74.)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-06-05 20:44:43 -03:00
Iuri Matias 825b80aeee re-add token auth (#73) 2026-06-05 18:12:29 -04:00
Iuri Matias b7eb07efed add doctests (#75)
* add doctests

* add doctest for cross module call
2026-06-05 14:47:47 -04:00
Dario LipicarandClaude Opus 4.8 3bdd8858f5 handle reserved words in names/parameters correctly (#72)
* handle reserved words in names/parameters correctly

* parser: accept reserved words as dependency names too

Addresses review feedback on the depends list: parseMetadata() still
hard-required LidlToken::Ident for each entry, so a dependency named after a
keyword (e.g. `version`) would fail to parse even though lidlSerialize()
emits it unquoted. Use atName() there too, consistent with the
contextual-keyword rule applied to the other name positions. Adds a
KeywordAsDependencyName regression test.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-04 20:14:15 -03:00
Dario LipicarandClaude Opus 4.8 7b62ac2017 Per-event documentation + getPluginEvents introspection (#71)
* Add per-event documentation + getPluginEvents introspection

Mirror the per-method documentation pipeline for events. Events
(declared in a universal module's logos_events: section) now carry a
description parsed from their /// doc comments, and are introspectable
at runtime via a new getPluginEvents framework call.

- lidl_ast: EventDecl gains a description field.
- impl_header_parser: capture the event's doc comment (previously
  discarded) and an optional metadata.json events[].description.
- lidl_gen_provider: generated universal provider emits
  getEvents() override, mirroring getMethods() (name/signature/
  parameters/description; no returnType/isInvokable — events are void).
- logos_provider_object: default-empty virtual getEvents() so the
  legacy provider path and QtProviderObject inherit empty.
- module_proxy / qt_provider_object: intercept getPluginEvents next to
  the getPluginMethods special-case.
- docs: spec + README event-documentation notes.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* Add unit tests for event documentation + getEvents generation

Address review feedback (#71): cover the event-introspection paths that
previously only had method-side tests.

- impl_header_parser test: assert metadata.json events[].description is
  parsed; new documented_events fixture asserts `///` doc-comment
  capture on a logos_events: block (multi-line joined with \n,
  adjacent-only, plain // ignored).
- lidl_gen_provider test: assert the generated dispatch contains
  getEvents() emitting each event's name/signature/parameters and an
  escaped description, and that events carry no returnType/isInvokable.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* Fold event introspection into getMethods() to keep the provider ABI stable

The previous approach added a getEvents() virtual to LogosProviderObject,
which inserted a new vtable slot and shifted every later slot — an ABI
break that would misdispatch virtual calls whenever an old and new
host/module were mixed across the in-process plugin boundary.

Instead, report events INSIDE the existing getMethods() call: it now
returns the module's whole interface, with each entry tagged
type "method" or "event" (events omit returnType/isInvokable). The
provider vtable is therefore byte-for-byte unchanged, so old/new hosts
and modules stay binary-compatible — a new host reading an old module
sees no event entries (zero events), and an old host reading a new
module just ignores the "type" field (cosmetic). An entry with no
"type" is treated as a method.

- logos_provider_object.h: remove the getEvents() virtual; document that
  getMethods() carries both, and why.
- generator (lidl_gen_provider): emit events as type "event" entries
  inside getMethods(); tag methods type "method"; no getEvents() output.
- module_proxy / qt_provider_object: getPluginMethods()/getPluginEvents()
  are now type-filtered views of getMethods(), plus a new
  getPluginInterface() returning the whole list. (These are name-
  dispatched Q_INVOKABLEs, not vtable surface — adding them is safe.)
- tests: generator asserts events fold into getMethods() tagged "event";
  ModuleProxy asserts the three filtered views; parser tests unchanged.
- docs: spec/project/docs/README updated, incl. an ABI rationale note.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-04 17:06:12 -03:00
Dario LipicarandClaude Opus 4.8 760916e97b Parse method doc comments into per-method description (#70)
* parse adjacent method comments to populate description

* preserve line breaks in method descriptions

Join doc-comment lines with newlines instead of spaces (markers stripped,
leading/trailing blank lines dropped, interior blanks kept), and escape \n
when emitting the description into the generated getMethods(). Both codegen
paths updated; docs corrected.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* don't count braces inside comment lines (impl-header parser)

A brace in a doc/line comment (e.g. `/// returns { ... }`) no longer affects
class-scope tracking, which previously could make the parser think the class
ended early and drop later declarations. Addresses review feedback on #70.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-04 11:38:27 -03:00
Dario Lipicar c71089abe9 remove legacy emitEvent (#69) tutorial-v3 2026-06-02 15:54:54 -03:00
Igor SirotinandClaude Opus 4.7 d77c3dd616 fix: marshal provider events onto the source thread (#68)
* fix: marshal provider events onto the source thread

ModuleProxy's event listener emitted eventResponse directly on whatever thread
the module fired the event from (its worker/FFI thread). QtRemoteObjects then
serialized and sent the event from that foreign thread, racing the source
socket against a method reply being sent from the source thread, which silently
dropped the reply.

This is why a method that emits an event mid-call never returns to the caller
(e.g. delivery_module start(), which emits connectionStateChanged as the node
connects) while a method that emits nothing (createNode) returns fine.

Marshal the emission onto the ModuleProxy's own thread via a queued invocation
so events and method replies are serialized on the single thread
QtRemoteObjects expects to own the source.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* docs: generalize the threading comment

* fix: use AutoConnection so same-thread emits stay synchronous

QueuedConnection deferred every emission, breaking same-thread callers that
emit-then-assert and crashing when a queued lambda outlived the object.
AutoConnection invokes synchronously when already on the source thread and only
queues cross-thread emissions (the actual fix); passing 'this' as context
cancels a queued call if the object is destroyed first.

---------

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-25 09:35:25 -04:00
Iuri Matias 4e20614cda add universal qt-free provider interface (#67)
add universal qt-free provider interface

address review
2026-05-22 17:44:07 -04:00
Iuri Matias c87f3437e3 add overloads supporting nlohmann::json as intermediate steps to remove qt (#66) 2026-05-22 16:08:24 -04:00
Iuri Matias 3eea564de1 overload with method that don't use QString (#65) 2026-05-21 15:37:50 -04:00
Iuri Matias e29ba9b185 overload with method that don't use QString (#64)
overload with method that don't use QString

overload with method that don't use QString

overload with method that don't use QString

overload with method that don't use QString
2026-05-21 14:04:25 -04:00
Dario Lipicar 8bdbd13848 Extend universal modules with module context (#61)
* extend universal modules with module context

* implement module calls and events for universal modules

* pr comments
2026-05-19 12:49:15 -03:00
Dario Lipicar 25c88f4d48 support non-local remote transports (#57)
* support non-local remote transports

* fix LogosResult

* allow getting client over specific transport

* fix ssl

* investiage ssl error

* pr comments

* allow transport set configuration on any module

* pr comments

* add docs

* pr comments

* propagate only non-qt dependencies

* restore ABI compatibility
tutorial-v2
2026-05-07 12:27:14 -03:00
Dario Lipicar ecd369d48b properly handle subscribers to all events (#56) 2026-04-22 15:31:20 -03:00
Iuri Matias f7c855b110 add logos result type (#55) 2026-04-21 09:38:37 -04:00
Iuri Matias 04b75c84b8 add setProperty without using qt type (#52) 2026-04-16 13:15:18 -04:00
Iuri Matias 1a0cb031db add overloards using cpp types to replace qt ones later (#51) 2026-04-16 12:41:17 -04:00
Iuri Matias 1468180b25 add support for new types (#50) 2026-04-13 13:29:26 -04:00
Dario Lipicar 2a21637e02 fix async call crash (#49)
* fix async call crash

* add regression test
2026-04-10 10:39:14 -04:00
Dario Lipicar 8b1cfadf09 make async method calls truly async (#48)
* make async method calls truly async

* PR comments
2026-04-09 11:37:51 -03:00
Iuri Matias d633575677 add IDL parser & generator (wip) (#33)
* add IDL parser & generator (wip)

* fix fixtures issues affecting tests

* fix fixtures issues affecting tests
tutorial-v1
2026-03-31 16:29:35 -04:00
Khushboo-dev-cppandDario Lipicar 38006e7240 add support for QVariantList and QVariantMap (#31) (#32)
Co-authored-by: Dario Lipicar <lipigl@gmail.com>
2026-03-31 14:02:35 +02:00
Dario Lipicar 01221559b7 add support for QVariantList and QVariantMap (#31) 2026-03-26 10:12:18 -03:00
Iuri MatiasandLogos Workspace 02baa918a8 remove proxy api (moved to logos-module-client) (#30)
Co-authored-by: Logos Workspace <logos@workspace.local>
2026-03-25 15:00:21 -04:00
Jakub c937eae156 chore: add missing MIT and Apache v2 licenses (#29)
Signed-off-by: Jakub Sokołowski <jakub@status.im>
2026-03-25 12:20:11 -04:00
Iuri MatiasandLogos Workspace 21f8fb43d3 abstract/move some of proxy api logic to cpp-sdk (#28)
Co-authored-by: Logos Workspace <logos@workspace.local>
2026-03-25 08:46:45 -04:00
Iuri Matias 39b0a9acce Add tests; CI (#27)
* add tests for cpp-generator and sdk

* add tests for new api, module_proxy and factories

* add CI tests

* add tests for a module definition
2026-03-24 10:14:17 -04:00
Iuri MatiasandLogos Workspace 4197ee1830 Finish Abstraction & Refactor (Ongoing) - part 1 (#25)
* refactor: abstract connection/transport; and clearly separate qt remote obj and qt local into separate implementations

* abstract qt remote registry

* add mock implementation; these serves to further test the abstraction but also useful for testing modules later

* use LogosObject instead of QObject

* abstract provider side

* updates to use new api

* re-add async api back

---------

Co-authored-by: Logos Workspace <logos@workspace.local>
2026-03-23 11:45:25 -04:00
Iuri Matias 4b66dac015 follow logos-nix for nix packages (#26) 2026-03-19 17:39:45 -04:00
Khushboo-dev-cpp 128180971c feat: add auto support for async calls (#21) 2026-03-19 15:57:08 -04:00
Eric a4bd66cd6e add Logos instance id to registry url (#20)
Allows multiple Logos core instances to run on the same machine by giving appending a unique instance identifier to each registry url.
2026-03-16 10:43:39 -04:00
Arnaud 95f763b48d Add bool argument support (#17) 2026-02-25 09:16:00 -05:00
Vedran 5c49a0d6a4 fix: redact sensitive data from debug logs (#18)
Remove logging of method arguments. It may contain private keys,
DB passwords, auth tokens, and token values. Log only method
names and argument counts for debugging.

- https://github.com/status-im/infra-logos/issues/1
2026-02-25 09:15:39 -05:00
Arnaud 4fdf157120 feat: LogosResult (#14)
* Add LogosResult

* Add documentation for complex types

* Add get type util function

* Add more shorthand functions

* Add bool support

* Provide more shorthand functions

* Throw exception on bad access

* Fix typo in doc
2026-02-25 09:13:43 -05:00
Iuri Matias 30ef7986f4 Merge pull request #13 from logos-co/remove_unused
remove unused files
2026-02-03 10:36:37 -05:00
Iuri Matias 63bcab1b42 remove unused files 2026-02-03 10:36:07 -05:00
Iuri Matias f649e0365c Merge pull request #10 from logos-co/feat/add-qstringlist-as-argument
feat: add QStringList, QByteArray and QUrl arguments
2026-02-03 08:59:28 -05:00
Arnaud b7a556483a Add QUrl argument 2026-02-03 10:57:53 +04:00
Arnaud d4e6255a28 Add QByteArray arg 2026-02-03 07:46:11 +04:00
Arnaud c61215a250 Add QStringList argument 2026-02-02 10:01:58 +04:00
Iuri Matias 32f1d7080d Merge pull request #8 from logos-co/docs
add docs
2026-01-06 13:32:09 -05:00
Iuri Matias 19e0c4f239 add docs 2026-01-06 13:31:25 -05:00