@openagents-org/agent-launcher 0.2.218 → 0.2.219

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": "@openagents-org/agent-launcher",
3
- "version": "0.2.218",
3
+ "version": "0.2.219",
4
4
  "description": "OpenAgents Launcher — install, configure, and run AI coding agents from your terminal",
5
5
  "main": "src/index.js",
6
6
  "bin": {
package/registry.json CHANGED
@@ -833,7 +833,13 @@
833
833
  "saved_env_key": "COPILOT_GITHUB_TOKEN",
834
834
  "login_command": "copilot",
835
835
  "unverifiable": true,
836
- "not_ready_message": "Sign-in not confirmed. A token env var (COPILOT_GITHUB_TOKEN/GH_TOKEN/GITHUB_TOKEN) is one option; you may already be signed in via `copilot` /login or `gh auth`. Auth is confirmed when you run a task."
836
+ "creds_file": "~/.copilot/config.json",
837
+ "creds_no_parse": true,
838
+ "creds_classifier": "copilot_logged_in_users",
839
+ "creds_key": "loggedInUsers",
840
+ "not_ready_message": "Sign-in not confirmed. A token env var (COPILOT_GITHUB_TOKEN/GH_TOKEN/GITHUB_TOKEN) is one option; you may already be signed in via `copilot` /login or `gh auth`. Auth is confirmed when you run a task.",
841
+ "unknown_message": "Sign-in not confirmed. A token env var (COPILOT_GITHUB_TOKEN/GH_TOKEN/GITHUB_TOKEN) is one option; you may already be signed in via `copilot` /login or `gh auth`. Auth is confirmed when you run a task.",
842
+ "unreadable_message": "Sign-in not confirmed. A token env var (COPILOT_GITHUB_TOKEN/GH_TOKEN/GITHUB_TOKEN) is one option; you may already be signed in via `copilot` /login or `gh auth`. Auth is confirmed when you run a task."
837
843
  },
