mercury-agent 0.5.1 → 0.5.6
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 +6 -5
- package/package.json +1 -1
- package/resources/profiles/coding/mercury-profile.yaml +1 -1
- package/resources/profiles/general/mercury-profile.yaml +1 -1
- package/resources/profiles/research/mercury-profile.yaml +1 -1
- package/resources/templates/mercury.example.yaml +2 -2
- package/src/agent/container-entry.ts +1 -1
- package/src/agent/container-runner.ts +1 -2
- package/src/cli/mercury.ts +1 -1
- package/src/config.ts +1 -1
- package/src/main.ts +1 -1
- package/docs/ARCHITECTURE.md +0 -34
- package/docs/DESIGN.md +0 -42
- package/docs/ROADMAP.md +0 -43
- package/docs/TODOS.md +0 -147
- package/docs/VISION.md +0 -32
- package/docs/archive/.gitkeep +0 -0
- package/docs/archive/applicative-profiles/2026-07-01-applicative-profiles.md +0 -270
- package/docs/archive/applicative-profiles/2026-07-01-caller-bound-capability-token.md +0 -184
- package/docs/archive/applicative-profiles/2026-07-01-dm-auto-space.md +0 -273
- package/docs/archive/summarization/2026-07-02-recent-dev-summary.md +0 -71
- package/docs/backlog/.gitkeep +0 -0
- package/docs/bugs/.gitkeep +0 -0
- package/docs/debug/major/.gitkeep +0 -0
- package/docs/debug/major/2026-07-01-strict-yaml-schema-crash.md +0 -85
- package/docs/debug/major/2026-07-02-bwrap-privileged-linux-docker.md +0 -160
- package/docs/debug/major/2026-07-02-e2big-prompt-delivery-fix.md +0 -382
- package/docs/debug/major/2026-07-02-registry-pull-no-local-fallback.md +0 -194
- package/docs/debug/minor/.gitkeep +0 -0
- package/docs/debug/moderate/.gitkeep +0 -0
- package/docs/debug/summarization/2026-07-02-common-bug-patterns.md +0 -72
- package/docs/html-slides/.gitkeep +0 -0
- package/docs/ideas/.gitkeep +0 -0
- package/docs/ideas/business-extensions.md +0 -48
- package/docs/in-progress/.gitkeep +0 -0
- package/docs/notes/.gitkeep +0 -0
- package/docs/pending-updates/.gitkeep +0 -0
- package/docs/runbooks/gws-oauth-setup.md +0 -211
- package/docs/runbooks/publish-checklist.md +0 -46
- package/docs/templates/TEMPLATE-AUTOPILOT-CONFIG.yaml +0 -35
- package/docs/templates/TEMPLATE-BUG.md +0 -71
- package/docs/templates/TEMPLATE-CI.yml +0 -25
- package/docs/templates/TEMPLATE-DECISIONS.md +0 -11
- package/docs/templates/TEMPLATE-FEATURE.md +0 -127
- package/docs/templates/TEMPLATE-GOAL.md +0 -31
- package/docs/templates/TEMPLATE-IDEA.md +0 -31
- package/docs/templates/TEMPLATE-NOTE.md +0 -27
- package/docs/templates/TEMPLATE-ROADMAP.md +0 -21
package/README.md
CHANGED
|
@@ -18,7 +18,7 @@ Mercury is a personal AI assistant that lives where you chat. It connects to Wha
|
|
|
18
18
|
## Prerequisites
|
|
19
19
|
|
|
20
20
|
- **[Node.js](https://nodejs.org/)** >= 18 — Required for `npm install -g mercury-agent`
|
|
21
|
-
- **[Bun](https://bun.sh)** >= 1.
|
|
21
|
+
- **[Bun](https://bun.sh)** >= 1.2 — JavaScript runtime used by Mercury
|
|
22
22
|
- **[Docker](https://docs.docker.com/get-docker/)** — Required for running agent containers. On Linux, also install `docker-buildx` (`apt-get install docker-buildx`) — Docker Desktop includes it, but Docker Engine on Linux does not.
|
|
23
23
|
- **Windows users:** Mercury runs best under [WSL2](https://learn.microsoft.com/en-us/windows/wsl/install). Install WSL2 with `wsl --install`, then install Bun and Docker inside it.
|
|
24
24
|
|
|
@@ -66,6 +66,8 @@ mercury run
|
|
|
66
66
|
mercury service install
|
|
67
67
|
```
|
|
68
68
|
|
|
69
|
+
> `mercury run` runs in the foreground (good for a first smoke test). For anything long-running, prefer `mercury service install` — it runs in the background and auto-restarts.
|
|
70
|
+
|
|
69
71
|
### Set up spaces and conversations
|
|
70
72
|
|
|
71
73
|
Mercury discovers conversations from incoming traffic. They start **unlinked** — you assign them to **spaces** (memory boundaries).
|
|
@@ -310,7 +312,7 @@ Optional project file **`mercury.yaml`** (or **`mercury.yml`**) supplies non-sec
|
|
|
310
312
|
| Variable | Default | Description |
|
|
311
313
|
|----------|---------|-------------|
|
|
312
314
|
| `MERCURY_DATA_DIR` | `.mercury` | Data directory |
|
|
313
|
-
| `MERCURY_MAX_CONCURRENCY` | `
|
|
315
|
+
| `MERCURY_MAX_CONCURRENCY` | `2` | Max concurrent runs |
|
|
314
316
|
| `MERCURY_PORT` | `8787` | API port |
|
|
315
317
|
| `MERCURY_BOT_USERNAME` | `mercury` | Bot display name |
|
|
316
318
|
| `MERCURY_LOG_LEVEL` | `info` | Log level |
|
|
@@ -335,7 +337,7 @@ Supported OAuth providers: Anthropic, GitHub Copilot, Google Gemini CLI, Antigra
|
|
|
335
337
|
| Variable | Default | Description |
|
|
336
338
|
|----------|---------|-------------|
|
|
337
339
|
| `MERCURY_MODEL_PROVIDER` | `anthropic` | Provider |
|
|
338
|
-
| `MERCURY_MODEL` | `claude-opus-4-
|
|
340
|
+
| `MERCURY_MODEL` | `claude-opus-4-8` | Model |
|
|
339
341
|
| `MERCURY_ANTHROPIC_API_KEY` | — | API key |
|
|
340
342
|
| `MERCURY_ANTHROPIC_OAUTH_TOKEN` | — | OAuth token (alternative) |
|
|
341
343
|
|
|
@@ -357,7 +359,7 @@ Supported OAuth providers: Anthropic, GitHub Copilot, Google Gemini CLI, Antigra
|
|
|
357
359
|
|
|
358
360
|
| Variable | Default | Description |
|
|
359
361
|
|----------|---------|-------------|
|
|
360
|
-
| `
|
|
362
|
+
| `MERCURY_AGENT_IMAGE` | `ghcr.io/avishai-tsabari/mercury-agent:latest` | Container image |
|
|
361
363
|
| `MERCURY_CONTAINER_TIMEOUT_MS` | `300000` | Container timeout (5 min) |
|
|
362
364
|
| `MERCURY_CONTAINER_RUNTIME` | `runc` | `runc` (default) or `runsc` ([gVisor](https://gvisor.dev)) |
|
|
363
365
|
| `MERCURY_CONTAINER_BWRAP_DOCKER_COMPAT` | `false` | Set `true` on Linux Docker Engine (see note below) |
|
|
@@ -413,7 +415,6 @@ mrctl config set trigger_patterns "@Bot,Bot"
|
|
|
413
415
|
|
|
414
416
|
## Docs
|
|
415
417
|
|
|
416
|
-
- **Remaining work:** [TODOS](docs/TODOS.md) — Security, reliability, and ops gaps
|
|
417
418
|
- **Platform setup:** [WhatsApp](docs/setup-whatsapp.md) · [Discord](docs/setup-discord.md) · [Slack](docs/setup-slack.md)
|
|
418
419
|
- [Configuration](docs/configuration.md) (mercury.yaml + env) · [PRD: config load](docs/prd-config-load.md)
|
|
419
420
|
- [Authentication](docs/auth/overview.md)
|
package/package.json
CHANGED
|
@@ -9,10 +9,10 @@
|
|
|
9
9
|
# model:
|
|
10
10
|
# chain:
|
|
11
11
|
# - provider: anthropic
|
|
12
|
-
# model: claude-
|
|
12
|
+
# model: claude-opus-4-8
|
|
13
13
|
# # Legacy single primary + optional fallback (when chain is omitted):
|
|
14
14
|
# # provider: anthropic
|
|
15
|
-
# # model: claude-
|
|
15
|
+
# # model: claude-opus-4-8
|
|
16
16
|
# # fallback_provider: openai
|
|
17
17
|
# # fallback: gpt-4o-mini
|
|
18
18
|
# # max_retries_per_leg: 2
|
|
@@ -29,8 +29,7 @@ import { ContainerError } from "./container-error.js";
|
|
|
29
29
|
* launching the inner container detached (`docker create` + `docker start`, no
|
|
30
30
|
* attach) is the only pattern that works through the Bun `fetch()`-based body-proxy
|
|
31
31
|
* the cloud agent lane goes through — the proxy cannot carry Docker's hijacked
|
|
32
|
-
* attach connection, so an attached run hangs to its idleTimeout
|
|
33
|
-
* docs/debug/major/2026-05-25-agent-lane-docker-run-wait-hang-no-chat-response.md).
|
|
32
|
+
* attach connection, so an attached run hangs to its idleTimeout.
|
|
34
33
|
*/
|
|
35
34
|
const INNER_IO_DIR = "/run/mercury-io";
|
|
36
35
|
|
package/src/cli/mercury.ts
CHANGED
package/src/config.ts
CHANGED
|
@@ -62,7 +62,7 @@ const schema = z.object({
|
|
|
62
62
|
|
|
63
63
|
// ─── AI Model ───────────────────────────────────────────────────────
|
|
64
64
|
modelProvider: z.string().default("anthropic"),
|
|
65
|
-
model: z.string().default("claude-opus-4-
|
|
65
|
+
model: z.string().default("claude-opus-4-8"),
|
|
66
66
|
modelFallbackProvider: z.string().optional(),
|
|
67
67
|
modelFallback: z.string().optional(),
|
|
68
68
|
/** JSON array of `{ provider, model }`. When set, overrides legacy primary+fallback pair. */
|
package/src/main.ts
CHANGED
|
@@ -90,7 +90,7 @@ async function main() {
|
|
|
90
90
|
// ─── Normalize data dir ownership ───────────────────────────────────────
|
|
91
91
|
// Host base image's default user has drifted historically; if the volume
|
|
92
92
|
// was written by a previous uid, SQLite can't reopen state.db for writes.
|
|
93
|
-
// Idempotent on matching ownership.
|
|
93
|
+
// Idempotent on matching ownership.
|
|
94
94
|
if (process.platform === "linux" && process.getuid?.() === 0) {
|
|
95
95
|
const dataDirPath = resolveProjectPath(config.dataDir);
|
|
96
96
|
if (existsSync(dataDirPath)) {
|
package/docs/ARCHITECTURE.md
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
# {Project Name} — Architecture Reference
|
|
2
|
-
|
|
3
|
-
> On-demand reference. Do not auto-load. Read when a task is cross-cutting or you need to understand inter-package data flow.
|
|
4
|
-
|
|
5
|
-
## Packages
|
|
6
|
-
|
|
7
|
-
| Package | Purpose | Stack | Runs On |
|
|
8
|
-
|---------|---------|-------|---------|
|
|
9
|
-
| `{package}/` | {purpose} | {stack} | {where it runs} |
|
|
10
|
-
|
|
11
|
-
## Deployment Topology
|
|
12
|
-
|
|
13
|
-
```
|
|
14
|
-
{ASCII diagram of your deployment — servers, services, databases, CDNs, etc.}
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
## Data Flow
|
|
18
|
-
|
|
19
|
-
> How data moves between packages, services, and external systems. Include request paths, event flows, and storage interactions.
|
|
20
|
-
|
|
21
|
-
## Key Invariants
|
|
22
|
-
|
|
23
|
-
> Rules that must always hold true across the system. Breaking these causes cascading failures.
|
|
24
|
-
|
|
25
|
-
- {Invariant 1}
|
|
26
|
-
- {Invariant 2}
|
|
27
|
-
|
|
28
|
-
## Extension Points
|
|
29
|
-
|
|
30
|
-
> Where the system is designed to be extended — plugin interfaces, hook points, configuration surfaces.
|
|
31
|
-
|
|
32
|
-
- **Applicative profiles** (`src/core/profiles.ts`) — a `mercury-profile.yaml` declares `capabilities`, an exhaustive `member_permissions` set, and a `system_prompt`. `applyProfile` validates capabilities and persists `.mercury/active-profile.json`; `main.ts` activates it at startup (project-wide). Member permission scoping is in `getRolePermissions` (`src/core/permissions.ts`). Authoring contract: `docs/authoring-profiles.md`.
|
|
33
|
-
- **Host-side capability broker** — extensions register `mercury.capability(name, handler)` (`src/extensions/types.ts`, `api.ts`); the agent invokes them from the container via `mrctl capability <name> <action>` → `POST /api/capability/:name/:action` (`src/core/routes/capability.ts`). Handlers run on the host with credentials that never enter the container; identity is the token-derived caller.
|
|
34
|
-
- **Caller-bound capability token** (`src/core/caller-token.ts`) — per-turn HMAC token minted at container spawn, made authoritative over spoofable identity headers in the control-plane API auth middleware (`src/core/api.ts`).
|
package/docs/DESIGN.md
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
# {Project Name} — Design System
|
|
2
|
-
|
|
3
|
-
> Fill this in if your project has a UI. Skip if it's a backend-only project.
|
|
4
|
-
|
|
5
|
-
## 1. Visual Theme
|
|
6
|
-
|
|
7
|
-
> Design principles — what the UI should feel like.
|
|
8
|
-
|
|
9
|
-
## 2. Color Roles
|
|
10
|
-
|
|
11
|
-
> CSS variable inventory. All colors must be defined as variables — never hardcode hex in component files.
|
|
12
|
-
|
|
13
|
-
| Token | Dark Value | Light Value | Role |
|
|
14
|
-
|-------|-----------|-------------|------|
|
|
15
|
-
| `--bg` | {hex} | {hex} | Page background |
|
|
16
|
-
| `--surface` | {hex} | {hex} | Card/panel background |
|
|
17
|
-
| `--text` | {hex} | {hex} | Primary text |
|
|
18
|
-
| `--muted` | {hex} | {hex} | Secondary text |
|
|
19
|
-
| `--accent` | {hex} | {hex} | Interactive elements |
|
|
20
|
-
| `--border` | {hex} | {hex} | Borders and dividers |
|
|
21
|
-
| `--color-success` | {hex} | {hex} | Success states |
|
|
22
|
-
| `--color-error` | {hex} | {hex} | Error states |
|
|
23
|
-
| `--color-warning` | {hex} | {hex} | Warning states |
|
|
24
|
-
|
|
25
|
-
## 3. Typography
|
|
26
|
-
|
|
27
|
-
> Font families, sizes, weights. Which fonts for which contexts.
|
|
28
|
-
|
|
29
|
-
## 4. Layout & Spacing
|
|
30
|
-
|
|
31
|
-
> Grid system, breakpoints, spacing scale. Include RTL/logical property conventions if applicable.
|
|
32
|
-
|
|
33
|
-
## 5. Components
|
|
34
|
-
|
|
35
|
-
> Component conventions — buttons, inputs, cards, modals, status indicators, etc.
|
|
36
|
-
|
|
37
|
-
## 6. Hard Rules
|
|
38
|
-
|
|
39
|
-
> Violations block merge. Examples:
|
|
40
|
-
> - No hardcoded hex colors in component files — use CSS variables
|
|
41
|
-
> - No physical CSS properties (`left`/`right`) — use logical properties
|
|
42
|
-
> - All interactive elements must have visible focus rings
|
package/docs/ROADMAP.md
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
# {Project Name} — Roadmap
|
|
2
|
-
|
|
3
|
-
Single source of truth for priority. Rule: ≤15 min/week to maintain.
|
|
4
|
-
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
## Inbox
|
|
8
|
-
|
|
9
|
-
> Uncategorized ideas. Triage into Now / Next / Later or drop.
|
|
10
|
-
|
|
11
|
-
| Item | Doc | Notes |
|
|
12
|
-
|------|-----|-------|
|
|
13
|
-
| — | — | — |
|
|
14
|
-
|
|
15
|
-
## Now
|
|
16
|
-
|
|
17
|
-
> Max 2 items. What you're actively working on.
|
|
18
|
-
|
|
19
|
-
| Item | Doc | Started | Notes |
|
|
20
|
-
|------|-----|---------|-------|
|
|
21
|
-
| — | — | — | — |
|
|
22
|
-
|
|
23
|
-
## Next
|
|
24
|
-
|
|
25
|
-
| # | Item | Doc | Depends on | Why now |
|
|
26
|
-
|---|------|-----|-----------|---------|
|
|
27
|
-
| 1 | **autonomous-planning-tier** | [doc](backlog/autonomous-planning-tier.md) | — | Let agents decompose ideas, keep human gate |
|
|
28
|
-
|
|
29
|
-
## Later
|
|
30
|
-
|
|
31
|
-
| Item | Doc | Notes |
|
|
32
|
-
|------|-----|-------|
|
|
33
|
-
| — | — | — |
|
|
34
|
-
|
|
35
|
-
---
|
|
36
|
-
|
|
37
|
-
## Shipped
|
|
38
|
-
|
|
39
|
-
| Item | Shipped | What |
|
|
40
|
-
|------|---------|------|
|
|
41
|
-
| **applicative-profiles** | 2026-07-01 | Generic profile layer: manifest schema, exhaustive member scoping, host-side capability broker |
|
|
42
|
-
| **caller-bound-capability-token** | 2026-07-01 | Per-turn unspoofable caller token for host API auth; also hardens TradeStation |
|
|
43
|
-
| **dm-auto-space** | 2026-07-01 | Auto-create space per customer DM with rate limits and dashboard controls |
|
package/docs/TODOS.md
DELETED
|
@@ -1,147 +0,0 @@
|
|
|
1
|
-
# Mercury — Remaining TODOs
|
|
2
|
-
|
|
3
|
-
This document tracks gaps identified in the comprehensive code review that are not yet addressed. Items are ordered by priority (security first, then reliability, then polish).
|
|
4
|
-
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
## Security
|
|
8
|
-
|
|
9
|
-
### TODO-1: Protect dashboard root routes
|
|
10
|
-
|
|
11
|
-
**Status:** Open
|
|
12
|
-
**Priority:** Medium
|
|
13
|
-
**Files:** `src/server.ts`
|
|
14
|
-
|
|
15
|
-
**Issue:** `GET /` and `GET /dashboard` serve the dashboard HTML without authentication. Only `/dashboard/*` (htmx partials, API, SSE) is protected. Users can load the HTML shell without a token.
|
|
16
|
-
|
|
17
|
-
**Fix:** Apply the same auth middleware to `/` and `/dashboard`, or redirect unauthenticated requests to a login page. When `MERCURY_API_SECRET` is set, require Bearer token or `mercury_token` cookie for these routes.
|
|
18
|
-
|
|
19
|
-
---
|
|
20
|
-
|
|
21
|
-
### TODO-2: Harden permission guard
|
|
22
|
-
|
|
23
|
-
**Status:** Open
|
|
24
|
-
**Priority:** Medium
|
|
25
|
-
**Files:** `src/extensions/permission-guard.ts`
|
|
26
|
-
|
|
27
|
-
**Issue:** The permission guard blocks CLI names via regex on bash commands. It can be bypassed by:
|
|
28
|
-
- `env napkin search "query"`
|
|
29
|
-
- `` `which napkin` search "query" ``
|
|
30
|
-
- `python3 -c "import subprocess; subprocess.run(['napkin', ...])"`
|
|
31
|
-
- Path-based execution: `/root/.bun/bin/napkin`
|
|
32
|
-
|
|
33
|
-
**Fix options:**
|
|
34
|
-
1. Run denied CLIs through an allowlist/blocklist at the pi tool-call layer (if the pi API supports it)
|
|
35
|
-
2. Use a wrapper script that validates the command before execution
|
|
36
|
-
3. Document that this is defense-in-depth only; rely on extension trust model
|
|
37
|
-
4. Consider seccomp or additional bwrap restrictions to limit subprocess execution
|
|
38
|
-
|
|
39
|
-
**Note:** Bubblewrap limits filesystem access but does not prevent the agent from invoking allowed binaries. The permission guard remains the primary control for which CLIs run.
|
|
40
|
-
|
|
41
|
-
---
|
|
42
|
-
|
|
43
|
-
### TODO-3: Sanitize extension install commands
|
|
44
|
-
|
|
45
|
-
**Status:** Open
|
|
46
|
-
**Priority:** Low
|
|
47
|
-
**Files:** `src/extensions/image-builder.ts`
|
|
48
|
-
|
|
49
|
-
**Issue:** Extension `install` commands are interpolated directly into Dockerfile `RUN` statements. A malicious extension could inject shell commands that exfiltrate secrets or modify the image.
|
|
50
|
-
|
|
51
|
-
**Fix options:**
|
|
52
|
-
1. Validate install commands against an allowlist (e.g. `bun add -g X`, `npm install -g X`)
|
|
53
|
-
2. Run install commands in a sandboxed build step
|
|
54
|
-
3. Document that extensions are trusted by design (operator installs them); recommend auditing before `mercury add`
|
|
55
|
-
|
|
56
|
-
---
|
|
57
|
-
|
|
58
|
-
## Reliability
|
|
59
|
-
|
|
60
|
-
### TODO-4: Database migration system
|
|
61
|
-
|
|
62
|
-
**Status:** Open
|
|
63
|
-
**Priority:** Medium
|
|
64
|
-
**Files:** `src/storage/db.ts`, new `src/storage/migrations/`
|
|
65
|
-
|
|
66
|
-
**Issue:** Schema evolution uses `CREATE TABLE IF NOT EXISTS` only. Adding columns, changing types, or renaming tables has no migration path.
|
|
67
|
-
|
|
68
|
-
**Fix:** Implement a simple migration system:
|
|
69
|
-
1. Create `migrations/` directory with sequential SQL files (`001_initial.sql`, `002_add_mutes.sql`, …)
|
|
70
|
-
2. Add `schema_migrations` table to track applied migrations
|
|
71
|
-
3. On startup, run any migrations not yet applied
|
|
72
|
-
4. Document migration authoring in `docs/`
|
|
73
|
-
|
|
74
|
-
---
|
|
75
|
-
|
|
76
|
-
### TODO-5: Outbox scan race condition
|
|
77
|
-
|
|
78
|
-
**Status:** Open
|
|
79
|
-
**Priority:** Low
|
|
80
|
-
**Files:** `src/core/outbox.ts`, `src/agent/container-runner.ts`
|
|
81
|
-
|
|
82
|
-
**Issue:** Outbox scanning uses mtime comparison against `startTime`. Files written at exactly `startTime` or during clock skew could be missed or incorrectly included.
|
|
83
|
-
|
|
84
|
-
**Fix:** Use a more robust approach (e.g. track written files explicitly, or use a small time buffer). Document the current behavior and edge cases.
|
|
85
|
-
|
|
86
|
-
---
|
|
87
|
-
|
|
88
|
-
## Operations
|
|
89
|
-
|
|
90
|
-
### TODO-6: Run containers as non-root
|
|
91
|
-
|
|
92
|
-
**Status:** Open
|
|
93
|
-
**Priority:** Low
|
|
94
|
-
**Files:** `container/Dockerfile`, `container/Dockerfile.minimal`, `src/agent/container-runner.ts`
|
|
95
|
-
|
|
96
|
-
**Issue:** Containers run as root. Chromium uses `--no-sandbox` because it runs as root. This increases blast radius if the container is compromised.
|
|
97
|
-
|
|
98
|
-
**Fix:**
|
|
99
|
-
1. Create a non-root user in the Dockerfile
|
|
100
|
-
2. Run the entrypoint as that user (`USER mercury` or similar)
|
|
101
|
-
3. Ensure Chromium can run without `--no-sandbox` (may require `--user-data-dir` and other flags, or use a different approach)
|
|
102
|
-
4. Update `container-runner.ts` if `docker run` needs `--user` override
|
|
103
|
-
|
|
104
|
-
**Note:** Bubblewrap runs as the same user as the parent process. Moving the container to non-root would also make bwrap run as non-root, reducing privilege further.
|
|
105
|
-
|
|
106
|
-
---
|
|
107
|
-
|
|
108
|
-
### TODO-7: CORS configuration
|
|
109
|
-
|
|
110
|
-
**Status:** Open
|
|
111
|
-
**Priority:** Low
|
|
112
|
-
**Files:** `src/server.ts`
|
|
113
|
-
|
|
114
|
-
**Issue:** No CORS headers are set. When Mercury is behind a reverse proxy or accessed from a browser on another origin, cross-origin requests may fail or behave unexpectedly.
|
|
115
|
-
|
|
116
|
-
**Fix:** Add configurable CORS middleware (e.g. `MERCURY_CORS_ORIGINS`). Default to restrictive (same-origin or empty) for security.
|
|
117
|
-
|
|
118
|
-
---
|
|
119
|
-
|
|
120
|
-
## In-Memory State (Deferred)
|
|
121
|
-
|
|
122
|
-
### TODO-8: Crash-safe rate limiter and queue
|
|
123
|
-
|
|
124
|
-
**Status:** Deferred
|
|
125
|
-
**Priority:** Low
|
|
126
|
-
**Files:** `src/core/rate-limiter.ts`, `src/core/space-queue.ts`
|
|
127
|
-
|
|
128
|
-
**Issue:** Rate limiter and queue are in-memory. On crash, rate limit windows reset (allowing burst abuse) and queued work is lost.
|
|
129
|
-
|
|
130
|
-
**Fix:** Persist rate limit state and queue to SQLite or Redis. Adds complexity; may be acceptable for single-node deployments. Revisit if multi-instance or high-availability is required.
|
|
131
|
-
|
|
132
|
-
---
|
|
133
|
-
|
|
134
|
-
## Bubblewrap — What It Mitigates
|
|
135
|
-
|
|
136
|
-
Bubblewrap adds **defense-in-depth** inside the container:
|
|
137
|
-
|
|
138
|
-
| Risk | Mitigated by bubblewrap? |
|
|
139
|
-
|------|--------------------------|
|
|
140
|
-
| **Cross-space data access** | Partially — with per-space mount, `/spaces` only has one space. Bwrap further restricts the pi process to a minimal mount set. |
|
|
141
|
-
| **Arbitrary filesystem access** | Yes — pi only sees `/usr`, `/app`, `/etc`, `/docs`, `/spaces`, `/root`, `/proc`, `/dev`, `/tmp`. Cannot access other paths. |
|
|
142
|
-
| **Process isolation** | Yes — `--unshare-pid`, `--new-session`, `--die-with-parent` limit process visibility and lifecycle. |
|
|
143
|
-
| **Permission guard bypass** | No — bwrap limits *what* the agent can access, not *which commands* it runs. A bypassed guard could still invoke allowed binaries. |
|
|
144
|
-
| **Extension install injection** | No — that happens at image build time, before bwrap runs. |
|
|
145
|
-
| **Container non-root** | No — bwrap runs as the same user (root) as the container. Moving to non-root would improve both. |
|
|
146
|
-
|
|
147
|
-
**Summary:** Bubblewrap reduces blast radius if the agent is compromised. It does not replace the permission guard, API auth, or other controls. It is a valuable additional layer.
|
package/docs/VISION.md
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
# {Project Name} — Product Vision
|
|
2
|
-
|
|
3
|
-
## What {Project Name} Is
|
|
4
|
-
|
|
5
|
-
> One-sentence pitch.
|
|
6
|
-
|
|
7
|
-
## Target User
|
|
8
|
-
|
|
9
|
-
> Who is this for? Be specific — role, context, what they're trying to accomplish.
|
|
10
|
-
|
|
11
|
-
## What Makes {Project Name} Different
|
|
12
|
-
|
|
13
|
-
| Differentiator | Why it matters |
|
|
14
|
-
|---------------|----------------|
|
|
15
|
-
| {differentiator} | {why} |
|
|
16
|
-
|
|
17
|
-
## Non-Goals
|
|
18
|
-
|
|
19
|
-
> Explicit list of what this project does NOT try to be. Helps filter feature requests.
|
|
20
|
-
|
|
21
|
-
- {Non-goal 1}
|
|
22
|
-
- {Non-goal 2}
|
|
23
|
-
|
|
24
|
-
## Guiding Questions for New Ideas
|
|
25
|
-
|
|
26
|
-
> Use these to evaluate whether a feature idea fits the product:
|
|
27
|
-
|
|
28
|
-
1. Does this serve the target user directly?
|
|
29
|
-
2. Does this align with the differentiators above?
|
|
30
|
-
3. Does this conflict with any non-goal?
|
|
31
|
-
4. Can the user benefit from this without configuration or documentation?
|
|
32
|
-
5. Would removing this make the product worse for the target user?
|
package/docs/archive/.gitkeep
DELETED
|
File without changes
|