@sherwoodagent/cli 0.25.2 → 0.25.3
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/{chat-MYRUIM54.js → chat-DRKUZCOY.js} +4 -4
- package/dist/{chunk-L5RWZSET.js → chunk-4WG64CRK.js} +2 -2
- package/dist/{chunk-2SNPCWB4.js → chunk-6DWQIKGN.js} +2 -2
- package/dist/{chunk-2UP63CYI.js → chunk-H55III3L.js} +2 -2
- package/dist/{chunk-O7QIRMJO.js → chunk-ICUQY7TY.js} +9 -1
- package/dist/chunk-ICUQY7TY.js.map +1 -0
- package/dist/{chunk-G6LOQCM3.js → chunk-Y7LUFGIS.js} +12 -2
- package/dist/chunk-Y7LUFGIS.js.map +1 -0
- package/dist/{eas-DGLNPNWX.js → eas-652I6ULB.js} +3 -3
- package/dist/{governor-3PINJ2X2.js → governor-CY3GXU44.js} +3 -3
- package/dist/index.js +144 -17
- package/dist/index.js.map +1 -1
- package/dist/{price-76BEXJDI.js → price-FOCSYKGJ.js} +2 -2
- package/dist/{research-FIX3U4LG.js → research-LJKYDBCL.js} +3 -3
- package/dist/{session-6DJ4A2Q3.js → session-7HKFQ7JZ.js} +5 -5
- package/dist/{trade-MDVM4XFF.js → trade-4SOHHD5R.js} +6 -6
- package/dist/{xmtp-64CYLVLO.js → xmtp-K555NJPU.js} +3 -3
- package/package.json +1 -1
- package/dist/chunk-G6LOQCM3.js.map +0 -1
- package/dist/chunk-O7QIRMJO.js.map +0 -1
- /package/dist/{chat-MYRUIM54.js.map → chat-DRKUZCOY.js.map} +0 -0
- /package/dist/{chunk-L5RWZSET.js.map → chunk-4WG64CRK.js.map} +0 -0
- /package/dist/{chunk-2SNPCWB4.js.map → chunk-6DWQIKGN.js.map} +0 -0
- /package/dist/{chunk-2UP63CYI.js.map → chunk-H55III3L.js.map} +0 -0
- /package/dist/{eas-DGLNPNWX.js.map → eas-652I6ULB.js.map} +0 -0
- /package/dist/{governor-3PINJ2X2.js.map → governor-CY3GXU44.js.map} +0 -0
- /package/dist/{price-76BEXJDI.js.map → price-FOCSYKGJ.js.map} +0 -0
- /package/dist/{research-FIX3U4LG.js.map → research-LJKYDBCL.js.map} +0 -0
- /package/dist/{session-6DJ4A2Q3.js.map → session-7HKFQ7JZ.js.map} +0 -0
- /package/dist/{trade-MDVM4XFF.js.map → trade-4SOHHD5R.js.map} +0 -0
- /package/dist/{xmtp-64CYLVLO.js.map → xmtp-K555NJPU.js.map} +0 -0
package/dist/index.js
CHANGED
|
@@ -4,11 +4,13 @@ import {
|
|
|
4
4
|
deposit,
|
|
5
5
|
depositWithEthWrap,
|
|
6
6
|
executeBatch,
|
|
7
|
+
getAssetAddress,
|
|
7
8
|
getAssetDecimals,
|
|
8
9
|
getBalance,
|
|
9
10
|
getShareBalance,
|
|
10
11
|
getVaultAddress,
|
|
11
12
|
getVaultInfo,
|
|
13
|
+
getVaultOwner,
|
|
12
14
|
isAgent,
|
|
13
15
|
preflightDeposit,
|
|
14
16
|
preflightRedeem,
|
|
@@ -19,7 +21,7 @@ import {
|
|
|
19
21
|
resolveVaultSyndicate,
|
|
20
22
|
setTextRecord,
|
|
21
23
|
setVaultAddress
|
|
22
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-Y7LUFGIS.js";
|
|
23
25
|
import {
|
|
24
26
|
UniswapProvider,
|
|
25
27
|
applySlippage,
|
|
@@ -30,7 +32,7 @@ import {
|
|
|
30
32
|
getQuote,
|
|
31
33
|
listModels,
|
|
32
34
|
provisionApiKey
|
|
33
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-4WG64CRK.js";
|
|
34
36
|
import {
|
|
35
37
|
PROPOSAL_STATE,
|
|
36
38
|
PROPOSAL_STATES,
|
|
@@ -39,6 +41,7 @@ import {
|
|
|
39
41
|
emergencyCancel,
|
|
40
42
|
emergencySettle,
|
|
41
43
|
executeProposal,
|
|
44
|
+
getActiveProposal,
|
|
42
45
|
getCapitalSnapshot,
|
|
43
46
|
getExecuteCalls,
|
|
44
47
|
getGovernorAddress,
|
|
@@ -61,7 +64,7 @@ import {
|
|
|
61
64
|
setVotingPeriod,
|
|
62
65
|
settleProposal,
|
|
63
66
|
vote
|
|
64
|
-
} from "./chunk-
|
|
67
|
+
} from "./chunk-H55III3L.js";
|
|
65
68
|
import {
|
|
66
69
|
fetchMetadata,
|
|
67
70
|
uploadMetadata
|
|
@@ -75,7 +78,7 @@ import {
|
|
|
75
78
|
queryJoinRequests,
|
|
76
79
|
revokeAttestation,
|
|
77
80
|
stripReferrerPrefix
|
|
78
|
-
} from "./chunk-
|
|
81
|
+
} from "./chunk-6DWQIKGN.js";
|
|
79
82
|
import {
|
|
80
83
|
AERODROME,
|
|
81
84
|
AGENT_REGISTRY,
|
|
@@ -96,7 +99,7 @@ import {
|
|
|
96
99
|
UNISWAP,
|
|
97
100
|
VENICE,
|
|
98
101
|
VENICE_STAKING_ABI
|
|
99
|
-
} from "./chunk-
|
|
102
|
+
} from "./chunk-ICUQY7TY.js";
|
|
100
103
|
import {
|
|
101
104
|
formatContractError,
|
|
102
105
|
getAccount,
|
|
@@ -1296,9 +1299,9 @@ function registerStrategyTemplateCommands(strategy2) {
|
|
|
1296
1299
|
console.error(chalk.red("Missing --name, --performance-fee, or --duration. Use --write-calls to skip proposal submission."));
|
|
1297
1300
|
process.exit(1);
|
|
1298
1301
|
}
|
|
1299
|
-
const { propose: propose2 } = await import("./governor-
|
|
1302
|
+
const { propose: propose2 } = await import("./governor-CY3GXU44.js");
|
|
1300
1303
|
const { pinJSON } = await import("./ipfs-22YLNQ2C.js");
|
|
1301
|
-
const { parseDuration: parseDuration2 } = await import("./governor-
|
|
1304
|
+
const { parseDuration: parseDuration2 } = await import("./governor-CY3GXU44.js");
|
|
1302
1305
|
const performanceFeeBps = BigInt(opts.performanceFee);
|
|
1303
1306
|
if (performanceFeeBps < 0n || performanceFeeBps > 10000n) {
|
|
1304
1307
|
console.error(chalk.red("--performance-fee must be 0-10000 (basis points)"));
|
|
@@ -1406,7 +1409,7 @@ function registerStrategyTemplateCommands(strategy2) {
|
|
|
1406
1409
|
let prices = [];
|
|
1407
1410
|
let priceSource = null;
|
|
1408
1411
|
try {
|
|
1409
|
-
const { getTokenPricesInAsset } = await import("./price-
|
|
1412
|
+
const { getTokenPricesInAsset } = await import("./price-FOCSYKGJ.js");
|
|
1410
1413
|
prices = await getTokenPricesInAsset({
|
|
1411
1414
|
tokens: allocations.map((a, i) => ({
|
|
1412
1415
|
token: a.token,
|
|
@@ -1953,7 +1956,7 @@ function registerVeniceCommands(program2) {
|
|
|
1953
1956
|
console.log(chalk2.dim(` Key: ${apiKey.slice(0, 8)}...${apiKey.slice(-4)}`));
|
|
1954
1957
|
console.log(chalk2.dim(" Saved to ~/.sherwood/config.json"));
|
|
1955
1958
|
try {
|
|
1956
|
-
const { createVeniceProvisionAttestation, getEasScanUrl: getEasScanUrl2 } = await import("./eas-
|
|
1959
|
+
const { createVeniceProvisionAttestation, getEasScanUrl: getEasScanUrl2 } = await import("./eas-652I6ULB.js");
|
|
1957
1960
|
const { uid } = await createVeniceProvisionAttestation(account.address);
|
|
1958
1961
|
if (uid !== "0x0000000000000000000000000000000000000000000000000000000000000000") {
|
|
1959
1962
|
console.log(chalk2.dim(` Attested: ${getEasScanUrl2(uid)}`));
|
|
@@ -2104,7 +2107,7 @@ ${opts.prompt}`;
|
|
|
2104
2107
|
console.log(chalk2.dim(`Model: ${result.model} | Tokens: ${result.usage.promptTokens} in, ${result.usage.completionTokens} out, ${result.usage.totalTokens} total`));
|
|
2105
2108
|
}
|
|
2106
2109
|
try {
|
|
2107
|
-
const { createVeniceInferenceAttestation, getEasScanUrl: getEasScanUrl2 } = await import("./eas-
|
|
2110
|
+
const { createVeniceInferenceAttestation, getEasScanUrl: getEasScanUrl2 } = await import("./eas-652I6ULB.js");
|
|
2108
2111
|
const { keccak256, toHex, isAddress: isAddr } = await import("viem");
|
|
2109
2112
|
const { getChainContracts: getChainContracts2 } = await import("./config-YXZKPSZB.js");
|
|
2110
2113
|
const { getChain: getActiveChain } = await import("./network-QEMP3DSP.js");
|
|
@@ -2558,7 +2561,7 @@ function registerIdentityCommands(program2) {
|
|
|
2558
2561
|
}
|
|
2559
2562
|
|
|
2560
2563
|
// src/commands/proposal.ts
|
|
2561
|
-
import { isAddress as isAddress4 } from "viem";
|
|
2564
|
+
import { isAddress as isAddress4, encodeFunctionData as encodeFunctionData9 } from "viem";
|
|
2562
2565
|
import chalk6 from "chalk";
|
|
2563
2566
|
import ora5 from "ora";
|
|
2564
2567
|
import { readFileSync as readFileSync2 } from "fs";
|
|
@@ -3236,7 +3239,7 @@ function printSimulationResult(result, callType) {
|
|
|
3236
3239
|
}
|
|
3237
3240
|
async function sendSimulationAlert(subdomain, proposalId, vault, execResult, settleResult) {
|
|
3238
3241
|
try {
|
|
3239
|
-
const xmtp = await import("./xmtp-
|
|
3242
|
+
const xmtp = await import("./xmtp-K555NJPU.js");
|
|
3240
3243
|
const { getAccount: getAccount2 } = await import("./client-CWQFYZ5Z.js");
|
|
3241
3244
|
const group = await xmtp.getGroup("", subdomain);
|
|
3242
3245
|
const allRisks = [...execResult.risks, ...settleResult?.risks ?? []];
|
|
@@ -3688,6 +3691,130 @@ function registerProposalCommands(program2) {
|
|
|
3688
3691
|
process.exit(1);
|
|
3689
3692
|
}
|
|
3690
3693
|
});
|
|
3694
|
+
proposal.command("unstick", { hidden: true }).description(
|
|
3695
|
+
"Guardian-only: unstick a vault whose Executed proposal cannot settle (no funds moved)"
|
|
3696
|
+
).requiredOption("--id <proposalId>", "Proposal ID to unstick").option("--yes", "Skip the interactive confirmation").option(
|
|
3697
|
+
"--dry-run",
|
|
3698
|
+
"Check preconditions and print the fallback call without broadcasting"
|
|
3699
|
+
).action(async (opts) => {
|
|
3700
|
+
try {
|
|
3701
|
+
const proposalId = parseBigIntArg(opts.id, "proposal ID");
|
|
3702
|
+
const account = getAccount();
|
|
3703
|
+
const spinner = ora5("Loading proposal...").start();
|
|
3704
|
+
const p = await getProposal(proposalId);
|
|
3705
|
+
const state = await getProposalState(proposalId);
|
|
3706
|
+
if (state !== PROPOSAL_STATE.Executed) {
|
|
3707
|
+
spinner.fail(
|
|
3708
|
+
`Proposal ${proposalId} is ${PROPOSAL_STATES[state] || "Unknown"} \u2014 unstick only applies to Executed proposals.`
|
|
3709
|
+
);
|
|
3710
|
+
console.error(
|
|
3711
|
+
DIM2(
|
|
3712
|
+
"\n Other states have their own recovery path:\n Draft/Pending \u2192 sherwood proposal cancel --id <id>\n Approved \u2192 sherwood proposal veto <id>\n Expired \u2192 vault is not locked, nothing to do\n Settled \u2192 already settled\n Cancelled \u2192 governor upgrade required (issue #177)\n"
|
|
3713
|
+
)
|
|
3714
|
+
);
|
|
3715
|
+
process.exit(1);
|
|
3716
|
+
}
|
|
3717
|
+
const now = BigInt(Math.floor(Date.now() / 1e3));
|
|
3718
|
+
const expiresAt = p.executedAt + p.strategyDuration;
|
|
3719
|
+
if (p.executedAt === 0n || now < expiresAt) {
|
|
3720
|
+
spinner.fail("Strategy duration has not elapsed yet.");
|
|
3721
|
+
const remaining = expiresAt - now;
|
|
3722
|
+
console.error(
|
|
3723
|
+
DIM2(
|
|
3724
|
+
`
|
|
3725
|
+
Can unstick after: ${new Date(Number(expiresAt) * 1e3).toLocaleString()} (in ~${formatDurationShort(remaining)})
|
|
3726
|
+
`
|
|
3727
|
+
)
|
|
3728
|
+
);
|
|
3729
|
+
process.exit(1);
|
|
3730
|
+
}
|
|
3731
|
+
const vault = p.vault;
|
|
3732
|
+
const active = await getActiveProposal(vault);
|
|
3733
|
+
if (active !== proposalId) {
|
|
3734
|
+
spinner.fail(
|
|
3735
|
+
`Vault ${vault} active proposal is ${active}, not ${proposalId} \u2014 nothing to unstick for this proposal.`
|
|
3736
|
+
);
|
|
3737
|
+
process.exit(1);
|
|
3738
|
+
}
|
|
3739
|
+
const vaultOwner = await getVaultOwner(vault);
|
|
3740
|
+
if (account.address.toLowerCase() !== vaultOwner.toLowerCase()) {
|
|
3741
|
+
spinner.fail("Only the vault owner can unstick a proposal.");
|
|
3742
|
+
console.error(
|
|
3743
|
+
DIM2(`
|
|
3744
|
+
Vault owner: ${vaultOwner}
|
|
3745
|
+
Your wallet: ${account.address}
|
|
3746
|
+
`)
|
|
3747
|
+
);
|
|
3748
|
+
process.exit(1);
|
|
3749
|
+
}
|
|
3750
|
+
const asset = await getAssetAddress();
|
|
3751
|
+
const noopCalldata = encodeFunctionData9({
|
|
3752
|
+
abi: ERC20_ABI,
|
|
3753
|
+
functionName: "balanceOf",
|
|
3754
|
+
args: [vault]
|
|
3755
|
+
});
|
|
3756
|
+
const fallbackCalls = [
|
|
3757
|
+
{ target: asset, data: noopCalldata, value: 0n }
|
|
3758
|
+
];
|
|
3759
|
+
spinner.stop();
|
|
3760
|
+
console.log();
|
|
3761
|
+
console.log(BOLD2("Unstick plan"));
|
|
3762
|
+
SEP2();
|
|
3763
|
+
console.log(` Proposal: ${proposalId}`);
|
|
3764
|
+
console.log(` Vault: ${vault}`);
|
|
3765
|
+
console.log(` Asset: ${asset}`);
|
|
3766
|
+
console.log(` State: ${PROPOSAL_STATES[state]} (duration elapsed)`);
|
|
3767
|
+
console.log(` Caller: ${account.address} (vault owner \u2713)`);
|
|
3768
|
+
console.log();
|
|
3769
|
+
console.log(LABEL2(" Fallback call (no-op, cannot revert):"));
|
|
3770
|
+
console.log(DIM2(` target: ${asset}`));
|
|
3771
|
+
console.log(DIM2(` data: ${noopCalldata} // balanceOf(${vault})`));
|
|
3772
|
+
console.log(DIM2(" value: 0"));
|
|
3773
|
+
console.log();
|
|
3774
|
+
console.log(
|
|
3775
|
+
DIM2(
|
|
3776
|
+
" This calls emergencySettle(id, [noop]). The governor catches any revert\n from the pre-committed settlement calls and runs the no-op instead. No\n funds move. The proposal transitions to Settled and the vault unlocks.\n LPs can then redeem via `sherwood vault redeem`."
|
|
3777
|
+
)
|
|
3778
|
+
);
|
|
3779
|
+
console.log();
|
|
3780
|
+
if (opts.dryRun) {
|
|
3781
|
+
console.log(G2(" (dry-run) Preconditions OK \u2014 not broadcasting.\n"));
|
|
3782
|
+
return;
|
|
3783
|
+
}
|
|
3784
|
+
if (!opts.yes) {
|
|
3785
|
+
process.stdout.write(chalk6.yellow(" Proceed? [y/N] "));
|
|
3786
|
+
const answer = await new Promise((resolve2) => {
|
|
3787
|
+
process.stdin.resume();
|
|
3788
|
+
process.stdin.setEncoding("utf-8");
|
|
3789
|
+
process.stdin.once("data", (d) => resolve2(String(d).trim().toLowerCase()));
|
|
3790
|
+
});
|
|
3791
|
+
process.stdin.pause();
|
|
3792
|
+
if (answer !== "y" && answer !== "yes") {
|
|
3793
|
+
console.log(DIM2(" Cancelled.\n"));
|
|
3794
|
+
return;
|
|
3795
|
+
}
|
|
3796
|
+
}
|
|
3797
|
+
const send = ora5("Broadcasting emergencySettle...").start();
|
|
3798
|
+
const hash = await emergencySettle(proposalId, fallbackCalls);
|
|
3799
|
+
send.succeed(G2("Vault unstuck \u2014 proposal Settled"));
|
|
3800
|
+
console.log(DIM2(` ${getExplorerUrl(hash)}`));
|
|
3801
|
+
const stillActive = await getActiveProposal(vault);
|
|
3802
|
+
if (stillActive === 0n) {
|
|
3803
|
+
console.log(G2(" redemptionsLocked cleared \u2713"));
|
|
3804
|
+
} else {
|
|
3805
|
+
console.log(
|
|
3806
|
+
chalk6.yellow(
|
|
3807
|
+
` \u26A0 getActiveProposal(vault) still returns ${stillActive} \u2014 check manually.`
|
|
3808
|
+
)
|
|
3809
|
+
);
|
|
3810
|
+
}
|
|
3811
|
+
console.log();
|
|
3812
|
+
} catch (err) {
|
|
3813
|
+
console.error(chalk6.red(`
|
|
3814
|
+
\u2716 ${formatContractError(err)}`));
|
|
3815
|
+
process.exit(1);
|
|
3816
|
+
}
|
|
3817
|
+
});
|
|
3691
3818
|
proposal.command("cancel").description("Cancel a proposal (proposer or vault owner)").requiredOption("--id <proposalId>", "Proposal ID").option("--emergency", "Emergency cancel (vault owner only, any non-settled state)").action(async (opts) => {
|
|
3692
3819
|
try {
|
|
3693
3820
|
const proposalId = parseBigIntArg(opts.id, "proposal ID");
|
|
@@ -3929,7 +4056,7 @@ try {
|
|
|
3929
4056
|
var require2 = createRequire(import.meta.url);
|
|
3930
4057
|
var { version: CLI_VERSION } = require2("../package.json");
|
|
3931
4058
|
async function loadXmtp() {
|
|
3932
|
-
return import("./xmtp-
|
|
4059
|
+
return import("./xmtp-K555NJPU.js");
|
|
3933
4060
|
}
|
|
3934
4061
|
async function loadCron() {
|
|
3935
4062
|
return import("./cron-EOULYO3R.js");
|
|
@@ -4954,7 +5081,7 @@ ${info.name} (${info.type})`);
|
|
|
4954
5081
|
}
|
|
4955
5082
|
});
|
|
4956
5083
|
try {
|
|
4957
|
-
const { registerChatCommands } = await import("./chat-
|
|
5084
|
+
const { registerChatCommands } = await import("./chat-DRKUZCOY.js");
|
|
4958
5085
|
registerChatCommands(program);
|
|
4959
5086
|
} catch {
|
|
4960
5087
|
program.command("chat <name> [action] [actionArgs...]").description("Syndicate chat (XMTP) \u2014 requires @xmtp/cli").action(() => {
|
|
@@ -4964,16 +5091,16 @@ try {
|
|
|
4964
5091
|
process.exit(1);
|
|
4965
5092
|
});
|
|
4966
5093
|
}
|
|
4967
|
-
var { registerSessionCommands } = await import("./session-
|
|
5094
|
+
var { registerSessionCommands } = await import("./session-7HKFQ7JZ.js");
|
|
4968
5095
|
registerSessionCommands(program);
|
|
4969
5096
|
registerVeniceCommands(program);
|
|
4970
5097
|
registerAllowanceCommands(program);
|
|
4971
5098
|
registerIdentityCommands(program);
|
|
4972
5099
|
registerProposalCommands(program);
|
|
4973
5100
|
registerGovernorCommands(program);
|
|
4974
|
-
var { registerResearchCommands } = await import("./research-
|
|
5101
|
+
var { registerResearchCommands } = await import("./research-LJKYDBCL.js");
|
|
4975
5102
|
registerResearchCommands(program);
|
|
4976
|
-
var { registerTradeCommands } = await import("./trade-
|
|
5103
|
+
var { registerTradeCommands } = await import("./trade-4SOHHD5R.js");
|
|
4977
5104
|
registerTradeCommands(program);
|
|
4978
5105
|
var configCmd = program.command("config");
|
|
4979
5106
|
configCmd.command("set").description("Save settings to ~/.sherwood/config.json (persists across sessions)").option("--private-key <key>", "Wallet private key (0x-prefixed)").option("--vault <address>", "Default SyndicateVault address").option("--rpc <url>", "Custom RPC URL for the active --chain network").option("--notify-to <id>", "Destination for cron summaries (Telegram chat ID, phone, etc.)").option("--uniswap-api-key <key>", "Uniswap Trading API key (from developers.uniswap.org)").option("--venice-api-key <key>", "Venice AI inference API key").action((opts) => {
|