mercury-agent 0.5.7 → 0.5.8
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/container/Dockerfile +7 -3
- package/container/build.sh +7 -38
- package/docs/authoring-profiles.md +2 -2
- package/docs/container-lifecycle.md +7 -11
- package/docs/memory.md +0 -6
- package/docs/prd-config-load.md +1 -1
- package/package.json +17 -1
- package/resources/templates/env.template +0 -3
- package/src/agent/container-entry.ts +1 -1
package/container/Dockerfile
CHANGED
|
@@ -97,6 +97,13 @@ patch('/home/mercury/.bun');
|
|
|
97
97
|
patch('/app/node_modules');
|
|
98
98
|
EOF
|
|
99
99
|
|
|
100
|
+
# Fix ownership of all mercury home dir artifacts before switching user.
|
|
101
|
+
# Placed here — after the last step that writes to /home/mercury (the pi patch),
|
|
102
|
+
# but before the volatile /app source COPYs below — so this expensive `chown -R`
|
|
103
|
+
# (it walks the whole Chromium + .bun tree) lands in a stable cached layer.
|
|
104
|
+
# Editing source files no longer invalidates it or forces the huge layer re-export.
|
|
105
|
+
RUN chown -R mercury:mercury /home/mercury
|
|
106
|
+
|
|
100
107
|
COPY src/agent/container-entry.ts /app/src/agent/container-entry.ts
|
|
101
108
|
COPY src/agent/model-capabilities-core.ts /app/src/agent/model-capabilities-core.ts
|
|
102
109
|
COPY src/agent/pi-failure-class.ts /app/src/agent/pi-failure-class.ts
|
|
@@ -119,9 +126,6 @@ RUN while IFS= read -r ext || [ -n "$ext" ]; do \
|
|
|
119
126
|
RUN echo '#!/bin/sh\nbun run /app/src/cli/mrctl.ts "$@"' > /usr/local/bin/mrctl && \
|
|
120
127
|
chmod +x /usr/local/bin/mrctl
|
|
121
128
|
|
|
122
|
-
# Fix ownership of all mercury home dir artifacts before switching user
|
|
123
|
-
RUN chown -R mercury:mercury /home/mercury
|
|
124
|
-
|
|
125
129
|
USER mercury
|
|
126
130
|
|
|
127
131
|
ENTRYPOINT ["bun", "run", "/app/src/agent/container-entry.ts"]
|
package/container/build.sh
CHANGED
|
@@ -9,46 +9,15 @@ cd "$PROJECT_ROOT"
|
|
|
9
9
|
IMAGE_NAME="mercury-agent"
|
|
10
10
|
|
|
11
11
|
# Parse arguments
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
BUILD_MINIMAL=false
|
|
15
|
-
|
|
16
|
-
if [ $# -eq 0 ]; then
|
|
17
|
-
BUILD_LATEST=true
|
|
18
|
-
elif [ "$1" = "all" ]; then
|
|
19
|
-
BUILD_ALL=true
|
|
20
|
-
elif [ "$1" = "latest" ]; then
|
|
21
|
-
BUILD_LATEST=true
|
|
22
|
-
elif [ "$1" = "minimal" ]; then
|
|
23
|
-
BUILD_MINIMAL=true
|
|
24
|
-
else
|
|
25
|
-
echo "Usage: $0 [all|latest|minimal]"
|
|
26
|
-
echo ""
|
|
27
|
-
echo "Presets:"
|
|
28
|
-
echo " latest Full devcontainer with Node, Python, Go, git (~2.8GB)"
|
|
29
|
-
echo " minimal Bun + pi + browser only (~1.9GB)"
|
|
30
|
-
echo " all Build both presets"
|
|
12
|
+
if [ $# -gt 0 ] && [ "$1" != "latest" ]; then
|
|
13
|
+
echo "Usage: $0 [latest]"
|
|
31
14
|
echo ""
|
|
32
|
-
echo "
|
|
15
|
+
echo "Builds ${IMAGE_NAME}:latest — full devcontainer with Node, Python, Go, git (~2.8GB)."
|
|
33
16
|
exit 1
|
|
34
17
|
fi
|
|
35
18
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
echo ""
|
|
41
|
-
fi
|
|
42
|
-
|
|
43
|
-
if [ "$BUILD_ALL" = true ] || [ "$BUILD_MINIMAL" = true ]; then
|
|
44
|
-
echo "Building ${IMAGE_NAME}:minimal (bun-only)..."
|
|
45
|
-
docker build -f container/Dockerfile.minimal -t "${IMAGE_NAME}:minimal" .
|
|
46
|
-
echo "✓ Built ${IMAGE_NAME}:minimal"
|
|
47
|
-
echo ""
|
|
48
|
-
fi
|
|
49
|
-
|
|
19
|
+
echo "Building ${IMAGE_NAME}:latest (full devcontainer)..."
|
|
20
|
+
docker build -f container/Dockerfile -t "${IMAGE_NAME}:latest" .
|
|
21
|
+
echo "✓ Built ${IMAGE_NAME}:latest"
|
|
22
|
+
echo ""
|
|
50
23
|
echo "Build complete!"
|
|
51
|
-
if [ "$BUILD_ALL" = true ]; then
|
|
52
|
-
echo " ${IMAGE_NAME}:latest - Full devcontainer (~2.8GB)"
|
|
53
|
-
echo " ${IMAGE_NAME}:minimal - Bun + pi + browser (~1.9GB)"
|
|
54
|
-
fi
|
|
@@ -52,7 +52,7 @@ defaults:
|
|
|
52
52
|
trigger_patterns: always
|
|
53
53
|
```
|
|
54
54
|
|
|
55
|
-
Apply it with `mercury profile
|
|
55
|
+
Apply it with `mercury setup --profile <name|path>`. That validates
|
|
56
56
|
capabilities, copies extensions/AGENTS.md, and persists activation to
|
|
57
57
|
`.mercury/active-profile.json`, which Mercury loads at startup.
|
|
58
58
|
|
|
@@ -168,7 +168,7 @@ Depend on this repo (`mercury-agent`) for the types
|
|
|
168
168
|
|
|
169
169
|
## 5. Local test loop
|
|
170
170
|
|
|
171
|
-
1. `mercury profile
|
|
171
|
+
1. `mercury setup --profile ./barber`
|
|
172
172
|
2. `mercury service install` (builds the derived image with the extension CLI)
|
|
173
173
|
3. DM the bot as a non-admin number; confirm you can `book`/`cancel` only your
|
|
174
174
|
own appointments and cannot reach `gws`/Gmail.
|
|
@@ -175,9 +175,8 @@ Message received
|
|
|
175
175
|
# Set container timeout to 10 minutes
|
|
176
176
|
export MERCURY_CONTAINER_TIMEOUT_MS=600000
|
|
177
177
|
|
|
178
|
-
# Use
|
|
178
|
+
# Use the preset image from GitHub Container Registry
|
|
179
179
|
export MERCURY_AGENT_IMAGE=ghcr.io/avishai-tsabari/mercury-agent:latest # Full (default)
|
|
180
|
-
export MERCURY_AGENT_IMAGE=ghcr.io/avishai-tsabari/mercury-agent:minimal # Lightweight
|
|
181
180
|
```
|
|
182
181
|
|
|
183
182
|
## Sandboxing (Bubblewrap)
|
|
@@ -198,27 +197,24 @@ If you see `bwrap: Creating new namespace failed: Operation not permitted`, try
|
|
|
198
197
|
|
|
199
198
|
Custom images must install `bubblewrap` for sandboxing to work.
|
|
200
199
|
|
|
201
|
-
## Agent Image
|
|
200
|
+
## Agent Image Preset
|
|
202
201
|
|
|
203
|
-
Mercury publishes
|
|
202
|
+
Mercury publishes an image preset to GitHub Container Registry:
|
|
204
203
|
|
|
205
204
|
| Preset | Size | Contents |
|
|
206
205
|
|--------|------|----------|
|
|
207
206
|
| `ghcr.io/avishai-tsabari/mercury-agent:latest` | ~2.8GB | Full devcontainer: Bun, Node.js, Python, Go, git, build tools |
|
|
208
|
-
| `ghcr.io/avishai-tsabari/mercury-agent:minimal` | ~1.9GB | Lightweight runtime: Bun + pi + Chromium deps |
|
|
209
207
|
|
|
210
|
-
Images are published on each release. Version-specific tags are also available (e.g., `:0.2.0
|
|
208
|
+
Images are published on each release. Version-specific tags are also available (e.g., `:0.2.0`).
|
|
211
209
|
|
|
212
210
|
### Building Locally
|
|
213
211
|
|
|
214
|
-
To build
|
|
212
|
+
To build the image locally instead of pulling from the registry:
|
|
215
213
|
```bash
|
|
216
|
-
./container/build.sh
|
|
217
|
-
./container/build.sh latest # Full image only (default)
|
|
218
|
-
./container/build.sh minimal # Lightweight image only
|
|
214
|
+
./container/build.sh # Full image (default)
|
|
219
215
|
```
|
|
220
216
|
|
|
221
|
-
Then use `mercury-agent:latest`
|
|
217
|
+
Then use `mercury-agent:latest` (without the ghcr.io prefix).
|
|
222
218
|
|
|
223
219
|
## Custom Agent Images
|
|
224
220
|
|
package/docs/memory.md
CHANGED
|
@@ -107,12 +107,6 @@ _2026-02-25:_ Changed venue to [[Cafe Nimrod]].
|
|
|
107
107
|
- **Body** — Accumulated context (append semantics, timestamped)
|
|
108
108
|
- **Wikilinks** — Connections to other entities
|
|
109
109
|
|
|
110
|
-
## Conditional Context
|
|
111
|
-
|
|
112
|
-
Mercury can skip loading the full session for standalone prompts (e.g. "what's 2+2?"), reducing token usage. After the run, the prompt and reply are merged back into the session so history stays complete.
|
|
113
|
-
|
|
114
|
-
See [conditional-context.md](conditional-context.md) for details and configuration.
|
|
115
|
-
|
|
116
110
|
## Persistence
|
|
117
111
|
|
|
118
112
|
Memory persists because the agent writes to disk during conversation. When a session compacts or restarts, the vault files remain — the agent reads them fresh on next interaction.
|
package/docs/prd-config-load.md
CHANGED
|
@@ -71,7 +71,7 @@ For each mapped setting, `mergeRawMercuryConfig` applies:
|
|
|
71
71
|
| YAML parse, Zod file schema, flatten, merge | `src/config-file.ts` |
|
|
72
72
|
| Shared model-leg validation | `src/config-model-chain.ts` |
|
|
73
73
|
| `loadConfig`, Zod app schema | `src/config.ts` |
|
|
74
|
-
| Tests | `tests/config.test.ts` (+ guards in `router.test.ts
|
|
74
|
+
| Tests | `tests/config.test.ts` (+ guards in `router.test.ts`) |
|
|
75
75
|
| Template | `resources/templates/mercury.example.yaml` |
|
|
76
76
|
| Operator guide | `docs/configuration.md` |
|
|
77
77
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mercury-agent",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.8",
|
|
4
4
|
"description": "Personal AI assistant for chat platforms (WhatsApp, Slack, Discord, Telegram)",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Avishai Tsabari",
|
|
@@ -42,6 +42,22 @@
|
|
|
42
42
|
"resources",
|
|
43
43
|
"container",
|
|
44
44
|
"docs",
|
|
45
|
+
"!docs/archive",
|
|
46
|
+
"!docs/backlog",
|
|
47
|
+
"!docs/bugs",
|
|
48
|
+
"!docs/debug",
|
|
49
|
+
"!docs/html-slides",
|
|
50
|
+
"!docs/ideas",
|
|
51
|
+
"!docs/in-progress",
|
|
52
|
+
"!docs/notes",
|
|
53
|
+
"!docs/pending-updates",
|
|
54
|
+
"!docs/runbooks",
|
|
55
|
+
"!docs/templates",
|
|
56
|
+
"!docs/ARCHITECTURE.md",
|
|
57
|
+
"!docs/DESIGN.md",
|
|
58
|
+
"!docs/VISION.md",
|
|
59
|
+
"!docs/ROADMAP.md",
|
|
60
|
+
"!docs/TODOS.md",
|
|
45
61
|
"examples",
|
|
46
62
|
"README.md"
|
|
47
63
|
],
|
|
@@ -31,8 +31,5 @@ MERCURY_ANTHROPIC_API_KEY=
|
|
|
31
31
|
# Any MERCURY_* variable set here overrides the YAML value for that key.
|
|
32
32
|
# MERCURY_CONFIG_FILE= # Path to YAML, or empty/none to disable file loading
|
|
33
33
|
|
|
34
|
-
# MERCURY_AUTO_COMPACT_THRESHOLD= # Optional: auto-compact pi session when entry count exceeds this (10–10000) after full-session runs
|
|
35
|
-
# MERCURY_COMPACT_KEEP_RECENT_TOKENS= # Optional: pi compaction keeps this many recent tokens (1000–100000); see docs/conditional-context.md
|
|
36
|
-
|
|
37
34
|
# MERCURY_MODEL_CAPABILITIES= # JSON override for all chain legs, e.g. {"tools":false}
|
|
38
35
|
# Per-model overrides: .mercury/model-capabilities.yaml (see docs)
|
|
@@ -281,7 +281,7 @@ Prioritize practical outputs and explicit assumptions.`;
|
|
|
281
281
|
|
|
282
282
|
const mercuryPlatform = `Files received from users (images, documents, voice notes) are saved to the \`inbox/\` directory in the current workspace. To send files back with your reply, write them to the \`outbox/\` directory — any files created or modified there during this run will be automatically attached to your response.
|
|
283
283
|
|
|
284
|
-
You are Mercury, built from https://github.com/
|
|
284
|
+
You are Mercury, built from https://github.com/Avishai-Tsabari/mercury. When users ask about Mercury — what it can do, how to configure it, scheduling, permissions, extensions, or anything about the platform — you MUST read from \`/docs/mercury/\` before answering. Start with \`/docs/mercury/README.md\` for an overview, then check \`/docs/mercury/docs/\` for detailed guides.
|
|
285
285
|
|
|
286
286
|
## Permissions & Security
|
|
287
287
|
Each run is triggered by a specific caller with a role (admin or member). The caller's identity and role are provided in the user prompt as a <caller /> tag.
|