From b1fc6530815ca453d5f2ffd9225ecec35b0d8e93 Mon Sep 17 00:00:00 2001 From: nousbot-eng Date: Sat, 18 Jul 2026 11:12:47 -0400 Subject: [PATCH] fmt(js): `npm run fix` on merge (#66983) Co-authored-by: github-actions[bot] --- .../src/app/settings/billing/errors.test.ts | 3 +- .../src/app/settings/billing/errors.ts | 1 - .../src/app/settings/billing/types.test.ts | 5 +- .../billing/use-billing-state.test.ts | 2 + .../app/settings/billing/use-charge-poller.ts | 7 +- apps/shared/src/index.ts | 68 +++++++++---------- ui-tui/src/app/slash/commands/topup.ts | 5 +- ui-tui/src/gatewayTypes.ts | 20 ++++-- 8 files changed, 57 insertions(+), 54 deletions(-) diff --git a/apps/desktop/src/app/settings/billing/errors.test.ts b/apps/desktop/src/app/settings/billing/errors.test.ts index f478f8ca5266..82ed48091d7d 100644 --- a/apps/desktop/src/app/settings/billing/errors.test.ts +++ b/apps/desktop/src/app/settings/billing/errors.test.ts @@ -1,6 +1,5 @@ -import { describe, expect, it } from 'vitest' - import type { KnownBillingRefusalCode } from '@hermes/shared/billing' +import { describe, expect, it } from 'vitest' import type { BillingRefusal } from './api' import { resolveRefusal } from './errors' diff --git a/apps/desktop/src/app/settings/billing/errors.ts b/apps/desktop/src/app/settings/billing/errors.ts index 90207d3d37cb..f368a9e0abc1 100644 --- a/apps/desktop/src/app/settings/billing/errors.ts +++ b/apps/desktop/src/app/settings/billing/errors.ts @@ -93,7 +93,6 @@ export const resolveRefusal = (refusal: BillingRefusal): BillingRefusalPresentat message: "This token isn't bound to an org you can manage", title: 'Org access denied' } - case 'monthly_cap_exceeded': { const remaining = refusal.payload?.remainingUsd diff --git a/apps/desktop/src/app/settings/billing/types.test.ts b/apps/desktop/src/app/settings/billing/types.test.ts index a189309a4615..320cc9248310 100644 --- a/apps/desktop/src/app/settings/billing/types.test.ts +++ b/apps/desktop/src/app/settings/billing/types.test.ts @@ -1,9 +1,6 @@ import { describe, expect, it } from 'vitest' -import type { - BillingStateResponse, - SubscriptionStateResponse -} from './types' +import type { BillingStateResponse, SubscriptionStateResponse } from './types' const fullBillingState = { auto_reload: { diff --git a/apps/desktop/src/app/settings/billing/use-billing-state.test.ts b/apps/desktop/src/app/settings/billing/use-billing-state.test.ts index f7f751e3ffe5..cd7c74507a98 100644 --- a/apps/desktop/src/app/settings/billing/use-billing-state.test.ts +++ b/apps/desktop/src/app/settings/billing/use-billing-state.test.ts @@ -106,6 +106,7 @@ describe('deriveBillingView', () => { }), okSubscription(todaySubscriptionState) ) + const autoReload = view.accountRows.find(row => row.id === 'auto_reload') expect(autoReload?.caption).toContain('Mastercard ••4444') @@ -127,6 +128,7 @@ describe('deriveBillingView', () => { }), okSubscription(todaySubscriptionState) ) + const autoReload = view.accountRows.find(row => row.id === 'auto_reload') expect(autoReload?.caption).toContain('a different card') diff --git a/apps/desktop/src/app/settings/billing/use-charge-poller.ts b/apps/desktop/src/app/settings/billing/use-charge-poller.ts index 8727365a4315..02ef7dbf9312 100644 --- a/apps/desktop/src/app/settings/billing/use-charge-poller.ts +++ b/apps/desktop/src/app/settings/billing/use-charge-poller.ts @@ -1,12 +1,11 @@ -import { useQueryClient } from '@tanstack/react-query' -import { useCallback, useRef, useState } from 'react' - import { refusalPolicy } from '@hermes/shared/billing-policy' import { driveChargeSettlement, SETTLEMENT_POLL_CAP_MS, SETTLEMENT_POLL_INTERVAL_MS } from '@hermes/shared/charge-settlement' +import { useQueryClient } from '@tanstack/react-query' +import { useCallback, useRef, useState } from 'react' import type { BillingApi, BillingRefusal } from './api' import { useBillingApi } from './api' @@ -108,7 +107,6 @@ export async function pollChargeSettlement( retryFreshKey: true, title: 'Charge failed' } - case 'ambiguous': { if (settlement.status && refusalPolicy(settlement.error).ambiguousMidPoll) { const refusal = observed.refusal ?? refusalFromStatus(settlement.error, settlement.status) @@ -140,6 +138,7 @@ export async function pollChargeSettlement( } case 'cancelled': + case 'timed_out': return timeoutOutcome(observed.status?.ok ? (observed.status.portal_url ?? opts.portalUrl) : opts.portalUrl) } diff --git a/apps/shared/src/index.ts b/apps/shared/src/index.ts index 3b9aff5d4578..d2a21999182a 100644 --- a/apps/shared/src/index.ts +++ b/apps/shared/src/index.ts @@ -1,3 +1,37 @@ +export { + BILLING_REFUSAL_POLICY, + type BillingRecovery, + type BillingRefusalPolicy, + refusalPolicy +} from './billing-policy' +export type { + BillingAutoReload, + 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, @@ -19,37 +53,3 @@ export { type ResolveGatewayWsUrlDeps, type WebSocketAuthParam } from './websocket-url' -export type { - BillingCardInfo, - BillingMonthlyCap, - BillingAutoReload, - BillingRefusalCode, - BillingStateResponse, - BillingErrorPayload, - BillingChargeResponse, - BillingChargeStatusResponse, - BillingMutationResponse, - ChargeFailureReason, - KnownBillingRefusalCode, - KnownChargeFailureReason, - SubscriptionTierOption, - SubscriptionStateResponse, - SubscriptionPreviewResponse, - SubscriptionUpgradeResponse, - UsageBarData, - UsageModelData -} from './billing-types' -export { - BILLING_REFUSAL_POLICY, - type BillingRecovery, - type BillingRefusalPolicy, - refusalPolicy -} from './billing-policy' -export { - driveChargeSettlement, - SETTLEMENT_MAX_RETRY_AFTER_MS, - SETTLEMENT_POLL_CAP_MS, - SETTLEMENT_POLL_INTERVAL_MS, - type SettlementDeps, - type SettlementOutcome -} from './charge-settlement' diff --git a/ui-tui/src/app/slash/commands/topup.ts b/ui-tui/src/app/slash/commands/topup.ts index 7bbbad027134..77222e9e0812 100644 --- a/ui-tui/src/app/slash/commands/topup.ts +++ b/ui-tui/src/app/slash/commands/topup.ts @@ -1,7 +1,4 @@ -import { - driveChargeSettlement, - type SettlementOutcome -} from '@hermes/shared/charge-settlement' +import { driveChargeSettlement, type SettlementOutcome } from '@hermes/shared/charge-settlement' import type { BillingChargeResponse, diff --git a/ui-tui/src/gatewayTypes.ts b/ui-tui/src/gatewayTypes.ts index 1b87eb696ac3..953b8a812579 100644 --- a/ui-tui/src/gatewayTypes.ts +++ b/ui-tui/src/gatewayTypes.ts @@ -1,4 +1,5 @@ import type { UsageModelData } from '@hermes/shared/billing' + import type { SessionInfo, SlashCategory, SubagentStatus, Usage } from './types.js' export interface GatewaySkin { @@ -48,11 +49,20 @@ export interface SlashExecResponse { // Wire shapes now live in @hermes/shared for reuse by TypeScript clients. export type { - BillingCardInfo, BillingMonthlyCap, BillingAutoReload, BillingStateResponse, - BillingErrorPayload, BillingChargeResponse, BillingChargeStatusResponse, - BillingMutationResponse, SubscriptionTierOption, SubscriptionStateResponse, - SubscriptionPreviewResponse, SubscriptionUpgradeResponse, - UsageBarData, UsageModelData, + BillingAutoReload, + BillingCardInfo, + BillingChargeResponse, + BillingChargeStatusResponse, + BillingErrorPayload, + BillingMonthlyCap, + BillingMutationResponse, + BillingStateResponse, + SubscriptionPreviewResponse, + SubscriptionStateResponse, + SubscriptionTierOption, + SubscriptionUpgradeResponse, + UsageBarData, + UsageModelData } from '@hermes/shared/billing' export type CommandDispatchResponse =