@wildo-ai/external-connectors-models 1.1.4 → 1.1.5

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 (89) hide show
  1. package/dist/esm/companion-exports.d.ts.map +1 -1
  2. package/dist/esm/core/commons.external-connectors-models.schemas.d.ts +13 -132
  3. package/dist/esm/core/commons.external-connectors-models.schemas.d.ts.map +1 -1
  4. package/dist/esm/core/commons.external-connectors-models.schemas.js +13 -31
  5. package/dist/esm/core/commons.external-connectors-models.schemas.js.map +1 -1
  6. package/dist/esm/core/operation-classification.external-connectors-models.schemas.d.ts.map +1 -1
  7. package/dist/esm/core/operation-classification.external-connectors-models.schemas.js.map +1 -1
  8. package/dist/esm/core/security.external-connectors-models.schemas.d.ts +40 -8
  9. package/dist/esm/core/security.external-connectors-models.schemas.d.ts.map +1 -1
  10. package/dist/esm/core/security.external-connectors-models.schemas.js +61 -14
  11. package/dist/esm/core/security.external-connectors-models.schemas.js.map +1 -1
  12. package/dist/esm/index.d.ts +2 -2
  13. package/dist/esm/index.d.ts.map +1 -1
  14. package/dist/esm/index.js +2 -2
  15. package/dist/esm/index.js.map +1 -1
  16. package/dist/esm/protocols/agent-client-protocol.external-connectors-models.schemas.d.ts +26 -163
  17. package/dist/esm/protocols/agent-client-protocol.external-connectors-models.schemas.d.ts.map +1 -1
  18. package/dist/esm/protocols/agent-client-protocol.external-connectors-models.schemas.js +20 -92
  19. package/dist/esm/protocols/agent-client-protocol.external-connectors-models.schemas.js.map +1 -1
  20. package/dist/esm/protocols/billing.standard-interface.schemas.d.ts +130 -10
  21. package/dist/esm/protocols/billing.standard-interface.schemas.d.ts.map +1 -1
  22. package/dist/esm/protocols/billing.standard-interface.schemas.js +41 -0
  23. package/dist/esm/protocols/billing.standard-interface.schemas.js.map +1 -1
  24. package/dist/esm/protocols/document-extraction.external-connectors-models.schemas.d.ts +1 -16
  25. package/dist/esm/protocols/document-extraction.external-connectors-models.schemas.d.ts.map +1 -1
  26. package/dist/esm/protocols/document-extraction.external-connectors-models.schemas.js +1 -7
  27. package/dist/esm/protocols/document-extraction.external-connectors-models.schemas.js.map +1 -1
  28. package/dist/esm/protocols/email.external-connectors-models.schemas.d.ts +1 -56
  29. package/dist/esm/protocols/email.external-connectors-models.schemas.d.ts.map +1 -1
  30. package/dist/esm/protocols/email.external-connectors-models.schemas.js +0 -20
  31. package/dist/esm/protocols/email.external-connectors-models.schemas.js.map +1 -1
  32. package/dist/esm/protocols/email.standard-interface.schemas.d.ts +4 -4
  33. package/dist/esm/protocols/email.standard-interface.schemas.d.ts.map +1 -1
  34. package/dist/esm/protocols/embeddings.external-connectors-models.schemas.d.ts +1 -16
  35. package/dist/esm/protocols/embeddings.external-connectors-models.schemas.d.ts.map +1 -1
  36. package/dist/esm/protocols/embeddings.external-connectors-models.schemas.js +4 -9
  37. package/dist/esm/protocols/embeddings.external-connectors-models.schemas.js.map +1 -1
  38. package/dist/esm/protocols/frontend.external-connectors-models.schemas.d.ts +6 -13
  39. package/dist/esm/protocols/frontend.external-connectors-models.schemas.d.ts.map +1 -1
  40. package/dist/esm/protocols/frontend.external-connectors-models.schemas.js +0 -9
  41. package/dist/esm/protocols/frontend.external-connectors-models.schemas.js.map +1 -1
  42. package/dist/esm/protocols/hooks-capability.external-connectors-models.schemas.d.ts.map +1 -1
  43. package/dist/esm/protocols/hooks-capability.external-connectors-models.schemas.js.map +1 -1
  44. package/dist/esm/protocols/hooks.external-connectors-models.schemas.d.ts +1 -15
  45. package/dist/esm/protocols/hooks.external-connectors-models.schemas.d.ts.map +1 -1
  46. package/dist/esm/protocols/hooks.external-connectors-models.schemas.js +1 -9
  47. package/dist/esm/protocols/hooks.external-connectors-models.schemas.js.map +1 -1
  48. package/dist/esm/protocols/image.external-connectors-models.schemas.d.ts +1 -18
  49. package/dist/esm/protocols/image.external-connectors-models.schemas.d.ts.map +1 -1
  50. package/dist/esm/protocols/image.external-connectors-models.schemas.js +1 -7
  51. package/dist/esm/protocols/image.external-connectors-models.schemas.js.map +1 -1
  52. package/dist/esm/protocols/llm.external-connectors-models.schemas.d.ts +92 -40
  53. package/dist/esm/protocols/llm.external-connectors-models.schemas.d.ts.map +1 -1
  54. package/dist/esm/protocols/llm.external-connectors-models.schemas.js +154 -41
  55. package/dist/esm/protocols/llm.external-connectors-models.schemas.js.map +1 -1
  56. package/dist/esm/protocols/oauth2-provider-assurance.definitions.d.ts +7 -0
  57. package/dist/esm/protocols/oauth2-provider-assurance.definitions.d.ts.map +1 -0
  58. package/dist/esm/protocols/oauth2-provider-assurance.definitions.js +36 -0
  59. package/dist/esm/protocols/oauth2-provider-assurance.definitions.js.map +1 -0
  60. package/dist/esm/protocols/oauth2-provider-assurance.schemas.d.ts +23 -0
  61. package/dist/esm/protocols/oauth2-provider-assurance.schemas.d.ts.map +1 -0
  62. package/dist/esm/protocols/oauth2-provider-assurance.schemas.js +25 -0
  63. package/dist/esm/protocols/oauth2-provider-assurance.schemas.js.map +1 -0
  64. package/dist/esm/protocols/oauth2.external-connectors-models.schemas.d.ts +0 -148
  65. package/dist/esm/protocols/oauth2.external-connectors-models.schemas.d.ts.map +1 -1
  66. package/dist/esm/protocols/oauth2.external-connectors-models.schemas.js +1 -40
  67. package/dist/esm/protocols/oauth2.external-connectors-models.schemas.js.map +1 -1
  68. package/dist/esm/protocols/rest-operations.external-connectors-models.schemas.d.ts +530 -15
  69. package/dist/esm/protocols/rest-operations.external-connectors-models.schemas.d.ts.map +1 -1
  70. package/dist/esm/protocols/rest-operations.external-connectors-models.schemas.js +380 -0
  71. package/dist/esm/protocols/rest-operations.external-connectors-models.schemas.js.map +1 -1
  72. package/dist/esm/protocols/sms.external-connectors-models.schemas.d.ts +0 -39
  73. package/dist/esm/protocols/sms.external-connectors-models.schemas.d.ts.map +1 -1
  74. package/dist/esm/protocols/sms.external-connectors-models.schemas.js +0 -13
  75. package/dist/esm/protocols/sms.external-connectors-models.schemas.js.map +1 -1
  76. package/dist/esm/protocols/sms.standard-interface.schemas.d.ts +1 -1
  77. package/dist/esm/protocols/sms.standard-interface.schemas.d.ts.map +1 -1
  78. package/dist/esm/protocols/sms.standard-interface.schemas.js.map +1 -1
  79. package/dist/tsconfig.build.tsbuildinfo +1 -1
  80. package/package.json +2 -3
  81. package/dist/esm/.native.tsbuildinfo +0 -1
  82. package/dist/esm/core/protocols.external-connectors-models.schemas.d.ts +0 -74
  83. package/dist/esm/core/protocols.external-connectors-models.schemas.d.ts.map +0 -1
  84. package/dist/esm/core/protocols.external-connectors-models.schemas.js +0 -1
  85. package/dist/esm/core/protocols.external-connectors-models.schemas.js.map +0 -1
  86. package/dist/esm/protocols/rest-api.external-connectors-models.schemas.d.ts +0 -37
  87. package/dist/esm/protocols/rest-api.external-connectors-models.schemas.d.ts.map +0 -1
  88. package/dist/esm/protocols/rest-api.external-connectors-models.schemas.js +0 -10
  89. package/dist/esm/protocols/rest-api.external-connectors-models.schemas.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"document-extraction.external-connectors-models.schemas.js","sourceRoot":"","sources":["../../../src/protocols/document-extraction.external-connectors-models.schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EAEL,sCAAsC,EAEtC,mDAAmD,GACpD,MAAM,oDAAoD,CAAA;AAE3D,iEAAiE;AACjE,+BAA+B;AAC/B,WAAW;AACX,iEAAiE;AACjE,6EAA6E;AAC7E,mDAAmD;AACnD,EAAE;AACF,kEAAkE;AAClE,EAAE;AACF,iFAAiF;AACjF,iFAAiF;AACjF,gFAAgF;AAChF,+EAA+E;AAC/E,iFAAiF;AACjF,EAAE;AACF,+DAA+D;AAC/D,EAAE;AACF,kFAAkF;AAClF,iFAAiF;AACjF,8EAA8E;AAC9E,gFAAgF;AAChF,gFAAgF;AAChF,4EAA4E;AAC5E,4EAA4E;AAC5E,qEAAqE;AACrE,EAAE;AACF,8EAA8E;AAC9E,gFAAgF;AAChF,gFAAgF;AAChF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K,GAAG,CAAC;IAC3D,MAAM,mBAAmB,GAAG,MAAM,KAAK,GAAG,IAAI,MAAM,KAAK,GAAG,CAAC;IAC7D,MAAM,aAAa,GAAG,MAAM,IAAI,GAAG,CAAC;IACpC,OAAO,iBAAiB,IAAI,mBAAmB,IAAI,aAAa;QAC9D,CAAC,CAAC,+BAA+B,CAAC,oBAAoB;QACtD,CAAC,CAAC,+BAA+B,CAAC,mBAAmB,CAAC;AAC1D,CAAC,CAAC;AAEF,kEAAkE;AAClE,SAAS;AACT,kEAAkE;AAElE,MAAM,CAAC,MAAM,uCAAuC,GAAG,mDAAmD,CAAC,MAAM,CAAC;IAChH,YAAY,EAAE,CAAC,CAAC,OAAO,CAAC,sCAAsC,CAAC,4BAA4B,CAAC;CAC7F,CAAC,CAAC","sourcesContent":["import { z } from \"zod\"\nimport {\n ExternalProvider_ExchangeProtocol_Configuration_Base,\n ExternalProvider_ExchangeProtocol_Kind,\n ExternalProvider_ExchangeProtocol_Profile_Base,\n ExternalProvider_ExchangeProtocol_Status_BaseSchema,\n} from \"../core/commons.external-connectors-models.schemas\"\n\n//===============================================================\n// Document Extraction Provider\n// --------\n// Document bytes → text. Serves the file-side TEXT PROVIDER that\n// `FileTextExtractionBackendService` owns, whose largest consumer is the RAG\n// ingestion path (`.ragSource()` corpus building).\n//\n// ## Why this is a provider at all, and not just a better library\n//\n// The local `pdfjs-dist` path reads a PDF's TEXT LAYER. A scanned document — the\n// common case for uploaded contracts, invoices and forms — is an IMAGE of a page\n// and carries no text layer, so it extracts to the empty string, contributes no\n// chunks, and becomes silently unanswerable. That is not a defect in the local\n// library; it is its nature, and it is the entire reason a provider exists here.\n//\n// ## Deliberately a SEPARATE protocol kind from `LLM_PROVIDER`\n//\n// Same reasoning as `EMBEDDINGS_PROVIDER` (RAG plan DL2) and the `IMAGE_PROVIDER`\n// precedent before it: an unmapped LLM operation key fails SILENTLY across every\n// consumer surface (the registry's semantic-operation map filters it out, the\n// executor never dispatches it, the capability slot never fills), whereas a new\n// `runtimeContract.kind` fails COMPILATION at every switch over the union. That\n// compile-enforcement is the whole argument, and it is verified rather than\n// asserted — deleting an arm from `secretRefForRuntimeContract` reddens the\n// `never` check with the offending contract named in the diagnostic.\n//\n// It also fills its own `EngineCapability.AI_DOCUMENT_EXTRACTION` slot, so an\n// application selects its OCR provider INDEPENDENTLY of its chat and embeddings\n// providers. Those are three unrelated procurement decisions — a deployment may\n// well want Anthropic for chat, OpenAI for embeddings, and Mistral for OCR — and\n// fusing any two of them into one `selection` entry makes that unexpressible.\n//===============================================================\n\n/**\n * Concrete document-extraction model ids the framework knows.\n *\n * Import path: `@wildo-ai/external-connectors-models`.\n */\nexport enum DocumentExtractionProvider_Model {\n /**\n * Mistral's OCR model alias. An ALIAS deliberately, not a dated snapshot: unlike an embedding\n * model — where the concrete id is persisted as a stamp on every chunk and a silent change\n * would fracture the vector space — extraction output is consumed immediately and re-derived\n * on every ingestion pass, so tracking the vendor's current model is a benefit rather than a\n * hazard.\n */\n MISTRAL_OCR_LATEST = \"mistral-ocr-latest\",\n}\n\n/**\n * The document-extraction operation vocabulary — deliberately DISJOINT from\n * `LLMProvider_OperationKey`, `ImageProvider_OperationKey` and\n * `EmbeddingsProvider_OperationKey` (each protocol kind owns its own operation enum, so a key's\n * membership decides its protocol without inspection).\n *\n * Import path: `@wildo-ai/external-connectors-models`.\n */\nexport enum DocumentExtractionProvider_OperationKey {\n /** One document's bytes → its text, page by page. */\n EXTRACT_DOCUMENT_TEXT = \"documentExtraction.extractDocumentText\",\n}\n\n/**\n * @wildo_source:part:start saas.external-providers.document-extraction.applicability facet:kind:api facet:audience:app-developer\n *\n * WHAT a document is being extracted FOR — the durable axis of extraction-model selection\n * (model-selection-by-applicability rule: an author names a CLASS, never a concrete model id;\n * the framework resolves the id from the catalog + preference below).\n *\n * One class today, and that is a statement rather than a placeholder: every extraction in the\n * engine feeds `FileTextExtractionBackendService`, and a second class would only be earned by a\n * surface with genuinely different requirements (a layout-preserving export, say, or a\n * cheap-and-approximate preview tier).\n */\nexport enum DocumentExtraction_Applicability {\n /** The default document-text surface: file text extraction, and the RAG corpus built on it. */\n DOCUMENT_TEXT_DEFAULT = \"document-text-default\",\n}\n/** @wildo_source:part:end saas.external-providers.document-extraction.applicability */\n\n/**\n * One row per document-extraction model: everything the framework knows about a concrete id.\n * Mirrors `Embeddings_ModelCatalogEntry`'s shape at the size this axis needs today.\n */\nexport type DocumentExtraction_ModelCatalogEntry = {\n /** The `ref` of the provider module that serves this id. */\n providerRef: string;\n /**\n * MIME types this model can process, as declared by the provider's documentation.\n *\n * Consulted BEFORE bytes leave the deployment: sending a document the model cannot read wastes\n * an egress of application content, which the data-minimization posture on the execution seam\n * exists to avoid.\n */\n supportedMimeTypes: readonly string[];\n /** FRAMEWORK OPINION — which applicability classes this model may be resolved for. */\n applicabilities: readonly DocumentExtraction_Applicability[];\n};\n\n/**\n * THE document-extraction model catalog — the single per-model fact table (the\n * `EMBEDDINGS_MODEL_CATALOG` discipline: an EXHAUSTIVE `Record`, so a new\n * `DocumentExtractionProvider_Model` member without a row is a compile error).\n */\nexport const DOCUMENT_EXTRACTION_MODEL_CATALOG: Record<\n DocumentExtractionProvider_Model,\n DocumentExtraction_ModelCatalogEntry\n> = {\n [DocumentExtractionProvider_Model.MISTRAL_OCR_LATEST]: {\n providerRef: \"mistral\",\n /**\n * Mistral's published OCR format list (docs.mistral.ai \"Known limitations\": \"Supported\n * formats for OCR: PDF, PNG, JPG, JPEG, TIFF, BMP, GIF, WEBP\"), narrowed to the MIME types\n * the engine's own extraction gate admits today.\n *\n * `application/pdf` is the only entry that is currently REACHABLE: image MIME types are\n * refused by `FileTextExtractionBackendService.isExtractionSupported`, which is a separate,\n * deliberate decision (an uploaded photo is not a document). The image types are declared\n * here anyway because this row states what the MODEL can do, not what the engine currently\n * asks it to do — and admitting images to extraction later must be an engine decision, not\n * an accidental consequence of a catalog edit.\n */\n supportedMimeTypes: [\"application/pdf\", \"image/png\", \"image/jpeg\", \"image/tiff\", \"image/webp\"],\n applicabilities: [DocumentExtraction_Applicability.DOCUMENT_TEXT_DEFAULT],\n },\n};\n\n/**\n * The framework's DEFAULT answer to \"which extraction model serves this class\", ordered by\n * preference, highest first.\n *\n * Unlike the embeddings preference — which is a MIGRATION KEY, because editing it re-binds a\n * class and forces every stamped chunk to be re-embedded — this one carries no durable\n * consequence: extraction output is re-derived on the next ingestion pass and nothing persists\n * the model that produced it. Editing this list changes what the next extraction uses and\n * nothing else.\n */\nexport const DOCUMENT_EXTRACTION_MODEL_APPLICABILITY_PREFERENCE: Record<\n DocumentExtraction_Applicability,\n readonly DocumentExtractionProvider_Model[]\n> = {\n [DocumentExtraction_Applicability.DOCUMENT_TEXT_DEFAULT]: [\n DocumentExtractionProvider_Model.MISTRAL_OCR_LATEST,\n ],\n};\n\n/** Why {@link resolveDocumentExtractionModelForApplicability} could not answer — carried into a named CONFIGURATION error. */\nexport enum DocumentExtraction_ModelResolutionFailure {\n /** The applicability has no candidate at all for this provider. */\n NO_CANDIDATE_FOR_PROVIDER = \"no_candidate_for_provider\",\n}\n\nexport type DocumentExtraction_ModelResolution =\n | { resolved: true; model: DocumentExtractionProvider_Model; entry: DocumentExtraction_ModelCatalogEntry }\n | {\n resolved: false;\n failure: DocumentExtraction_ModelResolutionFailure;\n consideredModels: readonly DocumentExtractionProvider_Model[];\n };\n\n/**\n * Resolve an applicability class to ONE concrete extraction model for a given provider.\n *\n * Fails CLOSED and explains itself (the `resolveModelForApplicability` contract): a silent\n * fallback to some other model would send application documents to a model nobody chose.\n */\nexport const resolveDocumentExtractionModelForApplicability = (\n input: { applicability: DocumentExtraction_Applicability; providerRef: string },\n catalog: Record<DocumentExtractionProvider_Model, DocumentExtraction_ModelCatalogEntry> = DOCUMENT_EXTRACTION_MODEL_CATALOG,\n): DocumentExtraction_ModelResolution => {\n const candidates = DOCUMENT_EXTRACTION_MODEL_APPLICABILITY_PREFERENCE[input.applicability];\n const forProvider = candidates.filter((model) => {\n const entry = catalog[model];\n return entry.providerRef === input.providerRef && entry.applicabilities.includes(input.applicability);\n });\n if (forProvider.length === 0) {\n return {\n resolved: false,\n failure: DocumentExtraction_ModelResolutionFailure.NO_CANDIDATE_FOR_PROVIDER,\n consideredModels: candidates,\n };\n }\n const model = forProvider[0]!;\n return { resolved: true, model, entry: catalog[model] };\n};\n\n// ===============================================================\n// Document Extraction Provider Profiles and Configurations (the config arm —\n// disjoint from LLM/image/embeddings config by construction)\n// ===============================================================\n\nexport type DocumentExtractionProvider_Profile = ExternalProvider_ExchangeProtocol_Profile_Base & {\n baseURL?: string,\n /** Model ids this provider serves (advertised for validation/UX). */\n supportedModels?: string[],\n}\n\nexport type DocumentExtractionProvider_Configuration = ExternalProvider_ExchangeProtocol_Configuration_Base & {\n customLocation?: string,\n}\n\n// ===============================================================\n// Document Extraction Operations Context\n// ===============================================================\n\n/**\n * Usage of one extraction call.\n *\n * There is NO token dimension, and its absence is structural rather than an omission: an OCR\n * call is billed and reported per PAGE, not per token. Any consumer judging usage completeness\n * for an extraction must do so on `pagesProcessed` alone — the operation-aware discipline the\n * embeddings arm records for its own missing completion-token dimension.\n */\nexport const DocumentExtractionProvider_UsageSchema = z.object({\n /**\n * Pages the provider reports having processed.\n *\n * The FRAMEWORK's name for the dimension. Which vendor field it is projected from is the\n * provider's `parseExtractResponse` to know — the wired one reads Mistral's\n * `usage_info.pages_processed`, and a second provider will read something else.\n */\n pagesProcessed: z.number().optional(),\n /** Document size the provider reports having received. Same ownership as `pagesProcessed`. */\n documentSizeBytes: z.number().optional(),\n});\nexport type DocumentExtractionProvider_Usage = z.infer<typeof DocumentExtractionProvider_UsageSchema>;\n\nexport const DocumentExtractionProvider_ExecutionTransportMetadataSchema = z.object({\n protocolKind: z.literal(ExternalProvider_ExchangeProtocol_Kind.DOCUMENT_EXTRACTION_PROVIDER),\n providerRef: z.string(),\n model: z.string().optional(),\n});\nexport type DocumentExtractionProvider_ExecutionTransportMetadata = z.infer<\n typeof DocumentExtractionProvider_ExecutionTransportMetadataSchema\n>;\n\n// ===============================================================\n// Document Extraction I/O Schemas\n// ===============================================================\n\n/**\n * Input DESCRIPTOR of the {@link DocumentExtractionProvider_OperationKey.EXTRACT_DOCUMENT_TEXT}\n * operation — the metadata about the document, deliberately NOT the document.\n *\n * ⚠️ THE BYTES ARE ABSENT ON PURPOSE, and this is the design decision most likely to be\n * \"corrected\" by a later reader. A `documentBase64: z.string()` field here would be structurally\n * correct and operationally dangerous: a Zod-shaped input object is the thing every diagnostic\n * path in this codebase reaches for when something goes wrong — error `context`, debug logs,\n * agent-call traces — and a multi-megabyte base64 blob of an application's private contract is\n * the single worst payload to make casually loggable. The embeddings arm reached the same\n * conclusion from the other direction (its header forbids raw texts and vectors from ever\n * entering a trace); here the prohibition is enforced by the SHAPE rather than by discipline.\n *\n * The bytes travel as a `Buffer` on the execution service's own request type, which no\n * serializer walks.\n */\nexport const DocumentExtractionProvider_ExtractDocumentTextInputSchema = z.object({\n /** The document's MIME type — checked against the model's catalog row before any egress. */\n mimeType: z.string(),\n /** Byte length of the document being sent. Diagnostic and ceiling-checking only. */\n documentByteLength: z.number().int().nonnegative(),\n});\nexport type DocumentExtractionProvider_ExtractDocumentTextInput = z.infer<\n typeof DocumentExtractionProvider_ExtractDocumentTextInputSchema\n>;\n\n/**\n * Output of {@link DocumentExtractionProvider_OperationKey.EXTRACT_DOCUMENT_TEXT}.\n *\n * `text` is the concatenation of the provider's per-page output in document order. Providers in\n * this family return MARKDOWN per page (Mistral's `pages[].markdown`), which is kept as-is:\n * headings and table structure are signal for a retrieval corpus, and stripping them to \"plain\"\n * text would discard information the provider was paid to recover.\n */\nexport const DocumentExtractionProvider_ExtractDocumentTextOutputSchema = z.object({\n text: z.string(),\n /** Pages the provider actually returned — the authoritative count, not the request's estimate. */\n pageCount: z.number().int().nonnegative(),\n /** The concrete model that produced the text. */\n model: z.string(),\n usage: DocumentExtractionProvider_UsageSchema,\n});\nexport type DocumentExtractionProvider_ExtractDocumentTextOutput = z.infer<\n typeof DocumentExtractionProvider_ExtractDocumentTextOutputSchema\n>;\n\n// ===============================================================\n// The PROVIDER-OWNED WIRE SEAM\n// --------\n// Until 2026-09-09 this arm declared `baseUrl`, `endpointPath`, `apiKey` and `models` — where the\n// call goes and how it authenticates — and NOTHING about the body or the response. So the engine's\n// execution seam composed Mistral's `/v1/ocr` request (`document: { type: 'document_url',\n// document_url }`, `include_image_base64`) and read Mistral's response (`pages[].markdown`,\n// `usage_info.pages_processed`) with the vendor named nowhere, and a second provider declaring\n// DOCUMENT_EXTRACTION_PROVIDER would have been sent through Mistral's API carrying its own key.\n//\n// The remedy is the one the EMAIL and SMS arms already converged on: the provider declares PURE\n// FUNCTIONS and the engine owns transport and credentials. The types those functions are written\n// against live HERE rather than beside the contract, because the failure vocabulary is read by\n// BOTH sides — the provider produces it, the engine's caller branches on it — and a vocabulary\n// with two homes is a vocabulary that drifts.\n// ===============================================================\n\n/**\n * WHY an extraction failed, in the only two senses a caller can act on differently.\n *\n * This is the arm's most load-bearing output after the text itself, and the consequence of\n * confusing the two is CORPUS DELETION rather than a misleading log line:\n * `RagIngestionBackendService` deletes a field's entire chunk set when an ingestion pass yields no\n * text, so reporting a provider OUTAGE as an unreadable document silently destroys a live,\n * already-embedded corpus and reports success.\n *\n * It lived in `saas-backend-lib`'s execution seam until 2026-09-09, which is exactly why the wire\n * shape lived there too: a vocabulary a provider cannot reach is one a provider cannot answer in,\n * so classification had to be done by whoever could. Moving it here is what makes\n * {@link DocumentExtraction_ProviderExtraction} expressible at all.\n */\nexport enum DocumentExtraction_FailureClass {\n /**\n * The provider read the request and judged the DOCUMENT unprocessable — corrupt bytes, an\n * unsupported format, a password-protected file. PERMANENT: re-sending the same bytes cannot\n * succeed, so a sweep may safely stop retrying and skip the document.\n */\n UNREADABLE_DOCUMENT = \"unreadable_document\",\n /**\n * The provider could not be reached, refused the credential, throttled, or failed internally —\n * a network error, a 401/403, a 429, any 5xx, or a timeout. TRANSIENT and, decisively, says\n * NOTHING about the document. A caller must not conclude anything about the bytes from this.\n */\n PROVIDER_UNAVAILABLE = \"provider_unavailable\",\n}\n\n/**\n * What a provider's `parseExtractResponse` returns: the extraction, or a CLASSIFIED refusal.\n *\n * A discriminated union rather than \"return the output or throw\", for the reason the failure class\n * exists: a thrown `Error` carries no class, and the engine would have to guess one — which is the\n * guess that deletes a corpus. A provider that cannot classify a response must still say which of\n * the two it is, and the arm's JSDoc tells it to prefer `PROVIDER_UNAVAILABLE` when unsure,\n * because that is the answer with no destructive consequence.\n */\nexport type DocumentExtraction_ProviderExtraction =\n | {\n extracted: true;\n /** Per-page text joined in document order. Markdown is kept as-is; see the output schema. */\n text: string;\n /** Pages the provider actually returned — the authoritative count, not the request estimate. */\n pageCount: number;\n /** The model the provider says produced the text. Absent means \"the resolved model\". */\n model?: string;\n usage?: DocumentExtractionProvider_Usage;\n }\n | {\n extracted: false;\n failureClass: DocumentExtraction_FailureClass;\n /**\n * Operator-facing reason. MUST NOT contain the provider's response body or any part of the\n * document: this message reaches logs, and a provider error body can echo request content.\n */\n message: string;\n };\n\n/**\n * The framework's DEFAULT reading of an extraction response's HTTP status.\n *\n * Offered to every provider's `parseExtractResponse` rather than applied by the engine, because\n * only the provider knows whether its vendor also signals a per-document verdict inside a 2xx\n * body (Twilio does exactly that on the SMS arm). What it prevents is each provider re-deriving a\n * classification whose worst case is corpus deletion.\n *\n * Every boundary is deliberate:\n * - 4xx generally means the provider READ the request and refused THIS DOCUMENT → permanent.\n * - 401/403 is a CREDENTIAL fault, not a document fault. Classifying it as unreadable would make\n * a rotated key look like a corpus of corrupt files and delete chunk sets across every\n * document for as long as the key was wrong.\n * - 408/429 are explicitly retryable by their own definition.\n * - 5xx is the provider's fault, never the document's.\n */\nexport const classifyDocumentExtractionHttpStatus = (status: number): DocumentExtraction_FailureClass => {\n const isCredentialFault = status === 401 || status === 403;\n const isThrottleOrTimeout = status === 408 || status === 429;\n const isServerFault = status >= 500;\n return isCredentialFault || isThrottleOrTimeout || isServerFault\n ? DocumentExtraction_FailureClass.PROVIDER_UNAVAILABLE\n : DocumentExtraction_FailureClass.UNREADABLE_DOCUMENT;\n};\n\n// ===============================================================\n// STATUS\n// ===============================================================\n\nexport const DocumentExtractionProvider_StatusSchema = ExternalProvider_ExchangeProtocol_Status_BaseSchema.extend({\n protocolKind: z.literal(ExternalProvider_ExchangeProtocol_Kind.DOCUMENT_EXTRACTION_PROVIDER),\n});\nexport type DocumentExtractionProvider_Status = z.infer<typeof DocumentExtractionProvider_StatusSchema>;\n"]}
