@sjawhar/pi-envoy 8.3.0 → 8.5.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
@@ -1,6 +1,6 @@
1
1
  # Pi Envoy Extension
2
2
 
3
- `@sjawhar/pi-envoy` is the Oh My Pi extension for Envoy messaging and the native Dispatch tools,
3
+ `@sjawhar/pi-envoy` is the Oh My Pi extension for Envoy messaging and the `dispatch` command,
4
4
  the plugin every session loads. It shares the Envoy HTTP client, tool contract, envelope parsing,
5
5
  and subject helpers with the other Legion adapters while keeping OMP's direct NATS subscriptions
6
6
  and Pi steering delivery local (inbound messages steer an in-flight turn instead of queueing behind
@@ -100,12 +100,15 @@ performs that manifest rewrite around `bun pm pack` and restores the committed f
100
100
  Packing with the committed source manifest is refused by the prepack, because such a tarball would
101
101
  point OMP at an extension file it does not contain.
102
102
 
103
- ## Native Dispatch tools
103
+ ## The `dispatch` command
104
104
 
105
- The extension registers twenty-one native Dispatch tools: `dispatch_issue`, `dispatch_issue_update`, `dispatch_claim`, `dispatch_ask`, `dispatch_edit_ask`,
106
- `dispatch_resolve_ask`, `dispatch_resolve_comment`, `dispatch_follow`, `dispatch_comment`, `dispatch_suggest`,
107
- `dispatch_message`, `dispatch_doc_edit`, `dispatch_doc_read`, `dispatch_request_approval`, `dispatch_artifact`,
108
- `dispatch_read`, `dispatch_search`, `dispatch_issues`, `dispatch_architecture_sync`, `dispatch_open_asks`, and `dispatch_whoami`, when Dispatch configuration resolves both a base URL and bearer token.
105
+ The extension registers no Dispatch tool. Agents reach Dispatch through the `dispatch` command in
106
+ their shell: `dispatch --help` lists its commands, `dispatch <command> --help` each one's flags and
107
+ an example, and the `dispatch` skill teaches when to use each. The package ships `bin/dispatch`, a
108
+ shim that runs the bundled `dist/dispatch.js` (built from `@legion/envoy-client`'s
109
+ `bin/dispatch.ts`) with `bun`. At load the extension puts that `bin/` first on `PATH` and sets
110
+ `DISPATCH_HOST=omp`; each session start, switch and branch sets `DISPATCH_SESSION_ID` to the
111
+ session's id, so a command acts as the session whose shell ran it.
109
112
 
110
113
  Configure the shared `envoy.json` with:
111
114
 
@@ -129,31 +132,35 @@ whose trimmed contents are the token — how the Legion daemon delivers it to a
129
132
  pane) wins over every other token source and never falls back when unreadable.
130
133
  Omitting `dispatch.serverUrl` while `dispatch.enabled` is true targets
131
134
  `http://localhost:8766`, the Go server's listen address. Invalid configuration,
132
- an invalid URL, or an empty token leaves the twenty-one tools unavailable and
133
- reports the source of the error.
134
-
135
- Owner-scoped calls use either an issue (a native `KEY` or external `owner/repo#n` reference) or
136
- an unlinked project document (`project` plus its `artifact` slug). A Legion session may omit
137
- `issue` when `LEGION_ISSUE` identifies its root issue and its working directory resolves to a
138
- repository. `dispatch_doc_read` and `dispatch_read` also accept `dispatch://` references,
139
- including `dispatch://PROJECT/artifact/<slug>`. `dispatch_search` needs only its query.
140
- `dispatch_edit_ask`, `dispatch_resolve_ask`, and `dispatch_follow` instead identify an existing
141
- ask with `ask`, and `dispatch_resolve_comment` a comment with `comment`. No result carries a subscription topic: opening an ask or replying to one with
142
- `dispatch_comment({ reply_to_ask })` makes the session a follower of that ask (its answer and
143
- replies reach the session directly, server-side), the result carries `details.follows.ask`, and
144
- the extension's `tool_result` hook tells the model so once per ask. Whole-issue or
145
- whole-document subscription is the model's own `envoy_subscribe` of the topic every write
146
- result names (`notifications.dispatch.issue.<KEY>.>` or
147
- `notifications.dispatch.document.<PROJECT>.<SLUG>.>`). `dispatch_doc_read` and
148
- `dispatch_read` return owner details only.
149
-
150
- The shared contract supplies the model-facing schemas and descriptions. The
151
- `dispatch` skill describes when to use each operation for issues, asks, review
152
- feedback, documents, artifacts, and status reads.
153
-
154
- `dispatch_artifact` accepts exactly one upload source: a local `path`, or inline `content`.
155
- For example, an architect can post a specification directly with
156
- `{ issue, name: "spec.md", content: "# Design" }`.
135
+ an invalid URL, or an empty token makes every `dispatch` command exit 2 naming the source of the
136
+ error, and the extension reports it when the session starts.
137
+
138
+ A command that writes to an owner names either an issue (`--issue`, a native `KEY` or an external
139
+ `owner/repo#n` reference) or an unlinked project document (`--project` plus `--artifact`). A Legion
140
+ session may omit `--issue`: `LEGION_ISSUE` names its issue, and a bare issue number there is read
141
+ against the GitHub repository of the working directory. `dispatch doc-read` and `dispatch read`
142
+ also accept `--ref` with a `dispatch://` reference, including `dispatch://PROJECT/artifact/<slug>`.
143
+ `dispatch search` needs only `--query`. `dispatch edit-ask`, `dispatch resolve-ask`, and
144
+ `dispatch follow` instead identify an existing ask with `--ask`, and `dispatch resolve-comment` a
145
+ comment with `--comment`. No result carries a subscription topic: opening an ask, or replying to
146
+ one with `dispatch comment --reply-to-ask`, makes the session a follower of that ask (its answer
147
+ and replies reach the session directly, server-side), and the command prints
148
+ `Following ask <id> on <owner>: …` after its result the first time the session follows that ask.
149
+ Whole-issue or whole-document subscription is the model's own `envoy_subscribe` of the topic every
150
+ write result names (`notifications.dispatch.issue.<KEY>.>` or
151
+ `notifications.dispatch.document.<PROJECT>.<SLUG>.>`).
152
+
153
+ The shared specs in `@legion/contracts` supply each command's description and flags:
154
+ `@legion/envoy-client`'s `dispatch-command.ts` derives one command per spec and one flag per field.
155
+
156
+ `dispatch artifact` takes exactly one upload source: a local `--path`, or inline `--content`. For
157
+ example, an architect can post a specification directly, its text on stdin:
158
+
159
+ ```sh
160
+ dispatch artifact --issue LEGION-1 --name spec.md --content-file - <<'EOF'
161
+ # Design
162
+ EOF
163
+ ```
157
164
 
158
165
  Lifecycle and scope decisions between Legion roles go through `envoy_publish` to the owning
159
166
  architect's role topic; Dispatch is for durable questions to the human and the shared
package/bin/dispatch ADDED
@@ -0,0 +1,6 @@
1
+ #!/bin/sh
2
+ # The dispatch CLI, bundled into this plugin's dist/ by its build.
3
+ here=$(cd "$(dirname "$0")" && pwd)
4
+ cli="$here/../dist/dispatch.js"
5
+ [ -f "$cli" ] || { echo "dispatch: $cli is missing; build the plugin (bun run build)" >&2; exit 2; }
6
+ exec bun "$cli" "$@"