Skip to content
Myr

Merge build/1108 into main

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by oscabriel · committed by oscabriel · parents 1a26053, 8d26192 · Browse files · 20 files+1053 added−49 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

20 files+1053 added−49 removed

  • tests:+623 added−19 removed
  • other:+430 added−30 removed

20 files+1053 added−49 removed

modified:apps/web/src/features/agents/llms.ts+8 added-4 removed
modified:apps/web/src/features/ask/markdown.ts+19 added-6 removed
2 unmodified lines
3 * fetch, either with `Accept: text/markdown` on the ask's own URL or at the4 * same URL with `.md`. The request decides; no user-agent list does.5 *6 * The brief is the platform's: `showAsk` renders it once, and the web only7 * serves it. A refusal is set the way `git push` printed it, from8 * `@repo/protocol/render` (AGENTS.md principle 3), then its next command.7 * serves it, under the banner that names the web's indexes. A refusal is8 * set the way `git push` printed it, from `@repo/protocol/render`9 * (AGENTS.md principle 3), then its next command.10 * Pure: a `Request` or an `Exit` in, a string or a `Response` out.11 */12import { indexBanner } from "@repo/agent-kit/host-doc";13import { Brand } from "@repo/brand";14import type { Visibility } from "@repo/protocol/annotations";15import type { ProjectName } from "@repo/protocol/ids";16import { Refusal } from "@repo/protocol/refusal";17import { explain } from "@repo/protocol/render";18import { Array, Cause, Exit, Option, Schema } from "effect";19
132 unmodified lines
152 "The platform did not answer, so the web cannot read this ask now. Ask again in a moment.",153 "",154].join("\n");155156/** Where the web's indexes are, for the banner over an ask's brief. */157export interface AskIndex {158 readonly project: ProjectName;159 readonly webUrl: string;160}161162/**163 * How reading an ask ended, as the Markdown response: the brief (200,155 * cacheable as its contract's visibility allows); a refusal (404, its156 * Markdown); or no answer from the platform (502). Only a brief is cached.164 * cacheable as its contract's visibility allows), opened by the banner165 * naming `index`'s `llms.txt` files; a refusal (404, its166 * Markdown, no banner); or no answer from the platform (502). Only a brief167 * is cached.168 */169export const askMarkdownResponse = <E>(170 result: Exit.Exit<{ readonly brief: string }, E>,160 visibility: ContractVisibility171 visibility: ContractVisibility,172 index: AskIndex173): Response =>174 Exit.match(result, {175 onFailure: (cause) =>176 Option.match(Option.filter(Cause.findErrorOption(cause), isRefusal), {177 onNone: () => markdown(UNANSWERED, 502, "no-store"),178 onSome: (refusal) =>179 markdown(refusalsMarkdown([refusal]), 404, "no-store"),180 }),169 onSuccess: ({ brief }) => markdown(brief, 200, cacheFor(visibility)),181 onSuccess: ({ brief }) =>182 markdown(`${indexBanner(index)}\n\n${brief}`, 200, cacheFor(visibility)),183 });184185/**186 * The answer to a path that can name no ask: a project's and an ask's names
21 unmodified lines
modified:apps/web/src/routes/$project/asks/{$ask}[.]md.ts+9 added-3 removed
added:apps/web/src/routes/llms-full[.]txt.ts+52 added
modified:apps/web/test/ask-markdown.test.ts+47 added-6 removed
1/**2 * An ask answers as Markdown, so a harness reads it with one plain fetch:3 * the ask's URL with `Accept: text/markdown`, or the same URL with `.md`.4 * The body is the brief the platform rendered (`showAsk`), untouched; an5 * unknown ask is a 404 whose body is the refusal, as git would print it.4 * The body is the banner naming the web's indexes, then the brief the5 * platform rendered (`showAsk`), untouched; an unknown ask is a 404 whose6 * body is the refusal, as git would print it.7 * A browser asking for HTML gets the page.8 */9import { describe, expect, it } from "@effect/vitest";10import { Brand } from "@repo/brand";
4 unmodified lines
15import { asTester, unanswered } from "@repo/protocol/testing";16import { Effect, Exit, Layer, Ref } from "effect";17import { RpcTest } from "effect/rpc";1819import { indexBanner } from "../src/features/agents/llms.ts";20import {21 askMarkdownResponse,22 refusalsMarkdown,23 wantsMarkdown,
6 unmodified lines
30import { ask, askId, brief, project } from "./ask-fixtures.ts";3132const WEB = "https://web-test.example.workers.dev";3334/** Where the web's indexes are for datekit's asks, as the routes find them. */35const index = { project, webUrl: WEB };3637/** An ask's Markdown as served: the banner naming the indexes, then the brief unchanged. */38const served = `${indexBanner(index)}\n\n${brief}`;3940const MARKDOWN = "text/markdown; charset=utf-8";4142const BROWSER =43 "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8";
76 unmodified lines
120 )121 );122123 expect(yield* read(response)).toStrictEqual({116 body: brief,124 body: served,125 cacheControl: "public, max-age=60",126 contentType: MARKDOWN,127 status: 200,128 vary: "Accept",
34 unmodified lines
163 })164 );165166 expect(yield* read(response)).toStrictEqual({159 body: brief,167 body: served,168 cacheControl: "public, max-age=60",169 contentType: MARKDOWN,170 status: 200,171 vary: "Accept",
122 unmodified lines
294 "never lets a cache keep the answer of a contract only maintainers may see",295 () =>296 Effect.gen(function* () {297 const seen = yield* read(290 askMarkdownResponse(Exit.succeed({ brief }), "maintainers")298 askMarkdownResponse(Exit.succeed({ brief }), "maintainers", index)299 );300301 expect([seen.status, seen.cacheControl, seen.body]).toStrictEqual([302 200,303 "private, no-store",296 brief,304 served,305 ]);306 })307 );308});309310describe("an ask's Markdown with the index named", () => {311 it.effect(312 "opens with the banner naming its project's llms.txt, then the brief unchanged",313 () =>314 Effect.gen(function* () {315 const seen = yield* read(316 askMarkdownResponse(Exit.succeed({ brief }), "public", index)317 );318319 expect(seen.status).toBe(200);320 expect(seen.body).toBe(served);321 expect(seen.body.split("\n")[0]).toContain(322 `${WEB}/${project}/llms.txt`323 );324 })325 );326327 it.effect("keeps a refusal's Markdown as it is, with no banner", () =>328 Effect.gen(function* () {329 const refusal = new UnknownAsk({ ask: AskId.make("no-such-ask") });330331 const seen = yield* read(332 askMarkdownResponse(Exit.fail(refusal), "public", index)333 );334335 expect([seen.status, seen.body]).toStrictEqual([336 404,337 refusalsMarkdown([refusal]),338 ]);339 })340 );341});342343describe(refusalsMarkdown, () => {344 it("sets every refusal's explain lines in one text block, then each distinct next command once", () => {345 const refusals = [346 new UnknownProject({ project: ProjectName.make("nowhere") }),
44 unmodified lines
modified:apps/web/test/llms.test.ts+102 added-4 removed
6 unmodified lines
7 */8import { describe, expect, it } from "@effect/vitest";9import type { CommandDoc } from "@repo/agent-kit/command-doc";10import { Brand } from "@repo/brand";11import { claimForkName, workingForkName } from "@repo/project/repo-names";12import { Client, Contracts } from "@repo/protocol/contracts";13import type { AskListing } from "@repo/protocol/domain/ask";14import type { ProjectListing } from "@repo/protocol/domain/front-page";13import { AskId, KindName, ProjectName } from "@repo/protocol/ids";14import { Option } from "effect";15import { AskId, Handle, KindName, ProjectName } from "@repo/protocol/ids";16import { asTester, unanswered } from "@repo/protocol/testing";17import { Effect, Layer, Option } from "effect";18import { RpcTest } from "effect/rpc";1920import { commands as catalog } from "../src/features/agents/catalog.ts";21import {22 frontLlms,23 fullLlms,24 indexBanner,25 mcpCard,26 missingProjectLlms,27 projectLlms,28} from "../src/features/agents/llms.ts";29import { llmsFullHandler } from "../src/routes/llms-full[.]txt.ts";3031const platformUrl = "https://platform-test.example.workers.dev";3233const webUrl = "https://web-test.example.workers.dev";
203 unmodified lines
237 });238239 const lines = linesOf(text);240234 it("opens with the project, its posture and how many asks are open", () => {235 expect(lines.slice(0, 3)).toStrictEqual([241 it("opens with the banner, then the project, its posture and how many asks are open", () => {242 expect(lines.slice(0, 5)).toStrictEqual([243 indexBanner({ project: datekit, webUrl }),244 "",245 "# datekit",246 "",247 `> A project on ${Brand.name}. Posture: Open with sealed evidence. 3 open asks.`,248 ]);
83 unmodified lines
332 ).toStrictEqual([]);333 });334});335336/** A platform that lists `listed` as its projects, and answers nothing else. */337const listing = (listed: readonly ProjectListing[]) => () =>338 Layer.effect(Client, RpcTest.makeClient(Contracts)).pipe(339 Layer.provide([340 Layer.mergeAll(341 unanswered,342 Contracts.toLayerHandler("listProjects", () =>343 Effect.succeed({ projects: listed })344 )345 ),346 asTester,347 ])348 );349350/** A platform that cannot be reached: every call dies on the way. */351const unreachable = () =>352 Layer.effect(Client, RpcTest.makeClient(Contracts)).pipe(353 Layer.provide([unanswered, asTester])354 );355356const getFull = () => new Request(`${webUrl}/llms-full.txt`);357358const read = (response: Response) =>359 Effect.map(360 Effect.promise(() => response.text()),361 (body) => ({362 body,363 contentType: response.headers.get("content-type"),364 status: response.status,365 })366 );367368describe("/llms-full.txt", () => {369 it.effect("is fullLlms over the projects the platform lists", () =>370 Effect.gen(function* () {371 const response = yield* Effect.promise(() =>372 llmsFullHandler(listing(projects), platformUrl)({ request: getFull() })373 );374375 expect(yield* read(response)).toStrictEqual({376 body: fullLlms({ commands: catalog, platformUrl, projects, webUrl }),377 contentType: "text/markdown; charset=utf-8",378 status: 200,379 });380 })381 );382383 it.effect("is unavailable when the platform does not answer", () =>384 Effect.gen(function* () {385 const response = yield* Effect.promise(() =>386 llmsFullHandler(unreachable, platformUrl)({ request: getFull() })387 );388389 const seen = yield* read(response);390391 expect(seen.status).toBe(503);392 expect(seen.body).toContain("# Unavailable");393 })394 );395396 describe("its fork names", () => {397 const text = fullLlms({ commands: catalog, platformUrl, projects, webUrl });398 const parseIso = AskId.make("parse-iso");399 const ada = Handle.make("Ada");400401 /** A name pattern the doc states, with its placeholders filled in. */402 const filled = (pattern: string) =>403 pattern404 .replaceAll("<project>", datekit)405 .replaceAll("<ask>", parseIso)406 .replaceAll("<handle>", ada.toLowerCase());407408 /** The patterns in the doc's code spans that name a fork. */409 const patterns = [...text.matchAll(/`(?<name><project>--[^`]+)`/gu)].map(410 (match) => match.groups?.name ?? ""411 );412413 it("spell a claim's fork as the platform names it", () => {414 expect(patterns.map(filled)).toContain(415 claimForkName(datekit, parseIso, ada)416 );417 });418419 it("spell a working fork as the platform names it", () => {420 expect(patterns.map(filled)).toContain(workingForkName(datekit, ada));421 });422 });423});424425describe(mcpCard, () => {426 it("describes the platform's MCP endpoint and where its auth is found", () => {427 expect(mcpCard({ platformUrl })).toStrictEqual({428 authentication: {
12 unmodified lines
modified:apps/web/test/routes.test.ts+1 added
added:packages/agent-kit/src/full-llms.ts+204 added
1/**2 * `/llms-full.txt`: what an agent needs beyond the index, in one file.3 * `frontLlms`' text, then every refusal of the closed union (every group,4 * from `refusalCatalog`), how git meets the platform, how a landing5 * happens (ADR 0014), one line per event a watcher hears, and the guides6 * for the moments an answer goes sideways.7 *8 * Pure, and every name comes from `Brand`. The refusals come from the9 * union and the events from a table the type holds to `ProjectEvent`, so a10 * new tag cannot be missing; a guide names a command only when the catalog11 * has it. Nothing here names a private repo, its files or its readers12 * (AGENTS.md principle 7): the gateway lines below are the ones anyone13 * outside one can meet.14 */15import { Brand } from "@repo/brand";16import type { ProjectEvent } from "@repo/protocol/domain/event";17import type { ProjectListing } from "@repo/protocol/domain/front-page";18import { Option } from "effect";1920import type { CommandDoc } from "./command-doc.ts";21import { frontLlms, typed, withCommand } from "./host-doc.ts";22import { refusalCatalog } from "./refusals.ts";23import { code, page, table } from "./text.ts";2425type Commands = readonly CommandDoc[];2627const cli = (...words: readonly string[]) => [Brand.cli, ...words].join(" ");2829const notesRef = `refs/notes/${Brand.slug}`;3031const pushAnswer = code(`git push ${Brand.slug} HEAD:main`);3233/** What the gateway says when git is not let in: `<reason>; sign in with <cli> login`. */34const signIn = (reason: string) => `${reason}; sign in with ${cli("login")}`;3536// --- Refusals -----------------------------------------------------------------3738const refusals = () => [39 "## Refusals",40 "",41 `Every refusal the platform gives, in every group of its closed union. Each has a \`_tag\`, \`retryable\` (whether trying the same thing again can help) and \`next\` (the command to run next), and no message: match on the tag. Git prints them on its \`remote:\` lines, ${code(cli("check"))} and ${code(cli("status"))} print them, an MCP tool returns them as JSON, and the verdict note holds them. The refusals about an answer's files arrive together, so one push hears about all of them.`,42 "",43 ...table(44 ["`_tag`", "Group", "Retryable", "`next`", "What to do"],45 refusalCatalog().map(({ group, next, retryable, tag, todo }) => [46 code(tag),47 group,48 retryable ? "yes" : "no",49 next,50 todo,51 ])52 ),53 "",54];5556// --- Git here -------------------------------------------------------------------5758const gitHere = (platformUrl: string) => [59 "## Git here",60 "",61 `Git reaches each repo at ${code(`${platformUrl}/<repo>.git`)} over smart HTTP and signs in with Basic auth. The password is your platform token, which ${code(cli("login"))} stores and hands to git through its credential helper. The username is an audit tag, ${code("audit;harness=<harness>")} (with ${code("&model=…")} and ${code("&session=…")} when the harness names them): it records which harness pushed and is never identity. The token alone says who you are.`,62 "",63 ...table(64 ["Repo", "Name", "Who reads it", "Who pushes to it"],65 [66 [67 "The project's",68 code("<project>"),69 "Anyone",70 "No one: `main` moves only by a landing (the project's first push is its initializer's)",71 ],72 [73 "A claim's fork",74 code("<project>--<ask>--<handle>"),75 "Signed-in people",76 "Its claimant while the claim is live, and a decider who finishes the answer",77 ],78 [79 "A working fork",80 code("<project>--me--<handle>"),81 "Signed-in people",82 "Its owner",83 ],84 ]85 ),86 "",87 `A fork's name spells the handle in lowercase. A fork takes branches only: push your answer with ${pushAnswer}. A push of a note, a tag or any other ref outside ${code("refs/heads/")} is refused whole with ${code("DirectPush")}, since the platform writes those refs itself.`,88 "",89 "After a push, read the verdict on your head in a clone of your fork. It is one JSON note per head: match on its `_tag`, and run a refusal's `next`. A newer verdict on the same head replaces its note.",90 "",91 "```sh",92 `git fetch ${Brand.slug} ${notesRef}:${notesRef}`,93 `git notes --ref=${Brand.slug} show <head>`,94 "```",95 "",96 "When it does not let git in, the platform answers in plain text:",97 "",98 `- 401 ${code(signIn("a push needs a signed-in person"))}: a push without a token.`,99 `- 401 ${code(signIn("a fork is read by signed-in people"))}: a fork read without a token.`,100 `- 401 ${code(signIn("that token is not one we know"))}: the token expired or was revoked.`,101 `- 404 ${code("no repo <name>")}: no repo you may reach has that name.`,102 `- 404 ${code("not a git endpoint")}: the path is not one git asks for.`,103 "",104];105106// --- How a landing happens ----------------------------------------------------107108const landing = () => [109 "## How a landing happens",110 "",111 "1. The platform checks the answer's merged tree: the ask's check and the project's lanes.",112 "2. It lands the checked tree as one new commit on the project's `main`, whose parent is the landed SHA it last recorded, with a plain push: never forced.",113 "3. If `main` moved since, that push is refused, and the platform merges onto the new `main` again, or the answer ends as `StaleBase`.",114 "4. Only once `main` has moved does it write its bookkeeping, each in a push of its own: the ref that mirrors the landed SHA, then the verdict note. Either may trail `main` for a moment, and nothing decides by them.",115 "5. A landing tried again finds its own commit on `main` by its `Request-Id` trailer and writes only what is missing, so it never makes a second commit.",116 "",117];118119// --- Events ---------------------------------------------------------------------120121/** What each event says happened, one line per tag of `ProjectEvent`. */122const eventLines = {123 AskClosed: "An ask closed, with the landing that answered it.",124 AskOpened: "A new ask opened.",125 Claimed: "Someone claimed an ask.",126 Decided: "A decider took a decision.",127 Judged: "An answer was checked, with the outcome its verdict holds.",128 Landed: "A landing reached `main`.",129 Lapsed: "A claim lapsed: no push for too long.",130 LedgerAppended: "The project's public ledger gained an entry.",131 ProposalDrafted:132 "A proposal's draft settled: ready for a decider, or failed.",133 ProposalOpened: "A proposal opened.",134 Pushed: "A claimant pushed to their fork.",135 Released: "A claim was released.",136 Warned: "A claim was warned that it lapses without a push.",137} as const satisfies Record<ProjectEvent["_tag"], string>;138139const events = () => [140 "## Events",141 "",142 "A project's page follows its events as they happen (the `watch` contract). Each event carries `seq`, its place in the project's sequence, and `at`, its time; a watcher resumes after the last `seq` it saw.",143 "",144 ...Object.entries(eventLines).map(([tag, line]) => `- ${code(tag)}: ${line}`),145 "",146];147148// --- Guides ---------------------------------------------------------------------149150const guides = (commands: Commands, platformUrl: string) => [151 "## Guides",152 "",153 "### Recover from `StaleBase`",154 "",155 `\`main\` moved under your answer, and the answer did not merge onto it. Rebase onto the new \`main\`, resolve what the rebase stops on, and push again: ${code(`git pull --rebase ${platformUrl}/<project>.git main`)}, then ${pushAnswer}.`,156 "",157 "### Follow an answer until it lands",158 "",159 ...withCommand(160 typed(commands, "status", {}, ["project"]),161 (each) => `- ${each} shows your claims and answers and where each stands.`162 ),163 ...withCommand(164 typed(commands, "verdict", {}, ["project"]),165 (each) => `- ${each} shows the verdict on an answer.`166 ),167 "- The project's events say when it was checked and when it landed (see Events).",168 "- The verdict note on your head holds the verdict (see Git here).",169 "",170 ...Option.match(typed(commands, "submit", {}, ["project"]), {171 onNone: () => [],172 onSome: (each) => [173 "### Offer the same answer again",174 "",175 `Offering an answer again (${each}) with the same \`requestId\` returns the same receipt: it is checked once, however many times it is offered.`,176 "",177 ],178 }),179 "### Resume on a new machine",180 "",181 `Clone your claim's fork, with your handle in lowercase: ${code(`git clone ${platformUrl}/<project>--<ask>--<handle>.git`)}.${withCommand(182 typed(commands, "claim", {}, ["project"]),183 (each) =>184 ` Claiming the ask again (${each}) returns the claim you hold, with its remote.`185 ).join("")}`,186];187188/**189 * `/llms-full.txt`: the index, then the refusals, git, landings, events190 * and guides. The web serves it; the platform's `/` stays the index alone.191 */192export const fullLlms = (input: {193 readonly commands: Commands;194 readonly projects: readonly ProjectListing[];195 readonly platformUrl: string;196 readonly webUrl: string;197}) =>198 `${frontLlms(input)}\n${page([199 ...refusals(),200 ...gitHere(input.platformUrl),201 ...landing(),202 ...events(),203 ...guides(input.commands, input.platformUrl),204 ])}`;
modified:packages/agent-kit/src/host-doc.ts+23 added-4 removed
4 unmodified lines
5 * how to connect over MCP, how to find and take an ask, every command, and6 * which projects exist: the web serves it at `/llms.txt`, and the platform7 * at `/` for an agent, with no web app's pages named when it knows of none.8 * `projectLlms` is the web's `/<project>/llms.txt`, with the project's open9 * asks, and `mcpCard` its `/.well-known/mcp.json`.9 * asks, and `mcpCard` its `/.well-known/mcp.json`. With a web app,10 * `frontLlms` names `/llms-full.txt` (`full-llms.ts`), and `indexBanner`11 * opens every other Markdown answer the web serves, so a reader that lands12 * on one finds the rest.13 *14 * Pure: the hosts hand in what the platform lists and the CLI's commands15 * as this package's one list holds them, so no command is written here16 * by hand. A step names a command only when the catalog has it. Every
67 unmodified lines
84 ].join(" ");85};8687/** `words` as typed, with `flags`, when the catalog has the command. */85const typed = (88export const typed = (89 commands: Commands,90 words: string,91 known: Known,92 flags: readonly ("ask" | "project")[] = []
2 unmodified lines
95 code(usage(command, known, flags))96 );9798/** The sentence `make` writes around a typed command, or nothing without it. */96const withCommand = (99export const withCommand = (100 command: Option.Option<string>,101 make: (typedCommand: string) => string102) => Option.toArray(Option.map(command, make));103
110 unmodified lines
214 "",215 ...Option.match(webUrl, {216 onNone: () => [],217 onSome: (web) => [215 `The same facts read as Markdown: each project at ${web}/<project>/llms.txt, and each ask at ${web}/<project>/asks/<ask>.md.`,218 `The same facts read as Markdown: each project at ${web}/<project>/llms.txt, and each ask at ${web}/<project>/asks/<ask>.md. Every refusal, how git meets the platform, how a landing happens, the events and the guides are in ${web}/llms-full.txt.`,219 "",220 ],221 }),222 "## Install the CLI",
55 unmodified lines
278279const askLine = (webUrl: string, project: string, listing: AskListing) =>280 `- [${listing.ask}](${projectPage(webUrl, project)}/asks/${listing.ask}.md): ${[sentence(listing.want), ...askNotes(listing)].join(" ")}`;281282/**283 * The line that opens a Markdown answer the web serves: where the index is,284 * where the full text is, and, for a project's answer, the project's own285 * index. One blockquote, so a reader that lands on any page finds the rest.286 */287export const indexBanner = (input: {288 readonly webUrl: string;289 readonly project?: ProjectName;290}) => {291 const { project, webUrl } = input;292293 return `> For agents: the index is ${webUrl}/llms.txt, and everything beyond it (refusals, git, landings, events, guides) is ${webUrl}/llms-full.txt${project === undefined ? "" : `; this project's index is ${projectPage(webUrl, project)}/llms.txt`}.`;294};295296/** `/<project>/llms.txt`: the project, its posture, how to clone it, its open asks and how to take one. */297export const projectLlms = (input: {298 readonly listing: ProjectListing;299 readonly asks: readonly AskListing[];
4 unmodified lines
304 const { asks, commands, listing, platformUrl, webUrl } = input;305 const { project } = listing;306307 return page([308 indexBanner({ project, webUrl }),309 "",310 `# ${project}`,311 "",312 `> A project on ${Brand.name}. Posture: ${postureWords[listing.posture]}. ${counted(asks.length, "open ask")}.`,313 "",
52 unmodified lines
modified:packages/agent-kit/src/refusals.ts+115 added-13 removed
1 unmodified line
2 * The refusals an answer can meet, read from the closed union: each one's3 * tag, whether retrying can help and its `next` come from its schema, and4 * what to do about it from the table below, which the type holds to the5 * union's groups (a refusal added to one fails the typecheck until it has6 * a line here).6 * a line here). `refusalCatalog` walks every group the same way, for7 * `/llms-full.txt`, with a second table for the refusals no answer meets.8 */9import { Brand } from "@repo/brand";10import { groups } from "@repo/protocol/refusal";11import { Exit, Predicate, SchemaAST } from "effect";
19 unmodified lines
31>["members"][number];3233type AnswerTag = InstanceType<AnswerMember>["_tag"];3435type Tag = InstanceType<Member>["_tag"];3637/**38 * What to do on meeting it. A refusal whose `next` is set when it is raised39 * gives the command's form here, or what it names when no form fits.40 */
64 unmodified lines
105 VerifierBlocked: {106 todo: "Nothing: the platform could not run the checks, and runs them again.",107 },108 Weakened: {106 todo: "Take the marker out, or give it a reason for a decider to weigh; never raise a ratchet.",109 todo: "Take the marker out; a marker without a reason may get one after ` -- ` for a decider to weigh, but one a decider declined stays out; never raise a ratchet.",110 },111} as const satisfies Record<AnswerTag, Repair>;112113/**114 * What to do on meeting a refusal no answer meets: at an ask's opening, a115 * maintainer's own push, a decision, a lookup, setup or the env.116 */117const elsewhere = {118 DecisionClosed: {119 todo: "Nothing to decide: it was taken already, or expired to its default.",120 },121 DraftInProgress: {122 next: cli("proposal", "<proposal>"),123 todo: "Wait: the platform is drafting this proposal's ask already, and `next` shows when it settles.",124 },125 ImportFailed: { todo: "Read `reason`, then import again." },126 IncompleteBrief: {127 todo: "Fill in the fields `missing` names: the ask's kind requires them.",128 },129 LayerContentInPublicTree: {130 todo: "Take the paths it names out: their files stay private and never enter a public tree.",131 },132 NotDecider: {133 todo: "Only one of the project's deciders may do this: ask one of them.",134 },135 NotRedFirst: {136 todo: "Make the ask's check fail on main by an assertion, the same way twice, then open the ask again.",137 },138 NotSensitive: {139 todo: "Only an `@sensitive` item holds a write-only value: `next` shows which items are.",140 },141 PostureChange: {142 todo: "Wait for a decider to take the posture change it names (`from`, `to`); `next` lists the decisions waiting.",143 },144 ProjectExists: { todo: "Pick another name: that one is taken." },145 ProposalClosed: {146 todo: "Nothing more is drafted for it: the proposal was accepted, declined or expired.",147 },148 SecretInOutput: {149 todo: "Take the write-only value of `item` out of the output or the tree (`where`), then check again.",150 },151 UnknownAsk: {152 todo: "Check the ask's name: `next` lists the project's open asks.",153 },154 UnknownCommit: {155 todo: "Fetch the project, then name a commit it holds.",156 },157 UnknownDecision: {158 todo: "Check the decision's id: `next` lists the decisions waiting on you.",159 },160 UnknownEnvItem: {161 todo: "Name a key the project's env shape has: `next` lists them.",162 },163 UnknownPath: {164 todo: "Name a path the commit holds: `next` lists its files.",165 },166 UnknownProject: {167 todo: "Check the project's name: every project is listed in the index.",168 },169 UnknownProposal: {170 todo: "Check the proposal's id: `next` lists the proposals waiting on you.",171 },172 UnknownRevision: {173 todo: "Name `main`, a commit the project holds or one of its tags: `next` lists its refs.",174 },175 UnstatedRequirement: {176 todo: "State in public what the area's held-back check holds, or take the check out of the suite.",177 },178 ValueTooShort: {179 nextNames: `${code(cli("env", "set", "<key>"))}, with ${code("--acknowledge-short")} when the value is above the floor`,180 todo: "Give a longer value, or acknowledge a short one where the floor allows it.",181 },182 WeakCheck: {183 todo: "Strengthen the check: as it stands, the trivial answer `weakness` names would pass it.",184 },185} as const satisfies Record<Exclude<Tag, AnswerTag>, Repair>;186187const repairOf = new Map<string, Repair>(Object.entries(repairs));188189const everyRepairOf = new Map<string, Repair>([190 ...repairOf,191 ...Object.entries(elsewhere),192]);193194/** A field's value when the constructor fills it in, as it does a fixed `next`. */195const constructorDefault = (ast: SchemaAST.AST) => {196 const fill = ast.context?.constructorDefault;197
23 unmodified lines
221 ? (repair?.nextNames ?? "")222 : code(repair.next);223};224225/** One member's row, from its schema and the repair `repairTable` gives it. */226const rowOf = (227 member: Member,228 repairTable: ReadonlyMap<string, Repair>229): AnswerRefusal => {230 const { ast: retryable } = member.fields.retryable;231 const fixed = constructorDefault(member.fields.next.ast);232 const repair = repairTable.get(member.identifier);233234 return {235 next: nextOf(fixed, repair),236 retryable: SchemaAST.isLiteral(retryable) && retryable.literal === true,237 tag: member.identifier,238 todo: repair?.todo ?? "",239 };240};241242/** Every refusal an answer can meet, in the union's order. */243export const answerRefusals: readonly AnswerRefusal[] = groups244 .flatMap((group): readonly Member[] =>245 answerGroups.some((answer) => answer === group.name) ? group.members : []246 )148 .map((member) => {149 const { ast: retryable } = member.fields.retryable;150 const fixed = constructorDefault(member.fields.next.ast);151 const repair = repairOf.get(member.identifier);247 .map((member) => rowOf(member, repairOf));248153 return {154 next: nextOf(fixed, repair),155 retryable: SchemaAST.isLiteral(retryable) && retryable.literal === true,156 tag: member.identifier,157 todo: repair?.todo ?? "",158 };159 });249/** One refusal of the closed union, with the group the union files it under. */250export interface CatalogRow extends AnswerRefusal {251 readonly group: string;252}253254/** Every refusal of the closed union, every group, in the union's order. */255export const refusalCatalog = (): readonly CatalogRow[] =>256 groups.flatMap((group) =>257 group.members.map((member: Member) => ({258 ...rowOf(member, everyRepairOf),259 group: group.name,260 }))261 );262263/** The refusals section every skill carries. */264export const refusalSection = () => [265 "## Refusals",266 "",
13 unmodified lines
modified:packages/agent-kit/test/golden/agent-plugins-stdio.txt+1 added-1 removed
62 unmodified lines
63| `AskBlocked` | yes | `__CLI__ asks` | Wait for the asks it names to land, or answer one of them first. |64| `Denounced` | no | `__CLI__ status` | The project's vouch file denounces you: it takes no claims or proposals from you. |65| `OutOfScope` | no | `__CLI__ check` | Undo your changes to the paths it names: they are outside the ask's territory. |66| `TouchedJudge` | no | `__CLI__ check` | Undo your changes to the paths it names: they decide what the checks do. |67| `Weakened` | no | `__CLI__ check` | Take the marker out, or give it a reason for a decider to weigh; never raise a ratchet. |67| `Weakened` | no | `__CLI__ check` | Take the marker out; a marker without a reason may get one after ` -- ` for a decider to weigh, but one a decider declined stays out; never raise a ratchet. |68| `PrivatePathInPublicTree` | no | `__CLI__ check` | Take the held-back paths it names out of your answer. |69| `ReachedInternals` | no | `__CLI__ check` | Import the other module only through its public files. |70| `StaleBase` | yes | `git pull --rebase` | Main moved: rebase onto it, resolve the conflicts it names, and push again. |71| `StaleLayer` | yes | `__CLI__ status` | Nothing: the answer is checked again. |
26 unmodified lines
modified:packages/agent-kit/test/golden/agent-plugins.txt+1 added-1 removed
63 unmodified lines
64| `AskBlocked` | yes | `__CLI__ asks` | Wait for the asks it names to land, or answer one of them first. |65| `Denounced` | no | `__CLI__ status` | The project's vouch file denounces you: it takes no claims or proposals from you. |66| `OutOfScope` | no | `__CLI__ check` | Undo your changes to the paths it names: they are outside the ask's territory. |67| `TouchedJudge` | no | `__CLI__ check` | Undo your changes to the paths it names: they decide what the checks do. |68| `Weakened` | no | `__CLI__ check` | Take the marker out, or give it a reason for a decider to weigh; never raise a ratchet. |68| `Weakened` | no | `__CLI__ check` | Take the marker out; a marker without a reason may get one after ` -- ` for a decider to weigh, but one a decider declined stays out; never raise a ratchet. |69| `PrivatePathInPublicTree` | no | `__CLI__ check` | Take the held-back paths it names out of your answer. |70| `ReachedInternals` | no | `__CLI__ check` | Import the other module only through its public files. |71| `StaleBase` | yes | `git pull --rebase` | Main moved: rebase onto it, resolve the conflicts it names, and push again. |72| `StaleLayer` | yes | `__CLI__ status` | Nothing: the answer is checked again. |
23 unmodified lines
modified:packages/agent-kit/test/golden/claude-plugin-stdio.txt+1 added-1 removed
61 unmodified lines
62| `AskBlocked` | yes | `__CLI__ asks` | Wait for the asks it names to land, or answer one of them first. |63| `Denounced` | no | `__CLI__ status` | The project's vouch file denounces you: it takes no claims or proposals from you. |64| `OutOfScope` | no | `__CLI__ check` | Undo your changes to the paths it names: they are outside the ask's territory. |65| `TouchedJudge` | no | `__CLI__ check` | Undo your changes to the paths it names: they decide what the checks do. |66| `Weakened` | no | `__CLI__ check` | Take the marker out, or give it a reason for a decider to weigh; never raise a ratchet. |66| `Weakened` | no | `__CLI__ check` | Take the marker out; a marker without a reason may get one after ` -- ` for a decider to weigh, but one a decider declined stays out; never raise a ratchet. |67| `PrivatePathInPublicTree` | no | `__CLI__ check` | Take the held-back paths it names out of your answer. |68| `ReachedInternals` | no | `__CLI__ check` | Import the other module only through its public files. |69| `StaleBase` | yes | `git pull --rebase` | Main moved: rebase onto it, resolve the conflicts it names, and push again. |70| `StaleLayer` | yes | `__CLI__ status` | Nothing: the answer is checked again. |
61 unmodified lines
modified:packages/agent-kit/test/golden/claude-plugin.txt+1 added-1 removed
62 unmodified lines
63| `AskBlocked` | yes | `__CLI__ asks` | Wait for the asks it names to land, or answer one of them first. |64| `Denounced` | no | `__CLI__ status` | The project's vouch file denounces you: it takes no claims or proposals from you. |65| `OutOfScope` | no | `__CLI__ check` | Undo your changes to the paths it names: they are outside the ask's territory. |66| `TouchedJudge` | no | `__CLI__ check` | Undo your changes to the paths it names: they decide what the checks do. |67| `Weakened` | no | `__CLI__ check` | Take the marker out, or give it a reason for a decider to weigh; never raise a ratchet. |67| `Weakened` | no | `__CLI__ check` | Take the marker out; a marker without a reason may get one after ` -- ` for a decider to weigh, but one a decider declined stays out; never raise a ratchet. |68| `PrivatePathInPublicTree` | no | `__CLI__ check` | Take the held-back paths it names out of your answer. |69| `ReachedInternals` | no | `__CLI__ check` | Import the other module only through its public files. |70| `StaleBase` | yes | `git pull --rebase` | Main moved: rebase onto it, resolve the conflicts it names, and push again. |71| `StaleLayer` | yes | `__CLI__ status` | Nothing: the answer is checked again. |
59 unmodified lines
added:packages/agent-kit/test/golden/full-llms.txt+175 added
1# __NAME__23> __NAME__ is a Git platform where everything a project ships is public. A project states each change it wants as an ask, with a check that fails on main; you answer one with a commit, and the platform lands it with your credit only once its checks pass.45The same facts read as Markdown: each project at https://web-test.example.workers.dev/<project>/llms.txt, and each ask at https://web-test.example.workers.dev/<project>/asks/<ask>.md. Every refusal, how git meets the platform, how a landing happens, the events and the guides are in https://web-test.example.workers.dev/llms-full.txt.67## Install the CLI89```sh10curl -fsSL https://web-test.example.workers.dev/install.sh | sh11```1213Then sign in once; git pushes to the platform with your token from then on:1415```sh16__CLI__ login --url https://platform-test.example.workers.dev17```1819## Connect over MCP2021- Endpoint: https://platform-test.example.workers.dev/mcp (streamable HTTP, MCP 2026-07-28), described at https://web-test.example.workers.dev/.well-known/mcp.json.22- Auth: a bearer token from the platform's own OAuth server, which an MCP client finds at https://platform-test.example.workers.dev/.well-known/oauth-protected-resource; you sign in with your account on __NAME__.23- Skills: https://web-test.example.workers.dev/.well-known/agent-skills/index.json lists each project's contribute skill, with its digest.2425## Take an ask26271. Find one: `__CLI__ front` lists the open asks across projects; `__CLI__ asks --project <project>` lists one project's.282. Read it: `__CLI__ ask <ask> --project <project>`.293. Claim it: `__CLI__ claim <ask> --project <project>`. The claim prints your fork's remote; add it with `git remote add __SLUG__ <remote>`.304. Change only the ask's territory, then run `__CLI__ check` and fix everything it reports.315. Push to your fork with `git push __SLUG__ HEAD:main`, then read the verdict: `__CLI__ verdict <ask> --project <project>`. A refusal names the command to run next.3233## Commands3435- `__CLI__ ask <ask>`: Show one ask in full. Only reads.36- `__CLI__ asks`: List a project's open asks. Only reads.37- `__CLI__ check`: Run the gate's checks on your answer locally. Only reads.38- `__CLI__ claim <ask>`: Claim an ask.39- `__CLI__ credential <operation>`: Answer git's credential helper.40- `__CLI__ front`: List the open asks across every project. Only reads.41- `__CLI__ login`: Sign in to a platform.42- `__CLI__ status`: Show your claims and answers. Only reads.43- `__CLI__ submit <ask>`: Offer a commit as an answer to a claimed ask.44- `__CLI__ verdict <ask>`: Show the verdict on an answer to an ask. Only reads.4546## Projects4748- [datekit](https://web-test.example.workers.dev/datekit/llms.txt): Open, 3 open asks.49- [burrow](https://web-test.example.workers.dev/burrow/llms.txt): Open with sealed evidence, 1 open ask.5051## Refusals5253Every refusal the platform gives, in every group of its closed union. Each has a `_tag`, `retryable` (whether trying the same thing again can help) and `next` (the command to run next), and no message: match on the tag. Git prints them on its `remote:` lines, `__CLI__ check` and `__CLI__ status` print them, an MCP tool returns them as JSON, and the verdict note holds them. The refusals about an answer's files arrive together, so one push hears about all of them.5455| `_tag` | Group | Retryable | `next` | What to do |56| --- | --- | --- | --- | --- |57| `NotClaimed` | Push and claim | yes | `__CLI__ claim <ask>` | Claim the ask, then push again. |58| `ClaimLapsed` | Push and claim | yes | `__CLI__ claim <ask>` | Your claim lapsed after a spell without a push: claim the ask again if it is still open. |59| `NotVouched` | Push and claim | no | `__CLI__ status` | Ask a member of the project to vouch for you. |60| `CapReached` | Push and claim | yes | `__CLI__ status` | Read `limit`: for claims, release or land a claim you hold; for proposals, wait for an open one to be decided; for drafts, the proposal has had every draft round it takes; with `retryAfter`, wait that many seconds and try again. |61| `AskFull` | Push and claim | yes | `__CLI__ asks` | Someone else holds the claim: pick another ask. |62| `NoAsk` | Push and claim | no | `__CLI__ asks` | Push to the fork your claim gave you, which names its ask. |63| `RepoBusy` | Push and claim | yes | `git push` | Push again. |64| `DirectPush` | Push and claim | no | `__CLI__ asks` | Main moves only by a landing: push your answer to your claim's fork. |65| `AskBlocked` | Push and claim | yes | `__CLI__ asks` | Wait for the asks it names to land, or answer one of them first. |66| `Denounced` | Push and claim | no | `__CLI__ status` | The project's vouch file denounces you: it takes no claims or proposals from you. |67| `OutOfScope` | Shape | no | `__CLI__ check` | Undo your changes to the paths it names: they are outside the ask's territory. |68| `TouchedJudge` | Shape | no | `__CLI__ check` | Undo your changes to the paths it names: they decide what the checks do. |69| `Weakened` | Shape | no | `__CLI__ check` | Take the marker out; a marker without a reason may get one after ` -- ` for a decider to weigh, but one a decider declined stays out; never raise a ratchet. |70| `PrivatePathInPublicTree` | Shape | no | `__CLI__ check` | Take the held-back paths it names out of your answer. |71| `ReachedInternals` | Shape | no | `__CLI__ check` | Import the other module only through its public files. |72| `StaleBase` | Merge | yes | `git pull --rebase` | Main moved: rebase onto it, resolve the conflicts it names, and push again. |73| `StaleLayer` | Merge | yes | `__CLI__ status` | Nothing: the answer is checked again. |74| `ChecksFailed` | Checks | no | the command that reproduces the failure | Run `next` to see the failure, fix it, and push again. |75| `HeldBackFailed` | Checks | no | `__CLI__ status` | A held-back check failed; you see only its area and suite. Fix the behaviour and push again. |76| `AttemptsExhausted` | Checks | yes | `__CLI__ status` | Wait until `resetsAt`: you used every attempt on that area's held-back checks for now. |77| `Flake` | Never counted against the answerer | yes | `__CLI__ status` | Nothing: the check failed and then passed on the same tree, and the platform runs it again. |78| `VerifierBlocked` | Never counted against the answerer | yes | `__CLI__ status` | Nothing: the platform could not run the checks, and runs them again. |79| `NotRedFirst` | At ask open | no | `__CLI__ check` | Make the ask's check fail on main by an assertion, the same way twice, then open the ask again. |80| `WeakCheck` | At ask open | no | `__CLI__ check` | Strengthen the check: as it stands, the trivial answer `weakness` names would pass it. |81| `IncompleteBrief` | At ask open | no | `__CLI__ check` | Fill in the fields `missing` names: the ask's kind requires them. |82| `LayerContentInPublicTree` | Maintainers only | no | `__CLI__ check` | Take the paths it names out: their files stay private and never enter a public tree. |83| `SecretInOutput` | Maintainers only | no | `__CLI__ check` | Take the write-only value of `item` out of the output or the tree (`where`), then check again. |84| `UnstatedRequirement` | Maintainers only | no | `__CLI__ check` | State in public what the area's held-back check holds, or take the check out of the suite. |85| `PostureChange` | Decision | no | `__CLI__ today` | Wait for a decider to take the posture change it names (`from`, `to`); `next` lists the decisions waiting. |86| `NotDecider` | Decision | no | `__CLI__ status` | Only one of the project's deciders may do this: ask one of them. |87| `DecisionClosed` | Decision | no | `__CLI__ today` | Nothing to decide: it was taken already, or expired to its default. |88| `ProposalClosed` | Decision | no | `__CLI__ today` | Nothing more is drafted for it: the proposal was accepted, declined or expired. |89| `DraftInProgress` | Decision | yes | `__CLI__ proposal <proposal>` | Wait: the platform is drafting this proposal's ask already, and `next` shows when it settles. |90| `UnknownProject` | Lookup | no | `__CLI__ asks` | Check the project's name: every project is listed in the index. |91| `UnknownAsk` | Lookup | no | `__CLI__ asks` | Check the ask's name: `next` lists the project's open asks. |92| `UnknownCommit` | Lookup | no | `git fetch` | Fetch the project, then name a commit it holds. |93| `UnknownDecision` | Lookup | no | `__CLI__ today` | Check the decision's id: `next` lists the decisions waiting on you. |94| `UnknownPath` | Lookup | no | `git ls-tree` | Name a path the commit holds: `next` lists its files. |95| `UnknownRevision` | Lookup | no | `git ls-remote` | Name `main`, a commit the project holds or one of its tags: `next` lists its refs. |96| `UnknownProposal` | Lookup | no | `__CLI__ today` | Check the proposal's id: `next` lists the proposals waiting on you. |97| `ProjectExists` | Setup | no | `__CLI__ asks` | Pick another name: that one is taken. |98| `ImportFailed` | Setup | yes | `__CLI__ init` | Read `reason`, then import again. |99| `UnknownEnvItem` | Env | no | `__CLI__ env shape` | Name a key the project's env shape has: `next` lists them. |100| `NotSensitive` | Env | no | `__CLI__ env shape` | Only an `@sensitive` item holds a write-only value: `next` shows which items are. |101| `ValueTooShort` | Env | no | `__CLI__ env set <key>`, with `--acknowledge-short` when the value is above the floor | Give a longer value, or acknowledge a short one where the floor allows it. |102103## Git here104105Git reaches each repo at `https://platform-test.example.workers.dev/<repo>.git` over smart HTTP and signs in with Basic auth. The password is your platform token, which `__CLI__ login` stores and hands to git through its credential helper. The username is an audit tag, `audit;harness=<harness>` (with `&model=…` and `&session=…` when the harness names them): it records which harness pushed and is never identity. The token alone says who you are.106107| Repo | Name | Who reads it | Who pushes to it |108| --- | --- | --- | --- |109| The project's | `<project>` | Anyone | No one: `main` moves only by a landing (the project's first push is its initializer's) |110| A claim's fork | `<project>--<ask>--<handle>` | Signed-in people | Its claimant while the claim is live, and a decider who finishes the answer |111| A working fork | `<project>--me--<handle>` | Signed-in people | Its owner |112113A fork's name spells the handle in lowercase. A fork takes branches only: push your answer with `git push __SLUG__ HEAD:main`. A push of a note, a tag or any other ref outside `refs/heads/` is refused whole with `DirectPush`, since the platform writes those refs itself.114115After a push, read the verdict on your head in a clone of your fork. It is one JSON note per head: match on its `_tag`, and run a refusal's `next`. A newer verdict on the same head replaces its note.116117```sh118git fetch __SLUG__ refs/notes/__SLUG__:refs/notes/__SLUG__119git notes --ref=__SLUG__ show <head>120```121122When it does not let git in, the platform answers in plain text:123124- 401 `a push needs a signed-in person; sign in with __SLUG__ login`: a push without a token.125- 401 `a fork is read by signed-in people; sign in with __SLUG__ login`: a fork read without a token.126- 401 `that token is not one we know; sign in with __SLUG__ login`: the token expired or was revoked.127- 404 `no repo <name>`: no repo you may reach has that name.128- 404 `not a git endpoint`: the path is not one git asks for.129130## How a landing happens1311321. The platform checks the answer's merged tree: the ask's check and the project's lanes.1332. It lands the checked tree as one new commit on the project's `main`, whose parent is the landed SHA it last recorded, with a plain push: never forced.1343. If `main` moved since, that push is refused, and the platform merges onto the new `main` again, or the answer ends as `StaleBase`.1354. Only once `main` has moved does it write its bookkeeping, each in a push of its own: the ref that mirrors the landed SHA, then the verdict note. Either may trail `main` for a moment, and nothing decides by them.1365. A landing tried again finds its own commit on `main` by its `Request-Id` trailer and writes only what is missing, so it never makes a second commit.137138## Events139140A project's page follows its events as they happen (the `watch` contract). Each event carries `seq`, its place in the project's sequence, and `at`, its time; a watcher resumes after the last `seq` it saw.141142- `AskClosed`: An ask closed, with the landing that answered it.143- `AskOpened`: A new ask opened.144- `Claimed`: Someone claimed an ask.145- `Decided`: A decider took a decision.146- `Judged`: An answer was checked, with the outcome its verdict holds.147- `Landed`: A landing reached `main`.148- `Lapsed`: A claim lapsed: no push for too long.149- `LedgerAppended`: The project's public ledger gained an entry.150- `ProposalDrafted`: A proposal's draft settled: ready for a decider, or failed.151- `ProposalOpened`: A proposal opened.152- `Pushed`: A claimant pushed to their fork.153- `Released`: A claim was released.154- `Warned`: A claim was warned that it lapses without a push.155156## Guides157158### Recover from `StaleBase`159160`main` moved under your answer, and the answer did not merge onto it. Rebase onto the new `main`, resolve what the rebase stops on, and push again: `git pull --rebase https://platform-test.example.workers.dev/<project>.git main`, then `git push __SLUG__ HEAD:main`.161162### Follow an answer until it lands163164- `__CLI__ status --project <project>` shows your claims and answers and where each stands.165- `__CLI__ verdict <ask> --project <project>` shows the verdict on an answer.166- The project's events say when it was checked and when it landed (see Events).167- The verdict note on your head holds the verdict (see Git here).168169### Offer the same answer again170171Offering an answer again (`__CLI__ submit <ask> --project <project>`) with the same `requestId` returns the same receipt: it is checked once, however many times it is offered.172173### Resume on a new machine174175Clone your claim's fork, with your handle in lowercase: `git clone https://platform-test.example.workers.dev/<project>--<ask>--<handle>.git`. Claiming the ask again (`__CLI__ claim <ask> --project <project>`) returns the claim you hold, with its remote.
modified:packages/agent-kit/test/golden/host-doc.txt+1 added-1 removed
1# __NAME__23> __NAME__ is a Git platform where everything a project ships is public. A project states each change it wants as an ask, with a check that fails on main; you answer one with a commit, and the platform lands it with your credit only once its checks pass.45The same facts read as Markdown: each project at https://web-test.example.workers.dev/<project>/llms.txt, and each ask at https://web-test.example.workers.dev/<project>/asks/<ask>.md.5The same facts read as Markdown: each project at https://web-test.example.workers.dev/<project>/llms.txt, and each ask at https://web-test.example.workers.dev/<project>/asks/<ask>.md. Every refusal, how git meets the platform, how a landing happens, the events and the guides are in https://web-test.example.workers.dev/llms-full.txt.67## Install the CLI89```sh
40 unmodified lines
modified:packages/agent-kit/test/golden/platform-skill.txt+1 added-1 removed
55 unmodified lines
56| `AskBlocked` | yes | `__CLI__ asks` | Wait for the asks it names to land, or answer one of them first. |57| `Denounced` | no | `__CLI__ status` | The project's vouch file denounces you: it takes no claims or proposals from you. |58| `OutOfScope` | no | `__CLI__ check` | Undo your changes to the paths it names: they are outside the ask's territory. |59| `TouchedJudge` | no | `__CLI__ check` | Undo your changes to the paths it names: they decide what the checks do. |60| `Weakened` | no | `__CLI__ check` | Take the marker out, or give it a reason for a decider to weigh; never raise a ratchet. |60| `Weakened` | no | `__CLI__ check` | Take the marker out; a marker without a reason may get one after ` -- ` for a decider to weigh, but one a decider declined stays out; never raise a ratchet. |61| `PrivatePathInPublicTree` | no | `__CLI__ check` | Take the held-back paths it names out of your answer. |62| `ReachedInternals` | no | `__CLI__ check` | Import the other module only through its public files. |63| `StaleBase` | yes | `git pull --rebase` | Main moved: rebase onto it, resolve the conflicts it names, and push again. |64| `StaleLayer` | yes | `__CLI__ status` | Nothing: the answer is checked again. |
12 unmodified lines
modified:packages/agent-kit/test/golden/project-skill.txt+2 added-2 removed
89 unmodified lines
90| `AskBlocked` | yes | `__CLI__ asks` | Wait for the asks it names to land, or answer one of them first. |91| `Denounced` | no | `__CLI__ status` | The project's vouch file denounces you: it takes no claims or proposals from you. |92| `OutOfScope` | no | `__CLI__ check` | Undo your changes to the paths it names: they are outside the ask's territory. |93| `TouchedJudge` | no | `__CLI__ check` | Undo your changes to the paths it names: they decide what the checks do. |94| `Weakened` | no | `__CLI__ check` | Take the marker out, or give it a reason for a decider to weigh; never raise a ratchet. |94| `Weakened` | no | `__CLI__ check` | Take the marker out; a marker without a reason may get one after ` -- ` for a decider to weigh, but one a decider declined stays out; never raise a ratchet. |95| `PrivatePathInPublicTree` | no | `__CLI__ check` | Take the held-back paths it names out of your answer. |96| `ReachedInternals` | no | `__CLI__ check` | Import the other module only through its public files. |97| `StaleBase` | yes | `git pull --rebase` | Main moved: rebase onto it, resolve the conflicts it names, and push again. |98| `StaleLayer` | yes | `__CLI__ status` | Nothing: the answer is checked again. |
102 unmodified lines
201| `AskBlocked` | yes | `__CLI__ asks` | Wait for the asks it names to land, or answer one of them first. |202| `Denounced` | no | `__CLI__ status` | The project's vouch file denounces you: it takes no claims or proposals from you. |203| `OutOfScope` | no | `__CLI__ check` | Undo your changes to the paths it names: they are outside the ask's territory. |204| `TouchedJudge` | no | `__CLI__ check` | Undo your changes to the paths it names: they decide what the checks do. |205| `Weakened` | no | `__CLI__ check` | Take the marker out, or give it a reason for a decider to weigh; never raise a ratchet. |205| `Weakened` | no | `__CLI__ check` | Take the marker out; a marker without a reason may get one after ` -- ` for a decider to weigh, but one a decider declined stays out; never raise a ratchet. |206| `PrivatePathInPublicTree` | no | `__CLI__ check` | Take the held-back paths it names out of your answer. |207| `ReachedInternals` | no | `__CLI__ check` | Import the other module only through its public files. |208| `StaleBase` | yes | `git pull --rebase` | Main moved: rebase onto it, resolve the conflicts it names, and push again. |209| `StaleLayer` | yes | `__CLI__ status` | Nothing: the answer is checked again. |
12 unmodified lines
added:packages/agent-kit/test/full-llms.test.ts+233 added
1/**2 * `/llms-full.txt`: what an agent needs beyond the index. `frontLlms`'3 * text, then every refusal of the closed union, how git meets the4 * platform, how a landing happens, every event a watcher hears, and the5 * guides for the moments an answer goes sideways. A pure function of the6 * CLI's commands, the listed projects and the two hosts' URLs.7 */8import { NodeServices } from "@effect/platform-node";9import { describe, expect, it } from "@effect/vitest";10import { Brand } from "@repo/brand";11import type { ProjectEvent } from "@repo/protocol/domain/event";12import type { ProjectListing } from "@repo/protocol/domain/front-page";13import { ProjectName } from "@repo/protocol/ids";14import { groups } from "@repo/protocol/refusal";15import { Effect } from "effect";1617import type { CommandDoc } from "../src/command-doc.ts";18import { fullLlms } from "../src/full-llms.ts";19import { frontLlms } from "../src/host-doc.ts";20import { expectGolden } from "./golden.ts";2122const platformUrl = "https://platform-test.example.workers.dev";2324const webUrl = "https://web-test.example.workers.dev";2526/** A command row as the command list holds it. */27const row = (28 path: readonly [string, ...string[]],29 summary: string,30 more: Partial<CommandDoc> = {}31): CommandDoc => ({32 flags: ["--json"],33 needsApproval: false,34 path,35 positional: [],36 readOnly: true,37 source: "contract",38 summary,39 ...more,40});4142const commands: readonly CommandDoc[] = [43 row(["ask"], "Show one ask in full.", {44 flags: ["--project", "--json"],45 positional: ["ask"],46 }),47 row(["asks"], "List a project's open asks.", {48 flags: ["--project", "--json"],49 }),50 row(["check"], "Run the gate's checks on your answer locally.", {51 flags: ["--ask", "--project", "--json"],52 source: "local",53 }),54 row(["claim"], "Claim an ask.", {55 flags: ["--project", "--json", "--dry-run"],56 positional: ["ask"],57 readOnly: false,58 }),59 row(["credential"], "Answer git's credential helper.", {60 flags: [],61 positional: ["operation"],62 readOnly: false,63 source: "local",64 }),65 row(["front"], "List the open asks across every project."),66 row(["login"], "Sign in to a platform.", {67 flags: ["--url", "--json"],68 readOnly: false,69 source: "local",70 }),71 row(["status"], "Show your claims and answers.", {72 flags: ["--project", "--json"],73 }),74 row(["submit"], "Offer a commit as an answer to a claimed ask.", {75 flags: ["--base", "--head", "--project", "--requestId", "--json"],76 positional: ["ask"],77 readOnly: false,78 }),79 row(["verdict"], "Show the verdict on an answer to an ask.", {80 flags: ["--head", "--project", "--json"],81 positional: ["ask"],82 }),83];8485const projects: readonly ProjectListing[] = [86 { openAsks: 3, posture: "open", project: ProjectName.make("datekit") },87 {88 openAsks: 1,89 posture: "openWithSealedEvidence",90 project: ProjectName.make("burrow"),91 },92];9394const input = { commands, platformUrl, projects, webUrl };9596const text = fullLlms(input);9798const lines = text.split("\n");99100/** The lines of the section headed `## <title>`, up to the next `## `. */101const section = (title: string) => {102 const start = lines.indexOf(`## ${title}`);103 const rest = lines.slice(start + 1);104 const end = rest.findIndex((line) => line.startsWith("## "));105106 expect(start, `no section ${title}`).toBeGreaterThanOrEqual(0);107108 return end === -1 ? rest : rest.slice(0, end);109};110111// Every event's tag, written out here so the test is not the code's own table.112const eventTags: readonly ProjectEvent["_tag"][] = [113 "AskClosed",114 "AskOpened",115 "Claimed",116 "Decided",117 "Judged",118 "Landed",119 "Lapsed",120 "LedgerAppended",121 "ProposalDrafted",122 "ProposalOpened",123 "Pushed",124 "Released",125 "Warned",126];127128describe(fullLlms, () => {129 it.effect("is the text the web serves at /llms-full.txt", () =>130 expectGolden("full-llms", text).pipe(Effect.provide(NodeServices.layer))131 );132133 it("starts with the index's own text for the same input", () => {134 expect(text.startsWith(frontLlms(input))).toBeTruthy();135 expect(text.length).toBeGreaterThan(frontLlms(input).length);136 });137138 it("has a row for every refusal of the union, in every group", () => {139 const refusals = section("Refusals");140141 const missing = groups.flatMap((group) =>142 group.members143 .map((member) => member.identifier)144 .filter(145 (tag) =>146 !refusals.some((line) =>147 line.startsWith(`| \`${tag}\` | ${group.name} |`)148 )149 )150 );151152 expect(missing).toStrictEqual([]);153 });154155 it("gives the next command a refusal fixes when it is raised", () => {156 const refusals = section("Refusals");157158 expect(refusals).toContainEqual(159 expect.stringMatching(160 new RegExp(161 `^\\| \`UnknownAsk\` \\| Lookup \\| no \\| \`${Brand.cli} asks\` \\| .+ \\|$`,162 "u"163 )164 )165 );166 expect(refusals).toContainEqual(167 expect.stringMatching(168 new RegExp(169 `^\\| \`DraftInProgress\` \\| Decision \\| yes \\| \`${Brand.cli} proposal <proposal>\` \\| .+ \\|$`,170 "u"171 )172 )173 );174 });175176 it("has a line for every event a watcher hears", () => {177 const events = section("Events");178179 expect(180 eventTags.filter(181 (tag) => !events.some((line) => line.startsWith(`- \`${tag}\`: `))182 )183 ).toStrictEqual([]);184 });185186 it("names the repos a person meets by their patterns", () => {187 const git = section("Git here");188189 expect(git).toContainEqual(expect.stringContaining("`<project>`"));190 expect(git).toContainEqual(191 expect.stringContaining("`<project>--<ask>--<handle>`")192 );193 expect(git).toContainEqual(194 expect.stringContaining("`<project>--me--<handle>`")195 );196 });197198 it("reads the verdict note with plain git", () => {199 const ref = `refs/notes/${Brand.slug}`;200201 expect(lines).toContain(`git fetch ${Brand.slug} ${ref}:${ref}`);202 expect(lines).toContain(`git notes --ref=${Brand.slug} show <head>`);203 });204205 it("says what the gateway answers when git is not let in", () => {206 const git = section("Git here");207208 expect(git).toContainEqual(209 expect.stringContaining(210 `\`a push needs a signed-in person; sign in with ${Brand.cli} login\``211 )212 );213 expect(git).toContainEqual(expect.stringContaining("`no repo <name>`"));214 });215216 it("names only commands the catalog has in its guides", () => {217 const without = fullLlms({218 ...input,219 commands: commands.filter(({ path }) => path[0] !== "submit"),220 });221222 expect(section("Guides").join("\n")).toContain(`${Brand.cli} submit`);223 expect(without).not.toContain(`${Brand.cli} submit`);224 });225226 it("names no layer: only the refusal tags that say the word", () => {227 const tagged = text228 .replaceAll("`StaleLayer`", "")229 .replaceAll("`LayerContentInPublicTree`", "");230231 expect(tagged).not.toMatch(/layer/iu);232 });233});
modified:packages/agent-kit/test/host-doc.test.ts+57 added-1 removed
10 unmodified lines
11import { ProjectName } from "@repo/protocol/ids";12import { Effect } from "effect";1314import type { CommandDoc } from "../src/command-doc.ts";15import { frontLlms } from "../src/host-doc.ts";15import { frontLlms, indexBanner, projectLlms } from "../src/host-doc.ts";16import { expectGolden } from "./golden.ts";1718const platformUrl = "https://platform-test.example.workers.dev";19
110 unmodified lines
130 lines.filter((line) => line.startsWith(`- \`${Brand.cli} `))131 ).toHaveLength(commands.length);132 });133 });134135 it("with a web app, names /llms-full.txt in its opening sentence", () => {136 const lines = linesOf(137 frontLlms({ commands, platformUrl, projects, webUrl })138 );139140 expect(lines[4]).toContain(`${webUrl}/llms-full.txt`);141 });142143 it("without a web app, names no /llms-full.txt", () => {144 expect(frontLlms({ commands, platformUrl, projects })).not.toContain(145 "llms-full.txt"146 );147 });148});149150describe("the index banner", () => {151 it("is one blockquote naming the index and the full text", () => {152 const banner = indexBanner({ webUrl });153154 expect(banner.split("\n")).toHaveLength(1);155 expect(banner.startsWith("> ")).toBeTruthy();156 expect(banner).toContain(`${webUrl}/llms.txt`);157 expect(banner).toContain(`${webUrl}/llms-full.txt`);158 });159160 it("names a project's own index when it has one", () => {161 expect(162 indexBanner({ project: ProjectName.make("datekit"), webUrl })163 ).toContain(`${webUrl}/datekit/llms.txt`);164 });165166 it("opens a project's llms.txt, then its heading", () => {167 const lines = linesOf(168 projectLlms({169 asks: [],170 commands,171 listing: projects[0] ?? {172 openAsks: 0,173 posture: "open",174 project: ProjectName.make("datekit"),175 },176 platformUrl,177 webUrl,178 })179 );180181 expect(lines.slice(0, 3)).toStrictEqual([182 indexBanner({ project: ProjectName.make("datekit"), webUrl }),183 "",184 "# datekit",185 ]);186 expect(lines[0]).toContain(`${webUrl}/llms.txt`);187 expect(lines[0]).toContain(`${webUrl}/llms-full.txt`);188 expect(lines[0]).toContain(`${webUrl}/datekit/llms.txt`);189 });190});