skald/vendor/clawdforge/src/lib.rs
Kayos e1e782177d vendor/clawdforge: refresh SDK — adds SystemMode::Replace for personas
Re-vendored from clawdforge@d4c3a9d. RunRequest now carries
`system_mode: Option<SystemMode>` where SystemMode is Append (the
default, current behavior — append to claude's base prompt) or
Replace (new — replaces claude's base prompt entirely).

Replace mode is the unlock for v0.3 author personas: Orson Black /
Bay / Kayos as authors can't have Claude's default helpful-honest
defaults bleeding through. Replace makes the model BECOME the
persona instead of 'Claude playing the persona.'

Existing skald::summarize call stays on default (Append) — the
summarizer is more 'tool-use over text' than persona, and Claude's
defaults help there. The gen + cleanup passes will switch to
Replace once authors are wired (next step).
2026-05-13 11:30:13 -07:00

58 lines
1.8 KiB
Rust

//! Async Rust client for the [clawdforge] HTTP service.
//!
//! clawdforge is a small LAN-only service that wraps `claude -p` subprocess
//! calls behind a bearer-token-gated REST API. This crate is a thin,
//! ergonomic Rust SDK for it.
//!
//! # Quickstart
//!
//! ```no_run
//! use clawdforge::{Client, RunRequest};
//!
//! # async fn run() -> Result<(), Box<dyn std::error::Error>> {
//! let client = Client::builder()
//! .base_url("http://localhost:8800")
//! .token("cf_xxxxxxxxxxxxxxxx")
//! .build()?;
//!
//! let h = client.healthz().await?;
//! println!("claude present: {}", h.claude_present);
//!
//! let r = client.run(RunRequest {
//! prompt: "Reply with JSON: {\"hello\":\"world\"}".into(),
//! model: Some("sonnet".into()),
//! ..Default::default()
//! }).await?;
//!
//! #[derive(serde::Deserialize)]
//! struct Hello { hello: String }
//! let typed: Hello = r.as_json()?;
//! println!("{}", typed.hello);
//! # Ok(()) }
//! ```
//!
//! [clawdforge]: https://gitea.sulkta.com/Sulkta-Coop/clawdforge
//!
//! # Field naming
//!
//! The clawdforge wire format is snake_case end-to-end (Python / Pydantic
//! conventions), so structs in [`crate::types`] do **not** carry
//! `#[serde(rename_all = "camelCase")]`. If a future endpoint exposes
//! camelCase, prefer per-field `#[serde(rename = "...")]` over a blanket
//! container attribute.
#![deny(rust_2018_idioms)]
#![deny(missing_docs)]
mod client;
mod error;
pub mod session;
pub mod types;
pub use client::{Client, ClientBuilder};
pub use error::Error;
pub use session::{Session, SessionList, SessionOptions, SessionState, TurnEvent, TurnResult};
pub use types::{
AppToken, AppTokenInfo, FileToken, Healthz, RunFailure, RunRequest, RunResult,
SystemMode, TokenCreateRequest, TokenList,
};