@sjawhar/pi-envoy 16.28.0 → 16.30.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/dist/dispatch.js +19 -6
- package/dist/envoy.js +798 -760
- package/package.json +1 -1
package/dist/dispatch.js
CHANGED
|
@@ -14975,6 +14975,17 @@ function isIdPrefix(value) {
|
|
|
14975
14975
|
function pictureCaption(name) {
|
|
14976
14976
|
return name.replace(/[\\[\]`]/g, "\\$&").replace(/\s+/g, " ");
|
|
14977
14977
|
}
|
|
14978
|
+
var PICTURE_CAPTION = String.raw`(?:\\.|[^\\\]\n]){0,512}`;
|
|
14979
|
+
var PICTURE_ADDRESS = String.raw`dispatch://[^\s()]{1,2048}@v[1-9][0-9]{0,18}`;
|
|
14980
|
+
var PICTURE_TITLE = String.raw`(?:\s{1,4}"(?:\\.|[^\\"]){0,256}")?`;
|
|
14981
|
+
var PICTURE_SYNTAX = String.raw`!\[${PICTURE_CAPTION}\]\((${PICTURE_ADDRESS})${PICTURE_TITLE}\)`;
|
|
14982
|
+
function pictureSyntax() {
|
|
14983
|
+
return new RegExp(PICTURE_SYNTAX, "g");
|
|
14984
|
+
}
|
|
14985
|
+
function blockPlaceholder(type) {
|
|
14986
|
+
return `[${type}]`;
|
|
14987
|
+
}
|
|
14988
|
+
var PICTURE_PLACEHOLDER = blockPlaceholder("image");
|
|
14978
14989
|
var PICTURE_TYPES = {
|
|
14979
14990
|
"image/png": true,
|
|
14980
14991
|
"image/jpeg": true,
|
|
@@ -15078,7 +15089,7 @@ var commentValidation = {
|
|
|
15078
15089
|
refusal: (value) => commentProblem(value) ?? `${commentOwner.message} ${COMMENT_TURN_RULE}`
|
|
15079
15090
|
};
|
|
15080
15091
|
var ISSUE_UPDATE_FIELDS_RULE = "Issue update requires at least one field besides issue: status, title, labels, priority, external_links, route, parent, blocked_by, components, repo, before, or after.";
|
|
15081
|
-
var ISSUE_UPDATE_DONE_RULE = "status done requires reason, a non-empty note saying why the issue is closing, posted on the issue before it closes
|
|
15092
|
+
var ISSUE_UPDATE_DONE_RULE = "status done requires reason, a non-empty note saying why the issue is closing, posted on the issue before it closes so the close carries its note";
|
|
15082
15093
|
var ISSUE_UPDATE_REASON_RULE = "reason goes only with status done";
|
|
15083
15094
|
var ISSUE_UPDATE_RULE = `${ISSUE_UPDATE_FIELDS_RULE} ${ISSUE_UPDATE_DONE_RULE}; ${ISSUE_UPDATE_REASON_RULE}.`;
|
|
15084
15095
|
function issueUpdateProblem(value) {
|
|
@@ -15223,7 +15234,7 @@ var dispatchToolSpecs = [
|
|
|
15223
15234
|
priority: 1,
|
|
15224
15235
|
before: "DSP-2"
|
|
15225
15236
|
},
|
|
15226
|
-
description: "Update an existing issue: move its lifecycle status, retitle it, replace its labels, set " + "its priority, link a URL (the pull request that delivers it, a run, a document), set its " + "route, set or clear its parent, replace the issues it is blocked by, attach it to " + "architecture components, set the repository it targets, or move it on its project's " + "board. Status is one of " + `${ISSUE_STATUSES.join(", ")}; outside Legion, move it yourself as the work advances; inside ` + "Legion the daemon moves it. A non-empty external_links is " + "merged into the issue's existing links by URL, so linking the pull request you just opened " + "keeps every earlier link; an empty external_links removes every link instead. components " + "replaces the issue's own attachment. Closing an issue " + "(status done) requires reason, the note that says why: it is posted on the issue as a " + "message, then the issue closes,
|
|
15237
|
+
description: "Update an existing issue: move its lifecycle status, retitle it, replace its labels, set " + "its priority, link a URL (the pull request that delivers it, a run, a document), set its " + "route, set or clear its parent, replace the issues it is blocked by, attach it to " + "architecture components, set the repository it targets, or move it on its project's " + "board. Status is one of " + `${ISSUE_STATUSES.join(", ")}; outside Legion, move it yourself as the work advances; inside ` + "Legion the daemon moves it. A non-empty external_links is " + "merged into the issue's existing links by URL, so linking the pull request you just opened " + "keeps every earlier link; an empty external_links removes every link instead. components " + "replaces the issue's own attachment. Closing an issue " + "(status done) requires reason, the note that says why: it is posted on the issue as a " + "message, then the issue closes, so the close carries its note; closing an issue that is " + "already closed is refused (ISSUE_CLOSED) before anything is posted. Reason goes only " + "with status done. Closing an issue withdraws every open ask " + "it holds (resolution kind withdrawn, naming the closer), and reopening it brings exactly " + "those asks back. " + "A closed issue still takes messages and comments, though not asks or artifacts; of this " + "tool's fields it takes only a board move " + "(before, after), components, " + "a reopening status (any status but done), and an external_links write that adds no new " + "link (so a link can move to the issue that replaced it); everything else, priority " + "included, waits for the reopen. " + "priority is yours to set and a human overrides it. before and after move the issue on " + "its project's board: before puts it above that issue, after below, and both together " + "land it between them. A project's board order is one agent's to keep; in a Legion " + "deployment that is the controller. Never reassign an issue a person holds to get a " + "faster answer: who holds it is their call. At least one " + `field besides issue is required. ${ISSUE_REFERENCE}`,
|
|
15227
15238
|
arguments: (z) => ({
|
|
15228
15239
|
issue: z.string().describe(ISSUE_REFERENCE),
|
|
15229
15240
|
status: z.enum(ISSUE_STATUSES).describe("New lifecycle status.").optional(),
|
|
@@ -18108,9 +18119,9 @@ class DispatchClient {
|
|
|
18108
18119
|
async messageReply(id, input, options = {}) {
|
|
18109
18120
|
return this.#json("POST", ["api", "v1", "messages", id, "reply"], input, options.followUp === true ? { follow_up: "true" } : undefined);
|
|
18110
18121
|
}
|
|
18111
|
-
async deliveryReply(resource, id, input) {
|
|
18122
|
+
async deliveryReply(resource, id, input, options = {}) {
|
|
18112
18123
|
const collection = resource === "message" ? "messages" : "comments";
|
|
18113
|
-
await this.#json("POST", ["api", "v1", collection, id, "reply"], input);
|
|
18124
|
+
await this.#json("POST", ["api", "v1", collection, id, "reply"], input, options.followUp === true ? { follow_up: "true" } : undefined);
|
|
18114
18125
|
}
|
|
18115
18126
|
async getMessage(issue, id) {
|
|
18116
18127
|
return this.#json("GET", [
|
|
@@ -18646,9 +18657,8 @@ function withPictureLines(text, lines) {
|
|
|
18646
18657
|
${lines.join(`
|
|
18647
18658
|
`)}`;
|
|
18648
18659
|
}
|
|
18649
|
-
var PICTURE_SYNTAX = /!\[(?:\\.|[^\\\]])*\]\((dispatch:\/\/[^\s()]+@v[1-9][0-9]*)(?:\s+"(?:\\.|[^\\"])*")?\)/g;
|
|
18650
18660
|
function pictureAddresses(text) {
|
|
18651
|
-
return [...text.matchAll(
|
|
18661
|
+
return [...text.matchAll(pictureSyntax())].map((match) => match[1]);
|
|
18652
18662
|
}
|
|
18653
18663
|
function picturesNewestFirst(texts) {
|
|
18654
18664
|
const ordered = texts.map((item, index) => ({ item, index, at: Date.parse(item.at) })).sort((left, right) => (Number.isNaN(right.at) ? 0 : right.at) - (Number.isNaN(left.at) ? 0 : left.at) || left.index - right.index);
|
|
@@ -21728,6 +21738,9 @@ async function executeDispatchTool(input) {
|
|
|
21728
21738
|
} catch (error) {
|
|
21729
21739
|
throw refusalWithCode(error);
|
|
21730
21740
|
}
|
|
21741
|
+
if (status === "done" && typeof before.closed_at === "string") {
|
|
21742
|
+
throw refusalWithCode(new DispatchServiceError("ISSUE_CLOSED", 409, "issue is closed"), `${issueKey} closed at ${before.closed_at}, so the reason was not posted and the close was not sent`);
|
|
21743
|
+
}
|
|
21731
21744
|
let closingNote;
|
|
21732
21745
|
if (reason !== undefined) {
|
|
21733
21746
|
try {
|