Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -728,6 +728,8 @@ rollback. Do not rely on a pre-existing mutable `openswarm:latest` image.

Without `OPENSWARM_WEB_TOKEN` the dashboard binds only inside the container — an unauthenticated all-interfaces bind is refused by design — so the published port answers nothing while the daemon itself keeps running. With the token set, browser/API access from the host sends it as the `X-OpenSwarm-Token` header (`/api/health` stays token-less).

**Web terminal (opt-in).** `OPENSWARM_WEB_TERMINAL=1` adds a `/terminal` page: a `bash -l` shell inside the daemon's container (same uid, cwd `OPENSWARM_WORKSPACE_ROOT`, default `/work`). Unset, neither the page nor its WebSocket exists. The upgrade passes the same gate as API mutations (web token, or loopback / trusted Tailscale with a same-host `Origin`); the browser sends the token as a `Sec-WebSocket-Protocol` entry, never in the URL. At most 4 sessions, each closed after 15 minutes without input; starts and stops are logged with the peer address. **Terminal access is access to the container's environment, including every token the daemon holds** — enable it only where the web gate already limits access to the operator.

The compose file wires the persistent and local-data mounts that matter:

| Mount | Purpose |
Expand Down
4 changes: 4 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ services:
# web UI writes through a second mount of the same host directory.
- OPENSWARM_WAREHOUSE_ROOT=/warehouse
- OPENSWARM_WAREHOUSE_WRITE_ROOT=/warehouse-rw
# Web virtual terminal (/terminal): a bash shell INSIDE this container for
# any authorized web client. Off unless set to 1. Whoever can open it can
# read this container's environment, including every token above.
- OPENSWARM_WEB_TERMINAL=${OPENSWARM_WEB_TERMINAL:-}
# Provider/API keys come from .env (see env_file) or the shell:
# LINEAR_API_KEY, LINEAR_TEAM_ID, DISCORD_TOKEN, DISCORD_CHANNEL_ID,
# ATLASCLOUD_API_KEY, OPENROUTER_API_KEY, ...
Expand Down
54 changes: 48 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 8 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"dev": "node --env-file=.env --import=tsx src/index.ts",
"prestart": "pkill -f 'dist/index.js' 2>/dev/null || true",
"build": "tsc",
"postbuild": "chmod +x dist/cli.js && node -e \"const fs=require('node:fs');fs.rmSync('dist/web-static',{recursive:true,force:true});fs.cpSync('web/static','dist/web-static',{recursive:true})\"",
"postbuild": "chmod +x dist/cli.js && node -e \"const fs=require('node:fs');fs.rmSync('dist/web-static',{recursive:true,force:true});fs.cpSync('web/static','dist/web-static',{recursive:true})\" && node scripts/copy-web-vendor.mjs",
"start": "node --env-file=.env dist/index.js",
"stop": "pkill -f 'node --env-file=.env.*openswarm' 2>/dev/null || echo 'No process running'",
"lint": "oxlint src/ web/static/js/",
Expand Down Expand Up @@ -73,13 +73,17 @@
"nanoid": "^5.1.7",
"react": "^19.2.7",
"undici": "^6.28.0",
"ws": "^8.23.0",
"yaml": "^2.8.2",
"zod": "^4.3.6"
},
"devDependencies": {
"@types/node": "^22.0.0",
"@types/react": "^19.2.17",
"@types/ws": "^8.18.2",
"@vitest/coverage-v8": "^4.0.18",
"@xterm/addon-fit": "^0.11.0",
"@xterm/xterm": "^6.0.0",
"bun-types": "^1.1.0",
"ink-testing-library": "^4.0.0",
"jsdom": "^26.1.0",
Expand All @@ -97,5 +101,8 @@
"undici": "^6.28.0",
"adm-zip": "^0.6.1",
"sharp": "^0.35.0"
},
"optionalDependencies": {
"node-pty": "^1.1.0"
}
}
25 changes: 25 additions & 0 deletions scripts/copy-web-vendor.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// Copy browser-side vendor files (xterm.js for the opt-in web terminal,
// AGT-4002) into dist/web-static/vendor. The dashboard loads no third-party
// CDN, so the terminal page needs these served from the daemon itself.
// Runs from postbuild after web/static has been copied.
import { copyFileSync, existsSync, mkdirSync } from 'node:fs';
import { join } from 'node:path';

const target = join('dist', 'web-static', 'vendor', 'xterm');
const files = [
['node_modules/@xterm/xterm/lib/xterm.js', 'xterm.js'],
['node_modules/@xterm/xterm/css/xterm.css', 'xterm.css'],
['node_modules/@xterm/addon-fit/lib/addon-fit.js', 'addon-fit.js'],
];

mkdirSync(target, { recursive: true });
let missing = 0;
for (const [from, name] of files) {
if (!existsSync(from)) {
missing += 1;
console.warn(`[copy-web-vendor] missing ${from}; the web terminal page will not load`);
continue;
}
copyFileSync(from, join(target, name));
}
if (missing === 0) console.log(`[copy-web-vendor] ${files.length} files -> ${target}`);
5 changes: 5 additions & 0 deletions src/support/staticAssets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,11 @@ export async function readUsageShell(): Promise<Buffer | null> {
return readShellFile('usage.html');
}

/** The opt-in web terminal shell (AGT-4002); routed only when OPENSWARM_WEB_TERMINAL=1. */
export async function readTerminalShell(): Promise<Buffer | null> {
return readShellFile('terminal.html');
}

/** The /app entry document, or null when assets are not present. */
export async function readAppShell(): Promise<Buffer | null> {
return readShellFile('app.html');
Expand Down
Loading
Loading