Commit graph

5 commits

Author SHA1 Message Date
65ea96bb1f RunRequest: add effort (low|medium|high|xhigh|max)
Mirrors the system_mode wiring: optional field on the wire,
maps to 'claude -p --effort <level>'. None lets the CLI default
decide. Right for prose-craft tasks (skald) where the author
persona benefits from extra thinking budget.
2026-05-13 14:19:05 -07:00
d4c3a9d2de RunRequest: add system_mode (append|replace)
Why this matters:
- Default 'append' (--append-system-prompt): caller's system text
  is ADDED to Claude's default base prompt ('I am Claude, an AI
  assistant...'). Right for tool-using assistants and coding agents
  where the helpful-honest defaults are useful substrate. Every
  existing caller (cauldron, petalparse, etc) ran in this mode
  implicitly.

- New 'replace' (--system-prompt): caller's system text REPLACES
  the default base prompt entirely. Right for personas — fiction
  authors, chat bots, in-world characters — where Claude's defaults
  would bleed through as friction. The model BECOMES the persona
  rather than 'Claude playing the persona.'

Trigger for adding this: skald v0.3 — authors as personas with
souls. Orson Black writing a Chernobyl piece can't have Claude's
default helpfulness softening the prose; the soul needs to be the
prompt, not append to it.

Wire shape:
- server.py: Literal['append','replace']|None in RunRequest, default 'append'
- runner.py: branch on system_mode to pick the right CLI flag
- clients/rust: SystemMode enum, Option<SystemMode> on RunRequest

Backward compatible: clients that don't set system_mode get append
semantics (the existing behavior).
2026-05-13 11:27:40 -07:00
e0f161f18c clients/rust: v0.2 multi-turn Session API
- Session with consume-self close() (compile-time use-after-close)
- AtomicBool flag + Drop best-effort async close via tokio::spawn (logged on failure)
- Client::new_session / list_sessions / get_session
- TurnResult.text() helper, hand-written Debug to avoid bearer leak
- tests/sessions.rs: 12 tests covering new/close/idempotent/drop/list/state/404/text/debug-redaction
- README "Multi-turn / Sessions (v0.2)" section

v0.1 run path unchanged.

Spec: memory/spec-clawdforge-v0.2.md
Server core: 940861f
2026-04-29 06:39:37 -07:00
ebbd7cc553 clients/rust: apply audit findings — UTF-8 panic + Debug redaction + path-traversal (062d405 → next)
HIGH:
- H1: truncate() uses floor_char_boundary (was panicking on multibyte boundaries)
- H2: hand-written Debug for Client/ClientBuilder/AppToken redacts bearer (was leaking via dbg!()/tracing)
- H3: revoke_token validates name client-side (rejects path traversal sequences)

MEDIUM:
- M1: From<reqwest::Error> maps timeouts to Error::Timeout (was always Transport)
- M2: revoke_token accepts 2xx empty body (was rejecting RFC-correct 204 No Content)
- M3: tests use assert!(matches!) instead of matches!().then_some().unwrap()
- M4: ClientBuilder.max_upload_bytes optional cap
- M5: lib.rs deny(missing_docs)

LOW:
- L1: cargo fmt
- L2: drop dead AUTHORIZATION import

Audit: memory/clawdforge-audits/rust-062d405.md
2026-04-28 23:26:22 -07:00
062d405a9e clients/rust: initial Rust SDK for clawdforge
Async client over reqwest+tokio with builder-pattern Client, serde
RunRequest/RunResult/FileToken/AppToken types, thiserror Error enum,
streaming multipart upload via tokio::fs::File, and 14 wiremock-backed
integration tests covering healthz, run-success-json, run-success-text,
run-502, run-with-files, file-upload, token mint/list/revoke, auth
failure, missing-token short-circuit, transport timeout, and builder
validation. Doc-tested. cargo test, cargo clippy --all-targets -D
warnings, and cargo build --examples all clean.
2026-04-28 22:35:16 -07:00