@saasontools/strauss-kb 0.1.22 → 0.2.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.cts CHANGED
@@ -767,22 +767,10 @@ type KbRecordStamp = {
767
767
  };
768
768
 
769
769
  /**
770
- * Edges a trace may follow the shared kb-edges.ts definitions, minus
771
- * `body-link`: body links can reach most of a bundle from anywhere, which
772
- * suits a bounded pack but floods a timeline. Also absent by design:
773
- * `strauss_answered` carries no target id, so a question's resolution lives
774
- * in its own body rather than in another record.
775
- *
776
- * `typed-link` is in, where `body-link` is out, because the two differ in how
777
- * cheaply they are made. A body link is any markdown a writer happened to
778
- * type; a `strauss_links` entry is a deliberate claim from a closed vocabulary
779
- * about what this record depends on. That is exactly the kind of edge a
780
- * timeline should follow — "we chose this because of that" is the history.
781
- *
782
- * Only the causal rels, though. `related_to` asserts no dependence and reaches
783
- * whatever a writer thought worth mentioning, which is the same flooding
784
- * `body-link` is excluded for; a bibliography is a neighbourhood's business
785
- * (`pack`), not a history's.
770
+ * Edges a trace may follow: every kb-edges.ts kind, narrowed to the causal
771
+ * rels. `related_to` reaches whatever a writer thought worth mentioning, which
772
+ * suits a bounded pack but floods a timeline. `strauss_answered` carries no
773
+ * target id, so a question's resolution is not an edge.
786
774
  */
787
775
  declare const TRACE_EDGES: readonly ["typed-link", "supersession", "anchor", "source"];
788
776
  type KbTraceEdge = (typeof TRACE_EDGES)[number];
@@ -795,7 +783,7 @@ type KbTraceStep = {
795
783
  };
796
784
  type KbTraceOptions = {
797
785
  edges?: readonly KbTraceEdge[];
798
- /** Body links alone can reach the whole bundle, so a trace is always bounded. */
786
+ /** A trace is always bounded: supersession and shared anchors alone can reach the whole bundle. */
799
787
  depth?: number;
800
788
  };
801
789
  /**
@@ -2609,32 +2597,20 @@ type KbClassifyResult = {
2609
2597
  declare function classifyDiff(files: readonly KbClassifyFile[], options?: KbClassifyOptions): KbClassifiedFile[];
2610
2598
 
2611
2599
  /**
2612
- * The edges between records in one bundle, defined once.
2600
+ * Every concept id this record's prose cites, itself excluded.
2613
2601
  *
2614
- * Both walks `trace` and `pack` consume this module, so they cannot drift
2615
- * into disagreeing about what makes two records neighbours, and a diagnostic
2616
- * pass over the graph can reuse the same definition.
2617
- *
2618
- * There is no separate `related` kind: compose.ts renders `relatedConceptIds`
2619
- * as body links (`Relates to [id](id.md).`), so in stored form a related edge
2620
- * IS a body link, and a distinct kind would count the same markdown twice.
2621
- *
2622
- * `typed-link` is not that case, despite compose.ts also rendering a sentence
2623
- * per link. The edge is `strauss_links` in the frontmatter — the authoritative,
2624
- * typed form — and the sentence is its rendering for a reader that only knows
2625
- * OKF. A record can carry the frontmatter without the prose (hand-written, or
2626
- * from a producer we did not write), so reading only the body would miss it.
2627
- * A pair connected both ways comes back with both kinds in `via`, which is the
2628
- * honest answer: it was declared, and it was written about.
2629
- *
2630
- * `body-link` and `typed-link` are DIRECTED — the edges a record itself makes,
2631
- * read off its own body or frontmatter. `supersession`, `anchor` and `source`
2632
- * are symmetric: they hold between two records because both name the same
2633
- * thing, so either end sees the other. Callers wanting the inbound half of a
2634
- * typed edge use `kb-links/` (`kb_backlinks`, `kb_impact`) rather than this
2635
- * module, which answers "what does this record point at".
2602
+ * Parsed to an mdast tree rather than matched by pattern: a link in a fence, an
2603
+ * indented block or a code span is an example, and only a parser knows which.
2636
2604
  */
2637
- declare const KB_EDGE_KINDS: readonly ["body-link", "typed-link", "supersession", "anchor", "source"];
2605
+ declare function bodyCitations(record: KbRecord): Set<string>;
2606
+
2607
+ /**
2608
+ * The edges between records in one bundle, defined once for `trace` and
2609
+ * `pack`. `typed-link` (`strauss_links`) is directed and the only edge a
2610
+ * record declares; the other three are symmetric. Prose is never walked; the
2611
+ * inbound half of a typed edge is `kb-links/`.
2612
+ */
2613
+ declare const KB_EDGE_KINDS: readonly ["typed-link", "supersession", "anchor", "source"];
2638
2614
  type KbEdgeKind = (typeof KB_EDGE_KINDS)[number];
