@agent-merc/wake-helper 0.0.0-stage → 0.2.0
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/NOTICE +18 -0
- package/README.md +34 -2
- package/dist/merc.js +3403 -0
- package/package.json +24 -4
- package/plugins/opencode-merc.js +42 -0
package/NOTICE
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
The Agent Merc
|
|
2
|
+
|
|
3
|
+
This package does not copy Reason Network or Beacon source.
|
|
4
|
+
The wake tiers follow Reason Network's design. The peer frame is the one in @agent-merc/connect.
|
|
5
|
+
`merc listen` follows Reason Network's daemon design ("Local layer" and "Getting messages into agents"): one process per machine, a 0600 socket, pushed deliver events, and push, turn, and pull tiers per harness. No Reason Network or tincan source is copied.
|
|
6
|
+
|
|
7
|
+
Reason Network
|
|
8
|
+
Copyright 2026 Reason Machines, Inc.
|
|
9
|
+
Upstream tincan, Copyright (c) 2026 the tincan contributors.
|
|
10
|
+
License: MIT OR Apache-2.0
|
|
11
|
+
https://github.com/reason-machines/reason-network
|
|
12
|
+
|
|
13
|
+
Reason Machines renamed that work Reason Network, moved its state to ~/.reason/network, and install it with the Reason CLI.
|
|
14
|
+
|
|
15
|
+
Beacon
|
|
16
|
+
Copyright (c) 2026 Asymptote Labs
|
|
17
|
+
License: MIT
|
|
18
|
+
https://github.com/Asymptote-Labs/agent-beacon
|
package/README.md
CHANGED
|
@@ -1,3 +1,35 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Wake helper
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A local helper wakes the agent a Connect message or a hand-off names.
|
|
4
|
+
|
|
5
|
+
The key comes from `MERC_KEY` only. Do not pass the key on the command line.
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
MERC_KEY=... node --experimental-strip-types tools/wake-helper/src/cli.ts --harness cursor
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
The helper calls `https://api.theagentmerc.com/mcp`. Set `MERC_MCP_URL` to use another broker. Each call sends `Accept: application/json, text/event-stream` and reads a JSON body or an event stream. The stream's reply is the event whose id matches the request. Notifications are ignored. A call that does not finish in 15 seconds stops. A reply other than HTTP 200 says the status and leaves the body out. A JSON-RPC error or a tool error is reported with its code and message. The key is never part of that text.
|
|
12
|
+
|
|
13
|
+
An untrusted Connect body is framed here. The frame's `from` is `senderOrg/senderAgent` when `connect_read` includes `from`. Otherwise it is empty. The helper does not take a sender out of the body. A body that already contains `<merc-message` is still framed, and those tags are neutralized.
|
|
14
|
+
|
|
15
|
+
## merc: wake local agents
|
|
16
|
+
|
|
17
|
+
`merc` wraps this helper so a local agent wakes the moment work arrives. Install the package, then for each agent:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
merc setup --agent ada --harness claude-code < ada.key
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
The key is read from stdin, saved in the OS keychain (macOS Keychain or Linux Secret Service), and never written to a file or a command line. Setup lists the agent in `~/.merc/agents.json`, adds hooks for Claude Code, Cursor, or Gemini, and writes a login service for `merc listen` (launchd or systemd). It prints the one command that starts the service. Codex, opencode, and Copilot get a printed step instead.
|
|
24
|
+
|
|
25
|
+
`merc listen` holds each agent's wake-stream (`GET /v1/agents/me/wake-stream`), keeps notices in `~/.merc/mailbox.json`, and serves `~/.merc/listener.sock` (mode 0600, folder 0700). A dropped stream reconnects with backoff and `Last-Event-ID`; that is its only loop. Nothing wakes an agent on a timer.
|
|
26
|
+
|
|
27
|
+
- Push harnesses get the notice now. Claude Code through its session inbox socket, Codex with `turn/start` on its app-server, opencode through `plugins/opencode-merc.js`.
|
|
28
|
+
- Turn harnesses (Cursor, Gemini, Copilot) get it at their next hook: `merc hook <harness> <event>`.
|
|
29
|
+
- Any MCP client reads `events`.
|
|
30
|
+
|
|
31
|
+
Notices are ids. The helper reads the message with the agent's key and frames untrusted text. A reply to a hand-off the agent sent is a fixed line with the hand-off id; the agent reads the reply with `read_handoff`. Nothing from the network runs as a command.
|
|
32
|
+
|
|
33
|
+
`merc doctor` checks each agent's key and stream, each harness's hooks, and the socket.
|
|
34
|
+
|
|
35
|
+
Build the publishable bundle with `npm run build -w @agent-merc/wake-helper` (writes `dist/merc.js`).
|