@phnx-labs/agents-cli 1.20.89 → 1.20.90

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 (58) hide show
  1. package/CHANGELOG.md +240 -0
  2. package/README.md +6 -0
  3. package/dist/bin/agents +0 -0
  4. package/dist/commands/exec.js +7 -1
  5. package/dist/commands/harness.d.ts +27 -0
  6. package/dist/commands/harness.js +120 -13
  7. package/dist/commands/profiles.d.ts +3 -0
  8. package/dist/commands/profiles.js +1 -1
  9. package/dist/commands/routines.d.ts +19 -0
  10. package/dist/commands/routines.js +28 -6
  11. package/dist/commands/secrets.d.ts +10 -1
  12. package/dist/commands/secrets.js +18 -6
  13. package/dist/commands/sessions-browser.d.ts +4 -0
  14. package/dist/commands/sessions-browser.js +51 -9
  15. package/dist/commands/sessions-favorite.d.ts +20 -0
  16. package/dist/commands/sessions-favorite.js +120 -0
  17. package/dist/commands/sessions.d.ts +103 -20
  18. package/dist/commands/sessions.js +356 -62
  19. package/dist/commands/setup-secrets.d.ts +7 -0
  20. package/dist/commands/setup-secrets.js +12 -9
  21. package/dist/commands/versions.js +12 -4
  22. package/dist/commands/view.d.ts +14 -1
  23. package/dist/commands/view.js +103 -128
  24. package/dist/lib/agents.d.ts +4 -2
  25. package/dist/lib/agents.js +21 -6
  26. package/dist/lib/hosts/dispatch.js +19 -1
  27. package/dist/lib/hq/floor.js +12 -0
  28. package/dist/lib/menubar/MenubarHelper.app/Contents/MacOS/MenubarHelper +0 -0
  29. package/dist/lib/picker.d.ts +27 -2
  30. package/dist/lib/picker.js +71 -7
  31. package/dist/lib/profiles.d.ts +48 -0
  32. package/dist/lib/profiles.js +67 -0
  33. package/dist/lib/rotate.d.ts +24 -2
  34. package/dist/lib/rotate.js +63 -6
  35. package/dist/lib/secrets/Agents CLI.app/Contents/CodeResources +0 -0
  36. package/dist/lib/secrets/Agents CLI.app/Contents/MacOS/Agents CLI +0 -0
  37. package/dist/lib/session/active.d.ts +109 -3
  38. package/dist/lib/session/active.js +269 -13
  39. package/dist/lib/session/db.d.ts +14 -0
  40. package/dist/lib/session/db.js +35 -0
  41. package/dist/lib/session/favorites.d.ts +39 -0
  42. package/dist/lib/session/favorites.js +101 -0
  43. package/dist/lib/session/host-link.d.ts +68 -0
  44. package/dist/lib/session/host-link.js +64 -0
  45. package/dist/lib/session/presence.d.ts +85 -0
  46. package/dist/lib/session/presence.js +150 -0
  47. package/dist/lib/session/remote-list.d.ts +10 -0
  48. package/dist/lib/session/remote-list.js +47 -9
  49. package/dist/lib/tmux/binary.d.ts +7 -0
  50. package/dist/lib/tmux/binary.js +11 -1
  51. package/dist/lib/types.d.ts +4 -3
  52. package/dist/lib/usage-backoff.d.ts +29 -0
  53. package/dist/lib/usage-backoff.js +165 -0
  54. package/dist/lib/usage.d.ts +112 -5
  55. package/dist/lib/usage.js +464 -46
  56. package/dist/lib/watchdog/runner.d.ts +13 -0
  57. package/dist/lib/watchdog/runner.js +16 -1
  58. package/package.json +1 -1
@@ -29,6 +29,7 @@
29
29
  * synthetic sessions without a live terminal.
30
30
  */
31
31
  import type { ActiveSession } from '../session/active.js';
32
+ import { type PresenceTransition } from '../session/presence.js';
32
33
  import { type InjectRail } from '../terminal/resolve.js';
