@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/cli.mjs
CHANGED
|
@@ -327,7 +327,7 @@ function isIncludedInContentHash(relPath, includeAllRootFiles) {
|
|
|
327
327
|
if (name.startsWith(".")) return false;
|
|
328
328
|
if (parts.includes("__pycache__")) return false;
|
|
329
329
|
if (dirParts.length === 0) {
|
|
330
|
-
return includeAllRootFiles || name === "README.md" || name === "pyproject.toml" || name
|
|
330
|
+
return includeAllRootFiles || name === "README.md" || name === "pyproject.toml" || BROAD_ROOT_MARKERS.includes(name) || name.endsWith(".py");
|
|
331
331
|
}
|
|
332
332
|
return !dirParts.some(isExcludedDirComponent);
|
|
333
333
|
}
|
|
@@ -338,7 +338,9 @@ function collectArchiveRelPaths(dir) {
|
|
|
338
338
|
);
|
|
339
339
|
}
|
|
340
340
|
const out = [];
|
|
341
|
-
const includeAllRootFiles =
|
|
341
|
+
const includeAllRootFiles = BROAD_ROOT_MARKERS.some(
|
|
342
|
+
(marker) => fs.existsSync(path.join(dir, marker))
|
|
343
|
+
);
|
|
342
344
|
const walk = (rel) => {
|
|
343
345
|
const abs = rel ? path.join(dir, rel) : dir;
|
|
344
346
|
for (const entry of fs.readdirSync(abs, { withFileTypes: true }).sort((a, b) => a.name.localeCompare(b.name))) {
|
|
@@ -652,7 +654,7 @@ async function createRef(slug, name, kind, versionId, options = {}) {
|
|
|
652
654
|
...versionId ? { versionId } : {}
|
|
653
655
|
});
|
|
654
656
|
}
|
|
655
|
-
var DEFAULT_BRANCH, META_RELPATH, SKIP_DIRS, ROOT_EXCLUDED_DIRS, sha256b64;
|
|
657
|
+
var DEFAULT_BRANCH, META_RELPATH, SKIP_DIRS, ROOT_EXCLUDED_DIRS, BROAD_ROOT_MARKERS, sha256b64;
|
|
656
658
|
var init_hub = __esm({
|
|
657
659
|
"src/worlds/hub.ts"() {
|
|
658
660
|
"use strict";
|
|
@@ -670,6 +672,7 @@ var init_hub = __esm({
|
|
|
670
672
|
"outputs"
|
|
671
673
|
]);
|
|
672
674
|
ROOT_EXCLUDED_DIRS = /* @__PURE__ */ new Set(["dist", "build", "outputs", "__pycache__"]);
|
|
675
|
+
BROAD_ROOT_MARKERS = ["gateway-env.toml", "gateway-api-world.toml"];
|
|
673
676
|
sha256b64 = (data) => createHash("sha256").update(data).digest("base64");
|
|
674
677
|
}
|
|
675
678
|
});
|
|
@@ -755,6 +758,23 @@ async function validateWorld(dir, opts) {
|
|
|
755
758
|
versionId: pushed.versionId,
|
|
756
759
|
...provenance
|
|
757
760
|
});
|
|
761
|
+
const host = (options.host ?? process.env.GATEWAY_HOST ?? "https://withgateway.ai").replace(/\/+$/, "");
|
|
762
|
+
let projectId = null;
|
|
763
|
+
try {
|
|
764
|
+
const projects = await apiRequest(
|
|
765
|
+
options,
|
|
766
|
+
"GET",
|
|
767
|
+
"/api/public/projects"
|
|
768
|
+
);
|
|
769
|
+
projectId = projects.data?.[0]?.id ?? null;
|
|
770
|
+
} catch {
|
|
771
|
+
projectId = null;
|
|
772
|
+
}
|
|
773
|
+
const fallbackUrl = (report) => {
|
|
774
|
+
if (report.url) return report.url;
|
|
775
|
+
const evaluationId = report.evaluations[0]?.id;
|
|
776
|
+
return projectId && evaluationId ? `${host}/project/${projectId}/environment/runs/${encodeURIComponent(evaluationId)}` : null;
|
|
777
|
+
};
|
|
758
778
|
const runs = [];
|
|
759
779
|
for (const run of dispatched.runs) {
|
|
760
780
|
if (!run.ok) {
|
|
@@ -777,6 +797,7 @@ async function validateWorld(dir, opts) {
|
|
|
777
797
|
`\u2026${run.model}: ${r.status.toLowerCase()} (${r.shardsCompleted ?? 0}/${r.parallelism} shards)`
|
|
778
798
|
)
|
|
779
799
|
});
|
|
800
|
+
report = { ...report, url: fallbackUrl(report) };
|
|
780
801
|
if (report.status.toUpperCase() !== "COMPLETED") {
|
|
781
802
|
failure = report.status;
|
|
782
803
|
} else if (minScore !== null) {
|