Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 44 additions & 1 deletion pkgs/id/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 11 additions & 7 deletions pkgs/id/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,34 +16,35 @@ categories = ["command-line-utilities", "network-programming"]
# id-core sub-crate under crates/; this package is the workspace root.

[workspace]
members = ["crates/id-core", "crates/id-caps", "crates/id-store", "crates/id-events", "crates/id-groups", "crates/id-sync", "crates/id-worlds", "crates/id-directory", "crates/id-web", "crates/id-native-shell"]
members = ["crates/id-core", "crates/id-caps", "crates/id-store", "crates/id-events", "crates/id-groups", "crates/id-sync", "crates/id-worlds", "crates/id-directory", "crates/id-web", "crates/id-native-shell", "crates/id-cli"]
# The vendored crates stay OUT of the workspace: as path dependencies inside
# this directory Cargo would otherwise treat them as members, and a member's
# feature graph joins the lock resolve — p2panda-sync's `test_utils` feature
# forwards to `p2panda-store/test_utils`, whose `sqlite` feature pulls sqlx
# into Cargo.lock even though no build here enables it (see vendor/README.md).
exclude = ["vendor/p2panda-sync", "vendor/p2panda-encryption"]
default-members = [".", "crates/id-core", "crates/id-caps", "crates/id-store", "crates/id-events", "crates/id-groups", "crates/id-sync", "crates/id-worlds", "crates/id-directory", "crates/id-web"]
default-members = [".", "crates/id-core", "crates/id-caps", "crates/id-store", "crates/id-events", "crates/id-groups", "crates/id-sync", "crates/id-worlds", "crates/id-directory", "crates/id-web", "crates/id-cli"]

# =============================================================================
# Features
# =============================================================================

[features]
default = ["sandbox", "world"]
sandbox = ["world", "id-core/sandbox", "id-caps/sandbox", "id-worlds/sandbox"]
sandbox = ["world", "id-core/sandbox", "id-caps/sandbox", "id-worlds/sandbox", "id-cli/sandbox"]
world = [
"id-core/world",
"id-cli/world",
]
ssh = ["world", "id-worlds/ssh"]
ssh = ["world", "id-worlds/ssh", "id-cli/ssh"]
web = [
"world",
"dep:axum",
"dep:id-web",
"id-core/web",
"id-cli/web",
]
# Mainline DHT address lookup (P7.3, decision 15). Off in the default build; src/dht.rs decides per server.
dht = ["id-sync/dht"]
dht = ["id-sync/dht", "id-cli/dht"]
# Live-cluster binding for the currency PoC (#2289): the official TigerBeetle
# Rust client, pinned to the harness server version (harness.rs). Off by
# default so normal builds do not link the client native tb_client library.
Expand Down Expand Up @@ -76,6 +77,10 @@ id-worlds = { path = "crates/id-worlds", default-features = false }
# only the `web` feature links it, and src/lib.rs re-exports it as
# `id::web` under that feature.
id-web = { path = "crates/id-web", default-features = false, optional = true }
# Application layer extracted in step 7b of the crate split (#4411).
# Re-exported at their historical crate:: paths in src/lib.rs; the
# binary entry point (src/main.rs) stays in this package.
id-cli = { path = "crates/id-cli", default-features = false }
# Directory-family modules extracted in step 6b of the crate split
# (#4409). Re-exported at their historical crate:: paths in src/lib.rs.
id-directory = { path = "crates/id-directory", default-features = false }
Expand Down Expand Up @@ -132,7 +137,6 @@ unicode-segmentation = "1.13"
unicode-width = "0.2"

# Web feature dependencies (optional)
axum = { version = "0.8", features = ["ws", "multipart"], optional = true }
argon2 = "0.6"
chacha20poly1305 = "0.10"
zeroize = "1"
Expand Down
57 changes: 57 additions & 0 deletions pkgs/id/crates/id-cli/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
[package]
name = "id-cli"
version = "0.1.0"
edition = "2024"
rust-version = "1.96"
license = "MIT OR Apache-2.0"

