@wildo-ai/zod-decorators 1.1.2 → 1.1.3

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.
@@ -729,7 +729,14 @@ export const FileMimeTypeGroups = {
729
729
  ],
730
730
  };
731
731
  /**
732
- * File nature classification for constraint validation and UI display.
732
+ * @wildo_source:part:start zod.decorators.file-vocabularies facet:layer:shared facet:audience:app-developer
733
+ *
734
+ * The vocabularies a `z_file()` field selects from. Pick a member of each; the option bag names the
735
+ * type, and these are the values.
736
+ *
737
+ * File nature classification, chosen with `z_file({ nature })`. It selects which per-nature
738
+ * constraint bag applies and how the form control and display surface behave. `ALL` accepts any
739
+ * kind and is the right answer for a generic attachment field.
733
740
  */
734
741
  export var FileNature;
735
742
  (function (FileNature) {
@@ -741,6 +748,7 @@ export var FileNature;
741
748
  FileNature["ARCHIVE"] = "archive";
742
749
  FileNature["ALL"] = "all";
743
750
  })(FileNature || (FileNature = {}));
751
+ /** @wildo_source:part:end zod.decorators.file-vocabularies */
744
752
  /**
745
753
  * Rendering-level file nature categories.
746
754
  *
@@ -835,7 +843,19 @@ export var FileActivationPolicy;
835
843
  FileActivationPolicy["CUSTOM"] = "custom";
836
844
  })(FileActivationPolicy || (FileActivationPolicy = {}));
837
845
  /**
838
- * Storage providers accepted for file uploads.
846
+ * @wildo_source:part:start zod.decorators.file-vocabularies
847
+ *
848
+ * Where a field's bytes may be stored, chosen with `z_file({ storageAccepted: [...] })`. ORDER
849
+ * EXPRESSES PREFERENCE: list several and the first CONFIGURED one is used. Omit the option entirely
850
+ * and the field resolves to managed storage.
851
+ *
852
+ * ⚠️ **Only `WILDO_MANAGED` and `LOCAL_DIRECTORY` have a provider behind them.** `ONEDRIVE`,
853
+ * `GOOGLE_DRIVE` and `DROPBOX` are declared vocabulary with no implementation — a field naming only
854
+ * those has no configured provider, and startup configuration validation refuses the application
855
+ * rather than letting it serve a field that could never accept an upload.
856
+ *
857
+ * ⚠️ **The target is decided once, when the file is created, and the object never moves.** Changing
858
+ * a field's declared target changes where NEW files go; it does not relocate what is already stored.
839
859
  */
840
860
  export var FileStorageAccepted;
