Skip to content

AI service refresh - #1685

Draft
ctkm-aelf wants to merge 17 commits into
mainfrom
soft-wolf
Draft

ctkm-aelf wants to merge 17 commits into
mainfrom
soft-wolf

Conversation

@ctkm-aelf

@ctkm-aelf ctkm-aelf commented Sep 28, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

AI Services currently makes users compare separate connections without a clear view of routing, billing, or the agents using them. This refresh groups each catalog service into one compact card and keeps its connections, saved pool routes, billing rules, agent-key access, and recorded use inside the expanded card.

  • Keep equal 288px collapsed cards with two description lines and the existing service header/footer. The body shows configured NyxID platform billing (or credential-supply categories when no platform price exists), pool size/strategy and failover, agent-key count and last-use time on one line, followed by latest edit/actor. Caller/application and exact time are available on hover or keyboard focus. Source avatars sit at the bottom right with source-specific details on hover/focus; crossing between avatars updates the tooltip. The Personal/All services toggle tooltip names the next view and explains the current selection in both toolbar modes. One service card and one connection panel open at a time, with scrolling and sticky headers.
  • Check the service billing configuration before deriving a billing summary from its connection binding. Configured platform pricing shows NyxID platform billing; the rate and sync state are available on hover, in the expanded table and in its billing panel. Read prices from catalog billing and published connection pricing, with all catalog services included. Without platform pricing, summarize NyxID/BYOK/Not billable categories. Preserve the actual reported credential and payer separately: a stored user key alongside platform pricing does not establish BYOK, and a configured platform price does not prove a request selected that credential. The additive credit_billing_configured explanation remains available for detailed charges.
  • Integrate main's service pools into the layout. Routing opens actual saved pool slugs, priority tiers, rotation weights, member eligibility/cooldown, and each connection's credential supplier, rates, and expected/resolved payer. AI chat pools show model mappings and gateway aliases. Same API inspection applies the chosen method/path and makes no upstream request. AI service routing is read-only: Manage in Service Pools opens and scrolls to the selected pool under its personal or organization owner. All pool editing stays in Service Pools.
  • Replace the old local-only pool ordering preview with real pool cards and the existing atomic editor. Drag/arrow ordering creates explicit priorities while preserving models, weights, enabled state, and compatibility declarations. Saves include the original configuration revision. Equal priority values retain rotation within a tier.
  • Distinguish priority failover from single-attempt round-robin/weighted rotation. Null policies use backend defaults. Direct connection slugs retain their individual routing behavior; grouping connections does not create a pool. Missing/failed inspection never claims working credentials.
  • Separate credential supply, NyxID charges, and credit funding. Shared OAuth app access is not labeled BYOK. A supplied key can still incur NyxID fees; access grants and credit grants remain distinct. Billing shows rates and payer per connection, including pool attempts, while allowances → grants → wallet describes funding within that account.
  • Preserve Personal view's accessible organization/platform counterparts, separate Organization/Service multiselects, removable pills, and saved defaults in users.profile_config.services_view. The sticky toolbar keeps compact Connect and Personal controls without an extra Filters menu or refresh action.
  • Surface configured agent-key access, credential overrides, and recorded caller/application, source layer, and time. The read-only /api/v1/service-insights projection and exact execution attribution retain the existing scope and configuration-visibility boundaries. Readers retain permitted history.
  • Merge main through be1883bd (v0.39.0). Preserve the new pool attempt billing identity in service-request attribution so history links to the correct metered attempt.

Behavior and rollout

Pool attempts use their own credential class, payer, and billing identity; reported consumption can charge more than one attempt. NyxID access, approval and billing errors remain terminal. Inspection describes the current viewer and selected operation, not a successful upstream probe or the final authorization of every agent key.

The local frontend reads production metadata. It now allows pool metadata/candidate/health GETs, while pool writes, cooldown resets and execution remain blocked. The real editor can be inspected and drafted there with Save disabled; normal deployments use the existing revision-checked write endpoints. No production pool or credential was changed by this work.

On servers without /service-insights, compatible inventory reads expose configured associations, expected payer rules, and published rates. Missing OAuth app provenance remains unverified. Exact caller history and selected-agent billing require this branch's backend endpoint. Current prices and funding order are not settled transaction totals or evidence of which grant funded a request. This PR does not deploy the backend.

Validation

  • Latest service billing configuration revision: 80 focused frontend tests, TypeScript, production frontend/credential-accept builds, changed-file ESLint and whitespace checks passed. The live preview serves the updated modules.
  • Live metadata verified: Twitter has synced platform pricing of 0.05 credits/request and DeepSeek 0.000001 credits/token; both connection records report a user binding. Regression cases use those metadata shapes and verify the card, tooltip, expanded table and billing panel retain platform configuration without claiming a selected credential.
  • Latest billing-summary revision: 61 focused frontend tests passed, including mixed NyxID/BYOK counts, shared OAuth app provenance, supplied-key fees, missing credentials, no-credential legacy charges and agent overrides. TypeScript, production builds and changed-file ESLint passed.
  • Latest tooltip/activity revision: 50 focused frontend tests passed, covering direct hover changes between source avatars, Personal/All services tooltip updates in normal and sticky modes, and compact activity navigation. TypeScript, production builds and changed-file ESLint passed.
  • 102 focused frontend tests passed, including five unbilled personal apps plus one billable platform connection, disabled and zero-price cases, missing/restricted billing, source tooltips, pool membership, last-use attribution, edit-history navigation, and existing grouped/pool navigation.
  • 14 backend billing projection tests passed, including configured charges for disabled connections, selected credential lanes, zero prices, pending legacy prices, access restrictions and caller rollout.
  • TypeScript, production frontend/credential-accept builds, changed-file ESLint, and diff whitespace checks passed.
  • Backend including test targets compiled after merging main. All 6 pool billing integration tests passed against an isolated MongoDB 8.0.16 replica set, including the regression asserting that each attempt's service history and meter share a billing request ID; reported usage across both attempts, hold release, revoked grants, and stream lease loss also passed.
  • The local preview and updated modules return HTTP 200. Signed-in visual inspection remains unverified because this session has no connected browser.

Preview setup: docs/plans/local-routing-preview.md. Architecture: docs/AI_SERVICES_ARCHITECTURE.md. Pool execution contract: docs/SERVICE_POOLS.md.

@github-actions

github-actions Bot commented Sep 28, 2026 •

Copy link
Copy Markdown

📊 Code coverage

No coverage components ran for this PR.

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