Repository navigation
Add managed local API controls to Maple Agent - #1309
Merged
Merged
Conversation
This was referenced Oct 27, 2026
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.
Maple Agent already has a foreground CLI proxy, but desktop users cannot configure a localhost API through Settings. This adds a Local API section with enable/disable, port selection, live status, active requests, a copyable base URL, instructions linking to the existing API-key controls, and a keyboard-accessible Learn more link directly beneath the introduction pointing to https://maple.ai/docs/proxy.
The local profile daemon owns the listener even when a paired executor is selected. It binds only 127.0.0.1, requires the caller's Maple bearer key, rejects browser-origin requests, and never borrows the desktop login or saves a fallback key. Existing proxy routes and the foreground CLI remain available.
Lifecycle handling fences pending starts and restores, tracks accepted connections and response bodies, and bounds shutdown across incomplete headers, uploads, request setup, SSE, and slow readers. Logout, store maintenance/reset, and Quit close the service before releasing local ownership. Emergency Stop remains available while locked and stays paused across automatic restores; Off also stays paused if its settings write fails. Status updates are coalesced and reject replies from a previous host connection.
Validation before review:
Full pinned
env -u MAPLE_PORT just cipassed through the complete pre-commit hook: formatting, 9 Git metadata tests, all four Clippy configurations, the warning-denied workspace/all-targets build, every workspace test, and 342 headless ACP/proxy tests. Clearing the runtime port override lets the existing CLI-defaults test check port 8080.29 focused Local API tests passed on the rebased Agent 0.0.9 binary: rendered local/remote selection, real private IPC/listeners, streaming disconnect/teardown, stale starts, redundant restore, failed Off persistence, admission limits, locked controls, and UI state/reconnect ordering.
Native macOS linked Local workspace: real API keys, models, nonstreaming chat and SSE; missing-key/browser rejection; actual Settings switch and invalid port; actual local listener ownership while connected to a separately configured Iroh executor profile.
Native Local PR build
0cb56b1: Local Pro login,/v1/models, two JSON completions and one SSE completion through127.0.0.1:37289; all returned 200, SSE finished with[DONE], and the temporary caller key was revoked afterward.Native daemon lifecycle: password conversion, Stop during maintenance, locked restart/unlock, authenticated restore, logout, confirmed store replacement using the normal integrity-check child, and explicit GUI Quit.
Native link check at
b51a3006: the Local API pane exposes Learn more as a keyboard-accessible link, clicking it openshttps://maple.ai/docs/proxyin the system browser, and the refreshed Local API remains healthy on its reserved port.The initial native pairing and destructive lifecycle checks used the feature tree based on
7e664459; the full gate uses the feature reapplied to Agent 0.0.9 atd7848049. The architecture review found no new shutdown path in that base update. The native Iroh check paired two isolated profiles on one Mac using the supported Local loopback mode. Cross-computer operation, native Linux/Windows behavior, and release/signing remain separate from these checks.Post-merge follow-up: update the Maple Proxy marketing guide's desktop instructions for Agent's Local API pane and caller-supplied API keys. This documentation update does not block this PR.