1
+ {"version":3,"file":"document-extraction.external-connectors-models.schemas.js","sourceRoot":"","sources":["../../../../src/protocols/document-extraction.external-connectors-models.schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EACL,sCAAsC,GACrC,MAAM,oDAAoD,CAAA;AAE7D,iEAAiE;AACjE,+BAA+B;AAC/B,WAAW;AACX,iEAAiE;AACjE,6EAA6E;AAC7E,mDAAmD;AACnD,EAAE;AACF,kEAAkE;AAClE,EAAE;AACF,iFAAiF;AACjF,iFAAiF;AACjF,gFAAgF;AAChF,+EAA+E;AAC/E,iFAAiF;AACjF,EAAE;AACF,+DAA+D;AAC/D,EAAE;AACF,kFAAkF;AAClF,iFAAiF;AACjF,8EAA8E;AAC9E,gFAAgF;AAChF,gFAAgF;AAChF,4EAA4E;AAC5E,4EAA4E;AAC5E,qEAAqE;AACrE,EAAE;AACF,8EAA8E;AAC9E,gFAAgF;AAChF,gFAAgF;AAChF,iFAAiF;AACjF,8EAA8E;AAC9E,iEAAiE;AAEjE;;;;GAIG;AACH,MAAM,CAAN,IAAY,gCASX;AATD,WAAY,gCAAgC;IAC1C;;;;;;OAMG;IACH,6EAAyC,CAAA;AAC3C,CAAC,EATW,gCAAgC,KAAhC,gCAAgC,QAS3C;AAED;;;;;;;GAOG;AACH,MAAM,CAAN,IAAY,uCAGX;AAHD,WAAY,uCAAuC;IACjD,qDAAqD;IACrD,2G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AC,CAAC","sourcesContent":["import { z } from \"zod\"\nimport {\n ExternalProvider_ExchangeProtocol_Kind,\n } from \"../core/commons.external-connectors-models.schemas\"\n\n//===============================================================\n// Document Extraction Provider\n// --------\n// Document bytes → text. Serves the file-side TEXT PROVIDER that\n// `FileTextExtractionBackendService` owns, whose largest consumer is the RAG\n// ingestion path (`.ragSource()` corpus building).\n//\n// ## Why this is a provider at all, and not just a better library\n//\n// The local `pdfjs-dist` path reads a PDF's TEXT LAYER. A scanned document — the\n// common case for uploaded contracts, invoices and forms — is an IMAGE of a page\n// and carries no text layer, so it extracts to the empty string, contributes no\n// chunks, and becomes silently unanswerable. That is not a defect in the local\n// library; it is its nature, and it is the entire reason a provider exists here.\n//\n// ## Deliberately a SEPARATE protocol kind from `LLM_PROVIDER`\n//\n// Same reasoning as `EMBEDDINGS_PROVIDER` (RAG plan DL2) and the `IMAGE_PROVIDER`\n// precedent before it: an unmapped LLM operation key fails SILENTLY across every\n// consumer surface (the registry's semantic-operation map filters it out, the\n// executor never dispatches it, the capability slot never fills), whereas a new\n// `runtimeContract.kind` fails COMPILATION at every switch over the union. That\n// compile-enforcement is the whole argument, and it is verified rather than\n// asserted — deleting an arm from `secretRefForRuntimeContract` reddens the\n// `never` check with the offending contract named in the diagnostic.\n//\n// It also fills its own `EngineCapability.AI_DOCUMENT_EXTRACTION` slot, so an\n// application selects its OCR provider INDEPENDENTLY of its chat and embeddings\n// providers. Those are three unrelated procurement decisions — a deployment may\n// well want Anthropic for chat, OpenAI for embeddings, and Mistral for OCR — and\n// fusing any two of them into one `selection` entry makes that unexpressible.\n//===============================================================\n\n/**\n * Concrete document-extraction model ids the framework knows.\n *\n * Import path: `@wildo-ai/external-connectors-models`.\n */\nexport enum DocumentExtractionProvider_Model {\n /**\n * Mistral's OCR model alias. An ALIAS deliberately, not a dated snapshot: unlike an embedding\n * model — where the concrete id is persisted as a stamp on every chunk and a silent change\n * would fracture the vector space — extraction output is consumed immediately and re-derived\n * on every ingestion pass, so tracking the vendor's current model is a benefit rather than a\n * hazard.\n */\n MISTRAL_OCR_LATEST = \"mistral-ocr-latest\",\n}\n\n/**\n * The document-extraction operation vocabulary — deliberately DISJOINT from\n * `LLMProvider_OperationKey`, `ImageProvider_OperationKey` and\n * `EmbeddingsProvider_OperationKey` (each protocol kind owns its own operation enum, so a key's\n * membership decides its protocol without inspection).\n *\n * Import path: `@wildo-ai/external-connectors-models`.\n */\nexport enum DocumentExtractionProvider_OperationKey {\n /** One document's bytes → its text, page by page. */\n EXTRACT_DOCUMENT_TEXT = \"documentExtraction.extractDocumentText\",\n}\n\n/**\n * @wildo_source:part:start saas.external-providers.document-extraction.applicability facet:kind:api facet:audience:app-developer\n *\n * WHAT a document is being extracted FOR — the durable axis of extraction-model selection\n * (model-selection-by-applicability rule: an author names a CLASS, never a concrete model id;\n * the framework resolves the id from the catalog + preference below).\n *\n * One class today, and that is a statement rather than a placeholder: every extraction in the\n * engine feeds `FileTextExtractionBackendService`, and a second class would only be earned by a\n * surface with genuinely different requirements (a layout-preserving export, say, or a\n * cheap-and-approximate preview tier).\n */\nexport enum DocumentExtraction_Applicability {\n /** The default document-text surface: file text extraction, and the RAG corpus built on it. */\n DOCUMENT_TEXT_DEFAULT = \"document-text-default\",\n}\n/** @wildo_source:part:end saas.external-providers.document-extraction.applicability */\n\n/**\n * One row per document-extraction model: everything the framework knows about a concrete id.\n * Mirrors `Embeddings_ModelCatalogEntry`'s shape at the size this axis needs today.\n */\nexport type DocumentExtraction_ModelCatalogEntry = {\n /** The `ref` of the provider module that serves this id. */\n providerRef: string;\n /**\n * MIME types this model can process, as declared by the provider's documentation.\n *\n * Consulted BEFORE bytes leave the deployment: sending a document the model cannot read wastes\n * an egress of application content, which the data-minimization posture on the execution seam\n * exists to avoid.\n */\n supportedMimeTypes: readonly string[];\n /** FRAMEWORK OPINION — which applicability classes this model may be resolved for. */\n applicabilities: readonly DocumentExtraction_Applicability[];\n};\n\n/**\n * THE document-extraction model catalog — the single per-model fact table (the\n * `EMBEDDINGS_MODEL_CATALOG` discipline: an EXHAUSTIVE `Record`, so a new\n * `DocumentExtractionProvider_Model` member without a row is a compile error).\n */\nexport const DOCUMENT_EXTRACTION_MODEL_CATALOG: Record<\n DocumentExtractionProvider_Model,\n DocumentExtraction_ModelCatalogEntry\n> = {\n [DocumentExtractionProvider_Model.MISTRAL_OCR_LATEST]: {\n providerRef: \"mistral\",\n /**\n * Mistral's published OCR format list (docs.mistral.ai \"Known limitations\": \"Supported\n * formats for OCR: PDF, PNG, JPG, JPEG, TIFF, BMP, GIF, WEBP\"), narrowed to the MIME types\n * the engine's own extraction gate admits today.\n *\n * `application/pdf` is the only entry that is currently REACHABLE: image MIME types are\n * refused by `FileTextExtractionBackendService.isExtractionSupported`, which is a separate,\n * deliberate decision (an uploaded photo is not a document). The image types are declared\n * here anyway because this row states what the MODEL can do, not what the engine currently\n * asks it to do — and admitting images to extraction later must be an engine decision, not\n * an accidental consequence of a catalog edit.\n */\n supportedMimeTypes: [\"application/pdf\", \"image/png\", \"image/jpeg\", \"image/tiff\", \"image/webp\"],\n applicabilities: [DocumentExtraction_Applicability.DOCUMENT_TEXT_DEFAULT],\n },\n};\n\n/**\n * The framework's DEFAULT answer to \"which extraction model serves this class\", ordered by\n * preference, highest first.\n *\n * Unlike the embeddings preference — which is a MIGRATION KEY, because editing it re-binds a\n * class and forces every stamped chunk to be re-embedded — this one carries no durable\n * consequence: extraction output is re-derived on the next ingestion pass and nothing persists\n * the model that produced it. Editing this list changes what the next extraction uses and\n * nothing else.\n */\nexport const DOCUMENT_EXTRACTION_MODEL_APPLICABILITY_PREFERENCE: Record<\n DocumentExtraction_Applicability,\n readonly DocumentExtractionProvider_Model[]\n> = {\n [DocumentExtraction_Applicability.DOCUMENT_TEXT_DEFAULT]: [\n DocumentExtractionProvider_Model.MISTRAL_OCR_LATEST,\n ],\n};\n\n/** Why {@link resolveDocumentExtractionModelForApplicability} could not answer — carried into a named CONFIGURATION error. */\nexport enum DocumentExtraction_ModelResolutionFailure {\n /** The applicability has no candidate at all for this provider. */\n NO_CANDIDATE_FOR_PROVIDER = \"no_candidate_for_provider\",\n}\n\nexport type DocumentExtraction_ModelResolution =\n | { resolved: true; model: DocumentExtractionProvider_Model; entry: DocumentExtraction_ModelCatalogEntry }\n | {\n resolved: false;\n failure: DocumentExtraction_ModelResolutionFailure;\n consideredModels: readonly DocumentExtractionProvider_Model[];\n };\n\n/**\n * Resolve an applicability class to ONE concrete extraction model for a given provider.\n *\n * Fails CLOSED and explains itself (the `resolveModelForApplicability` contract): a silent\n * fallback to some other model would send application documents to a model nobody chose.\n */\nexport const resolveDocumentExtractionModelForApplicability = (\n input: { applicability: DocumentExtraction_Applicability; providerRef: string },\n catalog: Record<DocumentExtractionProvider_Model, DocumentExtraction_ModelCatalogEntry> = DOCUMENT_EXTRACTION_MODEL_CATALOG,\n): DocumentExtraction_ModelResolution => {\n const candidates = DOCUMENT_EXTRACTION_MODEL_APPLICABILITY_PREFERENCE[input.applicability];\n const forProvider = candidates.filter((model) => {\n const entry = catalog[model];\n return entry.providerRef === input.providerRef && entry.applicabilities.includes(input.applicability);\n });\n if (forProvider.length === 0) {\n return {\n resolved: false,\n failure: DocumentExtraction_ModelResolutionFailure.NO_CANDIDATE_FOR_PROVIDER,\n consideredModels: candidates,\n };\n }\n const model = forProvider[0]!;\n return { resolved: true, model, entry: catalog[model] };\n};\n\n// ===============================================================\n// Document Extraction Operations Context\n// ===============================================================\n\n/**\n * Usage of one extraction call.\n *\n * There is NO token dimension, and its absence is structural rather than an omission: an OCR\n * call is billed and reported per PAGE, not per token. Any consumer judging usage completeness\n * for an extraction must do so on `pagesProcessed` alone — the operation-aware discipline the\n * embeddings arm records for its own missing completion-token dimension.\n */\nexport const DocumentExtractionProvider_UsageSchema = z.object({\n /**\n * Pages the provider reports having processed.\n *\n * The FRAMEWORK's name for the dimension. Which vendor field it is projected from is the\n * provider's `parseExtractResponse` to know — the wired one reads Mistral's\n * `usage_info.pages_processed`, and a second provider will read something else.\n */\n pagesProcessed: z.number().optional(),\n /** Document size the provider reports having received. Same ownership as `pagesProcessed`. */\n documentSizeBytes: z.number().optional(),\n});\nexport type DocumentExtractionProvider_Usage = z.infer<typeof DocumentExtractionProvider_UsageSchema>;\n\nexport const DocumentExtractionProvider_ExecutionTransportMetadataSchema = z.object({\n protocolKind: z.literal(ExternalProvider_ExchangeProtocol_Kind.DOCUMENT_EXTRACTION_PROVIDER),\n providerRef: z.string(),\n model: z.string().optional(),\n});\nexport type DocumentExtractionProvider_ExecutionTransportMetadata = z.infer<\n typeof DocumentExtractionProvider_ExecutionTransportMetadataSchema\n>;\n\n// ===============================================================\n// Document Extraction I/O Schemas\n// ===============================================================\n\n/**\n * Input DESCRIPTOR of the {@link DocumentExtractionProvider_OperationKey.EXTRACT_DOCUMENT_TEXT}\n * operation — the metadata about the document, deliberately NOT the document.\n *\n * ⚠️ THE BYTES ARE ABSENT ON PURPOSE, and this is the design decision most likely to be\n * \"corrected\" by a later reader. A `documentBase64: z.string()` field here would be structurally\n * correct and operationally dangerous: a Zod-shaped input object is the thing every diagnostic\n * path in this codebase reaches for when something goes wrong — error `context`, debug logs,\n * agent-call traces — and a multi-megabyte base64 blob of an application's private contract is\n * the single worst payload to make casually loggable. The embeddings arm reached the same\n * conclusion from the other direction (its header forbids raw texts and vectors from ever\n * entering a trace); here the prohibition is enforced by the SHAPE rather than by discipline.\n *\n * The bytes travel as a `Buffer` on the execution service's own request type, which no\n * serializer walks.\n */\nexport const DocumentExtractionProvider_ExtractDocumentTextInputSchema = z.object({\n /** The document's MIME type — checked against the model's catalog row before any egress. */\n mimeType: z.string(),\n /** Byte length of the document being sent. Diagnostic and ceiling-checking only. */\n documentByteLength: z.number().int().nonnegative(),\n});\nexport type DocumentExtractionProvider_ExtractDocumentTextInput = z.infer<\n typeof DocumentExtractionProvider_ExtractDocumentTextInputSchema\n>;\n\n/**\n * Output of {@link DocumentExtractionProvider_OperationKey.EXTRACT_DOCUMENT_TEXT}.\n *\n * `text` is the concatenation of the provider's per-page output in document order. Providers in\n * this family return MARKDOWN per page (Mistral's `pages[].markdown`), which is kept as-is:\n * headings and table structure are signal for a retrieval corpus, and stripping them to \"plain\"\n * text would discard information the provider was paid to recover.\n */\nexport const DocumentExtractionProvider_ExtractDocumentTextOutputSchema = z.object({\n text: z.string(),\n /** Pages the provider actually returned — the authoritative count, not the request's estimate. */\n pageCount: z.number().int().nonnegative(),\n /** The concrete model that produced the text. */\n model: z.string(),\n usage: DocumentExtractionProvider_UsageSchema,\n});\nexport type DocumentExtractionProvider_ExtractDocumentTextOutput = z.infer<\n typeof DocumentExtractionProvider_ExtractDocumentTextOutputSchema\n>;\n\n// ===============================================================\n// The PROVIDER-OWNED WIRE SEAM\n// --------\n// Until 2026-09-09 this arm declared `baseUrl`, `endpointPath`, `apiKey` and `models` — where the\n// call goes and how it authenticates — and NOTHING about the body or the response. So the engine's\n// execution seam composed Mistral's `/v1/ocr` request (`document: { type: 'document_url',\n// document_url }`, `include_image_base64`) and read Mistral's response (`pages[].markdown`,\n// `usage_info.pages_processed`) with the vendor named nowhere, and a second provider declaring\n// DOCUMENT_EXTRACTION_PROVIDER would have been sent through Mistral's API carrying its own key.\n//\n// The remedy is the one the EMAIL and SMS arms already converged on: the provider declares PURE\n// FUNCTIONS and the engine owns transport and credentials. The types those functions are written\n// against live HERE rather than beside the contract, because the failure vocabulary is read by\n// BOTH sides — the provider produces it, the engine's caller branches on it — and a vocabulary\n// with two homes is a vocabulary that drifts.\n// ===============================================================\n\n/**\n * WHY an extraction failed, in the only two senses a caller can act on differently.\n *\n * This is the arm's most load-bearing output after the text itself, and the consequence of\n * confusing the two is CORPUS DELETION rather than a misleading log line:\n * `RagIngestionBackendService` deletes a field's entire chunk set when an ingestion pass yields no\n * text, so reporting a provider OUTAGE as an unreadable document silently destroys a live,\n * already-embedded corpus and reports success.\n *\n * It lived in `saas-backend-lib`'s execution seam until 2026-09-09, which is exactly why the wire\n * shape lived there too: a vocabulary a provider cannot reach is one a provider cannot answer in,\n * so classification had to be done by whoever could. Moving it here is what makes\n * {@link DocumentExtraction_ProviderExtraction} expressible at all.\n */\nexport enum DocumentExtraction_FailureClass {\n /**\n * The provider read the request and judged the DOCUMENT unprocessable — corrupt bytes, an\n * unsupported format, a password-protected file. PERMANENT: re-sending the same bytes cannot\n * succeed, so a sweep may safely stop retrying and skip the document.\n */\n UNREADABLE_DOCUMENT = \"unreadable_document\",\n /**\n * The provider could not be reached, refused the credential, throttled, or failed internally —\n * a network error, a 401/403, a 429, any 5xx, or a timeout. TRANSIENT and, decisively, says\n * NOTHING about the document. A caller must not conclude anything about the bytes from this.\n */\n PROVIDER_UNAVAILABLE = \"provider_unavailable\",\n}\n\n/**\n * What a provider's `parseExtractResponse` returns: the extraction, or a CLASSIFIED refusal.\n *\n * A discriminated union rather than \"return the output or throw\", for the reason the failure class\n * exists: a thrown `Error` carries no class, and the engine would have to guess one — which is the\n * guess that deletes a corpus. A provider that cannot classify a response must still say which of\n * the two it is, and the arm's JSDoc tells it to prefer `PROVIDER_UNAVAILABLE` when unsure,\n * because that is the answer with no destructive consequence.\n */\nexport type DocumentExtraction_ProviderExtraction =\n | {\n extracted: true;\n /** Per-page text joined in document order. Markdown is kept as-is; see the output schema. */\n text: string;\n /** Pages the provider actually returned — the authoritative count, not the request estimate. */\n pageCount: number;\n /** The model the provider says produced the text. Absent means \"the resolved model\". */\n model?: string;\n usage?: DocumentExtractionProvider_Usage;\n }\n | {\n extracted: false;\n failureClass: DocumentExtraction_FailureClass;\n /**\n * Operator-facing reason. MUST NOT contain the provider's response body or any part of the\n * document: this message reaches logs, and a provider error body can echo request content.\n */\n message: string;\n };\n\n/**\n * The framework's DEFAULT reading of an extraction response's HTTP status.\n *\n * Offered to every provider's `parseExtractResponse` rather than applied by the engine, because\n * only the provider knows whether its vendor also signals a per-document verdict inside a 2xx\n * body (Twilio does exactly that on the SMS arm). What it prevents is each provider re-deriving a\n * classification whose worst case is corpus deletion.\n *\n * Every boundary is deliberate:\n * - 4xx generally means the provider READ the request and refused THIS DOCUMENT → permanent.\n * - 401/403 is a CREDENTIAL fault, not a document fault. Classifying it as unreadable would make\n * a rotated key look like a corpus of corrupt files and delete chunk sets across every\n * document for as long as the key was wrong.\n * - 408/429 are explicitly retryable by their own definition.\n * - 5xx is the provider's fault, never the document's.\n */\nexport const classifyDocumentExtractionHttpStatus = (status: number): DocumentExtraction_FailureClass => {\n const isCredentialFault = status === 401 || status === 403;\n const isThrottleOrTimeout = status === 408 || status === 429;\n const isServerFault = status >= 500;\n return isCredentialFault || isThrottleOrTimeout || isServerFault\n ? DocumentExtraction_FailureClass.PROVIDER_UNAVAILABLE\n : DocumentExtraction_FailureClass.UNREADABLE_DOCUMENT;\n};\n\n"]}
@@ -1,5 +1,4 @@
1
1
  import { z } from "zod";
2
- import { ExternalProvider_ExchangeProtocol_Configuration_Base, ExternalProvider_ExchangeProtocol_Kind, ExternalProvider_ExchangeProtocol_Profile_Base } from "../core/commons.external-connectors-models.schemas";
3
2
  import { ExternalProvider_OperationDefinition_Base } from "../core/operations.external-connectors-models.schemas";
4
3
  /**
5
4
  * The type of email operation - transactional vs marketing have different
@@ -122,44 +121,6 @@ export declare const EmailProvider_AttachmentSchema: z.ZodObject<{
122
121
  contentId: z.ZodOptional<z.ZodString>;
123
122
  }, z.core.$strip>;
124
123
  export type EmailProvider_Attachment = z.infer<typeof EmailProvider_AttachmentSchema>;
125
- export type EmailProvider_Profile = ExternalProvider_ExchangeProtocol_Profile_Base & {
126
- displayName?: string;
127
- baseURL: string;
128
- apiVersion?: string;
129
- smtpServer?: EmailProvider_SMTP_ServerProfile;
130
- capabilities: EmailProvider_Capability[];
131
- supportedEmailTypes: EmailProvider_EmailType[];
132
- deliveryMethods: EmailProvider_DeliveryMethod[];
133
- limits: {
134
- maxRecipientsPerRequest?: number;
135
- maxBatchSize?: number;
136
- maxAttachmentSizeMB?: number;
137
- maxEmailSizeKB?: number;
138
- rateLimit?: {
139
- requests: number;
140
- period: "second" | "minute" | "hour" | "day";
141
- };
142
- };
143
- };
144
- export type EmailProvider_Configuration = ExternalProvider_ExchangeProtocol_Configuration_Base & {
145
- preferredDeliveryMethod?: EmailProvider_DeliveryMethod;
146
- smtpCredentials?: {
147
- username: string;
148
- passwordSecretRef: string;
149
- };
150
- defaultFromAddress?: EmailProvider_Address;
151
- defaultReplyTo?: EmailProvider_Address;
152
- openTrackingEnabled?: boolean;
153
- clickTrackingEnabled?: boolean;
154
- webhookConfig?: {
155
- url: string;
156
- secretRef?: string;
157
- events?: EmailProvider_DeliveryStatus[];
158
- };
159
- sandboxMode?: boolean;
160
- ipPoolName?: string;
161
- defaultTags?: string[];
162
- };
163
124
  export declare const EmailProvider_SendEmailInputSchema: z.ZodObject<{
164
125
  to: z.ZodArray<z.ZodObject<{
165
126
  email: z.ZodEmail;
@@ -297,8 +258,8 @@ export declare const EmailProvider_CampaignOutputSchema: z.ZodObject<{
297
258
  id: z.ZodString;
298
259
  status: z.ZodEnum<{
299
260
  cancelled: "cancelled";
300
- draft: "draft";
301
261
  sent: "sent";
262
+ draft: "draft";
302
263
  scheduled: "scheduled";
303
264
  sending: "sending";
304
265
  }>;
@@ -351,20 +312,4 @@ export type EmailProvider_OperationDefinition = ExternalProvider_OperationDefini
351
312
  supportedDeliveryMethods: EmailProvider_DeliveryMethod[];
352
313
  requiredCapabilities?: EmailProvider_Capability[];
353
314
  };
354
- export declare const EmailProvider_StatusSchema: z.ZodObject<{
355
- status: z.ZodEnum<typeof import("..").ExternalProvider_Status>;
356
- lastCheckedAt: z.ZodString;
357
- errorReason: z.ZodOptional<z.ZodString>;
358
- protocolKind: z.ZodLiteral<ExternalProvider_ExchangeProtocol_Kind.EMAIL_PROVIDER>;
359
- apiConnected: z.ZodOptional<z.ZodBoolean>;
360
- smtpConnected: z.ZodOptional<z.ZodBoolean>;
361
- domainVerified: z.ZodOptional<z.ZodBoolean>;
362
- spfValid: z.ZodOptional<z.ZodBoolean>;
363
- dkimValid: z.ZodOptional<z.ZodBoolean>;
364
- dmarcValid: z.ZodOptional<z.ZodBoolean>;
365
- rateLimitRemaining: z.ZodOptional<z.ZodNumber>;
366
- rateLimitResetAt: z.ZodOptional<z.ZodISODateTime>;
367
- senderReputation: z.ZodOptional<z.ZodNumber>;
368
- }, z.core.$strip>;
369
- export type EmailProvider_Status = z.infer<typeof EmailProvider_StatusSchema>;
370
315
  //# sourceMappingURL=email.external-connectors-models.schemas.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"email.external-connectors-models.schemas.d.ts","sourceRoot":"","sources":["../../../src/protocols/email.external-connectors-models.schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,oDAAoD,EACpD,sCAAsC,EACtC,8CAA8C,EAE/C,MAAM,oDAAoD,CAAC;AAC5D,OAAO,EAA2C,yCAAyC,EAAE,MAAM,uDAAuD,CAAC;AAoB3J;;;GAGG;AACH,oBAAY,uBAAuB;IACjC,aAAa,kBAAkB,CAAG,2CAA2C;IAC7E,SAAS,cAAc;CACxB;AAED;;;GAGG;AACH,oBAAY,4BAA4B;IACtC,QAAQ,aAAa;IACrB,IAAI,SAAS;CACd;AAED;;GAEG;AACH,oBAAY,2BAA2B;IACrC,IAAI,SAAS,CAAY,wCAAwC;IACjE,QAAQ,aAAa,CAAI,4BAA4B;IACrD,GAAG,QAAQ;CACZ;AAED;;GAEG;AACH,oBAAY,4BAA4B;IACtC,MAAM,WAAW;IACjB,IAAI,SAAS;IACb,SAAS,cAAc;IACvB,MAAM,WAAW;IACjB,OAAO,YAAY;IACnB,OAAO,YAAY;IACnB,YAAY,iBAAiB;IAC7B,cAAc,mBAAmB;IACjC,YAAY,iBAAiB;IAC7B,OAAO,YAAY;IACnB,QAAQ,aAAa;IACrB,MAAM,WAAW;CAClB;AAED;;GAEG;AACH,oBAAY,wBAAwB;IAClC,IAAI,SAAS,CAAO,4CAA4C;IAChE,IAAI,SAAS,CAAO,g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CAAC,OAAO,kCAAkC,CAAC,CAAC;AAM9F,eAAO,MAAM,iCAAiC;;;;;;;;;;;;iBAY5C,CAAC;AACH,MAAM,MAAM,2BAA2B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iCAAiC,CAAC,CAAC;AAM5F,eAAO,MAAM,oCAAoC;;;;;;;;;;;iBAiB/C,CAAC;AACH,MAAM,MAAM,8BAA8B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oCAAoC,CAAC,CAAC;AAMlG,eAAO,MAAM,gCAAgC;;;;;;;;;;iBAc3C,CAAC;AACH,MAAM,MAAM,0BAA0B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gCAAgC,CAAC,CAAC;AAM1F,MAAM,MAAM,iCAAiC,GAAG,yCAAyC,GAAG;IAC1F,sBAAsB,EAAE,OAAO,oCAAoC,CAAC;IAGpE,mBAAmB,EAAE,uBAAuB,EAAE,CAAC;IAG/C,wBAAwB,EAAE,4BAA4B,EAAE,CAAC;IAGzD,oBAAoB,CAAC,EAAE,wBAAwB,EAAE,CAAC;CACnD,CAAC;AAMF,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;iBAmBrC,CAAC;AACH,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC"}
1
+ {"version":3,"file":"email.external-connectors-models.schemas.d.ts","sourceRoot":"","sources":["../../../../src/protocols/email.external-connectors-models.schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,OAAO,EAA2C,yCAAyC,EAAE,MAAM,uDAAuD,CAAC;AAoB3J;;;GAGG;AACH,oBAAY,uBAAuB;IACjC,aAAa,kBAAkB,CAAG,2CAA2C;IAC7E,SAAS,cAAc;CACxB;AAED;;;GAGG;AACH,oBAAY,4BAA4B;IACtC,QAAQ,aAAa;IACrB,IAAI,SAAS;CACd;AAED;;GAEG;AACH,oBAAY,2BAA2B;IAC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kCAAkC,CAAC,CAAC;AAM9F,eAAO,MAAM,mCAAmC;;;;;;;;;;;;;iBAa9C,CAAC;AACH,MAAM,MAAM,6BAA6B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mCAAmC,CAAC,CAAC;AAMhG,eAAO,MAAM,uCAAuC;;;;;;;;;;;;;;;;;;;;iBAyBlD,CAAC;AACH,MAAM,MAAM,iCAAiC,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uCAAuC,CAAC,CAAC;AAMxG,eAAO,MAAM,kCAAkC;;;;;;;;;;;iBAK7C,CAAC;AACH,MAAM,MAAM,4BAA4B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kCAAkC,CAAC,CAAC;AAM9F,eAAO,MAAM,iCAAiC;;;;;;;;;;;;iBAY5C,CAAC;AACH,MAAM,MAAM,2BAA2B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iCAAiC,CAAC,CAAC;AAM5F,eAAO,MAAM,oCAAoC;;;;;;;;;;;iBAiB/C,CAAC;AACH,MAAM,MAAM,8BAA8B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oCAAoC,CAAC,CAAC;AAMlG,eAAO,MAAM,gCAAgC;;;;;;;;;;iBAc3C,CAAC;AACH,MAAM,MAAM,0BAA0B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gCAAgC,CAAC,CAAC;AAM1F,MAAM,MAAM,iCAAiC,GAAG,yCAAyC,GAAG;IAC1F,sBAAsB,EAAE,OAAO,oCAAoC,CAAC;IAGpE,mBAAmB,EAAE,uBAAuB,EAAE,CAAC;IAG/C,wBAAwB,EAAE,4BAA4B,EAAE,CAAC;IAGzD,oBAAoB,CAAC,EAAE,wBAAwB,EAAE,CAAC;CACnD,CAAC"}
@@ -1,5 +1,4 @@
1
1
  import { z } from "zod";
2
- import { ExternalProvider_ExchangeProtocol_Kind, ExternalProvider_ExchangeProtocol_Status_BaseSchema } from "../core/commons.external-connectors-models.schemas.js";
3
2
  import { ExternalProvider_OperationContextSchema } from "../core/operations.external-connectors-models.schemas.js";
4
3
  //===============================================================
5
4
  // Email Provider
@@ -346,23 +345,4 @@ export const EmailProvider_WebhookEventSchema = z.object({
346
345
  // Original tags
347
346
  tags: z.array(z.string()).optional(),
348
347
  });
349
- // ===============================================================
350
- // Email Provider Status Schema
351
- // ===============================================================
352
- export const EmailProvider_StatusSchema = ExternalProvider_ExchangeProtocol_Status_BaseSchema.extend({
353
- protocolKind: z.literal(ExternalProvider_ExchangeProtocol_Kind.EMAIL_PROVIDER),
354
- // API connectivity
355
- apiConnected: z.boolean().optional(),
356
- smtpConnected: z.boolean().optional(),
357
- // Domain status
358
- domainVerified: z.boolean().optional(),
359
- spfValid: z.boolean().optional(),
360
- dkimValid: z.boolean().optional(),
361
- dmarcValid: z.boolean().optional(),
362
- // Rate limit
363
- rateLimitRemaining: z.number().optional(),
364
- rateLimitResetAt: z.iso.datetime().optional(),
365
- // Reputation (if provider exposes it)
366
- senderReputation: z.number().min(0).max(100).optional(),
367
- });
368
348
  //# sourceMappingURL=email.external-connectors-models.schemas.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"email.external-connectors-models.schemas.js","sourceRoot":"","sources":["../../../../src/protocols/email.external-connectors-models.schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAEL,sCAAsC,EAEtC,mDAAmD,EACpD,MAAM,oDAAoD,CAAC;AAC5D,OAAO,EAAE,uCAAuC,EAA6C,MAAM,uDAAuD,CAAC;AAE3J,iEAAiE;AACjE,iBAAiB;AACjB,WAAW;AACX,qEAAqE;AACrE,wEAAwE;AACxE,sDAAsD;AACtD,EAAE;AACF,wBAAwB;AACxB,wEAAwE;AACxE,0EAA0E;AAC1E,gEAAgE;AAChE,0EAA0E;AAC1E,iEAAiE;AAEjE,kEAAkE;AAClE,uBAAuB;AACvB,kEAAkE;AAElE;;;GAGG;AACH,MAAM,CAAN,IAAY,uBAGX;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ol_Configuration_Base, \n ExternalProvider_ExchangeProtocol_Kind, \n ExternalProvider_ExchangeProtocol_Profile_Base, \n ExternalProvider_ExchangeProtocol_Status_BaseSchema \n} from \"../core/commons.external-connectors-models.schemas\";\nimport { ExternalProvider_OperationContextSchema, ExternalProvider_OperationDefinition_Base } from \"../core/operations.external-connectors-models.schemas\";\n\n//===============================================================\n// Email Provider\n// --------\n// Integration with email service providers for sending transactional\n// and marketing emails. Supports both REST API and SMTP-based providers\n// with differentiated operations for each email type.\n//\n// CONFIGURATION LEVELS:\n// - Profile (Provider-level): Fixed by the provider, cannot be changed.\n// Examples: API endpoints, SMTP server addresses, capabilities, limits.\n// - Configuration (Consumer-level): User-configurable settings.\n// Examples: API keys, sender addresses, tracking preferences, webhooks.\n//===============================================================\n\n// ===============================================================\n// Email Provider Enums\n// ===============================================================\n\n/**\n * The type of email operation - transactional vs marketing have different\n * requirements, compliance rules, and often use separate sending domains/IPs.\n */\nexport enum EmailProvider_EmailType {\n TRANSACTIONAL = \"transactional\", // Password resets, receipts, notifications\n MARKETING = \"marketing\", // Newsletters, promotions, campaigns\n}\n\n/**\n * The delivery method used by the email provider.\n * REST API provides more features, SMTP is simpler but more limited.\n */\nexport enum EmailProvider_DeliveryMethod {\n REST_API = \"rest_api\",\n SMTP = \"smtp\",\n}\n\n/**\n * SMTP encryption/security modes.\n */\nexport enum EmailProvider_SMTP_Security {\n NONE = \"none\", // Plain text (port 25, not recommended)\n STARTTLS = \"starttls\", // Upgrade to TLS (port 587)\n TLS = \"tls\", // Implicit TLS/SSL (port 465)\n}\n\n/**\n * Email delivery status for tracking.\n */\nexport enum EmailProvider_DeliveryStatus {\n QUEUED = \"queued\",\n SENT = \"sent\",\n DELIVERED = \"delivered\",\n OPENED = \"opened\",\n CLICKED = \"clicked\",\n BOUNCED = \"bounced\",\n SOFT_BOUNCED = \"soft_bounced\",\n SPAM_COMPLAINT = \"spam_complaint\",\n UNSUBSCRIBED = \"unsubscribed\",\n DROPPED = \"dropped\",\n DEFERRED = \"deferred\",\n FAILED = \"failed\",\n}\n\n/**\n * Email bounce types.\n */\nexport enum EmailProvider_BounceType {\n HARD = \"hard\", // Permanent failure (address doesn't exist)\n SOFT = \"soft\", // Temporary failure (mailbox full, server down)\n TRANSIENT = \"transient\",\n}\n\n/**\n * Standard email provider operation keys.\n * Each provider implements a subset of these based on capabilities.\n */\nexport enum EmailProvider_OperationKey {\n // Core Transactional Operations\n SEND_EMAIL = \"email.send\",\n SEND_BATCH = \"email.sendBatch\",\n SEND_TEMPLATE = \"email.sendTemplate\",\n \n // Marketing/Campaign Operations\n SEND_CAMPAIGN = \"email.campaign.send\",\n CREATE_CAMPAIGN = \"email.campaign.create\",\n SCHEDULE_CAMPAIGN = \"email.campaign.schedule\",\n GET_CAMPAIGN = \"email.campaign.get\",\n \n // List Management (Marketing)\n LIST_CREATE = \"email.list.create\",\n LIST_ADD_CONTACT = \"email.list.addContact\",\n LIST_REMOVE_CONTACT = \"email.list.removeContact\",\n LIST_GET = \"email.list.get\",\n \n // Template Operations\n TEMPLATE_CREATE = \"email.template.create\",\n TEMPLATE_GET = \"email.template.get\",\n TEMPLATE_LIST = \"email.template.list\",\n TEMPLATE_DELETE = \"email.template.delete\",\n \n // Status & Analytics\n GET_MESSAGE_STATUS = \"email.message.getStatus\",\n GET_ANALYTICS = \"email.analytics.get\",\n \n // Suppression/Bounces\n GET_SUPPRESSIONS = \"email.suppressions.get\",\n ADD_SUPPRESSION = \"email.suppressions.add\",\n DELETE_SUPPRESSION = \"email.suppressions.delete\",\n \n // Domain Verification\n DOMAIN_VERIFY = \"email.domain.verify\",\n DOMAIN_GET_STATUS = \"email.domain.getStatus\",\n}\n\n/**\n * Email provider capabilities - what features the provider supports.\n * Used to determine which operations are available.\n */\nexport enum EmailProvider_Capability {\n // Delivery Methods\n SUPPORTS_REST_API = \"supports_rest_api\",\n SUPPORTS_SMTP = \"supports_smtp\",\n \n // Email Types\n SUPPORTS_TRANSACTIONAL = \"supports_transactional\",\n SUPPORTS_MARKETING = \"supports_marketing\",\n \n // Core Features\n SUPPORTS_TEMPLATES = \"supports_templates\",\n SUPPORTS_BATCH_SENDING = \"supports_batch_sending\",\n SUPPORTS_SCHEDULING = \"supports_scheduling\",\n SUPPORTS_ATTACHMENTS = \"supports_attachments\",\n SUPPORTS_INLINE_IMAGES = \"supports_inline_images\",\n \n // Tracking\n SUPPORTS_OPEN_TRACKING = \"supports_open_tracking\",\n SUPPORTS_CLICK_TRACKING = \"supports_click_tracking\",\n SUPPORTS_WEBHOOKS = \"supports_webhooks\",\n \n // Marketing Specific\n SUPPORTS_CAMPAIGNS = \"supports_campaigns\",\n SUPPORTS_LIST_MANAGEMENT = \"supports_list_management\",\n SUPPORTS_SEGMENTATION = \"supports_segmentation\",\n SUPPORTS_AB_TESTING = \"supports_ab_testing\",\n \n // Compliance & Deliverability\n SUPPORTS_SUPPRESSION_LISTS = \"supports_suppression_lists\",\n SUPPORTS_DEDICATED_IP = \"supports_dedicated_ip\",\n SUPPORTS_CUSTOM_DOMAIN = \"supports_custom_domain\",\n SUPPORTS_EMAIL_VALIDATION = \"supports_email_validation\",\n}\n\n// ===============================================================\n// SMTP Server Profile (Provider-level, fixed)\n// ===============================================================\n\nexport const EmailProvider_SMTP_ServerProfileSchema = z.object({\n host: z.string().min(1),\n port: z.number().int().min(1).max(65535),\n security: z.enum(EmailProvider_SMTP_Security),\n // Note: username/password are consumer-level (in Configuration)\n});\nexport type EmailProvider_SMTP_ServerProfile = z.infer<typeof EmailProvider_SMTP_ServerProfileSchema>;\n\n// ===============================================================\n// Email Address Schema\n// ===============================================================\n\nexport const EmailProvider_AddressSchema = z.object({\n email: z.email(),\n name: z.string().optional(),\n});\nexport type EmailProvider_Address = z.infer<typeof EmailProvider_AddressSchema>;\n\n// ===============================================================\n// Email Attachment Schema\n// ===============================================================\n\nexport const EmailProvider_AttachmentSchema = z.object({\n filename: z.string().min(1),\n content: z.string(), // Base64 encoded content\n contentType: z.string().optional(),\n contentId: z.string().optional(), // For inline images (cid:)\n});\nexport type EmailProvider_Attachment = z.infer<typeof EmailProvider_AttachmentSchema>;\n\n// ===============================================================\n// Email Provider Profile (Provider-level - FIXED by provider)\n// ===============================================================\n\nexport type EmailProvider_Profile = ExternalProvider_ExchangeProtocol_Profile_Base & {\n // Human-readable provider name (for display and registry)\n displayName?: string;\n \n // API settings (for REST API providers)\n baseURL: string;\n apiVersion?: string;\n \n // SMTP server settings (for SMTP-capable providers)\n // Note: These are the provider's SMTP server details, NOT user credentials\n smtpServer?: EmailProvider_SMTP_ServerProfile;\n \n // Provider capabilities (fixed)\n capabilities: EmailProvider_Capability[];\n \n // Supported email types (fixed)\n supportedEmailTypes: EmailProvider_EmailType[];\n \n // Delivery methods supported (fixed)\n deliveryMethods: EmailProvider_DeliveryMethod[];\n \n // Provider-imposed limits (fixed)\n limits: {\n maxRecipientsPerRequest?: number;\n maxBatchSize?: number;\n maxAttachmentSizeMB?: number;\n maxEmailSizeKB?: number;\n rateLimit?: {\n requests: number;\n period: \"second\" | \"minute\" | \"hour\" | \"day\";\n };\n };\n};\n\n// ===============================================================\n// Email Provider Configuration (Consumer-level - user configurable)\n// ===============================================================\n\nexport type EmailProvider_Configuration = ExternalProvider_ExchangeProtocol_Configuration_Base & {\n // Preferred delivery method (if provider supports both)\n preferredDeliveryMethod?: EmailProvider_DeliveryMethod;\n \n // SMTP credentials (user's credentials for SMTP)\n smtpCredentials?: {\n username: string;\n passwordSecretRef: string; // Reference to secret store\n };\n \n // Default sender identity (user's sender)\n defaultFromAddress?: EmailProvider_Address;\n defaultReplyTo?: EmailProvider_Address;\n \n // Tracking preferences\n openTrackingEnabled?: boolean;\n clickTrackingEnabled?: boolean;\n \n // Webhook for delivery events\n webhookConfig?: {\n url: string;\n secretRef?: string;\n events?: EmailProvider_DeliveryStatus[];\n };\n \n // Testing/sandbox mode\n sandboxMode?: boolean;\n \n // IP pool selection (for providers that support it)\n ipPoolName?: string;\n \n // Tags to apply to all emails\n defaultTags?: string[];\n};\n\n// ===============================================================\n// Send Email Input Schema\n// ===============================================================\n\nexport const EmailProvider_SendEmailInputSchema = z.object({\n // Recipients\n to: z.array(EmailProvider_AddressSchema).min(1),\n cc: z.array(EmailProvider_AddressSchema).optional(),\n bcc: z.array(EmailProvider_AddressSchema).optional(),\n \n // Sender (can override configuration default)\n from: EmailProvider_AddressSchema.optional(),\n replyTo: EmailProvider_AddressSchema.optional(),\n \n // Content\n subject: z.string().min(1),\n text: z.string().optional(),\n html: z.string().optional(),\n \n // Attachments\n attachments: z.array(EmailProvider_AttachmentSchema).optional(),\n \n // Headers\n headers: z.record(z.string(), z.string()).optional(),\n \n // Tags for categorization/analytics\n tags: z.array(z.string()).optional(),\n \n // Scheduling\n scheduledAt: z.iso.datetime().optional(),\n \n // Tracking overrides\n trackOpens: z.boolean().optional(),\n trackClicks: z.boolean().optional(),\n});\nexport type EmailProvider_SendEmailInput = z.infer<typeof EmailProvider_SendEmailInputSchema>;\n\n// ===============================================================\n// Send Email Output Schema\n// ===============================================================\n\nexport const EmailProvider_SendEmailOutputSchema = z.object({\n // Provider's message ID\n id: z.string(),\n \n // Status (if available immediately)\n status: z.enum(EmailProvider_DeliveryStatus).optional(),\n \n // Provider-specific data\n providerMessageId: z.string().optional(),\n});\nexport type EmailProvider_SendEmailOutput = z.infer<typeof EmailProvider_SendEmailOutputSchema>;\n\n// ===============================================================\n// Send Template Email Input Schema\n// ===============================================================\n\nexport const EmailProvider_SendTemplateInputSchema = z.object({\n // Recipients\n to: z.array(EmailProvider_AddressSchema).min(1),\n cc: z.array(EmailProvider_AddressSchema).optional(),\n bcc: z.array(EmailProvider_AddressSchema).optional(),\n \n // Sender\n from: EmailProvider_AddressSchema.optional(),\n replyTo: EmailProvider_AddressSchema.optional(),\n \n // Template\n templateId: z.string().min(1),\n templateAlias: z.string().optional(), // Some providers use alias instead of ID\n \n // Template variables\n variables: z.record(z.string(), z.unknown()).optional(),\n \n // Subject override (if template allows)\n subject: z.string().optional(),\n \n // Tags\n tags: z.array(z.string()).optional(),\n \n // Scheduling\n scheduledAt: z.iso.datetime().optional(),\n});\nexport type EmailProvider_SendTemplateInput = z.infer<typeof EmailProvider_SendTemplateInputSchema>;\n\n// ===============================================================\n// Batch Send Input Schema\n// ===============================================================\n\nconst emailProviderBatchItemSchema = z.object({\n to: EmailProvider_AddressSchema,\n variables: z.record(z.string(), z.unknown()).optional(),\n subject: z.string().optional(), // Override per recipient\n});\n\nexport const EmailProvider_SendBatchInputSchema = z.object({\n // Sender\n from: EmailProvider_AddressSchema.optional(),\n replyTo: EmailProvider_AddressSchema.optional(),\n \n // Content (direct or template)\n subject: z.string().optional(), // Default subject\n text: z.string().optional(),\n html: z.string().optional(),\n templateId: z.string().optional(),\n \n // Recipients with personalizations\n recipients: z.array(emailProviderBatchItemSchema).min(1),\n \n // Tags\n tags: z.array(z.string()).optional(),\n});\nexport type EmailProvider_SendBatchInput = z.infer<typeof EmailProvider_SendBatchInputSchema>;\n\n// ===============================================================\n// Batch Send Output Schema\n// ===============================================================\n\nexport const EmailProvider_SendBatchOutputSchema = z.object({\n // Summary\n totalRequested: z.number().int(),\n totalAccepted: z.number().int(),\n totalRejected: z.number().int(),\n \n // Results per recipient\n results: z.array(z.object({\n email: z.string(),\n id: z.string().optional(),\n status: z.enum([\"accepted\", \"rejected\"]),\n error: z.string().optional(),\n })),\n});\nexport type EmailProvider_SendBatchOutput = z.infer<typeof EmailProvider_SendBatchOutputSchema>;\n\n// ===============================================================\n// Campaign Input Schema (Marketing)\n// ===============================================================\n\nexport const EmailProvider_CreateCampaignInputSchema = z.object({\n // Campaign details\n name: z.string().min(1),\n subject: z.string().min(1),\n previewText: z.string().optional(),\n \n // Sender\n from: EmailProvider_AddressSchema,\n replyTo: EmailProvider_AddressSchema.optional(),\n \n // Content\n html: z.string().optional(),\n text: z.string().optional(),\n templateId: z.string().optional(),\n \n // Recipients\n listIds: z.array(z.string()).optional(),\n segmentIds: z.array(z.string()).optional(),\n \n // Scheduling\n scheduledAt: z.iso.datetime().optional(),\n \n // Tracking\n trackOpens: z.boolean().optional().default(true),\n trackClicks: z.boolean().optional().default(true),\n});\nexport type EmailProvider_CreateCampaignInput = z.infer<typeof EmailProvider_CreateCampaignInputSchema>;\n\n// ===============================================================\n// Campaign Output Schema\n// ===============================================================\n\nexport const EmailProvider_CampaignOutputSchema = z.object({\n id: z.string(),\n status: z.enum([\"draft\", \"scheduled\", \"sending\", \"sent\", \"cancelled\"]),\n scheduledAt: z.iso.datetime().optional(),\n sentAt: z.iso.datetime().optional(),\n});\nexport type EmailProvider_CampaignOutput = z.infer<typeof EmailProvider_CampaignOutputSchema>;\n\n// ===============================================================\n// Message Status Schema\n// ===============================================================\n\nexport const EmailProvider_MessageStatusSchema = z.object({\n id: z.string(),\n status: z.enum(EmailProvider_DeliveryStatus),\n to: z.email(),\n subject: z.string().optional(),\n sentAt: z.iso.datetime().optional(),\n deliveredAt: z.iso.datetime().optional(),\n openedAt: z.iso.datetime().optional(),\n clickedAt: z.iso.datetime().optional(),\n bouncedAt: z.iso.datetime().optional(),\n bounceType: z.enum(EmailProvider_BounceType).optional(),\n bounceReason: z.string().optional(),\n});\nexport type EmailProvider_MessageStatus = z.infer<typeof EmailProvider_MessageStatusSchema>;\n\n// ===============================================================\n// Email Operation Context (for tracking)\n// ===============================================================\n\nexport const EmailProvider_OperationContextSchema = ExternalProvider_OperationContextSchema.extend({\n // Message identification\n messageId: z.string().optional(),\n \n // Delivery info\n deliveryMethod: z.enum(EmailProvider_DeliveryMethod).optional(),\n deliveryStatus: z.enum(EmailProvider_DeliveryStatus).optional(),\n \n // Email type\n emailType: z.enum(EmailProvider_EmailType).optional(),\n \n // Counts\n recipientCount: z.number().int().optional(),\n \n // Rate limit headers from provider\n rateLimitRemaining: z.number().optional(),\n rateLimitResetAt: z.iso.datetime().optional(),\n});\nexport type EmailProvider_OperationContext = z.infer<typeof EmailProvider_OperationContextSchema>;\n\n// ===============================================================\n// Webhook Event Schema\n// ===============================================================\n\nexport const EmailProvider_WebhookEventSchema = z.object({\n eventType: z.enum(EmailProvider_DeliveryStatus),\n messageId: z.string(),\n email: z.email(),\n timestamp: z.iso.datetime(),\n \n // Event-specific data\n bounceType: z.enum(EmailProvider_BounceType).optional(),\n bounceReason: z.string().optional(),\n link: z.url().optional(), // For click events\n userAgent: z.string().optional(),\n \n // Original tags\n tags: z.array(z.string()).optional(),\n});\nexport type EmailProvider_WebhookEvent = z.infer<typeof EmailProvider_WebhookEventSchema>;\n\n// ===============================================================\n// Email Operation Definition\n// ===============================================================\n\nexport type EmailProvider_OperationDefinition = ExternalProvider_OperationDefinition_Base & {\n operationContextSchema: typeof EmailProvider_OperationContextSchema;\n \n // Which email types this operation supports\n supportedEmailTypes: EmailProvider_EmailType[];\n \n // Which delivery methods work for this operation\n supportedDeliveryMethods: EmailProvider_DeliveryMethod[];\n \n // Required capabilities\n requiredCapabilities?: EmailProvider_Capability[];\n};\n\n// ===============================================================\n// Email Provider Status Schema\n// ===============================================================\n\nexport const EmailProvider_StatusSchema = ExternalProvider_ExchangeProtocol_Status_BaseSchema.extend({\n protocolKind: z.literal(ExternalProvider_ExchangeProtocol_Kind.EMAIL_PROVIDER),\n \n // API connectivity\n apiConnected: z.boolean().optional(),\n smtpConnected: z.boolean().optional(),\n \n // Domain status\n domainVerified: z.boolean().optional(),\n spfValid: z.boolean().optional(),\n dkimValid: z.boolean().optional(),\n dmarcValid: z.boolean().optional(),\n \n // Rate limit\n rateLimitRemaining: z.number().optional(),\n rateLimitResetAt: z.iso.datetime().optional(),\n \n // Reputation (if provider exposes it)\n senderReputation: z.number().min(0).max(100).optional(),\n});\nexport type EmailProvider_Status = z.infer<typeof EmailProvider_StatusSchema>;\n"]}
