@sjawhar/opencode-legion-envoy 0.42.0 → 0.44.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.
@@ -13628,6 +13628,11 @@ var ChildStatusEventPayloadSchema = object({
13628
13628
  from: string2().optional(),
13629
13629
  to: string2().optional()
13630
13630
  });
13631
+ var SubscriptionRemovedEventPayloadSchema = object({
13632
+ session_id: string2().optional(),
13633
+ by: object({ kind: string2(), id: string2().optional() }).passthrough().optional(),
13634
+ topics: array(string2()).optional()
13635
+ });
13631
13636
  // ../contracts/src/dispatch-snippet.ts
13632
13637
  var HTML_ENTITIES = [
13633
13638
  ["&lt;", "<"],
@@ -13685,15 +13690,17 @@ function dispatchToolSchema(spec, z, opts) {
13685
13690
  }
13686
13691
  var ISSUE_REFERENCE = "An issue is a native KEY or external owner/repo#n reference; an external reference creates its native issue in the repository's dashboard-configured project or, failing that, the default project (DISPATCH_DEFAULT_PROJECT).";
13687
13692
  var OWNER_REFERENCE = "Exactly one of issue and project is required. An issue is a native KEY or external owner/repo#n reference; a project is a project key such as CORE and addresses an unlinked project document named by artifact.";
13688
- function documentOwnerValidation(requireArtifact) {
13693
+ function documentOwnerValidation(requireArtifact, alwaysRequireArtifact = false) {
13689
13694
  return {
13690
13695
  check: (value) => {
13691
13696
  const input = value;
13692
13697
  const hasIssue = typeof input.issue === "string";
13693
13698
  const hasProject = typeof input.project === "string";
13694
- return (hasIssue !== hasProject || !hasIssue && !hasProject && typeof input.ref === "string") && (!hasProject || !requireArtifact || typeof input.artifact === "string");
13699
+ const hasArtifact = typeof input.artifact === "string";
13700
+ const hasRef = typeof input.ref === "string";
13701
+ return (hasIssue !== hasProject || !hasIssue && !hasProject && hasRef) && (!hasProject || !requireArtifact || hasArtifact) && (!alwaysRequireArtifact || hasArtifact || hasRef);
13695
13702
  },
13696
- message: "Exactly one of issue and project is required; with project, artifact names the document."
13703
+ message: alwaysRequireArtifact ? "Exactly one of issue and project is required; artifact or ref must name the document." : "Exactly one of issue and project is required; with project, artifact names the document."
13697
13704
  };
13698
13705
  }
13699
13706
  var SPEC_SECTIONS = [
@@ -13728,6 +13735,7 @@ var dispatchToolSpecs = [
13728
13735
  issue: z.string().describe(ISSUE_REFERENCE).optional(),
13729
13736
  project: z.string().describe("Project key owning the document.").optional(),
13730
13737
  artifact: z.string().describe("Project document slug or id.").optional(),
13738
+ ref: z.string().describe("Optional dispatch:// issue or document reference.").optional(),
13731
13739
  question: z.string({ max: 800 }).describe("Decision question, at most 800 characters."),
13732
13740
  options: z.array(z.object({
13733
13741
  label: z.string().describe("Selectable option label."),
@@ -13780,6 +13788,7 @@ var dispatchToolSpecs = [
13780
13788
  issue: z.string().describe(ISSUE_REFERENCE).optional(),
13781
13789
  project: z.string().describe("Project key owning the document.").optional(),
13782
13790
  artifact: z.string().describe("Artifact slug or id required when quote is given.").optional(),
13791
+ ref: z.string().describe("Optional dispatch:// issue or document reference.").optional(),
13783
13792
  quote: z.string().describe("Optional exact quoted document text.").optional(),
13784
13793
  occurrence: z.number({ int: true, min: 0 }).describe("Optional zero-based occurrence of quote.").optional(),
13785
13794
  body: z.string({ max: 2000 }).describe("Review comment, at most 2,000 characters."),
@@ -13794,13 +13803,14 @@ var dispatchToolSpecs = [
13794
13803
  arguments: (z) => ({
13795
13804
  issue: z.string().describe(ISSUE_REFERENCE).optional(),
13796
13805
  project: z.string().describe("Project key owning the document.").optional(),
13797
- artifact: z.string().describe("Artifact slug or id containing the quoted text."),
13806
+ artifact: z.string().describe("Artifact slug or id containing the quoted text; optional when ref names it.").optional(),
13807
+ ref: z.string().describe("Optional dispatch:// issue or document reference.").optional(),
13798
13808
  quote: z.string().describe("Exact document text to replace."),
13799
13809
  replace_with: z.string().describe("Replacement text."),
13800
13810
  body: z.string({ max: 2000 }).describe("Optional rationale, at most 2,000 characters.").optional(),
13801
13811
  occurrence: z.number({ int: true, min: 0 }).describe("Optional zero-based occurrence of quote.").optional()
13802
13812
  }),
13803
- validation: documentOwnerValidation(true)
13813
+ validation: documentOwnerValidation(true, true)
13804
13814
  },
13805
13815
  {
13806
13816
  name: "dispatch_message",
@@ -13817,7 +13827,8 @@ var dispatchToolSpecs = [
13817
13827
  arguments: (z) => ({
13818
13828
  issue: z.string().describe(ISSUE_REFERENCE).optional(),
13819
13829
  project: z.string().describe("Project key owning the document.").optional(),
13820
- artifact: z.string().describe("Artifact slug or id for the document."),
13830
+ artifact: z.string().describe("Artifact slug or id for the document; optional when ref names it.").optional(),
13831
+ ref: z.string().describe("Optional dispatch:// issue or document reference.").optional(),
13821
13832
  ops: z.array(z.object({
13822
13833
  op: z.enum(DOC_EDIT_OPS).describe("Edit operation."),
13823
13834
  find: z.string().describe("Text to find for replace or delete.").optional(),
@@ -13829,7 +13840,7 @@ var dispatchToolSpecs = [
13829
13840
  })).describe("Flat tagged edits; the server validates fields required for each operation."),
13830
13841
  summary: z.string().describe("Optional named-version summary.").optional()
13831
13842
  }),
13832
- validation: documentOwnerValidation(true)
13843
+ validation: documentOwnerValidation(true, true)
13833
13844
  },
13834
13845
  {
13835
13846
  name: "dispatch_doc_read",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sjawhar/opencode-legion-envoy",
3
- "version": "0.42.0",
3
+ "version": "0.44.0",
4
4
  "type": "module",
5
5
  "main": "dist/src/server.js",
6
6
  "exports": {
@@ -169,19 +169,22 @@ retrying. Pass `summary` to name the version when recording a decision.
169
169
  Add feedback with:
170
170
 
171
171
  ```ts
172
- dispatch_comment({ issue?, project?, artifact?, quote?, occurrence?, body, reply_to?, reply_to_ask? })
172
+ dispatch_comment({ issue?, project?, artifact?, ref?, quote?, occurrence?, body, reply_to?, reply_to_ask? })
173
173
  ```
174
174
 
175
- It returns issue or project-document owner details plus `comment` and, for writes, `topic`. `quote` requires `artifact`; omit both for a
176
- floating issue comment. A reply (`reply_to`/`reply_to_ask`) takes no `quote`; it belongs to its parent's anchor. Use `reply_to` to
177
- continue a comment thread at its root; a reply to a resolved thread reopens it. Use `reply_to_ask` to reply directly under a question
178
- asked with `dispatch_ask`. Comments are edited only by their author from the dashboard. A delivered `comment.created` event carries the
179
- comment `id`; reply to it with `dispatch_comment({ reply_to: <id> })`.
175
+ It returns issue or project-document owner details plus `comment` and, for writes, `topic`.
176
+ `ref` names the owner (an issue or project-document reference) in place of `issue`/`project`.
177
+ `quote` requires `artifact`; omit both for a floating issue comment. A reply (`reply_to`/`reply_to_ask`)
178
+ takes no `quote`; it belongs to its parent's anchor. Use `reply_to` to continue a comment thread at
179
+ its root; a reply to a resolved thread reopens it. Use `reply_to_ask` to reply directly under a
180
+ question asked with `dispatch_ask`. Comments are edited only by their author from the dashboard. A
181
+ delivered `comment.created` event carries the comment `id`; reply to it with
182
+ `dispatch_comment({ reply_to: <id> })`.
180
183
 
181
184
  Propose an exact replacement instead of describing it:
182
185
 
183
186
  ```ts
184
- dispatch_suggest({ issue?, project?, artifact, quote, replace_with, body?, occurrence? })
187
+ dispatch_suggest({ issue?, project?, artifact, ref?, quote, replace_with, body?, occurrence? })
185
188
  ```
186
189
 
187
190
  It returns issue or project-document owner details plus `comment` and its write `topic`. A human accepts or rejects a suggestion.
@@ -223,9 +226,11 @@ It returns `details` `{ issue, topic, message }`. `body` is capped at 2,000 char
223
226
 
224
227
  ## What comes back
225
228
 
226
- A write result's `details.topic` subscribes the host to its owner. Issue writes use `notifications.dispatch.issue.<KEY>.>`;
229
+ A write result's `details.topic` subscribes the host to its owner, and the first such subscription on an issue or document also tells
230
+ you so (an already-subscribed write stays quiet — no repeat notice). Issue writes use `notifications.dispatch.issue.<KEY>.>`;
227
231
  project-document writes use `notifications.dispatch.document.<PROJECT>.<SLUG>.>`. The owner topic carries every Dispatch event; `notify`
228
- only controls agent wake and routed delivery. After a restart, catch up with:
232
+ only controls agent wake and routed delivery. A human may unsubscribe you from the issue or document header; you are told with a
233
+ `subscription.removed` notice when that happens. After a restart, catch up with:
229
234
 
230
235
  ```ts
231
236
  dispatch_read({ issue?, project?, artifact?, ref? })
@@ -238,7 +243,12 @@ message ref, it returns that message and its reply chain. Reads do not subscribe
238
243
 
239
244
  ## References
240
245
 
241
- Use these in document, ask, comment, and message bodies; Dispatch unfurls them:
246
+ Use these in document, ask, comment, and message bodies. In the dashboard, a reference renders
247
+ as an inline link whose text is the target's title (an issue's title, an ask's question, a
248
+ comment's first line, a document's name) once it resolves; a body that is only a bare reference
249
+ still gets an unfurl card instead. Every `ref` argument below (and `issue`/`project`) accepts
250
+ either form — an issue key or a project key is never ambiguous, since a project key never
251
+ contains a dash:
242
252
 
243
253
  ```text
244
254
  dispatch://KEY