@fenglimg/fabric-shared 1.8.0-rc.3 → 2.0.0-rc.10
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/chunk-G4IKTNY4.js +609 -0
- package/dist/{chunk-FEEWLYO3.js → chunk-YGEE3WMC.js} +122 -21
- package/dist/i18n/index.d.ts +1 -1
- package/dist/i18n/index.js +1 -1
- package/dist/index.d.ts +3398 -1031
- package/dist/index.js +385 -82
- package/dist/node.js +172 -3
- package/dist/schemas/api-contracts.d.ts +920 -114
- package/dist/schemas/api-contracts.js +55 -13
- package/dist/types/index.d.ts +37 -6
- package/package.json +3 -7
- package/dist/chunk-GI6L6VTT.js +0 -176
- package/dist/chunk-KV27CZH3.js +0 -223
- package/dist/node/bootstrap-guide.d.ts +0 -12
- package/dist/node/bootstrap-guide.js +0 -52
package/dist/index.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import "./chunk-LXNCAKJZ.js";
|
|
2
1
|
import {
|
|
3
2
|
PROTECTED_TOKENS,
|
|
4
3
|
createTranslator,
|
|
@@ -7,25 +6,47 @@ import {
|
|
|
7
6
|
enMessages,
|
|
8
7
|
normalizeLocale,
|
|
9
8
|
zhCNMessages
|
|
10
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-YGEE3WMC.js";
|
|
11
10
|
import {
|
|
11
|
+
FabExtractKnowledgeInputSchema,
|
|
12
|
+
FabExtractKnowledgeInputShape,
|
|
13
|
+
FabExtractKnowledgeOutputSchema,
|
|
14
|
+
FabReviewInputSchema,
|
|
15
|
+
FabReviewInputShape,
|
|
16
|
+
FabReviewOutputSchema,
|
|
17
|
+
FabReviewOutputShape,
|
|
18
|
+
KNOWLEDGE_TYPE_CODES,
|
|
19
|
+
KnowledgeEntryFrontmatterSchema,
|
|
20
|
+
KnowledgeTypeSchema,
|
|
21
|
+
LayerSchema,
|
|
22
|
+
MaturitySchema,
|
|
23
|
+
PROPOSED_REASON_DESCRIPTIONS,
|
|
24
|
+
ProposedReasonSchema,
|
|
25
|
+
StableIdSchema,
|
|
12
26
|
annotateIntentRequestSchema,
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
27
|
+
fabExtractKnowledgeAnnotations,
|
|
28
|
+
fabReviewAnnotations,
|
|
29
|
+
formatKnowledgeId,
|
|
30
|
+
getKnowledgeAnnotations,
|
|
31
|
+
getKnowledgeInputSchema,
|
|
32
|
+
getKnowledgeOutputSchema,
|
|
16
33
|
historyStateQuerySchema,
|
|
17
34
|
humanLockApproveRequestSchema,
|
|
18
35
|
humanLockFileParamsSchema,
|
|
36
|
+
knowledgeSectionsAnnotations,
|
|
37
|
+
knowledgeSectionsInputSchema,
|
|
38
|
+
knowledgeSectionsOutputSchema,
|
|
19
39
|
ledgerQuerySchema,
|
|
20
40
|
ledgerSourceSchema,
|
|
41
|
+
parseKnowledgeId,
|
|
21
42
|
planContextAnnotations,
|
|
43
|
+
planContextHintNarrowEntrySchema,
|
|
44
|
+
planContextHintOutputSchema,
|
|
22
45
|
planContextInputSchema,
|
|
23
46
|
planContextOutputSchema,
|
|
24
|
-
ruleSectionsAnnotations,
|
|
25
|
-
ruleSectionsInputSchema,
|
|
26
|
-
ruleSectionsOutputSchema,
|
|
27
47
|
structuredWarningSchema
|
|
28
|
-
} from "./chunk-
|
|
48
|
+
} from "./chunk-G4IKTNY4.js";
|
|
49
|
+
import "./chunk-LXNCAKJZ.js";
|
|
29
50
|
|
|
30
51
|
// src/schemas/agents-meta.ts
|
|
31
52
|
import { z } from "zod";
|
|
@@ -42,7 +63,22 @@ var ruleDescriptionSchema = z.object({
|
|
|
42
63
|
tech_stack: z.array(z.string()),
|
|
43
64
|
impact: z.array(z.string()),
|
|
44
65
|
must_read_if: z.string(),
|
|
45
|
-
entities: z.array(z.string()).optional()
|
|
66
|
+
entities: z.array(z.string()).optional(),
|
|
67
|
+
// v2.0 knowledge entry fields (TASK-002 schemas). All optional for backward compat.
|
|
68
|
+
id: z.string().optional(),
|
|
69
|
+
knowledge_type: z.enum(["model", "decision", "guideline", "pitfall", "process"]).optional(),
|
|
70
|
+
maturity: z.enum(["draft", "verified", "proven"]).optional(),
|
|
71
|
+
knowledge_layer: z.enum(["personal", "team"]).optional(),
|
|
72
|
+
layer_reason: z.string().optional(),
|
|
73
|
+
created_at: z.string().optional(),
|
|
74
|
+
// v2/rc.2: flat flow-style YAML array; populated by init-scan from forensic tech stack and editable by user. Used by rc.3 review skill for tag-filter search.
|
|
75
|
+
tags: z.array(z.string()).default([]).optional(),
|
|
76
|
+
// v2.0-rc.5 (C1): relevance scope/paths drive plan-context-hint narrowing.
|
|
77
|
+
// Defaults applied so existing entries lacking these fields parse cleanly:
|
|
78
|
+
// relevance_scope → 'broad' (always-surface, safe default)
|
|
79
|
+
// relevance_paths → [] (no path anchors)
|
|
80
|
+
relevance_scope: z.enum(["narrow", "broad"]).default("broad"),
|
|
81
|
+
relevance_paths: z.array(z.string()).default([])
|
|
46
82
|
}).strict();
|
|
47
83
|
var ruleDescriptionIndexItemSchema = z.object({
|
|
48
84
|
stable_id: z.string(),
|
|
@@ -55,11 +91,6 @@ var agentsMetaNodeBaseSchema = z.object({
|
|
|
55
91
|
file: z.string(),
|
|
56
92
|
content_ref: z.string().optional(),
|
|
57
93
|
scope_glob: z.string(),
|
|
58
|
-
deps: z.array(z.string()),
|
|
59
|
-
priority: z.enum(["high", "medium", "low"]),
|
|
60
|
-
level: agentsLayerSchema.optional(),
|
|
61
|
-
layer: agentsLayerSchema,
|
|
62
|
-
topology_type: agentsTopologyTypeSchema,
|
|
63
94
|
hash: z.string(),
|
|
64
95
|
stable_id: z.string().optional(),
|
|
65
96
|
identity_source: agentsIdentitySourceSchema.optional(),
|
|
@@ -69,20 +100,40 @@ var agentsMetaNodeBaseSchema = z.object({
|
|
|
69
100
|
}).optional(),
|
|
70
101
|
description: ruleDescriptionSchema.optional(),
|
|
71
102
|
sections: z.array(z.string()).optional()
|
|
72
|
-
});
|
|
103
|
+
}).passthrough();
|
|
73
104
|
var agentsMetaNodeSchema = z.preprocess((value) => {
|
|
74
105
|
if (!isRecord(value) || typeof value.file !== "string") {
|
|
75
106
|
return value;
|
|
76
107
|
}
|
|
77
108
|
return withDerivedAgentsMetaNodeDefaults(value);
|
|
78
109
|
}, agentsMetaNodeBaseSchema);
|
|
110
|
+
var knowledgeTypeCountersSchema = z.object({
|
|
111
|
+
MOD: z.number().int().nonnegative().default(0),
|
|
112
|
+
DEC: z.number().int().nonnegative().default(0),
|
|
113
|
+
GLD: z.number().int().nonnegative().default(0),
|
|
114
|
+
PIT: z.number().int().nonnegative().default(0),
|
|
115
|
+
PRO: z.number().int().nonnegative().default(0)
|
|
116
|
+
}).default({ MOD: 0, DEC: 0, GLD: 0, PIT: 0, PRO: 0 });
|
|
117
|
+
var AgentsMetaCountersSchema = z.object({
|
|
118
|
+
KP: knowledgeTypeCountersSchema,
|
|
119
|
+
KT: knowledgeTypeCountersSchema
|
|
120
|
+
}).default({
|
|
121
|
+
KP: { MOD: 0, DEC: 0, GLD: 0, PIT: 0, PRO: 0 },
|
|
122
|
+
KT: { MOD: 0, DEC: 0, GLD: 0, PIT: 0, PRO: 0 }
|
|
123
|
+
});
|
|
79
124
|
var agentsMetaSchema = z.object({
|
|
80
125
|
revision: z.string(),
|
|
81
|
-
nodes: z.record(agentsMetaNodeSchema)
|
|
126
|
+
nodes: z.record(agentsMetaNodeSchema),
|
|
127
|
+
counters: AgentsMetaCountersSchema.optional()
|
|
82
128
|
});
|
|
129
|
+
var KNOWLEDGE_STABLE_ID_PATTERN = /^K[PT]-(MOD|DEC|GLD|PIT|PRO)-\d{4,}$/u;
|
|
130
|
+
function isKnowledgeStableId(stableId) {
|
|
131
|
+
return stableId !== void 0 && KNOWLEDGE_STABLE_ID_PATTERN.test(stableId);
|
|
132
|
+
}
|
|
83
133
|
function withDerivedAgentsMetaNodeDefaults(node) {
|
|
134
|
+
const isKnowledgeEntry = isKnowledgeStableId(node.stable_id);
|
|
84
135
|
const stableId = node.stable_id ?? deriveAgentsMetaStableId(node.file);
|
|
85
|
-
const identitySource = deriveAgentsMetaIdentitySource(node);
|
|
136
|
+
const identitySource = isKnowledgeEntry ? "declared" : deriveAgentsMetaIdentitySource(node);
|
|
86
137
|
return {
|
|
87
138
|
...node,
|
|
88
139
|
layer: node.layer ?? node.level ?? deriveAgentsMetaLayer(node.file),
|
|
@@ -92,6 +143,27 @@ function withDerivedAgentsMetaNodeDefaults(node) {
|
|
|
92
143
|
identity_source: identitySource
|
|
93
144
|
};
|
|
94
145
|
}
|
|
146
|
+
function allocateKnowledgeId(layer, type, current) {
|
|
147
|
+
const layerKey = layer === "personal" ? "KP" : "KT";
|
|
148
|
+
const typeCode = KNOWLEDGE_TYPE_CODES[type];
|
|
149
|
+
const previousCount = current[layerKey][typeCode] ?? 0;
|
|
150
|
+
const nextCount = previousCount + 1;
|
|
151
|
+
const id = formatKnowledgeId(layer, type, nextCount);
|
|
152
|
+
const nextCounters = {
|
|
153
|
+
...current,
|
|
154
|
+
[layerKey]: {
|
|
155
|
+
...current[layerKey],
|
|
156
|
+
[typeCode]: nextCount
|
|
157
|
+
}
|
|
158
|
+
};
|
|
159
|
+
return { id, nextCounters };
|
|
160
|
+
}
|
|
161
|
+
function defaultAgentsMetaCounters() {
|
|
162
|
+
return {
|
|
163
|
+
KP: { MOD: 0, DEC: 0, GLD: 0, PIT: 0, PRO: 0 },
|
|
164
|
+
KT: { MOD: 0, DEC: 0, GLD: 0, PIT: 0, PRO: 0 }
|
|
165
|
+
};
|
|
166
|
+
}
|
|
95
167
|
function deriveAgentsMetaStableId(file) {
|
|
96
168
|
const normalized = normalizePath(file);
|
|
97
169
|
if (normalized === "AGENTS.md" || normalized === ".fabric/bootstrap/README.md") {
|
|
@@ -103,6 +175,9 @@ function deriveAgentsMetaIdentitySource(node) {
|
|
|
103
175
|
if (node.identity_source !== void 0) {
|
|
104
176
|
return node.identity_source;
|
|
105
177
|
}
|
|
178
|
+
if (isKnowledgeStableId(node.stable_id)) {
|
|
179
|
+
return "declared";
|
|
180
|
+
}
|
|
106
181
|
const derivedStableId = deriveAgentsMetaStableId(node.file);
|
|
107
182
|
return node.stable_id !== void 0 && node.stable_id !== derivedStableId ? "declared" : "derived";
|
|
108
183
|
}
|
|
@@ -144,11 +219,11 @@ function isRecord(value) {
|
|
|
144
219
|
return typeof value === "object" && value !== null;
|
|
145
220
|
}
|
|
146
221
|
|
|
147
|
-
// src/schemas/
|
|
222
|
+
// src/schemas/knowledge-test-index.ts
|
|
148
223
|
import { z as z2 } from "zod";
|
|
149
|
-
var
|
|
224
|
+
var KNOWLEDGE_TEST_INDEX_SCHEMA_VERSION = 1;
|
|
150
225
|
var hashSchema = z2.string().min(1);
|
|
151
|
-
var
|
|
226
|
+
var knowledgeTestLinkSchema = z2.object({
|
|
152
227
|
rule_stable_id: z2.string().min(1),
|
|
153
228
|
rule_file: z2.string().min(1),
|
|
154
229
|
rule_hash: hashSchema,
|
|
@@ -158,20 +233,20 @@ var ruleTestLinkSchema = z2.object({
|
|
|
158
233
|
previous_test_hash: hashSchema.optional(),
|
|
159
234
|
annotation_line: z2.number().int().positive()
|
|
160
235
|
}).strict();
|
|
161
|
-
var
|
|
236
|
+
var knowledgeTestOrphanAnnotationSchema = z2.object({
|
|
162
237
|
rule_stable_id: z2.string().min(1),
|
|
163
238
|
test_file: z2.string().min(1),
|
|
164
239
|
test_hash: hashSchema,
|
|
165
240
|
previous_test_hash: hashSchema.optional(),
|
|
166
241
|
annotation_line: z2.number().int().positive()
|
|
167
242
|
}).strict();
|
|
168
|
-
var
|
|
169
|
-
schema_version: z2.literal(
|
|
243
|
+
var knowledgeTestIndexSchema = z2.object({
|
|
244
|
+
schema_version: z2.literal(KNOWLEDGE_TEST_INDEX_SCHEMA_VERSION),
|
|
170
245
|
generated_at: z2.string().datetime({ offset: true }),
|
|
171
246
|
revision: z2.string().min(1).optional(),
|
|
172
247
|
previous_revision: z2.string().min(1).optional(),
|
|
173
|
-
links: z2.array(
|
|
174
|
-
orphan_annotations: z2.array(
|
|
248
|
+
links: z2.array(knowledgeTestLinkSchema),
|
|
249
|
+
orphan_annotations: z2.array(knowledgeTestOrphanAnnotationSchema)
|
|
175
250
|
}).strict();
|
|
176
251
|
|
|
177
252
|
// src/schemas/ledger-entry.ts
|
|
@@ -226,18 +301,79 @@ var clientPathsSchema = z5.object({
|
|
|
226
301
|
claudeCodeDesktop: z5.string().optional(),
|
|
227
302
|
cursor: z5.string().optional(),
|
|
228
303
|
codexCLI: z5.string().optional()
|
|
229
|
-
}).
|
|
304
|
+
}).strict();
|
|
230
305
|
var mcpPayloadLimitsSchema = z5.object({
|
|
231
306
|
warnBytes: z5.number().int().positive().optional(),
|
|
232
307
|
hardBytes: z5.number().int().positive().optional()
|
|
233
308
|
}).optional();
|
|
309
|
+
var knowledgeLanguageSchema = z5.enum(["match-existing", "zh-CN", "en"]);
|
|
310
|
+
var defaultLayerFilterSchema = z5.enum(["team", "personal", "both"]);
|
|
234
311
|
var fabricConfigSchema = z5.object({
|
|
235
312
|
clientPaths: clientPathsSchema.optional(),
|
|
236
313
|
externalFixturePath: z5.string().optional(),
|
|
237
314
|
scanIgnores: z5.array(z5.string()).optional(),
|
|
238
315
|
auditMode: auditModeSchema.optional(),
|
|
239
316
|
audit_mode: auditModeSchema.optional(),
|
|
240
|
-
mcpPayloadLimits: mcpPayloadLimitsSchema
|
|
317
|
+
mcpPayloadLimits: mcpPayloadLimitsSchema,
|
|
318
|
+
// Backward-compat: both fields are optional with defaults so existing
|
|
319
|
+
// fabric-config.json files (pre-grill-followup) parse unchanged. The default
|
|
320
|
+
// values themselves are load-bearing — see docs/data-schema.md.
|
|
321
|
+
knowledge_language: knowledgeLanguageSchema.optional().default("match-existing"),
|
|
322
|
+
default_layer_filter: defaultLayerFilterSchema.optional().default("both"),
|
|
323
|
+
// Cooldown for the fabric-hint Stop hook (formerly archive-hint, renamed in
|
|
324
|
+
// rc.5 TASK-010). After ANY of the three signals (archive / review / import)
|
|
325
|
+
// fires, that signal stays silent for this many hours regardless of state
|
|
326
|
+
// drift — purely a reminder throttle. Default 12 means "at most twice per
|
|
327
|
+
// day if the user keeps ignoring it." Set to 24 to align with the archive
|
|
328
|
+
// trigger threshold. The legacy `archive_hint_` key is retained for backward
|
|
329
|
+
// compat with existing user fabric-config.json files.
|
|
330
|
+
archive_hint_cooldown_hours: z5.number().int().positive().optional().default(12),
|
|
331
|
+
// Underseed-node threshold for the fabric-hint Stop hook's import signal
|
|
332
|
+
// (rc.5 TASK-010). When the canonical knowledge node count is strictly less
|
|
333
|
+
// than this value AND a successful `init_scan_completed` event happened at
|
|
334
|
+
// least 24h ago AND no `knowledge_proposed` event has fired in the last 24h,
|
|
335
|
+
// the hook recommends running the fabric-import skill. Default 10 reflects
|
|
336
|
+
// the rule-of-thumb that a workspace with fewer than ten knowledge entries
|
|
337
|
+
// is below the floor for plan_context retrieval to be meaningful. Also
|
|
338
|
+
// consumed by `doctor` lint #22 (knowledge_underseeded).
|
|
339
|
+
underseed_node_threshold: z5.number().int().positive().optional().default(10),
|
|
340
|
+
// Edit-count threshold for the fabric-hint Stop hook's Signal A
|
|
341
|
+
// (rc.6 TASK-022 / E5). Signal A fires when EITHER (a) >=24h have elapsed
|
|
342
|
+
// since the last `knowledge_proposed` event, OR (b) >=archive_edit_threshold
|
|
343
|
+
// PreToolUse fires have been recorded in `.fabric/.cache/edit-counter` since
|
|
344
|
+
// the last `knowledge_proposed` event. The edit-counter sidecar is populated
|
|
345
|
+
// by the rc.6 PreToolUse hook (TASK-020 / E4) — one ISO-8601 line per fire.
|
|
346
|
+
// Default 20 reflects the rule-of-thumb "after ~20 Edit/Write operations
|
|
347
|
+
// there is probably something worth archiving"; lowered values nag more
|
|
348
|
+
// aggressively, higher values rely on the 24h fallback. Missing or absent
|
|
349
|
+
// edit-counter file degrades safely to the 24h-only path.
|
|
350
|
+
archive_edit_threshold: z5.number().int().positive().optional().default(20),
|
|
351
|
+
// rc.7 T7: hours-since-last-knowledge_proposed cutoff for Signal A's
|
|
352
|
+
// time branch. Was hardcoded as 24 in fabric-hint.cjs's THRESHOLD_HOURS;
|
|
353
|
+
// externalized so chatty workspaces can lower the bar and quiet ones can
|
|
354
|
+
// raise it. Default 24 preserves rc.6 behavior. See docs/configuration.md.
|
|
355
|
+
archive_hint_hours: z5.number().int().positive().optional().default(24),
|
|
356
|
+
// rc.7 T7: pending-count cutoff for Signal B (review skill). Was
|
|
357
|
+
// hardcoded as 10 in fabric-hint.cjs's THRESHOLD_PENDING_COUNT.
|
|
358
|
+
// Default 10 preserves rc.6 behavior. See docs/configuration.md for
|
|
359
|
+
// small/medium/large repo recommendations.
|
|
360
|
+
review_hint_pending_count: z5.number().int().positive().optional().default(10),
|
|
361
|
+
// rc.7 T7: pending-age cutoff (in days) for Signal B (review skill).
|
|
362
|
+
// Was hardcoded as 7 in fabric-hint.cjs's THRESHOLD_PENDING_AGE_DAYS.
|
|
363
|
+
// Default 7 preserves rc.6 behavior. See docs/configuration.md.
|
|
364
|
+
review_hint_pending_age_days: z5.number().int().positive().optional().default(7),
|
|
365
|
+
// rc.7 T7 + T10 pre-wiring: days-since-last-doctor cutoff for the future
|
|
366
|
+
// Signal D (maintenance hint). T10 will consume this to decide when the
|
|
367
|
+
// fabric-hint Stop hook surfaces a "run `fabric doctor`" reminder.
|
|
368
|
+
// Default 14 reflects a fortnightly cadence — long enough to avoid nag,
|
|
369
|
+
// short enough to catch index drift before it compounds.
|
|
370
|
+
maintenance_hint_days: z5.number().int().positive().optional().default(14),
|
|
371
|
+
// rc.7 T7 + T10 pre-wiring: cooldown between Signal D reminders, in
|
|
372
|
+
// days. Once Signal D fires, it stays silent for this many days even if
|
|
373
|
+
// the user doesn't run doctor. Default 7 keeps the reminder weekly at
|
|
374
|
+
// worst — pairing 14d trigger + 7d cooldown means at most ~2 reminders
|
|
375
|
+
// per month for a workspace that ignores them.
|
|
376
|
+
maintenance_hint_cooldown_days: z5.number().int().positive().optional().default(7)
|
|
241
377
|
});
|
|
242
378
|
|
|
243
379
|
// src/schemas/forensic-report.ts
|
|
@@ -408,9 +544,9 @@ var eventLedgerEnvelopeSchema = {
|
|
|
408
544
|
session_id: z9.string().optional()
|
|
409
545
|
};
|
|
410
546
|
var stringRecordSchema = z9.record(z9.string());
|
|
411
|
-
var
|
|
547
|
+
var knowledgeContextPlannedEventSchema = z9.object({
|
|
412
548
|
...eventLedgerEnvelopeSchema,
|
|
413
|
-
event_type: z9.literal("
|
|
549
|
+
event_type: z9.literal("knowledge_context_planned"),
|
|
414
550
|
target_paths: z9.array(z9.string()),
|
|
415
551
|
required_stable_ids: z9.array(z9.string()),
|
|
416
552
|
ai_selectable_stable_ids: z9.array(z9.string()),
|
|
@@ -421,9 +557,9 @@ var ruleContextPlannedEventSchema = z9.object({
|
|
|
421
557
|
known_tech: z9.array(z9.string()).optional(),
|
|
422
558
|
diagnostics: z9.array(z9.unknown()).optional()
|
|
423
559
|
});
|
|
424
|
-
var
|
|
560
|
+
var knowledgeSelectionEventSchema = z9.object({
|
|
425
561
|
...eventLedgerEnvelopeSchema,
|
|
426
|
-
event_type: z9.literal("
|
|
562
|
+
event_type: z9.literal("knowledge_selection"),
|
|
427
563
|
selection_token: z9.string(),
|
|
428
564
|
target_paths: z9.array(z9.string()),
|
|
429
565
|
required_stable_ids: z9.array(z9.string()),
|
|
@@ -434,9 +570,9 @@ var ruleSelectionEventSchema = z9.object({
|
|
|
434
570
|
rejected_stable_ids: z9.array(z9.string()),
|
|
435
571
|
ignored_stable_ids: z9.array(z9.string())
|
|
436
572
|
});
|
|
437
|
-
var
|
|
573
|
+
var knowledgeSectionsFetchedEventSchema = z9.object({
|
|
438
574
|
...eventLedgerEnvelopeSchema,
|
|
439
|
-
event_type: z9.literal("
|
|
575
|
+
event_type: z9.literal("knowledge_sections_fetched"),
|
|
440
576
|
selection_token: z9.string(),
|
|
441
577
|
target_paths: z9.array(z9.string()).optional(),
|
|
442
578
|
requested_sections: z9.array(z9.string()),
|
|
@@ -460,9 +596,9 @@ var editIntentCheckedEventSchema = z9.object({
|
|
|
460
596
|
matched_rule_context_ts: z9.number().int().nonnegative().nullable(),
|
|
461
597
|
window_ms: z9.number().int().nonnegative()
|
|
462
598
|
});
|
|
463
|
-
var
|
|
599
|
+
var knowledgeDriftDetectedEventSchema = z9.object({
|
|
464
600
|
...eventLedgerEnvelopeSchema,
|
|
465
|
-
event_type: z9.literal("
|
|
601
|
+
event_type: z9.literal("knowledge_drift_detected"),
|
|
466
602
|
revision: z9.string().optional(),
|
|
467
603
|
drifted_stable_ids: z9.array(z9.string()),
|
|
468
604
|
missing_files: z9.array(z9.string()),
|
|
@@ -476,23 +612,6 @@ var ruleDriftDetectedEventSchema = z9.object({
|
|
|
476
612
|
})
|
|
477
613
|
).optional()
|
|
478
614
|
});
|
|
479
|
-
var ruleBaselineAcceptedEventSchema = z9.object({
|
|
480
|
-
...eventLedgerEnvelopeSchema,
|
|
481
|
-
event_type: z9.literal("rule_baseline_accepted"),
|
|
482
|
-
revision: z9.string(),
|
|
483
|
-
previous_revision: z9.string().optional(),
|
|
484
|
-
accepted_stable_ids: z9.array(z9.string()),
|
|
485
|
-
source: z9.enum(["doctor_fix", "sync_meta"]).optional()
|
|
486
|
-
});
|
|
487
|
-
var baselineSyncedEventSchema = z9.object({
|
|
488
|
-
...eventLedgerEnvelopeSchema,
|
|
489
|
-
event_type: z9.literal("baseline_synced"),
|
|
490
|
-
revision: z9.string(),
|
|
491
|
-
previous_revision: z9.string().optional(),
|
|
492
|
-
synced_files: z9.array(z9.string()),
|
|
493
|
-
accepted_stable_ids: z9.array(z9.string()),
|
|
494
|
-
source: z9.enum(["doctor_fix", "sync_meta"])
|
|
495
|
-
});
|
|
496
615
|
var mcpEventLedgerEventSchema = z9.object({
|
|
497
616
|
...eventLedgerEnvelopeSchema,
|
|
498
617
|
event_type: z9.literal("mcp_event"),
|
|
@@ -525,7 +644,7 @@ var metaReconciledOnStartupEventSchema = z9.object({
|
|
|
525
644
|
event_type: z9.literal("meta_reconciled_on_startup"),
|
|
526
645
|
reconciled_files: z9.array(z9.string()),
|
|
527
646
|
duration_ms: z9.number().int().nonnegative(),
|
|
528
|
-
source: z9.literal("
|
|
647
|
+
source: z9.literal("reconcileKnowledge")
|
|
529
648
|
});
|
|
530
649
|
var metaReconciledEventSchema = z9.object({
|
|
531
650
|
...eventLedgerEnvelopeSchema,
|
|
@@ -533,7 +652,7 @@ var metaReconciledEventSchema = z9.object({
|
|
|
533
652
|
reconciled_files: z9.array(z9.string()),
|
|
534
653
|
duration_ms: z9.number().int().nonnegative(),
|
|
535
654
|
trigger: z9.enum(["doctor", "manual"]),
|
|
536
|
-
source: z9.literal("
|
|
655
|
+
source: z9.literal("reconcileKnowledge")
|
|
537
656
|
});
|
|
538
657
|
var claudeSkillPathMigratedEventSchema = z9.object({
|
|
539
658
|
...eventLedgerEnvelopeSchema,
|
|
@@ -553,19 +672,138 @@ var codexSkillPathMigratedEventSchema = z9.object({
|
|
|
553
672
|
from: z9.string(),
|
|
554
673
|
to: z9.string()
|
|
555
674
|
});
|
|
556
|
-
var
|
|
675
|
+
var initScanCompletedEventSchema = z9.object({
|
|
676
|
+
...eventLedgerEnvelopeSchema,
|
|
677
|
+
event_type: z9.literal("init_scan_completed"),
|
|
678
|
+
written_stable_ids: z9.array(z9.string()),
|
|
679
|
+
duration_ms: z9.number().int().nonnegative(),
|
|
680
|
+
source: z9.enum(["init", "scan", "doctor_fix"]).optional()
|
|
681
|
+
});
|
|
682
|
+
var knowledgeProposedEventSchema = z9.object({
|
|
683
|
+
...eventLedgerEnvelopeSchema,
|
|
684
|
+
event_type: z9.literal("knowledge_proposed"),
|
|
685
|
+
stable_id: z9.string().optional(),
|
|
686
|
+
timestamp: z9.string().datetime(),
|
|
687
|
+
reason: z9.string().optional()
|
|
688
|
+
});
|
|
689
|
+
var knowledgePromoteStartedEventSchema = z9.object({
|
|
690
|
+
...eventLedgerEnvelopeSchema,
|
|
691
|
+
event_type: z9.literal("knowledge_promote_started"),
|
|
692
|
+
stable_id: z9.string().optional(),
|
|
693
|
+
timestamp: z9.string().datetime(),
|
|
694
|
+
reason: z9.string().optional()
|
|
695
|
+
});
|
|
696
|
+
var knowledgePromotedEventSchema = z9.object({
|
|
697
|
+
...eventLedgerEnvelopeSchema,
|
|
698
|
+
event_type: z9.literal("knowledge_promoted"),
|
|
699
|
+
stable_id: z9.string().optional(),
|
|
700
|
+
timestamp: z9.string().datetime(),
|
|
701
|
+
reason: z9.string().optional()
|
|
702
|
+
});
|
|
703
|
+
var knowledgePromoteFailedEventSchema = z9.object({
|
|
704
|
+
...eventLedgerEnvelopeSchema,
|
|
705
|
+
event_type: z9.literal("knowledge_promote_failed"),
|
|
706
|
+
stable_id: z9.string().optional(),
|
|
707
|
+
timestamp: z9.string().datetime(),
|
|
708
|
+
reason: z9.string()
|
|
709
|
+
});
|
|
710
|
+
var knowledgeLayerChangedEventSchema = z9.object({
|
|
711
|
+
...eventLedgerEnvelopeSchema,
|
|
712
|
+
event_type: z9.literal("knowledge_layer_changed"),
|
|
713
|
+
stable_id: z9.string().optional(),
|
|
714
|
+
timestamp: z9.string().datetime(),
|
|
715
|
+
reason: z9.string().optional(),
|
|
716
|
+
from_layer: z9.enum(["team", "personal"]),
|
|
717
|
+
to_layer: z9.enum(["team", "personal"])
|
|
718
|
+
});
|
|
719
|
+
var knowledgeSlugRenamedEventSchema = z9.object({
|
|
720
|
+
...eventLedgerEnvelopeSchema,
|
|
721
|
+
event_type: z9.literal("knowledge_slug_renamed"),
|
|
722
|
+
stable_id: z9.string().optional(),
|
|
723
|
+
timestamp: z9.string().datetime(),
|
|
724
|
+
reason: z9.string().optional(),
|
|
725
|
+
from_slug: z9.string(),
|
|
726
|
+
to_slug: z9.string()
|
|
727
|
+
});
|
|
728
|
+
var knowledgeDemotedEventSchema = z9.object({
|
|
729
|
+
...eventLedgerEnvelopeSchema,
|
|
730
|
+
event_type: z9.literal("knowledge_demoted"),
|
|
731
|
+
stable_id: z9.string().optional(),
|
|
732
|
+
timestamp: z9.string().datetime(),
|
|
733
|
+
reason: z9.string().optional()
|
|
734
|
+
});
|
|
735
|
+
var knowledgeArchivedEventSchema = z9.object({
|
|
736
|
+
...eventLedgerEnvelopeSchema,
|
|
737
|
+
event_type: z9.literal("knowledge_archived"),
|
|
738
|
+
stable_id: z9.string().optional(),
|
|
739
|
+
timestamp: z9.string().datetime(),
|
|
740
|
+
reason: z9.string().optional()
|
|
741
|
+
});
|
|
742
|
+
var knowledgeArchiveAttemptedEventSchema = z9.object({
|
|
743
|
+
...eventLedgerEnvelopeSchema,
|
|
744
|
+
event_type: z9.literal("knowledge_archive_attempted"),
|
|
745
|
+
stable_id: z9.string().optional(),
|
|
746
|
+
timestamp: z9.string().datetime(),
|
|
747
|
+
reason: z9.string().optional()
|
|
748
|
+
});
|
|
749
|
+
var knowledgeDeferredEventSchema = z9.object({
|
|
750
|
+
...eventLedgerEnvelopeSchema,
|
|
751
|
+
event_type: z9.literal("knowledge_deferred"),
|
|
752
|
+
stable_id: z9.string().optional(),
|
|
753
|
+
timestamp: z9.string().datetime(),
|
|
754
|
+
reason: z9.string().optional(),
|
|
755
|
+
until: z9.string().datetime().optional()
|
|
756
|
+
});
|
|
757
|
+
var knowledgeRejectedEventSchema = z9.object({
|
|
758
|
+
...eventLedgerEnvelopeSchema,
|
|
759
|
+
event_type: z9.literal("knowledge_rejected"),
|
|
760
|
+
stable_id: z9.string().optional(),
|
|
761
|
+
timestamp: z9.string().datetime(),
|
|
762
|
+
reason: z9.string()
|
|
763
|
+
});
|
|
764
|
+
var knowledgeConsumedEventSchema = z9.object({
|
|
765
|
+
...eventLedgerEnvelopeSchema,
|
|
766
|
+
event_type: z9.literal("knowledge_consumed"),
|
|
767
|
+
stable_id: z9.string(),
|
|
768
|
+
consumed_at: z9.string().datetime(),
|
|
769
|
+
client_hash: z9.string()
|
|
770
|
+
});
|
|
771
|
+
var knowledgeScopeDegradedEventSchema = z9.object({
|
|
772
|
+
...eventLedgerEnvelopeSchema,
|
|
773
|
+
event_type: z9.literal("knowledge_scope_degraded"),
|
|
774
|
+
stable_id: z9.string(),
|
|
775
|
+
timestamp: z9.string().datetime(),
|
|
776
|
+
from_scope: z9.enum(["narrow", "broad"]),
|
|
777
|
+
to_scope: z9.enum(["narrow", "broad"]),
|
|
778
|
+
reason: z9.string()
|
|
779
|
+
});
|
|
780
|
+
var doctorRunEventSchema = z9.object({
|
|
781
|
+
...eventLedgerEnvelopeSchema,
|
|
782
|
+
event_type: z9.literal("doctor_run"),
|
|
783
|
+
mode: z9.enum(["lint", "apply-lint"]),
|
|
784
|
+
issues: z9.number().int().nonnegative(),
|
|
785
|
+
mutations: z9.number().int().nonnegative().optional(),
|
|
786
|
+
timestamp: z9.string().datetime()
|
|
787
|
+
});
|
|
788
|
+
var knowledgePathDangledEventSchema = z9.object({
|
|
789
|
+
...eventLedgerEnvelopeSchema,
|
|
790
|
+
event_type: z9.literal("knowledge_path_dangled"),
|
|
791
|
+
stable_id: z9.string(),
|
|
792
|
+
removed_glob: z9.string()
|
|
793
|
+
});
|
|
794
|
+
var pendingAutoArchivedEventSchema = z9.object({
|
|
557
795
|
...eventLedgerEnvelopeSchema,
|
|
558
|
-
event_type: z9.literal("
|
|
559
|
-
|
|
796
|
+
event_type: z9.literal("pending_auto_archived"),
|
|
797
|
+
pending_path: z9.string(),
|
|
798
|
+
archived_to: z9.string(),
|
|
799
|
+
reason: z9.string()
|
|
560
800
|
});
|
|
561
801
|
var eventLedgerEventSchema = z9.discriminatedUnion("event_type", [
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
802
|
+
knowledgeContextPlannedEventSchema,
|
|
803
|
+
knowledgeSelectionEventSchema,
|
|
804
|
+
knowledgeSectionsFetchedEventSchema,
|
|
565
805
|
editIntentCheckedEventSchema,
|
|
566
|
-
|
|
567
|
-
ruleBaselineAcceptedEventSchema,
|
|
568
|
-
baselineSyncedEventSchema,
|
|
806
|
+
knowledgeDriftDetectedEventSchema,
|
|
569
807
|
mcpEventLedgerEventSchema,
|
|
570
808
|
reapplyCompletedEventSchema,
|
|
571
809
|
eventLedgerTruncatedEventSchema,
|
|
@@ -575,40 +813,85 @@ var eventLedgerEventSchema = z9.discriminatedUnion("event_type", [
|
|
|
575
813
|
claudeSkillPathMigratedEventSchema,
|
|
576
814
|
claudeHookPathMigratedEventSchema,
|
|
577
815
|
codexSkillPathMigratedEventSchema,
|
|
578
|
-
|
|
816
|
+
initScanCompletedEventSchema,
|
|
817
|
+
// v2.0 rc.2 grill-followup TASK-004: knowledge.* lifecycle pre-registration
|
|
818
|
+
knowledgeProposedEventSchema,
|
|
819
|
+
knowledgePromoteStartedEventSchema,
|
|
820
|
+
knowledgePromotedEventSchema,
|
|
821
|
+
knowledgePromoteFailedEventSchema,
|
|
822
|
+
knowledgeLayerChangedEventSchema,
|
|
823
|
+
knowledgeSlugRenamedEventSchema,
|
|
824
|
+
knowledgeDemotedEventSchema,
|
|
825
|
+
knowledgeArchivedEventSchema,
|
|
826
|
+
knowledgeArchiveAttemptedEventSchema,
|
|
827
|
+
knowledgeDeferredEventSchema,
|
|
828
|
+
knowledgeRejectedEventSchema,
|
|
829
|
+
// v2.0 rc.5 TASK-014: knowledge_consumed (consumption tracking)
|
|
830
|
+
knowledgeConsumedEventSchema,
|
|
831
|
+
// v2.0 rc.5 TASK-012 (C3): knowledge_scope_degraded — narrow→broad auto-degrade
|
|
832
|
+
knowledgeScopeDegradedEventSchema,
|
|
833
|
+
// v2.0 rc.5 TASK-009 (B2): pending_auto_archived — doctor --apply-lint moves
|
|
834
|
+
// pending entries >30d old into the .archive/pending/ subtree.
|
|
835
|
+
pendingAutoArchivedEventSchema,
|
|
836
|
+
// v2.0 rc.5 TASK-013 (C4): knowledge_path_dangled — emitted by doctor lint
|
|
837
|
+
// #24 when a glob in relevance_paths resolves to zero filesystem matches.
|
|
838
|
+
knowledgePathDangledEventSchema,
|
|
839
|
+
// v2.0.0-rc.7 T10: doctor_run — emitted by `fabric doctor` to drive Signal D.
|
|
840
|
+
doctorRunEventSchema
|
|
579
841
|
]);
|
|
580
842
|
export {
|
|
581
843
|
AGENTS_META_IDENTITY_SOURCES,
|
|
582
844
|
AGENTS_META_LAYERS,
|
|
583
845
|
AGENTS_META_TOPOLOGY_TYPES,
|
|
846
|
+
AgentsMetaCountersSchema,
|
|
847
|
+
FabExtractKnowledgeInputSchema,
|
|
848
|
+
FabExtractKnowledgeInputShape,
|
|
849
|
+
FabExtractKnowledgeOutputSchema,
|
|
850
|
+
FabReviewInputSchema,
|
|
851
|
+
FabReviewInputShape,
|
|
852
|
+
FabReviewOutputSchema,
|
|
853
|
+
FabReviewOutputShape,
|
|
854
|
+
KNOWLEDGE_TEST_INDEX_SCHEMA_VERSION,
|
|
855
|
+
KNOWLEDGE_TYPE_CODES,
|
|
856
|
+
KnowledgeEntryFrontmatterSchema,
|
|
857
|
+
KnowledgeTypeSchema,
|
|
858
|
+
LayerSchema,
|
|
859
|
+
MaturitySchema,
|
|
860
|
+
PROPOSED_REASON_DESCRIPTIONS,
|
|
584
861
|
PROTECTED_TOKENS,
|
|
585
|
-
|
|
862
|
+
ProposedReasonSchema,
|
|
863
|
+
StableIdSchema,
|
|
586
864
|
agentsIdentitySourceSchema,
|
|
587
865
|
agentsLayerSchema,
|
|
588
866
|
agentsMetaNodeSchema,
|
|
589
867
|
agentsMetaSchema,
|
|
590
868
|
agentsTopologyTypeSchema,
|
|
591
869
|
aiLedgerEntrySchema,
|
|
870
|
+
allocateKnowledgeId,
|
|
592
871
|
annotateIntentRequestSchema,
|
|
593
872
|
auditModeSchema,
|
|
594
|
-
baselineSyncedEventSchema,
|
|
595
873
|
candidateFileEntrySchema,
|
|
596
874
|
claudeHookPathMigratedEventSchema,
|
|
597
875
|
claudeSkillPathMigratedEventSchema,
|
|
598
876
|
clientPathsSchema,
|
|
599
877
|
codexSkillPathMigratedEventSchema,
|
|
600
878
|
createTranslator,
|
|
879
|
+
defaultAgentsMetaCounters,
|
|
880
|
+
defaultLayerFilterSchema,
|
|
601
881
|
defaultMessages,
|
|
602
882
|
deriveAgentsMetaIdentitySource,
|
|
603
883
|
deriveAgentsMetaLayer,
|
|
604
884
|
deriveAgentsMetaStableId,
|
|
605
885
|
deriveAgentsMetaTopologyType,
|
|
606
886
|
detectNodeLocale,
|
|
887
|
+
doctorRunEventSchema,
|
|
607
888
|
driftDetectedEventSchema,
|
|
608
889
|
editIntentCheckedEventSchema,
|
|
609
890
|
enMessages,
|
|
610
891
|
eventLedgerEventSchema,
|
|
611
892
|
eventLedgerTruncatedEventSchema,
|
|
893
|
+
fabExtractKnowledgeAnnotations,
|
|
894
|
+
fabReviewAnnotations,
|
|
612
895
|
fabricConfigSchema,
|
|
613
896
|
fabricEventSchema,
|
|
614
897
|
forensicAssertionCoverageSchema,
|
|
@@ -621,9 +904,10 @@ export {
|
|
|
621
904
|
forensicReportSchema,
|
|
622
905
|
forensicSamplingBudgetSchema,
|
|
623
906
|
forensicTopologySchema,
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
907
|
+
formatKnowledgeId,
|
|
908
|
+
getKnowledgeAnnotations,
|
|
909
|
+
getKnowledgeInputSchema,
|
|
910
|
+
getKnowledgeOutputSchema,
|
|
627
911
|
historyStateQuerySchema,
|
|
628
912
|
humanLedgerEntrySchema,
|
|
629
913
|
humanLockApproveRequestSchema,
|
|
@@ -637,11 +921,37 @@ export {
|
|
|
637
921
|
initContextInvariantSchema,
|
|
638
922
|
initContextSchema,
|
|
639
923
|
initContextSourceEvidenceSchema,
|
|
924
|
+
initScanCompletedEventSchema,
|
|
925
|
+
isKnowledgeStableId,
|
|
926
|
+
knowledgeArchiveAttemptedEventSchema,
|
|
927
|
+
knowledgeArchivedEventSchema,
|
|
928
|
+
knowledgeConsumedEventSchema,
|
|
929
|
+
knowledgeContextPlannedEventSchema,
|
|
930
|
+
knowledgeDeferredEventSchema,
|
|
931
|
+
knowledgeDemotedEventSchema,
|
|
932
|
+
knowledgeDriftDetectedEventSchema,
|
|
933
|
+
knowledgeLanguageSchema,
|
|
934
|
+
knowledgeLayerChangedEventSchema,
|
|
935
|
+
knowledgePathDangledEventSchema,
|
|
936
|
+
knowledgePromoteFailedEventSchema,
|
|
937
|
+
knowledgePromoteStartedEventSchema,
|
|
938
|
+
knowledgePromotedEventSchema,
|
|
939
|
+
knowledgeProposedEventSchema,
|
|
940
|
+
knowledgeRejectedEventSchema,
|
|
941
|
+
knowledgeScopeDegradedEventSchema,
|
|
942
|
+
knowledgeSectionsAnnotations,
|
|
943
|
+
knowledgeSectionsFetchedEventSchema,
|
|
944
|
+
knowledgeSectionsInputSchema,
|
|
945
|
+
knowledgeSectionsOutputSchema,
|
|
946
|
+
knowledgeSelectionEventSchema,
|
|
947
|
+
knowledgeSlugRenamedEventSchema,
|
|
948
|
+
knowledgeTestIndexSchema,
|
|
949
|
+
knowledgeTestLinkSchema,
|
|
950
|
+
knowledgeTestOrphanAnnotationSchema,
|
|
640
951
|
ledgerAppendedEventSchema,
|
|
641
952
|
ledgerEntrySchema,
|
|
642
953
|
ledgerQuerySchema,
|
|
643
954
|
ledgerSourceSchema,
|
|
644
|
-
legacyClientPathPresentEventSchema,
|
|
645
955
|
lockApprovedEventSchema,
|
|
646
956
|
lockDriftEventSchema,
|
|
647
957
|
mcpConfigMigratedEventSchema,
|
|
@@ -651,23 +961,16 @@ export {
|
|
|
651
961
|
metaReconciledOnStartupEventSchema,
|
|
652
962
|
metaUpdatedEventSchema,
|
|
653
963
|
normalizeLocale,
|
|
964
|
+
parseKnowledgeId,
|
|
965
|
+
pendingAutoArchivedEventSchema,
|
|
654
966
|
planContextAnnotations,
|
|
967
|
+
planContextHintNarrowEntrySchema,
|
|
968
|
+
planContextHintOutputSchema,
|
|
655
969
|
planContextInputSchema,
|
|
656
970
|
planContextOutputSchema,
|
|
657
971
|
reapplyCompletedEventSchema,
|
|
658
|
-
ruleBaselineAcceptedEventSchema,
|
|
659
|
-
ruleContextPlannedEventSchema,
|
|
660
972
|
ruleDescriptionIndexItemSchema,
|
|
661
973
|
ruleDescriptionSchema,
|
|
662
|
-
ruleDriftDetectedEventSchema,
|
|
663
|
-
ruleSectionsAnnotations,
|
|
664
|
-
ruleSectionsFetchedEventSchema,
|
|
665
|
-
ruleSectionsInputSchema,
|
|
666
|
-
ruleSectionsOutputSchema,
|
|
667
|
-
ruleSelectionEventSchema,
|
|
668
|
-
ruleTestIndexSchema,
|
|
669
|
-
ruleTestLinkSchema,
|
|
670
|
-
ruleTestOrphanAnnotationSchema,
|
|
671
974
|
structuredWarningSchema,
|
|
672
975
|
withDerivedAgentsMetaNodeDefaults,
|
|
673
976
|
zhCNMessages
|