@sjawhar/claude-envoy 1.25.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 +137 -85
- package/dist/session-hook.js +136 -84
- package/package.json +1 -1
package/dist/session-hook.js
CHANGED
|
@@ -13610,6 +13610,9 @@ var PROJECT_NAME_MAX = 80;
|
|
|
13610
13610
|
var MAX_ISSUE_PAGE_LIMIT = 250;
|
|
13611
13611
|
var DEFAULT_ISSUE_PAGE_LIMIT = 50;
|
|
13612
13612
|
var ASK_TURNS = ["human", "agent"];
|
|
13613
|
+
function inboxThreadRow(row) {
|
|
13614
|
+
return row.kind === "agent" ? row : row;
|
|
13615
|
+
}
|
|
13613
13616
|
var DELIVERY_CAPABILITIES = ["aside", "btw", "steer"];
|
|
13614
13617
|
var IDEMPOTENCY_KEY_HEADER = "Idempotency-Key";
|
|
13615
13618
|
var IDEMPOTENCY_REPLAYED_HEADER = "Idempotency-Replayed";
|
|
@@ -13960,12 +13963,15 @@ var HOLDING_OF = {
|
|
|
13960
13963
|
unknown: "unknown",
|
|
13961
13964
|
unresponsive: "unresponsive"
|
|
13962
13965
|
};
|
|
13966
|
+
function isHolderState(state) {
|
|
13967
|
+
return Object.hasOwn(HOLDING_OF, state);
|
|
13968
|
+
}
|
|
13963
13969
|
function claimHolds(claim, titles, liveness = {}) {
|
|
13964
13970
|
if (claim.actor.kind !== "session") {
|
|
13965
13971
|
return "holds";
|
|
13966
13972
|
}
|
|
13967
13973
|
const state = liveness.holder_state;
|
|
13968
|
-
if (state != null) {
|
|
13974
|
+
if (state != null && isHolderState(state)) {
|
|
13969
13975
|
return HOLDING_OF[state];
|
|
13970
13976
|
}
|
|
13971
13977
|
if (titles === undefined) {
|
|
@@ -15935,8 +15941,9 @@ function relatedCheckFormOf(suggestions) {
|
|
|
15935
15941
|
return { form: "not_made", reason: missing ?? "the server gave no reason", searchQuery };
|
|
15936
15942
|
}
|
|
15937
15943
|
const mode = relatedCheckModeWords(suggestions);
|
|
15938
|
-
|
|
15939
|
-
|
|
15944
|
+
const related = suggestions.related ?? [];
|
|
15945
|
+
if (related.length > 0) {
|
|
15946
|
+
return { form: "items", mode, related };
|
|
15940
15947
|
}
|
|
15941
15948
|
if (outcome === undefined) {
|
|
15942
15949
|
return {
|
|
@@ -17633,7 +17640,12 @@ function documentLabel(project, slug) {
|
|
|
17633
17640
|
return `${project}/${slug}`;
|
|
17634
17641
|
}
|
|
17635
17642
|
function ownerTitle(owner) {
|
|
17636
|
-
|
|
17643
|
+
const { issue, document } = owner;
|
|
17644
|
+
if (issue !== undefined)
|
|
17645
|
+
return `${issue.key}: ${issue.title}`;
|
|
17646
|
+
if (document !== undefined)
|
|
17647
|
+
return `${document.project} / ${document.name}`;
|
|
17648
|
+
return "";
|
|
17637
17649
|
}
|
|
17638
17650
|
function issueTopic(key) {
|
|
17639
17651
|
return { label: key, topic: dispatchIssueSubject(key, ">") };
|
|
@@ -18644,10 +18656,10 @@ async function wholeCarriedBody(client, item, session) {
|
|
|
18644
18656
|
try {
|
|
18645
18657
|
if (item.resource === "comment") {
|
|
18646
18658
|
const read = await client.getComment(item.id);
|
|
18647
|
-
return [read.comment, ...read.replies].find((comment) => comment.id === item.id)?.body;
|
|
18659
|
+
return [read.comment, ...read.replies ?? []].find((comment) => comment.id === item.id)?.body;
|
|
18648
18660
|
}
|
|
18649
18661
|
const read = item.issueKey === null ? session === undefined ? undefined : await client.getMessageThread(item.id, session) : await client.getMessage(item.issueKey, item.id);
|
|
18650
|
-
return read === undefined ? undefined : [read.message, ...read.replies].find((message) => message.id === item.id)?.body;
|
|
18662
|
+
return read === undefined ? undefined : [read.message, ...read.replies ?? []].find((message) => message.id === item.id)?.body;
|
|
18651
18663
|
} catch {
|
|
18652
18664
|
return;
|
|
18653
18665
|
}
|
|
@@ -19238,7 +19250,7 @@ function askTexts({ ask, replies }) {
|
|
|
19238
19250
|
{ text: ask.question, at: ask.created_at },
|
|
19239
19251
|
...ask.answer?.text ? [{ text: ask.answer.text, at: ask.answer.at }] : [],
|
|
19240
19252
|
...ask.resolution === undefined ? [] : [{ text: ask.resolution.reason, at: ask.resolution.at }],
|
|
19241
|
-
...datedBodies(replies)
|
|
19253
|
+
...datedBodies(replies ?? [])
|
|
19242
19254
|
];
|
|
19243
19255
|
}
|
|
19244
19256
|
function eventTexts(event) {
|
|
@@ -19361,7 +19373,7 @@ async function readPictures(client, addresses, shown) {
|
|
|
19361
19373
|
artifacts.set(target.key, read);
|
|
19362
19374
|
}
|
|
19363
19375
|
const artifact = await read;
|
|
19364
|
-
const version = artifact.versions.find((candidate) => candidate.number === target.version);
|
|
19376
|
+
const version = (artifact.versions ?? []).find((candidate) => candidate.number === target.version);
|
|
19365
19377
|
if (version === undefined) {
|
|
19366
19378
|
skip(`${artifact.name} has no version ${target.version}`);
|
|
19367
19379
|
continue;
|
|
@@ -19477,7 +19489,7 @@ function searchHitLine(result, baseUrl) {
|
|
|
19477
19489
|
const href = new URL(result.href, baseUrl).toString();
|
|
19478
19490
|
const { owner } = result;
|
|
19479
19491
|
if (owner.kind === "document") {
|
|
19480
|
-
const reference = dispatchDocumentRef(owner.project, owner.slug);
|
|
19492
|
+
const reference = dispatchDocumentRef(owner.project ?? "", owner.slug ?? "");
|
|
19481
19493
|
return `${reference} [document] ${owner.name} - ${result.kind}: ${snippetText(result.snippet)} -> ${href}`;
|
|
19482
19494
|
}
|
|
19483
19495
|
const artifactName = result.artifact ? ` ${result.artifact.name}` : "";
|
|
@@ -19489,7 +19501,8 @@ function indentedText(text) {
|
|
|
19489
19501
|
`);
|
|
19490
19502
|
}
|
|
19491
19503
|
function answerLines(lead, answer) {
|
|
19492
|
-
const
|
|
19504
|
+
const chosen = answer.selected ?? [];
|
|
19505
|
+
const selected = chosen.length === 0 ? "none" : chosen.join(", ");
|
|
19493
19506
|
const text = answer.text === null || answer.text === "" ? "none" : indentedText(answer.text);
|
|
19494
19507
|
return [
|
|
19495
19508
|
` ${lead} by ${actorActText(answer.user, answer.act)} at ${answer.at} \xB7 options chosen: ${selected}`,
|
|
@@ -19503,16 +19516,21 @@ function askStateLines(ask) {
|
|
|
19503
19516
|
if (ask === undefined) {
|
|
19504
19517
|
return [" Answer state not reported by this Dispatch; open the link to read the ask."];
|
|
19505
19518
|
}
|
|
19519
|
+
const resolution = ask.resolution;
|
|
19520
|
+
const closed = resolution === undefined ? "closed, and this Dispatch did not say by whom" : resolutionText(resolution);
|
|
19506
19521
|
switch (ask.state) {
|
|
19507
19522
|
case "open":
|
|
19508
19523
|
return [" Open: no answer yet."];
|
|
19509
19524
|
case "answered":
|
|
19510
|
-
return answerLines("Answered", ask.answer);
|
|
19525
|
+
return ask.answer === undefined ? [" Answered; this Dispatch did not carry the answer. Open the link to read it."] : answerLines("Answered", ask.answer);
|
|
19511
19526
|
case "resolved":
|
|
19512
|
-
return ask.answer === undefined ? [` Closed with no answer: ${
|
|
19513
|
-
|
|
19514
|
-
|
|
19527
|
+
return ask.answer === undefined ? [` Closed with no answer: ${closed}`] : [` Closed after an answer: ${closed}`, ...answerLines("Last answer", ask.answer)];
|
|
19528
|
+
default: {
|
|
19529
|
+
const unreportedState = ask.state;
|
|
19530
|
+
return [
|
|
19531
|
+
` Answer state "${String(unreportedState)}" is newer than this client; open the link to read the ask.`
|
|
19515
19532
|
];
|
|
19533
|
+
}
|
|
19516
19534
|
}
|
|
19517
19535
|
}
|
|
19518
19536
|
function searchResultLine(result, baseUrl) {
|
|
@@ -19521,7 +19539,7 @@ function searchResultLine(result, baseUrl) {
|
|
|
19521
19539
|
`) : line;
|
|
19522
19540
|
}
|
|
19523
19541
|
function searchAnswer(search, query, offset, configUrl) {
|
|
19524
|
-
const results = search.results;
|
|
19542
|
+
const results = search.results ?? [];
|
|
19525
19543
|
const count = results.length;
|
|
19526
19544
|
const lines = results.map((result) => searchResultLine(result, configUrl));
|
|
19527
19545
|
const noun = count === 1 ? "result" : "results";
|
|
@@ -19746,11 +19764,15 @@ var RELATION_PHRASES = {
|
|
|
19746
19764
|
sent_you_a_message: "sent you a message",
|
|
19747
19765
|
replied_to_your_message: "replied to your message"
|
|
19748
19766
|
};
|
|
19767
|
+
function isSessionAnswerRelation(value) {
|
|
19768
|
+
return Object.hasOwn(RELATION_PHRASES, value);
|
|
19769
|
+
}
|
|
19749
19770
|
function isNoAnswersRoute(error) {
|
|
19750
19771
|
return isNoRoute(error);
|
|
19751
19772
|
}
|
|
19752
19773
|
function renderSessionAnswerItem(item) {
|
|
19753
|
-
const
|
|
19774
|
+
const phrase = isSessionAnswerRelation(item.relation) ? RELATION_PHRASES[item.relation] : item.relation;
|
|
19775
|
+
const relation = `${phrase}${item.replaced === true ? " (replaces an earlier answer)" : ""}`;
|
|
19754
19776
|
const head = [item.at, actorActText(`user ${item.author.id}`, item.author.act), relation];
|
|
19755
19777
|
if (item.edited_at !== undefined)
|
|
19756
19778
|
head.push(`edited ${item.edited_at}`);
|
|
@@ -20179,20 +20201,21 @@ function adviceMemory() {
|
|
|
20179
20201
|
function renderAdvice(tool, key, advice, opts) {
|
|
20180
20202
|
if (advice === undefined)
|
|
20181
20203
|
return [];
|
|
20182
|
-
const
|
|
20183
|
-
const
|
|
20184
|
-
const
|
|
20204
|
+
const issueAdvice = "issue_status" in advice ? advice : undefined;
|
|
20205
|
+
const hasIssueAdvice = issueAdvice !== undefined;
|
|
20206
|
+
const openAsks = issueAdvice?.your_open_asks ?? undefined;
|
|
20207
|
+
const writesSinceHuman = issueAdvice?.session_writes_since_human;
|
|
20185
20208
|
const lines = [];
|
|
20186
20209
|
const unparsed = advice.unparsed_openers;
|
|
20187
20210
|
if (unparsed !== undefined && unparsed.count > 0 && (tool === "dispatch_issue" || tool === "dispatch_artifact")) {
|
|
20188
|
-
const quoted = unparsed.examples.map((example) => JSON.stringify(example)).join(", ");
|
|
20211
|
+
const quoted = (unparsed.examples ?? []).map((example) => JSON.stringify(example)).join(", ");
|
|
20189
20212
|
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`;
|
|
20190
20213
|
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".`);
|
|
20191
20214
|
}
|
|
20192
20215
|
if (advice.decision_blocks === 0 && opts.isPrimarySpec === true && (tool === "dispatch_issue" || tool === "dispatch_artifact")) {
|
|
20193
20216
|
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`.");
|
|
20194
20217
|
}
|
|
20195
|
-
if (
|
|
20218
|
+
if (issueAdvice?.issue_status === "triage" && issueAdvice.legion_managed_status !== true && tool !== "dispatch_issue" && !(tool === "dispatch_issue_update" && opts.setsStatus === true) && !triageAdviceShown.has(key)) {
|
|
20196
20219
|
triageAdviceShown.add(key);
|
|
20197
20220
|
lines.push(`${key} is still in triage \u2014 nobody can see its development status. See the \`dispatch\` skill, "Issue status is yours to move".`);
|
|
20198
20221
|
}
|
|
@@ -20343,17 +20366,19 @@ function optionalComponents(args, name) {
|
|
|
20343
20366
|
function componentsChange(input, after) {
|
|
20344
20367
|
switch (input.mode) {
|
|
20345
20368
|
case "explicit":
|
|
20346
|
-
return `components -> explicit [${after.ids.join(", ")}]`;
|
|
20369
|
+
return `components -> explicit [${(after.ids ?? []).join(", ")}]`;
|
|
20347
20370
|
case "none":
|
|
20348
20371
|
return `components -> none (${after.reason ?? input.reason ?? ""})`;
|
|
20349
20372
|
case "inherit":
|
|
20350
20373
|
return "components -> inherit";
|
|
20374
|
+
default:
|
|
20375
|
+
return `components -> ${input.mode}`;
|
|
20351
20376
|
}
|
|
20352
20377
|
}
|
|
20353
20378
|
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.';
|
|
20354
20379
|
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.";
|
|
20355
20380
|
async function architectureGuidance(client, project, components) {
|
|
20356
|
-
if (components.mode === "none" || components.ids.length > 0)
|
|
20381
|
+
if (components.mode === "none" || (components.ids ?? []).length > 0)
|
|
20357
20382
|
return;
|
|
20358
20383
|
try {
|
|
20359
20384
|
if ((await client.listArchitectureSources(project)).length === 0)
|
|
@@ -20544,7 +20569,7 @@ async function sessionOpenAsks(client, sessionId) {
|
|
|
20544
20569
|
const session = sessionId?.trim();
|
|
20545
20570
|
if (!session)
|
|
20546
20571
|
throw new Error("host session id is required to read this session's open asks");
|
|
20547
|
-
return (await client.openAsks(session)).asks;
|
|
20572
|
+
return (await client.openAsks(session)).asks ?? [];
|
|
20548
20573
|
}
|
|
20549
20574
|
function openAskHints(asks) {
|
|
20550
20575
|
if (asks.length === 0)
|
|
@@ -21017,14 +21042,15 @@ async function resolveArtifact(client, owner, artifactReference, { canonical = f
|
|
|
21017
21042
|
};
|
|
21018
21043
|
}
|
|
21019
21044
|
const issue = await client.getIssue(owner.issue);
|
|
21045
|
+
const issueArtifacts = issue.artifacts ?? [];
|
|
21020
21046
|
let artifact;
|
|
21021
21047
|
if (artifactReference === undefined || artifactReference === "spec") {
|
|
21022
|
-
artifact =
|
|
21048
|
+
artifact = issueArtifacts.find((candidate) => candidate.primary || candidate.id === issue.primary_artifact_id);
|
|
21023
21049
|
} else {
|
|
21024
|
-
artifact = artifactByReference(
|
|
21050
|
+
artifact = artifactByReference(issueArtifacts, artifactReference, { kind: "issue", issue: issue.key }, canonical);
|
|
21025
21051
|
}
|
|
21026
21052
|
if (!artifact) {
|
|
21027
|
-
throw new DocumentNotFoundError(documentReferenceProblem(artifactReference ?? "spec",
|
|
21053
|
+
throw new DocumentNotFoundError(documentReferenceProblem(artifactReference ?? "spec", issueArtifacts, {
|
|
21028
21054
|
kind: "issue",
|
|
21029
21055
|
issue: issue.key
|
|
21030
21056
|
}));
|
|
@@ -21130,7 +21156,7 @@ async function movedApprovalLine(client, askID) {
|
|
|
21130
21156
|
async function invalidReplyToAskProblem(client, owner, resolved) {
|
|
21131
21157
|
if (owner.kind === "issue") {
|
|
21132
21158
|
const issue = resolved?.issue ?? await client.getIssue(owner.issue);
|
|
21133
|
-
return askIDInputProblem(issue.open_asks, "this issue's");
|
|
21159
|
+
return askIDInputProblem(issue.open_asks ?? [], "this issue's");
|
|
21134
21160
|
}
|
|
21135
21161
|
if (resolved === undefined)
|
|
21136
21162
|
throw new Error("project document is missing its resolved artifact");
|
|
@@ -21170,18 +21196,24 @@ function approvalLine(artifact) {
|
|
|
21170
21196
|
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}`;
|
|
21171
21197
|
case "changes_requested":
|
|
21172
21198
|
return `Approval: changes requested on v${approval.version} by ${approval.by?.id ?? "unknown"}: ${approval.reason ?? ""}${content}`;
|
|
21199
|
+
default:
|
|
21200
|
+
return `Approval: ${approval.state} on v${approval.version}${content}`;
|
|
21173
21201
|
}
|
|
21174
21202
|
}
|
|
21175
21203
|
function componentsLine(components) {
|
|
21204
|
+
const ids = components.ids ?? [];
|
|
21205
|
+
const unknown = components.unknown ?? [];
|
|
21176
21206
|
const inherited = components.inherited_from === null ? "" : ` (inherited from ${components.inherited_from})`;
|
|
21177
|
-
const retired =
|
|
21207
|
+
const retired = unknown.length === 0 ? "" : ` (retired: ${unknown.join(", ")})`;
|
|
21178
21208
|
switch (components.mode) {
|
|
21179
21209
|
case "explicit":
|
|
21180
|
-
return `Components: ${
|
|
21210
|
+
return `Components: ${ids.length === 0 ? "none live" : ids.join(", ")}${inherited}${retired}`;
|
|
21181
21211
|
case "none":
|
|
21182
21212
|
return `Components: none \u2014 ${components.reason ?? ""}${inherited}`;
|
|
21183
21213
|
case "inherit":
|
|
21184
21214
|
return "Components: unassigned";
|
|
21215
|
+
default:
|
|
21216
|
+
return `Components: ${components.mode}${inherited}${retired}`;
|
|
21185
21217
|
}
|
|
21186
21218
|
}
|
|
21187
21219
|
function claimText(claim, agents, read = {}) {
|
|
@@ -21231,6 +21263,9 @@ function agentLiveness(agent) {
|
|
|
21231
21263
|
function holdsSession(claim) {
|
|
21232
21264
|
return claim?.actor.kind === "session";
|
|
21233
21265
|
}
|
|
21266
|
+
function isRouteStatus(value) {
|
|
21267
|
+
return ISSUE_ROUTE_STATUSES.some((status) => status === value);
|
|
21268
|
+
}
|
|
21234
21269
|
function routeHeldBySession(issue) {
|
|
21235
21270
|
return issue.route_status === "live" && issue.route?.startsWith("role:") === true;
|
|
21236
21271
|
}
|
|
@@ -21244,7 +21279,8 @@ function routeText(issue, titles) {
|
|
|
21244
21279
|
no_holder: issue.route.startsWith("role:") ? " (nobody holds it right now)" : " (that session is not running right now)",
|
|
21245
21280
|
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)"
|
|
21246
21281
|
};
|
|
21247
|
-
|
|
21282
|
+
const status = issue.route_status;
|
|
21283
|
+
return issue.route + (status != null && isRouteStatus(status) ? reach[status] : "");
|
|
21248
21284
|
}
|
|
21249
21285
|
function progressText(progress, sep) {
|
|
21250
21286
|
if (progress === undefined)
|
|
@@ -21261,12 +21297,13 @@ function formatCheckResults(results) {
|
|
|
21261
21297
|
if (results.verification_artifact_id === "") {
|
|
21262
21298
|
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.`;
|
|
21263
21299
|
}
|
|
21264
|
-
|
|
21300
|
+
const checks = results.checks ?? [];
|
|
21301
|
+
if (checks.length === 0) {
|
|
21265
21302
|
return `${results.issue}'s Verification document holds no check blocks.`;
|
|
21266
21303
|
}
|
|
21267
|
-
const lines =
|
|
21304
|
+
const lines = checks.map((check) => {
|
|
21268
21305
|
const head = `- ${check.block_id} (${check.when}): `;
|
|
21269
|
-
const latest = check.results[0];
|
|
21306
|
+
const latest = (check.results ?? [])[0];
|
|
21270
21307
|
if (latest === undefined) {
|
|
21271
21308
|
return `${head}no result yet. ${check.text}`;
|
|
21272
21309
|
}
|
|
@@ -21301,7 +21338,10 @@ function refuseUnsavedRepository(verb, issue, repo) {
|
|
|
21301
21338
|
throw new Error(`Dispatch ${verb} ${issue.key} without its repository: this Dispatch server predates repository fields, so ${lost}; upgrade the server`);
|
|
21302
21339
|
}
|
|
21303
21340
|
function issueSummary(issue, events, references, graph, linkBase, coverage, agents) {
|
|
21304
|
-
const asks = issue.open_asks;
|
|
21341
|
+
const asks = issue.open_asks ?? [];
|
|
21342
|
+
const labels = issue.labels ?? [];
|
|
21343
|
+
const links = issue.external_links ?? [];
|
|
21344
|
+
const members = typeof references === "string" ? [] : references.members ?? [];
|
|
21305
21345
|
const spec = issue.artifacts?.find((artifact) => artifact.primary);
|
|
21306
21346
|
const specApproval = spec === undefined ? undefined : approvalLine(spec);
|
|
21307
21347
|
if (issue.priority === undefined)
|
|
@@ -21323,21 +21363,21 @@ function issueSummary(issue, events, references, graph, linkBase, coverage, agen
|
|
|
21323
21363
|
`Assignee: ${issue.assignee ?? "unassigned"}`,
|
|
21324
21364
|
`Claimed by: ${issue.claim === null ? "nobody" : claimText(issue.claim, agents, issue)}`,
|
|
21325
21365
|
...issue.priority === null ? [] : [`Priority: P${issue.priority}`],
|
|
21326
|
-
`Labels: ${
|
|
21366
|
+
`Labels: ${labels.length === 0 ? "none" : labels.join(", ")}`,
|
|
21327
21367
|
componentsLine(issue.components),
|
|
21328
21368
|
`Route: ${routeText(issue, agents?.titles)}`,
|
|
21329
21369
|
repositoryLine(issue),
|
|
21330
21370
|
`Progress: ${progressText(issue.progress, ", ") || "none"}`,
|
|
21331
21371
|
...specApproval === undefined ? [] : [`Spec ${specApproval.replace(/^Approval/, "approval")}`],
|
|
21332
|
-
...typeof coverage === "string" ? [`Coverage: ${coverage}`] : coverage.gaps.map((gap) => `Coverage: ${gap}`),
|
|
21372
|
+
...typeof coverage === "string" ? [`Coverage: ${coverage}`] : (coverage.gaps ?? []).map((gap) => `Coverage: ${gap}`),
|
|
21333
21373
|
"External links:",
|
|
21334
|
-
...
|
|
21374
|
+
...links.length === 0 ? ["- none"] : links.map((link) => `- ${link.url}${link.kind === undefined ? "" : ` (${link.kind})`}`),
|
|
21335
21375
|
"Documents:",
|
|
21336
21376
|
...documentListLines(issue.artifacts ?? []),
|
|
21337
21377
|
"Open asks:",
|
|
21338
21378
|
...asks.length === 0 ? ["- none"] : asks.map((ask) => `- ${ask.id}: ${ask.question}`),
|
|
21339
21379
|
"References:",
|
|
21340
|
-
...typeof references === "string" ? [`- ${references}`] :
|
|
21380
|
+
...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}`),
|
|
21341
21381
|
...typeof references === "string" || !references.truncated ? [] : ["- more references beyond 8 hops"],
|
|
21342
21382
|
"Events:",
|
|
21343
21383
|
...events.length === 0 ? ["- none"] : events.map(eventLine),
|
|
@@ -21348,9 +21388,10 @@ function issueSummary(issue, events, references, graph, linkBase, coverage, agen
|
|
|
21348
21388
|
function referenceLines(read) {
|
|
21349
21389
|
if (typeof read === "string")
|
|
21350
21390
|
return [`- ${read}`];
|
|
21351
|
-
|
|
21391
|
+
const edges = read.edges ?? [];
|
|
21392
|
+
if (edges.length === 0)
|
|
21352
21393
|
return ["- none"];
|
|
21353
|
-
return
|
|
21394
|
+
return edges.map(edgeLine);
|
|
21354
21395
|
}
|
|
21355
21396
|
function isItemKind(kind) {
|
|
21356
21397
|
return ITEM_KINDS.some((item) => item === kind);
|
|
@@ -21407,7 +21448,7 @@ function graphSectionLines(incoming, outgoing) {
|
|
|
21407
21448
|
function nodeLine(node) {
|
|
21408
21449
|
if (node.made_by === undefined)
|
|
21409
21450
|
return [];
|
|
21410
|
-
const fact = (by, time) => `${by
|
|
21451
|
+
const fact = (by, time) => `${by == null || by.length === 0 ? "nobody recorded" : by.map(actorText).join(", ")}${time == null ? "" : ` at ${time}`}`;
|
|
21411
21452
|
const made = fact(node.made_by, node.made_at);
|
|
21412
21453
|
const changed = fact(node.changed_by, node.changed_at);
|
|
21413
21454
|
const { parent } = node;
|
|
@@ -21455,9 +21496,9 @@ async function typedBlockOf(client, ref) {
|
|
|
21455
21496
|
function askPartNoun(ask, node, blockID) {
|
|
21456
21497
|
if (ask.answer?.id === blockID)
|
|
21457
21498
|
return "Answer";
|
|
21458
|
-
if (ask.options.some((option) => option.id === blockID))
|
|
21499
|
+
if ((ask.options ?? []).some((option) => option.id === blockID))
|
|
21459
21500
|
return "Option";
|
|
21460
|
-
const placed = (ask.revision ?? 0) > 0 && ask.options.every((option) => option.id !== undefined) && (ask.answer === null || ask.answer.id !== undefined);
|
|
21501
|
+
const placed = (ask.revision ?? 0) > 0 && (ask.options ?? []).every((option) => option.id !== undefined) && (ask.answer === null || ask.answer.id !== undefined);
|
|
21461
21502
|
return placed && node.pin?.state !== "removed" ? "Question" : "Part";
|
|
21462
21503
|
}
|
|
21463
21504
|
function logSummary(issue, events) {
|
|
@@ -21530,16 +21571,16 @@ function childrenSummary(issue) {
|
|
|
21530
21571
|
return [
|
|
21531
21572
|
`Key: ${issue.key}`,
|
|
21532
21573
|
"Children:",
|
|
21533
|
-
...issue.children.length === 0 ? ["- none"] : issue.children.map((child) => `- ${child.key}: ${child.title} (${child.status})`)
|
|
21574
|
+
...(issue.children ?? []).length === 0 ? ["- none"] : (issue.children ?? []).map((child) => `- ${child.key}: ${child.title} (${child.status})`)
|
|
21534
21575
|
].join(`
|
|
21535
21576
|
`);
|
|
21536
21577
|
}
|
|
21537
21578
|
function askSummary({ ask, replies, answers }, askRef, pictures, incoming, outgoing) {
|
|
21538
21579
|
const answer = ask.answer;
|
|
21539
|
-
const earlierAnswers = answers.slice(0, -1);
|
|
21580
|
+
const earlierAnswers = (answers ?? []).slice(0, -1);
|
|
21540
21581
|
const parts = askPartEdges(ask, incoming);
|
|
21541
21582
|
const partRef = (id) => `${askRef}#b-${encodeBlockId(id)}`;
|
|
21542
|
-
const chain = replies.flatMap((reply) => [
|
|
21583
|
+
const chain = (replies ?? []).flatMap((reply) => [
|
|
21543
21584
|
`${reply.id} \xB7 ${actorText(reply.author)}`,
|
|
21544
21585
|
`Body: ${reply.body}`
|
|
21545
21586
|
]);
|
|
@@ -21547,7 +21588,7 @@ function askSummary({ ask, replies, answers }, askRef, pictures, incoming, outgo
|
|
|
21547
21588
|
`Question: ${ask.question}`,
|
|
21548
21589
|
...anchorLines(ask),
|
|
21549
21590
|
"Options:",
|
|
21550
|
-
...ask.options.length === 0 ? ["- none"] : ask.options.flatMap((option) => [
|
|
21591
|
+
...(ask.options ?? []).length === 0 ? ["- none"] : (ask.options ?? []).flatMap((option) => [
|
|
21551
21592
|
`- ${option.label}${option.description ? ` \u2014 ${option.description}` : ""}${option.id === undefined ? "" : ` (${partRef(option.id)})`}`,
|
|
21552
21593
|
...partReferenceLines(parts.at, option.id)
|
|
21553
21594
|
]),
|
|
@@ -21556,7 +21597,7 @@ function askSummary({ ask, replies, answers }, askRef, pictures, incoming, outgo
|
|
|
21556
21597
|
"Answer:",
|
|
21557
21598
|
...answer === null ? ["- none"] : [
|
|
21558
21599
|
`- By: ${actorActText(answer.user, answer.act)}`,
|
|
21559
|
-
`- Selected: ${answer.selected.length === 0 ? "none" : answer.selected.join(", ")}`,
|
|
21600
|
+
`- Selected: ${(answer.selected ?? []).length === 0 ? "none" : (answer.selected ?? []).join(", ")}`,
|
|
21560
21601
|
...answer.text === null ? [] : [`- Text: ${answer.text}`],
|
|
21561
21602
|
...answer.id === undefined ? [] : [`- Reference: ${partRef(answer.id)}`],
|
|
21562
21603
|
...partReferenceLines(parts.at, answer.id)
|
|
@@ -21579,12 +21620,12 @@ function askSummary({ ask, replies, answers }, askRef, pictures, incoming, outgo
|
|
|
21579
21620
|
`);
|
|
21580
21621
|
}
|
|
21581
21622
|
function askPartEdges(ask, incoming) {
|
|
21582
|
-
const ids = new Set([...ask.options.map((option) => option.id), ask.answer?.id].filter((id) => id !== undefined));
|
|
21623
|
+
const ids = new Set([...(ask.options ?? []).map((option) => option.id), ask.answer?.id].filter((id) => id !== undefined));
|
|
21583
21624
|
const at = new Map;
|
|
21584
21625
|
if (typeof incoming === "string" || ids.size === 0)
|
|
21585
21626
|
return { at, rest: incoming };
|
|
21586
21627
|
const rest = [];
|
|
21587
|
-
for (const edge of incoming.edges) {
|
|
21628
|
+
for (const edge of incoming.edges ?? []) {
|
|
21588
21629
|
const part = edge.block?.block_id;
|
|
21589
21630
|
if (part === undefined || !ids.has(part)) {
|
|
21590
21631
|
rest.push(edge);
|
|
@@ -21628,8 +21669,8 @@ function formatOpenAsksSummary(response, baseUrl) {
|
|
|
21628
21669
|
return ["There are no unanswered asks for this session.", `Scope: ${scope}.`].join(`
|
|
21629
21670
|
`);
|
|
21630
21671
|
}
|
|
21631
|
-
const waitingOnHuman = response.asks.filter((ask) => ask.waiting_on === "human");
|
|
21632
|
-
const waitingOnAgent = response.asks.filter((ask) => ask.waiting_on === "agent");
|
|
21672
|
+
const waitingOnHuman = (response.asks ?? []).filter((ask) => ask.waiting_on === "human");
|
|
21673
|
+
const waitingOnAgent = (response.asks ?? []).filter((ask) => ask.waiting_on === "agent");
|
|
21633
21674
|
return [
|
|
21634
21675
|
`${response.count} unanswered ${response.count === 1 ? "ask" : "asks"} you authored on active issues and project documents.`,
|
|
21635
21676
|
"",
|
|
@@ -21642,7 +21683,7 @@ function formatOpenAsksSummary(response, baseUrl) {
|
|
|
21642
21683
|
`);
|
|
21643
21684
|
}
|
|
21644
21685
|
function whoamiPerson(identity) {
|
|
21645
|
-
return identity.kind === "
|
|
21686
|
+
return identity.kind === "user" ? identity.login.toLowerCase() : identity.owner;
|
|
21646
21687
|
}
|
|
21647
21688
|
var INBOX_QUESTION_HEAD = 80;
|
|
21648
21689
|
function inboxSnoozed(row, now) {
|
|
@@ -21654,7 +21695,8 @@ function inboxSnoozed(row, now) {
|
|
|
21654
21695
|
function inboxSection(row, now) {
|
|
21655
21696
|
if (inboxSnoozed(row, now))
|
|
21656
21697
|
return "later";
|
|
21657
|
-
|
|
21698
|
+
const waiting = row.waiting_on;
|
|
21699
|
+
return waiting === "agent" || waiting === "human" ? waiting : undefined;
|
|
21658
21700
|
}
|
|
21659
21701
|
function inboxAskOwner(row) {
|
|
21660
21702
|
const key = row.issue?.key ?? row.issue_key;
|
|
@@ -21676,9 +21718,10 @@ function inboxAskLine(row) {
|
|
|
21676
21718
|
return `- ${label} \xB7 ${priority} \xB7 ${row.kind} \xB7 ${textHead(row.question, INBOX_QUESTION_HEAD)} \xB7 ${ref}`;
|
|
21677
21719
|
}
|
|
21678
21720
|
function inboxThreadLabel(row) {
|
|
21679
|
-
|
|
21680
|
-
|
|
21681
|
-
|
|
21721
|
+
const thread = inboxThreadRow(row);
|
|
21722
|
+
if (thread.kind === "agent")
|
|
21723
|
+
return thread.session.name;
|
|
21724
|
+
return thread.issue?.key ?? thread.document?.slug ?? thread.thread_id;
|
|
21682
21725
|
}
|
|
21683
21726
|
function inboxReplyAge(at, now) {
|
|
21684
21727
|
const minutes = Math.floor(Math.max(0, now - Date.parse(at)) / 60000);
|
|
@@ -21705,7 +21748,7 @@ function credentialRequestLine(request) {
|
|
|
21705
21748
|
const session = request.session ?? null;
|
|
21706
21749
|
return [
|
|
21707
21750
|
`- ${request.kind}`,
|
|
21708
|
-
request.identifiers.join(", "),
|
|
21751
|
+
(request.identifiers ?? []).join(", "),
|
|
21709
21752
|
request.requested_at,
|
|
21710
21753
|
...session === null ? [] : [`session request=${session.request ?? "-"}, enrollment=${session.enrollment ?? "-"}`],
|
|
21711
21754
|
...request.approve_url === undefined ? [] : [request.approve_url]
|
|
@@ -21746,7 +21789,7 @@ function commentSummary({ comment, replies }, graph) {
|
|
|
21746
21789
|
...replyBlockLines(comment),
|
|
21747
21790
|
`Body: ${comment.body}`
|
|
21748
21791
|
];
|
|
21749
|
-
const chain = replies.flatMap((reply) => [
|
|
21792
|
+
const chain = (replies ?? []).flatMap((reply) => [
|
|
21750
21793
|
`${reply.id} \xB7 ${actorText(reply.author)}`,
|
|
21751
21794
|
...anchorLines(reply),
|
|
21752
21795
|
...replyBlockLines(reply),
|
|
@@ -21779,10 +21822,10 @@ function anchorLines(record) {
|
|
|
21779
21822
|
}
|
|
21780
21823
|
function positionText(block) {
|
|
21781
21824
|
const { table, path } = block;
|
|
21782
|
-
const segments = path.map((entry) => `${entry.type}[${entry.index}]`);
|
|
21825
|
+
const segments = (path ?? []).map((entry) => `${entry.type}[${entry.index}]`);
|
|
21783
21826
|
if (table === undefined || table.row === null)
|
|
21784
21827
|
return segments.join(" \u203A ");
|
|
21785
|
-
const tableAt = path.findIndex((entry) => entry.type === "table");
|
|
21828
|
+
const tableAt = (path ?? []).findIndex((entry) => entry.type === "table");
|
|
21786
21829
|
const cells = table.cells ?? [];
|
|
21787
21830
|
const label = (table.column === null ? cells : cells.slice(0, table.column)).map((cell) => cell.trim()).filter((cell) => cell !== "" && !/^\d+$/.test(cell)).join(" \xB7 ");
|
|
21788
21831
|
const row = label === "" ? `row ${table.row}` : `row ${table.row} (${label})`;
|
|
@@ -21798,7 +21841,7 @@ function messageSummary({ message, replies }, graph) {
|
|
|
21798
21841
|
...replyBlockLines(message),
|
|
21799
21842
|
`Body: ${message.body}`
|
|
21800
21843
|
];
|
|
21801
|
-
const chain = replies.flatMap((reply) => [
|
|
21844
|
+
const chain = (replies ?? []).flatMap((reply) => [
|
|
21802
21845
|
`${reply.id} \xB7 ${actorText(reply.author)}`,
|
|
21803
21846
|
...replyBlockLines(reply),
|
|
21804
21847
|
`Body: ${reply.body}`
|
|
@@ -21876,7 +21919,8 @@ async function blockAsks(client, resolved, state) {
|
|
|
21876
21919
|
return asks.filter((ask) => typeof ask.block_id === "string" && ask.block_artifact?.id === resolved.artifact.id);
|
|
21877
21920
|
}
|
|
21878
21921
|
async function readUploadedFile(client, artifact, details, requested, owner, shown) {
|
|
21879
|
-
const
|
|
21922
|
+
const versions = artifact.versions ?? [];
|
|
21923
|
+
const latest = Math.max(0, ...versions.map((version) => version.number));
|
|
21880
21924
|
const number = requested ?? latest;
|
|
21881
21925
|
const of = number === latest ? "" : ` of ${latest}`;
|
|
21882
21926
|
const bytesRoute = `GET /api/v1/artifacts/${artifact.id}/versions/${number} serves its bytes.`;
|
|
@@ -21884,7 +21928,7 @@ async function readUploadedFile(client, artifact, details, requested, owner, sho
|
|
|
21884
21928
|
text: `${oversizePictureText(artifact.name, bytes)}, so dispatch doc-read cannot show this ` + `uploaded ${mime} picture (version ${number}${of}). ${bytesRoute}`,
|
|
21885
21929
|
details
|
|
21886
21930
|
});
|
|
21887
|
-
const stated =
|
|
21931
|
+
const stated = versions.find((version) => version.number === number);
|
|
21888
21932
|
if (artifact.kind === "image" && stated?.size !== undefined && stated.size > PICTURE_SHOWN_MAX_BYTES) {
|
|
21889
21933
|
return tooLarge(stated.mime ?? "image", stated.size);
|
|
21890
21934
|
}
|
|
@@ -21951,9 +21995,9 @@ async function listDocumentBlocks(client, artifact) {
|
|
|
21951
21995
|
if (block.table === undefined) {
|
|
21952
21996
|
lines.push(`${indent} This Dispatch does not report table rows yet, so no row or column index is listed.`);
|
|
21953
21997
|
} else {
|
|
21954
|
-
for (const row of block.table.rows) {
|
|
21998
|
+
for (const row of block.table.rows ?? []) {
|
|
21955
21999
|
lines.push(`${indent} row ${row.index}, ${row.id === "" ? "no id yet" : `id ${row.id}`}`);
|
|
21956
|
-
for (const cell of row.cells) {
|
|
22000
|
+
for (const cell of row.cells ?? []) {
|
|
21957
22001
|
const under = cell.header === "" ? "" : `, under ${JSON.stringify(cell.header)}`;
|
|
21958
22002
|
lines.push(`${indent} row ${cell.row} column ${cell.column}, ${cell.id === "" ? "no id yet" : `id ${cell.id}`}${under}: ${cell.text === "" ? "(empty)" : cell.text}`);
|
|
21959
22003
|
}
|
|
@@ -22174,7 +22218,7 @@ async function executeDispatchTool(input) {
|
|
|
22174
22218
|
throw error;
|
|
22175
22219
|
}
|
|
22176
22220
|
return {
|
|
22177
|
-
text: renderSessionAnswersList(response.items, { now: Date.now() }),
|
|
22221
|
+
text: renderSessionAnswersList(response.items ?? [], { now: Date.now() }),
|
|
22178
22222
|
details: { session: sessionId, since: response.since, total: response.total }
|
|
22179
22223
|
};
|
|
22180
22224
|
}
|
|
@@ -22185,9 +22229,10 @@ async function executeDispatchTool(input) {
|
|
|
22185
22229
|
const client = dispatchClient();
|
|
22186
22230
|
const identity = await client.whoami();
|
|
22187
22231
|
const owner = whoamiPerson(identity);
|
|
22188
|
-
const
|
|
22189
|
-
const
|
|
22190
|
-
const
|
|
22232
|
+
const agent = identity.kind === "agent" ? identity : undefined;
|
|
22233
|
+
const service = agent?.service ?? null;
|
|
22234
|
+
const proved = agent?.session ?? null;
|
|
22235
|
+
const project = agent?.project ?? null;
|
|
22191
22236
|
const session = proved ?? sessionId;
|
|
22192
22237
|
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.";
|
|
22193
22238
|
const signInNeeded = owner === null && service !== null && proved !== null;
|
|
@@ -22397,9 +22442,10 @@ async function executeDispatchTool(input) {
|
|
|
22397
22442
|
throw withAccount(error, told);
|
|
22398
22443
|
}
|
|
22399
22444
|
}
|
|
22400
|
-
const
|
|
22445
|
+
const existingLinks = before.external_links ?? [];
|
|
22446
|
+
const linked = existingLinks.map((link) => link.url);
|
|
22401
22447
|
const newLinks = requestedLinks?.filter((url) => !linked.includes(url)) ?? [];
|
|
22402
|
-
const sentLinks = requestedLinks === undefined ? undefined : requestedLinks.length === 0 ? [] : [...
|
|
22448
|
+
const sentLinks = requestedLinks === undefined ? undefined : requestedLinks.length === 0 ? [] : [...existingLinks, ...newLinks.map((url) => ({ url }))];
|
|
22403
22449
|
const rank = rankBefore === undefined && rankAfter === undefined ? undefined : {
|
|
22404
22450
|
...rankBefore === undefined ? {} : { before: rankBefore },
|
|
22405
22451
|
...rankAfter === undefined ? {} : { after: rankAfter }
|
|
@@ -22434,12 +22480,15 @@ async function executeDispatchTool(input) {
|
|
|
22434
22480
|
throw withAccount(error, landed);
|
|
22435
22481
|
}
|
|
22436
22482
|
refuseUnsavedRepository("updated", after, repo);
|
|
22437
|
-
const
|
|
22483
|
+
const links = after.external_links ?? [];
|
|
22484
|
+
const linkCount = `(${links.length} ${links.length === 1 ? "link" : "links"})`;
|
|
22438
22485
|
const changes = [
|
|
22439
22486
|
...closingNote === undefined ? [] : [`reason posted as message ${closingNote.id} (${closingNote.ref})`],
|
|
22440
22487
|
...status === undefined ? [] : [`status ${before.status} -> ${after.status}`],
|
|
22441
22488
|
...title === undefined ? [] : [`title "${after.title}"`],
|
|
22442
|
-
...labels === undefined ? [] : [
|
|
22489
|
+
...labels === undefined ? [] : [
|
|
22490
|
+
(after.labels ?? []).length === 0 ? "labels cleared" : `labels ${(after.labels ?? []).join(", ")}`
|
|
22491
|
+
],
|
|
22443
22492
|
...priority === undefined ? [] : [after.priority === null ? "priority cleared" : `priority -> P${after.priority}`],
|
|
22444
22493
|
...rank === undefined ? [] : [
|
|
22445
22494
|
`rank -> ${[
|
|
@@ -22453,7 +22502,7 @@ async function executeDispatchTool(input) {
|
|
|
22453
22502
|
...route === undefined ? [] : [after.route === null ? "route cleared" : `route ${after.route}`],
|
|
22454
22503
|
...parent === undefined ? [] : [after.parent === null ? "parent cleared" : `parent -> ${after.parent}`],
|
|
22455
22504
|
...blockedBy === undefined ? [] : [
|
|
22456
|
-
after.blocked_by.length === 0 ? "blocked_by cleared" : `blocked by ${after.blocked_by.join(", ")}`
|
|
22505
|
+
(after.blocked_by ?? []).length === 0 ? "blocked_by cleared" : `blocked by ${(after.blocked_by ?? []).join(", ")}`
|
|
22457
22506
|
],
|
|
22458
22507
|
...components === undefined ? [] : [componentsChange(components, after.components)],
|
|
22459
22508
|
...repo === undefined ? [] : [
|
|
@@ -22472,7 +22521,7 @@ async function executeDispatchTool(input) {
|
|
|
22472
22521
|
details: {
|
|
22473
22522
|
issue: after.key,
|
|
22474
22523
|
status: after.status,
|
|
22475
|
-
external_links: after.external_links.map((link) => link.url),
|
|
22524
|
+
external_links: (after.external_links ?? []).map((link) => link.url),
|
|
22476
22525
|
...closingNote === undefined ? {} : { message: closingNote.id },
|
|
22477
22526
|
...after.advice === undefined ? {} : { advice: after.advice }
|
|
22478
22527
|
}
|
|
@@ -22568,7 +22617,7 @@ async function executeDispatchTool(input) {
|
|
|
22568
22617
|
offset: optionalNumber(args, "offset") ?? 0
|
|
22569
22618
|
});
|
|
22570
22619
|
const { total, limit, offset } = page;
|
|
22571
|
-
const rows = page.issues.map((row) => ({
|
|
22620
|
+
const rows = (page.issues ?? []).map((row) => ({
|
|
22572
22621
|
key: row.key,
|
|
22573
22622
|
title: row.title,
|
|
22574
22623
|
status: row.status,
|
|
@@ -23087,7 +23136,7 @@ ${recorded.line}`,
|
|
|
23087
23136
|
const results = await client.issueResults(issue);
|
|
23088
23137
|
return {
|
|
23089
23138
|
text: formatCheckResults(results),
|
|
23090
|
-
details: { issue, checks: results.checks.length }
|
|
23139
|
+
details: { issue, checks: (results.checks ?? []).length }
|
|
23091
23140
|
};
|
|
23092
23141
|
}
|
|
23093
23142
|
case "dispatch_artifact": {
|
|
@@ -23219,7 +23268,7 @@ ${handoff.body}`,
|
|
|
23219
23268
|
const thread = await client.getMessageThread(messageIdOf(message), sessionId);
|
|
23220
23269
|
const issueKey = thread.message.issue_key;
|
|
23221
23270
|
const [pictures, graph] = await Promise.all([
|
|
23222
|
-
picturesOf(datedBodies([thread.message, ...thread.replies])),
|
|
23271
|
+
picturesOf(datedBodies([thread.message, ...thread.replies ?? []])),
|
|
23223
23272
|
issueKey === null ? [] : graphSections(client, dispatchChildRef(dispatchIssueRef(issueKey), "message", thread.message.id))
|
|
23224
23273
|
]);
|
|
23225
23274
|
return {
|
|
@@ -23259,7 +23308,7 @@ ${handoff.body}`,
|
|
|
23259
23308
|
await refuseItemOffRef(input.tool, "comment", ref, stringArg(args, "ref"), comment.comment, () => documentIdOf(ref));
|
|
23260
23309
|
const commentRef = refTarget(ref, "comment", id);
|
|
23261
23310
|
const [pictures, graph] = await Promise.all([
|
|
23262
|
-
picturesOf(datedBodies([comment.comment, ...comment.replies])),
|
|
23311
|
+
picturesOf(datedBodies([comment.comment, ...comment.replies ?? []])),
|
|
23263
23312
|
graphSections(client, commentRef)
|
|
23264
23313
|
]);
|
|
23265
23314
|
return {
|
|
@@ -23275,7 +23324,7 @@ ${handoff.body}`,
|
|
|
23275
23324
|
const messageRead = await client.getMessage(ownerArguments.ref.owner.issue, ownerArguments.ref.id);
|
|
23276
23325
|
const messageRef = dispatchChildRef(dispatchIssueRef(ownerArguments.ref.owner.issue), "message", ownerArguments.ref.id);
|
|
23277
23326
|
const [pictures, graph] = await Promise.all([
|
|
23278
|
-
picturesOf(datedBodies([messageRead.message, ...messageRead.replies])),
|
|
23327
|
+
picturesOf(datedBodies([messageRead.message, ...messageRead.replies ?? []])),
|
|
23279
23328
|
graphSections(client, messageRef)
|
|
23280
23329
|
]);
|
|
23281
23330
|
return {
|
|
@@ -23343,7 +23392,7 @@ ${handoff.body}`,
|
|
|
23343
23392
|
`Issue: ${resolved.issue.key} [${resolved.issue.status}] ${resolved.issue.title}`
|
|
23344
23393
|
],
|
|
23345
23394
|
`Reference: ${documentRef}`,
|
|
23346
|
-
`Versions: ${artifact.versions.length}`,
|
|
23395
|
+
`Versions: ${(artifact.versions ?? []).length}`,
|
|
23347
23396
|
...approval === undefined ? [] : [approval],
|
|
23348
23397
|
...await graphSections(client, documentRef)
|
|
23349
23398
|
].join(`
|
|
@@ -23383,7 +23432,10 @@ ${handoff.body}`,
|
|
|
23383
23432
|
graphSections(client, dispatchIssueRef(read.issue.key)),
|
|
23384
23433
|
liveAgents(client, holdsSession(read.issue.claim) || routeHeldBySession(read.issue)),
|
|
23385
23434
|
picturesOf([
|
|
23386
|
-
...read.issue.open_asks.map((ask) => ({
|
|
23435
|
+
...(read.issue.open_asks ?? []).map((ask) => ({
|
|
23436
|
+
text: ask.question,
|
|
23437
|
+
at: ask.created_at
|
|
23438
|
+
})),
|
|
23387
23439
|
...await eventTextsWhole(client, read.events)
|
|
23388
23440
|
]),
|
|
23389
23441
|
issueCoverageOrReason(client, read.issue.key)
|