chofex-cli 0.1.191 → 0.1.193

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 +38 -52
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -59728,7 +59728,9 @@ var resolveAuthentication = (suppliedToken, campaignAttribution, authenticate, f
59728
59728
  catch: (error2) => cliError("AUTHENTICATION_REQUIRED", String(error2), false)
59729
59729
  });
59730
59730
  };
59731
- var sendRequest = (options, path4, init, credentials) => exports_Effect.tryPromise({
59731
+ var defaultRequestTimeoutMs = 20000;
59732
+ var challengeEvaluateRequestTimeoutMs = 30000;
59733
+ var sendRequest = (options, path4, init, credentials, timeoutMs = defaultRequestTimeoutMs) => exports_Effect.tryPromise({
59732
59734
  try: () => {
59733
59735
  const headers = new Headers(init.headers);
59734
59736
  headers.set("accept", "application/json");
@@ -59747,7 +59749,7 @@ var sendRequest = (options, path4, init, credentials) => exports_Effect.tryPromi
59747
59749
  return fetch(endpoint(options.apiUrl, path4), {
59748
59750
  ...init,
59749
59751
  headers,
59750
- signal: AbortSignal.timeout(20000)
59752
+ signal: AbortSignal.timeout(timeoutMs)
59751
59753
  });
59752
59754
  },
59753
59755
  catch: (error2) => cliError("NETWORK_ERROR", `Could not reach the registration API: ${String(error2)}`, true)
@@ -59766,15 +59768,15 @@ var decodeHttpBody = exports_Effect.fn("decodeHttpBody")(function* (response, de
59766
59768
  }
59767
59769
  return yield* decodeResponse(body).pipe(exports_Effect.mapError((error2) => cliError("INVALID_API_RESPONSE", "The API response did not match protocol version 1", false, { issues: String(error2) })));
59768
59770
  });
59769
- var request3 = exports_Effect.fn("apiRequest")(function* (options, path4, init, decodeResponse) {
59771
+ var request3 = exports_Effect.fn("apiRequest")(function* (options, path4, init, decodeResponse, timeoutMs = defaultRequestTimeoutMs) {
59770
59772
  const suppliedToken = options.token ?? process.env.CHOFEX_TOKEN;
59771
59773
  const authenticate = options.authenticate ?? authentication;
59772
59774
  const credentials = yield* resolveAuthentication(suppliedToken, options.campaignAttribution, authenticate);
59773
- let response = yield* sendRequest(options, path4, init, credentials);
59775
+ let response = yield* sendRequest(options, path4, init, credentials, timeoutMs);
59774
59776
  if (response.status === 401 && !suppliedToken) {
59775
59777
  const refreshed = yield* resolveAuthentication(undefined, undefined, authenticate, true).pipe(exports_Effect.map((value3) => ({ ok: true, value: value3 })), exports_Effect.catch(() => exports_Effect.succeed({ ok: false })));
59776
59778
  if (refreshed.ok) {
59777
- response = yield* sendRequest(options, path4, init, refreshed.value);
59779
+ response = yield* sendRequest(options, path4, init, refreshed.value, timeoutMs);
59778
59780
  }
59779
59781
  }
59780
59782
  return yield* decodeHttpBody(response, decodeResponse);
@@ -59810,7 +59812,7 @@ var listChallenges = (options) => publicRequest(options, "/api/v1/challenges", {
59810
59812
  var getChallengeAttempt = (options, slug) => request3(options, `/api/v1/challenges/${slug}`, { method: "GET" }, decodeChallengeAttempt);
59811
59813
  var queryChallenge = (options, slug, input) => request3(options, `/api/v1/challenges/${slug}/query`, { method: "POST", body: JSON.stringify(input) }, decodeChallengeQuery);
59812
59814
  var testChallenge = (options, slug, input) => request3(options, `/api/v1/challenges/${slug}/test`, { method: "POST", body: JSON.stringify(input) }, decodeChallengeTest);
59813
- var evaluateChallenge = (options, slug, input) => request3(options, `/api/v1/challenges/${slug}/evaluate`, { method: "POST", body: JSON.stringify(input) }, decodeChallengeEvaluation);
59815
+ var evaluateChallenge = (options, slug, input) => request3(options, `/api/v1/challenges/${slug}/evaluate`, { method: "POST", body: JSON.stringify(input) }, decodeChallengeEvaluation, challengeEvaluateRequestTimeoutMs);
59814
59816
  var getChallengeRanking = (options, slug) => publicRequest(options, `/api/v1/challenges/${slug}/ranking`, { method: "GET" }, decodeChallengeRanking);
59815
59817
 
59816
59818
  // src/challenge-input.ts
@@ -60238,31 +60240,17 @@ var challengeTestText = (result3) => {
60238
60240
  `);
60239
60241
  };
60240
60242
  var challengeEvaluateText = (result3) => {
60241
- if (result3.breakdown) {
60242
- const executionCost = result3.executionCost ?? result3.runtimeMs;
60243
- const capabilityLines = [
60244
- ["Comportamiento base", result3.breakdown.coreBehavior],
60245
- ["Persistencia", result3.breakdown.persistence],
60246
- ["Concurrencia", result3.breakdown.concurrency],
60247
- ["Recuperación", result3.breakdown.failureRecovery],
60248
- ["Idempotencia", result3.breakdown.idempotency],
60249
- ["Sin regresiones", result3.breakdown.regressionSafety],
60250
- ["Rendimiento", result3.breakdown.performance]
60251
- ];
60243
+ if (result3.rankingPath === "/challenges/broken-agent") {
60252
60244
  const lines3 = [
60253
60245
  "VEREDICTO OFICIAL — BROKEN AGENT — PREPARACIÓN PARA PRODUCCIÓN",
60254
- `Puntaje ${(result3.accuracy * 100).toFixed(2)} / ${result3.sampleSize}`,
60255
- `Costo determinístico ${executionCost} ops`,
60256
- "",
60257
- "Puntajes por capacidad",
60258
- ...capabilityLines.map(([label, score]) => `${label.padEnd(20)}${score.earned.toFixed(2)} / ${score.available}`)
60246
+ `Puntaje ${(result3.accuracy * 100).toFixed(2)} / ${result3.sampleSize}`
60259
60247
  ];
60260
60248
  if (result3.rank !== undefined) {
60261
60249
  lines3.push(`Puesto #${result3.rank}`);
60262
60250
  }
60263
60251
  lines3.push(`Evaluaciones oficiales restantes ${result3.evaluationsRemaining} / ${result3.evaluationsLimit}`, "", result3.shareText, "", "Siguiente: consulta el ranking", " chofex challenge ranking --challenge broken-agent");
60264
60252
  if (result3.evaluationsRemaining > 0) {
60265
- lines3.push("", "El evaluador reporta capacidades, no casos ocultos individuales. Razona antes de volver a enviar.", " chofex challenge test --challenge broken-agent --source ./scheduler.js");
60253
+ lines3.push("", "El veredicto es un solo puntaje. No dice qué caso falló. Razona antes de volver a enviar.", " chofex challenge test --challenge broken-agent --source ./scheduler.js");
60266
60254
  }
60267
60255
  return lines3.join(`
60268
60256
  `);
@@ -60298,16 +60286,14 @@ var challengeRankingText = (ranking, now3 = new Date) => {
60298
60286
  `);
60299
60287
  }
60300
60288
  if (ranking.challenge.slug === "broken-agent") {
60301
- lines2.push("Psto Puntaje Puntos Costo Nombre");
60289
+ lines2.push("Psto Puntaje Puntos Nombre");
60302
60290
  for (const entry of ranking.entries.slice(0, 20)) {
60303
60291
  const rank = String(entry.rank).padStart(4, " ");
60304
60292
  const accuracy = percent(entry.accuracy).padStart(8, " ");
60305
60293
  const points = `${entry.exactCount}/${entry.sampleSize}`.padStart(11, " ");
60306
- const executionCost = entry.executionCost ?? entry.runtimeMs;
60307
- const runtime = `${executionCost}ops`.padStart(8, " ");
60308
60294
  const profileLinks = [entry.githubUrl, entry.linkedInUrl].filter(Boolean);
60309
60295
  const participant = [entry.displayName, ...profileLinks].join(" ");
60310
- lines2.push(`${rank} ${accuracy} ${points} ${runtime} ${participant}`);
60296
+ lines2.push(`${rank} ${accuracy} ${points} ${participant}`);
60311
60297
  }
60312
60298
  return lines2.join(`
60313
60299
  `);
@@ -60619,13 +60605,13 @@ aprobación nueva; la sesión OAuth del CLI no puede aprobarla.
60619
60605
  - El store sobrevive nuevas instancias del scheduler y reinicios del proceso.
60620
60606
  - Varios workers, incluso instancias que reutilizan un \`workerId\` después de
60621
60607
  reiniciar, pueden llamar \`runDue()\` contra el mismo store.
60622
- - \`runDue()\` intenta una vez cada job vencido al inicio de esa llamada. Un job
60623
- que falla queda pendiente para una llamada posterior y no bloquea otros jobs.
60624
- - Cada ejecución debe reclamarse atómicamente antes de llamar al executor. El
60625
- claim dura 30 segundos y necesita una identidad única distinta de
60626
- \`workerId\`. Cuando \`clock.now()\` alcanza el deadline, otro worker puede
60627
- reclamarlo. Un worker obsoleto nunca puede completar ni reabrir un claim más
60628
- nuevo.
60608
+ - \`runDue()\` reclama un job antes de llamar al executor. Un job que falla
60609
+ queda pendiente para una llamada posterior y no bloquea otros jobs.
60610
+ - Cada ejecución debe reclamarse atómicamente. El claim dura 30 segundos.
60611
+ Cuando \`clock.now()\` alcanza ese deadline, otro worker puede reclamar el
60612
+ job. Un worker que ya no es dueño del claim, incluido un proceso que vuelve
60613
+ con el mismo \`workerId\`, no puede completarlo, marcarlo como fallido ni
60614
+ reabrirlo.
60629
60615
  - Un intento se cuenta al reclamar el job. Después de 3 ejecuciones fallidas el
60630
60616
  job queda failed.
60631
60617
  - \`execute(job)\` puede fallar antes o después de aplicar el efecto. El adapter
@@ -60642,24 +60628,13 @@ ofrece operaciones síncronas \`get(id)\`, \`put(job)\`, \`delete(id)\` y
60642
60628
 
60643
60629
  ## Evaluación
60644
60630
 
60645
- El evaluador usa variantes determinísticas por participante para probar el
60646
- contrato bajo concurrencia, reinicios, fallas, idempotencia, compatibilidad y
60647
- carga. Reporta puntajes por capacidad, no casos ocultos individuales.
60648
-
60649
- - Comportamiento base: 10 puntos
60650
- - Persistencia: 15 puntos
60651
- - Concurrencia: 20 puntos
60652
- - Recuperación ante fallas: 20 puntos
60653
- - Idempotencia: 15 puntos
60654
- - Seguridad contra regresiones: 15 puntos
60655
- - Rendimiento: 5 puntos, solo si la carga termina correctamente y sin perder
60656
- seguridad de concurrencia
60631
+ El evaluador usa variantes determinísticas por participante. El veredicto
60632
+ oficial es un solo puntaje sobre 100. No incluye casos ocultos, un desglose por
60633
+ capacidad ni un costo de ejecución.
60657
60634
 
60658
60635
  El ranking exige una postulación enviada o revisada. Ordena por puntaje total,
60659
- menos evaluaciones oficiales, costo determinístico de ejecución y hora del mejor
60660
- envío. El costo es \`transacciones + ceil(jobs recorridos por tx.list / 10)\` en
60661
- una carga equivalente para todos; no usa tiempo de servidor. Todos los puntajes
60662
- válidos aparecen en el ranking.
60636
+ luego por menos evaluaciones oficiales y, al final, por la hora del mejor
60637
+ envío. Todos los puntajes válidos aparecen en el ranking.
60663
60638
  `;
60664
60639
  var brokenAgentPublicTestSource = `const test = require("node:test");
60665
60640
  const assert = require("node:assert/strict");
@@ -61014,7 +60989,7 @@ var challengeQuickstart = {
61014
60989
  "Los mejores resultados de los rankings serán seleccionados para el evento.",
61015
60990
  "Tienes 5 evaluaciones oficiales contra variantes ocultas y determinísticas por participante.",
61016
60991
  "Los tests locales y públicos son ilimitados.",
61017
- "Gana el puntaje total; los empates usan menos evaluaciones, costo determinístico y hora del mejor envío.",
60992
+ "Gana el puntaje total; los empates usan menos evaluaciones y la hora del mejor envío.",
61018
60993
  "Las herramientas de AI están permitidas, pero el participante toma las decisiones de ingeniería."
61019
60994
  ],
61020
60995
  workflow: [
@@ -61138,7 +61113,18 @@ var optionalString = (name, description) => exports_Flag.string(name).pipe(expor
61138
61113
  var challengeFlag = exports_Flag.string("challenge").pipe(exports_Flag.withDefault(defaultChallengeSlug), exports_Flag.withDescription("Challenge slug (default: broken-agent)"));
61139
61114
  var sourceFlag = optionalString("source", "JavaScript challenge solution file");
61140
61115
  var reviewFlag = optionalString("review", "Participant-authored Broken Agent engineering review JSON");
61116
+ var officialEvaluateRetryCommand = "chofex challenge evaluate --challenge broken-agent --source ./scheduler.js --review ./review.json";
61141
61117
  var evaluationErrorText = (error2) => {
61118
+ if (error2.code === "CHALLENGE_ENGINE_UNAVAILABLE") {
61119
+ return [
61120
+ "La evaluación oficial no se pudo completar.",
61121
+ "No es un error de tu computadora, y este intento no se consumió.",
61122
+ "",
61123
+ "Vuelve a ejecutar el mismo comando en unos segundos:",
61124
+ ` ${officialEvaluateRetryCommand}`
61125
+ ].join(`
61126
+ `);
61127
+ }
61142
61128
  if (error2.code !== "HUMAN_APPROVAL_REQUIRED")
61143
61129
  return;
61144
61130
  if (!error2.details || typeof error2.details !== "object")
@@ -61146,7 +61132,7 @@ var evaluationErrorText = (error2) => {
61146
61132
  const details = error2.details;
61147
61133
  if (typeof details.approvalUrl !== "string")
61148
61134
  return;
61149
- let retryCommand = "chofex challenge evaluate --challenge broken-agent --source ./scheduler.js --review ./review.json";
61135
+ let retryCommand = officialEvaluateRetryCommand;
61150
61136
  if (typeof details.retryCommand === "string") {
61151
61137
  retryCommand = details.retryCommand;
61152
61138
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "chofex-cli",
3
- "version": "0.1.191",
3
+ "version": "0.1.193",
4
4
  "description": "Command-line client for Hack the Andes",
5
5
  "type": "module",
6
6
  "bin": {