hermes-agent/apps/shared/src/index.ts
Brooklyn Nicholson 960d339f86 feat(billing): shared cross-surface out-of-credits signal
Detect a billing wall once (agent/error_classifier → FailoverReason.billing) and
map it to a recovery link + label in one place, then carry that structured
BillingBlock to every surface instead of re-parsing free-form error text per
surface.

- agent/billing_links.py: provider-agnostic slug/host → (label, billing URL)
  table (single source of truth), Nous-aware (is_nous routes to the in-app flow);
  unknown providers degrade to a readable label with no invented URL.
- conversation_loop: both billing exit paths return a billing_block through one
  helper; the guidance message carries the derived URL for every provider.
- gateway forwards billing_block on message.complete (it was dropped).
- @hermes/shared: BillingBlock type shared by desktop + TUI.
2026-07-22 18:08:59 -05:00

66 lines
1.5 KiB
TypeScript

export {
BILLING_REFUSAL_POLICY,
type BillingRecovery,
type BillingRefusalPolicy,
refusalPolicy
} from './billing-policy'
export type {
BillingAutoReload,
BillingBlock,
BillingCardInfo,
BillingChargeResponse,
BillingChargeStatusResponse,
BillingErrorPayload,
BillingMonthlyCap,
BillingMutationResponse,
BillingRefusalCode,
BillingStateResponse,
ChargeFailureReason,
KnownBillingRefusalCode,
KnownChargeFailureReason,
SubscriptionPreviewResponse,
SubscriptionStateResponse,
SubscriptionTierOption,
SubscriptionUpgradeResponse,
UsageBarData,
UsageModelData
} from './billing-types'
export {
driveChargeSettlement,
SETTLEMENT_MAX_RETRY_AFTER_MS,
SETTLEMENT_POLL_CAP_MS,
SETTLEMENT_POLL_INTERVAL_MS,
type SettlementDeps,
type SettlementOutcome
} from './charge-settlement'
export {
type ConnectionState,
type GatewayClientOptions,
type GatewayEvent,
type GatewayEventName,
type GatewayRequestId,
type JsonRpcFrame,
JsonRpcGatewayClient,
type WebSocketLike
} from './json-rpc-gateway'
export {
type HermesSkin,
SKIN_BRANDING_TOKENS,
SKIN_COLOR_TOKENS,
type SkinBranding,
type SkinBrandingToken,
type SkinColors,
type SkinColorToken
} from './skin'
export {
buildHermesWebSocketUrl,
type GatewayAuthMode,
GatewayReauthRequiredError,
type GatewayWsConnection,
type GatewayWsUrlResult,
type HermesWebSocketUrlOptions,
isGatewayReauthRequired,
resolveGatewayWsUrl,
type ResolveGatewayWsUrlDeps,
type WebSocketAuthParam
} from './websocket-url'