@phnx-labs/agents-cli 1.23.51 → 1.23.52
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
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.23.52
|
|
4
|
+
|
|
5
|
+
- **`agents browser` (and `computer`, `secrets`, `sessions`) now explain the alias that sent you there (PHNX-4641).** With `alias browser="agents browser"` in `~/.zshrc`, every `browser` call hit the removed-group error, and its advice, `browser --help`, looped straight back into it. The error now names the standalone binary by absolute path (`/opt/homebrew/bin/browser doctor`), says a shell alias or function is the likely cause (`type browser` shows it), and, when it finds one in `~/.zshrc`, `~/.zshenv`, `~/.zprofile`, `~/.bashrc`, `~/.bash_aliases`, `~/.bash_profile`, `~/.profile` or `~/.config/fish/config.fish`, names the file and line with the fix: delete it, then `unalias browser`. The scan is read-only and never edits an rc file. Source: `cli/src/lib/startup/command-registry.ts`, `cli/src/lib/startup/shadowing-alias.ts`.
|
|
6
|
+
|
|
3
7
|
## 1.23.51
|
|
4
8
|
|
|
5
9
|
- **Every session gets a workstream, and titles come in one batched call.** The `session-title` daemon service now names up to 12 sessions per tick in ONE cheap-model call instead of one call per session, and each reply carries a `workstream` beside the title: 1 to 3 words naming the larger effort ("Rush Mac", "Ahrefs SEO"). The call is shown the workstreams this box already uses, so related sessions share one name. A session keeps its workstream until its first message changes, and a `/rename`d session keeps its name and only gets a workstream. The field rides `agents ps --json`, `ps watch --json`, `feed watch --json`, history rows and the fleet session mirror, so AGI EXT can group sessions by what they are about. Schema v55 adds `sessions.workstream`. Source: `cli/src/lib/session/title.ts`, `cli/src/lib/session/db.ts`, `cli/src/lib/session/active.ts`, `cli/src/lib/session/remote/watch.ts`, `cli/src/lib/session/mirror.ts`.
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import * as os from 'os';
|
|
2
|
+
import { findExecutable } from '../platform/exec.js';
|
|
3
|
+
import { findShadowingDefinition, shadowFixCommand } from './shadowing-alias.js';
|
|
1
4
|
const LOADED_COMMAND_NAMES = [
|
|
2
5
|
'accounts', 'auth', 'view', 'inspect', 'commands', 'hooks', 'skills', 'rules', 'memory',
|
|
3
6
|
'permissions', 'mcp', 'clis', 'subagents', 'plugins', 'workflows', 'add', 'use',
|
|
@@ -105,7 +108,21 @@ export function removedToolGroupMessage(group, rest) {
|
|
|
105
108
|
? `error: 'agents sessions --roots' was removed; use 'agents daemon index roots'.`
|
|
106
109
|
: `error: 'agents sessions --active' was removed; use 'agents ps'.`;
|
|
107
110
|
}
|
|
108
|
-
return
|
|
111
|
+
return standaloneGroupMessage(group);
|
|
112
|
+
}
|
|
113
|
+
const STANDALONE_CHECK_VERB = { browser: 'doctor' };
|
|
114
|
+
function standaloneGroupMessage(group) {
|
|
115
|
+
const binary = findExecutable(group);
|
|
116
|
+
const next = binary ? `(${binary} ${STANDALONE_CHECK_VERB[group] ?? '--help'})` : `(none is on PATH)`;
|
|
117
|
+
const shadow = findShadowingDefinition(group, os.homedir());
|
|
118
|
+
const fix = shadow
|
|
119
|
+
? `~/${shadow.file}:${shadow.line} defines it: delete that ${shadow.kind === 'alias' ? 'line' : 'function'}, then run '${shadowFixCommand(group, shadow)}'.`
|
|
120
|
+
: `If so, remove it from your shell rc file, then run 'unalias ${group}' (or 'unset -f ${group}' for a function).`;
|
|
121
|
+
return [
|
|
122
|
+
`error: 'agents ${group}' was removed; use the standalone '${group}' CLI ${next}.`,
|
|
123
|
+
`If you typed '${group}', a shell alias or function sends it here; 'type ${group}' shows it.`,
|
|
124
|
+
fix,
|
|
125
|
+
].join('\n');
|
|
109
126
|
}
|
|
110
127
|
export function isKnownTopLevelCommand(name) {
|
|
111
128
|
return KNOWN_TOP_LEVEL_COMMANDS.has(name);
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export interface ShadowingDefinition {
|
|
2
|
+
kind: 'alias' | 'function';
|
|
3
|
+
file: string;
|
|
4
|
+
line: number;
|
|
5
|
+
fish: boolean;
|
|
6
|
+
}
|
|
7
|
+
export declare function findShadowingDefinition(group: string, home: string): ShadowingDefinition | undefined;
|
|
8
|
+
export declare function shadowFixCommand(group: string, def: ShadowingDefinition): string;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import * as fs from 'fs';
|
|
2
|
+
import * as path from 'path';
|
|
3
|
+
const RC_FILES = [
|
|
4
|
+
'.zshrc', '.zshenv', '.zprofile', '.bashrc', '.bash_aliases', '.bash_profile', '.profile',
|
|
5
|
+
'.config/fish/config.fish',
|
|
6
|
+
];
|
|
7
|
+
const MAX_RC_BYTES = 1024 * 1024;
|
|
8
|
+
const MAX_FUNCTION_LINES = 20;
|
|
9
|
+
function escapeRegExp(value) {
|
|
10
|
+
return value.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
11
|
+
}
|
|
12
|
+
export function findShadowingDefinition(group, home) {
|
|
13
|
+
const name = `${escapeRegExp(group)}(?![\\w-])`;
|
|
14
|
+
const callsAgents = new RegExp(`(?:^|[\\s'"/;&|({])(?:agents|ag)\\s+${name}`);
|
|
15
|
+
const alias = new RegExp(`^\\s*alias\\s+(?:-\\w+\\s+)*(?:--\\s+)?${name}(?:=|\\s+)(.*)$`);
|
|
16
|
+
const fn = new RegExp(`^\\s*(?:function\\s+${name}|${name}\\s*\\(\\s*\\))(.*)$`);
|
|
17
|
+
const comment = /^\s*#/;
|
|
18
|
+
for (const file of RC_FILES) {
|
|
19
|
+
const full = path.join(home, file);
|
|
20
|
+
let text;
|
|
21
|
+
try {
|
|
22
|
+
const stat = fs.statSync(full);
|
|
23
|
+
if (!stat.isFile() || stat.size > MAX_RC_BYTES)
|
|
24
|
+
continue;
|
|
25
|
+
text = fs.readFileSync(full, 'utf-8');
|
|
26
|
+
}
|
|
27
|
+
catch {
|
|
28
|
+
continue;
|
|
29
|
+
}
|
|
30
|
+
const fish = file.endsWith('.fish');
|
|
31
|
+
const lines = text.split(/\r?\n/);
|
|
32
|
+
for (let i = 0; i < lines.length; i++) {
|
|
33
|
+
const aliasMatch = alias.exec(lines[i]);
|
|
34
|
+
if (aliasMatch && callsAgents.test(aliasMatch[1])) {
|
|
35
|
+
return { kind: 'alias', file, line: i + 1, fish };
|
|
36
|
+
}
|
|
37
|
+
const fnMatch = fn.exec(lines[i]);
|
|
38
|
+
if (!fnMatch)
|
|
39
|
+
continue;
|
|
40
|
+
const header = fnMatch[1];
|
|
41
|
+
if (callsAgents.test(header))
|
|
42
|
+
return { kind: 'function', file, line: i + 1, fish };
|
|
43
|
+
if (/\}\s*;?\s*$/.test(header))
|
|
44
|
+
continue;
|
|
45
|
+
let depth = 0;
|
|
46
|
+
const end = Math.min(lines.length, i + MAX_FUNCTION_LINES);
|
|
47
|
+
for (let j = i + 1; j < end; j++) {
|
|
48
|
+
const body = lines[j];
|
|
49
|
+
if (comment.test(body))
|
|
50
|
+
continue;
|
|
51
|
+
if (callsAgents.test(body))
|
|
52
|
+
return { kind: 'function', file, line: i + 1, fish };
|
|
53
|
+
if (fish && /^\s*(?:if|for|while|switch|begin|function)\b/.test(body))
|
|
54
|
+
depth++;
|
|
55
|
+
if (/^\s*(?:\}|end\b)/.test(body) && depth-- === 0)
|
|
56
|
+
break;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
return undefined;
|
|
61
|
+
}
|
|
62
|
+
export function shadowFixCommand(group, def) {
|
|
63
|
+
if (def.fish)
|
|
64
|
+
return `functions --erase ${group}`;
|
|
65
|
+
return def.kind === 'alias' ? `unalias ${group}` : `unset -f ${group}`;
|
|
66
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@phnx-labs/agents-cli",
|
|
3
|
-
"version": "1.23.
|
|
3
|
+
"version": "1.23.52",
|
|
4
4
|
"description": "One CLI for all your AI coding agents - versions, config, cloud dispatch, sessions, and teams (now with first-class Grok Build CLI support)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|