@phnx-labs/agents-cli 1.23.8 → 1.23.10

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.10
4
+
5
+ - **A desktop tab showing a session that runs on another machine is listed once, as that session.** An ssh tab opened by `agents sessions resume` (AGI EXT opens remote sessions this way) used to appear in `agents feed watch` and `agents ps` as a second session on the desktop with status `unknown` and nothing to read, beside the real one on the worker. The resume hop now records the owner machine for its tab, and the stream projection folds a tab with no transcript of its own into the device that reports the session's transcript, so the tab shows up in that session's `observerTerminals`. Tabs opened before this release fold in the same way. Source: `cli/src/commands/resume.ts`, `cli/src/lib/session/active.ts`, `cli/src/lib/session/projection.ts`.
6
+
7
+ ## 1.23.9
8
+
9
+ - Session status no longer reads an idle session as working: the bundled sessions reader moves to 0.8.3, which judges working vs idle by event timestamps instead of the transcript's file time (Claude's bookkeeping writes kept old sessions looking active). Formats without per-line timestamps (grok, cursor) still date their last event by the file time, so a waiting grok question still reads as waiting.
10
+
3
11
  ## 1.23.8
4
12
 
5
13
  - **AGI Menu config keys for the Linear tab, Sessions kinds and ticket grouping (PHNX-4326).** `tabOrder`/`hiddenTabs` accept `linear`; new `menubar.menu.showBrowserSessions` and `showComputerSessions` (default `true`) and `menubar.menu.ticketGroup` (default `none`; reads `milestone` while the superseded `groupTicketsByMilestone` is on). Source: `cli/src/lib/device-config.ts`, `cli/src/lib/menubar/snapshot.ts`.
@@ -4,7 +4,8 @@ import { resolveSessionMetadataValue } from '../lib/session/selection.js';
4
4
  import { sessionOwnerDevice, consumeResumePinned, RESUME_PINNED_ENV } from '../lib/session/resume-owner.js';
5
5
  import { machineId } from '../lib/machine-id.js';
6
6
  import { takeOverDetachedSession } from '../lib/session/detached.js';
7
- import { liveSessionProcesses } from '../lib/session/pid-registry.js';
7
+ import { liveSessionProcesses, writePidSessionEntry } from '../lib/session/pid-registry.js';
8
+ import { launchIdentityEnv } from '../lib/launch-identity.js';
8
9
  const RESUME_SOURCE_ENV = 'AGENTS_RESUME_SOURCE_JSON';
