@phnx-labs/agents-cli 1.20.14 → 1.20.16

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 (41) hide show
  1. package/CHANGELOG.md +5 -0
  2. package/dist/commands/repo.js +22 -1
  3. package/dist/commands/secrets.js +53 -1
  4. package/dist/commands/sessions-sync.d.ts +13 -0
  5. package/dist/commands/sessions-sync.js +73 -0
  6. package/dist/commands/sessions.js +2 -0
  7. package/dist/commands/view.js +11 -3
  8. package/dist/index.js +1 -1
  9. package/dist/lib/agents.d.ts +11 -0
  10. package/dist/lib/agents.js +11 -9
  11. package/dist/lib/browser/service.js +28 -18
  12. package/dist/lib/daemon.d.ts +19 -0
  13. package/dist/lib/daemon.js +97 -2
  14. package/dist/lib/migrate.d.ts +22 -0
  15. package/dist/lib/migrate.js +99 -1
  16. package/dist/lib/plugin-marketplace.d.ts +15 -0
  17. package/dist/lib/plugin-marketplace.js +44 -0
  18. package/dist/lib/secrets/index.js +20 -0
  19. package/dist/lib/session/parse.d.ts +2 -0
  20. package/dist/lib/session/parse.js +168 -2
  21. package/dist/lib/session/sync/agents.d.ts +46 -0
  22. package/dist/lib/session/sync/agents.js +94 -0
  23. package/dist/lib/session/sync/config.d.ts +30 -0
  24. package/dist/lib/session/sync/config.js +58 -0
  25. package/dist/lib/session/sync/crdt.d.ts +44 -0
  26. package/dist/lib/session/sync/crdt.js +119 -0
  27. package/dist/lib/session/sync/manifest.d.ts +51 -0
  28. package/dist/lib/session/sync/manifest.js +96 -0
  29. package/dist/lib/session/sync/r2.d.ts +32 -0
  30. package/dist/lib/session/sync/r2.js +121 -0
  31. package/dist/lib/session/sync/sync.d.ts +82 -0
  32. package/dist/lib/session/sync/sync.js +251 -0
  33. package/dist/lib/shims.d.ts +1 -1
  34. package/dist/lib/shims.js +29 -3
  35. package/dist/lib/state.d.ts +18 -0
  36. package/dist/lib/state.js +73 -0
  37. package/dist/lib/teams/parsers.js +159 -1
  38. package/dist/lib/usage.d.ts +18 -0
  39. package/dist/lib/usage.js +25 -0
  40. package/dist/lib/versions.js +30 -13
  41. package/package.json +2 -1
@@ -25,7 +25,7 @@ import { checkbox, select } from '@inquirer/prompts';
25
25
  import { getVersionsDir, ensureAgentsDir, readMeta, writeMeta, getCommandsDir, getSkillsDir, getHooksDir, getResolvedRulesDir, getUserRulesDir, getVersionResources, ensureVersionResourcePatterns, getProjectAgentsDir, getPromptcutsPath, getUserPromptcutsPath, getEnabledExtraRepos, getAgentsDir, getUserAgentsDir, getTrashVersionsDir, getActiveRulesPreset } from './state.js';
26
26
  import { defaultPatterns, expandPatterns } from './resource-patterns.js';
27
27
  import { listResources } from './resources.js';
28
- import { AGENTS, agentConfigDirName, getAccountEmail, resolveAgentName, formatAgentError } from './agents.js';
28
+ import { AGENTS, agentConfigDirName, getAccountEmail, resolveAgentName, formatAgentError, findInPath } from './agents.js';
29
29
  import { discoverPermissionGroups, getActivePermissionPresetName, readPermissionPresetRecipe, PERMISSION_PRESET_ENV_VAR } from './permissions.js';
30
30
  import { parseMcpServerConfig } from './mcp.js';
31
31
  import { createVersionedAlias, removeVersionedAlias, getConfigSymlinkVersion, ensureClaudeInsideSymlink } from './shims.js';
@@ -818,6 +818,14 @@ export function getBinaryPath(agent, version) {
818
818
  catch { }
819
819
  return path.join(grokDownloads, `grok-${version}`);
820
820
  }
