@wildo-ai/external-connectors-models 1.1.11 → 1.1.12

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 (109) hide show
  1. package/dist/esm/companion-exports.d.ts.map +1 -1
  2. package/dist/esm/companion-exports.js.map +1 -1
  3. package/dist/esm/core/commons.external-connectors-models.schemas.d.ts +10 -0
  4. package/dist/esm/core/commons.external-connectors-models.schemas.d.ts.map +1 -1
  5. package/dist/esm/core/commons.external-connectors-models.schemas.js +10 -0
  6. package/dist/esm/core/commons.external-connectors-models.schemas.js.map +1 -1
  7. package/dist/esm/core/oauth2.enums.d.ts.map +1 -1
  8. package/dist/esm/core/oauth2.enums.js.map +1 -1
  9. package/dist/esm/core/operation-classification.external-connectors-models.schemas.d.ts.map +1 -1
  10. package/dist/esm/core/operation-classification.external-connectors-models.schemas.js.map +1 -1
  11. package/dist/esm/core/operations.external-connectors-models.schemas.d.ts.map +1 -1
  12. package/dist/esm/core/operations.external-connectors-models.schemas.js.map +1 -1
  13. package/dist/esm/core/security.external-connectors-models.schemas.d.ts.map +1 -1
  14. package/dist/esm/core/security.external-connectors-models.schemas.js.map +1 -1
  15. package/dist/esm/index.d.ts +6 -0
  16. package/dist/esm/index.d.ts.map +1 -1
  17. package/dist/esm/index.js +6 -0
  18. package/dist/esm/index.js.map +1 -1
  19. package/dist/esm/protocols/agent-client-protocol.external-connectors-models.schemas.d.ts +8 -42
  20. package/dist/esm/protocols/agent-client-protocol.external-connectors-models.schemas.d.ts.map +1 -1
  21. package/dist/esm/protocols/agent-client-protocol.external-connectors-models.schemas.js +21 -0
  22. package/dist/esm/protocols/agent-client-protocol.external-connectors-models.schemas.js.map +1 -1
  23. package/dist/esm/protocols/billing.standard-interface.schemas.d.ts +56 -3
  24. package/dist/esm/protocols/billing.standard-interface.schemas.d.ts.map +1 -1
  25. package/dist/esm/protocols/billing.standard-interface.schemas.js +15 -2
  26. package/dist/esm/protocols/billing.standard-interface.schemas.js.map +1 -1
  27. package/dist/esm/protocols/content-safety.external-connectors-models.schemas.d.ts.map +1 -1
  28. package/dist/esm/protocols/content-safety.external-connectors-models.schemas.js.map +1 -1
  29. package/dist/esm/protocols/document-extraction.external-connectors-models.schemas.d.ts.map +1 -1
  30. package/dist/esm/protocols/document-extraction.external-connectors-models.schemas.js.map +1 -1
  31. package/dist/esm/protocols/electronic-signature.external-connectors-models.schemas.d.ts +157 -0
  32. package/dist/esm/protocols/electronic-signature.external-connectors-models.schemas.d.ts.map +1 -0
  33. package/dist/esm/protocols/electronic-signature.external-connectors-models.schemas.js +134 -0
  34. package/dist/esm/protocols/electronic-signature.external-connectors-models.schemas.js.map +1 -0
  35. package/dist/esm/protocols/email-inbound.standard-interface.schemas.d.ts +85 -0
  36. package/dist/esm/protocols/email-inbound.standard-interface.schemas.d.ts.map +1 -1
  37. package/dist/esm/protocols/email-inbound.standard-interface.schemas.js +46 -2
  38. package/dist/esm/protocols/email-inbound.standard-interface.schemas.js.map +1 -1
  39. package/dist/esm/protocols/email.external-connectors-models.schemas.d.ts.map +1 -1
  40. package/dist/esm/protocols/email.external-connectors-models.schemas.js.map +1 -1
  41. package/dist/esm/protocols/email.standard-interface.schemas.d.ts.map +1 -1
  42. package/dist/esm/protocols/email.standard-interface.schemas.js.map +1 -1
  43. package/dist/esm/protocols/embeddings.external-connectors-models.schemas.d.ts +49 -6
  44. package/dist/esm/protocols/embeddings.external-connectors-models.schemas.d.ts.map +1 -1
  45. package/dist/esm/protocols/embeddings.external-connectors-models.schemas.js +89 -6
  46. package/dist/esm/protocols/embeddings.external-connectors-models.schemas.js.map +1 -1
  47. package/dist/esm/protocols/file-storage.standard-interface.d.ts +9 -2
  48. package/dist/esm/protocols/file-storage.standard-interface.d.ts.map +1 -1
  49. package/dist/esm/protocols/file-storage.standard-interface.js +6 -0
  50. package/dist/esm/protocols/file-storage.standard-interface.js.map +1 -1
  51. package/dist/esm/protocols/frontend.external-connectors-models.schemas.d.ts.map +1 -1
  52. package/dist/esm/protocols/frontend.external-connectors-models.schemas.js.map +1 -1
  53. package/dist/esm/protocols/graphql-operations.external-connectors-models.schemas.d.ts +254 -0
  54. package/dist/esm/protocols/graphql-operations.external-connectors-models.schemas.d.ts.map +1 -0
  55. package/dist/esm/protocols/graphql-operations.external-connectors-models.schemas.js +480 -0
  56. package/dist/esm/protocols/graphql-operations.external-connectors-models.schemas.js.map +1 -0
  57. package/dist/esm/protocols/hooks-capability.external-connectors-models.schemas.d.ts.map +1 -1
  58. package/dist/esm/protocols/hooks-capability.external-connectors-models.schemas.js.map +1 -1
  59. package/dist/esm/protocols/hooks.external-connectors-models.schemas.d.ts +95 -1
  60. package/dist/esm/protocols/hooks.external-connectors-models.schemas.d.ts.map +1 -1
  61. package/dist/esm/protocols/hooks.external-connectors-models.schemas.js +110 -0
  62. package/dist/esm/protocols/hooks.external-connectors-models.schemas.js.map +1 -1
  63. package/dist/esm/protocols/image.external-connectors-models.schemas.d.ts.map +1 -1
  64. package/dist/esm/protocols/image.external-connectors-models.schemas.js.map +1 -1
  65. package/dist/esm/protocols/llm.external-connectors-models.schemas.d.ts +95 -3
  66. package/dist/esm/protocols/llm.external-connectors-models.schemas.d.ts.map +1 -1
  67. package/dist/esm/protocols/llm.external-connectors-models.schemas.js +147 -15
  68. package/dist/esm/protocols/llm.external-connectors-models.schemas.js.map +1 -1
  69. package/dist/esm/protocols/oauth2-provider-assurance.definitions.d.ts.map +1 -1
  70. package/dist/esm/protocols/oauth2-provider-assurance.definitions.js.map +1 -1
  71. package/dist/esm/protocols/oauth2-provider-assurance.schemas.d.ts.map +1 -1
  72. package/dist/esm/protocols/oauth2-provider-assurance.schemas.js.map +1 -1
  73. package/dist/esm/protocols/oauth2.external-connectors-models.schemas.d.ts.map +1 -1
  74. package/dist/esm/protocols/oauth2.external-connectors-models.schemas.js.map +1 -1
  75. package/dist/esm/protocols/provider-configuration-authoring.external-connectors-models.schemas.d.ts +52 -0
  76. package/dist/esm/protocols/provider-configuration-authoring.external-connectors-models.schemas.d.ts.map +1 -0
  77. package/dist/esm/protocols/provider-configuration-authoring.external-connectors-models.schemas.js +132 -0
  78. package/dist/esm/protocols/provider-configuration-authoring.external-connectors-models.schemas.js.map +1 -0
  79. package/dist/esm/protocols/provider-connection-parameters.external-connectors-models.d.ts +111 -0
  80. package/dist/esm/protocols/provider-connection-parameters.external-connectors-models.d.ts.map +1 -0
  81. package/dist/esm/protocols/provider-connection-parameters.external-connectors-models.js +203 -0
  82. package/dist/esm/protocols/provider-connection-parameters.external-connectors-models.js.map +1 -0
  83. package/dist/esm/protocols/provider-oauth2-token-endpoint-hosts.external-connectors-models.d.ts +6 -0
  84. package/dist/esm/protocols/provider-oauth2-token-endpoint-hosts.external-connectors-models.d.ts.map +1 -1
  85. package/dist/esm/protocols/provider-oauth2-token-endpoint-hosts.external-connectors-models.js +13 -7
  86. package/dist/esm/protocols/provider-oauth2-token-endpoint-hosts.external-connectors-models.js.map +1 -1
  87. package/dist/esm/protocols/provider-vendor-registration.external-connectors-models.d.ts +50 -0
  88. package/dist/esm/protocols/provider-vendor-registration.external-connectors-models.d.ts.map +1 -0
  89. package/dist/esm/protocols/provider-vendor-registration.external-connectors-models.js +30 -0
  90. package/dist/esm/protocols/provider-vendor-registration.external-connectors-models.js.map +1 -0
  91. package/dist/esm/protocols/rest-operations.external-connectors-models.schemas.d.ts +730 -17
  92. package/dist/esm/protocols/rest-operations.external-connectors-models.schemas.d.ts.map +1 -1
  93. package/dist/esm/protocols/rest-operations.external-connectors-models.schemas.js +822 -20
  94. package/dist/esm/protocols/rest-operations.external-connectors-models.schemas.js.map +1 -1
  95. package/dist/esm/protocols/service-account-token.external-connectors-models.schemas.d.ts +73 -0
  96. package/dist/esm/protocols/service-account-token.external-connectors-models.schemas.d.ts.map +1 -0
  97. package/dist/esm/protocols/service-account-token.external-connectors-models.schemas.js +82 -0
  98. package/dist/esm/protocols/service-account-token.external-connectors-models.schemas.js.map +1 -0
  99. package/dist/esm/protocols/sms.external-connectors-models.schemas.d.ts.map +1 -1
  100. package/dist/esm/protocols/sms.external-connectors-models.schemas.js.map +1 -1
  101. package/dist/esm/protocols/sms.standard-interface.schemas.d.ts +79 -1
  102. package/dist/esm/protocols/sms.standard-interface.schemas.d.ts.map +1 -1
  103. package/dist/esm/protocols/sms.standard-interface.schemas.js +93 -0
  104. package/dist/esm/protocols/sms.standard-interface.schemas.js.map +1 -1
  105. package/dist/esm/protocols/subject-erasure-effect.standard-interface.d.ts.map +1 -1
  106. package/dist/esm/protocols/subject-erasure-effect.standard-interface.js.map +1 -1
  107. package/dist/tsconfig.build.tsbuildinfo +1 -1
  108. package/package.json +5 -5
  109. package/dist/esm/.native.tsbuildinfo +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,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,kFAAkF;AAClF,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,E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G,MAAM,KAAK,GAAG,IAAI,MAAM,KAAK,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","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 `describeProviderProtocolSecretRef` 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 ENGINE providers' document-extraction model catalog — the per-model fact table for every model an engine\n * provider serves (the `EMBEDDINGS_MODEL_CATALOG` discipline: an EXHAUSTIVE `Record`, so a new\n * `DocumentExtractionProvider_Model` member without a row is a compile error). A provider installed from the module\n * registry states the same facts on its own contract instead (`DocumentExtraction_ModelDeclaration`, #2021).\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/**\n * A document-extraction model a provider DECLARES itself (#2021): what the engine's catalog holds for its own providers,\n * for a provider the catalog does not know.\n *\n * The catalog above is closed over an engine enum, which is right for the engine's providers and makes an imported one\n * impossible: a provider installed from the module registry is authored in the application's own package, and the engine\n * cannot hold a row for a model it has never heard of. So such a provider states the same facts on its runtime contract\n * (`models` on the DOCUMENT_EXTRACTION arm), and they are held to the same use: `supportedMimeTypes` is consulted before\n * any byte leaves, and `applicabilities` is what an author's class resolves against.\n *\n * Import path: `@wildo-ai/external-connectors-models`.\n */\nexport type DocumentExtraction_ModelDeclaration = {\n /** The vendor's model id, sent as the resolved model. */\n model: string;\n /** MIME types this model can process, as the vendor documents them. Lower-case. */\n supportedMimeTypes: readonly string[];\n /** Which applicability classes this model may be resolved for. */\n applicabilities: readonly DocumentExtraction_Applicability[];\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 * A provider the engine's catalog knows ALSO declares models. The catalog is the one place an engine provider's models\n * live; a second, provider-side list could disagree with it about what may be sent, so it is refused rather than merged.\n */\n CATALOG_PROVIDER_DECLARES_MODELS = \"catalog_provider_declares_models\",\n}\n\nexport type DocumentExtraction_ModelResolution =\n | { resolved: true; model: string; supportedMimeTypes: readonly string[] }\n | {\n resolved: false;\n failure: DocumentExtraction_ModelResolutionFailure;\n consideredModels: readonly string[];\n };\n\n/**\n * Resolve an applicability class to ONE concrete extraction model for a given provider.\n *\n * A provider the engine's catalog knows resolves from the catalog and its preference order, and may not also declare\n * models. Any other provider (one installed from the module registry, #2021) resolves from the models it declares, in\n * the order it declares them.\n *\n * Fails CLOSED and explains itself (the `resolveModelForApplicability` contract): a silent fallback to some other model\n * would send application documents to a model nobody chose.\n */\nexport const resolveDocumentExtractionModelForApplicability = (\n input: {\n applicability: DocumentExtraction_Applicability;\n providerRef: string;\n /** The `models` the provider's runtime contract declares. Absent or empty for an engine provider. */\n declaredModels?: readonly DocumentExtraction_ModelDeclaration[];\n },\n catalog: Record<DocumentExtractionProvider_Model, DocumentExtraction_ModelCatalogEntry> = DOCUMENT_EXTRACTION_MODEL_CATALOG,\n): DocumentExtraction_ModelResolution => {\n const declaredModels = input.declaredModels ?? [];\n const catalogKnowsProvider = Object.values(catalog).some((entry) => entry.providerRef === input.providerRef);\n if (catalogKnowsProvider) {\n const candidates = DOCUMENT_EXTRACTION_MODEL_APPLICABILITY_PREFERENCE[input.applicability];\n if (declaredModels.length > 0) {\n return {\n resolved: false,\n failure: DocumentExtraction_ModelResolutionFailure.CATALOG_PROVIDER_DECLARES_MODELS,\n consideredModels: declaredModels.map((declaration) => declaration.model),\n };\n }\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: DocumentExtraction_ModelResolutionFailure.NO_CANDIDATE_FOR_PROVIDER, consideredModels: candidates };\n }\n const model = forProvider[0]!;\n return { resolved: true, model, supportedMimeTypes: catalog[model].supportedMimeTypes };\n }\n const declared = declaredModels.find((declaration) => declaration.applicabilities.includes(input.applicability));\n if (declared === undefined) {\n return {\n resolved: false,\n failure: DocumentExtraction_ModelResolutionFailure.NO_CANDIDATE_FOR_PROVIDER,\n consideredModels: declaredModels.map((declaration) => declaration.model),\n };\n }\n return { resolved: true, model: declared.model, supportedMimeTypes: declared.supportedMimeTypes };\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, and what a COMPLETE poll carries (#2020): the extraction, or a\n * 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 * HOW a document-extraction provider exchanges with its vendor (#2020) — the discriminator of the runtime arm's\n * `exchange`.\n *\n * Two shapes exist in the field and they cannot be folded into one:\n * - SINGLE_REQUEST: one request carries the document and the answer carries the text (Mistral OCR).\n * - SUBMIT_AND_POLL: the vendor accepts the document, answers with a job, and the text is fetched later by polling\n * that job until it is done (Azure Document Intelligence's `Operation-Location`, VLM Run). Asynchronous Textract is\n * a job-based vendor this form does NOT serve (SigV4, S3 input, POST polls); see the private exchange type.\n * Folding this into one request is what #2001 showed failing: the first request answers a job id, not text.\n *\n * A closed vocabulary with one home, so the engine's switch over it is exhaustive: a new form, or a deleted one, is a\n * compile error at the one place that executes the exchange.\n */\nexport enum DocumentExtractionExchangeForm {\n SINGLE_REQUEST = \"single-request\",\n SUBMIT_AND_POLL = \"submit-and-poll\",\n}\n\n/**\n * What a SUBMIT_AND_POLL provider's `parseSubmitResponse` returns: the vendor's job id, or a CLASSIFIED refusal. The\n * refusal carries the same two classes as an extraction, for the same reason: a vendor refusing THIS document at\n * submission is permanent, an outage is not, and confusing them deletes a corpus.\n */\nexport type DocumentExtraction_JobSubmission =\n | {\n submitted: true;\n /** The vendor's identifier for the job. Opaque to the engine; handed back to `buildPollRequest`. */\n jobId: string;\n }\n | {\n submitted: false;\n failureClass: DocumentExtraction_FailureClass;\n /** Operator-facing; MUST NOT contain the response body or the document (see the extraction's `message`). */\n message: string;\n };\n\n/** Where a polled job stands. PENDING keeps the engine polling until the provider's deadline. */\nexport enum DocumentExtraction_JobState {\n PENDING = \"pending\",\n COMPLETE = \"complete\",\n}\n\n/**\n * What a SUBMIT_AND_POLL provider's `parsePollResponse` returns for one poll: still running, or done — with the\n * extraction or its classified refusal, exactly what a single-request parser returns.\n *\n * COMPLETE means the VENDOR says the job has ended. A job the vendor reports failed is COMPLETE with a refusal, and\n * only then may the engine submit the document again, because only then is nothing still running. A poll the vendor\n * answered with a transient error (a 5xx or 429 on the poll route) says nothing about the job, so it is PENDING: the\n * engine polls again until the deadline. Reading it as COMPLETE would stop the engine while the job may still run,\n * and a retry would then pay the vendor twice for one document.\n */\nexport type DocumentExtraction_JobPoll =\n | { state: DocumentExtraction_JobState.PENDING }\n | { state: DocumentExtraction_JobState.COMPLETE; extraction: DocumentExtraction_ProviderExtraction };\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
