char-slop/berry

multipurpose self-modifiable agentic harness

git clone https://git.t4t.associates/char-slop/berry

Charlotte Somdiff: edit mutable jj commits, warning before a save that conflicts their descendants15e7101

main
1.0 KiB47 linesraw
1import type { FileDiff } from "./types.ts";
2
3/**
4 * Where an edit lands: the working copy, or with `change` a jj commit, whose `identity` is then its commit id, which
5 * every rewrite changes.
6 */
7export type WorkingCopy = {
8  machine: string;
9  root: string;
10  vcs: "jj" | "git";
11  identity: string;
12  change?: string;
13};
14
15export type OpenFile = {
16  working: WorkingCopy;
17  file: FileDiff;
18  original: string;
19  content: string;
20  version: string;
21};
22
23export type Save = {
24  session: string;
25  id: string;
26  working: WorkingCopy;
27  path: string;
28  version: string;
29  content: string;
30  /** Save a commit even though its descendants then conflict. */
31  force?: boolean;
32};
33
34export type Saved = {
35  id: string;
36  working: WorkingCopy;
37  path: string;
38  version: string;
39  patch: string;
40};
41
42export type Event =
43  | { type: "saved"; session: string; save: Saved }
44  | { type: "finished"; session: string; timestamp: number; paths: string[] };
45
46export type Session = { saves: Saved[]; finished: number | null };
47export type State = { sessions: Record<string, Session> };