beam-protocol-cli 0.5.0 → 0.5.2

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 (77) hide show
  1. package/README.md +150 -0
  2. package/dist/commands/browse.d.ts +11 -0
  3. package/dist/commands/browse.d.ts.map +1 -0
  4. package/dist/commands/browse.js +47 -0
  5. package/dist/commands/browse.js.map +1 -0
  6. package/dist/commands/delegate.d.ts +9 -0
  7. package/dist/commands/delegate.d.ts.map +1 -0
  8. package/dist/commands/delegate.js +44 -0
  9. package/dist/commands/delegate.js.map +1 -0
  10. package/dist/commands/init.d.ts +9 -0
  11. package/dist/commands/init.d.ts.map +1 -0
  12. package/dist/commands/init.js +44 -0
  13. package/dist/commands/init.js.map +1 -0
  14. package/dist/commands/lookup.d.ts +7 -0
  15. package/dist/commands/lookup.d.ts.map +1 -0
  16. package/dist/commands/lookup.js +56 -0
  17. package/dist/commands/lookup.js.map +1 -0
  18. package/dist/commands/profile-update.d.ts +10 -0
  19. package/dist/commands/profile-update.d.ts.map +1 -0
  20. package/dist/commands/profile-update.js +36 -0
  21. package/dist/commands/profile-update.js.map +1 -0
  22. package/dist/commands/register.d.ts +8 -0
  23. package/dist/commands/register.d.ts.map +1 -0
  24. package/dist/commands/register.js +46 -0
  25. package/dist/commands/register.js.map +1 -0
  26. package/dist/commands/report.d.ts +8 -0
  27. package/dist/commands/report.d.ts.map +1 -0
  28. package/dist/commands/report.js +41 -0
  29. package/dist/commands/report.js.map +1 -0
  30. package/dist/commands/search.d.ts +11 -0
  31. package/dist/commands/search.d.ts.map +1 -0
  32. package/dist/commands/search.js +72 -0
  33. package/dist/commands/search.js.map +1 -0
  34. package/dist/commands/send.d.ts +8 -0
  35. package/dist/commands/send.d.ts.map +1 -0
  36. package/dist/commands/send.js +76 -0
  37. package/dist/commands/send.js.map +1 -0
  38. package/dist/commands/stats.d.ts +7 -0
  39. package/dist/commands/stats.d.ts.map +1 -0
  40. package/dist/commands/stats.js +35 -0
  41. package/dist/commands/stats.js.map +1 -0
  42. package/dist/commands/talk.d.ts +10 -0
  43. package/dist/commands/talk.d.ts.map +1 -0
  44. package/dist/commands/talk.js +80 -0
  45. package/dist/commands/talk.js.map +1 -0
  46. package/dist/commands/verify-check.d.ts +7 -0
  47. package/dist/commands/verify-check.d.ts.map +1 -0
  48. package/dist/commands/verify-check.js +34 -0
  49. package/dist/commands/verify-check.js.map +1 -0
  50. package/dist/commands/verify-domain.d.ts +7 -0
  51. package/dist/commands/verify-domain.d.ts.map +1 -0
  52. package/dist/commands/verify-domain.js +36 -0
  53. package/dist/commands/verify-domain.js.map +1 -0
  54. package/dist/config.d.ts +16 -0
  55. package/dist/config.d.ts.map +1 -0
  56. package/dist/config.js +37 -0
  57. package/dist/config.js.map +1 -0
  58. package/dist/index.d.ts +3 -0
  59. package/dist/index.d.ts.map +1 -0
  60. package/dist/index.js +170 -0
  61. package/dist/index.js.map +1 -0
  62. package/package.json +16 -4
  63. package/src/commands/browse.ts +0 -61
  64. package/src/commands/delegate.ts +0 -52
  65. package/src/commands/init.ts +0 -61
  66. package/src/commands/lookup.ts +0 -68
  67. package/src/commands/profile-update.ts +0 -47
  68. package/src/commands/register.ts +0 -58
  69. package/src/commands/report.ts +0 -49
  70. package/src/commands/search.ts +0 -87
  71. package/src/commands/send.ts +0 -92
  72. package/src/commands/stats.ts +0 -40
  73. package/src/commands/verify-check.ts +0 -41
  74. package/src/commands/verify-domain.ts +0 -42
  75. package/src/config.ts +0 -51
  76. package/src/index.ts +0 -162
  77. package/tsconfig.json +0 -23
package/dist/index.js ADDED
@@ -0,0 +1,170 @@
1
+ #!/usr/bin/env node
2
+ import { createRequire } from 'node:module';
3
+ import { Command } from 'commander';
4
+ import chalk from 'chalk';
5
+ import { cmdInit } from './commands/init.js';
6
+ import { cmdRegister } from './commands/register.js';
7
+ import { cmdLookup } from './commands/lookup.js';
8
+ import { cmdSearch } from './commands/search.js';
9
+ import { cmdSend } from './commands/send.js';
10
+ import { cmdBrowse } from './commands/browse.js';
11
+ import { cmdProfileUpdate } from './commands/profile-update.js';
12
+ import { cmdVerifyDomain } from './commands/verify-domain.js';
13
+ import { cmdVerifyCheck } from './commands/verify-check.js';
14
+ import { cmdStats } from './commands/stats.js';
15
+ import { cmdDelegate } from './commands/delegate.js';
16
+ import { cmdReport } from './commands/report.js';
17
+ import { cmdTalk } from './commands/talk.js';
18
+ const require = createRequire(import.meta.url);
19
+ const { version } = require('../package.json');
20
+ const program = new Command();
21
+ program
22
+ .name('beam')
23
+ .description(chalk.bold('Beam Protocol CLI') + '\n' +
24
+ chalk.dim('SMTP for AI Agents — agent identity, registration & intent routing'))
25
+ .version(version);
26
+ program
27
+ .command('init')
28
+ .description('Generate a new Beam identity (writes .beam/identity.json)')
29
+ .option('-a, --agent <name>', 'Agent name (e.g. jarvis)')
30
+ .option('-n, --name <name>', 'Alias for --agent')
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')
33
+ .option('-f, --force', 'Overwrite existing identity')
34
+ .action(async (opts) => {
35
+ const agent = opts.agent ?? opts.name;
36
+ if (!agent) {
37
+ throw new Error('init requires --agent <name>');
38
+ }
39
+ await cmdInit({ agent, org: opts.org, directory: opts.directory, force: opts.force });
40
+ });
41
+ program
42
+ .command('register')
43
+ .description('Register this agent with a Beam directory')
44
+ .option('-n, --display-name <name>', 'Human-readable display name')
45
+ .option('--name <name>', 'Alias for --display-name')
46
+ .option('-c, --capabilities <list>', 'Comma-separated capabilities (e.g. query,answer,write)')
47
+ .option('-d, --directory <url>', 'Override directory URL')
48
+ .action(async (opts) => {
49
+ await cmdRegister({
50
+ displayName: opts.displayName ?? opts.name,
51
+ capabilities: opts.capabilities,
52
+ directory: opts.directory,
53
+ });
54
+ });
55
+ program
56
+ .command('lookup <beamId>')
57
+ .description('Look up an agent by Beam ID')
58
+ .option('-d, --directory <url>', 'Override directory URL')
59
+ .option('--json', 'Output raw JSON')
60
+ .action(async (beamId, opts) => {
61
+ await cmdLookup(beamId, opts);
62
+ });
63
+ program
64
+ .command('search')
65
+ .description('Search for agents in the directory')
66
+ .option('--org <org>', 'Filter by organisation')
67
+ .option('--capability <cap>', 'Filter by capability')
68
+ .option('--min-trust <score>', 'Minimum trust score (0.0-1.0)')
69
+ .option('--limit <n>', 'Max results', '20')
70
+ .option('-d, --directory <url>', 'Override directory URL')
71
+ .option('--json', 'Output raw JSON')
72
+ .action(async (opts) => {
73
+ await cmdSearch(opts);
74
+ });
75
+ program
76
+ .command('browse')
77
+ .description('Browse paginated agent listings')
78
+ .option('--page <n>', 'Page number', '1')
79
+ .option('--capability <cap>', 'Filter by capability')
80
+ .option('--tier <tier>', 'Filter by verification tier')
81
+ .option('--verified-only', 'Only show verified agents')
82
+ .option('-d, --directory <url>', 'Override directory URL')
83
+ .option('--json', 'Output raw JSON')
84
+ .action(async (opts) => {
85
+ await cmdBrowse(opts);
86
+ });
87
+ const profile = program.command('profile').description('Profile management commands');
88
+ profile
89
+ .command('update')
90
+ .description('Update your agent profile')
91
+ .option('--description <text>', 'Profile description')
92
+ .option('--logo-url <url>', 'Public logo URL')
93
+ .option('--website <url>', 'Public website URL')
94
+ .option('-d, --directory <url>', 'Override directory URL')
95
+ .option('--json', 'Output raw JSON')
96
+ .action(async (opts) => {
97
+ await cmdProfileUpdate(opts);
98
+ });
99
+ const verify = program.command('verify').description('Verification commands');
100
+ verify
101
+ .command('domain <domain>')
102
+ .description('Initiate DNS verification for a domain')
103
+ .option('-d, --directory <url>', 'Override directory URL')
104
+ .option('--json', 'Output raw JSON')
105
+ .action(async (domain, opts) => {
106
+ await cmdVerifyDomain(domain, opts);
107
+ });
108
+ verify
109
+ .command('check')
110
+ .description('Check current verification status')
111
+ .option('-d, --directory <url>', 'Override directory URL')
112
+ .option('--json', 'Output raw JSON')
113
+ .action(async (opts) => {
114
+ await cmdVerifyCheck(opts);
115
+ });
116
+ program
117
+ .command('stats')
118
+ .description('Show directory statistics')
119
+ .option('-d, --directory <url>', 'Override directory URL')
120
+ .option('--json', 'Output raw JSON')
121
+ .action(async (opts) => {
122
+ await cmdStats(opts);
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, opts) => {
132
+ await cmdDelegate(targetBeamId, opts);
133
+ });
134
+ program
135
+ .command('report <targetBeamId>')
136
+ .description('Report an agent')
137
+ .requiredOption('--reason <reason>', 'Reason for the report')
138
+ .option('-d, --directory <url>', 'Override directory URL')
139
+ .option('--json', 'Output raw JSON')
140
+ .action(async (targetBeamId, opts) => {
141
+ await cmdReport(targetBeamId, opts);
142
+ });
143
+ program
144
+ .command('send <to> <intent> [params]')
145
+ .description('Send an intent to an agent and print the result')
146
+ .option('-d, --directory <url>', 'Override directory URL')
147
+ .option('-t, --timeout <seconds>', 'Timeout in seconds', '10')
148
+ .option('--json', 'Output raw JSON')
149
+ .action(async (to, intent, params, opts) => {
150
+ await cmdSend(to, intent, params, opts);
151
+ });
152
+ program
153
+ .command('talk <to> <message>')
154
+ .description('Send a natural-language message via conversation.message')
155
+ .option('-d, --directory <url>', 'Override directory URL')
156
+ .option('-t, --timeout <seconds>', 'Timeout in seconds', '60')
157
+ .option('-l, --language <language>', 'Language hint, e.g. en or de')
158
+ .option('-c, --context <json>', 'Optional context JSON object')
159
+ .option('--json', 'Output raw JSON')
160
+ .action(async (to, message, opts) => {
161
+ await cmdTalk(to, message, opts);
162
+ });
163
+ program.configureOutput({
164
+ outputError: (str, write) => write(chalk.red(str))
165
+ });
166
+ program.parseAsync(process.argv).catch((err) => {
167
+ console.error(chalk.red(`\n✖ ${err.message}`));
168
+ process.exit(1);
169
+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AAO,EAAE,CAAC,CAAC,CAAA;IAC9C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;AACjB,CAAC,CAAC,CAAA"}
package/package.json CHANGED
@@ -1,12 +1,13 @@
1
1
  {
2
2
  "name": "beam-protocol-cli",
3
- "version": "0.5.0",
4
- "description": "Beam Protocol CLI \u2014 manage Beam identities, register agents, send intents",
3
+ "version": "0.5.2",
4
+ "description": "Beam Protocol CLI manage Beam identities, register agents, send intents",
5
5
  "type": "module",
6
6
  "bin": {
7
7
  "beam": "./dist/index.js"
8
8
  },
9
9
  "main": "./dist/index.js",
10
+ "types": "./dist/index.d.ts",
10
11
  "scripts": {
11
12
  "build": "tsc",
12
13
  "dev": "node --watch dist/index.js",
@@ -14,7 +15,7 @@
14
15
  "start": "node dist/index.js"
15
16
  },
16
17
  "dependencies": {
17
- "@beam-protocol/sdk": "*",
18
+ "beam-protocol-sdk": "^0.5.2",
18
19
  "chalk": "^5.3.0",
19
20
  "commander": "^12.0.0",
20
21
  "inquirer": "^9.2.15",
@@ -27,6 +28,17 @@
27
28
  "engines": {
28
29
  "node": ">=18.0.0"
29
30
  },
31
+ "files": [
32
+ "dist",
33
+ "README.md",
34
+ "LICENSE"
35
+ ],
36
+ "repository": {
37
+ "type": "git",
38
+ "url": "https://github.com/Beam-directory/beam-protocol.git",
39
+ "directory": "packages/cli"
40
+ },
41
+ "homepage": "https://beam.directory",
30
42
  "license": "Apache-2.0",
31
43
  "keywords": [
32
44
  "beam-protocol",
@@ -34,4 +46,4 @@
34
46
  "ai-agents",
35
47
  "cli"
36
48
  ]
37
- }
49
+ }
@@ -1,61 +0,0 @@
1
- import chalk from 'chalk'
2
- import ora from 'ora'
3
- import { BeamClient } from '@beam-protocol/sdk'
4
- import type { BrowseFilters } from '@beam-protocol/sdk'
5
- import { loadConfig } from '../config.js'
6
-
7
- interface BrowseOptions {
8
- page?: string
9
- capability?: string
10
- tier?: string
11
- verifiedOnly?: boolean
12
- directory?: string
13
- json?: boolean
14
- }
15
-
16
- export async function cmdBrowse(options: BrowseOptions): Promise<void> {
17
- const config = loadConfig()
18
- const directoryUrl = options.directory ?? config.directoryUrl
19
- const page = options.page ? parseInt(options.page, 10) : 1
20
- const filters: BrowseFilters = {
21
- capability: options.capability,
22
- tier: options.tier as BrowseFilters['tier'],
23
- verified_only: options.verifiedOnly,
24
- }
25
-
26
- const spinner = ora(`Browsing directory page ${page}...`).start()
27
-
28
- try {
29
- const client = new BeamClient({ identity: config.identity, directoryUrl })
30
- const result = await client.browse(page, filters)
31
- spinner.stop()
32
-
33
- if (options.json) {
34
- console.log(JSON.stringify(result, null, 2))
35
- return
36
- }
37
-
38
- console.log('')
39
- console.log(chalk.bold(`📚 Directory Page ${result.page}`))
40
- console.log(chalk.dim(`Showing ${result.agents.length} of ${result.total} agents`))
41
- console.log(chalk.dim('─'.repeat(72)))
42
-
43
- for (const agent of result.agents) {
44
- const badge = agent.verified ? chalk.green('✓') : chalk.dim('○')
45
- const tier = agent.verificationTier ? chalk.magenta(agent.verificationTier) : chalk.dim('basic')
46
- console.log(` ${badge} ${chalk.bold(agent.beamId)} ${chalk.dim(`(${tier})`)}`)
47
- console.log(` ${agent.displayName}${agent.description ? chalk.dim(` — ${agent.description}`) : ''}`)
48
- if (agent.capabilities.length > 0) {
49
- console.log(` ${chalk.cyan('Capabilities:')} ${agent.capabilities.join(', ')}`)
50
- }
51
- if (agent.website) {
52
- console.log(` ${chalk.cyan('Website:')} ${agent.website}`)
53
- }
54
- console.log('')
55
- }
56
- } catch (err) {
57
- spinner.fail('Browse failed')
58
- console.error(chalk.red(`✖ ${(err as Error).message}`))
59
- process.exit(1)
60
- }
61
- }
@@ -1,52 +0,0 @@
1
- import chalk from 'chalk'
2
- import ora from 'ora'
3
- import { BeamClient } from '@beam-protocol/sdk'
4
- import { BEAM_ID_PATTERN, loadConfig } from '../config.js'
5
-
6
- interface DelegateOptions {
7
- scope?: string
8
- expires?: string
9
- directory?: string
10
- json?: boolean
11
- }
12
-
13
- export async function cmdDelegate(targetBeamId: string, options: DelegateOptions): Promise<void> {
14
- if (!BEAM_ID_PATTERN.test(targetBeamId)) {
15
- console.error(chalk.red(`✖ Invalid Beam ID: ${targetBeamId}`))
16
- process.exit(1)
17
- }
18
- if (!options.scope) {
19
- console.error(chalk.red('✖ Missing required --scope value'))
20
- process.exit(1)
21
- }
22
-
23
- const config = loadConfig()
24
- const directoryUrl = options.directory ?? config.directoryUrl
25
- const expiresIn = options.expires ? parseInt(options.expires, 10) : undefined
26
- const spinner = ora(`Creating delegation for ${chalk.bold(targetBeamId)}...`).start()
27
-
28
- try {
29
- const client = new BeamClient({ identity: config.identity, directoryUrl })
30
- const delegation = await client.delegate(targetBeamId, options.scope, expiresIn)
31
- spinner.stop()
32
-
33
- if (options.json) {
34
- console.log(JSON.stringify(delegation, null, 2))
35
- return
36
- }
37
-
38
- console.log('')
39
- console.log(chalk.bold.green('✅ Delegation created'))
40
- console.log(chalk.dim('─'.repeat(40)))
41
- console.log(`${chalk.cyan('From:')} ${delegation.sourceBeamId}`)
42
- console.log(`${chalk.cyan('To:')} ${delegation.targetBeamId}`)
43
- console.log(`${chalk.cyan('Scope:')} ${delegation.scope}`)
44
- if (delegation.expiresAt) console.log(`${chalk.cyan('Expires:')} ${delegation.expiresAt}`)
45
- if (delegation.status) console.log(`${chalk.cyan('Status:')} ${delegation.status}`)
46
- console.log('')
47
- } catch (err) {
48
- spinner.fail('Delegation failed')
49
- console.error(chalk.red(`✖ ${(err as Error).message}`))
50
- process.exit(1)
51
- }
52
- }
@@ -1,61 +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
-
6
- interface InitOptions {
7
- agent: string
8
- org?: string
9
- force?: boolean
10
- directory?: string
11
- }
12
-
13
- export async function cmdInit(options: InitOptions): Promise<void> {
14
- const { agent, org, force, directory = DEFAULT_DIRECTORY_URL } = options
15
-
16
- if (!/^[a-z0-9_-]+$/.test(agent)) {
17
- console.error(chalk.red('✖ Agent name must match [a-z0-9_-]'))
18
- process.exit(1)
19
- }
20
- if (org && !/^[a-z0-9_-]+$/.test(org)) {
21
- console.error(chalk.red('✖ Org name must match [a-z0-9_-]'))
22
- process.exit(1)
23
- }
24
-
25
- if (configExists() && !force) {
26
- console.error(chalk.yellow('⚠ Identity already exists at .beam/identity.json'))
27
- console.error(chalk.dim(' Use --force to overwrite'))
28
- process.exit(1)
29
- }
30
-
31
- const spinner = ora('Generating Ed25519 keypair...').start()
32
-
33
- const identity = BeamIdentity.generate({ agentName: agent, orgName: org })
34
- const identityData = identity.export()
35
-
36
- saveConfig({
37
- identity: identityData,
38
- directoryUrl: directory,
39
- createdAt: new Date().toISOString()
40
- })
41
-
42
- spinner.succeed('Identity generated')
43
-
44
- console.log('')
45
- console.log(chalk.bold('🔑 Beam Identity Created'))
46
- console.log(chalk.dim('─'.repeat(40)))
47
- console.log(`${chalk.cyan('Beam ID:')} ${chalk.bold(identityData.beamId)}`)
48
- console.log(`${chalk.cyan('Directory:')} ${directory}`)
49
- console.log(`${chalk.cyan('Config:')} ${process.cwd()}/.beam/identity.json`)
50
- console.log('')
51
- console.log(chalk.dim('Public key (SPKI/DER/base64):'))
52
- console.log(chalk.dim(identityData.publicKeyBase64.substring(0, 64) + '...'))
53
- console.log('')
54
- console.log(chalk.yellow('⚠ Keep .beam/identity.json secret — it contains your private key!'))
55
- console.log(chalk.dim(' Add .beam/ to your .gitignore'))
56
- console.log('')
57
- console.log(
58
- chalk.green('Next step:'),
59
- `beam register --display-name "${org ? agent : 'My Consumer Agent'}" --capabilities "query,answer"`
60
- )
61
- }
@@ -1,68 +0,0 @@
1
- import chalk from 'chalk'
2
- import ora from 'ora'
3
- import { BeamDirectory } from '@beam-protocol/sdk'
4
- import type { BeamIdString } from '@beam-protocol/sdk'
5
- import { BEAM_ID_PATTERN, resolveDirectoryUrl } from '../config.js'
6
-
7
- interface LookupOptions {
8
- directory?: string
9
- json?: boolean
10
- }
11
-
12
- export async function cmdLookup(beamId: string, options: LookupOptions): Promise<void> {
13
- const directoryUrl = resolveDirectoryUrl(options.directory)
14
-
15
- if (!BEAM_ID_PATTERN.test(beamId)) {
16
- console.error(chalk.red(`✖ Invalid Beam ID format: ${beamId}`))
17
- console.error(chalk.dim(' Expected: agent@beam.directory or agent@org.beam.directory'))
18
- process.exit(1)
19
- }
20
-
21
- const spinner = ora(`Looking up ${chalk.bold(beamId)}...`).start()
22
-
23
- try {
24
- const directory = new BeamDirectory({ baseUrl: directoryUrl })
25
- const record = await directory.lookup(beamId as BeamIdString)
26
-
27
- if (!record) {
28
- spinner.fail(`Agent not found: ${beamId}`)
29
- process.exit(1)
30
- }
31
-
32
- spinner.stop()
33
-
34
- if (options.json) {
35
- console.log(JSON.stringify(record, null, 2))
36
- return
37
- }
38
-
39
- const trustBar = getTrustBar(record.trustScore)
40
-
41
- console.log('')
42
- console.log(chalk.bold(`🤖 ${record.displayName}`))
43
- console.log(chalk.dim('─'.repeat(40)))
44
- console.log(`${chalk.cyan('Beam ID:')} ${chalk.bold(record.beamId)}`)
45
- console.log(`${chalk.cyan('Org:')} ${record.org ?? chalk.dim('consumer')}`)
46
- console.log(`${chalk.cyan('Trust Score:')} ${trustBar} ${(record.trustScore * 100).toFixed(0)}%`)
47
- console.log(`${chalk.cyan('Verified:')} ${record.verified ? chalk.green('✓ Verified') : chalk.yellow('Unverified')}`)
48
- if (record.capabilities.length > 0) {
49
- console.log(`${chalk.cyan('Capabilities:')} ${record.capabilities.map((capability: string) => chalk.blue(capability)).join(', ')}`)
50
- }
51
- console.log(`${chalk.cyan('Last Seen:')} ${new Date(record.lastSeen).toLocaleString()}`)
52
- console.log(`${chalk.cyan('Registered:')} ${new Date(record.createdAt).toLocaleString()}`)
53
- console.log('')
54
- } catch (err) {
55
- spinner.fail('Lookup failed')
56
- console.error(chalk.red(`✖ ${(err as Error).message}`))
57
- process.exit(1)
58
- }
59
- }
60
-
61
- function getTrustBar(score: number): string {
62
- const filled = Math.round(score * 10)
63
- const empty = 10 - filled
64
- const bar = '█'.repeat(filled) + '░'.repeat(empty)
65
- if (score >= 0.8) return chalk.green(bar)
66
- if (score >= 0.5) return chalk.yellow(bar)
67
- return chalk.red(bar)
68
- }
@@ -1,47 +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
-
6
- interface ProfileUpdateOptions {
7
- description?: string
8
- logoUrl?: string
9
- website?: string
10
- directory?: string
11
- json?: boolean
12
- }
13
-
14
- export async function cmdProfileUpdate(options: ProfileUpdateOptions): Promise<void> {
15
- const config = loadConfig()
16
- const directoryUrl = options.directory ?? config.directoryUrl
17
- const spinner = ora(`Updating profile for ${chalk.bold(config.identity.beamId)}...`).start()
18
-
19
- try {
20
- const client = new BeamClient({ identity: config.identity, directoryUrl })
21
- const profile = await client.updateProfile({
22
- description: options.description,
23
- logo_url: options.logoUrl,
24
- website: options.website,
25
- })
26
-
27
- spinner.stop()
28
-
29
- if (options.json) {
30
- console.log(JSON.stringify(profile, null, 2))
31
- return
32
- }
33
-
34
- console.log('')
35
- console.log(chalk.bold.green('✅ Profile updated'))
36
- console.log(chalk.dim('─'.repeat(40)))
37
- console.log(`${chalk.cyan('Beam ID:')} ${profile.beamId}`)
38
- console.log(`${chalk.cyan('Description:')} ${profile.description ?? chalk.dim('—')}`)
39
- console.log(`${chalk.cyan('Logo URL:')} ${profile.logoUrl ?? chalk.dim('—')}`)
40
- console.log(`${chalk.cyan('Website:')} ${profile.website ?? chalk.dim('—')}`)
41
- console.log('')
42
- } catch (err) {
43
- spinner.fail('Profile update failed')
44
- console.error(chalk.red(`✖ ${(err as Error).message}`))
45
- process.exit(1)
46
- }
47
- }
@@ -1,58 +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
-
6
- interface RegisterOptions {
7
- displayName?: string
8
- capabilities?: string
9
- directory?: string
10
- }
11
-
12
- export async function cmdRegister(options: RegisterOptions): Promise<void> {
13
- const config = loadConfig()
14
- const directoryUrl = options.directory ?? config.directoryUrl
15
-
16
- const parsed = BeamIdentity.parseBeamId(config.identity.beamId)
17
- if (!parsed) {
18
- console.error(chalk.red('✖ Invalid Beam ID in config'))
19
- process.exit(1)
20
- }
21
-
22
- const displayName = options.displayName ?? parsed.agent
23
- const capabilities = options.capabilities
24
- ? options.capabilities.split(',').map(c => c.trim()).filter(Boolean)
25
- : []
26
-
27
- const spinner = ora(`Registering ${chalk.bold(config.identity.beamId)}...`).start()
28
-
29
- try {
30
- const client = new BeamClient({
31
- identity: config.identity,
32
- directoryUrl
33
- })
34
-
35
- const record = await client.register(displayName, capabilities)
36
-
37
- spinner.succeed('Agent registered successfully')
38
-
39
- console.log('')
40
- console.log(chalk.bold('✅ Registration Complete'))
41
- console.log(chalk.dim('─'.repeat(40)))
42
- console.log(`${chalk.cyan('Beam ID:')} ${chalk.bold(record.beamId)}`)
43
- console.log(`${chalk.cyan('Display:')} ${record.displayName}`)
44
- console.log(`${chalk.cyan('Org:')} ${record.org ?? chalk.dim('consumer')}`)
45
- console.log(`${chalk.cyan('Trust Score:')} ${(record.trustScore * 100).toFixed(0)}%`)
46
- console.log(`${chalk.cyan('Verified:')} ${record.verified ? chalk.green('Yes ✓') : chalk.yellow('No')}`)
47
- if (record.capabilities.length > 0) {
48
- console.log(`${chalk.cyan('Capabilities:')} ${record.capabilities.join(', ')}`)
49
- }
50
- console.log(`${chalk.cyan('Registered:')} ${new Date(record.createdAt).toLocaleString()}`)
51
- console.log('')
52
- console.log(chalk.green('Next step:'), `beam lookup ${record.beamId}`)
53
- } catch (err) {
54
- spinner.fail('Registration failed')
55
- console.error(chalk.red(`✖ ${(err as Error).message}`))
56
- process.exit(1)
57
- }
58
- }
@@ -1,49 +0,0 @@
1
- import chalk from 'chalk'
2
- import ora from 'ora'
3
- import { BeamClient } from '@beam-protocol/sdk'
4
- import { BEAM_ID_PATTERN, loadConfig } from '../config.js'
5
-
6
- interface ReportOptions {
7
- reason?: string
8
- directory?: string
9
- json?: boolean
10
- }
11
-
12
- export async function cmdReport(targetBeamId: string, options: ReportOptions): Promise<void> {
13
- if (!BEAM_ID_PATTERN.test(targetBeamId)) {
14
- console.error(chalk.red(`✖ Invalid Beam ID: ${targetBeamId}`))
15
- process.exit(1)
16
- }
17
- if (!options.reason) {
18
- console.error(chalk.red('✖ Missing required --reason value'))
19
- process.exit(1)
20
- }
21
-
22
- const config = loadConfig()
23
- const directoryUrl = options.directory ?? config.directoryUrl
24
- const spinner = ora(`Submitting report for ${chalk.bold(targetBeamId)}...`).start()
25
-
26
- try {
27
- const client = new BeamClient({ identity: config.identity, directoryUrl })
28
- const report = await client.report(targetBeamId, options.reason)
29
- spinner.stop()
30
-
31
- if (options.json) {
32
- console.log(JSON.stringify(report, null, 2))
33
- return
34
- }
35
-
36
- console.log('')
37
- console.log(chalk.bold.yellow('⚠ Agent reported'))
38
- console.log(chalk.dim('─'.repeat(40)))
39
- console.log(`${chalk.cyan('Reporter:')} ${report.reporterBeamId}`)
40
- console.log(`${chalk.cyan('Target:')} ${report.targetBeamId}`)
41
- console.log(`${chalk.cyan('Reason:')} ${report.reason}`)
42
- if (report.status) console.log(`${chalk.cyan('Status:')} ${report.status}`)
43
- console.log('')
44
- } catch (err) {
45
- spinner.fail('Report failed')
46
- console.error(chalk.red(`✖ ${(err as Error).message}`))
47
- process.exit(1)
48
- }
49
- }