838
844
  "env_config": [
839
845
  {
@@ -1388,10 +1394,14 @@
1388
1394
  "GEMINI_API_KEY"
1389
1395
  ],
1390
1396
  "credential_target": "gemini:antigravity",
1397
+ "keychain_item": {
1398
+ "service": "gemini",
1399
+ "account": "antigravity"
1400
+ },
1391
1401
  "unverifiable": true,
1392
1402
  "saved_env_key": "GEMINI_API_KEY",
1393
1403
  "login_command": "agy",
1394
- "not_ready_message": "Sign-in not confirmed. Run `agy` in a terminal to sign in with Google, or set GEMINI_API_KEY. On Windows the sign-in is detected once it lands in Credential Manager; elsewhere agy keeps it out of reach, so it is confirmed when you run a task.",
1404
+ "not_ready_message": "Sign-in not confirmed. Run `agy` in a terminal to sign in with Google, or set GEMINI_API_KEY. The sign-in is detected once it lands in the macOS Keychain or Windows Credential Manager; on Linux it is confirmed when you run a task.",
1395
1405
  "auth_detected_labels": {
1396
1406
  "cli_login": "Google account sign-in detected",
1397
1407
  "api_key": "API key detected"
@@ -83,8 +83,12 @@ const DSH_BUILTIN_MODELS = ['deepseek-flash', 'deepseek-v4-pro'];
83
83
  /** The pi-ai route an OpenAI-compatible gateway is served through. */
84
84
  const GATEWAY_PROVIDER = 'openai-gateway';
85
85
 
86
- /** The model a gateway route runs when none is configured. */
87
- const DEFAULT_GATEWAY_MODEL = 'deepseek-v4-flash';
86
+ /**
87
+ * The model a gateway route runs when none is configured: the one the
88
+ * OpenAgents gateway serves. It has since narrowed to this single id and
89
+ * refuses `deepseek-v4-flash` with "This gateway only allows: …".
90
+ */
91
+ const DEFAULT_GATEWAY_MODEL = 'deepseek-v4.1-flash';
88
92
 
89
93
  /** Where DeepSeek's own model list is read (its OpenAI-style root). */
90
94
  const DEEPSEEK_MODELS_BASE = 'https://api.deepseek.com/v1';
package/src/installer.js CHANGED
@@ -71,8 +71,44 @@ const CREDS_CLASSIFIERS = {
71
71
  cline_providers(creds) {
72
72
  return classifyClineAuth(creds, {}).state;
73
73
  },
74
+ // ~/.copilot/config.json lists the GitHub accounts `copilot` /login signed
75
+ // in. An empty list (or no file) is not "signed out": a GH_TOKEN or a gh
76
+ // sign-in works without it, so that stays for the run to decide.
77
+ copilot_logged_in_users(creds) {
78
+ const users = creds && creds.loggedInUsers;
79
+ return Array.isArray(users) && users.length > 0 ? 'ready' : 'unknown';
80
+ },
74
81
  };
75
82
 
83
+ /**
84
+ * JSON that may carry `//` and `/* *\/` comments (JSONC). Copilot writes its
85
+ * config.json with a two-line `//` header, so a strict parse read a signed-in
86
+ * user's file as unparseable. Comments are removed outside strings only.
87
+ */
88
+ function parseJsonLoose(raw) {
89
+ const text = String(raw);
90
+ try { return JSON.parse(text); } catch { /* fall through to JSONC */ }
91
+ let out = '';
92
+ for (let i = 0; i < text.length; i++) {
93
+ const c = text[i];
94
+ if (c === '"') {
95
+ let j = i + 1;
96
+ while (j < text.length && text[j] !== '"') j += text[j] === '\\' ? 2 : 1;
97
+ out += text.slice(i, j + 1);
98
+ i = j;
99
+ } else if (c === '/' && text[i + 1] === '/') {
100
+ while (i < text.length && text[i] !== '\n') i++;
101
+ out += '\n';
102
+ } else if (c === '/' && text[i + 1] === '*') {
103
+ const end = text.indexOf('*/', i + 2);
104
+ i = end === -1 ? text.length : end + 1;
105
+ } else {
106
+ out += c;
107
+ }
108
+ }
109
+ return JSON.parse(out);
110
+ }
111
+
76
112
  /** The named classifier's verdict, or null when the entry names none. */
77
113
  function classifyCreds(checkReady, creds) {
78
114
  const classify = checkReady && CREDS_CLASSIFIERS[checkReady.creds_classifier];
@@ -1080,7 +1116,7 @@ class Installer {
1080
1116
  if (fs.existsSync(credsPath)) {
1081
1117
  const stat = fs.statSync(credsPath);
1082
1118
  if (stat.isDirectory()) return fs.readdirSync(credsPath).length > 0;
1083
- const creds = JSON.parse(fs.readFileSync(credsPath, 'utf-8'));
1119
+ const creds = parseJsonLoose(fs.readFileSync(credsPath, 'utf-8'));
1084
1120
  const verdict = classifyCreds(checkReady, creds);
1085
1121
  if (verdict) return verdict === 'ready';
1086
1122
  if (checkReady.creds_key) return !!creds[checkReady.creds_key];
@@ -1097,6 +1133,18 @@ class Installer {
1097
1133
  }
1098
1134
  }
1099
1135
 
1136
+ // An item named by service AND account. A separate field from
1137
+ // keychain_service so an older core, which would match on the service
1138
+ // alone, skips it rather than reading someone else's item as a sign-in.
1139
+ // agy keeps its Google sign-in as service `gemini`, account `antigravity`:
1140
+ // the same pair it stores on Windows as the target `gemini:antigravity`.
1141
+ const item = checkReady.keychain_item;
1142
+ if (item && item.service && item.account && process.platform === 'darwin') {
1143
+ if (this._checkMacKeychain(item.service, item.account)) {
1144
+ return true;
1145
+ }
1146
+ }
1147
+
1100
1148
  if (checkReady.credential_target && process.platform === 'win32') {
1101
1149
  if (this._checkWindowsCredential(checkReady.credential_target)) {
1102
1150
  return true;
@@ -1201,7 +1249,7 @@ class Installer {
1201
1249
  if (checkReady.creds_classifier) {
1202
1250
  const raw = fs.readFileSync(p, 'utf-8');
1203
1251
  let parsed;
1204
- try { parsed = JSON.parse(raw); } catch { parsed = { __parse_error: true }; }
1252
+ try { parsed = parseJsonLoose(raw); } catch { parsed = { __parse_error: true }; }
1205
1253
  const verdict = classifyCreds(checkReady, parsed);
1206
1254
  if (verdict) return verdict === 'ready' ? 'present' : verdict === 'unknown' ? 'unknown' : 'absent';
1207
1255
  }
@@ -1285,11 +1333,12 @@ class Installer {
1285
1333
  *
1286
1334
  * Cached like _checkWindowsCredential, and never waited on in Electron main.
1287
1335
  */
1288
- _checkMacKeychain(service) {
1336
+ _checkMacKeychain(service, account = null) {
1289
1337
  if (!service) return false;
1290
- const cached = keychainItemCache.get(service);
1338
+ const cacheKey = account ? `${service}\u0000${account}` : service;
1339
+ const cached = keychainItemCache.get(cacheKey);
1291
1340
  const fresh = cached && (Date.now() - cached.ts) < STATUS_CACHE_TTL_MS;
1292
- const args = ['find-generic-password', '-s', service];
1341
+ const args = ['find-generic-password', '-s', service, ...(account ? ['-a', account] : [])];
1293
1342
  if (!fresh && canBlock()) {
1294
1343
  let found = false;
1295
1344
  try {
@@ -1299,20 +1348,20 @@ class Installer {
1299
1348
  });
1300
1349
  found = !run.error && run.status === 0;
1301
1350
  } catch {}
1302
- keychainItemCache.set(service, { found, ts: Date.now() });
1303
- } else if (!fresh && !keychainRefreshing.has(service)) {
1351
+ keychainItemCache.set(cacheKey, { found, ts: Date.now() });
1352
+ } else if (!fresh && !keychainRefreshing.has(cacheKey)) {
1304
1353
  // Answer from the last lookup now; the refresh lands for the next call.
1305
- keychainRefreshing.add(service);
1354
+ keychainRefreshing.add(cacheKey);
1306
1355
  try {
1307
1356
  execFile('security', args, { timeout: 5000 }, (err) => {
1308
- keychainRefreshing.delete(service);
1309
- keychainItemCache.set(service, { found: !err, ts: Date.now() });
1357
+ keychainRefreshing.delete(cacheKey);
1358
+ keychainItemCache.set(cacheKey, { found: !err, ts: Date.now() });
1310
1359
  });
1311
1360
  } catch {
1312
- keychainRefreshing.delete(service);
1361
+ keychainRefreshing.delete(cacheKey);
1313
1362
  }
1314
1363
  }
1315
- return !!(keychainItemCache.get(service) || {}).found;
1364
+ return !!(keychainItemCache.get(cacheKey) || {}).found;
1316
1365
  }
1317
1366
 
1318
1367
  /**
@@ -3119,4 +3168,4 @@ function escapeRegExp(text) {
3119
3168
  return String(text).replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
3120
3169
  }
3121
3170
 
3122
- module.exports = { Installer, compareVersions, clearVersionCache, loginVerdict, credentialListHasTarget };
3171
+ module.exports = { Installer, compareVersions, clearVersionCache, loginVerdict, credentialListHasTarget, parseJsonLoose };
package/src/probe.js CHANGED
@@ -142,7 +142,12 @@ function classifyOutputText(text) {
142
142
  // was unreachable; a Codex that could not reach chatgpt.com ran out the
143
143
  // probe clock and was reported as waiting for interactive input. "Request
144
144
  // to <host> timed out" is the direct API test's own deadline (utils.js).
145
- if (/enotfound|econnrefused|econnreset|etimedout|eai_again|fetch failed|socket hang up|network error|error sending request|request to \S+ timed out|self[- ]signed certificate|unable to get local issuer/.test(text)) return CODE.NETWORK;
145
+ // Codex (Rust) also says "Connection failed", "stream disconnected before
146
+ // completion" or, refreshing its model list, "failed to refresh available
147
+ // models: request timed out" — on a device that cannot reach chatgpt.com
148
+ // that was all the probe saw before its clock ran out, and it was reported
149
+ // as a CLI waiting for a login prompt.
150
+ if (/enotfound|econnrefused|econnreset|etimedout|eai_again|fetch failed|socket hang up|network error|error sending request|request to \S+ timed out|self[- ]signed certificate|unable to get local issuer|connection failed|stream disconnected before completion|failed to lookup address|dns error|tls handshake|failed to refresh available models: request timed out/.test(text)) return CODE.NETWORK;
146
151
  if (/api key.{0,24}(not set|not found|missing)|no api key|missing api key|environment variable.{0,40}(is )?(not set|required)/.test(text)) return CODE.MISSING_API_KEY;
147
152
  if (/invalid.{0,12}(api.?key|x-api-key|token)|incorrect api key|authentication[_ ]?error|invalid credentials|\b401\b|unauthorized|forbidden|\b403\b/.test(text)) return CODE.INVALID_API_KEY;
148
153
  // A sign-in that exists but has run out — Claude Code: "Failed to
@@ -390,8 +395,24 @@ function failureMessage(res, code, timeoutMs) {
390
395
  // Each line is scrubbed before that test: a provider that echoes the whole
391
396
  // key (`401 Incorrect API key provided: sk-proj-…`) had the one line that
392
397
  // explains the failure dropped as encoded.
393
- const lines = (s) => String(s || '').split(/\r?\n/).map((l) => scrub(l.trim()))
394
- .filter((l) => l && !BENIGN_OUTPUT.test(l) && !mostlyEncoded(l) && !/^at\s+\S/.test(l));
398
+ //
399
+ // A CLI's own log records (`2026-11-08T05:37:58Z ERROR module: …`) are kept,
400
+ // shorn of the timestamp, but rank after what it said in plain words. Codex's
401
+ // built-in ChatGPT connector (`rmcp::…`) is left out altogether: its lines
402
+ // are about that side service, and they were quoted as the reason a Codex
403
+ // probe failed in place of the model-list error underneath them. Only when
404
+ // nothing else was said do they stand, rather than no reason at all.
405
+ const LOG_RECORD = /^\d{4}-\d{2}-\d{2}T[\d:.]+Z?\s+(?=(TRACE|DEBUG|INFO|WARN|ERROR)\s)/;
406
+ const SIDE_SERVICE = /\brmcp::|\bcodex_mcp::/;
407
+ const lines = (s) => {
408
+ const said = String(s || '').split(/\r?\n/).map((l) => scrub(l.trim()))
409
+ .filter((l) => l && !BENIGN_OUTPUT.test(l) && !mostlyEncoded(l) && !/^at\s+\S/.test(l));
410
+ const own = said.filter((l) => !SIDE_SERVICE.test(l));
411
+ const kept = own.length ? own : said;
412
+ const plain = kept.filter((l) => !LOG_RECORD.test(l));
413
+ const logged = kept.filter((l) => LOG_RECORD.test(l)).map((l) => l.replace(LOG_RECORD, ''));
414
+ return [...plain, ...logged];
415
+ };
395
416
  const all = [...lines(res.stderr), ...lines(res.stdout)];
396
417
  const telling = all.find((l) => classifyOutputText(l.toLowerCase()) === code);
397
418
  const detail = tail(telling || lines(res.stderr).join('\n') || lines(res.stdout).join('\n'), OUTPUT_CAP);