@sjawhar/claude-envoy 1.30.1 → 1.32.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/.claude-plugin/plugin.json +1 -1
- package/.omp-plugin/plugin.json +1 -1
- package/dist/dispatch.js +37 -6
- package/dist/envoy-channel.js +38 -7
- package/dist/session-hook.js +37 -6
- package/package.json +1 -1
- package/skills/dispatch/SKILL.md +6 -7
package/.omp-plugin/plugin.json
CHANGED
package/dist/dispatch.js
CHANGED
|
@@ -14743,6 +14743,9 @@ var askEventPayloadFields = {
|
|
|
14743
14743
|
actor: object({ kind: string2().optional(), id: string2().optional() }).passthrough().optional(),
|
|
14744
14744
|
at: string2().optional()
|
|
14745
14745
|
}).nullish(),
|
|
14746
|
+
asked_of: string2().nullish(),
|
|
14747
|
+
asked_of_by: string2().nullish(),
|
|
14748
|
+
asked_of_at: string2().nullish(),
|
|
14746
14749
|
thread_logins: array(string2()).optional()
|
|
14747
14750
|
};
|
|
14748
14751
|
var AskEventPayloadSchema = intersection(object(askEventPayloadFields), object({
|
|
@@ -15085,6 +15088,8 @@ var BOARD_NEIGHBOUR_REFUSAL = "The server refuses a key that does not exist, one
|
|
|
15085
15088
|
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.";
|
|
15086
15089
|
var ASK_QUESTION_CONTRACT = "The question names the concrete case first: which machines, files, sessions or people, and the " + "numbers. It asks the choice in those terms, saying what happens to whom under each option " + '("Ship Friday and risk signing out 1,240 users, or hold to Monday?"), never "How should we ' + 'proceed?" or "Which option?", because a reader cannot work back from a general question to ' + "the case. It carries every fact the reader needs to decide and nothing " + "that does not change the decision. Generalize only after the specifics, if at all. Then give " + "your recommendation and its reason.";
|
|
15087
15090
|
var ASK_OPTIONS_CONTRACT = "Options carry the genuinely different approaches. Each option has a label, and its description " + "says what that approach costs.";
|
|
15091
|
+
var ASK_IS_FOR_A_PERSON = "An ask is a question for a person, never a request to another agent. Ask an agent by envoy_send or a comment on the issue.";
|
|
15092
|
+
var ASK_WAITS_ON_THE_ASSIGNEE = "An ask waits on the issue's assignee until a person hands it on. No agent can hand one on.";
|
|
15088
15093
|
var HUMAN_AGREED_TO_DOCUMENT = "the human has agreed to every point in the document";
|
|
15089
15094
|
function documentOwnerValidation(requireArtifact, alwaysRequireArtifact = false) {
|
|
15090
15095
|
return {
|
|
@@ -15165,7 +15170,7 @@ var commentValidation = {
|
|
|
15165
15170
|
message: `${commentOwner.message} ${COMMENT_TURN_RULE}`,
|
|
15166
15171
|
refusal: (value) => commentProblem(value) ?? `${commentOwner.message} ${COMMENT_TURN_RULE}`
|
|
15167
15172
|
};
|
|
15168
|
-
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.";
|
|
15173
|
+
var ISSUE_UPDATE_FIELDS_RULE = "Issue update requires at least one field besides issue: status, title, labels, priority, assignee, external_links, route, parent, blocked_by, components, repo, before, or after.";
|
|
15169
15174
|
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";
|
|
15170
15175
|
var ISSUE_UPDATE_REASON_RULE = "reason goes only with status done";
|
|
15171
15176
|
var ISSUE_UPDATE_RULE = `${ISSUE_UPDATE_FIELDS_RULE} ${ISSUE_UPDATE_DONE_RULE}; ${ISSUE_UPDATE_REASON_RULE}.`;
|
|
@@ -15179,7 +15184,7 @@ function issueUpdateProblem(value) {
|
|
|
15179
15184
|
const status = typeof input.status === "string" ? `status ${input.status}` : "an update without status done";
|
|
15180
15185
|
return `${ISSUE_UPDATE_REASON_RULE}: it is the note posted on the issue as it closes, and ${status} closes nothing. Drop reason, or set status done to close the issue.`;
|
|
15181
15186
|
}
|
|
15182
|
-
const changesAField = typeof input.status === "string" || typeof input.title === "string" || Array.isArray(input.labels) || typeof input.priority === "number" || input.priority === null || Array.isArray(input.external_links) || typeof input.route === "string" || typeof input.parent === "string" || Array.isArray(input.blocked_by) || typeof input.components === "object" && input.components !== null || typeof input.repo === "string" || typeof input.before === "string" || typeof input.after === "string";
|
|
15187
|
+
const changesAField = typeof input.status === "string" || typeof input.title === "string" || Array.isArray(input.labels) || typeof input.priority === "number" || input.priority === null || typeof input.assignee === "string" || input.assignee === null || Array.isArray(input.external_links) || typeof input.route === "string" || typeof input.parent === "string" || Array.isArray(input.blocked_by) || typeof input.components === "object" && input.components !== null || typeof input.repo === "string" || typeof input.before === "string" || typeof input.after === "string";
|
|
15183
15188
|
return changesAField ? undefined : ISSUE_UPDATE_FIELDS_RULE;
|
|
15184
15189
|
}
|
|
15185
15190
|
var messageValidation = {
|
|
@@ -15311,7 +15316,7 @@ var dispatchToolSpecs = [
|
|
|
15311
15316
|
priority: 1,
|
|
15312
15317
|
before: "DSP-2"
|
|
15313
15318
|
},
|
|
15314
|
-
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}`,
|
|
15319
|
+
description: "Update an existing issue: move its lifecycle status, retitle it, replace its labels, set " + "its priority, set or clear its assignee, 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. assignee is the person who answers " + "this issue's asks, and every ask on it waits on them until a person hands that ask on. " + "Passing null unassigns the issue. Set the assignee when a person said who owns the work, as you " + "file the issue or hand it over. 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}`,
|
|
15315
15320
|
arguments: (z) => ({
|
|
15316
15321
|
issue: z.string().describe(ISSUE_REFERENCE),
|
|
15317
15322
|
status: z.enum(ISSUE_STATUSES).describe("New lifecycle status.").optional(),
|
|
@@ -15319,6 +15324,7 @@ var dispatchToolSpecs = [
|
|
|
15319
15324
|
title: z.string({ min: 1, max: ISSUE_TITLE_MAX }).describe("Replacement title, at most 1,000 characters.").optional(),
|
|
15320
15325
|
labels: z.array(z.string({ min: 1, max: 40 }), { max: 20 }).describe("Replacement label set, at most 20 labels of up to 40 characters; replaces every existing label.").optional(),
|
|
15321
15326
|
priority: z.number({ int: true, min: 0, max: 3 }).nullable().optional().describe("Coarse priority: 0 is P0 (highest) through 3 is P3 (lowest); null clears it."),
|
|
15327
|
+
assignee: z.string().nullable().optional().describe("Email of the person who answers this issue's asks (someone who has signed in to Dispatch); null unassigns the issue. Set it only when a person said who owns the issue, never to move a question off the person holding it."),
|
|
15322
15328
|
external_links: z.array(z.string({ min: 1 })).describe("URLs to link; a non-empty list merges into the issue's existing external links by URL, an empty list removes every link instead.").optional(),
|
|
15323
15329
|
route: z.string().describe("Route the issue to role:<name> or session:<id>; an empty string clears it.").optional(),
|
|
15324
15330
|
parent: z.string().describe("Parent issue key in the same project; an empty string clears the parent.").optional(),
|
|
@@ -15361,7 +15367,7 @@ var dispatchToolSpecs = [
|
|
|
15361
15367
|
}
|
|
15362
15368
|
]
|
|
15363
15369
|
},
|
|
15364
|
-
description: "Open a to-do or permission only a human can give, or a decision that has no document to " + "live in. A question about the design an issue's document records is not this tool: write " + "it into that document as a decision block (dispatch doc-edit inserting an ask block at the " + "end of the section it concerns), at every phase, approved spec or not; the block reaches " + "the Inbox and its answer lands next to its context. Never give an ask an Approve option: a " + "document is approved through dispatch request-approval. Do not use this tool for a status " + "update or discussion; use dispatch message instead. Never create an issue to park a " + "question: the question is an ask on the issue it concerns. " + ASK_QUESTION_CONTRACT + " " + ASK_OPTIONS_CONTRACT + " For an action only a human can perform, state what it changes and risks as constraints. " + "Anything that requires a human to do, including a credential or grant renewal, is an ask, " + "never a message. Measure what you can first, and put the measurement and the size of the " + "population it covers in the question; drop an option that cannot fix most of that " + "population, never offer it cut down, and keep an option not to act (Hold). Set urgency high " + "when your work halts on the answer, and keep working on everything else. " + "Anchor a to-do about a document passage, thread reply_to/reply_to_ask, or cite a dispatch:// " + `reference \u2014 it must be answerable from its own text and anchor alone, never "see above". ` + `A quote anchor is pinned to its block. ${ASK_BOUND_RULE} The lines images appends count ` + `toward that bound, and an ask has at most 8 options. ${RELATED_CHECK_RESULT} ` + `An ask among the related items says whether it is answered, by whom and with which options. ${OWNER_REFERENCE}`,
|
|
15370
|
+
description: `${ASK_IS_FOR_A_PERSON} ${ASK_WAITS_ON_THE_ASSIGNEE} ` + "Open a to-do or permission only a human can give, or a decision that has no document to " + "live in. A question about the design an issue's document records is not this tool: write " + "it into that document as a decision block (dispatch doc-edit inserting an ask block at the " + "end of the section it concerns), at every phase, approved spec or not; the block reaches " + "the Inbox and its answer lands next to its context. Never give an ask an Approve option: a " + "document is approved through dispatch request-approval. Do not use this tool for a status " + "update or discussion; use dispatch message instead. Never create an issue to park a " + "question: the question is an ask on the issue it concerns. " + ASK_QUESTION_CONTRACT + " " + ASK_OPTIONS_CONTRACT + " For an action only a human can perform, state what it changes and risks as constraints. " + "Anything that requires a human to do, including a credential or grant renewal, is an ask, " + "never a message. Measure what you can first, and put the measurement and the size of the " + "population it covers in the question; drop an option that cannot fix most of that " + "population, never offer it cut down, and keep an option not to act (Hold). Set urgency high " + "when your work halts on the answer, and keep working on everything else. " + "Anchor a to-do about a document passage, thread reply_to/reply_to_ask, or cite a dispatch:// " + `reference \u2014 it must be answerable from its own text and anchor alone, never "see above". ` + `A quote anchor is pinned to its block. ${ASK_BOUND_RULE} The lines images appends count ` + `toward that bound, and an ask has at most 8 options. ${RELATED_CHECK_RESULT} ` + `An ask among the related items says whether it is answered, by whom and with which options. ${OWNER_REFERENCE}`,
|
|
15365
15371
|
arguments: (z) => ({
|
|
15366
15372
|
issue: z.string().describe(ISSUE_REFERENCE).optional(),
|
|
15367
15373
|
project: z.string().describe("Project key owning the document.").optional(),
|
|
@@ -15399,7 +15405,7 @@ var dispatchToolSpecs = [
|
|
|
15399
15405
|
}
|
|
15400
15406
|
]
|
|
15401
15407
|
},
|
|
15402
|
-
description: "Edit an open question in place. Use it to correct or refine the same decision; retract the " + "old ask and open a new one when the decision itself changes. " + ASK_QUESTION_CONTRACT + " " + ASK_OPTIONS_CONTRACT + " Previous text remains in the event log. Only the asking session can edit it; answered or " + "resolved asks cannot be edited. An ask that lives as an `ask` block in a document is written " + "in the document too, changing only the fields you name - pass urgency alone and the " + "question's wording, formatting, links and comment anchors are untouched - so the edit " + "writes a document version and closes a spec's design gate until that version is approved; " + "text the block cannot carry back unchanged is refused, naming the field - an option label " + 'containing ": ", the separator between a label and its description, is one example.',
|
|
15408
|
+
description: `${ASK_IS_FOR_A_PERSON} ${ASK_WAITS_ON_THE_ASSIGNEE} ` + "Edit an open question in place. Use it to correct or refine the same decision; retract the " + "old ask and open a new one when the decision itself changes. " + ASK_QUESTION_CONTRACT + " " + ASK_OPTIONS_CONTRACT + " Previous text remains in the event log. Only the asking session can edit it; answered or " + "resolved asks cannot be edited. An ask that lives as an `ask` block in a document is written " + "in the document too, changing only the fields you name - pass urgency alone and the " + "question's wording, formatting, links and comment anchors are untouched - so the edit " + "writes a document version and closes a spec's design gate until that version is approved; " + "text the block cannot carry back unchanged is refused, naming the field - an option label " + 'containing ": ", the separator between a label and its description, is one example.',
|
|
15403
15409
|
arguments: (z) => ({
|
|
15404
15410
|
ask: z.string().describe("Ask id (uuid); an 8+ hex prefix unique among this session's own open asks works too."),
|
|
15405
15411
|
question: z.string().optional().describe(`${ASK_QUESTION_CONTRACT} Replaces the ask's question. ${ASK_BOUND_RULE}`),
|
|
@@ -19720,6 +19726,7 @@ var DISPATCH_PAYLOAD_SCHEMAS = {
|
|
|
19720
19726
|
"ask.anchor_refreshed": AskEventPayloadSchema,
|
|
19721
19727
|
"ask.edited": AskEditedEventPayloadSchema,
|
|
19722
19728
|
"ask.handed_back": AskEventPayloadSchema,
|
|
19729
|
+
"ask.asked_of": AskEventPayloadSchema,
|
|
19723
19730
|
"ask.answered": AskEventPayloadSchema,
|
|
19724
19731
|
"ask.resolved": AskEventPayloadSchema,
|
|
19725
19732
|
"comment.created": CommentEventPayloadSchema,
|
|
@@ -19839,6 +19846,15 @@ function dispatchCompact(event, comment) {
|
|
|
19839
19846
|
};
|
|
19840
19847
|
break;
|
|
19841
19848
|
}
|
|
19849
|
+
case "ask.asked_of": {
|
|
19850
|
+
const handedOnBy = ask.data.asked_of_by;
|
|
19851
|
+
record = {
|
|
19852
|
+
...record,
|
|
19853
|
+
asked_of: ask.data.asked_of ?? "the assignee of its issue",
|
|
19854
|
+
...handedOnBy === null || handedOnBy === undefined || handedOnBy === "" ? {} : { handed_on_by: handedOnBy }
|
|
19855
|
+
};
|
|
19856
|
+
break;
|
|
19857
|
+
}
|
|
19842
19858
|
case "ask.resolved": {
|
|
19843
19859
|
const resolved = askResolutionText(ask.data.resolution);
|
|
19844
19860
|
record = resolved === undefined ? record : { ...record, resolved };
|
|
@@ -21356,6 +21372,12 @@ function optionalString(args, name) {
|
|
|
21356
21372
|
const value = args[name];
|
|
21357
21373
|
return typeof value === "string" ? value : undefined;
|
|
21358
21374
|
}
|
|
21375
|
+
function optionalNullableString(args, name) {
|
|
21376
|
+
const value = args[name];
|
|
21377
|
+
if (value === null)
|
|
21378
|
+
return null;
|
|
21379
|
+
return typeof value === "string" ? value : undefined;
|
|
21380
|
+
}
|
|
21359
21381
|
function optionalBoolean(args, name) {
|
|
21360
21382
|
const value = args[name];
|
|
21361
21383
|
return typeof value === "boolean" ? value : undefined;
|
|
@@ -22553,6 +22575,8 @@ function eventHead(event) {
|
|
|
22553
22575
|
const previousAnswer = event.payload.previous_answer;
|
|
22554
22576
|
return `${textHead(event.payload.question)} -> ${textHead(askAnswerText(event.payload.answer))}${previousAnswer === undefined ? "" : ` (was: ${textHead(askAnswerText(previousAnswer))})`}`;
|
|
22555
22577
|
}
|
|
22578
|
+
case "ask.asked_of":
|
|
22579
|
+
return `${textHead(event.payload.question)} -> asked of ${event.payload.asked_of ?? "the assignee of its issue"}`;
|
|
22556
22580
|
case "comment.created":
|
|
22557
22581
|
case "comment.answered":
|
|
22558
22582
|
case "comment.anchor_refreshed":
|
|
@@ -22691,9 +22715,13 @@ function openAskAge(ageSeconds) {
|
|
|
22691
22715
|
const days = Math.floor(hours / 24);
|
|
22692
22716
|
return `${days}d${hours % 24 === 0 ? "" : ` ${hours % 24}h`}`;
|
|
22693
22717
|
}
|
|
22718
|
+
function openAskAskedOf(ask) {
|
|
22719
|
+
const person = ask.waiting_on_person;
|
|
22720
|
+
return person === undefined || person === "" ? "nobody" : person;
|
|
22721
|
+
}
|
|
22694
22722
|
function openAskLine(ask, baseUrl) {
|
|
22695
22723
|
const priority = ask.priority === null ? "" : `P${ask.priority} \xB7 `;
|
|
22696
|
-
return `- ${openAskAge(ask.age_seconds)} \xB7 ${priority}${ownerTitle(ask.owner)} \xB7 ${ask.question} \xB7 ${new URL(ask.ref, baseUrl).toString()}`;
|
|
22724
|
+
return `- ${openAskAge(ask.age_seconds)} \xB7 ${priority}${ownerTitle(ask.owner)} \xB7 asked of ${openAskAskedOf(ask)} \xB7 ${ask.question} \xB7 ${new URL(ask.ref, baseUrl).toString()}`;
|
|
22697
22725
|
}
|
|
22698
22726
|
function formatOpenAsksSummary(response, baseUrl) {
|
|
22699
22727
|
const scope = "active open asks you authored on open issues and project documents";
|
|
@@ -23444,6 +23472,7 @@ async function executeDispatchTool(input) {
|
|
|
23444
23472
|
const rankBefore = optionalString(args, "before");
|
|
23445
23473
|
const rankAfter = optionalString(args, "after");
|
|
23446
23474
|
const priority = optionalPriority(args, "priority");
|
|
23475
|
+
const assignee = optionalNullableString(args, "assignee");
|
|
23447
23476
|
const labels = Array.isArray(args.labels) ? args.labels : undefined;
|
|
23448
23477
|
const blockedBy = Array.isArray(args.blocked_by) ? args.blocked_by : undefined;
|
|
23449
23478
|
const requestedLinks = Array.isArray(args.external_links) ? [...new Set(args.external_links)] : undefined;
|
|
@@ -23489,6 +23518,7 @@ async function executeDispatchTool(input) {
|
|
|
23489
23518
|
...title === undefined ? {} : { title },
|
|
23490
23519
|
...labels === undefined ? {} : { labels },
|
|
23491
23520
|
...priority === undefined ? {} : { priority },
|
|
23521
|
+
...assignee === undefined ? {} : { assignee },
|
|
23492
23522
|
...route === undefined ? {} : { route },
|
|
23493
23523
|
...parent === undefined ? {} : { parent: parent === "" ? null : parent },
|
|
23494
23524
|
...blockedBy === undefined ? {} : { blocked_by: blockedBy },
|
|
@@ -23522,6 +23552,7 @@ async function executeDispatchTool(input) {
|
|
|
23522
23552
|
(after.labels ?? []).length === 0 ? "labels cleared" : `labels ${(after.labels ?? []).join(", ")}`
|
|
23523
23553
|
],
|
|
23524
23554
|
...priority === undefined ? [] : [after.priority === null ? "priority cleared" : `priority -> P${after.priority}`],
|
|
23555
|
+
...assignee === undefined ? [] : [after.assignee === null ? "assignee cleared" : `assignee -> ${after.assignee}`],
|
|
23525
23556
|
...rank === undefined ? [] : [
|
|
23526
23557
|
`rank -> ${[
|
|
23527
23558
|
...rankAfter === undefined ? [] : [`after ${rankAfter}`],
|
package/dist/envoy-channel.js
CHANGED
|
@@ -36392,6 +36392,9 @@ var askEventPayloadFields = {
|
|
|
36392
36392
|
actor: object({ kind: string2().optional(), id: string2().optional() }).passthrough().optional(),
|
|
36393
36393
|
at: string2().optional()
|
|
36394
36394
|
}).nullish(),
|
|
36395
|
+
asked_of: string2().nullish(),
|
|
36396
|
+
asked_of_by: string2().nullish(),
|
|
36397
|
+
asked_of_at: string2().nullish(),
|
|
36395
36398
|
thread_logins: array(string2()).optional()
|
|
36396
36399
|
};
|
|
36397
36400
|
var AskEventPayloadSchema = intersection(object(askEventPayloadFields), object({
|
|
@@ -36734,6 +36737,8 @@ var BOARD_NEIGHBOUR_REFUSAL = "The server refuses a key that does not exist, one
|
|
|
36734
36737
|
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.";
|
|
36735
36738
|
var ASK_QUESTION_CONTRACT = "The question names the concrete case first: which machines, files, sessions or people, and the " + "numbers. It asks the choice in those terms, saying what happens to whom under each option " + '("Ship Friday and risk signing out 1,240 users, or hold to Monday?"), never "How should we ' + 'proceed?" or "Which option?", because a reader cannot work back from a general question to ' + "the case. It carries every fact the reader needs to decide and nothing " + "that does not change the decision. Generalize only after the specifics, if at all. Then give " + "your recommendation and its reason.";
|
|
36736
36739
|
var ASK_OPTIONS_CONTRACT = "Options carry the genuinely different approaches. Each option has a label, and its description " + "says what that approach costs.";
|
|
36740
|
+
var ASK_IS_FOR_A_PERSON = "An ask is a question for a person, never a request to another agent. Ask an agent by envoy_send or a comment on the issue.";
|
|
36741
|
+
var ASK_WAITS_ON_THE_ASSIGNEE = "An ask waits on the issue's assignee until a person hands it on. No agent can hand one on.";
|
|
36737
36742
|
var HUMAN_AGREED_TO_DOCUMENT = "the human has agreed to every point in the document";
|
|
36738
36743
|
function documentOwnerValidation(requireArtifact, alwaysRequireArtifact = false) {
|
|
36739
36744
|
return {
|
|
@@ -36814,7 +36819,7 @@ var commentValidation = {
|
|
|
36814
36819
|
message: `${commentOwner.message} ${COMMENT_TURN_RULE}`,
|
|
36815
36820
|
refusal: (value) => commentProblem(value) ?? `${commentOwner.message} ${COMMENT_TURN_RULE}`
|
|
36816
36821
|
};
|
|
36817
|
-
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.";
|
|
36822
|
+
var ISSUE_UPDATE_FIELDS_RULE = "Issue update requires at least one field besides issue: status, title, labels, priority, assignee, external_links, route, parent, blocked_by, components, repo, before, or after.";
|
|
36818
36823
|
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";
|
|
36819
36824
|
var ISSUE_UPDATE_REASON_RULE = "reason goes only with status done";
|
|
36820
36825
|
var ISSUE_UPDATE_RULE = `${ISSUE_UPDATE_FIELDS_RULE} ${ISSUE_UPDATE_DONE_RULE}; ${ISSUE_UPDATE_REASON_RULE}.`;
|
|
@@ -36828,7 +36833,7 @@ function issueUpdateProblem(value) {
|
|
|
36828
36833
|
const status = typeof input.status === "string" ? `status ${input.status}` : "an update without status done";
|
|
36829
36834
|
return `${ISSUE_UPDATE_REASON_RULE}: it is the note posted on the issue as it closes, and ${status} closes nothing. Drop reason, or set status done to close the issue.`;
|
|
36830
36835
|
}
|
|
36831
|
-
const changesAField = typeof input.status === "string" || typeof input.title === "string" || Array.isArray(input.labels) || typeof input.priority === "number" || input.priority === null || Array.isArray(input.external_links) || typeof input.route === "string" || typeof input.parent === "string" || Array.isArray(input.blocked_by) || typeof input.components === "object" && input.components !== null || typeof input.repo === "string" || typeof input.before === "string" || typeof input.after === "string";
|
|
36836
|
+
const changesAField = typeof input.status === "string" || typeof input.title === "string" || Array.isArray(input.labels) || typeof input.priority === "number" || input.priority === null || typeof input.assignee === "string" || input.assignee === null || Array.isArray(input.external_links) || typeof input.route === "string" || typeof input.parent === "string" || Array.isArray(input.blocked_by) || typeof input.components === "object" && input.components !== null || typeof input.repo === "string" || typeof input.before === "string" || typeof input.after === "string";
|
|
36832
36837
|
return changesAField ? undefined : ISSUE_UPDATE_FIELDS_RULE;
|
|
36833
36838
|
}
|
|
36834
36839
|
var messageValidation = {
|
|
@@ -36960,7 +36965,7 @@ var dispatchToolSpecs = [
|
|
|
36960
36965
|
priority: 1,
|
|
36961
36966
|
before: "DSP-2"
|
|
36962
36967
|
},
|
|
36963
|
-
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}`,
|
|
36968
|
+
description: "Update an existing issue: move its lifecycle status, retitle it, replace its labels, set " + "its priority, set or clear its assignee, 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. assignee is the person who answers " + "this issue's asks, and every ask on it waits on them until a person hands that ask on. " + "Passing null unassigns the issue. Set the assignee when a person said who owns the work, as you " + "file the issue or hand it over. 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}`,
|
|
36964
36969
|
arguments: (z) => ({
|
|
36965
36970
|
issue: z.string().describe(ISSUE_REFERENCE),
|
|
36966
36971
|
status: z.enum(ISSUE_STATUSES).describe("New lifecycle status.").optional(),
|
|
@@ -36968,6 +36973,7 @@ var dispatchToolSpecs = [
|
|
|
36968
36973
|
title: z.string({ min: 1, max: ISSUE_TITLE_MAX }).describe("Replacement title, at most 1,000 characters.").optional(),
|
|
36969
36974
|
labels: z.array(z.string({ min: 1, max: 40 }), { max: 20 }).describe("Replacement label set, at most 20 labels of up to 40 characters; replaces every existing label.").optional(),
|
|
36970
36975
|
priority: z.number({ int: true, min: 0, max: 3 }).nullable().optional().describe("Coarse priority: 0 is P0 (highest) through 3 is P3 (lowest); null clears it."),
|
|
36976
|
+
assignee: z.string().nullable().optional().describe("Email of the person who answers this issue's asks (someone who has signed in to Dispatch); null unassigns the issue. Set it only when a person said who owns the issue, never to move a question off the person holding it."),
|
|
36971
36977
|
external_links: z.array(z.string({ min: 1 })).describe("URLs to link; a non-empty list merges into the issue's existing external links by URL, an empty list removes every link instead.").optional(),
|
|
36972
36978
|
route: z.string().describe("Route the issue to role:<name> or session:<id>; an empty string clears it.").optional(),
|
|
36973
36979
|
parent: z.string().describe("Parent issue key in the same project; an empty string clears the parent.").optional(),
|
|
@@ -37010,7 +37016,7 @@ var dispatchToolSpecs = [
|
|
|
37010
37016
|
}
|
|
37011
37017
|
]
|
|
37012
37018
|
},
|
|
37013
|
-
description: "Open a to-do or permission only a human can give, or a decision that has no document to " + "live in. A question about the design an issue's document records is not this tool: write " + "it into that document as a decision block (dispatch doc-edit inserting an ask block at the " + "end of the section it concerns), at every phase, approved spec or not; the block reaches " + "the Inbox and its answer lands next to its context. Never give an ask an Approve option: a " + "document is approved through dispatch request-approval. Do not use this tool for a status " + "update or discussion; use dispatch message instead. Never create an issue to park a " + "question: the question is an ask on the issue it concerns. " + ASK_QUESTION_CONTRACT + " " + ASK_OPTIONS_CONTRACT + " For an action only a human can perform, state what it changes and risks as constraints. " + "Anything that requires a human to do, including a credential or grant renewal, is an ask, " + "never a message. Measure what you can first, and put the measurement and the size of the " + "population it covers in the question; drop an option that cannot fix most of that " + "population, never offer it cut down, and keep an option not to act (Hold). Set urgency high " + "when your work halts on the answer, and keep working on everything else. " + "Anchor a to-do about a document passage, thread reply_to/reply_to_ask, or cite a dispatch:// " + `reference \u2014 it must be answerable from its own text and anchor alone, never "see above". ` + `A quote anchor is pinned to its block. ${ASK_BOUND_RULE} The lines images appends count ` + `toward that bound, and an ask has at most 8 options. ${RELATED_CHECK_RESULT} ` + `An ask among the related items says whether it is answered, by whom and with which options. ${OWNER_REFERENCE}`,
|
|
37019
|
+
description: `${ASK_IS_FOR_A_PERSON} ${ASK_WAITS_ON_THE_ASSIGNEE} ` + "Open a to-do or permission only a human can give, or a decision that has no document to " + "live in. A question about the design an issue's document records is not this tool: write " + "it into that document as a decision block (dispatch doc-edit inserting an ask block at the " + "end of the section it concerns), at every phase, approved spec or not; the block reaches " + "the Inbox and its answer lands next to its context. Never give an ask an Approve option: a " + "document is approved through dispatch request-approval. Do not use this tool for a status " + "update or discussion; use dispatch message instead. Never create an issue to park a " + "question: the question is an ask on the issue it concerns. " + ASK_QUESTION_CONTRACT + " " + ASK_OPTIONS_CONTRACT + " For an action only a human can perform, state what it changes and risks as constraints. " + "Anything that requires a human to do, including a credential or grant renewal, is an ask, " + "never a message. Measure what you can first, and put the measurement and the size of the " + "population it covers in the question; drop an option that cannot fix most of that " + "population, never offer it cut down, and keep an option not to act (Hold). Set urgency high " + "when your work halts on the answer, and keep working on everything else. " + "Anchor a to-do about a document passage, thread reply_to/reply_to_ask, or cite a dispatch:// " + `reference \u2014 it must be answerable from its own text and anchor alone, never "see above". ` + `A quote anchor is pinned to its block. ${ASK_BOUND_RULE} The lines images appends count ` + `toward that bound, and an ask has at most 8 options. ${RELATED_CHECK_RESULT} ` + `An ask among the related items says whether it is answered, by whom and with which options. ${OWNER_REFERENCE}`,
|
|
37014
37020
|
arguments: (z) => ({
|
|
37015
37021
|
issue: z.string().describe(ISSUE_REFERENCE).optional(),
|
|
37016
37022
|
project: z.string().describe("Project key owning the document.").optional(),
|
|
@@ -37048,7 +37054,7 @@ var dispatchToolSpecs = [
|
|
|
37048
37054
|
}
|
|
37049
37055
|
]
|
|
37050
37056
|
},
|
|
37051
|
-
description: "Edit an open question in place. Use it to correct or refine the same decision; retract the " + "old ask and open a new one when the decision itself changes. " + ASK_QUESTION_CONTRACT + " " + ASK_OPTIONS_CONTRACT + " Previous text remains in the event log. Only the asking session can edit it; answered or " + "resolved asks cannot be edited. An ask that lives as an `ask` block in a document is written " + "in the document too, changing only the fields you name - pass urgency alone and the " + "question's wording, formatting, links and comment anchors are untouched - so the edit " + "writes a document version and closes a spec's design gate until that version is approved; " + "text the block cannot carry back unchanged is refused, naming the field - an option label " + 'containing ": ", the separator between a label and its description, is one example.',
|
|
37057
|
+
description: `${ASK_IS_FOR_A_PERSON} ${ASK_WAITS_ON_THE_ASSIGNEE} ` + "Edit an open question in place. Use it to correct or refine the same decision; retract the " + "old ask and open a new one when the decision itself changes. " + ASK_QUESTION_CONTRACT + " " + ASK_OPTIONS_CONTRACT + " Previous text remains in the event log. Only the asking session can edit it; answered or " + "resolved asks cannot be edited. An ask that lives as an `ask` block in a document is written " + "in the document too, changing only the fields you name - pass urgency alone and the " + "question's wording, formatting, links and comment anchors are untouched - so the edit " + "writes a document version and closes a spec's design gate until that version is approved; " + "text the block cannot carry back unchanged is refused, naming the field - an option label " + 'containing ": ", the separator between a label and its description, is one example.',
|
|
37052
37058
|
arguments: (z) => ({
|
|
37053
37059
|
ask: z.string().describe("Ask id (uuid); an 8+ hex prefix unique among this session's own open asks works too."),
|
|
37054
37060
|
question: z.string().optional().describe(`${ASK_QUESTION_CONTRACT} Replaces the ask's question. ${ASK_BOUND_RULE}`),
|
|
@@ -43679,6 +43685,7 @@ var DISPATCH_PAYLOAD_SCHEMAS = {
|
|
|
43679
43685
|
"ask.anchor_refreshed": AskEventPayloadSchema,
|
|
43680
43686
|
"ask.edited": AskEditedEventPayloadSchema,
|
|
43681
43687
|
"ask.handed_back": AskEventPayloadSchema,
|
|
43688
|
+
"ask.asked_of": AskEventPayloadSchema,
|
|
43682
43689
|
"ask.answered": AskEventPayloadSchema,
|
|
43683
43690
|
"ask.resolved": AskEventPayloadSchema,
|
|
43684
43691
|
"comment.created": CommentEventPayloadSchema,
|
|
@@ -43798,6 +43805,15 @@ function dispatchCompact(event, comment) {
|
|
|
43798
43805
|
};
|
|
43799
43806
|
break;
|
|
43800
43807
|
}
|
|
43808
|
+
case "ask.asked_of": {
|
|
43809
|
+
const handedOnBy = ask.data.asked_of_by;
|
|
43810
|
+
record = {
|
|
43811
|
+
...record,
|
|
43812
|
+
asked_of: ask.data.asked_of ?? "the assignee of its issue",
|
|
43813
|
+
...handedOnBy === null || handedOnBy === undefined || handedOnBy === "" ? {} : { handed_on_by: handedOnBy }
|
|
43814
|
+
};
|
|
43815
|
+
break;
|
|
43816
|
+
}
|
|
43801
43817
|
case "ask.resolved": {
|
|
43802
43818
|
const resolved = askResolutionText(ask.data.resolution);
|
|
43803
43819
|
record = resolved === undefined ? record : { ...record, resolved };
|
|
@@ -48280,6 +48296,12 @@ function optionalString(args, name) {
|
|
|
48280
48296
|
const value = args[name];
|
|
48281
48297
|
return typeof value === "string" ? value : undefined;
|
|
48282
48298
|
}
|
|
48299
|
+
function optionalNullableString(args, name) {
|
|
48300
|
+
const value = args[name];
|
|
48301
|
+
if (value === null)
|
|
48302
|
+
return null;
|
|
48303
|
+
return typeof value === "string" ? value : undefined;
|
|
48304
|
+
}
|
|
48283
48305
|
function optionalBoolean(args, name) {
|
|
48284
48306
|
const value = args[name];
|
|
48285
48307
|
return typeof value === "boolean" ? value : undefined;
|
|
@@ -49477,6 +49499,8 @@ function eventHead(event) {
|
|
|
49477
49499
|
const previousAnswer = event.payload.previous_answer;
|
|
49478
49500
|
return `${textHead(event.payload.question)} -> ${textHead(askAnswerText(event.payload.answer))}${previousAnswer === undefined ? "" : ` (was: ${textHead(askAnswerText(previousAnswer))})`}`;
|
|
49479
49501
|
}
|
|
49502
|
+
case "ask.asked_of":
|
|
49503
|
+
return `${textHead(event.payload.question)} -> asked of ${event.payload.asked_of ?? "the assignee of its issue"}`;
|
|
49480
49504
|
case "comment.created":
|
|
49481
49505
|
case "comment.answered":
|
|
49482
49506
|
case "comment.anchor_refreshed":
|
|
@@ -49615,9 +49639,13 @@ function openAskAge(ageSeconds) {
|
|
|
49615
49639
|
const days = Math.floor(hours / 24);
|
|
49616
49640
|
return `${days}d${hours % 24 === 0 ? "" : ` ${hours % 24}h`}`;
|
|
49617
49641
|
}
|
|
49642
|
+
function openAskAskedOf(ask) {
|
|
49643
|
+
const person = ask.waiting_on_person;
|
|
49644
|
+
return person === undefined || person === "" ? "nobody" : person;
|
|
49645
|
+
}
|
|
49618
49646
|
function openAskLine(ask, baseUrl) {
|
|
49619
49647
|
const priority = ask.priority === null ? "" : `P${ask.priority} \xB7 `;
|
|
49620
|
-
return `- ${openAskAge(ask.age_seconds)} \xB7 ${priority}${ownerTitle(ask.owner)} \xB7 ${ask.question} \xB7 ${new URL(ask.ref, baseUrl).toString()}`;
|
|
49648
|
+
return `- ${openAskAge(ask.age_seconds)} \xB7 ${priority}${ownerTitle(ask.owner)} \xB7 asked of ${openAskAskedOf(ask)} \xB7 ${ask.question} \xB7 ${new URL(ask.ref, baseUrl).toString()}`;
|
|
49621
49649
|
}
|
|
49622
49650
|
function formatOpenAsksSummary(response, baseUrl) {
|
|
49623
49651
|
const scope = "active open asks you authored on open issues and project documents";
|
|
@@ -50368,6 +50396,7 @@ async function executeDispatchTool(input) {
|
|
|
50368
50396
|
const rankBefore = optionalString(args, "before");
|
|
50369
50397
|
const rankAfter = optionalString(args, "after");
|
|
50370
50398
|
const priority = optionalPriority(args, "priority");
|
|
50399
|
+
const assignee = optionalNullableString(args, "assignee");
|
|
50371
50400
|
const labels = Array.isArray(args.labels) ? args.labels : undefined;
|
|
50372
50401
|
const blockedBy = Array.isArray(args.blocked_by) ? args.blocked_by : undefined;
|
|
50373
50402
|
const requestedLinks = Array.isArray(args.external_links) ? [...new Set(args.external_links)] : undefined;
|
|
@@ -50413,6 +50442,7 @@ async function executeDispatchTool(input) {
|
|
|
50413
50442
|
...title === undefined ? {} : { title },
|
|
50414
50443
|
...labels === undefined ? {} : { labels },
|
|
50415
50444
|
...priority === undefined ? {} : { priority },
|
|
50445
|
+
...assignee === undefined ? {} : { assignee },
|
|
50416
50446
|
...route === undefined ? {} : { route },
|
|
50417
50447
|
...parent === undefined ? {} : { parent: parent === "" ? null : parent },
|
|
50418
50448
|
...blockedBy === undefined ? {} : { blocked_by: blockedBy },
|
|
@@ -50446,6 +50476,7 @@ async function executeDispatchTool(input) {
|
|
|
50446
50476
|
(after.labels ?? []).length === 0 ? "labels cleared" : `labels ${(after.labels ?? []).join(", ")}`
|
|
50447
50477
|
],
|
|
50448
50478
|
...priority === undefined ? [] : [after.priority === null ? "priority cleared" : `priority -> P${after.priority}`],
|
|
50479
|
+
...assignee === undefined ? [] : [after.assignee === null ? "assignee cleared" : `assignee -> ${after.assignee}`],
|
|
50449
50480
|
...rank === undefined ? [] : [
|
|
50450
50481
|
`rank -> ${[
|
|
50451
50482
|
...rankAfter === undefined ? [] : [`after ${rankAfter}`],
|
|
@@ -55408,7 +55439,7 @@ var import_nats2 = __toESM(require_mod4(), 1);
|
|
|
55408
55439
|
|
|
55409
55440
|
// package.json
|
|
55410
55441
|
var name = "@sjawhar/claude-envoy";
|
|
55411
|
-
var version2 = "1.
|
|
55442
|
+
var version2 = "1.32.0";
|
|
55412
55443
|
var legion = {
|
|
55413
55444
|
daemonApiVersion: 59
|
|
55414
55445
|
};
|
package/dist/session-hook.js
CHANGED
|
@@ -13742,6 +13742,9 @@ var askEventPayloadFields = {
|
|
|
13742
13742
|
actor: object({ kind: string2().optional(), id: string2().optional() }).passthrough().optional(),
|
|
13743
13743
|
at: string2().optional()
|
|
13744
13744
|
}).nullish(),
|
|
13745
|
+
asked_of: string2().nullish(),
|
|
13746
|
+
asked_of_by: string2().nullish(),
|
|
13747
|
+
asked_of_at: string2().nullish(),
|
|
13745
13748
|
thread_logins: array(string2()).optional()
|
|
13746
13749
|
};
|
|
13747
13750
|
var AskEventPayloadSchema = intersection(object(askEventPayloadFields), object({
|
|
@@ -14084,6 +14087,8 @@ var BOARD_NEIGHBOUR_REFUSAL = "The server refuses a key that does not exist, one
|
|
|
14084
14087
|
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.";
|
|
14085
14088
|
var ASK_QUESTION_CONTRACT = "The question names the concrete case first: which machines, files, sessions or people, and the " + "numbers. It asks the choice in those terms, saying what happens to whom under each option " + '("Ship Friday and risk signing out 1,240 users, or hold to Monday?"), never "How should we ' + 'proceed?" or "Which option?", because a reader cannot work back from a general question to ' + "the case. It carries every fact the reader needs to decide and nothing " + "that does not change the decision. Generalize only after the specifics, if at all. Then give " + "your recommendation and its reason.";
|
|
14086
14089
|
var ASK_OPTIONS_CONTRACT = "Options carry the genuinely different approaches. Each option has a label, and its description " + "says what that approach costs.";
|
|
14090
|
+
var ASK_IS_FOR_A_PERSON = "An ask is a question for a person, never a request to another agent. Ask an agent by envoy_send or a comment on the issue.";
|
|
14091
|
+
var ASK_WAITS_ON_THE_ASSIGNEE = "An ask waits on the issue's assignee until a person hands it on. No agent can hand one on.";
|
|
14087
14092
|
var HUMAN_AGREED_TO_DOCUMENT = "the human has agreed to every point in the document";
|
|
14088
14093
|
function documentOwnerValidation(requireArtifact, alwaysRequireArtifact = false) {
|
|
14089
14094
|
return {
|
|
@@ -14164,7 +14169,7 @@ var commentValidation = {
|
|
|
14164
14169
|
message: `${commentOwner.message} ${COMMENT_TURN_RULE}`,
|
|
14165
14170
|
refusal: (value) => commentProblem(value) ?? `${commentOwner.message} ${COMMENT_TURN_RULE}`
|
|
14166
14171
|
};
|
|
14167
|
-
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.";
|
|
14172
|
+
var ISSUE_UPDATE_FIELDS_RULE = "Issue update requires at least one field besides issue: status, title, labels, priority, assignee, external_links, route, parent, blocked_by, components, repo, before, or after.";
|
|
14168
14173
|
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";
|
|
14169
14174
|
var ISSUE_UPDATE_REASON_RULE = "reason goes only with status done";
|
|
14170
14175
|
var ISSUE_UPDATE_RULE = `${ISSUE_UPDATE_FIELDS_RULE} ${ISSUE_UPDATE_DONE_RULE}; ${ISSUE_UPDATE_REASON_RULE}.`;
|
|
@@ -14178,7 +14183,7 @@ function issueUpdateProblem(value) {
|
|
|
14178
14183
|
const status = typeof input.status === "string" ? `status ${input.status}` : "an update without status done";
|
|
14179
14184
|
return `${ISSUE_UPDATE_REASON_RULE}: it is the note posted on the issue as it closes, and ${status} closes nothing. Drop reason, or set status done to close the issue.`;
|
|
14180
14185
|
}
|
|
14181
|
-
const changesAField = typeof input.status === "string" || typeof input.title === "string" || Array.isArray(input.labels) || typeof input.priority === "number" || input.priority === null || Array.isArray(input.external_links) || typeof input.route === "string" || typeof input.parent === "string" || Array.isArray(input.blocked_by) || typeof input.components === "object" && input.components !== null || typeof input.repo === "string" || typeof input.before === "string" || typeof input.after === "string";
|
|
14186
|
+
const changesAField = typeof input.status === "string" || typeof input.title === "string" || Array.isArray(input.labels) || typeof input.priority === "number" || input.priority === null || typeof input.assignee === "string" || input.assignee === null || Array.isArray(input.external_links) || typeof input.route === "string" || typeof input.parent === "string" || Array.isArray(input.blocked_by) || typeof input.components === "object" && input.components !== null || typeof input.repo === "string" || typeof input.before === "string" || typeof input.after === "string";
|
|
14182
14187
|
return changesAField ? undefined : ISSUE_UPDATE_FIELDS_RULE;
|
|
14183
14188
|
}
|
|
14184
14189
|
var messageValidation = {
|
|
@@ -14310,7 +14315,7 @@ var dispatchToolSpecs = [
|
|
|
14310
14315
|
priority: 1,
|
|
14311
14316
|
before: "DSP-2"
|
|
14312
14317
|
},
|
|
14313
|
-
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}`,
|
|
14318
|
+
description: "Update an existing issue: move its lifecycle status, retitle it, replace its labels, set " + "its priority, set or clear its assignee, 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. assignee is the person who answers " + "this issue's asks, and every ask on it waits on them until a person hands that ask on. " + "Passing null unassigns the issue. Set the assignee when a person said who owns the work, as you " + "file the issue or hand it over. 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}`,
|
|
14314
14319
|
arguments: (z) => ({
|
|
14315
14320
|
issue: z.string().describe(ISSUE_REFERENCE),
|
|
14316
14321
|
status: z.enum(ISSUE_STATUSES).describe("New lifecycle status.").optional(),
|
|
@@ -14318,6 +14323,7 @@ var dispatchToolSpecs = [
|
|
|
14318
14323
|
title: z.string({ min: 1, max: ISSUE_TITLE_MAX }).describe("Replacement title, at most 1,000 characters.").optional(),
|
|
14319
14324
|
labels: z.array(z.string({ min: 1, max: 40 }), { max: 20 }).describe("Replacement label set, at most 20 labels of up to 40 characters; replaces every existing label.").optional(),
|
|
14320
14325
|
priority: z.number({ int: true, min: 0, max: 3 }).nullable().optional().describe("Coarse priority: 0 is P0 (highest) through 3 is P3 (lowest); null clears it."),
|
|
14326
|
+
assignee: z.string().nullable().optional().describe("Email of the person who answers this issue's asks (someone who has signed in to Dispatch); null unassigns the issue. Set it only when a person said who owns the issue, never to move a question off the person holding it."),
|
|
14321
14327
|
external_links: z.array(z.string({ min: 1 })).describe("URLs to link; a non-empty list merges into the issue's existing external links by URL, an empty list removes every link instead.").optional(),
|
|
14322
14328
|
route: z.string().describe("Route the issue to role:<name> or session:<id>; an empty string clears it.").optional(),
|
|
14323
14329
|
parent: z.string().describe("Parent issue key in the same project; an empty string clears the parent.").optional(),
|
|
@@ -14360,7 +14366,7 @@ var dispatchToolSpecs = [
|
|
|
14360
14366
|
}
|
|
14361
14367
|
]
|
|
14362
14368
|
},
|
|
14363
|
-
description: "Open a to-do or permission only a human can give, or a decision that has no document to " + "live in. A question about the design an issue's document records is not this tool: write " + "it into that document as a decision block (dispatch doc-edit inserting an ask block at the " + "end of the section it concerns), at every phase, approved spec or not; the block reaches " + "the Inbox and its answer lands next to its context. Never give an ask an Approve option: a " + "document is approved through dispatch request-approval. Do not use this tool for a status " + "update or discussion; use dispatch message instead. Never create an issue to park a " + "question: the question is an ask on the issue it concerns. " + ASK_QUESTION_CONTRACT + " " + ASK_OPTIONS_CONTRACT + " For an action only a human can perform, state what it changes and risks as constraints. " + "Anything that requires a human to do, including a credential or grant renewal, is an ask, " + "never a message. Measure what you can first, and put the measurement and the size of the " + "population it covers in the question; drop an option that cannot fix most of that " + "population, never offer it cut down, and keep an option not to act (Hold). Set urgency high " + "when your work halts on the answer, and keep working on everything else. " + "Anchor a to-do about a document passage, thread reply_to/reply_to_ask, or cite a dispatch:// " + `reference \u2014 it must be answerable from its own text and anchor alone, never "see above". ` + `A quote anchor is pinned to its block. ${ASK_BOUND_RULE} The lines images appends count ` + `toward that bound, and an ask has at most 8 options. ${RELATED_CHECK_RESULT} ` + `An ask among the related items says whether it is answered, by whom and with which options. ${OWNER_REFERENCE}`,
|
|
14369
|
+
description: `${ASK_IS_FOR_A_PERSON} ${ASK_WAITS_ON_THE_ASSIGNEE} ` + "Open a to-do or permission only a human can give, or a decision that has no document to " + "live in. A question about the design an issue's document records is not this tool: write " + "it into that document as a decision block (dispatch doc-edit inserting an ask block at the " + "end of the section it concerns), at every phase, approved spec or not; the block reaches " + "the Inbox and its answer lands next to its context. Never give an ask an Approve option: a " + "document is approved through dispatch request-approval. Do not use this tool for a status " + "update or discussion; use dispatch message instead. Never create an issue to park a " + "question: the question is an ask on the issue it concerns. " + ASK_QUESTION_CONTRACT + " " + ASK_OPTIONS_CONTRACT + " For an action only a human can perform, state what it changes and risks as constraints. " + "Anything that requires a human to do, including a credential or grant renewal, is an ask, " + "never a message. Measure what you can first, and put the measurement and the size of the " + "population it covers in the question; drop an option that cannot fix most of that " + "population, never offer it cut down, and keep an option not to act (Hold). Set urgency high " + "when your work halts on the answer, and keep working on everything else. " + "Anchor a to-do about a document passage, thread reply_to/reply_to_ask, or cite a dispatch:// " + `reference \u2014 it must be answerable from its own text and anchor alone, never "see above". ` + `A quote anchor is pinned to its block. ${ASK_BOUND_RULE} The lines images appends count ` + `toward that bound, and an ask has at most 8 options. ${RELATED_CHECK_RESULT} ` + `An ask among the related items says whether it is answered, by whom and with which options. ${OWNER_REFERENCE}`,
|
|
14364
14370
|
arguments: (z) => ({
|
|
14365
14371
|
issue: z.string().describe(ISSUE_REFERENCE).optional(),
|
|
14366
14372
|
project: z.string().describe("Project key owning the document.").optional(),
|
|
@@ -14398,7 +14404,7 @@ var dispatchToolSpecs = [
|
|
|
14398
14404
|
}
|
|
14399
14405
|
]
|
|
14400
14406
|
},
|
|
14401
|
-
description: "Edit an open question in place. Use it to correct or refine the same decision; retract the " + "old ask and open a new one when the decision itself changes. " + ASK_QUESTION_CONTRACT + " " + ASK_OPTIONS_CONTRACT + " Previous text remains in the event log. Only the asking session can edit it; answered or " + "resolved asks cannot be edited. An ask that lives as an `ask` block in a document is written " + "in the document too, changing only the fields you name - pass urgency alone and the " + "question's wording, formatting, links and comment anchors are untouched - so the edit " + "writes a document version and closes a spec's design gate until that version is approved; " + "text the block cannot carry back unchanged is refused, naming the field - an option label " + 'containing ": ", the separator between a label and its description, is one example.',
|
|
14407
|
+
description: `${ASK_IS_FOR_A_PERSON} ${ASK_WAITS_ON_THE_ASSIGNEE} ` + "Edit an open question in place. Use it to correct or refine the same decision; retract the " + "old ask and open a new one when the decision itself changes. " + ASK_QUESTION_CONTRACT + " " + ASK_OPTIONS_CONTRACT + " Previous text remains in the event log. Only the asking session can edit it; answered or " + "resolved asks cannot be edited. An ask that lives as an `ask` block in a document is written " + "in the document too, changing only the fields you name - pass urgency alone and the " + "question's wording, formatting, links and comment anchors are untouched - so the edit " + "writes a document version and closes a spec's design gate until that version is approved; " + "text the block cannot carry back unchanged is refused, naming the field - an option label " + 'containing ": ", the separator between a label and its description, is one example.',
|
|
14402
14408
|
arguments: (z) => ({
|
|
14403
14409
|
ask: z.string().describe("Ask id (uuid); an 8+ hex prefix unique among this session's own open asks works too."),
|
|
14404
14410
|
question: z.string().optional().describe(`${ASK_QUESTION_CONTRACT} Replaces the ask's question. ${ASK_BOUND_RULE}`),
|
|
@@ -18724,6 +18730,7 @@ var DISPATCH_PAYLOAD_SCHEMAS = {
|
|
|
18724
18730
|
"ask.anchor_refreshed": AskEventPayloadSchema,
|
|
18725
18731
|
"ask.edited": AskEditedEventPayloadSchema,
|
|
18726
18732
|
"ask.handed_back": AskEventPayloadSchema,
|
|
18733
|
+
"ask.asked_of": AskEventPayloadSchema,
|
|
18727
18734
|
"ask.answered": AskEventPayloadSchema,
|
|
18728
18735
|
"ask.resolved": AskEventPayloadSchema,
|
|
18729
18736
|
"comment.created": CommentEventPayloadSchema,
|
|
@@ -18843,6 +18850,15 @@ function dispatchCompact(event, comment) {
|
|
|
18843
18850
|
};
|
|
18844
18851
|
break;
|
|
18845
18852
|
}
|
|
18853
|
+
case "ask.asked_of": {
|
|
18854
|
+
const handedOnBy = ask.data.asked_of_by;
|
|
18855
|
+
record = {
|
|
18856
|
+
...record,
|
|
18857
|
+
asked_of: ask.data.asked_of ?? "the assignee of its issue",
|
|
18858
|
+
...handedOnBy === null || handedOnBy === undefined || handedOnBy === "" ? {} : { handed_on_by: handedOnBy }
|
|
18859
|
+
};
|
|
18860
|
+
break;
|
|
18861
|
+
}
|
|
18846
18862
|
case "ask.resolved": {
|
|
18847
18863
|
const resolved = askResolutionText(ask.data.resolution);
|
|
18848
18864
|
record = resolved === undefined ? record : { ...record, resolved };
|
|
@@ -20360,6 +20376,12 @@ function optionalString(args, name) {
|
|
|
20360
20376
|
const value = args[name];
|
|
20361
20377
|
return typeof value === "string" ? value : undefined;
|
|
20362
20378
|
}
|
|
20379
|
+
function optionalNullableString(args, name) {
|
|
20380
|
+
const value = args[name];
|
|
20381
|
+
if (value === null)
|
|
20382
|
+
return null;
|
|
20383
|
+
return typeof value === "string" ? value : undefined;
|
|
20384
|
+
}
|
|
20363
20385
|
function optionalBoolean(args, name) {
|
|
20364
20386
|
const value = args[name];
|
|
20365
20387
|
return typeof value === "boolean" ? value : undefined;
|
|
@@ -21557,6 +21579,8 @@ function eventHead(event) {
|
|
|
21557
21579
|
const previousAnswer = event.payload.previous_answer;
|
|
21558
21580
|
return `${textHead(event.payload.question)} -> ${textHead(askAnswerText(event.payload.answer))}${previousAnswer === undefined ? "" : ` (was: ${textHead(askAnswerText(previousAnswer))})`}`;
|
|
21559
21581
|
}
|
|
21582
|
+
case "ask.asked_of":
|
|
21583
|
+
return `${textHead(event.payload.question)} -> asked of ${event.payload.asked_of ?? "the assignee of its issue"}`;
|
|
21560
21584
|
case "comment.created":
|
|
21561
21585
|
case "comment.answered":
|
|
21562
21586
|
case "comment.anchor_refreshed":
|
|
@@ -21695,9 +21719,13 @@ function openAskAge(ageSeconds) {
|
|
|
21695
21719
|
const days = Math.floor(hours / 24);
|
|
21696
21720
|
return `${days}d${hours % 24 === 0 ? "" : ` ${hours % 24}h`}`;
|
|
21697
21721
|
}
|
|
21722
|
+
function openAskAskedOf(ask) {
|
|
21723
|
+
const person = ask.waiting_on_person;
|
|
21724
|
+
return person === undefined || person === "" ? "nobody" : person;
|
|
21725
|
+
}
|
|
21698
21726
|
function openAskLine(ask, baseUrl) {
|
|
21699
21727
|
const priority = ask.priority === null ? "" : `P${ask.priority} \xB7 `;
|
|
21700
|
-
return `- ${openAskAge(ask.age_seconds)} \xB7 ${priority}${ownerTitle(ask.owner)} \xB7 ${ask.question} \xB7 ${new URL(ask.ref, baseUrl).toString()}`;
|
|
21728
|
+
return `- ${openAskAge(ask.age_seconds)} \xB7 ${priority}${ownerTitle(ask.owner)} \xB7 asked of ${openAskAskedOf(ask)} \xB7 ${ask.question} \xB7 ${new URL(ask.ref, baseUrl).toString()}`;
|
|
21701
21729
|
}
|
|
21702
21730
|
function formatOpenAsksSummary(response, baseUrl) {
|
|
21703
21731
|
const scope = "active open asks you authored on open issues and project documents";
|
|
@@ -22448,6 +22476,7 @@ async function executeDispatchTool(input) {
|
|
|
22448
22476
|
const rankBefore = optionalString(args, "before");
|
|
22449
22477
|
const rankAfter = optionalString(args, "after");
|
|
22450
22478
|
const priority = optionalPriority(args, "priority");
|
|
22479
|
+
const assignee = optionalNullableString(args, "assignee");
|
|
22451
22480
|
const labels = Array.isArray(args.labels) ? args.labels : undefined;
|
|
22452
22481
|
const blockedBy = Array.isArray(args.blocked_by) ? args.blocked_by : undefined;
|
|
22453
22482
|
const requestedLinks = Array.isArray(args.external_links) ? [...new Set(args.external_links)] : undefined;
|
|
@@ -22493,6 +22522,7 @@ async function executeDispatchTool(input) {
|
|
|
22493
22522
|
...title === undefined ? {} : { title },
|
|
22494
22523
|
...labels === undefined ? {} : { labels },
|
|
22495
22524
|
...priority === undefined ? {} : { priority },
|
|
22525
|
+
...assignee === undefined ? {} : { assignee },
|
|
22496
22526
|
...route === undefined ? {} : { route },
|
|
22497
22527
|
...parent === undefined ? {} : { parent: parent === "" ? null : parent },
|
|
22498
22528
|
...blockedBy === undefined ? {} : { blocked_by: blockedBy },
|
|
@@ -22526,6 +22556,7 @@ async function executeDispatchTool(input) {
|
|
|
22526
22556
|
(after.labels ?? []).length === 0 ? "labels cleared" : `labels ${(after.labels ?? []).join(", ")}`
|
|
22527
22557
|
],
|
|
22528
22558
|
...priority === undefined ? [] : [after.priority === null ? "priority cleared" : `priority -> P${after.priority}`],
|
|
22559
|
+
...assignee === undefined ? [] : [after.assignee === null ? "assignee cleared" : `assignee -> ${after.assignee}`],
|
|
22529
22560
|
...rank === undefined ? [] : [
|
|
22530
22561
|
`rank -> ${[
|
|
22531
22562
|
...rankAfter === undefined ? [] : [`after ${rankAfter}`],
|
package/package.json
CHANGED
package/skills/dispatch/SKILL.md
CHANGED
|
@@ -14,24 +14,23 @@ Dispatch is a record for the people who decide, never a log of your work.
|
|
|
14
14
|
|
|
15
15
|
## Asks and ask blocks
|
|
16
16
|
|
|
17
|
-
-
|
|
17
|
+
- An ask is a question for a person, never a request to another agent. Ask an agent by envoy_send or a comment on the issue.
|
|
18
|
+
- An ask waits on the issue's assignee until a person hands it on. No agent can hand one on.
|
|
19
|
+
- A design question a document records is an ask block at the end of its section:
|
|
18
20
|
|
|
19
21
|
```md
|
|
20
22
|
:::ask{urgency="med"}
|
|
21
|
-
The question and the recommendation
|
|
23
|
+
The question and the recommendation (`skill://dispatch-writing-specs`).
|
|
22
24
|
|
|
23
25
|
- Option one: what it costs.
|
|
24
26
|
- Option two: what it costs.
|
|
25
27
|
:::
|
|
26
28
|
```
|
|
27
29
|
|
|
28
|
-
-
|
|
29
|
-
-
|
|
30
|
-
- Change an open ask's block with `dispatch edit-ask`, or `doc-edit`'s `replace` or `move`. An answered ask is fixed: ask anew.
|
|
30
|
+
- Never repeat an open ask in a message.
|
|
31
|
+
- Change an open ask's block with `dispatch edit-ask` (its ask id), or `doc-edit`'s `replace` or `move` (its block id). An answered ask is fixed: ask anew. `dispatch read --ref` takes either id.
|
|
31
32
|
- Reply on an open ask with `dispatch comment --reply-to-ask`; `--turn agent` (a progress note) needs it. An approval request a newer version moved needs `request-approval` again.
|
|
32
33
|
- When an answer's option and text disagree, the text wins.
|
|
33
|
-
- An ask block has a block id, for `doc-edit`, and an ask id, for the ask commands. `dispatch read --ref dispatch://KEY/ask/<id>` takes either.
|
|
34
|
-
- An ask reaches the issue's assignee; if none, name who answers.
|
|
35
34
|
|
|
36
35
|
## Choosing what to work on
|
|
37
36
|
|