@thirdfy/agent-cli 0.2.81 → 0.2.82

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,13 @@ All notable changes to `@thirdfy/agent-cli` are documented here. The format is b
4
4
 
5
5
  ## Unreleased
6
6
 
7
+ ## [0.2.82] - 2026-10-01
8
+
9
+ ### Fixed
10
+
11
+ - **`preflight` / `run --run-mode agent_wallet` keep the API's native gas readiness.** On user-pays-gas chains (DogeOS 6281971) Thirdfy API 3.18.2 returns `gasSponsored`, `gasReady`, `nativeGasBalance` and, at 0, `nativeGasWarning` from `/execution-wallet`; the CLI rebuilt the preflight from a fixed field list and dropped them. They now appear under `data.executionWalletPreflight`, and a write whose wallet holds 0 native coin stops before `/execute` with `INSUFFICIENT_NATIVE_GAS` and the faucet message. Sponsored chains and older APIs are unchanged. Pin: `test/preflight-native-gas.test.cjs`.
12
+ - **DogeOS Laika writes check the right funding token.** `dogeos-laika-buy-token` and `dogeos-laika-launch-token` spend native DOGE (`dogeAmountWei`, `initialPurchaseWei`), and `dogeos-laika-claim` receives `tokenAddress`; the CLI sent that bonding-curve token as the execution-wallet `tokenIn` and blocked a buy with `INSUFFICIENT_FUNDS`. They now skip the ERC-20 balance check, as does any action that carries `dogeAmountWei`. `dogeos-laika-sell-token` still checks the token it sells. Pin: `test/funding-token-in.test.cjs`.
13
+
7
14
  ## [0.2.81] - 2026-10-01
8
15
 
9
16
  ### Added
package/README.md CHANGED
@@ -40,11 +40,10 @@ Run without global install:
40
40
  npx @thirdfy/agent-cli --help
