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,95 @@
|
||||
//! Slack outbound posting (§7.3): a §15 gated category, and the first
|
||||
//! tool whose approved execution happens INSIDE the secret broker — the
|
||||
//! runtime never touches the bot token, and the broker independently
|
||||
//! consumes the single-use grant before calling Slack.
|
||||
|
||||
use cm_llm::ToolDescriptor;
|
||||
use cm_tools::Effect;
|
||||
use serde_json::{json, Value};
|
||||
|
||||
use super::{Tool, ToolContext};
|
||||
|
||||
pub struct SlackPost;
|
||||
|
||||
#[async_trait::async_trait]
|
||||
impl Tool for SlackPost {
|
||||
fn descriptor(&self) -> ToolDescriptor {
|
||||
ToolDescriptor {
|
||||
name: "slack.post".into(),
|
||||
description: "Posts a message to a Slack channel. Requires \
|
||||
human approval before it executes."
|
||||
.into(),
|
||||
input_schema: json!({
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"channel": {"type": "string"},
|
||||
"text": {"type": "string"},
|
||||
},
|
||||
"required": ["channel", "text"],
|
||||
}),
|
||||
}
|
||||
}
|
||||
|
||||
fn effects(&self) -> &'static [Effect] {
|
||||
&[Effect::SendsExternally]
|
||||
}
|
||||
|
||||
/// The broker consumes the execution grant itself; the runtime must
|
||||
/// not pre-consume it.
|
||||
fn broker_executed(&self) -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
fn preview(&self, input: &Value) -> Value {
|
||||
json!({
|
||||
"summary": format!(
|
||||
"Post to Slack {}",
|
||||
input["channel"].as_str().unwrap_or("(missing channel)")
|
||||
),
|
||||
"channel": input["channel"],
|
||||
"text": input["text"],
|
||||
})
|
||||
}
|
||||
|
||||
async fn execute(&self, ctx: &ToolContext, input: Value) -> Result<Value, String> {
|
||||
let channel = input["channel"].as_str().ok_or("missing 'channel'")?;
|
||||
let text = input["text"].as_str().ok_or("missing 'text'")?;
|
||||
let approval_id = ctx
|
||||
.approval_id
|
||||
.ok_or("slack.post can only run as an approved gated action")?;
|
||||
let socket = ctx
|
||||
.broker_socket
|
||||
.as_ref()
|
||||
.ok_or("secret broker is not configured")?;
|
||||
|
||||
let connection = cm_db::repo::connections::find_provider(
|
||||
&ctx.pool,
|
||||
ctx.workspace_id,
|
||||
ctx.agent_id,
|
||||
"slack",
|
||||
)
|
||||
.await
|
||||
.map_err(|e| e.to_string())?
|
||||
.ok_or("Slack is not connected for this claw")?;
|
||||
let secret_ref = connection
|
||||
.secret_ref
|
||||
.ok_or("connection has no credential")?;
|
||||
|
||||
let mut broker = cm_secrets::BrokerClient::connect(socket)
|
||||
.await
|
||||
.map_err(|e| format!("broker unreachable: {e}"))?;
|
||||
let status = broker
|
||||
.invoke_http(
|
||||
approval_id,
|
||||
secret_ref,
|
||||
&format!("{}/chat.postMessage", ctx.slack_base_url),
|
||||
json!({"channel": channel, "text": text}),
|
||||
)
|
||||
.await
|
||||
.map_err(|e| format!("slack post failed: {e}"))?;
|
||||
if !(200..300).contains(&(status as u16 as i32 as u16)) && status != 200 {
|
||||
return Err(format!("slack returned status {status}"));
|
||||
}
|
||||
Ok(json!({ "posted": true, "channel": channel, "status": status }))
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user