Skip to content

Open source Grok Bot alternative, Bring your own agent and subscription: message Claude Code, Codex, Gemini CLI, Cursor, Copilot and 40+ AI agents as bots on your own computer, from iPhone, Mac, Windows, Linux or terminal. Agent-agnostic and free. Also a Muse and Dots alternative. Built in Rust.

build(network): publish codync-network on its own, like codync-mem

leepokai3e4527e3896d
diff --git a/.github/workflows/network-crate.yml b/.github/workflows/network-crate.yml
new file mode 100644
index 00000000..4ab52a8f
--- /dev/null
+++ b/.github/workflows/network-crate.yml
@@ -0,0 +1,100 @@
+# Ships host/crates/network with each Codync release (docs/guides/development.md#crate-releases), like codync-mem: a
+# pull request into main that changes the crate must raise its version; the push to main mirrors it to
+# leepokai/codync-network, read-only, and publishes that version. The split is deterministic, so each push
+# fast-forwards the mirror as long as nobody commits there and the crate's commits reach main unrewritten.
+name: codync-network
+
+on:
+ pull_request:
+ branches: [main]
+ paths: ["host/crates/network/**"]
+ push:
+ branches: [main]
+ paths: ["host/crates/network/**"]
+
+concurrency:
+ group: network-crate-${{ github.event_name }}
+ cancel-in-progress: false
+
+jobs:
+ version:
+ if: github.event_name == 'pull_request'
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v4
+ with:
+ fetch-depth: 0
+ - name: A changed crate has a new version
+ env:
+ BASE: ${{ github.event.pull_request.base.sha }}
+ run: |
+ # Its .github is the mirror's CI, not part of the package.
+ if git diff --quiet "$BASE" HEAD -- host/crates/network ':!host/crates/network/.github'; then exit 0; fi
+ # A crate main has never had starts at the version it was first published with.
+ if ! git cat-file -e "$BASE:host/crates/network/Cargo.toml" 2>/dev/null; then exit 0; fi
+ version() { sed -n 's/^version = "\(.*\)"$/\1/p' | head -n 1; }
+ before=$(git show "$BASE:host/crates/network/Cargo.toml" | version)
+ after=$(version < host/crates/network/Cargo.toml)
+ if [ "$before" = "$after" ]; then
+ echo "::error file=host/crates/network/Cargo.toml::codync-network changed but is still $after: raise its version."
+ exit 1
+ fi
+
+ mirror:
+ if: github.event_name == 'push'
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v4
+ with:
+ fetch-depth: 0
+ - name: Split the crate's history
+ run: git subtree split --prefix=host/crates/network -b mirror
+ - name: Push it to the mirror
+ env:
+ # A deploy key with write access on leepokai/codync-network.
+ KEY: ${{ secrets.CODYNC_NETWORK_DEPLOY_KEY }}
+ run: |
+ if [ -z "$KEY" ]; then
+ echo "::notice::CODYNC_NETWORK_DEPLOY_KEY isn't set, so the mirror isn't updated."
+ exit 0
+ fi
+ mkdir -p ~/.ssh
+ printf '%s\n' "$KEY" > ~/.ssh/mirror
+ chmod 600 ~/.ssh/mirror
+ GIT_SSH_COMMAND="ssh -i ~/.ssh/mirror -o StrictHostKeyChecking=accept-new" \
+ git push [email protected]:leepokai/codync-network.git mirror:main
+
+ publish:
+ # Trusted publishing: crates.io trusts this workflow file, so no token is stored.
+ needs: mirror
+ runs-on: ubuntu-latest
+ permissions:
+ contents: read
+ id-token: write
+ defaults:
+ run:
+ working-directory: host
+ steps:
+ - uses: actions/checkout@v4
+ - name: Is this version on crates.io yet?
+ id: version
+ run: |
+ version=$(sed -n 's/^version = "\(.*\)"$/\1/p' crates/network/Cargo.toml | head -n 1)
+ code=$(curl -s -o /dev/null -w '%{http_code}' -A "codync-ci (https://github.com/leepokai/Codync)" \
+ "https://crates.io/api/v1/crates/codync-network/$version")
+ case "$code" in
+ 200) echo "::notice::codync-network $version is already on crates.io."; echo "new=false" >> "$GITHUB_OUTPUT" ;;
+ 404) echo "new=true" >> "$GITHUB_OUTPUT" ;;
+ *) echo "::error::crates.io answered $code for codync-network $version."; exit 1 ;;
+ esac
+ - name: Install Rust (rust-toolchain.toml)
+ if: steps.version.outputs.new == 'true'
+ run: rustup toolchain install
+ - uses: rust-lang/crates-io-auth-action@v1
+ if: steps.version.outputs.new == 'true'
+ id: auth
+ - name: Publish
+ if: steps.version.outputs.new == 'true'
+ run: cargo publish -p codync-network --locked
+ env:
+ CARGO_REGISTRY_TOKEN: ${{ steps.auth.outputs.token }}
diff --git a/CLAUDE.md b/CLAUDE.md
index 24005d89..ac98bb54 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -72,7 +72,7 @@ After every change, test it end to end on the real apps, not just builds and uni
- Xcode Cloud archives the `iOS` scheme on every `v*` tag and uploads it to App Store Connect with its own build number, then the `Submit iOS` workflow submits it to App Review for the App Store; don't upload from the local machine or edit `CURRENT_PROJECT_VERSION` for it. Details: [development guide](docs/guides/development.md#ios-releases-xcode-cloud). `Submit Android` builds the same tags and uploads them to Google Play ([Android releases](docs/guides/development.md#android-releases-google-play)).
- Phone ↔ host compatibility: each side names the oldest version of the other it works with (`minApp` in the host's `hello`, `minHost` in each client). Additive changes need nothing; a rename/removal raises `minApp` in the same release, and the release gate holds that release until the App Store has the iPhone app: [docs/reference/compatibility.md](docs/reference/compatibility.md)
- **Every source change ships as a release.** A version bump on `main` is the only release trigger (Auto Tag → desktop app for macOS, Linux and Windows, host, Homebrew, in-app update), so any change to shipped code (`apps/`, `host/`, `packaging/`) bumps the version before it reaches `main`, without being asked. Docs, `web/`, `cloud/`, `relay/` and CI-only changes don't bump.
-- Pick the bump yourself: patch for fixes and small tweaks, minor for new features or protocol additions. Never bump major (stay on 2.x). One bump per merge into `main`: if `MARKETING_VERSION` is already ahead of the latest `v*` tag, leave it. A change to `host/crates/memory` also raises `codync-mem`'s own 0.x version once per release (leave it if it's already ahead of `main`'s); CI blocks a PR into `main` that forgets, and the merge publishes it to crates.io ([codync-mem releases](docs/guides/development.md#codync-mem-releases)).
+- Pick the bump yourself: patch for fixes and small tweaks, minor for new features or protocol additions. Never bump major (stay on 2.x). One bump per merge into `main`: if `MARKETING_VERSION` is already ahead of the latest `v*` tag, leave it. A change to `host/crates/memory` or `host/crates/network` also raises that crate's own 0.x version (`codync-mem`, `codync-network`) once per release (leave it if it's already ahead of `main`'s); CI blocks a PR into `main` that forgets, and the merge mirrors and publishes it to crates.io ([crate releases](docs/guides/development.md#codync-mem-releases)).
- How: set `MARKETING_VERSION` in `apps/project.yml` and `version` in `host/Cargo.toml` (+ its `Cargo.lock` entry) and `apps/desktop/package.json` (+ `package-lock.json`) to the same value, run `xcodegen generate --spec apps/project.yml`, commit as `build: bump version to X.Y.Z`. Never touch `CURRENT_PROJECT_VERSION` (Xcode Cloud sets the iOS build number). When a phone app changes, also write that version's section in its notes (zh-Hant + en-US, what that app's users notice): `apps/ios/WhatsNew.md` becomes the App Store "What's New", `apps/android/WhatsNew.md` the Google Play release notes.
## Layout & naming
diff --git a/docs/guides/development.md b/docs/guides/development.md
index a03c1978..6eafb6e1 100644
--- a/docs/guides/development.md
+++ b/docs/guides/development.md
@@ -164,6 +164,12 @@ The memory crate (`host/crates/memory`) has its own 0.x version and ships with t
To bump, set `version` in `host/crates/memory/Cargo.toml` (patch for fixes, minor for API changes while 0.x) and run `cargo check -p codync-mem` in `host/` to update its `Cargo.lock` entry. A published version can't be deleted, only yanked.
+## Crate releases
+
+`codync-network` (`host/crates/network`) ships the same way as codync-mem, through `.github/workflows/network-crate.yml`: a pull request into `main` that changes it must raise its 0.x `version`, and the push to `main` mirrors it to [leepokai/codync-network](https://github.com/leepokai/codync-network) (deploy key in `CODYNC_NETWORK_DEPLOY_KEY`) and publishes the version on crates.io by trusted publishing (`leepokai/Codync`, `network-crate.yml`). Bump with `cargo check -p codync-network` in `host/`. Its `.github` folder is the mirror's own CI and pull-request redirect, inert in Codync.
+
+The mirror only fast-forwards: the crate's commits must reach `main` as they are. Merge a branch that touches a crate (no rebase or squash after its commits were mirrored or published), or the next push to the mirror is refused. 0.1.0 was published and mirrored by hand from `feat/codync-network` on 2026-10-26, ahead of its Codync release.
+
## iOS releases (Xcode Cloud)
The Xcode Cloud workflow "Release" on the product "iOS" has no automatic start condition (its own tag trigger never fired); it only runs when started through the API, and it archives the `iOS` scheme in Release with deployment preparation **TestFlight and App Store** (the "Internal Testing Only" option produces builds App Review can't take) and uploads it to App Store Connect. Xcode Cloud overrides the build number with its own counter (`CI_BUILD_NUMBER`, configured under Xcode Cloud settings → Build Number in App Store Connect), so `CURRENT_PROJECT_VERSION` in `project.yml` is only the local default. The checked-in `apps/Codync.xcodeproj` is what the cloud builds: regenerate it whenever `project.yml` changes, and commit `apps/Codync.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved` whenever a package version changes (Xcode Cloud never resolves packages itself; copy `apps/ios/Kit/Package.resolved` there if Xcode wrote it to `apps/ios/Kit/`). Xcode Cloud reads public package repositories without any connection. The `Submit iOS` GitHub workflow (`.github/workflows/ios-submit.yml` → `tools/asc-submit.py`, secrets `ASC_KEY_ID`, `ASC_ISSUER_ID`, `ASC_PRIVATE_KEY`) runs on every `v*` tag (the tags Auto Tag pushes after a version bump on `main`). It compares the tag with the last version sent to App Review (a version never sent or pulled back, such as one a failed run left behind, doesn't count; a rejected one does): when nothing the iPhone app is built from changed (`apps/ios/` including `apps/ios/Kit/`, except `WhatsNew.md` and the Kit tests, `apps/shared/`, the package pins, or `apps/project.yml` beyond its version lines), iOS skips that release, so host- or desktop-only releases neither build nor touch a version in review; a release whose host asks for a newer iPhone app (`MIN_APP`) than that version ships anyway, so the release gate never waits for an iPhone app that isn't coming. Otherwise it starts the Xcode Cloud archive on the tag (or on `main` while `main` is the tagged commit: Xcode Cloud hears of a new tag through a GitHub webhook that sometimes never arrives), waits for that build to finish processing and submits it for App Review, released automatically after approval. The latest version wins: a version still *Waiting for Review* is pulled back, renamed and resubmitted with the new build; one already *In Review* or approved is left alone (rerun the workflow with the version once it is out). *What's New* comes from the version's `## <version>` section in `apps/ios/WhatsNew.md` (one `### <locale>` per App Store language, written in the version bump); without one, the `### zh-Hant` / `### en-US` bullets under `## What's New: iPhone` in the PR template are collected from every PR merged since the last App Store version (changes pushed to `main` without a PR add nothing); with neither, empty fields get a generic "Bug fixes and improvements" line. Running `Submit iOS` by hand with a version ships it even without iPhone changes. After each `Submit iOS` run, the `iOS dSYMs` workflow (`.github/workflows/ios-dsyms.yml` → `tools/upload-dsyms.py`, on macOS) downloads that release's archive from Xcode Cloud and uploads its dSYMs to PostHog (secret `POSTHOG_CLI_API_KEY`), so iPhone crash reports are symbolicated; run it by hand with a version after a manual `Submit iOS` or to upload an older one ([iPhone crash tracing](iphone-crash-tracing.md)). `python3 tools/asc-submit-test.py` checks the PR parsing, the change detection, the `MIN_APP` check (all three in `tools/store_release.py`, shared with Google Play) and the archive source. `DRY_RUN=1 tools/asc-submit.py <version>` prints the writes without making them.
diff --git a/host/Cargo.lock b/host/Cargo.lock
index c45689cc..65813384 100644
--- a/host/Cargo.lock
+++ b/host/Cargo.lock
@@ -1110,7 +1110,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c54e03a951783e8b327515db3f2a2fd0e3bed362a96b066f341ce66ed49b4ead"
dependencies = [
"data-encoding",
- "syn 3.0.6",
+ "syn 2.0.119",
]
[[package]]
@@ -5917,9 +5917,9 @@ dependencies = [
[[package]]
name = "yoke-derive"
-version = "0.8.3"
+version = "0.8.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "33811428bee40dbceb6d545e95754741d17a6aef9a4849f0fd62e2ba4f412a78"
+checksum = "ec8ebde2db3681e8c9980cc27822030e68752690ddfa9473e739aeb4dbde6d71"
dependencies = [
"proc-macro2",
"quote",
diff --git a/host/crates/network/.github/workflows/ci.yml b/host/crates/network/.github/workflows/ci.yml
new file mode 100644
index 00000000..ad4398f8
--- /dev/null
+++ b/host/crates/network/.github/workflows/ci.yml
@@ -0,0 +1,25 @@
+# Runs in the codync-network mirror, where this folder is the repository root. In Codync it is inert: GitHub reads
+# only the root .github, and Codync's host workflow checks the crate there.
+name: CI
+
+on:
+ push:
+ branches: [main]
+ pull_request:
+
+jobs:
+ test:
+ strategy:
+ matrix:
+ os: [ubuntu-latest, macos-latest, windows-latest]
+ runs-on: ${{ matrix.os }}
+ steps:
+ - uses: actions/checkout@v4
+ - uses: dtolnay/rust-toolchain@stable
+ with:
+ components: clippy, rustfmt
+ - run: cargo fmt --check
+ - run: cargo clippy --all-targets -- -D warnings
+ # On Windows the crate builds; its tests and the daemon's control socket come later.
+ - run: cargo test
+ if: runner.os != 'Windows'
diff --git a/host/crates/network/.github/workflows/pull-requests.yml b/host/crates/network/.github/workflows/pull-requests.yml
new file mode 100644
index 00000000..d78c2dbd
--- /dev/null
+++ b/host/crates/network/.github/workflows/pull-requests.yml
@@ -0,0 +1,22 @@
+# Runs in the codync-network mirror, where this folder is the repository root (inert in Codync, like ci.yml). The
+# mirror is read-only: a pull request opened here gets a pointer to Codync's dev branch and is closed.
+name: Pull requests
+
+on:
+ pull_request_target:
+ types: [opened]
+
+permissions:
+ pull-requests: write
+
+jobs:
+ redirect:
+ runs-on: ubuntu-latest
+ steps:
+ # Nothing from the pull request is checked out or run.
+ - env:
+ GH_TOKEN: ${{ github.token }}
+ PR: ${{ github.event.pull_request.number }}
+ run: |
+ gh pr comment "$PR" --repo "$GITHUB_REPOSITORY" --body "Thanks! codync-network is developed inside Codync and mirrored here read-only, so a pull request can't be merged here. Please open it against Codync's \`dev\` branch, in \`host/crates/network\`: https://github.com/leepokai/Codync. Issues are welcome here."
+ gh pr close "$PR" --repo "$GITHUB_REPOSITORY"
diff --git a/host/crates/network/Cargo.toml b/host/crates/network/Cargo.toml
index 59d66d28..436b1d50 100644
--- a/host/crates/network/Cargo.toml
+++ b/host/crates/network/Cargo.toml
@@ -10,6 +10,8 @@ repository = "https://github.com/leepokai/codync-network"
readme = "README.md"
keywords = ["agent", "p2p", "iroh", "mesh", "bots"]
categories = ["network-programming"]
+# The mirror's CI, not part of the package.
+exclude = [".github"]
[dependencies]
anyhow = "1"
diff --git a/host/crates/network/README.md b/host/crates/network/README.md
index e3894fc5..2b1662bd 100644
--- a/host/crates/network/README.md
+++ b/host/crates/network/README.md
@@ -46,8 +46,31 @@ Requests and replies, rooms or shared task boards are patterns of letters, built
## Status
-0.1, developed inside Codync, whose host uses it to carry bot requests between the user's computers. The API will
-change. Messages into Claude Code sessions and the control socket work on macOS and Linux; Windows comes later.
+0.x, developed inside Codync, whose host uses it to carry bot requests between the user's computers, and mirrored
+here read-only. The API changes with Codync. Report issues here; send pull requests to
+[Codync's `dev` branch](https://github.com/leepokai/Codync) (`host/crates/network`). Messages into Claude Code
+sessions and the daemon's control socket work on macOS and Linux; on Windows the crate builds, and those come later.
+
+## Install
+
+The daemon and its command (`codync-network`), with Rust 1.91 or later:
+
+```sh
+cargo install codync-network
+```
+
+As a library:
+
+```sh
+cargo add codync-network
+```
+
+It builds iroh on rustls with ring. An app that already uses rustls with aws-lc-rs takes the other one, so the two
+aren't built in together (rustls then can't pick a provider by itself):
+
+```toml
+codync-network = { version = "0.1", default-features = false, features = ["tls-aws-lc-rs"] }
+```
## Try it
diff --git a/host/crates/network/src/bin/codync-network/control.rs b/host/crates/network/src/bin/codync-network/control.rs
index 562b54a4..346f75a4 100644
--- a/host/crates/network/src/bin/codync-network/control.rs
+++ b/host/crates/network/src/bin/codync-network/control.rs
@@ -1,85 +1,97 @@
//! The running node's local door: `codync-network <command>` from any terminal or agent on this
//! computer sends its words over a socket only this user can open, and prints the answer.
-use super::Daemon;
-use anyhow::{Context, Result, bail};
-use serde_json::{Value, json};
-use std::path::Path;
-use std::sync::Arc;
-
-const SOCKET: &str = "control.sock";
-/// What a socket path may hold, with room to spare (`sun_path` is 104 bytes on macOS).
+#[cfg(not(unix))]
+pub use other::{ask, serve};
#[cfg(unix)]
-const MAX_SOCKET_PATH: usize = 100;
+pub use unix::{ask, serve};
-/// In the state folder, or, when that path is too long for a socket, a name for it in this
-/// user's temporary folder.
#[cfg(unix)]
-fn socket_path(dir: &Path) -> std::path::PathBuf {
- use std::hash::{DefaultHasher, Hash, Hasher};
- let path = dir.join(SOCKET);
- if path.as_os_str().len() <= MAX_SOCKET_PATH {
- return path;
- }
- let mut hasher = DefaultHasher::new();
- dir.hash(&mut hasher);
- std::env::temp_dir().join(format!("codync-network-{:016x}.sock", hasher.finish()))
-}
+mod unix {
+ use super::super::Daemon;
+ use anyhow::{Context, Result, bail};
+ use serde_json::{Value, json};
+ use std::path::Path;
+ use std::sync::Arc;
-#[cfg(unix)]
-pub fn serve(dir: &Path, daemon: Arc<Daemon>) -> Result<()> {
- use std::os::unix::fs::PermissionsExt;
- use tokio::io::{AsyncBufReadExt, AsyncWriteExt, BufReader};
- let path = socket_path(dir);
- // A socket left by a node that stopped.
- let _ = std::fs::remove_file(&path);
- let listener = tokio::net::UnixListener::bind(&path).context("couldn't open the control socket")?;
- std::fs::set_permissions(&path, std::fs::Permissions::from_mode(0o600))?;
- tokio::spawn(async move {
- while let Ok((conn, _)) = listener.accept().await {
- let daemon = daemon.clone();
- tokio::spawn(async move {
- let (read, mut write) = conn.into_split();
- let Ok(Some(line)) = BufReader::new(read).lines().next_line().await else { return };
- let answer = match serde_json::from_str::<Vec<String>>(&line) {
- Ok(words) => match daemon.command(&words).await {
- Ok(out) => json!({"ok": out}),
- Err(e) => json!({"error": format!("{e:#}")}),
- },
- Err(_) => json!({"error": "unreadable request"}),
- };
- let _ = write.write_all(format!("{answer}\n").as_bytes()).await;
- });
+ const SOCKET: &str = "control.sock";
+ /// What a socket path may hold, with room to spare (`sun_path` is 104 bytes on macOS).
+ const MAX_SOCKET_PATH: usize = 100;
+
+ /// In the state folder, or, when that path is too long for a socket, a name for it in this
+ /// user's temporary folder.
+ fn socket_path(dir: &Path) -> std::path::PathBuf {
+ use std::hash::{DefaultHasher, Hash, Hasher};
+ let path = dir.join(SOCKET);
+ if path.as_os_str().len() <= MAX_SOCKET_PATH {
+ return path;
}
- });
- Ok(())
-}
+ let mut hasher = DefaultHasher::new();
+ dir.hash(&mut hasher);
+ std::env::temp_dir().join(format!("codync-network-{:016x}.sock", hasher.finish()))
+ }
-#[cfg(unix)]
-pub async fn ask(dir: &Path, words: &[String]) -> Result<String> {
- use tokio::io::{AsyncBufReadExt, AsyncWriteExt, BufReader};
- let conn = tokio::net::UnixStream::connect(socket_path(dir))
- .await
- .context("codync-network isn't running on this computer; start it with `codync-network up`")?;
- let (read, mut write) = conn.into_split();
- write.write_all(format!("{}\n", serde_json::to_string(words)?).as_bytes()).await?;
- let line = BufReader::new(read).lines().next_line().await?.unwrap_or_default();
- let answer: Value = serde_json::from_str(&line).context("the node gave an unreadable answer")?;
- match (answer["ok"].as_str(), answer["error"].as_str()) {
- (Some(out), _) => Ok(out.into()),
- (_, Some(error)) => bail!("{error}"),
- _ => bail!("the node gave an unreadable answer"),
+ pub fn serve(dir: &Path, daemon: Arc<Daemon>) -> Result<()> {
+ use std::os::unix::fs::PermissionsExt;
+ use tokio::io::{AsyncBufReadExt, AsyncWriteExt, BufReader};
+ let path = socket_path(dir);
+ // A socket left by a node that stopped.
+ let _ = std::fs::remove_file(&path);
+ let listener = tokio::net::UnixListener::bind(&path).context("couldn't open the control socket")?;
+ std::fs::set_permissions(&path, std::fs::Permissions::from_mode(0o600))?;
+ tokio::spawn(async move {
+ while let Ok((conn, _)) = listener.accept().await {
+ let daemon = daemon.clone();
+ tokio::spawn(async move {
+ let (read, mut write) = conn.into_split();
+ let Ok(Some(line)) = BufReader::new(read).lines().next_line().await else { return };
+ let answer = match serde_json::from_str::<Vec<String>>(&line) {
+ Ok(words) => match daemon.command(&words).await {
+ Ok(out) => json!({"ok": out}),
+ Err(e) => json!({"error": format!("{e:#}")}),
+ },
+ Err(_) => json!({"error": "unreadable request"}),
+ };
+ let _ = write.write_all(format!("{answer}\n").as_bytes()).await;
+ });
+ }
+ });
+ Ok(())
+ }
+
+ pub async fn ask(dir: &Path, words: &[String]) -> Result<String> {
+ use tokio::io::{AsyncBufReadExt, AsyncWriteExt, BufReader};
+ let conn = tokio::net::UnixStream::connect(socket_path(dir))
+ .await
+ .context("codync-network isn't running on this computer; start it with `codync-network up`")?;
+ let (read, mut write) = conn.into_split();
+ write.write_all(format!("{}\n", serde_json::to_string(words)?).as_bytes()).await?;
+ let line = BufReader::new(read).lines().next_line().await?.unwrap_or_default();
+ let answer: Value = serde_json::from_str(&line).context("the node gave an unreadable answer")?;
+ match (answer["ok"].as_str(), answer["error"].as_str()) {
+ (Some(out), _) => Ok(out.into()),
+ (_, Some(error)) => bail!("{error}"),
+ _ => bail!("the node gave an unreadable answer"),
+ }
}
}
// ponytail: Windows gets the control door (a named pipe) with Windows support; until then its node
// takes commands typed where it runs.
#[cfg(not(unix))]
-pub fn serve(_dir: &Path, _daemon: Arc<Daemon>) -> Result<()> {
- Ok(())
-}
+mod other {
+ use super::super::Daemon;
+ use anyhow::{Result, bail};
+ use std::path::Path;
+ use std::sync::Arc;
-#[cfg(not(unix))]
-pub async fn ask(_dir: &Path, _words: &[String]) -> Result<String> {
- bail!("on Windows, type commands where codync-network runs")
+ #[allow(clippy::unnecessary_wraps, reason = "the same signature as the Unix version")]
+ pub fn serve(_dir: &Path, _daemon: Arc<Daemon>) -> Result<()> {
+ Ok(())
+ }
+
+ #[allow(clippy::unused_async, reason = "the same signature as the Unix version")]
+ pub async fn ask(_dir: &Path, _words: &[String]) -> Result<String> {
+ bail!("on Windows, type commands where codync-network runs")
+ }
}
diff --git a/host/crates/network/src/reach.rs b/host/crates/network/src/reach.rs
index 98b47f26..887c2689 100644
--- a/host/crates/network/src/reach.rs
+++ b/host/crates/network/src/reach.rs
@@ -147,6 +147,7 @@ async fn post_to_claude(dir: &Path, session: &str, text: &str) -> Result<()> {
// ponytail: Windows sessions take messages on a named pipe with a token; add it with Windows support.
#[cfg(not(unix))]
+#[allow(clippy::unused_async, reason = "the same signature as the Unix version")]
async fn post_to_claude(dir: &Path, session: &str, _text: &str) -> Result<()> {
claude_socket(dir, session)?;
bail!("reaching Claude Code on Windows isn't supported yet")
diff --git a/host/src/chat/team/directory.rs b/host/src/chat/team/directory.rs
index a69ffd4a..2303a83b 100644
--- a/host/src/chat/team/directory.rs
+++ b/host/src/chat/team/directory.rs
@@ -155,7 +155,7 @@ mod tests {
assert_eq!(kept(&rows, &json!({"computer": "desk"}), Some("desk")), ["Coder", "Code Reviewer"]);
assert_eq!(kept(&rows, &json!({"computer": HERE}), None), ["Coder", "Code Reviewer"]);
assert_eq!(kept(&rows, &json!({"online": true}), None), ["Coder", "Code Reviewer"]);
- assert!(kept(&rows, &json!({"computer": "elsewhere"}), None).is_empty());
+ assert_eq!(kept(&rows, &json!({"computer": "elsewhere"}), None), Vec::<&str>::new());
let first = page(&rows, &json!({"limit": 2}), true);
assert_eq!((first["total"].as_u64(), first["next"].as_str()), (Some(3), Some("2")));