@phnx-labs/agents-cli 1.23.11 → 1.23.12
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 +6 -0
- package/dist/commands/permissions.js +36 -6
- package/dist/lib/agent-spec/agents.js +15 -9
- package/dist/lib/installations/active-check.d.ts +1 -0
- package/dist/lib/installations/active-check.js +37 -4
- package/dist/lib/installations/versions.js +1 -2
- package/dist/lib/permissions-registry.d.ts +4 -0
- package/dist/lib/permissions-registry.js +70 -18
- package/dist/lib/permissions.d.ts +25 -5
- package/dist/lib/permissions.js +239 -53
- package/dist/lib/staleness/detectors/permissions.js +16 -8
- package/dist/lib/staleness/writers/permissions.js +6 -1
- package/dist/lib/types.d.ts +4 -1
- package/package.json +1 -1
|
@@ -3,7 +3,7 @@ import * as path from 'path';
|
|
|
3
3
|
import * as TOML from 'smol-toml';
|
|
4
4
|
import * as yaml from 'yaml';
|
|
5
5
|
import { capableAgents } from '../../capabilities.js';
|
|
6
|
-
import { discoverPermissionGroups, buildPermissionsFromGroups, CODEX_RULES_FILENAME, } from '../../permissions.js';
|
|
6
|
+
import { discoverPermissionGroups, buildPermissionsFromGroups, CODEX_ASK_RULES_FILENAME, CODEX_RULES_FILENAME, } from '../../permissions.js';
|
|
7
7
|
import { lazyAgentMap } from '../writers/lazy-map.js';
|
|
8
8
|
function buildClaudeDetector() {
|
|
9
9
|
return {
|
|
@@ -17,19 +17,22 @@ function buildClaudeDetector() {
|
|
|
17
17
|
const settings = JSON.parse(fs.readFileSync(settingsPath, 'utf-8'));
|
|
18
18
|
const allowRules = settings.permissions?.allow || [];
|
|
19
19
|
const denyRules = settings.permissions?.deny || [];
|
|
20
|
-
|
|
20
|
+
const askRules = settings.permissions?.ask || [];
|
|
21
|
+
if (allowRules.length === 0 && denyRules.length === 0 && askRules.length === 0)
|
|
21
22
|
return [];
|
|
22
23
|
const groups = discoverPermissionGroups();
|
|
23
24
|
const applied = [];
|
|
24
25
|
for (const group of groups) {
|
|
25
26
|
const built = buildPermissionsFromGroups([group.name]);
|
|
26
|
-
|
|
27
|
+
const askContent = built.ask ?? [];
|
|
28
|
+
if (built.allow.length === 0 && (!built.deny || built.deny.length === 0) && askContent.length === 0) {
|
|
27
29
|
applied.push(group.name);
|
|
28
30
|
continue;
|
|
29
31
|
}
|
|
30
32
|
const hasAllow = built.allow.some(r => allowRules.includes(r));
|
|
31
33
|
const hasDeny = built.deny?.some(r => denyRules.includes(r)) || false;
|
|
32
|
-
|
|
34
|
+
const hasAsk = askContent.some(r => askRules.includes(r));
|
|
35
|
+
if (hasAllow || hasDeny || hasAsk)
|
|
33
36
|
applied.push(group.name);
|
|
34
37
|
}
|
|
35
38
|
return applied;
|
|
@@ -47,9 +50,11 @@ function buildCodexDetector() {
|
|
|
47
50
|
list({ versionHome }) {
|
|
48
51
|
const codexConfigPath = path.join(versionHome, '.codex', 'config.toml');
|
|
49
52
|
const codexRulesPath = path.join(versionHome, '.codex', 'rules', CODEX_RULES_FILENAME);
|
|
53
|
+
const codexAskPath = path.join(versionHome, '.codex', 'rules', CODEX_ASK_RULES_FILENAME);
|
|
50
54
|
const hasConfig = fs.existsSync(codexConfigPath);
|
|
51
55
|
const hasRules = fs.existsSync(codexRulesPath);
|
|
52
|
-
|
|
56
|
+
const hasAskRules = fs.existsSync(codexAskPath);
|
|
57
|
+
if (!hasConfig && !hasRules && !hasAskRules)
|
|
53
58
|
return [];
|
|
54
59
|
try {
|
|
55
60
|
let hasPermKeys = false;
|
|
@@ -57,7 +62,7 @@ function buildCodexDetector() {
|
|
|
57
62
|
const config = TOML.parse(fs.readFileSync(codexConfigPath, 'utf-8'));
|
|
58
63
|
hasPermKeys = !!(config.approval_policy || config.sandbox_mode || config.sandbox_workspace_write);
|
|
59
64
|
}
|
|
60
|
-
if (hasPermKeys || hasRules) {
|
|
65
|
+
if (hasPermKeys || hasRules || hasAskRules) {
|
|
61
66
|
return discoverPermissionGroups().map(g => g.name);
|
|
62
67
|
}
|
|
63
68
|
}
|
|
@@ -100,7 +105,8 @@ function buildAntigravityDetector() {
|
|
|
100
105
|
const perms = settings?.permissions;
|
|
101
106
|
const hasAllow = Array.isArray(perms?.allow) && perms.allow.length > 0;
|
|
102
107
|
const hasDeny = Array.isArray(perms?.deny) && perms.deny.length > 0;
|
|
103
|
-
|
|
108
|
+
const hasAsk = Array.isArray(perms?.ask) && perms.ask.length > 0;
|
|
109
|
+
if (hasAllow || hasDeny || hasAsk) {
|
|
104
110
|
return discoverPermissionGroups().map(g => g.name);
|
|
105
111
|
}
|
|
106
112
|
}
|
|
@@ -181,7 +187,9 @@ function buildDroidDetector() {
|
|
|
181
187
|
const settings = JSON.parse(fs.readFileSync(settingsPath, 'utf-8'));
|
|
182
188
|
const hasAllow = Array.isArray(settings.commandAllowlist) && settings.commandAllowlist.length > 0;
|
|
183
189
|
const hasDeny = Array.isArray(settings.commandDenylist) && settings.commandDenylist.length > 0;
|
|
184
|
-
|
|
190
|
+
const askRules = settings.permissionRules?.rules;
|
|
191
|
+
const hasAsk = Array.isArray(askRules) && askRules.some((rule) => rule?.decision === 'ask');
|
|
192
|
+
if (hasAllow || hasDeny || hasAsk)
|
|
185
193
|
return discoverPermissionGroups().map(g => g.name);
|
|
186
194
|
}
|
|
187
195
|
catch { }
|
|
@@ -11,9 +11,14 @@ function buildPermissionsWriter(agent) {
|
|
|
11
11
|
const built = buildPermissionsFromGroups(selection);
|
|
12
12
|
const hasAllow = built.allow.length > 0;
|
|
13
13
|
const hasDeny = (built.deny?.length ?? 0) > 0;
|
|
14
|
-
|
|
14
|
+
const hasAsk = (built.ask?.length ?? 0) > 0;
|
|
15
|
+
if (!hasAllow && !hasDeny && !hasAsk)
|
|
15
16
|
return { synced: [] };
|
|
16
17
|
const r = applyPermsToVersion(agent, built, versionHome, true, cwd);
|
|
18
|
+
if (r.skipped?.length) {
|
|
19
|
+
for (const line of r.skipped)
|
|
20
|
+
console.warn(line);
|
|
21
|
+
}
|
|
17
22
|
return { synced: r.success ? selection : [] };
|
|
18
23
|
},
|
|
19
24
|
};
|
package/dist/lib/types.d.ts
CHANGED
|
@@ -98,6 +98,7 @@ export interface AgentConfig {
|
|
|
98
98
|
mcpHttp: Capability;
|
|
99
99
|
mcpHeaders: Capability;
|
|
100
100
|
allowlist: Capability;
|
|
101
|
+
ask: Capability;
|
|
101
102
|
skills: Capability;
|
|
102
103
|
commands: Capability;
|
|
103
104
|
plugins: Capability;
|
|
@@ -118,7 +119,7 @@ export type Capability = boolean | {
|
|
|
118
119
|
export type RulesCapability = false | {
|
|
119
120
|
file: string;
|
|
120
121
|
};
|
|
121
|
-
export type CapabilityName = 'hooks' | 'mcp' | 'mcpHttp' | 'mcpHeaders' | 'allowlist' | 'skills' | 'commands' | 'plugins' | 'subagents' | 'rules' | 'workflows' | 'memory' | 'interactiveRepl';
|
|
122
|
+
export type CapabilityName = 'hooks' | 'mcp' | 'mcpHttp' | 'mcpHeaders' | 'allowlist' | 'ask' | 'skills' | 'commands' | 'plugins' | 'subagents' | 'rules' | 'workflows' | 'memory' | 'interactiveRepl';
|
|
122
123
|
export type Mode = 'plan' | 'edit' | 'auto' | 'skip';
|
|
123
124
|
export declare const ALL_MODES: readonly Mode[];
|
|
124
125
|
export type CapabilityFailReason = 'unsupported' | 'too_old' | 'too_new';
|
|
@@ -591,6 +592,7 @@ export interface PermissionSet {
|
|
|
591
592
|
description?: string;
|
|
592
593
|
allow: string[];
|
|
593
594
|
deny?: string[];
|
|
595
|
+
ask?: string[];
|
|
594
596
|
additionalDirectories?: string[];
|
|
595
597
|
}
|
|
596
598
|
export interface InstalledPermission {
|
|
@@ -602,6 +604,7 @@ export interface ClaudePermissions {
|
|
|
602
604
|
permissions: {
|
|
603
605
|
allow: string[];
|
|
604
606
|
deny: string[];
|
|
607
|
+
ask?: string[];
|
|
605
608
|
additionalDirectories?: string[];
|
|
606
609
|
};
|
|
607
610
|
}
|
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.12",
|
|
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",
|