@sjawhar/opencode-legion-envoy 9.0.0 → 9.2.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 +162 -41
- package/dist/src/server.js +20 -17
- package/package.json +1 -1
- package/skills/AGENTS.md +7 -6
- package/skills/dispatch/SKILL.md +54 -169
- package/skills/dispatch-first/SKILL.md +23 -17
- package/skills/dispatch-writing-specs/SKILL.md +76 -0
- package/skills/leading-a-work-stream/SKILL.md +96 -0
- package/skills/leading-a-work-stream/references/daily-plan.md +8 -0
- package/skills/leading-a-work-stream/references/decision-rights.md +6 -0
- package/skills/leading-a-work-stream/references/direction-and-coaching.md +13 -0
- package/skills/leading-a-work-stream/references/dispatch-upkeep.md +7 -0
- package/skills/leading-a-work-stream/references/sources.md +9 -0
- package/skills/leading-a-work-stream/references/speed-tick.md +44 -0
- package/skills/leading-a-work-stream/references/user-quotes.md +7 -0
- package/skills/legion-architect/SKILL.md +11 -8
- package/skills/legion-architect/references/acceptance.md +18 -5
- package/skills/legion-architect/references/decomposition.md +3 -2
- package/skills/legion-architect/references/design-gate.md +42 -19
- package/skills/legion-architect/references/wake-routing.md +4 -4
- package/skills/legion-controller/SKILL.md +31 -17
- package/skills/legion-controller/references/admission.md +5 -3
- package/skills/legion-controller/references/backlog-stewardship.md +17 -2
- package/skills/legion-controller/references/daily-report.md +4 -4
- package/skills/legion-controller/references/finding-asks.md +111 -14
- package/skills/legion-controller/references/slack-mentions.md +2 -2
- package/skills/legion-controller/references/triage.md +9 -5
- package/skills/legion-controller/references/wakes.md +22 -8
- package/skills/legion-worker/SKILL.md +7 -6
- package/skills/legion-worker/references/conflicts-and-rewrites.md +23 -16
- package/skills/legion-worker/references/findings.md +126 -31
- package/skills/legion-worker/references/merge-gate.md +57 -25
- package/skills/legion-worker/references/pr-body.md +9 -5
- package/skills/legion-worker/references/skip-checks-trailer.md +1 -1
- package/skills/dispatch/references/api.md +0 -21
- package/skills/dispatch/references/asks.md +0 -43
- package/skills/dispatch/references/document-edits.md +0 -59
- package/skills/dispatch/references/documents.md +0 -79
- package/skills/dispatch/references/examples.md +0 -85
- package/skills/dispatch/references/issues.md +0 -66
- package/skills/dispatch/references/messages.md +0 -31
- package/skills/dispatch/references/reading.md +0 -32
- package/skills/dispatch-brainstorming/SKILL.md +0 -56
package/dist/dispatch.js
CHANGED
|
@@ -13623,6 +13623,7 @@ var askEventPayloadFields = {
|
|
|
13623
13623
|
text: exports_external.string().nullish(),
|
|
13624
13624
|
at: exports_external.string().optional()
|
|
13625
13625
|
}).nullish(),
|
|
13626
|
+
restored: exports_external.boolean().optional(),
|
|
13626
13627
|
anchor: exports_external.object({
|
|
13627
13628
|
quote: exports_external.string().optional(),
|
|
13628
13629
|
mark_id: exports_external.string().optional(),
|
|
@@ -13793,19 +13794,17 @@ function actorName(actor, titles) {
|
|
|
13793
13794
|
const live = titles?.get(actor.id)?.trim();
|
|
13794
13795
|
return sessionLabel(actor.id, live === undefined || live === "" ? actor.origin?.session_title : live);
|
|
13795
13796
|
}
|
|
13796
|
-
function
|
|
13797
|
-
const name = actorName(actor, titles);
|
|
13797
|
+
function actorAttribution(actor) {
|
|
13798
13798
|
if (actor.kind !== "session") {
|
|
13799
|
-
return
|
|
13799
|
+
return "";
|
|
13800
13800
|
}
|
|
13801
13801
|
if (actor.owner !== undefined) {
|
|
13802
|
-
return
|
|
13803
|
-
}
|
|
13804
|
-
const service = actor.service;
|
|
13805
|
-
if (service === undefined) {
|
|
13806
|
-
return name;
|
|
13802
|
+
return ` (for ${actor.owner})`;
|
|
13807
13803
|
}
|
|
13808
|
-
return
|
|
13804
|
+
return actor.service === undefined ? "" : ` (as ${serviceSubjectLabel(actor.service)})`;
|
|
13805
|
+
}
|
|
13806
|
+
function actorLabel(actor, titles) {
|
|
13807
|
+
return `${actorName(actor, titles)}${actorAttribution(actor)}`;
|
|
13809
13808
|
}
|
|
13810
13809
|
// ../contracts/src/agent-stream.ts
|
|
13811
13810
|
var AGENT_STREAM_LIMITS = {
|
|
@@ -13858,6 +13857,44 @@ function itemFromSearch(search) {
|
|
|
13858
13857
|
}
|
|
13859
13858
|
return ask === null ? { id, kind: "comment" } : { id, kind: "ask" };
|
|
13860
13859
|
}
|
|
13860
|
+
|
|
13861
|
+
// ../contracts/src/dispatch-block-ref.ts
|
|
13862
|
+
var encoder = new TextEncoder;
|
|
13863
|
+
function encodeBlockId(id) {
|
|
13864
|
+
let encoded = "";
|
|
13865
|
+
for (const character of id) {
|
|
13866
|
+
for (const byte of encoder.encode(character)) {
|
|
13867
|
+
const bare = byte >= 48 && byte <= 57 || byte >= 65 && byte <= 90 || byte >= 97 && byte <= 122 || byte === 45;
|
|
13868
|
+
encoded += bare ? String.fromCharCode(byte) : `%${byte.toString(16).toUpperCase().padStart(2, "0")}`;
|
|
13869
|
+
}
|
|
13870
|
+
}
|
|
13871
|
+
return encoded;
|
|
13872
|
+
}
|
|
13873
|
+
function decodeBlockId(encoded) {
|
|
13874
|
+
if (encoded === "" || encoded.includes("@")) {
|
|
13875
|
+
return;
|
|
13876
|
+
}
|
|
13877
|
+
let id;
|
|
13878
|
+
try {
|
|
13879
|
+
id = decodeURIComponent(encoded);
|
|
13880
|
+
} catch {
|
|
13881
|
+
return;
|
|
13882
|
+
}
|
|
13883
|
+
return id === "" || hasControlCharacter(id) ? undefined : id;
|
|
13884
|
+
}
|
|
13885
|
+
var MAX_BLOCK_PIN = 9223372036854775807n;
|
|
13886
|
+
function parseBlockFragment(encoded) {
|
|
13887
|
+
const at = encoded.indexOf("@");
|
|
13888
|
+
const pin = at === -1 ? undefined : encoded.slice(at + 1).match(/^v([1-9][0-9]*)$/)?.[1];
|
|
13889
|
+
if (at !== -1 && (pin === undefined || BigInt(pin) > MAX_BLOCK_PIN)) {
|
|
13890
|
+
return;
|
|
13891
|
+
}
|
|
13892
|
+
const block = decodeBlockId(at === -1 ? encoded : encoded.slice(0, at));
|
|
13893
|
+
if (block === undefined) {
|
|
13894
|
+
return;
|
|
13895
|
+
}
|
|
13896
|
+
return pin === undefined ? { block } : { block, pin };
|
|
13897
|
+
}
|
|
13861
13898
|
// ../contracts/src/dispatch-snippet.ts
|
|
13862
13899
|
var HTML_ENTITIES = [
|
|
13863
13900
|
["<", "<"],
|
|
@@ -14014,7 +14051,7 @@ function componentsArgument(z2) {
|
|
|
14014
14051
|
reason: z2.string({ min: 1 }).describe("For mode none: why this issue is not architectural (process, hiring, ops).").optional()
|
|
14015
14052
|
}).describe("Attach the issue to architecture components. Attach the root before decomposing it; children inherit unless they choose.");
|
|
14016
14053
|
}
|
|
14017
|
-
var SPEC_WRITING_POINTER =
|
|
14054
|
+
var SPEC_WRITING_POINTER = "Write a spec as skill://dispatch-writing-specs says.";
|
|
14018
14055
|
function imagesArgument(z2, owner, cap) {
|
|
14019
14056
|
return z2.array(z2.string({ min: 1 }), { min: 1 }).describe(`Optional local picture files to show inline: PNG, JPEG, GIF or WebP (by their bytes, not their name), each at most 25 MiB. Each is uploaded to ${owner} and appended after a blank line as one  line, in this order; those lines count toward ${cap}.`).optional();
|
|
14020
14057
|
}
|
|
@@ -14052,7 +14089,7 @@ var dispatchToolSpecs = [
|
|
|
14052
14089
|
{
|
|
14053
14090
|
name: "dispatch_issue",
|
|
14054
14091
|
example: { project: "DSP", title: "Native workspace" },
|
|
14055
|
-
description: "Create a native Dispatch issue for newly tracked work. Search first with dispatch search; if potentially duplicate issues exist, this returns 409 POSSIBLE_DUPLICATE unless --force is set after reading them. " + "When passing a spec, before calling, have a fresh read-only reader check it against the code and the human's words, then resolve every finding; a Legion architect uses `plan-gap-analyst`. " + "A spec holding an ask block whose body breaks its content rule (one or more question paragraphs, then at most one bullet list of options, last) is refused with 400 INVALID_ASK_BLOCK. " + `Do not use it when an existing issue already covers the work; read or update that issue instead. ${ISSUE_REFERENCE}`,
|
|
14092
|
+
description: "Create a native Dispatch issue for newly tracked work. Search first with dispatch search; if potentially duplicate issues exist, this returns 409 POSSIBLE_DUPLICATE unless --force is set after reading them. " + "When passing a spec, before calling, have a fresh read-only reader check it against the code and the human's words, then resolve every finding; a Legion architect uses `plan-gap-analyst`. " + "A spec holding an ask block whose body breaks its content rule (one or more question paragraphs, then at most one bullet list of options, last) is refused with 400 INVALID_ASK_BLOCK. " + "Create a project only when a person asks for one; work that spans projects goes in the project that owns most of it. " + `Do not use it when an existing issue already covers the work; read or update that issue instead. ${ISSUE_REFERENCE}`,
|
|
14056
14093
|
arguments: (z2) => ({
|
|
14057
14094
|
project: z2.string().describe("Project key for the new issue."),
|
|
14058
14095
|
title: z2.string({ max: ISSUE_TITLE_MAX }).describe("Concise issue title, at most 1,000 characters."),
|
|
@@ -14063,7 +14100,7 @@ var dispatchToolSpecs = [
|
|
|
14063
14100
|
spec: z2.string().describe(`Optional initial primary-document markdown. ${SPEC_WRITING_POINTER}`).optional(),
|
|
14064
14101
|
labels: z2.array(z2.string({ min: 1, max: 40 }), { max: 20 }).describe("Optional initial labels, at most 20 labels of up to 40 characters.").optional(),
|
|
14065
14102
|
priority: z2.number({ int: true, min: 0, max: 3 }).describe("Optional coarse priority, a number from 0 to 3: 0 is highest and 3 is lowest.").optional(),
|
|
14066
|
-
assignee: z2.string().describe("Email of the person who answers this issue's asks (someone who has signed in to Dispatch); defaults to your owner when you act for a person, else the parent's assignee, else the project's default assignee when it still names a person who has signed in, else unassigned.").optional(),
|
|
14103
|
+
assignee: z2.string().describe("Email of the person who answers this issue's asks (someone who has signed in to Dispatch); defaults to your owner when you act for a person, else the parent's assignee, else the project's default assignee when it still names a person who has signed in, else unassigned. Set it only when a person said who owns the issue.").optional(),
|
|
14067
14104
|
components: componentsArgument(z2).optional(),
|
|
14068
14105
|
repo: z2.string().describe("The repository the issue targets, owner/name, mapped to the issue's project in Settings; a child inherits its parent's when unset, and an issue with none on its parent chain takes the project's default.").optional()
|
|
14069
14106
|
})
|
|
@@ -14075,7 +14112,7 @@ var dispatchToolSpecs = [
|
|
|
14075
14112
|
priority: 1,
|
|
14076
14113
|
before: "DSP-2"
|
|
14077
14114
|
},
|
|
14078
|
-
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, because a closed issue refuses messages, comments, and " + "artifacts; reason goes only with status done. A closed issue 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. At least one " + `field besides issue is required. ${ISSUE_REFERENCE}`,
|
|
14115
|
+
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, because a closed issue refuses messages, comments, and " + "artifacts; reason goes only with status done. A closed issue 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}`,
|
|
14079
14116
|
arguments: (z2) => ({
|
|
14080
14117
|
issue: z2.string().describe(ISSUE_REFERENCE),
|
|
14081
14118
|
status: z2.enum(ISSUE_STATUSES).describe("New lifecycle status.").optional(),
|
|
@@ -14125,12 +14162,12 @@ var dispatchToolSpecs = [
|
|
|
14125
14162
|
}
|
|
14126
14163
|
]
|
|
14127
14164
|
},
|
|
14128
|
-
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. " + 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. " + "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. Question is at most ${ASK_QUESTION_MAX} characters, ` + `the lines images appends included, and has at most 8 options. ${OWNER_REFERENCE}`,
|
|
14165
|
+
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. Question is at most ${ASK_QUESTION_MAX} characters, ` + `the lines images appends included, and has at most 8 options. ${OWNER_REFERENCE}`,
|
|
14129
14166
|
arguments: (z2) => ({
|
|
14130
14167
|
issue: z2.string().describe(ISSUE_REFERENCE).optional(),
|
|
14131
14168
|
project: z2.string().describe("Project key owning the document.").optional(),
|
|
14132
14169
|
artifact: z2.string().describe("Project document artifact id, slug, or filename.").optional(),
|
|
14133
|
-
ref: z2.string().describe("Optional dispatch:// reference (issue, document, message, or ask); appended to the question and rendered as a link.").optional(),
|
|
14170
|
+
ref: z2.string().describe("Optional dispatch:// reference (issue, document, block, message, or ask); appended to the question and rendered as a link.").optional(),
|
|
14134
14171
|
question: z2.string({ max: ASK_QUESTION_MAX }).describe(`${ASK_QUESTION_CONTRACT} At most ${ASK_QUESTION_MAX} characters.`),
|
|
14135
14172
|
options: z2.array(z2.object({
|
|
14136
14173
|
label: z2.string().describe("Selectable option label."),
|
|
@@ -14189,7 +14226,7 @@ var dispatchToolSpecs = [
|
|
|
14189
14226
|
kind: "retracted",
|
|
14190
14227
|
reason: "A newer question supersedes this one."
|
|
14191
14228
|
},
|
|
14192
|
-
description: "Retract an open question that is moot or resolve one after finding the answer. This closes " + "the question without answering it. An ask that lives as an `ask` block in a document is " + 'closed in the document too. A reason beginning "removed from the document in version" is ' + "refused: that marks a retraction the document's own settlement wrote.",
|
|
14229
|
+
description: "Retract an open question that is moot or resolve one after finding the answer. This closes " + "the question without answering it. An ask that lives as an `ask` block in a document is " + 'closed in the document too. A reason beginning "removed from the document in version" is ' + "refused: that marks a retraction the document's own settlement wrote. Use retracted for an ask " + "a newer one replaces or the design made moot, resolved for one whose answer you found; an " + "answered ask cannot be resolved, and resolving records no decision by a person.",
|
|
14193
14230
|
arguments: (z2) => ({
|
|
14194
14231
|
ask: z2.string().describe("Ask id (uuid) to close; an 8+ hex prefix unique among this session's own open asks " + "works too."),
|
|
14195
14232
|
kind: z2.enum(["retracted", "resolved"]).describe("Whether the ask is retracted or self-resolved."),
|
|
@@ -14218,7 +14255,7 @@ var dispatchToolSpecs = [
|
|
|
14218
14255
|
{
|
|
14219
14256
|
name: "dispatch_comment",
|
|
14220
14257
|
example: { issue: "DSP-1", body: "Looks good." },
|
|
14221
|
-
description: "Add review feedback to an issue or project document quote, or reply to a question asked with dispatch ask. " + "Do not use it for an exact replacement; use " + `dispatch suggest instead. A quote anchor is pinned to its block. Body is at most ${DISPATCH_BODY_MAX} characters, the lines images appends included. ${OWNER_REFERENCE}`,
|
|
14258
|
+
description: "Add review feedback to an issue or project document quote, or reply to a question asked with dispatch ask. " + "Do not use it for an exact replacement; use " + `dispatch suggest instead. A quote anchor is pinned to its block. A reply under an open ask asks for clarification, not an answer: answer it with reply_to_ask, or reword the ask with dispatch edit-ask, rather than opening a second ask. Body is at most ${DISPATCH_BODY_MAX} characters, the lines images appends included. ${OWNER_REFERENCE}`,
|
|
14222
14259
|
arguments: (z2) => ({
|
|
14223
14260
|
issue: z2.string().describe(ISSUE_REFERENCE).optional(),
|
|
14224
14261
|
project: z2.string().describe("Project key owning the document.").optional(),
|
|
@@ -14258,7 +14295,7 @@ var dispatchToolSpecs = [
|
|
|
14258
14295
|
{
|
|
14259
14296
|
name: "dispatch_message",
|
|
14260
14297
|
example: { issue: "DSP-1", body: "Implementation started." },
|
|
14261
|
-
description: "Post a note humans must read now: a reply to a human's message or a deliverable that landed. A to-do only a human can " + "complete is an ask (dispatch ask), so it reaches their inbox. Never progress or status updates - Dispatch is a high-signal " + "record, not a log. Not a design decision (write it as a decision block in the document) or document feedback (dispatch comment). " + "To answer a human's direct message to this session - one sent from the Agents page, which names no issue - pass that message's bare id as " + "in_reply_to and no issue; the reply lands in that conversation. Another call with the same in_reply_to and new text posts a follow-up, " + "threaded under this session's first reply; the same text again posts nothing. dispatch read --message <id> reads " + "that conversation back. Every other message names its issue. " + `Body is at most ${DISPATCH_BODY_MAX} characters, the lines images appends included. ${ISSUE_REFERENCE}`,
|
|
14298
|
+
description: "Post a note humans must read now: a reply to a human's message or a deliverable that landed. A to-do only a human can " + "complete is an ask (dispatch ask), so it reaches their inbox. Never progress or status updates - Dispatch is a high-signal " + "record, not a log. Not a design decision (write it as a decision block in the document) or document feedback (dispatch comment). " + "To answer a human's direct message to this session - one sent from the Agents page, which names no issue - pass that message's bare id as " + "in_reply_to and no issue; the reply lands in that conversation. Another call with the same in_reply_to and new text posts a follow-up, " + "threaded under this session's first reply; the same text again posts nothing. dispatch read --message <id> reads " + "that conversation back. " + "Every other message names its issue; keep --issue whenever the frame you answer gave one. A BTW, Aside or Steer " + "frame carries a reply_with command: answer with it, on that issue. On Oh My Pi an Agents-page Send or Aside " + "arrives as a user message: answer in the conversation, with no dispatch message. " + `Body is at most ${DISPATCH_BODY_MAX} characters, the lines images appends included. ${ISSUE_REFERENCE}`,
|
|
14262
14299
|
arguments: (z2) => ({
|
|
14263
14300
|
issue: z2.string().describe(`${ISSUE_REFERENCE} Omit it only when in_reply_to answers a human's direct message to this session.`).optional(),
|
|
14264
14301
|
body: z2.string({ max: DISPATCH_BODY_MAX }).describe(`Update text, at most ${DISPATCH_BODY_MAX} characters.`),
|
|
@@ -14275,7 +14312,7 @@ var dispatchToolSpecs = [
|
|
|
14275
14312
|
ops: [{ op: "delete_column", block: "table-123", index: 1 }],
|
|
14276
14313
|
precondition: { blocks: [{ id: "table-123", token: "sha256:current-table-token" }] }
|
|
14277
14314
|
},
|
|
14278
|
-
description: "Apply deterministic document edits: replace or delete quoted text, insert markdown at an anchor, retype an identified paragraph or typed block into a schema-declared typed block, delete or move a whole block by its id, or delete a table row or column in place. " + "Do not use it for review feedback or for reading; use dispatch comment, dispatch suggest, or dispatch doc-read instead. " + `For replace, delete, and quote anchors, find text as rendered: inline Markdown (**bold**, \`code\`) is tolerated and must be balanced; a leading '# ' matches a heading at any level. replace is inline: with is the new text of the matched span, so a marker of a different kind from the block's own stays literal text ('4. Design' written into a heading). A with that opens with a marker of the same kind as the matched block's own would write it twice and is INVALID_OP - including prose that merely looks like one ('1999. was a year' into an ordered item), which you write as text by escaping it ('1999\\. was a year'). The exception is a heading rename whose find carried a heading marker: replace(find="## Old", with="## New") gives '## New', and a different level applies only when find named the heading's actual level (find "## Old" with "### New" makes it an h3), since '# ' selects a heading without naming its level. A task item (\`- [ ]\` / \`- [x]\`) is ticked the same way: when find matches from the start of the item's text and with opens with '[x] ' or '[ ] ', the opening sets the item's box and the rest is its new text (replace(find="Write it", with="[x] Write it") ticks it); the same opening over a plain list item or a paragraph stays literal text. Any non-empty with that renders to no text - a line indented four spaces or a tab, which markdown reads as a code block, or whitespace alone - is INVALID_OP rather than a silent deletion; pass an empty with to delete the matched text on purpose - a list item, quote, typed block or footnote definition left holding only the emptied paragraph keeps it. ` + "with cannot open a new block: after a hard line break inside with (two trailing spaces, or a backslash, before the newline) a heading, bullet, '1.'/'1)' ordered, or '>' blockquote marker is INVALID_OP too, since that line would stay escaped text inside the matched block - use insert, plus delete for what it replaces, to add the block. A hard break in with is itself INVALID_OP when the matched text is in a heading or a table cell, which are written on one line. " + "A delete whose find is a block's entire text removes the block (a list emptied of its items goes too); delete with block removes any block by id, and move with block relocates one. A delete or retype that would take an ask block out of the document while its ask is open is refused, with nothing sent. delete_row and delete_column take a table block and a zero-based index, preserving the table block id and refusing to remove cells with open asks or unresolved comments. " + `Insert and move anchors also accept "start", "end", "heading:<exact heading text>", and "block:<id>"; dispatch doc-read --blocks lists every block's id, type, opening words and token, and each table's rows and cells with the indexes delete_row and delete_column take (GET /api/v1/artifacts/{artifact UUID}/blocks serves the same list). ` + "Optionally require the state just read: precondition selects exactly one of a document token from dispatch doc-read, or block {id, token} values from dispatch doc-read --blocks. A block guard must include every block the batch changes; Dispatch resolves quote targets and rejects an uncovered batch rather than applying it. Use a document token for insert or move, which depend on document order. Prefer block tokens when the covered content blocks are independent sections. Tokens include inline marks, so a fresh human comment also makes a stale edit fail. PRECONDITION_FAILED means re-read; EDIT_QUEUE_FULL means back off before retrying. " + "The result carries the document token this edit produced, so a chain of guarded edits passes each result's token as the next edit's precondition with no dispatch doc-read between them. " + "A batch that leaves the document exactly as it was mints no version, named or not, and the result says nothing changed and names each operation that did nothing. " + "A change a browser removes while the edit is in flight is never reported as applied: EDIT_LOST_TO_CONCURRENT_CHANGE means the write was refused and nothing was written, so re-read the document and decide again, as with PRECONDITION_FAILED; lost_ops on a successful result names operations whose text the live document no longer has, because the deletion landed after the version was written. " + `The spec
|
|
14315
|
+
description: "Apply deterministic document edits: replace or delete quoted text, insert markdown at an anchor, retype an identified paragraph or typed block into a schema-declared typed block, delete or move a whole block by its id, or delete a table row or column in place. " + "Do not use it for review feedback or for reading; use dispatch comment, dispatch suggest, or dispatch doc-read instead. " + `For replace, delete, and quote anchors, find text as rendered: inline Markdown (**bold**, \`code\`) is tolerated and must be balanced; a leading '# ' matches a heading at any level. replace is inline: with is the new text of the matched span, so a marker of a different kind from the block's own stays literal text ('4. Design' written into a heading). A with that opens with a marker of the same kind as the matched block's own would write it twice and is INVALID_OP - including prose that merely looks like one ('1999. was a year' into an ordered item), which you write as text by escaping it ('1999\\. was a year'). The exception is a heading rename whose find carried a heading marker: replace(find="## Old", with="## New") gives '## New', and a different level applies only when find named the heading's actual level (find "## Old" with "### New" makes it an h3), since '# ' selects a heading without naming its level. A task item (\`- [ ]\` / \`- [x]\`) is ticked the same way: when find matches from the start of the item's text and with opens with '[x] ' or '[ ] ', the opening sets the item's box and the rest is its new text (replace(find="Write it", with="[x] Write it") ticks it); the same opening over a plain list item or a paragraph stays literal text. Any non-empty with that renders to no text - a line indented four spaces or a tab, which markdown reads as a code block, or whitespace alone - is INVALID_OP rather than a silent deletion; pass an empty with to delete the matched text on purpose - a list item, quote, typed block or footnote definition left holding only the emptied paragraph keeps it. ` + "with cannot open a new block: after a hard line break inside with (two trailing spaces, or a backslash, before the newline) a heading, bullet, '1.'/'1)' ordered, or '>' blockquote marker is INVALID_OP too, since that line would stay escaped text inside the matched block - use insert, plus delete for what it replaces, to add the block. A hard break in with is itself INVALID_OP when the matched text is in a heading or a table cell, which are written on one line. " + "A delete whose find is a block's entire text removes the block (a list emptied of its items goes too); delete with block removes any block by id, and move with block relocates one. A delete or retype that would take an ask block out of the document while its ask is open is refused, with nothing sent. delete_row and delete_column take a table block and a zero-based index, preserving the table block id and refusing to remove cells with open asks or unresolved comments. " + `Insert and move anchors also accept "start", "end", "heading:<exact heading text>", and "block:<id>"; dispatch doc-read --blocks lists every block's id, type, opening words and token, and each table's rows and cells with the indexes delete_row and delete_column take (GET /api/v1/artifacts/{artifact UUID}/blocks serves the same list). ` + "Optionally require the state just read: precondition selects exactly one of a document token from dispatch doc-read, or block {id, token} values from dispatch doc-read --blocks. A block guard must include every block the batch changes; Dispatch resolves quote targets and rejects an uncovered batch rather than applying it. Use a document token for insert or move, which depend on document order. Prefer block tokens when the covered content blocks are independent sections. Tokens include inline marks, so a fresh human comment also makes a stale edit fail. PRECONDITION_FAILED means re-read; EDIT_QUEUE_FULL means back off before retrying. " + "The result carries the document token this edit produced, so a chain of guarded edits passes each result's token as the next edit's precondition with no dispatch doc-read between them. " + "A batch that leaves the document exactly as it was mints no version, named or not, and the result says nothing changed and names each operation that did nothing. " + "A change a browser removes while the edit is in flight is never reported as applied: EDIT_LOST_TO_CONCURRENT_CHANGE means the write was refused and nothing was written, so re-read the document and decide again, as with PRECONDITION_FAILED; lost_ops on a successful result names operations whose text the live document no longer has, because the deletion landed after the version was written. " + "One replace per paragraph: more new paragraphs go in one insert after the last one you rewrote, since two inserts at one anchor come out reversed; read the passage back with dispatch doc-read afterwards. " + "A block id written as {#id} longer than 256 bytes is stored, but its block is no graph node, so no reference reaches it. " + `The spec holds requirements, design, and decisions - never progress, status, or timestamps; a record of open items or progress is a document of its own. ${OWNER_REFERENCE} ${SPEC_WRITING_POINTER}`,
|
|
14279
14316
|
arguments: (z2) => ({
|
|
14280
14317
|
issue: z2.string().describe(ISSUE_REFERENCE).optional(),
|
|
14281
14318
|
project: z2.string().describe("Project key owning the document.").optional(),
|
|
@@ -14322,12 +14359,12 @@ var dispatchToolSpecs = [
|
|
|
14322
14359
|
{
|
|
14323
14360
|
name: "dispatch_request_approval",
|
|
14324
14361
|
example: { issue: "DSP-1", summary: "A live sync replaces the nightly export." },
|
|
14325
|
-
description: "Ask a human to approve a document at its current version. Before calling, have a fresh read-only reader check the spec against the code and the human's words, then resolve every finding; a Legion architect
|
|
14362
|
+
description: "Ask a human to approve a document at its current version. Before calling, have a fresh read-only reader check the spec against the code and the human's words, then resolve every finding; a Legion architect runs `plan-gap-analyst` and `plan-reviewer`. Opens an approval ask (Approve / " + "Request changes) in the human's Inbox whose question names the document and version, " + "followed by the summary; the answer pins a review to that version and arrives as " + "artifact.approved or artifact.changes_requested. An open request follows the document: a " + "later version moves it to that version and leaves it waiting on you, as a human's reply in " + "its thread does. Only the first move since the request was opened or handed back sends an " + "event, and never to the session whose version made it; dispatch doc-read shows whom it " + "waits on. Once the revision is complete and " + HUMAN_AGREED_TO_DOCUMENT + ", call this again to hand that same Inbox row back. The request carries nothing new. A " + "call while it already waits on the human hands nothing back: the same summary changes " + "nothing, and a different one is refused, since it would rewrite the card the human is " + "reading. Approve and Request changes each close the request, so the next call opens a new " + "one. Call it once per revision, when the revision is complete, never after each edit. An " + "approval goes stale when the document changes outside its decision blocks after it: " + "request approval again once that revision is complete and " + HUMAN_AGREED_TO_DOCUMENT + ", with a one-sentence summary naming what changed since the earlier approval: the card " + "names that approval (version, date, reviewer) and its Show diff control carries the detail. " + "A human's own answer to a decision block carries the approval to the version it writes when " + "that answer is the whole change since the approved version, so nothing is requested for " + "it. A new version of a Legion root spec closes its armed design gate until a human " + "approves it; the carried approval reopens it too. " + "Refused, with nothing sent, while the document holds an open decision block, even when a " + "human asked for approval: the refusal names each block; ask the human to answer or waive " + "it first. " + OWNER_REFERENCE,
|
|
14326
14363
|
arguments: (z2) => ({
|
|
14327
14364
|
issue: z2.string().describe(ISSUE_REFERENCE).optional(),
|
|
14328
14365
|
project: z2.string().describe("Project key owning the document.").optional(),
|
|
14329
14366
|
artifact: z2.string().describe("Project document artifact id, slug, or filename; primary document by default for an issue.").optional(),
|
|
14330
|
-
summary: z2.string({ min: 1 }).describe(`What the human is approving, in one to three sentences, and nothing else: no commentary on itself or the conversation, and no question; after an earlier approval, one sentence naming what changed since it, since the card shows that approval and a diff. Request approval only once ${HUMAN_AGREED_TO_DOCUMENT}.`)
|
|
14367
|
+
summary: z2.string({ min: 1 }).describe(`What the human is approving, in one to three sentences, and nothing else: no commentary on itself or the conversation, and no question; after an earlier approval, one sentence naming what changed since it, since the card shows that approval and a diff. A Legion architect adds one last sentence with its two spec reviews' results. Request approval only once ${HUMAN_AGREED_TO_DOCUMENT}.`)
|
|
14331
14368
|
}),
|
|
14332
14369
|
validation: documentOwnerValidation(true)
|
|
14333
14370
|
},
|
|
@@ -14335,7 +14372,7 @@ var dispatchToolSpecs = [
|
|
|
14335
14372
|
name: "dispatch_artifact",
|
|
14336
14373
|
example: { issue: "DSP-1", name: "design.md", content: `# Design
|
|
14337
14374
|
` },
|
|
14338
|
-
description: "Attach a local file or inline text as an issue artifact or project document. Do not use it to edit a live document; use " + "dispatch doc-edit instead. Exactly one of path or content is required; a markdown document is at most 1 MiB and any other file at most 25 MiB. " + "Markdown is also refused with 413 CAP_EXCEEDED when it makes more than 65,536 elements (a block weighs 3, and an empty list item, quote, footnote definition or typed block 3 more for the empty paragraph it holds; a table cell 4, a hard line break 3, an image 3, a piece of inline HTML 2, an autolink 2, a footnote reference 2; inline syntax, marks, lines of text and backslash escapes or character references 1 each), or when a new version would leave the document's stored markdown (what its text reads back as) longer than 1 MiB or making more than 65,536 elements, and longer or heavier than before; shorten it or split it across documents. " + "Markdown holding an ask block whose body breaks its content rule (one or more question paragraphs, then at most one bullet list of options, last) is refused with 400 INVALID_ASK_BLOCK; a new version of a document is held to it only for the asks it writes or changes. " + `${OWNER_REFERENCE}`,
|
|
14375
|
+
description: "Attach a local file or inline text as an issue artifact or project document. Do not use it to edit a live document; use " + "dispatch doc-edit instead. Never upload a document's own name to change it (spec.md replaces the spec whole); edit it with dispatch doc-edit. Uploading the same name again makes its next version. Exactly one of path or content is required; a markdown document is at most 1 MiB and any other file at most 25 MiB. " + "Markdown is also refused with 413 CAP_EXCEEDED when it makes more than 65,536 elements (a block weighs 3, and an empty list item, quote, footnote definition or typed block 3 more for the empty paragraph it holds; a table cell 4, a hard line break 3, an image 3, a piece of inline HTML 2, an autolink 2, a footnote reference 2; inline syntax, marks, lines of text and backslash escapes or character references 1 each), or when a new version would leave the document's stored markdown (what its text reads back as) longer than 1 MiB or making more than 65,536 elements, and longer or heavier than before; shorten it or split it across documents. " + "Markdown holding an ask block whose body breaks its content rule (one or more question paragraphs, then at most one bullet list of options, last) is refused with 400 INVALID_ASK_BLOCK; a new version of a document is held to it only for the asks it writes or changes. " + `${OWNER_REFERENCE}`,
|
|
14339
14376
|
arguments: (z2) => ({
|
|
14340
14377
|
issue: z2.string().describe(ISSUE_REFERENCE).optional(),
|
|
14341
14378
|
project: z2.string().describe("Project key for an unlinked document.").optional(),
|
|
@@ -14355,12 +14392,12 @@ var dispatchToolSpecs = [
|
|
|
14355
14392
|
{
|
|
14356
14393
|
name: "dispatch_read",
|
|
14357
14394
|
example: { issue: "DSP-1" },
|
|
14358
|
-
description: "Read an issue or document summary, targeted ask, or targeted comment reply chain, or the conversation " + "a message belongs to. Do not use it for document contents; use dispatch doc-read instead. Supply ref, issue, " + "issue plus artifact (one of its documents), or project plus artifact; or message alone, which reads a human's direct message to this session and every " + "reply to it (they belong to no issue). A document summary names its issue, reference, versions and approval. " + "An anchored comment or ask also says where its quote sits, as `Position:`: the block's path from the top, " + "and in a table the row (0 is the header), the cells before the anchored one, and the column's header; " + "`Position: unavailable (<code>)` when Dispatch could not read the document: `DOC_SERVICE_UNAVAILABLE` " + "(try again shortly), `DOC_SCHEMA` (the document needs repair), `DOCUMENT_UNLOADABLE` (the document " + "needs a rebuild) or `INTERNAL`. " + "An issue read carries a `Progress:` line, `tasks 3/7, children 2/5`: its spec's task-list items " + "(`- [ ]` / `- [x]`, nested lists included) and its direct children, each done of total and each only " + "when it has any (`Progress: none` otherwise). " + `An issue read, and its dispatch://KEY/log, lists the issue's last ${DEFAULT_ISSUE_READ_EVENTS} events, oldest first; ` + "--events N lists the last N, and --all-events every one. " + "Every read ends with `Referenced by:` (what cites or hangs off this node, each with its dispatch:// address, " + "an excerpt, and when) and `Links:` (what it cites), so tracing provenance is one call. " + "The pictures the shown messages, asks and comments embed come back as images you see, newest first, at most 8 " + "and 10 MiB of them per read, each a PNG, JPEG, GIF or WebP of at most 3,750,000 bytes (5 MB of base64); a `Pictures:` section names each " + "one shown, in order, and the rest by reference, for dispatch doc-read. A picture this session was already shown is named, not sent again " + "(every request carries the session's history, and the provider refuses one over 32 MB); dispatch doc-read shows it again. " + OWNER_REFERENCE,
|
|
14395
|
+
description: "Read an issue or document summary, targeted ask, or targeted comment reply chain, or the conversation " + "a message belongs to. Do not use it for document contents; use dispatch doc-read instead. Supply ref, issue, " + "issue plus artifact (one of its documents), or project plus artifact; or message alone, which reads a human's direct message to this session and every " + "reply to it (they belong to no issue). A document summary names its issue, reference, versions and approval. " + "An anchored comment or ask also says where its quote sits, as `Position:`: the block's path from the top, " + "and in a table the row (0 is the header), the cells before the anchored one, and the column's header; " + "`Position: unavailable (<code>)` when Dispatch could not read the document: `DOC_SERVICE_UNAVAILABLE` " + "(try again shortly), `DOC_SCHEMA` (the document needs repair), `DOCUMENT_UNLOADABLE` (the document " + "needs a rebuild) or `INTERNAL`. " + "An issue read carries a `Progress:` line, `tasks 3/7, children 2/5`: its spec's task-list items " + "(`- [ ]` / `- [x]`, nested lists included) and its direct children, each done of total and each only " + "when it has any (`Progress: none` otherwise). " + `An issue read, and its dispatch://KEY/log, lists the issue's last ${DEFAULT_ISSUE_READ_EVENTS} events, oldest first; ` + "--events N lists the last N, and --all-events every one. " + "Every read ends with `Referenced by:` (what cites or hangs off this node, each with its dispatch:// address, " + "an excerpt, and when) and `Links:` (what it cites), so tracing provenance is one call. " + "A block read prints `Block:`, `Document:`, `Changed in version:` and `Text:`, then those two sections; a pinned one adds " + "the block's text at that version and whether it is unchanged, changed or removed since, and an absent block, unpinned, " + "reads `No block <id> in <document>.` " + "The pictures the shown messages, asks and comments embed come back as images you see, newest first, at most 8 " + "and 10 MiB of them per read, each a PNG, JPEG, GIF or WebP of at most 3,750,000 bytes (5 MB of base64); a `Pictures:` section names each " + "one shown, in order, and the rest by reference, for dispatch doc-read. A picture this session was already shown is named, not sent again " + "(every request carries the session's history, and the provider refuses one over 32 MB); dispatch doc-read shows it again. " + OWNER_REFERENCE,
|
|
14359
14396
|
arguments: (z2) => ({
|
|
14360
14397
|
issue: z2.string().describe(ISSUE_REFERENCE).optional(),
|
|
14361
14398
|
project: z2.string().describe("Project key owning the document.").optional(),
|
|
14362
14399
|
artifact: z2.string().describe("Document artifact id, slug, or filename: one of the issue's, or a project document.").optional(),
|
|
14363
|
-
ref: z2.string().describe("Optional dispatch://
|
|
14400
|
+
ref: z2.string().describe("Optional dispatch:// reference: dispatch://KEY, dispatch://KEY/spec, " + "dispatch://KEY/artifact/<slug>[@vN], dispatch://KEY/ask/<id>, dispatch://KEY/comment/<id>, " + "dispatch://KEY/message/<id>, dispatch://PROJECT/artifact/<slug>[@vN], and its " + "/ask/<id> and /comment/<id>; or the dashboard URL of one. A block: " + "dispatch://KEY/spec#b-<block id>[@vN], dispatch://KEY/artifact/<slug>#b-<block id>[@vN] or " + "dispatch://PROJECT/artifact/<slug>#b-<block id>[@vN], the id percent-encoded except ASCII " + "letters, digits and -.").optional(),
|
|
14364
14401
|
message: z2.string().describe("A message id (uuid): reads the conversation it belongs to, the root message and every " + "reply. Name nothing else with it.").optional(),
|
|
14365
14402
|
events: z2.number({ int: true, min: 1 }).describe(`How many of the issue's newest events an issue read or its dispatch://KEY/log lists, oldest first; default ${DEFAULT_ISSUE_READ_EVENTS}. Name no --all-events with it.`).optional(),
|
|
14366
14403
|
all_events: z2.boolean().describe(`List every one of the issue's events, oldest first, on an issue read or its dispatch://KEY/log, in place of the last ${DEFAULT_ISSUE_READ_EVENTS}. Name no --events with it.`).optional()
|
|
@@ -14392,7 +14429,7 @@ var dispatchToolSpecs = [
|
|
|
14392
14429
|
{
|
|
14393
14430
|
name: "dispatch_issues",
|
|
14394
14431
|
example: { project: "PROJ", limit: 250, offset: 250 },
|
|
14395
|
-
description: "List a project's issues for a roadmap or backlog pass: every issue in one project, each carrying " + "its status, priority, parent, labels, open-ask count, progress (its spec's task-list items and " + "its direct children, each done of total, as `tasks 3/7 \xB7 children 2/5`, each only when it has " + "any), and route with whether it reaches anyone, " + "so you can see backlog shape without opening every issue. Optionally filter by status, parent, " + "label, priority, route status, or how recently it changed; priority takes one or more of 0-3 " + "(P0-P3) and null for an issue with no priority, so an owner's P0/P1 audit is priority [0, 1]. " + 'route_status "no_holder" lists every open issue whose route names a role nobody holds or a ' + "session that is not running
|
|
14432
|
+
description: "List a project's issues for a roadmap or backlog pass: every issue in one project, each carrying " + "its status, priority, parent, labels, open-ask count, progress (its spec's task-list items and " + "its direct children, each done of total, as `tasks 3/7 \xB7 children 2/5`, each only when it has " + "any), and route with whether it reaches anyone, " + "so you can see backlog shape without opening every issue. Optionally filter by status, parent, " + "label, priority, route status, or how recently it changed; priority takes one or more of 0-3 " + "(P0-P3) and null for an issue with no priority, so an owner's P0/P1 audit is priority [0, 1]. " + 'route_status "no_holder" lists every open issue whose route names a role nobody holds or a ' + "session that is not running, as of the server's copy of the listener's session list, at " + "most 5 s old, whatever its priority. A restarting " + "session is absent for minutes, so an issue is unowned only when a read ten minutes later agrees. " + "Do not use it to search by keyword or phrase; dispatch search remains the keyword surface. " + "Dispatch pages the list: limit sets the page size (default " + `${DEFAULT_ISSUE_PAGE_LIMIT}, max ${MAX_ISSUE_PAGE_LIMIT}) and offset selects where it starts ` + "(default 0), and the answer names how many issues match, so repeat with the next offset to " + "walk every matching issue. A walk is exact only while the list does not change: an issue " + "that enters or leaves what the filters match, or whose status or rank changes, between two " + "pages shifts rows across a page boundary, so one issue can come back twice and another never. " + "all takes the whole filtered list in one read instead, for a caller that must not miss or " + "repeat a row while other writers change the list, and especially for one whose own writes " + "move issues out of what it filtered on.",
|
|
14396
14433
|
arguments: (z2) => ({
|
|
14397
14434
|
project: z2.string().describe("Project key to list issues from."),
|
|
14398
14435
|
status: z2.enum(ISSUE_STATUSES).describe("Optional lifecycle status filter.").optional(),
|
|
@@ -14426,7 +14463,7 @@ var dispatchToolSpecs = [
|
|
|
14426
14463
|
{
|
|
14427
14464
|
name: "dispatch_architecture_sync",
|
|
14428
14465
|
example: { project: "CORE", repo: "acme/infra" },
|
|
14429
|
-
description: "Import a project's architecture model from its source repositories now, instead of waiting " + "for the server's five-minute schedule. A project may have several sources, one per " + "repository, and its model is every source's components together. Without repo every " + "source imports and each answers on its own line; with repo only that source does. Each " + "line names the imported commit, or the recorded error when that source's model was " + "rejected (its previous components stay up, and every other source is untouched). Sources " + "are saved in Settings or with PUT /api/v1/projects/{key}/architecture-sources/{owner}/{repo}; " + "404 SOURCE_NOT_FOUND when the project has none, or none for that repository.",
|
|
14466
|
+
description: "Import a project's architecture model from its source repositories now, instead of waiting " + "for the server's five-minute schedule. A project may have several sources, one per " + "repository, and its model is every source's components together. Without repo every " + "source imports and each answers on its own line; with repo only that source does. Each " + "line names the imported commit, or the recorded error when that source's model was " + "rejected (its previous components stay up, and every other source is untouched). A failed " + "line also says what of that source still shows (its commit, its component count when it " + "was saved again on another branch and has not imported from it yet, or that it never " + "imported), and a credential or branch problem is that source's failed line, or with repo " + "the error 409 SOURCE_ACCESS. Sources " + "are saved in Settings or with PUT /api/v1/projects/{key}/architecture-sources/{owner}/{repo}; " + "404 SOURCE_NOT_FOUND when the project has none, or none for that repository.",
|
|
14430
14467
|
arguments: (z2) => ({
|
|
14431
14468
|
project: z2.string().describe("Project key whose architecture sources to sync, such as CORE."),
|
|
14432
14469
|
repo: z2.string().describe("One source repository of the project to sync alone, owner/name; omit it to sync every source.").optional()
|
|
@@ -15724,7 +15761,27 @@ function dispatchDocumentRef(owner, slug) {
|
|
|
15724
15761
|
function dispatchChildRef(ownerRef, kind, id) {
|
|
15725
15762
|
return `${ownerRef}/${kind}/${id}`;
|
|
15726
15763
|
}
|
|
15764
|
+
function parseBlockRef(document, fragment) {
|
|
15765
|
+
const target = parseBlockFragment(fragment);
|
|
15766
|
+
const parsed = parseDispatchRef(document);
|
|
15767
|
+
if (target === undefined || parsed === null || parsed.version !== undefined || parsed.kind !== "spec" && parsed.kind !== "artifact") {
|
|
15768
|
+
return null;
|
|
15769
|
+
}
|
|
15770
|
+
return {
|
|
15771
|
+
owner: parsed.owner,
|
|
15772
|
+
kind: "block",
|
|
15773
|
+
id: parsed.id,
|
|
15774
|
+
block: target.block,
|
|
15775
|
+
document,
|
|
15776
|
+
...parsed.owner.kind === "project" ? { artifact: parsed.id } : {},
|
|
15777
|
+
...target.pin === undefined ? {} : { pin: target.pin }
|
|
15778
|
+
};
|
|
15779
|
+
}
|
|
15727
15780
|
function parseDispatchRef(ref) {
|
|
15781
|
+
const hash2 = ref.indexOf("#");
|
|
15782
|
+
if (hash2 !== -1 && ref.startsWith("b-", hash2 + 1)) {
|
|
15783
|
+
return parseBlockRef(ref.slice(0, hash2), ref.slice(hash2 + 3));
|
|
15784
|
+
}
|
|
15728
15785
|
const projectDocument = ref.match(/^dispatch:\/\/([A-Z][A-Z0-9]{1,9})\/artifact\/([^/@]+)(?:@v(\d+))?(?:\/(ask|comment)\/([^/]+))?$/);
|
|
15729
15786
|
if (projectDocument) {
|
|
15730
15787
|
const [, project, artifact2, version3, targetKind, targetID] = projectDocument;
|
|
@@ -16371,10 +16428,10 @@ function renderAdvice(tool, key, advice, opts) {
|
|
|
16371
16428
|
if (unparsed !== undefined && unparsed.count > 0 && (tool === "dispatch_issue" || tool === "dispatch_artifact")) {
|
|
16372
16429
|
const quoted = unparsed.examples.map((example) => JSON.stringify(example)).join(", ");
|
|
16373
16430
|
const subject2 = unparsed.count === 1 ? "1 typed-block opening in this document is text, not a block" : `${unparsed.count} typed-block openings in this document are text, not blocks`;
|
|
16374
|
-
lines.push(`${subject2}: ${quoted}. An opening like \`:::ask{\u2026}\` makes a block only as a line of its own, so as text it asks nobody. Mentioning the syntax on purpose? Put it in code. See the \`dispatch\` skill, "
|
|
16431
|
+
lines.push(`${subject2}: ${quoted}. An opening like \`:::ask{\u2026}\` makes a block only as a line of its own, so as text it asks nobody. Mentioning the syntax on purpose? Put it in code. See the \`dispatch-writing-specs\` skill, "Questions".`);
|
|
16375
16432
|
}
|
|
16376
16433
|
if (advice.decision_blocks === 0 && opts.isPrimarySpec === true && (tool === "dispatch_issue" || tool === "dispatch_artifact")) {
|
|
16377
|
-
lines.push(
|
|
16434
|
+
lines.push("This spec holds no ask blocks. A person does not watch your chat. They see that you need them only through an open ask or a spec that waits for their approval. If the design needs a person's choice, add an ask block. If it does not, request approval with `dispatch request-approval`.");
|
|
16378
16435
|
}
|
|
16379
16436
|
if (advice.issue_status === "triage" && advice.legion_managed_status !== true && tool !== "dispatch_issue" && !(tool === "dispatch_issue_update" && opts.setsStatus === true) && !triageAdviceShown.has(key)) {
|
|
16380
16437
|
triageAdviceShown.add(key);
|
|
@@ -16857,9 +16914,13 @@ function dispatchRefFromUrl(value, serverUrl) {
|
|
|
16857
16914
|
const value2 = url2.searchParams.get(name);
|
|
16858
16915
|
return value2 !== null && /^[1-9][0-9]*$/.test(value2) ? `@v${value2}` : "";
|
|
16859
16916
|
};
|
|
16917
|
+
const blockOf = (versionName) => {
|
|
16918
|
+
const id = url2.hash.startsWith("#b-") ? decodeBlockId(url2.hash.slice(3)) : undefined;
|
|
16919
|
+
return id === undefined || url2.searchParams.get(versionName) ? "" : `#b-${encodeBlockId(id)}`;
|
|
16920
|
+
};
|
|
16860
16921
|
const issuePage = url2.pathname.match(/^\/issues\/([A-Z][A-Z0-9]{1,9}-[1-9][0-9]*)(?:\/(spec|log|conversation|activity|children)|\/artifacts\/([^/]+)|\/asks\/([^/]+)|\/comments\/([^/]+)|\/messages\/([^/]+))?\/?$/);
|
|
16861
16922
|
if (issuePage) {
|
|
16862
|
-
const [, key, page, artifact, ask, comment, message] = issuePage;
|
|
16923
|
+
const [, key = "", page, artifact, ask, comment, message] = issuePage;
|
|
16863
16924
|
const version2 = versionOf("v");
|
|
16864
16925
|
if (page === "spec" || artifact !== undefined) {
|
|
16865
16926
|
const item2 = itemFromSearch(url2.search);
|
|
@@ -16870,10 +16931,13 @@ function dispatchRefFromUrl(value, serverUrl) {
|
|
|
16870
16931
|
}
|
|
16871
16932
|
if (page === "spec" && version2 !== "")
|
|
16872
16933
|
return `dispatch://${key}/artifact/spec${version2}`;
|
|
16934
|
+
if (page === "spec")
|
|
16935
|
+
return `dispatch://${key}/spec${blockOf("v")}`;
|
|
16873
16936
|
if (page !== undefined)
|
|
16874
16937
|
return `dispatch://${key}/${page === "conversation" ? "log" : page}`;
|
|
16875
16938
|
if (artifact !== undefined) {
|
|
16876
|
-
|
|
16939
|
+
const slug2 = decodeURIComponent(artifact);
|
|
16940
|
+
return `dispatch://${key}/artifact/${slug2}${version2}${blockOf("v")}`;
|
|
16877
16941
|
}
|
|
16878
16942
|
if (ask !== undefined)
|
|
16879
16943
|
return `dispatch://${key}/ask/${ask}`;
|
|
@@ -16896,25 +16960,26 @@ function dispatchRefFromUrl(value, serverUrl) {
|
|
|
16896
16960
|
if (!documentPage)
|
|
16897
16961
|
return;
|
|
16898
16962
|
const [, project, slug] = documentPage;
|
|
16899
|
-
const
|
|
16963
|
+
const decodedSlug = decodeURIComponent(slug ?? "");
|
|
16964
|
+
const document = `dispatch://${project}/artifact/${decodedSlug}`;
|
|
16900
16965
|
const item = itemFromSearch(url2.search);
|
|
16901
16966
|
if (item === null)
|
|
16902
16967
|
return;
|
|
16903
|
-
return item === undefined ? `${document}${versionOf("version")}` : `${document}/${item.kind}/${item.id}`;
|
|
16968
|
+
return item === undefined ? `${document}${versionOf("version")}${blockOf("version")}` : `${document}/${item.kind}/${item.id}`;
|
|
16904
16969
|
}
|
|
16905
|
-
var refGrammarProblem = "ref must be a valid dispatch:// reference such as dispatch://KEY-1, " + "dispatch://KEY-1/ask/<uuid>, dispatch://KEY-1/comment/<uuid>, " + "dispatch://KEY-1/message/<uuid>, dispatch://KEY-1/artifact/<slug>, " + "dispatch://PROJECT/artifact/<document-ref> (an artifact id, slug, or filename), or " + "dispatch://agent/<session id>/artifact/<slug> (a picture in a conversation on the Agents page, " + "for dispatch doc-read); a dashboard URL on this Dispatch server is accepted too";
|
|
16970
|
+
var refGrammarProblem = "ref must be a valid dispatch:// reference such as dispatch://KEY-1, " + "dispatch://KEY-1/ask/<uuid>, dispatch://KEY-1/comment/<uuid>, " + "dispatch://KEY-1/message/<uuid>, dispatch://KEY-1/artifact/<slug>, " + "dispatch://PROJECT/artifact/<document-ref> (an artifact id, slug, or filename), " + "dispatch://KEY-1/spec#b-<block id>, dispatch://KEY-1/artifact/<slug>#b-<block id> or " + "dispatch://PROJECT/artifact/<slug>#b-<block id> (one block of a document, its id " + "percent-encoded, optionally pinned to a version of the document with @v<N> after it; for " + "dispatch read), or " + "dispatch://agent/<session id>/artifact/<slug> (a picture in a conversation on the Agents page, " + "for dispatch doc-read); a dashboard URL on this Dispatch server is accepted too";
|
|
16906
16971
|
var ownerRequiredProblem = "issue is required; supply issue or set LEGION_ISSUE";
|
|
16907
16972
|
function innerRefProblem(tool, ref, refText) {
|
|
16908
|
-
if (ref.kind !== "ask" && ref.kind !== "comment" && ref.kind !== "message" && ref.kind !== "log" && ref.kind !== "children") {
|
|
16973
|
+
if (ref.kind !== "ask" && ref.kind !== "comment" && ref.kind !== "message" && ref.kind !== "log" && ref.kind !== "children" && ref.kind !== "block") {
|
|
16909
16974
|
return;
|
|
16910
16975
|
}
|
|
16911
16976
|
if (tool === "dispatch_read" || tool === "dispatch_ask")
|
|
16912
16977
|
return;
|
|
16913
16978
|
const owner = refOwnerName(ref);
|
|
16914
|
-
const
|
|
16915
|
-
const ownerArguments = ref.owner.kind === "issue" ? `issue ${ref.owner.issue}${
|
|
16979
|
+
const documentArgument = ref.kind === "block" && tool !== "dispatch_comment" ? ` and artifact ${ref.id}` : tool === "dispatch_suggest" ? " and artifact <the document's slug>" : "";
|
|
16980
|
+
const ownerArguments = ref.owner.kind === "issue" ? `issue ${ref.owner.issue}${documentArgument}` : `project ${ref.owner.project} and artifact ${ref.artifact}`;
|
|
16916
16981
|
const fix = tool === "dispatch_comment" && ref.kind === "ask" ? `reply under it with reply_to_ask ${ref.id} and ${ownerArguments}` : tool === "dispatch_comment" && ref.kind === "comment" ? `reply in its thread with reply_to ${ref.id} and ${ownerArguments}` : `read it with dispatch read, or name ${owner} with ${ownerArguments}`;
|
|
16917
|
-
const item = ref.kind === "ask" ? "an ask" : ref.kind === "log" ? "the event log" : ref.kind === "children" ? "the children" : `a ${ref.kind}`;
|
|
16982
|
+
const item = ref.kind === "ask" ? "an ask" : ref.kind === "log" ? "the event log" : ref.kind === "children" ? "the children" : ref.kind === "block" ? `block ${ref.block}` : `a ${ref.kind}`;
|
|
16918
16983
|
return `ref ${refText} names ${item} on ${owner}; dispatch ${commandName(tool)} would act on ${owner} and drop the ${ref.kind}: ${fix}`;
|
|
16919
16984
|
}
|
|
16920
16985
|
var documentItemPattern = /^dispatch:\/\/([A-Z][A-Z0-9]{1,9}-[1-9][0-9]*)\/artifact\/[^/@]+(?:@v\d+)?\/(ask|comment)\/([^/]+)$/;
|
|
@@ -16941,7 +17006,7 @@ function ownerConflictProblems(tool, args, parsedRef, refText) {
|
|
|
16941
17006
|
const artifact = optionalString(args, "artifact");
|
|
16942
17007
|
const version2 = optionalNumber(args, "version");
|
|
16943
17008
|
const ref = tool === "dispatch_ask" && (issue2 !== undefined || project !== undefined) ? null : parsedRef;
|
|
16944
|
-
const refDocument = ref === null ? undefined : ref.owner.kind === "project" ? ref.artifact ?? ref.id : ref.kind === "spec" || ref.kind === "artifact" ? ref.id : undefined;
|
|
17009
|
+
const refDocument = ref === null ? undefined : ref.owner.kind === "project" ? ref.artifact ?? ref.id : ref.kind === "spec" || ref.kind === "artifact" || ref.kind === "block" ? ref.id : undefined;
|
|
16945
17010
|
if (ref !== null && refText !== undefined) {
|
|
16946
17011
|
const refOwner = refOwnerName(ref);
|
|
16947
17012
|
if (issue2 !== undefined && (ref.owner.kind !== "issue" || nativeIssueKeyPattern.test(issue2) && issue2 !== ref.owner.issue)) {
|
|
@@ -16969,7 +17034,7 @@ function ownerConflictProblems(tool, args, parsedRef, refText) {
|
|
|
16969
17034
|
}
|
|
16970
17035
|
const projectOwned = project !== undefined || ref?.owner.kind === "project";
|
|
16971
17036
|
if (tool === "dispatch_comment" && !projectOwned && optionalString(args, "quote") === undefined) {
|
|
16972
|
-
const document = artifact ?? refDocument;
|
|
17037
|
+
const document = artifact ?? (ref?.kind === "block" ? undefined : refDocument);
|
|
16973
17038
|
if (document !== undefined) {
|
|
16974
17039
|
problems.push(`${command} posts on the issue unless quote anchors it in a document, so document ${document} would be dropped: add --quote to comment on a passage of it, or name only the issue`);
|
|
16975
17040
|
}
|
|
@@ -17349,7 +17414,8 @@ function referenceLines(edges) {
|
|
|
17349
17414
|
return ["- none"];
|
|
17350
17415
|
return edges.map((edge) => {
|
|
17351
17416
|
const excerpt2 = edge.excerpt === undefined ? "" : `${textHead(edge.excerpt.text)} \xB7 `;
|
|
17352
|
-
|
|
17417
|
+
const block = edge.block === undefined ? "" : ` (block ${edge.block.ref ?? edge.block.id})`;
|
|
17418
|
+
return `- ${edge.kind} ${edge.node.kind} ${edge.node.ref ?? edge.node.id} (${excerpt2}${edge.created_at})${block}`;
|
|
17353
17419
|
});
|
|
17354
17420
|
}
|
|
17355
17421
|
function unavailableReason(error48) {
|
|
@@ -17374,8 +17440,30 @@ async function graphSections(client, ref) {
|
|
|
17374
17440
|
graphEdges(client, { to: ref }),
|
|
17375
17441
|
graphEdges(client, { from: ref })
|
|
17376
17442
|
]);
|
|
17443
|
+
return graphSectionLines(incoming, outgoing);
|
|
17444
|
+
}
|
|
17445
|
+
function graphSectionLines(incoming, outgoing) {
|
|
17377
17446
|
return ["Referenced by:", ...referenceLines(incoming), "Links:", ...referenceLines(outgoing)];
|
|
17378
17447
|
}
|
|
17448
|
+
function blockLines(node, ref) {
|
|
17449
|
+
const head = [
|
|
17450
|
+
`Block: ${node.block_id ?? ref.block}`,
|
|
17451
|
+
`Document: ${node.document ?? ref.document}`,
|
|
17452
|
+
...node.changed_version === undefined ? [] : [`Changed in version: ${node.changed_version}`],
|
|
17453
|
+
...node.text === undefined ? [] : ["Text:", node.text]
|
|
17454
|
+
];
|
|
17455
|
+
const { pin } = node;
|
|
17456
|
+
if (pin === undefined)
|
|
17457
|
+
return head;
|
|
17458
|
+
const state = pin.state === "unchanged" ? `Unchanged since version ${pin.version}.` : pin.state === "changed" ? `Changed since version ${pin.version}; last changed in version ${node.changed_version}.` : `Removed in version ${pin.removed_version}.`;
|
|
17459
|
+
return [
|
|
17460
|
+
...head,
|
|
17461
|
+
`Pinned to version: ${pin.version}`,
|
|
17462
|
+
state,
|
|
17463
|
+
`Text at version ${pin.version}:`,
|
|
17464
|
+
pin.text
|
|
17465
|
+
];
|
|
17466
|
+
}
|
|
17379
17467
|
function logSummary(issue2, events) {
|
|
17380
17468
|
return [
|
|
17381
17469
|
`Key: ${issue2.key}`,
|
|
@@ -17424,9 +17512,18 @@ function actorText(actor) {
|
|
|
17424
17512
|
}
|
|
17425
17513
|
return `${actor.kind} ${actor.id} (as ${serviceSubjectLabel(service)})`;
|
|
17426
17514
|
}
|
|
17515
|
+
function eventRef(event) {
|
|
17516
|
+
const payload = event.payload;
|
|
17517
|
+
const id = typeof payload === "object" && payload !== null && "id" in payload ? payload.id : undefined;
|
|
17518
|
+
if (typeof id !== "string" || id === "" || event.issue_key === null)
|
|
17519
|
+
return;
|
|
17520
|
+
const kind = event.type.startsWith("message.") ? "message" : event.type.startsWith("comment.") || event.type.startsWith("suggestion.") ? "comment" : event.type.startsWith("ask.") ? "ask" : undefined;
|
|
17521
|
+
return kind === undefined ? undefined : `dispatch://${event.issue_key}/${kind}/${id}`;
|
|
17522
|
+
}
|
|
17427
17523
|
function eventLine(event) {
|
|
17428
17524
|
const head = eventHead(event);
|
|
17429
|
-
|
|
17525
|
+
const ref = eventRef(event);
|
|
17526
|
+
return `- #${event.seq} ${event.type}${ref === undefined ? "" : ` ${ref}`} \xB7 ${actorText(event.actor)} \xB7 ${event.created_at}${head === undefined || head === "" ? "" : ` \xB7 ${head}`}`;
|
|
17430
17527
|
}
|
|
17431
17528
|
function childrenSummary(issue2) {
|
|
17432
17529
|
return [
|
|
@@ -18732,6 +18829,30 @@ ${trailer.join(`
|
|
|
18732
18829
|
...showImages(pictures3)
|
|
18733
18830
|
};
|
|
18734
18831
|
}
|
|
18832
|
+
if (ownerArguments.ref?.kind === "block") {
|
|
18833
|
+
const ref = ownerArguments.ref;
|
|
18834
|
+
const blockRef = stringArg(args, "ref");
|
|
18835
|
+
const [incoming, outgoing] = await Promise.all([
|
|
18836
|
+
client.getReferences({ to: blockRef }).catch((error48) => {
|
|
18837
|
+
if (ref.pin === undefined && dispatchAnswered(error48, 404)) {
|
|
18838
|
+
throw new Error(`No block ${ref.block} in ${ref.document}.`);
|
|
18839
|
+
}
|
|
18840
|
+
throw error48;
|
|
18841
|
+
}),
|
|
18842
|
+
graphEdges(client, { from: blockRef })
|
|
18843
|
+
]);
|
|
18844
|
+
return {
|
|
18845
|
+
text: [
|
|
18846
|
+
...blockLines(incoming.node, ref),
|
|
18847
|
+
...graphSectionLines(incoming.edges, outgoing)
|
|
18848
|
+
].join(`
|
|
18849
|
+
`),
|
|
18850
|
+
details: {
|
|
18851
|
+
...ref.owner.kind === "project" ? { project: ref.owner.project } : { issue: ref.owner.issue },
|
|
18852
|
+
block: incoming.node.block_id ?? ref.block
|
|
18853
|
+
}
|
|
18854
|
+
};
|
|
18855
|
+
}
|
|
18735
18856
|
const documentReference = optionalString(args, "artifact");
|
|
18736
18857
|
if (documentOwner().kind === "project" || documentReference !== undefined) {
|
|
18737
18858
|
const resolved = await resolveDocument(documentOwner(), documentReference);
|