Rebrand: TeamClaw -> Clawmates (clawmates.work)
Full-depth rename per the approved plan; the 'claw' product vocabulary (claws, /claws routes, clawId, Claw Chat) stays — it is now the brand. - Display brand: Clawmates (manifest, titles, hero, login/rail logo 'clawmates'); default host app.clawmates.work; registry ghcr.io/clawmates - Crates tc-* -> cm-* (16 crates + all imports); binaries clawmates-server/broker/bundler; images clawmates/*; env prefix CLAWMATES_* (+ CM_TEST_DATABASE_URL / CM_LIVE_LLM); config clawmates.toml; helm chart deploy/helm/clawmates with clawmates-* resources; db names clawmates*; sockets /run/clawmates; cookie cm_session; kind cluster clawmates-test; seccomp node profile clawmates-agent-profile.json - All 9 Playwright brand assertions updated in lockstep; historical spec document left untouched as the only remaining 'TeamClaw' - Local env migrated: dev pg clawmates-dev-pg/clawmates_dev, shared test server clawmates-test-pg, kind cluster recreated with image + profile, compose images rebuilt under clawmates/* Verified end to end: 161 Rust + 68 frontend tests, 29 Playwright journeys, 4 live kind tests, helm/install/LOC/placeholder gates, and the clean-room install rehearsal serving the clawmates login page from a signed bundle of the rebuilt images. Co-Authored-By: Claude Fable 5 <[email protected]>
This commit is contained in:
co-authored by
Claude Fable 5
parent
8046853feb
commit
add4f79fed
@@ -0,0 +1,111 @@
|
||||
use futures::stream::BoxStream;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_json::Value;
|
||||
|
||||
/// Provider-neutral conversation role.
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "lowercase")]
|
||||
pub enum ChatRole {
|
||||
User,
|
||||
Assistant,
|
||||
}
|
||||
|
||||
/// Provider-neutral message content. Tool results travel as user-role parts,
|
||||
/// matching both wire formats' conventions.
|
||||
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
|
||||
#[serde(tag = "type", rename_all = "snake_case")]
|
||||
pub enum ContentPart {
|
||||
// Struct variant (not newtype): internally-tagged enums cannot
|
||||
// serialize newtype primitives, and this type round-trips through
|
||||
// `agent_runs.checkpoint`.
|
||||
Text {
|
||||
text: String,
|
||||
},
|
||||
ToolUse {
|
||||
id: String,
|
||||
name: String,
|
||||
input: Value,
|
||||
},
|
||||
ToolResult {
|
||||
tool_use_id: String,
|
||||
content: Value,
|
||||
},
|
||||
}
|
||||
|
||||
impl ContentPart {
|
||||
/// Convenience constructor for plain text parts.
|
||||
pub fn text(value: impl Into<String>) -> ContentPart {
|
||||
ContentPart::Text { text: value.into() }
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
|
||||
pub struct ChatMessage {
|
||||
pub role: ChatRole,
|
||||
pub parts: Vec<ContentPart>,
|
||||
}
|
||||
|
||||
/// A tool offered to the model. `input_schema` is JSON Schema.
|
||||
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
|
||||
pub struct ToolDescriptor {
|
||||
pub name: String,
|
||||
pub description: String,
|
||||
pub input_schema: Value,
|
||||
}
|
||||
|
||||
/// The checkpointable, provider-neutral request. This struct is what gets
|
||||
/// serialized into `agent_runs.checkpoint`, so resume works identically
|
||||
/// across providers.
|
||||
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
|
||||
pub struct ChatRequest {
|
||||
pub system: String,
|
||||
pub messages: Vec<ChatMessage>,
|
||||
pub tools: Vec<ToolDescriptor>,
|
||||
pub model: String,
|
||||
pub max_tokens: u32,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum StopReason {
|
||||
EndTurn,
|
||||
ToolUse,
|
||||
MaxTokens,
|
||||
}
|
||||
|
||||
/// Streaming events every provider normalizes to.
|
||||
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
|
||||
#[serde(tag = "type", rename_all = "snake_case")]
|
||||
pub enum LlmEvent {
|
||||
TextDelta(String),
|
||||
ToolUse {
|
||||
id: String,
|
||||
name: String,
|
||||
input: Value,
|
||||
},
|
||||
/// Token accounting for this provider call (drives credit metering).
|
||||
Usage {
|
||||
input_tokens: u32,
|
||||
output_tokens: u32,
|
||||
},
|
||||
Stop(StopReason),
|
||||
}
|
||||
|
||||
#[derive(Debug, thiserror::Error)]
|
||||
pub enum LlmError {
|
||||
#[error("scenario error: {0}")]
|
||||
Scenario(String),
|
||||
#[error("transport error: {0}")]
|
||||
Transport(String),
|
||||
#[error("provider returned an error: {0}")]
|
||||
Api(String),
|
||||
#[error("malformed provider response: {0}")]
|
||||
Wire(String),
|
||||
}
|
||||
|
||||
pub type EventStream = BoxStream<'static, Result<LlmEvent, LlmError>>;
|
||||
|
||||
#[async_trait::async_trait]
|
||||
pub trait LlmProvider: Send + Sync {
|
||||
async fn stream(&self, request: ChatRequest) -> Result<EventStream, LlmError>;
|
||||
}
|
||||
Reference in New Issue
Block a user