@sjawhar/pi-legion-envoy 1.4.3 → 1.6.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
@@ -103,14 +103,17 @@ Configure the shared `envoy.json` with:
103
103
  ```
104
104
 
105
105
  The user file is `~/.config/opencode/envoy.json`; a
106
- `<cwd>/.opencode/envoy.json` file shallow-merges over it. `DISPATCH_URL` and
107
- `DISPATCH_TOKEN` override the file values for one process; `DISPATCH_TOKEN_FILE`
108
- (a path whose trimmed contents are the token — how the Legion daemon delivers it
109
- to a pane) wins over both and never falls back when unreadable. Omitting
110
- `dispatch.serverUrl` while `dispatch.enabled` is true targets
106
+ `<cwd>/.opencode/envoy.json` file shallow-merges over it. A repository
107
+ `dispatch.serverUrl` requires `dispatch.token` in that same repository file:
108
+ it never combines with a user-file or process-environment credential. To
109
+ override a repository endpoint for one process, set `DISPATCH_URL` together
110
+ with `DISPATCH_TOKEN` or `DISPATCH_TOKEN_FILE`. `DISPATCH_TOKEN_FILE` (a path
111
+ whose trimmed contents are the token — how the Legion daemon delivers it to a
112
+ pane) wins over every other token source and never falls back when unreadable.
113
+ Omitting `dispatch.serverUrl` while `dispatch.enabled` is true targets
111
114
  `http://localhost:8766`, the Go server's listen address. Invalid configuration,
112
- an invalid URL, or an empty token leaves the twelve tools unavailable and reports
113
- the source of the error.
115
+ an invalid URL, or an empty token leaves the twelve tools unavailable and
116
+ reports the source of the error.
114
117
 
115
118
  Owner-scoped calls use either an issue (a native `KEY` or external `owner/repo#n` reference) or
116
119
  an unlinked project document (`project` plus its `artifact` slug). A Legion session may omit