841
861
  (function (FileStorageAccepted) {
@@ -884,6 +904,39 @@ export const AudioFormat = {
884
904
  OGG: 'ogg',
885
905
  AAC: 'aac',
886
906
  };
907
+ /** @wildo_source:part:end zod.decorators.file-nature-constraints */
908
+ /*
909
+ * MAINTAINER NOTE — deliberately OUTSIDE the `zod.decorators.rag-source` anchor below, because the
910
+ * anchor ships into every generated application and an application author needs the vocabulary, not
911
+ * its history. The one sentence they DO need ("there is no semantic member, and why") is inside.
912
+ *
913
+ * ## `SEMANTIC` was a fifth member here, and was REMOVED on 2026-09-09 (#434)
914
+ *
915
+ * It read `SEMANTIC — split at embedding-detected topic boundaries` and was never implemented: every
916
+ * field authoring it silently degraded to `FIXED_SIZE`. The obvious fix was to build it. The measured
917
+ * answer is that it is not worth building, so the member went instead — recorded because "add the
918
+ * missing one back" is what the next reader will otherwise propose.
919
+ *
920
+ * Chroma's chunking evaluation benchmarks exactly this algorithm. Its `KamradtSemanticChunker` scored
921
+ * 83.6% recall / 1.5% precision against `RecursiveCharacterTextSplitter`'s 89.5% / 3.6% — worse on
922
+ * BOTH axes than the `RECURSIVE` member beside it — and the report calls it "slightly below average
923
+ * across all metrics". A 2026 cost-versus-effectiveness study reached the same conclusion
924
+ * independently: expensive chunking methods "do not yield meaningful effectiveness improvements while
925
+ * introducing substantially higher computational overhead", with only fixed-size and recursive
926
+ * "robust across datasets".
927
+ * spec-cite: Chroma, "Evaluating Chunking Strategies for Retrieval"
928
+ * (https://www.trychroma.com/research/evaluating-chunking); arXiv:2606.00881. Both read 2026-09-09.
929
+ *
930
+ * The architectural cost was the other half, and it is Wildo-specific. Boundaries computed from
931
+ * embeddings make the CHUNKER a client of the embeddings provider on the resource WRITE path, and
932
+ * force the embedding model into `chunkingConfigHash` — after which a model migration RE-CHUNKS
933
+ * rather than re-embedding in place, discarding exactly the property the dimension-flexible vector
934
+ * column and the deferred `rag:embedding-drain` batch exist to provide.
935
+ *
936
+ * If retrieval quality is ever the MEASURED bottleneck, the evidence points at CONTEXTUAL RETRIEVAL
937
+ * (prepend document-level context to each chunk before embedding), not at topic boundaries. That
938
+ * changes what is embedded rather than when boundaries are computed, so it costs none of the above.
939
+ */
887
940
  /**
888
941
  * @wildo_source:part:start zod.decorators.rag-source facet:layer:shared facet:family:decorator facet:family:param-surface facet:kind:api facet:audience:app-developer
889
942
  *
@@ -902,7 +955,6 @@ export const AudioFormat = {
902
955
  *
903
956
  * - `FIXED_SIZE` — split every `chunkSize` characters/tokens regardless of structure.
904
957
  * - `RECURSIVE` — split on a separator hierarchy (paragraph → sentence → word) down to `chunkSize`.
905
- * - `SEMANTIC` — split at embedding-detected topic boundaries.
906
958
  * - `MARKDOWN` — split on markdown structure (headings, lists, code fences).
907
959
  * - `CODE` — split on source-code structure (functions, classes, blocks). Unified in (2026-08-26)
908
960
  * from a second copy of this vocabulary that `saas-models` then carried: the member sets differed
@@ -910,11 +962,16 @@ export const AudioFormat = {
910
962
  * invalidated configurations authored against the wider one — so the union won. That second copy,
911
963
  * and the agent-level RAG configuration schemas around it, were retired on 2026-08-27 as a
912
964
  * pre-capability design the shipped capability superseded; this object is now the only home.
965
+ *
966
+ * There is deliberately NO semantic/embedding-based member. It is the option people reach for
967
+ * first, and published evaluations put it BELOW `RECURSIVE` on both recall and precision while
968
+ * costing an embedding pass per document — so `RECURSIVE` is the right default for prose, and the
969
+ * two structure-aware members are for text whose structure carries meaning.
970
+ *
913
971
  */
914
972
  export const RAGChunkingStrategy = {
915
973
  FIXED_SIZE: 'fixed_size',
916
974
  RECURSIVE: 'recursive',
917
- SEMANTIC: 'semantic',
918
975
  MARKDOWN: 'markdown',
919
976
  CODE: 'code',
920
977
  };
@@ -933,6 +990,15 @@ export var FileGenerationSource;
933
990
  FileGenerationSource["PDF_TEMPLATE"] = "pdfTemplate";
934
991
  })(FileGenerationSource || (FileGenerationSource = {}));
935
992
  /**
993
+ * @wildo_source:part:start zod.decorators.file-vocabularies
994
+ *
995
+ * What happens to the file when its parent record is deleted, chosen with
996
+ * `z_file({ onParentDelete })`. Defaults to `CASCADE`.
997
+ *
998
+ * ⚠️ `SOFT_DELETE` behaves IDENTICALLY to `CASCADE` at runtime today. It exists as an explicit
999
+ * semantic marker for consumers that want to model a softer intent — choosing it does not currently
1000
+ * change what happens to the file.
1001
+ *
936
1002
  * File behavior when parent resource is deleted.
937
1003
  * - CASCADE: Mark the file deleted as part of parent removal; physical storage cleanup is deferred to the cleanup batch
938
1004
  * - SOFT_DELETE: Same current runtime behavior as CASCADE, but keeps an explicit semantic marker for consumers that want to model softer intent
@@ -1339,10 +1405,12 @@ export var ZodDecorator;
1339
1405
  * could ask to have erased.
1340
1406
  *
1341
1407
  * ⚠️ This is a WRITE-side claim — "when this field CHANGES, the change itself is evidence" — and
1342
- * is independent of the READ-side disclosure trail. The only disclosure trigger the framework has
1343
- * is `isBackendOnly({ isReturnedAtCreation: true })`, which fires one `FIELD_ACCESS` event when a
1344
- * server-minted secret is first exposed. A field can carry either, both, or neither. There is no
1345
- * general "audit every read of this field" marker — do not go looking for one.
1408
+ * is independent of the READ-side disclosure trail. The framework has exactly two disclosure
1409
+ * triggers: `isBackendOnly({ isReturnedAtCreation: true })`, which fires one `FIELD_ACCESS` event
1410
+ * when a server-minted secret is first exposed on a create, and `.isEphemeral()`, which fires on
1411
+ * any operation so a rotate or regenerate is recorded as well. A field can carry any combination
1412
+ * of the three markers. There is still no general "audit every read of this field" marker; do not
1413
+ * go looking for one.
1346
1414
  *
1347
1415
  * assurance-control: WILDO.SECRETS.DISCLOSURE_AUDIT
1348
1416
  */