beam-protocol-cli 0.3.0 → 0.5.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.
Files changed (44) hide show
  1. package/package.json +2 -2
  2. package/src/commands/browse.ts +61 -0
  3. package/src/commands/delegate.ts +52 -0
  4. package/src/commands/init.ts +6 -4
  5. package/src/commands/lookup.ts +6 -8
  6. package/src/commands/profile-update.ts +47 -0
  7. package/src/commands/register.ts +1 -1
  8. package/src/commands/report.ts +49 -0
  9. package/src/commands/search.ts +3 -6
  10. package/src/commands/send.ts +4 -9
  11. package/src/commands/stats.ts +40 -0
  12. package/src/commands/verify-check.ts +41 -0
  13. package/src/commands/verify-domain.ts +42 -0
  14. package/src/config.ts +16 -5
  15. package/src/index.ts +91 -12
  16. package/tsconfig.json +7 -2
  17. package/dist/commands/init.d.ts +0 -9
  18. package/dist/commands/init.d.ts.map +0 -1
  19. package/dist/commands/init.js +0 -45
  20. package/dist/commands/init.js.map +0 -1
  21. package/dist/commands/lookup.d.ts +0 -7
  22. package/dist/commands/lookup.d.ts.map +0 -1
  23. package/dist/commands/lookup.js +0 -58
  24. package/dist/commands/lookup.js.map +0 -1
  25. package/dist/commands/register.d.ts +0 -8
  26. package/dist/commands/register.d.ts.map +0 -1
  27. package/dist/commands/register.js +0 -46
  28. package/dist/commands/register.js.map +0 -1
  29. package/dist/commands/search.d.ts +0 -11
  30. package/dist/commands/search.d.ts.map +0 -1
  31. package/dist/commands/search.js +0 -73
  32. package/dist/commands/search.js.map +0 -1
  33. package/dist/commands/send.d.ts +0 -8
  34. package/dist/commands/send.d.ts.map +0 -1
  35. package/dist/commands/send.js +0 -78
  36. package/dist/commands/send.js.map +0 -1
  37. package/dist/config.d.ts +0 -13
  38. package/dist/config.d.ts.map +0 -1
  39. package/dist/config.js +0 -26
  40. package/dist/config.js.map +0 -1
  41. package/dist/index.d.ts +0 -3
  42. package/dist/index.d.ts.map +0 -1
  43. package/dist/index.js +0 -73
  44. package/dist/index.js.map +0 -1
package/src/index.ts CHANGED
@@ -6,6 +6,13 @@ import { cmdRegister } from './commands/register.js'
6
6
  import { cmdLookup } from './commands/lookup.js'
7
7
  import { cmdSearch } from './commands/search.js'
8
8
  import { cmdSend } from './commands/send.js'
9
+ import { cmdBrowse } from './commands/browse.js'
10
+ import { cmdProfileUpdate } from './commands/profile-update.js'
11
+ import { cmdVerifyDomain } from './commands/verify-domain.js'
12
+ import { cmdVerifyCheck } from './commands/verify-check.js'
13
+ import { cmdStats } from './commands/stats.js'
14
+ import { cmdDelegate } from './commands/delegate.js'
15
+ import { cmdReport } from './commands/report.js'
9
16
 
10
17
  const program = new Command()
11
18
 
@@ -15,21 +22,19 @@ program
15
22
  chalk.bold('Beam Protocol CLI') + '\n' +
16
23
  chalk.dim('SMTP for AI Agents — agent identity, registration & intent routing')
17
24
  )
18
- .version('0.1.0')
25
+ .version('0.5.0')
19
26
 
20
- // ─── beam init ────────────────────────────────────────────────────────────────
21
27
  program
22
28
  .command('init')
23
29
  .description('Generate a new Beam identity (writes .beam/identity.json)')
24
30
  .requiredOption('-a, --agent <name>', 'Agent name (e.g. jarvis)')
25
- .requiredOption('-o, --org <name>', 'Organisation name (e.g. coppen)')
26
- .option('-d, --directory <url>', 'Directory server URL', process.env['BEAM_DIRECTORY_URL'] ?? 'http://localhost:3100')
31
+ .option('-o, --org <name>', 'Organisation name (optional for consumer Beam-IDs)')
32
+ .option('-d, --directory <url>', 'Directory server URL', process.env['BEAM_DIRECTORY_URL'] ?? 'https://api.beam.directory')
27
33
  .option('-f, --force', 'Overwrite existing identity')
28
- .action(async (opts: { agent: string; org: string; directory?: string; force?: boolean }) => {
34
+ .action(async (opts: { agent: string; org?: string; directory?: string; force?: boolean }) => {
29
35
  await cmdInit(opts)
30
36
  })
31
37
 
32
- // ─── beam register ────────────────────────────────────────────────────────────
33
38
  program
34
39
  .command('register')
35
40
  .description('Register this agent with a Beam directory')
@@ -40,7 +45,6 @@ program
40
45
  await cmdRegister(opts)
41
46
  })
