{"version":3,"sources":["../src/index.ts","../src/core/log.ts","../../utils/dist/index.js","../src/core/utils.ts","../src/core/flags.ts","../../toolprint-api-client/src/zod.gen.ts","../../toolprint-api-client/src/core/bodySerializer.ts","../../toolprint-api-client/src/core/params.ts","../../toolprint-api-client/src/core/auth.ts","../../toolprint-api-client/src/core/pathSerializer.ts","../../toolprint-api-client/src/client/utils.ts","../../toolprint-api-client/src/client/client.ts","../../toolprint-api-client/src/client.gen.ts","../../toolprint-api-client/src/sdk.gen.ts","../src/core/api/client.ts","../src/core/api/utils.ts","../src/core/api/high.ts","../src/connection.ts","../src/providers/mcp/toolcall.ts","../src/schema.ts","../src/providers/blaxel/connection.ts","../src/secrets/doppler.ts","../src/providers/blaxel/api.ts","../src/providers/smithery/connection.ts","../src/providers/mcp/session.ts","../src/providers/blaxel/transport.ts","../src/providers/smithery/transport.ts","../src/providers/composio/transport.ts","../src/providers/composio/connection.ts","../src/providers/composio/api.ts","../src/printer.ts","../src/toolcache.ts","../src/toolbox.ts","../src/providers/mcp/transport/sse.ts","../src/providers/mcp/types.ts","../src/extensions/langchain.ts"],"sourcesContent":["export * from './core/index.js'\n\nexport * from './connection.js'\nexport * from './schema.js'\nexport * from './printer.js'\nexport * from './toolbox.js'\nexport * from './toolcache.js'\nexport * from './types.js'\n\nexport * from './secrets/index.js'\n\nexport * from './providers/mcp/index.js'\nexport * from './providers/blaxel/index.js'\nexport * from './providers/smithery/index.js'\n\nexport * from './extensions/langchain.js'\nexport * from './extensions/types.js'\n","import { z } from 'zod'\nimport { getEnv, getLogger, wrapConsole, loggingSchema } from '@repo/utils'\n\n/**\n * NOTE: We previously had a custom sdkLoggingSchema that extended the base loggingSchema\n * to validate ONEGREP_SDK_LOG_LEVEL. This was removed due to TypeScript type conflicts\n * between different instances of Zod types when extending schemas.\n *\n * Instead, we now:\n * 1. Use the base loggingSchema directly from @repo/utils\n * 2. Handle ONEGREP_SDK_LOG_LEVEL through the sdkLogLevel function with its own validation\n * 3. Trade schema validation for type compatibility\n */\n\n// Separate schema just for SDK log level validation\nconst sdkLogLevelSchema = z.string().default('info')\n\nconst sdkLogLevel = () => {\n  const rawLevel =\n    process.env.ONEGREP_SDK_LOG_LEVEL ?? process.env.LOG_LEVEL ?? 'info'\n  // Parse and validate the log level\n  return sdkLogLevelSchema.parse(rawLevel)\n}\n\nconst initSdkLogger = () => {\n  const env = getEnv(loggingSchema)\n  return getLogger(env.LOG_MODE, 'sdk', sdkLogLevel())\n}\n\n/**\n * The child logger for the onegrep-sdk.\n */\nexport const log = initSdkLogger()\n\n/**\n * Wraps the console object with the sdk root logger.\n * NOTE: Should call this as soon as possible in the application\n * to ensure that any third party libraries that use the console\n * object will log to the sdk root logger.\n */\nexport const useRootLoggerAsConsole = () => {\n  wrapConsole()\n}\n","import require$$2 from 'os';\nimport path from 'path';\nimport fs from 'fs';\nimport require$$3 from 'crypto';\nimport chalk from 'chalk';\n\nvar util;\n(function (util) {\n    util.assertEqual = (val) => val;\n    function assertIs(_arg) { }\n    util.assertIs = assertIs;\n    function assertNever(_x) {\n        throw new Error();\n    }\n    util.assertNever = assertNever;\n    util.arrayToEnum = (items) => {\n        const obj = {};\n        for (const item of items) {\n            obj[item] = item;\n        }\n        return obj;\n    };\n    util.getValidEnumValues = (obj) => {\n        const validKeys = util.objectKeys(obj).filter((k) => typeof obj[obj[k]] !== \"number\");\n        const filtered = {};\n        for (const k of validKeys) {\n            filtered[k] = obj[k];\n        }\n        return util.objectValues(filtered);\n    };\n    util.objectValues = (obj) => {\n        return util.objectKeys(obj).map(function (e) {\n            return obj[e];\n        });\n    };\n    util.objectKeys = typeof Object.keys === \"function\" // eslint-disable-line ban/ban\n        ? (obj) => Object.keys(obj) // eslint-disable-line ban/ban\n        : (object) => {\n            const keys = [];\n            for (const key in object) {\n                if (Object.prototype.hasOwnProperty.call(object, key)) {\n                    keys.push(key);\n                }\n            }\n            return keys;\n        };\n    util.find = (arr, checker) => {\n        for (const item of arr) {\n            if (checker(item))\n                return item;\n        }\n        return undefined;\n    };\n    util.isInteger = typeof Number.isInteger === \"function\"\n        ? (val) => Number.isInteger(val) // eslint-disable-line ban/ban\n        : (val) => typeof val === \"number\" && isFinite(val) && Math.floor(val) === val;\n    function joinValues(array, separator = \" | \") {\n        return array\n            .map((val) => (typeof val === \"string\" ? `'${val}'` : val))\n            .join(separator);\n    }\n    util.joinValues = joinValues;\n    util.jsonStringifyReplacer = (_, value) => {\n        if (typeof value === \"bigint\") {\n            return value.toString();\n        }\n        return value;\n    };\n})(util || (util = {}));\nvar objectUtil;\n(function (objectUtil) {\n    objectUtil.mergeShapes = (first, second) => {\n        return {\n            ...first,\n            ...second, // second overwrites first\n        };\n    };\n})(objectUtil || (objectUtil = {}));\nconst ZodParsedType = util.arrayToEnum([\n    \"string\",\n    \"nan\",\n    \"number\",\n    \"integer\",\n    \"float\",\n    \"boolean\",\n    \"date\",\n    \"bigint\",\n    \"symbol\",\n    \"function\",\n    \"undefined\",\n    \"null\",\n    \"array\",\n    \"object\",\n    \"unknown\",\n    \"promise\",\n    \"void\",\n    \"never\",\n    \"map\",\n    \"set\",\n]);\nconst getParsedType = (data) => {\n    const t = typeof data;\n    switch (t) {\n        case \"undefined\":\n            return ZodParsedType.undefined;\n        case \"string\":\n            return ZodParsedType.string;\n        case \"number\":\n            return isNaN(data) ? ZodParsedType.nan : ZodParsedType.number;\n        case \"boolean\":\n            return ZodParsedType.boolean;\n        case \"function\":\n            return ZodParsedType.function;\n        case \"bigint\":\n            return ZodParsedType.bigint;\n        case \"symbol\":\n            return ZodParsedType.symbol;\n        case \"object\":\n            if (Array.isArray(data)) {\n                return ZodParsedType.array;\n            }\n            if (data === null) {\n                return ZodParsedType.null;\n            }\n            if (data.then &&\n                typeof data.then === \"function\" &&\n                data.catch &&\n                typeof data.catch === \"function\") {\n                return ZodParsedType.promise;\n            }\n            if (typeof Map !== \"undefined\" && data instanceof Map) {\n                return ZodParsedType.map;\n            }\n            if (typeof Set !== \"undefined\" && data instanceof Set) {\n                return ZodParsedType.set;\n            }\n            if (typeof Date !== \"undefined\" && data instanceof Date) {\n                return ZodParsedType.date;\n            }\n            return ZodParsedType.object;\n        default:\n            return ZodParsedType.unknown;\n    }\n};\n\nconst ZodIssueCode = util.arrayToEnum([\n    \"invalid_type\",\n    \"invalid_literal\",\n    \"custom\",\n    \"invalid_union\",\n    \"invalid_union_discriminator\",\n    \"invalid_enum_value\",\n    \"unrecognized_keys\",\n    \"invalid_arguments\",\n    \"invalid_return_type\",\n    \"invalid_date\",\n    \"invalid_string\",\n    \"too_small\",\n    \"too_big\",\n    \"invalid_intersection_types\",\n    \"not_multiple_of\",\n    \"not_finite\",\n]);\nconst quotelessJson = (obj) => {\n    const json = JSON.stringify(obj, null, 2);\n    return json.replace(/\"([^\"]+)\":/g, \"$1:\");\n};\nclass ZodError extends Error {\n    get errors() {\n        return this.issues;\n    }\n    constructor(issues) {\n        super();\n        this.issues = [];\n        this.addIssue = (sub) => {\n            this.issues = [...this.issues, sub];\n        };\n        this.addIssues = (subs = []) => {\n            this.issues = [...this.issues, ...subs];\n        };\n        const actualProto = new.target.prototype;\n        if (Object.setPrototypeOf) {\n            // eslint-disable-next-line ban/ban\n            Object.setPrototypeOf(this, actualProto);\n        }\n        else {\n            this.__proto__ = actualProto;\n        }\n        this.name = \"ZodError\";\n        this.issues = issues;\n    }\n    format(_mapper) {\n        const mapper = _mapper ||\n            function (issue) {\n                return issue.message;\n            };\n        const fieldErrors = { _errors: [] };\n        const processError = (error) => {\n            for (const issue of error.issues) {\n                if (issue.code === \"invalid_union\") {\n                    issue.unionErrors.map(processError);\n                }\n                else if (issue.code === \"invalid_return_type\") {\n                    processError(issue.returnTypeError);\n                }\n                else if (issue.code === \"invalid_arguments\") {\n                    processError(issue.argumentsError);\n                }\n                else if (issue.path.length === 0) {\n                    fieldErrors._errors.push(mapper(issue));\n                }\n                else {\n                    let curr = fieldErrors;\n                    let i = 0;\n                    while (i < issue.path.length) {\n                        const el = issue.path[i];\n                        const terminal = i === issue.path.length - 1;\n                        if (!terminal) {\n                            curr[el] = curr[el] || { _errors: [] };\n                            // if (typeof el === \"string\") {\n                            //   curr[el] = curr[el] || { _errors: [] };\n                            // } else if (typeof el === \"number\") {\n                            //   const errorArray: any = [];\n                            //   errorArray._errors = [];\n                            //   curr[el] = curr[el] || errorArray;\n                            // }\n                        }\n                        else {\n                            curr[el] = curr[el] || { _errors: [] };\n                            curr[el]._errors.push(mapper(issue));\n                        }\n                        curr = curr[el];\n                        i++;\n                    }\n                }\n            }\n        };\n        processError(this);\n        return fieldErrors;\n    }\n    static assert(value) {\n        if (!(value instanceof ZodError)) {\n            throw new Error(`Not a ZodError: ${value}`);\n        }\n    }\n    toString() {\n        return this.message;\n    }\n    get message() {\n        return JSON.stringify(this.issues, util.jsonStringifyReplacer, 2);\n    }\n    get isEmpty() {\n        return this.issues.length === 0;\n    }\n    flatten(mapper = (issue) => issue.message) {\n        const fieldErrors = {};\n        const formErrors = [];\n        for (const sub of this.issues) {\n            if (sub.path.length > 0) {\n                fieldErrors[sub.path[0]] = fieldErrors[sub.path[0]] || [];\n                fieldErrors[sub.path[0]].push(mapper(sub));\n            }\n            else {\n                formErrors.push(mapper(sub));\n            }\n        }\n        return { formErrors, fieldErrors };\n    }\n    get formErrors() {\n        return this.flatten();\n    }\n}\nZodError.create = (issues) => {\n    const error = new ZodError(issues);\n    return error;\n};\n\nconst errorMap = (issue, _ctx) => {\n    let message;\n    switch (issue.code) {\n        case ZodIssueCode.invalid_type:\n            if (issue.received === ZodParsedType.undefined) {\n                message = \"Required\";\n            }\n            else {\n                message = `Expected ${issue.expected}, received ${issue.received}`;\n            }\n            break;\n        case ZodIssueCode.invalid_literal:\n            message = `Invalid literal value, expected ${JSON.stringify(issue.expected, util.jsonStringifyReplacer)}`;\n            break;\n        case ZodIssueCode.unrecognized_keys:\n            message = `Unrecognized key(s) in object: ${util.joinValues(issue.keys, \", \")}`;\n            break;\n        case ZodIssueCode.invalid_union:\n            message = `Invalid input`;\n            break;\n        case ZodIssueCode.invalid_union_discriminator:\n            message = `Invalid discriminator value. Expected ${util.joinValues(issue.options)}`;\n            break;\n        case ZodIssueCode.invalid_enum_value:\n            message = `Invalid enum value. Expected ${util.joinValues(issue.options)}, received '${issue.received}'`;\n            break;\n        case ZodIssueCode.invalid_arguments:\n            message = `Invalid function arguments`;\n            break;\n        case ZodIssueCode.invalid_return_type:\n            message = `Invalid function return type`;\n            break;\n        case ZodIssueCode.invalid_date:\n            message = `Invalid date`;\n            break;\n        case ZodIssueCode.invalid_string:\n            if (typeof issue.validation === \"object\") {\n                if (\"includes\" in issue.validation) {\n                    message = `Invalid input: must include \"${issue.validation.includes}\"`;\n                    if (typeof issue.validation.position === \"number\") {\n                        message = `${message} at one or more positions greater than or equal to ${issue.validation.position}`;\n                    }\n                }\n                else if (\"startsWith\" in issue.validation) {\n                    message = `Invalid input: must start with \"${issue.validation.startsWith}\"`;\n                }\n                else if (\"endsWith\" in issue.validation) {\n                    message = `Invalid input: must end with \"${issue.validation.endsWith}\"`;\n                }\n                else {\n                    util.assertNever(issue.validation);\n                }\n            }\n            else if (issue.validation !== \"regex\") {\n                message = `Invalid ${issue.validation}`;\n            }\n            else {\n                message = \"Invalid\";\n            }\n            break;\n        case ZodIssueCode.too_small:\n            if (issue.type === \"array\")\n                message = `Array must contain ${issue.exact ? \"exactly\" : issue.inclusive ? `at least` : `more than`} ${issue.minimum} element(s)`;\n            else if (issue.type === \"string\")\n                message = `String must contain ${issue.exact ? \"exactly\" : issue.inclusive ? `at least` : `over`} ${issue.minimum} character(s)`;\n            else if (issue.type === \"number\")\n                message = `Number must be ${issue.exact\n                    ? `exactly equal to `\n                    : issue.inclusive\n                        ? `greater than or equal to `\n                        : `greater than `}${issue.minimum}`;\n            else if (issue.type === \"date\")\n                message = `Date must be ${issue.exact\n                    ? `exactly equal to `\n                    : issue.inclusive\n                        ? `greater than or equal to `\n                        : `greater than `}${new Date(Number(issue.minimum))}`;\n            else\n                message = \"Invalid input\";\n            break;\n        case ZodIssueCode.too_big:\n            if (issue.type === \"array\")\n                message = `Array must contain ${issue.exact ? `exactly` : issue.inclusive ? `at most` : `less than`} ${issue.maximum} element(s)`;\n            else if (issue.type === \"string\")\n                message = `String must contain ${issue.exact ? `exactly` : issue.inclusive ? `at most` : `under`} ${issue.maximum} character(s)`;\n            else if (issue.type === \"number\")\n                message = `Number must be ${issue.exact\n                    ? `exactly`\n                    : issue.inclusive\n                        ? `less than or equal to`\n                        : `less than`} ${issue.maximum}`;\n            else if (issue.type === \"bigint\")\n                message = `BigInt must be ${issue.exact\n                    ? `exactly`\n                    : issue.inclusive\n                        ? `less than or equal to`\n                        : `less than`} ${issue.maximum}`;\n            else if (issue.type === \"date\")\n                message = `Date must be ${issue.exact\n                    ? `exactly`\n                    : issue.inclusive\n                        ? `smaller than or equal to`\n                        : `smaller than`} ${new Date(Number(issue.maximum))}`;\n            else\n                message = \"Invalid input\";\n            break;\n        case ZodIssueCode.custom:\n            message = `Invalid input`;\n            break;\n        case ZodIssueCode.invalid_intersection_types:\n            message = `Intersection results could not be merged`;\n            break;\n        case ZodIssueCode.not_multiple_of:\n            message = `Number must be a multiple of ${issue.multipleOf}`;\n            break;\n        case ZodIssueCode.not_finite:\n            message = \"Number must be finite\";\n            break;\n        default:\n            message = _ctx.defaultError;\n            util.assertNever(issue);\n    }\n    return { message };\n};\n\nlet overrideErrorMap = errorMap;\nfunction setErrorMap(map) {\n    overrideErrorMap = map;\n}\nfunction getErrorMap() {\n    return overrideErrorMap;\n}\n\nconst makeIssue = (params) => {\n    const { data, path, errorMaps, issueData } = params;\n    const fullPath = [...path, ...(issueData.path || [])];\n    const fullIssue = {\n        ...issueData,\n        path: fullPath,\n    };\n    if (issueData.message !== undefined) {\n        return {\n            ...issueData,\n            path: fullPath,\n            message: issueData.message,\n        };\n    }\n    let errorMessage = \"\";\n    const maps = errorMaps\n        .filter((m) => !!m)\n        .slice()\n        .reverse();\n    for (const map of maps) {\n        errorMessage = map(fullIssue, { data, defaultError: errorMessage }).message;\n    }\n    return {\n        ...issueData,\n        path: fullPath,\n        message: errorMessage,\n    };\n};\nconst EMPTY_PATH = [];\nfunction addIssueToContext(ctx, issueData) {\n    const overrideMap = getErrorMap();\n    const issue = makeIssue({\n        issueData: issueData,\n        data: ctx.data,\n        path: ctx.path,\n        errorMaps: [\n            ctx.common.contextualErrorMap, // contextual error map is first priority\n            ctx.schemaErrorMap, // then schema-bound map if available\n            overrideMap, // then global override map\n            overrideMap === errorMap ? undefined : errorMap, // then global default map\n        ].filter((x) => !!x),\n    });\n    ctx.common.issues.push(issue);\n}\nclass ParseStatus {\n    constructor() {\n        this.value = \"valid\";\n    }\n    dirty() {\n        if (this.value === \"valid\")\n            this.value = \"dirty\";\n    }\n    abort() {\n        if (this.value !== \"aborted\")\n            this.value = \"aborted\";\n    }\n    static mergeArray(status, results) {\n        const arrayValue = [];\n        for (const s of results) {\n            if (s.status === \"aborted\")\n                return INVALID;\n            if (s.status === \"dirty\")\n                status.dirty();\n            arrayValue.push(s.value);\n        }\n        return { status: status.value, value: arrayValue };\n    }\n    static async mergeObjectAsync(status, pairs) {\n        const syncPairs = [];\n        for (const pair of pairs) {\n            const key = await pair.key;\n            const value = await pair.value;\n            syncPairs.push({\n                key,\n                value,\n            });\n        }\n        return ParseStatus.mergeObjectSync(status, syncPairs);\n    }\n    static mergeObjectSync(status, pairs) {\n        const finalObject = {};\n        for (const pair of pairs) {\n            const { key, value } = pair;\n            if (key.status === \"aborted\")\n                return INVALID;\n            if (value.status === \"aborted\")\n                return INVALID;\n            if (key.status === \"dirty\")\n                status.dirty();\n            if (value.status === \"dirty\")\n                status.dirty();\n            if (key.value !== \"__proto__\" &&\n                (typeof value.value !== \"undefined\" || pair.alwaysSet)) {\n                finalObject[key.value] = value.value;\n            }\n        }\n        return { status: status.value, value: finalObject };\n    }\n}\nconst INVALID = Object.freeze({\n    status: \"aborted\",\n});\nconst DIRTY = (value) => ({ status: \"dirty\", value });\nconst OK = (value) => ({ status: \"valid\", value });\nconst isAborted = (x) => x.status === \"aborted\";\nconst isDirty = (x) => x.status === \"dirty\";\nconst isValid = (x) => x.status === \"valid\";\nconst isAsync = (x) => typeof Promise !== \"undefined\" && x instanceof Promise;\n\n/******************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n\r\nfunction __classPrivateFieldGet(receiver, state, kind, f) {\r\n    if (typeof state === \"function\" ? receiver !== state || true : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\r\n    return state.get(receiver);\r\n}\r\n\r\nfunction __classPrivateFieldSet(receiver, state, value, kind, f) {\r\n    if (typeof state === \"function\" ? receiver !== state || true : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\r\n    return (state.set(receiver, value)), value;\r\n}\r\n\r\ntypeof SuppressedError === \"function\" ? SuppressedError : function (error, suppressed, message) {\r\n    var e = new Error(message);\r\n    return e.name = \"SuppressedError\", e.error = error, e.suppressed = suppressed, e;\r\n};\n\nvar errorUtil;\n(function (errorUtil) {\n    errorUtil.errToObj = (message) => typeof message === \"string\" ? { message } : message || {};\n    errorUtil.toString = (message) => typeof message === \"string\" ? message : message === null || message === void 0 ? void 0 : message.message;\n})(errorUtil || (errorUtil = {}));\n\nvar _ZodEnum_cache, _ZodNativeEnum_cache;\nclass ParseInputLazyPath {\n    constructor(parent, value, path, key) {\n        this._cachedPath = [];\n        this.parent = parent;\n        this.data = value;\n        this._path = path;\n        this._key = key;\n    }\n    get path() {\n        if (!this._cachedPath.length) {\n            if (this._key instanceof Array) {\n                this._cachedPath.push(...this._path, ...this._key);\n            }\n            else {\n                this._cachedPath.push(...this._path, this._key);\n            }\n        }\n        return this._cachedPath;\n    }\n}\nconst handleResult = (ctx, result) => {\n    if (isValid(result)) {\n        return { success: true, data: result.value };\n    }\n    else {\n        if (!ctx.common.issues.length) {\n            throw new Error(\"Validation failed but no issues detected.\");\n        }\n        return {\n            success: false,\n            get error() {\n                if (this._error)\n                    return this._error;\n                const error = new ZodError(ctx.common.issues);\n                this._error = error;\n                return this._error;\n            },\n        };\n    }\n};\nfunction processCreateParams(params) {\n    if (!params)\n        return {};\n    const { errorMap, invalid_type_error, required_error, description } = params;\n    if (errorMap && (invalid_type_error || required_error)) {\n        throw new Error(`Can't use \"invalid_type_error\" or \"required_error\" in conjunction with custom error map.`);\n    }\n    if (errorMap)\n        return { errorMap: errorMap, description };\n    const customMap = (iss, ctx) => {\n        var _a, _b;\n        const { message } = params;\n        if (iss.code === \"invalid_enum_value\") {\n            return { message: message !== null && message !== void 0 ? message : ctx.defaultError };\n        }\n        if (typeof ctx.data === \"undefined\") {\n            return { message: (_a = message !== null && message !== void 0 ? message : required_error) !== null && _a !== void 0 ? _a : ctx.defaultError };\n        }\n        if (iss.code !== \"invalid_type\")\n            return { message: ctx.defaultError };\n        return { message: (_b = message !== null && message !== void 0 ? message : invalid_type_error) !== null && _b !== void 0 ? _b : ctx.defaultError };\n    };\n    return { errorMap: customMap, description };\n}\nclass ZodType {\n    get description() {\n        return this._def.description;\n    }\n    _getType(input) {\n        return getParsedType(input.data);\n    }\n    _getOrReturnCtx(input, ctx) {\n        return (ctx || {\n            common: input.parent.common,\n            data: input.data,\n            parsedType: getParsedType(input.data),\n            schemaErrorMap: this._def.errorMap,\n            path: input.path,\n            parent: input.parent,\n        });\n    }\n    _processInputParams(input) {\n        return {\n            status: new ParseStatus(),\n            ctx: {\n                common: input.parent.common,\n                data: input.data,\n                parsedType: getParsedType(input.data),\n                schemaErrorMap: this._def.errorMap,\n                path: input.path,\n                parent: input.parent,\n            },\n        };\n    }\n    _parseSync(input) {\n        const result = this._parse(input);\n        if (isAsync(result)) {\n            throw new Error(\"Synchronous parse encountered promise.\");\n        }\n        return result;\n    }\n    _parseAsync(input) {\n        const result = this._parse(input);\n        return Promise.resolve(result);\n    }\n    parse(data, params) {\n        const result = this.safeParse(data, params);\n        if (result.success)\n            return result.data;\n        throw result.error;\n    }\n    safeParse(data, params) {\n        var _a;\n        const ctx = {\n            common: {\n                issues: [],\n                async: (_a = params === null || params === void 0 ? void 0 : params.async) !== null && _a !== void 0 ? _a : false,\n                contextualErrorMap: params === null || params === void 0 ? void 0 : params.errorMap,\n            },\n            path: (params === null || params === void 0 ? void 0 : params.path) || [],\n            schemaErrorMap: this._def.errorMap,\n            parent: null,\n            data,\n            parsedType: getParsedType(data),\n        };\n        const result = this._parseSync({ data, path: ctx.path, parent: ctx });\n        return handleResult(ctx, result);\n    }\n    \"~validate\"(data) {\n        var _a, _b;\n        const ctx = {\n            common: {\n                issues: [],\n                async: !!this[\"~standard\"].async,\n            },\n            path: [],\n            schemaErrorMap: this._def.errorMap,\n            parent: null,\n            data,\n            parsedType: getParsedType(data),\n        };\n        if (!this[\"~standard\"].async) {\n            try {\n                const result = this._parseSync({ data, path: [], parent: ctx });\n                return isValid(result)\n                    ? {\n                        value: result.value,\n                    }\n                    : {\n                        issues: ctx.common.issues,\n                    };\n            }\n            catch (err) {\n                if ((_b = (_a = err === null || err === void 0 ? void 0 : err.message) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === null || _b === void 0 ? void 0 : _b.includes(\"encountered\")) {\n                    this[\"~standard\"].async = true;\n                }\n                ctx.common = {\n                    issues: [],\n                    async: true,\n                };\n            }\n        }\n        return this._parseAsync({ data, path: [], parent: ctx }).then((result) => isValid(result)\n            ? {\n                value: result.value,\n            }\n            : {\n                issues: ctx.common.issues,\n            });\n    }\n    async parseAsync(data, params) {\n        const result = await this.safeParseAsync(data, params);\n        if (result.success)\n            return result.data;\n        throw result.error;\n    }\n    async safeParseAsync(data, params) {\n        const ctx = {\n            common: {\n                issues: [],\n                contextualErrorMap: params === null || params === void 0 ? void 0 : params.errorMap,\n                async: true,\n            },\n            path: (params === null || params === void 0 ? void 0 : params.path) || [],\n            schemaErrorMap: this._def.errorMap,\n            parent: null,\n            data,\n            parsedType: getParsedType(data),\n        };\n        const maybeAsyncResult = this._parse({ data, path: ctx.path, parent: ctx });\n        const result = await (isAsync(maybeAsyncResult)\n            ? maybeAsyncResult\n            : Promise.resolve(maybeAsyncResult));\n        return handleResult(ctx, result);\n    }\n    refine(check, message) {\n        const getIssueProperties = (val) => {\n            if (typeof message === \"string\" || typeof message === \"undefined\") {\n                return { message };\n            }\n            else if (typeof message === \"function\") {\n                return message(val);\n            }\n            else {\n                return message;\n            }\n        };\n        return this._refinement((val, ctx) => {\n            const result = check(val);\n            const setError = () => ctx.addIssue({\n                code: ZodIssueCode.custom,\n                ...getIssueProperties(val),\n            });\n            if (typeof Promise !== \"undefined\" && result instanceof Promise) {\n                return result.then((data) => {\n                    if (!data) {\n                        setError();\n                        return false;\n                    }\n                    else {\n                        return true;\n                    }\n                });\n            }\n            if (!result) {\n                setError();\n                return false;\n            }\n            else {\n                return true;\n            }\n        });\n    }\n    refinement(check, refinementData) {\n        return this._refinement((val, ctx) => {\n            if (!check(val)) {\n                ctx.addIssue(typeof refinementData === \"function\"\n                    ? refinementData(val, ctx)\n                    : refinementData);\n                return false;\n            }\n            else {\n                return true;\n            }\n        });\n    }\n    _refinement(refinement) {\n        return new ZodEffects({\n            schema: this,\n            typeName: ZodFirstPartyTypeKind.ZodEffects,\n            effect: { type: \"refinement\", refinement },\n        });\n    }\n    superRefine(refinement) {\n        return this._refinement(refinement);\n    }\n    constructor(def) {\n        /** Alias of safeParseAsync */\n        this.spa = this.safeParseAsync;\n        this._def = def;\n        this.parse = this.parse.bind(this);\n        this.safeParse = this.safeParse.bind(this);\n        this.parseAsync = this.parseAsync.bind(this);\n        this.safeParseAsync = this.safeParseAsync.bind(this);\n        this.spa = this.spa.bind(this);\n        this.refine = this.refine.bind(this);\n        this.refinement = this.refinement.bind(this);\n        this.superRefine = this.superRefine.bind(this);\n        this.optional = this.optional.bind(this);\n        this.nullable = this.nullable.bind(this);\n        this.nullish = this.nullish.bind(this);\n        this.array = this.array.bind(this);\n        this.promise = this.promise.bind(this);\n        this.or = this.or.bind(this);\n        this.and = this.and.bind(this);\n        this.transform = this.transform.bind(this);\n        this.brand = this.brand.bind(this);\n        this.default = this.default.bind(this);\n        this.catch = this.catch.bind(this);\n        this.describe = this.describe.bind(this);\n        this.pipe = this.pipe.bind(this);\n        this.readonly = this.readonly.bind(this);\n        this.isNullable = this.isNullable.bind(this);\n        this.isOptional = this.isOptional.bind(this);\n        this[\"~standard\"] = {\n            version: 1,\n            vendor: \"zod\",\n            validate: (data) => this[\"~validate\"](data),\n        };\n    }\n    optional() {\n        return ZodOptional.create(this, this._def);\n    }\n    nullable() {\n        return ZodNullable.create(this, this._def);\n    }\n    nullish() {\n        return this.nullable().optional();\n    }\n    array() {\n        return ZodArray.create(this);\n    }\n    promise() {\n        return ZodPromise.create(this, this._def);\n    }\n    or(option) {\n        return ZodUnion.create([this, option], this._def);\n    }\n    and(incoming) {\n        return ZodIntersection.create(this, incoming, this._def);\n    }\n    transform(transform) {\n        return new ZodEffects({\n            ...processCreateParams(this._def),\n            schema: this,\n            typeName: ZodFirstPartyTypeKind.ZodEffects,\n            effect: { type: \"transform\", transform },\n        });\n    }\n    default(def) {\n        const defaultValueFunc = typeof def === \"function\" ? def : () => def;\n        return new ZodDefault({\n            ...processCreateParams(this._def),\n            innerType: this,\n            defaultValue: defaultValueFunc,\n            typeName: ZodFirstPartyTypeKind.ZodDefault,\n        });\n    }\n    brand() {\n        return new ZodBranded({\n            typeName: ZodFirstPartyTypeKind.ZodBranded,\n            type: this,\n            ...processCreateParams(this._def),\n        });\n    }\n    catch(def) {\n        const catchValueFunc = typeof def === \"function\" ? def : () => def;\n        return new ZodCatch({\n            ...processCreateParams(this._def),\n            innerType: this,\n            catchValue: catchValueFunc,\n            typeName: ZodFirstPartyTypeKind.ZodCatch,\n        });\n    }\n    describe(description) {\n        const This = this.constructor;\n        return new This({\n            ...this._def,\n            description,\n        });\n    }\n    pipe(target) {\n        return ZodPipeline.create(this, target);\n    }\n    readonly() {\n        return ZodReadonly.create(this);\n    }\n    isOptional() {\n        return this.safeParse(undefined).success;\n    }\n    isNullable() {\n        return this.safeParse(null).success;\n    }\n}\nconst cuidRegex = /^c[^\\s-]{8,}$/i;\nconst cuid2Regex = /^[0-9a-z]+$/;\nconst ulidRegex = /^[0-9A-HJKMNP-TV-Z]{26}$/i;\n// const uuidRegex =\n//   /^([a-f0-9]{8}-[a-f0-9]{4}-[1-5][a-f0-9]{3}-[a-f0-9]{4}-[a-f0-9]{12}|00000000-0000-0000-0000-000000000000)$/i;\nconst uuidRegex = /^[0-9a-fA-F]{8}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{12}$/i;\nconst nanoidRegex = /^[a-z0-9_-]{21}$/i;\nconst jwtRegex = /^[A-Za-z0-9-_]+\\.[A-Za-z0-9-_]+\\.[A-Za-z0-9-_]*$/;\nconst durationRegex = /^[-+]?P(?!$)(?:(?:[-+]?\\d+Y)|(?:[-+]?\\d+[.,]\\d+Y$))?(?:(?:[-+]?\\d+M)|(?:[-+]?\\d+[.,]\\d+M$))?(?:(?:[-+]?\\d+W)|(?:[-+]?\\d+[.,]\\d+W$))?(?:(?:[-+]?\\d+D)|(?:[-+]?\\d+[.,]\\d+D$))?(?:T(?=[\\d+-])(?:(?:[-+]?\\d+H)|(?:[-+]?\\d+[.,]\\d+H$))?(?:(?:[-+]?\\d+M)|(?:[-+]?\\d+[.,]\\d+M$))?(?:[-+]?\\d+(?:[.,]\\d+)?S)?)??$/;\n// from https://stackoverflow.com/a/46181/1550155\n// old version: too slow, didn't support unicode\n// const emailRegex = /^((([a-z]|\\d|[!#\\$%&'\\*\\+\\-\\/=\\?\\^_`{\\|}~]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])+(\\.([a-z]|\\d|[!#\\$%&'\\*\\+\\-\\/=\\?\\^_`{\\|}~]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])+)*)|((\\x22)((((\\x20|\\x09)*(\\x0d\\x0a))?(\\x20|\\x09)+)?(([\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x7f]|\\x21|[\\x23-\\x5b]|[\\x5d-\\x7e]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(\\\\([\\x01-\\x09\\x0b\\x0c\\x0d-\\x7f]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]))))*(((\\x20|\\x09)*(\\x0d\\x0a))?(\\x20|\\x09)+)?(\\x22)))@((([a-z]|\\d|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(([a-z]|\\d|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])([a-z]|\\d|-|\\.|_|~|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])*([a-z]|\\d|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])))\\.)+(([a-z]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(([a-z]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])([a-z]|\\d|-|\\.|_|~|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])*([a-z]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])))$/i;\n//old email regex\n// const emailRegex = /^(([^<>()[\\].,;:\\s@\"]+(\\.[^<>()[\\].,;:\\s@\"]+)*)|(\".+\"))@((?!-)([^<>()[\\].,;:\\s@\"]+\\.)+[^<>()[\\].,;:\\s@\"]{1,})[^-<>()[\\].,;:\\s@\"]$/i;\n// eslint-disable-next-line\n// const emailRegex =\n//   /^(([^<>()[\\]\\\\.,;:\\s@\\\"]+(\\.[^<>()[\\]\\\\.,;:\\s@\\\"]+)*)|(\\\".+\\\"))@((\\[(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\\])|(\\[IPv6:(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))\\])|([A-Za-z0-9]([A-Za-z0-9-]*[A-Za-z0-9])*(\\.[A-Za-z]{2,})+))$/;\n// const emailRegex =\n//   /^[a-zA-Z0-9\\.\\!\\#\\$\\%\\&\\'\\*\\+\\/\\=\\?\\^\\_\\`\\{\\|\\}\\~\\-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/;\n// const emailRegex =\n//   /^(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|\"(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21\\x23-\\x5b\\x5d-\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])*\")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21-\\x5a\\x53-\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])+)\\])$/i;\nconst emailRegex = /^(?!\\.)(?!.*\\.\\.)([A-Z0-9_'+\\-\\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\\-]*\\.)+[A-Z]{2,}$/i;\n// const emailRegex =\n//   /^[a-z0-9.!#$%&’*+/=?^_`{|}~-]+@[a-z0-9-]+(?:\\.[a-z0-9\\-]+)*$/i;\n// from https://thekevinscott.com/emojis-in-javascript/#writing-a-regular-expression\nconst _emojiRegex = `^(\\\\p{Extended_Pictographic}|\\\\p{Emoji_Component})+$`;\nlet emojiRegex;\n// faster, simpler, safer\nconst ipv4Regex = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/;\nconst ipv4CidrRegex = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\\/(3[0-2]|[12]?[0-9])$/;\n// const ipv6Regex =\n// /^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/;\nconst ipv6Regex = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/;\nconst ipv6CidrRegex = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/;\n// https://stackoverflow.com/questions/7860392/determine-if-string-is-in-base64-using-javascript\nconst base64Regex = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/;\n// https://base64.guru/standards/base64url\nconst base64urlRegex = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/;\n// simple\n// const dateRegexSource = `\\\\d{4}-\\\\d{2}-\\\\d{2}`;\n// no leap year validation\n// const dateRegexSource = `\\\\d{4}-((0[13578]|10|12)-31|(0[13-9]|1[0-2])-30|(0[1-9]|1[0-2])-(0[1-9]|1\\\\d|2\\\\d))`;\n// with leap year validation\nconst dateRegexSource = `((\\\\d\\\\d[2468][048]|\\\\d\\\\d[13579][26]|\\\\d\\\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\\\d|30)|(02)-(0[1-9]|1\\\\d|2[0-8])))`;\nconst dateRegex = new RegExp(`^${dateRegexSource}$`);\nfunction timeRegexSource(args) {\n    // let regex = `\\\\d{2}:\\\\d{2}:\\\\d{2}`;\n    let regex = `([01]\\\\d|2[0-3]):[0-5]\\\\d:[0-5]\\\\d`;\n    if (args.precision) {\n        regex = `${regex}\\\\.\\\\d{${args.precision}}`;\n    }\n    else if (args.precision == null) {\n        regex = `${regex}(\\\\.\\\\d+)?`;\n    }\n    return regex;\n}\nfunction timeRegex(args) {\n    return new RegExp(`^${timeRegexSource(args)}$`);\n}\n// Adapted from https://stackoverflow.com/a/3143231\nfunction datetimeRegex(args) {\n    let regex = `${dateRegexSource}T${timeRegexSource(args)}`;\n    const opts = [];\n    opts.push(args.local ? `Z?` : `Z`);\n    if (args.offset)\n        opts.push(`([+-]\\\\d{2}:?\\\\d{2})`);\n    regex = `${regex}(${opts.join(\"|\")})`;\n    return new RegExp(`^${regex}$`);\n}\nfunction isValidIP(ip, version) {\n    if ((version === \"v4\" || !version) && ipv4Regex.test(ip)) {\n        return true;\n    }\n    if ((version === \"v6\" || !version) && ipv6Regex.test(ip)) {\n        return true;\n    }\n    return false;\n}\nfunction isValidJWT(jwt, alg) {\n    if (!jwtRegex.test(jwt))\n        return false;\n    try {\n        const [header] = jwt.split(\".\");\n        // Convert base64url to base64\n        const base64 = header\n            .replace(/-/g, \"+\")\n            .replace(/_/g, \"/\")\n            .padEnd(header.length + ((4 - (header.length % 4)) % 4), \"=\");\n        const decoded = JSON.parse(atob(base64));\n        if (typeof decoded !== \"object\" || decoded === null)\n            return false;\n        if (!decoded.typ || !decoded.alg)\n            return false;\n        if (alg && decoded.alg !== alg)\n            return false;\n        return true;\n    }\n    catch (_a) {\n        return false;\n    }\n}\nfunction isValidCidr(ip, version) {\n    if ((version === \"v4\" || !version) && ipv4CidrRegex.test(ip)) {\n        return true;\n    }\n    if ((version === \"v6\" || !version) && ipv6CidrRegex.test(ip)) {\n        return true;\n    }\n    return false;\n}\nclass ZodString extends ZodType {\n    _parse(input) {\n        if (this._def.coerce) {\n            input.data = String(input.data);\n        }\n        const parsedType = this._getType(input);\n        if (parsedType !== ZodParsedType.string) {\n            const ctx = this._getOrReturnCtx(input);\n            addIssueToContext(ctx, {\n                code: ZodIssueCode.invalid_type,\n                expected: ZodParsedType.string,\n                received: ctx.parsedType,\n            });\n            return INVALID;\n        }\n        const status = new ParseStatus();\n        let ctx = undefined;\n        for (const check of this._def.checks) {\n            if (check.kind === \"min\") {\n                if (input.data.length < check.value) {\n                    ctx = this._getOrReturnCtx(input, ctx);\n                    addIssueToContext(ctx, {\n                        code: ZodIssueCode.too_small,\n                        minimum: check.value,\n                        type: \"string\",\n                        inclusive: true,\n                        exact: false,\n                        message: check.message,\n                    });\n                    status.dirty();\n                }\n            }\n            else if (check.kind === \"max\") {\n                if (input.data.length > check.value) {\n                    ctx = this._getOrReturnCtx(input, ctx);\n                    addIssueToContext(ctx, {\n                        code: ZodIssueCode.too_big,\n                        maximum: check.value,\n                        type: \"string\",\n                        inclusive: true,\n                        exact: false,\n                        message: check.message,\n                    });\n                    status.dirty();\n                }\n            }\n            else if (check.kind === \"length\") {\n                const tooBig = input.data.length > check.value;\n                const tooSmall = input.data.length < check.value;\n                if (tooBig || tooSmall) {\n                    ctx = this._getOrReturnCtx(input, ctx);\n                    if (tooBig) {\n                        addIssueToContext(ctx, {\n                            code: ZodIssueCode.too_big,\n                            maximum: check.value,\n                            type: \"string\",\n                            inclusive: true,\n                            exact: true,\n                            message: check.message,\n                        });\n                    }\n                    else if (tooSmall) {\n                        addIssueToContext(ctx, {\n                            code: ZodIssueCode.too_small,\n                            minimum: check.value,\n                            type: \"string\",\n                            inclusive: true,\n                            exact: true,\n                            message: check.message,\n                        });\n                    }\n                    status.dirty();\n                }\n            }\n            else if (check.kind === \"email\") {\n                if (!emailRegex.test(input.data)) {\n                    ctx = this._getOrReturnCtx(input, ctx);\n                    addIssueToContext(ctx, {\n                        validation: \"email\",\n                        code: ZodIssueCode.invalid_string,\n                        message: check.message,\n                    });\n                    status.dirty();\n                }\n            }\n            else if (check.kind === \"emoji\") {\n                if (!emojiRegex) {\n                    emojiRegex = new RegExp(_emojiRegex, \"u\");\n                }\n                if (!emojiRegex.test(input.data)) {\n                    ctx = this._getOrReturnCtx(input, ctx);\n                    addIssueToContext(ctx, {\n                        validation: \"emoji\",\n                        code: ZodIssueCode.invalid_string,\n                        message: check.message,\n                    });\n                    status.dirty();\n                }\n            }\n            else if (check.kind === \"uuid\") {\n                if (!uuidRegex.test(input.data)) {\n                    ctx = this._getOrReturnCtx(input, ctx);\n                    addIssueToContext(ctx, {\n                        validation: \"uuid\",\n                        code: ZodIssueCode.invalid_string,\n                        message: check.message,\n                    });\n                    status.dirty();\n                }\n            }\n            else if (check.kind === \"nanoid\") {\n                if (!nanoidRegex.test(input.data)) {\n                    ctx = this._getOrReturnCtx(input, ctx);\n                    addIssueToContext(ctx, {\n                        validation: \"nanoid\",\n                        code: ZodIssueCode.invalid_string,\n                        message: check.message,\n                    });\n                    status.dirty();\n                }\n            }\n            else if (check.kind === \"cuid\") {\n                if (!cuidRegex.test(input.data)) {\n                    ctx = this._getOrReturnCtx(input, ctx);\n                    addIssueToContext(ctx, {\n                        validation: \"cuid\",\n                        code: ZodIssueCode.invalid_string,\n                        message: check.message,\n                    });\n                    status.dirty();\n                }\n            }\n            else if (check.kind === \"cuid2\") {\n                if (!cuid2Regex.test(input.data)) {\n                    ctx = this._getOrReturnCtx(input, ctx);\n                    addIssueToContext(ctx, {\n                        validation: \"cuid2\",\n                        code: ZodIssueCode.invalid_string,\n                        message: check.message,\n                    });\n                    status.dirty();\n                }\n            }\n            else if (check.kind === \"ulid\") {\n                if (!ulidRegex.test(input.data)) {\n                    ctx = this._getOrReturnCtx(input, ctx);\n                    addIssueToContext(ctx, {\n                        validation: \"ulid\",\n                        code: ZodIssueCode.invalid_string,\n                        message: check.message,\n                    });\n                    status.dirty();\n                }\n            }\n            else if (check.kind === \"url\") {\n                try {\n                    new URL(input.data);\n                }\n                catch (_a) {\n                    ctx = this._getOrReturnCtx(input, ctx);\n                    addIssueToContext(ctx, {\n                        validation: \"url\",\n                        code: ZodIssueCode.invalid_string,\n                        message: check.message,\n                    });\n                    status.dirty();\n                }\n            }\n            else if (check.kind === \"regex\") {\n                check.regex.lastIndex = 0;\n                const testResult = check.regex.test(input.data);\n                if (!testResult) {\n                    ctx = this._getOrReturnCtx(input, ctx);\n                    addIssueToContext(ctx, {\n                        validation: \"regex\",\n                        code: ZodIssueCode.invalid_string,\n                        message: check.message,\n                    });\n                    status.dirty();\n                }\n            }\n            else if (check.kind === \"trim\") {\n                input.data = input.data.trim();\n            }\n            else if (check.kind === \"includes\") {\n                if (!input.data.includes(check.value, check.position)) {\n                    ctx = this._getOrReturnCtx(input, ctx);\n                    addIssueToContext(ctx, {\n                        code: ZodIssueCode.invalid_string,\n                        validation: { includes: check.value, position: check.position },\n                        message: check.message,\n                    });\n                    status.dirty();\n                }\n            }\n            else if (check.kind === \"toLowerCase\") {\n                input.data = input.data.toLowerCase();\n            }\n            else if (check.kind === \"toUpperCase\") {\n                input.data = input.data.toUpperCase();\n            }\n            else if (check.kind === \"startsWith\") {\n                if (!input.data.startsWith(check.value)) {\n                    ctx = this._getOrReturnCtx(input, ctx);\n                    addIssueToContext(ctx, {\n                        code: ZodIssueCode.invalid_string,\n                        validation: { startsWith: check.value },\n                        message: check.message,\n                    });\n                    status.dirty();\n                }\n            }\n            else if (check.kind === \"endsWith\") {\n                if (!input.data.endsWith(check.value)) {\n                    ctx = this._getOrReturnCtx(input, ctx);\n                    addIssueToContext(ctx, {\n                        code: ZodIssueCode.invalid_string,\n                        validation: { endsWith: check.value },\n                        message: check.message,\n                    });\n                    status.dirty();\n                }\n            }\n            else if (check.kind === \"datetime\") {\n                const regex = datetimeRegex(check);\n                if (!regex.test(input.data)) {\n                    ctx = this._getOrReturnCtx(input, ctx);\n                    addIssueToContext(ctx, {\n                        code: ZodIssueCode.invalid_string,\n                        validation: \"datetime\",\n                        message: check.message,\n                    });\n                    status.dirty();\n                }\n            }\n            else if (check.kind === \"date\") {\n                const regex = dateRegex;\n                if (!regex.test(input.data)) {\n                    ctx = this._getOrReturnCtx(input, ctx);\n                    addIssueToContext(ctx, {\n                        code: ZodIssueCode.invalid_string,\n                        validation: \"date\",\n                        message: check.message,\n                    });\n                    status.dirty();\n                }\n            }\n            else if (check.kind === \"time\") {\n                const regex = timeRegex(check);\n                if (!regex.test(input.data)) {\n                    ctx = this._getOrReturnCtx(input, ctx);\n                    addIssueToContext(ctx, {\n                        code: ZodIssueCode.invalid_string,\n                        validation: \"time\",\n                        message: check.message,\n                    });\n                    status.dirty();\n                }\n            }\n            else if (check.kind === \"duration\") {\n                if (!durationRegex.test(input.data)) {\n                    ctx = this._getOrReturnCtx(input, ctx);\n                    addIssueToContext(ctx, {\n                        validation: \"duration\",\n                        code: ZodIssueCode.invalid_string,\n                        message: check.message,\n                    });\n                    status.dirty();\n                }\n            }\n            else if (check.kind === \"ip\") {\n                if (!isValidIP(input.data, check.version)) {\n                    ctx = this._getOrReturnCtx(input, ctx);\n                    addIssueToContext(ctx, {\n                        validation: \"ip\",\n                        code: ZodIssueCode.invalid_string,\n                        message: check.message,\n                    });\n                    status.dirty();\n                }\n            }\n            else if (check.kind === \"jwt\") {\n                if (!isValidJWT(input.data, check.alg)) {\n                    ctx = this._getOrReturnCtx(input, ctx);\n                    addIssueToContext(ctx, {\n                        validation: \"jwt\",\n                        code: ZodIssueCode.invalid_string,\n                        message: check.message,\n                    });\n                    status.dirty();\n                }\n            }\n            else if (check.kind === \"cidr\") {\n                if (!isValidCidr(input.data, check.version)) {\n                    ctx = this._getOrReturnCtx(input, ctx);\n                    addIssueToContext(ctx, {\n                        validation: \"cidr\",\n                        code: ZodIssueCode.invalid_string,\n                        message: check.message,\n                    });\n                    status.dirty();\n                }\n            }\n            else if (check.kind === \"base64\") {\n                if (!base64Regex.test(input.data)) {\n                    ctx = this._getOrReturnCtx(input, ctx);\n                    addIssueToContext(ctx, {\n                        validation: \"base64\",\n                        code: ZodIssueCode.invalid_string,\n                        message: check.message,\n                    });\n                    status.dirty();\n                }\n            }\n            else if (check.kind === \"base64url\") {\n                if (!base64urlRegex.test(input.data)) {\n                    ctx = this._getOrReturnCtx(input, ctx);\n                    addIssueToContext(ctx, {\n                        validation: \"base64url\",\n                        code: ZodIssueCode.invalid_string,\n                        message: check.message,\n                    });\n                    status.dirty();\n                }\n            }\n            else {\n                util.assertNever(check);\n            }\n        }\n        return { status: status.value, value: input.data };\n    }\n    _regex(regex, validation, message) {\n        return this.refinement((data) => regex.test(data), {\n            validation,\n            code: ZodIssueCode.invalid_string,\n            ...errorUtil.errToObj(message),\n        });\n    }\n    _addCheck(check) {\n        return new ZodString({\n            ...this._def,\n            checks: [...this._def.checks, check],\n        });\n    }\n    email(message) {\n        return this._addCheck({ kind: \"email\", ...errorUtil.errToObj(message) });\n    }\n    url(message) {\n        return this._addCheck({ kind: \"url\", ...errorUtil.errToObj(message) });\n    }\n    emoji(message) {\n        return this._addCheck({ kind: \"emoji\", ...errorUtil.errToObj(message) });\n    }\n    uuid(message) {\n        return this._addCheck({ kind: \"uuid\", ...errorUtil.errToObj(message) });\n    }\n    nanoid(message) {\n        return this._addCheck({ kind: \"nanoid\", ...errorUtil.errToObj(message) });\n    }\n    cuid(message) {\n        return this._addCheck({ kind: \"cuid\", ...errorUtil.errToObj(message) });\n    }\n    cuid2(message) {\n        return this._addCheck({ kind: \"cuid2\", ...errorUtil.errToObj(message) });\n    }\n    ulid(message) {\n        return this._addCheck({ kind: \"ulid\", ...errorUtil.errToObj(message) });\n    }\n    base64(message) {\n        return this._addCheck({ kind: \"base64\", ...errorUtil.errToObj(message) });\n    }\n    base64url(message) {\n        // base64url encoding is a modification of base64 that can safely be used in URLs and filenames\n        return this._addCheck({\n            kind: \"base64url\",\n            ...errorUtil.errToObj(message),\n        });\n    }\n    jwt(options) {\n        return this._addCheck({ kind: \"jwt\", ...errorUtil.errToObj(options) });\n    }\n    ip(options) {\n        return this._addCheck({ kind: \"ip\", ...errorUtil.errToObj(options) });\n    }\n    cidr(options) {\n        return this._addCheck({ kind: \"cidr\", ...errorUtil.errToObj(options) });\n    }\n    datetime(options) {\n        var _a, _b;\n        if (typeof options === \"string\") {\n            return this._addCheck({\n                kind: \"datetime\",\n                precision: null,\n                offset: false,\n                local: false,\n                message: options,\n            });\n        }\n        return this._addCheck({\n            kind: \"datetime\",\n            precision: typeof (options === null || options === void 0 ? void 0 : options.precision) === \"undefined\" ? null : options === null || options === void 0 ? void 0 : options.precision,\n            offset: (_a = options === null || options === void 0 ? void 0 : options.offset) !== null && _a !== void 0 ? _a : false,\n            local: (_b = options === null || options === void 0 ? void 0 : options.local) !== null && _b !== void 0 ? _b : false,\n            ...errorUtil.errToObj(options === null || options === void 0 ? void 0 : options.message),\n        });\n    }\n    date(message) {\n        return this._addCheck({ kind: \"date\", message });\n    }\n    time(options) {\n        if (typeof options === \"string\") {\n            return this._addCheck({\n                kind: \"time\",\n                precision: null,\n                message: options,\n            });\n        }\n        return this._addCheck({\n            kind: \"time\",\n            precision: typeof (options === null || options === void 0 ? void 0 : options.precision) === \"undefined\" ? null : options === null || options === void 0 ? void 0 : options.precision,\n            ...errorUtil.errToObj(options === null || options === void 0 ? void 0 : options.message),\n        });\n    }\n    duration(message) {\n        return this._addCheck({ kind: \"duration\", ...errorUtil.errToObj(message) });\n    }\n    regex(regex, message) {\n        return this._addCheck({\n            kind: \"regex\",\n            regex: regex,\n            ...errorUtil.errToObj(message),\n        });\n    }\n    includes(value, options) {\n        return this._addCheck({\n            kind: \"includes\",\n            value: value,\n            position: options === null || options === void 0 ? void 0 : options.position,\n            ...errorUtil.errToObj(options === null || options === void 0 ? void 0 : options.message),\n        });\n    }\n    startsWith(value, message) {\n        return this._addCheck({\n            kind: \"startsWith\",\n            value: value,\n            ...errorUtil.errToObj(message),\n        });\n    }\n    endsWith(value, message) {\n        return this._addCheck({\n            kind: \"endsWith\",\n            value: value,\n            ...errorUtil.errToObj(message),\n        });\n    }\n    min(minLength, message) {\n        return this._addCheck({\n            kind: \"min\",\n            value: minLength,\n            ...errorUtil.errToObj(message),\n        });\n    }\n    max(maxLength, message) {\n        return this._addCheck({\n            kind: \"max\",\n            value: maxLength,\n            ...errorUtil.errToObj(message),\n        });\n    }\n    length(len, message) {\n        return this._addCheck({\n            kind: \"length\",\n            value: len,\n            ...errorUtil.errToObj(message),\n        });\n    }\n    /**\n     * Equivalent to `.min(1)`\n     */\n    nonempty(message) {\n        return this.min(1, errorUtil.errToObj(message));\n    }\n    trim() {\n        return new ZodString({\n            ...this._def,\n            checks: [...this._def.checks, { kind: \"trim\" }],\n        });\n    }\n    toLowerCase() {\n        return new ZodString({\n            ...this._def,\n            checks: [...this._def.checks, { kind: \"toLowerCase\" }],\n        });\n    }\n    toUpperCase() {\n        return new ZodString({\n            ...this._def,\n            checks: [...this._def.checks, { kind: \"toUpperCase\" }],\n        });\n    }\n    get isDatetime() {\n        return !!this._def.checks.find((ch) => ch.kind === \"datetime\");\n    }\n    get isDate() {\n        return !!this._def.checks.find((ch) => ch.kind === \"date\");\n    }\n    get isTime() {\n        return !!this._def.checks.find((ch) => ch.kind === \"time\");\n    }\n    get isDuration() {\n        return !!this._def.checks.find((ch) => ch.kind === \"duration\");\n    }\n    get isEmail() {\n        return !!this._def.checks.find((ch) => ch.kind === \"email\");\n    }\n    get isURL() {\n        return !!this._def.checks.find((ch) => ch.kind === \"url\");\n    }\n    get isEmoji() {\n        return !!this._def.checks.find((ch) => ch.kind === \"emoji\");\n    }\n    get isUUID() {\n        return !!this._def.checks.find((ch) => ch.kind === \"uuid\");\n    }\n    get isNANOID() {\n        return !!this._def.checks.find((ch) => ch.kind === \"nanoid\");\n    }\n    get isCUID() {\n        return !!this._def.checks.find((ch) => ch.kind === \"cuid\");\n    }\n    get isCUID2() {\n        return !!this._def.checks.find((ch) => ch.kind === \"cuid2\");\n    }\n    get isULID() {\n        return !!this._def.checks.find((ch) => ch.kind === \"ulid\");\n    }\n    get isIP() {\n        return !!this._def.checks.find((ch) => ch.kind === \"ip\");\n    }\n    get isCIDR() {\n        return !!this._def.checks.find((ch) => ch.kind === \"cidr\");\n    }\n    get isBase64() {\n        return !!this._def.checks.find((ch) => ch.kind === \"base64\");\n    }\n    get isBase64url() {\n        // base64url encoding is a modification of base64 that can safely be used in URLs and filenames\n        return !!this._def.checks.find((ch) => ch.kind === \"base64url\");\n    }\n    get minLength() {\n        let min = null;\n        for (const ch of this._def.checks) {\n            if (ch.kind === \"min\") {\n                if (min === null || ch.value > min)\n                    min = ch.value;\n            }\n        }\n        return min;\n    }\n    get maxLength() {\n        let max = null;\n        for (const ch of this._def.checks) {\n            if (ch.kind === \"max\") {\n                if (max === null || ch.value < max)\n                    max = ch.value;\n            }\n        }\n        return max;\n    }\n}\nZodString.create = (params) => {\n    var _a;\n    return new ZodString({\n        checks: [],\n        typeName: ZodFirstPartyTypeKind.ZodString,\n        coerce: (_a = params === null || params === void 0 ? void 0 : params.coerce) !== null && _a !== void 0 ? _a : false,\n        ...processCreateParams(params),\n    });\n};\n// https://stackoverflow.com/questions/3966484/why-does-modulus-operator-return-fractional-number-in-javascript/31711034#31711034\nfunction floatSafeRemainder(val, step) {\n    const valDecCount = (val.toString().split(\".\")[1] || \"\").length;\n    const stepDecCount = (step.toString().split(\".\")[1] || \"\").length;\n    const decCount = valDecCount > stepDecCount ? valDecCount : stepDecCount;\n    const valInt = parseInt(val.toFixed(decCount).replace(\".\", \"\"));\n    const stepInt = parseInt(step.toFixed(decCount).replace(\".\", \"\"));\n    return (valInt % stepInt) / Math.pow(10, decCount);\n}\nclass ZodNumber extends ZodType {\n    constructor() {\n        super(...arguments);\n        this.min = this.gte;\n        this.max = this.lte;\n        this.step = this.multipleOf;\n    }\n    _parse(input) {\n        if (this._def.coerce) {\n            input.data = Number(input.data);\n        }\n        const parsedType = this._getType(input);\n        if (parsedType !== ZodParsedType.number) {\n            const ctx = this._getOrReturnCtx(input);\n            addIssueToContext(ctx, {\n                code: ZodIssueCode.invalid_type,\n                expected: ZodParsedType.number,\n                received: ctx.parsedType,\n            });\n            return INVALID;\n        }\n        let ctx = undefined;\n        const status = new ParseStatus();\n        for (const check of this._def.checks) {\n            if (check.kind === \"int\") {\n                if (!util.isInteger(input.data)) {\n                    ctx = this._getOrReturnCtx(input, ctx);\n                    addIssueToContext(ctx, {\n                        code: ZodIssueCode.invalid_type,\n                        expected: \"integer\",\n                        received: \"float\",\n                        message: check.message,\n                    });\n                    status.dirty();\n                }\n            }\n            else if (check.kind === \"min\") {\n                const tooSmall = check.inclusive\n                    ? input.data < check.value\n                    : input.data <= check.value;\n                if (tooSmall) {\n                    ctx = this._getOrReturnCtx(input, ctx);\n                    addIssueToContext(ctx, {\n                        code: ZodIssueCode.too_small,\n                        minimum: check.value,\n                        type: \"number\",\n                        inclusive: check.inclusive,\n                        exact: false,\n                        message: check.message,\n                    });\n                    status.dirty();\n                }\n            }\n            else if (check.kind === \"max\") {\n                const tooBig = check.inclusive\n                    ? input.data > check.value\n                    : input.data >= check.value;\n                if (tooBig) {\n                    ctx = this._getOrReturnCtx(input, ctx);\n                    addIssueToContext(ctx, {\n                        code: ZodIssueCode.too_big,\n                        maximum: check.value,\n                        type: \"number\",\n                        inclusive: check.inclusive,\n                        exact: false,\n                        message: check.message,\n                    });\n                    status.dirty();\n                }\n            }\n            else if (check.kind === \"multipleOf\") {\n                if (floatSafeRemainder(input.data, check.value) !== 0) {\n                    ctx = this._getOrReturnCtx(input, ctx);\n                    addIssueToContext(ctx, {\n                        code: ZodIssueCode.not_multiple_of,\n                        multipleOf: check.value,\n                        message: check.message,\n                    });\n                    status.dirty();\n                }\n            }\n            else if (check.kind === \"finite\") {\n                if (!Number.isFinite(input.data)) {\n                    ctx = this._getOrReturnCtx(input, ctx);\n                    addIssueToContext(ctx, {\n                        code: ZodIssueCode.not_finite,\n                        message: check.message,\n                    });\n                    status.dirty();\n                }\n            }\n            else {\n                util.assertNever(check);\n            }\n        }\n        return { status: status.value, value: input.data };\n    }\n    gte(value, message) {\n        return this.setLimit(\"min\", value, true, errorUtil.toString(message));\n    }\n    gt(value, message) {\n        return this.setLimit(\"min\", value, false, errorUtil.toString(message));\n    }\n    lte(value, message) {\n        return this.setLimit(\"max\", value, true, errorUtil.toString(message));\n    }\n    lt(value, message) {\n        return this.setLimit(\"max\", value, false, errorUtil.toString(message));\n    }\n    setLimit(kind, value, inclusive, message) {\n        return new ZodNumber({\n            ...this._def,\n            checks: [\n                ...this._def.checks,\n                {\n                    kind,\n                    value,\n                    inclusive,\n                    message: errorUtil.toString(message),\n                },\n            ],\n        });\n    }\n    _addCheck(check) {\n        return new ZodNumber({\n            ...this._def,\n            checks: [...this._def.checks, check],\n        });\n    }\n    int(message) {\n        return this._addCheck({\n            kind: \"int\",\n            message: errorUtil.toString(message),\n        });\n    }\n    positive(message) {\n        return this._addCheck({\n            kind: \"min\",\n            value: 0,\n            inclusive: false,\n            message: errorUtil.toString(message),\n        });\n    }\n    negative(message) {\n        return this._addCheck({\n            kind: \"max\",\n            value: 0,\n            inclusive: false,\n            message: errorUtil.toString(message),\n        });\n    }\n    nonpositive(message) {\n        return this._addCheck({\n            kind: \"max\",\n            value: 0,\n            inclusive: true,\n            message: errorUtil.toString(message),\n        });\n    }\n    nonnegative(message) {\n        return this._addCheck({\n            kind: \"min\",\n            value: 0,\n            inclusive: true,\n            message: errorUtil.toString(message),\n        });\n    }\n    multipleOf(value, message) {\n        return this._addCheck({\n            kind: \"multipleOf\",\n            value: value,\n            message: errorUtil.toString(message),\n        });\n    }\n    finite(message) {\n        return this._addCheck({\n            kind: \"finite\",\n            message: errorUtil.toString(message),\n        });\n    }\n    safe(message) {\n        return this._addCheck({\n            kind: \"min\",\n            inclusive: true,\n            value: Number.MIN_SAFE_INTEGER,\n            message: errorUtil.toString(message),\n        })._addCheck({\n            kind: \"max\",\n            inclusive: true,\n            value: Number.MAX_SAFE_INTEGER,\n            message: errorUtil.toString(message),\n        });\n    }\n    get minValue() {\n        let min = null;\n        for (const ch of this._def.checks) {\n            if (ch.kind === \"min\") {\n                if (min === null || ch.value > min)\n                    min = ch.value;\n            }\n        }\n        return min;\n    }\n    get maxValue() {\n        let max = null;\n        for (const ch of this._def.checks) {\n            if (ch.kind === \"max\") {\n                if (max === null || ch.value < max)\n                    max = ch.value;\n            }\n        }\n        return max;\n    }\n    get isInt() {\n        return !!this._def.checks.find((ch) => ch.kind === \"int\" ||\n            (ch.kind === \"multipleOf\" && util.isInteger(ch.value)));\n    }\n    get isFinite() {\n        let max = null, min = null;\n        for (const ch of this._def.checks) {\n            if (ch.kind === \"finite\" ||\n                ch.kind === \"int\" ||\n                ch.kind === \"multipleOf\") {\n                return true;\n            }\n            else if (ch.kind === \"min\") {\n                if (min === null || ch.value > min)\n                    min = ch.value;\n            }\n            else if (ch.kind === \"max\") {\n                if (max === null || ch.value < max)\n                    max = ch.value;\n            }\n        }\n        return Number.isFinite(min) && Number.isFinite(max);\n    }\n}\nZodNumber.create = (params) => {\n    return new ZodNumber({\n        checks: [],\n        typeName: ZodFirstPartyTypeKind.ZodNumber,\n        coerce: (params === null || params === void 0 ? void 0 : params.coerce) || false,\n        ...processCreateParams(params),\n    });\n};\nclass ZodBigInt extends ZodType {\n    constructor() {\n        super(...arguments);\n        this.min = this.gte;\n        this.max = this.lte;\n    }\n    _parse(input) {\n        if (this._def.coerce) {\n            try {\n                input.data = BigInt(input.data);\n            }\n            catch (_a) {\n                return this._getInvalidInput(input);\n            }\n        }\n        const parsedType = this._getType(input);\n        if (parsedType !== ZodParsedType.bigint) {\n            return this._getInvalidInput(input);\n        }\n        let ctx = undefined;\n        const status = new ParseStatus();\n        for (const check of this._def.checks) {\n            if (check.kind === \"min\") {\n                const tooSmall = check.inclusive\n                    ? input.data < check.value\n                    : input.data <= check.value;\n                if (tooSmall) {\n                    ctx = this._getOrReturnCtx(input, ctx);\n                    addIssueToContext(ctx, {\n                        code: ZodIssueCode.too_small,\n                        type: \"bigint\",\n                        minimum: check.value,\n                        inclusive: check.inclusive,\n                        message: check.message,\n                    });\n                    status.dirty();\n                }\n            }\n            else if (check.kind === \"max\") {\n                const tooBig = check.inclusive\n                    ? input.data > check.value\n                    : input.data >= check.value;\n                if (tooBig) {\n                    ctx = this._getOrReturnCtx(input, ctx);\n                    addIssueToContext(ctx, {\n                        code: ZodIssueCode.too_big,\n                        type: \"bigint\",\n                        maximum: check.value,\n                        inclusive: check.inclusive,\n                        message: check.message,\n                    });\n                    status.dirty();\n                }\n            }\n            else if (check.kind === \"multipleOf\") {\n                if (input.data % check.value !== BigInt(0)) {\n                    ctx = this._getOrReturnCtx(input, ctx);\n                    addIssueToContext(ctx, {\n                        code: ZodIssueCode.not_multiple_of,\n                        multipleOf: check.value,\n                        message: check.message,\n                    });\n                    status.dirty();\n                }\n            }\n            else {\n                util.assertNever(check);\n            }\n        }\n        return { status: status.value, value: input.data };\n    }\n    _getInvalidInput(input) {\n        const ctx = this._getOrReturnCtx(input);\n        addIssueToContext(ctx, {\n            code: ZodIssueCode.invalid_type,\n            expected: ZodParsedType.bigint,\n            received: ctx.parsedType,\n        });\n        return INVALID;\n    }\n    gte(value, message) {\n        return this.setLimit(\"min\", value, true, errorUtil.toString(message));\n    }\n    gt(value, message) {\n        return this.setLimit(\"min\", value, false, errorUtil.toString(message));\n    }\n    lte(value, message) {\n        return this.setLimit(\"max\", value, true, errorUtil.toString(message));\n    }\n    lt(value, message) {\n        return this.setLimit(\"max\", value, false, errorUtil.toString(message));\n    }\n    setLimit(kind, value, inclusive, message) {\n        return new ZodBigInt({\n            ...this._def,\n            checks: [\n                ...this._def.checks,\n                {\n                    kind,\n                    value,\n                    inclusive,\n                    message: errorUtil.toString(message),\n                },\n            ],\n        });\n    }\n    _addCheck(check) {\n        return new ZodBigInt({\n            ...this._def,\n            checks: [...this._def.checks, check],\n        });\n    }\n    positive(message) {\n        return this._addCheck({\n            kind: \"min\",\n            value: BigInt(0),\n            inclusive: false,\n            message: errorUtil.toString(message),\n        });\n    }\n    negative(message) {\n        return this._addCheck({\n            kind: \"max\",\n            value: BigInt(0),\n            inclusive: false,\n            message: errorUtil.toString(message),\n        });\n    }\n    nonpositive(message) {\n        return this._addCheck({\n            kind: \"max\",\n            value: BigInt(0),\n            inclusive: true,\n            message: errorUtil.toString(message),\n        });\n    }\n    nonnegative(message) {\n        return this._addCheck({\n            kind: \"min\",\n            value: BigInt(0),\n            inclusive: true,\n            message: errorUtil.toString(message),\n        });\n    }\n    multipleOf(value, message) {\n        return this._addCheck({\n            kind: \"multipleOf\",\n            value,\n            message: errorUtil.toString(message),\n        });\n    }\n    get minValue() {\n        let min = null;\n        for (const ch of this._def.checks) {\n            if (ch.kind === \"min\") {\n                if (min === null || ch.value > min)\n                    min = ch.value;\n            }\n        }\n        return min;\n    }\n    get maxValue() {\n        let max = null;\n        for (const ch of this._def.checks) {\n            if (ch.kind === \"max\") {\n                if (max === null || ch.value < max)\n                    max = ch.value;\n            }\n        }\n        return max;\n    }\n}\nZodBigInt.create = (params) => {\n    var _a;\n    return new ZodBigInt({\n        checks: [],\n        typeName: ZodFirstPartyTypeKind.ZodBigInt,\n        coerce: (_a = params === null || params === void 0 ? void 0 : params.coerce) !== null && _a !== void 0 ? _a : false,\n        ...processCreateParams(params),\n    });\n};\nclass ZodBoolean extends ZodType {\n    _parse(input) {\n        if (this._def.coerce) {\n            input.data = Boolean(input.data);\n        }\n        const parsedType = this._getType(input);\n        if (parsedType !== ZodParsedType.boolean) {\n            const ctx = this._getOrReturnCtx(input);\n            addIssueToContext(ctx, {\n                code: ZodIssueCode.invalid_type,\n                expected: ZodParsedType.boolean,\n                received: ctx.parsedType,\n            });\n            return INVALID;\n        }\n        return OK(input.data);\n    }\n}\nZodBoolean.create = (params) => {\n    return new ZodBoolean({\n        typeName: ZodFirstPartyTypeKind.ZodBoolean,\n        coerce: (params === null || params === void 0 ? void 0 : params.coerce) || false,\n        ...processCreateParams(params),\n    });\n};\nclass ZodDate extends ZodType {\n    _parse(input) {\n        if (this._def.coerce) {\n            input.data = new Date(input.data);\n        }\n        const parsedType = this._getType(input);\n        if (parsedType !== ZodParsedType.date) {\n            const ctx = this._getOrReturnCtx(input);\n            addIssueToContext(ctx, {\n                code: ZodIssueCode.invalid_type,\n                expected: ZodParsedType.date,\n                received: ctx.parsedType,\n            });\n            return INVALID;\n        }\n        if (isNaN(input.data.getTime())) {\n            const ctx = this._getOrReturnCtx(input);\n            addIssueToContext(ctx, {\n                code: ZodIssueCode.invalid_date,\n            });\n            return INVALID;\n        }\n        const status = new ParseStatus();\n        let ctx = undefined;\n        for (const check of this._def.checks) {\n            if (check.kind === \"min\") {\n                if (input.data.getTime() < check.value) {\n                    ctx = this._getOrReturnCtx(input, ctx);\n                    addIssueToContext(ctx, {\n                        code: ZodIssueCode.too_small,\n                        message: check.message,\n                        inclusive: true,\n                        exact: false,\n                        minimum: check.value,\n                        type: \"date\",\n                    });\n                    status.dirty();\n                }\n            }\n            else if (check.kind === \"max\") {\n                if (input.data.getTime() > check.value) {\n                    ctx = this._getOrReturnCtx(input, ctx);\n                    addIssueToContext(ctx, {\n                        code: ZodIssueCode.too_big,\n                        message: check.message,\n                        inclusive: true,\n                        exact: false,\n                        maximum: check.value,\n                        type: \"date\",\n                    });\n                    status.dirty();\n                }\n            }\n            else {\n                util.assertNever(check);\n            }\n        }\n        return {\n            status: status.value,\n            value: new Date(input.data.getTime()),\n        };\n    }\n    _addCheck(check) {\n        return new ZodDate({\n            ...this._def,\n            checks: [...this._def.checks, check],\n        });\n    }\n    min(minDate, message) {\n        return this._addCheck({\n            kind: \"min\",\n            value: minDate.getTime(),\n            message: errorUtil.toString(message),\n        });\n    }\n    max(maxDate, message) {\n        return this._addCheck({\n            kind: \"max\",\n            value: maxDate.getTime(),\n            message: errorUtil.toString(message),\n        });\n    }\n    get minDate() {\n        let min = null;\n        for (const ch of this._def.checks) {\n            if (ch.kind === \"min\") {\n                if (min === null || ch.value > min)\n                    min = ch.value;\n            }\n        }\n        return min != null ? new Date(min) : null;\n    }\n    get maxDate() {\n        let max = null;\n        for (const ch of this._def.checks) {\n            if (ch.kind === \"max\") {\n                if (max === null || ch.value < max)\n                    max = ch.value;\n            }\n        }\n        return max != null ? new Date(max) : null;\n    }\n}\nZodDate.create = (params) => {\n    return new ZodDate({\n        checks: [],\n        coerce: (params === null || params === void 0 ? void 0 : params.coerce) || false,\n        typeName: ZodFirstPartyTypeKind.ZodDate,\n        ...processCreateParams(params),\n    });\n};\nclass ZodSymbol extends ZodType {\n    _parse(input) {\n        const parsedType = this._getType(input);\n        if (parsedType !== ZodParsedType.symbol) {\n            const ctx = this._getOrReturnCtx(input);\n            addIssueToContext(ctx, {\n                code: ZodIssueCode.invalid_type,\n                expected: ZodParsedType.symbol,\n                received: ctx.parsedType,\n            });\n            return INVALID;\n        }\n        return OK(input.data);\n    }\n}\nZodSymbol.create = (params) => {\n    return new ZodSymbol({\n        typeName: ZodFirstPartyTypeKind.ZodSymbol,\n        ...processCreateParams(params),\n    });\n};\nclass ZodUndefined extends ZodType {\n    _parse(input) {\n        const parsedType = this._getType(input);\n        if (parsedType !== ZodParsedType.undefined) {\n            const ctx = this._getOrReturnCtx(input);\n            addIssueToContext(ctx, {\n                code: ZodIssueCode.invalid_type,\n                expected: ZodParsedType.undefined,\n                received: ctx.parsedType,\n            });\n            return INVALID;\n        }\n        return OK(input.data);\n    }\n}\nZodUndefined.create = (params) => {\n    return new ZodUndefined({\n        typeName: ZodFirstPartyTypeKind.ZodUndefined,\n        ...processCreateParams(params),\n    });\n};\nclass ZodNull extends ZodType {\n    _parse(input) {\n        const parsedType = this._getType(input);\n        if (parsedType !== ZodParsedType.null) {\n            const ctx = this._getOrReturnCtx(input);\n            addIssueToContext(ctx, {\n                code: ZodIssueCode.invalid_type,\n                expected: ZodParsedType.null,\n                received: ctx.parsedType,\n            });\n            return INVALID;\n        }\n        return OK(input.data);\n    }\n}\nZodNull.create = (params) => {\n    return new ZodNull({\n        typeName: ZodFirstPartyTypeKind.ZodNull,\n        ...processCreateParams(params),\n    });\n};\nclass ZodAny extends ZodType {\n    constructor() {\n        super(...arguments);\n        // to prevent instances of other classes from extending ZodAny. this causes issues with catchall in ZodObject.\n        this._any = true;\n    }\n    _parse(input) {\n        return OK(input.data);\n    }\n}\nZodAny.create = (params) => {\n    return new ZodAny({\n        typeName: ZodFirstPartyTypeKind.ZodAny,\n        ...processCreateParams(params),\n    });\n};\nclass ZodUnknown extends ZodType {\n    constructor() {\n        super(...arguments);\n        // required\n        this._unknown = true;\n    }\n    _parse(input) {\n        return OK(input.data);\n    }\n}\nZodUnknown.create = (params) => {\n    return new ZodUnknown({\n        typeName: ZodFirstPartyTypeKind.ZodUnknown,\n        ...processCreateParams(params),\n    });\n};\nclass ZodNever extends ZodType {\n    _parse(input) {\n        const ctx = this._getOrReturnCtx(input);\n        addIssueToContext(ctx, {\n            code: ZodIssueCode.invalid_type,\n            expected: ZodParsedType.never,\n            received: ctx.parsedType,\n        });\n        return INVALID;\n    }\n}\nZodNever.create = (params) => {\n    return new ZodNever({\n        typeName: ZodFirstPartyTypeKind.ZodNever,\n        ...processCreateParams(params),\n    });\n};\nclass ZodVoid extends ZodType {\n    _parse(input) {\n        const parsedType = this._getType(input);\n        if (parsedType !== ZodParsedType.undefined) {\n            const ctx = this._getOrReturnCtx(input);\n            addIssueToContext(ctx, {\n                code: ZodIssueCode.invalid_type,\n                expected: ZodParsedType.void,\n                received: ctx.parsedType,\n            });\n            return INVALID;\n        }\n        return OK(input.data);\n    }\n}\nZodVoid.create = (params) => {\n    return new ZodVoid({\n        typeName: ZodFirstPartyTypeKind.ZodVoid,\n        ...processCreateParams(params),\n    });\n};\nclass ZodArray extends ZodType {\n    _parse(input) {\n        const { ctx, status } = this._processInputParams(input);\n        const def = this._def;\n        if (ctx.parsedType !== ZodParsedType.array) {\n            addIssueToContext(ctx, {\n                code: ZodIssueCode.invalid_type,\n                expected: ZodParsedType.array,\n                received: ctx.parsedType,\n            });\n            return INVALID;\n        }\n        if (def.exactLength !== null) {\n            const tooBig = ctx.data.length > def.exactLength.value;\n            const tooSmall = ctx.data.length < def.exactLength.value;\n            if (tooBig || tooSmall) {\n                addIssueToContext(ctx, {\n                    code: tooBig ? ZodIssueCode.too_big : ZodIssueCode.too_small,\n                    minimum: (tooSmall ? def.exactLength.value : undefined),\n                    maximum: (tooBig ? def.exactLength.value : undefined),\n                    type: \"array\",\n                    inclusive: true,\n                    exact: true,\n                    message: def.exactLength.message,\n                });\n                status.dirty();\n            }\n        }\n        if (def.minLength !== null) {\n            if (ctx.data.length < def.minLength.value) {\n                addIssueToContext(ctx, {\n                    code: ZodIssueCode.too_small,\n                    minimum: def.minLength.value,\n                    type: \"array\",\n                    inclusive: true,\n                    exact: false,\n                    message: def.minLength.message,\n                });\n                status.dirty();\n            }\n        }\n        if (def.maxLength !== null) {\n            if (ctx.data.length > def.maxLength.value) {\n                addIssueToContext(ctx, {\n                    code: ZodIssueCode.too_big,\n                    maximum: def.maxLength.value,\n                    type: \"array\",\n                    inclusive: true,\n                    exact: false,\n                    message: def.maxLength.message,\n                });\n                status.dirty();\n            }\n        }\n        if (ctx.common.async) {\n            return Promise.all([...ctx.data].map((item, i) => {\n                return def.type._parseAsync(new ParseInputLazyPath(ctx, item, ctx.path, i));\n            })).then((result) => {\n                return ParseStatus.mergeArray(status, result);\n            });\n        }\n        const result = [...ctx.data].map((item, i) => {\n            return def.type._parseSync(new ParseInputLazyPath(ctx, item, ctx.path, i));\n        });\n        return ParseStatus.mergeArray(status, result);\n    }\n    get element() {\n        return this._def.type;\n    }\n    min(minLength, message) {\n        return new ZodArray({\n            ...this._def,\n            minLength: { value: minLength, message: errorUtil.toString(message) },\n        });\n    }\n    max(maxLength, message) {\n        return new ZodArray({\n            ...this._def,\n            maxLength: { value: maxLength, message: errorUtil.toString(message) },\n        });\n    }\n    length(len, message) {\n        return new ZodArray({\n            ...this._def,\n            exactLength: { value: len, message: errorUtil.toString(message) },\n        });\n    }\n    nonempty(message) {\n        return this.min(1, message);\n    }\n}\nZodArray.create = (schema, params) => {\n    return new ZodArray({\n        type: schema,\n        minLength: null,\n        maxLength: null,\n        exactLength: null,\n        typeName: ZodFirstPartyTypeKind.ZodArray,\n        ...processCreateParams(params),\n    });\n};\nfunction deepPartialify(schema) {\n    if (schema instanceof ZodObject) {\n        const newShape = {};\n        for (const key in schema.shape) {\n            const fieldSchema = schema.shape[key];\n            newShape[key] = ZodOptional.create(deepPartialify(fieldSchema));\n        }\n        return new ZodObject({\n            ...schema._def,\n            shape: () => newShape,\n        });\n    }\n    else if (schema instanceof ZodArray) {\n        return new ZodArray({\n            ...schema._def,\n            type: deepPartialify(schema.element),\n        });\n    }\n    else if (schema instanceof ZodOptional) {\n        return ZodOptional.create(deepPartialify(schema.unwrap()));\n    }\n    else if (schema instanceof ZodNullable) {\n        return ZodNullable.create(deepPartialify(schema.unwrap()));\n    }\n    else if (schema instanceof ZodTuple) {\n        return ZodTuple.create(schema.items.map((item) => deepPartialify(item)));\n    }\n    else {\n        return schema;\n    }\n}\nclass ZodObject extends ZodType {\n    constructor() {\n        super(...arguments);\n        this._cached = null;\n        /**\n         * @deprecated In most cases, this is no longer needed - unknown properties are now silently stripped.\n         * If you want to pass through unknown properties, use `.passthrough()` instead.\n         */\n        this.nonstrict = this.passthrough;\n        // extend<\n        //   Augmentation extends ZodRawShape,\n        //   NewOutput extends util.flatten<{\n        //     [k in keyof Augmentation | keyof Output]: k extends keyof Augmentation\n        //       ? Augmentation[k][\"_output\"]\n        //       : k extends keyof Output\n        //       ? Output[k]\n        //       : never;\n        //   }>,\n        //   NewInput extends util.flatten<{\n        //     [k in keyof Augmentation | keyof Input]: k extends keyof Augmentation\n        //       ? Augmentation[k][\"_input\"]\n        //       : k extends keyof Input\n        //       ? Input[k]\n        //       : never;\n        //   }>\n        // >(\n        //   augmentation: Augmentation\n        // ): ZodObject<\n        //   extendShape<T, Augmentation>,\n        //   UnknownKeys,\n        //   Catchall,\n        //   NewOutput,\n        //   NewInput\n        // > {\n        //   return new ZodObject({\n        //     ...this._def,\n        //     shape: () => ({\n        //       ...this._def.shape(),\n        //       ...augmentation,\n        //     }),\n        //   }) as any;\n        // }\n        /**\n         * @deprecated Use `.extend` instead\n         *  */\n        this.augment = this.extend;\n    }\n    _getCached() {\n        if (this._cached !== null)\n            return this._cached;\n        const shape = this._def.shape();\n        const keys = util.objectKeys(shape);\n        return (this._cached = { shape, keys });\n    }\n    _parse(input) {\n        const parsedType = this._getType(input);\n        if (parsedType !== ZodParsedType.object) {\n            const ctx = this._getOrReturnCtx(input);\n            addIssueToContext(ctx, {\n                code: ZodIssueCode.invalid_type,\n                expected: ZodParsedType.object,\n                received: ctx.parsedType,\n            });\n            return INVALID;\n        }\n        const { status, ctx } = this._processInputParams(input);\n        const { shape, keys: shapeKeys } = this._getCached();\n        const extraKeys = [];\n        if (!(this._def.catchall instanceof ZodNever &&\n            this._def.unknownKeys === \"strip\")) {\n            for (const key in ctx.data) {\n                if (!shapeKeys.includes(key)) {\n                    extraKeys.push(key);\n                }\n            }\n        }\n        const pairs = [];\n        for (const key of shapeKeys) {\n            const keyValidator = shape[key];\n            const value = ctx.data[key];\n            pairs.push({\n                key: { status: \"valid\", value: key },\n                value: keyValidator._parse(new ParseInputLazyPath(ctx, value, ctx.path, key)),\n                alwaysSet: key in ctx.data,\n            });\n        }\n        if (this._def.catchall instanceof ZodNever) {\n            const unknownKeys = this._def.unknownKeys;\n            if (unknownKeys === \"passthrough\") {\n                for (const key of extraKeys) {\n                    pairs.push({\n                        key: { status: \"valid\", value: key },\n                        value: { status: \"valid\", value: ctx.data[key] },\n                    });\n                }\n            }\n            else if (unknownKeys === \"strict\") {\n                if (extraKeys.length > 0) {\n                    addIssueToContext(ctx, {\n                        code: ZodIssueCode.unrecognized_keys,\n                        keys: extraKeys,\n                    });\n                    status.dirty();\n                }\n            }\n            else if (unknownKeys === \"strip\") ;\n            else {\n                throw new Error(`Internal ZodObject error: invalid unknownKeys value.`);\n            }\n        }\n        else {\n            // run catchall validation\n            const catchall = this._def.catchall;\n            for (const key of extraKeys) {\n                const value = ctx.data[key];\n                pairs.push({\n                    key: { status: \"valid\", value: key },\n                    value: catchall._parse(new ParseInputLazyPath(ctx, value, ctx.path, key) //, ctx.child(key), value, getParsedType(value)\n                    ),\n                    alwaysSet: key in ctx.data,\n                });\n            }\n        }\n        if (ctx.common.async) {\n            return Promise.resolve()\n                .then(async () => {\n                const syncPairs = [];\n                for (const pair of pairs) {\n                    const key = await pair.key;\n                    const value = await pair.value;\n                    syncPairs.push({\n                        key,\n                        value,\n                        alwaysSet: pair.alwaysSet,\n                    });\n                }\n                return syncPairs;\n            })\n                .then((syncPairs) => {\n                return ParseStatus.mergeObjectSync(status, syncPairs);\n            });\n        }\n        else {\n            return ParseStatus.mergeObjectSync(status, pairs);\n        }\n    }\n    get shape() {\n        return this._def.shape();\n    }\n    strict(message) {\n        errorUtil.errToObj;\n        return new ZodObject({\n            ...this._def,\n            unknownKeys: \"strict\",\n            ...(message !== undefined\n                ? {\n                    errorMap: (issue, ctx) => {\n                        var _a, _b, _c, _d;\n                        const defaultError = (_c = (_b = (_a = this._def).errorMap) === null || _b === void 0 ? void 0 : _b.call(_a, issue, ctx).message) !== null && _c !== void 0 ? _c : ctx.defaultError;\n                        if (issue.code === \"unrecognized_keys\")\n                            return {\n                                message: (_d = errorUtil.errToObj(message).message) !== null && _d !== void 0 ? _d : defaultError,\n                            };\n                        return {\n                            message: defaultError,\n                        };\n                    },\n                }\n                : {}),\n        });\n    }\n    strip() {\n        return new ZodObject({\n            ...this._def,\n            unknownKeys: \"strip\",\n        });\n    }\n    passthrough() {\n        return new ZodObject({\n            ...this._def,\n            unknownKeys: \"passthrough\",\n        });\n    }\n    // const AugmentFactory =\n    //   <Def extends ZodObjectDef>(def: Def) =>\n    //   <Augmentation extends ZodRawShape>(\n    //     augmentation: Augmentation\n    //   ): ZodObject<\n    //     extendShape<ReturnType<Def[\"shape\"]>, Augmentation>,\n    //     Def[\"unknownKeys\"],\n    //     Def[\"catchall\"]\n    //   > => {\n    //     return new ZodObject({\n    //       ...def,\n    //       shape: () => ({\n    //         ...def.shape(),\n    //         ...augmentation,\n    //       }),\n    //     }) as any;\n    //   };\n    extend(augmentation) {\n        return new ZodObject({\n            ...this._def,\n            shape: () => ({\n                ...this._def.shape(),\n                ...augmentation,\n            }),\n        });\n    }\n    /**\n     * Prior to zod@1.0.12 there was a bug in the\n     * inferred type of merged objects. Please\n     * upgrade if you are experiencing issues.\n     */\n    merge(merging) {\n        const merged = new ZodObject({\n            unknownKeys: merging._def.unknownKeys,\n            catchall: merging._def.catchall,\n            shape: () => ({\n                ...this._def.shape(),\n                ...merging._def.shape(),\n            }),\n            typeName: ZodFirstPartyTypeKind.ZodObject,\n        });\n        return merged;\n    }\n    // merge<\n    //   Incoming extends AnyZodObject,\n    //   Augmentation extends Incoming[\"shape\"],\n    //   NewOutput extends {\n    //     [k in keyof Augmentation | keyof Output]: k extends keyof Augmentation\n    //       ? Augmentation[k][\"_output\"]\n    //       : k extends keyof Output\n    //       ? Output[k]\n    //       : never;\n    //   },\n    //   NewInput extends {\n    //     [k in keyof Augmentation | keyof Input]: k extends keyof Augmentation\n    //       ? Augmentation[k][\"_input\"]\n    //       : k extends keyof Input\n    //       ? Input[k]\n    //       : never;\n    //   }\n    // >(\n    //   merging: Incoming\n    // ): ZodObject<\n    //   extendShape<T, ReturnType<Incoming[\"_def\"][\"shape\"]>>,\n    //   Incoming[\"_def\"][\"unknownKeys\"],\n    //   Incoming[\"_def\"][\"catchall\"],\n    //   NewOutput,\n    //   NewInput\n    // > {\n    //   const merged: any = new ZodObject({\n    //     unknownKeys: merging._def.unknownKeys,\n    //     catchall: merging._def.catchall,\n    //     shape: () =>\n    //       objectUtil.mergeShapes(this._def.shape(), merging._def.shape()),\n    //     typeName: ZodFirstPartyTypeKind.ZodObject,\n    //   }) as any;\n    //   return merged;\n    // }\n    setKey(key, schema) {\n        return this.augment({ [key]: schema });\n    }\n    // merge<Incoming extends AnyZodObject>(\n    //   merging: Incoming\n    // ): //ZodObject<T & Incoming[\"_shape\"], UnknownKeys, Catchall> = (merging) => {\n    // ZodObject<\n    //   extendShape<T, ReturnType<Incoming[\"_def\"][\"shape\"]>>,\n    //   Incoming[\"_def\"][\"unknownKeys\"],\n    //   Incoming[\"_def\"][\"catchall\"]\n    // > {\n    //   // const mergedShape = objectUtil.mergeShapes(\n    //   //   this._def.shape(),\n    //   //   merging._def.shape()\n    //   // );\n    //   const merged: any = new ZodObject({\n    //     unknownKeys: merging._def.unknownKeys,\n    //     catchall: merging._def.catchall,\n    //     shape: () =>\n    //       objectUtil.mergeShapes(this._def.shape(), merging._def.shape()),\n    //     typeName: ZodFirstPartyTypeKind.ZodObject,\n    //   }) as any;\n    //   return merged;\n    // }\n    catchall(index) {\n        return new ZodObject({\n            ...this._def,\n            catchall: index,\n        });\n    }\n    pick(mask) {\n        const shape = {};\n        util.objectKeys(mask).forEach((key) => {\n            if (mask[key] && this.shape[key]) {\n                shape[key] = this.shape[key];\n            }\n        });\n        return new ZodObject({\n            ...this._def,\n            shape: () => shape,\n        });\n    }\n    omit(mask) {\n        const shape = {};\n        util.objectKeys(this.shape).forEach((key) => {\n            if (!mask[key]) {\n                shape[key] = this.shape[key];\n            }\n        });\n        return new ZodObject({\n            ...this._def,\n            shape: () => shape,\n        });\n    }\n    /**\n     * @deprecated\n     */\n    deepPartial() {\n        return deepPartialify(this);\n    }\n    partial(mask) {\n        const newShape = {};\n        util.objectKeys(this.shape).forEach((key) => {\n            const fieldSchema = this.shape[key];\n            if (mask && !mask[key]) {\n                newShape[key] = fieldSchema;\n            }\n            else {\n                newShape[key] = fieldSchema.optional();\n            }\n        });\n        return new ZodObject({\n            ...this._def,\n            shape: () => newShape,\n        });\n    }\n    required(mask) {\n        const newShape = {};\n        util.objectKeys(this.shape).forEach((key) => {\n            if (mask && !mask[key]) {\n                newShape[key] = this.shape[key];\n            }\n            else {\n                const fieldSchema = this.shape[key];\n                let newField = fieldSchema;\n                while (newField instanceof ZodOptional) {\n                    newField = newField._def.innerType;\n                }\n                newShape[key] = newField;\n            }\n        });\n        return new ZodObject({\n            ...this._def,\n            shape: () => newShape,\n        });\n    }\n    keyof() {\n        return createZodEnum(util.objectKeys(this.shape));\n    }\n}\nZodObject.create = (shape, params) => {\n    return new ZodObject({\n        shape: () => shape,\n        unknownKeys: \"strip\",\n        catchall: ZodNever.create(),\n        typeName: ZodFirstPartyTypeKind.ZodObject,\n        ...processCreateParams(params),\n    });\n};\nZodObject.strictCreate = (shape, params) => {\n    return new ZodObject({\n        shape: () => shape,\n        unknownKeys: \"strict\",\n        catchall: ZodNever.create(),\n        typeName: ZodFirstPartyTypeKind.ZodObject,\n        ...processCreateParams(params),\n    });\n};\nZodObject.lazycreate = (shape, params) => {\n    return new ZodObject({\n        shape,\n        unknownKeys: \"strip\",\n        catchall: ZodNever.create(),\n        typeName: ZodFirstPartyTypeKind.ZodObject,\n        ...processCreateParams(params),\n    });\n};\nclass ZodUnion extends ZodType {\n    _parse(input) {\n        const { ctx } = this._processInputParams(input);\n        const options = this._def.options;\n        function handleResults(results) {\n            // return first issue-free validation if it exists\n            for (const result of results) {\n                if (result.result.status === \"valid\") {\n                    return result.result;\n                }\n            }\n            for (const result of results) {\n                if (result.result.status === \"dirty\") {\n                    // add issues from dirty option\n                    ctx.common.issues.push(...result.ctx.common.issues);\n                    return result.result;\n                }\n            }\n            // return invalid\n            const unionErrors = results.map((result) => new ZodError(result.ctx.common.issues));\n            addIssueToContext(ctx, {\n                code: ZodIssueCode.invalid_union,\n                unionErrors,\n            });\n            return INVALID;\n        }\n        if (ctx.common.async) {\n            return Promise.all(options.map(async (option) => {\n                const childCtx = {\n                    ...ctx,\n                    common: {\n                        ...ctx.common,\n                        issues: [],\n                    },\n                    parent: null,\n                };\n                return {\n                    result: await option._parseAsync({\n                        data: ctx.data,\n                        path: ctx.path,\n                        parent: childCtx,\n                    }),\n                    ctx: childCtx,\n                };\n            })).then(handleResults);\n        }\n        else {\n            let dirty = undefined;\n            const issues = [];\n            for (const option of options) {\n                const childCtx = {\n                    ...ctx,\n                    common: {\n                        ...ctx.common,\n                        issues: [],\n                    },\n                    parent: null,\n                };\n                const result = option._parseSync({\n                    data: ctx.data,\n                    path: ctx.path,\n                    parent: childCtx,\n                });\n                if (result.status === \"valid\") {\n                    return result;\n                }\n                else if (result.status === \"dirty\" && !dirty) {\n                    dirty = { result, ctx: childCtx };\n                }\n                if (childCtx.common.issues.length) {\n                    issues.push(childCtx.common.issues);\n                }\n            }\n            if (dirty) {\n                ctx.common.issues.push(...dirty.ctx.common.issues);\n                return dirty.result;\n            }\n            const unionErrors = issues.map((issues) => new ZodError(issues));\n            addIssueToContext(ctx, {\n                code: ZodIssueCode.invalid_union,\n                unionErrors,\n            });\n            return INVALID;\n        }\n    }\n    get options() {\n        return this._def.options;\n    }\n}\nZodUnion.create = (types, params) => {\n    return new ZodUnion({\n        options: types,\n        typeName: ZodFirstPartyTypeKind.ZodUnion,\n        ...processCreateParams(params),\n    });\n};\n/////////////////////////////////////////////////////\n/////////////////////////////////////////////////////\n//////////                                 //////////\n//////////      ZodDiscriminatedUnion      //////////\n//////////                                 //////////\n/////////////////////////////////////////////////////\n/////////////////////////////////////////////////////\nconst getDiscriminator = (type) => {\n    if (type instanceof ZodLazy) {\n        return getDiscriminator(type.schema);\n    }\n    else if (type instanceof ZodEffects) {\n        return getDiscriminator(type.innerType());\n    }\n    else if (type instanceof ZodLiteral) {\n        return [type.value];\n    }\n    else if (type instanceof ZodEnum) {\n        return type.options;\n    }\n    else if (type instanceof ZodNativeEnum) {\n        // eslint-disable-next-line ban/ban\n        return util.objectValues(type.enum);\n    }\n    else if (type instanceof ZodDefault) {\n        return getDiscriminator(type._def.innerType);\n    }\n    else if (type instanceof ZodUndefined) {\n        return [undefined];\n    }\n    else if (type instanceof ZodNull) {\n        return [null];\n    }\n    else if (type instanceof ZodOptional) {\n        return [undefined, ...getDiscriminator(type.unwrap())];\n    }\n    else if (type instanceof ZodNullable) {\n        return [null, ...getDiscriminator(type.unwrap())];\n    }\n    else if (type instanceof ZodBranded) {\n        return getDiscriminator(type.unwrap());\n    }\n    else if (type instanceof ZodReadonly) {\n        return getDiscriminator(type.unwrap());\n    }\n    else if (type instanceof ZodCatch) {\n        return getDiscriminator(type._def.innerType);\n    }\n    else {\n        return [];\n    }\n};\nclass ZodDiscriminatedUnion extends ZodType {\n    _parse(input) {\n        const { ctx } = this._processInputParams(input);\n        if (ctx.parsedType !== ZodParsedType.object) {\n            addIssueToContext(ctx, {\n                code: ZodIssueCode.invalid_type,\n                expected: ZodParsedType.object,\n                received: ctx.parsedType,\n            });\n            return INVALID;\n        }\n        const discriminator = this.discriminator;\n        const discriminatorValue = ctx.data[discriminator];\n        const option = this.optionsMap.get(discriminatorValue);\n        if (!option) {\n            addIssueToContext(ctx, {\n                code: ZodIssueCode.invalid_union_discriminator,\n                options: Array.from(this.optionsMap.keys()),\n                path: [discriminator],\n            });\n            return INVALID;\n        }\n        if (ctx.common.async) {\n            return option._parseAsync({\n                data: ctx.data,\n                path: ctx.path,\n                parent: ctx,\n            });\n        }\n        else {\n            return option._parseSync({\n                data: ctx.data,\n                path: ctx.path,\n                parent: ctx,\n            });\n        }\n    }\n    get discriminator() {\n        return this._def.discriminator;\n    }\n    get options() {\n        return this._def.options;\n    }\n    get optionsMap() {\n        return this._def.optionsMap;\n    }\n    /**\n     * The constructor of the discriminated union schema. Its behaviour is very similar to that of the normal z.union() constructor.\n     * However, it only allows a union of objects, all of which need to share a discriminator property. This property must\n     * have a different value for each object in the union.\n     * @param discriminator the name of the discriminator property\n     * @param types an array of object schemas\n     * @param params\n     */\n    static create(discriminator, options, params) {\n        // Get all the valid discriminator values\n        const optionsMap = new Map();\n        // try {\n        for (const type of options) {\n            const discriminatorValues = getDiscriminator(type.shape[discriminator]);\n            if (!discriminatorValues.length) {\n                throw new Error(`A discriminator value for key \\`${discriminator}\\` could not be extracted from all schema options`);\n            }\n            for (const value of discriminatorValues) {\n                if (optionsMap.has(value)) {\n                    throw new Error(`Discriminator property ${String(discriminator)} has duplicate value ${String(value)}`);\n                }\n                optionsMap.set(value, type);\n            }\n        }\n        return new ZodDiscriminatedUnion({\n            typeName: ZodFirstPartyTypeKind.ZodDiscriminatedUnion,\n            discriminator,\n            options,\n            optionsMap,\n            ...processCreateParams(params),\n        });\n    }\n}\nfunction mergeValues(a, b) {\n    const aType = getParsedType(a);\n    const bType = getParsedType(b);\n    if (a === b) {\n        return { valid: true, data: a };\n    }\n    else if (aType === ZodParsedType.object && bType === ZodParsedType.object) {\n        const bKeys = util.objectKeys(b);\n        const sharedKeys = util\n            .objectKeys(a)\n            .filter((key) => bKeys.indexOf(key) !== -1);\n        const newObj = { ...a, ...b };\n        for (const key of sharedKeys) {\n            const sharedValue = mergeValues(a[key], b[key]);\n            if (!sharedValue.valid) {\n                return { valid: false };\n            }\n            newObj[key] = sharedValue.data;\n        }\n        return { valid: true, data: newObj };\n    }\n    else if (aType === ZodParsedType.array && bType === ZodParsedType.array) {\n        if (a.length !== b.length) {\n            return { valid: false };\n        }\n        const newArray = [];\n        for (let index = 0; index < a.length; index++) {\n            const itemA = a[index];\n            const itemB = b[index];\n            const sharedValue = mergeValues(itemA, itemB);\n            if (!sharedValue.valid) {\n                return { valid: false };\n            }\n            newArray.push(sharedValue.data);\n        }\n        return { valid: true, data: newArray };\n    }\n    else if (aType === ZodParsedType.date &&\n        bType === ZodParsedType.date &&\n        +a === +b) {\n        return { valid: true, data: a };\n    }\n    else {\n        return { valid: false };\n    }\n}\nclass ZodIntersection extends ZodType {\n    _parse(input) {\n        const { status, ctx } = this._processInputParams(input);\n        const handleParsed = (parsedLeft, parsedRight) => {\n            if (isAborted(parsedLeft) || isAborted(parsedRight)) {\n                return INVALID;\n            }\n            const merged = mergeValues(parsedLeft.value, parsedRight.value);\n            if (!merged.valid) {\n                addIssueToContext(ctx, {\n                    code: ZodIssueCode.invalid_intersection_types,\n                });\n                return INVALID;\n            }\n            if (isDirty(parsedLeft) || isDirty(parsedRight)) {\n                status.dirty();\n            }\n            return { status: status.value, value: merged.data };\n        };\n        if (ctx.common.async) {\n            return Promise.all([\n                this._def.left._parseAsync({\n                    data: ctx.data,\n                    path: ctx.path,\n                    parent: ctx,\n                }),\n                this._def.right._parseAsync({\n                    data: ctx.data,\n                    path: ctx.path,\n                    parent: ctx,\n                }),\n            ]).then(([left, right]) => handleParsed(left, right));\n        }\n        else {\n            return handleParsed(this._def.left._parseSync({\n                data: ctx.data,\n                path: ctx.path,\n                parent: ctx,\n            }), this._def.right._parseSync({\n                data: ctx.data,\n                path: ctx.path,\n                parent: ctx,\n            }));\n        }\n    }\n}\nZodIntersection.create = (left, right, params) => {\n    return new ZodIntersection({\n        left: left,\n        right: right,\n        typeName: ZodFirstPartyTypeKind.ZodIntersection,\n        ...processCreateParams(params),\n    });\n};\nclass ZodTuple extends ZodType {\n    _parse(input) {\n        const { status, ctx } = this._processInputParams(input);\n        if (ctx.parsedType !== ZodParsedType.array) {\n            addIssueToContext(ctx, {\n                code: ZodIssueCode.invalid_type,\n                expected: ZodParsedType.array,\n                received: ctx.parsedType,\n            });\n            return INVALID;\n        }\n        if (ctx.data.length < this._def.items.length) {\n            addIssueToContext(ctx, {\n                code: ZodIssueCode.too_small,\n                minimum: this._def.items.length,\n                inclusive: true,\n                exact: false,\n                type: \"array\",\n            });\n            return INVALID;\n        }\n        const rest = this._def.rest;\n        if (!rest && ctx.data.length > this._def.items.length) {\n            addIssueToContext(ctx, {\n                code: ZodIssueCode.too_big,\n                maximum: this._def.items.length,\n                inclusive: true,\n                exact: false,\n                type: \"array\",\n            });\n            status.dirty();\n        }\n        const items = [...ctx.data]\n            .map((item, itemIndex) => {\n            const schema = this._def.items[itemIndex] || this._def.rest;\n            if (!schema)\n                return null;\n            return schema._parse(new ParseInputLazyPath(ctx, item, ctx.path, itemIndex));\n        })\n            .filter((x) => !!x); // filter nulls\n        if (ctx.common.async) {\n            return Promise.all(items).then((results) => {\n                return ParseStatus.mergeArray(status, results);\n            });\n        }\n        else {\n            return ParseStatus.mergeArray(status, items);\n        }\n    }\n    get items() {\n        return this._def.items;\n    }\n    rest(rest) {\n        return new ZodTuple({\n            ...this._def,\n            rest,\n        });\n    }\n}\nZodTuple.create = (schemas, params) => {\n    if (!Array.isArray(schemas)) {\n        throw new Error(\"You must pass an array of schemas to z.tuple([ ... ])\");\n    }\n    return new ZodTuple({\n        items: schemas,\n        typeName: ZodFirstPartyTypeKind.ZodTuple,\n        rest: null,\n        ...processCreateParams(params),\n    });\n};\nclass ZodRecord extends ZodType {\n    get keySchema() {\n        return this._def.keyType;\n    }\n    get valueSchema() {\n        return this._def.valueType;\n    }\n    _parse(input) {\n        const { status, ctx } = this._processInputParams(input);\n        if (ctx.parsedType !== ZodParsedType.object) {\n            addIssueToContext(ctx, {\n                code: ZodIssueCode.invalid_type,\n                expected: ZodParsedType.object,\n                received: ctx.parsedType,\n            });\n            return INVALID;\n        }\n        const pairs = [];\n        const keyType = this._def.keyType;\n        const valueType = this._def.valueType;\n        for (const key in ctx.data) {\n            pairs.push({\n                key: keyType._parse(new ParseInputLazyPath(ctx, key, ctx.path, key)),\n                value: valueType._parse(new ParseInputLazyPath(ctx, ctx.data[key], ctx.path, key)),\n                alwaysSet: key in ctx.data,\n            });\n        }\n        if (ctx.common.async) {\n            return ParseStatus.mergeObjectAsync(status, pairs);\n        }\n        else {\n            return ParseStatus.mergeObjectSync(status, pairs);\n        }\n    }\n    get element() {\n        return this._def.valueType;\n    }\n    static create(first, second, third) {\n        if (second instanceof ZodType) {\n            return new ZodRecord({\n                keyType: first,\n                valueType: second,\n                typeName: ZodFirstPartyTypeKind.ZodRecord,\n                ...processCreateParams(third),\n            });\n        }\n        return new ZodRecord({\n            keyType: ZodString.create(),\n            valueType: first,\n            typeName: ZodFirstPartyTypeKind.ZodRecord,\n            ...processCreateParams(second),\n        });\n    }\n}\nclass ZodMap extends ZodType {\n    get keySchema() {\n        return this._def.keyType;\n    }\n    get valueSchema() {\n        return this._def.valueType;\n    }\n    _parse(input) {\n        const { status, ctx } = this._processInputParams(input);\n        if (ctx.parsedType !== ZodParsedType.map) {\n            addIssueToContext(ctx, {\n                code: ZodIssueCode.invalid_type,\n                expected: ZodParsedType.map,\n                received: ctx.parsedType,\n            });\n            return INVALID;\n        }\n        const keyType = this._def.keyType;\n        const valueType = this._def.valueType;\n        const pairs = [...ctx.data.entries()].map(([key, value], index) => {\n            return {\n                key: keyType._parse(new ParseInputLazyPath(ctx, key, ctx.path, [index, \"key\"])),\n                value: valueType._parse(new ParseInputLazyPath(ctx, value, ctx.path, [index, \"value\"])),\n            };\n        });\n        if (ctx.common.async) {\n            const finalMap = new Map();\n            return Promise.resolve().then(async () => {\n                for (const pair of pairs) {\n                    const key = await pair.key;\n                    const value = await pair.value;\n                    if (key.status === \"aborted\" || value.status === \"aborted\") {\n                        return INVALID;\n                    }\n                    if (key.status === \"dirty\" || value.status === \"dirty\") {\n                        status.dirty();\n                    }\n                    finalMap.set(key.value, value.value);\n                }\n                return { status: status.value, value: finalMap };\n            });\n        }\n        else {\n            const finalMap = new Map();\n            for (const pair of pairs) {\n                const key = pair.key;\n                const value = pair.value;\n                if (key.status === \"aborted\" || value.status === \"aborted\") {\n                    return INVALID;\n                }\n                if (key.status === \"dirty\" || value.status === \"dirty\") {\n                    status.dirty();\n                }\n                finalMap.set(key.value, value.value);\n            }\n            return { status: status.value, value: finalMap };\n        }\n    }\n}\nZodMap.create = (keyType, valueType, params) => {\n    return new ZodMap({\n        valueType,\n        keyType,\n        typeName: ZodFirstPartyTypeKind.ZodMap,\n        ...processCreateParams(params),\n    });\n};\nclass ZodSet extends ZodType {\n    _parse(input) {\n        const { status, ctx } = this._processInputParams(input);\n        if (ctx.parsedType !== ZodParsedType.set) {\n            addIssueToContext(ctx, {\n                code: ZodIssueCode.invalid_type,\n                expected: ZodParsedType.set,\n                received: ctx.parsedType,\n            });\n            return INVALID;\n        }\n        const def = this._def;\n        if (def.minSize !== null) {\n            if (ctx.data.size < def.minSize.value) {\n                addIssueToContext(ctx, {\n                    code: ZodIssueCode.too_small,\n                    minimum: def.minSize.value,\n                    type: \"set\",\n                    inclusive: true,\n                    exact: false,\n                    message: def.minSize.message,\n                });\n                status.dirty();\n            }\n        }\n        if (def.maxSize !== null) {\n            if (ctx.data.size > def.maxSize.value) {\n                addIssueToContext(ctx, {\n                    code: ZodIssueCode.too_big,\n                    maximum: def.maxSize.value,\n                    type: \"set\",\n                    inclusive: true,\n                    exact: false,\n                    message: def.maxSize.message,\n                });\n                status.dirty();\n            }\n        }\n        const valueType = this._def.valueType;\n        function finalizeSet(elements) {\n            const parsedSet = new Set();\n            for (const element of elements) {\n                if (element.status === \"aborted\")\n                    return INVALID;\n                if (element.status === \"dirty\")\n                    status.dirty();\n                parsedSet.add(element.value);\n            }\n            return { status: status.value, value: parsedSet };\n        }\n        const elements = [...ctx.data.values()].map((item, i) => valueType._parse(new ParseInputLazyPath(ctx, item, ctx.path, i)));\n        if (ctx.common.async) {\n            return Promise.all(elements).then((elements) => finalizeSet(elements));\n        }\n        else {\n            return finalizeSet(elements);\n        }\n    }\n    min(minSize, message) {\n        return new ZodSet({\n            ...this._def,\n            minSize: { value: minSize, message: errorUtil.toString(message) },\n        });\n    }\n    max(maxSize, message) {\n        return new ZodSet({\n            ...this._def,\n            maxSize: { value: maxSize, message: errorUtil.toString(message) },\n        });\n    }\n    size(size, message) {\n        return this.min(size, message).max(size, message);\n    }\n    nonempty(message) {\n        return this.min(1, message);\n    }\n}\nZodSet.create = (valueType, params) => {\n    return new ZodSet({\n        valueType,\n        minSize: null,\n        maxSize: null,\n        typeName: ZodFirstPartyTypeKind.ZodSet,\n        ...processCreateParams(params),\n    });\n};\nclass ZodFunction extends ZodType {\n    constructor() {\n        super(...arguments);\n        this.validate = this.implement;\n    }\n    _parse(input) {\n        const { ctx } = this._processInputParams(input);\n        if (ctx.parsedType !== ZodParsedType.function) {\n            addIssueToContext(ctx, {\n                code: ZodIssueCode.invalid_type,\n                expected: ZodParsedType.function,\n                received: ctx.parsedType,\n            });\n            return INVALID;\n        }\n        function makeArgsIssue(args, error) {\n            return makeIssue({\n                data: args,\n                path: ctx.path,\n                errorMaps: [\n                    ctx.common.contextualErrorMap,\n                    ctx.schemaErrorMap,\n                    getErrorMap(),\n                    errorMap,\n                ].filter((x) => !!x),\n                issueData: {\n                    code: ZodIssueCode.invalid_arguments,\n                    argumentsError: error,\n                },\n            });\n        }\n        function makeReturnsIssue(returns, error) {\n            return makeIssue({\n                data: returns,\n                path: ctx.path,\n                errorMaps: [\n                    ctx.common.contextualErrorMap,\n                    ctx.schemaErrorMap,\n                    getErrorMap(),\n                    errorMap,\n                ].filter((x) => !!x),\n                issueData: {\n                    code: ZodIssueCode.invalid_return_type,\n                    returnTypeError: error,\n                },\n            });\n        }\n        const params = { errorMap: ctx.common.contextualErrorMap };\n        const fn = ctx.data;\n        if (this._def.returns instanceof ZodPromise) {\n            // Would love a way to avoid disabling this rule, but we need\n            // an alias (using an arrow function was what caused 2651).\n            // eslint-disable-next-line @typescript-eslint/no-this-alias\n            const me = this;\n            return OK(async function (...args) {\n                const error = new ZodError([]);\n                const parsedArgs = await me._def.args\n                    .parseAsync(args, params)\n                    .catch((e) => {\n                    error.addIssue(makeArgsIssue(args, e));\n                    throw error;\n                });\n                const result = await Reflect.apply(fn, this, parsedArgs);\n                const parsedReturns = await me._def.returns._def.type\n                    .parseAsync(result, params)\n                    .catch((e) => {\n                    error.addIssue(makeReturnsIssue(result, e));\n                    throw error;\n                });\n                return parsedReturns;\n            });\n        }\n        else {\n            // Would love a way to avoid disabling this rule, but we need\n            // an alias (using an arrow function was what caused 2651).\n            // eslint-disable-next-line @typescript-eslint/no-this-alias\n            const me = this;\n            return OK(function (...args) {\n                const parsedArgs = me._def.args.safeParse(args, params);\n                if (!parsedArgs.success) {\n                    throw new ZodError([makeArgsIssue(args, parsedArgs.error)]);\n                }\n                const result = Reflect.apply(fn, this, parsedArgs.data);\n                const parsedReturns = me._def.returns.safeParse(result, params);\n                if (!parsedReturns.success) {\n                    throw new ZodError([makeReturnsIssue(result, parsedReturns.error)]);\n                }\n                return parsedReturns.data;\n            });\n        }\n    }\n    parameters() {\n        return this._def.args;\n    }\n    returnType() {\n        return this._def.returns;\n    }\n    args(...items) {\n        return new ZodFunction({\n            ...this._def,\n            args: ZodTuple.create(items).rest(ZodUnknown.create()),\n        });\n    }\n    returns(returnType) {\n        return new ZodFunction({\n            ...this._def,\n            returns: returnType,\n        });\n    }\n    implement(func) {\n        const validatedFunc = this.parse(func);\n        return validatedFunc;\n    }\n    strictImplement(func) {\n        const validatedFunc = this.parse(func);\n        return validatedFunc;\n    }\n    static create(args, returns, params) {\n        return new ZodFunction({\n            args: (args\n                ? args\n                : ZodTuple.create([]).rest(ZodUnknown.create())),\n            returns: returns || ZodUnknown.create(),\n            typeName: ZodFirstPartyTypeKind.ZodFunction,\n            ...processCreateParams(params),\n        });\n    }\n}\nclass ZodLazy extends ZodType {\n    get schema() {\n        return this._def.getter();\n    }\n    _parse(input) {\n        const { ctx } = this._processInputParams(input);\n        const lazySchema = this._def.getter();\n        return lazySchema._parse({ data: ctx.data, path: ctx.path, parent: ctx });\n    }\n}\nZodLazy.create = (getter, params) => {\n    return new ZodLazy({\n        getter: getter,\n        typeName: ZodFirstPartyTypeKind.ZodLazy,\n        ...processCreateParams(params),\n    });\n};\nclass ZodLiteral extends ZodType {\n    _parse(input) {\n        if (input.data !== this._def.value) {\n            const ctx = this._getOrReturnCtx(input);\n            addIssueToContext(ctx, {\n                received: ctx.data,\n                code: ZodIssueCode.invalid_literal,\n                expected: this._def.value,\n            });\n            return INVALID;\n        }\n        return { status: \"valid\", value: input.data };\n    }\n    get value() {\n        return this._def.value;\n    }\n}\nZodLiteral.create = (value, params) => {\n    return new ZodLiteral({\n        value: value,\n        typeName: ZodFirstPartyTypeKind.ZodLiteral,\n        ...processCreateParams(params),\n    });\n};\nfunction createZodEnum(values, params) {\n    return new ZodEnum({\n        values,\n        typeName: ZodFirstPartyTypeKind.ZodEnum,\n        ...processCreateParams(params),\n    });\n}\nclass ZodEnum extends ZodType {\n    constructor() {\n        super(...arguments);\n        _ZodEnum_cache.set(this, void 0);\n    }\n    _parse(input) {\n        if (typeof input.data !== \"string\") {\n            const ctx = this._getOrReturnCtx(input);\n            const expectedValues = this._def.values;\n            addIssueToContext(ctx, {\n                expected: util.joinValues(expectedValues),\n                received: ctx.parsedType,\n                code: ZodIssueCode.invalid_type,\n            });\n            return INVALID;\n        }\n        if (!__classPrivateFieldGet(this, _ZodEnum_cache)) {\n            __classPrivateFieldSet(this, _ZodEnum_cache, new Set(this._def.values));\n        }\n        if (!__classPrivateFieldGet(this, _ZodEnum_cache).has(input.data)) {\n            const ctx = this._getOrReturnCtx(input);\n            const expectedValues = this._def.values;\n            addIssueToContext(ctx, {\n                received: ctx.data,\n                code: ZodIssueCode.invalid_enum_value,\n                options: expectedValues,\n            });\n            return INVALID;\n        }\n        return OK(input.data);\n    }\n    get options() {\n        return this._def.values;\n    }\n    get enum() {\n        const enumValues = {};\n        for (const val of this._def.values) {\n            enumValues[val] = val;\n        }\n        return enumValues;\n    }\n    get Values() {\n        const enumValues = {};\n        for (const val of this._def.values) {\n            enumValues[val] = val;\n        }\n        return enumValues;\n    }\n    get Enum() {\n        const enumValues = {};\n        for (const val of this._def.values) {\n            enumValues[val] = val;\n        }\n        return enumValues;\n    }\n    extract(values, newDef = this._def) {\n        return ZodEnum.create(values, {\n            ...this._def,\n            ...newDef,\n        });\n    }\n    exclude(values, newDef = this._def) {\n        return ZodEnum.create(this.options.filter((opt) => !values.includes(opt)), {\n            ...this._def,\n            ...newDef,\n        });\n    }\n}\n_ZodEnum_cache = new WeakMap();\nZodEnum.create = createZodEnum;\nclass ZodNativeEnum extends ZodType {\n    constructor() {\n        super(...arguments);\n        _ZodNativeEnum_cache.set(this, void 0);\n    }\n    _parse(input) {\n        const nativeEnumValues = util.getValidEnumValues(this._def.values);\n        const ctx = this._getOrReturnCtx(input);\n        if (ctx.parsedType !== ZodParsedType.string &&\n            ctx.parsedType !== ZodParsedType.number) {\n            const expectedValues = util.objectValues(nativeEnumValues);\n            addIssueToContext(ctx, {\n                expected: util.joinValues(expectedValues),\n                received: ctx.parsedType,\n                code: ZodIssueCode.invalid_type,\n            });\n            return INVALID;\n        }\n        if (!__classPrivateFieldGet(this, _ZodNativeEnum_cache)) {\n            __classPrivateFieldSet(this, _ZodNativeEnum_cache, new Set(util.getValidEnumValues(this._def.values)));\n        }\n        if (!__classPrivateFieldGet(this, _ZodNativeEnum_cache).has(input.data)) {\n            const expectedValues = util.objectValues(nativeEnumValues);\n            addIssueToContext(ctx, {\n                received: ctx.data,\n                code: ZodIssueCode.invalid_enum_value,\n                options: expectedValues,\n            });\n            return INVALID;\n        }\n        return OK(input.data);\n    }\n    get enum() {\n        return this._def.values;\n    }\n}\n_ZodNativeEnum_cache = new WeakMap();\nZodNativeEnum.create = (values, params) => {\n    return new ZodNativeEnum({\n        values: values,\n        typeName: ZodFirstPartyTypeKind.ZodNativeEnum,\n        ...processCreateParams(params),\n    });\n};\nclass ZodPromise extends ZodType {\n    unwrap() {\n        return this._def.type;\n    }\n    _parse(input) {\n        const { ctx } = this._processInputParams(input);\n        if (ctx.parsedType !== ZodParsedType.promise &&\n            ctx.common.async === false) {\n            addIssueToContext(ctx, {\n                code: ZodIssueCode.invalid_type,\n                expected: ZodParsedType.promise,\n                received: ctx.parsedType,\n            });\n            return INVALID;\n        }\n        const promisified = ctx.parsedType === ZodParsedType.promise\n            ? ctx.data\n            : Promise.resolve(ctx.data);\n        return OK(promisified.then((data) => {\n            return this._def.type.parseAsync(data, {\n                path: ctx.path,\n                errorMap: ctx.common.contextualErrorMap,\n            });\n        }));\n    }\n}\nZodPromise.create = (schema, params) => {\n    return new ZodPromise({\n        type: schema,\n        typeName: ZodFirstPartyTypeKind.ZodPromise,\n        ...processCreateParams(params),\n    });\n};\nclass ZodEffects extends ZodType {\n    innerType() {\n        return this._def.schema;\n    }\n    sourceType() {\n        return this._def.schema._def.typeName === ZodFirstPartyTypeKind.ZodEffects\n            ? this._def.schema.sourceType()\n            : this._def.schema;\n    }\n    _parse(input) {\n        const { status, ctx } = this._processInputParams(input);\n        const effect = this._def.effect || null;\n        const checkCtx = {\n            addIssue: (arg) => {\n                addIssueToContext(ctx, arg);\n                if (arg.fatal) {\n                    status.abort();\n                }\n                else {\n                    status.dirty();\n                }\n            },\n            get path() {\n                return ctx.path;\n            },\n        };\n        checkCtx.addIssue = checkCtx.addIssue.bind(checkCtx);\n        if (effect.type === \"preprocess\") {\n            const processed = effect.transform(ctx.data, checkCtx);\n            if (ctx.common.async) {\n                return Promise.resolve(processed).then(async (processed) => {\n                    if (status.value === \"aborted\")\n                        return INVALID;\n                    const result = await this._def.schema._parseAsync({\n                        data: processed,\n                        path: ctx.path,\n                        parent: ctx,\n                    });\n                    if (result.status === \"aborted\")\n                        return INVALID;\n                    if (result.status === \"dirty\")\n                        return DIRTY(result.value);\n                    if (status.value === \"dirty\")\n                        return DIRTY(result.value);\n                    return result;\n                });\n            }\n            else {\n                if (status.value === \"aborted\")\n                    return INVALID;\n                const result = this._def.schema._parseSync({\n                    data: processed,\n                    path: ctx.path,\n                    parent: ctx,\n                });\n                if (result.status === \"aborted\")\n                    return INVALID;\n                if (result.status === \"dirty\")\n                    return DIRTY(result.value);\n                if (status.value === \"dirty\")\n                    return DIRTY(result.value);\n                return result;\n            }\n        }\n        if (effect.type === \"refinement\") {\n            const executeRefinement = (acc) => {\n                const result = effect.refinement(acc, checkCtx);\n                if (ctx.common.async) {\n                    return Promise.resolve(result);\n                }\n                if (result instanceof Promise) {\n                    throw new Error(\"Async refinement encountered during synchronous parse operation. Use .parseAsync instead.\");\n                }\n                return acc;\n            };\n            if (ctx.common.async === false) {\n                const inner = this._def.schema._parseSync({\n                    data: ctx.data,\n                    path: ctx.path,\n                    parent: ctx,\n                });\n                if (inner.status === \"aborted\")\n                    return INVALID;\n                if (inner.status === \"dirty\")\n                    status.dirty();\n                // return value is ignored\n                executeRefinement(inner.value);\n                return { status: status.value, value: inner.value };\n            }\n            else {\n                return this._def.schema\n                    ._parseAsync({ data: ctx.data, path: ctx.path, parent: ctx })\n                    .then((inner) => {\n                    if (inner.status === \"aborted\")\n                        return INVALID;\n                    if (inner.status === \"dirty\")\n                        status.dirty();\n                    return executeRefinement(inner.value).then(() => {\n                        return { status: status.value, value: inner.value };\n                    });\n                });\n            }\n        }\n        if (effect.type === \"transform\") {\n            if (ctx.common.async === false) {\n                const base = this._def.schema._parseSync({\n                    data: ctx.data,\n                    path: ctx.path,\n                    parent: ctx,\n                });\n                if (!isValid(base))\n                    return base;\n                const result = effect.transform(base.value, checkCtx);\n                if (result instanceof Promise) {\n                    throw new Error(`Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.`);\n                }\n                return { status: status.value, value: result };\n            }\n            else {\n                return this._def.schema\n                    ._parseAsync({ data: ctx.data, path: ctx.path, parent: ctx })\n                    .then((base) => {\n                    if (!isValid(base))\n                        return base;\n                    return Promise.resolve(effect.transform(base.value, checkCtx)).then((result) => ({ status: status.value, value: result }));\n                });\n            }\n        }\n        util.assertNever(effect);\n    }\n}\nZodEffects.create = (schema, effect, params) => {\n    return new ZodEffects({\n        schema,\n        typeName: ZodFirstPartyTypeKind.ZodEffects,\n        effect,\n        ...processCreateParams(params),\n    });\n};\nZodEffects.createWithPreprocess = (preprocess, schema, params) => {\n    return new ZodEffects({\n        schema,\n        effect: { type: \"preprocess\", transform: preprocess },\n        typeName: ZodFirstPartyTypeKind.ZodEffects,\n        ...processCreateParams(params),\n    });\n};\nclass ZodOptional extends ZodType {\n    _parse(input) {\n        const parsedType = this._getType(input);\n        if (parsedType === ZodParsedType.undefined) {\n            return OK(undefined);\n        }\n        return this._def.innerType._parse(input);\n    }\n    unwrap() {\n        return this._def.innerType;\n    }\n}\nZodOptional.create = (type, params) => {\n    return new ZodOptional({\n        innerType: type,\n        typeName: ZodFirstPartyTypeKind.ZodOptional,\n        ...processCreateParams(params),\n    });\n};\nclass ZodNullable extends ZodType {\n    _parse(input) {\n        const parsedType = this._getType(input);\n        if (parsedType === ZodParsedType.null) {\n            return OK(null);\n        }\n        return this._def.innerType._parse(input);\n    }\n    unwrap() {\n        return this._def.innerType;\n    }\n}\nZodNullable.create = (type, params) => {\n    return new ZodNullable({\n        innerType: type,\n        typeName: ZodFirstPartyTypeKind.ZodNullable,\n        ...processCreateParams(params),\n    });\n};\nclass ZodDefault extends ZodType {\n    _parse(input) {\n        const { ctx } = this._processInputParams(input);\n        let data = ctx.data;\n        if (ctx.parsedType === ZodParsedType.undefined) {\n            data = this._def.defaultValue();\n        }\n        return this._def.innerType._parse({\n            data,\n            path: ctx.path,\n            parent: ctx,\n        });\n    }\n    removeDefault() {\n        return this._def.innerType;\n    }\n}\nZodDefault.create = (type, params) => {\n    return new ZodDefault({\n        innerType: type,\n        typeName: ZodFirstPartyTypeKind.ZodDefault,\n        defaultValue: typeof params.default === \"function\"\n            ? params.default\n            : () => params.default,\n        ...processCreateParams(params),\n    });\n};\nclass ZodCatch extends ZodType {\n    _parse(input) {\n        const { ctx } = this._processInputParams(input);\n        // newCtx is used to not collect issues from inner types in ctx\n        const newCtx = {\n            ...ctx,\n            common: {\n                ...ctx.common,\n                issues: [],\n            },\n        };\n        const result = this._def.innerType._parse({\n            data: newCtx.data,\n            path: newCtx.path,\n            parent: {\n                ...newCtx,\n            },\n        });\n        if (isAsync(result)) {\n            return result.then((result) => {\n                return {\n                    status: \"valid\",\n                    value: result.status === \"valid\"\n                        ? result.value\n                        : this._def.catchValue({\n                            get error() {\n                                return new ZodError(newCtx.common.issues);\n                            },\n                            input: newCtx.data,\n                        }),\n                };\n            });\n        }\n        else {\n            return {\n                status: \"valid\",\n                value: result.status === \"valid\"\n                    ? result.value\n                    : this._def.catchValue({\n                        get error() {\n                            return new ZodError(newCtx.common.issues);\n                        },\n                        input: newCtx.data,\n                    }),\n            };\n        }\n    }\n    removeCatch() {\n        return this._def.innerType;\n    }\n}\nZodCatch.create = (type, params) => {\n    return new ZodCatch({\n        innerType: type,\n        typeName: ZodFirstPartyTypeKind.ZodCatch,\n        catchValue: typeof params.catch === \"function\" ? params.catch : () => params.catch,\n        ...processCreateParams(params),\n    });\n};\nclass ZodNaN extends ZodType {\n    _parse(input) {\n        const parsedType = this._getType(input);\n        if (parsedType !== ZodParsedType.nan) {\n            const ctx = this._getOrReturnCtx(input);\n            addIssueToContext(ctx, {\n                code: ZodIssueCode.invalid_type,\n                expected: ZodParsedType.nan,\n                received: ctx.parsedType,\n            });\n            return INVALID;\n        }\n        return { status: \"valid\", value: input.data };\n    }\n}\nZodNaN.create = (params) => {\n    return new ZodNaN({\n        typeName: ZodFirstPartyTypeKind.ZodNaN,\n        ...processCreateParams(params),\n    });\n};\nconst BRAND = Symbol(\"zod_brand\");\nclass ZodBranded extends ZodType {\n    _parse(input) {\n        const { ctx } = this._processInputParams(input);\n        const data = ctx.data;\n        return this._def.type._parse({\n            data,\n            path: ctx.path,\n            parent: ctx,\n        });\n    }\n    unwrap() {\n        return this._def.type;\n    }\n}\nclass ZodPipeline extends ZodType {\n    _parse(input) {\n        const { status, ctx } = this._processInputParams(input);\n        if (ctx.common.async) {\n            const handleAsync = async () => {\n                const inResult = await this._def.in._parseAsync({\n                    data: ctx.data,\n                    path: ctx.path,\n                    parent: ctx,\n                });\n                if (inResult.status === \"aborted\")\n                    return INVALID;\n                if (inResult.status === \"dirty\") {\n                    status.dirty();\n                    return DIRTY(inResult.value);\n                }\n                else {\n                    return this._def.out._parseAsync({\n                        data: inResult.value,\n                        path: ctx.path,\n                        parent: ctx,\n                    });\n                }\n            };\n            return handleAsync();\n        }\n        else {\n            const inResult = this._def.in._parseSync({\n                data: ctx.data,\n                path: ctx.path,\n                parent: ctx,\n            });\n            if (inResult.status === \"aborted\")\n                return INVALID;\n            if (inResult.status === \"dirty\") {\n                status.dirty();\n                return {\n                    status: \"dirty\",\n                    value: inResult.value,\n                };\n            }\n            else {\n                return this._def.out._parseSync({\n                    data: inResult.value,\n                    path: ctx.path,\n                    parent: ctx,\n                });\n            }\n        }\n    }\n    static create(a, b) {\n        return new ZodPipeline({\n            in: a,\n            out: b,\n            typeName: ZodFirstPartyTypeKind.ZodPipeline,\n        });\n    }\n}\nclass ZodReadonly extends ZodType {\n    _parse(input) {\n        const result = this._def.innerType._parse(input);\n        const freeze = (data) => {\n            if (isValid(data)) {\n                data.value = Object.freeze(data.value);\n            }\n            return data;\n        };\n        return isAsync(result)\n            ? result.then((data) => freeze(data))\n            : freeze(result);\n    }\n    unwrap() {\n        return this._def.innerType;\n    }\n}\nZodReadonly.create = (type, params) => {\n    return new ZodReadonly({\n        innerType: type,\n        typeName: ZodFirstPartyTypeKind.ZodReadonly,\n        ...processCreateParams(params),\n    });\n};\n////////////////////////////////////////\n////////////////////////////////////////\n//////////                    //////////\n//////////      z.custom      //////////\n//////////                    //////////\n////////////////////////////////////////\n////////////////////////////////////////\nfunction cleanParams(params, data) {\n    const p = typeof params === \"function\"\n        ? params(data)\n        : typeof params === \"string\"\n            ? { message: params }\n            : params;\n    const p2 = typeof p === \"string\" ? { message: p } : p;\n    return p2;\n}\nfunction custom(check, _params = {}, \n/**\n * @deprecated\n *\n * Pass `fatal` into the params object instead:\n *\n * ```ts\n * z.string().custom((val) => val.length > 5, { fatal: false })\n * ```\n *\n */\nfatal) {\n    if (check)\n        return ZodAny.create().superRefine((data, ctx) => {\n            var _a, _b;\n            const r = check(data);\n            if (r instanceof Promise) {\n                return r.then((r) => {\n                    var _a, _b;\n                    if (!r) {\n                        const params = cleanParams(_params, data);\n                        const _fatal = (_b = (_a = params.fatal) !== null && _a !== void 0 ? _a : fatal) !== null && _b !== void 0 ? _b : true;\n                        ctx.addIssue({ code: \"custom\", ...params, fatal: _fatal });\n                    }\n                });\n            }\n            if (!r) {\n                const params = cleanParams(_params, data);\n                const _fatal = (_b = (_a = params.fatal) !== null && _a !== void 0 ? _a : fatal) !== null && _b !== void 0 ? _b : true;\n                ctx.addIssue({ code: \"custom\", ...params, fatal: _fatal });\n            }\n            return;\n        });\n    return ZodAny.create();\n}\nconst late = {\n    object: ZodObject.lazycreate,\n};\nvar ZodFirstPartyTypeKind;\n(function (ZodFirstPartyTypeKind) {\n    ZodFirstPartyTypeKind[\"ZodString\"] = \"ZodString\";\n    ZodFirstPartyTypeKind[\"ZodNumber\"] = \"ZodNumber\";\n    ZodFirstPartyTypeKind[\"ZodNaN\"] = \"ZodNaN\";\n    ZodFirstPartyTypeKind[\"ZodBigInt\"] = \"ZodBigInt\";\n    ZodFirstPartyTypeKind[\"ZodBoolean\"] = \"ZodBoolean\";\n    ZodFirstPartyTypeKind[\"ZodDate\"] = \"ZodDate\";\n    ZodFirstPartyTypeKind[\"ZodSymbol\"] = \"ZodSymbol\";\n    ZodFirstPartyTypeKind[\"ZodUndefined\"] = \"ZodUndefined\";\n    ZodFirstPartyTypeKind[\"ZodNull\"] = \"ZodNull\";\n    ZodFirstPartyTypeKind[\"ZodAny\"] = \"ZodAny\";\n    ZodFirstPartyTypeKind[\"ZodUnknown\"] = \"ZodUnknown\";\n    ZodFirstPartyTypeKind[\"ZodNever\"] = \"ZodNever\";\n    ZodFirstPartyTypeKind[\"ZodVoid\"] = \"ZodVoid\";\n    ZodFirstPartyTypeKind[\"ZodArray\"] = \"ZodArray\";\n    ZodFirstPartyTypeKind[\"ZodObject\"] = \"ZodObject\";\n    ZodFirstPartyTypeKind[\"ZodUnion\"] = \"ZodUnion\";\n    ZodFirstPartyTypeKind[\"ZodDiscriminatedUnion\"] = \"ZodDiscriminatedUnion\";\n    ZodFirstPartyTypeKind[\"ZodIntersection\"] = \"ZodIntersection\";\n    ZodFirstPartyTypeKind[\"ZodTuple\"] = \"ZodTuple\";\n    ZodFirstPartyTypeKind[\"ZodRecord\"] = \"ZodRecord\";\n    ZodFirstPartyTypeKind[\"ZodMap\"] = \"ZodMap\";\n    ZodFirstPartyTypeKind[\"ZodSet\"] = \"ZodSet\";\n    ZodFirstPartyTypeKind[\"ZodFunction\"] = \"ZodFunction\";\n    ZodFirstPartyTypeKind[\"ZodLazy\"] = \"ZodLazy\";\n    ZodFirstPartyTypeKind[\"ZodLiteral\"] = \"ZodLiteral\";\n    ZodFirstPartyTypeKind[\"ZodEnum\"] = \"ZodEnum\";\n    ZodFirstPartyTypeKind[\"ZodEffects\"] = \"ZodEffects\";\n    ZodFirstPartyTypeKind[\"ZodNativeEnum\"] = \"ZodNativeEnum\";\n    ZodFirstPartyTypeKind[\"ZodOptional\"] = \"ZodOptional\";\n    ZodFirstPartyTypeKind[\"ZodNullable\"] = \"ZodNullable\";\n    ZodFirstPartyTypeKind[\"ZodDefault\"] = \"ZodDefault\";\n    ZodFirstPartyTypeKind[\"ZodCatch\"] = \"ZodCatch\";\n    ZodFirstPartyTypeKind[\"ZodPromise\"] = \"ZodPromise\";\n    ZodFirstPartyTypeKind[\"ZodBranded\"] = \"ZodBranded\";\n    ZodFirstPartyTypeKind[\"ZodPipeline\"] = \"ZodPipeline\";\n    ZodFirstPartyTypeKind[\"ZodReadonly\"] = \"ZodReadonly\";\n})(ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {}));\nconst instanceOfType = (\n// const instanceOfType = <T extends new (...args: any[]) => any>(\ncls, params = {\n    message: `Input not instance of ${cls.name}`,\n}) => custom((data) => data instanceof cls, params);\nconst stringType = ZodString.create;\nconst numberType = ZodNumber.create;\nconst nanType = ZodNaN.create;\nconst bigIntType = ZodBigInt.create;\nconst booleanType = ZodBoolean.create;\nconst dateType = ZodDate.create;\nconst symbolType = ZodSymbol.create;\nconst undefinedType = ZodUndefined.create;\nconst nullType = ZodNull.create;\nconst anyType = ZodAny.create;\nconst unknownType = ZodUnknown.create;\nconst neverType = ZodNever.create;\nconst voidType = ZodVoid.create;\nconst arrayType = ZodArray.create;\nconst objectType = ZodObject.create;\nconst strictObjectType = ZodObject.strictCreate;\nconst unionType = ZodUnion.create;\nconst discriminatedUnionType = ZodDiscriminatedUnion.create;\nconst intersectionType = ZodIntersection.create;\nconst tupleType = ZodTuple.create;\nconst recordType = ZodRecord.create;\nconst mapType = ZodMap.create;\nconst setType = ZodSet.create;\nconst functionType = ZodFunction.create;\nconst lazyType = ZodLazy.create;\nconst literalType = ZodLiteral.create;\nconst enumType = ZodEnum.create;\nconst nativeEnumType = ZodNativeEnum.create;\nconst promiseType = ZodPromise.create;\nconst effectsType = ZodEffects.create;\nconst optionalType = ZodOptional.create;\nconst nullableType = ZodNullable.create;\nconst preprocessType = ZodEffects.createWithPreprocess;\nconst pipelineType = ZodPipeline.create;\nconst ostring = () => stringType().optional();\nconst onumber = () => numberType().optional();\nconst oboolean = () => booleanType().optional();\nconst coerce = {\n    string: ((arg) => ZodString.create({ ...arg, coerce: true })),\n    number: ((arg) => ZodNumber.create({ ...arg, coerce: true })),\n    boolean: ((arg) => ZodBoolean.create({\n        ...arg,\n        coerce: true,\n    })),\n    bigint: ((arg) => ZodBigInt.create({ ...arg, coerce: true })),\n    date: ((arg) => ZodDate.create({ ...arg, coerce: true })),\n};\nconst NEVER = INVALID;\n\nvar z = /*#__PURE__*/Object.freeze({\n    __proto__: null,\n    defaultErrorMap: errorMap,\n    setErrorMap: setErrorMap,\n    getErrorMap: getErrorMap,\n    makeIssue: makeIssue,\n    EMPTY_PATH: EMPTY_PATH,\n    addIssueToContext: addIssueToContext,\n    ParseStatus: ParseStatus,\n    INVALID: INVALID,\n    DIRTY: DIRTY,\n    OK: OK,\n    isAborted: isAborted,\n    isDirty: isDirty,\n    isValid: isValid,\n    isAsync: isAsync,\n    get util () { return util; },\n    get objectUtil () { return objectUtil; },\n    ZodParsedType: ZodParsedType,\n    getParsedType: getParsedType,\n    ZodType: ZodType,\n    datetimeRegex: datetimeRegex,\n    ZodString: ZodString,\n    ZodNumber: ZodNumber,\n    ZodBigInt: ZodBigInt,\n    ZodBoolean: ZodBoolean,\n    ZodDate: ZodDate,\n    ZodSymbol: ZodSymbol,\n    ZodUndefined: ZodUndefined,\n    ZodNull: ZodNull,\n    ZodAny: ZodAny,\n    ZodUnknown: ZodUnknown,\n    ZodNever: ZodNever,\n    ZodVoid: ZodVoid,\n    ZodArray: ZodArray,\n    ZodObject: ZodObject,\n    ZodUnion: ZodUnion,\n    ZodDiscriminatedUnion: ZodDiscriminatedUnion,\n    ZodIntersection: ZodIntersection,\n    ZodTuple: ZodTuple,\n    ZodRecord: ZodRecord,\n    ZodMap: ZodMap,\n    ZodSet: ZodSet,\n    ZodFunction: ZodFunction,\n    ZodLazy: ZodLazy,\n    ZodLiteral: ZodLiteral,\n    ZodEnum: ZodEnum,\n    ZodNativeEnum: ZodNativeEnum,\n    ZodPromise: ZodPromise,\n    ZodEffects: ZodEffects,\n    ZodTransformer: ZodEffects,\n    ZodOptional: ZodOptional,\n    ZodNullable: ZodNullable,\n    ZodDefault: ZodDefault,\n    ZodCatch: ZodCatch,\n    ZodNaN: ZodNaN,\n    BRAND: BRAND,\n    ZodBranded: ZodBranded,\n    ZodPipeline: ZodPipeline,\n    ZodReadonly: ZodReadonly,\n    custom: custom,\n    Schema: ZodType,\n    ZodSchema: ZodType,\n    late: late,\n    get ZodFirstPartyTypeKind () { return ZodFirstPartyTypeKind; },\n    coerce: coerce,\n    any: anyType,\n    array: arrayType,\n    bigint: bigIntType,\n    boolean: booleanType,\n    date: dateType,\n    discriminatedUnion: discriminatedUnionType,\n    effect: effectsType,\n    'enum': enumType,\n    'function': functionType,\n    'instanceof': instanceOfType,\n    intersection: intersectionType,\n    lazy: lazyType,\n    literal: literalType,\n    map: mapType,\n    nan: nanType,\n    nativeEnum: nativeEnumType,\n    never: neverType,\n    'null': nullType,\n    nullable: nullableType,\n    number: numberType,\n    object: objectType,\n    oboolean: oboolean,\n    onumber: onumber,\n    optional: optionalType,\n    ostring: ostring,\n    pipeline: pipelineType,\n    preprocess: preprocessType,\n    promise: promiseType,\n    record: recordType,\n    set: setType,\n    strictObject: strictObjectType,\n    string: stringType,\n    symbol: symbolType,\n    transformer: effectsType,\n    tuple: tupleType,\n    'undefined': undefinedType,\n    union: unionType,\n    unknown: unknownType,\n    'void': voidType,\n    NEVER: NEVER,\n    ZodIssueCode: ZodIssueCode,\n    quotelessJson: quotelessJson,\n    ZodError: ZodError\n});\n\nfunction getDefaultExportFromCjs (x) {\n\treturn x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;\n}\n\nvar config = {};\n\nvar main = {exports: {}};\n\nconst version=\"16.4.7\";var require$$4 = {version:version};\n\nvar hasRequiredMain;\n\nfunction requireMain () {\n\tif (hasRequiredMain) return main.exports;\n\thasRequiredMain = 1;\n\tconst fs$1 = fs;\n\tconst path$1 = path;\n\tconst os = require$$2;\n\tconst crypto = require$$3;\n\tconst packageJson = require$$4;\n\n\tconst version = packageJson.version;\n\n\tconst LINE = /(?:^|^)\\s*(?:export\\s+)?([\\w.-]+)(?:\\s*=\\s*?|:\\s+?)(\\s*'(?:\\\\'|[^'])*'|\\s*\"(?:\\\\\"|[^\"])*\"|\\s*`(?:\\\\`|[^`])*`|[^#\\r\\n]+)?\\s*(?:#.*)?(?:$|$)/mg;\n\n\t// Parse src into an Object\n\tfunction parse (src) {\n\t  const obj = {};\n\n\t  // Convert buffer to string\n\t  let lines = src.toString();\n\n\t  // Convert line breaks to same format\n\t  lines = lines.replace(/\\r\\n?/mg, '\\n');\n\n\t  let match;\n\t  while ((match = LINE.exec(lines)) != null) {\n\t    const key = match[1];\n\n\t    // Default undefined or null to empty string\n\t    let value = (match[2] || '');\n\n\t    // Remove whitespace\n\t    value = value.trim();\n\n\t    // Check if double quoted\n\t    const maybeQuote = value[0];\n\n\t    // Remove surrounding quotes\n\t    value = value.replace(/^(['\"`])([\\s\\S]*)\\1$/mg, '$2');\n\n\t    // Expand newlines if double quoted\n\t    if (maybeQuote === '\"') {\n\t      value = value.replace(/\\\\n/g, '\\n');\n\t      value = value.replace(/\\\\r/g, '\\r');\n\t    }\n\n\t    // Add to object\n\t    obj[key] = value;\n\t  }\n\n\t  return obj\n\t}\n\n\tfunction _parseVault (options) {\n\t  const vaultPath = _vaultPath(options);\n\n\t  // Parse .env.vault\n\t  const result = DotenvModule.configDotenv({ path: vaultPath });\n\t  if (!result.parsed) {\n\t    const err = new Error(`MISSING_DATA: Cannot parse ${vaultPath} for an unknown reason`);\n\t    err.code = 'MISSING_DATA';\n\t    throw err\n\t  }\n\n\t  // handle scenario for comma separated keys - for use with key rotation\n\t  // example: DOTENV_KEY=\"dotenv://:key_1234@dotenvx.com/vault/.env.vault?environment=prod,dotenv://:key_7890@dotenvx.com/vault/.env.vault?environment=prod\"\n\t  const keys = _dotenvKey(options).split(',');\n\t  const length = keys.length;\n\n\t  let decrypted;\n\t  for (let i = 0; i < length; i++) {\n\t    try {\n\t      // Get full key\n\t      const key = keys[i].trim();\n\n\t      // Get instructions for decrypt\n\t      const attrs = _instructions(result, key);\n\n\t      // Decrypt\n\t      decrypted = DotenvModule.decrypt(attrs.ciphertext, attrs.key);\n\n\t      break\n\t    } catch (error) {\n\t      // last key\n\t      if (i + 1 >= length) {\n\t        throw error\n\t      }\n\t      // try next key\n\t    }\n\t  }\n\n\t  // Parse decrypted .env string\n\t  return DotenvModule.parse(decrypted)\n\t}\n\n\tfunction _log (message) {\n\t  console.log(`[dotenv@${version}][INFO] ${message}`);\n\t}\n\n\tfunction _warn (message) {\n\t  console.log(`[dotenv@${version}][WARN] ${message}`);\n\t}\n\n\tfunction _debug (message) {\n\t  console.log(`[dotenv@${version}][DEBUG] ${message}`);\n\t}\n\n\tfunction _dotenvKey (options) {\n\t  // prioritize developer directly setting options.DOTENV_KEY\n\t  if (options && options.DOTENV_KEY && options.DOTENV_KEY.length > 0) {\n\t    return options.DOTENV_KEY\n\t  }\n\n\t  // secondary infra already contains a DOTENV_KEY environment variable\n\t  if (process.env.DOTENV_KEY && process.env.DOTENV_KEY.length > 0) {\n\t    return process.env.DOTENV_KEY\n\t  }\n\n\t  // fallback to empty string\n\t  return ''\n\t}\n\n\tfunction _instructions (result, dotenvKey) {\n\t  // Parse DOTENV_KEY. Format is a URI\n\t  let uri;\n\t  try {\n\t    uri = new URL(dotenvKey);\n\t  } catch (error) {\n\t    if (error.code === 'ERR_INVALID_URL') {\n\t      const err = new Error('INVALID_DOTENV_KEY: Wrong format. Must be in valid uri format like dotenv://:key_1234@dotenvx.com/vault/.env.vault?environment=development');\n\t      err.code = 'INVALID_DOTENV_KEY';\n\t      throw err\n\t    }\n\n\t    throw error\n\t  }\n\n\t  // Get decrypt key\n\t  const key = uri.password;\n\t  if (!key) {\n\t    const err = new Error('INVALID_DOTENV_KEY: Missing key part');\n\t    err.code = 'INVALID_DOTENV_KEY';\n\t    throw err\n\t  }\n\n\t  // Get environment\n\t  const environment = uri.searchParams.get('environment');\n\t  if (!environment) {\n\t    const err = new Error('INVALID_DOTENV_KEY: Missing environment part');\n\t    err.code = 'INVALID_DOTENV_KEY';\n\t    throw err\n\t  }\n\n\t  // Get ciphertext payload\n\t  const environmentKey = `DOTENV_VAULT_${environment.toUpperCase()}`;\n\t  const ciphertext = result.parsed[environmentKey]; // DOTENV_VAULT_PRODUCTION\n\t  if (!ciphertext) {\n\t    const err = new Error(`NOT_FOUND_DOTENV_ENVIRONMENT: Cannot locate environment ${environmentKey} in your .env.vault file.`);\n\t    err.code = 'NOT_FOUND_DOTENV_ENVIRONMENT';\n\t    throw err\n\t  }\n\n\t  return { ciphertext, key }\n\t}\n\n\tfunction _vaultPath (options) {\n\t  let possibleVaultPath = null;\n\n\t  if (options && options.path && options.path.length > 0) {\n\t    if (Array.isArray(options.path)) {\n\t      for (const filepath of options.path) {\n\t        if (fs$1.existsSync(filepath)) {\n\t          possibleVaultPath = filepath.endsWith('.vault') ? filepath : `${filepath}.vault`;\n\t        }\n\t      }\n\t    } else {\n\t      possibleVaultPath = options.path.endsWith('.vault') ? options.path : `${options.path}.vault`;\n\t    }\n\t  } else {\n\t    possibleVaultPath = path$1.resolve(process.cwd(), '.env.vault');\n\t  }\n\n\t  if (fs$1.existsSync(possibleVaultPath)) {\n\t    return possibleVaultPath\n\t  }\n\n\t  return null\n\t}\n\n\tfunction _resolveHome (envPath) {\n\t  return envPath[0] === '~' ? path$1.join(os.homedir(), envPath.slice(1)) : envPath\n\t}\n\n\tfunction _configVault (options) {\n\t  _log('Loading env from encrypted .env.vault');\n\n\t  const parsed = DotenvModule._parseVault(options);\n\n\t  let processEnv = process.env;\n\t  if (options && options.processEnv != null) {\n\t    processEnv = options.processEnv;\n\t  }\n\n\t  DotenvModule.populate(processEnv, parsed, options);\n\n\t  return { parsed }\n\t}\n\n\tfunction configDotenv (options) {\n\t  const dotenvPath = path$1.resolve(process.cwd(), '.env');\n\t  let encoding = 'utf8';\n\t  const debug = Boolean(options && options.debug);\n\n\t  if (options && options.encoding) {\n\t    encoding = options.encoding;\n\t  } else {\n\t    if (debug) {\n\t      _debug('No encoding is specified. UTF-8 is used by default');\n\t    }\n\t  }\n\n\t  let optionPaths = [dotenvPath]; // default, look for .env\n\t  if (options && options.path) {\n\t    if (!Array.isArray(options.path)) {\n\t      optionPaths = [_resolveHome(options.path)];\n\t    } else {\n\t      optionPaths = []; // reset default\n\t      for (const filepath of options.path) {\n\t        optionPaths.push(_resolveHome(filepath));\n\t      }\n\t    }\n\t  }\n\n\t  // Build the parsed data in a temporary object (because we need to return it).  Once we have the final\n\t  // parsed data, we will combine it with process.env (or options.processEnv if provided).\n\t  let lastError;\n\t  const parsedAll = {};\n\t  for (const path of optionPaths) {\n\t    try {\n\t      // Specifying an encoding returns a string instead of a buffer\n\t      const parsed = DotenvModule.parse(fs$1.readFileSync(path, { encoding }));\n\n\t      DotenvModule.populate(parsedAll, parsed, options);\n\t    } catch (e) {\n\t      if (debug) {\n\t        _debug(`Failed to load ${path} ${e.message}`);\n\t      }\n\t      lastError = e;\n\t    }\n\t  }\n\n\t  let processEnv = process.env;\n\t  if (options && options.processEnv != null) {\n\t    processEnv = options.processEnv;\n\t  }\n\n\t  DotenvModule.populate(processEnv, parsedAll, options);\n\n\t  if (lastError) {\n\t    return { parsed: parsedAll, error: lastError }\n\t  } else {\n\t    return { parsed: parsedAll }\n\t  }\n\t}\n\n\t// Populates process.env from .env file\n\tfunction config (options) {\n\t  // fallback to original dotenv if DOTENV_KEY is not set\n\t  if (_dotenvKey(options).length === 0) {\n\t    return DotenvModule.configDotenv(options)\n\t  }\n\n\t  const vaultPath = _vaultPath(options);\n\n\t  // dotenvKey exists but .env.vault file does not exist\n\t  if (!vaultPath) {\n\t    _warn(`You set DOTENV_KEY but you are missing a .env.vault file at ${vaultPath}. Did you forget to build it?`);\n\n\t    return DotenvModule.configDotenv(options)\n\t  }\n\n\t  return DotenvModule._configVault(options)\n\t}\n\n\tfunction decrypt (encrypted, keyStr) {\n\t  const key = Buffer.from(keyStr.slice(-64), 'hex');\n\t  let ciphertext = Buffer.from(encrypted, 'base64');\n\n\t  const nonce = ciphertext.subarray(0, 12);\n\t  const authTag = ciphertext.subarray(-16);\n\t  ciphertext = ciphertext.subarray(12, -16);\n\n\t  try {\n\t    const aesgcm = crypto.createDecipheriv('aes-256-gcm', key, nonce);\n\t    aesgcm.setAuthTag(authTag);\n\t    return `${aesgcm.update(ciphertext)}${aesgcm.final()}`\n\t  } catch (error) {\n\t    const isRange = error instanceof RangeError;\n\t    const invalidKeyLength = error.message === 'Invalid key length';\n\t    const decryptionFailed = error.message === 'Unsupported state or unable to authenticate data';\n\n\t    if (isRange || invalidKeyLength) {\n\t      const err = new Error('INVALID_DOTENV_KEY: It must be 64 characters long (or more)');\n\t      err.code = 'INVALID_DOTENV_KEY';\n\t      throw err\n\t    } else if (decryptionFailed) {\n\t      const err = new Error('DECRYPTION_FAILED: Please check your DOTENV_KEY');\n\t      err.code = 'DECRYPTION_FAILED';\n\t      throw err\n\t    } else {\n\t      throw error\n\t    }\n\t  }\n\t}\n\n\t// Populate process.env with parsed values\n\tfunction populate (processEnv, parsed, options = {}) {\n\t  const debug = Boolean(options && options.debug);\n\t  const override = Boolean(options && options.override);\n\n\t  if (typeof parsed !== 'object') {\n\t    const err = new Error('OBJECT_REQUIRED: Please check the processEnv argument being passed to populate');\n\t    err.code = 'OBJECT_REQUIRED';\n\t    throw err\n\t  }\n\n\t  // Set process.env\n\t  for (const key of Object.keys(parsed)) {\n\t    if (Object.prototype.hasOwnProperty.call(processEnv, key)) {\n\t      if (override === true) {\n\t        processEnv[key] = parsed[key];\n\t      }\n\n\t      if (debug) {\n\t        if (override === true) {\n\t          _debug(`\"${key}\" is already defined and WAS overwritten`);\n\t        } else {\n\t          _debug(`\"${key}\" is already defined and was NOT overwritten`);\n\t        }\n\t      }\n\t    } else {\n\t      processEnv[key] = parsed[key];\n\t    }\n\t  }\n\t}\n\n\tconst DotenvModule = {\n\t  configDotenv,\n\t  _configVault,\n\t  _parseVault,\n\t  config,\n\t  decrypt,\n\t  parse,\n\t  populate\n\t};\n\n\tmain.exports.configDotenv = DotenvModule.configDotenv;\n\tmain.exports._configVault = DotenvModule._configVault;\n\tmain.exports._parseVault = DotenvModule._parseVault;\n\tmain.exports.config = DotenvModule.config;\n\tmain.exports.decrypt = DotenvModule.decrypt;\n\tmain.exports.parse = DotenvModule.parse;\n\tmain.exports.populate = DotenvModule.populate;\n\n\tmain.exports = DotenvModule;\n\treturn main.exports;\n}\n\nvar envOptions;\nvar hasRequiredEnvOptions;\n\nfunction requireEnvOptions () {\n\tif (hasRequiredEnvOptions) return envOptions;\n\thasRequiredEnvOptions = 1;\n\t// ../config.js accepts options via environment variables\n\tconst options = {};\n\n\tif (process.env.DOTENV_CONFIG_ENCODING != null) {\n\t  options.encoding = process.env.DOTENV_CONFIG_ENCODING;\n\t}\n\n\tif (process.env.DOTENV_CONFIG_PATH != null) {\n\t  options.path = process.env.DOTENV_CONFIG_PATH;\n\t}\n\n\tif (process.env.DOTENV_CONFIG_DEBUG != null) {\n\t  options.debug = process.env.DOTENV_CONFIG_DEBUG;\n\t}\n\n\tif (process.env.DOTENV_CONFIG_OVERRIDE != null) {\n\t  options.override = process.env.DOTENV_CONFIG_OVERRIDE;\n\t}\n\n\tif (process.env.DOTENV_CONFIG_DOTENV_KEY != null) {\n\t  options.DOTENV_KEY = process.env.DOTENV_CONFIG_DOTENV_KEY;\n\t}\n\n\tenvOptions = options;\n\treturn envOptions;\n}\n\nvar cliOptions;\nvar hasRequiredCliOptions;\n\nfunction requireCliOptions () {\n\tif (hasRequiredCliOptions) return cliOptions;\n\thasRequiredCliOptions = 1;\n\tconst re = /^dotenv_config_(encoding|path|debug|override|DOTENV_KEY)=(.+)$/;\n\n\tcliOptions = function optionMatcher (args) {\n\t  return args.reduce(function (acc, cur) {\n\t    const matches = cur.match(re);\n\t    if (matches) {\n\t      acc[matches[1]] = matches[2];\n\t    }\n\t    return acc\n\t  }, {})\n\t};\n\treturn cliOptions;\n}\n\nvar hasRequiredConfig;\n\nfunction requireConfig () {\n\tif (hasRequiredConfig) return config;\n\thasRequiredConfig = 1;\n\t(function () {\n\t  requireMain().config(\n\t    Object.assign(\n\t      {},\n\t      requireEnvOptions(),\n\t      requireCliOptions()(process.argv)\n\t    )\n\t  );\n\t})();\n\treturn config;\n}\n\nrequireConfig();\n\nconst nodeEnv = z.object({\n    NODE_ENV: z\n        .union([\n        z.literal('test'),\n        z.literal('development'),\n        z.literal('production')\n    ])\n        .default('development')\n});\nconst logModes = z.enum(['off', 'console', 'file', 'all']);\nconst loggingSchema = z.object({\n    LOG_MODE: logModes.default('off'),\n    LOG_LEVEL: z.string().default('info')\n});\nconst sdkApiSchema = z.object({\n    ONEGREP_API_KEY: z.string().optional(),\n    ONEGREP_API_URL: z.string().url().default('https://test-sandbox.onegrep.dev')\n});\nconst configSchema = z.object({\n    ONEGREP_CONFIG_DIR: z.string().optional()\n});\nconst loggingEnvSchema = nodeEnv.merge(loggingSchema);\nconst envSchema = loggingEnvSchema.merge(sdkApiSchema);\nfunction getEnv(envSchema) {\n    return envSchema.strip().parse(process.env);\n}\nconst getEnvIssues = (envSchema) => {\n    const result = envSchema.strip().safeParse(process.env);\n    if (!result.success)\n        return result.error.issues;\n};\n\nconst getConfigDir = () => {\n    const env = getEnv(configSchema);\n    if (env.ONEGREP_CONFIG_DIR) {\n        return env.ONEGREP_CONFIG_DIR;\n    }\n    return path.join(require$$2.homedir(), '.onegrep');\n};\nconst initConfigDir = () => {\n    const userCfgDir = getConfigDir();\n    if (!fs.existsSync(userCfgDir)) {\n        fs.mkdirSync(userCfgDir, { recursive: true });\n    }\n    return userCfgDir;\n};\n\nvar src = {};\n\nvar hasRequiredSrc;\n\nfunction requireSrc () {\n\tif (hasRequiredSrc) return src;\n\thasRequiredSrc = 1;\n\tObject.defineProperty(src, \"__esModule\", { value: true });\n\tsrc.dummyLogger = void 0;\n\t/**\n\t * Dummy logger that does not do anything.\n\t *\n\t * Useful as a default for some library that the user might want to get logs out of.\n\t */\n\tsrc.dummyLogger = {\n\t    trace: function (_message) {\n\t    },\n\t    debug: function (_message) {\n\t    },\n\t    info: function (_message) {\n\t    },\n\t    warn: function (_message) {\n\t    },\n\t    error: function (_message) {\n\t    },\n\t};\n\t\n\treturn src;\n}\n\nvar srcExports = requireSrc();\n\nvar loglevel$2 = {exports: {}};\n\n/*\n* loglevel - https://github.com/pimterry/loglevel\n*\n* Copyright (c) 2013 Tim Perry\n* Licensed under the MIT license.\n*/\nvar loglevel$1 = loglevel$2.exports;\n\nvar hasRequiredLoglevel;\n\nfunction requireLoglevel () {\n\tif (hasRequiredLoglevel) return loglevel$2.exports;\n\thasRequiredLoglevel = 1;\n\t(function (module) {\n\t\t(function (root, definition) {\n\t\t    if (module.exports) {\n\t\t        module.exports = definition();\n\t\t    } else {\n\t\t        root.log = definition();\n\t\t    }\n\t\t}(loglevel$1, function () {\n\n\t\t    // Slightly dubious tricks to cut down minimized file size\n\t\t    var noop = function() {};\n\t\t    var undefinedType = \"undefined\";\n\t\t    var isIE = (typeof window !== undefinedType) && (typeof window.navigator !== undefinedType) && (\n\t\t        /Trident\\/|MSIE /.test(window.navigator.userAgent)\n\t\t    );\n\n\t\t    var logMethods = [\n\t\t        \"trace\",\n\t\t        \"debug\",\n\t\t        \"info\",\n\t\t        \"warn\",\n\t\t        \"error\"\n\t\t    ];\n\n\t\t    var _loggersByName = {};\n\t\t    var defaultLogger = null;\n\n\t\t    // Cross-browser bind equivalent that works at least back to IE6\n\t\t    function bindMethod(obj, methodName) {\n\t\t        var method = obj[methodName];\n\t\t        if (typeof method.bind === 'function') {\n\t\t            return method.bind(obj);\n\t\t        } else {\n\t\t            try {\n\t\t                return Function.prototype.bind.call(method, obj);\n\t\t            } catch (e) {\n\t\t                // Missing bind shim or IE8 + Modernizr, fallback to wrapping\n\t\t                return function() {\n\t\t                    return Function.prototype.apply.apply(method, [obj, arguments]);\n\t\t                };\n\t\t            }\n\t\t        }\n\t\t    }\n\n\t\t    // Trace() doesn't print the message in IE, so for that case we need to wrap it\n\t\t    function traceForIE() {\n\t\t        if (console.log) {\n\t\t            if (console.log.apply) {\n\t\t                console.log.apply(console, arguments);\n\t\t            } else {\n\t\t                // In old IE, native console methods themselves don't have apply().\n\t\t                Function.prototype.apply.apply(console.log, [console, arguments]);\n\t\t            }\n\t\t        }\n\t\t        if (console.trace) console.trace();\n\t\t    }\n\n\t\t    // Build the best logging method possible for this env\n\t\t    // Wherever possible we want to bind, not wrap, to preserve stack traces\n\t\t    function realMethod(methodName) {\n\t\t        if (methodName === 'debug') {\n\t\t            methodName = 'log';\n\t\t        }\n\n\t\t        if (typeof console === undefinedType) {\n\t\t            return false; // No method possible, for now - fixed later by enableLoggingWhenConsoleArrives\n\t\t        } else if (methodName === 'trace' && isIE) {\n\t\t            return traceForIE;\n\t\t        } else if (console[methodName] !== undefined) {\n\t\t            return bindMethod(console, methodName);\n\t\t        } else if (console.log !== undefined) {\n\t\t            return bindMethod(console, 'log');\n\t\t        } else {\n\t\t            return noop;\n\t\t        }\n\t\t    }\n\n\t\t    // These private functions always need `this` to be set properly\n\n\t\t    function replaceLoggingMethods() {\n\t\t        /*jshint validthis:true */\n\t\t        var level = this.getLevel();\n\n\t\t        // Replace the actual methods.\n\t\t        for (var i = 0; i < logMethods.length; i++) {\n\t\t            var methodName = logMethods[i];\n\t\t            this[methodName] = (i < level) ?\n\t\t                noop :\n\t\t                this.methodFactory(methodName, level, this.name);\n\t\t        }\n\n\t\t        // Define log.log as an alias for log.debug\n\t\t        this.log = this.debug;\n\n\t\t        // Return any important warnings.\n\t\t        if (typeof console === undefinedType && level < this.levels.SILENT) {\n\t\t            return \"No console available for logging\";\n\t\t        }\n\t\t    }\n\n\t\t    // In old IE versions, the console isn't present until you first open it.\n\t\t    // We build realMethod() replacements here that regenerate logging methods\n\t\t    function enableLoggingWhenConsoleArrives(methodName) {\n\t\t        return function () {\n\t\t            if (typeof console !== undefinedType) {\n\t\t                replaceLoggingMethods.call(this);\n\t\t                this[methodName].apply(this, arguments);\n\t\t            }\n\t\t        };\n\t\t    }\n\n\t\t    // By default, we use closely bound real methods wherever possible, and\n\t\t    // otherwise we wait for a console to appear, and then try again.\n\t\t    function defaultMethodFactory(methodName, _level, _loggerName) {\n\t\t        /*jshint validthis:true */\n\t\t        return realMethod(methodName) ||\n\t\t               enableLoggingWhenConsoleArrives.apply(this, arguments);\n\t\t    }\n\n\t\t    function Logger(name, factory) {\n\t\t      // Private instance variables.\n\t\t      var self = this;\n\t\t      /**\n\t\t       * The level inherited from a parent logger (or a global default). We\n\t\t       * cache this here rather than delegating to the parent so that it stays\n\t\t       * in sync with the actual logging methods that we have installed (the\n\t\t       * parent could change levels but we might not have rebuilt the loggers\n\t\t       * in this child yet).\n\t\t       * @type {number}\n\t\t       */\n\t\t      var inheritedLevel;\n\t\t      /**\n\t\t       * The default level for this logger, if any. If set, this overrides\n\t\t       * `inheritedLevel`.\n\t\t       * @type {number|null}\n\t\t       */\n\t\t      var defaultLevel;\n\t\t      /**\n\t\t       * A user-specific level for this logger. If set, this overrides\n\t\t       * `defaultLevel`.\n\t\t       * @type {number|null}\n\t\t       */\n\t\t      var userLevel;\n\n\t\t      var storageKey = \"loglevel\";\n\t\t      if (typeof name === \"string\") {\n\t\t        storageKey += \":\" + name;\n\t\t      } else if (typeof name === \"symbol\") {\n\t\t        storageKey = undefined;\n\t\t      }\n\n\t\t      function persistLevelIfPossible(levelNum) {\n\t\t          var levelName = (logMethods[levelNum] || 'silent').toUpperCase();\n\n\t\t          if (typeof window === undefinedType || !storageKey) return;\n\n\t\t          // Use localStorage if available\n\t\t          try {\n\t\t              window.localStorage[storageKey] = levelName;\n\t\t              return;\n\t\t          } catch (ignore) {}\n\n\t\t          // Use session cookie as fallback\n\t\t          try {\n\t\t              window.document.cookie =\n\t\t                encodeURIComponent(storageKey) + \"=\" + levelName + \";\";\n\t\t          } catch (ignore) {}\n\t\t      }\n\n\t\t      function getPersistedLevel() {\n\t\t          var storedLevel;\n\n\t\t          if (typeof window === undefinedType || !storageKey) return;\n\n\t\t          try {\n\t\t              storedLevel = window.localStorage[storageKey];\n\t\t          } catch (ignore) {}\n\n\t\t          // Fallback to cookies if local storage gives us nothing\n\t\t          if (typeof storedLevel === undefinedType) {\n\t\t              try {\n\t\t                  var cookie = window.document.cookie;\n\t\t                  var cookieName = encodeURIComponent(storageKey);\n\t\t                  var location = cookie.indexOf(cookieName + \"=\");\n\t\t                  if (location !== -1) {\n\t\t                      storedLevel = /^([^;]+)/.exec(\n\t\t                          cookie.slice(location + cookieName.length + 1)\n\t\t                      )[1];\n\t\t                  }\n\t\t              } catch (ignore) {}\n\t\t          }\n\n\t\t          // If the stored level is not valid, treat it as if nothing was stored.\n\t\t          if (self.levels[storedLevel] === undefined) {\n\t\t              storedLevel = undefined;\n\t\t          }\n\n\t\t          return storedLevel;\n\t\t      }\n\n\t\t      function clearPersistedLevel() {\n\t\t          if (typeof window === undefinedType || !storageKey) return;\n\n\t\t          // Use localStorage if available\n\t\t          try {\n\t\t              window.localStorage.removeItem(storageKey);\n\t\t          } catch (ignore) {}\n\n\t\t          // Use session cookie as fallback\n\t\t          try {\n\t\t              window.document.cookie =\n\t\t                encodeURIComponent(storageKey) + \"=; expires=Thu, 01 Jan 1970 00:00:00 UTC\";\n\t\t          } catch (ignore) {}\n\t\t      }\n\n\t\t      function normalizeLevel(input) {\n\t\t          var level = input;\n\t\t          if (typeof level === \"string\" && self.levels[level.toUpperCase()] !== undefined) {\n\t\t              level = self.levels[level.toUpperCase()];\n\t\t          }\n\t\t          if (typeof level === \"number\" && level >= 0 && level <= self.levels.SILENT) {\n\t\t              return level;\n\t\t          } else {\n\t\t              throw new TypeError(\"log.setLevel() called with invalid level: \" + input);\n\t\t          }\n\t\t      }\n\n\t\t      /*\n\t\t       *\n\t\t       * Public logger API - see https://github.com/pimterry/loglevel for details\n\t\t       *\n\t\t       */\n\n\t\t      self.name = name;\n\n\t\t      self.levels = { \"TRACE\": 0, \"DEBUG\": 1, \"INFO\": 2, \"WARN\": 3,\n\t\t          \"ERROR\": 4, \"SILENT\": 5};\n\n\t\t      self.methodFactory = factory || defaultMethodFactory;\n\n\t\t      self.getLevel = function () {\n\t\t          if (userLevel != null) {\n\t\t            return userLevel;\n\t\t          } else if (defaultLevel != null) {\n\t\t            return defaultLevel;\n\t\t          } else {\n\t\t            return inheritedLevel;\n\t\t          }\n\t\t      };\n\n\t\t      self.setLevel = function (level, persist) {\n\t\t          userLevel = normalizeLevel(level);\n\t\t          if (persist !== false) {  // defaults to true\n\t\t              persistLevelIfPossible(userLevel);\n\t\t          }\n\n\t\t          // NOTE: in v2, this should call rebuild(), which updates children.\n\t\t          return replaceLoggingMethods.call(self);\n\t\t      };\n\n\t\t      self.setDefaultLevel = function (level) {\n\t\t          defaultLevel = normalizeLevel(level);\n\t\t          if (!getPersistedLevel()) {\n\t\t              self.setLevel(level, false);\n\t\t          }\n\t\t      };\n\n\t\t      self.resetLevel = function () {\n\t\t          userLevel = null;\n\t\t          clearPersistedLevel();\n\t\t          replaceLoggingMethods.call(self);\n\t\t      };\n\n\t\t      self.enableAll = function(persist) {\n\t\t          self.setLevel(self.levels.TRACE, persist);\n\t\t      };\n\n\t\t      self.disableAll = function(persist) {\n\t\t          self.setLevel(self.levels.SILENT, persist);\n\t\t      };\n\n\t\t      self.rebuild = function () {\n\t\t          if (defaultLogger !== self) {\n\t\t              inheritedLevel = normalizeLevel(defaultLogger.getLevel());\n\t\t          }\n\t\t          replaceLoggingMethods.call(self);\n\n\t\t          if (defaultLogger === self) {\n\t\t              for (var childName in _loggersByName) {\n\t\t                _loggersByName[childName].rebuild();\n\t\t              }\n\t\t          }\n\t\t      };\n\n\t\t      // Initialize all the internal levels.\n\t\t      inheritedLevel = normalizeLevel(\n\t\t          defaultLogger ? defaultLogger.getLevel() : \"WARN\"\n\t\t      );\n\t\t      var initialLevel = getPersistedLevel();\n\t\t      if (initialLevel != null) {\n\t\t          userLevel = normalizeLevel(initialLevel);\n\t\t      }\n\t\t      replaceLoggingMethods.call(self);\n\t\t    }\n\n\t\t    /*\n\t\t     *\n\t\t     * Top-level API\n\t\t     *\n\t\t     */\n\n\t\t    defaultLogger = new Logger();\n\n\t\t    defaultLogger.getLogger = function getLogger(name) {\n\t\t        if ((typeof name !== \"symbol\" && typeof name !== \"string\") || name === \"\") {\n\t\t            throw new TypeError(\"You must supply a name when creating a logger.\");\n\t\t        }\n\n\t\t        var logger = _loggersByName[name];\n\t\t        if (!logger) {\n\t\t            logger = _loggersByName[name] = new Logger(\n\t\t                name,\n\t\t                defaultLogger.methodFactory\n\t\t            );\n\t\t        }\n\t\t        return logger;\n\t\t    };\n\n\t\t    // Grab the current global log variable in case of overwrite\n\t\t    var _log = (typeof window !== undefinedType) ? window.log : undefined;\n\t\t    defaultLogger.noConflict = function() {\n\t\t        if (typeof window !== undefinedType &&\n\t\t               window.log === defaultLogger) {\n\t\t            window.log = _log;\n\t\t        }\n\n\t\t        return defaultLogger;\n\t\t    };\n\n\t\t    defaultLogger.getLoggers = function getLoggers() {\n\t\t        return _loggersByName;\n\t\t    };\n\n\t\t    // ES6 default export, for compatibility\n\t\t    defaultLogger['default'] = defaultLogger;\n\n\t\t    return defaultLogger;\n\t\t})); \n\t} (loglevel$2));\n\treturn loglevel$2.exports;\n}\n\nvar loglevelExports = requireLoglevel();\nvar loglevel = /*@__PURE__*/getDefaultExportFromCjs(loglevelExports);\n\nfunction consoleLogger(loggerName, logLevel) {\n    let logger = loglevel;\n    if (loggerName) {\n        logger = loglevel.getLogger(loggerName);\n    }\n    if (logLevel) {\n        logger.setLevel(logLevel);\n    }\n    class LoggerInstance {\n        trace(message, ...optionalParams) {\n            logger.trace(chalk.dim(chalk.gray(message)), ...optionalParams);\n        }\n        debug(message, ...optionalParams) {\n            logger.debug(chalk.dim(chalk.yellow(message)), ...optionalParams);\n        }\n        info(message, ...optionalParams) {\n            logger.info(chalk.blue(message), ...optionalParams);\n        }\n        warn(message, ...optionalParams) {\n            logger.warn(chalk.magenta(message), ...optionalParams);\n        }\n        error(message, ...optionalParams) {\n            logger.error(chalk.red(message), ...optionalParams);\n        }\n    }\n    return new LoggerInstance();\n}\n\nconst getLogFilepath = (filename) => {\n    const configDir = initConfigDir();\n    return path.join(configDir, filename);\n};\nconst clearLogFile = (filename) => {\n    const logFilepath = getLogFilepath(filename);\n    fs.writeFileSync(logFilepath, '');\n};\nconst levelString = (level) => {\n    const levelString = Object.keys(loglevel.levels).find((key) => loglevel.levels[key] === level);\n    if (!levelString) {\n        throw new Error(`Invalid log level: ${level}`);\n    }\n    return levelString.toUpperCase();\n};\nconst formatMessage = (loglevel, message, ...optionalParams) => {\n    if (typeof message === 'object') {\n        message = JSON.stringify(message, null, 2);\n    }\n    const logLine = `${new Date().toISOString()} ${levelString(loglevel).padEnd(5)}: ${message}\\n`;\n    if (optionalParams.length === 0) {\n        return logLine;\n    }\n    const formattedParams = optionalParams\n        .map((param) => typeof param === 'object' ? JSON.stringify(param, null, 2) : param)\n        .join('\\n');\n    return [logLine, formattedParams].join('\\n');\n};\nfunction fileLogger(loggerName, logLevel) {\n    let logger = loglevel;\n    if (loggerName) {\n        logger = loglevel.getLogger(loggerName);\n    }\n    if (logLevel) {\n        logger.setLevel(logLevel);\n    }\n    let logFilepath = getLogFilepath('console.log');\n    if (loggerName) {\n        logFilepath = getLogFilepath(`onegrep.${loggerName}.log`);\n    }\n    const shouldLogMessage = (messageLevel) => {\n        return messageLevel >= logger.getLevel();\n    };\n    const fileOutput = fs.createWriteStream(logFilepath, { flags: 'w' });\n    class LoggerInstance {\n        trace(message, ...optionalParams) {\n            const messageLevel = loglevel.levels.TRACE;\n            if (shouldLogMessage(messageLevel)) {\n                fileOutput.write(`${formatMessage(messageLevel, message, ...optionalParams)}`);\n            }\n        }\n        debug(message, ...optionalParams) {\n            const messageLevel = loglevel.levels.DEBUG;\n            if (shouldLogMessage(messageLevel)) {\n                fileOutput.write(`${formatMessage(messageLevel, message, ...optionalParams)}`);\n            }\n        }\n        info(message, ...optionalParams) {\n            const messageLevel = loglevel.levels.INFO;\n            if (shouldLogMessage(messageLevel)) {\n                fileOutput.write(`${formatMessage(messageLevel, message, ...optionalParams)}`);\n            }\n        }\n        warn(message, ...optionalParams) {\n            const messageLevel = loglevel.levels.WARN;\n            if (shouldLogMessage(messageLevel)) {\n                fileOutput.write(`${formatMessage(messageLevel, message, ...optionalParams)}`);\n            }\n        }\n        error(message, ...optionalParams) {\n            const messageLevel = loglevel.levels.ERROR;\n            if (shouldLogMessage(messageLevel)) {\n                fileOutput.write(`${formatMessage(messageLevel, message, ...optionalParams)}`);\n            }\n        }\n    }\n    return new LoggerInstance();\n}\n\nfunction multiLogger(loggers) {\n    class LoggerInstance {\n        trace(message, ...optionalParams) {\n            for (const logger of loggers) {\n                logger.trace(message, ...optionalParams);\n            }\n        }\n        debug(message, ...optionalParams) {\n            for (const logger of loggers) {\n                logger.debug(message, ...optionalParams);\n            }\n        }\n        info(message, ...optionalParams) {\n            for (const logger of loggers) {\n                logger.info(message, ...optionalParams);\n            }\n        }\n        warn(message, ...optionalParams) {\n            for (const logger of loggers) {\n                logger.warn(message, ...optionalParams);\n            }\n        }\n        error(message, ...optionalParams) {\n            for (const logger of loggers) {\n                logger.error(message, ...optionalParams);\n            }\n        }\n    }\n    return new LoggerInstance();\n}\n\nconst asConsole = (logger) => {\n    return {\n        log: logger.info.bind(logger),\n        debug: logger.debug.bind(logger),\n        info: logger.info.bind(logger),\n        warn: logger.warn.bind(logger),\n        error: logger.error.bind(logger)\n    };\n};\nconst silentLogger = srcExports.dummyLogger;\nfunction getLogger(logMode, loggerName, logLevelName) {\n    let logger;\n    const logLevelDesc = logLevelName;\n    if (logMode === 'off') {\n        logger = silentLogger;\n    }\n    else if (logMode === 'console') {\n        logger = consoleLogger(loggerName, logLevelDesc);\n    }\n    else if (logMode === 'file') {\n        logger = fileLogger(loggerName, logLevelDesc);\n    }\n    else if (logMode === 'all') {\n        const allLoggers = [\n            consoleLogger(loggerName, logLevelDesc),\n            fileLogger(loggerName, logLevelDesc)\n        ];\n        logger = multiLogger(allLoggers);\n    }\n    else {\n        throw new Error(`Unsupported log mode: ${logMode}`);\n    }\n    logger.debug(`${loggerName ?? 'Root'} logger initialized with log level ${logLevelName}`);\n    return logger;\n}\nconst initRootLogger = () => {\n    const issues = getEnvIssues(loggingEnvSchema);\n    if (issues) {\n        console.error('Invalid environment variables:', issues);\n        process.exit(1);\n    }\n    const env = getEnv(loggingEnvSchema);\n    try {\n        return getLogger(env.LOG_MODE, undefined, env.LOG_LEVEL);\n    }\n    catch (error) {\n        console.error('Failed to initialize requested log mode, using console log mode', error);\n        return consoleLogger();\n    }\n};\nconst rootLogger = initRootLogger();\nfunction wrapConsole() {\n    console = asConsole(rootLogger);\n}\n\nexport { asConsole, clearLogFile, configSchema, consoleLogger, envSchema, fileLogger, getConfigDir, getEnv, getEnvIssues, getLogFilepath, getLogger, initConfigDir, logModes, loggingEnvSchema, loggingSchema, multiLogger, nodeEnv, rootLogger, sdkApiSchema, silentLogger, wrapConsole };\n","import {\n  getLogger,\n  loggingSchema,\n  getConfigDir as getConfigDirUtils,\n  initConfigDir as initConfigDirUtils,\n  getEnv,\n  getEnvIssues\n} from '@repo/utils'\n\nexport { getEnv, getEnvIssues }\n\nexport const getChildLogger = (loggerName: string, logLevelName?: string) => {\n  const env = getEnv(loggingSchema)\n  return getLogger(env.LOG_MODE, loggerName, logLevelName)\n}\n\nexport const getConfigDir = () => {\n  return getConfigDirUtils()\n}\n\nexport const initConfigDir = () => {\n  return initConfigDirUtils()\n}\n","import { Keyv } from 'keyv'\nimport { Cache, createCache } from 'cache-manager'\nimport { OneGrepApiHighLevelClient } from './api/high.js'\nimport { log } from './log.js'\n\nexport type Flags = Record<string, FlagValue>\nexport type FlagValue = string | boolean\n\nexport class FlagsProvider {\n  private flagsCache: Cache\n\n  constructor(private readonly apiClient: OneGrepApiHighLevelClient) {\n    this.flagsCache = createCache({\n      cacheId: 'flags',\n      stores: [\n        new Keyv({ ttl: 1000 * 60 }) // 1 minute\n      ]\n    })\n  }\n\n  private async getAuthenticatedUserId(): Promise<string | undefined> {\n    const authStatus = await this.apiClient.authStatus()\n    if (authStatus.is_authenticated) {\n      return authStatus.user_id! as string // ! Should be a string if authenticated\n    } else {\n      return undefined\n    }\n  }\n\n  async all(): Promise<Flags> {\n    const user_id = await this.getAuthenticatedUserId()\n    if (!user_id) {\n      log.warn(\n        'No authenticated user id found for flags: returning empty flags'\n      )\n      return {}\n    }\n\n    // Cache flags by user_id in case the SDK is used in a multi-user environment\n    return this.flagsCache.wrap(user_id, async () => {\n      return await this.apiClient.getFlags()\n    })\n  }\n\n  async value(flagName: string): Promise<FlagValue | undefined> {\n    const flags = await this.all()\n    return flags[flagName]\n  }\n}\n\nexport const getFlagsProvider = (\n  apiClient: OneGrepApiHighLevelClient\n): FlagsProvider => {\n  return new FlagsProvider(apiClient)\n}\n","// This file is auto-generated by @hey-api/openapi-ts\n\nimport { z } from 'zod'\n\n/**\n * ValidationError\n */\nexport const zValidationError = z.object({\n  loc: z.array(z.union([z.string(), z.number().int()])),\n  msg: z.string(),\n  type: z.string()\n})\n\n/**\n * UserAccount\n * Model for storing user information including their API key\n */\nexport const zUserAccount = z.object({\n  api_key: z.string(),\n  belongs_to_organization_id: z.union([z.string(), z.null()]).optional(),\n  created_at: z.union([z.string().datetime(), z.null()]).optional(),\n  doppler_service_token_id: z.union([z.string().uuid(), z.null()]).optional(),\n  id: z.string(),\n  updated_at: z.union([z.string().datetime(), z.null()]).optional()\n})\n\n/**\n * UpsertSecretResponse\n */\nexport const zUpsertSecretResponse = z.object({\n  secret_name: z.string(),\n  success: z.boolean()\n})\n\n/**\n * UpsertSecretRequest\n */\nexport const zUpsertSecretRequest = z.object({\n  value: z.union([z.string(), z.object({})]),\n  value_type: z.enum(['string', 'object'])\n})\n\n/**\n * ToolprintToolReference\n * A reference to a tool that is used in a toolprint. This reference can link to a tool directly by a unique identifier or indirectly through\n * a link to the tool server as well as the name of the tool. The latter reference is experimental and relies on the implementor\n * to ensure that the reference is correctly followed.\n */\nexport const zToolprintToolReference = z.object({\n  id: z.union([z.string().uuid(), z.null()]).optional(),\n  name: z.string(),\n  ref_type: z.union([z.enum(['local', 'id']), z.null()]).optional()\n})\n\n/**\n * ToolprintTool\n * A definition of how a specific tool should be used within a toolprint.\n * This is a simplified model that focuses on the conceptual structure and specifically\n * avoids referential fields to any persisted entities.\n *\n * This tool reference is limited to the server or integration in which the toolprint was defined.\n */\nexport const zToolprintTool = z.object({\n  ref: zToolprintToolReference,\n  usage_hints: z.union([z.string(), z.null()]).optional()\n})\n\n/**\n * SearchResultMeta\n * Metadata about a search result. All search result types should inherit from this model.\n */\nexport const zSearchResultMeta = z.object({\n  score: z.number()\n})\n\n/**\n * Prompt\n * A prompt for an LLM.\n */\nexport const zPrompt = z.object({\n  message: z.string(),\n  type: z.enum(['system', 'user'])\n})\n\n/**\n * ToolprintMeta\n * A set of meta fields that are common to all toolprints.\n */\nexport const zToolprintMetaOutput = z.object({\n  language: z.literal('en-US').optional().default('en-US'),\n  name: z.string(),\n  resource_id: z.union([z.string(), z.null()]).optional(),\n  version: z.string().optional().default('0.0.1')\n})\n\n/**\n * Toolprint\n * A declarative definition of a toolprint that describes how tools should be used together\n * to achieve a goal. This is a simplified model that focuses on the conceptual structure and specifically\n * avoids referential fields to any persisted entities.\n */\nexport const zToolprintOutput = z.object({\n  goal: z.string(),\n  instructions: z.union([z.string(), z.null()]),\n  meta: zToolprintMetaOutput,\n  tools: z.array(zToolprintTool)\n})\n\n/**\n * Tool\n * A tool.\n */\nexport const zTool = z.object({\n  description: z.union([z.string(), z.null()]).optional(),\n  icon_url: z.union([z.string().url().min(1), z.null()]).optional(),\n  id: z.string().uuid(),\n  input_schema: z.union([z.object({}), z.boolean()]).optional(),\n  name: z.string(),\n  server_id: z.string().uuid()\n})\n\n/**\n * RegisteredToolprint\n * A toolprint.\n */\nexport const zRegisteredToolprint = z.object({\n  created_at: z.union([z.string().datetime(), z.null()]).optional(),\n  created_by: z.string().optional(),\n  id: z.string().uuid().optional(),\n  owner_id: z.union([z.string(), z.null()]).optional(),\n  source: z.object({}).optional(),\n  source_checksum: z.string(),\n  toolprint: zToolprintOutput,\n  tools: z.array(zTool).readonly(),\n  updated_at: z.union([z.string().datetime(), z.null()]).optional(),\n  updated_by: z.union([z.string(), z.null()]).optional()\n})\n\n/**\n * ToolprintRecommendation\n * A recommendation for a toolprint based on a goal.\n */\nexport const zToolprintRecommendation = z.object({\n  meta: zSearchResultMeta,\n  prompts: z.array(zPrompt),\n  toolprint: zRegisteredToolprint\n})\n\n/**\n * ToolprintMeta\n * A set of meta fields that are common to all toolprints.\n */\nexport const zToolprintMetaInput = z.object({\n  language: z.literal('en-US').optional().default('en-US'),\n  name: z.string(),\n  resource_id: z.union([z.string().uuid(), z.null()]).optional(),\n  version: z.string().optional().default('0.0.1')\n})\n\n/**\n * Toolprint\n * A declarative definition of a toolprint that describes how tools should be used together\n * to achieve a goal. This is a simplified model that focuses on the conceptual structure and specifically\n * avoids referential fields to any persisted entities.\n */\nexport const zToolprintInput = z.object({\n  goal: z.string(),\n  instructions: z.union([z.string(), z.null()]),\n  meta: zToolprintMetaInput,\n  tools: z.array(zToolprintTool)\n})\n\n/**\n * ToolServerProvider\n */\nexport const zToolServerProvider = z.object({\n  id: z.string().uuid(),\n  name: z.string()\n})\n\n/**\n * ToolServerProperties\n * Properties for a tool server.\n */\nexport const zToolServerProperties = z.object({\n  properties: z.object({})\n})\n\n/**\n * ToolServerLaunchConfig\n * The launch config for a tool server.\n */\nexport const zToolServerLaunchConfig = z.object({\n  secret_name: z.string(),\n  source: z.literal('doppler')\n})\n\n/**\n * ToolServer\n */\nexport const zToolServer = z.object({\n  id: z.string().uuid(),\n  name: z.string(),\n  properties: z.object({}).optional(),\n  provider_id: z.string().uuid()\n})\n\n/**\n * CanonicalResource\n * Represents a canonical resource name in object form.\n */\nexport const zCanonicalResource = z.object({\n  event_name: z.string(),\n  org_id: z.string(),\n  profile_id: z.string(),\n  server_name: z.string()\n})\n\n/**\n * AccessPolicyType\n * Enum for access policy types\n */\nexport const zAccessPolicyType = z.enum([\n  'ALWAYS',\n  'NEVER',\n  'REQUIRES_PERMISSION'\n])\n\n/**\n * PolicyBase\n * Base model with shared policy fields\n */\nexport const zPolicyBase = z.object({\n  access_policy: zAccessPolicyType,\n  canonical_resource_name: z.string(),\n  description: z.union([z.string(), z.null()]).optional(),\n  event_name: z.string(),\n  organization_id: z.union([z.string(), z.null()]).optional()\n})\n\n/**\n * ToolProperties\n * Properties for a tool.\n */\nexport const zToolProperties = z.object({\n  tags: z.object({})\n})\n\n/**\n * ToolResource\n * A broad summary of details about a tool akin to a ToolResource.\n */\nexport const zToolResource = z.object({\n  canonical_resource: zCanonicalResource,\n  description: z.union([z.string(), z.null()]).optional(),\n  id: z.string(),\n  integration_name: z.string(),\n  org_id: z.string(),\n  policy: zPolicyBase,\n  profile_id: z.string(),\n  properties: zToolProperties,\n  provider: zToolServerProvider,\n  server: zToolServer,\n  tool: zTool,\n  tool_name: z.string()\n})\n\n/**\n * ToolCustomTagsParamsRequest\n * Params to change the tags for a tool in an integration. Will upsert any tags that already\n * exist. Will not delete any other tags. This is only net additive.\n */\nexport const zToolCustomTagsParamsRequest = z.object({\n  description: z.union([z.string(), z.null()]).optional(),\n  integration_name: z.string(),\n  tags: z.object({}),\n  tool_name: z.string()\n})\n\n/**\n * ToolCustomTagSelectionParamsRequest\n * Params that generalize the selection the tags for a tool in an integration.\n */\nexport const zToolCustomTagSelectionParamsRequest = z.object({\n  description: z.union([z.string(), z.null()]).optional(),\n  integration_name: z.string(),\n  tags: z.array(z.string()),\n  tool_name: z.string()\n})\n\n/**\n * Strategy\n * A model representing a result for a goal-based search.\n */\nexport const zStrategy = z.object({\n  instructions: z.string(),\n  recipe_id: z.string().uuid(),\n  tools: z.array(zToolResource)\n})\n\n/**\n * SmitheryConnectionInfo\n */\nexport const zSmitheryConnectionInfo = z.object({\n  config_schema: z.union([z.object({}), z.boolean()]).optional(),\n  deployment_url: z.string().url().min(1).optional(),\n  type: z.enum(['ws', 'http'])\n})\n\n/**\n * SmitheryToolServerClient\n * A client for a tool server that is a smithery server.\n */\nexport const zSmitheryToolServerClient = z.object({\n  client_type: z.literal('smithery'),\n  connections: z.array(zSmitheryConnectionInfo),\n  launch_config: z.union([zToolServerLaunchConfig, z.null()]).optional(),\n  server_id: z.string().uuid()\n})\n\n/**\n * ServiceTokenResponse\n * Response including the service token for the SDK to use.\n */\nexport const zServiceTokenResponse = z.object({\n  doppler_config: z.union([z.string(), z.null()]).optional(),\n  doppler_env: z.union([z.string(), z.null()]).optional(),\n  doppler_project: z.union([z.string(), z.null()]).optional(),\n  doppler_service_token: z.union([z.string(), z.null()]).optional()\n})\n\n/**\n * PaginationMetadata\n * Metadata for paginated results\n */\nexport const zPaginationMetadata = z.object({\n  has_next: z.boolean(),\n  has_prev: z.boolean(),\n  page: z.number().int(),\n  page_size: z.number().int(),\n  pages: z.number().int(),\n  total: z.number().int()\n})\n\n/**\n * ScoredItem[Tool]\n */\nexport const zScoredItemTool = z.object({\n  item: zTool,\n  score: z.number().gte(0).lte(1)\n})\n\n/**\n * SearchResponse[ScoredItem[Tool]]\n */\nexport const zSearchResponseScoredItemTool = z.object({\n  pagination: zPaginationMetadata,\n  results: z.array(zScoredItemTool)\n})\n\n/**\n * ScoredItem[RegisteredToolprint]\n */\nexport const zScoredItemRegisteredToolprint = z.object({\n  item: zRegisteredToolprint,\n  score: z.number().gte(0).lte(1)\n})\n\n/**\n * SearchResponse[ScoredItem[RegisteredToolprint]]\n */\nexport const zSearchResponseScoredItemRegisteredToolprint = z.object({\n  pagination: zPaginationMetadata,\n  results: z.array(zScoredItemRegisteredToolprint)\n})\n\n/**\n * SearchRequest\n * A request for a search.\n */\nexport const zSearchRequest = z.object({\n  k: z.number().int().optional().default(10),\n  min_score: z.number().optional().default(0),\n  page: z.number().int().optional().default(0),\n  page_size: z.number().int().optional().default(10),\n  query: z.string()\n})\n\n/**\n * Recipe\n * A recipe.\n */\nexport const zRecipe = z.object({\n  created_at: z.union([z.string().datetime(), z.null()]).optional(),\n  goal: z.string(),\n  id: z.string().uuid().optional(),\n  instructions: z.union([z.string(), z.null()]),\n  tools: z.array(zTool).readonly(),\n  updated_at: z.union([z.string().datetime(), z.null()]).optional()\n})\n\n/**\n * PolicyCheckResult\n * Result of a policy check\n */\nexport const zPolicyCheckResult = z.object({\n  approved: z.boolean()\n})\n\n/**\n * PolicyAccessRule\n * Policy template that is used to create a policy.\n */\nexport const zPolicyAccessRule = z.object({\n  access_policy: zAccessPolicyType,\n  description: z.union([z.string(), z.null()]).optional(),\n  event_name: z.string()\n})\n\n/**\n * Policy\n * Policy model that works with both SQL and in-memory storage\n */\nexport const zPolicy = z.object({\n  access_policy: zAccessPolicyType,\n  canonical_resource_name: z.string(),\n  created_at: z.union([z.string().datetime(), z.null()]).optional(),\n  description: z.union([z.string(), z.null()]).optional(),\n  event_name: z.string(),\n  id: z.string().uuid().optional(),\n  organization_id: z.union([z.string(), z.null()]).optional(),\n  updated_at: z.union([z.string().datetime(), z.null()]).optional()\n})\n\n/**\n * AuditLog\n * Model for audit logging\n */\nexport const zAuditLog = z.object({\n  action: z.string(),\n  details: z.object({}).optional(),\n  id: z.union([z.number().int(), z.null()]).optional(),\n  performed_by: z.string().optional().default('system'),\n  policy_id: z.string().uuid(),\n  timestamp: z.string().datetime().optional()\n})\n\n/**\n * PaginatedResponse[AuditLog]\n */\nexport const zPaginatedResponseAuditLog = z.object({\n  items: z.array(zAuditLog),\n  pagination: zPaginationMetadata\n})\n\n/**\n * Organization\n */\nexport const zOrganization = z.object({\n  created_at: z.union([z.string().datetime(), z.null()]).optional(),\n  created_by_user_id: z.union([z.string(), z.null()]).optional(),\n  id: z.string(),\n  open_invitation_code: z.union([z.string(), z.null()]).optional(),\n  owner_id: z.union([z.string(), z.null()]).optional(),\n  updated_at: z.union([z.string().datetime(), z.null()]).optional()\n})\n\n/**\n * NewPolicyRequest\n * Model to create a new policy. Other policy fields are derived from the default policy for the\n * integration/event\n */\nexport const zNewPolicyRequest = z.object({\n  access_policy: zAccessPolicyType,\n  event_name: z.string(),\n  integration_name: z.string()\n})\n\n/**\n * MultipleToolCustomTagsParamsRequest\n * Params to change the tags for multiple tools in an integration.\n */\nexport const zMultipleToolCustomTagsParamsRequest = z.object({\n  tags: z.object({}),\n  tool_names: z.array(z.string())\n})\n\n/**\n * MultiIdPostBody\n * A multi-id post body.\n */\nexport const zMultiIdPostBody = z.object({\n  ids: z.union([z.array(z.string()), z.array(z.string().uuid())])\n})\n\n/**\n * MCPToolServerClient\n * A client for a tool server that is a direct MCP server connection.\n */\nexport const zMcpToolServerClient = z.object({\n  client_type: z.literal('mcp'),\n  server_id: z.string().uuid(),\n  transport_type: z.enum(['sse', 'websocket']),\n  url: z.string().url().min(1)\n})\n\n/**\n * MCPIntegrationArgs\n * Arguments specifically for an integration that is powered by an MCP server.\n */\nexport const zMcpIntegrationArgs = z.object({\n  args: z.union([z.array(z.string()), z.null()]).optional(),\n  command: z.string(),\n  type: z.literal('mcp')\n})\n\n/**\n * IntegrationAuthScheme\n * Authentication schemes supported by server templates.\n */\nexport const zIntegrationAuthScheme = z.enum([\n  'token',\n  'oauth_1_0',\n  'oauth_2_0'\n])\n\n/**\n * IntegrationDefaultPolicies\n * Default policies for an integration.\n */\nexport const zIntegrationDefaultPolicies = z.object({\n  tools: z.array(zPolicyAccessRule)\n})\n\n/**\n * IntegrationOAuthAuthorizer\n */\nexport const zIntegrationOAuthAuthorizer = z.enum(['google', 'meta'])\n\n/**\n * IntegrationSecret\n * Represents a secret required by a server template.\n */\nexport const zIntegrationSecret = z.object({\n  generation_link: z.union([z.string(), z.null()]).optional(),\n  name: z.string(),\n  value: z.union([z.string(), z.null()]).optional()\n})\n\n/**\n * IntegrationTemplate\n * Class representation of the server templates that we support. This matches the structure\n * of server templates under resources/integrations/templates*\n */\nexport const zIntegrationTemplate = z.object({\n  args: z\n    .object({\n      type: z.literal('mcp')\n    })\n    .and(zMcpIntegrationArgs),\n  auth_scheme: z.union([zIntegrationAuthScheme, z.null()]).optional(),\n  default_policies: zIntegrationDefaultPolicies,\n  name: z.string(),\n  oauth_authorizer: z.union([zIntegrationOAuthAuthorizer, z.null()]).optional(),\n  repository: z.string(),\n  secrets: z.union([z.array(zIntegrationSecret), z.null()]).optional(),\n  sha: z.string(),\n  version: z.string()\n})\n\n/**\n * IntegrationConfigurationState\n * The state of an integration from an account perspective (not runtime).\n * To determine the runtime state, we will have to check the server configuration for\n * the integration separately depending on our infrastucture selection.\n */\nexport const zIntegrationConfigurationState = z.enum([\n  'agent_local',\n  'cloud_hosted_available',\n  'cloud_hosted_configured'\n])\n\n/**\n * IntegrationConfigDetails\n * General details about an integration. Meant to be surfaceable to a client.\n */\nexport const zIntegrationConfigDetails = z.object({\n  configuration_state: zIntegrationConfigurationState,\n  name: z.string(),\n  template: zIntegrationTemplate\n})\n\n/**\n * BlaxelToolServerClient\n * A client for a tool server that is a blaxel server.\n */\nexport const zBlaxelToolServerClient = z.object({\n  blaxel_function: z.string(),\n  blaxel_workspace: z.string(),\n  client_type: z.literal('blaxel'),\n  server_id: z.string().uuid()\n})\n\n/**\n * ComposioToolServerClient\n * A client for a tool server that is a composio server.\n */\nexport const zComposioToolServerClient = z.object({\n  allowed_tools: z.array(z.string()),\n  auth_config_id: z.string(),\n  client_type: z.literal('composio'),\n  composio_server_id: z.string(),\n  mcp_url: z.string(),\n  server_id: z.string().uuid()\n})\n\n/**\n * InitializeResponse\n * Response for the SDK to initialize.\n */\nexport const zInitializeResponse = z.object({\n  clients: z.array(\n    z.union([\n      z\n        .object({\n          client_type: z.literal('mcp')\n        })\n        .and(zMcpToolServerClient),\n      z\n        .object({\n          client_type: z.literal('blaxel')\n        })\n        .and(zBlaxelToolServerClient),\n      z\n        .object({\n          client_type: z.literal('smithery')\n        })\n        .and(zSmitheryToolServerClient),\n      z\n        .object({\n          client_type: z.literal('composio')\n        })\n        .and(zComposioToolServerClient)\n    ])\n  ),\n  doppler_config: z.union([z.string(), z.null()]).optional(),\n  doppler_env: z.union([z.string(), z.null()]).optional(),\n  doppler_project: z.union([z.string(), z.null()]).optional(),\n  doppler_service_token: z.union([z.string(), z.null()]).optional(),\n  org_id: z.string(),\n  providers: z.array(zToolServerProvider),\n  servers: z.array(zToolServer),\n  tools: z.array(zTool),\n  user_id: z.string()\n})\n\n/**\n * HTTPValidationError\n */\nexport const zHttpValidationError = z.object({\n  detail: z.array(zValidationError).optional()\n})\n\n/**\n * GetAllFlagsResponse\n */\nexport const zGetAllFlagsResponse = z.object({\n  flags: z.object({}),\n  user_id: z.string()\n})\n\n/**\n * Body_upsert_secret_api_v1_secrets__secret_name__put\n */\nexport const zBodyUpsertSecretApiV1SecretsSecretNamePut = z.object({\n  request: zUpsertSecretRequest\n})\n\n/**\n * BasicPostResponse\n * A basic post response.\n */\nexport const zBasicPostResponse = z.object({\n  message: z.union([z.string(), z.null()]).optional(),\n  success: z.boolean()\n})\n\n/**\n * BasicPostBody\n * A basic post body.\n */\nexport const zBasicPostBody = z.object({\n  content: z.string()\n})\n\n/**\n * AuthenticationMethod\n */\nexport const zAuthenticationMethod = z.enum(['propelauth', 'api_key'])\n\n/**\n * AuthenticationStatus\n */\nexport const zAuthenticationStatus = z.object({\n  credentials_provided: z.boolean(),\n  is_authenticated: z.boolean(),\n  method: z.union([zAuthenticationMethod, z.null()]).optional(),\n  user_id: z.union([z.string(), z.null()]).optional()\n})\n\n/**\n * ActionApprovalState\n * Enum for policy approval states\n */\nexport const zActionApprovalState = z.enum(['pending', 'approved', 'rejected'])\n\n/**\n * ActionApprovalRequest\n * Model that holds the state of a request for an action to be taken with respect to a policy.\n * Ex. if the policy is set to require approval, then we will have a request for approval.\n */\nexport const zActionApprovalRequest = z.object({\n  created_at: z.string().datetime().optional(),\n  id: z.union([z.number().int(), z.null()]),\n  last_updated_at: z.string().datetime().optional(),\n  payload: z.union([z.object({}), z.null()]).optional(),\n  policy_id: z.string().uuid(),\n  state: zActionApprovalState.optional(),\n  updated_by_user_id: z.string()\n})\n\n/**\n * ApprovalAndPolicy\n * Approval and policy\n */\nexport const zApprovalAndPolicy = z.object({\n  approval: zActionApprovalRequest,\n  canonical_resource_name: z.string(),\n  integration_name: z.string(),\n  policy: zPolicy,\n  tool_name: z.string()\n})\n\n/**\n * AccountInformation\n * Model for storing account information\n */\nexport const zAccountInformation = z.object({\n  account: zUserAccount,\n  organization: zOrganization,\n  user_id: z.string()\n})\n\n/**\n * AccountCreateRequest\n */\nexport const zAccountCreateRequest = z.object({\n  email: z.string(),\n  invitation_code: z.string()\n})\n\nexport const zGetAiDocumentationAiTxtGetData = z.object({\n  body: z.never().optional(),\n  path: z.never().optional(),\n  query: z.never().optional()\n})\n\n/**\n * Successful Response\n */\nexport const zGetAiDocumentationAiTxtGetResponse = z.string()\n\nexport const zDeleteAccountApiV1AccountDeleteData = z.object({\n  body: z.never().optional(),\n  path: z.never().optional(),\n  query: z.never().optional()\n})\n\n/**\n * Response Delete Account Api V1 Account  Delete\n * Successful Response\n */\nexport const zDeleteAccountApiV1AccountDeleteResponse = z.boolean()\n\nexport const zGetAccountInformationApiV1AccountGetData = z.object({\n  body: z.never().optional(),\n  path: z.never().optional(),\n  query: z.never().optional()\n})\n\n/**\n * Successful Response\n */\nexport const zGetAccountInformationApiV1AccountGetResponse = zAccountInformation\n\nexport const zCreateAccountApiV1AccountPostData = z.object({\n  body: z.never().optional(),\n  path: z.never().optional(),\n  query: z.never().optional()\n})\n\n/**\n * Successful Response\n */\nexport const zCreateAccountApiV1AccountPostResponse = zUserAccount\n\nexport const zGetApiKeyApiV1AccountApiKeyGetData = z.object({\n  body: z.never().optional(),\n  path: z.never().optional(),\n  query: z.never().optional()\n})\n\n/**\n * Successful Response\n */\nexport const zGetApiKeyApiV1AccountApiKeyGetResponse = zUserAccount\n\nexport const zGetAuthStatusApiV1AccountAuthStatusGetData = z.object({\n  body: z.never().optional(),\n  path: z.never().optional(),\n  query: z.never().optional()\n})\n\n/**\n * Successful Response\n */\nexport const zGetAuthStatusApiV1AccountAuthStatusGetResponse =\n  zAuthenticationStatus\n\nexport const zCreateAccountByInvitationApiV1AccountInvitationCodePostData =\n  z.object({\n    body: zAccountCreateRequest,\n    path: z.never().optional(),\n    query: z.never().optional()\n  })\n\n/**\n * Successful Response\n */\nexport const zCreateAccountByInvitationApiV1AccountInvitationCodePostResponse =\n  zAccountInformation\n\nexport const zGetServiceTokenApiV1AccountServiceTokenGetData = z.object({\n  body: z.never().optional(),\n  path: z.never().optional(),\n  query: z.never().optional()\n})\n\n/**\n * Successful Response\n */\nexport const zGetServiceTokenApiV1AccountServiceTokenGetResponse =\n  zServiceTokenResponse\n\nexport const zRotateServiceTokenApiV1AccountServiceTokenPostData = z.object({\n  body: z.never().optional(),\n  path: z.never().optional(),\n  query: z.never().optional()\n})\n\n/**\n * Successful Response\n */\nexport const zRotateServiceTokenApiV1AccountServiceTokenPostResponse =\n  zServiceTokenResponse\n\nexport const zGetAuditLogsApiV1AuditGetData = z.object({\n  body: z.never().optional(),\n  path: z.never().optional(),\n  query: z\n    .object({\n      page: z.number().int().gte(1).optional().default(1),\n      page_size: z.number().int().gte(1).lte(500).optional().default(100),\n      policy_id: z.union([z.string(), z.null()]).optional(),\n      action: z.union([z.string(), z.null()]).optional(),\n      start_date: z.union([z.string().datetime(), z.null()]).optional(),\n      end_date: z.union([z.string().datetime(), z.null()]).optional()\n    })\n    .optional()\n})\n\n/**\n * Successful Response\n */\nexport const zGetAuditLogsApiV1AuditGetResponse = zPaginatedResponseAuditLog\n\nexport const zGetAllFlagsApiV1FlagsGetData = z.object({\n  body: z.never().optional(),\n  path: z.never().optional(),\n  query: z.never().optional()\n})\n\n/**\n * Successful Response\n */\nexport const zGetAllFlagsApiV1FlagsGetResponse = zGetAllFlagsResponse\n\nexport const zListIntegrationsApiV1IntegrationsGetData = z.object({\n  body: z.never().optional(),\n  path: z.never().optional(),\n  query: z\n    .object({\n      active: z.boolean().optional().default(false)\n    })\n    .optional()\n})\n\n/**\n * Response List Integrations Api V1 Integrations  Get\n * Successful Response\n */\nexport const zListIntegrationsApiV1IntegrationsGetResponse = z.array(\n  zIntegrationConfigDetails\n)\n\nexport const zGetIntegrationToolsApiV1IntegrationsIntegrationNameToolsGetData =\n  z.object({\n    body: z.never().optional(),\n    path: z.object({\n      integration_name: z.string()\n    }),\n    query: z.never().optional()\n  })\n\n/**\n * Response Get Integration Tools Api V1 Integrations  Integration Name  Tools Get\n * Successful Response\n */\nexport const zGetIntegrationToolsApiV1IntegrationsIntegrationNameToolsGetResponse =\n  z.array(zToolResource)\n\nexport const zUpsertMultipleToolCustomTagsApiV1IntegrationsIntegrationNameToolsCustomTagsPostData =\n  z.object({\n    body: zMultipleToolCustomTagsParamsRequest,\n    path: z.object({\n      integration_name: z.string()\n    }),\n    query: z.never().optional()\n  })\n\n/**\n * Response Upsert Multiple Tool Custom Tags Api V1 Integrations  Integration Name  Tools Custom Tags Post\n * Successful Response\n */\nexport const zUpsertMultipleToolCustomTagsApiV1IntegrationsIntegrationNameToolsCustomTagsPostResponse =\n  z.array(zToolResource)\n\nexport const zGetToolDetailsApiV1IntegrationsIntegrationNameToolsToolNameGetData =\n  z.object({\n    body: z.never().optional(),\n    path: z.object({\n      integration_name: z.string(),\n      tool_name: z.string()\n    }),\n    query: z.never().optional()\n  })\n\n/**\n * Successful Response\n */\nexport const zGetToolDetailsApiV1IntegrationsIntegrationNameToolsToolNameGetResponse =\n  zToolResource\n\nexport const zDeleteToolCustomTagsApiV1IntegrationsIntegrationNameToolsToolNameCustomTagsDeleteData =\n  z.object({\n    body: zToolCustomTagSelectionParamsRequest,\n    path: z.object({\n      integration_name: z.string(),\n      tool_name: z.string()\n    }),\n    query: z.never().optional()\n  })\n\n/**\n * Successful Response\n */\nexport const zDeleteToolCustomTagsApiV1IntegrationsIntegrationNameToolsToolNameCustomTagsDeleteResponse =\n  zToolResource\n\nexport const zUpsertToolCustomTagsApiV1IntegrationsIntegrationNameToolsToolNameCustomTagsPostData =\n  z.object({\n    body: zToolCustomTagsParamsRequest,\n    path: z.object({\n      integration_name: z.string(),\n      tool_name: z.string()\n    }),\n    query: z.never().optional()\n  })\n\n/**\n * Successful Response\n */\nexport const zUpsertToolCustomTagsApiV1IntegrationsIntegrationNameToolsToolNameCustomTagsPostResponse =\n  zToolResource\n\nexport const zGetAllPoliciesApiV1PoliciesGetData = z.object({\n  body: z.never().optional(),\n  path: z.never().optional(),\n  query: z\n    .object({\n      skip: z.number().int().optional().default(0),\n      limit: z.number().int().optional().default(100)\n    })\n    .optional()\n})\n\n/**\n * Response Get All Policies Api V1 Policies  Get\n * Successful Response\n */\nexport const zGetAllPoliciesApiV1PoliciesGetResponse = z.array(zPolicy)\n\nexport const zCreatePolicyApiV1PoliciesPostData = z.object({\n  body: zNewPolicyRequest,\n  path: z.never().optional(),\n  query: z.never().optional()\n})\n\n/**\n * Successful Response\n */\nexport const zCreatePolicyApiV1PoliciesPostResponse = zPolicy\n\nexport const zGetApprovalRequestsApiV1PoliciesApprovalsGetData = z.object({\n  body: z.never().optional(),\n  path: z.never().optional(),\n  query: z\n    .object({\n      page: z.number().int().optional().default(0),\n      page_size: z.number().int().optional().default(100)\n    })\n    .optional()\n})\n\n/**\n * Response Get Approval Requests Api V1 Policies Approvals Get\n * Successful Response\n */\nexport const zGetApprovalRequestsApiV1PoliciesApprovalsGetResponse =\n  z.array(zApprovalAndPolicy)\n\nexport const zCheckResourceAccessGetApiV1PoliciesResourcesCheckGetData =\n  z.object({\n    body: z.never().optional(),\n    path: z.never().optional(),\n    query: z.never().optional()\n  })\n\n/**\n * Successful Response\n */\nexport const zCheckResourceAccessGetApiV1PoliciesResourcesCheckGetResponse =\n  zPolicyCheckResult\n\nexport const zCheckResourceAccessApiV1PoliciesResourcesCheckPostData = z.object(\n  {\n    body: z.never().optional(),\n    path: z.never().optional(),\n    query: z.never().optional()\n  }\n)\n\n/**\n * Successful Response\n */\nexport const zCheckResourceAccessApiV1PoliciesResourcesCheckPostResponse =\n  zPolicyCheckResult\n\nexport const zCheckResourceForApprovalApiV1PoliciesResourcesResourceNameApprovalGetData =\n  z.object({\n    body: z.never().optional(),\n    path: z.object({\n      resource_name: z.string()\n    }),\n    query: z.never().optional()\n  })\n\nexport const zGetPolicyApiV1PoliciesPolicyIdGetData = z.object({\n  body: z.never().optional(),\n  path: z.object({\n    policy_id: z.string()\n  }),\n  query: z.never().optional()\n})\n\n/**\n * Successful Response\n */\nexport const zGetPolicyApiV1PoliciesPolicyIdGetResponse = zPolicy\n\nexport const zUpdatePolicyApiV1PoliciesPolicyIdPutData = z.object({\n  body: z.object({}),\n  path: z.object({\n    policy_id: z.string()\n  }),\n  query: z.never().optional()\n})\n\n/**\n * Successful Response\n */\nexport const zUpdatePolicyApiV1PoliciesPolicyIdPutResponse = zPolicy\n\nexport const zCheckPolicyStatusApiV1PoliciesPolicyIdAuditIdStatusPostData =\n  z.object({\n    body: z.never().optional(),\n    path: z.object({\n      policy_id: z.string().uuid(),\n      audit_id: z.number().int()\n    }),\n    query: z.never().optional()\n  })\n\nexport const zListProvidersApiV1ProvidersGetData = z.object({\n  body: z.never().optional(),\n  path: z.never().optional(),\n  query: z.never().optional()\n})\n\n/**\n * Response List Providers Api V1 Providers  Get\n * Successful Response\n */\nexport const zListProvidersApiV1ProvidersGetResponse =\n  z.array(zToolServerProvider)\n\nexport const zGetProviderApiV1ProvidersProviderIdGetData = z.object({\n  body: z.never().optional(),\n  path: z.object({\n    provider_id: z.string()\n  }),\n  query: z.never().optional()\n})\n\n/**\n * Successful Response\n */\nexport const zGetProviderApiV1ProvidersProviderIdGetResponse =\n  zToolServerProvider\n\nexport const zGetServersApiV1ProvidersProviderIdServersGetData = z.object({\n  body: z.never().optional(),\n  path: z.object({\n    provider_id: z.string()\n  }),\n  query: z.never().optional()\n})\n\n/**\n * Response Get Servers Api V1 Providers  Provider Id  Servers Get\n * Successful Response\n */\nexport const zGetServersApiV1ProvidersProviderIdServersGetResponse =\n  z.array(zToolServer)\n\nexport const zSyncProviderApiV1ProvidersProviderIdSyncPostData = z.object({\n  body: z.never().optional(),\n  path: z.object({\n    provider_id: z.string()\n  }),\n  query: z.never().optional()\n})\n\nexport const zInitializeApiV1SdkInitializeGetData = z.object({\n  body: z.never().optional(),\n  path: z.never().optional(),\n  query: z.never().optional()\n})\n\n/**\n * Successful Response\n */\nexport const zInitializeApiV1SdkInitializeGetResponse = zInitializeResponse\n\nexport const zGetServiceTokenApiV1SdkServiceTokenGetData = z.object({\n  body: z.never().optional(),\n  path: z.never().optional(),\n  query: z.never().optional()\n})\n\n/**\n * Successful Response\n */\nexport const zGetServiceTokenApiV1SdkServiceTokenGetResponse =\n  zServiceTokenResponse\n\nexport const zReindexApiV1SearchReindexPostData = z.object({\n  body: z.never().optional(),\n  path: z.never().optional(),\n  query: z.never().optional()\n})\n\nexport const zReindexToolprintsApiV1SearchReindexToolprintsPostData = z.object({\n  body: z.never().optional(),\n  path: z.never().optional(),\n  query: z.never().optional()\n})\n\nexport const zReindexToolsApiV1SearchReindexToolsPostData = z.object({\n  body: z.never().optional(),\n  path: z.never().optional(),\n  query: z.never().optional()\n})\n\nexport const zSearchToolprintsApiV1SearchToolprintsPostData = z.object({\n  body: zSearchRequest,\n  path: z.never().optional(),\n  query: z.never().optional()\n})\n\n/**\n * Successful Response\n */\nexport const zSearchToolprintsApiV1SearchToolprintsPostResponse =\n  zSearchResponseScoredItemRegisteredToolprint\n\nexport const zGetToolprintRecommendationApiV1SearchToolprintsRecommendationPostData =\n  z.object({\n    body: zSearchRequest,\n    path: z.never().optional(),\n    query: z.never().optional()\n  })\n\n/**\n * Successful Response\n */\nexport const zGetToolprintRecommendationApiV1SearchToolprintsRecommendationPostResponse =\n  zToolprintRecommendation\n\nexport const zSearchToolsApiV1SearchToolsPostData = z.object({\n  body: zSearchRequest,\n  path: z.never().optional(),\n  query: z.never().optional()\n})\n\n/**\n * Successful Response\n */\nexport const zSearchToolsApiV1SearchToolsPostResponse =\n  zSearchResponseScoredItemTool\n\nexport const zGetSecretsApiV1SecretsGetData = z.object({\n  body: z.never().optional(),\n  path: z.never().optional(),\n  query: z.never().optional()\n})\n\nexport const zGetSecretApiV1SecretsSecretNameGetData = z.object({\n  body: z.never().optional(),\n  path: z.object({\n    secret_name: z.string()\n  }),\n  query: z.never().optional()\n})\n\n/**\n * Response Get Secret Api V1 Secrets  Secret Name  Get\n * Successful Response\n */\nexport const zGetSecretApiV1SecretsSecretNameGetResponse = z.object({})\n\nexport const zUpsertSecretApiV1SecretsSecretNamePutData = z.object({\n  body: zBodyUpsertSecretApiV1SecretsSecretNamePut,\n  path: z.object({\n    secret_name: z.string()\n  }),\n  query: z.never().optional(),\n  headers: z\n    .object({\n      'X-ONEGREP-PROFILE-ID': z.union([z.string(), z.null()]).optional()\n    })\n    .optional()\n})\n\n/**\n * Successful Response\n */\nexport const zUpsertSecretApiV1SecretsSecretNamePutResponse =\n  zUpsertSecretResponse\n\nexport const zListServersApiV1ServersGetData = z.object({\n  body: z.never().optional(),\n  path: z.never().optional(),\n  query: z.never().optional()\n})\n\n/**\n * Response List Servers Api V1 Servers  Get\n * Successful Response\n */\nexport const zListServersApiV1ServersGetResponse = z.array(zToolServer)\n\nexport const zGetServerApiV1ServersServerIdGetData = z.object({\n  body: z.never().optional(),\n  path: z.object({\n    server_id: z.string()\n  }),\n  query: z.never().optional()\n})\n\n/**\n * Successful Response\n */\nexport const zGetServerApiV1ServersServerIdGetResponse = zToolServer\n\nexport const zGetServerClientApiV1ServersServerIdClientGetData = z.object({\n  body: z.never().optional(),\n  path: z.object({\n    server_id: z.string()\n  }),\n  query: z.never().optional()\n})\n\n/**\n * Response Get Server Client Api V1 Servers  Server Id  Client Get\n * Successful Response\n */\nexport const zGetServerClientApiV1ServersServerIdClientGetResponse = z.union([\n  z\n    .object({\n      client_type: z.literal('mcp')\n    })\n    .and(zMcpToolServerClient),\n  z\n    .object({\n      client_type: z.literal('blaxel')\n    })\n    .and(zBlaxelToolServerClient),\n  z\n    .object({\n      client_type: z.literal('smithery')\n    })\n    .and(zSmitheryToolServerClient),\n  z\n    .object({\n      client_type: z.literal('composio')\n    })\n    .and(zComposioToolServerClient)\n])\n\nexport const zGetServerPropertiesApiV1ServersServerIdPropertiesGetData =\n  z.object({\n    body: z.never().optional(),\n    path: z.object({\n      server_id: z.string()\n    }),\n    query: z.never().optional()\n  })\n\n/**\n * Successful Response\n */\nexport const zGetServerPropertiesApiV1ServersServerIdPropertiesGetResponse =\n  zToolServerProperties\n\nexport const zPatchServerPropertiesApiV1ServersServerIdPropertiesKeyPatchData =\n  z.object({\n    body: z.object({}),\n    path: z.object({\n      server_id: z.string(),\n      key: z.string()\n    }),\n    query: z.never().optional()\n  })\n\n/**\n * Successful Response\n */\nexport const zPatchServerPropertiesApiV1ServersServerIdPropertiesKeyPatchResponse =\n  zToolServerProperties\n\nexport const zGetStrategyApiV1StrategyPostData = z.object({\n  body: zSearchRequest,\n  path: z.never().optional(),\n  query: z.never().optional()\n})\n\n/**\n * Response Get Strategy Api V1 Strategy  Post\n * Successful Response\n */\nexport const zGetStrategyApiV1StrategyPostResponse = z.array(zStrategy)\n\nexport const zCreateFakeRecipesApiV1StrategyFakePostData = z.object({\n  body: z.never().optional(),\n  path: z.never().optional(),\n  query: z.never().optional()\n})\n\n/**\n * Response Create Fake Recipes Api V1 Strategy Fake Post\n * Successful Response\n */\nexport const zCreateFakeRecipesApiV1StrategyFakePostResponse = z.array(zRecipe)\n\nexport const zCreateToolprintApiV1ToolprintsPostData = z.object({\n  body: zToolprintInput,\n  path: z.never().optional(),\n  query: z.never().optional()\n})\n\n/**\n * Successful Response\n */\nexport const zCreateToolprintApiV1ToolprintsPostResponse = zRegisteredToolprint\n\nexport const zGetToolprintInstructionsApiV1ToolprintsWellKnownAiTxtGetData =\n  z.object({\n    body: z.never().optional(),\n    path: z.never().optional(),\n    query: z.never().optional()\n  })\n\n/**\n * Successful Response\n */\nexport const zGetToolprintInstructionsApiV1ToolprintsWellKnownAiTxtGetResponse =\n  z.string()\n\nexport const zGetToolprintSchemaApiV1ToolprintsWellKnownSchemaGetData =\n  z.object({\n    body: z.never().optional(),\n    path: z.never().optional(),\n    query: z.never().optional()\n  })\n\n/**\n * Response Get Toolprint Schema Api V1 Toolprints  Well Known Schema Get\n * Successful Response\n */\nexport const zGetToolprintSchemaApiV1ToolprintsWellKnownSchemaGetResponse =\n  z.object({})\n\nexport const zGetToolprintTemplateApiV1ToolprintsWellKnownTemplateGetData =\n  z.object({\n    body: z.never().optional(),\n    path: z.never().optional(),\n    query: z.never().optional()\n  })\n\n/**\n * Successful Response\n */\nexport const zGetToolprintTemplateApiV1ToolprintsWellKnownTemplateGetResponse =\n  z.string()\n\nexport const zCreateToolprintJsonApiV1ToolprintsJsonPostData = z.object({\n  body: zBasicPostBody,\n  path: z.never().optional(),\n  query: z.never().optional()\n})\n\n/**\n * Successful Response\n */\nexport const zCreateToolprintJsonApiV1ToolprintsJsonPostResponse =\n  zRegisteredToolprint\n\nexport const zValidateToolprintApiV1ToolprintsValidatePostData = z.object({\n  body: zToolprintInput,\n  path: z.never().optional(),\n  query: z.never().optional()\n})\n\n/**\n * Successful Response\n */\nexport const zValidateToolprintApiV1ToolprintsValidatePostResponse =\n  zBasicPostResponse\n\nexport const zValidateToolprintJsonApiV1ToolprintsValidateJsonPostData =\n  z.object({\n    body: zBasicPostBody,\n    path: z.never().optional(),\n    query: z.never().optional()\n  })\n\nexport const zValidateToolprintYamlApiV1ToolprintsValidateYamlPostData =\n  z.object({\n    body: z.string(),\n    path: z.never().optional(),\n    query: z.never().optional()\n  })\n\n/**\n * Successful Response\n */\nexport const zValidateToolprintYamlApiV1ToolprintsValidateYamlPostResponse =\n  zBasicPostResponse\n\nexport const zCreateToolprintYamlApiV1ToolprintsYamlPostData = z.object({\n  body: z.string(),\n  path: z.never().optional(),\n  query: z.never().optional()\n})\n\n/**\n * Successful Response\n */\nexport const zCreateToolprintYamlApiV1ToolprintsYamlPostResponse =\n  zRegisteredToolprint\n\nexport const zGetToolprintApiV1ToolprintsToolprintIdGetData = z.object({\n  body: z.never().optional(),\n  path: z.object({\n    toolprint_id: z.string().uuid()\n  }),\n  query: z.never().optional()\n})\n\n/**\n * Successful Response\n */\nexport const zGetToolprintApiV1ToolprintsToolprintIdGetResponse =\n  zRegisteredToolprint\n\nexport const zListToolsApiV1ToolsGetData = z.object({\n  body: z.never().optional(),\n  path: z.never().optional(),\n  query: z.never().optional()\n})\n\n/**\n * Response List Tools Api V1 Tools  Get\n * Successful Response\n */\nexport const zListToolsApiV1ToolsGetResponse = z.array(zTool)\n\nexport const zGetToolResourcesBatchApiV1ToolsResourcesBatchPostData = z.object({\n  body: zMultiIdPostBody,\n  path: z.never().optional(),\n  query: z.never().optional()\n})\n\n/**\n * Response Get Tool Resources Batch Api V1 Tools Resources Batch Post\n * Successful Response\n */\nexport const zGetToolResourcesBatchApiV1ToolsResourcesBatchPostResponse =\n  z.array(zToolResource)\n\nexport const zGetToolApiV1ToolsToolIdGetData = z.object({\n  body: z.never().optional(),\n  path: z.object({\n    tool_id: z.string()\n  }),\n  query: z.never().optional()\n})\n\n/**\n * Successful Response\n */\nexport const zGetToolApiV1ToolsToolIdGetResponse = zTool\n\nexport const zGetToolPropertiesApiV1ToolsToolIdPropertiesGetData = z.object({\n  body: z.never().optional(),\n  path: z.object({\n    tool_id: z.string()\n  }),\n  query: z.never().optional()\n})\n\n/**\n * Successful Response\n */\nexport const zGetToolPropertiesApiV1ToolsToolIdPropertiesGetResponse =\n  zToolProperties\n\nexport const zGetToolResourceApiV1ToolsToolIdResourceGetData = z.object({\n  body: z.never().optional(),\n  path: z.object({\n    tool_id: z.string()\n  }),\n  query: z.never().optional()\n})\n\n/**\n * Successful Response\n */\nexport const zGetToolResourceApiV1ToolsToolIdResourceGetResponse = zToolResource\n\nexport const zHealthHealthGetData = z.object({\n  body: z.never().optional(),\n  path: z.never().optional(),\n  query: z.never().optional()\n})\n","import type {\n  ArrayStyle,\n  ObjectStyle,\n  SerializerOptions\n} from './pathSerializer.js'\n\nexport type QuerySerializer = (query: Record<string, unknown>) => string\n\nexport type BodySerializer = (body: any) => any\n\nexport interface QuerySerializerOptions {\n  allowReserved?: boolean\n  array?: SerializerOptions<ArrayStyle>\n  object?: SerializerOptions<ObjectStyle>\n}\n\nconst serializeFormDataPair = (data: FormData, key: string, value: unknown) => {\n  if (typeof value === 'string' || value instanceof Blob) {\n    data.append(key, value)\n  } else {\n    data.append(key, JSON.stringify(value))\n  }\n}\n\nconst serializeUrlSearchParamsPair = (\n  data: URLSearchParams,\n  key: string,\n  value: unknown\n) => {\n  if (typeof value === 'string') {\n    data.append(key, value)\n  } else {\n    data.append(key, JSON.stringify(value))\n  }\n}\n\nexport const formDataBodySerializer = {\n  bodySerializer: <T extends Record<string, any> | Array<Record<string, any>>>(\n    body: T\n  ) => {\n    const data = new FormData()\n\n    Object.entries(body).forEach(([key, value]) => {\n      if (value === undefined || value === null) {\n        return\n      }\n      if (Array.isArray(value)) {\n        value.forEach((v) => serializeFormDataPair(data, key, v))\n      } else {\n        serializeFormDataPair(data, key, value)\n      }\n    })\n\n    return data\n  }\n}\n\nexport const jsonBodySerializer = {\n  bodySerializer: <T>(body: T) =>\n    JSON.stringify(body, (_key, value) =>\n      typeof value === 'bigint' ? value.toString() : value\n    )\n}\n\nexport const urlSearchParamsBodySerializer = {\n  bodySerializer: <T extends Record<string, any> | Array<Record<string, any>>>(\n    body: T\n  ) => {\n    const data = new URLSearchParams()\n\n    Object.entries(body).forEach(([key, value]) => {\n      if (value === undefined || value === null) {\n        return\n      }\n      if (Array.isArray(value)) {\n        value.forEach((v) => serializeUrlSearchParamsPair(data, key, v))\n      } else {\n        serializeUrlSearchParamsPair(data, key, value)\n      }\n    })\n\n    return data.toString()\n  }\n}\n","type Slot = 'body' | 'headers' | 'path' | 'query'\n\nexport type Field =\n  | {\n      in: Exclude<Slot, 'body'>\n      key: string\n      map?: string\n    }\n  | {\n      in: Extract<Slot, 'body'>\n      key?: string\n      map?: string\n    }\n\nexport interface Fields {\n  allowExtra?: Partial<Record<Slot, boolean>>\n  args?: ReadonlyArray<Field>\n}\n\nexport type FieldsConfig = ReadonlyArray<Field | Fields>\n\nconst extraPrefixesMap: Record<string, Slot> = {\n  $body_: 'body',\n  $headers_: 'headers',\n  $path_: 'path',\n  $query_: 'query'\n}\nconst extraPrefixes = Object.entries(extraPrefixesMap)\n\ntype KeyMap = Map<\n  string,\n  {\n    in: Slot\n    map?: string\n  }\n>\n\nconst buildKeyMap = (fields: FieldsConfig, map?: KeyMap): KeyMap => {\n  if (!map) {\n    map = new Map()\n  }\n\n  for (const config of fields) {\n    if ('in' in config) {\n      if (config.key) {\n        map.set(config.key, {\n          in: config.in,\n          map: config.map\n        })\n      }\n    } else if (config.args) {\n      buildKeyMap(config.args, map)\n    }\n  }\n\n  return map\n}\n\ninterface Params {\n  body: unknown\n  headers: Record<string, unknown>\n  path: Record<string, unknown>\n  query: Record<string, unknown>\n}\n\nconst stripEmptySlots = (params: Params) => {\n  for (const [slot, value] of Object.entries(params)) {\n    if (value && typeof value === 'object' && !Object.keys(value).length) {\n      delete params[slot as Slot]\n    }\n  }\n}\n\nexport const buildClientParams = (\n  args: ReadonlyArray<unknown>,\n  fields: FieldsConfig\n) => {\n  const params: Params = {\n    body: {},\n    headers: {},\n    path: {},\n    query: {}\n  }\n\n  const map = buildKeyMap(fields)\n\n  let config: FieldsConfig[number] | undefined\n\n  for (const [index, arg] of args.entries()) {\n    if (fields[index]) {\n      config = fields[index]\n    }\n\n    if (!config) {\n      continue\n    }\n\n    if ('in' in config) {\n      if (config.key) {\n        const field = map.get(config.key)!\n        const name = field.map || config.key\n        ;(params[field.in] as Record<string, unknown>)[name] = arg\n      } else {\n        params.body = arg\n      }\n    } else {\n      for (const [key, value] of Object.entries(arg ?? {})) {\n        const field = map.get(key)\n\n        if (field) {\n          const name = field.map || key\n          ;(params[field.in] as Record<string, unknown>)[name] = value\n        } else {\n          const extra = extraPrefixes.find(([prefix]) => key.startsWith(prefix))\n\n          if (extra) {\n            const [prefix, slot] = extra\n            ;(params[slot] as Record<string, unknown>)[\n              key.slice(prefix.length)\n            ] = value\n          } else {\n            for (const [slot, allowed] of Object.entries(\n              config.allowExtra ?? {}\n            )) {\n              if (allowed) {\n                ;(params[slot as Slot] as Record<string, unknown>)[key] = value\n                break\n              }\n            }\n          }\n        }\n      }\n    }\n  }\n\n  stripEmptySlots(params)\n\n  return params\n}\n","export type AuthToken = string | undefined\n\nexport interface Auth {\n  /**\n   * Which part of the request do we use to send the auth?\n   *\n   * @default 'header'\n   */\n  in?: 'header' | 'query' | 'cookie'\n  /**\n   * Header or query parameter name.\n   *\n   * @default 'Authorization'\n   */\n  name?: string\n  scheme?: 'basic' | 'bearer'\n  type: 'apiKey' | 'http'\n}\n\nexport const getAuthToken = async (\n  auth: Auth,\n  callback: ((auth: Auth) => Promise<AuthToken> | AuthToken) | AuthToken\n): Promise<string | undefined> => {\n  const token = typeof callback === 'function' ? await callback(auth) : callback\n\n  if (!token) {\n    return\n  }\n\n  if (auth.scheme === 'bearer') {\n    return `Bearer ${token}`\n  }\n\n  if (auth.scheme === 'basic') {\n    return `Basic ${btoa(token)}`\n  }\n\n  return token\n}\n","interface SerializeOptions<T>\n  extends SerializePrimitiveOptions,\n    SerializerOptions<T> {}\n\ninterface SerializePrimitiveOptions {\n  allowReserved?: boolean\n  name: string\n}\n\nexport interface SerializerOptions<T> {\n  /**\n   * @default true\n   */\n  explode: boolean\n  style: T\n}\n\nexport type ArrayStyle = 'form' | 'spaceDelimited' | 'pipeDelimited'\nexport type ArraySeparatorStyle = ArrayStyle | MatrixStyle\ntype MatrixStyle = 'label' | 'matrix' | 'simple'\nexport type ObjectStyle = 'form' | 'deepObject'\ntype ObjectSeparatorStyle = ObjectStyle | MatrixStyle\n\ninterface SerializePrimitiveParam extends SerializePrimitiveOptions {\n  value: string\n}\n\nexport const separatorArrayExplode = (style: ArraySeparatorStyle) => {\n  switch (style) {\n    case 'label':\n      return '.'\n    case 'matrix':\n      return ';'\n    case 'simple':\n      return ','\n    default:\n      return '&'\n  }\n}\n\nexport const separatorArrayNoExplode = (style: ArraySeparatorStyle) => {\n  switch (style) {\n    case 'form':\n      return ','\n    case 'pipeDelimited':\n      return '|'\n    case 'spaceDelimited':\n      return '%20'\n    default:\n      return ','\n  }\n}\n\nexport const separatorObjectExplode = (style: ObjectSeparatorStyle) => {\n  switch (style) {\n    case 'label':\n      return '.'\n    case 'matrix':\n      return ';'\n    case 'simple':\n      return ','\n    default:\n      return '&'\n  }\n}\n\nexport const serializeArrayParam = ({\n  allowReserved,\n  explode,\n  name,\n  style,\n  value\n}: SerializeOptions<ArraySeparatorStyle> & {\n  value: unknown[]\n}) => {\n  if (!explode) {\n    const joinedValues = (\n      allowReserved ? value : value.map((v) => encodeURIComponent(v as string))\n    ).join(separatorArrayNoExplode(style))\n    switch (style) {\n      case 'label':\n        return `.${joinedValues}`\n      case 'matrix':\n        return `;${name}=${joinedValues}`\n      case 'simple':\n        return joinedValues\n      default:\n        return `${name}=${joinedValues}`\n    }\n  }\n\n  const separator = separatorArrayExplode(style)\n  const joinedValues = value\n    .map((v) => {\n      if (style === 'label' || style === 'simple') {\n        return allowReserved ? v : encodeURIComponent(v as string)\n      }\n\n      return serializePrimitiveParam({\n        allowReserved,\n        name,\n        value: v as string\n      })\n    })\n    .join(separator)\n  return style === 'label' || style === 'matrix'\n    ? separator + joinedValues\n    : joinedValues\n}\n\nexport const serializePrimitiveParam = ({\n  allowReserved,\n  name,\n  value\n}: SerializePrimitiveParam) => {\n  if (value === undefined || value === null) {\n    return ''\n  }\n\n  if (typeof value === 'object') {\n    throw new Error(\n      'Deeply-nested arrays/objects aren’t supported. Provide your own `querySerializer()` to handle these.'\n    )\n  }\n\n  return `${name}=${allowReserved ? value : encodeURIComponent(value)}`\n}\n\nexport const serializeObjectParam = ({\n  allowReserved,\n  explode,\n  name,\n  style,\n  value,\n  valueOnly\n}: SerializeOptions<ObjectSeparatorStyle> & {\n  value: Record<string, unknown> | Date\n  valueOnly?: boolean\n}) => {\n  if (value instanceof Date) {\n    return valueOnly ? value.toISOString() : `${name}=${value.toISOString()}`\n  }\n\n  if (style !== 'deepObject' && !explode) {\n    let values: string[] = []\n    Object.entries(value).forEach(([key, v]) => {\n      values = [\n        ...values,\n        key,\n        allowReserved ? (v as string) : encodeURIComponent(v as string)\n      ]\n    })\n    const joinedValues = values.join(',')\n    switch (style) {\n      case 'form':\n        return `${name}=${joinedValues}`\n      case 'label':\n        return `.${joinedValues}`\n      case 'matrix':\n        return `;${name}=${joinedValues}`\n      default:\n        return joinedValues\n    }\n  }\n\n  const separator = separatorObjectExplode(style)\n  const joinedValues = Object.entries(value)\n    .map(([key, v]) =>\n      serializePrimitiveParam({\n        allowReserved,\n        name: style === 'deepObject' ? `${name}[${key}]` : key,\n        value: v as string\n      })\n    )\n    .join(separator)\n  return style === 'label' || style === 'matrix'\n    ? separator + joinedValues\n    : joinedValues\n}\n","import { getAuthToken } from '../core/auth.js'\nimport type {\n  QuerySerializer,\n  QuerySerializerOptions\n} from '../core/bodySerializer.js'\nimport { jsonBodySerializer } from '../core/bodySerializer.js'\nimport {\n  serializeArrayParam,\n  serializeObjectParam,\n  serializePrimitiveParam\n} from '../core/pathSerializer.js'\nimport type { Client, ClientOptions, Config, RequestOptions } from './types.js'\n\ninterface PathSerializer {\n  path: Record<string, unknown>\n  url: string\n}\n\nconst PATH_PARAM_RE = /\\{[^{}]+\\}/g\n\ntype ArrayStyle = 'form' | 'spaceDelimited' | 'pipeDelimited'\ntype MatrixStyle = 'label' | 'matrix' | 'simple'\ntype ArraySeparatorStyle = ArrayStyle | MatrixStyle\n\nconst defaultPathSerializer = ({ path, url: _url }: PathSerializer) => {\n  let url = _url\n  const matches = _url.match(PATH_PARAM_RE)\n  if (matches) {\n    for (const match of matches) {\n      let explode = false\n      let name = match.substring(1, match.length - 1)\n      let style: ArraySeparatorStyle = 'simple'\n\n      if (name.endsWith('*')) {\n        explode = true\n        name = name.substring(0, name.length - 1)\n      }\n\n      if (name.startsWith('.')) {\n        name = name.substring(1)\n        style = 'label'\n      } else if (name.startsWith(';')) {\n        name = name.substring(1)\n        style = 'matrix'\n      }\n\n      const value = path[name]\n\n      if (value === undefined || value === null) {\n        continue\n      }\n\n      if (Array.isArray(value)) {\n        url = url.replace(\n          match,\n          serializeArrayParam({ explode, name, style, value })\n        )\n        continue\n      }\n\n      if (typeof value === 'object') {\n        url = url.replace(\n          match,\n          serializeObjectParam({\n            explode,\n            name,\n            style,\n            value: value as Record<string, unknown>,\n            valueOnly: true\n          })\n        )\n        continue\n      }\n\n      if (style === 'matrix') {\n        url = url.replace(\n          match,\n          `;${serializePrimitiveParam({\n            name,\n            value: value as string\n          })}`\n        )\n        continue\n      }\n\n      const replaceValue = encodeURIComponent(\n        style === 'label' ? `.${value as string}` : (value as string)\n      )\n      url = url.replace(match, replaceValue)\n    }\n  }\n  return url\n}\n\nexport const createQuerySerializer = <T = unknown>({\n  allowReserved,\n  array,\n  object\n}: QuerySerializerOptions = {}) => {\n  const querySerializer = (queryParams: T) => {\n    const search: string[] = []\n    if (queryParams && typeof queryParams === 'object') {\n      for (const name in queryParams) {\n        const value = queryParams[name]\n\n        if (value === undefined || value === null) {\n          continue\n        }\n\n        if (Array.isArray(value)) {\n          const serializedArray = serializeArrayParam({\n            allowReserved,\n            explode: true,\n            name,\n            style: 'form',\n            value,\n            ...array\n          })\n          if (serializedArray) search.push(serializedArray)\n        } else if (typeof value === 'object') {\n          const serializedObject = serializeObjectParam({\n            allowReserved,\n            explode: true,\n            name,\n            style: 'deepObject',\n            value: value as Record<string, unknown>,\n            ...object\n          })\n          if (serializedObject) search.push(serializedObject)\n        } else {\n          const serializedPrimitive = serializePrimitiveParam({\n            allowReserved,\n            name,\n            value: value as string\n          })\n          if (serializedPrimitive) search.push(serializedPrimitive)\n        }\n      }\n    }\n    return search.join('&')\n  }\n  return querySerializer\n}\n\n/**\n * Infers parseAs value from provided Content-Type header.\n */\nexport const getParseAs = (\n  contentType: string | null\n): Exclude<Config['parseAs'], 'auto'> => {\n  if (!contentType) {\n    // If no Content-Type header is provided, the best we can do is return the raw response body,\n    // which is effectively the same as the 'stream' option.\n    return 'stream'\n  }\n\n  const cleanContent = contentType.split(';')[0]?.trim()\n\n  if (!cleanContent) {\n    return\n  }\n\n  if (\n    cleanContent.startsWith('application/json') ||\n    cleanContent.endsWith('+json')\n  ) {\n    return 'json'\n  }\n\n  if (cleanContent === 'multipart/form-data') {\n    return 'formData'\n  }\n\n  if (\n    ['application/', 'audio/', 'image/', 'video/'].some((type) =>\n      cleanContent.startsWith(type)\n    )\n  ) {\n    return 'blob'\n  }\n\n  if (cleanContent.startsWith('text/')) {\n    return 'text'\n  }\n\n  return\n}\n\nexport const setAuthParams = async ({\n  security,\n  ...options\n}: Pick<Required<RequestOptions>, 'security'> &\n  Pick<RequestOptions, 'auth' | 'query'> & {\n    headers: Headers\n  }) => {\n  for (const auth of security) {\n    const token = await getAuthToken(auth, options.auth)\n\n    if (!token) {\n      continue\n    }\n\n    const name = auth.name ?? 'Authorization'\n\n    switch (auth.in) {\n      case 'query':\n        if (!options.query) {\n          options.query = {}\n        }\n        options.query[name] = token\n        break\n      case 'cookie':\n        options.headers.append('Cookie', `${name}=${token}`)\n        break\n      case 'header':\n      default:\n        options.headers.set(name, token)\n        break\n    }\n\n    return\n  }\n}\n\nexport const buildUrl: Client['buildUrl'] = (options) => {\n  const url = getUrl({\n    baseUrl: options.baseUrl as string,\n    path: options.path,\n    query: options.query,\n    querySerializer:\n      typeof options.querySerializer === 'function'\n        ? options.querySerializer\n        : createQuerySerializer(options.querySerializer),\n    url: options.url\n  })\n  return url\n}\n\nexport const getUrl = ({\n  baseUrl,\n  path,\n  query,\n  querySerializer,\n  url: _url\n}: {\n  baseUrl?: string\n  path?: Record<string, unknown>\n  query?: Record<string, unknown>\n  querySerializer: QuerySerializer\n  url: string\n}) => {\n  const pathUrl = _url.startsWith('/') ? _url : `/${_url}`\n  let url = (baseUrl ?? '') + pathUrl\n  if (path) {\n    url = defaultPathSerializer({ path, url })\n  }\n  let search = query ? querySerializer(query) : ''\n  if (search.startsWith('?')) {\n    search = search.substring(1)\n  }\n  if (search) {\n    url += `?${search}`\n  }\n  return url\n}\n\nexport const mergeConfigs = (a: Config, b: Config): Config => {\n  const config = { ...a, ...b }\n  if (config.baseUrl?.endsWith('/')) {\n    config.baseUrl = config.baseUrl.substring(0, config.baseUrl.length - 1)\n  }\n  config.headers = mergeHeaders(a.headers, b.headers)\n  return config\n}\n\nexport const mergeHeaders = (\n  ...headers: Array<Required<Config>['headers'] | undefined>\n): Headers => {\n  const mergedHeaders = new Headers()\n  for (const header of headers) {\n    if (!header || typeof header !== 'object') {\n      continue\n    }\n\n    const iterator =\n      header instanceof Headers ? header.entries() : Object.entries(header)\n\n    for (const [key, value] of iterator) {\n      if (value === null) {\n        mergedHeaders.delete(key)\n      } else if (Array.isArray(value)) {\n        for (const v of value) {\n          mergedHeaders.append(key, v as string)\n        }\n      } else if (value !== undefined) {\n        // assume object headers are meant to be JSON stringified, i.e. their\n        // content value in OpenAPI specification is 'application/json'\n        mergedHeaders.set(\n          key,\n          typeof value === 'object' ? JSON.stringify(value) : (value as string)\n        )\n      }\n    }\n  }\n  return mergedHeaders\n}\n\ntype ErrInterceptor<Err, Res, Req, Options> = (\n  error: Err,\n  response: Res,\n  request: Req,\n  options: Options\n) => Err | Promise<Err>\n\ntype ReqInterceptor<Req, Options> = (\n  request: Req,\n  options: Options\n) => Req | Promise<Req>\n\ntype ResInterceptor<Res, Req, Options> = (\n  response: Res,\n  request: Req,\n  options: Options\n) => Res | Promise<Res>\n\nclass Interceptors<Interceptor> {\n  _fns: (Interceptor | null)[]\n\n  constructor() {\n    this._fns = []\n  }\n\n  clear() {\n    this._fns = []\n  }\n\n  getInterceptorIndex(id: number | Interceptor): number {\n    if (typeof id === 'number') {\n      return this._fns[id] ? id : -1\n    } else {\n      return this._fns.indexOf(id)\n    }\n  }\n  exists(id: number | Interceptor) {\n    const index = this.getInterceptorIndex(id)\n    return !!this._fns[index]\n  }\n\n  eject(id: number | Interceptor) {\n    const index = this.getInterceptorIndex(id)\n    if (this._fns[index]) {\n      this._fns[index] = null\n    }\n  }\n\n  update(id: number | Interceptor, fn: Interceptor) {\n    const index = this.getInterceptorIndex(id)\n    if (this._fns[index]) {\n      this._fns[index] = fn\n      return id\n    } else {\n      return false\n    }\n  }\n\n  use(fn: Interceptor) {\n    this._fns = [...this._fns, fn]\n    return this._fns.length - 1\n  }\n}\n\n// `createInterceptors()` response, meant for external use as it does not\n// expose internals\nexport interface Middleware<Req, Res, Err, Options> {\n  error: Pick<\n    Interceptors<ErrInterceptor<Err, Res, Req, Options>>,\n    'eject' | 'use'\n  >\n  request: Pick<Interceptors<ReqInterceptor<Req, Options>>, 'eject' | 'use'>\n  response: Pick<\n    Interceptors<ResInterceptor<Res, Req, Options>>,\n    'eject' | 'use'\n  >\n}\n\n// do not add `Middleware` as return type so we can use _fns internally\nexport const createInterceptors = <Req, Res, Err, Options>() => ({\n  error: new Interceptors<ErrInterceptor<Err, Res, Req, Options>>(),\n  request: new Interceptors<ReqInterceptor<Req, Options>>(),\n  response: new Interceptors<ResInterceptor<Res, Req, Options>>()\n})\n\nconst defaultQuerySerializer = createQuerySerializer({\n  allowReserved: false,\n  array: {\n    explode: true,\n    style: 'form'\n  },\n  object: {\n    explode: true,\n    style: 'deepObject'\n  }\n})\n\nconst defaultHeaders = {\n  'Content-Type': 'application/json'\n}\n\nexport const createConfig = <T extends ClientOptions = ClientOptions>(\n  override: Config<Omit<ClientOptions, keyof T> & T> = {}\n): Config<Omit<ClientOptions, keyof T> & T> => ({\n  ...jsonBodySerializer,\n  headers: defaultHeaders,\n  parseAs: 'auto',\n  querySerializer: defaultQuerySerializer,\n  ...override\n})\n","import type { Client, Config, RequestOptions } from './types.js'\nimport {\n  buildUrl,\n  createConfig,\n  createInterceptors,\n  getParseAs,\n  mergeConfigs,\n  mergeHeaders,\n  setAuthParams\n} from './utils.js'\n\ntype ReqInit = Omit<RequestInit, 'body' | 'headers'> & {\n  body?: any\n  headers: ReturnType<typeof mergeHeaders>\n}\n\nexport const createClient = (config: Config = {}): Client => {\n  let _config = mergeConfigs(createConfig(), config)\n\n  const getConfig = (): Config => ({ ..._config })\n\n  const setConfig = (config: Config): Config => {\n    _config = mergeConfigs(_config, config)\n    return getConfig()\n  }\n\n  const interceptors = createInterceptors<\n    Request,\n    Response,\n    unknown,\n    RequestOptions\n  >()\n\n  const request: Client['request'] = async (options) => {\n    const opts = {\n      ..._config,\n      ...options,\n      fetch: options.fetch ?? _config.fetch ?? globalThis.fetch,\n      headers: mergeHeaders(_config.headers, options.headers)\n    }\n\n    if (opts.security) {\n      await setAuthParams({\n        ...opts,\n        security: opts.security\n      })\n    }\n\n    if (opts.requestValidator) {\n      await opts.requestValidator(opts)\n    }\n\n    if (opts.body && opts.bodySerializer) {\n      opts.body = opts.bodySerializer(opts.body)\n    }\n\n    // remove Content-Type header if body is empty to avoid sending invalid requests\n    if (opts.body === undefined || opts.body === '') {\n      opts.headers.delete('Content-Type')\n    }\n\n    const url = buildUrl(opts)\n    const requestInit: ReqInit = {\n      redirect: 'follow',\n      ...opts\n    }\n\n    let request = new Request(url, requestInit)\n\n    for (const fn of interceptors.request._fns) {\n      if (fn) {\n        request = await fn(request, opts)\n      }\n    }\n\n    // fetch must be assigned here, otherwise it would throw the error:\n    // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation\n    const _fetch = opts.fetch!\n    let response = await _fetch(request)\n\n    for (const fn of interceptors.response._fns) {\n      if (fn) {\n        response = await fn(response, request, opts)\n      }\n    }\n\n    const result = {\n      request,\n      response\n    }\n\n    if (response.ok) {\n      if (\n        response.status === 204 ||\n        response.headers.get('Content-Length') === '0'\n      ) {\n        return opts.responseStyle === 'data'\n          ? {}\n          : {\n              data: {},\n              ...result\n            }\n      }\n\n      const parseAs =\n        (opts.parseAs === 'auto'\n          ? getParseAs(response.headers.get('Content-Type'))\n          : opts.parseAs) ?? 'json'\n\n      let data: any\n      switch (parseAs) {\n        case 'arrayBuffer':\n        case 'blob':\n        case 'formData':\n        case 'json':\n        case 'text':\n          data = await response[parseAs]()\n          break\n        case 'stream':\n          return opts.responseStyle === 'data'\n            ? response.body\n            : {\n                data: response.body,\n                ...result\n              }\n      }\n\n      if (parseAs === 'json') {\n        if (opts.responseValidator) {\n          await opts.responseValidator(data)\n        }\n\n        if (opts.responseTransformer) {\n          data = await opts.responseTransformer(data)\n        }\n      }\n\n      return opts.responseStyle === 'data'\n        ? data\n        : {\n            data,\n            ...result\n          }\n    }\n\n    let error = await response.text()\n\n    try {\n      error = JSON.parse(error)\n    } catch {\n      // noop\n    }\n\n    let finalError = error\n\n    for (const fn of interceptors.error._fns) {\n      if (fn) {\n        finalError = (await fn(error, response, request, opts)) as string\n      }\n    }\n\n    finalError = finalError || ({} as string)\n\n    if (opts.throwOnError) {\n      throw finalError\n    }\n\n    // TODO: we probably want to return error and improve types\n    return opts.responseStyle === 'data'\n      ? undefined\n      : {\n          error: finalError,\n          ...result\n        }\n  }\n\n  return {\n    buildUrl,\n    connect: (options) => request({ ...options, method: 'CONNECT' }),\n    delete: (options) => request({ ...options, method: 'DELETE' }),\n    get: (options) => request({ ...options, method: 'GET' }),\n    getConfig,\n    head: (options) => request({ ...options, method: 'HEAD' }),\n    interceptors,\n    options: (options) => request({ ...options, method: 'OPTIONS' }),\n    patch: (options) => request({ ...options, method: 'PATCH' }),\n    post: (options) => request({ ...options, method: 'POST' }),\n    put: (options) => request({ ...options, method: 'PUT' }),\n    request,\n    setConfig,\n    trace: (options) => request({ ...options, method: 'TRACE' })\n  }\n}\n","// This file is auto-generated by @hey-api/openapi-ts\n\nimport type { ClientOptions } from './types.gen.js'\nimport {\n  type Config,\n  type ClientOptions as DefaultClientOptions,\n  createClient,\n  createConfig\n} from './client/index.js'\n\n/**\n * The `createClientConfig()` function will be called on client initialization\n * and the returned object will become the client's initial configuration.\n *\n * You may want to initialize your client this way instead of calling\n * `setConfig()`. This is useful for example if you're using Next.js\n * to ensure your client always has the correct values.\n */\nexport type CreateClientConfig<T extends DefaultClientOptions = ClientOptions> =\n  (\n    override?: Config<DefaultClientOptions & T>\n  ) => Config<Required<DefaultClientOptions> & T>\n\nexport const client = createClient(\n  createConfig<ClientOptions>({\n    baseUrl: 'http://localhost:8080'\n  })\n)\n","// This file is auto-generated by @hey-api/openapi-ts\n\nimport type {\n  Options as ClientOptions,\n  TDataShape,\n  Client\n} from './client/index.js'\nimport type {\n  GetAiDocumentationAiTxtGetData,\n  GetAiDocumentationAiTxtGetResponses,\n  DeleteAccountApiV1AccountDeleteData,\n  DeleteAccountApiV1AccountDeleteResponses,\n  GetAccountInformationApiV1AccountGetData,\n  GetAccountInformationApiV1AccountGetResponses,\n  CreateAccountApiV1AccountPostData,\n  CreateAccountApiV1AccountPostResponses,\n  GetApiKeyApiV1AccountApiKeyGetData,\n  GetApiKeyApiV1AccountApiKeyGetResponses,\n  GetAuthStatusApiV1AccountAuthStatusGetData,\n  GetAuthStatusApiV1AccountAuthStatusGetResponses,\n  CreateAccountByInvitationApiV1AccountInvitationCodePostData,\n  CreateAccountByInvitationApiV1AccountInvitationCodePostResponses,\n  CreateAccountByInvitationApiV1AccountInvitationCodePostErrors,\n  GetServiceTokenApiV1AccountServiceTokenGetData,\n  GetServiceTokenApiV1AccountServiceTokenGetResponses,\n  RotateServiceTokenApiV1AccountServiceTokenPostData,\n  RotateServiceTokenApiV1AccountServiceTokenPostResponses,\n  GetAuditLogsApiV1AuditGetData,\n  GetAuditLogsApiV1AuditGetResponses,\n  GetAuditLogsApiV1AuditGetErrors,\n  GetAllFlagsApiV1FlagsGetData,\n  GetAllFlagsApiV1FlagsGetResponses,\n  ListIntegrationsApiV1IntegrationsGetData,\n  ListIntegrationsApiV1IntegrationsGetResponses,\n  ListIntegrationsApiV1IntegrationsGetErrors,\n  GetIntegrationToolsApiV1IntegrationsIntegrationNameToolsGetData,\n  GetIntegrationToolsApiV1IntegrationsIntegrationNameToolsGetResponses,\n  GetIntegrationToolsApiV1IntegrationsIntegrationNameToolsGetErrors,\n  UpsertMultipleToolCustomTagsApiV1IntegrationsIntegrationNameToolsCustomTagsPostData,\n  UpsertMultipleToolCustomTagsApiV1IntegrationsIntegrationNameToolsCustomTagsPostResponses,\n  UpsertMultipleToolCustomTagsApiV1IntegrationsIntegrationNameToolsCustomTagsPostErrors,\n  GetToolDetailsApiV1IntegrationsIntegrationNameToolsToolNameGetData,\n  GetToolDetailsApiV1IntegrationsIntegrationNameToolsToolNameGetResponses,\n  GetToolDetailsApiV1IntegrationsIntegrationNameToolsToolNameGetErrors,\n  DeleteToolCustomTagsApiV1IntegrationsIntegrationNameToolsToolNameCustomTagsDeleteData,\n  DeleteToolCustomTagsApiV1IntegrationsIntegrationNameToolsToolNameCustomTagsDeleteResponses,\n  DeleteToolCustomTagsApiV1IntegrationsIntegrationNameToolsToolNameCustomTagsDeleteErrors,\n  UpsertToolCustomTagsApiV1IntegrationsIntegrationNameToolsToolNameCustomTagsPostData,\n  UpsertToolCustomTagsApiV1IntegrationsIntegrationNameToolsToolNameCustomTagsPostResponses,\n  UpsertToolCustomTagsApiV1IntegrationsIntegrationNameToolsToolNameCustomTagsPostErrors,\n  GetAllPoliciesApiV1PoliciesGetData,\n  GetAllPoliciesApiV1PoliciesGetResponses,\n  GetAllPoliciesApiV1PoliciesGetErrors,\n  CreatePolicyApiV1PoliciesPostData,\n  CreatePolicyApiV1PoliciesPostResponses,\n  CreatePolicyApiV1PoliciesPostErrors,\n  GetApprovalRequestsApiV1PoliciesApprovalsGetData,\n  GetApprovalRequestsApiV1PoliciesApprovalsGetResponses,\n  GetApprovalRequestsApiV1PoliciesApprovalsGetErrors,\n  CheckResourceAccessGetApiV1PoliciesResourcesCheckGetData,\n  CheckResourceAccessGetApiV1PoliciesResourcesCheckGetResponses,\n  CheckResourceAccessApiV1PoliciesResourcesCheckPostData,\n  CheckResourceAccessApiV1PoliciesResourcesCheckPostResponses,\n  CheckResourceForApprovalApiV1PoliciesResourcesResourceNameApprovalGetData,\n  CheckResourceForApprovalApiV1PoliciesResourcesResourceNameApprovalGetResponses,\n  CheckResourceForApprovalApiV1PoliciesResourcesResourceNameApprovalGetErrors,\n  GetPolicyApiV1PoliciesPolicyIdGetData,\n  GetPolicyApiV1PoliciesPolicyIdGetResponses,\n  GetPolicyApiV1PoliciesPolicyIdGetErrors,\n  UpdatePolicyApiV1PoliciesPolicyIdPutData,\n  UpdatePolicyApiV1PoliciesPolicyIdPutResponses,\n  UpdatePolicyApiV1PoliciesPolicyIdPutErrors,\n  CheckPolicyStatusApiV1PoliciesPolicyIdAuditIdStatusPostData,\n  CheckPolicyStatusApiV1PoliciesPolicyIdAuditIdStatusPostResponses,\n  CheckPolicyStatusApiV1PoliciesPolicyIdAuditIdStatusPostErrors,\n  ListProvidersApiV1ProvidersGetData,\n  ListProvidersApiV1ProvidersGetResponses,\n  GetProviderApiV1ProvidersProviderIdGetData,\n  GetProviderApiV1ProvidersProviderIdGetResponses,\n  GetProviderApiV1ProvidersProviderIdGetErrors,\n  GetServersApiV1ProvidersProviderIdServersGetData,\n  GetServersApiV1ProvidersProviderIdServersGetResponses,\n  GetServersApiV1ProvidersProviderIdServersGetErrors,\n  SyncProviderApiV1ProvidersProviderIdSyncPostData,\n  SyncProviderApiV1ProvidersProviderIdSyncPostResponses,\n  SyncProviderApiV1ProvidersProviderIdSyncPostErrors,\n  InitializeApiV1SdkInitializeGetData,\n  InitializeApiV1SdkInitializeGetResponses,\n  GetServiceTokenApiV1SdkServiceTokenGetData,\n  GetServiceTokenApiV1SdkServiceTokenGetResponses,\n  ReindexApiV1SearchReindexPostData,\n  ReindexApiV1SearchReindexPostResponses,\n  ReindexToolprintsApiV1SearchReindexToolprintsPostData,\n  ReindexToolprintsApiV1SearchReindexToolprintsPostResponses,\n  ReindexToolsApiV1SearchReindexToolsPostData,\n  ReindexToolsApiV1SearchReindexToolsPostResponses,\n  SearchToolprintsApiV1SearchToolprintsPostData,\n  SearchToolprintsApiV1SearchToolprintsPostResponses,\n  SearchToolprintsApiV1SearchToolprintsPostErrors,\n  GetToolprintRecommendationApiV1SearchToolprintsRecommendationPostData,\n  GetToolprintRecommendationApiV1SearchToolprintsRecommendationPostResponses,\n  GetToolprintRecommendationApiV1SearchToolprintsRecommendationPostErrors,\n  SearchToolsApiV1SearchToolsPostData,\n  SearchToolsApiV1SearchToolsPostResponses,\n  SearchToolsApiV1SearchToolsPostErrors,\n  GetSecretsApiV1SecretsGetData,\n  GetSecretsApiV1SecretsGetResponses,\n  GetSecretApiV1SecretsSecretNameGetData,\n  GetSecretApiV1SecretsSecretNameGetResponses,\n  GetSecretApiV1SecretsSecretNameGetErrors,\n  UpsertSecretApiV1SecretsSecretNamePutData,\n  UpsertSecretApiV1SecretsSecretNamePutResponses,\n  UpsertSecretApiV1SecretsSecretNamePutErrors,\n  ListServersApiV1ServersGetData,\n  ListServersApiV1ServersGetResponses,\n  GetServerApiV1ServersServerIdGetData,\n  GetServerApiV1ServersServerIdGetResponses,\n  GetServerApiV1ServersServerIdGetErrors,\n  GetServerClientApiV1ServersServerIdClientGetData,\n  GetServerClientApiV1ServersServerIdClientGetResponses,\n  GetServerClientApiV1ServersServerIdClientGetErrors,\n  GetServerPropertiesApiV1ServersServerIdPropertiesGetData,\n  GetServerPropertiesApiV1ServersServerIdPropertiesGetResponses,\n  GetServerPropertiesApiV1ServersServerIdPropertiesGetErrors,\n  PatchServerPropertiesApiV1ServersServerIdPropertiesKeyPatchData,\n  PatchServerPropertiesApiV1ServersServerIdPropertiesKeyPatchResponses,\n  PatchServerPropertiesApiV1ServersServerIdPropertiesKeyPatchErrors,\n  GetStrategyApiV1StrategyPostData,\n  GetStrategyApiV1StrategyPostResponses,\n  GetStrategyApiV1StrategyPostErrors,\n  CreateFakeRecipesApiV1StrategyFakePostData,\n  CreateFakeRecipesApiV1StrategyFakePostResponses,\n  CreateToolprintApiV1ToolprintsPostData,\n  CreateToolprintApiV1ToolprintsPostResponses,\n  CreateToolprintApiV1ToolprintsPostErrors,\n  GetToolprintInstructionsApiV1ToolprintsWellKnownAiTxtGetData,\n  GetToolprintInstructionsApiV1ToolprintsWellKnownAiTxtGetResponses,\n  GetToolprintSchemaApiV1ToolprintsWellKnownSchemaGetData,\n  GetToolprintSchemaApiV1ToolprintsWellKnownSchemaGetResponses,\n  GetToolprintTemplateApiV1ToolprintsWellKnownTemplateGetData,\n  GetToolprintTemplateApiV1ToolprintsWellKnownTemplateGetResponses,\n  CreateToolprintJsonApiV1ToolprintsJsonPostData,\n  CreateToolprintJsonApiV1ToolprintsJsonPostResponses,\n  CreateToolprintJsonApiV1ToolprintsJsonPostErrors,\n  ValidateToolprintApiV1ToolprintsValidatePostData,\n  ValidateToolprintApiV1ToolprintsValidatePostResponses,\n  ValidateToolprintApiV1ToolprintsValidatePostErrors,\n  ValidateToolprintJsonApiV1ToolprintsValidateJsonPostData,\n  ValidateToolprintJsonApiV1ToolprintsValidateJsonPostResponses,\n  ValidateToolprintJsonApiV1ToolprintsValidateJsonPostErrors,\n  ValidateToolprintYamlApiV1ToolprintsValidateYamlPostData,\n  ValidateToolprintYamlApiV1ToolprintsValidateYamlPostResponses,\n  ValidateToolprintYamlApiV1ToolprintsValidateYamlPostErrors,\n  CreateToolprintYamlApiV1ToolprintsYamlPostData,\n  CreateToolprintYamlApiV1ToolprintsYamlPostResponses,\n  CreateToolprintYamlApiV1ToolprintsYamlPostErrors,\n  GetToolprintApiV1ToolprintsToolprintIdGetData,\n  GetToolprintApiV1ToolprintsToolprintIdGetResponses,\n  GetToolprintApiV1ToolprintsToolprintIdGetErrors,\n  ListToolsApiV1ToolsGetData,\n  ListToolsApiV1ToolsGetResponses,\n  GetToolResourcesBatchApiV1ToolsResourcesBatchPostData,\n  GetToolResourcesBatchApiV1ToolsResourcesBatchPostResponses,\n  GetToolResourcesBatchApiV1ToolsResourcesBatchPostErrors,\n  GetToolApiV1ToolsToolIdGetData,\n  GetToolApiV1ToolsToolIdGetResponses,\n  GetToolApiV1ToolsToolIdGetErrors,\n  GetToolPropertiesApiV1ToolsToolIdPropertiesGetData,\n  GetToolPropertiesApiV1ToolsToolIdPropertiesGetResponses,\n  GetToolPropertiesApiV1ToolsToolIdPropertiesGetErrors,\n  GetToolResourceApiV1ToolsToolIdResourceGetData,\n  GetToolResourceApiV1ToolsToolIdResourceGetResponses,\n  GetToolResourceApiV1ToolsToolIdResourceGetErrors,\n  HealthHealthGetData,\n  HealthHealthGetResponses\n} from './types.gen.js'\nimport {\n  zGetAiDocumentationAiTxtGetData,\n  zGetAiDocumentationAiTxtGetResponse,\n  zDeleteAccountApiV1AccountDeleteData,\n  zDeleteAccountApiV1AccountDeleteResponse,\n  zGetAccountInformationApiV1AccountGetData,\n  zGetAccountInformationApiV1AccountGetResponse,\n  zCreateAccountApiV1AccountPostData,\n  zCreateAccountApiV1AccountPostResponse,\n  zGetApiKeyApiV1AccountApiKeyGetData,\n  zGetApiKeyApiV1AccountApiKeyGetResponse,\n  zGetAuthStatusApiV1AccountAuthStatusGetData,\n  zGetAuthStatusApiV1AccountAuthStatusGetResponse,\n  zCreateAccountByInvitationApiV1AccountInvitationCodePostData,\n  zCreateAccountByInvitationApiV1AccountInvitationCodePostResponse,\n  zGetServiceTokenApiV1AccountServiceTokenGetData,\n  zGetServiceTokenApiV1AccountServiceTokenGetResponse,\n  zRotateServiceTokenApiV1AccountServiceTokenPostData,\n  zRotateServiceTokenApiV1AccountServiceTokenPostResponse,\n  zGetAuditLogsApiV1AuditGetData,\n  zGetAuditLogsApiV1AuditGetResponse,\n  zGetAllFlagsApiV1FlagsGetData,\n  zGetAllFlagsApiV1FlagsGetResponse,\n  zListIntegrationsApiV1IntegrationsGetData,\n  zListIntegrationsApiV1IntegrationsGetResponse,\n  zGetIntegrationToolsApiV1IntegrationsIntegrationNameToolsGetData,\n  zGetIntegrationToolsApiV1IntegrationsIntegrationNameToolsGetResponse,\n  zUpsertMultipleToolCustomTagsApiV1IntegrationsIntegrationNameToolsCustomTagsPostData,\n  zUpsertMultipleToolCustomTagsApiV1IntegrationsIntegrationNameToolsCustomTagsPostResponse,\n  zGetToolDetailsApiV1IntegrationsIntegrationNameToolsToolNameGetData,\n  zGetToolDetailsApiV1IntegrationsIntegrationNameToolsToolNameGetResponse,\n  zDeleteToolCustomTagsApiV1IntegrationsIntegrationNameToolsToolNameCustomTagsDeleteData,\n  zDeleteToolCustomTagsApiV1IntegrationsIntegrationNameToolsToolNameCustomTagsDeleteResponse,\n  zUpsertToolCustomTagsApiV1IntegrationsIntegrationNameToolsToolNameCustomTagsPostData,\n  zUpsertToolCustomTagsApiV1IntegrationsIntegrationNameToolsToolNameCustomTagsPostResponse,\n  zGetAllPoliciesApiV1PoliciesGetData,\n  zGetAllPoliciesApiV1PoliciesGetResponse,\n  zCreatePolicyApiV1PoliciesPostData,\n  zCreatePolicyApiV1PoliciesPostResponse,\n  zGetApprovalRequestsApiV1PoliciesApprovalsGetData,\n  zGetApprovalRequestsApiV1PoliciesApprovalsGetResponse,\n  zCheckResourceAccessGetApiV1PoliciesResourcesCheckGetData,\n  zCheckResourceAccessGetApiV1PoliciesResourcesCheckGetResponse,\n  zCheckResourceAccessApiV1PoliciesResourcesCheckPostData,\n  zCheckResourceAccessApiV1PoliciesResourcesCheckPostResponse,\n  zCheckResourceForApprovalApiV1PoliciesResourcesResourceNameApprovalGetData,\n  zGetPolicyApiV1PoliciesPolicyIdGetData,\n  zGetPolicyApiV1PoliciesPolicyIdGetResponse,\n  zUpdatePolicyApiV1PoliciesPolicyIdPutData,\n  zUpdatePolicyApiV1PoliciesPolicyIdPutResponse,\n  zCheckPolicyStatusApiV1PoliciesPolicyIdAuditIdStatusPostData,\n  zListProvidersApiV1ProvidersGetData,\n  zListProvidersApiV1ProvidersGetResponse,\n  zGetProviderApiV1ProvidersProviderIdGetData,\n  zGetProviderApiV1ProvidersProviderIdGetResponse,\n  zGetServersApiV1ProvidersProviderIdServersGetData,\n  zGetServersApiV1ProvidersProviderIdServersGetResponse,\n  zSyncProviderApiV1ProvidersProviderIdSyncPostData,\n  zInitializeApiV1SdkInitializeGetData,\n  zInitializeApiV1SdkInitializeGetResponse,\n  zGetServiceTokenApiV1SdkServiceTokenGetData,\n  zGetServiceTokenApiV1SdkServiceTokenGetResponse,\n  zReindexApiV1SearchReindexPostData,\n  zReindexToolprintsApiV1SearchReindexToolprintsPostData,\n  zReindexToolsApiV1SearchReindexToolsPostData,\n  zSearchToolprintsApiV1SearchToolprintsPostData,\n  zSearchToolprintsApiV1SearchToolprintsPostResponse,\n  zGetToolprintRecommendationApiV1SearchToolprintsRecommendationPostData,\n  zGetToolprintRecommendationApiV1SearchToolprintsRecommendationPostResponse,\n  zSearchToolsApiV1SearchToolsPostData,\n  zSearchToolsApiV1SearchToolsPostResponse,\n  zGetSecretsApiV1SecretsGetData,\n  zGetSecretApiV1SecretsSecretNameGetData,\n  zGetSecretApiV1SecretsSecretNameGetResponse,\n  zUpsertSecretApiV1SecretsSecretNamePutData,\n  zUpsertSecretApiV1SecretsSecretNamePutResponse,\n  zListServersApiV1ServersGetData,\n  zListServersApiV1ServersGetResponse,\n  zGetServerApiV1ServersServerIdGetData,\n  zGetServerApiV1ServersServerIdGetResponse,\n  zGetServerClientApiV1ServersServerIdClientGetData,\n  zGetServerClientApiV1ServersServerIdClientGetResponse,\n  zGetServerPropertiesApiV1ServersServerIdPropertiesGetData,\n  zGetServerPropertiesApiV1ServersServerIdPropertiesGetResponse,\n  zPatchServerPropertiesApiV1ServersServerIdPropertiesKeyPatchData,\n  zPatchServerPropertiesApiV1ServersServerIdPropertiesKeyPatchResponse,\n  zGetStrategyApiV1StrategyPostData,\n  zGetStrategyApiV1StrategyPostResponse,\n  zCreateFakeRecipesApiV1StrategyFakePostData,\n  zCreateFakeRecipesApiV1StrategyFakePostResponse,\n  zCreateToolprintApiV1ToolprintsPostData,\n  zCreateToolprintApiV1ToolprintsPostResponse,\n  zGetToolprintInstructionsApiV1ToolprintsWellKnownAiTxtGetData,\n  zGetToolprintInstructionsApiV1ToolprintsWellKnownAiTxtGetResponse,\n  zGetToolprintSchemaApiV1ToolprintsWellKnownSchemaGetData,\n  zGetToolprintSchemaApiV1ToolprintsWellKnownSchemaGetResponse,\n  zGetToolprintTemplateApiV1ToolprintsWellKnownTemplateGetData,\n  zGetToolprintTemplateApiV1ToolprintsWellKnownTemplateGetResponse,\n  zCreateToolprintJsonApiV1ToolprintsJsonPostData,\n  zCreateToolprintJsonApiV1ToolprintsJsonPostResponse,\n  zValidateToolprintApiV1ToolprintsValidatePostData,\n  zValidateToolprintApiV1ToolprintsValidatePostResponse,\n  zValidateToolprintJsonApiV1ToolprintsValidateJsonPostData,\n  zValidateToolprintYamlApiV1ToolprintsValidateYamlPostData,\n  zValidateToolprintYamlApiV1ToolprintsValidateYamlPostResponse,\n  zCreateToolprintYamlApiV1ToolprintsYamlPostData,\n  zCreateToolprintYamlApiV1ToolprintsYamlPostResponse,\n  zGetToolprintApiV1ToolprintsToolprintIdGetData,\n  zGetToolprintApiV1ToolprintsToolprintIdGetResponse,\n  zListToolsApiV1ToolsGetData,\n  zListToolsApiV1ToolsGetResponse,\n  zGetToolResourcesBatchApiV1ToolsResourcesBatchPostData,\n  zGetToolResourcesBatchApiV1ToolsResourcesBatchPostResponse,\n  zGetToolApiV1ToolsToolIdGetData,\n  zGetToolApiV1ToolsToolIdGetResponse,\n  zGetToolPropertiesApiV1ToolsToolIdPropertiesGetData,\n  zGetToolPropertiesApiV1ToolsToolIdPropertiesGetResponse,\n  zGetToolResourceApiV1ToolsToolIdResourceGetData,\n  zGetToolResourceApiV1ToolsToolIdResourceGetResponse,\n  zHealthHealthGetData\n} from './zod.gen.js'\nimport { client as _heyApiClient } from './client.gen.js'\n\nexport type Options<\n  TData extends TDataShape = TDataShape,\n  ThrowOnError extends boolean = boolean\n> = ClientOptions<TData, ThrowOnError> & {\n  /**\n   * You can provide a client instance returned by `createClient()` instead of\n   * individual options. This might be also useful if you want to implement a\n   * custom client.\n   */\n  client?: Client\n  /**\n   * You can pass arbitrary values through the `meta` object. This can be\n   * used to access values that aren't defined as part of the SDK function.\n   */\n  meta?: Record<string, unknown>\n}\n\nexport class Default {\n  /**\n   * Get Ai Documentation\n   * Returns the complete API documentation including toolprint examples.\n   *\n   * This endpoint combines:\n   * 1. Base API documentation (base_ai.txt)\n   * 2. Toolprint example and usage guide (toolprint_example.txt)\n   */\n  public static getAiDocumentationAiTxtGet<\n    ThrowOnError extends boolean = false\n  >(options?: Options<GetAiDocumentationAiTxtGetData, ThrowOnError>) {\n    return (options?.client ?? _heyApiClient).get<\n      GetAiDocumentationAiTxtGetResponses,\n      unknown,\n      ThrowOnError\n    >({\n      requestValidator: async (data) => {\n        return await zGetAiDocumentationAiTxtGetData.parseAsync(data)\n      },\n      responseValidator: async (data) => {\n        return await zGetAiDocumentationAiTxtGetResponse.parseAsync(data)\n      },\n      url: '/ai.txt',\n      ...options\n    })\n  }\n\n  /**\n   * Health\n   * Generic healthcheck endpoint to ensure the service is running.\n   */\n  public static healthHealthGet<ThrowOnError extends boolean = false>(\n    options?: Options<HealthHealthGetData, ThrowOnError>\n  ) {\n    return (options?.client ?? _heyApiClient).get<\n      HealthHealthGetResponses,\n      unknown,\n      ThrowOnError\n    >({\n      requestValidator: async (data) => {\n        return await zHealthHealthGetData.parseAsync(data)\n      },\n      url: '/health',\n      ...options\n    })\n  }\n}\n\nexport class Account {\n  /**\n   * Delete Account\n   */\n  public static deleteAccountApiV1AccountDelete<\n    ThrowOnError extends boolean = false\n  >(options?: Options<DeleteAccountApiV1AccountDeleteData, ThrowOnError>) {\n    return (options?.client ?? _heyApiClient).delete<\n      DeleteAccountApiV1AccountDeleteResponses,\n      unknown,\n      ThrowOnError\n    >({\n      requestValidator: async (data) => {\n        return await zDeleteAccountApiV1AccountDeleteData.parseAsync(data)\n      },\n      responseValidator: async (data) => {\n        return await zDeleteAccountApiV1AccountDeleteResponse.parseAsync(data)\n      },\n      security: [\n        {\n          scheme: 'bearer',\n          type: 'http'\n        }\n      ],\n      url: '/api/v1/account/',\n      ...options\n    })\n  }\n\n  /**\n   * Get Account Information\n   */\n  public static getAccountInformationApiV1AccountGet<\n    ThrowOnError extends boolean = false\n  >(options?: Options<GetAccountInformationApiV1AccountGetData, ThrowOnError>) {\n    return (options?.client ?? _heyApiClient).get<\n      GetAccountInformationApiV1AccountGetResponses,\n      unknown,\n      ThrowOnError\n    >({\n      requestValidator: async (data) => {\n        return await zGetAccountInformationApiV1AccountGetData.parseAsync(data)\n      },\n      responseValidator: async (data) => {\n        return await zGetAccountInformationApiV1AccountGetResponse.parseAsync(\n          data\n        )\n      },\n      security: [\n        {\n          scheme: 'bearer',\n          type: 'http'\n        }\n      ],\n      url: '/api/v1/account/',\n      ...options\n    })\n  }\n\n  /**\n   * Create Account\n   * Creates a new account given an authenticated user if they recently signed up via PropelAuth.\n   *\n   * NOTE: This only creates the account, not assign the user to an organization.\n   * Use invitation codes to assign to an organization.\n   */\n  public static createAccountApiV1AccountPost<\n    ThrowOnError extends boolean = false\n  >(options?: Options<CreateAccountApiV1AccountPostData, ThrowOnError>) {\n    return (options?.client ?? _heyApiClient).post<\n      CreateAccountApiV1AccountPostResponses,\n      unknown,\n      ThrowOnError\n    >({\n      requestValidator: async (data) => {\n        return await zCreateAccountApiV1AccountPostData.parseAsync(data)\n      },\n      responseValidator: async (data) => {\n        return await zCreateAccountApiV1AccountPostResponse.parseAsync(data)\n      },\n      security: [\n        {\n          scheme: 'bearer',\n          type: 'http'\n        }\n      ],\n      url: '/api/v1/account/',\n      ...options\n    })\n  }\n\n  /**\n   * Get Api Key\n   * Returns the API key information for the authenticated user.\n   */\n  public static getApiKeyApiV1AccountApiKeyGet<\n    ThrowOnError extends boolean = false\n  >(options?: Options<GetApiKeyApiV1AccountApiKeyGetData, ThrowOnError>) {\n    return (options?.client ?? _heyApiClient).get<\n      GetApiKeyApiV1AccountApiKeyGetResponses,\n      unknown,\n      ThrowOnError\n    >({\n      requestValidator: async (data) => {\n        return await zGetApiKeyApiV1AccountApiKeyGetData.parseAsync(data)\n      },\n      responseValidator: async (data) => {\n        return await zGetApiKeyApiV1AccountApiKeyGetResponse.parseAsync(data)\n      },\n      security: [\n        {\n          scheme: 'bearer',\n          type: 'http'\n        }\n      ],\n      url: '/api/v1/account/api-key',\n      ...options\n    })\n  }\n\n  /**\n   * Get Auth Status\n   * Returns the authentications state of the caller. Will read their API Key or JWT and then determine\n   * if a OneGrep account exists. If yes, then it will be considered authenticated.\n   *\n   * # ! NOTE: The User may have a valid JWT but if they do not have a OneGrep account, they will not be considered authenticated.\n   */\n  public static getAuthStatusApiV1AccountAuthStatusGet<\n    ThrowOnError extends boolean = false\n  >(\n    options?: Options<GetAuthStatusApiV1AccountAuthStatusGetData, ThrowOnError>\n  ) {\n    return (options?.client ?? _heyApiClient).get<\n      GetAuthStatusApiV1AccountAuthStatusGetResponses,\n      unknown,\n      ThrowOnError\n    >({\n      requestValidator: async (data) => {\n        return await zGetAuthStatusApiV1AccountAuthStatusGetData.parseAsync(\n          data\n        )\n      },\n      responseValidator: async (data) => {\n        return await zGetAuthStatusApiV1AccountAuthStatusGetResponse.parseAsync(\n          data\n        )\n      },\n      security: [\n        {\n          scheme: 'bearer',\n          type: 'http'\n        },\n        {\n          name: 'X-ONEGREP-API-KEY',\n          type: 'apiKey'\n        }\n      ],\n      url: '/api/v1/account/auth/status',\n      ...options\n    })\n  }\n\n  /**\n   * Create Account By Invitation\n   * Creates a new account given an authenticated user and a valid invitation code.\n   */\n  public static createAccountByInvitationApiV1AccountInvitationCodePost<\n    ThrowOnError extends boolean = false\n  >(\n    options: Options<\n      CreateAccountByInvitationApiV1AccountInvitationCodePostData,\n      ThrowOnError\n    >\n  ) {\n    return (options.client ?? _heyApiClient).post<\n      CreateAccountByInvitationApiV1AccountInvitationCodePostResponses,\n      CreateAccountByInvitationApiV1AccountInvitationCodePostErrors,\n      ThrowOnError\n    >({\n      requestValidator: async (data) => {\n        return await zCreateAccountByInvitationApiV1AccountInvitationCodePostData.parseAsync(\n          data\n        )\n      },\n      responseValidator: async (data) => {\n        return await zCreateAccountByInvitationApiV1AccountInvitationCodePostResponse.parseAsync(\n          data\n        )\n      },\n      security: [\n        {\n          scheme: 'bearer',\n          type: 'http'\n        }\n      ],\n      url: '/api/v1/account/invitation-code',\n      ...options,\n      headers: {\n        'Content-Type': 'application/json',\n        ...options.headers\n      }\n    })\n  }\n\n  /**\n   * Get Service Token\n   * Returns the service token information for the authenticated user.\n   */\n  public static getServiceTokenApiV1AccountServiceTokenGet<\n    ThrowOnError extends boolean = false\n  >(\n    options?: Options<\n      GetServiceTokenApiV1AccountServiceTokenGetData,\n      ThrowOnError\n    >\n  ) {\n    return (options?.client ?? _heyApiClient).get<\n      GetServiceTokenApiV1AccountServiceTokenGetResponses,\n      unknown,\n      ThrowOnError\n    >({\n      requestValidator: async (data) => {\n        return await zGetServiceTokenApiV1AccountServiceTokenGetData.parseAsync(\n          data\n        )\n      },\n      responseValidator: async (data) => {\n        return await zGetServiceTokenApiV1AccountServiceTokenGetResponse.parseAsync(\n          data\n        )\n      },\n      security: [\n        {\n          scheme: 'bearer',\n          type: 'http'\n        }\n      ],\n      url: '/api/v1/account/service-token',\n      ...options\n    })\n  }\n\n  /**\n   * Rotate Service Token\n   */\n  public static rotateServiceTokenApiV1AccountServiceTokenPost<\n    ThrowOnError extends boolean = false\n  >(\n    options?: Options<\n      RotateServiceTokenApiV1AccountServiceTokenPostData,\n      ThrowOnError\n    >\n  ) {\n    return (options?.client ?? _heyApiClient).post<\n      RotateServiceTokenApiV1AccountServiceTokenPostResponses,\n      unknown,\n      ThrowOnError\n    >({\n      requestValidator: async (data) => {\n        return await zRotateServiceTokenApiV1AccountServiceTokenPostData.parseAsync(\n          data\n        )\n      },\n      responseValidator: async (data) => {\n        return await zRotateServiceTokenApiV1AccountServiceTokenPostResponse.parseAsync(\n          data\n        )\n      },\n      security: [\n        {\n          scheme: 'bearer',\n          type: 'http'\n        }\n      ],\n      url: '/api/v1/account/service-token',\n      ...options\n    })\n  }\n}\n\nexport class Audit {\n  /**\n   * Get Audit Logs\n   * Gets audit logs visible to the user with pagination and filtering.\n   *\n   * - Page numbers start at 1 (not 0)\n   * - Results are sorted by timestamp (newest first)\n   * - Optional filters can be applied for policy_id, action, and date range\n   */\n  public static getAuditLogsApiV1AuditGet<ThrowOnError extends boolean = false>(\n    options?: Options<GetAuditLogsApiV1AuditGetData, ThrowOnError>\n  ) {\n    return (options?.client ?? _heyApiClient).get<\n      GetAuditLogsApiV1AuditGetResponses,\n      GetAuditLogsApiV1AuditGetErrors,\n      ThrowOnError\n    >({\n      requestValidator: async (data) => {\n        return await zGetAuditLogsApiV1AuditGetData.parseAsync(data)\n      },\n      responseValidator: async (data) => {\n        return await zGetAuditLogsApiV1AuditGetResponse.parseAsync(data)\n      },\n      security: [\n        {\n          name: 'X-ONEGREP-API-KEY',\n          type: 'apiKey'\n        }\n      ],\n      url: '/api/v1/audit/',\n      ...options\n    })\n  }\n}\n\nexport class Flags {\n  /**\n   * Get All Flags\n   */\n  public static getAllFlagsApiV1FlagsGet<ThrowOnError extends boolean = false>(\n    options?: Options<GetAllFlagsApiV1FlagsGetData, ThrowOnError>\n  ) {\n    return (options?.client ?? _heyApiClient).get<\n      GetAllFlagsApiV1FlagsGetResponses,\n      unknown,\n      ThrowOnError\n    >({\n      requestValidator: async (data) => {\n        return await zGetAllFlagsApiV1FlagsGetData.parseAsync(data)\n      },\n      responseValidator: async (data) => {\n        return await zGetAllFlagsApiV1FlagsGetResponse.parseAsync(data)\n      },\n      security: [\n        {\n          name: 'X-ONEGREP-API-KEY',\n          type: 'apiKey'\n        }\n      ],\n      url: '/api/v1/flags/',\n      ...options\n    })\n  }\n}\n\nexport class Integrations {\n  /**\n   * List Integrations\n   * Lists all available integrations for a user's organization.\n   * If active is true, only returns integrations that have an active tool server.\n   */\n  public static listIntegrationsApiV1IntegrationsGet<\n    ThrowOnError extends boolean = false\n  >(options?: Options<ListIntegrationsApiV1IntegrationsGetData, ThrowOnError>) {\n    return (options?.client ?? _heyApiClient).get<\n      ListIntegrationsApiV1IntegrationsGetResponses,\n      ListIntegrationsApiV1IntegrationsGetErrors,\n      ThrowOnError\n    >({\n      requestValidator: async (data) => {\n        return await zListIntegrationsApiV1IntegrationsGetData.parseAsync(data)\n      },\n      responseValidator: async (data) => {\n        return await zListIntegrationsApiV1IntegrationsGetResponse.parseAsync(\n          data\n        )\n      },\n      security: [\n        {\n          name: 'X-ONEGREP-API-KEY',\n          type: 'apiKey'\n        }\n      ],\n      url: '/api/v1/integrations/',\n      ...options\n    })\n  }\n\n  /**\n   * Get Integration Tools\n   * Returns details for a tool in an integration available to a user.\n   */\n  public static getIntegrationToolsApiV1IntegrationsIntegrationNameToolsGet<\n    ThrowOnError extends boolean = false\n  >(\n    options: Options<\n      GetIntegrationToolsApiV1IntegrationsIntegrationNameToolsGetData,\n      ThrowOnError\n    >\n  ) {\n    return (options.client ?? _heyApiClient).get<\n      GetIntegrationToolsApiV1IntegrationsIntegrationNameToolsGetResponses,\n      GetIntegrationToolsApiV1IntegrationsIntegrationNameToolsGetErrors,\n      ThrowOnError\n    >({\n      requestValidator: async (data) => {\n        return await zGetIntegrationToolsApiV1IntegrationsIntegrationNameToolsGetData.parseAsync(\n          data\n        )\n      },\n      responseValidator: async (data) => {\n        return await zGetIntegrationToolsApiV1IntegrationsIntegrationNameToolsGetResponse.parseAsync(\n          data\n        )\n      },\n      security: [\n        {\n          name: 'X-ONEGREP-API-KEY',\n          type: 'apiKey'\n        }\n      ],\n      url: '/api/v1/integrations/{integration_name}/tools',\n      ...options\n    })\n  }\n\n  /**\n   * Upsert Multiple Tool Custom Tags\n   * Upserts custom tags for multiple tools in an integration.\n   */\n  public static upsertMultipleToolCustomTagsApiV1IntegrationsIntegrationNameToolsCustomTagsPost<\n    ThrowOnError extends boolean = false\n  >(\n    options: Options<\n      UpsertMultipleToolCustomTagsApiV1IntegrationsIntegrationNameToolsCustomTagsPostData,\n      ThrowOnError\n    >\n  ) {\n    return (options.client ?? _heyApiClient).post<\n      UpsertMultipleToolCustomTagsApiV1IntegrationsIntegrationNameToolsCustomTagsPostResponses,\n      UpsertMultipleToolCustomTagsApiV1IntegrationsIntegrationNameToolsCustomTagsPostErrors,\n      ThrowOnError\n    >({\n      requestValidator: async (data) => {\n        return await zUpsertMultipleToolCustomTagsApiV1IntegrationsIntegrationNameToolsCustomTagsPostData.parseAsync(\n          data\n        )\n      },\n      responseValidator: async (data) => {\n        return await zUpsertMultipleToolCustomTagsApiV1IntegrationsIntegrationNameToolsCustomTagsPostResponse.parseAsync(\n          data\n        )\n      },\n      security: [\n        {\n          name: 'X-ONEGREP-API-KEY',\n          type: 'apiKey'\n        }\n      ],\n      url: '/api/v1/integrations/{integration_name}/tools/custom/tags',\n      ...options,\n      headers: {\n        'Content-Type': 'application/json',\n        ...options.headers\n      }\n    })\n  }\n\n  /**\n   * Get Tool Details\n   * Returns the details for a tool in an integration.\n   */\n  public static getToolDetailsApiV1IntegrationsIntegrationNameToolsToolNameGet<\n    ThrowOnError extends boolean = false\n  >(\n    options: Options<\n      GetToolDetailsApiV1IntegrationsIntegrationNameToolsToolNameGetData,\n      ThrowOnError\n    >\n  ) {\n    return (options.client ?? _heyApiClient).get<\n      GetToolDetailsApiV1IntegrationsIntegrationNameToolsToolNameGetResponses,\n      GetToolDetailsApiV1IntegrationsIntegrationNameToolsToolNameGetErrors,\n      ThrowOnError\n    >({\n      requestValidator: async (data) => {\n        return await zGetToolDetailsApiV1IntegrationsIntegrationNameToolsToolNameGetData.parseAsync(\n          data\n        )\n      },\n      responseValidator: async (data) => {\n        return await zGetToolDetailsApiV1IntegrationsIntegrationNameToolsToolNameGetResponse.parseAsync(\n          data\n        )\n      },\n      security: [\n        {\n          name: 'X-ONEGREP-API-KEY',\n          type: 'apiKey'\n        }\n      ],\n      url: '/api/v1/integrations/{integration_name}/tools/{tool_name}',\n      ...options\n    })\n  }\n\n  /**\n   * Delete Tool Custom Tags\n   * Deletes custom tags for a tool in an integration.\n   */\n  public static deleteToolCustomTagsApiV1IntegrationsIntegrationNameToolsToolNameCustomTagsDelete<\n    ThrowOnError extends boolean = false\n  >(\n    options: Options<\n      DeleteToolCustomTagsApiV1IntegrationsIntegrationNameToolsToolNameCustomTagsDeleteData,\n      ThrowOnError\n    >\n  ) {\n    return (options.client ?? _heyApiClient).delete<\n      DeleteToolCustomTagsApiV1IntegrationsIntegrationNameToolsToolNameCustomTagsDeleteResponses,\n      DeleteToolCustomTagsApiV1IntegrationsIntegrationNameToolsToolNameCustomTagsDeleteErrors,\n      ThrowOnError\n    >({\n      requestValidator: async (data) => {\n        return await zDeleteToolCustomTagsApiV1IntegrationsIntegrationNameToolsToolNameCustomTagsDeleteData.parseAsync(\n          data\n        )\n      },\n      responseValidator: async (data) => {\n        return await zDeleteToolCustomTagsApiV1IntegrationsIntegrationNameToolsToolNameCustomTagsDeleteResponse.parseAsync(\n          data\n        )\n      },\n      security: [\n        {\n          name: 'X-ONEGREP-API-KEY',\n          type: 'apiKey'\n        }\n      ],\n      url: '/api/v1/integrations/{integration_name}/tools/{tool_name}/custom/tags',\n      ...options,\n      headers: {\n        'Content-Type': 'application/json',\n        ...options.headers\n      }\n    })\n  }\n\n  /**\n   * Upsert Tool Custom Tags\n   * Upserts custom tags for a tool in an integration. Will not delete any existing tags but will update any\n   * overlapping tags that are already set.\n   */\n  public static upsertToolCustomTagsApiV1IntegrationsIntegrationNameToolsToolNameCustomTagsPost<\n    ThrowOnError extends boolean = false\n  >(\n    options: Options<\n      UpsertToolCustomTagsApiV1IntegrationsIntegrationNameToolsToolNameCustomTagsPostData,\n      ThrowOnError\n    >\n  ) {\n    return (options.client ?? _heyApiClient).post<\n      UpsertToolCustomTagsApiV1IntegrationsIntegrationNameToolsToolNameCustomTagsPostResponses,\n      UpsertToolCustomTagsApiV1IntegrationsIntegrationNameToolsToolNameCustomTagsPostErrors,\n      ThrowOnError\n    >({\n      requestValidator: async (data) => {\n        return await zUpsertToolCustomTagsApiV1IntegrationsIntegrationNameToolsToolNameCustomTagsPostData.parseAsync(\n          data\n        )\n      },\n      responseValidator: async (data) => {\n        return await zUpsertToolCustomTagsApiV1IntegrationsIntegrationNameToolsToolNameCustomTagsPostResponse.parseAsync(\n          data\n        )\n      },\n      security: [\n        {\n          name: 'X-ONEGREP-API-KEY',\n          type: 'apiKey'\n        }\n      ],\n      url: '/api/v1/integrations/{integration_name}/tools/{tool_name}/custom/tags',\n      ...options,\n      headers: {\n        'Content-Type': 'application/json',\n        ...options.headers\n      }\n    })\n  }\n}\n\nexport class Policies {\n  /**\n   * Get All Policies\n   */\n  public static getAllPoliciesApiV1PoliciesGet<\n    ThrowOnError extends boolean = false\n  >(options?: Options<GetAllPoliciesApiV1PoliciesGetData, ThrowOnError>) {\n    return (options?.client ?? _heyApiClient).get<\n      GetAllPoliciesApiV1PoliciesGetResponses,\n      GetAllPoliciesApiV1PoliciesGetErrors,\n      ThrowOnError\n    >({\n      requestValidator: async (data) => {\n        return await zGetAllPoliciesApiV1PoliciesGetData.parseAsync(data)\n      },\n      responseValidator: async (data) => {\n        return await zGetAllPoliciesApiV1PoliciesGetResponse.parseAsync(data)\n      },\n      security: [\n        {\n          name: 'X-ONEGREP-API-KEY',\n          type: 'apiKey'\n        }\n      ],\n      url: '/api/v1/policies/',\n      ...options\n    })\n  }\n\n  /**\n   * Create Policy\n   */\n  public static createPolicyApiV1PoliciesPost<\n    ThrowOnError extends boolean = false\n  >(options: Options<CreatePolicyApiV1PoliciesPostData, ThrowOnError>) {\n    return (options.client ?? _heyApiClient).post<\n      CreatePolicyApiV1PoliciesPostResponses,\n      CreatePolicyApiV1PoliciesPostErrors,\n      ThrowOnError\n    >({\n      requestValidator: async (data) => {\n        return await zCreatePolicyApiV1PoliciesPostData.parseAsync(data)\n      },\n      responseValidator: async (data) => {\n        return await zCreatePolicyApiV1PoliciesPostResponse.parseAsync(data)\n      },\n      security: [\n        {\n          name: 'X-ONEGREP-API-KEY',\n          type: 'apiKey'\n        }\n      ],\n      url: '/api/v1/policies/',\n      ...options,\n      headers: {\n        'Content-Type': 'application/json',\n        ...options.headers\n      }\n    })\n  }\n\n  /**\n   * Get Approval Requests\n   * Get all approval requests visible to the user with their associated policies and resource details.\n   */\n  public static getApprovalRequestsApiV1PoliciesApprovalsGet<\n    ThrowOnError extends boolean = false\n  >(\n    options?: Options<\n      GetApprovalRequestsApiV1PoliciesApprovalsGetData,\n      ThrowOnError\n    >\n  ) {\n    return (options?.client ?? _heyApiClient).get<\n      GetApprovalRequestsApiV1PoliciesApprovalsGetResponses,\n      GetApprovalRequestsApiV1PoliciesApprovalsGetErrors,\n      ThrowOnError\n    >({\n      requestValidator: async (data) => {\n        return await zGetApprovalRequestsApiV1PoliciesApprovalsGetData.parseAsync(\n          data\n        )\n      },\n      responseValidator: async (data) => {\n        return await zGetApprovalRequestsApiV1PoliciesApprovalsGetResponse.parseAsync(\n          data\n        )\n      },\n      security: [\n        {\n          name: 'X-ONEGREP-API-KEY',\n          type: 'apiKey'\n        }\n      ],\n      url: '/api/v1/policies/approvals',\n      ...options\n    })\n  }\n\n  /**\n   * Check Resource Access Get\n   */\n  public static checkResourceAccessGetApiV1PoliciesResourcesCheckGet<\n    ThrowOnError extends boolean = false\n  >(\n    options?: Options<\n      CheckResourceAccessGetApiV1PoliciesResourcesCheckGetData,\n      ThrowOnError\n    >\n  ) {\n    return (options?.client ?? _heyApiClient).get<\n      CheckResourceAccessGetApiV1PoliciesResourcesCheckGetResponses,\n      unknown,\n      ThrowOnError\n    >({\n      requestValidator: async (data) => {\n        return await zCheckResourceAccessGetApiV1PoliciesResourcesCheckGetData.parseAsync(\n          data\n        )\n      },\n      responseValidator: async (data) => {\n        return await zCheckResourceAccessGetApiV1PoliciesResourcesCheckGetResponse.parseAsync(\n          data\n        )\n      },\n      url: '/api/v1/policies/resources/check',\n      ...options\n    })\n  }\n\n  /**\n   * Check Resource Access\n   * Generic endpoint to check resource access.\n   */\n  public static checkResourceAccessApiV1PoliciesResourcesCheckPost<\n    ThrowOnError extends boolean = false\n  >(\n    options?: Options<\n      CheckResourceAccessApiV1PoliciesResourcesCheckPostData,\n      ThrowOnError\n    >\n  ) {\n    return (options?.client ?? _heyApiClient).post<\n      CheckResourceAccessApiV1PoliciesResourcesCheckPostResponses,\n      unknown,\n      ThrowOnError\n    >({\n      requestValidator: async (data) => {\n        return await zCheckResourceAccessApiV1PoliciesResourcesCheckPostData.parseAsync(\n          data\n        )\n      },\n      responseValidator: async (data) => {\n        return await zCheckResourceAccessApiV1PoliciesResourcesCheckPostResponse.parseAsync(\n          data\n        )\n      },\n      security: [\n        {\n          name: 'X-ONEGREP-API-KEY',\n          type: 'apiKey'\n        }\n      ],\n      url: '/api/v1/policies/resources/check',\n      ...options\n    })\n  }\n\n  /**\n   * Check Resource For Approval\n   * Checks the policy that is associated with a resource if it requires approval, if yes, this will create an approval request. If the policy indicates that\n   * it does require approval, this will wait for the user to approve or reject the request before returning back the final\n   * response and HTTP CODE. 200 = approved or didn't require approval, 403 = rejected by the user.\n   */\n  public static checkResourceForApprovalApiV1PoliciesResourcesResourceNameApprovalGet<\n    ThrowOnError extends boolean = false\n  >(\n    options: Options<\n      CheckResourceForApprovalApiV1PoliciesResourcesResourceNameApprovalGetData,\n      ThrowOnError\n    >\n  ) {\n    return (options.client ?? _heyApiClient).get<\n      CheckResourceForApprovalApiV1PoliciesResourcesResourceNameApprovalGetResponses,\n      CheckResourceForApprovalApiV1PoliciesResourcesResourceNameApprovalGetErrors,\n      ThrowOnError\n    >({\n      requestValidator: async (data) => {\n        return await zCheckResourceForApprovalApiV1PoliciesResourcesResourceNameApprovalGetData.parseAsync(\n          data\n        )\n      },\n      security: [\n        {\n          name: 'X-ONEGREP-API-KEY',\n          type: 'apiKey'\n        }\n      ],\n      url: '/api/v1/policies/resources/{resource_name}/approval',\n      ...options\n    })\n  }\n\n  /**\n   * Get Policy\n   */\n  public static getPolicyApiV1PoliciesPolicyIdGet<\n    ThrowOnError extends boolean = false\n  >(options: Options<GetPolicyApiV1PoliciesPolicyIdGetData, ThrowOnError>) {\n    return (options.client ?? _heyApiClient).get<\n      GetPolicyApiV1PoliciesPolicyIdGetResponses,\n      GetPolicyApiV1PoliciesPolicyIdGetErrors,\n      ThrowOnError\n    >({\n      requestValidator: async (data) => {\n        return await zGetPolicyApiV1PoliciesPolicyIdGetData.parseAsync(data)\n      },\n      responseValidator: async (data) => {\n        return await zGetPolicyApiV1PoliciesPolicyIdGetResponse.parseAsync(data)\n      },\n      security: [\n        {\n          name: 'X-ONEGREP-API-KEY',\n          type: 'apiKey'\n        }\n      ],\n      url: '/api/v1/policies/{policy_id}',\n      ...options\n    })\n  }\n\n  /**\n   * Update Policy\n   */\n  public static updatePolicyApiV1PoliciesPolicyIdPut<\n    ThrowOnError extends boolean = false\n  >(options: Options<UpdatePolicyApiV1PoliciesPolicyIdPutData, ThrowOnError>) {\n    return (options.client ?? _heyApiClient).put<\n      UpdatePolicyApiV1PoliciesPolicyIdPutResponses,\n      UpdatePolicyApiV1PoliciesPolicyIdPutErrors,\n      ThrowOnError\n    >({\n      requestValidator: async (data) => {\n        return await zUpdatePolicyApiV1PoliciesPolicyIdPutData.parseAsync(data)\n      },\n      responseValidator: async (data) => {\n        return await zUpdatePolicyApiV1PoliciesPolicyIdPutResponse.parseAsync(\n          data\n        )\n      },\n      security: [\n        {\n          name: 'X-ONEGREP-API-KEY',\n          type: 'apiKey'\n        }\n      ],\n      url: '/api/v1/policies/{policy_id}',\n      ...options,\n      headers: {\n        'Content-Type': 'application/json',\n        ...options.headers\n      }\n    })\n  }\n\n  /**\n   * Check Policy Status\n   */\n  public static checkPolicyStatusApiV1PoliciesPolicyIdAuditIdStatusPost<\n    ThrowOnError extends boolean = false\n  >(\n    options: Options<\n      CheckPolicyStatusApiV1PoliciesPolicyIdAuditIdStatusPostData,\n      ThrowOnError\n    >\n  ) {\n    return (options.client ?? _heyApiClient).post<\n      CheckPolicyStatusApiV1PoliciesPolicyIdAuditIdStatusPostResponses,\n      CheckPolicyStatusApiV1PoliciesPolicyIdAuditIdStatusPostErrors,\n      ThrowOnError\n    >({\n      requestValidator: async (data) => {\n        return await zCheckPolicyStatusApiV1PoliciesPolicyIdAuditIdStatusPostData.parseAsync(\n          data\n        )\n      },\n      security: [\n        {\n          name: 'X-ONEGREP-API-KEY',\n          type: 'apiKey'\n        }\n      ],\n      url: '/api/v1/policies/{policy_id}/{audit_id}/status',\n      ...options\n    })\n  }\n}\n\nexport class Providers {\n  /**\n   * List Providers\n   */\n  public static listProvidersApiV1ProvidersGet<\n    ThrowOnError extends boolean = false\n  >(options?: Options<ListProvidersApiV1ProvidersGetData, ThrowOnError>) {\n    return (options?.client ?? _heyApiClient).get<\n      ListProvidersApiV1ProvidersGetResponses,\n      unknown,\n      ThrowOnError\n    >({\n      requestValidator: async (data) => {\n        return await zListProvidersApiV1ProvidersGetData.parseAsync(data)\n      },\n      responseValidator: async (data) => {\n        return await zListProvidersApiV1ProvidersGetResponse.parseAsync(data)\n      },\n      security: [\n        {\n          name: 'X-ONEGREP-API-KEY',\n          type: 'apiKey'\n        }\n      ],\n      url: '/api/v1/providers/',\n      ...options\n    })\n  }\n\n  /**\n   * Get Provider\n   */\n  public static getProviderApiV1ProvidersProviderIdGet<\n    ThrowOnError extends boolean = false\n  >(\n    options: Options<GetProviderApiV1ProvidersProviderIdGetData, ThrowOnError>\n  ) {\n    return (options.client ?? _heyApiClient).get<\n      GetProviderApiV1ProvidersProviderIdGetResponses,\n      GetProviderApiV1ProvidersProviderIdGetErrors,\n      ThrowOnError\n    >({\n      requestValidator: async (data) => {\n        return await zGetProviderApiV1ProvidersProviderIdGetData.parseAsync(\n          data\n        )\n      },\n      responseValidator: async (data) => {\n        return await zGetProviderApiV1ProvidersProviderIdGetResponse.parseAsync(\n          data\n        )\n      },\n      security: [\n        {\n          name: 'X-ONEGREP-API-KEY',\n          type: 'apiKey'\n        }\n      ],\n      url: '/api/v1/providers/{provider_id}',\n      ...options\n    })\n  }\n\n  /**\n   * Get Servers\n   */\n  public static getServersApiV1ProvidersProviderIdServersGet<\n    ThrowOnError extends boolean = false\n  >(\n    options: Options<\n      GetServersApiV1ProvidersProviderIdServersGetData,\n      ThrowOnError\n    >\n  ) {\n    return (options.client ?? _heyApiClient).get<\n      GetServersApiV1ProvidersProviderIdServersGetResponses,\n      GetServersApiV1ProvidersProviderIdServersGetErrors,\n      ThrowOnError\n    >({\n      requestValidator: async (data) => {\n        return await zGetServersApiV1ProvidersProviderIdServersGetData.parseAsync(\n          data\n        )\n      },\n      responseValidator: async (data) => {\n        return await zGetServersApiV1ProvidersProviderIdServersGetResponse.parseAsync(\n          data\n        )\n      },\n      security: [\n        {\n          name: 'X-ONEGREP-API-KEY',\n          type: 'apiKey'\n        }\n      ],\n      url: '/api/v1/providers/{provider_id}/servers',\n      ...options\n    })\n  }\n\n  /**\n   * Sync Provider\n   */\n  public static syncProviderApiV1ProvidersProviderIdSyncPost<\n    ThrowOnError extends boolean = false\n  >(\n    options: Options<\n      SyncProviderApiV1ProvidersProviderIdSyncPostData,\n      ThrowOnError\n    >\n  ) {\n    return (options.client ?? _heyApiClient).post<\n      SyncProviderApiV1ProvidersProviderIdSyncPostResponses,\n      SyncProviderApiV1ProvidersProviderIdSyncPostErrors,\n      ThrowOnError\n    >({\n      requestValidator: async (data) => {\n        return await zSyncProviderApiV1ProvidersProviderIdSyncPostData.parseAsync(\n          data\n        )\n      },\n      security: [\n        {\n          name: 'X-ONEGREP-API-KEY',\n          type: 'apiKey'\n        }\n      ],\n      url: '/api/v1/providers/{provider_id}/sync',\n      ...options\n    })\n  }\n}\n\nexport class Sdk {\n  /**\n   * Initialize\n   */\n  public static initializeApiV1SdkInitializeGet<\n    ThrowOnError extends boolean = false\n  >(options?: Options<InitializeApiV1SdkInitializeGetData, ThrowOnError>) {\n    return (options?.client ?? _heyApiClient).get<\n      InitializeApiV1SdkInitializeGetResponses,\n      unknown,\n      ThrowOnError\n    >({\n      requestValidator: async (data) => {\n        return await zInitializeApiV1SdkInitializeGetData.parseAsync(data)\n      },\n      responseValidator: async (data) => {\n        return await zInitializeApiV1SdkInitializeGetResponse.parseAsync(data)\n      },\n      security: [\n        {\n          name: 'X-ONEGREP-API-KEY',\n          type: 'apiKey'\n        }\n      ],\n      url: '/api/v1/sdk/initialize',\n      ...options\n    })\n  }\n\n  /**\n   * Get Service Token\n   * Returns the service token information for the authenticated user.\n   */\n  public static getServiceTokenApiV1SdkServiceTokenGet<\n    ThrowOnError extends boolean = false\n  >(\n    options?: Options<GetServiceTokenApiV1SdkServiceTokenGetData, ThrowOnError>\n  ) {\n    return (options?.client ?? _heyApiClient).get<\n      GetServiceTokenApiV1SdkServiceTokenGetResponses,\n      unknown,\n      ThrowOnError\n    >({\n      requestValidator: async (data) => {\n        return await zGetServiceTokenApiV1SdkServiceTokenGetData.parseAsync(\n          data\n        )\n      },\n      responseValidator: async (data) => {\n        return await zGetServiceTokenApiV1SdkServiceTokenGetResponse.parseAsync(\n          data\n        )\n      },\n      security: [\n        {\n          name: 'X-ONEGREP-API-KEY',\n          type: 'apiKey'\n        }\n      ],\n      url: '/api/v1/sdk/service-token',\n      ...options\n    })\n  }\n}\n\nexport class Search {\n  /**\n   * Reindex\n   * Reindexes all tools and toolprints for an organization.\n   */\n  public static reindexApiV1SearchReindexPost<\n    ThrowOnError extends boolean = false\n  >(options?: Options<ReindexApiV1SearchReindexPostData, ThrowOnError>) {\n    return (options?.client ?? _heyApiClient).post<\n      ReindexApiV1SearchReindexPostResponses,\n      unknown,\n      ThrowOnError\n    >({\n      requestValidator: async (data) => {\n        return await zReindexApiV1SearchReindexPostData.parseAsync(data)\n      },\n      security: [\n        {\n          name: 'X-ONEGREP-API-KEY',\n          type: 'apiKey'\n        }\n      ],\n      url: '/api/v1/search/reindex',\n      ...options\n    })\n  }\n\n  /**\n   * Reindex Toolprints\n   * Reindexes all toolprints for an organization.\n   */\n  public static reindexToolprintsApiV1SearchReindexToolprintsPost<\n    ThrowOnError extends boolean = false\n  >(\n    options?: Options<\n      ReindexToolprintsApiV1SearchReindexToolprintsPostData,\n      ThrowOnError\n    >\n  ) {\n    return (options?.client ?? _heyApiClient).post<\n      ReindexToolprintsApiV1SearchReindexToolprintsPostResponses,\n      unknown,\n      ThrowOnError\n    >({\n      requestValidator: async (data) => {\n        return await zReindexToolprintsApiV1SearchReindexToolprintsPostData.parseAsync(\n          data\n        )\n      },\n      security: [\n        {\n          name: 'X-ONEGREP-API-KEY',\n          type: 'apiKey'\n        }\n      ],\n      url: '/api/v1/search/reindex/toolprints',\n      ...options\n    })\n  }\n\n  /**\n   * Reindex Tools\n   */\n  public static reindexToolsApiV1SearchReindexToolsPost<\n    ThrowOnError extends boolean = false\n  >(\n    options?: Options<ReindexToolsApiV1SearchReindexToolsPostData, ThrowOnError>\n  ) {\n    return (options?.client ?? _heyApiClient).post<\n      ReindexToolsApiV1SearchReindexToolsPostResponses,\n      unknown,\n      ThrowOnError\n    >({\n      requestValidator: async (data) => {\n        return await zReindexToolsApiV1SearchReindexToolsPostData.parseAsync(\n          data\n        )\n      },\n      security: [\n        {\n          name: 'X-ONEGREP-API-KEY',\n          type: 'apiKey'\n        }\n      ],\n      url: '/api/v1/search/reindex/tools',\n      ...options\n    })\n  }\n\n  /**\n   * Search Toolprints\n   * Searches for the best set of toolprints that semantically match the query and returns them\n   * along with a similarity score for each toolprint.\n   */\n  public static searchToolprintsApiV1SearchToolprintsPost<\n    ThrowOnError extends boolean = false\n  >(\n    options: Options<\n      SearchToolprintsApiV1SearchToolprintsPostData,\n      ThrowOnError\n    >\n  ) {\n    return (options.client ?? _heyApiClient).post<\n      SearchToolprintsApiV1SearchToolprintsPostResponses,\n      SearchToolprintsApiV1SearchToolprintsPostErrors,\n      ThrowOnError\n    >({\n      requestValidator: async (data) => {\n        return await zSearchToolprintsApiV1SearchToolprintsPostData.parseAsync(\n          data\n        )\n      },\n      responseValidator: async (data) => {\n        return await zSearchToolprintsApiV1SearchToolprintsPostResponse.parseAsync(\n          data\n        )\n      },\n      security: [\n        {\n          name: 'X-ONEGREP-API-KEY',\n          type: 'apiKey'\n        }\n      ],\n      url: '/api/v1/search/toolprints',\n      ...options,\n      headers: {\n        'Content-Type': 'application/json',\n        ...options.headers\n      }\n    })\n  }\n\n  /**\n   * Get Toolprint Recommendation\n   * Returns a single recommendation for a toolprint based on the goal that is trying to be achieved. It also\n   * includes the set of prompts that should be injected into the message stack to prime the agent's LLM.\n   *\n   * Args:\n   * request_context: The authenticated request context\n   * toolprint_index: The toolprint index manager to search with\n   * search_request: The search request containing the goal query\n   *\n   * Returns:\n   * A ToolprintRecommendation containing the best matching toolprint and associated prompts\n   */\n  public static getToolprintRecommendationApiV1SearchToolprintsRecommendationPost<\n    ThrowOnError extends boolean = false\n  >(\n    options: Options<\n      GetToolprintRecommendationApiV1SearchToolprintsRecommendationPostData,\n      ThrowOnError\n    >\n  ) {\n    return (options.client ?? _heyApiClient).post<\n      GetToolprintRecommendationApiV1SearchToolprintsRecommendationPostResponses,\n      GetToolprintRecommendationApiV1SearchToolprintsRecommendationPostErrors,\n      ThrowOnError\n    >({\n      requestValidator: async (data) => {\n        return await zGetToolprintRecommendationApiV1SearchToolprintsRecommendationPostData.parseAsync(\n          data\n        )\n      },\n      responseValidator: async (data) => {\n        return await zGetToolprintRecommendationApiV1SearchToolprintsRecommendationPostResponse.parseAsync(\n          data\n        )\n      },\n      security: [\n        {\n          name: 'X-ONEGREP-API-KEY',\n          type: 'apiKey'\n        }\n      ],\n      url: '/api/v1/search/toolprints/recommendation',\n      ...options,\n      headers: {\n        'Content-Type': 'application/json',\n        ...options.headers\n      }\n    })\n  }\n\n  /**\n   * Search Tools\n   * Searches for the best set of tools that semantically match the query and returns them\n   * along with a similarity score for each tool.\n   */\n  public static searchToolsApiV1SearchToolsPost<\n    ThrowOnError extends boolean = false\n  >(options: Options<SearchToolsApiV1SearchToolsPostData, ThrowOnError>) {\n    return (options.client ?? _heyApiClient).post<\n      SearchToolsApiV1SearchToolsPostResponses,\n      SearchToolsApiV1SearchToolsPostErrors,\n      ThrowOnError\n    >({\n      requestValidator: async (data) => {\n        return await zSearchToolsApiV1SearchToolsPostData.parseAsync(data)\n      },\n      responseValidator: async (data) => {\n        return await zSearchToolsApiV1SearchToolsPostResponse.parseAsync(data)\n      },\n      security: [\n        {\n          name: 'X-ONEGREP-API-KEY',\n          type: 'apiKey'\n        }\n      ],\n      url: '/api/v1/search/tools',\n      ...options,\n      headers: {\n        'Content-Type': 'application/json',\n        ...options.headers\n      }\n    })\n  }\n}\n\nexport class Secrets {\n  /**\n   * Get Secrets\n   */\n  public static getSecretsApiV1SecretsGet<ThrowOnError extends boolean = false>(\n    options?: Options<GetSecretsApiV1SecretsGetData, ThrowOnError>\n  ) {\n    return (options?.client ?? _heyApiClient).get<\n      GetSecretsApiV1SecretsGetResponses,\n      unknown,\n      ThrowOnError\n    >({\n      requestValidator: async (data) => {\n        return await zGetSecretsApiV1SecretsGetData.parseAsync(data)\n      },\n      security: [\n        {\n          name: 'X-ONEGREP-API-KEY',\n          type: 'apiKey'\n        }\n      ],\n      url: '/api/v1/secrets/',\n      ...options\n    })\n  }\n\n  /**\n   * Get Secret\n   */\n  public static getSecretApiV1SecretsSecretNameGet<\n    ThrowOnError extends boolean = false\n  >(options: Options<GetSecretApiV1SecretsSecretNameGetData, ThrowOnError>) {\n    return (options.client ?? _heyApiClient).get<\n      GetSecretApiV1SecretsSecretNameGetResponses,\n      GetSecretApiV1SecretsSecretNameGetErrors,\n      ThrowOnError\n    >({\n      requestValidator: async (data) => {\n        return await zGetSecretApiV1SecretsSecretNameGetData.parseAsync(data)\n      },\n      responseValidator: async (data) => {\n        return await zGetSecretApiV1SecretsSecretNameGetResponse.parseAsync(\n          data\n        )\n      },\n      security: [\n        {\n          name: 'X-ONEGREP-API-KEY',\n          type: 'apiKey'\n        }\n      ],\n      url: '/api/v1/secrets/{secret_name}',\n      ...options\n    })\n  }\n\n  /**\n   * Upsert Secret\n   */\n  public static upsertSecretApiV1SecretsSecretNamePut<\n    ThrowOnError extends boolean = false\n  >(options: Options<UpsertSecretApiV1SecretsSecretNamePutData, ThrowOnError>) {\n    return (options.client ?? _heyApiClient).put<\n      UpsertSecretApiV1SecretsSecretNamePutResponses,\n      UpsertSecretApiV1SecretsSecretNamePutErrors,\n      ThrowOnError\n    >({\n      requestValidator: async (data) => {\n        return await zUpsertSecretApiV1SecretsSecretNamePutData.parseAsync(data)\n      },\n      responseValidator: async (data) => {\n        return await zUpsertSecretApiV1SecretsSecretNamePutResponse.parseAsync(\n          data\n        )\n      },\n      security: [\n        {\n          name: 'X-ONEGREP-API-KEY',\n          type: 'apiKey'\n        },\n        {\n          scheme: 'bearer',\n          type: 'http'\n        }\n      ],\n      url: '/api/v1/secrets/{secret_name}',\n      ...options,\n      headers: {\n        'Content-Type': 'application/json',\n        ...options.headers\n      }\n    })\n  }\n}\n\nexport class Servers {\n  /**\n   * List Servers\n   */\n  public static listServersApiV1ServersGet<\n    ThrowOnError extends boolean = false\n  >(options?: Options<ListServersApiV1ServersGetData, ThrowOnError>) {\n    return (options?.client ?? _heyApiClient).get<\n      ListServersApiV1ServersGetResponses,\n      unknown,\n      ThrowOnError\n    >({\n      requestValidator: async (data) => {\n        return await zListServersApiV1ServersGetData.parseAsync(data)\n      },\n      responseValidator: async (data) => {\n        return await zListServersApiV1ServersGetResponse.parseAsync(data)\n      },\n      security: [\n        {\n          name: 'X-ONEGREP-API-KEY',\n          type: 'apiKey'\n        }\n      ],\n      url: '/api/v1/servers/',\n      ...options\n    })\n  }\n\n  /**\n   * Get Server\n   */\n  public static getServerApiV1ServersServerIdGet<\n    ThrowOnError extends boolean = false\n  >(options: Options<GetServerApiV1ServersServerIdGetData, ThrowOnError>) {\n    return (options.client ?? _heyApiClient).get<\n      GetServerApiV1ServersServerIdGetResponses,\n      GetServerApiV1ServersServerIdGetErrors,\n      ThrowOnError\n    >({\n      requestValidator: async (data) => {\n        return await zGetServerApiV1ServersServerIdGetData.parseAsync(data)\n      },\n      responseValidator: async (data) => {\n        return await zGetServerApiV1ServersServerIdGetResponse.parseAsync(data)\n      },\n      security: [\n        {\n          name: 'X-ONEGREP-API-KEY',\n          type: 'apiKey'\n        }\n      ],\n      url: '/api/v1/servers/{server_id}',\n      ...options\n    })\n  }\n\n  /**\n   * Get Server Client\n   */\n  public static getServerClientApiV1ServersServerIdClientGet<\n    ThrowOnError extends boolean = false\n  >(\n    options: Options<\n      GetServerClientApiV1ServersServerIdClientGetData,\n      ThrowOnError\n    >\n  ) {\n    return (options.client ?? _heyApiClient).get<\n      GetServerClientApiV1ServersServerIdClientGetResponses,\n      GetServerClientApiV1ServersServerIdClientGetErrors,\n      ThrowOnError\n    >({\n      requestValidator: async (data) => {\n        return await zGetServerClientApiV1ServersServerIdClientGetData.parseAsync(\n          data\n        )\n      },\n      responseValidator: async (data) => {\n        return await zGetServerClientApiV1ServersServerIdClientGetResponse.parseAsync(\n          data\n        )\n      },\n      security: [\n        {\n          name: 'X-ONEGREP-API-KEY',\n          type: 'apiKey'\n        }\n      ],\n      url: '/api/v1/servers/{server_id}/client',\n      ...options\n    })\n  }\n\n  /**\n   * Get Server Properties\n   */\n  public static getServerPropertiesApiV1ServersServerIdPropertiesGet<\n    ThrowOnError extends boolean = false\n  >(\n    options: Options<\n      GetServerPropertiesApiV1ServersServerIdPropertiesGetData,\n      ThrowOnError\n    >\n  ) {\n    return (options.client ?? _heyApiClient).get<\n      GetServerPropertiesApiV1ServersServerIdPropertiesGetResponses,\n      GetServerPropertiesApiV1ServersServerIdPropertiesGetErrors,\n      ThrowOnError\n    >({\n      requestValidator: async (data) => {\n        return await zGetServerPropertiesApiV1ServersServerIdPropertiesGetData.parseAsync(\n          data\n        )\n      },\n      responseValidator: async (data) => {\n        return await zGetServerPropertiesApiV1ServersServerIdPropertiesGetResponse.parseAsync(\n          data\n        )\n      },\n      security: [\n        {\n          name: 'X-ONEGREP-API-KEY',\n          type: 'apiKey'\n        }\n      ],\n      url: '/api/v1/servers/{server_id}/properties',\n      ...options\n    })\n  }\n\n  /**\n   * Patch Server Properties\n   */\n  public static patchServerPropertiesApiV1ServersServerIdPropertiesKeyPatch<\n    ThrowOnError extends boolean = false\n  >(\n    options: Options<\n      PatchServerPropertiesApiV1ServersServerIdPropertiesKeyPatchData,\n      ThrowOnError\n    >\n  ) {\n    return (options.client ?? _heyApiClient).patch<\n      PatchServerPropertiesApiV1ServersServerIdPropertiesKeyPatchResponses,\n      PatchServerPropertiesApiV1ServersServerIdPropertiesKeyPatchErrors,\n      ThrowOnError\n    >({\n      requestValidator: async (data) => {\n        return await zPatchServerPropertiesApiV1ServersServerIdPropertiesKeyPatchData.parseAsync(\n          data\n        )\n      },\n      responseValidator: async (data) => {\n        return await zPatchServerPropertiesApiV1ServersServerIdPropertiesKeyPatchResponse.parseAsync(\n          data\n        )\n      },\n      security: [\n        {\n          name: 'X-ONEGREP-API-KEY',\n          type: 'apiKey'\n        }\n      ],\n      url: '/api/v1/servers/{server_id}/properties/{key}',\n      ...options,\n      headers: {\n        'Content-Type': 'application/json',\n        ...options.headers\n      }\n    })\n  }\n}\n\nexport class Strategy {\n  /**\n   * Get Strategy\n   * Gets a strategy for a given goal.\n   */\n  public static getStrategyApiV1StrategyPost<\n    ThrowOnError extends boolean = false\n  >(options: Options<GetStrategyApiV1StrategyPostData, ThrowOnError>) {\n    return (options.client ?? _heyApiClient).post<\n      GetStrategyApiV1StrategyPostResponses,\n      GetStrategyApiV1StrategyPostErrors,\n      ThrowOnError\n    >({\n      requestValidator: async (data) => {\n        return await zGetStrategyApiV1StrategyPostData.parseAsync(data)\n      },\n      responseValidator: async (data) => {\n        return await zGetStrategyApiV1StrategyPostResponse.parseAsync(data)\n      },\n      security: [\n        {\n          name: 'X-ONEGREP-API-KEY',\n          type: 'apiKey'\n        }\n      ],\n      url: '/api/v1/strategy/',\n      ...options,\n      headers: {\n        'Content-Type': 'application/json',\n        ...options.headers\n      }\n    })\n  }\n\n  /**\n   * Create Fake Recipes\n   * Creates fake strategies for testing purposes.\n   */\n  public static createFakeRecipesApiV1StrategyFakePost<\n    ThrowOnError extends boolean = false\n  >(\n    options?: Options<CreateFakeRecipesApiV1StrategyFakePostData, ThrowOnError>\n  ) {\n    return (options?.client ?? _heyApiClient).post<\n      CreateFakeRecipesApiV1StrategyFakePostResponses,\n      unknown,\n      ThrowOnError\n    >({\n      requestValidator: async (data) => {\n        return await zCreateFakeRecipesApiV1StrategyFakePostData.parseAsync(\n          data\n        )\n      },\n      responseValidator: async (data) => {\n        return await zCreateFakeRecipesApiV1StrategyFakePostResponse.parseAsync(\n          data\n        )\n      },\n      security: [\n        {\n          name: 'X-ONEGREP-API-KEY',\n          type: 'apiKey'\n        }\n      ],\n      url: '/api/v1/strategy/fake',\n      ...options\n    })\n  }\n}\n\nexport class Toolprints {\n  /**\n   * Create Toolprint\n   * Creates a new toolprint and indexes it for search.\n   *\n   * The process:\n   * 1. Validates the toolprint definition\n   * 2. Creates and persists the toolprint\n   * 3. Indexes the toolprint for semantic search\n   */\n  public static createToolprintApiV1ToolprintsPost<\n    ThrowOnError extends boolean = false\n  >(options: Options<CreateToolprintApiV1ToolprintsPostData, ThrowOnError>) {\n    return (options.client ?? _heyApiClient).post<\n      CreateToolprintApiV1ToolprintsPostResponses,\n      CreateToolprintApiV1ToolprintsPostErrors,\n      ThrowOnError\n    >({\n      requestValidator: async (data) => {\n        return await zCreateToolprintApiV1ToolprintsPostData.parseAsync(data)\n      },\n      responseValidator: async (data) => {\n        return await zCreateToolprintApiV1ToolprintsPostResponse.parseAsync(\n          data\n        )\n      },\n      security: [\n        {\n          name: 'X-ONEGREP-API-KEY',\n          type: 'apiKey'\n        }\n      ],\n      url: '/api/v1/toolprints/',\n      ...options,\n      headers: {\n        'Content-Type': 'application/json',\n        ...options.headers\n      }\n    })\n  }\n\n  /**\n   * Get Toolprint Instructions\n   * Returns the complete toolprint documentation including example in markdown format.\n   */\n  public static getToolprintInstructionsApiV1ToolprintsWellKnownAiTxtGet<\n    ThrowOnError extends boolean = false\n  >(\n    options?: Options<\n      GetToolprintInstructionsApiV1ToolprintsWellKnownAiTxtGetData,\n      ThrowOnError\n    >\n  ) {\n    return (options?.client ?? _heyApiClient).get<\n      GetToolprintInstructionsApiV1ToolprintsWellKnownAiTxtGetResponses,\n      unknown,\n      ThrowOnError\n    >({\n      requestValidator: async (data) => {\n        return await zGetToolprintInstructionsApiV1ToolprintsWellKnownAiTxtGetData.parseAsync(\n          data\n        )\n      },\n      responseValidator: async (data) => {\n        return await zGetToolprintInstructionsApiV1ToolprintsWellKnownAiTxtGetResponse.parseAsync(\n          data\n        )\n      },\n      security: [\n        {\n          name: 'X-ONEGREP-API-KEY',\n          type: 'apiKey'\n        }\n      ],\n      url: '/api/v1/toolprints/.well-known/ai.txt',\n      ...options\n    })\n  }\n\n  /**\n   * Get Toolprint Schema\n   * Returns the schema for toolprint definitions.\n   */\n  public static getToolprintSchemaApiV1ToolprintsWellKnownSchemaGet<\n    ThrowOnError extends boolean = false\n  >(\n    options?: Options<\n      GetToolprintSchemaApiV1ToolprintsWellKnownSchemaGetData,\n      ThrowOnError\n    >\n  ) {\n    return (options?.client ?? _heyApiClient).get<\n      GetToolprintSchemaApiV1ToolprintsWellKnownSchemaGetResponses,\n      unknown,\n      ThrowOnError\n    >({\n      requestValidator: async (data) => {\n        return await zGetToolprintSchemaApiV1ToolprintsWellKnownSchemaGetData.parseAsync(\n          data\n        )\n      },\n      responseValidator: async (data) => {\n        return await zGetToolprintSchemaApiV1ToolprintsWellKnownSchemaGetResponse.parseAsync(\n          data\n        )\n      },\n      security: [\n        {\n          name: 'X-ONEGREP-API-KEY',\n          type: 'apiKey'\n        }\n      ],\n      url: '/api/v1/toolprints/.well-known/schema',\n      ...options\n    })\n  }\n\n  /**\n   * Get Toolprint Template\n   * Returns a template for toolprint definitions in YAML format.\n   */\n  public static getToolprintTemplateApiV1ToolprintsWellKnownTemplateGet<\n    ThrowOnError extends boolean = false\n  >(\n    options?: Options<\n      GetToolprintTemplateApiV1ToolprintsWellKnownTemplateGetData,\n      ThrowOnError\n    >\n  ) {\n    return (options?.client ?? _heyApiClient).get<\n      GetToolprintTemplateApiV1ToolprintsWellKnownTemplateGetResponses,\n      unknown,\n      ThrowOnError\n    >({\n      requestValidator: async (data) => {\n        return await zGetToolprintTemplateApiV1ToolprintsWellKnownTemplateGetData.parseAsync(\n          data\n        )\n      },\n      responseValidator: async (data) => {\n        return await zGetToolprintTemplateApiV1ToolprintsWellKnownTemplateGetResponse.parseAsync(\n          data\n        )\n      },\n      security: [\n        {\n          name: 'X-ONEGREP-API-KEY',\n          type: 'apiKey'\n        }\n      ],\n      url: '/api/v1/toolprints/.well-known/template',\n      ...options\n    })\n  }\n\n  /**\n   * Create Toolprint Json\n   * Creates a new toolprint from JSON content and indexes it for search.\n   *\n   * The process:\n   * 1. Validates the JSON content\n   * 2. Creates and persists the toolprint\n   * 3. Indexes the toolprint for semantic search\n   */\n  public static createToolprintJsonApiV1ToolprintsJsonPost<\n    ThrowOnError extends boolean = false\n  >(\n    options: Options<\n      CreateToolprintJsonApiV1ToolprintsJsonPostData,\n      ThrowOnError\n    >\n  ) {\n    return (options.client ?? _heyApiClient).post<\n      CreateToolprintJsonApiV1ToolprintsJsonPostResponses,\n      CreateToolprintJsonApiV1ToolprintsJsonPostErrors,\n      ThrowOnError\n    >({\n      requestValidator: async (data) => {\n        return await zCreateToolprintJsonApiV1ToolprintsJsonPostData.parseAsync(\n          data\n        )\n      },\n      responseValidator: async (data) => {\n        return await zCreateToolprintJsonApiV1ToolprintsJsonPostResponse.parseAsync(\n          data\n        )\n      },\n      security: [\n        {\n          name: 'X-ONEGREP-API-KEY',\n          type: 'apiKey'\n        }\n      ],\n      url: '/api/v1/toolprints/json',\n      ...options,\n      headers: {\n        'Content-Type': 'application/json',\n        ...options.headers\n      }\n    })\n  }\n\n  /**\n   * Validate Toolprint\n   * Validates a toolprint definition without persisting it.\n   *\n   * This endpoint checks:\n   * 1. The basic structure and required fields of the toolprint\n   * 2. That all referenced tools exist and are accessible to the user\n   * 3. That the toolprint definition meets any additional business rules\n   */\n  public static validateToolprintApiV1ToolprintsValidatePost<\n    ThrowOnError extends boolean = false\n  >(\n    options: Options<\n      ValidateToolprintApiV1ToolprintsValidatePostData,\n      ThrowOnError\n    >\n  ) {\n    return (options.client ?? _heyApiClient).post<\n      ValidateToolprintApiV1ToolprintsValidatePostResponses,\n      ValidateToolprintApiV1ToolprintsValidatePostErrors,\n      ThrowOnError\n    >({\n      requestValidator: async (data) => {\n        return await zValidateToolprintApiV1ToolprintsValidatePostData.parseAsync(\n          data\n        )\n      },\n      responseValidator: async (data) => {\n        return await zValidateToolprintApiV1ToolprintsValidatePostResponse.parseAsync(\n          data\n        )\n      },\n      security: [\n        {\n          name: 'X-ONEGREP-API-KEY',\n          type: 'apiKey'\n        }\n      ],\n      url: '/api/v1/toolprints/validate',\n      ...options,\n      headers: {\n        'Content-Type': 'application/json',\n        ...options.headers\n      }\n    })\n  }\n\n  /**\n   * Validate Toolprint Json\n   * Validates a toolprint definition in JSON format without persisting it.\n   *\n   * This endpoint accepts JSON content and:\n   * 1. Validates the JSON can be converted to a Toolprint model\n   * 2. Validates the basic structure and required fields\n   * 3. Checks that all referenced tools exist and are accessible\n   * 4. Verifies the toolprint definition meets business rules\n   */\n  public static validateToolprintJsonApiV1ToolprintsValidateJsonPost<\n    ThrowOnError extends boolean = false\n  >(\n    options: Options<\n      ValidateToolprintJsonApiV1ToolprintsValidateJsonPostData,\n      ThrowOnError\n    >\n  ) {\n    return (options.client ?? _heyApiClient).post<\n      ValidateToolprintJsonApiV1ToolprintsValidateJsonPostResponses,\n      ValidateToolprintJsonApiV1ToolprintsValidateJsonPostErrors,\n      ThrowOnError\n    >({\n      requestValidator: async (data) => {\n        return await zValidateToolprintJsonApiV1ToolprintsValidateJsonPostData.parseAsync(\n          data\n        )\n      },\n      security: [\n        {\n          name: 'X-ONEGREP-API-KEY',\n          type: 'apiKey'\n        }\n      ],\n      url: '/api/v1/toolprints/validate/json',\n      ...options,\n      headers: {\n        'Content-Type': 'application/json',\n        ...options.headers\n      }\n    })\n  }\n\n  /**\n   * Validate Toolprint Yaml\n   * Validates a toolprint definition in YAML format without persisting it.\n   *\n   * This endpoint accepts YAML content and:\n   * 1. Parses the YAML into a Toolprint model\n   * 2. Validates the basic structure and required fields\n   * 3. Checks that all referenced tools exist and are accessible\n   * 4. Verifies the toolprint definition meets business rules\n   */\n  public static validateToolprintYamlApiV1ToolprintsValidateYamlPost<\n    ThrowOnError extends boolean = false\n  >(\n    options: Options<\n      ValidateToolprintYamlApiV1ToolprintsValidateYamlPostData,\n      ThrowOnError\n    >\n  ) {\n    return (options.client ?? _heyApiClient).post<\n      ValidateToolprintYamlApiV1ToolprintsValidateYamlPostResponses,\n      ValidateToolprintYamlApiV1ToolprintsValidateYamlPostErrors,\n      ThrowOnError\n    >({\n      bodySerializer: null,\n      requestValidator: async (data) => {\n        return await zValidateToolprintYamlApiV1ToolprintsValidateYamlPostData.parseAsync(\n          data\n        )\n      },\n      responseValidator: async (data) => {\n        return await zValidateToolprintYamlApiV1ToolprintsValidateYamlPostResponse.parseAsync(\n          data\n        )\n      },\n      security: [\n        {\n          name: 'X-ONEGREP-API-KEY',\n          type: 'apiKey'\n        }\n      ],\n      url: '/api/v1/toolprints/validate/yaml',\n      ...options,\n      headers: {\n        'Content-Type': 'text/plain',\n        ...options.headers\n      }\n    })\n  }\n\n  /**\n   * Create Toolprint Yaml\n   * Creates a new toolprint from YAML content and indexes it for search.\n   *\n   * The process:\n   * 1. Parses and validates the YAML content\n   * 2. Creates and persists the toolprint\n   * 3. Indexes the toolprint for semantic search\n   */\n  public static createToolprintYamlApiV1ToolprintsYamlPost<\n    ThrowOnError extends boolean = false\n  >(\n    options: Options<\n      CreateToolprintYamlApiV1ToolprintsYamlPostData,\n      ThrowOnError\n    >\n  ) {\n    return (options.client ?? _heyApiClient).post<\n      CreateToolprintYamlApiV1ToolprintsYamlPostResponses,\n      CreateToolprintYamlApiV1ToolprintsYamlPostErrors,\n      ThrowOnError\n    >({\n      bodySerializer: null,\n      requestValidator: async (data) => {\n        return await zCreateToolprintYamlApiV1ToolprintsYamlPostData.parseAsync(\n          data\n        )\n      },\n      responseValidator: async (data) => {\n        return await zCreateToolprintYamlApiV1ToolprintsYamlPostResponse.parseAsync(\n          data\n        )\n      },\n      security: [\n        {\n          name: 'X-ONEGREP-API-KEY',\n          type: 'apiKey'\n        }\n      ],\n      url: '/api/v1/toolprints/yaml',\n      ...options,\n      headers: {\n        'Content-Type': 'text/plain',\n        ...options.headers\n      }\n    })\n  }\n\n  /**\n   * Get Toolprint\n   * Gets a specific toolprint by its ID.\n   */\n  public static getToolprintApiV1ToolprintsToolprintIdGet<\n    ThrowOnError extends boolean = false\n  >(\n    options: Options<\n      GetToolprintApiV1ToolprintsToolprintIdGetData,\n      ThrowOnError\n    >\n  ) {\n    return (options.client ?? _heyApiClient).get<\n      GetToolprintApiV1ToolprintsToolprintIdGetResponses,\n      GetToolprintApiV1ToolprintsToolprintIdGetErrors,\n      ThrowOnError\n    >({\n      requestValidator: async (data) => {\n        return await zGetToolprintApiV1ToolprintsToolprintIdGetData.parseAsync(\n          data\n        )\n      },\n      responseValidator: async (data) => {\n        return await zGetToolprintApiV1ToolprintsToolprintIdGetResponse.parseAsync(\n          data\n        )\n      },\n      security: [\n        {\n          name: 'X-ONEGREP-API-KEY',\n          type: 'apiKey'\n        }\n      ],\n      url: '/api/v1/toolprints/{toolprint_id}',\n      ...options\n    })\n  }\n}\n\nexport class Tools {\n  /**\n   * List Tools\n   * List all tools for the current user.\n   */\n  public static listToolsApiV1ToolsGet<ThrowOnError extends boolean = false>(\n    options?: Options<ListToolsApiV1ToolsGetData, ThrowOnError>\n  ) {\n    return (options?.client ?? _heyApiClient).get<\n      ListToolsApiV1ToolsGetResponses,\n      unknown,\n      ThrowOnError\n    >({\n      requestValidator: async (data) => {\n        return await zListToolsApiV1ToolsGetData.parseAsync(data)\n      },\n      responseValidator: async (data) => {\n        return await zListToolsApiV1ToolsGetResponse.parseAsync(data)\n      },\n      security: [\n        {\n          name: 'X-ONEGREP-API-KEY',\n          type: 'apiKey'\n        }\n      ],\n      url: '/api/v1/tools/',\n      ...options\n    })\n  }\n\n  /**\n   * Get Tool Resources Batch\n   * Returns hydrated tool resources for the specified tool IDs in an efficient batch operation.\n   */\n  public static getToolResourcesBatchApiV1ToolsResourcesBatchPost<\n    ThrowOnError extends boolean = false\n  >(\n    options: Options<\n      GetToolResourcesBatchApiV1ToolsResourcesBatchPostData,\n      ThrowOnError\n    >\n  ) {\n    return (options.client ?? _heyApiClient).post<\n      GetToolResourcesBatchApiV1ToolsResourcesBatchPostResponses,\n      GetToolResourcesBatchApiV1ToolsResourcesBatchPostErrors,\n      ThrowOnError\n    >({\n      requestValidator: async (data) => {\n        return await zGetToolResourcesBatchApiV1ToolsResourcesBatchPostData.parseAsync(\n          data\n        )\n      },\n      responseValidator: async (data) => {\n        return await zGetToolResourcesBatchApiV1ToolsResourcesBatchPostResponse.parseAsync(\n          data\n        )\n      },\n      security: [\n        {\n          name: 'X-ONEGREP-API-KEY',\n          type: 'apiKey'\n        }\n      ],\n      url: '/api/v1/tools/resources/batch',\n      ...options,\n      headers: {\n        'Content-Type': 'application/json',\n        ...options.headers\n      }\n    })\n  }\n\n  /**\n   * Get Tool\n   */\n  public static getToolApiV1ToolsToolIdGet<\n    ThrowOnError extends boolean = false\n  >(options: Options<GetToolApiV1ToolsToolIdGetData, ThrowOnError>) {\n    return (options.client ?? _heyApiClient).get<\n      GetToolApiV1ToolsToolIdGetResponses,\n      GetToolApiV1ToolsToolIdGetErrors,\n      ThrowOnError\n    >({\n      requestValidator: async (data) => {\n        return await zGetToolApiV1ToolsToolIdGetData.parseAsync(data)\n      },\n      responseValidator: async (data) => {\n        return await zGetToolApiV1ToolsToolIdGetResponse.parseAsync(data)\n      },\n      security: [\n        {\n          name: 'X-ONEGREP-API-KEY',\n          type: 'apiKey'\n        }\n      ],\n      url: '/api/v1/tools/{tool_id}',\n      ...options\n    })\n  }\n\n  /**\n   * Get Tool Properties\n   */\n  public static getToolPropertiesApiV1ToolsToolIdPropertiesGet<\n    ThrowOnError extends boolean = false\n  >(\n    options: Options<\n      GetToolPropertiesApiV1ToolsToolIdPropertiesGetData,\n      ThrowOnError\n    >\n  ) {\n    return (options.client ?? _heyApiClient).get<\n      GetToolPropertiesApiV1ToolsToolIdPropertiesGetResponses,\n      GetToolPropertiesApiV1ToolsToolIdPropertiesGetErrors,\n      ThrowOnError\n    >({\n      requestValidator: async (data) => {\n        return await zGetToolPropertiesApiV1ToolsToolIdPropertiesGetData.parseAsync(\n          data\n        )\n      },\n      responseValidator: async (data) => {\n        return await zGetToolPropertiesApiV1ToolsToolIdPropertiesGetResponse.parseAsync(\n          data\n        )\n      },\n      security: [\n        {\n          name: 'X-ONEGREP-API-KEY',\n          type: 'apiKey'\n        }\n      ],\n      url: '/api/v1/tools/{tool_id}/properties',\n      ...options\n    })\n  }\n\n  /**\n   * Get Tool Resource\n   * Returns the hydrated details for a tool given the current user and profile.\n   */\n  public static getToolResourceApiV1ToolsToolIdResourceGet<\n    ThrowOnError extends boolean = false\n  >(\n    options: Options<\n      GetToolResourceApiV1ToolsToolIdResourceGetData,\n      ThrowOnError\n    >\n  ) {\n    return (options.client ?? _heyApiClient).get<\n      GetToolResourceApiV1ToolsToolIdResourceGetResponses,\n      GetToolResourceApiV1ToolsToolIdResourceGetErrors,\n      ThrowOnError\n    >({\n      requestValidator: async (data) => {\n        return await zGetToolResourceApiV1ToolsToolIdResourceGetData.parseAsync(\n          data\n        )\n      },\n      responseValidator: async (data) => {\n        return await zGetToolResourceApiV1ToolsToolIdResourceGetResponse.parseAsync(\n          data\n        )\n      },\n      security: [\n        {\n          name: 'X-ONEGREP-API-KEY',\n          type: 'apiKey'\n        }\n      ],\n      url: '/api/v1/tools/{tool_id}/resource',\n      ...options\n    })\n  }\n}\n","import {\n  createConfig,\n  createClient,\n  ClientOptions\n} from '@toolprint/api-client'\nimport { getEnv, sdkApiSchema } from '@repo/utils'\nimport { OneGrepApiClient } from './types.js'\n\nimport { log } from '../log.js'\n\n/**\n * Create a client that can be used to check the health of the API.\n * @param baseUrl - The base URL of the API\n * @returns An instance of the OneGrep API Client\n */\nexport function createUnauthenticatedClient(baseUrl: string): OneGrepApiClient {\n  try {\n    const client = createClient(\n      createConfig<ClientOptions>({\n        baseUrl: baseUrl,\n        throwOnError: true\n      })\n    )\n    return client as unknown as OneGrepApiClient\n  } catch (error) {\n    log.error(`Error creating OneGrep Unauthenticated Client: ${error}`)\n    throw error\n  }\n}\n\n/**\n * Create a raw API Client given multiple optional parameters. A baseURL is always required.\n * @param clientParams - The parameters for the client\n * @returns An instance of the OneGrep API Client\n */\nexport function createApiClientFromParams(clientParams: {\n  baseUrl: string\n  apiKey?: string\n  accessToken?: string\n}): OneGrepApiClient {\n  const { baseUrl, apiKey, accessToken } = clientParams\n\n  let authSchemeProvided = false\n  const headers: Record<string, string> = {}\n  if (apiKey !== undefined) {\n    headers['X-ONEGREP-API-KEY'] = apiKey\n    authSchemeProvided = true\n  }\n\n  if (!authSchemeProvided && accessToken !== undefined) {\n    headers['Authorization'] = `Bearer ${accessToken}`\n    authSchemeProvided = true\n  }\n\n  if (!authSchemeProvided) {\n    throw new Error(\n      'No authentication scheme provided. Must provide either an API Key or an Access Token.'\n    )\n  }\n\n  try {\n    const client = createClient(\n      createConfig<ClientOptions>({\n        baseUrl: baseUrl,\n        headers: headers,\n        throwOnError: true\n      })\n    )\n    return client as unknown as OneGrepApiClient\n  } catch (error) {\n    log.error(`Error creating OneGrep API Client: ${error}`)\n    throw error\n  }\n}\n\n/**\n * Create a raw API Client given the state of the environment.\n * @returns A client configured with the environment variables\n */\nexport function clientFromConfig(): OneGrepApiClient {\n  const env = getEnv(sdkApiSchema)\n\n  if (!env.ONEGREP_API_KEY) {\n    throw new Error('ONEGREP_API_KEY is not set')\n  }\n\n  const params = {\n    apiKey: env.ONEGREP_API_KEY.toString(),\n    baseUrl: env.ONEGREP_API_URL.toString()\n  }\n\n  // console.debug(`Creating client pointing to ${params.baseUrl}`)\n\n  return createApiClientFromParams(params)\n}\n","/**\n * Custom error class for OneGrep API errors.\n */\nexport class OneGrepApiError extends Error {\n  private readonly _status?: number\n  private readonly _data?: unknown\n\n  constructor(\n    private readonly causedByError: Error | unknown,\n    response?: Response\n  ) {\n    // Handle different error types from the new fetch-based client\n    let message = 'Unknown API error'\n    let data: unknown\n    let status: number | undefined\n\n    if (causedByError instanceof Error) {\n      message = causedByError.message\n\n      // Handle ZodError (validation errors from the new client)\n      if ('issues' in causedByError) {\n        // This is a ZodError with validation issues\n        data = (causedByError as any).issues\n      } else if ('response' in causedByError) {\n        // For fetch errors, the error might have additional properties\n        data = (causedByError as any).response\n      }\n    } else if (typeof causedByError === 'string') {\n      message = causedByError\n    } else if (typeof causedByError === 'object' && causedByError !== null) {\n      // The new client may throw parsed error objects directly\n      data = causedByError\n      message = JSON.stringify(causedByError)\n    }\n\n    if (response) {\n      status = response.status\n      // If we have a response but no data from causedByError, use causedByError as data\n      if (!data) {\n        data = causedByError\n      }\n    }\n\n    super(message)\n    this.name = 'OneGrepApiError'\n    this._status = status\n    this._data = data\n  }\n\n  get cause(): Error | unknown {\n    return this.causedByError\n  }\n\n  get status(): number | undefined {\n    return this._status\n  }\n\n  get data(): unknown {\n    return this._data\n  }\n}\n\n/**\n * Makes an API call and handles errors by calling a callback instead of throwing exceptions.\n * @param apiCall - The async function that makes the API call\n * @param onError - Callback function that receives the error\n * @param onSuccess - Callback function that receives the successful response\n * @returns Promise<void> - Resolves when the call is complete, never rejects\n */\nexport async function makeApiCallWithCallback<T>(\n  apiCall: () => Promise<T>,\n  onSuccess?: (response: T) => void,\n  onError?: (error: unknown) => void\n): Promise<void> {\n  try {\n    const response = await apiCall()\n    onSuccess?.(response)\n  } catch (error) {\n    onError?.(new OneGrepApiError(error))\n  }\n}\n\n/**\n * Makes an API call and returns a result object instead of throwing exceptions.\n * @param apiCall - The async function that makes the API call\n * @returns Promise<{ success: boolean; data?: T; error?: unknown }> - Always resolves with a result object\n */\nexport async function makeApiCallWithResult<T>(\n  apiCall: () => Promise<unknown>\n): Promise<{ success: boolean; data?: T; error?: unknown }> {\n  try {\n    const response = await apiCall()\n\n    if (response && typeof response === 'object' && 'data' in response) {\n      return {\n        success: true,\n        data: response.data as unknown as T\n      }\n    }\n    throw new Error(`Unexpected response type: ${typeof response}`)\n  } catch (error) {\n    // The new client throws the parsed error response directly\n    // We need to create a OneGrepApiError with the error data\n    return {\n      success: false,\n      error: new OneGrepApiError(error)\n    }\n  }\n}\n","import {\n  AuthenticationStatus,\n  ToolServerProvider,\n  ToolServer,\n  Tool,\n  SearchService,\n  IntegrationsService,\n  ToolprintRecommendationReadable,\n  RegisteredToolprintReadable,\n  ToolprintInput,\n  ToolprintOutput,\n  ProvidersService,\n  AccountInformation,\n  SearchResponseScoredItemRegisteredToolprintReadable,\n  SearchRequest,\n  ToolProperties,\n  ToolResource,\n  SearchResponseScoredItemTool,\n  DefaultService,\n  SdkService,\n  AccountService,\n  FlagsService,\n  UpsertSecretRequest,\n  UpsertSecretResponse,\n  ServersService,\n  ToolsService,\n  ToolprintsService,\n  SecretsService,\n  InitializeResponse,\n  GetAllFlagsResponse\n} from '@toolprint/api-client'\nimport { makeApiCallWithResult } from './utils.js'\nimport { OneGrepApiClient, ToolServerClient } from './types.js'\n\nexport class OneGrepApiHighLevelClient {\n  constructor(private readonly apiClient: OneGrepApiClient) {}\n\n  async healthCheck(): Promise<boolean> {\n    const result = await makeApiCallWithResult<void>(async () => {\n      await DefaultService.healthHealthGet({\n        client: this.apiClient\n      })\n    })\n    return result.success\n  }\n\n  /** Returns the global \"ai.txt\" for an agent to gather details on what the API can do. */\n  async getAiTxt(): Promise<string> {\n    const result = await makeApiCallWithResult<string>(async () => {\n      return await DefaultService.getAiDocumentationAiTxtGet({\n        client: this.apiClient\n      })\n    })\n\n    if (result.error) {\n      throw result.error\n    }\n    return result.data!\n  }\n\n  async initialize(): Promise<InitializeResponse> {\n    const result = await makeApiCallWithResult<InitializeResponse>(async () => {\n      return await SdkService.initializeApiV1SdkInitializeGet({\n        client: this.apiClient\n      })\n    })\n    if (result.error) {\n      throw result.error\n    }\n    return result.data!\n  }\n\n  async authStatus(): Promise<AuthenticationStatus> {\n    const result = await makeApiCallWithResult<AuthenticationStatus>(\n      async () => {\n        return await AccountService.getAuthStatusApiV1AccountAuthStatusGet({\n          client: this.apiClient\n        })\n      }\n    )\n    if (result.error) {\n      throw result.error\n    }\n    return result.data!\n  }\n\n  async getAccountInformation(): Promise<AccountInformation> {\n    const result = await makeApiCallWithResult<AccountInformation>(async () => {\n      return await AccountService.getAccountInformationApiV1AccountGet({\n        client: this.apiClient\n      })\n    })\n    if (result.error) {\n      throw result.error\n    }\n    return result.data!\n  }\n\n  async createAccountByInvitation(\n    invitationCode: string,\n    email: string\n  ): Promise<AccountInformation> {\n    const result = await makeApiCallWithResult<AccountInformation>(async () => {\n      return await AccountService.createAccountByInvitationApiV1AccountInvitationCodePost(\n        {\n          client: this.apiClient,\n          body: { invitation_code: invitationCode, email: email }\n        }\n      )\n    })\n    if (result.error) {\n      throw result.error\n    }\n    return result.data!\n  }\n\n  async getFlags(): Promise<Record<string, boolean | string>> {\n    const result = await makeApiCallWithResult<GetAllFlagsResponse>(\n      async () => {\n        return await FlagsService.getAllFlagsApiV1FlagsGet({\n          client: this.apiClient\n        })\n      }\n    )\n    if (result.error) {\n      throw result.error\n    }\n    return result.data!.flags as unknown as Record<string, boolean>\n  }\n\n  async getSecret(secretName: string): Promise<any> {\n    const result = await makeApiCallWithResult<any>(async () => {\n      return await SecretsService.getSecretApiV1SecretsSecretNameGet({\n        client: this.apiClient,\n        path: { secret_name: secretName }\n      })\n    })\n    if (result.error) {\n      throw result.error\n    }\n    return result.data!\n  }\n\n  async upsertSecret(secretName: string, secret: string): Promise<boolean> {\n    const result = await makeApiCallWithResult<UpsertSecretResponse>(\n      async () => {\n        const request: UpsertSecretRequest = {\n          value_type: 'string',\n          value: secret\n        }\n        return await SecretsService.upsertSecretApiV1SecretsSecretNamePut({\n          client: this.apiClient,\n          body: {\n            request: request\n          },\n          path: {\n            secret_name: secretName\n          }\n        })\n      }\n    )\n    if (result.error) {\n      throw result.error\n    }\n    return result.data!.success\n  }\n\n  async getAllProviders(): Promise<ToolServerProvider[]> {\n    const result = await makeApiCallWithResult<ToolServerProvider[]>(\n      async () => {\n        return await ProvidersService.listProvidersApiV1ProvidersGet({\n          client: this.apiClient\n        })\n      }\n    )\n    if (result.error) {\n      throw result.error\n    }\n    return result.data!\n  }\n\n  async getServerName(serverId: string): Promise<string> {\n    const result = await makeApiCallWithResult<ToolServer>(async () => {\n      const toolServer = await ServersService.getServerApiV1ServersServerIdGet({\n        client: this.apiClient,\n        path: {\n          server_id: serverId\n        }\n      })\n      return toolServer\n    })\n    if (result.error) {\n      throw result.error\n    }\n    return result.data!.name\n  }\n\n  async getAllServers(): Promise<Record<string, ToolServer>> {\n    const result = await makeApiCallWithResult<ToolServer[]>(async () => {\n      return await ServersService.listServersApiV1ServersGet({\n        client: this.apiClient\n      })\n    })\n    if (result.error) {\n      throw result.error\n    }\n    const toolServersMap: Record<string, ToolServer> = {}\n    for (const toolServer of result.data!) {\n      toolServersMap[toolServer.id] = toolServer\n    }\n    return toolServersMap\n  }\n\n  async getAllServerNames(): Promise<string[]> {\n    const servers = await this.getAllServers()\n    return Object.values(servers).map((server) => server.name)\n  }\n\n  async getAllServersForProvider(\n    providerName: string\n  ): Promise<Record<string, ToolServer>> {\n    const providers = await this.getAllProviders()\n    const provider = providers.find(\n      (provider) => provider.name === providerName\n    )\n    if (!provider) {\n      throw new Error(`Provider ${providerName} not found`)\n    }\n    const servers = await this.getAllServers()\n    const serversByProvider: Record<string, ToolServer> = {}\n    for (const server of Object.values(servers)) {\n      if (server.provider_id === provider.id) {\n        serversByProvider[server.id] = server as ToolServer\n      }\n    }\n    return serversByProvider\n  }\n\n  /**\n   * Get the client for a given server.\n   * @param serverId - The ID of the server to get the client for.\n   * @returns The client for the given server.\n   */\n  async getServerClient(serverId: string): Promise<ToolServerClient> {\n    const result = await makeApiCallWithResult<ToolServerClient>(async () => {\n      const toolServerClient =\n        await ServersService.getServerClientApiV1ServersServerIdClientGet({\n          client: this.apiClient,\n          path: {\n            server_id: serverId\n          }\n        })\n      return toolServerClient\n    })\n    if (result.error) {\n      throw result.error\n    }\n    return result.data!\n  }\n\n  async listTools(): Promise<Tool[]> {\n    const result = await makeApiCallWithResult<Tool[]>(async () => {\n      return await ToolsService.listToolsApiV1ToolsGet({\n        client: this.apiClient\n      })\n    })\n    if (result.error) {\n      throw result.error\n    }\n    return result.data!\n  }\n\n  async getTool(toolId: string): Promise<Tool> {\n    const result = await makeApiCallWithResult<Tool>(async () => {\n      return await ToolsService.getToolApiV1ToolsToolIdGet({\n        client: this.apiClient,\n        path: {\n          tool_id: toolId\n        }\n      })\n    })\n    if (result.error) {\n      throw result.error\n    }\n    return result.data!\n  }\n\n  async getToolProperties(toolId: string): Promise<ToolProperties> {\n    const result = await makeApiCallWithResult<ToolProperties>(async () => {\n      const toolProperties =\n        await ToolsService.getToolPropertiesApiV1ToolsToolIdPropertiesGet({\n          path: {\n            tool_id: toolId\n          }\n        })\n      return toolProperties\n    })\n    if (result.error) {\n      throw result.error\n    }\n    return result.data!\n  }\n\n  async upsertToolTags(\n    integrationName: string,\n    toolNames: string[],\n    tags: Record<string, any>\n  ): Promise<Array<ToolResource>> {\n    const result = await makeApiCallWithResult<Array<ToolResource>>(\n      async () => {\n        return await IntegrationsService.upsertMultipleToolCustomTagsApiV1IntegrationsIntegrationNameToolsCustomTagsPost(\n          {\n            client: this.apiClient,\n            path: { integration_name: integrationName },\n            body: { tool_names: toolNames, tags: tags }\n          }\n        )\n      }\n    )\n    if (result.error) {\n      throw result.error\n    }\n    return result.data!\n  }\n\n  async getToolResource(toolId: string): Promise<ToolResource> {\n    const result = await makeApiCallWithResult<ToolResource>(async () => {\n      const toolResource =\n        await ToolsService.getToolResourceApiV1ToolsToolIdResourceGet({\n          client: this.apiClient,\n          path: {\n            tool_id: toolId\n          }\n        })\n      return toolResource\n    })\n    if (result.error) {\n      throw result.error\n    }\n    return result.data!\n  }\n\n  async getToolResourcesBatch(\n    toolIds: string[]\n  ): Promise<Map<string, ToolResource>> {\n    const result = await makeApiCallWithResult<ToolResource[]>(async () => {\n      const toolResources =\n        await ToolsService.getToolResourcesBatchApiV1ToolsResourcesBatchPost({\n          client: this.apiClient,\n          body: {\n            ids: toolIds\n          }\n        })\n      return toolResources\n    })\n    if (result.error) {\n      throw result.error\n    }\n\n    const toolResourcesMap: Map<string, ToolResource> = new Map()\n    for (const toolResource of result.data!) {\n      toolResourcesMap.set(toolResource.tool.id, toolResource)\n    }\n    return toolResourcesMap\n  }\n\n  async getToolResourcesForIntegration(\n    integrationName: string\n  ): Promise<ToolResource[]> {\n    const result = await makeApiCallWithResult<ToolResource[]>(async () => {\n      return await IntegrationsService.getIntegrationToolsApiV1IntegrationsIntegrationNameToolsGet(\n        {\n          client: this.apiClient,\n          path: {\n            integration_name: integrationName\n          }\n        }\n      )\n    })\n    if (result.error) {\n      throw result.error\n    }\n    return result.data!\n  }\n\n  async searchTools(\n    query: string,\n    options?: SearchRequest\n  ): Promise<SearchResponseScoredItemTool> {\n    const result = await makeApiCallWithResult<SearchResponseScoredItemTool>(\n      async () => {\n        return await SearchService.searchToolsApiV1SearchToolsPost({\n          client: this.apiClient,\n          body: {\n            ...options,\n            query: query\n          }\n        })\n      }\n    )\n    if (result.error) {\n      throw result.error\n    }\n    return result.data!\n  }\n\n  /**\n   * Search for toolprints.\n   * @param query - The query to search for.\n   * @returns The search results.\n   */\n  async searchToolprints(\n    query: string,\n    options?: SearchRequest\n  ): Promise<SearchResponseScoredItemRegisteredToolprintReadable> {\n    const result =\n      await makeApiCallWithResult<SearchResponseScoredItemRegisteredToolprintReadable>(\n        async () => {\n          return await SearchService.searchToolprintsApiV1SearchToolprintsPost({\n            client: this.apiClient,\n            body: {\n              // the query parameter takes precedence over options.query\n              ...options,\n              query: query\n            }\n          })\n        }\n      )\n    if (result.error) {\n      throw result.error\n    }\n    return result.data!\n  }\n\n  async recommendToolprint(\n    goal: string\n  ): Promise<ToolprintRecommendationReadable> {\n    const result = await makeApiCallWithResult<ToolprintRecommendationReadable>(\n      async () => {\n        return await SearchService.getToolprintRecommendationApiV1SearchToolprintsRecommendationPost(\n          {\n            client: this.apiClient,\n            body: {\n              query: goal\n            }\n          }\n        )\n      }\n    )\n    if (result.error) {\n      throw result.error\n    }\n    return result.data!\n  }\n\n  async newToolprint(\n    toolprint: ToolprintInput\n  ): Promise<RegisteredToolprintReadable> {\n    const result = await makeApiCallWithResult<RegisteredToolprintReadable>(\n      async () => {\n        return await ToolprintsService.createToolprintApiV1ToolprintsPost({\n          client: this.apiClient,\n          body: toolprint\n        })\n      }\n    )\n    if (result.error) {\n      throw result.error\n    }\n    return result.data!\n  }\n\n  async newToolprintFromJson(json: string): Promise<ToolprintOutput> {\n    const result = await makeApiCallWithResult<ToolprintOutput>(async () => {\n      const output: ToolprintOutput =\n        (await ToolprintsService.createToolprintJsonApiV1ToolprintsJsonPost({\n          client: this.apiClient,\n          body: {\n            content: json\n          }\n        })) as unknown as ToolprintOutput\n      return output\n    })\n    if (result.error) {\n      throw result.error\n    }\n    return result.data!\n  }\n\n  async newToolprintFromYaml(\n    yaml: string\n  ): Promise<RegisteredToolprintReadable> {\n    const result = await makeApiCallWithResult<ToolprintOutput>(async () => {\n      const output: ToolprintOutput =\n        (await ToolprintsService.createToolprintYamlApiV1ToolprintsYamlPost({\n          client: this.apiClient,\n          body: yaml\n        })) as unknown as ToolprintOutput\n      return output\n    })\n    if (result.error) {\n      throw result.error\n    }\n    return result.data! as unknown as RegisteredToolprintReadable\n  }\n\n  async validateToolprint(toolprint: ToolprintInput): Promise<boolean> {\n    const result = await makeApiCallWithResult<boolean>(async () => {\n      return await ToolprintsService.validateToolprintApiV1ToolprintsValidatePost(\n        {\n          client: this.apiClient,\n          body: toolprint\n        }\n      )\n    })\n    if (result.error) {\n      throw result.error\n    } else if (!result.success) {\n      return false\n    }\n    return true\n  }\n\n  async validateToolprintInJson(json: string): Promise<boolean> {\n    const result = await makeApiCallWithResult<boolean>(async () => {\n      return await ToolprintsService.validateToolprintJsonApiV1ToolprintsValidateJsonPost(\n        {\n          client: this.apiClient,\n          body: {\n            content: json\n          }\n        }\n      )\n    })\n    if (result.error) {\n      throw result.error\n    } else if (!result.success) {\n      return false\n    }\n    return true\n  }\n\n  async validateToolprintInYaml(yaml: string): Promise<boolean> {\n    const result = await makeApiCallWithResult<string>(async () => {\n      return await ToolprintsService.validateToolprintYamlApiV1ToolprintsValidateYamlPost(\n        {\n          client: this.apiClient,\n          body: yaml\n        }\n      )\n    })\n    if (result.error) {\n      throw result.error\n    } else if (!result.success) {\n      return false\n    }\n    return true\n  }\n\n  async getToolprintJsonSchema(): Promise<object> {\n    const result = await makeApiCallWithResult<object>(async () => {\n      return await ToolprintsService.getToolprintSchemaApiV1ToolprintsWellKnownSchemaGet(\n        {\n          client: this.apiClient\n        }\n      )\n    })\n    if (result.error) {\n      throw result.error\n    }\n    return result.data!\n  }\n\n  async getToolprintTemplate(): Promise<string> {\n    const result = await makeApiCallWithResult<string>(async () => {\n      return await ToolprintsService.getToolprintTemplateApiV1ToolprintsWellKnownTemplateGet(\n        {\n          client: this.apiClient\n        }\n      )\n    })\n    if (result.error) {\n      throw result.error\n    }\n    return result.data!\n  }\n\n  /** Returns the \"ai.txt\" instruction set for toolprint generation. */\n  async getToolprintAiTxt(): Promise<string> {\n    const result = await makeApiCallWithResult<string>(async () => {\n      return await ToolprintsService.getToolprintInstructionsApiV1ToolprintsWellKnownAiTxtGet(\n        {\n          client: this.apiClient\n        }\n      )\n    })\n    if (result.error) {\n      throw result.error\n    }\n    return result.data!\n  }\n}\n","import { initialize } from '@blaxel/core'\nimport { ToolServerClient } from '~/core/index.js'\nimport {\n  BlaxelToolServerClient,\n  ComposioToolServerClient,\n  SmitheryToolServerClient\n} from '@toolprint/api-client'\nimport { createBlaxelConnection } from '~/providers/blaxel/connection.js'\nimport { createSmitheryConnection } from '~/providers/smithery/connection.js'\nimport {\n  ConnectionManager,\n  ToolServerConnection,\n  ToolServerId\n} from '~/types.js'\nimport {\n  MultiTransportClientSession,\n  RefreshableMultiTransportClientSession\n} from '~/providers/mcp/session.js'\nimport { ClientSessionFactory } from '~/providers/mcp/session.js'\nimport { ClientSession } from '~/providers/mcp/session.js'\nimport { ClientSessionManager } from '~/providers/mcp/session.js'\n\nimport {\n  createBlaxelMcpClientTransports as blaxelMcpTransportOptions,\n  BlaxelSettings\n} from '~/providers/blaxel/transport.js'\nimport { createSmitheryTransports as smitheryMcpTransportOptions } from '~/providers/smithery/transport.js'\n\nimport { log } from '~/core/log.js'\nimport { xBlaxelHeaders } from './providers/blaxel/api.js'\nimport { SecretManager } from './secrets/index.js'\nimport { SmitheryUrlOptions } from '@smithery/sdk/shared/config.js'\nimport { createComposioTransports } from './providers/composio/transport.js'\nimport { createComposioConnection } from './providers/composio/connection.js'\n\nexport class ClientSessionError extends Error {\n  constructor(message: string) {\n    super(message)\n    this.name = 'ClientSessionError'\n  }\n}\n\nexport class InvalidTransportConfigError extends ClientSessionError {\n  constructor(message: string) {\n    super(message)\n    this.name = 'InvalidTransportConfigError'\n  }\n}\n\n/**\n * A function that creates a client session for a tool server client\n */\nexport interface ClientSessionMaker<T extends ToolServerClient> {\n  create: (client: T) => Promise<ClientSession>\n}\n\nexport const blaxelClientSessionMaker: ClientSessionMaker<BlaxelToolServerClient> =\n  {\n    create: async (client: BlaxelToolServerClient) => {\n      return Promise.resolve(\n        new RefreshableMultiTransportClientSession(\n          blaxelMcpTransportOptions(client.blaxel_function)\n        )\n      )\n    }\n  }\n\nexport const apiKeyBlaxelClientSessionMaker = (\n  apiKey: string,\n  workspace: string,\n  providedSettings?: BlaxelSettings\n): ClientSessionMaker<BlaxelToolServerClient> => {\n  const headerOverrides = xBlaxelHeaders(apiKey, workspace)\n  log.trace('Blaxel header overrides', headerOverrides)\n  initialize({\n    apikey: apiKey,\n    workspace: workspace\n  })\n  return {\n    create: async (client: BlaxelToolServerClient) => {\n      return Promise.resolve(\n        new MultiTransportClientSession(\n          blaxelMcpTransportOptions(\n            client.blaxel_function,\n            providedSettings,\n            headerOverrides\n          )\n        )\n      )\n    }\n  }\n}\n\nexport const smitheryClientSessionMaker: ClientSessionMaker<SmitheryToolServerClient> =\n  {\n    create: async (client: SmitheryToolServerClient) => {\n      return Promise.resolve(\n        new MultiTransportClientSession(\n          smitheryMcpTransportOptions(client, {\n            apiKey: process.env.SMITHERY_API_KEY,\n            profile: 'default' // ! Probably won't work, it generates a random profile name\n          })\n        )\n      )\n    }\n  }\n\nexport const apiKeySmitheryClientSessionMaker = (\n  secretManager: SecretManager,\n  apiKey: string,\n  profileId: string\n): ClientSessionMaker<SmitheryToolServerClient> => {\n  return {\n    create: async (client: SmitheryToolServerClient) => {\n      // Initialize the config with an empty object by default\n      let smitheryConfig: Record<string, any> = {}\n\n      const launchConfig = client.launch_config\n      if (\n        launchConfig &&\n        typeof launchConfig === 'object' &&\n        'source' in launchConfig\n      ) {\n        // ! We only support Doppler source for now\n        if (launchConfig.source === 'doppler') {\n          log.debug('Loading Smithery launch config from Doppler')\n\n          const secretName = launchConfig.secret_name\n          const hasSecret = await secretManager.hasSecret(secretName)\n\n          // If the secret exists, parse it and use it as the config\n          if (hasSecret) {\n            const secret = await secretManager.getSecret(secretName)\n            try {\n              smitheryConfig = JSON.parse(secret)\n            } catch (error) {\n              throw new ClientSessionError(\n                `Failed to parse Smithery launch config: ${error}`\n              )\n            }\n            log.debug('Smithery launch config parsed successfully from Doppler')\n          } else {\n            log.warn(\n              'Smithery launch config not found in Doppler, using empty config'\n            )\n          }\n        }\n      }\n\n      const smitheryUrlOptions: SmitheryUrlOptions = {\n        apiKey,\n        profile: profileId,\n        config: smitheryConfig\n      }\n      return Promise.resolve(\n        new MultiTransportClientSession(\n          smitheryMcpTransportOptions(client, smitheryUrlOptions)\n        )\n      )\n    }\n  }\n}\n\nexport const apiKeyComposioClientSessionMaker = (\n  apiKey: string\n): ClientSessionMaker<ComposioToolServerClient> => {\n  log.debug('Creating Composio client session maker', apiKey)\n  return {\n    create: async (client: ComposioToolServerClient) => {\n      return Promise.resolve(\n        new MultiTransportClientSession(createComposioTransports(client))\n      )\n    }\n  }\n}\n\nclass RegisteredClientSessionFactory {\n  private clientTypeToSessionMaker: Map<\n    string,\n    ClientSessionMaker<ToolServerClient>\n  >\n\n  constructor(\n    sessionMakers?: Map<string, ClientSessionMaker<ToolServerClient>>\n  ) {\n    this.clientTypeToSessionMaker = sessionMakers ?? new Map()\n  }\n\n  register(\n    client_type: string,\n    sessionMaker: ClientSessionMaker<ToolServerClient>\n  ) {\n    this.clientTypeToSessionMaker.set(client_type, sessionMaker)\n  }\n\n  create(client: ToolServerClient): Promise<ClientSession> {\n    if (!this.clientTypeToSessionMaker.has(client.client_type)) {\n      throw new Error(\n        `Session maker not registered for client type: ${client.client_type}`\n      )\n    }\n    return this.clientTypeToSessionMaker.get(client.client_type)!.create(client)\n  }\n}\n\n/**\n * Creates a client session for a tool server based on the client type.\n */\nexport const defaultToolServerSessionFactory: RegisteredClientSessionFactory =\n  new RegisteredClientSessionFactory()\n\n/**\n * Manages tool server sessions for different tool servers.\n *\n * Sessions are cached by tool server id\n *\n * Must use close() to clean up sessions\n */\nexport function createToolServerSessionManager(\n  factory: ClientSessionFactory<\n    ToolServerClient,\n    ClientSession\n  > = defaultToolServerSessionFactory\n): ClientSessionManager<ToolServerClient, ClientSession> {\n  return new ClientSessionManager<ToolServerClient, ClientSession>(\n    factory,\n    (client) => Promise.resolve(client.server_id) // KeyExtractor uses the server_id as the key\n  )\n}\n\n/**\n * Manages connections to tool servers of different types.\n *\n * connections are cached and reused for efficiency\n *\n * Must use close() to clean up connections\n */\nexport class ToolServerConnectionManager implements ConnectionManager {\n  private readonly toolServerSessionManager: ClientSessionManager<\n    ToolServerClient,\n    ClientSession\n  >\n  private openConnections: Map<ToolServerId, ToolServerConnection>\n\n  constructor(\n    factory: ClientSessionFactory<\n      ToolServerClient,\n      ClientSession\n    > = defaultToolServerSessionFactory\n  ) {\n    this.toolServerSessionManager = createToolServerSessionManager(factory)\n    this.openConnections = new Map()\n  }\n\n  private async removeClosedConnection(\n    client: ToolServerClient\n  ): Promise<void> {\n    this.openConnections.delete(client.server_id)\n    log.debug(`Removed closed connection for tool server ${client.server_id}`)\n  }\n\n  private async newConnection(\n    client: ToolServerClient\n  ): Promise<ToolServerConnection> {\n    // ! Extend the onClose callback to remove the closed connection from the open connections map\n    async function extendOnClose(\n      manager: ToolServerConnectionManager,\n      mcpClientSession: ClientSession\n    ) {\n      const originalOnClose = mcpClientSession.onClose\n      mcpClientSession.onClose = async () => {\n        await originalOnClose?.()\n        await manager.removeClosedConnection(client)\n      }\n    }\n\n    if (client.client_type === 'blaxel') {\n      // ! Use the SDK's MCP client sessions if the environment variable is set\n      if (process.env.ONEGREP_SDK_BLAXEL_USE_SDK_SESSIONS) {\n        return await createBlaxelConnection(client as BlaxelToolServerClient)\n      }\n\n      // Otherwise we manage our own sessions\n      const mcpClientSession =\n        await this.toolServerSessionManager.getSession(client)\n      extendOnClose(this, mcpClientSession)\n\n      return await createBlaxelConnection(\n        client as BlaxelToolServerClient,\n        mcpClientSession\n      )\n    }\n    if (client.client_type === 'smithery') {\n      const mcpClientSession =\n        await this.toolServerSessionManager.getSession(client)\n      extendOnClose(this, mcpClientSession)\n\n      return await createSmitheryConnection(\n        client as SmitheryToolServerClient,\n        mcpClientSession\n      )\n    }\n\n    if (client.client_type === 'composio') {\n      const mcpClientSession =\n        await this.toolServerSessionManager.getSession(client)\n      extendOnClose(this, mcpClientSession)\n\n      return await createComposioConnection(\n        client as ComposioToolServerClient,\n        mcpClientSession\n      )\n    }\n\n    throw new Error(\n      `Unsupported tool server client type: ${client.client_type}`\n    )\n  }\n\n  /**\n   * Connect to a tool server and return a connection.\n   *\n   * returns an active connection for a given server id if one exists\n   * otherwise creates a new connection and caches it\n   */\n  async connect(client: ToolServerClient): Promise<ToolServerConnection> {\n    if (this.openConnections.has(client.server_id)) {\n      log.info(`Returning open connection for tool server: ${client.server_id}`)\n      return this.openConnections.get(client.server_id)!\n    }\n    const connection = await this.newConnection(client)\n    this.openConnections.set(client.server_id, connection)\n    log.info(\n      `Opening ${connection.constructor.name} for tool server: ${client.server_id}`\n    )\n\n    await connection.initialize()\n    log.info(`Connection initialized for tool server: ${client.server_id}`)\n\n    return connection\n  }\n\n  /**\n   * Close all connections.\n   */\n  async close(): Promise<void> {\n    for (const connection of this.openConnections.values()) {\n      await connection.close()\n    }\n    this.openConnections.clear()\n  }\n}\n","import { Buffer } from 'buffer'\nimport { z } from 'zod'\n\nimport {\n  CallToolResult,\n  TextContent,\n  ImageContent,\n  EmbeddedResource,\n  CallToolRequest\n} from '@modelcontextprotocol/sdk/types.js'\nimport { Client } from '@modelcontextprotocol/sdk/client/index.js'\n\nimport {\n  ToolCallResultContent,\n  ObjectResultContent,\n  ToolCallOutput,\n  TextResultContent,\n  BinaryResultContent,\n  ToolCallOutputMode,\n  ToolCallResponse,\n  ToolCallInput,\n  BasicToolDetails,\n  ToolCallError,\n  ToolDetails\n} from '~/types.js'\nimport { jsonSchemaUtils } from '~/schema.js'\n\nimport { log } from '~/core/log.js'\n\nexport type McpCallToolResultContent = Array<\n  TextContent | ImageContent | EmbeddedResource\n>\n\n// Parse MCP TextContent into an ObjectResultContent validated against the output schema\n// Throws an error if the content is not valid or if the text is not valid JSON\n// function parseOutputContent(\n//   content: TextContent,\n//   outputSchema: JsonSchema\n// ): ObjectResultContent {\n//   try {\n//     const parsedJson: Record<string, any> = JSON.parse(content.text)\n//     // console.debug(`Parsed JSON: ${JSON.stringify(parsedJson)}`)\n//     const validator = jsonSchemaUtils.getValidator(outputSchema)\n//     const valid = validator(parsedJson)\n//     if (!valid) {\n//       throw new Error(`Tool output content is not valid`)\n//     }\n//     return { type: 'object', data: parsedJson }\n//   } catch (error) {\n//     throw new Error(`JSON parsing failed: ${error}`)\n//   }\n// }\n\n// Validate the number of MCP TextContent results to the output mode\n// Returns an array of ObjectResultContent validated against the output schema\n// function _validateOutputSchema(\n//   contents: TextContent[],\n//   outputSchema: JsonSchema,\n//   mode: ToolCallOutputMode = 'single' // TODO: Put this in the tool metadata\n// ): ObjectResultContent[] {\n//   const resultContents: ObjectResultContent[] = []\n//   if (mode === 'single') {\n//     if (contents.length < 1) {\n//       return resultContents\n//     } else if (contents.length > 1) {\n//       throw new Error(`Expected 0..1 content, got ${contents.length}`)\n//     }\n//   }\n\n//   // Parse the contents into schema-validated objects\n//   for (const content of contents) {\n//     resultContents.push(parseOutputContent(content, outputSchema))\n//   }\n//   return resultContents\n// }\n\n// If we're attempting to validate using an output schema, we need to first ensure we have all MCP TextContent\n// Any Image Content or Resource Content returned would mean we don't have a \"Structured\" tool result.\n// function validateOutputSchema(\n//   contents: McpCallToolResultContent,\n//   outputSchema: JsonSchema\n// ): ObjectResultContent[] {\n//   if (\n//     !contents.every((item) => typeof item === 'object' && item.type === 'text')\n//   ) {\n//     throw new Error('All content must be of type TextContent.')\n//   } else {\n//     return _validateOutputSchema(contents, outputSchema)\n//   }\n// }\n\n// A parsing approach to results from MCP when we are not provided an output schema\n// If enabled, attemptStructuredOutput settings will attempt to create ObjectResultContent from TextContent if it is valid JSON\n// Otherwise, we return a TextResultContent as a fallback.  We convert ImageContent to BinaryContent for consistency.\nexport function parseMcpContent(\n  mcpContent: McpCallToolResultContent,\n  attemptStructuredOutput: boolean = true // TODO: Should attempt structured output be the default behavior?\n): ToolCallResultContent {\n  const resultContent: (\n    | TextResultContent\n    | ObjectResultContent\n    | BinaryResultContent\n  )[] = []\n  for (const content of mcpContent) {\n    if (content.type === 'text') {\n      // TODO: Should indicate in the tool metadata that structured output should be attempted\n      if (attemptStructuredOutput) {\n        try {\n          const parsedJson = JSON.parse(content.text)\n          resultContent.push({ type: 'object', data: parsedJson })\n        } catch (error) {\n          log.debug(`Invalid JSON: ${error}`)\n          resultContent.push({ type: 'text', text: content.text })\n        }\n      } else {\n        resultContent.push({ type: 'text', text: content.text })\n      }\n    } else if (content.type === 'image') {\n      // Decode the base64-encoded image data\n      const decodedData = Buffer.from(content.data, 'base64').toString('binary')\n      resultContent.push({\n        type: 'binary',\n        data: decodedData,\n        mime_type: content.mimeType\n      })\n    } else if (content.type === 'resource') {\n      throw new Error('Embedded resources are not implemented yet')\n    } else {\n      throw new Error(`Unknown content type: ${JSON.stringify(content)}`)\n    }\n  }\n  return resultContent\n}\n\n// ! TODO: Broken for now because we need to refactor output schema\n// Parse raw MCP results into a ToolCallOutput\n// First check if the tool result is an error, if so, throw an error\n// If the tool metadata includes an output schema, we attempt to validate the output schema\n// Otherwise, we parse the raw content into a ToolCallResultContent\nexport function parseMcpResult<T>(\n  result: CallToolResult,\n  toolDetails: ToolDetails,\n  mode: ToolCallOutputMode = 'single' // TODO: Put this in the tool metadata\n): ToolCallOutput<T> {\n  if (result.isError) {\n    throw new Error(`MCP Tool call failed`)\n  }\n\n  // Attempt to validate the output schema if it is provided, otherwise attempt to parse the raw content\n  // if (toolMetadata.outputSchema) {\n  //   log.debug(`Validating structured output for tool: ${toolMetadata.name}`)\n  //   const content = validateOutputSchema(\n  //     result.content,\n  //     toolMetadata.outputSchema\n  //   )\n\n  //   // Create a function that safely parses the content into the zod output type\n  //   const toZod = () => {\n  //     const outputZodType = toolMetadata.zodOutputType()\n  //     // console.debug(`Content: ${JSON.stringify(content)}`)\n  //     const zodOutput =\n  //       mode === 'single'\n  //         ? outputZodType.safeParse(content[0].data)\n  //         : outputZodType.array().safeParse(content.map((c) => c.data))\n  //     if (!zodOutput.success) {\n  //       throw new Error(`Failed to parse tool output`)\n  //     }\n  //     return zodOutput.data\n  //   }\n\n  //   return { isError: false, content, mode, toZod } as ToolCallOutput<T>\n  // } else {\n  log.warn(`No output schema provided for tool: ${toolDetails.name}`)\n  const content = parseMcpContent(result.content as McpCallToolResultContent)\n  return {\n    isError: false,\n    content,\n    mode,\n    toZod: () => undefined\n  } as ToolCallOutput<T>\n  // }\n}\n\n// TODO: How to determine the output type?\nexport const parseResultFunc = (\n  result: CallToolResult\n): ToolCallResponse<any> => {\n  log.debug('Parsing tool result')\n  const resultContent = result.content as McpCallToolResultContent\n  const content = parseMcpContent(resultContent)\n  return {\n    isError: false,\n    content: content,\n    mode: 'single',\n    toZod: () => {\n      return z.object({})\n    }\n  }\n}\n\n/**\n * Call a tool using the MCP protocol, wrapped in our Input/Output schema validation.\n *\n * @param mcpClient - The MCP client to use.\n * @param toolDetails - The details of the tool to call.\n * @param toolCallInput - The input to the tool call.\n */\nexport const mcpCallTool = async (\n  mcpClient: Client,\n  toolDetails: BasicToolDetails,\n  toolCallInput: ToolCallInput\n): Promise<ToolCallResponse<any>> => {\n  log.info(\n    `Calling MCP tool ${toolDetails.name} with input ${JSON.stringify(toolCallInput)}`\n  )\n  try {\n    const validator = jsonSchemaUtils.getValidator(toolDetails.inputSchema)\n    const valid = validator(toolCallInput.args)\n    if (!valid) {\n      throw new Error('Invalid tool input arguments')\n    }\n    const callToolRequest: CallToolRequest = {\n      method: 'tools/call',\n      params: {\n        name: toolDetails.name,\n        arguments: toolCallInput.args\n      }\n    }\n    const result = await mcpClient.callTool(callToolRequest.params)\n    if (result.isError) {\n      const errorMsg = `Tool call failed.\\nReason: ${JSON.stringify(result)}`\n      log.error(errorMsg)\n      throw new Error(errorMsg)\n    }\n    return parseResultFunc(result as CallToolResult)\n  } catch (error) {\n    if (error instanceof Error) {\n      return {\n        isError: true,\n        message: error.message\n      } as ToolCallError\n    } else {\n      return {\n        isError: true,\n        message: 'An unknown error occurred'\n      } as ToolCallError\n    }\n  }\n}\n","import { Ajv } from 'ajv'\nimport { JsonSchema, EquippedTool } from '~/types.js'\nimport {\n  jsonSchemaToZod,\n  JsonSchema as ToZodJsonSchema\n} from '@toolprint/json-schema-to-zod'\n\nimport { v5 as uuidv5 } from 'uuid'\n\nimport { log } from '~/core/log.js'\n\nconst TOOL_SCHEMA_NAMESPACE = uuidv5('onegrep-sdk-tool-schemas', uuidv5.DNS)\nconst INPUT_SCHEMA_NAMESPACE = uuidv5('input', TOOL_SCHEMA_NAMESPACE)\n// const OUTPUT_SCHEMA_NAMESPACE = uuidv5('output', TOOL_SCHEMA_NAMESPACE)\n\nfunction schemaIdForTool(toolId: string, namespace: string) {\n  return uuidv5(toolId, namespace)\n}\n\nfunction toZodAdapter(jsonSchema: JsonSchema): ToZodJsonSchema {\n  // If the jsonSchema is a boolean, return it as-is\n  if (typeof jsonSchema === 'boolean') {\n    return jsonSchema\n  }\n\n  // Remove the \"$defs\" from the jsonSchema (excessive complexity and unused)\n  const { $defs, ...rest } = jsonSchema\n  return {\n    type: 'object',\n    properties: rest.properties,\n    required: rest.required\n  }\n}\n\nfunction schemaIdsForTool(tool: EquippedTool): Record<string, JsonSchema> {\n  const schemas: Record<string, JsonSchema> = {}\n  if (tool.details.inputSchema) {\n    const inputId = schemaIdForTool(tool.details.id, INPUT_SCHEMA_NAMESPACE)\n    schemas[inputId] = tool.details.inputSchema\n  }\n  // if (tool.metadata.outputSchema) {\n  //   const outputId = schemaIdForTool(tool.metadata.id, OUTPUT_SCHEMA_NAMESPACE)\n  //   schemas[outputId] = tool.metadata.outputSchema\n  // }\n  return schemas\n}\n\nclass ToolValidator {\n  private _ajv: Ajv\n  private _toolId: string\n\n  constructor(ajv: Ajv, toolId: string) {\n    this._ajv = ajv\n    this._toolId = toolId\n  }\n\n  validateInputData(data: any) {\n    const validate = this._ajv.getSchema(\n      schemaIdForTool(this._toolId, INPUT_SCHEMA_NAMESPACE)\n    )\n    if (!validate) {\n      throw new Error(`Tool ${this._toolId} has no input schema`)\n    }\n    return validate(data)\n  }\n\n  // validateOutputData(data: any) {\n  //   const validate = this._ajv.getSchema(\n  //     schemaIdForTool(this._toolId, OUTPUT_SCHEMA_NAMESPACE)\n  //   )\n  //   if (!validate) {\n  //     throw new Error(`Tool ${this._toolId} has no output schema`)\n  //   }\n  //   return validate(data)\n  // }\n}\n\n/**\n * Utilities for working with JSON schemas\n *\n * MCP uses JSON Schema to define input for tools and is used as part of the OpenAPI spec,\n * therefore it's a decent choice for schema validation. However, it defines the restrictions\n * on the data, rather than the shape of the data, so it's not as good for code-generation.\n * Ajv also supports [JTD](https://jsontypedef.com/), but it's not as well-supported in\n * other languages.  Ajv supports a JTD distribution for TypeScript, for parsing and validating,\n * but it's not in the main distribution.\n *\n * See Ajv docs for more information on JSON Schema vs. JTD and why there are different exports:\n * https://ajv.js.org/guide/schema-language.html\n */\nclass JsonSchemaUtils {\n  private _ajv: Ajv\n  private _toolValidators: Record<string, ToolValidator>\n\n  constructor(ajv?: Ajv) {\n    this._ajv = ajv ?? new Ajv()\n    this._toolValidators = {}\n  }\n\n  validateJsonSchema(schema: JsonSchema) {\n    return this._ajv.validateSchema(schema)\n  }\n\n  getValidator(schema: JsonSchema) {\n    return this._ajv.compile(schema)\n  }\n\n  registerTool(tool: EquippedTool) {\n    const schemas = schemaIdsForTool(tool)\n    for (const [id, schema] of Object.entries(schemas)) {\n      if (!this.validateJsonSchema(schema)) {\n        log.error(`Tool ${tool.details.id} has invalid JSON schemas`)\n        throw new Error(`Tool ${tool.details.id} has invalid JSON schemas`)\n      }\n      this._ajv.addSchema(schema, id)\n    }\n    this._toolValidators[tool.details.id] = new ToolValidator(\n      this._ajv,\n      tool.details.id\n    )\n    log.info(`Registered tool ${tool.details.id}`)\n  }\n\n  getToolValidator(tool: EquippedTool) {\n    return this._toolValidators[tool.details.id]\n  }\n\n  toZodType(schema: JsonSchema) {\n    return jsonSchemaToZod(toZodAdapter(schema))\n  }\n}\n\nexport const jsonSchemaUtils = new JsonSchemaUtils()\n","import { ClientSession } from '~/providers/mcp/session.js'\nimport { mcpCallTool, parseResultFunc } from '~/providers/mcp/toolcall.js'\nimport { jsonSchemaUtils } from '~/schema.js'\nimport {\n  BasicToolDetails,\n  ToolCallError,\n  ToolCallInput,\n  ToolCallResponse,\n  ToolHandle,\n  ToolServerConnection\n} from '~/types.js'\n\nimport { BlaxelToolServerClient } from '@toolprint/api-client'\n\nimport { Function, getTool as getBlaxelServerTools } from '@blaxel/core'\n\nimport { CallToolResult } from '@modelcontextprotocol/sdk/types.js'\n\nimport { log } from '~/core/log.js'\nimport { getDopplerSecretManager } from '~/secrets/doppler.js'\nimport {\n  getBlaxelFunction,\n  initializeBlaxelApiClientFromSecrets\n} from './api.js'\n\n/**\n * A tool from the Blaxel MCP server.\n *\n * ! Blaxel doesn't export the Tool type, so we're using this simplified version.\n */\ninterface BlaxelTool {\n  name: string\n  description: string\n  call(input: unknown): Promise<unknown>\n}\n\n/**\n * A connection to a Blaxel tool server.\n *\n * Delegates to the Blaxel MCP client cache for ClientSession management rather than ours.\n *\n * TODO: Consider using our own ClientSessionManager for Blaxel MCP clients if they can give us Transport instances.\n */\nexport class BlaxelToolServerConnection implements ToolServerConnection {\n  private toolServerClient: BlaxelToolServerClient\n  private mcpClientSession: ClientSession | undefined\n  private toolsByName: Map<string, BlaxelTool>\n\n  constructor(\n    toolServerClient: BlaxelToolServerClient,\n    mcpClientSession?: ClientSession\n  ) {\n    this.toolServerClient = toolServerClient\n    this.mcpClientSession = mcpClientSession\n    this.toolsByName = new Map()\n  }\n\n  /**\n   * Whether we should use a direct connection to the Blaxel MCP server.\n   *\n   * If we have a direct session, we should use it.\n   * If we don't have a direct session, we should use the Blaxel SDK's MCP client.\n   */\n  private get useDirectConnection(): boolean {\n    return this.mcpClientSession !== undefined\n  }\n\n  async initialize(): Promise<void> {\n    // If we don't have a direct session, we should get register the BlaxelTools\n    if (!this.useDirectConnection) {\n      // ! For now the Blaxel Function name is the same as the integration name.\n      const tools = await getBlaxelServerTools(\n        this.toolServerClient.blaxel_function\n      )\n      this.toolsByName = new Map(tools.map((tool) => [tool.name, tool]))\n      log.debug(`Registered ${this.registeredToolNames.size} blaxel tools`)\n    }\n  }\n\n  private get registeredToolNames(): Set<string> {\n    return new Set(this.toolsByName.keys())\n  }\n\n  async getHandle(toolDetails: BasicToolDetails): Promise<ToolHandle> {\n    if (toolDetails.serverId !== this.toolServerClient.server_id) {\n      throw new Error(\n        `Tool server ID mismatch: ${toolDetails.serverId} !== ${this.toolServerClient.server_id}`\n      )\n    }\n\n    // Only try to validate the tool name if we're using the Blaxel SDK's MCP client.\n    if (!this.useDirectConnection) {\n      if (!this.registeredToolNames.has(toolDetails.name)) {\n        throw new Error(`Tool not found: ${toolDetails.name}`)\n      }\n    }\n\n    // Call using our own MCP client.\n    const callDirect = async (\n      toolCallInput: ToolCallInput\n    ): Promise<ToolCallResponse<any>> => {\n      return await mcpCallTool(\n        this.mcpClientSession!.client,\n        toolDetails,\n        toolCallInput\n      )\n    }\n\n    // Call using our own MCP client.\n    const callSyncDirect = (_: ToolCallInput): ToolCallResponse<any> => {\n      throw new Error('Blaxel tools do not support sync calls')\n    }\n\n    // Call using the Blaxel SDK's MCP client.\n    const call = async (\n      toolCallInput: ToolCallInput\n    ): Promise<ToolCallResponse<any>> => {\n      log.info(\n        `Calling blaxel tool with input: ${JSON.stringify(toolCallInput)}`\n      )\n      try {\n        const validator = jsonSchemaUtils.getValidator(toolDetails.inputSchema)\n        const valid = validator(toolCallInput.args)\n        if (!valid) {\n          throw new Error('Invalid tool input arguments')\n        }\n        const tool = this.toolsByName.get(toolDetails.name)\n        if (!tool) {\n          throw new Error(`Tool not found: ${toolDetails.name}`)\n        }\n\n        const result = (await tool.call(toolCallInput.args)) as CallToolResult // ! Why does blaxel not return a CallToolResult type?\n        return parseResultFunc(result)\n      } catch (error) {\n        if (error instanceof Error) {\n          return {\n            isError: true,\n            message: error.message\n          } as ToolCallError\n        } else {\n          return {\n            isError: true,\n            message: 'An unknown error occurred'\n          } as ToolCallError\n        }\n      }\n    }\n\n    // Call using the Blaxel SDK's MCP client.\n    const callSync = (_: ToolCallInput): ToolCallResponse<any> => {\n      throw new Error('Blaxel tools do not support sync calls')\n\n      // ! TODO: Was having issues with the sync call, so we're not using it yet.\n      // log.info(`Calling blaxel tool with input: ${JSON.stringify(toolCallInput)}`);\n      // const result: CallToolResult = toolServer.call(toolCallInput.name, toolCallInput.args);\n      // return parseResultFunc(result);\n    }\n\n    if (this.useDirectConnection) {\n      return {\n        call: callDirect.bind(this),\n        callSync: callSyncDirect.bind(this)\n      }\n    } else {\n      return {\n        call: call.bind(this),\n        callSync: callSync.bind(this)\n      }\n    }\n  }\n\n  async close(): Promise<void> {\n    log.info(\n      `Closing connection to Blaxel Server ${this.toolServerClient.server_id}`\n    )\n    // Only close if we have a direct MCP session\n    // When using Blaxel SDK's MCP client it manages its own sessions.\n    if (this.mcpClientSession) {\n      await this.mcpClientSession.close()\n    }\n  }\n}\n\nexport async function createBlaxelConnection(\n  client: BlaxelToolServerClient,\n  mcpClientSession?: ClientSession\n): Promise<ToolServerConnection> {\n  // If we've been given a direct session, use it instead of the Blaxel SDK's.\n  if (mcpClientSession) {\n    return new BlaxelToolServerConnection(client, mcpClientSession)\n  }\n\n  // Verify the we can authenticate with Blaxel and that the workspace matches the tool server's workspace.\n  try {\n    await initializeBlaxelApiClientFromSecrets(await getDopplerSecretManager())\n    const blaxelFunction: Function = await getBlaxelFunction(\n      client.blaxel_function\n    )\n\n    if (!blaxelFunction) {\n      throw new Error(\n        `Blaxel function not found using provided authentication: ${client.blaxel_function}`\n      )\n    }\n\n    log.debug(\n      `Blaxel function found for tool server ${client.server_id}: ${client.blaxel_function}`,\n      blaxelFunction\n    )\n  } catch (error) {\n    // ! TODO: Warn for now, but we should probably throw an error here when we can reliably validate the Blaxel function.\n    log.warn(\n      `Unable to verify Blaxel authentication for tool server ${client.server_id}`,\n      error\n    )\n  }\n\n  return new BlaxelToolServerConnection(client)\n}\n","import DopplerSDK from '@dopplerhq/node-sdk'\n\nimport { SecretManager } from './types.js'\n\nimport { InitializeResponse } from '@toolprint/api-client'\n\nimport { OneGrepApiClient } from '~/core/index.js'\nimport { OneGrepApiHighLevelClient } from '~/core/index.js'\nimport { clientFromConfig } from '~/core/index.js'\n\nimport { log } from '~/core/log.js'\n\n/**\n * A secret manager that uses pre-configured Doppler to store and retrieve SDK secrets.\n *\n * Configuration is driven by the OneGrep API based on the currently authenticated user.\n */\nexport class DopplerSecretManager implements SecretManager {\n  private apiClient: OneGrepApiClient\n  private highLevelClient: OneGrepApiHighLevelClient\n\n  private client: DopplerSDK | undefined\n  private serviceToken: string | undefined\n  private project: string | undefined\n  private config: string | undefined\n\n  constructor(apiClient: OneGrepApiClient) {\n    this.apiClient = apiClient\n    this.highLevelClient = new OneGrepApiHighLevelClient(this.apiClient)\n    this.client = undefined\n  }\n\n  async initialize(): Promise<void> {\n    log.debug('Initializing Doppler secret manager...')\n\n    try {\n      const initResponse: InitializeResponse =\n        await this.highLevelClient.initialize()\n\n      // ? If none of these get vended, this will error out.\n      this.serviceToken = initResponse.doppler_service_token as string\n      this.project = initResponse.doppler_project as string\n      this.config = initResponse.doppler_config as string\n\n      log.debug(`Doppler configuration received:`)\n      log.debug(`  Project: ${this.project}`)\n      log.debug(`  Config: ${this.config}`)\n      log.debug(\n        `  Service Token: ${this.serviceToken ? `${this.serviceToken.substring(0, 8)}...` : 'undefined'}`\n      )\n\n      this.client = new DopplerSDK({ accessToken: this.serviceToken })\n\n      log.info('Doppler secret manager initialized successfully')\n    } catch (error) {\n      log.error('Failed to initialize Doppler secret manager:', error)\n      throw error\n    }\n  }\n\n  private isInitialized(): boolean {\n    return this.client !== undefined\n  }\n\n  private async fetchSecrets(): Promise<Map<string, string>> {\n    /** Fetches secrets from Doppler. Does not cache secrets by design so that\n     * any secrets fetched from the Doppler API are immediately available to\n     * the SDK and are not stale.\n     */\n    if (!this.isInitialized()) {\n      log.error(\n        'Doppler Secrets Manager not initialized - cannot fetch secrets'\n      )\n      throw new Error('Doppler Secrets Manager not initialized')\n    }\n\n    log.debug(\n      `Fetching secrets from Doppler project: ${this.project}, config: ${this.config}`\n    )\n\n    try {\n      const secrets = await this.doppler.secrets.list(\n        this.project!,\n        this.config!\n      )\n\n      if (!secrets.secrets) {\n        log.debug('No secrets discovered from doppler secrets manager')\n      } else {\n        const secretCount = Object.keys(secrets.secrets).length\n        log.debug(`Successfully fetched ${secretCount} secrets from Doppler`)\n      }\n\n      return this.parseSecretsResponse(secrets)\n    } catch (error) {\n      log.error(\n        `Failed to fetch secrets from Doppler project: ${this.project}, config: ${this.config}`\n      )\n      log.error('Doppler API error details:', error)\n      throw error\n    }\n  }\n\n  private parseSecretsResponse(secrets: any): Map<string, string> {\n    // Secrets model is a mess from doppler so we'll jsonify it and re-parse it\n    const secretsJson = JSON.stringify(secrets)\n    const secretsParsed = JSON.parse(secretsJson)\n    /**\n     * Structure of secretsParsed is:\n     *\n     * {\n     *    secrets: {\n     *        <secret_name>: { // ! This is the secret name.\n     *            raw: xxx, // ! this is what we want.\n     *            computed: xxx\n     *        }\n     *    }\n     * }\n     *\n     * Parse this into a map of secret name to secret value.\n     */\n\n    const secretsMap = new Map<string, string>()\n    let skippedCount = 0\n\n    for (const secretName in secretsParsed.secrets) {\n      // Doppler secrets.list returns DOPPLER_ prefixed secrets for some reason so we'll skip them.\n      if (secretName.startsWith('DOPPLER_')) {\n        skippedCount++\n        continue\n      }\n\n      secretsMap.set(secretName, secretsParsed.secrets[secretName].raw)\n    }\n\n    log.debug(\n      `Parsed ${secretsMap.size} secrets from Doppler response (skipped ${skippedCount} DOPPLER_ prefixed secrets)`\n    )\n\n    return secretsMap\n  }\n\n  /**\n   * Fetches secrets by name from Doppler.\n   *\n   * If requireAll is true, and any of the requested secrets are not found, an error is thrown.\n   * If requireAll is false (default), and any of the requested secrets are not found, they are logged as warnings.\n   */\n  async getSecrets(\n    secretNames: string[],\n    requireAll: boolean = false\n  ): Promise<Map<string, string>> {\n    log.debug(\n      `Requesting ${secretNames.length} secrets from Doppler: [${secretNames.join(', ')}]`\n    )\n    log.debug(`RequireAll mode: ${requireAll}`)\n\n    const secretsMap = await this.fetchSecrets()\n    const foundSecrets = secretNames.filter((secretName) =>\n      secretsMap.has(secretName)\n    )\n    const missingSecrets = secretNames.filter(\n      (secretName) => !secretsMap.has(secretName)\n    )\n\n    log.debug(\n      `Found ${foundSecrets.length}/${secretNames.length} requested secrets`\n    )\n    if (foundSecrets.length > 0) {\n      log.debug(`Available secrets: [${foundSecrets.join(', ')}]`)\n    }\n\n    if (missingSecrets.length > 0) {\n      log.debug(`Missing secrets: [${missingSecrets.join(', ')}]`)\n      if (requireAll) {\n        log.error(`Missing required secrets: ${missingSecrets.join(', ')}`)\n        throw new Error(\n          `Missing required secrets: ${missingSecrets.join(', ')}`\n        )\n      } else {\n        log.warn(\n          `Missing requested optional secrets: ${missingSecrets.join(', ')}`\n        )\n      }\n    }\n\n    // Return only the requested secrets that were found\n    const requestedSecretsMap = new Map<string, string>()\n    for (const secretName of foundSecrets) {\n      requestedSecretsMap.set(secretName, secretsMap.get(secretName)!)\n    }\n\n    log.debug(`Returning ${requestedSecretsMap.size} secrets`)\n    return requestedSecretsMap\n  }\n\n  async syncProcessEnvironment(): Promise<void> {\n    const secretsMap = await this.fetchSecrets()\n\n    // Forcibly export it to the environment so that a subsequent library can pick it up.\n    for (const [secretName, secretValue] of secretsMap.entries()) {\n      log.debug(`Syncing secret ${secretName} to process environment`)\n      process.env[secretName] = secretValue\n    }\n\n    log.info(`Synced ${secretsMap.size} secrets to process environment`)\n  }\n\n  private get doppler(): DopplerSDK {\n    if (!this.isInitialized()) {\n      throw new Error('Doppler Secrets Manager not initialized')\n    }\n    return this.client!\n  }\n\n  async getSecretNames(): Promise<string[]> {\n    const secretsMap = await this.fetchSecrets()\n    return Array.from(secretsMap.keys())\n  }\n\n  async hasSecret(secretName: string): Promise<boolean> {\n    const secretsMap = await this.fetchSecrets()\n    return secretsMap.has(secretName)\n  }\n\n  async getSecret(secretName: string): Promise<string> {\n    const secretsMap = await this.fetchSecrets()\n    const secretValue = secretsMap.get(secretName)\n    if (!secretValue) {\n      throw new Error(`Secret ${secretName} not found`)\n    }\n    return secretValue\n  }\n}\n\nexport async function createDopplerSecretManager(\n  apiClient: OneGrepApiClient\n): Promise<DopplerSecretManager> {\n  const secretManager = new DopplerSecretManager(apiClient)\n  await secretManager.initialize()\n  return secretManager\n}\n\nexport async function getDopplerSecretManager(): Promise<DopplerSecretManager> {\n  return await createDopplerSecretManager(clientFromConfig())\n}\n","import { Function, getFunction, initialize, settings } from '@blaxel/core'\n\nimport { SecretManager } from '~/secrets/types.js'\n\nexport const initializeBlaxelApiClient: (\n  apikey?: string,\n  workspace?: string,\n  baseUrl?: string\n) => void = (apikey, workspace, baseUrl) => {\n  initialize({\n    proxy: baseUrl ?? settings.baseUrl,\n    apikey: apikey ?? settings.authorization,\n    workspace: workspace ?? settings.workspace\n  })\n}\n\nexport const xBlaxelHeaders: (\n  apiKey: string,\n  workspace: string\n) => Record<string, string> = (apiKey, workspace) => {\n  return {\n    'x-blaxel-authorization': `Bearer ${apiKey}`,\n    'x-blaxel-workspace': workspace\n  }\n}\n\nexport const initializeBlaxelApiClientFromSecrets: (\n  secretsManager: SecretManager\n) => Promise<void> = async (secretsManager) => {\n  const requiredSecretNames = ['BL_API_KEY', 'BL_WORKSPACE']\n  const secrets = await secretsManager.getSecrets(requiredSecretNames, true)\n  initializeBlaxelApiClient(\n    secrets.get('BL_API_KEY')!,\n    secrets.get('BL_WORKSPACE')!\n  )\n}\n\nexport const getBlaxelFunction: (\n  functionName: string\n) => Promise<Function> = async (functionName) => {\n  const response = await getFunction({\n    path: {\n      functionName: functionName\n    }\n  })\n  if (response.error) {\n    throw new Error(`Error getting function ${functionName}: ${response.error}`)\n  }\n  return response.data!\n}\n","import { SmitheryToolServerClient } from '@toolprint/api-client'\nimport {\n  BasicToolDetails,\n  ToolCallInput,\n  ToolCallResponse,\n  ToolHandle,\n  ToolServerConnection\n} from '~/types.js'\n\nimport { mcpCallTool } from '~/providers/mcp/toolcall.js'\nimport { ClientSession } from '~/providers/mcp/session.js'\n\nimport { log } from '~/core/log.js'\n\n/*\n * A connection to a Smithery tool server using HTTP Streaming transport\n */\nexport class SmitheryToolServerConnection implements ToolServerConnection {\n  private toolServerClient: SmitheryToolServerClient\n  private mcpClientSession: ClientSession\n  private toolNames: Set<string>\n\n  constructor(\n    toolServerClient: SmitheryToolServerClient,\n    mcpClientSession: ClientSession\n  ) {\n    this.toolServerClient = toolServerClient\n    this.mcpClientSession = mcpClientSession\n    this.toolNames = new Set<string>()\n  }\n\n  // private getTransport(): Transport {\n  //   // ! TODO: Move to sdk initialization to prevent late binding issues?\n  //   const smitheryApiKey = process.env.SMITHERY_API_KEY\n  //   if (!smitheryApiKey) {\n  //     throw new Error(\n  //       'SMITHERY_API_KEY environment variable is required for Smithery connections'\n  //     )\n  //   }\n\n  //   // Smithery is moving to prioritize http-streaming transport\n  //   const http_connection = this.toolServerClient.connections.find(\n  //     (c) => c.type === 'http'\n  //   )\n  //   if (!http_connection) {\n  //     throw new Error('No HTTP connection found')\n  //   }\n  //   if (!http_connection.deployment_url) {\n  //     throw new Error('No deployment URL found')\n  //   }\n\n  //   // ! TODO: Parse and validate config\n  //   const config = {\n  //     env: {}\n  //   }\n\n  //   // NOTE: do not log the smithery_transport_url as it contains the api key\n  //   const smithery_transport_url = createSmitheryUrl(\n  //     http_connection.deployment_url,\n  //     config,\n  //     smitheryApiKey\n  //   )\n  //   return new StreamableHTTPClientTransport(smithery_transport_url)\n  // }\n\n  async initialize(): Promise<void> {\n    const tools = await (await this.mcpClientSession.client.listTools()).tools\n    log.info(`Found ${tools.length} tools on smithery MCP server`)\n    this.toolNames = new Set(tools.values().map((tool) => tool.name))\n  }\n\n  async getHandle(toolDetails: BasicToolDetails): Promise<ToolHandle> {\n    log.info(`Getting handle for tool: ${toolDetails.name}`, toolDetails)\n    if (toolDetails.serverId !== this.toolServerClient.server_id) {\n      throw new Error(\n        `Tool server ID mismatch: ${toolDetails.serverId} !== ${this.toolServerClient.server_id}`\n      )\n    }\n\n    if (!this.toolNames.has(toolDetails.name)) {\n      throw new Error(`Tool not found: ${toolDetails.name}`)\n    }\n\n    // // TODO: How to determine the output type?\n    // const parseResultFunc = (result: CallToolResult): ToolCallResponse<any> => {\n    //   log.debug('Parsing blaxel tool result')\n    //   const resultContent = result.content as McpCallToolResultContent\n    //   const content = parseMcpContent(resultContent)\n    //   return {\n    //     isError: false,\n    //     content: content,\n    //     mode: 'single',\n    //     toZod: () => {\n    //       return z.object({})\n    //     }\n    //   }\n    // }\n\n    // const call = async (\n    //   toolCallInput: ToolCallInput\n    // ): Promise<ToolCallResponse<any>> => {\n    //   log.info(\n    //     `Calling Smithery tool ${toolDetails.name} with input ${JSON.stringify(toolCallInput)}`\n    //   )\n    //   try {\n    //     const validator = jsonSchemaUtils.getValidator(toolDetails.inputSchema)\n    //     const valid = validator(toolCallInput.args)\n    //     if (!valid) {\n    //       throw new Error('Invalid tool input arguments')\n    //     }\n    //     const callToolRequest: CallToolRequest = {\n    //       method: 'tools/call',\n    //       params: {\n    //         name: toolDetails.name,\n    //         arguments: toolCallInput.args\n    //       }\n    //     }\n    //     const result = await this.mcpClient.callTool(callToolRequest.params)\n    //     if (result.isError) {\n    //       log.error(`Tool call failed result: ${JSON.stringify(result)}`)\n    //       throw new Error('Tool call failed')\n    //     }\n    //     return parseResultFunc(result as CallToolResult)\n    //   } catch (error) {\n    //     if (error instanceof Error) {\n    //       return {\n    //         isError: true,\n    //         message: error.message\n    //       } as ToolCallError\n    //     } else {\n    //       return {\n    //         isError: true,\n    //         message: 'An unknown error occurred'\n    //       } as ToolCallError\n    //     }\n    //   }\n    // }\n\n    const call = async (\n      input: ToolCallInput\n    ): Promise<ToolCallResponse<any>> => {\n      return await mcpCallTool(this.mcpClientSession.client, toolDetails, input)\n    }\n\n    const callSync = (_: ToolCallInput): ToolCallResponse<any> => {\n      throw new Error('Smithery tools do not support sync calls')\n    }\n\n    return {\n      call: (input: ToolCallInput) => call(input),\n      callSync: (input: ToolCallInput) => callSync(input)\n    }\n  }\n\n  async close(): Promise<void> {\n    return Promise.resolve()\n  }\n}\n\nexport async function createSmitheryConnection(\n  client: SmitheryToolServerClient,\n  mcpClientSession: ClientSession\n): Promise<ToolServerConnection> {\n  return new SmitheryToolServerConnection(client, mcpClientSession)\n}\n","import {\n  Client,\n  ClientOptions\n} from '@modelcontextprotocol/sdk/client/index.js'\nimport { Transport } from '@modelcontextprotocol/sdk/shared/transport.js'\nimport { Implementation } from '@modelcontextprotocol/sdk/types.js'\n\nimport { log } from '~/core/log.js'\n\nclass SettableTimer {\n  private timer?: NodeJS.Timeout\n\n  constructor(\n    private readonly timeoutMs: number,\n    private readonly callback: () => Promise<void>\n  ) {\n    this.timer = undefined\n    this.timeoutMs = timeoutMs\n    this.callback = callback\n  }\n\n  isRunning() {\n    return this.timer !== undefined\n  }\n\n  start() {\n    this.timer = setTimeout(() => {\n      this.callback().catch((err: Error) => {\n        // We had an error with the callback, log and move on\n        log.error(err.stack)\n      })\n    }, this.timeoutMs)\n    log.debug(`Started timer for ${this.timeoutMs}ms`)\n  }\n\n  reset() {\n    this.stop()\n    this.start()\n  }\n\n  stop() {\n    if (this.isRunning()) {\n      clearTimeout(this.timer)\n      this.timer = undefined\n      log.debug(`Stopped timer`)\n    }\n  }\n}\n\ntype ClientWithCallbacksPingResult = Awaited<\n  ReturnType<typeof Client.prototype.ping>\n>\ntype ClientWithCallbacksListToolsResult = Awaited<\n  ReturnType<typeof Client.prototype.listTools>\n>\ntype ClientWithCallbacksCallToolResult = Awaited<\n  ReturnType<typeof Client.prototype.callTool>\n>\n\nexport class ClientWithCallbacks extends Client {\n  private callbacks: Map<string, () => Promise<void>>\n  private supportedMethods: Set<string> = new Set([\n    'ping',\n    'listTools',\n    'callTool'\n  ])\n\n  constructor(_clientInfo: Implementation, options?: ClientOptions) {\n    super(_clientInfo, options)\n    this.callbacks = new Map()\n  }\n\n  registerCallback(method: string, callback: () => Promise<void>) {\n    if (!this.supportedMethods.has(method)) {\n      throw new Error(`Method ${method} is not supported`)\n    }\n    this.callbacks.set(method, callback)\n  }\n\n  async ping(options?: any): Promise<ClientWithCallbacksPingResult> {\n    const result = await super.ping(options)\n    const callback = this.callbacks.get('ping')\n    if (callback) {\n      await callback()\n    }\n    return result\n  }\n\n  async listTools(\n    params?: any,\n    options?: any\n  ): Promise<ClientWithCallbacksListToolsResult> {\n    const result = await super.listTools(params, options)\n    const callback = this.callbacks.get('listTools')\n    if (callback) {\n      await callback()\n    }\n    return result\n  }\n\n  async callTool(\n    params: any,\n    options?: any\n  ): Promise<ClientWithCallbacksCallToolResult> {\n    const result = await super.callTool(params, options)\n    const callback = this.callbacks.get('callTool')\n    if (callback) {\n      await callback()\n    }\n    return result\n  }\n}\n\nexport interface ClientSession {\n  get client(): Client\n  get sessionId(): string | undefined\n\n  connect(): Promise<void>\n  close(): Promise<void>\n\n  // ! Optional Callbacks\n  onConnect?(): Promise<void>\n  onClose?(): Promise<void>\n}\n\nexport interface AutoCloseableClientSession extends ClientSession {\n  resetAutoCloseTimer(): void\n}\n\nexport interface RefreshableClientSession extends ClientSession {\n  refresh(): Promise<void>\n}\n\n// TODO: make this configurable?\nfunction newCallbackClient(clientOptions?: ClientOptions) {\n  const _clientInfo: Implementation = {\n    name: 'MultiTransport MCP Client',\n    version: '1.0.0'\n  }\n  const options = clientOptions ?? {\n    capabilities: {\n      tools: {}\n    }\n  }\n  const callbacksClient = new ClientWithCallbacks(_clientInfo, options)\n\n  return callbacksClient\n}\n\nexport class SingleTransportClientSession\n  implements AutoCloseableClientSession\n{\n  private mcpClient: Client\n  private transport: Transport\n  private autoCloseTimer: SettableTimer\n\n  constructor(\n    transport: Transport,\n    clientOptions?: ClientOptions,\n    autoCloseTimeoutMs: number = 5000\n  ) {\n    this.transport = transport\n\n    const callbacksClient = newCallbackClient(clientOptions)\n    callbacksClient.registerCallback('ping', async () => {\n      log.debug('Ping callback')\n    })\n    callbacksClient.registerCallback('listTools', async () => {\n      log.debug('List tools callback')\n      this.resetAutoCloseTimer()\n    })\n    callbacksClient.registerCallback('callTool', async () => {\n      log.debug('Call tool callback')\n      this.resetAutoCloseTimer()\n    })\n\n    this.mcpClient = callbacksClient\n    this.autoCloseTimer = new SettableTimer(\n      autoCloseTimeoutMs,\n      () => this.close() // Close the session if the timer expires\n    )\n  }\n\n  get client() {\n    return this.mcpClient\n  }\n\n  get sessionId() {\n    return this.client.transport?.sessionId\n  }\n\n  async connect(): Promise<void> {\n    try {\n      await this.client.connect(this.transport)\n      await this.onConnect()\n    } catch (error) {\n      log.error(\n        `Failed to connect with transport ${typeof this.transport}:`,\n        error\n      )\n      throw error\n    }\n  }\n\n  onConnect = async () => {\n    log.debug('SingleTransportClientSession onConnect callback')\n  }\n\n  resetAutoCloseTimer() {\n    this.autoCloseTimer.reset()\n  }\n\n  async close(): Promise<void> {\n    this.autoCloseTimer.stop()\n    await this.client.close()\n    return this.onClose()\n  }\n\n  onClose = async () => {\n    log.debug('SingleTransportClientSession onClose callback')\n  }\n}\n\n/**\n * A client session that attempts to connect to one of multiple transports in priority order.\n * Once connected, a timer is started to automatically close the session if no activity is detected.\n */\nexport class MultiTransportClientSession implements AutoCloseableClientSession {\n  private mcpClient: Client\n  private transports: Transport[]\n  private autoCloseTimer: SettableTimer\n\n  constructor(\n    transports: Transport[],\n    clientOptions?: ClientOptions,\n    autoCloseTimeoutMs: number = 5000\n  ) {\n    if (transports.length === 0) {\n      throw new Error('At least one transport is required')\n    }\n\n    const callbacksClient = newCallbackClient(clientOptions)\n    callbacksClient.registerCallback('ping', async () => {\n      log.debug('Ping callback')\n    })\n    callbacksClient.registerCallback('listTools', async () => {\n      log.debug('List tools callback')\n      this.resetAutoCloseTimer()\n    })\n    callbacksClient.registerCallback('callTool', async () => {\n      log.debug('Call tool callback')\n      this.resetAutoCloseTimer()\n    })\n\n    this.mcpClient = callbacksClient\n    this.transports = transports\n    this.autoCloseTimer = new SettableTimer(\n      autoCloseTimeoutMs,\n      () => this.close() // Close the session if the timer expires\n    )\n  }\n\n  get client() {\n    return this.mcpClient\n  }\n\n  get sessionId() {\n    return this.client.transport?.sessionId\n  }\n\n  private async connectTransport(transport: Transport): Promise<boolean> {\n    try {\n      log.debug(`Connecting to transport ${typeof transport}`)\n      await this.client.connect(transport)\n      return true\n    } catch (error) {\n      log.error(`Failed to connect with transport ${typeof transport}:`, error)\n      return false\n    }\n  }\n\n  async connect(): Promise<void> {\n    if (this.client.transport) {\n      log.warn('MCP session already connected')\n      return\n    }\n\n    for (const transport of this.transports) {\n      if (await this.connectTransport(transport)) {\n        await this.onConnect()\n        log.info(\n          `MCP session ${transport.sessionId} connected via ${typeof transport}`\n        )\n        return\n      }\n    }\n    // TODO: callbacks?\n    throw new Error('Failed to connect to any transport')\n  }\n\n  onConnect = async () => {\n    log.debug('MultiTransportClientSession onConnect callback')\n  }\n\n  resetAutoCloseTimer() {\n    this.autoCloseTimer.reset()\n  }\n\n  async close(): Promise<void> {\n    this.autoCloseTimer.stop()\n    await this.client.close()\n    return this.onClose()\n  }\n\n  onClose = async () => {\n    log.debug('MultiTransportClientSession onClose callback')\n  }\n}\n\n/**\n * A client session that attempts to connect to one of multiple transports in priority order.\n * Once connected, a timer is started to automatically close the session if no activity is detected.\n *\n * Additionally, the session can be refreshed by calling the refresh() method.\n * This will close the current session and attempt to reconnect as if the session was just created.\n */\nexport class RefreshableMultiTransportClientSession extends MultiTransportClientSession {\n  private refreshCallback: () => Promise<void>\n\n  constructor(\n    transports: Transport[],\n    clientOptions?: ClientOptions,\n    autoCloseTimeoutMs: number = 5000\n  ) {\n    super(transports, clientOptions, autoCloseTimeoutMs)\n\n    this.refreshCallback = async () => {\n      log.debug('Refreshing MCP session transport')\n      this.close()\n      await this.connect() // Refresh the session by reconnecting\n    }\n  }\n\n  async refresh(): Promise<void> {\n    await this.refreshCallback()\n  }\n}\n\nexport interface ClientSessionFactory<C, V extends ClientSession> {\n  create(config: C): Promise<V>\n}\n\nconst defaultKeyExtractor = (key: any) => {\n  const json = JSON.stringify(key)\n  return crypto.subtle\n    .digest('SHA-256', new TextEncoder().encode(json))\n    .then((hash) => {\n      return Array.from(new Uint8Array(hash))\n        .map((b) => b.toString(16).padStart(2, '0'))\n        .join('')\n    })\n}\nexport class ClientSessionManager<C, V extends ClientSession> {\n  private sessions: Map<string, V>\n  private keyExtractor: (config: C) => Promise<string>\n\n  constructor(\n    private factory: ClientSessionFactory<C, V>,\n    keyExtractor?: (config: C) => Promise<string>\n  ) {\n    this.sessions = new Map()\n    this.keyExtractor = keyExtractor ?? defaultKeyExtractor\n  }\n\n  /**\n   * Create a new session and ensure it is connected.\n   * @param config - The configuration for the factory to create the session.\n   * @returns A promise that resolves to the new connected session.\n   */\n  private async new(config: C): Promise<V> {\n    const key = await this.keyExtractor(config)\n    log.debug(`Creating new session for key: ${key}`)\n\n    const session = await this.factory.create(config)\n    // ! Add the session to the manager when it is connected\n    session.onConnect = async () => {\n      this.sessions.set(key, session)\n      log.debug(\n        `Session ${session.sessionId} for key ${key} connected and added to manager`\n      )\n    }\n    // ! Remove the session from the manager when it is closed\n    session.onClose = async () => {\n      this.sessions.delete(key)\n      log.debug(\n        `Session ${session.sessionId} for key ${key} closed and removed from manager`\n      )\n    }\n\n    log.debug(`Connecting session: ${session.sessionId}`)\n\n    await session.connect()\n    log.debug(`Session ${session.sessionId} for key ${key} connected`)\n\n    return session\n  }\n\n  async getSession(config: C): Promise<V> {\n    const key = await this.keyExtractor(config)\n    if (this.sessions.has(key)) {\n      log.debug(`Using existing session for key: ${key}`)\n      return this.sessions.get(key) as V\n    }\n    return (await this.new(config)) as V\n  }\n\n  async close(): Promise<void> {\n    log.debug('Closing all sessions')\n    for (const session of this.sessions.values()) {\n      await session.close()\n    }\n  }\n}\n","import { env } from 'process'\n\nimport { BlaxelMcpClientTransport, settings } from '@blaxel/core'\nimport { Transport } from '@modelcontextprotocol/sdk/shared/transport.js'\nimport { log } from '~/core/log.js'\nimport { InvalidTransportConfigError } from '~/connection.js'\n\nexport type BlaxelSettings = typeof settings\n\n/**\n * Utility class for getting the Blaxel MCP client transport URLs.\n *\n * Extracted from SDK code here:\n * https://github.com/beamlit/sdk-typescript/blob/9c5a363d705cd1ad49e829a4f02c33a788831294/src/tools/mcpTool.ts#L36\n */\nclass BlaxelUrlUtils {\n  // Name is the name of the Blaxel function\n  constructor(\n    private readonly name: string,\n    private readonly blaxelSettings: BlaxelSettings\n  ) {}\n\n  get fallbackUrl() {\n    if (this.externalUrl != this.url) {\n      return this.externalUrl\n    }\n    return null\n  }\n\n  get externalUrl() {\n    const envVar = this.name.replace(/-/g, '_').toUpperCase()\n    if (env[`BL_FUNCTION_${envVar}_URL`]) {\n      return new URL(env[`BL_FUNCTION_${envVar}_URL`] as string)\n    }\n    return new URL(\n      `${this.blaxelSettings.runUrl}/${this.blaxelSettings.workspace}/functions/${this.name}`\n    )\n  }\n\n  get url() {\n    const envVar = this.name.replace(/-/g, '_').toUpperCase()\n    if (env[`BL_FUNCTION_${envVar}_URL`]) {\n      return new URL(env[`BL_FUNCTION_${envVar}_URL`] as string)\n    }\n    if (env[`BL_FUNCTION_${envVar}_SERVICE_NAME`]) {\n      return new URL(\n        `https://${env[`BL_FUNCTION_${envVar}_SERVICE_NAME`]}.${\n          this.blaxelSettings.runInternalHostname\n        }`\n      )\n    }\n    return this.externalUrl\n  }\n}\n\n/**\n * Creates a Blaxel MCP client transport and fallback transport.\n *\n * Extracted from SDK code here:\n * https://github.com/beamlit/sdk-typescript/blob/9c5a363d705cd1ad49e829a4f02c33a788831294/src/tools/mcpTool.ts#L92\n */\nexport function createBlaxelMcpClientTransports(\n  functionName: string,\n  providedSettings?: BlaxelSettings,\n  headerOverrides?: Record<string, string>\n): Transport[] {\n  const useSettings = providedSettings ?? settings\n\n  const urlUtils = new BlaxelUrlUtils(functionName, useSettings)\n\n  try {\n    const url = urlUtils.url.toString()\n    const fallbackUrl = urlUtils.fallbackUrl?.toString()\n    log.trace('BlaxelMcpClientTransports urls', { url, fallbackUrl })\n\n    const transportHeaders = headerOverrides ?? useSettings.headers\n    log.trace('BlaxelMcpClientTransports headers', transportHeaders)\n\n    const transports = [new BlaxelMcpClientTransport(url, transportHeaders)]\n    if (fallbackUrl) {\n      transports.push(\n        new BlaxelMcpClientTransport(fallbackUrl, transportHeaders)\n      )\n    }\n    return transports\n  } catch {\n    throw new InvalidTransportConfigError(\n      `Failed to create Blaxel MCP client transports for: ${functionName}`\n    )\n  }\n}\n","import {\n  createSmitheryUrl,\n  SmitheryUrlOptions\n} from '@smithery/sdk/shared/config.js'\n\nimport { Transport } from '@modelcontextprotocol/sdk/shared/transport.js'\nimport { StreamableHTTPClientTransport } from '@modelcontextprotocol/sdk/client/streamableHttp.js'\n\nimport { log } from '~/core/index.js'\nimport { SmitheryToolServerClient } from '@toolprint/api-client'\nimport { jsonSchemaUtils } from '~/schema.js'\nimport { InvalidTransportConfigError } from '~/connection.js'\n\nexport function createSmitheryTransports(\n  toolServerClient: SmitheryToolServerClient,\n  smitheryUrlOptions: SmitheryUrlOptions\n): Transport[] {\n  if (!smitheryUrlOptions.apiKey) {\n    throw new InvalidTransportConfigError(\n      'Smithery API key is required for Smithery connections'\n    )\n  }\n\n  // Smithery is moving to prioritize http-streaming transport\n  // TODO: Create transports for all connection types?\n  const http_connection = toolServerClient.connections.find(\n    (c: any) => c.type === 'http'\n  )\n  if (!http_connection) {\n    throw new InvalidTransportConfigError('No HTTP connection found')\n  }\n  if (!http_connection.deployment_url) {\n    throw new InvalidTransportConfigError(\n      'No deployment URL found for HTTP connection'\n    )\n  }\n\n  // Validate the provided config against the config schema (not required if using profile)\n  if (!smitheryUrlOptions.profile && http_connection.config_schema) {\n    log.debug('Validating Smithery launch config')\n    const validator = jsonSchemaUtils.getValidator(\n      http_connection.config_schema\n    )\n    if (!validator(smitheryUrlOptions.config)) {\n      log.warn(\n        `Invalid Smithery launch config for: ${toolServerClient.server_id}`\n      )\n    }\n  }\n\n  // ! NOTE: do not log the `smithery_transport_url` as it contains the api key\n  const smithery_transport_url = createSmitheryUrl(\n    http_connection.deployment_url,\n    smitheryUrlOptions\n  )\n  return [new StreamableHTTPClientTransport(smithery_transport_url)]\n}\n","import { SSEClientTransport } from '@modelcontextprotocol/sdk/client/sse.js'\nimport { Transport } from '@modelcontextprotocol/sdk/shared/transport.js'\nimport { ComposioToolServerClient } from '@toolprint/api-client'\n\nexport function createComposioTransports(\n  toolServerClient: ComposioToolServerClient\n): Transport[] {\n  const mcpServerUrl = new URL(toolServerClient.mcp_url)\n  if (!mcpServerUrl) {\n    throw new Error('Composio MCP server not found')\n  }\n  return [new SSEClientTransport(mcpServerUrl)]\n}\n","import { ComposioToolServerClient } from '@toolprint/api-client'\nimport {\n  BasicToolDetails,\n  ObjectResultContent,\n  ToolCallError,\n  ToolCallInput,\n  ToolCallResponse,\n  ToolHandle,\n  ToolServerConnection\n} from '~/types.js'\n\nimport { ActionExecuteResponse, ComposioToolSet } from 'composio-core'\nimport {\n  ClientSession,\n  getDopplerSecretManager,\n  jsonSchemaUtils,\n  mcpCallTool\n} from '~/index.js'\n\nimport { log } from '~/core/log.js'\nimport { z } from 'zod'\nimport { getComposioToolSet } from './api.js'\n\nexport class ComposioToolServerConnection implements ToolServerConnection {\n  private toolServerClient: ComposioToolServerClient\n  private mcpClientSession: ClientSession | undefined\n  private toolSet: ComposioToolSet | undefined\n  private toolsByName: Map<string, any>\n\n  constructor(\n    toolServerClient: ComposioToolServerClient,\n    mcpClientSession?: ClientSession,\n    apiKey?: string\n  ) {\n    this.toolServerClient = toolServerClient\n    this.mcpClientSession = mcpClientSession\n    this.toolsByName = new Map()\n    if (apiKey) {\n      this.toolSet = getComposioToolSet(apiKey)\n    }\n  }\n\n  private async ensureToolSet(): Promise<ComposioToolSet> {\n    if (!this.toolSet) {\n      const secrets = await getDopplerSecretManager()\n      const apiKey = await secrets.getSecret('COMPOSIO_API_KEY')\n      if (!apiKey) {\n        throw new Error('Composio API key not found')\n      }\n      this.toolSet = getComposioToolSet(apiKey)\n    }\n    return this.toolSet\n  }\n\n  /**\n   * Whether we should use a direct connection to the Blaxel MCP server.\n   *\n   * If we have a direct session, we should use it.\n   * If we don't have a direct session, we should use the Blaxel SDK's MCP client.\n   */\n  private get useDirectConnection(): boolean {\n    return this.mcpClientSession !== undefined\n  }\n\n  async initialize(): Promise<void> {\n    // ! TODO: Initialize with Composio SDK?\n  }\n\n  async getHandle(toolDetails: BasicToolDetails): Promise<ToolHandle> {\n    if (toolDetails.serverId !== this.toolServerClient.server_id) {\n      throw new Error(\n        `Tool server ID mismatch: ${toolDetails.serverId} !== ${this.toolServerClient.server_id}`\n      )\n    }\n\n    // Call using our own MCP client.\n    const callDirect = async (\n      toolCallInput: ToolCallInput\n    ): Promise<ToolCallResponse<any>> => {\n      return await mcpCallTool(\n        this.mcpClientSession!.client,\n        toolDetails,\n        toolCallInput\n      )\n    }\n\n    // Call using our own MCP client.\n    const callSyncDirect = (_: ToolCallInput): ToolCallResponse<any> => {\n      throw new Error('Composio tools do not support sync calls')\n    }\n\n    // Call using the Composio SDK's MCP client.\n    const call = async (\n      toolCallInput: ToolCallInput\n    ): Promise<ToolCallResponse<any>> => {\n      log.info(\n        `Calling composio tool with input: ${JSON.stringify(toolCallInput)}`\n      )\n      try {\n        const validator = jsonSchemaUtils.getValidator(toolDetails.inputSchema)\n        const valid = validator(toolCallInput.args)\n        if (!valid) {\n          throw new Error('Invalid tool input arguments')\n        }\n        const tool = this.toolsByName.get(toolDetails.name)\n        if (!tool) {\n          throw new Error(`Tool not found: ${toolDetails.name}`)\n        }\n\n        const toolSet = await this.ensureToolSet()\n        const actionExecuteResponse: ActionExecuteResponse =\n          await toolSet.executeAction({\n            action: toolDetails.name,\n            params: toolCallInput.args\n          })\n        if (actionExecuteResponse.error) {\n          throw new Error(actionExecuteResponse.error)\n        }\n        const resultContent: ObjectResultContent = {\n          type: 'object',\n          data: actionExecuteResponse.data\n        }\n        return {\n          isError: false,\n          content: [resultContent],\n          mode: 'single',\n          toZod: () =>\n            z.object({\n              result: z.any()\n            })\n        }\n      } catch (error) {\n        if (error instanceof Error) {\n          return {\n            isError: true,\n            message: error.message\n          } as ToolCallError\n        } else {\n          return {\n            isError: true,\n            message: 'An unknown error occurred'\n          } as ToolCallError\n        }\n      }\n    }\n\n    // Call using the Composio SDK's MCP client.\n    const callSync = (_: ToolCallInput): ToolCallResponse<any> => {\n      // ! TODO: Was having issues with the sync call, so we're not using it yet.\n      throw new Error('Composio tools do not support sync calls')\n    }\n\n    if (this.useDirectConnection) {\n      return {\n        call: callDirect.bind(this),\n        callSync: callSyncDirect.bind(this)\n      }\n    } else {\n      return {\n        call: call.bind(this),\n        callSync: callSync.bind(this)\n      }\n    }\n  }\n\n  async close(): Promise<void> {\n    log.info(\n      `Closing connection to Composio Server ${this.toolServerClient.server_id}`\n    )\n    // Only close if we have a direct MCP session\n    // When using Composio SDK's MCP client it manages its own sessions.\n    if (this.mcpClientSession) {\n      await this.mcpClientSession.close()\n    }\n  }\n}\n\nexport interface ComposioConnectionOptions {\n  apiKey: string\n  baseUrl: string\n}\n\nexport async function createComposioConnection(\n  client: ComposioToolServerClient,\n  mcpClientSession?: ClientSession\n): Promise<ToolServerConnection> {\n  // If we've been given a direct session, use it instead of the Composio SDK's.\n  if (mcpClientSession) {\n    return new ComposioToolServerConnection(client, mcpClientSession)\n  }\n\n  // Verify we can authenticate with Composio and get the API key\n  try {\n    const secrets = await getDopplerSecretManager()\n    const apiKey = await secrets.getSecret('COMPOSIO_API_KEY')\n    if (!apiKey) {\n      throw new Error('Composio API key not found')\n    }\n    return new ComposioToolServerConnection(client, undefined, apiKey)\n  } catch (error) {\n    // ! TODO: Warn for now, but we should probably throw an error here when we can reliably validate the Composio function.\n    log.warn(\n      `Unable to verify Composio authentication for tool server ${client.server_id}`,\n      error\n    )\n    return new ComposioToolServerConnection(client)\n  }\n}\n","import { Composio, ComposioToolSet } from 'composio-core'\n\nlet _composio: Composio | undefined\nlet _composioToolSet: ComposioToolSet | undefined\n\nexport function getComposio(apiKey: string): Composio {\n  if (!_composio) {\n    _composio = new Composio({\n      apiKey,\n      baseUrl: 'https://backend.composio.dev',\n      runtime: 'nodejs',\n      allowTracing: true\n    })\n  }\n  return _composio\n}\n\nexport function getComposioToolSet(apiKey: string): ComposioToolSet {\n  if (!_composioToolSet) {\n    _composioToolSet = new ComposioToolSet({\n      apiKey,\n      baseUrl: 'https://backend.composio.dev',\n      runtime: 'nodejs',\n      allowTracing: true\n    })\n  }\n  return _composioToolSet\n}\n","import { BaseToolPrinter } from './types.js'\nimport { OneGrepApiHighLevelClient } from './core/index.js'\nimport YAML from 'yaml'\nimport {\n  RegisteredToolprintReadable,\n  ToolprintInput\n} from '@toolprint/api-client'\n\nclass ToolprintValidationError extends Error {\n  constructor(message: string, cause?: unknown) {\n    super(message, { cause })\n    this.name = 'ToolprintValidationError'\n  }\n}\n\nclass ToolprintRegistrationError extends Error {\n  constructor(message: string, cause?: unknown) {\n    super(message, { cause })\n    this.name = 'ToolprintRegistrationError'\n  }\n}\n\nexport class ToolPrinter implements BaseToolPrinter {\n  constructor(private readonly client: OneGrepApiHighLevelClient) {}\n\n  async validate(\n    content: string,\n    format: 'json' | 'yaml'\n  ): Promise<ToolprintInput> {\n    // ! TODO: validation in API should return Toolprint object parsed and validated\n    if (format === 'json') {\n      const parsed = JSON.parse(content)\n      const isValid = await this.client.validateToolprintInJson(\n        JSON.stringify(parsed)\n      )\n      if (!isValid) {\n        throw new ToolprintValidationError(\n          'Invalid Toolprint',\n          new Error('Validation failures: ' + JSON.stringify(isValid)) // TODO: return validation errors from API\n        )\n      }\n      return parsed as ToolprintInput\n    } else if (format === 'yaml') {\n      const parsed = YAML.parse(content)\n      const isValid = await this.client.validateToolprintInYaml(\n        YAML.stringify(parsed)\n      )\n      if (!isValid) {\n        throw new ToolprintValidationError(\n          'Invalid Toolprint',\n          new Error('Validation failures: ' + JSON.stringify(isValid)) // TODO: return validation errors from API\n        )\n      }\n      return parsed as ToolprintInput\n    } else {\n      throw new ToolprintValidationError('Invalid format: ' + format)\n    }\n  }\n\n  async register(\n    toolprint: ToolprintInput\n  ): Promise<RegisteredToolprintReadable> {\n    try {\n      return await this.client.newToolprint(toolprint)\n    } catch (error) {\n      throw new ToolprintRegistrationError(\n        'Failed to register Toolprint',\n        error\n      )\n    }\n  }\n}\n","import {\n  Tool,\n  ToolProperties,\n  ToolResource,\n  SearchResponseScoredItemTool,\n  InitializeResponse,\n  Prompt,\n  ScoredItemTool\n} from '@toolprint/api-client'\n\nimport { ToolServerClient } from '~/core/api/types.js'\n\nimport {\n  ScoredResult,\n  ToolCache,\n  ToolId,\n  ToolServerId,\n  JsonSchema,\n  FilterOptions,\n  ToolDetails,\n  BasicToolDetails,\n  ToolHandle,\n  ConnectionManager,\n  ToolCallInput,\n  ToolCallResponse,\n  ToolCallError,\n  Recommendation\n} from './types.js'\n\nimport { OneGrepApiClient } from '~/core/index.js'\nimport { OneGrepApiHighLevelClient } from '~/core/index.js'\n\nimport { Keyv } from 'keyv'\nimport { Cache, createCache } from 'cache-manager'\nimport { ToolServerConnectionManager } from '~/connection.js'\n\nimport { OneGrepApiError } from './core/api/utils.js'\n\nimport { log } from '~/core/log.js'\n\n/**\n * A wrapper around a ToolHandle that provides a safe way to call the tool.\n * If the ToolHandle call fails, it will return a ToolCallError instead of\n * throwing an unhandled error.\n */\nclass SafeToolHandle implements ToolHandle {\n  private unsafeCall: (input: ToolCallInput) => Promise<ToolCallResponse<any>>\n  private unsafeCallSync: (input: ToolCallInput) => ToolCallResponse<any>\n\n  constructor(readonly toolHandle: ToolHandle) {\n    this.unsafeCall = toolHandle.call\n    this.unsafeCallSync = toolHandle.callSync\n  }\n\n  private async safeCall(input: ToolCallInput): Promise<ToolCallResponse<any>> {\n    try {\n      return await this.unsafeCall(input)\n    } catch (error) {\n      log.error(`Broken ToolHandle: ${error}`)\n      return {\n        isError: true,\n        message: `Async ToolHandle call unexpectedly failed: ${error}`\n      } as ToolCallError\n    }\n  }\n\n  private safeCallSync(input: ToolCallInput): ToolCallResponse<any> {\n    try {\n      return this.unsafeCallSync(input)\n    } catch (error) {\n      log.error(`Broken ToolHandle: ${error}`)\n      return {\n        isError: true,\n        message: `Sync ToolHandle call unexpectedly failed: ${error}`\n      } as ToolCallError\n    }\n  }\n\n  call(input: ToolCallInput): Promise<ToolCallResponse<any>> {\n    return this.safeCall(input)\n  }\n\n  callSync(input: ToolCallInput): ToolCallResponse<any> {\n    return this.safeCallSync(input)\n  }\n}\n\nclass ToolCacheError extends Error {\n  constructor(message: string, cause?: Error) {\n    super(message, { cause })\n    this.name = 'ToolCacheError'\n  }\n}\n\ntype MethodDecorator = (\n  target: any,\n  propertyKey: string | symbol,\n  descriptor: PropertyDescriptor\n) => PropertyDescriptor | void\n\nfunction handleErrors(): MethodDecorator {\n  return function (\n    _: any,\n    propertyKey: string | symbol,\n    descriptor: PropertyDescriptor\n  ): PropertyDescriptor {\n    const originalMethod = descriptor.value\n    descriptor.value = async function (...args: any[]) {\n      try {\n        return await originalMethod.apply(this, args)\n      } catch (error) {\n        if (error instanceof Error) {\n          if (error instanceof OneGrepApiError) {\n            log.error(\n              `Issue with OneGrep API in ${propertyKey.toString()}: ${error.message}`\n            )\n          }\n          throw new ToolCacheError(\n            `Error in ${propertyKey.toString()}: ${error.message}`,\n            error\n          )\n        }\n        throw error\n      }\n    }\n    return descriptor\n  }\n}\n\nexport class UniversalToolCache implements ToolCache {\n  private highLevelClient: OneGrepApiHighLevelClient\n\n  private connectionManager: ConnectionManager\n\n  private serverNameCache: Cache\n  private serverClientCache: Cache\n  private toolBasicDetailsCache: Cache\n\n  constructor(\n    apiClient: OneGrepApiClient,\n    connectionManager: ConnectionManager\n  ) {\n    this.highLevelClient = new OneGrepApiHighLevelClient(apiClient)\n\n    this.connectionManager = connectionManager\n\n    // Configure caches with TTL and max size\n    this.serverNameCache = createCache({\n      cacheId: 'server-name-cache',\n      stores: [\n        new Keyv({ ttl: 1000 * 60 * 60 * 24 }) // 24 hours\n      ]\n    })\n\n    this.serverClientCache = createCache({\n      cacheId: 'server-client-cache',\n      stores: [\n        new Keyv({ ttl: 1000 * 60 * 60 * 24 }) // 24 hours\n      ]\n    })\n\n    this.toolBasicDetailsCache = createCache({\n      cacheId: 'tool-basic-details-cache',\n      stores: [\n        new Keyv({ ttl: 1000 * 60 * 60 * 24 }) // 1 hours\n      ]\n    })\n  }\n\n  /**\n   * Get the name of a tool server (wrapped in TTL cache)\n   * @param serverId - The id of the tool server.\n   * @returns The name of the tool server.\n   */\n  private async getServerName(serverId: ToolServerId): Promise<string> {\n    return await this.serverNameCache.wrap(serverId, async () => {\n      return await this.highLevelClient.getServerName(serverId)\n    })\n  }\n\n  /**\n   * Get the client for a tool server (wrapped in TTL cache)\n   * @param serverId - The id of the tool server.\n   * @returns The client for the tool server.\n   */\n  private async getServerClient(\n    serverId: ToolServerId\n  ): Promise<ToolServerClient> {\n    return await this.serverClientCache.wrap(serverId, async () => {\n      return await this.highLevelClient.getServerClient(serverId)\n    })\n  }\n\n  private async convertToolToBasicDetails(\n    tool: Tool\n  ): Promise<BasicToolDetails> {\n    const serverName = await this.getServerName(tool.server_id)\n    if (!serverName) {\n      log.warn(`Server name not found for tool ${tool.id}`)\n      throw new Error(`Server name not found for tool ${tool.id}`)\n    }\n\n    return {\n      id: tool.id,\n      name: tool.name,\n      description: tool.description as string,\n      serverId: tool.server_id,\n      integrationName: serverName as string,\n      iconUrl: tool.icon_url as URL | undefined,\n      inputSchema: tool.input_schema as JsonSchema\n    }\n  }\n\n  /**\n   * Get the basic details of a tool (wrapped in TTL cache)\n   * @param toolId - The id of the tool.\n   * @returns The basic details of the tool.\n   */\n  private async getToolBasicDetails(toolId: ToolId): Promise<BasicToolDetails> {\n    return await this.toolBasicDetailsCache.wrap(toolId, async () => {\n      const tool: Tool = await this.highLevelClient.getTool(toolId)\n      return await this.convertToolToBasicDetails(tool)\n    })\n  }\n\n  /**\n   * Invalidate the basic details cache for a tool\n   * @param toolId - The id of the tool.\n   */\n  private async invalidateToolBasicDetailsCache(toolId: ToolId): Promise<void> {\n    await this.toolBasicDetailsCache.del(toolId)\n  }\n\n  private createToolDetails(\n    basicToolDetails: BasicToolDetails,\n    toolResource: ToolResource,\n    serverClient: ToolServerClient\n  ): ToolDetails {\n    const details: ToolDetails = {\n      ...basicToolDetails,\n      properties: toolResource.properties as ToolProperties,\n      policy: toolResource.policy,\n      equip: async () => {\n        log.trace(`Converting to equipped tool`)\n        try {\n          const connection = await this.connectionManager.connect(serverClient)\n          log.info(\n            `Got connection to tool server ${toolResource.tool.server_id}`\n          )\n\n          const toolHandle = await connection.getHandle(basicToolDetails)\n          log.info(`Got tool handle for ${toolResource.tool.id}`)\n\n          return {\n            details,\n            handle: new SafeToolHandle(toolHandle)\n          }\n        } catch (error) {\n          log.error(`Error grabbing tool handle: ${error}`)\n          throw error\n        }\n      }\n    }\n    return details\n  }\n\n  private async getToolDetailsBatch(\n    toolIds: ToolId[]\n  ): Promise<Map<ToolId, ToolDetails>> {\n    const toolResources =\n      await this.highLevelClient.getToolResourcesBatch(toolIds)\n\n    const toolDetails: Map<ToolId, ToolDetails> = new Map()\n    for (const toolId of toolIds) {\n      const toolResource = toolResources.get(toolId)\n      if (toolResource) {\n        const basicToolDetails = await this.getToolBasicDetails(toolId)\n        const serverClient = await this.getServerClient(\n          toolResource.tool.server_id\n        )\n        const details = this.createToolDetails(\n          basicToolDetails,\n          toolResource,\n          serverClient\n        )\n        toolDetails.set(toolId, details)\n      }\n    }\n\n    return toolDetails\n  }\n\n  /**\n   * Get the details of a tool\n   * @param toolId - The id of the tool.\n   * @returns The details of the tool.\n   */\n  private async getToolDetails(toolId: ToolId): Promise<ToolDetails> {\n    const basicToolDetails: BasicToolDetails =\n      await this.getToolBasicDetails(toolId)\n\n    log.trace(`Got tool basic details`, basicToolDetails)\n\n    // Getting the ToolResource will get the Properties and Policy for the tool\n    const resource: ToolResource =\n      await this.highLevelClient.getToolResource(toolId)\n\n    log.trace(`Got tool resource`, resource)\n\n    const serverClient: ToolServerClient = await this.getServerClient(\n      resource.tool.server_id\n    )\n\n    return this.createToolDetails(basicToolDetails, resource, serverClient)\n  }\n\n  @handleErrors()\n  async listTools(): Promise<Map<ToolId, BasicToolDetails>> {\n    const tools: Tool[] = await this.highLevelClient.listTools()\n    log.debug(`Found ${tools.length} tools`)\n\n    const basicTools: Map<ToolId, BasicToolDetails> = new Map()\n\n    for (const t of tools) {\n      try {\n        const basicToolDetails = await this.getToolBasicDetails(t.id)\n        basicTools.set(t.id, basicToolDetails)\n      } catch (e) {\n        log.warn(`Error fetching tool details for ${t.id}`, e)\n        continue\n      }\n    }\n\n    return basicTools\n  }\n\n  @handleErrors()\n  async listIntegrations(): Promise<string[]> {\n    // TODO: Replace with endpoint which lists integration names\n    return await this.highLevelClient.getAllServerNames()\n  }\n\n  @handleErrors()\n  async clearServerClientCache(): Promise<boolean> {\n    /**\n     * Clear the server client cache.\n     * Returns true if successful, false otherwise.\n     */\n    this.serverClientCache.clear()\n    log.info('Cleared server client cache')\n    return true\n  }\n\n  @handleErrors()\n  async filterTools(\n    filterOptions?: FilterOptions\n  ): Promise<Map<ToolId, ToolDetails>> {\n    log.info(`Filtering tools with options: ${JSON.stringify(filterOptions)}`)\n    if (!filterOptions) {\n      throw new Error(\n        'No filter options provided. If you want to list tools, use the `.listTools()` method.'\n      )\n    }\n\n    // ! Does not support the full filter options yet\n    if (filterOptions.serverIds) {\n      throw new Error('Filtering by server ids is not yet supported.')\n    }\n    if (filterOptions.tools) {\n      throw new Error('Filtering by tools is not yet supported.')\n    }\n\n    // Filter the tools based on the integration names\n    const allTools: Tool[] = await this.highLevelClient.listTools()\n    const filteredTools: Tool[] = await Promise.all(\n      allTools.map(async (tool) => {\n        if (filterOptions.integrationNames) {\n          const serverName = await this.getServerName(tool.server_id)\n          return filterOptions.integrationNames.includes(serverName)\n            ? tool\n            : null\n        }\n        return tool\n      })\n    ).then((tools) =>\n      tools.filter((tool: Tool | null): tool is Tool => tool !== null)\n    )\n\n    // Get the details for the filtered tool using the basic details cache\n    const result: Map<ToolId, ToolDetails> = new Map()\n    for (const tool of filteredTools) {\n      const toolDetails = await this.getToolDetails(tool.id)\n      result.set(toolDetails.id, toolDetails)\n    }\n\n    return result\n  }\n\n  @handleErrors()\n  async get(toolId: ToolId): Promise<ToolDetails> {\n    return await this.getToolDetails(toolId)\n  }\n\n  @handleErrors()\n  async getMultiple(toolIds: ToolId[]): Promise<Map<ToolId, ToolDetails>> {\n    return await this.getToolDetailsBatch(toolIds)\n  }\n\n  /**\n   * Finds the best toolprint for a given goal (if one exists), and returns a\n   * simplified Recommendation object. If no toolprint is found for the goal,\n   * it will perform a traditional search and return a list of tools but no\n   * prompts in the recommendation.\n   *\n   * @param goal - The goal to get a recommendation for\n   * @returns A recommendation for the goal\n   */\n  @handleErrors()\n  async recommend(goal: string): Promise<Recommendation> {\n    try {\n      const recommendedToolprint =\n        await this.highLevelClient.recommendToolprint(goal)\n      const tools: Tool[] = recommendedToolprint.toolprint.tools\n      const toolDetails: ToolDetails[] = await Promise.all(\n        tools.map(async (tool) => {\n          return await this.getToolDetails(tool.id)\n        })\n      )\n      const messages: Prompt[] = recommendedToolprint.prompts\n\n      return {\n        goal,\n        tools: toolDetails,\n        messages\n      }\n    } catch {\n      log.debug(\n        `No toolprint found for goal: ${goal}, performing traditional search`\n      )\n      // If no toolprint is found, perform a traditional search\n      const searchResult = await this.search(goal)\n      const tools = searchResult.map((result) => result.result)\n      return {\n        goal,\n        tools,\n        messages: []\n      }\n    }\n  }\n\n  @handleErrors()\n  async search(query: string): Promise<ScoredResult<ToolDetails>[]> {\n    log.info(`Searching for tools with query: ${query}`)\n\n    const response: SearchResponseScoredItemTool =\n      await this.highLevelClient.searchTools(query)\n\n    const results: ScoredResult<ToolDetails>[] = []\n\n    const toolIds = response.results.map(\n      (result: ScoredItemTool) => result.item.id\n    )\n    const toolDetailsMap = await this.getMultiple(toolIds)\n\n    for (const result of response.results) {\n      results.push({\n        result: toolDetailsMap.get(result.item.id)!,\n        score: result.score\n      })\n    }\n\n    return results\n  }\n\n  @handleErrors()\n  async refresh(): Promise<boolean> {\n    try {\n      log.info('Refreshing toolcache')\n\n      const initResponse: InitializeResponse =\n        await this.highLevelClient.initialize()\n      log.info(\n        `Refresh item counts: servers: ${initResponse.servers.length}, tools: ${initResponse.tools.length}`\n      )\n\n      for (const server of initResponse.servers) {\n        this.serverNameCache.set(server.id, server.name)\n      }\n      log.debug(`Set ${initResponse.servers.length} server names in cache`)\n\n      for (const client of initResponse.clients) {\n        this.serverClientCache.set(client.server_id, client)\n      }\n      log.debug(`Set ${initResponse.clients.length} server clients in cache`)\n\n      for (const tool of initResponse.tools) {\n        this.toolBasicDetailsCache.set(\n          tool.id,\n          await this.convertToolToBasicDetails(tool)\n        )\n      }\n      log.debug(`Set ${initResponse.tools.length} tool basic details in cache`)\n\n      return true\n    } catch (error) {\n      if (error instanceof OneGrepApiError) {\n        log.error(\n          `Issue with OneGrep API when refreshing toolcache: ${error.message}`\n        )\n        return false\n      }\n      throw error\n    }\n  }\n\n  @handleErrors()\n  async refreshTool(toolId: ToolId): Promise<ToolDetails> {\n    await this.invalidateToolBasicDetailsCache(toolId)\n\n    return await this.get(toolId)\n  }\n\n  @handleErrors()\n  async cleanup(): Promise<void> {\n    await this.connectionManager.close()\n  }\n}\n\n/**\n * Create a ToolCache with the specified or default connection manager.\n * @param apiClient - The OneGrepApiClient to use.\n * @param connectionManager - The ConnectionManager to use.\n * @returns A ToolCache.\n */\nexport async function createToolCache(\n  apiClient: OneGrepApiClient,\n  connectionManager?: ConnectionManager\n) {\n  return new UniversalToolCache(\n    apiClient,\n    connectionManager ?? new ToolServerConnectionManager()\n  )\n}\n","import {\n  clientFromConfig,\n  OneGrepApiClient,\n  OneGrepApiHighLevelClient,\n  ToolServerClient\n} from '~/core/index.js'\nimport {\n  BaseToolbox,\n  ToolCache,\n  FilterOptions,\n  ToolId,\n  ScoredResult,\n  ToolDetails,\n  BasicToolDetails,\n  Recommendation\n} from '~/types.js'\nimport { createDopplerSecretManager } from './secrets/doppler.js'\n\nimport { createToolCache } from '~/toolcache.js'\n\nimport {\n  apiKeyBlaxelClientSessionMaker,\n  apiKeyComposioClientSessionMaker,\n  apiKeySmitheryClientSessionMaker,\n  defaultToolServerSessionFactory\n} from './connection.js'\nimport { ClientSessionMaker } from './connection.js'\nimport { SecretManager } from './secrets/index.js'\n\nimport { log } from '~/core/log.js'\n\nexport class Toolbox implements BaseToolbox<ToolDetails, Recommendation> {\n  private toolCache: ToolCache\n  private highLevelClient: OneGrepApiHighLevelClient\n\n  constructor(apiClient: OneGrepApiClient, toolCache: ToolCache) {\n    this.toolCache = toolCache\n    this.highLevelClient = new OneGrepApiHighLevelClient(apiClient)\n  }\n\n  get api(): OneGrepApiHighLevelClient {\n    return this.highLevelClient\n  }\n\n  async listTools(): Promise<Map<ToolId, BasicToolDetails>> {\n    return await this.toolCache.listTools()\n  }\n\n  async listIntegrations(): Promise<string[]> {\n    return await this.toolCache.listIntegrations()\n  }\n\n  async filterTools(\n    options?: FilterOptions\n  ): Promise<Map<ToolId, ToolDetails>> {\n    return await this.toolCache.filterTools(options)\n  }\n\n  async get(toolId: ToolId): Promise<ToolDetails> {\n    return await this.toolCache.get(toolId)\n  }\n\n  async getMultiple(toolIds: ToolId[]): Promise<Map<ToolId, ToolDetails>> {\n    return await this.toolCache.getMultiple(toolIds)\n  }\n\n  async recommend(goal: string): Promise<Recommendation> {\n    return await this.toolCache.recommend(goal)\n  }\n\n  async search(query: string): Promise<Array<ScoredResult<ToolDetails>>> {\n    return await this.toolCache.search(query)\n  }\n\n  async refresh(): Promise<boolean> {\n    return await this.toolCache.refresh()\n  }\n\n  async close(): Promise<void> {\n    await this.toolCache.cleanup()\n  }\n}\n\n/**\n * Registers the session makers for the given secret manager based on secrets available.\n */\nconst registerSessionMakers = async (secretManager: SecretManager) => {\n  const requestedSecretNames = [\n    'BL_API_KEY',\n    'BL_WORKSPACE',\n    'SMITHERY_API_KEY',\n    'SMITHERY_PROFILE_ID',\n    'COMPOSIO_API_KEY'\n  ]\n  // Get requested secrets (do not throw an error if any are missing)\n  const secrets = await secretManager.getSecrets(requestedSecretNames, false)\n\n  // Blaxel provider requires an API key and workspace\n  if (secrets.has('BL_API_KEY') && secrets.has('BL_WORKSPACE')) {\n    const blaxelSessionMaker = apiKeyBlaxelClientSessionMaker(\n      secrets.get('BL_API_KEY')!,\n      secrets.get('BL_WORKSPACE')!\n    )\n\n    // Register the new BlaxelSessionMaker\n    defaultToolServerSessionFactory.register(\n      'blaxel',\n      blaxelSessionMaker as ClientSessionMaker<ToolServerClient>\n    )\n    log.info('Registered BlaxelSessionMaker')\n  }\n\n  // Smithery provider requires an API key and profile id\n  if (secrets.has('SMITHERY_API_KEY') && secrets.has('SMITHERY_PROFILE_ID')) {\n    const smitherySessionMaker = apiKeySmitheryClientSessionMaker(\n      secretManager,\n      secrets.get('SMITHERY_API_KEY')!,\n      secrets.get('SMITHERY_PROFILE_ID')!\n    )\n    defaultToolServerSessionFactory.register(\n      'smithery',\n      smitherySessionMaker as ClientSessionMaker<ToolServerClient>\n    )\n    log.info('Registered SmitherySessionMaker')\n  }\n\n  // Composio provider requires an API key\n  if (secrets.has('COMPOSIO_API_KEY')) {\n    const composioSessionMaker = apiKeyComposioClientSessionMaker(\n      secrets.get('COMPOSIO_API_KEY')!\n    )\n    defaultToolServerSessionFactory.register(\n      'composio',\n      composioSessionMaker as ClientSessionMaker<ToolServerClient>\n    )\n    log.info('Registered ComposioSessionMaker')\n  }\n\n  // ! As a hack, we need to sync the process environment to get environment variables for authentication\n  // TODO: Remove this once we have more reliable ways to create API clients\n  // For some reason, even when we provide all the Blaxel config directly above, something is still using the env vars\n  // eslint-disable-next-line no-constant-condition\n  if (process.env.ONEGREP_SDK_INJECT_SECRETS_TO_ENV || true) {\n    await secretManager.syncProcessEnvironment()\n  }\n}\n\nexport async function createToolbox(\n  apiClient: OneGrepApiClient,\n  providedToolCache?: ToolCache,\n  providedSecretManager?: SecretManager\n) {\n  // Make sure the secret manager is initialized\n  const secretManager =\n    providedSecretManager ?? (await createDopplerSecretManager(apiClient))\n  await secretManager.initialize()\n\n  // Register available session makers\n  await registerSessionMakers(secretManager)\n\n  // Create the tool cache if not provided\n  const toolCache: ToolCache =\n    providedToolCache ?? (await createToolCache(apiClient))\n\n  // Make sure the tool cache attempts to refresh on bootstrap (to warm cache)\n  const ok = await toolCache.refresh()\n\n  if (!ok) {\n    log.error('Toolcache initialization failed. Tools will not be available.')\n  }\n\n  return new Toolbox(apiClient, toolCache)\n}\n\nexport async function getToolbox(): Promise<Toolbox> {\n  return await createToolbox(clientFromConfig())\n}\n","import {\n  FetchLikeInit,\n  EventSourceInit,\n  FetchLike,\n  FetchLikeResponse\n} from 'eventsource'\nimport { SSEClientTransport } from '@modelcontextprotocol/sdk/client/sse.js'\n\nimport { log } from '~/core/log.js'\n\n// Get an SSE transport for the OneGrep Gateway\nexport const createGatewaySSETransport = (\n  url: URL,\n  additionalHeaders?: Record<string, string>,\n  apiKey?: string\n) => {\n  const headers = additionalHeaders || {}\n  if (apiKey) {\n    log.debug(`Adding api key to headers`)\n    headers['X-ONEGREP-API-KEY'] = apiKey\n  }\n\n  log.debug(`SSE headers: ${Object.keys(headers).join(', ')}`)\n\n  const fetchLikeWithHeaders: FetchLike = async (\n    url: string | URL,\n    init?: FetchLikeInit\n  ) => {\n    const response = await fetch(url, {\n      ...init,\n      headers: {\n        ...init?.headers,\n        ...headers\n      }\n    })\n    return response as FetchLikeResponse\n  }\n\n  const eventSourceInit: EventSourceInit = {\n    withCredentials: false,\n    fetch: fetchLikeWithHeaders\n  }\n  const requestInit = {\n    headers: {\n      ...headers\n    }\n  }\n  const sse_opts = {\n    eventSourceInit: eventSourceInit,\n    requestInit: requestInit\n  }\n\n  const transport = new SSEClientTransport(url, sse_opts)\n\n  transport.onclose = () => {\n    log.debug(`SSE transport closed`)\n  }\n\n  transport.onerror = (error) => {\n    log.error(`SSE transport error: ${error}`)\n  }\n\n  transport.onmessage = (_message) => {\n    log.debug(`SSE transport message`)\n  }\n\n  return transport\n}\n","import { z } from 'zod'\n\nconst McpToolCallInput = z.object({\n  toolName: z.string(),\n  toolArgs: z.record(z.string(), z.any())\n})\n\nexport type McpToolCallInput = z.infer<typeof McpToolCallInput>\n\nexport class McpToolCallError extends Error {\n  input: McpToolCallInput\n  constructor(\n    input: McpToolCallInput,\n    message: string,\n    options?: ErrorOptions\n  ) {\n    super(message, options)\n    this.name = 'McpToolCallError'\n    this.input = input\n\n    Object.setPrototypeOf(this, McpToolCallError.prototype)\n  }\n}\n","import {\n  EquippedTool,\n  ToolCallResponse,\n  ToolId,\n  ToolDetails,\n  BasicToolDetails,\n  FilterOptions,\n  ScoredResult,\n  BaseToolbox\n} from '~/types.js'\nimport { Toolbox } from '~/toolbox.js'\nimport { jsonSchemaUtils } from '~/schema.js'\n\nimport {\n  DynamicStructuredTool,\n  DynamicStructuredToolInput,\n  StructuredTool\n} from '@langchain/core/tools'\n\nimport { z, ZodTypeAny } from 'zod'\n\nimport { log } from '~/core/log.js'\nimport { StructuredToolsRecommendation } from './types.js'\nimport { SystemMessage } from '@langchain/core/messages'\nimport { Prompt } from '@toolprint/api-client'\n\n/**\n * Convert an EquippedTool to a DynamicStructuredTool that's compatible with LangChain agents\n */\nconst convertToLangChainTool = (equippedTool: EquippedTool): StructuredTool => {\n  // Input zod type is required for Langchain to enforce input schema\n  const zodInputType: ZodTypeAny = jsonSchemaUtils.toZodType(\n    equippedTool.details.inputSchema\n  )\n\n  const _zodOutputType: ZodTypeAny = z.any()\n\n  type ToolInputType = z.infer<typeof zodInputType>\n  type ToolOutputType = z.infer<typeof _zodOutputType>\n\n  // The tool call function with proper signature for LangChain\n  const toolcallFunc = async (\n    input: ToolInputType\n  ): Promise<ToolCallResponse<ToolOutputType>> => {\n    const response: ToolCallResponse<ToolOutputType> =\n      await equippedTool.handle.call({\n        args: input,\n        approval: undefined // TODO: approvals\n      })\n    if (response.isError) {\n      log.error(`Tool call error: ${response.message}`)\n      throw new Error(response.message)\n    }\n    return response\n  }\n\n  // Create the dynamic structured tool\n  const dynamicToolInput: DynamicStructuredToolInput<ToolOutputType> = {\n    name: equippedTool.details.name,\n    description: equippedTool.details.description,\n    func: toolcallFunc,\n    schema: zodInputType\n  }\n\n  return new DynamicStructuredTool(dynamicToolInput)\n}\n\n/** Converts a list of prompts to a list of LangChain SystemMessages */\nconst convertToLangChainMessages = (prompts: Prompt[]): SystemMessage[] => {\n  return prompts.map((message) => {\n    return new SystemMessage(message.message)\n  })\n}\n\n/**\n * A Langchain Toolbox that provides tools compatible with LangChain agents\n *\n * NOTE: For Blaxel to work with LangChain StructuredTools, we must pin\n * @langchain/core to 0.3.40, as 0.3.44 has slight changes to the StructuredTool\n * interface that break Blaxel.  We will need to find better ways to manage\n * Toolbox interfaces to let us extend the Toolbox for various agent frameworks.\n */\nexport class LangchainToolbox\n  implements BaseToolbox<StructuredTool, StructuredToolsRecommendation>\n{\n  toolbox: Toolbox\n\n  constructor(toolbox: Toolbox) {\n    this.toolbox = toolbox\n  }\n\n  async listTools(): Promise<Map<ToolId, BasicToolDetails>> {\n    return this.toolbox.listTools()\n  }\n\n  async filterTools(\n    filterOptions?: FilterOptions\n  ): Promise<Map<ToolId, ToolDetails>> {\n    return this.toolbox.filterTools(filterOptions)\n  }\n\n  async listIntegrations(): Promise<string[]> {\n    return this.toolbox.listIntegrations()\n  }\n\n  async get(toolId: string): Promise<StructuredTool> {\n    const toolDetails = await this.toolbox.get(toolId)\n    const tool = await toolDetails.equip()\n    return convertToLangChainTool(tool)\n  }\n\n  async getMultiple(toolIds: ToolId[]): Promise<Map<ToolId, StructuredTool>> {\n    const toolDetailsMap = await this.toolbox.getMultiple(toolIds)\n    const structuredToolById: Map<ToolId, StructuredTool> = new Map()\n    for (const [toolId, toolDetails] of toolDetailsMap) {\n      const tool = await toolDetails.equip()\n      structuredToolById.set(toolId, convertToLangChainTool(tool))\n    }\n\n    return structuredToolById\n  }\n\n  async recommend(goal: string): Promise<StructuredToolsRecommendation> {\n    const recommendation = await this.toolbox.recommend(goal)\n    const structuredTools: StructuredTool[] = await Promise.all(\n      recommendation.tools.map(async (t) => {\n        const et = await t.equip()\n        return convertToLangChainTool(et)\n      })\n    )\n    const messages: SystemMessage[] = convertToLangChainMessages(\n      recommendation.messages\n    )\n    return {\n      goal,\n      tools: structuredTools,\n      messages\n    }\n  }\n\n  async search(query: string): Promise<Array<ScoredResult<StructuredTool>>> {\n    const searchResults = await this.toolbox.search(query)\n    const equippedToolResults: ScoredResult<EquippedTool>[] = await Promise.all(\n      searchResults.map(async (result) => {\n        const toolDetails = result.result\n        const tool = await toolDetails.equip()\n        return {\n          score: result.score,\n          result: tool\n        }\n      })\n    )\n    const structuredToolResults: ScoredResult<StructuredTool>[] =\n      equippedToolResults.map((result) => ({\n        score: result.score,\n        result: convertToLangChainTool(result.result)\n      }))\n    return structuredToolResults\n  }\n\n  async close(): Promise<void> {\n    await this.toolbox.close()\n  }\n}\n\nexport async function createLangchainToolbox(toolbox: Toolbox) {\n  return new LangchainToolbox(toolbox)\n}\n"],"mappings":"+1BAAA,IAAAA,GAAA,GAAAC,GAAAD,GAAA,gCAAAE,GAAA,uBAAAC,GAAA,yBAAAC,GAAA,wBAAAC,GAAA,yBAAAC,GAAA,kBAAAC,GAAA,gCAAAC,GAAA,qBAAAC,GAAA,qBAAAC,GAAA,gCAAAC,GAAA,8BAAAC,GAAA,2CAAAC,GAAA,iCAAAC,GAAA,iCAAAC,GAAA,gBAAAC,GAAA,gCAAAC,GAAA,YAAAC,GAAA,uBAAAC,EAAA,mCAAAC,GAAA,qCAAAC,GAAA,qCAAAC,GAAA,6BAAAC,GAAA,qBAAAC,GAAA,8BAAAC,GAAA,2BAAAC,GAAA,oCAAAC,GAAA,+BAAAC,GAAA,8BAAAC,GAAA,2BAAAC,GAAA,6BAAAC,GAAA,6BAAAC,GAAA,oBAAAC,GAAA,mCAAAC,GAAA,kBAAAC,GAAA,gCAAAC,GAAA,oCAAAC,GAAA,mBAAAC,GAAA,iBAAAC,GAAA,4BAAAC,GAAA,WAAAC,GAAA,iBAAAC,GAAA,qBAAAC,GAAA,eAAAC,GAAA,kBAAAC,GAAA,oBAAAC,EAAA,QAAAC,EAAA,gBAAAC,GAAA,oBAAAC,GAAA,mBAAAC,GAAA,oBAAAC,GAAA,+BAAAC,GAAA,2BAAAC,KAAA,eAAAC,GAAAtD,ICAA,IAAAuD,GAAkB,eCAlB,IAAAC,GAAuB,oBACvBC,GAAiB,sBACjBC,GAAe,oBACfC,GAAuB,wBACvBC,GAAkB,uBAEdC,GACH,SAAUA,EAAM,CACbA,EAAK,YAAeC,GAAQA,EAC5B,SAASC,EAASC,EAAM,CAAE,CAC1BH,EAAK,SAAWE,EAChB,SAASE,EAAYC,EAAI,CACrB,MAAM,IAAI,KACd,CACAL,EAAK,YAAcI,EACnBJ,E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,OAAQb,CACV,CACF,CAAC,CACH,GAEsB,IAAKa,IAAY,CACnC,MAAOA,EAAO,MACd,OAAQ9B,GAAuB8B,EAAO,MAAM,CAC9C,EAAE,CAEN,CAEA,MAAM,OAAuB,CAC3B,MAAM,KAAK,QAAQ,MAAM,CAC3B,CACF,EAEA,eAAsBC,GAAuBjB,EAAkB,CAC7D,OAAO,IAAID,GAAiBC,CAAO,CACrC","names":["index_exports","__export","BlaxelToolServerConnection","ClientSessionError","ClientSessionManager","ClientWithCallbacks","DopplerSecretManager","FlagsProvider","InvalidTransportConfigError","LangchainToolbox","McpToolCallError","MultiTransportClientSession","OneGrepApiHighLevelClient","RefreshableMultiTransportClientSession","SingleTransportClientSession","SmitheryToolServerConnection","ToolPrinter","ToolServerConnectionManager","Toolbox","UniversalToolCache","apiKeyBlaxelClientSessionMaker","apiKeyComposioClientSessionMaker","apiKeySmitheryClientSessionMaker","blaxelClientSessionMaker","clientFromConfig","createApiClientFromParams","createBlaxelConnection","createBlaxelMcpClientTransports","createDopplerSecretManager","createGatewaySSETransport","createLangchainToolbox","createSmitheryConnection","createSmitheryTransports","createToolCache","createToolServerSessionManager","createToolbox","createUnauthenticatedClient","defaultToolServerSessionFactory","getChildLogger","getConfigDir","getDopplerSecretManager","getEnv","getEnvIssues","getFlagsProvider","getToolbox","initConfigDir","jsonSchemaUtils","log","mcpCallTool","parseMcpContent","parseMcpResult","parseResultFunc","smitheryClientSessionMaker","useRootLoggerAsConsole","__toCommonJS","import_zod","import_os","import_path","import_fs","import_crypto","import_chalk","util","val","assertIs","_arg","assertNever","_x","items","obj","item","validKeys","k","filtered","e","object","keys","key","arr","checker","joinValues","array","separator","_","value","objectUtil","first","second","ZodParsedType","getParsedType","data","ZodIssueCode","quotelessJson","ZodError","_ZodError","issues","sub","subs","actualProto","_mapper","mapper","issue","fieldErrors","processError","error","curr","i","el","formErrors","errorMap","_ctx","message","overrideErrorMap","setErrorMap","map","getErrorMap","makeIssue","params","path","errorMaps","issueData","fullPath","fullIssue","errorMessage","maps","m","EMPTY_PATH","addIssueToContext","ctx","overrideMap","x","ParseStatus","_ParseStatus","status","results","arrayValue","s","INVALID","pairs","syncPairs","pair","finalObject","DIRTY","OK","isAborted","isDirty","isValid","isAsync","__classPrivateFieldGet","receiver","state","kind","f","__classPrivateFieldSet","errorUtil","message","_ZodEnum_cache","_ZodNativeEnum_cache","ParseInputLazyPath","parent","value","path","key","handleResult","ctx","result","isValid","error","ZodError","processCreateParams","params","errorMap","invalid_type_error","required_error","description","iss","_a","_b","ZodType","input","getParsedType","ParseStatus","isAsync","data","err","maybeAsyncResult","check","getIssueProperties","val","setError","ZodIssueCode","refinementData","refinement","ZodEffects","ZodFirstPartyTypeKind","def","ZodOptional","ZodNullable","ZodArray","ZodPromise","option","ZodUnion","incoming","ZodIntersection","transform","defaultValueFunc","ZodDefault","ZodBranded","catchValueFunc","ZodCatch","This","target","ZodPipeline","ZodReadonly","cuidRegex","cuid2Regex","ulidRegex","uuidRegex","nanoidRegex","jwtRegex","durationRegex","emailRegex","_emojiRegex","emojiRegex","ipv4Regex","ipv4CidrRegex","ipv6Regex","ipv6CidrRegex","base64Regex","base64urlRegex","dateRegexSource","dateRegex","timeRegexSource","args","regex","timeRegex","datetimeRegex","opts","isValidIP","ip","version","isValidJWT","jwt","alg","header","base64","decoded","isValidCidr","ZodString","_ZodString","ZodParsedType","addIssueToContext","INVALID","status","tooBig","tooSmall","util","validation","options","minLength","maxLength","len","ch","min","max","floatSafeRemainder","step","valDecCount","stepDecCount","decCount","valInt","stepInt","ZodNumber","_ZodNumber","kind","inclusive","ZodBigInt","_ZodBigInt","ZodBoolean","OK","ZodDate","_ZodDate","minDate","maxDate","ZodSymbol","ZodUndefined","ZodNull","ZodAny","ZodUnknown","ZodNever","ZodVoid","_ZodArray","item","i","schema","deepPartialify","ZodObject","newShape","fieldSchema","ZodTuple","_ZodObject","shape","keys","shapeKeys","extraKeys","pairs","keyValidator","unknownKeys","catchall","syncPairs","pair","issue","_c","_d","defaultError","augmentation","merging","index","mask","newField","createZodEnum","handleResults","results","unionErrors","childCtx","dirty","issues","types","getDiscriminator","type","ZodLazy","ZodLiteral","ZodEnum","ZodNativeEnum","ZodDiscriminatedUnion","_ZodDiscriminatedUnion","discriminator","discriminatorValue","optionsMap","discriminatorValues","mergeValues","a","b","aType","bType","bKeys","sharedKeys","newObj","sharedValue","newArray","itemA","itemB","handleParsed","parsedLeft","parsedRight","isAborted","merged","isDirty","left","right","_ZodTuple","items","itemIndex","x","rest","schemas","ZodRecord","_ZodRecord","keyType","valueType","first","second","third","ZodMap","finalMap","ZodSet","_ZodSet","finalizeSet","elements","parsedSet","element","minSize","maxSize","size","ZodFunction","_ZodFunction","makeArgsIssue","makeIssue","getErrorMap","makeReturnsIssue","returns","fn","me","parsedArgs","e","parsedReturns","returnType","func","getter","values","_ZodEnum","expectedValues","__classPrivateFieldGet","__classPrivateFieldSet","enumValues","newDef","opt","nativeEnumValues","promisified","effect","checkCtx","arg","processed","DIRTY","executeRefinement","acc","inner","base","preprocess","newCtx","ZodNaN","BRAND","_ZodPipeline","inResult","freeze","cleanParams","p","custom","_params","fatal","r","_fatal","late","instanceOfType","cls","stringType","numberType","nanType","bigIntType","booleanType","dateType","symbolType","undefinedType","nullType","anyType","unknownType","neverType","voidType","arrayType","objectType","strictObjectType","unionType","discriminatedUnionType","intersectionType","tupleType","recordType","mapType","setType","functionType","lazyType","literalType","enumType","nativeEnumType","promiseType","effectsType","optionalType","nullableType","preprocessType","pipelineType","ostring","onumber","oboolean","coerce","NEVER","z","setErrorMap","EMPTY_PATH","objectUtil","quotelessJson","getDefaultExportFromCjs","config","main","require$$4","hasRequiredMain","requireMain","fs$1","fs","path$1","os","require$$2","crypto","require$$3","LINE","parse","src","obj","lines","match","maybeQuote","_parseVault","vaultPath","_vaultPath","DotenvModule","_dotenvKey","length","decrypted","attrs","_instructions","_log","_warn","_debug","dotenvKey","uri","environment","environmentKey","ciphertext","possibleVaultPath","filepath","_resolveHome","envPath","_configVault","parsed","processEnv","configDotenv","dotenvPath","encoding","debug","optionPaths","lastError","parsedAll","decrypt","encrypted","keyStr","nonce","authTag","aesgcm","isRange","invalidKeyLength","decryptionFailed","populate","override","envOptions","hasRequiredEnvOptions","requireEnvOptions","cliOptions","hasRequiredCliOptions","requireCliOptions","re","cur","matches","hasRequiredConfig","requireConfig","nodeEnv","logModes","loggingSchema","sdkApiSchema","configSchema","loggingEnvSchema","envSchema","getEnv","getEnvIssues","getConfigDir","env","initConfigDir","userCfgDir","hasRequiredSrc","requireSrc","_message","srcExports","loglevel$2","loglevel$1","hasRequiredLoglevel","requireLoglevel","module","root","definition","noop","isIE","logMethods","_loggersByName","defaultLogger","bindMethod","methodName","method","traceForIE","realMethod","replaceLoggingMethods","level","enableLoggingWhenConsoleArrives","defaultMethodFactory","_level","_loggerName","Logger","name","factory","self","inheritedLevel","defaultLevel","userLevel","storageKey","persistLevelIfPossible","levelNum","levelName","getPersistedLevel","storedLevel","cookie","cookieName","location","clearPersistedLevel","normalizeLevel","persist","childName","initialLevel","logger","loglevelExports","loglevel","consoleLogger","loggerName","logLevel","LoggerInstance","optionalParams","chalk","getLogFilepath","filename","configDir","levelString","level","loglevel","key","formatMessage","message","optionalParams","logLine","formattedParams","param","fileLogger","loggerName","logLevel","logger","logFilepath","getLogFilepath","shouldLogMessage","messageLevel","fileOutput","fs","LoggerInstance","multiLogger","loggers","asConsole","silentLogger","srcExports","getLogger","logMode","logLevelName","logLevelDesc","consoleLogger","allLoggers","initRootLogger","issues","getEnvIssues","loggingEnvSchema","env","getEnv","error","rootLogger","wrapConsole","sdkLogLevelSchema","sdkLogLevel","rawLevel","initSdkLogger","env","getEnv","loggingSchema","getLogger","log","useRootLoggerAsConsole","wrapConsole","getChildLogger","loggerName","logLevelName","env","getEnv","loggingSchema","getLogger","getConfigDir","initConfigDir","import_keyv","import_cache_manager","FlagsProvider","apiClient","authStatus","user_id","log","flagName","getFlagsProvider","import_zod","zValidationError","zUserAccount","zUpsertSecretResponse","zUpsertSecretRequest","zToolprintToolReference","zToolprintTool","zSearchResultMeta","zPrompt","zToolprintMetaOutput","zToolprintOutput","zTool","zRegisteredToolprint","zToolprintRecommendation","zToolprintMetaInput","zToolprintInput","zToolServerProvider","zToolServerProperties","zToolServerLaunchConfig","zToolServer","zCanonicalResource","zAccessPolicyType","zPolicyBase","zToolProperties","zToolResource","zToolCustomTagsParamsRequest","zToolCustomTagSelectionParamsRequest","zStrategy","zSmitheryConnectionInfo","zSmitheryToolServerClient","zServiceTokenResponse","zPaginationMetadata","zScoredItemTool","zSearchResponseScoredItemTool","zScoredItemRegisteredToolprint","zSearchResponseScoredItemRegisteredToolprint","zSearchRequest","zRecipe","zPolicyCheckResult","zPolicyAccessRule","zPolicy","zAuditLog","zPaginatedResponseAuditLog","zOrganization","zNewPolicyRequest","zMultipleToolCustomTagsParamsRequest","zMultiIdPostBody","zMcpToolServerClient","zMcpIntegrationArgs","zIntegrationAuthScheme","zIntegrationDefaultPolicies","zIntegrationOAuthAuthorizer","zIntegrationSecret","zIntegrationTemplate","zIntegrationConfigurationState","zIntegrationConfigDetails","zBlaxelToolServerClient","zComposioToolServerClient","zInitializeResponse","zHttpValidationError","zGetAllFlagsResponse","zBodyUpsertSecretApiV1SecretsSecretNamePut","zBasicPostResponse","zBasicPostBody","zAuthenticationMethod","zAuthenticationStatus","zActionApprovalState","zActionApprovalRequest","zApprovalAndPolicy","zAccountInformation","zAccountCreateRequest","zGetAiDocumentationAiTxtGetData","zGetAiDocumentationAiTxtGetResponse","zDeleteAccountApiV1AccountDeleteData","zDeleteAccountApiV1AccountDeleteResponse","zGetAccountInformationApiV1AccountGetData","zGetAccountInformationApiV1AccountGetResponse","zCreateAccountApiV1AccountPostData","zCreateAccountApiV1AccountPostResponse","zGetApiKeyApiV1AccountApiKeyGetData","zGetApiKeyApiV1AccountApiKeyGetResponse","zGetAuthStatusApiV1AccountAuthStatusGetData","zGetAuthStatusApiV1AccountAuthStatusGetResponse","zCreateAccountByInvitationApiV1AccountInvitationCodePostData","zCreateAccountByInvitationApiV1AccountInvitationCodePostResponse","zGetServiceTokenApiV1AccountServiceTokenGetData","zGetServiceTokenApiV1AccountServiceTokenGetResponse","zRotateServiceTokenApiV1AccountServiceTokenPostData","zRotateServiceTokenApiV1AccountServiceTokenPostResponse","zGetAuditLogsApiV1AuditGetData","zGetAllFlagsApiV1FlagsGetData","zGetAllFlagsApiV1FlagsGetResponse","zGetAllFlagsResponse","zListIntegrationsApiV1IntegrationsGetData","zListIntegrationsApiV1IntegrationsGetResponse","zIntegrationConfigDetails","zGetIntegrationToolsApiV1IntegrationsIntegrationNameToolsGetData","zGetIntegrationToolsApiV1IntegrationsIntegrationNameToolsGetResponse","zToolResource","zUpsertMultipleToolCustomTagsApiV1IntegrationsIntegrationNameToolsCustomTagsPostData","zMultipleToolCustomTagsParamsRequest","zUpsertMultipleToolCustomTagsApiV1IntegrationsIntegrationNameToolsCustomTagsPostResponse","zGetToolDetailsApiV1IntegrationsIntegrationNameToolsToolNameGetData","zGetToolDetailsApiV1IntegrationsIntegrationNameToolsToolNameGetResponse","zDeleteToolCustomTagsApiV1IntegrationsIntegrationNameToolsToolNameCustomTagsDeleteData","zToolCustomTagSelectionParamsRequest","zDeleteToolCustomTagsApiV1IntegrationsIntegrationNameToolsToolNameCustomTagsDeleteResponse","zUpsertToolCustomTagsApiV1IntegrationsIntegrationNameToolsToolNameCustomTagsPostData","zToolCustomTagsParamsRequest","zUpsertToolCustomTagsApiV1IntegrationsIntegrationNameToolsToolNameCustomTagsPostResponse","zGetAllPoliciesApiV1PoliciesGetData","zGetAllPoliciesApiV1PoliciesGetResponse","zPolicy","zCreatePolicyApiV1PoliciesPostData","zNewPolicyRequest","zGetApprovalRequestsApiV1PoliciesApprovalsGetData","zGetApprovalRequestsApiV1PoliciesApprovalsGetResponse","zApprovalAndPolicy","zCheckResourceAccessGetApiV1PoliciesResourcesCheckGetData","zCheckResourceAccessApiV1PoliciesResourcesCheckPostData","zCheckResourceForApprovalApiV1PoliciesResourcesResourceNameApprovalGetData","zGetPolicyApiV1PoliciesPolicyIdGetData","zUpdatePolicyApiV1PoliciesPolicyIdPutData","zCheckPolicyStatusApiV1PoliciesPolicyIdAuditIdStatusPostData","zListProvidersApiV1ProvidersGetData","zListProvidersApiV1ProvidersGetResponse","zToolServerProvider","zGetProviderApiV1ProvidersProviderIdGetData","zGetProviderApiV1ProvidersProviderIdGetResponse","zGetServersApiV1ProvidersProviderIdServersGetData","zGetServersApiV1ProvidersProviderIdServersGetResponse","zToolServer","zSyncProviderApiV1ProvidersProviderIdSyncPostData","zInitializeApiV1SdkInitializeGetData","zInitializeApiV1SdkInitializeGetResponse","zInitializeResponse","zGetServiceTokenApiV1SdkServiceTokenGetData","zGetServiceTokenApiV1SdkServiceTokenGetResponse","zServiceTokenResponse","zReindexApiV1SearchReindexPostData","zReindexToolprintsApiV1SearchReindexToolprintsPostData","zReindexToolsApiV1SearchReindexToolsPostData","zSearchToolprintsApiV1SearchToolprintsPostData","zSearchRequest","zSearchToolprintsApiV1SearchToolprintsPostResponse","zSearchResponseScoredItemRegisteredToolprint","zGetToolprintRecommendationApiV1SearchToolprintsRecommendationPostData","zGetToolprintRecommendationApiV1SearchToolprintsRecommendationPostResponse","zToolprintRecommendation","zSearchToolsApiV1SearchToolsPostData","zSearchToolsApiV1SearchToolsPostResponse","zSearchResponseScoredItemTool","zGetSecretsApiV1SecretsGetData","zGetSecretApiV1SecretsSecretNameGetData","zGetSecretApiV1SecretsSecretNameGetResponse","zUpsertSecretApiV1SecretsSecretNamePutData","zBodyUpsertSecretApiV1SecretsSecretNamePut","zUpsertSecretApiV1SecretsSecretNamePutResponse","zUpsertSecretResponse","zListServersApiV1ServersGetData","zListServersApiV1ServersGetResponse","zGetServerApiV1ServersServerIdGetData","zGetServerApiV1ServersServerIdGetResponse","zGetServerClientApiV1ServersServerIdClientGetData","zGetServerClientApiV1ServersServerIdClientGetResponse","zMcpToolServerClient","zBlaxelToolServerClient","zSmitheryToolServerClient","zComposioToolServerClient","zGetServerPropertiesApiV1ServersServerIdPropertiesGetData","zGetServerPropertiesApiV1ServersServerIdPropertiesGetResponse","zToolServerProperties","zPatchServerPropertiesApiV1ServersServerIdPropertiesKeyPatchData","zPatchServerPropertiesApiV1ServersServerIdPropertiesKeyPatchResponse","zGetStrategyApiV1StrategyPostData","zGetStrategyApiV1StrategyPostResponse","zStrategy","zCreateFakeRecipesApiV1StrategyFakePostData","zCreateFakeRecipesApiV1StrategyFakePostResponse","zRecipe","zCreateToolprintApiV1ToolprintsPostData","zToolprintInput","zCreateToolprintApiV1ToolprintsPostResponse","zRegisteredToolprint","zGetToolprintInstructionsApiV1ToolprintsWellKnownAiTxtGetData","zGetToolprintInstructionsApiV1ToolprintsWellKnownAiTxtGetResponse","zGetToolprintSchemaApiV1ToolprintsWellKnownSchemaGetData","zGetToolprintSchemaApiV1ToolprintsWellKnownSchemaGetResponse","zGetToolprintTemplateApiV1ToolprintsWellKnownTemplateGetData","zGetToolprintTemplateApiV1ToolprintsWellKnownTemplateGetResponse","zCreateToolprintJsonApiV1ToolprintsJsonPostData","zBasicPostBody","zCreateToolprintJsonApiV1ToolprintsJsonPostResponse","zValidateToolprintApiV1ToolprintsValidatePostData","zValidateToolprintApiV1ToolprintsValidatePostResponse","zBasicPostResponse","zValidateToolprintJsonApiV1ToolprintsValidateJsonPostData","zValidateToolprintYamlApiV1ToolprintsValidateYamlPostData","zValidateToolprintYamlApiV1ToolprintsValidateYamlPostResponse","zCreateToolprintYamlApiV1ToolprintsYamlPostData","zCreateToolprintYamlApiV1ToolprintsYamlPostResponse","zGetToolprintApiV1ToolprintsToolprintIdGetData","zGetToolprintApiV1ToolprintsToolprintIdGetResponse","zListToolsApiV1ToolsGetData","zListToolsApiV1ToolsGetResponse","zTool","zGetToolResourcesBatchApiV1ToolsResourcesBatchPostData","zMultiIdPostBody","zGetToolResourcesBatchApiV1ToolsResourcesBatchPostResponse","zToolResource","zGetToolApiV1ToolsToolIdGetData","zGetToolApiV1ToolsToolIdGetResponse","zGetToolPropertiesApiV1ToolsToolIdPropertiesGetData","zGetToolPropertiesApiV1ToolsToolIdPropertiesGetResponse","zToolProperties","zGetToolResourceApiV1ToolsToolIdResourceGetData","zGetToolResourceApiV1ToolsToolIdResourceGetResponse","zHealthHealthGetData","jsonBodySerializer","body","_key","value","extraPrefixesMap","extraPrefixes","getAuthToken","auth","callback","token","separatorArrayExplode","style","separatorArrayNoExplode","separatorObjectExplode","serializeArrayParam","allowReserved","explode","name","value","joinedValues","v","separator","serializePrimitiveParam","serializeObjectParam","valueOnly","values","key","PATH_PARAM_RE","defaultPathSerializer","path","_url","url","matches","match","explode","name","style","value","serializeArrayParam","serializeObjectParam","serializePrimitiveParam","replaceValue","createQuerySerializer","allowReserved","array","object","queryParams","search","serializedArray","serializedObject","serializedPrimitive","getParseAs","contentType","cleanContent","type","setAuthParams","security","options","auth","token","getAuthToken","buildUrl","getUrl","baseUrl","query","querySerializer","pathUrl","mergeConfigs","a","b","config","mergeHeaders","headers","mergedHeaders","header","iterator","key","v","Interceptors","__publicField","id","index","fn","createInterceptors","defaultQuerySerializer","defaultHeaders","createConfig","override","jsonBodySerializer","createClient","config","_config","mergeConfigs","createConfig","getConfig","setConfig","interceptors","createInterceptors","request","options","opts","mergeHeaders","setAuthParams","url","buildUrl","requestInit","fn","_fetch","response","result","parseAs","getParseAs","data","error","finalError","client","createClient","createConfig","Default","options","client","data","zGetAiDocumentationAiTxtGetData","zGetAiDocumentationAiTxtGetResponse","zHealthHealthGetData","Account","zDeleteAccountApiV1AccountDeleteData","zDeleteAccountApiV1AccountDeleteResponse","zGetAccountInformationApiV1AccountGetData","zGetAccountInformationApiV1AccountGetResponse","zCreateAccountApiV1AccountPostData","zCreateAccountApiV1AccountPostResponse","zGetApiKeyApiV1AccountApiKeyGetData","zGetApiKeyApiV1AccountApiKeyGetResponse","zGetAuthStatusApiV1AccountAuthStatusGetData","zGetAuthStatusApiV1AccountAuthStatusGetResponse","zCreateAccountByInvitationApiV1AccountInvitationCodePostData","zCreateAccountByInvitationApiV1AccountInvitationCodePostResponse","zGetServiceTokenApiV1AccountServiceTokenGetData","zGetServiceTokenApiV1AccountServiceTokenGetResponse","zRotateServiceTokenApiV1AccountServiceTokenPostData","zRotateServiceTokenApiV1AccountServiceTokenPostResponse","Flags","options","client","data","zGetAllFlagsApiV1FlagsGetData","zGetAllFlagsApiV1FlagsGetResponse","Integrations","zListIntegrationsApiV1IntegrationsGetData","zListIntegrationsApiV1IntegrationsGetResponse","zGetIntegrationToolsApiV1IntegrationsIntegrationNameToolsGetData","zGetIntegrationToolsApiV1IntegrationsIntegrationNameToolsGetResponse","zUpsertMultipleToolCustomTagsApiV1IntegrationsIntegrationNameToolsCustomTagsPostData","zUpsertMultipleToolCustomTagsApiV1IntegrationsIntegrationNameToolsCustomTagsPostResponse","zGetToolDetailsApiV1IntegrationsIntegrationNameToolsToolNameGetData","zGetToolDetailsApiV1IntegrationsIntegrationNameToolsToolNameGetResponse","zDeleteToolCustomTagsApiV1IntegrationsIntegrationNameToolsToolNameCustomTagsDeleteData","zDeleteToolCustomTagsApiV1IntegrationsIntegrationNameToolsToolNameCustomTagsDeleteResponse","zUpsertToolCustomTagsApiV1IntegrationsIntegrationNameToolsToolNameCustomTagsPostData","zUpsertToolCustomTagsApiV1IntegrationsIntegrationNameToolsToolNameCustomTagsPostResponse","Providers","options","client","data","zListProvidersApiV1ProvidersGetData","zListProvidersApiV1ProvidersGetResponse","zGetProviderApiV1ProvidersProviderIdGetData","zGetProviderApiV1ProvidersProviderIdGetResponse","zGetServersApiV1ProvidersProviderIdServersGetData","zGetServersApiV1ProvidersProviderIdServersGetResponse","zSyncProviderApiV1ProvidersProviderIdSyncPostData","Sdk","zInitializeApiV1SdkInitializeGetData","zInitializeApiV1SdkInitializeGetResponse","zGetServiceTokenApiV1SdkServiceTokenGetData","zGetServiceTokenApiV1SdkServiceTokenGetResponse","Search","zReindexApiV1SearchReindexPostData","zReindexToolprintsApiV1SearchReindexToolprintsPostData","zReindexToolsApiV1SearchReindexToolsPostData","zSearchToolprintsApiV1SearchToolprintsPostData","zSearchToolprintsApiV1SearchToolprintsPostResponse","zGetToolprintRecommendationApiV1SearchToolprintsRecommendationPostData","zGetToolprintRecommendationApiV1SearchToolprintsRecommendationPostResponse","zSearchToolsApiV1SearchToolsPostData","zSearchToolsApiV1SearchToolsPostResponse","Secrets","zGetSecretsApiV1SecretsGetData","zGetSecretApiV1SecretsSecretNameGetData","zGetSecretApiV1SecretsSecretNameGetResponse","zUpsertSecretApiV1SecretsSecretNamePutData","zUpsertSecretApiV1SecretsSecretNamePutResponse","Servers","zListServersApiV1ServersGetData","zListServersApiV1ServersGetResponse","zGetServerApiV1ServersServerIdGetData","zGetServerApiV1ServersServerIdGetResponse","zGetServerClientApiV1ServersServerIdClientGetData","zGetServerClientApiV1ServersServerIdClientGetResponse","zGetServerPropertiesApiV1ServersServerIdPropertiesGetData","zGetServerPropertiesApiV1ServersServerIdPropertiesGetResponse","zPatchServerPropertiesApiV1ServersServerIdPropertiesKeyPatchData","zPatchServerPropertiesApiV1ServersServerIdPropertiesKeyPatchResponse","Toolprints","options","client","data","zCreateToolprintApiV1ToolprintsPostData","zCreateToolprintApiV1ToolprintsPostResponse","zGetToolprintInstructionsApiV1ToolprintsWellKnownAiTxtGetData","zGetToolprintInstructionsApiV1ToolprintsWellKnownAiTxtGetResponse","zGetToolprintSchemaApiV1ToolprintsWellKnownSchemaGetData","zGetToolprintSchemaApiV1ToolprintsWellKnownSchemaGetResponse","zGetToolprintTemplateApiV1ToolprintsWellKnownTemplateGetData","zGetToolprintTemplateApiV1ToolprintsWellKnownTemplateGetResponse","zCreateToolprintJsonApiV1ToolprintsJsonPostData","zCreateToolprintJsonApiV1ToolprintsJsonPostResponse","zValidateToolprintApiV1ToolprintsValidatePostData","zValidateToolprintApiV1ToolprintsValidatePostResponse","zValidateToolprintJsonApiV1ToolprintsValidateJsonPostData","zValidateToolprintYamlApiV1ToolprintsValidateYamlPostData","zValidateToolprintYamlApiV1ToolprintsValidateYamlPostResponse","zCreateToolprintYamlApiV1ToolprintsYamlPostData","zCreateToolprintYamlApiV1ToolprintsYamlPostResponse","zGetToolprintApiV1ToolprintsToolprintIdGetData","zGetToolprintApiV1ToolprintsToolprintIdGetResponse","Tools","zListToolsApiV1ToolsGetData","zListToolsApiV1ToolsGetResponse","zGetToolResourcesBatchApiV1ToolsResourcesBatchPostData","zGetToolResourcesBatchApiV1ToolsResourcesBatchPostResponse","zGetToolApiV1ToolsToolIdGetData","zGetToolApiV1ToolsToolIdGetResponse","zGetToolPropertiesApiV1ToolsToolIdPropertiesGetData","zGetToolPropertiesApiV1ToolsToolIdPropertiesGetResponse","zGetToolResourceApiV1ToolsToolIdResourceGetData","zGetToolResourceApiV1ToolsToolIdResourceGetResponse","createUnauthenticatedClient","baseUrl","createClient","createConfig","error","log","createApiClientFromParams","clientParams","apiKey","accessToken","authSchemeProvided","headers","clientFromConfig","env","getEnv","sdkApiSchema","params","OneGrepApiError","causedByError","response","message","data","status","makeApiCallWithResult","apiCall","response","error","OneGrepApiError","OneGrepApiHighLevelClient","apiClient","makeApiCallWithResult","Default","result","Sdk","Account","invitationCode","email","Flags","secretName","Secrets","secret","request","Providers","serverId","Servers","toolServersMap","toolServer","servers","server","providerName","provider","serversByProvider","Tools","toolId","integrationName","toolNames","tags","Integrations","toolIds","toolResourcesMap","toolResource","query","options","Search","goal","toolprint","Toolprints","json","yaml","import_core","import_buffer","import_zod","import_ajv","import_json_schema_to_zod","import_uuid","TOOL_SCHEMA_NAMESPACE","uuidv5","INPUT_SCHEMA_NAMESPACE","schemaIdForTool","toolId","namespace","toZodAdapter","jsonSchema","$defs","rest","schemaIdsForTool","tool","schemas","inputId","ToolValidator","ajv","data","validate","JsonSchemaUtils","schema","id","log","jsonSchemaUtils","parseMcpContent","mcpContent","attemptStructuredOutput","resultContent","content","parsedJson","error","log","decodedData","parseMcpResult","result","toolDetails","mode","parseResultFunc","mcpCallTool","mcpClient","toolCallInput","jsonSchemaUtils","callToolRequest","errorMsg","import_core","import_node_sdk","DopplerSecretManager","apiClient","OneGrepApiHighLevelClient","log","initResponse","DopplerSDK","error","secrets","secretCount","secretsJson","secretsParsed","secretsMap","skippedCount","secretName","secretNames","requireAll","foundSecrets","missingSecrets","requestedSecretsMap","secretValue","createDopplerSecretManager","secretManager","getDopplerSecretManager","clientFromConfig","import_core","initializeBlaxelApiClient","apikey","workspace","baseUrl","xBlaxelHeaders","apiKey","initializeBlaxelApiClientFromSecrets","secretsManager","requiredSecretNames","secrets","getBlaxelFunction","functionName","response","BlaxelToolServerConnection","toolServerClient","mcpClientSession","tools","getBlaxelServerTools","tool","log","toolDetails","callDirect","toolCallInput","mcpCallTool","callSyncDirect","_","call","jsonSchemaUtils","result","parseResultFunc","error","callSync","createBlaxelConnection","client","initializeBlaxelApiClientFromSecrets","getDopplerSecretManager","blaxelFunction","getBlaxelFunction","SmitheryToolServerConnection","toolServerClient","mcpClientSession","tools","log","tool","toolDetails","call","input","mcpCallTool","callSync","_","createSmitheryConnection","client","import_client","SettableTimer","timeoutMs","callback","err","log","ClientWithCallbacks","_clientInfo","options","method","result","params","newCallbackClient","clientOptions","SingleTransportClientSession","transport","autoCloseTimeoutMs","callbacksClient","error","MultiTransportClientSession","transports","RefreshableMultiTransportClientSession","defaultKeyExtractor","key","json","hash","b","ClientSessionManager","factory","keyExtractor","config","session","import_process","import_core","BlaxelUrlUtils","name","blaxelSettings","envVar","createBlaxelMcpClientTransports","functionName","providedSettings","headerOverrides","useSettings","urlUtils","url","fallbackUrl","log","transportHeaders","transports","InvalidTransportConfigError","import_config","import_streamableHttp","createSmitheryTransports","toolServerClient","smitheryUrlOptions","InvalidTransportConfigError","http_connection","c","log","jsonSchemaUtils","smithery_transport_url","import_sse","createComposioTransports","toolServerClient","mcpServerUrl","import_zod","import_composio_core","_composioToolSet","getComposioToolSet","apiKey","_composioToolSet","ComposioToolServerConnection","toolServerClient","mcpClientSession","apiKey","getComposioToolSet","getDopplerSecretManager","toolDetails","callDirect","toolCallInput","mcpCallTool","callSyncDirect","_","call","log","jsonSchemaUtils","actionExecuteResponse","error","callSync","createComposioConnection","client","ClientSessionError","message","InvalidTransportConfigError","blaxelClientSessionMaker","client","RefreshableMultiTransportClientSession","createBlaxelMcpClientTransports","apiKeyBlaxelClientSessionMaker","apiKey","workspace","providedSettings","headerOverrides","xBlaxelHeaders","log","MultiTransportClientSession","smitheryClientSessionMaker","createSmitheryTransports","apiKeySmitheryClientSessionMaker","secretManager","profileId","smitheryConfig","launchConfig","secretName","secret","error","smitheryUrlOptions","apiKeyComposioClientSessionMaker","createComposioTransports","RegisteredClientSessionFactory","sessionMakers","client_type","sessionMaker","defaultToolServerSessionFactory","createToolServerSessionManager","factory","ClientSessionManager","ToolServerConnectionManager","extendOnClose","manager","mcpClientSession","originalOnClose","createBlaxelConnection","createSmitheryConnection","createComposioConnection","connection","import_yaml","ToolprintValidationError","message","cause","ToolprintRegistrationError","ToolPrinter","client","content","format","parsed","isValid","YAML","toolprint","error","import_keyv","import_cache_manager","SafeToolHandle","toolHandle","input","error","log","ToolCacheError","message","cause","handleErrors","_","propertyKey","descriptor","originalMethod","args","OneGrepApiError","UniversalToolCache","apiClient","connectionManager","OneGrepApiHighLevelClient","serverId","tool","serverName","toolId","basicToolDetails","toolResource","serverClient","details","connection","toolIds","toolResources","toolDetails","resource","tools","basicTools","t","e","filterOptions","allTools","filteredTools","result","goal","recommendedToolprint","messages","query","response","results","toolDetailsMap","initResponse","server","client","__decorateClass","createToolCache","ToolServerConnectionManager","Toolbox","apiClient","toolCache","OneGrepApiHighLevelClient","options","toolId","toolIds","goal","query","registerSessionMakers","secretManager","requestedSecretNames","secrets","blaxelSessionMaker","apiKeyBlaxelClientSessionMaker","defaultToolServerSessionFactory","log","smitherySessionMaker","apiKeySmitheryClientSessionMaker","composioSessionMaker","apiKeyComposioClientSessionMaker","createToolbox","providedToolCache","providedSecretManager","createDopplerSecretManager","createToolCache","getToolbox","clientFromConfig","import_sse","createGatewaySSETransport","url","additionalHeaders","apiKey","headers","log","eventSourceInit","init","requestInit","sse_opts","transport","error","_message","import_zod","McpToolCallInput","McpToolCallError","_McpToolCallError","input","message","options","import_tools","import_zod","import_messages","convertToLangChainTool","equippedTool","zodInputType","jsonSchemaUtils","_zodOutputType","toolcallFunc","input","response","log","dynamicToolInput","convertToLangChainMessages","prompts","message","LangchainToolbox","toolbox","filterOptions","toolId","tool","toolIds","toolDetailsMap","structuredToolById","toolDetails","goal","recommendation","structuredTools","t","et","messages","query","searchResults","result","createLangchainToolbox"]}