@mindstudio-ai/agent 0.0.1 → 0.0.3

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 CHANGED
@@ -450,11 +450,27 @@ var MindStudioAgent = class {
450
450
  ...options?.appId != null && { appId: options.appId },
451
451
  ...options?.threadId != null && { threadId: options.threadId }
452
452
  });
453
+ let output;
454
+ if (data.output != null) {
455
+ output = data.output;
456
+ } else if (data.outputUrl) {
457
+ const res = await fetch(data.outputUrl);
458
+ if (!res.ok) {
459
+ throw new MindStudioError(
460
+ `Failed to fetch output from S3: ${res.status} ${res.statusText}`,
461
+ "output_fetch_error",
462
+ res.status
463
+ );
464
+ }
465
+ const envelope = await res.json();
466
+ output = envelope.value;
467
+ } else {
468
+ output = void 0;
469
+ }
453
470
  return {
454
- output: data.output,
455
- outputUrl: data.outputUrl,
456
- appId: headers.get("x-mindstudio-app-id") ?? "",
457
- threadId: headers.get("x-mindstudio-thread-id") ?? ""
471
+ ...output,
472
+ $appId: headers.get("x-mindstudio-app-id") ?? "",
473
+ $threadId: headers.get("x-mindstudio-thread-id") ?? ""
458
474
  };
459
475
  }
460
476
  /** @internal Used by generated helper methods. */
@@ -474,10 +490,11 @@ function resolveToken(provided) {
474
490
  401
475
491
  );
476
492
  }
493
+
494
+ // src/index.ts
495
+ var MindStudioAgent2 = MindStudioAgent;
477
496
  export {
478
- MindStudioAgent,
479
- MindStudioError,
480
- applyHelperMethods,
481
- applyStepMethods
497
+ MindStudioAgent2 as MindStudioAgent,
498
+ MindStudioError
482
499
  };
483
500
  //# sourceMappingURL=index.js.map