labgate 0.5.40 → 0.5.43
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 +132 -265
- package/bin/postinstall.js +40 -0
- package/dist/cli.js +56 -43
- package/dist/cli.js.map +1 -1
- package/dist/lib/cli-update-notice.d.ts +13 -0
- package/dist/lib/cli-update-notice.js +21 -0
- package/dist/lib/cli-update-notice.js.map +1 -0
- package/dist/lib/config.d.ts +18 -3
- package/dist/lib/config.js +151 -80
- package/dist/lib/config.js.map +1 -1
- package/dist/lib/container.d.ts +11 -9
- package/dist/lib/container.js +753 -302
- package/dist/lib/container.js.map +1 -1
- package/dist/lib/dataset-mcp.js +2 -9
- package/dist/lib/dataset-mcp.js.map +1 -1
- package/dist/lib/display-mcp.d.ts +2 -2
- package/dist/lib/display-mcp.js +17 -38
- package/dist/lib/display-mcp.js.map +1 -1
- package/dist/lib/doctor.js +8 -0
- package/dist/lib/doctor.js.map +1 -1
- package/dist/lib/explorer-claude.js +36 -1
- package/dist/lib/explorer-claude.js.map +1 -1
- package/dist/lib/explorer-eval.js +3 -2
- package/dist/lib/explorer-eval.js.map +1 -1
- package/dist/lib/init.js +14 -18
- package/dist/lib/init.js.map +1 -1
- package/dist/lib/slurm-cli-passthrough.d.ts +12 -2
- package/dist/lib/slurm-cli-passthrough.js +401 -143
- package/dist/lib/slurm-cli-passthrough.js.map +1 -1
- package/dist/lib/startup-stage-lock.d.ts +21 -0
- package/dist/lib/startup-stage-lock.js +195 -0
- package/dist/lib/startup-stage-lock.js.map +1 -0
- package/dist/lib/ui.d.ts +40 -0
- package/dist/lib/ui.html +4953 -3366
- package/dist/lib/ui.js +1815 -432
- package/dist/lib/ui.js.map +1 -1
- package/dist/lib/update-check.d.ts +33 -0
- package/dist/lib/update-check.js +203 -0
- package/dist/lib/update-check.js.map +1 -0
- package/dist/lib/web-terminal-startup-readiness.d.ts +8 -0
- package/dist/lib/web-terminal-startup-readiness.js +29 -0
- package/dist/lib/web-terminal-startup-readiness.js.map +1 -0
- package/dist/lib/web-terminal.d.ts +51 -0
- package/dist/lib/web-terminal.js +171 -1
- package/dist/lib/web-terminal.js.map +1 -1
- package/dist/mcp-bundles/dataset-mcp.bundle.mjs +125 -74
- package/dist/mcp-bundles/display-mcp.bundle.mjs +22 -30
- package/dist/mcp-bundles/explorer-mcp.bundle.mjs +211 -106
- package/dist/mcp-bundles/results-mcp.bundle.mjs +22 -24
- package/dist/mcp-bundles/slurm-mcp.bundle.mjs +6 -8
- package/package.json +4 -3
package/README.md
CHANGED
|
@@ -1,351 +1,218 @@
|
|
|
1
1
|
# LabGate
|
|
2
2
|
|
|
3
|
-
Policy-controlled sandboxes for AI coding agents
|
|
3
|
+
Policy-controlled sandboxes for AI coding agents on HPC.
|
|
4
4
|
|
|
5
|
-
## Current
|
|
5
|
+
## Current Focus
|
|
6
6
|
|
|
7
|
-
- Primary workflow:
|
|
8
|
-
- Primary runtime: Apptainer
|
|
9
|
-
-
|
|
10
|
-
- Secondary
|
|
7
|
+
- Primary workflow: `labgate claude`
|
|
8
|
+
- Primary runtime: Apptainer
|
|
9
|
+
- HPC default: SLURM tracking enabled by default
|
|
10
|
+
- Secondary path: `labgate codex` (best-effort)
|
|
11
|
+
|
|
12
|
+
Docs: [labgate.dev/docs](https://labgate.dev/docs)
|
|
11
13
|
|
|
12
14
|
## Install
|
|
13
15
|
|
|
14
16
|
```bash
|
|
15
17
|
npm i -g labgate
|
|
18
|
+
labgate init
|
|
16
19
|
```
|
|
17
20
|
|
|
18
|
-
|
|
21
|
+
Notes:
|
|
19
22
|
|
|
20
|
-
|
|
23
|
+
- `labgate ui` requires host `tmux`.
|
|
24
|
+
- `node-pty` is optional. If it fails to build on a minimal Linux host, LabGate still works and falls back to non-sticky output.
|
|
25
|
+
- Default config path is `~/.labgate/config.json`.
|
|
26
|
+
- `labgate init` pre-registers a bundled sample dataset at `~/.labgate/datasets/flowers-iris`.
|
|
21
27
|
|
|
22
|
-
|
|
28
|
+
## Quick Start
|
|
23
29
|
|
|
24
|
-
|
|
30
|
+
Recommended two-node HPC flow:
|
|
25
31
|
|
|
26
|
-
|
|
32
|
+
1. On the login node, start the dashboard:
|
|
27
33
|
|
|
28
34
|
```bash
|
|
29
|
-
labgate
|
|
30
|
-
labgate claude # launch Claude Code in current dir
|
|
31
|
-
labgate codex /projects/my-analysis # launch Codex in a specific dir
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
## What it does
|
|
35
|
-
|
|
36
|
-
LabGate runs your AI coding agent inside a sandboxed container with:
|
|
37
|
-
|
|
38
|
-
- **Scoped filesystem** — only your working directory and configured paths are visible
|
|
39
|
-
- **Credential blocking** — `.ssh`, `.aws`, `.env`, `.gnupg`, and other sensitive paths are hidden by default
|
|
40
|
-
- **Network policy** — configurable network modes (`host`, `filtered`, `none`)
|
|
41
|
-
- **Command blocking** — high-risk system commands (for example `mount`, `umount`, `mkfs`, `reboot`) are blocked by default
|
|
42
|
-
- **Audit logging** — session start/stop and mount configuration logged to `~/.labgate/logs/`
|
|
43
|
-
- **Dashboard instructions editor** — view and update per-session `AGENTS.md` / `CLAUDE.md` from the UI
|
|
44
|
-
- **Session context injection** — LabGate prepends a temporary sandbox-mapping instruction block during active sessions
|
|
45
|
-
- **HPC ready** — first-class Apptainer support for shared clusters
|
|
46
|
-
|
|
47
|
-
## Configuration
|
|
48
|
-
|
|
49
|
-
Edit `~/.labgate/config.json` to customize:
|
|
50
|
-
|
|
51
|
-
```bash
|
|
52
|
-
$EDITOR ~/.labgate/config.json
|
|
35
|
+
labgate ui
|
|
53
36
|
```
|
|
54
37
|
|
|
55
|
-
|
|
38
|
+
2. On a compute node, launch Claude inside the sandbox:
|
|
56
39
|
|
|
57
40
|
```bash
|
|
58
|
-
|
|
41
|
+
srun --pty bash
|
|
42
|
+
cd /path/to/project
|
|
43
|
+
labgate claude
|
|
59
44
|
```
|
|
60
45
|
|
|
61
|
-
|
|
46
|
+
If browser auth is not practical over SSH, pass an API key directly:
|
|
62
47
|
|
|
63
48
|
```bash
|
|
64
|
-
labgate
|
|
49
|
+
labgate claude --api-key "$ANTHROPIC_API_KEY"
|
|
65
50
|
```
|
|
66
51
|
|
|
67
|
-
|
|
52
|
+
For local non-SSH, non-SLURM shells, `labgate claude` auto-starts `labgate ui` when the UI is not already running.
|
|
68
53
|
|
|
69
|
-
|
|
70
|
-
|---------|---------|-------------|
|
|
71
|
-
| `runtime` | `auto` | `auto`, `apptainer`, or `podman` |
|
|
72
|
-
| `image` | `docker.io/library/node:20-bookworm` | Container image |
|
|
73
|
-
| `session_timeout_hours` | `8` | Max session length |
|
|
74
|
-
| `filesystem.blocked_patterns` | `.ssh, .aws, .env, ...` | Hidden from sandbox |
|
|
75
|
-
| `filesystem.extra_paths` | `[]` | Additional mounts |
|
|
76
|
-
| `network.mode` | `host` | `none`, `filtered`, or `host` |
|
|
77
|
-
| `commands.blacklist` | `mount, umount, mkfs, reboot, shutdown` | Blocked commands |
|
|
78
|
-
| `slurm.enabled` | `true` | Enable SLURM CLI passthrough (`sbatch`, `squeue`, etc.) and job tracking |
|
|
79
|
-
| `headless.claude_run_with_allowed_permissions` | `true` | In Claude headless mode, auto-allow tool use via `--dangerously-skip-permissions` |
|
|
80
|
-
| `headless.continuation_in_other_terminals` | `true` | Show or hide the `Continue in terminal via labgate continue ...` footer hint |
|
|
81
|
-
| `headless.git_integration` | `false` | Show or hide Git integration UI (Git DAG sidebar widget and footer branch controls) |
|
|
54
|
+
## What LabGate Does
|
|
82
55
|
|
|
83
|
-
|
|
56
|
+
- Runs Claude or Codex inside a containerized sandbox
|
|
57
|
+
- Mounts the working directory, a persistent sandbox home, configured extra paths, and named datasets
|
|
58
|
+
- Hides common credential and secret paths by default
|
|
59
|
+
- Applies network policy with `host` or `filtered` modes
|
|
60
|
+
- Blocks high-risk commands such as `mount`, `umount`, `mkfs`, `reboot`, and `shutdown`
|
|
61
|
+
- Records audit logs in `~/.labgate/logs/`
|
|
62
|
+
- Tracks SLURM jobs and exposes MCP integrations for supported LabGate subsystems
|
|
63
|
+
- Provides a browser UI and web-terminal control plane with `labgate ui`
|
|
64
|
+
- Ships a bundled `flowers-iris` sample dataset for first-run dataset workflows
|
|
65
|
+
- Lets you edit `AGENTS.md` / `CLAUDE.md` from the UI, with a temporary LabGate sandbox-context block injected for active sessions
|
|
84
66
|
|
|
85
|
-
|
|
86
|
-
labgate claude [workdir] # launch Claude Code
|
|
87
|
-
labgate codex [workdir] # launch Codex
|
|
88
|
-
labgate feedback # submit feedback (interactive or piped)
|
|
89
|
-
labgate status # list running sessions
|
|
90
|
-
labgate stop <id> # stop a session
|
|
91
|
-
labgate ui # start dashboard server on localhost:7700 (auth token required, tmux required)
|
|
92
|
-
labgate register <activation-key> [--server <url>] # activate + install enterprise license
|
|
93
|
-
labgate license # show enterprise license status
|
|
94
|
-
labgate license install <key-or-file> [--system|--user|--path] # install enterprise license key
|
|
95
|
-
labgate policy init [--institution ... --admin ...] # create policy template
|
|
96
|
-
labgate policy validate [file] # validate policy JSON
|
|
97
|
-
labgate logs [-n 20] # view recent audit events
|
|
98
|
-
labgate logs --follow # stream new audit events
|
|
99
|
-
labgate init [--force] # create/reset config
|
|
100
|
-
labgate explore create --name <name> --repo <path> --eval "<command>" # create Solution Explorer experiment
|
|
101
|
-
labgate explore tick --experiment <id> # run one autopilot tick (cron-friendly)
|
|
102
|
-
labgate explore overview --experiment <id> # aggregated status/counts/best/latest
|
|
103
|
-
labgate explore run --id <run-id> # run metadata + artifact paths
|
|
104
|
-
labgate explore gc --experiment <id> # retention-based prune (dry-run by default)
|
|
105
|
-
labgate explore compare --experiment <id> --run <run-id> --to best # score+diff compare
|
|
106
|
-
```
|
|
107
|
-
|
|
108
|
-
### Solution Explorer (MVP backend)
|
|
67
|
+
`network.mode=none` is rejected for `labgate claude` and `labgate codex`.
|
|
109
68
|
|
|
110
|
-
|
|
111
|
-
variant search workflows:
|
|
69
|
+
## Key Defaults
|
|
112
70
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
71
|
+
| Setting | Default |
|
|
72
|
+
| --- | --- |
|
|
73
|
+
| `runtime` | `auto` |
|
|
74
|
+
| `image` | `docker.io/library/node:20-bookworm` |
|
|
75
|
+
| `session_timeout_hours` | `8` |
|
|
76
|
+
| `network.mode` | `host` |
|
|
77
|
+
| `commands.ensure_commands` | `["git"]` |
|
|
78
|
+
| `slurm.enabled` | `true` |
|
|
79
|
+
| `slurm.mcp_server` | `true` |
|
|
80
|
+
| `audit.enabled` | `true` |
|
|
81
|
+
| `headless.continuation_in_other_terminals` | `true` |
|
|
82
|
+
| `headless.git_integration` | `false` |
|
|
118
83
|
|
|
119
|
-
|
|
84
|
+
Inspect or change config with:
|
|
120
85
|
|
|
121
86
|
```bash
|
|
122
|
-
|
|
87
|
+
labgate config path
|
|
88
|
+
labgate config show
|
|
89
|
+
labgate config get <key>
|
|
90
|
+
labgate config set <key> <value>
|
|
91
|
+
labgate config reset <key>
|
|
123
92
|
```
|
|
124
93
|
|
|
125
|
-
|
|
94
|
+
## CLI Overview
|
|
126
95
|
|
|
127
|
-
|
|
128
|
-
# Create experiment from a local repo
|
|
129
|
-
labgate explore create \
|
|
130
|
-
--name "TSP baseline" \
|
|
131
|
-
--repo /path/to/tsp-lab \
|
|
132
|
-
--eval "python3 eval.py" \
|
|
133
|
-
--agent-mode stub \
|
|
134
|
-
--stub-patch stub-patches/enable_two_opt.patch
|
|
135
|
-
|
|
136
|
-
# Trigger one run
|
|
137
|
-
labgate explore tick --experiment <experiment-id>
|
|
138
|
-
|
|
139
|
-
# Inspect tree and leaderboard
|
|
140
|
-
labgate explore tree --experiment <experiment-id> --mode best_path
|
|
141
|
-
labgate explore leaderboard --experiment <experiment-id> --top 5
|
|
142
|
-
```
|
|
143
|
-
|
|
144
|
-
Cron example (every 5 minutes):
|
|
96
|
+
Core session commands:
|
|
145
97
|
|
|
146
98
|
```bash
|
|
147
|
-
|
|
99
|
+
labgate init
|
|
100
|
+
labgate claude [workdir]
|
|
101
|
+
labgate codex [workdir]
|
|
102
|
+
labgate ui [--port <number> --listen-address <address> --token <string> | --socket <path>]
|
|
103
|
+
labgate status
|
|
104
|
+
labgate continue [idOrName] [--latest]
|
|
105
|
+
labgate stop <id>
|
|
106
|
+
labgate restart <id> [--dry-run]
|
|
107
|
+
labgate logs [-n|--lines <count>] [--follow]
|
|
108
|
+
labgate feedback [message...]
|
|
148
109
|
```
|
|
149
110
|
|
|
150
|
-
|
|
111
|
+
SLURM commands:
|
|
151
112
|
|
|
152
113
|
```bash
|
|
153
|
-
labgate
|
|
154
|
-
labgate
|
|
155
|
-
labgate
|
|
156
|
-
labgate
|
|
157
|
-
labgate
|
|
158
|
-
labgate ui --socket ~/.labgate/ui.sock # custom Unix socket path
|
|
159
|
-
labgate logs --lines 50 --follow # tail last 50 lines and keep following
|
|
114
|
+
labgate slurm status [--state <state>] [--limit <count>] [--search <query>]
|
|
115
|
+
labgate slurm job <id>
|
|
116
|
+
labgate slurm output <id> [--stderr] [--tail <lines>]
|
|
117
|
+
labgate slurm cancel <id>
|
|
118
|
+
labgate slurm mcp [--db <path>]
|
|
160
119
|
```
|
|
161
120
|
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
### Shared Apptainer SIF cache (multi-user HPC)
|
|
165
|
-
|
|
166
|
-
Set `LABGATE_IMAGES_DIR` to use a shared SIF cache path instead of `~/.labgate/images`:
|
|
121
|
+
Dataset commands:
|
|
167
122
|
|
|
168
123
|
```bash
|
|
169
|
-
|
|
124
|
+
labgate dataset list
|
|
125
|
+
labgate dataset init <name>
|
|
170
126
|
```
|
|
171
127
|
|
|
172
|
-
|
|
173
|
-
wait for the first pull instead of downloading the same SIF repeatedly.
|
|
174
|
-
|
|
175
|
-
Optional lock tuning env vars:
|
|
176
|
-
|
|
177
|
-
- `LABGATE_IMAGE_PULL_LOCK_TIMEOUT_MS` (default `3600000`)
|
|
178
|
-
- `LABGATE_IMAGE_PULL_LOCK_STALE_MS` (default `7200000`)
|
|
179
|
-
- `LABGATE_IMAGE_PULL_LOCK_POLL_MS` (default `750`)
|
|
128
|
+
`labgate dataset init` scans an already-registered dataset entry and stores file count and size metadata in config.
|
|
180
129
|
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
For Apptainer sessions, LabGate now attempts SLURM CLI passthrough automatically.
|
|
184
|
-
If host `sbatch`/`squeue` are available, they are staged into the sandbox, so
|
|
185
|
-
`labgate claude` should work without extra config in the common HPC path.
|
|
186
|
-
|
|
187
|
-
SLURM tracking and MCP tools are enabled by default (`slurm.enabled=true`).
|
|
188
|
-
If native SQLite (`better-sqlite3`) is unavailable on a host, LabGate falls back
|
|
189
|
-
to a JSON tracking store automatically.
|
|
190
|
-
|
|
191
|
-
Requirements for automatic `sbatch` in sandbox:
|
|
192
|
-
|
|
193
|
-
1. Runtime is Apptainer
|
|
194
|
-
2. The host can resolve SLURM CLI tools when launching LabGate
|
|
195
|
-
|
|
196
|
-
If `sbatch` is missing inside the sandbox, run:
|
|
130
|
+
Solution Explorer commands:
|
|
197
131
|
|
|
198
132
|
```bash
|
|
199
|
-
|
|
200
|
-
labgate
|
|
133
|
+
labgate explore create --name <name> --repo <path> --eval <command> [options]
|
|
134
|
+
labgate explore list [--limit <count>] [--offset <count>]
|
|
135
|
+
labgate explore status <experimentId> [-n|--limit <count>]
|
|
136
|
+
labgate explore pause <experimentId>
|
|
137
|
+
labgate explore resume <experimentId>
|
|
138
|
+
labgate explore tick --experiment <id>
|
|
139
|
+
labgate explore tree --experiment <id> [--mode best_path|full]
|
|
140
|
+
labgate explore leaderboard --experiment <id> [-k|--top <count>]
|
|
141
|
+
labgate explore gc --experiment <id> [--yes]
|
|
142
|
+
labgate explore retention show --experiment <id>
|
|
143
|
+
labgate explore retention set --experiment <id> [retention flags]
|
|
144
|
+
labgate explore compare --experiment <id> --run <runId> [--to best|parent|<runId>] [--diff]
|
|
145
|
+
labgate explore overview --experiment <id>
|
|
146
|
+
labgate explore run --id <runId>
|
|
147
|
+
labgate explore mcp [--db <path>]
|
|
201
148
|
```
|
|
202
149
|
|
|
203
|
-
|
|
150
|
+
For Claude/Codex sessions, LabGate can also register dataset, cluster, and SLURM MCP servers inside the sandbox when the relevant integrations are enabled.
|
|
204
151
|
|
|
205
|
-
|
|
206
|
-
module load slurm # or your site-specific module name
|
|
207
|
-
labgate claude
|
|
208
|
-
```
|
|
209
|
-
|
|
210
|
-
Optional (disable SLURM tracking DB + MCP server):
|
|
211
|
-
|
|
212
|
-
```bash
|
|
213
|
-
labgate config set slurm.enabled false
|
|
214
|
-
```
|
|
215
|
-
|
|
216
|
-
## Feedback
|
|
217
|
-
|
|
218
|
-
Submit feedback from the CLI:
|
|
152
|
+
Enterprise commands:
|
|
219
153
|
|
|
220
154
|
```bash
|
|
221
|
-
labgate
|
|
222
|
-
|
|
223
|
-
labgate
|
|
155
|
+
labgate license
|
|
156
|
+
labgate license install <keyOrFile> [--system|--user|--path] [--overwrite]
|
|
157
|
+
labgate register <activationKey> [--server <url>] [--token <token>] [--timeout <ms>] [--system|--user|--path] [--overwrite]
|
|
158
|
+
labgate policy validate [file]
|
|
159
|
+
labgate policy init [--path <path>] [--institution <name>] [--admin <username>] [--runtime <runtime>] [--force]
|
|
224
160
|
```
|
|
225
161
|
|
|
226
|
-
|
|
227
|
-
If `LABGATE_FEEDBACK_TOKEN` is set, it will be sent as a Bearer token.
|
|
228
|
-
If no URL is configured, LabGate defaults to `https://labgate.dev/api/feedback`.
|
|
229
|
-
If the request fails (or `LABGATE_FEEDBACK_DISABLE=1`), feedback is saved locally at `~/.labgate/feedback.jsonl`.
|
|
162
|
+
For full options, use `labgate <command> --help` or the docs site.
|
|
230
163
|
|
|
231
|
-
##
|
|
164
|
+
## Apptainer and SLURM Notes
|
|
232
165
|
|
|
233
|
-
|
|
166
|
+
- The primary supported path is login-node `labgate ui` plus compute-node `labgate claude`.
|
|
167
|
+
- LabGate prefers Apptainer on HPC. If you manage runtime explicitly, prefer `apptainer`.
|
|
168
|
+
- SLURM tracking is enabled by default.
|
|
169
|
+
- For Apptainer sessions, LabGate expects host SLURM CLIs such as `sbatch` and `squeue` to be available when the session starts.
|
|
170
|
+
- If your site uses environment modules, load SLURM before launching LabGate:
|
|
234
171
|
|
|
235
172
|
```bash
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
npm run verify # build + unit + integration tests
|
|
239
|
-
npm run dev:claude # start UI in background, then launch local labgate claude
|
|
240
|
-
npm run test:unit # fast unit tests
|
|
241
|
-
npm run test:integration # dashboard integration tests
|
|
242
|
-
npm run test:e2e:real # opt-in real runtime OAuth/browser smoke test
|
|
243
|
-
npm test # unit + integration
|
|
244
|
-
npm run release:check # verify + npm pack --dry-run
|
|
173
|
+
module load slurm
|
|
174
|
+
labgate claude
|
|
245
175
|
```
|
|
246
176
|
|
|
247
|
-
|
|
177
|
+
- In SLURM job scripts, use relative paths or real host paths for `#SBATCH --output` and `#SBATCH --error`, not container-only paths such as `/work/...`.
|
|
178
|
+
|
|
179
|
+
Shared SIF cache:
|
|
248
180
|
|
|
249
181
|
```bash
|
|
250
|
-
|
|
251
|
-
export LABGATE_LICENSE_SECRET='replace-with-your-signing-secret'
|
|
252
|
-
LICENSE_KEY="$(npx tsx scripts/generate-license.ts \
|
|
253
|
-
--institution 'Example University' \
|
|
254
|
-
--tier pro \
|
|
255
|
-
--expires 2099-12-31 2>/dev/null)"
|
|
256
|
-
|
|
257
|
-
# 2) Install key on target host (admin side)
|
|
258
|
-
labgate license install "$LICENSE_KEY" --path /tmp/labgate/license.key --overwrite
|
|
259
|
-
# HPC system-wide install (root):
|
|
260
|
-
# sudo labgate license install "$LICENSE_KEY" --system --overwrite
|
|
261
|
-
|
|
262
|
-
# Optional online activation (instead of direct install):
|
|
263
|
-
# Uses default endpoint: https://labgate.dev/api/license/activate
|
|
264
|
-
# labgate register '<activation-key-from-vendor>' --path /tmp/labgate/license.key --overwrite
|
|
265
|
-
# Optional custom endpoint:
|
|
266
|
-
# export LABGATE_ACTIVATION_URL='https://your-control-plane.example.com/api/license/activate'
|
|
267
|
-
|
|
268
|
-
# 3) Bootstrap and validate policy
|
|
269
|
-
labgate policy init --path /tmp/labgate/policy.json --admin "$(whoami)" --force
|
|
270
|
-
labgate policy validate /tmp/labgate/policy.json
|
|
271
|
-
|
|
272
|
-
# 4) Verify forced settings are locked for users
|
|
273
|
-
LABGATE_LICENSE_PATH=/tmp/labgate/license.key \
|
|
274
|
-
LABGATE_POLICY_PATH=/tmp/labgate/policy.json \
|
|
275
|
-
labgate config set runtime auto
|
|
276
|
-
# expected: error about admin-locked field
|
|
277
|
-
|
|
278
|
-
# 5) Open dashboard and verify UI lock labels ("set by admin")
|
|
279
|
-
LABGATE_LICENSE_PATH=/tmp/labgate/license.key \
|
|
280
|
-
LABGATE_POLICY_PATH=/tmp/labgate/policy.json \
|
|
281
|
-
labgate ui
|
|
182
|
+
labgate config set images_dir /shared/labgate/images
|
|
282
183
|
```
|
|
283
184
|
|
|
284
|
-
|
|
185
|
+
Or with an environment override:
|
|
285
186
|
|
|
286
187
|
```bash
|
|
287
|
-
|
|
188
|
+
export LABGATE_IMAGES_DIR=/shared/labgate/images
|
|
288
189
|
```
|
|
289
190
|
|
|
290
|
-
|
|
291
|
-
`npm run test:integration` automatically rebuilds `better-sqlite3` first to avoid Node ABI mismatch errors after Node upgrades.
|
|
191
|
+
`LABGATE_IMAGES_DIR` takes precedence over `images_dir`.
|
|
292
192
|
|
|
293
|
-
|
|
193
|
+
## Feedback
|
|
294
194
|
|
|
295
195
|
```bash
|
|
296
|
-
|
|
297
|
-
|
|
196
|
+
labgate feedback
|
|
197
|
+
labgate feedback "Short feedback message"
|
|
198
|
+
echo "This was great" | labgate feedback
|
|
298
199
|
```
|
|
299
200
|
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
- **`npm run test:unit`** covers config/runtime/container helpers
|
|
303
|
-
- **`npm run test:integration`** covers dashboard flow that:
|
|
304
|
-
1. Builds the CLI
|
|
305
|
-
2. Starts `labgate ui` on a temporary localhost port
|
|
306
|
-
3. Launches `labgate claude` and `labgate codex` with a mocked runtime
|
|
307
|
-
4. Verifies sessions appear in `/api/sessions` (dashboard data source)
|
|
308
|
-
5. Stops a session through `POST /api/sessions/stop` and verifies it disappears
|
|
309
|
-
6. Verifies UI port fallback when requested ports are occupied
|
|
310
|
-
7. Verifies `/api/config` accepts valid payloads and rejects invalid payloads without mutating config
|
|
311
|
-
8. Verifies `labgate logs --follow` prints tail output and streams newly appended events
|
|
312
|
-
9. Verifies dashboard activity inference for accessed files and websites from agent transcripts
|
|
313
|
-
10. Verifies `GET/PUT /api/sessions/:id/instructions` with conflict detection for `AGENTS.md` and `CLAUDE.md`
|
|
314
|
-
- **`npm run test:e2e:real`** runs a real runtime smoke test for OAuth/browser opening:
|
|
315
|
-
1. Launches real `labgate claude` (no mocked container runtime)
|
|
316
|
-
2. Waits for OAuth URL flow
|
|
317
|
-
3. Verifies host browser-open hook is triggered
|
|
318
|
-
4. Optional override: `LABGATE_REAL_E2E_IMAGE`
|
|
201
|
+
Feedback posts to `LABGATE_FEEDBACK_URL` when set, or to `https://labgate.dev/api/feedback` by default. If remote submission fails, LabGate saves feedback locally to `~/.labgate/feedback.jsonl`.
|
|
319
202
|
|
|
320
|
-
##
|
|
321
|
-
|
|
322
|
-
LabGate builds a sandboxed container from your config:
|
|
323
|
-
|
|
324
|
-
1. Detects Apptainer first, then Podman (or uses explicit runtime)
|
|
325
|
-
2. Mounts your working directory at `/work`
|
|
326
|
-
3. Mounts persistent sandbox HOME at `/home/sandbox` (for npm cache, agent config)
|
|
327
|
-
4. Overlays blocked paths (`.ssh`, `.aws`, etc.) with empty mounts
|
|
328
|
-
5. Applies network isolation and capability restrictions
|
|
329
|
-
6. Installs the agent (if not cached) and runs it interactively
|
|
330
|
-
|
|
331
|
-
On macOS, LabGate syncs your Claude credentials from the system keychain so the agent can authenticate automatically.
|
|
332
|
-
|
|
333
|
-
## Audit logs
|
|
334
|
-
|
|
335
|
-
Session events are logged to `~/.labgate/logs/YYYY-MM-DD.jsonl`:
|
|
203
|
+
## Development
|
|
336
204
|
|
|
337
205
|
```bash
|
|
338
|
-
|
|
206
|
+
npm run setup
|
|
207
|
+
npm run verify:quick
|
|
208
|
+
npm run verify
|
|
209
|
+
npm run test:unit
|
|
210
|
+
npm run test:integration
|
|
211
|
+
npm run test:e2e:real
|
|
212
|
+
npm run dev:claude
|
|
213
|
+
npm run release:check
|
|
339
214
|
```
|
|
340
215
|
|
|
341
|
-
## Roadmap
|
|
342
|
-
|
|
343
|
-
- **M0** CLI + sandbox engine + config + audit (this release)
|
|
344
|
-
- **M1** Mount allowlists, network filtering, project-level config
|
|
345
|
-
- **M2** SLURM proxy (submit/status/cancel from inside sandbox)
|
|
346
|
-
- **M3** Web UI for config + audit viewer
|
|
347
|
-
- **M4** Institutional mode (/etc/labgate/ policies, admin locks)
|
|
348
|
-
|
|
349
216
|
## License
|
|
350
217
|
|
|
351
|
-
|
|
218
|
+
License terms: [labgate.dev](https://labgate.dev)
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
function shouldShowGlobalInstallHint(env = process.env) {
|
|
4
|
+
if (env.LABGATE_SKIP_POSTINSTALL_HINT === '1') {
|
|
5
|
+
return false;
|
|
6
|
+
}
|
|
7
|
+
return env.npm_config_global === 'true' || env.npm_config_location === 'global';
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
function buildPostInstallMessage() {
|
|
11
|
+
return [
|
|
12
|
+
'LabGate is ready.',
|
|
13
|
+
'',
|
|
14
|
+
'Next steps:',
|
|
15
|
+
' cd /path/to/project',
|
|
16
|
+
' labgate claude # recommended: start Claude in a sandbox',
|
|
17
|
+
' labgate codex # start Codex in a sandbox',
|
|
18
|
+
' labgate ui # open the local dashboard',
|
|
19
|
+
'',
|
|
20
|
+
'LabGate creates ~/.labgate/config.json automatically on first run.',
|
|
21
|
+
'Docs: https://labgate.dev/quickstart',
|
|
22
|
+
].join('\n');
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function main({ env = process.env, stdout = process.stdout } = {}) {
|
|
26
|
+
if (!shouldShowGlobalInstallHint(env)) {
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
stdout.write(`\n${buildPostInstallMessage()}\n`);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
if (require.main === module) {
|
|
33
|
+
main();
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
module.exports = {
|
|
37
|
+
buildPostInstallMessage,
|
|
38
|
+
main,
|
|
39
|
+
shouldShowGlobalInstallHint,
|
|
40
|
+
};
|