@belugafinancial/advisor-cli 0.2.0 → 0.4.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/commands/init.js +10 -12
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/install-skill.d.ts +5 -1
- package/dist/commands/install-skill.js +6 -5
- package/dist/commands/install-skill.js.map +1 -1
- package/dist/commands/portfolio.d.ts +2 -0
- package/dist/commands/portfolio.js +32 -0
- package/dist/commands/portfolio.js.map +1 -0
- package/dist/commands/status.js +0 -1
- package/dist/commands/status.js.map +1 -1
- package/dist/commands/upgrade.d.ts +6 -0
- package/dist/commands/upgrade.js +40 -0
- package/dist/commands/upgrade.js.map +1 -0
- package/dist/index.js +16 -3
- package/dist/index.js.map +1 -1
- package/dist/skill/SKILL.md +219 -108
- package/package.json +2 -2
package/dist/commands/init.js
CHANGED
|
@@ -4,7 +4,7 @@ import { dirname, join } from "node:path";
|
|
|
4
4
|
import { createInterface } from "node:readline/promises";
|
|
5
5
|
import { stdin, stdout } from "node:process";
|
|
6
6
|
import { Keypair } from "@solana/web3.js";
|
|
7
|
-
import { BELUGA_PROGRAM_ID_MAINNET,
|
|
7
|
+
import { BELUGA_PROGRAM_ID_MAINNET, loadKeypairFromBase64, } from "@belugafinancial/advisor-sdk";
|
|
8
8
|
import { installSkillCommand } from "./install-skill.js";
|
|
9
9
|
const DEFAULT_CONFIG_PATH = join(homedir(), ".openclaw", "openclaw.json");
|
|
10
10
|
const DEFAULT_RPC = "https://api.mainnet-beta.solana.com";
|
|
@@ -56,13 +56,11 @@ async function promptInt(rl, question, defaultValue) {
|
|
|
56
56
|
async function resolveConfig(args) {
|
|
57
57
|
const interactive = !args.yes && stdin.isTTY;
|
|
58
58
|
const keypair = resolveKeypair(args);
|
|
59
|
-
const x25519 = deriveX25519Keypair(keypair);
|
|
60
59
|
const keypairBase64 = Buffer.from(keypair.secretKey).toString("base64");
|
|
61
60
|
if (!interactive) {
|
|
62
61
|
return {
|
|
63
62
|
keypairBase64,
|
|
64
63
|
pubkey: keypair.publicKey.toBase58(),
|
|
65
|
-
x25519Pubkey: Buffer.from(x25519.publicKey).toString("base64"),
|
|
66
64
|
rpcUrl: args.rpcUrl ?? DEFAULT_RPC,
|
|
67
65
|
programId: args.programId ?? BELUGA_PROGRAM_ID_MAINNET,
|
|
68
66
|
feeBps: args.feeBps ?? DEFAULT_FEE_BPS,
|
|
@@ -85,7 +83,6 @@ async function resolveConfig(args) {
|
|
|
85
83
|
return {
|
|
86
84
|
keypairBase64,
|
|
87
85
|
pubkey: keypair.publicKey.toBase58(),
|
|
88
|
-
x25519Pubkey: Buffer.from(x25519.publicKey).toString("base64"),
|
|
89
86
|
rpcUrl,
|
|
90
87
|
programId: args.programId ?? BELUGA_PROGRAM_ID_MAINNET,
|
|
91
88
|
feeBps,
|
|
@@ -144,7 +141,7 @@ export async function initCommand(args) {
|
|
|
144
141
|
return true;
|
|
145
142
|
});
|
|
146
143
|
try {
|
|
147
|
-
installSkillCommand({ destination: undefined
|
|
144
|
+
installSkillCommand({ destination: undefined });
|
|
148
145
|
}
|
|
149
146
|
finally {
|
|
150
147
|
stdout.write = orig;
|
|
@@ -163,15 +160,16 @@ export async function initCommand(args) {
|
|
|
163
160
|
`\nAdvisor pubkey: ${resolved.pubkey}\n` +
|
|
164
161
|
`Invite URL: ${inviteUrl}\n` +
|
|
165
162
|
`\nNext steps:\n` +
|
|
166
|
-
` 1. Fund the advisor pubkey with a little SOL
|
|
167
|
-
`
|
|
168
|
-
`
|
|
169
|
-
`
|
|
170
|
-
` 2.
|
|
171
|
-
`
|
|
163
|
+
` 1. Fund the advisor pubkey above with a little SOL.\n` +
|
|
164
|
+
` This is the agent's address — it pays gas on every transaction\n` +
|
|
165
|
+
` it signs (accepting your invitation, executing your approved\n` +
|
|
166
|
+
` proposals). ~${RECOMMENDED_FUNDING_SOL} SOL is plenty for low-volume use.\n` +
|
|
167
|
+
` 2. Open the invite URL in the Beluga app and sign the invitation\n` +
|
|
168
|
+
` from your client wallet. That delegates trade-proposal authority\n` +
|
|
169
|
+
` to the agent so it can advise your vault.\n` +
|
|
170
|
+
` 3. Restart your OpenClaw agent so it picks up the new skill config.\n`);
|
|
172
171
|
process.stdout.write(JSON.stringify({
|
|
173
172
|
pubkey: resolved.pubkey,
|
|
174
|
-
x25519Pubkey: resolved.x25519Pubkey,
|
|
175
173
|
inviteUrl,
|
|
176
174
|
fundingAddress: resolved.pubkey,
|
|
177
175
|
recommendedFundingSol: RECOMMENDED_FUNDING_SOL,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC7E,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC1C,OAAO,EACL,yBAAyB,EACzB,
|
|
1
|
+
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC7E,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,OA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,IAAI;QAChC,iBAAiB;QACjB,yDAAyD;QACzD,uEAAuE;QACvE,qEAAqE;QACrE,qBAAqB,uBAAuB,sCAAsC;QAClF,sEAAsE;QACtE,yEAAyE;QACzE,kDAAkD;QAClD,yEAAyE,CAC1E,CAAC;IAEF,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC;QAClC,MAAM,EAAE,QAAQ,CAAC,MAAM;QACvB,SAAS;QACT,cAAc,EAAE,QAAQ,CAAC,MAAM;QAC/B,qBAAqB,EAAE,uBAAuB;QAC9C,UAAU,EAAE,QAAQ,CAAC,UAAU;QAC/B,YAAY,EAAE,iBAAiB;QAC/B,cAAc,EAAE,WAAW,KAAK,IAAI;QACpC,KAAK,EAAE,WAAW;KACnB,EAAE,IAAI,EAAE,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;AACtB,CAAC"}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
interface InstallSkillArgs {
|
|
2
2
|
destination?: string;
|
|
3
|
-
force: boolean;
|
|
4
3
|
}
|
|
4
|
+
/**
|
|
5
|
+
* Copy the bundled skill into the OpenClaw skills root. Idempotent — always
|
|
6
|
+
* overwrites the existing copy because the bundled skill is the canonical
|
|
7
|
+
* source of truth (no user-edited content lives there).
|
|
8
|
+
*/
|
|
5
9
|
export declare function installSkillCommand(args: InstallSkillArgs): void;
|
|
6
10
|
export {};
|
|
@@ -4,6 +4,11 @@ import { dirname, join, resolve } from "node:path";
|
|
|
4
4
|
import { fileURLToPath } from "node:url";
|
|
5
5
|
const DEFAULT_SKILLS_ROOT = join(homedir(), ".openclaw", "workspace", "skills");
|
|
6
6
|
const SKILL_NAME = "beluga-advisor";
|
|
7
|
+
/**
|
|
8
|
+
* Copy the bundled skill into the OpenClaw skills root. Idempotent — always
|
|
9
|
+
* overwrites the existing copy because the bundled skill is the canonical
|
|
10
|
+
* source of truth (no user-edited content lives there).
|
|
11
|
+
*/
|
|
7
12
|
export function installSkillCommand(args) {
|
|
8
13
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
9
14
|
// dist/commands/install-skill.js → dist/skill
|
|
@@ -13,12 +18,8 @@ export function installSkillCommand(args) {
|
|
|
13
18
|
}
|
|
14
19
|
const skillsRoot = args.destination ?? DEFAULT_SKILLS_ROOT;
|
|
15
20
|
const target = join(skillsRoot, SKILL_NAME);
|
|
16
|
-
if (existsSync(target))
|
|
17
|
-
if (!args.force) {
|
|
18
|
-
throw new Error(`${target} already exists. Pass --force to overwrite.`);
|
|
19
|
-
}
|
|
21
|
+
if (existsSync(target))
|
|
20
22
|
rmSync(target, { recursive: true, force: true });
|
|
21
|
-
}
|
|
22
23
|
mkdirSync(skillsRoot, { recursive: true });
|
|
23
24
|
cpSync(source, target, { recursive: true });
|
|
24
25
|
process.stderr.write(`[install-skill] copied skill to ${target}\n`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"install-skill.js","sourceRoot":"","sources":["../../src/commands/install-skill.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAChE,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,MAAM,mBAAmB,GAAG,IAAI,CAAC,OAAO,EAAE,EAAE,WAAW,EAAE,WAAW,EAAE,QAAQ,CAAC,CAAC;AAChF,MAAM,UAAU,GAAG,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"install-skill.js","sourceRoot":"","sources":["../../src/commands/install-skill.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAChE,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS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AAE,MAAM,EAAE,CAAC,GAAG,IAAI,CAAC,CAAC;AAC7E,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export async function portfolioCommand(advisor) {
|
|
2
|
+
const accounts = await advisor.portfolio();
|
|
3
|
+
// bigints don't survive JSON.stringify by default; serialize amounts as strings.
|
|
4
|
+
const serializable = accounts.map((acct) => ({
|
|
5
|
+
...acct,
|
|
6
|
+
holdings: acct.holdings.map((h) => ({
|
|
7
|
+
mint: h.mint,
|
|
8
|
+
amount: h.amount.toString(),
|
|
9
|
+
decimals: h.decimals,
|
|
10
|
+
uiAmount: Number(h.amount) / Math.pow(10, h.decimals),
|
|
11
|
+
})),
|
|
12
|
+
}));
|
|
13
|
+
const summary = {
|
|
14
|
+
advisor: advisor.pubkey.toBase58(),
|
|
15
|
+
totalAccounts: accounts.length,
|
|
16
|
+
activeAccounts: accounts.filter((a) => a.status === "active").length,
|
|
17
|
+
pendingAccounts: accounts.filter((a) => a.status === "pending").length,
|
|
18
|
+
actionItems: {
|
|
19
|
+
pendingInvitations: accounts
|
|
20
|
+
.filter((a) => a.status === "pending")
|
|
21
|
+
.map((a) => ({ advisoryAccount: a.address, owner: a.owner })),
|
|
22
|
+
approvedProposals: accounts.flatMap((a) => a.approvedProposalAddresses.map((addr) => ({
|
|
23
|
+
proposalAddress: addr,
|
|
24
|
+
advisoryAccount: a.address,
|
|
25
|
+
owner: a.owner,
|
|
26
|
+
}))),
|
|
27
|
+
},
|
|
28
|
+
accounts: serializable,
|
|
29
|
+
};
|
|
30
|
+
process.stdout.write(JSON.stringify(summary, null, 2) + "\n");
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=portfolio.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"portfolio.js","sourceRoot":"","sources":["../../src/commands/portfolio.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,OAAsB;IAC3D,MAAM,QAAQ,GAAG,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,aAAa;YACpC,SAAS,EAAE;gBACT,OAAO,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,MAAM;gBAC/D,QAAQ,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,UAAU,CAAC,CAAC,MAAM;gBACjE,QAAQ,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,UAAU,CAAC,CAAC,MAAM;gBACjE,QAAQ,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,UAAU,CAAC,CAAC,MAAM;aAClE;YACD,yBAAyB,EAAE,SAAS;iBACjC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,UAAU,CAAC;iBACtC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC;SACzB,CAAC;IACJ,CAAC,CAAC,CACH,CAAC;IAEF,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CACjC;QACE,OAAO,EAAE,OAAO,CAAC,MAAM,CAAC,QAAQ,EAAE;QAClC,QAAQ,EAAE,QAAQ;KACnB,EACD,IAAI,EACJ,CAAC,CACF,GAAG,IAAI,CAAC,CAAC;AACZ,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { spawn } from "node:child_process";
|
|
2
|
+
const PACKAGE_NAME = "@belugafinancial/advisor-cli";
|
|
3
|
+
function runInherit(command, args) {
|
|
4
|
+
return new Promise((resolve) => {
|
|
5
|
+
const child = spawn(command, args, { stdio: "inherit", shell: false });
|
|
6
|
+
child.on("exit", (code) => resolve(code ?? 1));
|
|
7
|
+
child.on("error", () => resolve(127));
|
|
8
|
+
});
|
|
9
|
+
}
|
|
10
|
+
export async function upgradeCommand(args) {
|
|
11
|
+
if (!args.skipNpm) {
|
|
12
|
+
process.stderr.write(`[upgrade] running: npm install -g ${PACKAGE_NAME}@latest\n`);
|
|
13
|
+
const npmCode = await runInherit("npm", ["install", "-g", `${PACKAGE_NAME}@latest`]);
|
|
14
|
+
if (npmCode !== 0) {
|
|
15
|
+
process.stderr.write(`\n[upgrade] npm install failed (exit ${npmCode}).\n` +
|
|
16
|
+
`If this was a permissions error, run one of:\n` +
|
|
17
|
+
` sudo npm install -g ${PACKAGE_NAME}@latest\n` +
|
|
18
|
+
` npm install -g ${PACKAGE_NAME}@latest # after fixing your npm prefix\n` +
|
|
19
|
+
`Then run \`beluga-advisor install-skill\` to update the bundled skill.\n`);
|
|
20
|
+
process.exit(npmCode);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
// After the npm install above, the global beluga-advisor binary is the new
|
|
24
|
+
// version. Spawn it as a separate process so install-skill copies the NEW
|
|
25
|
+
// bundled skill, not the one in this (old) process's dist/.
|
|
26
|
+
process.stderr.write(`[upgrade] running: beluga-advisor install-skill\n`);
|
|
27
|
+
const skillCode = await runInherit("beluga-advisor", ["install-skill"]);
|
|
28
|
+
if (skillCode !== 0) {
|
|
29
|
+
process.stderr.write(`[upgrade] install-skill failed (exit ${skillCode}).\n`);
|
|
30
|
+
process.exit(skillCode);
|
|
31
|
+
}
|
|
32
|
+
process.stdout.write(JSON.stringify({
|
|
33
|
+
upgraded: true,
|
|
34
|
+
package: `${PACKAGE_NAME}@latest`,
|
|
35
|
+
skipNpm: args.skipNpm,
|
|
36
|
+
}) + "\n");
|
|
37
|
+
process.stderr.write(`\n✓ Upgraded ${PACKAGE_NAME} and reinstalled the bundled skill.\n` +
|
|
38
|
+
`Restart OpenClaw so it picks up the new skill version.\n`);
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=upgrade.js.map
|
|
@@ -0,0 +1 @@
|
|
|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E,0EAA0E;IAC1E,4DAA4D;IAC5D,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,mDAAmD,CAAC,CAAC;IAC1E,MAAM,SAAS,GAAG,MAAM,UAAU,CAAC,gBAAgB,EAAE,CAAC,eAAe,CAAC,CAAC,CAAC;IACxE,IAAI,SAAS,KAAK,CAAC,EAAE,CAAC;QACpB,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,wCAAwC,SAAS,MAAM,CAAC,CAAC;QAC9E,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IAC1B,CAAC;IAED,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC;QAClC,QAAQ,EAAE,IAAI;QACd,OAAO,EAAE,GAAG,YAAY,SAAS;QACjC,OAAO,EAAE,IAAI,CAAC,OAAO;KACtB,CAAC,GAAG,IAAI,CAAC,CAAC;IACX,OAAO,CAAC,MAAM,CAAC,KAAK,CAClB,gBAAgB,YAAY,uCAAuC;QACnE,0DAA0D,CAC3D,CAAC;AACJ,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -6,6 +6,8 @@ import { proposeCommand } from "./commands/propose.js";
|
|
|
6
6
|
import { executeCommand } from "./commands/execute.js";
|
|
7
7
|
import { initCommand } from "./commands/init.js";
|
|
8
8
|
import { installSkillCommand } from "./commands/install-skill.js";
|
|
9
|
+
import { portfolioCommand } from "./commands/portfolio.js";
|
|
10
|
+
import { upgradeCommand } from "./commands/upgrade.js";
|
|
9
11
|
import { watchStartCommand, watchStatusCommand, watchStopCommand, } from "./commands/watch.js";
|
|
10
12
|
const HELP = `beluga-advisor — operate a Beluga advisor account from the command line.
|
|
11
13
|
|
|
@@ -14,7 +16,9 @@ Usage:
|
|
|
14
16
|
[--auto-accept true|false] [--auto-execute true|false]
|
|
15
17
|
[--keypair-base64 <secret> | --keypair-file <path>]
|
|
16
18
|
[--config-path <path>] [--no-install-skill]
|
|
17
|
-
beluga-advisor
|
|
19
|
+
beluga-advisor upgrade [--skip-npm]
|
|
20
|
+
beluga-advisor install-skill [--destination <dir>]
|
|
21
|
+
beluga-advisor portfolio
|
|
18
22
|
beluga-advisor status
|
|
19
23
|
beluga-advisor accept [<advisory-account-address>] [--fee-bps <n>]
|
|
20
24
|
beluga-advisor propose <advisory-account-address> [--payload <file|->] [--payload-json <json>]
|
|
@@ -62,7 +66,11 @@ async function main() {
|
|
|
62
66
|
if (command === "install-skill") {
|
|
63
67
|
return installSkillCommand({
|
|
64
68
|
destination: getFlag(rest, "destination"),
|
|
65
|
-
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
if (command === "upgrade") {
|
|
72
|
+
return upgradeCommand({
|
|
73
|
+
skipNpm: rest.includes("--skip-npm"),
|
|
66
74
|
});
|
|
67
75
|
}
|
|
68
76
|
if (command === "init") {
|
|
@@ -94,11 +102,16 @@ async function main() {
|
|
|
94
102
|
const advisor = buildAdvisor(env);
|
|
95
103
|
switch (command) {
|
|
96
104
|
case "pubkey":
|
|
105
|
+
// Solana base58 pubkey only — this is what the user invites in the
|
|
106
|
+
// Beluga app. The x25519 encryption key is derived internally and
|
|
107
|
+
// shouldn't be surfaced as an "address" to anyone.
|
|
97
108
|
process.stdout.write(JSON.stringify({
|
|
98
109
|
pubkey: advisor.pubkey.toBase58(),
|
|
99
|
-
x25519Pubkey: Buffer.from(advisor.x25519.publicKey).toString("base64"),
|
|
100
110
|
}) + "\n");
|
|
101
111
|
return;
|
|
112
|
+
case "portfolio":
|
|
113
|
+
await portfolioCommand(advisor);
|
|
114
|
+
return;
|
|
102
115
|
case "status":
|
|
103
116
|
await statusCommand(advisor);
|
|
104
117
|
return;
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,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user's Beluga advisor. The user is a Beluga client — they own a vault and have delegated trade-proposal authority to this skill's keypair. The skill IS their advisor: it forms opinions on what trades to propose, drafts encrypted swap proposals against the user's vault, and executes them once the user approves in the Beluga app. Activate whenever the user mentions Beluga, their vault, holdings the agent should manage, or a swap they're considering.
|
|
4
4
|
metadata:
|
|
5
5
|
openclaw:
|
|
6
6
|
requires:
|
|
@@ -14,102 +14,133 @@ metadata:
|
|
|
14
14
|
|
|
15
15
|
# Beluga Advisor
|
|
16
16
|
|
|
17
|
-
Beluga is a Solana investment advisory platform.
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
Beluga is a Solana investment advisory platform. A *client* owns a vault and
|
|
18
|
+
custodies the assets themselves; an *advisor* holds a Solana keypair that
|
|
19
|
+
authorizes them to propose encrypted swap trades against the client's vault.
|
|
20
|
+
The client approves or rejects each proposal in the Beluga app. Only after
|
|
21
|
+
approval can the advisor execute the swap on-chain via Raydium AMMs.
|
|
20
22
|
|
|
21
|
-
|
|
22
|
-
invitations, build encrypted swap proposals against a client's vault, and
|
|
23
|
-
execute proposals that the client has approved.
|
|
23
|
+
## Your role
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
**You — the agent — are the advisor.** The advisor keypair stored in this
|
|
26
|
+
skill's config is *your* identity. You're the entity invited on-chain, you
|
|
27
|
+
draft the proposals, you sign the execution transactions. You are paid the
|
|
28
|
+
configured fee for trades you successfully execute.
|
|
26
29
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
- The user describes a trade they want to suggest to a Beluga client and the
|
|
32
|
-
trade involves a Raydium-listed token.
|
|
33
|
-
- The user wants to run a background watcher that auto-accepts new advisory
|
|
34
|
-
accounts and auto-executes approved proposals.
|
|
35
|
-
- The agent is operating autonomously on a Beluga deployment and needs to
|
|
36
|
-
handle the lifecycle of advisory accounts.
|
|
30
|
+
**The user is the client.** They own a Beluga vault, they invited your
|
|
31
|
+
pubkey to advise it, they bear custody of the assets, and every proposal
|
|
32
|
+
you submit must be approved by them in the Beluga app before you can
|
|
33
|
+
execute it. You cannot move their funds without their approval.
|
|
37
34
|
|
|
38
|
-
|
|
35
|
+
Speak from this perspective. "Your vault holds $4,200 in USDC" — not "the
|
|
36
|
+
client's vault." "I think we should swap 30% to SOL" — not "the advisor
|
|
37
|
+
recommends." "Approve the proposal I just sent in the Beluga app" — not
|
|
38
|
+
"the proposal needs approval."
|
|
39
39
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
anything they don't have an opinion on:
|
|
46
|
-
|
|
47
|
-
1. **Keypair** — "Generate a new advisor keypair, or import an existing one?"
|
|
48
|
-
Default: generate. If they want to import, ask whether they have a
|
|
49
|
-
base64-encoded 64-byte secret or a Solana keygen JSON file.
|
|
50
|
-
2. **RPC URL** — "Which Solana RPC should the advisor use?"
|
|
51
|
-
Default: `https://api.mainnet-beta.solana.com`. Recommend a private RPC
|
|
52
|
-
(QuikNode/Helius/Triton) if they plan to run watch mode.
|
|
53
|
-
3. **Fee** — "What fee should you charge clients, in basis points?"
|
|
54
|
-
Default: 50 (0.5%). Range: 0 – ~500.
|
|
55
|
-
4. **Auto-accept** — "Should the watcher auto-accept new client invitations?"
|
|
56
|
-
Default: yes.
|
|
57
|
-
5. **Auto-execute** — "Should the watcher auto-execute approved proposals?"
|
|
58
|
-
Default: yes.
|
|
40
|
+
(Edge case: the same advisor pubkey can be invited by *multiple* Beluga
|
|
41
|
+
clients. If `beluga-advisor portfolio` returns more than one advisory
|
|
42
|
+
account, brief the user on each — the user is one of them, the others are
|
|
43
|
+
people who have separately invited you. Treat each as a distinct advisory
|
|
44
|
+
relationship.)
|
|
59
45
|
|
|
60
|
-
|
|
46
|
+
## First contact: brief, don't menu
|
|
47
|
+
|
|
48
|
+
When the user opens this skill (`/beluga_advisor`, "show me my Beluga
|
|
49
|
+
vault", "what should I trade", or any vague entry), your **first action**
|
|
50
|
+
is to run:
|
|
61
51
|
|
|
62
52
|
```
|
|
63
|
-
beluga-advisor
|
|
64
|
-
--rpc-url <answer> \
|
|
65
|
-
--fee-bps <answer> \
|
|
66
|
-
--auto-accept <true|false> \
|
|
67
|
-
--auto-execute <true|false>
|
|
53
|
+
beluga-advisor portfolio
|
|
68
54
|
```
|
|
69
55
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
56
|
+
Read the JSON, then open with a portfolio briefing — never a menu of
|
|
57
|
+
options. For each advisory account, cover in this order:
|
|
58
|
+
|
|
59
|
+
1. **Vault state.** Holdings (mint addresses if you don't recognize the
|
|
60
|
+
symbols — look them up via web search), and any in-flight proposals.
|
|
61
|
+
2. **Action items.**
|
|
62
|
+
- Approved proposals waiting for *you* to execute on-chain. Offer to
|
|
63
|
+
execute them now.
|
|
64
|
+
- Pending invitations (clients who invited you but you haven't accepted
|
|
65
|
+
yet). Offer to accept.
|
|
66
|
+
- Drift / opportunities you spotted while reading the holdings.
|
|
67
|
+
3. **A recommendation, not a question.** Form an opinion. End the briefing
|
|
68
|
+
with one or two specific trade ideas — what would *you* do next, and
|
|
69
|
+
why. Don't fall back to "what would you like to do?" until the user has
|
|
70
|
+
seen your read.
|
|
71
|
+
|
|
72
|
+
If the portfolio is empty (no advisory accounts yet), the user hasn't
|
|
73
|
+
invited you to advise anything. Show them your pubkey and the invite URL
|
|
74
|
+
from `beluga-advisor pubkey` and tell them to invite you from the Beluga
|
|
75
|
+
app.
|
|
76
|
+
|
|
77
|
+
When you share your pubkey with the user, **always quote the Solana
|
|
78
|
+
base58 string** (the `pubkey` field in JSON output) — this is the address
|
|
79
|
+
they put into the Beluga app to invite you. Never share the x25519 key;
|
|
80
|
+
that's internal encryption material the user has no use for. If you ever
|
|
81
|
+
see a base64 string described as a "pubkey", it is not the right thing to
|
|
82
|
+
hand to the user.
|
|
83
|
+
|
|
84
|
+
## Forming recommendations
|
|
85
|
+
|
|
86
|
+
You are expected to bring market judgment to every interaction. Use every
|
|
87
|
+
tool available to you:
|
|
88
|
+
|
|
89
|
+
- **Web search** for current token prices, recent news on each holding,
|
|
90
|
+
sector trends, and the user's broader thesis if they've shared one.
|
|
91
|
+
- **Other skills** the user has installed — DeFi data feeds, on-chain
|
|
92
|
+
analytics, news aggregators, anything that helps inform the call.
|
|
93
|
+
- **The vault data itself** — concentration risk, idle stablecoin balances
|
|
94
|
+
that should be deployed, holdings that have drifted from the user's
|
|
95
|
+
stated allocation.
|
|
96
|
+
|
|
97
|
+
A useful recommendation is *specific*: "swap 30% of your USDC into SOL —
|
|
98
|
+
SOL is up 8% this week on a Raydium volume surge, and your vault is 100%
|
|
99
|
+
USDC right now which is a missed opportunity given the growth thesis you
|
|
100
|
+
mentioned last week." Not: "you could consider rebalancing".
|
|
101
|
+
|
|
102
|
+
When the user accepts a recommendation, draft and submit the proposal
|
|
103
|
+
yourself (see "Propose a swap" below). Then tell them to **open the
|
|
104
|
+
Beluga app and approve** — without their approval you can't execute.
|
|
105
|
+
When they reject, ask one clarifying question and adapt.
|
|
106
|
+
|
|
107
|
+
## The CLI you operate
|
|
108
|
+
|
|
109
|
+
All commands print JSON to stdout and human-readable status to stderr. You
|
|
110
|
+
read the JSON; the user reads your synthesis.
|
|
111
|
+
|
|
112
|
+
### Portfolio briefing — your default open
|
|
87
113
|
|
|
88
|
-
|
|
114
|
+
```
|
|
115
|
+
beluga-advisor portfolio
|
|
116
|
+
```
|
|
89
117
|
|
|
90
|
-
|
|
118
|
+
Returns: every advisory account where you're the advisor, with each
|
|
119
|
+
account's status, fee, holdings (mint + raw amount + decimals + uiAmount),
|
|
120
|
+
and proposal action items (pending invitations from clients, approved
|
|
121
|
+
proposals waiting for you to execute). Run this on first contact and any
|
|
122
|
+
time the user asks "what's going on" or you need refreshed state.
|
|
91
123
|
|
|
92
|
-
### Inspect state
|
|
124
|
+
### Inspect proposal state
|
|
93
125
|
|
|
94
126
|
```
|
|
95
127
|
beluga-advisor status
|
|
96
128
|
```
|
|
97
129
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
Run this first whenever the user asks "what's going on" or you need to know
|
|
101
|
-
which clients have what state.
|
|
130
|
+
Lighter than `portfolio` — accounts and proposal counts, no balances. Use
|
|
131
|
+
this when you only need to check whether something has changed.
|
|
102
132
|
|
|
103
133
|
### Accept a pending advisory account
|
|
104
134
|
|
|
105
135
|
```
|
|
106
|
-
beluga-advisor accept # accept ALL pending
|
|
107
|
-
beluga-advisor accept <advisory-account> # accept
|
|
108
|
-
beluga-advisor accept --fee-bps 75 # override
|
|
136
|
+
beluga-advisor accept # accept ALL pending invites
|
|
137
|
+
beluga-advisor accept <advisory-account> # accept one
|
|
138
|
+
beluga-advisor accept --fee-bps 75 # override fee
|
|
109
139
|
```
|
|
110
140
|
|
|
111
|
-
|
|
112
|
-
|
|
141
|
+
Used when the user (or another client) has invited you and you haven't
|
|
142
|
+
accepted yet. Accepting locks in your fee. Default fee comes from
|
|
143
|
+
`BELUGA_ACCEPT_FEE_BPS`.
|
|
113
144
|
|
|
114
145
|
### Propose a swap
|
|
115
146
|
|
|
@@ -133,19 +164,25 @@ The payload JSON shape is:
|
|
|
133
164
|
}
|
|
134
165
|
```
|
|
135
166
|
|
|
136
|
-
- `amount` and `other_amount_threshold` are in raw token units (lamports
|
|
137
|
-
SOL, microUSDC for USDC, etc.).
|
|
138
|
-
building the payload.
|
|
139
|
-
- `a_to_b: true` means swap mint_a → mint_b
|
|
140
|
-
means `amount` is the input amount; `other_amount_threshold` is
|
|
141
|
-
acceptable output (slippage protection).
|
|
142
|
-
- `
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
The
|
|
148
|
-
|
|
167
|
+
- `amount` and `other_amount_threshold` are in raw token units (lamports
|
|
168
|
+
for SOL, microUSDC for USDC, etc.). Look up token decimals via web
|
|
169
|
+
search or on-chain mint metadata before building the payload.
|
|
170
|
+
- `a_to_b: true` means swap `mint_a → mint_b`. `amount_specified_is_input:
|
|
171
|
+
true` means `amount` is the input amount; `other_amount_threshold` is
|
|
172
|
+
the minimum acceptable output (slippage protection).
|
|
173
|
+
- `pool` is a Raydium pool — find one via web search of Raydium's pool
|
|
174
|
+
list or their API. `pool_type` is `"cpmm"` for constant-product or
|
|
175
|
+
`"clmm"` for concentrated-liquidity.
|
|
176
|
+
- `rationale` is encrypted on-chain and shown to the client only — keep
|
|
177
|
+
it concise (under ~200 chars) since the envelope is capped at 512
|
|
178
|
+
bytes. The client (your user) sees this when deciding whether to
|
|
179
|
+
approve, so make it persuasive but honest.
|
|
180
|
+
|
|
181
|
+
The proposal is encrypted with the client's x25519 public key (read from
|
|
182
|
+
the advisory account on-chain) so only the client and you can decrypt it.
|
|
183
|
+
|
|
184
|
+
After you submit, **always tell the user to open the Beluga app and
|
|
185
|
+
approve the proposal**. Until they approve, you cannot execute it.
|
|
149
186
|
|
|
150
187
|
### Execute approved proposals
|
|
151
188
|
|
|
@@ -155,10 +192,11 @@ beluga-advisor execute <proposal-address> # execute one
|
|
|
155
192
|
beluga-advisor execute --account <advisory-account> # all approved on one client
|
|
156
193
|
```
|
|
157
194
|
|
|
158
|
-
Once
|
|
159
|
-
|
|
195
|
+
Once the user (or another client) has approved a proposal in the Beluga
|
|
196
|
+
app, this command pushes it on-chain. Vault initialization and Raydium
|
|
197
|
+
routing are automatic.
|
|
160
198
|
|
|
161
|
-
### Watch mode (
|
|
199
|
+
### Watch mode (background lifecycle)
|
|
162
200
|
|
|
163
201
|
```
|
|
164
202
|
beluga-advisor watch start # spawn background daemon
|
|
@@ -166,30 +204,103 @@ beluga-advisor watch status # is it running?
|
|
|
166
204
|
beluga-advisor watch stop # kill the daemon
|
|
167
205
|
```
|
|
168
206
|
|
|
169
|
-
The watcher polls every 30 seconds
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
207
|
+
The watcher polls every 30 seconds and, by default, auto-accepts pending
|
|
208
|
+
client invitations and auto-executes approved proposals. It does NOT
|
|
209
|
+
auto-propose — proposing is your job (you, the agent, decide what to
|
|
210
|
+
suggest).
|
|
211
|
+
|
|
212
|
+
To opt out, set `BELUGA_AUTO_ACCEPT=false` or `BELUGA_AUTO_EXECUTE=false`
|
|
213
|
+
in the skill config.
|
|
214
|
+
|
|
215
|
+
## First-time setup (chat-driven)
|
|
216
|
+
|
|
217
|
+
Use this when `BELUGA_ADVISOR_KEYPAIR` is not yet set, or when the user
|
|
218
|
+
asks to "set up Beluga", "create my advisor", or similar. Common trigger
|
|
219
|
+
phrasings: "/init-beluga-advisor", "configure beluga", "set me up".
|
|
220
|
+
|
|
221
|
+
Frame it as creating *your* (the agent's) Beluga identity — the keypair
|
|
222
|
+
you'll use to advise the user's vault. Walk the user through these
|
|
223
|
+
questions in chat, accepting the default for anything they don't have an
|
|
224
|
+
opinion on:
|
|
225
|
+
|
|
226
|
+
1. **Keypair** — "Should I generate a fresh advisor identity, or use one
|
|
227
|
+
you already have?" Default: generate. If they have one, ask whether
|
|
228
|
+
they have a base64-encoded 64-byte secret or a Solana keygen JSON
|
|
229
|
+
file.
|
|
230
|
+
2. **RPC URL** — "Which Solana RPC should I use?"
|
|
231
|
+
Default: `https://api.mainnet-beta.solana.com`. Recommend a private
|
|
232
|
+
RPC (QuikNode/Helius/Triton) if they plan to run watch mode.
|
|
233
|
+
3. **Fee** — "What fee should I charge per trade, in basis points?"
|
|
234
|
+
Default: 50 (0.5%). Range: 0 – ~500. (This is the fee you collect on
|
|
235
|
+
every executed trade, paid out of the input mint.)
|
|
236
|
+
4. **Auto-accept** — "Should the watcher auto-accept new client invitations
|
|
237
|
+
I receive?" Default: yes.
|
|
238
|
+
5. **Auto-execute** — "Should the watcher auto-execute proposals once
|
|
239
|
+
you've approved them in the Beluga app?" Default: yes.
|
|
240
|
+
|
|
241
|
+
Then run init non-interactively with the answers:
|
|
242
|
+
|
|
243
|
+
```
|
|
244
|
+
beluga-advisor init --yes \
|
|
245
|
+
--rpc-url <answer> \
|
|
246
|
+
--fee-bps <answer> \
|
|
247
|
+
--auto-accept <true|false> \
|
|
248
|
+
--auto-execute <true|false>
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
(Add `--keypair-base64 <secret>` or `--keypair-file <path>` only if the
|
|
252
|
+
user chose to import an existing keypair.)
|
|
253
|
+
|
|
254
|
+
`init` writes a merged config to `~/.openclaw/openclaw.json`, installs
|
|
255
|
+
(or re-installs) the skill, and prints a JSON object containing your new
|
|
256
|
+
advisor pubkey and an invite URL the user should open.
|
|
257
|
+
|
|
258
|
+
After init succeeds, tell the user (in this order — funding comes first
|
|
259
|
+
because you can't transact without SOL):
|
|
260
|
+
|
|
261
|
+
1. **Fund the advisor pubkey.** Show your new pubkey from the JSON output
|
|
262
|
+
and tell them to send a small amount of SOL to it (~0.05 SOL is plenty
|
|
263
|
+
for low-volume use). You can't accept their invitation or execute
|
|
264
|
+
proposals until this address holds SOL.
|
|
265
|
+
2. **Open the invite URL** in the Beluga app and confirm the invitation
|
|
266
|
+
from their wallet — that's how they (the client) invite you (the
|
|
267
|
+
advisor) on-chain.
|
|
268
|
+
3. **Restart OpenClaw** so it picks up the new env from
|
|
269
|
+
`~/.openclaw/openclaw.json`.
|
|
270
|
+
|
|
271
|
+
After OpenClaw restarts, the watcher (or the next time the user invokes
|
|
272
|
+
the skill) will accept the invitation and you'll be live as their
|
|
273
|
+
advisor.
|
|
274
|
+
|
|
275
|
+
## Updating the skill
|
|
276
|
+
|
|
277
|
+
When the user asks how to update Beluga (or you notice the bundled skill
|
|
278
|
+
disagrees with what's installed), tell them to run:
|
|
279
|
+
|
|
280
|
+
```
|
|
281
|
+
beluga-advisor upgrade
|
|
282
|
+
```
|
|
173
283
|
|
|
174
|
-
|
|
175
|
-
|
|
284
|
+
`upgrade` runs `npm install -g @belugafinancial/advisor-cli@latest` and
|
|
285
|
+
then re-installs the bundled skill in one step. If npm install fails for
|
|
286
|
+
permissions reasons, the command prints the exact `sudo`-prefixed
|
|
287
|
+
command to run instead.
|
|
176
288
|
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
up on next `watch status`.
|
|
289
|
+
After an upgrade, OpenClaw needs to be restarted to pick up the new
|
|
290
|
+
skill content.
|
|
180
291
|
|
|
181
292
|
## Concurrency
|
|
182
293
|
|
|
183
|
-
The CLI's one-shot commands and the watcher can both run safely
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
harmless failed transaction.
|
|
294
|
+
The CLI's one-shot commands and the watcher can both run safely. Already-
|
|
295
|
+
executed proposals fail idempotently on-chain (the program rejects double-
|
|
296
|
+
execution), so a race only produces a harmless failed transaction.
|
|
187
297
|
|
|
188
298
|
## Trust model
|
|
189
299
|
|
|
190
|
-
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
300
|
+
- Your keypair only authorizes proposing and executing swaps within the
|
|
301
|
+
limits enforced by the on-chain program. You cannot withdraw the
|
|
302
|
+
client's funds.
|
|
303
|
+
- The client retains custody of their vault assets and must approve every
|
|
304
|
+
proposal in the Beluga app before you can execute it.
|
|
305
|
+
- Encrypted proposal payloads are decryptable by you and the client only
|
|
306
|
+
— not by anyone observing the chain.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@belugafinancial/advisor-cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "Command-line tool to operate a Beluga advisor account: accept invitations, propose encrypted swaps, execute approved proposals, and run a watch daemon for the boring lifecycle bits.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"prepublishOnly": "npm run build"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@belugafinancial/advisor-sdk": "^0.
|
|
26
|
+
"@belugafinancial/advisor-sdk": "^0.4.0",
|
|
27
27
|
"@solana/web3.js": "^1.98.0"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|