@algolia/wizard 0.94.0 → 0.95.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 +36 -8
- 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.
|
|
2387
|
+
version: "0.95.0",
|
|
2388
2388
|
description: "Magically implement Algolia functionality in your codebase",
|
|
2389
2389
|
type: "module",
|
|
2390
2390
|
engines: {
|
|
@@ -5315,9 +5315,11 @@ function incompleteCauseOf(stepCount, maxSteps, finishReason) {
|
|
|
5315
5315
|
}
|
|
5316
5316
|
var AgentReportedFailureError = class extends Error {
|
|
5317
5317
|
reason;
|
|
5318
|
-
|
|
5318
|
+
output;
|
|
5319
|
+
constructor(reason, output) {
|
|
5319
5320
|
super(`Agent reported failure: ${reason ?? "no reason given"}`);
|
|
5320
5321
|
this.reason = reason;
|
|
5322
|
+
this.output = output;
|
|
5321
5323
|
}
|
|
5322
5324
|
};
|
|
5323
5325
|
function withCachedHistory(messages) {
|
|
@@ -5573,7 +5575,7 @@ async function runAgentAttempt(req, attempt, retryReason) {
|
|
|
5573
5575
|
},
|
|
5574
5576
|
"agent reported failure"
|
|
5575
5577
|
);
|
|
5576
|
-
throw new AgentReportedFailureError(result.reason);
|
|
5578
|
+
throw new AgentReportedFailureError(result.reason, result.output);
|
|
5577
5579
|
}
|
|
5578
5580
|
return result.output;
|
|
5579
5581
|
}
|
|
@@ -6120,8 +6122,22 @@ Output:
|
|
|
6120
6122
|
${JSON.stringify(s.output, null, 2)}`
|
|
6121
6123
|
).join("\n\n");
|
|
6122
6124
|
}
|
|
6125
|
+
async function runReviewAgent(request) {
|
|
6126
|
+
try {
|
|
6127
|
+
return await runAgent(request);
|
|
6128
|
+
} catch (err) {
|
|
6129
|
+
if (!(err instanceof AgentReportedFailureError)) throw err;
|
|
6130
|
+
const parsed = reviewSchema.safeParse(err.output);
|
|
6131
|
+
if (!parsed.success) throw err;
|
|
6132
|
+
logger.warn(
|
|
6133
|
+
{ reason: err.reason },
|
|
6134
|
+
"review agent reported fail, using its summary"
|
|
6135
|
+
);
|
|
6136
|
+
return parsed.data;
|
|
6137
|
+
}
|
|
6138
|
+
}
|
|
6123
6139
|
var reviewStep = async (ctx, options) => {
|
|
6124
|
-
const result = await
|
|
6140
|
+
const result = await runReviewAgent({
|
|
6125
6141
|
operation: "workflow-review",
|
|
6126
6142
|
instructions: [
|
|
6127
6143
|
"Summarize what was accomplished in the workflow, leaving out verbose details.",
|
|
@@ -6133,6 +6149,7 @@ var reviewStep = async (ctx, options) => {
|
|
|
6133
6149
|
options.nextStepsGuidance,
|
|
6134
6150
|
`Completed steps:
|
|
6135
6151
|
${formatCompletedSteps(ctx.completedSteps)}`,
|
|
6152
|
+
"The reportStatus status is for your summary task, not for the workflow. When a prior step failed, report status=success and describe the failure in summaryPoints.",
|
|
6136
6153
|
"When done, call reportStatus"
|
|
6137
6154
|
],
|
|
6138
6155
|
tools: [],
|
|
@@ -7594,14 +7611,25 @@ var defaultWorkflow = {
|
|
|
7594
7611
|
"ingestion"
|
|
7595
7612
|
);
|
|
7596
7613
|
return reviewStep(ctx, {
|
|
7597
|
-
|
|
7598
|
-
// LLM-paraphrased restatement in nextSteps risks being wrong.
|
|
7599
|
-
nextStepsGuidance: ingestion2?.ingestScriptRan ? "The wizard already ran the ingestion script and records are in the index. Do NOT tell the user to run it again; instead point them at the target index to confirm the records. Do not restate the ingestion command \u2014 the wizard already showed it to them." : "Tell the user to run the ingestion script; do not restate the exact command \u2014 the wizard already showed it to them above."
|
|
7614
|
+
nextStepsGuidance: ingestionGuidance(ingestion2)
|
|
7600
7615
|
});
|
|
7601
7616
|
}
|
|
7602
7617
|
})
|
|
7603
7618
|
]
|
|
7604
7619
|
};
|
|
7620
|
+
function ingestionGuidance(ingestion2) {
|
|
7621
|
+
if (ingestion2?.ingestScriptRan) {
|
|
7622
|
+
return "The wizard already ran the ingestion script and records are in the index. Do NOT tell the user to run it again; instead point them at the target index to confirm the records. Do not restate the ingestion command \u2014 the wizard already showed it to them.";
|
|
7623
|
+
}
|
|
7624
|
+
const partialCount = ingestion2?.ingestRecordCount ?? 0;
|
|
7625
|
+
if (partialCount > 0) {
|
|
7626
|
+
return `The ingestion script indexed ${partialCount} record(s) and then failed before it finished. Say that plainly. Do not say that ingestion succeeded or that no records were indexed. Tell the user to fix the error shown above and run the ingestion script again. Do not restate the exact command, because the wizard already showed it to them above.`;
|
|
7627
|
+
}
|
|
7628
|
+
if (ingestion2?.ingestCommand) {
|
|
7629
|
+
return "No records were indexed in this run. Say that plainly, and do not say that the wizard created or populated an index. Tell the user to run the ingestion script; do not restate the exact command \u2014 the wizard already showed it to them above.";
|
|
7630
|
+
}
|
|
7631
|
+
return "No ingestion script ran and no records were indexed in this run. Say that plainly. Do not say that the wizard created, selected, or populated an index, and do not tell the user to run an ingestion script, because the wizard has no tested command for one. Tell the user to run the wizard again to create and run the ingestion script.";
|
|
7632
|
+
}
|
|
7605
7633
|
|
|
7606
7634
|
// src/actions/playbookSteps/selectPlaybook.ts
|
|
7607
7635
|
import { z as z33 } from "zod";
|
|
@@ -9875,7 +9903,7 @@ async function resetProjectState() {
|
|
|
9875
9903
|
// package.json with { type: 'json' }
|
|
9876
9904
|
var package_default2 = {
|
|
9877
9905
|
name: "@algolia/wizard",
|
|
9878
|
-
version: "0.
|
|
9906
|
+
version: "0.95.0",
|
|
9879
9907
|
description: "Magically implement Algolia functionality in your codebase",
|
|
9880
9908
|
type: "module",
|
|
9881
9909
|
engines: {
|