@pat-lewczuk/cezar 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/config.d.ts +55 -0
- package/dist/config.js +44 -0
- package/dist/config.js.map +1 -0
- package/dist/core/agent-runner.d.ts +13 -0
- package/dist/core/claude-cli-runner.js +23 -2
- package/dist/core/claude-cli-runner.js.map +1 -1
- package/dist/git-worktree.d.ts +49 -0
- package/dist/git-worktree.js +129 -0
- package/dist/git-worktree.js.map +1 -0
- package/dist/handoff.d.ts +42 -0
- package/dist/handoff.js +120 -0
- package/dist/handoff.js.map +1 -0
- package/dist/index.js +27 -6
- package/dist/index.js.map +1 -1
- package/dist/planner.d.ts +17 -0
- package/dist/planner.js +244 -0
- package/dist/planner.js.map +1 -0
- package/dist/runs/store.d.ts +40 -13
- package/dist/runs/store.js +33 -3
- package/dist/runs/store.js.map +1 -1
- package/dist/server/github.d.ts +28 -0
- package/dist/server/github.js +133 -0
- package/dist/server/github.js.map +1 -0
- package/dist/server/launch-key.d.ts +7 -0
- package/dist/server/launch-key.js +33 -0
- package/dist/server/launch-key.js.map +1 -0
- package/dist/server/pr.d.ts +22 -0
- package/dist/server/pr.js +92 -0
- package/dist/server/pr.js.map +1 -0
- package/dist/server/server.js +370 -15
- package/dist/server/server.js.map +1 -1
- package/dist/skills-remote.d.ts +35 -0
- package/dist/skills-remote.js +266 -0
- package/dist/skills-remote.js.map +1 -0
- package/dist/skills.d.ts +18 -6
- package/dist/skills.js +8 -4
- package/dist/skills.js.map +1 -1
- package/dist/todos.d.ts +60 -0
- package/dist/todos.js +166 -0
- package/dist/todos.js.map +1 -0
- package/dist/workflows/load.js +5 -9
- package/dist/workflows/load.js.map +1 -1
- package/dist/workflows/run.d.ts +62 -3
- package/dist/workflows/run.js +332 -43
- package/dist/workflows/run.js.map +1 -1
- package/dist/workflows/types.d.ts +27 -20
- package/dist/workflows/types.js +21 -0
- package/dist/workflows/types.js.map +1 -1
- package/package.json +1 -1
- package/scripts/mock-claude.mjs +118 -0
- package/web/app.js +1851 -149
- package/web/index.html +73 -22
- package/web/style.css +1271 -223
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"load.js","sourceRoot":"","sources":["../../src/workflows/load.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,MAAM,CAAC;AAC1C,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAoB,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"load.js","sourceRoot":"","sources":["../../src/workflows/load.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,MAAM,CAAC;AAC1C,OAAO,EAAE,mBAAmB,EAAE,UAAU,EAAE,kBAAkB,EAAoB,MAAM,YAAY,CAAC;AAEnG,MAAM,CAAC,MAAM,aAAa,GAAG,qBAAqB,CAAC;AAOnD;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,QAAgB;IAEhB,MAAM,GAAG,GAAG,OAAO,CAAC,QAAQ,EAAE,aAAa,CAAC,CAAC;IAC7C,MAAM,MAAM,GAAwB,EAAE,CAAC;IACvC,MAAM,SAAS,GAAkB,EAAE,CAAC;IAEpC,IAAI,OAAO,GAAa,EAAE,CAAC;IAC3B,IAAI,CAAC;QACH,OAAO,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC,CAAC;IAC/B,CAAC;IAAC,MAAM,CAAC;QACP,oCAAoC;IACtC,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AC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QACnF,CAAC;IACH,CAAC;IAED,MAAM,SAAS,GAAG,IAAI,GAAG,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;IACxD,MAAM,SAAS,GAAG;QAChB,GAAG,SAAS;QACZ,GAAG,CAAC,mBAAmB,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;KAC/D,CAAC;IACF,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;IACvD,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,CAAC;AAC/B,CAAC"}
|
package/dist/workflows/run.d.ts
CHANGED
|
@@ -3,24 +3,60 @@ import type { RunRecord, RunStore } from '../runs/store.js';
|
|
|
3
3
|
import { type WorkflowDef } from './types.js';
|
|
4
4
|
/** An interactive session that hears nothing from the user closes itself. */
|
|
5
5
|
export declare const IDLE_TIMEOUT_MS: number;
|
|
6
|
+
/** Periodic "cezar autosave" commit in the task worktree (spec 006). */
|
|
7
|
+
export declare const AUTOSAVE_INTERVAL_MS = 90000;
|
|
6
8
|
export interface StartRunInput {
|
|
7
9
|
task: string;
|
|
8
10
|
model?: string;
|
|
11
|
+
/** Screenshots pasted into the new-task form — delivered once, with the
|
|
12
|
+
* first agent step's opening message. */
|
|
13
|
+
images?: ContentBlock[];
|
|
9
14
|
}
|
|
15
|
+
/** Variant letters + the fixed diversification hints (spec 010). A runs the
|
|
16
|
+
* task verbatim; B/C get one constant sentence each — zero configuration. */
|
|
17
|
+
export declare const VARIANT_LETTERS: readonly ["A", "B", "C"];
|
|
10
18
|
/**
|
|
11
19
|
* The mini workflow engine: executes a `WorkflowDef` against a repo, one step
|
|
12
20
|
* at a time, persisting every event to the RunStore (which the SSE endpoints
|
|
13
21
|
* relay live to the GUI). No GitHub choreography — agent steps and shell
|
|
14
22
|
* checks with bounded retry loops, plus live sessions: the last agent step
|
|
15
23
|
* stays open for follow-ups (`waiting`) until "finish", idle timeout, or
|
|
16
|
-
* cancel.
|
|
24
|
+
* cancel. Runs queue behind `maxParallel` slots and each run executes in its
|
|
25
|
+
* own git worktree on a `cez/<id8>` branch (spec 006), autosave-committed
|
|
26
|
+
* every 90 s — the user's working tree is never touched.
|
|
17
27
|
*/
|
|
18
28
|
export declare class RunManager {
|
|
19
29
|
private readonly store;
|
|
20
30
|
private readonly repoRoot;
|
|
21
31
|
private readonly active;
|
|
32
|
+
private readonly queue;
|
|
33
|
+
private readonly starting;
|
|
34
|
+
private readonly pendingJobs;
|
|
35
|
+
private pumping;
|
|
36
|
+
/** `.ai/cezar` — where the per-task handoff files and todos.json live. */
|
|
37
|
+
private readonly dataDir;
|
|
22
38
|
constructor(store: RunStore, repoRoot: string);
|
|
23
|
-
|
|
39
|
+
/** Env the spawned claude gets so the agent can find its handoff file and
|
|
40
|
+
* the global inbox (spec 007). */
|
|
41
|
+
private agentEnv;
|
|
42
|
+
startRun(workflow: WorkflowDef, input: StartRunInput, group?: {
|
|
43
|
+
groupId: string;
|
|
44
|
+
variant: string;
|
|
45
|
+
}): RunRecord;
|
|
46
|
+
/**
|
|
47
|
+
* Parallel variants (spec 010): N runs of the same workflow on the same
|
|
48
|
+
* task, sharing a groupId. Variant A gets the task verbatim; B and C get a
|
|
49
|
+
* fixed one-line approach hint appended to the *task input* (not the step
|
|
50
|
+
* template), so diversification works with any workflow. The normal queue
|
|
51
|
+
* applies — with maxParallel=2 a third variant simply waits.
|
|
52
|
+
*/
|
|
53
|
+
startVariants(workflow: WorkflowDef, input: StartRunInput, count: number): RunRecord[];
|
|
54
|
+
/**
|
|
55
|
+
* Start queued runs while parallel slots are free. `maxParallel` comes from
|
|
56
|
+
* `.ai/cezar/config.json` (default 2); a non-git directory degrades to 1
|
|
57
|
+
* sequential run in the repo root (spec 006 degradation rule).
|
|
58
|
+
*/
|
|
59
|
+
private pump;
|
|
24
60
|
cancel(runId: string): boolean;
|
|
25
61
|
isActive(runId: string): boolean;
|
|
26
62
|
/**
|
|
@@ -29,7 +65,11 @@ export declare class RunManager {
|
|
|
29
65
|
* then offers "Continue" instead.
|
|
30
66
|
*/
|
|
31
67
|
sendMessage(runId: string, content: ContentBlock[]): boolean;
|
|
32
|
-
/** Close the open session gracefully — the run then completes as `done
|
|
68
|
+
/** Close the open session gracefully — the run then completes as `done`
|
|
69
|
+
* (or rests at `review` when the worktree holds changes, spec 009).
|
|
70
|
+
* On a run already resting at `review` (no session — the engine loop is
|
|
71
|
+
* over), "Finish" is the third review exit: accept the changes without a
|
|
72
|
+
* PR and flip straight to `done`. */
|
|
33
73
|
finish(runId: string): boolean;
|
|
34
74
|
/**
|
|
35
75
|
* "Continue" (spec 003): reopen a finished run's claude session in-process
|
|
@@ -45,8 +85,27 @@ export declare class RunManager {
|
|
|
45
85
|
private execute;
|
|
46
86
|
/** Returns an error message, or null on success. */
|
|
47
87
|
private runAgentStep;
|
|
88
|
+
/**
|
|
89
|
+
* Diff-first review gate (spec 009), shared by `execute` and
|
|
90
|
+
* `runContinuation`: a *successful* run whose worktree holds changes rests
|
|
91
|
+
* at `review` instead of `done` — the user inspects the diff first, then
|
|
92
|
+
* sends feedback back, opens a draft PR, or just finishes. Failed/cancelled
|
|
93
|
+
* runs never enter review; no worktree or an empty diff means plain `done`.
|
|
94
|
+
*/
|
|
95
|
+
private settleSuccess;
|
|
96
|
+
/**
|
|
97
|
+
* Agent screenshot (an image block inside a tool result): the base64 data
|
|
98
|
+
* never enters the NDJSON event log — it lands as a file under
|
|
99
|
+
* `.ai/cezar/runs/<id>-images/` and the transcript event carries only the
|
|
100
|
+
* name + serving URL. Best effort: on failure the screenshot is dropped,
|
|
101
|
+
* the transcript still shows the tool result's `[screenshot]` placeholder.
|
|
102
|
+
*/
|
|
103
|
+
private persistImage;
|
|
48
104
|
private armIdleTimer;
|
|
49
105
|
private clearIdleTimer;
|
|
106
|
+
/** Autosave-commit the worktree every 90 s while the run lives (spec 006). */
|
|
107
|
+
private armAutosave;
|
|
108
|
+
private clearAutosaveTimer;
|
|
50
109
|
private runCheckStep;
|
|
51
110
|
private finishStep;
|
|
52
111
|
}
|