42
47
 
43
- // ─── beam lookup ──────────────────────────────────────────────────────────────
44
48
  program
45
49
  .command('lookup <beamId>')
46
50
  .description('Look up an agent by Beam ID')
@@ -50,7 +54,6 @@ program
50
54
  await cmdLookup(beamId, opts)
51
55
  })
52
56
 
53
- // ─── beam search ──────────────────────────────────────────────────────────────
54
57
  program
55
58
  .command('search')
56
59
  .description('Search for agents in the directory')
@@ -64,7 +67,81 @@ program
64
67
  await cmdSearch(opts)
65
68
  })
66
69
 
67
- // ─── beam send ────────────────────────────────────────────────────────────────
70
+ program
71
+ .command('browse')
72
+ .description('Browse paginated agent listings')
73
+ .option('--page <n>', 'Page number', '1')
74
+ .option('--capability <cap>', 'Filter by capability')
75
+ .option('--tier <tier>', 'Filter by verification tier')
76
+ .option('--verified-only', 'Only show verified agents')
77
+ .option('-d, --directory <url>', 'Override directory URL')
78
+ .option('--json', 'Output raw JSON')
79
+ .action(async (opts: { page?: string; capability?: string; tier?: string; verifiedOnly?: boolean; directory?: string; json?: boolean }) => {
80
+ await cmdBrowse(opts)
81
+ })
82
+
83
+ const profile = program.command('profile').description('Profile management commands')
84
+ profile
85
+ .command('update')
86
+ .description('Update your agent profile')
87
+ .option('--description <text>', 'Profile description')
88
+ .option('--logo-url <url>', 'Public logo URL')
89
+ .option('--website <url>', 'Public website URL')
90
+ .option('-d, --directory <url>', 'Override directory URL')
91
+ .option('--json', 'Output raw JSON')
92
+ .action(async (opts: { description?: string; logoUrl?: string; website?: string; directory?: string; json?: boolean }) => {
93
+ await cmdProfileUpdate(opts)
94
+ })
95
+
96
+ const verify = program.command('verify').description('Verification commands')
97
+ verify
98
+ .command('domain <domain>')
99
+ .description('Initiate DNS verification for a domain')
100
+ .option('-d, --directory <url>', 'Override directory URL')
101
+ .option('--json', 'Output raw JSON')
102
+ .action(async (domain: string, opts: { directory?: string; json?: boolean }) => {
103
+ await cmdVerifyDomain(domain, opts)
104
+ })
105
+
106
+ verify
107
+ .command('check')
108
+ .description('Check current verification status')
109
+ .option('-d, --directory <url>', 'Override directory URL')
110
+ .option('--json', 'Output raw JSON')
111
+ .action(async (opts: { directory?: string; json?: boolean }) => {
112
+ await cmdVerifyCheck(opts)
113
+ })
114
+
115
+ program
116
+ .command('stats')
117
+ .description('Show directory statistics')
118
+ .option('-d, --directory <url>', 'Override directory URL')
119
+ .option('--json', 'Output raw JSON')
120
+ .action(async (opts: { directory?: string; json?: boolean }) => {
121
+ await cmdStats(opts)
122
+ })
123
+
124
+ program
125
+ .command('delegate <targetBeamId>')
126
+ .description('Create a delegation for another Beam agent')
127
+ .requiredOption('--scope <scope>', 'Delegation scope')
128
+ .option('--expires <hours>', 'Hours until delegation expiry')
129
+ .option('-d, --directory <url>', 'Override directory URL')
130
+ .option('--json', 'Output raw JSON')
131
+ .action(async (targetBeamId: string, opts: { scope?: string; expires?: string; directory?: string; json?: boolean }) => {
132
+ await cmdDelegate(targetBeamId, opts)
133
+ })
134
+
135
+ program
136
+ .command('report <targetBeamId>')
137
+ .description('Report an agent')
138
+ .requiredOption('--reason <reason>', 'Reason for the report')
139
+ .option('-d, --directory <url>', 'Override directory URL')
140
+ .option('--json', 'Output raw JSON')
141
+ .action(async (targetBeamId: string, opts: { reason?: string; directory?: string; json?: boolean }) => {
142
+ await cmdReport(targetBeamId, opts)
143
+ })
144
+
68
145
  program
69
146
  .command('send <to> <intent> [params]')
70
147
  .description('Send an intent to an agent and print the result')
@@ -75,9 +152,11 @@ program
75
152
  await cmdSend(to, intent, params, opts)
76
153
  })
77
154
 
78
- // ─── Error handling ───────────────────────────────────────────────────────────
79
155
  program.configureOutput({
80
- writeErr: str => process.stderr.write(chalk.red(str))
156
+ outputError: (str, write) => write(chalk.red(str))
81
157
  })
