@dreamtree-org/harness-device 0.1.1 → 0.1.2
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/CHANGELOG.md +7 -0
- package/README.md +3 -1
- package/package.json +1 -1
- package/sh/setup/darwin.sh +14 -2
- package/src/capabilities.js +6 -1
- package/src/cli.js +13 -2
- package/src/config.js +3 -0
- package/src/install.js +1 -1
- package/src/ngrok.js +12 -3
- package/src/platform/darwin.js +6 -2
- package/src/providers/claude.js +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.1.2
|
|
4
|
+
|
|
5
|
+
- **Dokploy:** secret fields in API responses are redacted before they reach the agent; optional `DOKPLOY_TOOL_PRESET` / `DOKPLOY_ENABLED_TAGS` / `DOKPLOY_DISABLED_TAGS` in config.env limit the tools loaded.
|
|
6
|
+
- **ngrok:** Intel Macs get ngrok's official release in `~/.local/bin`; `ngrok up` waits for every tunnel and lists it; one tunnel can be opened by name (`ngrok up ttyd`); a warning when tunnels share the single URL of a free plan.
|
|
7
|
+
- **Install summary** lists only the MCP servers it registered, and names the ones of yours it kept.
|
|
8
|
+
- `.env` and `.playwright-mcp/` are git-ignored.
|
|
9
|
+
|
|
3
10
|
## 0.1.1
|
|
4
11
|
|
|
5
12
|
Fixes from the first installs on a real Mac (Intel) and checks on Ubuntu 26.04.
|
package/README.md
CHANGED
|
@@ -123,6 +123,8 @@ harness-device install
|
|
|
123
123
|
harness-device doctor # "Dokploy API accepts the key"
|
|
124
124
|
```
|
|
125
125
|
|
|
126
|
+
Secrets in Dokploy's API responses (env vars, passwords, tokens) are redacted before they reach the agent (`DOKPLOY_REDACT_ENV=true`). To load fewer Dokploy tools, add any of these to `config.env` and run `install` again: `DOKPLOY_TOOL_PRESET`, `DOKPLOY_ENABLED_TAGS=project,application,postgres`, `DOKPLOY_DISABLED_TAGS`. If you already have your own `dokploy` MCP server, install leaves it as it is and the device's is not registered.
|
|
127
|
+
|
|
126
128
|
### Updating
|
|
127
129
|
|
|
128
130
|
Run `install` again with the new version: `npx @dreamtree-org/harness-device@latest install`. It is idempotent. It updates scripts, services, MCP registrations and the skill, and never restarts the tmux session, so live conversations keep running. Add or drop capabilities the same way: `init --with …` / `--without …`, then `install`.
|
|
@@ -164,7 +166,7 @@ Pick them with `init --with`/`--without`, or edit `CAPABILITIES=` in `config.env
|
|
|
164
166
|
| `docker` | Docker Engine (`get.docker.com`) | Docker Desktop, else colima | `docker`, `docker compose` |
|
|
165
167
|
| `dokploy` | API only | API only | Dokploy MCP against your deployment (`DOKPLOY_URL` + `secrets set DOKPLOY_API_KEY`); nothing is installed |
|
|
166
168
|
| `graphify` | | | `@dreamtree-org/graphify` CLI; `graphify .` wires a project's graph MCP and hooks |
|
|
167
|
-
| `ngrok` | apt repo | Homebrew (Intel: ngrok
|
|
169
|
+
| `ngrok` | apt repo | Homebrew (Intel: ngrok's official release, into `~/.local/bin`) | Tunnels you open; the agent may only read them |
|
|
168
170
|
| `ollama` | ollama.com script | Homebrew (Intel: Ollama app) | Local models on 127.0.0.1:11434 (`OLLAMA_MODELS` pulled on install) |
|
|
169
171
|
|
|
170
172
|
Extra MCP servers for the agent: add `MCP_<name>=command args` lines to `config.env`. They run through `hd-with-secrets`, so API keys stay in `secrets.env`.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dreamtree-org/harness-device",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "Turn a Linux server into a reboot-proof Claude Code harness: Remote Control per project in tmux, a persistent Chromium + Playwright MCP on a virtual display, live viewers (noVNC, ttyd, Playwright UI), self-healing systemd services, plus Docker, Dokploy, ngrok and AI-provider tooling.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Partha Preetham Krishna",
|
package/sh/setup/darwin.sh
CHANGED
|
@@ -94,8 +94,20 @@ fi
|
|
|
94
94
|
|
|
95
95
|
if want ngrok; then
|
|
96
96
|
if ! has ngrok; then
|
|
97
|
-
has brew
|
|
98
|
-
|
|
97
|
+
if has brew; then
|
|
98
|
+
brew install ngrok
|
|
99
|
+
else
|
|
100
|
+
# Not on conda-forge: ngrok's own release (its official download host), into ~/.local/bin.
|
|
101
|
+
arch=$(uname -m); [ "$arch" = x86_64 ] && arch=amd64
|
|
102
|
+
log "installing ngrok (official release for darwin-$arch) into ~/.local/bin"
|
|
103
|
+
tmp=$(mktemp -d)
|
|
104
|
+
curl -fsSL -o "$tmp/ngrok.zip" "https://bin.equinox.io/c/bNyj1mQVY4c/ngrok-v3-stable-darwin-$arch.zip"
|
|
105
|
+
mkdir -p "$HOME/.local/bin"
|
|
106
|
+
unzip -o -q "$tmp/ngrok.zip" ngrok -d "$HOME/.local/bin"
|
|
107
|
+
chmod 755 "$HOME/.local/bin/ngrok"
|
|
108
|
+
rm -r "$tmp"
|
|
109
|
+
"$HOME/.local/bin/ngrok" version >/dev/null || die "ngrok did not install"
|
|
110
|
+
fi
|
|
99
111
|
fi
|
|
100
112
|
fi
|
|
101
113
|
|
package/src/capabilities.js
CHANGED
|
@@ -15,6 +15,8 @@ import { listSessions, listProcs } from './state.js';
|
|
|
15
15
|
|
|
16
16
|
export const PLAYWRIGHT_MCP = '@playwright/mcp@0.0.86';
|
|
17
17
|
export const DOKPLOY_MCP = '@dokploy/mcp@0.30.7';
|
|
18
|
+
/** Optional @dokploy/mcp tool filters, passed through from config.env when set. */
|
|
19
|
+
export const DOKPLOY_OPTIONS = ['DOKPLOY_TOOL_PRESET', 'DOKPLOY_ENABLED_TAGS', 'DOKPLOY_DISABLED_TAGS'];
|
|
18
20
|
|
|
19
21
|
const isMac = (plat) => plat && plat.id === 'darwin';
|
|
20
22
|
|
|
@@ -159,7 +161,10 @@ You can use \`docker\` and \`docker compose\` directly${isMac(plat) ? ' (the eng
|
|
|
159
161
|
|
|
160
162
|
dokploy: {
|
|
161
163
|
label: 'Dokploy (your existing deployment, through its API and the Dokploy MCP)',
|
|
162
|
-
|
|
164
|
+
// Secrets in API responses (env vars, passwords, tokens) are redacted before
|
|
165
|
+
// they reach the agent; optional tool filters come from config.env.
|
|
166
|
+
mcp: (cfg, p) => [{ name: 'dokploy', command: path.join(p.bin, 'hd-with-secrets'), args: ['env', `DOKPLOY_URL=${cfg.DOKPLOY_URL}`, 'DOKPLOY_REDACT_ENV=true',
|
|
167
|
+
...DOKPLOY_OPTIONS.filter((k) => cfg[k]).map((k) => `${k}=${cfg[k]}`), 'npx', '-y', DOKPLOY_MCP] }],
|
|
163
168
|
secrets: ['DOKPLOY_API_KEY'],
|
|
164
169
|
checks: async (ctx) => {
|
|
165
170
|
const url = ctx.cfg.DOKPLOY_URL;
|
package/src/cli.js
CHANGED
|
@@ -333,9 +333,17 @@ export async function main(argv) {
|
|
|
333
333
|
writeFile(p.ngrokYml, ngrok.renderNgrokYml(ctx.cfg, fs.readFileSync(p.ngrokToken, 'utf8').trim(), ctx.platform.id), { mode: 0o600 });
|
|
334
334
|
writeFile(p.ngrokEnv, ngrok.renderNgrokEnv(names), { mode: 0o600 });
|
|
335
335
|
ctx.platform.ngrokUp(ctx);
|
|
336
|
-
|
|
337
|
-
|
|
336
|
+
// The agent needs a few seconds to connect; wait for every tunnel (up to 30 s).
|
|
337
|
+
let s = { running: false, tunnels: [] };
|
|
338
|
+
for (let i = 0; i < 30; i++) {
|
|
339
|
+
await new Promise((r) => setTimeout(r, 1000));
|
|
340
|
+
s = await device.ngrokStatus();
|
|
341
|
+
if (s.tunnels.length >= names.length) break;
|
|
342
|
+
}
|
|
338
343
|
for (const t of s.tunnels) console.log(` ${t.name.padEnd(10)} ${color.bold(t.url)} → ${t.addr}`);
|
|
344
|
+
const shared = ngrok.sharedUrls(s.tunnels);
|
|
345
|
+
if (shared.length) log.warn(`Your ngrok plan gives one URL, so ${shared.join(', ')} share it and each request goes to either at random. Open one at a time (e.g. harness-device ngrok up ttyd), or reserve more domains.`);
|
|
346
|
+
if (s.running && s.tunnels.length < names.length) log.warn(`only ${s.tunnels.length} of ${names.length} tunnels are up yet; check: harness-device ngrok status, harness-device logs ngrok`);
|
|
339
347
|
if (names.some((n) => ['novnc', 'ttyd', 'pwui'].includes(n))) log.info(color.dim(` viewer login: ${ctx.cfg.NGROK_VIEWER_USER} / (NGROK_VIEWER_PASS in ${p.config})`));
|
|
340
348
|
return log.ok(s.running ? `ngrok up (survives reboots until: harness-device ngrok down)` : 'ngrok did not start yet; check: harness-device logs ngrok');
|
|
341
349
|
}
|
|
@@ -345,7 +353,10 @@ export async function main(argv) {
|
|
|
345
353
|
}
|
|
346
354
|
const s = await device.ngrokStatus();
|
|
347
355
|
if (!s.running) return console.log('ngrok is not running (harness-device ngrok up <group>)');
|
|
356
|
+
if (!s.tunnels.length) console.log('ngrok is running but no tunnel is up yet (harness-device logs ngrok)');
|
|
348
357
|
for (const t of s.tunnels) console.log(`${t.name}\t${t.url}\t${t.addr}`);
|
|
358
|
+
const shared = ngrok.sharedUrls(s.tunnels);
|
|
359
|
+
if (shared.length) log.warn(`${shared.join(', ')} share one URL; requests go to either at random`);
|
|
349
360
|
return;
|
|
350
361
|
}
|
|
351
362
|
|
package/src/config.js
CHANGED
|
@@ -170,6 +170,9 @@ export function validateConfig(cfg, env = process.env) {
|
|
|
170
170
|
if (!['conversation', 'server'].includes(cfg.SERVE_MODE)) errs.push('SERVE_MODE must be conversation or server.');
|
|
171
171
|
if (!/^\d+$/.test(String(cfg.TRANSCRIPT_DAYS)) || Number(cfg.TRANSCRIPT_DAYS) < 30) errs.push('TRANSCRIPT_DAYS must be a number of days, at least 30.');
|
|
172
172
|
if (cfg.DOKPLOY_URL && !/^https?:\/\/[^\s'"]+$/.test(cfg.DOKPLOY_URL)) errs.push('DOKPLOY_URL must be an http(s) URL.');
|
|
173
|
+
for (const k of ['DOKPLOY_TOOL_PRESET', 'DOKPLOY_ENABLED_TAGS', 'DOKPLOY_DISABLED_TAGS']) {
|
|
174
|
+
if (cfg[k] && !/^[A-Za-z0-9_,-]+$/.test(cfg[k])) errs.push(`${k} must be a comma-separated list of names (e.g. project,application,postgres).`);
|
|
175
|
+
}
|
|
173
176
|
for (const k of ['DISPLAY_NUM', 'CDP_PORT', 'VNC_PORT', 'NOVNC_PORT', 'TTYD_PORT', 'PW_UI_PORT']) {
|
|
174
177
|
if (!/^\d+$/.test(String(cfg[k]))) errs.push(`${k} must be a number (got "${cfg[k]}").`);
|
|
175
178
|
}
|
package/src/install.js
CHANGED
|
@@ -67,7 +67,7 @@ export async function install(ctx, opts = {}) {
|
|
|
67
67
|
log.step(`Wiring capabilities into ${ctx.provider.label}`);
|
|
68
68
|
const servers = allMcpServers(ctx);
|
|
69
69
|
const res = ctx.provider.apply({ ...ctx, mcpServers: servers, warn: log.warn });
|
|
70
|
-
log.info(color.dim(` MCP: ${servers.map((s) => s.name).join(', ')} · pre-approved rules: ${res.allow.length} · denied: ${res.deny.length}`));
|
|
70
|
+
log.info(color.dim(` MCP: ${(res.registered || servers.map((s) => s.name)).join(', ')}${res.skipped && res.skipped.length ? ` (yours kept: ${res.skipped.join(', ')})` : ''} · pre-approved rules: ${res.allow.length} · denied: ${res.deny.length}`));
|
|
71
71
|
|
|
72
72
|
for (const c of ctx.caps) for (const k of c.secrets || []) if (!ctx.secrets[k]) log.warn(`${c.id}: set ${k} with: harness-device secrets set ${k}`);
|
|
73
73
|
if (ctx.caps.some((c) => c.id === 'dokploy') && !ctx.cfg.DOKPLOY_URL) log.warn('dokploy: set your Dokploy URL with: harness-device init --dokploy-url https://…');
|
package/src/ngrok.js
CHANGED
|
@@ -34,9 +34,11 @@ export function tunnels(cfg, platformId = 'linux') {
|
|
|
34
34
|
export function selectTunnels(cfg, groups, platformId = 'linux') {
|
|
35
35
|
const all = tunnels(cfg, platformId);
|
|
36
36
|
const list = groups.includes('all') ? GROUPS : groups;
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
const
|
|
37
|
+
// A group (viewers, apps, ...) or a single tunnel by name (ttyd, pwui, app3000, ...).
|
|
38
|
+
const single = Object.assign({}, ...GROUPS.map((g) => all[g]));
|
|
39
|
+
const bad = list.filter((g) => !GROUPS.includes(g) && !single[g]);
|
|
40
|
+
if (bad.length) throw new Error(`Unknown ngrok group or tunnel: ${bad.join(', ')} (use ${GROUPS.join(', ')}, all, or one of ${Object.keys(single).join(', ')})`);
|
|
41
|
+
const names = [...new Set(list.flatMap((g) => (GROUPS.includes(g) ? Object.keys(all[g]) : [g])))];
|
|
40
42
|
if (!names.length) throw new Error(list.includes('apps') ? 'No app ports: set NGROK_APP_PORTS=3000,5173 in config.env' : 'Nothing to expose');
|
|
41
43
|
return names;
|
|
42
44
|
}
|
|
@@ -60,3 +62,10 @@ export function renderNgrokYml(cfg, authtoken, platformId = 'linux') {
|
|
|
60
62
|
export function renderNgrokEnv(names) {
|
|
61
63
|
return `HD_NGROK_TUNNELS='${names.join(' ')}'\n`;
|
|
62
64
|
}
|
|
65
|
+
|
|
66
|
+
/** Names of tunnels that ended up on the same public URL (free plans have one domain). */
|
|
67
|
+
export function sharedUrls(tunnels) {
|
|
68
|
+
const by = {};
|
|
69
|
+
for (const t of tunnels) (by[t.url] = by[t.url] || []).push(t.name);
|
|
70
|
+
return Object.values(by).filter((n) => n.length > 1).flat();
|
|
71
|
+
}
|
package/src/platform/darwin.js
CHANGED
|
@@ -182,12 +182,16 @@ export function followLogsCmd(u, ctx) {
|
|
|
182
182
|
export function ngrokUp(ctx) {
|
|
183
183
|
const file = path.join(serviceDir(ctx.env), plistName('harness-ngrok'));
|
|
184
184
|
writeFile(file, plist(jobs(ctx)('harness-ngrok')));
|
|
185
|
-
|
|
185
|
+
const l = labelOf('harness-ngrok');
|
|
186
|
+
if (loaded(l)) {
|
|
187
|
+
lc(['bootout', `${domain()}/${l}`]);
|
|
188
|
+
for (let i = 0; i < 25 && loaded(l); i++) sleepMs(200);
|
|
189
|
+
}
|
|
186
190
|
lc(['bootstrap', domain(), file]);
|
|
187
191
|
}
|
|
188
192
|
|
|
189
193
|
export function ngrokDown(ctx) {
|
|
190
|
-
lc(['bootout', `${domain()}/${labelOf('harness-ngrok')}`]);
|
|
194
|
+
if (loaded(labelOf('harness-ngrok'))) lc(['bootout', `${domain()}/${labelOf('harness-ngrok')}`]);
|
|
191
195
|
fs.rmSync(path.join(serviceDir(ctx.env), plistName('harness-ngrok')), { force: true });
|
|
192
196
|
}
|
|
193
197
|
|
package/src/providers/claude.js
CHANGED
|
@@ -190,7 +190,7 @@ export function apply(ctx) {
|
|
|
190
190
|
const keep = applyRetention(settings, Number(ctx.cfg.TRANSCRIPT_DAYS), prev);
|
|
191
191
|
writeFile(f.settings, JSON.stringify(settings, null, 2) + '\n', { dryRun });
|
|
192
192
|
writeFile(stateFile, JSON.stringify({ ...added, ...keep, mcp: mcpNames }, null, 2) + '\n', { dryRun });
|
|
193
|
-
return { allow, deny, added };
|
|
193
|
+
return { allow, deny, added, registered: mcpNames, skipped: foreign };
|
|
194
194
|
}
|
|
195
195
|
|
|
196
196
|
export function remove(ctx) {
|