41
41
  ```
42
42
 
43
- ## What's new in v0.2.81
43
+ ## What's new in v0.2.82
44
44
 
45
- - **DogeOS onboarding**: the quickstart starts with `login email`, warns not to use `managed wallet init` for `agent_wallet`, funds gas and test USDC from the DogeOS faucet, starts with a USDC→WDOGE swap, and adds `dogeos-laika-sell-token`. See [docs/dogeos-quickstart.md](./docs/dogeos-quickstart.md).
46
- - **Chain-aware gas notes**: `help onboarding --chain-id` and `doctor auth --chain-id` say when the sending wallet pays gas (DogeOS) and link the faucet.
47
- - **`wallet submit --chain-id` works**, reads the chain from the signed transaction when `--chain-id` is omitted, and picks the RPC for that chain. Base keeps its order (`BASE_RPC_URL`, `BASE_RPC_HTTP_URL`, `RPC_URL`); other chains use `--rpc-url`, then `RPC_URL`, then the built-in DogeOS RPC. Self-mode broadcast (`self-exec`) uses the same rule. A Base RPC is never used on DogeOS.
45
+ - **`agent_wallet` preflight shows native gas** on chains where the wallet pays gas (DogeOS 6281971): `gasSponsored`, `gasReady`, `nativeGasBalance`, from Thirdfy API 3.18.2. A write from a wallet with 0 native coin stops before `/execute` with `INSUFFICIENT_NATIVE_GAS` and the faucet link.
46
+ - **DogeOS Laika buys pass preflight.** A buy spends native DOGE (`dogeAmountWei`); the CLI no longer checks the balance of the token being bought. Launch and claim are treated the same way, and a sell still checks the token it sells.
48
47
  - See [CHANGELOG.md](./CHANGELOG.md) and GitHub Releases for older versions.
49
48
 
50
49
  ## Quick start
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thirdfy/agent-cli",
3
- "version": "0.2.81",
3
+ "version": "0.2.82",
4
4
  "description": "Thirdfy Agent CLI for onboarding, governance preflight, execute-intent, and status polling.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -9,6 +9,9 @@ const NATIVE_ETH_SPEND_ACTIONS = new Set([
9
9
  'basedbid_create_lbp',
10
10
  'basedbid_create_flash',
11
11
  'basedbid_create_board',
12
+ // DogeOS Laika: buys and launches spend native DOGE; tokenAddress is the bonding-curve token received.
13
+ 'dogeos_laika_buy_token',
14
+ 'dogeos_laika_launch_token',
12
15
  ]);
13
16
 
14
17
  /**
@@ -18,6 +21,7 @@ const NATIVE_ETH_SPEND_ACTIONS = new Set([
18
21
  const POSITION_EXIT_ACTIONS = new Set([
19
22
  'withdraw_earn_position',
20
23
  'claim_earn_rewards',
24
+ 'dogeos_laika_claim',
21
25
  ]);
22
26
 
23
27
  export function resolveTokenInForFunding(params, action) {
@@ -28,5 +32,6 @@ export function resolveTokenInForFunding(params, action) {
28
32
  if (NATIVE_ETH_SPEND_ACTIONS.has(actionId)) return '';
29
33
  if (POSITION_EXIT_ACTIONS.has(actionId)) return '';
30
34
  if (params.amountEth != null && String(params.amountEth).trim() !== '') return '';
35
+ if (params.dogeAmountWei != null && String(params.dogeAmountWei).trim() !== '') return '';
31
36
  return String(params.tokenAddress || params.token || '').trim();
32
37
  }
@@ -0,0 +1,13 @@
1
+ const NATIVE_GAS_FIELDS = ['gasSponsored', 'gasReady', 'nativeGasBalance', 'nativeGasBalanceUnavailable', 'nativeGasWarning'];
2
+
3
+ /**
4
+ * Native gas readiness from an `/execution-wallet` reply (Thirdfy API 3.18.2+). Present only on
5
+ * user-pays-gas chains (DogeOS 6281971); empty for sponsored chains and older APIs.
6
+ */
7
+ export function pickNativeGasFields(response) {
8
+ const out = {};
9
+ for (const key of NATIVE_GAS_FIELDS) {
10
+ if (response && response[key] !== undefined) out[key] = response[key];
11
+ }
12
+ return out;
13
+ }
@@ -1,4 +1,5 @@
1
1
  import { randomUUID } from 'crypto';
2
+ import { pickNativeGasFields } from './nativeGas.mjs';
2
3
  import { requireFlag } from '../../core/args.mjs';
3
4
  import { createCliError } from '../../core/envelope.mjs';
4
5
  import {
@@ -778,6 +779,7 @@ async function resolveManagedExecutionPreflight(ctx, flags, resolved, options =
778
779
  executionWalletAddress: preflightSeed.executionWalletAddress || null,
779
780
  signerMethod: preflightSeed.signerMethod || null,
780
781
  fundingTokenBalance: preflightSeed.fundingTokenBalance || null,
782
+ ...pickNativeGasFields(preflightSeed),
781
783
  }
782
784
  : await apiGet(ctx, `/api/v1/agent/execution-wallet?${query.toString()}`, {
783
785
  'x-agent-api-key': agentApiKey,
@@ -832,6 +834,23 @@ async function resolveManagedExecutionPreflight(ctx, flags, resolved, options =
832
834
  };
833
835
  }
834
836
 
837
+ // User-pays-gas chains (DogeOS): the API reports native gas readiness (API 3.18.2+). Keep it, and
838
+ // stop a write before /execute when the wallet holds 0 native coin.
839
+ const nativeGas = pickNativeGasFields(response);
840
+ if (options.requireFundingCheck && nativeGas.gasReady === false) {
841
+ return {
842
+ success: false,
843
+ blockedReason: 'INSUFFICIENT_NATIVE_GAS',
844
+ blockedStage: 'sizing',
845
+ error: nativeGas.nativeGasWarning?.message
846
+ || `Execution wallet ${executionWalletAddress || 'unknown'} has 0 native gas on chain ${chainId}; gas on this chain is paid by the wallet.`,
847
+ executionWalletAddress,
848
+ signerMethod,
849
+ fundingTokenBalance: response?.fundingTokenBalance || null,
850
+ ...nativeGas,
851
+ };
852
+ }
853
+
835
854
  return {
836
855
  success: true,
837
856
  executionWalletAddress,
@@ -840,6 +859,7 @@ async function resolveManagedExecutionPreflight(ctx, flags, resolved, options =
840
859
  userDid,
841
860
  chainId,
842
861
  tokenIn: tokenIn || null,
862
+ ...nativeGas,
843
863
  };
844
864
  }
845
865