@tostudy-ai/cli 0.18.23 → 0.18.25

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/main.js CHANGED
@@ -657,6 +657,23 @@ function parseOtlpResourceAttributes(raw2) {
657
657
  }
658
658
  return out;
659
659
  }
660
+ function parseOtlpHeaders(raw2) {
661
+ if (!raw2) return {};
662
+ const out = {};
663
+ for (const pair of raw2.split(",")) {
664
+ const eq = pair.indexOf("=");
665
+ if (eq <= 0) continue;
666
+ const key = pair.slice(0, eq).trim();
667
+ if (!key) continue;
668
+ const value = pair.slice(eq + 1).trim();
669
+ try {
670
+ out[key] = decodeURIComponent(value);
671
+ } catch {
672
+ out[key] = value;
673
+ }
674
+ }
675
+ return out;
676
+ }
660
677
  function detectEnvironment() {
661
678
  const isProd = process.env.NODE_ENV === "production" || !!process.env.VERCEL || !!process.env.RAILWAY_ENVIRONMENT;
662
679
  let env = process.env.NODE_ENV || "development";
@@ -908,7 +925,8 @@ var init_dist = __esm({
908
925
  });
909
926
  if (!response.ok) throw new Error(`OTLP log ingest failed: ${response.status} ${response.statusText}`);
910
927
  } catch (error49) {
911
- if (this.buffer.length < this.maxBufferSize * 3) this.buffer.unshift(...batch);
928
+ const room = Math.max(0, this.maxBufferSize * 3 - this.buffer.length);
929
+ if (room > 0) this.buffer.unshift(...batch.slice(-room));
912
930
  this.onError?.(error49, batch.length);
913
931
  } finally {
914
932
  this.flushing = false;
@@ -958,6 +976,10 @@ var init_dist = __esm({
958
976
  endpoint: otlpEndpoint,
959
977
  serviceName: process.env.OTEL_SERVICE_NAME || getDefaultService(),
960
978
  resourceAttributes: parseOtlpResourceAttributes(process.env.OTEL_RESOURCE_ATTRIBUTES),
979
+ headers: {
980
+ ...parseOtlpHeaders(process.env.OTEL_EXPORTER_OTLP_HEADERS),
981
+ ...parseOtlpHeaders(process.env.OTEL_EXPORTER_OTLP_LOGS_HEADERS)
982
+ },
961
983
  onError: (err, count) => {
962
984
  process.stderr.write(`[logger] OTLP transport error: ${err.message} (${count} entries)
963
985
  `);
@@ -1045,7 +1067,7 @@ var init_errors_pt_br = __esm({
1045
1067
  suggestReasonMatch: "combina com o seu perfil em",
1046
1068
  suggestReasonAnd: "e",
1047
1069
  suggestPaidHeader: "Pagos. A matr\xEDcula fica no navegador e nada \xE9 debitado por aqui:",
1048
- loginAccountOwnerManaged: "Esta conta agora \xE9 gerenciada por voc\xEA no ToStudy (senha ou login social), ent\xE3o c\xF3digos e magic-links da imers\xE3o n\xE3o funcionam mais. Rode `tostudy login` (sem --magic-link) para entrar pelo navegador.",
1070
+ loginAccountOwnerManaged: "Esta conta agora \xE9 gerenciada por voc\xEA na ToStudy (senha ou login social), ent\xE3o c\xF3digos e magic-links da imers\xE3o n\xE3o funcionam mais. Rode `tostudy login` (sem --magic-link) para entrar pelo navegador.",
1049
1071
  enrollmentNotEntitled: "\u{1F6AB} Sua matr\xEDcula neste curso n\xE3o est\xE1 mais ativa (reembolso, cancelamento ou preview expirado).\nPara voltar a estudar, adquira o curso novamente em https://tostudy.ai.\n",
1050
1072
  creator: {
1051
1073
  loginBrowserOnly: "`--creator` s\xF3 funciona no login pelo browser. Rode `tostudy login --creator` sem --code, --magic-link ou --manual.",
@@ -3595,7 +3617,7 @@ async function loginWithMagicLink(magicLinkUrl, apiUrl) {
3595
3617
  await persistSession(data, apiUrl);
3596
3618
  return data;
3597
3619
  }
3598
- var loginCommand = new Command("login").description("Autentica no ToStudy via browser").option("--manual", "Login manual (sem browser)").option("--code <code>", "Login n\xE3o-interativo via c\xF3digo de autentica\xE7\xE3o").option("--magic-link <url>", "Login via URL de magic-link (recupera\xE7\xE3o)").option("--creator", "Request the creator scope (author courses with your own AI agent)").option("--api-url <url>", "API URL override", DEFAULT_API_URL).action(
3620
+ var loginCommand = new Command("login").description("Autentica na ToStudy via browser").option("--manual", "Login manual (sem browser)").option("--code <code>", "Login n\xE3o-interativo via c\xF3digo de autentica\xE7\xE3o").option("--magic-link <url>", "Login via URL de magic-link (recupera\xE7\xE3o)").option("--creator", "Request the creator scope (author courses with your own AI agent)").option("--api-url <url>", "API URL override", DEFAULT_API_URL).action(
3599
3621
  async (opts) => {
3600
3622
  const apiUrl = opts.apiUrl;
3601
3623
  if (opts.creator && (opts.code || opts.magicLink || opts.manual)) {
@@ -3806,7 +3828,7 @@ import { spawn } from "node:child_process";
3806
3828
  import { hostname } from "node:os";
3807
3829
 
3808
3830
  // src/version.ts
3809
- var CLI_VERSION = true ? "0.18.23" : "0.7.1";
3831
+ var CLI_VERSION = true ? "0.18.25" : "0.7.1";
3810
3832
 
3811
3833
  // src/installer/mcp-setup.ts
3812
3834
  function safeServerError(text2) {
@@ -5252,9 +5274,9 @@ function buildPipelineDeps(opts = {}) {
5252
5274
  init_runtime_registry();
5253
5275
  import readline2 from "node:readline/promises";
5254
5276
  import { stdin, stdout } from "node:process";
5255
- var ROOT_AGENTS_QUESTION = "Esta pasta j\xE1 tem um AGENTS.md. Adicionar o bloco do ToStudy nele? [s/N] ";
5277
+ var ROOT_AGENTS_QUESTION = "Esta pasta j\xE1 tem um AGENTS.md. Adicionar o bloco da ToStudy nele? [s/N] ";
5256
5278
  function rootAgentsSkippedHint() {
5257
- return " AGENTS.md desta pasta n\xE3o foi alterado \u2014 rode `tostudy sync --root-agents` para adicionar o bloco do ToStudy.";
5279
+ return " AGENTS.md desta pasta n\xE3o foi alterado \u2014 rode `tostudy sync --root-agents` para adicionar o bloco da ToStudy.";
5258
5280
  }
5259
5281
  async function askViaReadline(question) {
5260
5282
  const rl = readline2.createInterface({ input: stdin, output: stdout });
@@ -19997,7 +20019,7 @@ function buildInitTemplate(userName, course, progress) {
19997
20019
  lines.push("## 5. Coexist\xEAncia");
19998
20020
  lines.push("Este workspace pode ter suas pr\xF3prias instru\xE7\xF5es (CLAUDE.md, AGENTS.md).");
19999
20021
  lines.push("- Instru\xE7\xF5es do projeto \u2192 decis\xF5es de c\xF3digo (estilo, lint, arquitetura)");
20000
- lines.push("- Instru\xE7\xF5es do ToStudy \u2192 fluxo de estudo (navega\xE7\xE3o, exerc\xEDcios, valida\xE7\xE3o)");
20022
+ lines.push("- Instru\xE7\xF5es da ToStudy \u2192 fluxo de estudo (navega\xE7\xE3o, exerc\xEDcios, valida\xE7\xE3o)");
20001
20023
  return lines.join("\n");
20002
20024
  }
20003
20025
  function resolveTutorMode(level) {
@@ -20727,7 +20749,7 @@ async function setupWorkspace(input2) {
20727
20749
  const readme = [
20728
20750
  `# ${input2.courseName}`,
20729
20751
  "",
20730
- "Workspace de estudo gerado pelo ToStudy.",
20752
+ "Workspace de estudo gerado pela ToStudy.",
20731
20753
  "",
20732
20754
  "## Estrutura",
20733
20755
  "",