@algolia/wizard 0.91.0 → 0.92.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.
- package/dist/main.js +57 -18
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -1817,7 +1817,21 @@ function agentRunMetrics(event, values, tags) {
|
|
|
1817
1817
|
value: Number(event.attempt > FIRST_ATTEMPT),
|
|
1818
1818
|
type: COUNT_METRIC,
|
|
1819
1819
|
tags: runTags
|
|
1820
|
-
}
|
|
1820
|
+
},
|
|
1821
|
+
...event.stepCount === void 0 ? [] : [
|
|
1822
|
+
{
|
|
1823
|
+
name: "wizard.agent.step_count",
|
|
1824
|
+
value: event.stepCount,
|
|
1825
|
+
type: GAUGE_METRIC,
|
|
1826
|
+
tags: runTags
|
|
1827
|
+
},
|
|
1828
|
+
{
|
|
1829
|
+
name: "wizard.agent.step_limit_hit",
|
|
1830
|
+
value: Number(event.hitStepLimit === true),
|
|
1831
|
+
type: COUNT_METRIC,
|
|
1832
|
+
tags: runTags
|
|
1833
|
+
}
|
|
1834
|
+
]
|
|
1821
1835
|
];
|
|
1822
1836
|
}
|
|
1823
1837
|
function trackAgentRun(event) {
|
|
@@ -1845,6 +1859,9 @@ function trackAgentRun(event) {
|
|
|
1845
1859
|
thinking: profile.thinking,
|
|
1846
1860
|
attempt: event.attempt,
|
|
1847
1861
|
durationMs: event.durationMs,
|
|
1862
|
+
stepCount: event.stepCount,
|
|
1863
|
+
hitStepLimit: event.hitStepLimit,
|
|
1864
|
+
finishReason: event.finishReason,
|
|
1848
1865
|
workflow_id: AGENT_TELEMETRY_CONTEXT.workflowId,
|
|
1849
1866
|
app_id: AGENT_TELEMETRY_CONTEXT.appId,
|
|
1850
1867
|
...values
|
|
@@ -2367,7 +2384,7 @@ async function ensureApplication(resumeAppId) {
|
|
|
2367
2384
|
// package.json
|
|
2368
2385
|
var package_default = {
|
|
2369
2386
|
name: "@algolia/wizard",
|
|
2370
|
-
version: "0.
|
|
2387
|
+
version: "0.92.0",
|
|
2371
2388
|
description: "Magically implement Algolia functionality in your codebase",
|
|
2372
2389
|
type: "module",
|
|
2373
2390
|
engines: {
|
|
@@ -5335,6 +5352,7 @@ async function runAgentAttempt(req, attempt, retryReason) {
|
|
|
5335
5352
|
const profileName = req.modelProfile ?? "implementation" /* implementation */;
|
|
5336
5353
|
const profile = getModelProfile(profileName);
|
|
5337
5354
|
const profileOptions = providerOptionsForProfile(profileName);
|
|
5355
|
+
const maxSteps = req.maxSteps ?? profile.maxSteps;
|
|
5338
5356
|
const forceReport = retryReason === "missingReport";
|
|
5339
5357
|
const modelOptions = forceReport ? { thinking: { type: "disabled" } } : profileOptions;
|
|
5340
5358
|
logger.info(
|
|
@@ -5415,11 +5433,11 @@ async function runAgentAttempt(req, attempt, retryReason) {
|
|
|
5415
5433
|
toolChoice: "required",
|
|
5416
5434
|
stopWhen: [
|
|
5417
5435
|
hasToolCall("reportStatus"),
|
|
5418
|
-
stepCountIs(
|
|
5436
|
+
stepCountIs(maxSteps)
|
|
5419
5437
|
],
|
|
5420
5438
|
prepareStep: ({ stepNumber, messages }) => ({
|
|
5421
5439
|
messages: withCachedHistory(messages),
|
|
5422
|
-
...stepNumber >=
|
|
5440
|
+
...stepNumber >= maxSteps - 1 && {
|
|
5423
5441
|
activeTools: ["reportStatus"]
|
|
5424
5442
|
}
|
|
5425
5443
|
}),
|
|
@@ -5459,12 +5477,20 @@ async function runAgentAttempt(req, attempt, retryReason) {
|
|
|
5459
5477
|
}
|
|
5460
5478
|
const end = Date.now();
|
|
5461
5479
|
const usage = await stream.totalUsage;
|
|
5480
|
+
const steps = await stream.steps;
|
|
5481
|
+
const stepCount = steps.length;
|
|
5482
|
+
const hitStepLimit = stepCount >= maxSteps;
|
|
5483
|
+
const lastStep = steps[steps.length - 1];
|
|
5484
|
+
const finishReason = lastStep?.finishReason;
|
|
5462
5485
|
trackAgentRun({
|
|
5463
5486
|
operation: req.operation,
|
|
5464
5487
|
profile: profileName,
|
|
5465
5488
|
attempt: attempt + ATTEMPT_NUMBER_OFFSET,
|
|
5466
5489
|
durationMs: end - start,
|
|
5467
|
-
usage
|
|
5490
|
+
usage,
|
|
5491
|
+
stepCount,
|
|
5492
|
+
hitStepLimit,
|
|
5493
|
+
finishReason
|
|
5468
5494
|
});
|
|
5469
5495
|
logger.info(
|
|
5470
5496
|
{
|
|
@@ -5473,7 +5499,11 @@ async function runAgentAttempt(req, attempt, retryReason) {
|
|
|
5473
5499
|
operation: req.operation,
|
|
5474
5500
|
profile: profileName,
|
|
5475
5501
|
model: profile.model,
|
|
5476
|
-
usage
|
|
5502
|
+
usage,
|
|
5503
|
+
stepCount,
|
|
5504
|
+
maxSteps,
|
|
5505
|
+
hitStepLimit,
|
|
5506
|
+
finishReason
|
|
5477
5507
|
},
|
|
5478
5508
|
"runAgent finished"
|
|
5479
5509
|
);
|
|
@@ -5488,27 +5518,24 @@ async function runAgentAttempt(req, attempt, retryReason) {
|
|
|
5488
5518
|
const toolResults = await stream.toolResults;
|
|
5489
5519
|
const report = [...toolResults].reverse().find((r) => r.toolName === "reportStatus");
|
|
5490
5520
|
if (!report) {
|
|
5491
|
-
const steps = await stream.steps;
|
|
5492
|
-
const lastStep = steps[steps.length - 1];
|
|
5493
5521
|
logger.error(
|
|
5494
5522
|
{
|
|
5495
|
-
finishReason
|
|
5523
|
+
finishReason,
|
|
5496
5524
|
rawFinishReason: lastStep?.rawFinishReason,
|
|
5497
|
-
stepCount
|
|
5525
|
+
stepCount,
|
|
5498
5526
|
lastStepToolCalls: lastStep?.toolCalls?.map((c) => c.toolName)
|
|
5499
5527
|
},
|
|
5500
5528
|
"Agent finished without calling reportStatus"
|
|
5501
5529
|
);
|
|
5502
|
-
const incomplete =
|
|
5530
|
+
const incomplete = hitStepLimit || finishReason !== "stop";
|
|
5503
5531
|
throw new MissingReportError(incomplete);
|
|
5504
5532
|
}
|
|
5505
5533
|
const result = report.output;
|
|
5506
5534
|
if (result.status !== "success") {
|
|
5507
|
-
const steps = await stream.steps;
|
|
5508
5535
|
logger.warn(
|
|
5509
5536
|
{
|
|
5510
5537
|
reason: result.reason,
|
|
5511
|
-
stepCount
|
|
5538
|
+
stepCount,
|
|
5512
5539
|
recentSteps: steps.slice(-RECENT_STEPS_LOGGED).map((s) => ({
|
|
5513
5540
|
text: s.text?.slice(0, LOGGED_CHARS),
|
|
5514
5541
|
toolCalls: s.toolCalls?.map((c) => c.toolName),
|
|
@@ -6285,6 +6312,7 @@ var validationOutputSchema = z29.object({
|
|
|
6285
6312
|
unrelatedFailure: z29.string().optional()
|
|
6286
6313
|
});
|
|
6287
6314
|
var MAX_IMPLEMENT_VALIDATION_ATTEMPTS = 3;
|
|
6315
|
+
var INGESTION_MAX_STEPS = 96;
|
|
6288
6316
|
var FIRST_IMPLEMENTATION_ATTEMPT = 1;
|
|
6289
6317
|
var DEFAULT_IMPLEMENT_USE_CASES = ["ingestion", "search"];
|
|
6290
6318
|
var INGEST_DIR = ".algolia-wizard";
|
|
@@ -6670,10 +6698,15 @@ function ingestOutcome(executions, repoRoot, ingestCommand) {
|
|
|
6670
6698
|
const succeeded = newestFirst.filter(
|
|
6671
6699
|
(e) => e.approved && e.exitCode === 0 && !e.timedOut
|
|
6672
6700
|
);
|
|
6701
|
+
const run2 = succeeded.find(matchesReportedCommand) ?? succeeded.find((e) => withCount.includes(e));
|
|
6702
|
+
const runs = executions.filter(
|
|
6703
|
+
(e) => e.approved && matchesReportedCommand(e)
|
|
6704
|
+
).length;
|
|
6673
6705
|
return {
|
|
6674
|
-
run:
|
|
6706
|
+
run: run2,
|
|
6675
6707
|
attempt: ingestCommand ? newestFirst.find(matchesReportedCommand) : void 0,
|
|
6676
|
-
recordCount: parseIngestRecordCount(withCount[0]?.output ?? "")
|
|
6708
|
+
recordCount: parseIngestRecordCount(withCount[0]?.output ?? ""),
|
|
6709
|
+
attempts: run2 && !matchesReportedCommand(run2) ? runs + 1 : runs
|
|
6677
6710
|
};
|
|
6678
6711
|
}
|
|
6679
6712
|
var INGEST_OUTPUT_TAIL_CHARS = 400;
|
|
@@ -7048,6 +7081,9 @@ async function implement(ctx, useCases = DEFAULT_IMPLEMENT_USE_CASES) {
|
|
|
7048
7081
|
tools: toolsForUseCase(currentUseCase, input.ingestionSource),
|
|
7049
7082
|
outputSchema: implementationOutputSchema,
|
|
7050
7083
|
modelProfile: isRetry ? "implementationRetry" /* implementationRetry */ : "implementation" /* implementation */,
|
|
7084
|
+
...currentUseCase === "ingestion" && {
|
|
7085
|
+
maxSteps: INGESTION_MAX_STEPS
|
|
7086
|
+
},
|
|
7051
7087
|
toolContext
|
|
7052
7088
|
});
|
|
7053
7089
|
} catch (err) {
|
|
@@ -7181,7 +7217,8 @@ async function implement(ctx, useCases = DEFAULT_IMPLEMENT_USE_CASES) {
|
|
|
7181
7217
|
const {
|
|
7182
7218
|
run: ingestRun,
|
|
7183
7219
|
attempt: ingestAttempt,
|
|
7184
|
-
recordCount
|
|
7220
|
+
recordCount,
|
|
7221
|
+
attempts: ingestRunAttempts
|
|
7185
7222
|
} = outcome;
|
|
7186
7223
|
let ingestCwd = ".";
|
|
7187
7224
|
if (ingestAttempt) {
|
|
@@ -7214,7 +7251,8 @@ async function implement(ctx, useCases = DEFAULT_IMPLEMENT_USE_CASES) {
|
|
|
7214
7251
|
record_count: ingestRecordCount,
|
|
7215
7252
|
duration_ms: ingestDurationMs ?? 0,
|
|
7216
7253
|
index_name: targetIndex,
|
|
7217
|
-
record_schema: recordSchema(sample, confirmed2?.[0]?.attributes ?? [])
|
|
7254
|
+
record_schema: recordSchema(sample, confirmed2?.[0]?.attributes ?? []),
|
|
7255
|
+
attempts: ingestRunAttempts
|
|
7218
7256
|
});
|
|
7219
7257
|
} else {
|
|
7220
7258
|
logger.warn(
|
|
@@ -7250,6 +7288,7 @@ ${detail}` : ""}`
|
|
|
7250
7288
|
error_message: `ingestion did not complete: ${reason}`,
|
|
7251
7289
|
error_type: "Ingest Records",
|
|
7252
7290
|
product_area: "AI Wizard",
|
|
7291
|
+
attempts: ingestRunAttempts,
|
|
7253
7292
|
...ingestAttempt?.exitCode != null ? { error_code: String(ingestAttempt.exitCode) } : {}
|
|
7254
7293
|
});
|
|
7255
7294
|
}
|
|
@@ -9794,7 +9833,7 @@ async function resetProjectState() {
|
|
|
9794
9833
|
// package.json with { type: 'json' }
|
|
9795
9834
|
var package_default2 = {
|
|
9796
9835
|
name: "@algolia/wizard",
|
|
9797
|
-
version: "0.
|
|
9836
|
+
version: "0.92.0",
|
|
9798
9837
|
description: "Magically implement Algolia functionality in your codebase",
|
|
9799
9838
|
type: "module",
|
|
9800
9839
|
engines: {
|