clawmoney 0.15.41 → 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.
- package/dist/commands/setup.js +12 -4
- package/package.json +1 -1
package/dist/commands/setup.js
CHANGED
|
@@ -168,7 +168,15 @@ export async function setupCommand() {
|
|
|
168
168
|
return;
|
|
169
169
|
}
|
|
170
170
|
const checkData = checkResp.data;
|
|
171
|
-
|
|
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 (
|
|
202
|
+
else if (agentStatus === 'ACTIVE') {
|
|
195
203
|
// Step 7: Login existing agent via OTP
|
|
196
|
-
agentSpinner.info(`Agent found: ${
|
|
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: ${
|
|
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
|
}
|