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
32 changes: 32 additions & 0 deletions .github/workflows/rust-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: rust-ci

on:
push:
paths:
- "rust/**"
- ".github/workflows/rust-ci.yml"
pull_request:
paths:
- "rust/**"
- ".github/workflows/rust-ci.yml"

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy,rustfmt
- name: Format
working-directory: rust
run: cargo fmt --check
- name: Lint
working-directory: rust
run: cargo clippy --all-targets --all-features -- -D warnings
- name: Test
working-directory: rust
run: cargo test --all-targets
- name: Package
working-directory: rust
run: cargo package --locked
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ pnpm-lock.yaml
yarn.lock
npm-debug.log*

# Rust
target/

# Editors
.vscode/
.idea/
Expand Down
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,17 @@
`cccc-sdk` tracks the `cccc` daemon version. Each release targets a specific
CCCC line and exposes the IPC surface available on that line.

## Rust crate [0.0.1] — 2026-08-03

### Added

- Initial `cccc-sdk` Rust crate with Unix Socket/TCP endpoint discovery,
Daemon IPC v1 NDJSON transport, structured protocol errors, response limits,
and configurable timeouts.
- Generic non-streaming operation calls plus focused helpers for compatibility,
groups, chat, inbox, and context workflows.
- Unit tests, a live compatibility example, crate documentation, and Rust CI.

## [0.4.33] — Unreleased

### Added
Expand Down
18 changes: 15 additions & 3 deletions README.ja.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ CCCC SDK は CCCC プラットフォーム向けの **クライアント SDK**

- CCCC 本体リポジトリ: https://github.com/ChesterRa/cccc
- `cccc`(本体)は daemon/web/CLI を提供し、`CCCC_HOME` の実行状態を管理します。
- `cccc-sdk`(このリポジトリ)は Python/TypeScript から **Daemon IPC v1** を呼ぶクライアントです。
- `cccc-sdk`(このリポジトリ)は PythonTypeScript、Rust から **Daemon IPC v1** を呼ぶクライアントです。
- SDK 単体では動作せず、実行中の CCCC daemon が必要です。

SDK と CCCC Web が同じ `CCCC_HOME` を参照していれば、書き込みは即時に共有されます
Expand All @@ -22,6 +22,7 @@ SDK と CCCC Web が同じ `CCCC_HOME` を参照していれば、書き込み

- `python/` — Python パッケージ(PyPI 名: `cccc-sdk`、import: `cccc_sdk`)
- `ts/` — TypeScript パッケージ(`cccc-sdk`)
- `rust/` — Rust crate(`cccc-sdk`、crate 名 `cccc_sdk`)
- `spec/` — SDK 開発用の契約ドキュメントミラー

主な用途:
Expand All @@ -33,6 +34,7 @@ SDK と CCCC Web が同じ `CCCC_HOME` を参照していれば、書き込み
言語別の詳細:
- Python SDK: `python/README.md`
- TypeScript SDK: `ts/README.md`
- Rust SDK: `rust/README.md`

---

