@phnx-labs/agents-cli 1.20.57 → 1.20.58

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 (43) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/README.md +34 -3
  3. package/dist/bin/agents +0 -0
  4. package/dist/commands/defaults.js +24 -0
  5. package/dist/commands/exec.js +28 -4
  6. package/dist/commands/secrets.js +28 -19
  7. package/dist/commands/versions.js +11 -3
  8. package/dist/commands/view.js +19 -4
  9. package/dist/lib/agents.d.ts +21 -0
  10. package/dist/lib/agents.js +28 -4
  11. package/dist/lib/daemon.d.ts +5 -5
  12. package/dist/lib/daemon.js +65 -17
  13. package/dist/lib/git.d.ts +9 -0
  14. package/dist/lib/git.js +12 -0
  15. package/dist/lib/hosts/dispatch.d.ts +21 -0
  16. package/dist/lib/hosts/dispatch.js +88 -5
  17. package/dist/lib/permissions.d.ts +19 -1
  18. package/dist/lib/permissions.js +137 -0
  19. package/dist/lib/project-root.d.ts +65 -0
  20. package/dist/lib/project-root.js +133 -0
  21. package/dist/lib/resources/permissions.js +2 -0
  22. package/dist/lib/resources/types.d.ts +1 -1
  23. package/dist/lib/secrets/agent.d.ts +26 -23
  24. package/dist/lib/secrets/agent.js +196 -216
  25. package/dist/lib/secrets/remote.js +1 -0
  26. package/dist/lib/session/active.d.ts +3 -0
  27. package/dist/lib/session/active.js +1 -0
  28. package/dist/lib/session/parse.js +38 -15
  29. package/dist/lib/session/state.d.ts +4 -1
  30. package/dist/lib/session/state.js +18 -1
  31. package/dist/lib/session/types.d.ts +8 -0
  32. package/dist/lib/staleness/detectors/permissions.js +42 -0
  33. package/dist/lib/staleness/detectors/subagents.js +30 -0
  34. package/dist/lib/staleness/writers/subagents.js +13 -1
  35. package/dist/lib/subagents.d.ts +22 -0
  36. package/dist/lib/subagents.js +146 -0
  37. package/dist/lib/teams/agents.d.ts +14 -0
  38. package/dist/lib/teams/agents.js +158 -22
  39. package/dist/lib/types.d.ts +13 -0
  40. package/dist/lib/versions.d.ts +39 -0
  41. package/dist/lib/versions.js +199 -12
  42. package/package.json +1 -1
  43. package/scripts/postinstall.js +26 -11
@@ -386,23 +386,38 @@ function retargetManagedLinksToNativeBin() {
386
386
  async function healLongRunningProcesses() {
387
387
  if (process.platform !== 'darwin') return;
388
388
  if (process.env.CI || process.env.AGENTS_NO_HEAL === '1') return;
389
+
390
+ // Retire the legacy standalone secrets-agent service FIRST (#416 step 2) so
391
+ // that when the daemon (re)starts below its coexistence guard sees no
392
+ // standalone broker and hosts the broker socket itself. No-op if no legacy
393
+ // plist is present; never blocks.
394
+ let retiredLegacyBroker = false;
395
+ try {
396
+ const a = await import('../dist/lib/secrets/agent.js');
397
+ if (a.secretsAgentServiceInstalled?.()) {
398
+ a.retireLegacySecretsAgentService?.();
399
+ retiredLegacyBroker = true;
400
+ console.log(' Retired the standalone secrets-agent service — the daemon now hosts the broker.');
401
+ }
402
+ } catch { /* best effort */ }
403
+
389
404
  // Routines daemon: restart so it reloads new code (e.g. picks up keychain
390
- // read-memoization / broker fast-path that a stale daemon wouldn't have).
405
+ // read-memoization / broker fast-path that a stale daemon wouldn't have) and
406
+ // (re)hosts the broker socket now the legacy service is gone. If it wasn't
407
+ // running but we just retired a broker the user relied on, start it so the
408
+ // socket has a host.
391
409
  try {
392
410
  const d = await import('../dist/lib/daemon.js');
393
411
  if (d.isDaemonRunning?.()) {
394
412
  d.stopDaemon?.();
395
- d.startDaemon?.();
413
+ // This lifecycle script is process.argv[1] while npm is installing. Pin
414
+ // the restart to the installed CLI entrypoint so the service manifest
415
+ // never records scripts/postinstall.js as the daemon command.
416
+ d.startDaemon?.(AGENTS_BIN);
396
417
  console.log(' Restarted the routines daemon onto this version.');
397
- }
398
- } catch { /* best effort */ }
399
- // Persistent secrets-agent broker: kickstart so launchd relaunches it on the
400
- // new code. No-op if the service isn't installed; never blocks.
401
- try {
402
- const a = await import('../dist/lib/secrets/agent.js');
403
- if (a.secretsAgentServiceInstalled?.()) {
404
- a.kickstartSecretsAgentService?.();
405
- console.log(' Reloaded the secrets-agent service onto this version.');
418
+ } else if (retiredLegacyBroker) {
419
+ d.startDaemon?.(AGENTS_BIN);
420
+ console.log(' Started the daemon to host the secrets broker.');
406
421
  }
407
422
  } catch { /* best effort */ }
408
423
  }