@algolia/wizard 0.103.0-rc.217.760 → 0.103.0-rc.226.758

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 +43 -106
  2. package/package.json +4 -4
package/dist/main.js CHANGED
@@ -1616,10 +1616,6 @@ async function clearWorkflowState(workflowId) {
1616
1616
  }
1617
1617
 
1618
1618
  // src/lib/modelProfiles.ts
1619
- var MODEL_CAPABILITIES = {
1620
- "claude-haiku-5-5": { forcedToolUse: true, lowestThinking: "disabled" },
1621
- "claude-sonnet-5-5": { forcedToolUse: false, lowestThinking: "between_tools" }
1622
- };
1623
1619
  var TOKENS_PER_MILLION = 1e6;
1624
1620
  var INITIAL_MODEL_ATTEMPT = 1;
1625
1621
  var NO_TOKENS = 0;
@@ -1631,57 +1627,57 @@ var IMPLEMENTATION_MAX_OUTPUT_TOKENS = 65536;
1631
1627
  var IMPLEMENTATION_MAX_STEPS = 48;
1632
1628
  var VALIDATION_MAX_OUTPUT_TOKENS = 8192;
1633
1629
  var VALIDATION_MAX_STEPS = 24;
1634
- var HAIKU_5_5_PRICES = {
1635
- input: 0.1,
1636
- output: 0.5,
1637
- cacheRead: 0.01,
1638
- cacheWrite: 0.125
1630
+ var HAIKU_4_5_PRICES = {
1631
+ input: 1,
1632
+ output: 5,
1633
+ cacheRead: 0.1,
1634
+ cacheWrite: 1.25
1639
1635
  };
1640
- var SONNET_5_5_PRICES = {
1636
+ var SONNET_5_PRICES = {
1641
1637
  input: 2,
1642
1638
  output: 10,
1643
- cacheRead: 0.1,
1639
+ cacheRead: 0.2,
1644
1640
  cacheWrite: 2.5
1645
1641
  };
1646
1642
  var MODEL_PROFILES = {
1647
1643
  quick: {
1648
- model: "claude-haiku-5-5",
1644
+ model: "claude-haiku-4-5",
1649
1645
  thinking: "disabled",
1650
1646
  maxOutputTokens: QUICK_MAX_OUTPUT_TOKENS,
1651
1647
  maxSteps: QUICK_MAX_STEPS,
1652
- prices: HAIKU_5_5_PRICES
1648
+ prices: HAIKU_4_5_PRICES
1653
1649
  },
1654
1650
  analysis: {
1655
- model: "claude-sonnet-5-5",
1651
+ model: "claude-sonnet-5",
1656
1652
  thinking: "adaptive",
1657
1653
  effort: "low",
1658
1654
  maxOutputTokens: ANALYSIS_MAX_OUTPUT_TOKENS,
1659
1655
  maxSteps: ANALYSIS_MAX_STEPS,
1660
- prices: SONNET_5_5_PRICES
1656
+ prices: SONNET_5_PRICES
1661
1657
  },
1662
1658
  implementation: {
1663
- model: "claude-sonnet-5-5",
1659
+ model: "claude-sonnet-5",
1664
1660
  thinking: "adaptive",
1665
1661
  effort: "medium",
1666
1662
  maxOutputTokens: IMPLEMENTATION_MAX_OUTPUT_TOKENS,
1667
1663
  maxSteps: IMPLEMENTATION_MAX_STEPS,
1668
- prices: SONNET_5_5_PRICES
1664
+ prices: SONNET_5_PRICES
1669
1665
  },
1670
1666
  implementationRetry: {
1671
- model: "claude-sonnet-5-5",
1667
+ model: "claude-sonnet-5",
1672
1668
  thinking: "adaptive",
1673
1669
  effort: "high",
1674
1670
  maxOutputTokens: IMPLEMENTATION_MAX_OUTPUT_TOKENS,
1675
1671
  maxSteps: IMPLEMENTATION_MAX_STEPS,
1676
- prices: SONNET_5_5_PRICES
1672
+ prices: SONNET_5_PRICES
1677
1673
  },
1678
1674
  validation: {
1679
- model: "claude-sonnet-5-5",
1675
+ model: "claude-sonnet-5",
1680
1676
  thinking: "adaptive",
1681
1677
  effort: "low",
1682
1678
  maxOutputTokens: VALIDATION_MAX_OUTPUT_TOKENS,
1683
1679
  maxSteps: VALIDATION_MAX_STEPS,
1684
- prices: SONNET_5_5_PRICES
1680
+ prices: SONNET_5_PRICES
1685
1681
  }
1686
1682
  };
1687
1683
  function getModelProfile(profileName) {
@@ -1694,14 +1690,6 @@ function providerOptionsForProfile(profileName) {
1694
1690
  ...profile.effort !== void 0 && { effort: profile.effort }
1695
1691
  };
1696
1692
  }
1697
- function toolChoiceForProfile(profileName) {
1698
- const { model } = getModelProfile(profileName);
1699
- return MODEL_CAPABILITIES[model].forcedToolUse ? "required" : "auto";
1700
- }
1701
- function lowestThinkingForProfile(profileName) {
1702
- const { model } = getModelProfile(profileName);
1703
- return { type: MODEL_CAPABILITIES[model].lowestThinking };
1704
- }
1705
1693
  function tokenCount(value = NO_TOKENS) {
1706
1694
  return value;
1707
1695
  }
@@ -1722,7 +1710,6 @@ function estimateModelCost(profileName, usage) {
1722
1710
  var COUNT_METRIC = 1;
1723
1711
  var GAUGE_METRIC = 3;
1724
1712
  var FIRST_ATTEMPT = 1;
1725
- var NO_CONTINUATION = 0;
1726
1713
  var NO_TOKENS2 = 0;
1727
1714
  var NO_COST = 0;
1728
1715
  var AGENT_TELEMETRY_CONTEXT = {
@@ -1876,12 +1863,6 @@ function agentRunMetrics(event, values, tags) {
1876
1863
  type: COUNT_METRIC,
1877
1864
  tags: runTags
1878
1865
  },
1879
- {
1880
- name: "wizard.agent.continuation",
1881
- value: Number((event.continuation ?? NO_CONTINUATION) > NO_CONTINUATION),
1882
- type: COUNT_METRIC,
1883
- tags: runTags
1884
- },
1885
1866
  ...event.stepCount === void 0 ? [] : [
1886
1867
  {
1887
1868
  name: "wizard.agent.step_count",
@@ -1924,7 +1905,6 @@ function trackAgentRun(event) {
1924
1905
  effort: profile.effort ?? "none",
1925
1906
  thinking: profile.thinking,
1926
1907
  attempt: event.attempt,
1927
- continuation: event.continuation,
1928
1908
  durationMs: event.durationMs,
1929
1909
  stepCount: event.stepCount,
1930
1910
  hitStepLimit: event.hitStepLimit,
@@ -2467,7 +2447,7 @@ async function ensureApplication(resumeAppId) {
2467
2447
  // package.json
2468
2448
  var package_default = {
2469
2449
  name: "@algolia/wizard",
2470
- version: "0.103.0-rc.217.760",
2450
+ version: "0.103.0-rc.226.758",
2471
2451
  description: "Magically implement Algolia functionality in your codebase",
2472
2452
  type: "module",
2473
2453
  engines: {
@@ -2514,11 +2494,11 @@ var package_default = {
2514
2494
  vitest: "^4.1.11"
2515
2495
  },
2516
2496
  dependencies: {
2517
- "@ai-sdk/anthropic": "^3.0.128",
2518
- "@ai-sdk/openai-compatible": "^2.0.81",
2497
+ "@ai-sdk/anthropic": "^3.0.118",
2498
+ "@ai-sdk/openai-compatible": "^2.0.75",
2519
2499
  "@hono/node-server": "^2.0.10",
2520
2500
  "@segment/analytics-node": "^3.1.0",
2521
- ai: "^6.0.302",
2501
+ ai: "^6.0.283",
2522
2502
  "cross-keychain": "^1.1.0",
2523
2503
  dotenv: "^17.4.2",
2524
2504
  hono: "^4.13.8",
@@ -5438,10 +5418,6 @@ var MISSING_REPORT_STATUS_ERROR_MESSAGE = "Agent finished without calling report
5438
5418
  var MISSING_REPORT_USER_MESSAGE = "This step ran into a problem finishing. Run the wizard again to retry it.";
5439
5419
  var REPORT_STATUS_RETRIES = 2;
5440
5420
  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.";
5441
- 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.";
5442
- var ENDED_TURN_NUDGE = "Your last response did not call a tool. Continue the work with tools. When the work is done, call reportStatus.";
5443
- var INITIAL_PROMPT = "Follow system instructions";
5444
- var ENDED_TURN_CONTINUATIONS = 3;
5445
5421
  var RECENT_STEPS_LOGGED = 3;
5446
5422
  var LOGGED_CHARS = 300;
5447
5423
  var ATTEMPT_NUMBER_OFFSET = 1;
@@ -5479,13 +5455,6 @@ var MissingReportError = class extends Error {
5479
5455
  this.incompleteCause = incompleteCause;
5480
5456
  }
5481
5457
  };
5482
- var EndedTurnError = class extends MissingReportError {
5483
- continuation;
5484
- constructor(continuation) {
5485
- super(null);
5486
- this.continuation = continuation;
5487
- }
5488
- };
5489
5458
  function incompleteCauseOf(stepCount, maxSteps, finishReason) {
5490
5459
  if (stepCount >= maxSteps) return "stepLimit";
5491
5460
  if (finishReason === "length") return "truncated";
@@ -5544,23 +5513,10 @@ function exhaustedError(kind, err) {
5544
5513
  }
5545
5514
  async function runAgent(req) {
5546
5515
  let retryReason = null;
5547
- let attempt = INITIAL_ATTEMPT;
5548
- let continuation;
5549
- let continuations = 0;
5550
- for (; ; ) {
5516
+ for (let attempt = INITIAL_ATTEMPT; attempt <= REPORT_STATUS_RETRIES; attempt++) {
5551
5517
  try {
5552
- return await runAgentAttempt(req, attempt, retryReason, continuation);
5518
+ return await runAgentAttempt(req, attempt, retryReason);
5553
5519
  } catch (err) {
5554
- continuation = void 0;
5555
- if (err instanceof EndedTurnError && continuations < ENDED_TURN_CONTINUATIONS) {
5556
- continuations++;
5557
- continuation = err.continuation;
5558
- logger.warn(
5559
- { attempt: attempt + 1, continuations },
5560
- "continuing runAgent after a turn ended without a tool call"
5561
- );
5562
- continue;
5563
- }
5564
5520
  const kind = retryKind(err);
5565
5521
  if (!kind) throw err;
5566
5522
  if (attempt === REPORT_STATUS_RETRIES) throw exhaustedError(kind, err);
@@ -5569,23 +5525,19 @@ async function runAgent(req) {
5569
5525
  { attempt: attempt + 1, err },
5570
5526
  isMissingReportRetry(kind) ? "retrying runAgent after missing reportStatus" : "retrying runAgent after a transient provider error"
5571
5527
  );
5572
- attempt++;
5573
5528
  }
5574
5529
  }
5530
+ throw new Error("unreachable");
5575
5531
  }
5576
- async function runAgentAttempt(req, attempt, retryReason, continuation) {
5532
+ async function runAgentAttempt(req, attempt, retryReason) {
5577
5533
  const start = Date.now();
5578
5534
  const profileName = req.modelProfile ?? "implementation" /* implementation */;
5579
5535
  const profile = getModelProfile(profileName);
5580
5536
  const profileOptions = providerOptionsForProfile(profileName);
5581
- const toolChoice = toolChoiceForProfile(profileName);
5582
5537
  const maxSteps = req.maxSteps ?? profile.maxSteps;
5583
- const stepsUsed = continuation?.stepsUsed ?? 0;
5584
- const stepsLeft = maxSteps - stepsUsed;
5585
5538
  const forceReport = retryReason === "missingReport";
5586
5539
  const incompleteReason = incompleteReasonOf(retryReason);
5587
- const reportThinking = lowestThinkingForProfile(profileName);
5588
- const modelOptions = forceReport ? { thinking: reportThinking, effort: void 0 } : profileOptions;
5540
+ const modelOptions = forceReport ? { thinking: { type: "disabled" } } : profileOptions;
5589
5541
  logger.info(
5590
5542
  {
5591
5543
  startedAt: new Date(start).toISOString(),
@@ -5593,9 +5545,8 @@ async function runAgentAttempt(req, attempt, retryReason, continuation) {
5593
5545
  profile: profileName,
5594
5546
  model: profile.model,
5595
5547
  effort: forceReport ? void 0 : profile.effort,
5596
- thinking: forceReport ? reportThinking.type : profile.thinking,
5597
- retryReason,
5598
- stepsUsed
5548
+ thinking: forceReport ? "disabled" : profile.thinking,
5549
+ retryReason
5599
5550
  },
5600
5551
  "runAgent started"
5601
5552
  );
@@ -5609,7 +5560,7 @@ async function runAgentAttempt(req, attempt, retryReason, continuation) {
5609
5560
  fetch: proxyFetch
5610
5561
  });
5611
5562
  const toolContext = req.toolContext ?? createToolContext();
5612
- if (attempt > INITIAL_ATTEMPT && !continuation) resetToolCounts(toolContext);
5563
+ if (attempt > INITIAL_ATTEMPT) resetToolCounts(toolContext);
5613
5564
  const readTools = ["readFile", "searchFiles", "listFiles"];
5614
5565
  const hasReadTools = !req.tools || req.tools.some((t) => readTools.includes(t));
5615
5566
  const instructions = [
@@ -5618,7 +5569,6 @@ async function runAgentAttempt(req, attempt, retryReason, continuation) {
5618
5569
  "When you need to read or search multiple files, issue those tool calls together in one step rather than one at a time."
5619
5570
  ] : [],
5620
5571
  "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.",
5621
- ...toolChoice === "auto" ? [TOOL_EVERY_TURN_INSTRUCTION] : [],
5622
5572
  STEP_LIMIT_INSTRUCTION,
5623
5573
  // Last so a retry does not bust the cached tools+system prefix from
5624
5574
  // the first attempt. Inspect-and-continue, not start over: implement
@@ -5663,11 +5613,11 @@ async function runAgentAttempt(req, attempt, retryReason, continuation) {
5663
5613
  output: req.outputSchema,
5664
5614
  tools: req.tools
5665
5615
  }),
5666
- toolChoice,
5667
- stopWhen: [reportAccepted, stepCountIs(stepsLeft)],
5616
+ toolChoice: "required",
5617
+ stopWhen: [reportAccepted, stepCountIs(maxSteps)],
5668
5618
  prepareStep: ({ stepNumber, messages }) => ({
5669
5619
  messages: withCachedHistory(messages),
5670
- ...stepNumber >= stepsLeft - 1 && {
5620
+ ...stepNumber >= maxSteps - 1 && {
5671
5621
  activeTools: ["reportStatus"]
5672
5622
  }
5673
5623
  }),
@@ -5675,11 +5625,9 @@ async function runAgentAttempt(req, attempt, retryReason, continuation) {
5675
5625
  ...{ onError: () => {
5676
5626
  } }
5677
5627
  });
5678
- const prompt = continuation ? [
5679
- ...continuation.messages,
5680
- { role: "user", content: ENDED_TURN_NUDGE }
5681
- ] : [{ role: "user", content: INITIAL_PROMPT }];
5682
- const stream = await agent.stream({ prompt });
5628
+ const stream = await agent.stream({
5629
+ prompt: "Follow system instructions"
5630
+ });
5683
5631
  let chunks = [];
5684
5632
  const chunkLimit = 5;
5685
5633
  let streamError;
@@ -5711,18 +5659,16 @@ async function runAgentAttempt(req, attempt, retryReason, continuation) {
5711
5659
  const usage = await stream.totalUsage;
5712
5660
  const steps = await stream.steps;
5713
5661
  const stepCount = steps.length;
5714
- const totalSteps = stepsUsed + stepCount;
5715
- const hitStepLimit = totalSteps >= maxSteps;
5662
+ const hitStepLimit = stepCount >= maxSteps;
5716
5663
  const lastStep = steps[steps.length - 1];
5717
5664
  const finishReason = lastStep?.finishReason;
5718
5665
  trackAgentRun({
5719
5666
  operation: req.operation,
5720
5667
  profile: profileName,
5721
5668
  attempt: attempt + ATTEMPT_NUMBER_OFFSET,
5722
- continuation: continuation?.number ?? 0,
5723
5669
  durationMs: end - start,
5724
5670
  usage,
5725
- stepCount: totalSteps,
5671
+ stepCount,
5726
5672
  hitStepLimit,
5727
5673
  finishReason
5728
5674
  });
@@ -5734,7 +5680,7 @@ async function runAgentAttempt(req, attempt, retryReason, continuation) {
5734
5680
  profile: profileName,
5735
5681
  model: profile.model,
5736
5682
  usage,
5737
- stepCount: totalSteps,
5683
+ stepCount,
5738
5684
  maxSteps,
5739
5685
  hitStepLimit,
5740
5686
  finishReason
@@ -5761,17 +5707,8 @@ async function runAgentAttempt(req, attempt, retryReason, continuation) {
5761
5707
  },
5762
5708
  "Agent finished without calling reportStatus"
5763
5709
  );
5764
- const endedTurn = toolChoice === "auto" && finishReason === "stop" && !lastStep?.toolCalls?.length && !hitStepLimit;
5765
- if (endedTurn) {
5766
- const { messages } = await stream.response;
5767
- throw new EndedTurnError({
5768
- messages: [...prompt, ...messages],
5769
- stepsUsed: totalSteps,
5770
- number: (continuation?.number ?? 0) + 1
5771
- });
5772
- }
5773
5710
  throw new MissingReportError(
5774
- incompleteCauseOf(totalSteps, maxSteps, finishReason)
5711
+ incompleteCauseOf(stepCount, maxSteps, finishReason)
5775
5712
  );
5776
5713
  }
5777
5714
  const result = report.output;
@@ -10145,7 +10082,7 @@ async function resetProjectState() {
10145
10082
  // package.json with { type: 'json' }
10146
10083
  var package_default2 = {
10147
10084
  name: "@algolia/wizard",
10148
- version: "0.103.0-rc.217.760",
10085
+ version: "0.103.0-rc.226.758",
10149
10086
  description: "Magically implement Algolia functionality in your codebase",
10150
10087
  type: "module",
10151
10088
  engines: {
@@ -10192,11 +10129,11 @@ var package_default2 = {
10192
10129
  vitest: "^4.1.11"
10193
10130
  },
10194
10131
  dependencies: {
10195
- "@ai-sdk/anthropic": "^3.0.128",
10196
- "@ai-sdk/openai-compatible": "^2.0.81",
10132
+ "@ai-sdk/anthropic": "^3.0.118",
10133
+ "@ai-sdk/openai-compatible": "^2.0.75",
10197
10134
  "@hono/node-server": "^2.0.10",
10198
10135
  "@segment/analytics-node": "^3.1.0",
10199
- ai: "^6.0.302",
10136
+ ai: "^6.0.283",
10200
10137
  "cross-keychain": "^1.1.0",
10201
10138
  dotenv: "^17.4.2",
10202
10139
  hono: "^4.13.8",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@algolia/wizard",
3
- "version": "0.103.0-rc.217.760",
3
+ "version": "0.103.0-rc.226.758",
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",