@phnx-labs/agents-cli 1.20.4 → 1.20.6

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 (207) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/README.md +49 -18
  3. package/dist/commands/browser.js +31 -4
  4. package/dist/commands/cli.js +1 -1
  5. package/dist/commands/cloud.js +1 -1
  6. package/dist/commands/commands.js +2 -0
  7. package/dist/commands/computer.js +10 -2
  8. package/dist/commands/defaults.d.ts +7 -0
  9. package/dist/commands/defaults.js +89 -0
  10. package/dist/commands/doctor.js +1 -1
  11. package/dist/commands/exec.js +73 -19
  12. package/dist/commands/hooks.js +6 -6
  13. package/dist/commands/inspect.d.ts +26 -0
  14. package/dist/commands/inspect.js +590 -0
  15. package/dist/commands/mcp.js +17 -16
  16. package/dist/commands/models.js +1 -1
  17. package/dist/commands/packages.js +6 -4
  18. package/dist/commands/permissions.js +13 -12
  19. package/dist/commands/plugins.d.ts +13 -0
  20. package/dist/commands/plugins.js +100 -11
  21. package/dist/commands/prune.js +3 -2
  22. package/dist/commands/pull.d.ts +12 -5
  23. package/dist/commands/pull.js +26 -422
  24. package/dist/commands/push.d.ts +14 -0
  25. package/dist/commands/push.js +30 -0
  26. package/dist/commands/repo.d.ts +1 -1
  27. package/dist/commands/repo.js +155 -112
  28. package/dist/commands/resource-view.d.ts +2 -0
  29. package/dist/commands/resource-view.js +12 -3
  30. package/dist/commands/routines.js +32 -7
  31. package/dist/commands/rules.js +4 -4
  32. package/dist/commands/secrets.js +46 -9
  33. package/dist/commands/sessions.js +1 -0
  34. package/dist/commands/setup.d.ts +3 -3
  35. package/dist/commands/setup.js +17 -17
  36. package/dist/commands/skills.js +6 -5
  37. package/dist/commands/subagents.js +5 -4
  38. package/dist/commands/sync.d.ts +18 -5
  39. package/dist/commands/sync.js +251 -65
  40. package/dist/commands/teams.js +109 -11
  41. package/dist/commands/tmux.d.ts +25 -0
  42. package/dist/commands/tmux.js +415 -0
  43. package/dist/commands/trash.d.ts +2 -2
  44. package/dist/commands/trash.js +1 -1
  45. package/dist/commands/versions.js +2 -2
  46. package/dist/commands/view.d.ts +12 -1
  47. package/dist/commands/view.js +128 -40
  48. package/dist/commands/workflows.js +4 -3
  49. package/dist/commands/worktree.d.ts +4 -5
  50. package/dist/commands/worktree.js +4 -4
  51. package/dist/index.js +106 -41
  52. package/dist/lib/agents.d.ts +23 -10
  53. package/dist/lib/agents.js +88 -25
  54. package/dist/lib/auto-pull-worker.d.ts +1 -1
  55. package/dist/lib/auto-pull-worker.js +2 -2
  56. package/dist/lib/auto-pull.d.ts +1 -1
  57. package/dist/lib/auto-pull.js +1 -1
  58. package/dist/lib/beta.d.ts +1 -1
  59. package/dist/lib/beta.js +1 -1
  60. package/dist/lib/browser/chrome.d.ts +10 -0
  61. package/dist/lib/browser/chrome.js +84 -3
  62. package/dist/lib/capabilities.js +2 -0
  63. package/dist/lib/commands.d.ts +28 -1
  64. package/dist/lib/commands.js +125 -20
  65. package/dist/lib/doctor-diff.js +2 -2
  66. package/dist/lib/exec.d.ts +14 -0
  67. package/dist/lib/exec.js +59 -5
  68. package/dist/lib/fuzzy.d.ts +12 -2
  69. package/dist/lib/fuzzy.js +29 -4
  70. package/dist/lib/git.js +8 -1
  71. package/dist/lib/hooks.d.ts +2 -2
  72. package/dist/lib/hooks.js +97 -10
  73. package/dist/lib/mcp.js +32 -2
  74. package/dist/lib/migrate.d.ts +51 -0
  75. package/dist/lib/migrate.js +233 -5
  76. package/dist/lib/models.js +62 -15
  77. package/dist/lib/permissions.d.ts +59 -2
  78. package/dist/lib/permissions.js +299 -7
  79. package/dist/lib/plugin-marketplace.d.ts +98 -40
  80. package/dist/lib/plugin-marketplace.js +196 -93
  81. package/dist/lib/plugins.d.ts +21 -4
  82. package/dist/lib/plugins.js +130 -49
  83. package/dist/lib/profiles-presets.js +12 -12
  84. package/dist/lib/project-launch.d.ts +70 -0
  85. package/dist/lib/project-launch.js +404 -0
  86. package/dist/lib/pty-client.js +1 -1
  87. package/dist/lib/pty-server.d.ts +1 -1
  88. package/dist/lib/pty-server.js +8 -5
  89. package/dist/lib/refresh.d.ts +26 -0
  90. package/dist/lib/refresh.js +315 -0
  91. package/dist/lib/resource-patterns.d.ts +1 -1
  92. package/dist/lib/resource-patterns.js +1 -1
  93. package/dist/lib/resources/commands.js +2 -2
  94. package/dist/lib/resources/hooks.d.ts +1 -1
  95. package/dist/lib/resources/hooks.js +1 -1
  96. package/dist/lib/resources/mcp.d.ts +1 -1
  97. package/dist/lib/resources/mcp.js +5 -6
  98. package/dist/lib/resources/permissions.js +5 -2
  99. package/dist/lib/resources/rules.js +3 -2
  100. package/dist/lib/resources/skills.js +3 -2
  101. package/dist/lib/resources/types.d.ts +1 -1
  102. package/dist/lib/resources.d.ts +2 -0
  103. package/dist/lib/resources.js +4 -3
  104. package/dist/lib/rotate.d.ts +1 -1
  105. package/dist/lib/rotate.js +7 -19
  106. package/dist/lib/routines.d.ts +16 -4
  107. package/dist/lib/routines.js +67 -17
  108. package/dist/lib/rules/compile.js +22 -10
  109. package/dist/lib/rules/rules.js +3 -3
  110. package/dist/lib/run-config.d.ts +9 -0
  111. package/dist/lib/run-config.js +35 -0
  112. package/dist/lib/run-defaults.d.ts +42 -0
  113. package/dist/lib/run-defaults.js +180 -0
  114. package/dist/lib/runner.js +16 -3
  115. package/dist/lib/scheduler.js +15 -1
  116. package/dist/lib/secrets/Agents CLI.app/Contents/CodeResources +0 -0
  117. package/dist/lib/secrets/Agents CLI.app/Contents/MacOS/Agents CLI +0 -0
  118. package/dist/lib/secrets/Agents CLI.app/Contents/_CodeSignature/CodeResources +9 -1
  119. package/dist/lib/secrets/Agents CLI.app/Contents/embedded.provisionprofile +0 -0
  120. package/dist/lib/secrets/install-helper.d.ts +11 -3
  121. package/dist/lib/secrets/install-helper.js +48 -6
  122. package/dist/lib/secrets/linux.d.ts +56 -9
  123. package/dist/lib/secrets/linux.js +327 -59
  124. package/dist/lib/session/db.js +15 -2
  125. package/dist/lib/session/discover.js +118 -3
  126. package/dist/lib/session/parse.js +3 -0
  127. package/dist/lib/session/types.d.ts +1 -1
  128. package/dist/lib/session/types.js +1 -1
  129. package/dist/lib/shims.d.ts +18 -9
  130. package/dist/lib/shims.js +133 -50
  131. package/dist/lib/skills.d.ts +1 -1
  132. package/dist/lib/skills.js +10 -9
  133. package/dist/lib/staleness/detectors/commands.d.ts +3 -0
  134. package/dist/lib/staleness/detectors/commands.js +46 -0
  135. package/dist/lib/staleness/detectors/hooks.d.ts +3 -0
  136. package/dist/lib/staleness/detectors/hooks.js +44 -0
  137. package/dist/lib/staleness/detectors/mcp.d.ts +3 -0
  138. package/dist/lib/staleness/detectors/mcp.js +31 -0
  139. package/dist/lib/staleness/detectors/permissions.d.ts +3 -0
  140. package/dist/lib/staleness/detectors/permissions.js +201 -0
  141. package/dist/lib/staleness/detectors/plugins.d.ts +8 -0
  142. package/dist/lib/staleness/detectors/plugins.js +23 -0
  143. package/dist/lib/staleness/detectors/rules.d.ts +3 -0
  144. package/dist/lib/staleness/detectors/rules.js +34 -0
  145. package/dist/lib/staleness/detectors/skills.d.ts +3 -0
  146. package/dist/lib/staleness/detectors/skills.js +71 -0
  147. package/dist/lib/staleness/detectors/subagents.d.ts +3 -0
  148. package/dist/lib/staleness/detectors/subagents.js +50 -0
  149. package/dist/lib/staleness/detectors/types.d.ts +22 -0
  150. package/dist/lib/staleness/detectors/types.js +1 -0
  151. package/dist/lib/staleness/detectors/workflows.d.ts +3 -0
  152. package/dist/lib/staleness/detectors/workflows.js +28 -0
  153. package/dist/lib/staleness/registry.d.ts +26 -0
  154. package/dist/lib/staleness/registry.js +123 -0
  155. package/dist/lib/staleness/writers/commands.d.ts +3 -0
  156. package/dist/lib/staleness/writers/commands.js +111 -0
  157. package/dist/lib/staleness/writers/hooks.d.ts +3 -0
  158. package/dist/lib/staleness/writers/hooks.js +47 -0
  159. package/dist/lib/staleness/writers/kinds.d.ts +10 -0
  160. package/dist/lib/staleness/writers/kinds.js +15 -0
  161. package/dist/lib/staleness/writers/lazy-map.d.ts +13 -0
  162. package/dist/lib/staleness/writers/lazy-map.js +19 -0
  163. package/dist/lib/staleness/writers/mcp.d.ts +10 -0
  164. package/dist/lib/staleness/writers/mcp.js +19 -0
  165. package/dist/lib/staleness/writers/permissions.d.ts +13 -0
  166. package/dist/lib/staleness/writers/permissions.js +26 -0
  167. package/dist/lib/staleness/writers/plugins.d.ts +7 -0
  168. package/dist/lib/staleness/writers/plugins.js +31 -0
  169. package/dist/lib/staleness/writers/rules.d.ts +7 -0
  170. package/dist/lib/staleness/writers/rules.js +55 -0
  171. package/dist/lib/staleness/writers/skills.d.ts +3 -0
  172. package/dist/lib/staleness/writers/skills.js +81 -0
  173. package/dist/lib/staleness/writers/sources.d.ts +16 -0
  174. package/dist/lib/staleness/writers/sources.js +72 -0
  175. package/dist/lib/staleness/writers/subagents.d.ts +3 -0
  176. package/dist/lib/staleness/writers/subagents.js +53 -0
  177. package/dist/lib/staleness/writers/types.d.ts +36 -0
  178. package/dist/lib/staleness/writers/types.js +1 -0
  179. package/dist/lib/staleness/writers/workflows.d.ts +7 -0
  180. package/dist/lib/staleness/writers/workflows.js +31 -0
  181. package/dist/lib/state.d.ts +34 -11
  182. package/dist/lib/state.js +58 -13
  183. package/dist/lib/subagents.d.ts +0 -2
  184. package/dist/lib/subagents.js +6 -6
  185. package/dist/lib/teams/agents.js +1 -1
  186. package/dist/lib/teams/api.d.ts +67 -0
  187. package/dist/lib/teams/api.js +78 -0
  188. package/dist/lib/teams/parsers.d.ts +1 -1
  189. package/dist/lib/tmux/binary.d.ts +67 -0
  190. package/dist/lib/tmux/binary.js +141 -0
  191. package/dist/lib/tmux/index.d.ts +8 -0
  192. package/dist/lib/tmux/index.js +8 -0
  193. package/dist/lib/tmux/paths.d.ts +17 -0
  194. package/dist/lib/tmux/paths.js +30 -0
  195. package/dist/lib/tmux/session.d.ts +122 -0
  196. package/dist/lib/tmux/session.js +305 -0
  197. package/dist/lib/types.d.ts +73 -13
  198. package/dist/lib/types.js +1 -1
  199. package/dist/lib/usage.js +1 -1
  200. package/dist/lib/versions.d.ts +4 -4
  201. package/dist/lib/versions.js +138 -496
  202. package/dist/lib/workflows.d.ts +2 -4
  203. package/dist/lib/workflows.js +3 -4
  204. package/package.json +6 -3
  205. package/scripts/postinstall.js +16 -63
  206. package/dist/commands/status.d.ts +0 -9
  207. package/dist/commands/status.js +0 -25
package/CHANGELOG.md CHANGED
@@ -1,5 +1,24 @@
1
1
  # Changelog
2
2
 
3
+ ## Unreleased
4
+
5
+ ## 1.20.5
6
+
7
+ **`agents inspect` — per-agent+version detail view with drill-down (#217)**
8
+
9
+ - New top-level command `agents inspect <agent>[@version]`. Summary mode shows install path, config symlink target, shim path, versioned alias, run strategy, capability table (`hooks`/`mcp`/`skills`/`commands`/`subagents`/`plugins`/`workflows`/`rules`/`allowlist`), resource counts with project/user/system scope breakdown, and session total. Replaces the awkward `agents view <agent>@<version>` deep-detail mode as a dedicated verb; `view` itself is unchanged.
10
+ - Drill-down flags for every resource kind — `--commands`, `--skills`, `--hooks`, `--mcp`, `--rules`, `--plugins`, `--workflows`, `--subagents`. Bare flag lists every entry; passing a positional query fuzzy-searches that kind, ranking exact > substring > Damerau-Levenshtein. Zero matches exit 1 with the three closest names as suggestions. One drill-down at a time (validation error otherwise). `--json` works with summary and every drill-down for scriptable consumption.
11
+ - Resource names render as OSC-8 terminal hyperlinks to the marker file (`SKILL.md` / `WORKFLOW.md` / `AGENT.md`) for clickable navigation in modern terminals (Ghostty, iTerm2, WezTerm) — no inline path noise. Plain text on terminals without OSC-8 support.
12
+ - MCP detail intentionally suppresses path and env values to avoid leaking secrets — only the server name, scope, and version reach the output.
13
+ - Removes the deprecated `agents status` alias for `view @default`. Top-level help text updated; no consumers referenced it.
14
+
15
+ **Headless Linux: encrypted-file fallback when libsecret collection is locked (#183)**
16
+
17
+ - On server-class Linux (Ubuntu 24.04 over SSH on the reporter's box), `agents secrets create x` failed with `secret-tool: Cannot create an item in a locked collection`. Diagnosis in the issue: `gnome-keyring-daemon` is running and D-Bus is reachable, but the default `login` collection is locked because no graphical login has fed the daemon the passphrase, and `secret-tool` from `libsecret-tools` has no `--collection` flag so it can't target the unlocked `session` collection. This made `agents secrets` effectively macOS-only on any headless box.
18
+ - `src/lib/secrets/linux.ts` now transparently falls back to a file-based AES-256-GCM encrypted store at `~/.agents/.cache/secrets/<item>.enc` (mode 0600, per-file random scrypt salt + 96-bit IV, GCM auth tag). The encryption key is scrypt-derived from a passphrase read from `AGENTS_SECRETS_PASSPHRASE` (preferred) or a TTY prompt via `/dev/tty` with `stty -echo` for non-echoing input. The fallback also activates when `libsecret-tools` is not installed at all but `AGENTS_SECRETS_PASSPHRASE` is set, so a fresh install can store secrets without any apt-get step.
19
+ - The decision is cached per process; on first activation we emit one stderr line: `[agents] secret-service collection locked, using file-based store at <dir>`. The `KeychainBackend` interface in `src/lib/secrets/index.ts` is unchanged — `has`/`get`/`set`/`delete`/`list` work identically against either backend, so `bundles.ts`, `sync.ts`, and every consumer above it sees no API change.
20
+ - Items written into the file store before the fallback was added remain accessible only via libsecret if/when the collection is later unlocked; this PR does not migrate stranded items in either direction — the user simply re-creates them on a freshly headless box.
21
+
3
22
  ## 1.20.4
4
23
 
5
24
  **Plugin marketplace sync (skip outside-pointing symlinks)**
package/README.md CHANGED
@@ -243,7 +243,7 @@ agents teams status auth-feature # Who's working, what they changed, what the
243
243
 
244
244
  Teammates run detached -- close your terminal, they keep working. Check in with `teams status`, read full output with `teams logs <name>`, clean up with `teams disband`.
245
245
 
246
- Team state is observable via `agents teams list --json` / `agents teams status --json`. External tools join it with `sessions --json` (teammates get `isTeamOrigin: true`) and `cloud list --json` (for `--cloud` teammates) to build a unified fleet view. See [docs/06-observability.md](docs/06-observability.md).
246
+ Team state is observable via `agents teams list --json` / `agents teams status --json` (compact by default; add `--verbose` for the full per-teammate shape). External tools join it with `sessions --json` (teammates get `isTeamOrigin: true`) and `cloud list --json` (for `--cloud` teammates) to build a unified fleet view. See [docs/06-observability.md](docs/06-observability.md).
247
247
 
248
248
  ---
249
249
 
@@ -641,23 +641,54 @@ By default, secrets sync via iCloud Keychain to your other Macs. With `--no-iclo
641
641
 
642
642
  ## Compatibility
643
643
 
644
- | Agent | Versions | MCP | Commands | Skills | Rules | Hooks | Plugins | Permissions | Routines | Teams |
645
- |-------|----------|-----|----------|--------|-------|-------|---------|-------------|----------|-------|
646
- | Claude Code | yes | yes | yes | yes | CLAUDE.md | yes | yes | yes | yes | yes |
647
- | Codex CLI | yes | yes | yes | yes | AGENTS.md | yes (>= 0.116.0) | -- | yes | yes | yes |
648
- | Gemini CLI | yes | yes | yes | yes | GEMINI.md | yes (>= 0.26.0) | -- | -- | yes | yes |
649
- | OpenClaw | yes | yes | -- | yes | workspace/AGENTS.md | yes | yes | -- | -- | -- |
650
- | Cursor | yes | yes | yes | yes | .cursorrules | -- | -- | -- | -- | yes |
651
- | OpenCode | yes | yes | yes | yes | AGENTS.md | -- | -- | yes | -- | yes |
652
- | Copilot | yes | yes | yes | yes | AGENTS.md | -- | -- | -- | -- | -- |
653
- | Amp | yes | yes | yes | yes | AGENTS.md | -- | -- | -- | -- | -- |
654
- | Kiro | yes | yes | yes | yes | AGENTS.md | -- | -- | -- | -- | -- |
655
- | Goose | yes | yes | -- | -- | AGENTS.md | -- | -- | -- | -- | -- |
656
- | Roo Code | yes | yes | yes | yes | AGENTS.md | -- | -- | -- | -- | -- |
657
-
658
- Hooks columns marked `yes (>= X.Y.Z)` are version-gated: `agents hooks add` skips with a clear message when the installed binary is older than the listed version, instead of writing config the older binary would silently ignore. OpenCode's plugin-based hook system is on the roadmap; the entry is `--` until a writer ships.
659
-
660
- Codex command sync is version-aware: Codex `0.116.x` and older receive slash commands in `.codex/prompts/`; Codex `0.117.0+` receives those commands as generated skills so they can be invoked with `$name`.
644
+ Which DotAgents resources each agent CLI can load. Source of truth: [src/lib/agents.ts](src/lib/agents.ts) (`capabilities`); gates use `supports(agent, cap, version)` from [src/lib/capabilities.ts](src/lib/capabilities.ts). Full matrix also in [docs/00-concepts.md](docs/00-concepts.md).
645
+
646
+ | Agent | Versions | Hooks | MCP | Permissions | Skills | Commands | Plugins | Subagents | Rules | Workflows |
647
+ |-------|----------|-------|-----|-------------|--------|----------|---------|-----------|-------|-----------|
648
+ | Claude Code | yes | yes | yes | yes | yes | yes | yes | yes | `CLAUDE.md` | yes |
649
+ | Codex CLI | yes | >= 0.116.0 | yes | no | yes | < 0.117.0 · skills ($name, >= 0.117) | >= 0.128.0 | no | `AGENTS.md` | no |
650
+ | Gemini CLI | yes | >= 0.26.0 | yes | no | yes | yes (.toml) | no | no | `GEMINI.md` | no |
651
+ | Antigravity | yes | yes | yes | yes | yes | yes | yes | no | `AGENTS.md` | no |
652
+ | Grok Build | yes | yes | yes | yes | yes | skills ($name) | yes | no | `AGENTS.md` | no |
653
+ | OpenClaw | yes | yes | yes | no | yes | gateway | yes | yes | `workspace/AGENTS.md` | no |
654
+ | Cursor | yes | no | yes | no | yes | yes | no | no | `.cursorrules` | no |
655
+ | OpenCode | yes | no | yes | no | yes | yes | no | no | `AGENTS.md` | no |
656
+ | Copilot | yes | no | yes | no | yes | yes | no | no | `AGENTS.md` | no |
657
+ | Amp | yes | no | yes | no | yes | yes | no | no | `AGENTS.md` | no |
658
+ | Kiro | yes | no | yes | no | yes | yes | no | no | `AGENTS.md` | no |
659
+ | Goose | yes | no | yes | no | no | no | no | no | `AGENTS.md` | no |
660
+ | Roo Code | yes | no | yes | no | yes | yes | no | no | `AGENTS.md` | no |
661
+
662
+ **Legend:** `yes` / `no` = synced or skipped at install time. `skills ($name)` = no file-based slash-command dir; behavior ships as a generated skill invoked with `$command`. `gateway` = OpenClaw resolves slash commands at runtime, not from synced files. Version suffixes are enforced at sync time — out-of-range versions are skipped with a clear message.
663
+
664
+ **Host CLIs** (`agents cli`) are separate: YAML manifests under `~/.agents/cli/` install binaries onto your PATH (`gh`, `higgsfield`, etc.). They are not copied into per-agent version homes.
665
+
666
+ ### agents-cli features (not agent-native resources)
667
+
668
+ | Agent | Routines | Teams | Session index |
669
+ |-------|----------|-------|---------------|
670
+ | Claude Code | yes | yes | yes |
671
+ | Codex CLI | yes | yes | yes |
672
+ | Gemini CLI | yes | yes | yes |
673
+ | Cursor | -- | yes | -- |
674
+ | OpenCode | -- | yes | -- |
675
+ | Grok Build | -- | yes | yes |
676
+ | Antigravity | -- | yes | -- |
677
+ | Copilot | -- | -- | yes |
678
+ | OpenClaw, Amp, Kiro, Goose, Roo | -- | -- | -- |
679
+
680
+ ### Version-gated sync
681
+
682
+ | Capability | Agent | Gate |
683
+ |------------|-------|------|
684
+ | Hooks | Codex | >= 0.116.0 |
685
+ | Hooks | Gemini | >= 0.26.0 |
686
+ | File-based commands | Codex | < 0.117.0 (0.117+ uses command-as-skill) |
687
+ | Plugins | Codex | >= 0.128.0 |
688
+
689
+ Codex `0.117.0+` no longer reads `.codex/prompts/`; agents-cli converts slash commands into skills so they stay invocable as `$name`. OpenCode's plugin-based hook system is on the roadmap; hooks stay `no` until a writer ships.
690
+
691
+ Slash commands can declare per-agent/version targeting in frontmatter (`agents:`, `since:`, `until:`). Gating applies when syncing from `~/.agents/commands/` (user/system) into version homes — project `.agents/commands/` files are read in place and are not filtered by `agents:`. This repo ships `.agents/commands/version.md` as `/version` for Claude, Codex, Gemini, Cursor, OpenCode, Copilot, and Grok; Antigravity excluded until verified.
661
692
 
662
693
  ## FAQ
663
694
 
@@ -1,7 +1,7 @@
1
1
  import * as fs from 'fs';
2
2
  import * as path from 'path';
3
3
  import { listProfiles, getProfile, createProfile, deleteProfile, ensureDefaultBrowserProfile, getProfileRuntimeDir, extractConfiguredPort, findFreeProfilePort, getEndpointPresets, } from '../lib/browser/profiles.js';
4
- import { findBrowserPath, getPortOccupant } from '../lib/browser/chrome.js';
4
+ import { findBrowserPath, getPortOccupant, isLauncherScript } from '../lib/browser/chrome.js';
5
5
  import { listProfileCacheDirs, removeProfileCache, listAllProfileSnapshots, } from '../lib/browser/runtime-state.js';
6
6
  import { DEFAULT_VIEWPORT } from '../lib/browser/devices.js';
7
7
  import { discoverBrowserWsUrl, verifyBrowserIdentity } from '../lib/browser/cdp.js';
@@ -311,10 +311,28 @@ function registerProfilesCommands(browser) {
311
311
  process.exit(1);
312
312
  }
313
313
  const checks = [];
314
- // 1. Binary exists for declared browser type
314
+ // 1. Binary exists for declared browser type, and is a real executable we
315
+ // can drive — not a distro launcher script. findBrowserPath already
316
+ // unwraps the known Chromium wrappers to their ELF; if it still hands
317
+ // back a shebang script we couldn't resolve, `start` would fail with
318
+ // `CDP connection closed` (the wrapper re-execs the browser as a child,
319
+ // breaking the --remote-debugging-pipe transport — issue #229). Flag it
320
+ // here instead of letting launch fail opaquely.
315
321
  try {
316
322
  const binPath = findBrowserPath(profile.browser, profile.binary);
317
- checks.push({ label: 'binary', ok: true, detail: binPath });
323
+ if (isLauncherScript(binPath)) {
324
+ checks.push({
325
+ label: 'binary',
326
+ ok: false,
327
+ detail: `${binPath} is a launcher script, not the browser executable — ` +
328
+ `agents browser drives the browser over --remote-debugging-pipe and ` +
329
+ `can't attach to a wrapper that re-execs it. Point the profile at the ` +
330
+ `real binary (\`--binary /path/to/browser\`) or reinstall the standard package.`,
331
+ });
332
+ }
333
+ else {
334
+ checks.push({ label: 'binary', ok: true, detail: binPath });
335
+ }
318
336
  }
