@phnx-labs/agents-cli 1.20.35 → 1.20.36
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 +91 -0
- package/LICENSE +185 -21
- package/README.md +8 -4
- package/dist/commands/audit.d.ts +14 -0
- package/dist/commands/audit.js +68 -0
- package/dist/commands/browser.js +82 -8
- package/dist/commands/check.d.ts +15 -0
- package/dist/commands/check.js +84 -0
- package/dist/commands/cloud.js +143 -3
- package/dist/commands/computer.js +81 -0
- package/dist/commands/daemon.js +4 -1
- package/dist/commands/doctor.js +1 -89
- package/dist/commands/events.js +3 -3
- package/dist/commands/exec.d.ts +19 -0
- package/dist/commands/exec.js +277 -11
- package/dist/commands/hosts.js +10 -6
- package/dist/commands/inspect.js +8 -9
- package/dist/commands/lock.d.ts +12 -0
- package/dist/commands/lock.js +70 -0
- package/dist/commands/message.d.ts +15 -0
- package/dist/commands/message.js +56 -0
- package/dist/commands/routines.js +101 -5
- package/dist/commands/secrets-migrate.js +106 -57
- package/dist/commands/secrets.d.ts +31 -18
- package/dist/commands/secrets.js +156 -75
- package/dist/commands/serve.d.ts +10 -0
- package/dist/commands/serve.js +37 -0
- package/dist/commands/sessions-inject.d.ts +14 -0
- package/dist/commands/sessions-inject.js +111 -0
- package/dist/commands/sessions-picker.d.ts +2 -0
- package/dist/commands/sessions-picker.js +24 -3
- package/dist/commands/sessions-resume.js +20 -8
- package/dist/commands/sessions.d.ts +71 -1
- package/dist/commands/sessions.js +365 -37
- package/dist/commands/setup.js +4 -2
- package/dist/commands/sync.d.ts +3 -1
- package/dist/commands/sync.js +156 -4
- package/dist/commands/teams.js +217 -0
- package/dist/commands/versions.js +2 -4
- package/dist/commands/watchdog.d.ts +18 -0
- package/dist/commands/watchdog.js +238 -0
- package/dist/index.js +25 -2
- package/dist/lib/audit/log.d.ts +92 -0
- package/dist/lib/audit/log.js +177 -0
- package/dist/lib/auto-pull.js +2 -1
- package/dist/lib/browser/chrome.d.ts +10 -0
- package/dist/lib/browser/chrome.js +18 -7
- package/dist/lib/browser/drivers/ssh.js +2 -1
- package/dist/lib/browser/har.d.ts +84 -0
- package/dist/lib/browser/har.js +77 -0
- package/dist/lib/browser/ipc.js +24 -3
- package/dist/lib/browser/profiles.d.ts +1 -1
- package/dist/lib/browser/profiles.js +8 -10
- package/dist/lib/browser/refs.d.ts +65 -0
- package/dist/lib/browser/refs.js +73 -1
- package/dist/lib/browser/runtime-state.js +1 -0
- package/dist/lib/browser/service.d.ts +38 -2
- package/dist/lib/browser/service.js +112 -8
- package/dist/lib/browser/types.d.ts +14 -1
- package/dist/lib/budget/live-cloud.d.ts +42 -0
- package/dist/lib/budget/live-cloud.js +79 -0
- package/dist/lib/budget/live-team.d.ts +31 -0
- package/dist/lib/budget/live-team.js +115 -0
- package/dist/lib/cloud/codex.js +4 -0
- package/dist/lib/cloud/rush.d.ts +12 -1
- package/dist/lib/cloud/rush.js +13 -3
- package/dist/lib/cloud/types.d.ts +9 -0
- package/dist/lib/computer/dispatch.d.ts +8 -0
- package/dist/lib/computer/dispatch.js +125 -0
- package/dist/lib/computer/loop.d.ts +62 -0
- package/dist/lib/computer/loop.js +98 -0
- package/dist/lib/computer/model.d.ts +44 -0
- package/dist/lib/computer/model.js +157 -0
- package/dist/lib/concurrency.d.ts +19 -0
- package/dist/lib/concurrency.js +33 -0
- package/dist/lib/daemon.d.ts +57 -0
- package/dist/lib/daemon.js +192 -16
- package/dist/lib/devices/registry.d.ts +7 -0
- package/dist/lib/devices/registry.js +24 -0
- package/dist/lib/devices/tailscale.js +1 -1
- package/dist/lib/drift.d.ts +52 -0
- package/dist/lib/drift.js +112 -0
- package/dist/lib/events.d.ts +1 -1
- package/dist/lib/events.js +31 -13
- package/dist/lib/exec.d.ts +17 -0
- package/dist/lib/exec.js +79 -13
- package/dist/lib/git.d.ts +27 -0
- package/dist/lib/git.js +56 -1
- package/dist/lib/hooks/cache.d.ts +6 -0
- package/dist/lib/hooks/cache.js +54 -12
- package/dist/lib/hooks.d.ts +27 -0
- package/dist/lib/hooks.js +127 -8
- package/dist/lib/hosts/dispatch.d.ts +15 -0
- package/dist/lib/hosts/dispatch.js +39 -6
- package/dist/lib/hosts/logs.js +30 -1
- package/dist/lib/hosts/option.js +1 -1
- package/dist/lib/hosts/passthrough.js +3 -1
- package/dist/lib/hosts/ready.d.ts +29 -6
- package/dist/lib/hosts/ready.js +66 -15
- package/dist/lib/hosts/registry.d.ts +19 -2
- package/dist/lib/hosts/registry.js +58 -2
- package/dist/lib/hosts/remote-cmd.d.ts +62 -1
- package/dist/lib/hosts/remote-cmd.js +70 -1
- package/dist/lib/hosts/remote-os.d.ts +17 -0
- package/dist/lib/hosts/remote-os.js +30 -0
- package/dist/lib/hosts/session-index.d.ts +34 -0
- package/dist/lib/hosts/session-index.js +56 -0
- package/dist/lib/hosts/tasks.d.ts +14 -0
- package/dist/lib/hosts/tasks.js +15 -0
- package/dist/lib/lock.d.ts +93 -0
- package/dist/lib/lock.js +207 -0
- package/dist/lib/loop.js +16 -1
- package/dist/lib/machine-id.d.ts +21 -0
- package/dist/lib/machine-id.js +26 -0
- package/dist/lib/mailbox-target.d.ts +36 -0
- package/dist/lib/mailbox-target.js +45 -0
- package/dist/lib/mailbox.d.ts +47 -0
- package/dist/lib/mailbox.js +194 -0
- package/dist/lib/mcp.d.ts +5 -0
- package/dist/lib/mcp.js +24 -8
- package/dist/lib/migrate.d.ts +19 -0
- package/dist/lib/migrate.js +134 -26
- package/dist/lib/overdue.js +3 -0
- package/dist/lib/picker.d.ts +2 -0
- package/dist/lib/picker.js +4 -1
- package/dist/lib/platform/exec.d.ts +46 -0
- package/dist/lib/platform/exec.js +74 -0
- package/dist/lib/platform/process.d.ts +31 -0
- package/dist/lib/platform/process.js +34 -1
- package/dist/lib/platform/winpath.js +2 -0
- package/dist/lib/plugins.js +16 -6
- package/dist/lib/profiles.d.ts +25 -0
- package/dist/lib/profiles.js +22 -6
- package/dist/lib/pty-client.js +2 -1
- package/dist/lib/rotate.d.ts +61 -0
- package/dist/lib/rotate.js +52 -0
- package/dist/lib/routines.d.ts +40 -2
- package/dist/lib/routines.js +66 -8
- package/dist/lib/runner.d.ts +11 -2
- package/dist/lib/runner.js +49 -7
- package/dist/lib/scheduler.js +6 -1
- package/dist/lib/secrets/bundles.d.ts +60 -4
- package/dist/lib/secrets/bundles.js +131 -12
- package/dist/lib/secrets/filestore.d.ts +3 -0
- package/dist/lib/secrets/filestore.js +42 -16
- package/dist/lib/secrets/index.d.ts +43 -2
- package/dist/lib/secrets/index.js +102 -3
- package/dist/lib/secrets/mcp.d.ts +93 -0
- package/dist/lib/secrets/mcp.js +205 -0
- package/dist/lib/secrets/remote.js +12 -5
- package/dist/lib/secrets/sync.js +83 -4
- package/dist/lib/secrets/windows.js +14 -3
- package/dist/lib/serve/data.d.ts +81 -0
- package/dist/lib/serve/data.js +91 -0
- package/dist/lib/serve/page.d.ts +7 -0
- package/dist/lib/serve/page.js +140 -0
- package/dist/lib/serve/server.d.ts +46 -0
- package/dist/lib/serve/server.js +115 -0
- package/dist/lib/session/active.d.ts +54 -0
- package/dist/lib/session/active.js +190 -19
- package/dist/lib/session/discover.d.ts +37 -0
- package/dist/lib/session/discover.js +111 -28
- package/dist/lib/session/inject.d.ts +18 -0
- package/dist/lib/session/inject.js +21 -0
- package/dist/lib/session/parse.js +23 -20
- package/dist/lib/session/pid-registry.d.ts +1 -0
- package/dist/lib/session/pid-registry.js +24 -0
- package/dist/lib/session/provenance.d.ts +14 -2
- package/dist/lib/session/provenance.js +39 -8
- package/dist/lib/session/remote-active.js +19 -7
- package/dist/lib/session/remote-list.d.ts +51 -0
- package/dist/lib/session/remote-list.js +213 -0
- package/dist/lib/session/remote.d.ts +7 -1
- package/dist/lib/session/remote.js +16 -2
- package/dist/lib/session/sync/config.d.ts +1 -15
- package/dist/lib/session/sync/config.js +4 -20
- package/dist/lib/session/types.d.ts +17 -0
- package/dist/lib/shims.d.ts +36 -6
- package/dist/lib/shims.js +91 -29
- package/dist/lib/ssh-exec.js +2 -0
- package/dist/lib/ssh-tunnel.js +2 -1
- package/dist/lib/startup/command-registry.d.ts +6 -0
- package/dist/lib/startup/command-registry.js +13 -1
- package/dist/lib/state.d.ts +13 -0
- package/dist/lib/state.js +103 -9
- package/dist/lib/sync-umbrella.d.ts +14 -7
- package/dist/lib/sync-umbrella.js +17 -9
- package/dist/lib/teams/forEach.d.ts +110 -0
- package/dist/lib/teams/forEach.js +186 -0
- package/dist/lib/teams/index.d.ts +1 -0
- package/dist/lib/teams/index.js +1 -0
- package/dist/lib/teams/pr-watch.d.ts +226 -0
- package/dist/lib/teams/pr-watch.js +371 -0
- package/dist/lib/teams/supervisor.d.ts +14 -1
- package/dist/lib/teams/supervisor.js +19 -0
- package/dist/lib/teams/worktree.d.ts +9 -0
- package/dist/lib/teams/worktree.js +32 -0
- package/dist/lib/terminal/backends/index.d.ts +2 -1
- package/dist/lib/terminal/backends/index.js +3 -1
- package/dist/lib/terminal/backends/vscodium-agent.d.ts +31 -0
- package/dist/lib/terminal/backends/vscodium-agent.js +72 -0
- package/dist/lib/terminal/index.d.ts +4 -1
- package/dist/lib/terminal/index.js +4 -1
- package/dist/lib/terminal/inject.d.ts +204 -0
- package/dist/lib/terminal/inject.js +247 -0
- package/dist/lib/terminal/resolve.d.ts +64 -0
- package/dist/lib/terminal/resolve.js +90 -0
- package/dist/lib/terminal/types.d.ts +1 -1
- package/dist/lib/triggers/webhook.d.ts +85 -0
- package/dist/lib/triggers/webhook.js +141 -0
- package/dist/lib/versions.d.ts +23 -0
- package/dist/lib/versions.js +119 -13
- package/dist/lib/watchdog/index.d.ts +3 -0
- package/dist/lib/watchdog/index.js +5 -0
- package/dist/lib/watchdog/read.d.ts +35 -0
- package/dist/lib/watchdog/read.js +149 -0
- package/dist/lib/watchdog/runner.d.ts +127 -0
- package/dist/lib/watchdog/runner.js +322 -0
- package/dist/lib/watchdog/watchdog.d.ts +40 -0
- package/dist/lib/watchdog/watchdog.js +166 -0
- package/dist/lib/watchdog/watchdogTail.d.ts +5 -0
- package/dist/lib/watchdog/watchdogTail.js +154 -0
- package/dist/lib/workflows.d.ts +166 -0
- package/dist/lib/workflows.js +193 -0
- package/package.json +5 -4
|
@@ -12,6 +12,14 @@ import { linkPath, relativeToCwd } from '../lib/session/render.js';
|
|
|
12
12
|
import { renderMarkdown } from '../lib/markdown.js';
|
|
13
13
|
import { itemPicker } from '../lib/picker.js';
|
|
14
14
|
import { classifyFileChanges, changeCounts, toolHistogram, detectTestResult } from '../lib/session/digest.js';
|
|
15
|
+
/** A session whose transcript lives on another machine (folded in over the live
|
|
16
|
+
* cross-machine fan-out): its `filePath` is on that peer's disk, so the preview
|
|
17
|
+
* can't parse it locally — it shows metadata + a "resume there" note instead.
|
|
18
|
+
* Keys off `_remote`, not the machine tag, so locally-readable synced mirrors
|
|
19
|
+
* still parse their file normally. */
|
|
20
|
+
function remoteMachineOf(session) {
|
|
21
|
+
return session._remote ? session.machine : undefined;
|
|
22
|
+
}
|
|
15
23
|
/**
|
|
16
24
|
* SessionMeta originates in discover.ts (gitBranch, cwd, label, etc. read from
|
|
17
25
|
* untrusted session files). parseSession sanitizes event payloads at its
|
|
@@ -37,9 +45,22 @@ function sanitizeMeta(s) {
|
|
|
37
45
|
const previewCache = new Map();
|
|
38
46
|
/** Build a cached multi-line preview string for display in the session picker. */
|
|
39
47
|
export function buildPreview(session) {
|
|
40
|
-
const
|
|
48
|
+
const remote = remoteMachineOf(session);
|
|
49
|
+
const cacheKey = remote ? `${remote}:${session.id}` : session.id;
|
|
50
|
+
const cached = previewCache.get(cacheKey);
|
|
41
51
|
if (cached)
|
|
42
52
|
return cached;
|
|
53
|
+
const safe = sanitizeMeta(session);
|
|
54
|
+
// Remote session: the transcript is on the peer's disk, so there is nothing to
|
|
55
|
+
// parse here. Show the metadata header (agent, cwd, msgs, tokens — all carried
|
|
56
|
+
// over in the fan-out) plus where it lives and how to open it.
|
|
57
|
+
if (remote) {
|
|
58
|
+
const note = ' ' + chalk.gray(`on `) + chalk.bold.white(remote)
|
|
59
|
+
+ chalk.gray(` — enter to resume there, or space then enter to read it over SSH`);
|
|
60
|
+
const output = [formatHeader(safe, []), '', note].join('\n');
|
|
61
|
+
previewCache.set(cacheKey, output);
|
|
62
|
+
return output;
|
|
63
|
+
}
|
|
43
64
|
let events = [];
|
|
44
65
|
let parseError;
|
|
45
66
|
try {
|
|
@@ -48,13 +69,12 @@ export function buildPreview(session) {
|
|
|
48
69
|
catch (err) {
|
|
49
70
|
parseError = sanitizeForTerminal(err?.message ?? String(err));
|
|
50
71
|
}
|
|
51
|
-
const safe = sanitizeMeta(session);
|
|
52
72
|
const header = formatHeader(safe, events);
|
|
53
73
|
const body = parseError
|
|
54
74
|
? ' ' + chalk.red(`Failed to parse session: ${parseError}`)
|
|
55
75
|
: formatCompactPreview(events, safe);
|
|
56
76
|
const output = [header, '', body].filter(Boolean).join('\n');
|
|
57
|
-
previewCache.set(
|
|
77
|
+
previewCache.set(cacheKey, output);
|
|
58
78
|
return output;
|
|
59
79
|
}
|
|
60
80
|
function displayAgent(agent) {
|
|
@@ -342,6 +362,7 @@ function truncate(s, max) {
|
|
|
342
362
|
export async function sessionPicker(config) {
|
|
343
363
|
const picked = await itemPicker({
|
|
344
364
|
message: config.message,
|
|
365
|
+
subtitle: config.subtitle,
|
|
345
366
|
items: config.sessions,
|
|
346
367
|
filter: config.filter,
|
|
347
368
|
labelFor: config.labelFor,
|
|
@@ -14,7 +14,7 @@ import { discoverSessions } from '../lib/session/discover.js';
|
|
|
14
14
|
import { filterTeamSessions } from '../lib/session/team-filter.js';
|
|
15
15
|
import { multiItemPicker, itemPicker } from '../lib/picker.js';
|
|
16
16
|
import { buildPreview } from './sessions-picker.js';
|
|
17
|
-
import { filterSessionsByQuery, formatPickerLabel, buildResumeCommand, resumeSessionInPlace, parseAgentFilter, } from './sessions.js';
|
|
17
|
+
import { filterSessionsByQuery, formatPickerLabel, pickerColumnsFor, buildResumeCommand, resumeSessionInPlace, parseAgentFilter, } from './sessions.js';
|
|
18
18
|
import { openSurfaces, availableBackends, detectCurrentBackend, currentContext, } from '../lib/terminal/index.js';
|
|
19
19
|
import { isInteractiveTerminal, isPromptCancelled } from './utils.js';
|
|
20
20
|
import { setHelpSections } from '../lib/help.js';
|
|
@@ -25,7 +25,7 @@ export function registerSessionsResumeCommand(sessionsCmd) {
|
|
|
25
25
|
const cmd = sessionsCmd
|
|
26
26
|
.command('resume')
|
|
27
27
|
.argument('[query]', 'Filter sessions before selecting (topic, path, or id fragment)')
|
|
28
|
-
.description('Multi-select sessions and resume each in a terminal tab/split (this terminal, iTerm, Ghostty, tmux; local or --host).')
|
|
28
|
+
.description('Multi-select sessions and resume each in a terminal tab/split (this terminal, iTerm, Ghostty, tmux, VSCodium; local or --host).')
|
|
29
29
|
.option('-a, --agent <agent>', 'Filter by agent type and version (e.g., claude, codex@0.116.0)')
|
|
30
30
|
.option('--all', 'Include sessions from every directory (not just current project)')
|
|
31
31
|
.option('--teams', 'Include team-spawned sessions (hidden by default)')
|
|
@@ -35,6 +35,7 @@ export function registerSessionsResumeCommand(sessionsCmd) {
|
|
|
35
35
|
.option('--iterm', 'Force the iTerm backend')
|
|
36
36
|
.option('--ghostty', 'Force the Ghostty backend')
|
|
37
37
|
.option('--tmux', 'Force the tmux backend')
|
|
38
|
+
.option('--vscodium', 'Force the VSCodium agent-terminal backend (swarm-ext)')
|
|
38
39
|
.option('--tabs', 'One tab per session (default: pack two panes per tab)');
|
|
39
40
|
setHelpSections(cmd, {
|
|
40
41
|
examples: `
|
|
@@ -46,13 +47,16 @@ export function registerSessionsResumeCommand(sessionsCmd) {
|
|
|
46
47
|
|
|
47
48
|
# Force a backend / one tab each / a remote host
|
|
48
49
|
agents sessions resume --ghostty
|
|
50
|
+
agents sessions resume --vscodium
|
|
49
51
|
agents sessions resume --tabs
|
|
50
52
|
agents sessions resume --host zion --tmux
|
|
51
53
|
`,
|
|
52
54
|
notes: `
|
|
53
55
|
- space toggles a session, enter confirms; tab toggles the preview pane.
|
|
54
56
|
- Layout: two-per-tab by default (session 1 → new tab, session 2 → split beside it, …). --tabs disables splitting.
|
|
55
|
-
-
|
|
57
|
+
- VSCodium defaults to one editor tab per session (matches swarm-ext's native agent-terminal UX); the others default to two-per-tab.
|
|
58
|
+
- Backend: auto-detected from the terminal you're in (iTerm / Ghostty / tmux); override with --iterm/--ghostty/--tmux/--vscodium.
|
|
59
|
+
- --vscodium opens each session as an agent terminal tab in VSCodium via the swarm-ext extension (works with --host too).
|
|
56
60
|
- --host <alias> resumes on a remote machine over the same SSH transport as 'sessions --host' (defaults to tmux).
|
|
57
61
|
- Each session opens version-pinned, in its own cwd. Non-resumable agents are skipped with a note.
|
|
58
62
|
`,
|
|
@@ -86,14 +90,16 @@ async function sessionsResumeAction(query, options) {
|
|
|
86
90
|
console.log(chalk.gray('No sessions found. Try --all or a different --since window.'));
|
|
87
91
|
return;
|
|
88
92
|
}
|
|
89
|
-
// 1. Multi-select the sessions.
|
|
93
|
+
// 1. Multi-select the sessions. gutter: 6 = the multi-select cursor + checkbox
|
|
94
|
+
// ('> [x] ') that multiItemPicker prepends, so rows size to fit without wrapping.
|
|
95
|
+
const cols = { ...pickerColumnsFor(sessions), gutter: 6 };
|
|
90
96
|
let chosen;
|
|
91
97
|
try {
|
|
92
98
|
chosen = await multiItemPicker({
|
|
93
99
|
message: 'Select sessions to resume:',
|
|
94
100
|
items: sessions,
|
|
95
101
|
filter: (q) => (q.trim() ? filterSessionsByQuery(sessions, q) : sessions),
|
|
96
|
-
labelFor: (s, q) => formatPickerLabel(s, q),
|
|
102
|
+
labelFor: (s, q) => formatPickerLabel(s, q, cols),
|
|
97
103
|
keyFor: (s) => s.id,
|
|
98
104
|
buildPreview,
|
|
99
105
|
pageSize: 15,
|
|
@@ -147,8 +153,10 @@ async function sessionsResumeAction(query, options) {
|
|
|
147
153
|
await resumeSessionInPlace(it.session);
|
|
148
154
|
return;
|
|
149
155
|
}
|
|
150
|
-
// 5b. Fan out through the engine (two-per-tab
|
|
151
|
-
|
|
156
|
+
// 5b. Fan out through the engine. Split-packing (two-per-tab) suits the
|
|
157
|
+
// terminal apps; the VSCodium backend defaults to one editor tab per session,
|
|
158
|
+
// matching swarm-ext's native agent-terminal UX. --tabs forces tabs anywhere.
|
|
159
|
+
const packing = options.tabs || backend === 'vscodium-agent' ? 'tabs' : 'two-per-tab';
|
|
152
160
|
const where = options.host ? `${backend} on ${options.host}` : backend;
|
|
153
161
|
console.log(chalk.gray(`Opening ${items.length} session${items.length === 1 ? '' : 's'} in ${where} (${packing})…`));
|
|
154
162
|
const results = await openSurfaces(items.map((it) => ({ cwd: it.cwd, command: it.command })), { backend, host: options.host, packing });
|
|
@@ -172,7 +180,11 @@ async function sessionsResumeAction(query, options) {
|
|
|
172
180
|
* user dismissed the chooser).
|
|
173
181
|
*/
|
|
174
182
|
async function resolveBackend(options, ctx, count) {
|
|
175
|
-
const forced = options.iterm ? 'iterm'
|
|
183
|
+
const forced = options.iterm ? 'iterm'
|
|
184
|
+
: options.ghostty ? 'ghostty'
|
|
185
|
+
: options.tmux ? 'tmux'
|
|
186
|
+
: options.vscodium ? 'vscodium-agent'
|
|
187
|
+
: undefined;
|
|
176
188
|
if (forced)
|
|
177
189
|
return forced;
|
|
178
190
|
// Remote defaults to tmux (headless, no GUI session assumptions); override with a backend flag.
|
|
@@ -80,13 +80,83 @@ export declare function groupSessionsByMachine(sessions: ActiveSession[], localM
|
|
|
80
80
|
* correlated, so they're all kept.
|
|
81
81
|
*/
|
|
82
82
|
export declare function dedupeByMachineSession(sessions: ActiveSession[]): ActiveSession[];
|
|
83
|
+
/**
|
|
84
|
+
* Order a merged listing so the local machine's sessions come first, then each
|
|
85
|
+
* remote machine as a contiguous block (more sessions first, then name), with
|
|
86
|
+
* every machine keeping its incoming order (timestamp) within the block. Also
|
|
87
|
+
* dedupes: a session present both locally (a synced mirror copy) and via live
|
|
88
|
+
* fan-out collapses to one, keyed by machine + session id. Rows are keyed by
|
|
89
|
+
* `machine` (discover tags local rows with the local id; fan-out tags remote
|
|
90
|
+
* rows with the peer id) falling back to `localMachine` when untagged. Pure —
|
|
91
|
+
* `localMachine` is injected so the ordering is testable without os.hostname().
|
|
92
|
+
*/
|
|
93
|
+
export declare function mergeLocalFirst(sessions: SessionMeta[], localMachine: string): SessionMeta[];
|
|
94
|
+
/**
|
|
95
|
+
* Group key for the overview: prefer the indexed project name; else fold the cwd
|
|
96
|
+
* to its repo — a worktree (`.../<repo>/.agents/worktrees/<slug>`) folds to the
|
|
97
|
+
* repo, and a monorepo subdir falls back to its leaf dir basename. Pure.
|
|
98
|
+
*/
|
|
99
|
+
export declare function overviewProjectKey(s: Pick<SessionMeta, 'project' | 'cwd'>): string;
|
|
100
|
+
export interface OverviewGroup {
|
|
101
|
+
key: string;
|
|
102
|
+
total: number;
|
|
103
|
+
shown: SessionMeta[];
|
|
104
|
+
more: number;
|
|
105
|
+
maxTs: string;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Turn a recency-descending pool into project groups: each group shows its
|
|
109
|
+
* `perProjectCap` most-recent sessions (the rest become `· N more`), and groups
|
|
110
|
+
* are ordered by their most-recent session so the newest-active project leads.
|
|
111
|
+
* `perProjectCap = Infinity` expands every group. Pure — unit-tested.
|
|
112
|
+
*/
|
|
113
|
+
export declare function buildOverviewGroups(pool: SessionMeta[], perProjectCap: number): {
|
|
114
|
+
groups: OverviewGroup[];
|
|
115
|
+
projectCount: number;
|
|
116
|
+
};
|
|
83
117
|
/**
|
|
84
118
|
* Render a session's full transcript to stdout — the non-follow view behind
|
|
85
119
|
* `agents logs <sessionId>`. Reuses the same markdown renderer as
|
|
86
120
|
* `agents sessions <id> --markdown`.
|
|
87
121
|
*/
|
|
88
122
|
export declare function renderSessionLog(session: SessionMeta): Promise<void>;
|
|
89
|
-
|
|
123
|
+
/** Column-visibility flags for the picker row, computed once over the whole pool. */
|
|
124
|
+
export interface PickerColumns {
|
|
125
|
+
/** Render the machine column (only when the pool spans more than one machine). */
|
|
126
|
+
showMachine?: boolean;
|
|
127
|
+
/** Map a full machine id to its compact display form (shared prefix stripped). */
|
|
128
|
+
machineLabel?: (m: string) => string;
|
|
129
|
+
/** Total width of the machine column, sized to the widest compacted hostname
|
|
130
|
+
* in the pool (capped). Falls back to PICKER_MACHINE_W when absent. */
|
|
131
|
+
machineWidth?: number;
|
|
132
|
+
/** Render the ticket/PR column (only when at least one row carries a ref). */
|
|
133
|
+
showTicket?: boolean;
|
|
134
|
+
/**
|
|
135
|
+
* Cells the picker prepends before each row: 2 for the single-select cursor
|
|
136
|
+
* ('> '), 6 for the multi-select cursor + checkbox ('> [x] '). Reserved from
|
|
137
|
+
* the topic width so rows never wrap. Defaults to 2.
|
|
138
|
+
*/
|
|
139
|
+
gutter?: number;
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Compact display form for machine ids: strip the longest shared dash-delimited
|
|
143
|
+
* prefix so "yosemite-s0"/"yosemite-s1" read as "s0"/"s1" while unrelated ids
|
|
144
|
+
* ("zion", "mac-mini") stay whole. Stripping a *common* prefix can't collide,
|
|
145
|
+
* and at least one segment is always kept.
|
|
146
|
+
*/
|
|
147
|
+
export declare function machineLabeler(machines: string[]): (m: string) => string;
|
|
148
|
+
/**
|
|
149
|
+
* Column flags for a picker, computed once over the whole pool so every row
|
|
150
|
+
* aligns: the machine column only earns its width when the listing spans more
|
|
151
|
+
* than one box, the ticket column only when some row carries a PR/ticket ref.
|
|
152
|
+
*/
|
|
153
|
+
export declare function pickerColumnsFor(sessions: SessionMeta[]): PickerColumns;
|
|
154
|
+
export declare function formatPickerLabel(s: SessionMeta, query: string, cols?: PickerColumns): string;
|
|
155
|
+
/**
|
|
156
|
+
* Pick a hint to show above the picker. Deterministic (keys off the pool size)
|
|
157
|
+
* so it stays fixed across the picker's re-renders within a single run.
|
|
158
|
+
*/
|
|
159
|
+
export declare function formatPickerTip(sessions: SessionMeta[]): string;
|
|
90
160
|
export declare function pickSessionInteractive(sessions: SessionMeta[], message?: string, initialSearch?: string, hiddenCount?: number): Promise<PickedSession | null>;
|
|
91
161
|
/**
|
|
92
162
|
* Resume a session in the current terminal — a foreground takeover of this
|