@hybridlabor-api/aos 4.4.2-beta.4 → 4.4.2-beta.5

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 (2) hide show
  1. package/installer.js +43 -6
  2. package/package.json +1 -1
package/installer.js CHANGED
@@ -811,7 +811,10 @@ function detectPlatforms() {
811
811
  },
812
812
  {
813
813
  key: 'codex', name: 'ChatGPT Codex CLI', path: path.join(homeDir, '.codex'),
814
- evidence: () => hasExecutable('codex'),
814
+ // Codex ships two ways: the standalone CLI binary, and embedded in
815
+ // the ChatGPT desktop app. A machine can have either without the
816
+ // other (e.g. ChatGPT desktop only, codex never put on PATH).
817
+ evidence: () => hasExecutable('codex') || anyExists(appBundle('ChatGPT')),
815
818
  },
816
819
  {
817
820
  key: 'claudecode', name: 'Claude Code CLI', path: path.join(homeDir, '.claude'),
@@ -1171,13 +1174,20 @@ function syncSkillsToGlobalHarnesses(excludeSkills = []) {
1171
1174
  // the very directories detectPlatforms() then read back as proof the
1172
1175
  // harness existed. ~/.agents is ours and always written.
1173
1176
  const detectedKeys = new Set(detectPlatforms().map((d) => d.key));
1177
+ // No `|| fs.existsSync(d.dir)` fallback here on purpose: that fallback
1178
+ // used to mean a directory AOS itself planted in a past run (before a
1179
+ // harness was ever really detected) kept being "detected" forever,
1180
+ // regardless of what detectPlatforms() found this run -- the exact
1181
+ // circularity the block comment above warns about, just one layer down.
1182
+ // A harness that stops being detected now simply stops receiving skill
1183
+ // updates instead of perpetuating a false positive.
1174
1184
  const extraSkillDestinations = [
1175
1185
  { dir: path.join(homeDir, '.agents', 'skills'), key: null },
1176
1186
  { dir: path.join(homeDir, '.claude', 'skills'), key: 'claudecode' },
1177
1187
  { dir: path.join(homeDir, '.codex', 'skills'), key: 'codex' },
1178
1188
  { dir: path.join(homeDir, '.cursor', 'skills'), key: 'cursor' },
1179
1189
  { dir: path.join(homeDir, '.roo', 'skills'), key: 'vscode' },
1180
- ].filter((d) => d.key === null || detectedKeys.has(d.key) || fs.existsSync(d.dir));
1190
+ ].filter((d) => d.key === null || detectedKeys.has(d.key));
1181
1191
 
1182
1192
  for (const { dir: dest } of extraSkillDestinations) {
1183
1193
  try {
@@ -1245,15 +1255,42 @@ function maskApiKey(key) {
1245
1255
  return key.substring(0, 4) + '...' + key.substring(key.length - 4);
1246
1256
  }
1247
1257
 
1248
- async function promptCredentials(referenceMcpDir) {
1249
- if (isAutoYes) return { gemini: "", github: "", openwikiProvider: "google", openwikiModel: "", openwikiBaseUrl: "", keyEnvName: 'GEMINI_API_KEY' };
1258
+ // Provider -> its own API key env var name. Used both to find a previously
1259
+ // configured non-Google provider's key (loadExistingEnv only special-cased
1260
+ // Gemini/GitHub, so a Groq/Grok/NVIDIA/OpenAI/OpenRouter setup was invisible
1261
+ // to "keep existing" and silently looked unconfigured) and to build the
1262
+ // isAutoYes default without re-deriving the same mapping twice.
1263
+ const PROVIDER_KEY_ENV_NAMES = {
1264
+ google: 'GEMINI_API_KEY', groq: 'GROQ_API_KEY', grok: 'XAI_API_KEY',
1265
+ nvidia: 'NVIDIA_API_KEY', openrouter: 'OPENROUTER_API_KEY',
1266
+ openai: 'OPENAI_API_KEY', ollama: null, custom: 'OPENWIKI_API_KEY',
1267
+ };
1250
1268
 
1269
+ async function promptCredentials(referenceMcpDir) {
1251
1270
  const existingEnv = loadExistingEnv(referenceMcpDir);
1252
- const existingGemini = existingEnv['GEMINI_API_KEY'] || existingEnv['GOOGLE_API_KEY'] || existingEnv['OPENWIKI_API_KEY'] || '';
1253
1271
  const existingGithub = existingEnv['GITHUB_PERSONAL_ACCESS_TOKEN'] || existingEnv['GITHUB_TOKEN'] || '';
1254
1272
  const existingProvider = existingEnv['OPENWIKI_PROVIDER'] || 'google';
1255
1273
  const existingModel = existingEnv['OPENWIKI_MODEL'] || '';
1256
1274
  const existingBaseUrl = existingEnv['OPENWIKI_BASE_URL'] || '';
1275
+ const existingKeyEnvName = PROVIDER_KEY_ENV_NAMES[existingProvider] || 'OPENWIKI_API_KEY';
1276
+ // Gemini/Google/OpenWiki-generic keys are also accepted as a fallback so
1277
+ // an old config written before OPENWIKI_PROVIDER existed still resolves.
1278
+ const existingGemini = existingEnv[existingKeyEnvName] || existingEnv['GEMINI_API_KEY'] || existingEnv['GOOGLE_API_KEY'] || existingEnv['OPENWIKI_API_KEY'] || '';
1279
+
1280
+ if (isAutoYes) {
1281
+ // A non-interactive run (npx -y, or an --auto submodule install) must
1282
+ // never silently discard a provider already configured on this
1283
+ // machine -- this used to hard-reset to an empty Google/Gemini
1284
+ // default on every unattended re-run, wiping a previously-chosen
1285
+ // NVIDIA/Nemotron (or any other) provider and key each time.
1286
+ if (existingGemini || existingProvider === 'ollama') {
1287
+ return { gemini: existingGemini, github: existingGithub, openwikiProvider: existingProvider, openwikiModel: existingModel, openwikiBaseUrl: existingBaseUrl, keyEnvName: existingKeyEnvName };
1288
+ }
1289
+ // Nothing configured yet on this machine: default to NVIDIA NIM /
1290
+ // Nemotron. Google was only ever a placeholder default, never the
1291
+ // intended house default.
1292
+ return { gemini: "", github: existingGithub, openwikiProvider: "nvidia", openwikiModel: "nvidia/llama-3.1-nemotron-70b-instruct", openwikiBaseUrl: "https://integrate.api.nvidia.com/v1", keyEnvName: 'NVIDIA_API_KEY' };
1293
+ }
1257
1294
 
1258
1295
  const hasKeys = Boolean(existingGemini || existingGithub);
1259
1296
 
@@ -1280,7 +1317,7 @@ async function promptCredentials(referenceMcpDir) {
1280
1317
  openwikiProvider: existingProvider,
1281
1318
  openwikiModel: existingModel,
1282
1319
  openwikiBaseUrl: existingBaseUrl,
1283
- keyEnvName: existingProvider === 'google' ? 'GEMINI_API_KEY' : 'OPENWIKI_API_KEY'
1320
+ keyEnvName: existingKeyEnvName
1284
1321
  };
1285
1322
  }
1286
1323
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hybridlabor-api/aos",
3
- "version": "4.4.2-beta.4",
3
+ "version": "4.4.2-beta.5",
4
4
  "description": "AOS — A Curated AI AGENT OS. Optimized agent skills and add-ons like memB, OpenWiki, Heimdall Token Saver, and Godmode architectures.",
5
5
  "main": "installer.js",
6
6
  "bin": {