@axlsdk/axl 0.9.0 → 0.9.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.
package/dist/index.d.cts CHANGED
@@ -200,10 +200,12 @@ type VoteOptions<T> = {
200
200
  type VerifyRetry<T> = {
201
201
  /** Error message from the failed attempt (schema or validate). */
202
202
  error: string;
203
- /** Raw return value from the previous fn call. */
203
+ /** Raw return value from the previous fn call. When fn() throws a ValidationError
204
+ * or VerifyError, falls back to err.lastOutput so the retry has data to repair. */
204
205
  output: unknown;
205
206
  /** Schema-parsed object — only present when schema passed but validate failed.
206
- * Safe to modify and return as the next attempt. */
207
+ * Also populated from ValidationError.lastOutput when fn() throws (e.g., inner
208
+ * ctx.ask() exhausted its validate retries). Safe to modify and return. */
207
209
  parsed?: T;
208
210
  };
209
211
  /** Verify options */
package/dist/index.d.ts CHANGED
@@ -200,10 +200,12 @@ type VoteOptions<T> = {
200
200
  type VerifyRetry<T> = {
201
201
  /** Error message from the failed attempt (schema or validate). */
202
202
  error: string;
203
- /** Raw return value from the previous fn call. */
203
+ /** Raw return value from the previous fn call. When fn() throws a ValidationError
204
+ * or VerifyError, falls back to err.lastOutput so the retry has data to repair. */
204
205
  output: unknown;
205
206
  /** Schema-parsed object — only present when schema passed but validate failed.
206
- * Safe to modify and return as the next attempt. */
207
+ * Also populated from ValidationError.lastOutput when fn() throws (e.g., inner
208
+ * ctx.ask() exhausted its validate retries). Safe to modify and return. */
207
209
  parsed?: T;
208
210
  };
209
211
  /** Verify options */
package/dist/index.js CHANGED
@@ -3345,7 +3345,7 @@ ${summaryResponse.content}`
3345
3345
  if (err instanceof ValidationError) {
3346
3346
  lastRetry = {
3347
3347
  error: err.reason,
3348
- output: rawOutput,
3348
+ output: rawOutput ?? err.lastOutput,
3349
3349
  parsed: err.lastOutput
3350
3350
  };
3351
3351
  if (attempt === maxRetries) {
@@ -3354,6 +3354,14 @@ ${summaryResponse.content}`
3354
3354
  }
3355
3355
  continue;
3356
3356
  }
3357
+ if (err instanceof VerifyError) {
3358
+ lastRetry = { error: err.message, output: rawOutput ?? err.lastOutput };
3359
+ if (attempt === maxRetries) {
3360
+ if (options?.fallback !== void 0) return options.fallback;
3361
+ throw err;
3362
+ }
3363
+ continue;
3364
+ }
3357
3365
  const errorMsg = err instanceof ZodError ? err.message : err instanceof Error ? err.message : String(err);
3358
3366
  lastRetry = { error: errorMsg, output: rawOutput };
3359
3367
  if (attempt === maxRetries) {