@sjawhar/opencode-legion-envoy 0.20.0 → 0.20.1
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/dist/src/server.js +156 -117
- package/package.json +1 -1
package/dist/src/server.js
CHANGED
|
@@ -19,122 +19,6 @@ import { existsSync } from "fs";
|
|
|
19
19
|
import path3 from "path";
|
|
20
20
|
import { fileURLToPath } from "url";
|
|
21
21
|
|
|
22
|
-
// ../contracts/src/dispatch-tools.ts
|
|
23
|
-
var ISSUE_REFERENCE = "An issue is a native KEY or external owner/repo#n reference; an external reference creates its native issue on first use in the repository's mapped project (DISPATCH_REPO_PROJECTS) or, failing that, the default project (DISPATCH_DEFAULT_PROJECT).";
|
|
24
|
-
var ASK_URGENCIES = ["low", "med", "high", "blocking"];
|
|
25
|
-
var DOC_EDIT_OPS = ["replace", "delete", "insert"];
|
|
26
|
-
var dispatchToolSpecs = [
|
|
27
|
-
{
|
|
28
|
-
name: "dispatch_issue",
|
|
29
|
-
description: "Create a native Dispatch issue for newly tracked work. Do not use it when an existing issue " + `already covers the work; read or update that issue instead. ${ISSUE_REFERENCE}`,
|
|
30
|
-
arguments: (z) => ({
|
|
31
|
-
project: z.string().describe("Project key for the new issue."),
|
|
32
|
-
title: z.string().describe("Concise issue title."),
|
|
33
|
-
parent: z.string().describe("Optional parent issue.").optional(),
|
|
34
|
-
external: z.string().describe("Optional external issue reference.").optional(),
|
|
35
|
-
spec: z.string().describe("Optional initial primary-document markdown.").optional()
|
|
36
|
-
})
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
name: "dispatch_ask",
|
|
40
|
-
description: "Open a durable, answerable decision on an issue. Do not use it for a status update or discussion; " + `use dispatch_message instead. Question is at most 800 characters and has at most 8 options. ${ISSUE_REFERENCE}`,
|
|
41
|
-
arguments: (z) => ({
|
|
42
|
-
issue: z.string().describe(ISSUE_REFERENCE),
|
|
43
|
-
question: z.string({ max: 800 }).describe("Decision question, at most 800 characters."),
|
|
44
|
-
options: z.array(z.object({
|
|
45
|
-
label: z.string().describe("Selectable option label."),
|
|
46
|
-
description: z.string().describe("Optional option context.").optional()
|
|
47
|
-
}), { max: 8 }).describe("Optional choices, at most 8.").optional(),
|
|
48
|
-
multiple: z.boolean().describe("Whether multiple choices may be selected.").optional(),
|
|
49
|
-
custom: z.boolean().describe("Whether a free-text answer is allowed.").optional(),
|
|
50
|
-
urgency: z.enum(ASK_URGENCIES).describe("Optional decision urgency.").optional(),
|
|
51
|
-
anchor: z.object({
|
|
52
|
-
artifact: z.string().describe("Artifact slug or id containing the quoted text."),
|
|
53
|
-
quote: z.string().describe("Exact text the decision concerns."),
|
|
54
|
-
occurrence: z.number({ int: true, min: 0 }).describe("Zero-based occurrence of the quote.").optional()
|
|
55
|
-
}).describe("Optional document location for the question.").optional()
|
|
56
|
-
})
|
|
57
|
-
},
|
|
58
|
-
{
|
|
59
|
-
name: "dispatch_comment",
|
|
60
|
-
description: "Add review feedback to an issue or document quote. Do not use it for an exact replacement; use " + `dispatch_suggest instead. Body is at most 2,000 characters. ${ISSUE_REFERENCE}`,
|
|
61
|
-
arguments: (z) => ({
|
|
62
|
-
issue: z.string().describe(ISSUE_REFERENCE),
|
|
63
|
-
artifact: z.string().describe("Artifact slug or id required when quote is given.").optional(),
|
|
64
|
-
quote: z.string().describe("Optional exact quoted document text.").optional(),
|
|
65
|
-
occurrence: z.number({ int: true, min: 0 }).describe("Optional zero-based occurrence of quote.").optional(),
|
|
66
|
-
body: z.string({ max: 2000 }).describe("Review comment, at most 2,000 characters."),
|
|
67
|
-
reply_to: z.string().describe("Optional comment id to reply to.").optional()
|
|
68
|
-
})
|
|
69
|
-
},
|
|
70
|
-
{
|
|
71
|
-
name: "dispatch_suggest",
|
|
72
|
-
description: "Propose an exact replacement for quoted document text. Do not use it for general feedback; use " + `dispatch_comment instead. Optional explanation is at most 2,000 characters. ${ISSUE_REFERENCE}`,
|
|
73
|
-
arguments: (z) => ({
|
|
74
|
-
issue: z.string().describe(ISSUE_REFERENCE),
|
|
75
|
-
artifact: z.string().describe("Artifact slug or id containing the quoted text."),
|
|
76
|
-
quote: z.string().describe("Exact document text to replace."),
|
|
77
|
-
replace_with: z.string().describe("Replacement text."),
|
|
78
|
-
body: z.string({ max: 2000 }).describe("Optional rationale, at most 2,000 characters.").optional(),
|
|
79
|
-
occurrence: z.number({ int: true, min: 0 }).describe("Optional zero-based occurrence of quote.").optional()
|
|
80
|
-
})
|
|
81
|
-
},
|
|
82
|
-
{
|
|
83
|
-
name: "dispatch_message",
|
|
84
|
-
description: "Post a plain issue update. Do not use it for a decision or line-specific review; use dispatch_ask " + `or dispatch_comment instead. Body is at most 2,000 characters. ${ISSUE_REFERENCE}`,
|
|
85
|
-
arguments: (z) => ({
|
|
86
|
-
issue: z.string().describe(ISSUE_REFERENCE),
|
|
87
|
-
body: z.string({ max: 2000 }).describe("Update text, at most 2,000 characters.")
|
|
88
|
-
})
|
|
89
|
-
},
|
|
90
|
-
{
|
|
91
|
-
name: "dispatch_doc_edit",
|
|
92
|
-
description: "Apply deterministic text edits to a document. Do not use it for review feedback or for reading; use " + `dispatch_comment, dispatch_suggest, or dispatch_doc_read instead. ${ISSUE_REFERENCE}`,
|
|
93
|
-
arguments: (z) => ({
|
|
94
|
-
issue: z.string().describe(ISSUE_REFERENCE),
|
|
95
|
-
artifact: z.string().describe("Artifact slug or id for the document."),
|
|
96
|
-
ops: z.array(z.object({
|
|
97
|
-
op: z.enum(DOC_EDIT_OPS).describe("Edit operation."),
|
|
98
|
-
find: z.string().describe("Text to find for replace or delete.").optional(),
|
|
99
|
-
with: z.string().describe("Replacement text for replace.").optional(),
|
|
100
|
-
occurrence: z.number({ int: true, min: 0 }).describe("Optional zero-based match occurrence.").optional(),
|
|
101
|
-
markdown: z.string().describe("Markdown to insert.").optional(),
|
|
102
|
-
after: z.string().describe("Anchor after which to insert.").optional(),
|
|
103
|
-
before: z.string().describe("Anchor before which to insert.").optional()
|
|
104
|
-
})).describe("Flat tagged edits; the server validates fields required for each operation."),
|
|
105
|
-
summary: z.string().describe("Optional named-version summary.").optional()
|
|
106
|
-
})
|
|
107
|
-
},
|
|
108
|
-
{
|
|
109
|
-
name: "dispatch_doc_read",
|
|
110
|
-
description: "Read a live document or a named document version. Do not use it for issue status, asks, or events; " + "use dispatch_read instead. Supply ref or issue; issue plus an omitted artifact reads the primary document. " + `${ISSUE_REFERENCE}`,
|
|
111
|
-
arguments: (z) => ({
|
|
112
|
-
issue: z.string().describe(ISSUE_REFERENCE).optional(),
|
|
113
|
-
artifact: z.string().describe("Optional artifact slug or id; primary document by default.").optional(),
|
|
114
|
-
version: z.number({ int: true, min: 1 }).describe("Optional version number.").optional(),
|
|
115
|
-
ref: z.string().describe("Optional dispatch:// document reference.").optional()
|
|
116
|
-
})
|
|
117
|
-
},
|
|
118
|
-
{
|
|
119
|
-
name: "dispatch_artifact",
|
|
120
|
-
description: "Upload a local file as an issue artifact. Do not use it to edit a live document; use dispatch_doc_edit " + `instead. Files are limited to 25 MiB. ${ISSUE_REFERENCE}`,
|
|
121
|
-
arguments: (z) => ({
|
|
122
|
-
issue: z.string().describe(ISSUE_REFERENCE),
|
|
123
|
-
name: z.string().describe("Artifact filename shown in Dispatch."),
|
|
124
|
-
path: z.string().describe("Local path to the file to upload."),
|
|
125
|
-
primary: z.boolean().describe("Make this document the issue primary artifact.").optional(),
|
|
126
|
-
summary: z.string().describe("Optional version summary.").optional()
|
|
127
|
-
})
|
|
128
|
-
},
|
|
129
|
-
{
|
|
130
|
-
name: "dispatch_read",
|
|
131
|
-
description: "Read an issue summary, targeted ask, or targeted comment reply chain. Do not use it for document " + "contents; use dispatch_doc_read instead. Supply issue or ref. " + ISSUE_REFERENCE,
|
|
132
|
-
arguments: (z) => ({
|
|
133
|
-
issue: z.string().describe(ISSUE_REFERENCE).optional(),
|
|
134
|
-
ref: z.string().describe("Optional dispatch:// issue reference.").optional()
|
|
135
|
-
})
|
|
136
|
-
}
|
|
137
|
-
];
|
|
138
22
|
// ../../node_modules/.bun/zod@4.3.6/node_modules/zod/v4/classic/external.js
|
|
139
23
|
var exports_external = {};
|
|
140
24
|
__export(exports_external, {
|
|
@@ -13667,6 +13551,160 @@ function date4(params) {
|
|
|
13667
13551
|
|
|
13668
13552
|
// ../../node_modules/.bun/zod@4.3.6/node_modules/zod/v4/classic/external.js
|
|
13669
13553
|
config(en_default());
|
|
13554
|
+
// ../contracts/src/dispatch-api.ts
|
|
13555
|
+
var DispatchEventSchema = object({
|
|
13556
|
+
issue_key: string2(),
|
|
13557
|
+
type: string2(),
|
|
13558
|
+
actor: object({ kind: string2(), id: string2().optional() }).passthrough(),
|
|
13559
|
+
payload: object({}).passthrough()
|
|
13560
|
+
});
|
|
13561
|
+
var IssueEventPayloadSchema = object({
|
|
13562
|
+
title: string2().optional(),
|
|
13563
|
+
status: string2().optional(),
|
|
13564
|
+
route: string2().nullish()
|
|
13565
|
+
});
|
|
13566
|
+
var ArtifactCreatedEventPayloadSchema = object({
|
|
13567
|
+
artifact: object({ name: string2().optional() }).optional()
|
|
13568
|
+
});
|
|
13569
|
+
var ArtifactVersionEventPayloadSchema = object({
|
|
13570
|
+
name: string2().optional(),
|
|
13571
|
+
version: object({ number: number2().optional(), summary: string2().nullish() }).optional(),
|
|
13572
|
+
diff: string2().optional()
|
|
13573
|
+
});
|
|
13574
|
+
var AskEventPayloadSchema = object({
|
|
13575
|
+
question: string2().optional(),
|
|
13576
|
+
options: array(object({ label: string2().optional() })).nullish(),
|
|
13577
|
+
answer: object({ selected: array(string2()).nullish(), text: string2().nullish() }).nullish()
|
|
13578
|
+
});
|
|
13579
|
+
var CommentEventPayloadSchema = object({
|
|
13580
|
+
artifact_name: string2().optional(),
|
|
13581
|
+
body: string2().optional(),
|
|
13582
|
+
reply_to: string2().nullish(),
|
|
13583
|
+
anchor: object({ quote: string2().optional() }).nullish(),
|
|
13584
|
+
suggestion: object({ replace_with: string2().optional() }).nullish()
|
|
13585
|
+
});
|
|
13586
|
+
var MessageEventPayloadSchema = object({ body: string2().optional() });
|
|
13587
|
+
var ChildStatusEventPayloadSchema = object({
|
|
13588
|
+
child_key: string2().optional(),
|
|
13589
|
+
from: string2().optional(),
|
|
13590
|
+
to: string2().optional()
|
|
13591
|
+
});
|
|
13592
|
+
// ../contracts/src/dispatch-tools.ts
|
|
13593
|
+
var ISSUE_REFERENCE = "An issue is a native KEY or external owner/repo#n reference; an external reference creates its native issue on first use in the repository's mapped project (DISPATCH_REPO_PROJECTS) or, failing that, the default project (DISPATCH_DEFAULT_PROJECT).";
|
|
13594
|
+
var ASK_URGENCIES = ["low", "med", "high", "blocking"];
|
|
13595
|
+
var DOC_EDIT_OPS = ["replace", "delete", "insert"];
|
|
13596
|
+
var dispatchToolSpecs = [
|
|
13597
|
+
{
|
|
13598
|
+
name: "dispatch_issue",
|
|
13599
|
+
description: "Create a native Dispatch issue for newly tracked work. Do not use it when an existing issue " + `already covers the work; read or update that issue instead. ${ISSUE_REFERENCE}`,
|
|
13600
|
+
arguments: (z) => ({
|
|
13601
|
+
project: z.string().describe("Project key for the new issue."),
|
|
13602
|
+
title: z.string().describe("Concise issue title."),
|
|
13603
|
+
parent: z.string().describe("Optional parent issue.").optional(),
|
|
13604
|
+
external: z.string().describe("Optional external issue reference.").optional(),
|
|
13605
|
+
spec: z.string().describe("Optional initial primary-document markdown.").optional()
|
|
13606
|
+
})
|
|
13607
|
+
},
|
|
13608
|
+
{
|
|
13609
|
+
name: "dispatch_ask",
|
|
13610
|
+
description: "Open a durable, answerable decision on an issue. Do not use it for a status update or discussion; " + `use dispatch_message instead. Question is at most 800 characters and has at most 8 options. ${ISSUE_REFERENCE}`,
|
|
13611
|
+
arguments: (z) => ({
|
|
13612
|
+
issue: z.string().describe(ISSUE_REFERENCE),
|
|
13613
|
+
question: z.string({ max: 800 }).describe("Decision question, at most 800 characters."),
|
|
13614
|
+
options: z.array(z.object({
|
|
13615
|
+
label: z.string().describe("Selectable option label."),
|
|
13616
|
+
description: z.string().describe("Optional option context.").optional()
|
|
13617
|
+
}), { max: 8 }).describe("Optional choices, at most 8.").optional(),
|
|
13618
|
+
multiple: z.boolean().describe("Whether multiple choices may be selected.").optional(),
|
|
13619
|
+
custom: z.boolean().describe("Whether a free-text answer is allowed.").optional(),
|
|
13620
|
+
urgency: z.enum(ASK_URGENCIES).describe("Optional decision urgency.").optional(),
|
|
13621
|
+
anchor: z.object({
|
|
13622
|
+
artifact: z.string().describe("Artifact slug or id containing the quoted text."),
|
|
13623
|
+
quote: z.string().describe("Exact text the decision concerns."),
|
|
13624
|
+
occurrence: z.number({ int: true, min: 0 }).describe("Zero-based occurrence of the quote.").optional()
|
|
13625
|
+
}).describe("Optional document location for the question.").optional()
|
|
13626
|
+
})
|
|
13627
|
+
},
|
|
13628
|
+
{
|
|
13629
|
+
name: "dispatch_comment",
|
|
13630
|
+
description: "Add review feedback to an issue or document quote. Do not use it for an exact replacement; use " + `dispatch_suggest instead. Body is at most 2,000 characters. ${ISSUE_REFERENCE}`,
|
|
13631
|
+
arguments: (z) => ({
|
|
13632
|
+
issue: z.string().describe(ISSUE_REFERENCE),
|
|
13633
|
+
artifact: z.string().describe("Artifact slug or id required when quote is given.").optional(),
|
|
13634
|
+
quote: z.string().describe("Optional exact quoted document text.").optional(),
|
|
13635
|
+
occurrence: z.number({ int: true, min: 0 }).describe("Optional zero-based occurrence of quote.").optional(),
|
|
13636
|
+
body: z.string({ max: 2000 }).describe("Review comment, at most 2,000 characters."),
|
|
13637
|
+
reply_to: z.string().describe("Optional comment id to reply to.").optional()
|
|
13638
|
+
})
|
|
13639
|
+
},
|
|
13640
|
+
{
|
|
13641
|
+
name: "dispatch_suggest",
|
|
13642
|
+
description: "Propose an exact replacement for quoted document text. Do not use it for general feedback; use " + `dispatch_comment instead. Optional explanation is at most 2,000 characters. ${ISSUE_REFERENCE}`,
|
|
13643
|
+
arguments: (z) => ({
|
|
13644
|
+
issue: z.string().describe(ISSUE_REFERENCE),
|
|
13645
|
+
artifact: z.string().describe("Artifact slug or id containing the quoted text."),
|
|
13646
|
+
quote: z.string().describe("Exact document text to replace."),
|
|
13647
|
+
replace_with: z.string().describe("Replacement text."),
|
|
13648
|
+
body: z.string({ max: 2000 }).describe("Optional rationale, at most 2,000 characters.").optional(),
|
|
13649
|
+
occurrence: z.number({ int: true, min: 0 }).describe("Optional zero-based occurrence of quote.").optional()
|
|
13650
|
+
})
|
|
13651
|
+
},
|
|
13652
|
+
{
|
|
13653
|
+
name: "dispatch_message",
|
|
13654
|
+
description: "Post a plain issue update. Do not use it for a decision or line-specific review; use dispatch_ask " + `or dispatch_comment instead. Body is at most 2,000 characters. ${ISSUE_REFERENCE}`,
|
|
13655
|
+
arguments: (z) => ({
|
|
13656
|
+
issue: z.string().describe(ISSUE_REFERENCE),
|
|
13657
|
+
body: z.string({ max: 2000 }).describe("Update text, at most 2,000 characters.")
|
|
13658
|
+
})
|
|
13659
|
+
},
|
|
13660
|
+
{
|
|
13661
|
+
name: "dispatch_doc_edit",
|
|
13662
|
+
description: "Apply deterministic text edits to a document. Do not use it for review feedback or for reading; use " + `dispatch_comment, dispatch_suggest, or dispatch_doc_read instead. ${ISSUE_REFERENCE}`,
|
|
13663
|
+
arguments: (z) => ({
|
|
13664
|
+
issue: z.string().describe(ISSUE_REFERENCE),
|
|
13665
|
+
artifact: z.string().describe("Artifact slug or id for the document."),
|
|
13666
|
+
ops: z.array(z.object({
|
|
13667
|
+
op: z.enum(DOC_EDIT_OPS).describe("Edit operation."),
|
|
13668
|
+
find: z.string().describe("Text to find for replace or delete.").optional(),
|
|
13669
|
+
with: z.string().describe("Replacement text for replace.").optional(),
|
|
13670
|
+
occurrence: z.number({ int: true, min: 0 }).describe("Optional zero-based match occurrence.").optional(),
|
|
13671
|
+
markdown: z.string().describe("Markdown to insert.").optional(),
|
|
13672
|
+
after: z.string().describe("Anchor after which to insert.").optional(),
|
|
13673
|
+
before: z.string().describe("Anchor before which to insert.").optional()
|
|
13674
|
+
})).describe("Flat tagged edits; the server validates fields required for each operation."),
|
|
13675
|
+
summary: z.string().describe("Optional named-version summary.").optional()
|
|
13676
|
+
})
|
|
13677
|
+
},
|
|
13678
|
+
{
|
|
13679
|
+
name: "dispatch_doc_read",
|
|
13680
|
+
description: "Read a live document or a named document version. Do not use it for issue status, asks, or events; " + "use dispatch_read instead. Supply ref or issue; issue plus an omitted artifact reads the primary document. " + `${ISSUE_REFERENCE}`,
|
|
13681
|
+
arguments: (z) => ({
|
|
13682
|
+
issue: z.string().describe(ISSUE_REFERENCE).optional(),
|
|
13683
|
+
artifact: z.string().describe("Optional artifact slug or id; primary document by default.").optional(),
|
|
13684
|
+
version: z.number({ int: true, min: 1 }).describe("Optional version number.").optional(),
|
|
13685
|
+
ref: z.string().describe("Optional dispatch:// document reference.").optional()
|
|
13686
|
+
})
|
|
13687
|
+
},
|
|
13688
|
+
{
|
|
13689
|
+
name: "dispatch_artifact",
|
|
13690
|
+
description: "Upload a local file as an issue artifact. Do not use it to edit a live document; use dispatch_doc_edit " + `instead. Files are limited to 25 MiB. ${ISSUE_REFERENCE}`,
|
|
13691
|
+
arguments: (z) => ({
|
|
13692
|
+
issue: z.string().describe(ISSUE_REFERENCE),
|
|
13693
|
+
name: z.string().describe("Artifact filename shown in Dispatch."),
|
|
13694
|
+
path: z.string().describe("Local path to the file to upload."),
|
|
13695
|
+
primary: z.boolean().describe("Make this document the issue primary artifact.").optional(),
|
|
13696
|
+
summary: z.string().describe("Optional version summary.").optional()
|
|
13697
|
+
})
|
|
13698
|
+
},
|
|
13699
|
+
{
|
|
13700
|
+
name: "dispatch_read",
|
|
13701
|
+
description: "Read an issue summary, targeted ask, or targeted comment reply chain. Do not use it for document " + "contents; use dispatch_doc_read instead. Supply issue or ref. " + ISSUE_REFERENCE,
|
|
13702
|
+
arguments: (z) => ({
|
|
13703
|
+
issue: z.string().describe(ISSUE_REFERENCE).optional(),
|
|
13704
|
+
ref: z.string().describe("Optional dispatch:// issue reference.").optional()
|
|
13705
|
+
})
|
|
13706
|
+
}
|
|
13707
|
+
];
|
|
13670
13708
|
// ../contracts/src/envelope.ts
|
|
13671
13709
|
var isSubject = (value) => typeof value === "string" && value.length > 0;
|
|
13672
13710
|
var EnvelopeSchema = object({
|
|
@@ -14319,7 +14357,8 @@ class DispatchClient {
|
|
|
14319
14357
|
form.set("primary", String(input.primary));
|
|
14320
14358
|
if (input.summary !== undefined)
|
|
14321
14359
|
form.set("summary", input.summary);
|
|
14322
|
-
|
|
14360
|
+
if (input.actor !== undefined)
|
|
14361
|
+
form.set("actor", JSON.stringify(input.actor));
|
|
14323
14362
|
form.set("file", input.file, input.name);
|
|
14324
14363
|
return this.#form("POST", ["api", "v1", "issues", await this.#resolveIssue(issue), "artifacts"], form);
|
|
14325
14364
|
}
|