@pat-lewczuk/cezar 0.1.1 → 0.1.3

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.
Files changed (59) hide show
  1. package/README.md +249 -45
  2. package/dist/config.d.ts +15 -0
  3. package/dist/config.js +11 -0
  4. package/dist/config.js.map +1 -1
  5. package/dist/core/agent-runner.d.ts +44 -2
  6. package/dist/core/agent-runner.js +8 -2
  7. package/dist/core/agent-runner.js.map +1 -1
  8. package/dist/core/backend-detect.d.ts +6 -4
  9. package/dist/core/backend-detect.js +44 -4
  10. package/dist/core/backend-detect.js.map +1 -1
  11. package/dist/core/claude-cli-runner.d.ts +3 -25
  12. package/dist/core/claude-cli-runner.js +2 -19
  13. package/dist/core/claude-cli-runner.js.map +1 -1
  14. package/dist/core/codex-app-server-runner.d.ts +29 -0
  15. package/dist/core/codex-app-server-runner.js +452 -0
  16. package/dist/core/codex-app-server-runner.js.map +1 -0
  17. package/dist/core/ndjson.d.ts +6 -0
  18. package/dist/core/ndjson.js +23 -0
  19. package/dist/core/ndjson.js.map +1 -0
  20. package/dist/core/opencode-server-runner.d.ts +30 -0
  21. package/dist/core/opencode-server-runner.js +451 -0
  22. package/dist/core/opencode-server-runner.js.map +1 -0
  23. package/dist/core/runner-factory.d.ts +8 -0
  24. package/dist/core/runner-factory.js +22 -0
  25. package/dist/core/runner-factory.js.map +1 -0
  26. package/dist/git-worktree.d.ts +7 -0
  27. package/dist/git-worktree.js +14 -0
  28. package/dist/git-worktree.js.map +1 -1
  29. package/dist/planner.js +7 -3
  30. package/dist/planner.js.map +1 -1
  31. package/dist/runs/store.d.ts +7 -2
  32. package/dist/runs/store.js +3 -0
  33. package/dist/runs/store.js.map +1 -1
  34. package/dist/server/git.d.ts +5 -0
  35. package/dist/server/git.js +38 -0
  36. package/dist/server/git.js.map +1 -1
  37. package/dist/server/github.d.ts +2 -1
  38. package/dist/server/github.js +17 -10
  39. package/dist/server/github.js.map +1 -1
  40. package/dist/server/pr.js +7 -1
  41. package/dist/server/pr.js.map +1 -1
  42. package/dist/server/server.js +207 -20
  43. package/dist/server/server.js.map +1 -1
  44. package/dist/skills.d.ts +11 -9
  45. package/dist/skills.js +74 -13
  46. package/dist/skills.js.map +1 -1
  47. package/dist/workflows/load.js +5 -3
  48. package/dist/workflows/load.js.map +1 -1
  49. package/dist/workflows/run.d.ts +3 -0
  50. package/dist/workflows/run.js +43 -11
  51. package/dist/workflows/run.js.map +1 -1
  52. package/dist/workflows/types.d.ts +87 -8
  53. package/dist/workflows/types.js +54 -2
  54. package/dist/workflows/types.js.map +1 -1
  55. package/package.json +1 -1
  56. package/web/app.js +1180 -88
  57. package/web/index.html +16 -7
  58. package/web/open-mercato.svg +11 -0
  59. package/web/style.css +458 -56
package/README.md CHANGED
@@ -1,90 +1,294 @@
1
+ <div align="center">
2
+
1
3
  # cezar ⚡
2
4
 
