@belugafinancial/advisor-cli 0.1.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/accept.d.ts +5 -0
- package/dist/commands/accept.js +23 -0
- package/dist/commands/accept.js.map +1 -0
- package/dist/commands/execute.d.ts +5 -0
- package/dist/commands/execute.js +27 -0
- package/dist/commands/execute.js.map +1 -0
- package/dist/commands/install-skill.d.ts +6 -0
- package/dist/commands/install-skill.js +27 -0
- package/dist/commands/install-skill.js.map +1 -0
- package/dist/commands/propose.d.ts +8 -0
- package/dist/commands/propose.js +35 -0
- package/dist/commands/propose.js.map +1 -0
- package/dist/commands/status.d.ts +2 -0
- package/dist/commands/status.js +28 -0
- package/dist/commands/status.js.map +1 -0
- package/dist/commands/watch.d.ts +5 -0
- package/dist/commands/watch.js +104 -0
- package/dist/commands/watch.js.map +1 -0
- package/dist/env.d.ts +12 -0
- package/dist/env.js +24 -0
- package/dist/env.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +116 -0
- package/dist/index.js.map +1 -0
- package/dist/skill/SKILL.md +154 -0
- package/dist/skill/openclaw.config.example.json +25 -0
- package/package.json +33 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export async function acceptCommand(advisor, args) {
|
|
2
|
+
// If no address given, accept all pending advisory accounts.
|
|
3
|
+
const accounts = await advisor.listAdvisoryAccounts();
|
|
4
|
+
const targets = args.address
|
|
5
|
+
? accounts.filter((a) => a.address === args.address)
|
|
6
|
+
: accounts.filter((a) => a.status === "pending");
|
|
7
|
+
if (targets.length === 0) {
|
|
8
|
+
process.stdout.write(JSON.stringify({ accepted: [] }) + "\n");
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
const accepted = [];
|
|
12
|
+
for (const account of targets) {
|
|
13
|
+
if (account.status !== "pending") {
|
|
14
|
+
process.stderr.write(`[accept] skipping ${account.address}: status is ${account.status}\n`);
|
|
15
|
+
continue;
|
|
16
|
+
}
|
|
17
|
+
const signature = await advisor.accept(account.address, args.feeBps);
|
|
18
|
+
accepted.push({ address: account.address, signature });
|
|
19
|
+
process.stderr.write(`[accept] ${account.address} → ${signature}\n`);
|
|
20
|
+
}
|
|
21
|
+
process.stdout.write(JSON.stringify({ accepted }, null, 2) + "\n");
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=accept.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"accept.js","sourceRoot":"","sources":["../../src/commands/accept.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,OAAsB,EACtB,IAA0C;IAE1C,6DAA6D;IAC7D,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,oBAAoB,EAAE,CAAC;IACtD,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO;QAC1B,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,KAAK,IAAI,CAAC,OAAO,CAAC;QACpD,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC;IAEnD,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACzB,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,GAAG,IAAI,CAAC,CAAC;QAC9D,OAAO;IACT,CAAC;IAED,MAAM,QAAQ,GAA6C,EAAE,CAAC;IAC9D,KAAK,MAAM,OAAO,IAAI,OAAO,EAAE,CAAC;QAC9B,IAAI,OAAO,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;YACjC,OAAO,CAAC,MAAM,CAAC,KAAK,CAClB,qBAAqB,OAAO,CAAC,OAAO,eAAe,OAAO,CAAC,MAAM,IAAI,CACtE,CAAC;YACF,SAAS;QACX,CAAC;QACD,MAAM,SAAS,GAAG,MAAM,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;QACrE,QAAQ,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,SAAS,EAAE,CAAC,CAAC;QACvD,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,YAAY,OAAO,CAAC,OAAO,MAAM,SAAS,IAAI,CAAC,CAAC;IACvE,CAAC;IAED,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,QAAQ,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;AACrE,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export async function executeCommand(advisor, args) {
|
|
2
|
+
const accounts = await advisor.listAdvisoryAccounts();
|
|
3
|
+
const candidateAccounts = args.advisoryAccount
|
|
4
|
+
? accounts.filter((a) => a.address === args.advisoryAccount)
|
|
5
|
+
: accounts.filter((a) => a.status === "active");
|
|
6
|
+
const executed = [];
|
|
7
|
+
const errors = [];
|
|
8
|
+
for (const account of candidateAccounts) {
|
|
9
|
+
const proposals = await advisor.listApprovedProposals(account.address);
|
|
10
|
+
for (const proposal of proposals) {
|
|
11
|
+
if (args.proposalAddress && proposal.address !== args.proposalAddress)
|
|
12
|
+
continue;
|
|
13
|
+
try {
|
|
14
|
+
const signature = await advisor.execute(proposal);
|
|
15
|
+
executed.push({ address: proposal.address, signature });
|
|
16
|
+
process.stderr.write(`[execute] ${proposal.address} → ${signature}\n`);
|
|
17
|
+
}
|
|
18
|
+
catch (err) {
|
|
19
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
20
|
+
errors.push({ address: proposal.address, error: message });
|
|
21
|
+
process.stderr.write(`[execute] ${proposal.address} FAILED: ${message}\n`);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
process.stdout.write(JSON.stringify({ executed, errors }, null, 2) + "\n");
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=execute.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"execute.js","sourceRoot":"","sources":["../../src/commands/execute.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,KAAK,UAAU,cAAc,CAClC,OAAsB,EACtB,IAA4D;IAE5D,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,oBAAoB,EAAE,CAAC;IACtD,MAAM,iBAAiB,GAAG,IAAI,CAAC,eAAe;QAC5C,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,KAAK,IAAI,CAAC,eAAe,CAAC;QAC5D,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,QAAQ,CAAC,CAAC;IAElD,MAAM,QAAQ,GAA6C,EAAE,CAAC;IAC9D,MAAM,MAAM,GAAyC,EAAE,CAAC;IAExD,KAAK,MAAM,OAAO,IAAI,iBAAiB,EAAE,CAAC;QACxC,MAAM,SAAS,GAAG,MAAM,OAAO,CAAC,qBAAqB,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QACvE,KAAK,MAAM,QAAQ,IAAI,SAAS,EAAE,CAAC;YACjC,IAAI,IAAI,CAAC,eAAe,IAAI,QAAQ,CAAC,OAAO,KAAK,IAAI,CAAC,eAAe;gBAAE,SAAS;YAChF,IAAI,CAAC;gBACH,MAAM,SAAS,GAAG,MAAM,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;gBAClD,QAAQ,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,QAAQ,CAAC,OAAO,EAAE,SAAS,EAAE,CAAC,CAAC;gBACxD,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,aAAa,QAAQ,CAAC,OAAO,MAAM,SAAS,IAAI,CAAC,CAAC;YACzE,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACb,MAAM,OAAO,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;gBACjE,MAAM,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,QAAQ,CAAC,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,CAAC;gBAC3D,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,aAAa,QAAQ,CAAC,OAAO,YAAY,OAAO,IAAI,CAAC,CAAC;YAC7E,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;AAC7E,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { cpSync, existsSync, mkdirSync, rmSync } from "node:fs";
|
|
2
|
+
import { homedir } from "node:os";
|
|
3
|
+
import { dirname, join, resolve } from "node:path";
|
|
4
|
+
import { fileURLToPath } from "node:url";
|
|
5
|
+
const DEFAULT_SKILLS_ROOT = join(homedir(), ".openclaw", "workspace", "skills");
|
|
6
|
+
const SKILL_NAME = "beluga-advisor";
|
|
7
|
+
export function installSkillCommand(args) {
|
|
8
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
9
|
+
// dist/commands/install-skill.js → dist/skill
|
|
10
|
+
const source = resolve(__dirname, "..", "skill");
|
|
11
|
+
if (!existsSync(source)) {
|
|
12
|
+
throw new Error(`Bundled skill not found at ${source}. Reinstall @belugafinancial/advisor-cli to repair.`);
|
|
13
|
+
}
|
|
14
|
+
const skillsRoot = args.destination ?? DEFAULT_SKILLS_ROOT;
|
|
15
|
+
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
|
+
}
|
|
20
|
+
rmSync(target, { recursive: true, force: true });
|
|
21
|
+
}
|
|
22
|
+
mkdirSync(skillsRoot, { recursive: true });
|
|
23
|
+
cpSync(source, target, { recursive: true });
|
|
24
|
+
process.stderr.write(`[install-skill] copied skill to ${target}\n`);
|
|
25
|
+
process.stdout.write(JSON.stringify({ installed: target, source }) + "\n");
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=install-skill.js.map
|
|
@@ -0,0 +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;AAOpC,MAAM,UAAU,mBAAmB,CAAC,IAAsB;IACxD,MAAM,SAAS,GAAG,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;IAC1D,8CAA8C;IAC9C,MAAM,MAAM,GAAG,OAAO,CAAC,SAAS,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;IACjD,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC;QACxB,MAAM,IAAI,KAAK,CACb,8BAA8B,MAAM,qDAAqD,CAC1F,CAAC;IACJ,CAAC;IAED,MAAM,UAAU,GAAG,IAAI,CAAC,WAAW,IAAI,mBAAmB,CAAC;IAC3D,MAAM,MAAM,GAAG,IAAI,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;IAE5C,IAAI,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC;QACvB,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC;YAChB,MAAM,IAAI,KAAK,CACb,GAAG,MAAM,6CAA6C,CACvD,CAAC;QACJ,CAAC;QACD,MAAM,CAAC,MAAM,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IACnD,CAAC;IAED,SAAS,CAAC,UAAU,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAC3C,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAE5C,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,mCAAmC,MAAM,IAAI,CAAC,CAAC;IACpE,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,GAAG,IAAI,CAAC,CAAC;AAC7E,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { BelugaAdvisor } from "@belugafinancial/advisor-sdk";
|
|
2
|
+
interface ProposeArgs {
|
|
3
|
+
advisoryAccount: string;
|
|
4
|
+
payloadFile?: string;
|
|
5
|
+
payloadJson?: string;
|
|
6
|
+
}
|
|
7
|
+
export declare function proposeCommand(advisor: BelugaAdvisor, args: ProposeArgs): Promise<void>;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { readFileSync } from "fs";
|
|
2
|
+
async function readPayload(args) {
|
|
3
|
+
if (args.payloadJson)
|
|
4
|
+
return JSON.parse(args.payloadJson);
|
|
5
|
+
if (args.payloadFile) {
|
|
6
|
+
const raw = args.payloadFile === "-"
|
|
7
|
+
? await readStdin()
|
|
8
|
+
: readFileSync(args.payloadFile, "utf-8");
|
|
9
|
+
return JSON.parse(raw);
|
|
10
|
+
}
|
|
11
|
+
// Default: read from stdin if nothing else specified.
|
|
12
|
+
return JSON.parse(await readStdin());
|
|
13
|
+
}
|
|
14
|
+
async function readStdin() {
|
|
15
|
+
const chunks = [];
|
|
16
|
+
for await (const chunk of process.stdin) {
|
|
17
|
+
chunks.push(chunk);
|
|
18
|
+
}
|
|
19
|
+
return Buffer.concat(chunks).toString("utf-8");
|
|
20
|
+
}
|
|
21
|
+
export async function proposeCommand(advisor, args) {
|
|
22
|
+
const accounts = await advisor.listAdvisoryAccounts();
|
|
23
|
+
const account = accounts.find((a) => a.address === args.advisoryAccount);
|
|
24
|
+
if (!account) {
|
|
25
|
+
throw new Error(`No advisory account found at ${args.advisoryAccount} for advisor ${advisor.pubkey.toBase58()}`);
|
|
26
|
+
}
|
|
27
|
+
if (account.status !== "active") {
|
|
28
|
+
throw new Error(`Advisory account ${account.address} is ${account.status}, not active.`);
|
|
29
|
+
}
|
|
30
|
+
const payload = await readPayload(args);
|
|
31
|
+
const result = await advisor.propose(account, payload);
|
|
32
|
+
process.stderr.write(`[propose] ${result.proposalAddress} → ${result.signature}\n`);
|
|
33
|
+
process.stdout.write(JSON.stringify(result, null, 2) + "\n");
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=propose.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"propose.js","sourceRoot":"","sources":["../../src/commands/propose.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AASlC,KAAK,UAAU,WAAW,CAAC,IAAiB;IAC1C,IAAI,IAAI,CAAC,WAAW;QAAE,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,WAAW,CAAoB,CAAC;IAC7E,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC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AM,WAAW,CAAC,IAAI,CAAC,CAAC;IACxC,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IACvD,OAAO,CAAC,MAAM,CAAC,KAAK,CAClB,aAAa,MAAM,CAAC,eAAe,MAAM,MAAM,CAAC,SAAS,IAAI,CAC9D,CAAC;IACF,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;AAC/D,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export async function statusCommand(advisor) {
|
|
2
|
+
const accounts = await advisor.listAdvisoryAccounts();
|
|
3
|
+
const enriched = await Promise.all(accounts.map(async (account) => {
|
|
4
|
+
const proposals = await advisor.listProposals(account.address);
|
|
5
|
+
return {
|
|
6
|
+
address: account.address,
|
|
7
|
+
owner: account.owner,
|
|
8
|
+
status: account.status,
|
|
9
|
+
feeBps: account.advisorFeeBps,
|
|
10
|
+
proposalCount: account.proposalCount,
|
|
11
|
+
proposals: {
|
|
12
|
+
pending: proposals.filter((p) => p.status === "pending").length,
|
|
13
|
+
approved: proposals.filter((p) => p.status === "approved").length,
|
|
14
|
+
executed: proposals.filter((p) => p.status === "executed").length,
|
|
15
|
+
rejected: proposals.filter((p) => p.status === "rejected").length,
|
|
16
|
+
},
|
|
17
|
+
approvedProposalAddresses: proposals
|
|
18
|
+
.filter((p) => p.status === "approved")
|
|
19
|
+
.map((p) => p.address),
|
|
20
|
+
};
|
|
21
|
+
}));
|
|
22
|
+
process.stdout.write(JSON.stringify({
|
|
23
|
+
advisor: advisor.pubkey.toBase58(),
|
|
24
|
+
x25519Pubkey: Buffer.from(advisor.x25519.publicKey).toString("base64"),
|
|
25
|
+
accounts: enriched,
|
|
26
|
+
}, null, 2) + "\n");
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=status.js.map
|
|
@@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AAC,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,YAAY,EAAE,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC;QACtE,QAAQ,EAAE,QAAQ;KACnB,EACD,IAAI,EACJ,CAAC,CACF,GAAG,IAAI,CAAC,CAAC;AACZ,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { BelugaAdvisor } from "@belugafinancial/advisor-sdk";
|
|
2
|
+
import type { CliEnv } from "../env.js";
|
|
3
|
+
export declare function watchStartCommand(advisor: BelugaAdvisor, env: CliEnv): Promise<void>;
|
|
4
|
+
export declare function watchStopCommand(): void;
|
|
5
|
+
export declare function watchStatusCommand(): void;
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { existsSync, mkdirSync, readFileSync, unlinkSync, writeFileSync } from "fs";
|
|
2
|
+
import { homedir } from "os";
|
|
3
|
+
import { join } from "path";
|
|
4
|
+
const STATE_DIR = join(homedir(), ".beluga-advisor");
|
|
5
|
+
const PID_FILE = join(STATE_DIR, "watch.pid");
|
|
6
|
+
function ensureStateDir() {
|
|
7
|
+
if (!existsSync(STATE_DIR))
|
|
8
|
+
mkdirSync(STATE_DIR, { recursive: true });
|
|
9
|
+
}
|
|
10
|
+
function readPid() {
|
|
11
|
+
if (!existsSync(PID_FILE))
|
|
12
|
+
return null;
|
|
13
|
+
const pid = parseInt(readFileSync(PID_FILE, "utf-8").trim(), 10);
|
|
14
|
+
if (!Number.isFinite(pid))
|
|
15
|
+
return null;
|
|
16
|
+
try {
|
|
17
|
+
process.kill(pid, 0);
|
|
18
|
+
return pid;
|
|
19
|
+
}
|
|
20
|
+
catch {
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
async function tick(advisor, env) {
|
|
25
|
+
const accounts = await advisor.listAdvisoryAccounts();
|
|
26
|
+
if (env.autoAccept) {
|
|
27
|
+
for (const account of accounts.filter((a) => a.status === "pending")) {
|
|
28
|
+
try {
|
|
29
|
+
const sig = await advisor.accept(account.address, env.acceptFeeBps);
|
|
30
|
+
process.stderr.write(`[watch] accepted ${account.address} (${sig})\n`);
|
|
31
|
+
}
|
|
32
|
+
catch (err) {
|
|
33
|
+
process.stderr.write(`[watch] accept ${account.address} failed: ${err instanceof Error ? err.message : err}\n`);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
if (env.autoExecute) {
|
|
38
|
+
for (const account of accounts.filter((a) => a.status === "active")) {
|
|
39
|
+
const proposals = await advisor.listApprovedProposals(account.address);
|
|
40
|
+
for (const proposal of proposals) {
|
|
41
|
+
try {
|
|
42
|
+
const sig = await advisor.execute(proposal);
|
|
43
|
+
process.stderr.write(`[watch] executed ${proposal.address} (${sig})\n`);
|
|
44
|
+
}
|
|
45
|
+
catch (err) {
|
|
46
|
+
process.stderr.write(`[watch] execute ${proposal.address} failed: ${err instanceof Error ? err.message : err}\n`);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
export async function watchStartCommand(advisor, env) {
|
|
53
|
+
ensureStateDir();
|
|
54
|
+
const existingPid = readPid();
|
|
55
|
+
if (existingPid) {
|
|
56
|
+
process.stdout.write(JSON.stringify({ alreadyRunning: true, pid: existingPid }) + "\n");
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
writeFileSync(PID_FILE, String(process.pid));
|
|
60
|
+
process.stderr.write(`[watch] started pid=${process.pid} interval=${env.watchIntervalMs}ms ` +
|
|
61
|
+
`auto_accept=${env.autoAccept} auto_execute=${env.autoExecute}\n`);
|
|
62
|
+
let stopping = false;
|
|
63
|
+
const cleanup = () => {
|
|
64
|
+
stopping = true;
|
|
65
|
+
if (existsSync(PID_FILE)) {
|
|
66
|
+
try {
|
|
67
|
+
unlinkSync(PID_FILE);
|
|
68
|
+
}
|
|
69
|
+
catch { /* ignore */ }
|
|
70
|
+
}
|
|
71
|
+
process.exit(0);
|
|
72
|
+
};
|
|
73
|
+
process.on("SIGINT", cleanup);
|
|
74
|
+
process.on("SIGTERM", cleanup);
|
|
75
|
+
while (!stopping) {
|
|
76
|
+
try {
|
|
77
|
+
await tick(advisor, env);
|
|
78
|
+
}
|
|
79
|
+
catch (err) {
|
|
80
|
+
process.stderr.write(`[watch] tick failed: ${err instanceof Error ? err.message : err}\n`);
|
|
81
|
+
}
|
|
82
|
+
await new Promise((resolve) => setTimeout(resolve, env.watchIntervalMs));
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
export function watchStopCommand() {
|
|
86
|
+
const pid = readPid();
|
|
87
|
+
if (!pid) {
|
|
88
|
+
if (existsSync(PID_FILE)) {
|
|
89
|
+
try {
|
|
90
|
+
unlinkSync(PID_FILE);
|
|
91
|
+
}
|
|
92
|
+
catch { /* ignore */ }
|
|
93
|
+
}
|
|
94
|
+
process.stdout.write(JSON.stringify({ stopped: false, reason: "not running" }) + "\n");
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
process.kill(pid, "SIGTERM");
|
|
98
|
+
process.stdout.write(JSON.stringify({ stopped: true, pid }) + "\n");
|
|
99
|
+
}
|
|
100
|
+
export function watchStatusCommand() {
|
|
101
|
+
const pid = readPid();
|
|
102
|
+
process.stdout.write(JSON.stringify({ running: Boolean(pid), pid: pid ?? null }) + "\n");
|
|
103
|
+
}
|
|
104
|
+
//# sourceMappingURL=watch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"watch.js","sourceRoot":"","sources":["../../src/commands/watch.ts"],"names":[],"mappings":"AAAA,OAAO,EA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 @@
|
|
|
1
|
+
import { BelugaAdvisor } from "@belugafinancial/advisor-sdk";
|
|
2
|
+
export interface CliEnv {
|
|
3
|
+
keypair: string;
|
|
4
|
+
rpcUrl: string;
|
|
5
|
+
programId: string;
|
|
6
|
+
watchIntervalMs: number;
|
|
7
|
+
autoAccept: boolean;
|
|
8
|
+
autoExecute: boolean;
|
|
9
|
+
acceptFeeBps: number;
|
|
10
|
+
}
|
|
11
|
+
export declare function loadEnv(): CliEnv;
|
|
12
|
+
export declare function buildAdvisor(env: CliEnv): BelugaAdvisor;
|
package/dist/env.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { BelugaAdvisor, BELUGA_PROGRAM_ID_MAINNET, } from "@belugafinancial/advisor-sdk";
|
|
2
|
+
export function loadEnv() {
|
|
3
|
+
const keypair = process.env.BELUGA_ADVISOR_KEYPAIR;
|
|
4
|
+
if (!keypair) {
|
|
5
|
+
throw new Error("BELUGA_ADVISOR_KEYPAIR is required (base64-encoded 64-byte ed25519 secret key).");
|
|
6
|
+
}
|
|
7
|
+
return {
|
|
8
|
+
keypair,
|
|
9
|
+
rpcUrl: process.env.SOLANA_RPC_URL || "https://api.mainnet-beta.solana.com",
|
|
10
|
+
programId: process.env.BELUGA_PROGRAM_ID || BELUGA_PROGRAM_ID_MAINNET,
|
|
11
|
+
watchIntervalMs: parseInt(process.env.BELUGA_WATCH_INTERVAL_MS || "30000", 10),
|
|
12
|
+
autoAccept: process.env.BELUGA_AUTO_ACCEPT !== "false",
|
|
13
|
+
autoExecute: process.env.BELUGA_AUTO_EXECUTE !== "false",
|
|
14
|
+
acceptFeeBps: parseInt(process.env.BELUGA_ACCEPT_FEE_BPS || "50", 10),
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
export function buildAdvisor(env) {
|
|
18
|
+
return new BelugaAdvisor({
|
|
19
|
+
keypair: env.keypair,
|
|
20
|
+
rpc: env.rpcUrl,
|
|
21
|
+
programId: env.programId,
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=env.js.map
|
package/dist/env.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"env.js","sourceRoot":"","sources":["../src/env.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,yBAAyB,GAC1B,MAAM,8BAA8B,CAAC;AAYtC,MAAM,UAAU,OAAO;IACrB,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,sBAAsB,CAAC;IACnD,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,KAAK,CACb,iFAAiF,CAClF,CAAC;IACJ,CAAC;IACD,OAAO;QACL,OAAO;QACP,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,cAAc,IAAI,qCAAqC;QAC3E,SAAS,EAAE,OAAO,CAAC,GAAG,CAAC,iBAAiB,IAAI,yBAAyB;QACrE,eAAe,EAAE,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,wBAAwB,IAAI,OAAO,EAAE,EAAE,CAAC;QAC9E,UAAU,EAAE,OAAO,CAAC,GAAG,CAAC,kBAAkB,KAAK,OAAO;QACtD,WAAW,EAAE,OAAO,CAAC,GAAG,CAAC,mBAAmB,KAAK,OAAO;QACxD,YAAY,EAAE,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,qBAAqB,IAAI,IAAI,EAAE,EAAE,CAAC;KACtE,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,GAAW;IACtC,OAAO,IAAI,aAAa,CAAC;QACvB,OAAO,EAAE,GAAG,CAAC,OAAO;QACpB,GAAG,EAAE,GAAG,CAAC,MAAM;QACf,SAAS,EAAE,GAAG,CAAC,SAAS;KACzB,CAAC,CAAC;AACL,CAAC"}
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { buildAdvisor, loadEnv } from "./env.js";
|
|
3
|
+
import { statusCommand } from "./commands/status.js";
|
|
4
|
+
import { acceptCommand } from "./commands/accept.js";
|
|
5
|
+
import { proposeCommand } from "./commands/propose.js";
|
|
6
|
+
import { executeCommand } from "./commands/execute.js";
|
|
7
|
+
import { installSkillCommand } from "./commands/install-skill.js";
|
|
8
|
+
import { watchStartCommand, watchStatusCommand, watchStopCommand, } from "./commands/watch.js";
|
|
9
|
+
const HELP = `beluga-advisor — operate a Beluga advisor account from the command line.
|
|
10
|
+
|
|
11
|
+
Usage:
|
|
12
|
+
beluga-advisor install-skill [--destination <dir>] [--force]
|
|
13
|
+
beluga-advisor status
|
|
14
|
+
beluga-advisor accept [<advisory-account-address>] [--fee-bps <n>]
|
|
15
|
+
beluga-advisor propose <advisory-account-address> [--payload <file|->] [--payload-json <json>]
|
|
16
|
+
beluga-advisor execute [<proposal-address>] [--account <advisory-account>]
|
|
17
|
+
beluga-advisor watch start
|
|
18
|
+
beluga-advisor watch stop
|
|
19
|
+
beluga-advisor watch status
|
|
20
|
+
beluga-advisor pubkey
|
|
21
|
+
|
|
22
|
+
Environment:
|
|
23
|
+
BELUGA_ADVISOR_KEYPAIR base64 64-byte ed25519 secret (required for all commands except install-skill)
|
|
24
|
+
SOLANA_RPC_URL RPC endpoint (default: mainnet-beta)
|
|
25
|
+
BELUGA_PROGRAM_ID program ID (default: mainnet)
|
|
26
|
+
BELUGA_WATCH_INTERVAL_MS watch tick interval in ms (default: 30000)
|
|
27
|
+
BELUGA_AUTO_ACCEPT auto-accept pending accounts in watch mode (default: true)
|
|
28
|
+
BELUGA_AUTO_EXECUTE auto-execute approved proposals in watch mode (default: true)
|
|
29
|
+
BELUGA_ACCEPT_FEE_BPS fee bps to charge when accepting (default: 50)
|
|
30
|
+
`;
|
|
31
|
+
function getFlag(argv, name) {
|
|
32
|
+
const i = argv.indexOf(`--${name}`);
|
|
33
|
+
return i >= 0 ? argv[i + 1] : undefined;
|
|
34
|
+
}
|
|
35
|
+
function getPositional(argv) {
|
|
36
|
+
const out = [];
|
|
37
|
+
for (let i = 0; i < argv.length; i++) {
|
|
38
|
+
const arg = argv[i];
|
|
39
|
+
if (arg.startsWith("--")) {
|
|
40
|
+
i++;
|
|
41
|
+
continue;
|
|
42
|
+
}
|
|
43
|
+
out.push(arg);
|
|
44
|
+
}
|
|
45
|
+
return out;
|
|
46
|
+
}
|
|
47
|
+
async function main() {
|
|
48
|
+
const argv = process.argv.slice(2);
|
|
49
|
+
if (argv.length === 0 || argv[0] === "--help" || argv[0] === "-h") {
|
|
50
|
+
process.stdout.write(HELP);
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
const command = argv[0];
|
|
54
|
+
const rest = argv.slice(1);
|
|
55
|
+
const positional = getPositional(rest);
|
|
56
|
+
// Commands that don't require a keypair / RPC connection.
|
|
57
|
+
if (command === "install-skill") {
|
|
58
|
+
return installSkillCommand({
|
|
59
|
+
destination: getFlag(rest, "destination"),
|
|
60
|
+
force: rest.includes("--force"),
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
const env = loadEnv();
|
|
64
|
+
const advisor = buildAdvisor(env);
|
|
65
|
+
switch (command) {
|
|
66
|
+
case "pubkey":
|
|
67
|
+
process.stdout.write(JSON.stringify({
|
|
68
|
+
pubkey: advisor.pubkey.toBase58(),
|
|
69
|
+
x25519Pubkey: Buffer.from(advisor.x25519.publicKey).toString("base64"),
|
|
70
|
+
}) + "\n");
|
|
71
|
+
return;
|
|
72
|
+
case "status":
|
|
73
|
+
await statusCommand(advisor);
|
|
74
|
+
return;
|
|
75
|
+
case "accept": {
|
|
76
|
+
const feeBps = parseInt(getFlag(rest, "fee-bps") ?? String(env.acceptFeeBps), 10);
|
|
77
|
+
await acceptCommand(advisor, { address: positional[0], feeBps });
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
case "propose": {
|
|
81
|
+
const advisoryAccount = positional[0];
|
|
82
|
+
if (!advisoryAccount)
|
|
83
|
+
throw new Error("propose: advisory account address required");
|
|
84
|
+
await proposeCommand(advisor, {
|
|
85
|
+
advisoryAccount,
|
|
86
|
+
payloadFile: getFlag(rest, "payload"),
|
|
87
|
+
payloadJson: getFlag(rest, "payload-json"),
|
|
88
|
+
});
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
case "execute":
|
|
92
|
+
await executeCommand(advisor, {
|
|
93
|
+
proposalAddress: positional[0],
|
|
94
|
+
advisoryAccount: getFlag(rest, "account"),
|
|
95
|
+
});
|
|
96
|
+
return;
|
|
97
|
+
case "watch": {
|
|
98
|
+
const sub = positional[0];
|
|
99
|
+
if (sub === "start")
|
|
100
|
+
return watchStartCommand(advisor, env);
|
|
101
|
+
if (sub === "stop")
|
|
102
|
+
return watchStopCommand();
|
|
103
|
+
if (sub === "status")
|
|
104
|
+
return watchStatusCommand();
|
|
105
|
+
throw new Error(`Unknown watch subcommand: ${sub}`);
|
|
106
|
+
}
|
|
107
|
+
default:
|
|
108
|
+
process.stderr.write(`Unknown command: ${command}\n\n${HELP}`);
|
|
109
|
+
process.exit(2);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
main().catch((err) => {
|
|
113
|
+
process.stderr.write(`error: ${err instanceof Error ? err.message : String(err)}\n`);
|
|
114
|
+
process.exit(1);
|
|
115
|
+
});
|
|
116
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +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,sBAAsB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AACl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AAC;AAClB,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: beluga-advisor
|
|
3
|
+
description: Operate a Beluga advisor account on Solana — accept advisory accounts, build encrypted swap proposals on client vaults, and execute approved proposals. Use whenever the user wants to act as an advisor on a Beluga vault, propose trades for a client, check pending or approved proposals, or run an automated watcher that handles the boring parts of the lifecycle.
|
|
4
|
+
metadata:
|
|
5
|
+
openclaw:
|
|
6
|
+
requires:
|
|
7
|
+
bins: [beluga-advisor]
|
|
8
|
+
env: [BELUGA_ADVISOR_KEYPAIR]
|
|
9
|
+
install:
|
|
10
|
+
node:
|
|
11
|
+
package: "@belugafinancial/advisor-cli"
|
|
12
|
+
bin: beluga-advisor
|
|
13
|
+
primaryEnv: BELUGA_ADVISOR_KEYPAIR
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
# Beluga Advisor
|
|
17
|
+
|
|
18
|
+
Beluga is a Solana investment advisory platform. Advisors propose swaps on
|
|
19
|
+
client vaults; clients approve or reject them. The on-chain program handles
|
|
20
|
+
custody, fees, and execution via Raydium AMMs.
|
|
21
|
+
|
|
22
|
+
This skill lets the host agent act as an advisor: accept advisory account
|
|
23
|
+
invitations, build encrypted swap proposals against a client's vault, and
|
|
24
|
+
execute proposals that the client has approved.
|
|
25
|
+
|
|
26
|
+
## When to invoke
|
|
27
|
+
|
|
28
|
+
- The user asks to check on Beluga clients, advisory accounts, vault balances,
|
|
29
|
+
or pending/approved proposals.
|
|
30
|
+
- The user describes a trade they want to suggest to a Beluga client and the
|
|
31
|
+
trade involves a Raydium-listed token.
|
|
32
|
+
- The user wants to run a background watcher that auto-accepts new advisory
|
|
33
|
+
accounts and auto-executes approved proposals.
|
|
34
|
+
- The agent is operating autonomously on a Beluga deployment and needs to
|
|
35
|
+
handle the lifecycle of advisory accounts.
|
|
36
|
+
|
|
37
|
+
## Setup
|
|
38
|
+
|
|
39
|
+
1. Generate or supply a Solana keypair. Set the base64 64-byte secret as
|
|
40
|
+
`BELUGA_ADVISOR_KEYPAIR` in the skill config.
|
|
41
|
+
2. Optionally set `SOLANA_RPC_URL` (defaults to mainnet-beta) and
|
|
42
|
+
`BELUGA_PROGRAM_ID` (defaults to mainnet program).
|
|
43
|
+
3. Run `beluga-advisor pubkey` to print the advisor pubkey. This is the
|
|
44
|
+
address the client will invite via the Beluga app:
|
|
45
|
+
`https://app.beluga.financial/invite?advisor=<pubkey>`.
|
|
46
|
+
|
|
47
|
+
## Commands
|
|
48
|
+
|
|
49
|
+
All commands print JSON to stdout and human-readable status to stderr.
|
|
50
|
+
|
|
51
|
+
### Inspect state
|
|
52
|
+
|
|
53
|
+
```
|
|
54
|
+
beluga-advisor status
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Returns the advisor's advisory accounts (pending and active), their proposal
|
|
58
|
+
counts, and the addresses of any approved proposals waiting to be executed.
|
|
59
|
+
Run this first whenever the user asks "what's going on" or you need to know
|
|
60
|
+
which clients have what state.
|
|
61
|
+
|
|
62
|
+
### Accept a pending advisory account
|
|
63
|
+
|
|
64
|
+
```
|
|
65
|
+
beluga-advisor accept # accept ALL pending accounts
|
|
66
|
+
beluga-advisor accept <advisory-account> # accept a specific one
|
|
67
|
+
beluga-advisor accept --fee-bps 75 # override default 50bps fee
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
When a client invites this advisor, an advisory account appears with status
|
|
71
|
+
`pending`. Accepting locks in the fee and activates the relationship.
|
|
72
|
+
|
|
73
|
+
### Propose a swap
|
|
74
|
+
|
|
75
|
+
```
|
|
76
|
+
beluga-advisor propose <advisory-account> --payload-json '<json>'
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
The payload JSON shape is:
|
|
80
|
+
|
|
81
|
+
```json
|
|
82
|
+
{
|
|
83
|
+
"rationale": "Short reason shown to the client.",
|
|
84
|
+
"amount": 1000000,
|
|
85
|
+
"other_amount_threshold": 950000,
|
|
86
|
+
"amount_specified_is_input": true,
|
|
87
|
+
"a_to_b": true,
|
|
88
|
+
"pool": "<raydium-pool-address>",
|
|
89
|
+
"token_mint_a": "<mint-a>",
|
|
90
|
+
"token_mint_b": "<mint-b>",
|
|
91
|
+
"pool_type": "cpmm"
|
|
92
|
+
}
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
- `amount` and `other_amount_threshold` are in raw token units (lamports for
|
|
96
|
+
SOL, microUSDC for USDC, etc.). The agent must look up token decimals before
|
|
97
|
+
building the payload.
|
|
98
|
+
- `a_to_b: true` means swap mint_a → mint_b. `amount_specified_is_input: true`
|
|
99
|
+
means `amount` is the input amount; `other_amount_threshold` is the minimum
|
|
100
|
+
acceptable output (slippage protection).
|
|
101
|
+
- `pool_type` is `"cpmm"` for Raydium constant-product or `"clmm"` for
|
|
102
|
+
concentrated-liquidity pools.
|
|
103
|
+
- `rationale` is encrypted and shown to the client only — keep it concise
|
|
104
|
+
(under ~200 chars) since the on-chain envelope is capped at 512 bytes.
|
|
105
|
+
|
|
106
|
+
The proposal is encrypted with the client's x25519 public key (read from the
|
|
107
|
+
advisory account on-chain) so only the client and this advisor can decrypt it.
|
|
108
|
+
|
|
109
|
+
### Execute approved proposals
|
|
110
|
+
|
|
111
|
+
```
|
|
112
|
+
beluga-advisor execute # execute ALL approved
|
|
113
|
+
beluga-advisor execute <proposal-address> # execute one
|
|
114
|
+
beluga-advisor execute --account <advisory-account> # all approved on one client
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
Once a client approves a proposal in the Beluga app, the advisor can execute
|
|
118
|
+
it. The CLI handles vault initialization and Raydium routing automatically.
|
|
119
|
+
|
|
120
|
+
### Watch mode (long-running)
|
|
121
|
+
|
|
122
|
+
```
|
|
123
|
+
beluga-advisor watch start # spawn background daemon
|
|
124
|
+
beluga-advisor watch status # is it running?
|
|
125
|
+
beluga-advisor watch stop # kill the daemon
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
The watcher polls every 30 seconds (configurable via `BELUGA_WATCH_INTERVAL_MS`)
|
|
129
|
+
and, by default, auto-accepts pending advisory accounts and auto-executes any
|
|
130
|
+
proposals the client has approved. It does NOT auto-propose — proposing is
|
|
131
|
+
left to the host agent's strategy logic.
|
|
132
|
+
|
|
133
|
+
To opt out of either behavior, set `BELUGA_AUTO_ACCEPT=false` or
|
|
134
|
+
`BELUGA_AUTO_EXECUTE=false` in the skill config.
|
|
135
|
+
|
|
136
|
+
The watcher is a detached child process. Its PID lives at
|
|
137
|
+
`~/.beluga-advisor/watch.pid`; if it exits unexpectedly, the file is cleaned
|
|
138
|
+
up on next `watch status`.
|
|
139
|
+
|
|
140
|
+
## Concurrency
|
|
141
|
+
|
|
142
|
+
The CLI's one-shot commands and the watcher can both run safely against the
|
|
143
|
+
same advisor. Already-executed proposals fail idempotently on-chain (the
|
|
144
|
+
program rejects double-execution), so a race between the two only produces a
|
|
145
|
+
harmless failed transaction.
|
|
146
|
+
|
|
147
|
+
## Trust model
|
|
148
|
+
|
|
149
|
+
- The advisor's keypair only authorizes proposing and executing swaps within
|
|
150
|
+
the limits enforced by the on-chain program. It cannot withdraw funds.
|
|
151
|
+
- The client retains custody of vault assets and must approve every proposal
|
|
152
|
+
before it is executable.
|
|
153
|
+
- Encrypted proposal payloads are decryptable by the advisor and the client
|
|
154
|
+
only — not by anyone observing the chain.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"skills": {
|
|
3
|
+
"entries": {
|
|
4
|
+
"beluga-advisor": {
|
|
5
|
+
"enabled": true,
|
|
6
|
+
"apiKey": {
|
|
7
|
+
"source": "env",
|
|
8
|
+
"provider": "default",
|
|
9
|
+
"id": "BELUGA_ADVISOR_KEYPAIR"
|
|
10
|
+
},
|
|
11
|
+
"env": {
|
|
12
|
+
"BELUGA_ADVISOR_KEYPAIR": "<base64-64-byte-secret>",
|
|
13
|
+
"SOLANA_RPC_URL": "https://api.mainnet-beta.solana.com",
|
|
14
|
+
"BELUGA_PROGRAM_ID": "8A3VegJ9k5mcXr1AeXgGD4Zr6XrAdyWnNiCK1AUTidey"
|
|
15
|
+
},
|
|
16
|
+
"config": {
|
|
17
|
+
"auto_accept": true,
|
|
18
|
+
"auto_execute": true,
|
|
19
|
+
"watch_interval_ms": 30000,
|
|
20
|
+
"accept_fee_bps": 50
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@belugafinancial/advisor-cli",
|
|
3
|
+
"version": "0.1.0",
|
|
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
|
+
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/lionfi-sh/ross.git",
|
|
9
|
+
"directory": "packages/advisor-cli"
|
|
10
|
+
},
|
|
11
|
+
"homepage": "https://docs.beluga.financial/guides/openclaw-integration/",
|
|
12
|
+
"type": "module",
|
|
13
|
+
"main": "./dist/index.js",
|
|
14
|
+
"bin": {
|
|
15
|
+
"beluga-advisor": "./dist/index.js"
|
|
16
|
+
},
|
|
17
|
+
"files": ["dist"],
|
|
18
|
+
"publishConfig": {
|
|
19
|
+
"access": "public"
|
|
20
|
+
},
|
|
21
|
+
"scripts": {
|
|
22
|
+
"build": "tsc && node scripts/copy-skill.mjs",
|
|
23
|
+
"prepublishOnly": "npm run build"
|
|
24
|
+
},
|
|
25
|
+
"dependencies": {
|
|
26
|
+
"@belugafinancial/advisor-sdk": "^0.1.0",
|
|
27
|
+
"@solana/web3.js": "^1.98.0"
|
|
28
|
+
},
|
|
29
|
+
"devDependencies": {
|
|
30
|
+
"@types/node": "^22.0.0",
|
|
31
|
+
"typescript": "^5.7.0"
|
|
32
|
+
}
|
|
33
|
+
}
|