supertag-ai 0.2.0-alpha.5 → 0.2.0-alpha.6

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 (35) hide show
  1. package/README.md +1 -1
  2. package/dist/chunk-33IFPHXE.js +136 -0
  3. package/dist/chunk-33IFPHXE.js.map +1 -0
  4. package/dist/{chunk-YJCJLNXV.js → chunk-CUH5CP7W.js} +34 -50
  5. package/dist/chunk-CUH5CP7W.js.map +1 -0
  6. package/dist/chunk-PEGY7YJA.js +84 -0
  7. package/dist/chunk-PEGY7YJA.js.map +1 -0
  8. package/dist/{chunk-KUH6RQAM.js → chunk-WGPRACJB.js} +48 -41
  9. package/dist/chunk-WGPRACJB.js.map +1 -0
  10. package/dist/cli.js +2 -2
  11. package/dist/cli.js.map +1 -1
  12. package/dist/docs/guides/python-workers.md +8 -8
  13. package/dist/docs/guides/troubleshooting.md +14 -0
  14. package/dist/docs/operations/install.md +38 -9
  15. package/dist/docs/operations/requirements.md +15 -11
  16. package/dist/docs/reference/control-plane-api.md +2 -2
  17. package/dist/harnesses/claude-code.d.ts +11 -1
  18. package/dist/harnesses/claude-code.js +2 -1
  19. package/dist/harnesses/codex.d.ts +11 -4
  20. package/dist/harnesses/codex.js +2 -1
  21. package/dist/harnesses-4UPB47DO.js +5 -0
  22. package/dist/harnesses-4UPB47DO.js.map +1 -0
  23. package/dist/src-2PGBHIMD.js +9 -0
  24. package/dist/{src-25NGYB52.js.map → src-2PGBHIMD.js.map} +1 -1
  25. package/dist/src-JYMWKZIE.js +8 -0
  26. package/dist/src-JYMWKZIE.js.map +1 -0
  27. package/dist/{src-IM5LBBN7.js → src-OUTXJBMT.js} +45 -126
  28. package/dist/src-OUTXJBMT.js.map +1 -0
  29. package/package.json +1 -1
  30. package/dist/chunk-KUH6RQAM.js.map +0 -1
  31. package/dist/chunk-YJCJLNXV.js.map +0 -1
  32. package/dist/src-25NGYB52.js +0 -7
  33. package/dist/src-IM5LBBN7.js.map +0 -1
  34. package/dist/src-OSKS5ATA.js +0 -8
  35. package/dist/src-OSKS5ATA.js.map +0 -1
package/README.md CHANGED
@@ -163,7 +163,7 @@ To find bundled collaboration surface guides and manifests, run `supertag setup
163
163
  The matching Python SDK is published separately as `supertag` on PyPI:
164
164
 
165
165
  ```sh
166
- python -m pip install 'supertag==0.2.0a5'
166
+ python -m pip install 'supertag==0.2.0a6'
167
167
  ```
168
168
 
169
169
  Pin the prerelease explicitly so pip selects the matching SDK. Python applications can compose
@@ -0,0 +1,136 @@
1
+ import { checkInstalledCli } from './chunk-PEGY7YJA.js';
2
+ import { execFile } from 'child_process';
3
+ import { constants } from 'fs';
4
+ import { stat, access } from 'fs/promises';
5
+ import { delimiter, join } from 'path';
6
+ import { promisify } from 'util';
7
+
8
+ var HARNESSES = ["claude-code", "codex", "cursor", "opencode"];
9
+ var HARNESS_COMMANDS = {
10
+ "claude-code": "claude",
11
+ codex: "codex",
12
+ cursor: "cursor-agent",
13
+ opencode: "opencode"
14
+ };
15
+ function isHarness(value) {
16
+ return typeof value === "string" && HARNESSES.includes(value);
17
+ }
18
+ async function detectHarnesses(path = process.env["PATH"], environment = process.env) {
19
+ return (await inspectHarnesses(path, environment)).found;
20
+ }
21
+ async function inspectHarnesses(path = process.env["PATH"], environment = process.env) {
22
+ const found = [];
23
+ const problems = [];
24
+ for (const harness of HARNESSES) {
25
+ if (harness === "cursor") {
26
+ if (environment["CURSOR_API_KEY"]?.trim() || await isOnPath("cursor-agent", path) || await isCursorAgentAlias(path))
27
+ found.push(harness);
28
+ } else if (harness === "claude-code" || harness === "codex") {
29
+ const check = await checkHarnessCli(harness, { path, environment });
30
+ if (check.status === "ok") found.push(harness);
31
+ else if (check.status !== "missing") problems.push(check.message);
32
+ } else if (await isOnPath(HARNESS_COMMANDS[harness], path)) found.push(harness);
33
+ }
34
+ return { found, problems };
35
+ }
36
+ async function checkHarnessCli(harness, options = {}) {
37
+ if (harness === "codex") {
38
+ const { codexCliRequirement } = await import('./src-JYMWKZIE.js');
39
+ return checkInstalledCli(await codexCliRequirement(), options);
40
+ }
41
+ const { claudeCodeCliRequirement } = await import('./src-2PGBHIMD.js');
42
+ return checkInstalledCli(await claudeCodeCliRequirement(), options);
43
+ }
44
+ function harnessSignInInstructions(harness) {
45
+ if (harness === "claude-code")
46
+ return "Claude Code: run claude and use /login, or set ANTHROPIC_API_KEY in the host's env_file (default ~/.supertag/.env). A background host also inherits it from the shell; a service unit does not. The bundled Claude Agent SDK reads the secure sign-in store selected by CLAUDE_SECURESTORAGE_CONFIG_DIR, then CLAUDE_CONFIG_DIR, then ~/.claude (macOS Keychain on macOS; .credentials.json on Linux). Task sessions and settings stay in a separate temporary directory.";
47
+ if (harness === "codex")
48
+ return `Codex: run codex -c 'cli_auth_credentials_store="file"' login, or set CODEX_API_KEY or OPENAI_API_KEY in the host's env_file (default ~/.supertag/.env). On macOS, a Keychain-only login is not copied to Task Attempts. A background host also inherits environment credentials from the shell; a service unit does not. The bundled Codex SDK reads CODEX_API_KEY first, then copies $CODEX_HOME/auth.json (default ~/.codex/auth.json), then falls back to OPENAI_API_KEY if that file cannot be read. The file-backed init check only verifies credential structure; it cannot verify account access without rotating a refresh token.`;
49
+ if (harness === "cursor")
50
+ return "Cursor: generate an API key at https://cursor.com/dashboard/api and set CURSOR_API_KEY in the host's env_file (default ~/.supertag/.env). The Cursor app and cursor-agent logins do not authenticate the bundled SDK runner.";
51
+ return "OpenCode: set the API key for the selected provider/model in the Worker Host environment (for example OPENAI_API_KEY for openai, or ANTHROPIC_API_KEY for anthropic). Tasks use an isolated OpenCode home and do not read your usual OpenCode auth.json.";
52
+ }
53
+ async function probeHarnessSignIn(harness, model, environment = process.env) {
54
+ const options = { environment, ...model === void 0 ? {} : { model } };
55
+ if (harness === "claude-code") {
56
+ const { checkClaudeCodeSignIn } = await import('./src-2PGBHIMD.js');
57
+ return checkClaudeCodeSignIn(options);
58
+ }
59
+ if (harness === "codex") {
60
+ const { checkCodexSignIn } = await import('./src-JYMWKZIE.js');
61
+ return checkCodexSignIn(options);
62
+ }
63
+ if (harness === "cursor") {
64
+ const { checkCursorSignIn } = await import('./cursor-sign-in-VZYMNUV7.js');
65
+ const { checkCursorModels } = await import('./src-NJP6L4P7.js');
66
+ const result = await checkCursorSignIn({
67
+ environment,
68
+ verifyModels: async (apiKey) => {
69
+ const check = await checkCursorModels(
70
+ model === void 0 ? [] : [model],
71
+ apiKey === void 0 ? {} : { apiKey }
72
+ );
73
+ return check.status === "ok" ? { status: "ok", models: check.availableIds } : { status: "error" };
74
+ }
75
+ });
76
+ return result.signedIn;
77
+ }
78
+ const { checkOpenCodeSignIn } = await import('./opencode-sign-in-KSCTH2WC.js');
79
+ return model === void 0 ? false : checkOpenCodeSignIn(model, environment);
80
+ }
81
+ async function isOnPath(command, path) {
82
+ const extensions = process.platform === "win32" ? (process.env["PATHEXT"] ?? ".EXE;.CMD;.BAT").split(";").filter(Boolean) : [""];
83
+ for (const directory of (path ?? "").split(delimiter).filter(Boolean))
84
+ for (const extension of extensions) {
85
+ const candidate = join(directory, `${command}${extension}`);
86
+ const stats = await stat(candidate).catch(() => void 0);
87
+ if (stats === void 0 || stats.isDirectory()) continue;
88
+ if (await access(candidate, constants.X_OK).then(
89
+ () => true,
90
+ () => false
91
+ ))
92
+ return true;
93
+ }
94
+ return false;
95
+ }
96
+ var execFileAsync = promisify(execFile);
97
+ async function isCursorAgentAlias(path) {
98
+ if (!await isOnPath("agent", path)) return false;
99
+ const options = {
100
+ env: { PATH: path },
101
+ timeout: 5e3,
102
+ killSignal: "SIGKILL",
103
+ maxBuffer: 64 * 1024
104
+ };
105
+ const cursorName = (value) => typeof value === "string" && /^cursor(?:[- ]agent)?\b/i.test(value.trim());
106
+ const about = await execFileAsync("agent", ["about", "--format", "json"], options).catch(
107
+ () => void 0
108
+ );
109
+ if (about) {
110
+ try {
111
+ const parsed = JSON.parse(about.stdout);
112
+ if (parsed !== null && typeof parsed === "object" && ["name", "product", "application", "cli"].some(
113
+ (field) => cursorName(parsed[field])
114
+ ))
115
+ return true;
116
+ } catch {
117
+ }
118
+ }
119
+ const version = await execFileAsync("agent", ["--version"], options).catch(() => void 0);
120
+ return version !== void 0 && cursorName(version.stdout);
121
+ }
122
+ var SIGN_IN_DOCS = "https://github.com/atemaguer/supertag/blob/main/docs/operations/requirements.md#choose-and-sign-in-to-a-harness";
123
+ function noHarnessMessage() {
124
+ return `No harness is available on this machine. SuperTag runs Tasks through Claude Code, Codex, Cursor, or OpenCode.
125
+ Install one and sign in:
126
+ Claude Code npm install -g @anthropic-ai/claude-code, then run claude to sign in
127
+ Codex npm install -g @openai/codex, then codex -c 'cli_auth_credentials_store="file"' login
128
+ Cursor Add CURSOR_API_KEY to ~/.supertag/.env, using a key from https://cursor.com/dashboard/api
129
+ OpenCode npm install -g opencode-ai, then set your provider's API key
130
+ Sign-in details: ${SIGN_IN_DOCS}
131
+ SuperTag looks for claude, codex, and opencode on PATH, and for Cursor through CURSOR_API_KEY or cursor-agent.`;
132
+ }
133
+
134
+ export { HARNESSES, HARNESS_COMMANDS, checkHarnessCli, detectHarnesses, harnessSignInInstructions, inspectHarnesses, isHarness, noHarnessMessage, probeHarnessSignIn };
135
+ //# sourceMappingURL=chunk-33IFPHXE.js.map
136
+ //# sourceMappingURL=chunk-33IFPHXE.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../apps/cli/src/harnesses.ts"],"names":[],"mappings":";;;;;;;AAQO,IAAM,SAAA,GAAuC,CAAC,aAAA,EAAe,OAAA,EAAS,UAAU,UAAU;AAG1F,IAAM,gBAAA,GAA6D;AAAA,EACxE,aAAA,EAAe,QAAA;AAAA,EACf,KAAA,EAAO,OAAA;AAAA,EACP,MAAA,EAAQ,cAAA;AAAA,EACR,QAAA,EAAU;AACZ;AAEO,SAAS,UAAU,KAAA,EAAyC;AACjE,EAAA,OAAO,OAAO,KAAA,KAAU,QAAA,IAAa,SAAA,CAAgC,SAAS,KAAK,CAAA;AACrF;AAG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AAK,CAAC,KAAA,KAC9C,UAAA,CAAY,MAAA,CAAmC,KAAK,CAAC;AAAA,OACvD;AAEA,QAAA,OAAO,IAAA;AAAA,IACX,CAAA,CAAA,MAAQ;AAAA,IAER;AAAA,EACF;AACA,EAAA,MAAM,OAAA,GAAU,MAAM,aAAA,CAAc,OAAA,EAAS,CAAC,WAAW,CAAA,EAAG,OAAO,CAAA,CAAE,KAAA,CAAM,MAAM,MAAS,CAAA;AAC1F,EAAA,OAAO,OAAA,KAAY,MAAA,IAAa,UAAA,CAAW,OAAA,CAAQ,MAAM,CAAA;AAC3D;AAEA,IAAM,YAAA,GACJ,iHAAA;AAGK,SAAS,gBAAA,GAA2B;AACzC,EAAA,OAAO,CAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iBAAA,EAMU,YAAY;AAAA,8GAAA,CAAA;AAE/B","file":"chunk-33IFPHXE.js","sourcesContent":["import { execFile } from \"node:child_process\";\nimport { constants } from \"node:fs\";\nimport { access, stat } from \"node:fs/promises\";\nimport { delimiter, join } from \"node:path\";\nimport { promisify } from \"node:util\";\nimport { checkInstalledCli, type InstalledCliCheck } from \"@supertag/worker-sdk/installed-cli\";\nimport type { WorkletHarness } from \"./worker.js\";\n\nexport const HARNESSES: readonly WorkletHarness[] = [\"claude-code\", \"codex\", \"cursor\", \"opencode\"];\n\n/** Optional PATH command associated with each harness. */\nexport const HARNESS_COMMANDS: Readonly<Record<WorkletHarness, string>> = {\n \"claude-code\": \"claude\",\n codex: \"codex\",\n cursor: \"cursor-agent\",\n opencode: \"opencode\",\n};\n\nexport function isHarness(value: unknown): value is WorkletHarness {\n return typeof value === \"string\" && (HARNESSES as readonly string[]).includes(value);\n}\n\n/** Available harnesses in stable order; Cursor also accepts CURSOR_API_KEY. */\nexport async function detectHarnesses(\n path: string | undefined = process.env[\"PATH\"],\n environment: Readonly<Record<string, string | undefined>> = process.env,\n): Promise<readonly WorkletHarness[]> {\n return (await inspectHarnesses(path, environment)).found;\n}\n\n/**\n * Usable harnesses, plus why an installed one can't be used. Claude Code and Codex run the user's\n * own CLI, so each must be installed and at least the version SuperTag's SDK targets.\n */\nexport async function inspectHarnesses(\n path: string | undefined = process.env[\"PATH\"],\n environment: Readonly<Record<string, string | undefined>> = process.env,\n): Promise<{ readonly found: readonly WorkletHarness[]; readonly problems: readonly string[] }> {\n const found: WorkletHarness[] = [];\n const problems: string[] = [];\n for (const harness of HARNESSES) {\n if (harness === \"cursor\") {\n if (\n environment[\"CURSOR_API_KEY\"]?.trim() ||\n (await isOnPath(\"cursor-agent\", path)) ||\n (await isCursorAgentAlias(path))\n )\n found.push(harness);\n } else if (harness === \"claude-code\" || harness === \"codex\") {\n const check = await checkHarnessCli(harness, { path, environment });\n if (check.status === \"ok\") found.push(harness);\n else if (check.status !== \"missing\") problems.push(check.message);\n } else if (await isOnPath(HARNESS_COMMANDS[harness], path)) found.push(harness);\n }\n return { found, problems };\n}\n\n/** Checks the installed CLI a harness runs: present on PATH and new enough. */\nexport async function checkHarnessCli(\n harness: \"claude-code\" | \"codex\",\n options: Parameters<typeof checkInstalledCli>[1] = {},\n): Promise<InstalledCliCheck> {\n if (harness === \"codex\") {\n const { codexCliRequirement } = await import(\"@supertag/worker-codex\");\n return checkInstalledCli(await codexCliRequirement(), options);\n }\n const { claudeCodeCliRequirement } = await import(\"@supertag/worker-claude-code\");\n return checkInstalledCli(await claudeCodeCliRequirement(), options);\n}\n\n/** Exact local Worker credential lookup, shared with Task Attempt error translation. */\nexport function harnessSignInInstructions(harness: WorkletHarness): string {\n if (harness === \"claude-code\")\n return \"Claude Code: run claude and use /login, or set ANTHROPIC_API_KEY in the host's env_file (default ~/.supertag/.env). A background host also inherits it from the shell; a service unit does not. The bundled Claude Agent SDK reads the secure sign-in store selected by CLAUDE_SECURESTORAGE_CONFIG_DIR, then CLAUDE_CONFIG_DIR, then ~/.claude (macOS Keychain on macOS; .credentials.json on Linux). Task sessions and settings stay in a separate temporary directory.\";\n if (harness === \"codex\")\n return `Codex: run codex -c 'cli_auth_credentials_store=\"file\"' login, or set CODEX_API_KEY or OPENAI_API_KEY in the host's env_file (default ~/.supertag/.env). On macOS, a Keychain-only login is not copied to Task Attempts. A background host also inherits environment credentials from the shell; a service unit does not. The bundled Codex SDK reads CODEX_API_KEY first, then copies $CODEX_HOME/auth.json (default ~/.codex/auth.json), then falls back to OPENAI_API_KEY if that file cannot be read. The file-backed init check only verifies credential structure; it cannot verify account access without rotating a refresh token.`;\n if (harness === \"cursor\")\n return \"Cursor: generate an API key at https://cursor.com/dashboard/api and set CURSOR_API_KEY in the host's env_file (default ~/.supertag/.env). The Cursor app and cursor-agent logins do not authenticate the bundled SDK runner.\";\n return \"OpenCode: set the API key for the selected provider/model in the Worker Host environment (for example OPENAI_API_KEY for openai, or ANTHROPIC_API_KEY for anthropic). Tasks use an isolated OpenCode home and do not read your usual OpenCode auth.json.\";\n}\n\n/** Verify a model turn through the same bundled runtimes used by local Workers. */\nexport async function probeHarnessSignIn(\n harness: WorkletHarness,\n model?: string,\n environment: Readonly<Record<string, string | undefined>> = process.env,\n): Promise<boolean> {\n const options = { environment, ...(model === undefined ? {} : { model }) };\n if (harness === \"claude-code\") {\n const { checkClaudeCodeSignIn } = await import(\"@supertag/worker-claude-code\");\n return checkClaudeCodeSignIn(options);\n }\n if (harness === \"codex\") {\n const { checkCodexSignIn } = await import(\"@supertag/worker-codex\");\n return checkCodexSignIn(options);\n }\n if (harness === \"cursor\") {\n const { checkCursorSignIn } = await import(\"./cursor-sign-in.js\");\n const { checkCursorModels } = await import(\"@supertag/worker-cursor\");\n const result = await checkCursorSignIn({\n environment,\n verifyModels: async (apiKey) => {\n const check = await checkCursorModels(\n model === undefined ? [] : [model],\n apiKey === undefined ? {} : { apiKey },\n );\n return check.status === \"ok\"\n ? { status: \"ok\" as const, models: check.availableIds }\n : { status: \"error\" as const };\n },\n });\n return result.signedIn;\n }\n const { checkOpenCodeSignIn } = await import(\"./opencode-sign-in.js\");\n return model === undefined ? false : checkOpenCodeSignIn(model, environment);\n}\n\nasync function isOnPath(command: string, path: string | undefined): Promise<boolean> {\n const extensions =\n process.platform === \"win32\"\n ? (process.env[\"PATHEXT\"] ?? \".EXE;.CMD;.BAT\").split(\";\").filter(Boolean)\n : [\"\"];\n for (const directory of (path ?? \"\").split(delimiter).filter(Boolean))\n for (const extension of extensions) {\n const candidate = join(directory, `${command}${extension}`);\n const stats = await stat(candidate).catch(() => undefined);\n if (stats === undefined || stats.isDirectory()) continue;\n if (\n await access(candidate, constants.X_OK).then(\n () => true,\n () => false,\n )\n )\n return true;\n }\n return false;\n}\n\nconst execFileAsync = promisify(execFile);\n\nasync function isCursorAgentAlias(path: string | undefined): Promise<boolean> {\n if (!(await isOnPath(\"agent\", path))) return false;\n const options = {\n env: { PATH: path },\n timeout: 5_000,\n killSignal: \"SIGKILL\" as const,\n maxBuffer: 64 * 1024,\n };\n const cursorName = (value: unknown): boolean =>\n typeof value === \"string\" && /^cursor(?:[- ]agent)?\\b/i.test(value.trim());\n const about = await execFileAsync(\"agent\", [\"about\", \"--format\", \"json\"], options).catch(\n () => undefined,\n );\n if (about) {\n try {\n const parsed: unknown = JSON.parse(about.stdout);\n if (\n parsed !== null &&\n typeof parsed === \"object\" &&\n [\"name\", \"product\", \"application\", \"cli\"].some((field) =>\n cursorName((parsed as Record<string, unknown>)[field]),\n )\n )\n return true;\n } catch {\n // Some Cursor versions only identify themselves in --version.\n }\n }\n const version = await execFileAsync(\"agent\", [\"--version\"], options).catch(() => undefined);\n return version !== undefined && cursorName(version.stdout);\n}\n\nconst SIGN_IN_DOCS =\n \"https://github.com/atemaguer/supertag/blob/main/docs/operations/requirements.md#choose-and-sign-in-to-a-harness\";\n\n/** The message shown when no harness is available. */\nexport function noHarnessMessage(): string {\n return `No harness is available on this machine. SuperTag runs Tasks through Claude Code, Codex, Cursor, or OpenCode.\nInstall one and sign in:\n Claude Code npm install -g @anthropic-ai/claude-code, then run claude to sign in\n Codex npm install -g @openai/codex, then codex -c 'cli_auth_credentials_store=\"file\"' login\n Cursor Add CURSOR_API_KEY to ~/.supertag/.env, using a key from https://cursor.com/dashboard/api\n OpenCode npm install -g opencode-ai, then set your provider's API key\nSign-in details: ${SIGN_IN_DOCS}\nSuperTag looks for claude, codex, and opencode on PATH, and for Cursor through CURSOR_API_KEY or cursor-agent.`;\n}\n"]}
@@ -1,8 +1,9 @@
1
+ import { checkInstalledCli } from './chunk-PEGY7YJA.js';
1
2
  import { minimalProcessEnvironment, withoutProviderCredentials, harnessModels, PROCESS_OUTPUT_STREAMING_CAPABILITY, PROCESS_INPUT_STREAMING_CAPABILITY, HARNESS_EFFORTS, attemptModel, runtimeInputs, harnessArtifactRestoreDestination, inPlaceWorkspacePath, executionRootWorkspace, executionRootCheckoutPath, artifactInputPath, ExecutionCleanupError, assertHarnessMcpPolicyEnforceable, isControlPlaneCoordinationTool, startMcpPolicyProxy, connectWorkerMcpClient, connectExecutionEnvironmentMcpClient, resolveHarnessContinuity, executionWarningProgress, LocalExecutionEnvironmentProvider, createWorker, CHANGE_SUMMARY_INSTRUCTION, FINDINGS_INSTRUCTION, resolveSkillPackages, describeToolCall, toolCallOutcomeFromText, HarnessProviderError, ToolAdapterRegistry, McpToolAdapter, LocalHarnessExecutionControl, ExecutionBudgetExceededError } from './chunk-GGLTVY7F.js';
2
3
  import { reportedCodexModel, codexCostFields } from './chunk-FMADEKHP.js';
3
4
  import { readFile, mkdtemp, rm, access, open, stat, mkdir, copyFile, chmod, realpath } from 'fs/promises';
4
5
  import { tmpdir, homedir } from 'os';
5
- import { join, resolve, isAbsolute, delimiter, dirname } from 'path';
6
+ import { join, resolve, isAbsolute } from 'path';
6
7
  import { Codex } from '@openai/codex-sdk';
7
8
  import { constants } from 'fs';
8
9
  import { createRequire } from 'module';
@@ -89,7 +90,9 @@ async function checkCodexSignIn(options = {}) {
89
90
  if (controller.signal.aborted) return false;
90
91
  const home = join(directory, ".codex");
91
92
  const apiKey = await prepareCodexHome(home, environment);
93
+ const codexPath = options.createCodex === void 0 ? (await import('./src-JYMWKZIE.js').then(({ installedCodex: installedCodex2 }) => installedCodex2())).command : void 0;
92
94
  const codex = (options.createCodex ?? ((config) => new Codex(config)))({
95
+ ...codexPath === void 0 ? {} : { codexPathOverride: codexPath },
93
96
  ...apiKey ? { apiKey } : {},
94
97
  env: { ...minimalProcessEnvironment(environment), CODEX_HOME: home },
95
98
  config: {
@@ -1643,8 +1646,8 @@ async function checkCodexModels(models, options = {}) {
1643
1646
  }
1644
1647
  }
1645
1648
  async function codexCommand() {
1646
- const { bundledCodexCommand: bundledCodexCommand2 } = await import('./src-25NGYB52.js');
1647
- return bundledCodexCommand2();
1649
+ const { installedCodex: installedCodex2 } = await import('./src-JYMWKZIE.js');
1650
+ return (await installedCodex2()).command;
1648
1651
  }
1649
1652
 
1650
1653
  // ../runtime/harnesses/codex/src/portable-session-state.ts
@@ -1990,15 +1993,10 @@ var CodexHarness = class {
1990
1993
  executionEnvironment
1991
1994
  );
1992
1995
  const native = this.#executionMode === "app-server" || environment.placement === "local";
1993
- const source = !this.#enforceMcpPolicy ? "injected" : environment.placement !== "local" || this.#command !== "codex" ? "configured" : "bundled";
1996
+ const source = !this.#enforceMcpPolicy ? "injected" : "configured";
1994
1997
  let version;
1995
- if (source === "bundled") {
1996
- const sdk = createRequire(import.meta.resolve("@openai/codex-sdk"));
1997
- const manifest = JSON.parse(
1998
- await readFile(sdk.resolve("@openai/codex/package.json"), "utf8")
1999
- );
2000
- if (typeof manifest.version === "string") version = manifest.version;
2001
- }
1998
+ if (source === "configured" && environment.placement === "local" && this.#command === "codex")
1999
+ version = (await installedCodex()).version;
2002
2000
  return {
2003
2001
  capabilities: {
2004
2002
  ...await this.describe(),
@@ -2275,18 +2273,14 @@ var CodexHarness = class {
2275
2273
  try {
2276
2274
  const home = runtime.resolvePath(".codex");
2277
2275
  const apiKey = request.authFileStaged ? void 0 : runtime.placement === "local" ? await prepareCodexHome(home) : process.env["CODEX_API_KEY"] ?? process.env["OPENAI_API_KEY"];
2278
- const executable = runtime.placement === "local" && request.command === "codex" ? await bundledCodex() : {
2279
- command: request.command,
2280
- path: void 0
2281
- };
2276
+ const executable = runtime.placement === "local" && request.command === "codex" ? await installedCodex() : { command: request.command };
2282
2277
  const processEnvironment = {
2283
2278
  ...minimalProcessEnvironment(process.env),
2284
2279
  ...request.outputDirectory === void 0 ? {} : { SUPERTAG_OUTPUT_DIR: request.outputDirectory },
2285
2280
  ...request.scratchDirectory === void 0 ? {} : { SUPERTAG_SCRATCH_DIR: request.scratchDirectory },
2286
2281
  CODEX_HOME: home,
2287
2282
  ...apiKey ? { CODEX_API_KEY: apiKey } : {},
2288
- ...codexMcpRuntimeEnvironment(request.mcpServers),
2289
- ...executable.path ? { PATH: [executable.path, process.env["PATH"]].filter(Boolean).join(delimiter) } : {}
2283
+ ...codexMcpRuntimeEnvironment(request.mcpServers)
2290
2284
  };
2291
2285
  const requestedLimits = input.attempt.execution.limits;
2292
2286
  if (requestedLimits?.maxNativeAgents !== void 0 && requestedLimits.maxNativeAgents !== 0)
@@ -3058,36 +3052,27 @@ function assertCodexEventSucceeded(event) {
3058
3052
  throw new HarnessProviderError(`Codex SDK failed: ${event.error.message}`);
3059
3053
  if (event.type === "error") throw new HarnessProviderError(`Codex SDK failed: ${event.message}`);
3060
3054
  }
3061
- async function bundledCodexCommand() {
3062
- try {
3063
- return (await bundledCodex()).command;
3064
- } catch {
3065
- return "codex";
3066
- }
3067
- }
3068
- async function bundledCodex() {
3069
- const os = process.platform === "android" ? "linux" : process.platform;
3070
- const cpu = process.arch === "x64" ? "x86_64" : process.arch === "arm64" ? "aarch64" : void 0;
3071
- const target = os === "linux" ? "unknown-linux-musl" : os === "darwin" ? "apple-darwin" : os === "win32" ? "pc-windows-msvc" : void 0;
3072
- if (!cpu || !target) throw new Error("Unsupported bundled Codex platform");
3055
+ async function codexCliRequirement() {
3073
3056
  const sdk = createRequire(import.meta.resolve("@openai/codex-sdk"));
3074
- const manifestPath = sdk.resolve("@openai/codex/package.json");
3075
- const manifest = JSON.parse(await readFile(manifestPath, "utf8"));
3057
+ const manifest = JSON.parse(
3058
+ await readFile(sdk.resolve("@openai/codex/package.json"), "utf8")
3059
+ );
3076
3060
  if (typeof manifest.version !== "string" || !manifest.version)
3077
- throw new Error("Pinned Codex package has no version");
3078
- const codex = createRequire(manifestPath);
3079
- const platform = codex.resolve(`@openai/codex-${os}-${process.arch}/package.json`);
3080
- const root = join(dirname(platform), "vendor", `${cpu}-${target}`);
3081
- const binary = os === "win32" ? "codex.exe" : "codex";
3082
- for (const [bin, path] of [
3083
- ["bin", "codex-path"],
3084
- ["codex", "path"]
3085
- ]) {
3086
- const command = join(root, bin, binary);
3087
- if (await stat(command).then((s) => s.isFile()).catch(() => false))
3088
- return { command, path: join(root, path), version: manifest.version };
3089
- }
3090
- throw new Error("Pinned Codex binary missing; install the SDK optional platform dependencies");
3061
+ throw new Error("The pinned Codex SDK has no CLI version");
3062
+ return {
3063
+ name: "Codex",
3064
+ command: "codex",
3065
+ minimumVersion: manifest.version,
3066
+ install: "Install or upgrade it with: npm install -g @openai/codex"
3067
+ };
3068
+ }
3069
+ async function checkCodexCli(options = {}) {
3070
+ return checkInstalledCli(await codexCliRequirement(), options);
3071
+ }
3072
+ async function installedCodex() {
3073
+ const check = await checkCodexCli();
3074
+ if (check.status !== "ok") throw new HarnessProviderError(check.message);
3075
+ return { command: check.path, version: check.version };
3091
3076
  }
3092
3077
  async function codexCliVersion(runtime, command, timeoutMs) {
3093
3078
  const handle = await runtime.spawn({
@@ -3116,7 +3101,7 @@ async function* codexProcessEvents(request, environment, signal) {
3116
3101
  validateExternalSandbox(request, environment);
3117
3102
  const home = environment.resolvePath(".codex");
3118
3103
  const apiKey = request.authFileStaged ? void 0 : environment.placement === "local" ? await prepareCodexHome(home) : process.env["CODEX_API_KEY"] ?? process.env["OPENAI_API_KEY"];
3119
- const executable = environment.placement === "local" && request.command === "codex" ? await bundledCodex() : { command: request.command, path: void 0 };
3104
+ const executable = environment.placement === "local" && request.command === "codex" ? await installedCodex() : { command: request.command };
3120
3105
  const env = {
3121
3106
  ...minimalProcessEnvironment(process.env),
3122
3107
  ...request.outputDirectory === void 0 ? {} : { SUPERTAG_OUTPUT_DIR: request.outputDirectory },
@@ -3125,7 +3110,6 @@ async function* codexProcessEvents(request, environment, signal) {
3125
3110
  ...apiKey ? { CODEX_API_KEY: apiKey } : {},
3126
3111
  ...codexMcpRuntimeEnvironment(request.mcpServers)
3127
3112
  };
3128
- if (executable.path) env["PATH"] = [executable.path, env["PATH"]].filter(Boolean).join(delimiter);
3129
3113
  const sandbox = codexSandboxAllowance(request.sandboxMode, request.runtimeActions);
3130
3114
  const sandboxMode = codexSandboxMode(sandbox);
3131
3115
  const commonGitDir = environment.placement === "local" ? await codexProtectedGitDirectory(request.workspace) : void 0;
@@ -3515,6 +3499,6 @@ function validatedUsageBaselines(value) {
3515
3499
  return value;
3516
3500
  }
3517
3501
 
3518
- export { CodexHarness, bundledCodexCommand, checkCodexModels, checkCodexSignIn, codexInformationRetrievalPrompt, codexSandboxAllowance, compareModels, createCodexWorker, listCodexModels, runCodex, taskProgressFromCodexTodo };
3519
- //# sourceMappingURL=chunk-YJCJLNXV.js.map
3520
- //# sourceMappingURL=chunk-YJCJLNXV.js.map
3502
+ export { CodexHarness, checkCodexCli, checkCodexModels, checkCodexSignIn, codexCliRequirement, codexInformationRetrievalPrompt, codexSandboxAllowance, compareModels, createCodexWorker, installedCodex, listCodexModels, runCodex, taskProgressFromCodexTodo };
3503
+ //# sourceMappingURL=chunk-CUH5CP7W.js.map
3504
+ //# sourceMappingURL=chunk-CUH5CP7W.js.map