Skip to content

Feat/provider capabilities rework - #80

Open
Zeptiny wants to merge 15 commits into
mainfrom
feat/provider-capabilities-rework
Open

Feat/provider capabilities rework#80
Zeptiny wants to merge 15 commits into
mainfrom
feat/provider-capabilities-rework

Conversation

@Zeptiny

@Zeptiny Zeptiny commented Aug 12, 2026

Copy link
Copy Markdown
Owner

No description provided.

Zeptiny added 15 commits August 8, 2026 17:05
…ns, and connection document v2

U1 of the provider capabilities rework: typed facet metadata (thinking
policy, tier mechanism, pricing dimensions incl. non-fiat currency,
cache, quota, discovery) as optional hooks on the trusted driver
interface; catalog facet declarations gated by the trust policy list;
connection document v2 (discoveredModels, per-model pricing overrides,
tier selections) with fill-absent v1->v2 migration on read; new
openai-responses protocol member.
U2: createNativeLanguageModel branches to .responses() for the
openai-responses protocol (native OpenAI, OpenCode Go per-model table,
generic compatible endpoints); trust pins allow it for those drivers.
Fixes dead provider options (openai maxReasoningTokens, anthropic
reasoningEffort -> effort). Verified end-to-end against a mock SSE
fetch: /responses route, reasoning effort mapping, paired tool items,
and usage normalization (reasoning_tokens, cached_tokens).
…and dynamic refresh

U4: PricingResolver composes rates provider-API -> user -> catalog per
rate field with per-field provenance; request-driven PricingRefresher
keeps latest-known dynamic rates without blocking requests, falling
back with stale provenance. FrozenPricingSnapshot gains cacheWriteByTtl,
perRequest, contextTiers, currencyUnit; cost.ts handles non-fiat units,
context tiers, and per-request fees; attempts record cost_rung (schema
v4) and costRungStale evidence. Cost evidence extraction moves behind
the driver pricing facet (Neuralwatt extractor, header allowlist);
Lilac's inline multiplier becomes its dynamic pricing facet.
U3: drivers declare per-model thinking policies (exposure, replay rule,
declared request knobs); stream adapter captures Anthropic
signature/redacted and Responses itemId/encrypted-content artifacts
into Message.thinking_payload; history replays per policy
(mandatory-in-tool-loop / recommended / impossible) with
strip-on-switch; reasoning parts carry providerOptions through
toModelMessages; opaque thinking renders as a token-count indicator;
subagent runs resolve and persist artifacts the same way.
…l listing

U5: discovery facets for Neuralwatt (inline pricing) and Lilac via a
shared models-endpoint helper; discovery runs on connection create,
first ready credential, and manual fetch (no polling); discovered
models merge into connection.discoveredModels with provider provenance
and fill-absent reasoning seeds; unified model_list rows carry
catalog/provider/user source badges with uniform affordances; effective
metadata resolves user > live > catalog per field; PricingRefresher
invalidate wired into connection delete/disconnect/key rotation.
… Go, and compatible endpoints

U5 follow-up: native OpenAI discovers /v1/models ids with
openai-responses protocol stamped from the catalog protocol table;
OpenCode Go discovers ids-only with per-model protocol mapping; generic
OpenAI-compatible discovers ids from the validated connection endpoint.
… placement

U6 (tier/cache half): per-model tier selections on the connection with
per-session override (draft-tier, mirroring draft-reasoning); variant
drivers (Neuralwatt -flex/-fast/-short) group under the base model row
with a tier selector and map the selection to the variant id at request
time with precondition assertions; parameter drivers send serviceTier
opt-in. Served tier is captured into attempt evidence and billed at the
served variant's rates. Anthropic places cache_control breakpoints on
the stable tools+system prefix and the advancing conversation tail with
TTL as the only user knob; OpenAI sends a session-scoped promptCacheKey;
generic connections send no markers. Stable-prefix order guarded so
dynamic context lands after the static prefix for main and subagents.
…ering

U6 (quota half): typed read-only quota facet (balances, subscription,
allowances in provider-native units) validated into the status layer
with TTL/single-flight refresh, surfaced over providers:quota_refresh;
Neuralwatt maps USD credit + kWh energy + key allowance, Lilac maps
documented per-model supply-state/discount into allowances (balances
stay empty — no documented endpoint). Quota is informational only and
never gates sends. Analytics renders kWh and USD buckets separately
without merging and shows per-attempt energy evidence (charged kWh,
consumed, multiplier) plus a quota overview panel.
…, dead code (review fixes)

Addresses P0 #1, P1 #3, P2 #7/#10/#12/#19 from code review:
- cap thinking replay artifact sizes at capture, hydration, IPC schema,
  and replay (64 KiB blob/displayText, 256 itemId)
- pricing refresher backs off after failure (once per cadence) and
  invalidate() races in-flight refreshes via generation guard
- Anthropic tail cache breakpoint walks back from reasoning-only tails
- remove dead legacy Neuralwatt quota path; repoint tests at canonical
  neuralwatt-quota.ts