3
- Local cockpit for running and tracking AI agent tasks in your repo. Single
4
- user, zero config, one command:
5
+ **A local cockpit for running and tracking AI coding-agent tasks in your repo.**
6
+
7
+ Type a task, pick a workflow, watch the agent work live — steps, tool calls,
8
+ tokens, diffs — in a browser cockpit that runs entirely on your machine.
9
+ Your `claude` login, your `gh`, your files. No accounts, no database, no cloud.
10
+
11
+ [What it solves](#what-it-solves) · [Who it's for](#who-its-for) · [Quick start](#quick-start) · [How it works](#how-it-works) · [Core concepts](#core-concepts) · [Cockpit tour](#cockpit-tour)
12
+
13
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](#license)
14
+ ![Node 20+](https://img.shields.io/badge/Node-20%2B-339933)
15
+ ![TypeScript 5.x](https://img.shields.io/badge/TypeScript-5.x-3178c6)
16
+ ![Zero config](https://img.shields.io/badge/config-zero-success)
17
+ ![No database](https://img.shields.io/badge/database-none-success)
18
+
19
+ </div>
20
+
21
+ ---
5
22
 
6
23
  ```bash
7
24
  cd your-repo
8
- npx cezar
25
+ npx cezar-cli # → cockpit at http://localhost:4321
9
26
  ```
10
27
 
11
- That's it. If you have the `claude` CLI logged in (Pro/Max subscription) and
12
- `gh` authenticated, there is nothing to configure cez opens a browser
13
- cockpit at `http://localhost:4321` where you type a task, pick a workflow and
14
- watch the agent work live (steps, tool calls, tokens), with a repo view
15
- (status / diff / log) right next to it.
28
+ That's the whole setup. If your `claude` CLI is logged in (Pro/Max) and `gh` is
29
+ authenticated, there is nothing else to configure. State lives in `.ai/cezar/`
30
+ inside your repo plain JSON, NDJSON and Markdown you can `cat` and fix by hand.
31
+
32
+ ---
33
+
34
+ ## What it solves
35
+
36
+ Most "AI coding agent" tooling makes you choose between a **terminal** you can't
37
+ see into once it's running, and a **cloud product** that wants your API key, your
38
+ code on their servers, and an account. cezar is the third option: the agent runs
39
+ locally under *your* subscription, and a cockpit shows you exactly what it's doing.
40
+
41
+ - **No visibility into a running agent.** A headless `claude` run is a black box
42
+ until it finishes. cezar streams every step — agent text, each tool call and
43
+ its result, tokens and cost per step — live, and keeps the full replay.
44
+ - **One agent, one working tree, one thing at a time.** Kick off a second task and
45
+ it fights the first over your files. cezar runs each task in its **own git
46
+ worktree**, so two (or three) agents work in parallel without stepping on
47
+ each other — or on the branch you're editing.
48
+ - **The agent finishes and you have to trust it.** cezar ends non-trivial runs at
49
+ a **review gate**: inspect the diff, send notes back into the same session, or
50
+ push a **draft PR** — never an auto-merge.
51
+ - **Losing a session when it fails.** Every run records its `claude` session id.
52
+ Take it over interactively in one click (`claude --resume <id>`), or continue it
53
+ in-process from the cockpit.
54
+ - **Setup tax.** No wizard, no env vars, no schema. Skills are Markdown, workflows
55
+ are short YAML, and everything degrades: no `gh` → works without PRs, no network
56
+ → local skills still load, no `.ai/skills` → the bare prompt still runs.
57
+
58
+ ---
59
+
60
+ ## Who it's for
61
+
62
+ - **Solo devs and small teams** who want the leverage of coding agents without
63
+ handing their code and keys to a SaaS — the agent runs on your subscription,
64
+ on your machine.
65
+ - **`claude` CLI power users** who love headless runs but want to *see* them,
66
+ compare a few attempts side by side, and review a diff before it lands.
67
+ - **Anyone with a backlog** who'd rather queue three tasks into isolated worktrees
68
+ and pick the winners than babysit one terminal.
69
+ - **Teams with shared conventions** who want their playbooks (skills) pulled from
70
+ a git repo, applied consistently, with zero per-project setup.
71
+
72
+ ---
16
73
 
17
- No accounts, no database, no cloud. State lives in `.ai/cezar/` inside your repo.
74
+ ## Quick start
18
75
 
19
- ## What it does
76
+ **Prerequisites:** Node 20+, the [`claude` CLI](https://github.com/anthropics/claude-code)
77
+ logged in (Pro/Max subscription), and — optionally — `git` and the `gh` CLI.
20
78
 
21
- - **Runs** — every agent task is a run: queued → running → done/failed, with a
22
- live event log (agent text, tool calls, tool results), token usage per step
23
- and cancel/delete controls. Failed run? Take the session over interactively:
24
- `claude --resume <session-id>` (shown in the run header).
25
- - **Workflows** — a YAML file: agent steps + shell checks, with bounded
26
- retry loops (`onFail: retry`). The built-in `quick-task` workflow (one agent
27
- step) works with zero setup.
28
- - **Skills** — Markdown files in `.ai/skills/` or `.ai/cezar/skills/`; a workflow
29
- step references one via `skill: <name>` and its body becomes the agent's
30
- extra system prompt.
31
- - **Repo view** — branch, working-tree status, diff vs HEAD, recent commits.
79
+ ```bash
80
+ cd your-repo
81
+ npx cezar-cli # start the cockpit for the current repo
82
+ # or: npx @pat-lewczuk/cezar
83
+ ```
32
84
 
33
- ## Commands
85
+ The cockpit opens at `http://localhost:4321` (auto-picks the next free port if
86
+ busy). Type a task, pick a workflow, hit **Start**. That's it.
34
87
 
35
88
  ```bash
36
- npx cezar # start the cockpit for the current repo
37
- npx cezar run "task" # headless run in the terminal (CI-friendly)
38
- npx cezar init # scaffold .ai/cezar/ with an example workflow + skill
89
+ npx cezar-cli run "add a --json flag to the export command" # headless, CI-friendly
90
+ npx cezar-cli init # scaffold .ai/cezar/
39
91
  ```
40
92
 
93
+ Both the `cezar` and `cez` commands are installed, so once it's on your PATH you
94
+ can run either. No API key is ever used — cezar shells out to your logged-in
95
+ `claude` CLI.
96
+
97
+ > **Just kicking the tires?** Set `CEZ_DRY_RUN=1` to run against a bundled mock
98
+ > instead of the real CLI — the whole cockpit works with no `claude` login, so
99
+ > you can explore runs, diffs, variants and the review gate offline.
100
+
101
+ ---
102
+
103
+ ## How it works
104
+
105
+ You describe a task. cezar runs it as a **workflow** — an ordered list of agent
106
+ steps and shell checks — shelling out to your `claude` CLI in headless
107
+ stream-json mode. Each task gets its own git worktree; the cockpit streams every
108
+ event live and parks the run at a review gate when there's a diff to inspect.
109
+
110
+ ```
111
+ you type a task
112
+
113
+
114
+ ┌─────────────┐ optional: Plan → AI drafts a chain of steps you approve
115
+ │ workflow │ (agent steps + shell checks, with bounded onFail retries)
116
+ └─────────────┘
117
+
118
+
119
+ ┌──────────────────────────────┐ ┌───────────────────────────────┐
120
+ │ git worktree per task │ │ claude CLI (your login) │
121
+ │ (isolated branch, parallel) │◄───►│ stream-json · default-deny │
122
+ └──────────────────────────────┘ │ tools · acceptEdits in-repo │
123
+ │ └───────────────────────────────┘
124
+ │ agent text · tool calls · tool results · tokens · cost
125
+
126
+ ┌─────────────┐ SSE (replay + live) ┌──────────────────────────┐
127
+ │ .ai/cezar/ │ ──────────────────────► │ cockpit localhost:4321 │
128
+ │ JSON·NDJSON │ │ Runs · Repo · GitHub · │
129
+ │ ·Markdown │ │ Skills · Workflows │
130
+ └─────────────┘ └──────────────────────────┘
131
+
132
+ review gate: read the diff →
133
+ send notes back · draft PR · finish
134
+ ```
135
+
136
+ When a check fails, the workflow can loop back to an earlier step (bounded by
137
+ `max`) with the failing output appended to the retried agent's prompt. Nothing
138
+ auto-merges: a run with changes rests in `review` until you act on it.
139
+
140
+ ---
141
+
142
+ ## Core concepts
143
+
144
+ Three words, no jargon — **task**, **skill**, **chain**:
145
+
146
+ - **Tasks** are the unit of work. Every task is a **run**: `queued → running →
147
+ review / done / failed / cancelled`, with a live event log, per-step token and
148
+ cost usage, cancel/delete, and — for anything with a diff — a review gate. Paste
149
+ screenshots into the task, or send follow-up messages into the live session
150
+ while it works.
151
+ - **Skills** are Markdown playbooks. Drop them in `.ai/skills/` or
152
+ `.ai/cezar/skills/`, or pull them from a shared **team skills repo** (a bare
153
+ git clone cached globally in `~/.cache/cez/`). A workflow step references one by
154
+ `skill: <name>` and its body becomes the agent's extra system prompt — so you
155
+ shape *how* the agent reasons without touching code.
156
+ - **Chains (workflows)** stitch steps into a pipeline: agent steps plus shell
157
+ checks, with bounded `onFail` retry loops. Write the YAML yourself, build one by
158
+ drag-ordering skills in the **Workflows** tab, or press **Plan** and let the AI
159
+ draft a chain for your task that you review, trim and start. The built-in
160
+ `quick-task` (one agent step) works with zero setup.
161
+
162
+ Two moves that make the cockpit worth the browser tab:
163
+
164
+ - **Parallel variants (×2 / ×3).** Run the same task as competing agents in
165
+ separate worktrees, then compare their diffs side by side and **pick** one —
166
+ the losers are archived and their worktrees cleaned up.
167
+ - **Review gate.** A finished run with changes waits in `review`. Read the diff,
168
+ type notes that go straight back into the agent's session, or push a
169
+ `gh pr create --draft`. You stay the merge button.
170
+
171
+ ---
172
+
173
+ ## Cockpit tour
174
+
175
+ Six tabs, one browser window, all live over Server-Sent Events:
176
+
177
+ | Tab | What's in it |
178
+ |---|---|
179
+ | **Runs** | Every task with its status, live event stream (agent text · tool calls · tool results · pasted/generated screenshots), tokens and cost. Continue, cancel, open in terminal (`claude --resume`), review the diff, or push a draft PR. |
180
+ | **Inbox** | Follow-ups an agent left behind (`todos.json`) — one click turns a suggestion into the next task, pre-wired to its suggested skill. |
181
+ | **Repo** | Branch, working-tree status, diff vs HEAD, recent commits (click one for its inline patch + GitHub link), and the configurable base branch that worktrees fork from and PRs target. |
182
+ | **GitHub** | Open issues and PRs of the repo's origin, read through your logged-in `gh`. Drag an issue onto the task box to prefill the prompt. |
183
+ | **Skills** | Local skills plus the team skills repo, with a rendered body + prompt preview. Refresh pulls the latest from the remote. |
184
+ | **Workflows** | Build a chain by drag-ordering skills, save it as portable YAML, import/export, or delete. Built-ins always come back. |
185
+
186
+ The whole GUI is dependency-free vanilla JS with no build step, a dark/light
187
+ theme toggle, and bookmarklets that launch a task straight from a GitHub page.
188
+
189
+ ---
190
+
41
191
  ## Workflow format
42
192
 
43
- `.ai/cezar/workflows/fix-and-verify.yaml`:
193
+ A workflow is a small YAML file in `.ai/cezar/workflows/`:
44
194
 
45
195
  ```yaml
46
196
  name: fix-and-verify
47
- description: Implement, then verify; retry with failing output on red.
197
+ description: Implement the task, then verify; retry with failing output on red.
48
198
  steps:
49
199
  - id: implement
50
200
  name: Implement
51
201
  prompt: "{{task}}"
52
- skill: project-conventions # optional, from .ai/skills or .ai/cezar/skills
53
- # model: opus # optional per-step override
202
+ skill: project-conventions # optional from .ai/skills or .ai/cezar/skills
203
+ # model: opus # optional per-step model override
54
204
  # allowedTools: [Read, Edit, Write, Grep, Glob, Bash]
55
205
  - id: verify
56
206
  name: Verify
57
- command: "npm test"
207
+ command: "npm test" # a check step: exit 0 passes
58
208
  onFail:
59
- retry: implement # loop back, at most:
60
- max: 2
209
+ retry: implement # loop back to an earlier step…
210
+ max: 2 # …at most twice
61
211
  ```
62
212
 
63
- `{{task}}` is replaced with the task you typed. When a check fails and loops
64
- back, the failing output is appended to the retried agent's prompt.
213
+ `{{task}}` is replaced with the task text you typed. When a check fails and loops
214
+ back, its failing output is appended to the retried agent's prompt so the next
215
+ attempt can see what broke.
216
+
217
+ Prefer skills over steps? A workflow can also be written in the portable
218
+ shorthand — an ordered list of skill names, each becoming one agent step:
219
+
220
+ ```yaml
221
+ name: triage-and-fix
222
+ skills: [reproduce, root-cause, implement, self-review]
223
+ ```
224
+
225
+ ---
65
226
 
66
227
  ## How it runs agents
67
228
 
68
- cez shells out to your locally installed, logged-in `claude` CLI in headless
69
- stream-json mode — your subscription, no API key. Tool access is
70
- default-deny via `--allowedTools`; edits are auto-accepted
71
- (`--permission-mode acceptEdits`) inside the repo directory.
229
+ cezar shells out to your locally installed, logged-in `claude` CLI in headless
230
+ `stream-json` mode — **your subscription, no API key**. Tool access is
231
+ default-deny via `--allowedTools`, and edits are auto-accepted
232
+ (`--permission-mode acceptEdits`) inside the task's worktree. Nothing runs on a
233
+ server you don't own.
234
+
235
+ Useful environment variables:
236
+
237
+ | Var | Effect |
238
+ |---|---|
239
+ | `CEZ_DRY_RUN=1` | Use the bundled mock instead of the real `claude` CLI — the entire cockpit works offline, for demos and development. |
240
+ | `CEZ_CLAUDE_BIN=/path/to/claude` | Override which `claude` binary is used. |
241
+ | `GITHUB_TOKEN` | Fallback for GitHub reads/PRs when `gh` isn't authenticated. |
242
+
243
+ ---
244
+
245
+ ## Configuration (optional)
246
+
247
+ Zero config is the default — everything below is opt-in via
248
+ `.ai/cezar/config.json` (a missing or invalid file simply uses the defaults, and
249
+ never blocks startup):
250
+
251
+ ```jsonc
252
+ {
253
+ "skillsRepos": [{ "repo": "open-mercato/skills", "ref": "main" }], // team skills; [] disables
254
+ "maxParallel": 2, // how many tasks may run at once (non-git dirs always run 1)
255
+ "plannerModel": "sonnet", // model the Plan button uses to draft chains
256
+ "baseBranch": "develop" // branch worktrees fork from + PRs target (also settable in the Repo tab)
257
+ }
258
+ ```
72
259
 
73
- Useful env vars:
260
+ Run data (`runs.json`, NDJSON event logs, worktrees, `todos.json`) is
261
+ git-ignored automatically; your workflows and skills stay committable.
74
262
 
75
- - `CEZ_DRY_RUN=1` — use the bundled mock instead of the real CLI (demo/dev).
76
- - `CEZ_CLAUDE_BIN=/path/to/claude` — override the binary.
263
+ ---
77
264
 
78
265
  ## Development
79
266
 
80
267
  ```bash
81
268
  npm install
82
- npm run dev # tsx src/index.ts
83
- npm run build # tsc → dist/
269
+ npm run dev # tsx src/index.ts — the cockpit, live-reloaded
270
+ npm run build # tsc → dist/
271
+ npm run typecheck # tsc --noEmit
84
272
  ```
85
273
 
274
+ The stack is deliberately small: **TypeScript** (strict, ESM), **Hono** + SSE for
275
+ the server, **Zod** at every boundary, **YAML** for workflows, and **vanilla JS**
276
+ for the GUI (no framework, no bundler). Every module is meant to be read in one
277
+ sitting.
278
+
86
279
  ---
87
280
 
281
+ ## Relationship to cezar (the SaaS)
282
+
88
283
  cez is the radically-simple, single-user sibling of
89
- [cezar](https://github.com/...) — same core ideas (agent runner, skills,
90
- declarative workflows, run cockpit), none of the SaaS.
284
+ [**cezar**](https://github.com/comerito/cezar) — the team SaaS cockpit for
285
+ running agents across the whole GitHub issue lifecycle (auto-triage, webhooks,
286
+ Supabase, multi-repo). Same core ideas — agent runner, skills, declarative
287
+ workflows, a live run cockpit — with none of the accounts, database or cloud.
288
+ Start here; graduate to cezar when a team needs shared visibility.
289
+
290
+ ---
291
+
292
+ ## License
293
+
294
+ **MIT** © Patryk Lewczuk
package/dist/config.d.ts CHANGED
@@ -32,22 +32,37 @@ declare const configSchema: z.ZodObject<{
32
32
  }>, "many">>;
33
33
  /** How many tasks may run at once (spec 006). Non-git dirs always run 1. */
34
34
  maxParallel: z.ZodDefault<z.ZodNumber>;
35
+ /**
36
+ * Which agent backend a task uses unless overridden per task (GUI) or per
37
+ * step (workflow). The GUI only offers runners actually installed; this is
38
+ * the preselected default. Also the runner the chain planner uses.
39
+ */
40
+ defaultRunner: z.ZodDefault<z.ZodEnum<["claude", "codex", "opencode"]>>;
35
41
  /** Model for the chain planner (spec 008) — cheap but reliable at JSON. */
36
42
  plannerModel: z.ZodDefault<z.ZodString>;
43
+ /**
44
+ * Branch task worktrees fork from and draft PRs target (e.g. `develop`).
45
+ * Unset = the branch currently checked out. Settable from the Repo tab.
46
+ */
47
+ baseBranch: z.ZodOptional<z.ZodString>;
37
48
  }, "strip", z.ZodTypeAny, {
38
49
  skillsRepos: {
39
50
  repo: string;
40
51
  ref: string;
41
52
  }[];
42
53
  maxParallel: number;
54
+ defaultRunner: "claude" | "codex" | "opencode";
43
55
  plannerModel: string;
56
+ baseBranch?: string | undefined;
44
57
  }, {
45
58
  skillsRepos?: {
46
59
  repo: string;
47
60
  ref?: string | undefined;
48
61
  }[] | undefined;
49
62
  maxParallel?: number | undefined;
63
+ defaultRunner?: "claude" | "codex" | "opencode" | undefined;
50
64
  plannerModel?: string | undefined;
65
+ baseBranch?: string | undefined;
51
66
  }>;
52
67
  export type CezConfig = z.infer<typeof configSchema>;
53
68
  /** Read `.ai/cezar/config.json` on demand — never cached, never throws. */
package/dist/config.js CHANGED
@@ -19,8 +19,19 @@ const configSchema = z.object({
19
19
  skillsRepos: z.array(skillsRepoSchema).default(DEFAULT_SKILLS_REPOS),
20
20
  /** How many tasks may run at once (spec 006). Non-git dirs always run 1. */
21
21
  maxParallel: z.number().int().min(1).max(16).default(2),
22
+ /**
23
+ * Which agent backend a task uses unless overridden per task (GUI) or per
24
+ * step (workflow). The GUI only offers runners actually installed; this is
25
+ * the preselected default. Also the runner the chain planner uses.
26
+ */
27
+ defaultRunner: z.enum(['claude', 'codex', 'opencode']).default('claude'),
22
28
  /** Model for the chain planner (spec 008) — cheap but reliable at JSON. */
23
29
  plannerModel: z.string().min(1).default('sonnet'),
30
+ /**
31
+ * Branch task worktrees fork from and draft PRs target (e.g. `develop`).
32
+ * Unset = the branch currently checked out. Settable from the Repo tab.
33
+ */
34
+ baseBranch: z.string().trim().min(1).optional(),
24
35
  });
25
36
  /** Read `.ai/cezar/config.json` on demand — never cached, never throws. */
26
37
  export async function loadConfig(repoRoot) {
@@ -1 +1 @@
1
- {"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;GAKG;AACH,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC;IAChC,gFAAgF;IAChF,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACvB,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,C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,QAAQ,EAAE;CAChD,CAAC,CAAC;AAIH,2EAA2E;AAC3E,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,QAAgB;IAC/C,IAAI,GAAW,CAAC;IAChB,IAAI,CAAC;QACH,GAAG,GAAG,MAAM,QAAQ,CAAC,IAAI,CAAC,QAAQ,EAAE,WAAW,EAAE,aAAa,CAAC,EAAE,MAAM,CAAC,CAAC;IAC3E,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,YAAY,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IAChC,CAAC;IACD,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,YAAY,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC;QACvD,IAAI,MAAM,CAAC,OAAO;YAAE,OAAO,MAAM,CAAC,IAAI,CAAC;IACzC,CAAC;IAAC,MAAM,CAAC;QACP,wDAAwD;IAC1D,CAAC;IACD,OAAO,YAAY,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;AAChC,CAAC"}
@@ -2,9 +2,19 @@
2
2
  * The backend-agnostic seam for running one agent task. Adapted from
3
3
  * @cezar/core's `agents/agent-runner.ts`, trimmed for single-user local use:
4
4
  * no token-budget circuit breaker, no zod response schemas — one run is one
5
- * `claude` CLI invocation streaming normalized events.
5
+ * agent-CLI session streaming normalized events.
6
+ *
7
+ * Three interchangeable backends implement this seam, each as a persistent
8
+ * process so multi-turn follow-ups, `waiting`, interrupt and resume all work:
9
+ * - `claude` — Claude Code CLI, stream-json over stdin/stdout;
10
+ * - `codex` — `codex app-server`, JSON-RPC 2.0 (JSONL) over stdin/stdout;
11
+ * - `opencode` — `opencode serve`, HTTP + SSE.
6
12
  */
7
- export type AgentBackend = 'claude-cli';
13
+ /** `claude-cli` is the legacy id kept so old run records still parse. */
14
+ export type AgentBackend = 'claude' | 'codex' | 'opencode' | 'claude-cli';
15
+ /** The user-selectable runners (what config/GUI expose). */
16
+ export type RunnerId = 'claude' | 'codex' | 'opencode';
17
+ export declare const RUNNER_IDS: readonly RunnerId[];
8
18
  export interface AgentRunSpec {
9
19
  /** Appended to the CLI's default system prompt (`--append-system-prompt`). */
10
20
  systemPrompt?: string;
@@ -77,6 +87,13 @@ export type AgentEvent = {
77
87
  } | {
78
88
  type: 'cost';
79
89
  usd: number;
90
+ }
91
+ /** The backend's real session id, once known — codex threads and opencode
92
+ * sessions mint their own id, so the run manager persists this to enable
93
+ * resume ("Continue") and "open in CLI". Claude's equals `spec.sessionId`. */
94
+ | {
95
+ type: 'session';
96
+ sessionId: string;
80
97
  } | {
81
98
  type: 'turn-end';
82
99
  } | {
@@ -101,8 +118,33 @@ export interface AgentRunResult {
101
118
  tokensUsed: number;
102
119
  sessionId?: string;
103
120
  }
121
+ export interface SessionOptions {
122
+ /** Close the session shortly after the first turn ends (single-turn
123
+ * behavior, used for non-interactive workflow steps). Interactive
124
+ * sessions omit this and control `end()` themselves. */
125
+ autoEndAfterFirstTurn?: boolean;
126
+ }
127
+ /**
128
+ * A live agent session over one spawned backend process. The process stays
129
+ * alive between turns and reads further user messages — that's what makes
130
+ * mid-task follow-ups possible. Implemented identically by every backend
131
+ * (claude stdin, codex app-server, opencode serve).
132
+ */
133
+ export interface AgentSession {
134
+ /** Resolves when the backend process exits — the session is fully over. */
135
+ result: Promise<AgentRunResult>;
136
+ /** Write a user message into the live session. False when it is closed. */
137
+ sendMessage(content: ContentBlock[]): boolean;
138
+ /** Graceful close: end input, then a SIGTERM→SIGKILL watchdog. */
139
+ end(): void;
140
+ /** Hard stop (used by cancel). */
141
+ interrupt(): void;
142
+ /** True while the session still accepts messages. */
143
+ readonly open: boolean;
144
+ }
104
145
  export interface AgentRunner {
105
146
  readonly backend: AgentBackend;
106
147
  run(spec: AgentRunSpec, onEvent?: (event: AgentEvent) => void): Promise<AgentRunResult>;
148
+ startSession(spec: AgentRunSpec, onEvent?: (event: AgentEvent) => void, opts?: SessionOptions): AgentSession;
107
149
  interrupt(): Promise<void>;
108
150
  }
@@ -2,7 +2,13 @@
2
2
  * The backend-agnostic seam for running one agent task. Adapted from
3
3
  * @cezar/core's `agents/agent-runner.ts`, trimmed for single-user local use:
4
4
  * no token-budget circuit breaker, no zod response schemas — one run is one
5
- * `claude` CLI invocation streaming normalized events.
5
+ * agent-CLI session streaming normalized events.
6
+ *
7
+ * Three interchangeable backends implement this seam, each as a persistent
8
+ * process so multi-turn follow-ups, `waiting`, interrupt and resume all work:
9
+ * - `claude` — Claude Code CLI, stream-json over stdin/stdout;
10
+ * - `codex` — `codex app-server`, JSON-RPC 2.0 (JSONL) over stdin/stdout;
11
+ * - `opencode` — `opencode serve`, HTTP + SSE.
6
12
  */
7
- export {};
13
+ export const RUNNER_IDS = ['claude', 'codex', 'opencode'];
8
14
  //# sourceMappingURL=agent-runner.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"agent-runner.js","sourceRoot":"","sources":["../../src/core/agent-runner.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}
1
+ {"version":3,"file":"agent-runner.js","sourceRoot":"","sources":["../../src/core/agent-runner.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAOH,MAAM,CAAC,MAAM,UAAU,GAAwB,CAAC,QAAQ,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC"}
@@ -1,13 +1,15 @@
1
1
  export interface BackendCheck {
2
- name: 'claude' | 'gh' | 'git';
2
+ name: 'claude' | 'codex' | 'opencode' | 'gh' | 'git';
3
3
  available: boolean;
4
4
  version?: string;
5
5
  hint?: string;
6
6
  }
7
7
  /**
8
- * Probe the host for everything cez leans on: the `claude` CLI (the agent
9
- * backend), `gh` (GitHub auth for PR creation) and `git`. Nothing is required
10
- * except `claude` the GUI degrades gracefully and shows the hints instead.
8
+ * Probe the host for everything cez leans on: the agent CLIs (`claude`, and
9
+ * the optional `codex` / `opencode` alternatives), `gh` (GitHub auth for PR
10
+ * creation) and `git`. Nothing is required except at least one agent CLI — the
11
+ * GUI degrades gracefully, only offers the runners that are present, and shows
12
+ * the hints for the rest.
11
13
  */
12
14
  export declare function detectEnvironment(): Promise<BackendCheck[]>;
13
15
  /** The host's GitHub token: logged-in `gh` first, `GITHUB_TOKEN` fallback. */
@@ -2,12 +2,14 @@ import { execFile } from 'node:child_process';
2
2
  import { promisify } from 'node:util';
3
3
  const exec = promisify(execFile);
4
4
  /**
5
- * Probe the host for everything cez leans on: the `claude` CLI (the agent
6
- * backend), `gh` (GitHub auth for PR creation) and `git`. Nothing is required
7
- * except `claude` the GUI degrades gracefully and shows the hints instead.
5
+ * Probe the host for everything cez leans on: the agent CLIs (`claude`, and
6
+ * the optional `codex` / `opencode` alternatives), `gh` (GitHub auth for PR
7
+ * creation) and `git`. Nothing is required except at least one agent CLI — the
8
+ * GUI degrades gracefully, only offers the runners that are present, and shows
9
+ * the hints for the rest.
8
10
  */
9
11
  export async function detectEnvironment() {
10
- return Promise.all([probeClaude(), probeGh(), probeGit()]);
12
+ return Promise.all([probeClaude(), probeCodex(), probeOpencode(), probeGh(), probeGit()]);
11
13
  }
12
14
  async function probeClaude() {
13
15
  if (process.env.CEZ_DRY_RUN === '1') {
@@ -40,6 +42,44 @@ async function probeClaude() {
40
42
  };
41
43
  }
42
44
  }
45
+ async function probeCodex() {
46
+ const bin = process.env.CEZ_CODEX_BIN ?? 'codex';
47
+ try {
48
+ const { stdout } = await exec(bin, ['--version'], { timeout: 10_000 });
49
+ return {
50
+ name: 'codex',
51
+ available: true,
52
+ version: stdout.trim(),
53
+ hint: 'if not authenticated, run `codex` once and log in',
54
+ };
55
+ }
56
+ catch {
57
+ return {
58
+ name: 'codex',
59
+ available: false,
60
+ hint: 'optional: install the Codex CLI (npm i -g @openai/codex) and log in to use the Codex runner',
61
+ };
62
+ }
63
+ }
64
+ async function probeOpencode() {
65
+ const bin = process.env.CEZ_OPENCODE_BIN ?? 'opencode';
66
+ try {
67
+ const { stdout } = await exec(bin, ['--version'], { timeout: 10_000 });
68
+ return {
69
+ name: 'opencode',
70
+ available: true,
71
+ version: stdout.trim(),
72
+ hint: 'if no provider is configured, run `opencode` once to set one up',
73
+ };
74
+ }
75
+ catch {
76
+ return {
77
+ name: 'opencode',
78
+ available: false,
79
+ hint: 'optional: install OpenCode (https://opencode.ai) and configure a provider to use the OpenCode runner',
80
+ };
81
+ }
82
+ }
43
83
  async function probeGh() {
44
84
  try {
45
85
  const { stdout } = await exec('gh', ['auth', 'token'], { timeout: 10_000 });
@@ -1 +1 @@
1
- {"version":3,"file":"backend-detect.js","sourceRoot":"","sources":["../../src/core/backend-detect.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC,MAAM,IAAI,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC;AASjC;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB;IACrC,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,WAAW,EAAE,EAAE,OAAO,EAAE,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC;AAC7D,CAAC;AAED,KAAK,UAAU,WAAW;IACxB,IAAI,OAAO,CAAC,GAAG,CAAC,WAAW,KAAK,GAAG,EAAE,CAAC;QACpC,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,IAAI,EAAE,OAAO,EAAE,sBAAsB,EAAE,CAAC;IAC9E,CAAC;IACD,IAAI,CAAC;QACH,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,IAAI,CAAC,QAAQ,EAAE,CAAC,WAAW,CAAC,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,CAAC;QAC5E,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,EAAE,CAAC;QAC9B,4EAA4E;QAC5E,yEAAyE;QACzE,IAAI,CAAC,mDAAmD,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC;YACvE,OAAO;gBACL,IAAI,EAAE,QAAQ;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AM,CAAC,IAAI,EAAE,EAAE,CAAC;IAClE,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,IAAI,EAAE,aAAa,EAAE,CAAC;IAChE,CAAC;AACH,CAAC;AAED,8EAA8E;AAC9E,MAAM,CAAC,KAAK,UAAU,mBAAmB;IACvC,IAAI,CAAC;QACH,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,IAAI,CAAC,IAAI,EAAE,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,CAAC;QAC5E,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,EAAE,CAAC;QAC5B,IAAI,KAAK;YAAE,OAAO,KAAK,CAAC;IAC1B,CAAC;IAAC,MAAM,CAAC;QACP,8BAA8B;IAChC,CAAC;IACD,OAAO,OAAO,CAAC,GAAG,CAAC,YAAY,EAAE,IAAI,EAAE,IAAI,IAAI,CAAC;AAClD,CAAC"}
@@ -1,4 +1,5 @@
1
- import type { AgentEvent, AgentRunResult, AgentRunSpec, AgentRunner, ContentBlock } from './agent-runner.js';
1
+ import type { AgentEvent, AgentRunResult, AgentRunSpec, AgentRunner, AgentSession, SessionOptions } from './agent-runner.js';
2
+ export type { AgentSession, SessionOptions } from './agent-runner.js';
2
3
  /** Default wall-clock cap for a single run before SIGTERM → SIGKILL.
3
4
  * Interactive sessions pass `timeoutMs: 0` to disable it entirely. */
4
5
  export declare const DEFAULT_RUN_TIMEOUT_MS: number;
@@ -16,29 +17,6 @@ export interface ClaudeCliRunnerOptions {
16
17
  /** Wall-clock timeout for a run (ms); per-spec `timeoutMs` still wins. */
17
18
  timeoutMs?: number;
18
19
  }
19
- export interface SessionOptions {
20
- /** Close the session shortly after the first turn ends (single-turn
21
- * behavior, used for non-interactive workflow steps). Interactive
22
- * sessions omit this and control `end()` themselves. */
23
- autoEndAfterFirstTurn?: boolean;
24
- }
25
- /**
26
- * A live agent session over one spawned claude process. The process stays
27
- * alive between turns (no `-p`) and reads further user messages from stdin —
28
- * that's what makes mid-task follow-ups and pasted screenshots possible.
29
- */
30
- export interface AgentSession {
31
- /** Resolves when the claude process exits — the session is fully over. */
32
- result: Promise<AgentRunResult>;
33
- /** Write a user message into the live session. False when stdin is closed. */
34
- sendMessage(content: ContentBlock[]): boolean;
35
- /** Graceful close: EOF on stdin, then the SIGTERM→SIGKILL watchdog. */
36
- end(): void;
37
- /** Hard stop (used by cancel). */
38
- interrupt(): void;
39
- /** True while the session still accepts messages. */
40
- readonly open: boolean;
41
- }
42
20
  /**
43
21
  * `AgentRunner` over the Claude Code CLI in headless stream-json mode. Auth =
44
22
  * the host's logged-in Pro/Max subscription (no API key needed). Sandboxing is
@@ -50,7 +28,7 @@ export interface AgentSession {
50
28
  * came from @cezar/core's `ClaudeCodeCliRunner`.
51
29
  */
52
30
  export declare class ClaudeCliRunner implements AgentRunner {
53
- readonly backend: "claude-cli";
31
+ readonly backend: "claude";
54
32
  private readonly bin;
55
33
  private readonly timeoutMs;
56
34
  private lastSession;