@phnx-labs/agents-cli 1.23.25 → 1.23.26

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.23.26
4
+
5
+ - **`agents ps` says how long a working Claude turn has been quiet (PHNX-4387).** The list row shows `quiet Nm` where it showed `idle Nm` for a turn Claude reports busy, including one whose transcript tail holds only request records (Claude 2.1.261 appends 100+ KB of them after a step), where no quiet time was shown. `agents ps --json` carries `quietSinceMs`, when the turn went silent, in place of `quietMs`: a timestamp is stable across polls, so a quiet row no longer rewrites the active-sessions journal on every poll, and the age is computed when it is shown. Source: `cli/src/lib/session/active.ts`, `cli/src/commands/ps-roster.ts`, `cli/src/lib/session/presentation.ts`.
6
+
3
7
  ## 1.23.25
4
8
 
5
9
  - **A Claude turn quiet for over two minutes stays `running` in `agents ps`.** Claude writes nothing to its transcript while it thinks or streams one long tool call, so a live turn turned idle after two minutes. agents-cli now passes the turn state Claude Code records in `<config>/sessions/<pid>.json` (`busy` / `idle`) to the state engine (`@phnx-labs/sessions-cli` 0.8.6): `busy` is `running`, `idle` is `idle`, and other harnesses keep the two-minute window. `agents ps --json` rows carry `quietMs` once a running turn has been silent past two minutes, and `agents ps <id>` shows `quiet Nm` beside `working`. Source: `cli/src/lib/session/active.ts`, `cli/src/lib/session/presentation.ts`.
@@ -96,7 +96,9 @@ function activeTimeCell(s) {
96
96
  const parts = [];
97
97
  if (s.startedAtMs)
98
98
  parts.push(`created ${formatCompactAge(new Date(s.startedAtMs).toISOString())}`);
99
- if (s.lastActivityMs)
99
+ if (s.activity === 'working' && s.quietSinceMs != null)
100
+ parts.push(`quiet ${formatCompactAge(new Date(s.quietSinceMs).toISOString())}`);
101
+ else if (s.lastActivityMs)
100
102
  parts.push(`idle ${formatCompactAge(new Date(s.lastActivityMs).toISOString())}`);
101
103
  return parts.join(' · ');
102
104
  }