+ {"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,E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AC9C,kEAAkE;AAElE;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAN,IAAY,+BAaX;AAbD,WAAY,+BAA+B;IACzC;;;;OAIG;IACH,8EAA2C,CAAA;IAC3C;;;;OAIG;IACH,gFAA6C,CAAA;AAC/C,CAAC,EAbW,+BAA+B,KAA/B,+BAA+B,QAa1C;AAiCD;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAN,IAAY,8BAGX;AAHD,WAAY,8BAA8B;IACxC,mEAAiC,CAAA;IACjC,qEAAmC,CAAA;AACrC,CAAC,EAHW,8BAA8B,KAA9B,8BAA8B,QAGzC;AAoBD,iGAAiG;AACjG,MAAM,CAAN,IAAY,2BAGX;AAHD,WAAY,2BAA2B;IACrC,kDAAmB,CAAA;IACnB,oDAAqB,CAAA;AACvB,CAAC,EAHW,2BAA2B,KAA3B,2BAA2B,QAGtC;AAgBD;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,MAAM,oCAAoC,GAAG,CAAC,MAAc,EAAmC,EAAE;IACtG,MAAM,iBAAiB,GAAG,MAAM,KAAK,GAAG,IAAI,MAAM,KAAK,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","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 `describeProviderProtocolSecretRef` 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 ENGINE providers' document-extraction model catalog — the per-model fact table for every model an engine\n * provider serves (the `EMBEDDINGS_MODEL_CATALOG` discipline: an EXHAUSTIVE `Record`, so a new\n * `DocumentExtractionProvider_Model` member without a row is a compile error). A provider installed from the module\n * registry states the same facts on its own contract instead (`DocumentExtraction_ModelDeclaration`, #2021).\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/**\n * A document-extraction model a provider DECLARES itself (#2021): what the engine's catalog holds for its own providers,\n * for a provider the catalog does not know.\n *\n * The catalog above is closed over an engine enum, which is right for the engine's providers and makes an imported one\n * impossible: a provider installed from the module registry is authored in the application's own package, and the engine\n * cannot hold a row for a model it has never heard of. So such a provider states the same facts on its runtime contract\n * (`models` on the DOCUMENT_EXTRACTION arm), and they are held to the same use: `supportedMimeTypes` is consulted before\n * any byte leaves, and `applicabilities` is what an author's class resolves against.\n *\n * Import path: `@wildo-ai/external-connectors-models`.\n */\nexport type DocumentExtraction_ModelDeclaration = {\n /** The vendor's model id, sent as the resolved model. */\n model: string;\n /** MIME types this model can process, as the vendor documents them. Lower-case. */\n supportedMimeTypes: readonly string[];\n /** Which applicability classes this model may be resolved for. */\n applicabilities: readonly DocumentExtraction_Applicability[];\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 * A provider the engine's catalog knows ALSO declares models. The catalog is the one place an engine provider's models\n * live; a second, provider-side list could disagree with it about what may be sent, so it is refused rather than merged.\n */\n CATALOG_PROVIDER_DECLARES_MODELS = \"catalog_provider_declares_models\",\n}\n\nexport type DocumentExtraction_ModelResolution =\n | { resolved: true; model: string; supportedMimeTypes: readonly string[] }\n | {\n resolved: false;\n failure: DocumentExtraction_ModelResolutionFailure;\n consideredModels: readonly string[];\n };\n\n/**\n * Resolve an applicability class to ONE concrete extraction model for a given provider.\n *\n * A provider the engine's catalog knows resolves from the catalog and its preference order, and may not also declare\n * models. Any other provider (one installed from the module registry, #2021) resolves from the models it declares, in\n * the order it declares them.\n *\n * Fails CLOSED and explains itself (the `resolveModelForApplicability` contract): a silent fallback to some other model\n * would send application documents to a model nobody chose.\n */\nexport const resolveDocumentExtractionModelForApplicability = (\n input: {\n applicability: DocumentExtraction_Applicability;\n providerRef: string;\n /** The `models` the provider's runtime contract declares. Absent or empty for an engine provider. */\n declaredModels?: readonly DocumentExtraction_ModelDeclaration[];\n },\n catalog: Record<DocumentExtractionProvider_Model, DocumentExtraction_ModelCatalogEntry> = DOCUMENT_EXTRACTION_MODEL_CATALOG,\n): DocumentExtraction_ModelResolution => {\n const declaredModels = input.declaredModels ?? [];\n const catalogKnowsProvider = Object.values(catalog).some((entry) => entry.providerRef === input.providerRef);\n if (catalogKnowsProvider) {\n const candidates = DOCUMENT_EXTRACTION_MODEL_APPLICABILITY_PREFERENCE[input.applicability];\n if (declaredModels.length > 0) {\n return {\n resolved: false,\n failure: DocumentExtraction_ModelResolutionFailure.CATALOG_PROVIDER_DECLARES_MODELS,\n consideredModels: declaredModels.map((declaration) => declaration.model),\n };\n }\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: DocumentExtraction_ModelResolutionFailure.NO_CANDIDATE_FOR_PROVIDER, consideredModels: candidates };\n }\n const model = forProvider[0]!;\n return { resolved: true, model, supportedMimeTypes: catalog[model].supportedMimeTypes };\n }\n const declared = declaredModels.find((declaration) => declaration.applicabilities.includes(input.applicability));\n if (declared === undefined) {\n return {\n resolved: false,\n failure: DocumentExtraction_ModelResolutionFailure.NO_CANDIDATE_FOR_PROVIDER,\n consideredModels: declaredModels.map((declaration) => declaration.model),\n };\n }\n return { resolved: true, model: declared.model, supportedMimeTypes: declared.supportedMimeTypes };\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, and what a COMPLETE poll carries (#2020): the extraction, or a\n * 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 * HOW a document-extraction provider exchanges with its vendor (#2020) — the discriminator of the runtime arm's\n * `exchange`.\n *\n * Two shapes exist in the field and they cannot be folded into one:\n * - SINGLE_REQUEST: one request carries the document and the answer carries the text (Mistral OCR).\n * - SUBMIT_AND_POLL: the vendor accepts the document, answers with a job, and the text is fetched later by polling\n * that job until it is done (Azure Document Intelligence's `Operation-Location`, VLM Run). Asynchronous Textract is\n * a job-based vendor this form does NOT serve (SigV4, S3 input, POST polls); see the private exchange type.\n * Folding this into one request is what #2001 showed failing: the first request answers a job id, not text.\n *\n * A closed vocabulary with one home, so the engine's switch over it is exhaustive: a new form, or a deleted one, is a\n * compile error at the one place that executes the exchange.\n */\nexport enum DocumentExtractionExchangeForm {\n SINGLE_REQUEST = \"single-request\",\n SUBMIT_AND_POLL = \"submit-and-poll\",\n}\n\n/**\n * What a SUBMIT_AND_POLL provider's `parseSubmitResponse` returns: the vendor's job id, or a CLASSIFIED refusal. The\n * refusal carries the same two classes as an extraction, for the same reason: a vendor refusing THIS document at\n * submission is permanent, an outage is not, and confusing them deletes a corpus.\n */\nexport type DocumentExtraction_JobSubmission =\n | {\n submitted: true;\n /** The vendor's identifier for the job. Opaque to the engine; handed back to `buildPollRequest`. */\n jobId: string;\n }\n | {\n submitted: false;\n failureClass: DocumentExtraction_FailureClass;\n /** Operator-facing; MUST NOT contain the response body or the document (see the extraction's `message`). */\n message: string;\n };\n\n/** Where a polled job stands. PENDING keeps the engine polling until the provider's deadline. */\nexport enum DocumentExtraction_JobState {\n PENDING = \"pending\",\n COMPLETE = \"complete\",\n}\n\n/**\n * What a SUBMIT_AND_POLL provider's `parsePollResponse` returns for one poll: still running, or done — with the\n * extraction or its classified refusal, exactly what a single-request parser returns.\n *\n * COMPLETE means the VENDOR says the job has ended. A job the vendor reports failed is COMPLETE with a refusal, and\n * only then may the engine submit the document again, because only then is nothing still running. A poll the vendor\n * answered with a transient error (a 5xx or 429 on the poll route) says nothing about the job, so it is PENDING: the\n * engine polls again until the deadline. Reading it as COMPLETE would stop the engine while the job may still run,\n * and a retry would then pay the vendor twice for one document.\n */\nexport type DocumentExtraction_JobPoll =\n | { state: DocumentExtraction_JobState.PENDING }\n | { state: DocumentExtraction_JobState.COMPLETE; extraction: DocumentExtraction_ProviderExtraction };\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"]}
@@ -0,0 +1,157 @@
1
+ import { z } from "zod";
2
+ import type { API_HttpMethod } from "../core/commons.external-connectors-models.schemas";
3
+ /**
4
+ * The level of electronic signature a deliverable requires, and a provider declares it can apply.
5
+ *
6
+ * eIDAS Art. 3(10) and Art. 26: an advanced signature is uniquely linked to and capable of identifying the signatory,
7
+ * created with data under their sole control, and linked to the signed data so that any later change is detectable.
8
+ * Qualified signatures (Art. 3(12)) are deliberately not a member (Paul, 2026-10-19).
9
+ *
10
+ * spec-cite: Regulation (EU) No 910/2014, Art. 3(10), 3(11), 3(12) and Art. 26 — the definitions of simple, advanced
11
+ * and qualified electronic signatures; paraphrased, not quoted.
12
+ *
13
+ * Import path: `@wildo-ai/external-connectors-models`.
14
+ */
15
+ export declare enum ElectronicSignature_Level {
16
+ /** A simple electronic signature: data the signatory attaches to sign (Art. 3(10)). Any vendor applies it. */
17
+ SIMPLE = "simple",
18
+ /** An advanced electronic signature (Art. 26), applied by a trust-service vendor. */
19
+ ADVANCED = "advanced"
20
+ }
21
+ /**
22
+ * Whether a signature at `achieved` meets a requirement of `required`. An advanced signature is also a simple one, so it
23
+ * meets a SIMPLE requirement; a simple one never meets an ADVANCED requirement.
24
+ *
25
+ * Import path: `@wildo-ai/external-connectors-models`.
26
+ */
27
+ export declare function electronicSignatureLevelSatisfies(achieved: ElectronicSignature_Level, required: ElectronicSignature_Level): boolean;
28
+ /**
29
+ * Whether a provider's contract reaches the vendor's PRODUCTION environment or one of its test environments. Evidence
30
+ * signed in a test environment is refused in production (its chain does not reach the production anchors), and a
31
+ * contract declaring a test environment is refused at startup in a production runtime.
32
+ *
33
+ * Import path: `@wildo-ai/external-connectors-models`.
34
+ */
35
+ export declare enum ElectronicSignature_VendorEnvironment {
36
+ PRODUCTION = "production",
37
+ NON_PRODUCTION = "non_production"
38
+ }
39
+ /**
40
+ * The electronic-signature operation vocabulary — disjoint from every other protocol's operation keys.
41
+ *
42
+ * Import path: `@wildo-ai/external-connectors-models`.
43
+ */
44
+ export declare enum ElectronicSignatureProvider_OperationKey {
45
+ /** Create a request at the vendor: the document, its signers, the level. */
46
+ SEND_REQUEST = "electronicSignature.sendRequest",
47
+ /** Re-read a request's status at the vendor. */
48
+ READ_REQUEST = "electronicSignature.readRequest",
49
+ /** Download the signed document of a request the vendor reports complete. */
50
+ DOWNLOAD_SIGNED_DOCUMENT = "electronicSignature.downloadSignedDocument",
51
+ /** Cancel an open request at the vendor, and (where the provider deletes on removal) delete it there. */
52
+ CANCEL_REQUEST = "electronicSignature.cancelRequest"
53
+ }
54
+ /**
55
+ * Where the vendor says a request stands, read from its own API. A CLAIM of the vendor's: the engine moves its own record
56
+ * on it (declined, expired, cancelled, partially signed) but never to SIGNED, which needs the validated document.
57
+ *
58
+ * Import path: `@wildo-ai/external-connectors-models`.
59
+ */
60
+ export declare enum ElectronicSignature_VendorRequestStatus {
61
+ /** Created and waiting for its signers; nobody has signed. */
62
+ PENDING = "pending",
63
+ /** Some signers signed, others have not yet. */
64
+ PARTIALLY_SIGNED = "partially_signed",
65
+ /** Every signer signed; the signed document can be downloaded. */
66
+ COMPLETED = "completed",
67
+ /** A signer refused. */
68
+ DECLINED = "declined",
69
+ /** The vendor's deadline passed. */
70
+ EXPIRED = "expired",
71
+ /** Cancelled at the vendor. */
72
+ CANCELLED = "cancelled"
73
+ }
74
+ /**
75
+ * One HTTP request a provider function asks the engine to send. The engine owns the host (the contract's base URL, never
76
+ * anything here), the API-key header, the timeout and the redirect refusal; `path` is appended to the base URL and must
77
+ * start with `/` (an absolute URL is refused). `body` is already encoded; `transportHeaders` describe it (a
78
+ * `content-type` at minimum when there is a body) and can never replace the engine's authentication header.
79
+ */
80
+ export interface ElectronicSignature_ProviderRequest {
81
+ readonly method: API_HttpMethod;
82
+ readonly path: string;
83
+ readonly body?: string | Uint8Array;
84
+ readonly transportHeaders?: Readonly<Record<string, string>>;
85
+ }
86
+ /** A vendor answer as the engine hands it to a provider function: status, lower-cased headers, best-effort decoded body. */
87
+ export interface ElectronicSignature_ProviderResponse {
88
+ readonly status: number;
89
+ readonly headers: Readonly<Record<string, string>>;
90
+ readonly body: unknown;
91
+ }
92
+ /** One signer of a request, as a provider is given it. */
93
+ export interface ElectronicSignature_SignerInput {
94
+ /** The engine's own opaque reference to this signer (its signer row). The provider maps it to the vendor's signer. */
95
+ readonly signerRef: string;
96
+ /** The order in which the vendor asks the signers, from 0. Equal orders sign in parallel. */
97
+ readonly signingOrder: number;
98
+ readonly firstName: string;
99
+ readonly lastName: string;
100
+ readonly email: string;
101
+ }
102
+ /** What a provider is given to send a request. Nothing about the tenant, the record or the approval. */
103
+ export interface ElectronicSignature_SendInput {
104
+ readonly document: Uint8Array;
105
+ readonly documentName: string;
106
+ readonly mimeType: string;
107
+ /** The SHA-256 of `document`, lower-case hex, as the file recorded it. */
108
+ readonly contentSha256: string;
109
+ readonly level: ElectronicSignature_Level;
110
+ readonly signers: readonly ElectronicSignature_SignerInput[];
111
+ }
112
+ /**
113
+ * What a provider answers at each step of sending: another request to make (with JSON-safe state it wants back), or
114
+ * the end, SENT or REFUSED.
115
+ */
116
+ export type ElectronicSignature_SendStep = {
117
+ readonly kind: "request";
118
+ readonly request: ElectronicSignature_ProviderRequest;
119
+ readonly carry?: unknown;
120
+ } | {
121
+ readonly kind: "sent";
122
+ /** The vendor's references for the request: several when the vendor splits it per document. Never empty. */
123
+ readonly vendorReferences: readonly string[];
124
+ /** The vendor's reference to each signer, keyed by the engine's `signerRef`. */
125
+ readonly vendorSignerReferences: Readonly<Record<string, string>>;
126
+ } | {
127
+ readonly kind: "refused";
128
+ readonly reason: string;
129
+ /** Whether asking again later could succeed (a vendor outage or throttle), as opposed to a refusal of the request. */
130
+ readonly retryable: boolean;
131
+ };
132
+ /** What a provider reads from the vendor's answer to a status re-read. */
133
+ export declare const ElectronicSignature_VendorRequestReadingSchema: z.ZodObject<{
134
+ status: z.ZodEnum<typeof ElectronicSignature_VendorRequestStatus>;
135
+ signedVendorSignerReferences: z.ZodOptional<z.ZodArray<z.ZodString>>;
136
+ }, z.core.$strip>;
137
+ export type ElectronicSignature_VendorRequestReading = z.infer<typeof ElectronicSignature_VendorRequestReadingSchema>;
138
+ /** What a provider reads from the vendor's answer to a cancellation. */
139
+ export declare enum ElectronicSignature_CancellationOutcome {
140
+ /** The request is cancelled at the vendor (now, or already). */
141
+ CANCELLED = "cancelled",
142
+ /** The vendor refuses: the request is already final there (signed, declined, expired). */
143
+ ALREADY_FINAL = "already_final",
144
+ /** The vendor could not be asked or did not answer usably. Try again. */
145
+ FAILED = "failed"
146
+ }
147
+ /**
148
+ * The provider's limits the engine enforces on its side: how many steps a sending may take, and how large a document
149
+ * and a signed document may be. A provider declares its vendor's documented maxima.
150
+ */
151
+ export declare const ElectronicSignature_LimitsSchema: z.ZodObject<{
152
+ maxSendSteps: z.ZodNumber;
153
+ maxDocumentBytes: z.ZodNumber;
154
+ maxSignedDocumentBytes: z.ZodNumber;
155
+ }, z.core.$strip>;
156
+ export type ElectronicSignature_Limits = z.infer<typeof ElectronicSignature_LimitsSchema>;
157
+ //# sourceMappingURL=electronic-signature.external-connectors-models.schemas.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"electronic-signature.external-connectors-models.schemas.d.ts","sourceRoot":"","sources":["../../../src/protocols/electronic-signature.external-connectors-models.schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oDAAoD,CAAA;AA4BxF;;;;;;;;;;;GAWG;AACH,oBAAY,yBAAyB;IACnC,8GAA8G;IAC9G,MAAM,WAAW;IACjB,qFAAqF;IACrF,QAAQ,aAAa;CACtB;AAKD;;;;;GAKG;AACH,wBAAgB,iCAAiC,CAAC,QAAQ,EAAE,yBAAyB,EAAE,QAAQ,EAAE,yBAAyB,GAAG,OAAO,CAEnI;AAED;;;;;;GAMG;AACH,oBAAY,qCAAqC;IAC/C,UAAU,eAAe;IACzB,cAAc,mBAAmB;CAClC;AAED;;;;GAIG;AACH,oBAAY,wCAAwC;IAClD,4EAA4E;IAC5E,YAAY,oCAAoC;IAChD,gDAAgD;IAChD,YAAY,oCAAoC;IAChD,6EAA6E;IAC7E,wBAAwB,+CAA+C;IACvE,yGAAyG;IACzG,cAAc,sCAAsC;CACrD;AAED;;;;;GAKG;AACH,oBAAY,uCAAuC;IACjD,8DAA8D;IAC9D,OAAO,YAAY;IACnB,gDAAgD;IAChD,gBAAgB,qBAAqB;IACrC,kEAAkE;IAClE,SAAS,cAAc;IACvB,wBAAwB;IACxB,QAAQ,aAAa;IACrB,oCAAoC;IACpC,OAAO,YAAY;IACnB,+BAA+B;IAC/B,SAAS,cAAc;CACxB;AAED;;;;;GAKG;AACH,MAAM,WAAW,mCAAmC;IAClD,QAAQ,CAAC,MAAM,EAAE,cAAc,CAAA;IAC/B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,UAAU,CAAA;IACnC,QAAQ,CAAC,gBAAgB,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC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5C,gFAAgF;IAChF,QAAQ,CAAC,sBAAsB,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAA;CAClE,GACD;IACE,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAA;IACxB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,sHAAsH;IACtH,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAA;CAC5B,CAAA;AAEL,0EAA0E;AAC1E,eAAO,MAAM,8CAA8C;;;iBAIzD,CAAA;AACF,MAAM,MAAM,wCAAwC,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,8CAA8C,CAAC,CAAA;AAErH,wEAAwE;AACxE,oBAAY,uCAAuC;IACjD,gEAAgE;IAChE,SAAS,cAAc;IACvB,0FAA0F;IAC1F,aAAa,kBAAkB;IAC/B,yEAAyE;IACzE,MAAM,WAAW;CAClB;AAED;;;GAGG;AACH,eAAO,MAAM,gCAAgC;;;;iBAO3C,CAAA;AACF,MAAM,MAAM,0BAA0B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gCAAgC,CAAC,CAAA"}
@@ -0,0 +1,134 @@
1
+ import { z } from "zod";
2
+ //===============================================================
3
+ // Electronic Signature Provider (#2293)
4
+ // --------
5
+ // A deliverable sent to a trust-service vendor so the people who must sign it apply their own electronic signature
6
+ // (level 2 of epic #2916). The vendor renders the signing page, authenticates each signer and returns the signed
7
+ // document; the engine never trusts the vendor's word that it is signed (it validates the document at receipt).
8
+ //
9
+ // ## Why the exchange is a sequence of steps
10
+ //
11
+ // Vendors do not agree on how many calls a request takes. DocuSign creates an envelope, its documents and its recipients
12
+ // in one call; Yousign and IgniSign create the request, upload each document, add each signer and then activate (or
13
+ // publish) it, each a call of its own. So creation is a CONVERSATION the provider drives with pure functions: the
14
+ // engine asks for the first request, sends it, hands the answer back with whatever the provider chose to carry, and
15
+ // repeats until the provider answers SENT or REFUSED. The provider never touches the network, a key or a clock.
16
+ //
17
+ // spec-cite: N/A — the step counts above are a paraphrase of each vendor's public API reference (DocuSign eSignature
18
+ // REST `Envelopes:create`; Yousign API v3 "create a signature request, add documents and signers, activate"; IgniSign v4
19
+ // init, documents, signers, publish), cited for the shape the exchange must admit, not quoted.
20
+ //
21
+ // ## What a provider is given
22
+ //
23
+ // The document's bytes and name, its SHA-256, the required level, and per signer the opaque reference the engine keys
24
+ // them by, their name and their contact: what a vendor needs to send the invitation and nothing about the tenant, the
25
+ // record or the approval. Contact data comes from the operator's database; that is a stated residual of the epic.
26
+ //===============================================================
27
+ /**
28
+ * The level of electronic signature a deliverable requires, and a provider declares it can apply.
29
+ *
30
+ * eIDAS Art. 3(10) and Art. 26: an advanced signature is uniquely linked to and capable of identifying the signatory,
31
+ * created with data under their sole control, and linked to the signed data so that any later change is detectable.
32
+ * Qualified signatures (Art. 3(12)) are deliberately not a member (Paul, 2026-10-19).
33
+ *
34
+ * spec-cite: Regulation (EU) No 910/2014, Art. 3(10), 3(11), 3(12) and Art. 26 — the definitions of simple, advanced
35
+ * and qualified electronic signatures; paraphrased, not quoted.
36
+ *
37
+ * Import path: `@wildo-ai/external-connectors-models`.
38
+ */
39
+ export var ElectronicSignature_Level;
40
+ (function (ElectronicSignature_Level) {
41
+ /** A simple electronic signature: data the signatory attaches to sign (Art. 3(10)). Any vendor applies it. */
42
+ ElectronicSignature_Level["SIMPLE"] = "simple";
43
+ /** An advanced electronic signature (Art. 26), applied by a trust-service vendor. */
44
+ ElectronicSignature_Level["ADVANCED"] = "advanced";
45
+ })(ElectronicSignature_Level || (ElectronicSignature_Level = {}));
46
+ /** The levels from weakest to strongest: the one order {@link electronicSignatureLevelSatisfies} compares on. */
47
+ const ELECTRONIC_SIGNATURE_LEVEL_ORDER = [ElectronicSignature_Level.SIMPLE, ElectronicSignature_Level.ADVANCED];
48
+ /**
49
+ * Whether a signature at `achieved` meets a requirement of `required`. An advanced signature is also a simple one, so it
50
+ * meets a SIMPLE requirement; a simple one never meets an ADVANCED requirement.
51
+ *
52
+ * Import path: `@wildo-ai/external-connectors-models`.
53
+ */
54
+ export function electronicSignatureLevelSatisfies(achieved, required) {
55
+ return ELECTRONIC_SIGNATURE_LEVEL_ORDER.indexOf(achieved) >= ELECTRONIC_SIGNATURE_LEVEL_ORDER.indexOf(required);
56
+ }
57
+ /**
58
+ * Whether a provider's contract reaches the vendor's PRODUCTION environment or one of its test environments. Evidence
59
+ * signed in a test environment is refused in production (its chain does not reach the production anchors), and a
60
+ * contract declaring a test environment is refused at startup in a production runtime.
61
+ *
62
+ * Import path: `@wildo-ai/external-connectors-models`.
63
+ */
64
+ export var ElectronicSignature_VendorEnvironment;
65
+ (function (ElectronicSignature_VendorEnvironment) {
66
+ ElectronicSignature_VendorEnvironment["PRODUCTION"] = "production";
67
+ ElectronicSignature_VendorEnvironment["NON_PRODUCTION"] = "non_production";
68
+ })(ElectronicSignature_VendorEnvironment || (ElectronicSignature_VendorEnvironment = {}));
69
+ /**
70
+ * The electronic-signature operation vocabulary — disjoint from every other protocol's operation keys.
71
+ *
72
+ * Import path: `@wildo-ai/external-connectors-models`.
73
+ */
74
+ export var ElectronicSignatureProvider_OperationKey;
75
+ (function (ElectronicSignatureProvider_OperationKey) {
76
+ /** Create a request at the vendor: the document, its signers, the level. */
77
+ ElectronicSignatureProvider_OperationKey["SEND_REQUEST"] = "electronicSignature.sendRequest";
78
+ /** Re-read a request's status at the vendor. */
79
+ ElectronicSignatureProvider_OperationKey["READ_REQUEST"] = "electronicSignature.readRequest";
80
+ /** Download the signed document of a request the vendor reports complete. */
81
+ ElectronicSignatureProvider_OperationKey["DOWNLOAD_SIGNED_DOCUMENT"] = "electronicSignature.downloadSignedDocument";
82
+ /** Cancel an open request at the vendor, and (where the provider deletes on removal) delete it there. */
83
+ ElectronicSignatureProvider_OperationKey["CANCEL_REQUEST"] = "electronicSignature.cancelRequest";
84
+ })(ElectronicSignatureProvider_OperationKey || (ElectronicSignatureProvider_OperationKey = {}));
85
+ /**
86
+ * Where the vendor says a request stands, read from its own API. A CLAIM of the vendor's: the engine moves its own record
87
+ * on it (declined, expired, cancelled, partially signed) but never to SIGNED, which needs the validated document.
88
+ *
89
+ * Import path: `@wildo-ai/external-connectors-models`.
90
+ */
91
+ export var ElectronicSignature_VendorRequestStatus;
92
+ (function (ElectronicSignature_VendorRequestStatus) {
93
+ /** Created and waiting for its signers; nobody has signed. */
94
+ ElectronicSignature_VendorRequestStatus["PENDING"] = "pending";
95
+ /** Some signers signed, others have not yet. */
96
+ ElectronicSignature_VendorRequestStatus["PARTIALLY_SIGNED"] = "partially_signed";
97
+ /** Every signer signed; the signed document can be downloaded. */
98
+ ElectronicSignature_VendorRequestStatus["COMPLETED"] = "completed";
99
+ /** A signer refused. */
100
+ ElectronicSignature_VendorRequestStatus["DECLINED"] = "declined";
101
+ /** The vendor's deadline passed. */
102
+ ElectronicSignature_VendorRequestStatus["EXPIRED"] = "expired";
103
+ /** Cancelled at the vendor. */
104
+ ElectronicSignature_VendorRequestStatus["CANCELLED"] = "cancelled";
105
+ })(ElectronicSignature_VendorRequestStatus || (ElectronicSignature_VendorRequestStatus = {}));
106
+ /** What a provider reads from the vendor's answer to a status re-read. */
107
+ export const ElectronicSignature_VendorRequestReadingSchema = z.object({
108
+ status: z.enum(ElectronicSignature_VendorRequestStatus),
109
+ /** The vendor's references of the signers the vendor reports as signed, when it says. */
110
+ signedVendorSignerReferences: z.array(z.string().min(1)).optional(),
111
+ });
112
+ /** What a provider reads from the vendor's answer to a cancellation. */
113
+ export var ElectronicSignature_CancellationOutcome;
114
+ (function (ElectronicSignature_CancellationOutcome) {
115
+ /** The request is cancelled at the vendor (now, or already). */
116
+ ElectronicSignature_CancellationOutcome["CANCELLED"] = "cancelled";
117
+ /** The vendor refuses: the request is already final there (signed, declined, expired). */
118
+ ElectronicSignature_CancellationOutcome["ALREADY_FINAL"] = "already_final";
119
+ /** The vendor could not be asked or did not answer usably. Try again. */
120
+ ElectronicSignature_CancellationOutcome["FAILED"] = "failed";
121
+ })(ElectronicSignature_CancellationOutcome || (ElectronicSignature_CancellationOutcome = {}));
122
+ /**
123
+ * The provider's limits the engine enforces on its side: how many steps a sending may take, and how large a document
124
+ * and a signed document may be. A provider declares its vendor's documented maxima.
125
+ */
126
+ export const ElectronicSignature_LimitsSchema = z.object({
127
+ /** The most requests one sending makes (every step of the conversation counts). */
128
+ maxSendSteps: z.number().int().positive().max(64),
129
+ /** The largest document, in bytes, the vendor accepts. */
130
+ maxDocumentBytes: z.number().int().positive(),
131
+ /** The largest signed document, in bytes, the engine reads back. */
132
+ maxSignedDocumentBytes: z.number().int().positive(),
133
+ });
134
+ //# sourceMappingURL=electronic-signature.external-connectors-models.schemas.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"electronic-signature.external-connectors-models.schemas.js","sourceRoot":"","sources":["../../../src/protocols/electronic-signature.external-connectors-models.schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAGvB,iEAAiE;AACjE,wCAAwC;AACxC,WAAW;AACX,mHAAmH;AACnH,iHAAiH;AACjH,gHAAgH;AAChH,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,yHAAyH;AACzH,oHAAoH;AACpH,kHAAkH;AAClH,oHAAoH;AACpH,gHAAgH;AAChH,EAAE;AACF,qHAAqH;AACrH,yHAAyH;AACzH,+FAA+F;AAC/F,EAAE;AACF,8BAA8B;AAC9B,EAAE;AACF,sHAAsH;AACtH,sHAAsH;AACtH,kHAAkH;AAClH,iEAAiE;AAEjE;;;;;;;;;;;GAWG;AACH,MAAM,CAAN,IAAY,yBAKX;AALD,WAAY,yBAAyB;IACnC,8GAA8G;IAC9G,8CAAiB,CAAA;IACjB,qFAAqF;IACrF,kDAAqB,CAAA;AACvB,CAAC,EALW,yBAAyB,KAAzB,yBAAyB,QAKpC;AAED,iHAAiH;AACjH,MAAM,gCAAgC,GAAyC,CAAC,yBAAyB,CAAC,MAAM,EAAE,yBAAyB,CAAC,QAAQ,CA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wE;AACxE,MAAM,CAAN,IAAY,uCAOX;AAPD,WAAY,uCAAuC;IACjD,gEAAgE;IAChE,kEAAuB,CAAA;IACvB,0FAA0F;IAC1F,0EAA+B,CAAA;IAC/B,yEAAyE;IACzE,4DAAiB,CAAA;AACnB,CAAC,EAPW,uCAAuC,KAAvC,uCAAuC,QAOlD;AAED;;;GAGG;AACH,MAAM,CAAC,MAAM,gCAAgC,GAAG,CAAC,CAAC,MAAM,CAAC;IACvD,mFAAmF;IACnF,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC;IACjD,0DAA0D;IAC1D,gBAAgB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;IAC7C,oEAAoE;IACpE,sBAAsB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;CACpD,CAAC,CAAA","sourcesContent":["import { z } from \"zod\"\nimport type { API_HttpMethod } from \"../core/commons.external-connectors-models.schemas\"\n\n//===============================================================\n// Electronic Signature Provider (#2293)\n// --------\n// A deliverable sent to a trust-service vendor so the people who must sign it apply their own electronic signature\n// (level 2 of epic #2916). The vendor renders the signing page, authenticates each signer and returns the signed\n// document; the engine never trusts the vendor's word that it is signed (it validates the document at receipt).\n//\n// ## Why the exchange is a sequence of steps\n//\n// Vendors do not agree on how many calls a request takes. DocuSign creates an envelope, its documents and its recipients\n// in one call; Yousign and IgniSign create the request, upload each document, add each signer and then activate (or\n// publish) it, each a call of its own. So creation is a CONVERSATION the provider drives with pure functions: the\n// engine asks for the first request, sends it, hands the answer back with whatever the provider chose to carry, and\n// repeats until the provider answers SENT or REFUSED. The provider never touches the network, a key or a clock.\n//\n// spec-cite: N/A — the step counts above are a paraphrase of each vendor's public API reference (DocuSign eSignature\n// REST `Envelopes:create`; Yousign API v3 \"create a signature request, add documents and signers, activate\"; IgniSign v4\n// init, documents, signers, publish), cited for the shape the exchange must admit, not quoted.\n//\n// ## What a provider is given\n//\n// The document's bytes and name, its SHA-256, the required level, and per signer the opaque reference the engine keys\n// them by, their name and their contact: what a vendor needs to send the invitation and nothing about the tenant, the\n// record or the approval. Contact data comes from the operator's database; that is a stated residual of the epic.\n//===============================================================\n\n/**\n * The level of electronic signature a deliverable requires, and a provider declares it can apply.\n *\n * eIDAS Art. 3(10) and Art. 26: an advanced signature is uniquely linked to and capable of identifying the signatory,\n * created with data under their sole control, and linked to the signed data so that any later change is detectable.\n * Qualified signatures (Art. 3(12)) are deliberately not a member (Paul, 2026-10-19).\n *\n * spec-cite: Regulation (EU) No 910/2014, Art. 3(10), 3(11), 3(12) and Art. 26 — the definitions of simple, advanced\n * and qualified electronic signatures; paraphrased, not quoted.\n *\n * Import path: `@wildo-ai/external-connectors-models`.\n */\nexport enum ElectronicSignature_Level {\n /** A simple electronic signature: data the signatory attaches to sign (Art. 3(10)). Any vendor applies it. */\n SIMPLE = \"simple\",\n /** An advanced electronic signature (Art. 26), applied by a trust-service vendor. */\n ADVANCED = \"advanced\",\n}\n\n/** The levels from weakest to strongest: the one order {@link electronicSignatureLevelSatisfies} compares on. */\nconst ELECTRONIC_SIGNATURE_LEVEL_ORDER: readonly ElectronicSignature_Level[] = [ElectronicSignature_Level.SIMPLE, ElectronicSignature_Level.ADVANCED]\n\n/**\n * Whether a signature at `achieved` meets a requirement of `required`. An advanced signature is also a simple one, so it\n * meets a SIMPLE requirement; a simple one never meets an ADVANCED requirement.\n *\n * Import path: `@wildo-ai/external-connectors-models`.\n */\nexport function electronicSignatureLevelSatisfies(achieved: ElectronicSignature_Level, required: ElectronicSignature_Level): boolean {\n return ELECTRONIC_SIGNATURE_LEVEL_ORDER.indexOf(achieved) >= ELECTRONIC_SIGNATURE_LEVEL_ORDER.indexOf(required)\n}\n\n/**\n * Whether a provider's contract reaches the vendor's PRODUCTION environment or one of its test environments. Evidence\n * signed in a test environment is refused in production (its chain does not reach the production anchors), and a\n * contract declaring a test environment is refused at startup in a production runtime.\n *\n * Import path: `@wildo-ai/external-connectors-models`.\n */\nexport enum ElectronicSignature_VendorEnvironment {\n PRODUCTION = \"production\",\n NON_PRODUCTION = \"non_production\",\n}\n\n/**\n * The electronic-signature operation vocabulary — disjoint from every other protocol's operation keys.\n *\n * Import path: `@wildo-ai/external-connectors-models`.\n */\nexport enum ElectronicSignatureProvider_OperationKey {\n /** Create a request at the vendor: the document, its signers, the level. */\n SEND_REQUEST = \"electronicSignature.sendRequest\",\n /** Re-read a request's status at the vendor. */\n READ_REQUEST = \"electronicSignature.readRequest\",\n /** Download the signed document of a request the vendor reports complete. */\n DOWNLOAD_SIGNED_DOCUMENT = \"electronicSignature.downloadSignedDocument\",\n /** Cancel an open request at the vendor, and (where the provider deletes on removal) delete it there. */\n CANCEL_REQUEST = \"electronicSignature.cancelRequest\",\n}\n\n/**\n * Where the vendor says a request stands, read from its own API. A CLAIM of the vendor's: the engine moves its own record\n * on it (declined, expired, cancelled, partially signed) but never to SIGNED, which needs the validated document.\n *\n * Import path: `@wildo-ai/external-connectors-models`.\n */\nexport enum ElectronicSignature_VendorRequestStatus {\n /** Created and waiting for its signers; nobody has signed. */\n PENDING = \"pending\",\n /** Some signers signed, others have not yet. */\n PARTIALLY_SIGNED = \"partially_signed\",\n /** Every signer signed; the signed document can be downloaded. */\n COMPLETED = \"completed\",\n /** A signer refused. */\n DECLINED = \"declined\",\n /** The vendor's deadline passed. */\n EXPIRED = \"expired\",\n /** Cancelled at the vendor. */\n CANCELLED = \"cancelled\",\n}\n\n/**\n * One HTTP request a provider function asks the engine to send. The engine owns the host (the contract's base URL, never\n * anything here), the API-key header, the timeout and the redirect refusal; `path` is appended to the base URL and must\n * start with `/` (an absolute URL is refused). `body` is already encoded; `transportHeaders` describe it (a\n * `content-type` at minimum when there is a body) and can never replace the engine's authentication header.\n */\nexport interface ElectronicSignature_ProviderRequest {\n readonly method: API_HttpMethod\n readonly path: string\n readonly body?: string | Uint8Array\n readonly transportHeaders?: Readonly<Record<string, string>>\n}\n\n/** A vendor answer as the engine hands it to a provider function: status, lower-cased headers, best-effort decoded body. */\nexport interface ElectronicSignature_ProviderResponse {\n readonly status: number\n readonly headers: Readonly<Record<string, string>>\n readonly body: unknown\n}\n\n/** One signer of a request, as a provider is given it. */\nexport interface ElectronicSignature_SignerInput {\n /** The engine's own opaque reference to this signer (its signer row). The provider maps it to the vendor's signer. */\n readonly signerRef: string\n /** The order in which the vendor asks the signers, from 0. Equal orders sign in parallel. */\n readonly signingOrder: number\n readonly firstName: string\n readonly lastName: string\n readonly email: string\n}\n\n/** What a provider is given to send a request. Nothing about the tenant, the record or the approval. */\nexport interface ElectronicSignature_SendInput {\n readonly document: Uint8Array\n readonly documentName: string\n readonly mimeType: string\n /** The SHA-256 of `document`, lower-case hex, as the file recorded it. */\n readonly contentSha256: string\n readonly level: ElectronicSignature_Level\n readonly signers: readonly ElectronicSignature_SignerInput[]\n}\n\n/**\n * What a provider answers at each step of sending: another request to make (with JSON-safe state it wants back), or\n * the end, SENT or REFUSED.\n */\nexport type ElectronicSignature_SendStep =\n | { readonly kind: \"request\"; readonly request: ElectronicSignature_ProviderRequest; readonly carry?: unknown }\n | {\n readonly kind: \"sent\"\n /** The vendor's references for the request: several when the vendor splits it per document. Never empty. */\n readonly vendorReferences: readonly string[]\n /** The vendor's reference to each signer, keyed by the engine's `signerRef`. */\n readonly vendorSignerReferences: Readonly<Record<string, string>>\n }\n | {\n readonly kind: \"refused\"\n readonly reason: string\n /** Whether asking again later could succeed (a vendor outage or throttle), as opposed to a refusal of the request. */\n readonly retryable: boolean\n }\n\n/** What a provider reads from the vendor's answer to a status re-read. */\nexport const ElectronicSignature_VendorRequestReadingSchema = z.object({\n status: z.enum(ElectronicSignature_VendorRequestStatus),\n /** The vendor's references of the signers the vendor reports as signed, when it says. */\n signedVendorSignerReferences: z.array(z.string().min(1)).optional(),\n})\nexport type ElectronicSignature_VendorRequestReading = z.infer<typeof ElectronicSignature_VendorRequestReadingSchema>\n\n/** What a provider reads from the vendor's answer to a cancellation. */\nexport enum ElectronicSignature_CancellationOutcome {\n /** The request is cancelled at the vendor (now, or already). */\n CANCELLED = \"cancelled\",\n /** The vendor refuses: the request is already final there (signed, declined, expired). */\n ALREADY_FINAL = \"already_final\",\n /** The vendor could not be asked or did not answer usably. Try again. */\n FAILED = \"failed\",\n}\n\n/**\n * The provider's limits the engine enforces on its side: how many steps a sending may take, and how large a document\n * and a signed document may be. A provider declares its vendor's documented maxima.\n */\nexport const ElectronicSignature_LimitsSchema = z.object({\n /** The most requests one sending makes (every step of the conversation counts). */\n maxSendSteps: z.number().int().positive().max(64),\n /** The largest document, in bytes, the vendor accepts. */\n maxDocumentBytes: z.number().int().positive(),\n /** The largest signed document, in bytes, the engine reads back. */\n maxSignedDocumentBytes: z.number().int().positive(),\n})\nexport type ElectronicSignature_Limits = z.infer<typeof ElectronicSignature_LimitsSchema>\n"]}
@@ -64,6 +64,7 @@ export type StandardInboundEmail_Attachment = z.infer<typeof StandardInboundEmai
64
64
  export declare const StandardInboundEmail_NotificationSchema: z.ZodObject<{
65
65
  providerMessageId: z.ZodString;
66
66
  receivedFor: z.ZodArray<z.ZodString>;
67
+ namedAddresses: z.ZodOptional<z.ZodArray<z.ZodString>>;
67
68
  receivedAt: z.ZodCoercedDate<unknown>;
68
69
  }, z.core.$strip>;