[features]
default = ["sandbox", "world"]
world = ["id-core/world"]
sandbox = ["world", "id-core/sandbox", "id-caps/sandbox", "id-worlds/sandbox"]
ssh = ["world", "id-worlds/ssh"]
web = ["world", "id-core/web", "dep:id-web", "dep:axum"]
dht = ["id-sync/dht"]

[dependencies]
anyhow = "1"
id-caps = { path = "../id-caps", default-features = false }
id-core = { path = "../id-core", default-features = false }
id-directory = { path = "../id-directory", default-features = false }
id-events = { path = "../id-events", default-features = false }
id-groups = { path = "../id-groups", default-features = false }
id-store = { path = "../id-store", default-features = false }
id-sync = { path = "../id-sync", default-features = false }
id-web = { path = "../id-web", default-features = false, optional = true }
axum = { version = "0.8", features = ["ws", "multipart"], optional = true }
id-worlds = { path = "../id-worlds", default-features = false }
serde = { version = "1", features = ["derive"] }
serde_json = "1"
tokio = { version = "1", features = ["full"] }
tracing = "0.1"
blake3 = "1"
clap = { version = "4", features = ["derive", "env"] }
distributed-topic-tracker = "0.3"
ed25519-dalek = { version = "3", features = ["rand_core"] }
futures-lite = "2"
iroh = "1"
iroh-base = "1"
iroh-blobs = "0.103"
iroh-docs = "0.101"
iroh-gossip = { version = "0.101", features = ["net"] }
iroh-mdns-address-lookup = "0.6"
libc = "0.2"
p2panda-core = { git = "https://github.com/p2panda/p2panda", rev = "da80c05b95269926bf58121cf6a2d3dd5ca41dfc" }
postcard = { version = "1", features = ["alloc"] }
rand = "0.10"
rpassword = "7"
rustyline = "18"
tempfile = "3"
thiserror = "2"
toml = "1"
zeroize = "1"

[dev-dependencies]
id-core = { path = "../id-core", default-features = false, features = ["test-utils"] }
id-worlds = { path = "../id-worlds", default-features = false, features = ["test-utils"] }
proptest = "1.12"
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ use std::collections::BTreeMap;

use p2panda_core::Hash;

use crate::groups::Key;
use crate::tag_claims::Claim;
use crate::waiting::AuthorKey;
use id_events::groups::Key;
use id_store::tag_claims::Claim;
use id_core::waiting::AuthorKey;

