@phnx-labs/agents-cli 1.20.64 → 1.20.65

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 (155) hide show
  1. package/CHANGELOG.md +39 -3
  2. package/README.md +37 -2
  3. package/dist/bin/agents +0 -0
  4. package/dist/commands/apply.d.ts +12 -0
  5. package/dist/commands/apply.js +274 -0
  6. package/dist/commands/browser.js +2 -2
  7. package/dist/commands/cloud.js +32 -2
  8. package/dist/commands/doctor.js +4 -1
  9. package/dist/commands/exec.js +94 -49
  10. package/dist/commands/feed.js +25 -11
  11. package/dist/commands/hosts.js +44 -6
  12. package/dist/commands/mcp.js +55 -5
  13. package/dist/commands/monitors.d.ts +12 -0
  14. package/dist/commands/monitors.js +740 -0
  15. package/dist/commands/output.js +2 -2
  16. package/dist/commands/routines.js +23 -2
  17. package/dist/commands/secrets.d.ts +16 -0
  18. package/dist/commands/secrets.js +215 -64
  19. package/dist/commands/serve.js +31 -0
  20. package/dist/commands/sessions-export.js +8 -3
  21. package/dist/commands/sessions.d.ts +16 -0
  22. package/dist/commands/sessions.js +36 -6
  23. package/dist/commands/ssh.js +45 -2
  24. package/dist/commands/versions.js +7 -3
  25. package/dist/commands/view.d.ts +26 -0
  26. package/dist/commands/view.js +32 -9
  27. package/dist/commands/webhook.js +10 -2
  28. package/dist/index.js +34 -14
  29. package/dist/lib/agents.d.ts +18 -0
  30. package/dist/lib/agents.js +53 -3
  31. package/dist/lib/auto-dispatch-provider.js +7 -2
  32. package/dist/lib/auto-dispatch.d.ts +3 -0
  33. package/dist/lib/auto-dispatch.js +3 -0
  34. package/dist/lib/browser/chrome.js +2 -2
  35. package/dist/lib/cloud/antigravity.js +2 -2
  36. package/dist/lib/cloud/host.d.ts +59 -0
  37. package/dist/lib/cloud/host.js +224 -0
  38. package/dist/lib/cloud/registry.js +4 -0
  39. package/dist/lib/cloud/types.d.ts +6 -4
  40. package/dist/lib/computer-rpc.js +3 -1
  41. package/dist/lib/crabbox/cli.js +5 -1
  42. package/dist/lib/crabbox/runtimes.js +11 -2
  43. package/dist/lib/daemon.d.ts +20 -4
  44. package/dist/lib/daemon.js +62 -19
  45. package/dist/lib/devices/fleet.d.ts +3 -2
  46. package/dist/lib/devices/fleet.js +9 -0
  47. package/dist/lib/devices/registry.d.ts +15 -0
  48. package/dist/lib/devices/registry.js +9 -0
  49. package/dist/lib/exec.d.ts +19 -2
  50. package/dist/lib/exec.js +41 -13
  51. package/dist/lib/fleet/apply.d.ts +63 -0
  52. package/dist/lib/fleet/apply.js +214 -0
  53. package/dist/lib/fleet/auth-sync.d.ts +67 -0
  54. package/dist/lib/fleet/auth-sync.js +142 -0
  55. package/dist/lib/fleet/manifest.d.ts +29 -0
  56. package/dist/lib/fleet/manifest.js +127 -0
  57. package/dist/lib/fleet/types.d.ts +129 -0
  58. package/dist/lib/fleet/types.js +13 -0
  59. package/dist/lib/git.d.ts +27 -0
  60. package/dist/lib/git.js +34 -2
  61. package/dist/lib/hosts/dispatch.d.ts +29 -8
  62. package/dist/lib/hosts/dispatch.js +46 -18
  63. package/dist/lib/hosts/passthrough.js +2 -0
  64. package/dist/lib/hosts/providers/devices.d.ts +27 -0
  65. package/dist/lib/hosts/providers/devices.js +98 -0
  66. package/dist/lib/hosts/registry.d.ts +10 -16
  67. package/dist/lib/hosts/registry.js +17 -50
  68. package/dist/lib/hosts/remote-cmd.d.ts +23 -0
  69. package/dist/lib/hosts/remote-cmd.js +71 -0
  70. package/dist/lib/hosts/run-target.d.ts +84 -0
  71. package/dist/lib/hosts/run-target.js +99 -0
  72. package/dist/lib/hosts/types.d.ts +23 -5
  73. package/dist/lib/hosts/types.js +22 -4
  74. package/dist/lib/linear-autoclose.d.ts +30 -0
  75. package/dist/lib/linear-autoclose.js +22 -0
  76. package/dist/lib/mcp.d.ts +27 -1
  77. package/dist/lib/mcp.js +126 -12
  78. package/dist/lib/monitors/config.d.ts +161 -0
  79. package/dist/lib/monitors/config.js +372 -0
  80. package/dist/lib/monitors/dispatch.d.ts +28 -0
  81. package/dist/lib/monitors/dispatch.js +91 -0
  82. package/dist/lib/monitors/engine.d.ts +61 -0
  83. package/dist/lib/monitors/engine.js +201 -0
  84. package/dist/lib/monitors/sources/command.d.ts +11 -0
  85. package/dist/lib/monitors/sources/command.js +31 -0
  86. package/dist/lib/monitors/sources/device.d.ts +13 -0
  87. package/dist/lib/monitors/sources/device.js +35 -0
  88. package/dist/lib/monitors/sources/file.d.ts +14 -0
  89. package/dist/lib/monitors/sources/file.js +57 -0
  90. package/dist/lib/monitors/sources/http.d.ts +10 -0
  91. package/dist/lib/monitors/sources/http.js +34 -0
  92. package/dist/lib/monitors/sources/index.d.ts +14 -0
  93. package/dist/lib/monitors/sources/index.js +31 -0
  94. package/dist/lib/monitors/sources/poll.d.ts +9 -0
  95. package/dist/lib/monitors/sources/poll.js +9 -0
  96. package/dist/lib/monitors/sources/types.d.ts +18 -0
  97. package/dist/lib/monitors/sources/types.js +9 -0
  98. package/dist/lib/monitors/sources/webhook.d.ts +23 -0
  99. package/dist/lib/monitors/sources/webhook.js +47 -0
  100. package/dist/lib/monitors/sources/ws.d.ts +14 -0
  101. package/dist/lib/monitors/sources/ws.js +45 -0
  102. package/dist/lib/monitors/state.d.ts +69 -0
  103. package/dist/lib/monitors/state.js +144 -0
  104. package/dist/lib/platform/exec.d.ts +16 -0
  105. package/dist/lib/platform/exec.js +17 -0
  106. package/dist/lib/plugins.js +101 -2
  107. package/dist/lib/redact.d.ts +14 -1
  108. package/dist/lib/redact.js +47 -1
  109. package/dist/lib/remote-agents-json.js +7 -1
  110. package/dist/lib/rotate.d.ts +6 -3
  111. package/dist/lib/rotate.js +0 -1
  112. package/dist/lib/routines.d.ts +16 -0
  113. package/dist/lib/routines.js +19 -0
  114. package/dist/lib/runner.d.ts +1 -0
  115. package/dist/lib/runner.js +102 -9
  116. package/dist/lib/secrets/agent.d.ts +48 -10
  117. package/dist/lib/secrets/agent.js +123 -15
  118. package/dist/lib/secrets/bundles.d.ts +26 -0
  119. package/dist/lib/secrets/bundles.js +59 -8
  120. package/dist/lib/secrets/mcp.js +4 -2
  121. package/dist/lib/secrets/remote.d.ts +17 -0
  122. package/dist/lib/secrets/remote.js +40 -0
  123. package/dist/lib/self-update.d.ts +20 -0
  124. package/dist/lib/self-update.js +54 -1
  125. package/dist/lib/serve/control.d.ts +95 -0
  126. package/dist/lib/serve/control.js +260 -0
  127. package/dist/lib/serve/server.d.ts +35 -1
  128. package/dist/lib/serve/server.js +106 -76
  129. package/dist/lib/serve/stream.d.ts +43 -0
  130. package/dist/lib/serve/stream.js +116 -0
  131. package/dist/lib/serve/token.d.ts +35 -0
  132. package/dist/lib/serve/token.js +85 -0
  133. package/dist/lib/session/bundle.d.ts +14 -0
  134. package/dist/lib/session/bundle.js +12 -1
  135. package/dist/lib/session/remote-list.js +5 -1
  136. package/dist/lib/session/state.d.ts +7 -25
  137. package/dist/lib/session/state.js +16 -6
  138. package/dist/lib/session/sync/config.js +8 -2
  139. package/dist/lib/session/types.d.ts +30 -0
  140. package/dist/lib/ssh-tunnel.d.ts +19 -1
  141. package/dist/lib/ssh-tunnel.js +86 -7
  142. package/dist/lib/startup/command-registry.d.ts +2 -0
  143. package/dist/lib/startup/command-registry.js +4 -0
  144. package/dist/lib/state.d.ts +5 -0
  145. package/dist/lib/state.js +12 -0
  146. package/dist/lib/tmux/session.d.ts +7 -0
  147. package/dist/lib/tmux/session.js +3 -1
  148. package/dist/lib/triggers/webhook.d.ts +18 -0
  149. package/dist/lib/triggers/webhook.js +105 -0
  150. package/dist/lib/types.d.ts +26 -1
  151. package/dist/lib/usage.js +7 -5
  152. package/dist/lib/versions.js +14 -11
  153. package/dist/lib/workflows.d.ts +20 -0
  154. package/dist/lib/workflows.js +24 -0
  155. package/package.json +2 -1
@@ -30,7 +30,7 @@ import { listResources } from './resources.js';
30
30
  import { VERSION_RE, compareVersions } from './agent-spec/primitives.js';
31
31
  import { AGENTS, agentConfigDirName, getAccountEmail, resolveAgentName, formatAgentError, findInPath, isSelfUpdatingAgent } from './agents.js';
32
32
  import { discoverPermissionGroups, getActivePermissionPresetName, readPermissionPresetRecipe, PERMISSION_PRESET_ENV_VAR } from './permissions.js';
33
- import { parseMcpServerConfig } from './mcp.js';
33
+ import { parseMcpServerConfig, isProjectMcpTrusted } from './mcp.js';
34
34
  import { createVersionedAlias, removeVersionedAlias, getConfigSymlinkVersion, ensureClaudeInsideSymlink } from './shims.js';
35
35
  import { importInstallScriptBinary } from './import.js';
36
36
  import { IS_WINDOWS, composeWin32CommandLine } from './platform/index.js';
@@ -2511,20 +2511,23 @@ export function syncResourcesToVersion(agent, version, selection, options = {})
2511
2511
  // For Claude/Codex: uses CLI commands (claude mcp add, codex mcp add)
2512
2512
  // For others: edits config files directly
2513
2513
  //
2514
- // Mirror the hooks defense: exclude project-scoped MCPs from the sync. An
2515
- // MCP server is an executable invoked under the agent's authority, so a
2516
- // cloned public repo's .agents/mcp/foo.yaml could install an arbitrary
2517
- // command. We pre-compute the set of project-scoped names and drop them
2518
- // before handing the list to installMcpServers. (The deeper helper-side
2519
- // dedup in lib/mcp.ts still lets a project entry shadow a same-named
2520
- // user entry, so name-collision shadowing is not fully closed here
2521
- // tracked separately for a follow-up in lib/mcp.ts.)
2522
- const projectScopedMcpNames = new Set(getScopedMcpResources(cwd).filter(r => r.scope === 'project').map(r => r.name));
2514
+ // Mirror the hooks defense: an MCP server is an executable invoked under the
2515
+ // agent's authority, so a cloned public repo's .agents/mcp/foo.yaml could
2516
+ // install an arbitrary command (RUSH-1776). Project-scoped MCPs are UNTRUSTED
2517
+ // by default drop them before handing the list to installMcpServers unless
2518
+ // the user has explicitly trusted this project (`agents mcp trust`). The
2519
+ // register/spawn choke in lib/mcp.ts (getMcpServersByName) enforces the same
2520
+ // trust gate and drops untrusted project entries before dedup, so a project
2521
+ // entry can no longer shadow a same-named user entry either.
2522
+ const projectMcpTrusted = projectAgentsDir ? isProjectMcpTrusted(projectAgentsDir) : false;
2523
+ const untrustedProjectMcpNames = new Set(projectMcpTrusted
2524
+ ? []
2525
+ : getScopedMcpResources(cwd).filter(r => r.scope === 'project').map(r => r.name));
2523
2526
  const mcpWriter = getWriter('mcp', agent);
2524
2527
  const mcpToSyncAll = selection
2525
2528
  ? resolveSelection(selection.mcp, available.mcp)
2526
2529
  : (mcpWriter ? available.mcp : []);
2527
- const mcpToSync = mcpToSyncAll.filter(n => !projectScopedMcpNames.has(n));
2530
+ const mcpToSync = mcpToSyncAll.filter(n => !untrustedProjectMcpNames.has(n));
2528
2531
  if (mcpToSync.length > 0 && mcpWriter) {
2529
2532
  const r = mcpWriter.write({ version, versionHome, selection: mcpToSync, cwd });
2530
2533
  result.mcp = r.synced;
@@ -240,6 +240,26 @@ export declare function resolveAllowedSubagents(available: string[], allowedAgen
240
240
  allowedStems: string[];
241
241
  missing: string[];
242
242
  };
243
+ /** The Claude tool an orchestrator uses to dispatch subagents. Must stay in a
244
+ * workflow's `--tools` allowlist whenever the workflow ships dispatchable
245
+ * subagents, or the orchestrator has no way to reach them. */
246
+ export declare const SUBAGENT_DISPATCH_TOOL = "Task";
247
+ /**
248
+ * Keep the subagent-dispatch tool (`Task`) in a `tools:`-restricted workflow's
249
+ * allowlist when the workflow actually ships subagents to dispatch.
250
+ *
251
+ * A WORKFLOW.md `tools:` list becomes Claude's `--tools` set, which *restricts*
252
+ * the available built-ins. An orchestrator whose `subagents/` files were just
253
+ * copied into the shared agents dir but whose `tools:` omits `Task` cannot
254
+ * reach any of them — it silently no-ops (observed: the run emits only "I'll
255
+ * wait for the completion notification" and exits). Omitting `Task` while
256
+ * shipping a `subagents/` dir is always an authoring miss, so we re-add it at
257
+ * the source rather than relying on every workflow author to remember.
258
+ *
259
+ * Returns `tools` unchanged when the workflow has no subagents or already lists
260
+ * `Task`; otherwise appends `Task`.
261
+ */
262
+ export declare function ensureSubagentDispatchTool(tools: string[], hasSubagents: boolean): string[];
243
263
  /**
244
264
  * Prune stale workflow-managed subagent files from the shared per-agent agents
245
265
  * dir before a scoped run writes the permitted set (issue #401, follow-up to
@@ -278,6 +278,30 @@ export function resolveAllowedSubagents(available, allowedAgents) {
278
278
  missing: allowedAgents.filter(a => !present.has(a)),
279
279
  };
280
280
  }
281
+ /** The Claude tool an orchestrator uses to dispatch subagents. Must stay in a
282
+ * workflow's `--tools` allowlist whenever the workflow ships dispatchable
283
+ * subagents, or the orchestrator has no way to reach them. */
284
+ export const SUBAGENT_DISPATCH_TOOL = 'Task';
285
+ /**
286
+ * Keep the subagent-dispatch tool (`Task`) in a `tools:`-restricted workflow's
287
+ * allowlist when the workflow actually ships subagents to dispatch.
288
+ *
289
+ * A WORKFLOW.md `tools:` list becomes Claude's `--tools` set, which *restricts*
290
+ * the available built-ins. An orchestrator whose `subagents/` files were just
291
+ * copied into the shared agents dir but whose `tools:` omits `Task` cannot
292
+ * reach any of them — it silently no-ops (observed: the run emits only "I'll
293
+ * wait for the completion notification" and exits). Omitting `Task` while
294
+ * shipping a `subagents/` dir is always an authoring miss, so we re-add it at
295
+ * the source rather than relying on every workflow author to remember.
296
+ *
297
+ * Returns `tools` unchanged when the workflow has no subagents or already lists
298
+ * `Task`; otherwise appends `Task`.
299
+ */
300
+ export function ensureSubagentDispatchTool(tools, hasSubagents) {
301
+ if (!hasSubagents || tools.includes(SUBAGENT_DISPATCH_TOOL))
302
+ return tools;
303
+ return [...tools, SUBAGENT_DISPATCH_TOOL];
304
+ }
281
305
  /**
282
306
  * Prune stale workflow-managed subagent files from the shared per-agent agents
283
307
  * dir before a scoped run writes the permitted set (issue #401, follow-up to
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@phnx-labs/agents-cli",
3
- "version": "1.20.64",
3
+ "version": "1.20.65",
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",
@@ -51,6 +51,7 @@
51
51
  "prepack": "cp ../../README.md README.md && scripts/verify-keychain-helper.sh && scripts/verify-menubar-helper.sh && scripts/verify-cli-binary.sh",
52
52
  "postinstall": "node scripts/postinstall.js",
53
53
  "dev": "tsx src/index.ts",
54
+ "changelog": "bun scripts/gen-changelog.ts",
54
55
  "start": "node dist/index.js",
55
56
  "test": "node ./node_modules/vitest/vitest.mjs run",
56
57
  "test:remote": "scripts/sandbox.sh 'bun install && bun run build && bun run test'",