@algolia/wizard 0.90.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 +117 -48
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -1514,6 +1514,15 @@ function PromptInput() {
|
|
|
1514
1514
|
return /* @__PURE__ */ jsxs10(Box10, { flexDirection: "column", children: [
|
|
1515
1515
|
inputReq.error && /* @__PURE__ */ jsx9(Text11, { color: COLORS.danger, children: inputReq.error }),
|
|
1516
1516
|
inputReq.messages?.map((m, i) => /* @__PURE__ */ jsx9(Text11, { color: COLORS.muted, children: m }, `msg-${i}`)),
|
|
1517
|
+
inputReq.suggestion && /* @__PURE__ */ jsxs10(Text11, { color: COLORS.muted, children: [
|
|
1518
|
+
"Press",
|
|
1519
|
+
" ",
|
|
1520
|
+
/* @__PURE__ */ jsx9(Text11, { color: COLORS.accent, bold: true, children: "Enter" }),
|
|
1521
|
+
" ",
|
|
1522
|
+
"to use",
|
|
1523
|
+
" ",
|
|
1524
|
+
/* @__PURE__ */ jsx9(Text11, { color: COLORS.accent, bold: true, children: inputReq.suggestion })
|
|
1525
|
+
] }),
|
|
1517
1526
|
/* @__PURE__ */ jsxs10(Box10, { children: [
|
|
1518
1527
|
/* @__PURE__ */ jsxs10(Text11, { color: COLORS.primary, children: [
|
|
1519
1528
|
inputReq.prompt,
|
|
@@ -1808,7 +1817,21 @@ function agentRunMetrics(event, values, tags) {
|
|
|
1808
1817
|
value: Number(event.attempt > FIRST_ATTEMPT),
|
|
1809
1818
|
type: COUNT_METRIC,
|
|
1810
1819
|
tags: runTags
|
|
1811
|
-
}
|
|
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
|
+
]
|
|
1812
1835
|
];
|
|
1813
1836
|
}
|
|
1814
1837
|
function trackAgentRun(event) {
|
|
@@ -1836,6 +1859,9 @@ function trackAgentRun(event) {
|
|
|
1836
1859
|
thinking: profile.thinking,
|
|
1837
1860
|
attempt: event.attempt,
|
|
1838
1861
|
durationMs: event.durationMs,
|
|
1862
|
+
stepCount: event.stepCount,
|
|
1863
|
+
hitStepLimit: event.hitStepLimit,
|
|
1864
|
+
finishReason: event.finishReason,
|
|
1839
1865
|
workflow_id: AGENT_TELEMETRY_CONTEXT.workflowId,
|
|
1840
1866
|
app_id: AGENT_TELEMETRY_CONTEXT.appId,
|
|
1841
1867
|
...values
|
|
@@ -2358,7 +2384,7 @@ async function ensureApplication(resumeAppId) {
|
|
|
2358
2384
|
// package.json
|
|
2359
2385
|
var package_default = {
|
|
2360
2386
|
name: "@algolia/wizard",
|
|
2361
|
-
version: "0.
|
|
2387
|
+
version: "0.92.0",
|
|
2362
2388
|
description: "Magically implement Algolia functionality in your codebase",
|
|
2363
2389
|
type: "module",
|
|
2364
2390
|
engines: {
|
|
@@ -2831,6 +2857,9 @@ async function runWorkflow(workflow, startWorkflowAppId, options) {
|
|
|
2831
2857
|
}
|
|
2832
2858
|
}
|
|
2833
2859
|
|
|
2860
|
+
// src/actions/selectIndex.ts
|
|
2861
|
+
import { basename } from "node:path";
|
|
2862
|
+
|
|
2834
2863
|
// src/actions/listIndices.ts
|
|
2835
2864
|
import { z as z5 } from "zod";
|
|
2836
2865
|
var indicesListSchema = z5.object({
|
|
@@ -2865,11 +2894,27 @@ function indexNameError(name) {
|
|
|
2865
2894
|
return "Index name cannot end with .txt, .bin, or .idx.";
|
|
2866
2895
|
return void 0;
|
|
2867
2896
|
}
|
|
2897
|
+
function slug(text) {
|
|
2898
|
+
return text.toLowerCase().replace(/[^a-z0-9]+/g, "_").replace(/^_+|_+$/g, "");
|
|
2899
|
+
}
|
|
2900
|
+
function suggestIndexName(project, entity, taken) {
|
|
2901
|
+
const base = ([slug(project), slug(entity ?? "")].filter(Boolean).join("_") || "records").slice(0, MAX_INDEX_NAME_LENGTH);
|
|
2902
|
+
let name = base;
|
|
2903
|
+
for (let n = 2; taken.includes(name); n++) {
|
|
2904
|
+
const suffix = `_${n}`;
|
|
2905
|
+
name = base.slice(0, MAX_INDEX_NAME_LENGTH - suffix.length) + suffix;
|
|
2906
|
+
}
|
|
2907
|
+
return name;
|
|
2908
|
+
}
|
|
2868
2909
|
var selectIndexStep = async (ctx) => {
|
|
2869
2910
|
await requireApplication(ctx.appId);
|
|
2870
2911
|
const indices = await listIndices();
|
|
2871
2912
|
const names = indices.map((i) => i.name);
|
|
2872
2913
|
const hasIndices = names.length > 0;
|
|
2914
|
+
const entity = ctx.getStepOutput(
|
|
2915
|
+
"confirm-entities"
|
|
2916
|
+
)?.confirmedEntities?.[0]?.name;
|
|
2917
|
+
const suggested = suggestIndexName(basename(process.cwd()), entity, names);
|
|
2873
2918
|
let error;
|
|
2874
2919
|
let chosen;
|
|
2875
2920
|
while (chosen === void 0) {
|
|
@@ -2886,6 +2931,7 @@ var selectIndexStep = async (ctx) => {
|
|
|
2886
2931
|
messages: [
|
|
2887
2932
|
"This app has no existing indices \u2014 enter a name to create one."
|
|
2888
2933
|
],
|
|
2934
|
+
suggestion: suggested,
|
|
2889
2935
|
error
|
|
2890
2936
|
});
|
|
2891
2937
|
if (typeof selection !== "string") {
|
|
@@ -2894,17 +2940,18 @@ var selectIndexStep = async (ctx) => {
|
|
|
2894
2940
|
let candidate;
|
|
2895
2941
|
let isNewName = true;
|
|
2896
2942
|
if (!hasIndices) {
|
|
2897
|
-
candidate = selection.trim();
|
|
2943
|
+
candidate = selection.trim() || suggested;
|
|
2898
2944
|
} else if (selection === CREATE_NEW_INDEX) {
|
|
2899
2945
|
const name = await ctx.requestUserInput({
|
|
2900
2946
|
prompt: "Name the new index:",
|
|
2901
2947
|
promptType: "textInput",
|
|
2902
|
-
options: []
|
|
2948
|
+
options: [],
|
|
2949
|
+
suggestion: suggested
|
|
2903
2950
|
});
|
|
2904
2951
|
if (typeof name !== "string") {
|
|
2905
2952
|
throw new Error("selectIndex received an unexpected non-text result");
|
|
2906
2953
|
}
|
|
2907
|
-
candidate = name.trim();
|
|
2954
|
+
candidate = name.trim() || suggested;
|
|
2908
2955
|
} else {
|
|
2909
2956
|
candidate = selection;
|
|
2910
2957
|
isNewName = false;
|
|
@@ -3140,14 +3187,14 @@ import z9 from "zod";
|
|
|
3140
3187
|
import { readFile as readFile4 } from "node:fs/promises";
|
|
3141
3188
|
|
|
3142
3189
|
// src/lib/tools/env.ts
|
|
3143
|
-
import { basename } from "node:path";
|
|
3190
|
+
import { basename as basename2 } from "node:path";
|
|
3144
3191
|
function isEnvFile(filePath) {
|
|
3145
|
-
const name =
|
|
3192
|
+
const name = basename2(filePath);
|
|
3146
3193
|
return name === ".env" || name.startsWith(".env.");
|
|
3147
3194
|
}
|
|
3148
3195
|
function isSecretEnvFile(filePath) {
|
|
3149
3196
|
if (!isEnvFile(filePath)) return false;
|
|
3150
|
-
const name =
|
|
3197
|
+
const name = basename2(filePath);
|
|
3151
3198
|
return !/\.(example|sample|template)$/.test(name);
|
|
3152
3199
|
}
|
|
3153
3200
|
function secretEnvWriteRefusal(filePath) {
|
|
@@ -3782,7 +3829,7 @@ import { execFile as execFile2 } from "node:child_process";
|
|
|
3782
3829
|
import { tool as tool8 } from "ai";
|
|
3783
3830
|
import z15 from "zod";
|
|
3784
3831
|
import { lstat as lstat3, readdir as readdir2, readFile as readFile8, realpath, stat as stat2 } from "node:fs/promises";
|
|
3785
|
-
import { basename as
|
|
3832
|
+
import { basename as basename3, isAbsolute as isAbsolute2, join as join8, relative as relative4, sep as sep2 } from "node:path";
|
|
3786
3833
|
import { performance } from "node:perf_hooks";
|
|
3787
3834
|
import { Worker } from "node:worker_threads";
|
|
3788
3835
|
var MAX_GIT_OUTPUT_BYTES = 32e6;
|
|
@@ -4125,7 +4172,7 @@ async function safeSearchPath(rootPath, file) {
|
|
|
4125
4172
|
}
|
|
4126
4173
|
async function searchableFiles(root, target) {
|
|
4127
4174
|
try {
|
|
4128
|
-
if (SKIP_FILES.has(
|
|
4175
|
+
if (SKIP_FILES.has(basename3(target)) && (await lstat3(target)).isFile()) {
|
|
4129
4176
|
return [target];
|
|
4130
4177
|
}
|
|
4131
4178
|
const gitRoot = await gitRootForTarget(root, target);
|
|
@@ -4304,7 +4351,7 @@ import { tool as tool9 } from "ai";
|
|
|
4304
4351
|
import z16 from "zod";
|
|
4305
4352
|
import { createHash as createHash2 } from "node:crypto";
|
|
4306
4353
|
import { readFile as readFile9, stat as stat3 } from "node:fs/promises";
|
|
4307
|
-
import { basename as
|
|
4354
|
+
import { basename as basename4, relative as relative5, resolve as resolve3 } from "node:path";
|
|
4308
4355
|
|
|
4309
4356
|
// src/lib/tools/utils/prompt.ts
|
|
4310
4357
|
var chain = Promise.resolve();
|
|
@@ -4402,7 +4449,7 @@ function commandDiffersFromReviewedScript(ctx, command, cwd) {
|
|
|
4402
4449
|
if (approval.command === command && approval.cwd === cwd) return false;
|
|
4403
4450
|
if (approval.command === command) return true;
|
|
4404
4451
|
const scriptReferences = [
|
|
4405
|
-
|
|
4452
|
+
basename4(approval.filePath),
|
|
4406
4453
|
relative5(ctx.root, approval.filePath),
|
|
4407
4454
|
".algolia-wizard"
|
|
4408
4455
|
];
|
|
@@ -5123,8 +5170,8 @@ function generateRecordTool(ctx, createModel = defaultCreateModel2) {
|
|
|
5123
5170
|
...record,
|
|
5124
5171
|
objectID: nanoid2()
|
|
5125
5172
|
}));
|
|
5126
|
-
const
|
|
5127
|
-
const relPath = `${DATA_DIR}/${
|
|
5173
|
+
const slug2 = entityName.toLowerCase().replace(/[^a-z0-9]+/g, "-");
|
|
5174
|
+
const relPath = `${DATA_DIR}/${slug2}.json`;
|
|
5128
5175
|
const resolved2 = resolveInRoot(ctx, relPath);
|
|
5129
5176
|
if (resolved2.ok === false) return resolved2.error;
|
|
5130
5177
|
const writeError = await safeWriteFile(
|
|
@@ -5305,6 +5352,7 @@ async function runAgentAttempt(req, attempt, retryReason) {
|
|
|
5305
5352
|
const profileName = req.modelProfile ?? "implementation" /* implementation */;
|
|
5306
5353
|
const profile = getModelProfile(profileName);
|
|
5307
5354
|
const profileOptions = providerOptionsForProfile(profileName);
|
|
5355
|
+
const maxSteps = req.maxSteps ?? profile.maxSteps;
|
|
5308
5356
|
const forceReport = retryReason === "missingReport";
|
|
5309
5357
|
const modelOptions = forceReport ? { thinking: { type: "disabled" } } : profileOptions;
|
|
5310
5358
|
logger.info(
|
|
@@ -5385,11 +5433,11 @@ async function runAgentAttempt(req, attempt, retryReason) {
|
|
|
5385
5433
|
toolChoice: "required",
|
|
5386
5434
|
stopWhen: [
|
|
5387
5435
|
hasToolCall("reportStatus"),
|
|
5388
|
-
stepCountIs(
|
|
5436
|
+
stepCountIs(maxSteps)
|
|
5389
5437
|
],
|
|
5390
5438
|
prepareStep: ({ stepNumber, messages }) => ({
|
|
5391
5439
|
messages: withCachedHistory(messages),
|
|
5392
|
-
...stepNumber >=
|
|
5440
|
+
...stepNumber >= maxSteps - 1 && {
|
|
5393
5441
|
activeTools: ["reportStatus"]
|
|
5394
5442
|
}
|
|
5395
5443
|
}),
|
|
@@ -5429,12 +5477,20 @@ async function runAgentAttempt(req, attempt, retryReason) {
|
|
|
5429
5477
|
}
|
|
5430
5478
|
const end = Date.now();
|
|
5431
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;
|
|
5432
5485
|
trackAgentRun({
|
|
5433
5486
|
operation: req.operation,
|
|
5434
5487
|
profile: profileName,
|
|
5435
5488
|
attempt: attempt + ATTEMPT_NUMBER_OFFSET,
|
|
5436
5489
|
durationMs: end - start,
|
|
5437
|
-
usage
|
|
5490
|
+
usage,
|
|
5491
|
+
stepCount,
|
|
5492
|
+
hitStepLimit,
|
|
5493
|
+
finishReason
|
|
5438
5494
|
});
|
|
5439
5495
|
logger.info(
|
|
5440
5496
|
{
|
|
@@ -5443,7 +5499,11 @@ async function runAgentAttempt(req, attempt, retryReason) {
|
|
|
5443
5499
|
operation: req.operation,
|
|
5444
5500
|
profile: profileName,
|
|
5445
5501
|
model: profile.model,
|
|
5446
|
-
usage
|
|
5502
|
+
usage,
|
|
5503
|
+
stepCount,
|
|
5504
|
+
maxSteps,
|
|
5505
|
+
hitStepLimit,
|
|
5506
|
+
finishReason
|
|
5447
5507
|
},
|
|
5448
5508
|
"runAgent finished"
|
|
5449
5509
|
);
|
|
@@ -5458,27 +5518,24 @@ async function runAgentAttempt(req, attempt, retryReason) {
|
|
|
5458
5518
|
const toolResults = await stream.toolResults;
|
|
5459
5519
|
const report = [...toolResults].reverse().find((r) => r.toolName === "reportStatus");
|
|
5460
5520
|
if (!report) {
|
|
5461
|
-
const steps = await stream.steps;
|
|
5462
|
-
const lastStep = steps[steps.length - 1];
|
|
5463
5521
|
logger.error(
|
|
5464
5522
|
{
|
|
5465
|
-
finishReason
|
|
5523
|
+
finishReason,
|
|
5466
5524
|
rawFinishReason: lastStep?.rawFinishReason,
|
|
5467
|
-
stepCount
|
|
5525
|
+
stepCount,
|
|
5468
5526
|
lastStepToolCalls: lastStep?.toolCalls?.map((c) => c.toolName)
|
|
5469
5527
|
},
|
|
5470
5528
|
"Agent finished without calling reportStatus"
|
|
5471
5529
|
);
|
|
5472
|
-
const incomplete =
|
|
5530
|
+
const incomplete = hitStepLimit || finishReason !== "stop";
|
|
5473
5531
|
throw new MissingReportError(incomplete);
|
|
5474
5532
|
}
|
|
5475
5533
|
const result = report.output;
|
|
5476
5534
|
if (result.status !== "success") {
|
|
5477
|
-
const steps = await stream.steps;
|
|
5478
5535
|
logger.warn(
|
|
5479
5536
|
{
|
|
5480
5537
|
reason: result.reason,
|
|
5481
|
-
stepCount
|
|
5538
|
+
stepCount,
|
|
5482
5539
|
recentSteps: steps.slice(-RECENT_STEPS_LOGGED).map((s) => ({
|
|
5483
5540
|
text: s.text?.slice(0, LOGGED_CHARS),
|
|
5484
5541
|
toolCalls: s.toolCalls?.map((c) => c.toolName),
|
|
@@ -6077,7 +6134,7 @@ import {
|
|
|
6077
6134
|
// src/lib/git.ts
|
|
6078
6135
|
import { execFile as execFile3 } from "node:child_process";
|
|
6079
6136
|
import { copyFile, mkdir as mkdir4, stat as stat4 } from "node:fs/promises";
|
|
6080
|
-
import { basename as
|
|
6137
|
+
import { basename as basename5, dirname as dirname3, isAbsolute as isAbsolute3, join as join9, resolve as resolve4 } from "node:path";
|
|
6081
6138
|
var MAX_BUFFER = 32 * 1024 * 1024;
|
|
6082
6139
|
function git(args) {
|
|
6083
6140
|
return new Promise((resolve6, reject) => {
|
|
@@ -6114,7 +6171,7 @@ async function copyUploadIntoProject(repoRoot, ingestDir, sourcePath) {
|
|
|
6114
6171
|
} catch {
|
|
6115
6172
|
return { ok: false, reason: `"${sourcePath}" does not exist` };
|
|
6116
6173
|
}
|
|
6117
|
-
const relPath = join9(ingestDir,
|
|
6174
|
+
const relPath = join9(ingestDir, basename5(source));
|
|
6118
6175
|
const dest = join9(repoRoot, relPath);
|
|
6119
6176
|
if (resolve4(source) === resolve4(dest)) {
|
|
6120
6177
|
return { ok: true, relPath };
|
|
@@ -6255,6 +6312,7 @@ var validationOutputSchema = z29.object({
|
|
|
6255
6312
|
unrelatedFailure: z29.string().optional()
|
|
6256
6313
|
});
|
|
6257
6314
|
var MAX_IMPLEMENT_VALIDATION_ATTEMPTS = 3;
|
|
6315
|
+
var INGESTION_MAX_STEPS = 96;
|
|
6258
6316
|
var FIRST_IMPLEMENTATION_ATTEMPT = 1;
|
|
6259
6317
|
var DEFAULT_IMPLEMENT_USE_CASES = ["ingestion", "search"];
|
|
6260
6318
|
var INGEST_DIR = ".algolia-wizard";
|
|
@@ -6640,10 +6698,15 @@ function ingestOutcome(executions, repoRoot, ingestCommand) {
|
|
|
6640
6698
|
const succeeded = newestFirst.filter(
|
|
6641
6699
|
(e) => e.approved && e.exitCode === 0 && !e.timedOut
|
|
6642
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;
|
|
6643
6705
|
return {
|
|
6644
|
-
run:
|
|
6706
|
+
run: run2,
|
|
6645
6707
|
attempt: ingestCommand ? newestFirst.find(matchesReportedCommand) : void 0,
|
|
6646
|
-
recordCount: parseIngestRecordCount(withCount[0]?.output ?? "")
|
|
6708
|
+
recordCount: parseIngestRecordCount(withCount[0]?.output ?? ""),
|
|
6709
|
+
attempts: run2 && !matchesReportedCommand(run2) ? runs + 1 : runs
|
|
6647
6710
|
};
|
|
6648
6711
|
}
|
|
6649
6712
|
var INGEST_OUTPUT_TAIL_CHARS = 400;
|
|
@@ -6685,8 +6748,8 @@ async function firstRecordIn(filePath) {
|
|
|
6685
6748
|
async function ingestedRecordSample(repoRoot, entityName, uploadFilePath) {
|
|
6686
6749
|
const candidates = [];
|
|
6687
6750
|
if (entityName) {
|
|
6688
|
-
const
|
|
6689
|
-
candidates.push(join11(repoRoot, INGEST_DIR, "data", `${
|
|
6751
|
+
const slug2 = entityName.toLowerCase().replace(/[^a-z0-9]+/g, "-");
|
|
6752
|
+
candidates.push(join11(repoRoot, INGEST_DIR, "data", `${slug2}.json`));
|
|
6690
6753
|
}
|
|
6691
6754
|
if (uploadFilePath?.toLowerCase().endsWith(".json")) {
|
|
6692
6755
|
candidates.push(join11(repoRoot, uploadFilePath));
|
|
@@ -7018,6 +7081,9 @@ async function implement(ctx, useCases = DEFAULT_IMPLEMENT_USE_CASES) {
|
|
|
7018
7081
|
tools: toolsForUseCase(currentUseCase, input.ingestionSource),
|
|
7019
7082
|
outputSchema: implementationOutputSchema,
|
|
7020
7083
|
modelProfile: isRetry ? "implementationRetry" /* implementationRetry */ : "implementation" /* implementation */,
|
|
7084
|
+
...currentUseCase === "ingestion" && {
|
|
7085
|
+
maxSteps: INGESTION_MAX_STEPS
|
|
7086
|
+
},
|
|
7021
7087
|
toolContext
|
|
7022
7088
|
});
|
|
7023
7089
|
} catch (err) {
|
|
@@ -7151,7 +7217,8 @@ async function implement(ctx, useCases = DEFAULT_IMPLEMENT_USE_CASES) {
|
|
|
7151
7217
|
const {
|
|
7152
7218
|
run: ingestRun,
|
|
7153
7219
|
attempt: ingestAttempt,
|
|
7154
|
-
recordCount
|
|
7220
|
+
recordCount,
|
|
7221
|
+
attempts: ingestRunAttempts
|
|
7155
7222
|
} = outcome;
|
|
7156
7223
|
let ingestCwd = ".";
|
|
7157
7224
|
if (ingestAttempt) {
|
|
@@ -7184,7 +7251,8 @@ async function implement(ctx, useCases = DEFAULT_IMPLEMENT_USE_CASES) {
|
|
|
7184
7251
|
record_count: ingestRecordCount,
|
|
7185
7252
|
duration_ms: ingestDurationMs ?? 0,
|
|
7186
7253
|
index_name: targetIndex,
|
|
7187
|
-
record_schema: recordSchema(sample, confirmed2?.[0]?.attributes ?? [])
|
|
7254
|
+
record_schema: recordSchema(sample, confirmed2?.[0]?.attributes ?? []),
|
|
7255
|
+
attempts: ingestRunAttempts
|
|
7188
7256
|
});
|
|
7189
7257
|
} else {
|
|
7190
7258
|
logger.warn(
|
|
@@ -7220,6 +7288,7 @@ ${detail}` : ""}`
|
|
|
7220
7288
|
error_message: `ingestion did not complete: ${reason}`,
|
|
7221
7289
|
error_type: "Ingest Records",
|
|
7222
7290
|
product_area: "AI Wizard",
|
|
7291
|
+
attempts: ingestRunAttempts,
|
|
7223
7292
|
...ingestAttempt?.exitCode != null ? { error_code: String(ingestAttempt.exitCode) } : {}
|
|
7224
7293
|
});
|
|
7225
7294
|
}
|
|
@@ -7623,9 +7692,9 @@ async function getPlaybooks() {
|
|
|
7623
7692
|
);
|
|
7624
7693
|
return data;
|
|
7625
7694
|
}
|
|
7626
|
-
async function createPlaybookExecution(appId,
|
|
7695
|
+
async function createPlaybookExecution(appId, slug2, indexName, options) {
|
|
7627
7696
|
const { data } = await dashboardRequest(
|
|
7628
|
-
`/api/1/playbook-integrations/applications/${appId}/playbooks/${
|
|
7697
|
+
`/api/1/playbook-integrations/applications/${appId}/playbooks/${slug2}/executions`,
|
|
7629
7698
|
playbookExecutionCreateResponseSchema,
|
|
7630
7699
|
{
|
|
7631
7700
|
method: "POST",
|
|
@@ -7666,9 +7735,9 @@ async function assessPlaybookExecution(uuid) {
|
|
|
7666
7735
|
var selectPlaybookSchema = z33.object({
|
|
7667
7736
|
slug: z33.string()
|
|
7668
7737
|
});
|
|
7669
|
-
function persistSlug(ctx,
|
|
7670
|
-
ctx.setUserInput("playbookSlug",
|
|
7671
|
-
return { slug };
|
|
7738
|
+
function persistSlug(ctx, slug2) {
|
|
7739
|
+
ctx.setUserInput("playbookSlug", slug2);
|
|
7740
|
+
return { slug: slug2 };
|
|
7672
7741
|
}
|
|
7673
7742
|
async function selectPlaybookStep(ctx, requestedSlug) {
|
|
7674
7743
|
const playbooks = await getPlaybooks();
|
|
@@ -7799,13 +7868,13 @@ async function confirmIndexStep(ctx) {
|
|
|
7799
7868
|
if (!sampleIndex) {
|
|
7800
7869
|
return null;
|
|
7801
7870
|
}
|
|
7802
|
-
const { slug } = ctx.getStepOutput("select-playbook");
|
|
7871
|
+
const { slug: slug2 } = ctx.getStepOutput("select-playbook");
|
|
7803
7872
|
const selection = await ctx.requestUserInput({
|
|
7804
7873
|
prompt: "Ready to create sample index?",
|
|
7805
7874
|
promptType: "multipleChoice",
|
|
7806
7875
|
options: [CONTINUE_OPTION, GO_BACK_OPTION2],
|
|
7807
7876
|
messages: [
|
|
7808
|
-
`A new index called "algolia_playbooks_${
|
|
7877
|
+
`A new index called "algolia_playbooks_${slug2}_sample_index" will be created with sample ${slug2} data.`
|
|
7809
7878
|
],
|
|
7810
7879
|
helpText: "Going back lets you choose a different index."
|
|
7811
7880
|
});
|
|
@@ -7957,13 +8026,13 @@ var POLL_NOTICES = [
|
|
|
7957
8026
|
{ message: "detecting required fields\u2026" }
|
|
7958
8027
|
];
|
|
7959
8028
|
async function dataAssessmentStep(ctx) {
|
|
7960
|
-
const { slug } = ctx.getStepOutput("select-playbook");
|
|
8029
|
+
const { slug: slug2 } = ctx.getStepOutput("select-playbook");
|
|
7961
8030
|
const { indexName, existingExecution } = indexForAssessment(ctx);
|
|
7962
8031
|
if (existingExecution) return existingExecution;
|
|
7963
8032
|
try {
|
|
7964
8033
|
showNotice(ctx, CREATING_EXECUTION_NOTICE);
|
|
7965
8034
|
const { id: appId } = await requireApplication();
|
|
7966
|
-
const execution = await resolveExecution(ctx, appId,
|
|
8035
|
+
const execution = await resolveExecution(ctx, appId, slug2, indexName);
|
|
7967
8036
|
const assessed = await runAssessment(ctx, execution, indexName);
|
|
7968
8037
|
ctx.clearNotices();
|
|
7969
8038
|
await promptReady(ctx, assessed);
|
|
@@ -8068,24 +8137,24 @@ function unexpectedAssessmentStatus(status) {
|
|
|
8068
8137
|
`data-assessment received an unexpected assessment status: ${status}`
|
|
8069
8138
|
);
|
|
8070
8139
|
}
|
|
8071
|
-
async function resolveExecution(ctx, appId,
|
|
8072
|
-
const created = await createWithRecovery(ctx, appId,
|
|
8140
|
+
async function resolveExecution(ctx, appId, slug2, indexName) {
|
|
8141
|
+
const created = await createWithRecovery(ctx, appId, slug2, indexName);
|
|
8073
8142
|
if (!created.resumed) return created;
|
|
8074
8143
|
const choice = await promptResumeExecution(ctx, indexName);
|
|
8075
8144
|
if (choice === CONTINUE_EXECUTION_OPTION) return created;
|
|
8076
8145
|
if (choice === RESTART_OPTION) {
|
|
8077
|
-
return createWithRecovery(ctx, appId,
|
|
8146
|
+
return createWithRecovery(ctx, appId, slug2, indexName, { forceNew: true });
|
|
8078
8147
|
}
|
|
8079
8148
|
if (choice === GO_BACK_OPTION3) {
|
|
8080
8149
|
return ctx.returnToStep("select-index");
|
|
8081
8150
|
}
|
|
8082
8151
|
throw new Error("data-assessment received an unexpected execution choice");
|
|
8083
8152
|
}
|
|
8084
|
-
async function createWithRecovery(ctx, appId,
|
|
8153
|
+
async function createWithRecovery(ctx, appId, slug2, indexName, options) {
|
|
8085
8154
|
return retryOnDashboardError(
|
|
8086
8155
|
() => {
|
|
8087
8156
|
showNotice(ctx, CREATING_EXECUTION_NOTICE);
|
|
8088
|
-
return createPlaybookExecution(appId,
|
|
8157
|
+
return createPlaybookExecution(appId, slug2, indexName, options);
|
|
8089
8158
|
},
|
|
8090
8159
|
onRequestFailure(ctx, indexName)
|
|
8091
8160
|
);
|
|
@@ -9764,7 +9833,7 @@ async function resetProjectState() {
|
|
|
9764
9833
|
// package.json with { type: 'json' }
|
|
9765
9834
|
var package_default2 = {
|
|
9766
9835
|
name: "@algolia/wizard",
|
|
9767
|
-
version: "0.
|
|
9836
|
+
version: "0.92.0",
|
|
9768
9837
|
description: "Magically implement Algolia functionality in your codebase",
|
|
9769
9838
|
type: "module",
|
|
9770
9839
|
engines: {
|