chofex-cli 0.1.192 → 0.1.194

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 +26 -12
  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
@@ -60563,9 +60565,10 @@ tu razonamiento ni tomar la decisión de release por ti. Si cambias
60563
60565
  \`scheduler.js\`, vuelve a revisar la evidencia antes de reemplazar el review.
60564
60566
 
60565
60567
  La primera ejecución de \`challenge evaluate\` crea un enlace corto de
60566
- aprobación y **no consume** una evaluación. Abre ese enlace personalmente,
60567
- revisa el review vinculado al SHA-256 exacto y confirma con Face ID, Touch ID,
60568
- Windows Hello, PIN del dispositivo o una llave de seguridad. Después repite el
60568
+ aprobación y **no consume** una evaluación. Abre ese enlace en tu computadora,
60569
+ revisa el review vinculado al SHA-256 exacto y confirma con Windows Hello,
60570
+ Touch ID, PIN del equipo o una llave de seguridad. Google Workspace puede
60571
+ bloquear las passkeys del teléfono: no uses el código QR. Después repite el
60569
60572
  mismo comando para ejecutar la evaluación oficial. Cada evaluación requiere una
60570
60573
  aprobación nueva; la sesión OAuth del CLI no puede aprobarla.
60571
60574
 
@@ -61049,7 +61052,7 @@ var challengeQuickstart = {
61049
61052
  step: 10,
61050
61053
  action: "El participante aprueba en el navegador",
61051
61054
  command: "Abre approvalUrl personalmente",
61052
- note: "Revisa el razonamiento y confirma con Face ID, Touch ID, Windows Hello, PIN o llave de seguridad. El agente no puede completar este paso."
61055
+ note: "Abre el enlace en su computadora y confirma con Windows Hello, Touch ID, PIN o llave de seguridad. Google Workspace puede bloquear las passkeys del teléfono. El agente no puede completar este paso."
61053
61056
  },
61054
61057
  {
61055
61058
  step: 11,
@@ -61111,7 +61114,18 @@ var optionalString = (name, description) => exports_Flag.string(name).pipe(expor
61111
61114
  var challengeFlag = exports_Flag.string("challenge").pipe(exports_Flag.withDefault(defaultChallengeSlug), exports_Flag.withDescription("Challenge slug (default: broken-agent)"));
61112
61115
  var sourceFlag = optionalString("source", "JavaScript challenge solution file");
61113
61116
  var reviewFlag = optionalString("review", "Participant-authored Broken Agent engineering review JSON");
61117
+ var officialEvaluateRetryCommand = "chofex challenge evaluate --challenge broken-agent --source ./scheduler.js --review ./review.json";
61114
61118
  var evaluationErrorText = (error2) => {
61119
+ if (error2.code === "CHALLENGE_ENGINE_UNAVAILABLE") {
61120
+ return [
61121
+ "La evaluación oficial no se pudo completar.",
61122
+ "No es un error de tu computadora, y este intento no se consumió.",
61123
+ "",
61124
+ "Vuelve a ejecutar el mismo comando en unos segundos:",
61125
+ ` ${officialEvaluateRetryCommand}`
61126
+ ].join(`
61127
+ `);
61128
+ }
61115
61129
  if (error2.code !== "HUMAN_APPROVAL_REQUIRED")
61116
61130
  return;
61117
61131
  if (!error2.details || typeof error2.details !== "object")
@@ -61119,7 +61133,7 @@ var evaluationErrorText = (error2) => {
61119
61133
  const details = error2.details;
61120
61134
  if (typeof details.approvalUrl !== "string")
61121
61135
  return;
61122
- let retryCommand = "chofex challenge evaluate --challenge broken-agent --source ./scheduler.js --review ./review.json";
61136
+ let retryCommand = officialEvaluateRetryCommand;
61123
61137
  if (typeof details.retryCommand === "string") {
61124
61138
  retryCommand = details.retryCommand;
61125
61139
  }
@@ -61127,7 +61141,7 @@ var evaluationErrorText = (error2) => {
61127
61141
  "INTERVENCIÓN DEL PARTICIPANTE REQUERIDA",
61128
61142
  "La evaluación todavía no consumió un intento.",
61129
61143
  "",
61130
- "El participante debe abrir personalmente este enlace, revisar sus respuestas y aprobar con Face ID, Touch ID, Windows Hello, PIN o llave de seguridad:",
61144
+ "El participante debe abrir este enlace en su computadora, revisar sus respuestas y aprobar con Windows Hello, Touch ID, PIN o llave de seguridad. Google Workspace puede bloquear las passkeys del teléfono:",
61131
61145
  ` ${details.approvalUrl}`,
61132
61146
  "",
61133
61147
  "Después de aprobar, repite:",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "chofex-cli",
3
- "version": "0.1.192",
3
+ "version": "0.1.194",
4
4
  "description": "Command-line client for Hack the Andes",
5
5
  "type": "module",
6
6
  "bin": {