319
337
  catch (err) {
320
338
  checks.push({
@@ -351,7 +369,16 @@ function registerProfilesCommands(browser) {
351
369
  else {
352
370
  const occupant = getPortOccupant(port);
353
371
  if (!occupant) {
354
- checks.push({ label: 'port', ok: true, detail: `${port} is free` });
372
+ // A free port doesn't mean "ready to launch here": for a local
373
+ // profile we self-launch over an internal --remote-debugging-pipe and
374
+ // never bind this port. The port is consulted only to attach to a
375
+ // browser someone already started on it. Say so, so a green doctor
376
+ // can't be read as "the port is what launch depends on" (#229).
377
+ checks.push({
378
+ label: 'port',
379
+ ok: true,
380
+ detail: `${port} free — will self-launch over an internal pipe (port used only to attach to an already-running browser)`,
381
+ });
355
382
  }
356
383
  else {
357
384
  try {
@@ -52,7 +52,7 @@ Examples:
52
52
  agents cli check
53
53
 
54
54
  When to use:
55
- - After 'agents pull' on a new machine, to materialize host binaries
55
+ - After 'agents repo refresh' on a new machine, to materialize host binaries
56
56
  - In a team setup: commit cli/ entries so teammates get the same toolchain
57
57
  `);
58
58
  cliCmd
@@ -123,7 +123,7 @@ Examples:
123
123
  # Codex Cloud
124
124
  agents cloud run "add auth tests" --provider codex --env env_abc123
125
125
 
126
- # Default provider (set in ~/.agents-system/agents.yaml)
126
+ # Default provider (set in ~/.agents/agents.yaml)
127
127
  agents cloud run "refactor auth module" --repo user/repo
128
128
  `)
129
129
  .action(async (positionalPrompt, options) => {
@@ -506,6 +506,8 @@ function buildCommandRows(opts) {
506
506
  status = 'synced';
507
507
  else if (diff.toUpdate.includes(name))
508
508
  status = 'stale';
509
+ else if (diff.toRemove.includes(name))
510
+ status = 'stale';
509
511
  else
510
512
  status = 'missing';
511
513
  targets.push({
@@ -12,8 +12,16 @@ const COMPUTER_HELP_GROUPS = [
12
12
  ];
13
13
  export function registerComputerCommand(program) {
14
14
  const computer = program
15
- .command('computer')
16
- .description('Drive macOS apps via Accessibility — list, screenshot, click, type');
15
+ .command('computers')
16
+ .description('Drive macOS apps via Accessibility — list, screenshot, click, type (macOS only)')
17
+ // The whole subsystem is macOS Accessibility / TCC. Fail fast with a clear
18
+ // message on other platforms instead of a downstream ENOENT / launchctl error.
19
+ .hook('preAction', () => {
20
+ if (process.platform !== 'darwin') {
21
+ console.error('agents computers: macOS only — it drives apps via the macOS Accessibility API.');
22
+ process.exit(1);
23
+ }
24
+ });
17
25
  registerComputerSubcommands(computer);
18
26
  registerCommandGroups(computer, COMPUTER_HELP_GROUPS);
19
27
  }
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Defaults command tree.
3
+ *
4
+ * `agents defaults run ...` manages selector-based defaults for `agents run`.
5
+ */
6
+ import type { Command } from 'commander';
7
+ export declare function registerDefaultsCommands(program: Command): void;
@@ -0,0 +1,89 @@
1
+ /**
2
+ * Defaults command tree.
3
+ *
4
+ * `agents defaults run ...` manages selector-based defaults for `agents run`.
5
+ */
6
+ import chalk from 'chalk';
7
+ import { setHelpSections } from '../lib/help.js';
8
+ import { listRunDefaults, setRunDefault, unsetRunDefault, } from '../lib/run-defaults.js';
9
+ function formatRunDefault(entry) {
10
+ const parts = [];
11
+ if (entry.defaults.mode)
12
+ parts.push(`mode ${chalk.white(entry.defaults.mode)}`);
13
+ if (entry.defaults.model)
14
+ parts.push(`model ${chalk.white(entry.defaults.model)}`);
15
+ return `${chalk.cyan(entry.selector.padEnd(22))} ${parts.join(' ')}`;
16
+ }
17
+ export function registerDefaultsCommands(program) {
18
+ const defaults = program
19
+ .command('defaults')
20
+ .description('Manage default options for agents-cli commands');
21
+ const run = defaults
22
+ .command('run')
23
+ .description('Manage selector-based defaults for `agents run`');
24
+ setHelpSections(run, {
25
+ examples: `
26
+ agents defaults run list
27
+ agents defaults run set 'claude:*' --mode auto --model opus
28
+ agents defaults run set claude@2.1.45 --mode plan --model sonnet
29
+ agents defaults run unset 'claude:*'
30
+ `,
31
+ notes: `
32
+ Selectors use <agent>:<version>. Use * for all versions of an agent.
33
+ Exact selectors override wildcard selectors field by field.
34
+ Explicit flags on agents run always win over configured defaults.
35
+ `,
36
+ });
37
+ run
38
+ .command('list')
39
+ .description('List configured run defaults')
40
+ .action(() => {
41
+ const entries = listRunDefaults();
42
+ if (entries.length === 0) {
43
+ console.log(chalk.gray('No run defaults configured.'));
44
+ console.log(chalk.gray("Set one with: agents defaults run set 'claude:*' --mode auto --model opus"));
45
+ return;
46
+ }
47
+ console.log(chalk.bold('Run Defaults\n'));
48
+ for (const entry of entries) {
49
+ console.log(` ${formatRunDefault(entry)}`);
50
+ }
51
+ });
52
+ run
53
+ .command('set <selector>')
54
+ .description('Set defaults for an agent/version selector')
55
+ .option('--mode <mode>', "Default mode: plan, edit, auto, skip. 'full' accepted as alias for skip.")
56
+ .option('--model <model>', 'Default model or model alias, forwarded via --model')
57
+ .action((selector, options) => {
58
+ try {
59
+ const entry = setRunDefault(selector, {
60
+ ...(options.mode !== undefined ? { mode: options.mode } : {}),
61
+ ...(options.model !== undefined ? { model: options.model } : {}),
62
+ });
63
+ console.log(chalk.green('Set run default:'));
64
+ console.log(` ${formatRunDefault(entry)}`);
65
+ }
66
+ catch (err) {
67
+ console.error(chalk.red(err.message));
68
+ process.exit(1);
69
+ }
70
+ });
71
+ run
72
+ .command('unset <selector>')
73
+ .description('Remove defaults for an agent/version selector')
74
+ .action((selector) => {
75
+ try {
76
+ const removed = unsetRunDefault(selector);
77
+ if (removed) {
78
+ console.log(chalk.green(`Removed run default ${selector}`));
79
+ }
80
+ else {
81
+ console.log(chalk.gray(`No run default matched ${selector}`));
82
+ }
83
+ }
84
+ catch (err) {
85
+ console.error(chalk.red(err.message));
86
+ process.exit(1);
87
+ }
88
+ });
89
+ }
@@ -310,7 +310,7 @@ function renderTargetText(report, options) {
310
310
  }
311
311
  else {
312
312
  console.log(` Verdict: ${verdictParts.join(', ')}.`);
313
- console.log(chalk.gray(` Run \`agents sync --agent ${report.agent} --agent-version ${report.version}\` to reconcile, or \`agents prune cleanup\` to drop extras.`));
313
+ console.log(chalk.gray(` Run \`agents sync ${report.agent}@${report.version}\` to reconcile, or \`agents prune cleanup\` to drop extras.`));
314
314
  }
315
315
  }
316
316
  // ─── command registration ────────────────────────────────────────────────────
@@ -85,7 +85,7 @@ export function registerRunCommand(program) {
85
85
  `,
86
86
  });
87
87
  runCmd.action(async (agentSpec, prompt, options) => {
88
- const [{ buildExecCommand, parseExecEnv, execAgent, runWithFallback, normalizeMode, resolveMode }, { ALL_AGENT_IDS }, { profileExists, resolveProfileForRun }, { readAndResolveBundleEnv, describeBundle }, { getConfiguredRunStrategy, normalizeRunStrategy, resolveRunVersion, RUN_STRATEGIES }, { getGlobalDefault, getVersionHomePath, resolveVersionAlias }, { buildDiscoveredPlugin, loadPluginManifest, syncPluginToVersion }, { parseWorkflowFrontmatter, resolveWorkflowRef },] = await Promise.all([
88
+ const [{ buildExecCommand, parseExecEnv, execAgent, runWithFallback, normalizeMode, resolveMode, defaultModeFor }, { ALL_AGENT_IDS }, { profileExists, resolveProfileForRun }, { readAndResolveBundleEnv, describeBundle }, { getConfiguredRunStrategy, normalizeRunStrategy, resolveRunVersion, RUN_STRATEGIES }, { getGlobalDefault, getVersionHomePath, resolveVersion, resolveVersionAlias }, { buildDiscoveredPlugin, loadPluginManifest, syncPluginToVersion }, { parseWorkflowFrontmatter, resolveWorkflowRef }, { resolveRunDefaults },] = await Promise.all([
89
89
  import('../lib/exec.js'),
90
90
  import('../lib/agents.js'),
91
91
  import('../lib/profiles.js'),
@@ -94,6 +94,7 @@ export function registerRunCommand(program) {
94
94
  import('../lib/versions.js'),
95
95
  import('../lib/plugins.js'),
96
96
  import('../lib/workflows.js'),
97
+ import('../lib/run-defaults.js'),
97
98
  ]);
98
99
  const isValidAgent = (agent) => ALL_AGENT_IDS.includes(agent);
99
100
  // Parse agent@version
@@ -102,6 +103,7 @@ export function registerRunCommand(program) {
102
103
  let version = rawVersion || undefined;
103
104
  let profileEnv;
104
105
  let fromProfile = false;
106
+ let workflowModel;
105
107
  const cwd = options.cwd ?? process.cwd();
106
108
  if (isValidAgent(rawAgent)) {
107
109
  agent = rawAgent;
@@ -133,6 +135,10 @@ export function registerRunCommand(program) {
133
135
  // subagents/*.md ← flat .md files copied to ~/.claude/agents/ for Agent tool discovery
134
136
  const workflowDir = resolveWorkflowRef(rawAgent, cwd);
135
137
  agent = 'claude';
138
+ const workflowFrontmatter = parseWorkflowFrontmatter(workflowDir);
139
+ if (typeof workflowFrontmatter?.model === 'string' && workflowFrontmatter.model.trim() !== '') {
140
+ workflowModel = workflowFrontmatter.model.trim();
141
+ }
136
142
  const resolvedVersion = resolveVersionAlias('claude', version);
137
143
  const versionHome = getVersionHomePath('claude', resolvedVersion ?? getGlobalDefault('claude') ?? '');
138
144
  const claudeAgentsDir = path.join(versionHome, '.claude', 'agents');
@@ -179,8 +185,7 @@ export function registerRunCommand(program) {
179
185
  // Auto-inject secrets bundles declared in the workflow's frontmatter `secrets:` field.
180
186
  // Union with any --secrets flags the user passed; dedupe. Skip when --no-auto-secrets is set.
181
187
  if (!options.noAutoSecrets) {
182
- const fm = parseWorkflowFrontmatter(workflowDir);
183
- const declared = fm?.secrets ?? [];
188
+ const declared = workflowFrontmatter?.secrets ?? [];
184
189
  if (declared.length > 0) {
185
190
  const existing = new Set(options.secrets);
186
191
  const added = [];
@@ -202,10 +207,20 @@ export function registerRunCommand(program) {
202
207
  process.stderr.write(chalk.gray(`Workflow '${rawAgent}' → claude (${subagentCount} subagents)\n`));
203
208
  }
204
209
  else {
205
- console.error(chalk.red(`Unknown agent: ${rawAgent}`));
206
- console.error(chalk.gray(`Available agents: ${ALL_AGENT_IDS.join(', ')}`));
207
- console.error(chalk.gray(`Or add a profile: agents profiles add <name>`));
208
- process.exit(1);
210
+ // Smart pick: auto-correct a single typo (insertion/deletion/substitution/transposition)
211
+ // against the known agent ids before giving up. Example: `cladue` -> `claude`, `grk` -> `grok`.
212
+ const { fuzzyMatch, FUZZY_PRESETS } = await import('../lib/fuzzy.js');
213
+ const suggested = fuzzyMatch(rawAgent, ALL_AGENT_IDS, FUZZY_PRESETS.agents);
214
+ if (suggested && isValidAgent(suggested)) {
215
+ process.stderr.write(chalk.gray(`Resolved '${rawAgent}' -> '${suggested}' (single-edit match)\n`));
216
+ agent = suggested;
217
+ }
218
+ else {
219
+ console.error(chalk.red(`Unknown agent: ${rawAgent}`));
220
+ console.error(chalk.gray(`Available agents: ${ALL_AGENT_IDS.join(', ')}`));
221
+ console.error(chalk.gray(`Or add a profile: agents profiles add <name>`));
222
+ process.exit(1);
223
+ }
209
224
  }
210
225
  version = resolveVersionAlias(agent, version);
211
226
  const configuredStrategy = getConfiguredRunStrategy(agent, cwd);
@@ -252,22 +267,44 @@ export function registerRunCommand(program) {
252
267
  }
253
268
  }
254
269
  }
270
+ const defaultVersion = version ?? resolveVersion(agent, cwd);
271
+ const runDefaults = fromProfile
272
+ ? { sources: {} }
273
+ : resolveRunDefaults(agent, defaultVersion, cwd);
255
274
  // Accept the four canonical modes plus 'full' as a permanent silent
256
275
  // alias for 'skip' (rewritten downstream by normalizeMode in exec.ts).
257
- const mode = options.mode;
276
+ let mode = options.mode;
277
+ const modeSource = runCmd.getOptionValueSource('mode');
278
+ const modeFromRunDefault = modeSource === 'default' && !!runDefaults.mode;
279
+ if (modeFromRunDefault) {
280
+ mode = runDefaults.mode;
281
+ }
258
282
  if (!['plan', 'edit', 'auto', 'skip', 'full'].includes(mode)) {
259
283
  console.error(chalk.red(`Invalid mode: ${mode}. Use plan, edit, auto, or skip ('full' accepted as alias for skip).`));
260
284
  process.exit(1);
261
285
  }
262
- // Surface capability errors as a clean CLI message instead of a stack
263
- // trace from buildExecCommand. resolveMode degrades 'auto' silently and
264
- // throws on unsupported 'plan'/'skip' we catch and pretty-print.
286
+ // When the user did not pass --mode explicitly, the default is the
287
+ // generic 'plan'. Some agents (antigravity: edit/skip only, grok in some
288
+ // configurations) do not support plan. For implicit defaults, degrade
289
+ // silently to the agent's first listed mode rather than throwing — the
290
+ // user did not ask for read-only, they asked for "just run it." An
291
+ // explicit --mode plan still throws (see resolveMode), because silently
292
+ // elevating an explicit read-only request to edit is unsafe.
293
+ const modeIsDefault = modeSource === 'default';
265
294
  try {
266
295
  resolveMode(agent, normalizeMode(mode));
267
296
  }
268
297
  catch (err) {
269
- console.error(chalk.red(err.message));
270
- process.exit(1);
298
+ if (modeIsDefault && !modeFromRunDefault) {
299
+ mode = defaultModeFor(agent);
300
+ if (!options.quiet) {
301
+ process.stderr.write(chalk.gray(`[agents] ${agent} has no '${options.mode}' mode; using '${mode}'\n`));
302
+ }
303
+ }
304
+ else {
305
+ console.error(chalk.red(err.message));
306
+ process.exit(1);
307
+ }
271
308
  }
272
309
  const effort = options.effort;
273
310
  if (!['low', 'medium', 'high', 'xhigh', 'max', 'auto'].includes(effort)) {
@@ -310,6 +347,11 @@ export function registerRunCommand(program) {
310
347
  const env = hasOverrides
311
348
  ? { ...(profileEnv ?? {}), ...secretsEnv, ...(userEnv ?? {}) }
312
349
  : undefined;
350
+ const modelSource = runCmd.getOptionValueSource('model');
351
+ const model = options.model
352
+ ?? (!fromProfile && modelSource === undefined
353
+ ? (workflowModel ?? (options.fallback ? undefined : runDefaults.model))
354
+ : undefined);
313
355
  const execOptions = {
314
356
  agent,
315
357
  version,
@@ -318,7 +360,7 @@ export function registerRunCommand(program) {
318
360
  mode,
319
361
  effort,
320
362
  cwd: options.cwd,
321
- model: options.model,
363
+ model,
322
364
  addDirs: options.addDir,
323
365
  json: options.json,
324
366
  headless: options.headless ?? true,
@@ -344,12 +386,24 @@ export function registerRunCommand(program) {
344
386
  process.exit(1);
345
387
  }
346
388
  const entries = options.fallback.split(',').map(s => s.trim()).filter(Boolean);
389
+ const { fuzzyMatch: fuzzyFb, FUZZY_PRESETS: PRESETS_FB } = await import('../lib/fuzzy.js');
347
390
  for (const entry of entries) {
348
- const [fbAgent, fbVersion] = entry.split('@');
349
- if (!isValidAgent(fbAgent)) {
350
- console.error(chalk.red(`Unknown fallback agent: ${fbAgent}`));
351
- console.error(chalk.gray(`Available: ${ALL_AGENT_IDS.join(', ')}`));
352
- process.exit(1);
391
+ const [rawFbAgent, fbVersion] = entry.split('@');
392
+ let fbAgent;
393
+ if (isValidAgent(rawFbAgent)) {
394
+ fbAgent = rawFbAgent;
395
+ }
396
+ else {
397
+ const suggested = fuzzyFb(rawFbAgent, ALL_AGENT_IDS, PRESETS_FB.agents);
398
+ if (suggested && isValidAgent(suggested)) {
399
+ process.stderr.write(chalk.gray(`Resolved fallback '${rawFbAgent}' -> '${suggested}' (single-edit match)\n`));
400
+ fbAgent = suggested;
401
+ }
402
+ else {
403
+ console.error(chalk.red(`Unknown fallback agent: ${rawFbAgent}`));
404
+ console.error(chalk.gray(`Available: ${ALL_AGENT_IDS.join(', ')}`));
405
+ process.exit(1);
406
+ }
353
407
  }
354
408
  if (fbAgent === agent) {
355
409
  console.error(chalk.red(`Fallback cannot include the primary agent (${agent}). Rate-limit fallback only helps when switching providers.`));
@@ -4,8 +4,8 @@ import * as fs from 'fs';
4
4
  import * as os from 'os';
5
5
  import * as path from 'path';
6
6
  import { checkbox } from '@inquirer/prompts';
7
- import { AGENTS, HOOKS_CAPABLE_AGENTS, resolveAgentName, formatAgentError, agentLabel, } from '../lib/agents.js';
8
- import { supports } from '../lib/capabilities.js';
7
+ import { AGENTS, resolveAgentName, formatAgentError, agentLabel, } from '../lib/agents.js';
8
+ import { supports, capableAgents } from '../lib/capabilities.js';
9
9
  import { cloneRepo } from '../lib/git.js';
10
10
  import { discoverHooksFromRepo, installHooksCentrally, listCentralHooks, listInstalledHooksWithScope, getHookInfo, parseHookManifest, iterHooksCapableVersions, removeHookFromVersion, } from '../lib/hooks.js';
11
11
  import { listInstalledVersions, getGlobalDefault, resolveVersionAlias, syncResourcesToVersion, promptAgentVersionSelection, getVersionHomePath, resolveInstalledAgentTargets, } from '../lib/versions.js';
@@ -58,7 +58,7 @@ When to use:
58
58
  agentId = resolveAgentName(agentName);
59
59
  if (!agentId) {
60
60
  spinner.stop();
61
- console.log(chalk.red(formatAgentError(agentName, [...HOOKS_CAPABLE_AGENTS])));
61
+ console.log(chalk.red(formatAgentError(agentName, [...capableAgents('hooks')])));
62
62
  process.exit(1);
63
63
  }
64
64
  requestedVersion = resolveVersionAlias(agentId, parts[1]) ?? null;
@@ -185,7 +185,7 @@ When to use:
185
185
  }
186
186
  // No agent specified - show default version for each hooks-capable agent
187
187
  console.log(chalk.bold('Installed Hooks\n'));
188
- for (const aid of HOOKS_CAPABLE_AGENTS) {
188
+ for (const aid of capableAgents('hooks')) {
189
189
  const agent = AGENTS[aid];
190
190
  const installedVersions = listInstalledVersions(aid);
191
191
  const defaultVer = getGlobalDefault(aid);
@@ -338,7 +338,7 @@ Examples:
338
338
  // Get agent and version selection
339
339
  let selectedAgents;
340
340
  let versionSelections;
341
- const hooksCapableAgents = Array.from(HOOKS_CAPABLE_AGENTS);
341
+ const hooksCapableAgents = Array.from(capableAgents('hooks'));
342
342
  if (options.agents) {
343
343
  const result = await resolveAgentTargetsAutoInstalling(options.agents, hooksCapableAgents, { yes: options.yes });
344
344
  if (!result) {
@@ -468,7 +468,7 @@ Examples:
468
468
  // agent@x.y.z, agent@all, literal all) works here too.
469
469
  let availableTargets = hookInfo.targets;
470
470
  if (options?.agents) {
471
- const requestedTargets = resolveInstalledAgentTargets(options.agents, [...HOOKS_CAPABLE_AGENTS]);
471
+ const requestedTargets = resolveInstalledAgentTargets(options.agents, [...capableAgents('hooks')]);
472
472
  const requested = new Set();
473
473
  for (const aid of requestedTargets.directAgents) {
474
474
  for (const ver of listInstalledVersions(aid)) {
@@ -0,0 +1,26 @@
1
+ /**
2
+ * `agents inspect <agent>[@version]` — single-agent, single-version detail view.
3
+ *
4
+ * Summary mode shows the per-version header (paths, shim, capabilities, resource
5
+ * counts, sessions). Drill-down flags (`--skills`, `--hooks`, `--mcp`, ...) list
6
+ * one resource kind; passing a positional query to the same flag fuzzy-searches
7
+ * for a single resource and prints its detail. Resource names render as OSC-8
8
+ * hyperlinks to the marker file (SKILL.md / WORKFLOW.md / AGENT.md / the file
9
+ * itself) so users can click straight to the source.
10
+ */
11
+ import { Command } from 'commander';
12
+ interface InspectOptions {
13
+ brief?: boolean;
14
+ json?: boolean;
15
+ commands?: boolean | string;
16
+ skills?: boolean | string;
17
+ hooks?: boolean | string;
18
+ mcp?: boolean | string;
19
+ rules?: boolean | string;
20
+ plugins?: boolean | string;
21
+ workflows?: boolean | string;
22
+ subagents?: boolean | string;
23
+ }
24
+ export declare function registerInspectCommand(program: Command): void;
25
+ export declare function inspectAction(target: string, options: InspectOptions): Promise<void>;
26
+ export {};