@@ -124,7 +124,7 @@ export interface ActiveSession {
124
124
  accountLabel?: string;
125
125
  lastActivityMs?: number;
126
126
  lastEventMs?: number;
127
- quietMs?: number;
127
+ quietSinceMs?: number;
128
128
  status: ActiveStatus;
129
129
  phase?: SessionPhase;
130
130
  origin?: 'cli' | 'routine';
@@ -198,8 +198,11 @@ export declare function lifecycleStatus(pidAlive: boolean, mtimeMs: number | und
198
198
  export declare function resolveFallbackStatus(sessionFile: string | undefined, pidAlive: boolean, nowMs?: number): ActiveStatus;
199
199
  export declare function findSessionFileForKind(kind: string, cwd?: string, sessionId?: string): string | undefined;
200
200
  export declare function sessionIdFromFile(kind: string, file?: string): string | undefined;
201
+ type LiveState = SessionState & {
202
+ quietSinceMs?: number;
203
+ };
201
204
  interface LiveSignals {
202
- state?: SessionState;
205
+ state?: LiveState;
203
206
  tokPerSec?: number;
204
207
  }
205
208
  export declare function clearLiveSignalsCacheForTest(): void;
@@ -591,6 +591,11 @@ export function computeLiveSignals(kind, sessionFile, cwd, pidAlive, nowMs = Dat
591
591
  if (tail.events.length === 0 && harnessStatus !== 'busy')
592
592
  return {};
593
593
  const state = inferSessionState(tail.events, { cwd, pidAlive, mtimeMs, harnessStatus, activeWindowMs: ACTIVE_MTIME_WINDOW_MS, nowMs });
594
+ if (harnessStatus === 'busy' && state.activity === 'working') {
595
+ const quietSinceMs = state.quietMs != null ? nowMs - state.quietMs : tail.events.length === 0 ? mtimeMs : undefined;
596
+ if (quietSinceMs != null && nowMs - quietSinceMs >= ACTIVE_MTIME_WINDOW_MS)
597
+ state.quietSinceMs = quietSinceMs;
598
+ }
594
599
  return { state, tokPerSec: tail.tokPerSec };
595
600
  }
596
601
  function statusFromActivity(activity) {
@@ -611,7 +616,7 @@ function applyState(base, state, fallbackFile, pidAlive) {
611
616
  awaitingReason: state.awaitingReason,
612
617
  question: state.question,
613
618
  lastEventMs: state.lastEventMs,
614
- quietMs: state.quietMs,
619
+ quietSinceMs: state.quietSinceMs,
615
620
  plan: state.plan,
616
621
  todos: state.todos,
617
622
  tail: state.tail,
@@ -9,7 +9,7 @@ import { homeDir, toComparablePath } from '../platform/index.js';
9
9
  import { redactSecrets, sanitizeForTerminal } from '../redact.js';
10
10
  import { listBookmarks } from './bookmarks.js';
11
11
  import { readArchivedSessionPreview, readSessionContent, readSessionTimelineAny } from './db.js';
12
- import { formatRelativeTime, sessionAgeParts } from './relative-time.js';
12
+ import { formatCompactAge, formatRelativeTime, sessionAgeParts } from './relative-time.js';
13
13
  import { ticketLabel } from './selection.js';
14
14
  import { sessionHeadline } from './title.js';
15
15
  import { padToWidth, stringWidth, terminalWidth, truncateToWidth } from './width.js';
@@ -340,8 +340,8 @@ export function formatLiveStatusHeadline(live, bookmarked = false) {
340
340
  const needsYou = isAwaitingUser(live);
341
341
  const reason = live.awaitingReason ? ` (${live.awaitingReason.replace('_', ' ')})` : '';
342
342
  let suffix = needsYou ? chalk.yellow(` ← needs you${reason}`) : '';
343
- if (word === 'working' && live.quietMs != null)
344
- suffix = chalk.dim(` quiet ${Math.floor(live.quietMs / 60_000)}m`);
343
+ if (word === 'working' && live.quietSinceMs != null)
344
+ suffix = chalk.dim(` quiet ${formatCompactAge(new Date(live.quietSinceMs).toISOString())}`);
345
345
  if (live.status === 'crashed') {
346
346
  suffix = chalk.redBright(' ← the host app or connection went away and took the agent with it');
347
347
  }
@@ -38,7 +38,7 @@ interface ImmutableSessionFields {
38
38
  context?: ActiveSession['context'];
39
39
  }
40
40
  export declare const IMMUTABLE_FIELD_KEYS: readonly ["topic", "firstUserMessage", "label", "name", "cwd", "project", "attachments", "startedAtMs", "version", "pr", "worktree", "ticket", "createdTickets", "spawnedTeam", "sessionFile", "owner", "assignedTask", "kind", "context"];
41
- export declare const LIVE_STATUS_KEYS: readonly ["status", "activity", "model", "failures", "activityHistogram", "userTurns", "subagents", "pending", "effort", "fast", "preview", "tokPerSec", "awaitingReason", "question", "todos", "tail", "lastActivityMs", "lastEventMs", "hostLink", "presence", "pidAlive", "tmuxClients", "windowHeartbeatMs", "provenance", "rateLimited", "plan"];
41
+ export declare const LIVE_STATUS_KEYS: readonly ["status", "activity", "model", "failures", "activityHistogram", "userTurns", "subagents", "pending", "effort", "fast", "preview", "tokPerSec", "awaitingReason", "question", "todos", "tail", "lastActivityMs", "lastEventMs", "quietSinceMs", "hostLink", "presence", "pidAlive", "tmuxClients", "windowHeartbeatMs", "provenance", "rateLimited", "plan"];
42
42
  export declare const ACTIVE_SESSIONS_READER_IDLE_WINDOW_MS = 45000;
43
43
  export declare function setActiveSessionsSnapshotPathForTest(p: string | null): string | null;
44
44
  export declare function clearActiveSnapshotMemoryForTest(): void;
@@ -61,6 +61,7 @@ export const LIVE_STATUS_KEYS = [
61
61
  'tail',
62
62
  'lastActivityMs',
63
63
  'lastEventMs',
64
+ 'quietSinceMs',
64
65
  'hostLink',
65
66
  'presence',
66
67
  'pidAlive',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@phnx-labs/agents-cli",
3
- "version": "1.23.25",
3
+ "version": "1.23.26",
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",