package/dist/envoy.js CHANGED
@@ -29663,6 +29663,7 @@ var DispatchEventSchema = object({
29663
29663
  var IssueEventPayloadSchema = object({
29664
29664
  title: string2().optional(),
29665
29665
  status: string2().optional(),
29666
+ rank: string2().optional(),
29666
29667
  route: string2().nullish()
29667
29668
  });
29668
29669
  var ArtifactCreatedEventPayloadSchema = object({
@@ -31300,10 +31301,25 @@ function resolveDispatchConfig(env, options = {}) {
31300
31301
  return { enabled: false, url: null, token: null, error: file.reason };
31301
31302
  }
31302
31303
  }
31303
- const merged = {
31304
- ...userFile.kind === "valid" ? userFile.settings : null,
31305
- ...repoFile.kind === "valid" ? repoFile.settings : null
31306
- };
31304
+ const userSettings = userFile.kind === "valid" ? userFile.settings : null;
31305
+ const repoSettings = repoFile.kind === "valid" ? repoFile.settings : null;
31306
+ const merged = { ...userSettings, ...repoSettings };
31307
+ const repoURL = repoSettings?.serverUrl;
31308
+ if (explicitUrl === undefined && merged.enabled === true && repoURL !== undefined) {
31309
+ const token = repoSettings?.token ?? null;
31310
+ if (!token) {
31311
+ return {
31312
+ enabled: false,
31313
+ url: null,
31314
+ token: null,
31315
+ error: "repository dispatch.serverUrl requires dispatch.token from the same .opencode/envoy.json or DISPATCH_URL with DISPATCH_TOKEN"
31316
+ };
31317
+ }
31318
+ const url2 = parsedDispatchUrl(repoURL, "repository dispatch.serverUrl");
31319
+ if (url2.error !== null)
31320
+ return { enabled: false, url: null, token: null, error: url2.error };
31321
+ return { enabled: true, url: url2.url, token, error: null };
31322
+ }
31307
31323
  const rawUrl = explicitUrl !== undefined ? { value: explicitUrl, source: "DISPATCH_URL" } : merged.enabled === true ? { value: merged.serverUrl ?? DEFAULT_SERVER_URL, source: "dispatch.serverUrl" } : null;
31308
31324
  const url2 = rawUrl ? parsedDispatchUrl(rawUrl.value, rawUrl.source) : { url: null, error: null };
31309
31325
  let token;
package/dist/legion.js CHANGED
@@ -29662,6 +29662,7 @@ var DispatchEventSchema = object({
29662
29662
  var IssueEventPayloadSchema = object({
29663
29663
  title: string2().optional(),
29664
29664
  status: string2().optional(),
29665
+ rank: string2().optional(),
29665
29666
  route: string2().nullish()
29666
29667
  });
29667
29668
  var ArtifactCreatedEventPayloadSchema = object({
@@ -31726,10 +31727,25 @@ function resolveDispatchConfig(env, options = {}) {
31726
31727
  return { enabled: false, url: null, token: null, error: file.reason };
31727
31728
  }
31728
31729
  }
31729
- const merged = {
31730
- ...userFile.kind === "valid" ? userFile.settings : null,
31731
- ...repoFile.kind === "valid" ? repoFile.settings : null
31732
- };
31730
+ const userSettings = userFile.kind === "valid" ? userFile.settings : null;
31731
+ const repoSettings = repoFile.kind === "valid" ? repoFile.settings : null;
31732
+ const merged = { ...userSettings, ...repoSettings };
31733
+ const repoURL = repoSettings?.serverUrl;
31734
+ if (explicitUrl === undefined && merged.enabled === true && repoURL !== undefined) {
31735
+ const token = repoSettings?.token ?? null;
31736
+ if (!token) {
31737
+ return {
31738
+ enabled: false,
31739
+ url: null,
31740
+ token: null,
31741
+ error: "repository dispatch.serverUrl requires dispatch.token from the same .opencode/envoy.json or DISPATCH_URL with DISPATCH_TOKEN"
31742
+ };
31743
+ }
31744
+ const url2 = parsedDispatchUrl(repoURL, "repository dispatch.serverUrl");
31745
+ if (url2.error !== null)
31746
+ return { enabled: false, url: null, token: null, error: url2.error };
31747
+ return { enabled: true, url: url2.url, token, error: null };
31748
+ }
31733
31749
  const rawUrl = explicitUrl !== undefined ? { value: explicitUrl, source: "DISPATCH_URL" } : merged.enabled === true ? { value: merged.serverUrl ?? DEFAULT_SERVER_URL, source: "dispatch.serverUrl" } : null;
31734
31750
  const url2 = rawUrl ? parsedDispatchUrl(rawUrl.value, rawUrl.source) : { url: null, error: null };
31735
31751
  let token;
@@ -29,6 +29,13 @@ vocabulary, and is often on a phone. Write for that person.
29
29
  - Before posting, test it: could Sami, reading only this text on his phone, know what he is being
30
30
  told or asked? If not, rewrite it. Length is not the problem; density is.
31
31
 
32
+ ## Agent authentication
33
+
34
+ Use a personal Dispatch token: a human mints it in Dispatch **Settings → Agent tokens** and supplies
35
+ it to the agent through `dispatch.token` in `~/.config/opencode/envoy.json` or `DISPATCH_TOKEN`.
36
+ The server records the minting human as the owner of that session's writes. `DISPATCH_AGENT_TOKEN`
37
+ is the shared devbox fallback; do not configure it for an individual agent.
38
+
32
39
  ## Writing a spec
33
40
 
34
41
  A spec has two readers: the human who decides reads the top; the implementer who builds reads the
@@ -65,6 +72,8 @@ exactly one owner to every owner-scoped tool: `issue` for an issue, or `project`
65
72
  [References](#references) for the resulting ref shape). On first use, an external issue reference creates its native issue in the
66
73
  project configured for that repository in Dispatch Settings, then falls back to `DISPATCH_DEFAULT_PROJECT`.
67
74
 
75
+ Issue reads include `rank`, the server-owned ordering key used by project boards; reorder through `PATCH /api/v1/issues/{key}` with neighboring issue keys rather than writing a priority value.
76
+
68
77
  Architects create newly tracked child work with:
69
78
  ```ts
70
79
  dispatch_issue({ project, title, parent?, external?, spec?, force? })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sjawhar/pi-legion-envoy",
3
- "version": "1.4.3",
3
+ "version": "1.6.0",
4
4
  "type": "module",
5
5
  "omp": {
6
6
  "extensions": [