@mnemom/mnemom 0.7.0 → 0.7.1
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/index.js +0 -0
- package/package.json +1 -1
- package/dist/commands/claim.d.ts +0 -1
- package/dist/commands/claim.js +0 -72
package/dist/index.js
CHANGED
|
File without changes
|
package/package.json
CHANGED
package/dist/commands/claim.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function claimCommand(agentName?: string): Promise<void>;
|
package/dist/commands/claim.js
DELETED
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import * as crypto from "node:crypto";
|
|
2
|
-
import { configExists, loadConfig, getActiveAgent } from "../lib/config.js";
|
|
3
|
-
import { detectOpenClaw } from "../lib/openclaw.js";
|
|
4
|
-
import { claimAgent } from "../lib/api.js";
|
|
5
|
-
import { fmt } from "../lib/format.js";
|
|
6
|
-
const DASHBOARD_URL = "https://mnemom.ai";
|
|
7
|
-
export async function claimCommand(agentName) {
|
|
8
|
-
console.log(fmt.header("smoltbot claim - Link agent to your Mnemom account"));
|
|
9
|
-
console.log();
|
|
10
|
-
// Step 1: Check smoltbot config exists
|
|
11
|
-
if (!configExists()) {
|
|
12
|
-
console.log(fmt.error("smoltbot is not initialized") + "\n");
|
|
13
|
-
console.log("Run `smoltbot init` first.\n");
|
|
14
|
-
process.exit(1);
|
|
15
|
-
}
|
|
16
|
-
const config = loadConfig();
|
|
17
|
-
if (!config) {
|
|
18
|
-
console.log(fmt.error("Could not load smoltbot config") + "\n");
|
|
19
|
-
console.log("Run `smoltbot init` to reconfigure.\n");
|
|
20
|
-
process.exit(1);
|
|
21
|
-
}
|
|
22
|
-
const agent = getActiveAgent(agentName);
|
|
23
|
-
if (!agent) {
|
|
24
|
-
console.log(fmt.error(`Agent not found${agentName ? `: ${agentName}` : ""}`) + "\n");
|
|
25
|
-
process.exit(1);
|
|
26
|
-
}
|
|
27
|
-
console.log(fmt.label("Agent ID:", ` ${agent.agentId}`) + "\n");
|
|
28
|
-
// Step 2: Read API key from OpenClaw
|
|
29
|
-
const detection = detectOpenClaw();
|
|
30
|
-
if (!detection.hasApiKey || !detection.apiKey) {
|
|
31
|
-
console.log(fmt.error("No API key found") + "\n");
|
|
32
|
-
console.log(detection.error || "Run `openclaw auth` to configure your API key.\n");
|
|
33
|
-
process.exit(1);
|
|
34
|
-
}
|
|
35
|
-
// Step 3: Compute SHA-256 hash proof
|
|
36
|
-
console.log("Computing ownership proof...");
|
|
37
|
-
const hashProof = crypto
|
|
38
|
-
.createHash("sha256")
|
|
39
|
-
.update(detection.apiKey)
|
|
40
|
-
.digest("hex");
|
|
41
|
-
// Step 4: Claim via API
|
|
42
|
-
console.log("Claiming agent...\n");
|
|
43
|
-
try {
|
|
44
|
-
const result = await claimAgent(agent.agentId, hashProof);
|
|
45
|
-
console.log(fmt.success("Agent claimed successfully!") + "\n");
|
|
46
|
-
console.log(` Claimed at: ${new Date(result.claimed_at).toLocaleString()}\n`);
|
|
47
|
-
console.log(fmt.section("Next: Create a Mnemom account to link your agent"));
|
|
48
|
-
console.log(`\n Visit: ${DASHBOARD_URL}/claim/${agent.agentId}\n`);
|
|
49
|
-
console.log(" This lets you manage traces privately and access");
|
|
50
|
-
console.log(" your full transparency dashboard.\n");
|
|
51
|
-
console.log(fmt.label("Dashboard:", ` ${DASHBOARD_URL}/agents/${agent.agentId}`) + "\n");
|
|
52
|
-
}
|
|
53
|
-
catch (error) {
|
|
54
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
55
|
-
if (message.includes("already been claimed")) {
|
|
56
|
-
console.log("Agent has already been claimed.\n");
|
|
57
|
-
console.log(` Dashboard: ${DASHBOARD_URL}/agents/${agent.agentId}\n`);
|
|
58
|
-
console.log(" If this is your agent, sign in at:");
|
|
59
|
-
console.log(` ${DASHBOARD_URL}/login\n`);
|
|
60
|
-
}
|
|
61
|
-
else if (message.includes("not found")) {
|
|
62
|
-
console.log(fmt.error("Agent not found on server") + "\n");
|
|
63
|
-
console.log(" Your agent will be registered after its first traced API call.");
|
|
64
|
-
console.log(" Make sure you're using a smoltbot model:\n");
|
|
65
|
-
console.log(" openclaw models set smoltbot/<model-id>\n");
|
|
66
|
-
}
|
|
67
|
-
else {
|
|
68
|
-
console.log(fmt.error(`Claim failed: ${message}`) + "\n");
|
|
69
|
-
}
|
|
70
|
-
process.exit(1);
|
|
71
|
-
}
|
|
72
|
-
}
|