Component evidence
Polls billing charge status until settled, failed, refused, or timeout, using configurable intervals and retry caps.
// Source: https://github.com/umanitek/agent-blackbox | License: MIT | Copyright 2025 Nous Research
// Provided via justclaw.it.com; keep this notice with the code.
import { refusalPolicy } from './billing-policy.js'
import type { BillingChargeStatusResponse } from './billing-types.js'
export interface SettlementDeps {
fetchStatus(): Promise<BillingChargeStatusResponse>
sleep(ms: number): Promise<void>
isCancelled(): boolean
now(): number
}
export type SettlementOutcome =
| { kind: 'settled'; status: BillingChargeStatusResponse }
| { kind: 'failed'; status: BillingChargeStatusResponse }
| { kind: 'refused'; error: string; status: BillingChargeStatusResponse }
| {
kind: 'ambiguous'
error: string
status?: BillingChargeStatusResponse
cause?: unknown
... (truncated -- full source via MCP)