@openagents-org/agent-launcher 0.2.210 → 0.2.212

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/src/installer.js CHANGED
@@ -920,7 +920,7 @@ class Installer {
920
920
  // ~/.gemini/oauth_creds.json) or a service-account file path, WITHOUT
921
921
  // parsing or logging the token. Additive: agents that don't declare
922
922
  // creds_no_parse / creds_path_env get identical behavior to before.
923
- const credsFile = this._evaluateCredsFile(checkReady, agentType);
923
+ const credsFile = this._evaluateCredsFile(checkReady, agentType, savedEnv);
924
924
  const credsPathReady = this._checkCredsPathEnv(checkReady, savedEnv, agentType);
925
925
 
926
926
  let cliReady = false;
@@ -982,7 +982,7 @@ class Installer {
982
982
  // agent never needs.
983
983
  const credsReady = checkReady.creds_json_has_entries
984
984
  ? false
985
- : this._checkCredsReady(checkReady, agentType);
985
+ : this._checkCredsReady(checkReady, agentType, savedEnv);
986
986
  if (credsReady || credsFile.ready || credsPathReady) {
987
987
  return {
988
988
  ready: true,
@@ -1073,10 +1073,10 @@ class Installer {
1073
1073
  return checkReady.creds_file || null;
1074
1074
  }
1075
1075
 
1076
- _checkCredsReady(checkReady, agentType) {
1076
+ _checkCredsReady(checkReady, agentType, savedEnv = null) {
1077
1077
  if (this._credsFile(checkReady)) {
1078
1078
  try {
1079
- const credsPath = this._expandHome(this._credsFile(checkReady), agentType);
1079
+ const credsPath = this._credsFilePath(checkReady, agentType, savedEnv);
1080
1080
  if (fs.existsSync(credsPath)) {
1081
1081
  const stat = fs.statSync(credsPath);
1082
1082
  if (stat.isDirectory()) return fs.readdirSync(credsPath).length > 0;
@@ -1106,6 +1106,38 @@ class Installer {
1106
1106
  return false;
1107
1107
  }
1108
1108
 
1109
+ /**
1110
+ * Where `creds_file` is for this machine. A CLI that keeps its sign-in in
1111
+ * the XDG data directory (MiMo Code's auth.json) follows XDG_DATA_HOME when
1112
+ * it is set, so `creds_xdg_data_file` names the file under it and
1113
+ * `creds_file` stays the default — which is also all an older core reads.
1114
+ * `creds_home_env` + `creds_home_env_file` name a CLI home variable that
1115
+ * overrides both. The agent's own setting (`savedEnv`, what the CLI is
1116
+ * spawned with) comes before the daemon's. Not for a WSL install: the variable here is this
1117
+ * side's, not the distro's.
1118
+ */
1119
+ _credsFilePath(checkReady, agentType, savedEnv = null) {
1120
+ const fromEnv = (name) => String((savedEnv && savedEnv[name]) || process.env[name] || '').trim();
1121
+ let wsl = null;
1122
+ const isWsl = () => {
1123
+ if (wsl === null) {
1124
+ wsl = false;
1125
+ try { wsl = !!agentType && isWslBinary(this._whichBinary(agentType)); } catch { /* best-effort */ }
1126
+ }
1127
+ return wsl;
1128
+ };
1129
+ // A CLI home named by its own variable comes first (MiMo Code reads
1130
+ // $MIMOCODE_HOME/data/auth.json when MIMOCODE_HOME is set).
1131
+ const homeVar = checkReady.creds_home_env;
1132
+ const homeRel = checkReady.creds_home_env_file;
1133
+ const cliHome = homeVar && homeRel ? fromEnv(homeVar) : '';
1134
+ if (cliHome && path.isAbsolute(cliHome) && !isWsl()) return path.join(cliHome, homeRel);
1135
+ const rel = checkReady.creds_xdg_data_file;
1136
+ const dataHome = fromEnv('XDG_DATA_HOME');
1137
+ if (rel && dataHome && path.isAbsolute(dataHome) && !isWsl()) return path.join(dataHome, rel);
1138
+ return this._expandHome(this._credsFile(checkReady), agentType);
1139
+ }
1140
+
1109
1141
  /**
1110
1142
  * Expand a leading "~" to the home directory the AGENT writes its sign-in to.
1111
1143
  *
@@ -1156,9 +1188,9 @@ class Installer {
1156
1188
  * against the running user's home (the daemon/launcher user), not the
1157
1189
  * renderer/browser user.
1158
1190
  */
1159
- _credsFileState(checkReady, agentType) {
1191
+ _credsFileState(checkReady, agentType, savedEnv = null) {
1160
1192
  if (!this._credsFile(checkReady)) return 'absent';
1161
- const p = this._expandHome(this._credsFile(checkReady), agentType);
1193
+ const p = this._credsFilePath(checkReady, agentType, savedEnv);
1162
1194
  let exists = false;
1163
1195
  try { exists = fs.existsSync(p); } catch { return 'unreadable'; }
1164
1196
  if (!exists) return 'absent';
@@ -1205,11 +1237,11 @@ class Installer {
1205
1237
  * Returns { ready, unreadable }, plus `unknown: true` when the entry's
1206
1238
  * creds_classifier cannot tell from the file.
1207
1239
  */
1208
- _evaluateCredsFile(checkReady, agentType) {
1240
+ _evaluateCredsFile(checkReady, agentType, savedEnv = null) {
1209
1241
  if (!this._credsFile(checkReady) || !checkReady.creds_no_parse) {
1210
1242
  return { ready: false, unreadable: false };
1211
1243
  }
1212
- const state = this._credsFileState(checkReady, agentType);
1244
+ const state = this._credsFileState(checkReady, agentType, savedEnv);
1213
1245
  return {
1214
1246
  ready: state === 'present',
1215
1247
  unreadable: state === 'unreadable',
@@ -1448,7 +1480,7 @@ class Installer {
1448
1480
 
1449
1481
  let bootstrapEnv = this._buildShellEnv();
1450
1482
  let installEnv;
1451
- if (agentType === 'hermes' && process.platform === 'win32') {
1483
+ if (['hermes', 'qoder', 'qoder-cn'].includes(agentType) && process.platform === 'win32') {
1452
1484
  const prepared = this._prepareWindowsPowerShellInstall(cmd, bootstrapEnv);
1453
1485
  cmd = prepared.command;
1454
1486
  bootstrapEnv = prepared.env;
@@ -1547,11 +1579,11 @@ class Installer {
1547
1579
  let env = this._buildShellEnv();
1548
1580
  const isWin = process.platform === 'win32';
1549
1581
 
1550
- // Hermes's registry command names the inbox Windows PowerShell host for
1551
- // compatibility, but some Windows environments expose only PowerShell 7.
1552
- // Resolve the host that actually exists and keep module paths from the
1553
- // launcher's own PowerShell runtime out of both installer processes.
1554
- if (agentType === 'hermes' && isWin) {
1582
+ // Resolve a compatible host and keep inherited PowerShell 7 modules out
1583
+ // of Windows PowerShell. Qoder otherwise cannot load Get-FileHash when
1584
+ // verifying its download, just as Hermes's uv bootstrap could not load
1585
+ // Get-ExecutionPolicy.
1586
+ if (['hermes', 'qoder', 'qoder-cn'].includes(agentType) && isWin) {
1555
1587
  const prepared = this._prepareWindowsPowerShellInstall(rawCmd, env);
1556
1588
  rawCmd = prepared.command;
1557
1589
  env = prepared.env;
@@ -2527,7 +2559,7 @@ class Installer {
2527
2559
  throw new Error('Windows PowerShell or PowerShell 7 is required for this installer.');
2528
2560
  }
2529
2561
  return {
2530
- command: this._retargetPowerShellCommand(command, host),
2562
+ command: this._retargetPowerShellCommand(this._wrapForWindowsShell(command), host),
2531
2563
  env: this._powerShellChildEnv(env),
2532
2564
  host,
2533
2565
  };
@@ -3023,12 +3055,12 @@ class Installer {
3023
3055
  * `Invoke-RestMethod`, etc. The launcher's install shell is cmd.exe, which
3024
3056
  * doesn't recognize these aliases — without wrapping, e.g. Cursor's
3025
3057
  * `irm '…' | iex` exits 255. Skips commands already prefixed with
3026
- * `powershell`/`powershell.exe` so we don't double-wrap.
3058
+ * `powershell`/`pwsh` so we don't double-wrap.
3027
3059
  */
3028
3060
  _wrapForWindowsShell(cmd) {
3029
3061
  if (!cmd || process.platform !== 'win32') return cmd;
3030
3062
  const trimmed = cmd.trimStart();
3031
- if (/^("[^"]*\\)?powershell(\.exe)?["']?\s/i.test(trimmed)) return cmd;
3063
+ if (/^("[^"]*\\)?(powershell|pwsh)(\.exe)?["']?\s/i.test(trimmed)) return cmd;
3032
3064
  const psTokens = /\b(irm|iwr|iex|Invoke-RestMethod|Invoke-WebRequest|Invoke-Expression|Expand-Archive|Get-[A-Z]\w*|Set-[A-Z]\w*)\b/;
3033
3065
  if (!psTokens.test(cmd)) return cmd;
3034
3066
  const escaped = cmd.replace(/"/g, '\\"');
package/src/paths.js CHANGED
@@ -525,6 +525,11 @@ function _addAgentInstallerPaths(dirs) {
525
525
  // keeps off PATH.
526
526
  _push(dirs, path.join(HOME, '.codeartsdoer', 'installers'));
527
527
 
528
+ // mimo — Xiaomi's install.sh / install.ps1 drop the binary into
529
+ // ~/.mimocode/bin (mimo.exe on Windows) and reach PATH through a shell rc
530
+ // edit or the user `Path` value, neither of which a GUI launch sees.
531
+ _push(dirs, path.join(HOME, '.mimocode', 'bin'));
532
+
528
533
  // claude — `claude install` (the native, non-npm build) relocates the CLI to
529
534
  // ~/.claude/local and reaches it through a shell alias, which a GUI process
530
535
  // inherits no more than it inherits an rc-file PATH edit.
@@ -534,6 +539,14 @@ function _addAgentInstallerPaths(dirs) {
534
539
  // _addWindowsPaths; this is the half nothing covered.
535
540
  _push(dirs, path.join(HOME, '.hermes', 'bin'));
536
541
 
542
+ // qoder / qoder-cn — the official install scripts keep the binary in
543
+ // ~/.qoder/bin/qodercli (~/.qoder-cn/bin/qoderclicn). On Windows that dir
544
+ // holds qodercli.exe and reaches PATH only through the user `Path` registry
545
+ // value; on Unix it holds the versioned builds and the CLI is linked from
546
+ // ~/.local/bin, which is searched already.
547
+ _push(dirs, path.join(HOME, '.qoder', 'bin', 'qodercli'));
548
+ _push(dirs, path.join(HOME, '.qoder-cn', 'bin', 'qoderclicn'));
549
+
537
550
  // Installers that let the user choose the install dir. Each of these CLIs
538
551
  // reads an env var for its target, and a user who set one has their ONLY copy
539
552
  // there — every hardcoded default above then finds nothing. Added rather than
@@ -544,6 +557,11 @@ function _addAgentInstallerPaths(dirs) {
544
557
  if (process.env.GOOSE_BIN_DIR) _push(dirs, process.env.GOOSE_BIN_DIR);
545
558
  if (process.env.HERMES_INSTALL_DIR) _push(dirs, process.env.HERMES_INSTALL_DIR);
546
559
  if (process.env.HERMES_HOME) _push(dirs, path.join(process.env.HERMES_HOME, 'bin'));
560
+ // mimo — install.ps1 installs into MIMOCODE_INSTALL_DIR when it is set.
561
+ if (process.env.MIMOCODE_INSTALL_DIR) _push(dirs, process.env.MIMOCODE_INSTALL_DIR);
562
+ // qwen — install-qwen-standalone.sh / .ps1 read these for a custom target.
563
+ if (process.env.QWEN_INSTALL_BIN_DIR) _push(dirs, process.env.QWEN_INSTALL_BIN_DIR);
564
+ if (process.env.QWEN_INSTALL_ROOT) _push(dirs, path.join(process.env.QWEN_INSTALL_ROOT, 'bin'));
547
565
 
548
566
  // uv — `uv tool install X` builds a venv at <uv tool dir>/X and only COPIES
549
567
  // the executable into uv's bin dir, which reaches PATH through a shell rc
@@ -587,6 +605,9 @@ function _addAgentInstallerPaths(dirs) {
587
605
  _push(dirs, path.join(lad, 'Programs', 'cursor-agent'));
588
606
  // codebuddy's native Windows install.
589
607
  _push(dirs, path.join(lad, 'CodeBuddy', 'bin'));
608
+ // qwen — install-qwen-standalone.ps1 puts its qwen.cmd wrapper here and
609
+ // edits the user Path; on Unix the same installer uses ~/.local/bin.
610
+ _push(dirs, path.join(lad, 'qwen-code', 'bin'));
590
611
  // winget's shim dir — how GitHub Copilot CLI arrives on Windows for anyone
591
612
  // who didn't take the npm route. The copilot adapter knew it; nothing else did.
592
613
  _push(dirs, path.join(lad, 'Microsoft', 'WinGet', 'Links'));
package/src/probe.js CHANGED
@@ -587,7 +587,50 @@ async function probeAgentType(connector, type, opts = {}) {
587
587
 
588
588
  // ── Live tier 2: direct LLM API call for API-key agents (e.g. OpenClaw) ──
589
589
  if (canCallDirect || (entry.install && entry.install.api_only && reachable)) {
590
- const res = await callLLM(agentEnv, model, baseUrl, protocol);
590
+ let apiEnv = agentEnv;
591
+ let apiModel = model;
592
+ let apiBaseUrl = baseUrl;
593
+ if (type === 'mimo-code' && agentEnv.LLM_API_KEY) {
594
+ // The runtime owns MiMo's defaults and provider/model normalization.
595
+ // Generic API defaults would send a MiMo key/model to OpenAI instead.
596
+ const { resolveMimoRoute, parseMimoModelList, pickMimoModel } = require('./adapters/mimo-code-runtime');
597
+ let route = resolveMimoRoute(agentEnv);
598
+ if (!route.model && route.providerId === 'xiaomi' && health.binary) {
599
+ const listEnv = { ...env };
600
+ delete listEnv.LLM_API_KEY;
601
+ delete listEnv.XIAOMI_API_KEY;
602
+ const shell = shouldUseShellForBinary(health.binary);
603
+ const command = shell ? '"' + health.binary + '"' : health.binary;
604
+ const listed = await runCommand(command, ['models', 'xiaomi'], {
605
+ env: {
606
+ ...listEnv,
607
+ MIMOCODE_AUTH_CONTENT: '{}',
608
+ MIMOCODE_CONFIG_CONTENT: JSON.stringify({ enabled_providers: ['xiaomi'], disabled_providers: [] }),
609
+ MIMOCODE_DISABLE_AUTOUPDATE: '1',
610
+ },
611
+ timeoutMs,
612
+ shell,
613
+ });
614
+ if (!listed.timedOut && !listed.spawnError && listed.code === 0) {
615
+ route = resolveMimoRoute(agentEnv, null, {
616
+ fallbackModel: pickMimoModel(parseMimoModelList(listed.stdout)),
617
+ });
618
+ }
619
+ }
620
+ if (!route.model) {
621
+ return done({
622
+ ok: false, method: 'none', code: CODE.BAD_MODEL,
623
+ message: 'No model is configured and no default model could be resolved. Select a model and test again.',
624
+ guidance: buildGuidance(CODE.BAD_MODEL, entry, agentEnv),
625
+ });
626
+ }
627
+ // Match the runtime's credential choice, even if unrelated provider
628
+ // variables were saved alongside this agent's LLM_* configuration.
629
+ apiEnv = { LLM_API_KEY: route.apiKey, LLM_BASE_URL: route.baseURL, LLM_MODEL: route.model };
630
+ apiModel = route.model;
631
+ apiBaseUrl = route.baseURL;
632
+ }
633
+ const res = await callLLM(apiEnv, apiModel, apiBaseUrl, protocol);
591
634
  if (res && res.success) {
592
635
  return done({
593
636
  ok: true, method: 'llm_api', code: CODE.OK,
@@ -627,11 +627,12 @@ class WorkspaceClient {
627
627
  * Skill Hub UI can render installing / installed / failed states. Best
628
628
  * effort — returns the updated payload or throws (caller decides).
629
629
  */
630
- async reportSkillStatus(workspaceId, agentName, token, { skillId, state, path: installPath, error, partial } = {}) {
630
+ async reportSkillStatus(workspaceId, agentName, token, { skillId, state, path: installPath, error, partial, versionId } = {}) {
631
631
  const body = { skill_id: skillId, state };
632
632
  if (installPath) body.path = installPath;
633
633
  if (error) body.error = String(error).slice(0, 2000);
634
634
  if (partial) body.partial = true;
635
+ if (versionId) body.version_id = versionId;
635
636
  const data = await this._post(
636
637
  `/v1/workspaces/${workspaceId}/members/${encodeURIComponent(agentName)}/skills/status`,
637
638
  body,
@@ -815,6 +816,16 @@ class WorkspaceClient {
815
816
  return this._getRaw(`/v1/files/${fileId}?${params}`, this._wsHeaders(token), 60000);
816
817
  }
817
818
 
819
+ /** Download an immutable public registry version. */
820
+ async readRegistryVersion(versionId, token) {
821
+ if (!versionId) throw new Error('registry version id is required');
822
+ return this._getRaw(
823
+ `/v1/registry/versions/${encodeURIComponent(versionId)}/download`,
824
+ this._wsHeaders(token),
825
+ 60000,
826
+ );
827
+ }
828
+
818
829
  /**
819
830
  * Delete a file via DELETE /v1/files/{fileId}.
820
831
  */