@executor-js/plugin-openapi 1.4.33 → 1.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (81) hide show
  1. package/dist/AddOpenApiSource-7M52SRUX.js +893 -0
  2. package/dist/AddOpenApiSource-7M52SRUX.js.map +1 -0
  3. package/dist/EditOpenApiSource-WTAMRJUK.js +68 -0
  4. package/dist/EditOpenApiSource-WTAMRJUK.js.map +1 -0
  5. package/dist/OpenApiAccountsPanel-3VJJXNQF.js +112 -0
  6. package/dist/OpenApiAccountsPanel-3VJJXNQF.js.map +1 -0
  7. package/dist/api/group.d.ts +104 -225
  8. package/dist/api/index.d.ts +127 -271
  9. package/dist/{chunk-BB5IAKRG.js → chunk-AQ7JDDRM.js} +12 -2
  10. package/dist/chunk-AQ7JDDRM.js.map +1 -0
  11. package/dist/chunk-BSLE6HCE.js +181 -0
  12. package/dist/chunk-BSLE6HCE.js.map +1 -0
  13. package/dist/chunk-MZWZQ24W.js +226 -0
  14. package/dist/chunk-MZWZQ24W.js.map +1 -0
  15. package/dist/chunk-OSIFYIQP.js +623 -0
  16. package/dist/chunk-OSIFYIQP.js.map +1 -0
  17. package/dist/chunk-QSSRVK6M.js +139 -0
  18. package/dist/chunk-QSSRVK6M.js.map +1 -0
  19. package/dist/chunk-V7VCHYOY.js +1544 -0
  20. package/dist/chunk-V7VCHYOY.js.map +1 -0
  21. package/dist/{chunk-AN4HJFNP.js → chunk-YVRI7KRC.js} +162 -186
  22. package/dist/chunk-YVRI7KRC.js.map +1 -0
  23. package/dist/client.js +9 -8
  24. package/dist/client.js.map +1 -1
  25. package/dist/core.js +28 -11
  26. package/dist/index.js +11 -4
  27. package/dist/react/AddOpenApiSource.d.ts +2 -13
  28. package/dist/react/GoogleProductPicker.d.ts +9 -0
  29. package/dist/react/OpenApiAccountsPanel.d.ts +6 -0
  30. package/dist/react/OpenApiSourceDetailsFields.d.ts +3 -2
  31. package/dist/react/atoms.d.ts +177 -192
  32. package/dist/react/auth-method-config.d.ts +15 -0
  33. package/dist/react/client.d.ts +103 -224
  34. package/dist/react/index.d.ts +2 -2
  35. package/dist/react/source-plugin.d.ts +2 -2
  36. package/dist/sdk/config.d.ts +75 -0
  37. package/dist/sdk/configure.test.d.ts +1 -0
  38. package/dist/sdk/describe-auth-methods.test.d.ts +1 -0
  39. package/dist/sdk/errors.d.ts +4 -6
  40. package/dist/sdk/extract.d.ts +7 -5
  41. package/dist/sdk/google-bundle.test.d.ts +1 -0
  42. package/dist/sdk/google-discovery.d.ts +43 -0
  43. package/dist/sdk/google-discovery.test.d.ts +1 -0
  44. package/dist/sdk/google-oauth-batches.d.ts +13 -0
  45. package/dist/sdk/google-oauth-batches.test.d.ts +1 -0
  46. package/dist/sdk/google-oauth-scopes.d.ts +3 -0
  47. package/dist/sdk/google-oauth-scopes.test.d.ts +1 -0
  48. package/dist/sdk/google-presets.d.ts +16 -0
  49. package/dist/sdk/google-presets.test.d.ts +1 -0
  50. package/dist/sdk/google-product-picker-scopes.test.d.ts +1 -0
  51. package/dist/sdk/index.d.ts +7 -5
  52. package/dist/sdk/invoke.d.ts +6 -9
  53. package/dist/sdk/openapi-utils.d.ts +1 -0
  54. package/dist/sdk/plugin.d.ts +74 -231
  55. package/dist/sdk/presets.d.ts +2 -1
  56. package/dist/sdk/preview.d.ts +20 -15
  57. package/dist/sdk/query-serialization.test.d.ts +1 -0
  58. package/dist/sdk/store.d.ts +14 -41
  59. package/dist/sdk/types.d.ts +23 -51
  60. package/dist/testing/index.d.ts +49 -38
  61. package/dist/testing.js +46 -18
  62. package/dist/testing.js.map +1 -1
  63. package/package.json +6 -4
  64. package/dist/AddOpenApiSource-NSCULGTM.js +0 -19
  65. package/dist/AddOpenApiSource-NSCULGTM.js.map +0 -1
  66. package/dist/EditOpenApiSource-MV7NYTRP.js +0 -774
  67. package/dist/EditOpenApiSource-MV7NYTRP.js.map +0 -1
  68. package/dist/OpenApiSourceSummary-7JBS7PUV.js +0 -122
  69. package/dist/OpenApiSourceSummary-7JBS7PUV.js.map +0 -1
  70. package/dist/chunk-2ZKKZYZH.js +0 -1181
  71. package/dist/chunk-2ZKKZYZH.js.map +0 -1
  72. package/dist/chunk-AN4HJFNP.js.map +0 -1
  73. package/dist/chunk-BB5IAKRG.js.map +0 -1
  74. package/dist/chunk-PRVJDE43.js +0 -2101
  75. package/dist/chunk-PRVJDE43.js.map +0 -1
  76. package/dist/chunk-X5JX3KTA.js +0 -201
  77. package/dist/chunk-X5JX3KTA.js.map +0 -1
  78. package/dist/react/OpenApiSourceSummary.d.ts +0 -5
  79. package/dist/sdk/credential-status.d.ts +0 -23
  80. package/dist/sdk/source-contracts.d.ts +0 -55
  81. /package/dist/{sdk/credential-status.test.d.ts → react/auth-method-config.test.d.ts} +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/sdk/config.ts","../src/sdk/invoke.ts","../src/sdk/store.ts","../src/sdk/plugin.ts","../src/sdk/definitions.ts"],"sourcesContent":["import { Option, Schema } from \"effect\";\n\nimport type { Authentication, AuthenticationTemplateValue, AuthenticationVariable } from \"./types\";\nimport { TOKEN_VARIABLE } from \"./types\";\n\n// ---------------------------------------------------------------------------\n// OpenAPI integration config — the opaque blob stored on the catalog\n// `integration.config` column (D1). Core never parses it; the plugin writes it\n// at register time and reads it back in `resolveTools` / `invokeTool`.\n//\n// In v2 there are NO credential bindings, NO per-source secret slots, and NO\n// StoredSource credential config. The config carries only:\n// - the OpenAPI spec text (inlined) OR the source URL to (re)fetch from,\n// - the optional base URL override,\n// - the auth templates a connection's value is rendered through.\n// ---------------------------------------------------------------------------\n\nconst AuthenticationVariableSchema = Schema.Struct({\n type: Schema.Literal(\"variable\"),\n name: Schema.String,\n});\n\nconst AuthenticationTemplateValueSchema = Schema.Union([\n Schema.String,\n Schema.Array(Schema.Union([Schema.String, AuthenticationVariableSchema])),\n]);\n\nconst APIKeyAuthenticationSchema = Schema.Struct({\n slug: Schema.String,\n type: Schema.Literal(\"apiKey\"),\n headers: Schema.optional(Schema.Record(Schema.String, AuthenticationTemplateValueSchema)),\n queryParams: Schema.optional(Schema.Record(Schema.String, AuthenticationTemplateValueSchema)),\n});\n\nconst OAuthAuthenticationSchema = Schema.Struct({\n slug: Schema.String,\n type: Schema.Literal(\"oauth\"),\n authorizationUrl: Schema.String,\n tokenUrl: Schema.String,\n scopes: Schema.Array(Schema.String),\n});\n\nexport const AuthenticationSchema = Schema.Union([\n OAuthAuthenticationSchema,\n APIKeyAuthenticationSchema,\n]);\n\nexport const OpenApiIntegrationConfigSchema = Schema.Struct({\n /** Inlined OpenAPI document text (resolved + parsed source of truth). */\n spec: Schema.String,\n /** Origin URL the spec was fetched from, when known. Enables refresh. */\n sourceUrl: Schema.optional(Schema.String),\n /** Google Discovery bundle URLs, when the spec came from a Google bundle. */\n googleDiscoveryUrls: Schema.optional(Schema.Array(Schema.String)),\n /** Base URL override; falls back to the spec's first server. */\n baseUrl: Schema.optional(Schema.String),\n /** Static headers applied to every request (no secret material). */\n headers: Schema.optional(Schema.Record(Schema.String, Schema.String)),\n /** Static query params applied to every request (no secret material). */\n queryParams: Schema.optional(Schema.Record(Schema.String, Schema.String)),\n /** The auth methods a connection's value can be applied through. */\n authenticationTemplate: Schema.optional(Schema.Array(AuthenticationSchema)),\n});\n\nexport type OpenApiIntegrationConfig = Omit<\n typeof OpenApiIntegrationConfigSchema.Type,\n \"authenticationTemplate\"\n> & {\n /** Branded over the schema's structural form so the template renderer can\n * treat `slug` as an `AuthTemplateSlug`. */\n readonly authenticationTemplate?: readonly Authentication[];\n};\n\nconst decodeConfig = Schema.decodeUnknownOption(OpenApiIntegrationConfigSchema);\n\n/** Decode the opaque integration config blob into the openapi shape.\n * Returns null when the blob is missing/incompatible. */\nexport const decodeOpenApiIntegrationConfig = (value: unknown): OpenApiIntegrationConfig | null =>\n Option.getOrNull(decodeConfig(value)) as OpenApiIntegrationConfig | null;\n\n// ---------------------------------------------------------------------------\n// Template rendering — \"auth state derived into the auth-template format\"\n// (D11). The resolved credential value renders into the template's\n// `variable(\"token\")` slots, identically for apiKey and oauth (the oauth value\n// IS the access token). Returns the headers + query params to apply.\n// ---------------------------------------------------------------------------\n\nconst isVariable = (part: string | AuthenticationVariable): part is AuthenticationVariable =>\n typeof part !== \"string\";\n\nconst renderTemplateValue = (\n template: AuthenticationTemplateValue,\n values: Record<string, string | null>,\n): string => {\n if (typeof template === \"string\") return template;\n return template.map((part) => (isVariable(part) ? (values[part.name] ?? \"\") : part)).join(\"\");\n};\n\nexport interface RenderedAuth {\n readonly headers: Record<string, string>;\n readonly queryParams: Record<string, string>;\n}\n\n/** Render an auth template against a connection's resolved input `values`\n * (`variable → value`). For an apiKey template, each `variable(\"<name>\")` is\n * substituted from its own entry, so a method with two distinct inputs (e.g.\n * Datadog) fills each header from a different value. For an oauth template (no\n * explicit placement), render a bearer Authorization header from `token`. */\nexport const renderAuthTemplate = (\n template: Authentication,\n values: Record<string, string | null>,\n): RenderedAuth => {\n if (template.type === \"oauth\") {\n return {\n headers: { authorization: `Bearer ${values[TOKEN_VARIABLE] ?? \"\"}` },\n queryParams: {},\n };\n }\n const headers: Record<string, string> = {};\n const queryParams: Record<string, string> = {};\n for (const [name, tmpl] of Object.entries(template.headers ?? {})) {\n headers[name] = renderTemplateValue(tmpl, values);\n }\n for (const [name, tmpl] of Object.entries(template.queryParams ?? {})) {\n queryParams[name] = renderTemplateValue(tmpl, values);\n }\n return { headers, queryParams };\n};\n\n/** The distinct input variables a template references — the inputs a connection\n * must supply. An oauth template needs `token`; an apiKey template needs every\n * `variable(\"<name>\")` across its placements. */\nexport const requiredTemplateVariables = (template: Authentication): readonly string[] => {\n if (template.type === \"oauth\") return [TOKEN_VARIABLE];\n const names = new Set<string>();\n const collect = (tmpl: AuthenticationTemplateValue): void => {\n if (typeof tmpl === \"string\") return;\n for (const part of tmpl) {\n if (isVariable(part)) names.add(part.name);\n }\n };\n for (const tmpl of Object.values(template.headers ?? {})) collect(tmpl);\n for (const tmpl of Object.values(template.queryParams ?? {})) collect(tmpl);\n return [...names];\n};\n","import { Effect, Layer, Option } from \"effect\";\nimport { HttpClient, HttpClientRequest } from \"effect/unstable/http\";\n\nimport { OpenApiInvocationError } from \"./errors\";\nimport {\n type EncodingObject,\n type OperationBinding,\n InvocationResult,\n type MediaBinding,\n type OperationParameter,\n} from \"./types\";\n\n// ---------------------------------------------------------------------------\n// Parameter reading\n// ---------------------------------------------------------------------------\n\nconst CONTAINER_KEYS: Record<string, readonly string[]> = {\n path: [\"path\", \"pathParams\", \"params\"],\n query: [\"query\", \"queryParams\", \"params\"],\n header: [\"headers\", \"header\"],\n cookie: [\"cookies\", \"cookie\"],\n};\n\nconst readParamValue = (args: Record<string, unknown>, param: OperationParameter): unknown => {\n const direct = args[param.name];\n if (direct !== undefined) return direct;\n\n for (const key of CONTAINER_KEYS[param.location] ?? []) {\n const container = args[key];\n if (typeof container === \"object\" && container !== null && !Array.isArray(container)) {\n const nested = (container as Record<string, unknown>)[param.name];\n if (nested !== undefined) return nested;\n }\n }\n\n return undefined;\n};\n\nconst primitiveToString = (value: unknown): string =>\n typeof value === \"object\" && value !== null ? JSON.stringify(value) : String(value);\n\n// RFC 3986 §2.2 reserved chars. `allowReserved: true` leaves these\n// unencoded; default OAS behavior encodes everything non-unreserved.\nconst RESERVED_UNENCODED_RE = /[A-Za-z0-9\\-._~:/?#[\\]@!$&'()*+,;=]/;\n\nconst encodeReservedAware = (raw: string, allowReserved: boolean): string => {\n if (!allowReserved) return encodeURIComponent(raw);\n // Walk char-by-char so the reserved set passes through as-is.\n let out = \"\";\n for (const ch of raw) {\n out += RESERVED_UNENCODED_RE.test(ch) ? ch : encodeURIComponent(ch);\n }\n return out;\n};\n\nconst queryParamValues = (value: unknown, param: OperationParameter): string[] => {\n if (value === undefined || value === null) return [];\n if (!Array.isArray(value)) return [primitiveToString(value)];\n\n const style = Option.getOrUndefined(param.style) ?? \"form\";\n const explode = Option.getOrElse(param.explode, () => true);\n\n if (explode) return value.map(primitiveToString);\n\n const separator = style === \"spaceDelimited\" ? \" \" : style === \"pipeDelimited\" ? \"|\" : \",\";\n return [value.map(primitiveToString).join(separator)];\n};\n\n// ---------------------------------------------------------------------------\n// Path resolution\n// ---------------------------------------------------------------------------\n\nconst resolvePath = Effect.fn(\"OpenApi.resolvePath\")(function* (\n pathTemplate: string,\n args: Record<string, unknown>,\n parameters: readonly OperationParameter[],\n) {\n let resolved = pathTemplate;\n\n for (const param of parameters) {\n if (param.location !== \"path\") continue;\n const value = readParamValue(args, param);\n if (value === undefined || value === null) {\n if (param.required) {\n return yield* new OpenApiInvocationError({\n message: `Missing required path parameter: ${param.name}`,\n statusCode: Option.none(),\n });\n }\n continue;\n }\n const encoded = encodeReservedAware(\n String(value),\n Option.getOrElse(param.allowReserved, () => false),\n );\n resolved = resolved.replaceAll(`{${param.name}}`, encoded);\n resolved = resolved.replaceAll(`{+${param.name}}`, encoded);\n }\n\n const remaining = [...resolved.matchAll(/\\{([^{}]+)\\}/g)]\n .map((m) => m[1])\n .filter((v): v is string => typeof v === \"string\");\n\n for (const name of remaining) {\n const value = args[name];\n if (value !== undefined && value !== null) {\n resolved = resolved.replaceAll(`{${name}}`, encodeURIComponent(String(value)));\n }\n }\n\n const unresolved = [...resolved.matchAll(/\\{([^{}]+)\\}/g)]\n .map((m) => m[1])\n .filter((v): v is string => typeof v === \"string\");\n\n if (unresolved.length > 0) {\n return yield* new OpenApiInvocationError({\n message: `Unresolved path parameters: ${[...new Set(unresolved)].join(\", \")}`,\n statusCode: Option.none(),\n });\n }\n\n return resolved;\n});\n\nconst applyHeaders = (\n request: HttpClientRequest.HttpClientRequest,\n headers: Record<string, string>,\n): HttpClientRequest.HttpClientRequest => {\n let req = request;\n for (const [name, value] of Object.entries(headers)) {\n req = HttpClientRequest.setHeader(req, name, value);\n }\n return req;\n};\n\n// ---------------------------------------------------------------------------\n// Response helpers\n// ---------------------------------------------------------------------------\n\nconst normalizeContentType = (ct: string | null | undefined): string =>\n ct?.split(\";\")[0]?.trim().toLowerCase() ?? \"\";\n\nconst isJsonContentType = (ct: string | null | undefined): boolean => {\n const normalized = normalizeContentType(ct);\n if (!normalized) return false;\n return (\n normalized === \"application/json\" || normalized.includes(\"+json\") || normalized.includes(\"json\")\n );\n};\n\nconst isFormUrlEncoded = (ct: string | null | undefined): boolean =>\n normalizeContentType(ct) === \"application/x-www-form-urlencoded\";\n\nconst isMultipartFormData = (ct: string | null | undefined): boolean =>\n normalizeContentType(ct).startsWith(\"multipart/form-data\");\n\nconst isXmlContentType = (ct: string | null | undefined): boolean => {\n const normalized = normalizeContentType(ct);\n if (!normalized) return false;\n return (\n normalized === \"application/xml\" || normalized === \"text/xml\" || normalized.endsWith(\"+xml\")\n );\n};\n\nconst isTextContentType = (ct: string | null | undefined): boolean =>\n normalizeContentType(ct).startsWith(\"text/\");\n\nconst isOctetStream = (ct: string | null | undefined): boolean =>\n normalizeContentType(ct) === \"application/octet-stream\";\n\nconst toUint8Array = (value: unknown): Uint8Array | null => {\n if (value instanceof Uint8Array) return value;\n if (value instanceof ArrayBuffer) return new Uint8Array(value);\n if (ArrayBuffer.isView(value)) {\n const view = value as ArrayBufferView;\n return new Uint8Array(view.buffer, view.byteOffset, view.byteLength);\n }\n if (Array.isArray(value) && value.every((v) => typeof v === \"number\")) {\n return new Uint8Array(value as readonly number[]);\n }\n return null;\n};\n\ntype FormDataRecord = Parameters<typeof HttpClientRequest.bodyFormDataRecord>[1];\ntype FormDataCoercible = FormDataRecord[string];\n\n// Pull a plain ArrayBuffer out of a Uint8Array — `new Blob([u8])` rejects\n// views whose `.buffer` is `SharedArrayBuffer | ArrayBuffer` under strict\n// lib.dom typings.\nconst toArrayBuffer = (bytes: Uint8Array): ArrayBuffer => {\n const copy = new ArrayBuffer(bytes.byteLength);\n new Uint8Array(copy).set(bytes);\n return copy;\n};\n\n// ---------------------------------------------------------------------------\n// OpenAPI 3.x encoding — per-property style/explode/allowReserved/contentType\n// for multipart/form-data and application/x-www-form-urlencoded bodies.\n// Spec ref: https://spec.openapis.org/oas/v3.1.0#encoding-object\n// ---------------------------------------------------------------------------\n\ntype StyleExplode = {\n readonly style: string;\n readonly explode: boolean;\n readonly allowReserved: boolean;\n};\n\nconst DEFAULT_FORM_STYLE: StyleExplode = {\n style: \"form\",\n explode: true,\n allowReserved: false,\n};\n\nconst resolveStyleExplode = (e: EncodingObject | undefined): StyleExplode => {\n if (!e) return DEFAULT_FORM_STYLE;\n return {\n style: Option.getOrElse(e.style, () => DEFAULT_FORM_STYLE.style),\n explode: Option.getOrElse(e.explode, () => DEFAULT_FORM_STYLE.explode),\n allowReserved: Option.getOrElse(e.allowReserved, () => DEFAULT_FORM_STYLE.allowReserved),\n };\n};\n\nconst encodeFormValue = (v: unknown, allowReserved: boolean): string => {\n const raw = typeof v === \"object\" && v !== null ? JSON.stringify(v) : String(v);\n return encodeReservedAware(raw, allowReserved);\n};\n\n/**\n * Serialize a record to application/x-www-form-urlencoded with OAS3 style\n * rules honored per-field. Supports `form` (default), `deepObject`,\n * `pipeDelimited`, `spaceDelimited` styles with `explode` true / false.\n */\nconst serializeFormUrlEncoded = (\n value: Record<string, unknown>,\n encoding: Record<string, EncodingObject> | undefined,\n): string => {\n const parts: string[] = [];\n for (const [key, raw] of Object.entries(value)) {\n if (raw === undefined || raw === null) continue;\n const { style, explode, allowReserved } = resolveStyleExplode(encoding?.[key]);\n const encKey = encodeURIComponent(key);\n\n if (Array.isArray(raw)) {\n if (explode) {\n for (const v of raw) {\n parts.push(`${encKey}=${encodeFormValue(v, allowReserved)}`);\n }\n } else {\n const sep = style === \"spaceDelimited\" ? \" \" : style === \"pipeDelimited\" ? \"|\" : \",\";\n parts.push(\n `${encKey}=${encodeFormValue(\n raw.map((v) => (typeof v === \"object\" ? JSON.stringify(v) : String(v))).join(sep),\n allowReserved,\n )}`,\n );\n }\n continue;\n }\n\n if (typeof raw === \"object\") {\n const entries = Object.entries(raw as Record<string, unknown>).filter(\n ([, v]) => v !== undefined && v !== null,\n );\n if (style === \"deepObject\") {\n for (const [subkey, subval] of entries) {\n // Encode the whole `key[subkey]` fragment so `[` / `]` become\n // `%5B` / `%5D`. Matches swagger-client's behaviour and remains\n // accepted by common server-side parsers (qs, Rails, etc.).\n parts.push(\n `${encodeURIComponent(`${key}[${subkey}]`)}=${encodeFormValue(subval, allowReserved)}`,\n );\n }\n } else if (explode) {\n // form + explode=true on object: sub-keys become top-level fields.\n for (const [subkey, subval] of entries) {\n parts.push(`${encodeURIComponent(subkey)}=${encodeFormValue(subval, allowReserved)}`);\n }\n } else {\n // form + explode=false on object: flatten to csv key,val,key,val.\n const flat = entries.flatMap(([k, v]) => [\n k,\n typeof v === \"object\" ? JSON.stringify(v) : String(v),\n ]);\n parts.push(`${encKey}=${encodeFormValue(flat.join(\",\"), allowReserved)}`);\n }\n continue;\n }\n\n parts.push(`${encKey}=${encodeFormValue(raw, allowReserved)}`);\n }\n return parts.join(\"&\");\n};\n\n/**\n * Best-effort build of a multipart FormData entry record.\n *\n * If `encoding[key].contentType` is declared (OAS3 §4.8.15), wrap the value\n * in a `Blob` with that type so the runtime multipart framer emits the\n * per-part `Content-Type` header (e.g. `application/json` for a metadata\n * part whose server expects parsed JSON).\n *\n * Otherwise: primitives pass through, arrays handle their item types, byte\n * shapes wrap as Blob, nested objects JSON-stringify (never `[object Object]`).\n */\nconst coerceFormDataRecord = (\n value: Record<string, unknown>,\n encoding: Record<string, EncodingObject> | undefined,\n): FormDataRecord => {\n const out: Record<string, FormDataCoercible> = {};\n for (const [key, raw] of Object.entries(value)) {\n if (raw === undefined || raw === null) continue;\n\n const partType = encoding?.[key]\n ? Option.getOrUndefined(encoding[key]!.contentType)\n : undefined;\n\n // Explicit per-part content type: wrap in a typed Blob so the framer\n // emits `Content-Type: <partType>` on this part. JSON types get the\n // value JSON-stringified first so the blob body is valid JSON.\n if (partType) {\n const isJson = partType.startsWith(\"application/json\") || partType.includes(\"+json\");\n const serialized =\n typeof raw === \"string\"\n ? raw\n : isJson\n ? JSON.stringify(raw)\n : typeof raw === \"object\"\n ? JSON.stringify(raw)\n : String(raw);\n out[key] = new Blob([serialized], { type: partType });\n continue;\n }\n\n if (\n typeof raw === \"string\" ||\n typeof raw === \"number\" ||\n typeof raw === \"boolean\" ||\n raw instanceof Blob ||\n (typeof File !== \"undefined\" && raw instanceof File)\n ) {\n out[key] = raw as FormDataCoercible;\n continue;\n }\n if (Array.isArray(raw)) {\n out[key] = raw.map((v) =>\n typeof v === \"string\" ||\n typeof v === \"number\" ||\n typeof v === \"boolean\" ||\n v instanceof Blob ||\n (typeof File !== \"undefined\" && v instanceof File)\n ? (v as FormDataCoercible)\n : JSON.stringify(v),\n ) as FormDataCoercible;\n continue;\n }\n const bytes = toUint8Array(raw);\n if (bytes) {\n out[key] = new Blob([toArrayBuffer(bytes)]);\n continue;\n }\n out[key] = JSON.stringify(raw);\n }\n return out;\n};\n\n// ---------------------------------------------------------------------------\n// Request body dispatch\n//\n// Dispatch is driven by the spec-declared content type first, JS type of\n// the provided body second. Servers that advertise a specific content type\n// almost always reject anything else (e.g. a multipart endpoint will hang\n// waiting for valid framing if it receives `application/json`), so the\n// content type wins.\n//\n// Within each content type we accept both pre-serialized strings (user\n// already produced the wire format) and structured JS values we can\n// serialize ourselves. The last-resort fallback is `JSON.stringify(body)`\n// — never `String(body)` (which produces the useless `[object Object]`).\n// ---------------------------------------------------------------------------\n\nconst applyRequestBody = (\n request: HttpClientRequest.HttpClientRequest,\n contentType: string,\n bodyValue: unknown,\n encoding: Record<string, EncodingObject> | undefined,\n): HttpClientRequest.HttpClientRequest => {\n if (isJsonContentType(contentType)) {\n // Pre-serialized JSON strings pass through with the declared media\n // type preserved (important for `application/vnd.foo+json` etc.).\n if (typeof bodyValue === \"string\") {\n return HttpClientRequest.bodyText(request, bodyValue, contentType);\n }\n return HttpClientRequest.bodyJsonUnsafe(request, bodyValue);\n }\n\n if (isFormUrlEncoded(contentType)) {\n if (typeof bodyValue === \"string\") {\n return HttpClientRequest.bodyText(request, bodyValue, contentType);\n }\n if (typeof bodyValue === \"object\" && bodyValue !== null && !Array.isArray(bodyValue)) {\n // Serialize ourselves so OAS3 encoding (style/explode/deepObject)\n // is honored. bodyUrlParams doesn't know about per-field style.\n const serialized = serializeFormUrlEncoded(bodyValue as Record<string, unknown>, encoding);\n return HttpClientRequest.bodyText(request, serialized, contentType);\n }\n // Non-object body — fall back to platform helper (handles URLSearchParams).\n return HttpClientRequest.bodyUrlParams(\n request,\n bodyValue as Parameters<typeof HttpClientRequest.bodyUrlParams>[1],\n );\n }\n\n if (isMultipartFormData(contentType)) {\n if (bodyValue instanceof FormData) {\n return HttpClientRequest.bodyFormData(request, bodyValue);\n }\n if (typeof bodyValue === \"object\" && bodyValue !== null) {\n return HttpClientRequest.bodyFormDataRecord(\n request,\n coerceFormDataRecord(bodyValue as Record<string, unknown>, encoding),\n );\n }\n // String / primitive under multipart is almost certainly wrong on the\n // caller's end — send it as text with their declared content type and\n // let the server produce a useful error.\n return HttpClientRequest.bodyText(request, String(bodyValue), contentType);\n }\n\n if (isOctetStream(contentType)) {\n const bytes = toUint8Array(bodyValue);\n if (bytes) return HttpClientRequest.bodyUint8Array(request, bytes, contentType);\n if (typeof bodyValue === \"string\") {\n return HttpClientRequest.bodyText(request, bodyValue, contentType);\n }\n // Unknown shape — serialize as JSON so at least the payload is visible.\n return HttpClientRequest.bodyText(request, JSON.stringify(bodyValue), contentType);\n }\n\n if (isXmlContentType(contentType) || isTextContentType(contentType)) {\n if (typeof bodyValue === \"string\") {\n return HttpClientRequest.bodyText(request, bodyValue, contentType);\n }\n const bytes = toUint8Array(bodyValue);\n if (bytes) return HttpClientRequest.bodyUint8Array(request, bytes, contentType);\n // Object body under text/xml is unusual — stringify so the caller sees\n // their own payload instead of `[object Object]`.\n return HttpClientRequest.bodyText(request, JSON.stringify(bodyValue), contentType);\n }\n\n // Unknown content type: respect what the caller supplied.\n if (typeof bodyValue === \"string\") {\n return HttpClientRequest.bodyText(request, bodyValue, contentType);\n }\n const bytes = toUint8Array(bodyValue);\n if (bytes) return HttpClientRequest.bodyUint8Array(request, bytes, contentType);\n return HttpClientRequest.bodyText(request, JSON.stringify(bodyValue), contentType);\n};\n\n// ---------------------------------------------------------------------------\n// Public API — invoke a single operation\n// ---------------------------------------------------------------------------\n\nexport const invoke = Effect.fn(\"OpenApi.invoke\")(function* (\n operation: OperationBinding,\n args: Record<string, unknown>,\n resolvedHeaders: Record<string, string>,\n sourceQueryParams: Record<string, string> = {},\n) {\n const client = yield* HttpClient.HttpClient;\n\n yield* Effect.annotateCurrentSpan({\n \"http.method\": operation.method.toUpperCase(),\n \"http.route\": operation.pathTemplate,\n \"plugin.openapi.method\": operation.method.toUpperCase(),\n \"plugin.openapi.path_template\": operation.pathTemplate,\n \"plugin.openapi.headers.resolved_count\": Object.keys(resolvedHeaders).length,\n });\n\n const resolvedPath = yield* resolvePath(operation.pathTemplate, args, operation.parameters);\n\n const path = resolvedPath.startsWith(\"/\") ? resolvedPath : `/${resolvedPath}`;\n\n let request = HttpClientRequest.make(operation.method.toUpperCase() as \"GET\")(path);\n\n for (const [name, value] of Object.entries(sourceQueryParams)) {\n request = HttpClientRequest.setUrlParam(request, name, value);\n }\n\n for (const param of operation.parameters) {\n if (param.location !== \"query\") continue;\n const value = readParamValue(args, param);\n for (const paramValue of queryParamValues(value, param)) {\n request = HttpClientRequest.appendUrlParam(request, param.name, paramValue);\n }\n }\n\n for (const param of operation.parameters) {\n if (param.location !== \"header\") continue;\n const value = readParamValue(args, param);\n if (value === undefined || value === null) continue;\n request = HttpClientRequest.setHeader(request, param.name, String(value));\n }\n\n if (Option.isSome(operation.requestBody)) {\n const rb = operation.requestBody.value;\n const bodyValue = args.body ?? args.input;\n if (bodyValue !== undefined) {\n // Resolve which declared media type to use. When the spec declares\n // multiple, the caller can override via `args.contentType`; otherwise\n // we use the first-declared (spec author's preferred ordering).\n const contentsOpt = Option.getOrUndefined(rb.contents);\n const requestedCt = typeof args.contentType === \"string\" ? args.contentType : undefined;\n const selected: MediaBinding | undefined =\n contentsOpt && requestedCt\n ? contentsOpt.find((c) => c.contentType === requestedCt)\n : undefined;\n const chosenCt = selected?.contentType ?? rb.contentType;\n const chosenEncoding = selected\n ? Option.getOrUndefined(selected.encoding)\n : contentsOpt && contentsOpt[0]\n ? Option.getOrUndefined(contentsOpt[0].encoding)\n : undefined;\n request = applyRequestBody(request, chosenCt, bodyValue, chosenEncoding);\n }\n }\n\n request = applyHeaders(request, resolvedHeaders);\n\n const response = yield* client.execute(request).pipe(\n Effect.mapError(\n (err) =>\n new OpenApiInvocationError({\n message: \"HTTP request failed\",\n statusCode: Option.none(),\n cause: err,\n }),\n ),\n );\n\n const status = response.status;\n yield* Effect.annotateCurrentSpan({\n \"http.status_code\": status,\n });\n const responseHeaders: Record<string, string> = { ...response.headers };\n\n const contentType = response.headers[\"content-type\"] ?? null;\n const mapBodyError = Effect.mapError(\n (err: unknown) =>\n new OpenApiInvocationError({\n message: \"Failed to read response body\",\n statusCode: Option.some(status),\n cause: err,\n }),\n );\n const responseBody: unknown =\n status === 204\n ? null\n : isJsonContentType(contentType)\n ? yield* response.json.pipe(\n Effect.catch(() => response.text),\n mapBodyError,\n )\n : yield* response.text.pipe(mapBodyError);\n\n const ok = status >= 200 && status < 300;\n\n return InvocationResult.make({\n status,\n headers: responseHeaders,\n data: ok ? responseBody : null,\n error: ok ? null : responseBody,\n });\n});\n\n// ---------------------------------------------------------------------------\n// Invoke with a provided HttpClient layer + optional baseUrl prefix\n// ---------------------------------------------------------------------------\n\nexport const invokeWithLayer = (\n operation: OperationBinding,\n args: Record<string, unknown>,\n baseUrl: string,\n resolvedHeaders: Record<string, string>,\n sourceQueryParams: Record<string, string>,\n httpClientLayer: Layer.Layer<HttpClient.HttpClient, never, never>,\n) => {\n const operationBaseUrl = operation.baseUrl;\n const effectiveBaseUrl = operationBaseUrl ?? baseUrl;\n const clientWithBaseUrl = effectiveBaseUrl\n ? Layer.effect(\n HttpClient.HttpClient,\n Effect.map(\n Effect.service(HttpClient.HttpClient),\n HttpClient.mapRequest(HttpClientRequest.prependUrl(effectiveBaseUrl)),\n ),\n ).pipe(Layer.provide(httpClientLayer))\n : httpClientLayer;\n\n return invoke(operation, args, resolvedHeaders, sourceQueryParams).pipe(\n Effect.provide(clientWithBaseUrl),\n Effect.withSpan(\"plugin.openapi.invoke\", {\n attributes: {\n \"plugin.openapi.method\": operation.method.toUpperCase(),\n \"plugin.openapi.path_template\": operation.pathTemplate,\n \"plugin.openapi.base_url\": effectiveBaseUrl,\n },\n }),\n );\n};\n\n// ---------------------------------------------------------------------------\n// Derive annotations from HTTP method\n// ---------------------------------------------------------------------------\n\nconst REQUIRE_APPROVAL = new Set([\"post\", \"put\", \"patch\", \"delete\"]);\n\nexport const annotationsForOperation = (\n method: string,\n pathTemplate: string,\n): { requiresApproval?: boolean; approvalDescription?: string } => {\n const m = method.toLowerCase();\n if (!REQUIRE_APPROVAL.has(m)) return {};\n return {\n requiresApproval: true,\n approvalDescription: `${method.toUpperCase()} ${pathTemplate}`,\n };\n};\n","import { Effect, Option, Predicate, Schema } from \"effect\";\n\nimport {\n type PluginStorageEntry,\n type StorageDeps,\n type StorageFailure,\n} from \"@executor-js/sdk/core\";\n\nimport { OperationBinding } from \"./types\";\n\n// ---------------------------------------------------------------------------\n// OpenAPI plugin store (v2). The catalog row (integration.config) owns the spec\n// + auth templates; this store keeps only the per-operation invocation bindings\n// (method / path / params), keyed by integration slug, so `invokeTool` can map\n// a tool name back to its HTTP operation without re-parsing the spec on every\n// call. There are NO credential bindings, slots, or StoredSource credential\n// config here — those concepts are gone in v2.\n//\n// Operations are spec-derived (identical for every connection on an\n// integration), so they live under the org owner (the integration catalog is\n// tenant-level). The plugin storage facade partitions by owner; \"org\" keeps a\n// single shared copy per integration.\n// ---------------------------------------------------------------------------\n\nconst OPERATION_COLLECTION = \"operation\";\nconst STORE_OWNER = \"org\" as const;\n\nconst encodeBinding = Schema.encodeSync(OperationBinding);\nconst decodeBinding = Schema.decodeUnknownSync(OperationBinding);\nconst decodeBindingJson = Schema.decodeUnknownSync(Schema.fromJsonString(OperationBinding));\n\nconst toJsonRecord = (value: unknown): Record<string, unknown> => value as Record<string, unknown>;\n\nconst OperationStorage = Schema.Struct({\n integration: Schema.String,\n toolName: Schema.String,\n binding: Schema.Unknown,\n});\nconst decodeOperationStorage = Schema.decodeUnknownOption(OperationStorage);\n\nexport interface StoredOperation {\n /** The integration slug this operation belongs to. */\n readonly integration: string;\n /** The tool name (the `<tool>` address segment) this operation backs. */\n readonly toolName: string;\n readonly binding: OperationBinding;\n}\n\nconst rowToOperation = (row: PluginStorageEntry): StoredOperation | null => {\n const decoded = decodeOperationStorage(row.data);\n if (Option.isNone(decoded)) return null;\n const operation = decoded.value;\n return {\n integration: operation.integration,\n toolName: operation.toolName,\n binding: decodeBinding(\n typeof operation.binding === \"string\"\n ? decodeBindingJson(operation.binding)\n : operation.binding,\n ),\n };\n};\n\nconst operationKey = (integration: string, toolName: string): string =>\n `${integration}.${toolName}`;\n\nexport interface OpenapiStore {\n /** Replace all stored operations for an integration. */\n readonly putOperations: (\n integration: string,\n operations: readonly StoredOperation[],\n ) => Effect.Effect<void, StorageFailure>;\n /** Look up one operation by integration + tool name. */\n readonly getOperation: (\n integration: string,\n toolName: string,\n ) => Effect.Effect<StoredOperation | null, StorageFailure>;\n /** List every stored operation for an integration. */\n readonly listOperations: (\n integration: string,\n ) => Effect.Effect<readonly StoredOperation[], StorageFailure>;\n /** Drop all stored operations for an integration. */\n readonly removeOperations: (integration: string) => Effect.Effect<void, StorageFailure>;\n}\n\nexport const makeDefaultOpenapiStore = ({ pluginStorage }: StorageDeps): OpenapiStore => {\n const operationData = (operation: StoredOperation) => ({\n integration: operation.integration,\n toolName: operation.toolName,\n binding: toJsonRecord(encodeBinding(operation.binding)),\n });\n\n const listRows = (integration: string) =>\n pluginStorage\n .list({ collection: OPERATION_COLLECTION, keyPrefix: `${integration}.` })\n .pipe(\n Effect.map((rows: readonly PluginStorageEntry[]) =>\n rows.filter((row) => rowToOperation(row)?.integration === integration),\n ),\n );\n\n const removeOperations = (integration: string) =>\n Effect.gen(function* () {\n const rows = yield* listRows(integration);\n yield* pluginStorage.removeMany({\n owner: STORE_OWNER,\n entries: rows.map((row) => ({ collection: OPERATION_COLLECTION, key: row.key })),\n });\n });\n\n return {\n putOperations: (integration, operations) =>\n Effect.gen(function* () {\n yield* removeOperations(integration);\n yield* pluginStorage.putMany({\n owner: STORE_OWNER,\n entries: operations.map((operation) => ({\n collection: OPERATION_COLLECTION,\n key: operationKey(integration, operation.toolName),\n data: operationData(operation),\n })),\n });\n }),\n\n getOperation: (integration, toolName) =>\n pluginStorage\n .get({ collection: OPERATION_COLLECTION, key: operationKey(integration, toolName) })\n .pipe(Effect.map((row) => (row ? rowToOperation(row) : null))),\n\n listOperations: (integration) =>\n listRows(integration).pipe(\n Effect.map((rows) => rows.map(rowToOperation).filter(Predicate.isNotNull)),\n ),\n\n removeOperations,\n };\n};\n","import { Effect, Option, Schema } from \"effect\";\nimport type { Layer } from \"effect\";\nimport { HttpClient } from \"effect/unstable/http\";\n\nimport {\n AuthTemplateSlug,\n IntegrationAlreadyExistsError,\n IntegrationDetectionResult,\n IntegrationSlug,\n ToolName,\n ToolResult,\n authToolFailure,\n definePlugin,\n tool,\n type AuthMethodDescriptor,\n type AuthPlacementDescriptor,\n type Integration,\n type IntegrationConfig,\n type IntegrationRecord,\n type PluginCtx,\n type ResolveToolsResult,\n type StorageFailure,\n type ToolDef,\n type ToolInvocationCredential,\n} from \"@executor-js/sdk/core\";\n\nimport {\n decodeOpenApiIntegrationConfig,\n renderAuthTemplate,\n requiredTemplateVariables,\n type OpenApiIntegrationConfig,\n} from \"./config\";\nimport { OpenApiExtractionError, OpenApiOAuthError, OpenApiParseError } from \"./errors\";\nimport { parse, resolveSpecText } from \"./parse\";\nimport {\n convertGoogleDiscoveryBundleToOpenApi,\n convertGoogleDiscoveryToOpenApi,\n fetchGoogleDiscoveryDocument,\n isGoogleDiscoveryUrl,\n} from \"./google-discovery\";\nimport { extract } from \"./extract\";\nimport { compileToolDefinitions, type ToolDefinition } from \"./definitions\";\nimport { annotationsForOperation, invokeWithLayer } from \"./invoke\";\nimport { previewSpec, type SpecPreview } from \"./preview\";\nimport { openApiPresets } from \"./presets\";\nimport { makeDefaultOpenapiStore, type OpenapiStore, type StoredOperation } from \"./store\";\nimport type { Authentication, AuthenticationTemplateValue } from \"./types\";\nimport { OperationBinding, TOKEN_VARIABLE } from \"./types\";\n\n// ---------------------------------------------------------------------------\n// Plugin config\n// ---------------------------------------------------------------------------\n\nconst STRINGIFIED_BODY_CAP = 1024;\nconst UpstreamMessageBody = Schema.Struct({ message: Schema.String });\nconst UpstreamErrorMessageBody = Schema.Struct({ errorMessage: Schema.String });\nconst UpstreamNestedErrorBody = Schema.Struct({ error: UpstreamMessageBody });\nconst UpstreamErrorsArrayBody = Schema.Struct({\n errors: Schema.Array(\n Schema.Struct({\n detail: Schema.optional(Schema.String),\n message: Schema.optional(Schema.String),\n title: Schema.optional(Schema.String),\n }),\n ),\n});\nconst UpstreamDescriptionBody = Schema.Struct({\n detail: Schema.optional(Schema.String),\n title: Schema.optional(Schema.String),\n description: Schema.optional(Schema.String),\n});\n\nconst decodeUpstreamMessageBody = Schema.decodeUnknownOption(UpstreamMessageBody);\nconst decodeUpstreamErrorMessageBody = Schema.decodeUnknownOption(UpstreamErrorMessageBody);\nconst decodeUpstreamNestedErrorBody = Schema.decodeUnknownOption(UpstreamNestedErrorBody);\nconst decodeUpstreamErrorsArrayBody = Schema.decodeUnknownOption(UpstreamErrorsArrayBody);\nconst decodeUpstreamDescriptionBody = Schema.decodeUnknownOption(UpstreamDescriptionBody);\n\nconst clampedStringify = (value: unknown): string => {\n let s: string;\n // oxlint-disable-next-line executor/no-try-catch-or-throw -- boundary: JSON.stringify may throw on cycles; fall back to String() so the upstream body can still be surfaced as ToolError.details fallback text\n try {\n s = JSON.stringify(value);\n } catch {\n s = String(value);\n }\n return s.length > STRINGIFIED_BODY_CAP ? `${s.slice(0, STRINGIFIED_BODY_CAP)}…` : s;\n};\n\nconst firstNonEmpty = (...values: readonly (string | undefined)[]): string | undefined =>\n values.find((value) => value !== undefined && value.length > 0);\n\n// Walk known upstream error-body shapes so ToolError.message stays concise\n// while ToolError.details preserves the original body.\nconst extractUpstreamMessage = (body: unknown, status: number): string => {\n if (typeof body === \"string\") {\n return body.length > 0 ? body : `Upstream returned HTTP ${status}`;\n }\n const nested = Option.getOrUndefined(decodeUpstreamNestedErrorBody(body));\n const messageBody = Option.getOrUndefined(decodeUpstreamMessageBody(body));\n const errorMessageBody = Option.getOrUndefined(decodeUpstreamErrorMessageBody(body));\n const errorsBody = Option.getOrUndefined(decodeUpstreamErrorsArrayBody(body));\n const descriptionBody = Option.getOrUndefined(decodeUpstreamDescriptionBody(body));\n const arrayMessage = errorsBody?.errors\n .map(\n ({\n detail,\n message: upstreamMessage,\n title,\n }: {\n detail?: string;\n message?: string;\n title?: string;\n }) => firstNonEmpty(detail, upstreamMessage, title),\n )\n .find((message: string | undefined) => message !== undefined);\n const message = firstNonEmpty(\n nested?.error.message,\n messageBody?.message,\n errorMessageBody?.errorMessage,\n arrayMessage,\n descriptionBody?.detail,\n descriptionBody?.title,\n descriptionBody?.description,\n );\n if (message !== undefined) return message;\n if (body !== null && typeof body === \"object\") {\n return clampedStringify(body);\n }\n return `Upstream returned HTTP ${status}`;\n};\n\n// ---------------------------------------------------------------------------\n// Extension input shapes\n// ---------------------------------------------------------------------------\n\nexport type OpenApiSpecInput = typeof OpenApiSpecInputSchema.Type;\n\nexport interface OpenApiPreviewInput {\n readonly spec: string;\n}\n\n/** Add an OpenAPI integration to the catalog. The integration is the API\n * surface; connections (the credentials) are attached separately and resolve\n * their value through the declared `authenticationTemplate`. */\nexport interface OpenApiSpecConfig {\n readonly spec: OpenApiSpecInput;\n /** The catalog slug for the new integration (the `<integration>` segment). */\n readonly slug: string;\n /** Human description (defaults to the spec title). */\n readonly description?: string;\n readonly baseUrl?: string;\n /** Static headers applied to every request (no secret material). */\n readonly headers?: Record<string, string>;\n /** Static query params applied to every request. */\n readonly queryParams?: Record<string, string>;\n /** Auth methods a connection's value renders through. */\n readonly authenticationTemplate?: readonly Authentication[];\n}\n\nexport interface OpenApiExtensionFailure {\n readonly _tag: string;\n}\n\n/** Add / merge custom auth methods onto an existing OpenAPI integration's\n * `authenticationTemplate`. Mirrors the GraphQL plugin's `configure`. */\nexport interface OpenApiConfigureInput {\n /** The auth methods to add. Each entry is appended to (or, when its `slug`\n * already exists, replaces) the integration's existing template array. A\n * custom apiKey method with no `slug` is assigned a generated `custom_<id>`\n * slug that is collision-checked against the existing template. */\n readonly authenticationTemplate: readonly Authentication[];\n readonly mode?: \"merge\" | \"replace\";\n}\n\nexport interface OpenApiPluginExtension {\n readonly previewSpec: (\n input: string | OpenApiPreviewInput,\n ) => Effect.Effect<\n SpecPreview,\n OpenApiParseError | OpenApiExtractionError | OpenApiOAuthError | StorageFailure\n >;\n readonly addSpec: (\n config: OpenApiSpecConfig,\n ) => Effect.Effect<\n { readonly slug: IntegrationSlug; readonly toolCount: number },\n | OpenApiParseError\n | OpenApiExtractionError\n | OpenApiOAuthError\n | IntegrationAlreadyExistsError\n | StorageFailure\n >;\n readonly removeSpec: (slug: string) => Effect.Effect<void, StorageFailure>;\n readonly getIntegration: (slug: string) => Effect.Effect<Integration | null, StorageFailure>;\n /** Read the integration's full opaque config, including its\n * `authenticationTemplate`. Returns null when the integration is absent. */\n readonly getConfig: (\n slug: string,\n ) => Effect.Effect<OpenApiIntegrationConfig | null, StorageFailure>;\n /** Add / merge custom auth methods onto the integration's\n * `authenticationTemplate`. Returns the resulting template array. */\n readonly configure: (\n slug: string,\n input: OpenApiConfigureInput,\n ) => Effect.Effect<readonly Authentication[], StorageFailure>;\n}\n\n// ---------------------------------------------------------------------------\n// Control-tool input/output schemas\n// ---------------------------------------------------------------------------\n\nconst PreviewSpecInputSchema = Schema.Struct({\n spec: Schema.String,\n});\n\nconst StaticPreviewServerVariableSchema = Schema.Struct({\n default: Schema.String,\n enum: Schema.NullOr(Schema.Array(Schema.String)),\n description: Schema.NullOr(Schema.String),\n});\nconst StaticPreviewServerSchema = Schema.Struct({\n url: Schema.String,\n description: Schema.NullOr(Schema.String),\n variables: Schema.NullOr(Schema.Record(Schema.String, StaticPreviewServerVariableSchema)),\n});\nconst StaticPreviewOAuthAuthorizationCodeFlowSchema = Schema.Struct({\n authorizationUrl: Schema.String,\n tokenUrl: Schema.String,\n refreshUrl: Schema.NullOr(Schema.String),\n scopes: Schema.Record(Schema.String, Schema.String),\n});\nconst StaticPreviewOAuthClientCredentialsFlowSchema = Schema.Struct({\n tokenUrl: Schema.String,\n refreshUrl: Schema.NullOr(Schema.String),\n scopes: Schema.Record(Schema.String, Schema.String),\n});\nconst StaticPreviewOAuthFlowsSchema = Schema.Struct({\n authorizationCode: Schema.NullOr(StaticPreviewOAuthAuthorizationCodeFlowSchema),\n clientCredentials: Schema.NullOr(StaticPreviewOAuthClientCredentialsFlowSchema),\n});\nconst StaticPreviewSecuritySchemeSchema = Schema.Struct({\n name: Schema.String,\n type: Schema.Literals([\"http\", \"apiKey\", \"oauth2\", \"openIdConnect\"]),\n scheme: Schema.NullOr(Schema.String),\n bearerFormat: Schema.NullOr(Schema.String),\n in: Schema.NullOr(Schema.Literals([\"header\", \"query\", \"cookie\"])),\n headerName: Schema.NullOr(Schema.String),\n description: Schema.NullOr(Schema.String),\n flows: Schema.NullOr(StaticPreviewOAuthFlowsSchema),\n openIdConnectUrl: Schema.NullOr(Schema.String),\n});\nconst StaticPreviewOAuth2PresetSchema = Schema.Struct({\n label: Schema.String,\n securitySchemeName: Schema.String,\n flow: Schema.Literals([\"authorizationCode\", \"clientCredentials\"]),\n authorizationUrl: Schema.NullOr(Schema.String),\n tokenUrl: Schema.String,\n refreshUrl: Schema.NullOr(Schema.String),\n scopes: Schema.Record(Schema.String, Schema.String),\n identityScopes: Schema.Union([\n Schema.Literal(\"auto\"),\n Schema.Literal(false),\n Schema.Array(Schema.String),\n ]),\n});\nconst StaticPreviewSpecOutputSchema = Schema.Struct({\n title: Schema.NullOr(Schema.String),\n version: Schema.NullOr(Schema.String),\n servers: Schema.Array(StaticPreviewServerSchema),\n operationCount: Schema.Number,\n tags: Schema.Array(Schema.String),\n securitySchemes: Schema.Array(StaticPreviewSecuritySchemeSchema),\n authStrategies: Schema.Array(Schema.Struct({ schemes: Schema.Array(Schema.String) })),\n headerPresets: Schema.Array(\n Schema.Struct({\n label: Schema.String,\n headers: Schema.Record(Schema.String, Schema.NullOr(Schema.String)),\n secretHeaders: Schema.Array(Schema.String),\n }),\n ),\n oauth2Presets: Schema.Array(StaticPreviewOAuth2PresetSchema),\n});\ntype StaticPreviewSpecOutput = typeof StaticPreviewSpecOutputSchema.Type;\n\nconst OpenApiSpecInputSchema = Schema.Union([\n Schema.Struct({ kind: Schema.Literal(\"url\"), url: Schema.String }),\n Schema.Struct({ kind: Schema.Literal(\"blob\"), value: Schema.String }),\n Schema.Struct({\n kind: Schema.Literal(\"googleDiscovery\"),\n url: Schema.String,\n }),\n Schema.Struct({\n kind: Schema.Literal(\"googleDiscoveryBundle\"),\n urls: Schema.Array(Schema.String),\n }),\n]);\n\nconst AuthenticationVariableSchema = Schema.Struct({\n type: Schema.Literal(\"variable\"),\n name: Schema.String,\n});\nconst AuthenticationTemplateValueSchema = Schema.Union([\n Schema.String,\n Schema.Array(Schema.Union([Schema.String, AuthenticationVariableSchema])),\n]);\nconst AuthenticationSchema = Schema.Union([\n Schema.Struct({\n slug: Schema.String,\n type: Schema.Literal(\"apiKey\"),\n headers: Schema.optional(Schema.Record(Schema.String, AuthenticationTemplateValueSchema)),\n queryParams: Schema.optional(Schema.Record(Schema.String, AuthenticationTemplateValueSchema)),\n }),\n Schema.Struct({\n slug: Schema.String,\n type: Schema.Literal(\"oauth\"),\n authorizationUrl: Schema.String,\n tokenUrl: Schema.String,\n scopes: Schema.Array(Schema.String),\n }),\n]);\n\nconst AddSourceInputSchema = Schema.Struct({\n spec: OpenApiSpecInputSchema,\n slug: Schema.String,\n description: Schema.optional(Schema.String),\n baseUrl: Schema.optional(Schema.String),\n headers: Schema.optional(Schema.Record(Schema.String, Schema.String)),\n queryParams: Schema.optional(Schema.Record(Schema.String, Schema.String)),\n authenticationTemplate: Schema.optional(Schema.Array(AuthenticationSchema)),\n});\n\nconst AddSourceOutputSchema = Schema.Struct({\n slug: Schema.String,\n toolCount: Schema.Number,\n});\n\nconst PreviewSpecInputStandardSchema = Schema.toStandardSchemaV1(\n Schema.toStandardJSONSchemaV1(PreviewSpecInputSchema),\n);\nconst PreviewSpecOutputStandardSchema = Schema.toStandardSchemaV1(\n Schema.toStandardJSONSchemaV1(StaticPreviewSpecOutputSchema),\n);\nconst AddSourceInputStandardSchema = Schema.toStandardSchemaV1(\n Schema.toStandardJSONSchemaV1(AddSourceInputSchema),\n);\nconst AddSourceOutputStandardSchema = Schema.toStandardSchemaV1(\n Schema.toStandardJSONSchemaV1(AddSourceOutputSchema),\n);\n\nconst openApiToolFailure = (code: string, message: string, details?: unknown) =>\n ToolResult.fail({\n code,\n message,\n ...(details === undefined ? {} : { details }),\n });\n\nconst openApiAuthToolFailure = (failure: {\n readonly code: string;\n readonly message: string;\n readonly owner: \"org\" | \"user\";\n readonly integration: string;\n readonly connection: string;\n readonly credentialKind: \"secret\" | \"oauth\" | \"upstream\";\n readonly credentialLabel?: string;\n readonly status?: number;\n readonly details?: unknown;\n}) =>\n authToolFailure({\n // The auth-tool-failure helper's code set is shared with v1; keep the\n // string but reference the connection rather than v1's source/slot.\n code: failure.code as Parameters<typeof authToolFailure>[0][\"code\"],\n message: failure.message,\n source: { id: failure.integration, scope: failure.owner },\n credential: {\n kind: failure.credentialKind,\n ...(failure.credentialLabel ? { label: failure.credentialLabel } : {}),\n },\n ...(failure.status !== undefined ? { status: failure.status } : {}),\n ...(failure.details !== undefined\n ? {\n upstream: {\n ...(failure.status !== undefined ? { status: failure.status } : {}),\n details: failure.details,\n },\n }\n : {}),\n });\n\nconst staticPreviewOutput = (preview: SpecPreview): StaticPreviewSpecOutput => ({\n title: Option.getOrNull(preview.title),\n version: Option.getOrNull(preview.version),\n servers: preview.servers.map((server) => ({\n url: server.url,\n description: Option.getOrNull(server.description),\n variables: Option.getOrNull(server.variables)\n ? Object.fromEntries(\n Object.entries(Option.getOrNull(server.variables) ?? {}).map(([name, variable]) => [\n name,\n {\n default: variable.default,\n enum: Option.getOrNull(variable.enum),\n description: Option.getOrNull(variable.description),\n },\n ]),\n )\n : null,\n })),\n operationCount: preview.operationCount,\n tags: preview.tags,\n securitySchemes: preview.securitySchemes.map((scheme) => ({\n name: scheme.name,\n type: scheme.type,\n scheme: Option.getOrNull(scheme.scheme),\n bearerFormat: Option.getOrNull(scheme.bearerFormat),\n in: Option.getOrNull(scheme.in),\n headerName: Option.getOrNull(scheme.headerName),\n description: Option.getOrNull(scheme.description),\n flows: Option.isSome(scheme.flows)\n ? {\n authorizationCode: Option.isSome(scheme.flows.value.authorizationCode)\n ? {\n authorizationUrl: scheme.flows.value.authorizationCode.value.authorizationUrl,\n tokenUrl: scheme.flows.value.authorizationCode.value.tokenUrl,\n refreshUrl: Option.getOrNull(scheme.flows.value.authorizationCode.value.refreshUrl),\n scopes: scheme.flows.value.authorizationCode.value.scopes,\n }\n : null,\n clientCredentials: Option.isSome(scheme.flows.value.clientCredentials)\n ? {\n tokenUrl: scheme.flows.value.clientCredentials.value.tokenUrl,\n refreshUrl: Option.getOrNull(scheme.flows.value.clientCredentials.value.refreshUrl),\n scopes: scheme.flows.value.clientCredentials.value.scopes,\n }\n : null,\n }\n : null,\n openIdConnectUrl: Option.getOrNull(scheme.openIdConnectUrl),\n })),\n authStrategies: preview.authStrategies,\n headerPresets: preview.headerPresets,\n oauth2Presets: preview.oauth2Presets.map((preset) => ({\n label: preset.label,\n securitySchemeName: preset.securitySchemeName,\n flow: preset.flow,\n authorizationUrl: Option.getOrNull(preset.authorizationUrl),\n tokenUrl: preset.tokenUrl,\n refreshUrl: Option.getOrNull(preset.refreshUrl),\n scopes: preset.scopes,\n identityScopes: preset.identityScopes,\n })),\n});\n\n// ---------------------------------------------------------------------------\n// Helpers\n// ---------------------------------------------------------------------------\n\n/** Rewrite OpenAPI `#/components/schemas/X` refs to standard `#/$defs/X`. */\nconst normalizeOpenApiRefs = (node: unknown): unknown => {\n if (node == null || typeof node !== \"object\") return node;\n if (Array.isArray(node)) {\n let changed = false;\n const out = node.map((item) => {\n const n = normalizeOpenApiRefs(item);\n if (n !== item) changed = true;\n return n;\n });\n return changed ? out : node;\n }\n\n const obj = node as Record<string, unknown>;\n\n if (typeof obj.$ref === \"string\") {\n const match = obj.$ref.match(/^#\\/components\\/schemas\\/(.+)$/);\n if (match) return { ...obj, $ref: `#/$defs/${match[1]}` };\n return obj;\n }\n\n let changed = false;\n const result: Record<string, unknown> = {};\n for (const [k, v] of Object.entries(obj)) {\n const n = normalizeOpenApiRefs(v);\n if (n !== v) changed = true;\n result[k] = n;\n }\n return changed ? result : obj;\n};\n\nconst toBinding = (def: ToolDefinition): OperationBinding =>\n OperationBinding.make({\n method: def.operation.method,\n baseUrl: def.operation.baseUrl,\n pathTemplate: def.operation.pathTemplate,\n parameters: [...def.operation.parameters],\n requestBody: def.operation.requestBody,\n });\n\nconst descriptionFor = (def: ToolDefinition): string => {\n const op = def.operation;\n return Option.getOrElse(op.description, () =>\n Option.getOrElse(op.summary, () => `${op.method.toUpperCase()} ${op.pathTemplate}`),\n );\n};\n\nconst openApiTransportOutputSchema = (dataSchema: unknown): Record<string, unknown> => ({\n type: \"object\",\n additionalProperties: false,\n required: [\"status\", \"headers\", \"data\"],\n properties: {\n status: { type: \"integer\" },\n headers: {\n type: \"object\",\n additionalProperties: { type: \"string\" },\n },\n data: dataSchema ?? {},\n },\n});\n\nconst specInputToSourceUrl = (spec: OpenApiSpecInput): string | undefined =>\n spec.kind === \"url\" || spec.kind === \"googleDiscovery\" ? spec.url : undefined;\n\nconst specInputToGoogleBundle = (spec: OpenApiSpecInput): readonly string[] | undefined =>\n spec.kind === \"googleDiscoveryBundle\" ? spec.urls : undefined;\n\n// ---------------------------------------------------------------------------\n// Auth-template merge — `configure` appends custom methods to the integration's\n// existing `authenticationTemplate`. A method whose slug matches an existing\n// entry replaces it (in place); a method with no usable slug is assigned a\n// generated `custom_<id>` slug, collision-checked against the merged set so two\n// custom methods added in one call can't clash.\n// ---------------------------------------------------------------------------\n\nconst shortId = (): string => Math.random().toString(36).slice(2, 8);\n\n/** Generate a `custom_<id>` slug not present in `taken`. */\nconst freshCustomSlug = (taken: ReadonlySet<string>): AuthTemplateSlug => {\n let candidate = `custom_${shortId()}`;\n while (taken.has(candidate)) candidate = `custom_${shortId()}`;\n return AuthTemplateSlug.make(candidate);\n};\n\n/** Merge incoming auth methods into the existing template array. Entries with a\n * matching slug replace the existing entry; otherwise they are appended.\n * Incoming entries lacking a slug (or whose slug collides with another entry\n * added in this same call) get a fresh `custom_<id>` slug. */\nconst mergeAuthenticationTemplate = (\n existing: readonly Authentication[],\n incoming: readonly Authentication[],\n): readonly Authentication[] => {\n const result: Authentication[] = existing.map((entry) => entry);\n const taken = new Set<string>(result.map((entry) => String(entry.slug)));\n for (const entry of incoming) {\n // `slug` is branded as required, but JSON callers may omit it; read defensively.\n const rawSlug = (entry as { readonly slug?: unknown }).slug;\n const requested = typeof rawSlug === \"string\" ? rawSlug.trim() : \"\";\n const existingIndex = result.findIndex((current) => String(current.slug) === requested);\n if (requested.length > 0 && existingIndex >= 0) {\n // Replace the matching entry in place, preserving array order.\n result[existingIndex] = entry;\n continue;\n }\n const slug =\n requested.length > 0 && !taken.has(requested)\n ? AuthTemplateSlug.make(requested)\n : freshCustomSlug(taken);\n taken.add(String(slug));\n result.push({ ...entry, slug } as Authentication);\n }\n return result;\n};\n\n// ---------------------------------------------------------------------------\n// Declared auth methods — project the stored `authenticationTemplate` into the\n// catalog's plugin-agnostic `AuthMethodDescriptor[]`. This mirrors the client's\n// `authMethodsFromConfig` (in the React auth-method-config module) on the\n// server so the catalog field is consistent. OpenAPI also renders its own\n// accounts slot, so this projection is consistency work, not a fix; an absent /\n// malformed config yields `[]` with no regression.\n//\n// Placement prefix extraction: a header/query slot serializes the credential as\n// `name -> [prefix, variable(\"token\")]`; the leading literals before the\n// `variable(\"token\")` part are the prefix (empty for a bare `[token]`).\n// ---------------------------------------------------------------------------\n\n/** Extract the literal prefix preceding the credential variable, plus the\n * variable name a placement renders from (`token` for single-input methods, a\n * distinct name per input for multi-input ones). */\nconst parseTemplateValue = (\n value: AuthenticationTemplateValue,\n): { readonly prefix: string; readonly variable: string } => {\n if (typeof value === \"string\") return { prefix: \"\", variable: TOKEN_VARIABLE };\n const parts: string[] = [];\n for (const part of value) {\n if (typeof part !== \"string\" && part.type === \"variable\") {\n return { prefix: parts.join(\"\"), variable: part.name };\n }\n if (typeof part === \"string\") parts.push(part);\n }\n return { prefix: parts.join(\"\"), variable: TOKEN_VARIABLE };\n};\n\nconst placementsFromAuthentication = (\n template: Extract<Authentication, { readonly type: \"apiKey\" }>,\n): readonly AuthPlacementDescriptor[] => {\n const placements: AuthPlacementDescriptor[] = [];\n for (const [name, value] of Object.entries(template.headers ?? {})) {\n const { prefix, variable } = parseTemplateValue(value);\n placements.push({ carrier: \"header\", name, prefix, variable });\n }\n for (const [name, value] of Object.entries(template.queryParams ?? {})) {\n const { prefix, variable } = parseTemplateValue(value);\n placements.push({ carrier: \"query\", name, prefix, variable });\n }\n return placements;\n};\n\nconst apiKeyLabel = (slug: string, placements: readonly AuthPlacementDescriptor[]): string => {\n const first = placements[0];\n if (first) return `API key (${first.name || (first.carrier === \"header\" ? \"header\" : \"query\")})`;\n return `API key (${slug})`;\n};\n\nexport const describeOpenApiAuthMethods = (\n record: IntegrationRecord,\n): readonly AuthMethodDescriptor[] => {\n const config = decodeOpenApiIntegrationConfig(record.config);\n if (!config) return [];\n return (config.authenticationTemplate ?? []).map(\n (template: Authentication): AuthMethodDescriptor => {\n const slug = String(template.slug);\n if (template.type === \"oauth\") {\n return {\n id: slug,\n label: \"OAuth2\",\n kind: \"oauth\",\n template: slug,\n oauth: {\n authorizationUrl: template.authorizationUrl,\n tokenUrl: template.tokenUrl,\n scopes: template.scopes,\n },\n };\n }\n const placements = placementsFromAuthentication(template);\n return {\n id: slug,\n label: apiKeyLabel(slug, placements),\n kind: \"apikey\",\n template: slug,\n placements,\n };\n },\n );\n};\n\nexport const describeOpenApiIntegrationDisplay = (\n record: IntegrationRecord,\n): { readonly url?: string } => {\n const config = decodeOpenApiIntegrationConfig(record.config);\n return { url: config?.baseUrl ?? config?.sourceUrl };\n};\n\n// ---------------------------------------------------------------------------\n// Spec → tool definitions (shared by addSpec, resolveTools, and detect)\n// ---------------------------------------------------------------------------\n\ninterface CompiledSpec {\n readonly definitions: readonly ToolDefinition[];\n readonly hoistedDefs: Record<string, unknown>;\n readonly title: string | undefined;\n}\n\nconst compileSpec = (\n specText: string,\n): Effect.Effect<CompiledSpec, OpenApiParseError | OpenApiExtractionError> =>\n Effect.gen(function* () {\n const doc = yield* parse(specText);\n const result = yield* extract(doc);\n const hoistedDefs: Record<string, unknown> = {};\n if (doc.components?.schemas) {\n for (const [k, v] of Object.entries(doc.components.schemas)) {\n hoistedDefs[k] = normalizeOpenApiRefs(v);\n }\n }\n return {\n definitions: compileToolDefinitions(result.operations),\n hoistedDefs,\n title: Option.getOrUndefined(result.title),\n };\n });\n\n// A tool's name carries its structured `group.leaf` path verbatim (e.g.\n// `aliases.deleteAlias`). The address grammar\n// `tools.<integration>.<owner>.<connection>.<tool>` treats `<tool>` as the\n// trailing remainder (see parseToolAddress), so the dotted path needs no\n// flattening — it nests naturally as\n// `tools.<integration>.<owner>.<connection>.aliases.deleteAlias`, matching how\n// the sandbox `tools` proxy joins property access.\n\nconst toolDefsFromCompiled = (compiled: CompiledSpec): readonly ToolDef[] =>\n compiled.definitions.map(\n (def): ToolDef => ({\n name: ToolName.make(def.toolPath),\n description: descriptionFor(def),\n inputSchema: normalizeOpenApiRefs(Option.getOrUndefined(def.operation.inputSchema)),\n outputSchema: openApiTransportOutputSchema(\n normalizeOpenApiRefs(Option.getOrUndefined(def.operation.outputSchema)),\n ),\n annotations: annotationsForOperation(def.operation.method, def.operation.pathTemplate),\n }),\n );\n\nconst storedOperationsFromCompiled = (\n integration: string,\n compiled: CompiledSpec,\n): readonly StoredOperation[] =>\n compiled.definitions.map((def) => ({\n integration,\n toolName: def.toolPath,\n binding: toBinding(def),\n }));\n\n// ---------------------------------------------------------------------------\n// Plugin factory\n// ---------------------------------------------------------------------------\n\nexport interface OpenApiPluginOptions {\n readonly httpClientLayer?: Layer.Layer<HttpClient.HttpClient, never, never>;\n}\n\nconst fetchGoogleDiscoveryBundleConversion = (\n urls: readonly string[],\n httpClientLayer: Layer.Layer<HttpClient.HttpClient, never, never>,\n) =>\n Effect.forEach(\n urls,\n (url) =>\n fetchGoogleDiscoveryDocument(url).pipe(\n Effect.provide(httpClientLayer),\n Effect.map((documentText) => ({ discoveryUrl: url, documentText })),\n ),\n { concurrency: 4 },\n ).pipe(Effect.flatMap((documents) => convertGoogleDiscoveryBundleToOpenApi({ documents })));\n\nexport const openApiPlugin = definePlugin((options?: OpenApiPluginOptions) => {\n const resolveSpecForInput = (\n spec: OpenApiSpecInput,\n httpClientLayer: Layer.Layer<HttpClient.HttpClient, never, never>,\n ): Effect.Effect<\n {\n readonly specText: string;\n readonly baseUrl?: string;\n // The Google Discovery converters derive the `googleOAuth2` oauth template\n // straight from the spec's declared scopes. `addSpec` adopts it when the\n // caller didn't pass an explicit `authenticationTemplate` (the bundle add\n // path has no preview to detect auth from).\n readonly authenticationTemplate?: readonly Authentication[];\n },\n OpenApiParseError | OpenApiExtractionError | OpenApiOAuthError\n > =>\n Effect.gen(function* () {\n if (spec.kind === \"googleDiscovery\") {\n const conversion = yield* fetchGoogleDiscoveryDocument(spec.url).pipe(\n Effect.provide(httpClientLayer),\n Effect.flatMap((documentText) =>\n convertGoogleDiscoveryToOpenApi({\n discoveryUrl: spec.url,\n documentText,\n }),\n ),\n );\n return {\n specText: conversion.specText,\n baseUrl: conversion.baseUrl,\n ...(conversion.authenticationTemplate\n ? { authenticationTemplate: conversion.authenticationTemplate }\n : {}),\n };\n }\n if (spec.kind === \"googleDiscoveryBundle\") {\n const conversion = yield* fetchGoogleDiscoveryBundleConversion(spec.urls, httpClientLayer);\n return {\n specText: conversion.specText,\n baseUrl: conversion.baseUrl,\n ...(conversion.authenticationTemplate\n ? { authenticationTemplate: conversion.authenticationTemplate }\n : {}),\n };\n }\n if (spec.kind === \"url\") {\n const specText = yield* resolveSpecText(spec.url).pipe(Effect.provide(httpClientLayer));\n return { specText };\n }\n return { specText: spec.value };\n });\n\n return {\n id: \"openapi\" as const,\n packageName: \"@executor-js/plugin-openapi\",\n integrationPresets: openApiPresets.map((preset) => ({\n id: preset.id,\n name: preset.name,\n summary: preset.summary,\n ...(preset.url ? { url: preset.url } : {}),\n ...(preset.icon ? { icon: preset.icon } : {}),\n ...(preset.featured ? { featured: preset.featured } : {}),\n })),\n storage: (deps): OpenapiStore => makeDefaultOpenapiStore(deps),\n\n extension: (ctx: PluginCtx<OpenapiStore>) => {\n const httpClientLayer = options?.httpClientLayer ?? ctx.httpClientLayer;\n\n const addSpec = (config: OpenApiSpecConfig) =>\n Effect.gen(function* () {\n // Resolve URL → text and parse BEFORE opening a transaction. Holding\n // `BEGIN` across a network fetch is the Hyperdrive deadlock path.\n const resolved = yield* resolveSpecForInput(config.spec, httpClientLayer);\n const compiled = yield* compileSpec(resolved.specText);\n\n const slug = IntegrationSlug.make(config.slug);\n\n // Block re-adding an existing slug. The core `integrations.register`\n // primitive upserts (so boot re-registration is idempotent), but an\n // explicit add must NOT silently clobber an existing integration's\n // tools, connections, and policies. To add more auth, update the\n // existing integration instead.\n const existing = yield* ctx.core.integrations.get(slug);\n if (existing) {\n return yield* new IntegrationAlreadyExistsError({ slug });\n }\n\n const integrationConfig: OpenApiIntegrationConfig = {\n spec: resolved.specText,\n ...(specInputToSourceUrl(config.spec) !== undefined\n ? { sourceUrl: specInputToSourceUrl(config.spec) }\n : {}),\n ...(specInputToGoogleBundle(config.spec) !== undefined\n ? { googleDiscoveryUrls: specInputToGoogleBundle(config.spec) }\n : {}),\n ...((config.baseUrl ?? resolved.baseUrl)\n ? { baseUrl: config.baseUrl ?? resolved.baseUrl }\n : {}),\n ...(config.headers ? { headers: config.headers } : {}),\n ...(config.queryParams ? { queryParams: config.queryParams } : {}),\n // Prefer the caller's explicit template; otherwise adopt the one the\n // Google Discovery converter derived from the spec (the bundle add\n // path relies on this — it has no preview to detect auth from).\n ...(config.authenticationTemplate\n ? { authenticationTemplate: config.authenticationTemplate }\n : resolved.authenticationTemplate\n ? { authenticationTemplate: resolved.authenticationTemplate }\n : {}),\n };\n\n yield* ctx.transaction(\n Effect.gen(function* () {\n yield* ctx.core.integrations.register({\n slug,\n description: config.description ?? compiled.title ?? config.slug,\n config: integrationConfig satisfies OpenApiIntegrationConfig as IntegrationConfig,\n canRemove: true,\n canRefresh:\n specInputToSourceUrl(config.spec) != null ||\n specInputToGoogleBundle(config.spec) != null,\n });\n yield* ctx.storage.putOperations(\n config.slug,\n storedOperationsFromCompiled(config.slug, compiled),\n );\n }),\n );\n\n return { slug, toolCount: compiled.definitions.length };\n });\n\n return {\n previewSpec: (input: string | OpenApiPreviewInput) =>\n Effect.gen(function* () {\n const previewInput = typeof input === \"string\" ? { spec: input } : input;\n const specText = isGoogleDiscoveryUrl(previewInput.spec)\n ? yield* fetchGoogleDiscoveryDocument(previewInput.spec).pipe(\n Effect.provide(httpClientLayer),\n Effect.flatMap((documentText) =>\n convertGoogleDiscoveryToOpenApi({\n discoveryUrl: previewInput.spec,\n documentText,\n }),\n ),\n Effect.map((conversion) => conversion.specText),\n )\n : yield* resolveSpecText(previewInput.spec).pipe(Effect.provide(httpClientLayer));\n return yield* previewSpec(specText).pipe(Effect.provide(httpClientLayer));\n }),\n\n addSpec,\n\n removeSpec: (slug: string) =>\n ctx.transaction(\n Effect.gen(function* () {\n yield* ctx.storage.removeOperations(slug);\n yield* ctx.core.integrations\n .remove(IntegrationSlug.make(slug))\n .pipe(Effect.catchTag(\"IntegrationRemovalNotAllowedError\", () => Effect.void));\n }),\n ),\n\n getIntegration: (slug: string) =>\n ctx.core.integrations.get(IntegrationSlug.make(slug)).pipe(\n Effect.map((record) =>\n record\n ? ({\n slug: record.slug,\n description: record.description,\n kind: record.kind,\n canRemove: record.canRemove,\n canRefresh: record.canRefresh,\n } as Integration)\n : null,\n ),\n ),\n\n getConfig: (slug: string): Effect.Effect<OpenApiIntegrationConfig | null, StorageFailure> =>\n ctx.core.integrations\n .get(IntegrationSlug.make(slug))\n .pipe(\n Effect.map((record) =>\n record ? decodeOpenApiIntegrationConfig(record.config) : null,\n ),\n ),\n\n configure: (\n slug: string,\n input: OpenApiConfigureInput,\n ): Effect.Effect<readonly Authentication[], StorageFailure> =>\n ctx.transaction(\n Effect.gen(function* () {\n const record = yield* ctx.core.integrations.get(IntegrationSlug.make(slug));\n if (!record) return [] as readonly Authentication[];\n const current = decodeOpenApiIntegrationConfig(record.config);\n if (!current) return [] as readonly Authentication[];\n\n const merged =\n input.mode === \"replace\"\n ? input.authenticationTemplate\n : mergeAuthenticationTemplate(\n current.authenticationTemplate ?? [],\n input.authenticationTemplate,\n );\n\n const next: OpenApiIntegrationConfig = {\n ...current,\n authenticationTemplate: merged,\n };\n\n yield* ctx.core.integrations.update(IntegrationSlug.make(slug), {\n config: next satisfies OpenApiIntegrationConfig as IntegrationConfig,\n });\n\n return merged;\n }),\n ),\n };\n },\n\n staticSources: (self: OpenApiPluginExtension) => [\n {\n id: \"openapi\",\n kind: \"executor\",\n name: \"OpenAPI\",\n tools: [\n tool({\n name: \"previewSpec\",\n description:\n \"Preview an OpenAPI document before adding it as an integration. Call this first when the user provides a spec URL/blob so you can inspect servers, auth schemes, operation count, and tags before `addSpec`. Do not collect API keys or OAuth client secrets in chat; use the connections tools for those values.\",\n inputSchema: PreviewSpecInputStandardSchema,\n outputSchema: PreviewSpecOutputStandardSchema,\n execute: (input: typeof PreviewSpecInputSchema.Type) =>\n self.previewSpec(input).pipe(\n Effect.map((preview) => ToolResult.ok(staticPreviewOutput(preview))),\n Effect.catchTags({\n OpenApiParseError: ({ message }: OpenApiParseError) =>\n Effect.succeed(openApiToolFailure(\"openapi_parse_failed\", message)),\n OpenApiExtractionError: ({ message }: OpenApiExtractionError) =>\n Effect.succeed(openApiToolFailure(\"openapi_extraction_failed\", message)),\n OpenApiOAuthError: ({ message }: OpenApiOAuthError) =>\n Effect.succeed(openApiToolFailure(\"openapi_oauth_failed\", message)),\n }),\n ),\n }),\n tool({\n name: \"addSpec\",\n description:\n \"Add an OpenAPI integration to the catalog and persist its operations as tools. Recommended flow: call `previewSpec`, choose a `slug`, declare an `authenticationTemplate` for how a credential is applied (apiKey header/query, or oauth bearer), then create a connection for that integration with the user's API key or via `oauth.start`.\",\n annotations: {\n requiresApproval: true,\n approvalDescription: \"Add an OpenAPI integration\",\n },\n inputSchema: AddSourceInputStandardSchema,\n outputSchema: AddSourceOutputStandardSchema,\n execute: (input: typeof AddSourceInputSchema.Type) =>\n self\n .addSpec({\n spec: input.spec,\n slug: input.slug,\n description: input.description,\n baseUrl: input.baseUrl,\n headers: input.headers,\n queryParams: input.queryParams,\n authenticationTemplate: input.authenticationTemplate as\n | readonly Authentication[]\n | undefined,\n })\n .pipe(\n Effect.map((result) =>\n ToolResult.ok({\n slug: String(result.slug),\n toolCount: result.toolCount,\n }),\n ),\n Effect.catchTags({\n OpenApiParseError: ({ message }: OpenApiParseError) =>\n Effect.succeed(openApiToolFailure(\"openapi_parse_failed\", message)),\n OpenApiExtractionError: ({ message }: OpenApiExtractionError) =>\n Effect.succeed(openApiToolFailure(\"openapi_extraction_failed\", message)),\n OpenApiOAuthError: ({ message }: OpenApiOAuthError) =>\n Effect.succeed(openApiToolFailure(\"openapi_oauth_failed\", message)),\n IntegrationAlreadyExistsError: ({ slug }: IntegrationAlreadyExistsError) =>\n Effect.succeed(\n openApiToolFailure(\n \"integration_already_exists\",\n `Integration ${slug} already exists; update it instead of re-adding.`,\n ),\n ),\n }),\n ),\n }),\n ],\n },\n ],\n\n describeAuthMethods: describeOpenApiAuthMethods,\n describeIntegrationDisplay: describeOpenApiIntegrationDisplay,\n\n // Produce one tool per spec operation. Spec-derived, identical for every\n // connection on the integration — so `getValue` is never called here. The\n // operation bindings invokeTool needs are persisted at addSpec time; this\n // hook only shapes the per-connection ToolDefs from the catalog config.\n resolveTools: ({\n config,\n }: {\n readonly integration: Integration;\n readonly config: IntegrationConfig;\n }): Effect.Effect<ResolveToolsResult, StorageFailure> =>\n Effect.gen(function* () {\n const openApiConfig = decodeOpenApiIntegrationConfig(config);\n if (!openApiConfig) return { tools: [], definitions: {} };\n const compiled = yield* compileSpec(openApiConfig.spec).pipe(\n Effect.catch(() => Effect.succeed(null)),\n );\n if (!compiled) return { tools: [], definitions: {} };\n return {\n tools: toolDefsFromCompiled(compiled),\n definitions: compiled.hoistedDefs,\n };\n }),\n\n invokeTool: ({\n ctx: invokeCtx,\n toolRow,\n credential,\n args,\n }: {\n readonly ctx: PluginCtx<OpenapiStore>;\n readonly toolRow: { readonly integration: string; readonly name: string };\n readonly credential: ToolInvocationCredential;\n readonly args: unknown;\n }) =>\n Effect.gen(function* () {\n const httpClientLayer = options?.httpClientLayer ?? invokeCtx.httpClientLayer;\n const integration = toolRow.integration;\n const config = decodeOpenApiIntegrationConfig(credential.config);\n\n // Resolve the operation binding from the plugin store; fall back to\n // deriving it from the catalog spec when the store has no row (e.g. an\n // integration registered without going through addSpec).\n let binding = (yield* invokeCtx.storage.getOperation(integration, toolRow.name))?.binding;\n if (!binding && config) {\n const compiled = yield* compileSpec(config.spec).pipe(\n Effect.catch(() => Effect.succeed(null)),\n );\n binding = compiled\n ? storedOperationsFromCompiled(integration, compiled).find(\n (op) => op.toolName === toolRow.name,\n )?.binding\n : undefined;\n }\n if (!binding) {\n return yield* new OpenApiExtractionError({\n message: `No OpenAPI operation found for tool \"${toolRow.name}\" on \"${integration}\"`,\n });\n }\n\n const headers: Record<string, string> = { ...(config?.headers ?? {}) };\n const queryParams: Record<string, string> = {\n ...(config?.queryParams ?? {}),\n };\n\n // Apply the auth template (D11): render the connection's resolved inputs\n // into the matching template's header/query slots (apiKey) or as a bearer\n // Authorization header (oauth). A method with two distinct inputs (e.g.\n // Datadog) renders each from its own value.\n const template = (config?.authenticationTemplate ?? []).find(\n (entry) => String(entry.slug) === String(credential.template),\n );\n if (template) {\n // Fail if ANY input the template requires is unresolved — not just the\n // primary `token` (a Datadog connection has no `token`, only its keys).\n const missing = requiredTemplateVariables(template).filter((name) => {\n const value = credential.values[name];\n return value == null || value === \"\";\n });\n if (missing.length > 0) {\n return openApiAuthToolFailure({\n code:\n template.type === \"oauth\" ? \"oauth_connection_missing\" : \"connection_value_missing\",\n message: `Connection \"${credential.connection}\" for \"${integration}\" has no resolvable credential value. Re-authenticate or update the connection.`,\n owner: credential.owner,\n integration,\n connection: String(credential.connection),\n credentialKind: template.type === \"oauth\" ? \"oauth\" : \"secret\",\n });\n }\n const rendered = renderAuthTemplate(template, credential.values);\n Object.assign(headers, rendered.headers);\n Object.assign(queryParams, rendered.queryParams);\n }\n\n const result = yield* invokeWithLayer(\n binding,\n (args ?? {}) as Record<string, unknown>,\n config?.baseUrl ?? \"\",\n headers,\n queryParams,\n httpClientLayer,\n );\n\n const ok = result.status >= 200 && result.status < 300;\n if (!ok) {\n if (result.status === 401 || result.status === 403) {\n return openApiAuthToolFailure({\n code: \"connection_rejected\",\n status: result.status,\n message: `Upstream rejected credentials for \"${integration}\" with HTTP ${result.status}. Re-authenticate or update the connection \"${credential.connection}\" before retrying this tool.`,\n owner: credential.owner,\n integration,\n connection: String(credential.connection),\n credentialKind: \"upstream\",\n credentialLabel: \"Upstream authorization\",\n details: result.error,\n });\n }\n return ToolResult.fail({\n code: \"upstream_http_error\",\n status: result.status,\n message: extractUpstreamMessage(result.error, result.status),\n details: result.error,\n });\n }\n return ToolResult.ok({\n status: result.status,\n headers: result.headers,\n data: result.data,\n });\n }),\n\n resolveAnnotations: ({\n ctx: annotationsCtx,\n integration,\n toolRows,\n }: {\n readonly ctx: PluginCtx<OpenapiStore>;\n readonly integration: string;\n readonly toolRows: readonly { readonly name: string }[];\n }) =>\n Effect.gen(function* () {\n const ops = yield* annotationsCtx.storage.listOperations(String(integration));\n const byName = new Map<string, OperationBinding>();\n for (const op of ops) byName.set(op.toolName, op.binding);\n const out: Record<string, ReturnType<typeof annotationsForOperation>> = {};\n for (const row of toolRows) {\n const binding = byName.get(row.name);\n if (binding) {\n out[row.name] = annotationsForOperation(binding.method, binding.pathTemplate);\n }\n }\n return out;\n }),\n\n removeConnection: () => Effect.void,\n\n detect: ({\n ctx: detectCtx,\n url,\n }: {\n readonly ctx: PluginCtx<OpenapiStore>;\n readonly url: string;\n }) =>\n Effect.gen(function* () {\n const httpClientLayer = options?.httpClientLayer ?? detectCtx.httpClientLayer;\n const trimmed = url.trim();\n if (!trimmed) return null;\n const parsed = yield* Effect.try({\n try: () => new URL(trimmed),\n catch: (error) => error,\n }).pipe(Effect.option);\n if (Option.isNone(parsed)) return null;\n if (isGoogleDiscoveryUrl(trimmed)) {\n const conversion = yield* fetchGoogleDiscoveryDocument(trimmed).pipe(\n Effect.provide(httpClientLayer),\n Effect.flatMap((documentText) =>\n convertGoogleDiscoveryToOpenApi({\n discoveryUrl: trimmed,\n documentText,\n }),\n ),\n Effect.catch(() => Effect.succeed(null)),\n );\n if (conversion) {\n return IntegrationDetectionResult.make({\n kind: \"openapi\",\n confidence: \"high\",\n endpoint: trimmed,\n name: conversion.title,\n slug:\n conversion.title\n .toLowerCase()\n .replace(/[^a-z0-9]+/g, \"_\")\n .replace(/^_+|_+$/g, \"\") || `google_${conversion.service}`,\n });\n }\n }\n const specText = yield* resolveSpecText(trimmed).pipe(\n Effect.provide(httpClientLayer),\n Effect.catch(() => Effect.succeed(null)),\n );\n if (specText === null) return null;\n const doc = yield* parse(specText).pipe(Effect.catch(() => Effect.succeed(null)));\n if (!doc) return null;\n const result = yield* extract(doc).pipe(Effect.catch(() => Effect.succeed(null)));\n if (!result) return null;\n const slug = Option.getOrElse(result.title, () => \"api\")\n .toLowerCase()\n .replace(/[^a-z0-9]+/g, \"_\");\n const name = Option.getOrElse(result.title, () => slug);\n return IntegrationDetectionResult.make({\n kind: \"openapi\",\n confidence: \"high\",\n endpoint: trimmed,\n name,\n slug,\n });\n }),\n };\n // HTTP transport (routes/handlers/extensionService) is layered on by\n // the api-aware factory in `@executor-js/plugin-openapi/api`. Hosts that\n // want the HTTP surface import the plugin from there; SDK-only consumers\n // stay on this entry and avoid the server-only deps.\n});\n","/**\n * Derives structured `group.leaf` tool paths from extracted OpenAPI operations.\n *\n * Ported from the v3 executor's `definitions.ts`. Turns flat operation IDs like\n * `zones_listZones` into nested paths like `zones.listZones` that the tree UI\n * can render with proper nesting.\n */\n\nimport { Option } from \"effect\";\n\nimport type { ExtractedOperation } from \"./types\";\n\n// ---------------------------------------------------------------------------\n// Word / case utilities\n// ---------------------------------------------------------------------------\n\nconst splitWords = (value: string): string[] =>\n value\n .replace(/([a-z0-9])([A-Z])/g, \"$1 $2\")\n .replace(/([A-Z]+)([A-Z][a-z0-9]+)/g, \"$1 $2\")\n .replace(/[^a-zA-Z0-9]+/g, \" \")\n .trim()\n .split(/\\s+/)\n .filter((part) => part.length > 0);\n\nconst normalizeWord = (value: string): string => value.toLowerCase();\n\nconst toCamelCase = (value: string): string => {\n const words = splitWords(value).map(normalizeWord);\n if (words.length === 0) return \"tool\";\n const [first, ...rest] = words;\n return `${first}${rest.map((p) => `${p[0]?.toUpperCase() ?? \"\"}${p.slice(1)}`).join(\"\")}`;\n};\n\nconst toPascalCase = (value: string): string => {\n const camel = toCamelCase(value);\n return `${camel[0]?.toUpperCase() ?? \"\"}${camel.slice(1)}`;\n};\n\n// ---------------------------------------------------------------------------\n// Path utilities\n// ---------------------------------------------------------------------------\n\nconst VERSION_SEGMENT_REGEX = /^v\\d+(?:[._-]\\d+)?$/i;\nconst IGNORED_PATH_SEGMENTS = new Set([\"api\"]);\n\nconst pathSegmentsFromTemplate = (pathTemplate: string): string[] =>\n pathTemplate\n .split(\"/\")\n .map((s) => s.trim())\n .filter((s) => s.length > 0);\n\nconst isPathParameterSegment = (segment: string): boolean =>\n segment.startsWith(\"{\") && segment.endsWith(\"}\");\n\nconst normalizeGroupSegment = (value: string | undefined): string | null => {\n const candidate = value?.trim();\n if (!candidate) return null;\n return toCamelCase(candidate);\n};\n\n// ---------------------------------------------------------------------------\n// Derivation\n// ---------------------------------------------------------------------------\n\nconst deriveVersionSegment = (pathTemplate: string): string | undefined =>\n pathSegmentsFromTemplate(pathTemplate)\n .map((s) => s.toLowerCase())\n .find((s) => VERSION_SEGMENT_REGEX.test(s));\n\nconst derivePathGroup = (pathTemplate: string): string => {\n for (const segment of pathSegmentsFromTemplate(pathTemplate)) {\n const lower = segment.toLowerCase();\n if (VERSION_SEGMENT_REGEX.test(lower)) continue;\n if (IGNORED_PATH_SEGMENTS.has(lower)) continue;\n if (isPathParameterSegment(segment)) continue;\n return normalizeGroupSegment(segment) ?? \"root\";\n }\n return \"root\";\n};\n\nconst splitOperationIdSegments = (value: string): string[] =>\n value\n .split(/[/.]+/)\n .map((s) => s.trim())\n .filter((s) => s.length > 0);\n\nconst deriveLeafSeed = (operationId: string, group: string): string => {\n const segments = splitOperationIdSegments(operationId);\n if (segments.length > 1) {\n const [first, ...rest] = segments;\n if ((normalizeGroupSegment(first) ?? first) === group && rest.length > 0) {\n return rest.join(\" \");\n }\n }\n return operationId;\n};\n\nconst fallbackLeafSeed = (method: string, pathTemplate: string, group: string): string => {\n const relevantSegments = pathSegmentsFromTemplate(pathTemplate)\n .filter((s) => !VERSION_SEGMENT_REGEX.test(s.toLowerCase()))\n .filter((s) => !IGNORED_PATH_SEGMENTS.has(s.toLowerCase()))\n .filter((s) => !isPathParameterSegment(s))\n .map((s) => normalizeGroupSegment(s) ?? s)\n .filter((s) => s !== group);\n\n const segmentSuffix = relevantSegments.map((s) => toPascalCase(s)).join(\"\");\n return `${method}${segmentSuffix || \"Operation\"}`;\n};\n\nconst deriveLeaf = (\n operationId: string,\n method: string,\n pathTemplate: string,\n group: string,\n): string => {\n const preferred = toCamelCase(deriveLeafSeed(operationId, group));\n if (preferred.length > 0 && preferred !== group) return preferred;\n return toCamelCase(fallbackLeafSeed(method, pathTemplate, group));\n};\n\n// ---------------------------------------------------------------------------\n// Public types\n// ---------------------------------------------------------------------------\n\nexport interface ToolDefinition {\n /** Dot-separated path like `zones.listZones` */\n readonly toolPath: string;\n /** The group segment */\n readonly group: string;\n /** The leaf segment */\n readonly leaf: string;\n /** Index into the original operations array */\n readonly operationIndex: number;\n /** The original operation */\n readonly operation: ExtractedOperation;\n}\n\n// ---------------------------------------------------------------------------\n// Collision resolution\n// ---------------------------------------------------------------------------\n\nconst resolveCollisions = (\n definitions: {\n toolPath: string;\n group: string;\n leaf: string;\n versionSegment: string | undefined;\n method: string;\n operationHash: string;\n operationIndex: number;\n operation: ExtractedOperation;\n }[],\n): ToolDefinition[] => {\n // Mutable — we progressively refine toolPath on collision\n const staged = definitions.map((d) => ({ ...d }));\n\n const applyFactory = (items: typeof staged, factory: (d: (typeof staged)[number]) => string) => {\n const byPath = new Map<string, typeof staged>();\n for (const item of items) {\n const bucket = byPath.get(item.toolPath) ?? [];\n bucket.push(item);\n byPath.set(item.toolPath, bucket);\n }\n for (const bucket of byPath.values()) {\n if (bucket.length < 2) continue;\n for (const d of bucket) {\n d.toolPath = factory(d);\n }\n }\n };\n\n // Round 1: add version segment\n applyFactory(staged, (d) =>\n d.versionSegment ? `${d.group}.${d.versionSegment}.${d.leaf}` : d.toolPath,\n );\n\n // Round 2: add method suffix\n applyFactory(staged, (d) => {\n const prefix = d.versionSegment ? `${d.group}.${d.versionSegment}` : d.group;\n return `${prefix}.${d.leaf}${toPascalCase(d.method)}`;\n });\n\n // Round 3: add hash suffix\n applyFactory(staged, (d) => {\n const prefix = d.versionSegment ? `${d.group}.${d.versionSegment}` : d.group;\n return `${prefix}.${d.leaf}${toPascalCase(d.method)}${d.operationHash.slice(0, 8)}`;\n });\n\n return staged.map((d) => ({\n toolPath: d.toolPath,\n group: d.group,\n leaf: d.leaf,\n operationIndex: d.operationIndex,\n operation: d.operation,\n }));\n};\n\n// ---------------------------------------------------------------------------\n// Stable hash (simple, deterministic)\n// ---------------------------------------------------------------------------\n\nconst stableHash = (value: unknown): string => {\n const str = JSON.stringify(value, Object.keys(value as Record<string, unknown>).sort());\n let hash = 0;\n for (let i = 0; i < str.length; i++) {\n hash = ((hash << 5) - hash + str.charCodeAt(i)) | 0;\n }\n return Math.abs(hash).toString(36).padStart(8, \"0\");\n};\n\n// ---------------------------------------------------------------------------\n// Main entry point\n// ---------------------------------------------------------------------------\n\n/**\n * Compile extracted operations into tool definitions with structured\n * `group.leaf` paths suitable for tree rendering.\n */\nexport const compileToolDefinitions = (\n operations: readonly ExtractedOperation[],\n): ToolDefinition[] => {\n const raw = operations.map((op, index) => {\n const operationId = op.operationId;\n const explicitToolPath = Option.getOrUndefined(op.toolPath);\n if (explicitToolPath) {\n const [group = \"root\", ...leafParts] = explicitToolPath.split(\".\").filter(Boolean);\n const leaf = leafParts.join(\".\") || group;\n const versionSegment = deriveVersionSegment(op.pathTemplate);\n const operationHash = stableHash({\n method: op.method,\n path: op.pathTemplate,\n operationId,\n });\n\n return {\n toolPath: explicitToolPath,\n group,\n leaf,\n versionSegment,\n method: op.method,\n operationHash,\n operationIndex: index,\n operation: op,\n };\n }\n\n const group = normalizeGroupSegment(op.tags[0]) ?? derivePathGroup(op.pathTemplate);\n const leaf = deriveLeaf(operationId, op.method, op.pathTemplate, group);\n const versionSegment = deriveVersionSegment(op.pathTemplate);\n const operationHash = stableHash({\n method: op.method,\n path: op.pathTemplate,\n operationId,\n });\n\n return {\n toolPath: `${group}.${leaf}`,\n group,\n leaf,\n versionSegment,\n method: op.method,\n operationHash,\n operationIndex: index,\n operation: op,\n };\n });\n\n return resolveCollisions(raw).sort((a, b) => a.toolPath.localeCompare(b.toolPath));\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,QAAQ,cAAc;AAiB/B,IAAM,+BAA+B,OAAO,OAAO;AAAA,EACjD,MAAM,OAAO,QAAQ,UAAU;AAAA,EAC/B,MAAM,OAAO;AACf,CAAC;AAED,IAAM,oCAAoC,OAAO,MAAM;AAAA,EACrD,OAAO;AAAA,EACP,OAAO,MAAM,OAAO,MAAM,CAAC,OAAO,QAAQ,4BAA4B,CAAC,CAAC;AAC1E,CAAC;AAED,IAAM,6BAA6B,OAAO,OAAO;AAAA,EAC/C,MAAM,OAAO;AAAA,EACb,MAAM,OAAO,QAAQ,QAAQ;AAAA,EAC7B,SAAS,OAAO,SAAS,OAAO,OAAO,OAAO,QAAQ,iCAAiC,CAAC;AAAA,EACxF,aAAa,OAAO,SAAS,OAAO,OAAO,OAAO,QAAQ,iCAAiC,CAAC;AAC9F,CAAC;AAED,IAAM,4BAA4B,OAAO,OAAO;AAAA,EAC9C,MAAM,OAAO;AAAA,EACb,MAAM,OAAO,QAAQ,OAAO;AAAA,EAC5B,kBAAkB,OAAO;AAAA,EACzB,UAAU,OAAO;AAAA,EACjB,QAAQ,OAAO,MAAM,OAAO,MAAM;AACpC,CAAC;AAEM,IAAM,uBAAuB,OAAO,MAAM;AAAA,EAC/C;AAAA,EACA;AACF,CAAC;AAEM,IAAM,iCAAiC,OAAO,OAAO;AAAA;AAAA,EAE1D,MAAM,OAAO;AAAA;AAAA,EAEb,WAAW,OAAO,SAAS,OAAO,MAAM;AAAA;AAAA,EAExC,qBAAqB,OAAO,SAAS,OAAO,MAAM,OAAO,MAAM,CAAC;AAAA;AAAA,EAEhE,SAAS,OAAO,SAAS,OAAO,MAAM;AAAA;AAAA,EAEtC,SAAS,OAAO,SAAS,OAAO,OAAO,OAAO,QAAQ,OAAO,M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MAAM,QAAQ,EAAE,KAAKA,QAAO,MAAM,MAAMA,QAAO,QAAQ,IAAI,CAAC,CAAC;AAChF,UAAI,CAAC,IAAK,QAAO;AACjB,YAAM,SAAS,OAAO,QAAQ,GAAG,EAAE,KAAKA,QAAO,MAAM,MAAMA,QAAO,QAAQ,IAAI,CAAC,CAAC;AAChF,UAAI,CAAC,OAAQ,QAAO;AACpB,YAAM,OAAON,QAAO,UAAU,OAAO,OAAO,MAAM,KAAK,EACpD,YAAY,EACZ,QAAQ,eAAe,GAAG;AAC7B,YAAM,OAAOA,QAAO,UAAU,OAAO,OAAO,MAAM,IAAI;AACtD,aAAO,2BAA2B,KAAK;AAAA,QACrC,MAAM;AAAA,QACN,YAAY;AAAA,QACZ,UAAU;AAAA,QACV;AAAA,QACA;AAAA,MACF,CAAC;AAAA,IACH,CAAC;AAAA,EACL;AAKF,CAAC;","names":["Option","Option","bytes","Effect","Option","Schema","Schema","Option","Effect","Effect","Option","Schema","Option","group","leaf","versionSegment","operationHash","Schema","Option","message","AuthenticationVariableSchema","AuthenticationTemplateValueSchema","AuthenticationSchema","changed","Effect"]}