@phnx-labs/agents-cli 1.20.52 → 1.20.53

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 (107) hide show
  1. package/CHANGELOG.md +57 -2
  2. package/README.md +12 -0
  3. package/dist/bin/agents +0 -0
  4. package/dist/commands/cloud.d.ts +3 -0
  5. package/dist/commands/cloud.js +2 -1
  6. package/dist/commands/exec.js +65 -1
  7. package/dist/commands/feed.d.ts +29 -0
  8. package/dist/commands/feed.js +237 -32
  9. package/dist/commands/memory.d.ts +9 -0
  10. package/dist/commands/memory.js +164 -0
  11. package/dist/commands/message.d.ts +11 -6
  12. package/dist/commands/message.js +140 -5
  13. package/dist/commands/routines.js +12 -0
  14. package/dist/commands/secrets-migrate.d.ts +2 -1
  15. package/dist/commands/secrets-migrate.js +88 -13
  16. package/dist/commands/secrets.js +4 -1
  17. package/dist/commands/sessions.js +10 -1
  18. package/dist/commands/worktree.js +4 -2
  19. package/dist/index.js +16 -21
  20. package/dist/lib/agents.js +249 -17
  21. package/dist/lib/answer-router.d.ts +75 -0
  22. package/dist/lib/answer-router.js +149 -0
  23. package/dist/lib/ask-classifier.d.ts +71 -0
  24. package/dist/lib/ask-classifier.js +197 -0
  25. package/dist/lib/cloud/antigravity.d.ts +0 -2
  26. package/dist/lib/cloud/antigravity.js +2 -17
  27. package/dist/lib/cloud/codex.js +3 -18
  28. package/dist/lib/cloud/rush.js +3 -15
  29. package/dist/lib/cloud/stream.js +2 -0
  30. package/dist/lib/cloud/types.d.ts +21 -0
  31. package/dist/lib/cloud/types.js +81 -0
  32. package/dist/lib/crabbox/cli.d.ts +1 -1
  33. package/dist/lib/crabbox/cli.js +12 -2
  34. package/dist/lib/crabbox/lease.d.ts +13 -0
  35. package/dist/lib/crabbox/lease.js +11 -2
  36. package/dist/lib/crabbox/progress.d.ts +62 -0
  37. package/dist/lib/crabbox/progress.js +129 -0
  38. package/dist/lib/events.js +4 -1
  39. package/dist/lib/exec.js +19 -1
  40. package/dist/lib/feed-outcome.d.ts +101 -0
  41. package/dist/lib/feed-outcome.js +244 -0
  42. package/dist/lib/feed-policy.d.ts +30 -0
  43. package/dist/lib/feed-policy.js +133 -0
  44. package/dist/lib/feed.d.ts +127 -3
  45. package/dist/lib/feed.js +416 -40
  46. package/dist/lib/git.d.ts +17 -1
  47. package/dist/lib/git.js +20 -1
  48. package/dist/lib/hooks.js +522 -12
  49. package/dist/lib/hosts/passthrough.d.ts +3 -3
  50. package/dist/lib/hosts/passthrough.js +3 -4
  51. package/dist/lib/mailbox-gc.d.ts +22 -0
  52. package/dist/lib/mailbox-gc.js +161 -0
  53. package/dist/lib/mailbox.d.ts +26 -2
  54. package/dist/lib/mailbox.js +80 -5
  55. package/dist/lib/mcp.js +82 -0
  56. package/dist/lib/memory.d.ts +55 -0
  57. package/dist/lib/memory.js +274 -0
  58. package/dist/lib/notify.d.ts +16 -0
  59. package/dist/lib/notify.js +61 -0
  60. package/dist/lib/operator.d.ts +26 -0
  61. package/dist/lib/operator.js +107 -0
  62. package/dist/lib/plugins.d.ts +35 -0
  63. package/dist/lib/plugins.js +217 -0
  64. package/dist/lib/remote-agents-json.d.ts +14 -0
  65. package/dist/lib/remote-agents-json.js +94 -0
  66. package/dist/lib/resources/mcp.js +44 -0
  67. package/dist/lib/resources/memory.d.ts +15 -0
  68. package/dist/lib/resources/memory.js +46 -0
  69. package/dist/lib/resources/types.d.ts +2 -2
  70. package/dist/lib/runner.d.ts +43 -0
  71. package/dist/lib/runner.js +323 -74
  72. package/dist/lib/sandbox.js +6 -0
  73. package/dist/lib/secrets/bundles.js +38 -13
  74. package/dist/lib/secrets/icloud-import.d.ts +12 -3
  75. package/dist/lib/secrets/icloud-import.js +37 -7
  76. package/dist/lib/secrets/index.d.ts +106 -2
  77. package/dist/lib/secrets/index.js +603 -28
  78. package/dist/lib/session/active.d.ts +18 -0
  79. package/dist/lib/session/active.js +47 -17
  80. package/dist/lib/session/db.d.ts +9 -1
  81. package/dist/lib/session/db.js +18 -3
  82. package/dist/lib/session/discover.d.ts +13 -0
  83. package/dist/lib/session/discover.js +31 -0
  84. package/dist/lib/session/parse.d.ts +8 -0
  85. package/dist/lib/session/parse.js +42 -21
  86. package/dist/lib/session/remote-active.js +8 -89
  87. package/dist/lib/session/state.d.ts +11 -0
  88. package/dist/lib/session/state.js +37 -0
  89. package/dist/lib/session/tail.d.ts +23 -4
  90. package/dist/lib/session/tail.js +34 -16
  91. package/dist/lib/session/throughput.d.ts +30 -0
  92. package/dist/lib/session/throughput.js +86 -0
  93. package/dist/lib/shim-heal.d.ts +12 -3
  94. package/dist/lib/shim-heal.js +12 -6
  95. package/dist/lib/staleness/detectors/subagents.js +57 -3
  96. package/dist/lib/staleness/writers/hooks.js +7 -3
  97. package/dist/lib/staleness/writers/subagents.js +37 -6
  98. package/dist/lib/startup/command-registry.d.ts +1 -0
  99. package/dist/lib/startup/command-registry.js +2 -0
  100. package/dist/lib/subagents.d.ts +52 -0
  101. package/dist/lib/subagents.js +315 -12
  102. package/dist/lib/teams/worktree.d.ts +8 -0
  103. package/dist/lib/teams/worktree.js +8 -0
  104. package/dist/lib/types.d.ts +10 -2
  105. package/dist/lib/versions.js +38 -48
  106. package/package.json +4 -3
  107. package/scripts/postinstall.js +61 -1
