@phnx-labs/agents-cli 1.23.26 → 1.23.27

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.27
4
+
5
+ - **A Claude session started in a symlinked folder shows its real state (PHNX-4387).** `agents ps` and the session feed looked for the transcript under the folder's path as typed, while Claude stores it under the folder's real path, so such a session showed "Running · no transcript" forever. They now look under both and take the newest; `agents run` and project memory sync use the real path too. Source: `cli/src/lib/session/active.ts`, `cli/src/lib/project-key.ts`, `cli/src/lib/exec.ts`, `cli/src/lib/memory.ts`.
6
+
3
7
  ## 1.23.26
4
8
 
5
9
  - **`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`.
package/dist/lib/exec.js CHANGED
@@ -42,7 +42,7 @@ import { claudeWorkerLoginTrapPreflight } from './harness/adapters/claude.js';
42
42
  import { resolveConfigVersion } from './harness/exec-config-version.js';
43
43
  import { getAccountInfo } from './agents.js';
44
44
  import { getUsageLookupKey, noteClaudeSessionLimit, noteClaudeOutOfCredits, clearClaudeAccountRefusal, parseClaudeSessionLimitReset, noteClaudeModelRefusal, clearClaudeModelRefusal, parseClaudeModelRefusal, claudeModelRefusalKey, } from './accounting/usage.js';
45
- import { claudeProjectDirName } from './project-key.js';
45
+ import { claudeProjectDirName, realCwd } from './project-key.js';
46
46
  import { bootMark, flushBootProfile } from './boot-profile.js';
47
47
  export function normalizeMode(input) {
48
48
  if (!input) {
@@ -1061,7 +1061,7 @@ async function spawnAgent(options) {
1061
1061
  const home = resolveExecConfigHome(options).versionHome;
1062
1062
  const modelKey = claudeModelRefusalKey(options.accountId, home);
1063
1063
  const transcript = options.agent === 'claude' && home && options.sessionId
1064
- ? path.join(home, '.claude', 'projects', claudeProjectDirName(options.cwd || process.cwd()), `${options.sessionId}.jsonl`)
1064
+ ? path.join(home, '.claude', 'projects', claudeProjectDirName(realCwd(options.cwd || process.cwd())), `${options.sessionId}.jsonl`)
1065
1065
  : undefined;
1066
1066
  let offset = transcript && fs.existsSync(transcript) ? fs.statSync(transcript).size : 0;
1067
1067
  const observeTranscript = () => {
@@ -3,7 +3,7 @@ import * as path from 'path';
3
3
  import { getUserAgentsDir, getSystemAgentsDir, getProjectAgentsDir, ensureAgentsDir, getRuntimeStateDir, } from './state.js';
4
4
  import { agentConfigDirName } from './agents.js';
5
5
  import { supports } from './capabilities.js';
6
- import { claudeProjectDirName } from './project-key.js';
6
+ import { claudeProjectDirName, realCwd } from './project-key.js';
7
7
  export function getUserMemoryDir() {
8
8
  return path.join(getUserAgentsDir(), 'memory');
9
9
  }
@@ -249,7 +249,7 @@ export function getClaudeProjectMemoryDir(cwd) {
249
249
  export function syncClaudeProjectMemoryDir(versionHome, cwd = process.cwd()) {
250
250
  const projectKey = claudeProjectDirName(path.resolve(cwd));
251
251
  const canonicalDir = path.join(getRuntimeStateDir(), 'claude-project-memory', projectKey);
252
- const projectDir = path.join(versionHome, agentConfigDirName('claude'), 'projects', projectKey);
252
+ const projectDir = path.join(versionHome, agentConfigDirName('claude'), 'projects', claudeProjectDirName(realCwd(path.resolve(cwd))));
253
253
  const nativeMemoryDir = path.join(projectDir, 'memory');
254
254
  fs.mkdirSync(canonicalDir, { recursive: true, mode: 0o700 });
255
255
  let existing;
@@ -1,4 +1,5 @@
1
1
  export declare function claudeProjectDirName(cwd: string): string;
2
+ export declare function realCwd(cwd: string): string;
2
3
  export declare function projectKeyFromCwd(cwd?: string | null): string | undefined;
3
4
  export declare function repoRootForCwd(dir: string, home?: string): string | undefined;
4
5
  export declare function repoAgentsDirForCwd(cwd?: string | null, home?: string): string | undefined;
@@ -5,6 +5,14 @@ const WORKTREE_SEGMENT = '/.agents/worktrees/';
5
5
  export function claudeProjectDirName(cwd) {
6
6
  return cwd.replace(/[/.]/g, '-');
7
7
  }
8
+ export function realCwd(cwd) {
9
+ try {
10
+ return fs.realpathSync(cwd);
11
+ }
12
+ catch {
13
+ return cwd;
14
+ }
15
+ }
8
16
  export function projectKeyFromCwd(cwd) {
9
17
  if (!cwd)
10
18
  return undefined;
@@ -34,7 +34,7 @@ import { classifyHostLink, hostWindowLost, HOST_HEARTBEAT_STALE_MS } from './hos
34
34
  import { mapBounded } from '../concurrency.js';
35
35
  import { linearIssueUrl } from '@phnx-labs/sessions-cli/reader';
36
36
  import { viewingInLabel } from './viewing-in.js';
37
- import { claudeProjectDirName } from '../project-key.js';
37
+ import { claudeProjectDirName, realCwd } from '../project-key.js';
38
38
  import { gatherRemoteActive, NO_FANOUT_ENV } from './remote-active.js';
39
39
  import { hostToken, remoteHostsToDial, shouldIncludeLocal } from './remote-list.js';
40
40
  const execFileAsync = promisify(execFile);
@@ -450,21 +450,23 @@ function findClaudeSessionFile(cwd, sessionId) {
450
450
  return pickClaudeSessionFileAcrossRoots(getAgentSessionDirs('claude', 'projects'), cwd, sessionId);
451
451
  }
452
452
  export function pickClaudeSessionFileAcrossRoots(projectRoots, cwd, sessionId) {
453
- const enc = claudeProjectDirName(cwd);
453
+ const encs = [...new Set([cwd, realCwd(cwd)].map(claudeProjectDirName))];
454
454
  let best;
455
455
  for (const root of projectRoots) {
456
- const hit = pickSessionFile(path.join(root, enc), sessionId);
457
- if (!hit)
458
- continue;
459
- let mtime;
460
- try {
461
- mtime = fs.statSync(hit).mtimeMs;
462
- }
463
- catch {
464
- continue;
456
+ for (const enc of encs) {
457
+ const hit = pickSessionFile(path.join(root, enc), sessionId);
458
+ if (!hit)
459
+ continue;
460
+ let mtime;
461
+ try {
462
+ mtime = fs.statSync(hit).mtimeMs;
463
+ }
464
+ catch {
465
+ continue;
466
+ }
467
+ if (!best || mtime > best.mtime)
468
+ best = { path: hit, mtime };
465
469
  }
466
- if (!best || mtime > best.mtime)
467
- best = { path: hit, mtime };
468
470
  }
469
471
  return best?.path;
470
472
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@phnx-labs/agents-cli",
3
- "version": "1.23.26",
3
+ "version": "1.23.27",
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",