ocruntime package + native tmux runtime (#376) #389
Labels
No labels
backend
bug
chore
duplication
effort:complex
effort:medium
effort:trivial
enhancement
frontend
fullstack
priority:high
ready-for-agent
refactor
security
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
dries/ocman#389
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Parent
#388 (spec), #376, epic #375. Spec:
spec/runtime-neutral-lifecycle/requirements.md(AD-1, AD-3, AD-4, AD-10).What to build
A new
internal/ocruntimepackage that abstracts how a project's OpenCode instance is hosted, with a native-tmux implementation. This is the plug point #375's container runtime slots into. Built and unit-tested in isolation; not yet wired into the host (that is the next ticket).Runtimeinterface:Launch(ctx, LaunchSpec) (*Instance, error),Probe(ctx, *Instance) bool,Stop(ctx, *Instance) error.LaunchSpec{RepoRoot, Host, Port, PermissionJSON}(secret field added by #377).Instance{Endpoint, Kind, ID, PID, secret(unexported)}.Native runtime:
Launchthreads the given ocman-allocated port into the tmux launch (opencode --port N, replacing--port 0), seedsOPENCODE_PERMISSION, returnsEndpoint(full base URL) +Kind="native-tmux"+ tmux session name asID.Probe=GET /configreturns 200.Stopkills the tmux session. A free-loopback-port allocator (bind→close) lives here or in a small helper (host will call it — AD-3 says allocation is host policy, but the helper can live alongside).Native tmux behavior stays compatible: same
tmux.SessionNameForPath, same attachable window, same permission seeding.Acceptance criteria
internal/ocruntimeexposes theRuntimeinterface +LaunchSpec/Instancetypes;secretis unexported (with aponytail:note for #377).Launchlaunchesopencode --port N(not--port 0) with the allocated port and seedsOPENCODE_PERMISSION.Probereturns true only whenGET /configanswers 200; false on refused/500/other.Stoptears down the tmux session.Blocked by
None — can start immediately.