sinfactura-types 1.10.360 → 1.10.362

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/ai.d.ts CHANGED
@@ -195,19 +195,23 @@ declare global {
195
195
  */
196
196
  data: string;
197
197
  /**
198
- * Page count of the document, COUNTED BY THE CALLER.
198
+ * Page count of the document, counted by the caller — a HINT, and OPTIONAL
199
+ * in the full sense: omitting it gives up nothing.
199
200
  *
200
- * ⚠️ Send it whenever you can. The page cap is only enforceable pre-flight
201
- * when it is DECLARED — omit it and the check does not run at all: the
202
- * document is sent, the call is made, the tenant's ceiling is charged for
203
- * it, and the model provider enforces its own page limit opaquely, so the
204
- * caller gets a generic upstream failure instead of
205
- * `DOCUMENT_TOO_MANY_PAGES`. A caller that can cheaply count pages (the
206
- * app already parses the PDF to preview it) should ALWAYS send this:
207
- * omitting it buys nothing and gives up the one free refusal.
201
+ * ⚠️ **The count the cap is enforced against is derived from the BYTES**,
202
+ * server-side, before any model call. This field used to be the only thing
203
+ * that could trigger the check, so an omitted count meant an arbitrarily
204
+ * long PDF was sent, metered and billed; a client could therefore clear
205
+ * the cap by saying nothing, which is the opposite of what a declaration
206
+ * should buy.
208
207
  *
209
- * A declared count above the cap is refused before any model call, so
210
- * nothing is spent.
208
+ * ⚠️ It can only ever cause MORE refusals, never fewer: the effective
209
+ * count is the LARGER of the derived and the declared figure. A caller who
210
+ * knows the true count of a file the server under-reads is believed; a
211
+ * caller declaring `1` for a 500-page document is not.
212
+ *
213
+ * Either way the refusal is `DOCUMENT_TOO_MANY_PAGES` before any model
214
+ * call, so nothing is spent.
211
215
  */
212
216
  pageCount?: number;
213
217
  }
