Skip to content

Add safe AI opponent provider layer#69

Open
YfengJ wants to merge 4 commits into
Bitcoindefi:mainfrom
YfengJ:codex/ai-opponent-provider-17
Open

Add safe AI opponent provider layer#69
YfengJ wants to merge 4 commits into
Bitcoindefi:mainfrom
YfengJ:codex/ai-opponent-provider-17

Conversation

@YfengJ

@YfengJ YfengJ commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add a validated AI opponent decision layer with legal-action checks and heuristic fallback
  • support cloud proxy, local OpenAI-compatible, and MCP tool providers without exposing production API keys in the frontend
  • add provider controls, connection testing, anti-farm metadata, docs, and a server-side proxy example

Closes #17

Validation

  • node --test demo/human-vs-bots/ai-opponent.test.mjs scripts/ai-opponent-proxy.test.mjs godot/web/stellar_bridge.test.js
  • node --check demo/human-vs-bots/ai-opponent.js && node --check demo/human-vs-bots/game.js && node --check scripts/ai-opponent-proxy.mjs && node --check godot/web/stellar_bridge.js
  • git diff --check
  • Playwright smoke: opened demo, connected wallet, started a match, ended one turn through the async AI controller; only favicon.ico 404 appeared in console

Security notes

  • Cloud provider keys stay in the proxy process environment.
  • The browser sends only compact game state and legal actions to the configured provider.
  • Invalid model output, unavailable providers, and illegal actions fall back to the existing heuristic bot.

@YfengJ

YfengJ commented Jun 30, 2026

Copy link
Copy Markdown
Contributor Author

CI note: SonarCloud passed. The red check is the existing Godot Web export path failing before app code is exercised, with:\n\nCannot export project with preset "Web" due to configuration errors\n\nLocal validation for this PR passed:\n- node --test demo/human-vs-bots/ai-opponent.test.mjs scripts/ai-opponent-proxy.test.mjs godot/web/stellar_bridge.test.js\n- node --check demo/human-vs-bots/ai-opponent.js && node --check demo/human-vs-bots/game.js && node --check scripts/ai-opponent-proxy.mjs && node --check godot/web/stellar_bridge.js\n- git diff --check\n- Browser smoke: connected wallet, started a match, and ended one turn through the async AI controller.

@sonarqubecloud

Copy link
Copy Markdown

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.

IA real como oponente: conectar modelo vía API / MCP / local

1 participant