@open-mercato/cezar 0.9.0 → 0.9.1-pr470.726
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/README.md +27 -8
- package/dist/config.d.ts +21 -3
- package/dist/config.js +42 -1
- package/dist/config.js.map +1 -1
- package/dist/core/agent-env.js +21 -15
- package/dist/core/agent-env.js.map +1 -1
- package/dist/core/agent-runner.d.ts +16 -6
- package/dist/core/agent-runner.js +15 -3
- package/dist/core/agent-runner.js.map +1 -1
- package/dist/core/backend-detect.d.ts +5 -5
- package/dist/core/backend-detect.js +37 -5
- package/dist/core/backend-detect.js.map +1 -1
- package/dist/core/claude-cli-runner.d.ts +16 -1
- package/dist/core/claude-cli-runner.js +8 -3
- package/dist/core/claude-cli-runner.js.map +1 -1
- package/dist/core/claude-ui-mapper.d.ts +9 -0
- package/dist/core/claude-ui-mapper.js +31 -2
- package/dist/core/claude-ui-mapper.js.map +1 -1
- package/dist/core/codex-app-server-runner.js +19 -18
- package/dist/core/codex-app-server-runner.js.map +1 -1
- package/dist/core/model-identity.js +4 -0
- package/dist/core/model-identity.js.map +1 -1
- package/dist/core/model-presets.js +5 -0
- package/dist/core/model-presets.js.map +1 -1
- package/dist/core/opencode-server-runner.js +25 -5
- package/dist/core/opencode-server-runner.js.map +1 -1
- package/dist/core/pi-runner.d.ts +40 -0
- package/dist/core/pi-runner.js +49 -0
- package/dist/core/pi-runner.js.map +1 -0
- package/dist/core/runner-factory.js +3 -0
- package/dist/core/runner-factory.js.map +1 -1
- package/dist/core/tool-display.d.ts +2 -1
- package/dist/core/tool-display.js +6 -1
- package/dist/core/tool-display.js.map +1 -1
- package/dist/core/ui-events.d.ts +1 -1
- package/dist/core/v1-text-coalescer.d.ts +36 -0
- package/dist/core/v1-text-coalescer.js +72 -0
- package/dist/core/v1-text-coalescer.js.map +1 -0
- package/dist/index.js +40 -4
- package/dist/index.js.map +1 -1
- package/dist/runs/auto-name.js +6 -0
- package/dist/runs/auto-name.js.map +1 -1
- package/dist/runs/store.d.ts +19 -12
- package/dist/runs/store.js +51 -15
- package/dist/runs/store.js.map +1 -1
- package/dist/server/capabilities.d.ts +6 -0
- package/dist/server/capabilities.js +6 -0
- package/dist/server/capabilities.js.map +1 -1
- package/dist/server/open-in-app.d.ts +2 -1
- package/dist/server/open-in-app.js +1 -0
- package/dist/server/open-in-app.js.map +1 -1
- package/dist/server/server.d.ts +49 -0
- package/dist/server/server.js +339 -19
- package/dist/server/server.js.map +1 -1
- package/dist/server/ws.d.ts +85 -0
- package/dist/server/ws.js +218 -0
- package/dist/server/ws.js.map +1 -0
- package/dist/server-install/engine.d.ts +5 -0
- package/dist/server-install/engine.js +6 -0
- package/dist/server-install/engine.js.map +1 -1
- package/dist/server-install/platforms/ubuntu-vps.d.ts +11 -2
- package/dist/server-install/platforms/ubuntu-vps.js +123 -10
- package/dist/server-install/platforms/ubuntu-vps.js.map +1 -1
- package/dist/server-install/steps.js +6 -2
- package/dist/server-install/steps.js.map +1 -1
- package/dist/server-install/types.d.ts +39 -0
- package/dist/server-install/types.js +13 -0
- package/dist/server-install/types.js.map +1 -1
- package/dist/skills-remote.d.ts +11 -0
- package/dist/skills-remote.js +31 -2
- package/dist/skills-remote.js.map +1 -1
- package/dist/skills.d.ts +29 -0
- package/dist/skills.js +72 -14
- package/dist/skills.js.map +1 -1
- package/dist/workflows/run.d.ts +50 -10
- package/dist/workflows/run.js +216 -103
- package/dist/workflows/run.js.map +1 -1
- package/dist/workflows/types.d.ts +14 -14
- package/dist/workflows/types.js +2 -1
- package/dist/workflows/types.js.map +1 -1
- package/dist/workspace/config.d.ts +30 -0
- package/dist/workspace/config.js +5 -0
- package/dist/workspace/config.js.map +1 -1
- package/dist/workspace/projects-cli.d.ts +2 -0
- package/dist/workspace/projects-cli.js +21 -4
- package/dist/workspace/projects-cli.js.map +1 -1
- package/dist/workspace/projects.d.ts +5 -1
- package/dist/workspace/projects.js +5 -8
- package/dist/workspace/projects.js.map +1 -1
- package/dist/workspace/semaphore.d.ts +53 -2
- package/dist/workspace/semaphore.js +93 -5
- package/dist/workspace/semaphore.js.map +1 -1
- package/package.json +3 -1
- package/web/dist/assets/centered-state-DOsTcJZF.js +43 -0
- package/web/dist/assets/commit-list-BrxBEzRK.js +1 -0
- package/web/dist/assets/compare-variants-B6jBSSV9.js +1 -0
- package/web/dist/assets/diff-view-DOTM7r3w.js +6 -0
- package/web/dist/assets/{dist-Cw_CDvC3.js → dist-B6XQOhgM.js} +1 -1
- package/web/dist/assets/git-toolbar-BE0hxHH4.js +1 -0
- package/web/dist/assets/github-Xz78nz5l.js +1 -0
- package/web/dist/assets/index-C2F5QakS.js +30 -0
- package/web/dist/assets/index-DzroxqBG.css +2 -0
- package/web/dist/assets/lib-DPEZDBUN.js +1 -0
- package/web/dist/assets/{project-router-CT8Rt5Eu.js → project-router-BMx4e8m-.js} +1 -1
- package/web/dist/assets/repo-git-BT8qBh0L.js +1 -0
- package/web/dist/assets/{run-diff-CxIDdRwy.js → run-diff-EzbV-h61.js} +2 -2
- package/web/dist/assets/run-header-5uMuWQ_8.js +1 -0
- package/web/dist/assets/skill-empty-hint-DTUSp6Vl.js +1 -0
- package/web/dist/assets/skills-BVv19iI0.js +1 -0
- package/web/dist/assets/{tab-link-C_bk_Kvn.js → tab-link-F3uQrdm2.js} +1 -1
- package/web/dist/assets/task-changes-CYteOI-a.js +1 -0
- package/web/dist/assets/task-commits-tl6b2abZ.js +1 -0
- package/web/dist/assets/task-files-CLcsbNF6.js +2 -0
- package/web/dist/assets/task-thread-BMKci8dc.js +9 -0
- package/web/dist/assets/textarea-Bj_LCreg.js +1 -0
- package/web/dist/assets/use-desktop-CnvcfmLk.js +3 -0
- package/web/dist/assets/workflows-CHvvzTfn.js +11 -0
- package/web/dist/index.html +6 -12
- package/web/dist/assets/centered-state-zzWBfO_1.js +0 -43
- package/web/dist/assets/command-ylf8-fG0.js +0 -1
- package/web/dist/assets/compare-variants-BcR3zdtB.js +0 -1
- package/web/dist/assets/dialog-BYr_BAil.js +0 -1
- package/web/dist/assets/diff-view-DPCR7gon.js +0 -4
- package/web/dist/assets/dropdown-menu-C3GD8eLA.js +0 -1
- package/web/dist/assets/git-toolbar-CiMaCi03.js +0 -1
- package/web/dist/assets/github-BJEZbEOp.js +0 -1
- package/web/dist/assets/index-DmW_TYjO.js +0 -16
- package/web/dist/assets/index-Qbs-JRWQ.css +0 -2
- package/web/dist/assets/loader-circle-CGwIVNTv.js +0 -1
- package/web/dist/assets/prompt-templates-DW7_d8Ys.js +0 -15
- package/web/dist/assets/repo-git-BkmyKcvN.js +0 -1
- package/web/dist/assets/run-header-8nwDIWWO.js +0 -1
- package/web/dist/assets/skill-empty-hint-Cl3ESoPu.js +0 -1
- package/web/dist/assets/skills-BIpb0mqO.js +0 -1
- package/web/dist/assets/task-changes-D1bJx2uW.js +0 -1
- package/web/dist/assets/task-commits-DlhB21mR.js +0 -1
- package/web/dist/assets/task-files-ChJDOFg5.js +0 -2
- package/web/dist/assets/task-thread-J7ckxJJh.js +0 -9
- package/web/dist/assets/tasks-table--V1pKwuK.js +0 -1
- package/web/dist/assets/use-desktop-CuDnWju1.js +0 -3
- package/web/dist/assets/workflows-BksgdYAQ.js +0 -11
- package/web/dist/assets/x-DgoqYQOJ.js +0 -1
package/README.md
CHANGED
|
@@ -382,7 +382,7 @@ steps:
|
|
|
382
382
|
prompt: "{{task}}"
|
|
383
383
|
skill: project-conventions # optional — from .ai/skills or .ai/cezar/skills
|
|
384
384
|
# model: opus # optional per-step model override
|
|
385
|
-
# runner: codex # optional per-step backend: claude · codex · opencode
|
|
385
|
+
# runner: codex # optional per-step backend: claude · codex · opencode · pi
|
|
386
386
|
# allowedTools: [Read, Edit, Write, Grep, Glob, Bash]
|
|
387
387
|
- id: verify
|
|
388
388
|
name: Verify
|
|
@@ -432,8 +432,10 @@ Useful environment variables:
|
|
|
432
432
|
| `CEZ_CLAUDE_BIN=/path/to/claude` | Override which `claude` binary is used. |
|
|
433
433
|
| `CEZ_CODEX_BIN=/path/to/codex` | Override which `codex` binary is used. |
|
|
434
434
|
| `CEZ_OPENCODE_BIN=/path/to/opencode` | Override which `opencode` binary is used. |
|
|
435
|
+
| `CEZ_PI_BIN=/path/to/pi` | Override which `pi` binary is used. |
|
|
435
436
|
| `CEZ_BROWSE_ROOT=~/` | Default root for **Add project → Open local folder…**. The picker cannot navigate above it; a saved workspace value overrides the environment default and must name an existing folder. |
|
|
436
437
|
| `CEZ_PROJECTS_DIR=~/cezar/projects` | Default destination for **Clone from GitHub**. Saved workspace settings override it, and missing directories are created recursively. |
|
|
438
|
+
| `CEZ_SINGLE_PROJECT=1` | Opt into a launch-project-only cockpit: only the exact value `1` enables it. Project add, edit, checkout, folder browsing, and removal are refused and only the launch project is shown. Off by default; stored registry rows are retained, so unsetting it and restarting restores the full multi-project workspace without migration or data loss. |
|
|
437
439
|
| `GITHUB_TOKEN` | Fallback for GitHub reads/PRs when `gh` isn't authenticated. |
|
|
438
440
|
| `CEZ_ENV_PASSTHROUGH=A,B` | Forward these extra host env vars to spawned agents. By default agents get a least-privilege env (safe shell/toolchain vars + the backend's own auth + `GITHUB_TOKEN` + `CEZ_*`), not your full environment — use this to add a var an agent needs. |
|
|
439
441
|
| `CEZ_AGENT_ENV_FULL=1` | Escape hatch: give spawned agents the full host environment (pre-hardening behavior). Off by default; only set it if you understand that this hands every host secret to the agent process. |
|
|
@@ -441,27 +443,29 @@ Useful environment variables:
|
|
|
441
443
|
| `CEZ_TITLE_UPDATES=0` | Turn off the live task-title refresh (namer re-runs on each turn end). The Settings → Agents toggle overrides this default. |
|
|
442
444
|
| `CEZ_AUTONAME=0` | Disable ALL LLM task naming (creation + live) — titles stay heuristic (`437: /om-auto-review-pr`). Under `CEZ_DRY_RUN=1` naming is already off unless forced with `CEZ_AUTONAME=1`. |
|
|
443
445
|
| `CEZ_REVIEW_GATE=1` | Turn ON the optional diff-first review gate (#489): a successful, non-autonomous run with changes parks at `review` (Accept / Send back / Draft PR) instead of finishing. Off by default — changed runs settle to `done` with the diff left in the worktree. Only `1` enables. The Settings → Agents toggle overrides this; autonomous runs always skip it. |
|
|
444
|
-
| `CEZ_NO_BANNER=1` | Skip the `open-mercato/skills` banner on `cezar serve` startup.
|
|
446
|
+
| `CEZ_NO_BANNER=1` | Skip the `open-mercato/skills` banner on `cezar serve` startup. (The cockpit no longer shows a banner — its skills now live on the Skills page's Manage panel — so this env var is the terminal banner's only switch.) |
|
|
445
447
|
|
|
446
448
|
---
|
|
447
449
|
|
|
448
450
|
## Coding agent backends
|
|
449
451
|
|
|
450
452
|
cezar is not married to one vendor. Every agent step runs through a single
|
|
451
|
-
`AgentRunner` seam with
|
|
453
|
+
`AgentRunner` seam with four built-in backends:
|
|
452
454
|
|
|
453
455
|
| Backend | CLI | How cezar drives it | Tool access |
|
|
454
456
|
|---|---|---|---|
|
|
455
457
|
| **Claude Code** (default) | [`claude`](https://github.com/anthropics/claude-code) | Headless `stream-json` mode. | Per-tool `--allowedTools` (`bashAllowlist` scopes `Bash`); `dontAsk` denies unapproved tools without prompting (`CEZ_APPROVAL_GATE=1` → `acceptEdits` + approval UI). |
|
|
456
458
|
| **Codex** | [`codex`](https://github.com/openai/codex) | `codex app-server` — JSON-RPC over stdio, the same transport the Codex IDE extensions use. | Ignores `allowedTools`; the default auto mode uses `danger-full-access` with `approvalPolicy: never` (`CEZ_CODEX_NETWORK=0` opts into the network-blocked `workspace-write` sandbox). |
|
|
457
459
|
| **OpenCode** _(experimental)_ | [`opencode`](https://opencode.ai) | `opencode serve` — a local HTTP server with an SSE event stream. | Ignores `allowedTools` entirely; every permission is auto-approved. |
|
|
460
|
+
| **pi** _(experimental)_ | `pi` | Headless Claude-compatible `stream-json`; models are picked with the `provider/model` convention. | Same as Claude Code — the runner delegates to the Claude CLI driver, so per-tool `--allowedTools` applies and unapproved tools are denied. |
|
|
458
461
|
|
|
459
|
-
> ⚠️ **OpenCode support
|
|
460
|
-
> than the Claude Code and Codex backends, and OpenCode auto-approves
|
|
461
|
-
> (it ignores `allowedTools`). Treat
|
|
462
|
+
> ⚠️ **OpenCode and pi support are experimental.** Both runners work but are less
|
|
463
|
+
> battle-tested than the Claude Code and Codex backends, and OpenCode auto-approves
|
|
464
|
+
> every permission (it ignores `allowedTools`). Treat them as previews and expect
|
|
465
|
+
> rough edges.
|
|
462
466
|
|
|
463
467
|
On startup cezar probes which CLIs are installed and the cockpit only offers
|
|
464
|
-
the backends it found — install any one of the
|
|
468
|
+
the backends it found — install any one of the four and you're operational.
|
|
465
469
|
|
|
466
470
|
**Pick a backend at three levels** (most specific wins):
|
|
467
471
|
|
|
@@ -520,9 +524,24 @@ On `ubuntu-vps` a single host can run several independent cockpits — add
|
|
|
520
524
|
`--domain <host>` and each gets its own port, nginx site, login and service; a
|
|
521
525
|
new domain never resumes or clobbers the first install.
|
|
522
526
|
|
|
527
|
+
**Already running a reverse proxy?** If Dokploy, Coolify, Caddy or your own
|
|
528
|
+
nginx already owns `:80/:443`, cezar's would fight it for the ports. Install the
|
|
529
|
+
service only and let your proxy front it:
|
|
530
|
+
|
|
531
|
+
```bash
|
|
532
|
+
npx cezar-cli server-install --platform ubuntu-vps \
|
|
533
|
+
--external-proxy --domain cezar.example.com --bind-host 172.17.0.1
|
|
534
|
+
```
|
|
535
|
+
|
|
536
|
+
`--bind-host` is only needed when the proxy runs in a **container** (Traefik
|
|
537
|
+
can't reach the host's loopback); a host-installed proxy uses the `127.0.0.1`
|
|
538
|
+
default. In this mode **your proxy must enforce authentication** — cezar has
|
|
539
|
+
none of its own. [Details →](docs/server-install/ubuntu-vps.md#the-box-already-has-a-reverse-proxy-dokploy-coolify-caddy)
|
|
540
|
+
|
|
523
541
|
| Provider | `--platform` | Public front | Guide |
|
|
524
542
|
|----------|--------------|--------------|-------|
|
|
525
543
|
| Ubuntu / Debian VPS | `ubuntu-vps` | nginx + Let's Encrypt HTTPS, htpasswd login, systemd | [Step-by-step →](docs/server-install/ubuntu-vps.md) |
|
|
544
|
+
| Ubuntu + existing proxy | `ubuntu-vps --external-proxy` | your Dokploy/Traefik/Caddy front; cezar ships the service only | [Step-by-step →](docs/server-install/ubuntu-vps.md#the-box-already-has-a-reverse-proxy-dokploy-coolify-caddy) |
|
|
526
545
|
| macOS + ngrok | `macosx-ngrok` | ngrok tunnel + `--basic-auth`, launchd | [Step-by-step →](docs/server-install/macosx-ngrok.md) |
|
|
527
546
|
|
|
528
547
|
See the **[Remote access overview](docs/server-install/README.md)** for how it
|
|
@@ -546,7 +565,7 @@ never blocks startup):
|
|
|
546
565
|
// the source against a moving branch head — cezar verifies it resolves to
|
|
547
566
|
// exactly that commit, and reports it as `team.commit`.
|
|
548
567
|
"worktreeRetention": 10, // keep the last N finished worktrees on disk; 0 = unlimited (branch always kept)
|
|
549
|
-
"defaultRunner": "claude", // agent backend: "claude" (default) · "codex" · "opencode"
|
|
568
|
+
"defaultRunner": "claude", // agent backend: "claude" (default) · "codex" · "opencode" · "pi"
|
|
550
569
|
"plannerModel": "sonnet", // model the "Plan first" button uses to draft chains
|
|
551
570
|
"baseBranch": "develop" // branch worktrees fork from + PRs target (also settable in the Git tab)
|
|
552
571
|
}
|
package/dist/config.d.ts
CHANGED
|
@@ -54,7 +54,7 @@ declare const configSchema: z.ZodObject<{
|
|
|
54
54
|
* step (workflow). The GUI only offers runners actually installed; this is
|
|
55
55
|
* the preselected default. Also the runner the chain planner uses.
|
|
56
56
|
*/
|
|
57
|
-
defaultRunner: z.ZodDefault<z.ZodEnum<["claude", "codex", "opencode"]>>;
|
|
57
|
+
defaultRunner: z.ZodDefault<z.ZodEnum<["claude", "codex", "opencode", "pi"]>>;
|
|
58
58
|
/** Model for the chain planner (spec 008) — cheap but reliable at JSON. */
|
|
59
59
|
plannerModel: z.ZodDefault<z.ZodString>;
|
|
60
60
|
/** Model for the task namer (spec 2026-07-17-task-auto-naming) — the cheapest
|
|
@@ -94,14 +94,17 @@ declare const configSchema: z.ZodObject<{
|
|
|
94
94
|
claude: z.ZodOptional<z.ZodString>;
|
|
95
95
|
codex: z.ZodOptional<z.ZodString>;
|
|
96
96
|
opencode: z.ZodOptional<z.ZodString>;
|
|
97
|
+
pi: z.ZodOptional<z.ZodString>;
|
|
97
98
|
}, "strip", z.ZodTypeAny, {
|
|
98
99
|
claude?: string | undefined;
|
|
99
100
|
codex?: string | undefined;
|
|
100
101
|
opencode?: string | undefined;
|
|
102
|
+
pi?: string | undefined;
|
|
101
103
|
}, {
|
|
102
104
|
claude?: string | undefined;
|
|
103
105
|
codex?: string | undefined;
|
|
104
106
|
opencode?: string | undefined;
|
|
107
|
+
pi?: string | undefined;
|
|
105
108
|
}>>>;
|
|
106
109
|
}, "strip", z.ZodTypeAny, {
|
|
107
110
|
skillsRepos: {
|
|
@@ -111,7 +114,7 @@ declare const configSchema: z.ZodObject<{
|
|
|
111
114
|
maxParallel: number;
|
|
112
115
|
worktreeRetention: number;
|
|
113
116
|
memoryLimitMb?: number | undefined;
|
|
114
|
-
defaultRunner: "claude" | "codex" | "opencode";
|
|
117
|
+
defaultRunner: "claude" | "codex" | "opencode" | "pi";
|
|
115
118
|
plannerModel: string;
|
|
116
119
|
namerModel: string;
|
|
117
120
|
liveTitleUpdates?: boolean | undefined;
|
|
@@ -122,6 +125,7 @@ declare const configSchema: z.ZodObject<{
|
|
|
122
125
|
claude?: string | undefined;
|
|
123
126
|
codex?: string | undefined;
|
|
124
127
|
opencode?: string | undefined;
|
|
128
|
+
pi?: string | undefined;
|
|
125
129
|
} | undefined;
|
|
126
130
|
}, {
|
|
127
131
|
skillsRepos?: {
|
|
@@ -131,7 +135,7 @@ declare const configSchema: z.ZodObject<{
|
|
|
131
135
|
maxParallel?: number | undefined;
|
|
132
136
|
worktreeRetention?: unknown;
|
|
133
137
|
memoryLimitMb?: unknown;
|
|
134
|
-
defaultRunner?: "claude" | "codex" | "opencode" | undefined;
|
|
138
|
+
defaultRunner?: "claude" | "codex" | "opencode" | "pi" | undefined;
|
|
135
139
|
plannerModel?: string | undefined;
|
|
136
140
|
namerModel?: string | undefined;
|
|
137
141
|
liveTitleUpdates?: boolean | undefined;
|
|
@@ -143,6 +147,20 @@ declare const configSchema: z.ZodObject<{
|
|
|
143
147
|
export type CezConfig = z.infer<typeof configSchema>;
|
|
144
148
|
/** Read `.ai/cezar/config.json` on demand — never cached, never throws. */
|
|
145
149
|
export declare function loadConfig(repoRoot: string): Promise<CezConfig>;
|
|
150
|
+
/**
|
|
151
|
+
* The default skills repos that are *opt-in per skill* (the "import OM skills"
|
|
152
|
+
* flow): the set of repo identifiers a user must explicitly import from before
|
|
153
|
+
* their skills join the catalog. This is exactly `DEFAULT_SKILLS_REPOS` when the
|
|
154
|
+
* repo has NOT configured its own `skillsRepos` — the zero-config majority — and
|
|
155
|
+
* empty once a repo takes control by setting `skillsRepos` (then everything it
|
|
156
|
+
* lists auto-loads, unchanged).
|
|
157
|
+
*
|
|
158
|
+
* `loadConfig` cannot answer this: the schema's `.default(DEFAULT_SKILLS_REPOS)`
|
|
159
|
+
* materializes the key, so a parsed config can't tell "the user chose these" from
|
|
160
|
+
* "the user said nothing". So we probe the raw file for the key's presence — the
|
|
161
|
+
* same reason `ownWorktreeRetention` below reads the raw JSON.
|
|
162
|
+
*/
|
|
163
|
+
export declare function gatedSkillsRepos(repoRoot: string): Promise<Set<string>>;
|
|
146
164
|
/**
|
|
147
165
|
* Effective worktree retention for a repo (#483 + spec
|
|
148
166
|
* 2026-07-20-multi-project-workspace). Precedence, exactly what Settings →
|
package/dist/config.js
CHANGED
|
@@ -2,6 +2,7 @@ import { readFile } from 'node:fs/promises';
|
|
|
2
2
|
import { join } from 'node:path';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
import { loadWorkspaceConfig } from './workspace/config.js';
|
|
5
|
+
import { RUNNER_IDS } from './core/agent-runner.js';
|
|
5
6
|
/**
|
|
6
7
|
* Optional advanced config at `.ai/cezar/config.json`. Zero-config rule:
|
|
7
8
|
* a missing file behaves exactly like the default below, an unreadable or
|
|
@@ -46,7 +47,7 @@ const configSchema = z.object({
|
|
|
46
47
|
* step (workflow). The GUI only offers runners actually installed; this is
|
|
47
48
|
* the preselected default. Also the runner the chain planner uses.
|
|
48
49
|
*/
|
|
49
|
-
defaultRunner: z.enum(
|
|
50
|
+
defaultRunner: z.enum(RUNNER_IDS).default('claude'),
|
|
50
51
|
/** Model for the chain planner (spec 008) — cheap but reliable at JSON. */
|
|
51
52
|
plannerModel: z.string().min(1).default('sonnet'),
|
|
52
53
|
/** Model for the task namer (spec 2026-07-17-task-auto-naming) — the cheapest
|
|
@@ -87,6 +88,7 @@ const configSchema = z.object({
|
|
|
87
88
|
claude: z.string().trim().min(1).max(200).optional(),
|
|
88
89
|
codex: z.string().trim().min(1).max(200).optional(),
|
|
89
90
|
opencode: z.string().trim().min(1).max(200).optional(),
|
|
91
|
+
pi: z.string().trim().min(1).max(200).optional(),
|
|
90
92
|
})
|
|
91
93
|
.optional()
|
|
92
94
|
.catch(undefined),
|
|
@@ -141,6 +143,45 @@ async function ownWorktreeRetention(repoRoot) {
|
|
|
141
143
|
return undefined; // malformed JSON — same as unset
|
|
142
144
|
}
|
|
143
145
|
}
|
|
146
|
+
/**
|
|
147
|
+
* The default skills repos that are *opt-in per skill* (the "import OM skills"
|
|
148
|
+
* flow): the set of repo identifiers a user must explicitly import from before
|
|
149
|
+
* their skills join the catalog. This is exactly `DEFAULT_SKILLS_REPOS` when the
|
|
150
|
+
* repo has NOT configured its own `skillsRepos` — the zero-config majority — and
|
|
151
|
+
* empty once a repo takes control by setting `skillsRepos` (then everything it
|
|
152
|
+
* lists auto-loads, unchanged).
|
|
153
|
+
*
|
|
154
|
+
* `loadConfig` cannot answer this: the schema's `.default(DEFAULT_SKILLS_REPOS)`
|
|
155
|
+
* materializes the key, so a parsed config can't tell "the user chose these" from
|
|
156
|
+
* "the user said nothing". So we probe the raw file for the key's presence — the
|
|
157
|
+
* same reason `ownWorktreeRetention` below reads the raw JSON.
|
|
158
|
+
*/
|
|
159
|
+
export async function gatedSkillsRepos(repoRoot) {
|
|
160
|
+
const none = new Set();
|
|
161
|
+
let raw;
|
|
162
|
+
try {
|
|
163
|
+
raw = await readFile(join(repoRoot, '.ai/cezar', 'config.json'), 'utf8');
|
|
164
|
+
}
|
|
165
|
+
catch {
|
|
166
|
+
// No file — the defaults are in effect, so they are the opt-in set.
|
|
167
|
+
return new Set(DEFAULT_SKILLS_REPOS.map((r) => r.repo));
|
|
168
|
+
}
|
|
169
|
+
try {
|
|
170
|
+
const parsed = JSON.parse(raw);
|
|
171
|
+
if (!parsed || typeof parsed !== 'object') {
|
|
172
|
+
return new Set(DEFAULT_SKILLS_REPOS.map((r) => r.repo));
|
|
173
|
+
}
|
|
174
|
+
// The user took control of the source list — nothing is gated; a value the
|
|
175
|
+
// schema would refuse degrades to the default too (same as `loadConfig`).
|
|
176
|
+
if (parsed.skillsRepos !== undefined)
|
|
177
|
+
return none;
|
|
178
|
+
return new Set(DEFAULT_SKILLS_REPOS.map((r) => r.repo));
|
|
179
|
+
}
|
|
180
|
+
catch {
|
|
181
|
+
// Malformed JSON degrades to the default (which loadConfig also does).
|
|
182
|
+
return new Set(DEFAULT_SKILLS_REPOS.map((r) => r.repo));
|
|
183
|
+
}
|
|
184
|
+
}
|
|
144
185
|
/**
|
|
145
186
|
* Effective worktree retention for a repo (#483 + spec
|
|
146
187
|
* 2026-07-20-multi-project-workspace). Precedence, exactly what Settings →
|
package/dist/config.js.map
CHANGED
|
@@ -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;AACxB,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],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G,CAAC,CAAC;QACxC,IAAI,CAAC,MAAM,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE,CAAC;YAC1C,OAAO,IAAI,GAAG,CAAC,oBAAoB,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;QAC1D,CAAC;QACD,2EAA2E;QAC3E,0EAA0E;QAC1E,IAAK,MAAkC,CAAC,WAAW,KAAK,SAAS;YAAE,OAAO,IAAI,CAAC;QAC/E,OAAO,IAAI,GAAG,CAAC,oBAAoB,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;IAC1D,CAAC;IAAC,MAAM,CAAC;QACP,uEAAuE;QACvE,OAAO,IAAI,GAAG,CAAC,oBAAoB,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;IAC1D,CAAC;AACH,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,CAAC,KAAK,UAAU,wBAAwB,CAAC,QAAgB;IAC7D,MAAM,GAAG,GAAG,MAAM,oBAAoB,CAAC,QAAQ,CAAC,CAAC;IACjD,IAAI,GAAG,KAAK,SAAS;QAAE,OAAO,GAAG,CAAC;IAClC,MAAM,SAAS,GAAG,MAAM,mBAAmB,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC;IAChE,OAAO,SAAS,EAAE,SAAS,CAAC,wBAAwB,IAAI,0BAA0B,CAAC;AACrF,CAAC"}
|
package/dist/core/agent-env.js
CHANGED
|
@@ -192,26 +192,32 @@ const BASE_ALLOW_PREFIXES = [
|
|
|
192
192
|
'MISE_',
|
|
193
193
|
'COMPOSER_',
|
|
194
194
|
];
|
|
195
|
+
/** The provider credentials a backend that selects models as `provider/model` may need — it can
|
|
196
|
+
* be pointed at any of them, so none can be pruned without breaking a legitimate model id. */
|
|
197
|
+
const MULTI_PROVIDER_PREFIXES = [
|
|
198
|
+
'OPENAI_',
|
|
199
|
+
'ANTHROPIC_',
|
|
200
|
+
'AZURE_OPENAI_',
|
|
201
|
+
'OPENROUTER_',
|
|
202
|
+
'GROQ_',
|
|
203
|
+
'MISTRAL_',
|
|
204
|
+
'GEMINI_',
|
|
205
|
+
'GOOGLE_GENERATIVE_AI_',
|
|
206
|
+
'DEEPSEEK_',
|
|
207
|
+
'XAI_',
|
|
208
|
+
'PERPLEXITY_',
|
|
209
|
+
'TOGETHER_',
|
|
210
|
+
'FIREWORKS_',
|
|
211
|
+
];
|
|
195
212
|
/** Per-backend auth/config the runner genuinely needs, by prefix. */
|
|
196
213
|
const BACKEND_ALLOW_PREFIXES = {
|
|
197
214
|
claude: ['ANTHROPIC_', 'CLAUDE_'],
|
|
198
215
|
'claude-cli': ['ANTHROPIC_', 'CLAUDE_'],
|
|
199
216
|
codex: ['OPENAI_', 'CODEX_', 'AZURE_OPENAI_'],
|
|
200
|
-
opencode:
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
'OPENROUTER_',
|
|
205
|
-
'GROQ_',
|
|
206
|
-
'MISTRAL_',
|
|
207
|
-
'GEMINI_',
|
|
208
|
-
'GOOGLE_GENERATIVE_AI_',
|
|
209
|
-
'DEEPSEEK_',
|
|
210
|
-
'XAI_',
|
|
211
|
-
'PERPLEXITY_',
|
|
212
|
-
'TOGETHER_',
|
|
213
|
-
'FIREWORKS_',
|
|
214
|
-
],
|
|
217
|
+
opencode: MULTI_PROVIDER_PREFIXES,
|
|
218
|
+
// pi drives a Claude-compatible CLI but selects models as `provider/model` (#387), so it
|
|
219
|
+
// needs both the Claude-side config and any provider a `provider/model` id can name.
|
|
220
|
+
pi: ['PI_', 'CLAUDE_', ...MULTI_PROVIDER_PREFIXES],
|
|
215
221
|
};
|
|
216
222
|
/** `gh` handoff (draft PRs) works in every backend — the one credential the
|
|
217
223
|
* project deliberately keeps in the environment (AGENTS.md "No secrets in
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-env.js","sourceRoot":"","sources":["../../src/core/agent-env.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAGH,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEvD;;;;;;;GAOG;AACH,SAAS,QAAQ,CAAC,KAAwB;IACxC,OAAO,IAAI,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC;AACpD,CAAC;AAED,6EAA6E;AAC7E,MAAM,gBAAgB,GAAwB,QAAQ,CAAC;IACrD,gCAAgC;IAChC,MAAM;IACN,MAAM;IACN,OAAO;IACP,MAAM;IACN,SAAS;IACT,OAAO;IACP,KAAK;IACL,QAAQ;IACR,OAAO;IACP,UAAU;IACV,MAAM;IACN,UAAU;IACV,UAAU;IACV,QAAQ;IACR,QAAQ;IACR,MAAM;IACN,KAAK;IACL,IAAI;IACJ,SAAS;IACT,MAAM;IACN,UAAU;IACV,qBAAqB;IACrB,MAAM;IACN,UAAU;IACV,WAAW;IACX,SAAS;IACT,OAAO;IACP,UAAU;IACV,aAAa;IACb,UAAU;IACV,SAAS;IACT,iBAAiB;IACjB,YAAY;IACZ,uEAAuE;IACvE,eAAe;IACf,eAAe;IACf,mBAAmB;IACnB,QAAQ;IACR,QAAQ;IACR,OAAO;IACP,MAAM;IACN,SAAS;IACT,UAAU;IACV,oCAAoC;IACpC,WAAW;IACX,YAAY;IACZ,qBAAqB;IACrB,SAAS;IACT,iBAAiB;IACjB,eAAe;IACf,yEAAyE;IACzE,YAAY;IACZ,aAAa;IACb,WAAW;IACX,WAAW;IACX,UAAU;IACV,2EAA2E;IAC3E,wEAAwE;IACxE,wEAAwE;IACxE,4EAA4E;IAC5E,oCAAoC;IACpC,YAAY;IACZ,aAAa;IACb,QAAQ;IACR,SAAS;IACT,SAAS;I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SAAS,CAAC;IACvC,KAAK,EAAE,CAAC,SAAS,EAAE,QAAQ,EAAE,eAAe,CAAC;IAC7C,QAAQ,EAAE
|
|
1
|
+
{"version":3,"file":"agent-env.js","sourceRoot":"","sources":["../../src/core/agent-env.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAGH,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEvD;;;;;;;GAOG;AACH,SAAS,QAAQ,CAAC,KAAwB;IACxC,OAAO,IAAI,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC;AACpD,CAAC;AAED,6EAA6E;AAC7E,MAAM,gBAAgB,GAAwB,QAAQ,CAAC;IACrD,gCAAgC;IAChC,MAAM;IACN,MAAM;IACN,OAAO;IACP,MAAM;IACN,SAAS;IACT,OAAO;IACP,KAAK;IACL,QAAQ;IACR,OAAO;IACP,UAAU;IACV,MAAM;IACN,UAAU;IACV,UAAU;IACV,QAAQ;IACR,QAAQ;IACR,MAAM;IACN,KAAK;IACL,IAAI;IACJ,SAAS;IACT,MAAM;IACN,UAAU;IACV,qBAAqB;IACrB,MAAM;IACN,UAAU;IACV,WAAW;IACX,SAAS;IACT,OAAO;IACP,UAAU;IACV,aAAa;IACb,UAAU;IACV,SAAS;IACT,iBAAiB;IACjB,YAAY;IACZ,uEAAuE;IACvE,eAAe;IACf,eAAe;IACf,mBAAmB;IACnB,QAAQ;IACR,QAAQ;IACR,OAAO;IACP,MAAM;IACN,SAAS;IACT,UAAU;IACV,oCAAoC;IACpC,WAAW;IACX,YAAY;IACZ,qBAAqB;IACrB,SAAS;IACT,iBAAiB;IACjB,eAAe;IACf,yEAAyE;IACzE,YAAY;IACZ,aAAa;IACb,WAAW;IACX,WAAW;IACX,UAAU;IACV,2EAA2E;IAC3E,wEAAwE;IACxE,wEAAwE;IACxE,4EAA4E;IAC5E,oCAA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C;IACrE,OAAO,GAAG,CAAC;IAEX,4EAA4E;IAC5E,SAAS,KAAK,CAAC,IAAY;QACzB,MAAM,GAAG,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC;QAC/B,wEAAwE;QACxE,IAAI,GAAG,CAAC,UAAU,CAAC,MAAM,CAAC;YAAE,OAAO,IAAI,CAAC;QACxC,uEAAuE;QACvE,4EAA4E;QAC5E,qEAAqE;QACrE,wDAAwD;QACxD,IAAI,cAAc,CAAC,GAAG,CAAC,GAAG,CAAC;YAAE,OAAO,IAAI,CAAC;QACzC,IAAI,aAAa,CAAC,GAAG,EAAE,eAAe,CAAC;YAAE,OAAO,IAAI,CAAC;QACrD,IAAI,UAAU,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,aAAa,CAAC,GAAG,EAAE,aAAa,CAAC;YAAE,OAAO,IAAI,CAAC;QAC1E,+BAA+B;QAC/B,IAAI,WAAW,CAAC,GAAG,CAAC,GAAG,CAAC;YAAE,OAAO,IAAI,CAAC;QACtC,0EAA0E;QAC1E,uEAAuE;QACvE,uEAAuE;QACvE,IAAI,gBAAgB,CAAC,GAAG,CAAC,GAAG,CAAC;YAAE,OAAO,IAAI,CAAC;QAC3C,IAAI,aAAa,CAAC,GAAG,EAAE,mBAAmB,CAAC,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC;YAAE,OAAO,IAAI,CAAC;QAC9E,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC"}
|
|
@@ -4,18 +4,28 @@
|
|
|
4
4
|
* no token-budget circuit breaker, no zod response schemas — one run is one
|
|
5
5
|
* agent-CLI session streaming normalized events.
|
|
6
6
|
*
|
|
7
|
-
*
|
|
7
|
+
* Four interchangeable backends implement this seam, each as a persistent
|
|
8
8
|
* process so multi-turn follow-ups, `waiting`, interrupt and resume all work:
|
|
9
9
|
* - `claude` — Claude Code CLI, stream-json over stdin/stdout;
|
|
10
10
|
* - `codex` — `codex app-server`, JSON-RPC 2.0 (JSONL) over stdin/stdout;
|
|
11
|
-
* - `opencode` — `opencode serve`, HTTP + SSE
|
|
11
|
+
* - `opencode` — `opencode serve`, HTTP + SSE;
|
|
12
|
+
* - `pi` — pi coding CLI, Claude-compatible stream-json over
|
|
13
|
+
* stdin/stdout, selecting its model with `provider/model`.
|
|
12
14
|
*/
|
|
13
15
|
import type { UiEvent } from './ui-events.js';
|
|
14
|
-
/**
|
|
15
|
-
|
|
16
|
+
/**
|
|
17
|
+
* The user-selectable runners (what config/GUI expose), in display order — the SINGLE source of
|
|
18
|
+
* truth for the set. Every runtime enumeration derives from this tuple (zod schemas, the
|
|
19
|
+
* server-install "at least one agent CLI" gate, the CLI-handoff registry) rather than repeating
|
|
20
|
+
* the literals, so adding runner #5 is a one-line change here and typecheck finds the rest.
|
|
21
|
+
*/
|
|
22
|
+
export declare const RUNNER_IDS: readonly ['claude', 'codex', 'opencode', 'pi'];
|
|
16
23
|
/** The user-selectable runners (what config/GUI expose). */
|
|
17
|
-
export type RunnerId =
|
|
18
|
-
|
|
24
|
+
export type RunnerId = (typeof RUNNER_IDS)[number];
|
|
25
|
+
/** `claude-cli` is the legacy id kept so old run records still parse. */
|
|
26
|
+
export type AgentBackend = RunnerId | 'claude-cli';
|
|
27
|
+
/** Narrow an arbitrary string (a config value, a check name) to a runner id. */
|
|
28
|
+
export declare function isRunnerId(value: string): value is RunnerId;
|
|
19
29
|
export interface AgentRunSpec {
|
|
20
30
|
/** Appended to the CLI's default system prompt (`--append-system-prompt`). */
|
|
21
31
|
systemPrompt?: string;
|
|
@@ -4,13 +4,25 @@
|
|
|
4
4
|
* no token-budget circuit breaker, no zod response schemas — one run is one
|
|
5
5
|
* agent-CLI session streaming normalized events.
|
|
6
6
|
*
|
|
7
|
-
*
|
|
7
|
+
* Four interchangeable backends implement this seam, each as a persistent
|
|
8
8
|
* process so multi-turn follow-ups, `waiting`, interrupt and resume all work:
|
|
9
9
|
* - `claude` — Claude Code CLI, stream-json over stdin/stdout;
|
|
10
10
|
* - `codex` — `codex app-server`, JSON-RPC 2.0 (JSONL) over stdin/stdout;
|
|
11
|
-
* - `opencode` — `opencode serve`, HTTP + SSE
|
|
11
|
+
* - `opencode` — `opencode serve`, HTTP + SSE;
|
|
12
|
+
* - `pi` — pi coding CLI, Claude-compatible stream-json over
|
|
13
|
+
* stdin/stdout, selecting its model with `provider/model`.
|
|
12
14
|
*/
|
|
13
|
-
|
|
15
|
+
/**
|
|
16
|
+
* The user-selectable runners (what config/GUI expose), in display order — the SINGLE source of
|
|
17
|
+
* truth for the set. Every runtime enumeration derives from this tuple (zod schemas, the
|
|
18
|
+
* server-install "at least one agent CLI" gate, the CLI-handoff registry) rather than repeating
|
|
19
|
+
* the literals, so adding runner #5 is a one-line change here and typecheck finds the rest.
|
|
20
|
+
*/
|
|
21
|
+
export const RUNNER_IDS = ['claude', 'codex', 'opencode', 'pi'];
|
|
22
|
+
/** Narrow an arbitrary string (a config value, a check name) to a runner id. */
|
|
23
|
+
export function isRunnerId(value) {
|
|
24
|
+
return RUNNER_IDS.includes(value);
|
|
25
|
+
}
|
|
14
26
|
/**
|
|
15
27
|
* Backends without a dedicated system-prompt channel (codex app-server,
|
|
16
28
|
* opencode serve) deliver `spec.systemPrompt` as a leading block of the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-runner.js","sourceRoot":"","sources":["../../src/core/agent-runner.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"agent-runner.js","sourceRoot":"","sources":["../../src/core/agent-runner.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAIH;;;;;GAKG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,QAAQ,EAAE,OAAO,EAAE,UAAU,EAAE,IAAI,CAAU,CAAC;AAQzE,gFAAgF;AAChF,MAAM,UAAU,UAAU,CAAC,KAAa;IACtC,OAAQ,UAAgC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AAC3D,CAAC;AAsCD;;;;;GAKG;AACH,MAAM,UAAU,mBAAmB,CAAC,YAAgC,EAAE,UAAkB;IACtF,OAAO,YAAY,CAAC,CAAC,CAAC,GAAG,YAAY,cAAc,UAAU,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC;AAC/E,CAAC"}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
export interface BackendCheck {
|
|
2
|
-
name: 'claude' | 'codex' | 'opencode' | 'gh' | 'git';
|
|
2
|
+
name: 'claude' | 'codex' | 'opencode' | 'pi' | 'gh' | 'git';
|
|
3
3
|
available: boolean;
|
|
4
4
|
version?: string;
|
|
5
5
|
hint?: string;
|
|
6
6
|
}
|
|
7
7
|
/**
|
|
8
8
|
* Probe the host for everything cez leans on: the agent CLIs (`claude`, and
|
|
9
|
-
* the optional `codex` / `opencode` alternatives), `gh` (GitHub auth for
|
|
10
|
-
* creation) and `git`. Nothing is required except at least one agent CLI —
|
|
11
|
-
* GUI degrades gracefully, only offers the runners that are present, and
|
|
12
|
-
* the hints for the rest.
|
|
9
|
+
* the optional `codex` / `opencode` / `pi` alternatives), `gh` (GitHub auth for
|
|
10
|
+
* PR creation) and `git`. Nothing is required except at least one agent CLI —
|
|
11
|
+
* the GUI degrades gracefully, only offers the runners that are present, and
|
|
12
|
+
* shows the hints for the rest.
|
|
13
13
|
*/
|
|
14
14
|
export declare function detectEnvironment(): Promise<BackendCheck[]>;
|
|
15
15
|
/** The host's GitHub token: logged-in `gh` first, `GITHUB_TOKEN` fallback. */
|
|
@@ -3,13 +3,20 @@ import { promisify } from 'node:util';
|
|
|
3
3
|
const exec = promisify(execFile);
|
|
4
4
|
/**
|
|
5
5
|
* Probe the host for everything cez leans on: the agent CLIs (`claude`, and
|
|
6
|
-
* the optional `codex` / `opencode` alternatives), `gh` (GitHub auth for
|
|
7
|
-
* creation) and `git`. Nothing is required except at least one agent CLI —
|
|
8
|
-
* GUI degrades gracefully, only offers the runners that are present, and
|
|
9
|
-
* the hints for the rest.
|
|
6
|
+
* the optional `codex` / `opencode` / `pi` alternatives), `gh` (GitHub auth for
|
|
7
|
+
* PR creation) and `git`. Nothing is required except at least one agent CLI —
|
|
8
|
+
* the GUI degrades gracefully, only offers the runners that are present, and
|
|
9
|
+
* shows the hints for the rest.
|
|
10
10
|
*/
|
|
11
11
|
export async function detectEnvironment() {
|
|
12
|
-
return Promise.all([
|
|
12
|
+
return Promise.all([
|
|
13
|
+
probeClaude(),
|
|
14
|
+
probeCodex(),
|
|
15
|
+
probeOpencode(),
|
|
16
|
+
probePi(),
|
|
17
|
+
probeGh(),
|
|
18
|
+
probeGit(),
|
|
19
|
+
]);
|
|
13
20
|
}
|
|
14
21
|
async function probeClaude() {
|
|
15
22
|
if (process.env.CEZ_DRY_RUN === '1') {
|
|
@@ -80,6 +87,31 @@ async function probeOpencode() {
|
|
|
80
87
|
};
|
|
81
88
|
}
|
|
82
89
|
}
|
|
90
|
+
async function probePi() {
|
|
91
|
+
// Dry-run stands the runner up on the shared mock, so report it present.
|
|
92
|
+
if (process.env.CEZ_DRY_RUN === '1') {
|
|
93
|
+
return { name: 'pi', available: true, version: 'mock (CEZ_DRY_RUN=1)' };
|
|
94
|
+
}
|
|
95
|
+
const bin = process.env.CEZ_PI_BIN ?? 'pi';
|
|
96
|
+
try {
|
|
97
|
+
const { stdout } = await exec(bin, ['--version'], { timeout: 10_000 });
|
|
98
|
+
return {
|
|
99
|
+
name: 'pi',
|
|
100
|
+
available: true,
|
|
101
|
+
version: stdout.trim(),
|
|
102
|
+
hint: 'if not authenticated, run `pi` once and log in',
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
catch {
|
|
106
|
+
// A missing `pi` CLI is never a boot failure — the runner just isn't
|
|
107
|
+
// offered, exactly like an absent codex/opencode.
|
|
108
|
+
return {
|
|
109
|
+
name: 'pi',
|
|
110
|
+
available: false,
|
|
111
|
+
hint: 'optional: install the pi CLI and log in to use the pi runner',
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
}
|
|
83
115
|
async function probeGh() {
|
|
84
116
|
try {
|
|
85
117
|
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;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB;IACrC,OAAO,OAAO,CAAC,GAAG,CAAC,
|
|
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;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB;IACrC,OAAO,OAAO,CAAC,GAAG,CAAC;QACjB,WAAW,EAAE;QACb,UAAU,EAAE;QACZ,aAAa,EAAE;QACf,OAAO,EAAE;QACT,OAAO,EAAE;QACT,QAAQ,EAAE;KACX,CAAC,CAAC;AACL,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,CAA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AAO,CAAC,GAAG,CAAC,YAAY,EAAE,IAAI,EAAE,IAAI,IAAI,CAAC;AAClD,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AgentEvent, AgentRunResult, AgentRunSpec, AgentRunner, AgentSession, SessionOptions } from './agent-runner.js';
|
|
1
|
+
import type { AgentBackend, AgentEvent, AgentRunResult, AgentRunSpec, AgentRunner, AgentSession, SessionOptions } from './agent-runner.js';
|
|
2
2
|
export type { AgentSession, SessionOptions } from './agent-runner.js';
|
|
3
3
|
/** Default wall-clock cap for a single run before SIGTERM → SIGKILL.
|
|
4
4
|
* Interactive sessions pass `timeoutMs: 0` to disable it entirely. */
|
|
@@ -16,6 +16,15 @@ export interface ClaudeCliRunnerOptions {
|
|
|
16
16
|
bin?: string;
|
|
17
17
|
/** Wall-clock timeout for a run (ms); per-spec `timeoutMs` still wins. */
|
|
18
18
|
timeoutMs?: number;
|
|
19
|
+
/**
|
|
20
|
+
* Which backend's credential allowlist the spawned process gets (#387). Defaults to `claude`.
|
|
21
|
+
* A runner that DELEGATES its transport to this class (`PiRunner`) still spawns its OWN binary,
|
|
22
|
+
* and `buildChildEnv` is least-privilege per backend — leaving this at `claude` would hand pi
|
|
23
|
+
* only `ANTHROPIC_`/`CLAUDE_`, so a pi run on `openai/gpt-5.1` would start with no OpenAI
|
|
24
|
+
* credential at all. Deliberately separate from the public `backend` field, which is the
|
|
25
|
+
* `AgentRunner` seam's identity and must stay `claude` for the drift guards.
|
|
26
|
+
*/
|
|
27
|
+
envBackend?: AgentBackend;
|
|
19
28
|
}
|
|
20
29
|
/**
|
|
21
30
|
* `AgentRunner` over the Claude Code CLI in headless stream-json mode. Auth =
|
|
@@ -33,6 +42,8 @@ export declare class ClaudeCliRunner implements AgentRunner {
|
|
|
33
42
|
readonly backend: 'claude';
|
|
34
43
|
private readonly bin;
|
|
35
44
|
private readonly timeoutMs;
|
|
45
|
+
/** See `ClaudeCliRunnerOptions.envBackend` — the credential allowlist to spawn under. */
|
|
46
|
+
private readonly envBackend;
|
|
36
47
|
private lastSession;
|
|
37
48
|
constructor(opts?: ClaudeCliRunnerOptions);
|
|
38
49
|
/** One-shot run: start a session and auto-end it after the first turn. */
|
|
@@ -54,3 +65,7 @@ export declare function buildClaudeArgs(spec: AgentRunSpec, env?: NodeJS.Process
|
|
|
54
65
|
* `Bash` with no allowlist stays plain `Bash`.
|
|
55
66
|
*/
|
|
56
67
|
export declare function buildAllowedTools(allowedTools: string[], bashAllowlist?: string[]): string[];
|
|
68
|
+
/** Path to the bundled mock (`scripts/mock-claude.mjs`), for CEZ_DRY_RUN=1.
|
|
69
|
+
* Exported so sibling stream-json runners (the `pi` runner, #387) reuse the
|
|
70
|
+
* one mock instead of shipping a second copy. */
|
|
71
|
+
export declare function mockClaudePath(): string;
|
|
@@ -32,6 +32,8 @@ export class ClaudeCliRunner {
|
|
|
32
32
|
backend = 'claude';
|
|
33
33
|
bin;
|
|
34
34
|
timeoutMs;
|
|
35
|
+
/** See `ClaudeCliRunnerOptions.envBackend` — the credential allowlist to spawn under. */
|
|
36
|
+
envBackend;
|
|
35
37
|
lastSession = null;
|
|
36
38
|
constructor(opts = {}) {
|
|
37
39
|
// CEZ_DRY_RUN=1 swaps in the bundled mock so the cockpit / store /
|
|
@@ -40,6 +42,7 @@ export class ClaudeCliRunner {
|
|
|
40
42
|
(process.env.CEZ_DRY_RUN === '1' ? mockClaudePath() : 'claude');
|
|
41
43
|
this.bin = opts.bin ?? defaultBin;
|
|
42
44
|
this.timeoutMs = opts.timeoutMs ?? DEFAULT_RUN_TIMEOUT_MS;
|
|
45
|
+
this.envBackend = opts.envBackend ?? this.backend;
|
|
43
46
|
}
|
|
44
47
|
/** One-shot run: start a session and auto-end it after the first turn. */
|
|
45
48
|
run(spec, onEvent) {
|
|
@@ -54,7 +57,7 @@ export class ClaudeCliRunner {
|
|
|
54
57
|
try {
|
|
55
58
|
child = nodeSpawn(this.bin, args, {
|
|
56
59
|
cwd: spec.cwd,
|
|
57
|
-
env: buildChildEnv({ backend: this.
|
|
60
|
+
env: buildChildEnv({ backend: this.envBackend, extraEnv: spec.env }),
|
|
58
61
|
});
|
|
59
62
|
}
|
|
60
63
|
catch (err) {
|
|
@@ -328,8 +331,10 @@ export function buildAllowedTools(allowedTools, bashAllowlist) {
|
|
|
328
331
|
function truncate(s, max = 200) {
|
|
329
332
|
return s.length > max ? `${s.slice(0, max)}…` : s;
|
|
330
333
|
}
|
|
331
|
-
/** Path to the bundled mock (`scripts/mock-claude.mjs`), for CEZ_DRY_RUN=1.
|
|
332
|
-
|
|
334
|
+
/** Path to the bundled mock (`scripts/mock-claude.mjs`), for CEZ_DRY_RUN=1.
|
|
335
|
+
* Exported so sibling stream-json runners (the `pi` runner, #387) reuse the
|
|
336
|
+
* one mock instead of shipping a second copy. */
|
|
337
|
+
export function mockClaudePath() {
|
|
333
338
|
const here = dirname(fileURLToPath(import.meta.url));
|
|
334
339
|
// here = <pkg>/dist/core (built) or <pkg>/src/core (tsx dev).
|
|
335
340
|
return resolvePath(here, '..', '..', 'scripts', 'mock-claude.mjs');
|