Files
multica/packages/views/common/task-transcript/trace-issue-labels.ts
Jiayuan Zhang 028f3b4437 feat(issues): show agent execution inline in comment threads (#8131)
* feat(issues): show agent runs inline with comment replies

* fix(issues): unify run comment projection and preserve disclosure focus

* refactor(issues): replace nested run cards with inline status rows

* fix(issues): align thread roots with reply content

* style(issues): remove thread toggle background

* style(issues): group reaction picker with comment actions

* feat(issues): show readable issue references in run summaries

* style(issues): move completed run logs into comment headers

* style(issues): balance comment block vertical spacing

* style(issues): shimmer live agent progress text

* style(issues): unify comment action hover feedback

* style(issues): reveal comment actions on block hover

* fix(issues): move published reply activity into the header

* fix(issues): settle comment UI as soon as replies are published

* fix(issues): reveal comment log buttons on hover

* fix(issues): defer run placement until trigger comments arrive

* fix(issues): isolate agent comment queues by thread

* fix(issues): display pending runs in execution order

* fix(ci): align integration tests with thread-scoped queues

* fix(issues): fit run actions to narrow comment columns
2026-09-08 12:58:16 +08:00

35 lines
1.4 KiB
TypeScript

import type { TraceEvent } from "./trace-event-presenter";
const UUID = "[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}";
const UUID_VALUE = new RegExp(`^${UUID}$`, "i");
// Only these positional arguments identify issues. In particular --thread and
// --parent identify comments, and must never be sent to the issue resolver.
const ISSUE_COMMAND = new RegExp(
`\\bmultica\\s+issue\\s+(?:get|update|comment\\s+(?:list|add))\\s+["']?(${UUID})(?![\\w-])`,
"gi",
);
export function collectTraceIssueIds(issueId: string, events: readonly TraceEvent[]): string[] {
const ids = new Set<string>();
const add = (id: unknown) => {
if (typeof id === "string" && UUID_VALUE.test(id)) ids.add(id.toLowerCase());
};
add(issueId);
for (const event of events) {
if (event.type !== "tool_use" || !event.input) continue;
add(event.input.issue_id);
for (const key of ["command", "cmd"]) {
const command = event.input[key];
if (typeof command !== "string") continue;
for (const match of command.matchAll(ISSUE_COMMAND)) add(match[1]);
}
}
return [...ids];
}
/** Display-only: never rewrite stored events, expanded evidence, or clipboard text. */
export function replaceTraceIssueIds(text: string, labels: ReadonlyMap<string, string>): string {
return text.replace(new RegExp(`(?<![\\w-])${UUID}(?![\\w-])`, "gi"),
(id) => labels.get(id.toLowerCase()) ?? id);
}