@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.js
CHANGED
|
@@ -336,7 +336,7 @@ function isIncludedInContentHash(relPath, includeAllRootFiles) {
|
|
|
336
336
|
if (name.startsWith(".")) return false;
|
|
337
337
|
if (parts.includes("__pycache__")) return false;
|
|
338
338
|
if (dirParts.length === 0) {
|
|
339
|
-
return includeAllRootFiles || name === "README.md" || name === "pyproject.toml" || name
|
|
339
|
+
return includeAllRootFiles || name === "README.md" || name === "pyproject.toml" || BROAD_ROOT_MARKERS.includes(name) || name.endsWith(".py");
|
|
340
340
|
}
|
|
341
341
|
return !dirParts.some(isExcludedDirComponent);
|
|
342
342
|
}
|
|
@@ -347,7 +347,9 @@ function collectArchiveRelPaths(dir) {
|
|
|
347
347
|
);
|
|
348
348
|
}
|
|
349
349
|
const out = [];
|
|
350
|
-
const includeAllRootFiles =
|
|
350
|
+
const includeAllRootFiles = BROAD_ROOT_MARKERS.some(
|
|
351
|
+
(marker) => fs.existsSync(path.join(dir, marker))
|
|
352
|
+
);
|
|
351
353
|
const walk = (rel) => {
|
|
352
354
|
const abs = rel ? path.join(dir, rel) : dir;
|
|
353
355
|
for (const entry of fs.readdirSync(abs, { withFileTypes: true }).sort((a, b) => a.name.localeCompare(b.name))) {
|
|
@@ -661,7 +663,7 @@ async function createRef(slug, name, kind, versionId, options = {}) {
|
|
|
661
663
|
...versionId ? { versionId } : {}
|
|
662
664
|
});
|
|
663
665
|
}
|
|
664
|
-
var import_node_crypto, import_node_zlib, fs, path, DEFAULT_BRANCH, META_RELPATH, SKIP_DIRS, ROOT_EXCLUDED_DIRS, sha256b64;
|
|
666
|
+
var import_node_crypto, import_node_zlib, fs, path, DEFAULT_BRANCH, META_RELPATH, SKIP_DIRS, ROOT_EXCLUDED_DIRS, BROAD_ROOT_MARKERS, sha256b64;
|
|
665
667
|
var init_hub = __esm({
|
|
666
668
|
"src/worlds/hub.ts"() {
|
|
667
669
|
"use strict";
|
|
@@ -683,6 +685,7 @@ var init_hub = __esm({
|
|
|
683
685
|
"outputs"
|
|
684
686
|
]);
|
|
685
687
|
ROOT_EXCLUDED_DIRS = /* @__PURE__ */ new Set(["dist", "build", "outputs", "__pycache__"]);
|
|
688
|
+
BROAD_ROOT_MARKERS = ["gateway-env.toml", "gateway-api-world.toml"];
|
|
686
689
|
sha256b64 = (data) => (0, import_node_crypto.createHash)("sha256").update(data).digest("base64");
|
|
687
690
|
}
|
|
688
691
|
});
|
|
@@ -768,6 +771,23 @@ async function validateWorld(dir, opts) {
|
|
|
768
771
|
versionId: pushed.versionId,
|
|
769
772
|
...provenance
|
|
770
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
|
+
};
|
|
771
791
|
const runs = [];
|
|
772
792
|
for (const run of dispatched.runs) {
|
|
773
793
|
if (!run.ok) {
|
|
@@ -790,6 +810,7 @@ async function validateWorld(dir, opts) {
|
|
|
790
810
|
`\u2026${run.model}: ${r.status.toLowerCase()} (${r.shardsCompleted ?? 0}/${r.parallelism} shards)`
|
|
791
811
|
)
|
|
792
812
|
});
|
|
813
|
+
report = { ...report, url: fallbackUrl(report) };
|
|
793
814
|
if (report.status.toUpperCase() !== "COMPLETED") {
|
|
794
815
|
failure = report.status;
|
|
795
816
|
} else if (minScore !== null) {
|