@withgateway/sdk 0.1.19 → 0.1.20

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
@@ -697,14 +697,15 @@ var init_hub = __esm({
697
697
  function fmtScore(score) {
698
698
  return score === null ? "no score" : score.toFixed(3);
699
699
  }
700
- function buildMarkdown(report, minScore) {
700
+ function buildMarkdown(report, minScore, source) {
701
701
  const lines = [];
702
702
  lines.push(
703
703
  `### World validation ${report.ok ? "passed" : "failed"} \u2014 \`${report.slug}@${report.branch}\``
704
704
  );
705
705
  lines.push("");
706
+ const commitLink = source?.repoUrl && source?.commit ? `[\`${source.commit.slice(0, 12)}\`](${source.repoUrl}/commit/${source.commit})` : null;
706
707
  lines.push(
707
- `Ran the pull request's own world source (version \`${report.contentHash.slice(0, 12)}\`) through run config **${report.runConfig.name}**` + (minScore !== null ? `, gating at score \u2265 ${minScore}.` : ".")
708
+ `Ran the pull request's own world source` + (commitLink ? ` (${commitLink} on \`${report.branch}\`` : ` (`) + `${commitLink ? ", " : ""}pinned as \`${report.contentHash.slice(0, 12)}\`) through run config **${report.runConfig.name}**` + (minScore !== null ? `, gating at score \u2265 ${minScore}.` : ".")
708
709
  );
709
710
  lines.push("");
710
711
  lines.push("| Model | Status | Score | Run |");
@@ -724,19 +725,29 @@ function buildMarkdown(report, minScore) {
724
725
  reward: sample.reward
725
726
  }))
726
727
  );
727
- if (taskRows.length > 0 && taskRows.length <= 40) {
728
+ if (taskRows.length > 0) {
729
+ const fold = taskRows.length > 12;
728
730
  lines.push("");
729
- lines.push("<details><summary>Per-task rewards</summary>");
730
- lines.push("");
731
- lines.push("| Task | Model | Reward |");
731
+ if (fold) {
732
+ lines.push(
733
+ `<details><summary>Per-scenario rewards (${taskRows.length})</summary>`
734
+ );
735
+ lines.push("");
736
+ } else {
737
+ lines.push(`**Scenarios (${taskRows.length})**`);
738
+ lines.push("");
739
+ }
740
+ lines.push("| Scenario | Model | Reward |");
732
741
  lines.push("| --- | --- | ---: |");
733
742
  for (const row of taskRows) {
734
743
  lines.push(
735
744
  `| ${row.task} | \`${row.model}\` | ${row.reward === null ? "no score" : row.reward.toFixed(2)} |`
736
745
  );
737
746
  }
738
- lines.push("");
739
- lines.push("</details>");
747
+ if (fold) {
748
+ lines.push("");
749
+ lines.push("</details>");
750
+ }
740
751
  }
741
752
  return lines.join("\n");
742
753
  }
@@ -850,7 +861,13 @@ async function validateWorld(dir, opts) {
850
861
  runConfig: { id: runConfig.id, name: runConfig.name },
851
862
  runs
852
863
  };
853
- return { ...base, markdown: buildMarkdown(base, minScore) };
864
+ return {
865
+ ...base,
866
+ markdown: buildMarkdown(base, minScore, {
867
+ repoUrl: provenance.repoUrl,
868
+ commit: provenance.commit
869
+ })
870
+ };
854
871
  }
855
872
  var init_validate = __esm({
856
873
  "src/worlds/validate.ts"() {
@@ -1126,7 +1143,7 @@ var require_package = __commonJS({
1126
1143
  "package.json"(exports2, module2) {
1127
1144
  module2.exports = {
1128
1145
  name: "@withgateway/sdk",
1129
- version: "0.1.19",
1146
+ version: "0.1.20",
1130
1147
  description: "Gateway SDK for TypeScript - A/B experiments, tracing, and observability",
1131
1148
  main: "./dist/index.js",
1132
1149
  module: "./dist/index.mjs",