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