/// The tag name an alias claim carries. Its value is the alias text.
pub const ALIAS_NAME: &str = "alias";
Expand Down Expand Up @@ -189,7 +189,7 @@ mod tests {
subject,
name: name.to_owned(),
value: value.map(str::to_owned),
scope: crate::tag_claims::TagScope::Shared,
scope: id_store::tag_claims::TagScope::Shared,
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -668,7 +668,7 @@ route = "/tic-tac-toe"

#[test]
fn checked_in_tic_tac_toe_manifest_remains_valid() {
let path = Path::new(env!("CARGO_MANIFEST_DIR")).join("apps/tic-tac-toe/app.toml");
let path = Path::new(env!("CARGO_MANIFEST_DIR")).join("../../apps/tic-tac-toe/app.toml");
let source = fs::read_to_string(path).unwrap();
let manifest = parse_app_manifest(&source, "tic-tac-toe").unwrap();
assert_eq!(manifest.interfaces.web.unwrap().route, "/tic-tac-toe");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! Chat presence: ephemeral TTL heartbeats and roster liveness (ID chat v1, #2809).
//!
//! Presence is a separately-scoped ephemeral protocol, distinct from chat messages
//! ([`crate::chat`]): a node periodically broadcasts a [`PresenceHeartbeat`] —
//! ([`id_store::chat`]): a node periodically broadcasts a [`PresenceHeartbeat`] —
//! `{node, channels[], status, ts}` — over the already-wired gossip plane (see
//! [`crate::commands::serve`]), and every receiver keeps the latest heartbeat per node in
//! an in-memory [`PresenceTable`]. There are no leave messages: a node that stops
Expand All @@ -20,7 +20,7 @@
//! entry point had no production caller and is removed; tests exercise the
//! deterministic `update_at` core instead. The peer-announcement path is
//! `SignedPeerAnnouncement::decode_frame` →
//! [`crate::discovery::PeerDiscovery::update`], both in the serve receiver
//! [`id_core::discovery::PeerDiscovery::update`], both in the serve receiver
//! and the temporary table used by `commands::peers::discover_via_gossip`.
//!
//! `commands::peers::{query_local_peers, query_remote_peers, crawl_peers}`
Expand Down Expand Up @@ -68,7 +68,7 @@
//! # Membership scoping
//!
//! A channel is a chat group (the channel's identity is its group [`Hash`], as in
//! [`crate::chat`]), and presence metadata is scoped to authorized channel members:
//! [`id_store::chat`]), and presence metadata is scoped to authorized channel members:
//!
//! - On receipt, [`PresenceTable::update_scoped`] filters a heartbeat's channels to
//! those the *sender* is a member of (the caller's membership predicate), so a node
Expand All @@ -90,7 +90,7 @@
//! # Roster
//!
//! The roster for a channel is the backing group's membership — the member set of the
//! group fold ([`crate::groups::GroupView`]) — annotated with last-seen liveness from
//! group fold ([`id_events::groups::GroupView`]) — annotated with last-seen liveness from
//! the table: [`Liveness::Live`] when a heartbeat for that channel is within TTL,
//! [`Liveness::Offline`] when the member was never seen or its heartbeat went stale.

Expand All @@ -102,8 +102,8 @@ use ed25519_dalek::{Signature, Signer, SigningKey, VerifyingKey};
use p2panda_core::Hash;
use serde::{Deserialize, Serialize};

use crate::groups::GroupView;
use crate::waiting::AuthorKey;
use id_events::groups::GroupView;
use id_core::waiting::AuthorKey;

/// How long a heartbeat keeps a node live, in seconds: 75, inside the 60–90 s band
/// #2809 specifies. A node silent for longer than this reads as gone.
Expand Down Expand Up @@ -284,7 +284,7 @@ struct Entry {
/// Thread-safe in-memory table of the latest presence heartbeat per node.
///
/// Cheaply cloneable (backed by `Arc`) and safe to share across async tasks, like
/// [`crate::discovery::PeerDiscovery`]. All state is ephemeral by construction: the
/// [`id_core::discovery::PeerDiscovery`]. All state is ephemeral by construction: the
/// table is never persisted, journaled, synced, or replayed.
#[derive(Debug, Clone, Default)]
pub struct PresenceTable {
Expand Down Expand Up @@ -319,7 +319,7 @@ impl PresenceTable {
/// Records a heartbeat as of `now` (unix seconds), the deterministic core of
/// [`update_scoped`](Self::update_scoped).
///
/// Three guards, mirroring [`crate::discovery::PeerDiscovery`]:
/// Three guards, mirroring [`id_core::discovery::PeerDiscovery`]:
///
/// - **Freshness bound.** A heartbeat stamped older than [`PRESENCE_TTL_SECS`]
/// relative to `now` is refused — replaying a captured heartbeat cannot keep a
Expand Down Expand Up @@ -1049,7 +1049,7 @@ mod tests {
// forgery (R = identity, S = 0) passes plain verify for any
// message under it — only verify_strict keeps it out of the
// presence authentication gate.
use crate::test_forgeries::{IDENTITY_KEY, identity_forgery};
use id_core::test_forgeries::{IDENTITY_KEY, identity_forgery};
let chan = channel("general");
let mut hb = heartbeat(IDENTITY_KEY, vec![chan], 9_600);
hb.signature = identity_forgery().to_vec();
Expand All @@ -1060,7 +1060,7 @@ mod tests {
fn verify_rejects_a_non_canonical_s() {
// #1386: a genuine signature mutated to S + L must be refused,
// while the original verifies.
use crate::test_forgeries::with_non_canonical_s;
use id_core::test_forgeries::with_non_canonical_s;
let chan = channel("general");
let alice_key = SigningKey::from_bytes(&[7u8; 32]);
let alice = alice_key.verifying_key().to_bytes();
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@

use clap::{Args, Subcommand, ValueEnum};

use crate::groups::Role;
use crate::groups::policy::Delegation;
use crate::groups::policy::SuccessorKind;
use id_events::groups::Role;
use id_events::groups::policy::Delegation;
use id_events::groups::policy::SuccessorKind;

/// Subcommands for `id group`. Accounts and groups are 64 hex characters.
#[derive(Subcommand, Debug)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ pub use writer_sets::WriterSetCommand;
/// # Example
///
/// ```rust
/// use id::cli::Cli;
/// use id_cli::cli::Cli;
/// use clap::Parser;
///
/// // Parse command line arguments
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ fn test_command_lists_cover_all_clap_subcommands() {
"expected the full command set, got {names:?}"
);
let source = include_str!("mod.rs");
let readme = std::fs::read_to_string(concat!(env!("CARGO_MANIFEST_DIR"), "/README.md"))
let readme = std::fs::read_to_string(concat!(env!("CARGO_MANIFEST_DIR"), "/../../README.md"))
.expect("README readable");
check_command_lists(
&names,
Expand All @@ -109,7 +109,7 @@ fn test_command_lists_cover_all_clap_subcommands() {
fn test_command_lists_reject_stale_entries() {
let names = clap_subcommand_names();
let source = include_str!("mod.rs");
let readme = std::fs::read_to_string(concat!(env!("CARGO_MANIFEST_DIR"), "/README.md"))
let readme = std::fs::read_to_string(concat!(env!("CARGO_MANIFEST_DIR"), "/../../README.md"))
.expect("README readable");

let mut doc_entries = module_doc_entries(source);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ pub struct WorldRuntimeArgs {
/// `id-core`'s `world_limits` and validates through this trait, which the
/// CLI argument struct implements here in its own crate.
#[cfg(feature = "world")]
impl crate::world_limits::WorldLimitArgs for WorldRuntimeArgs {
impl id_caps::world_limits::WorldLimitArgs for WorldRuntimeArgs {
fn world_fuel(&self) -> u64 {
self.world_fuel
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use anyhow::Result;
use clap::Parser;

use super::{Cli, Command, ServeArgs};
use crate::world_limits::RuntimeLimits;
use id_caps::world_limits::RuntimeLimits;

const KIB: u64 = 1024;
const MIB: u64 = 1024 * KIB;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! `id claim`: set, clear, list, and search tag claims on any subject (P6.7c).
//!
//! This module parses the arguments, acts on the event store, and prints. The rules are the
//! library's ([`crate::local_events`], [`crate::tag_claims`]).
//! library's ([`id_events::local_events`], [`id_store::tag_claims`]).
//!
//! # Output
//!
Expand All @@ -19,8 +19,8 @@ use serde_json::{Value, json};
use crate::cli::{ClaimCommand, ClaimScope};
use crate::commands::doc::{open_events, print_action, print_rows};
use crate::commands::group::hex;
use crate::groups::log::hash_from_hex;
use crate::tag_claims::{Claim, TagScope};
use id_groups::groups::log::hash_from_hex;
use id_store::tag_claims::{Claim, TagScope};

/// Prints a `set` line for a claim just recorded.
pub(super) fn print_set(json: bool, subject: Hash, name: &str, value: Option<&str>, event: Hash) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
//! # Usage
//!
//! ```rust,ignore
//! use id::commands::{get_serve_info, create_local_client_endpoint};
//! use id_cli::commands::{get_serve_info, create_local_client_endpoint};
//!
//! if let Some(serve_info) = get_serve_info().await {
//! let (endpoint, addr) = create_local_client_endpoint(&serve_info).await?;
Expand Down
Loading
Loading