Commit Graph

1054 Commits

Author SHA1 Message Date
shinchan-zhai 6fe849c18d fix: update frontend default model references from DeepSeek to GLM
Backend was changed to GLM-5 in 8a0f3f5 but frontend still had
hardcoded DeepSeek fallback and onboarding copy.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-10 22:47:35 +08:00
shinchan-zhai 4f0a922779 feat: add "forgot account" reset flow with wallet preservation
Add account reset functionality for users who forgot their login credentials.
The reset clears authentication data while preserving wallet private keys and
exchange configs, which are automatically adopted by the new account on
re-registration to prevent fund loss.

- Add POST /api/reset-account endpoint
- Add "Forgot account?" button on login page (zh/en/id)
- Orphan ai_models and exchanges are re-assigned to new user on register
- Onboarding reuses existing claw402 wallet instead of generating new one

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-10 18:00:56 +08:00
deanokk 80272c0d5a fix(dashboard): preserve trader selection in URL and silence background requests (#1459)
* refactor: streamline trader selection logic and URL handling in App component

* refactor: update API request handling across components to use silent mode for improved error management

---------

Co-authored-by: Dean <afei.wuhao@gmail.com>
2026-04-04 17:16:47 +08:00
shinchan-zhai 8a0f3f5a13 feat: change claw402 default model from deepseek to glm-5 2026-04-04 14:48:42 +08:00
Zavier 0c1f438cc3 fix: improve trader error feedback, stale balance cleanup, and claw402 warnings (#1452)
* fix: improve trader error handling and balance validation

* fix: localize structured trader failure reasons

---------

Co-authored-by: apple <apple@MacbookPro-zbh.local>
2026-04-01 22:10:29 +08:00
deanokk 9a80f1d88d feat: add exchange account states and refine beginner trader creation flow (#1450)
* feat: implement exchange account state management and UI updates

- Added functionality to invalidate exchange account state cache on exchange config updates, creation, and deletion.
- Introduced new API endpoint to fetch exchange account states.
- Updated frontend components to display exchange account states, including status and balance information.
- Enhanced user experience by refreshing exchange account states after relevant actions.

* feat: enhance trader creation readiness in AITradersPage and BeginnerGuideCards

---------

Co-authored-by: Dean <afei.wuhao@gmail.com>
2026-04-01 16:26:04 +08:00
shinchan-zhai 9937542020 docs: add MiniMax to AI models and beginner mode to setup across all i18n READMEs
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-31 22:16:46 +08:00
Zavier 287280857b perf: reduce frontend login and dashboard friction (#1447)
Co-authored-by: apple <apple@MacbookPro-zbh.local>
2026-03-31 20:40:12 +08:00
shinchan-zhai d250aed26a fix: auto re-fetch system config after invalidation
- invalidateSystemConfig() now dispatches a custom event
- useSystemConfig() listens for the event and re-fetches automatically
- Fixes stale initialized=false after register/logout causing
  incorrect redirect to SetupPage
2026-03-31 16:12:01 +08:00
shinchan-zhai 608f02ed67 fix: clean stale auth state on login/setup, unify language switcher
- LoginPage/SetupPage: clear localStorage auth tokens on mount
- AuthContext: clear onboarding state on register, invalidate config on logout
- Extract shared LanguageSwitcher component for consistent UI
- Merge duplicate config import in AuthContext
2026-03-31 15:23:00 +08:00
deanokk 1d6e99c74a feat(beginner): protect default AI model and prevent repeated onboarding (#1444)
Co-authored-by: Dean <afei.wuhao@gmail.com>
2026-03-30 21:04:43 +08:00
shinchan-zhai fb0bd13f51 fix: division by zero guard, logout redirect, onboarding close button
- auto_trader_risk: skip drawdown check when entryPrice <= 0
- AuthContext: redirect to / on logout
- App.tsx: simplify data page navigation
- BeginnerOnboardingPage: add close button to overlay
2026-03-30 14:02:50 +08:00
Zavier 55db747318 feat: refine beginner wallet onboarding modal (#1438)
Co-authored-by: Codex <codex@openai.com>
2026-03-28 16:09:04 +08:00
shinchan-zhai cab58afe6d fix: guard short trader ID, i18n setup page, simplify onboarding UX
- main.go: prevent panic when trader ID < 8 chars
- SetupPage: add zh/en i18n labels
- BeginnerOnboardingPage: show private key by default, simplify code
2026-03-28 14:14:20 +08:00
shinchan-zhai 9176aa9844 fix(deps): resolve 11 npm vulnerabilities in frontend dependencies
Update react-router, rollup, picomatch, and yaml to patched versions.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-28 00:29:12 +08:00
Dean 7464dfa892 docs: update token estimation values for candidate coins in Chinese documentation 2026-03-28 00:23:11 +08:00
Dean 2e2598e4e0 fix: update token limits and error handling in Trader Dashboard 2026-03-28 00:23:11 +08:00
Dean fbca4166a1 fix: reduce candidate coin limit to 10, fix Select scroll and flash
- Lower MaxCandidateCoins from 50 to 10 (backend)
- Update CoinSourceEditor: options 1-10, default 3, max static coins 10
- Fix NofxSelect dropdown closing on internal scroll
- Fix NofxSelect position flash on open (useLayoutEffect)
2026-03-28 00:23:11 +08:00
Dean f83f2b1c18 style: apply gofmt to api/strategy.go and store/strategy.go 2026-03-28 00:23:11 +08:00
Dean c6adc34247 fix: update error handling for account data fetch on Trader Dashboard 2026-03-28 00:23:11 +08:00
Dean 1d897f635e feat: localize default strategy names by UI language at registration
- Pass `lang` from register request body to createDefaultStrategies
- Support zh/en/id locales for strategy names and descriptions
- Wrap strategy creation in a transaction to prevent partial writes
- Frontend sends current UI language in register request body
- Strategy list UI: 2-line clamp, unselected border, larger spacing, smaller font for non-zh
2026-03-28 00:23:11 +08:00
Dean 39782600a9 docs: add token estimation analysis for candidate coin limits 2026-03-28 00:22:49 +08:00
Dean 1c378007ee fix: show -- instead of 0 when account data fetch fails on dashboard
Replace zero-value fallback with undefined, pass accountFailed prop to
distinguish load failure from initial loading skeleton.
2026-03-28 00:22:49 +08:00
Dean b0be49569c feat: implement default strategy creation for new users 2026-03-28 00:22:49 +08:00
Dean 95e76f6a56 feat: enhance token estimation and context limit handling in strategy configurations 2026-03-28 00:22:49 +08:00
Dean 6cb6c31b34 feat: enhance strategy deletion process with user feedback and validation checks 2026-03-28 00:21:37 +08:00
Zavier b331733e23 feat: improve user onboarding and setup UX (#1436)
* feat: add beginner onboarding and mode switching flow

* chore: ignore local gh auth config

* fix: restore kline fallback and align onboarding language

---------

Co-authored-by: zavier-bin <zhaobbbhhh@gmail.com>
2026-03-28 00:17:37 +08:00
shinchan-zhai 4ab4024628 fix: fallback to Binance kline when coinank returns empty data for non-Binance exchanges
CoinAnk recently stopped providing free kline data for OKX/Bitget/Gate
exchanges (returns success but empty array). This caused '3-minute
k-line data is empty' errors for all users on those exchanges.

Fix: detect empty kline response and automatically fallback to Binance
kline data, which is always available.
2026-03-27 13:41:49 +08:00
deanokk f0d3352971 fix: prevent DeepSeek token overflow with product-level limits (#1431)
* feat: enforce strategy limits to prevent token overflow

* fix: tune token limits after real-world testing

- Relax kline max 20→30, timeframes 3→4 (tested ~41K tokens, safe under 131K)
- Restore ranking limits to original [5,10,15,20] options (only ~1.5K token impact)
- Add static coins limit (max 3) with toast notification
- Add timeframe limit toast when exceeding 4
- Log SSE token usage (prompt/completion/total) from API response
- Fix nil logger crash in claw402 data client (engine.go)

* feat: add token estimation functionality for strategy configurations

* feat: add discard changes button in Strategy Studio for unsaved modifications

* feat: retain selected strategy after saving in Strategy Studio

* feat: enhance strategy display in Strategy Studio with improved layout and sorting of token limits

* refactor: improve layout and styling of stats display in CompetitionPage

* refactor: replace select elements with NofxSelect component for improved consistency in strategy configuration forms

* style: update NofxSelect component to use smaller text size for improved readability

* feat: implement token overflow handling in strategy updates and UI

---------

Co-authored-by: Dean <afei.wuhao@gmail.com>
2026-03-27 00:26:40 +08:00
shinchan-zhai af6f6d5930 feat: auto-reuse claw402 wallet for nofxos data — no extra config needed
When a trader uses claw402 as AI provider, the same wallet private key
is now automatically used to route nofxos data API calls (AI500, OI,
NetFlow, etc.) through claw402 payment as well.

Users don't need to configure anything extra — if they already set up
claw402 for AI, data APIs automatically go through claw402 too.
2026-03-25 10:08:55 +08:00
shinchan-zhai 2d68b48f52 feat: route nofxos data API calls through claw402 x402 payment
When CLAW402_WALLET_KEY env var is set, all nofxos.ai data API calls
(AI500, OI rankings, NetFlow, price rankings) are automatically routed
through claw402.ai with x402 USDC micropayment.

- provider/nofxos/claw402.go: x402 GET request client for data APIs
- provider/nofxos/client.go: claw402 mode support in doRequest()
- kernel/engine.go: auto-detect CLAW402_WALLET_KEY and enable routing
- mcp/payment/x402.go: MakeClaw402SignFunc helper

Without CLAW402_WALLET_KEY, falls back to direct nofxos.ai (backward compat).
2026-03-25 09:58:24 +08:00
Hansen1018 9b14c5c84d feat: update default MiniMax model to M2.7 (#1428) 2026-03-24 08:37:00 +08:00
tinkle-community 966995fb88 refactor: remove BlockRun provider, retain Claw402 as sole x402 payment provider
Remove all BlockRun (Base + Solana wallet) references from codebase:
- Delete blockrun_base.go, blockrun_sol.go, wallet setup docs, icon
- Move shared EIP-712 signing code to x402.go for Claw402 reuse
- Clean up provider constants, model lists, UI components, translations
- Update all README files (EN + 6 i18n) and getting-started docs
2026-03-24 01:44:54 +08:00
tinkle-community bbf96fe4b4 Merge remote-tracking branch 'origin/main' into dev 2026-03-22 18:42:09 +08:00
shinchan-zhai 4e4b4ceed7 feat: safe mode — auto-protect positions when AI fails 3+ times
- Track consecutive AI failures
- After 3 failures: activate safe mode (no new positions, close/hold only)
- Auto-deactivate when AI recovers
- Keep loop running in safe mode (retry each cycle)
- Log clearly: 🛡️ SAFE MODE ACTIVATED/DEACTIVATED
2026-03-21 19:59:00 +08:00
shinchan-zhai fd77f2df3e feat: AI cost tracking, pre-launch balance check, low balance alerts
- store/ai_charge.go: local AI cost tracking per call (SQLite)
- wallet/usdc.go: shared USDC balance query (Base chain RPC)
- Pre-launch: estimate daily cost + runway days
- Low balance: warn <$1, error at $0 (every 10 cycles)
- API: GET /api/ai-costs for cost history
- Frontend: model cards show price per call
- Frontend: wallet create + QR deposit + balance display
2026-03-21 12:31:20 +08:00
shinchan-zhai 79a513470b feat: real-time wallet validation — key check, address display, USDC balance, claw402 health
- POST /api/wallet/validate: validate key, derive address, query Base USDC, check claw402
- Claw402ConfigForm: debounced validation, balance display, connection test button
- i18n: 11 new keys (en/zh/id)
- Private key never logged or stored
2026-03-21 01:08:29 +08:00
shinchan-zhai 53ac52562f fix: replace toast.promise with await to ensure state refresh after API calls
sonner's toast.promise() returns a toast ID (not a Promise), so
await resolves immediately and subsequent data refresh fetches stale
data. Users had to manually reload to see changes.

Fixed across AITradersPage, SettingsPage, and TraderConfigModal.
2026-03-21 00:54:36 +08:00
shinchan-zhai 58236ba8b5 Merge branch 'dev' of https://github.com/NoFxAiOS/nofx into dev 2026-03-21 00:27:20 +08:00
shinchan-zhai 16ebe0a64c feat(mcp): add context length guard to prevent oversized requests
* feat: add X-Client-ID header for claw402 monitoring

* feat(mcp): add context length guard to prevent oversized requests

- Add MaxContext field to Config (default 0 = no limit)
- Add WithMaxContext() option for setting model context limits
- Add context_guard.go: token estimation + message truncation
- Integrate guard into both BuildMCPRequestBody and BuildRequestBodyFromRequest
- Support both map[string]string and map[string]any message formats
- Truncates oldest non-system messages when estimated tokens exceed limit
- Always preserves system messages and keeps at least 1 non-system message
- Logs warning when truncation occurs for debugging

Usage: mcp.NewDeepSeekClient(mcp.WithMaxContext(131072))
2026-03-18 11:10:22 +08:00
shinchan-zhai 2cdc3d0cd8 fix: set temperature=1 for kimi provider (k2.5 model restriction)
* feat: add X-Client-ID header for claw402 monitoring

* fix: set temperature=1 for kimi provider (k2.5 model restriction)
2026-03-18 11:10:20 +08:00
tinkle-community d5fbe445e1 feat: add channel dimension to GA4 AI usage tracking
Distinguish claw402, blockrun, and native direct API calls in telemetry.
2026-03-16 15:19:49 +08:00
tinkle-community b8bc91f7a0 docs: add x402 streaming payment architecture documentation 2026-03-16 13:53:27 +08:00
tinkle-community 0f06f9b2a2 feat: add streaming support for x402 payment flow to bypass Cloudflare timeout
- Extract ParseSSEStream as shared function from CallWithRequestStream
- Add DoX402RequestStream and X402CallStream for streaming x402 payments
- Switch Claw402Client.Call to use streaming (X402CallStream)
- TeeReader fallback: SSE parsing with JSON fallback for non-SSE responses
- Idle timeout watchdog (90s) protects against stalled streams
2026-03-16 12:41:30 +08:00
tinkle-community 780bb39a92 fix: strategy studio crash due to mismatched translation key oiTopDesc→oi_topDesc
CoinSourceEditor constructs keys as `${value}Desc` where value='oi_top',
expecting 'oi_topDesc' but the translation key was 'oiTopDesc' (camelCase).
This caused ts(undefined, lang) → "Cannot read properties of undefined".
2026-03-16 08:01:56 +08:00
tinkle-community 7203655ae7 fix: strategy studio black screen on create and remove stale benefit3 ref
- Add missing configResponse.ok check in handleCreateStrategy to prevent
  rendering with invalid config data when API fails
- Remove deleted benefit3 translation key reference from LoginRequiredOverlay
2026-03-16 07:55:47 +08:00
tinkle-community 21a15f98eb refactor: remove all backtest module code and references
Delete backtest/ engine (19 files), api/backtest.go, store/backtest.go,
web backtest components (7 files), API client, types, docs, screenshot.
Clean all backtest references from main.go, api/server.go, store/store.go,
App.tsx, HeaderBar.tsx, LandingPage.tsx, translations, README and docs.
2026-03-16 07:38:01 +08:00
shinchan-zhai 1a6b88d77f feat: add X-Client-ID header for claw402 monitoring (#1414) 2026-03-16 07:33:05 +08:00
shinchan-zhai ff8a4300c6 feat: add X-Client-ID header for claw402 monitoring 2026-03-15 11:50:08 +08:00
tinkle-community 736d2d385d refactor: optimize codebase encoding 2026-03-12 16:14:56 +08:00