@phnx-labs/agents-cli 1.23.26 → 1.23.28

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,13 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.23.28
4
+
5
+ - **A folder two projects claim equally belongs to neither.** When two projects share the deepest root that holds a folder (rush and prix both rooted at one monorepo), `agents projects view`/`status --path` and session attribution now answer no project there instead of whichever project file sorts first, so the AGI EXT Project panel asks you to pick rather than quietly showing the wrong one. Each project's own `defaultPath` still resolves to it. Source: cli/src/lib/projects.ts
6
+
7
+ ## 1.23.27
8
+
9
+ - **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`.
10
+
3
11
  ## 1.23.26
4
12
 
5
13
  - **`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;
@@ -327,25 +327,23 @@ export function projectNameForCwd(cwd, defs) {
327
327
  if (!cwd)
328
328
  return undefined;
329
329
  const abs = path.resolve(localizeHome(expandLocalHome(cwd)));
330
- let best;
331
- let bestLen = -1;
332
- let weakBest;
333
- let weakLen = -1;
334
- for (const { name, abs: root, weak } of projectRootsAbs(defs)) {
335
- if (!isUnder(abs, root))
336
- continue;
337
- if (weak) {
338
- if (root.length > weakLen) {
339
- weakBest = name;
340
- weakLen = root.length;
330
+ const deepest = (weak) => {
331
+ let name;
332
+ let len = -1;
333
+ for (const r of projectRootsAbs(defs)) {
334
+ if (!!r.weak !== weak || !isUnder(abs, r.abs))
335
+ continue;
336
+ if (r.abs.length > len) {
337
+ name = r.name;
338
+ len = r.abs.length;
341
339
  }
340
+ else if (r.abs.length === len && r.name !== name)
341
+ name = undefined;
342
342
  }
343
- else if (root.length > bestLen) {
344
- best = name;
345
- bestLen = root.length;
346
- }
347
- }
348
- return best ?? weakBest;
343
+ return { name, len };
344
+ };
345
+ const strong = deepest(false);
346
+ return strong.len >= 0 ? strong.name : deepest(true).name;
349
347
  }
350
348
  let projectDefsMemo = null;
351
349
  function projectDefsStamp() {
@@ -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.28",
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",