@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.mjs CHANGED
@@ -683,14 +683,15 @@ var init_hub = __esm({
683
683
  function fmtScore(score) {
684
684
  return score === null ? "no score" : score.toFixed(3);
685
685
  }
686
- function buildMarkdown(report, minScore) {
686
+ function buildMarkdown(report, minScore, source) {
687
687
  const lines = [];
688
688
  lines.push(
689
689
  `### World validation ${report.ok ? "passed" : "failed"} \u2014 \`${report.slug}@${report.branch}\``
690
690
  );
691
691
  lines.push("");
692
+ const commitLink = source?.repoUrl && source?.commit ? `[\`${source.commit.slice(0, 12)}\`](${source.repoUrl}/commit/${source.commit})` : null;
692
693
  lines.push(
693
- `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}.` : ".")
694
+ `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}.` : ".")
694
695
  );
695
696
  lines.push("");
696
697
  lines.push("| Model | Status | Score | Run |");
@@ -710,19 +711,29 @@ function buildMarkdown(report, minScore) {
710
711
  reward: sample.reward
711
712
  }))
712
713
  );
713
- if (taskRows.length > 0 && taskRows.length <= 40) {
714
+ if (taskRows.length > 0) {
715
+ const fold = taskRows.length > 12;
714
716
  lines.push("");
715
- lines.push("<details><summary>Per-task rewards</summary>");
716
- lines.push("");
717
- lines.push("| Task | Model | Reward |");
717
+ if (fold) {
718
+ lines.push(
719
+ `<details><summary>Per-scenario rewards (${taskRows.length})</summary>`
720
+ );
721
+ lines.push("");
722
+ } else {
723
+ lines.push(`**Scenarios (${taskRows.length})**`);
724
+ lines.push("");
725
+ }
726
+ lines.push("| Scenario | Model | Reward |");
718
727
  lines.push("| --- | --- | ---: |");
719
728
  for (const row of taskRows) {
720
729
  lines.push(
721
730
  `| ${row.task} | \`${row.model}\` | ${row.reward === null ? "no score" : row.reward.toFixed(2)} |`
722
731
  );
723
732
  }
724
- lines.push("");
725
- lines.push("</details>");
733
+ if (fold) {
734
+ lines.push("");
735
+ lines.push("</details>");
736
+ }
726
737
  }
727
738
  return lines.join("\n");
728
739
  }
@@ -836,7 +847,13 @@ async function validateWorld(dir, opts) {
836
847
  runConfig: { id: runConfig.id, name: runConfig.name },
837
848
  runs
838
849
  };
839
- return { ...base, markdown: buildMarkdown(base, minScore) };
850
+ return {
851
+ ...base,
852
+ markdown: buildMarkdown(base, minScore, {
853
+ repoUrl: provenance.repoUrl,
854
+ commit: provenance.commit
855
+ })
856
+ };
840
857
  }
841
858
  var init_validate = __esm({
842
859
  "src/worlds/validate.ts"() {
@@ -1112,7 +1129,7 @@ var require_package = __commonJS({
1112
1129
  "package.json"(exports, module) {
1113
1130
  module.exports = {
1114
1131
  name: "@withgateway/sdk",
1115
- version: "0.1.19",
1132
+ version: "0.1.20",
1116
1133
  description: "Gateway SDK for TypeScript - A/B experiments, tracing, and observability",
1117
1134
  main: "./dist/index.js",
1118
1135
  module: "./dist/index.mjs",