Skip to content

Commit 9838407

Browse files
Manage Hermes Workspace as an interactive runtime
1 parent 28426ad commit 9838407

3 files changed

Lines changed: 35 additions & 6 deletions

File tree

‎config/ulysses/runtime-management.json‎

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -267,20 +267,33 @@
267267
"config_files": [
268268
{"path": "start.sh", "format": "shell"},
269269
{"path": "run.sh", "format": "shell"},
270+
{"path": "stop.sh", "format": "shell"},
270271
{"path": "update.sh", "format": "shell"}
271272
],
272273
"bootstrap_files": [
273274
{
274275
"path": ".env",
275276
"mode": "0600",
276-
"content": "# Hermes Workspace local-only defaults\nHOST=127.0.0.1\nPORT=3003\nHERMES_API_URL=http://127.0.0.1:8642\nHERMES_DASHBOARD_URL=http://127.0.0.1:9119\nCOOKIE_SECURE=0\nVITE_HERMESWORLD_ENABLED=0\nVITE_PLAYGROUND_WS_URL=\nVITE_PLAYGROUND_STATS_URL=\n"
277+
"content": "# Hermes Workspace trusted WSL/LAN defaults\nHOST=0.0.0.0\nPORT=3003\nNODE_ENV=production\nHERMES_HOME=${HOME}/.hermes\nHERMES_API_URL=http://127.0.0.1:8642\nHERMES_DASHBOARD_URL=http://127.0.0.1:9119\nHERMES_WORKSPACE_AUTO_START_AGENT=false\nHERMES_ALLOW_INSECURE_REMOTE=1\nCOOKIE_SECURE=0\nTRUST_PROXY=0\nVITE_HERMESWORLD_ENABLED=0\nVITE_PLAYGROUND_WS_URL=\nVITE_PLAYGROUND_STATS_URL=\nNEXT_PUBLIC_PING_URL=\nHERMES_SWARM_MEMORY_ROOT=${HOME}/Hermes/hermes-workspace\nHERMES_SWARM_DEFAULT_MODEL=compute1/Agents-A1-GPTQ-INT4-Sym\nVITE_HERMES_SWARM_DEFAULT_MODEL=compute1/Agents-A1-GPTQ-INT4-Sym\nHERMES_SWARM_BIFROST_BASE_URL=http://127.0.0.1:7999/v1\nHERMES_SWARM_BIFROST_MODEL=nvidia/minimaxai/minimax-m3\nHERMES_SWARM_BIFROST_VIRTUAL_KEY=\n"
278+
},
279+
{
280+
"path": "start.sh",
281+
"mode": "0755",
282+
"content": "#!/usr/bin/env bash\nset -Eeuo pipefail\nROOT=\"$(cd -- \"$(dirname -- \"${BASH_SOURCE[0]}\")\" && pwd -P)\"\ncd \"$ROOT\"\nif [[ -f .env ]]; then\n set -a\n source .env\n set +a\nfi\nexport BUN_INSTALL=\"${BUN_INSTALL:-$HOME/.bun}\"\nexport PATH=\"$HOME/.local/bin:$BUN_INSTALL/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin\"\nexport HERMES_HOME=\"${HERMES_HOME:-$HOME/.hermes}\"\nexport HOST=\"${HOST:-0.0.0.0}\"\nexport PORT=\"${PORT:-3003}\"\nexport HERMES_API_URL=\"${HERMES_API_URL:-http://127.0.0.1:8642}\"\nexport HERMES_DASHBOARD_URL=\"${HERMES_DASHBOARD_URL:-http://127.0.0.1:9119}\"\nworkspace_pid=\"\"\ndashboard_pid=\"\"\ndashboard_owned=false\ncleanup() {\n trap - EXIT INT TERM HUP\n if [[ -n \"$workspace_pid\" ]] && kill -0 \"$workspace_pid\" 2>/dev/null; then kill \"$workspace_pid\" 2>/dev/null || true; wait \"$workspace_pid\" 2>/dev/null || true; fi\n if [[ \"$dashboard_owned\" == true ]] && [[ -n \"$dashboard_pid\" ]] && kill -0 \"$dashboard_pid\" 2>/dev/null; then kill \"$dashboard_pid\" 2>/dev/null || true; wait \"$dashboard_pid\" 2>/dev/null || true; fi\n}\ntrap cleanup EXIT INT TERM HUP\nif ! curl -fsS --max-time 2 \"$HERMES_API_URL/health\" >/dev/null 2>&1; then\n printf 'Hermes gateway is unavailable at %s; refusing to create a duplicate gateway.\\n' \"$HERMES_API_URL\" >&2\n exit 1\nfi\nif ! curl -fsS --max-time 2 \"$HERMES_DASHBOARD_URL/api/status\" >/dev/null 2>&1; then\n hermes dashboard --host 127.0.0.1 --port 9119 --no-open &\n dashboard_pid=$!\n dashboard_owned=true\n for _ in {1..60}; do\n if curl -fsS --max-time 2 \"$HERMES_DASHBOARD_URL/api/status\" >/dev/null 2>&1; then break; fi\n if ! kill -0 \"$dashboard_pid\" 2>/dev/null; then printf 'Hermes dashboard exited before becoming ready.\\n' >&2; exit 1; fi\n sleep 1\n done\nfi\nif ! curl -fsS --max-time 2 \"$HERMES_DASHBOARD_URL/api/status\" >/dev/null 2>&1; then printf 'Hermes dashboard did not become ready.\\n' >&2; exit 1; fi\nif [[ ! -f dist/server/server.js ]]; then bun run build; fi\nprintf 'Starting Hermes Workspace at http://%s:%s\\n' \"$HOST\" \"$PORT\"\nbun server-entry.js &\nworkspace_pid=$!\nwait \"$workspace_pid\"\n"
277283
},
278284
{
279285
"path": "run.sh",
280286
"mode": "0755",
281-
"content": "#!/usr/bin/env bash\nset -Eeuo pipefail\nROOT=\"$(cd -- \"$(dirname -- \"${BASH_SOURCE[0]}\")\" && pwd -P)\"\ncd \"$ROOT\"\nif [[ -f .env ]]; then\n set -a\n source .env\n set +a\nfi\nHERMES_HOME=\"${HERMES_HOME:-$HOME/.hermes}\"\nif [[ -z ${HERMES_API_TOKEN:-} && -r \"$HERMES_HOME/.env\" ]]; then\n HERMES_API_TOKEN=\"$(sed -n 's/^API_SERVER_KEY=//p' \"$HERMES_HOME/.env\" | tail -n 1)\"\n HERMES_API_TOKEN=\"${HERMES_API_TOKEN%\\\"}\"\n HERMES_API_TOKEN=\"${HERMES_API_TOKEN#\\\"}\"\n export HERMES_API_TOKEN\nfi\nexec bun server-entry.js\n"
287+
"content": "#!/usr/bin/env bash\nset -Eeuo pipefail\nROOT=\"$(cd -- \"$(dirname -- \"${BASH_SOURCE[0]}\")\" && pwd -P)\"\nexec \"$ROOT/start.sh\"\n"
288+
},
289+
{
290+
"path": "stop.sh",
291+
"mode": "0755",
292+
"content": "#!/usr/bin/env bash\nset -Eeuo pipefail\nSESSION=\"${HERMES_WORKSPACE_TMUX:-diogenes-hermes-workspace}\"\nif tmux has-session -t \"=$SESSION\" 2>/dev/null; then tmux kill-session -t \"=$SESSION\"; printf 'Hermes Workspace stopped (%s).\\n' \"$SESSION\"; else printf 'Hermes Workspace is not running (%s).\\n' \"$SESSION\"; fi\n"
282293
}
283294
],
295+
"launch": ["bash", "start.sh"],
296+
"tmux_session": "diogenes-hermes-workspace",
284297
"git_update": true,
285298
"source_url": "https://github.com/outsourc-e/hermes-workspace.git",
286299
"source_branch": "main",
@@ -290,7 +303,7 @@
290303
"label": "Open Hermes Workspace",
291304
"url": "http://127.0.0.1:3003"
292305
},
293-
"ports": []
306+
"ports": [3003]
294307
},
295308
{
296309
"id": "librarian.mcp",

‎src/diogenes_docker_projects.py‎

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
from core.atomic_io import atomic_write_text
4949
from src.constants import DATA_DIR
5050
from src.ulysses_jobs import RuntimeJobError, RuntimeJobStore, native_host_environment
51+
from src.ulysses_runtime_management import load_runtime_management
5152

5253

5354
SCHEMA = "diogenes.docker.v2"
@@ -197,6 +198,16 @@ def _discover_project_paths() -> list[tuple[Path, Path]]:
197198
"""Arcane-style bounded discovery with child-project descent stopping."""
198199

199200
projects: dict[str, tuple[Path, Path]] = {}
201+
# A repository registered as a non-Docker runtime may still ship an
202+
# optional Compose file upstream. Do not duplicate that exact project root
203+
# in the Docker inventory; its declared Diogenes lifecycle remains the
204+
# source of truth. Descending continues so real nested Compose projects
205+
# remain discoverable.
206+
non_docker_roots = {
207+
os.path.normcase(str(item["root"].resolve()))
208+
for item in load_runtime_management()
209+
if item.get("category") != "docker"
210+
}
200211
for root in _configured_roots():
201212
if not root.is_dir() or root.is_symlink():
202213
continue
@@ -213,7 +224,7 @@ def _discover_project_paths() -> list[tuple[Path, Path]]:
213224
except OSError:
214225
continue
215226
compose = _detect_compose(resolved)
216-
if compose is not None:
227+
if compose is not None and identity not in non_docker_roots:
217228
projects[os.path.normcase(str(compose))] = (resolved, compose)
218229
# Arcane treats a child directory containing Compose as one
219230
# project. The configured root remains exempt so a Diogenes

‎static/js/ulyssesServices.js‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,12 @@ const SKILLS_MODAL_ID = 'diogenes-skills-auditor-modal';
1010
const SERVICE_ICON = '<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="4" width="18" height="6" rx="2"/><rect x="3" y="14" width="18" height="6" rx="2"/><path d="M7 7h.01M7 17h.01M11 7h7M11 17h7"/></svg>';
1111
const SKILLS_ICON = '<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M4 4h16v16H4z"/><path d="M8 9h8M8 13h5"/><path d="m15 16 1.5 1.5L20 14"/></svg>';
1212
const TERMINAL = new Set(['succeeded', 'failed', 'cancelled']);
13-
const INTERACTIVE_IDS = new Set(['camofox.browser', 'bifrost.gateway', 'signal.cli']);
13+
const INTERACTIVE_IDS = new Set([
14+
'camofox.browser',
15+
'bifrost.gateway',
16+
'signal.cli',
17+
'hermes.workspace',
18+
]);
1419
const DEPENDENCY_ACTIONS = [
1520
['install', 'Install'],
1621
['update', 'Update'],
@@ -503,7 +508,7 @@ function renderInteractive() {
503508
const managedCount = runtimes.filter((value) => value.tmux?.managed).length;
504509
return `
505510
<div class="dio-section-heading">
506-
<div><h3>Interactive processes</h3><p>Camofox, Bifrost, and signal-cli run in owned tmux sessions.</p></div>
511+
<div><h3>Interactive processes</h3><p>Camofox, Bifrost, signal-cli, and Hermes Workspace run in owned tmux sessions.</p></div>
507512
<button type="button" data-stop-interactive ${managedCount ? '' : 'disabled'}>
508513
Stop all${managedCount ? ` (${managedCount})` : ''}
509514
</button>

0 commit comments

Comments
 (0)