69
70
  export type StandardInboundEmail_Notification = z.infer<typeof StandardInboundEmail_NotificationSchema>;
@@ -118,6 +119,77 @@ export declare const StandardInboundEmail_MessageSchema: z.ZodObject<{
118
119
  rawRef: z.ZodOptional<z.ZodString>;
119
120
  }, z.core.$strip>;
120
121
  export type StandardInboundEmail_Message = z.infer<typeof StandardInboundEmail_MessageSchema>;
122
+ /**
123
+ * How a receiving provider hands the engine a message (#3395). A closed vocabulary because the engine's whole path
124
+ * from the webhook to the stored message depends on it.
125
+ */
126
+ export declare enum InboundEmailMessageDelivery {
127
+ /**
128
+ * The webhook NOTIFIES: a small signed notification names the message, and the engine fetches the message, its
129
+ * attachments and its original bytes through the provider's API (Resend). The default.
130
+ */
131
+ FETCHED = "fetched",
132
+ /**
133
+ * The webhook IS the message: the whole message, attachments included as base64, arrives in the request body, and
134
+ * nothing is fetched (Postmark; Mailgun's routes post the message too). The engine reads the bytes out of the body
135
+ * it verified and stores them through the same path a fetched message's bytes take.
136
+ */
137
+ PUSHED = "pushed"
138
+ }
139
+ /**
140
+ * A pushed message as a provider module maps it (#3395): the standard message, and the bytes its attachments and its
141
+ * original copy arrived with. The engine re-validates it, refuses an attachment whose content is absent or not
142
+ * base64, and refuses a `rawRef` with no raw content (or raw content with no `rawRef`).
143
+ */
144
+ export declare const StandardInboundEmail_PushedMessageSchema: z.ZodObject<{
145
+ message: z.ZodObject<{
146
+ providerMessageId: z.ZodString;
147
+ messageId: z.ZodOptional<z.ZodString>;
148
+ inReplyTo: z.ZodOptional<z.ZodString>;
149
+ references: z.ZodDefault<z.ZodArray<z.ZodString>>;
150
+ from: z.ZodObject<{
151
+ address: z.ZodString;
152
+ name: z.ZodOptional<z.ZodString>;
153
+ }, z.core.$strip>;
154
+ to: z.ZodDefault<z.ZodArray<z.ZodObject<{
155
+ address: z.ZodString;
156
+ name: z.ZodOptional<z.ZodString>;
157
+ }, z.core.$strip>>>;
158
+ cc: z.ZodDefault<z.ZodArray<z.ZodObject<{
159
+ address: z.ZodString;
160
+ name: z.ZodOptional<z.ZodString>;
161
+ }, z.core.$strip>>>;
162
+ replyTo: z.ZodOptional<z.ZodObject<{
163
+ address: z.ZodString;
164
+ name: z.ZodOptional<z.ZodString>;
165
+ }, z.core.$strip>>;
166
+ receivedFor: z.ZodArray<z.ZodString>;
167
+ subject: z.ZodDefault<z.ZodString>;
168
+ textBody: z.ZodOptional<z.ZodString>;
169
+ htmlBody: z.ZodOptional<z.ZodString>;
170
+ headers: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
171
+ authentication: z.ZodObject<{
172
+ spf: z.ZodEnum<typeof EmailAuthenticationVerdict>;
173
+ dkim: z.ZodEnum<typeof EmailAuthenticationVerdict>;
174
+ dmarc: z.ZodEnum<typeof EmailAuthenticationVerdict>;
175
+ dmarcAligned: z.ZodBoolean;
176
+ }, z.core.$strip>;
177
+ attachments: z.ZodDefault<z.ZodArray<z.ZodObject<{
178
+ ref: z.ZodString;
179
+ filename: z.ZodString;
180
+ contentType: z.ZodString;
181
+ sizeBytes: z.ZodNumber;
182
+ contentId: z.ZodOptional<z.ZodString>;
183
+ disposition: z.ZodOptional<z.ZodEnum<typeof EmailAttachmentDisposition>>;
184
+ }, z.core.$strip>>>;
185
+ sizeBytes: z.ZodOptional<z.ZodNumber>;
186
+ receivedAt: z.ZodCoercedDate<unknown>;
187
+ rawRef: z.ZodOptional<z.ZodString>;
188
+ }, z.core.$strip>;
189
+ attachmentContents: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
190
+ raw: z.ZodOptional<z.ZodString>;
191
+ }, z.core.$strip>;
192
+ export type StandardInboundEmail_PushedMessage = z.infer<typeof StandardInboundEmail_PushedMessageSchema>;
121
193
  /** The bytes of one attachment. */
