naracli 1.0.30 → 1.0.32
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 +10 -2
- package/dist/nara-cli-bundle.cjs +349 -134
- package/package.json +2 -2
- package/src/cli/commands/agent.ts +1 -1
- package/src/cli/commands/config.ts +118 -0
- package/src/cli/commands/quest.ts +3 -3
- package/src/cli/commands/zkid.ts +2 -2
- package/src/cli/index.ts +4 -0
- package/src/cli/utils/agent-config.ts +17 -15
- package/src/cli/utils/wallet.ts +20 -19
- package/src/tests/helpers.ts +3 -1
- package/src/tests/quest.test.ts +22 -6
package/dist/nara-cli-bundle.cjs
CHANGED
|
@@ -974,7 +974,7 @@ var require_command = __commonJS({
|
|
|
974
974
|
var { Help: Help2 } = require_help();
|
|
975
975
|
var { Option: Option2, DualOptions } = require_option();
|
|
976
976
|
var { suggestSimilar } = require_suggestSimilar();
|
|
977
|
-
var
|
|
977
|
+
var Command9 = class _Command extends EventEmitter {
|
|
978
978
|
/**
|
|
979
979
|
* Initialize a new `Command`.
|
|
980
980
|
*
|
|
@@ -3000,7 +3000,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
3000
3000
|
return arg;
|
|
3001
3001
|
});
|
|
3002
3002
|
}
|
|
3003
|
-
exports2.Command =
|
|
3003
|
+
exports2.Command = Command9;
|
|
3004
3004
|
}
|
|
3005
3005
|
});
|
|
3006
3006
|
|
|
@@ -3008,15 +3008,15 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
3008
3008
|
var require_commander = __commonJS({
|
|
3009
3009
|
"node_modules/commander/index.js"(exports2) {
|
|
3010
3010
|
var { Argument: Argument2 } = require_argument();
|
|
3011
|
-
var { Command:
|
|
3011
|
+
var { Command: Command9 } = require_command();
|
|
3012
3012
|
var { CommanderError: CommanderError2, InvalidArgumentError: InvalidArgumentError2 } = require_error();
|
|
3013
3013
|
var { Help: Help2 } = require_help();
|
|
3014
3014
|
var { Option: Option2 } = require_option();
|
|
3015
|
-
exports2.program = new
|
|
3016
|
-
exports2.createCommand = (name) => new
|
|
3015
|
+
exports2.program = new Command9();
|
|
3016
|
+
exports2.createCommand = (name) => new Command9(name);
|
|
3017
3017
|
exports2.createOption = (flags, description) => new Option2(flags, description);
|
|
3018
3018
|
exports2.createArgument = (name, description) => new Argument2(name, description);
|
|
3019
|
-
exports2.Command =
|
|
3019
|
+
exports2.Command = Command9;
|
|
3020
3020
|
exports2.Option = Option2;
|
|
3021
3021
|
exports2.Argument = Argument2;
|
|
3022
3022
|
exports2.Help = Help2;
|
|
@@ -33793,7 +33793,7 @@ var require_bindings = __commonJS({
|
|
|
33793
33793
|
var path = require("path");
|
|
33794
33794
|
var fileURLToPath3 = require_file_uri_to_path();
|
|
33795
33795
|
var join7 = path.join;
|
|
33796
|
-
var
|
|
33796
|
+
var dirname5 = path.dirname;
|
|
33797
33797
|
var exists = fs.accessSync && function(path2) {
|
|
33798
33798
|
try {
|
|
33799
33799
|
fs.accessSync(path2);
|
|
@@ -33908,7 +33908,7 @@ var require_bindings = __commonJS({
|
|
|
33908
33908
|
return fileName;
|
|
33909
33909
|
};
|
|
33910
33910
|
exports2.getRoot = function getRoot(file) {
|
|
33911
|
-
var dir =
|
|
33911
|
+
var dir = dirname5(file), prev;
|
|
33912
33912
|
while (true) {
|
|
33913
33913
|
if (dir === ".") {
|
|
33914
33914
|
dir = process.cwd();
|
|
@@ -74079,6 +74079,24 @@ var init_nara_agent_registry = __esm({
|
|
|
74079
74079
|
]
|
|
74080
74080
|
}
|
|
74081
74081
|
},
|
|
74082
|
+
{
|
|
74083
|
+
name: "config",
|
|
74084
|
+
pda: {
|
|
74085
|
+
seeds: [
|
|
74086
|
+
{
|
|
74087
|
+
kind: "const",
|
|
74088
|
+
value: [
|
|
74089
|
+
99,
|
|
74090
|
+
111,
|
|
74091
|
+
110,
|
|
74092
|
+
102,
|
|
74093
|
+
105,
|
|
74094
|
+
103
|
|
74095
|
+
]
|
|
74096
|
+
}
|
|
74097
|
+
]
|
|
74098
|
+
}
|
|
74099
|
+
},
|
|
74082
74100
|
{
|
|
74083
74101
|
name: "referral_agent",
|
|
74084
74102
|
docs: [
|
|
@@ -74490,6 +74508,57 @@ var init_nara_agent_registry = __esm({
|
|
|
74490
74508
|
}
|
|
74491
74509
|
]
|
|
74492
74510
|
},
|
|
74511
|
+
{
|
|
74512
|
+
name: "update_points_config",
|
|
74513
|
+
discriminator: [
|
|
74514
|
+
15,
|
|
74515
|
+
89,
|
|
74516
|
+
27,
|
|
74517
|
+
201,
|
|
74518
|
+
127,
|
|
74519
|
+
239,
|
|
74520
|
+
187,
|
|
74521
|
+
80
|
|
74522
|
+
],
|
|
74523
|
+
accounts: [
|
|
74524
|
+
{
|
|
74525
|
+
name: "admin",
|
|
74526
|
+
signer: true,
|
|
74527
|
+
relations: [
|
|
74528
|
+
"config"
|
|
74529
|
+
]
|
|
74530
|
+
},
|
|
74531
|
+
{
|
|
74532
|
+
name: "config",
|
|
74533
|
+
writable: true,
|
|
74534
|
+
pda: {
|
|
74535
|
+
seeds: [
|
|
74536
|
+
{
|
|
74537
|
+
kind: "const",
|
|
74538
|
+
value: [
|
|
74539
|
+
99,
|
|
74540
|
+
111,
|
|
74541
|
+
110,
|
|
74542
|
+
102,
|
|
74543
|
+
105,
|
|
74544
|
+
103
|
|
74545
|
+
]
|
|
74546
|
+
}
|
|
74547
|
+
]
|
|
74548
|
+
}
|
|
74549
|
+
}
|
|
74550
|
+
],
|
|
74551
|
+
args: [
|
|
74552
|
+
{
|
|
74553
|
+
name: "points_self",
|
|
74554
|
+
type: "u64"
|
|
74555
|
+
},
|
|
74556
|
+
{
|
|
74557
|
+
name: "points_referral",
|
|
74558
|
+
type: "u64"
|
|
74559
|
+
}
|
|
74560
|
+
]
|
|
74561
|
+
},
|
|
74493
74562
|
{
|
|
74494
74563
|
name: "update_register_fee",
|
|
74495
74564
|
discriminator: [
|
|
@@ -74743,11 +74812,16 @@ var init_nara_agent_registry = __esm({
|
|
|
74743
74812
|
},
|
|
74744
74813
|
{
|
|
74745
74814
|
code: 6017,
|
|
74815
|
+
name: "AgentIdNotLowercase",
|
|
74816
|
+
msg: "Agent ID must be lowercase"
|
|
74817
|
+
},
|
|
74818
|
+
{
|
|
74819
|
+
code: 6018,
|
|
74746
74820
|
name: "QuestIxNotFound",
|
|
74747
74821
|
msg: "No valid submit_answer instruction found in transaction"
|
|
74748
74822
|
},
|
|
74749
74823
|
{
|
|
74750
|
-
code:
|
|
74824
|
+
code: 6019,
|
|
74751
74825
|
name: "ReferralNotFound",
|
|
74752
74826
|
msg: "Referral agent not found"
|
|
74753
74827
|
}
|
|
@@ -74928,6 +75002,14 @@ var init_nara_agent_registry = __esm({
|
|
|
74928
75002
|
name: "register_fee",
|
|
74929
75003
|
type: "u64"
|
|
74930
75004
|
},
|
|
75005
|
+
{
|
|
75006
|
+
name: "points_self",
|
|
75007
|
+
type: "u64"
|
|
75008
|
+
},
|
|
75009
|
+
{
|
|
75010
|
+
name: "points_referral",
|
|
75011
|
+
type: "u64"
|
|
75012
|
+
},
|
|
74931
75013
|
{
|
|
74932
75014
|
name: "_reserved",
|
|
74933
75015
|
type: {
|
|
@@ -74963,6 +75045,7 @@ __export(agent_registry_exports, {
|
|
|
74963
75045
|
transferAgentAuthority: () => transferAgentAuthority,
|
|
74964
75046
|
updateAdmin: () => updateAdmin,
|
|
74965
75047
|
updateFeeRecipient: () => updateFeeRecipient,
|
|
75048
|
+
updatePointsConfig: () => updatePointsConfig,
|
|
74966
75049
|
updateRegisterFee: () => updateRegisterFee,
|
|
74967
75050
|
uploadMemory: () => uploadMemory
|
|
74968
75051
|
});
|
|
@@ -75099,28 +75182,38 @@ async function getAgentInfo(connection, agentId, options) {
|
|
|
75099
75182
|
return { record, bio, metadata };
|
|
75100
75183
|
}
|
|
75101
75184
|
async function getAgentMemory(connection, agentId, options) {
|
|
75102
|
-
const
|
|
75103
|
-
|
|
75104
|
-
const raw = await program3.account.agentRecord.fetch(agentPda);
|
|
75105
|
-
const memoryPubkey = raw.memory;
|
|
75106
|
-
if (memoryPubkey.equals(import_web37.PublicKey.default)) {
|
|
75185
|
+
const record = await getAgentRecord(connection, agentId, options);
|
|
75186
|
+
if (record.memory.equals(import_web37.PublicKey.default)) {
|
|
75107
75187
|
return null;
|
|
75108
75188
|
}
|
|
75109
|
-
const accountInfo = await connection.getAccountInfo(
|
|
75189
|
+
const accountInfo = await connection.getAccountInfo(record.memory);
|
|
75110
75190
|
if (!accountInfo) return null;
|
|
75111
75191
|
return Buffer.from(accountInfo.data.slice(MEMORY_HEADER_SIZE));
|
|
75112
75192
|
}
|
|
75113
75193
|
async function getConfig(connection, options) {
|
|
75114
|
-
const
|
|
75115
|
-
const configPda = getConfigPda(
|
|
75116
|
-
const
|
|
75117
|
-
|
|
75118
|
-
|
|
75119
|
-
|
|
75120
|
-
|
|
75121
|
-
|
|
75194
|
+
const pid = new import_web37.PublicKey(options?.programId ?? DEFAULT_AGENT_REGISTRY_PROGRAM_ID);
|
|
75195
|
+
const configPda = getConfigPda(pid);
|
|
75196
|
+
const accountInfo = await connection.getAccountInfo(configPda);
|
|
75197
|
+
if (!accountInfo) {
|
|
75198
|
+
throw new Error("Program config not initialized");
|
|
75199
|
+
}
|
|
75200
|
+
const buf = Buffer.from(accountInfo.data);
|
|
75201
|
+
let offset = 8;
|
|
75202
|
+
const admin = new import_web37.PublicKey(buf.subarray(offset, offset + 32));
|
|
75203
|
+
offset += 32;
|
|
75204
|
+
const feeRecipient = new import_web37.PublicKey(buf.subarray(offset, offset + 32));
|
|
75205
|
+
offset += 32;
|
|
75206
|
+
const registerFee = Number(buf.readBigUInt64LE(offset));
|
|
75207
|
+
offset += 8;
|
|
75208
|
+
const pointsSelf = Number(buf.readBigUInt64LE(offset));
|
|
75209
|
+
offset += 8;
|
|
75210
|
+
const pointsReferral = Number(buf.readBigUInt64LE(offset));
|
|
75211
|
+
return { admin, registerFee, feeRecipient, pointsSelf, pointsReferral };
|
|
75122
75212
|
}
|
|
75123
75213
|
async function registerAgent(connection, wallet, agentId, options) {
|
|
75214
|
+
if (/[A-Z]/.test(agentId)) {
|
|
75215
|
+
throw new Error(`Agent ID must not contain uppercase letters: "${agentId}"`);
|
|
75216
|
+
}
|
|
75124
75217
|
const program3 = createProgram(connection, wallet, options?.programId);
|
|
75125
75218
|
const configPda = getConfigPda(program3.programId);
|
|
75126
75219
|
const config = await program3.account.programConfig.fetch(configPda);
|
|
@@ -75137,10 +75230,8 @@ async function transferAgentAuthority(connection, wallet, agentId, newAuthority,
|
|
|
75137
75230
|
}
|
|
75138
75231
|
async function deleteAgent(connection, wallet, agentId, options) {
|
|
75139
75232
|
const program3 = createProgram(connection, wallet, options?.programId);
|
|
75140
|
-
const
|
|
75141
|
-
const
|
|
75142
|
-
const memoryPubkey = raw.memory;
|
|
75143
|
-
const memoryAccount = memoryPubkey.equals(import_web37.PublicKey.default) ? wallet.publicKey : memoryPubkey;
|
|
75233
|
+
const record = await getAgentRecord(connection, agentId, options);
|
|
75234
|
+
const memoryAccount = record.memory.equals(import_web37.PublicKey.default) ? wallet.publicKey : record.memory;
|
|
75144
75235
|
return program3.methods.deleteAgent(agentId).accounts({
|
|
75145
75236
|
authority: wallet.publicKey,
|
|
75146
75237
|
memoryAccount
|
|
@@ -75158,9 +75249,8 @@ async function uploadMemory(connection, wallet, agentId, data, options, mode = "
|
|
|
75158
75249
|
const program3 = createProgram(connection, wallet, options?.programId);
|
|
75159
75250
|
const chunkSize = options?.chunkSize ?? DEFAULT_CHUNK_SIZE;
|
|
75160
75251
|
const totalLen = data.length;
|
|
75161
|
-
const
|
|
75162
|
-
const
|
|
75163
|
-
const existingMemory = raw.memory;
|
|
75252
|
+
const record = await getAgentRecord(connection, agentId, options);
|
|
75253
|
+
const existingMemory = record.memory;
|
|
75164
75254
|
const hasMemory = !existingMemory.equals(import_web37.PublicKey.default);
|
|
75165
75255
|
let resolvedMode;
|
|
75166
75256
|
if (mode === "auto") {
|
|
@@ -75235,13 +75325,11 @@ async function uploadMemory(connection, wallet, agentId, data, options, mode = "
|
|
|
75235
75325
|
}
|
|
75236
75326
|
async function closeBuffer(connection, wallet, agentId, options) {
|
|
75237
75327
|
const program3 = createProgram(connection, wallet, options?.programId);
|
|
75238
|
-
const
|
|
75239
|
-
|
|
75240
|
-
const bufferPubkey = raw.pendingBuffer;
|
|
75241
|
-
if (bufferPubkey.equals(import_web37.PublicKey.default)) {
|
|
75328
|
+
const record = await getAgentRecord(connection, agentId, options);
|
|
75329
|
+
if (!record.pendingBuffer) {
|
|
75242
75330
|
throw new Error(`Agent "${agentId}" has no pending buffer`);
|
|
75243
75331
|
}
|
|
75244
|
-
return program3.methods.closeBuffer(agentId).accounts({ authority: wallet.publicKey, buffer:
|
|
75332
|
+
return program3.methods.closeBuffer(agentId).accounts({ authority: wallet.publicKey, buffer: record.pendingBuffer }).signers([wallet]).rpc();
|
|
75245
75333
|
}
|
|
75246
75334
|
async function logActivity(connection, wallet, agentId, model, activity, log, options, referralAgentId) {
|
|
75247
75335
|
const program3 = createProgram(connection, wallet, options?.programId);
|
|
@@ -75276,6 +75364,12 @@ async function updateRegisterFee(connection, wallet, newFee, options) {
|
|
|
75276
75364
|
const fee = typeof newFee === "number" ? new anchor.BN(newFee) : newFee;
|
|
75277
75365
|
return program3.methods.updateRegisterFee(fee).accounts({ admin: wallet.publicKey }).signers([wallet]).rpc();
|
|
75278
75366
|
}
|
|
75367
|
+
async function updatePointsConfig(connection, wallet, pointsSelf, pointsReferral, options) {
|
|
75368
|
+
const program3 = createProgram(connection, wallet, options?.programId);
|
|
75369
|
+
const ps = typeof pointsSelf === "number" ? new anchor.BN(pointsSelf) : pointsSelf;
|
|
75370
|
+
const pr = typeof pointsReferral === "number" ? new anchor.BN(pointsReferral) : pointsReferral;
|
|
75371
|
+
return program3.methods.updatePointsConfig(ps, pr).accounts({ admin: wallet.publicKey }).signers([wallet]).rpc();
|
|
75372
|
+
}
|
|
75279
75373
|
var import_web37, anchor, import_anchor, DEFAULT_CHUNK_SIZE, BUFFER_HEADER_SIZE, MEMORY_HEADER_SIZE, BIO_META_HEADER_SIZE;
|
|
75280
75374
|
var init_agent_registry = __esm({
|
|
75281
75375
|
"node_modules/nara-sdk/src/agent_registry.ts"() {
|
|
@@ -90770,8 +90864,8 @@ function createTransferInstruction(source, destination, owner, amount, multiSign
|
|
|
90770
90864
|
// src/cli/commands/wallet.ts
|
|
90771
90865
|
var bip39 = __toESM(require_src3(), 1);
|
|
90772
90866
|
var import_ed25519_hd_key = __toESM(require_dist3(), 1);
|
|
90773
|
-
var
|
|
90774
|
-
var
|
|
90867
|
+
var import_node_path3 = require("node:path");
|
|
90868
|
+
var import_node_os3 = require("node:os");
|
|
90775
90869
|
var import_promises = require("node:fs/promises");
|
|
90776
90870
|
|
|
90777
90871
|
// node_modules/base-x/src/esm/index.js
|
|
@@ -93284,6 +93378,9 @@ function mapSkillRecord(raw) {
|
|
|
93284
93378
|
};
|
|
93285
93379
|
}
|
|
93286
93380
|
async function registerSkill(connection, wallet, name, author, options) {
|
|
93381
|
+
if (/[A-Z]/.test(name)) {
|
|
93382
|
+
throw new Error(`Skill name must not contain uppercase letters: "${name}"`);
|
|
93383
|
+
}
|
|
93287
93384
|
const program3 = createProgram3(connection, wallet, options?.programId);
|
|
93288
93385
|
const configPda = getConfigPda2(program3.programId);
|
|
93289
93386
|
const config = await program3.account.programConfig.fetch(configPda);
|
|
@@ -124841,6 +124938,25 @@ async function transferZkIdByCommitment(connection, payer, name, currentIdSecret
|
|
|
124841
124938
|
packedProof
|
|
124842
124939
|
).accounts({ payer: payer.publicKey }).rpc();
|
|
124843
124940
|
}
|
|
124941
|
+
async function getConfig2(connection, options) {
|
|
124942
|
+
const programId = new import_web310.PublicKey(options?.programId ?? DEFAULT_ZKID_PROGRAM_ID);
|
|
124943
|
+
const [configPda] = import_web310.PublicKey.findProgramAddressSync(
|
|
124944
|
+
[Buffer.from("config")],
|
|
124945
|
+
programId
|
|
124946
|
+
);
|
|
124947
|
+
const accountInfo = await connection.getAccountInfo(configPda);
|
|
124948
|
+
if (!accountInfo) {
|
|
124949
|
+
throw new Error("ZK ID config account not found");
|
|
124950
|
+
}
|
|
124951
|
+
const buf = Buffer.from(accountInfo.data);
|
|
124952
|
+
let offset = 8;
|
|
124953
|
+
const admin = new import_web310.PublicKey(buf.subarray(offset, offset + 32));
|
|
124954
|
+
offset += 32;
|
|
124955
|
+
const feeRecipient = new import_web310.PublicKey(buf.subarray(offset, offset + 32));
|
|
124956
|
+
offset += 32;
|
|
124957
|
+
const feeAmount = Number(buf.readBigUInt64LE(offset));
|
|
124958
|
+
return { admin, feeRecipient, feeAmount };
|
|
124959
|
+
}
|
|
124844
124960
|
async function initializeConfig(connection, wallet, feeRecipient, feeAmount, options) {
|
|
124845
124961
|
const program3 = createProgram4(connection, wallet, options?.programId);
|
|
124846
124962
|
const fee = typeof feeAmount === "number" ? new import_bn.default(feeAmount) : feeAmount;
|
|
@@ -124859,12 +124975,57 @@ var import_bn2 = __toESM(require_bn(), 1);
|
|
|
124859
124975
|
|
|
124860
124976
|
// src/cli/utils/wallet.ts
|
|
124861
124977
|
var import_web312 = __toESM(require_index_cjs(), 1);
|
|
124978
|
+
var import_node_path2 = require("node:path");
|
|
124979
|
+
var import_node_os2 = require("node:os");
|
|
124980
|
+
|
|
124981
|
+
// src/cli/utils/agent-config.ts
|
|
124862
124982
|
var import_node_path = require("node:path");
|
|
124863
124983
|
var import_node_os = require("node:os");
|
|
124864
|
-
var
|
|
124865
|
-
var
|
|
124984
|
+
var import_node_fs = require("node:fs");
|
|
124985
|
+
var AGENT_CONFIG_PATH = (0, import_node_path.join)((0, import_node_os.homedir)(), ".config", "nara", "agent.json");
|
|
124986
|
+
var DEFAULT_CONFIG = { agent_ids: [], zk_ids: [] };
|
|
124987
|
+
function loadAgentConfig() {
|
|
124988
|
+
try {
|
|
124989
|
+
const raw = (0, import_node_fs.readFileSync)(AGENT_CONFIG_PATH, "utf-8");
|
|
124990
|
+
const parsed = JSON.parse(raw);
|
|
124991
|
+
return {
|
|
124992
|
+
agent_ids: Array.isArray(parsed.agent_ids) ? parsed.agent_ids : [],
|
|
124993
|
+
zk_ids: Array.isArray(parsed.zk_ids) ? parsed.zk_ids : [],
|
|
124994
|
+
rpc_url: parsed.rpc_url ?? void 0,
|
|
124995
|
+
wallet: parsed.wallet ?? void 0
|
|
124996
|
+
};
|
|
124997
|
+
} catch {
|
|
124998
|
+
return { ...DEFAULT_CONFIG };
|
|
124999
|
+
}
|
|
125000
|
+
}
|
|
125001
|
+
function saveAgentConfig(config) {
|
|
125002
|
+
(0, import_node_fs.mkdirSync)((0, import_node_path.dirname)(AGENT_CONFIG_PATH), { recursive: true });
|
|
125003
|
+
(0, import_node_fs.writeFileSync)(AGENT_CONFIG_PATH, JSON.stringify(config, null, 2) + "\n");
|
|
125004
|
+
}
|
|
125005
|
+
function addAgentId(id) {
|
|
125006
|
+
const config = loadAgentConfig();
|
|
125007
|
+
config.agent_ids = [id, ...config.agent_ids.filter((x3) => x3 !== id)];
|
|
125008
|
+
saveAgentConfig(config);
|
|
125009
|
+
}
|
|
125010
|
+
function addZkId(name) {
|
|
125011
|
+
const config = loadAgentConfig();
|
|
125012
|
+
config.zk_ids = [name, ...config.zk_ids.filter((x3) => x3 !== name)];
|
|
125013
|
+
saveAgentConfig(config);
|
|
125014
|
+
}
|
|
125015
|
+
|
|
125016
|
+
// src/cli/utils/wallet.ts
|
|
125017
|
+
var DEFAULT_WALLET_PATH = (0, import_node_path2.join)((0, import_node_os2.homedir)(), ".config", "nara", "id.json");
|
|
125018
|
+
function resolvePath(p) {
|
|
125019
|
+
return p.startsWith("~") ? (0, import_node_path2.join)((0, import_node_os2.homedir)(), p.slice(1)) : p;
|
|
125020
|
+
}
|
|
124866
125021
|
async function loadWallet(walletPath) {
|
|
124867
|
-
|
|
125022
|
+
let path = walletPath;
|
|
125023
|
+
if (!path) {
|
|
125024
|
+
const config = loadAgentConfig();
|
|
125025
|
+
path = config.wallet ? resolvePath(config.wallet) : DEFAULT_WALLET_PATH;
|
|
125026
|
+
} else {
|
|
125027
|
+
path = resolvePath(path);
|
|
125028
|
+
}
|
|
124868
125029
|
try {
|
|
124869
125030
|
const fs = await import("node:fs/promises");
|
|
124870
125031
|
const file = await fs.readFile(path, "utf-8");
|
|
@@ -124892,7 +125053,9 @@ async function loadWallet(walletPath) {
|
|
|
124892
125053
|
}
|
|
124893
125054
|
}
|
|
124894
125055
|
function getRpcUrl(rpcUrl) {
|
|
124895
|
-
|
|
125056
|
+
if (rpcUrl) return rpcUrl;
|
|
125057
|
+
const config = loadAgentConfig();
|
|
125058
|
+
return config.rpc_url || DEFAULT_RPC_URL;
|
|
124896
125059
|
}
|
|
124897
125060
|
|
|
124898
125061
|
// src/cli/utils/validation.ts
|
|
@@ -125071,8 +125234,8 @@ ${result.base64}`);
|
|
|
125071
125234
|
}
|
|
125072
125235
|
|
|
125073
125236
|
// src/cli/commands/wallet.ts
|
|
125074
|
-
var
|
|
125075
|
-
var DEFAULT_WALLET_PATH2 =
|
|
125237
|
+
var _DEFAULT_WALLET_PATH = process.env.WALLET_PATH || "~/.config/nara/id.json";
|
|
125238
|
+
var DEFAULT_WALLET_PATH2 = _DEFAULT_WALLET_PATH.startsWith("~") ? (0, import_node_path3.join)((0, import_node_os3.homedir)(), _DEFAULT_WALLET_PATH.slice(1)) : _DEFAULT_WALLET_PATH;
|
|
125076
125239
|
function registerWalletCommands(program3) {
|
|
125077
125240
|
const wallet = program3.command("wallet").description("Wallet management commands");
|
|
125078
125241
|
wallet.command("create").description("Create a new wallet").option("-o, --output <path>", "Output path for wallet file (default: ~/.config/nara/id.json)").action(async (options) => {
|
|
@@ -125450,43 +125613,6 @@ async function handleWalletAddress(options) {
|
|
|
125450
125613
|
|
|
125451
125614
|
// src/cli/commands/quest.ts
|
|
125452
125615
|
var import_web316 = __toESM(require_index_cjs(), 1);
|
|
125453
|
-
|
|
125454
|
-
// src/cli/utils/agent-config.ts
|
|
125455
|
-
var import_node_path3 = require("node:path");
|
|
125456
|
-
var import_node_os3 = require("node:os");
|
|
125457
|
-
var AGENT_CONFIG_PATH = (0, import_node_path3.join)((0, import_node_os3.homedir)(), ".config", "nara", "agent.json");
|
|
125458
|
-
var DEFAULT_CONFIG = { agent_ids: [], zk_ids: [] };
|
|
125459
|
-
async function loadAgentConfig() {
|
|
125460
|
-
const fs = await import("node:fs/promises");
|
|
125461
|
-
try {
|
|
125462
|
-
const raw = await fs.readFile(AGENT_CONFIG_PATH, "utf-8");
|
|
125463
|
-
const parsed = JSON.parse(raw);
|
|
125464
|
-
return {
|
|
125465
|
-
agent_ids: Array.isArray(parsed.agent_ids) ? parsed.agent_ids : [],
|
|
125466
|
-
zk_ids: Array.isArray(parsed.zk_ids) ? parsed.zk_ids : []
|
|
125467
|
-
};
|
|
125468
|
-
} catch {
|
|
125469
|
-
return { ...DEFAULT_CONFIG };
|
|
125470
|
-
}
|
|
125471
|
-
}
|
|
125472
|
-
async function saveAgentConfig(config) {
|
|
125473
|
-
const fs = await import("node:fs/promises");
|
|
125474
|
-
const { dirname: dirname4 } = await import("node:path");
|
|
125475
|
-
await fs.mkdir(dirname4(AGENT_CONFIG_PATH), { recursive: true });
|
|
125476
|
-
await fs.writeFile(AGENT_CONFIG_PATH, JSON.stringify(config, null, 2) + "\n");
|
|
125477
|
-
}
|
|
125478
|
-
async function addAgentId(id) {
|
|
125479
|
-
const config = await loadAgentConfig();
|
|
125480
|
-
config.agent_ids = [id, ...config.agent_ids.filter((x3) => x3 !== id)];
|
|
125481
|
-
await saveAgentConfig(config);
|
|
125482
|
-
}
|
|
125483
|
-
async function addZkId(name) {
|
|
125484
|
-
const config = await loadAgentConfig();
|
|
125485
|
-
config.zk_ids = [name, ...config.zk_ids.filter((x3) => x3 !== name)];
|
|
125486
|
-
await saveAgentConfig(config);
|
|
125487
|
-
}
|
|
125488
|
-
|
|
125489
|
-
// src/cli/commands/quest.ts
|
|
125490
125616
|
var DEFAULT_QUEST_RELAY_URL2 = process.env.QUEST_RELAY_URL || "https://quest-api.nara.build/";
|
|
125491
125617
|
var QUEST_ERRORS = {
|
|
125492
125618
|
6e3: "unauthorized",
|
|
@@ -125515,7 +125641,7 @@ function formatTimeRemaining(seconds) {
|
|
|
125515
125641
|
return `${s}s`;
|
|
125516
125642
|
}
|
|
125517
125643
|
async function handleQuestGet(options) {
|
|
125518
|
-
const rpcUrl = getRpcUrl(options.rpcUrl);
|
|
125644
|
+
const rpcUrl = await getRpcUrl(options.rpcUrl);
|
|
125519
125645
|
const connection = new import_web316.Connection(rpcUrl, "confirmed");
|
|
125520
125646
|
let wallet;
|
|
125521
125647
|
try {
|
|
@@ -125572,10 +125698,10 @@ async function handleQuestGet(options) {
|
|
|
125572
125698
|
}
|
|
125573
125699
|
}
|
|
125574
125700
|
async function handleQuestAnswer(answer, options) {
|
|
125575
|
-
const rpcUrl = getRpcUrl(options.rpcUrl);
|
|
125701
|
+
const rpcUrl = await getRpcUrl(options.rpcUrl);
|
|
125576
125702
|
const connection = new import_web316.Connection(rpcUrl, "confirmed");
|
|
125577
125703
|
const wallet = await loadWallet(options.wallet);
|
|
125578
|
-
const agentConfig =
|
|
125704
|
+
const agentConfig = loadAgentConfig();
|
|
125579
125705
|
const configAgentId = agentConfig.agent_ids[0];
|
|
125580
125706
|
const agent = options.agent ?? "naracli";
|
|
125581
125707
|
const model = options.model ?? "";
|
|
@@ -126795,7 +126921,7 @@ async function searchMultiselect(options) {
|
|
|
126795
126921
|
|
|
126796
126922
|
// src/cli/commands/skillsInstall.ts
|
|
126797
126923
|
var import_promises2 = require("node:fs/promises");
|
|
126798
|
-
var
|
|
126924
|
+
var import_node_fs2 = require("node:fs");
|
|
126799
126925
|
var import_node_path4 = require("node:path");
|
|
126800
126926
|
var import_node_os4 = require("node:os");
|
|
126801
126927
|
var import_web317 = __toESM(require_index_cjs(), 1);
|
|
@@ -126804,9 +126930,9 @@ var xdgConfig = process.env.XDG_CONFIG_HOME || (0, import_node_path4.join)(home,
|
|
|
126804
126930
|
var claudeHome = process.env.CLAUDE_CONFIG_DIR?.trim() || (0, import_node_path4.join)(home, ".claude");
|
|
126805
126931
|
var codexHome = process.env.CODEX_HOME?.trim() || (0, import_node_path4.join)(home, ".codex");
|
|
126806
126932
|
function openClawGlobalDir() {
|
|
126807
|
-
if ((0,
|
|
126808
|
-
if ((0,
|
|
126809
|
-
if ((0,
|
|
126933
|
+
if ((0, import_node_fs2.existsSync)((0, import_node_path4.join)(home, ".openclaw"))) return (0, import_node_path4.join)(home, ".openclaw/skills");
|
|
126934
|
+
if ((0, import_node_fs2.existsSync)((0, import_node_path4.join)(home, ".clawdbot"))) return (0, import_node_path4.join)(home, ".clawdbot/skills");
|
|
126935
|
+
if ((0, import_node_fs2.existsSync)((0, import_node_path4.join)(home, ".moltbot"))) return (0, import_node_path4.join)(home, ".moltbot/skills");
|
|
126810
126936
|
return (0, import_node_path4.join)(home, ".openclaw/skills");
|
|
126811
126937
|
}
|
|
126812
126938
|
var AGENT_CONFIGS = {
|
|
@@ -126815,55 +126941,55 @@ var AGENT_CONFIGS = {
|
|
|
126815
126941
|
displayName: "Amp",
|
|
126816
126942
|
projectDir: ".agents/skills",
|
|
126817
126943
|
globalDir: (0, import_node_path4.join)(xdgConfig, "agents/skills"),
|
|
126818
|
-
detect: () => (0,
|
|
126944
|
+
detect: () => (0, import_node_fs2.existsSync)((0, import_node_path4.join)(xdgConfig, "amp"))
|
|
126819
126945
|
},
|
|
126820
126946
|
cline: {
|
|
126821
126947
|
displayName: "Cline",
|
|
126822
126948
|
projectDir: ".agents/skills",
|
|
126823
126949
|
globalDir: (0, import_node_path4.join)(home, ".agents/skills"),
|
|
126824
|
-
detect: () => (0,
|
|
126950
|
+
detect: () => (0, import_node_fs2.existsSync)((0, import_node_path4.join)(home, ".cline"))
|
|
126825
126951
|
},
|
|
126826
126952
|
codex: {
|
|
126827
126953
|
displayName: "Codex",
|
|
126828
126954
|
projectDir: ".agents/skills",
|
|
126829
126955
|
globalDir: (0, import_node_path4.join)(codexHome, "skills"),
|
|
126830
|
-
detect: () => (0,
|
|
126956
|
+
detect: () => (0, import_node_fs2.existsSync)(codexHome) || (0, import_node_fs2.existsSync)("/etc/codex")
|
|
126831
126957
|
},
|
|
126832
126958
|
cursor: {
|
|
126833
126959
|
displayName: "Cursor",
|
|
126834
126960
|
projectDir: ".agents/skills",
|
|
126835
126961
|
globalDir: (0, import_node_path4.join)(home, ".cursor/skills"),
|
|
126836
|
-
detect: () => (0,
|
|
126962
|
+
detect: () => (0, import_node_fs2.existsSync)((0, import_node_path4.join)(home, ".cursor"))
|
|
126837
126963
|
},
|
|
126838
126964
|
"gemini-cli": {
|
|
126839
126965
|
displayName: "Gemini CLI",
|
|
126840
126966
|
projectDir: ".agents/skills",
|
|
126841
126967
|
globalDir: (0, import_node_path4.join)(home, ".gemini/skills"),
|
|
126842
|
-
detect: () => (0,
|
|
126968
|
+
detect: () => (0, import_node_fs2.existsSync)((0, import_node_path4.join)(home, ".gemini"))
|
|
126843
126969
|
},
|
|
126844
126970
|
"github-copilot": {
|
|
126845
126971
|
displayName: "GitHub Copilot",
|
|
126846
126972
|
projectDir: ".agents/skills",
|
|
126847
126973
|
globalDir: (0, import_node_path4.join)(home, ".copilot/skills"),
|
|
126848
|
-
detect: () => (0,
|
|
126974
|
+
detect: () => (0, import_node_fs2.existsSync)((0, import_node_path4.join)(home, ".copilot"))
|
|
126849
126975
|
},
|
|
126850
126976
|
"kimi-cli": {
|
|
126851
126977
|
displayName: "Kimi Code CLI",
|
|
126852
126978
|
projectDir: ".agents/skills",
|
|
126853
126979
|
globalDir: (0, import_node_path4.join)(home, ".config/agents/skills"),
|
|
126854
|
-
detect: () => (0,
|
|
126980
|
+
detect: () => (0, import_node_fs2.existsSync)((0, import_node_path4.join)(home, ".kimi"))
|
|
126855
126981
|
},
|
|
126856
126982
|
opencode: {
|
|
126857
126983
|
displayName: "OpenCode",
|
|
126858
126984
|
projectDir: ".agents/skills",
|
|
126859
126985
|
globalDir: (0, import_node_path4.join)(xdgConfig, "opencode/skills"),
|
|
126860
|
-
detect: () => (0,
|
|
126986
|
+
detect: () => (0, import_node_fs2.existsSync)((0, import_node_path4.join)(xdgConfig, "opencode"))
|
|
126861
126987
|
},
|
|
126862
126988
|
replit: {
|
|
126863
126989
|
displayName: "Replit",
|
|
126864
126990
|
projectDir: ".agents/skills",
|
|
126865
126991
|
globalDir: (0, import_node_path4.join)(xdgConfig, "agents/skills"),
|
|
126866
|
-
detect: () => (0,
|
|
126992
|
+
detect: () => (0, import_node_fs2.existsSync)((0, import_node_path4.join)(process.cwd(), ".replit")),
|
|
126867
126993
|
showInUniversalList: false
|
|
126868
126994
|
},
|
|
126869
126995
|
// ── Additional agents (custom skill dirs) ─────────────────────
|
|
@@ -126871,187 +126997,187 @@ var AGENT_CONFIGS = {
|
|
|
126871
126997
|
displayName: "AdaL",
|
|
126872
126998
|
projectDir: ".adal/skills",
|
|
126873
126999
|
globalDir: (0, import_node_path4.join)(home, ".adal/skills"),
|
|
126874
|
-
detect: () => (0,
|
|
127000
|
+
detect: () => (0, import_node_fs2.existsSync)((0, import_node_path4.join)(home, ".adal"))
|
|
126875
127001
|
},
|
|
126876
127002
|
antigravity: {
|
|
126877
127003
|
displayName: "Antigravity",
|
|
126878
127004
|
projectDir: ".agent/skills",
|
|
126879
127005
|
globalDir: (0, import_node_path4.join)(home, ".gemini/antigravity/skills"),
|
|
126880
|
-
detect: () => (0,
|
|
127006
|
+
detect: () => (0, import_node_fs2.existsSync)((0, import_node_path4.join)(home, ".gemini/antigravity"))
|
|
126881
127007
|
},
|
|
126882
127008
|
augment: {
|
|
126883
127009
|
displayName: "Augment",
|
|
126884
127010
|
projectDir: ".augment/skills",
|
|
126885
127011
|
globalDir: (0, import_node_path4.join)(home, ".augment/skills"),
|
|
126886
|
-
detect: () => (0,
|
|
127012
|
+
detect: () => (0, import_node_fs2.existsSync)((0, import_node_path4.join)(home, ".augment"))
|
|
126887
127013
|
},
|
|
126888
127014
|
"claude-code": {
|
|
126889
127015
|
displayName: "Claude Code",
|
|
126890
127016
|
projectDir: ".claude/skills",
|
|
126891
127017
|
globalDir: (0, import_node_path4.join)(claudeHome, "skills"),
|
|
126892
|
-
detect: () => (0,
|
|
127018
|
+
detect: () => (0, import_node_fs2.existsSync)(claudeHome)
|
|
126893
127019
|
},
|
|
126894
127020
|
codebuddy: {
|
|
126895
127021
|
displayName: "CodeBuddy",
|
|
126896
127022
|
projectDir: ".codebuddy/skills",
|
|
126897
127023
|
globalDir: (0, import_node_path4.join)(home, ".codebuddy/skills"),
|
|
126898
|
-
detect: () => (0,
|
|
127024
|
+
detect: () => (0, import_node_fs2.existsSync)((0, import_node_path4.join)(process.cwd(), ".codebuddy")) || (0, import_node_fs2.existsSync)((0, import_node_path4.join)(home, ".codebuddy"))
|
|
126899
127025
|
},
|
|
126900
127026
|
"command-code": {
|
|
126901
127027
|
displayName: "Command Code",
|
|
126902
127028
|
projectDir: ".commandcode/skills",
|
|
126903
127029
|
globalDir: (0, import_node_path4.join)(home, ".commandcode/skills"),
|
|
126904
|
-
detect: () => (0,
|
|
127030
|
+
detect: () => (0, import_node_fs2.existsSync)((0, import_node_path4.join)(home, ".commandcode"))
|
|
126905
127031
|
},
|
|
126906
127032
|
continue: {
|
|
126907
127033
|
displayName: "Continue",
|
|
126908
127034
|
projectDir: ".continue/skills",
|
|
126909
127035
|
globalDir: (0, import_node_path4.join)(home, ".continue/skills"),
|
|
126910
|
-
detect: () => (0,
|
|
127036
|
+
detect: () => (0, import_node_fs2.existsSync)((0, import_node_path4.join)(process.cwd(), ".continue")) || (0, import_node_fs2.existsSync)((0, import_node_path4.join)(home, ".continue"))
|
|
126911
127037
|
},
|
|
126912
127038
|
cortex: {
|
|
126913
127039
|
displayName: "Cortex Code",
|
|
126914
127040
|
projectDir: ".cortex/skills",
|
|
126915
127041
|
globalDir: (0, import_node_path4.join)(home, ".snowflake/cortex/skills"),
|
|
126916
|
-
detect: () => (0,
|
|
127042
|
+
detect: () => (0, import_node_fs2.existsSync)((0, import_node_path4.join)(home, ".snowflake/cortex"))
|
|
126917
127043
|
},
|
|
126918
127044
|
crush: {
|
|
126919
127045
|
displayName: "Crush",
|
|
126920
127046
|
projectDir: ".crush/skills",
|
|
126921
127047
|
globalDir: (0, import_node_path4.join)(home, ".config/crush/skills"),
|
|
126922
|
-
detect: () => (0,
|
|
127048
|
+
detect: () => (0, import_node_fs2.existsSync)((0, import_node_path4.join)(home, ".config/crush"))
|
|
126923
127049
|
},
|
|
126924
127050
|
droid: {
|
|
126925
127051
|
displayName: "Droid",
|
|
126926
127052
|
projectDir: ".factory/skills",
|
|
126927
127053
|
globalDir: (0, import_node_path4.join)(home, ".factory/skills"),
|
|
126928
|
-
detect: () => (0,
|
|
127054
|
+
detect: () => (0, import_node_fs2.existsSync)((0, import_node_path4.join)(home, ".factory"))
|
|
126929
127055
|
},
|
|
126930
127056
|
goose: {
|
|
126931
127057
|
displayName: "Goose",
|
|
126932
127058
|
projectDir: ".goose/skills",
|
|
126933
127059
|
globalDir: (0, import_node_path4.join)(xdgConfig, "goose/skills"),
|
|
126934
|
-
detect: () => (0,
|
|
127060
|
+
detect: () => (0, import_node_fs2.existsSync)((0, import_node_path4.join)(xdgConfig, "goose"))
|
|
126935
127061
|
},
|
|
126936
127062
|
"iflow-cli": {
|
|
126937
127063
|
displayName: "iFlow CLI",
|
|
126938
127064
|
projectDir: ".iflow/skills",
|
|
126939
127065
|
globalDir: (0, import_node_path4.join)(home, ".iflow/skills"),
|
|
126940
|
-
detect: () => (0,
|
|
127066
|
+
detect: () => (0, import_node_fs2.existsSync)((0, import_node_path4.join)(home, ".iflow"))
|
|
126941
127067
|
},
|
|
126942
127068
|
junie: {
|
|
126943
127069
|
displayName: "Junie",
|
|
126944
127070
|
projectDir: ".junie/skills",
|
|
126945
127071
|
globalDir: (0, import_node_path4.join)(home, ".junie/skills"),
|
|
126946
|
-
detect: () => (0,
|
|
127072
|
+
detect: () => (0, import_node_fs2.existsSync)((0, import_node_path4.join)(home, ".junie"))
|
|
126947
127073
|
},
|
|
126948
127074
|
kilo: {
|
|
126949
127075
|
displayName: "Kilo Code",
|
|
126950
127076
|
projectDir: ".kilocode/skills",
|
|
126951
127077
|
globalDir: (0, import_node_path4.join)(home, ".kilocode/skills"),
|
|
126952
|
-
detect: () => (0,
|
|
127078
|
+
detect: () => (0, import_node_fs2.existsSync)((0, import_node_path4.join)(home, ".kilocode"))
|
|
126953
127079
|
},
|
|
126954
127080
|
"kiro-cli": {
|
|
126955
127081
|
displayName: "Kiro CLI",
|
|
126956
127082
|
projectDir: ".kiro/skills",
|
|
126957
127083
|
globalDir: (0, import_node_path4.join)(home, ".kiro/skills"),
|
|
126958
|
-
detect: () => (0,
|
|
127084
|
+
detect: () => (0, import_node_fs2.existsSync)((0, import_node_path4.join)(home, ".kiro"))
|
|
126959
127085
|
},
|
|
126960
127086
|
kode: {
|
|
126961
127087
|
displayName: "Kode",
|
|
126962
127088
|
projectDir: ".kode/skills",
|
|
126963
127089
|
globalDir: (0, import_node_path4.join)(home, ".kode/skills"),
|
|
126964
|
-
detect: () => (0,
|
|
127090
|
+
detect: () => (0, import_node_fs2.existsSync)((0, import_node_path4.join)(home, ".kode"))
|
|
126965
127091
|
},
|
|
126966
127092
|
mcpjam: {
|
|
126967
127093
|
displayName: "MCPJam",
|
|
126968
127094
|
projectDir: ".mcpjam/skills",
|
|
126969
127095
|
globalDir: (0, import_node_path4.join)(home, ".mcpjam/skills"),
|
|
126970
|
-
detect: () => (0,
|
|
127096
|
+
detect: () => (0, import_node_fs2.existsSync)((0, import_node_path4.join)(home, ".mcpjam"))
|
|
126971
127097
|
},
|
|
126972
127098
|
"mistral-vibe": {
|
|
126973
127099
|
displayName: "Mistral Vibe",
|
|
126974
127100
|
projectDir: ".vibe/skills",
|
|
126975
127101
|
globalDir: (0, import_node_path4.join)(home, ".vibe/skills"),
|
|
126976
|
-
detect: () => (0,
|
|
127102
|
+
detect: () => (0, import_node_fs2.existsSync)((0, import_node_path4.join)(home, ".vibe"))
|
|
126977
127103
|
},
|
|
126978
127104
|
mux: {
|
|
126979
127105
|
displayName: "Mux",
|
|
126980
127106
|
projectDir: ".mux/skills",
|
|
126981
127107
|
globalDir: (0, import_node_path4.join)(home, ".mux/skills"),
|
|
126982
|
-
detect: () => (0,
|
|
127108
|
+
detect: () => (0, import_node_fs2.existsSync)((0, import_node_path4.join)(home, ".mux"))
|
|
126983
127109
|
},
|
|
126984
127110
|
neovate: {
|
|
126985
127111
|
displayName: "Neovate",
|
|
126986
127112
|
projectDir: ".neovate/skills",
|
|
126987
127113
|
globalDir: (0, import_node_path4.join)(home, ".neovate/skills"),
|
|
126988
|
-
detect: () => (0,
|
|
127114
|
+
detect: () => (0, import_node_fs2.existsSync)((0, import_node_path4.join)(home, ".neovate"))
|
|
126989
127115
|
},
|
|
126990
127116
|
openclaw: {
|
|
126991
127117
|
displayName: "OpenClaw",
|
|
126992
127118
|
projectDir: "skills",
|
|
126993
127119
|
globalDir: openClawGlobalDir(),
|
|
126994
|
-
detect: () => (0,
|
|
127120
|
+
detect: () => (0, import_node_fs2.existsSync)((0, import_node_path4.join)(home, ".openclaw")) || (0, import_node_fs2.existsSync)((0, import_node_path4.join)(home, ".clawdbot")) || (0, import_node_fs2.existsSync)((0, import_node_path4.join)(home, ".moltbot"))
|
|
126995
127121
|
},
|
|
126996
127122
|
openhands: {
|
|
126997
127123
|
displayName: "OpenHands",
|
|
126998
127124
|
projectDir: ".openhands/skills",
|
|
126999
127125
|
globalDir: (0, import_node_path4.join)(home, ".openhands/skills"),
|
|
127000
|
-
detect: () => (0,
|
|
127126
|
+
detect: () => (0, import_node_fs2.existsSync)((0, import_node_path4.join)(home, ".openhands"))
|
|
127001
127127
|
},
|
|
127002
127128
|
pi: {
|
|
127003
127129
|
displayName: "Pi",
|
|
127004
127130
|
projectDir: ".pi/skills",
|
|
127005
127131
|
globalDir: (0, import_node_path4.join)(home, ".pi/agent/skills"),
|
|
127006
|
-
detect: () => (0,
|
|
127132
|
+
detect: () => (0, import_node_fs2.existsSync)((0, import_node_path4.join)(home, ".pi/agent"))
|
|
127007
127133
|
},
|
|
127008
127134
|
pochi: {
|
|
127009
127135
|
displayName: "Pochi",
|
|
127010
127136
|
projectDir: ".pochi/skills",
|
|
127011
127137
|
globalDir: (0, import_node_path4.join)(home, ".pochi/skills"),
|
|
127012
|
-
detect: () => (0,
|
|
127138
|
+
detect: () => (0, import_node_fs2.existsSync)((0, import_node_path4.join)(home, ".pochi"))
|
|
127013
127139
|
},
|
|
127014
127140
|
qoder: {
|
|
127015
127141
|
displayName: "Qoder",
|
|
127016
127142
|
projectDir: ".qoder/skills",
|
|
127017
127143
|
globalDir: (0, import_node_path4.join)(home, ".qoder/skills"),
|
|
127018
|
-
detect: () => (0,
|
|
127144
|
+
detect: () => (0, import_node_fs2.existsSync)((0, import_node_path4.join)(home, ".qoder"))
|
|
127019
127145
|
},
|
|
127020
127146
|
"qwen-code": {
|
|
127021
127147
|
displayName: "Qwen Code",
|
|
127022
127148
|
projectDir: ".qwen/skills",
|
|
127023
127149
|
globalDir: (0, import_node_path4.join)(home, ".qwen/skills"),
|
|
127024
|
-
detect: () => (0,
|
|
127150
|
+
detect: () => (0, import_node_fs2.existsSync)((0, import_node_path4.join)(home, ".qwen"))
|
|
127025
127151
|
},
|
|
127026
127152
|
roo: {
|
|
127027
127153
|
displayName: "Roo Code",
|
|
127028
127154
|
projectDir: ".roo/skills",
|
|
127029
127155
|
globalDir: (0, import_node_path4.join)(home, ".roo/skills"),
|
|
127030
|
-
detect: () => (0,
|
|
127156
|
+
detect: () => (0, import_node_fs2.existsSync)((0, import_node_path4.join)(home, ".roo"))
|
|
127031
127157
|
},
|
|
127032
127158
|
trae: {
|
|
127033
127159
|
displayName: "Trae",
|
|
127034
127160
|
projectDir: ".trae/skills",
|
|
127035
127161
|
globalDir: (0, import_node_path4.join)(home, ".trae/skills"),
|
|
127036
|
-
detect: () => (0,
|
|
127162
|
+
detect: () => (0, import_node_fs2.existsSync)((0, import_node_path4.join)(home, ".trae"))
|
|
127037
127163
|
},
|
|
127038
127164
|
"trae-cn": {
|
|
127039
127165
|
displayName: "Trae CN",
|
|
127040
127166
|
projectDir: ".trae/skills",
|
|
127041
127167
|
globalDir: (0, import_node_path4.join)(home, ".trae-cn/skills"),
|
|
127042
|
-
detect: () => (0,
|
|
127168
|
+
detect: () => (0, import_node_fs2.existsSync)((0, import_node_path4.join)(home, ".trae-cn"))
|
|
127043
127169
|
},
|
|
127044
127170
|
windsurf: {
|
|
127045
127171
|
displayName: "Windsurf",
|
|
127046
127172
|
projectDir: ".windsurf/skills",
|
|
127047
127173
|
globalDir: (0, import_node_path4.join)(home, ".codeium/windsurf/skills"),
|
|
127048
|
-
detect: () => (0,
|
|
127174
|
+
detect: () => (0, import_node_fs2.existsSync)((0, import_node_path4.join)(home, ".codeium/windsurf"))
|
|
127049
127175
|
},
|
|
127050
127176
|
zencoder: {
|
|
127051
127177
|
displayName: "Zencoder",
|
|
127052
127178
|
projectDir: ".zencoder/skills",
|
|
127053
127179
|
globalDir: (0, import_node_path4.join)(home, ".zencoder/skills"),
|
|
127054
|
-
detect: () => (0,
|
|
127180
|
+
detect: () => (0, import_node_fs2.existsSync)((0, import_node_path4.join)(home, ".zencoder"))
|
|
127055
127181
|
}
|
|
127056
127182
|
};
|
|
127057
127183
|
function getLockPath(global2, cwd) {
|
|
@@ -127302,7 +127428,7 @@ async function handleSkillsList(options) {
|
|
|
127302
127428
|
for (const [, cfg] of Object.entries(AGENT_CONFIGS)) {
|
|
127303
127429
|
if (!cfg.detect()) continue;
|
|
127304
127430
|
const dir = isGlobal ? cfg.globalDir : (0, import_node_path4.join)(cwd, cfg.projectDir);
|
|
127305
|
-
if ((0,
|
|
127431
|
+
if ((0, import_node_fs2.existsSync)((0, import_node_path4.join)(dir, name, "SKILL.md"))) {
|
|
127306
127432
|
if (!canonicalPath) canonicalPath = shortenPath((0, import_node_path4.join)(dir, name), cwd);
|
|
127307
127433
|
installedAgents.push(cfg.displayName);
|
|
127308
127434
|
}
|
|
@@ -127782,7 +127908,7 @@ async function handleZkIdCreate(name, options) {
|
|
|
127782
127908
|
if (!options.json) printInfo(`Registering ZK ID "${name}"...`);
|
|
127783
127909
|
const signature = await createZkId(connection, wallet, name, idSecret);
|
|
127784
127910
|
if (!options.json) printSuccess(`ZK ID "${name}" registered!`);
|
|
127785
|
-
|
|
127911
|
+
addZkId(name);
|
|
127786
127912
|
if (options.json) {
|
|
127787
127913
|
formatOutput({ name, signature }, true);
|
|
127788
127914
|
} else {
|
|
@@ -127840,7 +127966,7 @@ async function handleZkIdScan(name, options) {
|
|
|
127840
127966
|
if (name) {
|
|
127841
127967
|
names = [name];
|
|
127842
127968
|
} else {
|
|
127843
|
-
const config =
|
|
127969
|
+
const config = loadAgentConfig();
|
|
127844
127970
|
if (config.zk_ids.length === 0) {
|
|
127845
127971
|
printError("No ZK IDs in config. Provide a name or create a ZK ID first.");
|
|
127846
127972
|
process.exit(1);
|
|
@@ -128068,7 +128194,7 @@ function registerZkIdCommands(program3) {
|
|
|
128068
128194
|
|
|
128069
128195
|
// src/cli/commands/agent.ts
|
|
128070
128196
|
var import_web320 = __toESM(require_index_cjs(), 1);
|
|
128071
|
-
var
|
|
128197
|
+
var import_node_fs3 = require("node:fs");
|
|
128072
128198
|
async function handleAgentRegister(agentId, options) {
|
|
128073
128199
|
validateName(agentId, "Agent ID");
|
|
128074
128200
|
const rpcUrl = getRpcUrl(options.rpcUrl);
|
|
@@ -128077,7 +128203,7 @@ async function handleAgentRegister(agentId, options) {
|
|
|
128077
128203
|
if (!options.json) printInfo(`Registering agent "${agentId}"...`);
|
|
128078
128204
|
const result = await registerAgent(connection, wallet, agentId);
|
|
128079
128205
|
if (!options.json) printSuccess(`Agent "${agentId}" registered!`);
|
|
128080
|
-
|
|
128206
|
+
addAgentId(agentId);
|
|
128081
128207
|
if (options.json) {
|
|
128082
128208
|
formatOutput({ agentId, signature: result.signature, agentPubkey: result.agentPubkey.toBase58() }, true);
|
|
128083
128209
|
} else {
|
|
@@ -128146,7 +128272,7 @@ async function handleAgentSetMetadata(agentId, jsonStr, options) {
|
|
|
128146
128272
|
async function handleAgentUploadMemory(agentId, filePath, options) {
|
|
128147
128273
|
let data;
|
|
128148
128274
|
try {
|
|
128149
|
-
data = (0,
|
|
128275
|
+
data = (0, import_node_fs3.readFileSync)(filePath);
|
|
128150
128276
|
} catch (err) {
|
|
128151
128277
|
throw new Error(`Failed to read file "${filePath}": ${err.message}`);
|
|
128152
128278
|
}
|
|
@@ -128339,6 +128465,94 @@ function registerAgentCommands(program3) {
|
|
|
128339
128465
|
});
|
|
128340
128466
|
}
|
|
128341
128467
|
|
|
128468
|
+
// src/cli/commands/config.ts
|
|
128469
|
+
function handleConfigGet(options) {
|
|
128470
|
+
const config = loadAgentConfig();
|
|
128471
|
+
const data = {
|
|
128472
|
+
rpc_url: config.rpc_url ?? DEFAULT_RPC_URL,
|
|
128473
|
+
wallet: config.wallet ?? "~/.config/nara/id.json",
|
|
128474
|
+
rpc_url_custom: !!config.rpc_url,
|
|
128475
|
+
wallet_custom: !!config.wallet
|
|
128476
|
+
};
|
|
128477
|
+
if (options.json) {
|
|
128478
|
+
formatOutput(data, true);
|
|
128479
|
+
} else {
|
|
128480
|
+
console.log("");
|
|
128481
|
+
console.log(` RPC URL: ${data.rpc_url}${data.rpc_url_custom ? "" : " (default)"}`);
|
|
128482
|
+
console.log(` Wallet: ${data.wallet}${data.wallet_custom ? "" : " (default)"}`);
|
|
128483
|
+
console.log("");
|
|
128484
|
+
}
|
|
128485
|
+
}
|
|
128486
|
+
function handleConfigSet(key, value, options) {
|
|
128487
|
+
const config = loadAgentConfig();
|
|
128488
|
+
switch (key) {
|
|
128489
|
+
case "rpc-url":
|
|
128490
|
+
config.rpc_url = value;
|
|
128491
|
+
break;
|
|
128492
|
+
case "wallet":
|
|
128493
|
+
config.wallet = value;
|
|
128494
|
+
break;
|
|
128495
|
+
default:
|
|
128496
|
+
throw new Error(`Unknown config key: "${key}". Valid keys: rpc-url, wallet`);
|
|
128497
|
+
}
|
|
128498
|
+
saveAgentConfig(config);
|
|
128499
|
+
if (!options.json) printSuccess(`Config "${key}" set to "${value}"`);
|
|
128500
|
+
if (options.json) formatOutput({ key, value }, true);
|
|
128501
|
+
}
|
|
128502
|
+
function handleConfigReset(key, options) {
|
|
128503
|
+
const config = loadAgentConfig();
|
|
128504
|
+
if (!key) {
|
|
128505
|
+
delete config.rpc_url;
|
|
128506
|
+
delete config.wallet;
|
|
128507
|
+
saveAgentConfig(config);
|
|
128508
|
+
if (!options.json) printSuccess("All config reset to defaults");
|
|
128509
|
+
} else {
|
|
128510
|
+
switch (key) {
|
|
128511
|
+
case "rpc-url":
|
|
128512
|
+
delete config.rpc_url;
|
|
128513
|
+
break;
|
|
128514
|
+
case "wallet":
|
|
128515
|
+
delete config.wallet;
|
|
128516
|
+
break;
|
|
128517
|
+
default:
|
|
128518
|
+
throw new Error(`Unknown config key: "${key}". Valid keys: rpc-url, wallet`);
|
|
128519
|
+
}
|
|
128520
|
+
saveAgentConfig(config);
|
|
128521
|
+
if (!options.json) printSuccess(`Config "${key}" reset to default`);
|
|
128522
|
+
}
|
|
128523
|
+
if (options.json) formatOutput({ key: key ?? "all", reset: true }, true);
|
|
128524
|
+
}
|
|
128525
|
+
function registerConfigCommands(program3) {
|
|
128526
|
+
const config = program3.command("config").description("Manage CLI configuration (rpc-url, wallet)");
|
|
128527
|
+
config.command("get").description("Show current configuration").action((_opts, cmd) => {
|
|
128528
|
+
try {
|
|
128529
|
+
const globalOpts = cmd.optsWithGlobals();
|
|
128530
|
+
handleConfigGet(globalOpts);
|
|
128531
|
+
} catch (error) {
|
|
128532
|
+
printError(error.message);
|
|
128533
|
+
process.exit(1);
|
|
128534
|
+
}
|
|
128535
|
+
});
|
|
128536
|
+
config.command("set <key> <value>").description("Set a config value (keys: rpc-url, wallet)").action((key, value, _opts, cmd) => {
|
|
128537
|
+
try {
|
|
128538
|
+
const globalOpts = cmd.optsWithGlobals();
|
|
128539
|
+
handleConfigSet(key, value, globalOpts);
|
|
128540
|
+
} catch (error) {
|
|
128541
|
+
printError(error.message);
|
|
128542
|
+
process.exit(1);
|
|
128543
|
+
}
|
|
128544
|
+
});
|
|
128545
|
+
config.command("reset [key]").description("Reset config to default (keys: rpc-url, wallet, or omit for all)").action((key, _opts, cmd) => {
|
|
128546
|
+
try {
|
|
128547
|
+
const globalOpts = cmd.optsWithGlobals();
|
|
128548
|
+
handleConfigReset(key, globalOpts);
|
|
128549
|
+
} catch (error) {
|
|
128550
|
+
printError(error.message);
|
|
128551
|
+
process.exit(1);
|
|
128552
|
+
}
|
|
128553
|
+
});
|
|
128554
|
+
}
|
|
128555
|
+
|
|
128342
128556
|
// src/cli/index.ts
|
|
128343
128557
|
async function pollConfirmation2(connection, signature, timeoutMs = 15e3, intervalMs = 1e3) {
|
|
128344
128558
|
const start = Date.now();
|
|
@@ -128363,6 +128577,7 @@ function registerCommands(program3) {
|
|
|
128363
128577
|
registerSkillsCommands(program3);
|
|
128364
128578
|
registerZkIdCommands(program3);
|
|
128365
128579
|
registerAgentCommands(program3);
|
|
128580
|
+
registerConfigCommands(program3);
|
|
128366
128581
|
program3.command("address").description("Show wallet address").action(async () => {
|
|
128367
128582
|
const opts = program3.opts();
|
|
128368
128583
|
try {
|
|
@@ -128468,7 +128683,7 @@ function registerCommands(program3) {
|
|
|
128468
128683
|
}
|
|
128469
128684
|
|
|
128470
128685
|
// bin/nara-cli.ts
|
|
128471
|
-
var version2 = true ? "1.0.
|
|
128686
|
+
var version2 = true ? "1.0.32" : "dev";
|
|
128472
128687
|
var program2 = new Command();
|
|
128473
128688
|
program2.name("naracli").description("CLI for the Nara chain (Solana-compatible)").version(version2);
|
|
128474
128689
|
program2.option("-r, --rpc-url <url>", "RPC endpoint URL").option("-w, --wallet <path>", "Path to wallet keypair JSON file").option("-j, --json", "Output in JSON format");
|