@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.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) {
@@ -11910,6 +11918,7 @@ const AGENT_CONFIG_KEYS = [
11910
11918
  "sandbox",
11911
11919
  "tenancyStrategy",
11912
11920
  "durability",
11921
+ "busyMessageRouting",
11913
11922
  "state"
11914
11923
  ];
11915
11924
  const AGENT_CONFIG_KEY_LIST = [...AGENT_CONFIG_KEYS].sort();
@@ -12882,7 +12891,9 @@ function normalizeFpoDefinition(fpo) {
12882
12891
  ...fpo.schedules !== void 0 && fpo.schedules !== null ? { schedules: normalizeValue$1(fpo.schedules) } : {},
12883
12892
  ...fpo.secrets !== void 0 && fpo.secrets !== null ? { secrets: normalizeValue$1(fpo.secrets) } : {},
12884
12893
  ...fpo.evals !== void 0 && fpo.evals !== null ? { evals: normalizeValue$1(fpo.evals) } : {},
12885
- ...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) } : {}
12886
12897
  };
12887
12898
  }
12888
12899
  /** SHA-256 (hex) over the canonical normalized FPO. */
@@ -14489,7 +14500,7 @@ function transformQueryParams(params) {
14489
14500
  }
14490
14501
  //#endregion
14491
14502
  //#region src/version.ts
14492
- const SDK_VERSION = "10.16.0";
14503
+ const SDK_VERSION = "11.0.0";
14493
14504
  /**
14494
14505
  * Canonical client identity the API uses for attribution
14495
14506
  * (`detectActorSource` in apps/api/src/lib/audit-log.ts keys `'sdk'` off the
@@ -14977,10 +14988,28 @@ var RuntypeClient = class {
14977
14988
  errorData = { error: "Unknown error occurred" };
14978
14989
  }
14979
14990
  const baseMessage = isObjectRecord(errorData) && (typeof errorData.error === "string" || typeof errorData.message === "string") ? errorData.error || errorData.message || "Request failed" : "Request failed";
14980
- const details = isObjectRecord(errorData) && typeof errorData.details === "string" ? errorData.details : void 0;
14991
+ const details = isObjectRecord(errorData) ? formatErrorDetails(errorData.details) : void 0;
14981
14992
  return new RuntypeApiError(details ? `${baseMessage}: ${details}` : baseMessage, response.status, errorData, new Headers(response.headers), response.statusText);
14982
14993
  }
14983
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
+ }
14984
15013
  /**
14985
15014
  * Custom error class for Runtype API errors
14986
15015
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@runtypelabs/sdk",
3
- "version": "10.16.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.82.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",