Repository navigation
Claude Agent: use your Claude plan in Eaon, through your own Claude Code - #47
Merged
Merged
Conversation
Chat and workers can run on a Claude Pro or Max plan: Eaon drives the user's installed, signed-in Claude Code with Anthropic's Agent SDK, the way OpenCode 2.2.3 does. - Sign-in is Claude Code's own (`claude auth login` in the user's terminal). Eaon reads only signed in, how, and the plan's name from `claude auth status`; never an email, organization or token. - Models are Claude Code's own list for the account (`supportedModels()` on a session that is never sent a message). - Tool calls Claude Code would ask about go to Eaon's approval policy (`canUseTool`); a plan runs in Claude Code's read-only plan mode. - Claude Code's system prompt is untouched; the SDK client app is named `eaon/<version>`; menus say "Claude Agent" with Anthropic's mark, per the Agent SDK branding rules. - Never charged: no API key reaches Claude Code, a key sign-in is refused, and a turn that reaches paid extra usage stops at once. - Usage counts as plan usage and isn't double-counted against Claude Code's own logs. - The SDK's bundled Claude Code binaries are left out of the app.
…E_CODE_EFFORT_LEVEL Claude's thinking now comes as summaries, so the transcript shows it as it does for other models. Two variables from the user's shell no longer reach Claude Code: CLAUDE_CODE_SIMPLE would skip their subscription sign-in, and CLAUDE_CODE_EFFORT_LEVEL would override the effort picked in Eaon.
…plan Claude models now run Eaon's own agent — its loop, tools, approvals, memory, workers and history — through the user's own Claude Code, the way OpenCode's Claude Agent provider works. Claude Code supplies only the model: - Its built-in tools, settings, CLAUDE.md files, hooks, skills and memory are off; Eaon's tools are offered as an in-process MCP server. When Claude calls one, the step ends with that call, Eaon's loop runs it through its approvals, and the result goes back into the waiting session. - One Claude session per conversation while Eaon's history and Claude's agree (user text and tool-call ids, which survive Eaon's rebuild of a chat); a changed prompt, tools or model resumes it in a new process; an edit, compaction or another model's turns start a new session that opens with the conversation so far. Subagents get sessions of their own; titles are one-offs. - Sign-in is Claude Code's own (`claude auth login`); Eaon holds no token. Models are Claude Code's list for the account. - Never charged: key sign-ins are refused, and extra usage stops a turn. - The Local API Server never offers it: a Claude plan isn't for other apps. - Chat's picker shows Claude Agent; the Claude engine (Claude Code's own agent) stays for workers and in Settings → Agent engines.
The usage meter read a Claude plan's limits only from what Claude Code had cached in .claude.json, so the figures went stale unless a Claude Code session was running. Now Eaon starts the user's Claude Code for a moment through the Agent SDK, sends it no message, and requests the data behind its /usage. Claude Code fetches it from Anthropic with its own sign-in; Eaon never reads the token, which Anthropic's terms forbid. ~1 second, no model request, nothing used. The live answer and the cache share one parser (5-hour, week, per-model weeks; Anthropic's codename keys ignored). When Claude Code can't answer (the SDK marks the request experimental), the meter falls back to the cached figures as before.
Collaborator
Author
|
Added: the usage meter now asks Claude Code itself for a plan's limits (the Agent SDK's request for its /usage data), so the figures are live with no Claude Code session open. Claude Code fetches them with its own sign-in; Eaon never touches the token. Falls back to Claude Code's cached figures if the (experimental) request isn't available. Verified live: Session 19%, Week 72%, ~0.9 s. Full suite: 1967 pass, 0 fail. |
Closing a session (Stop, a title's time limit, the idle timer) answered the call Claude was waiting on but never the step the loop was waiting for, so a Stop while Claude was answering could leave the turn on "Thinking…" for good whenever Claude Code went before it reported the interrupted turn, and a title that ran out of time never settled. Now closing rejects the step in flight, and a second message can't silently replace a step that hasn't answered yet.
…y their turn A session still waiting on a tool call when its turn ended (Stop while the tool ran, a presented plan, a worker's sleep) stayed open for up to an hour, and the chat's next turn was taken for a subagent whenever that call wasn't in its history (a retry or an edit after the Stop or the plan): it ran in a throwaway session outside the chat's record, and so did every turn after it while the old one waited. - The loop now names the turn each request is a step of (`turnId`, the reply's id, shared by its subagents) and says when it is over (`endAgentTurn`). Claude Agent then closes the chat's session if it waits on one of that turn's calls, and the turn's subagent sessions. - A subagent is one with its parent's turn id; any other request finding the chat's session waiting starts the chat's own. A request that comes while the chat's session is still answering gets a session apart. - The sign-in is checked when a turn or process starts, not again on every step: a long tool turn ran `claude --version` and `claude auth status` before each step once a minute had passed. Extra usage is still checked before every step.
Claude Code retries an overloaded or unreachable API itself before it gives
up, but its last words ("Claude: API Error: Repeated 529 Overloaded
errors") matched the loop's retry check, so the loop tried three more times
over 23 seconds, each in a new session sent the whole conversation again.
A Claude Agent failure is now said at once.
…other model Claude Agent was left out of the server's models, so an app that asked for `claude-agent/haiku` had its request quietly mapped to the default model, the way an app's own model names are, and the answer came back labelled with the name it asked for. Such a request is now refused with a 403 in each API's error shape, saying Claude Agent runs only inside Eaon.
Claude Agent reads as signed in only once the Claude engine has checked Claude Code, five seconds after launch, after the window has loaded its providers. Nothing told the window when the check came back, so after a launch the window went on treating Claude Agent as signed out (its models unusable, the picker without its effort control) until the model list was next refreshed, which can be hours later. A change in being on a Claude plan now refreshes the providers in every window.
A request with no working folder (every chat's title, and Chat's turns,
whose folder is '') was meant to run in userData/claude-agent, but nothing
made that folder, so Claude Code failed to start ("native binary … failed
to launch") and no chat on Claude Agent was ever named; Chat's turns ran in
whatever folder Eaon was started from. The folder is now made when it's
needed, and an empty folder counts as none.
A turn on the Claude engine never sent the usage event the transcript reads, so its replies had no "in · out · cached" line and the context meter stayed empty, unlike Codex's and Eaon's own. The result's usage is now sent with the reply.
…logs Claude Agent runs each chat as a Claude Code session that Claude Code keeps in its own logs, which Settings → Usage reads too. Only the Claude engine's turns were left to those logs, so every Claude Agent turn was counted twice in the chart, the calendar and the streaks. They're now left to Claude Code's logs like the engine's (a title's or a subagent's use, which Claude Code isn't asked to keep, goes uncounted there rather than doubled).
The Claude card said Claude Code makes its requests "against your own plan or key", but a Claude Code signed in with a key is refused, and the page's opening line didn't name Claude Code among the engines run on the user's own install.
A session whose process closed after ten idle minutes (or failed on its own) stayed in the adapter's set of open sessions for good, and as its chat's record until that chat's next turn: each one kept its Agent SDK query, its tool server and its buffers alive for the rest of the run. Closing a session now drops it everywhere; a chat's record keeps only the session's id, which its next turn resumes.
Setup showed Claude Agent as linked once Claude Code was signed in, but never offered it when it wasn't. It is listed now, outside Link everything found (its sign-in waits on claude auth login in Terminal), and Anthropic's API-key note points to it for the plan.
With nothing chosen, Chat took the first ready provider's first model. Claude Agent is ready whenever Claude Code is signed in, so when Eaon Lite needed attention a new chat ran on the user's Claude plan without their asking. It is now used only once picked; on its own it asks the user to choose.
Every engines refresh started Claude Code for its model list, signed in or
not. The list is the account's, so signed out (or on a key) it now keeps the
shipped one and starts nothing.
That extra start, and the new --version check, were what broke the Linux
end-to-end hand-off test ("Claude Code was not restarted", 2 !== 1) on every
run of this branch. Its stand-ins now answer --version like Claude Code does,
and the assertion says which starts it saw.
This reverts bbba7f4. Asking Claude Code for its /usage through the Agent SDK had it fetch the figures with its sign-in; the meter now uses only what Claude Code's sessions leave on this computer, as Orca does (its status-line report comes with the 2026.7.4 release; until then, what /usage last cached).
Merged
…engine # Conflicts: # src/main/index.ts
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.
Claude Pro and Max plans now work in Eaon in two ways. Both run the user's own installed, signed-in Claude Code through Anthropic's Agent SDK (
@anthropic-ai/claude-agent-sdk).1. Claude Agent, the provider: Eaon's own agent on Claude (the default in Chat)
This works like OpenCode's Claude Agent provider (anomalyco/opencode#58782). Claude Code supplies only the model; Eaon's loop, tools, approvals, memory, workers and history do the rest, the same as for any other model.
How it works:
providers/claudeAgent/tools.ts). When Claude calls one, the model step ends with that call. Eaon's loop runs it through its approvals, then hands the result back into the session waiting in the MCP handler (session.ts).history.ts).<conversation-checkpoint>of the conversation so far.claude auth loginin the user's terminal (oauth/claudeCode.ts). Eaon stores nothing. Models come from Claude Code's list for the account.2. The Claude engine: Claude Code's own agent inside Eaon
Claude Code's own tools and settings, with each tool call checked against Eaon's approval setting through
canUseTool. Its system prompt is untouched. It's available for workers and in Settings → Agent engines; Chat's picker shows Claude Agent instead.Both
ANTHROPIC_API_KEY,ANTHROPIC_AUTH_TOKENandCLAUDE_CODE_SIMPLEare stripped.apiKeySourceother than the account stops the turn.CLAUDE_AGENT_SDK_CLIENT_APP=eaon/<version>, "Claude Agent" naming and Anthropic's mark, per the SDK branding rules.Policy
docs/your-subscriptions.mdexplains all this to users.Testing
test/claudeAgentProvider.test.ts(7): a stand-in Claude Code calls Eaon's tools over the real MCP server through an in-memory transport. It covers the tool hand-off, same-session follow-ups, resume and catch-up, subagents, titles, nudges and the never-charged guards.test/claudeEngine.test.ts(9).claude-plan.test.ts, because the Anthropic provider now points to Claude Agent, andproviderMatrix.test.ts, because Claude Agent has no https endpoint.write_filewas held by Eaon's Allow card, approved, and written, and the changed-file card showed it.