@optima-chat/browser-cli 0.9.0 → 0.9.1
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/index.js +13 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -257,7 +257,14 @@ var BrowserAPI = class {
|
|
|
257
257
|
const deadline = Date.now() + timeoutMs;
|
|
258
258
|
for (; ; ) {
|
|
259
259
|
const task = await request(`/api/script-tasks/${started.id}`);
|
|
260
|
-
if (task.status === "completed")
|
|
260
|
+
if (task.status === "completed") {
|
|
261
|
+
if (!task.output) {
|
|
262
|
+
throw new Error(
|
|
263
|
+
`recipe ${name} reported completed but returned no output (task ${started.id})`
|
|
264
|
+
);
|
|
265
|
+
}
|
|
266
|
+
return task.output;
|
|
267
|
+
}
|
|
261
268
|
if (task.status === "failed" || task.status === "needs_fallback") {
|
|
262
269
|
throw new Error(task.error || task.output?.error || `recipe ${task.status}`);
|
|
263
270
|
}
|
|
@@ -1031,6 +1038,11 @@ async function runExport(script, params, out, timeoutMs) {
|
|
|
1031
1038
|
const outPath = resolve2(out);
|
|
1032
1039
|
const result = await api.runRecipeScript(script, { ...params, out_path: outPath }, 2e3, timeoutMs);
|
|
1033
1040
|
if (!result.path) {
|
|
1041
|
+
if (!result.artifact_path) {
|
|
1042
|
+
throw new Error(
|
|
1043
|
+
`Script ${script} finished but delivered no file \u2014 no workspace path and no staged artifact. Nothing was written to ${outPath}.`
|
|
1044
|
+
);
|
|
1045
|
+
}
|
|
1034
1046
|
writeFileSync4(outPath, await api.fetchArtifact(result.artifact_path));
|
|
1035
1047
|
}
|
|
1036
1048
|
console.log(`Saved ${result.filename} -> ${outPath} (${result.size} bytes)`);
|