@algolia/wizard 0.103.0-rc.217.761 → 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.
- package/dist/main.js +66 -146
- 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
|
|
1635
|
-
input:
|
|
1636
|
-
output:
|
|
1637
|
-
cacheRead: 0.
|
|
1638
|
-
cacheWrite:
|
|
1630
|
+
var HAIKU_4_5_PRICES = {
|
|
1631
|
+
input: 1,
|
|
1632
|
+
output: 5,
|
|
1633
|
+
cacheRead: 0.1,
|
|
1634
|
+
cacheWrite: 1.25
|
|
1639
1635
|
};
|
|
1640
|
-
var
|
|
1636
|
+
var SONNET_5_PRICES = {
|
|
1641
1637
|
input: 2,
|
|
1642
1638
|
output: 10,
|
|
1643
|
-
cacheRead: 0.
|
|
1639
|
+
cacheRead: 0.2,
|
|
1644
1640
|
cacheWrite: 2.5
|
|
1645
1641
|
};
|
|
1646
1642
|
var MODEL_PROFILES = {
|
|
1647
1643
|
quick: {
|
|
1648
|
-
model: "claude-haiku-
|
|
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:
|
|
1648
|
+
prices: HAIKU_4_5_PRICES
|
|
1653
1649
|
},
|
|
1654
1650
|
analysis: {
|
|
1655
|
-
model: "claude-sonnet-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:
|
|
1656
|
+
prices: SONNET_5_PRICES
|
|
1661
1657
|
},
|
|
1662
1658
|
implementation: {
|
|
1663
|
-
model: "claude-sonnet-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:
|
|
1664
|
+
prices: SONNET_5_PRICES
|
|
1669
1665
|
},
|
|
1670
1666
|
implementationRetry: {
|
|
1671
|
-
model: "claude-sonnet-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:
|
|
1672
|
+
prices: SONNET_5_PRICES
|
|
1677
1673
|
},
|
|
1678
1674
|
validation: {
|
|
1679
|
-
model: "claude-sonnet-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:
|
|
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.
|
|
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.
|
|
2518
|
-
"@ai-sdk/openai-compatible": "^2.0.
|
|
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.
|
|
2501
|
+
ai: "^6.0.283",
|
|
2522
2502
|
"cross-keychain": "^1.1.0",
|
|
2523
2503
|
dotenv: "^17.4.2",
|
|
2524
2504
|
hono: "^4.13.8",
|
|
@@ -3216,18 +3196,6 @@ async function hasSymlinkParent(ctx, target) {
|
|
|
3216
3196
|
}
|
|
3217
3197
|
return false;
|
|
3218
3198
|
}
|
|
3219
|
-
var fileLocks = /* @__PURE__ */ new Map();
|
|
3220
|
-
async function withFileLock(target, fn) {
|
|
3221
|
-
const previous = fileLocks.get(target) ?? Promise.resolve();
|
|
3222
|
-
const run2 = previous.then(fn);
|
|
3223
|
-
const settled = run2.catch(() => void 0);
|
|
3224
|
-
fileLocks.set(target, settled);
|
|
3225
|
-
try {
|
|
3226
|
-
return await run2;
|
|
3227
|
-
} finally {
|
|
3228
|
-
if (fileLocks.get(target) === settled) fileLocks.delete(target);
|
|
3229
|
-
}
|
|
3230
|
-
}
|
|
3231
3199
|
function symlinkTargetError(target) {
|
|
3232
3200
|
return `Refused: ${target} is a symbolic link.`;
|
|
3233
3201
|
}
|
|
@@ -3476,10 +3444,7 @@ function writeFileTool(ctx) {
|
|
|
3476
3444
|
return secretEnvWriteRefusal(filePath);
|
|
3477
3445
|
}
|
|
3478
3446
|
try {
|
|
3479
|
-
const writeError = await
|
|
3480
|
-
resolved2.target,
|
|
3481
|
-
() => safeWriteFile(ctx, resolved2.target, content)
|
|
3482
|
-
);
|
|
3447
|
+
const writeError = await safeWriteFile(ctx, resolved2.target, content);
|
|
3483
3448
|
if (writeError) return writeError;
|
|
3484
3449
|
useWizard.getState().recordWrittenFile(resolved2.target);
|
|
3485
3450
|
return `Wrote to ${filePath}`;
|
|
@@ -3545,31 +3510,29 @@ function editFileTool(ctx) {
|
|
|
3545
3510
|
return "Error: oldString and newString are identical. No change made.";
|
|
3546
3511
|
}
|
|
3547
3512
|
try {
|
|
3548
|
-
|
|
3549
|
-
|
|
3550
|
-
|
|
3551
|
-
|
|
3552
|
-
|
|
3553
|
-
|
|
3554
|
-
|
|
3555
|
-
|
|
3556
|
-
return `Error: ${filePath} does not exist. To create it, use writeFile.`;
|
|
3557
|
-
}
|
|
3558
|
-
throw err;
|
|
3559
|
-
}
|
|
3560
|
-
const matches = countOccurrences(content, oldString);
|
|
3561
|
-
if (matches === 0) {
|
|
3562
|
-
return `Error: oldString not found in ${filePath}. Read the file again and copy the exact text, including whitespace.`;
|
|
3563
|
-
}
|
|
3564
|
-
if (matches > 1 && !replaceAll) {
|
|
3565
|
-
return `Error: oldString matches ${matches} places in ${filePath}. Add surrounding lines to make it unique, or set replaceAll to true.`;
|
|
3513
|
+
const unsafe = await validateSafeWriteTarget(ctx, resolved2.target);
|
|
3514
|
+
if (unsafe) return unsafe;
|
|
3515
|
+
let content;
|
|
3516
|
+
try {
|
|
3517
|
+
content = await readFile5(resolved2.target, "utf8");
|
|
3518
|
+
} catch (err) {
|
|
3519
|
+
if (err.code === "ENOENT") {
|
|
3520
|
+
return `Error: ${filePath} does not exist. To create it, use writeFile.`;
|
|
3566
3521
|
}
|
|
3567
|
-
|
|
3568
|
-
|
|
3569
|
-
|
|
3570
|
-
|
|
3571
|
-
return
|
|
3572
|
-
}
|
|
3522
|
+
throw err;
|
|
3523
|
+
}
|
|
3524
|
+
const matches = countOccurrences(content, oldString);
|
|
3525
|
+
if (matches === 0) {
|
|
3526
|
+
return `Error: oldString not found in ${filePath}. Read the file again and copy the exact text, including whitespace.`;
|
|
3527
|
+
}
|
|
3528
|
+
if (matches > 1 && !replaceAll) {
|
|
3529
|
+
return `Error: oldString matches ${matches} places in ${filePath}. Add surrounding lines to make it unique, or set replaceAll to true.`;
|
|
3530
|
+
}
|
|
3531
|
+
const updated = replaceAll ? content.split(oldString).join(newString) : replaceFirst(content, oldString, newString);
|
|
3532
|
+
const writeError = await safeWriteFile(ctx, resolved2.target, updated);
|
|
3533
|
+
if (writeError) return writeError;
|
|
3534
|
+
useWizard.getState().recordWrittenFile(resolved2.target);
|
|
3535
|
+
return matches > 1 ? `Edited ${filePath} (${matches} replacements)` : `Edited ${filePath}. ${editedSnippet(updated, content.indexOf(oldString), newString)}`;
|
|
3573
3536
|
} catch (err) {
|
|
3574
3537
|
return `Error editing ${filePath}: ${err.message}`;
|
|
3575
3538
|
}
|
|
@@ -5455,10 +5418,6 @@ var MISSING_REPORT_STATUS_ERROR_MESSAGE = "Agent finished without calling report
|
|
|
5455
5418
|
var MISSING_REPORT_USER_MESSAGE = "This step ran into a problem finishing. Run the wizard again to retry it.";
|
|
5456
5419
|
var REPORT_STATUS_RETRIES = 2;
|
|
5457
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.";
|
|
5458
|
-
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.";
|
|
5459
|
-
var ENDED_TURN_NUDGE = "Your last response did not call a tool. Continue the work with tools. When the work is done, call reportStatus.";
|
|
5460
|
-
var INITIAL_PROMPT = "Follow system instructions";
|
|
5461
|
-
var ENDED_TURN_CONTINUATIONS = 3;
|
|
5462
5421
|
var RECENT_STEPS_LOGGED = 3;
|
|
5463
5422
|
var LOGGED_CHARS = 300;
|
|
5464
5423
|
var ATTEMPT_NUMBER_OFFSET = 1;
|
|
@@ -5496,13 +5455,6 @@ var MissingReportError = class extends Error {
|
|
|
5496
5455
|
this.incompleteCause = incompleteCause;
|
|
5497
5456
|
}
|
|
5498
5457
|
};
|
|
5499
|
-
var EndedTurnError = class extends MissingReportError {
|
|
5500
|
-
continuation;
|
|
5501
|
-
constructor(continuation) {
|
|
5502
|
-
super(null);
|
|
5503
|
-
this.continuation = continuation;
|
|
5504
|
-
}
|
|
5505
|
-
};
|
|
5506
5458
|
function incompleteCauseOf(stepCount, maxSteps, finishReason) {
|
|
5507
5459
|
if (stepCount >= maxSteps) return "stepLimit";
|
|
5508
5460
|
if (finishReason === "length") return "truncated";
|
|
@@ -5561,23 +5513,10 @@ function exhaustedError(kind, err) {
|
|
|
5561
5513
|
}
|
|
5562
5514
|
async function runAgent(req) {
|
|
5563
5515
|
let retryReason = null;
|
|
5564
|
-
let attempt = INITIAL_ATTEMPT;
|
|
5565
|
-
let continuation;
|
|
5566
|
-
let continuations = 0;
|
|
5567
|
-
for (; ; ) {
|
|
5516
|
+
for (let attempt = INITIAL_ATTEMPT; attempt <= REPORT_STATUS_RETRIES; attempt++) {
|
|
5568
5517
|
try {
|
|
5569
|
-
return await runAgentAttempt(req, attempt, retryReason
|
|
5518
|
+
return await runAgentAttempt(req, attempt, retryReason);
|
|
5570
5519
|
} catch (err) {
|
|
5571
|
-
continuation = void 0;
|
|
5572
|
-
if (err instanceof EndedTurnError && continuations < ENDED_TURN_CONTINUATIONS) {
|
|
5573
|
-
continuations++;
|
|
5574
|
-
continuation = err.continuation;
|
|
5575
|
-
logger.warn(
|
|
5576
|
-
{ attempt: attempt + 1, continuations },
|
|
5577
|
-
"continuing runAgent after a turn ended without a tool call"
|
|
5578
|
-
);
|
|
5579
|
-
continue;
|
|
5580
|
-
}
|
|
5581
5520
|
const kind = retryKind(err);
|
|
5582
5521
|
if (!kind) throw err;
|
|
5583
5522
|
if (attempt === REPORT_STATUS_RETRIES) throw exhaustedError(kind, err);
|
|
@@ -5586,23 +5525,19 @@ async function runAgent(req) {
|
|
|
5586
5525
|
{ attempt: attempt + 1, err },
|
|
5587
5526
|
isMissingReportRetry(kind) ? "retrying runAgent after missing reportStatus" : "retrying runAgent after a transient provider error"
|
|
5588
5527
|
);
|
|
5589
|
-
attempt++;
|
|
5590
5528
|
}
|
|
5591
5529
|
}
|
|
5530
|
+
throw new Error("unreachable");
|
|
5592
5531
|
}
|
|
5593
|
-
async function runAgentAttempt(req, attempt, retryReason
|
|
5532
|
+
async function runAgentAttempt(req, attempt, retryReason) {
|
|
5594
5533
|
const start = Date.now();
|
|
5595
5534
|
const profileName = req.modelProfile ?? "implementation" /* implementation */;
|
|
5596
5535
|
const profile = getModelProfile(profileName);
|
|
5597
5536
|
const profileOptions = providerOptionsForProfile(profileName);
|
|
5598
|
-
const toolChoice = toolChoiceForProfile(profileName);
|
|
5599
5537
|
const maxSteps = req.maxSteps ?? profile.maxSteps;
|
|
5600
|
-
const stepsUsed = continuation?.stepsUsed ?? 0;
|
|
5601
|
-
const stepsLeft = maxSteps - stepsUsed;
|
|
5602
5538
|
const forceReport = retryReason === "missingReport";
|
|
5603
5539
|
const incompleteReason = incompleteReasonOf(retryReason);
|
|
5604
|
-
const
|
|
5605
|
-
const modelOptions = forceReport ? { thinking: reportThinking, effort: void 0 } : profileOptions;
|
|
5540
|
+
const modelOptions = forceReport ? { thinking: { type: "disabled" } } : profileOptions;
|
|
5606
5541
|
logger.info(
|
|
5607
5542
|
{
|
|
5608
5543
|
startedAt: new Date(start).toISOString(),
|
|
@@ -5610,9 +5545,8 @@ async function runAgentAttempt(req, attempt, retryReason, continuation) {
|
|
|
5610
5545
|
profile: profileName,
|
|
5611
5546
|
model: profile.model,
|
|
5612
5547
|
effort: forceReport ? void 0 : profile.effort,
|
|
5613
|
-
thinking: forceReport ?
|
|
5614
|
-
retryReason
|
|
5615
|
-
stepsUsed
|
|
5548
|
+
thinking: forceReport ? "disabled" : profile.thinking,
|
|
5549
|
+
retryReason
|
|
5616
5550
|
},
|
|
5617
5551
|
"runAgent started"
|
|
5618
5552
|
);
|
|
@@ -5626,7 +5560,7 @@ async function runAgentAttempt(req, attempt, retryReason, continuation) {
|
|
|
5626
5560
|
fetch: proxyFetch
|
|
5627
5561
|
});
|
|
5628
5562
|
const toolContext = req.toolContext ?? createToolContext();
|
|
5629
|
-
if (attempt > INITIAL_ATTEMPT
|
|
5563
|
+
if (attempt > INITIAL_ATTEMPT) resetToolCounts(toolContext);
|
|
5630
5564
|
const readTools = ["readFile", "searchFiles", "listFiles"];
|
|
5631
5565
|
const hasReadTools = !req.tools || req.tools.some((t) => readTools.includes(t));
|
|
5632
5566
|
const instructions = [
|
|
@@ -5635,7 +5569,6 @@ async function runAgentAttempt(req, attempt, retryReason, continuation) {
|
|
|
5635
5569
|
"When you need to read or search multiple files, issue those tool calls together in one step rather than one at a time."
|
|
5636
5570
|
] : [],
|
|
5637
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.",
|
|
5638
|
-
...toolChoice === "auto" ? [TOOL_EVERY_TURN_INSTRUCTION] : [],
|
|
5639
5572
|
STEP_LIMIT_INSTRUCTION,
|
|
5640
5573
|
// Last so a retry does not bust the cached tools+system prefix from
|
|
5641
5574
|
// the first attempt. Inspect-and-continue, not start over: implement
|
|
@@ -5680,11 +5613,11 @@ async function runAgentAttempt(req, attempt, retryReason, continuation) {
|
|
|
5680
5613
|
output: req.outputSchema,
|
|
5681
5614
|
tools: req.tools
|
|
5682
5615
|
}),
|
|
5683
|
-
toolChoice,
|
|
5684
|
-
stopWhen: [reportAccepted, stepCountIs(
|
|
5616
|
+
toolChoice: "required",
|
|
5617
|
+
stopWhen: [reportAccepted, stepCountIs(maxSteps)],
|
|
5685
5618
|
prepareStep: ({ stepNumber, messages }) => ({
|
|
5686
5619
|
messages: withCachedHistory(messages),
|
|
5687
|
-
...stepNumber >=
|
|
5620
|
+
...stepNumber >= maxSteps - 1 && {
|
|
5688
5621
|
activeTools: ["reportStatus"]
|
|
5689
5622
|
}
|
|
5690
5623
|
}),
|
|
@@ -5692,11 +5625,9 @@ async function runAgentAttempt(req, attempt, retryReason, continuation) {
|
|
|
5692
5625
|
...{ onError: () => {
|
|
5693
5626
|
} }
|
|
5694
5627
|
});
|
|
5695
|
-
const
|
|
5696
|
-
|
|
5697
|
-
|
|
5698
|
-
] : [{ role: "user", content: INITIAL_PROMPT }];
|
|
5699
|
-
const stream = await agent.stream({ prompt });
|
|
5628
|
+
const stream = await agent.stream({
|
|
5629
|
+
prompt: "Follow system instructions"
|
|
5630
|
+
});
|
|
5700
5631
|
let chunks = [];
|
|
5701
5632
|
const chunkLimit = 5;
|
|
5702
5633
|
let streamError;
|
|
@@ -5728,18 +5659,16 @@ async function runAgentAttempt(req, attempt, retryReason, continuation) {
|
|
|
5728
5659
|
const usage = await stream.totalUsage;
|
|
5729
5660
|
const steps = await stream.steps;
|
|
5730
5661
|
const stepCount = steps.length;
|
|
5731
|
-
const
|
|
5732
|
-
const hitStepLimit = totalSteps >= maxSteps;
|
|
5662
|
+
const hitStepLimit = stepCount >= maxSteps;
|
|
5733
5663
|
const lastStep = steps[steps.length - 1];
|
|
5734
5664
|
const finishReason = lastStep?.finishReason;
|
|
5735
5665
|
trackAgentRun({
|
|
5736
5666
|
operation: req.operation,
|
|
5737
5667
|
profile: profileName,
|
|
5738
5668
|
attempt: attempt + ATTEMPT_NUMBER_OFFSET,
|
|
5739
|
-
continuation: continuation?.number ?? 0,
|
|
5740
5669
|
durationMs: end - start,
|
|
5741
5670
|
usage,
|
|
5742
|
-
stepCount
|
|
5671
|
+
stepCount,
|
|
5743
5672
|
hitStepLimit,
|
|
5744
5673
|
finishReason
|
|
5745
5674
|
});
|
|
@@ -5751,7 +5680,7 @@ async function runAgentAttempt(req, attempt, retryReason, continuation) {
|
|
|
5751
5680
|
profile: profileName,
|
|
5752
5681
|
model: profile.model,
|
|
5753
5682
|
usage,
|
|
5754
|
-
stepCount
|
|
5683
|
+
stepCount,
|
|
5755
5684
|
maxSteps,
|
|
5756
5685
|
hitStepLimit,
|
|
5757
5686
|
finishReason
|
|
@@ -5778,17 +5707,8 @@ async function runAgentAttempt(req, attempt, retryReason, continuation) {
|
|
|
5778
5707
|
},
|
|
5779
5708
|
"Agent finished without calling reportStatus"
|
|
5780
5709
|
);
|
|
5781
|
-
const endedTurn = toolChoice === "auto" && finishReason === "stop" && !lastStep?.toolCalls?.length && !hitStepLimit;
|
|
5782
|
-
if (endedTurn) {
|
|
5783
|
-
const { messages } = await stream.response;
|
|
5784
|
-
throw new EndedTurnError({
|
|
5785
|
-
messages: [...prompt, ...messages],
|
|
5786
|
-
stepsUsed: totalSteps,
|
|
5787
|
-
number: (continuation?.number ?? 0) + 1
|
|
5788
|
-
});
|
|
5789
|
-
}
|
|
5790
5710
|
throw new MissingReportError(
|
|
5791
|
-
incompleteCauseOf(
|
|
5711
|
+
incompleteCauseOf(stepCount, maxSteps, finishReason)
|
|
5792
5712
|
);
|
|
5793
5713
|
}
|
|
5794
5714
|
const result = report.output;
|
|
@@ -10162,7 +10082,7 @@ async function resetProjectState() {
|
|
|
10162
10082
|
// package.json with { type: 'json' }
|
|
10163
10083
|
var package_default2 = {
|
|
10164
10084
|
name: "@algolia/wizard",
|
|
10165
|
-
version: "0.103.0-rc.
|
|
10085
|
+
version: "0.103.0-rc.226.758",
|
|
10166
10086
|
description: "Magically implement Algolia functionality in your codebase",
|
|
10167
10087
|
type: "module",
|
|
10168
10088
|
engines: {
|
|
@@ -10209,11 +10129,11 @@ var package_default2 = {
|
|
|
10209
10129
|
vitest: "^4.1.11"
|
|
10210
10130
|
},
|
|
10211
10131
|
dependencies: {
|
|
10212
|
-
"@ai-sdk/anthropic": "^3.0.
|
|
10213
|
-
"@ai-sdk/openai-compatible": "^2.0.
|
|
10132
|
+
"@ai-sdk/anthropic": "^3.0.118",
|
|
10133
|
+
"@ai-sdk/openai-compatible": "^2.0.75",
|
|
10214
10134
|
"@hono/node-server": "^2.0.10",
|
|
10215
10135
|
"@segment/analytics-node": "^3.1.0",
|
|
10216
|
-
ai: "^6.0.
|
|
10136
|
+
ai: "^6.0.283",
|
|
10217
10137
|
"cross-keychain": "^1.1.0",
|
|
10218
10138
|
dotenv: "^17.4.2",
|
|
10219
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.
|
|
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.
|
|
51
|
-
"@ai-sdk/openai-compatible": "^2.0.
|
|
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.
|
|
54
|
+
"ai": "^6.0.283",
|
|
55
55
|
"cross-keychain": "^1.1.0",
|
|
56
56
|
"dotenv": "^17.4.2",
|
|
57
57
|
"hono": "^4.13.8",
|