33
34
  import { type InjectResult, type InjectTarget } from '../terminal/inject.js';
34
35
  import { type StallStatus, type WatchdogCandidate } from './watchdog.js';
@@ -137,6 +138,18 @@ export interface WatchdogTickResult {
137
138
  unaddressable: number;
138
139
  skipped: number;
139
140
  };
141
+ /**
142
+ * RUSH-2007 Layer C: per-session presence reconciled from this tick's active
143
+ * scan. `transitions` carries only the sessions whose connect/disconnect status
144
+ * flipped this tick — an interactive drop is a reconnect-nudge candidate, a
145
+ * headless remote a keep-alive. Surfaced for the tray/status; does not alter the
146
+ * nudge decisions above.
147
+ */
148
+ presence: {
149
+ connected: number;
150
+ disconnected: number;
151
+ transitions: PresenceTransition[];
152
+ };
140
153
  }
141
154
  /**
142
155
  * On-disk per-session policy sentinel: `<stateDir>/policy/<sessionId>` whose
@@ -31,6 +31,7 @@
31
31
  import * as fs from 'fs';
32
32
  import * as path from 'path';
33
33
  import { getActiveSessions } from '../session/active.js';
34
+ import { reconcilePresence, loadPresence, savePresence, observedFromActive, } from '../session/presence.js';
34
35
  import { resolveInjectTargetForSession, } from '../terminal/resolve.js';
35
36
  import { injectIntoTerminal } from '../terminal/inject.js';
36
37
  import { classifyTerminal, isLikelyTrulyBlocked, renderWatchdogPrompt, parseWatchdogResponse, } from './watchdog.js';
@@ -268,6 +269,20 @@ export async function runWatchdogTick(opts = {}) {
268
269
  const openBlockFor = opts.openBlockFor ?? defaultOpenBlockFor;
269
270
  const injectFn = opts.injectFn ?? injectIntoTerminal;
270
271
  const sessions = opts.sessions ?? (await getActiveSessions());
272
+ // RUSH-2007 Layer C — reconcile per-session presence from this tick's active
273
+ // scan and persist it. Additive: it derives connect/disconnect from what this
274
+ // tick actually saw and surfaces the flips (interactive drop => reconnect-nudge
275
+ // candidate, headless remote => keep-alive) for the tray/status, without
276
+ // touching the nudge decisions below. Uses the tick's own session view (fleet-
277
+ // wide when the caller passes gatherRemoteActive results), so it adds no SSH
278
+ // fan-out of its own.
279
+ const presenceResult = reconcilePresence(loadPresence(dir), observedFromActive(sessions), nowMs);
280
+ savePresence(presenceResult.next, dir);
281
+ const presence = {
282
+ connected: Object.values(presenceResult.next).filter((r) => r.status === 'connected').length,
283
+ disconnected: Object.values(presenceResult.next).filter((r) => r.status === 'disconnected').length,
284
+ transitions: presenceResult.transitions,
285
+ };
271
286
  const ledger = readNudgeLedger(dir);
272
287
  // Cooldown timestamps this tick decided to (re)start — merged into the ledger
273
288
  // under a lock at the end so a concurrent tick's updates are never lost.
@@ -483,7 +498,7 @@ export async function runWatchdogTick(opts = {}) {
483
498
  unaddressable: outcomes.filter((o) => o.addressable === false).length,
484
499
  skipped: outcomes.filter((o) => o.decision === 'skip').length,
485
500
  };
486
- const result = { atMs: nowMs, didNudge: opts.nudge === true, outcomes, counts };
501
+ const result = { atMs: nowMs, didNudge: opts.nudge === true, outcomes, counts, presence };
487
502
  writeJsonFile(path.join(dir, 'last-tick.json'), result);
488
503
  // Heartbeat + decision/nudge events to the canonical watchdog.log the Factory
489
504
  // Floor reads. Best-effort; never throws into the tick.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@phnx-labs/agents-cli",
3
- "version": "1.20.89",
3
+ "version": "1.20.90",
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",