@thirdfy/agent-cli 0.2.57 → 0.2.58

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/CHANGELOG.md CHANGED
@@ -4,6 +4,12 @@ All notable changes to `@thirdfy/agent-cli` are documented here. The format is b
4
4
 
5
5
  ## [Unreleased]
6
6
 
7
+ ## [0.2.58] - 2026-09-05
8
+
9
+ ### Fixed
10
+
11
+ - `basedbid_buy` managed-wallet preflight no longer treats listing `tokenAddress` as an ERC-20 `tokenIn`. Buy spends native ETH, so a zero listing-token balance no longer blocks a funded wallet. `basedbid_sell` and earn deposits still fund from `tokenAddress`. Pairs with `thirdfy-mcp` **0.0.106**.
12
+
7
13
  ## [0.2.57] - 2026-09-04
8
14
 
9
15
  ### Added
package/README.md CHANGED
@@ -40,9 +40,9 @@ Run without global install:
40
40
  npx @thirdfy/agent-cli --help
41
41
  ```
42
42
 
43
- ## What's new in v0.2.57
43
+ ## What's new in v0.2.58
44
44
 
45
- - `basedbid` provider hints and [`docs/providers/basedbid.md`](./docs/providers/basedbid.md). `basedbid_get_tokens` is read-only. LBP and flash create are writes on Base, Ethereum, and Robinhood Chain. Buy and sell are writes on Base. Board, fee claim, and hook writes stay fail-closed.
45
+ - `basedbid_buy` managed-wallet preflight no longer treats listing `tokenAddress` as an ERC-20 funding token. Buy spends native ETH. Sell still funds from the listing token.
46
46
  - See [CHANGELOG.md](./CHANGELOG.md) and GitHub Releases for older versions.
47
47
 
48
48
  ## Quick start
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thirdfy/agent-cli",
3
- "version": "0.2.57",
3
+ "version": "0.2.58",
4
4
  "description": "Thirdfy Agent CLI for onboarding, governance preflight, execute-intent, and status polling.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -0,0 +1,22 @@
1
+ import { normalizeActionKey } from './readOnlyActions.mjs';
2
+
3
+ /**
4
+ * Native-ETH spends pass `tokenAddress` as the listing or output, not the funding ERC-20.
5
+ * Sending that address as execution-wallet `tokenIn` checks the wrong balance and blocks buys.
6
+ */
7
+ const NATIVE_ETH_SPEND_ACTIONS = new Set([
8
+ 'basedbid_buy',
9
+ 'basedbid_create_lbp',
10
+ 'basedbid_create_flash',
11
+ 'basedbid_create_board',
12
+ ]);
13
+
14
+ export function resolveTokenInForFunding(params, action) {
15
+ if (!params || typeof params !== 'object') return '';
16
+ const explicit = String(params.tokenIn || '').trim();
17
+ if (explicit) return explicit;
18
+ const actionId = normalizeActionKey(action);
19
+ if (NATIVE_ETH_SPEND_ACTIONS.has(actionId)) return '';
20
+ if (params.amountEth != null && String(params.amountEth).trim() !== '') return '';
21
+ return String(params.tokenAddress || params.token || '').trim();
22
+ }
@@ -4,6 +4,7 @@ import { loadProfileConfig } from '../../core/context.mjs';
4
4
  import { createCliError } from '../../core/envelope.mjs';
5
5
  import { normalizeRunMode, normalizeManagedRunMode, normalizeHybridWalletMode } from '../../core/runMode.mjs';
6
6
  import { assertEarnclawPolymarketWriteIdempotency } from './earnclawRuntimeWriteGate.mjs';
7
+ import { resolveTokenInForFunding } from '../../core/fundingTokenIn.mjs';
7
8
  export function createExecutionPayloads({ getPreparedParams, rawUnitsToDecimalString }) {
8
9
  function buildBuildTxPayload(flags, resolvedAction) {
9
10
  const runMode = String(flags.runMode || '').trim().toLowerCase() || 'self';
@@ -134,12 +135,6 @@ function buildManagedExecutePayload(flags, options) {
134
135
  return payload;
135
136
  }
136
137
 
137
- function resolveTokenInForFunding(params) {
138
- if (!params || typeof params !== 'object') return '';
139
- const tokenIn = String(params.tokenIn || params.tokenAddress || params.token || '').trim();
140
- return tokenIn;
141
- }
142
-
143
138
  function buildIntentPayload(flags, options) {
144
139
  const runMode = String(options.runMode || flags.runMode || '').trim().toLowerCase() || 'thirdfy';
145
140
  const payload = {
@@ -650,7 +650,10 @@ async function resolveManagedExecutionPreflight(ctx, flags, resolved, options =
650
650
  signerMethod: 'managed_wallet_server',
651
651
  };
652
652
  }
653
- const tokenIn = resolveTokenInForFunding(getPreparedParams(flags));
653
+ const tokenIn = resolveTokenInForFunding(
654
+ getPreparedParams(flags),
655
+ resolved?.resolvedAction || flags.action
656
+ );
654
657
  const query = new URLSearchParams({
655
658
  userDid,
656
659
  chainId: String(chainId),