This repository was archived by the owner on Aug 17, 2026. It is now read-only.
Repository navigation
Commit 17f2d4c
committed
feat(grunt/tui): --peer-id flag on attach + TUI (anomalyco#222 patch 2a) (#3)
Adds a CLI flag that sets the OPENCODE_PEER_ID env var early in the
process lifecycle. sanitizedProcessEnv() already propagates env to MCP
children + workers, so any coordination MCP loaded into the session
can read process.env.OPENCODE_PEER_ID to know its tab identity without
asking the agent via a TAKEOFF prompt dance.
Plumbing only. Patch 2d (auto-announce-at-session-start) is what
actually USES this to call hivemind_announce automatically.
## Why
Today's hivemind-mcp coordination flow has the agent call
hivemind_announce({ id: <peer-id>, ... }) on its first turn. The peer-id
has to be passed in via the prompt because the agent has no other way
to know which terminal it's running in. With this flag, launch scripts
can set tab identity at start, and patch 2d will auto-announce so the
TAKEOFF dance disappears entirely.
## Surface
- New constant OPENCODE_PEER_ID in @opencode-ai/core/util/opencode-process
- New helper setPeerID() in same module — guards empty strings
- --peer-id <string> flag on attach + TUI commands (not serve;
headless serve has no terminal/tab identity)
- Reads from $OPENCODE_PEER_ID env if the flag is not given (yargs
picks this up automatically with the name 'peer-id' → 'peerId')
Refs hivemind anomalyco#222 Phase 2 patch 2a.1 parent 4d0f65f commit 17f2d4c
4 files changed
Lines changed: 28 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
4 | 14 | | |
5 | 15 | | |
6 | 16 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
| |||
83 | 84 | | |
84 | 85 | | |
85 | 86 | | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
86 | 92 | | |
87 | 93 | | |
88 | 94 | | |
89 | 95 | | |
90 | 96 | | |
91 | 97 | | |
| 98 | + | |
| 99 | + | |
92 | 100 | | |
93 | 101 | | |
94 | 102 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| 22 | + | |
22 | 23 | | |
23 | 24 | | |
24 | 25 | | |
| |||
111 | 112 | | |
112 | 113 | | |
113 | 114 | | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
114 | 120 | | |
115 | 121 | | |
116 | 122 | | |
| |||
121 | 127 | | |
122 | 128 | | |
123 | 129 | | |
| 130 | + | |
| 131 | + | |
124 | 132 | | |
125 | 133 | | |
126 | 134 | | |
| |||
0 commit comments