Skip to content

Add live guide attachment, Herdr-optional execution, in-place init, and merge API - #258

Merged
raphael merged 29 commits into
mainfrom
s1-agent-core
Nov 19, 2026
Merged

raphael merged 29 commits into
mainfrom
s1-agent-core

Conversation

@raphael

@raphael raphael commented Nov 19, 2026

Copy link
Copy Markdown
Member

Starting and completing a Surla change previously required leaving a coding agent for a shell at four points: running surla (which hard-failed without Herdr and opened the chorus-launcher modal before any change existed), creating a starter in a nested subfolder rather than an empty current directory, running surla again whenever a browser tab closed or reloaded, and running two git merge commands by hand after approving a verification result. In addition, worker panes stayed open after a build was merged or dropped, and builds could not run on machines without Herdr.

Resulting behavior

  • Live Guide attachment, safe browser opening, and project status: Management endpoint POST /project/attach-guide registers the guide role and, when given a live local Herdr terminal ID (HC_TERMINAL_ID) in an unconflicted tab, adopts its space and tab in place via terminal labels (normalizing chorus.agent, clearing chorus.options, and opening the non-modal surla companion window if installed and not already open) while deleting automatic chorus-launcher dialog invocations. GET /project/status and surla status [--json] report read-only project, stage, active-change, attention, and role status without starting a server when stopped. Bare surla becomes Herdr-optional, and the new open_views MCP tool (guide and user) mints a one-use browser link internally and opens the browser server-side without returning link or session secrets to any agent.
  • In-place empty-folder initialization (init_project with dir: "."): While keeping omitted dir defaulting to a <service> child folder for existing callers, init_project now accepts dir: "." to initialize an empty workspace root in place (permitting harmless agent/IDE dot-entries while refusing .git, project markers, or colliding files, and committing an inode-bound write-ahead record that moves .git last for deterministic crash recovery).
  • Herdr-optional daemon, on-demand agent options, and headless worker fallback: When hc is unavailable, surla launches surla serve as a detached OS daemon (Setsid, bounded serve-startup.log diagnostics). GET /team stays subprocess-free (herdr_mode, saved_choices, dismissed_notices), while GET /team/agent-options discovers locally installed agent CLIs and model/YOLO capabilities on demand. StartBuild and StartAgents accept explicit role choices (falling back to saved choices or cross-family defaults), write connections: [] rosters (worker-only when guide has no live Herdr pane) via chorus team launch, and—when Herdr is absent—execute builder and test_writer inside bounded, server-managed process groups (herdrEnv preserved, Chorus-optional, gated on in-flight report/verification checks, and drained on server shutdown).
  • User-only merge_change and build-scoped StopWorkers: POST /changes/{change_id}/merge (CallerUser only) re-verifies live currentCard approval and an undropped open build, checks a named branch, clean tracked working tree, and safe Git attribute/hook/include configuration, merges the candidate and accepted tests commits with deterministic git reset --merge rollback to the original HEAD on any failure, and triggers StopWorkers(ctx, buildIdentity) (also called on drop_build and first observed manual merge in supervision) to close only finished worker panes or processes without touching guide.

Compatibility and verification

Existing Change Card, build, and verification files load unchanged; omitted dir on init_project retains child-directory creation, and repositories using .gitattributes, hook.<name>.command, or in-worktree Git config includes refuse automatic server merge cleanly in favor of manual git merge. Unit and integration suites verify detached daemon startup without hc, live HC_TERMINAL_ID pane adoption and conflict fallback, open_views secret non-leakage, init_project(dir: ".") publication and crash replay, chorus team launch and headless process-group execution (including single-agent installs and Chorus-absent mode), two-step merge_change rollback across conflicts and ignored-file collisions, and BuildIdentity-guarded worker teardown. CLI and stdio setup entrypoints (surla stdio, surla setup -global, surla up) and the browser picker/merge controls land in the immediately following slices.

AgentCredential reads the bearer credential saved for one agent handle
through the existing private-file and format checks, so surla stdio can
present it to /mcp for the guide it attached or the worker whose working
copy it runs in. A missing file still matches os.ErrNotExist.
@raphael
raphael merged commit 004ee3f into main Nov 19, 2026
25 checks passed
@raphael
raphael deleted the s1-agent-core branch November 19, 2026 21:17
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