@withgateway/sdk 0.1.16 → 0.1.18
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/cli.js +24 -3
- package/dist/cli.js.map +1 -1
- package/dist/cli.mjs +24 -3
- package/dist/cli.mjs.map +1 -1
- package/dist/index.js +25 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +25 -4
- package/dist/index.mjs.map +1 -1
- package/dist/tracing/index.js +1 -1
- package/dist/tracing/index.js.map +1 -1
- package/dist/tracing/index.mjs +1 -1
- package/dist/tracing/index.mjs.map +1 -1
- package/dist/worlds/index.js +24 -3
- package/dist/worlds/index.js.map +1 -1
- package/dist/worlds/index.mjs +24 -3
- package/dist/worlds/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -329,7 +329,7 @@ function isIncludedInContentHash(relPath, includeAllRootFiles) {
|
|
|
329
329
|
if (name.startsWith(".")) return false;
|
|
330
330
|
if (parts.includes("__pycache__")) return false;
|
|
331
331
|
if (dirParts.length === 0) {
|
|
332
|
-
return includeAllRootFiles || name === "README.md" || name === "pyproject.toml" || name
|
|
332
|
+
return includeAllRootFiles || name === "README.md" || name === "pyproject.toml" || BROAD_ROOT_MARKERS.includes(name) || name.endsWith(".py");
|
|
333
333
|
}
|
|
334
334
|
return !dirParts.some(isExcludedDirComponent);
|
|
335
335
|
}
|
|
@@ -340,7 +340,9 @@ function collectArchiveRelPaths(dir) {
|
|
|
340
340
|
);
|
|
341
341
|
}
|
|
342
342
|
const out = [];
|
|
343
|
-
const includeAllRootFiles =
|
|
343
|
+
const includeAllRootFiles = BROAD_ROOT_MARKERS.some(
|
|
344
|
+
(marker) => fs.existsSync(path.join(dir, marker))
|
|
345
|
+
);
|
|
344
346
|
const walk = (rel) => {
|
|
345
347
|
const abs = rel ? path.join(dir, rel) : dir;
|
|
346
348
|
for (const entry of fs.readdirSync(abs, { withFileTypes: true }).sort((a, b) => a.name.localeCompare(b.name))) {
|
|
@@ -654,7 +656,7 @@ async function createRef(slug, name, kind, versionId, options = {}) {
|
|
|
654
656
|
...versionId ? { versionId } : {}
|
|
655
657
|
});
|
|
656
658
|
}
|
|
657
|
-
var DEFAULT_BRANCH, META_RELPATH, SKIP_DIRS, ROOT_EXCLUDED_DIRS, sha256b64;
|
|
659
|
+
var DEFAULT_BRANCH, META_RELPATH, SKIP_DIRS, ROOT_EXCLUDED_DIRS, BROAD_ROOT_MARKERS, sha256b64;
|
|
658
660
|
var init_hub = __esm({
|
|
659
661
|
"src/worlds/hub.ts"() {
|
|
660
662
|
"use strict";
|
|
@@ -672,6 +674,7 @@ var init_hub = __esm({
|
|
|
672
674
|
"outputs"
|
|
673
675
|
]);
|
|
674
676
|
ROOT_EXCLUDED_DIRS = /* @__PURE__ */ new Set(["dist", "build", "outputs", "__pycache__"]);
|
|
677
|
+
BROAD_ROOT_MARKERS = ["gateway-env.toml", "gateway-api-world.toml"];
|
|
675
678
|
sha256b64 = (data) => createHash2("sha256").update(data).digest("base64");
|
|
676
679
|
}
|
|
677
680
|
});
|
|
@@ -757,6 +760,23 @@ async function validateWorld(dir, opts) {
|
|
|
757
760
|
versionId: pushed.versionId,
|
|
758
761
|
...provenance
|
|
759
762
|
});
|
|
763
|
+
const host = (options.host ?? process.env.GATEWAY_HOST ?? "https://withgateway.ai").replace(/\/+$/, "");
|
|
764
|
+
let projectId = null;
|
|
765
|
+
try {
|
|
766
|
+
const projects = await apiRequest(
|
|
767
|
+
options,
|
|
768
|
+
"GET",
|
|
769
|
+
"/api/public/projects"
|
|
770
|
+
);
|
|
771
|
+
projectId = projects.data?.[0]?.id ?? null;
|
|
772
|
+
} catch {
|
|
773
|
+
projectId = null;
|
|
774
|
+
}
|
|
775
|
+
const fallbackUrl = (report) => {
|
|
776
|
+
if (report.url) return report.url;
|
|
777
|
+
const evaluationId = report.evaluations[0]?.id;
|
|
778
|
+
return projectId && evaluationId ? `${host}/project/${projectId}/environment/runs/${encodeURIComponent(evaluationId)}` : null;
|
|
779
|
+
};
|
|
760
780
|
const runs = [];
|
|
761
781
|
for (const run of dispatched.runs) {
|
|
762
782
|
if (!run.ok) {
|
|
@@ -779,6 +799,7 @@ async function validateWorld(dir, opts) {
|
|
|
779
799
|
`\u2026${run.model}: ${r.status.toLowerCase()} (${r.shardsCompleted ?? 0}/${r.parallelism} shards)`
|
|
780
800
|
)
|
|
781
801
|
});
|
|
802
|
+
report = { ...report, url: fallbackUrl(report) };
|
|
782
803
|
if (report.status.toUpperCase() !== "COMPLETED") {
|
|
783
804
|
failure = report.status;
|
|
784
805
|
} else if (minScore !== null) {
|
|
@@ -1076,7 +1097,7 @@ var require_package = __commonJS({
|
|
|
1076
1097
|
"package.json"(exports, module) {
|
|
1077
1098
|
module.exports = {
|
|
1078
1099
|
name: "@withgateway/sdk",
|
|
1079
|
-
version: "0.1.
|
|
1100
|
+
version: "0.1.18",
|
|
1080
1101
|
description: "Gateway SDK for TypeScript - A/B experiments, tracing, and observability",
|
|
1081
1102
|
main: "./dist/index.js",
|
|
1082
1103
|
module: "./dist/index.mjs",
|