llms-sections.ts
This file
Path
packages/agent-kit/src/llms-sections.ts
128 lines · 6.2 KiB · TypeScript
Last changed by
Merge redesign into mainoscabrielbefore adoptioncaedd21
History of this fileTake it
Merge build/1313-docs into mainoscabrielbefore adoption9000f4e
line 1why, one step back1import { Brand } from "@repo/brand";Merge redesign into mainoscabrielbefore adoptioncaedd21
line 2why, one step back2import { RecentLandingsOf, Surfaces } from "@repo/protocol/contracts";Merge build/1313-docs into mainoscabrielbefore adoption9000f4e
line 3why, one step back3import type { ProjectEvent } from "@repo/protocol/domain/event";Merge redesign into mainoscabrielbefore adoptioncaedd21
lines 4–5why, one step back4import { RECENT_LANDINGS_CAP } from "@repo/protocol/domain/recent-landing";5import { Context } from "effect";Merge build/1313-docs into mainoscabrielbefore adoption9000f4e
line 6why, one step back6Merge redesign into mainoscabrielbefore adoptioncaedd21
line 7why, one step back7import { pushCommand } from "./install.ts";Merge build/1313-docs into mainoscabrielbefore adoption9000f4e
lines 8–14why, one step back8import { refusalCatalog } from "./refusals.ts";9import { code, table } from "./text.ts";1011const cli = (...words: readonly string[]) => [Brand.cli, ...words].join(" ");1213const notesRef = `refs/notes/${Brand.slug}`;14Merge redesign into mainoscabrielbefore adoptioncaedd21
line 15why, one step back15export const pushAnswer = () => code(pushCommand);Merge build/1313-docs into mainoscabrielbefore adoption9000f4e
lines 16–47why, one step back1617const signIn = (reason: string) => `${reason}; sign in with ${cli("login")}`;1819export const refusals = () => [20 "## Refusals",21 "",22 `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.`,23 "",24 ...table(25 ["`_tag`", "Group", "Retryable", "Exit code", "`next`", "What to do"],26 refusalCatalog().map(({ exitCode, group, next, retryable, tag, todo }) => [27 code(tag),28 group,29 retryable ? "yes" : "no",30 String(exitCode),31 next,32 todo,33 ])34 ),35 "",36];3738export const gitHere = (platformUrl: string) => [39 "## Git here",40 "",41 `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.`,42 "",43 ...table(44 ["Repo", "Name", "Who reads it", "Who pushes to it"],45 [46 [47 "The project's",Merge build/1413-docs-and-texts into mainoscabrielbefore adoptionf10338e
line 48why, one step back48 code("<owner>/<name>"),Merge build/1313-docs into mainoscabrielbefore adoption9000f4e
lines 49–53why, one step back49 "Anyone",50 "No one: `main` moves only by a landing (the project's first push is its initializer's)",51 ],52 [53 "A claim's fork",Merge build/1413-docs-and-texts into mainoscabrielbefore adoptionf10338e
line 54why, one step back54 code("<owner>/<name>--<ask>--<handle>"),Merge build/1313-docs into mainoscabrielbefore adoption9000f4e
line 55why, one step back55 "Signed-in people",Merge build/maintainer-wording into mainoscabrielbefore adoption4c1a571
line 56why, one step back56 "Its claimant while the claim is live, and a maintainer who finishes the answer",Merge build/1313-docs into mainoscabrielbefore adoption9000f4e
lines 57–59why, one step back57 ],58 [59 "A working fork",Merge build/1413-docs-and-texts into mainoscabrielbefore adoptionf10338e
line 60why, one step back60 code("<owner>/<name>--me--<handle>"),Merge build/1313-docs into mainoscabrielbefore adoption9000f4e
lines 61–80why, one step back61 "Signed-in people",62 "Its owner",63 ],64 ]65 ),66 "",67 `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.`,68 "",69 "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.",70 "",71 "```sh",72 `git fetch ${Brand.slug} ${notesRef}:${notesRef}`,73 `git notes --ref=${Brand.slug} show <head>`,74 "```",75 "",76 "When it does not let git in, the platform answers in plain text:",77 "",78 `- 401 ${code(signIn("a push needs a signed-in person"))}: a push without a token.`,79 `- 401 ${code(signIn("a fork is read by signed-in people"))}: a fork read without a token.`,80 `- 401 ${code(signIn("that token is not one we know"))}: the token expired or was revoked.`,Merge build/1413-docs-and-texts into mainoscabrielbefore adoptionf10338e
line 81why, one step back81 `- 404 ${code("no repo <repo>")}: no repo you may reach has that name.`,Merge build/1313-docs into mainoscabrielbefore adoption9000f4e
lines 82–94why, one step back82 `- 404 ${code("not a git endpoint")}: the path is not one git asks for.`,83 "",84];8586export const landing = () => [87 "## How a landing happens",88 "",89 "1. The platform checks the answer's merged tree: the ask's check and the project's lanes.",90 "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.",91 "3. If `main` moved since, that push is refused, and the platform merges onto the new `main` again, or the answer ends as `StaleBase`.",92 "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.",93 "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.",94 "",Merge redesign into mainoscabrielbefore adoptioncaedd21
lines 95–100why, one step back95 ...(Context.get(RecentLandingsOf.annotations, Surfaces).includes("mcp")96 ? [97 `Across every project, the MCP tool ${code(RecentLandingsOf._tag)} lists the latest landings and the answers the gate refused, the latest first and at most ${RECENT_LANDINGS_CAP}: when, the project, the ask and its want, and of each refusal its tag and its area, never a held-back check's name.`,98 "",99 ]100 : []),Merge build/1313-docs into mainoscabrielbefore adoption9000f4e
lines 101–106why, one step back101];102103const eventLines = {104 AskClosed: "An ask closed, with the landing that answered it.",105 AskOpened: "A new ask opened.",106 Claimed: "Someone claimed an ask.",Merge build/maintainer-wording into mainoscabrielbefore adoption4c1a571
line 107why, one step back107 Decided: "A maintainer took a decision.",Merge build/1313-docs into mainoscabrielbefore adoption9000f4e
line 108why, one step back108 Judged: "An answer was checked, with the outcome its verdict holds.",Merge build/1316-adoption-heard into mainoscabrielbefore adoption2f3d065
lines 109–110why, one step back109 Landed:110 "A landing reached `main`, a project's adoption (its first push or its import) among them.",Merge build/1313-docs into mainoscabrielbefore adoption9000f4e
lines 111–113why, one step back111 Lapsed: "A claim lapsed: no push for too long.",112 LedgerAppended: "The project's public ledger gained an entry.",113 ProposalDrafted:Merge build/maintainer-wording into mainoscabrielbefore adoption4c1a571
line 114why, one step back114 "A proposal's draft settled: ready for a maintainer, or failed.",Merge build/1313-docs into mainoscabrielbefore adoption9000f4e
lines 115–128why, one step back115 ProposalOpened: "A proposal opened.",116 Pushed: "A claimant pushed to their fork.",117 Released: "A claim was released.",118 Warned: "A claim was warned that it lapses without a push.",119} as const satisfies Record<ProjectEvent["_tag"], string>;120121export const events = () => [122 "## Events",123 "",124 "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.",125 "",126 ...Object.entries(eventLines).map(([tag, line]) => `- ${code(tag)}: ${line}`),127 "",128];