@copilotkit/runtime
Version:
<img src="https://github.com/user-attachments/assets/0a6b64d9-e193-4940-a3f6-60334ac34084" alt="banner" style="border-radius: 12px; border: 2px solid #d6d4fa;" />
19 lines (18 loc) • 983 B
JavaScript
import "reflect-metadata";
//#region src/v2/runtime/core/learning.ts
const STABLE_CONTAINER_ID = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
/** Validates and returns a stable Learning Container ID. */
function assertStableLearningContainerId(value) {
if (typeof value !== "string" || value.length < 1 || value.length > 64 || !STABLE_CONTAINER_ID.test(value)) throw new Error("Learning Container must use a 1-64 character stable ID with lowercase letters, numbers, and single hyphens");
return value;
}
/** Resolves the configured Container once for one web or Channel run. */
async function resolveLearningContainerId(config, input) {
if (config === void 0) return void 0;
const value = typeof config.containerId === "function" ? await config.containerId(input) : config.containerId;
if (value == null) return void 0;
return assertStableLearningContainerId(value);
}
//#endregion
export { assertStableLearningContainerId, resolveLearningContainerId };
//# sourceMappingURL=learning.mjs.map