@sjawhar/opencode-legion-envoy 1.6.1 → 1.7.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.
@@ -13565,6 +13565,7 @@ var DispatchEventSchema = object({
13565
13565
  });
13566
13566
  var IssueEventPayloadSchema = object({
13567
13567
  title: string2().optional(),
13568
+ labels: array(string2()).optional(),
13568
13569
  status: string2().optional(),
13569
13570
  rank: string2().optional(),
13570
13571
  route: string2().nullish()
@@ -13740,7 +13741,8 @@ var dispatchToolSpecs = [
13740
13741
  parent: z.string().describe("Optional parent issue.").optional(),
13741
13742
  external: z.string().describe("Optional external issue reference.").optional(),
13742
13743
  force: z.boolean().describe("Create even though POSSIBLE_DUPLICATE listed similar issues; pass it only after reading them.").optional(),
13743
- spec: z.string().describe(`Optional initial primary-document markdown. ${SPEC_WRITING_GUIDANCE}`).optional()
13744
+ spec: z.string().describe(`Optional initial primary-document markdown. ${SPEC_WRITING_GUIDANCE}`).optional(),
13745
+ labels: z.array(z.string({ min: 1, max: 40 }), { max: 20 }).describe("Optional initial labels, at most 20 labels of up to 40 characters.").optional()
13744
13746
  })
13745
13747
  },
