agentspd 1.0.0 → 1.1.0
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/README.md +77 -294
- package/dist/api.d.ts +66 -0
- package/dist/api.d.ts.map +1 -1
- package/dist/api.js +147 -0
- package/dist/commands/agents.d.ts.map +1 -1
- package/dist/commands/agents.js +114 -32
- package/dist/commands/auth.d.ts.map +1 -1
- package/dist/commands/auth.js +58 -41
- package/dist/commands/index.d.ts +2 -0
- package/dist/commands/index.d.ts.map +1 -1
- package/dist/commands/index.js +2 -0
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +111 -19
- package/dist/commands/openclaw.d.ts +3 -0
- package/dist/commands/openclaw.d.ts.map +1 -0
- package/dist/commands/openclaw.js +1033 -0
- package/dist/commands/policies.d.ts.map +1 -1
- package/dist/commands/policies.js +137 -41
- package/dist/commands/threats.d.ts.map +1 -1
- package/dist/commands/threats.js +75 -29
- package/dist/commands/webhooks.d.ts.map +1 -1
- package/dist/commands/webhooks.js +24 -21
- package/dist/commands/workspaces.d.ts +5 -0
- package/dist/commands/workspaces.d.ts.map +1 -0
- package/dist/commands/workspaces.js +514 -0
- package/dist/config.d.ts +6 -3
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +34 -23
- package/dist/index.js +178 -155
- package/dist/openclaw-api.d.ts +81 -0
- package/dist/openclaw-api.d.ts.map +1 -0
- package/dist/openclaw-api.js +262 -0
- package/package.json +6 -6
package/dist/commands/init.js
CHANGED
|
@@ -72,6 +72,8 @@ async function runSignup() {
|
|
|
72
72
|
console.log();
|
|
73
73
|
output.info('You need an account first. Let\'s create one.');
|
|
74
74
|
console.log();
|
|
75
|
+
console.log(` Or sign up in your browser: ${output.link('https://emotos.ai/signup')}`);
|
|
76
|
+
console.log();
|
|
75
77
|
const answers = await inquirer.prompt([
|
|
76
78
|
{
|
|
77
79
|
type: 'input',
|
|
@@ -104,7 +106,7 @@ async function runSignup() {
|
|
|
104
106
|
email: answers.email,
|
|
105
107
|
password: answers.password,
|
|
106
108
|
name: answers.name,
|
|
107
|
-
role: '
|
|
109
|
+
role: 'free',
|
|
108
110
|
orgName: answers.orgName,
|
|
109
111
|
});
|
|
110
112
|
if (result.error) {
|
|
@@ -113,12 +115,55 @@ async function runSignup() {
|
|
|
113
115
|
return false;
|
|
114
116
|
}
|
|
115
117
|
if (result.data) {
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
118
|
+
const data = result.data;
|
|
119
|
+
// Handle verification-required flow (production)
|
|
120
|
+
if (data.requiresVerification) {
|
|
121
|
+
// Store org API key for auth until verified
|
|
122
|
+
if (data.orgApiKey) {
|
|
123
|
+
setConfig('apiKey', data.orgApiKey);
|
|
124
|
+
}
|
|
125
|
+
spinner.succeed('Account created!');
|
|
126
|
+
output.info(`Email verification required. Check your inbox at ${answers.email}`);
|
|
127
|
+
console.log();
|
|
128
|
+
console.log(` Verify your email, then log in at: ${output.link('https://emotos.ai/login')}`);
|
|
129
|
+
console.log();
|
|
130
|
+
// Dev mode: auto-verify using the debug token
|
|
131
|
+
if (data._verificationToken) {
|
|
132
|
+
const verifySpinner = ora('Auto-verifying (dev mode)...').start();
|
|
133
|
+
const verifyResult = await api.verify(data._verificationToken);
|
|
134
|
+
if (verifyResult.data) {
|
|
135
|
+
setConfig('sessionToken', verifyResult.data.token);
|
|
136
|
+
if (verifyResult.data.org) {
|
|
137
|
+
setConfig('orgId', verifyResult.data.org.id);
|
|
138
|
+
setConfig('orgName', verifyResult.data.org.name);
|
|
139
|
+
}
|
|
140
|
+
if (verifyResult.data.user) {
|
|
141
|
+
setConfig('userId', verifyResult.data.user.id);
|
|
142
|
+
setConfig('userName', verifyResult.data.user.name);
|
|
143
|
+
}
|
|
144
|
+
verifySpinner.succeed('Email verified (dev mode)');
|
|
145
|
+
return true;
|
|
146
|
+
}
|
|
147
|
+
verifySpinner.warn('Auto-verify failed — verify manually then run: agentspd auth login');
|
|
148
|
+
}
|
|
149
|
+
else {
|
|
150
|
+
output.info('After verifying your email, run: agentspd auth login');
|
|
151
|
+
}
|
|
152
|
+
return true; // Continue init with API key auth
|
|
153
|
+
}
|
|
154
|
+
// Full session response (auto-verified / legacy flow)
|
|
155
|
+
const sessionToken = data.sessionToken || data.token;
|
|
156
|
+
if (sessionToken)
|
|
157
|
+
setConfig('sessionToken', sessionToken);
|
|
158
|
+
if (data.org?.id)
|
|
159
|
+
setConfig('orgId', data.org.id);
|
|
160
|
+
if (data.org?.name)
|
|
161
|
+
setConfig('orgName', data.org.name);
|
|
162
|
+
if (data.user?.id)
|
|
163
|
+
setConfig('userId', data.user.id);
|
|
164
|
+
if (data.user?.name)
|
|
165
|
+
setConfig('userName', data.user.name);
|
|
166
|
+
spinner.succeed(`Welcome, ${data.user?.name ?? answers.name}!`);
|
|
122
167
|
}
|
|
123
168
|
return true;
|
|
124
169
|
}
|
|
@@ -126,6 +171,8 @@ async function runLogin() {
|
|
|
126
171
|
console.log();
|
|
127
172
|
output.info('Log in to your existing account.');
|
|
128
173
|
console.log();
|
|
174
|
+
console.log(` Or log in via browser: ${output.link('https://emotos.ai/login')}`);
|
|
175
|
+
console.log();
|
|
129
176
|
const answers = await inquirer.prompt([
|
|
130
177
|
{
|
|
131
178
|
type: 'input',
|
|
@@ -234,20 +281,64 @@ export function createInitCommand() {
|
|
|
234
281
|
output.printSecret('Agent API Key', apiKey);
|
|
235
282
|
}
|
|
236
283
|
// ── 5. Create & activate policy ─────────────────────────────────
|
|
237
|
-
const
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
284
|
+
const { policyMethod } = await inquirer.prompt([{
|
|
285
|
+
type: 'list',
|
|
286
|
+
name: 'policyMethod',
|
|
287
|
+
message: 'How would you like to create a security policy?',
|
|
288
|
+
choices: [
|
|
289
|
+
{ name: 'Describe what your agent does (AI generates policy)', value: 'ai' },
|
|
290
|
+
{ name: 'Use default deny-all policy', value: 'default' },
|
|
291
|
+
{ name: 'Skip (add policy later)', value: 'skip' },
|
|
292
|
+
],
|
|
293
|
+
}]);
|
|
294
|
+
let policyContent = DEFAULT_POLICY_CONTENT;
|
|
295
|
+
let policyDescription = 'Default deny-by-default policy from agentspd init';
|
|
296
|
+
if (policyMethod === 'ai') {
|
|
297
|
+
const { description } = await inquirer.prompt([{
|
|
298
|
+
type: 'input',
|
|
299
|
+
name: 'description',
|
|
300
|
+
message: 'Describe your agent (e.g. "reads public docs and summarizes them"):',
|
|
301
|
+
validate: (input) => input.length > 0 || 'Description is required',
|
|
302
|
+
}]);
|
|
303
|
+
const genSpinner = ora('🤖 Generating policy with AI...').start();
|
|
304
|
+
const genResult = await api.generatePolicy({ prompt: description, mode: 'single' });
|
|
305
|
+
if (genResult.error) {
|
|
306
|
+
genSpinner.warn('AI generation failed — falling back to default policy');
|
|
307
|
+
}
|
|
308
|
+
else if (genResult.data?.generatedPolicy) {
|
|
309
|
+
policyContent = genResult.data.generatedPolicy;
|
|
310
|
+
policyDescription = `AI-generated policy: ${description}`;
|
|
311
|
+
genSpinner.succeed('🤖 AI policy generated');
|
|
312
|
+
console.log();
|
|
313
|
+
console.log(output.dim(' Generated policy preview:'));
|
|
314
|
+
const preview = policyContent.split('\n').slice(0, 10).map((l) => ` ${output.dim(l)}`).join('\n');
|
|
315
|
+
console.log(preview);
|
|
316
|
+
if (policyContent.split('\n').length > 10)
|
|
317
|
+
console.log(output.dim(' ...'));
|
|
318
|
+
console.log();
|
|
319
|
+
}
|
|
320
|
+
else {
|
|
321
|
+
genSpinner.warn('AI generation returned empty — falling back to default policy');
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
if (policyMethod !== 'skip') {
|
|
325
|
+
const policySpinner = ora('🛡️ Creating security policy...').start();
|
|
326
|
+
const policyResult = await api.createPolicy({
|
|
327
|
+
name: `${agentName}-policy`,
|
|
328
|
+
description: policyDescription,
|
|
329
|
+
content: policyContent,
|
|
330
|
+
});
|
|
331
|
+
if (policyResult.error) {
|
|
332
|
+
policySpinner.warn('Could not create policy — you can add one later with `agentspd policies create`');
|
|
333
|
+
}
|
|
334
|
+
else {
|
|
335
|
+
const policy = policyResult.data;
|
|
336
|
+
await api.activatePolicy(policy.id);
|
|
337
|
+
policySpinner.succeed('🛡️ Security policy applied');
|
|
338
|
+
}
|
|
245
339
|
}
|
|
246
340
|
else {
|
|
247
|
-
|
|
248
|
-
// Activate it
|
|
249
|
-
await api.activatePolicy(policy.id);
|
|
250
|
-
policySpinner.succeed('🛡️ Security policy applied — deny by default');
|
|
341
|
+
output.info('Skipped policy creation. Add one later with: agentspd policies create');
|
|
251
342
|
}
|
|
252
343
|
// ── 6. Issue JWT ────────────────────────────────────────────────
|
|
253
344
|
const tokenSpinner = ora('🔑 Issuing JWT token...').start();
|
|
@@ -267,6 +358,7 @@ export function createInitCommand() {
|
|
|
267
358
|
console.log(output.highlight(' 🚨 Patrol is active. Your agents are protected.'));
|
|
268
359
|
console.log();
|
|
269
360
|
output.heading('What\'s next');
|
|
361
|
+
console.log(` Dashboard: ${output.link('https://emotos.ai')}`);
|
|
270
362
|
console.log(` Monitor your agent: ${output.highlight(`agentspd agents monitor ${agent.id}`)}`);
|
|
271
363
|
console.log(` View threats: ${output.highlight('agentspd threats list')}`);
|
|
272
364
|
console.log(` Review audit logs: ${output.highlight('agentspd audit events')}`);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"openclaw.d.ts","sourceRoot":"","sources":["../../src/commands/openclaw.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAgIpC,wBAAgB,qBAAqB,IAAI,OAAO,CAuqC/C"}
|