@hynaweb/kavlr 1.0.1 → 1.0.4
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/bin/cli.js +18 -13
- package/package.json +2 -2
package/bin/cli.js
CHANGED
|
@@ -35,7 +35,8 @@ function printLogo() {
|
|
|
35
35
|
██╔═██╗ ██╔══██║╚██╗ ██╔╝██║ ██╔══██╗
|
|
36
36
|
██║ ██╗██║ ██║ ╚████╔╝ ███████╗██║ ██║
|
|
37
37
|
╚═╝ ╚═╝╚═╝ ╚═╝ ╚═══╝ ╚══════╝╚═╝ ╚═╝
|
|
38
|
-
`) + chalk.gray(` The AI Agent Action Gate v1.0.
|
|
38
|
+
`) + chalk.gray(` The AI Agent Action Gate v1.0.3
|
|
39
|
+
`));
|
|
39
40
|
}
|
|
40
41
|
|
|
41
42
|
async function cmdSetup() {
|
|
@@ -56,7 +57,6 @@ async function cmdSetup() {
|
|
|
56
57
|
|
|
57
58
|
async function cmdStatus() {
|
|
58
59
|
const key = loadKey();
|
|
59
|
-
if (!key) return console.log(chalk.red('No API key found. Run: kavlr setup'));
|
|
60
60
|
console.log(chalk.gray('Fetching system status...'));
|
|
61
61
|
try {
|
|
62
62
|
const res = await fetch(`${SUPABASE_URL}/rest/v1/settings?id=eq.1&select=kill_switch_active`, {
|
|
@@ -65,12 +65,14 @@ async function cmdStatus() {
|
|
|
65
65
|
const data = await res.json();
|
|
66
66
|
const isKilled = data[0] ? data[0].kill_switch_active : false;
|
|
67
67
|
|
|
68
|
-
console.log(chalk.bold('
|
|
68
|
+
console.log(chalk.bold('
|
|
69
|
+
SYSTEM STATUS'));
|
|
69
70
|
console.log('──────────────────────────────');
|
|
70
71
|
console.log(`API Key: ${chalk.green('CONFIGURED')}`);
|
|
71
72
|
console.log(`Kill Switch: ${isKilled ? chalk.red.bold('HALTED (LOCKDOWN)') : chalk.green.bold('SECURE (ACTIVE)')}`);
|
|
72
73
|
console.log(`Gate: ${chalk.cyan('ONLINE')}`);
|
|
73
|
-
console.log('
|
|
74
|
+
console.log('──────────────────────────────
|
|
75
|
+
');
|
|
74
76
|
} catch (e) {
|
|
75
77
|
console.log(chalk.red(`Error: ${e.message}`));
|
|
76
78
|
}
|
|
@@ -78,28 +80,28 @@ async function cmdStatus() {
|
|
|
78
80
|
|
|
79
81
|
async function cmdLogs() {
|
|
80
82
|
const key = loadKey();
|
|
81
|
-
if (!key) return;
|
|
82
83
|
console.log(chalk.gray('Fetching recent telemetry...'));
|
|
83
84
|
try {
|
|
84
85
|
const userRes = await fetch(`${SUPABASE_URL}/rest/v1/api_keys?key=eq.${key}&select=user_id`, {
|
|
85
86
|
headers: { 'apikey': SUPABASE_ANON, 'Authorization': `Bearer ${SUPABASE_ANON}` }
|
|
86
87
|
});
|
|
87
88
|
const users = await userRes.json();
|
|
88
|
-
if (!users.length) return console.log(chalk.red('Invalid API key.'));
|
|
89
89
|
|
|
90
90
|
const logsRes = await fetch(`${SUPABASE_URL}/rest/v1/agent_logs?user_id=eq.${users[0].user_id}&order=created_at.desc&limit=5`, {
|
|
91
91
|
headers: { 'apikey': SUPABASE_ANON, 'Authorization': `Bearer ${SUPABASE_ANON}` }
|
|
92
92
|
});
|
|
93
93
|
const logs = await logsRes.json();
|
|
94
94
|
|
|
95
|
-
console.log(chalk.bold('
|
|
95
|
+
console.log(chalk.bold('
|
|
96
|
+
RECENT TELEMETRY'));
|
|
96
97
|
console.log('────────────────────────────────────────────────────────');
|
|
97
98
|
logs.forEach(log => {
|
|
98
99
|
const color = log.status === 'BLOCKED' ? chalk.red : chalk.green;
|
|
99
100
|
console.log(`${color(`[${log.status}]`)} ${log.payload}`);
|
|
100
101
|
console.log(chalk.gray(` ID: ${log.agent_id} | Time: ${log.created_at.substring(11, 19)}`));
|
|
101
102
|
});
|
|
102
|
-
console.log('
|
|
103
|
+
console.log('────────────────────────────────────────────────────────
|
|
104
|
+
');
|
|
103
105
|
} catch (e) {
|
|
104
106
|
console.log(chalk.red(`Error: ${e.message}`));
|
|
105
107
|
}
|
|
@@ -114,7 +116,6 @@ function cmdDashboard() {
|
|
|
114
116
|
|
|
115
117
|
async function runGate(args) {
|
|
116
118
|
const key = loadKey();
|
|
117
|
-
if (!key) return console.log(chalk.red('No API key found. Run: kavlr setup'));
|
|
118
119
|
|
|
119
120
|
const binary = args[0];
|
|
120
121
|
const cmdArgs = args.slice(1);
|
|
@@ -147,7 +148,6 @@ async function runGate(args) {
|
|
|
147
148
|
console.log(chalk.red(` Reason: ${aiData.reason}`));
|
|
148
149
|
process.exit(403);
|
|
149
150
|
}
|
|
150
|
-
} else if (!verdict.allowed) {
|
|
151
151
|
console.log(chalk.red.bold(`🛑 [BLOCKED] ${verdict.reason}`));
|
|
152
152
|
process.exit(403);
|
|
153
153
|
} else {
|
|
@@ -170,19 +170,24 @@ async function runGate(args) {
|
|
|
170
170
|
program
|
|
171
171
|
.name('kavlr')
|
|
172
172
|
.description('The AI Agent Action Gate')
|
|
173
|
-
.version('1.0.
|
|
173
|
+
.version('1.0.3')
|
|
174
174
|
.allowExcessArguments(true)
|
|
175
175
|
.allowUnknownOption(true)
|
|
176
176
|
.argument('[args...]', 'Command and arguments')
|
|
177
177
|
.action(async (args) => {
|
|
178
178
|
if (args.length === 0) {
|
|
179
179
|
printLogo();
|
|
180
|
-
console.log(`Usage
|
|
180
|
+
console.log(`Usage:
|
|
181
|
+
kavlr setup / kavlr init
|
|
182
|
+
kavlr status
|
|
183
|
+
kavlr logs
|
|
184
|
+
kavlr dashboard
|
|
185
|
+
kavlr <command> [args...]`);
|
|
181
186
|
return;
|
|
182
187
|
}
|
|
183
188
|
|
|
184
189
|
const cmd = args[0];
|
|
185
|
-
if (cmd === 'setup') return cmdSetup();
|
|
190
|
+
if (cmd === 'setup' || cmd === 'init') return cmdSetup();
|
|
186
191
|
if (cmd === 'status') return cmdStatus();
|
|
187
192
|
if (cmd === 'logs') return cmdLogs();
|
|
188
193
|
if (cmd === 'dashboard') return cmdDashboard();
|
package/package.json
CHANGED