claude-connector: token from a systemd credential, pin before every spawn, prompts in prompt_dir, door set 401/403/429

Delete EnvLookup and the connector's own environment as a token source; a
TokenSource port reads $CREDENTIALS_DIRECTORY/<token_credential> at each use
(claude-connector-token-credential). binary_matches_pin is the one pin check,
used by ready() and before every spawn. PromptFile::create stages into the
configured prompt_dir instead of temp_dir(). The zero-bill door set is exactly
401, 403 and 429 with explicitly empty since-last usage, pinned by a table over
statuses and usage shapes. Soul s2's stderr-join probe is committed. The three
price types gain serde derives so the price table can live in the config
document.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Meta Vens 2026-10-29 11:26:30 +01:00
commit 9a062f0846
9 changed files with 442 additions and 95 deletions

View file

@ -119,7 +119,7 @@ impl CallerAdmission {
}
/// What one million tokens of each class cost, in micro-USD.
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
pub struct Rates {
pub input: u64,
pub cache_write_short: u64,
@ -129,7 +129,7 @@ pub struct Rates {
}
/// The rates a prompt strictly above `above_prompt_tokens` is priced at.
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
pub struct LongContext {
pub above_prompt_tokens: u64,
pub rates: Rates,
@ -138,7 +138,7 @@ pub struct LongContext {
/// One model's price. Explicit zero rates are admitted (a local model is
/// free); a missing price is not. `overhead_tokens` is added to the byte
/// bound of a request when its worst case is reserved.
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
pub struct ModelPrice {
pub rates: Rates,
pub long_context: Option<LongContext>,