@hawkeyexl/manni 2.12.1 → 3.0.0

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/index.d.ts CHANGED
@@ -311,7 +311,12 @@ interface FingerprintContext {
311
311
  /** One external-metadata manifest (proposals 0037, 0038, 0039) joined to a collection. */
312
312
  interface ExternalMetadataConfig {
313
313
  file: string;
314
- keys: string[];
314
+ /**
315
+ * The top-level keys the manifest owns. Absent (proposal 0068), it owns
316
+ * what each page's schemas mark `x-manni-location: external`, as `ownsKey`
317
+ * decides.
318
+ */
319
+ keys?: string[];
315
320
  tokenEnv?: string;
316
321
  join?: string;
317
322
  }
@@ -411,6 +416,158 @@ interface ConfigFile {
411
416
  encryptionKeyPrevious?: string;
412
417
  }
413
418
 
419
+ interface BuiltinInfo {
420
+ id: string;
421
+ title: string;
422
+ description: string;
423
+ }
424
+ /**
425
+ * A schema `meta.register` loaded from a local file (proposal 0070), named
426
+ * everywhere by its own `$id`, as a built-in is named by its id.
427
+ */
428
+ interface RegisteredSchema {
429
+ /** The schema's `$id`: `vendor:name:version`, or an `https://` URL. */
430
+ id: string;
431
+ /** The file, relative to the config file's directory, with forward slashes. */
432
+ file: string;
433
+ /** The file's absolute path. */
434
+ path: string;
435
+ /** The parsed schema: the object every lookup of `id` returns. */
436
+ schema: Record<string, unknown>;
437
+ }
438
+ /** The registered schemas of one config, keyed by `$id`. */
439
+ type RegisteredSchemas = ReadonlyMap<string, RegisteredSchema>;
440
+ declare function listBuiltins(): BuiltinInfo[];
441
+ type RefKind = "builtin" | "file" | "url";
442
+ declare function classifyRef(ref: string): {
443
+ kind: RefKind;
444
+ ref: string;
445
+ };
446
+ /**
447
+ * What a config recorded about one reference beyond the reference itself.
448
+ *
449
+ * Kept out of the ref string deliberately: the ref appears in every report,
450
+ * every baseline fingerprint, and `Validator`'s compile cache key, so it has to
451
+ * stay exactly the string the user wrote.
452
+ */
453
+ interface SchemaPin {
454
+ /** Where the reference was vendored from — a URL, or a local path. */
455
+ source?: string;
456
+ /** `sha256-<64 hex>` the file's bytes must hash to. */
457
+ integrity?: string;
458
+ }
459
+ interface LoadSchemaOptions {
460
+ /**
461
+ * Directory a **relative local-file** ref is resolved against.
462
+ *
463
+ * Omitted means `process.cwd()`, which is what the CLI wants and what this
464
+ * always did. A library caller passing `cwd` to a command core needs the
465
+ * ref measured from *that* directory instead: `rebaseConfigSchemaRefs`
466
+ * deliberately leaves refs untouched when the config already sits in the
467
+ * run's `cwd`, so `./schema/house.json` arrives here exactly as written and
468
+ * was then read against the wrong directory.
469
+ *
470
+ * Resolved at read time rather than by rewriting the ref, and that choice is
471
+ * load-bearing: the ref string is what reports name, what `Validator` keys
472
+ * its compile cache on, and what every baseline fingerprint is taken over.
473
+ * Rewriting it to an absolute path would silently move every recorded
474
+ * baseline. `canonicalSchemaRef` in `baseline.ts` already measures a relative
475
+ * ref from the run's `cwd`, so this makes loading agree with fingerprinting
476
+ * rather than introducing a new convention.
477
+ */
478
+ fileBase?: string;
479
+ /** Abort a remote fetch after this many ms (default 10_000). */
480
+ timeoutMs?: number;
481
+ /** Reject a remote schema whose body exceeds this many bytes (default 5 MB). */
482
+ maxBytes?: number;
483
+ /**
484
+ * Directory for the cross-run schema cache. Omitted means **no disk cache**:
485
+ * the registry never guesses a project root, so a library caller gets the
486
+ * in-process behavior until it opts in. The command cores pass
487
+ * `schemaCacheDir(configDir ?? cwd)`.
488
+ */
489
+ cacheDir?: string;
490
+ /** Hours a cached entry stays fresh; `0` disables the cache (default 24). */
491
+ ttlHours?: number;
492
+ /**
493
+ * Never touch the network. A URL ref resolves from the disk cache — ignoring
494
+ * the TTL, since there is no re-fetch to fall back on — and an uncached one
495
+ * fails naming the URL. Built-ins and local files are unaffected.
496
+ *
497
+ * This is a *durability* control, not a trust boundary, and it never was:
498
+ * whether a document may name a URL at all is decided upstream by
499
+ * `schemaTrust` in `resolveSchemaSet`, which is the last place that still
500
+ * knows a ref came from a document rather than from an operator (proposal
501
+ * 0015). `offline` used to block that case by accident and was the only thing
502
+ * standing there; it is now free to mean only what it says.
503
+ */
504
+ offline?: boolean;
505
+ /**
506
+ * Provenance and integrity pins, keyed on the reference exactly as it is
507
+ * passed to `loadSchema`. Built by `collectSchemaPins` from the **rebased**
508
+ * config, so both sides spell a local path the same way; a config with no
509
+ * mapping-form `schemas:` entries produces an empty map and none of this
510
+ * runs.
511
+ */
512
+ pins?: ReadonlyMap<string, SchemaPin>;
513
+ /**
514
+ * The schemas `meta.register` loaded (proposal 0070), keyed by `$id`. A ref
515
+ * naming one resolves to its file's schema before anything else is
516
+ * consulted, so a registered `https://` id is never fetched.
517
+ */
518
+ registered?: RegisteredSchemas;
519
+ }
520
+ /** A fetched schema, with the bytes it arrived as. */
521
+ interface FetchedSchema {
522
+ /** Exactly what the server sent, undecoded. */
523
+ bytes: Buffer;
524
+ /** The same payload, parsed and guarded. */
525
+ schema: Record<string, unknown>;
526
+ }
527
+ /**
528
+ * Fetch, size-cap, parse, and guard a remote schema. At most two requests.
529
+ *
530
+ * Exported for `schemas vendor`, which needs the raw bytes to write and to
531
+ * hash. Sharing this path rather than fetching separately is what keeps
532
+ * vendoring subject to the same size cap, retry policy, and payload guard as
533
+ * validation — a vendored error envelope would otherwise be committed to the
534
+ * repository and pass every document from then on.
535
+ *
536
+ * Deliberately **not** routed through the disk cache or `offline`: vendoring is
537
+ * an explicit request to download, and the cache stores a parsed schema rather
538
+ * than the bytes a pin has to be taken over.
539
+ */
540
+ declare function fetchSchemaBytes(ref: string, options?: LoadSchemaOptions): Promise<FetchedSchema>;
541
+ /**
542
+ * Settle the remote-schema options for one run, from the config and the flag.
543
+ *
544
+ * Lives here rather than in a command core because all three commands need the
545
+ * same answer, and because "where does the cache live" is a property of schema
546
+ * loading, not of `validate`. `root` is the config's directory when a config
547
+ * governs the run, so a developer running from `docs/` shares the cache with
548
+ * CI running from the repo root instead of quietly keeping a second one.
549
+ */
550
+ declare function schemaLoadOptions(args: {
551
+ root: string;
552
+ /**
553
+ * Where a relative local-file schema ref is measured from — the run's `cwd`,
554
+ * not `root`. The two differ when a config was discovered in an ancestor, and
555
+ * a `--schema ./x.json` typed on the command line belongs to the directory
556
+ * the user was standing in, not to the config's.
557
+ */
558
+ fileBase?: string;
559
+ /** Config `schemaCache.ttlHours`. */
560
+ ttlHours?: number;
561
+ /** `--offline`, else config `offline:`. */
562
+ offline?: boolean;
563
+ /** From `collectSchemaPins(config)`; omitted when the config pins nothing. */
564
+ pins?: ReadonlyMap<string, SchemaPin>;
565
+ /** The config's registered schemas (`config.registered`), when it has any. */
566
+ registered?: RegisteredSchemas;
567
+ }): LoadSchemaOptions;
568
+ /** Load and return the JSON Schema object for a reference. */
569
+ declare function loadSchema(ref: string, options?: LoadSchemaOptions): Promise<Record<string, unknown>>;
570
+
414
571
  /** Lines as an entry writes them: an integer for one line, `"L1-L2"` for several. */
415
572
  type LineSpec = number | string;
416
573
  /** Page lines as an editor numbers them, 1-based and inclusive. */
@@ -557,6 +714,16 @@ interface RangeResult {
557
714
  /** The seven built-in fields, in the order messages list them. */
558
715
  declare const DERIVABLE_FIELDS: readonly ["created", "last-updated", "authors", "owner", "reviewed-by", "last-reviewed", "provenance"];
559
716
  type BuiltinDerivableField = (typeof DERIVABLE_FIELDS)[number];
717
+ /**
718
+ * The merge-safe fields (proposal 0069), in the order messages list them:
719
+ * the ones whose stamp, written in a pull request, still reads current after
720
+ * a squash merge. `derive.fields` absent manages these, and on each page only
721
+ * the ones its schemas claim.
722
+ */
723
+ declare const MERGE_SAFE_FIELDS: readonly ["owner", "created", "last-updated", "provenance"];
724
+ /** The dated fields the git source reads from the stamp a fact commit carries. */
725
+ declare const STAMPED_DATE_FIELDS: readonly ["created", "last-updated"];
726
+ type StampedDateField = (typeof STAMPED_DATE_FIELDS)[number];
560
727
  /**
561
728
  * A managed field name: one of the seven built-ins, or a key with an entry in
562
729
  * `derive.commands`. The config parser guarantees one or the other.
@@ -644,7 +811,14 @@ interface DeriveInput {
644
811
  * (proposal 0046), so evidence rule 2 reads the manifest's blob at each
645
812
  * commit rather than the page's frontmatter. Absent: the page's own.
646
813
  */
647
- provenanceManifest?: ProvenanceManifestRef;
814
+ provenanceManifest?: ManifestRef;
815
+ /**
816
+ * Where the page's `created` and `last-updated` live when a manifest owns
817
+ * them (proposal 0069, rule 1), so the git source reads the stamp a fact
818
+ * commit carries from the manifest's blob at that commit as well as from
819
+ * the page's. A field with no entry: the page's own.
820
+ */
821
+ stampManifests?: Partial<Readonly<Record<StampedDateField, ManifestRef>>>;
648
822
  /**
649
823
  * `manni meta derive <path>:L1-L2 --generated-by <name>`: the file lines
650
824
  * each target names go to `generatedBy`, committed or not, unless evidence
@@ -657,8 +831,8 @@ interface DeriveInput {
657
831
  generatedBy: string;
658
832
  };
659
833
  }
660
- /** A manifest that holds one page's `provenance`, as the git source reads it at a commit. */
661
- interface ProvenanceManifestRef {
834
+ /** A manifest that holds one page's managed field, as the git source reads it at a commit. */
835
+ interface ManifestRef {
662
836
  /** The manifest file, absolute. */
663
837
  absPath: string;
664
838
  /** The page's key there: its path relative to the config directory, or its join value. */
@@ -801,6 +975,17 @@ interface SchemaOverride {
801
975
  * trap.
802
976
  */
803
977
  elements?: string[];
978
+ /**
979
+ * Put the default set first, then this entry's `schemas` (proposal 0070).
980
+ * Absent or `false` means the entry's `schemas` replace the set, as an
981
+ * override always did. An override never inherits the top-level `schemas`.
982
+ */
983
+ defaults?: boolean;
984
+ /**
985
+ * Stack the strict version of each default or registered schema in the
986
+ * entry's set right after its base, where one exists.
987
+ */
988
+ strict?: boolean;
804
989
  }
805
990
  /**
806
991
  * A `schemas:` entry in its long form: a reference plus where it came from and
@@ -886,8 +1071,12 @@ interface DeriveConfig {
886
1071
  * The managed fields. Each is one of `DERIVABLE_FIELDS` or a key of
887
1072
  * `commands`, never `$schema`, and never a key a manifest owns: a value
888
1073
  * with two authorities has none.
1074
+ *
1075
+ * Absent means the merge-safe fields (`MERGE_SAFE_FIELDS`, proposal 0069),
1076
+ * each managed only on a page whose schemas claim it as a top-level
1077
+ * property. `[]` manages nothing. Read it through `managedFields`.
889
1078
  */
890
- fields: DerivableField[];
1079
+ fields?: DerivableField[];
891
1080
  /** Which sources to consult; absent means all of `DERIVE_SOURCES`. */
892
1081
  sources?: DeriveSource[];
893
1082
  /**
@@ -909,6 +1098,12 @@ interface DeriveConfig {
909
1098
  * through `machinesOf`.
910
1099
  */
911
1100
  machines?: string[];
1101
+ /**
1102
+ * The collections whose members derive manages (proposal 0070). A file in
1103
+ * none of them is neither stamped nor compared. Absent means every
1104
+ * validated file. Read it through `deriveCovers`.
1105
+ */
1106
+ collections?: string[];
912
1107
  }
913
1108
  /** Defaults for the `fill` command; every key is overridable by a CLI flag. */
914
1109
  interface FillConfig {
@@ -932,10 +1127,33 @@ interface SchemaCacheConfig {
932
1127
  }
933
1128
  interface DocmetaConfig {
934
1129
  /**
935
- * The default schema set. Each entry is either a reference string or a
936
- * `{ ref, source?, integrity? }` mapping — see `SchemaEntry`.
1130
+ * The schemas every file no override matches is judged by. Each entry is
1131
+ * either a reference string or a `{ ref, source?, integrity? }` mapping —
1132
+ * see `SchemaEntry`. They join the default set unless `defaults` is false.
937
1133
  */
938
1134
  schemas?: SchemaEntry[];
1135
+ /**
1136
+ * Put the default set first, then `schemas`, for the files no override
1137
+ * matches (proposal 0070). Absent means `true`; `false` makes `schemas`
1138
+ * replace the default set.
1139
+ */
1140
+ defaults?: boolean;
1141
+ /**
1142
+ * For those files, stack the strict version of each default or registered
1143
+ * schema in the set right after its base, where one exists. Absent means
1144
+ * `false`.
1145
+ */
1146
+ strict?: boolean;
1147
+ /**
1148
+ * JSON Schema files, or directories of them (`*.json`, recursively),
1149
+ * relative to the config file. Each is loaded once and named by its `$id`.
1150
+ */
1151
+ register?: string[];
1152
+ /**
1153
+ * The schemas `register` names, loaded by `loadConfig` and keyed by `$id`.
1154
+ * Not a key of the file: it is what the file's `register` produced.
1155
+ */
1156
+ registered?: RegisteredSchemas;
939
1157
  overrides?: SchemaOverride[];
940
1158
  /**
941
1159
  * Named corpus checks `validate` runs after the per-file schemas, when the
@@ -1592,7 +1810,21 @@ declare function loadExternalMetadata(collections: readonly CollectionConfig[],
1592
1810
  */
1593
1811
  declare function mergeExternalMetadata(label: string, extracted: ExtractedMetadata, index: ExternalMetadataIndex | null, memberOf: readonly string[], base: string, options?: {
1594
1812
  encryptionKey?: () => string | undefined;
1813
+ /**
1814
+ * The top-level keys the document's schemas mark `x-manni-location:
1815
+ * external` (proposal 0068), which is what a manifest with no `keys`
1816
+ * owns. Absent, such a manifest owns nothing for this document.
1817
+ */
1818
+ marked?: ReadonlySet<string>;
1595
1819
  }): MergedMetadata;
1820
+ /**
1821
+ * The top-level keys one document's schemas mark `x-manni-location:
1822
+ * external`, read over `probe`: the document's metadata with everything its
1823
+ * keyless manifests supply for it (proposal 0068). `undefined` when the
1824
+ * document's schemas cannot be resolved or loaded, so the caller reports that
1825
+ * the way it always has and a keyless manifest owns nothing for it.
1826
+ */
1827
+ type PageMarks = (label: string, probe: Readonly<Record<string, unknown>>, memberOf: readonly string[]) => Promise<ReadonlySet<string> | undefined>;
1596
1828
  /** The `/key` pointer for an external-metadata finding, RFC 6901 escaped. */
1597
1829
  declare function externalMetadataPointer(key: string): string;
1598
1830
  /**
@@ -1622,134 +1854,6 @@ declare function orphanJoins(index: ExternalMetadataIndex | null, matched: Reado
1622
1854
  /** The operational error an orphan check raises, naming the first entry. */
1623
1855
  declare function orphanError(orphans: readonly ExternalMetadataEntry[]): DocmetaError;
1624
1856
 
1625
- interface BuiltinInfo {
1626
- id: string;
1627
- title: string;
1628
- description: string;
1629
- }
1630
- declare function listBuiltins(): BuiltinInfo[];
1631
- type RefKind = "builtin" | "file" | "url";
1632
- declare function classifyRef(ref: string): {
1633
- kind: RefKind;
1634
- ref: string;
1635
- };
1636
- /**
1637
- * What a config recorded about one reference beyond the reference itself.
1638
- *
1639
- * Kept out of the ref string deliberately: the ref appears in every report,
1640
- * every baseline fingerprint, and `Validator`'s compile cache key, so it has to
1641
- * stay exactly the string the user wrote.
1642
- */
1643
- interface SchemaPin {
1644
- /** Where the reference was vendored from — a URL, or a local path. */
1645
- source?: string;
1646
- /** `sha256-<64 hex>` the file's bytes must hash to. */
1647
- integrity?: string;
1648
- }
1649
- interface LoadSchemaOptions {
1650
- /**
1651
- * Directory a **relative local-file** ref is resolved against.
1652
- *
1653
- * Omitted means `process.cwd()`, which is what the CLI wants and what this
1654
- * always did. A library caller passing `cwd` to a command core needs the
1655
- * ref measured from *that* directory instead: `rebaseConfigSchemaRefs`
1656
- * deliberately leaves refs untouched when the config already sits in the
1657
- * run's `cwd`, so `./schema/house.json` arrives here exactly as written and
1658
- * was then read against the wrong directory.
1659
- *
1660
- * Resolved at read time rather than by rewriting the ref, and that choice is
1661
- * load-bearing: the ref string is what reports name, what `Validator` keys
1662
- * its compile cache on, and what every baseline fingerprint is taken over.
1663
- * Rewriting it to an absolute path would silently move every recorded
1664
- * baseline. `canonicalSchemaRef` in `baseline.ts` already measures a relative
1665
- * ref from the run's `cwd`, so this makes loading agree with fingerprinting
1666
- * rather than introducing a new convention.
1667
- */
1668
- fileBase?: string;
1669
- /** Abort a remote fetch after this many ms (default 10_000). */
1670
- timeoutMs?: number;
1671
- /** Reject a remote schema whose body exceeds this many bytes (default 5 MB). */
1672
- maxBytes?: number;
1673
- /**
1674
- * Directory for the cross-run schema cache. Omitted means **no disk cache**:
1675
- * the registry never guesses a project root, so a library caller gets the
1676
- * in-process behavior until it opts in. The command cores pass
1677
- * `schemaCacheDir(configDir ?? cwd)`.
1678
- */
1679
- cacheDir?: string;
1680
- /** Hours a cached entry stays fresh; `0` disables the cache (default 24). */
1681
- ttlHours?: number;
1682
- /**
1683
- * Never touch the network. A URL ref resolves from the disk cache — ignoring
1684
- * the TTL, since there is no re-fetch to fall back on — and an uncached one
1685
- * fails naming the URL. Built-ins and local files are unaffected.
1686
- *
1687
- * This is a *durability* control, not a trust boundary, and it never was:
1688
- * whether a document may name a URL at all is decided upstream by
1689
- * `schemaTrust` in `resolveSchemaSet`, which is the last place that still
1690
- * knows a ref came from a document rather than from an operator (proposal
1691
- * 0015). `offline` used to block that case by accident and was the only thing
1692
- * standing there; it is now free to mean only what it says.
1693
- */
1694
- offline?: boolean;
1695
- /**
1696
- * Provenance and integrity pins, keyed on the reference exactly as it is
1697
- * passed to `loadSchema`. Built by `collectSchemaPins` from the **rebased**
1698
- * config, so both sides spell a local path the same way; a config with no
1699
- * mapping-form `schemas:` entries produces an empty map and none of this
1700
- * runs.
1701
- */
1702
- pins?: ReadonlyMap<string, SchemaPin>;
1703
- }
1704
- /** A fetched schema, with the bytes it arrived as. */
1705
- interface FetchedSchema {
1706
- /** Exactly what the server sent, undecoded. */
1707
- bytes: Buffer;
1708
- /** The same payload, parsed and guarded. */
1709
- schema: Record<string, unknown>;
1710
- }
1711
- /**
1712
- * Fetch, size-cap, parse, and guard a remote schema. At most two requests.
1713
- *
1714
- * Exported for `schemas vendor`, which needs the raw bytes to write and to
1715
- * hash. Sharing this path rather than fetching separately is what keeps
1716
- * vendoring subject to the same size cap, retry policy, and payload guard as
1717
- * validation — a vendored error envelope would otherwise be committed to the
1718
- * repository and pass every document from then on.
1719
- *
1720
- * Deliberately **not** routed through the disk cache or `offline`: vendoring is
1721
- * an explicit request to download, and the cache stores a parsed schema rather
1722
- * than the bytes a pin has to be taken over.
1723
- */
1724
- declare function fetchSchemaBytes(ref: string, options?: LoadSchemaOptions): Promise<FetchedSchema>;
1725
- /**
1726
- * Settle the remote-schema options for one run, from the config and the flag.
1727
- *
1728
- * Lives here rather than in a command core because all three commands need the
1729
- * same answer, and because "where does the cache live" is a property of schema
1730
- * loading, not of `validate`. `root` is the config's directory when a config
1731
- * governs the run, so a developer running from `docs/` shares the cache with
1732
- * CI running from the repo root instead of quietly keeping a second one.
1733
- */
1734
- declare function schemaLoadOptions(args: {
1735
- root: string;
1736
- /**
1737
- * Where a relative local-file schema ref is measured from — the run's `cwd`,
1738
- * not `root`. The two differ when a config was discovered in an ancestor, and
1739
- * a `--schema ./x.json` typed on the command line belongs to the directory
1740
- * the user was standing in, not to the config's.
1741
- */
1742
- fileBase?: string;
1743
- /** Config `schemaCache.ttlHours`. */
1744
- ttlHours?: number;
1745
- /** `--offline`, else config `offline:`. */
1746
- offline?: boolean;
1747
- /** From `collectSchemaPins(config)`; omitted when the config pins nothing. */
1748
- pins?: ReadonlyMap<string, SchemaPin>;
1749
- }): LoadSchemaOptions;
1750
- /** Load and return the JSON Schema object for a reference. */
1751
- declare function loadSchema(ref: string, options?: LoadSchemaOptions): Promise<Record<string, unknown>>;
1752
-
1753
1857
  /**
1754
1858
  * `x-manni-location` (proposal 0047): where a schema would like a top-level
1755
1859
  * key's value stored, on the page or in external metadata.
@@ -1843,6 +1947,16 @@ declare class Validator {
1843
1947
  * whose evaluated branches say both gives that key no preference.
1844
1948
  */
1845
1949
  locationPreferences(data: Record<string, unknown>, refs: string[]): Promise<Map<string, LocationPreference>>;
1950
+ /**
1951
+ * The top-level property names the schemas in `refs` claim: the keys of
1952
+ * each schema's own `properties`, each once. What a page's schema set
1953
+ * claims decides which merge-safe fields a `derive:` block with no `fields`
1954
+ * manages on it (proposal 0069). A property reached only through `allOf`,
1955
+ * `$ref` or a conditional is not counted, so a schema that should manage a
1956
+ * field names it in its root `properties`. A schema that fails to load or
1957
+ * compile throws, as it would for `validate`.
1958
+ */
1959
+ claimedProperties(refs: readonly string[]): Promise<Set<string>>;
1846
1960
  /**
1847
1961
  * Validate `data` against every schema in `refs`. Returns all violations,
1848
1962
  * each tagged with the schema that produced it and a source line via
@@ -2129,8 +2243,16 @@ interface QueryRun {
2129
2243
  }
2130
2244
  declare function runQuery(opts: QueryOptions): Promise<QueryRun>;
2131
2245
 
2246
+ /** One schema `meta.register` loaded: its `$id` and its file. */
2247
+ interface RegisteredInfo {
2248
+ id: string;
2249
+ /** Relative to the config file, with forward slashes. */
2250
+ file: string;
2251
+ }
2132
2252
  interface SchemasInfo {
2133
2253
  builtins: BuiltinInfo[];
2254
+ /** The governing config's registered schemas (proposal 0070). */
2255
+ registered: RegisteredInfo[];
2134
2256
  formats: {
2135
2257
  name: string;
2136
2258
  extensions: string[];
@@ -2138,7 +2260,7 @@ interface SchemasInfo {
2138
2260
  writable: boolean;
2139
2261
  }[];
2140
2262
  }
2141
- declare function getSchemasInfo(): SchemasInfo;
2263
+ declare function getSchemasInfo(registered?: RegisteredSchemas): SchemasInfo;
2142
2264
  /**
2143
2265
  * Where a vendored schema lands by default.
2144
2266
  *
@@ -2381,6 +2503,17 @@ interface FillOptions {
2381
2503
  concurrency?: number;
2382
2504
  /** Include the filled document on each result (used for stdin and tests). */
2383
2505
  includeContent?: boolean;
2506
+ /**
2507
+ * The glossary term labels offered for the fields that name a term. When
2508
+ * given, they are used instead of the registered term label source (see
2509
+ * `src/shared/term-labels.ts`). When absent, that source is used, if any.
2510
+ *
2511
+ * Labels only. The registered source also knows each term's id, which a
2512
+ * term relation (`broader`, `narrower`, `related-terms`, `see`) accepts as
2513
+ * `term check` does. With `termLabels`, no ids are known, so a relation
2514
+ * value must be a label; an id is retried and then skipped.
2515
+ */
2516
+ termLabels?: readonly string[];
2384
2517
  /** Test seam: bypasses `makeProvider`, so no API key is needed. */
2385
2518
  inferenceProvider?: InferenceProvider;
2386
2519
  /**
@@ -2606,11 +2739,15 @@ declare function reencryptMetadata(page: {
2606
2739
  }): ReencryptMetadataResult;
2607
2740
 
2608
2741
  /**
2609
- * Applied when nothing else resolves. Seven-Action is safe to include here
2610
- * because it constrains `action` — a key documents don't otherwise carry — and
2611
- * does not require it, so adding it fails nothing that passed before.
2612
- * Diataxis is deliberately absent: it both requires and constrains `type`, so
2613
- * defaulting it would fail every repo not already on Diataxis.
2742
+ * The default set (proposal 0070): what a file is judged by when nothing
2743
+ * replaces it, and what `schemas:` joins unless `defaults: false`.
2744
+ *
2745
+ * Seven-Action constrains `action`, a key documents don't otherwise carry,
2746
+ * and requires nothing. Diataxis is deliberately absent: it both requires and
2747
+ * constrains `type`, so defaulting it would fail every repo not already on
2748
+ * Diataxis. The manni vocabularies follow; core requires `title` and
2749
+ * `description`, and nothing else in the set requires anything.
2750
+ * Terminology, artifact-evals and every `-strict` overlay stay opt-in.
2614
2751
  */
2615
2752
  declare const DEFAULT_SCHEMAS: readonly string[];
2616
2753
  /**
@@ -3542,7 +3679,7 @@ interface CitationSource {
3542
3679
  /** The git commit hash the pin was taken at: 7 to 64 lowercase hex. */
3543
3680
  "commit-sha"?: string;
3544
3681
  }
3545
- /** One entry of `citations`, as the schema (`manni:citations:1.0.0-proposal.4`) spells it. */
3682
+ /** One entry of `citations`, as the schema (`manni:citations:1.0.0`) spells it. */
3546
3683
  interface Citation {
3547
3684
  id?: string;
3548
3685
  claim?: CitationClaim;
@@ -4992,6 +5129,45 @@ declare function shiftedEntries(opts: ShiftOptions): Shifted;
4992
5129
  /** A copy of a manifest entry with its `claim.lines` replaced. */
4993
5130
  declare function withClaimLines(entry: unknown, lines: LineSpec): unknown;
4994
5131
 
5132
+ interface SpliceManifestOptions {
5133
+ /**
5134
+ * The document entry: its path relative to the config's directory, or its
5135
+ * value of the join field when `join` names one. A path entry matches
5136
+ * however the manifest spells it (`./docs/a.md` is `docs/a.md`); a join
5137
+ * value matches exactly.
5138
+ */
5139
+ entry: string;
5140
+ /** The owned key to write. */
5141
+ key: string;
5142
+ /** The value to write. Mappings and lists are written in block style. */
5143
+ value: unknown;
5144
+ /** `path` (the default) or the frontmatter field the manifest joins on. */
5145
+ join?: string;
5146
+ /** The manifest as the run reports it, for error messages. */
5147
+ file?: string;
5148
+ }
5149
+ interface SplicedManifest {
5150
+ /** The whole manifest, with the one value rewritten. */
5151
+ text: string;
5152
+ /** 1-based line where the written value now starts. */
5153
+ line: number;
5154
+ }
5155
+ /**
5156
+ * Rewrite `options.key` of `options.entry` in the manifest `text` to
5157
+ * `options.value`, and return the new text and the line the value starts on.
5158
+ *
5159
+ * Throws `DocmetaError`, and never returns a partial result, when:
5160
+ * - the text is not valid YAML, or its top level is not a mapping;
5161
+ * - the entry is named twice, or is not a mapping;
5162
+ * - the key is set twice in the entry, or is `$schema`;
5163
+ * - the value is `undefined`;
5164
+ * - the key or entry is absent and would go into a flow mapping that has
5165
+ * members (`{ jira: A }`), which this writer does not add to;
5166
+ * - the key is written as an explicit `? key`;
5167
+ * - the result does not read back as written.
5168
+ */
5169
+ declare function spliceManifestValue(text: string, options: SpliceManifestOptions): SplicedManifest;
5170
+
4995
5171
  /** The one key cite keeps in a manifest. */
4996
5172
  declare const CITATIONS_KEY = "citations";
4997
5173
  /** A manifest that owns `citations` for one collection. */
@@ -5011,6 +5187,15 @@ interface CitationManifest {
5011
5187
  * created by the first write.
5012
5188
  */
5013
5189
  pattern?: string;
5190
+ /**
5191
+ * The manifest names no `keys` (proposal 0068), so it keeps a page's
5192
+ * citations only when the page's schemas mark `citations` external. The
5193
+ * declaration, for `ownsKey`.
5194
+ */
5195
+ implied?: {
5196
+ collection: CollectionConfig;
5197
+ manifest: ExternalMetadataConfig;
5198
+ };
5014
5199
  }
5015
5200
  /** Where one page's citations are kept, and what the manifest already holds. */
5016
5201
  interface PageSidecar {
@@ -5035,7 +5220,7 @@ interface CitationSidecars {
5035
5220
  configDir: string;
5036
5221
  /** Directory the run's file labels are relative to. */
5037
5222
  base: string;
5038
- forPage(label: string, content: string, format?: string): PageSidecar;
5223
+ forPage(label: string, content: string, format?: string): Promise<PageSidecar>;
5039
5224
  /**
5040
5225
  * Manifest entries naming a page this run did not load, under meta's own
5041
5226
  * corpus invariant. `covered` names the collections a `--collection` run
@@ -5069,6 +5254,11 @@ interface LoadSidecarOptions {
5069
5254
  key?: string;
5070
5255
  /** The tool's error class; `CiteError` unless a sibling command says otherwise. */
5071
5256
  toError?: (message: string) => Error;
5257
+ /**
5258
+ * What a page's schemas mark external (proposal 0068), asked only for a
5259
+ * page a manifest with no `keys` may keep citations for.
5260
+ */
5261
+ marks?: () => Promise<PageMarks | undefined>;
5072
5262
  }
5073
5263
  /** `collection <name>: citations cannot come from a URL manifest, because cite writes them.` */
5074
5264
  declare function urlManifestRefusal(source: string, collection: string): string;
@@ -5106,45 +5296,6 @@ declare function sidecarsFor(run: CiteRun, over?: {
5106
5296
  pages?: readonly string[];
5107
5297
  }): Promise<CitationSidecars | null>;
5108
5298
 
5109
- interface SpliceManifestOptions {
5110
- /**
5111
- * The document entry: its path relative to the config's directory, or its
5112
- * value of the join field when `join` names one. A path entry matches
5113
- * however the manifest spells it (`./docs/a.md` is `docs/a.md`); a join
5114
- * value matches exactly.
5115
- */
5116
- entry: string;
5117
- /** The owned key to write. */
5118
- key: string;
5119
- /** The value to write. Mappings and lists are written in block style. */
5120
- value: unknown;
5121
- /** `path` (the default) or the frontmatter field the manifest joins on. */
5122
- join?: string;
5123
- /** The manifest as the run reports it, for error messages. */
5124
- file?: string;
5125
- }
5126
- interface SplicedManifest {
5127
- /** The whole manifest, with the one value rewritten. */
5128
- text: string;
5129
- /** 1-based line where the written value now starts. */
5130
- line: number;
5131
- }
5132
- /**
5133
- * Rewrite `options.key` of `options.entry` in the manifest `text` to
5134
- * `options.value`, and return the new text and the line the value starts on.
5135
- *
5136
- * Throws `DocmetaError`, and never returns a partial result, when:
5137
- * - the text is not valid YAML, or its top level is not a mapping;
5138
- * - the entry is named twice, or is not a mapping;
5139
- * - the key is set twice in the entry, or is `$schema`;
5140
- * - the value is `undefined`;
5141
- * - the key or entry is absent and would go into a flow mapping that has
5142
- * members (`{ jira: A }`), which this writer does not add to;
5143
- * - the key is written as an explicit `? key`;
5144
- * - the result does not read back as written.
5145
- */
5146
- declare function spliceManifestValue(text: string, options: SpliceManifestOptions): SplicedManifest;
5147
-
5148
5299
  /** One entry's one key: what an edit rewrites, and what a conflict is about. */
5149
5300
  interface ManifestKey {
5150
5301
  /** The entry, as the manifest spells it. */
@@ -6050,4 +6201,4 @@ declare namespace index {
6050
6201
  export { type index_EncryptionContext as EncryptionContext, index_KeyError as KeyError, type index_KeyRotateOptions as KeyRotateOptions, type index_KeyRotateResult as KeyRotateResult, type index_KeySetOptions as KeySetOptions, type index_KeySetResult as KeySetResult, type index_KeySource as KeySource, type index_ResolvedKey as ResolvedKey, type index_RotateManifest as RotateManifest, type index_RotateOutcome as RotateOutcome, type index_RotatePage as RotatePage, type index_RotatedCitation as RotatedCitation, type index_RotatedManifestValue as RotatedManifestValue, type index_RotatedMetadata as RotatedMetadata, type index_RotatedValue as RotatedValue, type index_SkippedCitation as SkippedCitation, type index_SkippedManifestValue as SkippedManifestValue, type index_SkippedMetadata as SkippedMetadata, type index_SkippedValue as SkippedValue, index_decryptValue as decryptValue, index_encryptValue as encryptValue, index_isEncryptedValue as isEncryptedValue, index_resolveEncryptionKey as resolveEncryptionKey, index_runKeyRotate as runKeyRotate, index_runKeySet as runKeySet };
6051
6202
  }
6052
6203
 
6053
- export { type ApplyOptions, type Approval, type BaselineSummary, BinMissing, type BuiltinDerivableField, COMMON_FORMATS, type CheckConfig, type CollectionConfig, type CommandSourceOptions, type CommandSourceResult, type CommonFormat, type ConfigNotice, DEFAULT_SCHEMAS, DEFAULT_TTL_HOURS, DEFAULT_VENDOR_DIR, DERIVABLE_FIELDS, DERIVED_KEYWORD, DERIVED_STALE_SCHEMA, DERIVE_FORMATS, DERIVE_SOURCES, type DerivableField, type DeriveCommand, type DeriveCommandConfig, type DeriveConfig, type DeriveContext, type DeriveFileResult, type DeriveInput, type DeriveOptions, type DeriveReportFormat, type DeriveReportOptions, type DeriveResult, type DeriveRun, type DeriveSource, type DeriveSummary, type DerivedField, type DerivedRecord, type DerivedStatus, type DerivedValue, type DocmetaConfig, DocmetaError, type DocumentRefTrust, EXTERNAL_DUPLICATE_SCHEMA, EXTERNAL_KEYWORD, EXTERNAL_METADATA_FETCH_MAX_BYTES, EXTERNAL_METADATA_FETCH_TIMEOUT_MS, EXTERNAL_OWNED_SCHEMA, type ExternalMetadataCollision, type ExternalMetadataConfig, type ExternalMetadataEntry, type ExternalMetadataFetchOptions, type ExternalMetadataIndex, type ExternalMetadataJoin, type ExternalMetadataValue, type ExtractOptions, type ExtractedMetadata, FIELD_SOURCES, FILL_FORMATS, type FetchedSchema, type FieldError, type FieldLocation, type FillConfig, type FillFileResult, type FillOptions, type FillReportFormat, type FillReportOptions, type FillRun, type FillSummary, type FilledField, type FingerprintContext, type FrontmatterFlavor, type FrontmatterLocation, type GetFileResult, type GetOptions, type GetReportOptions, GitHubClient, GitLabClient, INTEGRITY_SHAPE, type JunitOptions, LOCATION_KEYWORD, type LoadExternalMetadataOptions, type LoadSchemaOptions, type LoadedConfig, type LocationPreference, type MergedChange, type MergedMetadata, type MetadataExtractor, type MetadataPatch, PATH_JOIN, PATH_PLACEHOLDER, QUERY_FORMATS, type QueryChange, type QueryFormat, type QueryOptions, type QueryReportOptions, type QueryRun, REPORT_FORMATS, RESOLVED_VIEW, REVIEW_CACHE_DIR, REVIEW_CACHE_VERSION, type ReadOptions, type ReencryptMetadataResult, type ReencryptedValue, type RelocateOptions, type RelocateResult, type RemoteIdentity, type ReportFormat, type ReportOptions, ReviewCache, type ReviewClient, type ReviewFacts, type ReviewSourceInput, type ReviewSourceResult, type Run, type RunConfig, type RunConfigOptions, type RunSummary, SCHEMA_CACHE_DIR, SCHEMA_CACHE_VERSION, type SarifOptions, SchemaCache, type SchemaCacheConfig, type SchemaCacheEntry, type SchemaEntry, type SchemaPin, type SchemaRefEntry, type SchemaTrustConfig, type SkipReason, type SourceLocation, type SourceStatus$1 as SourceStatus, type SpawnOptions, type ValidateOptions, type ValidateRun, type ValidationResult, Validator, type VendorOptions, type VendorResult, applyFrontmatter, argvFor, assertSourcesAvailable, cachedClient, index$1 as cite, classifyRef, collectSchemaPins, compareDerived, consultedSources, createResolvedView, createReviewClient, deriveFromCommands, deriveFromReviews, deriveMetadata, externalMetadataJoin, externalMetadataPointer, externalMetadataUrlProblem, extractFrontmatter, extractorForExtension, fetchExternalMetadata, fetchSchemaBytes, frontmatterInnerText, getSchemasInfo, identityFromOrigin, integrityOf, isBuiltinField, isCommonFormat, isDeriveFormat, isDeriveSource, isErrorSeverity, isFillFormat, isIntegrity, isMember, isPerFile, isQueryFormat, isReportFormat, index as key, listBuiltins, loadConfig, loadExternalMetadata, loadSchema, locateFrontmatter, memberOf, mentionsResolved, mergeExternalMetadata, orphanEntries, orphanError, orphanJoins, parseCollections, parseConfig, parseOriginUrl, rebaseConfigSchemaRefs, reencryptMetadata, render, renderDerive, renderFill, renderFillGithub, renderGet, renderJunit, renderQuery, renderQueryCsv, renderSarif, resolveRunConfig, resolveSchemaSet, resolvedColumns, run, runDerive, runFill, runGet, runQuery, runRelocate, runValidate, runVendorSchema, schemaCacheDir, schemaEntryRef, schemaLoadOptions, selectCollections, sourcesFor, staleFindings, stringifyValue, supportedExtensions, valueOf, vendorFileName, writeFileAtomic };
6204
+ export { type ApplyOptions, type Approval, type BaselineSummary, BinMissing, type BuiltinDerivableField, COMMON_FORMATS, type CheckConfig, type CollectionConfig, type CommandSourceOptions, type CommandSourceResult, type CommonFormat, type ConfigNotice, DEFAULT_SCHEMAS, DEFAULT_TTL_HOURS, DEFAULT_VENDOR_DIR, DERIVABLE_FIELDS, DERIVED_KEYWORD, DERIVED_STALE_SCHEMA, DERIVE_FORMATS, DERIVE_SOURCES, type DerivableField, type DeriveCommand, type DeriveCommandConfig, type DeriveConfig, type DeriveContext, type DeriveFileResult, type DeriveInput, type DeriveOptions, type DeriveReportFormat, type DeriveReportOptions, type DeriveResult, type DeriveRun, type DeriveSource, type DeriveSummary, type DerivedField, type DerivedRecord, type DerivedStatus, type DerivedValue, type DocmetaConfig, DocmetaError, type DocumentRefTrust, EXTERNAL_DUPLICATE_SCHEMA, EXTERNAL_KEYWORD, EXTERNAL_METADATA_FETCH_MAX_BYTES, EXTERNAL_METADATA_FETCH_TIMEOUT_MS, EXTERNAL_OWNED_SCHEMA, type ExternalMetadataCollision, type ExternalMetadataConfig, type ExternalMetadataEntry, type ExternalMetadataFetchOptions, type ExternalMetadataIndex, type ExternalMetadataJoin, type ExternalMetadataValue, type ExtractOptions, type ExtractedMetadata, FIELD_SOURCES, FILL_FORMATS, type FetchedSchema, type FieldError, type FieldLocation, type FillConfig, type FillFileResult, type FillOptions, type FillReportFormat, type FillReportOptions, type FillRun, type FillSummary, type FilledField, type FingerprintContext, type FrontmatterFlavor, type FrontmatterLocation, type GetFileResult, type GetOptions, type GetReportOptions, GitHubClient, GitLabClient, INTEGRITY_SHAPE, type JunitOptions, LOCATION_KEYWORD, type LoadExternalMetadataOptions, type LoadSchemaOptions, type LoadedConfig, type LocationPreference, MERGE_SAFE_FIELDS, type MergedChange, type MergedMetadata, type MetadataExtractor, type MetadataPatch, PATH_JOIN, PATH_PLACEHOLDER, QUERY_FORMATS, type QueryChange, type QueryFormat, type QueryOptions, type QueryReportOptions, type QueryRun, REPORT_FORMATS, RESOLVED_VIEW, REVIEW_CACHE_DIR, REVIEW_CACHE_VERSION, type ReadOptions, type ReencryptMetadataResult, type ReencryptedValue, type RegisteredSchema, type RegisteredSchemas, type RelocateOptions, type RelocateResult, type RemoteIdentity, type ReportFormat, type ReportOptions, ReviewCache, type ReviewClient, type ReviewFacts, type ReviewSourceInput, type ReviewSourceResult, type Run, type RunConfig, type RunConfigOptions, type RunSummary, SCHEMA_CACHE_DIR, SCHEMA_CACHE_VERSION, type SarifOptions, SchemaCache, type SchemaCacheConfig, type SchemaCacheEntry, type SchemaEntry, type SchemaPin, type SchemaRefEntry, type SchemaTrustConfig, type SkipReason, type SourceLocation, type SourceStatus$1 as SourceStatus, type SpawnOptions, type ValidateOptions, type ValidateRun, type ValidationResult, Validator, type VendorOptions, type VendorResult, applyFrontmatter, argvFor, assertSourcesAvailable, cachedClient, index$1 as cite, classifyRef, collectSchemaPins, compareDerived, consultedSources, createResolvedView, createReviewClient, deriveFromCommands, deriveFromReviews, deriveMetadata, externalMetadataJoin, externalMetadataPointer, externalMetadataUrlProblem, extractFrontmatter, extractorForExtension, fetchExternalMetadata, fetchSchemaBytes, frontmatterInnerText, getSchemasInfo, identityFromOrigin, integrityOf, isBuiltinField, isCommonFormat, isDeriveFormat, isDeriveSource, isErrorSeverity, isFillFormat, isIntegrity, isMember, isPerFile, isQueryFormat, isReportFormat, index as key, listBuiltins, loadConfig, loadExternalMetadata, loadSchema, locateFrontmatter, memberOf, mentionsResolved, mergeExternalMetadata, orphanEntries, orphanError, orphanJoins, parseCollections, parseConfig, parseOriginUrl, rebaseConfigSchemaRefs, reencryptMetadata, render, renderDerive, renderFill, renderFillGithub, renderGet, renderJunit, renderQuery, renderQueryCsv, renderSarif, resolveRunConfig, resolveSchemaSet, resolvedColumns, run, runDerive, runFill, runGet, runQuery, runRelocate, runValidate, runVendorSchema, schemaCacheDir, schemaEntryRef, schemaLoadOptions, selectCollections, sourcesFor, staleFindings, stringifyValue, supportedExtensions, valueOf, vendorFileName, writeFileAtomic };