Documentation
¶
Overview ¶
Package wstoken acquires per-workspace proxy tokens from agentserver and caches them in-process so cc-broker can stamp them onto every spawned Claude CLI's ANTHROPIC_AUTH_TOKEN env without hitting the network on every turn.
Index ¶
Constants ¶
const CacheTTL = 5 * time.Minute
CacheTTL bounds how long a fetched token is reused before re-validating against agentserver. Short enough that a token rotation / workspace deletion is picked up within a few minutes; long enough that steady- state turn dispatch never hits the network for token lookup.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client acquires and caches workspace proxy tokens from agentserver:/internal/workspace-token.
func (*Client) GetOrCreate ¶
GetOrCreate returns the workspace's proxy token, fetching it from agentserver on first request (or after CacheTTL has elapsed) and caching the result. The agentserver endpoint is itself idempotent so concurrent first-time fetches converge.
func (*Client) Invalidate ¶
Invalidate drops the cached token for a workspace, forcing the next GetOrCreate to fetch fresh. Call this when an upstream returned 401 for the cached value (e.g., the workspace was deleted and its token row went with it). Safe to call for absent workspaces.