@wildo-ai/external-connectors-models 1.1.9 → 1.1.11
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.
- package/dist/esm/core/commons.external-connectors-models.schemas.d.ts +130 -0
- package/dist/esm/core/commons.external-connectors-models.schemas.d.ts.map +1 -1
- package/dist/esm/core/commons.external-connectors-models.schemas.js +193 -0
- package/dist/esm/core/commons.external-connectors-models.schemas.js.map +1 -1
- package/dist/esm/core/security.external-connectors-models.schemas.d.ts +2 -0
- package/dist/esm/core/security.external-connectors-models.schemas.d.ts.map +1 -1
- package/dist/esm/core/security.external-connectors-models.schemas.js +10 -4
- package/dist/esm/core/security.external-connectors-models.schemas.js.map +1 -1
- package/dist/esm/index.d.ts +2 -0
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +2 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/protocols/agent-client-protocol.external-connectors-models.schemas.d.ts +1 -0
- package/dist/esm/protocols/agent-client-protocol.external-connectors-models.schemas.d.ts.map +1 -1
- package/dist/esm/protocols/agent-client-protocol.external-connectors-models.schemas.js +10 -1
- package/dist/esm/protocols/agent-client-protocol.external-connectors-models.schemas.js.map +1 -1
- package/dist/esm/protocols/billing.standard-interface.schemas.d.ts +8 -0
- package/dist/esm/protocols/billing.standard-interface.schemas.d.ts.map +1 -1
- package/dist/esm/protocols/billing.standard-interface.schemas.js +8 -0
- package/dist/esm/protocols/billing.standard-interface.schemas.js.map +1 -1
- package/dist/esm/protocols/content-safety.external-connectors-models.schemas.d.ts +150 -0
- package/dist/esm/protocols/content-safety.external-connectors-models.schemas.d.ts.map +1 -0
- package/dist/esm/protocols/content-safety.external-connectors-models.schemas.js +182 -0
- package/dist/esm/protocols/content-safety.external-connectors-models.schemas.js.map +1 -0
- package/dist/esm/protocols/document-extraction.external-connectors-models.schemas.d.ts +41 -9
- package/dist/esm/protocols/document-extraction.external-connectors-models.schemas.d.ts.map +1 -1
- package/dist/esm/protocols/document-extraction.external-connectors-models.schemas.js +40 -14
- package/dist/esm/protocols/document-extraction.external-connectors-models.schemas.js.map +1 -1
- package/dist/esm/protocols/email.standard-interface.schemas.d.ts.map +1 -1
- package/dist/esm/protocols/email.standard-interface.schemas.js +4 -0
- package/dist/esm/protocols/email.standard-interface.schemas.js.map +1 -1
- package/dist/esm/protocols/embeddings.external-connectors-models.schemas.d.ts +37 -4
- package/dist/esm/protocols/embeddings.external-connectors-models.schemas.d.ts.map +1 -1
- package/dist/esm/protocols/embeddings.external-connectors-models.schemas.js +57 -1
- package/dist/esm/protocols/embeddings.external-connectors-models.schemas.js.map +1 -1
- package/dist/esm/protocols/file-storage.standard-interface.d.ts +6 -0
- package/dist/esm/protocols/file-storage.standard-interface.d.ts.map +1 -1
- package/dist/esm/protocols/file-storage.standard-interface.js.map +1 -1
- package/dist/esm/protocols/hooks-capability.external-connectors-models.schemas.d.ts +7 -2
- package/dist/esm/protocols/hooks-capability.external-connectors-models.schemas.d.ts.map +1 -1
- package/dist/esm/protocols/hooks-capability.external-connectors-models.schemas.js.map +1 -1
- package/dist/esm/protocols/hooks.external-connectors-models.schemas.d.ts +388 -7
- package/dist/esm/protocols/hooks.external-connectors-models.schemas.d.ts.map +1 -1
- package/dist/esm/protocols/hooks.external-connectors-models.schemas.js +238 -0
- package/dist/esm/protocols/hooks.external-connectors-models.schemas.js.map +1 -1
- package/dist/esm/protocols/llm.external-connectors-models.schemas.d.ts +70 -5
- package/dist/esm/protocols/llm.external-connectors-models.schemas.d.ts.map +1 -1
- package/dist/esm/protocols/llm.external-connectors-models.schemas.js +96 -5
- package/dist/esm/protocols/llm.external-connectors-models.schemas.js.map +1 -1
- package/dist/esm/protocols/rest-operations.external-connectors-models.schemas.d.ts +446 -5
- package/dist/esm/protocols/rest-operations.external-connectors-models.schemas.d.ts.map +1 -1
- package/dist/esm/protocols/rest-operations.external-connectors-models.schemas.js +406 -0
- package/dist/esm/protocols/rest-operations.external-connectors-models.schemas.js.map +1 -1
- package/dist/esm/protocols/subject-erasure-effect.standard-interface.d.ts +133 -0
- package/dist/esm/protocols/subject-erasure-effect.standard-interface.d.ts.map +1 -0
- package/dist/esm/protocols/subject-erasure-effect.standard-interface.js +61 -0
- package/dist/esm/protocols/subject-erasure-effect.standard-interface.js.map +1 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +2 -2
|
@@ -63,9 +63,10 @@ export type DocumentExtraction_ModelCatalogEntry = {
|
|
|
63
63
|
applicabilities: readonly DocumentExtraction_Applicability[];
|
|
64
64
|
};
|
|
65
65
|
/**
|
|
66
|
-
*
|
|
67
|
-
* `EMBEDDINGS_MODEL_CATALOG` discipline: an EXHAUSTIVE `Record`, so a new
|
|
68
|
-
* `DocumentExtractionProvider_Model` member without a row is a compile error).
|
|
66
|
+
* The ENGINE providers' document-extraction model catalog — the per-model fact table for every model an engine
|
|
67
|
+
* provider serves (the `EMBEDDINGS_MODEL_CATALOG` discipline: an EXHAUSTIVE `Record`, so a new
|
|
68
|
+
* `DocumentExtractionProvider_Model` member without a row is a compile error). A provider installed from the module
|
|
69
|
+
* registry states the same facts on its own contract instead (`DocumentExtraction_ModelDeclaration`, #2021).
|
|
69
70
|
*/
|
|
70
71
|
export declare const DOCUMENT_EXTRACTION_MODEL_CATALOG: Record<DocumentExtractionProvider_Model, DocumentExtraction_ModelCatalogEntry>;
|
|
71
72
|
/**
|
|
@@ -79,29 +80,60 @@ export declare const DOCUMENT_EXTRACTION_MODEL_CATALOG: Record<DocumentExtractio
|
|
|
79
80
|
* nothing else.
|
|
80
81
|
*/
|
|
81
82
|
export declare const DOCUMENT_EXTRACTION_MODEL_APPLICABILITY_PREFERENCE: Record<DocumentExtraction_Applicability, readonly DocumentExtractionProvider_Model[]>;
|
|
83
|
+
/**
|
|
84
|
+
* A document-extraction model a provider DECLARES itself (#2021): what the engine's catalog holds for its own providers,
|
|
85
|
+
* for a provider the catalog does not know.
|
|
86
|
+
*
|
|
87
|
+
* The catalog above is closed over an engine enum, which is right for the engine's providers and makes an imported one
|
|
88
|
+
* impossible: a provider installed from the module registry is authored in the application's own package, and the engine
|
|
89
|
+
* cannot hold a row for a model it has never heard of. So such a provider states the same facts on its runtime contract
|
|
90
|
+
* (`models` on the DOCUMENT_EXTRACTION arm), and they are held to the same use: `supportedMimeTypes` is consulted before
|
|
91
|
+
* any byte leaves, and `applicabilities` is what an author's class resolves against.
|
|
92
|
+
*
|
|
93
|
+
* Import path: `@wildo-ai/external-connectors-models`.
|
|
94
|
+
*/
|
|
95
|
+
export type DocumentExtraction_ModelDeclaration = {
|
|
96
|
+
/** The vendor's model id, sent as the resolved model. */
|
|
97
|
+
model: string;
|
|
98
|
+
/** MIME types this model can process, as the vendor documents them. Lower-case. */
|
|
99
|
+
supportedMimeTypes: readonly string[];
|
|
100
|
+
/** Which applicability classes this model may be resolved for. */
|
|
101
|
+
applicabilities: readonly DocumentExtraction_Applicability[];
|
|
102
|
+
};
|
|
82
103
|
/** Why {@link resolveDocumentExtractionModelForApplicability} could not answer — carried into a named CONFIGURATION error. */
|
|
83
104
|
export declare enum DocumentExtraction_ModelResolutionFailure {
|
|
84
105
|
/** The applicability has no candidate at all for this provider. */
|
|
85
|
-
NO_CANDIDATE_FOR_PROVIDER = "no_candidate_for_provider"
|
|
106
|
+
NO_CANDIDATE_FOR_PROVIDER = "no_candidate_for_provider",
|
|
107
|
+
/**
|
|
108
|
+
* A provider the engine's catalog knows ALSO declares models. The catalog is the one place an engine provider's models
|
|
109
|
+
* live; a second, provider-side list could disagree with it about what may be sent, so it is refused rather than merged.
|
|
110
|
+
*/
|
|
111
|
+
CATALOG_PROVIDER_DECLARES_MODELS = "catalog_provider_declares_models"
|
|
86
112
|
}
|
|
87
113
|
export type DocumentExtraction_ModelResolution = {
|
|
88
114
|
resolved: true;
|
|
89
|
-
model:
|
|
90
|
-
|
|
115
|
+
model: string;
|
|
116
|
+
supportedMimeTypes: readonly string[];
|
|
91
117
|
} | {
|
|
92
118
|
resolved: false;
|
|
93
119
|
failure: DocumentExtraction_ModelResolutionFailure;
|
|
94
|
-
consideredModels: readonly
|
|
120
|
+
consideredModels: readonly string[];
|
|
95
121
|
};
|
|
96
122
|
/**
|
|
97
123
|
* Resolve an applicability class to ONE concrete extraction model for a given provider.
|
|
98
124
|
*
|
|
99
|
-
*
|
|
100
|
-
*
|
|
125
|
+
* A provider the engine's catalog knows resolves from the catalog and its preference order, and may not also declare
|
|
126
|
+
* models. Any other provider (one installed from the module registry, #2021) resolves from the models it declares, in
|
|
127
|
+
* the order it declares them.
|
|
128
|
+
*
|
|
129
|
+
* Fails CLOSED and explains itself (the `resolveModelForApplicability` contract): a silent fallback to some other model
|
|
130
|
+
* would send application documents to a model nobody chose.
|
|
101
131
|
*/
|
|
102
132
|
export declare const resolveDocumentExtractionModelForApplicability: (input: {
|
|
103
133
|
applicability: DocumentExtraction_Applicability;
|
|
104
134
|
providerRef: string;
|
|
135
|
+
/** The `models` the provider's runtime contract declares. Absent or empty for an engine provider. */
|
|
136
|
+
declaredModels?: readonly DocumentExtraction_ModelDeclaration[];
|
|
105
137
|
}, catalog?: Record<DocumentExtractionProvider_Model, DocumentExtraction_ModelCatalogEntry>) => DocumentExtraction_ModelResolution;
|
|
106
138
|
/**
|
|
107
139
|
* Usage of one extraction call.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"document-extraction.external-connectors-models.schemas.d.ts","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,EACrC,MAAM,oDAAoD,CAAA;AAmC7D;;;;GAIG;AACH,oBAAY,gCAAgC;IAC1C;;;;;;OAMG;IACH,kBAAkB,uBAAuB;CAC1C;AAED;;;;;;;GAOG;AACH,oBAAY,uCAAuC;IACjD,qDAAqD;IACrD,qBAAqB,2CAA2C;CACjE;AAED;;;;;;;;;;;GAWG;AACH,oBAAY,gCAAgC;IAC1C,+FAA+F;IAC/F,qBAAqB,0BAA0B;CAChD;AACD,uFAAuF;AAEvF;;;GAGG;AACH,MAAM,MAAM,oCAAoC,GAAG;IACjD,4DAA4D;IAC5D,WAAW,EAAE,MAAM,CAAC;IACpB;;;;;;OAMG;IACH,kBAAkB,EAAE,SAAS,MAAM,EAAE,CAAC;IACtC,sFAAsF;IACtF,eAAe,EAAE,SAAS,gCAAgC,EAAE,CAAC;CAC9D,CAAC;AAEF
|
|
1
|
+
{"version":3,"file":"document-extraction.external-connectors-models.schemas.d.ts","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,EACrC,MAAM,oDAAoD,CAAA;AAmC7D;;;;GAIG;AACH,oBAAY,gCAAgC;IAC1C;;;;;;OAMG;IACH,kBAAkB,uBAAuB;CAC1C;AAED;;;;;;;GAOG;AACH,oBAAY,uCAAuC;IACjD,qDAAqD;IACrD,qBAAqB,2CAA2C;CACjE;AAED;;;;;;;;;;;GAWG;AACH,oBAAY,gCAAgC;IAC1C,+FAA+F;IAC/F,qBAAqB,0BAA0B;CAChD;AACD,uFAAuF;AAEvF;;;GAGG;AACH,MAAM,MAAM,oCAAoC,GAAG;IACjD,4DAA4D;IAC5D,WAAW,EAAE,MAAM,CAAC;IACpB;;;;;;OAMG;IACH,kBAAkB,EAAE,SAAS,MAAM,EAAE,CAAC;IACtC,sFAAsF;IACtF,eAAe,EAAE,SAAS,gCAAgC,EAAE,CAAC;CAC9D,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,iCAAiC,EAAE,MAAM,CACpD,gCAAgC,EAChC,oCAAoC,CAmBrC,CAAC;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,kDAAkD,EAAE,MAAM,CACrE,gCAAgC,EAChC,SAAS,gCAAgC,EAAE,CAK5C,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AE,2BAA2B,CAAC,OAAO,CAAA;CAAE,GAC9C;IAAE,KAAK,EAAE,2BAA2B,CAAC,QAAQ,CAAC;IAAC,UAAU,EAAE,qCAAqC,CAAA;CAAE,CAAC;AAEvG;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,oCAAoC,GAAI,QAAQ,MAAM,KAAG,+BAOrE,CAAC"}
|
|
@@ -79,9 +79,10 @@ export var DocumentExtraction_Applicability;
|
|
|
79
79
|
DocumentExtraction_Applicability["DOCUMENT_TEXT_DEFAULT"] = "document-text-default";
|
|
80
80
|
})(DocumentExtraction_Applicability || (DocumentExtraction_Applicability = {}));
|
|
81
81
|
/**
|
|
82
|
-
*
|
|
83
|
-
* `EMBEDDINGS_MODEL_CATALOG` discipline: an EXHAUSTIVE `Record`, so a new
|
|
84
|
-
* `DocumentExtractionProvider_Model` member without a row is a compile error).
|
|
82
|
+
* The ENGINE providers' document-extraction model catalog — the per-model fact table for every model an engine
|
|
83
|
+
* provider serves (the `EMBEDDINGS_MODEL_CATALOG` discipline: an EXHAUSTIVE `Record`, so a new
|
|
84
|
+
* `DocumentExtractionProvider_Model` member without a row is a compile error). A provider installed from the module
|
|
85
|
+
* registry states the same facts on its own contract instead (`DocumentExtraction_ModelDeclaration`, #2021).
|
|
85
86
|
*/
|
|
86
87
|
export const DOCUMENT_EXTRACTION_MODEL_CATALOG = {
|
|
87
88
|
[DocumentExtractionProvider_Model.MISTRAL_OCR_LATEST]: {
|
|
@@ -122,28 +123,53 @@ export var DocumentExtraction_ModelResolutionFailure;
|
|
|
122
123
|
(function (DocumentExtraction_ModelResolutionFailure) {
|
|
123
124
|
/** The applicability has no candidate at all for this provider. */
|
|
124
125
|
DocumentExtraction_ModelResolutionFailure["NO_CANDIDATE_FOR_PROVIDER"] = "no_candidate_for_provider";
|
|
126
|
+
/**
|
|
127
|
+
* A provider the engine's catalog knows ALSO declares models. The catalog is the one place an engine provider's models
|
|
128
|
+
* live; a second, provider-side list could disagree with it about what may be sent, so it is refused rather than merged.
|
|
129
|
+
*/
|
|
130
|
+
DocumentExtraction_ModelResolutionFailure["CATALOG_PROVIDER_DECLARES_MODELS"] = "catalog_provider_declares_models";
|
|
125
131
|
})(DocumentExtraction_ModelResolutionFailure || (DocumentExtraction_ModelResolutionFailure = {}));
|
|
126
132
|
/**
|
|
127
133
|
* Resolve an applicability class to ONE concrete extraction model for a given provider.
|
|
128
134
|
*
|
|
129
|
-
*
|
|
130
|
-
*
|
|
135
|
+
* A provider the engine's catalog knows resolves from the catalog and its preference order, and may not also declare
|
|
136
|
+
* models. Any other provider (one installed from the module registry, #2021) resolves from the models it declares, in
|
|
137
|
+
* the order it declares them.
|
|
138
|
+
*
|
|
139
|
+
* Fails CLOSED and explains itself (the `resolveModelForApplicability` contract): a silent fallback to some other model
|
|
140
|
+
* would send application documents to a model nobody chose.
|
|
131
141
|
*/
|
|
132
142
|
export const resolveDocumentExtractionModelForApplicability = (input, catalog = DOCUMENT_EXTRACTION_MODEL_CATALOG) => {
|
|
133
|
-
const
|
|
134
|
-
const
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
143
|
+
const declaredModels = input.declaredModels ?? [];
|
|
144
|
+
const catalogKnowsProvider = Object.values(catalog).some((entry) => entry.providerRef === input.providerRef);
|
|
145
|
+
if (catalogKnowsProvider) {
|
|
146
|
+
const candidates = DOCUMENT_EXTRACTION_MODEL_APPLICABILITY_PREFERENCE[input.applicability];
|
|
147
|
+
if (declaredModels.length > 0) {
|
|
148
|
+
return {
|
|
149
|
+
resolved: false,
|
|
150
|
+
failure: DocumentExtraction_ModelResolutionFailure.CATALOG_PROVIDER_DECLARES_MODELS,
|
|
151
|
+
consideredModels: declaredModels.map((declaration) => declaration.model),
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
const forProvider = candidates.filter((model) => {
|
|
155
|
+
const entry = catalog[model];
|
|
156
|
+
return entry.providerRef === input.providerRef && entry.applicabilities.includes(input.applicability);
|
|
157
|
+
});
|
|
158
|
+
if (forProvider.length === 0) {
|
|
159
|
+
return { resolved: false, failure: DocumentExtraction_ModelResolutionFailure.NO_CANDIDATE_FOR_PROVIDER, consideredModels: candidates };
|
|
160
|
+
}
|
|
161
|
+
const model = forProvider[0];
|
|
162
|
+
return { resolved: true, model, supportedMimeTypes: catalog[model].supportedMimeTypes };
|
|
163
|
+
}
|
|
164
|
+
const declared = declaredModels.find((declaration) => declaration.applicabilities.includes(input.applicability));
|
|
165
|
+
if (declared === undefined) {
|
|
139
166
|
return {
|
|
140
167
|
resolved: false,
|
|
141
168
|
failure: DocumentExtraction_ModelResolutionFailure.NO_CANDIDATE_FOR_PROVIDER,
|
|
142
|
-
consideredModels:
|
|
169
|
+
consideredModels: declaredModels.map((declaration) => declaration.model),
|
|
143
170
|
};
|
|
144
171
|
}
|
|
145
|
-
|
|
146
|
-
return { resolved: true, model, entry: catalog[model] };
|
|
172
|
+
return { resolved: true, model: declared.model, supportedMimeTypes: declared.supportedMimeTypes };
|
|
147
173
|
};
|
|
148
174
|
// ===============================================================
|
|
149
175
|
// Document Extraction Operations Context
|
|
@@ -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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GX;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 document-extraction model catalog — the single per-model fact table (the\n * `EMBEDDINGS_MODEL_CATALOG` discipline: an EXHAUSTIVE `Record`, so a new\n * `DocumentExtractionProvider_Model` member without a row is a compile error).\n */\nexport const DOCUMENT_EXTRACTION_MODEL_CATALOG: Record<\n DocumentExtractionProvider_Model,\n DocumentExtraction_ModelCatalogEntry\n> = {\n [DocumentExtractionProvider_Model.MISTRAL_OCR_LATEST]: {\n providerRef: \"mistral\",\n /**\n * Mistral's published OCR format list (docs.mistral.ai \"Known limitations\": \"Supported\n * formats for OCR: PDF, PNG, JPG, JPEG, TIFF, BMP, GIF, WEBP\"), narrowed to the MIME types\n * the engine's own extraction gate admits today.\n *\n * `application/pdf` is the only entry that is currently REACHABLE: image MIME types are\n * refused by `FileTextExtractionBackendService.isExtractionSupported`, which is a separate,\n * deliberate decision (an uploaded photo is not a document). The image types are declared\n * here anyway because this row states what the MODEL can do, not what the engine currently\n * asks it to do — and admitting images to extraction later must be an engine decision, not\n * an accidental consequence of a catalog edit.\n */\n supportedMimeTypes: [\"application/pdf\", \"image/png\", \"image/jpeg\", \"image/tiff\", \"image/webp\"],\n applicabilities: [DocumentExtraction_Applicability.DOCUMENT_TEXT_DEFAULT],\n },\n};\n\n/**\n * The framework's DEFAULT answer to \"which extraction model serves this class\", ordered by\n * preference, highest first.\n *\n * Unlike the embeddings preference — which is a MIGRATION KEY, because editing it re-binds a\n * class and forces every stamped chunk to be re-embedded — this one carries no durable\n * consequence: extraction output is re-derived on the next ingestion pass and nothing persists\n * the model that produced it. Editing this list changes what the next extraction uses and\n * nothing else.\n */\nexport const DOCUMENT_EXTRACTION_MODEL_APPLICABILITY_PREFERENCE: Record<\n DocumentExtraction_Applicability,\n readonly DocumentExtractionProvider_Model[]\n> = {\n [DocumentExtraction_Applicability.DOCUMENT_TEXT_DEFAULT]: [\n DocumentExtractionProvider_Model.MISTRAL_OCR_LATEST,\n ],\n};\n\n/** Why {@link resolveDocumentExtractionModelForApplicability} could not answer — carried into a named CONFIGURATION error. */\nexport enum DocumentExtraction_ModelResolutionFailure {\n /** The applicability has no candidate at all for this provider. */\n NO_CANDIDATE_FOR_PROVIDER = \"no_candidate_for_provider\",\n}\n\nexport type DocumentExtraction_ModelResolution =\n | { resolved: true; model: DocumentExtractionProvider_Model; entry: DocumentExtraction_ModelCatalogEntry }\n | {\n resolved: false;\n failure: DocumentExtraction_ModelResolutionFailure;\n consideredModels: readonly DocumentExtractionProvider_Model[];\n };\n\n/**\n * Resolve an applicability class to ONE concrete extraction model for a given provider.\n *\n * Fails CLOSED and explains itself (the `resolveModelForApplicability` contract): a silent\n * fallback to some other model would send application documents to a model nobody chose.\n */\nexport const resolveDocumentExtractionModelForApplicability = (\n input: { applicability: DocumentExtraction_Applicability; providerRef: string },\n catalog: Record<DocumentExtractionProvider_Model, DocumentExtraction_ModelCatalogEntry> = DOCUMENT_EXTRACTION_MODEL_CATALOG,\n): DocumentExtraction_ModelResolution => {\n const candidates = DOCUMENT_EXTRACTION_MODEL_APPLICABILITY_PREFERENCE[input.applicability];\n const forProvider = candidates.filter((model) => {\n const entry = catalog[model];\n return entry.providerRef === input.providerRef && entry.applicabilities.includes(input.applicability);\n });\n if (forProvider.length === 0) {\n return {\n resolved: false,\n failure: DocumentExtraction_ModelResolutionFailure.NO_CANDIDATE_FOR_PROVIDER,\n consideredModels: candidates,\n };\n }\n const model = forProvider[0]!;\n return { resolved: true, model, entry: catalog[model] };\n};\n\n// ===============================================================\n// Document Extraction Operations Context\n// ===============================================================\n\n/**\n * Usage of one extraction call.\n *\n * There is NO token dimension, and its absence is structural rather than an omission: an OCR\n * call is billed and reported per PAGE, not per token. Any consumer judging usage completeness\n * for an extraction must do so on `pagesProcessed` alone — the operation-aware discipline the\n * embeddings arm records for its own missing completion-token dimension.\n */\nexport const DocumentExtractionProvider_UsageSchema = z.object({\n /**\n * Pages the provider reports having processed.\n *\n * The FRAMEWORK's name for the dimension. Which vendor field it is projected from is the\n * provider's `parseExtractResponse` to know — the wired one reads Mistral's\n * `usage_info.pages_processed`, and a second provider will read something else.\n */\n pagesProcessed: z.number().optional(),\n /** Document size the provider reports having received. Same ownership as `pagesProcessed`. */\n documentSizeBytes: z.number().optional(),\n});\nexport type DocumentExtractionProvider_Usage = z.infer<typeof DocumentExtractionProvider_UsageSchema>;\n\nexport const DocumentExtractionProvider_ExecutionTransportMetadataSchema = z.object({\n protocolKind: z.literal(ExternalProvider_ExchangeProtocol_Kind.DOCUMENT_EXTRACTION_PROVIDER),\n providerRef: z.string(),\n model: z.string().optional(),\n});\nexport type DocumentExtractionProvider_ExecutionTransportMetadata = z.infer<\n typeof DocumentExtractionProvider_ExecutionTransportMetadataSchema\n>;\n\n// ===============================================================\n// Document Extraction I/O Schemas\n// ===============================================================\n\n/**\n * Input DESCRIPTOR of the {@link DocumentExtractionProvider_OperationKey.EXTRACT_DOCUMENT_TEXT}\n * operation — the metadata about the document, deliberately NOT the document.\n *\n * ⚠️ THE BYTES ARE ABSENT ON PURPOSE, and this is the design decision most likely to be\n * \"corrected\" by a later reader. A `documentBase64: z.string()` field here would be structurally\n * correct and operationally dangerous: a Zod-shaped input object is the thing every diagnostic\n * path in this codebase reaches for when something goes wrong — error `context`, debug logs,\n * agent-call traces — and a multi-megabyte base64 blob of an application's private contract is\n * the single worst payload to make casually loggable. The embeddings arm reached the same\n * conclusion from the other direction (its header forbids raw texts and vectors from ever\n * entering a trace); here the prohibition is enforced by the SHAPE rather than by discipline.\n *\n * The bytes travel as a `Buffer` on the execution service's own request type, which no\n * serializer walks.\n */\nexport const DocumentExtractionProvider_ExtractDocumentTextInputSchema = z.object({\n /** The document's MIME type — checked against the model's catalog row before any egress. */\n mimeType: z.string(),\n /** Byte length of the document being sent. Diagnostic and ceiling-checking only. */\n documentByteLength: z.number().int().nonnegative(),\n});\nexport type DocumentExtractionProvider_ExtractDocumentTextInput = z.infer<\n typeof DocumentExtractionProvider_ExtractDocumentTextInputSchema\n>;\n\n/**\n * Output of {@link DocumentExtractionProvider_OperationKey.EXTRACT_DOCUMENT_TEXT}.\n *\n * `text` is the concatenation of the provider's per-page output in document order. Providers in\n * this family return MARKDOWN per page (Mistral's `pages[].markdown`), which is kept as-is:\n * headings and table structure are signal for a retrieval corpus, and stripping them to \"plain\"\n * text would discard information the provider was paid to recover.\n */\nexport const DocumentExtractionProvider_ExtractDocumentTextOutputSchema = z.object({\n text: z.string(),\n /** Pages the provider actually returned — the authoritative count, not the request's estimate. */\n pageCount: z.number().int().nonnegative(),\n /** The concrete model that produced the text. */\n model: z.string(),\n usage: DocumentExtractionProvider_UsageSchema,\n});\nexport type DocumentExtractionProvider_ExtractDocumentTextOutput = z.infer<\n typeof DocumentExtractionProvider_ExtractDocumentTextOutputSchema\n>;\n\n// ===============================================================\n// The PROVIDER-OWNED WIRE SEAM\n// --------\n// Until 2026-09-09 this arm declared `baseUrl`, `endpointPath`, `apiKey` and `models` — where the\n// call goes and how it authenticates — and NOTHING about the body or the response. So the engine's\n// execution seam composed Mistral's `/v1/ocr` request (`document: { type: 'document_url',\n// document_url }`, `include_image_base64`) and read Mistral's response (`pages[].markdown`,\n// `usage_info.pages_processed`) with the vendor named nowhere, and a second provider declaring\n// DOCUMENT_EXTRACTION_PROVIDER would have been sent through Mistral's API carrying its own key.\n//\n// The remedy is the one the EMAIL and SMS arms already converged on: the provider declares PURE\n// FUNCTIONS and the engine owns transport and credentials. The types those functions are written\n// against live HERE rather than beside the contract, because the failure vocabulary is read by\n// BOTH sides — the provider produces it, the engine's caller branches on it — and a vocabulary\n// with two homes is a vocabulary that drifts.\n// ===============================================================\n\n/**\n * WHY an extraction failed, in the only two senses a caller can act on differently.\n *\n * This is the arm's most load-bearing output after the text itself, and the consequence of\n * confusing the two is CORPUS DELETION rather than a misleading log line:\n * `RagIngestionBackendService` deletes a field's entire chunk set when an ingestion pass yields no\n * text, so reporting a provider OUTAGE as an unreadable document silently destroys a live,\n * already-embedded corpus and reports success.\n *\n * It lived in `saas-backend-lib`'s execution seam until 2026-09-09, which is exactly why the wire\n * shape lived there too: a vocabulary a provider cannot reach is one a provider cannot answer in,\n * so classification had to be done by whoever could. Moving it here is what makes\n * {@link DocumentExtraction_ProviderExtraction} expressible at all.\n */\nexport enum DocumentExtraction_FailureClass {\n /**\n * The provider read the request and judged the DOCUMENT unprocessable — corrupt bytes, an\n * unsupported format, a password-protected file. PERMANENT: re-sending the same bytes cannot\n * succeed, so a sweep may safely stop retrying and skip the document.\n */\n UNREADABLE_DOCUMENT = \"unreadable_document\",\n /**\n * The provider could not be reached, refused the credential, throttled, or failed internally —\n * a network error, a 401/403, a 429, any 5xx, or a timeout. TRANSIENT and, decisively, says\n * NOTHING about the document. A caller must not conclude anything about the bytes from this.\n */\n PROVIDER_UNAVAILABLE = \"provider_unavailable\",\n}\n\n/**\n * What a provider's `parseExtractResponse` returns, 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,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,EATW,gCAAgC,KAAhC,gCAAgC,QAS3C;AAED;;;;;;;GAOG;AACH,MAAM,CAAN,IAAY,uCAGX;AAHD,WAAY,uCAAuC;IACjD,qDAAqD;IACrD,2GAAgE,CAAA;AAClE,CAAC,EAHW,uCAAuC,KAAvC,uCAAuC,QAGlD;AAED;;;;;;;;;;;GAWG;AACH,MAAM,CAAN,IAAY,gCAGX;AAHD,WAAY,gCAAgC;IAC1C,+FAA+F;IAC/F,mFAA+C,CAAA;A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AAmB,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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"email.standard-interface.schemas.d.ts","sourceRoot":"","sources":["../../../../src/protocols/email.standard-interface.schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,wBAAwB,EAA2B,4BAA4B,EAAE,MAAM,4CAA4C,CAAC;AAmB7I,eAAO,MAAM,2BAA2B;;;iBAGtC,CAAC;AAEH,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAMhF,eAAO,MAAM,8BAA8B;;;;;iBAKzC,CAAC;AAEH,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,8BAA8B,CAAC,CAAC;AAEtF;;;;;;GAMG;AACH,oBAAY,4BAA4B;IACtC,IAAI,SAAS;IACb,mBAAmB,wBAAwB;CAC5C;AAED,8EAA8E;AAC9E,oBAAY,6BAA6B;IACvC,MAAM,WAAW;IACjB,IAAI,SAAS;IACb,SAAS,cAAc;CACxB;AAED,kFAAkF;AAClF,oBAAY,qCAAqC;IAC/C,QAAQ,aAAa;IACrB,QAAQ,aAAa;IACrB,kBAAkB,uBAAuB;CAC1C;AAMD,eAAO,MAAM,+BAA+B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA0C3C,CAAC;AAEF,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,+BAA+B,CAAC,CAAC;AAMxF,eAAO,MAAM,gCAAgC;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"email.standard-interface.schemas.d.ts","sourceRoot":"","sources":["../../../../src/protocols/email.standard-interface.schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,wBAAwB,EAA2B,4BAA4B,EAAE,MAAM,4CAA4C,CAAC;AAmB7I,eAAO,MAAM,2BAA2B;;;iBAGtC,CAAC;AAEH,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAMhF,eAAO,MAAM,8BAA8B;;;;;iBAKzC,CAAC;AAEH,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,8BAA8B,CAAC,CAAC;AAEtF;;;;;;GAMG;AACH,oBAAY,4BAA4B;IACtC,IAAI,SAAS;IACb,mBAAmB,wBAAwB;CAC5C;AAED,8EAA8E;AAC9E,oBAAY,6BAA6B;IACvC,MAAM,WAAW;IACjB,IAAI,SAAS;IACb,SAAS,cA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-115,6 +115,10 @@ export const StandardEmail_SendResponseSchema = z.object({
|
|
|
115
115
|
/**
|
|
116
116
|
* Provider-declared detail explaining its explicit classification, including
|
|
117
117
|
* semantic rejection or an ambiguous idempotency/processing conflict.
|
|
118
|
+
*
|
|
119
|
+
* CONTENT-FREE: the vendor's own code or error name, never the vendor's message, which routinely quotes the refused
|
|
120
|
+
* address or the payload. The engine logs this text and returns it in batch results, and a log outlives an erasure
|
|
121
|
+
* (#2251).
|
|
118
122
|
*/
|
|
119
123
|
providerError: z.string().min(1).optional(),
|
|
120
124
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"email.standard-interface.schemas.js","sourceRoot":"","sources":["../../../../src/protocols/email.standard-interface.schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,wBAAwB,EAA2B,4BAA4B,EAAE,MAAM,4CAA4C,CAAC;AAE7I,iEAAiE;AACjE,2BAA2B;AAC3B,WAAW;AACX,qEAAqE;AACrE,gEAAgE;AAChE,+BAA+B;AAC/B,EAAE;AACF,qBAAqB;AACrB,uDAAuD;AACvD,gEAAgE;AAChE,yEAAyE;AACzE,iEAAiE;AAEjE,kEAAkE;AAClE,yBAAyB;AACzB,kEAAkE;AAElE,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,CAAC,MAAM,CAAC;IAClD,KAAK,EAAE,CAAC,CAAC,KAAK,EAAE;IAChB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAC5B,CAAC,CAAC;AAIH,kEAAkE;AAClE,sBAAsB;AACtB,kEAAkE;AAElE,MAAM,CAAC,MAAM,8BAA8B,GAAG,CAAC,CAAC,MAAM,CAAC;IACrD,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC3B,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,iBAAiB;I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_EmailType, EmailProvider_DeliveryStatus } from \"./email.external-connectors-models.schemas\";\n\n//===============================================================\n// Standard Email Interface\n// --------\n// This is the canonical interface that Wildo uses internally to send\n// emails. The ETL layer transforms these standard requests into\n// provider-specific API calls.\n//\n// Design Principles:\n// 1. Provider-agnostic - works with any email provider\n// 2. Capability-aware - validates against provider capabilities\n// 3. Extensible - new fields can be added without breaking existing code\n//===============================================================\n\n// ===============================================================\n// Standard Email Address\n// ===============================================================\n\nexport const StandardEmail_AddressSchema = z.object({\n email: z.email(),\n name: z.string().optional(),\n});\n\nexport type StandardEmail_Address = z.infer<typeof StandardEmail_AddressSchema>;\n\n// ===============================================================\n// Standard Attachment\n// ===============================================================\n\nexport const StandardEmail_AttachmentSchema = z.object({\n filename: z.string().min(1),\n content: z.string(), // Base64 encoded\n contentType: z.string().optional(),\n contentId: z.string().optional(), // For inline images (cid:)\n});\n\nexport type StandardEmail_Attachment = z.infer<typeof StandardEmail_AttachmentSchema>;\n\n/**\n * Wire encoding used by a network email provider gateway.\n *\n * This vocabulary is deliberately closed and explicit on every provider\n * contract: JSON and multipart data require materially different headers and\n * serialization. There is no implicit default.\n */\nexport enum EmailProviderPayloadEncoding {\n JSON = \"json\",\n MULTIPART_FORM_DATA = \"multipart-form-data\",\n}\n\n/** Provider acknowledgement state returned by a synchronous send endpoint. */\nexport enum EmailProviderSubmissionStatus {\n QUEUED = \"queued\",\n SENT = \"sent\",\n SCHEDULED = \"scheduled\",\n}\n\n/** Provider-owned classification for HTTP responses whose status is ambiguous. */\nexport enum EmailProviderSubmissionClassification {\n ACCEPTED = \"accepted\",\n REJECTED = \"rejected\",\n ACCEPTANCE_UNKNOWN = \"acceptance_unknown\",\n}\n\n// ===============================================================\n// TRANSACTIONAL: Send Email Request\n// ===============================================================\n\nexport const StandardEmail_SendRequestSchema = z.object({\n /**\n * Stable identity of ONE logical provider submission across retries.\n *\n * Deliberately not named `idempotencyKey`: it remains the framework's\n * correlation identity even when the selected provider cannot enforce\n * idempotency. Provider gateways may map it to a native idempotency field as\n * an optional duplicate-risk reduction.\n */\n submissionId: z.string().min(1).max(256),\n\n // Recipients (required)\n to: z.array(StandardEmail_AddressSchema).min(1),\n cc: z.array(StandardEmail_AddressSchema).optional(),\n bcc: z.array(StandardEmail_AddressSchema).optional(),\n \n // Sender (required unless provider config has default)\n from: StandardEmail_AddressSchema.optional(),\n replyTo: StandardEmail_AddressSchema.optional(),\n \n // Content (html OR text required)\n subject: z.string().min(1),\n html: z.string().optional(),\n text: z.string().optional(),\n \n // Optional features\n attachments: z.array(StandardEmail_AttachmentSchema).optional(),\n headers: z.record(z.string(), z.string()).optional(),\n tags: z.array(z.string()).optional(),\n \n // Scheduling (optional - requires SUPPORTS_SCHEDULING)\n scheduledAt: z.iso.datetime().optional(),\n \n // Tracking (optional, uses provider default if not set)\n trackOpens: z.boolean().optional(),\n trackClicks: z.boolean().optional(),\n \n // Metadata for correlation/tracking\n metadata: z.record(z.string(), z.string()).optional(),\n}).refine(\n (data) => data.html !== undefined || data.text !== undefined,\n { message: \"Either html or text content is required\" }\n);\n\nexport type StandardEmail_SendRequest = z.infer<typeof StandardEmail_SendRequestSchema>;\n\n// ===============================================================\n// TRANSACTIONAL: Send Email Response\n// ===============================================================\n\nexport const StandardEmail_SendResponseSchema = z.object({\n success: z.boolean(),\n /**\n * Mandatory provider-owned submission meaning. HTTP status, receipt shape,\n * and recipient-level `success` are not interchangeable across providers.\n */\n classification: z.enum(EmailProviderSubmissionClassification),\n /**\n * Provider-assigned receipts. An array is required because Brevo and\n * Mailchimp may acknowledge several recipient messages in one response.\n * Empty is honest for a successful non-delivery preview or a provider that\n * accepted the request without returning a receipt.\n */\n providerMessageIds: z.array(z.string().min(1)),\n /** Per-recipient rejections returned inside an otherwise successful HTTP response. */\n rejectedRecipients: z.array(z.object({\n email: z.string().min(1),\n reason: z.string().optional(),\n })).optional(),\n /**\n * Provider-declared detail explaining its explicit classification, including\n * semantic rejection or an ambiguous idempotency/processing conflict.\n */\n providerError: z.string().min(1).optional(),\n /**\n * Whether the caller should retry this response under at-least-once\n * semantics. For an acceptance-unknown response, a retry may duplicate a\n * message unless the selected provider happens to enforce the submission id.\n */\n retryable: z.boolean().optional(),\n /** Provider reports that this submission identity was already suppressed. */\n deduplicated: z.boolean().optional(),\n status: z.enum(EmailProviderSubmissionStatus).optional(),\n scheduledAt: z.iso.datetime().optional(),\n}).superRefine((response, context) => {\n const accepted =\n response.classification\n === EmailProviderSubmissionClassification.ACCEPTED;\n\n /**\n * `success` describes whole-request success, whereas `classification`\n * describes whether any provider submission was accepted. Once a provider\n * adapter classifies a submission as accepted, auxiliary result metadata\n * must never turn that acknowledgement into permission to replay. A false\n * `success` may describe an honest partial result (for example Mailchimp)\n * or anomalous adapter metadata; `rejectedRecipients` is therefore useful\n * evidence, but not a prerequisite for preserving acceptance.\n */\n if (response.success && !accepted) {\n context.addIssue({\n code: 'custom',\n path: ['success'],\n message:\n 'A successful email response must be classified as accepted',\n });\n }\n if (response.success && (response.rejectedRecipients?.length ?? 0) > 0) {\n context.addIssue({\n code: 'custom',\n path: ['rejectedRecipients'],\n message:\n 'A successful email response cannot contain rejected recipients',\n });\n }\n if (!accepted && response.providerMessageIds.length > 0) {\n context.addIssue({\n code: 'custom',\n path: ['providerMessageIds'],\n message:\n 'A non-accepted email response cannot contain provider acceptance receipts',\n });\n }\n for (const [index, providerMessageId] of response.providerMessageIds.entries()) {\n if (response.providerMessageIds.indexOf(providerMessageId) !== index) {\n context.addIssue({\n code: 'custom',\n path: ['providerMessageIds', index],\n message: 'Provider message receipts must be unique',\n });\n }\n }\n\n for (const acceptedOnlyField of [\n 'deduplicated',\n 'status',\n 'scheduledAt',\n ] as const) {\n if (!accepted && response[acceptedOnlyField] !== undefined) {\n context.addIssue({\n code: 'custom',\n path: [acceptedOnlyField],\n message:\n `${acceptedOnlyField} is valid only for an accepted email response`,\n });\n }\n }\n if (\n response.scheduledAt !== undefined\n && response.status !== EmailProviderSubmissionStatus.SCHEDULED\n ) {\n context.addIssue({\n code: 'custom',\n path: ['scheduledAt'],\n message:\n 'A scheduledAt receipt requires provider status scheduled',\n });\n }\n if (accepted && response.retryable === true) {\n context.addIssue({\n code: 'custom',\n path: ['retryable'],\n message: 'An accepted email response cannot request replay',\n });\n }\n});\n\nexport type StandardEmail_SendResponse = z.infer<typeof StandardEmail_SendResponseSchema>;\n\n// ===============================================================\n// TRANSACTIONAL: Send Template Request\n// ===============================================================\n\nexport const StandardEmail_SendTemplateRequestSchema = z.object({\n // Recipients\n to: z.array(StandardEmail_AddressSchema).min(1),\n cc: z.array(StandardEmail_AddressSchema).optional(),\n bcc: z.array(StandardEmail_AddressSchema).optional(),\n \n // Sender\n from: StandardEmail_AddressSchema.optional(),\n replyTo: StandardEmail_AddressSchema.optional(),\n \n // Template (requires SUPPORTS_TEMPLATES)\n templateId: z.string().min(1),\n templateAlias: z.string().optional(), // Alternative identifier (Postmark)\n variables: z.record(z.string(), z.unknown()).optional(),\n \n // Optional overrides\n subject: z.string().optional(), // Override template subject\n \n // Optional features\n attachments: z.array(StandardEmail_AttachmentSchema).optional(),\n tags: z.array(z.string()).optional(),\n scheduledAt: z.iso.datetime().optional(),\n \n // Metadata\n metadata: z.record(z.string(), z.string()).optional(),\n});\n\nexport type StandardEmail_SendTemplateRequest = z.infer<typeof StandardEmail_SendTemplateRequestSchema>;\n\n// ===============================================================\n// TRANSACTIONAL: Batch Send Request\n// ===============================================================\n\nexport const StandardEmail_BatchRecipientSchema = z.object({\n to: StandardEmail_AddressSchema,\n cc: z.array(StandardEmail_AddressSchema).optional(),\n bcc: z.array(StandardEmail_AddressSchema).optional(),\n variables: z.record(z.string(), z.unknown()).optional(),\n subject: z.string().optional(), // Per-recipient subject override\n metadata: z.record(z.string(), z.string()).optional(),\n});\n\nexport type StandardEmail_BatchRecipient = z.infer<typeof StandardEmail_BatchRecipientSchema>;\n\nexport const StandardEmail_BatchRequestSchema = z.object({\n // Sender (shared)\n from: StandardEmail_AddressSchema.optional(),\n replyTo: StandardEmail_AddressSchema.optional(),\n \n // Content (shared - either direct or template)\n subject: z.string().optional(), // Default subject\n html: z.string().optional(),\n text: z.string().optional(),\n templateId: z.string().optional(),\n \n // Recipients with personalizations (requires SUPPORTS_BATCH_SENDING)\n recipients: z.array(StandardEmail_BatchRecipientSchema).min(1),\n \n // Optional features\n attachments: z.array(StandardEmail_AttachmentSchema).optional(),\n tags: z.array(z.string()).optional(),\n scheduledAt: z.iso.datetime().optional(),\n});\n\nexport type StandardEmail_BatchRequest = z.infer<typeof StandardEmail_BatchRequestSchema>;\n\n// ===============================================================\n// TRANSACTIONAL: Batch Send Response\n// ===============================================================\n\nexport const StandardEmail_BatchResponseSchema = z.object({\n success: z.boolean(),\n totalRequested: z.number().int(),\n totalAccepted: z.number().int(),\n totalRejected: z.number().int(),\n results: z.array(z.object({\n // Email address OR summary identifier (e.g. \"batch\" when provider returns aggregate result)\n email: z.string().min(1),\n success: z.boolean(),\n messageId: z.string().optional(),\n error: z.string().optional(),\n })),\n});\n\nexport type StandardEmail_BatchResponse = z.infer<typeof StandardEmail_BatchResponseSchema>;\n\n// ===============================================================\n// MARKETING: Contact\n// ===============================================================\n\nexport const StandardMarketing_ContactSchema = z.object({\n email: z.email(),\n firstName: z.string().optional(),\n lastName: z.string().optional(),\n phone: z.string().optional(),\n attributes: z.record(z.string(), z.unknown()).optional(),\n});\n\nexport type StandardMarketing_Contact = z.infer<typeof StandardMarketing_ContactSchema>;\n\n// ===============================================================\n// MARKETING: List\n// ===============================================================\n\nexport const StandardMarketing_ListSchema = z.object({\n id: z.string().optional(), // Provider assigns on create\n name: z.string().min(1),\n description: z.string().optional(),\n});\n\nexport type StandardMarketing_List = z.infer<typeof StandardMarketing_ListSchema>;\n\n// ===============================================================\n// MARKETING: Audience (List + Contacts)\n// ===============================================================\n\nexport const StandardMarketing_AudienceSchema = z.object({\n // List reference (use existing by ID, or create/find by name)\n list: z.object({\n id: z.string().optional(),\n name: z.string().optional(),\n description: z.string().optional(),\n }).refine(\n (data) => data.id !== undefined || data.name !== undefined,\n { message: \"Either list.id or list.name is required\" }\n ),\n \n // Contacts to add/sync (optional if using existing list)\n contacts: z.array(StandardMarketing_ContactSchema).optional(),\n});\n\nexport type StandardMarketing_Audience = z.infer<typeof StandardMarketing_AudienceSchema>;\n\n// ===============================================================\n// MARKETING: Campaign Content\n// ===============================================================\n\nexport const StandardMarketing_ContentSchema = z.object({\n // Use template OR inline content\n templateId: z.string().optional(),\n templateVariables: z.record(z.string(), z.unknown()).optional(),\n \n // Inline content (if no template)\n subject: z.string().optional(),\n html: z.string().optional(),\n text: z.string().optional(),\n previewText: z.string().optional(),\n \n // Attachments\n attachments: z.array(StandardEmail_AttachmentSchema).optional(),\n}).refine(\n (data) => data.templateId !== undefined || data.subject !== undefined,\n { message: \"Either templateId or subject is required\" }\n);\n\nexport type StandardMarketing_Content = z.infer<typeof StandardMarketing_ContentSchema>;\n\n// ===============================================================\n// MARKETING: Campaign Request\n// ===============================================================\n\nexport const StandardMarketing_CampaignRequestSchema = z.object({\n // Campaign name\n name: z.string().min(1),\n \n // Sender\n from: StandardEmail_AddressSchema,\n replyTo: StandardEmail_AddressSchema.optional(),\n \n // Audience\n audience: StandardMarketing_AudienceSchema,\n \n // Content\n content: StandardMarketing_ContentSchema,\n \n // Execution\n schedule: z.object({\n sendAt: z.iso.datetime().optional(),\n sendImmediately: z.boolean().optional(),\n }).optional(),\n \n // Tracking\n trackOpens: z.boolean().optional().default(true),\n trackClicks: z.boolean().optional().default(true),\n \n // Tags\n tags: z.array(z.string()).optional(),\n \n // Metadata\n metadata: z.record(z.string(), z.string()).optional(),\n});\n\nexport type StandardMarketing_CampaignRequest = z.infer<typeof StandardMarketing_CampaignRequestSchema>;\n\n// ===============================================================\n// MARKETING: Campaign Response\n// ===============================================================\n\nexport const StandardMarketing_CampaignResponseSchema = z.object({\n success: z.boolean(),\n campaignId: z.string(),\n providerCampaignId: z.string().optional(),\n status: z.enum([\"draft\", \"scheduled\", \"sending\", \"sent\", \"cancelled\"]),\n scheduledAt: z.iso.datetime().optional(),\n listId: z.string().optional(),\n audienceSize: z.number().int().optional(),\n});\n\nexport type StandardMarketing_CampaignResponse = z.infer<typeof StandardMarketing_CampaignResponseSchema>;\n\n// ===============================================================\n// Message Status Request/Response\n// ===============================================================\n\nexport const StandardEmail_GetStatusRequestSchema = z.object({\n messageId: z.string().min(1),\n});\n\nexport type StandardEmail_GetStatusRequest = z.infer<typeof StandardEmail_GetStatusRequestSchema>;\n\nexport const StandardEmail_GetStatusResponseSchema = z.object({\n messageId: z.string(),\n status: z.enum(EmailProvider_DeliveryStatus),\n to: z.email(),\n subject: z.string().optional(),\n sentAt: z.iso.datetime().optional(),\n deliveredAt: z.iso.datetime().optional(),\n openedAt: z.iso.datetime().optional(),\n clickedAt: z.iso.datetime().optional(),\n bouncedAt: z.iso.datetime().optional(),\n bounceReason: z.string().optional(),\n});\n\nexport type StandardEmail_GetStatusResponse = z.infer<typeof StandardEmail_GetStatusResponseSchema>;\n\n// ===============================================================\n// Standard Error\n// ===============================================================\n\nexport const StandardEmail_ErrorSchema = z.object({\n code: z.enum([\n \"VALIDATION_ERROR\",\n \"PROVIDER_ERROR\",\n \"CAPABILITY_NOT_SUPPORTED\",\n \"MARKETING_NOT_SUPPORTED\",\n \"SCHEDULING_NOT_SUPPORTED\",\n \"TEMPLATE_NOT_FOUND\",\n \"RATE_LIMIT_EXCEEDED\",\n \"AUTHENTICATION_FAILED\",\n \"QUOTA_EXCEEDED\",\n \"UNKNOWN_ERROR\",\n ]),\n message: z.string(),\n provider: z.string().optional(),\n details: z.unknown().optional(),\n \n // For capability errors - dynamically populated from registry\n requiredCapability: z.enum(EmailProvider_Capability).optional(),\n supportedProviders: z.array(z.string()).optional(),\n});\n\nexport type StandardEmail_Error = z.infer<typeof StandardEmail_ErrorSchema>;\n\n// ===============================================================\n// Capability Requirements\n// ===============================================================\n\n/**\n * Maps standard operations to required capabilities.\n * Used by the ETL layer to validate provider support.\n */\nexport const StandardEmail_OperationCapabilities = {\n sendEmail: [] as EmailProvider_Capability[], // All providers support basic send\n sendTemplate: [EmailProvider_Capability.SUPPORTS_TEMPLATES],\n sendBatch: [EmailProvider_Capability.SUPPORTS_BATCH_SENDING],\n sendScheduled: [EmailProvider_Capability.SUPPORTS_SCHEDULING],\n sendCampaign: [EmailProvider_Capability.SUPPORTS_MARKETING, EmailProvider_Capability.SUPPORTS_CAMPAIGNS],\n manageList: [EmailProvider_Capability.SUPPORTS_LIST_MANAGEMENT],\n} as const;\n\nexport type StandardEmail_Operation = keyof typeof StandardEmail_OperationCapabilities;\n"]}
|
|
1
|
+
{"version":3,"file":"email.standard-interface.schemas.js","sourceRoot":"","sources":["../../../../src/protocols/email.standard-interface.schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,wBAAwB,EAA2B,4BAA4B,EAAE,MAAM,4CAA4C,CAAC;AAE7I,iEAAiE;AACjE,2BAA2B;AAC3B,WAAW;AACX,qEAAqE;AACrE,gEAAgE;AAChE,+BAA+B;AAC/B,EAAE;AACF,qBAAqB;AACrB,uDAAuD;AACvD,gEAAgE;AAChE,yEAAyE;AACzE,iEAAiE;AAEjE,kEAAkE;AAClE,yBAAyB;AACzB,kEAAkE;AAElE,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,CAAC,MAAM,CAAC;IAClD,KAAK,EAAE,CAAC,CAAC,KAAK,EAAE;IAChB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAC5B,CAAC,CAAC;AAIH,kEAAkE;AAClE,sBAAsB;AACtB,kEAAkE;AAElE,MAAM,CAAC,MAAM,8BAA8B,GAAG,CAAC,CAAC,MAAM,CAAC;IACrD,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC3B,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,iBAA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ability, EmailProvider_EmailType, EmailProvider_DeliveryStatus } from \"./email.external-connectors-models.schemas\";\n\n//===============================================================\n// Standard Email Interface\n// --------\n// This is the canonical interface that Wildo uses internally to send\n// emails. The ETL layer transforms these standard requests into\n// provider-specific API calls.\n//\n// Design Principles:\n// 1. Provider-agnostic - works with any email provider\n// 2. Capability-aware - validates against provider capabilities\n// 3. Extensible - new fields can be added without breaking existing code\n//===============================================================\n\n// ===============================================================\n// Standard Email Address\n// ===============================================================\n\nexport const StandardEmail_AddressSchema = z.object({\n email: z.email(),\n name: z.string().optional(),\n});\n\nexport type StandardEmail_Address = z.infer<typeof StandardEmail_AddressSchema>;\n\n// ===============================================================\n// Standard Attachment\n// ===============================================================\n\nexport const StandardEmail_AttachmentSchema = z.object({\n filename: z.string().min(1),\n content: z.string(), // Base64 encoded\n contentType: z.string().optional(),\n contentId: z.string().optional(), // For inline images (cid:)\n});\n\nexport type StandardEmail_Attachment = z.infer<typeof StandardEmail_AttachmentSchema>;\n\n/**\n * Wire encoding used by a network email provider gateway.\n *\n * This vocabulary is deliberately closed and explicit on every provider\n * contract: JSON and multipart data require materially different headers and\n * serialization. There is no implicit default.\n */\nexport enum EmailProviderPayloadEncoding {\n JSON = \"json\",\n MULTIPART_FORM_DATA = \"multipart-form-data\",\n}\n\n/** Provider acknowledgement state returned by a synchronous send endpoint. */\nexport enum EmailProviderSubmissionStatus {\n QUEUED = \"queued\",\n SENT = \"sent\",\n SCHEDULED = \"scheduled\",\n}\n\n/** Provider-owned classification for HTTP responses whose status is ambiguous. */\nexport enum EmailProviderSubmissionClassification {\n ACCEPTED = \"accepted\",\n REJECTED = \"rejected\",\n ACCEPTANCE_UNKNOWN = \"acceptance_unknown\",\n}\n\n// ===============================================================\n// TRANSACTIONAL: Send Email Request\n// ===============================================================\n\nexport const StandardEmail_SendRequestSchema = z.object({\n /**\n * Stable identity of ONE logical provider submission across retries.\n *\n * Deliberately not named `idempotencyKey`: it remains the framework's\n * correlation identity even when the selected provider cannot enforce\n * idempotency. Provider gateways may map it to a native idempotency field as\n * an optional duplicate-risk reduction.\n */\n submissionId: z.string().min(1).max(256),\n\n // Recipients (required)\n to: z.array(StandardEmail_AddressSchema).min(1),\n cc: z.array(StandardEmail_AddressSchema).optional(),\n bcc: z.array(StandardEmail_AddressSchema).optional(),\n \n // Sender (required unless provider config has default)\n from: StandardEmail_AddressSchema.optional(),\n replyTo: StandardEmail_AddressSchema.optional(),\n \n // Content (html OR text required)\n subject: z.string().min(1),\n html: z.string().optional(),\n text: z.string().optional(),\n \n // Optional features\n attachments: z.array(StandardEmail_AttachmentSchema).optional(),\n headers: z.record(z.string(), z.string()).optional(),\n tags: z.array(z.string()).optional(),\n \n // Scheduling (optional - requires SUPPORTS_SCHEDULING)\n scheduledAt: z.iso.datetime().optional(),\n \n // Tracking (optional, uses provider default if not set)\n trackOpens: z.boolean().optional(),\n trackClicks: z.boolean().optional(),\n \n // Metadata for correlation/tracking\n metadata: z.record(z.string(), z.string()).optional(),\n}).refine(\n (data) => data.html !== undefined || data.text !== undefined,\n { message: \"Either html or text content is required\" }\n);\n\nexport type StandardEmail_SendRequest = z.infer<typeof StandardEmail_SendRequestSchema>;\n\n// ===============================================================\n// TRANSACTIONAL: Send Email Response\n// ===============================================================\n\nexport const StandardEmail_SendResponseSchema = z.object({\n success: z.boolean(),\n /**\n * Mandatory provider-owned submission meaning. HTTP status, receipt shape,\n * and recipient-level `success` are not interchangeable across providers.\n */\n classification: z.enum(EmailProviderSubmissionClassification),\n /**\n * Provider-assigned receipts. An array is required because Brevo and\n * Mailchimp may acknowledge several recipient messages in one response.\n * Empty is honest for a successful non-delivery preview or a provider that\n * accepted the request without returning a receipt.\n */\n providerMessageIds: z.array(z.string().min(1)),\n /** Per-recipient rejections returned inside an otherwise successful HTTP response. */\n rejectedRecipients: z.array(z.object({\n email: z.string().min(1),\n reason: z.string().optional(),\n })).optional(),\n /**\n * Provider-declared detail explaining its explicit classification, including\n * semantic rejection or an ambiguous idempotency/processing conflict.\n *\n * CONTENT-FREE: the vendor's own code or error name, never the vendor's message, which routinely quotes the refused\n * address or the payload. The engine logs this text and returns it in batch results, and a log outlives an erasure\n * (#2251).\n */\n providerError: z.string().min(1).optional(),\n /**\n * Whether the caller should retry this response under at-least-once\n * semantics. For an acceptance-unknown response, a retry may duplicate a\n * message unless the selected provider happens to enforce the submission id.\n */\n retryable: z.boolean().optional(),\n /** Provider reports that this submission identity was already suppressed. */\n deduplicated: z.boolean().optional(),\n status: z.enum(EmailProviderSubmissionStatus).optional(),\n scheduledAt: z.iso.datetime().optional(),\n}).superRefine((response, context) => {\n const accepted =\n response.classification\n === EmailProviderSubmissionClassification.ACCEPTED;\n\n /**\n * `success` describes whole-request success, whereas `classification`\n * describes whether any provider submission was accepted. Once a provider\n * adapter classifies a submission as accepted, auxiliary result metadata\n * must never turn that acknowledgement into permission to replay. A false\n * `success` may describe an honest partial result (for example Mailchimp)\n * or anomalous adapter metadata; `rejectedRecipients` is therefore useful\n * evidence, but not a prerequisite for preserving acceptance.\n */\n if (response.success && !accepted) {\n context.addIssue({\n code: 'custom',\n path: ['success'],\n message:\n 'A successful email response must be classified as accepted',\n });\n }\n if (response.success && (response.rejectedRecipients?.length ?? 0) > 0) {\n context.addIssue({\n code: 'custom',\n path: ['rejectedRecipients'],\n message:\n 'A successful email response cannot contain rejected recipients',\n });\n }\n if (!accepted && response.providerMessageIds.length > 0) {\n context.addIssue({\n code: 'custom',\n path: ['providerMessageIds'],\n message:\n 'A non-accepted email response cannot contain provider acceptance receipts',\n });\n }\n for (const [index, providerMessageId] of response.providerMessageIds.entries()) {\n if (response.providerMessageIds.indexOf(providerMessageId) !== index) {\n context.addIssue({\n code: 'custom',\n path: ['providerMessageIds', index],\n message: 'Provider message receipts must be unique',\n });\n }\n }\n\n for (const acceptedOnlyField of [\n 'deduplicated',\n 'status',\n 'scheduledAt',\n ] as const) {\n if (!accepted && response[acceptedOnlyField] !== undefined) {\n context.addIssue({\n code: 'custom',\n path: [acceptedOnlyField],\n message:\n `${acceptedOnlyField} is valid only for an accepted email response`,\n });\n }\n }\n if (\n response.scheduledAt !== undefined\n && response.status !== EmailProviderSubmissionStatus.SCHEDULED\n ) {\n context.addIssue({\n code: 'custom',\n path: ['scheduledAt'],\n message:\n 'A scheduledAt receipt requires provider status scheduled',\n });\n }\n if (accepted && response.retryable === true) {\n context.addIssue({\n code: 'custom',\n path: ['retryable'],\n message: 'An accepted email response cannot request replay',\n });\n }\n});\n\nexport type StandardEmail_SendResponse = z.infer<typeof StandardEmail_SendResponseSchema>;\n\n// ===============================================================\n// TRANSACTIONAL: Send Template Request\n// ===============================================================\n\nexport const StandardEmail_SendTemplateRequestSchema = z.object({\n // Recipients\n to: z.array(StandardEmail_AddressSchema).min(1),\n cc: z.array(StandardEmail_AddressSchema).optional(),\n bcc: z.array(StandardEmail_AddressSchema).optional(),\n \n // Sender\n from: StandardEmail_AddressSchema.optional(),\n replyTo: StandardEmail_AddressSchema.optional(),\n \n // Template (requires SUPPORTS_TEMPLATES)\n templateId: z.string().min(1),\n templateAlias: z.string().optional(), // Alternative identifier (Postmark)\n variables: z.record(z.string(), z.unknown()).optional(),\n \n // Optional overrides\n subject: z.string().optional(), // Override template subject\n \n // Optional features\n attachments: z.array(StandardEmail_AttachmentSchema).optional(),\n tags: z.array(z.string()).optional(),\n scheduledAt: z.iso.datetime().optional(),\n \n // Metadata\n metadata: z.record(z.string(), z.string()).optional(),\n});\n\nexport type StandardEmail_SendTemplateRequest = z.infer<typeof StandardEmail_SendTemplateRequestSchema>;\n\n// ===============================================================\n// TRANSACTIONAL: Batch Send Request\n// ===============================================================\n\nexport const StandardEmail_BatchRecipientSchema = z.object({\n to: StandardEmail_AddressSchema,\n cc: z.array(StandardEmail_AddressSchema).optional(),\n bcc: z.array(StandardEmail_AddressSchema).optional(),\n variables: z.record(z.string(), z.unknown()).optional(),\n subject: z.string().optional(), // Per-recipient subject override\n metadata: z.record(z.string(), z.string()).optional(),\n});\n\nexport type StandardEmail_BatchRecipient = z.infer<typeof StandardEmail_BatchRecipientSchema>;\n\nexport const StandardEmail_BatchRequestSchema = z.object({\n // Sender (shared)\n from: StandardEmail_AddressSchema.optional(),\n replyTo: StandardEmail_AddressSchema.optional(),\n \n // Content (shared - either direct or template)\n subject: z.string().optional(), // Default subject\n html: z.string().optional(),\n text: z.string().optional(),\n templateId: z.string().optional(),\n \n // Recipients with personalizations (requires SUPPORTS_BATCH_SENDING)\n recipients: z.array(StandardEmail_BatchRecipientSchema).min(1),\n \n // Optional features\n attachments: z.array(StandardEmail_AttachmentSchema).optional(),\n tags: z.array(z.string()).optional(),\n scheduledAt: z.iso.datetime().optional(),\n});\n\nexport type StandardEmail_BatchRequest = z.infer<typeof StandardEmail_BatchRequestSchema>;\n\n// ===============================================================\n// TRANSACTIONAL: Batch Send Response\n// ===============================================================\n\nexport const StandardEmail_BatchResponseSchema = z.object({\n success: z.boolean(),\n totalRequested: z.number().int(),\n totalAccepted: z.number().int(),\n totalRejected: z.number().int(),\n results: z.array(z.object({\n // Email address OR summary identifier (e.g. \"batch\" when provider returns aggregate result)\n email: z.string().min(1),\n success: z.boolean(),\n messageId: z.string().optional(),\n error: z.string().optional(),\n })),\n});\n\nexport type StandardEmail_BatchResponse = z.infer<typeof StandardEmail_BatchResponseSchema>;\n\n// ===============================================================\n// MARKETING: Contact\n// ===============================================================\n\nexport const StandardMarketing_ContactSchema = z.object({\n email: z.email(),\n firstName: z.string().optional(),\n lastName: z.string().optional(),\n phone: z.string().optional(),\n attributes: z.record(z.string(), z.unknown()).optional(),\n});\n\nexport type StandardMarketing_Contact = z.infer<typeof StandardMarketing_ContactSchema>;\n\n// ===============================================================\n// MARKETING: List\n// ===============================================================\n\nexport const StandardMarketing_ListSchema = z.object({\n id: z.string().optional(), // Provider assigns on create\n name: z.string().min(1),\n description: z.string().optional(),\n});\n\nexport type StandardMarketing_List = z.infer<typeof StandardMarketing_ListSchema>;\n\n// ===============================================================\n// MARKETING: Audience (List + Contacts)\n// ===============================================================\n\nexport const StandardMarketing_AudienceSchema = z.object({\n // List reference (use existing by ID, or create/find by name)\n list: z.object({\n id: z.string().optional(),\n name: z.string().optional(),\n description: z.string().optional(),\n }).refine(\n (data) => data.id !== undefined || data.name !== undefined,\n { message: \"Either list.id or list.name is required\" }\n ),\n \n // Contacts to add/sync (optional if using existing list)\n contacts: z.array(StandardMarketing_ContactSchema).optional(),\n});\n\nexport type StandardMarketing_Audience = z.infer<typeof StandardMarketing_AudienceSchema>;\n\n// ===============================================================\n// MARKETING: Campaign Content\n// ===============================================================\n\nexport const StandardMarketing_ContentSchema = z.object({\n // Use template OR inline content\n templateId: z.string().optional(),\n templateVariables: z.record(z.string(), z.unknown()).optional(),\n \n // Inline content (if no template)\n subject: z.string().optional(),\n html: z.string().optional(),\n text: z.string().optional(),\n previewText: z.string().optional(),\n \n // Attachments\n attachments: z.array(StandardEmail_AttachmentSchema).optional(),\n}).refine(\n (data) => data.templateId !== undefined || data.subject !== undefined,\n { message: \"Either templateId or subject is required\" }\n);\n\nexport type StandardMarketing_Content = z.infer<typeof StandardMarketing_ContentSchema>;\n\n// ===============================================================\n// MARKETING: Campaign Request\n// ===============================================================\n\nexport const StandardMarketing_CampaignRequestSchema = z.object({\n // Campaign name\n name: z.string().min(1),\n \n // Sender\n from: StandardEmail_AddressSchema,\n replyTo: StandardEmail_AddressSchema.optional(),\n \n // Audience\n audience: StandardMarketing_AudienceSchema,\n \n // Content\n content: StandardMarketing_ContentSchema,\n \n // Execution\n schedule: z.object({\n sendAt: z.iso.datetime().optional(),\n sendImmediately: z.boolean().optional(),\n }).optional(),\n \n // Tracking\n trackOpens: z.boolean().optional().default(true),\n trackClicks: z.boolean().optional().default(true),\n \n // Tags\n tags: z.array(z.string()).optional(),\n \n // Metadata\n metadata: z.record(z.string(), z.string()).optional(),\n});\n\nexport type StandardMarketing_CampaignRequest = z.infer<typeof StandardMarketing_CampaignRequestSchema>;\n\n// ===============================================================\n// MARKETING: Campaign Response\n// ===============================================================\n\nexport const StandardMarketing_CampaignResponseSchema = z.object({\n success: z.boolean(),\n campaignId: z.string(),\n providerCampaignId: z.string().optional(),\n status: z.enum([\"draft\", \"scheduled\", \"sending\", \"sent\", \"cancelled\"]),\n scheduledAt: z.iso.datetime().optional(),\n listId: z.string().optional(),\n audienceSize: z.number().int().optional(),\n});\n\nexport type StandardMarketing_CampaignResponse = z.infer<typeof StandardMarketing_CampaignResponseSchema>;\n\n// ===============================================================\n// Message Status Request/Response\n// ===============================================================\n\nexport const StandardEmail_GetStatusRequestSchema = z.object({\n messageId: z.string().min(1),\n});\n\nexport type StandardEmail_GetStatusRequest = z.infer<typeof StandardEmail_GetStatusRequestSchema>;\n\nexport const StandardEmail_GetStatusResponseSchema = z.object({\n messageId: z.string(),\n status: z.enum(EmailProvider_DeliveryStatus),\n to: z.email(),\n subject: z.string().optional(),\n sentAt: z.iso.datetime().optional(),\n deliveredAt: z.iso.datetime().optional(),\n openedAt: z.iso.datetime().optional(),\n clickedAt: z.iso.datetime().optional(),\n bouncedAt: z.iso.datetime().optional(),\n bounceReason: z.string().optional(),\n});\n\nexport type StandardEmail_GetStatusResponse = z.infer<typeof StandardEmail_GetStatusResponseSchema>;\n\n// ===============================================================\n// Standard Error\n// ===============================================================\n\nexport const StandardEmail_ErrorSchema = z.object({\n code: z.enum([\n \"VALIDATION_ERROR\",\n \"PROVIDER_ERROR\",\n \"CAPABILITY_NOT_SUPPORTED\",\n \"MARKETING_NOT_SUPPORTED\",\n \"SCHEDULING_NOT_SUPPORTED\",\n \"TEMPLATE_NOT_FOUND\",\n \"RATE_LIMIT_EXCEEDED\",\n \"AUTHENTICATION_FAILED\",\n \"QUOTA_EXCEEDED\",\n \"UNKNOWN_ERROR\",\n ]),\n message: z.string(),\n provider: z.string().optional(),\n details: z.unknown().optional(),\n \n // For capability errors - dynamically populated from registry\n requiredCapability: z.enum(EmailProvider_Capability).optional(),\n supportedProviders: z.array(z.string()).optional(),\n});\n\nexport type StandardEmail_Error = z.infer<typeof StandardEmail_ErrorSchema>;\n\n// ===============================================================\n// Capability Requirements\n// ===============================================================\n\n/**\n * Maps standard operations to required capabilities.\n * Used by the ETL layer to validate provider support.\n */\nexport const StandardEmail_OperationCapabilities = {\n sendEmail: [] as EmailProvider_Capability[], // All providers support basic send\n sendTemplate: [EmailProvider_Capability.SUPPORTS_TEMPLATES],\n sendBatch: [EmailProvider_Capability.SUPPORTS_BATCH_SENDING],\n sendScheduled: [EmailProvider_Capability.SUPPORTS_SCHEDULING],\n sendCampaign: [EmailProvider_Capability.SUPPORTS_MARKETING, EmailProvider_Capability.SUPPORTS_CAMPAIGNS],\n manageList: [EmailProvider_Capability.SUPPORTS_LIST_MANAGEMENT],\n} as const;\n\nexport type StandardEmail_Operation = keyof typeof StandardEmail_OperationCapabilities;\n"]}
|
|
@@ -92,19 +92,47 @@ export declare const EMBEDDINGS_MODEL_CATALOG: Record<EmbeddingsProvider_Model,
|
|
|
92
92
|
* converging over runs. No agent/worker definition changes.
|
|
93
93
|
*/
|
|
94
94
|
export declare const EMBEDDINGS_MODEL_APPLICABILITY_PREFERENCE: Record<Embeddings_Applicability, readonly EmbeddingsProvider_Model[]>;
|
|
95
|
+
/**
|
|
96
|
+
* An embedding model a provider the engine does NOT ship declares it serves (#2516) — the embeddings mirror of
|
|
97
|
+
* `LLM_ModelDeclaration`. The catalog is an exhaustive record over {@link EmbeddingsProvider_Model}, so a registry
|
|
98
|
+
* vendor declares its models on its embeddings arm instead of adding a row.
|
|
99
|
+
*
|
|
100
|
+
* `dims` is as load-bearing here as on a catalog row: the drain worker verifies every returned vector against it, and the
|
|
101
|
+
* per-dimension vector index is keyed by it. It must be the model's published output dimension.
|
|
102
|
+
*/
|
|
103
|
+
export type Embeddings_ModelDeclaration = {
|
|
104
|
+
model: string;
|
|
105
|
+
dims: number;
|
|
106
|
+
applicabilities: readonly Embeddings_Applicability[];
|
|
107
|
+
};
|
|
108
|
+
/**
|
|
109
|
+
* Why a provider's declared embedding models ({@link Embeddings_ModelDeclaration}) cannot be used, or `undefined`
|
|
110
|
+
* (#2516). Absent is fine: an engine provider has none. A registry module is loaded at runtime, so nothing compiled its
|
|
111
|
+
* `models`; `dims` in particular decides which vector index a chunk enters, so it must be a positive integer.
|
|
112
|
+
*/
|
|
113
|
+
export declare const describeEmbeddingsModelDeclarationsDefect: (models: unknown) => string | undefined;
|
|
114
|
+
/**
|
|
115
|
+
* Whether the engine's embedding catalog knows this provider, which decides where its model facts come from (#2516): catalog
|
|
116
|
+
* rows for an engine provider, the provider's own `models` declaration otherwise.
|
|
117
|
+
*/
|
|
118
|
+
export declare const isEmbeddingsCatalogProvider: (providerRef: string, catalog?: Record<EmbeddingsProvider_Model, Embeddings_ModelCatalogEntry>) => boolean;
|
|
95
119
|
/** Why {@link resolveEmbeddingsModelForApplicability} could not answer — carried into a named CONFIGURATION error. */
|
|
96
120
|
export declare enum Embeddings_ModelResolutionFailure {
|
|
97
121
|
/** The applicability has no candidate at all for this provider. */
|
|
98
|
-
NO_CANDIDATE_FOR_PROVIDER = "no_candidate_for_provider"
|
|
122
|
+
NO_CANDIDATE_FOR_PROVIDER = "no_candidate_for_provider",
|
|
123
|
+
/** An engine provider (one the catalog knows) also declares models; its models are catalog rows, so it is refused. */
|
|
124
|
+
CATALOG_PROVIDER_DECLARES_MODELS = "catalog_provider_declares_models",
|
|
125
|
+
/** A declared model's `dims` is not a positive integer, so nothing could verify or index its vectors. */
|
|
126
|
+
DECLARED_DIMS_INVALID = "declared_dims_invalid"
|
|
99
127
|
}
|
|
100
128
|
export type Embeddings_ModelResolution = {
|
|
101
129
|
resolved: true;
|
|
102
|
-
model:
|
|
103
|
-
|
|
130
|
+
model: string;
|
|
131
|
+
dims: number;
|
|
104
132
|
} | {
|
|
105
133
|
resolved: false;
|
|
106
134
|
failure: Embeddings_ModelResolutionFailure;
|
|
107
|
-
consideredModels: readonly
|
|
135
|
+
consideredModels: readonly string[];
|
|
108
136
|
};
|
|
109
137
|
/**
|
|
110
138
|
* Resolve an applicability class to ONE concrete embedding model for a given provider.
|
|
@@ -113,10 +141,15 @@ export type Embeddings_ModelResolution = {
|
|
|
113
141
|
* fallback to some other model would fracture the vector space the class exists to keep whole.
|
|
114
142
|
* The resolved `(class, model)` pair is what the RAG drain worker stamps on every chunk and what
|
|
115
143
|
* its migration pass compares stamps against.
|
|
144
|
+
*
|
|
145
|
+
* Two sources, decided by whether the catalog knows the provider (as `resolveModelForApplicability`, #2516): an engine
|
|
146
|
+
* provider resolves through the preference and catalog and is refused if it also declares models; any other provider
|
|
147
|
+
* resolves from its `declaredModels`, the first declaring the applicability.
|
|
116
148
|
*/
|
|
117
149
|
export declare const resolveEmbeddingsModelForApplicability: (input: {
|
|
118
150
|
applicability: Embeddings_Applicability;
|
|
119
151
|
providerRef: string;
|
|
152
|
+
declaredModels?: readonly Embeddings_ModelDeclaration[];
|
|
120
153
|
}, catalog?: Record<EmbeddingsProvider_Model, Embeddings_ModelCatalogEntry>) => Embeddings_ModelResolution;
|
|
121
154
|
/**
|
|
122
155
|
* Usage of one embedding call. There is NO completion-token dimension — an embedding consumes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"embeddings.external-connectors-models.schemas.d.ts","sourceRoot":"","sources":["../../../../src/protocols/embeddings.external-connectors-models.schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EACL,sCAAsC,EACrC,MAAM,oDAAoD,CAAA;AAkB7D;;;;;GAKG;AACH,oBAAY,wBAAwB;IAClC,kGAAkG;IAClG,8BAA8B,2BAA2B;IACzD,kEAAkE;IAClE,8BAA8B,2BAA2B;CAC1D;AAED;;;;;;;;;GASG;AACH,oBAAY,+BAA+B;IACzC,8DAA8D;IAC9D,WAAW,0BAA0B;CACtC;AAED;;;;;;;;GAQG;AACH,oBAAY,8BAA8B;IACxC,yEAAyE;IACzE,MAAM,WAAW;IACjB,8EAA8E;IAC9E,KAAK,UAAU;CAChB;AAED;;;;;;;;;;;;;;;GAeG;AACH,oBAAY,wBAAwB;IAClC,iGAAiG;IACjG,WAAW,gBAAgB;CAC5B;AACD,8EAA8E;AAE9E;;;GAGG;AACH,MAAM,MAAM,4BAA4B,GAAG;IACzC,4DAA4D;IAC5D,WAAW,EAAE,MAAM,CAAC;IACpB;;;;OAIG;IACH,IAAI,EAAE,MAAM,CAAC;IACb,sFAAsF;IACtF,eAAe,EAAE,SAAS,wBAAwB,EAAE,CAAC;CACtD,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,wBAAwB,EAAE,MAAM,CAAC,wBAAwB,EAAE,4BAA4B,CAenG,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,yCAAyC,EAAE,MAAM,CAAC,wBAAwB,EAAE,SAAS,wBAAwB,EAAE,CAI3H,CAAC;AAEF,sHAAsH;AACtH,oBAAY,iCAAiC;IAC3C,mEAAmE;IACnE,yBAAyB,8BAA8B;
|
|
1
|
+
{"version":3,"file":"embeddings.external-connectors-models.schemas.d.ts","sourceRoot":"","sources":["../../../../src/protocols/embeddings.external-connectors-models.schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EACL,sCAAsC,EACrC,MAAM,oDAAoD,CAAA;AAkB7D;;;;;GAKG;AACH,oBAAY,wBAAwB;IAClC,kGAAkG;IAClG,8BAA8B,2BAA2B;IACzD,kEAAkE;IAClE,8BAA8B,2BAA2B;CAC1D;AAED;;;;;;;;;GASG;AACH,oBAAY,+BAA+B;IACzC,8DAA8D;IAC9D,WAAW,0BAA0B;CACtC;AAED;;;;;;;;GAQG;AACH,oBAAY,8BAA8B;IACxC,yEAAyE;IACzE,MAAM,WAAW;IACjB,8EAA8E;IAC9E,KAAK,UAAU;CAChB;AAED;;;;;;;;;;;;;;;GAeG;AACH,oBAAY,wBAAwB;IAClC,iGAAiG;IACjG,WAAW,gBAAgB;CAC5B;AACD,8EAA8E;AAE9E;;;G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