- MCP
- blame on this site's /mcp
- CLI
- abso blame worker/project/draft-diff.ts --json
- JSON
- /christopher/abso-core/blame/worker/project/draft-diff.ts?format=json
48 linesFirst import 83% · codex-capacity-chair 17%Last change codex-capacity-chair in version 163,
48 lines from 3 changes in 3 versions.
init0Start the project1// An agent's unpublished changes, file by file. They read through DraftDiffHost; today the host is the project
2// in memory.
codex-capacity-chair143Add inactive disk projection provider and verified transactional readers (#16)Compare4import type { AtomId, ReadView } from "../../src/engine/index.ts";
6import type { DiffAnswer } from "./project-types.ts";
7import { SHARED } from "./spaces.ts";
8import { changesBetween } from "./view-changes.ts";
10interface Agent {
11 readonly space: string;
12 readonly base: number;
13}
15/** What the draft diff reads need from a project. */
16export interface DraftDiffHost {
17 readonly agents: ReadonlyMap<string, Agent>;
18 needInit(): void;
19 draft(agent: Agent): AtomId[];
codex-capacity-chair143Add inactive disk projection provider and verified transactional readers (#16)Compare20 agentView(agent: Agent): ReadView;
codex-capacity-chair163Integrate reviewed disk-backed operations, queue and bounded read cachesCompare21 agentViewWithout?(agent: Agent, excluded: ReadonlySet<AtomId>): ReadView;
codex-capacity-chair143Add inactive disk projection provider and verified transactional readers (#16)Compare22 view(set: ReadonlySet<AtomId>): ReadView;
23 touchedFiles(ids: Iterable<AtomId>, views: readonly ReadView[]): Set<string>;
26/** An agent's draft diff for a reader (#41, the website): never creates the agent, never writes. */
27export function diffOf(host: DraftDiffHost, agentName: string): DiffAnswer {
28 host.needInit();
29 const agent = host.agents.get(agentName);
30 if (!agent) throw new ProjectError("not-found", `there is no agent ${JSON.stringify(agentName)}`);
31 return diffOfAgent(host, agent);
32}
34/** What the agent's unpublished changes do, file by file: its space at its base, then its view. */
35export function diffOfAgent(host: DraftDiffHost, agent: Agent): DiffAnswer {
36 const draft = host.draft(agent);
37 const after = host.agentView(agent);
38 const without = new Set(draft);
codex-capacity-chair163Integrate reviewed disk-backed operations, queue and bounded read cachesCompare39 const before = host.agentViewWithout
40 ? host.agentViewWithout(agent, without)
41 : host.view(new Set([...after.set].filter((id) => !without.has(id))));
43 return {
44 draft: agent.space === SHARED ? null : agent.space,
45 base: agent.base,
46 files: changesBetween(before, after, files),
47 };
48}