clawmoney 0.15.40 → 0.15.42

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.
@@ -168,7 +168,15 @@ export async function setupCommand() {
168
168
  return;
169
169
  }
170
170
  const checkData = checkResp.data;
171
- if (!checkData.exists || checkData.status === 'UNCLAIMED') {
171
+ // Backend returns agent details nested under `agent` now; fall back
172
+ // to legacy top-level fields so an older backend still works.
173
+ // Status is normalized to uppercase so case differences between
174
+ // backend builds (active vs ACTIVE) don't trip the branch select.
175
+ const agentInfo = checkData.agent ?? {};
176
+ const agentStatus = (agentInfo.status ?? checkData.status ?? '').toUpperCase();
177
+ const agentSlug = agentInfo.slug ?? checkData.slug;
178
+ const agentIdFromCheck = agentInfo.id ?? checkData.agent_id;
179
+ if (!checkData.exists || agentStatus === 'UNCLAIMED') {
172
180
  // Step 6: Register new agent
173
181
  agentSpinner.text = 'Registering agent...';
174
182
  const registerBody = { email };
@@ -191,9 +199,9 @@ export async function setupCommand() {
191
199
  wallet_address: walletAddress || undefined,
192
200
  });
193
201
  }
194
- else if (checkData.status === 'ACTIVE') {
202
+ else if (agentStatus === 'ACTIVE') {
195
203
  // Step 7: Login existing agent via OTP
196
- agentSpinner.info(`Agent found: ${checkData.slug || checkData.agent_id}`);
204
+ agentSpinner.info(`Agent found: ${agentSlug || agentIdFromCheck}`);
197
205
  const loginSpinner2 = ora('Sending login OTP...').start();
198
206
  const loginResp = await apiPost('/api/v1/claw-agents/login', { email });
199
207
  if (!loginResp.ok) {
@@ -225,7 +233,7 @@ export async function setupCommand() {
225
233
  });
226
234
  }
227
235
  else {
228
- agentSpinner.warn(`Agent status: ${checkData.status}`);
236
+ agentSpinner.warn(`Agent status: ${agentStatus || '(unknown)'}`);
229
237
  console.log(chalk.yellow('Please contact support if you need help.'));
230
238
  return;
231
239
  }
@@ -168,14 +168,19 @@ export async function walletBalanceCommand() {
168
168
  console.log(` ${chalk.yellow('unavailable')} ${chalk.dim('(' + (onchainError ?? 'unknown') + ')')}`);
169
169
  }
170
170
  console.log('');
171
- console.log(chalk.bold(' Relay earnings'));
171
+ console.log(chalk.bold(' Pending payout (Relay)'));
172
172
  if (relayRows && relayRows.length > 0) {
173
+ // "Earned lifetime" is vanity — the only thing that matters for
174
+ // the wallet view is: how much is already in the on-chain wallet
175
+ // (shown above as USDC), and how much is still owed to the user
176
+ // (pending = earned - withdrawn). Those two numbers together
177
+ // tell the full story; showing "earned" separately would double-
178
+ // count the wallet USDC that came from relay payouts.
173
179
  const earned = relayRows.reduce((s, p) => s + (p.total_earned_usd ?? 0), 0);
174
180
  const withdrawn = relayRows.reduce((s, p) => s + (p.total_withdrawn_usd ?? 0), 0);
175
181
  const pending = Math.max(0, earned - withdrawn);
176
182
  const requests = relayRows.reduce((s, p) => s + (p.total_requests ?? 0), 0);
177
- console.log(` ${chalk.dim('Earned:').padEnd(22)} ${chalk.green('$' + earned.toFixed(2))}`);
178
- console.log(` ${chalk.dim('Pending payout:').padEnd(22)} ${chalk.green('$' + pending.toFixed(2))}`);
183
+ console.log(` ${chalk.dim('Amount:').padEnd(22)} ${chalk.green('$' + pending.toFixed(2))}`);
179
184
  console.log(chalk.dim(` (${relayRows.length} provider${relayRows.length === 1 ? "" : "s"} · ${requests} request${requests === 1 ? "" : "s"} served)`));
180
185
  }
181
186
  else if (relayRows && relayRows.length === 0) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clawmoney",
3
- "version": "0.15.40",
3
+ "version": "0.15.42",
4
4
  "description": "ClawMoney CLI -- Earn rewards with your AI agent",
5
5
  "type": "module",
6
6
  "bin": {