Skip to content

feat(cloud): bidirectional CloudBrain over the agent dev-session protocol - #65

Merged
AetherAI3 merged 1 commit into
mainfrom
feat/cloud-brain-bidirectional
Aug 12, 2026
Merged

feat(cloud): bidirectional CloudBrain over the agent dev-session protocol#65
AetherAI3 merged 1 commit into
mainfrom
feat/cloud-brain-bidirectional

Conversation

@AetherAI3

Copy link
Copy Markdown
Owner

Purpose

Phase A + B of the API Coding IDE Hardening lane: make the hosted API path a true bidirectional coding brain. CloudBrain.sendToolResult() and control() are no longer no-ops — the cloud model can now drive the local host loop's tools while all execution stays on the user's machine.

Changes

  • src/core/brain_cloud.ts — rewritten. Primary path: create an /agent/dev/sessions session (effort + declared capabilities on the wire), consume seq-numbered GET SSE, surface tool_call frames as BrainEvents, POST tool results upstream (serialized, one retry against an idempotent server), control(pause|resume|steer), close() aborts the stream and deletes the session. Frames at or below the last-seen seq are skipped so a redelivered mutating tool_call never executes twice; a dropped stream reconnects from ?last_seq. Legacy servers (404/403 on create) fall back to the existing one-way chat stream unchanged.
  • src/core/stream.ts — dev-session frame vocabulary (session, tool_call, tool_result_ack), optional seq on every frame, ok on done (only when the wire carried it — legacy frames stay byte-identical).
  • src/core/transport.ts — dev-session route constants + GET support for SSE streams.
  • src/core/envelope.tsbuildDevSessionRequest (effort finally reaches the hosted brain).
  • AETHER_AGENT_API_CURRENT_STATE.md — Phase A audit deliverable (spec §121): current architecture map of both repos + defect register feeding Phases B–H.
  • RELEASE_NOTES.md — patch notes for this release.

Verification

  • npm run typecheck clean.
  • Full node --test suite green (0 fail), including 10 new protocol tests in test/brain_cloud_dev.test.ts: tool round-trip with upstream POST body assertions, seq-dedupe (duplicate mutating frame fires once), reconnect-from-last_seq, server error → done ok:false, control/steer POST, DELETE on close, tool-result retry, legacy 404 fallback (results/control stay no-ops there), non-404 create failure surfaces instead of silently downgrading.
  • Server half (AETHER-CLOUD feat/agent-dev-sessions) ships separately; this client negotiates protocol_version and fails safe against servers without it.

Risks

  • New behavior is additive and fail-soft: any server without the dev route degrades to today's exact behavior.
  • sendToolResult swallows a twice-failed upstream POST by design (the server's tool-result timeout terminates the session with a clear error frame rather than the host loop crashing mid-render).

🤖 Generated with Claude Code

…ocol

The hosted path becomes a real coding brain: CloudBrain now creates an
/agent/dev/sessions session, maps seq-numbered SSE frames (tool_call
included) onto the existing BrainEvent vocabulary, POSTs locally executed
tool results upstream (serialized, retried once against an idempotent
server), and implements control(pause|resume|steer). close() aborts the
stream and deletes the server session. Effort now rides the wire.

Replay safety: frames at or below the last-seen seq are skipped, so a
redelivered mutating tool_call can never execute twice; reconnect resumes
from ?last_seq. Older servers (404/403 on create) fall back to the
pre-existing one-way chat stream unchanged.

Ships Phase A/B of the API coding IDE hardening spec: the current-state
audit (AETHER_AGENT_API_CURRENT_STATE.md), dev-session route constants +
GET SSE support in transport, the new frame vocabulary in stream.ts, and
10 protocol tests covering the round-trip, dedupe, reconnect, control,
teardown, and both fallback splits.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@AetherAI3
AetherAI3 merged commit b98ef26 into main Aug 12, 2026
5 checks passed
@AetherAI3
AetherAI3 deleted the feat/cloud-brain-bidirectional branch August 12, 2026 16:38
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.

1 participant