@algolia/wizard 0.97.0-rc.217.726 → 0.97.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 +41 -94
  2. package/package.json +4 -4
package/dist/main.js CHANGED
@@ -1606,10 +1606,6 @@ async function clearWorkflowState(workflowId) {
1606
1606
  }
1607
1607
 
1608
1608
  // src/lib/modelProfiles.ts
1609
- var MODEL_CAPABILITIES = {
1610
- "claude-haiku-5-5": { forcedToolUse: true, lowestThinking: "disabled" },
1611
- "claude-sonnet-5-5": { forcedToolUse: false, lowestThinking: "between_tools" }
1612
- };
1613
1609
  var TOKENS_PER_MILLION = 1e6;
1614
1610
  var INITIAL_MODEL_ATTEMPT = 1;
1615
1611
  var NO_TOKENS = 0;
@@ -1621,57 +1617,57 @@ var IMPLEMENTATION_MAX_OUTPUT_TOKENS = 65536;
1621
1617
  var IMPLEMENTATION_MAX_STEPS = 48;
1622
1618
  var VALIDATION_MAX_OUTPUT_TOKENS = 8192;
1623
1619
  var VALIDATION_MAX_STEPS = 24;
1624
- var HAIKU_5_5_PRICES = {
1625
- input: 0.1,
1626
- output: 0.5,
1627
- cacheRead: 0.01,
1628
- cacheWrite: 0.125
1620
+ var HAIKU_4_5_PRICES = {
1621
+ input: 1,
1622
+ output: 5,
1623
+ cacheRead: 0.1,
1624
+ cacheWrite: 1.25
1629
1625
  };
1630
- var SONNET_5_5_PRICES = {
1626
+ var SONNET_5_PRICES = {
1631
1627
  input: 2,
1632
1628
  output: 10,
1633
- cacheRead: 0.1,
1629
+ cacheRead: 0.2,
1634
1630
  cacheWrite: 2.5
1635
1631
  };
1636
1632
  var MODEL_PROFILES = {
1637
1633
  quick: {
1638
- model: "claude-haiku-5-5",
1634
+ model: "claude-haiku-4-5",
1639
1635
  thinking: "disabled",
1640
1636
  maxOutputTokens: QUICK_MAX_OUTPUT_TOKENS,
1641
1637
  maxSteps: QUICK_MAX_STEPS,
1642
- prices: HAIKU_5_5_PRICES
1638
+ prices: HAIKU_4_5_PRICES
1643
1639
  },
1644
1640
  analysis: {
1645
- model: "claude-sonnet-5-5",
1641
+ model: "claude-sonnet-5",
1646
1642
  thinking: "adaptive",
1647
1643
  effort: "low",
1648
1644
  maxOutputTokens: ANALYSIS_MAX_OUTPUT_TOKENS,
1649
1645
  maxSteps: ANALYSIS_MAX_STEPS,
1650
- prices: SONNET_5_5_PRICES
1646
+ prices: SONNET_5_PRICES
1651
1647
  },
1652
1648
  implementation: {
1653
- model: "claude-sonnet-5-5",
1649
+ model: "claude-sonnet-5",
1654
1650
  thinking: "adaptive",
1655
1651
  effort: "medium",
1656
1652
  maxOutputTokens: IMPLEMENTATION_MAX_OUTPUT_TOKENS,
1657
1653
  maxSteps: IMPLEMENTATION_MAX_STEPS,
1658
- prices: SONNET_5_5_PRICES
1654
+ prices: SONNET_5_PRICES
1659
1655
  },
1660
1656
  implementationRetry: {
1661
- model: "claude-sonnet-5-5",
1657
+ model: "claude-sonnet-5",
1662
1658
  thinking: "adaptive",
1663
1659
  effort: "high",
1664
1660
  maxOutputTokens: IMPLEMENTATION_MAX_OUTPUT_TOKENS,
1665
1661
  maxSteps: IMPLEMENTATION_MAX_STEPS,
1666
- prices: SONNET_5_5_PRICES
1662
+ prices: SONNET_5_PRICES
1667
1663
  },
1668
1664
  validation: {
1669
- model: "claude-sonnet-5-5",
1665
+ model: "claude-sonnet-5",
1670
1666
  thinking: "adaptive",
1671
1667
  effort: "low",
1672
1668
  maxOutputTokens: VALIDATION_MAX_OUTPUT_TOKENS,
1673
1669
  maxSteps: VALIDATION_MAX_STEPS,
1674
- prices: SONNET_5_5_PRICES
1670
+ prices: SONNET_5_PRICES
1675
1671
  }
1676
1672
  };
1677
1673
  function getModelProfile(profileName) {
@@ -1684,14 +1680,6 @@ function providerOptionsForProfile(profileName) {
1684
1680
  ...profile.effort !== void 0 && { effort: profile.effort }
1685
1681
  };
1686
1682
  }
1687
- function toolChoiceForProfile(profileName) {
1688
- const { model } = getModelProfile(profileName);
1689
- return MODEL_CAPABILITIES[model].forcedToolUse ? "required" : "auto";
1690
- }
1691
- function lowestThinkingForProfile(profileName) {
1692
- const { model } = getModelProfile(profileName);
1693
- return { type: MODEL_CAPABILITIES[model].lowestThinking };
1694
- }
1695
1683
  function tokenCount(value = NO_TOKENS) {
1696
1684
  return value;
1697
1685
  }
@@ -2396,7 +2384,7 @@ async function ensureApplication(resumeAppId) {
2396
2384
  // package.json
2397
2385
  var package_default = {
2398
2386
  name: "@algolia/wizard",
2399
- version: "0.97.0-rc.217.726",
2387
+ version: "0.97.0",
2400
2388
  description: "Magically implement Algolia functionality in your codebase",
2401
2389
  type: "module",
2402
2390
  engines: {
@@ -2443,11 +2431,11 @@ var package_default = {
2443
2431
  vitest: "^4.1.11"
2444
2432
  },
2445
2433
  dependencies: {
2446
- "@ai-sdk/anthropic": "^3.0.128",
2447
- "@ai-sdk/openai-compatible": "^2.0.81",
2434
+ "@ai-sdk/anthropic": "^3.0.118",
2435
+ "@ai-sdk/openai-compatible": "^2.0.75",
2448
2436
  "@hono/node-server": "^2.0.10",
2449
2437
  "@segment/analytics-node": "^3.1.0",
2450
- ai: "^6.0.302",
2438
+ ai: "^6.0.283",
2451
2439
  "cross-keychain": "^1.1.0",
2452
2440
  dotenv: "^17.4.2",
2453
2441
  hono: "^4.13.8",
@@ -5282,10 +5270,6 @@ var MISSING_REPORT_STATUS_ERROR_MESSAGE = "Agent finished without calling report
5282
5270
  var MISSING_REPORT_USER_MESSAGE = "This step ran into a problem finishing. Run the wizard again to retry it.";
5283
5271
  var REPORT_STATUS_RETRIES = 2;
5284
5272
  var STEP_LIMIT_INSTRUCTION = "When reportStatus is the only tool available, you reached the step limit. This limit is not a failure, so do not report fail because of it: report status=success with the work done so far, and name the remaining work in the summary.";
5285
- var TOOL_EVERY_TURN_INSTRUCTION = "Call at least one tool in every response. Do not reply with text only. The run ends only when you call reportStatus.";
5286
- var ENDED_TURN_NUDGE = "Your last response did not call a tool. Continue the work with tools. When the work is done, call reportStatus.";
5287
- var INITIAL_PROMPT = "Follow system instructions";
5288
- var ENDED_TURN_CONTINUATIONS = 3;
5289
5273
  var RECENT_STEPS_LOGGED = 3;
5290
5274
  var LOGGED_CHARS = 300;
5291
5275
  var ATTEMPT_NUMBER_OFFSET = 1;
@@ -5323,13 +5307,6 @@ var MissingReportError = class extends Error {
5323
5307
  this.incompleteCause = incompleteCause;
5324
5308
  }
5325
5309
  };
5326
- var EndedTurnError = class extends MissingReportError {
5327
- continuation;
5328
- constructor(continuation) {
5329
- super(null);
5330
- this.continuation = continuation;
5331
- }
5332
- };
5333
5310
  function incompleteCauseOf(stepCount, maxSteps, finishReason) {
5334
5311
  if (stepCount >= maxSteps) return "stepLimit";
5335
5312
  if (finishReason === "length") return "truncated";
@@ -5380,23 +5357,10 @@ function exhaustedError(kind, err) {
5380
5357
  }
5381
5358
  async function runAgent(req) {
5382
5359
  let retryReason = null;
5383
- let attempt = INITIAL_ATTEMPT;
5384
- let continuation;
5385
- let continuations = 0;
5386
- for (; ; ) {
5360
+ for (let attempt = INITIAL_ATTEMPT; attempt <= REPORT_STATUS_RETRIES; attempt++) {
5387
5361
  try {
5388
- return await runAgentAttempt(req, attempt, retryReason, continuation);
5362
+ return await runAgentAttempt(req, attempt, retryReason);
5389
5363
  } catch (err) {
5390
- continuation = void 0;
5391
- if (err instanceof EndedTurnError && continuations < ENDED_TURN_CONTINUATIONS) {
5392
- continuations++;
5393
- continuation = err.continuation;
5394
- logger.warn(
5395
- { attempt: attempt + 1, continuations },
5396
- "continuing runAgent after a turn ended without a tool call"
5397
- );
5398
- continue;
5399
- }
5400
5364
  const kind = retryKind(err);
5401
5365
  if (!kind) throw err;
5402
5366
  if (attempt === REPORT_STATUS_RETRIES) throw exhaustedError(kind, err);
@@ -5405,23 +5369,19 @@ async function runAgent(req) {
5405
5369
  { attempt: attempt + 1, err },
5406
5370
  isMissingReportRetry(kind) ? "retrying runAgent after missing reportStatus" : "retrying runAgent after a transient provider error"
5407
5371
  );
5408
- attempt++;
5409
5372
  }
5410
5373
  }
5374
+ throw new Error("unreachable");
5411
5375
  }
5412
- async function runAgentAttempt(req, attempt, retryReason, continuation) {
5376
+ async function runAgentAttempt(req, attempt, retryReason) {
5413
5377
  const start = Date.now();
5414
5378
  const profileName = req.modelProfile ?? "implementation" /* implementation */;
5415
5379
  const profile = getModelProfile(profileName);
5416
5380
  const profileOptions = providerOptionsForProfile(profileName);
5417
- const toolChoice = toolChoiceForProfile(profileName);
5418
5381
  const maxSteps = req.maxSteps ?? profile.maxSteps;
5419
- const stepsUsed = continuation?.stepsUsed ?? 0;
5420
- const stepsLeft = maxSteps - stepsUsed;
5421
5382
  const forceReport = retryReason === "missingReport";
5422
5383
  const incompleteReason = incompleteReasonOf(retryReason);
5423
- const reportThinking = lowestThinkingForProfile(profileName);
5424
- const modelOptions = forceReport ? { thinking: reportThinking, effort: void 0 } : profileOptions;
5384
+ const modelOptions = forceReport ? { thinking: { type: "disabled" } } : profileOptions;
5425
5385
  logger.info(
5426
5386
  {
5427
5387
  startedAt: new Date(start).toISOString(),
@@ -5429,9 +5389,8 @@ async function runAgentAttempt(req, attempt, retryReason, continuation) {
5429
5389
  profile: profileName,
5430
5390
  model: profile.model,
5431
5391
  effort: forceReport ? void 0 : profile.effort,
5432
- thinking: forceReport ? reportThinking.type : profile.thinking,
5433
- retryReason,
5434
- stepsUsed
5392
+ thinking: forceReport ? "disabled" : profile.thinking,
5393
+ retryReason
5435
5394
  },
5436
5395
  "runAgent started"
5437
5396
  );
@@ -5445,7 +5404,7 @@ async function runAgentAttempt(req, attempt, retryReason, continuation) {
5445
5404
  fetch: proxyFetch
5446
5405
  });
5447
5406
  const toolContext = req.toolContext ?? createToolContext();
5448
- if (attempt > INITIAL_ATTEMPT && !continuation) resetToolCounts(toolContext);
5407
+ if (attempt > INITIAL_ATTEMPT) resetToolCounts(toolContext);
5449
5408
  const readTools = ["readFile", "searchFiles", "listFiles"];
5450
5409
  const hasReadTools = !req.tools || req.tools.some((t) => readTools.includes(t));
5451
5410
  const instructions = [
@@ -5454,7 +5413,6 @@ async function runAgentAttempt(req, attempt, retryReason, continuation) {
5454
5413
  "When you need to read or search multiple files, issue those tool calls together in one step rather than one at a time."
5455
5414
  ] : [],
5456
5415
  "Call notifyUser whenever you start a new phase of work or your focus shifts (e.g. moving from reading code to writing files) \u2014 a short, plain-language, high-level update. Do not call it for every tool use.",
5457
- ...toolChoice === "auto" ? [TOOL_EVERY_TURN_INSTRUCTION] : [],
5458
5416
  STEP_LIMIT_INSTRUCTION,
5459
5417
  // Last so a retry does not bust the cached tools+system prefix from
5460
5418
  // the first attempt. Inspect-and-continue, not start over: implement
@@ -5499,14 +5457,14 @@ async function runAgentAttempt(req, attempt, retryReason, continuation) {
5499
5457
  output: req.outputSchema,
5500
5458
  tools: req.tools
5501
5459
  }),
5502
- toolChoice,
5460
+ toolChoice: "required",
5503
5461
  stopWhen: [
5504
5462
  hasToolCall("reportStatus"),
5505
- stepCountIs(stepsLeft)
5463
+ stepCountIs(maxSteps)
5506
5464
  ],
5507
5465
  prepareStep: ({ stepNumber, messages }) => ({
5508
5466
  messages: withCachedHistory(messages),
5509
- ...stepNumber >= stepsLeft - 1 && {
5467
+ ...stepNumber >= maxSteps - 1 && {
5510
5468
  activeTools: ["reportStatus"]
5511
5469
  }
5512
5470
  }),
@@ -5514,11 +5472,9 @@ async function runAgentAttempt(req, attempt, retryReason, continuation) {
5514
5472
  ...{ onError: () => {
5515
5473
  } }
5516
5474
  });
5517
- const prompt = continuation ? [
5518
- ...continuation.messages,
5519
- { role: "user", content: ENDED_TURN_NUDGE }
5520
- ] : [{ role: "user", content: INITIAL_PROMPT }];
5521
- const stream = await agent.stream({ prompt });
5475
+ const stream = await agent.stream({
5476
+ prompt: "Follow system instructions"
5477
+ });
5522
5478
  let chunks = [];
5523
5479
  const chunkLimit = 5;
5524
5480
  let streamError;
@@ -5550,8 +5506,7 @@ async function runAgentAttempt(req, attempt, retryReason, continuation) {
5550
5506
  const usage = await stream.totalUsage;
5551
5507
  const steps = await stream.steps;
5552
5508
  const stepCount = steps.length;
5553
- const totalSteps = stepsUsed + stepCount;
5554
- const hitStepLimit = totalSteps >= maxSteps;
5509
+ const hitStepLimit = stepCount >= maxSteps;
5555
5510
  const lastStep = steps[steps.length - 1];
5556
5511
  const finishReason = lastStep?.finishReason;
5557
5512
  trackAgentRun({
@@ -5599,16 +5554,8 @@ async function runAgentAttempt(req, attempt, retryReason, continuation) {
5599
5554
  },
5600
5555
  "Agent finished without calling reportStatus"
5601
5556
  );
5602
- const endedTurn = toolChoice === "auto" && finishReason === "stop" && !lastStep?.toolCalls?.length && !hitStepLimit;
5603
- if (endedTurn) {
5604
- const { messages } = await stream.response;
5605
- throw new EndedTurnError({
5606
- messages: [...prompt, ...messages],
5607
- stepsUsed: totalSteps
5608
- });
5609
- }
5610
5557
  throw new MissingReportError(
5611
- incompleteCauseOf(totalSteps, maxSteps, finishReason)
5558
+ incompleteCauseOf(stepCount, maxSteps, finishReason)
5612
5559
  );
5613
5560
  }
5614
5561
  const result = report.output;
@@ -9956,7 +9903,7 @@ async function resetProjectState() {
9956
9903
  // package.json with { type: 'json' }
9957
9904
  var package_default2 = {
9958
9905
  name: "@algolia/wizard",
9959
- version: "0.97.0-rc.217.726",
9906
+ version: "0.97.0",
9960
9907
  description: "Magically implement Algolia functionality in your codebase",
9961
9908
  type: "module",
9962
9909
  engines: {
@@ -10003,11 +9950,11 @@ var package_default2 = {
10003
9950
  vitest: "^4.1.11"
10004
9951
  },
10005
9952
  dependencies: {
10006
- "@ai-sdk/anthropic": "^3.0.128",
10007
- "@ai-sdk/openai-compatible": "^2.0.81",
9953
+ "@ai-sdk/anthropic": "^3.0.118",
9954
+ "@ai-sdk/openai-compatible": "^2.0.75",
10008
9955
  "@hono/node-server": "^2.0.10",
10009
9956
  "@segment/analytics-node": "^3.1.0",
10010
- ai: "^6.0.302",
9957
+ ai: "^6.0.283",
10011
9958
  "cross-keychain": "^1.1.0",
10012
9959
  dotenv: "^17.4.2",
10013
9960
  hono: "^4.13.8",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@algolia/wizard",
3
- "version": "0.97.0-rc.217.726",
3
+ "version": "0.97.0",
4
4
  "description": "Magically implement Algolia functionality in your codebase",
5
5
  "type": "module",
6
6
  "engines": {
@@ -47,11 +47,11 @@
47
47
  "vitest": "^4.1.11"
48
48
  },
49
49
  "dependencies": {
50
- "@ai-sdk/anthropic": "^3.0.128",
51
- "@ai-sdk/openai-compatible": "^2.0.81",
50
+ "@ai-sdk/anthropic": "^3.0.118",
51
+ "@ai-sdk/openai-compatible": "^2.0.75",
52
52
  "@hono/node-server": "^2.0.10",
53
53
  "@segment/analytics-node": "^3.1.0",
54
- "ai": "^6.0.302",
54
+ "ai": "^6.0.283",
55
55
  "cross-keychain": "^1.1.0",
56
56
  "dotenv": "^17.4.2",
57
57
  "hono": "^4.13.8",