agents
Version:
A home for your AI agents
17 lines (16 loc) • 915 B
JavaScript
//#region src/channels/surface.ts
function isSurfaceValue(value) {
if (value === null || typeof value === "boolean" || typeof value === "string") return true;
if (typeof value === "number") return Number.isFinite(value);
if (Array.isArray(value)) return value.every(isSurfaceValue);
return typeof value === "object" && Object.values(value).every(isSurfaceValue);
}
/** Validate the common envelope before provider-specific address parsing. */
function isChannelMessageSurface(value) {
if (value === null || typeof value !== "object" || Array.isArray(value)) return false;
const surface = value;
return typeof surface.channelKey === "string" && surface.channelKey.length > 0 && surface.version === 1 && isSurfaceValue(surface.address) && typeof surface.label === "string" && surface.label.trim().length > 0;
}
//#endregion
export { isChannelMessageSurface as t };
//# sourceMappingURL=surface-bZZJqBka.js.map