Skip to content

Componentize logos delivery#148

Merged
jazzz merged 3 commits into
mainfrom
jazzz/componentize_logos_delivery
Jun 26, 2026
Merged

Componentize logos delivery#148
jazzz merged 3 commits into
mainfrom
jazzz/componentize_logos_delivery

Conversation

@jazzz

@jazzz jazzz commented Jun 24, 2026

Copy link
Copy Markdown
Collaborator

Problem

The embedded version of LogosDelivery is only available via chat-cli.

This:

  1. Makes it difficult to use the embedded version of logos-delivery in other projects.
  2. Complicates chat-cli with transport level concepts and complicated build steps.

Solution

  • Move the chat-cli/logos-delivery transport to components/EmbeddedP2pDeliveryService
  • Remove requirement for build.rs in consumers

Build Updates

  • extensions/components/build.rs — single source of truth: finds the lib (env override → nix auto-build), stamps an absolute install name (macOS install_name_tool, Linux patchelf --set-soname), emits the propagating link directives.
  • bin/chat-cli/build.rs — deleted.
  • extensions/components/src/lib.rs — export gated on logos_delivery to stay consistent with the module gate in delivery.rs, so the type is present exactly when the lib is available.

Consuming

EmbeddedP2pDeliveryService is available to applications via cargo import.

components = { ..., features = ["embedded_p2p_delivery"]}

@jazzz jazzz requested review from kaichaosun and osmaczko June 24, 2026 07:21
Comment thread bin/chat-cli/Cargo.toml Outdated
crossbeam-channel = { workspace = true }
logos-chat = { workspace = true }


Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change

Comment thread bin/chat-cli/src/main.rs
use components::{EmbeddedP2pDeliveryService, P2pConfig};

#[derive(Debug)]
struct P2pTransport(EmbeddedP2pDeliveryService);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[question] why wrap the EmbeddedP2pDeliveryService into P2pTransport, not use EmbeddedP2pDeliveryService and implement the traits directly on it?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The issue here is who is the owner of the Transport trait?

Transport trait is the result of the ChatClient being based on threaded model - it mandates that a DS uses a crossbeam queue to pass events across threads.

Given this requirement is unique to ChatClient, it doesn't quite make sense to force all DS's operate in this manner.

The approach is to use the newtype pattern to implement Transport where its needed. In the future this can be cleaned further, by building a blanket impl that runs the DS in a thread and captures output into a queue, so this does not require to be implemented.

@jazzz jazzz force-pushed the jazzz/componentize_logos_delivery branch 2 times, most recently from 4e280b5 to 8784a43 Compare June 24, 2026 13:41

@osmaczko osmaczko left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice cleanup 👍

jazzz added 2 commits June 26, 2026 09:20
Rename components

update deps

WIP

Remove requirement for build.rs in chat-cli

fix imports

update linux flake

Linter fixes

fix build in linux
@jazzz jazzz force-pushed the jazzz/componentize_logos_delivery branch from 8784a43 to c73eb90 Compare June 26, 2026 16:20
@jazzz jazzz merged commit 97eacc0 into main Jun 26, 2026
5 checks passed
@jazzz jazzz deleted the jazzz/componentize_logos_delivery branch June 26, 2026 17:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants