hankweave 0.6.2 → 0.7.2

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.
@@ -1 +1 @@
1
- 0.112.0
1
+ 0.139.0
@@ -11,6 +11,7 @@ import { promises as fs } from "fs";
11
11
  import os from "os";
12
12
  import path from "path";
13
13
  import { spawn } from "child_process";
14
+ import { statSync } from "fs";
14
15
  import path2 from "path";
15
16
  import readline from "readline";
16
17
  import { createRequire } from "module";
@@ -156,10 +157,18 @@ var PLATFORM_PACKAGE_BY_TARGET = {
156
157
  var moduleRequire = createRequire(import.meta.url);
157
158
  var CodexExec = class {
158
159
  executablePath;
160
+ pathDirs;
159
161
  envOverride;
160
162
  configOverrides;
161
163
  constructor(executablePath = null, env, configOverrides) {
162
- this.executablePath = executablePath || findCodexPath();
164
+ if (executablePath) {
165
+ this.executablePath = executablePath;
166
+ this.pathDirs = [];
167
+ } else {
168
+ const resolved = findCodexPath();
169
+ this.executablePath = resolved.executablePath;
170
+ this.pathDirs = resolved.pathDirs;
171
+ }
163
172
  this.envOverride = env;
164
173
  this.configOverrides = configOverrides;
165
174
  }
@@ -170,6 +179,12 @@ var CodexExec = class {
170
179
  commandArgs.push("--config", override);
171
180
  }
172
181
  }
182
+ if (args.baseUrl) {
183
+ commandArgs.push(
184
+ "--config",
185
+ `openai_base_url=${toTomlValue(args.baseUrl, "openai_base_url")}`
186
+ );
187
+ }
173
188
  if (args.model) {
174
189
  commandArgs.push("--model", args.model);
175
190
  }
@@ -230,12 +245,12 @@ var CodexExec = class {
230
245
  if (!env[INTERNAL_ORIGINATOR_ENV]) {
231
246
  env[INTERNAL_ORIGINATOR_ENV] = TYPESCRIPT_SDK_ORIGINATOR;
232
247
  }
233
- if (args.baseUrl) {
234
- env.OPENAI_BASE_URL = args.baseUrl;
235
- }
236
248
  if (args.apiKey) {
237
249
  env.CODEX_API_KEY = args.apiKey;
238
250
  }
251
+ if (this.pathDirs.length > 0) {
252
+ prependPathDirs(env, this.pathDirs);
253
+ }
239
254
  const child = spawn(this.executablePath, commandArgs, {
240
255
  env,
241
256
  signal: args.signal
@@ -428,10 +443,68 @@ function findCodexPath() {
428
443
  `Unable to locate Codex CLI binaries. Ensure ${CODEX_NPM_NAME} is installed with optional dependencies.`
429
444
  );
430
445
  }
431
- const archRoot = path2.join(vendorRoot, targetTriple);
432
446
  const codexBinaryName = process.platform === "win32" ? "codex.exe" : "codex";
433
- const binaryPath = path2.join(archRoot, "codex", codexBinaryName);
434
- return binaryPath;
447
+ const nativePackage = resolveNativePackage(vendorRoot, targetTriple, codexBinaryName);
448
+ if (!nativePackage) {
449
+ throw new Error(
450
+ `Unable to locate Codex CLI binaries for ${targetTriple}. Ensure ${CODEX_NPM_NAME} is installed with optional dependencies.`
451
+ );
452
+ }
453
+ return nativePackage;
454
+ }
455
+ function resolveNativePackage(vendorRoot, targetTriple, codexBinaryName) {
456
+ const packageRoot = path2.join(vendorRoot, targetTriple);
457
+ const packageBinaryPath = path2.join(packageRoot, "bin", codexBinaryName);
458
+ if (isFile(packageBinaryPath) && isFile(path2.join(packageRoot, "codex-package.json"))) {
459
+ return {
460
+ executablePath: packageBinaryPath,
461
+ pathDirs: existingDirs(path2.join(packageRoot, "codex-path"))
462
+ };
463
+ }
464
+ const legacyBinaryPath = path2.join(packageRoot, "codex", codexBinaryName);
465
+ if (isFile(legacyBinaryPath)) {
466
+ return {
467
+ executablePath: legacyBinaryPath,
468
+ pathDirs: existingDirs(path2.join(packageRoot, "path"))
469
+ };
470
+ }
471
+ return null;
472
+ }
473
+ function existingDirs(...dirs) {
474
+ return dirs.filter(isDirectory);
475
+ }
476
+ function prependPathDirs(env, pathDirs, platform = process.platform) {
477
+ const pathKey = pathEnvKey(env, platform);
478
+ if (platform === "win32") {
479
+ for (const key of Object.keys(env)) {
480
+ if (key.toLowerCase() === "path" && key !== pathKey) {
481
+ delete env[key];
482
+ }
483
+ }
484
+ }
485
+ const existingEntries = (env[pathKey] ?? "").split(path2.delimiter).filter((entry) => entry.length > 0 && !pathDirs.includes(entry));
486
+ env[pathKey] = [...pathDirs, ...existingEntries].join(path2.delimiter);
487
+ }
488
+ function pathEnvKey(env, platform) {
489
+ if (platform !== "win32") {
490
+ return "PATH";
491
+ }
492
+ const matchingKeys = Object.keys(env).filter((key) => key.toLowerCase() === "path");
493
+ return matchingKeys.includes("Path") ? "Path" : matchingKeys.at(-1) ?? "PATH";
494
+ }
495
+ function isFile(filePath) {
496
+ try {
497
+ return statSync(filePath).isFile();
498
+ } catch {
499
+ return false;
500
+ }
501
+ }
502
+ function isDirectory(filePath) {
503
+ try {
504
+ return statSync(filePath).isDirectory();
505
+ } catch {
506
+ return false;
507
+ }
435
508
  }
436
509
  var Codex = class {
437
510
  exec;
@@ -1181,7 +1254,7 @@ var package_default = {
1181
1254
  clean: `node -e "const fs=require('fs'); fs.rmSync('dist',{recursive:true,force:true}); fs.rmSync('index.js',{force:true});"`
1182
1255
  },
1183
1256
  dependencies: {
1184
- "@openai/codex-sdk": "^0.112.0",
1257
+ "@openai/codex-sdk": "^0.139.0",
1185
1258
  "@shims/common": "file:./common"
1186
1259
  },
1187
1260
  devDependencies: {
@@ -1333,6 +1406,18 @@ function findVendoredCodexExe(npmPrefix) {
1333
1406
  }
1334
1407
  return null;
1335
1408
  }
1409
+ function describeCodexSearch(command) {
1410
+ const fromOverride = getCodexPathOverride() ? " (from CODEX_PATH_OVERRIDE)" : "";
1411
+ if (path6.isAbsolute(command) || command.includes(path6.sep)) {
1412
+ return `path '${command}'${fromOverride}`;
1413
+ }
1414
+ const locator = process.platform === "win32" ? "where" : "which";
1415
+ const parts = [`'${command}'${fromOverride} on PATH (via ${locator})`];
1416
+ if (process.platform === "win32") {
1417
+ parts.push("vendored @openai/codex-win32 package in the npm prefix");
1418
+ }
1419
+ return parts.join(", ");
1420
+ }
1336
1421
  async function resolveCodexPath(command) {
1337
1422
  const isWindows = process.platform === "win32";
1338
1423
  if (path6.isAbsolute(command) || command.includes(path6.sep)) {
@@ -1444,7 +1529,7 @@ var CodexShim = class {
1444
1529
  {
1445
1530
  name: "agent_found",
1446
1531
  passed: agentFound,
1447
- message: agentFound ? `Found codex at ${resolvedPath}` : `Could not find codex via ${override}`
1532
+ message: agentFound ? `Found codex at ${resolvedPath}` : `Could not find codex. Searched: ${describeCodexSearch(override)}`
1448
1533
  },
1449
1534
  {
1450
1535
  name: "api_key",
@@ -34,7 +34,7 @@
34
34
  "clean": "node -e \"const fs=require('fs'); fs.rmSync('dist',{recursive:true,force:true}); fs.rmSync('index.js',{force:true});\""
35
35
  },
36
36
  "dependencies": {
37
- "@openai/codex-sdk": "^0.112.0",
37
+ "@openai/codex-sdk": "^0.139.0",
38
38
  "@shims/common": "file:./common"
39
39
  },
40
40
  "devDependencies": {
@@ -1283,7 +1283,7 @@ async function runSelfTest() {
1283
1283
  {
1284
1284
  name: "agent_found",
1285
1285
  passed: Boolean(geminiPath),
1286
- message: geminiPath ? `Found Gemini CLI at ${geminiPath}` : "Gemini CLI not found in PATH"
1286
+ message: geminiPath ? `Found Gemini CLI at ${geminiPath}` : `Gemini CLI ('gemini') not found on PATH (searched via ${process2.platform === "win32" ? "where" : "which"})`
1287
1287
  },
1288
1288
  {
1289
1289
  name: "auth_configured",
@@ -320,7 +320,10 @@ async function ensureOpencodeAvailable() {
320
320
  return resolved;
321
321
  }
322
322
  }
323
- throw new Error("OpenCode CLI not found. Set OPENCODE_BIN or install opencode.");
323
+ const searched = [
324
+ ...new Set(candidates.map((candidate) => candidate.includes(path2.sep) || candidate.startsWith(".") ? candidate : `'${candidate}' on PATH`))
325
+ ].join(", ");
326
+ throw new Error(`OpenCode CLI not found. Searched: ${searched}. Set OPENCODE_BIN or install opencode.`);
324
327
  }
325
328
  async function findOnPath(command) {
326
329
  const locator = process.platform === "win32" ? "where" : "which";
@@ -4,12 +4,13 @@ This shim bundles third-party code into `dist/index.js` / `index.js`.
4
4
 
5
5
  ## Primary SDK dependency
6
6
 
7
- ### @mariozechner/pi-coding-agent
7
+ ### @earendil-works/pi-coding-agent
8
8
 
9
- - Version: 0.57.1
9
+ - Version: 0.77.0
10
10
  - License: MIT
11
11
  - Copyright: Mario Zechner
12
- - Source: https://github.com/badlogic/pi-mono/tree/main/packages/coding-agent
12
+ - Source: https://github.com/earendil-works/pi-mono/tree/main/packages/coding-agent
13
+ - Previously published as `@mariozechner/pi-coding-agent` (renamed at upstream v0.74.0).
13
14
 
14
15
  The full license text is available in the npm package metadata and in the upstream source repository.
15
16
 
@@ -1 +1 @@
1
- 0.57.1
1
+ 0.79.1