codex-sift 0.0.0-stage → 0.1.0

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 codex-sift contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,237 @@
1
- # Temporary Holding Version
1
+ # Codex Sift
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Sift is a model router for the [OpenAI Codex CLI](https://developers.openai.com/codex). It keeps the native Codex experience, but routes each user turn to the cheapest model lane that should be able to handle it.
4
+
5
+ The problem is simple: coding sessions mix tiny asks, everyday implementation, and genuinely hard work. Running every turn on the strongest model is easy, but it spends premium quota on prompts like “explain this file”, “run the tests”, or “rename this helper”. Sift adds a small decision layer before Codex spends the turn.
6
+
7
+ On every **user turn**, Sift asks [TypeSafe Jev](https://docs.typesafe.ai) how hard the task is. Your YAML policy then picks a lane — **flash**, **craft**, or **forge** — and Codex runs against that model. You still talk to the native TUI.
8
+
9
+ Jev does not write code. It returns typed signals in about 300 ms. Sift’s YAML policy turns those signals into a model id.
10
+
11
+ This is a Codex-only router. It is not an MCP server, and it does not patch `~/.codex/config.toml`.
12
+
13
+ ## Current E2E result
14
+
15
+ The latest routing report in this repository was generated with:
16
+
17
+ ```bash
18
+ npm run e2e:report
19
+ ```
20
+
21
+ Result:
22
+
23
+ | Metric | Value |
24
+ |---|---:|
25
+ | Representative cases | 12 |
26
+ | Live Jev cases | 12 |
27
+ | Degraded cases | 0 |
28
+ | Policy expectation match | 11/12 |
29
+ | Average Jev latency | 418 ms |
30
+ | Always-forge baseline | 16.20 |
31
+ | Sift routed usage | 7.50 |
32
+ | Estimated quota saved | 53.7% |
33
+
34
+ See [reports/e2e-routing.md](reports/e2e-routing.md) for the full table.
35
+
36
+ This measures routing and quota efficiency against an always-forge baseline. It does not claim answer quality unless you run and score the same prompts through Codex.
37
+
38
+ ## Why this shape
39
+
40
+ Codex has no hook that can change the model *before* a turn is billed. The supported interception point is a custom `model_provider`. Sift starts a loopback Responses proxy, launches Codex with process-local `-c` overrides, and forwards your existing ChatGPT or API-key login upstream.
41
+
42
+ ```text
43
+ you → codex-sift → Codex TUI
44
+ │
45
+ POST /responses model=sift
46
+ │
47
+ Sift proxy (127.0.0.1)
48
+ │ Jev + policy.yaml
49
+ └─► chatgpt.com/backend-api/codex or api.openai.com
50
+ ```
51
+
52
+ If you pin another model in `/model`, routing pauses. Pick **Sift** again to resume.
53
+
54
+ ## Install
55
+
56
+ Global (recommended):
57
+
58
+ ```bash
59
+ npm install -g codex-sift
60
+ codex-sift setup
61
+ ```
62
+
63
+ Or without a global install:
64
+
65
+ ```bash
66
+ npx codex-sift setup
67
+ npx codex-sift
68
+ ```
69
+
70
+ From this repo (development):
71
+
72
+ ```bash
73
+ cd codex-sift
74
+ npm install
75
+ npm run build
76
+ npm link
77
+ codex-sift setup
78
+ ```
79
+
80
+ `setup` lists your Codex models as `1, 2, 3`. You pick one for **flash**, **craft**, and **forge**. It can also save `TYPESAFE_API_KEY` to `~/.codex-sift/env` (mode 600) so you do not have to export it every session.
81
+
82
+ ## Onboarding
83
+
84
+ The onboarding flow has three steps.
85
+
86
+ First, choose the concrete Codex model behind each lane:
87
+
88
+ ```bash
89
+ codex-sift setup
90
+ ```
91
+
92
+ The default mental model is:
93
+
94
+ | Lane | Use it for |
95
+ |---|---|
96
+ | `flash` | Questions, small ops, tiny edits |
97
+ | `craft` | Normal implementation and bounded debugging |
98
+ | `forge` | Hard diagnosis, architecture, auth, migrations, production-risk work |
99
+
100
+ Second, sanity-check your environment:
101
+
102
+ ```bash
103
+ codex-sift doctor
104
+ ```
105
+
106
+ This confirms Codex is available, your auth mode is detected, and the TypeSafe key is present for live Jev routing.
107
+
108
+ Third, start Codex through Sift from any project:
109
+
110
+ ```bash
111
+ cd /path/to/your-project
112
+ codex-sift
113
+ ```
114
+
115
+ `codex-sift` takes the same arguments as `codex`. Sessions, tools, sandbox, `/resume`, and permissions stay native.
116
+
117
+ ```bash
118
+ codex-sift exec "explain src/cli.ts"
119
+ codex-sift resume --last
120
+ ```
121
+
122
+ After any routed turn, inspect the latest decision:
123
+
124
+ ```bash
125
+ codex-sift explain
126
+ ```
127
+
128
+ Or, from inside Codex, use `$sift-explain`.
129
+
130
+ ## Commands
131
+
132
+ | Command | Purpose |
133
+ |---|---|
134
+ | `codex-sift setup` | Onboarding: pick lane models by number |
135
+ | `codex-sift models` | Print the numbered Codex catalog |
136
+ | `codex-sift` | Interactive Codex with routing |
137
+ | `codex-sift route "…"` | Decide a lane; do not start Codex |
138
+ | `codex-sift explain` | Print the last decision |
139
+ | `codex-sift report` | Quota saved vs always-forge (`--live`, `--since=today`, `--json`) |
140
+ | `codex-sift demo` | Classify a sample coding day with Jev; no Codex usage |
141
+ | `codex-sift doctor` | Codex binary, auth, Jev key |
142
+ | `codex-sift init` | Copy `policy.yaml` to `~/.codex-sift/` |
143
+ | `--sift-off` | Bypass the proxy for one invocation |
144
+
145
+ Inside Codex, `$sift-explain` (skill installed on launch) reads `~/.codex-sift/last.json`.
146
+
147
+ ## Show the savings
148
+
149
+ Codex with a ChatGPT subscription bills **quota**, not API invoices. Sift’s claim is: the same coding day uses fewer forge-tier turns.
150
+
151
+ 1. Work normally through `codex-sift` for a session.
152
+ 2. In another terminal:
153
+
154
+ ```bash
155
+ codex-sift report --live --since=today
156
+ ```
157
+
158
+ That prints lane mix and “usage vs always-Sol”. Degraded turns (Jev down) are excluded so the number is not inflated.
159
+
160
+ To show the idea without burning Codex quota, Jev-classify a canned day:
161
+
162
+ ```bash
163
+ codex-sift demo
164
+ ```
165
+
166
+ For a publishable E2E report with per-case tables:
167
+
168
+ ```bash
169
+ npm run e2e:report
170
+ ```
171
+
172
+ The E2E battery calls Jev for representative coding-agent prompts, compares each route against an always-forge baseline, and writes both human-readable Markdown and machine-readable JSON. It measures routing and quota efficiency; it does not claim response quality unless you manually run the same prompts through Codex and score the answers.
173
+
174
+ Weights live in `policy.yaml` as `usage_weight` × `effort_weight`. Tune them against `/usage` after a week of real sessions.
175
+
176
+ ## Lanes
177
+
178
+ Edit the lanes in `~/.codex-sift/policy.yaml`, or run `codex-sift setup` again and type `1`, `2`, `3`. First matching rule wins.
179
+
180
+ | Lane | Default model | Use |
181
+ |---|---|---|
182
+ | `flash` | `gpt-5.6-luna` | Lookups, ops, tiny edits |
183
+ | `craft` | `gpt-5.6-terra` | Everyday implementation |
184
+ | `forge` | `gpt-5.6-sol` | Hard, high-stakes, or uncertain work |
185
+
186
+ Jev is asked atomic questions (`task_kind`, `difficulty`, `needs_reasoning`, `needs_planning`, `high_stakes`, `cross_cutting`). The policy never asks Jev “which model?”.
187
+
188
+ If Jev times out or `TYPESAFE_API_KEY` is missing, Sift fail-opens to `on_jev_down` (default `craft`) and marks the decision `degraded`.
189
+
190
+ ## What is not routed
191
+
192
+ - Tool-loop continuations of the same user turn (the chosen model stays pinned)
193
+ - `codex-auto-review` and compact/review prompts
194
+ - Codex housekeeping that is not a `/responses` call
195
+ - Invocations with `-m` / `--model` pointing at a real model
196
+
197
+ ## Auth
198
+
199
+ Sift does not read your tokens to call OpenAI. Codex sends `Authorization` and, on ChatGPT login, `chatgpt-account-id`. The proxy forwards those headers:
200
+
201
+ - ChatGPT / OAuth → `https://chatgpt.com/backend-api/codex/responses`
202
+ - API key → `https://api.openai.com/v1/responses`
203
+
204
+ A ChatGPT token is not valid on the platform API. Do not point this proxy at `api.openai.com` while logged in with ChatGPT.
205
+
206
+ ## Status line (optional)
207
+
208
+ ```toml
209
+ # ~/.codex/config.toml
210
+ statusLine = "node /absolute/path/to/codex-sift/scripts/statusline.js"
211
+ ```
212
+
213
+ ## Configuration
214
+
215
+ | Variable | Meaning |
216
+ |---|---|
217
+ | `TYPESAFE_API_KEY` | Jev credentials |
218
+ | `TYPESAFE_BASE_URL` | Override, default `https://api.typesafe.ai` |
219
+ | `SIFT_POLICY` | Extra YAML overlay |
220
+ | `SIFT_HOME` | Default `~/.codex-sift` |
221
+ | `SIFT_DISABLED=1` | Disable routing |
222
+ | `CODEX_BIN` | Codex executable if it is not on `PATH` |
223
+ | `SIFT_CHATGPT_ORIGIN` / `SIFT_OPENAI_ORIGIN` | Test upstreams |
224
+
225
+ Pin `jev_model` in YAML (`jev-1.13.0`). Do not ship thresholds against `jev-latest`.
226
+
227
+ ## Development
228
+
229
+ ```bash
230
+ npm test
231
+ npm run build
232
+ npx tsx src/cli.ts route "rename the unused helper"
233
+ ```
234
+
235
+ ## License
236
+
237
+ MIT
@@ -0,0 +1,19 @@
1
+ import type { Policy } from "./types.js";
2
+ type ModelInfo = Record<string, unknown> & {
3
+ slug?: string;
4
+ display_name?: string;
5
+ description?: string;
6
+ visibility?: string;
7
+ priority?: number;
8
+ };
9
+ type Catalog = {
10
+ models: ModelInfo[];
11
+ [k: string]: unknown;
12
+ };
13
+ export declare function injectVirtualModel(catalog: Catalog, policy: Policy): Catalog;
14
+ export declare function injectIntoUnknown(payload: unknown, policy: Policy): unknown;
15
+ export declare function loadBundledCatalog(codexBin: string): Catalog;
16
+ export declare function cachedCatalogPath(codexVersion: string): string;
17
+ export declare function ensureInjectedCatalog(codexBin: string, policy: Policy): string;
18
+ export declare function readCatalog(path: string): Catalog;
19
+ export {};
@@ -0,0 +1,68 @@
1
+ import { spawnSync } from "node:child_process";
2
+ import { mkdirSync, readFileSync, writeFileSync, existsSync } from "node:fs";
3
+ import { join } from "node:path";
4
+ import { siftHome } from "./policy.js";
5
+ function parseJsonBlob(text) {
6
+ const start = text.indexOf("{");
7
+ if (start < 0)
8
+ throw new Error("No JSON object in catalog output");
9
+ return JSON.parse(text.slice(start));
10
+ }
11
+ export function injectVirtualModel(catalog, policy) {
12
+ const models = Array.isArray(catalog.models) ? catalog.models.map((m) => ({ ...m })) : [];
13
+ const slug = policy.virtual_model.slug;
14
+ const existing = models.findIndex((m) => m.slug === slug);
15
+ const template = models.find((m) => m.slug === "gpt-5.6-terra") ||
16
+ models.find((m) => m.visibility === "list") ||
17
+ models[0];
18
+ if (!template)
19
+ return { ...catalog, models };
20
+ const entry = {
21
+ ...template,
22
+ slug,
23
+ display_name: policy.virtual_model.display_name,
24
+ description: policy.virtual_model.description,
25
+ visibility: "list",
26
+ supported_in_api: true,
27
+ priority: 0,
28
+ };
29
+ if (existing >= 0)
30
+ models[existing] = entry;
31
+ else
32
+ models.unshift(entry);
33
+ return { ...catalog, models };
34
+ }
35
+ export function injectIntoUnknown(payload, policy) {
36
+ if (!payload || typeof payload !== "object")
37
+ return payload;
38
+ const rec = payload;
39
+ if (Array.isArray(rec.models))
40
+ return injectVirtualModel(rec, policy);
41
+ return payload;
42
+ }
43
+ export function loadBundledCatalog(codexBin) {
44
+ const result = spawnSync(codexBin, ["debug", "models", "--bundled"], {
45
+ encoding: "utf8",
46
+ maxBuffer: 20 * 1024 * 1024,
47
+ });
48
+ if (result.status !== 0) {
49
+ throw new Error(result.stderr || "codex debug models --bundled failed");
50
+ }
51
+ return parseJsonBlob(result.stdout || "");
52
+ }
53
+ export function cachedCatalogPath(codexVersion) {
54
+ return join(siftHome(), `catalog-${codexVersion.replace(/[^\w.-]+/g, "_")}.json`);
55
+ }
56
+ export function ensureInjectedCatalog(codexBin, policy) {
57
+ mkdirSync(siftHome(), { recursive: true });
58
+ const version = spawnSync(codexBin, ["--version"], { encoding: "utf8" }).stdout.trim() || "unknown";
59
+ const path = cachedCatalogPath(version);
60
+ if (existsSync(path))
61
+ return path;
62
+ const injected = injectVirtualModel(loadBundledCatalog(codexBin), policy);
63
+ writeFileSync(path, JSON.stringify(injected));
64
+ return path;
65
+ }
66
+ export function readCatalog(path) {
67
+ return JSON.parse(readFileSync(path, "utf8"));
68
+ }
package/dist/cli.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export {};
package/dist/cli.js ADDED
@@ -0,0 +1,106 @@
1
+ #!/usr/bin/env node
2
+ import { copyFileSync, mkdirSync, existsSync } from "node:fs";
3
+ import { join } from "node:path";
4
+ import { runDemo } from "./demo.js";
5
+ import { runDoctor } from "./doctor.js";
6
+ import { loadLocalEnv } from "./env.js";
7
+ import { runE2E } from "./e2e.js";
8
+ import { runExplain } from "./explain.js";
9
+ import { decideTurn } from "./jev.js";
10
+ import { launchCodex } from "./launch.js";
11
+ import { writeDecision } from "./log.js";
12
+ import { bundledPolicyPath, loadPolicy, siftHome } from "./policy.js";
13
+ import { runReport } from "./report.js";
14
+ import { runModels, runSetup } from "./setup.js";
15
+ const HELP = `codex-sift — route each Codex turn to the cheapest model that can handle it
16
+
17
+ Usage:
18
+ codex-sift [codex args...] Launch Codex with Sift routing
19
+ codex-sift setup Pick flash/craft/forge models by number
20
+ codex-sift models List Codex models as 1, 2, 3
21
+ codex-sift route "prompt" Decide a lane without calling Codex
22
+ codex-sift explain Show the last routing decision
23
+ codex-sift report Lane mix and estimated Codex quota saved
24
+ codex-sift demo Classify a sample coding day (Jev only)
25
+ codex-sift e2e Programming-prompt battery vs always-forge
26
+ codex-sift doctor Check Codex, auth, and Jev
27
+ codex-sift init Copy bundled policy.yaml to ~/.codex-sift/
28
+
29
+ Environment:
30
+ TYPESAFE_API_KEY Required for live Jev judgments
31
+ SIFT_POLICY Extra policy YAML path
32
+ SIFT_HOME Default ~/.codex-sift
33
+ SIFT_DISABLED=1 Bypass routing
34
+ CODEX_BIN Codex executable
35
+
36
+ Flags:
37
+ --sift-off Forward this invocation to Codex unchanged
38
+ --sift-lane=forge Skip Jev and pin a lane for this invocation
39
+ `;
40
+ async function main(argv) {
41
+ loadLocalEnv();
42
+ const [cmd, ...rest] = argv;
43
+ if (cmd === "-h" || cmd === "--help" || cmd === "help") {
44
+ process.stdout.write(HELP);
45
+ return 0;
46
+ }
47
+ if (!cmd)
48
+ return launchCodex([]);
49
+ if (cmd === "-v" || cmd === "--version" || cmd === "version") {
50
+ process.stdout.write("codex-sift 0.1.0\n");
51
+ return 0;
52
+ }
53
+ if (cmd === "doctor")
54
+ return runDoctor();
55
+ if (cmd === "explain")
56
+ return runExplain();
57
+ if (cmd === "report")
58
+ return runReport(rest);
59
+ if (cmd === "demo")
60
+ return runDemo();
61
+ if (cmd === "e2e")
62
+ return runE2E(rest);
63
+ if (cmd === "init")
64
+ return runInit();
65
+ if (cmd === "setup")
66
+ return runSetup(rest);
67
+ if (cmd === "models")
68
+ return runModels();
69
+ if (cmd === "route")
70
+ return runRoute(rest);
71
+ return launchCodex(argv);
72
+ }
73
+ async function runRoute(args) {
74
+ const jsonMode = args.includes("--json");
75
+ const prompt = args.filter((a) => a !== "--json").join(" ").trim();
76
+ if (!prompt) {
77
+ process.stderr.write("usage: codex-sift route [--json] <prompt>\n");
78
+ return 1;
79
+ }
80
+ const policy = loadPolicy();
81
+ const decision = await decideTurn(policy, prompt);
82
+ writeDecision(decision, prompt);
83
+ if (jsonMode) {
84
+ process.stdout.write(`${JSON.stringify(decision, null, 2)}\n`);
85
+ return 0;
86
+ }
87
+ process.stdout.write(`${decision.lane} -> ${decision.model}${decision.effort ? ` (${decision.effort})` : ""}${decision.degraded ? " [degraded]" : ""}\n${decision.reason.join("; ")}\n`);
88
+ return 0;
89
+ }
90
+ function runInit() {
91
+ mkdirSync(siftHome(), { recursive: true });
92
+ const dest = join(siftHome(), "policy.yaml");
93
+ if (existsSync(dest)) {
94
+ process.stdout.write(`already exists: ${dest}\n`);
95
+ return 0;
96
+ }
97
+ copyFileSync(bundledPolicyPath(), dest);
98
+ process.stdout.write(`wrote ${dest}\n`);
99
+ return 0;
100
+ }
101
+ main(process.argv.slice(2))
102
+ .then((code) => process.exit(code))
103
+ .catch((err) => {
104
+ process.stderr.write(`${err instanceof Error ? err.stack || err.message : err}\n`);
105
+ process.exit(1);
106
+ });
package/dist/demo.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ export declare const DEMO_PROMPTS: string[];
2
+ export declare function runDemo(): Promise<number>;
package/dist/demo.js ADDED
@@ -0,0 +1,33 @@
1
+ import { decideTurn } from "./jev.js";
2
+ import { loadPolicy } from "./policy.js";
3
+ import { formatUsage, summarizeUsage } from "./usage.js";
4
+ export const DEMO_PROMPTS = [
5
+ "hola",
6
+ "what does this repository do?",
7
+ "rename the unused helper in utils.ts",
8
+ "git status and commit the typo fix",
9
+ "explain the function that builds the nav",
10
+ "the test in auth.test.ts is failing, find why",
11
+ "add a loading spinner to the submit button",
12
+ "thanks",
13
+ "redesign auth across billing and the API gateway",
14
+ "stop the double fetch on the home page",
15
+ ];
16
+ export async function runDemo() {
17
+ const policy = loadPolicy();
18
+ if (!process.env.TYPESAFE_API_KEY) {
19
+ process.stderr.write("codex-sift demo needs TYPESAFE_API_KEY so Jev can classify the sample day.\n");
20
+ return 1;
21
+ }
22
+ process.stdout.write("Sample coding day (Jev only — Codex is not called)\n\n");
23
+ const rows = [];
24
+ for (const prompt of DEMO_PROMPTS) {
25
+ const decision = await decideTurn(policy, prompt);
26
+ rows.push(decision);
27
+ const tag = decision.degraded ? " degraded" : "";
28
+ process.stdout.write(`${decision.lane.padEnd(6)} ${decision.model.padEnd(14)} ${String(decision.effort || "").padEnd(7)} ${prompt}${tag}\n`);
29
+ }
30
+ process.stdout.write(`\n${formatUsage(summarizeUsage(policy, rows))}\n`);
31
+ process.stdout.write("That is the pitch: same work, less forge quota, because cheap turns never touch Sol.\n");
32
+ return 0;
33
+ }
@@ -0,0 +1 @@
1
+ export declare function runDoctor(): Promise<number>;
package/dist/doctor.js ADDED
@@ -0,0 +1,49 @@
1
+ import { existsSync, readFileSync } from "node:fs";
2
+ import { join } from "node:path";
3
+ import { loadLocalEnv } from "./env.js";
4
+ import { resolveCodexBin } from "./launch.js";
5
+ import { loadPolicy, siftHome } from "./policy.js";
6
+ function maskExists(path) {
7
+ return existsSync(path);
8
+ }
9
+ function authMode() {
10
+ const authPath = join(process.env.HOME || ".", ".codex", "auth.json");
11
+ if (!existsSync(authPath))
12
+ return "missing";
13
+ try {
14
+ const raw = readFileSync(authPath, "utf8");
15
+ if (/chatgpt|tokens/i.test(raw) && !/"openai_api_key"\s*:\s*"[^"]+"/.test(raw))
16
+ return "chatgpt";
17
+ if (/openai_api_key/.test(raw))
18
+ return "api-key";
19
+ return "present";
20
+ }
21
+ catch {
22
+ return "unreadable";
23
+ }
24
+ }
25
+ export async function runDoctor() {
26
+ loadLocalEnv();
27
+ const bin = resolveCodexBin();
28
+ const policy = loadPolicy();
29
+ const userPolicy = join(siftHome(), "policy.yaml");
30
+ const lines = [
31
+ `codex binary: ${bin}`,
32
+ `sift home: ${siftHome()}`,
33
+ `policy lanes: ${Object.keys(policy.lanes).join(", ")}`,
34
+ `flash: ${policy.lanes.flash?.model}`,
35
+ `craft: ${policy.lanes.craft?.model}`,
36
+ `forge: ${policy.lanes.forge?.model}`,
37
+ `virtual model: ${policy.virtual_model.slug}`,
38
+ `TYPESAFE_API_KEY: ${process.env.TYPESAFE_API_KEY ? "set" : "MISSING"}`,
39
+ `codex auth: ${authMode()}`,
40
+ `codex config: ${maskExists(join(process.env.HOME || ".", ".codex", "config.toml")) ? "found" : "missing"}`,
41
+ `user policy: ${existsSync(userPolicy) ? userPolicy : "bundled defaults (run codex-sift setup)"}`,
42
+ ];
43
+ process.stdout.write(`${lines.join("\n")}\n`);
44
+ if (!process.env.TYPESAFE_API_KEY) {
45
+ process.stderr.write("Set TYPESAFE_API_KEY or run `codex-sift setup` to save it.\n");
46
+ return 1;
47
+ }
48
+ return 0;
49
+ }
package/dist/e2e.d.ts ADDED
@@ -0,0 +1,24 @@
1
+ import type { Policy } from "./types.js";
2
+ export type E2ECase = {
3
+ id: string;
4
+ category: string;
5
+ expectedLane: string;
6
+ prompt: string;
7
+ };
8
+ export type E2ERow = E2ECase & {
9
+ actualLane: string;
10
+ model: string;
11
+ effort?: string;
12
+ degraded: boolean;
13
+ jevMs: number;
14
+ promptChars: number;
15
+ expectedMatch: boolean;
16
+ baselineUsage: number;
17
+ actualUsage: number;
18
+ savedPct: number;
19
+ reason: string;
20
+ };
21
+ export declare const PROGRAMMING_CASES: E2ECase[];
22
+ export declare function formatMarkdownReport(policy: Policy, rows: E2ERow[], generatedAt?: Date): string;
23
+ export declare function formatConsoleReport(policy: Policy, rows: E2ERow[]): string;
24
+ export declare function runE2E(argv?: string[]): Promise<number>;