@phnx-labs/agents-cli 1.23.17 → 1.23.18
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 +66 -0
- package/README.md +140 -165
- package/dist/bootstrap.js +10 -16
- package/dist/cli/command-registry.d.ts +1 -2
- package/dist/cli/command-registry.js +1 -10
- package/dist/commands/accounts.js +7 -7
- package/dist/commands/cloud-transcripts.d.ts +0 -1
- package/dist/commands/cloud-transcripts.js +2 -2
- package/dist/commands/cloud.js +1 -1
- package/dist/commands/config.js +0 -4
- package/dist/commands/cost.js +1 -1
- package/dist/commands/daemon-index.js +0 -1
- package/dist/commands/detach.d.ts +1 -1
- package/dist/commands/detach.js +5 -5
- package/dist/commands/exec.js +10 -22
- package/dist/commands/feed.d.ts +1 -1
- package/dist/commands/feed.js +3 -3
- package/dist/commands/focus.d.ts +1 -4
- package/dist/commands/focus.js +12 -13
- package/dist/commands/fork.d.ts +0 -1
- package/dist/commands/fork.js +7 -16
- package/dist/commands/harness-wizard.js +1 -1
- package/dist/commands/harness.js +1 -1
- package/dist/commands/insights.d.ts +0 -1
- package/dist/commands/insights.js +3 -7
- package/dist/commands/open.js +1 -1
- package/dist/commands/output.js +1 -1
- package/dist/commands/profiles.d.ts +1 -1
- package/dist/commands/profiles.js +2 -2
- package/dist/commands/projects.js +1 -1
- package/dist/commands/prune.js +1 -1
- package/dist/commands/ps.d.ts +0 -1
- package/dist/commands/ps.js +63 -18
- package/dist/commands/routines.js +1 -1
- package/dist/commands/send.js +1 -1
- package/dist/commands/sessions-backfill.d.ts +0 -1
- package/dist/commands/sessions-backfill.js +3 -6
- package/dist/commands/sessions-browser.d.ts +0 -10
- package/dist/commands/sessions-browser.js +19 -25
- package/dist/commands/sessions-migrate.d.ts +2 -2
- package/dist/commands/sessions-migrate.js +13 -13
- package/dist/commands/sessions-optimize.d.ts +0 -1
- package/dist/commands/sessions-optimize.js +0 -3
- package/dist/commands/sessions-picker.js +11 -11
- package/dist/commands/sessions-resume.d.ts +16 -15
- package/dist/commands/sessions-resume.js +101 -269
- package/dist/commands/sessions-stats.d.ts +0 -1
- package/dist/commands/sessions-stats.js +5 -8
- package/dist/commands/sessions-stop.d.ts +1 -1
- package/dist/commands/sessions-stop.js +6 -6
- package/dist/commands/sessions-trace.d.ts +1 -1
- package/dist/commands/sessions-trace.js +40 -17
- package/dist/commands/sessions-watch.js +2 -2
- package/dist/commands/sessions.test-fixture.d.ts +1 -0
- package/dist/commands/sessions.test-fixture.js +14 -0
- package/dist/commands/setup-browser.js +4 -4
- package/dist/commands/setup-computer.js +4 -4
- package/dist/commands/setup-fleet.js +1 -1
- package/dist/commands/setup-preferences.js +1 -1
- package/dist/commands/{sessions-backup-setup.d.ts → setup-session-backup.d.ts} +2 -2
- package/dist/commands/{sessions-backup-setup.js → setup-session-backup.js} +8 -8
- package/dist/commands/setup.js +3 -1
- package/dist/commands/ssh.js +4 -5
- package/dist/commands/sync.js +1 -1
- package/dist/commands/teams.js +2 -2
- package/dist/commands/utils.d.ts +0 -1
- package/dist/commands/utils.js +0 -10
- package/dist/index.js +0 -71
- package/dist/lib/analytics/mix-commands.js +1 -1
- package/dist/lib/auth-mint.js +2 -2
- package/dist/lib/browser-client.d.ts +0 -1
- package/dist/lib/browser-client.js +0 -3
- package/dist/lib/cloud/antigravity.js +1 -1
- package/dist/lib/cloud/cursor.js +3 -3
- package/dist/lib/cloudflare/creds.js +2 -2
- package/dist/lib/computer/context.d.ts +4 -21
- package/dist/lib/computer/context.js +3 -24
- package/dist/lib/computer/policy.d.ts +0 -10
- package/dist/lib/computer/policy.js +0 -28
- package/dist/lib/computer-client.d.ts +0 -44
- package/dist/lib/computer-client.js +17 -121
- package/dist/lib/config-keys.d.ts +1 -1
- package/dist/lib/config-keys.js +0 -3
- package/dist/lib/crabbox/cli.js +1 -1
- package/dist/lib/device-config.js +5 -28
- package/dist/lib/devices/connect.d.ts +1 -1
- package/dist/lib/devices/connect.js +3 -6
- package/dist/lib/devices/doctor-findings.d.ts +2 -1
- package/dist/lib/devices/doctor-findings.js +4 -4
- package/dist/lib/exec.js +1 -1
- package/dist/lib/feed/activity.js +1 -1
- package/dist/lib/fleet/apply.js +1 -1
- package/dist/lib/help.d.ts +0 -1
- package/dist/lib/help.js +2 -10
- package/dist/lib/hosts/option.js +1 -1
- package/dist/lib/hosts/passthrough.d.ts +0 -1
- package/dist/lib/hosts/passthrough.js +2 -26
- package/dist/lib/hosts/reconnect.js +5 -5
- package/dist/lib/hosts/remote-cmd.d.ts +3 -5
- package/dist/lib/hosts/remote-cmd.js +15 -20
- package/dist/lib/hosts/remote-session-id.js +1 -1
- package/dist/lib/installations/active-check.js +1 -1
- package/dist/lib/installations/migrate.js +4 -15
- package/dist/lib/installations/versions.js +1 -1
- package/dist/lib/launch-log.js +3 -6
- package/dist/lib/owner-notify.d.ts +1 -6
- package/dist/lib/owner-notify.js +0 -2
- package/dist/lib/paths.d.ts +0 -1
- package/dist/lib/paths.js +0 -8
- package/dist/lib/permissions.js +1 -1
- package/dist/lib/redact.d.ts +0 -1
- package/dist/lib/redact.js +0 -4
- package/dist/lib/remote-agents-json.d.ts +3 -1
- package/dist/lib/remote-agents-json.js +8 -6
- package/dist/lib/reserved-stores.js +1 -1
- package/dist/lib/scheduling/routines.d.ts +0 -1
- package/dist/lib/scheduling/routines.js +1 -1
- package/dist/lib/session/active.d.ts +1 -1
- package/dist/lib/session/db.js +3 -3
- package/dist/lib/session/detached.d.ts +0 -1
- package/dist/lib/session/detached.js +0 -23
- package/dist/lib/session/discover.d.ts +2 -2
- package/dist/lib/session/presentation.d.ts +0 -7
- package/dist/lib/session/presentation.js +4 -4
- package/dist/lib/session/projection.js +1 -1
- package/dist/lib/session/remote/remote-list.d.ts +2 -0
- package/dist/lib/session/remote/remote-list.js +3 -2
- package/dist/lib/session/remote/watch.js +4 -5
- package/dist/lib/session/remote-active.js +1 -1
- package/dist/lib/session/resume-command.d.ts +0 -1
- package/dist/lib/session/resume-command.js +1 -4
- package/dist/lib/session/resume-owner.d.ts +0 -2
- package/dist/lib/session/resume-owner.js +0 -6
- package/dist/lib/session/selection.d.ts +4 -5
- package/dist/lib/session/selection.js +2 -2
- package/dist/lib/session/sync/config.d.ts +0 -25
- package/dist/lib/session/sync/config.js +0 -62
- package/dist/lib/session/sync/managed-config.d.ts +0 -1
- package/dist/lib/session/sync/managed-config.js +0 -3
- package/dist/lib/session/sync/worker-template.js +1 -1
- package/dist/lib/sessions-client.d.ts +0 -16
- package/dist/lib/sessions-client.js +1 -187
- package/dist/lib/startup/command-registry.d.ts +2 -0
- package/dist/lib/startup/command-registry.js +36 -3
- package/dist/lib/startup/root-command.d.ts +0 -1
- package/dist/lib/startup/root-command.js +0 -21
- package/dist/lib/sync-umbrella.js +1 -1
- package/dist/lib/terminal/resolve.js +1 -1
- package/dist/lib/watchdog/rotate.js +1 -1
- package/dist/lib/watchdog/watchdog.d.ts +1 -1
- package/dist/lib/watchdog/watchdog.js +2 -2
- package/package.json +1 -1
- package/dist/commands/browser.d.ts +0 -7
- package/dist/commands/browser.js +0 -139
- package/dist/commands/computer.d.ts +0 -48
- package/dist/commands/computer.js +0 -244
- package/dist/commands/resume.d.ts +0 -23
- package/dist/commands/resume.js +0 -158
- package/dist/commands/secrets-passthrough.d.ts +0 -3
- package/dist/commands/secrets-passthrough.js +0 -52
- package/dist/commands/sessions-bookmark.d.ts +0 -2
- package/dist/commands/sessions-bookmark.js +0 -92
- package/dist/commands/sessions-export.d.ts +0 -31
- package/dist/commands/sessions-export.js +0 -409
- package/dist/commands/sessions-import.d.ts +0 -6
- package/dist/commands/sessions-import.js +0 -343
- package/dist/commands/sessions-inject.d.ts +0 -14
- package/dist/commands/sessions-inject.js +0 -143
- package/dist/commands/sessions-picker-factory.d.ts +0 -24
- package/dist/commands/sessions-picker-factory.js +0 -59
- package/dist/commands/sessions-render.d.ts +0 -11
- package/dist/commands/sessions-render.js +0 -119
- package/dist/commands/sessions-share.d.ts +0 -15
- package/dist/commands/sessions-share.js +0 -171
- package/dist/commands/sessions.d.ts +0 -122
- package/dist/commands/sessions.js +0 -1760
- package/dist/lib/address.d.ts +0 -39
- package/dist/lib/address.js +0 -128
- package/dist/lib/computer/record.d.ts +0 -6
- package/dist/lib/computer/record.js +0 -25
- package/dist/lib/openclaw-keychain.d.ts +0 -43
- package/dist/lib/openclaw-keychain.js +0 -227
- package/dist/lib/session/bundle.d.ts +0 -76
- package/dist/lib/session/bundle.js +0 -146
- package/dist/lib/session/remote/remote-bundle.d.ts +0 -7
- package/dist/lib/session/remote/remote-bundle.js +0 -40
- package/dist/lib/session/remote/remote.d.ts +0 -35
- package/dist/lib/session/remote/remote.js +0 -198
- package/dist/lib/session/remote-bundle.d.ts +0 -1
- package/dist/lib/session/remote-bundle.js +0 -1
- package/dist/lib/session/remote.d.ts +0 -1
- package/dist/lib/session/remote.js +0 -1
- package/dist/lib/session/sync/agents.d.ts +0 -24
- package/dist/lib/session/sync/agents.js +0 -0
- package/dist/lib/session/sync/backend.d.ts +0 -22
- package/dist/lib/session/sync/backend.js +0 -44
- package/dist/lib/session/sync/managed-key.d.ts +0 -5
- package/dist/lib/session/sync/managed-key.js +0 -87
- package/dist/lib/session/sync/net-client.d.ts +0 -29
- package/dist/lib/session/sync/net-client.js +0 -87
- package/dist/lib/session/sync/r2.d.ts +0 -20
- package/dist/lib/session/sync/r2.js +0 -103
- package/dist/lib/session/sync/transcript-crypto.d.ts +0 -41
- package/dist/lib/session/sync/transcript-crypto.js +0 -115
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
import * as fs from 'fs';
|
|
2
|
-
import { stripVTControlCharacters } from 'node:util';
|
|
3
|
-
import chalk from 'chalk';
|
|
4
|
-
import { setHelpSections } from '../lib/help.js';
|
|
5
|
-
import { knownSecretValuesFromEnv, redactSecrets } from '../lib/redact.js';
|
|
6
|
-
import { discoverSessions } from '../lib/session/discover.js';
|
|
7
|
-
import { parseSession } from '@phnx-labs/sessions-cli/reader';
|
|
8
|
-
import { extractSessionTopic, isSyntheticUserMessage } from '@phnx-labs/sessions-cli/reader';
|
|
9
|
-
import { renderConversationMarkdown } from '@phnx-labs/sessions-cli/reader';
|
|
10
|
-
import { buildPreview } from './sessions-picker.js';
|
|
11
|
-
import { parseAgentFilter } from '../lib/session/selection.js';
|
|
12
|
-
import { selectSessions } from './sessions-export.js';
|
|
13
|
-
export const MARKDOWN_RENDER_AGENTS = [
|
|
14
|
-
'claude',
|
|
15
|
-
'codex',
|
|
16
|
-
'antigravity',
|
|
17
|
-
'opencode',
|
|
18
|
-
'grok',
|
|
19
|
-
'rush',
|
|
20
|
-
'hermes',
|
|
21
|
-
'kimi',
|
|
22
|
-
'droid',
|
|
23
|
-
'cursor',
|
|
24
|
-
];
|
|
25
|
-
function parseReasoning(value) {
|
|
26
|
-
if (value === 'omit' || value === 'fold' || value === 'include')
|
|
27
|
-
return value;
|
|
28
|
-
throw new Error(`Unknown reasoning mode "${value}". Expected omit, fold, or include.`);
|
|
29
|
-
}
|
|
30
|
-
function quotePreview(preview) {
|
|
31
|
-
return preview.split('\n').map((line) => `> ${line}`).join('\n');
|
|
32
|
-
}
|
|
33
|
-
export function renderSessionMarkdownDocument(session, options = {}) {
|
|
34
|
-
if (!MARKDOWN_RENDER_AGENTS.includes(session.agent)) {
|
|
35
|
-
throw new Error(`Cannot render ${session.agent} session ${session.shortId || session.id}: Markdown rendering supports ${MARKDOWN_RENDER_AGENTS.join(', ')}.`);
|
|
36
|
-
}
|
|
37
|
-
const events = parseSession(session.filePath, session.agent, { maxToolOutputChars: Infinity });
|
|
38
|
-
if (events.length === 0) {
|
|
39
|
-
throw new Error(`Cannot render ${session.agent} session ${session.shortId || session.id}: transcript produced no normalized events.`);
|
|
40
|
-
}
|
|
41
|
-
const shouldRedact = options.redact !== false;
|
|
42
|
-
const sanitize = (text) => shouldRedact ? redactSecrets(text, options.knownSecrets) : text;
|
|
43
|
-
const preview = sanitize(stripVTControlCharacters(buildPreview(session)));
|
|
44
|
-
const shareEvents = events.filter((event) => !(event.type === 'message' && event._synthetic));
|
|
45
|
-
const firstPrompt = shareEvents.find((event) => event.type === 'message' && event.role === 'user')?.content;
|
|
46
|
-
const title = sanitize(session.label || (firstPrompt ? extractSessionTopic(firstPrompt) : undefined) ||
|
|
47
|
-
(session.topic && !isSyntheticUserMessage(session.topic) ? session.topic : undefined) ||
|
|
48
|
-
`${session.agent} session ${session.shortId || session.id}`);
|
|
49
|
-
const conversation = renderConversationMarkdown(shareEvents, {
|
|
50
|
-
redact: shouldRedact,
|
|
51
|
-
knownSecrets: options.knownSecrets,
|
|
52
|
-
reasoning: options.reasoning ?? 'omit',
|
|
53
|
-
maxToolOutputChars: options.maxToolOutputChars,
|
|
54
|
-
});
|
|
55
|
-
return `# ${title}\n\n## Session preview\n\n${quotePreview(preview)}\n\n## Conversation\n\n${conversation}\n`;
|
|
56
|
-
}
|
|
57
|
-
export function registerSessionsRenderCommand(sessionsCmd) {
|
|
58
|
-
const cmd = sessionsCmd
|
|
59
|
-
.command('render <selectors...>')
|
|
60
|
-
.description('Render one or more sessions as readable, redacted Markdown for review or sharing.')
|
|
61
|
-
.option('--format <format>', 'Output format (md or markdown)', 'md')
|
|
62
|
-
.option('-o, --output <path>', 'Write the rendered document to a file instead of stdout')
|
|
63
|
-
.option('--reasoning <mode>', 'Reasoning visibility: omit, fold, or include', 'omit');
|
|
64
|
-
setHelpSections(cmd, {
|
|
65
|
-
examples: `# Render one redacted session for a confidential gist
|
|
66
|
-
agents sessions render a1b2c3d4 -o session.md
|
|
67
|
-
|
|
68
|
-
# Combine several sessions into one Markdown document
|
|
69
|
-
agents sessions render a1b2c3d4 d4c3b2a1 -o delivery-sessions.md
|
|
70
|
-
|
|
71
|
-
# Keep reasoning locally in collapsible sections and opt out of redaction
|
|
72
|
-
agents sessions render a1b2c3d4 --reasoning fold --no-redact`,
|
|
73
|
-
notes: `Markdown is redacted by default, including credential-shaped values and local home paths.
|
|
74
|
-
The preview at the top is the same preview shown by 'agents sessions'. Tool output is truncated
|
|
75
|
-
with an explicit note. Use --no-redact only for local output that will not be shared.`,
|
|
76
|
-
});
|
|
77
|
-
cmd.action(async (selectors, options, command) => {
|
|
78
|
-
const globals = command.optsWithGlobals();
|
|
79
|
-
if (!['md', 'markdown'].includes(options.format.toLowerCase())) {
|
|
80
|
-
throw new Error(`Unknown format "${options.format}". Expected md or markdown.`);
|
|
81
|
-
}
|
|
82
|
-
const reasoning = parseReasoning(options.reasoning);
|
|
83
|
-
const limit = Math.max(1, Number.parseInt(globals.limit || '100', 10) || 100);
|
|
84
|
-
const agent = parseAgentFilter(globals.agent).agent;
|
|
85
|
-
const sessions = selectSessions(await discoverSessions({
|
|
86
|
-
all: globals.all !== false,
|
|
87
|
-
since: globals.since,
|
|
88
|
-
limit,
|
|
89
|
-
agent: agent ?? undefined,
|
|
90
|
-
}), selectors);
|
|
91
|
-
if (sessions.length === 0) {
|
|
92
|
-
process.stderr.write(chalk.yellow('No sessions matched the selection.\n'));
|
|
93
|
-
process.exitCode = 1;
|
|
94
|
-
return;
|
|
95
|
-
}
|
|
96
|
-
const knownSecrets = globals.redact === false ? undefined : knownSecretValuesFromEnv();
|
|
97
|
-
const rendered = sessions.map((session) => ({
|
|
98
|
-
id: session.id,
|
|
99
|
-
agent: session.agent,
|
|
100
|
-
markdown: renderSessionMarkdownDocument(session, {
|
|
101
|
-
redact: globals.redact !== false,
|
|
102
|
-
reasoning,
|
|
103
|
-
knownSecrets,
|
|
104
|
-
}),
|
|
105
|
-
}));
|
|
106
|
-
const markdown = rendered.map((item) => item.markdown.trimEnd()).join('\n\n---\n\n') + '\n';
|
|
107
|
-
if (options.output)
|
|
108
|
-
fs.writeFileSync(options.output, markdown, { mode: 0o600 });
|
|
109
|
-
if (globals.json) {
|
|
110
|
-
process.stdout.write(JSON.stringify({ redacted: globals.redact !== false, reasoning, sessions: rendered }, null, 2) + '\n');
|
|
111
|
-
}
|
|
112
|
-
else if (!options.output) {
|
|
113
|
-
process.stdout.write(markdown);
|
|
114
|
-
}
|
|
115
|
-
else {
|
|
116
|
-
process.stderr.write(chalk.green(`Rendered ${rendered.length} session${rendered.length === 1 ? '' : 's'} to ${options.output}\n`));
|
|
117
|
-
}
|
|
118
|
-
});
|
|
119
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { Command } from 'commander';
|
|
2
|
-
import type { SessionMeta } from '@phnx-labs/sessions-cli/reader';
|
|
3
|
-
interface ShareOptions {
|
|
4
|
-
public?: boolean;
|
|
5
|
-
slug?: string;
|
|
6
|
-
label?: string;
|
|
7
|
-
expire?: string;
|
|
8
|
-
reasoning: string;
|
|
9
|
-
force?: boolean;
|
|
10
|
-
cover?: boolean;
|
|
11
|
-
}
|
|
12
|
-
export declare function defaultSessionSlug(session: SessionMeta): string;
|
|
13
|
-
export declare function buildArtifactsShareArgs(session: SessionMeta, options: Pick<ShareOptions, 'public' | 'slug' | 'label' | 'expire' | 'force' | 'cover'>, file: string): string[];
|
|
14
|
-
export declare function registerSessionsShareCommand(sessionsCmd: Command): void;
|
|
15
|
-
export {};
|
|
@@ -1,171 +0,0 @@
|
|
|
1
|
-
import * as fs from 'fs';
|
|
2
|
-
import * as os from 'os';
|
|
3
|
-
import * as path from 'path';
|
|
4
|
-
import { spawnSync } from 'node:child_process';
|
|
5
|
-
import chalk from 'chalk';
|
|
6
|
-
import { setHelpSections } from '../lib/help.js';
|
|
7
|
-
import { knownSecretValuesFromEnv, redactEmails } from '../lib/redact.js';
|
|
8
|
-
import { discoverSessions } from '../lib/session/discover.js';
|
|
9
|
-
import { renderSessionHtmlDocument } from '@phnx-labs/sessions-cli/reader';
|
|
10
|
-
import { resolveArtifactsBin, invocation, ArtifactsClientError } from '../lib/artifacts-client.js';
|
|
11
|
-
import { renderSessionMarkdownDocument } from './sessions-render.js';
|
|
12
|
-
import { selectSessions } from './sessions-export.js';
|
|
13
|
-
import { parseAgentFilter } from '../lib/session/selection.js';
|
|
14
|
-
function parseReasoning(value) {
|
|
15
|
-
if (value === 'omit' || value === 'fold' || value === 'include')
|
|
16
|
-
return value;
|
|
17
|
-
throw new Error(`Unknown reasoning mode "${value}". Expected omit, fold, or include.`);
|
|
18
|
-
}
|
|
19
|
-
export function defaultSessionSlug(session) {
|
|
20
|
-
return `session-${session.shortId || session.id}`;
|
|
21
|
-
}
|
|
22
|
-
export function buildArtifactsShareArgs(session, options, file) {
|
|
23
|
-
const args = [
|
|
24
|
-
'share',
|
|
25
|
-
file,
|
|
26
|
-
'--slug',
|
|
27
|
-
options.slug ?? defaultSessionSlug(session),
|
|
28
|
-
'--visibility',
|
|
29
|
-
options.public === true ? 'public' : 'unlisted',
|
|
30
|
-
'--meta',
|
|
31
|
-
'kind=session',
|
|
32
|
-
'--json',
|
|
33
|
-
];
|
|
34
|
-
if (options.expire)
|
|
35
|
-
args.push('--expire', options.expire);
|
|
36
|
-
if (options.force === true)
|
|
37
|
-
args.push('--force');
|
|
38
|
-
if (options.cover === false)
|
|
39
|
-
args.push('--no-cover');
|
|
40
|
-
if (options.label)
|
|
41
|
-
args.push('--label', options.label);
|
|
42
|
-
return args;
|
|
43
|
-
}
|
|
44
|
-
export function registerSessionsShareCommand(sessionsCmd) {
|
|
45
|
-
const cmd = sessionsCmd
|
|
46
|
-
.command('share <session>')
|
|
47
|
-
.description('Publish one session as a redacted, self-contained web page and print the link.')
|
|
48
|
-
.option('--public', 'List the page in your public share gallery (default: unlisted capability URL)')
|
|
49
|
-
.option('--slug <slug>', 'URL slug under your namespace (default: session-<shortId>)')
|
|
50
|
-
.option('--label <text>', 'Display title in the gallery and `artifacts share list`')
|
|
51
|
-
.option('--expire <spec>', 'Auto-expire window: 30d, 12h, a date, or never (default: 30d)')
|
|
52
|
-
.option('--reasoning <mode>', 'Reasoning visibility: omit, fold, or include', 'omit')
|
|
53
|
-
.option('--force', 'Publish despite the sensitive-content scan flagging the transcript')
|
|
54
|
-
.option('--no-cover', 'Skip generating the Open Graph preview image');
|
|
55
|
-
setHelpSections(cmd, {
|
|
56
|
-
examples: `# Share a session — prints an unlisted, redacted link
|
|
57
|
-
agents sessions share a1b2c3d4
|
|
58
|
-
|
|
59
|
-
# Put it in your public gallery at share.getrush.ai/<you>
|
|
60
|
-
agents sessions share a1b2c3d4 --public --label "How the retry bug got fixed"
|
|
61
|
-
|
|
62
|
-
# Keep the model's reasoning in collapsible sections
|
|
63
|
-
agents sessions share a1b2c3d4 --reasoning fold
|
|
64
|
-
|
|
65
|
-
# A link that does not decay
|
|
66
|
-
agents sessions share a1b2c3d4 --expire never`,
|
|
67
|
-
notes: `Publishes through the standalone artifacts CLI — install it with
|
|
68
|
-
'npm i -g @phnx-labs/artifacts-cli'. Sign in with
|
|
69
|
-
'artifacts auth login' for the managed endpoint (zero Cloudflare setup), or configure
|
|
70
|
-
your own bucket with 'artifacts share setup' / 'artifacts share join <baseUrl>'.
|
|
71
|
-
|
|
72
|
-
Unlisted by default — the URL is world-readable but the page stays out of your public
|
|
73
|
-
gallery and out of 'artifacts share list'. Pass --public to list it.
|
|
74
|
-
|
|
75
|
-
Secrets are redacted and 'artifacts share' runs its own pre-publish scan on the page,
|
|
76
|
-
so a transcript carrying emails or credential-shaped strings is refused unless you pass
|
|
77
|
-
--force. --no-redact (the sessions-level flag) disables redaction and is a bad idea for
|
|
78
|
-
anything you publish.
|
|
79
|
-
|
|
80
|
-
Re-running with the same session updates the same URL and keeps the prior version
|
|
81
|
-
as a revision ('artifacts share revisions <slug>').
|
|
82
|
-
|
|
83
|
-
Manage published sessions with 'artifacts share list' and 'artifacts share delete <slug>'.`,
|
|
84
|
-
});
|
|
85
|
-
cmd.action(async (selector, options, command) => {
|
|
86
|
-
const globals = command.optsWithGlobals();
|
|
87
|
-
const reasoning = parseReasoning(options.reasoning);
|
|
88
|
-
const limit = Math.max(1, Number.parseInt(globals.limit || '100', 10) || 100);
|
|
89
|
-
const agent = parseAgentFilter(globals.agent).agent;
|
|
90
|
-
const sessions = selectSessions(await discoverSessions({
|
|
91
|
-
all: globals.all !== false,
|
|
92
|
-
since: globals.since,
|
|
93
|
-
limit,
|
|
94
|
-
agent: agent ?? undefined,
|
|
95
|
-
}), [selector]);
|
|
96
|
-
if (sessions.length === 0) {
|
|
97
|
-
process.stderr.write(chalk.yellow(`No session matched "${selector}".\n`));
|
|
98
|
-
process.exitCode = 1;
|
|
99
|
-
return;
|
|
100
|
-
}
|
|
101
|
-
if (sessions.length > 1) {
|
|
102
|
-
process.stderr.write(chalk.yellow(`"${selector}" matched ${sessions.length} sessions. Share one at a time — pass a full or unique session id.\n`));
|
|
103
|
-
process.exitCode = 1;
|
|
104
|
-
return;
|
|
105
|
-
}
|
|
106
|
-
const session = sessions[0];
|
|
107
|
-
const redact = globals.redact !== false;
|
|
108
|
-
const markdown = renderSessionMarkdownDocument(session, {
|
|
109
|
-
redact,
|
|
110
|
-
reasoning,
|
|
111
|
-
knownSecrets: redact ? knownSecretValuesFromEnv() : undefined,
|
|
112
|
-
});
|
|
113
|
-
const page = renderSessionHtmlDocument(session, markdown, { redacted: redact });
|
|
114
|
-
const html = redact ? redactEmails(page) : page;
|
|
115
|
-
const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'agents-session-share-'));
|
|
116
|
-
const file = path.join(dir, `${defaultSessionSlug(session)}.html`);
|
|
117
|
-
try {
|
|
118
|
-
fs.writeFileSync(file, html, { mode: 0o600 });
|
|
119
|
-
let bin;
|
|
120
|
-
try {
|
|
121
|
-
bin = resolveArtifactsBin();
|
|
122
|
-
}
|
|
123
|
-
catch (err) {
|
|
124
|
-
if (err instanceof ArtifactsClientError) {
|
|
125
|
-
process.stderr.write(chalk.red(err.message + '\n'));
|
|
126
|
-
process.exitCode = 1;
|
|
127
|
-
return;
|
|
128
|
-
}
|
|
129
|
-
throw err;
|
|
130
|
-
}
|
|
131
|
-
const { command: execCommand, prefix } = invocation(bin);
|
|
132
|
-
const args = [...prefix, ...buildArtifactsShareArgs(session, options, file)];
|
|
133
|
-
const proc = spawnSync(execCommand, args, { encoding: 'utf-8' });
|
|
134
|
-
if (proc.error)
|
|
135
|
-
throw proc.error;
|
|
136
|
-
if (proc.status !== 0) {
|
|
137
|
-
process.stderr.write(proc.stderr || chalk.red(`artifacts share exited ${proc.status ?? 'with no status'}\n`));
|
|
138
|
-
process.exitCode = proc.status ?? 1;
|
|
139
|
-
return;
|
|
140
|
-
}
|
|
141
|
-
let result;
|
|
142
|
-
try {
|
|
143
|
-
result = JSON.parse(proc.stdout);
|
|
144
|
-
}
|
|
145
|
-
catch {
|
|
146
|
-
const preview = proc.stdout.trim().slice(0, 200);
|
|
147
|
-
process.stderr.write(chalk.red(`artifacts share returned a non-JSON response${preview ? `: ${preview}` : ' (empty output)'}\n`));
|
|
148
|
-
process.exitCode = 1;
|
|
149
|
-
return;
|
|
150
|
-
}
|
|
151
|
-
if (globals.json) {
|
|
152
|
-
process.stdout.write(JSON.stringify({
|
|
153
|
-
session: session.id,
|
|
154
|
-
agent: session.agent,
|
|
155
|
-
redacted: redact,
|
|
156
|
-
...result,
|
|
157
|
-
}, null, 2) + '\n');
|
|
158
|
-
return;
|
|
159
|
-
}
|
|
160
|
-
process.stdout.write(`${result.url}\n`);
|
|
161
|
-
const visibility = result.visibility ?? (result.unlisted ? 'unlisted' : options.public ? 'public' : 'unlisted');
|
|
162
|
-
const bits = [visibility, redact ? 'redacted' : chalk.red('NOT redacted')];
|
|
163
|
-
if (result.expiresAt)
|
|
164
|
-
bits.push(`expires ${String(result.expiresAt).slice(0, 10)}`);
|
|
165
|
-
process.stderr.write(chalk.dim(`${bits.join(' · ')}\n`));
|
|
166
|
-
}
|
|
167
|
-
finally {
|
|
168
|
-
fs.rmSync(dir, { recursive: true, force: true });
|
|
169
|
-
}
|
|
170
|
-
});
|
|
171
|
-
}
|
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
import { type Command } from 'commander';
|
|
2
|
-
import { type ProjectDef } from '../lib/projects.js';
|
|
3
|
-
import type { SessionMeta } from '@phnx-labs/sessions-cli/reader';
|
|
4
|
-
import { type ActiveSession } from '../lib/session/active.js';
|
|
5
|
-
export { activeSessionProjectKey, backfillActiveRowsFromIndex, backfillActiveRowsFromMeta, isRunningLiveSession, serializeActiveSessionsForJson, serializeSessionsJson, type BackfillMeta } from '../lib/session/active.js';
|
|
6
|
-
import { type RunMeta } from '../lib/scheduling/routines.js';
|
|
7
|
-
import { type TranscriptRenderOptions } from '../lib/session/presentation.js';
|
|
8
|
-
export { buildFilterOptions, renderSession, renderSessionLog, renderSessionLogJson, resolveViewMode, type TranscriptRenderOptions, } from '../lib/session/presentation.js';
|
|
9
|
-
import { type FleetResolveDeps, type LiveMetadataDeps, type SessionFilterOptions, type SessionSearchScope } from '../lib/session/selection.js';
|
|
10
|
-
interface SessionsOptions extends SessionFilterOptions, TranscriptRenderOptions {
|
|
11
|
-
unmanaged?: boolean;
|
|
12
|
-
query?: string[];
|
|
13
|
-
resolve?: string;
|
|
14
|
-
resolveSafeV1?: string;
|
|
15
|
-
resolveLaunchId?: string;
|
|
16
|
-
limit?: string;
|
|
17
|
-
sort?: string;
|
|
18
|
-
artifacts?: boolean;
|
|
19
|
-
artifact?: string;
|
|
20
|
-
active?: boolean;
|
|
21
|
-
roots?: boolean;
|
|
22
|
-
cloud?: boolean;
|
|
23
|
-
host?: string[];
|
|
24
|
-
tree?: boolean;
|
|
25
|
-
flat?: boolean;
|
|
26
|
-
waiting?: boolean;
|
|
27
|
-
working?: boolean;
|
|
28
|
-
idle?: boolean;
|
|
29
|
-
orphan?: boolean;
|
|
30
|
-
orphaned?: boolean;
|
|
31
|
-
crashed?: boolean;
|
|
32
|
-
closed?: boolean;
|
|
33
|
-
abandoned?: boolean;
|
|
34
|
-
queued?: boolean;
|
|
35
|
-
unknown?: boolean;
|
|
36
|
-
bookmarks?: boolean;
|
|
37
|
-
live?: boolean;
|
|
38
|
-
local?: boolean;
|
|
39
|
-
device?: string[];
|
|
40
|
-
devices?: string[];
|
|
41
|
-
claude?: boolean;
|
|
42
|
-
codex?: boolean;
|
|
43
|
-
kimi?: boolean;
|
|
44
|
-
antigravity?: boolean;
|
|
45
|
-
grok?: boolean;
|
|
46
|
-
opencode?: boolean;
|
|
47
|
-
interactive?: boolean;
|
|
48
|
-
printCmd?: boolean;
|
|
49
|
-
preview?: boolean;
|
|
50
|
-
skill?: string;
|
|
51
|
-
plugin?: string;
|
|
52
|
-
}
|
|
53
|
-
interface SessionPickerJsonRow extends SessionMeta {
|
|
54
|
-
state: ActiveSession['status'] | 'inactive';
|
|
55
|
-
resumable: boolean;
|
|
56
|
-
unwatched: boolean;
|
|
57
|
-
viewingIn: string | null;
|
|
58
|
-
sourceDevice: string;
|
|
59
|
-
lastActivityMs: number;
|
|
60
|
-
pid: number | null;
|
|
61
|
-
recovery: {
|
|
62
|
-
command: 'agents';
|
|
63
|
-
args: string[];
|
|
64
|
-
cwd?: string;
|
|
65
|
-
} | null;
|
|
66
|
-
}
|
|
67
|
-
export declare function serializeSessionPickerRows(sessions: SessionMeta[], liveSessions: ActiveSession[], self?: string): SessionPickerJsonRow[];
|
|
68
|
-
export declare function hasNoBrowserDisqualifyingFlags(options: SessionsOptions, query: string | undefined): boolean;
|
|
69
|
-
export interface RoutineRunGroup {
|
|
70
|
-
runId: string;
|
|
71
|
-
timestamp: string;
|
|
72
|
-
sessions: SessionMeta[];
|
|
73
|
-
}
|
|
74
|
-
interface RoutineChoice {
|
|
75
|
-
name: string;
|
|
76
|
-
lastRunAt: string;
|
|
77
|
-
runCount: number;
|
|
78
|
-
latestRunSessionCount: number;
|
|
79
|
-
}
|
|
80
|
-
export declare function buildRoutineRunGroups(sessions: SessionMeta[]): RoutineRunGroup[];
|
|
81
|
-
export declare function buildRoutineChoices(sessions: SessionMeta[], runOnlyNames?: string[]): RoutineChoice[];
|
|
82
|
-
export declare function filterSessionsByRoutine(sessions: SessionMeta[], routine: boolean | string, interactive: boolean): Promise<SessionMeta[] | null>;
|
|
83
|
-
type RoutineExecutionKind = 'agent' | 'command' | 'workflow';
|
|
84
|
-
export declare function executionKind(meta: RunMeta): RoutineExecutionKind;
|
|
85
|
-
export interface RoutineRunEntry {
|
|
86
|
-
meta: RunMeta;
|
|
87
|
-
sessions: SessionMeta[];
|
|
88
|
-
}
|
|
89
|
-
export interface RoutineDrilldown {
|
|
90
|
-
name: string;
|
|
91
|
-
runs: RoutineRunEntry[];
|
|
92
|
-
orphanSessions: RoutineRunGroup[];
|
|
93
|
-
runRecordCount: number;
|
|
94
|
-
linkedSessionCount: number;
|
|
95
|
-
isAgentRoutine: boolean;
|
|
96
|
-
}
|
|
97
|
-
export declare function printRoutineDrilldown(drill: RoutineDrilldown, liveIndex?: Map<string, ActiveSession>, opts?: {
|
|
98
|
-
hiddenCount?: number;
|
|
99
|
-
hiddenUnmanaged?: number;
|
|
100
|
-
}): void;
|
|
101
|
-
export declare function maybeLiveIndex(options: SessionsOptions): Promise<Map<string, ActiveSession> | undefined>;
|
|
102
|
-
export declare function overviewProjectKey(s: Pick<SessionMeta, 'project' | 'cwd'>, defs?: ProjectDef[]): string;
|
|
103
|
-
interface OverviewGroup {
|
|
104
|
-
key: string;
|
|
105
|
-
total: number;
|
|
106
|
-
shown: SessionMeta[];
|
|
107
|
-
more: number;
|
|
108
|
-
maxTs: string;
|
|
109
|
-
}
|
|
110
|
-
export declare function buildOverviewGroups(pool: SessionMeta[], perProjectCap: number, defs?: ProjectDef[]): {
|
|
111
|
-
groups: OverviewGroup[];
|
|
112
|
-
projectCount: number;
|
|
113
|
-
};
|
|
114
|
-
export declare function fleetNotFoundMessage(query: string, deviceCount: number, unreachable: string[]): string[];
|
|
115
|
-
export declare function artifactLookupScope(agent?: string, project?: string, routine?: boolean | string): SessionSearchScope;
|
|
116
|
-
export declare function resolveSessionMetadata(selector: string, scope: {
|
|
117
|
-
agent?: string;
|
|
118
|
-
project?: string;
|
|
119
|
-
local?: boolean;
|
|
120
|
-
hosts?: string[];
|
|
121
|
-
}, deps?: Pick<FleetResolveDeps, 'gatherRemoteList'> & LiveMetadataDeps): Promise<void>;
|
|
122
|
-
export declare function registerSessionsCommands(program: Command): void;
|