opencode-openai-codex-multi-auth 4.4.7 → 4.4.9

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-openai-codex-multi-auth",
3
- "version": "4.4.7",
3
+ "version": "4.4.9",
4
4
  "description": "OpenAI ChatGPT (Codex backend) OAuth auth plugin for opencode - use your ChatGPT Plus/Pro subscription instead of API credits",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -10,16 +10,18 @@ import { parse, modify, applyEdits, printParseErrorCode } from "jsonc-parser";
10
10
  // This repository is a fork. Install the plugin from GitHub to ensure
11
11
  // OpenCode uses this fork instead of the upstream npm package.
12
12
  // The npm package name for this fork.
13
- const PLUGIN_SPEC = "opencode-openai-codex-multi-auth";
13
+ const PLUGIN_PACKAGE = "opencode-openai-codex-multi-auth";
14
+ // Keep the OpenCode plugin entry unpinned so it stays up to date.
15
+ const PLUGIN_ENTRY_LATEST = `${PLUGIN_PACKAGE}@latest`;
14
16
  // Keep track of older identifiers so we can migrate cleanly.
15
17
  const UPSTREAM_PACKAGE = "opencode-openai-codex-auth";
16
18
  const LEGACY_GITHUB_SPEC = "github:iam-brain/opencode-openai-codex-multi-auth";
17
- const PLUGIN_ALIASES = [PLUGIN_SPEC, UPSTREAM_PACKAGE, LEGACY_GITHUB_SPEC];
19
+ const PLUGIN_ALIASES = [PLUGIN_PACKAGE, UPSTREAM_PACKAGE, LEGACY_GITHUB_SPEC];
18
20
  const args = new Set(process.argv.slice(2));
19
21
 
20
22
  if (args.has("--help") || args.has("-h")) {
21
23
  console.log(
22
- `Usage: ${PLUGIN_SPEC} [--modern|--legacy] [--uninstall] [--all] [--dry-run] [--no-cache-clear]\n\n` +
24
+ `Usage: ${PLUGIN_PACKAGE} [--modern|--legacy] [--uninstall] [--all] [--dry-run] [--no-cache-clear]\n\n` +
23
25
  "Default behavior:\n" +
24
26
  " - Installs/updates global config at ~/.config/opencode/opencode.jsonc (falls back to .json)\n" +
25
27
  " - Uses modern config (variants) by default\n" +
@@ -55,7 +57,7 @@ const configDir = join(homedir(), ".config", "opencode");
55
57
  const configPathJson = join(configDir, "opencode.json");
56
58
  const configPathJsonc = join(configDir, "opencode.jsonc");
57
59
  const cacheDir = join(homedir(), ".cache", "opencode");
58
- const cacheNodeModules = join(cacheDir, "node_modules", PLUGIN_SPEC);
60
+ const cacheNodeModules = join(cacheDir, "node_modules", PLUGIN_PACKAGE);
59
61
  const cacheNodeModulesUpstream = join(cacheDir, "node_modules", UPSTREAM_PACKAGE);
60
62
  const cacheNodeModulesLegacyGitHub = join(cacheDir, "node_modules", LEGACY_GITHUB_SPEC);
61
63
  const cacheBunLock = join(cacheDir, "bun.lock");
@@ -72,16 +74,34 @@ function log(message) {
72
74
  console.log(message);
73
75
  }
74
76
 
77
+ function isPluginPackageSpec(entry) {
78
+ return typeof entry === "string" && entry.startsWith(`${PLUGIN_PACKAGE}@`);
79
+ }
80
+
81
+ function matchesPluginAlias(entry, alias) {
82
+ if (entry === alias) return true;
83
+ if (entry.startsWith(`${alias}@`)) return true;
84
+ // GitHub specs can include a ref suffix: github:owner/repo#ref
85
+ if (entry.startsWith(`${alias}#`)) return true;
86
+ return false;
87
+ }
88
+
89
+ function resolveDesiredPluginEntry(list) {
90
+ const entries = Array.isArray(list) ? list.filter(Boolean) : [];
91
+ const existingPinned = entries.find(isPluginPackageSpec);
92
+ return typeof existingPinned === "string" ? existingPinned : PLUGIN_ENTRY_LATEST;
93
+ }
94
+
75
95
  function normalizePluginList(list) {
76
96
  const entries = Array.isArray(list) ? list.filter(Boolean) : [];
97
+ const desiredPluginEntry = resolveDesiredPluginEntry(entries);
77
98
  const filtered = entries.filter((entry) => {
78
99
  if (typeof entry !== "string") return true;
79
100
  return !PLUGIN_ALIASES.some(
80
- (alias) =>
81
- entry === alias || entry.startsWith(`${alias}@`) || entry.includes(alias),
101
+ (alias) => matchesPluginAlias(entry, alias),
82
102
  );
83
103
  });
84
- return [...filtered, PLUGIN_SPEC];
104
+ return [...filtered, desiredPluginEntry];
85
105
  }
86
106
 
87
107
  function removePluginEntries(list) {
@@ -89,8 +109,7 @@ function removePluginEntries(list) {
89
109
  return entries.filter((entry) => {
90
110
  if (typeof entry !== "string") return true;
91
111
  return !PLUGIN_ALIASES.some(
92
- (alias) =>
93
- entry === alias || entry.startsWith(`${alias}@`) || entry.includes(alias),
112
+ (alias) => matchesPluginAlias(entry, alias),
94
113
  );
95
114
  });
96
115
  }
@@ -394,7 +413,7 @@ async function main() {
394
413
  }
395
414
 
396
415
  const template = await readJson(templatePath);
397
- template.plugin = [PLUGIN_SPEC];
416
+ template.plugin = [PLUGIN_ENTRY_LATEST];
398
417
 
399
418
  let nextConfig = template;
400
419
  let nextContent = null;