@sjawhar/claude-envoy 1.24.0 → 1.26.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 +136 -84
- package/dist/envoy-channel.js +143 -86
- package/dist/session-hook.js +136 -84
- package/legion/skills/legion-architect/SKILL.md +3 -0
- package/legion/skills/legion-architect/references/acceptance.md +14 -1
- package/legion/skills/legion-architect/references/design-gate.md +9 -1
- package/legion/skills/legion-architect/references/wake-routing.md +1 -0
- package/legion/skills/legion-controller/references/admission.md +1 -1
- package/package.json +2 -2
package/dist/dispatch.js
CHANGED
|
@@ -14611,6 +14611,9 @@ var PROJECT_NAME_MAX = 80;
|
|
|
14611
14611
|
var MAX_ISSUE_PAGE_LIMIT = 250;
|
|
14612
14612
|
var DEFAULT_ISSUE_PAGE_LIMIT = 50;
|
|
14613
14613
|
var ASK_TURNS = ["human", "agent"];
|
|
14614
|
+
function inboxThreadRow(row) {
|
|
14615
|
+
return row.kind === "agent" ? row : row;
|
|
14616
|
+
}
|
|
14614
14617
|
var DELIVERY_CAPABILITIES = ["aside", "btw", "steer"];
|
|
14615
14618
|
var IDEMPOTENCY_KEY_HEADER = "Idempotency-Key";
|
|
14616
14619
|
var IDEMPOTENCY_REPLAYED_HEADER = "Idempotency-Replayed";
|
|
@@ -14961,12 +14964,15 @@ var HOLDING_OF = {
|
|
|
14961
14964
|
unknown: "unknown",
|
|
14962
14965
|
unresponsive: "unresponsive"
|
|
14963
14966
|
};
|
|
14967
|
+
function isHolderState(state) {
|
|
14968
|
+
return Object.hasOwn(HOLDING_OF, state);
|
|
14969
|
+
}
|
|
14964
14970
|
function claimHolds(claim, titles, liveness = {}) {
|
|
14965
14971
|
if (claim.actor.kind !== "session") {
|
|
14966
14972
|
return "holds";
|
|
14967
14973
|
}
|
|
14968
14974
|
const state = liveness.holder_state;
|
|
14969
|
-
if (state != null) {
|
|
14975
|
+
if (state != null && isHolderState(state)) {
|
|
14970
14976
|
return HOLDING_OF[state];
|
|
14971
14977
|
}
|
|
14972
14978
|
if (titles === undefined) {
|
|
@@ -16936,8 +16942,9 @@ function relatedCheckFormOf(suggestions) {
|
|
|
16936
16942
|
return { form: "not_made", reason: missing ?? "the server gave no reason", searchQuery };
|
|
16937
16943
|
}
|
|
16938
16944
|
const mode = relatedCheckModeWords(suggestions);
|
|
16939
|
-
|
|
16940
|
-
|
|
16945
|
+
const related = suggestions.related ?? [];
|
|
16946
|
+
if (related.length > 0) {
|
|
16947
|
+
return { form: "items", mode, related };
|
|
16941
16948
|
}
|
|
16942
16949
|
if (outcome === undefined) {
|
|
16943
16950
|
return {
|
|
@@ -18629,7 +18636,12 @@ function documentLabel(project, slug) {
|
|
|
18629
18636
|
return `${project}/${slug}`;
|
|
18630
18637
|
}
|
|
18631
18638
|
function ownerTitle(owner) {
|
|
18632
|
-
|
|
18639
|
+
const { issue, document } = owner;
|
|
18640
|
+
if (issue !== undefined)
|
|
18641
|
+
return `${issue.key}: ${issue.title}`;
|
|
18642
|
+
if (document !== undefined)
|
|
18643
|
+
return `${document.project} / ${document.name}`;
|
|
18644
|
+
return "";
|
|
18633
18645
|
}
|
|
18634
18646
|
function issueTopic(key) {
|
|
18635
18647
|
return { label: key, topic: dispatchIssueSubject(key, ">") };
|
|
@@ -19640,10 +19652,10 @@ async function wholeCarriedBody(client, item, session) {
|
|
|
19640
19652
|
try {
|
|
19641
19653
|
if (item.resource === "comment") {
|
|
19642
19654
|
const read = await client.getComment(item.id);
|
|
19643
|
-
return [read.comment, ...read.replies].find((comment) => comment.id === item.id)?.body;
|
|
19655
|
+
return [read.comment, ...read.replies ?? []].find((comment) => comment.id === item.id)?.body;
|
|
19644
19656
|
}
|
|
19645
19657
|
const read = item.issueKey === null ? session === undefined ? undefined : await client.getMessageThread(item.id, session) : await client.getMessage(item.issueKey, item.id);
|
|
19646
|
-
return read === undefined ? undefined : [read.message, ...read.replies].find((message) => message.id === item.id)?.body;
|
|
19658
|
+
return read === undefined ? undefined : [read.message, ...read.replies ?? []].find((message) => message.id === item.id)?.body;
|
|
19647
19659
|
} catch {
|
|
19648
19660
|
return;
|
|
19649
19661
|
}
|
|
@@ -20234,7 +20246,7 @@ function askTexts({ ask, replies }) {
|
|
|
20234
20246
|
{ text: ask.question, at: ask.created_at },
|
|
20235
20247
|
...ask.answer?.text ? [{ text: ask.answer.text, at: ask.answer.at }] : [],
|
|
20236
20248
|
...ask.resolution === undefined ? [] : [{ text: ask.resolution.reason, at: ask.resolution.at }],
|
|
20237
|
-
...datedBodies(replies)
|
|
20249
|
+
...datedBodies(replies ?? [])
|
|
20238
20250
|
];
|
|
20239
20251
|
}
|
|
20240
20252
|
function eventTexts(event) {
|
|
@@ -20357,7 +20369,7 @@ async function readPictures(client, addresses, shown) {
|
|
|
20357
20369
|
artifacts.set(target.key, read);
|
|
20358
20370
|
}
|
|
20359
20371
|
const artifact = await read;
|
|
20360
|
-
const version = artifact.versions.find((candidate) => candidate.number === target.version);
|
|
20372
|
+
const version = (artifact.versions ?? []).find((candidate) => candidate.number === target.version);
|
|
20361
20373
|
if (version === undefined) {
|
|
20362
20374
|
skip(`${artifact.name} has no version ${target.version}`);
|
|
20363
20375
|
continue;
|
|
@@ -20473,7 +20485,7 @@ function searchHitLine(result, baseUrl) {
|
|
|
20473
20485
|
const href = new URL(result.href, baseUrl).toString();
|
|
20474
20486
|
const { owner } = result;
|
|
20475
20487
|
if (owner.kind === "document") {
|
|
20476
|
-
const reference = dispatchDocumentRef(owner.project, owner.slug);
|
|
20488
|
+
const reference = dispatchDocumentRef(owner.project ?? "", owner.slug ?? "");
|
|
20477
20489
|
return `${reference} [document] ${owner.name} - ${result.kind}: ${snippetText(result.snippet)} -> ${href}`;
|
|
20478
20490
|
}
|
|
20479
20491
|
const artifactName = result.artifact ? ` ${result.artifact.name}` : "";
|
|
@@ -20485,7 +20497,8 @@ function indentedText(text) {
|
|
|
20485
20497
|
`);
|
|
20486
20498
|
}
|
|
20487
20499
|
function answerLines(lead, answer) {
|
|
20488
|
-
const
|
|
20500
|
+
const chosen = answer.selected ?? [];
|
|
20501
|
+
const selected = chosen.length === 0 ? "none" : chosen.join(", ");
|
|
20489
20502
|
const text = answer.text === null || answer.text === "" ? "none" : indentedText(answer.text);
|
|
20490
20503
|
return [
|
|
20491
20504
|
` ${lead} by ${actorActText(answer.user, answer.act)} at ${answer.at} \xB7 options chosen: ${selected}`,
|
|
@@ -20499,16 +20512,21 @@ function askStateLines(ask) {
|
|
|
20499
20512
|
if (ask === undefined) {
|
|
20500
20513
|
return [" Answer state not reported by this Dispatch; open the link to read the ask."];
|
|
20501
20514
|
}
|
|
20515
|
+
const resolution = ask.resolution;
|
|
20516
|
+
const closed = resolution === undefined ? "closed, and this Dispatch did not say by whom" : resolutionText(resolution);
|
|
20502
20517
|
switch (ask.state) {
|
|
20503
20518
|
case "open":
|
|
20504
20519
|
return [" Open: no answer yet."];
|
|
20505
20520
|
case "answered":
|
|
20506
|
-
return answerLines("Answered", ask.answer);
|
|
20521
|
+
return ask.answer === undefined ? [" Answered; this Dispatch did not carry the answer. Open the link to read it."] : answerLines("Answered", ask.answer);
|
|
20507
20522
|
case "resolved":
|
|
20508
|
-
return ask.answer === undefined ? [` Closed with no answer: ${
|
|
20509
|
-
|
|
20510
|
-
|
|
20523
|
+
return ask.answer === undefined ? [` Closed with no answer: ${closed}`] : [` Closed after an answer: ${closed}`, ...answerLines("Last answer", ask.answer)];
|
|
20524
|
+
default: {
|
|
20525
|
+
const unreportedState = ask.state;
|
|
20526
|
+
return [
|
|
20527
|
+
` Answer state "${String(unreportedState)}" is newer than this client; open the link to read the ask.`
|
|
20511
20528
|
];
|
|
20529
|
+
}
|
|
20512
20530
|
}
|
|
20513
20531
|
}
|
|
20514
20532
|
function searchResultLine(result, baseUrl) {
|
|
@@ -20517,7 +20535,7 @@ function searchResultLine(result, baseUrl) {
|
|
|
20517
20535
|
`) : line;
|
|
20518
20536
|
}
|
|
20519
20537
|
function searchAnswer(search, query, offset, configUrl) {
|
|
20520
|
-
const results = search.results;
|
|
20538
|
+
const results = search.results ?? [];
|
|
20521
20539
|
const count = results.length;
|
|
20522
20540
|
const lines = results.map((result) => searchResultLine(result, configUrl));
|
|
20523
20541
|
const noun = count === 1 ? "result" : "results";
|
|
@@ -20742,11 +20760,15 @@ var RELATION_PHRASES = {
|
|
|
20742
20760
|
sent_you_a_message: "sent you a message",
|
|
20743
20761
|
replied_to_your_message: "replied to your message"
|
|
20744
20762
|
};
|
|
20763
|
+
function isSessionAnswerRelation(value) {
|
|
20764
|
+
return Object.hasOwn(RELATION_PHRASES, value);
|
|
20765
|
+
}
|
|
20745
20766
|
function isNoAnswersRoute(error) {
|
|
20746
20767
|
return isNoRoute(error);
|
|
20747
20768
|
}
|
|
20748
20769
|
function renderSessionAnswerItem(item) {
|
|
20749
|
-
const
|
|
20770
|
+
const phrase = isSessionAnswerRelation(item.relation) ? RELATION_PHRASES[item.relation] : item.relation;
|
|
20771
|
+
const relation = `${phrase}${item.replaced === true ? " (replaces an earlier answer)" : ""}`;
|
|
20750
20772
|
const head = [item.at, actorActText(`user ${item.author.id}`, item.author.act), relation];
|
|
20751
20773
|
if (item.edited_at !== undefined)
|
|
20752
20774
|
head.push(`edited ${item.edited_at}`);
|
|
@@ -21175,20 +21197,21 @@ function adviceMemory() {
|
|
|
21175
21197
|
function renderAdvice(tool, key, advice, opts) {
|
|
21176
21198
|
if (advice === undefined)
|
|
21177
21199
|
return [];
|
|
21178
|
-
const
|
|
21179
|
-
const
|
|
21180
|
-
const
|
|
21200
|
+
const issueAdvice = "issue_status" in advice ? advice : undefined;
|
|
21201
|
+
const hasIssueAdvice = issueAdvice !== undefined;
|
|
21202
|
+
const openAsks = issueAdvice?.your_open_asks ?? undefined;
|
|
21203
|
+
const writesSinceHuman = issueAdvice?.session_writes_since_human;
|
|
21181
21204
|
const lines = [];
|
|
21182
21205
|
const unparsed = advice.unparsed_openers;
|
|
21183
21206
|
if (unparsed !== undefined && unparsed.count > 0 && (tool === "dispatch_issue" || tool === "dispatch_artifact")) {
|
|
21184
|
-
const quoted = unparsed.examples.map((example) => JSON.stringify(example)).join(", ");
|
|
21207
|
+
const quoted = (unparsed.examples ?? []).map((example) => JSON.stringify(example)).join(", ");
|
|
21185
21208
|
const subject = 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`;
|
|
21186
21209
|
lines.push(`${subject}: ${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".`);
|
|
21187
21210
|
}
|
|
21188
21211
|
if (advice.decision_blocks === 0 && opts.isPrimarySpec === true && (tool === "dispatch_issue" || tool === "dispatch_artifact")) {
|
|
21189
21212
|
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`.");
|
|
21190
21213
|
}
|
|
21191
|
-
if (
|
|
21214
|
+
if (issueAdvice?.issue_status === "triage" && issueAdvice.legion_managed_status !== true && tool !== "dispatch_issue" && !(tool === "dispatch_issue_update" && opts.setsStatus === true) && !triageAdviceShown.has(key)) {
|
|
21192
21215
|
triageAdviceShown.add(key);
|
|
21193
21216
|
lines.push(`${key} is still in triage \u2014 nobody can see its development status. See the \`dispatch\` skill, "Issue status is yours to move".`);
|
|
21194
21217
|
}
|
|
@@ -21339,17 +21362,19 @@ function optionalComponents(args, name) {
|
|
|
21339
21362
|
function componentsChange(input, after) {
|
|
21340
21363
|
switch (input.mode) {
|
|
21341
21364
|
case "explicit":
|
|
21342
|
-
return `components -> explicit [${after.ids.join(", ")}]`;
|
|
21365
|
+
return `components -> explicit [${(after.ids ?? []).join(", ")}]`;
|
|
21343
21366
|
case "none":
|
|
21344
21367
|
return `components -> none (${after.reason ?? input.reason ?? ""})`;
|
|
21345
21368
|
case "inherit":
|
|
21346
21369
|
return "components -> inherit";
|
|
21370
|
+
default:
|
|
21371
|
+
return `components -> ${input.mode}`;
|
|
21347
21372
|
}
|
|
21348
21373
|
}
|
|
21349
21374
|
var architectureComponentsAction = 'Review the `dispatch` skill, "Architecture components", to attach it to the parts it changes or mark it as non-architectural with a reason.';
|
|
21350
21375
|
var LEGION_OWNS_STATUS = "Legion's daemon moves this issue's status on an issue it runs, so leave it alone \u2014 a status written here is undone.";
|
|
21351
21376
|
async function architectureGuidance(client, project, components) {
|
|
21352
|
-
if (components.mode === "none" || components.ids.length > 0)
|
|
21377
|
+
if (components.mode === "none" || (components.ids ?? []).length > 0)
|
|
21353
21378
|
return;
|
|
21354
21379
|
try {
|
|
21355
21380
|
if ((await client.listArchitectureSources(project)).length === 0)
|
|
@@ -21540,7 +21565,7 @@ async function sessionOpenAsks(client, sessionId) {
|
|
|
21540
21565
|
const session = sessionId?.trim();
|
|
21541
21566
|
if (!session)
|
|
21542
21567
|
throw new Error("host session id is required to read this session's open asks");
|
|
21543
|
-
return (await client.openAsks(session)).asks;
|
|
21568
|
+
return (await client.openAsks(session)).asks ?? [];
|
|
21544
21569
|
}
|
|
21545
21570
|
function openAskHints(asks) {
|
|
21546
21571
|
if (asks.length === 0)
|
|
@@ -22013,14 +22038,15 @@ async function resolveArtifact(client, owner, artifactReference, { canonical = f
|
|
|
22013
22038
|
};
|
|
22014
22039
|
}
|
|
22015
22040
|
const issue = await client.getIssue(owner.issue);
|
|
22041
|
+
const issueArtifacts = issue.artifacts ?? [];
|
|
22016
22042
|
let artifact;
|
|
22017
22043
|
if (artifactReference === undefined || artifactReference === "spec") {
|
|
22018
|
-
artifact =
|
|
22044
|
+
artifact = issueArtifacts.find((candidate) => candidate.primary || candidate.id === issue.primary_artifact_id);
|
|
22019
22045
|
} else {
|
|
22020
|
-
artifact = artifactByReference(
|
|
22046
|
+
artifact = artifactByReference(issueArtifacts, artifactReference, { kind: "issue", issue: issue.key }, canonical);
|
|
22021
22047
|
}
|
|
22022
22048
|
if (!artifact) {
|
|
22023
|
-
throw new DocumentNotFoundError(documentReferenceProblem(artifactReference ?? "spec",
|
|
22049
|
+
throw new DocumentNotFoundError(documentReferenceProblem(artifactReference ?? "spec", issueArtifacts, {
|
|
22024
22050
|
kind: "issue",
|
|
22025
22051
|
issue: issue.key
|
|
22026
22052
|
}));
|
|
@@ -22126,7 +22152,7 @@ async function movedApprovalLine(client, askID) {
|
|
|
22126
22152
|
async function invalidReplyToAskProblem(client, owner, resolved) {
|
|
22127
22153
|
if (owner.kind === "issue") {
|
|
22128
22154
|
const issue = resolved?.issue ?? await client.getIssue(owner.issue);
|
|
22129
|
-
return askIDInputProblem(issue.open_asks, "this issue's");
|
|
22155
|
+
return askIDInputProblem(issue.open_asks ?? [], "this issue's");
|
|
22130
22156
|
}
|
|
22131
22157
|
if (resolved === undefined)
|
|
22132
22158
|
throw new Error("project document is missing its resolved artifact");
|
|
@@ -22166,18 +22192,24 @@ function approvalLine(artifact) {
|
|
|
22166
22192
|
return `Approval: approved v${approval.version} by ${approval.by?.id ?? "unknown"}, changed since (now v${approval.latest_version}) - the human's own answer to a decision block carries the approval when that answer is the whole change since v${approval.version}; for any other change, request approval again once the human has agreed to every point in this version, with a --summary naming what changed since v${approval.version}${content}`;
|
|
22167
22193
|
case "changes_requested":
|
|
22168
22194
|
return `Approval: changes requested on v${approval.version} by ${approval.by?.id ?? "unknown"}: ${approval.reason ?? ""}${content}`;
|
|
22195
|
+
default:
|
|
22196
|
+
return `Approval: ${approval.state} on v${approval.version}${content}`;
|
|
22169
22197
|
}
|
|
22170
22198
|
}
|
|
22171
22199
|
function componentsLine(components) {
|
|
22200
|
+
const ids = components.ids ?? [];
|
|
22201
|
+
const unknown = components.unknown ?? [];
|
|
22172
22202
|
const inherited = components.inherited_from === null ? "" : ` (inherited from ${components.inherited_from})`;
|
|
22173
|
-
const retired =
|
|
22203
|
+
const retired = unknown.length === 0 ? "" : ` (retired: ${unknown.join(", ")})`;
|
|
22174
22204
|
switch (components.mode) {
|
|
22175
22205
|
case "explicit":
|
|
22176
|
-
return `Components: ${
|
|
22206
|
+
return `Components: ${ids.length === 0 ? "none live" : ids.join(", ")}${inherited}${retired}`;
|
|
22177
22207
|
case "none":
|
|
22178
22208
|
return `Components: none \u2014 ${components.reason ?? ""}${inherited}`;
|
|
22179
22209
|
case "inherit":
|
|
22180
22210
|
return "Components: unassigned";
|
|
22211
|
+
default:
|
|
22212
|
+
return `Components: ${components.mode}${inherited}${retired}`;
|
|
22181
22213
|
}
|
|
22182
22214
|
}
|
|
22183
22215
|
function claimText(claim, agents, read = {}) {
|
|
@@ -22227,6 +22259,9 @@ function agentLiveness(agent) {
|
|
|
22227
22259
|
function holdsSession(claim) {
|
|
22228
22260
|
return claim?.actor.kind === "session";
|
|
22229
22261
|
}
|
|
22262
|
+
function isRouteStatus(value) {
|
|
22263
|
+
return ISSUE_ROUTE_STATUSES.some((status) => status === value);
|
|
22264
|
+
}
|
|
22230
22265
|
function routeHeldBySession(issue) {
|
|
22231
22266
|
return issue.route_status === "live" && issue.route?.startsWith("role:") === true;
|
|
22232
22267
|
}
|
|
@@ -22240,7 +22275,8 @@ function routeText(issue, titles) {
|
|
|
22240
22275
|
no_holder: issue.route.startsWith("role:") ? " (nobody holds it right now)" : " (that session is not running right now)",
|
|
22241
22276
|
unknown: issue.route_status_reason === "refilling" ? " (the Envoy listener's agent list is refilling, so whether it reaches anyone is unknown; try again in a moment)" : " (the Envoy listener did not answer, so whether it reaches anyone is unknown)"
|
|
22242
22277
|
};
|
|
22243
|
-
|
|
22278
|
+
const status = issue.route_status;
|
|
22279
|
+
return issue.route + (status != null && isRouteStatus(status) ? reach[status] : "");
|
|
22244
22280
|
}
|
|
22245
22281
|
function progressText(progress, sep) {
|
|
22246
22282
|
if (progress === undefined)
|
|
@@ -22257,12 +22293,13 @@ function formatCheckResults(results) {
|
|
|
22257
22293
|
if (results.verification_artifact_id === "") {
|
|
22258
22294
|
return `${results.issue} has no Verification document, so it has no checks. Write one (verification.md) with a check block per thing that must be proved.`;
|
|
22259
22295
|
}
|
|
22260
|
-
|
|
22296
|
+
const checks = results.checks ?? [];
|
|
22297
|
+
if (checks.length === 0) {
|
|
22261
22298
|
return `${results.issue}'s Verification document holds no check blocks.`;
|
|
22262
22299
|
}
|
|
22263
|
-
const lines =
|
|
22300
|
+
const lines = checks.map((check) => {
|
|
22264
22301
|
const head = `- ${check.block_id} (${check.when}): `;
|
|
22265
|
-
const latest = check.results[0];
|
|
22302
|
+
const latest = (check.results ?? [])[0];
|
|
22266
22303
|
if (latest === undefined) {
|
|
22267
22304
|
return `${head}no result yet. ${check.text}`;
|
|
22268
22305
|
}
|
|
@@ -22297,7 +22334,10 @@ function refuseUnsavedRepository(verb, issue, repo) {
|
|
|
22297
22334
|
throw new Error(`Dispatch ${verb} ${issue.key} without its repository: this Dispatch server predates repository fields, so ${lost}; upgrade the server`);
|
|
22298
22335
|
}
|
|
22299
22336
|
function issueSummary(issue, events, references, graph, linkBase, coverage, agents) {
|
|
22300
|
-
const asks = issue.open_asks;
|
|
22337
|
+
const asks = issue.open_asks ?? [];
|
|
22338
|
+
const labels = issue.labels ?? [];
|
|
22339
|
+
const links = issue.external_links ?? [];
|
|
22340
|
+
const members = typeof references === "string" ? [] : references.members ?? [];
|
|
22301
22341
|
const spec = issue.artifacts?.find((artifact) => artifact.primary);
|
|
22302
22342
|
const specApproval = spec === undefined ? undefined : approvalLine(spec);
|
|
22303
22343
|
if (issue.priority === undefined)
|
|
@@ -22319,21 +22359,21 @@ function issueSummary(issue, events, references, graph, linkBase, coverage, agen
|
|
|
22319
22359
|
`Assignee: ${issue.assignee ?? "unassigned"}`,
|
|
22320
22360
|
`Claimed by: ${issue.claim === null ? "nobody" : claimText(issue.claim, agents, issue)}`,
|
|
22321
22361
|
...issue.priority === null ? [] : [`Priority: P${issue.priority}`],
|
|
22322
|
-
`Labels: ${
|
|
22362
|
+
`Labels: ${labels.length === 0 ? "none" : labels.join(", ")}`,
|
|
22323
22363
|
componentsLine(issue.components),
|
|
22324
22364
|
`Route: ${routeText(issue, agents?.titles)}`,
|
|
22325
22365
|
repositoryLine(issue),
|
|
22326
22366
|
`Progress: ${progressText(issue.progress, ", ") || "none"}`,
|
|
22327
22367
|
...specApproval === undefined ? [] : [`Spec ${specApproval.replace(/^Approval/, "approval")}`],
|
|
22328
|
-
...typeof coverage === "string" ? [`Coverage: ${coverage}`] : coverage.gaps.map((gap) => `Coverage: ${gap}`),
|
|
22368
|
+
...typeof coverage === "string" ? [`Coverage: ${coverage}`] : (coverage.gaps ?? []).map((gap) => `Coverage: ${gap}`),
|
|
22329
22369
|
"External links:",
|
|
22330
|
-
...
|
|
22370
|
+
...links.length === 0 ? ["- none"] : links.map((link) => `- ${link.url}${link.kind === undefined ? "" : ` (${link.kind})`}`),
|
|
22331
22371
|
"Documents:",
|
|
22332
22372
|
...documentListLines(issue.artifacts ?? []),
|
|
22333
22373
|
"Open asks:",
|
|
22334
22374
|
...asks.length === 0 ? ["- none"] : asks.map((ask) => `- ${ask.id}: ${ask.question}`),
|
|
22335
22375
|
"References:",
|
|
22336
|
-
...typeof references === "string" ? [`- ${references}`] :
|
|
22376
|
+
...typeof references === "string" ? [`- ${references}`] : members.length === 0 ? ["- none"] : members.map(({ artifact, depth, via }) => `- ${artifact.project}/${artifact.slug} \xB7 depth ${depth} via ${via.kind} ${via.id}`),
|
|
22337
22377
|
...typeof references === "string" || !references.truncated ? [] : ["- more references beyond 8 hops"],
|
|
22338
22378
|
"Events:",
|
|
22339
22379
|
...events.length === 0 ? ["- none"] : events.map(eventLine),
|
|
@@ -22344,9 +22384,10 @@ function issueSummary(issue, events, references, graph, linkBase, coverage, agen
|
|
|
22344
22384
|
function referenceLines(read) {
|
|
22345
22385
|
if (typeof read === "string")
|
|
22346
22386
|
return [`- ${read}`];
|
|
22347
|
-
|
|
22387
|
+
const edges = read.edges ?? [];
|
|
22388
|
+
if (edges.length === 0)
|
|
22348
22389
|
return ["- none"];
|
|
22349
|
-
return
|
|
22390
|
+
return edges.map(edgeLine);
|
|
22350
22391
|
}
|
|
22351
22392
|
function isItemKind(kind) {
|
|
22352
22393
|
return ITEM_KINDS.some((item) => item === kind);
|
|
@@ -22403,7 +22444,7 @@ function graphSectionLines(incoming, outgoing) {
|
|
|
22403
22444
|
function nodeLine(node) {
|
|
22404
22445
|
if (node.made_by === undefined)
|
|
22405
22446
|
return [];
|
|
22406
|
-
const fact = (by, time) => `${by
|
|
22447
|
+
const fact = (by, time) => `${by == null || by.length === 0 ? "nobody recorded" : by.map(actorText).join(", ")}${time == null ? "" : ` at ${time}`}`;
|
|
22407
22448
|
const made = fact(node.made_by, node.made_at);
|
|
22408
22449
|
const changed = fact(node.changed_by, node.changed_at);
|
|
22409
22450
|
const { parent } = node;
|
|
@@ -22451,9 +22492,9 @@ async function typedBlockOf(client, ref) {
|
|
|
22451
22492
|
function askPartNoun(ask, node, blockID) {
|
|
22452
22493
|
if (ask.answer?.id === blockID)
|
|
22453
22494
|
return "Answer";
|
|
22454
|
-
if (ask.options.some((option) => option.id === blockID))
|
|
22495
|
+
if ((ask.options ?? []).some((option) => option.id === blockID))
|
|
22455
22496
|
return "Option";
|
|
22456
|
-
const placed = (ask.revision ?? 0) > 0 && ask.options.every((option) => option.id !== undefined) && (ask.answer === null || ask.answer.id !== undefined);
|
|
22497
|
+
const placed = (ask.revision ?? 0) > 0 && (ask.options ?? []).every((option) => option.id !== undefined) && (ask.answer === null || ask.answer.id !== undefined);
|
|
22457
22498
|
return placed && node.pin?.state !== "removed" ? "Question" : "Part";
|
|
22458
22499
|
}
|
|
22459
22500
|
function logSummary(issue, events) {
|
|
@@ -22526,16 +22567,16 @@ function childrenSummary(issue) {
|
|
|
22526
22567
|
return [
|
|
22527
22568
|
`Key: ${issue.key}`,
|
|
22528
22569
|
"Children:",
|
|
22529
|
-
...issue.children.length === 0 ? ["- none"] : issue.children.map((child) => `- ${child.key}: ${child.title} (${child.status})`)
|
|
22570
|
+
...(issue.children ?? []).length === 0 ? ["- none"] : (issue.children ?? []).map((child) => `- ${child.key}: ${child.title} (${child.status})`)
|
|
22530
22571
|
].join(`
|
|
22531
22572
|
`);
|
|
22532
22573
|
}
|
|
22533
22574
|
function askSummary({ ask, replies, answers }, askRef, pictures, incoming, outgoing) {
|
|
22534
22575
|
const answer = ask.answer;
|
|
22535
|
-
const earlierAnswers = answers.slice(0, -1);
|
|
22576
|
+
const earlierAnswers = (answers ?? []).slice(0, -1);
|
|
22536
22577
|
const parts = askPartEdges(ask, incoming);
|
|
22537
22578
|
const partRef = (id) => `${askRef}#b-${encodeBlockId(id)}`;
|
|
22538
|
-
const chain = replies.flatMap((reply) => [
|
|
22579
|
+
const chain = (replies ?? []).flatMap((reply) => [
|
|
22539
22580
|
`${reply.id} \xB7 ${actorText(reply.author)}`,
|
|
22540
22581
|
`Body: ${reply.body}`
|
|
22541
22582
|
]);
|
|
@@ -22543,7 +22584,7 @@ function askSummary({ ask, replies, answers }, askRef, pictures, incoming, outgo
|
|
|
22543
22584
|
`Question: ${ask.question}`,
|
|
22544
22585
|
...anchorLines(ask),
|
|
22545
22586
|
"Options:",
|
|
22546
|
-
...ask.options.length === 0 ? ["- none"] : ask.options.flatMap((option) => [
|
|
22587
|
+
...(ask.options ?? []).length === 0 ? ["- none"] : (ask.options ?? []).flatMap((option) => [
|
|
22547
22588
|
`- ${option.label}${option.description ? ` \u2014 ${option.description}` : ""}${option.id === undefined ? "" : ` (${partRef(option.id)})`}`,
|
|
22548
22589
|
...partReferenceLines(parts.at, option.id)
|
|
22549
22590
|
]),
|
|
@@ -22552,7 +22593,7 @@ function askSummary({ ask, replies, answers }, askRef, pictures, incoming, outgo
|
|
|
22552
22593
|
"Answer:",
|
|
22553
22594
|
...answer === null ? ["- none"] : [
|
|
22554
22595
|
`- By: ${actorActText(answer.user, answer.act)}`,
|
|
22555
|
-
`- Selected: ${answer.selected.length === 0 ? "none" : answer.selected.join(", ")}`,
|
|
22596
|
+
`- Selected: ${(answer.selected ?? []).length === 0 ? "none" : (answer.selected ?? []).join(", ")}`,
|
|
22556
22597
|
...answer.text === null ? [] : [`- Text: ${answer.text}`],
|
|
22557
22598
|
...answer.id === undefined ? [] : [`- Reference: ${partRef(answer.id)}`],
|
|
22558
22599
|
...partReferenceLines(parts.at, answer.id)
|
|
@@ -22575,12 +22616,12 @@ function askSummary({ ask, replies, answers }, askRef, pictures, incoming, outgo
|
|
|
22575
22616
|
`);
|
|
22576
22617
|
}
|
|
22577
22618
|
function askPartEdges(ask, incoming) {
|
|
22578
|
-
const ids = new Set([...ask.options.map((option) => option.id), ask.answer?.id].filter((id) => id !== undefined));
|
|
22619
|
+
const ids = new Set([...(ask.options ?? []).map((option) => option.id), ask.answer?.id].filter((id) => id !== undefined));
|
|
22579
22620
|
const at = new Map;
|
|
22580
22621
|
if (typeof incoming === "string" || ids.size === 0)
|
|
22581
22622
|
return { at, rest: incoming };
|
|
22582
22623
|
const rest = [];
|
|
22583
|
-
for (const edge of incoming.edges) {
|
|
22624
|
+
for (const edge of incoming.edges ?? []) {
|
|
22584
22625
|
const part = edge.block?.block_id;
|
|
22585
22626
|
if (part === undefined || !ids.has(part)) {
|
|
22586
22627
|
rest.push(edge);
|
|
@@ -22624,8 +22665,8 @@ function formatOpenAsksSummary(response, baseUrl) {
|
|
|
22624
22665
|
return ["There are no unanswered asks for this session.", `Scope: ${scope}.`].join(`
|
|
22625
22666
|
`);
|
|
22626
22667
|
}
|
|
22627
|
-
const waitingOnHuman = response.asks.filter((ask) => ask.waiting_on === "human");
|
|
22628
|
-
const waitingOnAgent = response.asks.filter((ask) => ask.waiting_on === "agent");
|
|
22668
|
+
const waitingOnHuman = (response.asks ?? []).filter((ask) => ask.waiting_on === "human");
|
|
22669
|
+
const waitingOnAgent = (response.asks ?? []).filter((ask) => ask.waiting_on === "agent");
|
|
22629
22670
|
return [
|
|
22630
22671
|
`${response.count} unanswered ${response.count === 1 ? "ask" : "asks"} you authored on active issues and project documents.`,
|
|
22631
22672
|
"",
|
|
@@ -22638,7 +22679,7 @@ function formatOpenAsksSummary(response, baseUrl) {
|
|
|
22638
22679
|
`);
|
|
22639
22680
|
}
|
|
22640
22681
|
function whoamiPerson(identity) {
|
|
22641
|
-
return identity.kind === "
|
|
22682
|
+
return identity.kind === "user" ? identity.login.toLowerCase() : identity.owner;
|
|
22642
22683
|
}
|
|
22643
22684
|
var INBOX_QUESTION_HEAD = 80;
|
|
22644
22685
|
function inboxSnoozed(row, now) {
|
|
@@ -22650,7 +22691,8 @@ function inboxSnoozed(row, now) {
|
|
|
22650
22691
|
function inboxSection(row, now) {
|
|
22651
22692
|
if (inboxSnoozed(row, now))
|
|
22652
22693
|
return "later";
|
|
22653
|
-
|
|
22694
|
+
const waiting = row.waiting_on;
|
|
22695
|
+
return waiting === "agent" || waiting === "human" ? waiting : undefined;
|
|
22654
22696
|
}
|
|
22655
22697
|
function inboxAskOwner(row) {
|
|
22656
22698
|
const key = row.issue?.key ?? row.issue_key;
|
|
@@ -22672,9 +22714,10 @@ function inboxAskLine(row) {
|
|
|
22672
22714
|
return `- ${label} \xB7 ${priority} \xB7 ${row.kind} \xB7 ${textHead(row.question, INBOX_QUESTION_HEAD)} \xB7 ${ref}`;
|
|
22673
22715
|
}
|
|
22674
22716
|
function inboxThreadLabel(row) {
|
|
22675
|
-
|
|
22676
|
-
|
|
22677
|
-
|
|
22717
|
+
const thread = inboxThreadRow(row);
|
|
22718
|
+
if (thread.kind === "agent")
|
|
22719
|
+
return thread.session.name;
|
|
22720
|
+
return thread.issue?.key ?? thread.document?.slug ?? thread.thread_id;
|
|
22678
22721
|
}
|
|
22679
22722
|
function inboxReplyAge(at, now) {
|
|
22680
22723
|
const minutes = Math.floor(Math.max(0, now - Date.parse(at)) / 60000);
|
|
@@ -22701,7 +22744,7 @@ function credentialRequestLine(request) {
|
|
|
22701
22744
|
const session = request.session ?? null;
|
|
22702
22745
|
return [
|
|
22703
22746
|
`- ${request.kind}`,
|
|
22704
|
-
request.identifiers.join(", "),
|
|
22747
|
+
(request.identifiers ?? []).join(", "),
|
|
22705
22748
|
request.requested_at,
|
|
22706
22749
|
...session === null ? [] : [`session request=${session.request ?? "-"}, enrollment=${session.enrollment ?? "-"}`],
|
|
22707
22750
|
...request.approve_url === undefined ? [] : [request.approve_url]
|
|
@@ -22742,7 +22785,7 @@ function commentSummary({ comment, replies }, graph) {
|
|
|
22742
22785
|
...replyBlockLines(comment),
|
|
22743
22786
|
`Body: ${comment.body}`
|
|
22744
22787
|
];
|
|
22745
|
-
const chain = replies.flatMap((reply) => [
|
|
22788
|
+
const chain = (replies ?? []).flatMap((reply) => [
|
|
22746
22789
|
`${reply.id} \xB7 ${actorText(reply.author)}`,
|
|
22747
22790
|
...anchorLines(reply),
|
|
22748
22791
|
...replyBlockLines(reply),
|
|
@@ -22775,10 +22818,10 @@ function anchorLines(record) {
|
|
|
22775
22818
|
}
|
|
22776
22819
|
function positionText(block) {
|
|
22777
22820
|
const { table, path } = block;
|
|
22778
|
-
const segments = path.map((entry) => `${entry.type}[${entry.index}]`);
|
|
22821
|
+
const segments = (path ?? []).map((entry) => `${entry.type}[${entry.index}]`);
|
|
22779
22822
|
if (table === undefined || table.row === null)
|
|
22780
22823
|
return segments.join(" \u203A ");
|
|
22781
|
-
const tableAt = path.findIndex((entry) => entry.type === "table");
|
|
22824
|
+
const tableAt = (path ?? []).findIndex((entry) => entry.type === "table");
|
|
22782
22825
|
const cells = table.cells ?? [];
|
|
22783
22826
|
const label = (table.column === null ? cells : cells.slice(0, table.column)).map((cell) => cell.trim()).filter((cell) => cell !== "" && !/^\d+$/.test(cell)).join(" \xB7 ");
|
|
22784
22827
|
const row = label === "" ? `row ${table.row}` : `row ${table.row} (${label})`;
|
|
@@ -22794,7 +22837,7 @@ function messageSummary({ message, replies }, graph) {
|
|
|
22794
22837
|
...replyBlockLines(message),
|
|
22795
22838
|
`Body: ${message.body}`
|
|
22796
22839
|
];
|
|
22797
|
-
const chain = replies.flatMap((reply) => [
|
|
22840
|
+
const chain = (replies ?? []).flatMap((reply) => [
|
|
22798
22841
|
`${reply.id} \xB7 ${actorText(reply.author)}`,
|
|
22799
22842
|
...replyBlockLines(reply),
|
|
22800
22843
|
`Body: ${reply.body}`
|
|
@@ -22872,7 +22915,8 @@ async function blockAsks(client, resolved, state) {
|
|
|
22872
22915
|
return asks.filter((ask) => typeof ask.block_id === "string" && ask.block_artifact?.id === resolved.artifact.id);
|
|
22873
22916
|
}
|
|
22874
22917
|
async function readUploadedFile(client, artifact, details, requested, owner, shown) {
|
|
22875
|
-
const
|
|
22918
|
+
const versions = artifact.versions ?? [];
|
|
22919
|
+
const latest = Math.max(0, ...versions.map((version) => version.number));
|
|
22876
22920
|
const number = requested ?? latest;
|
|
22877
22921
|
const of = number === latest ? "" : ` of ${latest}`;
|
|
22878
22922
|
const bytesRoute = `GET /api/v1/artifacts/${artifact.id}/versions/${number} serves its bytes.`;
|
|
@@ -22880,7 +22924,7 @@ async function readUploadedFile(client, artifact, details, requested, owner, sho
|
|
|
22880
22924
|
text: `${oversizePictureText(artifact.name, bytes)}, so dispatch doc-read cannot show this ` + `uploaded ${mime} picture (version ${number}${of}). ${bytesRoute}`,
|
|
22881
22925
|
details
|
|
22882
22926
|
});
|
|
22883
|
-
const stated =
|
|
22927
|
+
const stated = versions.find((version) => version.number === number);
|
|
22884
22928
|
if (artifact.kind === "image" && stated?.size !== undefined && stated.size > PICTURE_SHOWN_MAX_BYTES) {
|
|
22885
22929
|
return tooLarge(stated.mime ?? "image", stated.size);
|
|
22886
22930
|
}
|
|
@@ -22947,9 +22991,9 @@ async function listDocumentBlocks(client, artifact) {
|
|
|
22947
22991
|
if (block.table === undefined) {
|
|
22948
22992
|
lines.push(`${indent} This Dispatch does not report table rows yet, so no row or column index is listed.`);
|
|
22949
22993
|
} else {
|
|
22950
|
-
for (const row of block.table.rows) {
|
|
22994
|
+
for (const row of block.table.rows ?? []) {
|
|
22951
22995
|
lines.push(`${indent} row ${row.index}, ${row.id === "" ? "no id yet" : `id ${row.id}`}`);
|
|
22952
|
-
for (const cell of row.cells) {
|
|
22996
|
+
for (const cell of row.cells ?? []) {
|
|
22953
22997
|
const under = cell.header === "" ? "" : `, under ${JSON.stringify(cell.header)}`;
|
|
22954
22998
|
lines.push(`${indent} row ${cell.row} column ${cell.column}, ${cell.id === "" ? "no id yet" : `id ${cell.id}`}${under}: ${cell.text === "" ? "(empty)" : cell.text}`);
|
|
22955
22999
|
}
|
|
@@ -23170,7 +23214,7 @@ async function executeDispatchTool(input) {
|
|
|
23170
23214
|
throw error;
|
|
23171
23215
|
}
|
|
23172
23216
|
return {
|
|
23173
|
-
text: renderSessionAnswersList(response.items, { now: Date.now() }),
|
|
23217
|
+
text: renderSessionAnswersList(response.items ?? [], { now: Date.now() }),
|
|
23174
23218
|
details: { session: sessionId, since: response.since, total: response.total }
|
|
23175
23219
|
};
|
|
23176
23220
|
}
|
|
@@ -23181,9 +23225,10 @@ async function executeDispatchTool(input) {
|
|
|
23181
23225
|
const client = dispatchClient();
|
|
23182
23226
|
const identity = await client.whoami();
|
|
23183
23227
|
const owner = whoamiPerson(identity);
|
|
23184
|
-
const
|
|
23185
|
-
const
|
|
23186
|
-
const
|
|
23228
|
+
const agent = identity.kind === "agent" ? identity : undefined;
|
|
23229
|
+
const service = agent?.service ?? null;
|
|
23230
|
+
const proved = agent?.session ?? null;
|
|
23231
|
+
const project = agent?.project ?? null;
|
|
23187
23232
|
const session = proved ?? sessionId;
|
|
23188
23233
|
const unowned = "no owner, so an issue you create without an assignee takes its parent's assignee, else the project's default assignee, else nobody.";
|
|
23189
23234
|
const signInNeeded = owner === null && service !== null && proved !== null;
|
|
@@ -23393,9 +23438,10 @@ async function executeDispatchTool(input) {
|
|
|
23393
23438
|
throw withAccount(error, told);
|
|
23394
23439
|
}
|
|
23395
23440
|
}
|
|
23396
|
-
const
|
|
23441
|
+
const existingLinks = before.external_links ?? [];
|
|
23442
|
+
const linked = existingLinks.map((link) => link.url);
|
|
23397
23443
|
const newLinks = requestedLinks?.filter((url) => !linked.includes(url)) ?? [];
|
|
23398
|
-
const sentLinks = requestedLinks === undefined ? undefined : requestedLinks.length === 0 ? [] : [...
|
|
23444
|
+
const sentLinks = requestedLinks === undefined ? undefined : requestedLinks.length === 0 ? [] : [...existingLinks, ...newLinks.map((url) => ({ url }))];
|
|
23399
23445
|
const rank = rankBefore === undefined && rankAfter === undefined ? undefined : {
|
|
23400
23446
|
...rankBefore === undefined ? {} : { before: rankBefore },
|
|
23401
23447
|
...rankAfter === undefined ? {} : { after: rankAfter }
|
|
@@ -23430,12 +23476,15 @@ async function executeDispatchTool(input) {
|
|
|
23430
23476
|
throw withAccount(error, landed);
|
|
23431
23477
|
}
|
|
23432
23478
|
refuseUnsavedRepository("updated", after, repo);
|
|
23433
|
-
const
|
|
23479
|
+
const links = after.external_links ?? [];
|
|
23480
|
+
const linkCount = `(${links.length} ${links.length === 1 ? "link" : "links"})`;
|
|
23434
23481
|
const changes = [
|
|
23435
23482
|
...closingNote === undefined ? [] : [`reason posted as message ${closingNote.id} (${closingNote.ref})`],
|
|
23436
23483
|
...status === undefined ? [] : [`status ${before.status} -> ${after.status}`],
|
|
23437
23484
|
...title === undefined ? [] : [`title "${after.title}"`],
|
|
23438
|
-
...labels === undefined ? [] : [
|
|
23485
|
+
...labels === undefined ? [] : [
|
|
23486
|
+
(after.labels ?? []).length === 0 ? "labels cleared" : `labels ${(after.labels ?? []).join(", ")}`
|
|
23487
|
+
],
|
|
23439
23488
|
...priority === undefined ? [] : [after.priority === null ? "priority cleared" : `priority -> P${after.priority}`],
|
|
23440
23489
|
...rank === undefined ? [] : [
|
|
23441
23490
|
`rank -> ${[
|
|
@@ -23449,7 +23498,7 @@ async function executeDispatchTool(input) {
|
|
|
23449
23498
|
...route === undefined ? [] : [after.route === null ? "route cleared" : `route ${after.route}`],
|
|
23450
23499
|
...parent === undefined ? [] : [after.parent === null ? "parent cleared" : `parent -> ${after.parent}`],
|
|
23451
23500
|
...blockedBy === undefined ? [] : [
|
|
23452
|
-
after.blocked_by.length === 0 ? "blocked_by cleared" : `blocked by ${after.blocked_by.join(", ")}`
|
|
23501
|
+
(after.blocked_by ?? []).length === 0 ? "blocked_by cleared" : `blocked by ${(after.blocked_by ?? []).join(", ")}`
|
|
23453
23502
|
],
|
|
23454
23503
|
...components === undefined ? [] : [componentsChange(components, after.components)],
|
|
23455
23504
|
...repo === undefined ? [] : [
|
|
@@ -23468,7 +23517,7 @@ async function executeDispatchTool(input) {
|
|
|
23468
23517
|
details: {
|
|
23469
23518
|
issue: after.key,
|
|
23470
23519
|
status: after.status,
|
|
23471
|
-
external_links: after.external_links.map((link) => link.url),
|
|
23520
|
+
external_links: (after.external_links ?? []).map((link) => link.url),
|
|
23472
23521
|
...closingNote === undefined ? {} : { message: closingNote.id },
|
|
23473
23522
|
...after.advice === undefined ? {} : { advice: after.advice }
|
|
23474
23523
|
}
|
|
@@ -23564,7 +23613,7 @@ async function executeDispatchTool(input) {
|
|
|
23564
23613
|
offset: optionalNumber(args, "offset") ?? 0
|
|
23565
23614
|
});
|
|
23566
23615
|
const { total, limit, offset } = page;
|
|
23567
|
-
const rows = page.issues.map((row) => ({
|
|
23616
|
+
const rows = (page.issues ?? []).map((row) => ({
|
|
23568
23617
|
key: row.key,
|
|
23569
23618
|
title: row.title,
|
|
23570
23619
|
status: row.status,
|
|
@@ -24083,7 +24132,7 @@ ${recorded.line}`,
|
|
|
24083
24132
|
const results = await client.issueResults(issue);
|
|
24084
24133
|
return {
|
|
24085
24134
|
text: formatCheckResults(results),
|
|
24086
|
-
details: { issue, checks: results.checks.length }
|
|
24135
|
+
details: { issue, checks: (results.checks ?? []).length }
|
|
24087
24136
|
};
|
|
24088
24137
|
}
|
|
24089
24138
|
case "dispatch_artifact": {
|
|
@@ -24215,7 +24264,7 @@ ${handoff.body}`,
|
|
|
24215
24264
|
const thread = await client.getMessageThread(messageIdOf(message), sessionId);
|
|
24216
24265
|
const issueKey = thread.message.issue_key;
|
|
24217
24266
|
const [pictures, graph] = await Promise.all([
|
|
24218
|
-
picturesOf(datedBodies([thread.message, ...thread.replies])),
|
|
24267
|
+
picturesOf(datedBodies([thread.message, ...thread.replies ?? []])),
|
|
24219
24268
|
issueKey === null ? [] : graphSections(client, dispatchChildRef(dispatchIssueRef(issueKey), "message", thread.message.id))
|
|
24220
24269
|
]);
|
|
24221
24270
|
return {
|
|
@@ -24255,7 +24304,7 @@ ${handoff.body}`,
|
|
|
24255
24304
|
await refuseItemOffRef(input.tool, "comment", ref, stringArg(args, "ref"), comment.comment, () => documentIdOf(ref));
|
|
24256
24305
|
const commentRef = refTarget(ref, "comment", id);
|
|
24257
24306
|
const [pictures, graph] = await Promise.all([
|
|
24258
|
-
picturesOf(datedBodies([comment.comment, ...comment.replies])),
|
|
24307
|
+
picturesOf(datedBodies([comment.comment, ...comment.replies ?? []])),
|
|
24259
24308
|
graphSections(client, commentRef)
|
|
24260
24309
|
]);
|
|
24261
24310
|
return {
|
|
@@ -24271,7 +24320,7 @@ ${handoff.body}`,
|
|
|
24271
24320
|
const messageRead = await client.getMessage(ownerArguments.ref.owner.issue, ownerArguments.ref.id);
|
|
24272
24321
|
const messageRef = dispatchChildRef(dispatchIssueRef(ownerArguments.ref.owner.issue), "message", ownerArguments.ref.id);
|
|
24273
24322
|
const [pictures, graph] = await Promise.all([
|
|
24274
|
-
picturesOf(datedBodies([messageRead.message, ...messageRead.replies])),
|
|
24323
|
+
picturesOf(datedBodies([messageRead.message, ...messageRead.replies ?? []])),
|
|
24275
24324
|
graphSections(client, messageRef)
|
|
24276
24325
|
]);
|
|
24277
24326
|
return {
|
|
@@ -24339,7 +24388,7 @@ ${handoff.body}`,
|
|
|
24339
24388
|
`Issue: ${resolved.issue.key} [${resolved.issue.status}] ${resolved.issue.title}`
|
|
24340
24389
|
],
|
|
24341
24390
|
`Reference: ${documentRef}`,
|
|
24342
|
-
`Versions: ${artifact.versions.length}`,
|
|
24391
|
+
`Versions: ${(artifact.versions ?? []).length}`,
|
|
24343
24392
|
...approval === undefined ? [] : [approval],
|
|
24344
24393
|
...await graphSections(client, documentRef)
|
|
24345
24394
|
].join(`
|
|
@@ -24379,7 +24428,10 @@ ${handoff.body}`,
|
|
|
24379
24428
|
graphSections(client, dispatchIssueRef(read.issue.key)),
|
|
24380
24429
|
liveAgents(client, holdsSession(read.issue.claim) || routeHeldBySession(read.issue)),
|
|
24381
24430
|
picturesOf([
|
|
24382
|
-
...read.issue.open_asks.map((ask) => ({
|
|
24431
|
+
...(read.issue.open_asks ?? []).map((ask) => ({
|
|
24432
|
+
text: ask.question,
|
|
24433
|
+
at: ask.created_at
|
|
24434
|
+
})),
|
|
24383
24435
|
...await eventTextsWhole(client, read.events)
|
|
24384
24436
|
]),
|
|
24385
24437
|
issueCoverageOrReason(client, read.issue.key)
|