@@ -16,9 +16,36 @@ const SHIMS_DIR = path.join(USER_DIR, '.cache', 'shims');
16
16
  // System repo lives inside the user repo (folded in v1.21). Legacy installs at
17
17
  // ~/.agents-system/ are migrated by src/lib/migrate.ts on first CLI invocation.
18
18
  const SYSTEM_DIR = path.join(USER_DIR, '.system');
19
- const AGENTS_BIN = fileURLToPath(new URL('../dist/index.js', import.meta.url));
19
+ const AGENTS_JS_ENTRYPOINT = fileURLToPath(new URL('../dist/index.js', import.meta.url));
20
+ // Signed + notarized standalone Mach-O, macOS only (scripts/sign-cli-binary.sh).
21
+ // Preferred over the node-shebang JS entrypoint on darwin: the unsigned JS shim
22
+ // is what EDR (CrowdStrike Falcon) flags when an editor child spawns it (#315).
23
+ const AGENTS_NATIVE_MACOS_BIN = fileURLToPath(new URL('../dist/bin/agents', import.meta.url));
24
+ const AGENTS_BIN = resolveAgentsBin();
20
25
  const INSTALL_HELPER_SCRIPT = fileURLToPath(new URL('./install-helper.js', import.meta.url));
21
26
 
