@signetai/connector-codex 0.155.2 → 0.156.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/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";
@@ -21895,6 +21895,8 @@ function resolveSignetDaemonUrl(opts = {}) {
21895
21895
  const explicit = readEnv(env, "SIGNET_DAEMON_URL");
21896
21896
  if (explicit)
21897
21897
  return normalizeDaemonUrl(explicit, "SIGNET_DAEMON_URL");
21898
+ if (opts.configUrl)
21899
+ return normalizeDaemonUrl(opts.configUrl, "daemon.url");
21898
21900
  const host = readEnv(env, "SIGNET_HOST") ?? fallbackHost;
21899
21901
  assertPlainHost(host);
21900
21902
  const port = normalizePort(readEnv(env, "SIGNET_PORT"), fallbackPort);
@@ -22178,11 +22180,27 @@ var SKIP_FILES2 = new Set([".DS_Store", "Thumbs.db", ".gitkeep", "node_modules",
22178
22180
  var CODEX_PLUGIN_MARKETPLACE_NAME = "signet-local";
22179
22181
  var CODEX_PLUGIN_NAME = "signet";
22180
22182
  var CODEX_PLUGIN_CONFIG_NAME = `${CODEX_PLUGIN_NAME}@${CODEX_PLUGIN_MARKETPLACE_NAME}`;
22181
- function resolveSignetArgs() {
22183
+ function resolveSignetEntry() {
22184
+ const wrapperDir = readEnv2("SIGNET_WRAPPER_DIR") ?? readEnv2("SIGNET_DIR");
22185
+ const candidates = [
22186
+ wrapperDir ? join4(wrapperDir, "bin", "signet.js") : null,
22187
+ join4(dirname5(process.execPath), "..", "bin", "signet.js"),
22188
+ process.argv[1]
22189
+ ];
22190
+ for (const entry of candidates) {
22191
+ if (entry && basename3(entry) === "signet.js" && existsSync2(entry))
22192
+ return entry;
22193
+ }
22194
+ return null;
22195
+ }
22196
+ function resolveSignetArgs(runtime = null) {
22197
+ const entry = resolveSignetEntry();
22198
+ if (runtime && entry)
22199
+ return [runtime, entry];
22182
22200
  const resolved = resolveSignetCliCommand();
22183
22201
  return [resolved.command, ...resolved.args];
22184
22202
  }
22185
- function resolveSignetMcp() {
22203
+ function resolveSignetMcp(runtime = null) {
22186
22204
  const remoteDaemonUrl = resolveRemoteDaemonUrl();
22187
22205
  if (remoteDaemonUrl) {
22188
22206
  const apiKey = readAuthTokenEnv();
@@ -22193,6 +22211,10 @@ function resolveSignetMcp() {
22193
22211
  ...apiKey ? { httpHeaders: { Authorization: `Bearer ${apiKey}` } } : {}
22194
22212
  };
22195
22213
  }
22214
+ const entry = resolveSignetEntry();
22215
+ const mcpEntry = entry ? join4(dirname5(entry), "..", "dist", "mcp-stdio.js") : null;
22216
+ if (runtime && mcpEntry && existsSync2(mcpEntry))
22217
+ return { command: runtime, args: [mcpEntry] };
22196
22218
  return resolveSignetMcpCommand();
22197
22219
  }
22198
22220
  function readEnv2(name) {
@@ -22208,6 +22230,44 @@ function resolveRemoteDaemonUrl() {
22208
22230
  return null;
22209
22231
  return resolveSignetDaemonUrl();
22210
22232
  }
22233
+ var CODEX_DESKTOP_APP_PATHS = [join4(homedir(), "Applications", "Codex.app"), "/Applications/Codex.app"];
22234
+ var CODEX_RUNTIME_SCAN_DEPTH = 8;
22235
+ function codexDesktopNodeCandidates(root, depth = 0) {
22236
+ if (depth > CODEX_RUNTIME_SCAN_DEPTH || !existsSync2(root))
22237
+ return [];
22238
+ const candidates = [];
22239
+ for (const entry of readdirSync(root, { withFileTypes: true })) {
22240
+ const path = join4(root, entry.name);
22241
+ if ((entry.isFile() || entry.isSymbolicLink()) && entry.name === "node")
22242
+ candidates.push(path);
22243
+ try {
22244
+ if (!statSync(path).isDirectory())
22245
+ continue;
22246
+ candidates.push(...codexDesktopNodeCandidates(path, depth + 1));
22247
+ } catch {}
22248
+ }
22249
+ return candidates;
22250
+ }
22251
+ function isUsableNodeRuntime(path) {
22252
+ try {
22253
+ if (!statSync(path).isFile())
22254
+ return false;
22255
+ const result = spawnSync(path, ["--version"], { encoding: "utf-8", timeout: 5000 });
22256
+ return result.status === 0 && /^v\d+\.\d+\.\d+/.test(result.stdout.trim());
22257
+ } catch {
22258
+ return false;
22259
+ }
22260
+ }
22261
+ function resolveCodexDesktopNode(appPaths = CODEX_DESKTOP_APP_PATHS, validate = isUsableNodeRuntime) {
22262
+ for (const appPath of appPaths) {
22263
+ const candidates = codexDesktopNodeCandidates(join4(appPath, "Contents", "Resources"));
22264
+ for (const candidate of candidates) {
22265
+ if (validate(candidate))
22266
+ return candidate;
22267
+ }
22268
+ }
22269
+ return null;
22270
+ }
22211
22271
  function codexPluginBundleFiles(signetArgs, mcp, remoteDaemonUrl) {
22212
22272
  const hookFile = buildHooksFile([...signetArgs], remoteDaemonUrl);
22213
22273
  const mcpServer = "url" in mcp ? {
@@ -22468,6 +22528,44 @@ function isSignetMatcherGroup(group) {
22468
22528
  }
22469
22529
  return false;
22470
22530
  }
22531
+ function hasMissingNodeRuntime(command) {
22532
+ const node = command.match(/(?:^|\s)(['\"]?)([^'\"\s]*[\\/]node(?:\.exe)?)(?:\1)(?=\s|$)/i)?.[2];
22533
+ return Boolean(node && !existsSync2(node));
22534
+ }
22535
+ function hasMissingSignetRuntime(file, configPath) {
22536
+ for (const groups of Object.values(file?.hooks ?? {})) {
22537
+ if (!Array.isArray(groups))
22538
+ continue;
22539
+ for (const group of groups) {
22540
+ if (typeof group !== "object" || group === null || !Array.isArray(group.hooks))
22541
+ continue;
22542
+ for (const handler of group.hooks) {
22543
+ if (typeof handler?.command === "string" && isSignetHookCommand(handler.command) && hasMissingNodeRuntime(handler.command)) {
22544
+ return true;
22545
+ }
22546
+ }
22547
+ }
22548
+ }
22549
+ if (!existsSync2(configPath))
22550
+ return false;
22551
+ let inSignetMcpSection = false;
22552
+ for (const line of readFileSync2(configPath, "utf-8").split(`
22553
+ `)) {
22554
+ const trimmed = line.trim();
22555
+ if (trimmed === "[mcp_servers.signet]") {
22556
+ inSignetMcpSection = true;
22557
+ continue;
22558
+ }
22559
+ if (inSignetMcpSection && trimmed.startsWith("["))
22560
+ break;
22561
+ if (!inSignetMcpSection)
22562
+ continue;
22563
+ const command = trimmed.match(/^command\s*=\s*['\"]([^'\"]+)['\"]/)?.[1];
22564
+ if (typeof command === "string")
22565
+ return hasMissingNodeRuntime(command);
22566
+ }
22567
+ return false;
22568
+ }
22471
22569
  function isLegacySignetMatcherGroup(group) {
22472
22570
  if (typeof group !== "object" || group === null)
22473
22571
  return false;
@@ -22810,6 +22908,12 @@ class CodexConnector extends BaseConnector {
22810
22908
  getCodexHome() {
22811
22909
  return join4(homedir(), ".codex");
22812
22910
  }
22911
+ getCodexDesktopAppPaths() {
22912
+ return CODEX_DESKTOP_APP_PATHS;
22913
+ }
22914
+ resolveCodexDesktopNode() {
22915
+ return resolveCodexDesktopNode(this.getCodexDesktopAppPaths());
22916
+ }
22813
22917
  supportsNativePluginInstall() {
22814
22918
  if (readEnv2("SIGNET_CODEX_DISABLE_NATIVE_PLUGIN") === "1")
22815
22919
  return false;
@@ -22924,8 +23028,14 @@ ${result.stderr ?? ""}`;
22924
23028
  }
22925
23029
  const codexHome = this.getCodexHome();
22926
23030
  mkdirSync(codexHome, { recursive: true });
22927
- const signetArgs = resolveSignetArgs();
22928
- const mcp = resolveSignetMcp();
23031
+ const configPath = this.getConfigPath();
23032
+ const staleRuntime = hasMissingSignetRuntime(readHooksFile(this.getHooksJsonPath()), configPath);
23033
+ const runtime = this.resolveCodexDesktopNode();
23034
+ const signetArgs = resolveSignetArgs(runtime);
23035
+ const mcp = resolveSignetMcp(runtime);
23036
+ if (staleRuntime) {
23037
+ 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.");
23038
+ }
22929
23039
  const nativePluginSupported = this.supportsNativePluginInstall();
22930
23040
  if (nativePluginSupported) {
22931
23041
  const bundle = writeCodexPluginBundle({
@@ -22972,7 +23082,6 @@ ${result.stderr ?? ""}`;
22972
23082
  if (!skillsResult) {
22973
23083
  warnings.push("Failed to symlink skills directory");
22974
23084
  }
22975
- const configPath = this.getConfigPath();
22976
23085
  if (patchConfigToml(configPath, mcp)) {
22977
23086
  configsPatched.push(configPath);
22978
23087
  }
@@ -23050,6 +23159,7 @@ ${result.stderr ?? ""}`;
23050
23159
  }
23051
23160
  export {
23052
23161
  writeCodexPluginBundle,
23162
+ resolveCodexDesktopNode,
23053
23163
  buildMcpBlock,
23054
23164
  CodexConnector
23055
23165
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@signetai/connector-codex",
3
- "version": "0.155.2",
3
+ "version": "0.156.0",
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.156.0",
28
+ "@signetai/core": "0.156.0"
29
29
  },
30
30
  "devDependencies": {
31
31
  "@types/node": "^22.0.0",