@algolia/wizard 0.92.0 → 0.93.0

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/main.js +37 -11
  2. package/package.json +1 -1
package/dist/main.js CHANGED
@@ -2384,7 +2384,7 @@ async function ensureApplication(resumeAppId) {
2384
2384
  // package.json
2385
2385
  var package_default = {
2386
2386
  name: "@algolia/wizard",
2387
- version: "0.92.0",
2387
+ version: "0.93.0",
2388
2388
  description: "Magically implement Algolia functionality in your codebase",
2389
2389
  type: "module",
2390
2390
  engines: {
@@ -5282,13 +5282,37 @@ function isProxyInactivityRejection(err) {
5282
5282
  const cause = RetryError.isInstance(err) ? err.lastError : err;
5283
5283
  return APICallError.isInstance(cause) && cause.statusCode === 401 && cause.responseBody === PROXY_REJECTION_BODY && cause.responseHeaders?.[PROXY_AUTH_REJECTED_HEADER2] === void 0;
5284
5284
  }
5285
+ var INCOMPLETE_CAUSES = {
5286
+ stepLimit: {
5287
+ kind: "missingReportAtStepLimit",
5288
+ reason: "reached its step limit"
5289
+ },
5290
+ truncated: {
5291
+ kind: "missingReportTruncated",
5292
+ reason: "was cut off by the output token limit"
5293
+ },
5294
+ stopped: {
5295
+ kind: "missingReportStopped",
5296
+ reason: "stopped before it finished"
5297
+ }
5298
+ };
5299
+ var INCOMPLETE_CAUSE_ENTRIES = Object.values(INCOMPLETE_CAUSES);
5300
+ function incompleteReasonOf(kind) {
5301
+ return INCOMPLETE_CAUSE_ENTRIES.find((entry) => entry.kind === kind)?.reason;
5302
+ }
5285
5303
  var MissingReportError = class extends Error {
5286
- atStepLimit;
5287
- constructor(atStepLimit) {
5304
+ incompleteCause;
5305
+ constructor(incompleteCause) {
5288
5306
  super(MISSING_REPORT_STATUS_ERROR_MESSAGE);
5289
- this.atStepLimit = atStepLimit;
5307
+ this.incompleteCause = incompleteCause;
5290
5308
  }
5291
5309
  };
5310
+ function incompleteCauseOf(stepCount, maxSteps, finishReason) {
5311
+ if (stepCount >= maxSteps) return "stepLimit";
5312
+ if (finishReason === "length") return "truncated";
5313
+ if (finishReason !== "stop") return "stopped";
5314
+ return null;
5315
+ }
5292
5316
  var AgentReportedFailureError = class extends Error {
5293
5317
  reason;
5294
5318
  constructor(reason) {
@@ -5314,11 +5338,11 @@ function withCachedHistory(messages) {
5314
5338
  ];
5315
5339
  }
5316
5340
  function isMissingReportRetry(kind) {
5317
- return kind === "missingReport" || kind === "missingReportAtStepLimit";
5341
+ return kind === "missingReport" || incompleteReasonOf(kind) !== void 0;
5318
5342
  }
5319
5343
  function retryKind(err) {
5320
5344
  if (err instanceof MissingReportError) {
5321
- return err.atStepLimit ? "missingReportAtStepLimit" : "missingReport";
5345
+ return err.incompleteCause ? INCOMPLETE_CAUSES[err.incompleteCause].kind : "missingReport";
5322
5346
  }
5323
5347
  if (NoOutputGeneratedError.isInstance(err)) return "transientProvider";
5324
5348
  if (APICallError.isInstance(err) && err.isRetryable) {
@@ -5354,6 +5378,7 @@ async function runAgentAttempt(req, attempt, retryReason) {
5354
5378
  const profileOptions = providerOptionsForProfile(profileName);
5355
5379
  const maxSteps = req.maxSteps ?? profile.maxSteps;
5356
5380
  const forceReport = retryReason === "missingReport";
5381
+ const incompleteReason = incompleteReasonOf(retryReason);
5357
5382
  const modelOptions = forceReport ? { thinking: { type: "disabled" } } : profileOptions;
5358
5383
  logger.info(
5359
5384
  {
@@ -5394,8 +5419,8 @@ async function runAgentAttempt(req, attempt, retryReason) {
5394
5419
  "The previous attempt ended without reportStatus. Do not repeat side effects. Use the available read tools to inspect existing work if needed, then call reportStatus."
5395
5420
  ] : [
5396
5421
  "The previous attempt ended without reportStatus. Do not repeat side effects. Call reportStatus now."
5397
- ] : retryReason === "missingReportAtStepLimit" ? [
5398
- "The previous attempt reached its step limit without reportStatus and may be incomplete. Inspect existing work, finish only the remaining work, avoid repeated side effects, and call reportStatus."
5422
+ ] : incompleteReason ? [
5423
+ `The previous attempt ${incompleteReason} without reportStatus and may be incomplete. Inspect existing work, finish only the remaining work, avoid repeated side effects, and call reportStatus.`
5399
5424
  ] : attempt > 0 ? [
5400
5425
  "This run is a retry after a transient AI service error. Files, shell commands, or ingestion may already have been applied in this workspace \u2014 inspect what is already there and continue from it rather than repeating that work."
5401
5426
  ] : []
@@ -5527,8 +5552,9 @@ async function runAgentAttempt(req, attempt, retryReason) {
5527
5552
  },
5528
5553
  "Agent finished without calling reportStatus"
5529
5554
  );
5530
- const incomplete = hitStepLimit || finishReason !== "stop";
5531
- throw new MissingReportError(incomplete);
5555
+ throw new MissingReportError(
5556
+ incompleteCauseOf(stepCount, maxSteps, finishReason)
5557
+ );
5532
5558
  }
5533
5559
  const result = report.output;
5534
5560
  if (result.status !== "success") {
@@ -9833,7 +9859,7 @@ async function resetProjectState() {
9833
9859
  // package.json with { type: 'json' }
9834
9860
  var package_default2 = {
9835
9861
  name: "@algolia/wizard",
9836
- version: "0.92.0",
9862
+ version: "0.93.0",
9837
9863
  description: "Magically implement Algolia functionality in your codebase",
9838
9864
  type: "module",
9839
9865
  engines: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@algolia/wizard",
3
- "version": "0.92.0",
3
+ "version": "0.93.0",
4
4
  "description": "Magically implement Algolia functionality in your codebase",
5
5
  "type": "module",
6
6
  "engines": {