@anythingai/cli 0.1.0 → 0.1.1

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/js/bin.mjs +10 -3
  2. package/package.json +1 -1
package/dist/js/bin.mjs CHANGED
@@ -3026,9 +3026,11 @@ const EXIT_CONFLICT = 5;
3026
3026
  const EXIT_TIMEOUT = 6;
3027
3027
  const EXIT_SERVER_ERROR = 7;
3028
3028
  const EXIT_RATE_LIMITED = 8;
3029
+ const EXIT_CREDIT_LIMIT = 9;
3029
3030
  function exitCodeFromHttpStatus(status) {
3030
3031
  if (status === null) return EXIT_ERROR;
3031
3032
  if (status === 401 || status === 403) return EXIT_AUTH_FAILURE;
3033
+ if (status === 402) return EXIT_CREDIT_LIMIT;
3032
3034
  if (status === 404) return EXIT_NOT_FOUND;
3033
3035
  if (status === 409) return EXIT_CONFLICT;
3034
3036
  if (status === 408 || status === 504) return EXIT_TIMEOUT;
@@ -3042,6 +3044,7 @@ function errorCodeFromExitCode(exitCode) {
3042
3044
  case EXIT_INVALID_ARGS: return "INVALID_ARGUMENTS";
3043
3045
  case EXIT_NOT_FOUND: return "NOT_FOUND";
3044
3046
  case EXIT_AUTH_FAILURE: return "AUTH_FAILURE";
3047
+ case EXIT_CREDIT_LIMIT: return "CREDIT_LIMIT_REACHED";
3045
3048
  case EXIT_CONFLICT: return "CONFLICT";
3046
3049
  case EXIT_TIMEOUT: return "TIMEOUT";
3047
3050
  case EXIT_SERVER_ERROR: return "SERVER_ERROR";
@@ -3052,6 +3055,7 @@ function errorCodeFromExitCode(exitCode) {
3052
3055
  function errorCodeFromHttpStatus(status) {
3053
3056
  if (status === null) return "NETWORK_ERROR";
3054
3057
  if (status === 401) return "AUTH_FAILURE";
3058
+ if (status === 402) return "CREDIT_LIMIT_REACHED";
3055
3059
  if (status === 403) return "FORBIDDEN";
3056
3060
  if (status === 404) return "NOT_FOUND";
3057
3061
  if (status === 409) return "CONFLICT";
@@ -3065,7 +3069,7 @@ function errorCodeFromHttpStatus(status) {
3065
3069
 
3066
3070
  //#endregion
3067
3071
  //#region package.json
3068
- var version = "0.1.0";
3072
+ var version = "0.1.1";
3069
3073
 
3070
3074
  //#endregion
3071
3075
  //#region generated/core/bodySerializer.gen.ts
@@ -4423,10 +4427,12 @@ var AnythingApiClient = class {
4423
4427
  }
4424
4428
  if (!response.ok) {
4425
4429
  const retryAfter = parseRetryAfter(response);
4430
+ const hint = error && typeof error === "object" && "hint" in error && typeof error.hint === "string" ? error.hint : void 0;
4426
4431
  return err({
4427
4432
  message: extractErrorMessage(response.status, error),
4428
4433
  status: response.status,
4429
4434
  details: error,
4435
+ ...hint ? { hint } : {},
4430
4436
  ...retryAfter !== null ? { retryAfter } : {}
4431
4437
  });
4432
4438
  }
@@ -4874,6 +4880,7 @@ function outputError({ argv, command, error, hint, exitCode }) {
4874
4880
  const status = "status" in error ? error.status ?? null : null;
4875
4881
  const details = "details" in error ? error.details : void 0;
4876
4882
  const retryAfter = "retryAfter" in error && typeof error.retryAfter === "number" ? error.retryAfter : null;
4883
+ const resolvedHint = hint ?? ("hint" in error && typeof error.hint === "string" ? error.hint : void 0);
4877
4884
  process.exitCode = exitCode ?? exitCodeFromHttpStatus(status);
4878
4885
  const code = extractErrorCode(details) ?? (status === null && exitCode !== void 0 ? errorCodeFromExitCode(exitCode) : errorCodeFromHttpStatus(status));
4879
4886
  if (argv.json || argv.quiet) {
@@ -4883,7 +4890,7 @@ function outputError({ argv, command, error, hint, exitCode }) {
4883
4890
  error: {
4884
4891
  code,
4885
4892
  message: error.message,
4886
- ...hint ? { hint } : {},
4893
+ ...resolvedHint ? { hint: resolvedHint } : {},
4887
4894
  ...retryAfter !== null ? { retry_after_seconds: retryAfter } : {}
4888
4895
  }
4889
4896
  }, null, 2));
@@ -4895,7 +4902,7 @@ function outputError({ argv, command, error, hint, exitCode }) {
4895
4902
  details
4896
4903
  });
4897
4904
  if (retryAfter !== null) console.error(` ${styleText("dim", `Retry after ${retryAfter}s`)}`);
4898
- if (hint) console.error(` ${styleText("dim", hint)}`);
4905
+ if (resolvedHint) console.error(` ${styleText("dim", resolvedHint)}`);
4899
4906
  }
4900
4907
  function outputValidationError({ argv, command, message, hint }) {
4901
4908
  outputError({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@anythingai/cli",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "homepage": "https://anything.com/",
5
5
  "license": "MIT",
6
6
  "bin": {