@fenglimg/fabric-server 2.0.0-rc.23 → 2.0.0-rc.26
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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Server } from 'node:http';
|
|
2
2
|
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
3
|
-
import { AgentsMeta, KnowledgeTestIndex, AgentsLayer, AgentsTopologyType,
|
|
3
|
+
import { AgentsMeta, KnowledgeTestIndex, AgentsLayer, AgentsTopologyType, KnowledgeType, Layer, StableId, AgentsMetaCounters, EventLedgerEventInput, EventLedgerEvent, RuleDescriptionIndexItem } from '@fenglimg/fabric-shared';
|
|
4
4
|
import { FabExtractKnowledgeInput, FabExtractKnowledgeOutput, FabReviewInput, FabReviewOutput } from '@fenglimg/fabric-shared/schemas/api-contracts';
|
|
5
5
|
import { IOFabricError } from '@fenglimg/fabric-shared/errors';
|
|
6
6
|
|
|
@@ -38,6 +38,7 @@ type DoctorIssue = {
|
|
|
38
38
|
name: string;
|
|
39
39
|
message: string;
|
|
40
40
|
path?: string;
|
|
41
|
+
actionHint?: string;
|
|
41
42
|
};
|
|
42
43
|
type DoctorSummary = {
|
|
43
44
|
target: string;
|
|
@@ -97,12 +98,26 @@ type DoctorApplyLintReport = {
|
|
|
97
98
|
declare function runDoctorReport(target: string): Promise<DoctorReport>;
|
|
98
99
|
declare function runDoctorFix(target: string): Promise<DoctorFixReport>;
|
|
99
100
|
declare function runDoctorApplyLint(target: string): Promise<DoctorApplyLintReport>;
|
|
101
|
+
type CiteContractMetrics = {
|
|
102
|
+
decisions_cited: number;
|
|
103
|
+
pitfalls_cited: number;
|
|
104
|
+
contract_with: number;
|
|
105
|
+
contract_missing: number;
|
|
106
|
+
hard_violated: number;
|
|
107
|
+
cite_id_unresolved: number;
|
|
108
|
+
skip_count: Record<string, number>;
|
|
109
|
+
};
|
|
110
|
+
type CiteLayerTypeBreakdown = {
|
|
111
|
+
team: Record<string, number>;
|
|
112
|
+
personal: Record<string, number>;
|
|
113
|
+
};
|
|
100
114
|
type CiteCoverageReport = {
|
|
101
115
|
status: "ok" | "skipped";
|
|
102
116
|
marker_ts: number;
|
|
103
117
|
marker_emitted_now: boolean;
|
|
104
118
|
since_ts: number;
|
|
105
119
|
client_filter: "cc" | "codex" | "cursor" | "all";
|
|
120
|
+
layer_filter?: "team" | "personal" | "all";
|
|
106
121
|
metrics: {
|
|
107
122
|
edits_touched: number;
|
|
108
123
|
qualifying_cites: number;
|
|
@@ -113,12 +128,34 @@ type CiteCoverageReport = {
|
|
|
113
128
|
per_client?: Record<string, Partial<CiteCoverageReport["metrics"]>>;
|
|
114
129
|
dismissed_reason_histogram?: Record<string, number>;
|
|
115
130
|
none_reason_histogram?: Record<string, number>;
|
|
131
|
+
contract_metrics_status?: "ok" | "skipped:bootstrap_drift" | "awaiting_marker";
|
|
132
|
+
contract_metrics?: CiteContractMetrics;
|
|
133
|
+
per_layer_type?: CiteLayerTypeBreakdown;
|
|
134
|
+
contract_marker_ts?: number;
|
|
116
135
|
generated_at: string;
|
|
117
136
|
};
|
|
118
137
|
declare function runDoctorCiteCoverage(projectRoot: string, options: {
|
|
119
138
|
since: number;
|
|
120
139
|
client: "cc" | "codex" | "cursor" | "all";
|
|
140
|
+
layer?: "team" | "personal" | "all";
|
|
121
141
|
}): Promise<CiteCoverageReport>;
|
|
142
|
+
type ArchiveHistoryEntry = {
|
|
143
|
+
session_id_short: string;
|
|
144
|
+
last_attempted_at: string;
|
|
145
|
+
outcome: "proposed" | "viability_failed" | "user_dismissed" | "skipped_no_signal";
|
|
146
|
+
candidates_proposed: number;
|
|
147
|
+
covered_through_ts: number;
|
|
148
|
+
age_since_covered_hours: number;
|
|
149
|
+
};
|
|
150
|
+
type ArchiveHistoryReport = {
|
|
151
|
+
entries: ArchiveHistoryEntry[];
|
|
152
|
+
total: number;
|
|
153
|
+
since_ms: number;
|
|
154
|
+
generated_at: string;
|
|
155
|
+
};
|
|
156
|
+
declare function runDoctorArchiveHistory(projectRoot: string, options: {
|
|
157
|
+
since: number;
|
|
158
|
+
}): Promise<ArchiveHistoryReport>;
|
|
122
159
|
type EnrichDescriptionsMode = "auto" | "interactive";
|
|
123
160
|
type EnrichDescriptionsCandidate = {
|
|
124
161
|
path: string;
|
|
@@ -149,6 +186,31 @@ type KnowledgeMetaBuildResult = {
|
|
|
149
186
|
type WriteKnowledgeMetaOptions = {
|
|
150
187
|
source: KnowledgeMetaBuildSource;
|
|
151
188
|
};
|
|
189
|
+
/**
|
|
190
|
+
* v2.0-rc.24 TASK-07: Load a Map<stable_id, knowledge_type> from the
|
|
191
|
+
* project's `.fabric/agents.meta.json`. Consumed by the doctor cite-coverage
|
|
192
|
+
* routing (TASK-08) to dispatch cites to the correct policy bucket
|
|
193
|
+
* (decision/pitfall = strict contract / model = reference-only /
|
|
194
|
+
* guideline+process = deferred to rc.25 LLM-judge). Cited ids absent from
|
|
195
|
+
* this map fall into the `cite_id_unresolved` bucket.
|
|
196
|
+
*
|
|
197
|
+
* **Singular knowledge_type contract (rc.24 lock):** the returned map values
|
|
198
|
+
* are the SINGULAR `KnowledgeType` enum (`"model" | "decision" | "guideline"
|
|
199
|
+
* | "pitfall" | "process"`) — matching both the on-disk `agents.meta.json`
|
|
200
|
+
* storage AND the canonical `KnowledgeTypeSchema` exported from
|
|
201
|
+
* `@fenglimg/fabric-shared`. No normalization happens at this boundary; the
|
|
202
|
+
* loader is a thin extract over engine-maintained meta. Downstream callers
|
|
203
|
+
* (TASK-08 doctor) must match against the singular enum.
|
|
204
|
+
*
|
|
205
|
+
* Both team (KT-*) and personal (KP-*) entries are included — they live in
|
|
206
|
+
* the same `meta.nodes` map.
|
|
207
|
+
*
|
|
208
|
+
* Graceful on failure: a missing meta file, malformed JSON, or schema
|
|
209
|
+
* validation failure all yield an empty Map (no throw). The doctor will then
|
|
210
|
+
* surface every cite as `cite_id_unresolved`, which is the safe degraded
|
|
211
|
+
* mode.
|
|
212
|
+
*/
|
|
213
|
+
declare function loadKbIdTypeMap(projectRootInput: string): Promise<Map<string, KnowledgeType>>;
|
|
152
214
|
declare function buildKnowledgeMeta(projectRootInput: string): Promise<KnowledgeMetaBuildResult>;
|
|
153
215
|
declare function writeKnowledgeMeta(projectRootInput: string, options: WriteKnowledgeMetaOptions): Promise<KnowledgeMetaBuildResult>;
|
|
154
216
|
declare function computeKnowledgeBasedAgentsMeta(projectRootInput: string, existingMeta?: AgentsMeta): Promise<AgentsMeta>;
|
|
@@ -435,4 +497,4 @@ declare function startHttpServer(options: {
|
|
|
435
497
|
authToken?: string;
|
|
436
498
|
}): Promise<Server>;
|
|
437
499
|
|
|
438
|
-
export { AGENTS_MD_RESOURCE_URI, type AcquireOptions, type CiteCoverageReport, type DoctorApplyLintMutation, type DoctorApplyLintMutationKind, type DoctorApplyLintReport, type DoctorFixReport, type DoctorIssue, type DoctorReport, EVENT_LEDGER_PATH, type EnrichDescriptionsCandidate, type EnrichDescriptionsMode, type EnrichDescriptionsReport, type InFlightTracker, KnowledgeIdAllocator, type KnowledgeMetaBuildResult, type KnowledgeMetaBuildSource, type KnowledgeSyncLedgerEvent, type KnowledgeSyncOptions, type KnowledgeSyncReport, LEDGER_PATH, LEGACY_LEDGER_PATH, type LedgerEvent, type LockState, type PlanContextInput, type PlanContextResult, type ReconcileKnowledgeOptions, type RequirementProfile, type SelectionTokenState, ServeLockHeldError, type ShutdownHandlerDeps, type StructuredWarning, type WriteKnowledgeMetaOptions, acquireLock, appendEventLedgerEvent, buildKnowledgeMeta, checkLockOrThrow, computeKnowledgeBasedAgentsMeta, computeKnowledgeTestIndex, createFabricServer, createInFlightTracker, createShutdownHandler, deriveKnowledgeMetaLayer, deriveKnowledgeMetaTopologyType, enrichDescriptions, ensureKnowledgeFresh, extractKnowledge, flushAndSyncEventLedger, formatPreexistingRootMessage, getEventLedgerPath, getLedgerPath, getLegacyLedgerPath, isSameKnowledgeTestIndex, planContext, readLockState, readSelectionToken, reconcileKnowledge, releaseLock, reviewKnowledge, runDoctorApplyLint, runDoctorCiteCoverage, runDoctorFix, runDoctorReport, stableStringify, startHttpServer, startStdioServer, writeKnowledgeMeta };
|
|
500
|
+
export { AGENTS_MD_RESOURCE_URI, type AcquireOptions, type ArchiveHistoryEntry, type ArchiveHistoryReport, type CiteCoverageReport, type DoctorApplyLintMutation, type DoctorApplyLintMutationKind, type DoctorApplyLintReport, type DoctorFixReport, type DoctorIssue, type DoctorReport, EVENT_LEDGER_PATH, type EnrichDescriptionsCandidate, type EnrichDescriptionsMode, type EnrichDescriptionsReport, type InFlightTracker, KnowledgeIdAllocator, type KnowledgeMetaBuildResult, type KnowledgeMetaBuildSource, type KnowledgeSyncLedgerEvent, type KnowledgeSyncOptions, type KnowledgeSyncReport, LEDGER_PATH, LEGACY_LEDGER_PATH, type LedgerEvent, type LockState, type PlanContextInput, type PlanContextResult, type ReconcileKnowledgeOptions, type RequirementProfile, type SelectionTokenState, ServeLockHeldError, type ShutdownHandlerDeps, type StructuredWarning, type WriteKnowledgeMetaOptions, acquireLock, appendEventLedgerEvent, buildKnowledgeMeta, checkLockOrThrow, computeKnowledgeBasedAgentsMeta, computeKnowledgeTestIndex, createFabricServer, createInFlightTracker, createShutdownHandler, deriveKnowledgeMetaLayer, deriveKnowledgeMetaTopologyType, enrichDescriptions, ensureKnowledgeFresh, extractKnowledge, flushAndSyncEventLedger, formatPreexistingRootMessage, getEventLedgerPath, getLedgerPath, getLegacyLedgerPath, isSameKnowledgeTestIndex, loadKbIdTypeMap, planContext, readLockState, readSelectionToken, reconcileKnowledge, releaseLock, reviewKnowledge, runDoctorApplyLint, runDoctorArchiveHistory, runDoctorCiteCoverage, runDoctorFix, runDoctorReport, stableStringify, startHttpServer, startStdioServer, writeKnowledgeMeta };
|
package/dist/index.js
CHANGED
|
@@ -23,19 +23,21 @@ import {
|
|
|
23
23
|
isSameKnowledgeTestIndex,
|
|
24
24
|
loadActiveMeta,
|
|
25
25
|
loadActiveMetaOrStale,
|
|
26
|
+
loadKbIdTypeMap,
|
|
26
27
|
normalizeKnowledgePath,
|
|
27
28
|
readLockState,
|
|
28
29
|
reconcileKnowledge,
|
|
29
30
|
releaseLock,
|
|
30
31
|
resolveProjectRoot,
|
|
31
32
|
runDoctorApplyLint,
|
|
33
|
+
runDoctorArchiveHistory,
|
|
32
34
|
runDoctorCiteCoverage,
|
|
33
35
|
runDoctorFix,
|
|
34
36
|
runDoctorReport,
|
|
35
37
|
sha256,
|
|
36
38
|
stableStringify,
|
|
37
39
|
writeKnowledgeMeta
|
|
38
|
-
} from "./chunk-
|
|
40
|
+
} from "./chunk-RHWIDD6A.js";
|
|
39
41
|
|
|
40
42
|
// src/index.ts
|
|
41
43
|
import { existsSync as existsSync4 } from "fs";
|
|
@@ -1892,7 +1894,7 @@ function formatPreexistingRootMessage(projectRoot) {
|
|
|
1892
1894
|
function createFabricServer(tracker) {
|
|
1893
1895
|
const server = new McpServer({
|
|
1894
1896
|
name: "fabric-knowledge-server",
|
|
1895
|
-
version: "2.0.0-rc.
|
|
1897
|
+
version: "2.0.0-rc.26"
|
|
1896
1898
|
});
|
|
1897
1899
|
registerPlanContext(server, tracker);
|
|
1898
1900
|
registerKnowledgeSections(server, tracker);
|
|
@@ -2000,7 +2002,7 @@ function createShutdownHandler(deps) {
|
|
|
2000
2002
|
};
|
|
2001
2003
|
}
|
|
2002
2004
|
async function startHttpServer(options) {
|
|
2003
|
-
const { createFabricHttpApp } = await import("./http-
|
|
2005
|
+
const { createFabricHttpApp } = await import("./http-FMSBWYMO.js");
|
|
2004
2006
|
const { port, projectRoot, host = "127.0.0.1", authToken } = options;
|
|
2005
2007
|
const app = createFabricHttpApp({ projectRoot, host, authToken });
|
|
2006
2008
|
return await new Promise((resolveServer, rejectServer) => {
|
|
@@ -2052,6 +2054,7 @@ export {
|
|
|
2052
2054
|
getLedgerPath,
|
|
2053
2055
|
getLegacyLedgerPath,
|
|
2054
2056
|
isSameKnowledgeTestIndex,
|
|
2057
|
+
loadKbIdTypeMap,
|
|
2055
2058
|
planContext,
|
|
2056
2059
|
readLockState,
|
|
2057
2060
|
readSelectionToken,
|
|
@@ -2059,6 +2062,7 @@ export {
|
|
|
2059
2062
|
releaseLock,
|
|
2060
2063
|
reviewKnowledge,
|
|
2061
2064
|
runDoctorApplyLint,
|
|
2065
|
+
runDoctorArchiveHistory,
|
|
2062
2066
|
runDoctorCiteCoverage,
|
|
2063
2067
|
runDoctorFix,
|
|
2064
2068
|
runDoctorReport,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fenglimg/fabric-server",
|
|
3
|
-
"version": "2.0.0-rc.
|
|
3
|
+
"version": "2.0.0-rc.26",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"express": "^5.2.1",
|
|
14
14
|
"minimatch": "^10.0.1",
|
|
15
15
|
"zod": "^3.25.0",
|
|
16
|
-
"@fenglimg/fabric-shared": "2.0.0-rc.
|
|
16
|
+
"@fenglimg/fabric-shared": "2.0.0-rc.26"
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
|
19
19
|
"@types/express": "^5.0.6",
|