@phnx-labs/agents-cli 1.23.31 → 1.23.32
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 +4 -0
- package/dist/lib/session/active.d.ts +2 -1
- package/dist/lib/session/active.js +6 -1
- package/dist/lib/session/db.d.ts +1 -1
- package/dist/lib/session/db.js +17 -3
- package/dist/lib/session/discover.d.ts +13 -4
- package/dist/lib/session/discover.js +47 -37
- package/dist/lib/session/remote/watch.js +2 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.23.32
|
|
4
|
+
|
|
5
|
+
- **A session row lists every PR the session opened (#3989).** The session index records each PR a Claude or Codex session created (`pr_urls`, schema v53), not only the first, and live and ended rows read it as `prs`, so a long session whose PR creations scrolled out of its transcript tail still lists them all. Upgrading re-parses only the transcripts of sessions that already have a PR. Source: cli/src/lib/session/discover.ts, cli/src/lib/session/db.ts, cli/src/lib/session/active.ts
|
|
6
|
+
|
|
3
7
|
## 1.23.31
|
|
4
8
|
|
|
5
9
|
- **A session row's `title` is the one name to show, and a fork says it is one.** `title` on `agents ps --json`, `agents ps watch --json` and `agents feed watch --json` (live and history rows) is never Claude's `<folder>-<n>` placeholder such as "agents-92" or "agents-1f", never the `[host/<device>]` fallback, and never an injected note, sub-agent hand-back or bare slash command; it falls through to the next usable name instead of going empty. A session started by `agents fork` carries `forkOf` (the source session id) and, until it has a name of its own, the source's name as its `title` instead of "fork of …". `agents fork` no longer launches an unnamed fork with `--name "fork of …"`, so the harness's own title takes over once it writes one; `--name` still names it. Source: `cli/src/lib/session/title.ts`, `cli/src/lib/session/fork.ts`, `cli/src/lib/session/active.ts`, `cli/src/lib/session/remote/watch.ts`, `cli/src/commands/fork.ts`.
|
|
@@ -21,7 +21,8 @@ export declare function unattributedFullRescanCountForTest(): number;
|
|
|
21
21
|
export declare function attributedSetLostPids(prev: Set<number>, next: Set<number>): boolean;
|
|
22
22
|
export declare function filterCachedUnattributed(sessions: ActiveSession[], attributed: Set<number>, alive: (pid: number, processStartedAtMs?: number) => boolean, ppidMap?: Map<number, number>): ActiveSession[];
|
|
23
23
|
export type ActiveContext = 'terminal' | 'teams' | 'cloud' | 'headless';
|
|
24
|
-
type BackfillMeta = Pick<SessionMeta, 'version' | 'account' | 'accountId' | 'accountKey' | 'timestamp' | 'label' | 'firstUserMessage' | 'lastUserMessage' | 'generatedTitle' | 'ticketId' | 'prUrl' | 'prNumber' | 'harness' | 'tokenCount' | 'durationMs' | 'subAgentCount' | 'lastActivity'>;
|
|
24
|
+
type BackfillMeta = Pick<SessionMeta, 'version' | 'account' | 'accountId' | 'accountKey' | 'timestamp' | 'label' | 'firstUserMessage' | 'lastUserMessage' | 'generatedTitle' | 'ticketId' | 'prUrl' | 'prNumber' | 'prUrls' | 'harness' | 'tokenCount' | 'durationMs' | 'subAgentCount' | 'lastActivity'>;
|
|
25
|
+
export declare function prsFromUrls(urls: string[]): DetectedPr[];
|
|
25
26
|
export declare function backfillActiveRowsFromMeta(sessions: ActiveSession[], metaById: Map<string, BackfillMeta>): void;
|
|
26
27
|
export declare function applySessionNames(sessions: ActiveSession[]): void;
|
|
27
28
|
export declare function sessionAccountLabel(kind: string, session: Pick<SessionMeta, 'accountId' | 'accountKey' | 'account'>, accounts?: import("../account-registry.js").NativeAccount[]): string | undefined;
|
|
@@ -21,7 +21,7 @@ import { forkSourceOf } from './fork.js';
|
|
|
21
21
|
import { getIndexedSessionNames, latestSessionFileForCwd, indexedSessionIdForFile, findSessionsByShortIds, findSessionMachinesByIds, getSessionById } from './db.js';
|
|
22
22
|
import { extractSessionTopic, classifyUserPrompt, tidyRequest } from '@phnx-labs/sessions-cli/reader';
|
|
23
23
|
import { readSessionTailWithRaw } from '@phnx-labs/sessions-cli/reader';
|
|
24
|
-
import { parseSession } from '@phnx-labs/sessions-cli/reader';
|
|
24
|
+
import { parseSession, extractPrUrl } from '@phnx-labs/sessions-cli/reader';
|
|
25
25
|
import { computeTokPerSec } from './throughput.js';
|
|
26
26
|
import { inferSessionState, readHarnessStatus } from '@phnx-labs/sessions-cli/reader';
|
|
27
27
|
import { isSessionTrackedAgent, SESSION_AGENTS, AG_TMUX_NAME_RE } from '@phnx-labs/sessions-cli/reader';
|
|
@@ -85,6 +85,9 @@ export function filterCachedUnattributed(sessions, attributed, alive, ppidMap) {
|
|
|
85
85
|
return alive(s.pid, s.processStartedAtMs);
|
|
86
86
|
});
|
|
87
87
|
}
|
|
88
|
+
export function prsFromUrls(urls) {
|
|
89
|
+
return urls.map((url) => extractPrUrl(url) ?? { url });
|
|
90
|
+
}
|
|
88
91
|
export function backfillActiveRowsFromMeta(sessions, metaById) {
|
|
89
92
|
const accounts = listNativeAccounts(readMeta());
|
|
90
93
|
for (const s of sessions) {
|
|
@@ -110,6 +113,8 @@ export function backfillActiveRowsFromMeta(sessions, metaById) {
|
|
|
110
113
|
s.ticket = { id: m.ticketId, url: linearIssueUrl(m.ticketId) };
|
|
111
114
|
if (!s.pr && m.prUrl)
|
|
112
115
|
s.pr = { url: m.prUrl, number: m.prNumber };
|
|
116
|
+
if (m.prUrls && m.prUrls.length > (s.prs?.length ?? 0))
|
|
117
|
+
s.prs = prsFromUrls(m.prUrls);
|
|
113
118
|
if (!s.startedAtMs && m.timestamp) {
|
|
114
119
|
const ts = new Date(m.timestamp).getTime();
|
|
115
120
|
if (!Number.isNaN(ts))
|
package/dist/lib/session/db.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import type { SessionRecap } from './title.js';
|
|
|
4
4
|
import { type IndexedToolCall } from '@phnx-labs/sessions-cli/reader';
|
|
5
5
|
import { type ToolScanResumePoint } from './tool-store.js';
|
|
6
6
|
import { type TimelineState } from '@phnx-labs/sessions-cli/reader';
|
|
7
|
-
export declare const SCHEMA_VERSION =
|
|
7
|
+
export declare const SCHEMA_VERSION = 53;
|
|
8
8
|
export declare const CONTENT_INDEX_VERSION = 8;
|
|
9
9
|
export declare const INSIGHTS_EXTRACTOR_VERSION = 7;
|
|
10
10
|
export declare const SESSION_SUMMARY_EXTRACTOR_VERSION = 1;
|
package/dist/lib/session/db.js
CHANGED
|
@@ -18,7 +18,7 @@ import { firstUserMessageFromEvents, lastUserMessageFromEvents } from '@phnx-lab
|
|
|
18
18
|
import { emptyTimelineState, TIMELINE_EXTRACTOR_VERSION } from '@phnx-labs/sessions-cli/reader';
|
|
19
19
|
const SESSIONS_DIR = getSessionsDir();
|
|
20
20
|
const DB_PATH = getSessionsDbPath();
|
|
21
|
-
export const SCHEMA_VERSION =
|
|
21
|
+
export const SCHEMA_VERSION = 53;
|
|
22
22
|
export const CONTENT_INDEX_VERSION = 8;
|
|
23
23
|
const RESOURCE_INDEX_VERSION = 2;
|
|
24
24
|
function canonicalLedgerKey(filePath) {
|
|
@@ -74,6 +74,7 @@ CREATE TABLE IF NOT EXISTS sessions (
|
|
|
74
74
|
is_team_origin INTEGER DEFAULT 0,
|
|
75
75
|
pr_url TEXT,
|
|
76
76
|
pr_number INTEGER,
|
|
77
|
+
pr_urls TEXT,
|
|
77
78
|
worktree_slug TEXT,
|
|
78
79
|
ticket_id TEXT,
|
|
79
80
|
spawned_team TEXT,
|
|
@@ -1031,6 +1032,15 @@ function migrateSchema(db, fromVersion) {
|
|
|
1031
1032
|
`);
|
|
1032
1033
|
db.exec(`DELETE FROM session_resource_usage WHERE plugin IS NOT NULL AND plugin <> '' AND instr(name, ':') = 0`);
|
|
1033
1034
|
}
|
|
1035
|
+
if (fromVersion < 53) {
|
|
1036
|
+
const cols = db.prepare(`PRAGMA table_info(sessions)`).all();
|
|
1037
|
+
if (!cols.some(c => c.name === 'pr_urls'))
|
|
1038
|
+
db.exec(`ALTER TABLE sessions ADD COLUMN pr_urls TEXT`);
|
|
1039
|
+
const withPr = db.prepare(`SELECT file_path FROM sessions WHERE pr_url IS NOT NULL AND file_path IS NOT NULL`).all();
|
|
1040
|
+
const dropLedger = db.prepare(`DELETE FROM scan_ledger WHERE file_path = ?`);
|
|
1041
|
+
for (const { file_path } of withPr)
|
|
1042
|
+
dropLedger.run(canonicalLedgerKey(file_path));
|
|
1043
|
+
}
|
|
1034
1044
|
}
|
|
1035
1045
|
function backfillClaudeAccounts(db, scope = 'all') {
|
|
1036
1046
|
const where = scope === 'all'
|
|
@@ -1440,7 +1450,7 @@ const upsertSessionStmt = (db) => db.prepare(`
|
|
|
1440
1450
|
output_tokens, input_tokens, cache_read_tokens, cache_write_tokens,
|
|
1441
1451
|
cost_usd, cost_usd_nocache, duration_ms, model, tool_call_count,
|
|
1442
1452
|
file_path, file_mtime_ms, file_size, scanned_at, is_team_origin,
|
|
1443
|
-
pr_url, pr_number, worktree_slug, ticket_id, spawned_team,
|
|
1453
|
+
pr_url, pr_number, pr_urls, worktree_slug, ticket_id, spawned_team,
|
|
1444
1454
|
sub_agent_count, background_shell_count, plan, todos,
|
|
1445
1455
|
recent_directories_touched, linear_project, linear_project_url, machine,
|
|
1446
1456
|
actor, initiated_by, phoenix_id, used_browser, used_computer
|
|
@@ -1451,7 +1461,7 @@ const upsertSessionStmt = (db) => db.prepare(`
|
|
|
1451
1461
|
@output_tokens, @input_tokens, @cache_read_tokens, @cache_write_tokens,
|
|
1452
1462
|
@cost_usd, @cost_usd_nocache, @duration_ms, @model, @tool_call_count,
|
|
1453
1463
|
@file_path, @file_mtime_ms, @file_size, @scanned_at, @is_team_origin,
|
|
1454
|
-
@pr_url, @pr_number, @worktree_slug, @ticket_id, @spawned_team,
|
|
1464
|
+
@pr_url, @pr_number, @pr_urls, @worktree_slug, @ticket_id, @spawned_team,
|
|
1455
1465
|
@sub_agent_count, @background_shell_count, @plan, @todos,
|
|
1456
1466
|
@recent_directories_touched, @linear_project, @linear_project_url, @machine,
|
|
1457
1467
|
@actor, @initiated_by, @phoenix_id, @used_browser, @used_computer
|
|
@@ -1517,6 +1527,7 @@ const upsertSessionStmt = (db) => db.prepare(`
|
|
|
1517
1527
|
is_team_origin = excluded.is_team_origin,
|
|
1518
1528
|
pr_url = excluded.pr_url,
|
|
1519
1529
|
pr_number = excluded.pr_number,
|
|
1530
|
+
pr_urls = excluded.pr_urls,
|
|
1520
1531
|
worktree_slug = excluded.worktree_slug,
|
|
1521
1532
|
ticket_id = excluded.ticket_id,
|
|
1522
1533
|
spawned_team = excluded.spawned_team,
|
|
@@ -1749,6 +1760,7 @@ export function upsertSession(meta, content, scan, assistantContent = '') {
|
|
|
1749
1760
|
is_team_origin: meta.isTeamOrigin ? 1 : 0,
|
|
1750
1761
|
pr_url: meta.prUrl ?? null,
|
|
1751
1762
|
pr_number: meta.prNumber ?? null,
|
|
1763
|
+
pr_urls: meta.prUrls ? JSON.stringify(meta.prUrls) : null,
|
|
1752
1764
|
worktree_slug: meta.worktreeSlug ?? null,
|
|
1753
1765
|
ticket_id: meta.ticketId ?? null,
|
|
1754
1766
|
spawned_team: meta.spawnedTeam ?? null,
|
|
@@ -1922,6 +1934,7 @@ export function upsertSessionsBatch(entries) {
|
|
|
1922
1934
|
is_team_origin: meta.isTeamOrigin ? 1 : 0,
|
|
1923
1935
|
pr_url: meta.prUrl ?? null,
|
|
1924
1936
|
pr_number: meta.prNumber ?? null,
|
|
1937
|
+
pr_urls: meta.prUrls ? JSON.stringify(meta.prUrls) : null,
|
|
1925
1938
|
worktree_slug: meta.worktreeSlug ?? null,
|
|
1926
1939
|
ticket_id: meta.ticketId ?? null,
|
|
1927
1940
|
spawned_team: meta.spawnedTeam ?? null,
|
|
@@ -2115,6 +2128,7 @@ function rowToMeta(row) {
|
|
|
2115
2128
|
isTeamOrigin: row.is_team_origin === 1,
|
|
2116
2129
|
prUrl: row.pr_url ?? undefined,
|
|
2117
2130
|
prNumber: row.pr_number ?? undefined,
|
|
2131
|
+
prUrls: parseJsonColumn(row.pr_urls),
|
|
2118
2132
|
worktreeSlug: row.worktree_slug ?? undefined,
|
|
2119
2133
|
ticketId: row.ticket_id ?? undefined,
|
|
2120
2134
|
spawnedTeam: row.spawned_team ?? undefined,
|
|
@@ -58,6 +58,7 @@ interface ClaudeSessionScan {
|
|
|
58
58
|
assistantText?: string;
|
|
59
59
|
prUrl?: string;
|
|
60
60
|
prNumber?: number;
|
|
61
|
+
prUrls?: string[];
|
|
61
62
|
worktreeSlug?: string;
|
|
62
63
|
ticketId?: string;
|
|
63
64
|
createdTickets?: string[];
|
|
@@ -99,6 +100,7 @@ interface CodexSessionScan {
|
|
|
99
100
|
assistantText?: string;
|
|
100
101
|
prUrl?: string;
|
|
101
102
|
prNumber?: number;
|
|
103
|
+
prUrls?: string[];
|
|
102
104
|
worktreeSlug?: string;
|
|
103
105
|
ticketId?: string;
|
|
104
106
|
createdTickets?: string[];
|
|
@@ -201,9 +203,10 @@ interface ClaudeParseState {
|
|
|
201
203
|
seenAssistantIds: Set<string>;
|
|
202
204
|
userTexts: string[];
|
|
203
205
|
assistantTexts: string[];
|
|
204
|
-
|
|
206
|
+
pendingPrCreates: Set<string>;
|
|
205
207
|
prUrl?: string;
|
|
206
208
|
prNumber?: number;
|
|
209
|
+
prUrls: string[];
|
|
207
210
|
createdTickets: Set<string>;
|
|
208
211
|
pendingTicketTools: Set<string>;
|
|
209
212
|
spawnedTeam?: string;
|
|
@@ -253,9 +256,10 @@ export interface ClaudeParserState {
|
|
|
253
256
|
costUsdNoCache: number;
|
|
254
257
|
seenIdsSize: number;
|
|
255
258
|
seenIdsRecent: string[];
|
|
256
|
-
|
|
259
|
+
pendingPrCreates?: string[];
|
|
257
260
|
prUrl?: string;
|
|
258
261
|
prNumber?: number;
|
|
262
|
+
prUrls?: string[];
|
|
259
263
|
pendingTicketTools: string[];
|
|
260
264
|
createdTickets: string[];
|
|
261
265
|
spawnedTeam?: string;
|
|
@@ -304,9 +308,10 @@ interface CodexParseState {
|
|
|
304
308
|
lastTsMs?: number;
|
|
305
309
|
userTexts: string[];
|
|
306
310
|
assistantTexts: string[];
|
|
307
|
-
|
|
311
|
+
pendingPrCreates: Set<string>;
|
|
308
312
|
prUrl?: string;
|
|
309
313
|
prNumber?: number;
|
|
314
|
+
prUrls: string[];
|
|
310
315
|
createdTickets: Set<string>;
|
|
311
316
|
pendingTicketTools: Set<string>;
|
|
312
317
|
spawnedTeam?: string;
|
|
@@ -317,6 +322,8 @@ interface CodexParseState {
|
|
|
317
322
|
slashCommandEvents: SessionEvent[];
|
|
318
323
|
}
|
|
319
324
|
export declare function initCodexParseState(): CodexParseState;
|
|
325
|
+
export declare function applyCodexLine(state: CodexParseState, parsed: any): void;
|
|
326
|
+
export declare function finalizeCodexScan(state: CodexParseState): CodexSessionScan;
|
|
320
327
|
export interface CodexParserState {
|
|
321
328
|
v: 4;
|
|
322
329
|
offset: number;
|
|
@@ -334,9 +341,10 @@ export interface CodexParserState {
|
|
|
334
341
|
lastTotalTokenUsage?: any;
|
|
335
342
|
firstTsMs?: number;
|
|
336
343
|
lastTsMs?: number;
|
|
337
|
-
|
|
344
|
+
pendingPrCreates?: string[];
|
|
338
345
|
prUrl?: string;
|
|
339
346
|
prNumber?: number;
|
|
347
|
+
prUrls?: string[];
|
|
340
348
|
pendingTicketTools: string[];
|
|
341
349
|
createdTickets: string[];
|
|
342
350
|
spawnedTeam?: string;
|
|
@@ -348,6 +356,7 @@ export interface CodexParserState {
|
|
|
348
356
|
toolCalls: ToolCallCollectorSnapshot;
|
|
349
357
|
}
|
|
350
358
|
export declare function serializeCodexParserState(state: CodexParseState, offset: number, jsonlDroppingOversizedLine?: boolean): CodexParserState;
|
|
359
|
+
export declare function hydrateCodexParseState(prior: CodexParserState): CodexParseState;
|
|
351
360
|
export declare function scanCodexSessionIncremental(filePath: string, fromOffset: number, prior: CodexParserState): Promise<{
|
|
352
361
|
scan: CodexSessionScan;
|
|
353
362
|
newState: CodexParserState;
|
|
@@ -799,6 +799,7 @@ async function readClaudeMeta(filePath, sessionId, scanStamp, priorRow, names =
|
|
|
799
799
|
isTeamOrigin,
|
|
800
800
|
prUrl: scan.prUrl,
|
|
801
801
|
prNumber: scan.prNumber,
|
|
802
|
+
prUrls: scan.prUrls,
|
|
802
803
|
worktreeSlug: scan.worktreeSlug,
|
|
803
804
|
ticketId: scan.ticketId,
|
|
804
805
|
createdTickets: scan.createdTickets,
|
|
@@ -841,6 +842,7 @@ async function readClaudeMeta(filePath, sessionId, scanStamp, priorRow, names =
|
|
|
841
842
|
isTeamOrigin,
|
|
842
843
|
prUrl: scan.prUrl,
|
|
843
844
|
prNumber: scan.prNumber,
|
|
845
|
+
prUrls: scan.prUrls,
|
|
844
846
|
worktreeSlug: scan.worktreeSlug,
|
|
845
847
|
ticketId: scan.ticketId,
|
|
846
848
|
createdTickets: scan.createdTickets,
|
|
@@ -1082,6 +1084,7 @@ export async function readCodexMeta(filePath, resolveAccount, currentVersion, sc
|
|
|
1082
1084
|
account: resolveAccount?.(),
|
|
1083
1085
|
prUrl: scan.prUrl,
|
|
1084
1086
|
prNumber: scan.prNumber,
|
|
1087
|
+
prUrls: scan.prUrls,
|
|
1085
1088
|
worktreeSlug: scan.worktreeSlug,
|
|
1086
1089
|
ticketId: scan.ticketId,
|
|
1087
1090
|
createdTickets: scan.createdTickets,
|
|
@@ -2146,9 +2149,10 @@ export function initClaudeParseState() {
|
|
|
2146
2149
|
seenAssistantIds: new Set(),
|
|
2147
2150
|
userTexts: [],
|
|
2148
2151
|
assistantTexts: [],
|
|
2149
|
-
|
|
2152
|
+
pendingPrCreates: new Set(),
|
|
2150
2153
|
prUrl: undefined,
|
|
2151
2154
|
prNumber: undefined,
|
|
2155
|
+
prUrls: [],
|
|
2152
2156
|
createdTickets: new Set(),
|
|
2153
2157
|
pendingTicketTools: new Set(),
|
|
2154
2158
|
spawnedTeam: undefined,
|
|
@@ -2234,27 +2238,21 @@ export function applyClaudeLine(state, parsed) {
|
|
|
2234
2238
|
state.createdTickets.add(t);
|
|
2235
2239
|
}
|
|
2236
2240
|
}
|
|
2237
|
-
if (
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
state.sawPrCreate = true;
|
|
2242
|
-
}
|
|
2241
|
+
if (parsed.type === 'assistant' && Array.isArray(parsed.message?.content)) {
|
|
2242
|
+
for (const b of parsed.message.content) {
|
|
2243
|
+
if (b?.type === 'tool_use' && typeof b?.id === 'string' && typeof b?.input?.command === 'string' && isPrCreateCommand(b.input.command)) {
|
|
2244
|
+
state.pendingPrCreates.add(b.id);
|
|
2243
2245
|
}
|
|
2244
2246
|
}
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
state.prUrl = pr.url;
|
|
2255
|
-
state.prNumber = pr.number;
|
|
2256
|
-
}
|
|
2257
|
-
}
|
|
2247
|
+
}
|
|
2248
|
+
if (state.pendingPrCreates.size > 0 && parsed.type === 'user' && Array.isArray(parsed.message?.content)) {
|
|
2249
|
+
for (const b of parsed.message.content) {
|
|
2250
|
+
if (b?.type !== 'tool_result' || !state.pendingPrCreates.delete(b.tool_use_id))
|
|
2251
|
+
continue;
|
|
2252
|
+
const text = typeof b.content === 'string'
|
|
2253
|
+
? b.content
|
|
2254
|
+
: Array.isArray(b.content) ? b.content.map((c) => c?.text || '').join('\n') : '';
|
|
2255
|
+
recordCreatedPr(state, extractPrUrl(text));
|
|
2258
2256
|
}
|
|
2259
2257
|
}
|
|
2260
2258
|
if (typeof parsed.timestamp === 'string') {
|
|
@@ -2389,6 +2387,7 @@ export function finalizeClaudeScan(state, sessionFile) {
|
|
|
2389
2387
|
assistantText: state.assistantTexts.length > 0 ? state.assistantTexts.join('\n') : undefined,
|
|
2390
2388
|
prUrl: state.prUrl,
|
|
2391
2389
|
prNumber: state.prNumber,
|
|
2390
|
+
prUrls: state.prUrls.length > 1 ? [...state.prUrls] : undefined,
|
|
2392
2391
|
worktreeSlug: worktree?.slug,
|
|
2393
2392
|
ticketId: ticket?.id,
|
|
2394
2393
|
createdTickets: state.createdTickets.size > 0 ? [...state.createdTickets] : undefined,
|
|
@@ -2466,9 +2465,10 @@ export function serializeClaudeParserState(state, offset, jsonlDroppingOversized
|
|
|
2466
2465
|
costUsdNoCache: state.costUsdNoCache,
|
|
2467
2466
|
seenIdsSize: state.seenAssistantIds.size,
|
|
2468
2467
|
seenIdsRecent,
|
|
2469
|
-
|
|
2468
|
+
pendingPrCreates: [...state.pendingPrCreates],
|
|
2470
2469
|
prUrl: state.prUrl,
|
|
2471
2470
|
prNumber: state.prNumber,
|
|
2471
|
+
prUrls: state.prUrls,
|
|
2472
2472
|
pendingTicketTools: [...state.pendingTicketTools],
|
|
2473
2473
|
createdTickets: [...state.createdTickets],
|
|
2474
2474
|
spawnedTeam: state.spawnedTeam,
|
|
@@ -2520,9 +2520,10 @@ export function hydrateClaudeParseState(prior) {
|
|
|
2520
2520
|
assistantTexts: prior.assistantContentText !== undefined && prior.assistantContentText.length > 0
|
|
2521
2521
|
? [prior.assistantContentText]
|
|
2522
2522
|
: [],
|
|
2523
|
-
|
|
2523
|
+
pendingPrCreates: new Set(prior.pendingPrCreates),
|
|
2524
2524
|
prUrl: prior.prUrl,
|
|
2525
2525
|
prNumber: prior.prNumber,
|
|
2526
|
+
prUrls: prior.prUrls ?? (prior.prUrl ? [prior.prUrl] : []),
|
|
2526
2527
|
createdTickets: new Set(prior.createdTickets),
|
|
2527
2528
|
pendingTicketTools: new Set(prior.pendingTicketTools),
|
|
2528
2529
|
spawnedTeam: prior.spawnedTeam,
|
|
@@ -2593,6 +2594,16 @@ async function claudeSessionIdentityAt(filePath, maxBytes = 1_048_576) {
|
|
|
2593
2594
|
}
|
|
2594
2595
|
return state.timestamp;
|
|
2595
2596
|
}
|
|
2597
|
+
function recordCreatedPr(state, pr) {
|
|
2598
|
+
if (!pr)
|
|
2599
|
+
return;
|
|
2600
|
+
if (!state.prUrl) {
|
|
2601
|
+
state.prUrl = pr.url;
|
|
2602
|
+
state.prNumber = pr.number;
|
|
2603
|
+
}
|
|
2604
|
+
if (!state.prUrls.includes(pr.url))
|
|
2605
|
+
state.prUrls.push(pr.url);
|
|
2606
|
+
}
|
|
2596
2607
|
function parsePriorClaudeState(row) {
|
|
2597
2608
|
if (!row?.parserState)
|
|
2598
2609
|
return null;
|
|
@@ -2632,9 +2643,10 @@ export function initCodexParseState() {
|
|
|
2632
2643
|
lastTsMs: undefined,
|
|
2633
2644
|
userTexts: [],
|
|
2634
2645
|
assistantTexts: [],
|
|
2635
|
-
|
|
2646
|
+
pendingPrCreates: new Set(),
|
|
2636
2647
|
prUrl: undefined,
|
|
2637
2648
|
prNumber: undefined,
|
|
2649
|
+
prUrls: [],
|
|
2638
2650
|
createdTickets: new Set(),
|
|
2639
2651
|
pendingTicketTools: new Set(),
|
|
2640
2652
|
spawnedTeam: undefined,
|
|
@@ -2645,7 +2657,7 @@ export function initCodexParseState() {
|
|
|
2645
2657
|
slashCommandEvents: [],
|
|
2646
2658
|
};
|
|
2647
2659
|
}
|
|
2648
|
-
function applyCodexLine(state, parsed) {
|
|
2660
|
+
export function applyCodexLine(state, parsed) {
|
|
2649
2661
|
collectCodexToolCalls(state.toolCollector, parsed);
|
|
2650
2662
|
if (parsed.type === 'response_item') {
|
|
2651
2663
|
const p = parsed.payload || {};
|
|
@@ -2661,8 +2673,8 @@ function applyCodexLine(state, parsed) {
|
|
|
2661
2673
|
type: 'tool_use', agent: 'codex', timestamp: parsed.timestamp || '', tool: p.name, args,
|
|
2662
2674
|
path: args.file_path || args.path, command: cmd || undefined,
|
|
2663
2675
|
});
|
|
2664
|
-
if (
|
|
2665
|
-
state.
|
|
2676
|
+
if (typeof p.call_id === 'string' && isPrCreateCommand(cmd))
|
|
2677
|
+
state.pendingPrCreates.add(p.call_id);
|
|
2666
2678
|
if (!state.spawnedTeam) {
|
|
2667
2679
|
const team = detectSpawnedTeam(cmd);
|
|
2668
2680
|
if (team)
|
|
@@ -2673,13 +2685,8 @@ function applyCodexLine(state, parsed) {
|
|
|
2673
2685
|
}
|
|
2674
2686
|
}
|
|
2675
2687
|
if (p.type === 'function_call_output') {
|
|
2676
|
-
if (
|
|
2677
|
-
|
|
2678
|
-
if (pr) {
|
|
2679
|
-
state.prUrl = pr.url;
|
|
2680
|
-
state.prNumber = pr.number;
|
|
2681
|
-
}
|
|
2682
|
-
}
|
|
2688
|
+
if (typeof p.call_id === 'string' && state.pendingPrCreates.delete(p.call_id))
|
|
2689
|
+
recordCreatedPr(state, extractPrUrl(String(p.output || '')));
|
|
2683
2690
|
if (typeof p.call_id === 'string' && state.pendingTicketTools.has(p.call_id)) {
|
|
2684
2691
|
state.pendingTicketTools.delete(p.call_id);
|
|
2685
2692
|
const t = extractCreatedTicket(String(p.output || ''));
|
|
@@ -2752,7 +2759,7 @@ function applyCodexLine(state, parsed) {
|
|
|
2752
2759
|
state.model = parsed.payload.info.model;
|
|
2753
2760
|
}
|
|
2754
2761
|
}
|
|
2755
|
-
function finalizeCodexScan(state) {
|
|
2762
|
+
export function finalizeCodexScan(state) {
|
|
2756
2763
|
const snap = state.lastTotalTokenUsage;
|
|
2757
2764
|
const outputTokens = snap
|
|
2758
2765
|
? (snap.output_tokens ?? 0) + (snap.reasoning_output_tokens ?? 0)
|
|
@@ -2806,6 +2813,7 @@ function finalizeCodexScan(state) {
|
|
|
2806
2813
|
assistantText: state.assistantTexts.length > 0 ? state.assistantTexts.join('\n') : undefined,
|
|
2807
2814
|
prUrl: state.prUrl,
|
|
2808
2815
|
prNumber: state.prNumber,
|
|
2816
|
+
prUrls: state.prUrls.length > 1 ? [...state.prUrls] : undefined,
|
|
2809
2817
|
worktreeSlug: worktree?.slug,
|
|
2810
2818
|
ticketId: ticket?.id,
|
|
2811
2819
|
createdTickets: state.createdTickets.size > 0 ? [...state.createdTickets] : undefined,
|
|
@@ -2857,9 +2865,10 @@ export function serializeCodexParserState(state, offset, jsonlDroppingOversizedL
|
|
|
2857
2865
|
lastTotalTokenUsage: state.lastTotalTokenUsage,
|
|
2858
2866
|
firstTsMs: state.firstTsMs,
|
|
2859
2867
|
lastTsMs: state.lastTsMs,
|
|
2860
|
-
|
|
2868
|
+
pendingPrCreates: [...state.pendingPrCreates],
|
|
2861
2869
|
prUrl: state.prUrl,
|
|
2862
2870
|
prNumber: state.prNumber,
|
|
2871
|
+
prUrls: state.prUrls,
|
|
2863
2872
|
pendingTicketTools: [...state.pendingTicketTools],
|
|
2864
2873
|
createdTickets: [...state.createdTickets],
|
|
2865
2874
|
spawnedTeam: state.spawnedTeam,
|
|
@@ -2871,7 +2880,7 @@ export function serializeCodexParserState(state, offset, jsonlDroppingOversizedL
|
|
|
2871
2880
|
toolCalls: state.toolCollector.snapshot(),
|
|
2872
2881
|
};
|
|
2873
2882
|
}
|
|
2874
|
-
function hydrateCodexParseState(prior) {
|
|
2883
|
+
export function hydrateCodexParseState(prior) {
|
|
2875
2884
|
return {
|
|
2876
2885
|
sessionId: prior.sessionId,
|
|
2877
2886
|
timestamp: prior.timestamp,
|
|
@@ -2890,9 +2899,10 @@ function hydrateCodexParseState(prior) {
|
|
|
2890
2899
|
assistantTexts: prior.assistantContentText !== undefined && prior.assistantContentText.length > 0
|
|
2891
2900
|
? [prior.assistantContentText]
|
|
2892
2901
|
: [],
|
|
2893
|
-
|
|
2902
|
+
pendingPrCreates: new Set(prior.pendingPrCreates),
|
|
2894
2903
|
prUrl: prior.prUrl,
|
|
2895
2904
|
prNumber: prior.prNumber,
|
|
2905
|
+
prUrls: prior.prUrls ?? (prior.prUrl ? [prior.prUrl] : []),
|
|
2896
2906
|
createdTickets: new Set(prior.createdTickets),
|
|
2897
2907
|
pendingTicketTools: new Set(prior.pendingTicketTools),
|
|
2898
2908
|
spawnedTeam: prior.spawnedTeam,
|
|
@@ -10,7 +10,7 @@ import { machineId, normalizeHost } from '../../machine-id.js';
|
|
|
10
10
|
import { shellQuote } from '../../ssh-exec.js';
|
|
11
11
|
import { streamFromPeer } from './peer-stream.js';
|
|
12
12
|
import { buildWindowsAgentsCommand, remoteShellFor } from '../../hosts/remote-cmd.js';
|
|
13
|
-
import { artifactKind, deriveImportantMessage, deriveSessionRecap, isReapableOrphan, sessionAccountLabel } from '../active.js';
|
|
13
|
+
import { artifactKind, deriveImportantMessage, deriveSessionRecap, isReapableOrphan, prsFromUrls, sessionAccountLabel } from '../active.js';
|
|
14
14
|
import { loadSessionPreviewDigest, readCachedPreviewDigest } from '../preview-digest.js';
|
|
15
15
|
import { indexArtifactSidecars, mergeArtifacts } from '@phnx-labs/sessions-cli/reader';
|
|
16
16
|
import { listNativeAccounts } from '../../account-registry.js';
|
|
@@ -133,6 +133,7 @@ export function toPreviousSessionWatchRow(scope, session, accounts = listNativeA
|
|
|
133
133
|
...(session.account ? { account: session.account } : {}),
|
|
134
134
|
accountLabel: sessionAccountLabel(session.agent, session, accounts),
|
|
135
135
|
...(session.prUrl ? { pr: { url: session.prUrl, number: session.prNumber } } : {}),
|
|
136
|
+
...(session.prUrls ? { prs: prsFromUrls(session.prUrls) } : {}),
|
|
136
137
|
...(worktree ? { worktree } : {}),
|
|
137
138
|
...(session.gitBranch ? { branch: session.gitBranch } : {}),
|
|
138
139
|
...(session.ticketId ? { ticket: { id: session.ticketId, url: linearIssueUrl(session.ticketId) } } : {}),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@phnx-labs/agents-cli",
|
|
3
|
-
"version": "1.23.
|
|
3
|
+
"version": "1.23.32",
|
|
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",
|
|
@@ -89,7 +89,7 @@
|
|
|
89
89
|
"@fontsource/jetbrains-mono": "^5.3.0",
|
|
90
90
|
"@inquirer/prompts": "8.5.2",
|
|
91
91
|
"@phnx-labs/secrets-cli": "0.4.0",
|
|
92
|
-
"@phnx-labs/sessions-cli": "0.8.
|
|
92
|
+
"@phnx-labs/sessions-cli": "0.8.9",
|
|
93
93
|
"@resvg/resvg-wasm": "^2.6.2",
|
|
94
94
|
"@types/proper-lockfile": "4.1.4",
|
|
95
95
|
"@zed-industries/agent-client-protocol": "0.4.5",
|