- replace draft-tier/draft-reasoning copies with shared generic
  createDraftOverrideStore factory
…g, tier tests (review fixes)

Addresses P2 #4/#6/#8/#11/#13/#14/#15/#16 and P1 #2 from code review:
- user pricing overrides key off the base model id on variant-tier
  requests; live-discovered inline pricing feeds the ladder as the
  top provider-api rung with discoveredAt provenance
- request-parameter tier attempts refuse to silently bill base rates
  when no tier-aware rates are frozen
- discovery delist prunes orphaned modelIds/tierSelections/reasoningConfig
  and orphaned enabled ids warn instead of hard-throwing on validate/update
- session tierOverride persistence + v2->v3 DB migration + set/get_service_tier
  IPC now covered; zod-rejection tests for discover_models/quota_refresh
- real-facet tier wiring tests (resolveTierContext, session override vs
  connection selection, variant vs parameter mechanism, extractServedTier)
- numeric reasoning budgets flagged as unsupported for OpenAI in the
  editor; session tier selector filters variant tiers to present models
…eview fixes)

Addresses P2 #18/#20: extract the duplicated thinking/tier/cache
provider-options merge block from send.ts and subagent-runner.ts into
assembleFacetProviderOptions (facets/turn-options.ts), preserving merge
order; rename mergeThinkingProviderOptions to mergeProviderOptions and
update all call sites.
…C (review fixes)

Addresses P2 #5/#17: pricingOverrides now round-trips through
create/update payload schemas and ProviderConnectionView, is wired into
the update handler and modelOptions rows keyed by base model id, and is
editable per model in the unified listing (input/output/cache/reasoning
rates + per-request fee, save/clear). Unified-model-listing, discovery,
tier/cache TTL view, and quota IPC move from ipc/providers.ts into a new
ipc/provider-models.ts; channel names, zod schemas, and message types
preserved; ipc/index.ts registers both modules.
@coderabbitai

coderabbitai Bot commented Aug 12, 2026

Copy link
Copy Markdown

Important

Review skipped

Too many files!

This PR contains 125 files, which is 25 over the limit of 100.

To get a review, reduce the PR to 100 files or fewer by splitting it into smaller PRs or changing its base branch.

Upgrade to a paid plan to raise the limit.

This review couldn't start because sufficient usage credits or metered capacity aren't available. Add credits or update usage-based reviews in the billing tab, then retry.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 15a02f0e-59ee-4031-aa17-7678eec97069

📥 Commits

Reviewing files that changed from the base of the PR and between b3edc67 and 3945a0d.