@@ -231,7 +235,8 @@ declare global {
231
235
  * who paid and what the operator should do next:
232
236
  *
233
237
  * · INGRESS — `INVALID_BASE64`, `UNSUPPORTED_MEDIA_TYPE`,
234
- * `CONTENT_TOO_LARGE`, `DOCUMENT_TOO_MANY_PAGES`. The document NEVER
238
+ * `CONTENT_TOO_LARGE`, `DOCUMENT_TOO_MANY_PAGES`,
239
+ * `DOCUMENT_PAGE_COUNT_UNREADABLE`. The document NEVER
235
240
  * REACHED THE MODEL: no call was made, nothing was metered, nothing was
236
241
  * billed. The operator fixes the file and retries at once, for free.
237
242
  * · BUDGET — `COST_CEILING_EXCEEDED`. A spend ceiling, not a problem with the
@@ -249,9 +254,21 @@ declare global {
249
254
  * - `UNSUPPORTED_MEDIA_TYPE` · 415 — the decoded bytes are not a PDF,
250
255
  * whatever `format` declared.
251
256
  * - `CONTENT_TOO_LARGE` · 413 — decoded size over the 4 MiB ingress cap.
252
- * - `DOCUMENT_TOO_MANY_PAGES` · 413 — the DECLARED `pageCount` exceeds the
253
- * model's page limit. ⚠️ Reachable ONLY when the caller declared one — see
257
+ * - `DOCUMENT_TOO_MANY_PAGES` · 413 — the document's page count exceeds this
258
+ * endpoint's page cap. ⚠️ The count is DERIVED FROM THE BYTES server-side
259
+ * and a declared `pageCount` can only raise it, so this is reachable on
260
+ * every request — it is no longer opt-in via the declaration. See
254
261
  * `SupplierDocExtractRequest.pageCount`.
262
+ * - `DOCUMENT_PAGE_COUNT_UNREADABLE` · 400 — the page count could not be
263
+ * derived from the bytes at all. ⚠️ A REFUSAL, not an assumption, and it is
264
+ * in the FREE ingress family: nothing was sent and nothing was metered. A
265
+ * caller must neither be billed for the server's inability to read a file
266
+ * nor be able to bypass the page cap by producing one. ⚠️ It is NOT the
267
+ * ordinary compressed-object-stream file — those are inflated and counted
268
+ * like any other. What reaches this code is a document under a compression
269
+ * filter the server does not implement, or one whose streams exceed its
270
+ * inflate budget. Re-exporting the PDF from the source application is the
271
+ * remedy a client should offer.
255
272
  * - `COST_CEILING_EXCEEDED` · 403 OR 503, and the app must switch on which.
256
273
  * 403 is the TENANT's own ceiling and carries `feature: 'aiFeatures'`; 503
257
274
  * is the platform-wide ceiling and is an operator hard-stop that no tenant
@@ -294,7 +311,7 @@ declare global {
294
311
  * entitled. Check `GatingErrorCode` IN ADDITION to this union, never instead
295
312
  * of it.
296
313
  */
297
- type SupplierDocExtractErrorCode = 'INVALID_BASE64' | 'UNSUPPORTED_MEDIA_TYPE' | 'CONTENT_TOO_LARGE' | 'DOCUMENT_TOO_MANY_PAGES' | 'COST_CEILING_EXCEEDED' | 'AI_DOC_EXTRACT_DISABLED' | 'AI_OPT_OUT' | 'DOC_EXTRACT_BLOCKED' | 'DOC_EXTRACT_TOO_LONG' | 'DOC_EXTRACT_GENERATION_FAILED';
314
+ type SupplierDocExtractErrorCode = 'INVALID_BASE64' | 'UNSUPPORTED_MEDIA_TYPE' | 'CONTENT_TOO_LARGE' | 'DOCUMENT_TOO_MANY_PAGES' | 'DOCUMENT_PAGE_COUNT_UNREADABLE' | 'COST_CEILING_EXCEEDED' | 'AI_DOC_EXTRACT_DISABLED' | 'AI_OPT_OUT' | 'DOC_EXTRACT_BLOCKED' | 'DOC_EXTRACT_TOO_LONG' | 'DOC_EXTRACT_GENERATION_FAILED';
298
315
  /**
299
316
  * One suggested line.
300
317
  *
@@ -426,11 +443,13 @@ declare global {
426
443
  * resets at midnight instead. ⚠️ The code lands in BOTH `error` and
427
444
  * `message`, matching the shipped ceiling mapper: `message` is NOT prose on
428
445
  * this member and must not be shown to a user verbatim.
429
- * - `AI_OPT_OUT` · 403 — this store switched AI off, explicitly. The same code
430
- * the sibling AI endpoints use, not a second spelling of it. ⚠️ A store read
431
- * that THREW does NOT answer this: the gate is fail-closed in that it never
432
- * proceeds, but it RETHROWS, so the wire answer is the wrapper's 500, not a
433
- * 403. Do not treat this code as covering "AI may be off".
446
+ * - `AI_OPT_OUT` · 403 — this store switched AI off. The same code every
447
+ * sibling AI endpoint uses, not a second spelling of it. ⚠️ A store read
448
+ * that THREW answers this TOO: the gate is fail-closed and every AI lane
449
+ * now maps an unreadable opt-out state onto this same refusal rather than
450
+ * some rethrowing to a 500 — a spend must not proceed on an unknown
451
+ * opt-out state, and the answer must not depend on which lane was called.
452
+ * So read this code as "AI is off, or we could not confirm it is on".
434
453
  * - `QUOTE_DRAFT_BLOCKED` · 422 — the guardrail refused the request. ⚠️
435
454
  * Carries one DOCUMENTED EXTRA key, `reason: string` — the guardrail's
436
455
  * filter TYPE NAMES, never the blocked content. It is the only member with
@@ -935,9 +935,15 @@ declare global {
935
935
  * What the campaign is FOR, in the tenant's own words — INSTRUCTIONS, never
936
936
  * facts. Non-empty, at most {@link MARKETING_COPY_GOAL_MAX_CHARS} characters.
937
937
  *
938
- * ⚠️ Nothing here is citable evidence: a claim the copy makes has to come
939
- * from {@link MarketingCopyRequest.facts}, so a discount written only into
940
- * the goal is dropped from the output rather than asserted.
938
+ * ⚠️ Nothing here is citable evidence for a CLAIM: every entry of
939
+ * {@link MarketingCopySuggestion.claims} must appear verbatim in
940
+ * {@link MarketingCopyRequest.facts}, so a discount written only into the
941
+ * goal is never returned as a claim.
942
+ *
943
+ * ⚠️ It IS in scope for the FIGURE belt, which is a different question. A
944
+ * number the operator typed here ("liquidación 30% off") may appear in the
945
+ * generated subject or body, because the operator plainly said it; a number
946
+ * NEITHER the goal nor the facts carries drops the whole suggestion.
941
947
  */
942
948
  goal: string;
943
949
  /**
@@ -995,6 +1001,18 @@ declare global {
995
1001
  * ⚠️ A claim the source does not contain is DROPPED server-side rather than
996
1002
  * returned flagged, so an empty array means the copy asserts no facts — not
997
1003
  * that the belt was skipped.
1004
+ *
1005
+ * ⚠️ **This array is NOT what makes the copy truthful, and an empty one
1006
+ * proves nothing about the text.** Every numeric, currency, percentage,
1007
+ * instalment, multibuy, duration and date figure in
1008
+ * {@link MarketingCopySuggestion.subject} and
1009
+ * {@link MarketingCopySuggestion.body} is separately checked against the
1010
+ * tenant's facts plus the operator's brief, and a suggestion carrying one
1011
+ * the tenant never supplied is dropped WHOLE rather than returned with a
1012
+ * tidy claims array. The check reads the figure's KIND as well as its
1013
+ * quantity — a peso fact does not license a dollar claim — and sees the
1014
+ * spelled-out forms (`tres cuotas`, `mitad de precio`) as the figures
1015
+ * they are.
998
1016
  */
999
1017
  claims: string[];
1000
1018
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sinfactura-types",
3
- "version": "1.10.360",
3
+ "version": "1.10.362",
4
4
  "description": "Shared wire and entity contracts for the SINFACTURA platform.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",