@boldblackai/harness 1.13.0 → 1.14.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -73,6 +73,7 @@ That's it. Your current directory is mounted at `/workspace` inside the containe
73
73
  - [pi (default)](#pi-default)
74
74
  - [opencode](#opencode)
75
75
  - [hermes](#hermes)
76
+ - [Browser Desktop](#browser-desktop)
76
77
  - [Security model](#security-model)
77
78
  - [Sandbox](#sandbox)
78
79
  - [Image verification](#image-verification)
@@ -109,6 +110,9 @@ npx @boldblackai/harness -f ./script.py -p "add type hints"
109
110
  # Switch agents
110
111
  npx @boldblackai/harness -a opencode -p "write me a fizzbuzz in Go"
111
112
  npx @boldblackai/harness -a hermes -e .env -p "add tests"
113
+
114
+ # Serve the browser Desktop (no TUI — the browser chat is the interface)
115
+ npx @boldblackai/harness desktop
112
116
  ```
113
117
 
114
118
  `npx`, `bunx`, and `pnpm dlx` are interchangeable. Or install globally:
@@ -173,6 +177,39 @@ Common keys: `ANTHROPIC_API_KEY`, `OPENROUTER_API_KEY`, `OPENAI_API_KEY`, `GOOGL
173
177
 
174
178
  **Multiple API keys in one env file.** With `--env-file`, each agent auto-detects a provider from the keys present. If the file contains keys for more than one provider (e.g. `OPENROUTER_API_KEY` and `GLM_API_KEY`), the agent may not pick the one you expect — `pi` and `opencode` follow their own detection order. For one-shot runs, use a single-provider env file, or select the agent and model explicitly (e.g. `harness -a hermes -e .env -m zai/glm-4.7 -p "..."`).
175
179
 
180
+ ### Browser Desktop
181
+
182
+ `harness desktop` serves the hermes Webapp - the browser-hosted
183
+ Desktop - from the container. It runs no agent command (no TUI): the
184
+ Desktop's browser chat is the interface.
185
+
186
+ ```bash
187
+ harness desktop
188
+ # harness desktop: http://localhost:3000 - sign in: admin / <generated password>
189
+ ```
190
+
191
+ - `harness desktop` implies `-a hermes` (it errors with any other
192
+ explicit `-a`) and takes no prompt (it errors with `-p`). It
193
+ publishes `3000:3000`. If you already publish container port 3000
194
+ yourself over TCP or without a protocol suffix (e.g. `--port
195
+ 8080:3000`), that publish is used and no extra one is added; a
196
+ udp/sctp publish of container port 3000 does not count.
197
+ - A sign-in password is generated at first start, persisted in the
198
+ hermes session data (`$XDG_DATA_HOME/harness/<project>/hermes/.env`,
199
+ mode 0600), and printed in the terminal at every start. Set your own
200
+ with `HARNESS_DESKTOP_PASSWORD=... harness desktop`. The Webapp is
201
+ gated by this sign-in - treat the password like one.
202
+ - The container keeps serving the Desktop until you stop it (the
203
+ gateway holds the container open). Persistence stays on like an
204
+ interactive run (an explicit `--ephemeral` still wins).
205
+ - On an image without a baked Webapp bundle (images older than the
206
+ bundle build), harness prints an error and the container exits -
207
+ serve-only mode has nothing else to run.
208
+
209
+ The Desktop is served over plain HTTP; browser features that need a
210
+ secure context (microphone, clipboard, notifications) are limited -
211
+ see hermes' `webapp.public_url` for HTTPS setups.
212
+
176
213
  ## Security model
177
214
 
178
215
  Harness layers protections at runtime, image, and dependency level.
@@ -280,6 +317,7 @@ Local-only mode pairs naturally with local mode: `harness --local --egress none`
280
317
  | `HARNESS_IMAGE_TAG` | Override the Docker image tag (defaults to the package version). Setting this implies `--no-verify`. |
281
318
  | `HARNESS_CONTAINER_RUNTIME` | Container runtime: `auto` (default — on macOS, prefers Apple's `container` CLI if on PATH; docker everywhere else), `docker` (force docker), or `apple` (deprecated explicit alias; warns). |
282
319
  | `HARNESS_EGRESS_SUBNET` | Override the egress network subnet (IPv4 CIDR; default pool `192.0.2.0/24` split into /29s). |
320
+ | `HARNESS_DESKTOP_PASSWORD` | Set the Webapp sign-in password for `harness desktop` (default: generated at first start, persisted in session data, printed in the terminal at every start). |
283
321
  | `XDG_DATA_HOME` | Override the base directory for persistence data (defaults to `~/.local/share`). |
284
322
  | `XDG_CACHE_HOME` | Override the base directory for the cosign cache (defaults to `~/.cache`). |
285
323
 
package/bin/harness.js CHANGED
@@ -423,6 +423,14 @@ function isAgentName(name) {
423
423
  return AGENT_NAMES.includes(name);
424
424
  }
425
425
  const USAGE = `Usage: harness [options]
426
+ harness desktop [options]
427
+
428
+ Commands:
429
+ desktop Serve the hermes Webapp (browser Desktop) at http://localhost:3000. Runs no
430
+ agent command (no TUI) - the Desktop's browser chat is the interface. Implies
431
+ -a hermes (errors with any other -a) and a 3000:3000 publish (skipped when you
432
+ already publish container port 3000 over TCP or without a protocol suffix).
433
+ Prints a generated sign-in password at start. Takes no prompt.
426
434
 
427
435
  Options:
428
436
  -p, --prompt <text> Pass a prompt directly to the coding agent
@@ -448,6 +456,7 @@ Environment variables:
448
456
  HARNESS_REGISTRY Override the container registry (defaults to ghcr.io/boldblackai/harness)
449
457
  HARNESS_CONTAINER_RUNTIME Container runtime: auto (default; prefers Apple container on macOS), docker, apple (deprecated)
450
458
  HARNESS_EGRESS_SUBNET Override the egress network subnet pool (IPv4 CIDR, default 192.0.2.0/24 split into /29s)
459
+ HARNESS_DESKTOP_PASSWORD Set the Webapp sign-in password for harness desktop (default: generated at first start)
451
460
  XDG_DATA_HOME Override the base directory for persistence data (defaults to ~/.local/share)
452
461
  XDG_CACHE_HOME Override the base directory for cosign cache (defaults to ~/.cache)
453
462
 
@@ -540,6 +549,9 @@ const noSkills = argv.skills === false;
540
549
  const noContextFiles = argv["context-files"] === false;
541
550
  const mountEntireHome = argv["mount-entire-home"] === true;
542
551
  const localMode = argv.local;
552
+ // The `harness desktop` subcommand serves the hermes Webapp only: no
553
+ // agent command runs (no TUI), the browser is the interface.
554
+ const desktopMode = argv._[0] === "desktop";
543
555
  const envFilePaths = Array.isArray(argv["env-file"])
544
556
  ? argv["env-file"]
545
557
  : argv["env-file"]
@@ -548,8 +560,25 @@ const envFilePaths = Array.isArray(argv["env-file"])
548
560
  const fileArg = argv.file || null;
549
561
  const promptArg = argv.prompt || null;
550
562
  const modelArg = argv.model || null;
551
- const effectiveEphemeral = argv.ephemeral || promptArg !== null || !process.stdin.isTTY;
563
+ if (desktopMode && (argv.prompt !== undefined || argv._.length > 1)) {
564
+ console.error("harness: desktop does not take a prompt; the Desktop's browser chat is the interface");
565
+ process.exit(1);
566
+ }
567
+ // harness desktop keeps persistence on (an interactive-style session);
568
+ // an explicit --ephemeral still wins.
569
+ const effectiveEphemeral = argv.ephemeral ||
570
+ (!desktopMode && (promptArg !== null || !process.stdin.isTTY));
552
571
  const agentName = (() => {
572
+ if (desktopMode) {
573
+ // The Desktop is a hermes feature: imply -a hermes, and refuse an
574
+ // explicit other agent rather than silently switching.
575
+ const requested = argv.agent;
576
+ if (requested !== undefined && requested !== "hermes") {
577
+ console.error(`harness: desktop works only with -a hermes (got -a "${requested}"); drop -a or pass -a hermes`);
578
+ process.exit(1);
579
+ }
580
+ return "hermes";
581
+ }
553
582
  const name = argv.agent ?? "pi";
554
583
  if (!isAgentName(name)) {
555
584
  console.error(`harness: unknown agent: "${name}". Available: ${Object.keys(ADAPTERS).join(", ")}`);
@@ -627,6 +656,25 @@ for (const spec of portArgList) {
627
656
  process.exit(1);
628
657
  }
629
658
  }
659
+ // The `desktop` subcommand implies a 3000:3000 publish unless the user
660
+ // already publishes container port 3000 themselves; the host port of
661
+ // that publish is what the printed Desktop URL uses. Only a tcp (or
662
+ // protocol-less, which the runtimes default to tcp) publish counts — a
663
+ // udp/sctp one would leave the TCP Webapp unpublished and the printed
664
+ // URL dead.
665
+ const desktopHostPort = (() => {
666
+ if (!desktopMode) {
667
+ return null;
668
+ }
669
+ for (const spec of portArgList) {
670
+ const match = spec.match(PORT_SPEC_REGEXP);
671
+ if (match && match[2] === "3000" && (match[3] ?? "tcp") === "tcp") {
672
+ return match[1];
673
+ }
674
+ }
675
+ portArgList.push("3000:3000");
676
+ return "3000";
677
+ })();
630
678
  // ---------------------------------------------------------------------------
631
679
  // Egress control (rfcs/2026-10-08_egress_allowlist.md), Tier 1: pass an
632
680
  // existing container network through to the runtime. Brings your own
@@ -1165,9 +1213,33 @@ async function run(prompt) {
1165
1213
  // Cloud mode: -e without --local signals entrypoints to skip local/defaults
1166
1214
  // and let agents auto-detect providers from env vars in the file.
1167
1215
  const cloudModeEnv = envFilePaths.length > 0 && !localMode ? ["-e", "HARNESS_CLOUD_MODE=1"] : [];
1216
+ // The `desktop` subcommand: the entrypoint wires the Webapp (config +
1217
+ // sign-in credentials) from these and serves it only (no agent
1218
+ // command runs). HARNESS_DESKTOP_PASSWORD is the user's own password
1219
+ // knob; HERMES_MODEL carries --model to the gateway's agent.
1220
+ const desktopEnv = desktopHostPort === null
1221
+ ? []
1222
+ : [
1223
+ "-e",
1224
+ "HARNESS_DESKTOP=1",
1225
+ "-e",
1226
+ "HARNESS_DESKTOP_SERVE_ONLY=1",
1227
+ "-e",
1228
+ `HARNESS_DESKTOP_HOST_PORT=${desktopHostPort}`,
1229
+ ];
1230
+ const desktopPassword = process.env.HARNESS_DESKTOP_PASSWORD ?? "";
1231
+ if (desktopHostPort !== null && desktopPassword !== "") {
1232
+ desktopEnv.push("-e", `HARNESS_DESKTOP_PASSWORD=${desktopPassword}`);
1233
+ }
1234
+ if (desktopHostPort !== null && modelArg !== null) {
1235
+ desktopEnv.push("-e", `HERMES_MODEL=${modelArg}`);
1236
+ }
1168
1237
  const adapter = ADAPTERS[agentName];
1169
1238
  const adapterOptions = { prompt, model: modelArg, envFilePaths };
1170
- const containerCmd = adapter.buildCommand(adapterOptions);
1239
+ // Serve-only in desktop mode: no agent command runs at all (no TUI) —
1240
+ // the entrypoint hands PID 1 to the gateway and the browser is the
1241
+ // interface.
1242
+ const containerCmd = desktopMode ? [] : adapter.buildCommand(adapterOptions);
1171
1243
  const adapterDockerArgs = adapter.extraDockerArgs?.(adapterOptions) ?? [];
1172
1244
  const interactive = process.stdin.isTTY;
1173
1245
  let volumeArgs;
@@ -1265,6 +1337,7 @@ async function run(prompt) {
1265
1337
  envFileArgs,
1266
1338
  envArgs: [
1267
1339
  ...cloudModeEnv,
1340
+ ...desktopEnv,
1268
1341
  ...adapterDockerArgs,
1269
1342
  ...(egress?.envArgs ?? []),
1270
1343
  ],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@boldblackai/harness",
3
- "version": "1.13.0",
3
+ "version": "1.14.1",
4
4
  "description": "Portable environment for running coding agents in a container",
5
5
  "bin": {
6
6
  "harness": "bin/harness.js"
@@ -21,7 +21,7 @@
21
21
  "lint": "pnpm lint:ts && pnpm lint:md && pnpm lint:sh && pnpm lint:docker && pnpm lint:actions",
22
22
  "lint:ts": "biome check .",
23
23
  "lint:md": "markdownlint-cli2 \"**/*.md\" \"#node_modules\"",
24
- "lint:sh": "shellcheck setup-env.sh entrypoint.sh entrypoint-opencode.sh entrypoint-hermes.sh",
24
+ "lint:sh": "shellcheck setup-env.sh entrypoint.sh entrypoint-opencode.sh entrypoint-hermes.sh scripts/fetch-retry.sh",
25
25
  "lint:docker": "hadolint Dockerfile Dockerfile.opencode Dockerfile.hermes Dockerfile.egress-proxy",
26
26
  "lint:actions": "actionlint",
27
27
  "format": "biome format --write .",