2639
2615
  type KbNeighbour = {
2640
2616
  record: KbRecord;
@@ -2665,6 +2641,61 @@ declare function neighbours(from: KbRecord, bundle: KbRecord[], kinds?: readonly
2665
2641
  */
2666
2642
  declare function edgeNeighbours(from: KbRecord, bundle: KbRecord[], kind: KbEdgeKind, linkRels?: readonly string[]): KbRecord[];
2667
2643
 
2644
+ /**
2645
+ * What a record explicitly points at — the question a consumer about to warn
2646
+ * or about to delete has to ask, where `kb-edges.ts` answers it for a walk and
2647
+ * `kb-links/` answers the causal inverse.
2648
+ */
2649
+ /** One target a record points at, with every claim it makes about it. */
2650
+ type KbOutboundReference = {
2651
+ target: string;
2652
+ /** Rels declared for this target, in declaration order. Never empty. */
2653
+ rels: string[];
2654
+ };
2655
+ /** A record that still holds, pointing at one that does not. */
2656
+ type KbStaleReference = {
2657
+ from: string;
2658
+ target: string;
2659
+ /** Always `superseded` or `rejected` — the standings that stopped holding. */
2660
+ targetStanding: Extract<KbStanding, "superseded" | "rejected">;
2661
+ rels: string[];
2662
+ /** The replacement chain, nearest first, limited to ids the bundle holds. */
2663
+ replacedBy: string[];
2664
+ };
2665
+ /** A record that still holds, pointing at the record being reassessed. */
2666
+ type KbLiveReference = {
2667
+ from: string;
2668
+ title: string | null;
2669
+ standing: KbStanding;
2670
+ rels: string[];
2671
+ };
2672
+
2673
+ /**
2674
+ * Every record this one points at through `strauss_links`, each target once,
2675
+ * with every distinct rel. An unknown rel is skipped, as every walk skips it;
2676
+ * shared anchors and sources are co-location, not reference.
2677
+ */
2678
+ declare function outboundReferences(record: KbRecord): KbOutboundReference[];
2679
+
2680
+ /**
2681
+ * Every stale reference in the bundle, in bundle order, then in each record's
2682
+ * own reference order.
2683
+ */
2684
+ declare function staleReferences(bundle: KbRecord[], standings: Map<string, KbStanding>): KbStaleReference[];
2685
+ /**
2686
+ * One record's stale references.
2687
+ *
2688
+ * A record already out of force is asked nothing: what a superseded record
2689
+ * points at is history, and repairing it would put a finding on every record
2690
+ * the base has already replaced.
2691
+ */
2692
+ declare function staleReferencesFrom(record: KbRecord, byId: Map<string, KbRecord>, standings: Map<string, KbStanding>): KbStaleReference[];
2693
+ /**
2694
+ * Who still points at this record, among the records that still hold: one hop
2695
+ * and every rel, where `kb_impact` walks causal dependence transitively.
2696
+ */
2697
+ declare function liveReferencesTo(targetId: string, bundle: KbRecord[], standings: Map<string, KbStanding>): KbLiveReference[];
2698
+
2668
2699
  /** `error` fails the check; `warning` does not. */
2669
2700
  type KbValidationSeverity = "error" | "warning";
2670
2701
  type KbValidationProblem = {
@@ -2710,6 +2741,11 @@ type KbDoctorFinding = {
2710
2741
  status: KbRecordStatus;
2711
2742
  /** Why this record is in this group, in one phrase a reader can act on. */
2712
2743
  note: string;
2744
+ /**
2745
+ * The edge behind a `superseded-but-cited` finding, for a consumer that acts
2746
+ * on it rather than prints it. Absent on every other check.
2747
+ */
2748
+ reference?: KbStaleReference;
2713
2749
  };
2714
2750
  type KbDoctorGroup = {
2715
2751
  check: KbDoctorCheck;
@@ -2919,6 +2955,38 @@ declare class KbAnchorSetDuplicateError extends BaseError {
2919
2955
  constructor(locator: string);
2920
2956
  }
2921
2957
 
2958
+ /**
2959
+ * What the run did about an anchor it set out to write. `applied` is set only
2960
+ * after the record is persisted, so a report never claims a baseline the store
2961
+ * does not hold.
2962
+ */
2963
+ type AnchorUpdateOutcome = "applied" | "skipped" | "failed";
2964
+ /** Why an intended write did not happen. */
2965
+ type AnchorUpdateReason = "frozen" | "write-failed" | "pinned-ref";
2966
+ type AnchorResolveResult = {
2967
+ file: string;
2968
+ symbol?: string;
2969
+ /** Set only for `side: "old"`: resolved at `ref`, never in the working tree. */
2970
+ side?: "old";
2971
+ /** `unstamped`: no hash yet, and nothing wrote one. */
2972
+ state: "stamped" | "unstamped" | "match" | "drifted" | "unresolved";
2973
+ storedHash?: string;
2974
+ currentHash?: string;
2975
+ /** What the compared hashes were taken over. */
2976
+ hashKind?: AnchorHashKind;
2977
+ /** `null` when the anchor recorded no `lines` — size unknown, not zero. */
2978
+ diffSize?: number | null;
2979
+ reason?: AnchorUnresolvedReason | AnchorDriftReason;
2980
+ resolver?: AnchorResolverName;
2981
+ /** Set only where a baseline write was due: the comparison is `state`. */
2982
+ outcome?: AnchorUpdateOutcome;
2983
+ outcomeReason?: AnchorUpdateReason;
2984
+ rebaselined?: boolean;
2985
+ /** Set only when the anchor was resolved against another repository. */
2986
+ repo?: string;
2987
+ remoteState?: RemoteAnchorState;
2988
+ };
2989
+
2922
2990
  /**
2923
2991
  * The record's anchors, as the caller means them to end up.
2924
2992
  *
@@ -2962,10 +3030,13 @@ type KbAnchorSetResult = {
2962
3030
  /** Unchanged anchors are not listed; a no-op write reports nothing. */
2963
3031
  changes: KbAnchorChange[];
2964
3032
  anchors: KbAnchor[];
2965
- /** `stamped` when `resolve` ran; `unchanged` otherwise. */
2966
- baseline: "unchanged" | "stamped";
3033
+ /**
3034
+ * `unchanged` without `resolve`; with it, `stamped` only when every anchor
3035
+ * matched or its write was `applied`, else `incomplete`.
3036
+ */
3037
+ baseline: "unchanged" | "stamped" | "incomplete";
2967
3038
  /** anchor-resolve's per-anchor results, when `resolve` ran. */
2968
- resolved?: unknown[];
3039
+ resolved?: AnchorResolveResult[];
2969
3040
  note: string;
2970
3041
  };
2971
3042
 
@@ -3180,6 +3251,20 @@ type KbReassessAnchor = {
3180
3251
  * reading, and naming the lean is what keeps it arguable.
3181
3252
  */
3182
3253
  type KbReassessDefault = "presumed-invalidated" | "rationale-may-survive" | "review";
3254
+ /**
3255
+ * The reference half of a reassessment, kept apart from the anchor half: two
3256
+ * readings, two repairs, and either present without the other.
3257
+ */
3258
+ type KbPacketReferences = {
3259
+ /** What this record points at that no longer holds. */
3260
+ outgoing: KbStaleReference[];
3261
+ /**
3262
+ * Who still points at this record, asked only of a record that has itself
3263
+ * stopped holding. Contextual and one hop — `impact` is the causal walk and
3264
+ * is not changed by this.
3265
+ */
3266
+ incoming: KbLiveReference[];
3267
+ };
3183
3268
  type KbReassessPacket = {
3184
3269
  conceptId: string;
3185
3270
  title: string | null;
@@ -3204,6 +3289,7 @@ type KbReassessPacket = {
3204
3289
  depth: number;
3205
3290
  }[];
3206
3291
  impactTruncated: boolean;
3292
+ references: KbPacketReferences;
3207
3293
  default: KbReassessDefault;
3208
3294
  defaultNote: string;
3209
3295
  };
@@ -3212,14 +3298,13 @@ type PacketOptions = ClassifyOptions & {
3212
3298
  withDiff?: boolean;
3213
3299
  impact?: KbImpactResult;
3214
3300
  standing?: KbStanding;
3301
+ /** Computed by the caller, which holds the bundle; the packet stays a shaper. */
3302
+ references?: KbPacketReferences;
3215
3303
  };
3216
3304
  /**
3217
- * One record's packet, or `null` when nothing survived classification.
3218
- *
3219
- * A record whose every drifted anchor turned out to be `moved` or `cosmetic`
3220
- * is a record with no reassessment work, and emitting an empty packet for it
3221
- * would put it back in front of the reader the classification just cleared it
3222
- * from.
3305
+ * One record's packet, or `null` when there is nothing for a reader to do:
3306
+ * every drifted anchor classified `moved` or `cosmetic`, and no unresolved
3307
+ * reference. Either half alone is reassessment work.
3223
3308
  */
3224
3309
  declare function reassessPacket(repoRoot: string, record: KbRecord, entries: readonly KbAnchorDriftEntry[], options?: PacketOptions): Promise<{
3225
3310
  packet: KbReassessPacket | null;
@@ -3358,4 +3443,4 @@ declare function parseMarkdownWithFrontmatter<S extends z.ZodType>(text: string,
3358
3443
  frontmatter: ReturnType<S["safeParse"]>;
3359
3444
  };
3360
3445
 
3361
- export { type AnchorResolution, type AnchorResolver, type AnchorResolverName, type AnchorSetInput, BaseError, CONTEXT_BEGIN, CONTEXT_END, CONTEXT_PROFILES, type ClassifiedAnchor, type ComposeInput, type ComposeLink, type ComposedRecord, DECISION_TYPE, DEFAULT_AGING_DAYS, DEFAULT_EXPIRING_DAYS, DEFAULT_LOAD_BUDGET, DEFAULT_PACK_HOPS, DEFAULT_PACK_MAX_NODES, DEFAULT_THRESHOLDS, DEFAULT_TYPED_LINK_RELS, DEFAULT_UNVERIFIED_DAYS, type DecisionInput, type DiffFile, type DiffHunk, type DiffMatch, type ErrorDetails, type ErrorProps, ErrorTypes, Fault, type Grammar, type GrammarManifest, type GrammarOptions, INDEX_FILE, KB_CAUSAL_LINK_RELS, KB_CLASSES, KB_COMMANDS, KB_COMMANDS_BY_NAME, KB_CONCEPT_ID_PATTERN, KB_CONFIDENCES, KB_DIR, KB_DOCTOR_CHECKS, KB_EDGE_KINDS, KB_LINK_RELS, KB_MATERIALITIES, KB_RECORD_STATUSES, KB_RECORD_TYPES, KB_SLUG_PATTERN, type KbActorStamp, type KbAdjudicated, type KbAnchor, type KbAnchorChange, type KbAnchorDriftEntry, type KbAnchorLocator, KbAnchorSetDuplicateError, type KbAnchorSetOutcome, type KbAnchorSetResult, type KbAnchorSpan, type KbAnchorWrite, type KbBacklink, type KbBacklinksResult, KbBaseFrozenError, type KbCatalogEntry, type KbCatalogResult, type KbClass, type KbClassifiedFile, type KbClassifiedHunk, type KbClassifyFile, KbClassifyInputError, type KbClassifyOptions, type KbClassifyResult, type KbClassifyThresholds, type KbCommand, type KbCommandContext, type KbContextBudgets, type KbContextOptions, type KbContextResult, type KbDoctorCheck, type KbDoctorFinding, type KbDoctorGroup, type KbDoctorOptions, type KbDoctorReport, type KbDoctorThresholds, type KbDroppedLink, type KbEdgeKind, type KbExportForeignFile, type KbExportResult, type KbExportedDecision, type KbImpactOptions, type KbImpactResult, type KbImpactedRecord, type KbInboundEdge, KbInvalidConceptIdError, type KbLink, type KbLinkEdge, type KbLinkRel, type KbLinkRelSpec, type KbLoadResult, type KbLogAnchorChange, type KbLogEntry, type KbLogReadResult, type KbLogger, type KbMatch, type KbMatchRecord, type KbMergedPin, type KbMergedPins, KbMissingFlagValueError, type KbNeighbour, KbPackBudgetExceededError, type KbPackOptions, type KbPackResult, type KbPackedRecord, type KbPin, type KbPinLayer, type KbPinOptions, type KbPinResult, type KbPinStatus, KbPinsMalformedError, type KbPinsManifest, type KbPromoteCandidate, KbPromoteCollisionError, type KbPromoteResult, KbPromoteSelfError, KbPromoteStandingError, KbPromoteStoppedError, type KbPromotedRecord, type KbReassessAnchor, type KbReassessDefault, type KbReassessDiff, type KbReassessPacket, type KbRecord, KbRecordAlreadyExistsError, type KbRecordFrontmatter, KbRecordNotFoundError, type KbRecordStatus, type KbRecordType, type KbRecordTypeSpec, type KbSearchLogger, KbSelfVerificationError, type KbSource, type KbStanding, KbStore, type KbSupersededStub, type KbSyncResult, type KbTagFilter, type KbTraceEdge, type KbTraceOptions, type KbTraceStep, KbUnknownLinkRelError, type KbValidationProblem, type KbValidationSeverity, type KbVerdict, type KbVerifiedEvent, type KbWarning, KbWriteConflictError, type KbWriteInput, LINK_RELS, LOG_FILE, type MatchOptions, NO_DECISION_SLUG, PINS_FILE, PINS_LOCAL_FILE, PIN_LAYERS, PROMOTION_SOURCE_ID, type QmdModule, RECORD_TYPES, type RemoteAnchorState, type RemoteOptions, type RemoteRead, type ResolvedSymbol, type ResolverAttempt, type ResolverAttemptOptions, SEARCH_INDEX_FILE, type SearchHit, type SearchOptions, type SymbolRange, type SymbolRangeIndex, TRACE_EDGES, TreeSitterResolver, adjudicate, anchorFilePath, anchorOnHunk, anchorSetInputSchema, applyAnchorSet, assertBaseNotFrozen, backlinks, buildContext, carry, catalog, classifyDiff, classifyDrift, composeDecisionRecord, composeInputSchema, composeLinkSchema, composeNoDecisionRecord, composeRecord, contextProfileBudgets, createKbMcpServer, decisionInputSchema, defaultAnchorResolvers, detectAnchorDrift, doctor, edgeNeighbours, ensureGrammar, grammarHints, grammarManifest, grammarsCacheRoot, hashAnchorText, impact, inboundIndex, indexIsStale, isCanonicalRepoUrl, isKbLinkRel, isKbRecordType, isNoDecisionRecord, isReviewTag, kbActorStampSchema, kbAnchorLocatorSchema, kbAnchorSchema, kbAnchorSpanSchema, kbAnchorWriteSchema, kbConceptIdSchema, kbJsonSchemas, kbLinkSchema, kbLogAnchorChangeSchema, kbLogEntrySchema, kbLogEntryWriteSchema, kbRecordFrontmatterSchema, kbSourceSchema, kbVerifiedEventSchema, languageForFile, listPins, loadQmd, locatorOf, matchToDiff, matchesTags, mergedContextBudgets, neighbours, pack, parseLog, parseMarkdownWithFrontmatter, pinBase, prepareResolvers, promoteCandidates, promoteInputSchema, readMergedPins, readPinsLayer, readRemoteAnchors, reassessPacket, regexResolver, renderCatalogLine, renderIndex, renderIndexLine, renderLogEntry, repoCacheDir, resolveAnchor, resolveAnchorSpan, resolveHeads, resolveHits, resolvePinPath, runKbCli, runKbMcpServer, searchBase, selectDecisions, splitMarkdownFrontmatter, stringifyMarkdownWithFrontmatter, symbolRangeIndex, syncInstructions, toHookJson, trace, treeSitterLanguages, unifiedDiff, unpinBase, validateBundle };
3446
+ export { type AnchorResolution, type AnchorResolver, type AnchorResolverName, type AnchorSetInput, BaseError, CONTEXT_BEGIN, CONTEXT_END, CONTEXT_PROFILES, type ClassifiedAnchor, type ComposeInput, type ComposeLink, type ComposedRecord, DECISION_TYPE, DEFAULT_AGING_DAYS, DEFAULT_EXPIRING_DAYS, DEFAULT_LOAD_BUDGET, DEFAULT_PACK_HOPS, DEFAULT_PACK_MAX_NODES, DEFAULT_THRESHOLDS, DEFAULT_TYPED_LINK_RELS, DEFAULT_UNVERIFIED_DAYS, type DecisionInput, type DiffFile, type DiffHunk, type DiffMatch, type ErrorDetails, type ErrorProps, ErrorTypes, Fault, type Grammar, type GrammarManifest, type GrammarOptions, INDEX_FILE, KB_CAUSAL_LINK_RELS, KB_CLASSES, KB_COMMANDS, KB_COMMANDS_BY_NAME, KB_CONCEPT_ID_PATTERN, KB_CONFIDENCES, KB_DIR, KB_DOCTOR_CHECKS, KB_EDGE_KINDS, KB_LINK_RELS, KB_MATERIALITIES, KB_RECORD_STATUSES, KB_RECORD_TYPES, KB_SLUG_PATTERN, type KbActorStamp, type KbAdjudicated, type KbAnchor, type KbAnchorChange, type KbAnchorDriftEntry, type KbAnchorLocator, KbAnchorSetDuplicateError, type KbAnchorSetOutcome, type KbAnchorSetResult, type KbAnchorSpan, type KbAnchorWrite, type KbBacklink, type KbBacklinksResult, KbBaseFrozenError, type KbCatalogEntry, type KbCatalogResult, type KbClass, type KbClassifiedFile, type KbClassifiedHunk, type KbClassifyFile, KbClassifyInputError, type KbClassifyOptions, type KbClassifyResult, type KbClassifyThresholds, type KbCommand, type KbCommandContext, type KbContextBudgets, type KbContextOptions, type KbContextResult, type KbDoctorCheck, type KbDoctorFinding, type KbDoctorGroup, type KbDoctorOptions, type KbDoctorReport, type KbDoctorThresholds, type KbDroppedLink, type KbEdgeKind, type KbExportForeignFile, type KbExportResult, type KbExportedDecision, type KbImpactOptions, type KbImpactResult, type KbImpactedRecord, type KbInboundEdge, KbInvalidConceptIdError, type KbLink, type KbLinkEdge, type KbLinkRel, type KbLinkRelSpec, type KbLiveReference, type KbLoadResult, type KbLogAnchorChange, type KbLogEntry, type KbLogReadResult, type KbLogger, type KbMatch, type KbMatchRecord, type KbMergedPin, type KbMergedPins, KbMissingFlagValueError, type KbNeighbour, type KbOutboundReference, KbPackBudgetExceededError, type KbPackOptions, type KbPackResult, type KbPackedRecord, type KbPin, type KbPinLayer, type KbPinOptions, type KbPinResult, type KbPinStatus, KbPinsMalformedError, type KbPinsManifest, type KbPromoteCandidate, KbPromoteCollisionError, type KbPromoteResult, KbPromoteSelfError, KbPromoteStandingError, KbPromoteStoppedError, type KbPromotedRecord, type KbReassessAnchor, type KbReassessDefault, type KbReassessDiff, type KbReassessPacket, type KbRecord, KbRecordAlreadyExistsError, type KbRecordFrontmatter, KbRecordNotFoundError, type KbRecordStatus, type KbRecordType, type KbRecordTypeSpec, type KbSearchLogger, KbSelfVerificationError, type KbSource, type KbStaleReference, type KbStanding, KbStore, type KbSupersededStub, type KbSyncResult, type KbTagFilter, type KbTraceEdge, type KbTraceOptions, type KbTraceStep, KbUnknownLinkRelError, type KbValidationProblem, type KbValidationSeverity, type KbVerdict, type KbVerifiedEvent, type KbWarning, KbWriteConflictError, type KbWriteInput, LINK_RELS, LOG_FILE, type MatchOptions, NO_DECISION_SLUG, PINS_FILE, PINS_LOCAL_FILE, PIN_LAYERS, PROMOTION_SOURCE_ID, type QmdModule, RECORD_TYPES, type RemoteAnchorState, type RemoteOptions, type RemoteRead, type ResolvedSymbol, type ResolverAttempt, type ResolverAttemptOptions, SEARCH_INDEX_FILE, type SearchHit, type SearchOptions, type SymbolRange, type SymbolRangeIndex, TRACE_EDGES, TreeSitterResolver, adjudicate, anchorFilePath, anchorOnHunk, anchorSetInputSchema, applyAnchorSet, assertBaseNotFrozen, backlinks, bodyCitations, buildContext, carry, catalog, classifyDiff, classifyDrift, composeDecisionRecord, composeInputSchema, composeLinkSchema, composeNoDecisionRecord, composeRecord, contextProfileBudgets, createKbMcpServer, decisionInputSchema, defaultAnchorResolvers, detectAnchorDrift, doctor, edgeNeighbours, ensureGrammar, grammarHints, grammarManifest, grammarsCacheRoot, hashAnchorText, impact, inboundIndex, indexIsStale, isCanonicalRepoUrl, isKbLinkRel, isKbRecordType, isNoDecisionRecord, isReviewTag, kbActorStampSchema, kbAnchorLocatorSchema, kbAnchorSchema, kbAnchorSpanSchema, kbAnchorWriteSchema, kbConceptIdSchema, kbJsonSchemas, kbLinkSchema, kbLogAnchorChangeSchema, kbLogEntrySchema, kbLogEntryWriteSchema, kbRecordFrontmatterSchema, kbSourceSchema, kbVerifiedEventSchema, languageForFile, listPins, liveReferencesTo, loadQmd, locatorOf, matchToDiff, matchesTags, mergedContextBudgets, neighbours, outboundReferences, pack, parseLog, parseMarkdownWithFrontmatter, pinBase, prepareResolvers, promoteCandidates, promoteInputSchema, readMergedPins, readPinsLayer, readRemoteAnchors, reassessPacket, regexResolver, renderCatalogLine, renderIndex, renderIndexLine, renderLogEntry, repoCacheDir, resolveAnchor, resolveAnchorSpan, resolveHeads, resolveHits, resolvePinPath, runKbCli, runKbMcpServer, searchBase, selectDecisions, splitMarkdownFrontmatter, staleReferences, staleReferencesFrom, stringifyMarkdownWithFrontmatter, symbolRangeIndex, syncInstructions, toHookJson, trace, treeSitterLanguages, unifiedDiff, unpinBase, validateBundle };
package/dist/index.d.ts CHANGED
@@ -767,22 +767,10 @@ type KbRecordStamp = {
767
767
  };
768
768
 
769
769
  /**
770
- * Edges a trace may follow the shared kb-edges.ts definitions, minus
771
- * `body-link`: body links can reach most of a bundle from anywhere, which
772
- * suits a bounded pack but floods a timeline. Also absent by design:
773
- * `strauss_answered` carries no target id, so a question's resolution lives
774
- * in its own body rather than in another record.
775
- *
776
- * `typed-link` is in, where `body-link` is out, because the two differ in how
777
- * cheaply they are made. A body link is any markdown a writer happened to
778
- * type; a `strauss_links` entry is a deliberate claim from a closed vocabulary
779
- * about what this record depends on. That is exactly the kind of edge a
780
- * timeline should follow — "we chose this because of that" is the history.
781
- *
782
- * Only the causal rels, though. `related_to` asserts no dependence and reaches
783
- * whatever a writer thought worth mentioning, which is the same flooding
784
- * `body-link` is excluded for; a bibliography is a neighbourhood's business
785
- * (`pack`), not a history's.
770
+ * Edges a trace may follow: every kb-edges.ts kind, narrowed to the causal
771
+ * rels. `related_to` reaches whatever a writer thought worth mentioning, which
772
+ * suits a bounded pack but floods a timeline. `strauss_answered` carries no
773
+ * target id, so a question's resolution is not an edge.
786
774
  */
787
775
  declare const TRACE_EDGES: readonly ["typed-link", "supersession", "anchor", "source"];
788
776
  type KbTraceEdge = (typeof TRACE_EDGES)[number];
@@ -795,7 +783,7 @@ type KbTraceStep = {
795
783
  };
796
784
  type KbTraceOptions = {
797
785
  edges?: readonly KbTraceEdge[];
798
- /** Body links alone can reach the whole bundle, so a trace is always bounded. */
786
+ /** A trace is always bounded: supersession and shared anchors alone can reach the whole bundle. */
799
787
  depth?: number;
800
788
  };
801
789
  /**
@@ -2609,32 +2597,20 @@ type KbClassifyResult = {
2609
2597
  declare function classifyDiff(files: readonly KbClassifyFile[], options?: KbClassifyOptions): KbClassifiedFile[];
2610
2598
 
2611
2599
  /**
2612
- * The edges between records in one bundle, defined once.
2600
+ * Every concept id this record's prose cites, itself excluded.
2613
2601
  *
2614
- * Both walks `trace` and `pack` consume this module, so they cannot drift
2615
- * into disagreeing about what makes two records neighbours, and a diagnostic
2616
- * pass over the graph can reuse the same definition.
2617
- *
2618
- * There is no separate `related` kind: compose.ts renders `relatedConceptIds`
2619
- * as body links (`Relates to [id](id.md).`), so in stored form a related edge
2620
- * IS a body link, and a distinct kind would count the same markdown twice.
2621
- *
2622
- * `typed-link` is not that case, despite compose.ts also rendering a sentence
2623
- * per link. The edge is `strauss_links` in the frontmatter — the authoritative,
2624
- * typed form — and the sentence is its rendering for a reader that only knows
2625
- * OKF. A record can carry the frontmatter without the prose (hand-written, or
2626
- * from a producer we did not write), so reading only the body would miss it.
2627
- * A pair connected both ways comes back with both kinds in `via`, which is the
2628
- * honest answer: it was declared, and it was written about.
2629
- *
2630
- * `body-link` and `typed-link` are DIRECTED — the edges a record itself makes,
2631
- * read off its own body or frontmatter. `supersession`, `anchor` and `source`
2632
- * are symmetric: they hold between two records because both name the same
2633
- * thing, so either end sees the other. Callers wanting the inbound half of a
2634
- * typed edge use `kb-links/` (`kb_backlinks`, `kb_impact`) rather than this
2635
- * module, which answers "what does this record point at".
2602
+ * Parsed to an mdast tree rather than matched by pattern: a link in a fence, an
2603
+ * indented block or a code span is an example, and only a parser knows which.
2636
2604
  */
2637
- declare const KB_EDGE_KINDS: readonly ["body-link", "typed-link", "supersession", "anchor", "source"];
2605
+ declare function bodyCitations(record: KbRecord): Set<string>;
2606
+
2607
+ /**
2608
+ * The edges between records in one bundle, defined once for `trace` and
2609
+ * `pack`. `typed-link` (`strauss_links`) is directed and the only edge a
2610
+ * record declares; the other three are symmetric. Prose is never walked; the
2611
+ * inbound half of a typed edge is `kb-links/`.
2612
+ */
2613
+ declare const KB_EDGE_KINDS: readonly ["typed-link", "supersession", "anchor", "source"];
2638
2614
  type KbEdgeKind = (typeof KB_EDGE_KINDS)[number];
2639
2615
  type KbNeighbour = {
2640
2616
  record: KbRecord;
@@ -2665,6 +2641,61 @@ declare function neighbours(from: KbRecord, bundle: KbRecord[], kinds?: readonly
2665
2641
  */
2666
2642
  declare function edgeNeighbours(from: KbRecord, bundle: KbRecord[], kind: KbEdgeKind, linkRels?: readonly string[]): KbRecord[];
2667
2643
 
2644
+ /**
2645
+ * What a record explicitly points at — the question a consumer about to warn
2646
+ * or about to delete has to ask, where `kb-edges.ts` answers it for a walk and
2647
+ * `kb-links/` answers the causal inverse.
2648
+ */
2649
+ /** One target a record points at, with every claim it makes about it. */
2650
+ type KbOutboundReference = {
2651
+ target: string;
2652
+ /** Rels declared for this target, in declaration order. Never empty. */
2653
+ rels: string[];
2654
+ };
2655
+ /** A record that still holds, pointing at one that does not. */
2656
+ type KbStaleReference = {
2657
+ from: string;
2658
+ target: string;
2659
+ /** Always `superseded` or `rejected` — the standings that stopped holding. */
2660
+ targetStanding: Extract<KbStanding, "superseded" | "rejected">;
2661
+ rels: string[];
2662
+ /** The replacement chain, nearest first, limited to ids the bundle holds. */
2663
+ replacedBy: string[];
2664
+ };
2665
+ /** A record that still holds, pointing at the record being reassessed. */
2666
+ type KbLiveReference = {
2667
+ from: string;
2668
+ title: string | null;
2669
+ standing: KbStanding;
2670
+ rels: string[];
2671
+ };
2672
+
2673
+ /**
2674
+ * Every record this one points at through `strauss_links`, each target once,
2675
+ * with every distinct rel. An unknown rel is skipped, as every walk skips it;
2676
+ * shared anchors and sources are co-location, not reference.
2677
+ */
2678
+ declare function outboundReferences(record: KbRecord): KbOutboundReference[];
2679
+
2680
+ /**
2681
+ * Every stale reference in the bundle, in bundle order, then in each record's
2682
+ * own reference order.
2683
+ */
2684
+ declare function staleReferences(bundle: KbRecord[], standings: Map<string, KbStanding>): KbStaleReference[];
2685
+ /**
2686
+ * One record's stale references.
2687
+ *
2688
+ * A record already out of force is asked nothing: what a superseded record
2689
+ * points at is history, and repairing it would put a finding on every record
2690
+ * the base has already replaced.
2691
+ */
2692
+ declare function staleReferencesFrom(record: KbRecord, byId: Map<string, KbRecord>, standings: Map<string, KbStanding>): KbStaleReference[];
2693
+ /**
2694
+ * Who still points at this record, among the records that still hold: one hop
2695
+ * and every rel, where `kb_impact` walks causal dependence transitively.
2696
+ */
2697
+ declare function liveReferencesTo(targetId: string, bundle: KbRecord[], standings: Map<string, KbStanding>): KbLiveReference[];
2698
+
2668
2699
  /** `error` fails the check; `warning` does not. */
2669
2700
  type KbValidationSeverity = "error" | "warning";
2670
2701
  type KbValidationProblem = {
@@ -2710,6 +2741,11 @@ type KbDoctorFinding = {
2710
2741
  status: KbRecordStatus;
2711
2742
  /** Why this record is in this group, in one phrase a reader can act on. */
2712
2743
  note: string;
2744
+ /**
2745
+ * The edge behind a `superseded-but-cited` finding, for a consumer that acts
2746
+ * on it rather than prints it. Absent on every other check.
2747
+ */
2748
+ reference?: KbStaleReference;
2713
2749
  };
2714
2750
  type KbDoctorGroup = {
2715
2751
  check: KbDoctorCheck;
@@ -2919,6 +2955,38 @@ declare class KbAnchorSetDuplicateError extends BaseError {
2919
2955
  constructor(locator: string);
2920
2956
  }
2921
2957
 
2958
+ /**
2959
+ * What the run did about an anchor it set out to write. `applied` is set only
2960
+ * after the record is persisted, so a report never claims a baseline the store
2961
+ * does not hold.
2962
+ */
2963
+ type AnchorUpdateOutcome = "applied" | "skipped" | "failed";
2964
+ /** Why an intended write did not happen. */
2965
+ type AnchorUpdateReason = "frozen" | "write-failed" | "pinned-ref";
2966
+ type AnchorResolveResult = {
2967
+ file: string;
2968
+ symbol?: string;
2969
+ /** Set only for `side: "old"`: resolved at `ref`, never in the working tree. */
2970
+ side?: "old";
2971
+ /** `unstamped`: no hash yet, and nothing wrote one. */
2972
+ state: "stamped" | "unstamped" | "match" | "drifted" | "unresolved";
2973
+ storedHash?: string;
2974
+ currentHash?: string;
2975
+ /** What the compared hashes were taken over. */
2976
+ hashKind?: AnchorHashKind;
2977
+ /** `null` when the anchor recorded no `lines` — size unknown, not zero. */
2978
+ diffSize?: number | null;
2979
+ reason?: AnchorUnresolvedReason | AnchorDriftReason;
2980
+ resolver?: AnchorResolverName;
2981
+ /** Set only where a baseline write was due: the comparison is `state`. */
2982
+ outcome?: AnchorUpdateOutcome;
2983
+ outcomeReason?: AnchorUpdateReason;
2984
+ rebaselined?: boolean;
2985
+ /** Set only when the anchor was resolved against another repository. */
2986
+ repo?: string;
2987
+ remoteState?: RemoteAnchorState;
2988
+ };
2989
+
2922
2990
  /**
2923
2991
  * The record's anchors, as the caller means them to end up.
2924
2992
  *
@@ -2962,10 +3030,13 @@ type KbAnchorSetResult = {
2962
3030
  /** Unchanged anchors are not listed; a no-op write reports nothing. */
2963
3031
  changes: KbAnchorChange[];
2964
3032
  anchors: KbAnchor[];
2965
- /** `stamped` when `resolve` ran; `unchanged` otherwise. */
2966
- baseline: "unchanged" | "stamped";
3033
+ /**
3034
+ * `unchanged` without `resolve`; with it, `stamped` only when every anchor
3035
+ * matched or its write was `applied`, else `incomplete`.
3036
+ */
3037
+ baseline: "unchanged" | "stamped" | "incomplete";
2967
3038
  /** anchor-resolve's per-anchor results, when `resolve` ran. */
2968
- resolved?: unknown[];
3039
+ resolved?: AnchorResolveResult[];
2969
3040
  note: string;
2970
3041
  };
2971
3042
 
@@ -3180,6 +3251,20 @@ type KbReassessAnchor = {
3180
3251
  * reading, and naming the lean is what keeps it arguable.
3181
3252
  */
3182
3253
  type KbReassessDefault = "presumed-invalidated" | "rationale-may-survive" | "review";
3254
+ /**
3255
+ * The reference half of a reassessment, kept apart from the anchor half: two
3256
+ * readings, two repairs, and either present without the other.
3257
+ */
3258
+ type KbPacketReferences = {
3259
+ /** What this record points at that no longer holds. */
3260
+ outgoing: KbStaleReference[];
3261
+ /**
3262
+ * Who still points at this record, asked only of a record that has itself
3263
+ * stopped holding. Contextual and one hop — `impact` is the causal walk and
3264
+ * is not changed by this.
3265
+ */
3266
+ incoming: KbLiveReference[];
3267
+ };
3183
3268
  type KbReassessPacket = {
3184
3269
  conceptId: string;
3185
3270
  title: string | null;
@@ -3204,6 +3289,7 @@ type KbReassessPacket = {
3204
3289
  depth: number;
3205
3290
  }[];
3206
3291
  impactTruncated: boolean;
3292
+ references: KbPacketReferences;
3207
3293
  default: KbReassessDefault;
3208
3294
  defaultNote: string;
3209
3295
  };
@@ -3212,14 +3298,13 @@ type PacketOptions = ClassifyOptions & {
3212
3298
  withDiff?: boolean;
3213
3299
  impact?: KbImpactResult;
3214
3300
  standing?: KbStanding;
3301
+ /** Computed by the caller, which holds the bundle; the packet stays a shaper. */
3302
+ references?: KbPacketReferences;
3215
3303
  };
3216
3304
  /**
3217
- * One record's packet, or `null` when nothing survived classification.
3218
- *
3219
- * A record whose every drifted anchor turned out to be `moved` or `cosmetic`
3220
- * is a record with no reassessment work, and emitting an empty packet for it
3221
- * would put it back in front of the reader the classification just cleared it
3222
- * from.
3305
+ * One record's packet, or `null` when there is nothing for a reader to do:
3306
+ * every drifted anchor classified `moved` or `cosmetic`, and no unresolved
3307
+ * reference. Either half alone is reassessment work.
3223
3308
  */
3224
3309
  declare function reassessPacket(repoRoot: string, record: KbRecord, entries: readonly KbAnchorDriftEntry[], options?: PacketOptions): Promise<{
3225
3310
  packet: KbReassessPacket | null;
@@ -3358,4 +3443,4 @@ declare function parseMarkdownWithFrontmatter<S extends z.ZodType>(text: string,
3358
3443
  frontmatter: ReturnType<S["safeParse"]>;
3359
3444
  };
3360
3445
 
3361
- export { type AnchorResolution, type AnchorResolver, type AnchorResolverName, type AnchorSetInput, BaseError, CONTEXT_BEGIN, CONTEXT_END, CONTEXT_PROFILES, type ClassifiedAnchor, type ComposeInput, type ComposeLink, type ComposedRecord, DECISION_TYPE, DEFAULT_AGING_DAYS, DEFAULT_EXPIRING_DAYS, DEFAULT_LOAD_BUDGET, DEFAULT_PACK_HOPS, DEFAULT_PACK_MAX_NODES, DEFAULT_THRESHOLDS, DEFAULT_TYPED_LINK_RELS, DEFAULT_UNVERIFIED_DAYS, type DecisionInput, type DiffFile, type DiffHunk, type DiffMatch, type ErrorDetails, type ErrorProps, ErrorTypes, Fault, type Grammar, type GrammarManifest, type GrammarOptions, INDEX_FILE, KB_CAUSAL_LINK_RELS, KB_CLASSES, KB_COMMANDS, KB_COMMANDS_BY_NAME, KB_CONCEPT_ID_PATTERN, KB_CONFIDENCES, KB_DIR, KB_DOCTOR_CHECKS, KB_EDGE_KINDS, KB_LINK_RELS, KB_MATERIALITIES, KB_RECORD_STATUSES, KB_RECORD_TYPES, KB_SLUG_PATTERN, type KbActorStamp, type KbAdjudicated, type KbAnchor, type KbAnchorChange, type KbAnchorDriftEntry, type KbAnchorLocator, KbAnchorSetDuplicateError, type KbAnchorSetOutcome, type KbAnchorSetResult, type KbAnchorSpan, type KbAnchorWrite, type KbBacklink, type KbBacklinksResult, KbBaseFrozenError, type KbCatalogEntry, type KbCatalogResult, type KbClass, type KbClassifiedFile, type KbClassifiedHunk, type KbClassifyFile, KbClassifyInputError, type KbClassifyOptions, type KbClassifyResult, type KbClassifyThresholds, type KbCommand, type KbCommandContext, type KbContextBudgets, type KbContextOptions, type KbContextResult, type KbDoctorCheck, type KbDoctorFinding, type KbDoctorGroup, type KbDoctorOptions, type KbDoctorReport, type KbDoctorThresholds, type KbDroppedLink, type KbEdgeKind, type KbExportForeignFile, type KbExportResult, type KbExportedDecision, type KbImpactOptions, type KbImpactResult, type KbImpactedRecord, type KbInboundEdge, KbInvalidConceptIdError, type KbLink, type KbLinkEdge, type KbLinkRel, type KbLinkRelSpec, type KbLoadResult, type KbLogAnchorChange, type KbLogEntry, type KbLogReadResult, type KbLogger, type KbMatch, type KbMatchRecord, type KbMergedPin, type KbMergedPins, KbMissingFlagValueError, type KbNeighbour, KbPackBudgetExceededError, type KbPackOptions, type KbPackResult, type KbPackedRecord, type KbPin, type KbPinLayer, type KbPinOptions, type KbPinResult, type KbPinStatus, KbPinsMalformedError, type KbPinsManifest, type KbPromoteCandidate, KbPromoteCollisionError, type KbPromoteResult, KbPromoteSelfError, KbPromoteStandingError, KbPromoteStoppedError, type KbPromotedRecord, type KbReassessAnchor, type KbReassessDefault, type KbReassessDiff, type KbReassessPacket, type KbRecord, KbRecordAlreadyExistsError, type KbRecordFrontmatter, KbRecordNotFoundError, type KbRecordStatus, type KbRecordType, type KbRecordTypeSpec, type KbSearchLogger, KbSelfVerificationError, type KbSource, type KbStanding, KbStore, type KbSupersededStub, type KbSyncResult, type KbTagFilter, type KbTraceEdge, type KbTraceOptions, type KbTraceStep, KbUnknownLinkRelError, type KbValidationProblem, type KbValidationSeverity, type KbVerdict, type KbVerifiedEvent, type KbWarning, KbWriteConflictError, type KbWriteInput, LINK_RELS, LOG_FILE, type MatchOptions, NO_DECISION_SLUG, PINS_FILE, PINS_LOCAL_FILE, PIN_LAYERS, PROMOTION_SOURCE_ID, type QmdModule, RECORD_TYPES, type RemoteAnchorState, type RemoteOptions, type RemoteRead, type ResolvedSymbol, type ResolverAttempt, type ResolverAttemptOptions, SEARCH_INDEX_FILE, type SearchHit, type SearchOptions, type SymbolRange, type SymbolRangeIndex, TRACE_EDGES, TreeSitterResolver, adjudicate, anchorFilePath, anchorOnHunk, anchorSetInputSchema, applyAnchorSet, assertBaseNotFrozen, backlinks, buildContext, carry, catalog, classifyDiff, classifyDrift, composeDecisionRecord, composeInputSchema, composeLinkSchema, composeNoDecisionRecord, composeRecord, contextProfileBudgets, createKbMcpServer, decisionInputSchema, defaultAnchorResolvers, detectAnchorDrift, doctor, edgeNeighbours, ensureGrammar, grammarHints, grammarManifest, grammarsCacheRoot, hashAnchorText, impact, inboundIndex, indexIsStale, isCanonicalRepoUrl, isKbLinkRel, isKbRecordType, isNoDecisionRecord, isReviewTag, kbActorStampSchema, kbAnchorLocatorSchema, kbAnchorSchema, kbAnchorSpanSchema, kbAnchorWriteSchema, kbConceptIdSchema, kbJsonSchemas, kbLinkSchema, kbLogAnchorChangeSchema, kbLogEntrySchema, kbLogEntryWriteSchema, kbRecordFrontmatterSchema, kbSourceSchema, kbVerifiedEventSchema, languageForFile, listPins, loadQmd, locatorOf, matchToDiff, matchesTags, mergedContextBudgets, neighbours, pack, parseLog, parseMarkdownWithFrontmatter, pinBase, prepareResolvers, promoteCandidates, promoteInputSchema, readMergedPins, readPinsLayer, readRemoteAnchors, reassessPacket, regexResolver, renderCatalogLine, renderIndex, renderIndexLine, renderLogEntry, repoCacheDir, resolveAnchor, resolveAnchorSpan, resolveHeads, resolveHits, resolvePinPath, runKbCli, runKbMcpServer, searchBase, selectDecisions, splitMarkdownFrontmatter, stringifyMarkdownWithFrontmatter, symbolRangeIndex, syncInstructions, toHookJson, trace, treeSitterLanguages, unifiedDiff, unpinBase, validateBundle };
3446
+ export { type AnchorResolution, type AnchorResolver, type AnchorResolverName, type AnchorSetInput, BaseError, CONTEXT_BEGIN, CONTEXT_END, CONTEXT_PROFILES, type ClassifiedAnchor, type ComposeInput, type ComposeLink, type ComposedRecord, DECISION_TYPE, DEFAULT_AGING_DAYS, DEFAULT_EXPIRING_DAYS, DEFAULT_LOAD_BUDGET, DEFAULT_PACK_HOPS, DEFAULT_PACK_MAX_NODES, DEFAULT_THRESHOLDS, DEFAULT_TYPED_LINK_RELS, DEFAULT_UNVERIFIED_DAYS, type DecisionInput, type DiffFile, type DiffHunk, type DiffMatch, type ErrorDetails, type ErrorProps, ErrorTypes, Fault, type Grammar, type GrammarManifest, type GrammarOptions, INDEX_FILE, KB_CAUSAL_LINK_RELS, KB_CLASSES, KB_COMMANDS, KB_COMMANDS_BY_NAME, KB_CONCEPT_ID_PATTERN, KB_CONFIDENCES, KB_DIR, KB_DOCTOR_CHECKS, KB_EDGE_KINDS, KB_LINK_RELS, KB_MATERIALITIES, KB_RECORD_STATUSES, KB_RECORD_TYPES, KB_SLUG_PATTERN, type KbActorStamp, type KbAdjudicated, type KbAnchor, type KbAnchorChange, type KbAnchorDriftEntry, type KbAnchorLocator, KbAnchorSetDuplicateError, type KbAnchorSetOutcome, type KbAnchorSetResult, type KbAnchorSpan, type KbAnchorWrite, type KbBacklink, type KbBacklinksResult, KbBaseFrozenError, type KbCatalogEntry, type KbCatalogResult, type KbClass, type KbClassifiedFile, type KbClassifiedHunk, type KbClassifyFile, KbClassifyInputError, type KbClassifyOptions, type KbClassifyResult, type KbClassifyThresholds, type KbCommand, type KbCommandContext, type KbContextBudgets, type KbContextOptions, type KbContextResult, type KbDoctorCheck, type KbDoctorFinding, type KbDoctorGroup, type KbDoctorOptions, type KbDoctorReport, type KbDoctorThresholds, type KbDroppedLink, type KbEdgeKind, type KbExportForeignFile, type KbExportResult, type KbExportedDecision, type KbImpactOptions, type KbImpactResult, type KbImpactedRecord, type KbInboundEdge, KbInvalidConceptIdError, type KbLink, type KbLinkEdge, type KbLinkRel, type KbLinkRelSpec, type KbLiveReference, type KbLoadResult, type KbLogAnchorChange, type KbLogEntry, type KbLogReadResult, type KbLogger, type KbMatch, type KbMatchRecord, type KbMergedPin, type KbMergedPins, KbMissingFlagValueError, type KbNeighbour, type KbOutboundReference, KbPackBudgetExceededError, type KbPackOptions, type KbPackResult, type KbPackedRecord, type KbPin, type KbPinLayer, type KbPinOptions, type KbPinResult, type KbPinStatus, KbPinsMalformedError, type KbPinsManifest, type KbPromoteCandidate, KbPromoteCollisionError, type KbPromoteResult, KbPromoteSelfError, KbPromoteStandingError, KbPromoteStoppedError, type KbPromotedRecord, type KbReassessAnchor, type KbReassessDefault, type KbReassessDiff, type KbReassessPacket, type KbRecord, KbRecordAlreadyExistsError, type KbRecordFrontmatter, KbRecordNotFoundError, type KbRecordStatus, type KbRecordType, type KbRecordTypeSpec, type KbSearchLogger, KbSelfVerificationError, type KbSource, type KbStaleReference, type KbStanding, KbStore, type KbSupersededStub, type KbSyncResult, type KbTagFilter, type KbTraceEdge, type KbTraceOptions, type KbTraceStep, KbUnknownLinkRelError, type KbValidationProblem, type KbValidationSeverity, type KbVerdict, type KbVerifiedEvent, type KbWarning, KbWriteConflictError, type KbWriteInput, LINK_RELS, LOG_FILE, type MatchOptions, NO_DECISION_SLUG, PINS_FILE, PINS_LOCAL_FILE, PIN_LAYERS, PROMOTION_SOURCE_ID, type QmdModule, RECORD_TYPES, type RemoteAnchorState, type RemoteOptions, type RemoteRead, type ResolvedSymbol, type ResolverAttempt, type ResolverAttemptOptions, SEARCH_INDEX_FILE, type SearchHit, type SearchOptions, type SymbolRange, type SymbolRangeIndex, TRACE_EDGES, TreeSitterResolver, adjudicate, anchorFilePath, anchorOnHunk, anchorSetInputSchema, applyAnchorSet, assertBaseNotFrozen, backlinks, bodyCitations, buildContext, carry, catalog, classifyDiff, classifyDrift, composeDecisionRecord, composeInputSchema, composeLinkSchema, composeNoDecisionRecord, composeRecord, contextProfileBudgets, createKbMcpServer, decisionInputSchema, defaultAnchorResolvers, detectAnchorDrift, doctor, edgeNeighbours, ensureGrammar, grammarHints, grammarManifest, grammarsCacheRoot, hashAnchorText, impact, inboundIndex, indexIsStale, isCanonicalRepoUrl, isKbLinkRel, isKbRecordType, isNoDecisionRecord, isReviewTag, kbActorStampSchema, kbAnchorLocatorSchema, kbAnchorSchema, kbAnchorSpanSchema, kbAnchorWriteSchema, kbConceptIdSchema, kbJsonSchemas, kbLinkSchema, kbLogAnchorChangeSchema, kbLogEntrySchema, kbLogEntryWriteSchema, kbRecordFrontmatterSchema, kbSourceSchema, kbVerifiedEventSchema, languageForFile, listPins, liveReferencesTo, loadQmd, locatorOf, matchToDiff, matchesTags, mergedContextBudgets, neighbours, outboundReferences, pack, parseLog, parseMarkdownWithFrontmatter, pinBase, prepareResolvers, promoteCandidates, promoteInputSchema, readMergedPins, readPinsLayer, readRemoteAnchors, reassessPacket, regexResolver, renderCatalogLine, renderIndex, renderIndexLine, renderLogEntry, repoCacheDir, resolveAnchor, resolveAnchorSpan, resolveHeads, resolveHits, resolvePinPath, runKbCli, runKbMcpServer, searchBase, selectDecisions, splitMarkdownFrontmatter, staleReferences, staleReferencesFrom, stringifyMarkdownWithFrontmatter, symbolRangeIndex, syncInstructions, toHookJson, trace, treeSitterLanguages, unifiedDiff, unpinBase, validateBundle };
package/dist/index.js CHANGED
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  runKbCli
3
- } from "./chunk-DVSPHL4B.js";
3
+ } from "./chunk-7J2BBP67.js";
4
4
  import {
5
5
  createKbMcpServer,
6
6
  runKbMcpServer
7
- } from "./chunk-TSE4YQEG.js";
7
+ } from "./chunk-GMZDXWWU.js";
8
8
  import {
9
9
  BaseError,
10
10
  CONTEXT_BEGIN,
@@ -71,6 +71,7 @@ import {
71
71
  applyAnchorSet,
72
72
  assertBaseNotFrozen,
73
73
  backlinks,
74
+ bodyCitations,
74
75
  buildContext,
75
76
  carry,
76
77
  catalog,
@@ -116,12 +117,14 @@ import {
116
117
  kbVerifiedEventSchema,
117
118
  languageForFile,
118
119
  listPins,
120
+ liveReferencesTo,
119
121
  loadQmd,
120
122
  locatorOf,
121
123
  matchToDiff,
122
124
  matchesTags,
123
125
  mergedContextBudgets,
124
126
  neighbours,
127
+ outboundReferences,
125
128
  pack,
126
129
  parseLog,
127
130
  parseMarkdownWithFrontmatter,
@@ -147,6 +150,8 @@ import {
147
150
  searchBase,
148
151
  selectDecisions,
149
152
  splitMarkdownFrontmatter,
153
+ staleReferences,
154
+ staleReferencesFrom,
150
155
  stringifyMarkdownWithFrontmatter,
151
156
  symbolRangeIndex,
152
157
  syncInstructions,
@@ -156,7 +161,7 @@ import {
156
161
  unifiedDiff,
157
162
  unpinBase,
158
163
  validateBundle
159
- } from "./chunk-AEO5U42S.js";
164
+ } from "./chunk-HNPHL6I4.js";
160
165
  export {
161
166
  BaseError,
162
167
  CONTEXT_BEGIN,
@@ -223,6 +228,7 @@ export {
223
228
  applyAnchorSet,
224
229
  assertBaseNotFrozen,
225
230
  backlinks,
231
+ bodyCitations,
226
232
  buildContext,
227
233
  carry,
228
234
  catalog,
@@ -269,12 +275,14 @@ export {
269
275
  kbVerifiedEventSchema,
270
276
  languageForFile,
271
277
  listPins,
278
+ liveReferencesTo,
272
279
  loadQmd,
273
280
  locatorOf,
274
281
  matchToDiff,
275
282
  matchesTags,
276
283
  mergedContextBudgets,
277
284
  neighbours,
285
+ outboundReferences,
278
286
  pack,
279
287
  parseLog,
280
288
  parseMarkdownWithFrontmatter,
@@ -302,6 +310,8 @@ export {
302
310
  searchBase,
303
311
  selectDecisions,
304
312
  splitMarkdownFrontmatter,
313
+ staleReferences,
314
+ staleReferencesFrom,
305
315
  stringifyMarkdownWithFrontmatter,
306
316
  symbolRangeIndex,
307
317
  syncInstructions,