9
10
  export function resumeLocalFallbackSource(session, self = machineId()) {
10
11
  return { ...session, machine: self };
@@ -103,6 +104,15 @@ export async function runStrictResume(sessionId, prompt, options) {
103
104
  if (!options.quiet) {
104
105
  process.stderr.write(chalk.gray(`[agents] session ${outcome.session.shortId} belongs to ${owner} → resuming there\n`));
105
106
  }
107
+ writePidSessionEntry({
108
+ pid: process.pid,
109
+ agent: outcome.session.agent,
110
+ sessionId: outcome.session.id,
111
+ cwd: outcome.session.cwd,
112
+ terminalId: launchIdentityEnv().AGENT_TERMINAL_ID,
113
+ machine: owner,
114
+ startedAtMs: Date.now(),
115
+ });
106
116
  const { runOnPeer } = await import('../lib/session/remote-list.js');
107
117
  const rc = await runOnPeer(buildResumeRemoteArgs(outcome.session.id, prompt, options), owner, {
108
118
  tty: !!process.stdout.isTTY,
@@ -201,6 +201,10 @@ export declare function listTeamsActive(opts?: {
201
201
  localOnly?: boolean;
202
202
  }): Promise<ActiveSession[]>;
203
203
  export declare function listTerminalsActive(): Promise<ActiveSession[]>;
204
+ export declare function relayedTo(entry: Pick<PidSessionEntry, 'machine'> | undefined, self: string): {
205
+ machine?: string;
206
+ offloadedFrom?: string;
207
+ };
204
208
  interface ProcRow {
205
209
  pid: number;
206
210
  ppid: number;
@@ -718,6 +718,7 @@ export async function listTerminalsActive() {
718
718
  const children = childrenByParent(new Map([...procByPid.values()].map(r => [r.pid, r.ppid])));
719
719
  const labelMap = buildClaudeLabelMap();
720
720
  const runNameMap = buildRunNameMap();
721
+ const self = machineId();
721
722
  return entries.flatMap((t) => {
722
723
  const directEntry = readPidSessionEntry(t.pid, procByPid.get(t.pid)?.startTime);
723
724
  const candidate = directEntry?.sessionId ? directEntry
@@ -758,9 +759,13 @@ export async function listTerminalsActive() {
758
759
  workspaceDir: t.cwd ?? undefined,
759
760
  windowHeartbeatMs: t.windowHeartbeatMs,
760
761
  owner: resolveOwner(pidEntry?.actor, resolvedId),
762
+ ...relayedTo(pidEntry, self),
761
763
  }, state, sessionFile, pidAlive)];
762
764
  });
763
765
  }
766
+ export function relayedTo(entry, self) {
767
+ return entry?.machine && entry.machine !== self ? { machine: entry.machine, offloadedFrom: self } : {};
768
+ }
764
769
  function listCloudActive() {
765
770
  let tasks;
766
771
  try {
@@ -11,6 +11,7 @@ export interface PidSessionEntry {
11
11
  terminalId?: string;
12
12
  originTerminal?: LaunchOrigin;
13
13
  tmuxPane?: string;
14
+ machine?: string;
14
15
  startedAtMs: number;
15
16
  processIdentity?: {
16
17
  bootId?: string;
@@ -240,9 +240,9 @@ export function listPidSessionEntries() {
240
240
  }
241
241
  export function liveSessionProcesses(sessionId) {
242
242
  return listPidSessionEntries()
243
- .filter((entry) => entry.sessionId === sessionId)
243
+ .filter((entry) => entry.sessionId === sessionId && !entry.machine)
244
244
  .map((entry) => readLivePidSessionEntry(entry.pid))
245
- .filter((entry) => entry?.sessionId === sessionId);
245
+ .filter((entry) => entry?.sessionId === sessionId && !entry.machine);
246
246
  }
247
247
  export function prunePidSessionRegistry(isAlive) {
248
248
  let files;
@@ -25,12 +25,24 @@ export class SessionProjection {
25
25
  if (event.type === 'scope' || event.type === 'heartbeat') {
26
26
  return [{ ...event, ...stamp(), scope }];
27
27
  }
28
+ const runsIt = new Map();
29
+ for (const [observer, rows] of this.observations)
30
+ for (const row of rows.values()) {
31
+ if (row.sessionId && row.sessionFile && normalizeHost(row.machine || row.sourceDevice || observer) === observer)
32
+ runsIt.set(`${row.kind}\0${row.sessionId}`, observer);
33
+ }
34
+ const ownerOf = (observer, row) => {
35
+ const own = normalizeHost(row.machine || row.sourceDevice || observer);
36
+ if (row.sessionFile || !row.terminalId || !row.sessionId)
37
+ return own;
38
+ return runsIt.get(`${row.kind}\0${row.sessionId}`) ?? own;
39
+ };
28
40
  const launchSessions = new Map();
29
41
  for (const [observer, rows] of this.observations)
30
42
  for (const row of rows.values()) {
31
43
  if (!row.launchId || !row.sessionId)
32
44
  continue;
33
- const owner = normalizeHost(row.machine || row.sourceDevice || observer);
45
+ const owner = ownerOf(observer, row);
34
46
  const launch = `${owner}\0${row.kind}\0${row.launchId}`;
35
47
  const ids = launchSessions.get(launch) ?? new Set();
36
48
  ids.add(row.sessionId);
@@ -39,7 +51,7 @@ export class SessionProjection {
39
51
  const groups = new Map();
40
52
  for (const [observer, rows] of this.observations)
41
53
  for (const row of rows.values()) {
42
- const owner = normalizeHost(row.machine || row.sourceDevice || observer);
54
+ const owner = ownerOf(observer, row);
43
55
  const launchIds = row.launchId ? launchSessions.get(`${owner}\0${row.kind}\0${row.launchId}`) : undefined;
44
56
  const sessionId = row.sessionId || (launchIds?.size === 1 ? [...launchIds][0] : undefined);
45
57
  const identity = sessionId ? `${row.kind}\0${sessionId}` : `${observer}\0${row.rowKey}`;
@@ -51,7 +63,7 @@ export class SessionProjection {
51
63
  const next = new Map();
52
64
  const selected = new Map();
53
65
  for (const [rowKey, observations] of groups) {
54
- const owner = normalizeHost(observations[0].row.machine || observations[0].row.sourceDevice || observations[0].scope);
66
+ const owner = ownerOf(observations[0].scope, observations[0].row);
55
67
  const authoritative = observations.filter(item => item.scope === owner);
56
68
  const candidates = authoritative.length ? authoritative : this.observations.has(owner) ? [] : observations;
57
69
  candidates.sort((a, b) => Number(a.row.previous) - Number(b.row.previous)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@phnx-labs/agents-cli",
3
- "version": "1.23.8",
3
+ "version": "1.23.10",
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",
@@ -87,7 +87,7 @@
87
87
  "@fontsource/inter": "^5.3.0",
88
88
  "@fontsource/jetbrains-mono": "^5.3.0",
89
89
  "@inquirer/prompts": "8.5.2",
90
- "@phnx-labs/sessions-cli": "0.8.0",
90
+ "@phnx-labs/sessions-cli": "0.8.3",
91
91
  "@resvg/resvg-wasm": "^2.6.2",
92
92
  "@types/proper-lockfile": "4.1.4",
93
93
  "@zed-industries/agent-client-protocol": "0.4.5",