@claudexor/harness-codex 1.0.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 joi-lab
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 ADDED
@@ -0,0 +1,7 @@
1
+ # @claudexor/harness-codex
2
+
3
+ Internal package of [Claudexor](https://github.com/razzant/claudexor) — Codex CLI adapter (codex exec --json).
4
+
5
+ Published as part of the Claudexor toolchain; it follows the monorepo's
6
+ lockstep version and has no separate semver contract. Use the `claudexor`
7
+ CLI (or `@claudexor/cli`) as the supported entry point.
@@ -0,0 +1,52 @@
1
+ import type { HarnessRunSpec } from "@claudexor/schema";
2
+ import type { HarnessAdapter } from "@claudexor/core";
3
+ /**
4
+ * Seed `api_key` auth into an isolated CODEX_HOME. Codex does not read
5
+ * `OPENAI_API_KEY` from the environment when run against an empty config dir
6
+ * (it requires `auth.json`), so an envelope-scoped CODEX_HOME would otherwise
7
+ * fail with 401 even though a key is available. We write the same file
8
+ * `codex login --with-api-key` produces. No-op when not isolated (use codex's
9
+ * native auth), when no key is available, or when auth already exists.
10
+ */
11
+ export declare function ensureCodexApiAuth(env?: Record<string, string>, allowApiKey?: boolean): void;
12
+ /** The user's real codex home (native ChatGPT/subscription session lives here). */
13
+ export declare function defaultNativeCodexHome(): string;
14
+ /**
15
+ * Seed the user's NATIVE codex session (`auth.json`, ChatGPT/subscription mode)
16
+ * into an isolated CODEX_HOME so a Max/Pro subscriber with NO API key can run
17
+ * inside a Claudexor envelope. This is the "subscription-first must actually
18
+ * work" fix: previously the scoped empty CODEX_HOME hid the native session and
19
+ * the run failed demanding an API key.
20
+ *
21
+ * Copies ONLY if the scoped auth is absent and a native `auth.json` exists; never
22
+ * overwrites (codex refreshes the token in place). Returns true when scoped auth
23
+ * is present afterwards. No-op when not isolated or no native session exists.
24
+ */
25
+ export declare function ensureCodexNativeAuth(env?: Record<string, string>, nativeHome?: string): boolean;
26
+ /**
27
+ * Inject the Playwright browser MCP as stateless `-c mcp_servers.browser.*`
28
+ * config overrides (live-verified: codex accepts array-valued `-c` overrides and
29
+ * surfaces the tools as `mcp_tool_call` events the parser already maps). Stateless
30
+ * means NO scoped config.toml write — the user's `~/.codex/config.toml` is never
31
+ * touched. Empty when no browser this run, and ALWAYS empty under
32
+ * `external_context_policy: off` (adapter-level defense-in-depth mirroring the
33
+ * claude adapter; the orchestrator already nulls the browser under off).
34
+ */
35
+ export declare function codexBrowserArgs(browser: HarnessRunSpec["browser"], externalContextPolicy?: HarnessRunSpec["external_context_policy"]): string[];
36
+ /**
37
+ * True only when the config codex WILL load (the scoped `CODEX_HOME` if set,
38
+ * else `~/.codex`) actually defines `[mcp_servers.node_repl]`. We only ever
39
+ * disable node_repl when it already exists — a `-c mcp_servers.node_repl.*`
40
+ * override against a config that has NO node_repl creates a partial entry with
41
+ * no transport and codex refuses to load it ("invalid transport in
42
+ * mcp_servers.node_repl"), which broke every scoped-home / api_key / MCP run.
43
+ */
44
+ export declare function codexConfigHasNodeRepl(codexHome: string | null | undefined): boolean;
45
+ export declare function codexExecArgs(spec: Pick<HarnessRunSpec, "access" | "model_hint" | "effort_hint" | "external_context_policy" | "prompt" | "attachments" | "browser"> & {
46
+ resume_session_id?: string | null;
47
+ }, opts?: {
48
+ suppressNodeRepl?: boolean;
49
+ outputSchemaPath?: string | null;
50
+ }): string[];
51
+ export declare function createCodexAdapter(): HarnessAdapter;
52
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAA+E,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAErI,OAAO,KAAK,EAAc,cAAc,EAAE,MAAM,iBAAiB,CAAC;AA4BlE;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,WAAW,UAAO,GAAG,IAAI,CAczF;AAED,mFAAmF;AACnF,wBAAgB,sBAAsB,IAAI,MAAM,CAI/C;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,qBAAqB,CACnC,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC5B,UAAU,GAAE,MAAiC,GAC5C,OAAO,CAmBT;AAuGD;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,cAAc,CAAC,SAAS,CAAC,EAClC,qBAAqB,CAAC,EAAE,cAAc,CAAC,yBAAyB,CAAC,GAChE,MAAM,EAAE,CAYV;AAED;;;;;;;GAOG;AACH,wBAAgB,sBAAsB,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,CAOpF;AAED,wBAAgB,aAAa,CAC3B,IAAI,EAAE,IAAI,CAAC,cAAc,EAAE,QAAQ,GAAG,YAAY,GAAG,aAAa,GAAG,yBAAyB,GAAG,QAAQ,GAAG,aAAa,GAAG,SAAS,CAAC,GAAG;IACvI,iBAAiB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACnC,EACD,IAAI,GAAE;IAAE,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAAC,gBAAgB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAAO,GAC1E,MAAM,EAAE,CAoDV;AA6BD,wBAAgB,kBAAkB,IAAI,cAAc,CA0HnD"}