v0.2 scaffold: vendor clawdforge SDK + forge module + Whisper plan
The Rust SDK already existed at Sulkta-OSS/clawdforge clients/rust/ — async,
reqwest-based, bearer-auth, exposes Client::run() + Session for multi-turn.
Vendoring it into vendor/clawdforge so skald is self-contained: no
git-submodule + no needing the clawdforge repo cloned next to skald.
Trade-off accepted: updates require manual re-copy until both sides
stabilize and we publish to a private cargo registry.
What landed:
- vendor/clawdforge/ — full SDK source from Sulkta-OSS/clawdforge HEAD.
Pinned in skald-core/Cargo.toml as a path dep.
- skald-core/src/forge.rs — three-pass orchestration shell. Forge wraps
clawdforge::Client; generate() / cleanup() / audit() each build a
RunRequest with the right system prompt + model alias (always opus),
call client.run(), return a PassOutput.
Prompt templates are TODO stubs (SYSTEM_GEN_TODO etc) — filling in the
actual prose-craft prompts is its own deep session.
- skald-core/src/config.rs — ForgeConfig { base_url, app_token, model }.
Resolved by the binary from env (CLAWDFORGE_URL + CLAWDFORGE_TOKEN);
lib stays env-agnostic.
- skald-core::AuditFinding + AuditResponse — parse shape for what the
third-Opus canon audit returns, ready to map onto audit_findings rows.
- docs/tts-pipeline.md — full plan for v0.2 narration + post-TTS audit
chain. Whisper-large-v3 STT does text-to-text verification on every
render; an optional Gemini Flash audio pass catches subjective issues
(prosody, tone) Whisper can't see. Reroll loop on crit findings.
What's still stubbed:
- Prompt templates in forge.rs (gen / cleanup / audit) — placeholders
that describe the role but don't constrain output shape yet.
- context.rs (assemble the LLM context blob from DB rows) — entire module
TBD.
- No CLI subcommand yet for invoking forge — that comes after context.rs.
Naming note: in Rust 2024 'gen' is a reserved keyword (for generators),
so the method is Forge::generate(), not Forge::gen().
This commit is contained in:
parent
79f4393f00
commit
8cbc9e04eb
17 changed files with 3340 additions and 19 deletions
58
vendor/clawdforge/src/lib.rs
vendored
Normal file
58
vendor/clawdforge/src/lib.rs
vendored
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
//! 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://git.sulkta.com/Sulkta-OSS/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,
|
||||
TokenCreateRequest, TokenList,
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue