agentbnb 3.1.4 → 3.1.5
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/index.js +6 -6
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -2941,15 +2941,17 @@ program.command("init").description("Initialize AgentBnB config and create agent
|
|
|
2941
2941
|
const port = parseInt(opts.port, 10);
|
|
2942
2942
|
const ip = opts.host ?? getLanIp();
|
|
2943
2943
|
const existingConfig = loadConfig();
|
|
2944
|
-
const api_key = existingConfig?.api_key ?? randomBytes(32).toString("hex");
|
|
2945
2944
|
const config = {
|
|
2945
|
+
...existingConfig,
|
|
2946
|
+
// Preserve all existing keys (registry, autonomy, budget, etc.)
|
|
2946
2947
|
owner,
|
|
2947
2948
|
gateway_url: `http://${ip}:${port}`,
|
|
2948
2949
|
gateway_port: port,
|
|
2949
2950
|
db_path: dbPath,
|
|
2950
2951
|
credit_db_path: creditDbPath,
|
|
2951
|
-
token,
|
|
2952
|
-
|
|
2952
|
+
token: existingConfig?.token ?? token,
|
|
2953
|
+
// Preserve existing token
|
|
2954
|
+
api_key: existingConfig?.api_key ?? randomBytes(32).toString("hex")
|
|
2953
2955
|
};
|
|
2954
2956
|
saveConfig(config);
|
|
2955
2957
|
let keypairStatus = "existing";
|
|
@@ -3456,7 +3458,7 @@ program.command("request [card-id]").description("Request a capability from anot
|
|
|
3456
3458
|
let gatewayUrl;
|
|
3457
3459
|
let token;
|
|
3458
3460
|
let isRemoteRequest = false;
|
|
3459
|
-
|
|
3461
|
+
const identityAuth = loadIdentityAuth(config.owner);
|
|
3460
3462
|
if (opts.peer) {
|
|
3461
3463
|
const peer = findPeer(opts.peer);
|
|
3462
3464
|
if (!peer) {
|
|
@@ -3466,7 +3468,6 @@ program.command("request [card-id]").description("Request a capability from anot
|
|
|
3466
3468
|
gatewayUrl = peer.url;
|
|
3467
3469
|
token = peer.token;
|
|
3468
3470
|
isRemoteRequest = true;
|
|
3469
|
-
identityAuth = loadIdentityAuth(config.owner);
|
|
3470
3471
|
} else {
|
|
3471
3472
|
const db = openDatabase(config.db_path);
|
|
3472
3473
|
let localCard;
|
|
@@ -3505,7 +3506,6 @@ program.command("request [card-id]").description("Request a capability from anot
|
|
|
3505
3506
|
gatewayUrl = remoteCard.gateway_url;
|
|
3506
3507
|
token = "";
|
|
3507
3508
|
isRemoteRequest = true;
|
|
3508
|
-
identityAuth = loadIdentityAuth(config.owner);
|
|
3509
3509
|
if (!opts.json) {
|
|
3510
3510
|
const displayName = remoteCard.name ?? remoteCard.agent_name ?? cardId;
|
|
3511
3511
|
console.log(`Found remote card: ${displayName} @ ${gatewayUrl}`);
|