@phnx-labs/agents-cli 1.22.127 → 1.22.128

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.
Files changed (49) hide show
  1. package/CHANGELOG.md +58 -0
  2. package/README.md +6 -15
  3. package/dist/commands/browser.js +4 -19
  4. package/dist/commands/computer.d.ts +2 -6
  5. package/dist/commands/computer.js +12 -18
  6. package/dist/commands/logs.js +2 -6
  7. package/dist/commands/sessions.d.ts +0 -11
  8. package/dist/commands/sessions.js +31 -364
  9. package/dist/index.js +10 -11
  10. package/dist/lib/browser-client.d.ts +0 -21
  11. package/dist/lib/browser-client.js +1 -44
  12. package/dist/lib/computer/record.d.ts +1 -0
  13. package/dist/lib/computer/record.js +2 -16
  14. package/dist/lib/daemon/runner.js +3 -2
  15. package/dist/lib/device-config.d.ts +1 -1
  16. package/dist/lib/device-config.js +7 -7
  17. package/dist/lib/feed/tool-activity.d.ts +22 -10
  18. package/dist/lib/feed/tool-activity.js +161 -32
  19. package/dist/lib/feed/tools.d.ts +55 -2
  20. package/dist/lib/feed/tools.js +22 -28
  21. package/dist/lib/feed/watch.js +4 -3
  22. package/dist/lib/session/cloud.d.ts +0 -1
  23. package/dist/lib/session/cloud.js +0 -5
  24. package/dist/lib/session/db.d.ts +0 -64
  25. package/dist/lib/session/db.js +0 -116
  26. package/dist/lib/session/remote/remote-list.d.ts +2 -36
  27. package/dist/lib/session/remote/remote-list.js +3 -320
  28. package/dist/lib/session/tool-index.d.ts +0 -62
  29. package/dist/lib/session/tool-index.js +1 -537
  30. package/dist/lib/sessions-client.d.ts +1 -0
  31. package/dist/lib/sessions-client.js +17 -1
  32. package/dist/lib/standalone-tools.js +2 -2
  33. package/package.json +1 -1
  34. package/dist/commands/browser-sessions-picker.d.ts +0 -9
  35. package/dist/commands/browser-sessions-picker.js +0 -136
  36. package/dist/commands/computer-sessions-picker.d.ts +0 -11
  37. package/dist/commands/computer-sessions-picker.js +0 -90
  38. package/dist/commands/sessions-tail.d.ts +0 -13
  39. package/dist/commands/sessions-tail.js +0 -222
  40. package/dist/lib/browser/native-history.test-fixture.d.ts +0 -12
  41. package/dist/lib/browser/native-history.test-fixture.js +0 -43
  42. package/dist/lib/browser/paths.d.ts +0 -9
  43. package/dist/lib/browser/paths.js +0 -31
  44. package/dist/lib/browser/record.d.ts +0 -4
  45. package/dist/lib/browser/record.js +0 -19
  46. package/dist/lib/browser/sessions-list.d.ts +0 -79
  47. package/dist/lib/browser/sessions-list.js +0 -415
  48. package/dist/lib/computer/sessions-list.d.ts +0 -78
  49. package/dist/lib/computer/sessions-list.js +0 -372
