@heyamiko/amiko-cli 0.5.3 → 0.5.5

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.
Files changed (2) hide show
  1. package/dist/index.js +20 -3
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -75133,6 +75133,16 @@ function resolveAuth(cliConfig) {
75133
75133
  userId: cliConfig.userId
75134
75134
  };
75135
75135
  }
75136
+ if (cliConfig.apiKey) {
75137
+ return {
75138
+ mode: "connected",
75139
+ billingBase: cliConfig.billingBase,
75140
+ platformKey: cliConfig.apiKey,
75141
+ userId: cliConfig.userId,
75142
+ twinId: cliConfig.twinId,
75143
+ twinToken: cliConfig.twinToken
75144
+ };
75145
+ }
75136
75146
  const envToken = process.env.AMIKO_USER_TOKEN;
75137
75147
  if (envToken) {
75138
75148
  return {
@@ -75240,9 +75250,10 @@ function registerCreditsCommand(program2) {
75240
75250
  try {
75241
75251
  let balance = null;
75242
75252
  const billingToken = auth.platformKey || auth.privyToken;
75243
- if (auth.billingBase && billingToken) {
75253
+ const base2 = auth.billingBase || "https://billing.heyamiko.com";
75254
+ if (billingToken) {
75244
75255
  try {
75245
- const res = await fetch(`${auth.billingBase}/api/credits`, {
75256
+ const res = await fetch(`${base2}/api/credits`, {
75246
75257
  headers: {
75247
75258
  Authorization: `Bearer ${billingToken}`
75248
75259
  }
@@ -75250,8 +75261,14 @@ function registerCreditsCommand(program2) {
75250
75261
  if (res.ok) {
75251
75262
  const data = await res.json();
75252
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(() => "")}`));
75253
75266
  }
75254
- } catch {}
75267
+ } catch (e8) {
75268
+ console.log(dim(` Fetch error: ${e8.message}`));
75269
+ }
75270
+ } else {
75271
+ console.log(dim(" No auth token available"));
75255
75272
  }
75256
75273
  spinner2.stop();
75257
75274
  if (balance !== null) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@heyamiko/amiko-cli",
3
- "version": "0.5.3",
3
+ "version": "0.5.5",
4
4
  "description": "Amiko CLI — swap tokens, manage credits, bridge cross-chain, and call marketplace agents",
5
5
  "type": "module",
6
6
  "bin": {