Skip to content

feat(editor): built-in agent with API key, models per task, and usage and privacy settings (#1030) - #1237

Open
houko wants to merge 1 commit into
mainfrom
feat/editor-builtin-agent-models-usage-1030
Open

houko wants to merge 1 commit into
mainfrom
feat/editor-builtin-agent-models-usage-1030

Conversation

@houko

@houko houko commented Nov 26, 2026

Copy link
Copy Markdown
Contributor

Closes #1030

Summary

  • Built-in agent with cx.Secrets and editor MCP tools (packages/game/editor/agent_builtin.go, packages/game/editor/editormcp/server.go):
    • Runs requests directly against the Anthropic Messages API (Editor.BuiltInAgentEndpoint / Editor.BuiltInHTTPClient) using the editor's real MCP tools via the inverted AgentToolExecutor bridge wired automatically by editormcp.New.
    • Reads and writes the API key under editor.AgentAPIKeySecretAccount ("agent.anthropic.api_key") via NSGo's core.Scope.Secrets() (backed by the OS keychain in production and nsgotest.Secrets in tests), never writing keys to project files, editor.yaml, or logs.
  • Settings › Models and connections & WHO DOES WHAT routing (packages/game/editor/settings_agent_ui.go, packages/game/editor/settings.go, packages/game/editor/settings_ui.go):
    • Adds the AGENT sidebar group (Models and connections, Usage and privacy) styled with SpecPalette tokens in both Dark and Light appearances.
    • Routes all five task kinds (scene_edit, playtest, problems, ask_in_place, art_sound) to connected local MCP agents or built-in Anthropic default/fast models, persisted in version-1 EditorSettings (editor.yaml + regenerated editor-settings.v1.json schema).
  • Settings › Usage and privacy & Limit reached queueing (packages/game/editor/agent_builtin.go, packages/game/editor/agent_ui.go):
    • Enforces a You only weekly request limit (refusing any agent attempt via WithAgentActor with ErrAgentYouOnly), transitions the header chip to Limit reached · resets 00:00 with a Usage link, and queues subsequent prompts until the weekly reset or until the person raises the limit.
    • Adds the WHAT MAY LEAVE THIS COMPUTER switches (SceneAndData, ViewportImages, GoSource, ArtAndAudio) enforced on built-in tool calls and guarded by ErrAgentYouOnly.
  • Model error retry with backoff & switching agents:
    • Retries 429, 5xx, and 529 overloaded errors on [4s, 8s, 16s, 32s] backoff (AgentModelRetryDelays via Editor.AgentScheduleAfter), rendering the model error card (Anthropic API is overloaded (529) · Retrying in 8 s · try 2 of 4) with Retry now and Use <connected agent> to switch that task kind's route and run the request on the alternative connected agent.
  • Docs, localization, schema, changelog, and agent note:
    • Updated docs/en/editor.md, docs/zh/editor.md, docs/en/formats.md, docs/zh/formats.md, packages/game/editor/locales/{en,zh}.yaml, apps/website/public/schemas/editor-settings.v1.json, changelog.d/editor-builtin-agent-models-usage-1030.md, and .agents/notes/implemented/feature/2026-11-26-editor-builtin-agent-models-usage.md.

Verification

  • (cd packages/game && env -u GOROOT go run ./cmd/gameschema -check)
  • (cd packages/game && env -u GOROOT go tool nsgo check ./editor && env -u GOROOT go tool nsgo check -target ios ./editor)
  • (cd packages/game && env -u GOROOT go tool nsgo check ./editor/editormcp && env -u GOROOT go tool nsgo check -target ios ./editor/editormcp)
  • (cd packages/game && env -u GOROOT go tool nsgo check ./editor/editorcmd && env -u GOROOT go tool nsgo check -target ios ./editor/editorcmd)
  • (cd packages/game && env -u GOROOT go tool nsgo test . -run TestFormatsPage)
  • (cd packages/game && env -u GOROOT go tool nsgo test ./editor/editormcp) (47 passed, including TestBuiltInAgentEndToEndWithNSGoTestSecretsAndMCPTools)
  • (cd packages/game && TMPDIR=/tmp env -u GOROOT go tool nsgo test ./editor -run 'TestLocaleCatalogsComplete|TestEditorSettings|TestSettings|TestConnectDialog|TestAgent|TestBuiltInAgent|TestModelsRouting|TestMatchSettingsPageQuery') (27 passed)
  • (cd packages/game && TMPDIR=/tmp env -u GOROOT go tool nsgo test -target macos -run '^TestBuiltInAgentModelsAndUsageMacOSScreenshots$' ./editor/editorcmd) (all 6 real macOS screenshots visually inspected in Dark & Light themes)
  • env -u GOROOT go run ./tools/changelog check & bun run verify-notes

@github-actions github-actions Bot added conflict Conflicts with the target branch; resolve before merging size/XL enhancement New feature or request documentation Improvements or additions to documentation pkg/editor area/website area/agents labels Nov 26, 2026
@houko
houko force-pushed the feat/editor-builtin-agent-models-usage-1030 branch from 60241ac to 055fdab Compare November 26, 2026 11:30
@github-actions github-actions Bot added conflict Conflicts with the target branch; resolve before merging and removed conflict Conflicts with the target branch; resolve before merging labels Nov 26, 2026
@houko
houko force-pushed the feat/editor-builtin-agent-models-usage-1030 branch from 055fdab to 0498871 Compare November 26, 2026 12:02
@github-actions github-actions Bot added conflict Conflicts with the target branch; resolve before merging and removed conflict Conflicts with the target branch; resolve before merging labels Nov 26, 2026
@houko
houko force-pushed the feat/editor-builtin-agent-models-usage-1030 branch 3 times, most recently from 9d7f49d to 5acc945 Compare November 26, 2026 12:41
@github-actions github-actions Bot added conflict Conflicts with the target branch; resolve before merging and removed conflict Conflicts with the target branch; resolve before merging labels Nov 26, 2026
@houko
houko force-pushed the feat/editor-builtin-agent-models-usage-1030 branch from 5acc945 to 5bfc414 Compare November 26, 2026 13:05
@github-actions github-actions Bot removed the conflict Conflicts with the target branch; resolve before merging label Nov 26, 2026

This branch has not been deployed

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

Labels

area/agents area/website documentation Improvements or additions to documentation enhancement New feature or request pkg/editor size/XL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Editor: a built-in agent with your API key, models per task, and usage and privacy settings

1 participant