@runtypelabs/sdk 10.16.0 → 11.0.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/dist/index.cjs CHANGED
@@ -5234,7 +5234,7 @@ var ModelConfigsEndpoint = class {
5234
5234
  this.client = client;
5235
5235
  }
5236
5236
  /**
5237
- * Get available models catalog
5237
+ * Get the available models catalog, followed by the account's custom models (`uiCategory: 'custom'`)
5238
5238
  */
5239
5239
  async getAvailable() {
5240
5240
  const response = await this.client.get("/model-configs/available");
@@ -5253,13 +5253,21 @@ var ModelConfigsEndpoint = class {
5253
5253
  return (await this.client.get("/model-configs/search-configured")).data || [];
5254
5254
  }
5255
5255
  /**
5256
- * List user's model configurations
5256
+ * List every model the account can run: its model configurations plus the models its organization's
5257
+ * custom inference endpoints declare (`configScope: 'organization_connection'`)
5257
5258
  */
5258
5259
  async list() {
5259
5260
  const response = await this.client.get("/model-configs");
5260
5261
  return Array.isArray(response) ? response : response.data || [];
5261
5262
  }
5262
5263
  /**
5264
+ * Get which providers may serve a model call for the account. When `mode` is `byok_only`,
5265
+ * only models from `byokProviders` run.
5266
+ */
5267
+ async getCredentialPolicy() {
5268
+ return (await this.client.get("/model-configs")).credentialPolicy;
5269
+ }
5270
+ /**
5263
5271
  * Create a new model configuration
5264
5272
  */
5265
5273
  async create(data) {
@@ -11911,6 +11919,7 @@ const AGENT_CONFIG_KEYS = [
11911
11919
  "sandbox",
11912
11920
  "tenancyStrategy",
11913
11921
  "durability",
11922
+ "busyMessageRouting",
11914
11923
  "state"
11915
11924
  ];
11916
11925
  const AGENT_CONFIG_KEY_LIST = [...AGENT_CONFIG_KEYS].sort();
@@ -12883,7 +12892,9 @@ function normalizeFpoDefinition(fpo) {
12883
12892
  ...fpo.schedules !== void 0 && fpo.schedules !== null ? { schedules: normalizeValue$1(fpo.schedules) } : {},
12884
12893
  ...fpo.secrets !== void 0 && fpo.secrets !== null ? { secrets: normalizeValue$1(fpo.secrets) } : {},
12885
12894
  ...fpo.evals !== void 0 && fpo.evals !== null ? { evals: normalizeValue$1(fpo.evals) } : {},
12886
- ...fpo.skills !== void 0 && fpo.skills !== null ? { skills: normalizeValue$1(fpo.skills) } : {}
12895
+ ...fpo.skills !== void 0 && fpo.skills !== null ? { skills: normalizeValue$1(fpo.skills) } : {},
12896
+ ...fpo.collections !== void 0 && fpo.collections !== null ? { collections: normalizeValue$1(fpo.collections) } : {},
12897
+ ...fpo.questionSets !== void 0 && fpo.questionSets !== null ? { questionSets: normalizeValue$1(fpo.questionSets) } : {}
12887
12898
  };
12888
12899
  }
12889
12900
  /** SHA-256 (hex) over the canonical normalized FPO. */
@@ -14490,7 +14501,7 @@ function transformQueryParams(params) {
14490
14501
  }
14491
14502
  //#endregion
14492
14503
  //#region src/version.ts
14493
- const SDK_VERSION = "10.16.0";
14504
+ const SDK_VERSION = "11.0.0";
14494
14505
  /**
14495
14506
  * Canonical client identity the API uses for attribution
14496
14507
  * (`detectActorSource` in apps/api/src/lib/audit-log.ts keys `'sdk'` off the
@@ -14978,10 +14989,28 @@ var RuntypeClient = class {
14978
14989
  errorData = { error: "Unknown error occurred" };
14979
14990
  }
14980
14991
  const baseMessage = isObjectRecord(errorData) && (typeof errorData.error === "string" || typeof errorData.message === "string") ? errorData.error || errorData.message || "Request failed" : "Request failed";
14981
- const details = isObjectRecord(errorData) && typeof errorData.details === "string" ? errorData.details : void 0;
14992
+ const details = isObjectRecord(errorData) ? formatErrorDetails(errorData.details) : void 0;
14982
14993
  return new RuntypeApiError(details ? `${baseMessage}: ${details}` : baseMessage, response.status, errorData, new Headers(response.headers), response.statusText);
14983
14994
  }
14984
14995
  };
14996
+ const MAX_ERROR_DETAILS_IN_MESSAGE = 5;
14997
+ function formatErrorDetail(detail) {
14998
+ if (typeof detail === "string") return detail || void 0;
14999
+ if (!isObjectRecord(detail) || typeof detail.message !== "string") return void 0;
15000
+ const path = typeof detail.path === "string" && detail.path ? `${detail.path}: ` : "";
15001
+ const code = typeof detail.code === "string" && detail.code ? ` [${detail.code}]` : "";
15002
+ return `${path}${detail.message}${code}`;
15003
+ }
15004
+ /** Renders an error envelope's `details` (a string, or the validation detail list) for the error message. */
15005
+ function formatErrorDetails(details) {
15006
+ if (typeof details === "string") return details || void 0;
15007
+ if (!Array.isArray(details)) return void 0;
15008
+ const rendered = details.map(formatErrorDetail).filter((line) => line !== void 0);
15009
+ if (rendered.length === 0) return void 0;
15010
+ const shown = rendered.slice(0, MAX_ERROR_DETAILS_IN_MESSAGE).join("; ");
15011
+ const omitted = rendered.length - MAX_ERROR_DETAILS_IN_MESSAGE;
15012
+ return omitted > 0 ? `${shown}; and ${omitted} more` : shown;
15013
+ }
14985
15014
  /**
14986
15015
  * Custom error class for Runtype API errors
14987
15016
  */