@phnx-labs/agents-cli 1.22.122 → 1.22.123
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 +261 -0
- package/README.md +49 -10
- package/dist/bootstrap.js +22 -17
- package/dist/cli/command-registry.d.ts +0 -1
- package/dist/cli/command-registry.js +2 -10
- package/dist/commands/auth.js +13 -4
- package/dist/commands/browser.js +3 -4
- package/dist/commands/cloud-transcripts.d.ts +7 -0
- package/dist/commands/cloud-transcripts.js +100 -0
- package/dist/commands/cloud.js +5 -0
- package/dist/commands/computer.d.ts +0 -12
- package/dist/commands/computer.js +14 -124
- package/dist/commands/config.js +5 -4
- package/dist/commands/daemon-index.d.ts +2 -0
- package/dist/commands/daemon-index.js +44 -0
- package/dist/commands/daemon.js +6 -0
- package/dist/commands/doctor.js +3 -4
- package/dist/commands/exec.d.ts +5 -0
- package/dist/commands/exec.js +35 -7
- package/dist/commands/feed-watch.js +12 -0
- package/dist/commands/feed.d.ts +1 -1
- package/dist/commands/feed.js +7 -4
- package/dist/commands/insights.js +3 -1
- package/dist/commands/inspect.js +1 -1
- package/dist/commands/logs.js +2 -1
- package/dist/commands/models.js +1 -1
- package/dist/commands/prune.js +6 -28
- package/dist/commands/ps-roster.d.ts +0 -1
- package/dist/commands/ps-roster.js +2 -21
- package/dist/commands/ps.js +13 -1
- package/dist/commands/recordings.d.ts +2 -0
- package/dist/commands/recordings.js +117 -0
- package/dist/commands/routines.js +1 -1
- package/dist/commands/secrets-passthrough.js +3 -3
- package/dist/commands/send.js +33 -20
- package/dist/commands/sessions-backfill.d.ts +1 -0
- package/dist/commands/sessions-backfill.js +48 -13
- package/dist/commands/sessions-migrate.d.ts +1 -1
- package/dist/commands/sessions-migrate.js +11 -10
- package/dist/commands/sessions-optimize.d.ts +1 -0
- package/dist/commands/sessions-optimize.js +7 -4
- package/dist/commands/sessions-resume.js +8 -1
- package/dist/commands/sessions-stats.d.ts +2 -0
- package/dist/commands/sessions-stats.js +24 -7
- package/dist/commands/sessions.d.ts +5 -11
- package/dist/commands/sessions.js +8 -236
- package/dist/commands/setup-computer.js +1 -2
- package/dist/commands/setup.js +1 -1
- package/dist/commands/teams.js +2 -2
- package/dist/commands/testdata/feed-hub.d.ts +1 -0
- package/dist/commands/testdata/feed-hub.js +11 -0
- package/dist/commands/trash.d.ts +0 -1
- package/dist/commands/trash.js +74 -10
- package/dist/lib/accounting/usage-sync.js +7 -0
- package/dist/lib/agent-modes.d.ts +1 -1
- package/dist/lib/agent-modes.js +11 -5
- package/dist/lib/auth-mint.d.ts +4 -0
- package/dist/lib/auth-mint.js +6 -4
- package/dist/lib/browser/native-history.test-fixture.d.ts +12 -0
- package/dist/lib/browser/native-history.test-fixture.js +43 -0
- package/dist/lib/browser/paths.d.ts +5 -0
- package/dist/lib/browser/paths.js +7 -1
- package/dist/lib/browser/sessions-list.d.ts +28 -1
- package/dist/lib/browser/sessions-list.js +137 -25
- package/dist/lib/channels/providers/rush.d.ts +2 -1
- package/dist/lib/channels/providers/rush.js +2 -2
- package/dist/lib/channels/providers/session.d.ts +1 -0
- package/dist/lib/channels/providers/session.js +23 -12
- package/dist/lib/channels/registry.d.ts +9 -2
- package/dist/lib/channels/send.d.ts +5 -10
- package/dist/lib/channels/send.js +88 -50
- package/dist/lib/cloud/rush.d.ts +6 -0
- package/dist/lib/cloud/rush.js +18 -3
- package/dist/lib/computer-client.d.ts +19 -0
- package/dist/lib/computer-client.js +104 -0
- package/dist/lib/config-keys.d.ts +5 -1
- package/dist/lib/config-keys.js +14 -11
- package/dist/lib/daemon/auth-sync-service.js +13 -0
- package/dist/lib/daemon/daemon.js +20 -8
- package/dist/lib/daemon/owner-device-delivery-service.d.ts +10 -0
- package/dist/lib/daemon/owner-device-delivery-service.js +28 -0
- package/dist/lib/daemon-services.d.ts +2 -1
- package/dist/lib/daemon-services.js +17 -5
- package/dist/lib/device-config.d.ts +4 -1
- package/dist/lib/device-config.js +57 -7
- package/dist/lib/devices/doctor-findings.d.ts +2 -3
- package/dist/lib/devices/doctor-findings.js +10 -19
- package/dist/lib/event-provenance.d.ts +1 -0
- package/dist/lib/event-provenance.js +2 -0
- package/dist/lib/exec.d.ts +1 -0
- package/dist/lib/exec.js +20 -15
- package/dist/lib/feed/pr-status.d.ts +5 -1
- package/dist/lib/feed/pr-status.js +44 -3
- package/dist/lib/feed/tool-activity.js +9 -6
- package/dist/lib/feed/tools.d.ts +4 -1
- package/dist/lib/feed/tools.js +8 -11
- package/dist/lib/feed-broadcast.d.ts +5 -3
- package/dist/lib/feed-broadcast.js +47 -36
- package/dist/lib/fleet-shared-state.d.ts +5 -0
- package/dist/lib/fleet-shared-state.js +8 -0
- package/dist/lib/github/project-prs.d.ts +4 -1
- package/dist/lib/github/project-prs.js +18 -5
- package/dist/lib/help.d.ts +1 -0
- package/dist/lib/help.js +8 -0
- package/dist/lib/helper-versions.js +1 -1
- package/dist/lib/hosts/passthrough.js +5 -8
- package/dist/lib/hosts/remote-cmd.d.ts +2 -7
- package/dist/lib/hosts/remote-cmd.js +14 -22
- package/dist/lib/hosts/routing-flag.d.ts +22 -0
- package/dist/lib/hosts/routing-flag.js +127 -14
- package/dist/lib/identity/index.d.ts +22 -0
- package/dist/lib/identity/index.js +3 -0
- package/dist/lib/installations/migrate.d.ts +7 -0
- package/dist/lib/installations/migrate.js +99 -88
- package/dist/lib/installations/versions.js +2 -2
- package/dist/lib/launch-identity.d.ts +6 -1
- package/dist/lib/launch-identity.js +12 -2
- package/dist/lib/menubar/install-menubar.d.ts +1 -0
- package/dist/lib/menubar/install-menubar.js +8 -5
- package/dist/lib/menubar/snapshot.js +2 -3
- package/dist/lib/notify.d.ts +7 -14
- package/dist/lib/notify.js +29 -75
- package/dist/lib/owner-message.d.ts +4 -6
- package/dist/lib/owner-message.js +12 -11
- package/dist/lib/owner-notify-tokens.d.ts +49 -0
- package/dist/lib/owner-notify-tokens.js +214 -0
- package/dist/lib/owner-notify.d.ts +75 -0
- package/dist/lib/owner-notify.js +144 -0
- package/dist/lib/recordings/config.d.ts +11 -0
- package/dist/lib/recordings/config.js +54 -0
- package/dist/lib/recordings/identity.d.ts +12 -0
- package/dist/lib/recordings/identity.js +57 -0
- package/dist/lib/recordings/ledger.d.ts +16 -0
- package/dist/lib/recordings/ledger.js +141 -0
- package/dist/lib/recordings/model.d.ts +29 -0
- package/dist/lib/recordings/model.js +28 -0
- package/dist/lib/recordings/pipeline.d.ts +44 -0
- package/dist/lib/recordings/pipeline.js +272 -0
- package/dist/lib/recordings/process.d.ts +17 -0
- package/dist/lib/recordings/process.js +94 -0
- package/dist/lib/recordings/service.d.ts +15 -0
- package/dist/lib/recordings/service.js +45 -0
- package/dist/lib/recordings/settle.d.ts +21 -0
- package/dist/lib/recordings/settle.js +92 -0
- package/dist/lib/recordings/transcode.d.ts +13 -0
- package/dist/lib/recordings/transcode.js +44 -0
- package/dist/lib/reminders.d.ts +0 -1
- package/dist/lib/reminders.js +1 -1
- package/dist/lib/reserved-stores.d.ts +3 -0
- package/dist/lib/reserved-stores.js +13 -0
- package/dist/lib/routine-notify-owner.d.ts +3 -23
- package/dist/lib/routine-notify-owner.js +26 -107
- package/dist/lib/rush-api.d.ts +1 -0
- package/dist/lib/rush-api.js +1 -0
- package/dist/lib/session/active.d.ts +18 -2
- package/dist/lib/session/active.js +47 -37
- package/dist/lib/session/cloud.js +18 -45
- package/dist/lib/session/db.d.ts +2 -0
- package/dist/lib/session/db.js +13 -4
- package/dist/lib/session/glance-files.d.ts +4 -3
- package/dist/lib/session/glance-files.js +31 -0
- package/dist/lib/session/inject-target.js +12 -2
- package/dist/lib/session/pid-registry.d.ts +2 -0
- package/dist/lib/session/pid-registry.js +6 -2
- package/dist/lib/session/presentation.d.ts +21 -0
- package/dist/lib/session/presentation.js +198 -0
- package/dist/lib/session/projection.js +9 -2
- package/dist/lib/sqlite.d.ts +3 -1
- package/dist/lib/sqlite.js +7 -3
- package/dist/lib/standalone-tools.js +1 -1
- package/dist/lib/startup/command-registry.js +9 -4
- package/dist/lib/state.d.ts +2 -2
- package/dist/lib/state.js +3 -5
- package/dist/lib/terminal/inject.js +1 -1
- package/dist/lib/testdata/owner-notify-api.d.ts +36 -0
- package/dist/lib/testdata/owner-notify-api.js +102 -0
- package/dist/lib/trash.d.ts +14 -0
- package/dist/lib/trash.js +75 -0
- package/dist/lib/types.d.ts +0 -34
- package/package.json +1 -1
- package/dist/commands/feedback.d.ts +0 -2
- package/dist/commands/feedback.js +0 -68
- package/dist/commands/humans.d.ts +0 -2
- package/dist/commands/humans.js +0 -83
- package/dist/commands/modes.d.ts +0 -2
- package/dist/commands/modes.js +0 -134
- package/dist/commands/reminders.d.ts +0 -2
- package/dist/commands/reminders.js +0 -49
- package/dist/lib/channels/owner-forward.d.ts +0 -25
- package/dist/lib/channels/owner-forward.js +0 -78
- package/dist/lib/channels/owner-sink.d.ts +0 -10
- package/dist/lib/channels/owner-sink.js +0 -26
- package/dist/lib/humans.d.ts +0 -12
- package/dist/lib/humans.js +0 -64
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import { arch, platform, release } from 'node:os';
|
|
2
|
-
import { createRequire } from 'node:module';
|
|
3
|
-
import chalk from 'chalk';
|
|
4
|
-
import { showUrl } from '../lib/open-url.js';
|
|
5
|
-
const REPO = 'phnx-labs/agi-cli';
|
|
6
|
-
const DISCUSSION_BASE = `https://github.com/${REPO}/discussions/new`;
|
|
7
|
-
const ISSUE_BASE = `https://github.com/${REPO}/issues/new`;
|
|
8
|
-
function readCliVersion() {
|
|
9
|
-
try {
|
|
10
|
-
const require = createRequire(import.meta.url);
|
|
11
|
-
const pkg = require('../../package.json');
|
|
12
|
-
return pkg.version ?? 'unknown';
|
|
13
|
-
}
|
|
14
|
-
catch {
|
|
15
|
-
return 'unknown';
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
function buildPrefill(kind, summary) {
|
|
19
|
-
const version = readCliVersion();
|
|
20
|
-
const os = `${platform()} ${release()} (${arch()})`;
|
|
21
|
-
const node = process.version;
|
|
22
|
-
const body = [
|
|
23
|
-
summary.trim() ? `${summary.trim()}\n` : '<!-- describe what you ran into / what you want -->\n',
|
|
24
|
-
'---',
|
|
25
|
-
'',
|
|
26
|
-
'**Environment**',
|
|
27
|
-
'',
|
|
28
|
-
`- agents-cli: \`${version}\``,
|
|
29
|
-
`- OS: \`${os}\``,
|
|
30
|
-
`- Node: \`${node}\``,
|
|
31
|
-
'',
|
|
32
|
-
'<!-- For bugs: include the exact command you ran and the full output. -->',
|
|
33
|
-
'<!-- For ideas: include a concrete use case. -->'
|
|
34
|
-
].join('\n');
|
|
35
|
-
if (kind === 'bug') {
|
|
36
|
-
const url = `${ISSUE_BASE}?template=bug_report.yml&title=${encodeURIComponent(summary || 'Bug: ')}`;
|
|
37
|
-
return { url, body };
|
|
38
|
-
}
|
|
39
|
-
const category = kind === 'idea' ? 'ideas' : 'q-a';
|
|
40
|
-
const url = `${DISCUSSION_BASE}?category=${category}&title=${encodeURIComponent(summary || '')}&body=${encodeURIComponent(body)}`;
|
|
41
|
-
return { url, body };
|
|
42
|
-
}
|
|
43
|
-
export function registerFeedbackCommand(program) {
|
|
44
|
-
program
|
|
45
|
-
.command('feedback [summary...]')
|
|
46
|
-
.description('Open a pre-filled feedback Discussion or bug report')
|
|
47
|
-
.option('-b, --bug', 'File as a bug report (opens issue tracker)')
|
|
48
|
-
.option('-i, --idea', 'File as a feature idea (Discussions → Ideas)')
|
|
49
|
-
.option('-q, --question', 'Ask a question (Discussions → Q&A)')
|
|
50
|
-
.option('--print', 'Print the URL instead of opening it')
|
|
51
|
-
.action(async (summary, opts) => {
|
|
52
|
-
const kind = opts.bug ? 'bug' : opts.idea ? 'idea' : 'question';
|
|
53
|
-
const summaryText = (summary ?? []).join(' ').trim();
|
|
54
|
-
const { url } = buildPrefill(kind, summaryText);
|
|
55
|
-
if (opts.print) {
|
|
56
|
-
console.log(url);
|
|
57
|
-
return;
|
|
58
|
-
}
|
|
59
|
-
const opened = (await showUrl(url)).via !== 'none';
|
|
60
|
-
if (opened) {
|
|
61
|
-
console.log(chalk.dim(`Opened ${kind} form in your browser:\n ${url}`));
|
|
62
|
-
}
|
|
63
|
-
else {
|
|
64
|
-
console.log(chalk.yellow('Could not auto-open a browser. Paste this URL:'));
|
|
65
|
-
console.log(` ${url}`);
|
|
66
|
-
}
|
|
67
|
-
});
|
|
68
|
-
}
|
package/dist/commands/humans.js
DELETED
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
import { setHelpSections } from '../lib/help.js';
|
|
2
|
-
import { readHumans, getOwnerFromHumans } from '../lib/humans.js';
|
|
3
|
-
export function registerHumansCommands(program) {
|
|
4
|
-
const humansCmd = program
|
|
5
|
-
.command('humans')
|
|
6
|
-
.description('Inspect owner identity and notification channel config (humans.yaml)');
|
|
7
|
-
setHelpSections(humansCmd, {
|
|
8
|
-
examples: `
|
|
9
|
-
# Show owner identity and channel config as JSON
|
|
10
|
-
agents humans show owner --json
|
|
11
|
-
|
|
12
|
-
# Show owner identity in human-readable form
|
|
13
|
-
agents humans show owner
|
|
14
|
-
`,
|
|
15
|
-
notes: `
|
|
16
|
-
humans.yaml is the canonical owner identity file at ~/.agents/humans.yaml.
|
|
17
|
-
It is populated by migrating notify.owner from agents.yaml and frontmatter
|
|
18
|
-
from owner.md. Use \`agents humans show owner\` to inspect the current config.
|
|
19
|
-
`,
|
|
20
|
-
});
|
|
21
|
-
const showCmd = humansCmd
|
|
22
|
-
.command('show')
|
|
23
|
-
.description('Show config from humans.yaml');
|
|
24
|
-
setHelpSections(showCmd, {
|
|
25
|
-
examples: `
|
|
26
|
-
agents humans show owner
|
|
27
|
-
agents humans show owner --json
|
|
28
|
-
`,
|
|
29
|
-
});
|
|
30
|
-
showCmd
|
|
31
|
-
.command('owner')
|
|
32
|
-
.description('Show the configured owner identity and notification channels')
|
|
33
|
-
.option('--json', 'Output as JSON')
|
|
34
|
-
.action((opts) => {
|
|
35
|
-
const humans = readHumans();
|
|
36
|
-
if (!humans) {
|
|
37
|
-
if (opts.json) {
|
|
38
|
-
process.stdout.write(JSON.stringify(null) + '\n');
|
|
39
|
-
}
|
|
40
|
-
else {
|
|
41
|
-
process.stderr.write('humans.yaml not found — run `agents` once to trigger migration\n');
|
|
42
|
-
process.exitCode = 1;
|
|
43
|
-
}
|
|
44
|
-
return;
|
|
45
|
-
}
|
|
46
|
-
const owner = getOwnerFromHumans();
|
|
47
|
-
if (opts.json) {
|
|
48
|
-
process.stdout.write(JSON.stringify(owner ?? null, null, 2) + '\n');
|
|
49
|
-
}
|
|
50
|
-
else {
|
|
51
|
-
if (!owner) {
|
|
52
|
-
process.stdout.write('No owner configured in humans.yaml\n');
|
|
53
|
-
return;
|
|
54
|
-
}
|
|
55
|
-
if (owner.name)
|
|
56
|
-
process.stdout.write(`Name: ${owner.name}\n`);
|
|
57
|
-
if (owner.timezone)
|
|
58
|
-
process.stdout.write(`Timezone: ${owner.timezone}\n`);
|
|
59
|
-
if (owner.quiet_hours)
|
|
60
|
-
process.stdout.write(`Quiet: ${owner.quiet_hours}\n`);
|
|
61
|
-
if (owner.default_severity)
|
|
62
|
-
process.stdout.write(`Severity: ${owner.default_severity}\n`);
|
|
63
|
-
if (owner.notify) {
|
|
64
|
-
process.stdout.write(`Notify: channel=${owner.notify.channel} to=${owner.notify.to}\n`);
|
|
65
|
-
}
|
|
66
|
-
if (owner.channels?.length) {
|
|
67
|
-
process.stdout.write(`Channels:\n`);
|
|
68
|
-
for (const ch of owner.channels) {
|
|
69
|
-
const extra = [ch.transport, ch.intrusive ? 'intrusive' : null].filter(Boolean).join(', ');
|
|
70
|
-
process.stdout.write(` - ${ch.id}${extra ? ` (${extra})` : ''}\n`);
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
if (owner.policy) {
|
|
74
|
-
process.stdout.write(`Policy:\n`);
|
|
75
|
-
for (const [sev, channels] of Object.entries(owner.policy)) {
|
|
76
|
-
if (Array.isArray(channels) && channels.length) {
|
|
77
|
-
process.stdout.write(` ${sev}: ${channels.join(', ')}\n`);
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
});
|
|
83
|
-
}
|
package/dist/commands/modes.d.ts
DELETED
package/dist/commands/modes.js
DELETED
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
import chalk from 'chalk';
|
|
2
|
-
import { AGENTS, ALL_AGENT_IDS, agentLabel, formatAgentError, resolveAgentName, } from '../lib/agents.js';
|
|
3
|
-
import { formatModeFlags, getAgentModesCatalog, } from '../lib/agent-modes.js';
|
|
4
|
-
import { setHelpSections } from '../lib/help.js';
|
|
5
|
-
import { getGlobalDefault, listInstalledVersions, resolveVersion, resolveVersionAlias } from '../lib/installations/versions.js';
|
|
6
|
-
const MODE_AGENTS = ALL_AGENT_IDS.filter((id) => !AGENTS[id].deprecated?.hard);
|
|
7
|
-
export function registerModesCommand(program) {
|
|
8
|
-
const modes = program
|
|
9
|
-
.command('modes [agentSpec]')
|
|
10
|
-
.description('Show which permission modes (--mode plan|edit|auto|skip) a harness supports for agents run / teams add')
|
|
11
|
-
.option('--json', 'Output machine-readable JSON')
|
|
12
|
-
.action((agentSpec, options) => {
|
|
13
|
-
const targets = resolveTargets(agentSpec);
|
|
14
|
-
if (targets.length === 0)
|
|
15
|
-
process.exit(1);
|
|
16
|
-
if (options.json) {
|
|
17
|
-
const out = targets.map(({ agent, version }) => {
|
|
18
|
-
const catalog = getAgentModesCatalog(agent, version);
|
|
19
|
-
return {
|
|
20
|
-
agent,
|
|
21
|
-
version,
|
|
22
|
-
defaultMode: catalog.defaultMode,
|
|
23
|
-
configuredMode: catalog.configuredMode,
|
|
24
|
-
configuredModeSource: catalog.configuredModeSource,
|
|
25
|
-
headlessPlan: catalog.headlessPlan,
|
|
26
|
-
modes: catalog.modes.map((m) => ({
|
|
27
|
-
mode: m.mode,
|
|
28
|
-
flags: m.flags,
|
|
29
|
-
description: m.description,
|
|
30
|
-
isDefault: m.isDefault,
|
|
31
|
-
})),
|
|
32
|
-
unsupported: catalog.unsupported,
|
|
33
|
-
notes: catalog.notes,
|
|
34
|
-
};
|
|
35
|
-
});
|
|
36
|
-
console.log(JSON.stringify(out, null, 2));
|
|
37
|
-
return;
|
|
38
|
-
}
|
|
39
|
-
let printed = 0;
|
|
40
|
-
for (const { agent, version, isDefault } of targets) {
|
|
41
|
-
if (printed > 0)
|
|
42
|
-
console.log();
|
|
43
|
-
printCatalog(getAgentModesCatalog(agent, version), version, isDefault);
|
|
44
|
-
printed++;
|
|
45
|
-
}
|
|
46
|
-
if (!agentSpec) {
|
|
47
|
-
console.log(chalk.gray('\n `agents modes <agent>` for one harness · `agents modes claude@2.1.219` for a version\'s run default'));
|
|
48
|
-
console.log(chalk.gray(' Pass --mode on `agents run` / `agents teams add`. Models: `agents models <agent>`.'));
|
|
49
|
-
}
|
|
50
|
-
});
|
|
51
|
-
setHelpSections(modes, {
|
|
52
|
-
examples: `
|
|
53
|
-
agents modes
|
|
54
|
-
agents modes claude
|
|
55
|
-
agents modes claude@2.1.219
|
|
56
|
-
agents modes cursor --json
|
|
57
|
-
`,
|
|
58
|
-
notes: `
|
|
59
|
-
Permission modes control how much the agent can do (not which LLM model
|
|
60
|
-
runs — that is --model / agents models). Supported modes come from each
|
|
61
|
-
harness's capabilities table; unsupported requests degrade (auto→edit,
|
|
62
|
-
plan→safest native) or error (skip when missing).
|
|
63
|
-
'full' is a silent alias for skip.
|
|
64
|
-
agent@version is accepted so any configured run.defaults mode for that
|
|
65
|
-
version is shown; the mode list itself is per-agent today.
|
|
66
|
-
`,
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
function resolveTargets(agentSpec) {
|
|
70
|
-
if (!agentSpec) {
|
|
71
|
-
const targets = [];
|
|
72
|
-
for (const agent of MODE_AGENTS) {
|
|
73
|
-
const version = getGlobalDefault(agent) || listInstalledVersions(agent)[0] || null;
|
|
74
|
-
targets.push({ agent, version, isDefault: true });
|
|
75
|
-
}
|
|
76
|
-
return targets;
|
|
77
|
-
}
|
|
78
|
-
const [agentName, versionSpec] = agentSpec.split('@');
|
|
79
|
-
const agent = resolveAgentName(agentName);
|
|
80
|
-
if (!agent) {
|
|
81
|
-
console.error(chalk.red(formatAgentError(agentName, MODE_AGENTS)));
|
|
82
|
-
return [];
|
|
83
|
-
}
|
|
84
|
-
if (AGENTS[agent].deprecated?.hard) {
|
|
85
|
-
console.error(chalk.yellow(`${agent} is deprecated and no longer supports run modes.`));
|
|
86
|
-
return [];
|
|
87
|
-
}
|
|
88
|
-
if (versionSpec === 'all') {
|
|
89
|
-
const installed = listInstalledVersions(agent);
|
|
90
|
-
if (installed.length === 0) {
|
|
91
|
-
return [{ agent, version: null, isDefault: true }];
|
|
92
|
-
}
|
|
93
|
-
return installed.map((v) => ({
|
|
94
|
-
agent,
|
|
95
|
-
version: v,
|
|
96
|
-
isDefault: v === getGlobalDefault(agent),
|
|
97
|
-
}));
|
|
98
|
-
}
|
|
99
|
-
if (versionSpec) {
|
|
100
|
-
const version = resolveVersionAlias(agent, versionSpec) ?? null;
|
|
101
|
-
return [{ agent, version, isDefault: version === getGlobalDefault(agent) }];
|
|
102
|
-
}
|
|
103
|
-
const version = resolveVersion(agent, process.cwd()) || getGlobalDefault(agent) || null;
|
|
104
|
-
return [{ agent, version, isDefault: true }];
|
|
105
|
-
}
|
|
106
|
-
function printCatalog(catalog, version, isDefault) {
|
|
107
|
-
const tag = version
|
|
108
|
-
? ` ${chalk.bold(version)}${isDefault ? chalk.gray(' (default)') : ''}`
|
|
109
|
-
: chalk.gray(' (not installed)');
|
|
110
|
-
console.log(`${agentLabel(catalog.agent)}${tag}`);
|
|
111
|
-
console.log(chalk.gray(' modes:'));
|
|
112
|
-
for (const entry of catalog.modes) {
|
|
113
|
-
const star = entry.isDefault ? chalk.cyan('*') : ' ';
|
|
114
|
-
const flags = chalk.gray(formatModeFlags(entry.flags));
|
|
115
|
-
console.log(` ${star} ${chalk.cyan(entry.mode.padEnd(6))} ${chalk.bold(entry.description)} ${flags}`);
|
|
116
|
-
}
|
|
117
|
-
if (catalog.unsupported.length > 0) {
|
|
118
|
-
console.log(chalk.gray(` unsupported: ${catalog.unsupported.join(', ')}`));
|
|
119
|
-
}
|
|
120
|
-
const defaultBits = [`native default ${chalk.white(catalog.defaultMode)}`];
|
|
121
|
-
if (catalog.configuredMode) {
|
|
122
|
-
const src = catalog.configuredModeSource ? chalk.gray(` (${catalog.configuredModeSource})`) : '';
|
|
123
|
-
defaultBits.push(`run default ${chalk.white(catalog.configuredMode)}${src}`);
|
|
124
|
-
}
|
|
125
|
-
console.log(chalk.gray(` ${defaultBits.join(' · ')}`));
|
|
126
|
-
if (!catalog.headlessPlan && catalog.modes.some((m) => m.mode === 'plan')) {
|
|
127
|
-
console.log(chalk.yellow(' headless plan: not supported (interactive plan still works)'));
|
|
128
|
-
}
|
|
129
|
-
for (const note of catalog.notes) {
|
|
130
|
-
if (note.startsWith("'full'"))
|
|
131
|
-
continue;
|
|
132
|
-
console.log(chalk.gray(` note: ${note}`));
|
|
133
|
-
}
|
|
134
|
-
}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import chalk from 'chalk';
|
|
2
|
-
import { loadReminders, remindersFilePath } from '../lib/reminders.js';
|
|
3
|
-
import { setHelpSections } from '../lib/help.js';
|
|
4
|
-
const EXAMPLES = [
|
|
5
|
-
'agents reminders # list your operating reminders',
|
|
6
|
-
'agents reminders --json # machine-readable output',
|
|
7
|
-
].join('\n');
|
|
8
|
-
const NOTES = [
|
|
9
|
-
"Reminders live in ~/.agents/reminders/reminders.yaml and sync across the fleet via 'agents repo push'.",
|
|
10
|
-
'One shows succinctly in the Claude statusline per session, chosen deterministically from the session id,',
|
|
11
|
-
'so concurrent agents each show a different one and it stays stable within a session.',
|
|
12
|
-
].join('\n');
|
|
13
|
-
export function registerRemindersCommand(program) {
|
|
14
|
-
const cmd = program
|
|
15
|
-
.command('reminders')
|
|
16
|
-
.description('Personal operating reminders shown in the Claude statusline')
|
|
17
|
-
.option('--json', 'output as JSON')
|
|
18
|
-
.action((opts) => {
|
|
19
|
-
const file = remindersFilePath();
|
|
20
|
-
let reminders;
|
|
21
|
-
try {
|
|
22
|
-
reminders = loadReminders();
|
|
23
|
-
}
|
|
24
|
-
catch (err) {
|
|
25
|
-
console.error(chalk.red(`Could not read reminders: ${err instanceof Error ? err.message : String(err)}`));
|
|
26
|
-
process.exitCode = 1;
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
29
|
-
if (opts.json) {
|
|
30
|
-
process.stdout.write(`${JSON.stringify({ file, reminders }, null, 2)}\n`);
|
|
31
|
-
return;
|
|
32
|
-
}
|
|
33
|
-
if (reminders.length === 0) {
|
|
34
|
-
console.log(`No reminders yet. Add them to ${chalk.cyan(file)}`);
|
|
35
|
-
console.log(chalk.dim('Each shows succinctly in the Claude statusline — one per session.'));
|
|
36
|
-
return;
|
|
37
|
-
}
|
|
38
|
-
const count = `${reminders.length} reminder${reminders.length === 1 ? '' : 's'}`;
|
|
39
|
-
console.log(chalk.dim(`${count} · ${file}`));
|
|
40
|
-
console.log(chalk.dim('One shows in the Claude statusline per session, chosen from the session id.\n'));
|
|
41
|
-
for (const reminder of reminders) {
|
|
42
|
-
console.log(` ${chalk.cyan('◆')} ${chalk.bold(reminder.short)}`);
|
|
43
|
-
if (reminder.full && reminder.full !== reminder.short) {
|
|
44
|
-
console.log(` ${chalk.dim(reminder.full)}`);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
setHelpSections(cmd, { examples: EXAMPLES, notes: NOTES });
|
|
49
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import type { Meta } from '../types.js';
|
|
2
|
-
import type { SendResult } from './registry.js';
|
|
3
|
-
import type { DeviceProfile } from '../devices/registry.js';
|
|
4
|
-
export declare const OWNER_FORWARD_GUARD_ENV = "AGENTS_OWNER_NO_FORWARD";
|
|
5
|
-
type OwnerForwardSkip = 'guarded' | 'not-rush-backed' | 'no-capable-peer';
|
|
6
|
-
interface OwnerForwardPlan {
|
|
7
|
-
candidates: string[];
|
|
8
|
-
skip?: OwnerForwardSkip;
|
|
9
|
-
}
|
|
10
|
-
export declare function isRushBackedTransport(channel: string, meta: Meta): boolean;
|
|
11
|
-
export declare function planOwnerForward(channel: string, meta: Meta, devices: DeviceProfile[], self: string, opts?: {
|
|
12
|
-
guarded?: boolean;
|
|
13
|
-
}): OwnerForwardPlan;
|
|
14
|
-
interface PeerOwnerEnvelope {
|
|
15
|
-
thread?: string;
|
|
16
|
-
from?: string;
|
|
17
|
-
}
|
|
18
|
-
type PeerOwnerSender = (machine: string, text: string, channel: string, target: string, envelope?: PeerOwnerEnvelope) => Promise<SendResult | undefined>;
|
|
19
|
-
export declare function forwardOwnerNotifyToPeer(text: string, channel: string, target: string, meta: Meta, opts?: {
|
|
20
|
-
self?: string;
|
|
21
|
-
devices?: DeviceProfile[];
|
|
22
|
-
send?: PeerOwnerSender;
|
|
23
|
-
envelope?: PeerOwnerEnvelope;
|
|
24
|
-
}): Promise<SendResult | undefined>;
|
|
25
|
-
export {};
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import { loadDevices, isDialableDevice } from '../devices/registry.js';
|
|
2
|
-
import { machineId, normalizeHost } from '../machine-id.js';
|
|
3
|
-
import { RUSH_CHANNELS } from './providers/rush.js';
|
|
4
|
-
import { resolvePeerTarget, sshCapture } from '../session/remote/remote-list.js';
|
|
5
|
-
import { buildRemoteAgentsInvocation, stripClixml } from '../hosts/remote-cmd.js';
|
|
6
|
-
export const OWNER_FORWARD_GUARD_ENV = 'AGENTS_OWNER_NO_FORWARD';
|
|
7
|
-
const PEER_SEND_TIMEOUT_MS = 15_000;
|
|
8
|
-
export function isRushBackedTransport(channel, meta) {
|
|
9
|
-
const transport = meta.notify?.transports?.[channel] ?? channel;
|
|
10
|
-
return RUSH_CHANNELS.includes(transport);
|
|
11
|
-
}
|
|
12
|
-
export function planOwnerForward(channel, meta, devices, self, opts = {}) {
|
|
13
|
-
if (opts.guarded)
|
|
14
|
-
return { candidates: [], skip: 'guarded' };
|
|
15
|
-
if (!isRushBackedTransport(channel, meta))
|
|
16
|
-
return { candidates: [], skip: 'not-rush-backed' };
|
|
17
|
-
const selfId = normalizeHost(self);
|
|
18
|
-
const capable = devices.filter((d) => d.platform === 'macos' && isDialableDevice(d) && normalizeHost(d.name) !== selfId);
|
|
19
|
-
const interactiveHost = typeof meta.config?.interactiveHost === 'string'
|
|
20
|
-
? normalizeHost(meta.config.interactiveHost)
|
|
21
|
-
: undefined;
|
|
22
|
-
const rank = (name) => (interactiveHost && normalizeHost(name) === interactiveHost ? 0 : 1);
|
|
23
|
-
const candidates = capable
|
|
24
|
-
.map((d) => normalizeHost(d.name))
|
|
25
|
-
.sort((a, b) => rank(a) - rank(b));
|
|
26
|
-
if (candidates.length === 0)
|
|
27
|
-
return { candidates: [], skip: 'no-capable-peer' };
|
|
28
|
-
return { candidates };
|
|
29
|
-
}
|
|
30
|
-
async function sendOnPeer(machine, text, channel, target, envelope = {}) {
|
|
31
|
-
const peer = await resolvePeerTarget(machine);
|
|
32
|
-
if (!peer)
|
|
33
|
-
return undefined;
|
|
34
|
-
const args = ['send', '--channel', channel, '--to', target, '--text', text, '--json'];
|
|
35
|
-
if (envelope.thread)
|
|
36
|
-
args.push('--thread', envelope.thread);
|
|
37
|
-
if (envelope.from)
|
|
38
|
-
args.push('--from', envelope.from);
|
|
39
|
-
const remoteCmd = buildRemoteAgentsInvocation(args, undefined, peer.os, { [OWNER_FORWARD_GUARD_ENV]: '1' });
|
|
40
|
-
const capture = await sshCapture(peer.target, remoteCmd, PEER_SEND_TIMEOUT_MS);
|
|
41
|
-
if (capture.code !== 0)
|
|
42
|
-
return undefined;
|
|
43
|
-
try {
|
|
44
|
-
const parsed = JSON.parse(stripClixml(capture.stdout));
|
|
45
|
-
if (parsed && typeof parsed === 'object' && typeof parsed.ok === 'boolean')
|
|
46
|
-
return parsed;
|
|
47
|
-
}
|
|
48
|
-
catch {
|
|
49
|
-
return undefined;
|
|
50
|
-
}
|
|
51
|
-
return undefined;
|
|
52
|
-
}
|
|
53
|
-
export async function forwardOwnerNotifyToPeer(text, channel, target, meta, opts = {}) {
|
|
54
|
-
if (process.env[OWNER_FORWARD_GUARD_ENV] === '1')
|
|
55
|
-
return undefined;
|
|
56
|
-
if (!isRushBackedTransport(channel, meta))
|
|
57
|
-
return undefined;
|
|
58
|
-
const self = opts.self ?? machineId();
|
|
59
|
-
let devices = opts.devices;
|
|
60
|
-
if (!devices) {
|
|
61
|
-
try {
|
|
62
|
-
devices = Object.values(await loadDevices());
|
|
63
|
-
}
|
|
64
|
-
catch {
|
|
65
|
-
return undefined;
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
const plan = planOwnerForward(channel, meta, devices, self);
|
|
69
|
-
if (plan.candidates.length === 0)
|
|
70
|
-
return undefined;
|
|
71
|
-
const send = opts.send ?? sendOnPeer;
|
|
72
|
-
for (const machine of plan.candidates) {
|
|
73
|
-
const result = await send(machine, text, channel, target, opts.envelope);
|
|
74
|
-
if (result?.ok)
|
|
75
|
-
return result;
|
|
76
|
-
}
|
|
77
|
-
return undefined;
|
|
78
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { Meta } from '../types.js';
|
|
2
|
-
export type OwnerSinkReason = 'imessage-not-macos' | 'slack-no-token' | 'channel-unsupported';
|
|
3
|
-
export interface OwnerSinkStatus {
|
|
4
|
-
configured: boolean;
|
|
5
|
-
reachable: boolean;
|
|
6
|
-
channel?: string;
|
|
7
|
-
transport?: string;
|
|
8
|
-
reason?: OwnerSinkReason;
|
|
9
|
-
}
|
|
10
|
-
export declare function probeOwnerSink(meta: Meta): Promise<OwnerSinkStatus>;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { platform } from 'os';
|
|
2
|
-
import { readOwnerDest } from './send.js';
|
|
3
|
-
import { RUSH_CHANNELS, resolveSlackToken } from './providers/rush.js';
|
|
4
|
-
export async function probeOwnerSink(meta) {
|
|
5
|
-
const dest = readOwnerDest(meta);
|
|
6
|
-
if (!dest)
|
|
7
|
-
return { configured: false, reachable: false };
|
|
8
|
-
const channel = dest.channel;
|
|
9
|
-
const transport = meta.notify?.transports?.[channel] ?? channel;
|
|
10
|
-
if (!RUSH_CHANNELS.includes(transport)) {
|
|
11
|
-
return { configured: true, reachable: true, channel, transport };
|
|
12
|
-
}
|
|
13
|
-
if (transport === 'imessage') {
|
|
14
|
-
if (platform() !== 'darwin') {
|
|
15
|
-
return { configured: true, reachable: false, channel, transport, reason: 'imessage-not-macos' };
|
|
16
|
-
}
|
|
17
|
-
return { configured: true, reachable: true, channel, transport };
|
|
18
|
-
}
|
|
19
|
-
if (transport === 'slack') {
|
|
20
|
-
if (resolveSlackToken()) {
|
|
21
|
-
return { configured: true, reachable: true, channel, transport };
|
|
22
|
-
}
|
|
23
|
-
return { configured: true, reachable: false, channel, transport, reason: 'slack-no-token' };
|
|
24
|
-
}
|
|
25
|
-
return { configured: true, reachable: false, channel, transport, reason: 'channel-unsupported' };
|
|
26
|
-
}
|
package/dist/lib/humans.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { HumansConfig, HumanOwner } from './types.js';
|
|
2
|
-
export declare function readHumans(): HumansConfig | null;
|
|
3
|
-
export declare function writeHumans(config: HumansConfig): void;
|
|
4
|
-
export declare function getOwnerNotifyFromHumans(): {
|
|
5
|
-
channel: string;
|
|
6
|
-
to: string;
|
|
7
|
-
} | null;
|
|
8
|
-
export declare function getOwnerNotifyDestinationsFromHumans(): Array<{
|
|
9
|
-
channel: string;
|
|
10
|
-
to: string;
|
|
11
|
-
}>;
|
|
12
|
-
export declare function getOwnerFromHumans(): HumanOwner | null;
|
package/dist/lib/humans.js
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import * as fs from 'fs';
|
|
2
|
-
import * as yaml from 'yaml';
|
|
3
|
-
import { getHumansFilePath } from './state.js';
|
|
4
|
-
const HUMANS_VERSION = 1;
|
|
5
|
-
const HUMANS_HEADER = `# humans.yaml — owner identity and notification channels
|
|
6
|
-
# Managed by agents-cli. See: agents humans --help
|
|
7
|
-
`;
|
|
8
|
-
export function readHumans() {
|
|
9
|
-
const filePath = getHumansFilePath();
|
|
10
|
-
if (!fs.existsSync(filePath))
|
|
11
|
-
return null;
|
|
12
|
-
try {
|
|
13
|
-
const raw = fs.readFileSync(filePath, 'utf-8');
|
|
14
|
-
const parsed = yaml.parse(raw);
|
|
15
|
-
if (!parsed || typeof parsed !== 'object')
|
|
16
|
-
return null;
|
|
17
|
-
const doc = parsed;
|
|
18
|
-
if (doc['version'] !== HUMANS_VERSION)
|
|
19
|
-
return null;
|
|
20
|
-
return doc;
|
|
21
|
-
}
|
|
22
|
-
catch {
|
|
23
|
-
return null;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
export function writeHumans(config) {
|
|
27
|
-
const filePath = getHumansFilePath();
|
|
28
|
-
const body = yaml.stringify(config, { lineWidth: 120 });
|
|
29
|
-
fs.writeFileSync(filePath, HUMANS_HEADER + body, { encoding: 'utf-8', mode: 0o600 });
|
|
30
|
-
}
|
|
31
|
-
export function getOwnerNotifyFromHumans() {
|
|
32
|
-
return getOwnerNotifyDestinationsFromHumans()[0] ?? null;
|
|
33
|
-
}
|
|
34
|
-
export function getOwnerNotifyDestinationsFromHumans() {
|
|
35
|
-
const owner = readHumans()?.owner;
|
|
36
|
-
const channels = owner?.channels ?? [];
|
|
37
|
-
const preferredIds = owner?.policy?.normal ?? [];
|
|
38
|
-
const selected = preferredIds.length > 0
|
|
39
|
-
? preferredIds.map((id) => channels.find((entry) => entry.id === id))
|
|
40
|
-
: [channels.find((entry) => entry.to)];
|
|
41
|
-
const seen = new Set();
|
|
42
|
-
const destinations = selected
|
|
43
|
-
.filter((entry) => Boolean(entry?.id && entry.to))
|
|
44
|
-
.map((entry) => ({ channel: entry.id, to: entry.to }))
|
|
45
|
-
.filter((entry) => {
|
|
46
|
-
const key = `${entry.channel}\0${entry.to}`;
|
|
47
|
-
if (seen.has(key))
|
|
48
|
-
return false;
|
|
49
|
-
seen.add(key);
|
|
50
|
-
return true;
|
|
51
|
-
});
|
|
52
|
-
if (destinations.length > 0)
|
|
53
|
-
return destinations;
|
|
54
|
-
const firstAddressable = channels.find((entry) => entry.id && entry.to);
|
|
55
|
-
if (firstAddressable?.to)
|
|
56
|
-
return [{ channel: firstAddressable.id, to: firstAddressable.to }];
|
|
57
|
-
const migrated = owner?.notify;
|
|
58
|
-
if (migrated?.channel && migrated.to)
|
|
59
|
-
return [migrated];
|
|
60
|
-
return [];
|
|
61
|
-
}
|
|
62
|
-
export function getOwnerFromHumans() {
|
|
63
|
-
return readHumans()?.owner ?? null;
|
|
64
|
-
}
|