@heyamiko/amiko-cli 0.5.4 → 0.5.6
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.js +13 -6
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -75249,10 +75249,11 @@ function registerCreditsCommand(program2) {
|
|
|
75249
75249
|
const spinner2 = ora("Fetching credit balance...").start();
|
|
75250
75250
|
try {
|
|
75251
75251
|
let balance = null;
|
|
75252
|
-
const billingToken = auth.platformKey || auth.privyToken;
|
|
75253
|
-
|
|
75252
|
+
const billingToken = auth.platformKey || auth.twinToken || auth.privyToken;
|
|
75253
|
+
const base2 = auth.billingBase || "https://billing.heyamiko.com";
|
|
75254
|
+
if (billingToken) {
|
|
75254
75255
|
try {
|
|
75255
|
-
const res = await fetch(`${
|
|
75256
|
+
const res = await fetch(`${base2}/api/credits`, {
|
|
75256
75257
|
headers: {
|
|
75257
75258
|
Authorization: `Bearer ${billingToken}`
|
|
75258
75259
|
}
|
|
@@ -75260,8 +75261,14 @@ function registerCreditsCommand(program2) {
|
|
|
75260
75261
|
if (res.ok) {
|
|
75261
75262
|
const data = await res.json();
|
|
75262
75263
|
balance = data.displayBalance ?? Math.round(Number(data.credits?.balance || 0));
|
|
75264
|
+
} else {
|
|
75265
|
+
console.log(dim(` API returned ${res.status}: ${await res.text().catch(() => "")}`));
|
|
75263
75266
|
}
|
|
75264
|
-
} catch {
|
|
75267
|
+
} catch (e8) {
|
|
75268
|
+
console.log(dim(` Fetch error: ${e8.message}`));
|
|
75269
|
+
}
|
|
75270
|
+
} else {
|
|
75271
|
+
console.log(dim(" No auth token available"));
|
|
75265
75272
|
}
|
|
75266
75273
|
spinner2.stop();
|
|
75267
75274
|
if (balance !== null) {
|
|
@@ -75279,7 +75286,7 @@ function registerCreditsCommand(program2) {
|
|
|
75279
75286
|
const agentWallets = (auth.agentWallets || []).filter((w5) => w5.source === "agent");
|
|
75280
75287
|
if (agentWallets.length > 0 && auth.billingBase) {
|
|
75281
75288
|
const spinner3 = ora("Fetching wallet balances...").start();
|
|
75282
|
-
const billingAuth = auth.platformKey || auth.privyToken;
|
|
75289
|
+
const billingAuth = auth.platformKey || auth.twinToken || auth.privyToken;
|
|
75283
75290
|
try {
|
|
75284
75291
|
spinner3.stop();
|
|
75285
75292
|
console.log(label("Agent Wallets", ""));
|
|
@@ -75349,7 +75356,7 @@ function registerCreditsCommand(program2) {
|
|
|
75349
75356
|
console.error(error("Billing service not configured. Run: amiko connect"));
|
|
75350
75357
|
process.exit(1);
|
|
75351
75358
|
}
|
|
75352
|
-
const authToken = auth.platformKey || auth.privyToken;
|
|
75359
|
+
const authToken = auth.platformKey || auth.twinToken || auth.privyToken;
|
|
75353
75360
|
if (!authToken) {
|
|
75354
75361
|
spinner.stop();
|
|
75355
75362
|
console.error(error("No API key or auth token. Run: amiko connect"));
|