@runtypelabs/sdk 10.17.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.mjs CHANGED
@@ -5233,7 +5233,7 @@ var ModelConfigsEndpoint = class {
5233
5233
  this.client = client;
5234
5234
  }
5235
5235
  /**
5236
- * Get available models catalog
5236
+ * Get the available models catalog, followed by the account's custom models (`uiCategory: 'custom'`)
5237
5237
  */
5238
5238
  async getAvailable() {
5239
5239
  const response = await this.client.get("/model-configs/available");
@@ -5252,13 +5252,21 @@ var ModelConfigsEndpoint = class {
5252
5252
  return (await this.client.get("/model-configs/search-configured")).data || [];
5253
5253
  }
5254
5254
  /**
5255
- * List user's model configurations
5255
+ * List every model the account can run: its model configurations plus the models its organization's
5256
+ * custom inference endpoints declare (`configScope: 'organization_connection'`)
5256
5257
  */
5257
5258
  async list() {
5258
5259
  const response = await this.client.get("/model-configs");
5259
5260
  return Array.isArray(response) ? response : response.data || [];
5260
5261
  }
5261
5262
  /**
5263
+ * Get which providers may serve a model call for the account. When `mode` is `byok_only`,
5264
+ * only models from `byokProviders` run.
5265
+ */
5266
+ async getCredentialPolicy() {
5267
+ return (await this.client.get("/model-configs")).credentialPolicy;
5268
+ }
5269
+ /**
5262
5270
  * Create a new model configuration
5263
5271
  */
5264
5272
  async create(data) {
@@ -12883,7 +12891,9 @@ function normalizeFpoDefinition(fpo) {
12883
12891
  ...fpo.schedules !== void 0 && fpo.schedules !== null ? { schedules: normalizeValue$1(fpo.schedules) } : {},
12884
12892
  ...fpo.secrets !== void 0 && fpo.secrets !== null ? { secrets: normalizeValue$1(fpo.secrets) } : {},
12885
12893
  ...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) } : {}
12894
+ ...fpo.skills !== void 0 && fpo.skills !== null ? { skills: normalizeValue$1(fpo.skills) } : {},
12895
+ ...fpo.collections !== void 0 && fpo.collections !== null ? { collections: normalizeValue$1(fpo.collections) } : {},
12896
+ ...fpo.questionSets !== void 0 && fpo.questionSets !== null ? { questionSets: normalizeValue$1(fpo.questionSets) } : {}
12887
12897
  };
12888
12898
  }
12889
12899
  /** SHA-256 (hex) over the canonical normalized FPO. */
@@ -14490,7 +14500,7 @@ function transformQueryParams(params) {
14490
14500
  }
14491
14501
  //#endregion
14492
14502
  //#region src/version.ts
14493
- const SDK_VERSION = "10.17.0";
14503
+ const SDK_VERSION = "11.0.0";
14494
14504
  /**
14495
14505
  * Canonical client identity the API uses for attribution
14496
14506
  * (`detectActorSource` in apps/api/src/lib/audit-log.ts keys `'sdk'` off the
@@ -14978,10 +14988,28 @@ var RuntypeClient = class {
14978
14988
  errorData = { error: "Unknown error occurred" };
14979
14989
  }
14980
14990
  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;
14991
+ const details = isObjectRecord(errorData) ? formatErrorDetails(errorData.details) : void 0;
14982
14992
  return new RuntypeApiError(details ? `${baseMessage}: ${details}` : baseMessage, response.status, errorData, new Headers(response.headers), response.statusText);
14983
14993
  }
14984
14994
  };
14995
+ const MAX_ERROR_DETAILS_IN_MESSAGE = 5;
14996
+ function formatErrorDetail(detail) {
14997
+ if (typeof detail === "string") return detail || void 0;
14998
+ if (!isObjectRecord(detail) || typeof detail.message !== "string") return void 0;
14999
+ const path = typeof detail.path === "string" && detail.path ? `${detail.path}: ` : "";
15000
+ const code = typeof detail.code === "string" && detail.code ? ` [${detail.code}]` : "";
15001
+ return `${path}${detail.message}${code}`;
15002
+ }
15003
+ /** Renders an error envelope's `details` (a string, or the validation detail list) for the error message. */
15004
+ function formatErrorDetails(details) {
15005
+ if (typeof details === "string") return details || void 0;
15006
+ if (!Array.isArray(details)) return void 0;
15007
+ const rendered = details.map(formatErrorDetail).filter((line) => line !== void 0);
15008
+ if (rendered.length === 0) return void 0;
15009
+ const shown = rendered.slice(0, MAX_ERROR_DETAILS_IN_MESSAGE).join("; ");
15010
+ const omitted = rendered.length - MAX_ERROR_DETAILS_IN_MESSAGE;
15011
+ return omitted > 0 ? `${shown}; and ${omitted} more` : shown;
15012
+ }
14985
15013
  /**
14986
15014
  * Custom error class for Runtype API errors
14987
15015
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@runtypelabs/sdk",
3
- "version": "10.17.0",
3
+ "version": "11.0.0",
4
4
  "type": "module",
5
5
  "description": "TypeScript SDK for the Runtype API with fluent methods. Use it to quickly realize AI products, agents, and workflows.",
6
6
  "main": "dist/index.cjs",
@@ -24,7 +24,7 @@
24
24
  ],
25
25
  "dependencies": {},
26
26
  "devDependencies": {
27
- "@runtypelabs/shared": "3.83.0",
27
+ "@runtypelabs/shared": "3.85.0",
28
28
  "openapi-typescript": "^7.13.0",
29
29
  "tsdown": "^0.23.0",
30
30
  "typescript": "^6.0.3",