orchestrator: restore opencode web launcher

This commit is contained in:
autonomic-bot
2026-06-12 15:45:09 +00:00
parent 03343ed3cf
commit a186f23b37
4 changed files with 61 additions and 15 deletions
+8 -2
View File
@@ -31,7 +31,7 @@ Env:
the session title in the web UI is the SESSION name)
"""
import os, sys, subprocess
import json, os, shlex, sys, subprocess
from datetime import datetime
from pathlib import Path
@@ -147,9 +147,15 @@ def start(mode="resume"):
die(f"opencode not found at {OPENCODE_BIN}")
# Attach the orchestrator TUI to the shared opencode web server so it shows up in the
# same project/session listing as browser-created sessions.
model_env = ""
if LOOP_MODEL:
# attach has no --model flag, so inject a one-off config overlay for this session.
model_env = (
f"OPENCODE_CONFIG_CONTENT={shlex.quote(json.dumps({'model': LOOP_MODEL}))} "
)
cmd = (
f"set -a; . /srv/cc-ci/.testenv; set +a; "
f"NO_COLOR=1 {OPENCODE_BIN} attach {OPENCODE_SERVER} --dir {WORKDIR}"
f"{model_env}NO_COLOR=1 {OPENCODE_BIN} attach {OPENCODE_SERVER} --dir {shlex.quote(WORKDIR)}"
)
log(f"starting {SESSION} (backend=opencode, model={LOOP_MODEL or 'default'})")
log(f" visible at http://oc.commoninternet.net (tailnet only)")