@haven_ai/cli 0.0.0-dev.202610141909.1546aaa → 0.0.0-dev.202610142033.0d2f50f

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 CHANGED
@@ -3148,7 +3148,7 @@ async function checkTextForSecrets(text, deps) {
3148
3148
 
3149
3149
  // src/commands.ts
3150
3150
  var DEFAULT_API = "https://havenbackend-production-8a00.up.railway.app";
3151
- var CLI_VERSION = "0.0.0-dev.202610141909.1546aaa";
3151
+ var CLI_VERSION = "0.0.0-dev.202610142033.0d2f50f";
3152
3152
  var CLI_CLIENT_IDENTITY = `@haven_ai/cli/${CLI_VERSION}`;
3153
3153
  function accountAddressOf(s) {
3154
3154
  return s.account_address ?? "";
@@ -3649,13 +3649,27 @@ async function cmdBudgetGrant(args, d) {
3649
3649
  }
3650
3650
  const amount = parseTokenAmount(args.flags.amount, token.decimals, token.symbol);
3651
3651
  if (!amount.ok) throw new UsageError(amount.message);
3652
- const built = await api.post(`/agents/${id}/delegations/build`, {
3653
- token_address: token.address,
3654
- recipient_address: args.flags.recipient ?? null,
3655
- budget_atomic: amount.atomic,
3656
- period_seconds: args.flags.period * 60,
3657
- ...args.flags.expires !== void 0 ? { expires_at: args.flags.expires } : {}
3658
- });
3652
+ let built;
3653
+ try {
3654
+ built = await api.post(`/agents/${id}/delegations/build`, {
3655
+ token_address: token.address,
3656
+ recipient_address: args.flags.recipient ?? null,
3657
+ budget_atomic: amount.atomic,
3658
+ period_seconds: args.flags.period * 60,
3659
+ ...args.flags.expires !== void 0 ? { expires_at: args.flags.expires } : {}
3660
+ });
3661
+ } catch (err) {
3662
+ const body = err instanceof CliApiError ? err.body : void 0;
3663
+ if (body?.error_code === "BUDGET_SLOT_OCCUPIED") {
3664
+ throw new HavenCliError(
3665
+ err instanceof Error ? err.message : "This agent already has a live budget for this token and recipient.",
3666
+ EXIT.refused,
3667
+ "Edit that budget on the agent's page in the Haven dashboard instead: editing replaces it and stops the old one on-chain. Open task and sub-budgets carved from the old budget end when it is stopped.",
3668
+ { error_code: "BUDGET_SLOT_OCCUPIED", existing_delegation_hash: body.existing_delegation_hash ?? null }
3669
+ );
3670
+ }
3671
+ throw err;
3672
+ }
3659
3673
  const emitGrant = (status) => emit(
3660
3674
  d,
3661
3675
  args.flags.json,