@wix/evalforge-evaluator 0.185.0 → 0.186.0

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/build/index.js CHANGED
@@ -6816,21 +6816,37 @@ function createApiClient(serverUrl, options = "") {
6816
6816
  // The legacy REST endpoint enriched the capability with its latest version
6817
6817
  // server-side; ambassador's GetCapability returns the bare entity, so we
6818
6818
  // compose it with GetLatestCapabilityVersion in parallel here.
6819
+ //
6820
+ // The latest-version fetch is BEST-EFFORT: a failure must not drop the whole
6821
+ // capability. Otherwise one broken snapshot fetch makes the capability (e.g.
6822
+ // an MCP) silently vanish from the run. Runs that pin a version still resolve
6823
+ // their content via getCapabilityVersion downstream.
6819
6824
  async getCapability(projectId2, id) {
6820
- const [capRes, versionRes] = await Promise.all([
6825
+ const [capResult, versionResult] = await Promise.allSettled([
6821
6826
  httpClient.request(getCapability({ projectId: projectId2, capabilityId: id })),
6822
6827
  httpClient.request(
6823
6828
  getLatestCapabilityVersion({ projectId: projectId2, capabilityId: id })
6824
6829
  )
6825
6830
  ]);
6826
- const capability = capRes.data.capability;
6831
+ if (capResult.status === "rejected") {
6832
+ throw capResult.reason;
6833
+ }
6834
+ const capability = capResult.value.data.capability;
6827
6835
  if (!capability) {
6828
6836
  throw new Error(`Capability ${id} not found in project ${projectId2}`);
6829
6837
  }
6830
- const latestVersion = versionRes.data.capabilityVersion ? capabilityVersionFromProto(
6831
- versionRes.data.capabilityVersion,
6832
- projectId2
6833
- ) : void 0;
6838
+ let latestVersion;
6839
+ if (versionResult.status === "fulfilled" && versionResult.value.data.capabilityVersion) {
6840
+ latestVersion = capabilityVersionFromProto(
6841
+ versionResult.value.data.capabilityVersion,
6842
+ projectId2
6843
+ );
6844
+ } else if (versionResult.status === "rejected") {
6845
+ const reason = versionResult.reason instanceof Error ? versionResult.reason.message : String(versionResult.reason);
6846
+ console.warn(
6847
+ `[Capabilities] getLatestCapabilityVersion(${id}) failed; loading capability without a snapshot (pinned versions still resolve): ${reason}`
6848
+ );
6849
+ }
6834
6850
  return { ...capabilityFromProto(capability), latestVersion };
6835
6851
  },
6836
6852
  async getCapabilityVersion(projectId2, capabilityId, versionId) {