@openagentmarket/create-agent 1.1.0 → 1.3.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/dist/index.js +31 -6
- package/package.json +1 -1
- package/src/index.ts +34 -6
package/dist/index.js
CHANGED
|
@@ -29,14 +29,30 @@ async function main() {
|
|
|
29
29
|
}
|
|
30
30
|
// ── Hirer Flow (zero-config) ─────────────────────────────────────────────────
|
|
31
31
|
async function scaffoldHirer() {
|
|
32
|
-
const
|
|
33
|
-
|
|
32
|
+
const { folderName } = await prompts({
|
|
33
|
+
type: 'text',
|
|
34
|
+
name: 'folderName',
|
|
35
|
+
message: 'Folder name:',
|
|
36
|
+
initial: 'my-hirer'
|
|
37
|
+
});
|
|
38
|
+
if (!folderName) {
|
|
39
|
+
console.log(kleur.red('Cancelled.'));
|
|
40
|
+
process.exit(1);
|
|
41
|
+
}
|
|
42
|
+
const dirName = folderName.toLowerCase().replace(/[^a-z0-9-]/g, '-');
|
|
43
|
+
const targetDir = path.join(process.cwd(), dirName);
|
|
44
|
+
if (fs.existsSync(targetDir)) {
|
|
45
|
+
console.log(kleur.red(`Error: Directory ${dirName} already exists!`));
|
|
46
|
+
process.exit(1);
|
|
47
|
+
}
|
|
48
|
+
console.log(`\nCreating hirer project in ${kleur.green(targetDir)}...\n`);
|
|
49
|
+
fs.mkdirSync(targetDir, { recursive: true });
|
|
34
50
|
// Auto-generate wallet
|
|
35
51
|
const wallet = Wallet.createRandom();
|
|
36
52
|
const mnemonic = wallet.mnemonic.phrase;
|
|
37
53
|
// 1. package.json
|
|
38
54
|
const packageJson = {
|
|
39
|
-
name:
|
|
55
|
+
name: dirName,
|
|
40
56
|
version: "1.0.0",
|
|
41
57
|
description: "Hire agents on OpenAgent Market",
|
|
42
58
|
type: "module",
|
|
@@ -86,7 +102,15 @@ async function scaffoldHirer() {
|
|
|
86
102
|
` const rl = readline.createInterface({`,
|
|
87
103
|
` input: process.stdin,`,
|
|
88
104
|
` output: process.stdout,`,
|
|
89
|
-
` prompt: "
|
|
105
|
+
` prompt: "> "`,
|
|
106
|
+
` });`,
|
|
107
|
+
``,
|
|
108
|
+
` // ── Background message listener ──`,
|
|
109
|
+
` await client.streamAllMessages((sender, content, convId) => {`,
|
|
110
|
+
` if (!content || !content.trim()) return;`,
|
|
111
|
+
` process.stdout.write("\\r\\x1b[K");`,
|
|
112
|
+
` console.log("📨 [" + sender.slice(0, 10) + "...] " + content);`,
|
|
113
|
+
` rl.prompt(true);`,
|
|
90
114
|
` });`,
|
|
91
115
|
``,
|
|
92
116
|
` rl.prompt();`,
|
|
@@ -110,8 +134,8 @@ async function scaffoldHirer() {
|
|
|
110
134
|
` console.log("Usage: /chat <agent-address> <message>");`,
|
|
111
135
|
` } else {`,
|
|
112
136
|
` console.log("📤 Sending to " + address + "...");`,
|
|
113
|
-
`
|
|
114
|
-
` console.log("
|
|
137
|
+
` await client.sendMessage(address, message);`,
|
|
138
|
+
` console.log("✅ Sent! Replies will appear below.");`,
|
|
115
139
|
` }`,
|
|
116
140
|
` }`,
|
|
117
141
|
` else if (input.startsWith("/task ")) {`,
|
|
@@ -247,6 +271,7 @@ async function scaffoldHirer() {
|
|
|
247
271
|
console.log(` ${kleur.bold('Wallet address:')} ${kleur.cyan(wallet.address)}`);
|
|
248
272
|
console.log(` ${kleur.bold('Mnemonic:')} saved to ${kleur.yellow('.env')}\n`);
|
|
249
273
|
console.log(kleur.bold('Next steps:'));
|
|
274
|
+
console.log(` cd ${dirName}`);
|
|
250
275
|
console.log(' npm install');
|
|
251
276
|
console.log(' npm start');
|
|
252
277
|
console.log(' # Then type /discover to find agents\n');
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -34,9 +34,28 @@ async function main() {
|
|
|
34
34
|
// ── Hirer Flow (zero-config) ─────────────────────────────────────────────────
|
|
35
35
|
|
|
36
36
|
async function scaffoldHirer() {
|
|
37
|
-
const
|
|
37
|
+
const { folderName } = await prompts({
|
|
38
|
+
type: 'text',
|
|
39
|
+
name: 'folderName',
|
|
40
|
+
message: 'Folder name:',
|
|
41
|
+
initial: 'my-hirer'
|
|
42
|
+
});
|
|
38
43
|
|
|
39
|
-
|
|
44
|
+
if (!folderName) {
|
|
45
|
+
console.log(kleur.red('Cancelled.'));
|
|
46
|
+
process.exit(1);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const dirName = folderName.toLowerCase().replace(/[^a-z0-9-]/g, '-');
|
|
50
|
+
const targetDir = path.join(process.cwd(), dirName);
|
|
51
|
+
|
|
52
|
+
if (fs.existsSync(targetDir)) {
|
|
53
|
+
console.log(kleur.red(`Error: Directory ${dirName} already exists!`));
|
|
54
|
+
process.exit(1);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
console.log(`\nCreating hirer project in ${kleur.green(targetDir)}...\n`);
|
|
58
|
+
fs.mkdirSync(targetDir, { recursive: true });
|
|
40
59
|
|
|
41
60
|
// Auto-generate wallet
|
|
42
61
|
const wallet = Wallet.createRandom();
|
|
@@ -44,7 +63,7 @@ async function scaffoldHirer() {
|
|
|
44
63
|
|
|
45
64
|
// 1. package.json
|
|
46
65
|
const packageJson = {
|
|
47
|
-
name:
|
|
66
|
+
name: dirName,
|
|
48
67
|
version: "1.0.0",
|
|
49
68
|
description: "Hire agents on OpenAgent Market",
|
|
50
69
|
type: "module",
|
|
@@ -98,7 +117,15 @@ async function scaffoldHirer() {
|
|
|
98
117
|
` const rl = readline.createInterface({`,
|
|
99
118
|
` input: process.stdin,`,
|
|
100
119
|
` output: process.stdout,`,
|
|
101
|
-
` prompt: "
|
|
120
|
+
` prompt: "> "`,
|
|
121
|
+
` });`,
|
|
122
|
+
``,
|
|
123
|
+
` // ── Background message listener ──`,
|
|
124
|
+
` await client.streamAllMessages((sender, content, convId) => {`,
|
|
125
|
+
` if (!content || !content.trim()) return;`,
|
|
126
|
+
` process.stdout.write("\\r\\x1b[K");`,
|
|
127
|
+
` console.log("📨 [" + sender.slice(0, 10) + "...] " + content);`,
|
|
128
|
+
` rl.prompt(true);`,
|
|
102
129
|
` });`,
|
|
103
130
|
``,
|
|
104
131
|
` rl.prompt();`,
|
|
@@ -122,8 +149,8 @@ async function scaffoldHirer() {
|
|
|
122
149
|
` console.log("Usage: /chat <agent-address> <message>");`,
|
|
123
150
|
` } else {`,
|
|
124
151
|
` console.log("📤 Sending to " + address + "...");`,
|
|
125
|
-
`
|
|
126
|
-
` console.log("
|
|
152
|
+
` await client.sendMessage(address, message);`,
|
|
153
|
+
` console.log("✅ Sent! Replies will appear below.");`,
|
|
127
154
|
` }`,
|
|
128
155
|
` }`,
|
|
129
156
|
` else if (input.startsWith("/task ")) {`,
|
|
@@ -261,6 +288,7 @@ async function scaffoldHirer() {
|
|
|
261
288
|
console.log(` ${kleur.bold('Wallet address:')} ${kleur.cyan(wallet.address)}`);
|
|
262
289
|
console.log(` ${kleur.bold('Mnemonic:')} saved to ${kleur.yellow('.env')}\n`);
|
|
263
290
|
console.log(kleur.bold('Next steps:'));
|
|
291
|
+
console.log(` cd ${dirName}`);
|
|
264
292
|
console.log(' npm install');
|
|
265
293
|
console.log(' npm start');
|
|
266
294
|
console.log(' # Then type /discover to find agents\n');
|