@@ -1,79 +0,0 @@
1
- import { formatBytes } from '../format.js';
2
- export { formatBytes };
3
- import type { SessionMeta } from '@phnx-labs/sessions-cli/reader';
4
- export type ArtifactKind = 'screenshot' | 'pdf' | 'recording' | 'download';
5
- export interface BrowserArtifact {
6
- kind: ArtifactKind;
7
- task?: string;
8
- name: string;
9
- path: string;
10
- bytes: number;
11
- mtimeMs: number;
12
- }
13
- export interface ProfileArtifacts {
14
- profile: string;
15
- artifacts: BrowserArtifact[];
16
- }
17
- export declare function renderBrowserSessions(groups: ProfileArtifacts[]): string;
18
- export declare function resolveArtifact(groups: ProfileArtifacts[], selector: string): string | null;
19
- export interface TaskIdentity {
20
- owner?: string;
21
- launchId?: string;
22
- sessionId?: string;
23
- startedAt?: number;
24
- lastActivity?: number;
25
- machine?: string;
26
- captureDir?: string;
27
- capturesRemote?: string;
28
- counts?: Partial<Record<ArtifactKind, number>>;
29
- }
30
- export interface BrowserTaskSummary extends Omit<TaskIdentity, 'owner'> {
31
- profile: string;
32
- task: string;
33
- actor?: string;
34
- startedAt: number;
35
- lastActivity: number;
36
- }
37
- export declare const BROWSER_HISTORY_LIMIT = 2000;
38
- export declare function nativeBrowserHistoryPath(): string;
39
- export interface BrowserHistoryQuery {
40
- key?: string;
41
- profile?: string;
42
- limit?: number;
43
- }
44
- export declare function readNativeBrowserHistory(query?: BrowserHistoryQuery, file?: string): BrowserTaskSummary[];
45
- export declare function readBrowserTaskHistory(query?: BrowserHistoryQuery): BrowserTaskSummary[];
46
- export declare function loadTaskIdentities(profile: string): Map<string, TaskIdentity>;
47
- export declare function loadDurableTaskIdentities(profile: string): Map<string, TaskIdentity>;
48
- export interface LaunchSessionIndex {
49
- byLaunchId: Map<string, string>;
50
- }
51
- export declare function buildLaunchSessionIndex(): LaunchSessionIndex;
52
- export declare function resolveLaunchSession(index: LaunchSessionIndex, launchId: string): SessionMeta | null;
53
- export type BrowserSessionLinkStatus = 'linked' | 'unresolved' | 'unlinked';
54
- export interface BrowserSessionRow {
55
- kind: 'task' | 'downloads';
56
- profile: string;
57
- task?: string;
58
- owner?: string;
59
- launchId?: string;
60
- sessionId?: string;
61
- linkStatus: BrowserSessionLinkStatus;
62
- linkedSession?: SessionMeta;
63
- artifacts: BrowserArtifact[];
64
- counts: Record<ArtifactKind, number>;
65
- latestMtimeMs: number;
66
- startedAt?: number;
67
- machine?: string;
68
- captureDir?: string;
69
- capturesRemote?: string;
70
- }
71
- export declare function groupIntoRows(groups: ProfileArtifacts[], taskIdentities: Map<string, Map<string, TaskIdentity>>, resolveLaunch?: (launchId: string) => SessionMeta | null, resolveSession?: (sessionId: string) => SessionMeta | null, listed?: Map<string, Set<string>>): BrowserSessionRow[];
72
- export declare function readBrowserSessionRows(profile?: string): BrowserSessionRow[];
73
- export declare function buildBrowserSessionRows(profile?: string): BrowserSessionRow[];
74
- export declare function matchesBrowserSessionRow(row: BrowserSessionRow, query: string): boolean;
75
- export declare function runBrowserSessions(opts: {
76
- profile?: string;
77
- open?: string | boolean;
78
- json?: boolean;
79
- }): Promise<void>;
@@ -1,415 +0,0 @@
1
- import { showFile } from '../open-url.js';
2
- import * as fs from 'fs';
3
- import { formatBytes } from '../format.js';
4
- export { formatBytes };
5
- import * as path from 'path';
6
- import { getBrowserRuntimeDir, getProfileRuntimeDir, listProfileCacheDirs, profileScopeSql } from './paths.js';
7
- import { formatRelativeTime } from '../session/relative-time.js';
8
- import { getSessionById, listBrowserSessionRecords, pruneToolSessions } from '../session/db.js';
9
- import Database from '../sqlite.js';
10
- import { getHistoryDir } from '../state.js';
11
- import { listPidSessionEntries } from '../session/pid-registry.js';
12
- import { loadHookSessionIndex } from '../session/hook-sessions.js';
13
- import { readRecentActivity } from '../feed/activity.js';
14
- const EXT_KIND = {
15
- '.png': 'screenshot',
16
- '.jpg': 'screenshot',
17
- '.jpeg': 'screenshot',
18
- '.webp': 'screenshot',
19
- '.pdf': 'pdf',
20
- '.webm': 'recording',
21
- };
22
- function statSafe(p) {
23
- try {
24
- return fs.statSync(p);
25
- }
26
- catch {
27
- return null;
28
- }
29
- }
30
- function walkFiles(dir) {
31
- let out = [];
32
- let entries;
33
- try {
34
- entries = fs.readdirSync(dir, { withFileTypes: true });
35
- }
36
- catch {
37
- return out;
38
- }
39
- for (const e of entries) {
40
- const full = path.join(dir, e.name);
41
- if (e.isDirectory())
42
- out = out.concat(walkFiles(full));
43
- else if (e.isFile())
44
- out.push(full);
45
- }
46
- return out;
47
- }
48
- function listTaskArtifacts(dir, task) {
49
- const artifacts = [];
50
- for (const file of walkFiles(dir)) {
51
- const kind = EXT_KIND[path.extname(file).toLowerCase()];
52
- if (!kind)
53
- continue;
54
- const st = statSafe(file);
55
- if (!st)
56
- continue;
57
- artifacts.push({ kind, task, name: path.basename(file), path: file, bytes: st.size, mtimeMs: st.mtimeMs });
58
- }
59
- return artifacts;
60
- }
61
- function listProfileArtifacts(profile) {
62
- const root = getProfileRuntimeDir(profile);
63
- const artifacts = [];
64
- const sessionsRoot = path.join(root, 'sessions');
65
- let taskDirs = [];
66
- try {
67
- taskDirs = fs.readdirSync(sessionsRoot, { withFileTypes: true });
68
- }
69
- catch { }
70
- for (const t of taskDirs) {
71
- if (t.isDirectory())
72
- artifacts.push(...listTaskArtifacts(path.join(sessionsRoot, t.name), t.name));
73
- }
74
- for (const file of walkFiles(path.join(root, 'downloads'))) {
75
- const st = statSafe(file);
76
- if (!st)
77
- continue;
78
- artifacts.push({ kind: 'download', name: path.basename(file), path: file, bytes: st.size, mtimeMs: st.mtimeMs });
79
- }
80
- artifacts.sort((a, b) => b.mtimeMs - a.mtimeMs);
81
- return artifacts;
82
- }
83
- function listBrowserSessions(only) {
84
- let profiles;
85
- if (only) {
86
- const dirs = listProfileCacheDirs(only).map((d) => path.basename(d));
87
- profiles = dirs.length > 0 ? dirs : [only];
88
- }
89
- else {
90
- try {
91
- profiles = fs.readdirSync(getBrowserRuntimeDir(), { withFileTypes: true })
92
- .filter((e) => e.isDirectory() && e.name !== 'sessions')
93
- .map((e) => e.name)
94
- .sort();
95
- }
96
- catch {
97
- profiles = [];
98
- }
99
- }
100
- return profiles
101
- .map((p) => ({ profile: p, artifacts: listProfileArtifacts(p) }))
102
- .filter((r) => !!only || r.artifacts.length > 0);
103
- }
104
- function countByKind(artifacts) {
105
- const counts = { screenshot: 0, pdf: 0, recording: 0, download: 0 };
106
- for (const a of artifacts)
107
- counts[a.kind]++;
108
- return counts;
109
- }
110
- export function renderBrowserSessions(groups) {
111
- if (groups.length === 0)
112
- return 'No browser profiles found.';
113
- const lines = [];
114
- for (const g of groups) {
115
- const counts = countByKind(g.artifacts);
116
- lines.push(`${g.profile} ` +
117
- `screenshots ${counts.screenshot} pdfs ${counts.pdf} recordings ${counts.recording} downloads ${counts.download}`);
118
- if (g.artifacts.length === 0) {
119
- lines.push(' (no captures yet)');
120
- continue;
121
- }
122
- for (const a of g.artifacts) {
123
- const when = formatRelativeTime(new Date(a.mtimeMs).toISOString());
124
- const where = a.kind === 'download' ? 'downloads/' : `sessions/${a.task}/`;
125
- lines.push(` ${when.padEnd(12)} ${a.name.padEnd(28)} ${formatBytes(a.bytes).padStart(8)} ${where}`);
126
- }
127
- }
128
- return lines.join('\n');
129
- }
130
- export function resolveArtifact(groups, selector) {
131
- const all = groups.flatMap((g) => g.artifacts).sort((a, b) => b.mtimeMs - a.mtimeMs);
132
- if (all.length === 0)
133
- return null;
134
- if (selector === 'latest')
135
- return all[0].path;
136
- const hit = all.find((a) => a.name === selector) ?? all.find((a) => a.name.includes(selector));
137
- return hit ? hit.path : null;
138
- }
139
- export const BROWSER_HISTORY_LIMIT = 2000;
140
- export function nativeBrowserHistoryPath() {
141
- return path.join(getHistoryDir(), 'browser', 'history.db');
142
- }
143
- const SUMMARY_TEXT_FIELDS = ['actor', 'sessionId', 'launchId', 'machine', 'captureDir', 'capturesRemote'];
144
- const COUNT_KINDS = ['screenshot', 'pdf', 'recording', 'download'];
145
- function parseSummary(file, raw) {
146
- let value;
147
- try {
148
- value = JSON.parse(raw);
149
- }
150
- catch (error) {
151
- throw new Error(`unreadable browser history record in ${file}: ${error.message}`);
152
- }
153
- const r = value;
154
- if (!r || typeof r !== 'object' || typeof r.profile !== 'string' || typeof r.task !== 'string'
155
- || !Number.isFinite(r.startedAt) || !Number.isFinite(r.lastActivity)) {
156
- throw new Error(`unexpected browser history record in ${file}: needs profile, task and finite timestamps`);
157
- }
158
- const summary = {
159
- profile: r.profile, task: r.task, startedAt: r.startedAt, lastActivity: r.lastActivity,
160
- };
161
- for (const key of SUMMARY_TEXT_FIELDS) {
162
- if (typeof r[key] === 'string')
163
- summary[key] = r[key];
164
- }
165
- if (r.counts && typeof r.counts === 'object') {
166
- const counts = {};
167
- for (const kind of COUNT_KINDS) {
168
- const n = r.counts[kind];
169
- if (Number.isFinite(n))
170
- counts[kind] = n;
171
- }
172
- summary.counts = counts;
173
- }
174
- return summary;
175
- }
176
- export function readNativeBrowserHistory(query = {}, file = nativeBrowserHistoryPath()) {
177
- if (!fs.existsSync(file))
178
- return [];
179
- const where = query.key ? { sql: 'profile = ?', params: [query.key] }
180
- : query.profile ? profileScopeSql('profile', query.profile) : undefined;
181
- const db = new Database(file, { readOnly: true });
182
- try {
183
- const rows = db.prepare(`SELECT record FROM tasks${where ? ` WHERE ${where.sql}` : ''} ORDER BY last_activity DESC${query.limit === undefined ? '' : ' LIMIT ?'}`).all(...(where?.params ?? []), ...(query.limit === undefined ? [] : [query.limit]));
184
- return rows.map((row) => parseSummary(file, row.record));
185
- }
186
- finally {
187
- db.close();
188
- }
189
- }
190
- export function readBrowserTaskHistory(query = {}) {
191
- const merged = new Map();
192
- const id = (s) => `${s.profile}\0${s.task}`;
193
- const legacyRows = query.key
194
- ? listBrowserSessionRecords(query.key, { limit: query.limit })
195
- : listBrowserSessionRecords(query.profile, { deviceKeys: true, limit: query.limit });
196
- for (const legacy of legacyRows) {
197
- if (legacy.startedAt === undefined)
198
- continue;
199
- merged.set(id(legacy), { ...legacy, startedAt: legacy.startedAt, lastActivity: legacy.lastActivity ?? legacy.startedAt });
200
- }
201
- for (const native of readNativeBrowserHistory(query)) {
202
- const legacy = merged.get(id(native));
203
- merged.set(id(native), legacy ? { ...legacy, ...native } : native);
204
- }
205
- return [...merged.values()];
206
- }
207
- export function loadTaskIdentities(profile) {
208
- const out = new Map();
209
- let raw;
210
- try {
211
- raw = fs.readFileSync(path.join(getProfileRuntimeDir(profile), 'tasks.json'), 'utf8');
212
- }
213
- catch {
214
- return out;
215
- }
216
- let parsed;
217
- try {
218
- parsed = JSON.parse(raw);
219
- }
220
- catch {
221
- return out;
222
- }
223
- if (!parsed || typeof parsed !== 'object')
224
- return out;
225
- for (const [name, value] of Object.entries(parsed)) {
226
- if (!value || typeof value !== 'object')
227
- continue;
228
- const t = value;
229
- out.set(name, {
230
- owner: typeof t.owner === 'string' ? t.owner : undefined,
231
- launchId: typeof t.launchId === 'string' ? t.launchId : undefined,
232
- sessionId: typeof t.sessionId === 'string' ? t.sessionId : undefined,
233
- });
234
- }
235
- return out;
236
- }
237
- export function loadDurableTaskIdentities(profile) {
238
- const merged = new Map();
239
- for (const record of readBrowserTaskHistory({ key: profile })) {
240
- const { actor, profile: _profile, task: _task, ...rest } = record;
241
- merged.set(record.task, { ...rest, owner: actor });
242
- }
243
- for (const [task, live] of loadTaskIdentities(profile)) {
244
- const durable = merged.get(task);
245
- merged.set(task, {
246
- ...durable,
247
- owner: live.owner ?? durable?.owner,
248
- launchId: live.launchId ?? durable?.launchId,
249
- sessionId: live.sessionId ?? durable?.sessionId,
250
- });
251
- }
252
- return merged;
253
- }
254
- export function buildLaunchSessionIndex() {
255
- const byLaunchId = new Map();
256
- for (const ev of readRecentActivity({ maxBytesPerSession: 64 * 1024 })) {
257
- if (ev.launchId && ev.sessionId)
258
- byLaunchId.set(ev.launchId, ev.sessionId);
259
- }
260
- for (const [launchId, rec] of loadHookSessionIndex().byLaunchId) {
261
- if (rec.session_id)
262
- byLaunchId.set(launchId, rec.session_id);
263
- }
264
- for (const entry of listPidSessionEntries()) {
265
- if (entry.launchId && entry.sessionId)
266
- byLaunchId.set(entry.launchId, entry.sessionId);
267
- }
268
- return { byLaunchId };
269
- }
270
- export function resolveLaunchSession(index, launchId) {
271
- const sessionId = index.byLaunchId.get(launchId);
272
- return sessionId ? getSessionById(sessionId) : null;
273
- }
274
- function mergeCounts(found, recorded) {
275
- const out = { ...found };
276
- for (const kind of COUNT_KINDS)
277
- out[kind] = Math.max(found[kind], recorded?.[kind] ?? 0);
278
- return out;
279
- }
280
- export function groupIntoRows(groups, taskIdentities, resolveLaunch, resolveSession, listed) {
281
- const rows = [];
282
- for (const g of groups) {
283
- const identities = taskIdentities.get(g.profile) ?? new Map();
284
- const byTask = new Map();
285
- const downloads = [];
286
- for (const a of g.artifacts) {
287
- if (a.kind === 'download' || !a.task) {
288
- downloads.push(a);
289
- continue;
290
- }
291
- const list = byTask.get(a.task) ?? [];
292
- list.push(a);
293
- byTask.set(a.task, list);
294
- }
295
- for (const task of listed?.get(g.profile) ?? []) {
296
- if (!byTask.has(task))
297
- byTask.set(task, []);
298
- }
299
- for (const [task, artifacts] of byTask) {
300
- artifacts.sort((a, b) => b.mtimeMs - a.mtimeMs);
301
- const identity = identities.get(task);
302
- let linkedSession = null;
303
- if (identity?.sessionId && resolveSession)
304
- linkedSession = resolveSession(identity.sessionId);
305
- if (!linkedSession && identity?.launchId && resolveLaunch) {
306
- linkedSession = resolveLaunch(identity.launchId);
307
- }
308
- const hasIdentityKey = !!(identity?.sessionId || identity?.launchId);
309
- rows.push({
310
- kind: 'task',
311
- profile: g.profile,
312
- task,
313
- owner: identity?.owner,
314
- launchId: identity?.launchId,
315
- sessionId: identity?.sessionId,
316
- linkStatus: linkedSession ? 'linked' : hasIdentityKey ? 'unresolved' : 'unlinked',
317
- linkedSession: linkedSession ?? undefined,
318
- artifacts,
319
- counts: mergeCounts(countByKind(artifacts), identity?.counts),
320
- latestMtimeMs: Math.max(artifacts[0]?.mtimeMs ?? 0, identity?.lastActivity ?? 0),
321
- ...(identity?.startedAt !== undefined ? { startedAt: identity.startedAt } : {}),
322
- ...(identity?.machine ? { machine: identity.machine } : {}),
323
- ...(identity?.captureDir ? { captureDir: identity.captureDir } : {}),
324
- ...(identity?.capturesRemote ? { capturesRemote: identity.capturesRemote } : {}),
325
- });
326
- }
327
- if (downloads.length > 0) {
328
- downloads.sort((a, b) => b.mtimeMs - a.mtimeMs);
329
- rows.push({
330
- kind: 'downloads',
331
- profile: g.profile,
332
- linkStatus: 'unlinked',
333
- artifacts: downloads,
334
- counts: countByKind(downloads),
335
- latestMtimeMs: downloads[0]?.mtimeMs ?? 0,
336
- });
337
- }
338
- }
339
- rows.sort((a, b) => b.latestMtimeMs - a.latestMtimeMs);
340
- return rows;
341
- }
342
- export function readBrowserSessionRows(profile) {
343
- const groups = listBrowserSessions(profile);
344
- const byProfile = new Map(groups.map((g) => [g.profile, g]));
345
- const listed = new Map();
346
- for (const record of readBrowserTaskHistory({ profile, limit: BROWSER_HISTORY_LIMIT })) {
347
- if (!byProfile.has(record.profile)) {
348
- const group = { profile: record.profile, artifacts: listProfileArtifacts(record.profile) };
349
- byProfile.set(record.profile, group);
350
- groups.push(group);
351
- }
352
- const tasks = listed.get(record.profile) ?? new Set();
353
- tasks.add(record.task);
354
- listed.set(record.profile, tasks);
355
- }
356
- const taskIdentities = new Map(groups.map((g) => [g.profile, loadDurableTaskIdentities(g.profile)]));
357
- for (const group of groups) {
358
- const identities = taskIdentities.get(group.profile);
359
- const known = new Set(group.artifacts.map((a) => a.path));
360
- const tasks = new Set([...(listed.get(group.profile) ?? []), ...group.artifacts.flatMap((a) => a.task ? [a.task] : [])]);
361
- for (const task of tasks) {
362
- const identity = identities.get(task);
363
- if (!identity?.captureDir || identity.capturesRemote)
364
- continue;
365
- group.artifacts.push(...listTaskArtifacts(identity.captureDir, task).filter((a) => !known.has(a.path)));
366
- }
367
- }
368
- const index = buildLaunchSessionIndex();
369
- return groupIntoRows(groups, taskIdentities, (launchId) => resolveLaunchSession(index, launchId), (sessionId) => getSessionById(sessionId), listed);
370
- }
371
- export function buildBrowserSessionRows(profile) {
372
- try {
373
- pruneToolSessions();
374
- }
375
- catch { }
376
- return readBrowserSessionRows(profile);
377
- }
378
- export function matchesBrowserSessionRow(row, query) {
379
- const q = query.trim().toLowerCase();
380
- if (!q)
381
- return true;
382
- if (row.task?.toLowerCase().includes(q))
383
- return true;
384
- if (row.profile.toLowerCase().includes(q))
385
- return true;
386
- if (row.kind === 'downloads' && 'downloads'.includes(q))
387
- return true;
388
- const s = row.linkedSession;
389
- if (s && (s.agent.toLowerCase().includes(q) || s.topic?.toLowerCase().includes(q) || s.label?.toLowerCase().includes(q))) {
390
- return true;
391
- }
392
- return row.artifacts.some((a) => a.name.toLowerCase().includes(q));
393
- }
394
- export async function runBrowserSessions(opts) {
395
- const groups = listBrowserSessions(opts.profile);
396
- if (opts.open !== undefined && opts.open !== false) {
397
- const selector = opts.open === true ? 'latest' : opts.open;
398
- const target = resolveArtifact(groups, selector);
399
- if (!target) {
400
- console.error(`No capture matching "${selector}".`);
401
- process.exit(1);
402
- }
403
- console.log(target);
404
- if ((await showFile(target)).via === 'none') {
405
- console.error(`Could not open ${target}`);
406
- process.exit(1);
407
- }
408
- return;
409
- }
410
- if (opts.json) {
411
- console.log(JSON.stringify(groups, null, 2));
412
- return;
413
- }
414
- console.log(renderBrowserSessions(groups));
415
- }
@@ -1,78 +0,0 @@
1
- import type { SessionMeta } from '@phnx-labs/sessions-cli/reader';
2
- export declare const TASK_PREVIEW_MAX_CHARS = 200;
3
- export interface ComputerAction {
4
- verb: string;
5
- ts: string;
6
- tsMs: number;
7
- pid: number;
8
- invocationId?: string;
9
- targetPid?: number;
10
- bundle?: string;
11
- host?: string;
12
- task?: string;
13
- sessionId?: string;
14
- launchId?: string;
15
- agent?: string;
16
- machineId?: string;
17
- hostname?: string;
18
- capture?: {
19
- path: string;
20
- kind: 'screenshot';
21
- name: string;
22
- bytes?: number;
23
- };
24
- }
25
- export declare function standaloneComputerActionsDir(): string;
26
- export declare function listStandaloneComputerActions(opts?: {
27
- limit?: number;
28
- dir?: string;
29
- observer?: string;
30
- }): ComputerAction[];
31
- export declare function mergeComputerActionSources(standalone: ComputerAction[], legacy: ComputerAction[]): ComputerAction[];
32
- export declare function listComputerActions(opts?: {
33
- limit?: number;
34
- }): ComputerAction[];
35
- export type ComputerRunLinkStatus = 'linked' | 'unresolved' | 'unlinked';
36
- export interface ComputerRunRow {
37
- pid?: number;
38
- invocationId?: string;
39
- recoveredActionCount?: number;
40
- task?: string;
41
- machine: string;
42
- machineId?: string;
43
- remoteHost?: string;
44
- bundle?: string;
45
- agent?: string;
46
- sessionId?: string;
47
- launchId?: string;
48
- linkStatus: ComputerRunLinkStatus;
49
- linkedSession?: SessionMeta;
50
- actions: ComputerAction[];
51
- counts: Record<string, number>;
52
- startMs: number;
53
- endMs: number;
54
- }
55
- export declare function groupIntoComputerRuns(actions: ComputerAction[], resolveSession?: (sessionId: string) => SessionMeta | null, resolveLaunch?: (launchId: string) => SessionMeta | null): ComputerRunRow[];
56
- export declare function buildComputerSessionRows(opts?: {
57
- limit?: number;
58
- machine?: string;
59
- observer?: string;
60
- }): ComputerRunRow[];
61
- export declare function matchesComputerSessionRow(row: ComputerRunRow, queryText: string): boolean;
62
- export declare function formatRowActions(row: ComputerRunRow): string;
63
- export declare function formatActionCounts(counts: Record<string, number>): string;
64
- export declare function renderComputerSessionRows(rows: ComputerRunRow[]): string;
65
- export declare const DEFAULT_ROW_DISPLAY_LIMIT = 50;
66
- export declare function applyRowDisplayLimit(rows: ComputerRunRow[], limit?: number): {
67
- shown: ComputerRunRow[];
68
- more: number;
69
- };
70
- export declare function runComputerSessions(opts: {
71
- machine?: string;
72
- json?: boolean;
73
- limit?: number;
74
- }): void;
75
- export declare function printComputerSessionRows(rows: ComputerRunRow[], opts: {
76
- json?: boolean;
77
- limit?: number;
78
- }): void;