@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.js CHANGED
@@ -771,6 +771,23 @@ async function validateWorld(dir, opts) {
771
771
  versionId: pushed.versionId,
772
772
  ...provenance
773
773
  });
774
+ const host = (options.host ?? process.env.GATEWAY_HOST ?? "https://withgateway.ai").replace(/\/+$/, "");
775
+ let projectId = null;
776
+ try {
777
+ const projects = await apiRequest(
778
+ options,
779
+ "GET",
780
+ "/api/public/projects"
781
+ );
782
+ projectId = projects.data?.[0]?.id ?? null;
783
+ } catch {
784
+ projectId = null;
785
+ }
786
+ const fallbackUrl = (report) => {
787
+ if (report.url) return report.url;
788
+ const evaluationId = report.evaluations[0]?.id;
789
+ return projectId && evaluationId ? `${host}/project/${projectId}/environment/runs/${encodeURIComponent(evaluationId)}` : null;
790
+ };
774
791
  const runs = [];
775
792
  for (const run of dispatched.runs) {
776
793
  if (!run.ok) {
@@ -793,6 +810,7 @@ async function validateWorld(dir, opts) {
793
810
  `\u2026${run.model}: ${r.status.toLowerCase()} (${r.shardsCompleted ?? 0}/${r.parallelism} shards)`
794
811
  )
795
812
  });
813
+ report = { ...report, url: fallbackUrl(report) };
796
814
  if (report.status.toUpperCase() !== "COMPLETED") {
797
815
  failure = report.status;
798
816
  } else if (minScore !== null) {
@@ -1090,7 +1108,7 @@ var require_package = __commonJS({
1090
1108
  "package.json"(exports2, module2) {
1091
1109
  module2.exports = {
1092
1110
  name: "@withgateway/sdk",
1093
- version: "0.1.16",
1111
+ version: "0.1.17",
1094
1112
  description: "Gateway SDK for TypeScript - A/B experiments, tracing, and observability",
1095
1113
  main: "./dist/index.js",
1096
1114
  module: "./dist/index.mjs",