mercury-agent 0.5.0 → 0.5.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/README.md +452 -451
- package/container/Dockerfile +127 -127
- package/container/Dockerfile.base +109 -109
- package/container/Dockerfile.power +17 -17
- package/container/agent-package.json +8 -8
- package/container/build.sh +54 -54
- package/docs/ROADMAP.md +3 -4
- package/docs/archive/summarization/2026-07-02-recent-dev-summary.md +71 -0
- package/docs/auth/dashboard.md +28 -28
- package/docs/auth/overview.md +109 -109
- package/docs/auth/whatsapp.md +173 -173
- package/docs/authoring-profiles.md +174 -174
- package/docs/configuration.md +54 -54
- package/docs/container-lifecycle.md +349 -349
- package/docs/{bugs/bwrap-privileged-linux-docker.md → debug/major/2026-07-02-bwrap-privileged-linux-docker.md} +21 -1
- package/docs/{bugs/e2big-prompt-delivery-fix.md → debug/major/2026-07-02-e2big-prompt-delivery-fix.md} +27 -1
- package/docs/{bugs/registry-pull-no-local-fallback.md → debug/major/2026-07-02-registry-pull-no-local-fallback.md} +27 -1
- package/docs/debug/summarization/2026-07-02-common-bug-patterns.md +72 -0
- package/docs/deployment.md +199 -199
- package/docs/extensions.md +375 -375
- package/docs/graceful-shutdown.md +62 -62
- package/docs/kb-distillation.md +77 -77
- package/docs/media/overview.md +140 -140
- package/docs/media/whatsapp.md +171 -171
- package/docs/memory.md +137 -137
- package/docs/permissions.md +217 -217
- package/docs/pipeline.md +228 -228
- package/docs/prd-chat-memory.md +76 -76
- package/docs/prd-config-load.md +82 -82
- package/docs/rate-limiting.md +229 -229
- package/docs/runbooks/publish-checklist.md +9 -1
- package/docs/scheduler.md +288 -288
- package/docs/setup-discord.md +100 -100
- package/docs/setup-slack.md +119 -119
- package/docs/setup-whatsapp.md +94 -94
- package/docs/subagents.md +166 -166
- package/docs/web-search.md +62 -62
- package/examples/extensions/README.md +12 -12
- package/examples/extensions/charts/index.ts +13 -13
- package/examples/extensions/charts/skill/SKILL.md +98 -98
- package/examples/extensions/gws/README.md +52 -52
- package/examples/extensions/gws/skill/SKILL.md +57 -57
- package/examples/extensions/gws/skill/references/calendar.md +101 -101
- package/examples/extensions/gws/skill/references/docs.md +65 -65
- package/examples/extensions/gws/skill/references/drive.md +79 -79
- package/examples/extensions/gws/skill/references/gmail.md +85 -85
- package/examples/extensions/gws/skill/references/sheets.md +60 -60
- package/examples/extensions/napkin/skill/SKILL.md +728 -728
- package/examples/extensions/pdf/skill/LICENSE.txt +30 -30
- package/examples/extensions/pdf/skill/SKILL.md +314 -314
- package/examples/extensions/pdf/skill/forms.md +294 -294
- package/examples/extensions/pdf/skill/reference.md +611 -611
- package/examples/extensions/pdf/skill/scripts/check_bounding_boxes.py +65 -65
- package/examples/extensions/pdf/skill/scripts/check_fillable_fields.py +11 -11
- package/examples/extensions/pdf/skill/scripts/convert_pdf_to_images.py +33 -33
- package/examples/extensions/pdf/skill/scripts/create_validation_image.py +37 -37
- package/examples/extensions/pdf/skill/scripts/extract_form_field_info.py +122 -122
- package/examples/extensions/pdf/skill/scripts/extract_form_structure.py +115 -115
- package/examples/extensions/pdf/skill/scripts/fill_fillable_fields.py +98 -98
- package/examples/extensions/pdf/skill/scripts/fill_pdf_form_with_annotations.py +107 -107
- package/examples/extensions/permission-guard/index.ts +65 -65
- package/examples/extensions/pinchtab/skill/SKILL.md +224 -224
- package/examples/extensions/pinchtab/skill/TRUST.md +69 -69
- package/examples/extensions/pinchtab/skill/references/api.md +297 -297
- package/examples/extensions/pinchtab/skill/references/env.md +45 -45
- package/examples/extensions/pinchtab/skill/references/profiles.md +107 -107
- package/examples/extensions/tradestation/host/refresh.ts +102 -102
- package/examples/extensions/tradestation/index.ts +153 -153
- package/examples/extensions/tradestation/skill/SKILL.md +67 -67
- package/examples/extensions/voice-synth/index.ts +94 -94
- package/examples/extensions/voice-synth/skill/SKILL.md +38 -38
- package/examples/extensions/voice-transcribe/requirements.txt +8 -8
- package/examples/extensions/voice-transcribe/scripts/transcribe.py +179 -179
- package/examples/extensions/voice-transcribe/skill/SKILL.md +53 -53
- package/examples/extensions/yahoo-mail/cli/package.json +13 -13
- package/examples/extensions/yahoo-mail/skill/SKILL.md +78 -78
- package/package.json +106 -106
- package/resources/agents/explore.md +50 -50
- package/resources/agents/worker.md +24 -24
- package/resources/connection-env-vars.json +25 -25
- package/resources/pi-extensions/subagent/agents.ts +126 -126
- package/resources/pi-extensions/subagent/index.ts +964 -964
- package/resources/profiles/coding/AGENTS.md +43 -43
- package/resources/profiles/coding/mercury-profile.yaml +15 -15
- package/resources/profiles/general/AGENTS.md +31 -31
- package/resources/profiles/general/mercury-profile.yaml +15 -15
- package/resources/profiles/research/AGENTS.md +40 -40
- package/resources/profiles/research/mercury-profile.yaml +15 -15
- package/resources/skills/config/SKILL.md +25 -25
- package/resources/skills/context/SKILL.md +33 -33
- package/resources/skills/conversation-recap/SKILL.md +19 -19
- package/resources/skills/mutes/SKILL.md +31 -31
- package/resources/skills/permissions/SKILL.md +19 -19
- package/resources/skills/preferences/SKILL.md +31 -31
- package/resources/skills/recall/SKILL.md +24 -24
- package/resources/skills/roles/SKILL.md +18 -18
- package/resources/skills/spaces/SKILL.md +18 -18
- package/resources/skills/tasks/SKILL.md +45 -45
- package/resources/templates/AGENTS.md +157 -157
- package/resources/templates/env.template +38 -38
- package/resources/templates/mercury.example.yaml +99 -99
- package/src/agent/container-entry.ts +1 -1
- package/src/agent/container-runner.ts +1345 -1346
- package/src/cli/mercury.ts +39 -7
- package/src/cli/mrctl.ts +636 -636
- package/src/config-file.ts +540 -540
- package/src/config.ts +339 -339
- package/src/core/api.ts +125 -125
- package/src/core/caller-token.ts +101 -101
- package/src/core/permissions.ts +228 -228
- package/src/core/profiles.ts +271 -271
- package/src/core/routes/capability.ts +70 -70
- package/src/core/routes/index.ts +15 -15
- package/src/core/runtime.ts +1530 -1530
- package/src/dashboard/index.html +729 -729
- package/src/extensions/api.ts +273 -273
- package/src/extensions/loader.ts +286 -286
- package/src/extensions/types.ts +517 -517
- package/src/main.ts +605 -605
- package/docs/pending-updates/applicative-profiles.md +0 -15
- package/docs/pending-updates/caller-bound-capability-token.md +0 -15
- package/docs/pending-updates/dm-auto-space.md +0 -15
- /package/docs/archive/{2026-07-01-applicative-profiles.md → applicative-profiles/2026-07-01-applicative-profiles.md} +0 -0
- /package/docs/archive/{2026-07-01-caller-bound-capability-token.md → applicative-profiles/2026-07-01-caller-bound-capability-token.md} +0 -0
- /package/docs/archive/{2026-07-01-dm-auto-space.md → applicative-profiles/2026-07-01-dm-auto-space.md} +0 -0
package/docs/subagents.md
CHANGED
|
@@ -1,166 +1,166 @@
|
|
|
1
|
-
# Subagents
|
|
2
|
-
|
|
3
|
-
Mercury supports delegating tasks to specialized sub-agents using pi's subagent extension. Each sub-agent runs in its own isolated context window, keeping the main conversation clean.
|
|
4
|
-
|
|
5
|
-
## How It Works
|
|
6
|
-
|
|
7
|
-
When the agent invokes the `subagent` tool, it spawns a separate `pi` process with:
|
|
8
|
-
- Its own context window (isolated from main conversation)
|
|
9
|
-
- A specific system prompt (from the agent definition)
|
|
10
|
-
- Optionally a different model (e.g., Haiku for fast recon)
|
|
11
|
-
|
|
12
|
-
```
|
|
13
|
-
Main Agent
|
|
14
|
-
│
|
|
15
|
-
└─► subagent tool
|
|
16
|
-
│
|
|
17
|
-
├─► Spawn pi process
|
|
18
|
-
│ • --mode json
|
|
19
|
-
│ • --model <agent-model>
|
|
20
|
-
│ • --tools <agent-tools>
|
|
21
|
-
│ • --append-system-prompt <agent.md>
|
|
22
|
-
│
|
|
23
|
-
├─► Stream messages back
|
|
24
|
-
│
|
|
25
|
-
└─► Return final output to main agent
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
## Built-in Agents
|
|
29
|
-
|
|
30
|
-
| Agent | Purpose | Model | Tools |
|
|
31
|
-
|-------|---------|-------|-------|
|
|
32
|
-
| `explore` | Fast codebase reconnaissance | Haiku | read, grep, find, ls, bash |
|
|
33
|
-
| `worker` | General-purpose tasks | Sonnet | all |
|
|
34
|
-
|
|
35
|
-
### explore
|
|
36
|
-
|
|
37
|
-
Quickly investigates a codebase and returns structured findings. Outputs:
|
|
38
|
-
- Files retrieved with line ranges
|
|
39
|
-
- Key code snippets (types, interfaces, functions)
|
|
40
|
-
- Architecture overview
|
|
41
|
-
- Where to start
|
|
42
|
-
|
|
43
|
-
### worker
|
|
44
|
-
|
|
45
|
-
General-purpose agent with full capabilities. Works autonomously and reports:
|
|
46
|
-
- What was done
|
|
47
|
-
- Files changed
|
|
48
|
-
- Notes for handoff
|
|
49
|
-
|
|
50
|
-
## Execution Modes
|
|
51
|
-
|
|
52
|
-
### Single Agent
|
|
53
|
-
|
|
54
|
-
Delegate one task to one agent:
|
|
55
|
-
|
|
56
|
-
```
|
|
57
|
-
"Use explore to find all rate limiting code"
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
### Parallel Execution
|
|
61
|
-
|
|
62
|
-
Run multiple agents concurrently (max 8 tasks, 4 concurrent):
|
|
63
|
-
|
|
64
|
-
```
|
|
65
|
-
"Run 2 workers in parallel: one to refactor the router, one to update tests"
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
### Chained Workflow
|
|
69
|
-
|
|
70
|
-
Sequential execution where each agent receives the previous output via `{previous}`:
|
|
71
|
-
|
|
72
|
-
```
|
|
73
|
-
"Use a chain: first have explore find the auth code, then have worker add rate limiting"
|
|
74
|
-
```
|
|
75
|
-
|
|
76
|
-
## File Locations
|
|
77
|
-
|
|
78
|
-
After `mercury init`, subagent files are scaffolded to:
|
|
79
|
-
|
|
80
|
-
```
|
|
81
|
-
.mercury/global/
|
|
82
|
-
├── extensions/subagent/
|
|
83
|
-
│ ├── index.ts # Subagent tool implementation
|
|
84
|
-
│ └── agents.ts # Agent discovery logic
|
|
85
|
-
└── agents/
|
|
86
|
-
├── explore.md # Explorer agent definition
|
|
87
|
-
└── worker.md # Worker agent definition
|
|
88
|
-
```
|
|
89
|
-
|
|
90
|
-
## Adding Custom Agents
|
|
91
|
-
|
|
92
|
-
Create a new `.md` file in `.mercury/global/agents/`:
|
|
93
|
-
|
|
94
|
-
```markdown
|
|
95
|
-
---
|
|
96
|
-
name: researcher
|
|
97
|
-
description: Deep research specialist for complex questions
|
|
98
|
-
tools: read, grep, find, ls, bash
|
|
99
|
-
model: claude-sonnet-4-5
|
|
100
|
-
---
|
|
101
|
-
|
|
102
|
-
You are a research specialist. Thoroughly investigate questions and provide comprehensive answers.
|
|
103
|
-
|
|
104
|
-
## Strategy
|
|
105
|
-
1. Break down the question
|
|
106
|
-
2. Search for relevant information
|
|
107
|
-
3. Synthesize findings
|
|
108
|
-
|
|
109
|
-
## Output Format
|
|
110
|
-
- Summary
|
|
111
|
-
- Key findings
|
|
112
|
-
- Sources
|
|
113
|
-
```
|
|
114
|
-
|
|
115
|
-
### Frontmatter Fields
|
|
116
|
-
|
|
117
|
-
| Field | Required | Description |
|
|
118
|
-
|-------|----------|-------------|
|
|
119
|
-
| `name` | Yes | Agent identifier (used in subagent calls) |
|
|
120
|
-
| `description` | Yes | Brief description of the agent's purpose |
|
|
121
|
-
| `tools` | No | Comma-separated list of allowed tools |
|
|
122
|
-
| `model` | No | Model to use (defaults to current model) |
|
|
123
|
-
|
|
124
|
-
The body after the frontmatter becomes the agent's system prompt.
|
|
125
|
-
|
|
126
|
-
## Agent Discovery
|
|
127
|
-
|
|
128
|
-
Agents are discovered from:
|
|
129
|
-
1. **User agents**: `~/.pi/agent/agents/` (default scope)
|
|
130
|
-
2. **Project agents**: `.mercury/global/agents/` (requires `agentScope: "both"`)
|
|
131
|
-
|
|
132
|
-
Project agents require user confirmation before running (security measure for repo-controlled code).
|
|
133
|
-
|
|
134
|
-
## Configuration
|
|
135
|
-
|
|
136
|
-
The subagent tool accepts these parameters:
|
|
137
|
-
|
|
138
|
-
| Parameter | Type | Description |
|
|
139
|
-
|-----------|------|-------------|
|
|
140
|
-
| `agent` | string | Agent name (single mode) |
|
|
141
|
-
| `task` | string | Task description (single mode) |
|
|
142
|
-
| `tasks` | array | Array of `{agent, task}` (parallel mode) |
|
|
143
|
-
| `chain` | array | Array of `{agent, task}` (chain mode) |
|
|
144
|
-
| `agentScope` | string | `"user"`, `"project"`, or `"both"` |
|
|
145
|
-
| `cwd` | string | Working directory for the agent |
|
|
146
|
-
|
|
147
|
-
## Limits
|
|
148
|
-
|
|
149
|
-
| Limit | Value |
|
|
150
|
-
|-------|-------|
|
|
151
|
-
| Max parallel tasks | 8 |
|
|
152
|
-
| Max concurrency | 4 |
|
|
153
|
-
|
|
154
|
-
## Example Usage
|
|
155
|
-
|
|
156
|
-
In the chat, users can request subagent work naturally:
|
|
157
|
-
|
|
158
|
-
```
|
|
159
|
-
@Mercury Use explore to find how authentication works in this codebase
|
|
160
|
-
|
|
161
|
-
@Mercury Run a chain: explore finds the database models, then worker adds a new "status" field to the User model
|
|
162
|
-
|
|
163
|
-
@Mercury Run 2 workers in parallel: one fixes the bug in router.ts, one adds a test for it
|
|
164
|
-
```
|
|
165
|
-
|
|
166
|
-
The main agent interprets these requests and invokes the subagent tool accordingly.
|
|
1
|
+
# Subagents
|
|
2
|
+
|
|
3
|
+
Mercury supports delegating tasks to specialized sub-agents using pi's subagent extension. Each sub-agent runs in its own isolated context window, keeping the main conversation clean.
|
|
4
|
+
|
|
5
|
+
## How It Works
|
|
6
|
+
|
|
7
|
+
When the agent invokes the `subagent` tool, it spawns a separate `pi` process with:
|
|
8
|
+
- Its own context window (isolated from main conversation)
|
|
9
|
+
- A specific system prompt (from the agent definition)
|
|
10
|
+
- Optionally a different model (e.g., Haiku for fast recon)
|
|
11
|
+
|
|
12
|
+
```
|
|
13
|
+
Main Agent
|
|
14
|
+
│
|
|
15
|
+
└─► subagent tool
|
|
16
|
+
│
|
|
17
|
+
├─► Spawn pi process
|
|
18
|
+
│ • --mode json
|
|
19
|
+
│ • --model <agent-model>
|
|
20
|
+
│ • --tools <agent-tools>
|
|
21
|
+
│ • --append-system-prompt <agent.md>
|
|
22
|
+
│
|
|
23
|
+
├─► Stream messages back
|
|
24
|
+
│
|
|
25
|
+
└─► Return final output to main agent
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Built-in Agents
|
|
29
|
+
|
|
30
|
+
| Agent | Purpose | Model | Tools |
|
|
31
|
+
|-------|---------|-------|-------|
|
|
32
|
+
| `explore` | Fast codebase reconnaissance | Haiku | read, grep, find, ls, bash |
|
|
33
|
+
| `worker` | General-purpose tasks | Sonnet | all |
|
|
34
|
+
|
|
35
|
+
### explore
|
|
36
|
+
|
|
37
|
+
Quickly investigates a codebase and returns structured findings. Outputs:
|
|
38
|
+
- Files retrieved with line ranges
|
|
39
|
+
- Key code snippets (types, interfaces, functions)
|
|
40
|
+
- Architecture overview
|
|
41
|
+
- Where to start
|
|
42
|
+
|
|
43
|
+
### worker
|
|
44
|
+
|
|
45
|
+
General-purpose agent with full capabilities. Works autonomously and reports:
|
|
46
|
+
- What was done
|
|
47
|
+
- Files changed
|
|
48
|
+
- Notes for handoff
|
|
49
|
+
|
|
50
|
+
## Execution Modes
|
|
51
|
+
|
|
52
|
+
### Single Agent
|
|
53
|
+
|
|
54
|
+
Delegate one task to one agent:
|
|
55
|
+
|
|
56
|
+
```
|
|
57
|
+
"Use explore to find all rate limiting code"
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### Parallel Execution
|
|
61
|
+
|
|
62
|
+
Run multiple agents concurrently (max 8 tasks, 4 concurrent):
|
|
63
|
+
|
|
64
|
+
```
|
|
65
|
+
"Run 2 workers in parallel: one to refactor the router, one to update tests"
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### Chained Workflow
|
|
69
|
+
|
|
70
|
+
Sequential execution where each agent receives the previous output via `{previous}`:
|
|
71
|
+
|
|
72
|
+
```
|
|
73
|
+
"Use a chain: first have explore find the auth code, then have worker add rate limiting"
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## File Locations
|
|
77
|
+
|
|
78
|
+
After `mercury init`, subagent files are scaffolded to:
|
|
79
|
+
|
|
80
|
+
```
|
|
81
|
+
.mercury/global/
|
|
82
|
+
├── extensions/subagent/
|
|
83
|
+
│ ├── index.ts # Subagent tool implementation
|
|
84
|
+
│ └── agents.ts # Agent discovery logic
|
|
85
|
+
└── agents/
|
|
86
|
+
├── explore.md # Explorer agent definition
|
|
87
|
+
└── worker.md # Worker agent definition
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
## Adding Custom Agents
|
|
91
|
+
|
|
92
|
+
Create a new `.md` file in `.mercury/global/agents/`:
|
|
93
|
+
|
|
94
|
+
```markdown
|
|
95
|
+
---
|
|
96
|
+
name: researcher
|
|
97
|
+
description: Deep research specialist for complex questions
|
|
98
|
+
tools: read, grep, find, ls, bash
|
|
99
|
+
model: claude-sonnet-4-5
|
|
100
|
+
---
|
|
101
|
+
|
|
102
|
+
You are a research specialist. Thoroughly investigate questions and provide comprehensive answers.
|
|
103
|
+
|
|
104
|
+
## Strategy
|
|
105
|
+
1. Break down the question
|
|
106
|
+
2. Search for relevant information
|
|
107
|
+
3. Synthesize findings
|
|
108
|
+
|
|
109
|
+
## Output Format
|
|
110
|
+
- Summary
|
|
111
|
+
- Key findings
|
|
112
|
+
- Sources
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### Frontmatter Fields
|
|
116
|
+
|
|
117
|
+
| Field | Required | Description |
|
|
118
|
+
|-------|----------|-------------|
|
|
119
|
+
| `name` | Yes | Agent identifier (used in subagent calls) |
|
|
120
|
+
| `description` | Yes | Brief description of the agent's purpose |
|
|
121
|
+
| `tools` | No | Comma-separated list of allowed tools |
|
|
122
|
+
| `model` | No | Model to use (defaults to current model) |
|
|
123
|
+
|
|
124
|
+
The body after the frontmatter becomes the agent's system prompt.
|
|
125
|
+
|
|
126
|
+
## Agent Discovery
|
|
127
|
+
|
|
128
|
+
Agents are discovered from:
|
|
129
|
+
1. **User agents**: `~/.pi/agent/agents/` (default scope)
|
|
130
|
+
2. **Project agents**: `.mercury/global/agents/` (requires `agentScope: "both"`)
|
|
131
|
+
|
|
132
|
+
Project agents require user confirmation before running (security measure for repo-controlled code).
|
|
133
|
+
|
|
134
|
+
## Configuration
|
|
135
|
+
|
|
136
|
+
The subagent tool accepts these parameters:
|
|
137
|
+
|
|
138
|
+
| Parameter | Type | Description |
|
|
139
|
+
|-----------|------|-------------|
|
|
140
|
+
| `agent` | string | Agent name (single mode) |
|
|
141
|
+
| `task` | string | Task description (single mode) |
|
|
142
|
+
| `tasks` | array | Array of `{agent, task}` (parallel mode) |
|
|
143
|
+
| `chain` | array | Array of `{agent, task}` (chain mode) |
|
|
144
|
+
| `agentScope` | string | `"user"`, `"project"`, or `"both"` |
|
|
145
|
+
| `cwd` | string | Working directory for the agent |
|
|
146
|
+
|
|
147
|
+
## Limits
|
|
148
|
+
|
|
149
|
+
| Limit | Value |
|
|
150
|
+
|-------|-------|
|
|
151
|
+
| Max parallel tasks | 8 |
|
|
152
|
+
| Max concurrency | 4 |
|
|
153
|
+
|
|
154
|
+
## Example Usage
|
|
155
|
+
|
|
156
|
+
In the chat, users can request subagent work naturally:
|
|
157
|
+
|
|
158
|
+
```
|
|
159
|
+
@Mercury Use explore to find how authentication works in this codebase
|
|
160
|
+
|
|
161
|
+
@Mercury Run a chain: explore finds the database models, then worker adds a new "status" field to the User model
|
|
162
|
+
|
|
163
|
+
@Mercury Run 2 workers in parallel: one fixes the bug in router.ts, one adds a test for it
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
The main agent interprets these requests and invokes the subagent tool accordingly.
|
package/docs/web-search.md
CHANGED
|
@@ -1,62 +1,62 @@
|
|
|
1
|
-
# Web Search
|
|
2
|
-
|
|
3
|
-
Web search is **extension-based** in Mercury.
|
|
4
|
-
|
|
5
|
-
Mercury core does not ship a built-in browser/search CLI. Instead, install a web automation extension (for example, `pinchtab`) and let the agent use that tool directly.
|
|
6
|
-
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
## Recommended Setup
|
|
10
|
-
|
|
11
|
-
Use the real example extension at:
|
|
12
|
-
|
|
13
|
-
- `examples/extensions/pinchtab/`
|
|
14
|
-
|
|
15
|
-
It demonstrates:
|
|
16
|
-
|
|
17
|
-
- installing browser tooling in the derived image
|
|
18
|
-
- `before_container` hook for runtime env injection
|
|
19
|
-
- system-prompt guidance for consistent search behavior
|
|
20
|
-
|
|
21
|
-
---
|
|
22
|
-
|
|
23
|
-
## Typical Flow
|
|
24
|
-
|
|
25
|
-
1. Start browser automation tool (`pinchtab`)
|
|
26
|
-
2. Navigate to search engine URL (e.g. Brave Search)
|
|
27
|
-
3. Extract text/snapshot content
|
|
28
|
-
4. Summarize and cite key findings
|
|
29
|
-
|
|
30
|
-
Example command pattern used by agents (see `examples/extensions/pinchtab/` for `pinchtab_ensure` — wait until the bridge listens on `:9867` before calling the CLI; otherwise you get `connection refused`):
|
|
31
|
-
|
|
32
|
-
```bash
|
|
33
|
-
pinchtab_ensure || exit 1
|
|
34
|
-
pinchtab nav "https://search.brave.com/search?q=your+query"
|
|
35
|
-
sleep 3
|
|
36
|
-
pinchtab text
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
---
|
|
40
|
-
|
|
41
|
-
## Why Extension-Based
|
|
42
|
-
|
|
43
|
-
- keeps Mercury core lean
|
|
44
|
-
- lets each deployment pick its own browser/search stack
|
|
45
|
-
- allows per-space RBAC for web tooling (`pinchtab` permission)
|
|
46
|
-
- avoids locking users into one provider/tool
|
|
47
|
-
|
|
48
|
-
---
|
|
49
|
-
|
|
50
|
-
## Security & RBAC
|
|
51
|
-
|
|
52
|
-
Extension CLIs are called directly in bash, with RBAC enforced by Mercury's in-container permission guard.
|
|
53
|
-
|
|
54
|
-
If a caller lacks permission for a web extension CLI, execution is blocked.
|
|
55
|
-
|
|
56
|
-
---
|
|
57
|
-
|
|
58
|
-
## Related Docs
|
|
59
|
-
|
|
60
|
-
- [extensions.md](./extensions.md)
|
|
61
|
-
- [pipeline.md](./pipeline.md)
|
|
62
|
-
- [container-lifecycle.md](./container-lifecycle.md)
|
|
1
|
+
# Web Search
|
|
2
|
+
|
|
3
|
+
Web search is **extension-based** in Mercury.
|
|
4
|
+
|
|
5
|
+
Mercury core does not ship a built-in browser/search CLI. Instead, install a web automation extension (for example, `pinchtab`) and let the agent use that tool directly.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Recommended Setup
|
|
10
|
+
|
|
11
|
+
Use the real example extension at:
|
|
12
|
+
|
|
13
|
+
- `examples/extensions/pinchtab/`
|
|
14
|
+
|
|
15
|
+
It demonstrates:
|
|
16
|
+
|
|
17
|
+
- installing browser tooling in the derived image
|
|
18
|
+
- `before_container` hook for runtime env injection
|
|
19
|
+
- system-prompt guidance for consistent search behavior
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## Typical Flow
|
|
24
|
+
|
|
25
|
+
1. Start browser automation tool (`pinchtab`)
|
|
26
|
+
2. Navigate to search engine URL (e.g. Brave Search)
|
|
27
|
+
3. Extract text/snapshot content
|
|
28
|
+
4. Summarize and cite key findings
|
|
29
|
+
|
|
30
|
+
Example command pattern used by agents (see `examples/extensions/pinchtab/` for `pinchtab_ensure` — wait until the bridge listens on `:9867` before calling the CLI; otherwise you get `connection refused`):
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
pinchtab_ensure || exit 1
|
|
34
|
+
pinchtab nav "https://search.brave.com/search?q=your+query"
|
|
35
|
+
sleep 3
|
|
36
|
+
pinchtab text
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
## Why Extension-Based
|
|
42
|
+
|
|
43
|
+
- keeps Mercury core lean
|
|
44
|
+
- lets each deployment pick its own browser/search stack
|
|
45
|
+
- allows per-space RBAC for web tooling (`pinchtab` permission)
|
|
46
|
+
- avoids locking users into one provider/tool
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## Security & RBAC
|
|
51
|
+
|
|
52
|
+
Extension CLIs are called directly in bash, with RBAC enforced by Mercury's in-container permission guard.
|
|
53
|
+
|
|
54
|
+
If a caller lacks permission for a web extension CLI, execution is blocked.
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
## Related Docs
|
|
59
|
+
|
|
60
|
+
- [extensions.md](./extensions.md)
|
|
61
|
+
- [pipeline.md](./pipeline.md)
|
|
62
|
+
- [container-lifecycle.md](./container-lifecycle.md)
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
# Extension Examples
|
|
2
|
-
|
|
3
|
-
Real-world Mercury extensions. Copy any of these into `.mercury/extensions/` to use.
|
|
4
|
-
|
|
5
|
-
| Extension | What it does | Features used |
|
|
6
|
-
|-----------|-------------|---------------|
|
|
7
|
-
| **charts** | Chart generation via `charts-cli` | cli, skill, permission |
|
|
8
|
-
| **pdf** | PDF processing (OCR, form filling, conversion) | cli, skill, permission |
|
|
9
|
-
| **gws** | Google Workspace (Drive/Gmail/Calendar/etc.) | cli, skill, permission (admin-only default) |
|
|
10
|
-
| **pinchtab** | Browser automation via Playwright | cli, skill, permission, `before_container` hook (env + system prompt) |
|
|
11
|
-
| **napkin** | Obsidian vault management + KB distillation | cli, skill, permission, `workspace_init` hook, `before_container` hook, job, config, widget, store |
|
|
12
|
-
|
|
1
|
+
# Extension Examples
|
|
2
|
+
|
|
3
|
+
Real-world Mercury extensions. Copy any of these into `.mercury/extensions/` to use.
|
|
4
|
+
|
|
5
|
+
| Extension | What it does | Features used |
|
|
6
|
+
|-----------|-------------|---------------|
|
|
7
|
+
| **charts** | Chart generation via `charts-cli` | cli, skill, permission |
|
|
8
|
+
| **pdf** | PDF processing (OCR, form filling, conversion) | cli, skill, permission |
|
|
9
|
+
| **gws** | Google Workspace (Drive/Gmail/Calendar/etc.) | cli, skill, permission (admin-only default) |
|
|
10
|
+
| **pinchtab** | Browser automation via Playwright | cli, skill, permission, `before_container` hook (env + system prompt) |
|
|
11
|
+
| **napkin** | Obsidian vault management + KB distillation | cli, skill, permission, `workspace_init` hook, `before_container` hook, job, config, widget, store |
|
|
12
|
+
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
export default function (mercury: {
|
|
2
|
-
cli(opts: { name: string; install: string }): void;
|
|
3
|
-
permission(opts: { defaultRoles: string[] }): void;
|
|
4
|
-
skill(relativePath: string): void;
|
|
5
|
-
}) {
|
|
6
|
-
mercury.cli({
|
|
7
|
-
name: "charts",
|
|
8
|
-
install: "npm install -g charts-cli",
|
|
9
|
-
});
|
|
10
|
-
|
|
11
|
-
mercury.permission({ defaultRoles: ["admin", "member"] });
|
|
12
|
-
mercury.skill("./skill");
|
|
13
|
-
}
|
|
1
|
+
export default function (mercury: {
|
|
2
|
+
cli(opts: { name: string; install: string }): void;
|
|
3
|
+
permission(opts: { defaultRoles: string[] }): void;
|
|
4
|
+
skill(relativePath: string): void;
|
|
5
|
+
}) {
|
|
6
|
+
mercury.cli({
|
|
7
|
+
name: "charts",
|
|
8
|
+
install: "npm install -g charts-cli",
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
mercury.permission({ defaultRoles: ["admin", "member"] });
|
|
12
|
+
mercury.skill("./skill");
|
|
13
|
+
}
|