@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.
Files changed (2) hide show
  1. package/dist/index.js +13 -1
  2. 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") return task.output;
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)`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@optima-chat/browser-cli",
3
- "version": "0.9.0",
3
+ "version": "0.9.1",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "bin": {