@sjawhar/claude-envoy 4.14.3 → 4.14.4

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.
@@ -2,5 +2,5 @@
2
2
  "name": "claude-envoy",
3
3
  "description": "Put Envoy events into the Claude Code session's own conversation and expose Envoy MCP tools.",
4
4
  "mcpServers": "./.mcp.json",
5
- "version": "4.14.3"
5
+ "version": "4.14.4"
6
6
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-envoy",
3
- "version": "4.14.3",
3
+ "version": "4.14.4",
4
4
  "description": "Put Envoy events into the Claude Code session's own conversation and expose Envoy MCP tools.",
5
5
  "mcpServers": {}
6
6
  }
package/AGENTS.md CHANGED
@@ -1,64 +1,41 @@
1
1
  # Claude Envoy
2
2
 
3
- `@sjawhar/claude-envoy` is the Claude Code plugin for Envoy and Dispatch.
4
- One MCP stdio server (`src/envoy-channel-server.ts`) is the session's Envoy ingress and serves the `envoy_*` tools; the mod (`hooks/mod.ts`) writes into a terminal session; `bin/dispatch` puts the `dispatch` command on the Bash tool's `PATH`.
5
- In a pane `legion claude-bridge` launched, the server also runs the Legion phase worker (`src/legion-*.ts`).
3
+ `@sjawhar/claude-envoy` is the Claude Code plugin for Envoy and Dispatch;
6
4
  `codex/` and `src/codex/` are the Codex CLI plugin, `@sjawhar/codex-envoy`, built from this source.
7
- `README.md` has the architecture, the bundle and release, and the smokes.
5
+ `README.md` has the architecture, the bundle and release, the commands and the smokes.
8
6
 
9
- ## Commands
7
+ ## Components
10
8
 
11
- - From this directory: `bun run test` (one file: `bun test --timeout=60000 tests/mod.test.ts`), `bun run typecheck` and `bun run lint`.
9
+ - `src/envoy-channel-server.ts`: the MCP stdio server, the session's Envoy ingress, which serves the `envoy_*` tools.
12
10
 
13
- - `bun scripts/build.ts --out "$(mktemp -d)"` builds a runnable copy outside the repository, and `--codex-out <dir>` the Codex plugin; `bun run verify-build "$(mktemp -d)/built.tar"` builds twice and compares, as the release does.
11
+ - `hooks/mod.ts`: the mod, which writes into a terminal session; `hooks/mod-writer.ts` decides whether a message becomes a prompt or a row.
14
12
 
15
- - The real-binary tests skip unless `LEGION_TEST_CLAUDE` names a Claude Code binary (README, "Local checks").
16
- `tests/envoy-channel-stall.test.ts` runs only with `LEGION_E2E_ENVOY_STACK=1` and `go` on `PATH`.
13
+ - `bin/dispatch`: puts the `dispatch` command on the Bash tool's `PATH`.
17
14
 
18
- ## Build and release
15
+ - `src/legion-*.ts`: the Legion phase worker, which the server runs in a pane `legion claude-bridge` launched.
19
16
 
20
- - Nothing commits `dist/` or `legion/`, and nothing run locally writes them.
21
- The `claude_envoy_build` job of `.github/workflows/release.yaml` builds and publishes after a merge that touches a path of `$CLAUDE_ENVOY_VERSION_ARGS`.
17
+ - `scripts/build.ts`: builds the plugin's bundles.
22
18
 
23
- - The plugin cache has no `node_modules`, so the bundles inline every dependency, `@legion/contracts` and `@legion/envoy-client` among them.
24
-
25
- - `scripts/build-inputs.txt` and `$CLAUDE_ENVOY_VERSION_ARGS` list the same paths.
26
- A change that makes `scripts/build.ts` or `scripts/verify-build.sh` read a new file adds it to both.
27
-
28
- - The build refuses a Bun other than `.bun-version`'s; call the pinned binary by path when a version manager's default differs.
19
+ ## Rules
29
20
 
30
- - `.omp-plugin/plugin.json`'s empty `mcpServers` keeps Oh My Pi from starting the server, and `.mcp.json`'s `env` passes `CLAUDE_PROJECT_DIR` alone, since Claude Code substitutes an unset `${VAR}` literally.
21
+ - Nothing commits `dist/` or `legion/`; the release builds them.
31
22
 
32
- ## Rules
23
+ - A change that makes `scripts/build.ts` or `scripts/verify-build.sh` read a new file adds it to `scripts/build-inputs.txt` and to `$CLAUDE_ENVOY_VERSION_ARGS` in `.github/workflows/release.yaml`.
33
24
 
34
- - `renderInbound` (`@legion/envoy-client/delivery`) is the only inbound renderer, and no receipt is published: a reply inbox on a frame belongs to the JetStream acknowledgement.
25
+ - Render inbound messages only through `renderInbound` (`@legion/envoy-client/delivery`).
35
26
 