Expand Down Expand Up @@ -64,7 +66,6 @@ from cccc_sdk import CCCCClient
c = CCCCClient()
c.assert_compatible(
require_ipc_v=1,
require_ops=["groups", "send", "reply", "tracked_send", "context_sync"],
require_ops=["groups", "send", "reply", "inbox_list", "context_get", "context_sync"],
)
print("OK: daemon is compatible")
Expand All @@ -84,12 +85,23 @@ python python/examples/stream.py --group g_xxx
python python/examples/auto_ack_attention.py --group g_xxx --actor user
```

## クイックスタート(Rust)

```toml
[dependencies]
cccc-sdk = "0.0.1"
```

Rust クライアントは `CCCC_HOME` の Unix Socket/TCP daemon を自動検出し、
汎用 `call` と group、chat、inbox、context の主要メソッドを提供します。
詳細は `rust/README.md` を参照してください。

---

## バージョニングと互換性

SDK リリースは daemon のバージョン文字列ではなく contract に追従します:
- Python と TypeScript のパッケージバージョンは現在の SDK リリースラインに追従し、RC 番号は SDK 側で管理します
- Python と TypeScript は現在の SDK リリースラインに追従し、Rust crate は `0.0.1` から開始します
- 実行時互換性は `assert_compatible(...)` で必要な capability/op を指定して確認します。

互換性は “契約/能力” で保証し、バージョン文字列の厳密一致には依存しません:
Expand Down
30 changes: 27 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ CCCC SDK provides **client SDKs** for building applications on top of the CCCC p

- CCCC core repository: https://github.com/ChesterRa/cccc
- `cccc` (core) ships the daemon/web/CLI and owns runtime state in `CCCC_HOME`.
- `cccc-sdk` (this repo) provides Python/TypeScript clients for **Daemon IPC v1**.
- `cccc-sdk` (this repo) provides Python, TypeScript, and Rust clients for **Daemon IPC v1**.
- The SDK is not a standalone framework. It always talks to a running CCCC daemon.

If SDK clients and CCCC Web use the same `CCCC_HOME`, all writes are shared immediately
Expand All @@ -22,6 +22,7 @@ If SDK clients and CCCC Web use the same `CCCC_HOME`, all writes are shared imme

- `python/` — Python package (`cccc-sdk`, import name `cccc_sdk`)
- `ts/` — TypeScript package (`cccc-sdk`)
- `rust/` — Rust crate (`cccc-sdk`, crate name `cccc_sdk`)
- `spec/CCCC_*.md` and `spec/CCCS_V1.md` — mirrored CCCC contract docs
- `spec/SDK_*.md` — SDK-owned surface notes that are not yet core standards

Expand All @@ -34,6 +35,7 @@ Typical use cases:
For language-specific details:
- Python SDK: `python/README.md`
- TypeScript SDK: `ts/README.md`
- Rust SDK: `rust/README.md`

---

Expand Down Expand Up @@ -65,7 +67,6 @@ from cccc_sdk import CCCCClient
c = CCCCClient()
c.assert_compatible(
require_ipc_v=1,
require_ops=["groups", "send", "reply", "tracked_send", "context_sync"],
require_ops=["groups", "send", "reply", "inbox_list", "context_get", "context_sync"],
)
print("OK: daemon is compatible")
Expand All @@ -85,12 +86,35 @@ python python/examples/stream.py --group g_xxx
python python/examples/auto_ack_attention.py --group g_xxx --actor user
```

## Quick start (Rust)

```toml
[dependencies]
cccc-sdk = "0.0.1"
```

```rust
use cccc_sdk::{CCCCClient, CompatibilityRequirements};

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

---

## Versioning and compatibility

SDK releases follow daemon contracts, not strict daemon version strings:
- Python and TypeScript package versions track the current SDK release line, while RC sequencing remains SDK-owned.
- Python and TypeScript package versions track the current SDK release line; the
Rust crate starts at `0.0.1` while its public API settles.
- Use `assert_compatible(...)` with required capabilities/ops for runtime gating.

Compatibility is enforced by **contracts**, not by strict version string matching:
Expand Down
19 changes: 15 additions & 4 deletions README.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
[English](README.md) | **中文** | [日本語](README.ja.md)

> 状态:**面向 CCCC Daemon IPC v1 的契约优先 SDK**。`main` 上的源码包面向
> 当前源码包面向 CCCC 0.4.33;发布仍是独立的 release 步骤。具体范围见 `CHANGELOG.md`
> CCCC 0.4.33;发布仍是独立的 release 步骤。具体范围见 `CHANGELOG.md`
> 与 `spec/ADAPTATION_PLAN.md`。

CCCC SDK 是一套用于 CCCC 平台的**客户端 SDK**。
Expand All @@ -12,7 +12,7 @@ CCCC SDK 是一套用于 CCCC 平台的**客户端 SDK**。

- CCCC 本体仓库:https://github.com/ChesterRa/cccc
- `cccc`(本体)负责 daemon/web/CLI,以及 `CCCC_HOME` 下的运行时状态。
- `cccc-sdk`(本仓库)提供 Python/TypeScript 客户端,调用 **Daemon IPC v1**。
- `cccc-sdk`(本仓库)提供 PythonTypeScript 和 Rust 客户端,调用 **Daemon IPC v1**。
- SDK 不是独立框架,必须连接到已运行的 CCCC daemon。

只要 SDK 与 CCCC Web 指向同一个 `CCCC_HOME`,写入会立即互通
Expand All @@ -22,6 +22,7 @@ CCCC SDK 是一套用于 CCCC 平台的**客户端 SDK**。

- `python/` — Python 包(PyPI 名称 `cccc-sdk`,import 名称 `cccc_sdk`)
- `ts/` — TypeScript 包(`cccc-sdk`)
- `rust/` — Rust crate(`cccc-sdk`,crate 名称 `cccc_sdk`)
- `spec/` — SDK 开发使用的合约文档镜像

典型场景:
Expand All @@ -33,6 +34,7 @@ CCCC SDK 是一套用于 CCCC 平台的**客户端 SDK**。
语言细分文档:
- Python SDK:`python/README.md`
- TypeScript SDK:`ts/README.md`
- Rust SDK:`rust/README.md`

---

Expand Down Expand Up @@ -64,7 +66,6 @@ from cccc_sdk import CCCCClient
c = CCCCClient()
c.assert_compatible(
require_ipc_v=1,
require_ops=["groups", "send", "reply", "tracked_send", "context_sync"],
require_ops=["groups", "send", "reply", "inbox_list", "context_get", "context_sync"],
)
print("OK: daemon is compatible")
Expand All @@ -84,12 +85,22 @@ python python/examples/stream.py --group g_xxx
python python/examples/auto_ack_attention.py --group g_xxx --actor user
```

