vibeiao 0.1.3 → 0.1.4
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 +1 -1
- package/package.json +1 -1
- package/src/index.js +39 -7
package/README.md
CHANGED
|
@@ -13,7 +13,7 @@ npx vibeiao@latest list --type agent --limit 10
|
|
|
13
13
|
Defaults used by the one-liners:
|
|
14
14
|
|
|
15
15
|
- `human`: reads `agent.json` if present, writes `handoff.json`
|
|
16
|
-
- `agent`: prefers `handoff.json`, then `agent.json
|
|
16
|
+
- `agent`: prefers `handoff.json`, then `agent.json`; uses `~/.config/solana/id.json` if present, otherwise auto-generates it on first run
|
|
17
17
|
|
|
18
18
|
## Memory Layout (Required)
|
|
19
19
|
|
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -356,6 +356,40 @@ const loadKeypair = (inputValue) => {
|
|
|
356
356
|
return Keypair.fromSecretKey(bs58.decode(trimmed));
|
|
357
357
|
};
|
|
358
358
|
|
|
359
|
+
const writeKeypairFile = (keypair, filePath) => {
|
|
360
|
+
const expanded = expandTildePath(filePath);
|
|
361
|
+
const resolved = path.resolve(expanded);
|
|
362
|
+
const parent = path.dirname(resolved);
|
|
363
|
+
fs.mkdirSync(parent, { recursive: true });
|
|
364
|
+
try {
|
|
365
|
+
fs.chmodSync(parent, 0o700);
|
|
366
|
+
} catch {
|
|
367
|
+
// Best-effort hardening for environments that allow permission changes.
|
|
368
|
+
}
|
|
369
|
+
const payload = JSON.stringify(Array.from(keypair.secretKey));
|
|
370
|
+
fs.writeFileSync(resolved, `${payload}\n`, { mode: 0o600 });
|
|
371
|
+
try {
|
|
372
|
+
fs.chmodSync(resolved, 0o600);
|
|
373
|
+
} catch {
|
|
374
|
+
// Ignore on filesystems that do not support POSIX mode bits.
|
|
375
|
+
}
|
|
376
|
+
return resolved;
|
|
377
|
+
};
|
|
378
|
+
|
|
379
|
+
const resolveAgentKeypair = (flags) => {
|
|
380
|
+
const explicitInput = flags.keypair || process.env.VIBEIAO_KEYPAIR || null;
|
|
381
|
+
if (explicitInput) {
|
|
382
|
+
return { keypair: loadKeypair(explicitInput), generated: false, path: null };
|
|
383
|
+
}
|
|
384
|
+
const defaultKeypairPath = findExistingFile(DEFAULT_KEYPAIR_PATH);
|
|
385
|
+
if (defaultKeypairPath) {
|
|
386
|
+
return { keypair: loadKeypair(defaultKeypairPath), generated: false, path: defaultKeypairPath };
|
|
387
|
+
}
|
|
388
|
+
const generated = Keypair.generate();
|
|
389
|
+
const outputPath = writeKeypairFile(generated, DEFAULT_KEYPAIR_PATH);
|
|
390
|
+
return { keypair: generated, generated: true, path: outputPath };
|
|
391
|
+
};
|
|
392
|
+
|
|
359
393
|
const parseMembers = (flags) => {
|
|
360
394
|
if (flags['members-file']) {
|
|
361
395
|
const entries = readJson(path.resolve(flags['members-file']));
|
|
@@ -984,13 +1018,10 @@ const handleAgent = async (flags) => {
|
|
|
984
1018
|
const listing = handoff?.listing
|
|
985
1019
|
? normalizeListing(handoff.listing)
|
|
986
1020
|
: await resolveListing(listingFlags, { interactive: false });
|
|
987
|
-
const
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
throw new Error(
|
|
992
|
-
`missing_keypair (tried --keypair, VIBEIAO_KEYPAIR, and default ${DEFAULT_KEYPAIR_PATH})`
|
|
993
|
-
);
|
|
1021
|
+
const { keypair, generated: keypairGenerated, path: keypairPath } = resolveAgentKeypair(flags);
|
|
1022
|
+
if (keypairGenerated && keypairPath) {
|
|
1023
|
+
console.log(`🔐 No keypair found. Generated agent keypair at ${keypairPath}`);
|
|
1024
|
+
console.log(' Keep this file safe. It controls your on-chain agent wallet.');
|
|
994
1025
|
}
|
|
995
1026
|
const quotedListing = await applyPriceQuote(listing, flags);
|
|
996
1027
|
validateListing(quotedListing);
|
|
@@ -1485,6 +1516,7 @@ const main = async () => {
|
|
|
1485
1516
|
Examples:
|
|
1486
1517
|
vibeiao human
|
|
1487
1518
|
vibeiao agent
|
|
1519
|
+
vibeiao agent # auto-creates ~/.config/solana/id.json if missing
|
|
1488
1520
|
vibeiao human --owner-keypair ~/.config/solana/id.json --output handoff.json --memory-root memory
|
|
1489
1521
|
vibeiao agent --keypair ~/.config/solana/id.json --handoff handoff.json --memory-root memory
|
|
1490
1522
|
vibeiao list --type agent --limit 10
|