36
- - Subscribe the relay subject (`notifications.envoy.deliver.<session_id>`) before any registration under that id, and read the id from the shared `SessionIdentity` at each use: a `/clear` moves the session to a new id.
27
+ - Subscribe the session's relay subject before any registration under its id, and read the id from the shared `SessionIdentity` at each use:
28
+ a `/clear` moves the session to a new id.
37
29
 
38
- - Hand the relay the nats.js `Msg` itself: its `data`, `headers` and `reply` are prototype getters that an object spread drops.
30
+ - Hand the relay the nats.js `Msg` itself, never a copy: its `data`, `headers` and `reply` are prototype getters that an object spread drops.
39
31
 
40
32
  - Every registry write goes through the session's one `serialized` chain, and nothing in it waits without a bound, since shutdown's deregistration queues behind it.
41
33
 
42
- - Register the capabilities `sessionCapabilities` computes, never a constant.
43
- The role record rules are `roleHeldBy` and `mayActOnRoleRecord` in `@legion/envoy-client/transport`, which pi-envoy shares.
34
+ - Register the capabilities `sessionCapabilities` computes, never a constant, and read role records through `roleHeldBy` and `mayActOnRoleRecord` (`@legion/envoy-client/transport`), which pi-envoy shares.
44
35
 
45
36
  - No Dispatch call goes through the MCP server, and no permission relay is carried: no reply path here authenticates its sender.
46
37
 
47
- ## The mod
48
-
49
- - Every message into a terminal session goes through the mod's `session.message`, and `hooks/mod-writer.ts` decides whether it becomes a prompt or a row: only the mod sees the turn's events and this plugin's writes in one order.
50
-
51
- - Answer a frame `done` only on the write the mod reports, a row appended or a prompt the engine took; the writes are idempotent by Envoy event id (`writeOnce`).
52
-
53
- - An event that carries `agentId` is a subagent's, never the session's turn (`ofSubagent`).
54
-
55
- - `resolveModSocketPath` puts the socket under `XDG_RUNTIME_DIR` or Claude Code's configuration directory, never `TMPDIR`, within a 100-byte path.
56
-
57
- - The mod needs Claude Code 2.1.310 or newer; `--bare`, `--safe-mode` and settings that turn hooks or mods off leave a session with no messages.
58
-
59
- ## Legion panes
60
-
61
- - The phase reminder's machine is `@legion/pi-shared`'s; `src/legion-phase-hook.ts` only drives it from Claude Code's hooks.
38
+ - Every message into a terminal session goes through the mod's `session.message`.
62
39
 
63
- - Its hook entries are generated into `legion/hooks/hooks.json` (`LEGION_HOOKS` in `scripts/build.ts`), never `hooks/hooks.json`: a plain install has no `legion` server, so each would fail on every turn.
64
- Only `tests/legion-phase-hook-claude.test.ts`, on the real binary, proves Claude Code arms them.
40
+ - The Legion hook entries go in `legion/hooks/hooks.json` (`LEGION_HOOKS` in `scripts/build.ts`), never `hooks/hooks.json`:
41
+ a plain install has no `legion` server, so each would fail on every turn.
package/README.md CHANGED
@@ -86,7 +86,8 @@ message from Dispatch's Agents page as that person's own turn.
86
86
  or disconnected, comes again and is delivered once, for up to 72 hours. A
87
87
  `notifications.team.<name>` topic is stored and delivered like any other followed topic. The
88
88
  resume point is kept in `replay-<session id>.json` with the ledger below.
89
- `packages/envoy/AGENTS.md`, "Session consumers", states the rule.
89
+ `packages/envoy/docs/architecture.md`, "Runtime shape" (its "Session consumers" item), states
90
+ the listener's side.
90
91
  - Nothing is fetched back: a message published while the session was not running, restarting or
91
92
  disconnected (NATS restarting, the connection dropped) waits in that consumer and is delivered
92
93
  when the session returns, the same way as any other, with a line saying when it was published
@@ -350,7 +351,7 @@ reads, to `dispatch-writing-specs`, which the session loads by name.
350
351
  reviewer's pair, `thermonuclear-code-quality` and `thermonuclear-deep-review`, ships here too, so
351
352
  one copy of each rubric reaches both harnesses. The other root skills
352
353
  stay out of this plugin: they belong to Legion's roles (the architect, controller, oracle and retro
353
- skills, and the phase workers' `legion-worker` and `simplify-settled-diff`) (`skills/AGENTS.md`). A phase worker on Claude Code gets them from the
354
+ skills, and the phase workers' `legion-worker` and `simplify-settled-diff`; the partition is in `scripts/pi-plugin-prepack.sh` at the repository root). A phase worker on Claude Code gets them from the
354
355
  generated `legion/` plugin (below). Link another root skill here only when a standalone Claude
355
356
  Code session needs it.
356
357
 