⛔ Files ignored due to path filters (2)
  • docs/brainstorms/2026-08-08-provider-capabilities-requirements.md is excluded by !docs/**
  • docs/plans/2026-08-08-001-feat-provider-capabilities-plan.md is excluded by !docs/**
📒 Files selected for processing (125)
  • CONCEPTS.md
  • TODO.md
  • electron/src/main/agents/subagent-live-projection.ts
  • electron/src/main/agents/subagent-run-assembler.ts
  • electron/src/main/agents/subagent-runner.ts
  • electron/src/main/agents/xstate/agent-machine.ts
  • electron/src/main/agents/xstate/events.ts
  • electron/src/main/ipc/chat/persist.ts
  • electron/src/main/ipc/chat/send.ts
  • electron/src/main/ipc/chat/session.ts
  • electron/src/main/ipc/chat/state.ts
  • electron/src/main/ipc/chat/stream.ts
  • electron/src/main/ipc/chat/title.ts
  • electron/src/main/ipc/index.ts
  • electron/src/main/ipc/payload-schemas.ts
  • electron/src/main/ipc/provider-models.ts
  • electron/src/main/ipc/providers.ts
  • electron/src/main/ipc/session.ts
  • electron/src/main/llm/history.ts
  • electron/src/main/llm/message-factories.ts
  • electron/src/main/llm/model-messages.ts
  • electron/src/main/llm/orchestrator.ts
  • electron/src/main/llm/stream/events.ts
  • electron/src/main/llm/stream/normalized-stream.ts
  • electron/src/main/llm/stream/sdk-event-adapter.ts
  • electron/src/main/providers/accounting/analytics-queries.ts
  • electron/src/main/providers/accounting/cost.ts
  • electron/src/main/providers/accounting/middleware.ts
  • electron/src/main/providers/accounting/schema.ts
  • electron/src/main/providers/accounting/store.ts
  • electron/src/main/providers/catalog/schema.ts
  • electron/src/main/providers/catalog/trust.ts
  • electron/src/main/providers/connection-store.ts
  • electron/src/main/providers/drivers/compatible.ts
  • electron/src/main/providers/drivers/lilac.ts
  • electron/src/main/providers/drivers/models-endpoint.ts
  • electron/src/main/providers/drivers/native.ts
  • electron/src/main/providers/drivers/neuralwatt-quota.ts
  • electron/src/main/providers/drivers/neuralwatt.ts
  • electron/src/main/providers/drivers/opencode-go.ts
  • electron/src/main/providers/drivers/types.ts
  • electron/src/main/providers/facets/cache.ts
  • electron/src/main/providers/facets/discovery.ts
  • electron/src/main/providers/facets/pricing-refresh.ts
  • electron/src/main/providers/facets/pricing.ts
  • electron/src/main/providers/facets/quota.ts
  • electron/src/main/providers/facets/thinking-ui.ts
  • electron/src/main/providers/facets/thinking.ts
  • electron/src/main/providers/facets/tiers.ts
  • electron/src/main/providers/facets/turn-options.ts
  • electron/src/main/providers/index.ts
  • electron/src/main/providers/resolver.ts
  • electron/src/main/providers/runtime-context.ts
  • electron/src/main/providers/status/service.ts
  • electron/src/main/session/db.ts
  • electron/src/main/session/draft-override-store.ts
  • electron/src/main/session/draft-reasoning.ts
  • electron/src/main/session/draft-tier.ts
  • electron/src/main/session/manager.ts
  • electron/src/main/session/schema.ts
  • electron/src/main/session/storage.ts
  • electron/src/preload/index.ts
  • electron/src/renderer/components/Footer.tsx
  • electron/src/renderer/components/MessageWidget.tsx
  • electron/src/renderer/components/Preferences/ProvidersTab.tsx
  • electron/src/renderer/components/Providers/ConnectionList.tsx
  • electron/src/renderer/components/Providers/ConnectionModelsDialog.tsx
  • electron/src/renderer/components/Providers/ConnectionWizard.tsx
  • electron/src/renderer/components/Providers/ProviderStatus.tsx
  • electron/src/renderer/components/Providers/ReasoningConfigEditor.tsx
  • electron/src/renderer/components/ServiceTierSelector.tsx
  • electron/src/renderer/components/analytics/OverviewTab.tsx
  • electron/src/renderer/components/analytics/SessionsTab.tsx
  • electron/src/renderer/components/analytics/shared.tsx
  • electron/src/renderer/hooks/useProviders.ts
  • electron/src/renderer/hooks/useSession.ts
  • electron/src/shared/types/accounting.ts
  • electron/src/shared/types/analytics.ts
  • electron/src/shared/types/ipc-schemas.ts
  • electron/src/shared/types/ipc.ts
  • electron/src/shared/types/message.ts
  • electron/src/shared/types/provider-facets.ts
  • electron/src/shared/types/provider.ts
  • electron/src/shared/types/session.ts
  • electron/tests/integration/analytics-queries.test.ts
  • electron/tests/integration/provider-attempt-accounting.test.ts
  • electron/tests/integration/provider-end-to-end.test.ts
  • electron/tests/integration/provider-onboarding.test.ts
  • electron/tests/integration/provider-status-contracts.test.ts
  • electron/tests/integration/renderer-style-contract.test.ts
  • electron/tests/unit/chat-ipc.test.ts
  • electron/tests/unit/connection-models-editor.test.tsx
  • electron/tests/unit/draft-override-store.test.ts
  • electron/tests/unit/provider-accounting-store.test.ts
  • electron/tests/unit/provider-cache.test.ts
  • electron/tests/unit/provider-catalog.test.ts
  • electron/tests/unit/provider-connection-store.test.ts
  • electron/tests/unit/provider-cost.test.ts
  • electron/tests/unit/provider-discovery.test.ts
  • electron/tests/unit/provider-domain.test.ts
  • electron/tests/unit/provider-driver-registry.test.ts
  • electron/tests/unit/provider-ipc.test.ts
  • electron/tests/unit/provider-lilac-quota.test.ts
  • electron/tests/unit/provider-native-adapters.test.ts
  • electron/tests/unit/provider-neuralwatt-quota.test.ts
  • electron/tests/unit/provider-opencode-neuralwatt.test.ts
  • electron/tests/unit/provider-pricing-refresh.test.ts
  • electron/tests/unit/provider-pricing-resolver.test.ts
  • electron/tests/unit/provider-quota-facet.test.ts
  • electron/tests/unit/provider-specialized-drivers.test.ts
  • electron/tests/unit/provider-status-quota.test.ts
  • electron/tests/unit/provider-tiers.test.ts
  • electron/tests/unit/provider-view-model.test.ts
  • electron/tests/unit/reasoning-config-editor.test.tsx
  • electron/tests/unit/reasoning-effort-driver-mapping.test.ts
  • electron/tests/unit/reasoning-effort-orchestrator.test.ts
  • electron/tests/unit/service-tier-selector.test.tsx
  • electron/tests/unit/session-db-migration.test.ts
  • electron/tests/unit/session-persistence.test.ts
  • electron/tests/unit/session-tier-config-ipc.test.ts
  • electron/tests/unit/session-tier-ipc.test.ts
  • electron/tests/unit/subagent-runner.test.ts
  • electron/tests/unit/system-prompt.test.ts
  • electron/tests/unit/thinking-facet.test.ts
  • electron/tests/unit/thinking-replay.test.ts

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant