@sherwoodagent/cli 0.87.1 → 0.88.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/{chunk-VYCLG5DE.js → chunk-HMFPP2PE.js} +46 -2
- package/dist/chunk-HMFPP2PE.js.map +1 -0
- package/dist/{chunk-SI65QHTY.js → chunk-SCQAKMMI.js} +117 -36
- package/dist/chunk-SCQAKMMI.js.map +1 -0
- package/dist/{eas-DV3Z7AT3.js → eas-B4HR2HXX.js} +6 -2
- package/dist/{identity-M4TXM7EX.js → identity-I2BG4IGT.js} +3 -3
- package/dist/index.js +8 -8
- package/dist/{research-44GHYE4H.js → research-T7A27OMB.js} +2 -2
- package/dist/{trade-FO52SP62.js → trade-ZOVM433K.js} +3 -3
- package/package.json +2 -2
- package/dist/chunk-SI65QHTY.js.map +0 -1
- package/dist/chunk-VYCLG5DE.js.map +0 -1
- /package/dist/{eas-DV3Z7AT3.js.map → eas-B4HR2HXX.js.map} +0 -0
- /package/dist/{identity-M4TXM7EX.js.map → identity-I2BG4IGT.js.map} +0 -0
- /package/dist/{research-44GHYE4H.js.map → research-T7A27OMB.js.map} +0 -0
- /package/dist/{trade-FO52SP62.js.map → trade-ZOVM433K.js.map} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
COORDINATION_NETWORK
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-SCQAKMMI.js";
|
|
4
4
|
import {
|
|
5
5
|
AGENT_REGISTRY
|
|
6
6
|
} from "./chunk-FWQESFFM.js";
|
|
@@ -34,6 +34,33 @@ import chalk from "chalk";
|
|
|
34
34
|
import ora from "ora";
|
|
35
35
|
import { SDK } from "agent0-sdk";
|
|
36
36
|
|
|
37
|
+
// src/lib/identity-mirror.ts
|
|
38
|
+
var METADATA_API_URL = process.env.SHERWOOD_METADATA_API_URL ?? "https://sherwood-metadata-api-production.up.railway.app";
|
|
39
|
+
var PUBLISH_TIMEOUT_MS = 8e3;
|
|
40
|
+
async function publishIdentityLink(params) {
|
|
41
|
+
const base2 = (params.baseUrl ?? METADATA_API_URL).replace(/\/+$/, "");
|
|
42
|
+
const doFetch = params.fetchImpl ?? fetch;
|
|
43
|
+
try {
|
|
44
|
+
const res = await doFetch(`${base2}/v1/identities?chain=${params.fundChainId}`, {
|
|
45
|
+
method: "POST",
|
|
46
|
+
headers: { "content-type": "application/json" },
|
|
47
|
+
body: JSON.stringify({
|
|
48
|
+
sherwoodWallet: params.wallet,
|
|
49
|
+
identityWallet: params.wallet,
|
|
50
|
+
erc8004ChainId: params.issuingChainId,
|
|
51
|
+
erc8004TokenId: params.tokenId.toString(),
|
|
52
|
+
bindingSig: null
|
|
53
|
+
}),
|
|
54
|
+
signal: AbortSignal.timeout(PUBLISH_TIMEOUT_MS)
|
|
55
|
+
});
|
|
56
|
+
if (res.ok) return { ok: true };
|
|
57
|
+
const detail = await res.text().catch(() => "");
|
|
58
|
+
return { ok: false, reason: `${res.status}${detail ? ` ${detail.slice(0, 200)}` : ""}` };
|
|
59
|
+
} catch (err) {
|
|
60
|
+
return { ok: false, reason: err instanceof Error ? err.message : String(err) };
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
37
64
|
// src/lib/virtuals.ts
|
|
38
65
|
import { execFile } from "child_process";
|
|
39
66
|
import { promisify } from "util";
|
|
@@ -2480,6 +2507,21 @@ async function readIdentityMetadata(tokenId) {
|
|
|
2480
2507
|
return null;
|
|
2481
2508
|
}
|
|
2482
2509
|
}
|
|
2510
|
+
async function announceIdentityToMirror(wallet, tokenId) {
|
|
2511
|
+
const fundChainId = getChain().id;
|
|
2512
|
+
const result = await publishIdentityLink({
|
|
2513
|
+
wallet,
|
|
2514
|
+
tokenId,
|
|
2515
|
+
issuingChainId: COORDINATION_CHAIN_ID,
|
|
2516
|
+
fundChainId
|
|
2517
|
+
});
|
|
2518
|
+
if (result.ok) {
|
|
2519
|
+
console.log(chalk.dim(` Published to the metadata mirror (chain ${fundChainId})`));
|
|
2520
|
+
return;
|
|
2521
|
+
}
|
|
2522
|
+
console.log(chalk.yellow(` Could not publish to the metadata mirror: ${result.reason}`));
|
|
2523
|
+
console.log(chalk.dim(" Harmless \u2014 the mirror discovers unpublished identities on its own."));
|
|
2524
|
+
}
|
|
2483
2525
|
function registerIdentityCommands(program) {
|
|
2484
2526
|
const identity = program.command("identity").description("Manage ERC-8004 agent identity (on Robinhood mainnet, chain 4663)");
|
|
2485
2527
|
identity.command("mint").description("Register a new ERC-8004 agent identity (required before creating/joining vaults)").requiredOption("--name <name>", "Agent name (e.g. 'Alpha Seeker Agent')").option("--description <desc>", "Agent description", "Sherwood vault agent").option("--image <uri>", "Agent image URI (IPFS recommended)").action(async (opts) => {
|
|
@@ -2539,6 +2581,7 @@ function registerIdentityCommands(program) {
|
|
|
2539
2581
|
console.log(chalk.dim(` Name: ${opts.name}`));
|
|
2540
2582
|
console.log(chalk.dim(` Owner: ${account.address}`));
|
|
2541
2583
|
console.log(chalk.dim(` Saved to ~/.sherwood/config.json`));
|
|
2584
|
+
await announceIdentityToMirror(account.address, tokenId);
|
|
2542
2585
|
console.log();
|
|
2543
2586
|
console.log(chalk.green("You can now create vaults:"));
|
|
2544
2587
|
console.log(chalk.dim(` sherwood vault create --agent-id ${tokenId} --subdomain <name> --name <name>`));
|
|
@@ -2570,6 +2613,7 @@ function registerIdentityCommands(program) {
|
|
|
2570
2613
|
spinner.succeed(`Agent #${tokenId} loaded and saved to config`);
|
|
2571
2614
|
console.log(chalk.dim(` Owner: ${account.address}`));
|
|
2572
2615
|
console.log(chalk.dim(` Saved to ~/.sherwood/config.json`));
|
|
2616
|
+
await announceIdentityToMirror(account.address, tokenId);
|
|
2573
2617
|
} catch (err) {
|
|
2574
2618
|
spinner.fail("Failed to load identity");
|
|
2575
2619
|
console.error(chalk.red(formatContractError(err)));
|
|
@@ -2951,4 +2995,4 @@ export {
|
|
|
2951
2995
|
lookupAgentIdByWallet,
|
|
2952
2996
|
registerIdentityCommands
|
|
2953
2997
|
};
|
|
2954
|
-
//# sourceMappingURL=chunk-
|
|
2998
|
+
//# sourceMappingURL=chunk-HMFPP2PE.js.map
|