@@ -376,7 +377,9 @@ Claude Code when `legion.yaml` sets `worker_backends: {<role>: claude}` (tmux ru
376
377
  error once Claude Code ended a step without taking it or exited; a relayed frame is `done` on
377
378
  that answer.
378
379
 
379
- `legion/` is generated by `scripts/build.ts` from Legion's worker skills and task agents; the
380
+ `legion/` is generated by `scripts/build.ts`: it copies the skills `@sjawhar/pi-legion` ships
381
+ (staged by `scripts/pi-plugin-prepack.sh --stage-skills @sjawhar/pi-legion`) and turns that
382
+ package's task agents (`packages/pi-legion/agents/`) into Claude Code's agent format. The
380
383
  release builds it with the bundle and packs it into the published package (below), and nobody
381
384
  edits it by hand. A standalone Claude Code session doesn't load it.
382
385
 
@@ -485,7 +488,9 @@ Nothing has to be enabled on the machine: the plugin carries a Claude Code mod (
485
488
  loaded by the `modules` key of `hooks/hooks.json`), and the mod and this server meet on a Unix
486
489
  socket of the session's own (`hooks/mod-protocol.ts`, `src/mod-link.ts`). Claude Code 2.1.310 or
487
490
  newer runs the mod; below that it never connects, and a terminal session advertises no delivery
488
- mode, so Dispatch refuses a message to it rather than reporting it delivered.
491
+ mode, so Dispatch refuses a message to it rather than reporting it delivered. The same holds for
492
+ a session started with `--bare` or `--safe-mode`, and one whose settings turn hooks or mods off
493
+ (`disableAllHooks`, or `allowManagedModsOnly` or `allowManagedHooksOnly` in managed settings).
489
494
 
490
495
  That socket is `claude-envoy/ce-<hash of the session id>.sock` under `XDG_RUNTIME_DIR`, and
491
496
  under Claude Code's own configuration directory — `CLAUDE_CONFIG_DIR`, else `$HOME/.claude` —
@@ -665,17 +670,23 @@ bash packages/claude-envoy/scripts/smoke-session-title.sh
665
670
  bun run --cwd packages/claude-envoy lint
666
671
  bun run --cwd packages/claude-envoy typecheck
667
672
  bun run --cwd packages/claude-envoy test
673
+ (cd packages/claude-envoy && bun test --timeout=60000 tests/mod.test.ts) # one file
668
674
  bun packages/claude-envoy/scripts/build.ts --out "$(mktemp -d)"
669
675
  ```
670
676
 
671
677
  `bun run --cwd packages/claude-envoy verify-build "$(mktemp -d)/built.tar"` builds the plugin
672
678
  twice and compares the two builds, which is what the release's build job runs; nothing in a
673
679
  checkout holds a built copy to compare against.
680
+ `bun packages/claude-envoy/scripts/build.ts --codex-out <dir>` builds the Codex plugin ("Codex
681
+ CLI" above).
682
+ The real-binary tests skip unless `LEGION_TEST_CLAUDE` names a Claude Code binary.
674
683
  `tests/answers-claude.test.ts` runs the real Claude Code, the release `.claude-code-pin` at the
675
684
  repository root pins, against a stand-in Messages endpoint and Dispatch: the list reaches the model
676
- at startup, on `--resume`, after `/compact` and in a subagent. It skips without `LEGION_TEST_CLAUDE`
677
- naming the binary, except on GitHub Actions, where `.github/actions/install-claude-code` installs
678
- the pin. Locally:
685
+ at startup, on `--resume`, after `/compact` and in a subagent. It skips without `LEGION_TEST_CLAUDE`,
686
+ except on GitHub Actions, where `.github/actions/install-claude-code` installs the pin.
687
+ `tests/envoy-channel-stall.test.ts` runs a real NATS server and Envoy listener, which it builds
688
+ with Go, so it runs only with `LEGION_E2E_ENVOY_STACK=1` and `go` on `PATH`.
689
+ Locally:
679
690
 
680
691
  ```bash
681
692
  mkdir -p "$TMPDIR/claude-code" && bun add --cwd "$TMPDIR/claude-code" --exact --no-save "@anthropic-ai/claude-code@$(<.claude-code-pin)"
@@ -58530,7 +58530,7 @@ var import_nats2 = __toESM(require_mod4(), 1);
58530
58530
 
58531
58531
  // package.json
58532
58532
  var name2 = "@sjawhar/claude-envoy";
58533
- var version2 = "4.14.3";
58533
+ var version2 = "4.14.4";
58534
58534
  var legion = {
58535
58535
  daemonApiVersion: 178
58536
58536
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sjawhar/claude-envoy",
3
- "version": "4.14.3",
3
+ "version": "4.14.4",
4
4
  "license": "Apache-2.0",
5
5
  "description": "Claude Code plugin for Legion's Envoy bus",
6
6
  "type": "module",