Skip to content

[FEATURE] Complete AINative managed chat-completion integration (partially integrated; 3 disconnects block user access) + IDE-plan launch-readiness audit #141

Description

@urbantech

Summary

Gap analysis (code-verified) of whether the AINative managed chat-completion API is integrated into the IDE. Verdict: PARTIALLY INTEGRATED (~60-70%). All infrastructure exists but is disconnected at 3 specific glue points, so no IDE user can actually use AINative-billed inference today — even though the provider, auth service, SSE streaming, and usage tracking are all implemented.

This matters for product/billing: the IDE plan tier is a separate, unlaunched product line (family=ide_cli, 0 active subscribers, placeholder Stripe price IDs, metered by completions/chat NOT the credit pool). It cannot be sold until (a) this integration is completed and (b) its Stripe pricing + metering pass their own audit. This issue tracks the integration gap; a separate audit is needed before the IDE plan goes on sale.

What EXISTS (built, verified)

  • AINativeCloudProvider class — full impl: JWT auth, SSE streaming, 401 auto-refresh, reconnect. Real endpoint https://api.ainative.studiosrc/vs/workbench/contrib/ainative/electron-main/llmMessage/providers/ainativeCloudProvider.ts:52-65
  • AINativeCloudAuthService — JWT auth, encrypted token storage, 5-min-buffer refresh
  • ManagedChatAPIService — types for credits_consumed/credits_remaining
  • usageTrackingServicetrackManagedUsage(), getCreditsStatus(), quota monitoring (wired into chatThreadService)
  • ✅ SSE streaming implementation (10 test cases)
  • ainativeCloud registered as a ProviderName with 4 models defined

What is MISSING (the 3 disconnects)

# Gap File:Line Effect
1 sendAINativeCloudChat is a stub returning a hard-coded error ("not yet available... TASK-006"), wired as the provider's sendChat sendLLMMessage.impl.ts:850-857, :951 Dispatcher never calls the real provider
2 displayInfoOfProviderName() throws for ainativeCloud (no case) ainativeSettingsTypes.ts:113 Settings UI crashes → user can't select the provider
3 subTextMdOfProviderName() throws for ainativeCloud (no case) ainativeSettingsTypes.ts:135 Same UI crash on help text

Secondary: no SDK client method for the chat-completions call yet (only /v1/auth/*); model registry still uses mock data (not live /v1/models); usage tracking is wired but inert because the API never returns credit data.

⚠️ Endpoint correctness note (backend integration)

ainativeCloudProvider.ts:54 targets /v1/chat/completions. Our billed managed path is /api/v1/managed/chat/completions (ManagedChatService — the gated, credit-metered handler). Wiring this up must point at the managed endpoint so credit deduction + the single-credit-pool billing (cost×2, chat_credit_service) actually fire. The bare /chat/completions path is the legacy handler and would bypass metering.

Tasks to close the integration

  • Implement sendAINativeCloudChat to call AINativeCloudProvider.sendChatCompletion() (inject IAINativeCloudAuthService) — sendLLMMessage.impl.ts:850
  • Add ainativeCloud case to displayInfoOfProviderName()ainativeSettingsTypes.ts:113
  • Add ainativeCloud case to subTextMdOfProviderName()ainativeSettingsTypes.ts:135
  • Point the provider at the managed billed endpoint (/api/v1/managed/chat/completions), not /v1/chat/completions
  • Add SDK client sendChatCompletion() method
  • Replace model-registry mock data with live /v1/models
  • Verify credits_consumed/credits_remaining surface in the usage tracker end-to-end
  • Before launching the IDE plan: replace placeholder Stripe price IDs + audit IDE-tier metering (currently completions/chat, not credits) against the single-credit-pool model

Estimated effort

~2-3 weeks (1 backend + 1 frontend). Architecture is solid; this is glue + endpoint correctness + a launch-readiness billing audit.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions