Fix local provider API key, captain's log display, and caching issues#11
Open
Brainstem2000 wants to merge 3 commits intoSpaceMolt:mainfrom
Open
Fix local provider API key, captain's log display, and caching issues#11Brainstem2000 wants to merge 3 commits intoSpaceMolt:mainfrom
Brainstem2000 wants to merge 3 commits intoSpaceMolt:mainfrom
Conversation
Two fixes for multi-agent setups: 1. resolveApiKey(): new export that safely resolves API keys for any provider. Local providers (ollama, lmstudio, vllm, etc.) get a 'local' placeholder so pi-ai doesn't fall through to checking process.env.OPENAI_API_KEY, which throws "OpenAI API key is required" for users who only have local providers configured. 2. fetchOpenApiSpec(): check fresh cache (1h TTL) before hitting the server. Previously always fetched first, causing 429 rate-limits when multiple agents started simultaneously. Now only fetches when cache is stale or missing, with stale cache as last-resort fallback. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- SidePane reads structuredContent (JSON) instead of result (text summary) for captain's log — MCP v2 returns these as separate fields - Added silent option to executeCommand so UI-driven captain's log queries don't pollute the activity log (20 calls per profile) - Set Cache-Control: no-cache on index.html so browser always picks up new content-hashed asset filenames after rebuilds Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Agents on MCP v2 were receiving text summaries (e.g. "Captain's log entry 0 of 20:") instead of actual JSON data because executeTool used resp.result instead of resp.structuredContent. Now prefers structuredContent when available. - Added 8-second cooldown between action commands within a turn to prevent spam loops when game returns "Action pending". Query commands are exempt. Strips spacemolt_ prefix for correct lookup. - Split llm_call into its own "Call" filter checkbox in LogPane so model/token metadata can be toggled independently from LLM thoughts. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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
resolveApiKey()now returns'local'placeholder for providers inCUSTOM_BASE_URLS(ollama, lmstudio, vllm, etc.) or with custombase_urlin the DB. Previously returnedundefined, causing pi-ai to fall through toprocess.env.OPENAI_API_KEYand throw "OpenAI API key is required".fetchOpenApiSpec()now checks fresh cache (1h TTL) before making network requests. Prevents 429 rate-limiting when multiple agents start simultaneously.structuredContent(JSON) instead ofresult(text summary) for captain's log — MCP v2 returns these as separate fields. Without this, the log pane shows "No log entries" becauseresultis now a string like"Captain's log entry 0 of 20:".silentoption toexecuteCommand()so UI-driven captain's log queries (20 per profile) don't spam the activity log.Cache-Control: no-cache, no-store, must-revalidateonindex.htmlso browser always picks up new content-hashed asset filenames after rebuilds.Test plan
captains_log_listspam entries🤖 Generated with Claude Code