agmsg 1.0.4 → 1.0.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/CHANGELOG.md CHANGED
@@ -4,6 +4,36 @@ All notable changes to this project are documented here.
4
4
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
5
5
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
6
 
7
+ ## [1.0.6] - 2026-06-21
8
+
9
+ ### Added
10
+ - Codex monitor bridge (beta) — app-server bridge + re-arm + fresh-session launch (#41) (#148)
11
+ - Add OpenCode as a supported agent type (#136)
12
+
13
+ ### Fixed
14
+ - Pin install to the bootstrapper's version, not main (#173)
15
+ - Engage the monitor bridge on codex 0.141 (ws transport + loaded-thread discovery) (#174)
16
+ - Escape hook command values via json_object (#175)
17
+ - Stop orphaned watch.sh from advancing the shared watermark past undelivered messages (#145)
18
+ - Resolve Codex thread by physical path so symlinked project paths match (#160) (#164)
19
+ - Validate writefile() byte count, not just sqlite3 exit code (#166)
20
+ - Pass sqlite3 -escape off so the char(31) separator stays raw (#165)
21
+ - Write hook files with writefile() to avoid sqlite3 caret-escaping (#158)
22
+ - Validate team names to prevent teams/ path traversal (#147)
23
+
24
+ ### Documentation
25
+ - Worker guardrails + empty-poll OOM case study (#163) (#167)
26
+ - Add llms.txt for AI-agent orientation (#155)
27
+
28
+ ## [1.0.5] - 2026-06-17
29
+
30
+ ### Added
31
+ - Add thin Windows PowerShell launcher (#128)
32
+ - Tear down spawned crew members (#109) (#129)
33
+
34
+ ### Fixed
35
+ - Isolate parallel --continue/--resume sessions sharing a session_id (#132)
36
+
7
37
  ## [1.0.4] - 2026-06-15
8
38
 
9
39
  ### Added
@@ -52,6 +82,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
52
82
  - Handle empty TaskList explicitly to stop fresh-session loop (#71)
53
83
  - Storage driver pluginization design (epic #51) (#52)
54
84
 
85
+ [1.0.6]: https://github.com/fujibee/agmsg/compare/v1.0.5...v1.0.6
86
+ [1.0.5]: https://github.com/fujibee/agmsg/compare/v1.0.4...v1.0.5
55
87
  [1.0.4]: https://github.com/fujibee/agmsg/compare/v1.0.3...v1.0.4
56
88
  [1.0.3]: https://github.com/fujibee/agmsg/compare/v1.0.2...v1.0.3
57
89
  [1.0.2]: https://github.com/fujibee/agmsg/releases/tag/v1.0.2
package/README.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  Cross-agent messaging for CLI AI agents. No daemon, no network, no complexity.
4
4
 
5
+ > **For AI agents:** see [`/llms.txt`](llms.txt) for a quick, machine-friendly orientation.
6
+
5
7
  <a href="https://www.producthunt.com/products/agmsg?utm_source=badge-top-post-badge&utm_medium=badge" target="_blank">
6
8
  <picture>
7
9
  <source media="(prefers-color-scheme: dark)"
@@ -40,16 +42,17 @@ bash <(curl -fsSL https://raw.githubusercontent.com/fujibee/agmsg/main/setup.sh)
40
42
  # Or clone first if you want to inspect the code
41
43
  git clone https://github.com/fujibee/agmsg.git && cd agmsg && ./install.sh
42
44
 
43
- # 2. Restart Claude Code / Codex / Gemini CLI / Antigravity to pick up the new skill
45
+ # 2. Restart Claude Code / Codex / Gemini CLI / Antigravity / OpenCode to pick up the new skill
44
46
 
45
47
  # 3. Run the command — it will prompt for team and agent name on first use
46
48
  # Claude Code: /agmsg
47
49
  # Codex: $agmsg
48
50
  # Gemini CLI: $agmsg
49
51
  # Antigravity: $agmsg
52
+ # OpenCode: $agmsg
50
53
  ```
51
54
 
52
- That's it. The slash command prompts you for a team name and an agent name on first use, then asks you to pick a [delivery mode](#delivery-modes) (default on Claude Code: `monitor` — real-time push; Codex defaults to `turn` because it has no Monitor tool). After that, you talk to your agent naturally — see [First run](#first-run) below.
55
+ That's it. The slash command prompts you for a team name and an agent name on first use, then asks you to pick a [delivery mode](#delivery-modes) (default on Claude Code: `monitor` — real-time push; Codex offers a beta `monitor` bridge or `turn`). After that, you talk to your agent naturally — see [First run](#first-run) below.
53
56
 
54
57
  Prefer a different install method? See [Install](#install) below for `npm` / `npx` and the Claude Code plugin marketplace paths.
55
58
 
@@ -97,7 +100,8 @@ git clone https://github.com/fujibee/agmsg.git
97
100
  cd agmsg
98
101
  ./install.sh # Interactive (asks command name, default: agmsg)
99
102
  ./install.sh --cmd m # Non-interactive with custom command name
100
- ./install.sh --agent-type gemini # Install a Gemini-oriented SKILL.md
103
+ ./install.sh --agent-type gemini # Install a Gemini-oriented SKILL.md
104
+ ./install.sh --agent-type opencode # OpenCode-only: sets shared skill to OpenCode template
101
105
  ```
102
106
 
103
107
  The **command name** determines:
@@ -107,22 +111,21 @@ The **command name** determines:
107
111
 
108
112
  `--cmd` and `--agent-type` are only available via the direct-script path; the `npm` and plugin paths always install as `agmsg` and auto-detect the host agent type.
109
113
 
110
- After install, **restart your agent** (Claude Code / Codex / Gemini CLI / Copilot CLI / Antigravity) so it picks up the new skill.
111
-
112
- ### Native Windows / PowerShell shortcut
113
-
114
- When `install.sh` runs under Git Bash on Windows, it also installs optional native helpers:
114
+ After install, **restart your agent** (Claude Code / Codex / Gemini CLI / Copilot CLI / Antigravity / OpenCode) so it picks up the new skill.
115
115
 
116
- - `~/.agents/agmsg.ps1` — a PowerShell function wrapper
117
- - `~/.agents/agmsg-run.sh` — the Git Bash runner used by that wrapper
118
- - `~/.agents/bin/sqlite3` — a compatibility shim for Windows `sqlite3.exe` output
116
+ ### Native Windows / PowerShell profile function
119
117
 
120
- To enable the PowerShell command, dot-source the generated file from your PowerShell profile:
118
+ When `install.sh` runs under Git Bash on Windows, it installs the PowerShell
119
+ launcher under the skill tree. To enable an `agmsg` PowerShell command, add the
120
+ profile function from the PowerShell host you use:
121
121
 
122
122
  ```powershell
123
- . "$HOME\.agents\agmsg.ps1"
123
+ pwsh -ExecutionPolicy Bypass -File "$HOME\.agents\skills\agmsg\scripts\windows\install-agmsg.ps1"
124
124
  ```
125
125
 
126
+ Use `powershell` instead of `pwsh` if you use Windows PowerShell rather than
127
+ PowerShell 7; each host has its own profile path.
128
+
126
129
  Then a PowerShell session can run:
127
130
 
128
131
  ```powershell
@@ -133,7 +136,11 @@ agmsg send alice "hello from PowerShell"
133
136
  agmsg mode turn
134
137
  ```
135
138
 
136
- The installer prints the same profile line but does not modify your profile automatically.
139
+ The PowerShell launcher delegates to the existing Bash scripts; it does not
140
+ reimplement agmsg logic or read the SQLite database directly. Git Bash and
141
+ `sqlite3` must both be available from the Windows environment. See
142
+ [Windows PowerShell launcher](docs/windows.md) for details and an optional
143
+ profile installer.
137
144
 
138
145
  ## First run
139
146
 
@@ -185,6 +192,21 @@ Options: `--project <path>` (default: current project), `--team <team>` (auto-re
185
192
 
186
193
  Only `claude-code` and `codex` are supported today. macOS is the primary target; Linux and Windows are best-effort (please open an issue/PR if your terminal isn't handled). Headless environments — no tmux **and** no usable terminal — error out, since the agent CLIs need an interactive terminal.
187
194
 
195
+ ### Tear down a spawned agent (`despawn`)
196
+
197
+ `despawn` is the inverse of `spawn` — it cleanly tears down a member you brought up.
198
+
199
+ ```
200
+ /agmsg despawn reviewer # graceful: the member drops its role and closes its own pane
201
+ /agmsg despawn alice --force # force: tear it down from here when its watcher can't respond
202
+ ```
203
+
204
+ By default `despawn <name>` is **graceful**: it sends a `ctrl:despawn` control message to `<name>`, whose watcher drops its own role (releasing the actas lock and registration) and closes its own tmux pane — ending the agent. It blocks until the role is released, up to `--timeout <secs>` (default 30), then prints `status=ok`. If the member's watcher never responds it prints `status=timeout` and exits 3 — retry with `--force`.
205
+
206
+ `--force` skips the message and tears the member down from the placement recorded at spawn time: it kills the member's tmux pane/window and drops its registration. Use it when the member's watcher can't respond — a dead watcher, or a **codex** member (no Monitor, so graceful has nothing to act on). A member started by hand (no spawn placement record) can't be `--force`d; despawn says so and leaves it for you to close.
207
+
208
+ Despawn only acts on the named member — the session running `despawn` is never torn down, and a broad-subscription watcher ignores a `ctrl:despawn` aimed at another role.
209
+
188
210
  ## Delivery modes
189
211
 
190
212
  How incoming messages reach your agent. Pick one at first join via the prompt, or change it later with `/agmsg mode <name>`.
@@ -192,7 +214,7 @@ How incoming messages reach your agent. Pick one at first join via the prompt, o
192
214
  | mode | mechanism | latency | who it's for |
193
215
  |---|---|---|---|
194
216
  | **`monitor`** (default on Claude Code) | SessionStart hook → Monitor tool → blocking SQLite stream | ~5s | Claude Code users wanting real-time push |
195
- | **`turn`** (default on Codex / Copilot CLI) | Stop hook fires `check-inbox.sh` between assistant turns | until your next interaction | Codex / Copilot CLI (no Monitor tool); Claude Code users on a quieter loop |
217
+ | **`turn`** (default on Codex / Copilot CLI / OpenCode) | Stop hook fires `check-inbox.sh` between assistant turns | until your next interaction | Codex / Copilot CLI / OpenCode (no Monitor tool); Claude Code users on a quieter loop |
196
218
  | **`both`** | monitor primary, turn as per-session safety net | ~5s; falls back to turn-end on watcher failure | belt-and-suspenders |
197
219
  | **`off`** | no automatic delivery | manual `/agmsg` only | minimalists |
198
220
 
@@ -234,6 +256,7 @@ The command updates `db/config.yaml`, rewrites the project's hook entries, and p
234
256
  /agmsg actas <name> — switch to another role in this project (create if needed)
235
257
  /agmsg drop <name> — remove a role from this project
236
258
  /agmsg spawn <type> <name> — launch a new agent (claude-code/codex) that takes <name>
259
+ /agmsg despawn <name> [--force] — tear down a member you spawned (graceful, or --force)
237
260
  /agmsg hook on | off — legacy aliases (mode turn | off)
238
261
  /agmsg version — show the installed version (git-describe provenance)
239
262
  /agmsg reset — clear current project registration
@@ -245,7 +268,11 @@ The command updates `db/config.yaml`, rewrites the project's hook entries, and p
245
268
  $agmsg — or /skills → agmsg
246
269
  ```
247
270
 
248
- Codex supports `mode turn` and `mode off` only — there's no Monitor tool to stream into.
271
+ Codex supports `mode monitor` as a **beta** app-server bridge, plus `mode turn` and `mode off`.
272
+
273
+ > ⚠️ **The monitor beta changes how Codex starts — opt in only if you understand it.** Codex has no Monitor tool, so `mode monitor` installs a shim at `~/.agents/bin/codex` and asks you to put `~/.agents/bin` **first on your PATH**, so `codex` then resolves to the shim instead of the real binary. In monitor-mode projects the shim routes interactive launches through a bridge that turns incoming agmsg messages into turns on the current Codex thread; `codex exec` and non-monitor projects pass straight through to the real Codex. It depends on experimental Codex app-server behavior and has known rough edges (orphans on TUI close — #149; one identity per project — #150).
274
+
275
+ If the shim can't be installed, launch with `~/.agents/skills/<cmd>/scripts/codex-monitor.sh`. Codex sandboxing must allow writes to the skill's `db/`, `teams/`, and `run/` dirs — `install.sh` configures those `writable_roots` when `~/.codex/config.toml` exists. Setup, PATH notes, and internals: [docs/codex-monitor-beta.md](docs/codex-monitor-beta.md).
249
276
 
250
277
  ### GitHub Copilot CLI
251
278
 
@@ -255,6 +282,18 @@ Codex supports `mode turn` and `mode off` only — there's no Monitor tool to st
255
282
 
256
283
  The Copilot installer drops a `SKILL.md` at `~/.copilot/skills/agmsg/` so `/agmsg` is auto-discovered. Per-project hooks live at `<project>/.github/hooks/agmsg.json`. Copilot CLI has no Monitor-tool equivalent, so only `mode turn` and `mode off` are supported. Asking for `monitor` or `both` is rejected with an error.
257
284
 
285
+ ### OpenCode
286
+
287
+ ```
288
+ $agmsg
289
+ ```
290
+
291
+ Install with `./install.sh` (when `~/.config/opencode/` exists, the OpenCode-typed skill is placed automatically alongside the default Codex-typed shared skill). Use `--agent-type opencode` only for OpenCode-only environments where Codex is not installed. OpenCode is supported for manual and turn/off delivery workflows. It currently supports `mode turn` and `mode off`; `monitor`, `both`, and `spawn opencode` are not supported.
292
+
293
+ This makes OpenCode useful as a local coding agent, including configurations backed by local providers such as Ollama.
294
+
295
+ See [docs/opencode.md](docs/opencode.md) for full setup instructions.
296
+
258
297
  ### Shell (any agent)
259
298
 
260
299
  ```bash
@@ -371,6 +410,63 @@ This can also go in project-level `.claude/settings.local.json` if you prefer pe
371
410
 
372
411
  If you installed agmsg under a custom command name (e.g. `m`), adjust the path accordingly (`~/.agents/skills/m/`).
373
412
 
413
+ ### Sandbox compatibility (Codex)
414
+
415
+ Codex may run shell commands in a workspace-write sandbox. agmsg stores its
416
+ SQLite database and team metadata under `~/.agents/skills/<cmd>/` by default,
417
+ which is outside most project workspaces. If the sandbox cannot write there,
418
+ commands that append or update state can fail with errors such as
419
+ `sqlite3.OperationalError: unable to open database file`.
420
+
421
+ This affects operations such as:
422
+
423
+ - sending messages (`send.sh` writes to `db/messages.db`)
424
+ - marking inbox rows as read (`inbox.sh` updates `read_at`)
425
+ - joining, resetting, switching roles, or changing delivery mode (`teams/` and
426
+ config/state files may be updated)
427
+
428
+ If you use Codex with filesystem sandboxing enabled, allow writes to the agmsg
429
+ skill storage directory in your Codex config.
430
+
431
+ Example `~/.codex/config.toml`:
432
+
433
+ ```toml
434
+ sandbox_mode = "workspace-write"
435
+
436
+ [sandbox_workspace_write]
437
+ writable_roots = [
438
+ "~/.agents/skills/agmsg/db",
439
+ "~/.agents/skills/agmsg/teams",
440
+ ]
441
+ ```
442
+
443
+ If you installed agmsg under a custom command name, adjust the path accordingly:
444
+
445
+ ```toml
446
+ [sandbox_workspace_write]
447
+ writable_roots = [
448
+ "~/.agents/skills/m/db",
449
+ "~/.agents/skills/m/teams",
450
+ ]
451
+ ```
452
+
453
+ You can also allow the whole skill directory if your Codex setup supports that:
454
+
455
+ ```toml
456
+ [sandbox_workspace_write]
457
+ writable_roots = [
458
+ "~/.agents/skills/agmsg",
459
+ ]
460
+ ```
461
+
462
+ Codex only supports `mode turn` and `mode off`; it does not have Claude Code's
463
+ Monitor tool. The sandbox allowlist is still required for writes performed by
464
+ manual `$agmsg` commands and turn-end inbox checks.
465
+
466
+ Some Codex runtimes or automations may inject a managed permission profile for a
467
+ single run. In that case, the run-specific writable roots must also include the
468
+ agmsg storage paths; the user-level config alone may not be enough.
469
+
374
470
  ## Tests
375
471
 
376
472
  ```bash
package/bin/agmsg.js CHANGED
@@ -29,10 +29,24 @@ const fs = require('fs');
29
29
  const os = require('os');
30
30
  const path = require('path');
31
31
 
32
- const SETUP_URL = 'https://raw.githubusercontent.com/fujibee/agmsg/main/setup.sh';
32
+ const RAW_BASE = 'https://raw.githubusercontent.com/fujibee/agmsg';
33
33
  const REPO_URL = 'https://github.com/fujibee/agmsg';
34
34
  const HOMEPAGE = 'https://agmsg.cc';
35
35
 
36
+ // Install the repo ref that matches THIS bootstrapper's version, so
37
+ // `npx agmsg@X` installs X — not whatever happens to be on main. We fetch
38
+ // setup.sh from the matching tag AND pass AGMSG_REF so setup.sh clones the
39
+ // same tag. Falls back to main only when the version can't be read (e.g. a
40
+ // dev checkout with no published tag). See #172.
41
+ //
42
+ // Bootstrappers published before this fix (<= 1.0.5) hardcoded main and
43
+ // cannot be retrofitted — `npx agmsg@1.0.5` will still pull main. Pinning
44
+ // holds from the first release that ships this file (1.0.6) onward.
45
+ function installRef() {
46
+ const v = readVersion();
47
+ return v && v !== '?' ? 'v' + v : 'main';
48
+ }
49
+
36
50
  function readVersion() {
37
51
  try {
38
52
  const pkgPath = path.join(__dirname, '..', 'package.json');
@@ -75,21 +89,27 @@ function runInstaller(passthroughArgs) {
75
89
  // bootstrapper plus a still-vulnerable install.sh would also work; doing it
76
90
  // correctly here is defense-in-depth and lets future interactive prompts
77
91
  // in setup.sh keep working for real-tty users.
92
+ const ref = installRef();
93
+ const setupUrl = RAW_BASE + '/' + ref + '/setup.sh';
78
94
  const tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'agmsg-bootstrap-'));
79
95
  const setupPath = path.join(tmpDir, 'setup.sh');
80
96
 
81
97
  try {
82
- const fetch = spawnSync('curl', ['-fsSL', '-o', setupPath, SETUP_URL], { stdio: 'inherit' });
98
+ const fetch = spawnSync('curl', ['-fsSL', '-o', setupPath, setupUrl], { stdio: 'inherit' });
83
99
  if (fetch.error) {
84
100
  console.error('agmsg: failed to launch curl:', fetch.error.message);
85
101
  process.exit(1);
86
102
  }
87
103
  if (fetch.status !== 0) {
88
- console.error('agmsg: curl exited ' + fetch.status + ' fetching ' + SETUP_URL);
104
+ console.error('agmsg: curl exited ' + fetch.status + ' fetching ' + setupUrl);
89
105
  process.exit(fetch.status || 1);
90
106
  }
91
107
 
92
- const result = spawnSync('bash', [setupPath, ...passthroughArgs], { stdio: 'inherit' });
108
+ // Pin the clone inside setup.sh to the same ref we fetched it from.
109
+ const result = spawnSync('bash', [setupPath, ...passthroughArgs], {
110
+ stdio: 'inherit',
111
+ env: Object.assign({}, process.env, { AGMSG_REF: ref })
112
+ });
93
113
  if (result.error) {
94
114
  console.error('agmsg: failed to launch bash:', result.error.message);
95
115
  process.exit(1);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agmsg",
3
- "version": "1.0.4",
3
+ "version": "1.0.6",
4
4
  "description": "Cross-agent messaging via SQLite for CLI AI agents (Claude Code, Codex, Gemini CLI, GitHub Copilot CLI, Antigravity, OpenCode). The npm package is a thin bootstrapper that fetches and runs the canonical bash installer at https://github.com/fujibee/agmsg.",
5
5
  "bin": {
6
6
  "agmsg": "bin/agmsg.js"