@withgateway/sdk 0.1.16 → 0.1.17

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.mjs CHANGED
@@ -757,6 +757,23 @@ async function validateWorld(dir, opts) {
757
757
  versionId: pushed.versionId,
758
758
  ...provenance
759
759
  });
760
+ const host = (options.host ?? process.env.GATEWAY_HOST ?? "https://withgateway.ai").replace(/\/+$/, "");
761
+ let projectId = null;
762
+ try {
763
+ const projects = await apiRequest(
764
+ options,
765
+ "GET",
766
+ "/api/public/projects"
767
+ );
768
+ projectId = projects.data?.[0]?.id ?? null;
769
+ } catch {
770
+ projectId = null;
771
+ }
772
+ const fallbackUrl = (report) => {
773
+ if (report.url) return report.url;
774
+ const evaluationId = report.evaluations[0]?.id;
775
+ return projectId && evaluationId ? `${host}/project/${projectId}/environment/runs/${encodeURIComponent(evaluationId)}` : null;
776
+ };
760
777
  const runs = [];
761
778
  for (const run of dispatched.runs) {
762
779
  if (!run.ok) {
@@ -779,6 +796,7 @@ async function validateWorld(dir, opts) {
779
796
  `\u2026${run.model}: ${r.status.toLowerCase()} (${r.shardsCompleted ?? 0}/${r.parallelism} shards)`
780
797
  )
781
798
  });
799
+ report = { ...report, url: fallbackUrl(report) };
782
800
  if (report.status.toUpperCase() !== "COMPLETED") {
783
801
  failure = report.status;
784
802
  } else if (minScore !== null) {
@@ -1076,7 +1094,7 @@ var require_package = __commonJS({
1076
1094
  "package.json"(exports, module) {
1077
1095
  module.exports = {
1078
1096
  name: "@withgateway/sdk",
1079
- version: "0.1.16",
1097
+ version: "0.1.17",
1080
1098
  description: "Gateway SDK for TypeScript - A/B experiments, tracing, and observability",
1081
1099
  main: "./dist/index.js",
1082
1100
  module: "./dist/index.mjs",