@signetai/connector-codex 0.155.2 → 0.155.3

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/dist/index.d.ts CHANGED
@@ -18,6 +18,7 @@ interface NativePluginCommandResult {
18
18
  readonly filesWritten: readonly string[];
19
19
  readonly warning?: string;
20
20
  }
21
+ export declare function resolveCodexDesktopNode(appPaths?: readonly string[], validate?: (path: string) => boolean): string | null;
21
22
  export declare function writeCodexPluginBundle(input: {
22
23
  readonly codexHome: string;
23
24
  readonly signetArgs?: readonly string[];
@@ -29,6 +30,8 @@ export declare class CodexConnector extends BaseConnector {
29
30
  readonly name = "Codex";
30
31
  readonly harnessId = "codex";
31
32
  protected getCodexHome(): string;
33
+ protected getCodexDesktopAppPaths(): readonly string[];
34
+ protected resolveCodexDesktopNode(): string | null;
32
35
  protected supportsNativePluginInstall(): boolean;
33
36
  protected nativePluginProvidesHooks(): boolean;
34
37
  protected installNativePlugin(codexHome: string): NativePluginCommandResult;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAKA,OAAO,EACN,aAAa,EACb,KAAK,aAAa,EAClB,KAAK,eAAe,EAIpB,MAAM,wBAAwB,CAAC;AAQhC,MAAM,MAAM,eAAe,GACxB;IAAE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,CAAA;CAAE,GAC9D;IACA,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,iBAAiB,EAAE,MAAM,CAAC;IACnC,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,WAAW,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;CACvD,CAAC;AAWL,UAAU,uBAAuB;IAChC,QAAQ,CAAC,eAAe,EAAE,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AAE,eAAe,CAAC;IAC/B,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACzC,GAAG,uBAAuB,CAe1B;AA6ZD,wBAAgB,aAAa,CAAC,GAAG,EAAE,eAAe,GAAG,MAAM,CAuB1D;AA8HD,qBAAa,cAAe,SAAQ,aAAa;IAChD,QAAQ,CAAC,IAAI,WAAW;IACxB,QAAQ,CAAC,SAAS,WAAW;IAE7B,SAAS,CAAC,YAAY,IAAI,MAAM;IAIhC,SAAS,CAAC,uBAAuB,IAAI,SAAS,MAAM,EAAE;IAItD,SAAS,CAAC,uBAAuB,IAAI,MAAM,GAAG,IAAI;IAIlD,SAAS,CAAC,2BAA2B,IAAI,OAAO;IAShD,SAAS,CAAC,yBAAyB,IAAI,OAAO;IAI9C,SAAS,CAAC,mBAAmB,CAAC,SAAS,EAAE,MAAM,GAAG,yBAAyB;IAoB3E,SAAS,CAAC,kBAAkB,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI;IAOrD,OAAO,CAAC,gBAAgB;IAIxB,aAAa,IAAI,MAAM;IAIvB,OAAO,CAAC,yBAAyB;IA4CjC,OAAO,CAAC,wBAAwB;IAkC1B,OAAO,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC;IAqGjD,SAAS,IAAI,OAAO,CAAC,eAAe,CAAC;IA2D3C,WAAW,IAAI,OAAO;CAgBtB"}
package/dist/index.js CHANGED
@@ -1,9 +1,9 @@
1
1
  // src/index.ts
2
2
  import { spawnSync } from "node:child_process";
3
3
  import { createHash } from "node:crypto";
4
- import { existsSync as existsSync2, mkdirSync, readFileSync as readFileSync2, rmSync, writeFileSync as writeFileSync2 } from "node:fs";
4
+ import { existsSync as existsSync2, mkdirSync, readFileSync as readFileSync2, readdirSync, rmSync, statSync, writeFileSync as writeFileSync2 } from "node:fs";
5
5
  import { homedir } from "node:os";
6
- import { join as join4 } from "node:path";
6
+ import { basename as basename3, dirname as dirname5, join as join4 } from "node:path";
7
7
 
8
8
  // ../../../libs/connector-base/dist/index.js
9
9
  import { randomBytes } from "node:crypto";
@@ -22178,11 +22178,27 @@ var SKIP_FILES2 = new Set([".DS_Store", "Thumbs.db", ".gitkeep", "node_modules",
22178
22178
  var CODEX_PLUGIN_MARKETPLACE_NAME = "signet-local";
22179
22179
  var CODEX_PLUGIN_NAME = "signet";
22180
22180
  var CODEX_PLUGIN_CONFIG_NAME = `${CODEX_PLUGIN_NAME}@${CODEX_PLUGIN_MARKETPLACE_NAME}`;
22181
- function resolveSignetArgs() {
22181
+ function resolveSignetEntry() {
22182
+ const wrapperDir = readEnv2("SIGNET_WRAPPER_DIR") ?? readEnv2("SIGNET_DIR");
22183
+ const candidates = [
22184
+ wrapperDir ? join4(wrapperDir, "bin", "signet.js") : null,
22185
+ join4(dirname5(process.execPath), "..", "bin", "signet.js"),
22186
+ process.argv[1]
22187
+ ];
22188
+ for (const entry of candidates) {
22189
+ if (entry && basename3(entry) === "signet.js" && existsSync2(entry))
22190
+ return entry;
22191
+ }
22192
+ return null;
22193
+ }
22194
+ function resolveSignetArgs(runtime = null) {
22195
+ const entry = resolveSignetEntry();
22196
+ if (runtime && entry)
22197
+ return [runtime, entry];
22182
22198
  const resolved = resolveSignetCliCommand();
22183
22199
  return [resolved.command, ...resolved.args];
22184
22200
  }
22185
- function resolveSignetMcp() {
22201
+ function resolveSignetMcp(runtime = null) {
22186
22202
  const remoteDaemonUrl = resolveRemoteDaemonUrl();
22187
22203
  if (remoteDaemonUrl) {
22188
22204
  const apiKey = readAuthTokenEnv();
@@ -22193,6 +22209,10 @@ function resolveSignetMcp() {
22193
22209
  ...apiKey ? { httpHeaders: { Authorization: `Bearer ${apiKey}` } } : {}
22194
22210
  };
22195
22211
  }
22212
+ const entry = resolveSignetEntry();
22213
+ const mcpEntry = entry ? join4(dirname5(entry), "..", "dist", "mcp-stdio.js") : null;
22214
+ if (runtime && mcpEntry && existsSync2(mcpEntry))
22215
+ return { command: runtime, args: [mcpEntry] };
22196
22216
  return resolveSignetMcpCommand();
22197
22217
  }
22198
22218
  function readEnv2(name) {
@@ -22208,6 +22228,44 @@ function resolveRemoteDaemonUrl() {
22208
22228
  return null;
22209
22229
  return resolveSignetDaemonUrl();
22210
22230
  }
22231
+ var CODEX_DESKTOP_APP_PATHS = [join4(homedir(), "Applications", "Codex.app"), "/Applications/Codex.app"];
22232
+ var CODEX_RUNTIME_SCAN_DEPTH = 8;
22233
+ function codexDesktopNodeCandidates(root, depth = 0) {
22234
+ if (depth > CODEX_RUNTIME_SCAN_DEPTH || !existsSync2(root))
22235
+ return [];
22236
+ const candidates = [];
22237
+ for (const entry of readdirSync(root, { withFileTypes: true })) {
22238
+ const path = join4(root, entry.name);
22239
+ if ((entry.isFile() || entry.isSymbolicLink()) && entry.name === "node")
22240
+ candidates.push(path);
22241
+ try {
22242
+ if (!statSync(path).isDirectory())
22243
+ continue;
22244
+ candidates.push(...codexDesktopNodeCandidates(path, depth + 1));
22245
+ } catch {}
22246
+ }
22247
+ return candidates;
22248
+ }
22249
+ function isUsableNodeRuntime(path) {
22250
+ try {
22251
+ if (!statSync(path).isFile())
22252
+ return false;
22253
+ const result = spawnSync(path, ["--version"], { encoding: "utf-8", timeout: 5000 });
22254
+ return result.status === 0 && /^v\d+\.\d+\.\d+/.test(result.stdout.trim());
22255
+ } catch {
22256
+ return false;
22257
+ }
22258
+ }
22259
+ function resolveCodexDesktopNode(appPaths = CODEX_DESKTOP_APP_PATHS, validate = isUsableNodeRuntime) {
22260
+ for (const appPath of appPaths) {
22261
+ const candidates = codexDesktopNodeCandidates(join4(appPath, "Contents", "Resources"));
22262
+ for (const candidate of candidates) {
22263
+ if (validate(candidate))
22264
+ return candidate;
22265
+ }
22266
+ }
22267
+ return null;
22268
+ }
22211
22269
  function codexPluginBundleFiles(signetArgs, mcp, remoteDaemonUrl) {
22212
22270
  const hookFile = buildHooksFile([...signetArgs], remoteDaemonUrl);
22213
22271
  const mcpServer = "url" in mcp ? {
@@ -22468,6 +22526,44 @@ function isSignetMatcherGroup(group) {
22468
22526
  }
22469
22527
  return false;
22470
22528
  }
22529
+ function hasMissingNodeRuntime(command) {
22530
+ const node = command.match(/(?:^|\s)(['\"]?)([^'\"\s]*[\\/]node(?:\.exe)?)(?:\1)(?=\s|$)/i)?.[2];
22531
+ return Boolean(node && !existsSync2(node));
22532
+ }
22533
+ function hasMissingSignetRuntime(file, configPath) {
22534
+ for (const groups of Object.values(file?.hooks ?? {})) {
22535
+ if (!Array.isArray(groups))
22536
+ continue;
22537
+ for (const group of groups) {
22538
+ if (typeof group !== "object" || group === null || !Array.isArray(group.hooks))
22539
+ continue;
22540
+ for (const handler of group.hooks) {
22541
+ if (typeof handler?.command === "string" && isSignetHookCommand(handler.command) && hasMissingNodeRuntime(handler.command)) {
22542
+ return true;
22543
+ }
22544
+ }
22545
+ }
22546
+ }
22547
+ if (!existsSync2(configPath))
22548
+ return false;
22549
+ let inSignetMcpSection = false;
22550
+ for (const line of readFileSync2(configPath, "utf-8").split(`
22551
+ `)) {
22552
+ const trimmed = line.trim();
22553
+ if (trimmed === "[mcp_servers.signet]") {
22554
+ inSignetMcpSection = true;
22555
+ continue;
22556
+ }
22557
+ if (inSignetMcpSection && trimmed.startsWith("["))
22558
+ break;
22559
+ if (!inSignetMcpSection)
22560
+ continue;
22561
+ const command = trimmed.match(/^command\s*=\s*['\"]([^'\"]+)['\"]/)?.[1];
22562
+ if (typeof command === "string")
22563
+ return hasMissingNodeRuntime(command);
22564
+ }
22565
+ return false;
22566
+ }
22471
22567
  function isLegacySignetMatcherGroup(group) {
22472
22568
  if (typeof group !== "object" || group === null)
22473
22569
  return false;
@@ -22810,6 +22906,12 @@ class CodexConnector extends BaseConnector {
22810
22906
  getCodexHome() {
22811
22907
  return join4(homedir(), ".codex");
22812
22908
  }
22909
+ getCodexDesktopAppPaths() {
22910
+ return CODEX_DESKTOP_APP_PATHS;
22911
+ }
22912
+ resolveCodexDesktopNode() {
22913
+ return resolveCodexDesktopNode(this.getCodexDesktopAppPaths());
22914
+ }
22813
22915
  supportsNativePluginInstall() {
22814
22916
  if (readEnv2("SIGNET_CODEX_DISABLE_NATIVE_PLUGIN") === "1")
22815
22917
  return false;
@@ -22924,8 +23026,14 @@ ${result.stderr ?? ""}`;
22924
23026
  }
22925
23027
  const codexHome = this.getCodexHome();
22926
23028
  mkdirSync(codexHome, { recursive: true });
22927
- const signetArgs = resolveSignetArgs();
22928
- const mcp = resolveSignetMcp();
23029
+ const configPath = this.getConfigPath();
23030
+ const staleRuntime = hasMissingSignetRuntime(readHooksFile(this.getHooksJsonPath()), configPath);
23031
+ const runtime = this.resolveCodexDesktopNode();
23032
+ const signetArgs = resolveSignetArgs(runtime);
23033
+ const mcp = resolveSignetMcp(runtime);
23034
+ if (staleRuntime) {
23035
+ warnings.push(runtime ? "Detected a missing Signet Codex runtime path; refreshed only Signet-owned hooks and MCP configuration." : "Detected a missing Signet Codex runtime path; no replacement Codex runtime was found, so Signet commands use the PATH fallback.");
23036
+ }
22929
23037
  const nativePluginSupported = this.supportsNativePluginInstall();
22930
23038
  if (nativePluginSupported) {
22931
23039
  const bundle = writeCodexPluginBundle({
@@ -22972,7 +23080,6 @@ ${result.stderr ?? ""}`;
22972
23080
  if (!skillsResult) {
22973
23081
  warnings.push("Failed to symlink skills directory");
22974
23082
  }
22975
- const configPath = this.getConfigPath();
22976
23083
  if (patchConfigToml(configPath, mcp)) {
22977
23084
  configsPatched.push(configPath);
22978
23085
  }
@@ -23050,6 +23157,7 @@ ${result.stderr ?? ""}`;
23050
23157
  }
23051
23158
  export {
23052
23159
  writeCodexPluginBundle,
23160
+ resolveCodexDesktopNode,
23053
23161
  buildMcpBlock,
23054
23162
  CodexConnector
23055
23163
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@signetai/connector-codex",
3
- "version": "0.155.2",
3
+ "version": "0.155.3",
4
4
  "description": "Signet connector for Codex CLI",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -24,8 +24,8 @@
24
24
  "typecheck": "tsc --noEmit"
25
25
  },
26
26
  "dependencies": {
27
- "@signetai/connector-base": "0.155.2",
28
- "@signetai/core": "0.155.2"
27
+ "@signetai/connector-base": "0.155.3",
28
+ "@signetai/core": "0.155.3"
29
29
  },
30
30
  "devDependencies": {
31
31
  "@types/node": "^22.0.0",