@tostudy-ai/cli 0.17.4 → 0.17.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.
package/dist/cli.js CHANGED
@@ -2866,6 +2866,7 @@ var init_errors_pt_br = __esm({
2866
2866
  workspaceCommandDescription: "Gerenciar workspace de estudo local",
2867
2867
  workspaceSetupDescription: "Criar estrutura do workspace para o curso ativo",
2868
2868
  insufficientCredits: "\u274C Voc\xEA est\xE1 sem cr\xE9ditos. Cada resposta do tutor de IA consome cr\xE9ditos para cobrir o processamento. Recarregue em https://tostudy.ai/student/credits para continuar de onde parou.\n",
2869
+ dailyAiLimit: "\u274C Voc\xEA atingiu o teto di\xE1rio de gastos com IA da sua conta. N\xE3o \xE9 falta de cr\xE9ditos: o teto reinicia \xE0 meia-noite (UTC). Para um teto maior, fa\xE7a upgrade do plano em https://tostudy.ai/student/plan.\n",
2869
2870
  workspaceRefusedAtHome: "N\xE3o d\xE1 para configurar o estudo direto na sua pasta pessoal.\nCrie uma pasta para o curso e entre nela antes de continuar:\n\n mkdir ~/meus-cursos && cd ~/meus-cursos\n",
2870
2871
  courseArchived: "Este curso foi arquivado e est\xE1 dispon\xEDvel somente para leitura.\nUse `tostudy lesson` para revisar o conte\xFAdo j\xE1 estudado.\n",
2871
2872
  noActiveCourse: "Nenhum curso ativo nesta pasta.\nVeja seus cursos com `tostudy courses` e ative um com `tostudy select <n>`.\n",
@@ -2888,6 +2889,7 @@ var init_errors_en_us = __esm({
2888
2889
  workspaceCommandDescription: "Manage local study workspace",
2889
2890
  workspaceSetupDescription: "Create the workspace structure for the active course",
2890
2891
  insufficientCredits: "\u274C You're out of credits. Every reply from the AI tutor uses credits to cover processing. Top up at https://tostudy.ai/student/credits to continue from where you stopped.\n",
2892
+ dailyAiLimit: "\u274C You have reached your account's daily AI spending limit. This is not an empty wallet: the limit resets at midnight (UTC). For a higher limit, upgrade your plan at https://tostudy.ai/student/plan.\n",
2891
2893
  workspaceRefusedAtHome: "Study can't be set up directly in your home folder.\nCreate a folder for the course and switch into it first:\n\n mkdir ~/my-courses && cd ~/my-courses\n",
2892
2894
  courseArchived: "This course has been archived and is available for reading only.\nUse `tostudy lesson` to review the content you've already studied.\n",
2893
2895
  noActiveCourse: "No active course in this folder.\nList your courses with `tostudy courses` and activate one with `tostudy select <n>`.\n",
@@ -2934,6 +2936,9 @@ function resolveErrorCode(err) {
2934
2936
  function isInsufficientCreditsError(err) {
2935
2937
  return resolveErrorCode(err).includes("INSUFFICIENT_CREDITS");
2936
2938
  }
2939
+ function isDailyAiLimitError(err) {
2940
+ return resolveErrorCode(err).includes("DAILY_AI_COST_LIMIT_EXCEEDED");
2941
+ }
2937
2942
  function isCourseArchivedError(err) {
2938
2943
  return resolveErrorCode(err).includes("COURSE_ARCHIVED");
2939
2944
  }
@@ -3531,7 +3536,7 @@ var CLI_VERSION;
3531
3536
  var init_version = __esm({
3532
3537
  "src/version.ts"() {
3533
3538
  "use strict";
3534
- CLI_VERSION = true ? "0.17.3" : "0.7.1";
3539
+ CLI_VERSION = true ? "0.17.5" : "0.7.1";
3535
3540
  }
3536
3541
  });
3537
3542
 
@@ -20269,6 +20274,12 @@ var init_validate = __esm({
20269
20274
  error(friendly);
20270
20275
  return;
20271
20276
  }
20277
+ if (isDailyAiLimitError(err)) {
20278
+ const friendly = getErrors().dailyAiLimit;
20279
+ if (opts.json) jsonError("daily_ai_limit", { message: friendly });
20280
+ error(friendly);
20281
+ return;
20282
+ }
20272
20283
  const msg = err instanceof Error ? err.message : String(err);
20273
20284
  if (opts.json) jsonError(msg);
20274
20285
  error(msg);
@@ -22316,6 +22327,11 @@ var init_theory = __esm({
22316
22327
  if (opts.json) jsonError("insufficient_credits", { message: friendly });
22317
22328
  error(friendly);
22318
22329
  }
22330
+ if (body.error === "DAILY_AI_COST_LIMIT_EXCEEDED") {
22331
+ const friendly = getErrors().dailyAiLimit;
22332
+ if (opts.json) jsonError("daily_ai_limit", { message: friendly });
22333
+ error(friendly);
22334
+ }
22319
22335
  const msg = body.error ?? body.message ?? `Falha ao pedir teoria (${res.status})`;
22320
22336
  if (opts.json) jsonError("request_failed", { message: msg, code: res.status });
22321
22337
  error(msg);
@@ -22333,6 +22349,12 @@ var init_theory = __esm({
22333
22349
  error(friendly);
22334
22350
  return;
22335
22351
  }
22352
+ if (isDailyAiLimitError(err)) {
22353
+ const friendly = getErrors().dailyAiLimit;
22354
+ if (opts.json) jsonError("daily_ai_limit", { message: friendly });
22355
+ error(friendly);
22356
+ return;
22357
+ }
22336
22358
  const msg = err instanceof Error ? err.message : String(err);
22337
22359
  if (opts.json) jsonError("unexpected_error", { message: msg });
22338
22360
  error(msg);