Repository navigation
[Draft] feat(ai-credits-widget): API key tab, key sheet and aiCreditsApi client (Stage 0) - #321
Draft
goodbounties-nanoclaw-agent[bot] wants to merge 1 commit into
Draft
goodbounties-nanoclaw-agent[bot] wants to merge 1 commit into
goodbounties-nanoclaw-agent[bot] wants to merge 1 commit into
Conversation
…and aiCreditsApi client (Stage 0) Replaces the Antseed Desktop / signer-key setup flow with hosted-gateway API keys: Buy Credits / API Key / History tabs, rotate and revoke dialogs, a one-time key sheet, a typed aiCreditsApi client with a Storybook/dev-only mock, and rewritten guide and FAQ copy. The purchase path is unchanged until Stage 1. Refs #318, #319. Co-Authored-By: Claude Code <noreply@anthropic.com> On-Behalf-Of: gdpatchagent[onecli] (yaskkeryodtdijpv)
goodbounties-nanoclaw-agent
Bot
had a problem deploying
to
preview-ai-credits
November 20, 2026 14:24
Failure
goodbounties-nanoclaw-agent
Bot
had a problem deploying
to
preview-storybook
November 20, 2026 14:24
Failure
goodbounties-nanoclaw-agent
Bot
had a problem deploying
to
preview-ai-credits
November 20, 2026 14:26
Failure
goodbounties-nanoclaw-agent
Bot
had a problem deploying
to
preview-storybook
November 20, 2026 14:26
Failure
Contributor
There was a problem hiding this comment.
🔵 Needs a closer look
The review could not proceed because the required GoodDollar CONTRIBUTING.md was unavailable locally and could not be retrieved with the available tools.
No open issues 🎉
What changed in this PR
Implements Stage 0 of #319/#318, preparing the AI Credits widget for hosted-gateway API keys instead of desktop signer setup. The purchase-account migration remains deferred, and production rollout stays held until the real backend and later stages are ready.
Changes:
- Adds the typed
aiCreditsApiinterface, development mock, API Key tab, rotation/revocation dialogs, and one-time key sheet. - Removes legacy setup and withdrawal UI, defaults to Buy Credits, and blocks purchases without a configured key service.
- Updates landing-page copy, widget guidance, Storybook examples, and Playwright coverage.
| File | Description |
|---|---|
tests/widgets/ai-credits-widget/states.spec.ts |
Replaces setup tests with API-key and purchase-gate coverage. |
packages/ai-credits-widget/tsup.config.ts |
Removes the obsolete PNG loader. |
packages/ai-credits-widget/src/widgetRuntimeContract.ts |
Adds the API client prop and updates tabs and actions. |
packages/ai-credits-widget/src/useApiKey.ts |
Adds key-management state, operations, and fulfillment retry. |
packages/ai-credits-widget/src/useAiCreditsHistory.ts |
Removes signer filtering and discovery. |
packages/ai-credits-widget/src/signerSignatures.ts |
Removes withdrawal and channel-close signing helpers. |
packages/ai-credits-widget/src/mocked/index.ts |
Exports the mock key client. |
packages/ai-credits-widget/src/mocked/chainClient.ts |
Removes the mock withdrawable-balance read. |
packages/ai-credits-widget/src/mocked/backendClient.ts |
Removes mock withdrawal and channel-close methods. |
packages/ai-credits-widget/src/mocked/AiCreditsMockWidget.tsx |
Supplies a stable mock key client. |
packages/ai-credits-widget/src/mocked/aiCreditsApi.ts |
Adds simulated key management and usage data. |
packages/ai-credits-widget/src/index.ts |
Exports API types and gateway URL formats. |
packages/ai-credits-widget/src/element.ts |
Exposes the API client as a web-component property. |
packages/ai-credits-widget/src/components/shared/tooltips.tsx |
Removes the unused information tooltip. |
packages/ai-credits-widget/src/components/shared/CopyAnnouncement.tsx |
Adds copy feedback without announcing secret values. |
packages/ai-credits-widget/src/components/shared/CopyableValueRow.tsx |
Adds a labelled value row with clipboard support. |
packages/ai-credits-widget/src/components/shared/constants.ts |
Deletes withdrawal and channel-close tooltip strings. |
packages/ai-credits-widget/src/components/shared/AddressView.tsx |
Deletes the legacy address-copy component. |
packages/ai-credits-widget/src/components/setup/SignerKeyPanel.tsx |
Deletes signer generation/import UI. |
packages/ai-credits-widget/src/components/setup/SetupOnboardingFlow.tsx |
Deletes desktop and signer onboarding. |
packages/ai-credits-widget/src/components/setup/HowToUseView.tsx |
Deletes the old setup walkthrough. |
packages/ai-credits-widget/src/components/setup/AntseedSignerRow.tsx |
Deletes the desktop signer screenshot component. |
packages/ai-credits-widget/src/components/setup/AntseedSetupPanel.tsx |
Deletes desktop download and CLI setup guidance. |
packages/ai-credits-widget/src/components/manage/SignerOperatorCard.tsx |
Deletes signer and operator management UI. |
packages/ai-credits-widget/src/components/manage/RevokeConsentStep.tsx |
Deletes operator-consent revocation UI. |
packages/ai-credits-widget/src/components/manage/CreditsManagementCard.tsx |
Replaces Withdrawable with monthly usage and removes withdrawal controls. |
packages/ai-credits-widget/src/components/index.ts |
Updates component exports for guides and API keys. |
packages/ai-credits-widget/src/components/history/HistoryTab.tsx |
Removes the signer filter control. |
packages/ai-credits-widget/src/components/guide/HowToUseView.tsx |
Adds the three-step API-key guide. |
packages/ai-credits-widget/src/components/guide/GuidanceCard.tsx |
Updates introductory guidance and removes the AntSeed link. |
packages/ai-credits-widget/src/components/guide/FaqView.tsx |
Rewrites FAQs for API keys and pending refund policy. |
packages/ai-credits-widget/src/components/guide/BonusHighlight.tsx |
Moves and renames the existing bonus guidance. |
packages/ai-credits-widget/src/components/buy/OperatorConsentStep.tsx |
Deletes the authorization step. |
packages/ai-credits-widget/src/components/buy/GenerateSignerKeyPanel.tsx |
Deletes signer-key generation and saving screens. |
packages/ai-credits-widget/src/components/buy/AmountPicker.tsx |
Updates the estimated-credit label. |
packages/ai-credits-widget/src/components/apiKey/ApiKeyReadySheet.tsx |
Adds one-time key display, snippets, copying, and dismissal confirmation. |
packages/ai-credits-widget/src/components/apiKey/ApiKeyPanel.tsx |
Adds key-tab orchestration, confirmations, errors, and refresh. |
packages/ai-credits-widget/src/components/apiKey/ApiKeyCard.tsx |
Displays masked keys, spend limits, and key actions. |
packages/ai-credits-widget/src/chainClient.ts |
Removes withdrawable-principal reads. |
packages/ai-credits-widget/src/backendTypes.ts |
Removes withdrawable balance from the account view. |
packages/ai-credits-widget/src/backendClient.ts |
Removes withdrawal/close endpoints and withdrawable aggregation. |
packages/ai-credits-widget/src/assets/assets.d.ts |
Deletes obsolete PNG import declarations. |
packages/ai-credits-widget/src/AiCreditsWidget.tsx |
Integrates key management, revised navigation, and the purchase gate. |
packages/ai-credits-widget/src/aiCreditsApi/types.ts |
Defines the backend key-management contract. |
packages/ai-credits-widget/src/aiCreditsApi/gatewayUrlFormats.ts |
Centralizes provisional tool-specific gateway URL formats. |
packages/ai-credits-widget/src/adapter.ts |
Updates tab routing and removes withdrawal/close actions. |
examples/storybook/src/stories/helpers/aiCreditsWidgetStories.tsx |
Replaces legacy fixtures with API-key scenarios. |
examples/storybook/src/stories/ai-credits-widget/AiCreditsWidgetQA.stories.tsx |
Adds key-state stories and a rotation interaction. |
examples/storybook/src/stories/ai-credits-widget/AiCreditsWidget.mdx |
Updates widget documentation for the gateway model. |
apps/ai-credits-web/tests/purchase-only.spec.ts |
Deletes tests for the removed partner-only mode. |
apps/ai-credits-web/tests/landing-page.spec.ts |
Updates assertions for API-key copy and disclosures. |
apps/ai-credits-web/src/App.tsx |
Revises security copy and removes AntSeed links and widget-only mode. |
apps/ai-credits-web/index.html |
Updates the page description for API-key access. |
Review effort: Balanced
This branch had an error being deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Stage 0 of #319 (tracking: #318; migration of existing signer users: #320). Moves the AI Credits widget from the per-user Antseed Desktop / signer-key model to hosted-gateway API keys. Draft until Stage 1 is unblocked; the production deploy stays held until the real backend exists.
Not in this PR (still to come): Stage 1 (payer address replaces the signer in the purchase path, BLOCKED on the account-id confirmation) and Stage 2 (0.2.0 bump, README/docs, final screenshots). The package version is still 0.1.14. Because of that, dev purchases still encode a signer the UI can no longer create, so purchase flows are only testable after Stage 1.
Agent-assisted: this PR was prepared by an AI agent (gdpatchagent) at the request of @rael. The issue's
[DRAFT]marker and assignment are still open, see "Process gates" below.What changed
aiCreditsApiclient (types plus a Storybook/dev-only mock):getAccount,createOrTopUpKey,rotateKey,revokeKey,getHistory. The widget only talks to a GoodDollar backend. No gateway management API is called from the browser and there is no management token in frontend code or config. The mock base URL ishttps://mock-gateway.invalid.Drawer): full key, copy, warning, Claude Code / Codex & others snippet toggle, "I've saved my key", confirm on dismiss. The full key lives in component memory only, never in storage, logs, analytics or aria-live. Both URL formats sit in one constant marked "confirm with AntSeed".aiCreditsApiconfigured, Buy is disabled with an "unavailable" notice and the API Key tab shows "coming soon".apps/ai-credits-webpasses none, so nobody can pay real G$ and get a mock key or no key.apps/ai-credits-web): Antseed copy and docs links removed;source=antseedwidget-only mode removed (partner-embed consumers are affected).signerPubKeyetc. in adapter types, deep-link exports,payerSession) remain on purpose.Acceptance criteria (mirrored from #319)
Stage 0 status. Unchecked items belong to Stage 1 or Stage 2, or cannot be proven yet.
aiCreditsApithe widget cannot take paymentOverlapping open PRs
AiCreditsWidgetand theAiCreditsWidgetPropstype; it does not use signer/operator types,onPaySuccess.signerPubKeyor the/mockedsigner mocks, so the ecosystem package should still compile.aiCreditsApi(viawidgetProps['ai-credits']), so the embedded AI Credits shows Buy disabled and API Key "coming soon" until the host supplies one. Ecosystem AI Credits screenshots will change.packages/ai-credits-widget/tests/header-harness.tsxbuilds a full adapter state/actions stub with removed fields (signerPubKey,signerPrvKey,operatorSignature,operatorConsent*,operatorAddress,currentOperator,withdrawableUsd,signers,derivedSignerAddress,generateSignerKey,selectSigner,discoverSigners,importSignerFromPrivateKey,applyDeepLinkSigner,signOperatorConsent,revokeOperatorConsent,syncOperatorConsentFromChain,withdrawCredits), so it will break on types.hide-header.spec.tsasserts "One-time setup required before buying AI Credits." and the "Set Up" tab, both removed.AiCreditsWidget.tsx(header block,SetupGuidanceCardrenamed toGuidanceCard),widgetRuntimeContract.tsandapps/ai-credits-web/src/App.tsx.Verification (agent-run automated checks; no human testing yet)
pnpm build18/18; package ESLint clean;apps/ai-credits-webtsc clean.tests/widgets/ai-credits-widget: 29/29 Playwright.apps/ai-credits-weblanding spec: 5/5 at desktop, and 5/5 at 390px (run in Chromium because WebKit cannot be installed in the sandbox).tests/widgets/ai-credits-widget/test-results/(new: acw-07, acw-29 to acw-33); 12 stale ones removed.Process gates
[DRAFT][PLAN]and unassigned; AGENTS.md says only an assigned[PLAN]without[DRAFT]may be executed. The requester approved the plan and asked for Stage 0 and this draft PR; maintainer confirmation of the title and assignment is requested before this leaves draft.Notes
packages/ai-credits-widget/src/Untitled(tracked, unrelated) is untouched and not in this diff.🤖 Generated with Claude Code