Skip to content
Myr

Merge project/discussions into main

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

Conflicts: the budget removal and discussions both took migration 3 and the deciders' and rows' budget lines. The budget stays gone, drop_budget_days stays 3 (it is on prod) and discussions becomes 4. The proposal field kept both its description and the discussion field; the discussion fields now say what they take. The dev seed moved the refused round and the stray push after the discussions it added, and the Today pins count its third open proposal.

authored by oscabriel · committed by oscabriel · parents 7bbe189, 7f85b26 · Browse files · 73 files+2302 added−39 removed
This commit

State

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

Diff stats

73 files+2302 added−39 removed

  • tests:+984 added−16 removed
  • other:+1318 added−23 removed

73 files+2302 added−39 removed

modified:apps/cli/src/render.ts+77 added
6 unmodified lines
7 Finish,8 FrontPage,9 LedgerOf,10 ListAsks,11 ListDiscussions,12 ListProjects,13 PolicyOf,14 PostDiscussion,15 ShowAsk,16 ShowDiscussion,17 Status,18 SubmitAnswer,19 TodayOf,20 VerdictOf,
3 unmodified lines
24import { LandReceipt } from "@repo/protocol/domain/answer";25import type { AnswerReceipt } from "@repo/protocol/domain/answer";26import type { ClaimView } from "@repo/protocol/domain/claim";27import { DecisionSubject } from "@repo/protocol/domain/decision";28import type { Discussion } from "@repo/protocol/domain/discussion";29import { Outcome } from "@repo/protocol/domain/outcome";30import type {31 ImportSource,32 PolicyPending,
169 unmodified lines
202);203204const ask = viewOf(ShowAsk.successSchema, ({ brief }) => prose(brief));205206const discussionStates = {207 closed: "closed",208 open: "open",209 proposed: "became a proposal",210} as const satisfies Record<Discussion["state"], string>;211212const discussions = viewOf(213 ListDiscussions.successSchema,214 ({ discussions: listed }) =>215 joined(216 table(217 ["discussion", "title", "opener", "posts", "last post", "state"],218 listed.map(219 ({ id, lastPostAt, opener, posts, proposal, state, title }) => [220 id,221 title,222 opener,223 String(posts),224 when(lastPostAt),225 proposal === undefined226 ? discussionStates[state]227 : `${discussionStates[state]} ${proposal}`,228 ]229 ),230 "No discussions yet."231 ),232 prose(233 `Read one with \`${Brand.cli} discussion <discussion>\`; open one with \`${Brand.cli} discussion post --title "<title>" --body "<post>"\`.`234 )235 )236);237238const onward = (discussion: Discussion) => {239 if (discussion.state === "open") {240 return `Reply with \`${Brand.cli} discussion post ${discussion.id} --body "<post>"\`.`;241 }242243 return discussion.proposal === undefined244 ? "This discussion is closed."245 : `This discussion became ${discussion.proposal}: read it with \`${Brand.cli} proposal ${discussion.proposal}\`.`;246};247248const thread = (discussion: Discussion): View =>249 joined(250 prose(`# ${discussion.title}`),251 fields([252 ["Discussion", discussion.id],253 ["Opened by", `${discussion.opener} at ${when(discussion.openedAt)}`],254 [255 "State",256 discussion.proposal === undefined257 ? discussionStates[discussion.state]258 : `${discussionStates[discussion.state]} ${discussion.proposal}`,259 ],260 ]),261 ...discussion.posts.map(({ at, body, by }) =>262 prose(`**${by}** at ${when(at)}\n\n${body}`)263 ),264 prose(onward(discussion))265 );266267const discussion = viewOf(268 ShowDiscussion.successSchema,269 ({ discussion: shown }) => thread(shown)270);271272const posted = viewOf(PostDiscussion.successSchema, ({ discussion: shown }) =>273 thread(shown)274);275276/** Where the receipt is read: in a clone of the project or not, and what the fork's remote may be called. */277export interface Place {278 readonly inClone: boolean;279 readonly remoteName: string;
373 unmodified lines
653 finish: finished,654 frontPage: front,655 ledger,656 listAsks: asks,657 listDiscussions: discussions,658 listProjects: projects,659 postDiscussion: posted,660 projectPolicy: policy,661 showAsk: ask,662 showDiscussion: discussion,663 status,664 submitAnswer: submitted,665 today,666 verdict,
9 unmodified lines
modified:apps/platform/src/adapters/do-projects.ts+5 added
modified:apps/platform/src/adapters/rate-limits.ts+7 added-1 removed
7 unmodified lines
89export interface Limits {10 readonly claim: number;11 readonly draft: number;12 readonly post: number;13 readonly proposal: number;14}1516// Mirrors each binding's `simple.limit` in wrangler.jsonc: a binding can't say its own limit.17export const WorkerCaps = {18 claim: 10,19 draft: 2,20 post: 5,21 proposal: 5,22} as const satisfies Limits;2324const LIMIT_OF = {25 claim: "claims",26 draft: "drafts",27 post: "discussions",28 proposal: "proposals",29} as const satisfies Record<Limited, CapReached["limit"]>;3031// A binding can't say when its window resets, so the whole 60 s period is the honest upper bound.
16 unmodified lines
48 RateLimits,49 RateLimits.of({50 check: (kind, handle) =>51 Effect.tryPromise(() =>49 bindings[kind].limit({ key: handle.toLowerCase() })52 // A post is counted by the proposal binding, under its own cap.53 bindings[kind === "post" ? "proposal" : kind].limit({54 key: handle.toLowerCase(),55 })56 ).pipe(57 Effect.orDie,58 Effect.flatMap(({ success }) =>59 success ? Effect.void : Effect.fail(capped(WorkerCaps, kind))
32 unmodified lines
modified:apps/platform/src/handlers.ts+16 added
259 unmodified lines
260 listAsks: ({ project }) =>261 Effect.flatMap(caller, (who) =>262 on(project, (api) => api.listAsks(who))263 ),264 listDiscussions: ({ project }) =>265 Effect.flatMap(caller, (who) =>266 on(project, (api) => api.listDiscussions(who))267 ),268 listPaths: ({ at, project }) =>269 code(project, (of) => pathsOf(of, Option.fromUndefinedOr(at))),270 listProjects: () =>271 frontPage.projects().pipe(
21 unmodified lines
293 openAsk: ({ project, ...input }) =>294 Effect.flatMap(person, (who) =>295 on(project, (api) => api.openAsk(who, input))296 ),297 postDiscussion: ({ project, ...input }) =>298 Effect.gen(function* () {299 const who = yield* person;300301 yield* rateLimits.check("post", who.handle);302303 return yield* on(project, (api) => api.postDiscussion(who, input));304 }),305 projectPolicy: ({ project }) => on(project, (api) => api.policy()),306 proposeAsk: ({ project, ...input }) =>307 Effect.gen(function* () {308 const who = yield* person;
29 unmodified lines
338 on(project, (api) => api.showAsk(who, ask))339 ),340 showCommit: ({ at, project, sha }) =>341 code(project, (of) => commitOf(of, sha, Option.fromUndefinedOr(at))),342 showDiscussion: ({ discussion, project }) =>343 Effect.flatMap(caller, (who) =>344 on(project, (api) => api.showDiscussion(who, discussion))345 ),346 showProposal: ({ project, proposal }) =>347 Effect.flatMap(caller, (who) =>348 on(project, (api) => api.showProposal(who, proposal))349 ),
60 unmodified lines
modified:apps/platform/src/project-calls.ts+3 added
88 unmodified lines
89 layerAccess: callOf(MethodSchemas.layerAccess),90 layerFacts: callOf(MethodSchemas.layerFacts),91 ledger: callOf(MethodSchemas.ledger),92 listAsks: callOf(MethodSchemas.listAsks),93 listDiscussions: callOf(MethodSchemas.listDiscussions),94 onAlarm: callOf(MethodSchemas.onAlarm),95 openAsk: callOf(MethodSchemas.openAsk),96 policy: callOf(MethodSchemas.policy),97 postDiscussion: callOf(MethodSchemas.postDiscussion),98 proposeAsk: callOf(MethodSchemas.proposeAsk),99 recordAdmission: callOf(MethodSchemas.recordAdmission),100 recordFirstPush: callOf(MethodSchemas.recordFirstPush),101 recordHeldBack: callOf(MethodSchemas.recordHeldBack),
4 unmodified lines
106 release: callOf(MethodSchemas.release),107 scanForValues: callOf(MethodSchemas.scanForValues),108 setEnv: callOf(MethodSchemas.setEnv),109 showAsk: callOf(MethodSchemas.showAsk),110 showDiscussion: callOf(MethodSchemas.showDiscussion),111 showProposal: callOf(MethodSchemas.showProposal),112 standing: callOf(MethodSchemas.standing),113 status: callOf(MethodSchemas.status),114 submitAnswer: callOf(MethodSchemas.submitAnswer),
59 unmodified lines
modified:apps/platform/src/rate-limits.ts+2 added-1 removed
1 unmodified line
2import type { CapReached } from "@repo/protocol/refusal";3import { Context } from "effect";4import type { Effect } from "effect";56/** A post shares the proposal binding's window: both are words put to a project's maintainers. */6export type Limited = "claim" | "proposal" | "draft";7export type Limited = "claim" | "proposal" | "draft" | "post";89export class RateLimits extends Context.Service<10 RateLimits,11 {
6 unmodified lines
modified:apps/platform/test/do-projects.test.ts+10 added
8 unmodified lines
9import { ProjectsMemory } from "@repo/project/projects/memory";10import {11 CommitSha,12 DecisionId,13 DiscussionId,14 EnvKey,15 keyOf,16 LandedSha,17 LayerName,
124 unmodified lines
142 layerAccess: settled("layerAccess", api.layerAccess(alice, layer)),143 layerFacts: settled("layerFacts", api.layerFacts(bob)),144 ledger: settled("ledger", api.ledger(anyone)),145 listAsks: settled("listAsks", api.listAsks(anyone)),146 listDiscussions: settled("listDiscussions", api.listDiscussions(anyone)),147 onAlarm: settled("onAlarm", api.onAlarm()),148 openAsk: settled(149 "openAsk",150 api.openAsk(bob, { ask: parseIso, files: askFiles() })151 ),152 policy: settled("policy", api.policy()),153 postDiscussion: settled(154 "postDiscussion",155 api.postDiscussion(carol, { title: "Which day starts a week?" })156 ),157 proposeAsk: settled(158 "proposeAsk",159 api.proposeAsk(carol, { want: "Parse ISO week dates." })160 ),
38 unmodified lines
199 value: Redacted.make("a-value-long-enough-0123"),200 })201 ),202 showAsk: settled("showAsk", api.showAsk(anyone, parseIso)),203 showDiscussion: settled(204 "showDiscussion",205 api.showDiscussion(anyone, DiscussionId.make("disc-000001"))206 ),207 showProposal: settled(208 "showProposal",209 api.showProposal(anyone, ProposalId.make("prop-000001"))210 ),
158 unmodified lines
modified:apps/platform/test/handlers.fixtures.ts+2 added
116 unmodified lines
117 readonly frontPage?: FrontPageSeed;118 readonly limits?: {119 readonly claim: number;120 readonly draft?: number;121 readonly post?: number;122 readonly proposal: number;123 };124}125
17 unmodified lines
143 FrontPageMemory.layer(options.frontPage ?? noFrontPage),144 MemoryRateLimits({145 claim: options.limits?.claim ?? 100,146 draft: options.limits?.draft ?? 100,147 post: options.limits?.post ?? 100,148 proposal: options.limits?.proposal ?? 100,149 }),150 EvidenceStoreMemory151 ).pipe(Layer.provideMerge(RepoHostMemory));
30 unmodified lines
modified:apps/platform/test/handlers.test.ts+155 added-1 removed
9 unmodified lines
10import type { Proposal } from "@repo/protocol/domain/proposal";11import {12 AskId,13 CommitSha,14 DiscussionId,15 EnvKey,16 Handle,17 KindName,18 ProjectName,
8 unmodified lines
27} from "@repo/protocol/principal";28import {29 AskFull,30 CapReached,31 Denounced,32 DiscussionClosed,33 NotClaimed,34 NotDecider,35 UnknownEnvItem,36 ProjectExists,
23 unmodified lines
60import type { WorldOptions } from "./handlers.fixtures.ts";6162const people = ["bob", "carol"];6364// spam is denounced in datekit's vouch file; the others are vouched for.65const datekit = aProject({ people }).pipe(62 withVouches(people),66 withVouches(people, ["spam"]),67 withAsk({ id: "parse-iso", territory: "packages/parser" }),68 withAsk({ id: "trim-input", territory: "packages/trim" })69);70
274 unmodified lines
345 }).pipe(Effect.provide(platform({ limits: { claim: 5, proposal: 1 } })))346 );347});348349describe("discussions", () => {350 it.effect(351 "take a thread and a reply from anyone not denounced, list and show them, and refuse the denounced",352 () =>353 Effect.gen(function* () {354 yield* made;355356 const bob = yield* as("bob");357 const carol = yield* as("carol");358 const spam = yield* as("spam");359360 const { discussion } = yield* bob.postDiscussion({361 body: "Weeks start on Monday in ISO 8601; which does parseISO assume?",362 project: datekit.project,363 title: "Which day starts a week?",364 });365366 yield* advanceTo("2026-10-07T12:05:00Z");367368 const replied = yield* carol.postDiscussion({369 body: "ISO, always.",370 discussion: discussion.id,371 project: datekit.project,372 });373374 const refused = yield* Effect.all({375 spamOpens: Effect.flip(376 spam.postDiscussion({377 project: datekit.project,378 title: "Buy dates",379 })380 ),381 spamReplies: Effect.flip(382 spam.postDiscussion({383 body: "Buy dates",384 discussion: discussion.id,385 project: datekit.project,386 })387 ),388 });389390 const threads = yield* bob.listDiscussions({391 project: datekit.project,392 });393394 const shown = yield* carol.showDiscussion({395 discussion: discussion.id,396 project: datekit.project,397 });398399 expect(discussion).toMatchObject({400 id: "disc-000001",401 opener: "bob",402 state: "open",403 });404 expect(replied.discussion.posts.map(({ by }) => by)).toStrictEqual([405 "bob",406 "carol",407 ]);408 expect(refused).toStrictEqual({409 spamOpens: new Denounced({}),410 spamReplies: new Denounced({}),411 });412 expect(413 threads.discussions.map(({ id, posts, state }) => [id, posts, state])414 ).toStrictEqual([["disc-000001", 2, "open"]]);415 expect(shown.discussion).toStrictEqual(replied.discussion);416 }).pipe(Effect.provide(platform()))417 );418419 it.effect(420 "become a proposal by a maintainer alone, and then take no more posts",421 () =>422 Effect.gen(function* () {423 yield* made;424425 const alice = yield* as("alice");426 const bob = yield* as("bob");427428 const { discussion } = yield* bob.postDiscussion({429 project: datekit.project,430 title: "Parse ISO week dates?",431 });432433 const bobProposes = yield* Effect.flip(434 bob.proposeAsk({435 discussion: discussion.id,436 project: datekit.project,437 want: "Parse ISO week dates.",438 })439 );440441 const { proposal } = yield* alice.proposeAsk({442 discussion: discussion.id,443 project: datekit.project,444 want: "Parse ISO week dates.",445 });446447 const after = yield* bob.showDiscussion({448 discussion: discussion.id,449 project: datekit.project,450 });451452 const reply = yield* Effect.flip(453 bob.postDiscussion({454 body: "Please",455 discussion: discussion.id,456 project: datekit.project,457 })458 );459460 expect(bobProposes).toStrictEqual(new NotDecider({}));461 expect(after.discussion).toMatchObject({462 proposal: proposal.id,463 state: "proposed",464 });465 expect(reply).toStrictEqual(466 new DiscussionClosed({ discussion: discussion.id })467 );468 }).pipe(Effect.provide(platform()))469 );470471 it.effect("are rate-limited per person, as posts", () =>472 Effect.gen(function* () {473 yield* made;474475 const bob = yield* as("bob");476 const carol = yield* as("carol");477478 yield* bob.postDiscussion({ project: datekit.project, title: "One" });479480 const second = yield* Effect.flip(481 bob.postDiscussion({ project: datekit.project, title: "Two" })482 );483484 const carols = yield* carol.postDiscussion({485 project: datekit.project,486 title: "Carol's",487 });488489 expect(second).toStrictEqual(490 new CapReached({ cap: 1, limit: "discussions", retryAfter: 60 })491 );492 expect(carols.discussion.id).toBe(DiscussionId.make("disc-000002"));493 }).pipe(494 Effect.provide(platform({ limits: { claim: 5, post: 1, proposal: 5 } }))495 )496 );497});498499describe("calls that name no project", () => {500 it.effect(501 "show the caller's claims in every project the projection lists",502 () =>
576 unmodified lines
modified:apps/platform/test/mcp.test.ts+22 added
11 unmodified lines
12import {13 AskId,14 CommitSha,15 DecisionId,16 DiscussionId,17 Handle,18 LaneName,19 ProjectName,20 ProposalId,
8 unmodified lines
29 ProjectExists,30 UnknownAsk,31 UnknownCommit,32 UnknownDecision,33 UnknownDiscussion,34 UnknownPath,35 UnknownProject,36 UnknownRevision,37} from "@repo/protocol/refusal";
378 unmodified lines
416 listAsks: {417 args: { project: nowhere },418 refusal: new UnknownProject({ project: nowhere }),419 },420 listDiscussions: {421 args: { project: nowhere },422 refusal: new UnknownProject({ project: nowhere }),423 },424 listRefs: {425 args: { project: nowhere },426 refusal: new UnknownProject({ project: nowhere }),427 },
4 unmodified lines
432 openAsk: {433 args: { ask: nope, files: askFiles, project },434 refusal: new NotDecider({}),435 },436 postDiscussion: {437 args: {438 body: "Hello",439 discussion: DiscussionId.make("disc-000001"),440 project,441 },442 refusal: new UnknownDiscussion({443 discussion: DiscussionId.make("disc-000001"),444 }),445 },446 projectPolicy: {447 args: { project: nowhere },448 refusal: new UnknownProject({ project: nowhere }),449 },
16 unmodified lines
466 showAsk: {467 args: { ask: nope, project },468 refusal: new UnknownAsk({ ask: nope }),469 },470 showDiscussion: {471 args: { discussion: DiscussionId.make("disc-000001"), project },472 refusal: new UnknownDiscussion({473 discussion: DiscussionId.make("disc-000001"),474 }),475 },476 showProposal: {477 args: { project: nowhere, proposal: ProposalId.make("prop-000001") },478 refusal: new UnknownProject({ project: nowhere }),479 },
535 unmodified lines
added:apps/web/src/client/discussion.ts+27 added
1import type { DiscussionId, ProjectName } from "@repo/protocol/ids";2import { Atom } from "effect/reactivity";34import { ContractsClient } from "../surfaces.ts";5import { keys } from "./keys.ts";67export const discussionsAtom = Atom.family((project: ProjectName) =>8 Atom.withServerValueInitial(9 ContractsClient.query(10 "listDiscussions",11 { project },12 { reactivityKeys: keys.discussions(project) }13 )14 )15);1617export const discussionAtom = Atom.family((project: ProjectName) =>18 Atom.family((discussion: DiscussionId) =>19 Atom.withServerValueInitial(20 ContractsClient.query(21 "showDiscussion",22 { discussion, project },23 { reactivityKeys: keys.discussion(project, discussion) }24 )25 )26 )27);
modified:apps/web/src/client/keys.ts+16 added-1 removed
1// Each key is one string: Reactivity treats every element of a key list as a key of its own.2import type { AskId, ProjectName, ProposalId } from "@repo/protocol/ids";2import type {3 AskId,4 DiscussionId,5 ProjectName,6 ProposalId,7} from "@repo/protocol/ids";89export const keys = {10 ask: (project: ProjectName, ask: AskId): readonly string[] => [11 `ask:${project}/${ask}`,12 `project:${project}`,13 ],14 code: (project: ProjectName): readonly string[] => [`code:${project}`],15 discussion: (16 project: ProjectName,17 discussion: DiscussionId18 ): readonly string[] => [19 `discussion:${project}/${discussion}`,20 `discussions:${project}`,21 ],22 discussions: (project: ProjectName): readonly string[] => [23 `discussions:${project}`,24 ],25 // Not the project's key, so a page's reads can refetch without replaying every event.26 events: (project: ProjectName): readonly string[] => [`events:${project}`],27 front: (): readonly string[] => ["front"],28 ledger: (project: ProjectName): readonly string[] => [`ledger:${project}`],
8 unmodified lines
modified:apps/web/src/client/watch.ts+4 added
50 unmodified lines
51 AskClosed: () => [...keys.project(project), ...keys.front()],52 AskOpened: () => [...keys.project(project), ...keys.front()],53 Claimed: () => keys.project(project),54 Decided: () => keys.project(project),55 DiscussionPosted: ({ discussion }) => [56 ...keys.discussion(project, discussion),57 ...keys.project(project),58 ],59 Judged: ({ ask }) => keys.ask(project, ask),60 Landed: () => [61 ...keys.project(project),62 ...keys.front(),
76 unmodified lines
modified:apps/web/src/dev/front-page.ts+1 added
78 unmodified lines
79 Decided: () => rows,80 Judged: () => rows,81 Landed: () => rows,82 Lapsed: ({ ask }) => withClaims(rows, keyOf(project, ask), -1),83 DiscussionPosted: () => rows,84 LedgerAppended: () => rows,85 ProposalDrafted: () => rows,86 ProposalOpened: () => rows,87 Pushed: () => rows,
204 unmodified lines
modified:apps/web/src/dev/handlers.ts+12 added
226 unmodified lines
227 on(project, (api) => api.landing(who, sha))228 ),229 ledger: ({ project }) =>230 Effect.flatMap(caller, (who) => on(project, (api) => api.ledger(who))),231 listDiscussions: ({ project }) =>232 Effect.flatMap(caller, (who) =>233 on(project, (api) => api.listDiscussions(who))234 ),235 listAsks: ({ project }) =>236 Effect.flatMap(caller, (who) =>237 on(project, (api) => api.listAsks(who))238 ),
25 unmodified lines
264 openAsk: ({ project, ...input }) =>265 Effect.flatMap(person, (who) =>266 on(project, (api) => api.openAsk(who, input))267 ),268 postDiscussion: ({ project, ...input }) =>269 Effect.flatMap(person, (who) =>270 on(project, (api) => api.postDiscussion(who, input))271 ),272 projectPolicy: ({ project }) => on(project, (api) => api.policy()),273 proposeAsk: ({ project, ...input }) =>274 Effect.flatMap(person, (who) =>275 on(project, (api) => api.proposeAsk(who, input))
20 unmodified lines
296 on(project, (api) => api.showAsk(who, ask))297 ),298 showCommit: ({ at, project, sha }) =>299 code(project, (of) => commitOf(of, sha, Option.fromUndefinedOr(at))),300 showDiscussion: ({ discussion, project }) =>301 Effect.flatMap(caller, (who) =>302 on(project, (api) => api.showDiscussion(who, discussion))303 ),304 showProposal: ({ project, proposal }) =>305 Effect.flatMap(caller, (who) =>306 on(project, (api) => api.showProposal(who, proposal))307 ),
68 unmodified lines
modified:apps/web/src/dev/seed.ts+32 added-6 removed
222 unmodified lines
223224 return { claim, head, receipt, requestId };225 });226227const ROUNDS_MINUTE = 19;227const ROUNDS_MINUTE = 25;228229/**230 * Bram's first answer to parse-iso-week, refused at Shape for a path outside231 * the ask's territory, then his second, still at the merge. The platform's
104 unmodified lines
336 ask: AskId.make("add-months-clamp"),337 reason: "Its check pins a common year only; leap years need a case too.",338 });339340 // Two discussions: one open, one a maintainer turned into a proposal.341 yield* at(14);342343 const talked = yield* api.postDiscussion(as(visitors.regular), {344 body: "Weeks start on Monday in ISO 8601, but on Sunday in the US; which does parseISO assume?",345 title: "Which day starts a week?",346 });347348 yield* api.postDiscussion(as(decider), {349 body: "ISO, always: a locale never changes what a date string means.",350 discussion: talked.discussion.id,351 });352353 yield* at(15);354355 const asked = yield* api.postDiscussion(as(visitors.proposer), {356 body: "Could parseISO take week dates like 2026-W41-3 too?",357 title: "ISO week dates",358 });359360 yield* at(16);361 yield* api.proposeAsk(as(decider), {362 discussion: asked.discussion.id,363 want: "parseISO reads an ISO week date to the day it names.",364 });365366 yield* Effect.forEach(367 DECLINED,368 (want, index) =>369 Effect.gen(function* () {344 yield* at(11 + index * 2);370 yield* at(17 + index * 2);371372 const { proposal } = yield* api.proposeAsk(as(visitors.regular), {373 want,374 });375350 yield* at(12 + index * 2);376 yield* at(18 + index * 2);377378 const decision = yield* decisionOn(api, decider, proposal.id);379380 yield* api.decide(as(decider), {
8 unmodified lines
389 return api;390});391392const seedBurrow = Effect.flatMap(367 started(burrow.project, operator, burrow.files, 15),368 (api) => opened(api, burrowPeople.decider, burrow.asks, 17)393 started(burrow.project, operator, burrow.files, 21),394 (api) => opened(api, burrowPeople.decider, burrow.asks, 23)395);396371const STRAY_MINUTE = 21;397const STRAY_MINUTE = 27;398399export const seedEnd = devMinute(STRAY_MINUTE);400401const strayPush = (api: ProjectApi) =>
38 unmodified lines
modified:apps/web/src/features/answer/subject.ts+1 added
18 unmodified lines
19 Decided: () => [],20 Judged: ({ ask }) => [ask],21 Landed: () => [],22 Lapsed: ({ ask }) => [ask],23 DiscussionPosted: () => [],24 LedgerAppended: () => [],25 ProposalDrafted: () => [],26 ProposalOpened: () => [],27 Pushed: ({ ask }) => [ask],
117 unmodified lines
added:apps/web/src/features/discussion/discussion-view.tsx+112 added
1import { Brand } from "@repo/brand";2import type {3 Discussion,4 DiscussionPost,5} from "@repo/protocol/domain/discussion";6import type { ProjectName, ProposalId } from "@repo/protocol/ids";7import type { DateTime } from "effect";8import type { ReactNode } from "react";910import { CommandLine } from "../shared/command.tsx";11import { FactBlock } from "../shared/facts.tsx";12import { HandleLink } from "../shared/handle.tsx";13import { AppLink } from "../shared/link.tsx";14import { Workspace } from "../shared/shell/workspace.tsx";15import { When } from "../shared/time.tsx";16import { replyCommand, STATE_LABEL } from "./discussions-view.tsx";1718const LINK = "decoration-rule underline hover:decoration-current";1920const proposalPath = (project: ProjectName, proposal: ProposalId) =>21 `/${project}/proposals/${proposal}`;2223const Post = ({24 now,25 post,26}: {27 readonly now: DateTime.Utc;28 readonly post: DiscussionPost;29}) => (30 <article31 className="border-rule flex min-w-0 flex-col gap-2 border-b py-3"32 data-post={post.by}33 >34 <p className="text-label text-muted-foreground">35 <HandleLink handle={post.by} />36 {" · "}37 <When at={post.at} now={now} />38 </p>39 <p className="text-ui max-w-(--measure) [overflow-wrap:anywhere] whitespace-pre-wrap">40 {post.body}41 </p>42 </article>43);4445const Became = ({ discussion }: { readonly discussion: Discussion }) =>46 discussion.proposal === undefined ? null : (47 <p className="text-ui" data-became={discussion.proposal}>48 {"A maintainer turned this discussion into "}49 <AppLink50 className={`text-mono font-mono ${LINK}`}51 to={proposalPath(discussion.project, discussion.proposal)}52 >53 {discussion.proposal}54 </AppLink>55 , which expires unless a maintainer accepts it.56 </p>57 );5859const ThreadFacts = ({ discussion }: { readonly discussion: Discussion }) => (60 <FactBlock label="This discussion">61 {discussion.state === "open" ? (62 <>63 <p className="text-ui">64 Reply from a terminal; anyone not denounced may. A maintainer may turn65 the thread into a proposal with{" "}66 <code className="text-mono font-mono">{`${Brand.cli} propose --discussion ${discussion.id}`}</code>67 .68 </p>69 <CommandLine command={replyCommand(discussion)} numbered />70 </>71 ) : (72 <p className="text-ui">73 {discussion.state === "closed"74 ? "This discussion is closed: it takes no more posts."75 : "This discussion became a proposal: it takes no more posts."}76 </p>77 )}78 </FactBlock>79);8081export const DiscussionView = ({82 discussion,83 now,84}: {85 readonly discussion: Discussion;86 readonly now: DateTime.Utc;87}): ReactNode => (88 <Workspace89 facts={<ThreadFacts discussion={discussion} />}90 factsHeading="This discussion"91 meta={92 <>93 <code className="text-mono font-mono">{discussion.id}</code>94 {" · opened by "}95 <HandleLink handle={discussion.opener} />{" "}96 <When at={discussion.openedAt} now={now} />97 </>98 }99 state={100 <span data-state={discussion.state}>{STATE_LABEL[discussion.state]}</span>101 }102 title={discussion.title}103 variant="document"104 >105 <Became discussion={discussion} />106 <div className="border-rule flex flex-col border-t" data-posts="">107 {discussion.posts.map((post, index) => (108 <Post key={index} now={now} post={post} />109 ))}110 </div>111 </Workspace>112);
added:apps/web/src/features/discussion/discussions-view.tsx+115 added
1import { Brand } from "@repo/brand";2import type {3 DiscussionListing,4 DiscussionState,5} from "@repo/protocol/domain/discussion";6import type { ProjectName } from "@repo/protocol/ids";7import type { DateTime } from "effect";8import type { ReactNode } from "react";910import { CommandLine } from "../shared/command.tsx";11import { EmptyState } from "../shared/empty.tsx";12import { FactBlock } from "../shared/facts.tsx";13import { HandleLink } from "../shared/handle.tsx";14import { AppLink } from "../shared/link.tsx";15import { discussionPath } from "../shared/paths.ts";16import { Workspace } from "../shared/shell/workspace.tsx";17import { When } from "../shared/time.tsx";1819const LINK = "decoration-rule underline hover:decoration-current";2021const plural = (count: number, one: string, many: string) =>22 `${count} ${count === 1 ? one : many}`;2324/** Every state reads as a word beside its mark, never by colour alone. */25export const STATE_LABEL = {26 closed: "Closed",27 open: "Open",28 proposed: "Became a proposal",29} as const satisfies Record<DiscussionState, string>;3031export const openCommand = (project: ProjectName) =>32 `${Brand.cli} discussion post --project ${project} --title "<title>" --body "<post>"`;3334export const replyCommand = (35 listing: Pick<DiscussionListing, "id" | "project">36) =>37 `${Brand.cli} discussion post ${listing.id} --project ${listing.project} --body "<post>"`;3839const Row = ({40 listing,41 now,42}: {43 readonly listing: DiscussionListing;44 readonly now: DateTime.Utc;45}) => (46 <li47 className="border-rule flex min-w-0 flex-col gap-1 border-b py-3"48 data-discussion={listing.id}49 data-state={listing.state}50 >51 <AppLink52 className={`text-ui font-medium ${LINK}`}53 to={discussionPath(listing.project, listing.id)}54 >55 {listing.title}56 </AppLink>57 <p className="text-label text-muted-foreground flex flex-wrap gap-x-3">58 <span>59 <code className="text-mono font-mono">{listing.id}</code>60 </span>61 <span>62 {"opened by "}63 <HandleLink handle={listing.opener} />64 </span>65 <span>{plural(listing.posts, "post", "posts")}</span>66 <span>67 {"last post "}68 <When at={listing.lastPostAt} now={now} />69 </span>70 <span>{STATE_LABEL[listing.state]}</span>71 </p>72 </li>73);7475const PostFacts = ({ project }: { readonly project: ProjectName }) => (76 <FactBlock label="How to post">77 <p className="text-ui">78 Anyone not denounced may open a thread or reply, from a terminal. A79 discussion lands nothing itself; a maintainer may turn one into a80 proposal.81 </p>82 <CommandLine command={openCommand(project)} numbered />83 </FactBlock>84);8586export const DiscussionsView = ({87 discussions,88 now,89 project,90}: {91 readonly discussions: readonly DiscussionListing[];92 readonly now: DateTime.Utc;93 readonly project: ProjectName;94}): ReactNode => (95 <Workspace96 count={plural(discussions.length, "discussion", "discussions")}97 facts={<PostFacts project={project} />}98 factsHeading="Discussions here"99 title="Discussions"100 variant="list"101 >102 {discussions.length === 0 ? (103 <EmptyState104 command={openCommand(project)}105 title="No discussions yet. Open one from a terminal; anyone not denounced may."106 />107 ) : (108 <ul className="border-rule flex flex-col border-t" data-discussions="">109 {discussions.map((listing) => (110 <Row key={listing.id} listing={listing} now={now} />111 ))}112 </ul>113 )}114 </Workspace>115);
modified:apps/web/src/features/project/project-header.tsx+1 added-1 removed
1/**2 * A project's one header (ADR 0041): its name, posture, description, facts3 * and three actions, then its eight tabs. Every page of the project draws it3 * and three actions, then its nine tabs. Every page of the project draws it4 * the same; only the current tab moves.5 */6import { Brand } from "@repo/brand";7import type { Handle, ProjectName } from "@repo/protocol/ids";
347 unmodified lines
modified:apps/web/src/features/shared/shell/sections.ts+12 added-1 removed
1 unmodified line
2import { Option } from "effect";34import { INBOX_PATH, segmentsOf } from "../paths.ts";56/** A project's eight tabs (ADR 0041), in the header's order. */6/** A project's nine tabs (ADR 0041, with Discussions), in the header's order. */7export type ProjectTab =8 | "asks"9 | "code"10 | "discussions"11 | "landings"12 | "overview"13 | "people"14 | "policy"
33 unmodified lines
48 label: "Proposals",49 tab: "proposals",50 to: `/${project}`,51 },52 { label: "Discussions", tab: "discussions", to: `/${project}/discussions` },53 { hash: "who-decides", label: "People", tab: "people", to: `/${project}` },54 { label: "Policy", tab: "policy", to: `/${project}/people` },55 { label: "Visibility", tab: "visibility", to: `/${project}/visibility` },56];
5 unmodified lines
62 blob: "code",63 commit: "landings",64 commits: "landings",65 decisions: "asks",66 discussions: "discussions",67 people: "policy",68 proposals: "proposals",69 raw: "code",70 refs: "code",
4 unmodified lines
7576/** A crumb names the page itself, which may be narrower than its tab. */77type PageSection =78 | "code"79 | "discussions"80 | "landings"81 | "overview"82 | "people"83 | "refs"
1 unmodified line
8586const PAGE_TO = (project: string) =>87 ({88 code: `/${project}/tree/main`,89 discussions: `/${project}/discussions`,90 landings: `/${project}/commits/main`,91 overview: `/${project}`,92 people: `/${project}/people`,93 refs: `/${project}/refs`,
5 unmodified lines
99 asks: "overview",100 blob: "code",101 commit: "landings",102 commits: "landings",103 discussions: "discussions",104 people: "people",105 refs: "refs",106 tree: "code",107 visibility: "visibility",
70 unmodified lines
178}179180const SECTION_LABEL = {181 code: "Code",182 discussions: "Discussions",183 landings: "Landings",184 overview: "Asks",185 people: "Policy",186 refs: "Refs",
52 unmodified lines
239 commit: (project: string, sha: string) => [240 ...projectCrumbs(project, "landings", true),241 { label: sha.slice(0, 7), mono: true },242 ],243 discussions: (project: string, discussion: string) => [244 ...projectCrumbs(project, "discussions", true),245 { label: discussion, mono: true },246 ],247 decisions: (project: string, decision: string) => [248 { label: project, to: `/${project}` },249 { label: "Inbox", to: INBOX_PATH },250 { label: decision, mono: true },
53 unmodified lines
modified:apps/web/src/features/shared/ask-progress.ts+1 added
97 unmodified lines
98 Landed: constVoid,99 Lapsed: ({ ask }) => {100 change(ask, startedOver);101 },102 DiscussionPosted: constVoid,103 LedgerAppended: constVoid,104 ProposalDrafted: constVoid,105 ProposalOpened: constVoid,106 Pushed: ({ ask, at, head }) => {
109 unmodified lines
modified:apps/web/src/features/shared/paths.ts+9 added
1import type {2 AskId,3 DecisionId,4 DiscussionId,5 Handle,6 ProjectName,7} from "@repo/protocol/ids";8import { Result } from "effect";
36 unmodified lines
4546/** A handle is URL-safe by its schema. */47export const personPath = (handle: Handle) => `/people/${handle}`;4849export const discussionsPath = (project: ProjectName) =>50 `/${project}/discussions`;5152export const discussionPath = (53 project: ProjectName,54 discussion: DiscussionId55) => `/${project}/discussions/${discussion}`;5657/** A project's Visibility tab (ADR 0041), and the regions on it a link may open. */58export const visibilityPath = (project: ProjectName) =>59 `/${project}/visibility`;60
31 unmodified lines
added:apps/web/src/routes/$owner/$project/discussions/$discussion.tsx+120 added
1import { useAtomMount, useAtomValue } from "@effect/atom-react";2import { Client, ShowDiscussion } from "@repo/protocol/contracts";3import { DiscussionId, ProjectName } from "@repo/protocol/ids";4import { createFileRoute, notFound } from "@tanstack/react-router";5import { createServerFn } from "@tanstack/react-start";6import { env } from "cloudflare:workers";7import { DateTime, Effect, Option, Schema } from "effect";8import { AsyncResult } from "effect/reactivity";910import { discussionAtom } from "../../../../client/discussion.ts";11import { SeededAtoms, seedSuccess } from "../../../../client/seeded.ts";12import { watchAtom } from "../../../../client/watch.ts";13import { NotFoundView } from "../../../../features/ask/refused.tsx";14import { DiscussionView } from "../../../../features/discussion/discussion-view.tsx";15import { pageHead } from "../../../../features/shared/head.ts";16import { notFoundFor, Refusals } from "../../../../features/shared/refusals.ts";17import { branchPage } from "../../../../server/cache-headers.ts";18import { serverClient } from "../../../../server/client.ts";1920type Shown = typeof ShowDiscussion.successSchema.Type;2122export const readDiscussion = (name: string, id: string) =>23 Effect.gen(function* () {24 const project = yield* Schema.decodeEffect(ProjectName)(name).pipe(25 Effect.mapError(() => notFound())26 );2728 const discussion = yield* Schema.decodeEffect(DiscussionId)(id).pipe(29 Effect.mapError(() => notFound())30 );3132 const client = yield* Client;3334 const shown = yield* client.showDiscussion({ discussion, project }).pipe(35 Effect.catchTags({36 UnknownDiscussion: notFoundFor,37 UnknownProject: notFoundFor,38 })39 );4041 return yield* Schema.encodeEffect(ShowDiscussion.successSchema)(shown);42 });4344const discussionPage = createServerFn({ method: "GET" })45 .validator(46 (params: { readonly discussion: string; readonly project: string }) =>47 params48 )49 .handler(({ data }) =>50 Effect.runPromise(51 readDiscussion(data.project, data.discussion).pipe(52 Effect.provide(serverClient(env))53 )54 )55 );5657const FreshDiscussion = ({58 project,59 read,60}: {61 readonly project: ProjectName;62 readonly read: Shown;63}) => {64 useAtomMount(watchAtom(project));6566 const { discussion } = Option.getOrElse(67 AsyncResult.value(68 useAtomValue(discussionAtom(project)(read.discussion.id))69 ),70 () => read71 );7273 return <DiscussionView discussion={discussion} now={DateTime.nowUnsafe()} />;74};7576const DiscussionPage = () => {77 const read = Schema.decodeSync(ShowDiscussion.successSchema)(78 Route.useLoaderData()79 );8081 const { id, project } = read.discussion;8283 return (84 <SeededAtoms85 id={`${project}/${id}`}86 seeds={[seedSuccess(discussionAtom(project)(id), read)]}87 >88 <FreshDiscussion project={project} read={read} />89 </SeededAtoms>90 );91};9293const decodeRefusals = Schema.decodeUnknownOption(Refusals);9495const Unknown = ({ data }: { readonly data?: unknown }) => (96 <NotFoundView97 nothing="Nothing is at this address: a project's name is lowercase words joined by single dashes, and a discussion's id reads disc- and six digits."98 refusals={Option.getOrUndefined(decodeRefusals(data))}99 title="No such discussion"100 />101);102103export const Route = createFileRoute(104 "/$owner/$project/discussions/$discussion"105)({106 staticData: { shell: "project" },107 loader: ({ params }) => discussionPage({ data: params }),108 headers: () => branchPage,109 head: ({ loaderData, params: { discussion, project } }) =>110 pageHead(111 loaderData === undefined112 ? { title: `${discussion} · ${project}` }113 : {114 description: loaderData.discussion.title,115 title: `${loaderData.discussion.title} · ${project}`,116 }117 ),118 component: DiscussionPage,119 notFoundComponent: Unknown,120});
added:apps/web/src/routes/$owner/$project/discussions/index.tsx+102 added
1import { useAtomMount, useAtomValue } from "@effect/atom-react";2import { Client, ListDiscussions } from "@repo/protocol/contracts";3import { ProjectName } from "@repo/protocol/ids";4import { createFileRoute, notFound } from "@tanstack/react-router";5import { createServerFn } from "@tanstack/react-start";6import { env } from "cloudflare:workers";7import { DateTime, Effect, Option, Schema } from "effect";8import { AsyncResult } from "effect/reactivity";910import { discussionsAtom } from "../../../../client/discussion.ts";11import { SeededAtoms, seedSuccess } from "../../../../client/seeded.ts";12import { watchAtom } from "../../../../client/watch.ts";13import { DiscussionsView } from "../../../../features/discussion/discussions-view.tsx";14import { UnknownProjectView } from "../../../../features/project/unknown-project.tsx";15import { pageHead } from "../../../../features/shared/head.ts";16import { branchPage } from "../../../../server/cache-headers.ts";17import { serverClient } from "../../../../server/client.ts";1819type Listed = typeof ListDiscussions.successSchema.Type;2021export const readDiscussions = (name: string) =>22 Effect.gen(function* () {23 const project = yield* Schema.decodeEffect(ProjectName)(name).pipe(24 Effect.mapError(() => notFound())25 );2627 const client = yield* Client;2829 const listed = yield* client30 .listDiscussions({ project })31 .pipe(Effect.catchTag("UnknownProject", () => Effect.fail(notFound())));3233 return {34 listed: yield* Schema.encodeEffect(ListDiscussions.successSchema)(listed),35 project,36 };37 });3839const discussionsPage = createServerFn({ method: "GET" })40 .validator((name: string) => name)41 .handler(({ data }) =>42 Effect.runPromise(43 readDiscussions(data).pipe(Effect.provide(serverClient(env)))44 )45 );4647const FreshDiscussions = ({48 project,49 read,50}: {51 readonly project: ProjectName;52 readonly read: Listed;53}) => {54 useAtomMount(watchAtom(project));5556 const { discussions } = Option.getOrElse(57 AsyncResult.value(useAtomValue(discussionsAtom(project))),58 () => read59 );6061 return (62 <DiscussionsView63 discussions={discussions}64 now={DateTime.nowUnsafe()}65 project={project}66 />67 );68};6970const DiscussionsPage = () => {71 const { listed, project } = Route.useLoaderData();72 const read = Schema.decodeSync(ListDiscussions.successSchema)(listed);73 const name = ProjectName.make(project);7475 return (76 <SeededAtoms77 id={`${name}/discussions`}78 seeds={[seedSuccess(discussionsAtom(name), read)]}79 >80 <FreshDiscussions project={name} read={read} />81 </SeededAtoms>82 );83};8485const Unknown = () => {86 const { project } = Route.useParams();8788 return <UnknownProjectView name={project} />;89};9091export const Route = createFileRoute("/$owner/$project/discussions/")({92 staticData: { shell: "project" },93 loader: ({ params }) => discussionsPage({ data: params.project }),94 headers: () => branchPage,95 head: ({ params: { project } }) =>96 pageHead({97 title: `Discussions · ${project}`,98 description: `${project}'s discussions: public threads that land nothing themselves.`,99 }),100 component: DiscussionsPage,101 notFoundComponent: Unknown,102});
modified:apps/web/test/client-today.test.ts+2 added-2 removed
46 unmodified lines
47 ).toStrictEqual({48 decider: "ines-v",49 newcomers: ["bram"],50 projects: ["oscabriel/datekit"],51 subjects: ["OpenProposal", "OpenProposal", "StrayPush"],51 subjects: ["OpenProposal", "OpenProposal", "OpenProposal", "StrayPush"],52 unattended: ["diff-in-days-dst"],53 });54 })55 );
43 unmodified lines
99100 expect(taken?.choice).toBe("decline");101 expect(102 taken === undefined ? undefined : DateTime.formatIso(taken.at)103 ).toBe("2026-10-07T09:21:00.000Z");103 ).toBe("2026-10-07T09:27:00.000Z");104105 const todayIn = (where: typeof registry) =>106 Effect.map(settled(where, todayAtom), (today) =>107 Exit.isSuccess(today)
21 unmodified lines
added:apps/web/test/discussions.test.tsx+273 added
1import { describe, expect, it } from "@effect/vitest";2import { Brand } from "@repo/brand";3import { Client, Contracts } from "@repo/protocol/contracts";4import {5 Discussion,6 DiscussionListing,7} from "@repo/protocol/domain/discussion";8import { DiscussionId, ProjectName } from "@repo/protocol/ids";9import { UnknownDiscussion, UnknownProject } from "@repo/protocol/refusal";10import { asTester, unanswered } from "@repo/protocol/testing";11import { isNotFound } from "@tanstack/react-router";12import { DateTime, Effect, Layer, Schema } from "effect";13import { RpcTest } from "effect/rpc";1415import { DiscussionView } from "../src/features/discussion/discussion-view.tsx";16import { DiscussionsView } from "../src/features/discussion/discussions-view.tsx";17import {18 crumbsFor,19 projectSections,20 projectTabOf,21} from "../src/features/shared/shell/sections.ts";22import { readDiscussion } from "../src/routes/$owner/$project/discussions/$discussion.tsx";23import { readDiscussions } from "../src/routes/$owner/$project/discussions/index.tsx";24import { inOrder, markupOf, plainText } from "./ask-fixtures.ts";25import { elementWith, mainOf } from "./records.ts";26import { renderAt } from "./render.tsx";2728const datekit = ProjectName.make("oscabriel/datekit");2930const now = DateTime.makeUnsafe("2026-10-07T13:00:00Z");3132const first = DiscussionId.make("disc-000001");3334const second = DiscussionId.make("disc-000002");3536const open = Schema.decodeSync(Discussion)({37 id: "disc-000001",38 openedAt: "2026-10-07T12:00:00.000Z",39 opener: "wren",40 posts: [41 {42 at: "2026-10-07T12:00:00.000Z",43 body: "Weeks start on Monday in ISO 8601; which does parseISO assume?",44 by: "wren",45 },46 {47 at: "2026-10-07T12:30:00.000Z",48 body: "ISO, always.",49 by: "ines-v",50 },51 ],52 project: "oscabriel/datekit",53 state: "open",54 title: "Which day starts a week?",55});5657const proposed = Schema.decodeSync(Discussion)({58 id: "disc-000002",59 openedAt: "2026-10-07T12:10:00.000Z",60 opener: "tove",61 posts: [62 {63 at: "2026-10-07T12:10:00.000Z",64 body: "Could parseISO take week dates too?",65 by: "tove",66 },67 ],68 project: "oscabriel/datekit",69 proposal: "prop-000001",70 state: "proposed",71 title: "ISO week dates",72});7374const listings = Schema.decodeSync(Schema.Array(DiscussionListing))([75 {76 id: "disc-000001",77 lastPostAt: "2026-10-07T12:30:00.000Z",78 openedAt: "2026-10-07T12:00:00.000Z",79 opener: "wren",80 posts: 2,81 project: "oscabriel/datekit",82 state: "open",83 title: "Which day starts a week?",84 },85 {86 id: "disc-000002",87 lastPostAt: "2026-10-07T12:10:00.000Z",88 openedAt: "2026-10-07T12:10:00.000Z",89 opener: "tove",90 posts: 1,91 project: "oscabriel/datekit",92 proposal: "prop-000001",93 state: "proposed",94 title: "ISO week dates",95 },96]);9798const commandsOf = (markup: string) =>99 [100 ...markup.matchAll(/<code\b[^>]*select-all[^>]*>(?<line>.*?)<\/code>/gsu),101 ].map((found) =>102 plainText((found.groups?.line ?? "").replaceAll(/ \\\n\s*/gu, " ")).trim()103 );104105const list = (106 <DiscussionsView discussions={listings} now={now} project={datekit} />107);108109describe("a project's discussions page", () => {110 it("lists each thread by title, opener, posts, last post and state, each linked to its page", () => {111 const markup = mainOf(markupOf(list));112 const rows = elementWith(markup, "data-discussions");113114 expect(markup).toMatch(/<h1\b[^>]*>Discussions<\/h1>/u);115 expect(rows).toContain('href="/oscabriel/datekit/discussions/disc-000001"');116 expect(rows).toContain('href="/oscabriel/datekit/discussions/disc-000002"');117 expect(118 inOrder(plainText(rows), [119 "Which day starts a week?",120 "wren",121 "2 posts",122 "30 min ago",123 "Open",124 "ISO week dates",125 "tove",126 "1 post",127 "Became a proposal",128 ])129 ).toBeTruthy();130 });131132 it("shows the command to open a thread, copyable, and no form", () => {133 const markup = markupOf(list);134135 expect(commandsOf(markup)).toContain(136 `${Brand.cli} discussion post --project oscabriel/datekit --title "<title>" --body "<post>"`137 );138 expect(markup).not.toMatch(/<form\b|<textarea\b/u);139 });140141 it("says so, with the command, when there are none", () => {142 const markup = markupOf(143 <DiscussionsView discussions={[]} now={now} project={datekit} />144 );145146 expect(plainText(mainOf(markup))).toContain("No discussions yet");147 expect(markup).not.toContain("data-discussions");148 });149150 it.effect("is the Discussions tab, with its crumbs", () =>151 Effect.gen(function* () {152 const markup = yield* renderAt("/oscabriel/datekit/discussions", list);153 const crumbs = elementWith(markup, 'aria-label="Breadcrumb"');154155 expect(plainText(crumbs)).toContain("Discussions");156 expect(157 projectSections("oscabriel/datekit").find(158 ({ tab }) => tab === "discussions"159 )160 ).toStrictEqual({161 label: "Discussions",162 tab: "discussions",163 to: "/oscabriel/datekit/discussions",164 });165 expect([166 projectTabOf("/oscabriel/datekit/discussions"),167 projectTabOf("/oscabriel/datekit/discussions/disc-000001"),168 ]).toStrictEqual(["discussions", "discussions"]);169 expect(170 crumbsFor("/oscabriel/datekit/discussions/disc-000001")171 ).toStrictEqual([172 { label: "oscabriel/datekit", to: "/oscabriel/datekit" },173 { label: "Discussions", to: "/oscabriel/datekit/discussions" },174 { label: "disc-000001", mono: true },175 ]);176 })177 );178});179180describe("a discussion's page", () => {181 it("shows the posts in order, each by its person and time, and the reply command while open", () => {182 const markup = markupOf(<DiscussionView discussion={open} now={now} />);183 const main = mainOf(markup);184 const posts = elementWith(main, "data-posts");185186 expect(main).toMatch(/<h1\b[^>]*>Which day starts a week\?<\/h1>/u);187 expect(188 inOrder(plainText(posts), [189 "wren",190 "1 h ago",191 "Weeks start on Monday in ISO 8601; which does parseISO assume?",192 "ines-v",193 "30 min ago",194 "ISO, always.",195 ])196 ).toBeTruthy();197 expect(posts).toMatch(/<a\b[^>]*href="\/people\/wren"[^>]*>wren<\/a>/u);198 expect(commandsOf(markup)).toContain(199 `${Brand.cli} discussion post disc-000001 --project oscabriel/datekit --body "<post>"`200 );201 expect(markup).not.toMatch(/<form\b|<textarea\b/u);202 });203204 it("names the proposal a maintainer turned it into, linked, and offers no reply", () => {205 const markup = markupOf(<DiscussionView discussion={proposed} now={now} />);206207 const became = elementWith(mainOf(markup), "data-became");208209 expect(became).toMatch(210 /<a\b[^>]*href="\/oscabriel\/datekit\/proposals\/prop-000001"[^>]*>prop-000001<\/a>/u211 );212 expect(plainText(markup)).toContain("Became a proposal");213 expect(plainText(markup)).toContain("takes no more posts");214 expect(commandsOf(markup)).toStrictEqual([]);215 });216});217218const platformOf = () =>219 Layer.effect(Client, RpcTest.makeClient(Contracts)).pipe(220 Layer.provide(221 Layer.mergeAll(222 unanswered,223 Contracts.toLayerHandler("listDiscussions", ({ project }) =>224 project === datekit225 ? Effect.succeed({ discussions: listings })226 : Effect.fail(new UnknownProject({ project }))227 ),228 Contracts.toLayerHandler(229 "showDiscussion",230 ({ discussion, project }) => {231 if (project !== datekit) {232 return Effect.fail(new UnknownProject({ project }));233 }234235 return discussion === first236 ? Effect.succeed({ discussion: open })237 : Effect.fail(new UnknownDiscussion({ discussion }));238 }239 ),240 asTester241 )242 )243 );244245describe("the discussion reads", () => {246 it.effect("list a project's discussions and show one", () =>247 Effect.gen(function* () {248 const listed = yield* readDiscussions("oscabriel/datekit");249 const shown = yield* readDiscussion("oscabriel/datekit", "disc-000001");250251 expect(listed.listed.discussions.map(({ id }) => id)).toStrictEqual([252 "disc-000001",253 "disc-000002",254 ]);255 expect(shown.discussion.id).toBe("disc-000001");256 }).pipe(Effect.provide(platformOf()))257 );258259 it.effect(260 "are not-founds for an unknown project, discussion or address",261 () =>262 Effect.gen(function* () {263 const failed = yield* Effect.all([264 Effect.flip(readDiscussions("oscabriel/no-such-project")),265 Effect.flip(readDiscussion("oscabriel/datekit", second)),266 Effect.flip(readDiscussion("oscabriel/datekit", "not-an-id")),267 Effect.flip(readDiscussions("Not_A-Project")),268 ]);269270 expect(failed.map(isNotFound)).toStrictEqual([true, true, true, true]);271 }).pipe(Effect.provide(platformOf()))272 );273});
modified:apps/web/test/nav.test.tsx+2 added-1 removed
24 unmodified lines
25 { href: "/oscabriel/datekit/tree/main", text: "Code" },26 { href: "/oscabriel/datekit#open-asks", text: "Asks" },27 { href: "/oscabriel/datekit/commits/main?show=landings", text: "Landings" },28 { href: "/oscabriel/datekit#proposals", text: "Proposals" },29 { href: "/oscabriel/datekit/discussions", text: "Discussions" },30 { href: "/oscabriel/datekit#who-decides", text: "People" },31 { href: "/oscabriel/datekit/people", text: "Policy" },32 { href: "/oscabriel/datekit/visibility", text: "Visibility" },33 ].map((link) => ({ current: link.text === current, ...link }));3435describe("a project's tabs", () => {35 it("links all eight, in ADR 0041's order, and marks only the page being read", () => {36 it("links all nine, in ADR 0041's order, and marks only the page being read", () => {37 const markup = renderToStaticMarkup(38 <ProjectTabs current="code" project={datekit} />39 );40
146 unmodified lines
modified:apps/web/test/project.test.tsx+1 added
128 unmodified lines
129 "Code",130 "Asks",131 "Landings",132 "Proposals",133 "Discussions",134 "People",135 "Policy",136 "Visibility",137];
1391 unmodified lines
modified:packages/agent-kit/src/docs/run-a-project.ts+4 added
85 unmodified lines
86 "## Proposals and drafts",87 "",88 `Anyone not denounced may propose an ask: ${cli('propose --project <owner>/<name> --want "<what should be true>"')}. A proposal expires unless a maintainer accepts it. With ${code("--draft")}, the platform's agent drafts the ask file and its failing check, runs them red first, and puts the draft to a maintainer with its evidence; ${cli("proposal <proposal> --project <owner>/<name>")} follows it, and ${cli("ask draft <proposal> --project <owner>/<name>")} asks for another round. Nothing lands until a maintainer accepts, and the landing discloses the agent in \`Assisted-by\`.`,89 "",90 "## Discussions",91 "",92 `A discussion is a public, freeform thread in a project, open to anyone not denounced, that lands nothing itself. Open one with ${cli('discussion post --project <owner>/<name> --title "<what to talk about>" --body "<the first post>"')}, and reply with ${cli('discussion post <discussion> --project <owner>/<name> --body "<your post>"')}; ${cli("discussions --project <owner>/<name>")} lists them and ${cli("discussion <discussion> --project <owner>/<name>")} reads one. A maintainer may turn a thread into a proposal with ${cli('propose --project <owner>/<name> --discussion <discussion> --want "<what should be true>"')}, which marks it proposed and takes no more posts; its page then names the proposal it became.`,93 "",94 "## Today",95 "",96 `A maintainer's Today is their open decisions, soonest to expire first, each with its evidence and a safe default taken if nobody decides before it expires. Read it on the web in [your inbox](/inbox), or with ${cli("today")}, and take one with ${cli("decide --project <owner>/<name> --decision <decision> --choice accept")} (or \`decline\`, \`adopt\`, \`revert\`).`,97 "",
23 unmodified lines
modified:packages/agent-kit/src/command-doc.ts+10 added-1 removed
179 unmodified lines
180 SchemaAST.isObjects(ast)181 ? ast.propertySignatures.map(({ name }) => String(name))182 : [];183184const requiredFieldsOf = (ast: SchemaAST.AST) =>185 SchemaAST.isObjects(ast)186 ? ast.propertySignatures.flatMap(({ name, type }) =>187 type.context?.isOptional === true ? [] : [String(name)]188 )189 : [];190191export const contractCommandDocs = (192 group: typeof Contracts193): readonly CommandDoc[] =>194 [...group.requests.values()].flatMap((rpc) => {
10 unmodified lines
205 return [];206 }207208 const positional = cli.positional ?? [];209 const required = requiredFieldsOf(rpc.payloadSchema.ast);210 const readOnly = Context.get(annotations, ReadOnly);211 const needsApproval = Context.get(annotations, NeedsApproval);212213 const flags = fieldsOf(rpc.payloadSchema.ast)
10 unmodified lines
224 ...(readOnly ? [] : ["--dry-run"]),225 ],226 needsApproval,227 path: [first, ...rest],220 positional: [...positional],228 // An optional positional (a reply's discussion) is taken, not required, so the row leaves it out.229 positional: positional.filter((field) => required.includes(field)),230 readOnly,231 source: "contract",232 summary: Context.get(annotations, Description),233 },
9 unmodified lines
modified:packages/agent-kit/src/llms-sections.ts+1 added
103 unmodified lines
104 AskClosed: "An ask closed, with the landing that answered it.",105 AskOpened: "A new ask opened.",106 Claimed: "Someone claimed an ask.",107 Decided: "A maintainer took a decision.",108 DiscussionPosted: "Someone posted in a discussion: opened one, or replied.",109 Judged: "An answer was checked, with the outcome its verdict holds.",110 Landed:111 "A landing reached `main`, a project's adoption (its first push or its import) among them.",112 Lapsed: "A claim lapsed: no push for too long.",
17 unmodified lines
modified:packages/agent-kit/src/refusals.ts+7 added-1 removed
52 unmodified lines
53 next: cli("claim", "<ask>"),54 todo: "Your claim lapsed after a spell without a push: claim the ask again if it is still open.",55 },56 Denounced: {57 todo: "The project's vouch file denounces you: it takes no claims or proposals from you.",57 todo: "The project's vouch file denounces you: it takes no claims, proposals or posts from you.",58 },59 DirectPush: {60 todo: "Main moves only by a landing. A contributor pushes the answer to the claim's fork; a maintainer makes a working fork with `next` and lands it with `land`.",61 },
39 unmodified lines
101const elsewhere = {102 DecisionClosed: {103 todo: "Nothing to decide: it was taken already, or expired to its default.",104 },105 DiscussionClosed: {106 todo: "Nothing more is posted there: the discussion was closed, or a maintainer turned it into a proposal; `next` lists the open ones.",107 },108 DraftInProgress: {109 next: cli("proposal", "<proposal>"),110 todo: "Wait: the platform is drafting this proposal's ask already, and `next` shows when it settles.",111 },
34 unmodified lines
146 },147 UnknownDecision: {148 todo: "Check the decision's id: `next` lists the decisions waiting on you.",149 },150 UnknownDiscussion: {151 todo: "Check the discussion's id: `next` lists the project's discussions.",152 },153 UnknownEnvItem: {154 todo: "Name a key the project's env shape has: `next` lists them.",155 },156 UnknownPath: {
140 unmodified lines
modified:packages/agent-kit/test/golden/agent-plugins-stdio.txt+1 added-1 removed
59 unmodified lines
60| `NoAsk` | no | 66 | `__CLI__ asks` | Push to the fork your claim gave you, which names its ask. |61| `RepoBusy` | yes | 75 | `git push` | Push again. |62| `DirectPush` | no | 77 | `__CLI__ fork --project <owner>/<name>` | Main moves only by a landing. A contributor pushes the answer to the claim's fork; a maintainer makes a working fork with `next` and lands it with `land`. |63| `AskBlocked` | yes | 75 | `__CLI__ asks` | Wait for the asks it names to land, or answer one of them first. |64| `Denounced` | no | 77 | `__CLI__ policy --project <owner>/<name>` | The project's vouch file denounces you: it takes no claims or proposals from you. |64| `Denounced` | no | 77 | `__CLI__ policy --project <owner>/<name>` | The project's vouch file denounces you: it takes no claims, proposals or posts from you. |65| `OutOfScope` | no | 65 | `__CLI__ check` | Undo your changes to the paths it names: they are outside the ask's territory. |66| `TouchedJudge` | no | 65 | `__CLI__ check` | Undo your changes to the paths it names: they decide what the checks do. |67| `Weakened` | no | 65 | `__CLI__ check` | Take the marker out; a marker without a reason may get one after ` -- ` for a maintainer to weigh, but one a maintainer declined stays out; never raise a ratchet. |68| `PrivatePathInPublicTree` | no | 65 | `__CLI__ check` | Take the held-back paths it names out of your answer. |
29 unmodified lines
modified:packages/agent-kit/test/golden/agent-plugins.txt+1 added-1 removed
60 unmodified lines
61| `NoAsk` | no | 66 | `__CLI__ asks` | Push to the fork your claim gave you, which names its ask. |62| `RepoBusy` | yes | 75 | `git push` | Push again. |63| `DirectPush` | no | 77 | `__CLI__ fork --project <owner>/<name>` | Main moves only by a landing. A contributor pushes the answer to the claim's fork; a maintainer makes a working fork with `next` and lands it with `land`. |64| `AskBlocked` | yes | 75 | `__CLI__ asks` | Wait for the asks it names to land, or answer one of them first. |65| `Denounced` | no | 77 | `__CLI__ policy --project <owner>/<name>` | The project's vouch file denounces you: it takes no claims or proposals from you. |65| `Denounced` | no | 77 | `__CLI__ policy --project <owner>/<name>` | The project's vouch file denounces you: it takes no claims, proposals or posts from you. |66| `OutOfScope` | no | 65 | `__CLI__ check` | Undo your changes to the paths it names: they are outside the ask's territory. |67| `TouchedJudge` | no | 65 | `__CLI__ check` | Undo your changes to the paths it names: they decide what the checks do. |68| `Weakened` | no | 65 | `__CLI__ check` | Take the marker out; a marker without a reason may get one after ` -- ` for a maintainer to weigh, but one a maintainer declined stays out; never raise a ratchet. |69| `PrivatePathInPublicTree` | no | 65 | `__CLI__ check` | Take the held-back paths it names out of your answer. |
26 unmodified lines
modified:packages/agent-kit/test/golden/agent-setup.txt+2 added-2 removed
127 unmodified lines
128- Checks: `ChecksFailed`, `HeldBackFailed` and `AttemptsExhausted`129- Never counted against the answerer: `Flake` and `VerifierBlocked`130- At ask open: `NotRedFirst`, `WeakCheck` and `IncompleteBrief`131- Maintainers only: `LayerContentInPublicTree`, `SecretInOutput` and `UnstatedRequirement`132- Decision: `PostureChange`, `NotDecider`, `DecisionClosed`, `ProposalClosed` and `DraftInProgress`133- Lookup: `UnknownProject`, `UnknownAsk`, `UnknownCommit`, `UnknownDecision`, `UnknownPath`, `UnknownRevision` and `UnknownProposal`132- Decision: `PostureChange`, `NotDecider`, `DecisionClosed`, `ProposalClosed`, `DraftInProgress` and `DiscussionClosed`133- Lookup: `UnknownProject`, `UnknownAsk`, `UnknownCommit`, `UnknownDecision`, `UnknownPath`, `UnknownRevision`, `UnknownProposal` and `UnknownDiscussion`134- Setup: `ProjectExists`, `NotYourNamespace` and `ImportFailed`135- Env: `UnknownEnvItem`, `NotSensitive` and `ValueTooShort`
modified:packages/agent-kit/test/golden/claude-plugin-stdio.txt+1 added-1 removed
58 unmodified lines
59| `NoAsk` | no | 66 | `__CLI__ asks` | Push to the fork your claim gave you, which names its ask. |60| `RepoBusy` | yes | 75 | `git push` | Push again. |61| `DirectPush` | no | 77 | `__CLI__ fork --project <owner>/<name>` | Main moves only by a landing. A contributor pushes the answer to the claim's fork; a maintainer makes a working fork with `next` and lands it with `land`. |62| `AskBlocked` | yes | 75 | `__CLI__ asks` | Wait for the asks it names to land, or answer one of them first. |63| `Denounced` | no | 77 | `__CLI__ policy --project <owner>/<name>` | The project's vouch file denounces you: it takes no claims or proposals from you. |63| `Denounced` | no | 77 | `__CLI__ policy --project <owner>/<name>` | The project's vouch file denounces you: it takes no claims, proposals or posts from you. |64| `OutOfScope` | no | 65 | `__CLI__ check` | Undo your changes to the paths it names: they are outside the ask's territory. |65| `TouchedJudge` | no | 65 | `__CLI__ check` | Undo your changes to the paths it names: they decide what the checks do. |66| `Weakened` | no | 65 | `__CLI__ check` | Take the marker out; a marker without a reason may get one after ` -- ` for a maintainer to weigh, but one a maintainer declined stays out; never raise a ratchet. |67| `PrivatePathInPublicTree` | no | 65 | `__CLI__ check` | Take the held-back paths it names out of your answer. |
64 unmodified lines
modified:packages/agent-kit/test/golden/claude-plugin.txt+1 added-1 removed
59 unmodified lines
60| `NoAsk` | no | 66 | `__CLI__ asks` | Push to the fork your claim gave you, which names its ask. |61| `RepoBusy` | yes | 75 | `git push` | Push again. |62| `DirectPush` | no | 77 | `__CLI__ fork --project <owner>/<name>` | Main moves only by a landing. A contributor pushes the answer to the claim's fork; a maintainer makes a working fork with `next` and lands it with `land`. |63| `AskBlocked` | yes | 75 | `__CLI__ asks` | Wait for the asks it names to land, or answer one of them first. |64| `Denounced` | no | 77 | `__CLI__ policy --project <owner>/<name>` | The project's vouch file denounces you: it takes no claims or proposals from you. |64| `Denounced` | no | 77 | `__CLI__ policy --project <owner>/<name>` | The project's vouch file denounces you: it takes no claims, proposals or posts from you. |65| `OutOfScope` | no | 65 | `__CLI__ check` | Undo your changes to the paths it names: they are outside the ask's territory. |66| `TouchedJudge` | no | 65 | `__CLI__ check` | Undo your changes to the paths it names: they decide what the checks do. |67| `Weakened` | no | 65 | `__CLI__ check` | Take the marker out; a marker without a reason may get one after ` -- ` for a maintainer to weigh, but one a maintainer declined stays out; never raise a ratchet. |68| `PrivatePathInPublicTree` | no | 65 | `__CLI__ check` | Take the held-back paths it names out of your answer. |
62 unmodified lines
modified:packages/agent-kit/test/golden/full-llms.txt+4 added-1 removed
64 unmodified lines
65| `NoAsk` | Push and claim | no | 66 | `__CLI__ asks` | Push to the fork your claim gave you, which names its ask. |66| `RepoBusy` | Push and claim | yes | 75 | `git push` | Push again. |67| `DirectPush` | Push and claim | no | 77 | `__CLI__ fork --project <owner>/<name>` | Main moves only by a landing. A contributor pushes the answer to the claim's fork; a maintainer makes a working fork with `next` and lands it with `land`. |68| `AskBlocked` | Push and claim | yes | 75 | `__CLI__ asks` | Wait for the asks it names to land, or answer one of them first. |69| `Denounced` | Push and claim | no | 77 | `__CLI__ policy --project <owner>/<name>` | The project's vouch file denounces you: it takes no claims or proposals from you. |69| `Denounced` | Push and claim | no | 77 | `__CLI__ policy --project <owner>/<name>` | The project's vouch file denounces you: it takes no claims, proposals or posts from you. |70| `OutOfScope` | Shape | no | 65 | `__CLI__ check` | Undo your changes to the paths it names: they are outside the ask's territory. |71| `TouchedJudge` | Shape | no | 65 | `__CLI__ check` | Undo your changes to the paths it names: they decide what the checks do. |72| `Weakened` | Shape | no | 65 | `__CLI__ check` | Take the marker out; a marker without a reason may get one after ` -- ` for a maintainer to weigh, but one a maintainer declined stays out; never raise a ratchet. |73| `PrivatePathInPublicTree` | Shape | no | 65 | `__CLI__ check` | Take the held-back paths it names out of your answer. |
15 unmodified lines
89| `NotDecider` | Decision | no | 77 | `__CLI__ policy --project <owner>/<name>` | Only one of the project's maintainers may do this: ask one of them. |90| `DecisionClosed` | Decision | no | 66 | `__CLI__ today` | Nothing to decide: it was taken already, or expired to its default. |91| `ProposalClosed` | Decision | no | 66 | `__CLI__ today` | Nothing more is drafted for it: the proposal was accepted, declined or expired. |92| `DraftInProgress` | Decision | yes | 75 | `__CLI__ proposal <proposal>` | Wait: the platform is drafting this proposal's ask already, and `next` shows when it settles. |93| `DiscussionClosed` | Decision | no | 66 | `__CLI__ discussions` | Nothing more is posted there: the discussion was closed, or a maintainer turned it into a proposal; `next` lists the open ones. |94| `UnknownProject` | Lookup | no | 66 | `__CLI__ projects` | Check the project's name: `next` lists every project. |95| `UnknownAsk` | Lookup | no | 66 | `__CLI__ asks` | Check the ask's name: `next` lists the project's open asks. |96| `UnknownCommit` | Lookup | no | 66 | `log {"project":"<owner>/<name>"}` | Name a commit the project holds: `next`, the MCP tool, lists its log. |97| `UnknownDecision` | Lookup | no | 66 | `__CLI__ today` | Check the decision's id: `next` lists the decisions waiting on you. |98| `UnknownPath` | Lookup | no | 66 | `readTree {"at":"main","project":"<owner>/<name>"}` | Name a path the commit holds: `next`, the MCP tool, lists a folder's entries; give it `at` the commit. |99| `UnknownRevision` | Lookup | no | 66 | `listRefs {"project":"<owner>/<name>"}` | Name `main`, a commit the project holds or one of its tags: `next`, the MCP tool, lists its refs. |100| `UnknownProposal` | Lookup | no | 66 | `__CLI__ today` | Check the proposal's id: `next` lists the proposals waiting on you. |101| `UnknownDiscussion` | Lookup | no | 66 | `__CLI__ discussions` | Check the discussion's id: `next` lists the project's discussions. |102| `ProjectExists` | Setup | no | 65 | `__CLI__ projects` | Pick another name: that one is taken. |103| `NotYourNamespace` | Setup | no | 77 | | Make the project in your own namespace: `next` names it with your handle. |104| `ImportFailed` | Setup | yes | 75 | `__CLI__ init --project <owner>/<name> --import <url>` | Read `reason`, then import again with `next`. |105| `UnknownEnvItem` | Env | no | 66 | `__CLI__ env shape` | Name a key the project's env shape has: `next` lists them. |
59 unmodified lines
165- `AskClosed`: An ask closed, with the landing that answered it.166- `AskOpened`: A new ask opened.167- `Claimed`: Someone claimed an ask.168- `Decided`: A maintainer took a decision.169- `DiscussionPosted`: Someone posted in a discussion: opened one, or replied.170- `Judged`: An answer was checked, with the outcome its verdict holds.171- `Landed`: A landing reached `main`, a project's adoption (its first push or its import) among them.172- `Lapsed`: A claim lapsed: no push for too long.173- `LedgerAppended`: The project's public ledger gained an entry.
28 unmodified lines
modified:packages/agent-kit/test/golden/platform-skill.txt+1 added-1 removed
52 unmodified lines
53| `NoAsk` | no | 66 | `__CLI__ asks` | Push to the fork your claim gave you, which names its ask. |54| `RepoBusy` | yes | 75 | `git push` | Push again. |55| `DirectPush` | no | 77 | `__CLI__ fork --project <owner>/<name>` | Main moves only by a landing. A contributor pushes the answer to the claim's fork; a maintainer makes a working fork with `next` and lands it with `land`. |56| `AskBlocked` | yes | 75 | `__CLI__ asks` | Wait for the asks it names to land, or answer one of them first. |57| `Denounced` | no | 77 | `__CLI__ policy --project <owner>/<name>` | The project's vouch file denounces you: it takes no claims or proposals from you. |57| `Denounced` | no | 77 | `__CLI__ policy --project <owner>/<name>` | The project's vouch file denounces you: it takes no claims, proposals or posts from you. |58| `OutOfScope` | no | 65 | `__CLI__ check` | Undo your changes to the paths it names: they are outside the ask's territory. |59| `TouchedJudge` | no | 65 | `__CLI__ check` | Undo your changes to the paths it names: they decide what the checks do. |60| `Weakened` | no | 65 | `__CLI__ check` | Take the marker out; a marker without a reason may get one after ` -- ` for a maintainer to weigh, but one a maintainer declined stays out; never raise a ratchet. |61| `PrivatePathInPublicTree` | no | 65 | `__CLI__ check` | Take the held-back paths it names out of your answer. |
15 unmodified lines
modified:packages/agent-kit/test/golden/project-skill.txt+2 added-2 removed
86 unmodified lines
87| `NoAsk` | no | 66 | `__CLI__ asks` | Push to the fork your claim gave you, which names its ask. |88| `RepoBusy` | yes | 75 | `git push` | Push again. |89| `DirectPush` | no | 77 | `__CLI__ fork --project <owner>/<name>` | Main moves only by a landing. A contributor pushes the answer to the claim's fork; a maintainer makes a working fork with `next` and lands it with `land`. |90| `AskBlocked` | yes | 75 | `__CLI__ asks` | Wait for the asks it names to land, or answer one of them first. |91| `Denounced` | no | 77 | `__CLI__ policy --project <owner>/<name>` | The project's vouch file denounces you: it takes no claims or proposals from you. |91| `Denounced` | no | 77 | `__CLI__ policy --project <owner>/<name>` | The project's vouch file denounces you: it takes no claims, proposals or posts from you. |92| `OutOfScope` | no | 65 | `__CLI__ check` | Undo your changes to the paths it names: they are outside the ask's territory. |93| `TouchedJudge` | no | 65 | `__CLI__ check` | Undo your changes to the paths it names: they decide what the checks do. |94| `Weakened` | no | 65 | `__CLI__ check` | Take the marker out; a marker without a reason may get one after ` -- ` for a maintainer to weigh, but one a maintainer declined stays out; never raise a ratchet. |95| `PrivatePathInPublicTree` | no | 65 | `__CLI__ check` | Take the held-back paths it names out of your answer. |
102 unmodified lines
198| `NoAsk` | no | 66 | `__CLI__ asks` | Push to the fork your claim gave you, which names its ask. |199| `RepoBusy` | yes | 75 | `git push` | Push again. |200| `DirectPush` | no | 77 | `__CLI__ fork --project <owner>/<name>` | Main moves only by a landing. A contributor pushes the answer to the claim's fork; a maintainer makes a working fork with `next` and lands it with `land`. |201| `AskBlocked` | yes | 75 | `__CLI__ asks` | Wait for the asks it names to land, or answer one of them first. |202| `Denounced` | no | 77 | `__CLI__ policy --project <owner>/<name>` | The project's vouch file denounces you: it takes no claims or proposals from you. |202| `Denounced` | no | 77 | `__CLI__ policy --project <owner>/<name>` | The project's vouch file denounces you: it takes no claims, proposals or posts from you. |203| `OutOfScope` | no | 65 | `__CLI__ check` | Undo your changes to the paths it names: they are outside the ask's territory. |204| `TouchedJudge` | no | 65 | `__CLI__ check` | Undo your changes to the paths it names: they decide what the checks do. |205| `Weakened` | no | 65 | `__CLI__ check` | Take the marker out; a marker without a reason may get one after ` -- ` for a maintainer to weigh, but one a maintainer declined stays out; never raise a ratchet. |206| `PrivatePathInPublicTree` | no | 65 | `__CLI__ check` | Take the held-back paths it names out of your answer. |
15 unmodified lines
modified:packages/agent-kit/test/docs.test.ts+1 added
184 unmodified lines
185 "AskClosed",186 "AskOpened",187 "Claimed",188 "Decided",189 "DiscussionPosted",190 "Judged",191 "Landed",192 "Lapsed",193 "LedgerAppended",
66 unmodified lines
modified:packages/agent-kit/test/full-llms.test.ts+1 added
110 unmodified lines
111 "AskClosed",112 "AskOpened",113 "Claimed",114 "Decided",115 "DiscussionPosted",116 "Judged",117 "Landed",118 "Lapsed",119 "LedgerAppended",
137 unmodified lines
added:packages/project/src/attention/discussions.ts+138 added
1import type { Discussion } from "@repo/protocol/domain/discussion";2import type { DiscussionId, ProjectName, ProposalId } from "@repo/protocol/ids";3import type { Person } from "@repo/protocol/principal";4import {5 CapReached,6 Denounced,7 DiscussionClosed,8} from "@repo/protocol/refusal";9import { Array, Data, Option, Result } from "effect";10import type { DateTime } from "effect";1112import { ProjectEventInput } from "../events.ts";13import { AttentionEffect } from "./effects.ts";1415/** How many discussions one person outside the project's vouches may hold open at once. */16export const DISCUSSIONS_PER_PERSON = 20;1718interface Poster {19 readonly denounced: boolean;20 readonly who: Person;21}2223export type DiscussionCommand = Data.TaggedEnum<{24 Open: Poster & {25 readonly body: Option.Option<string>;26 readonly capped: boolean;27 readonly id: DiscussionId;28 readonly openCount: number;29 readonly project: ProjectName;30 readonly title: string;31 };32 Reply: Poster & { readonly body: string; readonly discussion: Discussion };33}>;3435export const DiscussionCommand = Data.taggedEnum<DiscussionCommand>();3637export interface Posted {38 readonly discussion: Discussion;39 readonly effects: readonly AttentionEffect[];40}4142export type PostRefusal = Denounced | CapReached | DiscussionClosed;4344const posted = (discussion: Discussion, now: DateTime.Utc): Posted => ({45 discussion,46 effects: [47 AttentionEffect.Emit({48 event: ProjectEventInput.DiscussionPosted({49 at: now,50 by: Array.lastNonEmpty(discussion.posts).by,51 discussion: discussion.id,52 }),53 }),54 ],55});5657const open = (58 command: Data.TaggedEnum.Value<DiscussionCommand, "Open">,59 now: DateTime.Utc60): Result.Result<Posted, Denounced | CapReached> => {61 if (command.denounced) {62 return Result.fail(new Denounced({}));63 }6465 if (command.capped && command.openCount >= DISCUSSIONS_PER_PERSON) {66 return Result.fail(67 new CapReached({ cap: DISCUSSIONS_PER_PERSON, limit: "discussions" })68 );69 }7071 const first = {72 at: now,73 body: Option.getOrElse(command.body, () => command.title),74 by: command.who.handle,75 };7677 return Result.succeed(78 posted(79 {80 id: command.id,81 openedAt: now,82 opener: command.who.handle,83 posts: [first],84 project: command.project,85 state: "open",86 title: command.title,87 },88 now89 )90 );91};9293const reply = (94 command: Data.TaggedEnum.Value<DiscussionCommand, "Reply">,95 now: DateTime.Utc96): Result.Result<Posted, Denounced | DiscussionClosed> => {97 if (command.denounced) {98 return Result.fail(new Denounced({}));99 }100101 const { discussion } = command;102103 if (discussion.state !== "open") {104 return Result.fail(new DiscussionClosed({ discussion: discussion.id }));105 }106107 return Result.succeed(108 posted(109 {110 ...discussion,111 posts: [112 ...discussion.posts,113 { at: now, body: command.body, by: command.who.handle },114 ],115 },116 now117 )118 );119};120121/** `transition(state, command, now)`: an open thread takes a post; a closed or proposed one refuses it. */122export const post = (123 command: DiscussionCommand,124 now: DateTime.Utc125): Result.Result<Posted, PostRefusal> =>126 DiscussionCommand.$match(command, {127 Open: (opening) => open(opening, now),128 Reply: (replying) => reply(replying, now),129 });130131/** A maintainer's proposal from a thread marks it proposed; only an open thread can be. */132export const promoted = (133 discussion: Discussion,134 proposal: ProposalId135): Result.Result<Discussion, DiscussionClosed> =>136 discussion.state === "open"137 ? Result.succeed({ ...discussion, proposal, state: "proposed" })138 : Result.fail(new DiscussionClosed({ discussion: discussion.id }));
modified:packages/project/src/project-store/memory.ts+1 added
73 unmodified lines
74 asks: yield* all(state, Tables.asks),75 attempts: yield* all(state, Tables.attempts),76 claims: yield* all(state, Tables.claims),77 decisions: yield* all(state, Tables.decisions),78 discussions: yield* all(state, Tables.discussions),79 envValues: yield* all(state, Tables.envValues),80 landings: yield* decodeAll(81 Tables.landings,82 Array.map(newest, ([, row]) => row)
156 unmodified lines
modified:packages/project/src/project-store/migrations.ts+7 added
87 unmodified lines
8889 yield* sql`DROP TABLE budget_days`;90});9192const discussions = Effect.gen(function* () {93 const sql = yield* SqlClient;9495 yield* sql`CREATE TABLE discussions (id TEXT PRIMARY KEY, body TEXT NOT NULL)`;96});9798const migrations = {99 "1_project_state": projectState,100 "2_visibility": visibility,101 "3_drop_budget_days": dropBudgetDays,102 "4_discussions": discussions,103};104105export const migrate: Effect.Effect<106 readonly (readonly [id: number, name: string])[],
6 unmodified lines
modified:packages/project/src/project-store/rows.ts+5 added
1import { Ask } from "@repo/protocol/domain/ask";2import { AgentTrailer } from "@repo/protocol/domain/credit";3import { Decision } from "@repo/protocol/domain/decision";4import { Discussion } from "@repo/protocol/domain/discussion";5import { ProjectEvent } from "@repo/protocol/domain/event";6import { LandingView } from "@repo/protocol/domain/landing";7import { ImportSource } from "@repo/protocol/domain/policy";8import { Proposal } from "@repo/protocol/domain/proposal";
76 unmodified lines
85export const DecisionRow = Decision;8687export type DecisionRow = typeof DecisionRow.Type;8889export const DiscussionRow = Discussion;9091export type DiscussionRow = typeof DiscussionRow.Type;9293export const RatchetRow = Schema.Struct({94 at: LandedSha,95 count: Schema.Int,96 ratchet: RatchetName,
87 unmodified lines
modified:packages/project/src/project-store/sqlite.ts+1 added
178 unmodified lines
179 asks: yield* all(Tables.asks),180 attempts: yield* all(Tables.attempts),181 claims: yield* all(Tables.claims),182 decisions: yield* all(Tables.decisions),183 discussions: yield* all(Tables.discussions),184 envValues: yield* all(Tables.envValues),185 landings: yield* bodiesOf(186 Tables.landings,187 sql`SELECT body FROM landings
21 unmodified lines
modified:packages/project/src/project-store/tables.ts+5 added
6 unmodified lines
7 AskRow,8 AttemptRow,9 ClaimRow,10 DecisionRow,11 DiscussionRow,12 EnvValueRow,13 LandingRow,14 LayerReadRow,15 LayerRow,
58 unmodified lines
74 })),75 decisions: tableOf("decisions", DecisionRow, ["id"], (row) => ({76 id: row.id,77 })),78 discussions: tableOf("discussions", DiscussionRow, ["id"], (row) => ({79 id: row.id,80 })),81 envValues: tableOf("env_values", EnvValueRow, ["key"], (row) => ({82 key: row.key,83 })),84 landings: tableOf("landings", LandingRow, ["sha"], (row) => ({
83 unmodified lines
168 yield* upsert(QueueTable, writes.queue === undefined ? [] : [writes.queue]);169 yield* upsert(Tables.landings, writes.landings ?? []);170 yield* upsert(Tables.proposals, writes.proposals ?? []);171 yield* upsert(Tables.decisions, writes.decisions ?? []);172 yield* upsert(Tables.discussions, writes.discussions ?? []);173 yield* upsert(Tables.ratchets, writes.ratchets ?? []);174 yield* upsert(Tables.pushEvents, writes.pushEvents ?? []);175 yield* upsert(EventTable, events);176 yield* upsert(Tables.outbox, writes.outbox ?? []);
8 unmodified lines
modified:packages/project/src/projection-d1/projection.ts+1 added
209 unmodified lines
210 ...wanted(ask.ask, ask.want),211 ],212 Claimed: ({ ask }) => [claims(ask, 1)],213 Decided: () => unkept,214 DiscussionPosted: () => [],215 Judged: refusedRow,216 Landed: ({ landing }) => [217 ...landedRow({ landing }),218 sql`UPDATE projects SET landed_at = ${DateTime.formatIso(landing.landedAt)}
112 unmodified lines
modified:packages/project/src/deciders.ts+172 added-4 removed
11 unmodified lines
12import type { ConfigFile, Evidence } from "@repo/protocol/domain/common";13import type { AgentTrailer, Credit } from "@repo/protocol/domain/credit";14import { DecisionSubject } from "@repo/protocol/domain/decision";15import type { Choice, Decision, Today } from "@repo/protocol/domain/decision";16import { listingOf as discussionListingOf } from "@repo/protocol/domain/discussion";17import type {18 Discussion,19 DiscussionListing,20} from "@repo/protocol/domain/discussion";21import type { EnvSchemaView } from "@repo/protocol/domain/env";22import type { LandingView } from "@repo/protocol/domain/landing";23import { Outcome } from "@repo/protocol/domain/outcome";24import type { Policy } from "@repo/protocol/domain/policy";
5 unmodified lines
30import {31 AskId,32 CommitSha,33 DecisionId,34 DiscussionId,35 LandedSha,36 ProposalId,37 RepoName,38 RepoPath,
12 unmodified lines
51 RepoBusy,52 StaleBase,53 TouchedJudge,54 UnknownAsk,55 UnknownDiscussion,56 UnknownProposal,57} from "@repo/protocol/refusal";58import type {59 CapReached,60 DecisionClosed,61 DiscussionClosed,62 DraftInProgress,63 IncompleteBrief,64 NotRedFirst,65 NotSensitive,
28 unmodified lines
94 expireDecisions,95 openDecision,96} from "./attention/decisions.ts";97import type { Decided } from "./attention/decisions.ts";98import { DiscussionCommand, post, promoted } from "./attention/discussions.ts";99import { AttentionEffect, platformHandle } from "./attention/effects.ts";100import {101 draft,102 DraftCommand,
92 unmodified lines
195 readonly requestId: RequestId;196 }197 ) => Effect.Effect<LandReceipt, NotDecider | StaleBase | RepoBusy>;198 readonly ledger: (caller: Principal) => Effect.Effect<Ledger>;199 readonly listDiscussions: (200 caller: Principal201 ) => Effect.Effect<{ readonly discussions: readonly DiscussionListing[] }>;202 readonly postDiscussion: (203 caller: Person,204 input: {205 readonly body?: string;206 readonly discussion?: DiscussionId;207 readonly title?: string;208 }209 ) => Effect.Effect<210 { readonly discussion: Discussion },211 UnknownDiscussion | DiscussionClosed | Denounced | CapReached212 >;213 readonly proposeAsk: (214 caller: Person,215 input: {216 readonly discussion?: DiscussionId;217 readonly draft?: true;218 readonly files?: Array.NonEmptyReadonlyArray<ComposedFile>;219 readonly sealed?: { readonly head: CommitSha };220 readonly territory?: string;221 readonly want: string;222 }223 ) => Effect.Effect<224 { readonly proposal: Proposal },201 Denounced | CapReached | NotVouched225 | Denounced226 | CapReached227 | NotVouched228 | NotDecider229 | UnknownDiscussion230 | DiscussionClosed231 >;232 readonly setEnv: (233 caller: Person,234 input: {
15 unmodified lines
250 ) => Effect.Effect<251 { readonly proposal: Proposal },252 UnknownProposal | ProposalClosed | NotDecider | DraftInProgress | CapReached253 >;254 readonly showDiscussion: (255 caller: Principal,256 discussion: DiscussionId257 ) => Effect.Effect<{ readonly discussion: Discussion }, UnknownDiscussion>;258 readonly showProposal: (259 caller: Principal,260 proposal: ProposalId261 ) => Effect.Effect<
24 unmodified lines
286 readonly row: ClaimRow;287 readonly state: ClaimState;288 }[];289 readonly decisions: readonly Decision[];290 readonly discussions: readonly Discussion[];291 readonly landings: readonly LandingView[];292 readonly policy: Option.Option<Policy>;293 readonly project: Option.Option<ProjectRow>;294 readonly proposals: readonly Proposal[];295}296297export interface DeciderWrites {298 readonly decisions: Map<DecisionId, Decision>;299 readonly discussions: Map<DiscussionId, Discussion>;300 readonly events: ProjectEventInput[];301 readonly landings: LandingView[];302 readonly outbox: OutboxRow[];303 readonly project: Map<"row", ProjectRow>;
401 unmodified lines
705706 const decisionsNow = (h: H, writes: W) =>707 overlaid(h.decisions, writes.decisions);708709 const discussionsNow = (h: H, writes: W) =>710 overlaid(h.discussions, writes.discussions);711712 const recordLanding = (713 h: H,714 writes: W,715 landing: LandingView,
320 unmodified lines
1036 const who = standing(policy, [], caller.handle);1037 const files = input.files ?? [];1038 const territory = Option.fromUndefinedOr(input.territory);10391040 const id = ProposalId.make(1041 minted("prop", proposalsNow(h, writes).length)1042 );10431044 // Only a maintainer turns a thread into a proposal, and only an open one.1045 const fromThread = yield* Option.match(1046 Option.fromUndefinedOr(input.discussion),1047 {1048 onNone: () => Effect.succeedNone,1049 onSome: (named) =>1050 Effect.gen(function* () {1051 const thread = Array.findFirst(1052 discussionsNow(h, writes),1053 (each) => each.id === named1054 );10551056 if (Option.isNone(thread)) {1057 return yield* new UnknownDiscussion({ discussion: named });1058 }10591060 if (!isDecider(policy, caller.handle)) {1061 return yield* new NotDecider({});1062 }10631064 return Option.some(1065 yield* Effect.fromResult(promoted(thread.value, id))1066 );1067 }),1068 }1069 );10701071 const area = Option.map(territory, (named) =>1072 Option.getOrElse(1073 Option.map(moduleOf(policy, named), ({ module }) => module),1074 () => named
18 unmodified lines
1093 ProposalCommand.Propose({1094 capped: capped(who),1095 denounced: who === "denounced",1096 files: files.map(({ path }) => path),1028 id: ProposalId.make(1029 minted("prop", proposalsNow(h, writes).length)1030 ),1097 id,1098 openCount: openCountOf(h, writes, caller.handle),1099 project: name,1100 recordInArea,1101 sealed: Option.map(
11 unmodified lines
1113 now1114 )1115 );11161117 if (Option.isSome(fromThread)) {1118 writes.discussions.set(fromThread.value.id, fromThread.value);1119 }11201121 if (input.draft === true) {1122 // A proposal just opened drafts its first round: nothing refuses it.1123 return yield* Effect.orDie(1124 startDraft(h, writes, now, {
23 unmodified lines
1148 row,1149 });1150 });11511152 const openDiscussionsOf = (h: H, writes: W, handle: Handle) =>1153 discussionsNow(h, writes).filter(1154 ({ opener, state }) => state === "open" && sameHandle(opener, handle)1155 ).length;11561157 const postBody =1158 (caller: Person, input: Parameters<DeciderApi["postDiscussion"]>[1]) =>1159 (h: H, writes: W, now: DateTime.Utc) =>1160 Effect.gen(function* () {1161 const live = liveOf(h);11621163 // Before a policy, nobody is denounced and the public cap holds.1164 const who = Option.match(live, {1165 onNone: () => "unknown" as const,1166 onSome: ({ policy }) => standing(policy, [], caller.handle),1167 });11681169 const command = yield* Option.match(1170 Option.fromUndefinedOr(input.discussion),1171 {1172 onNone: () =>1173 Effect.succeed(1174 DiscussionCommand.Open({1175 body: Option.fromUndefinedOr(input.body),1176 capped: capped(who),1177 denounced: who === "denounced",1178 id: DiscussionId.make(1179 minted("disc", discussionsNow(h, writes).length)1180 ),1181 openCount: openDiscussionsOf(h, writes, caller.handle),1182 project: name,1183 // The contract's filter makes a title certain here.1184 title: input.title ?? "",1185 who: caller,1186 })1187 ),1188 onSome: (named) =>1189 Effect.map(1190 Effect.fromOption(1191 Array.findFirst(1192 discussionsNow(h, writes),1193 (each) => each.id === named1194 )1195 ).pipe(1196 Effect.mapError(1197 () => new UnknownDiscussion({ discussion: named })1198 )1199 ),1200 (discussion) =>1201 DiscussionCommand.Reply({1202 // The contract's filter makes a body certain here.1203 body: input.body ?? "",1204 denounced: who === "denounced",1205 discussion,1206 who: caller,1207 })1208 ),1209 }1210 );12111212 const { discussion, effects } = yield* Effect.fromResult(1213 post(command, now)1214 );12151216 writes.discussions.set(discussion.id, discussion);1217 emitted(writes, effects);12181219 return { discussion };1220 });12211222 const byLastPost = Order.mapInput(1223 Order.flip(DateTime.Order),1224 (listing: DiscussionListing) => listing.lastPostAt1225 );12261227 const discussionsOf = Effect.map(kernel.read, (h) => ({1228 discussions: Array.sort(h.discussions.map(discussionListingOf), byLastPost),1229 }));12301231 const discussionOf = (discussion: DiscussionId) =>1232 Effect.flatMap(kernel.read, (h) =>1233 Option.match(1234 Array.findFirst(h.discussions, ({ id }) => id === discussion),1235 {1236 onNone: () => Effect.fail(new UnknownDiscussion({ discussion })),1237 onSome: (found) => Effect.succeed({ discussion: found }),1238 }1239 )1240 );12411242 const flagBody =1243 (caller: Person, input: Parameters<DeciderApi["flagAsk"]>[1]) =>1244 (h: H, writes: W, now: DateTime.Utc) =>1245 Effect.gen(function* () {
1084 unmodified lines
2330 queue: AnswerQueue,2331 caller: Person,2332 input: Parameters<DeciderApi["land"]>[1]2333 ) => kernel.write(queue, landBody(queue, caller, input)),2334 listDiscussions: discussionsOf,2335 postDiscussion: (2336 queue: AnswerQueue,2337 caller: Person,2338 input: Parameters<DeciderApi["postDiscussion"]>[1]2339 ) => kernel.write(queue, postBody(caller, input)),2340 proposeAsk: (2341 queue: AnswerQueue,2342 caller: Person,2343 input: Parameters<DeciderApi["proposeAsk"]>[1]2344 ) => kernel.write(queue, proposeBody(caller, input)),2345 showDiscussion: discussionOf,2346 showProposal: proposalOf,2347 today: todayOf,2348 vouch: (2349 queue: AnswerQueue,
5 unmodified lines
modified:packages/project/src/project-store.ts+3 added
7 unmodified lines
8 AskRow,9 AttemptRow,10 ClaimRow,11 DecisionRow,12 DiscussionRow,13 EnvValueRow,14 EventRow,15 LandingRow,16 LayerRead,
17 unmodified lines
34 readonly asks: readonly AskRow[];35 readonly attempts: readonly AttemptRow[];36 readonly claims: readonly ClaimRow[];37 readonly decisions: readonly DecisionRow[];38 readonly discussions: readonly DiscussionRow[];39 readonly envValues: readonly EnvValueRow[];40 readonly landings: readonly LandingRow[];41 readonly lastSeq: number;42 readonly layers: readonly LayerRow[];
10 unmodified lines
53 readonly asks?: readonly AskRow[];54 readonly attempts?: readonly AttemptRow[];55 readonly claims?: readonly ClaimRow[];56 readonly decisions?: readonly DecisionRow[];57 readonly discussions?: readonly DiscussionRow[];58 readonly envValues?: readonly EnvValueRow[];59 readonly events?: readonly ProjectEventInput[];60 readonly landings?: readonly LandingRow[];61 readonly layerReads?: readonly LayerRead[];
48 unmodified lines
modified:packages/project/src/project.ts+52 added
62 unmodified lines
63 Land,64 LandingOf,65 LedgerOf,66 ListAsks,67 ListDiscussions,68 OpenAsk,69 PolicyOf,70 PostDiscussion,71 ProposeAsk,72 Release,73 SetEnv,74 ShowAsk,75 ShowDiscussion,76 ShowProposal,77 Status,78 SubmitAnswer,79 TodayOf,
19 unmodified lines
99import type { Evidence } from "@repo/protocol/domain/common";100import type { AgentTrailer, Credit } from "@repo/protocol/domain/credit";101import { DecisionSubject } from "@repo/protocol/domain/decision";102import type { Choice, Decision } from "@repo/protocol/domain/decision";103import type { Discussion } from "@repo/protocol/domain/discussion";104import { ProjectEvent } from "@repo/protocol/domain/event";105import type { AskKind } from "@repo/protocol/domain/kind";106import { LandingView } from "@repo/protocol/domain/landing";107import { Outcome } from "@repo/protocol/domain/outcome";
3 unmodified lines
111import type { Proposal } from "@repo/protocol/domain/proposal";112import {113 AskId,114 CommitSha,115 DiscussionId,116 EnvKey,117 Handle,118 LandedSha,119 LayerName,
548 unmodified lines
668 args: [Principal],669 error: ListAsks.errorSchema,670 success: ListAsks.successSchema,671 },672 listDiscussions: {673 args: [Principal],674 error: Schema.Never,675 success: ListDiscussions.successSchema,676 },677 onAlarm: { args: [], error: Schema.Never, success: Schema.Void },678 openAsk: {679 args: [680 Person,
6 unmodified lines
687 args: [],688 error: Schema.Never,689 success: PolicyOf.successSchema,690 },691 postDiscussion: {692 args: [693 Person,694 PostDiscussion.payloadSchema.mapFields(Struct.omit(["project"])),695 ],696 error: PostDiscussion.errorSchema,697 success: PostDiscussion.successSchema,698 },699 proposeAsk: {700 args: [701 Person,702 // The check reads only `draft`, `files` and `sealed`, which it keeps.
66 unmodified lines
769 args: [Principal, AskId],770 error: ShowAsk.errorSchema,771 success: ShowAsk.successSchema,772 },773 showDiscussion: {774 args: [Principal, DiscussionId],775 error: ShowDiscussion.errorSchema,776 success: ShowDiscussion.successSchema,777 },778 showProposal: {779 args: [Principal, ProposalId],780 error: ShowProposal.errorSchema,781 success: ShowProposal.successSchema,
174 unmodified lines
956 readonly answers: readonly Answered[];957 readonly asks: ReadonlyMap<AskId, Ask>;958 readonly claims: readonly Claimed[];959 readonly decisions: readonly Decision[];960 readonly discussions: readonly Discussion[];961 readonly landings: readonly LandingView[];962 readonly lastSeq: number;963 readonly outbox: readonly OutboxRow[];964 readonly policy: Option.Option<Policy>;
10 unmodified lines
975 readonly asks: Map<AskId, Ask>;976 readonly attempts: Map<string, AttemptRow>;977 readonly claims: Map<string, ClaimRow>;978 readonly decisions: Map<DecisionId, Decision>;979 readonly discussions: Map<DiscussionId, Discussion>;980 readonly envValues: Map<EnvKey, EnvValueRow>;981 readonly events: ProjectEventInput[];982 readonly landings: LandingView[];983 readonly layerReads: LayerRead[];
12 unmodified lines
996 asks: new Map(),997 attempts: new Map(),998 claims: new Map(),999 decisions: new Map(),1000 discussions: new Map(),1001 envValues: new Map(),1002 events: [],1003 landings: [],1004 layerReads: [],
13 unmodified lines
1018 writes.asks.size,1019 writes.attempts.size,1020 writes.claims.size,1021 writes.decisions.size,1022 writes.discussions.size,1023 writes.envValues.size,1024 writes.events.length,1025 writes.landings.length,1026 writes.layerReads.length,
58 unmodified lines
1085 Tables.decisions,1086 held.decisions,1087 writes.decisions.values()1088 ),1089 discussions: overlaid(1090 Tables.discussions,1091 held.discussions,1092 writes.discussions.values()1093 ),1094 envValues: overlaid(1095 Tables.envValues,1096 held.envValues,1097 writes.envValues.values()
812 unmodified lines
1910 answers,1911 asks: new Map(snapshot.asks.map((ask) => [ask.id, ask])),1912 claims,1913 decisions: snapshot.decisions,1914 discussions: snapshot.discussions,1915 landings: snapshot.landings,1916 lastSeq: snapshot.lastSeq,1917 outbox: snapshot.outbox,1918 policy,
213 unmodified lines
2132 asks: [...writes.asks.values()],2133 attempts: [...writes.attempts.values()],2134 claims: [...writes.claims.values()],2135 decisions: [...writes.decisions.values()],2136 discussions: [...writes.discussions.values()],2137 envValues: [...writes.envValues.values()],2138 events: writes.events,2139 landings: writes.landings,2140 layerReads: writes.layerReads,
3401 unmodified lines
5542 ask.state === "closed" ? [] : [listingOf(ask)]5543 ),5544 }))5545 ),5546 listDiscussions: (caller) =>5547 checked(5548 MethodSchemas.listDiscussions,5549 [caller],5550 decided.listDiscussions5551 ),5552 onAlarm: () => checked(MethodSchemas.onAlarm, [], alarmed(api)),5553 openAsk: (caller, input) =>5554 checked(5555 MethodSchemas.openAsk,5556 [caller, input],5557 write(api, openBody(caller, input))5558 ),5559 policy: () => checked(MethodSchemas.policy, [], policyStatus),5560 postDiscussion: (caller, input) =>5561 checked(5562 MethodSchemas.postDiscussion,5563 [caller, input],5564 decided.postDiscussion(api, caller, input)5565 ),5566 proposeAsk: (caller, input) =>5567 checked(5568 MethodSchemas.proposeAsk,5569 [caller, input],
93 unmodified lines
5663 onSome: (ask) => Effect.succeed({ ask, brief: briefOf(ask) }),5664 })5665 )5666 ),5667 showDiscussion: (caller, discussion) =>5668 checked(5669 MethodSchemas.showDiscussion,5670 [caller, discussion],5671 decided.showDiscussion(discussion)5672 ),5673 showProposal: (caller, proposal) =>5674 checked(5675 MethodSchemas.showProposal,5676 [caller, proposal],
37 unmodified lines
added:packages/project/test/discussions.test.ts+336 added
1import { describe, expect, it } from "@effect/vitest";2import { ProjectEvent } from "@repo/protocol/domain/event";3import {4 DiscussionId,5 Handle,6 ProposalId,7 RepoName,8 keyOf,9} from "@repo/protocol/ids";10import { Anonymous, Person } from "@repo/protocol/principal";11import {12 CapReached,13 Denounced,14 DiscussionClosed,15 NotDecider,16 UnknownDiscussion,17} from "@repo/protocol/refusal";18import { advanceTo } from "@repo/testkit/clock";19import type { Files } from "@repo/testkit/git-client";20import { aProject, withVouches } from "@repo/testkit/scenarios";21import { Array, DateTime, Effect, Option } from "effect";2223import { DISCUSSIONS_PER_PERSON } from "../src/attention/discussions.ts";24import { ProjectStore } from "../src/project-store.ts";25import type { ProjectApi } from "../src/project.ts";26import { projectService } from "../src/project.ts";27import { Pusher, worldOf } from "./world.ts";28import type { StoreKind } from "./world.ts";2930const people = ["bob", "carol", "dave", "erin"];3132// carol is vouched for, erin denounced, dave and bob unknown to the vouch file.33const scenario = aProject({ people }).pipe(withVouches(["carol"], ["erin"]));3435const { project } = scenario;3637const repo = RepoName.make(keyOf(project));3839const person = (name: string) =>40 Person.make({ handle: scenario.people.get(name) ?? scenario.initializer });4142const alice = person("alice");4344const carol = person("carol");4546const dave = person("dave");4748const erin = person("erin");4950const anyone = Anonymous.make({});5152const first = DiscussionId.make("disc-000001");5354const unknown = DiscussionId.make("disc-999999");5556const start: Files = [57 ["package.json", '{ "name": "alice/datekit" }\n'],58 ["src/parse.ts", "export const parse = (s) => ({});\n"],59];6061const made = Effect.gen(function* () {62 yield* advanceTo("2026-10-07T12:00:00Z");6364 const api = yield* projectService(project);6566 yield* api.initProject(alice, {});6768 const tip = yield* Pusher.use((pusher) =>69 pusher.push(repo, Option.none(), start, "Start")70 );7172 yield* api.recordFirstPush(alice, tip);7374 return api;75});7677const minutesOn = (count: number) =>78 advanceTo(79 DateTime.formatIso(80 DateTime.add(DateTime.makeUnsafe("2026-10-07T12:00:00Z"), {81 minutes: count,82 })83 )84 );8586const talking = (api: ProjectApi) =>87 Effect.gen(function* () {88 yield* minutesOn(1);8990 const opened = yield* api.postDiscussion(dave, {91 body: "Weeks start on Monday in ISO 8601; which does parse assume?",92 title: "Which day starts a week?",93 });9495 yield* minutesOn(2);9697 const replied = yield* api.postDiscussion(carol, {98 body: "ISO, always.",99 discussion: opened.discussion.id,100 });101102 yield* minutesOn(3);103104 const titleOnly = yield* api.postDiscussion(dave, {105 title: "Does format take a locale?",106 });107108 const refused = yield* Effect.all({109 erinOpens: Effect.flip(110 api.postDiscussion(erin, { body: "Hello", title: "A thread" })111 ),112 erinReplies: Effect.flip(113 api.postDiscussion(erin, { body: "Hello", discussion: first })114 ),115 nowhere: Effect.flip(116 api.postDiscussion(dave, { body: "Hello", discussion: unknown })117 ),118 });119120 const listed = yield* api.listDiscussions(anyone);121 const shown = yield* api.showDiscussion(anyone, first);122 const events = yield* api.events(0, 100);123124 return { events, listed, opened, refused, replied, shown, titleOnly };125 });126127const promoting = (api: ProjectApi) =>128 Effect.gen(function* () {129 yield* minutesOn(1);130131 const { discussion } = yield* api.postDiscussion(dave, {132 body: "Could parse take ISO week dates too?",133 title: "ISO week dates",134 });135136 const daveProposes = yield* Effect.flip(137 api.proposeAsk(dave, {138 discussion: discussion.id,139 want: "Parse ISO week dates.",140 })141 );142143 const carolProposes = yield* Effect.flip(144 api.proposeAsk(carol, {145 discussion: discussion.id,146 want: "Parse ISO week dates.",147 })148 );149150 const nowhere = yield* Effect.flip(151 api.proposeAsk(alice, { discussion: unknown, want: "Parse ISO weeks." })152 );153154 yield* minutesOn(2);155156 const { proposal } = yield* api.proposeAsk(alice, {157 discussion: discussion.id,158 want: "Parse ISO week dates.",159 });160161 const after = yield* api.showDiscussion(anyone, discussion.id);162163 const closed = yield* Effect.all({164 again: Effect.flip(165 api.proposeAsk(alice, {166 discussion: discussion.id,167 want: "Parse ISO week dates, again.",168 })169 ),170 reply: Effect.flip(171 api.postDiscussion(carol, { body: "Yes", discussion: discussion.id })172 ),173 });174175 const stored = yield* ProjectStore.use((store) => store.load());176177 return {178 after,179 carolProposes,180 closed,181 daveProposes,182 nowhere,183 proposal,184 stored: stored.discussions,185 };186 });187188const filling = (api: ProjectApi) =>189 Effect.gen(function* () {190 yield* Effect.forEach(191 Array.range(1, DISCUSSIONS_PER_PERSON),192 (index) =>193 Effect.andThen(194 minutesOn(index),195 api.postDiscussion(dave, { title: `Thread ${index}` })196 ),197 { discard: true }198 );199200 const daveAtCap = yield* Effect.flip(201 api.postDiscussion(dave, { title: "One more" })202 );203204 const daveReplies = yield* api.postDiscussion(dave, {205 body: "Still talking",206 discussion: first,207 });208209 const carolBeyond = yield* Effect.forEach(210 Array.range(1, DISCUSSIONS_PER_PERSON + 1),211 (index) =>212 api.postDiscussion(carol, { title: `Carol's thread ${index}` }),213 { discard: true }214 ).pipe(Effect.as("allowed"));215216 return { carolBeyond, daveAtCap, daveReplies };217 });218219describe.each<StoreKind>(["memory", "sqlite"])(220 "discussions over the %s store",221 (kind) => {222 const world = worldOf(scenario, kind);223224 const talked = Effect.flatMap(made, talking).pipe(Effect.provide(world));225226 const promoted = Effect.flatMap(made, promoting).pipe(227 Effect.provide(world)228 );229230 it.effect(231 "take a thread from anyone not denounced, and a reply from them too",232 () =>233 Effect.map(talked, (run) => {234 expect(run.opened.discussion).toMatchObject({235 id: first,236 opener: Handle.make("dave"),237 project,238 state: "open",239 title: "Which day starts a week?",240 });241 expect(run.opened.discussion.posts).toHaveLength(1);242 expect(243 run.replied.discussion.posts.map(({ body, by }) => [by, body])244 ).toStrictEqual([245 [246 "dave",247 "Weeks start on Monday in ISO 8601; which does parse assume?",248 ],249 ["carol", "ISO, always."],250 ]);251 // A thread opened with a title alone reads the title as its first post.252 expect(253 run.titleOnly.discussion.posts.map(({ body }) => body)254 ).toStrictEqual(["Does format take a locale?"]);255 expect(run.refused).toStrictEqual({256 erinOpens: new Denounced({}),257 erinReplies: new Denounced({}),258 nowhere: new UnknownDiscussion({ discussion: unknown }),259 });260 })261 );262263 it.effect(264 "list newest post first with the posts counted, show one whole, and tell each post",265 () =>266 Effect.map(talked, (run) => {267 expect(run.shown.discussion).toStrictEqual(run.replied.discussion);268 expect(269 run.listed.discussions.map(({ id, posts, state }) => [270 id,271 posts,272 state,273 ])274 ).toStrictEqual([275 ["disc-000002", 1, "open"],276 ["disc-000001", 2, "open"],277 ]);278 expect(279 run.events.flatMap(({ event }) =>280 ProjectEvent.guards.DiscussionPosted(event)281 ? [[event.discussion, event.by]]282 : []283 )284 ).toStrictEqual([285 ["disc-000001", "dave"],286 ["disc-000001", "carol"],287 ["disc-000002", "dave"],288 ]);289 })290 );291292 it.effect("become a proposal only by a maintainer", () =>293 Effect.map(promoted, (run) => {294 expect(run.daveProposes).toStrictEqual(new NotDecider({}));295 expect(run.carolProposes).toStrictEqual(new NotDecider({}));296 expect(run.nowhere).toStrictEqual(297 new UnknownDiscussion({ discussion: unknown })298 );299 expect(run.proposal.id).toBe(ProposalId.make("prop-000001"));300 expect(run.after.discussion).toMatchObject({301 proposal: run.proposal.id,302 state: "proposed",303 });304 })305 );306307 it.effect(308 "once proposed, take no more posts and no second proposal, and are kept so",309 () =>310 Effect.map(promoted, (run) => {311 expect(run.closed).toStrictEqual({312 again: new DiscussionClosed({ discussion: first }),313 reply: new DiscussionClosed({ discussion: first }),314 });315 expect(run.stored).toStrictEqual([run.after.discussion]);316 })317 );318 }319);320321describe("the cap on open discussions", () => {322 it.effect(323 "holds a person the project has not vouched for to twenty, and a vouched one to none",324 () =>325 Effect.gen(function* () {326 const run = yield* Effect.flatMap(made, filling);327328 expect(run.daveAtCap).toStrictEqual(329 new CapReached({ cap: DISCUSSIONS_PER_PERSON, limit: "discussions" })330 );331 // The cap is on threads held open, not on posts.332 expect(run.daveReplies.discussion.posts).toHaveLength(2);333 expect(run.carolBeyond).toBe("allowed");334 }).pipe(Effect.provide(worldOf(scenario, "memory")))335 );336});
modified:packages/project/test/project-store-sqlite.test.ts+1 added
19 unmodified lines
20 expect(yield* migrate).toStrictEqual([21 [1, "project_state"],22 [2, "visibility"],23 [3, "drop_budget_days"],24 [4, "discussions"],25 ]);26 expect(yield* migrate).toStrictEqual([]);27 }).pipe(Effect.provide(database))28 );
12 unmodified lines
modified:packages/project/test/project-store.contract.ts+3 added
21 unmodified lines
22 AskRow,23 AttemptRow,24 ClaimRow,25 DecisionRow,26 DiscussionRow,27 EnvValueRow,28 LandingRow,29 LayerReadRow,30 LayerRow,
241 unmodified lines
272 asks: Schema.Array(AskRow),273 attempts: Schema.Array(AttemptRow),274 claims: Schema.Array(ClaimRow),275 decisions: Schema.Array(DecisionRow),276 discussions: Schema.Array(DiscussionRow),277 envValues: Schema.Array(EnvValueRow),278 landings: Schema.Array(LandingRow),279 lastSeq: Schema.Int,280 layers: Schema.Array(LayerRow),
10 unmodified lines
291 asks: [],292 attempts: [],293 claims: [],294 decisions: [],295 discussions: [],296 envValues: [],297 landings: [],298 lastSeq: 0,299 layers: [],
460 unmodified lines
added:packages/protocol/src/domain/discussion.ts+68 added
1import { Array, Schema } from "effect";23import { DiscussionId, Handle, ProjectName, ProposalId } from "../ids.ts";4import { NoneOrMore } from "./common.ts";56export const DiscussionState = Schema.Literals(["open", "closed", "proposed"]);78export type DiscussionState = typeof DiscussionState.Type;910export const DiscussionTitle = Schema.NonEmptyString.check(11 Schema.isMaxLength(200)12);1314export const PostBody = Schema.NonEmptyString.check(Schema.isMaxLength(10_000));1516export const DiscussionPost = Schema.Struct({17 at: Schema.DateTimeUtcFromString,18 body: PostBody,19 by: Handle,20});2122export type DiscussionPost = typeof DiscussionPost.Type;2324/** A thread: its first post is the opener's, and `proposal` names the proposal a maintainer turned it into. */25export const Discussion = Schema.Struct({26 id: DiscussionId,27 openedAt: Schema.DateTimeUtcFromString,28 opener: Handle,29 posts: Schema.NonEmptyArray(DiscussionPost),30 project: ProjectName,31 proposal: Schema.optionalKey(ProposalId),32 state: DiscussionState,33 title: DiscussionTitle,34});3536export type Discussion = typeof Discussion.Type;3738/** A thread in a list: its posts counted, not carried. */39export const DiscussionListing = Schema.Struct({40 id: DiscussionId,41 lastPostAt: Schema.DateTimeUtcFromString,42 openedAt: Schema.DateTimeUtcFromString,43 opener: Handle,44 posts: NoneOrMore,45 project: ProjectName,46 proposal: Schema.optionalKey(ProposalId),47 state: DiscussionState,48 title: DiscussionTitle,49});5051export type DiscussionListing = typeof DiscussionListing.Type;5253export const listingOf = (discussion: Discussion): DiscussionListing => {54 const listing = {55 id: discussion.id,56 lastPostAt: Array.lastNonEmpty(discussion.posts).at,57 openedAt: discussion.openedAt,58 opener: discussion.opener,59 posts: discussion.posts.length,60 project: discussion.project,61 state: discussion.state,62 title: discussion.title,63 };6465 return discussion.proposal === undefined66 ? listing67 : { ...listing, proposal: discussion.proposal };68};
modified:packages/protocol/src/domain/event.ts+2 added
2 unmodified lines
3import {4 AskId,5 CommitSha,6 DecisionId,7 DiscussionId,8 Handle,9 LandedSha,10 ProposalId,11} from "../ids.ts";
9 unmodified lines
21 AskClosed: { ...stamp, ask: AskId, landing: LandedSha },22 AskOpened: { ...stamp, ask: AskListing },23 Claimed: { ...stamp, ask: AskId, claimant: Handle },24 Decided: { ...stamp, choice: Choice, decision: DecisionId },25 DiscussionPosted: { ...stamp, by: Handle, discussion: DiscussionId },26 Judged: { ...stamp, ask: AskId, head: CommitSha, outcome: Outcome },27 Landed: { ...stamp, landing: LandingView },28 Lapsed: { ...stamp, ask: AskId },29 LedgerAppended: { ...stamp, entry: LedgerEntry },
8 unmodified lines
modified:packages/protocol/src/contracts.ts+126 added-2 removed
32 unmodified lines
33 WhyView,34} from "./domain/code.ts";35import { ConfigFile, NoneOrMore } from "./domain/common.ts";36import { Choice, Decision, Today } from "./domain/decision.ts";37import {38 Discussion,39 DiscussionListing,40 DiscussionTitle,41 PostBody,42} from "./domain/discussion.ts";43import { EnvSchemaView } from "./domain/env.ts";44import { ProjectEvent } from "./domain/event.ts";45import { FrontPageEntry, ProjectListing } from "./domain/front-page.ts";46import { LandingView } from "./domain/landing.ts";
5 unmodified lines
52import {53 AskId,54 CommitSha,55 DecisionId,56 DiscussionId,57 EnvKey,58 Handle,59 KindName,60 LandedSha,
11 unmodified lines
72 CapReached,73 ClaimLapsed,74 DecisionClosed,75 Denounced,76 DiscussionClosed,77 DraftInProgress,78 ImportFailed,79 NotYourNamespace,80 IncompleteBrief,
12 unmodified lines
93 TouchedJudge,94 UnknownAsk,95 UnknownCommit,96 UnknownDecision,97 UnknownDiscussion,98 UnknownEnvItem,99 UnknownPath,100 UnknownProject,101 UnknownProposal,
36 unmodified lines
138 land: ["rpc", "mcp", "cli"],139 landing: SurfaceName.literals,140 ledger: SurfaceName.literals,141 listAsks: SurfaceName.literals,142 listDiscussions: SurfaceName.literals,143 // A commit's diff and every path stay off MCP: no cap fits a transcript.144 // No command: git reads code locally.145 listPaths: ["rpc", "web"],146 listProjects: SurfaceName.literals,147 listRefs: ["rpc", "mcp", "web"],148 log: ["rpc", "mcp", "web"],149 openAsk: ["rpc", "mcp", "cli"],150 // The web adds no form for what the CLI does: a post is made from a terminal.151 postDiscussion: ["rpc", "mcp", "cli"],152 projectPolicy: SurfaceName.literals,153 proposeAsk: SurfaceName.literals,154 readFile: ["rpc", "mcp", "web"],155 readTree: ["rpc", "mcp", "web"],
3 unmodified lines
159 // A value must never pass through an agent's transcript, so never MCP.160 setEnv: ["rpc", "cli"],161 showAsk: SurfaceName.literals,162 showCommit: ["rpc", "web"],163 showDiscussion: SurfaceName.literals,164 showProposal: SurfaceName.literals,165 status: SurfaceName.literals,166 submitAnswer: ["rpc", "mcp", "cli"],167 today: SurfaceName.literals,
490 unmodified lines
658 .annotate(NeedsApproval, false)659 .annotate(Cli, { name: "proposal", positional: ["proposal"] })660 .annotate(Surfaces, servedOn.showProposal) {}661662export class ListDiscussions extends Rpc.make("listDiscussions", {663 error: UnknownProject,664 payload: { project: ProjectName },665 success: Schema.Struct({ discussions: Schema.Array(DiscussionListing) }),666})667 .annotate(668 Description,669 "List a project's discussions, newest post first: each thread's title, opener, state and the proposal it became."670 )671 .annotate(Audience, "public")672 .annotate(Visibility, "public")673 .annotate(ReadOnly, true)674 .annotate(Idempotent, true)675 .annotate(Destructive, false)676 .annotate(NeedsApproval, false)677 .annotate(Cli, { name: "discussions" })678 .annotate(Surfaces, servedOn.listDiscussions) {}679680export class ShowDiscussion extends Rpc.make("showDiscussion", {681 error: Schema.Union([UnknownProject, UnknownDiscussion]),682 payload: {683 discussion: described(DiscussionId, "The discussion to show"),684 project: ProjectName,685 },686 success: Schema.Struct({ discussion: Discussion }),687})688 .annotate(689 Description,690 "Show one discussion: its posts in order, its state and the proposal it became."691 )692 .annotate(Audience, "public")693 .annotate(Visibility, "public")694 .annotate(ReadOnly, true)695 .annotate(Idempotent, true)696 .annotate(Destructive, false)697 .annotate(NeedsApproval, false)698 .annotate(Cli, { name: "discussion", positional: ["discussion"] })699 .annotate(Surfaces, servedOn.showDiscussion) {}700701export class InitProject extends Rpc.make("initProject", {702 error: Schema.Union([ProjectExists, NotYourNamespace, ImportFailed]),703 payload: {704 import: Schema.optionalKey(ImportSource),
64 unmodified lines
769 : "a drafted proposal carries neither files nor a sealed answer"770);771772export class ProposeAsk extends Rpc.make("proposeAsk", {721 error: Schema.Union([UnknownProject, Denounced, CapReached, NotVouched]),773 error: Schema.Union([774 UnknownProject,775 Denounced,776 CapReached,777 NotVouched,778 NotDecider,779 UnknownDiscussion,780 DiscussionClosed,781 ]),782 payload: Schema.Struct({783 /** The discussion this proposal comes from; a maintainer alone may name one, and it marks the thread proposed. */784 discussion: Schema.optionalKey(785 described(786 DiscussionId,787 "The discussion this proposal comes from; a maintainer alone may name one"788 )789 ),790 draft: Schema.optionalKey(791 described(792 Schema.Literal(true),793 "Have the platform's agent draft the ask file and its failing check"
26 unmodified lines
820 success: Schema.Struct({ proposal: Proposal }),821})822 .annotate(823 Description,757 "Propose an ask, optionally with a sealed answer; the proposal expires unless a maintainer accepts it."824 "Propose an ask, optionally with a sealed answer, or, as a maintainer, from a discussion; the proposal expires unless a maintainer accepts it."825 )826 .annotate(Audience, "signedIn")827 .annotate(Visibility, "public")828 .annotate(ReadOnly, false)
58 unmodified lines
887 .annotate(NeedsApproval, false)888 .annotate(Cli, { name: "ask flag", positional: ["ask"] })889 .annotate(Surfaces, servedOn.flagAsk) {}890891const titleOrBody = Schema.makeFilter(892 (payload: {893 readonly body?: string;894 readonly discussion?: string;895 readonly title?: string;896 }) => {897 if (payload.discussion === undefined) {898 return payload.title === undefined899 ? "opening a discussion takes a title"900 : true;901 }902903 return payload.body === undefined904 ? "a reply takes a body"905 : payload.title === undefined || "a reply takes no title";906 }907);908909export class PostDiscussion extends Rpc.make("postDiscussion", {910 error: Schema.Union([911 UnknownProject,912 UnknownDiscussion,913 DiscussionClosed,914 Denounced,915 CapReached,916 ]),917 payload: Schema.Struct({918 body: Schema.optionalKey(described(PostBody, "Your post")),919 discussion: Schema.optionalKey(920 described(921 DiscussionId,922 "The discussion to reply in; leave out to open one"923 )924 ),925 project: ProjectName,926 title: Schema.optionalKey(927 described(DiscussionTitle, "The title of the discussion you open")928 ),929 }).check(titleOrBody),930 success: Schema.Struct({ discussion: Discussion }),931})932 .annotate(933 Description,934 "Post in a project's discussions: with no discussion named, open a thread with a title and an optional body; with one named, reply with a body. Anyone not denounced may."935 )936 .annotate(Audience, "signedIn")937 .annotate(Visibility, "public")938 .annotate(ReadOnly, false)939 .annotate(Idempotent, false)940 .annotate(Destructive, false)941 .annotate(NeedsApproval, false)942 .annotate(Cli, { name: "discussion post", positional: ["discussion"] })943 .annotate(Surfaces, servedOn.postDiscussion) {}944945export class Decide extends Rpc.make("decide", {946 error: Schema.Union([947 UnknownProject,948 UnknownDecision,
300 unmodified lines
1249 ShowCommit,1250 WhyOf,1251 PolicyOf,1252 ShowProposal,1253 ListDiscussions,1254 ShowDiscussion,1255 InitProject,1256 OpenAsk,1257 ProposeAsk,1258 DraftAsk,1259 FlagAsk,1260 PostDiscussion,1261 Decide,1262 Claim,1263 Release,1264 SubmitAnswer,
55 unmodified lines
modified:packages/protocol/src/exit-code.ts+2 added
29 unmodified lines
30 ChecksFailed: ExitCode.dataErr,31 DecisionClosed: ExitCode.noInput,32 Denounced: ExitCode.noPerm,33 DirectPush: ExitCode.noPerm,34 DiscussionClosed: ExitCode.noInput,35 HeldBackFailed: ExitCode.dataErr,36 IncompleteBrief: ExitCode.dataErr,37 LayerContentInPublicTree: ExitCode.dataErr,38 NoAsk: ExitCode.noInput,
12 unmodified lines
51 TouchedJudge: ExitCode.dataErr,52 UnknownAsk: ExitCode.noInput,53 UnknownCommit: ExitCode.noInput,54 UnknownDecision: ExitCode.noInput,55 UnknownDiscussion: ExitCode.noInput,56 UnknownEnvItem: ExitCode.noInput,57 UnknownPath: ExitCode.noInput,58 UnknownProject: ExitCode.noInput,59 UnknownProposal: ExitCode.noInput,
31 unmodified lines
modified:packages/protocol/src/ids.ts+7 added
92 unmodified lines
93);9495export type ProposalId = typeof ProposalId.Type;9697export const DiscussionId = Schema.String.pipe(98 Schema.check(Schema.isPattern(Minted)),99 Schema.brand("DiscussionId")100);101102export type DiscussionId = typeof DiscussionId.Type;103104export const DecisionId = Schema.String.pipe(105 Schema.check(Schema.isPattern(Minted)),106 Schema.brand("DecisionId")107);
392 unmodified lines
modified:packages/protocol/src/refusal.ts+17 added-2 removed
4 unmodified lines
5import {6 AskId,7 CommitSha,8 DecisionId,9 DiscussionId,10 EnvKey,11 Handle,12 LandedSha,13 ProjectName,
69 unmodified lines
83export class CapReached extends Schema.TaggedError<CapReached>()("CapReached", {84 ...Retryable,85 ...nextIs(cli("status")),86 cap: Schema.Int,86 /** Which limit: claims held (also when absent), proposals, or drafts. */87 limit: Schema.optionalKey(Schema.Literals(["claims", "proposals", "drafts"])),87 /** Which limit: claims held (also when absent), proposals, drafts, or discussions. */88 limit: Schema.optionalKey(89 Schema.Literals(["claims", "proposals", "drafts", "discussions"])90 ),91 /** For a rate limit: seconds until one more is let through. */92 retryAfter: Schema.optionalKey(93 Schema.Int.check(Schema.isGreaterThanOrEqualTo(1))94 ),
217 unmodified lines
312 "ProposalClosed",313 { ...Final, ...nextIs(cli("today")), proposal: ProposalId }314) {}315316export class DiscussionClosed extends Schema.TaggedError<DiscussionClosed>()(317 "DiscussionClosed",318 { ...Final, ...nextIs(cli("discussions")), discussion: DiscussionId }319) {}320321export class DraftInProgress extends Schema.TaggedError<DraftInProgress>()(322 "DraftInProgress",323 { ...Retryable, proposal: ProposalId }324) {
45 unmodified lines
370 "UnknownProposal",371 { ...Final, ...nextIs(cli("today")), proposal: ProposalId }372) {}373374export class UnknownDiscussion extends Schema.TaggedError<UnknownDiscussion>()(375 "UnknownDiscussion",376 { ...Final, ...nextIs(cli("discussions")), discussion: DiscussionId }377) {}378379export class ProjectExists extends Schema.TaggedError<ProjectExists>()(380 "ProjectExists",381 { ...Final, ...nextIs(cli("projects")), project: ProjectName }382) {}
90 unmodified lines
473 NotDecider,474 DecisionClosed,475 ProposalClosed,476 DraftInProgress,477 DiscussionClosed,478] as const;479480const lookup = [481 UnknownProject,
2 unmodified lines
484 UnknownDecision,485 UnknownPath,486 UnknownRevision,487 UnknownProposal,488 UnknownDiscussion,489] as const;490491const setup = [ProjectExists, NotYourNamespace, ImportFailed] as const;492
32 unmodified lines
modified:packages/protocol/src/render.ts+8 added-1 removed
20 unmodified lines
21// landed, a proposal decided; a proposal's draft rounds never lift.22const held = {23 claims: (cap) =>24 `you already hold ${counted(cap, "claim")}, the most this project allows`,25 discussions: (cap) =>26 `you already have ${counted(cap, "open discussion")} here, the most this project allows`,27 drafts: (cap) =>28 `this proposal was already drafted ${cap === 1 ? "once" : `${cap} times`}, the most one proposal takes`,29 proposals: (cap) =>30 `you already have ${counted(cap, "open proposal")} here, the most this project allows`,31} as const satisfies Record<CapLimit, (cap: number) => string>;3233const rated = {34 claims: { noun: "claim", verb: "made" },35 discussions: { noun: "post", verb: "made" },36 drafts: { noun: "draft", verb: "started" },37 proposals: { noun: "proposal", verb: "made" },38} as const satisfies Record<CapLimit, { noun: string; verb: string }>;39
47 unmodified lines
87 ClaimLapsed: ({ ask }) => `your claim on ${ask} lapsed`,88 DecisionClosed: ({ decision }) =>89 `${decision} was already decided, or expired to its default`,90 Denounced: () =>88 "this project's vouch file denounces you, so it takes no claims or proposals from you",91 "this project's vouch file denounces you, so it takes no claims, proposals or posts from you",92 DirectPush: ({ ref }) =>93 ref.startsWith(BRANCH)94 ? `main moves only by a landing, so ${ref} takes no direct push; a contributor pushes the answer to the claim's fork, and a maintainer makes a working fork with ${Brand.cli} fork and lands it with ${Brand.cli} land`95 : `${ref} is written by the platform, not pushed; a fork takes branches only, so push your answer with git push ${Brand.slug} HEAD:main`,96 DiscussionClosed: ({ discussion }) =>97 `${discussion} is closed, or became a proposal, so it takes no more posts`,98 DraftInProgress: ({ proposal }) =>99 `the platform is already drafting ${proposal}'s ask`,100 Flake: ({ lane }) =>101 `the ${lane} checks failed, then passed on the same tree; the platform will run them again`,
45 unmodified lines
147 `changes files that decide what the checks do: ${list(paths)}; the checks are fixed for this ask, so put them back, or flag the ask if a check is wrong`,148 UnknownAsk: ({ ask }) => `this project has no ask named ${ask}`,149 UnknownCommit: ({ sha }) => `this project has no commit ${sha}`,150 UnknownDecision: ({ decision }) => `this project has no decision ${decision}`,151 UnknownDiscussion: ({ discussion }) =>152 `this project has no discussion ${discussion}`,153 UnknownEnvItem: ({ key }) => `the env shape has no item ${key}`,154 UnknownPath: ({ commit, path }) =>155 `${short(commit)} has no file or folder at ${path}`,156 UnknownProject: ({ project }) => `no project is named ${project}`,
66 unmodified lines
modified:packages/protocol/src/testing.ts+3 added
33 unmodified lines
34 land: uncalled,35 landing: uncalled,36 ledger: uncalled,37 listAsks: uncalled,38 listDiscussions: uncalled,39 listPaths: uncalled,40 listProjects: uncalled,41 listRefs: uncalled,42 log: uncalled,43 openAsk: uncalled,44 postDiscussion: uncalled,45 projectPolicy: uncalled,46 proposeAsk: uncalled,47 readFile: uncalled,48 readTree: uncalled,
1 unmodified line
50 release: uncalled,51 setEnv: uncalled,52 showAsk: uncalled,53 showCommit: uncalled,54 showDiscussion: uncalled,55 showProposal: uncalled,56 status: uncalled,57 submitAnswer: uncalled,58 today: uncalled,
6 unmodified lines
modified:packages/protocol/test/fixtures/contracts.json+73 added
170 unmodified lines
171 "flags": "iso-week"172 }173 }174 },175 "postDiscussion": {176 "payload": {177 "body": "Weeks start on Monday in ISO 8601, but on Sunday in the US; which does parseISO assume?",178 "project": "oscabriel/datekit",179 "title": "Which day starts a week?"180 },181 "success": {182 "discussion": {183 "id": "disc-000001",184 "openedAt": "2026-10-07T12:00:00.000Z",185 "opener": "dave",186 "posts": [187 {188 "at": "2026-10-07T12:00:00.000Z",189 "body": "Weeks start on Monday in ISO 8601, but on Sunday in the US; which does parseISO assume?",190 "by": "dave"191 }192 ],193 "project": "oscabriel/datekit",194 "state": "open",195 "title": "Which day starts a week?"196 }197 }198 },199 "fork": {200 "payload": {201 "project": "oscabriel/datekit"202 },
800 unmodified lines
1003 }1004 }1005 }1006 },1007 "listDiscussions": {1008 "payload": {1009 "project": "oscabriel/datekit"1010 },1011 "success": {1012 "discussions": [1013 {1014 "id": "disc-000001",1015 "lastPostAt": "2026-10-07T12:30:00.000Z",1016 "openedAt": "2026-10-07T12:00:00.000Z",1017 "opener": "dave",1018 "posts": 2,1019 "project": "oscabriel/datekit",1020 "state": "proposed",1021 "proposal": "prop-000001",1022 "title": "Which day starts a week?"1023 }1024 ]1025 }1026 },1027 "showDiscussion": {1028 "payload": {1029 "discussion": "disc-000001",1030 "project": "oscabriel/datekit"1031 },1032 "success": {1033 "discussion": {1034 "id": "disc-000001",1035 "openedAt": "2026-10-07T12:00:00.000Z",1036 "opener": "dave",1037 "posts": [1038 {1039 "at": "2026-10-07T12:00:00.000Z",1040 "body": "Weeks start on Monday in ISO 8601, but on Sunday in the US; which does parseISO assume?",1041 "by": "dave"1042 },1043 {1044 "at": "2026-10-07T12:30:00.000Z",1045 "body": "ISO, always: a locale never changes what a date string means.",1046 "by": "alice"1047 }1048 ],1049 "project": "oscabriel/datekit",1050 "state": "proposed",1051 "proposal": "prop-000001",1052 "title": "Which day starts a week?"1053 }1054 }1055 },1056 "status": {1057 "payload": {1058 "project": "oscabriel/datekit"1059 },
345 unmodified lines
modified:packages/protocol/test/cli.test.ts+3 added
598 unmodified lines
599 "ledger",600 "env shape",601 "policy",602 "proposal",603 "discussions",604 "discussion",605 "ask open",606 "propose",607 "ask draft",608 "ask flag",609 "discussion post",610 "decide",611 "claim",612 "release",613 "submit",
22 unmodified lines
modified:packages/protocol/test/contracts.test.ts+39 added-1 removed
219 unmodified lines
220 on: "RMCW",221 tag: "showProposal",222 },223 {224 audience: "public",225 cli: "discussions",226 errors: ["UnknownProject"],227 flags: "RI",228 on: "RMCW",229 tag: "listDiscussions",230 },231 {232 audience: "public",233 cli: "discussion <discussion>",234 errors: ["UnknownProject", "UnknownDiscussion"],235 flags: "RI",236 on: "RMCW",237 tag: "showDiscussion",238 },239 {240 audience: "signedIn",241 cli: "init",242 errors: ["ProjectExists", "NotYourNamespace", "ImportFailed"],243 flags: "A",
19 unmodified lines
263 },264 {265 audience: "signedIn",266 cli: "propose",251 errors: ["UnknownProject", "Denounced", "CapReached", "NotVouched"],267 errors: [268 "UnknownProject",269 "Denounced",270 "CapReached",271 "NotVouched",272 "NotDecider",273 "UnknownDiscussion",274 "DiscussionClosed",275 ],276 flags: "",277 on: "RMCW",278 tag: "proposeAsk",279 },
20 unmodified lines
300 on: "RMC",301 tag: "flagAsk",302 },303 {304 audience: "signedIn",305 cli: "discussion post <discussion>",306 errors: [307 "UnknownProject",308 "UnknownDiscussion",309 "DiscussionClosed",310 "Denounced",311 "CapReached",312 ],313 flags: "",314 on: "RMC",315 tag: "postDiscussion",316 },317 {318 audience: "decider",319 cli: "decide",320 errors: [321 "UnknownProject",
366 unmodified lines
modified:packages/protocol/test/examples.ts+7 added
2 unmodified lines
3import {4 AskId,5 CommitSha,6 DecisionId,7 DiscussionId,8 EnvKey,9 Handle,10 ProjectName,11 ProposalId,
8 unmodified lines
20 ClaimLapsed,21 DecisionClosed,22 Denounced,23 DirectPush,24 DiscussionClosed,25 DraftInProgress,26 Flake,27 HeldBackFailed,28 ImportFailed,
19 unmodified lines
48 TouchedJudge,49 UnknownAsk,50 UnknownCommit,51 UnknownDecision,52 UnknownDiscussion,53 UnknownEnvItem,54 UnknownPath,55 UnknownProject,56 UnknownProposal,
21 unmodified lines
78const key = EnvKey.make("PAYMENTS_KEY");7980const proposal = ProposalId.make("prop-000001");8182const discussion = DiscussionId.make("disc-000001");8384export const examples: readonly Refusal[] = [85 NotClaimed.of(ask),86 ClaimLapsed.of(ask),87 new NotVouched({}),
40 unmodified lines
128 new NotDecider({}),129 new DecisionClosed({ decision }),130 new ProposalClosed({ proposal }),131 DraftInProgress.of(proposal),132 new DiscussionClosed({ discussion }),133 new UnknownProject({ project }),134 new UnknownAsk({ ask }),135 new UnknownCommit({ sha: main }),136 new UnknownDecision({ decision }),137 new UnknownPath({ commit: main, path }),138 new UnknownRevision({ rev: "v9.9.9" }),139 new UnknownProposal({ proposal }),140 new UnknownDiscussion({ discussion }),141 new ProjectExists({ project }),142 NotYourNamespace.of(project, Handle.make("bob")),143 new ImportFailed({ reason: "the repo needs a sign-in to read" }),144 new UnknownEnvItem({ key }),
3 unmodified lines
modified:packages/protocol/test/exit-code.test.ts+2 added
24 unmodified lines
25 ClaimLapsed: 75,26 DecisionClosed: 66,27 Denounced: 77,28 DirectPush: 77,29 DiscussionClosed: 66,30 DraftInProgress: 75,31 Flake: 75,32 HeldBackFailed: 65,33 ImportFailed: 75,
19 unmodified lines
53 TouchedJudge: 65,54 UnknownAsk: 66,55 UnknownCommit: 66,56 UnknownDecision: 66,57 UnknownDiscussion: 66,58 UnknownEnvItem: 66,59 UnknownPath: 66,60 UnknownProject: 66,61 UnknownProposal: 66,
42 unmodified lines
modified:packages/protocol/test/refusal.test.ts+5 added-1 removed
123 unmodified lines
124 )125 ).toStrictEqual(Refusal.members.map((member) => member.identifier));126 });127128 it("lists all forty-five tags in union order, group by group", () => {128 it("lists all forty-seven tags in union order, group by group", () => {129 expect(Refusal.members.map((member) => member.identifier)).toStrictEqual([130 "NotClaimed",131 "ClaimLapsed",132 "NotVouched",
26 unmodified lines
159 "NotDecider",160 "DecisionClosed",161 "ProposalClosed",162 "DraftInProgress",163 "DiscussionClosed",164 "UnknownProject",165 "UnknownAsk",166 "UnknownCommit",167 "UnknownDecision",168 "UnknownPath",169 "UnknownRevision",170 "UnknownProposal",171 "UnknownDiscussion",172 "ProjectExists",173 "NotYourNamespace",174 "ImportFailed",175 "UnknownEnvItem",
35 unmodified lines
211 ClaimLapsed: true,212 DecisionClosed: false,213 Denounced: false,214 DirectPush: false,215 DiscussionClosed: false,216 DraftInProgress: true,217 Flake: true,218 HeldBackFailed: false,219 ImportFailed: true,
19 unmodified lines
239 TouchedJudge: false,240 UnknownAsk: false,241 UnknownCommit: false,242 UnknownDecision: false,243 UnknownDiscussion: false,244 UnknownEnvItem: false,245 UnknownPath: false,246 UnknownProject: false,247 UnknownProposal: false,
9 unmodified lines
modified:packages/protocol/test/render.test.ts+33 added
9 unmodified lines
10 EnvKey,11 Handle,12 LandedSha,13 ProjectName,14 DiscussionId,15 ProposalId,16 RepoPath,17 RequestId,18} from "../src/ids.ts";
4 unmodified lines
23 DraftInProgress,24 NotDecider,25 OutOfScope,26 PrivatePathInPublicTree,27 DiscussionClosed,28 ProposalClosed,29 ReachedInternals,30 StaleBase,31 TouchedJudge,32 UnknownPath,33 UnknownDiscussion,34 UnknownProposal,35 UnknownRevision,36 ValueTooShort,37 Weakened,
266 unmodified lines
304 refusal: new CapReached({ cap: 1, limit: "proposals" }),305 },306 {307 reason:308 "you already have 20 open discussions here, the most this project allows",309 refusal: new CapReached({ cap: 20, limit: "discussions" }),310 },311 {312 reason:313 "you made 5 posts in the last minute, the most the platform allows; try again in 60s",314 refusal: new CapReached({ cap: 5, limit: "discussions", retryAfter: 60 }),315 },316 {317 reason:318 "you started 2 drafts in the last minute, the most the platform allows; try again in 60s",319 refusal: new CapReached({ cap: 2, limit: "drafts", retryAfter: 60 }),320 },321 {
55 unmodified lines
377 refusal: new ProposalClosed({ proposal: ProposalId.make("prop-000007") }),378 },379 {380 lines: [381 "UnknownDiscussion: this project has no discussion disc-000007",382 ` next: ${Brand.cli} discussions`,383 " retryable: no",384 ],385 refusal: new UnknownDiscussion({386 discussion: DiscussionId.make("disc-000007"),387 }),388 },389 {390 lines: [391 "DiscussionClosed: disc-000007 is closed, or became a proposal, so it takes no more posts",392 ` next: ${Brand.cli} discussions`,393 " retryable: no",394 ],395 refusal: new DiscussionClosed({396 discussion: DiscussionId.make("disc-000007"),397 }),398 },399 {400 lines: [401 "DraftInProgress: the platform is already drafting prop-000007's ask",402 ` next: ${Brand.cli} proposal prop-000007`,403 " retryable: yes",404 ],
138 unmodified lines
modified:scripts/lib/swarm/views/counter.ts+1 added
38 unmodified lines
39 AskClosed: () => "",40 AskOpened: () => "",41 Claimed: ({ ask, claimant }) => `${claimant} claimed ${ask}`,42 Decided: () => "",43 DiscussionPosted: () => "",44 Judged: () => "",45 Landed: ({ landing }) =>46 `${landing.ask ?? "main"} landed as ${short(landing.sha)}`,47 Lapsed: () => "",
219 unmodified lines
modified:PRODUCT.md+2 added-1 removed
73 unmodified lines
74- Pages per job on the web:75 - **Landing** (`/`): what the gate does, the issue and pull-request flow beside the ask, answer and gate flow, the seven stages, and the latest landings and refused answers across projects. A signed-in reader goes on to the inbox.76 - **Explore** (`/explore`): every public project as a card with its posture, the projects taking answers first.77 - **Front page** (`/asks`): open asks across projects a viewer may take, grouped by project with each project's posture said once, in the group heading, filtered by kind, by open to take and by asks held for newcomers; a split family is one row with its children as a fan. The same list as Markdown by `Accept: text/markdown`.78 - **Project** (`/$project`, the Overview tab): a header that stays across the tabs (the name, the posture said once, a description, its facts and Watch, Clone and Contribute), then the tabs Overview, Code, Asks, Landings, Proposals, People, Policy and Visibility. Overview holds its asks, recent landings and README, beside an about column with how a change lands here and who decides. The same as the project's `llms.txt` by `Accept: text/markdown`.78 - **Project** (`/$project`, the Overview tab): a header that stays across the tabs (the name, the posture said once, a description, its facts and Watch, Clone and Contribute), then the tabs Overview, Code, Asks, Landings, Proposals, Discussions, People, Policy and Visibility. Overview holds its asks, recent landings and README, beside an about column with how a change lands here and who decides. The same as the project's `llms.txt` by `Accept: text/markdown`.79 - **Code** (`/$project/tree/…`, `blob/…`, `why/…`, `commits/…`, `commit/…`, `refs`): the files at any commit, tag or answer fork with a persistent tree, highlighted code with `#L` links, why each line is there, the landings by day, each commit's diff, and the refs; raw bytes under a sandboxing CSP.80 - **Ask** (`/$project/asks/$ask`): the want, the territory, the check, who may claim, and the commands; the same as Markdown by `Accept: text/markdown` or at `/$project/asks/$ask.md`.81 - **Answer** (`/$project/answers/$ask`): the outcome, the gate's stages, the rounds, the lanes, held-back results as one line per area, the refusal, and the landing. A waiting answer says the one thing the contributor needs; a landed one is told as a sentence first, then credits its people, and only then shows its sealed roots.82 - **Person** (`/people/$handle`): their credits by role and area, in words, never a number or a score.83 - **Policy** (`/$project/people`): who decides which paths, who is vouched for or denounced, the limits and the agent rules, read from the config folder at the landed commit, with the commands that change them.84 - **Discussions** (`/$project/discussions`, `/$project/discussions/$discussion`): a project's public, freeform threads, open to anyone not denounced, that land nothing themselves; each page shows its posts, the proposal a maintainer turned it into, and the command to post, since the web adds no form for it.85 - **Proposals** (`/$project/proposals/new`, `/$project/proposals/$proposal`): a want proposed from the web or the CLI, the platform's agent's draft if one was asked for (the ask file, the check, its red-first runs), and the decision it waits on.86 - **Inbox** (`/inbox`; `/home` and `/today` move here): the reader's own page. A maintainer's decisions in sections (due today, later), every open one, each with its evidence, safe default, expiry and one-tap choices whose consequence is written under each, with how many wait said as a sentence; the asks the reader holds and where each answer stands in the gate; the asks they may take next. Each decision has its own page (`/$project/decisions/$decision`), where a finish shows the answer's diff with refusals marked at their lines.87 - **Visibility** (`/$project/visibility`; `/$project/ledger` and `/$project/env` move here): the posture, each declared layer with its reason, each sealed area's count, authors, committed root and admission; the Environment, every item the project's committed `.env.schema` declares, parsed at the landed commit and never resolved, with who set a sensitive item's value and when, never a value; and the ledger, newest first.88 - **Settings** (`/settings`): the theme, the system's or its opposite, kept in this browser's `localStorage`, never a cookie.
37 unmodified lines