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.
| Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look | 1 | import assert from "node:assert/strict"; |
| 2 | import { test } from "node:test"; | |
| 3 | ||
| 4 | import { WAITING_PREFIX } from "../../../../packages/contracts/src/compute.ts"; | |
| 5 | import { isWaitingMessage, linkPaths } from "./compute.ts"; | |
| 6 | ||
| 7 | test("the page a refusal names becomes a link, without its full stop", () => { | |
| 8 | assert.deepEqual(linkPaths("Agents need a paid workspace. Start the $20 plan: /acme/-/billing"), [ | |
| 9 | { text: "Agents need a paid workspace. Start the $20 plan: " }, | |
| 10 | { text: "/acme/-/billing", href: "/acme/-/billing" }, | |
| 11 | ]); | |
| 12 | assert.deepEqual(linkPaths("An owner can raise it: /acme/-/billing. Then try again."), [ | |
| 13 | { text: "An owner can raise it: " }, | |
| 14 | { text: "/acme/-/billing", href: "/acme/-/billing" }, | |
| 15 | { text: ". Then try again." }, | |
| 16 | ]); | |
| 17 | }); | |
| 18 | ||
| 19 | test("text without a page, or with other slashes, stays text", () => { | |
| 20 | assert.deepEqual(linkPaths("Try again in a minute."), [{ text: "Try again in a minute." }]); | |
| 21 | assert.deepEqual(linkPaths("It reads src/-/x and a/b"), [{ text: "It reads src/-/x and a/b" }]); | |
| 22 | }); | |
| 23 | ||
| 24 | test("waiting is told apart from a refusal, as the gate words it", () => { | |
| 25 | assert.equal(isWaitingMessage(`${WAITING_PREFIX}: this workspace runs 2 agents at a time.`), true); | |
| 26 | assert.equal(isWaitingMessage("Agents need a paid workspace."), false); | |
| 27 | }); |