@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/envoy-channel.js
CHANGED
|
@@ -36260,6 +36260,9 @@ var PROJECT_NAME_MAX = 80;
|
|
|
36260
36260
|
var MAX_ISSUE_PAGE_LIMIT = 250;
|
|
36261
36261
|
var DEFAULT_ISSUE_PAGE_LIMIT = 50;
|
|
36262
36262
|
var ASK_TURNS = ["human", "agent"];
|
|
36263
|
+
function inboxThreadRow(row) {
|
|
36264
|
+
return row.kind === "agent" ? row : row;
|
|
36265
|
+
}
|
|
36263
36266
|
var DELIVERY_CAPABILITIES = ["aside", "btw", "steer"];
|
|
36264
36267
|
var IDEMPOTENCY_KEY_HEADER = "Idempotency-Key";
|
|
36265
36268
|
var IDEMPOTENCY_REPLAYED_HEADER = "Idempotency-Replayed";
|
|
@@ -36610,12 +36613,15 @@ var HOLDING_OF = {
|
|
|
36610
36613
|
unknown: "unknown",
|
|
36611
36614
|
unresponsive: "unresponsive"
|
|
36612
36615
|
};
|
|
36616
|
+
function isHolderState(state) {
|
|
36617
|
+
return Object.hasOwn(HOLDING_OF, state);
|
|
36618
|
+
}
|
|
36613
36619
|
function claimHolds(claim, titles, liveness = {}) {
|
|
36614
36620
|
if (claim.actor.kind !== "session") {
|
|
36615
36621
|
return "holds";
|
|
36616
36622
|
}
|
|
36617
36623
|
const state = liveness.holder_state;
|
|
36618
|
-
if (state != null) {
|
|
36624
|
+
if (state != null && isHolderState(state)) {
|
|
36619
36625
|
return HOLDING_OF[state];
|
|
36620
36626
|
}
|
|
36621
36627
|
if (titles === undefined) {
|
|
@@ -38585,8 +38591,9 @@ function relatedCheckFormOf(suggestions) {
|
|
|
38585
38591
|
return { form: "not_made", reason: missing ?? "the server gave no reason", searchQuery };
|
|
38586
38592
|
}
|
|
38587
38593
|
const mode = relatedCheckModeWords(suggestions);
|
|
38588
|
-
|
|
38589
|
-
|
|
38594
|
+
const related = suggestions.related ?? [];
|
|
38595
|
+
if (related.length > 0) {
|
|
38596
|
+
return { form: "items", mode, related };
|
|
38590
38597
|
}
|
|
38591
38598
|
if (outcome === undefined) {
|
|
38592
38599
|
return {
|
|
@@ -43114,7 +43121,12 @@ function documentLabel(project, slug) {
|
|
|
43114
43121
|
return `${project}/${slug}`;
|
|
43115
43122
|
}
|
|
43116
43123
|
function ownerTitle(owner) {
|
|
43117
|
-
|
|
43124
|
+
const { issue, document } = owner;
|
|
43125
|
+
if (issue !== undefined)
|
|
43126
|
+
return `${issue.key}: ${issue.title}`;
|
|
43127
|
+
if (document !== undefined)
|
|
43128
|
+
return `${document.project} / ${document.name}`;
|
|
43129
|
+
return "";
|
|
43118
43130
|
}
|
|
43119
43131
|
function issueTopic(key) {
|
|
43120
43132
|
return { label: key, topic: dispatchIssueSubject(key, ">") };
|
|
@@ -43599,10 +43611,10 @@ async function wholeCarriedBody(client, item, session) {
|
|
|
43599
43611
|
try {
|
|
43600
43612
|
if (item.resource === "comment") {
|
|
43601
43613
|
const read = await client.getComment(item.id);
|
|
43602
|
-
return [read.comment, ...read.replies].find((comment) => comment.id === item.id)?.body;
|
|
43614
|
+
return [read.comment, ...read.replies ?? []].find((comment) => comment.id === item.id)?.body;
|
|
43603
43615
|
}
|
|
43604
43616
|
const read = item.issueKey === null ? session === undefined ? undefined : await client.getMessageThread(item.id, session) : await client.getMessage(item.issueKey, item.id);
|
|
43605
|
-
return read === undefined ? undefined : [read.message, ...read.replies].find((message) => message.id === item.id)?.body;
|
|
43617
|
+
return read === undefined ? undefined : [read.message, ...read.replies ?? []].find((message) => message.id === item.id)?.body;
|
|
43606
43618
|
} catch {
|
|
43607
43619
|
return;
|
|
43608
43620
|
}
|
|
@@ -47251,7 +47263,7 @@ function askTexts({ ask, replies }) {
|
|
|
47251
47263
|
{ text: ask.question, at: ask.created_at },
|
|
47252
47264
|
...ask.answer?.text ? [{ text: ask.answer.text, at: ask.answer.at }] : [],
|
|
47253
47265
|
...ask.resolution === undefined ? [] : [{ text: ask.resolution.reason, at: ask.resolution.at }],
|
|
47254
|
-
...datedBodies(replies)
|
|
47266
|
+
...datedBodies(replies ?? [])
|
|
47255
47267
|
];
|
|
47256
47268
|
}
|
|
47257
47269
|
function eventTexts(event) {
|
|
@@ -47374,7 +47386,7 @@ async function readPictures(client, addresses, shown) {
|
|
|
47374
47386
|
artifacts.set(target.key, read);
|
|
47375
47387
|
}
|
|
47376
47388
|
const artifact = await read;
|
|
47377
|
-
const version = artifact.versions.find((candidate) => candidate.number === target.version);
|
|
47389
|
+
const version = (artifact.versions ?? []).find((candidate) => candidate.number === target.version);
|
|
47378
47390
|
if (version === undefined) {
|
|
47379
47391
|
skip(`${artifact.name} has no version ${target.version}`);
|
|
47380
47392
|
continue;
|
|
@@ -47425,7 +47437,7 @@ function searchHitLine(result, baseUrl) {
|
|
|
47425
47437
|
const href = new URL(result.href, baseUrl).toString();
|
|
47426
47438
|
const { owner } = result;
|
|
47427
47439
|
if (owner.kind === "document") {
|
|
47428
|
-
const reference = dispatchDocumentRef(owner.project, owner.slug);
|
|
47440
|
+
const reference = dispatchDocumentRef(owner.project ?? "", owner.slug ?? "");
|
|
47429
47441
|
return `${reference} [document] ${owner.name} - ${result.kind}: ${snippetText(result.snippet)} -> ${href}`;
|
|
47430
47442
|
}
|
|
47431
47443
|
const artifactName = result.artifact ? ` ${result.artifact.name}` : "";
|
|
@@ -47437,7 +47449,8 @@ function indentedText(text) {
|
|
|
47437
47449
|
`);
|
|
47438
47450
|
}
|
|
47439
47451
|
function answerLines(lead, answer) {
|
|
47440
|
-
const
|
|
47452
|
+
const chosen = answer.selected ?? [];
|
|
47453
|
+
const selected = chosen.length === 0 ? "none" : chosen.join(", ");
|
|
47441
47454
|
const text = answer.text === null || answer.text === "" ? "none" : indentedText(answer.text);
|
|
47442
47455
|
return [
|
|
47443
47456
|
` ${lead} by ${actorActText(answer.user, answer.act)} at ${answer.at} \xB7 options chosen: ${selected}`,
|
|
@@ -47451,16 +47464,21 @@ function askStateLines(ask) {
|
|
|
47451
47464
|
if (ask === undefined) {
|
|
47452
47465
|
return [" Answer state not reported by this Dispatch; open the link to read the ask."];
|
|
47453
47466
|
}
|
|
47467
|
+
const resolution = ask.resolution;
|
|
47468
|
+
const closed = resolution === undefined ? "closed, and this Dispatch did not say by whom" : resolutionText(resolution);
|
|
47454
47469
|
switch (ask.state) {
|
|
47455
47470
|
case "open":
|
|
47456
47471
|
return [" Open: no answer yet."];
|
|
47457
47472
|
case "answered":
|
|
47458
|
-
return answerLines("Answered", ask.answer);
|
|
47473
|
+
return ask.answer === undefined ? [" Answered; this Dispatch did not carry the answer. Open the link to read it."] : answerLines("Answered", ask.answer);
|
|
47459
47474
|
case "resolved":
|
|
47460
|
-
return ask.answer === undefined ? [` Closed with no answer: ${
|
|
47461
|
-
|
|
47462
|
-
|
|
47475
|
+
return ask.answer === undefined ? [` Closed with no answer: ${closed}`] : [` Closed after an answer: ${closed}`, ...answerLines("Last answer", ask.answer)];
|
|
47476
|
+
default: {
|
|
47477
|
+
const unreportedState = ask.state;
|
|
47478
|
+
return [
|
|
47479
|
+
` Answer state "${String(unreportedState)}" is newer than this client; open the link to read the ask.`
|
|
47463
47480
|
];
|
|
47481
|
+
}
|
|
47464
47482
|
}
|
|
47465
47483
|
}
|
|
47466
47484
|
function searchResultLine(result, baseUrl) {
|
|
@@ -47469,7 +47487,7 @@ function searchResultLine(result, baseUrl) {
|
|
|
47469
47487
|
`) : line;
|
|
47470
47488
|
}
|
|
47471
47489
|
function searchAnswer(search, query, offset, configUrl) {
|
|
47472
|
-
const results = search.results;
|
|
47490
|
+
const results = search.results ?? [];
|
|
47473
47491
|
const count = results.length;
|
|
47474
47492
|
const lines = results.map((result) => searchResultLine(result, configUrl));
|
|
47475
47493
|
const noun = count === 1 ? "result" : "results";
|
|
@@ -47662,11 +47680,15 @@ var RELATION_PHRASES = {
|
|
|
47662
47680
|
sent_you_a_message: "sent you a message",
|
|
47663
47681
|
replied_to_your_message: "replied to your message"
|
|
47664
47682
|
};
|
|
47683
|
+
function isSessionAnswerRelation(value) {
|
|
47684
|
+
return Object.hasOwn(RELATION_PHRASES, value);
|
|
47685
|
+
}
|
|
47665
47686
|
function isNoAnswersRoute(error) {
|
|
47666
47687
|
return isNoRoute(error);
|
|
47667
47688
|
}
|
|
47668
47689
|
function renderSessionAnswerItem(item) {
|
|
47669
|
-
const
|
|
47690
|
+
const phrase = isSessionAnswerRelation(item.relation) ? RELATION_PHRASES[item.relation] : item.relation;
|
|
47691
|
+
const relation = `${phrase}${item.replaced === true ? " (replaces an earlier answer)" : ""}`;
|
|
47670
47692
|
const head = [item.at, actorActText(`user ${item.author.id}`, item.author.act), relation];
|
|
47671
47693
|
if (item.edited_at !== undefined)
|
|
47672
47694
|
head.push(`edited ${item.edited_at}`);
|
|
@@ -48095,20 +48117,21 @@ function adviceMemory() {
|
|
|
48095
48117
|
function renderAdvice(tool, key, advice, opts) {
|
|
48096
48118
|
if (advice === undefined)
|
|
48097
48119
|
return [];
|
|
48098
|
-
const
|
|
48099
|
-
const
|
|
48100
|
-
const
|
|
48120
|
+
const issueAdvice = "issue_status" in advice ? advice : undefined;
|
|
48121
|
+
const hasIssueAdvice = issueAdvice !== undefined;
|
|
48122
|
+
const openAsks = issueAdvice?.your_open_asks ?? undefined;
|
|
48123
|
+
const writesSinceHuman = issueAdvice?.session_writes_since_human;
|
|
48101
48124
|
const lines = [];
|
|
48102
48125
|
const unparsed = advice.unparsed_openers;
|
|
48103
48126
|
if (unparsed !== undefined && unparsed.count > 0 && (tool === "dispatch_issue" || tool === "dispatch_artifact")) {
|
|
48104
|
-
const quoted = unparsed.examples.map((example) => JSON.stringify(example)).join(", ");
|
|
48127
|
+
const quoted = (unparsed.examples ?? []).map((example) => JSON.stringify(example)).join(", ");
|
|
48105
48128
|
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`;
|
|
48106
48129
|
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".`);
|
|
48107
48130
|
}
|
|
48108
48131
|
if (advice.decision_blocks === 0 && opts.isPrimarySpec === true && (tool === "dispatch_issue" || tool === "dispatch_artifact")) {
|
|
48109
48132
|
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`.");
|
|
48110
48133
|
}
|
|
48111
|
-
if (
|
|
48134
|
+
if (issueAdvice?.issue_status === "triage" && issueAdvice.legion_managed_status !== true && tool !== "dispatch_issue" && !(tool === "dispatch_issue_update" && opts.setsStatus === true) && !triageAdviceShown.has(key)) {
|
|
48112
48135
|
triageAdviceShown.add(key);
|
|
48113
48136
|
lines.push(`${key} is still in triage \u2014 nobody can see its development status. See the \`dispatch\` skill, "Issue status is yours to move".`);
|
|
48114
48137
|
}
|
|
@@ -48259,17 +48282,19 @@ function optionalComponents(args, name) {
|
|
|
48259
48282
|
function componentsChange(input, after) {
|
|
48260
48283
|
switch (input.mode) {
|
|
48261
48284
|
case "explicit":
|
|
48262
|
-
return `components -> explicit [${after.ids.join(", ")}]`;
|
|
48285
|
+
return `components -> explicit [${(after.ids ?? []).join(", ")}]`;
|
|
48263
48286
|
case "none":
|
|
48264
48287
|
return `components -> none (${after.reason ?? input.reason ?? ""})`;
|
|
48265
48288
|
case "inherit":
|
|
48266
48289
|
return "components -> inherit";
|
|
48290
|
+
default:
|
|
48291
|
+
return `components -> ${input.mode}`;
|
|
48267
48292
|
}
|
|
48268
48293
|
}
|
|
48269
48294
|
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.';
|
|
48270
48295
|
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.";
|
|
48271
48296
|
async function architectureGuidance(client, project, components) {
|
|
48272
|
-
if (components.mode === "none" || components.ids.length > 0)
|
|
48297
|
+
if (components.mode === "none" || (components.ids ?? []).length > 0)
|
|
48273
48298
|
return;
|
|
48274
48299
|
try {
|
|
48275
48300
|
if ((await client.listArchitectureSources(project)).length === 0)
|
|
@@ -48460,7 +48485,7 @@ async function sessionOpenAsks(client, sessionId) {
|
|
|
48460
48485
|
const session = sessionId?.trim();
|
|
48461
48486
|
if (!session)
|
|
48462
48487
|
throw new Error("host session id is required to read this session's open asks");
|
|
48463
|
-
return (await client.openAsks(session)).asks;
|
|
48488
|
+
return (await client.openAsks(session)).asks ?? [];
|
|
48464
48489
|
}
|
|
48465
48490
|
function openAskHints(asks) {
|
|
48466
48491
|
if (asks.length === 0)
|
|
@@ -48933,14 +48958,15 @@ async function resolveArtifact(client, owner, artifactReference, { canonical = f
|
|
|
48933
48958
|
};
|
|
48934
48959
|
}
|
|
48935
48960
|
const issue = await client.getIssue(owner.issue);
|
|
48961
|
+
const issueArtifacts = issue.artifacts ?? [];
|
|
48936
48962
|
let artifact;
|
|
48937
48963
|
if (artifactReference === undefined || artifactReference === "spec") {
|
|
48938
|
-
artifact =
|
|
48964
|
+
artifact = issueArtifacts.find((candidate) => candidate.primary || candidate.id === issue.primary_artifact_id);
|
|
48939
48965
|
} else {
|
|
48940
|
-
artifact = artifactByReference(
|
|
48966
|
+
artifact = artifactByReference(issueArtifacts, artifactReference, { kind: "issue", issue: issue.key }, canonical);
|
|
48941
48967
|
}
|
|
48942
48968
|
if (!artifact) {
|
|
48943
|
-
throw new DocumentNotFoundError(documentReferenceProblem(artifactReference ?? "spec",
|
|
48969
|
+
throw new DocumentNotFoundError(documentReferenceProblem(artifactReference ?? "spec", issueArtifacts, {
|
|
48944
48970
|
kind: "issue",
|
|
48945
48971
|
issue: issue.key
|
|
48946
48972
|
}));
|
|
@@ -49046,7 +49072,7 @@ async function movedApprovalLine(client, askID) {
|
|
|
49046
49072
|
async function invalidReplyToAskProblem(client, owner, resolved) {
|
|
49047
49073
|
if (owner.kind === "issue") {
|
|
49048
49074
|
const issue = resolved?.issue ?? await client.getIssue(owner.issue);
|
|
49049
|
-
return askIDInputProblem(issue.open_asks, "this issue's");
|
|
49075
|
+
return askIDInputProblem(issue.open_asks ?? [], "this issue's");
|
|
49050
49076
|
}
|
|
49051
49077
|
if (resolved === undefined)
|
|
49052
49078
|
throw new Error("project document is missing its resolved artifact");
|
|
@@ -49086,18 +49112,24 @@ function approvalLine(artifact) {
|
|
|
49086
49112
|
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}`;
|
|
49087
49113
|
case "changes_requested":
|
|
49088
49114
|
return `Approval: changes requested on v${approval.version} by ${approval.by?.id ?? "unknown"}: ${approval.reason ?? ""}${content}`;
|
|
49115
|
+
default:
|
|
49116
|
+
return `Approval: ${approval.state} on v${approval.version}${content}`;
|
|
49089
49117
|
}
|
|
49090
49118
|
}
|
|
49091
49119
|
function componentsLine(components) {
|
|
49120
|
+
const ids = components.ids ?? [];
|
|
49121
|
+
const unknown = components.unknown ?? [];
|
|
49092
49122
|
const inherited = components.inherited_from === null ? "" : ` (inherited from ${components.inherited_from})`;
|
|
49093
|
-
const retired =
|
|
49123
|
+
const retired = unknown.length === 0 ? "" : ` (retired: ${unknown.join(", ")})`;
|
|
49094
49124
|
switch (components.mode) {
|
|
49095
49125
|
case "explicit":
|
|
49096
|
-
return `Components: ${
|
|
49126
|
+
return `Components: ${ids.length === 0 ? "none live" : ids.join(", ")}${inherited}${retired}`;
|
|
49097
49127
|
case "none":
|
|
49098
49128
|
return `Components: none \u2014 ${components.reason ?? ""}${inherited}`;
|
|
49099
49129
|
case "inherit":
|
|
49100
49130
|
return "Components: unassigned";
|
|
49131
|
+
default:
|
|
49132
|
+
return `Components: ${components.mode}${inherited}${retired}`;
|
|
49101
49133
|
}
|
|
49102
49134
|
}
|
|
49103
49135
|
function claimText(claim, agents, read = {}) {
|
|
@@ -49147,6 +49179,9 @@ function agentLiveness(agent) {
|
|
|
49147
49179
|
function holdsSession(claim) {
|
|
49148
49180
|
return claim?.actor.kind === "session";
|
|
49149
49181
|
}
|
|
49182
|
+
function isRouteStatus(value) {
|
|
49183
|
+
return ISSUE_ROUTE_STATUSES.some((status) => status === value);
|
|
49184
|
+
}
|
|
49150
49185
|
function routeHeldBySession(issue) {
|
|
49151
49186
|
return issue.route_status === "live" && issue.route?.startsWith("role:") === true;
|
|
49152
49187
|
}
|
|
@@ -49160,7 +49195,8 @@ function routeText(issue, titles) {
|
|
|
49160
49195
|
no_holder: issue.route.startsWith("role:") ? " (nobody holds it right now)" : " (that session is not running right now)",
|
|
49161
49196
|
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)"
|
|
49162
49197
|
};
|
|
49163
|
-
|
|
49198
|
+
const status = issue.route_status;
|
|
49199
|
+
return issue.route + (status != null && isRouteStatus(status) ? reach[status] : "");
|
|
49164
49200
|
}
|
|
49165
49201
|
function progressText(progress, sep) {
|
|
49166
49202
|
if (progress === undefined)
|
|
@@ -49177,12 +49213,13 @@ function formatCheckResults(results) {
|
|
|
49177
49213
|
if (results.verification_artifact_id === "") {
|
|
49178
49214
|
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.`;
|
|
49179
49215
|
}
|
|
49180
|
-
|
|
49216
|
+
const checks = results.checks ?? [];
|
|
49217
|
+
if (checks.length === 0) {
|
|
49181
49218
|
return `${results.issue}'s Verification document holds no check blocks.`;
|
|
49182
49219
|
}
|
|
49183
|
-
const lines =
|
|
49220
|
+
const lines = checks.map((check) => {
|
|
49184
49221
|
const head = `- ${check.block_id} (${check.when}): `;
|
|
49185
|
-
const latest = check.results[0];
|
|
49222
|
+
const latest = (check.results ?? [])[0];
|
|
49186
49223
|
if (latest === undefined) {
|
|
49187
49224
|
return `${head}no result yet. ${check.text}`;
|
|
49188
49225
|
}
|
|
@@ -49217,7 +49254,10 @@ function refuseUnsavedRepository(verb, issue, repo) {
|
|
|
49217
49254
|
throw new Error(`Dispatch ${verb} ${issue.key} without its repository: this Dispatch server predates repository fields, so ${lost}; upgrade the server`);
|
|
49218
49255
|
}
|
|
49219
49256
|
function issueSummary(issue, events, references, graph, linkBase, coverage, agents) {
|
|
49220
|
-
const asks = issue.open_asks;
|
|
49257
|
+
const asks = issue.open_asks ?? [];
|
|
49258
|
+
const labels = issue.labels ?? [];
|
|
49259
|
+
const links = issue.external_links ?? [];
|
|
49260
|
+
const members = typeof references === "string" ? [] : references.members ?? [];
|
|
49221
49261
|
const spec = issue.artifacts?.find((artifact) => artifact.primary);
|
|
49222
49262
|
const specApproval = spec === undefined ? undefined : approvalLine(spec);
|
|
49223
49263
|
if (issue.priority === undefined)
|
|
@@ -49239,21 +49279,21 @@ function issueSummary(issue, events, references, graph, linkBase, coverage, agen
|
|
|
49239
49279
|
`Assignee: ${issue.assignee ?? "unassigned"}`,
|
|
49240
49280
|
`Claimed by: ${issue.claim === null ? "nobody" : claimText(issue.claim, agents, issue)}`,
|
|
49241
49281
|
...issue.priority === null ? [] : [`Priority: P${issue.priority}`],
|
|
49242
|
-
`Labels: ${
|
|
49282
|
+
`Labels: ${labels.length === 0 ? "none" : labels.join(", ")}`,
|
|
49243
49283
|
componentsLine(issue.components),
|
|
49244
49284
|
`Route: ${routeText(issue, agents?.titles)}`,
|
|
49245
49285
|
repositoryLine(issue),
|
|
49246
49286
|
`Progress: ${progressText(issue.progress, ", ") || "none"}`,
|
|
49247
49287
|
...specApproval === undefined ? [] : [`Spec ${specApproval.replace(/^Approval/, "approval")}`],
|
|
49248
|
-
...typeof coverage === "string" ? [`Coverage: ${coverage}`] : coverage.gaps.map((gap) => `Coverage: ${gap}`),
|
|
49288
|
+
...typeof coverage === "string" ? [`Coverage: ${coverage}`] : (coverage.gaps ?? []).map((gap) => `Coverage: ${gap}`),
|
|
49249
49289
|
"External links:",
|
|
49250
|
-
...
|
|
49290
|
+
...links.length === 0 ? ["- none"] : links.map((link) => `- ${link.url}${link.kind === undefined ? "" : ` (${link.kind})`}`),
|
|
49251
49291
|
"Documents:",
|
|
49252
49292
|
...documentListLines(issue.artifacts ?? []),
|
|
49253
49293
|
"Open asks:",
|
|
49254
49294
|
...asks.length === 0 ? ["- none"] : asks.map((ask) => `- ${ask.id}: ${ask.question}`),
|
|
49255
49295
|
"References:",
|
|
49256
|
-
...typeof references === "string" ? [`- ${references}`] :
|
|
49296
|
+
...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}`),
|
|
49257
49297
|
...typeof references === "string" || !references.truncated ? [] : ["- more references beyond 8 hops"],
|
|
49258
49298
|
"Events:",
|
|
49259
49299
|
...events.length === 0 ? ["- none"] : events.map(eventLine),
|
|
@@ -49264,9 +49304,10 @@ function issueSummary(issue, events, references, graph, linkBase, coverage, agen
|
|
|
49264
49304
|
function referenceLines(read) {
|
|
49265
49305
|
if (typeof read === "string")
|
|
49266
49306
|
return [`- ${read}`];
|
|
49267
|
-
|
|
49307
|
+
const edges = read.edges ?? [];
|
|
49308
|
+
if (edges.length === 0)
|
|
49268
49309
|
return ["- none"];
|
|
49269
|
-
return
|
|
49310
|
+
return edges.map(edgeLine);
|
|
49270
49311
|
}
|
|
49271
49312
|
function isItemKind(kind) {
|
|
49272
49313
|
return ITEM_KINDS.some((item) => item === kind);
|
|
@@ -49323,7 +49364,7 @@ function graphSectionLines(incoming, outgoing) {
|
|
|
49323
49364
|
function nodeLine(node) {
|
|
49324
49365
|
if (node.made_by === undefined)
|
|
49325
49366
|
return [];
|
|
49326
|
-
const fact = (by, time) => `${by
|
|
49367
|
+
const fact = (by, time) => `${by == null || by.length === 0 ? "nobody recorded" : by.map(actorText).join(", ")}${time == null ? "" : ` at ${time}`}`;
|
|
49327
49368
|
const made = fact(node.made_by, node.made_at);
|
|
49328
49369
|
const changed = fact(node.changed_by, node.changed_at);
|
|
49329
49370
|
const { parent } = node;
|
|
@@ -49371,9 +49412,9 @@ async function typedBlockOf(client, ref) {
|
|
|
49371
49412
|
function askPartNoun(ask, node, blockID) {
|
|
49372
49413
|
if (ask.answer?.id === blockID)
|
|
49373
49414
|
return "Answer";
|
|
49374
|
-
if (ask.options.some((option) => option.id === blockID))
|
|
49415
|
+
if ((ask.options ?? []).some((option) => option.id === blockID))
|
|
49375
49416
|
return "Option";
|
|
49376
|
-
const placed = (ask.revision ?? 0) > 0 && ask.options.every((option) => option.id !== undefined) && (ask.answer === null || ask.answer.id !== undefined);
|
|
49417
|
+
const placed = (ask.revision ?? 0) > 0 && (ask.options ?? []).every((option) => option.id !== undefined) && (ask.answer === null || ask.answer.id !== undefined);
|
|
49377
49418
|
return placed && node.pin?.state !== "removed" ? "Question" : "Part";
|
|
49378
49419
|
}
|
|
49379
49420
|
function logSummary(issue, events) {
|
|
@@ -49446,16 +49487,16 @@ function childrenSummary(issue) {
|
|
|
49446
49487
|
return [
|
|
49447
49488
|
`Key: ${issue.key}`,
|
|
49448
49489
|
"Children:",
|
|
49449
|
-
...issue.children.length === 0 ? ["- none"] : issue.children.map((child) => `- ${child.key}: ${child.title} (${child.status})`)
|
|
49490
|
+
...(issue.children ?? []).length === 0 ? ["- none"] : (issue.children ?? []).map((child) => `- ${child.key}: ${child.title} (${child.status})`)
|
|
49450
49491
|
].join(`
|
|
49451
49492
|
`);
|
|
49452
49493
|
}
|
|
49453
49494
|
function askSummary({ ask, replies, answers }, askRef, pictures, incoming, outgoing) {
|
|
49454
49495
|
const answer = ask.answer;
|
|
49455
|
-
const earlierAnswers = answers.slice(0, -1);
|
|
49496
|
+
const earlierAnswers = (answers ?? []).slice(0, -1);
|
|
49456
49497
|
const parts = askPartEdges(ask, incoming);
|
|
49457
49498
|
const partRef = (id) => `${askRef}#b-${encodeBlockId(id)}`;
|
|
49458
|
-
const chain = replies.flatMap((reply) => [
|
|
49499
|
+
const chain = (replies ?? []).flatMap((reply) => [
|
|
49459
49500
|
`${reply.id} \xB7 ${actorText(reply.author)}`,
|
|
49460
49501
|
`Body: ${reply.body}`
|
|
49461
49502
|
]);
|
|
@@ -49463,7 +49504,7 @@ function askSummary({ ask, replies, answers }, askRef, pictures, incoming, outgo
|
|
|
49463
49504
|
`Question: ${ask.question}`,
|
|
49464
49505
|
...anchorLines(ask),
|
|
49465
49506
|
"Options:",
|
|
49466
|
-
...ask.options.length === 0 ? ["- none"] : ask.options.flatMap((option) => [
|
|
49507
|
+
...(ask.options ?? []).length === 0 ? ["- none"] : (ask.options ?? []).flatMap((option) => [
|
|
49467
49508
|
`- ${option.label}${option.description ? ` \u2014 ${option.description}` : ""}${option.id === undefined ? "" : ` (${partRef(option.id)})`}`,
|
|
49468
49509
|
...partReferenceLines(parts.at, option.id)
|
|
49469
49510
|
]),
|
|
@@ -49472,7 +49513,7 @@ function askSummary({ ask, replies, answers }, askRef, pictures, incoming, outgo
|
|
|
49472
49513
|
"Answer:",
|
|
49473
49514
|
...answer === null ? ["- none"] : [
|
|
49474
49515
|
`- By: ${actorActText(answer.user, answer.act)}`,
|
|
49475
|
-
`- Selected: ${answer.selected.length === 0 ? "none" : answer.selected.join(", ")}`,
|
|
49516
|
+
`- Selected: ${(answer.selected ?? []).length === 0 ? "none" : (answer.selected ?? []).join(", ")}`,
|
|
49476
49517
|
...answer.text === null ? [] : [`- Text: ${answer.text}`],
|
|
49477
49518
|
...answer.id === undefined ? [] : [`- Reference: ${partRef(answer.id)}`],
|
|
49478
49519
|
...partReferenceLines(parts.at, answer.id)
|
|
@@ -49495,12 +49536,12 @@ function askSummary({ ask, replies, answers }, askRef, pictures, incoming, outgo
|
|
|
49495
49536
|
`);
|
|
49496
49537
|
}
|
|
49497
49538
|
function askPartEdges(ask, incoming) {
|
|
49498
|
-
const ids = new Set([...ask.options.map((option) => option.id), ask.answer?.id].filter((id) => id !== undefined));
|
|
49539
|
+
const ids = new Set([...(ask.options ?? []).map((option) => option.id), ask.answer?.id].filter((id) => id !== undefined));
|
|
49499
49540
|
const at = new Map;
|
|
49500
49541
|
if (typeof incoming === "string" || ids.size === 0)
|
|
49501
49542
|
return { at, rest: incoming };
|
|
49502
49543
|
const rest = [];
|
|
49503
|
-
for (const edge of incoming.edges) {
|
|
49544
|
+
for (const edge of incoming.edges ?? []) {
|
|
49504
49545
|
const part = edge.block?.block_id;
|
|
49505
49546
|
if (part === undefined || !ids.has(part)) {
|
|
49506
49547
|
rest.push(edge);
|
|
@@ -49544,8 +49585,8 @@ function formatOpenAsksSummary(response, baseUrl) {
|
|
|
49544
49585
|
return ["There are no unanswered asks for this session.", `Scope: ${scope}.`].join(`
|
|
49545
49586
|
`);
|
|
49546
49587
|
}
|
|
49547
|
-
const waitingOnHuman = response.asks.filter((ask) => ask.waiting_on === "human");
|
|
49548
|
-
const waitingOnAgent = response.asks.filter((ask) => ask.waiting_on === "agent");
|
|
49588
|
+
const waitingOnHuman = (response.asks ?? []).filter((ask) => ask.waiting_on === "human");
|
|
49589
|
+
const waitingOnAgent = (response.asks ?? []).filter((ask) => ask.waiting_on === "agent");
|
|
49549
49590
|
return [
|
|
49550
49591
|
`${response.count} unanswered ${response.count === 1 ? "ask" : "asks"} you authored on active issues and project documents.`,
|
|
49551
49592
|
"",
|
|
@@ -49558,7 +49599,7 @@ function formatOpenAsksSummary(response, baseUrl) {
|
|
|
49558
49599
|
`);
|
|
49559
49600
|
}
|
|
49560
49601
|
function whoamiPerson(identity) {
|
|
49561
|
-
return identity.kind === "
|
|
49602
|
+
return identity.kind === "user" ? identity.login.toLowerCase() : identity.owner;
|
|
49562
49603
|
}
|
|
49563
49604
|
var INBOX_QUESTION_HEAD = 80;
|
|
49564
49605
|
function inboxSnoozed(row, now) {
|
|
@@ -49570,7 +49611,8 @@ function inboxSnoozed(row, now) {
|
|
|
49570
49611
|
function inboxSection(row, now) {
|
|
49571
49612
|
if (inboxSnoozed(row, now))
|
|
49572
49613
|
return "later";
|
|
49573
|
-
|
|
49614
|
+
const waiting = row.waiting_on;
|
|
49615
|
+
return waiting === "agent" || waiting === "human" ? waiting : undefined;
|
|
49574
49616
|
}
|
|
49575
49617
|
function inboxAskOwner(row) {
|
|
49576
49618
|
const key = row.issue?.key ?? row.issue_key;
|
|
@@ -49592,9 +49634,10 @@ function inboxAskLine(row) {
|
|
|
49592
49634
|
return `- ${label} \xB7 ${priority} \xB7 ${row.kind} \xB7 ${textHead(row.question, INBOX_QUESTION_HEAD)} \xB7 ${ref}`;
|
|
49593
49635
|
}
|
|
49594
49636
|
function inboxThreadLabel(row) {
|
|
49595
|
-
|
|
49596
|
-
|
|
49597
|
-
|
|
49637
|
+
const thread = inboxThreadRow(row);
|
|
49638
|
+
if (thread.kind === "agent")
|
|
49639
|
+
return thread.session.name;
|
|
49640
|
+
return thread.issue?.key ?? thread.document?.slug ?? thread.thread_id;
|
|
49598
49641
|
}
|
|
49599
49642
|
function inboxReplyAge(at, now) {
|
|
49600
49643
|
const minutes = Math.floor(Math.max(0, now - Date.parse(at)) / 60000);
|
|
@@ -49621,7 +49664,7 @@ function credentialRequestLine(request) {
|
|
|
49621
49664
|
const session = request.session ?? null;
|
|
49622
49665
|
return [
|
|
49623
49666
|
`- ${request.kind}`,
|
|
49624
|
-
request.identifiers.join(", "),
|
|
49667
|
+
(request.identifiers ?? []).join(", "),
|
|
49625
49668
|
request.requested_at,
|
|
49626
49669
|
...session === null ? [] : [`session request=${session.request ?? "-"}, enrollment=${session.enrollment ?? "-"}`],
|
|
49627
49670
|
...request.approve_url === undefined ? [] : [request.approve_url]
|
|
@@ -49662,7 +49705,7 @@ function commentSummary({ comment, replies }, graph) {
|
|
|
49662
49705
|
...replyBlockLines(comment),
|
|
49663
49706
|
`Body: ${comment.body}`
|
|
49664
49707
|
];
|
|
49665
|
-
const chain = replies.flatMap((reply) => [
|
|
49708
|
+
const chain = (replies ?? []).flatMap((reply) => [
|
|
49666
49709
|
`${reply.id} \xB7 ${actorText(reply.author)}`,
|
|
49667
49710
|
...anchorLines(reply),
|
|
49668
49711
|
...replyBlockLines(reply),
|
|
@@ -49695,10 +49738,10 @@ function anchorLines(record) {
|
|
|
49695
49738
|
}
|
|
49696
49739
|
function positionText(block) {
|
|
49697
49740
|
const { table, path } = block;
|
|
49698
|
-
const segments = path.map((entry) => `${entry.type}[${entry.index}]`);
|
|
49741
|
+
const segments = (path ?? []).map((entry) => `${entry.type}[${entry.index}]`);
|
|
49699
49742
|
if (table === undefined || table.row === null)
|
|
49700
49743
|
return segments.join(" \u203A ");
|
|
49701
|
-
const tableAt = path.findIndex((entry) => entry.type === "table");
|
|
49744
|
+
const tableAt = (path ?? []).findIndex((entry) => entry.type === "table");
|
|
49702
49745
|
const cells = table.cells ?? [];
|
|
49703
49746
|
const label = (table.column === null ? cells : cells.slice(0, table.column)).map((cell) => cell.trim()).filter((cell) => cell !== "" && !/^\d+$/.test(cell)).join(" \xB7 ");
|
|
49704
49747
|
const row = label === "" ? `row ${table.row}` : `row ${table.row} (${label})`;
|
|
@@ -49714,7 +49757,7 @@ function messageSummary({ message, replies }, graph) {
|
|
|
49714
49757
|
...replyBlockLines(message),
|
|
49715
49758
|
`Body: ${message.body}`
|
|
49716
49759
|
];
|
|
49717
|
-
const chain = replies.flatMap((reply) => [
|
|
49760
|
+
const chain = (replies ?? []).flatMap((reply) => [
|
|
49718
49761
|
`${reply.id} \xB7 ${actorText(reply.author)}`,
|
|
49719
49762
|
...replyBlockLines(reply),
|
|
49720
49763
|
`Body: ${reply.body}`
|
|
@@ -49792,7 +49835,8 @@ async function blockAsks(client, resolved, state) {
|
|
|
49792
49835
|
return asks.filter((ask) => typeof ask.block_id === "string" && ask.block_artifact?.id === resolved.artifact.id);
|
|
49793
49836
|
}
|
|
49794
49837
|
async function readUploadedFile(client, artifact, details, requested, owner, shown) {
|
|
49795
|
-
const
|
|
49838
|
+
const versions = artifact.versions ?? [];
|
|
49839
|
+
const latest = Math.max(0, ...versions.map((version) => version.number));
|
|
49796
49840
|
const number = requested ?? latest;
|
|
49797
49841
|
const of = number === latest ? "" : ` of ${latest}`;
|
|
49798
49842
|
const bytesRoute = `GET /api/v1/artifacts/${artifact.id}/versions/${number} serves its bytes.`;
|
|
@@ -49800,7 +49844,7 @@ async function readUploadedFile(client, artifact, details, requested, owner, sho
|
|
|
49800
49844
|
text: `${oversizePictureText(artifact.name, bytes)}, so dispatch doc-read cannot show this ` + `uploaded ${mime} picture (version ${number}${of}). ${bytesRoute}`,
|
|
49801
49845
|
details
|
|
49802
49846
|
});
|
|
49803
|
-
const stated =
|
|
49847
|
+
const stated = versions.find((version) => version.number === number);
|
|
49804
49848
|
if (artifact.kind === "image" && stated?.size !== undefined && stated.size > PICTURE_SHOWN_MAX_BYTES) {
|
|
49805
49849
|
return tooLarge(stated.mime ?? "image", stated.size);
|
|
49806
49850
|
}
|
|
@@ -49867,9 +49911,9 @@ async function listDocumentBlocks(client, artifact) {
|
|
|
49867
49911
|
if (block.table === undefined) {
|
|
49868
49912
|
lines.push(`${indent} This Dispatch does not report table rows yet, so no row or column index is listed.`);
|
|
49869
49913
|
} else {
|
|
49870
|
-
for (const row of block.table.rows) {
|
|
49914
|
+
for (const row of block.table.rows ?? []) {
|
|
49871
49915
|
lines.push(`${indent} row ${row.index}, ${row.id === "" ? "no id yet" : `id ${row.id}`}`);
|
|
49872
|
-
for (const cell of row.cells) {
|
|
49916
|
+
for (const cell of row.cells ?? []) {
|
|
49873
49917
|
const under = cell.header === "" ? "" : `, under ${JSON.stringify(cell.header)}`;
|
|
49874
49918
|
lines.push(`${indent} row ${cell.row} column ${cell.column}, ${cell.id === "" ? "no id yet" : `id ${cell.id}`}${under}: ${cell.text === "" ? "(empty)" : cell.text}`);
|
|
49875
49919
|
}
|
|
@@ -50090,7 +50134,7 @@ async function executeDispatchTool(input) {
|
|
|
50090
50134
|
throw error;
|
|
50091
50135
|
}
|
|
50092
50136
|
return {
|
|
50093
|
-
text: renderSessionAnswersList(response.items, { now: Date.now() }),
|
|
50137
|
+
text: renderSessionAnswersList(response.items ?? [], { now: Date.now() }),
|
|
50094
50138
|
details: { session: sessionId, since: response.since, total: response.total }
|
|
50095
50139
|
};
|
|
50096
50140
|
}
|
|
@@ -50101,9 +50145,10 @@ async function executeDispatchTool(input) {
|
|
|
50101
50145
|
const client = dispatchClient();
|
|
50102
50146
|
const identity = await client.whoami();
|
|
50103
50147
|
const owner = whoamiPerson(identity);
|
|
50104
|
-
const
|
|
50105
|
-
const
|
|
50106
|
-
const
|
|
50148
|
+
const agent = identity.kind === "agent" ? identity : undefined;
|
|
50149
|
+
const service = agent?.service ?? null;
|
|
50150
|
+
const proved = agent?.session ?? null;
|
|
50151
|
+
const project = agent?.project ?? null;
|
|
50107
50152
|
const session = proved ?? sessionId;
|
|
50108
50153
|
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.";
|
|
50109
50154
|
const signInNeeded = owner === null && service !== null && proved !== null;
|
|
@@ -50313,9 +50358,10 @@ async function executeDispatchTool(input) {
|
|
|
50313
50358
|
throw withAccount(error, told);
|
|
50314
50359
|
}
|
|
50315
50360
|
}
|
|
50316
|
-
const
|
|
50361
|
+
const existingLinks = before.external_links ?? [];
|
|
50362
|
+
const linked = existingLinks.map((link) => link.url);
|
|
50317
50363
|
const newLinks = requestedLinks?.filter((url) => !linked.includes(url)) ?? [];
|
|
50318
|
-
const sentLinks = requestedLinks === undefined ? undefined : requestedLinks.length === 0 ? [] : [...
|
|
50364
|
+
const sentLinks = requestedLinks === undefined ? undefined : requestedLinks.length === 0 ? [] : [...existingLinks, ...newLinks.map((url) => ({ url }))];
|
|
50319
50365
|
const rank = rankBefore === undefined && rankAfter === undefined ? undefined : {
|
|
50320
50366
|
...rankBefore === undefined ? {} : { before: rankBefore },
|
|
50321
50367
|
...rankAfter === undefined ? {} : { after: rankAfter }
|
|
@@ -50350,12 +50396,15 @@ async function executeDispatchTool(input) {
|
|
|
50350
50396
|
throw withAccount(error, landed);
|
|
50351
50397
|
}
|
|
50352
50398
|
refuseUnsavedRepository("updated", after, repo);
|
|
50353
|
-
const
|
|
50399
|
+
const links = after.external_links ?? [];
|
|
50400
|
+
const linkCount = `(${links.length} ${links.length === 1 ? "link" : "links"})`;
|
|
50354
50401
|
const changes = [
|
|
50355
50402
|
...closingNote === undefined ? [] : [`reason posted as message ${closingNote.id} (${closingNote.ref})`],
|
|
50356
50403
|
...status === undefined ? [] : [`status ${before.status} -> ${after.status}`],
|
|
50357
50404
|
...title === undefined ? [] : [`title "${after.title}"`],
|
|
50358
|
-
...labels === undefined ? [] : [
|
|
50405
|
+
...labels === undefined ? [] : [
|
|
50406
|
+
(after.labels ?? []).length === 0 ? "labels cleared" : `labels ${(after.labels ?? []).join(", ")}`
|
|
50407
|
+
],
|
|
50359
50408
|
...priority === undefined ? [] : [after.priority === null ? "priority cleared" : `priority -> P${after.priority}`],
|
|
50360
50409
|
...rank === undefined ? [] : [
|
|
50361
50410
|
`rank -> ${[
|
|
@@ -50369,7 +50418,7 @@ async function executeDispatchTool(input) {
|
|
|
50369
50418
|
...route === undefined ? [] : [after.route === null ? "route cleared" : `route ${after.route}`],
|
|
50370
50419
|
...parent === undefined ? [] : [after.parent === null ? "parent cleared" : `parent -> ${after.parent}`],
|
|
50371
50420
|
...blockedBy === undefined ? [] : [
|
|
50372
|
-
after.blocked_by.length === 0 ? "blocked_by cleared" : `blocked by ${after.blocked_by.join(", ")}`
|
|
50421
|
+
(after.blocked_by ?? []).length === 0 ? "blocked_by cleared" : `blocked by ${(after.blocked_by ?? []).join(", ")}`
|
|
50373
50422
|
],
|
|
50374
50423
|
...components === undefined ? [] : [componentsChange(components, after.components)],
|
|
50375
50424
|
...repo === undefined ? [] : [
|
|
@@ -50388,7 +50437,7 @@ async function executeDispatchTool(input) {
|
|
|
50388
50437
|
details: {
|
|
50389
50438
|
issue: after.key,
|
|
50390
50439
|
status: after.status,
|
|
50391
|
-
external_links: after.external_links.map((link) => link.url),
|
|
50440
|
+
external_links: (after.external_links ?? []).map((link) => link.url),
|
|
50392
50441
|
...closingNote === undefined ? {} : { message: closingNote.id },
|
|
50393
50442
|
...after.advice === undefined ? {} : { advice: after.advice }
|
|
50394
50443
|
}
|
|
@@ -50484,7 +50533,7 @@ async function executeDispatchTool(input) {
|
|
|
50484
50533
|
offset: optionalNumber(args, "offset") ?? 0
|
|
50485
50534
|
});
|
|
50486
50535
|
const { total, limit, offset } = page;
|
|
50487
|
-
const rows = page.issues.map((row) => ({
|
|
50536
|
+
const rows = (page.issues ?? []).map((row) => ({
|
|
50488
50537
|
key: row.key,
|
|
50489
50538
|
title: row.title,
|
|
50490
50539
|
status: row.status,
|
|
@@ -51003,7 +51052,7 @@ ${recorded.line}`,
|
|
|
51003
51052
|
const results = await client.issueResults(issue);
|
|
51004
51053
|
return {
|
|
51005
51054
|
text: formatCheckResults(results),
|
|
51006
|
-
details: { issue, checks: results.checks.length }
|
|
51055
|
+
details: { issue, checks: (results.checks ?? []).length }
|
|
51007
51056
|
};
|
|
51008
51057
|
}
|
|
51009
51058
|
case "dispatch_artifact": {
|
|
@@ -51135,7 +51184,7 @@ ${handoff.body}`,
|
|
|
51135
51184
|
const thread = await client.getMessageThread(messageIdOf(message), sessionId);
|
|
51136
51185
|
const issueKey = thread.message.issue_key;
|
|
51137
51186
|
const [pictures, graph] = await Promise.all([
|
|
51138
|
-
picturesOf(datedBodies([thread.message, ...thread.replies])),
|
|
51187
|
+
picturesOf(datedBodies([thread.message, ...thread.replies ?? []])),
|
|
51139
51188
|
issueKey === null ? [] : graphSections(client, dispatchChildRef(dispatchIssueRef(issueKey), "message", thread.message.id))
|
|
51140
51189
|
]);
|
|
51141
51190
|
return {
|
|
@@ -51175,7 +51224,7 @@ ${handoff.body}`,
|
|
|
51175
51224
|
await refuseItemOffRef(input.tool, "comment", ref, stringArg(args, "ref"), comment.comment, () => documentIdOf(ref));
|
|
51176
51225
|
const commentRef = refTarget(ref, "comment", id);
|
|
51177
51226
|
const [pictures, graph] = await Promise.all([
|
|
51178
|
-
picturesOf(datedBodies([comment.comment, ...comment.replies])),
|
|
51227
|
+
picturesOf(datedBodies([comment.comment, ...comment.replies ?? []])),
|
|
51179
51228
|
graphSections(client, commentRef)
|
|
51180
51229
|
]);
|
|
51181
51230
|
return {
|
|
@@ -51191,7 +51240,7 @@ ${handoff.body}`,
|
|
|
51191
51240
|
const messageRead = await client.getMessage(ownerArguments.ref.owner.issue, ownerArguments.ref.id);
|
|
51192
51241
|
const messageRef = dispatchChildRef(dispatchIssueRef(ownerArguments.ref.owner.issue), "message", ownerArguments.ref.id);
|
|
51193
51242
|
const [pictures, graph] = await Promise.all([
|
|
51194
|
-
picturesOf(datedBodies([messageRead.message, ...messageRead.replies])),
|
|
51243
|
+
picturesOf(datedBodies([messageRead.message, ...messageRead.replies ?? []])),
|
|
51195
51244
|
graphSections(client, messageRef)
|
|
51196
51245
|
]);
|
|
51197
51246
|
return {
|
|
@@ -51259,7 +51308,7 @@ ${handoff.body}`,
|
|
|
51259
51308
|
`Issue: ${resolved.issue.key} [${resolved.issue.status}] ${resolved.issue.title}`
|
|
51260
51309
|
],
|
|
51261
51310
|
`Reference: ${documentRef}`,
|
|
51262
|
-
`Versions: ${artifact.versions.length}`,
|
|
51311
|
+
`Versions: ${(artifact.versions ?? []).length}`,
|
|
51263
51312
|
...approval === undefined ? [] : [approval],
|
|
51264
51313
|
...await graphSections(client, documentRef)
|
|
51265
51314
|
].join(`
|
|
@@ -51299,7 +51348,10 @@ ${handoff.body}`,
|
|
|
51299
51348
|
graphSections(client, dispatchIssueRef(read.issue.key)),
|
|
51300
51349
|
liveAgents(client, holdsSession(read.issue.claim) || routeHeldBySession(read.issue)),
|
|
51301
51350
|
picturesOf([
|
|
51302
|
-
...read.issue.open_asks.map((ask) => ({
|
|
51351
|
+
...(read.issue.open_asks ?? []).map((ask) => ({
|
|
51352
|
+
text: ask.question,
|
|
51353
|
+
at: ask.created_at
|
|
51354
|
+
})),
|
|
51303
51355
|
...await eventTextsWhole(client, read.events)
|
|
51304
51356
|
]),
|
|
51305
51357
|
issueCoverageOrReason(client, read.issue.key)
|
|
@@ -52172,6 +52224,10 @@ var legionSlotView = object({
|
|
|
52172
52224
|
admittedAt: timestamp,
|
|
52173
52225
|
lentTo: issueKey.optional()
|
|
52174
52226
|
});
|
|
52227
|
+
var legionWaitingLineView = object({
|
|
52228
|
+
place: number2().int().positive(),
|
|
52229
|
+
length: number2().int().positive()
|
|
52230
|
+
});
|
|
52175
52231
|
var legionCheckWakeView = object({
|
|
52176
52232
|
kind: nonEmptyString,
|
|
52177
52233
|
detail: string2(),
|
|
@@ -52256,6 +52312,7 @@ var legionIssue = object({
|
|
|
52256
52312
|
designGate: legionGateView.optional(),
|
|
52257
52313
|
gatedSteps: array(legionGatedStepView).optional(),
|
|
52258
52314
|
slot: legionSlotView.optional(),
|
|
52315
|
+
waitingLine: legionWaitingLineView.optional(),
|
|
52259
52316
|
waitingOn: legionWaitingOn.optional(),
|
|
52260
52317
|
check: legionCheckView.optional(),
|
|
52261
52318
|
memoryGroup: _enum2(["memory", "none"]).optional(),
|
|
@@ -55274,9 +55331,9 @@ var import_nats2 = __toESM(require_mod4(), 1);
|
|
|
55274
55331
|
|
|
55275
55332
|
// package.json
|
|
55276
55333
|
var name = "@sjawhar/claude-envoy";
|
|
55277
|
-
var version2 = "1.
|
|
55334
|
+
var version2 = "1.26.0";
|
|
55278
55335
|
var legion = {
|
|
55279
|
-
daemonApiVersion:
|
|
55336
|
+
daemonApiVersion: 58
|
|
55280
55337
|
};
|
|
55281
55338
|
|
|
55282
55339
|
// ../pi-shared/src/agent-stream.ts
|