## 快速开始(Rust)

```toml
[dependencies]
cccc-sdk = "0.0.1"
```

Rust 客户端会自动发现 `CCCC_HOME` 下的 Unix Socket/TCP daemon,并提供通用
`call` 以及常用的 group、chat、inbox、context 方法。完整示例见 `rust/README.md`。

---

## 版本策略与兼容性

SDK 发布跟随 daemon 合约,而不是硬匹配 daemon 版本号:
- Python 和 TypeScript 包版本跟随当前 SDK 发布线;RC 序号由 SDK 自身维护
- Python 和 TypeScript 包版本跟随当前 SDK 发布线;Rust crate 从 `0.0.1` 起步
- 运行时兼容请用 `assert_compatible(...)` 指定所需 capability/op。

我们保证兼容性的手段是“契约/能力”,而不是字符串版本号硬匹配:
Expand Down
30 changes: 28 additions & 2 deletions RELEASING.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
# Releasing `cccc-sdk`

This repo is a monorepo with two deliverables:
This repo is a monorepo with three deliverables:
- Python package: `python/` (PyPI name: `cccc-sdk`)
- TypeScript package: `ts/` (npm name: `cccc-sdk`)
- Rust crate: `rust/` (crates.io name: `cccc-sdk`)

## Versioning policy

- SDK version tracks the supported CCCC line: currently `0.4.33`.
- RC sequence is SDK-owned (`0.4.33rcN` for Python, `0.4.33-rc.N` for npm).
- The Rust crate begins at `0.0.1` while its public API settles.
- Compatibility is enforced by contracts/capabilities/op-probing, not by matching RC numbers.

## 0) Sync specs (recommended)
Expand Down Expand Up @@ -96,7 +98,29 @@ cd ts
npm publish --access public
```

## 3) Post-release sanity
## 3) Rust release (crates.io)

### Local checks

```bash
cd rust
cargo fmt --check
cargo clippy --all-targets --all-features -- -D warnings
cargo test --all-targets
cargo package --locked
```

### Publish

```bash
cd rust
cargo publish --locked --registry crates-io
```

Published crate versions are immutable. Confirm the package file list and
metadata before running `cargo publish`.

## 4) Post-release sanity

- Run Python compat check against a running daemon:

Expand All @@ -105,3 +129,5 @@ python python/examples/compat_check.py
```

- Verify npm package installs and can `import { CCCCClient } from 'cccc-sdk'`.
- Verify `cargo info cccc-sdk --registry crates-io` reports the expected Rust
crate version and repository.
Loading
Loading