1
+ {"version":3,"file":"email.external-connectors-models.schemas.js","sourceRoot":"","sources":["../../../../src/protocols/email.external-connectors-models.schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,OAAO,EAAE,uCA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E,CAAC,CAAC,IAAI,CAAC,4BAA4B,CAAC;IAC/C,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;IACrB,KAAK,EAAE,CAAC,CAAC,KAAK,EAAE;IAChB,SAAS,EAAE,CAAC,CAAC,GAAG,CAAC,QAAQ,EAAE;IAE3B,sBAAsB;IACtB,UAAU,EAAE,CAAC,CAAC,IAAI,CAAC,wBAAwB,CAAC,CAAC,QAAQ,EAAE;IACvD,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACnC,IAAI,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,EAAE,mBAAmB;IAC7C,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAEhC,gBAAgB;IAChB,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE;CACrC,CAAC,CAAC","sourcesContent":["import { z } from \"zod\";\nimport { \n ExternalProvider_ExchangeProtocol_Kind \n} from \"../core/commons.external-connectors-models.schemas\";\nimport { ExternalProvider_OperationContextSchema, ExternalProvider_OperationDefinition_Base } from \"../core/operations.external-connectors-models.schemas\";\n\n//===============================================================\n// Email Provider\n// --------\n// Integration with email service providers for sending transactional\n// and marketing emails. Supports both REST API and SMTP-based providers\n// with differentiated operations for each email type.\n//\n// CONFIGURATION LEVELS:\n// - Profile (Provider-level): Fixed by the provider, cannot be changed.\n// Examples: API endpoints, SMTP server addresses, capabilities, limits.\n// - Configuration (Consumer-level): User-configurable settings.\n// Examples: API keys, sender addresses, tracking preferences, webhooks.\n//===============================================================\n\n// ===============================================================\n// Email Provider Enums\n// ===============================================================\n\n/**\n * The type of email operation - transactional vs marketing have different\n * requirements, compliance rules, and often use separate sending domains/IPs.\n */\nexport enum EmailProvider_EmailType {\n TRANSACTIONAL = \"transactional\", // Password resets, receipts, notifications\n MARKETING = \"marketing\", // Newsletters, promotions, campaigns\n}\n\n/**\n * The delivery method used by the email provider.\n * REST API provides more features, SMTP is simpler but more limited.\n */\nexport enum EmailProvider_DeliveryMethod {\n REST_API = \"rest_api\",\n SMTP = \"smtp\",\n}\n\n/**\n * SMTP encryption/security modes.\n */\nexport enum EmailProvider_SMTP_Security {\n NONE = \"none\", // Plain text (port 25, not recommended)\n STARTTLS = \"starttls\", // Upgrade to TLS (port 587)\n TLS = \"tls\", // Implicit TLS/SSL (port 465)\n}\n\n/**\n * Email delivery status for tracking.\n */\nexport enum EmailProvider_DeliveryStatus {\n QUEUED = \"queued\",\n SENT = \"sent\",\n DELIVERED = \"delivered\",\n OPENED = \"opened\",\n CLICKED = \"clicked\",\n BOUNCED = \"bounced\",\n SOFT_BOUNCED = \"soft_bounced\",\n SPAM_COMPLAINT = \"spam_complaint\",\n UNSUBSCRIBED = \"unsubscribed\",\n DROPPED = \"dropped\",\n DEFERRED = \"deferred\",\n FAILED = \"failed\",\n}\n\n/**\n * Email bounce types.\n */\nexport enum EmailProvider_BounceType {\n HARD = \"hard\", // Permanent failure (address doesn't exist)\n SOFT = \"soft\", // Temporary failure (mailbox full, server down)\n TRANSIENT = \"transient\",\n}\n\n/**\n * Standard email provider operation keys.\n * Each provider implements a subset of these based on capabilities.\n */\nexport enum EmailProvider_OperationKey {\n // Core Transactional Operations\n SEND_EMAIL = \"email.send\",\n SEND_BATCH = \"email.sendBatch\",\n SEND_TEMPLATE = \"email.sendTemplate\",\n \n // Marketing/Campaign Operations\n SEND_CAMPAIGN = \"email.campaign.send\",\n CREATE_CAMPAIGN = \"email.campaign.create\",\n SCHEDULE_CAMPAIGN = \"email.campaign.schedule\",\n GET_CAMPAIGN = \"email.campaign.get\",\n \n // List Management (Marketing)\n LIST_CREATE = \"email.list.create\",\n LIST_ADD_CONTACT = \"email.list.addContact\",\n LIST_REMOVE_CONTACT = \"email.list.removeContact\",\n LIST_GET = \"email.list.get\",\n \n // Template Operations\n TEMPLATE_CREATE = \"email.template.create\",\n TEMPLATE_GET = \"email.template.get\",\n TEMPLATE_LIST = \"email.template.list\",\n TEMPLATE_DELETE = \"email.template.delete\",\n \n // Status & Analytics\n GET_MESSAGE_STATUS = \"email.message.getStatus\",\n GET_ANALYTICS = \"email.analytics.get\",\n \n // Suppression/Bounces\n GET_SUPPRESSIONS = \"email.suppressions.get\",\n ADD_SUPPRESSION = \"email.suppressions.add\",\n DELETE_SUPPRESSION = \"email.suppressions.delete\",\n \n // Domain Verification\n DOMAIN_VERIFY = \"email.domain.verify\",\n DOMAIN_GET_STATUS = \"email.domain.getStatus\",\n}\n\n/**\n * Email provider capabilities - what features the provider supports.\n * Used to determine which operations are available.\n */\nexport enum EmailProvider_Capability {\n // Delivery Methods\n SUPPORTS_REST_API = \"supports_rest_api\",\n SUPPORTS_SMTP = \"supports_smtp\",\n \n // Email Types\n SUPPORTS_TRANSACTIONAL = \"supports_transactional\",\n SUPPORTS_MARKETING = \"supports_marketing\",\n \n // Core Features\n SUPPORTS_TEMPLATES = \"supports_templates\",\n SUPPORTS_BATCH_SENDING = \"supports_batch_sending\",\n SUPPORTS_SCHEDULING = \"supports_scheduling\",\n SUPPORTS_ATTACHMENTS = \"supports_attachments\",\n SUPPORTS_INLINE_IMAGES = \"supports_inline_images\",\n \n // Tracking\n SUPPORTS_OPEN_TRACKING = \"supports_open_tracking\",\n SUPPORTS_CLICK_TRACKING = \"supports_click_tracking\",\n SUPPORTS_WEBHOOKS = \"supports_webhooks\",\n \n // Marketing Specific\n SUPPORTS_CAMPAIGNS = \"supports_campaigns\",\n SUPPORTS_LIST_MANAGEMENT = \"supports_list_management\",\n SUPPORTS_SEGMENTATION = \"supports_segmentation\",\n SUPPORTS_AB_TESTING = \"supports_ab_testing\",\n \n // Compliance & Deliverability\n SUPPORTS_SUPPRESSION_LISTS = \"supports_suppression_lists\",\n SUPPORTS_DEDICATED_IP = \"supports_dedicated_ip\",\n SUPPORTS_CUSTOM_DOMAIN = \"supports_custom_domain\",\n SUPPORTS_EMAIL_VALIDATION = \"supports_email_validation\",\n}\n\n// ===============================================================\n// SMTP Server Profile (Provider-level, fixed)\n// ===============================================================\n\nexport const EmailProvider_SMTP_ServerProfileSchema = z.object({\n host: z.string().min(1),\n port: z.number().int().min(1).max(65535),\n security: z.enum(EmailProvider_SMTP_Security),\n // Note: username/password are consumer-level (in Configuration)\n});\nexport type EmailProvider_SMTP_ServerProfile = z.infer<typeof EmailProvider_SMTP_ServerProfileSchema>;\n\n// ===============================================================\n// Email Address Schema\n// ===============================================================\n\nexport const EmailProvider_AddressSchema = z.object({\n email: z.email(),\n name: z.string().optional(),\n});\nexport type EmailProvider_Address = z.infer<typeof EmailProvider_AddressSchema>;\n\n// ===============================================================\n// Email Attachment Schema\n// ===============================================================\n\nexport const EmailProvider_AttachmentSchema = z.object({\n filename: z.string().min(1),\n content: z.string(), // Base64 encoded content\n contentType: z.string().optional(),\n contentId: z.string().optional(), // For inline images (cid:)\n});\nexport type EmailProvider_Attachment = z.infer<typeof EmailProvider_AttachmentSchema>;\n\n// ===============================================================\n// Send Email Input Schema\n// ===============================================================\n\nexport const EmailProvider_SendEmailInputSchema = z.object({\n // Recipients\n to: z.array(EmailProvider_AddressSchema).min(1),\n cc: z.array(EmailProvider_AddressSchema).optional(),\n bcc: z.array(EmailProvider_AddressSchema).optional(),\n \n // Sender (can override configuration default)\n from: EmailProvider_AddressSchema.optional(),\n replyTo: EmailProvider_AddressSchema.optional(),\n \n // Content\n subject: z.string().min(1),\n text: z.string().optional(),\n html: z.string().optional(),\n \n // Attachments\n attachments: z.array(EmailProvider_AttachmentSchema).optional(),\n \n // Headers\n headers: z.record(z.string(), z.string()).optional(),\n \n // Tags for categorization/analytics\n tags: z.array(z.string()).optional(),\n \n // Scheduling\n scheduledAt: z.iso.datetime().optional(),\n \n // Tracking overrides\n trackOpens: z.boolean().optional(),\n trackClicks: z.boolean().optional(),\n});\nexport type EmailProvider_SendEmailInput = z.infer<typeof EmailProvider_SendEmailInputSchema>;\n\n// ===============================================================\n// Send Email Output Schema\n// ===============================================================\n\nexport const EmailProvider_SendEmailOutputSchema = z.object({\n // Provider's message ID\n id: z.string(),\n \n // Status (if available immediately)\n status: z.enum(EmailProvider_DeliveryStatus).optional(),\n \n // Provider-specific data\n providerMessageId: z.string().optional(),\n});\nexport type EmailProvider_SendEmailOutput = z.infer<typeof EmailProvider_SendEmailOutputSchema>;\n\n// ===============================================================\n// Send Template Email Input Schema\n// ===============================================================\n\nexport const EmailProvider_SendTemplateInputSchema = z.object({\n // Recipients\n to: z.array(EmailProvider_AddressSchema).min(1),\n cc: z.array(EmailProvider_AddressSchema).optional(),\n bcc: z.array(EmailProvider_AddressSchema).optional(),\n \n // Sender\n from: EmailProvider_AddressSchema.optional(),\n replyTo: EmailProvider_AddressSchema.optional(),\n \n // Template\n templateId: z.string().min(1),\n templateAlias: z.string().optional(), // Some providers use alias instead of ID\n \n // Template variables\n variables: z.record(z.string(), z.unknown()).optional(),\n \n // Subject override (if template allows)\n subject: z.string().optional(),\n \n // Tags\n tags: z.array(z.string()).optional(),\n \n // Scheduling\n scheduledAt: z.iso.datetime().optional(),\n});\nexport type EmailProvider_SendTemplateInput = z.infer<typeof EmailProvider_SendTemplateInputSchema>;\n\n// ===============================================================\n// Batch Send Input Schema\n// ===============================================================\n\nconst emailProviderBatchItemSchema = z.object({\n to: EmailProvider_AddressSchema,\n variables: z.record(z.string(), z.unknown()).optional(),\n subject: z.string().optional(), // Override per recipient\n});\n\nexport const EmailProvider_SendBatchInputSchema = z.object({\n // Sender\n from: EmailProvider_AddressSchema.optional(),\n replyTo: EmailProvider_AddressSchema.optional(),\n \n // Content (direct or template)\n subject: z.string().optional(), // Default subject\n text: z.string().optional(),\n html: z.string().optional(),\n templateId: z.string().optional(),\n \n // Recipients with personalizations\n recipients: z.array(emailProviderBatchItemSchema).min(1),\n \n // Tags\n tags: z.array(z.string()).optional(),\n});\nexport type EmailProvider_SendBatchInput = z.infer<typeof EmailProvider_SendBatchInputSchema>;\n\n// ===============================================================\n// Batch Send Output Schema\n// ===============================================================\n\nexport const EmailProvider_SendBatchOutputSchema = z.object({\n // Summary\n totalRequested: z.number().int(),\n totalAccepted: z.number().int(),\n totalRejected: z.number().int(),\n \n // Results per recipient\n results: z.array(z.object({\n email: z.string(),\n id: z.string().optional(),\n status: z.enum([\"accepted\", \"rejected\"]),\n error: z.string().optional(),\n })),\n});\nexport type EmailProvider_SendBatchOutput = z.infer<typeof EmailProvider_SendBatchOutputSchema>;\n\n// ===============================================================\n// Campaign Input Schema (Marketing)\n// ===============================================================\n\nexport const EmailProvider_CreateCampaignInputSchema = z.object({\n // Campaign details\n name: z.string().min(1),\n subject: z.string().min(1),\n previewText: z.string().optional(),\n \n // Sender\n from: EmailProvider_AddressSchema,\n replyTo: EmailProvider_AddressSchema.optional(),\n \n // Content\n html: z.string().optional(),\n text: z.string().optional(),\n templateId: z.string().optional(),\n \n // Recipients\n listIds: z.array(z.string()).optional(),\n segmentIds: z.array(z.string()).optional(),\n \n // Scheduling\n scheduledAt: z.iso.datetime().optional(),\n \n // Tracking\n trackOpens: z.boolean().optional().default(true),\n trackClicks: z.boolean().optional().default(true),\n});\nexport type EmailProvider_CreateCampaignInput = z.infer<typeof EmailProvider_CreateCampaignInputSchema>;\n\n// ===============================================================\n// Campaign Output Schema\n// ===============================================================\n\nexport const EmailProvider_CampaignOutputSchema = z.object({\n id: z.string(),\n status: z.enum([\"draft\", \"scheduled\", \"sending\", \"sent\", \"cancelled\"]),\n scheduledAt: z.iso.datetime().optional(),\n sentAt: z.iso.datetime().optional(),\n});\nexport type EmailProvider_CampaignOutput = z.infer<typeof EmailProvider_CampaignOutputSchema>;\n\n// ===============================================================\n// Message Status Schema\n// ===============================================================\n\nexport const EmailProvider_MessageStatusSchema = z.object({\n id: z.string(),\n status: z.enum(EmailProvider_DeliveryStatus),\n to: z.email(),\n subject: z.string().optional(),\n sentAt: z.iso.datetime().optional(),\n deliveredAt: z.iso.datetime().optional(),\n openedAt: z.iso.datetime().optional(),\n clickedAt: z.iso.datetime().optional(),\n bouncedAt: z.iso.datetime().optional(),\n bounceType: z.enum(EmailProvider_BounceType).optional(),\n bounceReason: z.string().optional(),\n});\nexport type EmailProvider_MessageStatus = z.infer<typeof EmailProvider_MessageStatusSchema>;\n\n// ===============================================================\n// Email Operation Context (for tracking)\n// ===============================================================\n\nexport const EmailProvider_OperationContextSchema = ExternalProvider_OperationContextSchema.extend({\n // Message identification\n messageId: z.string().optional(),\n \n // Delivery info\n deliveryMethod: z.enum(EmailProvider_DeliveryMethod).optional(),\n deliveryStatus: z.enum(EmailProvider_DeliveryStatus).optional(),\n \n // Email type\n emailType: z.enum(EmailProvider_EmailType).optional(),\n \n // Counts\n recipientCount: z.number().int().optional(),\n \n // Rate limit headers from provider\n rateLimitRemaining: z.number().optional(),\n rateLimitResetAt: z.iso.datetime().optional(),\n});\nexport type EmailProvider_OperationContext = z.infer<typeof EmailProvider_OperationContextSchema>;\n\n// ===============================================================\n// Webhook Event Schema\n// ===============================================================\n\nexport const EmailProvider_WebhookEventSchema = z.object({\n eventType: z.enum(EmailProvider_DeliveryStatus),\n messageId: z.string(),\n email: z.email(),\n timestamp: z.iso.datetime(),\n \n // Event-specific data\n bounceType: z.enum(EmailProvider_BounceType).optional(),\n bounceReason: z.string().optional(),\n link: z.url().optional(), // For click events\n userAgent: z.string().optional(),\n \n // Original tags\n tags: z.array(z.string()).optional(),\n});\nexport type EmailProvider_WebhookEvent = z.infer<typeof EmailProvider_WebhookEventSchema>;\n\n// ===============================================================\n// Email Operation Definition\n// ===============================================================\n\nexport type EmailProvider_OperationDefinition = ExternalProvider_OperationDefinition_Base & {\n operationContextSchema: typeof EmailProvider_OperationContextSchema;\n \n // Which email types this operation supports\n supportedEmailTypes: EmailProvider_EmailType[];\n \n // Which delivery methods work for this operation\n supportedDeliveryMethods: EmailProvider_DeliveryMethod[];\n \n // Required capabilities\n requiredCapabilities?: EmailProvider_Capability[];\n};\n\n"]}
@@ -325,14 +325,14 @@ export declare const StandardEmail_ErrorSchema: z.ZodObject<{
325
325
  code: z.ZodEnum<{
326
326
  VALIDATION_ERROR: "VALIDATION_ERROR";
327
327
  PROVIDER_ERROR: "PROVIDER_ERROR";
328
- RATE_LIMIT_EXCEEDED: "RATE_LIMIT_EXCEEDED";
329
- AUTHENTICATION_FAILED: "AUTHENTICATION_FAILED";
330
- QUOTA_EXCEEDED: "QUOTA_EXCEEDED";
331
- UNKNOWN_ERROR: "UNKNOWN_ERROR";
332
328
  CAPABILITY_NOT_SUPPORTED: "CAPABILITY_NOT_SUPPORTED";
333
329
  MARKETING_NOT_SUPPORTED: "MARKETING_NOT_SUPPORTED";
334
330
  SCHEDULING_NOT_SUPPORTED: "SCHEDULING_NOT_SUPPORTED";
335
331
  TEMPLATE_NOT_FOUND: "TEMPLATE_NOT_FOUND";
332
+ RATE_LIMIT_EXCEEDED: "RATE_LIMIT_EXCEEDED";
333
+ AUTHENTICATION_FAILED: "AUTHENTICATION_FAILED";
334
+ QUOTA_EXCEEDED: "QUOTA_EXCEEDED";
335
+ UNKNOWN_ERROR: "UNKNOWN_ERROR";
336
336
  }>;
337
337
  message: z.ZodString;
338
338
  provider: z.ZodOptional<z.ZodString>;
@@ -1 +1 @@
1
- {"version":3,"file":"email.standard-interface.schemas.d.ts","sourceRoot":"","sources":["../../../src/protocols/email.standard-interface.schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,wBAAwB,EAA2B,4BAA4B,EAAE,MAAM,4CAA4C,CAAC;AAmB7I,eAAO,MAAM,2BAA2B;;;iBAGtC,CAAC;AAEH,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAMhF,eAAO,MAAM,8BAA8B;;;;;iBAKzC,CAAC;AAEH,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,8BAA8B,CAAC,CAAC;AAEtF;;;;;;G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AAC;AAM5E;;;GAGG;AACH,eAAO,MAAM,mCAAmC;wBAC7B,wBAAwB,EAAE;;;;;;CAMnC,CAAC;AAEX,MAAM,MAAM,uBAAuB,GAAG,MAAM,OAAO,mCAAmC,CAAC"}
1
+ {"version":3,"file":"email.standard-interface.schemas.d.ts","sourceRoot":"","sources":["../../../../src/protocols/email.standard-interface.schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,wBAAwB,EAA2B,4BAA4B,EAAE,MAAM,4CAA4C,CAAC;AAmB7I,eAAO,MAAM,2BAA2B;;;iBAGtC,CAAC;AAEH,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAMhF,eAAO,MAAM,8BAA8B;;;;;iBAKzC,CAAC;AAEH,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,8BAA8B,CAAC,CAAC;AAEtF;;;;;;GAMG;AACH,oBAAY,4BAA4B;IACtC,IAAI,SAAS;IACb,mBAAmB,wBAAwB;CAC5C;AAED,8EAA8E;AAC9E,oBAAY,6BAA6B;IACvC,MAAM,WAAW;IACjB,IAAI,SAAS;IACb,SAAS,cAAc;CACxB;AAED,kFAAkF;AAClF,oBAAY,qCAAqC;IAC/C,QAAQ,aAAa;IACrB,QAAQ,aAAa;IACrB,kBAAkB,uBAAuB;CAC1C;AAMD,eAAO,MAAM,+BAA+B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA0C3C,CAAC;AAEF,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,+BAA+B,CAAC,CAAC;AAMxF,eAAO,MAAM,gCAAgC;;;;;;;;;;;;;iBAkH3C,CAAC;AAEH,MAAM,MAAM,0BAA0B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gCAAgC,CAAC,CAAC;AAM1F,eAAO,M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D,CAAC;AAEH,MAAM,MAAM,iCAAiC,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uCAAuC,CAAC,CAAC;AAMxG,eAAO,MAAM,wCAAwC;;;;;;;;;;;;;;iBAQnD,CAAC;AAEH,MAAM,MAAM,kCAAkC,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wCAAwC,CAAC,CAAC;AAM1G,eAAO,MAAM,oCAAoC;;iBAE/C,CAAC;AAEH,MAAM,MAAM,8BAA8B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oCAAoC,CAAC,CAAC;AAElG,eAAO,MAAM,qCAAqC;;;;;;;;;;;iBAWhD,CAAC;AAEH,MAAM,MAAM,+BAA+B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qCAAqC,CAAC,CAAC;AAMpG,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;iBAoBpC,CAAC;AAEH,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAM5E;;;GAGG;AACH,eAAO,MAAM,mCAAmC;wBAC7B,wBAAwB,EAAE;;;;;;CAMnC,CAAC;AAEX,MAAM,MAAM,uBAAuB,GAAG,MAAM,OAAO,mCAAmC,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import { z } from "zod";
2
- import { ExternalProvider_ExchangeProtocol_Configuration_Base, ExternalProvider_ExchangeProtocol_Kind, ExternalProvider_ExchangeProtocol_Profile_Base } from "../core/commons.external-connectors-models.schemas";
2
+ import { ExternalProvider_ExchangeProtocol_Kind } from "../core/commons.external-connectors-models.schemas";
3
3
  /**
4
4
  * Concrete embedding-model ids the framework knows. Ids and dimensions are published provider
5
5
  * facts (OpenAI embeddings API); the runtime additionally verifies the MEASURED dimension of
@@ -118,14 +118,6 @@ export declare const resolveEmbeddingsModelForApplicability: (input: {
118
118
  applicability: Embeddings_Applicability;
119
119
  providerRef: string;
120
120
  }, catalog?: Record<EmbeddingsProvider_Model, Embeddings_ModelCatalogEntry>) => Embeddings_ModelResolution;
121
- export type EmbeddingsProvider_Profile = ExternalProvider_ExchangeProtocol_Profile_Base & {
122
- baseURL?: string;
123
- /** Model ids this provider serves (advertised for validation/UX). */
124
- supportedModels?: string[];
125
- };
126
- export type EmbeddingsProvider_Configuration = ExternalProvider_ExchangeProtocol_Configuration_Base & {
127
- customLocation?: string;
128
- };
129
121
  /**
130
122
  * Usage of one embedding call. There is NO completion-token dimension — an embedding consumes
131
123
  * input tokens and produces vectors, so usage-completeness for an embedding trace is judged on
@@ -165,11 +157,4 @@ export declare const EmbeddingsProvider_EmbedTextsOutputSchema: z.ZodObject<{
165
157
  }, z.core.$strip>;
166
158
  }, z.core.$strip>;
167
159
  export type EmbeddingsProvider_EmbedTextsOutput = z.infer<typeof EmbeddingsProvider_EmbedTextsOutputSchema>;
168
- export declare const EmbeddingsProvider_StatusSchema: z.ZodObject<{
169
- status: z.ZodEnum<typeof import("..").ExternalProvider_Status>;
170
- lastCheckedAt: z.ZodString;
171
- errorReason: z.ZodOptional<z.ZodString>;
172
- protocolKind: z.ZodLiteral<ExternalProvider_ExchangeProtocol_Kind.EMBEDDINGS_PROVIDER>;
173
- }, z.core.$strip>;
174
- export type EmbeddingsProvider_Status = z.infer<typeof EmbeddingsProvider_StatusSchema>;
175
160
  //# sourceMappingURL=embeddings.external-connectors-models.schemas.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"embeddings.external-connectors-models.schemas.d.ts","sourceRoot":"","sources":["../../../src/protocols/embeddings.external-connectors-models.schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EACL,oDAAoD,EACpD,sCAAsC,EACtC,8CAA8C,EAE/C,MAAM,oDAAoD,CAAA;AAkB3D;;;;;GAKG;AACH,oBAAY,wBAAwB;IAClC,kGAAkG;IAClG,8BAA8B,2BAA2B;IACzD,kEAAkE;IAClE,8BAA8B,2BAA2B;CAC1D;A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ACjG,0BAWF,CAAC;AAOF,MAAM,MAAM,0BAA0B,GAAG,8CAA8C,GAAG;IACxF,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,qEAAqE;IACrE,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;CAC5B,CAAA;AAED,MAAM,MAAM,gCAAgC,GAAG,oDAAoD,GAAG;IACpG,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,CAAA;AAMD;;;;;GAKG;AACH,eAAO,MAAM,8BAA8B;;iBAGzC,CAAC;AACH,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,8BAA8B,CAAC,CAAC;AAEtF,eAAO,MAAM,mDAAmD;;;;iBAI9D,CAAC;AACH,MAAM,MAAM,6CAA6C,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mDAAmD,CAAC,CAAC;AAMhI,kFAAkF;AAClF,eAAO,MAAM,wCAAwC;;;iBAKnD,CAAC;AACH,MAAM,MAAM,kCAAkC,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wCAAwC,CAAC,CAAC;AAE1G;;;;;;;GAOG;AACH,eAAO,MAAM,yCAAyC;;;;;;;iBAOpD,CAAC;AACH,MAAM,MAAM,mCAAmC,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yCAAyC,CAAC,CAAC;AAM5G,eAAO,MAAM,+BAA+B;;;;;iBAE1C,CAAC;AACH,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,+BAA+B,CAAC,CAAC"}
1
+ {"version":3,"file":"embeddings.external-connectors-models.schemas.d.ts","sourceRoot":"","sources":["../../../../src/protocols/embeddings.external-connectors-models.schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EACL,sCAAsC,EACrC,MAAM,oDAAoD,CAAA;AAkB7D;;;;;GAKG;AACH,oBAAY,wBAAwB;IAClC,kGAAkG;IAClG,8BAA8B,2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E,UAAS,MAAM,CAAC,wBAAwB,EAAE,4BAA4B,CAA4B,KACjG,0BAWF,CAAC;AAMF;;;;;GAKG;AACH,eAAO,MAAM,8BAA8B;;iBAGzC,CAAC;AACH,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,8BAA8B,CAAC,CAAC;AAEtF,eAAO,MAAM,mDAAmD;;;;iBAI9D,CAAC;AACH,MAAM,MAAM,6CAA6C,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mDAAmD,CAAC,CAAC;AAMhI,kFAAkF;AAClF,eAAO,MAAM,wCAAwC;;;iBAKnD,CAAC;AACH,MAAM,MAAM,kCAAkC,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wCAAwC,CAAC,CAAC;AAE1G;;;;;;;GAOG;AACH,eAAO,MAAM,yCAAyC;;;;;;;iBAOpD,CAAC;AACH,MAAM,MAAM,mCAAmC,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yCAAyC,CAAC,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import { z } from "zod";
2
- import { ExternalProvider_ExchangeProtocol_Kind, ExternalProvider_ExchangeProtocol_Status_BaseSchema, } from "../core/commons.external-connectors-models.schemas.js";
2
+ import { ExternalProvider_ExchangeProtocol_Kind, } from "../core/commons.external-connectors-models.schemas.js";
3
3
  //===============================================================
4
4
  // Embeddings Provider
5
5
  // --------
@@ -95,8 +95,9 @@ export const EMBEDDINGS_MODEL_CATALOG = {
95
95
  providerRef: "openai",
96
96
  dims: 3072,
97
97
  // Deliberately NOT auto-selected for RAG_DEFAULT: 2× the storage + ANN cost for a quality
98
- // delta most application corpora do not need. An application that wants it overrides the
99
- // preference (or a future applicability class names the high-quality surface).
98
+ // delta most application corpora do not need. Selection is framework-owned: the public
99
+ // resolver exposes no per-application preference override. Selecting this model would
100
+ // require a framework applicability/preference change, with corpus migration implications.
100
101
  applicabilities: [],
101
102
  },
102
103
  };
@@ -182,10 +183,4 @@ export const EmbeddingsProvider_EmbedTextsOutputSchema = z.object({
182
183
  dims: z.number().int().positive(),
183
184
  usage: EmbeddingsProvider_UsageSchema,
184
185
  });
185
- // ===============================================================
186
- // STATUS
187
- // ===============================================================
188
- export const EmbeddingsProvider_StatusSchema = ExternalProvider_ExchangeProtocol_Status_BaseSchema.extend({
189
- protocolKind: z.literal(ExternalProvider_ExchangeProtocol_Kind.EMBEDDINGS_PROVIDER),
190
- });
191
186
  //# sourceMappingURL=embeddings.external-connectors-models.schemas.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"embeddings.external-connectors-models.schemas.js","sourceRoot":"","sources":["../../../../src/protocols/embeddings.external-connectors-models.schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EAEL,sCAAsC,EAEtC,mDAAmD,GACpD,MAAM,oDAAoD,CAAA;AAE3D,iEAAiE;AACjE,sBAAsB;AACtB,WAAW;AACX,wFAAwF;AACxF,2FAA2F;AAC3F,yFAAyF;AACzF,yDAAyD;AACzD,EAAE;AACF,2FAA2F;AAC3F,+FAA+F;AAC/F,6FAA6F;AAC7F,+FAA+F;AAC/F,iGAAiG;AACjG,8DAA8D;AAC9D,iEAAiE;AAEjE;;;;;GAKG;AACH,MAAM,CAAN,IAAY,wBAKX;AALD,WAAY,wBAAwB;IAClC,kGAAkG;IAClG,qFAAyD,CAAA;IACzD,kEAAkE;IAClE,qFAAyD,CAAA;AAC3D,CAAC,EALW,wBAAwB,KAAxB,wBAAwB,QAKnC;AAED;;;;;;;;;GASG;AACH,MAAM,CAAN,IAAY,+BAGX;AAHD,WAAY,+BAA+B;IACzC,8DAA8D;IAC9D,wEAAqC,CAAA;AACvC,CAAC,EAHW,+BAA+B,KAA/B,+BAA+B,QAG1C;AAED;;;;;;;;GAQG;AACH,MAAM,CAAN,IAAY,8BAKX;AALD,WAAY,8BAA8B;IACxC,yEAAyE;IACzE,mDAAiB,CAAA;IACjB,8EAA8E;IAC9E,i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EAAE,CAAC,CAAC,IAAI,CAAC,8BAA8B,CAAC;CAChD,CAAC,CAAC;AAGH;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,yCAAyC,GAAG,CAAC,CAAC,MAAM,CAAC;IAChE,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC;IACrC,6FAA6F;IAC7F,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;IACjB,0FAA0F;IAC1F,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;IACjC,KAAK,EAAE,8BAA8B;CACtC,CAAC,CAAC;AAGH,kEAAkE;AAClE,SAAS;AACT,kEAAkE;AAElE,MAAM,CAAC,MAAM,+BAA+B,GAAG,mDAAmD,CAAC,MAAM,CAAC;IACxG,YAAY,EAAE,CAAC,CAAC,OAAO,CAAC,sCAAsC,CAAC,mBAAmB,CAAC;CACpF,CAAC,CAAC","sourcesContent":["import { z } from \"zod\"\nimport {\n ExternalProvider_ExchangeProtocol_Configuration_Base,\n ExternalProvider_ExchangeProtocol_Kind,\n ExternalProvider_ExchangeProtocol_Profile_Base,\n ExternalProvider_ExchangeProtocol_Status_BaseSchema,\n} from \"../core/commons.external-connectors-models.schemas\"\n\n//===============================================================\n// Embeddings Provider\n// --------\n// Text → vector embedding providers (OpenAI text-embedding-3, Voyage, Cohere embed, …).\n// Serves the RAG derived-data tier: the `rag:embedding-drain` worker embeds corpus chunks,\n// and retrieval (RAG plan Phase 5) embeds queries through the SAME provider seam so both\n// sides of a similarity search live in one vector space.\n//\n// Deliberately a SEPARATE protocol from `LLM_PROVIDER` (RAG plan DL2, the `IMAGE_PROVIDER`\n// precedent): its I/O is float vectors, its parameters (dimensions / batch size) share nothing\n// with LLM sampling, and — decisive — a sixth `LLMProvider_OperationKey` would fail SILENTLY\n// in every LLM consumer surface, while a new `runtimeContract.kind` fails COMPILATION at every\n// switch. It also fills its own `EngineCapability.AI_EMBEDDINGS` slot so an application can pick\n// Anthropic for chat and a different provider for embeddings.\n//===============================================================\n\n/**\n * Concrete embedding-model ids the framework knows. Ids and dimensions are published provider\n * facts (OpenAI embeddings API); the runtime additionally verifies the MEASURED dimension of\n * every returned vector against the catalog row before anything is persisted, so a wrong row\n * here fails loudly instead of poisoning a vector store.\n */\nexport enum EmbeddingsProvider_Model {\n /** OpenAI's cost-efficient embedding model — 1536 dimensions. The industry-default RAG choice. */\n OPEN_AI_TEXT_EMBEDDING_3_SMALL = \"text-embedding-3-small\",\n /** OpenAI's highest-quality embedding model — 3072 dimensions. */\n OPEN_AI_TEXT_EMBEDDING_3_LARGE = \"text-embedding-3-large\",\n}\n\n/**\n * The embeddings operation vocabulary — deliberately DISJOINT from `LLMProvider_OperationKey`\n * and `ImageProvider_OperationKey` (each protocol kind owns its own operation enum, so a key's\n * membership decides its protocol without inspection).\n *\n * Import path: `@wildo-ai/external-connectors-models`.\n *\n * (`@wildo_source` anchoring + the teaching skill are RAG-plan Phase-7 work — the\n * capability-catalog rule's DoD is deferred there deliberately, not forgotten.)\n */\nexport enum EmbeddingsProvider_OperationKey {\n /** A batch of texts → one vector per text, in input order. */\n EMBED_TEXTS = \"embeddings.embedTexts\",\n}\n\n/**\n * WHY a text is being embedded — some models embed retrieval QUERIES differently from the\n * DOCUMENTS they search over (Voyage/Cohere `input_type`; instruction-prefixed models), so the\n * caller's intent must travel with the call rather than being inferred. OpenAI `text-embedding-3-*`\n * ignores the distinction; providers that honour it translate this value at their boundary.\n *\n * A named home (semantic-string-literals rule): `'corpus'`/`'query'` are a closed vocabulary,\n * and this enum is where their semantics live.\n */\nexport enum EmbeddingsProvider_TextPurpose {\n /** The text IS retrievable content — a RAG chunk entering the corpus. */\n CORPUS = \"corpus\",\n /** The text is a SEARCH query that will be matched against corpus vectors. */\n QUERY = \"query\",\n}\n\n/**\n * @wildo_source:part:start saas.external-providers.embeddings.applicability facet:kind:api facet:audience:app-developer\n *\n * WHAT an embedding is produced FOR — the durable axis of embedding-model selection\n * (model-selection-by-applicability rule: an author names a CLASS, never a concrete model id;\n * the framework resolves the id from the catalog + preference below).\n *\n * This is ALSO the persisted `embeddingClass` stamp on every RAG chunk row: the drain worker\n * stamps the class it embedded under, and the model-migration pass re-embeds any chunk whose\n * stamped class→model binding no longer matches the current resolution — so changing the\n * preference below IS the migration trigger, with no chunk-table DDL and no call-site edits.\n *\n * NOTE both corpus AND query embedding of one retrieval surface MUST resolve through the SAME\n * class — a similarity search across two models' vector spaces is meaningless. That is why the\n * class names the SURFACE (`RAG_DEFAULT`), not the side (`purpose` carries the side).\n */\nexport enum Embeddings_Applicability {\n /** The default RAG surface: `.ragSource()` corpus chunks and the retrieval queries over them. */\n RAG_DEFAULT = \"rag-default\",\n}\n/** @wildo_source:part:end saas.external-providers.embeddings.applicability */\n\n/**\n * One row per embedding model: everything the framework knows about a concrete id.\n * Mirrors `LLM_ModelCatalogEntry`'s shape at the size this axis needs today.\n */\nexport type Embeddings_ModelCatalogEntry = {\n /** The `ref` of the provider module that serves this id. */\n providerRef: string;\n /**\n * The model's published output dimension. Load-bearing twice: the drain worker VERIFIES every\n * returned vector against it before persisting (a wrong-dims write silently poisons ANN\n * indexes), and the pgvector HNSW expression index is created per this dimension.\n */\n dims: number;\n /** FRAMEWORK OPINION — which applicability classes this model may be resolved for. */\n applicabilities: readonly Embeddings_Applicability[];\n};\n\n/**\n * THE embedding-model catalog — the single per-model fact table (the `LLM_MODEL_CATALOG`\n * discipline: an EXHAUSTIVE `Record`, so a new `EmbeddingsProvider_Model` member without a row\n * is a compile error).\n */\nexport const EMBEDDINGS_MODEL_CATALOG: Record<EmbeddingsProvider_Model, Embeddings_ModelCatalogEntry> = {\n [EmbeddingsProvider_Model.OPEN_AI_TEXT_EMBEDDING_3_SMALL]: {\n providerRef: \"openai\",\n dims: 1536,\n applicabilities: [Embeddings_Applicability.RAG_DEFAULT],\n },\n [EmbeddingsProvider_Model.OPEN_AI_TEXT_EMBEDDING_3_LARGE]: {\n providerRef: \"openai\",\n dims: 3072,\n // Deliberately NOT auto-selected for RAG_DEFAULT: 2× the storage + ANN cost for a quality\n // delta most application corpora do not need. An application that wants it overrides the\n // preference (or a future applicability class names the high-quality surface).\n applicabilities: [],\n },\n};\n\n/**\n * The framework's DEFAULT answer to \"which embedding model serves this class\", ordered by\n * preference, highest first. THIS BINDING IS THE MIGRATION KEY (RAG plan §3.d): editing it\n * changes what `resolveEmbeddingsModelForApplicability` answers, which makes every chunk stamped\n * with the previous model a migration candidate the drain worker re-embeds — bounded per run,\n * converging over runs. No agent/worker definition changes.\n */\nexport const EMBEDDINGS_MODEL_APPLICABILITY_PREFERENCE: Record<Embeddings_Applicability, readonly EmbeddingsProvider_Model[]> = {\n [Embeddings_Applicability.RAG_DEFAULT]: [\n EmbeddingsProvider_Model.OPEN_AI_TEXT_EMBEDDING_3_SMALL,\n ],\n};\n\n/** Why {@link resolveEmbeddingsModelForApplicability} could not answer — carried into a named CONFIGURATION error. */\nexport enum Embeddings_ModelResolutionFailure {\n /** The applicability has no candidate at all for this provider. */\n NO_CANDIDATE_FOR_PROVIDER = \"no_candidate_for_provider\",\n}\n\nexport type Embeddings_ModelResolution =\n | { resolved: true; model: EmbeddingsProvider_Model; entry: Embeddings_ModelCatalogEntry }\n | { resolved: false; failure: Embeddings_ModelResolutionFailure; consideredModels: readonly EmbeddingsProvider_Model[] };\n\n/**\n * Resolve an applicability class to ONE concrete embedding model for a given provider.\n *\n * Fails CLOSED and explains itself (the `resolveModelForApplicability` contract): a silent\n * fallback to some other model would fracture the vector space the class exists to keep whole.\n * The resolved `(class, model)` pair is what the RAG drain worker stamps on every chunk and what\n * its migration pass compares stamps against.\n */\nexport const resolveEmbeddingsModelForApplicability = (\n input: { applicability: Embeddings_Applicability; providerRef: string },\n catalog: Record<EmbeddingsProvider_Model, Embeddings_ModelCatalogEntry> = EMBEDDINGS_MODEL_CATALOG,\n): Embeddings_ModelResolution => {\n const candidates = EMBEDDINGS_MODEL_APPLICABILITY_PREFERENCE[input.applicability];\n const forProvider = candidates.filter((model) => {\n const entry = catalog[model];\n return entry.providerRef === input.providerRef && entry.applicabilities.includes(input.applicability);\n });\n if (forProvider.length === 0) {\n return { resolved: false, failure: Embeddings_ModelResolutionFailure.NO_CANDIDATE_FOR_PROVIDER, consideredModels: candidates };\n }\n const model = forProvider[0]!;\n return { resolved: true, model, entry: catalog[model] };\n};\n\n// ===============================================================\n// Embeddings Provider Profiles and Configurations (the config arm —\n// disjoint from LLM/image config by construction)\n// ===============================================================\n\nexport type EmbeddingsProvider_Profile = ExternalProvider_ExchangeProtocol_Profile_Base & {\n baseURL?: string,\n /** Model ids this provider serves (advertised for validation/UX). */\n supportedModels?: string[],\n}\n\nexport type EmbeddingsProvider_Configuration = ExternalProvider_ExchangeProtocol_Configuration_Base & {\n customLocation?: string,\n}\n\n// ===============================================================\n// Embeddings Operations Context\n// ===============================================================\n\n/**\n * Usage of one embedding call. There is NO completion-token dimension — an embedding consumes\n * input tokens and produces vectors, so usage-completeness for an embedding trace is judged on\n * `inputTokens` alone (H4: an embedding trace must never be flagged token-incomplete for lacking\n * completion tokens it structurally cannot have).\n */\nexport const EmbeddingsProvider_UsageSchema = z.object({\n /** Provider-reported input tokens, when the model reports them (OpenAI does). */\n inputTokens: z.number().optional(),\n});\nexport type EmbeddingsProvider_Usage = z.infer<typeof EmbeddingsProvider_UsageSchema>;\n\nexport const EmbeddingsProvider_ExecutionTransportMetadataSchema = z.object({\n protocolKind: z.literal(ExternalProvider_ExchangeProtocol_Kind.EMBEDDINGS_PROVIDER),\n providerRef: z.string(),\n model: z.string().optional(),\n});\nexport type EmbeddingsProvider_ExecutionTransportMetadata = z.infer<typeof EmbeddingsProvider_ExecutionTransportMetadataSchema>;\n\n// ===============================================================\n// Embeddings I/O Schemas\n// ===============================================================\n\n/** Input of the {@link EmbeddingsProvider_OperationKey.EMBED_TEXTS} operation. */\nexport const EmbeddingsProvider_EmbedTextsInputSchema = z.object({\n /** The texts to embed — one vector is returned per text, in this order. */\n texts: z.array(z.string()).min(1),\n /** Why these texts are embedded — see {@link EmbeddingsProvider_TextPurpose}. */\n purpose: z.enum(EmbeddingsProvider_TextPurpose),\n});\nexport type EmbeddingsProvider_EmbedTextsInput = z.infer<typeof EmbeddingsProvider_EmbedTextsInputSchema>;\n\n/**\n * Output of {@link EmbeddingsProvider_OperationKey.EMBED_TEXTS}. `vectors[i]` embeds `texts[i]`.\n *\n * ⚠️ PRIVACY/OBSERVABILITY CONTRACT: raw vectors are a lossy ENCODING of the source text, not\n * telemetry — they must NEVER reach analytics events, traces, or logs at any verbosity. Consumers\n * summarize (`vectorCount`, `dims`) instead; the PostHog sink's embedding arm enforces this\n * defensively even against a mis-built trace.\n */\nexport const EmbeddingsProvider_EmbedTextsOutputSchema = z.object({\n vectors: z.array(z.array(z.number())),\n /** The concrete model that produced the vectors — the chunk rows' `embeddingModel` stamp. */\n model: z.string(),\n /** The (verified) dimension every returned vector carries — the `embeddingDims` stamp. */\n dims: z.number().int().positive(),\n usage: EmbeddingsProvider_UsageSchema,\n});\nexport type EmbeddingsProvider_EmbedTextsOutput = z.infer<typeof EmbeddingsProvider_EmbedTextsOutputSchema>;\n\n// ===============================================================\n// STATUS\n// ===============================================================\n\nexport const EmbeddingsProvider_StatusSchema = ExternalProvider_ExchangeProtocol_Status_BaseSchema.extend({\n protocolKind: z.literal(ExternalProvider_ExchangeProtocol_Kind.EMBEDDINGS_PROVIDER),\n});\nexport type EmbeddingsProvider_Status = z.infer<typeof EmbeddingsProvider_StatusSchema>;\n"]}
1
+ {"version":3,"file":"embeddings.external-connectors-models.schemas.js","sourceRoot":"","sources":["../../../../src/protocols/embeddings.external-connectors-models.schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EACL,sCAAsC,GACrC,MAAM,oDAAoD,CAAA;AAE7D,iEAAiE;AACjE,sBAAsB;A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CAAC,MAAM,8BAA8B,GAAG,CAAC,CAAC,MAAM,CAAC;IACrD,iFAAiF;IACjF,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CACnC,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,mDAAmD,GAAG,CAAC,CAAC,MAAM,CAAC;IAC1E,YAAY,EAAE,CAAC,CAAC,OAAO,CAAC,sCAAsC,CAAC,mBAAmB,CAAC;IACnF,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE;IACvB,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAC7B,CAAC,CAAC;AAGH,kEAAkE;AAClE,yBAAyB;AACzB,kEAAkE;AAElE,kFAAkF;AAClF,MAAM,CAAC,MAAM,wCAAwC,GAAG,CAAC,CAAC,MAAM,CAAC;IAC/D,2EAA2E;IAC3E,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;IACjC,iFAAiF;IACjF,OAAO,EAAE,CAAC,CAAC,IAAI,CAAC,8BAA8B,CAAC;CAChD,CAAC,CAAC;AAGH;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,yCAAyC,GAAG,CAAC,CAAC,MAAM,CAAC;IAChE,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC;IACrC,6FAA6F;IAC7F,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;IACjB,0FAA0F;IAC1F,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;IACjC,KAAK,EAAE,8BAA8B;CACtC,CAAC,CAAC","sourcesContent":["import { z } from \"zod\"\nimport {\n ExternalProvider_ExchangeProtocol_Kind,\n } from \"../core/commons.external-connectors-models.schemas\"\n\n//===============================================================\n// Embeddings Provider\n// --------\n// Text → vector embedding providers (OpenAI text-embedding-3, Voyage, Cohere embed, …).\n// Serves the RAG derived-data tier: the `rag:embedding-drain` worker embeds corpus chunks,\n// and retrieval (RAG plan Phase 5) embeds queries through the SAME provider seam so both\n// sides of a similarity search live in one vector space.\n//\n// Deliberately a SEPARATE protocol from `LLM_PROVIDER` (RAG plan DL2, the `IMAGE_PROVIDER`\n// precedent): its I/O is float vectors, its parameters (dimensions / batch size) share nothing\n// with LLM sampling, and — decisive — a sixth `LLMProvider_OperationKey` would fail SILENTLY\n// in every LLM consumer surface, while a new `runtimeContract.kind` fails COMPILATION at every\n// switch. It also fills its own `EngineCapability.AI_EMBEDDINGS` slot so an application can pick\n// Anthropic for chat and a different provider for embeddings.\n//===============================================================\n\n/**\n * Concrete embedding-model ids the framework knows. Ids and dimensions are published provider\n * facts (OpenAI embeddings API); the runtime additionally verifies the MEASURED dimension of\n * every returned vector against the catalog row before anything is persisted, so a wrong row\n * here fails loudly instead of poisoning a vector store.\n */\nexport enum EmbeddingsProvider_Model {\n /** OpenAI's cost-efficient embedding model — 1536 dimensions. The industry-default RAG choice. */\n OPEN_AI_TEXT_EMBEDDING_3_SMALL = \"text-embedding-3-small\",\n /** OpenAI's highest-quality embedding model — 3072 dimensions. */\n OPEN_AI_TEXT_EMBEDDING_3_LARGE = \"text-embedding-3-large\",\n}\n\n/**\n * The embeddings operation vocabulary — deliberately DISJOINT from `LLMProvider_OperationKey`\n * and `ImageProvider_OperationKey` (each protocol kind owns its own operation enum, so a key's\n * membership decides its protocol without inspection).\n *\n * Import path: `@wildo-ai/external-connectors-models`.\n *\n * (`@wildo_source` anchoring + the teaching skill are RAG-plan Phase-7 work — the\n * capability-catalog rule's DoD is deferred there deliberately, not forgotten.)\n */\nexport enum EmbeddingsProvider_OperationKey {\n /** A batch of texts → one vector per text, in input order. */\n EMBED_TEXTS = \"embeddings.embedTexts\",\n}\n\n/**\n * WHY a text is being embedded — some models embed retrieval QUERIES differently from the\n * DOCUMENTS they search over (Voyage/Cohere `input_type`; instruction-prefixed models), so the\n * caller's intent must travel with the call rather than being inferred. OpenAI `text-embedding-3-*`\n * ignores the distinction; providers that honour it translate this value at their boundary.\n *\n * A named home (semantic-string-literals rule): `'corpus'`/`'query'` are a closed vocabulary,\n * and this enum is where their semantics live.\n */\nexport enum EmbeddingsProvider_TextPurpose {\n /** The text IS retrievable content — a RAG chunk entering the corpus. */\n CORPUS = \"corpus\",\n /** The text is a SEARCH query that will be matched against corpus vectors. */\n QUERY = \"query\",\n}\n\n/**\n * @wildo_source:part:start saas.external-providers.embeddings.applicability facet:kind:api facet:audience:app-developer\n *\n * WHAT an embedding is produced FOR — the durable axis of embedding-model selection\n * (model-selection-by-applicability rule: an author names a CLASS, never a concrete model id;\n * the framework resolves the id from the catalog + preference below).\n *\n * This is ALSO the persisted `embeddingClass` stamp on every RAG chunk row: the drain worker\n * stamps the class it embedded under, and the model-migration pass re-embeds any chunk whose\n * stamped class→model binding no longer matches the current resolution — so changing the\n * preference below IS the migration trigger, with no chunk-table DDL and no call-site edits.\n *\n * NOTE both corpus AND query embedding of one retrieval surface MUST resolve through the SAME\n * class — a similarity search across two models' vector spaces is meaningless. That is why the\n * class names the SURFACE (`RAG_DEFAULT`), not the side (`purpose` carries the side).\n */\nexport enum Embeddings_Applicability {\n /** The default RAG surface: `.ragSource()` corpus chunks and the retrieval queries over them. */\n RAG_DEFAULT = \"rag-default\",\n}\n/** @wildo_source:part:end saas.external-providers.embeddings.applicability */\n\n/**\n * One row per embedding model: everything the framework knows about a concrete id.\n * Mirrors `LLM_ModelCatalogEntry`'s shape at the size this axis needs today.\n */\nexport type Embeddings_ModelCatalogEntry = {\n /** The `ref` of the provider module that serves this id. */\n providerRef: string;\n /**\n * The model's published output dimension. Load-bearing twice: the drain worker VERIFIES every\n * returned vector against it before persisting (a wrong-dims write silently poisons ANN\n * indexes), and the pgvector HNSW expression index is created per this dimension.\n */\n dims: number;\n /** FRAMEWORK OPINION — which applicability classes this model may be resolved for. */\n applicabilities: readonly Embeddings_Applicability[];\n};\n\n/**\n * THE embedding-model catalog — the single per-model fact table (the `LLM_MODEL_CATALOG`\n * discipline: an EXHAUSTIVE `Record`, so a new `EmbeddingsProvider_Model` member without a row\n * is a compile error).\n */\nexport const EMBEDDINGS_MODEL_CATALOG: Record<EmbeddingsProvider_Model, Embeddings_ModelCatalogEntry> = {\n [EmbeddingsProvider_Model.OPEN_AI_TEXT_EMBEDDING_3_SMALL]: {\n providerRef: \"openai\",\n dims: 1536,\n applicabilities: [Embeddings_Applicability.RAG_DEFAULT],\n },\n [EmbeddingsProvider_Model.OPEN_AI_TEXT_EMBEDDING_3_LARGE]: {\n providerRef: \"openai\",\n dims: 3072,\n // Deliberately NOT auto-selected for RAG_DEFAULT: 2× the storage + ANN cost for a quality\n // delta most application corpora do not need. Selection is framework-owned: the public\n // resolver exposes no per-application preference override. Selecting this model would\n // require a framework applicability/preference change, with corpus migration implications.\n applicabilities: [],\n },\n};\n\n/**\n * The framework's DEFAULT answer to \"which embedding model serves this class\", ordered by\n * preference, highest first. THIS BINDING IS THE MIGRATION KEY (RAG plan §3.d): editing it\n * changes what `resolveEmbeddingsModelForApplicability` answers, which makes every chunk stamped\n * with the previous model a migration candidate the drain worker re-embeds — bounded per run,\n * converging over runs. No agent/worker definition changes.\n */\nexport const EMBEDDINGS_MODEL_APPLICABILITY_PREFERENCE: Record<Embeddings_Applicability, readonly EmbeddingsProvider_Model[]> = {\n [Embeddings_Applicability.RAG_DEFAULT]: [\n EmbeddingsProvider_Model.OPEN_AI_TEXT_EMBEDDING_3_SMALL,\n ],\n};\n\n/** Why {@link resolveEmbeddingsModelForApplicability} could not answer — carried into a named CONFIGURATION error. */\nexport enum Embeddings_ModelResolutionFailure {\n /** The applicability has no candidate at all for this provider. */\n NO_CANDIDATE_FOR_PROVIDER = \"no_candidate_for_provider\",\n}\n\nexport type Embeddings_ModelResolution =\n | { resolved: true; model: EmbeddingsProvider_Model; entry: Embeddings_ModelCatalogEntry }\n | { resolved: false; failure: Embeddings_ModelResolutionFailure; consideredModels: readonly EmbeddingsProvider_Model[] };\n\n/**\n * Resolve an applicability class to ONE concrete embedding model for a given provider.\n *\n * Fails CLOSED and explains itself (the `resolveModelForApplicability` contract): a silent\n * fallback to some other model would fracture the vector space the class exists to keep whole.\n * The resolved `(class, model)` pair is what the RAG drain worker stamps on every chunk and what\n * its migration pass compares stamps against.\n */\nexport const resolveEmbeddingsModelForApplicability = (\n input: { applicability: Embeddings_Applicability; providerRef: string },\n catalog: Record<EmbeddingsProvider_Model, Embeddings_ModelCatalogEntry> = EMBEDDINGS_MODEL_CATALOG,\n): Embeddings_ModelResolution => {\n const candidates = EMBEDDINGS_MODEL_APPLICABILITY_PREFERENCE[input.applicability];\n const forProvider = candidates.filter((model) => {\n const entry = catalog[model];\n return entry.providerRef === input.providerRef && entry.applicabilities.includes(input.applicability);\n });\n if (forProvider.length === 0) {\n return { resolved: false, failure: Embeddings_ModelResolutionFailure.NO_CANDIDATE_FOR_PROVIDER, consideredModels: candidates };\n }\n const model = forProvider[0]!;\n return { resolved: true, model, entry: catalog[model] };\n};\n\n// ===============================================================\n// Embeddings Operations Context\n// ===============================================================\n\n/**\n * Usage of one embedding call. There is NO completion-token dimension — an embedding consumes\n * input tokens and produces vectors, so usage-completeness for an embedding trace is judged on\n * `inputTokens` alone (H4: an embedding trace must never be flagged token-incomplete for lacking\n * completion tokens it structurally cannot have).\n */\nexport const EmbeddingsProvider_UsageSchema = z.object({\n /** Provider-reported input tokens, when the model reports them (OpenAI does). */\n inputTokens: z.number().optional(),\n});\nexport type EmbeddingsProvider_Usage = z.infer<typeof EmbeddingsProvider_UsageSchema>;\n\nexport const EmbeddingsProvider_ExecutionTransportMetadataSchema = z.object({\n protocolKind: z.literal(ExternalProvider_ExchangeProtocol_Kind.EMBEDDINGS_PROVIDER),\n providerRef: z.string(),\n model: z.string().optional(),\n});\nexport type EmbeddingsProvider_ExecutionTransportMetadata = z.infer<typeof EmbeddingsProvider_ExecutionTransportMetadataSchema>;\n\n// ===============================================================\n// Embeddings I/O Schemas\n// ===============================================================\n\n/** Input of the {@link EmbeddingsProvider_OperationKey.EMBED_TEXTS} operation. */\nexport const EmbeddingsProvider_EmbedTextsInputSchema = z.object({\n /** The texts to embed — one vector is returned per text, in this order. */\n texts: z.array(z.string()).min(1),\n /** Why these texts are embedded — see {@link EmbeddingsProvider_TextPurpose}. */\n purpose: z.enum(EmbeddingsProvider_TextPurpose),\n});\nexport type EmbeddingsProvider_EmbedTextsInput = z.infer<typeof EmbeddingsProvider_EmbedTextsInputSchema>;\n\n/**\n * Output of {@link EmbeddingsProvider_OperationKey.EMBED_TEXTS}. `vectors[i]` embeds `texts[i]`.\n *\n * ⚠️ PRIVACY/OBSERVABILITY CONTRACT: raw vectors are a lossy ENCODING of the source text, not\n * telemetry — they must NEVER reach analytics events, traces, or logs at any verbosity. Consumers\n * summarize (`vectorCount`, `dims`) instead; the PostHog sink's embedding arm enforces this\n * defensively even against a mis-built trace.\n */\nexport const EmbeddingsProvider_EmbedTextsOutputSchema = z.object({\n vectors: z.array(z.array(z.number())),\n /** The concrete model that produced the vectors — the chunk rows' `embeddingModel` stamp. */\n model: z.string(),\n /** The (verified) dimension every returned vector carries — the `embeddingDims` stamp. */\n dims: z.number().int().positive(),\n usage: EmbeddingsProvider_UsageSchema,\n});\nexport type EmbeddingsProvider_EmbedTextsOutput = z.infer<typeof EmbeddingsProvider_EmbedTextsOutputSchema>;\n\n"]}