agentdex-cli 0.4.0 → 0.4.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.
- package/dist/cli.js +30 -12
- package/dist/nostr.d.ts +3 -5
- package/dist/nostr.js +7 -10
- package/package.json +1 -1
- package/src/cli.ts +29 -12
- package/src/nostr.ts +8 -12
package/dist/cli.js
CHANGED
|
@@ -66,7 +66,9 @@ program
|
|
|
66
66
|
.option('--avatar <url>', 'Avatar image URL (sets picture in kind 0 profile)')
|
|
67
67
|
.option('--lightning <addr>', 'Lightning address (sets lud16 in kind 0 profile)')
|
|
68
68
|
.option('--owner-x <handle>', 'Owner X/Twitter handle (e.g., @username)')
|
|
69
|
-
.option('--
|
|
69
|
+
.option('--owner <npub-or-hex>', 'Owner/operator Nostr pubkey (npub or hex) — sets kind 0 p tag for bidirectional verification')
|
|
70
|
+
.option('--owner-type <type>', 'Owner type: human, agent, org (sets owner_type tag on kind 31339)')
|
|
71
|
+
.option('--parent <npub-or-hex>', 'Parent/orchestrator agent pubkey (npub or hex)')
|
|
70
72
|
.option('--bot', 'Add ["bot"] tag to kind 0 profile (declares this pubkey as automated)')
|
|
71
73
|
.option('--portfolio <entry>', 'Portfolio URL (format: "url,name,description") — repeatable', (val, acc) => [...acc, val], [])
|
|
72
74
|
.option('--skill <skill>', 'Skill tag (repeatable)', (val, acc) => [...acc, val], [])
|
|
@@ -103,23 +105,40 @@ program
|
|
|
103
105
|
const parts = entry.split(',').map((s) => s.trim());
|
|
104
106
|
return { url: parts[0], name: parts[1], description: parts[2] };
|
|
105
107
|
});
|
|
106
|
-
// Resolve owner pubkey hex from --
|
|
107
|
-
let
|
|
108
|
+
// Resolve owner pubkey hex from --owner flag (npub or hex)
|
|
109
|
+
let ownerNpub = options.owner;
|
|
108
110
|
let ownerPubkeyHex;
|
|
109
|
-
if (
|
|
110
|
-
if (
|
|
111
|
+
if (ownerNpub) {
|
|
112
|
+
if (ownerNpub.startsWith('npub')) {
|
|
111
113
|
try {
|
|
112
|
-
const decoded = nip19.decode(
|
|
114
|
+
const decoded = nip19.decode(ownerNpub);
|
|
113
115
|
ownerPubkeyHex = decoded.data;
|
|
114
116
|
}
|
|
115
117
|
catch {
|
|
116
|
-
console.error(chalk.red('Invalid --
|
|
118
|
+
console.error(chalk.red('Invalid --owner npub'));
|
|
117
119
|
process.exit(1);
|
|
118
120
|
}
|
|
119
121
|
}
|
|
120
122
|
else {
|
|
121
|
-
ownerPubkeyHex =
|
|
122
|
-
|
|
123
|
+
ownerPubkeyHex = ownerNpub;
|
|
124
|
+
ownerNpub = nip19.npubEncode(ownerNpub);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
// Resolve parent pubkey hex from --parent flag
|
|
128
|
+
let parentHex;
|
|
129
|
+
if (options.parent) {
|
|
130
|
+
if (options.parent.startsWith('npub')) {
|
|
131
|
+
try {
|
|
132
|
+
const decoded = nip19.decode(options.parent);
|
|
133
|
+
parentHex = decoded.data;
|
|
134
|
+
}
|
|
135
|
+
catch {
|
|
136
|
+
console.error(chalk.red('Invalid --parent npub'));
|
|
137
|
+
process.exit(1);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
else {
|
|
141
|
+
parentHex = options.parent;
|
|
123
142
|
}
|
|
124
143
|
}
|
|
125
144
|
const event = createProfileEvent(sk, {
|
|
@@ -128,10 +147,9 @@ program
|
|
|
128
147
|
capabilities,
|
|
129
148
|
framework,
|
|
130
149
|
model: options.model,
|
|
131
|
-
|
|
132
|
-
lightning: options.lightning,
|
|
133
|
-
human: humanNpub,
|
|
150
|
+
ownerType: options.ownerType,
|
|
134
151
|
ownerX: options.ownerX,
|
|
152
|
+
parent: parentHex,
|
|
135
153
|
status: 'active',
|
|
136
154
|
portfolio: portfolio.length > 0 ? portfolio : undefined,
|
|
137
155
|
skills: options.skill?.length > 0 ? options.skill : undefined,
|
package/dist/nostr.d.ts
CHANGED
|
@@ -7,17 +7,15 @@ export interface PortfolioItem {
|
|
|
7
7
|
description?: string;
|
|
8
8
|
}
|
|
9
9
|
export interface AgentProfile {
|
|
10
|
-
name
|
|
10
|
+
name?: string;
|
|
11
11
|
description?: string;
|
|
12
12
|
capabilities?: string[];
|
|
13
13
|
framework?: string;
|
|
14
14
|
model?: string;
|
|
15
|
-
|
|
16
|
-
avatar?: string;
|
|
17
|
-
lightning?: string;
|
|
18
|
-
human?: string;
|
|
15
|
+
ownerType?: string;
|
|
19
16
|
ownerX?: string;
|
|
20
17
|
status?: string;
|
|
18
|
+
parent?: string;
|
|
21
19
|
messagingPolicy?: string;
|
|
22
20
|
messagingMinTrust?: number;
|
|
23
21
|
messagingFee?: number;
|
package/dist/nostr.js
CHANGED
|
@@ -61,8 +61,9 @@ export function createProfileEvent(sk, profile) {
|
|
|
61
61
|
const tags = [
|
|
62
62
|
['d', 'agentdex-profile'],
|
|
63
63
|
];
|
|
64
|
-
//
|
|
65
|
-
//
|
|
64
|
+
// Kind 31339 is agent-specific metadata ONLY
|
|
65
|
+
// Basic profile (name, avatar, website, nip05, lud16) lives exclusively in kind 0
|
|
66
|
+
// name is included for API registration (server needs it) but kind 0 is canonical
|
|
66
67
|
if (profile.name)
|
|
67
68
|
tags.push(['name', profile.name]);
|
|
68
69
|
if (profile.description)
|
|
@@ -76,16 +77,12 @@ export function createProfileEvent(sk, profile) {
|
|
|
76
77
|
tags.push(['framework', profile.framework]);
|
|
77
78
|
if (profile.model)
|
|
78
79
|
tags.push(['model', profile.model]);
|
|
79
|
-
if (profile.
|
|
80
|
-
tags.push(['
|
|
81
|
-
if (profile.avatar)
|
|
82
|
-
tags.push(['avatar', profile.avatar]);
|
|
83
|
-
// Lightning address belongs in kind 0 (lud16), not kind 31339
|
|
84
|
-
// Use --lightning flag to set lud16 in kind 0 during claim
|
|
85
|
-
if (profile.human)
|
|
86
|
-
tags.push(['human', profile.human]);
|
|
80
|
+
if (profile.ownerType)
|
|
81
|
+
tags.push(['owner_type', profile.ownerType]);
|
|
87
82
|
if (profile.ownerX)
|
|
88
83
|
tags.push(['owner_x', profile.ownerX]);
|
|
84
|
+
if (profile.parent)
|
|
85
|
+
tags.push(['parent', profile.parent]);
|
|
89
86
|
if (profile.status)
|
|
90
87
|
tags.push(['status', profile.status || 'active']);
|
|
91
88
|
if (profile.messagingPolicy)
|
package/package.json
CHANGED
package/src/cli.ts
CHANGED
|
@@ -74,7 +74,9 @@ program
|
|
|
74
74
|
.option('--avatar <url>', 'Avatar image URL (sets picture in kind 0 profile)')
|
|
75
75
|
.option('--lightning <addr>', 'Lightning address (sets lud16 in kind 0 profile)')
|
|
76
76
|
.option('--owner-x <handle>', 'Owner X/Twitter handle (e.g., @username)')
|
|
77
|
-
.option('--
|
|
77
|
+
.option('--owner <npub-or-hex>', 'Owner/operator Nostr pubkey (npub or hex) — sets kind 0 p tag for bidirectional verification')
|
|
78
|
+
.option('--owner-type <type>', 'Owner type: human, agent, org (sets owner_type tag on kind 31339)')
|
|
79
|
+
.option('--parent <npub-or-hex>', 'Parent/orchestrator agent pubkey (npub or hex)')
|
|
78
80
|
.option('--bot', 'Add ["bot"] tag to kind 0 profile (declares this pubkey as automated)')
|
|
79
81
|
.option('--portfolio <entry>', 'Portfolio URL (format: "url,name,description") — repeatable', (val: string, acc: string[]) => [...acc, val], [])
|
|
80
82
|
.option('--skill <skill>', 'Skill tag (repeatable)', (val: string, acc: string[]) => [...acc, val], [])
|
|
@@ -116,21 +118,37 @@ program
|
|
|
116
118
|
return { url: parts[0], name: parts[1], description: parts[2] };
|
|
117
119
|
});
|
|
118
120
|
|
|
119
|
-
// Resolve owner pubkey hex from --
|
|
120
|
-
let
|
|
121
|
+
// Resolve owner pubkey hex from --owner flag (npub or hex)
|
|
122
|
+
let ownerNpub = options.owner;
|
|
121
123
|
let ownerPubkeyHex: string | undefined;
|
|
122
|
-
if (
|
|
123
|
-
if (
|
|
124
|
+
if (ownerNpub) {
|
|
125
|
+
if (ownerNpub.startsWith('npub')) {
|
|
124
126
|
try {
|
|
125
|
-
const decoded = nip19.decode(
|
|
127
|
+
const decoded = nip19.decode(ownerNpub);
|
|
126
128
|
ownerPubkeyHex = decoded.data as unknown as string;
|
|
127
129
|
} catch {
|
|
128
|
-
console.error(chalk.red('Invalid --
|
|
130
|
+
console.error(chalk.red('Invalid --owner npub'));
|
|
129
131
|
process.exit(1);
|
|
130
132
|
}
|
|
131
133
|
} else {
|
|
132
|
-
ownerPubkeyHex =
|
|
133
|
-
|
|
134
|
+
ownerPubkeyHex = ownerNpub;
|
|
135
|
+
ownerNpub = nip19.npubEncode(ownerNpub);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
// Resolve parent pubkey hex from --parent flag
|
|
140
|
+
let parentHex: string | undefined;
|
|
141
|
+
if (options.parent) {
|
|
142
|
+
if (options.parent.startsWith('npub')) {
|
|
143
|
+
try {
|
|
144
|
+
const decoded = nip19.decode(options.parent);
|
|
145
|
+
parentHex = decoded.data as unknown as string;
|
|
146
|
+
} catch {
|
|
147
|
+
console.error(chalk.red('Invalid --parent npub'));
|
|
148
|
+
process.exit(1);
|
|
149
|
+
}
|
|
150
|
+
} else {
|
|
151
|
+
parentHex = options.parent;
|
|
134
152
|
}
|
|
135
153
|
}
|
|
136
154
|
|
|
@@ -140,10 +158,9 @@ program
|
|
|
140
158
|
capabilities,
|
|
141
159
|
framework,
|
|
142
160
|
model: options.model,
|
|
143
|
-
|
|
144
|
-
lightning: options.lightning,
|
|
145
|
-
human: humanNpub,
|
|
161
|
+
ownerType: options.ownerType,
|
|
146
162
|
ownerX: options.ownerX,
|
|
163
|
+
parent: parentHex,
|
|
147
164
|
status: 'active',
|
|
148
165
|
portfolio: portfolio.length > 0 ? portfolio : undefined,
|
|
149
166
|
skills: options.skill?.length > 0 ? options.skill : undefined,
|
package/src/nostr.ts
CHANGED
|
@@ -16,17 +16,15 @@ export interface PortfolioItem {
|
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
export interface AgentProfile {
|
|
19
|
-
name
|
|
19
|
+
name?: string;
|
|
20
20
|
description?: string;
|
|
21
21
|
capabilities?: string[];
|
|
22
22
|
framework?: string;
|
|
23
23
|
model?: string;
|
|
24
|
-
|
|
25
|
-
avatar?: string;
|
|
26
|
-
lightning?: string;
|
|
27
|
-
human?: string;
|
|
24
|
+
ownerType?: string;
|
|
28
25
|
ownerX?: string;
|
|
29
26
|
status?: string;
|
|
27
|
+
parent?: string;
|
|
30
28
|
messagingPolicy?: string;
|
|
31
29
|
messagingMinTrust?: number;
|
|
32
30
|
messagingFee?: number;
|
|
@@ -96,8 +94,9 @@ export function createProfileEvent(sk: Uint8Array, profile: AgentProfile) {
|
|
|
96
94
|
['d', 'agentdex-profile'],
|
|
97
95
|
];
|
|
98
96
|
|
|
99
|
-
//
|
|
100
|
-
//
|
|
97
|
+
// Kind 31339 is agent-specific metadata ONLY
|
|
98
|
+
// Basic profile (name, avatar, website, nip05, lud16) lives exclusively in kind 0
|
|
99
|
+
// name is included for API registration (server needs it) but kind 0 is canonical
|
|
101
100
|
if (profile.name) tags.push(['name', profile.name]);
|
|
102
101
|
if (profile.description) tags.push(['description', profile.description]);
|
|
103
102
|
if (profile.capabilities) {
|
|
@@ -107,12 +106,9 @@ export function createProfileEvent(sk: Uint8Array, profile: AgentProfile) {
|
|
|
107
106
|
}
|
|
108
107
|
if (profile.framework) tags.push(['framework', profile.framework]);
|
|
109
108
|
if (profile.model) tags.push(['model', profile.model]);
|
|
110
|
-
if (profile.
|
|
111
|
-
if (profile.avatar) tags.push(['avatar', profile.avatar]);
|
|
112
|
-
// Lightning address belongs in kind 0 (lud16), not kind 31339
|
|
113
|
-
// Use --lightning flag to set lud16 in kind 0 during claim
|
|
114
|
-
if (profile.human) tags.push(['human', profile.human]);
|
|
109
|
+
if (profile.ownerType) tags.push(['owner_type', profile.ownerType]);
|
|
115
110
|
if (profile.ownerX) tags.push(['owner_x', profile.ownerX]);
|
|
111
|
+
if (profile.parent) tags.push(['parent', profile.parent]);
|
|
116
112
|
if (profile.status) tags.push(['status', profile.status || 'active']);
|
|
117
113
|
if (profile.messagingPolicy) tags.push(['messaging_policy', profile.messagingPolicy]);
|
|
118
114
|
if (profile.messagingMinTrust) tags.push(['messaging_min_trust', String(profile.messagingMinTrust)]);
|