coding-agent-search 0.5.1

Unified TUI search over local coding agent histories
Documentation
//! Semantic model daemon for warm embedding and reranking.
//!
//! This module provides a daemon server that keeps ML models resident in memory
//! for fast inference. The daemon:
//! - Listens on a Unix Domain Socket for requests
//! - Shares the socket with xf (wire-compatible protocol)
//! - First-come spawns, others connect
//! - Supports graceful fallback to direct inference
//!
//! ## Architecture
//!
//! ```text
//! ┌─────────────────────────────────────────────────────────────────┐
//! │                    WIRE-COMPATIBLE DAEMONS                      │
//! ├─────────────────────────────────────────────────────────────────┤
//! │  xf (standalone)           cass (standalone)                   │
//! │  ┌──────────────┐          ┌──────────────┐                    │
//! │  │ xf binary    │          │ cass binary  │                    │
//! │  │  └─ daemon   │          │  └─ daemon   │                    │
//! │  └──────────────┘          └──────────────┘                    │
//! │         │ Same socket path: /tmp/semantic-daemon-$USER.sock    │
//! │         ▼                         ▼                            │
//! │  ┌────────────────────────────────────────┐                    │
//! │  │  Shared UDS Socket (first-come wins)   │                    │
//! │  └────────────────────────────────────────┘                    │
//! └─────────────────────────────────────────────────────────────────┘
//! ```
//!
//! ## Usage
//!
//! ```ignore
//! use cass::daemon::{client::UdsDaemonClient, core::ModelDaemon};
//!
//! // Client usage (auto-spawns daemon if not running)
//! let client = UdsDaemonClient::with_defaults();
//! client.connect()?;
//! let embeddings = client.embed(&["hello world"])?;
//!
//! // Server usage (for daemon subprocess)
//! let daemon = ModelDaemon::with_defaults(&data_dir);
//! daemon.run()?;
//! ```

pub mod client;
pub mod core;
pub mod models;
pub mod protocol;
pub mod resource;
pub mod worker;

use std::path::{Path, PathBuf};

// Used by daemon client/server paths in some target combinations, but not all
// library-only builds that we verify during placeholder cleanup.
#[allow(dead_code)]
pub(crate) fn daemon_run_lock_path(socket_path: &Path) -> PathBuf {
    socket_path.with_extension("spawnlock")
}

pub(crate) fn daemon_spawn_guard_lock_path(socket_path: &Path) -> PathBuf {
    socket_path.with_extension("spawn-guard.lock")
}

// Re-export key types for convenience
pub use client::{DaemonClientConfig, UdsDaemonClient};
pub use core::{DaemonConfig, ModelDaemon};
pub use models::ModelManager;
pub use protocol::{PROTOCOL_VERSION, Request, Response, default_socket_path};
pub use resource::ResourceMonitor;
pub use worker::{EmbeddingJobConfig, EmbeddingWorkerHandle};