13746
13748
  {
@@ -13749,7 +13751,7 @@ var dispatchToolSpecs = [
13749
13751
  arguments: (z) => ({
13750
13752
  issue: z.string().describe(ISSUE_REFERENCE).optional(),
13751
13753
  project: z.string().describe("Project key owning the document.").optional(),
13752
- artifact: z.string().describe("Project document slug or id.").optional(),
13754
+ artifact: z.string().describe("Project document artifact id, slug, or filename.").optional(),
13753
13755
  ref: z.string().describe("Optional dispatch:// issue or document reference.").optional(),
13754
13756
  question: z.string({ max: 800 }).describe("Decision question, at most 800 characters."),
13755
13757
  options: z.array(z.object({
@@ -13802,7 +13804,7 @@ var dispatchToolSpecs = [
13802
13804
  arguments: (z) => ({
13803
13805
  issue: z.string().describe(ISSUE_REFERENCE).optional(),
13804
13806
  project: z.string().describe("Project key owning the document.").optional(),
13805
- artifact: z.string().describe("Artifact slug or id required when quote is given.").optional(),
13807
+ artifact: z.string().describe("Project document artifact id, slug, or filename required when quote is given.").optional(),
13806
13808
  ref: z.string().describe("Optional dispatch:// issue or document reference.").optional(),
13807
13809
  quote: z.string().describe("Optional exact quoted document text.").optional(),
13808
13810
  occurrence: z.number({ int: true, min: 0 }).describe("Optional zero-based occurrence of quote.").optional(),
@@ -13818,7 +13820,7 @@ var dispatchToolSpecs = [
13818
13820
  arguments: (z) => ({
13819
13821
  issue: z.string().describe(ISSUE_REFERENCE).optional(),
13820
13822
  project: z.string().describe("Project key owning the document.").optional(),
13821
- artifact: z.string().describe("Artifact slug or id containing the quoted text; optional when ref names it.").optional(),
13823
+ artifact: z.string().describe("Project document artifact id, slug, or filename containing the quoted text; optional when ref names it.").optional(),
13822
13824
  ref: z.string().describe("Optional dispatch:// issue or document reference.").optional(),
13823
13825
  quote: z.string().describe("Exact document text to replace."),
13824
13826
  replace_with: z.string().describe("Replacement text."),
@@ -13842,7 +13844,7 @@ var dispatchToolSpecs = [
13842
13844
  arguments: (z) => ({
13843
13845
  issue: z.string().describe(ISSUE_REFERENCE).optional(),
13844
13846
  project: z.string().describe("Project key owning the document.").optional(),
13845
- artifact: z.string().describe("Artifact slug or id for the document; optional when ref names it.").optional(),
13847
+ artifact: z.string().describe("Project document artifact id, slug, or filename; optional when ref names it.").optional(),
13846
13848
  ref: z.string().describe("Optional dispatch:// issue or document reference.").optional(),
13847
13849
  ops: z.array(z.object({
13848
13850
  op: z.enum(DOC_EDIT_OPS).describe("Edit operation."),
@@ -13863,7 +13865,7 @@ var dispatchToolSpecs = [
13863
13865
  arguments: (z) => ({
13864
13866
  issue: z.string().describe(ISSUE_REFERENCE).optional(),
13865
13867
  project: z.string().describe("Project key owning the document.").optional(),
13866
- artifact: z.string().describe("Optional artifact slug or id; primary document by default for an issue.").optional(),
13868
+ artifact: z.string().describe("Optional project document artifact id, slug, or filename; primary document by default for an issue.").optional(),
13867
13869
  version: z.number({ int: true, min: 1 }).describe("Optional version number.").optional(),
13868
13870
  ref: z.string().describe("Optional dispatch:// document reference.").optional()
13869
13871
  }),
@@ -13875,7 +13877,7 @@ var dispatchToolSpecs = [
13875
13877
  arguments: (z) => ({
13876
13878
  issue: z.string().describe(ISSUE_REFERENCE).optional(),
13877
13879
  project: z.string().describe("Project key owning the document.").optional(),
13878
- artifact: z.string().describe("Artifact slug or id; primary document by default for an issue.").optional()
13880
+ artifact: z.string().describe("Project document artifact id, slug, or filename; primary document by default for an issue.").optional()
13879
13881
  }),
13880
13882
  validation: documentOwnerValidation(true)
13881
13883
  },
@@ -13904,7 +13906,7 @@ var dispatchToolSpecs = [
13904
13906
  arguments: (z) => ({
13905
13907
  issue: z.string().describe(ISSUE_REFERENCE).optional(),
13906
13908
  project: z.string().describe("Project key owning the document.").optional(),
13907
- artifact: z.string().describe("Project document slug or id.").optional(),
13909
+ artifact: z.string().describe("Project document artifact id, slug, or filename.").optional(),
13908
13910
  ref: z.string().describe("Optional dispatch:// issue or document reference.").optional()
13909
13911
  }),
13910
13912
  validation: documentOwnerValidation(true)
@@ -15014,7 +15016,7 @@ async function resolveOwnerArguments(tool, args, cwd, env, exec) {
15014
15016
  return { args, ref: null, owner: null };
15015
15017
  const refArgument = args.ref;
15016
15018
  const ref = typeof refArgument === "string" ? parseDispatchRef(refArgument) ?? (() => {
15017
- throw new Error("ref must be a valid dispatch:// reference such as dispatch://KEY-1, " + "dispatch://KEY-1/ask/<uuid>, dispatch://KEY-1/comment/<uuid>, " + "dispatch://KEY-1/message/<uuid>, dispatch://KEY-1/artifact/<slug>, or " + "dispatch://PROJECT/artifact/<slug>");
15019
+ throw new Error("ref must be a valid dispatch:// reference such as dispatch://KEY-1, " + "dispatch://KEY-1/ask/<uuid>, dispatch://KEY-1/comment/<uuid>, " + "dispatch://KEY-1/message/<uuid>, dispatch://KEY-1/artifact/<slug>, or " + "dispatch://PROJECT/artifact/<document-ref> (an artifact id, slug, or filename)");
15018
15020
  })() : null;
15019
15021
  const issueArgument = args.issue;
15020
15022
  const projectArgument = args.project;
@@ -15095,14 +15097,16 @@ async function resolveArtifact(client, owner, artifactReference) {
15095
15097
  if (!(error instanceof DispatchServiceError) || error.status !== 404)
15096
15098
  throw error;
15097
15099
  const artifacts = await client.listProjectArtifacts(owner.project, true);
15098
- const matches = artifacts.filter((candidate) => candidate.name === artifactReference);
15099
- if (matches.length > 1) {
15100
- throw new Error(`artifact name ${artifactReference} is ambiguous in project ${owner.project}; ` + `${matches.length} documents share it \u2014 use its slug instead`);
15101
- }
15102
- const artifact = matches[0];
15103
- if (!artifact)
15100
+ const artifact = artifacts.find((candidate) => candidate.id === artifactReference) ?? artifacts.find((candidate) => candidate.slug === artifactReference);
15101
+ if (artifact)
15102
+ return { owner, artifact };
15103
+ const names = artifacts.filter((candidate) => candidate.name === artifactReference);
15104
+ if (names.length > 1) {
15105
+ throw new Error(`artifact name ${artifactReference} is ambiguous in project ${owner.project}; ` + `${names.length} documents share it \u2014 use its slug instead`);
15106
+ }
15107
+ if (names[0] === undefined)
15104
15108
  throw error;
15105
- return { owner, artifact };
15109
+ return { owner, artifact: names[0] };
15106
15110
  }
15107
15111
  }
15108
15112
  const issue = await client.getIssue(owner.issue);
@@ -15153,6 +15157,7 @@ function issueSummary(issue, events, references) {
15153
15157
  `Title: ${issue.title}`,
15154
15158
  `Key: ${issue.key}`,
15155
15159
  `Status: ${issue.status}`,
15160
+ `Labels: ${issue.labels.length === 0 ? "none" : issue.labels.join(", ")}`,
15156
15161
  `Route: ${issue.route ?? "none"}`,
15157
15162
  ...specApproval === undefined ? [] : [`Spec ${specApproval.replace(/^Approval/, "approval")}`],
15158
15163
  "Open asks:",
@@ -15285,6 +15290,7 @@ async function executeDispatchTool(input) {
15285
15290
  const external = optionalString(args, "external");
15286
15291
  const force = optionalBoolean(args, "force");
15287
15292
  const spec = optionalString(args, "spec");
15293
+ const labels = args.labels;
15288
15294
  try {
15289
15295
  const created = await client.issue({
15290
15296
  project,
@@ -15293,6 +15299,7 @@ async function executeDispatchTool(input) {
15293
15299
  ...external === undefined ? {} : { external },
15294
15300
  ...force === undefined ? {} : { force },
15295
15301
  ...spec === undefined ? {} : { spec },
15302
+ ...Array.isArray(labels) ? { labels } : {},
15296
15303
  actor
15297
15304
  });
15298
15305
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sjawhar/opencode-legion-envoy",
3
- "version": "1.6.1",
3
+ "version": "1.7.0",
4
4
  "type": "module",
5
5
  "main": "dist/src/server.js",
6
6
  "exports": {
@@ -76,10 +76,11 @@ Issue reads include `rank`, the server-owned ordering key used by project boards
76
76
 
77
77
  Architects create newly tracked child work with:
78
78
  ```ts
79
- dispatch_issue({ project, title, parent?, external?, spec?, force? })
79
+ dispatch_issue({ project, title, parent?, external?, spec?, force?, labels?: string[] })
80
80
  ```
81
- It returns `details` `{ issue, topic }`. Use `dispatch_issue` only to create an issue; never use it to park a question. When `spec` is
82
- supplied, follow [Writing a spec](#writing-a-spec).
81
+ `labels` are optional initial labels: Dispatch trims them, preserves their case, and removes case-insensitive duplicates. It returns
82
+ `details` `{ issue, topic }`. Use `dispatch_issue` only to create an issue; never use it to park a question. When `spec` is supplied,
83
+ follow [Writing a spec](#writing-a-spec).
83
84
 
84
85
  ## Search first
85
86
 
@@ -188,7 +189,7 @@ Read the current document before changing it:
188
189
  dispatch_doc_read({ issue?, project?, artifact?, version?, ref? })
189
190
  ```
190
191
  It returns live or versioned markdown with open marks. `issue` with an omitted `artifact` reads the issue specification; a project needs
191
- `artifact`; and a `dispatch://PROJECT/artifact/<slug>` ref supplies both. Then write with:
192
+ `artifact`; and a `dispatch://PROJECT/artifact/<document-ref>` ref supplies both, where `document-ref` is the id, slug, or filename.
192
193
 
193
194
  ```ts
194
195
  dispatch_doc_edit({ issue?, project?, artifact, ops, summary? })
@@ -266,7 +267,8 @@ Exactly one of `issue` and `project` is required. A project upload creates an un
266
267
  Exactly one of `path` and `content` is required. It returns issue or project-document owner details plus `artifact`, `version`, and its
267
268
  write `topic`. Uploading the same `name` creates its next version — so uploading `spec.md` **replaces the issue's own specification**
268
269
  with your text. Never do that: the spec is edited in place with `dispatch_doc_edit` (see [The Spec](#the-spec)). Address an existing
269
- artifact by the slug shown in the upload result or by its filename; the slug also arrives on `artifact.created` events.
270
+ artifact by the slug shown in the upload result or by its filename, and a project document by its artifact id, slug, or filename; the
271
+ slug also arrives on `artifact.created` events.
270
272
 
271
273
  ## Messages
272
274
 
@@ -315,9 +317,9 @@ dispatch://KEY/artifact/<slug>[@vN]
315
317
  dispatch://KEY/ask/<id>
316
318
  dispatch://KEY/comment/<id>
317
319
  dispatch://KEY/message/<id>
318
- dispatch://PROJECT/artifact/<slug>[@vN]
319
- dispatch://PROJECT/artifact/<slug>/ask/<id>
320
- dispatch://PROJECT/artifact/<slug>/comment/<id>
320
+ dispatch://PROJECT/artifact/<document-ref>[@vN]
321
+ dispatch://PROJECT/artifact/<document-ref>/ask/<id>
322
+ dispatch://PROJECT/artifact/<document-ref>/comment/<id>
321
323
  ```
322
324
 
323
325
  A bare UUID or `KEY#seq` is not a reference; the `dispatch://` form is what Dispatch links and records.