82
158
 
83
- program.parse()
159
+ program.parseAsync(process.argv).catch((err: Error) => {
160
+ console.error(chalk.red(`\n✖ ${err.message}`))
161
+ process.exit(1)
162
+ })
package/tsconfig.json CHANGED
@@ -13,6 +13,11 @@
13
13
  "skipLibCheck": true,
14
14
  "resolveJsonModule": true
15
15
  },
16
- "include": ["src/**/*"],
17
- "exclude": ["node_modules", "dist"]
16
+ "include": [
17
+ "src/**/*"
18
+ ],
19
+ "exclude": [
20
+ "node_modules",
21
+ "dist"
22
+ ]
18
23
  }
@@ -1,9 +0,0 @@
1
- interface InitOptions {
2
- agent: string;
3
- org: string;
4
- force?: boolean;
5
- directory?: string;
6
- }
7
- export declare function cmdInit(options: InitOptions): Promise<void>;
8
- export {};
9
- //# sourceMappingURL=init.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAKA,UAAU,WAAW;IACnB,KAAK,EAAE,MAAM,CAAA;IACb,GAAG,EAAE,MAAM,CAAA;IACX,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED,wBAAsB,OAAO,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CA8CjE"}
@@ -1,45 +0,0 @@
1
- import chalk from 'chalk';
2
- import ora from 'ora';
3
- import { BeamIdentity } from '@beam-protocol/sdk';
4
- import { configExists, saveConfig, DEFAULT_DIRECTORY_URL } from '../config.js';
5
- export async function cmdInit(options) {
6
- const { agent, org, force, directory = DEFAULT_DIRECTORY_URL } = options;
7
- // Validate inputs
8
- if (!/^[a-z0-9_-]+$/.test(agent)) {
9
- console.error(chalk.red('✖ Agent name must match [a-z0-9_-]'));
10
- process.exit(1);
11
- }
12
- if (!/^[a-z0-9_-]+$/.test(org)) {
13
- console.error(chalk.red('✖ Org name must match [a-z0-9_-]'));
14
- process.exit(1);
15
- }
16
- if (configExists() && !force) {
17
- console.error(chalk.yellow('⚠ Identity already exists at .beam/identity.json'));
18
- console.error(chalk.dim(' Use --force to overwrite'));
19
- process.exit(1);
20
- }
21
- const spinner = ora('Generating Ed25519 keypair...').start();
22
- const identity = BeamIdentity.generate({ agentName: agent, orgName: org });
23
- const identityData = identity.export();
24
- saveConfig({
25
- identity: identityData,
26
- directoryUrl: directory,
27
- createdAt: new Date().toISOString()
28
- });
29
- spinner.succeed('Identity generated');
30
- console.log('');
31
- console.log(chalk.bold('🔑 Beam Identity Created'));
32
- console.log(chalk.dim('─'.repeat(40)));
33
- console.log(`${chalk.cyan('Beam ID:')} ${chalk.bold(identityData.beamId)}`);
34
- console.log(`${chalk.cyan('Directory:')} ${directory}`);
35
- console.log(`${chalk.cyan('Config:')} ${process.cwd()}/.beam/identity.json`);
36
- console.log('');
37
- console.log(chalk.dim('Public key (SPKI/DER/base64):'));
38
- console.log(chalk.dim(identityData.publicKeyBase64.substring(0, 64) + '...'));
39
- console.log('');
40
- console.log(chalk.yellow('⚠ Keep .beam/identity.json secret — it contains your private key!'));
41
- console.log(chalk.dim(' Add .beam/ to your .gitignore'));
42
- console.log('');
43
- console.log(chalk.green('Next step:'), `beam register --display-name "My Agent" --capabilities "query,answer"`);
44
- }
45
- //# sourceMappingURL=init.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"init.js","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,GAAG,MAAM,KAAK,CAAA;AACrB,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AACjD,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAA;AAS9E,MAAM,CAAC,KAAK,UAAU,OAAO,CAAC,OAAoB;IAChD,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,SAAS,GAAG,qBAAqB,EAAE,GAAG,OAAO,CAAA;IAExE,kBAAkB;IAClB,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;QACjC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,oCAAoC,CAAC,CAAC,CAAA;QAC9D,OAAO,CA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C,GAAG,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,QAAQ,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,EAAE,CAAC,CAAA;IAC/E,OAAO,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,MAAM,SAAS,EAAE,CAAC,CAAA;IACzD,OAAO,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,SAAS,OAAO,CAAC,GAAG,EAAE,sBAAsB,CAAC,CAAA;IACjF,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAA;IACf,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,+BAA+B,CAAC,CAAC,CAAA;IACvD,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,YAAY,CAAC,eAAe,CAAC,SAAS,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,KAAK,CAAC,CAAC,CAAA;IAC7E,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAA;IACf,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,oEAAoE,CAAC,CAAC,CAAA;IAC/F,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,kCAAkC,CAAC,CAAC,CAAA;IAC1D,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAA;IACf,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,YAAY,CAAC,EAAE,uEAAuE,CAAC,CAAA;AACjH,CAAC"}
@@ -1,7 +0,0 @@
1
- interface LookupOptions {
2
- directory?: string;
3
- json?: boolean;
4
- }
5
- export declare function cmdLookup(beamId: string, options: LookupOptions): Promise<void>;
6
- export {};
7
- //# sourceMappingURL=lookup.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"lookup.d.ts","sourceRoot":"","sources":["../../src/commands/lookup.ts"],"names":[],"mappings":"AAMA,UAAU,aAAa;IACrB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,IAAI,CAAC,EAAE,OAAO,CAAA;CACf;AAED,wBAAsB,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAiDrF"}
@@ -1,58 +0,0 @@
1
- import chalk from 'chalk';
2
- import ora from 'ora';
3
- import { BeamDirectory } from '@beam-protocol/sdk';
4
- import { loadConfig } from '../config.js';
5
- export async function cmdLookup(beamId, options) {
6
- const config = loadConfig();
7
- const directoryUrl = options.directory ?? config.directoryUrl;
8
- // Validate beam ID format
9
- if (!beamId.match(/^[a-z0-9_-]+@[a-z0-9_-]+\.beam\.directory$/)) {
10
- console.error(chalk.red(`✖ Invalid Beam ID format: ${beamId}`));
11
- console.error(chalk.dim(' Expected: agent@org.beam.directory'));
12
- process.exit(1);
13
- }
14
- const spinner = ora(`Looking up ${chalk.bold(beamId)}...`).start();
15
- try {
16
- const directory = new BeamDirectory({ baseUrl: directoryUrl });
17
- const record = await directory.lookup(beamId);
18
- if (!record) {
19
- spinner.fail(`Agent not found: ${beamId}`);
20
- process.exit(1);
21
- }
22
- spinner.stop();
23
- if (options.json) {
24
- console.log(JSON.stringify(record, null, 2));
25
- return;
26
- }
27
- const trustBar = getTrustBar(record.trustScore);
28
- console.log('');
29
- console.log(chalk.bold(`🤖 ${record.displayName}`));
30
- console.log(chalk.dim('─'.repeat(40)));
31
- console.log(`${chalk.cyan('Beam ID:')} ${chalk.bold(record.beamId)}`);
32
- console.log(`${chalk.cyan('Org:')} ${record.org}`);
33
- console.log(`${chalk.cyan('Trust Score:')} ${trustBar} ${(record.trustScore * 100).toFixed(0)}%`);
34
- console.log(`${chalk.cyan('Verified:')} ${record.verified ? chalk.green('✓ Verified') : chalk.yellow('Unverified')}`);
35
- if (record.capabilities.length > 0) {
36
- console.log(`${chalk.cyan('Capabilities:')} ${record.capabilities.map(c => chalk.blue(c)).join(', ')}`);
37
- }
38
- console.log(`${chalk.cyan('Last Seen:')} ${new Date(record.lastSeen).toLocaleString()}`);
39
- console.log(`${chalk.cyan('Registered:')} ${new Date(record.createdAt).toLocaleString()}`);
40
- console.log('');
41
- }
42
- catch (err) {
43
- spinner.fail('Lookup failed');
44
- console.error(chalk.red(`✖ ${err.message}`));
45
- process.exit(1);
46
- }
47
- }
48
- function getTrustBar(score) {
49
- const filled = Math.round(score * 10);
50
- const empty = 10 - filled;
51
- const bar = '█'.repeat(filled) + '░'.repeat(empty);
52
- if (score >= 0.8)
53
- return chalk.green(bar);
54
- if (score >= 0.5)
55
- return chalk.yellow(bar);
56
- return chalk.red(bar);
57
- }
58
- //# sourceMappingURL=lookup.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"lookup.js","sourceRoot":"","sources":["../../src/commands/lookup.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,GAAG,MAAM,KAAK,CAAA;AACrB,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAElD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAOzC,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC,MAAc,EAAE,OAAsB;IACpE,MAAM,MAAM,GAAG,UAAU,EAAE,CAAA;IAC3B,MAAM,YAAY,GAAG,OAAO,CAAC,SAAS,IAAI,MAAM,CAAC,YAAY,CAAA;IAE7D,0BAA0B;IAC1B,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,4CAA4C,CAAC,EAAE,CAAC;QAChE,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,6BAA6B,MAAM,EAAE,CAAC,CAAC,CAAA;QAC/D,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,sCAAsC,CAAC,CAAC,CAAA;QAChE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IACjB,CAAC;IAED,MAAM,OAAO,GAAG,GAAG,CAAC,cA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,CAAA;QACvD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IACjB,CAAC;AACH,CAAC;AAED,SAAS,WAAW,CAAC,KAAa;IAChC,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,EAAE,CAAC,CAAA;IACrC,MAAM,KAAK,GAAG,EAAE,GAAG,MAAM,CAAA;IACzB,MAAM,GAAG,GAAG,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;IAClD,IAAI,KAAK,IAAI,GAAG;QAAE,OAAO,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;IACzC,IAAI,KAAK,IAAI,GAAG;QAAE,OAAO,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;IAC1C,OAAO,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;AACvB,CAAC"}
@@ -1,8 +0,0 @@
1
- interface RegisterOptions {
2
- displayName?: string;
3
- capabilities?: string;
4
- directory?: string;
5
- }
6
- export declare function cmdRegister(options: RegisterOptions): Promise<void>;
7
- export {};
8
- //# sourceMappingURL=register.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"register.d.ts","sourceRoot":"","sources":["../../src/commands/register.ts"],"names":[],"mappings":"AAKA,UAAU,eAAe;IACvB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED,wBAAsB,WAAW,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CA8CzE"}
@@ -1,46 +0,0 @@
1
- import chalk from 'chalk';
2
- import ora from 'ora';
3
- import { BeamClient, BeamIdentity } from '@beam-protocol/sdk';
4
- import { loadConfig } from '../config.js';
5
- export async function cmdRegister(options) {
6
- const config = loadConfig();
7
- const directoryUrl = options.directory ?? config.directoryUrl;
8
- const parsed = BeamIdentity.parseBeamId(config.identity.beamId);
9
- if (!parsed) {
10
- console.error(chalk.red('✖ Invalid Beam ID in config'));
11
- process.exit(1);
12
- }
13
- const displayName = options.displayName ?? parsed.agent;
14
- const capabilities = options.capabilities
15
- ? options.capabilities.split(',').map(c => c.trim()).filter(Boolean)
16
- : [];
17
- const spinner = ora(`Registering ${chalk.bold(config.identity.beamId)}...`).start();
18
- try {
19
- const client = new BeamClient({
20
- identity: config.identity,
21
- directoryUrl
22
- });
23
- const record = await client.register(displayName, capabilities);
24
- spinner.succeed('Agent registered successfully');
25
- console.log('');
26
- console.log(chalk.bold('✅ Registration Complete'));
27
- console.log(chalk.dim('─'.repeat(40)));
28
- console.log(`${chalk.cyan('Beam ID:')} ${chalk.bold(record.beamId)}`);
29
- console.log(`${chalk.cyan('Display:')} ${record.displayName}`);
30
- console.log(`${chalk.cyan('Org:')} ${record.org}`);
31
- console.log(`${chalk.cyan('Trust Score:')} ${(record.trustScore * 100).toFixed(0)}%`);
32
- console.log(`${chalk.cyan('Verified:')} ${record.verified ? chalk.green('Yes ✓') : chalk.yellow('No')}`);
33
- if (record.capabilities.length > 0) {
34
- console.log(`${chalk.cyan('Capabilities:')} ${record.capabilities.join(', ')}`);
35
- }
36
- console.log(`${chalk.cyan('Registered:')} ${new Date(record.createdAt).toLocaleString()}`);
37
- console.log('');
38
- console.log(chalk.green('Next step:'), `beam lookup ${record.beamId}`);
39
- }
40
- catch (err) {
41
- spinner.fail('Registration failed');
42
- console.error(chalk.red(`✖ ${err.message}`));
43
- process.exit(1);
44
- }
45
- }
46
- //# sourceMappingURL=register.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"register.js","sourceRoot":"","sources":["../../src/commands/register.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,GAAG,MAAM,KAAK,CAAA;AACrB,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAC7D,OAAO,EA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IAAI,CAAC,aAAa,CAAC,KAAK,IAAI,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,cAAc,EAAE,EAAE,CAAC,CAAA;QAC3F,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAA;QACf,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,YAAY,CAAC,EAAE,eAAe,MAAM,CAAC,MAAM,EAAE,CAAC,CAAA;IACxE,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAA;QACnC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,KAAM,GAAa,CAAC,OAAO,EAAE,CAAC,CAAC,CAAA;QACvD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IACjB,CAAC;AACH,CAAC"}
@@ -1,11 +0,0 @@
1
- interface SearchOptions {
2
- org?: string;
3
- capability?: string;
4
- minTrust?: string;
5
- limit?: string;
6
- directory?: string;
7
- json?: boolean;
8
- }
9
- export declare function cmdSearch(options: SearchOptions): Promise<void>;
10
- export {};
11
- //# sourceMappingURL=search.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../src/commands/search.ts"],"names":[],"mappings":"AAKA,UAAU,aAAa;IACrB,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,IAAI,CAAC,EAAE,OAAO,CAAA;CACf;AAED,wBAAsB,SAAS,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CA0DrE"}
@@ -1,73 +0,0 @@
1
- import chalk from 'chalk';
2
- import ora from 'ora';
3
- import { BeamDirectory } from '@beam-protocol/sdk';
4
- import { loadConfig } from '../config.js';
5
- export async function cmdSearch(options) {
6
- const config = loadConfig();
7
- const directoryUrl = options.directory ?? config.directoryUrl;
8
- const query = {
9
- org: options.org,
10
- capabilities: options.capability ? [options.capability] : undefined,
11
- minTrustScore: options.minTrust ? parseFloat(options.minTrust) : undefined,
12
- limit: options.limit ? parseInt(options.limit, 10) : 20
13
- };
14
- const parts = [];
15
- if (query.org)
16
- parts.push(`org=${query.org}`);
17
- if (query.capabilities)
18
- parts.push(`capability=${query.capabilities[0]}`);
19
- const label = parts.length ? parts.join(', ') : 'all agents';
20
- const spinner = ora(`Searching ${label}...`).start();
21
- try {
22
- const directory = new BeamDirectory({ baseUrl: directoryUrl });
23
- const agents = await directory.search(query);
24
- spinner.stop();
25
- if (options.json) {
26
- console.log(JSON.stringify(agents, null, 2));
27
- return;
28
- }
29
- if (agents.length === 0) {
30
- console.log(chalk.yellow(`\n No agents found matching your query.\n`));
31
- return;
32
- }
33
- console.log('');
34
- console.log(chalk.bold(`🔍 Found ${agents.length} agent${agents.length !== 1 ? 's' : ''}`));
35
- console.log(chalk.dim('─'.repeat(60)));
36
- for (const agent of agents) {
37
- const trustPct = (agent.trustScore * 100).toFixed(0);
38
- const verified = agent.verified ? chalk.green('✓') : chalk.dim('○');
39
- const caps = agent.capabilities.length > 0
40
- ? chalk.dim(` [${agent.capabilities.join(', ')}]`)
41
- : '';
42
- console.log(` ${verified} ${chalk.bold(agent.beamId)}${caps}`);
43
- console.log(` ${chalk.dim(agent.displayName)} · Trust: ${getTrustColored(agent.trustScore, trustPct + '%')} · Last seen: ${formatRelative(agent.lastSeen)}`);
44
- console.log('');
45
- }
46
- }
47
- catch (err) {
48
- spinner.fail('Search failed');
49
- console.error(chalk.red(`✖ ${err.message}`));
50
- process.exit(1);
51
- }
52
- }
53
- function getTrustColored(score, label) {
54
- if (score >= 0.8)
55
- return chalk.green(label);
56
- if (score >= 0.5)
57
- return chalk.yellow(label);
58
- return chalk.red(label);
59
- }
60
- function formatRelative(iso) {
61
- const ms = Date.now() - new Date(iso).getTime();
62
- const minutes = Math.floor(ms / 60000);
63
- if (minutes < 1)
64
- return chalk.dim('just now');
65
- if (minutes < 60)
66
- return chalk.dim(`${minutes}m ago`);
67
- const hours = Math.floor(minutes / 60);
68
- if (hours < 24)
69
- return chalk.dim(`${hours}h ago`);
70
- const days = Math.floor(hours / 24);
71
- return chalk.dim(`${days}d ago`);
72
- }
73
- //# sourceMappingURL=search.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"search.js","sourceRoot":"","sources":["../../src/commands/search.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,GAAG,MAAM,KAAK,CAAA;AACrB,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAWzC,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC,OAAsB;IACpD,MAAM,MAAM,GAAG,UAAU,EAAE,CAAA;IAC3B,MAAM,YAAY,GAAG,OAAO,CAAC,SAAS,IAAI,MAAM,CAAC,YAAY,CAAA;IAE7D,MAAM,KAAK,GAAG;QACZ,GAAG,EAAE,OAAO,CAAC,GAAG;QAChB,YAAY,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,SAAS;QACnE,aAAa,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,SAAS;QAC1E,KAAK,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE;KACxD,CAAA;IAED,MAAM,KAAK,GAAG,EAAE,CAAA;IAChB,IAAI,KAAK,CAAC,GAAG;QAAE,KAAK,CAAC,IAAI,CAAC,OAAO,KAAK,C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;IACnD,IAAI,KAAK,IAAI,GAAG;QAAE,OAAO,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,CAAA;IAC3C,IAAI,KAAK,IAAI,GAAG;QAAE,OAAO,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;IAC5C,OAAO,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,CAAA;AACzB,CAAC;AAED,SAAS,cAAc,CAAC,GAAW;IACjC,MAAM,EAAE,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,IAAI,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,CAAA;IAC/C,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,GAAG,KAAK,CAAC,CAAA;IACtC,IAAI,OAAO,GAAG,CAAC;QAAE,OAAO,KAAK,CAAC,GAAG,CAAC,UAAU,CAAC,CAAA;IAC7C,IAAI,OAAO,GAAG,EAAE;QAAE,OAAO,KAAK,CAAC,GAAG,CAAC,GAAG,OAAO,OAAO,CAAC,CAAA;IACrD,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,GAAG,EAAE,CAAC,CAAA;IACtC,IAAI,KAAK,GAAG,EAAE;QAAE,OAAO,KAAK,CAAC,GAAG,CAAC,GAAG,KAAK,OAAO,CAAC,CAAA;IACjD,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,EAAE,CAAC,CAAA;IACnC,OAAO,KAAK,CAAC,GAAG,CAAC,GAAG,IAAI,OAAO,CAAC,CAAA;AAClC,CAAC"}
@@ -1,8 +0,0 @@
1
- interface SendOptions {
2
- directory?: string;
3
- timeout?: string;
4
- json?: boolean;
5
- }
6
- export declare function cmdSend(to: string, intent: string, paramsJson: string | undefined, options: SendOptions): Promise<void>;
7
- export {};
8
- //# sourceMappingURL=send.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"send.d.ts","sourceRoot":"","sources":["../../src/commands/send.ts"],"names":[],"mappings":"AAMA,UAAU,WAAW;IACnB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,IAAI,CAAC,EAAE,OAAO,CAAA;CACf;AAED,wBAAsB,OAAO,CAC3B,EAAE,EAAE,MAAM,EACV,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,MAAM,GAAG,SAAS,EAC9B,OAAO,EAAE,WAAW,GACnB,OAAO,CAAC,IAAI,CAAC,CA+Ef"}
@@ -1,78 +0,0 @@
1
- import chalk from 'chalk';
2
- import ora from 'ora';
3
- import { BeamClient } from '@beam-protocol/sdk';
4
- import { loadConfig } from '../config.js';
5
- export async function cmdSend(to, intent, paramsJson, options) {
6
- const config = loadConfig();
7
- const directoryUrl = options.directory ?? config.directoryUrl;
8
- const timeoutMs = options.timeout ? parseInt(options.timeout, 10) * 1000 : 10000;
9
- // Validate beam ID format
10
- if (!to.match(/^[a-z0-9_-]+@[a-z0-9_-]+\.beam\.directory$/)) {
11
- console.error(chalk.red(`✖ Invalid Beam ID: ${to}`));
12
- console.error(chalk.dim(' Expected: agent@org.beam.directory'));
13
- process.exit(1);
14
- }
15
- // Parse params
16
- let params = {};
17
- if (paramsJson) {
18
- try {
19
- const parsed = JSON.parse(paramsJson);
20
- if (typeof parsed === 'object' && parsed !== null && !Array.isArray(parsed)) {
21
- params = parsed;
22
- }
23
- else {
24
- throw new Error('Params must be a JSON object');
25
- }
26
- }
27
- catch (err) {
28
- console.error(chalk.red(`✖ Invalid params JSON: ${err.message}`));
29
- process.exit(1);
30
- }
31
- }
32
- const spinner = ora(`Sending ${chalk.bold(intent)} to ${chalk.bold(to)}...`).start();
33
- const startTime = Date.now();
34
- try {
35
- const client = new BeamClient({
36
- identity: config.identity,
37
- directoryUrl
38
- });
39
- const result = await client.send(to, intent, params, timeoutMs);
40
- const elapsed = Date.now() - startTime;
41
- spinner.stop();
42
- if (options.json) {
43
- console.log(JSON.stringify(result, null, 2));
44
- return;
45
- }
46
- if (result.success) {
47
- console.log('');
48
- console.log(chalk.bold.green('✅ Intent delivered successfully'));
49
- console.log(chalk.dim('─'.repeat(40)));
50
- console.log(`${chalk.cyan('From:')} ${config.identity.beamId}`);
51
- console.log(`${chalk.cyan('To:')} ${to}`);
52
- console.log(`${chalk.cyan('Intent:')} ${intent}`);
53
- console.log(`${chalk.cyan('Latency:')} ${elapsed}ms`);
54
- if (result.payload && Object.keys(result.payload).length > 0) {
55
- console.log('');
56
- console.log(chalk.bold('📦 Result Payload:'));
57
- console.log(JSON.stringify(result.payload, null, 2));
58
- }
59
- }
60
- else {
61
- console.log('');
62
- console.log(chalk.bold.red('✖ Intent failed'));
63
- console.log(chalk.dim('─'.repeat(40)));
64
- console.log(`${chalk.cyan('Error:')} ${result.error ?? 'Unknown error'}`);
65
- if (result.errorCode) {
66
- console.log(`${chalk.cyan('Code:')} ${result.errorCode}`);
67
- }
68
- console.log(`${chalk.cyan('Latency:')} ${elapsed}ms`);
69
- }
70
- console.log('');
71
- }
72
- catch (err) {
73
- spinner.fail('Send failed');
74
- console.error(chalk.red(`✖ ${err.message}`));
75
- process.exit(1);
76
- }
77
- }
78
- //# sourceMappingURL=send.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"send.js","sourceRoot":"","sources":["../../src/commands/send.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,GAAG,MAAM,KAAK,CAAA;AACrB,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AAE/C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAQzC,MAAM,CAAC,KAAK,UAAU,OAAO,CAC3B,EAAU,EACV,MAAc,EACd,UAA8B,EAC9B,OAAoB;IAEpB,MAAM,MAAM,GAAG,UAAU,EAAE,CAAA;IAC3B,MAAM,YAAY,GAAG,OAAO,CAAC,SAAS,IAAI,MAAM,CAAC,YAAY,CAAA;IAC7D,MAAM,SAAS,GAAG,OAAO,CAAC,OAAO,CA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B,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,KAAM,GAAa,CAAC,OAAO,EAAE,CAAC,CAAC,CAAA;QACvD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IACjB,CAAC;AACH,CAAC"}
package/dist/config.d.ts DELETED
@@ -1,13 +0,0 @@
1
- import type { BeamIdentityData } from '@beam-protocol/sdk';
2
- export interface BeamConfig {
3
- identity: BeamIdentityData;
4
- directoryUrl: string;
5
- createdAt: string;
6
- }
7
- export declare function getConfigDir(cwd?: string): string;
8
- export declare function getConfigPath(cwd?: string): string;
9
- export declare function configExists(cwd?: string): boolean;
10
- export declare function loadConfig(cwd?: string): BeamConfig;
11
- export declare function saveConfig(config: BeamConfig, cwd?: string): void;
12
- export declare const DEFAULT_DIRECTORY_URL: string;
13
- //# sourceMappingURL=config.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAE1D,MAAM,WAAW,UAAU;IACzB,QAAQ,EAAE,gBAAgB,CAAA;IAC1B,YAAY,EAAE,MAAM,CAAA;IACpB,SAAS,EAAE,MAAM,CAAA;CAClB;AAED,wBAAgB,YAAY,CAAC,GAAG,SAAgB,GAAG,MAAM,CAExD;AAED,wBAAgB,aAAa,CAAC,GAAG,SAAgB,GAAG,MAAM,CAEzD;AAED,wBAAgB,YAAY,CAAC,GAAG,SAAgB,GAAG,OAAO,CAEzD;AAED,wBAAgB,UAAU,CAAC,GAAG,SAAgB,GAAG,UAAU,CAS1D;AAED,wBAAgB,UAAU,CAAC,MAAM,EAAE,UAAU,EAAE,GAAG,SAAgB,GAAG,IAAI,CAIxE;AAED,eAAO,MAAM,qBAAqB,QAA+D,CAAA"}
package/dist/config.js DELETED
@@ -1,26 +0,0 @@
1
- import { readFileSync, writeFileSync, mkdirSync, existsSync } from 'node:fs';
2
- import { join } from 'node:path';
3
- export function getConfigDir(cwd = process.cwd()) {
4
- return join(cwd, '.beam');
5
- }
6
- export function getConfigPath(cwd = process.cwd()) {
7
- return join(getConfigDir(cwd), 'identity.json');
8
- }
9
- export function configExists(cwd = process.cwd()) {
10
- return existsSync(getConfigPath(cwd));
11
- }
12
- export function loadConfig(cwd = process.cwd()) {
13
- const path = getConfigPath(cwd);
14
- if (!existsSync(path)) {
15
- throw new Error(`No Beam identity found. Run 'beam init' first.`);
16
- }
17
- const raw = readFileSync(path, 'utf8');
18
- return JSON.parse(raw);
19
- }
20
- export function saveConfig(config, cwd = process.cwd()) {
21
- const dir = getConfigDir(cwd);
22
- mkdirSync(dir, { recursive: true });
23
- writeFileSync(getConfigPath(cwd), JSON.stringify(config, null, 2), 'utf8');
24
- }
25
- export const DEFAULT_DIRECTORY_URL = process.env['BEAM_DIRECTORY_URL'] ?? 'http://localhost:3100';
26
- //# sourceMappingURL=config.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AAC5E,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAShC,MAAM,UAAU,YAAY,CAAC,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE;IAC9C,OAAO,IAAI,CAAC,GAAG,EAAE,OAAO,CAAC,CAAA;AAC3B,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE;IAC/C,OAAO,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,EAAE,eAAe,CAAC,CAAA;AACjD,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE;IAC9C,OAAO,UAAU,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,CAAA;AACvC,CAAC;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