821
+ if (agent === 'droid') {
822
+ // Factory's installer drops a standalone native binary at ~/.local/bin/droid
823
+ // (no npm package, nothing in node_modules/.bin). The binary is global, not
824
+ // per-version — config isolation rides the ~/.factory symlink switch, not a
825
+ // separate binary per version. Mirror the shim's `droid` branch so
826
+ // isVersionInstalled/`agents view` agree with what actually executes.
827
+ return path.join(os.homedir(), '.local', 'bin', 'droid');
828
+ }
821
829
  const versionDir = getVersionDir(agent, version);
822
830
  return path.join(versionDir, 'node_modules', '.bin', agentConfig.cliCommand);
823
831
  }
@@ -1005,19 +1013,28 @@ export async function installVersion(agent, version, onProgress) {
1005
1013
  // but `agents view` shows the agent under "Not Managed" because
1006
1014
  // listInstalledVersions returns [] — the installer drops the binary in
1007
1015
  // ~/.local/bin (or similar) rather than the version's node_modules/.bin.
1008
- // Grok is special-cased in getBinaryPath itself (binary lives in
1009
- // ~/.grok/downloads), so we skip the symlink there.
1010
- if (agent !== 'grok') {
1011
- try {
1012
- const { stdout: whichOut } = await execFileAsync(process.platform === 'win32' ? 'where' : 'which', [agentConfig.cliCommand]);
1013
- const installedBinary = whichOut.trim().split('\n')[0];
1014
- if (installedBinary && fs.existsSync(installedBinary)) {
1015
- importInstallScriptBinary({ agentId: agent, npmPackage: agentConfig.npmPackage, cliCommand: agentConfig.cliCommand }, installedVersion, installedBinary, versionDir);
1016
- }
1017
- }
1018
- catch {
1019
- /* binary missing from PATH install script failed silently; surface via the existing version.install error path below isn't possible here since the script returned 0. Leave the version dir empty so getBinaryPath check correctly reports it uninstalled. */
1016
+ //
1017
+ // Agents whose binary is special-cased in getBinaryPath (grok ->
1018
+ // ~/.grok/downloads, droid -> ~/.local/bin/droid) need no symlink — and
1019
+ // creating one is actively harmful: `which <cli>` can resolve to OUR OWN
1020
+ // dispatcher shim, because ~/.agents/.cache/shims sits ahead of ~/.local/bin
1021
+ // on PATH. Symlinking node_modules/.bin/<cli> at the shim makes the shim
1022
+ // exec itself forever. So we skip the resolver-backed agents here AND, for
1023
+ // everyone else, filter the shims dir out of the `which` candidates so the
1024
+ // same race can't bite a non-special-cased installScript agent.
1025
+ if (agent !== 'grok' && agent !== 'droid') {
1026
+ // findInPath is a pure-Node PATH scan that already skips our own shims
1027
+ // dirso it returns the genuine install, never our dispatcher shim
1028
+ // (which sits ahead of ~/.local/bin on PATH and would otherwise be
1029
+ // captured, producing a self-referential node_modules/.bin/<cli> link
1030
+ // that exec-loops forever).
1031
+ const installedBinary = findInPath(agentConfig.cliCommand);
1032
+ if (installedBinary) {
1033
+ importInstallScriptBinary({ agentId: agent, npmPackage: agentConfig.npmPackage, cliCommand: agentConfig.cliCommand }, installedVersion, installedBinary, versionDir);
1020
1034
  }
1035
+ /* If null: binary missing from PATH (install script failed silently) or
1036
+ only our shim is present. Leave the version dir empty so getBinaryPath
1037
+ correctly reports it uninstalled. */
1021
1038
  }
1022
1039
  createVersionedAlias(agent, installedVersion);
1023
1040
  emit('version.install', { agent, version: installedVersion });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@phnx-labs/agents-cli",
3
- "version": "1.20.14",
3
+ "version": "1.20.16",
4
4
  "description": "One CLI for all your AI coding agents - versions, config, cloud dispatch, sessions, and teams (now with first-class Grok Build CLI support)",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -82,6 +82,7 @@
82
82
  "@types/proper-lockfile": "4.1.4",
83
83
  "@xterm/headless": "6.0.0",
84
84
  "@zed-industries/agent-client-protocol": "0.4.5",
85
+ "aws4fetch": "1.0.20",
85
86
  "chalk": "5.6.2",
86
87
  "commander": "15.0.0",
87
88
  "croner": "10.0.1",