122
194
  export interface StandardInboundEmail_OpenedAttachment {
123
195
  readonly bytes: Uint8Array;
@@ -204,8 +276,20 @@ export interface StandardInboundEmail_Interface {
204
276
  export type InboundEmailProviderRequest = {
205
277
  readonly path: string;
206
278
  readonly method?: EmailProviderHttpMethod;
279
+ readonly headers?: Readonly<Record<string, string>>;
280
+ /** A JSON body (Resend). At most one of `jsonBody` and `multipartFormFields`. */
207
281
  readonly jsonBody?: unknown;
282
+ readonly multipartFormFields?: never;
283
+ } | {
284
+ readonly path: string;
285
+ readonly method?: EmailProviderHttpMethod;
208
286
  readonly headers?: Readonly<Record<string, string>>;
287
+ /**
288
+ * Text fields sent as a `multipart/form-data` body (#3395), for an API documented to take one (Mailgun's domains
289
+ * API). The engine encodes it and sets the content type with its boundary.
290
+ */
291
+ readonly multipartFormFields: Readonly<Record<string, string>>;
292
+ readonly jsonBody?: never;
209
293
  } | {
210
294
  readonly url: string;
211
295
  readonly headers?: Readonly<Record<string, string>>;
@@ -217,6 +301,7 @@ export type InboundEmailProviderRequest = {
217
301
  export declare enum EmailProviderHttpMethod {
218
302
  GET = "GET",
219
303
  POST = "POST",
304
+ PUT = "PUT",
220
305
  PATCH = "PATCH",
221
306
  DELETE = "DELETE"
222
307
  }
@@ -1 +1 @@
1
- {"version":3,"file":"email-inbound.standard-interface.schemas.d.ts","sourceRoot":"","sources":["../../../../src/protocols/email-inbound.standard-interface.schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAiBxB;;;;;;;;;;;GAWG;AACH,oBAAY,0BAA0B;IACpC,IAAI,SAAS;IACb,IAAI,SAAS;IACb,QAAQ,aAAa;IACrB,OAAO,YAAY;IACnB,IAAI,SAAS;IACb,MAAM,WAAW;IACjB,SAAS,cAAc;IACvB,SAAS,cAAc;CACxB;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,yCAAyC;;;;;iBAKpD,CAAC;AAEH,MAAM,MAAM,mCAAmC,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yCAAyC,CAAC,CAAC;AAE5G,eAAO,MAAM,kCAAkC;;;iBAG7C,CAAC;AAEH,MAAM,MAAM,4BAA4B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kCAAkC,CAAC,CAAC;AAE9F,iIAAiI;AACjI,oBAAY,0BAA0B;IACpC,UAAU,eAAe;IACzB,MAAM,WAAW;CAClB;AAED,kHAAkH;AAClH,eAAO,MAAM,qCAAqC;;;;;;;iBAShD,CAAC;AAEH,MAAM,MAAM,+BAA+B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qCAAqC,CAAC,CAAC;AAEpG;;;GAGG;AACH,eAAO,MAAM,uCAAuC;;;;iBAMlD,CAAC;AAEH,MAAM,MAAM,iCAAiC,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uCAAuC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E,MAAM,CAAC;IACxB,kEAAkE;IAClE,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;CACxB"}
1
+ {"version":3,"file":"email-inbound.standard-interface.schemas.d.ts","sourceRoot":"","sources":["../../../src/protocols/email-inbound.standard-interface.schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAkBxB;;;;;;;;;;;GAWG;AACH,oBAAY,0BAA0B;IACpC,IAAI,SAAS;IACb,IAAI,SAAS;IACb,QAAQ,aAAa;IACrB,OAAO,YAAY;IACnB,IAAI,SAAS;IACb,MAAM,WAAW;IACjB,SAAS,cAAc;IACvB,SAAS,cAAc;CACxB;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,yCAAyC;;;;;iBAKpD,CAAC;AAEH,MAAM,MAAM,mCAAmC,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yCAAyC,CAAC,CAAC;AAE5G,eAAO,MAAM,kCAAkC;;;iBAG7C,CAAC;AAEH,MAAM,MAAM,4BAA4B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kCAAkC,CAAC,CAAC;AAE9F,iIAAiI;AACjI,oBAAY,0BAA0B;IACpC,UAAU,eAAe;IACzB,MAAM,WAAW;CAClB;AAED,kHAAkH;AAClH,eAAO,MAAM,qCAAqC;;;;;;;iBAShD,CAAC;AAEH,MAAM,MAAM,+BAA+B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qCAAqC,CAAC,CAAC;AAEpG;;;GAGG;AACH,eAAO,MAAM,uCAAuC;;;;;iBAclD,CAAC;AAEH,MAAM,MAAM,iCAAiC,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uCAAuC,CAAC,CAAC;AAExG;;;;;GAKG;AACH,eAAO,MAAM,kCAAkC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAwB7C,CAAC;AAEH,MAAM,MAAM,4BAA4B,GAAG,CAAC,CAAC,KAAK,CAAC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