@sjawhar/opencode-legion-envoy 7.8.1 → 8.0.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/README.md +35 -9
- package/dist/dispatch.js +643 -225
- package/dist/src/server.js +836 -284
- package/package.json +1 -1
- package/skills/dispatch/references/api.md +16 -3
- package/skills/dispatch/references/issues.md +5 -1
- package/src/server.ts +226 -190
package/README.md
CHANGED
|
@@ -16,15 +16,41 @@ This package exposes the Envoy tools:
|
|
|
16
16
|
Agents reach Dispatch through the `dispatch` command in their shell: `dispatch --help` lists the
|
|
17
17
|
commands, `dispatch <command> --help` each one's flags, and the `dispatch` skill teaches them. The
|
|
18
18
|
plugin's `shell.env` hook puts its `bin/` (the `dispatch` shim, which runs the bundled
|
|
19
|
-
`dist/dispatch.js`) first on every shell command's `PATH`, sets `DISPATCH_HOST=opencode`,
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
`dispatch
|
|
19
|
+
`dist/dispatch.js`) first on every shell command's `PATH`, sets `DISPATCH_HOST=opencode`, hands on
|
|
20
|
+
the serve's envoy.json as `ENVOY_CONFIG_FILE`, and sets `DISPATCH_SESSION_ID` and
|
|
21
|
+
`DISPATCH_SESSION_TITLE` to the session running the command and the title the plugin tracks for it
|
|
22
|
+
(each empty when OpenCode names no session or the session has no title yet, so a value inherited
|
|
23
|
+
from a parent process never stands in).
|
|
24
|
+
|
|
25
|
+
The serve reads one envoy.json: `$OPENCODE_CONFIG_DIR/envoy.json` when `OPENCODE_CONFIG_DIR` is
|
|
26
|
+
set, else the file `ENVOY_CONFIG_FILE` names, else `${XDG_CONFIG_HOME:-~/.config}/legion/envoy.json`,
|
|
27
|
+
with the `dispatch` section of a `<repo>/.envoy/envoy.json` merged over it: its server only with the
|
|
28
|
+
token beside it, and its token only beside its own server. An `envoy` section in that checkout's
|
|
29
|
+
file is not read, which the logged notice says, and a checkout's file that is not valid refuses
|
|
30
|
+
Dispatch alone, only while `DISPATCH_URL` is unset. The chosen file's `dispatch` section
|
|
31
|
+
(`enabled`, `serverUrl`, `token`) and `envoy` section (`enabled`, `url`, `natsUrls`, `token`,
|
|
32
|
+
`natsSeed`) are resolved each on its own: `enabled: false` turns one off, a missing file
|
|
33
|
+
contributes nothing (each section is then on only when its variables name it), and a `token`
|
|
34
|
+
starting with `!` is a command whose trimmed output is the value. The serve opens no NATS
|
|
35
|
+
connection, so it resolves no `natsUrls` and never runs `natsSeed`. `DISPATCH_URL`,
|
|
36
|
+
`DISPATCH_TOKEN_FILE`, `DISPATCH_TOKEN`, `ENVOY_URL`, `ENVOY_TOKEN_FILE` and `ENVOY_TOKEN` each
|
|
37
|
+
override their own field; a file's token goes with a variable's server only when it is the file's
|
|
38
|
+
own. The `dispatch` command reads the file the `shell.env` hook hands it in `ENVOY_CONFIG_FILE`.
|
|
39
|
+
`dispatch.enabled: true` without `dispatch.serverUrl` targets `http://localhost:8766`. With
|
|
40
|
+
Dispatch on, every session also carries the `dispatch-first` skill as an instruction file; with
|
|
41
|
+
Envoy off, the plugin registers no Envoy tool and calls no listener. Why a section is off is logged
|
|
42
|
+
once (`envoy: no envoy.json at <path>: Dispatch and Envoy are off`, the section's error, or what a
|
|
43
|
+
checkout's files hold that is not read).
|
|
44
|
+
|
|
45
|
+
`~/.config/opencode/envoy.json` and a checkout's `.opencode/envoy.json` are not read. While the old
|
|
46
|
+
user file is there and the serve's file is missing, Dispatch and Envoy stay off unless a variable
|
|
47
|
+
names one, and the log says the old file is not read and what to do: for
|
|
48
|
+
`~/.config/legion/envoy.json`,
|
|
49
|
+
`mkdir -p ~/.config/legion && mv ~/.config/opencode/envoy.json ~/.config/legion/`; for
|
|
50
|
+
`$OPENCODE_CONFIG_DIR/envoy.json`, copy or link the old file to it, or write it; under a relocated
|
|
51
|
+
`XDG_CONFIG_HOME`, only that it is not read there. While a checkout has no `.envoy/envoy.json`, the
|
|
52
|
+
log and the `dispatch` command name the rename of its `.opencode/envoy.json`. A top-level
|
|
53
|
+
`natsUrls` is refused, naming `envoy.natsUrls`.
|
|
28
54
|
|
|
29
55
|
It also maintains the live session registry metadata needed for Envoy to discover OpenCode sessions and their API ports.
|
|
30
56
|
|