Files
clawmates/crates/tc-api/Cargo.toml
T
Omar SobhandClaude Fable 5 a8efada690 P5 exit: usage metering, credit billing, promo codes, 3-step wizard
- LlmEvent::Usage across all three providers (Scripted deterministic
  word-count accounting; Anthropic message_start/delta usage; OpenAI-compat
  stream_options include_usage)
- tc-billing: ceil(tokens/1000) min 1 credit; lots drain oldest-first under
  FOR UPDATE; balance clamps at zero while the usage ledger records the
  full obligation; promo codes redeem exactly once via CAS (migration 0006)
- Runtime charges every completed run (billing failure never fails a run);
  proven: 1 token in + 3 out -> 1 credit deducted
- API: GET /api/team/usage, POST /api/credits/redeem (409 on reuse, audited)
- Credits page: balance, 7-day usage meter with runway estimate, PromoRedeem
- /claws/new is the full §9 wizard: ?step=identity|access|slack deep-linked
  progress, accent swatches + name randomizer, access toggles, optional
  Slack step, explicit review-and-confirm (creation = live agent), animated
  provisioning state -> straight into chat
- E2E: chat decrements the visible balance and fills the usage meter;
  WELCOME500 adds exactly 500 once then refuses; wizard round trip

140 Rust + 63 frontend tests + 23 Playwright journeys.

Co-Authored-By: Claude Fable 5 <[email protected]>
2026-06-10 07:19:34 -05:00

47 lines
1.2 KiB
TOML

[package]
name = "tc-api"
version = "0.1.0"
edition.workspace = true
rust-version.workspace = true
license.workspace = true
publish.workspace = true
[dependencies]
async-stream = "0.3"
axum = "0.8"
futures = "0.3"
serde = { workspace = true }
serde_json = { workspace = true }
sqlx = { workspace = true }
reqwest = { version = "0.12", default-features = false, features = ["json", "rustls-tls"] }
tc-auth = { path = "../tc-auth" }
tc-billing = { path = "../tc-billing" }
tc-config = { path = "../tc-config" }
tc-db = { path = "../tc-db" }
tc-domain = { path = "../tc-domain" }
tc-runtime = { path = "../tc-runtime" }
tc-safety = { path = "../tc-safety" }
tc-scheduler = { path = "../tc-scheduler" }
tc-secrets = { path = "../tc-secrets" }
thiserror = { workspace = true }
time = { workspace = true }
tokio = { workspace = true }
urlencoding = "2"
uuid = { workspace = true }
[dev-dependencies]
eventsource-stream = "0.2"
reqwest = { version = "0.12", default-features = false, features = [
"json",
"rustls-tls",
"stream",
] }
tc-llm = { path = "../tc-llm" }
tc-testkit = { path = "../tc-testkit" }
hex = "0.4"
hmac = "0.12"
sha2 = "0.10"
[lints]
workspace = true