SSE stream for credential rotation events
Runtime-worker-JWT-only Server-Sent Events endpoint. Requires `worker:session`. Before any credential read or subscription, the platform resolves the canonical secret-release scope from the active worker row and claimed session: JWT worker (`sub`), org, and project claims must exactly match the active worker; the session must be owned by that worker in the same org/project scope. Missing or mismatched ownership is collapsed to 404. The stream fails closed: authentication, canonical scope resolution, credential-gate evaluation, initial snapshot materialization/filtering, and rotation subscription registration all complete before `text/event-stream` is returned. It emits `INITIAL`, then filtered `UPDATE` events when an upstream OAuth rotation occurs, plus heartbeat events. Dependency failures return 503 instead of opening a partial stream.
Authorization
workerJwt Short-lived worker runtime JWT minted by the platform. Claims bind the worker, project, organization, registration, and scopes.
In: header
Query Parameters
Claimed session id owned by the runtime worker JWT subject in the canonical active-worker org/project scope.
Response Body
text/event-stream
application/json
application/json
application/json
application/json
application/json
curl -X GET "https://example.com/api/daemon/credentials/rotate-stream?sessionId=string""string"{
"error": "Session not found"
}{
"error": "Session not found"
}{
"error": "Session not found"
}{
"error": "Session not found"
}{
"error": "Session not found"
}Trigger credential rotation fan-out
Called by the operator (CLI or admin UI) after rotating an upstream credential (Vault, 1Password, encrypted DB row, …). Re-resolves the `(orgId, kind)` tuple via the credential provider registry and fans the fresh value out to every live `rotate-stream` SSE subscriber for that org. Zero live subscribers is not an error. Auth: `Bearer rsk_*` via `getCliOrSessionAuth`. The `orgId` in the body must match the authenticated org. For `session` / `user_token` auth the caller must have `admin` or `owner` role; for `api_key` auth the cross-tenant guard is sufficient. The audit write is deferred (`after()`) and failures are non-fatal - the fan-out already fired.
Resolve credential env map for a session
Runtime-worker-JWT-only secret-release endpoint used at session spawn. Requires `worker:session`. Before any credential read, the platform resolves the canonical scope from the active worker row and claimed session: JWT worker (`sub`), org, and project claims must exactly match the active worker; the session must be owned by that worker in the same organization, and session project metadata must match when present. Body `orgId` must match that canonical scope and optional `projectId` is an exact assertion, never an override. Missing or mismatched ownership is collapsed to 404. Returns the blocklist-filtered agent environment and refresh horizon. The optional synthetic `poolId` is cost-attribution metadata and is not emitted into the agent environment. Audit is appended asynchronously without secret values.