27
+ function resolveAgentsBin() {
28
+ if (process.platform !== 'darwin') return AGENTS_JS_ENTRYPOINT;
29
+ try {
30
+ fs.accessSync(AGENTS_NATIVE_MACOS_BIN, fs.constants.X_OK);
31
+ } catch {
32
+ return AGENTS_JS_ENTRYPOINT; // no native binary in this install (dev build, arch without one)
33
+ }
34
+ // Real execution probe, not just a stat: catches a quarantined, EDR-blocked,
35
+ // or wrong-arch (Intel) binary at install time, where we can still fall back
36
+ // loudly, instead of breaking every later `agents` call.
37
+ const probe = spawnSync(AGENTS_NATIVE_MACOS_BIN, ['--version'], {
38
+ stdio: ['ignore', 'pipe', 'pipe'],
39
+ timeout: 15000,
40
+ encoding: 'utf-8',
41
+ });
42
+ if (probe.status === 0) return AGENTS_NATIVE_MACOS_BIN;
43
+ const why = probe.error ? probe.error.message : `exit status ${probe.status}`;
44
+ console.warn(` warning: the signed agents binary at ${AGENTS_NATIVE_MACOS_BIN} failed to run (${why}).`);
45
+ console.warn(` Falling back to the JS entrypoint; 'agents' still works but is not code-signed.`);
46
+ return AGENTS_JS_ENTRYPOINT;
47
+ }
48
+
22
49
  function installKeychainHelper() {
23
50
  if (process.platform !== 'darwin') return;
24
51
  if (!fs.existsSync(INSTALL_HELPER_SCRIPT)) return;
@@ -276,6 +303,7 @@ To enable version-aware shims, add this to your shell config:
276
303
  */
277
304
  async function ensureAgentsResolvablePosix() {
278
305
  if (process.env.CI || process.env.AGENTS_NO_HEAL === '1') return;
306
+ retargetManagedLinksToNativeBin();
279
307
  try {
280
308
  const { localBinDir, ensureLocalBinSymlink, loginShellResolves, dirOnLoginPath } =
281
309
  await import('../dist/lib/platform/posixpath.js');
@@ -314,6 +342,38 @@ async function ensureAgentsResolvablePosix() {
314
342
  }
315
343
  }
316
344
 
345
+ /**
346
+ * Upgrade path for #315: an earlier install symlinked ~/.local/bin/agents at
347
+ * the JS entrypoint. ensureLocalBinSymlink never repoints an existing link,
348
+ * and the loginShellResolves() early-return means ensureAgentsResolvablePosix
349
+ * would not even try - so without this, a machine healed before the signed
350
+ * binary existed keeps the unsigned JS shim forever. Repoint ONLY symlinks
351
+ * that resolve exactly to OUR dist/index.js; a dev build or foreign link is
352
+ * never touched.
353
+ */
354
+ function retargetManagedLinksToNativeBin() {
355
+ if (AGENTS_BIN === AGENTS_JS_ENTRYPOINT) return;
356
+ const binDir = path.join(HOME, '.local', 'bin');
357
+ // Compare realpaths: dist/index.js can be reached through path aliases
358
+ // (/var vs /private/var on macOS) depending on who created the link.
359
+ let want = AGENTS_JS_ENTRYPOINT;
360
+ try { want = fs.realpathSync(AGENTS_JS_ENTRYPOINT); } catch { /* keep the literal path */ }
361
+ for (const name of ['agents', 'ag']) {
362
+ const linkPath = path.join(binDir, name);
363
+ try {
364
+ const current = fs.readlinkSync(linkPath); // throws unless a symlink
365
+ let resolved = path.isAbsolute(current) ? current : path.resolve(binDir, current);
366
+ try { resolved = fs.realpathSync(resolved); } catch { /* dangling - compare as-is */ }
367
+ if (resolved !== want) continue;
368
+ fs.unlinkSync(linkPath);
369
+ fs.symlinkSync(AGENTS_BIN, linkPath);
370
+ console.log(` Repointed ${linkPath} at the signed agents binary.`);
371
+ } catch {
372
+ /* absent, unreadable, or not a symlink - nothing to retarget */
373
+ }
374
+ }
375
+ }
376
+
317
377
  /**
318
378
  * Self-heal long-running processes onto the just-installed code (macOS).
319
379
  *