@fenglimg/fabric-server 2.3.0-rc.12 → 2.3.0-rc.16

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/README.md CHANGED
@@ -7,7 +7,8 @@ Fabric MCP knowledge server. Runs over stdio transport and serves Claude Code an
7
7
  - `fab_recall` — single-step recall: returns candidate descriptions + native read paths (no body delivery over MCP; read a body on demand via a native Read of the returned path)
8
8
  - `fab_archive_scan` — scan recent work for archive-worthy knowledge candidates
9
9
  - `fab_propose` — persist a pending knowledge entry
10
- - `fab_review` — list / approve / reject / modify / defer pending entries
10
+ - `fab_pending` — read-only browse/search of pending + canonical knowledge (`list` / `search`)
11
+ - `fab_review` — write-only triage of pending knowledge (`approve` / `reject` / `modify` / `modify-content` / `modify-content-batch` / `modify-layer` / `defer` / `retire`)
11
12
 
12
13
  ## Install
13
14
 
package/dist/index.d.ts CHANGED
@@ -41,6 +41,114 @@ type BacklogAgeMetric = {
41
41
  declare function checkBacklogAge(projectRoot: string, nowMs?: number): Promise<BacklogAgeMetric>;
42
42
  declare function renderBacklogAgeLine(metric: BacklogAgeMetric): string;
43
43
 
44
+ /**
45
+ * doctor-types.ts — pure public report/check types for the doctor subsystem.
46
+ *
47
+ * Wave W1 extraction from doctor.ts (repo-hygiene-slim). No runtime logic —
48
+ * only type aliases. doctor.ts re-exports these for backward-compatible
49
+ * `import type { DoctorCheck } from "./doctor.js"` consumers.
50
+ */
51
+
52
+ type DoctorStatus = "ok" | "warn" | "error";
53
+ type DoctorIssueKind = "fixable_error" | "manual_error" | "warning" | "info";
54
+ type DoctorCheck = {
55
+ name: string;
56
+ status: DoctorStatus;
57
+ message: string;
58
+ kind?: DoctorIssueKind;
59
+ code?: string;
60
+ fixable?: boolean;
61
+ actionHint?: string;
62
+ audience?: "user" | "maintainer";
63
+ };
64
+ type DoctorIssue = {
65
+ code: string;
66
+ name: string;
67
+ message: string;
68
+ path?: string;
69
+ actionHint?: string;
70
+ audience?: "user" | "maintainer";
71
+ };
72
+ type DoctorPayloadLimits = {
73
+ warn_bytes: number;
74
+ hard_bytes: number;
75
+ source: "default" | "config";
76
+ };
77
+ type DoctorSummary = {
78
+ target: string;
79
+ framework: {
80
+ kind: string;
81
+ version: string;
82
+ subkind: string;
83
+ };
84
+ entryPoints: Array<{
85
+ path: string;
86
+ reason: string;
87
+ }>;
88
+ metaRevision: string | null;
89
+ computedMetaRevision: string | null;
90
+ ruleCount: number;
91
+ eventLedgerPath: string;
92
+ fixableErrorCount: number;
93
+ manualErrorCount: number;
94
+ warningCount: number;
95
+ infoCount: number;
96
+ targetFiles: Record<string, boolean>;
97
+ payload_limits: DoctorPayloadLimits;
98
+ health: DoctorHealth;
99
+ };
100
+ type DoctorReport = {
101
+ status: DoctorStatus;
102
+ checks: DoctorCheck[];
103
+ fixable_errors: DoctorIssue[];
104
+ manual_errors: DoctorIssue[];
105
+ warnings: DoctorIssue[];
106
+ infos: DoctorIssue[];
107
+ summary: DoctorSummary;
108
+ };
109
+ type DoctorFixReport = {
110
+ changed: boolean;
111
+ fixed: DoctorIssue[];
112
+ remaining_manual_errors: DoctorIssue[];
113
+ warnings: DoctorIssue[];
114
+ message: string;
115
+ report: DoctorReport;
116
+ };
117
+ type DoctorApplyLintMutationKind = "knowledge_session_hints_stale_cleanup" | "store_counter_floor";
118
+ type DoctorApplyLintMutation = {
119
+ kind: DoctorApplyLintMutationKind;
120
+ path: string;
121
+ detail: string;
122
+ applied: boolean;
123
+ error?: string;
124
+ };
125
+ type DoctorApplyLintReport = {
126
+ changed: boolean;
127
+ mutations: DoctorApplyLintMutation[];
128
+ warnings: DoctorIssue[];
129
+ manual_errors: DoctorIssue[];
130
+ aborted: boolean;
131
+ abort_reason?: string;
132
+ message: string;
133
+ report: DoctorReport;
134
+ };
135
+ type EnrichDescriptionsMode = "auto" | "preview" | "readonly" | "interactive";
136
+ type EnrichDescriptionsCandidate = {
137
+ path: string;
138
+ missing: Array<"intent_clues" | "tech_stack" | "impact" | "must_read_if">;
139
+ modified: boolean;
140
+ added_fields: Array<"intent_clues" | "tech_stack" | "impact" | "must_read_if">;
141
+ error?: string;
142
+ };
143
+ type EnrichDescriptionsReport = {
144
+ mode: EnrichDescriptionsMode;
145
+ dryRun: boolean;
146
+ scanned: number;
147
+ modified: number;
148
+ skipped: number;
149
+ candidates: EnrichDescriptionsCandidate[];
150
+ };
151
+
44
152
  declare function extractRuleDescription(source: string): RuleDescription | undefined;
45
153
 
46
154
  interface AlwaysActiveBody {
@@ -52,7 +160,11 @@ interface AlwaysActiveBody {
52
160
  /** description.summary — the overflow-degrade fallback when the body cannot
53
161
  * fit the injection char budget (the budget is enforced hook-side, D10). */
54
162
  summary: string;
55
- /** frontmatter-stripped markdown body. */
163
+ /**
164
+ * ISS-20260713-014 / KT-DEC-0036: SessionStart wire is index-only.
165
+ * Body is empty on this path; full text via Read/fab_recall.
166
+ * Field retained for wire compatibility.
167
+ */
56
168
  body: string;
57
169
  }
58
170
  /**
@@ -88,6 +200,7 @@ interface KnowledgeCensus {
88
200
  */
89
201
  declare function buildKnowledgeCensus(projectRoot: string): Promise<KnowledgeCensus>;
90
202
  declare function buildAlwaysActiveBodies(projectRoot: string): Promise<AlwaysActiveBody[]>;
203
+ declare function computeReadSetRevision(projectRoot: string): Promise<string>;
91
204
  interface StoreCanonicalEntry {
92
205
  stableId: string;
93
206
  qualifiedId: string;
@@ -177,6 +290,7 @@ type MetricsRow = {
177
290
  * dual-write allowlist below.
178
291
  */
179
292
  declare const METRIC_COUNTER_NAMES: {
293
+ readonly knowledge_body_read: "knowledge_body_read";
180
294
  readonly knowledge_consumed: "knowledge_consumed";
181
295
  readonly edit_intent_checked: "edit_intent_checked";
182
296
  readonly knowledge_context_planned: "knowledge_context_planned";
@@ -261,6 +375,7 @@ declare function runDoctorCiteCoverage(projectRoot: string, options: {
261
375
  until?: number;
262
376
  recallWindowMs?: number;
263
377
  }): Promise<CiteCoverageReport>;
378
+
264
379
  type ArchiveHistoryEntry = {
265
380
  session_id_short: string;
266
381
  last_attempted_at: string;
@@ -296,109 +411,10 @@ declare function runDoctorHistoryAll(projectRoot: string, options: {
296
411
  since: number;
297
412
  }): Promise<HistoryAllReport>;
298
413
 
299
- type DoctorStatus = "ok" | "warn" | "error";
300
- type DoctorIssueKind = "fixable_error" | "manual_error" | "warning" | "info";
301
- type DoctorCheck = {
302
- name: string;
303
- status: DoctorStatus;
304
- message: string;
305
- kind?: DoctorIssueKind;
306
- code?: string;
307
- fixable?: boolean;
308
- actionHint?: string;
309
- audience?: "user" | "maintainer";
310
- };
311
- type DoctorIssue = {
312
- code: string;
313
- name: string;
314
- message: string;
315
- path?: string;
316
- actionHint?: string;
317
- audience?: "user" | "maintainer";
318
- };
319
- type DoctorPayloadLimits = {
320
- warn_bytes: number;
321
- hard_bytes: number;
322
- source: "default" | "config";
323
- };
324
- type DoctorSummary = {
325
- target: string;
326
- framework: {
327
- kind: string;
328
- version: string;
329
- subkind: string;
330
- };
331
- entryPoints: Array<{
332
- path: string;
333
- reason: string;
334
- }>;
335
- metaRevision: string | null;
336
- computedMetaRevision: string | null;
337
- ruleCount: number;
338
- eventLedgerPath: string;
339
- fixableErrorCount: number;
340
- manualErrorCount: number;
341
- warningCount: number;
342
- infoCount: number;
343
- targetFiles: Record<string, boolean>;
344
- payload_limits: DoctorPayloadLimits;
345
- health: DoctorHealth;
346
- };
347
- type DoctorReport = {
348
- status: DoctorStatus;
349
- checks: DoctorCheck[];
350
- fixable_errors: DoctorIssue[];
351
- manual_errors: DoctorIssue[];
352
- warnings: DoctorIssue[];
353
- infos: DoctorIssue[];
354
- summary: DoctorSummary;
355
- };
356
- type DoctorFixReport = {
357
- changed: boolean;
358
- fixed: DoctorIssue[];
359
- remaining_manual_errors: DoctorIssue[];
360
- warnings: DoctorIssue[];
361
- message: string;
362
- report: DoctorReport;
363
- };
364
- type DoctorApplyLintMutationKind = "knowledge_orphan_demote_required" | "knowledge_stale_archive_required" | "knowledge_index_drift" | "knowledge_pending_auto_archive" | "knowledge_session_hints_stale_cleanup" | "knowledge_relevance_fields_missing";
365
- type DoctorApplyLintMutation = {
366
- kind: DoctorApplyLintMutationKind;
367
- path: string;
368
- detail: string;
369
- applied: boolean;
370
- error?: string;
371
- };
372
- type DoctorApplyLintReport = {
373
- changed: boolean;
374
- mutations: DoctorApplyLintMutation[];
375
- warnings: DoctorIssue[];
376
- manual_errors: DoctorIssue[];
377
- aborted: boolean;
378
- abort_reason?: string;
379
- message: string;
380
- report: DoctorReport;
381
- };
382
414
  declare function runDoctorReport(target: string): Promise<DoctorReport>;
383
415
  declare function runDoctorFix(target: string): Promise<DoctorFixReport>;
384
416
  declare function runDoctorApplyLint(target: string): Promise<DoctorApplyLintReport>;
385
417
 
386
- type EnrichDescriptionsMode = "auto" | "preview" | "readonly" | "interactive";
387
- type EnrichDescriptionsCandidate = {
388
- path: string;
389
- missing: Array<"intent_clues" | "tech_stack" | "impact" | "must_read_if">;
390
- modified: boolean;
391
- added_fields: Array<"intent_clues" | "tech_stack" | "impact" | "must_read_if">;
392
- error?: string;
393
- };
394
- type EnrichDescriptionsReport = {
395
- mode: EnrichDescriptionsMode;
396
- dryRun: boolean;
397
- scanned: number;
398
- modified: number;
399
- skipped: number;
400
- candidates: EnrichDescriptionsCandidate[];
401
- };
402
418
  declare function enrichDescriptions(projectRoot: string, opts?: {
403
419
  auto?: boolean;
404
420
  dryRun?: boolean;
@@ -654,6 +670,12 @@ declare function explainWhyNotSurfaced(projectRoot: string, query: string): Prom
654
670
  */
655
671
  declare function extractKnowledge(projectRoot: string, input: FabExtractKnowledgeInput): Promise<FabExtractKnowledgeOutput>;
656
672
 
673
+ /**
674
+ * fab_review / fab_pending facade (ISS-20260713-013).
675
+ * Action implementations live in review-write-actions / review-search;
676
+ * path/sandbox/list helpers in review-shared; frontmatter in review-frontmatter.
677
+ */
678
+
657
679
  /**
658
680
  * v2.0 rc.3 fab_review service (W3-K K2: WRITE-only).
659
681
  *
@@ -900,6 +922,26 @@ declare function readEventLedger(projectRoot: string, options?: ReadEventLedgerO
900
922
  */
901
923
  declare function flushAndSyncEventLedger(projectRoot: string): void;
902
924
 
925
+ /**
926
+ * ISS-20260713-011: selection_token mint / LRU cache for plan-context.
927
+ */
928
+ type SelectionTokenState = {
929
+ token: string;
930
+ revision_hash: string;
931
+ target_paths: string[];
932
+ required_stable_ids: string[];
933
+ ai_selectable_stable_ids: string[];
934
+ created_at: number;
935
+ expires_at: number;
936
+ };
937
+ declare function readSelectionToken(token: string, now?: number): SelectionTokenState | undefined;
938
+
939
+ /**
940
+ * planContext facade (ISS-20260713-011).
941
+ * Scoring / BM25 cache / selection-token live in dedicated modules;
942
+ * this file orchestrates the plan-context pipeline and re-exports the public API.
943
+ */
944
+
903
945
  type PlanContextInput = {
904
946
  paths: string[];
905
947
  intent?: string;
@@ -966,17 +1008,7 @@ type PlanContextResult = {
966
1008
  /** Internal service→tool signal; stripped before MCP output. */
967
1009
  payload_over_budget?: boolean;
968
1010
  };
969
- type SelectionTokenState = {
970
- token: string;
971
- revision_hash: string;
972
- target_paths: string[];
973
- required_stable_ids: string[];
974
- ai_selectable_stable_ids: string[];
975
- created_at: number;
976
- expires_at: number;
977
- };
978
1011
  declare function planContext(projectRoot: string, input: PlanContextInput): Promise<PlanContextResult>;
979
- declare function readSelectionToken(token: string, now?: number): SelectionTokenState | undefined;
980
1012
 
981
1013
  type RecallInput = PlanContextInput & {
982
1014
  /**
@@ -1167,4 +1199,4 @@ interface ShutdownHandlerDeps {
1167
1199
  */
1168
1200
  declare function createShutdownHandler(deps: ShutdownHandlerDeps): () => void;
1169
1201
 
1170
- export { AGENTS_MD_RESOURCE_URI, type AlwaysActiveBody, type ArchiveHistoryEntry, type ArchiveHistoryReport, type BacklogAgeMetric, COLD_EVAL_RUBRIC, type CiteCoverageReport, type ColdEvalBatch, type ColdEvalCandidate, type ColdEvalVerdict, type ConflictEntry, type ConflictJudge, type ConflictLintReport, type ConflictPair, type ConflictVerdict, type ConsumptionEntry, type ConsumptionInspection, type ConsumptionLintConfig, DEFAULT_CONFLICT_SIMILARITY_THRESHOLD, type DoctorApplyLintMutation, type DoctorApplyLintMutationKind, type DoctorApplyLintReport, type DoctorFixReport, type DoctorIssue, type DoctorReport, EVENT_LEDGER_PATH, type EnrichDescriptionsCandidate, type EnrichDescriptionsMode, type EnrichDescriptionsReport, FABRIC_SERVER_INSTRUCTIONS, type HistoryAllReport, type HistoryDayRow, type InFlightTracker, type KnowledgeCensus, LEDGER_PATH, LEGACY_LEDGER_PATH, METRICS_LEDGER_PATH, METRIC_COUNTER_NAMES, type MetricCounterName, type MetricsRow, OPTIONAL_EMBED_PACKAGE, type PlanContextInput, type PlanContextResult, type PrecheckResult, RETIRED_TOKENS, type RecallInput, type RecallResult, type RelatedBrokenLink, type RelatedGraphInspection, type RelatedGraphNode, type RelatedHubEntry, type RequirementProfile, type RetiredReferenceHit, type RetiredReferenceInspection, type RetiredToken, type SelectionTokenState, type ShutdownHandlerDeps, type StoreCanonicalEntry, type StoreReachability, type SurfaceVerdict, type UnboundProjectViolation, type WhyNotSurfacedResult, aggregateConsumption, appendEventLedgerEvent, buildAlwaysActiveBodies, buildColdEvalBatch, buildKnowledgeCensus, buildRelatedGraph, bumpCounter, checkBacklogAge, clearPrecheckCache, collectStoreCanonicalEntries, contextCache, createFabricServer, createInFlightTracker, createShutdownHandler, defaultEmbedCacheDir, detectUnboundProject, drainCounters, enrichDescriptions, evaluateStoreDir, explainWhyNotSurfaced, extractKnowledge, findConflictCandidates, flushAndSyncEventLedger, flushMetrics, formatPreexistingRootMessage, getEventLedgerPath, getLedgerPath, getLegacyLedgerPath, getMetricsLedgerPath, inspectConsumption, inspectRelatedGraph, inspectRetiredReferences, isEmbedderResolvable, lintConflicts, loadConflictEntries, loadEmbedder, pairSimilarity, planContext, precheckStoreReachability, readEmbedConfig, readEventLedger, readFusion, readLedger, readMetrics, readSelectionToken, recall, rehydrateAgentsMetaAt, renderBacklogAgeLine, resolveLedgerPaths, reviewKnowledge, reviewPending, runDoctorApplyLint, runDoctorArchiveHistory, runDoctorCiteCoverage, runDoctorConflictLint, runDoctorFix, runDoctorHistoryAll, runDoctorReport, startMetricsFlush, startRotationTick, startStdioServer, stopMetricsFlush, stopRotationTick };
1202
+ export { AGENTS_MD_RESOURCE_URI, type AlwaysActiveBody, type ArchiveHistoryEntry, type ArchiveHistoryReport, type BacklogAgeMetric, COLD_EVAL_RUBRIC, type CiteCoverageReport, type ColdEvalBatch, type ColdEvalCandidate, type ColdEvalVerdict, type ConflictEntry, type ConflictJudge, type ConflictLintReport, type ConflictPair, type ConflictVerdict, type ConsumptionEntry, type ConsumptionInspection, type ConsumptionLintConfig, DEFAULT_CONFLICT_SIMILARITY_THRESHOLD, type DoctorApplyLintMutation, type DoctorApplyLintMutationKind, type DoctorApplyLintReport, type DoctorFixReport, type DoctorIssue, type DoctorReport, EVENT_LEDGER_PATH, type EnrichDescriptionsCandidate, type EnrichDescriptionsMode, type EnrichDescriptionsReport, FABRIC_SERVER_INSTRUCTIONS, type HistoryAllReport, type HistoryDayRow, type InFlightTracker, type KnowledgeCensus, LEDGER_PATH, LEGACY_LEDGER_PATH, METRICS_LEDGER_PATH, METRIC_COUNTER_NAMES, type MetricCounterName, type MetricsRow, OPTIONAL_EMBED_PACKAGE, type PlanContextInput, type PlanContextResult, type PrecheckResult, RETIRED_TOKENS, type RecallInput, type RecallResult, type RelatedBrokenLink, type RelatedGraphInspection, type RelatedGraphNode, type RelatedHubEntry, type RequirementProfile, type RetiredReferenceHit, type RetiredReferenceInspection, type RetiredToken, type SelectionTokenState, type ShutdownHandlerDeps, type StoreCanonicalEntry, type StoreReachability, type SurfaceVerdict, type UnboundProjectViolation, type WhyNotSurfacedResult, aggregateConsumption, appendEventLedgerEvent, buildAlwaysActiveBodies, buildColdEvalBatch, buildKnowledgeCensus, buildRelatedGraph, bumpCounter, checkBacklogAge, clearPrecheckCache, collectStoreCanonicalEntries, computeReadSetRevision, contextCache, createFabricServer, createInFlightTracker, createShutdownHandler, defaultEmbedCacheDir, detectUnboundProject, drainCounters, enrichDescriptions, evaluateStoreDir, explainWhyNotSurfaced, extractKnowledge, findConflictCandidates, flushAndSyncEventLedger, flushMetrics, formatPreexistingRootMessage, getEventLedgerPath, getLedgerPath, getLegacyLedgerPath, getMetricsLedgerPath, inspectConsumption, inspectRelatedGraph, inspectRetiredReferences, isEmbedderResolvable, lintConflicts, loadConflictEntries, loadEmbedder, pairSimilarity, planContext, precheckStoreReachability, readEmbedConfig, readEventLedger, readFusion, readLedger, readMetrics, readSelectionToken, recall, rehydrateAgentsMetaAt, renderBacklogAgeLine, resolveLedgerPaths, reviewKnowledge, reviewPending, runDoctorApplyLint, runDoctorArchiveHistory, runDoctorCiteCoverage, runDoctorConflictLint, runDoctorFix, runDoctorHistoryAll, runDoctorReport, startMetricsFlush, startRotationTick, startStdioServer, stopMetricsFlush, stopRotationTick };