cccc-sdk 0.4.47

Official Rust client SDK for CCCC daemon IPC v1
Documentation

CCCC Rust SDK

Official blocking Rust client for the native CCCC Daemon IPC v1. SDK language does not constrain application architecture; Python and TypeScript clients use the same daemon contract.

This version targets the CCCC 0.4.47 daemon contract.

Install

[dependencies]
cccc-sdk = "0.4.47"

Quick start

use cccc_sdk::{CCCCClient, CompatibilityRequirements, MessageMode, ReplyMessageMode};

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = CCCCClient::discover()?;
    let requirements = CompatibilityRequirements {
        minimum_ipc_version: 1,
        operations: vec!["groups", "send", "reply", "context_get"],
        ..Default::default()
    };
    let daemon = client.assert_compatible(&requirements)?;
    println!("connected to CCCC {}", daemon.version);

    let groups = client.groups()?;
    println!("{groups:#?}");
    client.send("g_xxx", "FYI", MessageMode::Send, "user")?;
    client.reply_with_mode(
        "g_xxx",
        "e_request",
        "quiet follow-up",
        ReplyMessageMode::Mail,
        "peer-1",
    )?;
    Ok(())
}

The client discovers ${CCCC_HOME}/daemon/ccccd.addr.json, supports Unix sockets and TCP, and falls back to ${CCCC_HOME}/daemon/ccccd.sock on Unix.

Common helpers include ping, groups, group_show, send, reply, inbox_peek, inbox_read, message_history, message_deliver, reply_request_cancel, context_get, context_get_with_detail, context_sync, cursor-based terminal reads, and Web Model delivery-preference/recovery operations. Use call for every other non-streaming operation:

use cccc_sdk::CCCCClient;
use serde_json::{json, Map};

let client = CCCCClient::discover()?;
let args: Map<String, _> = [("group_id".into(), json!("g_xxx"))]
    .into_iter()
    .collect();
let preamble = client.call("group_preamble_get", args)?;
# Ok::<(), Box<dyn std::error::Error>>(())

Terminal helpers return typed cursor payloads. term_resize uses the standard operation name and falls back to the compatibility terminal_resize alias only after unknown_op; the legacy success payload is normalized to the standard typed result:

use cccc_sdk::{CCCCClient, TerminalSnapshotOptions};

let client = CCCCClient::discover()?;
let snapshot = client.terminal_snapshot(
    "g_xxx",
    "web-model",
    &TerminalSnapshotOptions {
        limit_bytes: Some(512_000),
        by: Some("user".into()),
    },
)?;
println!("cursor={}", snapshot.end_cursor);
# Ok::<(), Box<dyn std::error::Error>>(())

Clients created by discover / discover_in re-read ccccd.addr.json after a connection-establishment failure. Once request exchange begins, failures are reported as Error::OutcomeUnknown and are never replayed automatically. Clients created with new(endpoint) keep that explicit endpoint.

assert_compatible probes requested operation names and rejects an advertised capability whose actual operation returns unknown_op.

Streaming upgrade operations such as events_stream and term_attach are not exposed as iterators in this SDK. assert_compatible uses advertised capabilities for unsafe duplex operations and rejects unverified requirements; a reusable stream API will be added only with stable ownership, close, and backpressure semantics.

Voice library and Web Models

Use assistant_voice_document_library, assistant_voice_document_library_update and assistant_voice_document_delete for the stored Voice library. Updates take VoiceDocumentLibraryAction and return VoiceDocumentLibrary; folder removal retains documents, and renaming never moves files. An empty ReorderRoot list clears ordering; an empty Move.folder_id means root. Deletion permanently removes the Markdown file; archive/restore retains it.

Create/update Actors through generic IPC calls with runtime="grok_web_model" for Grok Bot or runtime="web_model" for ChatGPT. CCCC Web configures the Grok Bot URL, native Webhook Routine credentials and remote MCP connector; Grok does not use CCCC-managed browser delivery. grok is the separate CLI runtime. See the migration guide.