feat: daemon + agent presence/control (P1-P5 Chorus borrow)#54
Open
Vincentwei1021 wants to merge 48 commits into
Open
feat: daemon + agent presence/control (P1-P5 Chorus borrow)#54Vincentwei1021 wants to merge 48 commits into
Vincentwei1021 wants to merge 48 commits into
Conversation
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The listConnections function was pruning offline records before applying the agentUuids filter, causing offline records belonging to agents outside the filter to be deleted from the shared store. Reordered the guards so agentUuids filter is checked first, ensuring pruning only affects records that would actually be returned. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…ument single-instance registry
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…-turn race Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…p-dir cleanup Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…per, color cleanup Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
… clarifying comment
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
Borrows Chorus's daemon + agent-presence/control features into Synapse, mapped onto Synapse's experiment-centric model. Five phases, all on this branch (47 commits). Lets the frontend wake a local Claude Code, observe live agent connections, and control running turns — all over the existing notification/SSE infrastructure (no new realtime channel).
Phases
P1 — Connection registry & presence data layer. In-memory
(agentUuid, host, cwd)registry with online/offline liveness;POST /api/agent-connections/heartbeat(agent) +GET /api/agent-connections(owner-scoped, user); "current executions" reuseExperiment.liveStatus; OpenClaw plugin reports heartbeats.P2 —
synapse daemon. New@synapse-research/synapse-daemonpackage, bundled into the@synapse-research/synapseCLI assynapse daemon(one-step install). Connects over SSE, and on experiment assignment drives a persistent per-experiment Claude Code conversation (per-turnclaude -p --session-id/--resume; conversation persists in claude's own session). Safe-by-default tool posture (--allowedTools mcp__synapse --permission-mode dontAsk;--yoloopt-in). A connectedclaude_codeagent is treated as realtime (dynamic, connection-aware).P3 — Presence & execution observation UI. @mention online dot + active/idle count; shell-level
AgentPresenceProvider(single 15s poll); sidebar "N agents online" pill + popover; ExecutionRow deep-linking to the experiment panel; a Connections section in the/agentsdetail panel.P4 — Reverse control + in-experiment instruction injection. From the experiment panel: inject a free-text instruction (writes an audit comment + sends an
experiment_instructionnotification → daemon resumes the session) and interrupt a running turn (experiment_interrupt→ daemon kills the in-flight child via a per-experiment ChildRegistry). User-only routes; recipient derived server-side from the experiment's assignee.P5 — Session anchoring & human takeover. Session id = experimentUuid (already anchored in P2); panel "Copy session ID" so a human can
claude --resume <uuid>in the origin cwd.Verification
pnpm buildclean.presence+controlsections.synapse daemonover real SSE): instruction injection → resume turn, second instruction →--resume, audit comment + notifications persisted, interrupt → in-flight child SIGTERM-killed (exit 143) with the daemon surviving.Release surface (do NOT release yet — this PR is for review)
When released: publish new pkg
@synapse-research/synapse-daemon, bump@synapse-research/synapseCLI, rebuild Docker:latest. OpenClaw plugin: only the P1 heartbeat reporter changed. (Holding per request — not releasing.)🤖 Generated with Claude Code