g1t/apps/web/app/lib/agent-step.ts

17 lines764 bytesCodeBlame

Pick any line to see why it is the way it is: the commit, the pull request and issue it came from, and what the agent was thinking.

Download ZIP from the Code button; a slimmer lifecycle panel; agent steps say what was done, not sandbox paths1/**
2 * An agent's latest step as the pages show it. The sandbox hands a review,
3 * a plan or an answer back as a file under /work; an agent that says so
4 * ("The review is written to `/work/review.json`") is saying it finished
5 * that, not something anyone needs the path for.
6 */
7const HANDED_BACK: [RegExp, string][] = [
8 [/\/work\/review\.json/, "Wrote its review."],
9 [/\/work\/plan\.json/, "Wrote the plan."],
10 [/\/work\/answer\.md/, "Wrote its answer."],
11];
12
13export function shownStep(step: string): string {
14 for (const [path, words] of HANDED_BACK) if (path.test(step)) return words;
15 // Any other file of the checkout, as the repository names it.
16 return step.replace(/`?\/work\/repo\/([^\s`]+)`?/g, "$1").replace(/`?\/work\/([^\s`]+)`?/g, "$1");
17}