- MCP
- blame on this site's /mcp
- CLI
- abso blame worker/project/draft-diff.ts --version 143 --json
- JSON
- /christopher/abso-core/blame/worker/project/draft-diff.ts?version=143&format=json
45 linesFirst import 91% · codex-capacity-chair 9%Last change codex-capacity-chair in version 143,
45 lines from 2 changes in 2 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;
21 view(set: ReadonlySet<AtomId>): ReadView;
22 touchedFiles(ids: Iterable<AtomId>, views: readonly ReadView[]): Set<string>;
25/** An agent's draft diff for a reader (#41, the website): never creates the agent, never writes. */
26export function diffOf(host: DraftDiffHost, agentName: string): DiffAnswer {
27 host.needInit();
28 const agent = host.agents.get(agentName);
29 if (!agent) throw new ProjectError("not-found", `there is no agent ${JSON.stringify(agentName)}`);
30 return diffOfAgent(host, agent);
31}
33/** What the agent's unpublished changes do, file by file: its space at its base, then its view. */
34export function diffOfAgent(host: DraftDiffHost, agent: Agent): DiffAnswer {
35 const draft = host.draft(agent);
36 const after = host.agentView(agent);
37 const without = new Set(draft);
38 const before = host.view(new Set([...after.set].filter((id) => !without.has(id))));
39 const files = host.touchedFiles(draft, [before, after]);
40 return {
41 draft: agent.space === SHARED ? null : agent.space,
42 base: agent.base,
43 files: changesBetween(before, after, files),
44 };
45}