@sjawhar/claude-envoy 4.14.3 → 4.14.5
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/.claude-plugin/plugin.json +1 -1
- package/.omp-plugin/plugin.json +1 -1
- package/AGENTS.md +19 -42
- package/README.md +18 -7
- package/dist/envoy-channel.js +2 -2
- package/package.json +1 -1
package/.omp-plugin/plugin.json
CHANGED
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
|
-
##
|
|
7
|
+
## Components
|
|
10
8
|
|
|
11
|
-
-
|
|
9
|
+
- `src/envoy-channel-server.ts`: the MCP stdio server, the session's Envoy ingress, which serves the `envoy_*` tools.
|
|
12
10
|
|
|
13
|
-
- `
|
|
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
|
-
-
|
|
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
|
-
|
|
15
|
+
- `src/legion-*.ts`: the Legion phase worker, which the server runs in a pane `legion claude-bridge` launched.
|
|
19
16
|
|
|
20
|
-
-
|
|
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
|
-
|
|
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
|
-
-
|
|
21
|
+
- Nothing commits `dist/` or `legion/`; the release builds them.
|
|
31
22
|
|
|
32
|
-
|
|
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`)
|
|
25
|
+
- Render inbound messages only through `renderInbound` (`@legion/envoy-client/delivery`).
|
|
35
26
|
|
|
36
|
-
- Subscribe the relay subject
|
|
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
|
-
|
|
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
|
-
-
|
|
64
|
-
|
|
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/
|
|
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
|
|
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
|
|
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
|
-
|
|
678
|
-
|
|
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)"
|
package/dist/envoy-channel.js
CHANGED
|
@@ -57145,7 +57145,7 @@ var SESSION_STATE_GUIDE = "A session is live, unresponsive or gone, by how long
|
|
|
57145
57145
|
var DELIVERY_CONTRACT = "Delivery is at-least-once, possibly out of order across topics; use id for dedupe and at for freshness.";
|
|
57146
57146
|
var PUBLISH_COUNTS = "The answer counts who gets it: recipients is every session other than you that the message " + `goes to, one that is stopped and gets it when it runs again within ${DELIVERY_DUPLICATE_WINDOW_HOURS} hours included, and ` + "recipients_connected is how many of those are running now. A listener that counts neither " + "sends neither, and a role topic names its holder instead.";
|
|
57147
57147
|
var STORED_DELIVERY = "Every notification topic is stored (agent, dispatch, github, slack, legion, ghostwispr, " + "whatsapp, team; a role message reaches its holder as a stored copy on the holder's agent " + "topic), and reaches each subscribed session once from the durable consumer its listener " + "relays to it, also one that was away or restarted. A 200 means the stream stored the message " + "for each subscribed session's consumer, not that any recipient has read it.";
|
|
57148
|
-
var TOPIC_GUIDE = "Topic guide (all are under notifications.): agent.<session_id> (subscribe: own inbox); role.<role> " + "(publish-to; holders claim via envoy_role_set). > matches one or more trailing tokens and does not " + "match the base subject. Envoy registers the concrete base when you subscribe to <subject>.>, so " + "the recommended default remains github.<owner>.<repo>.pr.<n>.>. <owner> and <repo> are one token " + "each, with every dot in the name written _ (sjawhar/.github is github.sjawhar._github; " + "acme/site.io is github.acme.site_io), and a topic spelled with the dot receives nothing. " + "Default PR subscription: " + "github.<owner>.<repo>.pr.<n>.> (it receives the quiet PR family): pr.<n> (lifecycle: " + "opened/synchronize/closed; closed carries merged, merge_commit_sha, merged_by, head_sha), " + "pr.<n>.comment, pr.<n>.review, pr.<n>.mention, pr.<n>.checks (one settlement event per commit whose checks settle, the head or not, naming its sha: " + "passed/failed/cancelled/skipped check runs with failing names and URLs, and statuses, each commit status as " + "{context, state, created_at} with state success, failure or error and created_at the time GitHub created it, " + "left out when none is recorded; for each context keep the entry with the later created_at, and keep a context " + 'that a settlement leaves out as it was; re-fires with superseded_settlement: "true" ' + "when new runs appear, or a commit status is new or changes state, for the same commit). Other GitHub: issue.<n>, issue.<n>.comment, " + "issue.<n>.mention, mention, push.branch.<name>, push.tag.<name>, workflow.<file>.<action> (only " + "runs without an associated PR); slack.<team>.<channel>.message|mention and " + "slack.<team>.<channel>.thread.<ts>.message|mention; ghostwispr.<session>.<kind>; " + "whatsapp.<phone>.<jid>.<kind>; envoy.exceptions.<original-topic>.";
|
|
57148
|
+
var TOPIC_GUIDE = "Topic guide (all are under notifications.): agent.<session_id> (subscribe: own inbox); role.<role> " + "(publish-to; holders claim via envoy_role_set). > matches one or more trailing tokens and does not " + "match the base subject. Envoy registers the concrete base when you subscribe to <subject>.>, so " + "the recommended default remains github.<owner>.<repo>.pr.<n>.>. <owner> and <repo> are one token " + "each, with every dot in the name written _ (sjawhar/.github is github.sjawhar._github; " + "acme/site.io is github.acme.site_io), and a topic spelled with the dot receives nothing. " + "Default PR subscription: " + "github.<owner>.<repo>.pr.<n>.> (it receives the quiet PR family): pr.<n> (lifecycle: " + "opened/synchronize/closed; closed carries merged, merge_commit_sha, merged_by, head_sha), " + "pr.<n>.comment, pr.<n>.review, pr.<n>.mention, pr.<n>.checks (one settlement event per commit whose checks settle, the head or not, naming its sha: " + "passed/failed/cancelled/skipped check runs with failing names and URLs, check_runs, each check's latest run as " + "{name, id, conclusion} with conclusion GitHub's own word for that run where one is recorded (for example " + "success, skipped, neutral or timed_out; a skipped check ran nothing on that commit), and statuses, each commit status as " + "{context, state, created_at} with state success, failure or error and created_at the time GitHub created it, " + "left out when none is recorded; for each context keep the entry with the later created_at, and keep a context " + 'that a settlement leaves out as it was; re-fires with superseded_settlement: "true" ' + "when new runs appear, or a commit status is new or changes state, for the same commit). Other GitHub: issue.<n>, issue.<n>.comment, " + "issue.<n>.mention, mention, push.branch.<name>, push.tag.<name>, workflow.<file>.<action> (only " + "runs without an associated PR); slack.<team>.<channel>.message|mention and " + "slack.<team>.<channel>.thread.<ts>.message|mention; ghostwispr.<session>.<kind>; " + "whatsapp.<phone>.<jid>.<kind>; envoy.exceptions.<original-topic>.";
|
|
57149
57149
|
var URGENCY_VALUES = EnvelopeSchema.shape.urgency.unwrap().options;
|
|
57150
57150
|
function messageMetadataShape(schema) {
|
|
57151
57151
|
return {
|
|
@@ -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.
|
|
58533
|
+
var version2 = "4.14.5";
|
|
58534
58534
|
var legion = {
|
|
58535
58535
|
daemonApiVersion: 178
|
|
58536
58536
|
};
|