@sjawhar/pi-legion-envoy 0.14.0 → 0.15.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 CHANGED
@@ -77,28 +77,47 @@ and restores the committed file before tagging. Packing with the committed sourc
77
77
  manifest is refused by `scripts/prepack.sh`, because such a tarball would point OMP at
78
78
  extension files it does not contain.
79
79
 
80
- ## Dispatch
81
-
82
- Every OMP session — Legion sessions included — gets a native `dispatch` tool from this
83
- extension when `dispatch.enabled` is true in the shared envoy.json
84
- (`~/.config/opencode/envoy.json`, shallow-merged with `<cwd>/.opencode/envoy.json`) or
85
- `DISPATCH_MCP_URL` names a service endpoint explicitly. The service URL comes from
86
- `dispatch.serverUrl` (default `http://localhost:8766`). Dispatch is how any agent — an
87
- interactive session or a headless Legion role — raises a durable question to the human
88
- and keeps the conversation on one GitHub issue: `subject` opens a thread, `thread: N`
89
- continues one. Each call reads the session's id and title from OMP, resolves the cwd's
90
- GitHub repo, mints a GitHub token with `gh auth token` in the session cwd, and makes one
91
- stateless request to the dispatch service, which writes the issue or comment. The
92
- `dispatch` skill (shipped in `skills/`) says when and how to ask. Replies route back to the
93
- asking session, which is auto-subscribed to the thread's GitHub topic on every successful
94
- call; a Legion role's session survives kill/resume because Legion resurrection resumes the
95
- same OMP session file. Lifecycle and scope decisions go through `envoy_publish` to the owning
96
- architect's role topic — Dispatch is for durable questions to the human, not for coordination
97
- between roles.
98
-
99
- The tool's model-facing schema is the shared contract's zod shape
100
- (`@legion/envoy-client/dispatch-contract`) serialised to JSON Schema, so OMP shows the model
101
- the same arguments and descriptions as every other host.
102
-
103
- An invalid envoy.json disables the tool and the session is told why on start; a machine
104
- without dispatch configured has no `dispatch` tool at all.
80
+ ## Native Dispatch tools
81
+
82
+ The extension registers `dispatch_issue`, `dispatch_ask`, `dispatch_comment`,
83
+ `dispatch_suggest`, `dispatch_message`, `dispatch_doc_edit`,
84
+ `dispatch_doc_read`, `dispatch_artifact`, and `dispatch_read` when Dispatch
85
+ configuration resolves both a base URL and bearer token.
86
+
87
+ Configure the shared `envoy.json` with:
88
+
89
+ ```json
90
+ {
91
+ "dispatch": {
92
+ "enabled": true,
93
+ "serverUrl": "https://dispatch.example",
94
+ "token": "<agent-bearer-token>"
95
+ }
96
+ }
97
+ ```
98
+
99
+ The user file is `~/.config/opencode/envoy.json`; a
100
+ `<cwd>/.opencode/envoy.json` file shallow-merges over it. `DISPATCH_URL` and
101
+ `DISPATCH_TOKEN` override the file values for one process. Invalid configuration,
102
+ an invalid URL, or an empty token leaves the nine tools unavailable and reports
103
+ the source of the error.
104
+
105
+ Native tools operate on a Dispatch issue: a native `KEY` or an external
106
+ `owner/repo#n` reference. A Legion session may omit `issue` when
107
+ `LEGION_ISSUE` identifies its root issue and its working directory resolves to a
108
+ repository. `dispatch_doc_read` and `dispatch_read` also accept
109
+ `dispatch://` references.
110
+
111
+ Every mutation result carries `details.topic` as
112
+ `notifications.dispatch.issue.<KEY>.>`. The extension's `tool_result` hook
113
+ subscribes to that exact topic, then registers the session so retained issue
114
+ events arrive as Pi steering. `dispatch_doc_read` and `dispatch_read` return
115
+ issue details without a subscription topic.
116
+
117
+ The shared contract supplies the model-facing schemas and descriptions. The
118
+ `dispatch` skill describes when to use each operation for issues, asks, review
119
+ feedback, documents, artifacts, and status reads.
120
+
121
+ Lifecycle and scope decisions between Legion roles go through `envoy_publish` to the owning
122
+ architect's role topic; Dispatch is for durable questions to the human and the shared
123
+ document, not for coordination between roles.