@fenglimg/fabric-shared 2.0.0-rc.13 → 2.0.0-rc.21
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-QZNUUIL3.js +39 -0
- package/dist/{chunk-WIH5HBKU.js → chunk-VKCXD6CI.js} +218 -114
- package/dist/i18n/index.js +1 -1
- package/dist/index.d.ts +305 -36
- package/dist/index.js +538 -339
- package/dist/templates/bootstrap-canonical.d.ts +56 -0
- package/dist/templates/bootstrap-canonical.js +18 -0
- package/dist/types/index.d.ts +0 -2
- package/package.json +7 -3
package/dist/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import "./chunk-LXNCAKJZ.js";
|
|
1
2
|
import {
|
|
2
3
|
PROTECTED_TOKENS,
|
|
3
4
|
createTranslator,
|
|
@@ -6,7 +7,7 @@ import {
|
|
|
6
7
|
enMessages,
|
|
7
8
|
normalizeLocale,
|
|
8
9
|
zhCNMessages
|
|
9
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-VKCXD6CI.js";
|
|
10
11
|
import {
|
|
11
12
|
FabExtractKnowledgeInputSchema,
|
|
12
13
|
FabExtractKnowledgeInputShape,
|
|
@@ -46,7 +47,15 @@ import {
|
|
|
46
47
|
planContextOutputSchema,
|
|
47
48
|
structuredWarningSchema
|
|
48
49
|
} from "./chunk-NNDFOOBO.js";
|
|
49
|
-
import
|
|
50
|
+
import {
|
|
51
|
+
BOOTSTRAP_CANONICAL,
|
|
52
|
+
BOOTSTRAP_MARKER_BEGIN,
|
|
53
|
+
BOOTSTRAP_MARKER_END,
|
|
54
|
+
BOOTSTRAP_REGEX,
|
|
55
|
+
LEGACY_KB_MARKER_BEGIN,
|
|
56
|
+
LEGACY_KB_MARKER_END,
|
|
57
|
+
LEGACY_KB_REGEX
|
|
58
|
+
} from "./chunk-QZNUUIL3.js";
|
|
50
59
|
|
|
51
60
|
// src/schemas/agents-meta.ts
|
|
52
61
|
import { z } from "zod";
|
|
@@ -166,7 +175,7 @@ function defaultAgentsMetaCounters() {
|
|
|
166
175
|
}
|
|
167
176
|
function deriveAgentsMetaStableId(file) {
|
|
168
177
|
const normalized = normalizePath(file);
|
|
169
|
-
if (normalized === "AGENTS.md"
|
|
178
|
+
if (normalized === "AGENTS.md") {
|
|
170
179
|
return "bootstrap";
|
|
171
180
|
}
|
|
172
181
|
return getDepthSource(normalized).replace(/\.md$/u, "");
|
|
@@ -183,7 +192,7 @@ function deriveAgentsMetaIdentitySource(node) {
|
|
|
183
192
|
}
|
|
184
193
|
function deriveAgentsMetaLayer(file) {
|
|
185
194
|
const normalized = normalizePath(file);
|
|
186
|
-
if (normalized === "AGENTS.md"
|
|
195
|
+
if (normalized === "AGENTS.md") {
|
|
187
196
|
return "L0";
|
|
188
197
|
}
|
|
189
198
|
if (hasCrossCuttingSegment(normalized)) {
|
|
@@ -315,9 +324,14 @@ var fabricLanguageSchema = z5.enum([
|
|
|
315
324
|
var defaultLayerFilterSchema = z5.enum(["team", "personal", "both"]);
|
|
316
325
|
var fabricConfigSchema = z5.object({
|
|
317
326
|
clientPaths: clientPathsSchema.optional(),
|
|
318
|
-
|
|
327
|
+
// rc.17 (R-cut): the dev/test fixture-path config field was removed
|
|
328
|
+
// end-to-end. The `EXTERNAL_FIXTURE_PATH` env var is now the sole source
|
|
329
|
+
// consumed by `resolveDevMode()`. No z.preprocess alias — pre-rc.17
|
|
330
|
+
// fabric-config.json files carrying the field will be silently dropped by
|
|
331
|
+
// the lenient root parser (no .strict() at root). Pre-user clean-slate per
|
|
332
|
+
// memory/feedback_clean_slate.md; mirrors the rc.12 hard-rename precedent
|
|
333
|
+
// documented above.
|
|
319
334
|
scanIgnores: z5.array(z5.string()).optional(),
|
|
320
|
-
auditMode: auditModeSchema.optional(),
|
|
321
335
|
audit_mode: auditModeSchema.optional(),
|
|
322
336
|
mcpPayloadLimits: mcpPayloadLimitsSchema,
|
|
323
337
|
// Backward-compat: both fields are optional with defaults so existing
|
|
@@ -439,156 +453,294 @@ var fabricConfigSchema = z5.object({
|
|
|
439
453
|
review_stale_pending_days: z5.number().int().positive().optional().default(14)
|
|
440
454
|
});
|
|
441
455
|
|
|
442
|
-
// src/schemas/
|
|
456
|
+
// src/schemas/fabric-config-introspect.ts
|
|
443
457
|
import { z as z6 } from "zod";
|
|
444
|
-
var
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
458
|
+
var positiveIntSchema = z6.coerce.number().int().positive();
|
|
459
|
+
function makePositiveIntField(key, defaultValue) {
|
|
460
|
+
return {
|
|
461
|
+
key,
|
|
462
|
+
group: "B_hint_threshold",
|
|
463
|
+
widget: "text",
|
|
464
|
+
label_i18n_key: `cli.config.fields.${key}.label`,
|
|
465
|
+
description_i18n_key: `cli.config.fields.${key}.description`,
|
|
466
|
+
default: defaultValue,
|
|
467
|
+
validate(raw) {
|
|
468
|
+
const trimmed = raw.trim();
|
|
469
|
+
if (trimmed === "") {
|
|
470
|
+
return { ok: false, error: "Value is required (positive integer)." };
|
|
471
|
+
}
|
|
472
|
+
const parsed = positiveIntSchema.safeParse(trimmed);
|
|
473
|
+
if (!parsed.success) {
|
|
474
|
+
return {
|
|
475
|
+
ok: false,
|
|
476
|
+
error: "Must be a positive integer (e.g. 1, 12, 24)."
|
|
477
|
+
};
|
|
478
|
+
}
|
|
479
|
+
return { ok: true, value: parsed.data };
|
|
480
|
+
},
|
|
481
|
+
format_for_display(value) {
|
|
482
|
+
if (typeof value === "number") return String(value);
|
|
483
|
+
if (value === void 0 || value === null) return String(defaultValue);
|
|
484
|
+
return String(value);
|
|
485
|
+
}
|
|
486
|
+
};
|
|
487
|
+
}
|
|
488
|
+
function makeEnumField(key, group, enumValues, defaultValue) {
|
|
489
|
+
return {
|
|
490
|
+
key,
|
|
491
|
+
group,
|
|
492
|
+
widget: "select",
|
|
493
|
+
label_i18n_key: `cli.config.fields.${key}.label`,
|
|
494
|
+
description_i18n_key: `cli.config.fields.${key}.description`,
|
|
495
|
+
default: defaultValue,
|
|
496
|
+
enum_values: enumValues,
|
|
497
|
+
validate(raw) {
|
|
498
|
+
const trimmed = raw.trim();
|
|
499
|
+
if (!enumValues.includes(trimmed)) {
|
|
500
|
+
return {
|
|
501
|
+
ok: false,
|
|
502
|
+
error: `Must be one of: ${enumValues.join(", ")}.`
|
|
503
|
+
};
|
|
504
|
+
}
|
|
505
|
+
return { ok: true, value: trimmed };
|
|
506
|
+
},
|
|
507
|
+
format_for_display(value) {
|
|
508
|
+
if (typeof value === "string" && enumValues.includes(value)) return value;
|
|
509
|
+
if (value === void 0 || value === null) return defaultValue;
|
|
510
|
+
return String(value);
|
|
511
|
+
}
|
|
512
|
+
};
|
|
513
|
+
}
|
|
514
|
+
var SCHEMA_DEFAULTS = fabricConfigSchema.parse({});
|
|
515
|
+
function pickNumberDefault(key) {
|
|
516
|
+
const v = SCHEMA_DEFAULTS[key];
|
|
517
|
+
if (typeof v !== "number") {
|
|
518
|
+
throw new Error(
|
|
519
|
+
`fabric-config-introspect: expected numeric default for ${String(key)}, got ${typeof v}`
|
|
520
|
+
);
|
|
521
|
+
}
|
|
522
|
+
return v;
|
|
523
|
+
}
|
|
524
|
+
function pickStringDefault(key) {
|
|
525
|
+
const v = SCHEMA_DEFAULTS[key];
|
|
526
|
+
if (typeof v !== "string") {
|
|
527
|
+
throw new Error(
|
|
528
|
+
`fabric-config-introspect: expected string default for ${String(key)}, got ${typeof v}`
|
|
529
|
+
);
|
|
530
|
+
}
|
|
531
|
+
return v;
|
|
532
|
+
}
|
|
533
|
+
var AUDIT_MODE_PANEL_DEFAULT = "warn";
|
|
534
|
+
function getPanelFields() {
|
|
535
|
+
return PANEL_FIELDS;
|
|
536
|
+
}
|
|
537
|
+
function getPanelFieldByKey(key) {
|
|
538
|
+
return PANEL_FIELDS.find((f) => f.key === key);
|
|
539
|
+
}
|
|
540
|
+
var PANEL_FIELDS = [
|
|
541
|
+
// --- Group A: Locale (2) ---
|
|
542
|
+
makeEnumField(
|
|
543
|
+
"fabric_language",
|
|
544
|
+
"A_locale",
|
|
545
|
+
fabricLanguageSchema.options,
|
|
546
|
+
pickStringDefault("fabric_language")
|
|
547
|
+
),
|
|
548
|
+
makeEnumField(
|
|
549
|
+
"default_layer_filter",
|
|
550
|
+
"A_locale",
|
|
551
|
+
defaultLayerFilterSchema.options,
|
|
552
|
+
pickStringDefault("default_layer_filter")
|
|
553
|
+
),
|
|
554
|
+
// --- Group B: Hint thresholds (8 — see leading docstring for the
|
|
555
|
+
// 7-vs-8 reconciliation; archive_edit_threshold is the 8th key) ---
|
|
556
|
+
makePositiveIntField("archive_hint_hours", pickNumberDefault("archive_hint_hours")),
|
|
557
|
+
makePositiveIntField(
|
|
558
|
+
"archive_hint_cooldown_hours",
|
|
559
|
+
pickNumberDefault("archive_hint_cooldown_hours")
|
|
560
|
+
),
|
|
561
|
+
makePositiveIntField(
|
|
562
|
+
"archive_edit_threshold",
|
|
563
|
+
pickNumberDefault("archive_edit_threshold")
|
|
564
|
+
),
|
|
565
|
+
makePositiveIntField(
|
|
566
|
+
"underseed_node_threshold",
|
|
567
|
+
pickNumberDefault("underseed_node_threshold")
|
|
568
|
+
),
|
|
569
|
+
makePositiveIntField(
|
|
570
|
+
"review_hint_pending_count",
|
|
571
|
+
pickNumberDefault("review_hint_pending_count")
|
|
572
|
+
),
|
|
573
|
+
makePositiveIntField(
|
|
574
|
+
"review_hint_pending_age_days",
|
|
575
|
+
pickNumberDefault("review_hint_pending_age_days")
|
|
576
|
+
),
|
|
577
|
+
makePositiveIntField(
|
|
578
|
+
"maintenance_hint_days",
|
|
579
|
+
pickNumberDefault("maintenance_hint_days")
|
|
580
|
+
),
|
|
581
|
+
makePositiveIntField(
|
|
582
|
+
"maintenance_hint_cooldown_days",
|
|
583
|
+
pickNumberDefault("maintenance_hint_cooldown_days")
|
|
584
|
+
),
|
|
585
|
+
// --- Group C: Audit (1) ---
|
|
586
|
+
makeEnumField(
|
|
587
|
+
"audit_mode",
|
|
588
|
+
"C_audit",
|
|
589
|
+
auditModeSchema.options,
|
|
590
|
+
AUDIT_MODE_PANEL_DEFAULT
|
|
591
|
+
)
|
|
592
|
+
];
|
|
593
|
+
|
|
594
|
+
// src/schemas/forensic-report.ts
|
|
595
|
+
import { z as z7 } from "zod";
|
|
596
|
+
var forensicCodeSampleSchema = z7.object({
|
|
597
|
+
path: z7.string(),
|
|
598
|
+
lines: z7.string(),
|
|
599
|
+
snippet: z7.string(),
|
|
600
|
+
pattern_hint: z7.string()
|
|
601
|
+
});
|
|
602
|
+
var forensicEvidenceAnchorSchema = z7.object({
|
|
603
|
+
file: z7.string(),
|
|
604
|
+
line: z7.string(),
|
|
605
|
+
snippet: z7.string()
|
|
606
|
+
});
|
|
607
|
+
var forensicAssertionCoverageSchema = z7.object({
|
|
608
|
+
ratio: z7.number().min(0).max(1),
|
|
609
|
+
total: z7.number().int().nonnegative(),
|
|
610
|
+
matched: z7.number().int().nonnegative(),
|
|
611
|
+
co_occurring_patterns: z7.array(z7.string())
|
|
612
|
+
});
|
|
613
|
+
var forensicAssertionSchema = z7.object({
|
|
614
|
+
type: z7.enum(["framework", "pattern", "invariant", "domain"]),
|
|
615
|
+
statement: z7.string(),
|
|
616
|
+
confidence: z7.enum(["HIGH", "MEDIUM", "LOW"]),
|
|
617
|
+
evidence: z7.array(forensicEvidenceAnchorSchema),
|
|
466
618
|
coverage: forensicAssertionCoverageSchema,
|
|
467
|
-
proposed_rule:
|
|
468
|
-
alternatives:
|
|
469
|
-
});
|
|
470
|
-
var forensicTopologySchema =
|
|
471
|
-
total_files:
|
|
472
|
-
by_ext:
|
|
473
|
-
key_dirs:
|
|
474
|
-
max_depth:
|
|
475
|
-
});
|
|
476
|
-
var forensicEntryPointSchema =
|
|
477
|
-
path:
|
|
478
|
-
reason:
|
|
479
|
-
size_bytes:
|
|
480
|
-
});
|
|
481
|
-
var forensicFrameworkSchema =
|
|
482
|
-
kind:
|
|
483
|
-
version:
|
|
484
|
-
subkind:
|
|
485
|
-
evidence:
|
|
486
|
-
});
|
|
487
|
-
var forensicReadmeSchema =
|
|
488
|
-
quality:
|
|
489
|
-
line_count:
|
|
490
|
-
has_contributing:
|
|
491
|
-
});
|
|
492
|
-
var candidateFileEntrySchema =
|
|
493
|
-
path:
|
|
494
|
-
family:
|
|
495
|
-
rationale:
|
|
496
|
-
});
|
|
497
|
-
var forensicSamplingBudgetSchema =
|
|
498
|
-
max_files:
|
|
499
|
-
max_lines_per_file:
|
|
500
|
-
});
|
|
501
|
-
var forensicReportSchema =
|
|
502
|
-
version:
|
|
503
|
-
generated_at:
|
|
504
|
-
generated_by:
|
|
505
|
-
target:
|
|
506
|
-
project_name:
|
|
619
|
+
proposed_rule: z7.string().optional(),
|
|
620
|
+
alternatives: z7.array(z7.string()).optional()
|
|
621
|
+
});
|
|
622
|
+
var forensicTopologySchema = z7.object({
|
|
623
|
+
total_files: z7.number().int().nonnegative(),
|
|
624
|
+
by_ext: z7.record(z7.number().int().nonnegative()),
|
|
625
|
+
key_dirs: z7.array(z7.string()),
|
|
626
|
+
max_depth: z7.number().int().nonnegative()
|
|
627
|
+
});
|
|
628
|
+
var forensicEntryPointSchema = z7.object({
|
|
629
|
+
path: z7.string(),
|
|
630
|
+
reason: z7.string(),
|
|
631
|
+
size_bytes: z7.number().int().nonnegative().optional()
|
|
632
|
+
});
|
|
633
|
+
var forensicFrameworkSchema = z7.object({
|
|
634
|
+
kind: z7.string(),
|
|
635
|
+
version: z7.string(),
|
|
636
|
+
subkind: z7.string(),
|
|
637
|
+
evidence: z7.array(z7.string())
|
|
638
|
+
});
|
|
639
|
+
var forensicReadmeSchema = z7.object({
|
|
640
|
+
quality: z7.enum(["missing", "stub", "ok"]),
|
|
641
|
+
line_count: z7.number().int().nonnegative(),
|
|
642
|
+
has_contributing: z7.boolean()
|
|
643
|
+
});
|
|
644
|
+
var candidateFileEntrySchema = z7.object({
|
|
645
|
+
path: z7.string(),
|
|
646
|
+
family: z7.enum(["entry", "component", "config", "test", "domain"]),
|
|
647
|
+
rationale: z7.string()
|
|
648
|
+
});
|
|
649
|
+
var forensicSamplingBudgetSchema = z7.object({
|
|
650
|
+
max_files: z7.literal(15),
|
|
651
|
+
max_lines_per_file: z7.literal(100)
|
|
652
|
+
});
|
|
653
|
+
var forensicReportSchema = z7.object({
|
|
654
|
+
version: z7.string(),
|
|
655
|
+
generated_at: z7.string(),
|
|
656
|
+
generated_by: z7.string(),
|
|
657
|
+
target: z7.string(),
|
|
658
|
+
project_name: z7.string(),
|
|
507
659
|
framework: forensicFrameworkSchema,
|
|
508
660
|
topology: forensicTopologySchema,
|
|
509
|
-
entry_points:
|
|
510
|
-
code_samples:
|
|
511
|
-
assertions:
|
|
512
|
-
candidate_files:
|
|
661
|
+
entry_points: z7.array(forensicEntryPointSchema),
|
|
662
|
+
code_samples: z7.array(forensicCodeSampleSchema),
|
|
663
|
+
assertions: z7.array(forensicAssertionSchema),
|
|
664
|
+
candidate_files: z7.array(candidateFileEntrySchema),
|
|
513
665
|
sampling_budget: forensicSamplingBudgetSchema,
|
|
514
666
|
readme: forensicReadmeSchema,
|
|
515
|
-
recommendations_for_skill:
|
|
667
|
+
recommendations_for_skill: z7.array(z7.string()).optional()
|
|
516
668
|
});
|
|
517
669
|
|
|
518
670
|
// src/schemas/init-context.ts
|
|
519
|
-
import { z as
|
|
520
|
-
var initContextFrameworkSchema =
|
|
521
|
-
kind:
|
|
522
|
-
version:
|
|
523
|
-
subkind:
|
|
671
|
+
import { z as z8 } from "zod";
|
|
672
|
+
var initContextFrameworkSchema = z8.object({
|
|
673
|
+
kind: z8.string(),
|
|
674
|
+
version: z8.string(),
|
|
675
|
+
subkind: z8.string()
|
|
524
676
|
});
|
|
525
|
-
var initContextInvariantConfidenceSnapshotSchema =
|
|
526
|
-
confidence:
|
|
527
|
-
evidence_refs:
|
|
677
|
+
var initContextInvariantConfidenceSnapshotSchema = z8.object({
|
|
678
|
+
confidence: z8.enum(["HIGH", "MEDIUM", "LOW"]),
|
|
679
|
+
evidence_refs: z8.array(z8.string())
|
|
528
680
|
});
|
|
529
|
-
var initContextSourceEvidenceSchema =
|
|
530
|
-
file:
|
|
531
|
-
lines:
|
|
681
|
+
var initContextSourceEvidenceSchema = z8.object({
|
|
682
|
+
file: z8.string(),
|
|
683
|
+
lines: z8.string()
|
|
532
684
|
});
|
|
533
|
-
var initContextInvariantSchema =
|
|
534
|
-
type:
|
|
535
|
-
rule:
|
|
536
|
-
rationale:
|
|
685
|
+
var initContextInvariantSchema = z8.object({
|
|
686
|
+
type: z8.enum(["ban", "require", "protect"]),
|
|
687
|
+
rule: z8.string(),
|
|
688
|
+
rationale: z8.string().optional(),
|
|
537
689
|
confidence_snapshot: initContextInvariantConfidenceSnapshotSchema.optional(),
|
|
538
|
-
source_evidence:
|
|
539
|
-
});
|
|
540
|
-
var initContextDomainGroupSchema =
|
|
541
|
-
name:
|
|
542
|
-
paths:
|
|
543
|
-
summary:
|
|
544
|
-
topology_type:
|
|
545
|
-
target_path:
|
|
546
|
-
});
|
|
547
|
-
var initContextInterviewTrailEntrySchema =
|
|
548
|
-
phase:
|
|
549
|
-
question:
|
|
550
|
-
answer:
|
|
551
|
-
presentation:
|
|
552
|
-
user_corrections:
|
|
553
|
-
});
|
|
554
|
-
var initContextSchema =
|
|
690
|
+
source_evidence: z8.array(initContextSourceEvidenceSchema).optional()
|
|
691
|
+
});
|
|
692
|
+
var initContextDomainGroupSchema = z8.object({
|
|
693
|
+
name: z8.string(),
|
|
694
|
+
paths: z8.array(z8.string()),
|
|
695
|
+
summary: z8.string().optional(),
|
|
696
|
+
topology_type: z8.enum(["mirror", "cross-cutting"]).optional(),
|
|
697
|
+
target_path: z8.string().optional()
|
|
698
|
+
});
|
|
699
|
+
var initContextInterviewTrailEntrySchema = z8.object({
|
|
700
|
+
phase: z8.string(),
|
|
701
|
+
question: z8.string(),
|
|
702
|
+
answer: z8.string(),
|
|
703
|
+
presentation: z8.string().optional(),
|
|
704
|
+
user_corrections: z8.array(z8.string()).optional()
|
|
705
|
+
});
|
|
706
|
+
var initContextSchema = z8.object({
|
|
555
707
|
framework: initContextFrameworkSchema,
|
|
556
|
-
architecture_patterns:
|
|
557
|
-
invariants:
|
|
558
|
-
domain_groups:
|
|
559
|
-
interview_trail:
|
|
560
|
-
forensic_ref:
|
|
708
|
+
architecture_patterns: z8.array(z8.string()),
|
|
709
|
+
invariants: z8.array(initContextInvariantSchema),
|
|
710
|
+
domain_groups: z8.array(initContextDomainGroupSchema),
|
|
711
|
+
interview_trail: z8.array(initContextInterviewTrailEntrySchema),
|
|
712
|
+
forensic_ref: z8.string()
|
|
561
713
|
});
|
|
562
714
|
|
|
563
715
|
// src/schemas/events.ts
|
|
564
|
-
import { z as
|
|
565
|
-
var metaUpdatedEventSchema =
|
|
566
|
-
type:
|
|
716
|
+
import { z as z9 } from "zod";
|
|
717
|
+
var metaUpdatedEventSchema = z9.object({
|
|
718
|
+
type: z9.literal("meta:updated"),
|
|
567
719
|
payload: agentsMetaSchema
|
|
568
720
|
});
|
|
569
|
-
var lockDriftEventSchema =
|
|
570
|
-
type:
|
|
571
|
-
payload:
|
|
572
|
-
locked:
|
|
573
|
-
drifted:
|
|
721
|
+
var lockDriftEventSchema = z9.object({
|
|
722
|
+
type: z9.literal("lock:drift"),
|
|
723
|
+
payload: z9.object({
|
|
724
|
+
locked: z9.array(humanLockEntrySchema),
|
|
725
|
+
drifted: z9.array(humanLockEntrySchema)
|
|
574
726
|
})
|
|
575
727
|
});
|
|
576
|
-
var lockApprovedEventSchema =
|
|
577
|
-
type:
|
|
578
|
-
payload:
|
|
579
|
-
locked:
|
|
580
|
-
approved:
|
|
728
|
+
var lockApprovedEventSchema = z9.object({
|
|
729
|
+
type: z9.literal("lock:approved"),
|
|
730
|
+
payload: z9.object({
|
|
731
|
+
locked: z9.array(humanLockEntrySchema),
|
|
732
|
+
approved: z9.array(humanLockEntrySchema)
|
|
581
733
|
})
|
|
582
734
|
});
|
|
583
|
-
var ledgerAppendedEventSchema =
|
|
584
|
-
type:
|
|
735
|
+
var ledgerAppendedEventSchema = z9.object({
|
|
736
|
+
type: z9.literal("ledger:appended"),
|
|
585
737
|
payload: ledgerEntrySchema
|
|
586
738
|
});
|
|
587
|
-
var driftDetectedEventSchema =
|
|
588
|
-
type:
|
|
739
|
+
var driftDetectedEventSchema = z9.object({
|
|
740
|
+
type: z9.literal("drift:detected"),
|
|
589
741
|
payload: forensicReportSchema
|
|
590
742
|
});
|
|
591
|
-
var fabricEventSchema =
|
|
743
|
+
var fabricEventSchema = z9.discriminatedUnion("type", [
|
|
592
744
|
metaUpdatedEventSchema,
|
|
593
745
|
lockDriftEventSchema,
|
|
594
746
|
lockApprovedEventSchema,
|
|
@@ -597,278 +749,304 @@ var fabricEventSchema = z8.discriminatedUnion("type", [
|
|
|
597
749
|
]);
|
|
598
750
|
|
|
599
751
|
// src/schemas/event-ledger.ts
|
|
600
|
-
import { z as
|
|
752
|
+
import { z as z10 } from "zod";
|
|
601
753
|
var eventLedgerEnvelopeSchema = {
|
|
602
|
-
kind:
|
|
603
|
-
id:
|
|
604
|
-
ts:
|
|
605
|
-
schema_version:
|
|
606
|
-
correlation_id:
|
|
607
|
-
session_id:
|
|
754
|
+
kind: z10.literal("fabric-event"),
|
|
755
|
+
id: z10.string(),
|
|
756
|
+
ts: z10.number().int().nonnegative(),
|
|
757
|
+
schema_version: z10.literal(1),
|
|
758
|
+
correlation_id: z10.string().optional(),
|
|
759
|
+
session_id: z10.string().optional()
|
|
608
760
|
};
|
|
609
|
-
var stringRecordSchema =
|
|
610
|
-
var knowledgeContextPlannedEventSchema =
|
|
761
|
+
var stringRecordSchema = z10.record(z10.string());
|
|
762
|
+
var knowledgeContextPlannedEventSchema = z10.object({
|
|
611
763
|
...eventLedgerEnvelopeSchema,
|
|
612
|
-
event_type:
|
|
613
|
-
target_paths:
|
|
614
|
-
required_stable_ids:
|
|
615
|
-
ai_selectable_stable_ids:
|
|
616
|
-
final_stable_ids:
|
|
617
|
-
selection_token:
|
|
618
|
-
client_hash:
|
|
619
|
-
intent:
|
|
620
|
-
known_tech:
|
|
621
|
-
diagnostics:
|
|
622
|
-
});
|
|
623
|
-
var knowledgeSelectionEventSchema =
|
|
764
|
+
event_type: z10.literal("knowledge_context_planned"),
|
|
765
|
+
target_paths: z10.array(z10.string()),
|
|
766
|
+
required_stable_ids: z10.array(z10.string()),
|
|
767
|
+
ai_selectable_stable_ids: z10.array(z10.string()),
|
|
768
|
+
final_stable_ids: z10.array(z10.string()),
|
|
769
|
+
selection_token: z10.string().optional(),
|
|
770
|
+
client_hash: z10.string().optional(),
|
|
771
|
+
intent: z10.string().optional(),
|
|
772
|
+
known_tech: z10.array(z10.string()).optional(),
|
|
773
|
+
diagnostics: z10.array(z10.unknown()).optional()
|
|
774
|
+
});
|
|
775
|
+
var knowledgeSelectionEventSchema = z10.object({
|
|
624
776
|
...eventLedgerEnvelopeSchema,
|
|
625
|
-
event_type:
|
|
626
|
-
selection_token:
|
|
627
|
-
target_paths:
|
|
628
|
-
required_stable_ids:
|
|
629
|
-
ai_selectable_stable_ids:
|
|
630
|
-
ai_selected_stable_ids:
|
|
631
|
-
final_stable_ids:
|
|
777
|
+
event_type: z10.literal("knowledge_selection"),
|
|
778
|
+
selection_token: z10.string(),
|
|
779
|
+
target_paths: z10.array(z10.string()),
|
|
780
|
+
required_stable_ids: z10.array(z10.string()),
|
|
781
|
+
ai_selectable_stable_ids: z10.array(z10.string()),
|
|
782
|
+
ai_selected_stable_ids: z10.array(z10.string()),
|
|
783
|
+
final_stable_ids: z10.array(z10.string()),
|
|
632
784
|
ai_selection_reasons: stringRecordSchema,
|
|
633
|
-
rejected_stable_ids:
|
|
634
|
-
ignored_stable_ids:
|
|
785
|
+
rejected_stable_ids: z10.array(z10.string()),
|
|
786
|
+
ignored_stable_ids: z10.array(z10.string())
|
|
635
787
|
});
|
|
636
|
-
var knowledgeSectionsFetchedEventSchema =
|
|
788
|
+
var knowledgeSectionsFetchedEventSchema = z10.object({
|
|
637
789
|
...eventLedgerEnvelopeSchema,
|
|
638
|
-
event_type:
|
|
639
|
-
selection_token:
|
|
640
|
-
target_paths:
|
|
641
|
-
requested_sections:
|
|
642
|
-
final_stable_ids:
|
|
643
|
-
ai_selected_stable_ids:
|
|
644
|
-
diagnostics:
|
|
645
|
-
});
|
|
646
|
-
var editIntentCheckedEventSchema =
|
|
790
|
+
event_type: z10.literal("knowledge_sections_fetched"),
|
|
791
|
+
selection_token: z10.string(),
|
|
792
|
+
target_paths: z10.array(z10.string()).optional(),
|
|
793
|
+
requested_sections: z10.array(z10.string()),
|
|
794
|
+
final_stable_ids: z10.array(z10.string()),
|
|
795
|
+
ai_selected_stable_ids: z10.array(z10.string()),
|
|
796
|
+
diagnostics: z10.array(z10.unknown()).optional()
|
|
797
|
+
});
|
|
798
|
+
var editIntentCheckedEventSchema = z10.object({
|
|
647
799
|
...eventLedgerEnvelopeSchema,
|
|
648
|
-
event_type:
|
|
649
|
-
path:
|
|
650
|
-
compliant:
|
|
651
|
-
intent:
|
|
652
|
-
ledger_entry_id:
|
|
653
|
-
ledger_source:
|
|
654
|
-
commit_sha:
|
|
655
|
-
parent_sha:
|
|
656
|
-
parent_ledger_entry_id:
|
|
657
|
-
diff_stat:
|
|
658
|
-
annotation:
|
|
659
|
-
matched_rule_context_ts:
|
|
660
|
-
window_ms:
|
|
661
|
-
});
|
|
662
|
-
var knowledgeDriftDetectedEventSchema =
|
|
800
|
+
event_type: z10.literal("edit_intent_checked"),
|
|
801
|
+
path: z10.string(),
|
|
802
|
+
compliant: z10.boolean(),
|
|
803
|
+
intent: z10.string(),
|
|
804
|
+
ledger_entry_id: z10.string(),
|
|
805
|
+
ledger_source: z10.enum(["ai", "human"]).optional(),
|
|
806
|
+
commit_sha: z10.string().optional(),
|
|
807
|
+
parent_sha: z10.string().optional(),
|
|
808
|
+
parent_ledger_entry_id: z10.string().optional(),
|
|
809
|
+
diff_stat: z10.string().optional(),
|
|
810
|
+
annotation: z10.string().optional(),
|
|
811
|
+
matched_rule_context_ts: z10.number().int().nonnegative().nullable(),
|
|
812
|
+
window_ms: z10.number().int().nonnegative()
|
|
813
|
+
});
|
|
814
|
+
var knowledgeDriftDetectedEventSchema = z10.object({
|
|
663
815
|
...eventLedgerEnvelopeSchema,
|
|
664
|
-
event_type:
|
|
665
|
-
revision:
|
|
666
|
-
drifted_stable_ids:
|
|
667
|
-
missing_files:
|
|
668
|
-
stale_files:
|
|
669
|
-
details:
|
|
670
|
-
|
|
671
|
-
file:
|
|
672
|
-
stable_id:
|
|
673
|
-
expected_hash:
|
|
674
|
-
actual_hash:
|
|
816
|
+
event_type: z10.literal("knowledge_drift_detected"),
|
|
817
|
+
revision: z10.string().optional(),
|
|
818
|
+
drifted_stable_ids: z10.array(z10.string()),
|
|
819
|
+
missing_files: z10.array(z10.string()),
|
|
820
|
+
stale_files: z10.array(z10.string()),
|
|
821
|
+
details: z10.array(
|
|
822
|
+
z10.object({
|
|
823
|
+
file: z10.string(),
|
|
824
|
+
stable_id: z10.string(),
|
|
825
|
+
expected_hash: z10.string(),
|
|
826
|
+
actual_hash: z10.string().nullable()
|
|
675
827
|
})
|
|
676
828
|
).optional()
|
|
677
829
|
});
|
|
678
|
-
var mcpEventLedgerEventSchema =
|
|
830
|
+
var mcpEventLedgerEventSchema = z10.object({
|
|
679
831
|
...eventLedgerEnvelopeSchema,
|
|
680
|
-
event_type:
|
|
681
|
-
mcp_event_id:
|
|
682
|
-
stream_id:
|
|
683
|
-
message:
|
|
832
|
+
event_type: z10.literal("mcp_event"),
|
|
833
|
+
mcp_event_id: z10.string(),
|
|
834
|
+
stream_id: z10.string(),
|
|
835
|
+
message: z10.unknown()
|
|
684
836
|
});
|
|
685
|
-
var reapplyCompletedEventSchema =
|
|
837
|
+
var reapplyCompletedEventSchema = z10.object({
|
|
686
838
|
...eventLedgerEnvelopeSchema,
|
|
687
|
-
event_type:
|
|
688
|
-
preserved_ledger:
|
|
689
|
-
preserved_meta:
|
|
690
|
-
rules_count:
|
|
839
|
+
event_type: z10.literal("reapply_completed"),
|
|
840
|
+
preserved_ledger: z10.boolean(),
|
|
841
|
+
preserved_meta: z10.boolean(),
|
|
842
|
+
rules_count: z10.number().int().nonnegative()
|
|
691
843
|
});
|
|
692
|
-
var eventLedgerTruncatedEventSchema =
|
|
844
|
+
var eventLedgerTruncatedEventSchema = z10.object({
|
|
693
845
|
...eventLedgerEnvelopeSchema,
|
|
694
|
-
event_type:
|
|
695
|
-
byte_offset:
|
|
696
|
-
byte_length:
|
|
697
|
-
corrupted_path:
|
|
846
|
+
event_type: z10.literal("event_ledger_truncated"),
|
|
847
|
+
byte_offset: z10.number().int().nonnegative(),
|
|
848
|
+
byte_length: z10.number().int().nonnegative(),
|
|
849
|
+
corrupted_path: z10.string()
|
|
698
850
|
});
|
|
699
|
-
var mcpConfigMigratedEventSchema =
|
|
851
|
+
var mcpConfigMigratedEventSchema = z10.object({
|
|
700
852
|
...eventLedgerEnvelopeSchema,
|
|
701
|
-
event_type:
|
|
702
|
-
source:
|
|
703
|
-
removed_from:
|
|
853
|
+
event_type: z10.literal("mcp_config_migrated"),
|
|
854
|
+
source: z10.literal("doctor_fix"),
|
|
855
|
+
removed_from: z10.string()
|
|
704
856
|
});
|
|
705
|
-
var
|
|
857
|
+
var bootstrapMarkerMigratedEventSchema = z10.object({
|
|
706
858
|
...eventLedgerEnvelopeSchema,
|
|
707
|
-
event_type:
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
859
|
+
event_type: z10.literal("bootstrap_marker_migrated"),
|
|
860
|
+
path: z10.string(),
|
|
861
|
+
migrated_count: z10.number().int().nonnegative(),
|
|
862
|
+
legacy_marker: z10.literal("fabric:knowledge-base"),
|
|
863
|
+
new_marker: z10.literal("fabric:bootstrap"),
|
|
864
|
+
timestamp: z10.string()
|
|
711
865
|
});
|
|
712
|
-
var
|
|
866
|
+
var metaReconciledOnStartupEventSchema = z10.object({
|
|
713
867
|
...eventLedgerEnvelopeSchema,
|
|
714
|
-
event_type:
|
|
715
|
-
reconciled_files:
|
|
716
|
-
duration_ms:
|
|
717
|
-
|
|
718
|
-
source: z9.literal("reconcileKnowledge")
|
|
868
|
+
event_type: z10.literal("meta_reconciled_on_startup"),
|
|
869
|
+
reconciled_files: z10.array(z10.string()),
|
|
870
|
+
duration_ms: z10.number().int().nonnegative(),
|
|
871
|
+
source: z10.literal("reconcileKnowledge")
|
|
719
872
|
});
|
|
720
|
-
var
|
|
873
|
+
var metaReconciledEventSchema = z10.object({
|
|
721
874
|
...eventLedgerEnvelopeSchema,
|
|
722
|
-
event_type:
|
|
723
|
-
|
|
724
|
-
|
|
875
|
+
event_type: z10.literal("meta_reconciled"),
|
|
876
|
+
reconciled_files: z10.array(z10.string()),
|
|
877
|
+
duration_ms: z10.number().int().nonnegative(),
|
|
878
|
+
trigger: z10.enum(["doctor", "manual"]),
|
|
879
|
+
source: z10.literal("reconcileKnowledge")
|
|
725
880
|
});
|
|
726
|
-
var
|
|
881
|
+
var claudeSkillPathMigratedEventSchema = z10.object({
|
|
727
882
|
...eventLedgerEnvelopeSchema,
|
|
728
|
-
event_type:
|
|
729
|
-
from:
|
|
730
|
-
to:
|
|
883
|
+
event_type: z10.literal("claude_skill_path_migrated"),
|
|
884
|
+
from: z10.string(),
|
|
885
|
+
to: z10.string()
|
|
731
886
|
});
|
|
732
|
-
var
|
|
887
|
+
var claudeHookPathMigratedEventSchema = z10.object({
|
|
733
888
|
...eventLedgerEnvelopeSchema,
|
|
734
|
-
event_type:
|
|
735
|
-
from:
|
|
736
|
-
to:
|
|
889
|
+
event_type: z10.literal("claude_hook_path_migrated"),
|
|
890
|
+
from: z10.string(),
|
|
891
|
+
to: z10.string()
|
|
737
892
|
});
|
|
738
|
-
var
|
|
893
|
+
var codexSkillPathMigratedEventSchema = z10.object({
|
|
739
894
|
...eventLedgerEnvelopeSchema,
|
|
740
|
-
event_type:
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
source: z9.enum(["init", "scan", "doctor_fix"]).optional()
|
|
895
|
+
event_type: z10.literal("codex_skill_path_migrated"),
|
|
896
|
+
from: z10.string(),
|
|
897
|
+
to: z10.string()
|
|
744
898
|
});
|
|
745
|
-
var
|
|
899
|
+
var initScanCompletedEventSchema = z10.object({
|
|
746
900
|
...eventLedgerEnvelopeSchema,
|
|
747
|
-
event_type:
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
901
|
+
event_type: z10.literal("init_scan_completed"),
|
|
902
|
+
written_stable_ids: z10.array(z10.string()),
|
|
903
|
+
duration_ms: z10.number().int().nonnegative(),
|
|
904
|
+
source: z10.enum(["init", "scan", "doctor_fix", "doctor-rescan"]).optional()
|
|
751
905
|
});
|
|
752
|
-
var
|
|
906
|
+
var knowledgeProposedEventSchema = z10.object({
|
|
753
907
|
...eventLedgerEnvelopeSchema,
|
|
754
|
-
event_type:
|
|
755
|
-
stable_id:
|
|
756
|
-
timestamp:
|
|
757
|
-
reason:
|
|
908
|
+
event_type: z10.literal("knowledge_proposed"),
|
|
909
|
+
stable_id: z10.string().optional(),
|
|
910
|
+
timestamp: z10.string().datetime(),
|
|
911
|
+
reason: z10.string().optional()
|
|
758
912
|
});
|
|
759
|
-
var
|
|
913
|
+
var knowledgePromoteStartedEventSchema = z10.object({
|
|
760
914
|
...eventLedgerEnvelopeSchema,
|
|
761
|
-
event_type:
|
|
762
|
-
stable_id:
|
|
763
|
-
timestamp:
|
|
764
|
-
reason:
|
|
915
|
+
event_type: z10.literal("knowledge_promote_started"),
|
|
916
|
+
stable_id: z10.string().optional(),
|
|
917
|
+
timestamp: z10.string().datetime(),
|
|
918
|
+
reason: z10.string().optional()
|
|
765
919
|
});
|
|
766
|
-
var
|
|
920
|
+
var knowledgePromotedEventSchema = z10.object({
|
|
767
921
|
...eventLedgerEnvelopeSchema,
|
|
768
|
-
event_type:
|
|
769
|
-
stable_id:
|
|
770
|
-
timestamp:
|
|
771
|
-
reason:
|
|
922
|
+
event_type: z10.literal("knowledge_promoted"),
|
|
923
|
+
stable_id: z10.string().optional(),
|
|
924
|
+
timestamp: z10.string().datetime(),
|
|
925
|
+
reason: z10.string().optional()
|
|
772
926
|
});
|
|
773
|
-
var
|
|
927
|
+
var knowledgePromoteFailedEventSchema = z10.object({
|
|
774
928
|
...eventLedgerEnvelopeSchema,
|
|
775
|
-
event_type:
|
|
776
|
-
stable_id:
|
|
777
|
-
timestamp:
|
|
778
|
-
reason:
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
});
|
|
782
|
-
var knowledgeSlugRenamedEventSchema = z9.object({
|
|
929
|
+
event_type: z10.literal("knowledge_promote_failed"),
|
|
930
|
+
stable_id: z10.string().optional(),
|
|
931
|
+
timestamp: z10.string().datetime(),
|
|
932
|
+
reason: z10.string()
|
|
933
|
+
});
|
|
934
|
+
var knowledgeLayerChangedEventSchema = z10.object({
|
|
783
935
|
...eventLedgerEnvelopeSchema,
|
|
784
|
-
event_type:
|
|
785
|
-
stable_id:
|
|
786
|
-
timestamp:
|
|
787
|
-
reason:
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
});
|
|
791
|
-
var
|
|
936
|
+
event_type: z10.literal("knowledge_layer_changed"),
|
|
937
|
+
stable_id: z10.string().optional(),
|
|
938
|
+
timestamp: z10.string().datetime(),
|
|
939
|
+
reason: z10.string().optional(),
|
|
940
|
+
from_layer: z10.enum(["team", "personal"]),
|
|
941
|
+
to_layer: z10.enum(["team", "personal"])
|
|
942
|
+
});
|
|
943
|
+
var knowledgeSlugRenamedEventSchema = z10.object({
|
|
792
944
|
...eventLedgerEnvelopeSchema,
|
|
793
|
-
event_type:
|
|
794
|
-
stable_id:
|
|
795
|
-
timestamp:
|
|
796
|
-
reason:
|
|
945
|
+
event_type: z10.literal("knowledge_slug_renamed"),
|
|
946
|
+
stable_id: z10.string().optional(),
|
|
947
|
+
timestamp: z10.string().datetime(),
|
|
948
|
+
reason: z10.string().optional(),
|
|
949
|
+
from_slug: z10.string(),
|
|
950
|
+
to_slug: z10.string()
|
|
797
951
|
});
|
|
798
|
-
var
|
|
952
|
+
var knowledgeDemotedEventSchema = z10.object({
|
|
799
953
|
...eventLedgerEnvelopeSchema,
|
|
800
|
-
event_type:
|
|
801
|
-
stable_id:
|
|
802
|
-
timestamp:
|
|
803
|
-
reason:
|
|
954
|
+
event_type: z10.literal("knowledge_demoted"),
|
|
955
|
+
stable_id: z10.string().optional(),
|
|
956
|
+
timestamp: z10.string().datetime(),
|
|
957
|
+
reason: z10.string().optional()
|
|
804
958
|
});
|
|
805
|
-
var
|
|
959
|
+
var knowledgeArchivedEventSchema = z10.object({
|
|
806
960
|
...eventLedgerEnvelopeSchema,
|
|
807
|
-
event_type:
|
|
808
|
-
stable_id:
|
|
809
|
-
timestamp:
|
|
810
|
-
reason:
|
|
961
|
+
event_type: z10.literal("knowledge_archived"),
|
|
962
|
+
stable_id: z10.string().optional(),
|
|
963
|
+
timestamp: z10.string().datetime(),
|
|
964
|
+
reason: z10.string().optional()
|
|
811
965
|
});
|
|
812
|
-
var
|
|
966
|
+
var knowledgeArchiveAttemptedEventSchema = z10.object({
|
|
813
967
|
...eventLedgerEnvelopeSchema,
|
|
814
|
-
event_type:
|
|
815
|
-
stable_id:
|
|
816
|
-
timestamp:
|
|
817
|
-
reason:
|
|
818
|
-
until: z9.string().datetime().optional()
|
|
968
|
+
event_type: z10.literal("knowledge_archive_attempted"),
|
|
969
|
+
stable_id: z10.string().optional(),
|
|
970
|
+
timestamp: z10.string().datetime(),
|
|
971
|
+
reason: z10.string().optional()
|
|
819
972
|
});
|
|
820
|
-
var
|
|
973
|
+
var knowledgeDeferredEventSchema = z10.object({
|
|
821
974
|
...eventLedgerEnvelopeSchema,
|
|
822
|
-
event_type:
|
|
823
|
-
stable_id:
|
|
824
|
-
timestamp:
|
|
825
|
-
reason:
|
|
975
|
+
event_type: z10.literal("knowledge_deferred"),
|
|
976
|
+
stable_id: z10.string().optional(),
|
|
977
|
+
timestamp: z10.string().datetime(),
|
|
978
|
+
reason: z10.string().optional(),
|
|
979
|
+
until: z10.string().datetime().optional()
|
|
826
980
|
});
|
|
827
|
-
var
|
|
981
|
+
var knowledgeRejectedEventSchema = z10.object({
|
|
828
982
|
...eventLedgerEnvelopeSchema,
|
|
829
|
-
event_type:
|
|
830
|
-
stable_id:
|
|
831
|
-
|
|
832
|
-
|
|
983
|
+
event_type: z10.literal("knowledge_rejected"),
|
|
984
|
+
stable_id: z10.string().optional(),
|
|
985
|
+
timestamp: z10.string().datetime(),
|
|
986
|
+
reason: z10.string()
|
|
833
987
|
});
|
|
834
|
-
var
|
|
988
|
+
var knowledgeConsumedEventSchema = z10.object({
|
|
835
989
|
...eventLedgerEnvelopeSchema,
|
|
836
|
-
event_type:
|
|
837
|
-
stable_id:
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
});
|
|
843
|
-
var doctorRunEventSchema = z9.object({
|
|
990
|
+
event_type: z10.literal("knowledge_consumed"),
|
|
991
|
+
stable_id: z10.string(),
|
|
992
|
+
consumed_at: z10.string().datetime(),
|
|
993
|
+
client_hash: z10.string()
|
|
994
|
+
});
|
|
995
|
+
var knowledgeScopeDegradedEventSchema = z10.object({
|
|
844
996
|
...eventLedgerEnvelopeSchema,
|
|
845
|
-
event_type:
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
997
|
+
event_type: z10.literal("knowledge_scope_degraded"),
|
|
998
|
+
stable_id: z10.string(),
|
|
999
|
+
timestamp: z10.string().datetime(),
|
|
1000
|
+
from_scope: z10.enum(["narrow", "broad"]),
|
|
1001
|
+
to_scope: z10.enum(["narrow", "broad"]),
|
|
1002
|
+
reason: z10.string()
|
|
850
1003
|
});
|
|
851
|
-
var
|
|
1004
|
+
var doctorRunEventSchema = z10.object({
|
|
852
1005
|
...eventLedgerEnvelopeSchema,
|
|
853
|
-
event_type:
|
|
854
|
-
|
|
855
|
-
|
|
1006
|
+
event_type: z10.literal("doctor_run"),
|
|
1007
|
+
mode: z10.enum(["lint", "fix-knowledge"]),
|
|
1008
|
+
issues: z10.number().int().nonnegative(),
|
|
1009
|
+
mutations: z10.number().int().nonnegative().optional(),
|
|
1010
|
+
timestamp: z10.string().datetime()
|
|
856
1011
|
});
|
|
857
|
-
var
|
|
1012
|
+
var knowledgePathDangledEventSchema = z10.object({
|
|
858
1013
|
...eventLedgerEnvelopeSchema,
|
|
859
|
-
event_type:
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
touched_count: z9.number().int().nonnegative()
|
|
1014
|
+
event_type: z10.literal("knowledge_path_dangled"),
|
|
1015
|
+
stable_id: z10.string(),
|
|
1016
|
+
removed_glob: z10.string()
|
|
863
1017
|
});
|
|
864
|
-
var
|
|
1018
|
+
var relevanceMigrationRunEventSchema = z10.object({
|
|
865
1019
|
...eventLedgerEnvelopeSchema,
|
|
866
|
-
event_type:
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
1020
|
+
event_type: z10.literal("relevance_migration_run"),
|
|
1021
|
+
timestamp: z10.string().datetime(),
|
|
1022
|
+
scanned_count: z10.number().int().nonnegative(),
|
|
1023
|
+
touched_count: z10.number().int().nonnegative()
|
|
870
1024
|
});
|
|
871
|
-
var
|
|
1025
|
+
var pendingAutoArchivedEventSchema = z10.object({
|
|
1026
|
+
...eventLedgerEnvelopeSchema,
|
|
1027
|
+
event_type: z10.literal("pending_auto_archived"),
|
|
1028
|
+
pending_path: z10.string(),
|
|
1029
|
+
archived_to: z10.string(),
|
|
1030
|
+
reason: z10.string()
|
|
1031
|
+
});
|
|
1032
|
+
var assistantTurnObservedEventSchema = z10.object({
|
|
1033
|
+
...eventLedgerEnvelopeSchema,
|
|
1034
|
+
event_type: z10.literal("assistant_turn_observed"),
|
|
1035
|
+
kb_line_raw: z10.string().nullable(),
|
|
1036
|
+
cite_ids: z10.array(z10.string()).default([]),
|
|
1037
|
+
cite_tags: z10.array(z10.enum(["planned", "recalled", "chained-from", "dismissed", "none"])).default([]),
|
|
1038
|
+
client: z10.enum(["cc", "codex", "cursor"]).optional(),
|
|
1039
|
+
turn_id: z10.string(),
|
|
1040
|
+
envelope_index: z10.number().int().nonnegative().optional(),
|
|
1041
|
+
timestamp: z10.string().datetime()
|
|
1042
|
+
});
|
|
1043
|
+
var citePolicyActivatedEventSchema = z10.object({
|
|
1044
|
+
...eventLedgerEnvelopeSchema,
|
|
1045
|
+
event_type: z10.literal("cite_policy_activated"),
|
|
1046
|
+
policy_version: z10.string(),
|
|
1047
|
+
timestamp: z10.string().datetime()
|
|
1048
|
+
});
|
|
1049
|
+
var eventLedgerEventSchema = z10.discriminatedUnion("event_type", [
|
|
872
1050
|
knowledgeContextPlannedEventSchema,
|
|
873
1051
|
knowledgeSelectionEventSchema,
|
|
874
1052
|
knowledgeSectionsFetchedEventSchema,
|
|
@@ -878,6 +1056,9 @@ var eventLedgerEventSchema = z9.discriminatedUnion("event_type", [
|
|
|
878
1056
|
reapplyCompletedEventSchema,
|
|
879
1057
|
eventLedgerTruncatedEventSchema,
|
|
880
1058
|
mcpConfigMigratedEventSchema,
|
|
1059
|
+
// v2.0.0-rc.19 TASK-004: bootstrap_marker_migrated — one-time fabric:knowledge-base
|
|
1060
|
+
// → fabric:bootstrap marker rewrite emitted per file by `fab doctor --fix`.
|
|
1061
|
+
bootstrapMarkerMigratedEventSchema,
|
|
881
1062
|
metaReconciledOnStartupEventSchema,
|
|
882
1063
|
metaReconciledEventSchema,
|
|
883
1064
|
claudeSkillPathMigratedEventSchema,
|
|
@@ -910,13 +1091,23 @@ var eventLedgerEventSchema = z9.discriminatedUnion("event_type", [
|
|
|
910
1091
|
doctorRunEventSchema,
|
|
911
1092
|
// v2.0.0-rc.9 TASK-003 (A3): relevance_migration_run — emitted by
|
|
912
1093
|
// `doctor --apply-lint` after the lint #26 frontmatter back-fill pass.
|
|
913
|
-
relevanceMigrationRunEventSchema
|
|
1094
|
+
relevanceMigrationRunEventSchema,
|
|
1095
|
+
// v2.0.0-rc.20 TASK-02: assistant_turn_observed — per-turn cite-policy
|
|
1096
|
+
// observation (raw KB: line text + parsed cite_ids/cite_tags + client).
|
|
1097
|
+
assistantTurnObservedEventSchema,
|
|
1098
|
+
// v2.0.0-rc.20 TASK-02: cite_policy_activated — session/policy-bump
|
|
1099
|
+
// marker recording when a given policy_version became active.
|
|
1100
|
+
citePolicyActivatedEventSchema
|
|
914
1101
|
]);
|
|
915
1102
|
export {
|
|
916
1103
|
AGENTS_META_IDENTITY_SOURCES,
|
|
917
1104
|
AGENTS_META_LAYERS,
|
|
918
1105
|
AGENTS_META_TOPOLOGY_TYPES,
|
|
919
1106
|
AgentsMetaCountersSchema,
|
|
1107
|
+
BOOTSTRAP_CANONICAL,
|
|
1108
|
+
BOOTSTRAP_MARKER_BEGIN,
|
|
1109
|
+
BOOTSTRAP_MARKER_END,
|
|
1110
|
+
BOOTSTRAP_REGEX,
|
|
920
1111
|
FabExtractKnowledgeInputSchema,
|
|
921
1112
|
FabExtractKnowledgeInputShape,
|
|
922
1113
|
FabExtractKnowledgeOutputSchema,
|
|
@@ -928,6 +1119,9 @@ export {
|
|
|
928
1119
|
KNOWLEDGE_TYPE_CODES,
|
|
929
1120
|
KnowledgeEntryFrontmatterSchema,
|
|
930
1121
|
KnowledgeTypeSchema,
|
|
1122
|
+
LEGACY_KB_MARKER_BEGIN,
|
|
1123
|
+
LEGACY_KB_MARKER_END,
|
|
1124
|
+
LEGACY_KB_REGEX,
|
|
931
1125
|
LayerSchema,
|
|
932
1126
|
MaturitySchema,
|
|
933
1127
|
PROPOSED_REASON_DESCRIPTIONS,
|
|
@@ -942,8 +1136,11 @@ export {
|
|
|
942
1136
|
aiLedgerEntrySchema,
|
|
943
1137
|
allocateKnowledgeId,
|
|
944
1138
|
annotateIntentRequestSchema,
|
|
1139
|
+
assistantTurnObservedEventSchema,
|
|
945
1140
|
auditModeSchema,
|
|
1141
|
+
bootstrapMarkerMigratedEventSchema,
|
|
946
1142
|
candidateFileEntrySchema,
|
|
1143
|
+
citePolicyActivatedEventSchema,
|
|
947
1144
|
claudeHookPathMigratedEventSchema,
|
|
948
1145
|
claudeSkillPathMigratedEventSchema,
|
|
949
1146
|
clientPathsSchema,
|
|
@@ -982,6 +1179,8 @@ export {
|
|
|
982
1179
|
getKnowledgeAnnotations,
|
|
983
1180
|
getKnowledgeInputSchema,
|
|
984
1181
|
getKnowledgeOutputSchema,
|
|
1182
|
+
getPanelFieldByKey,
|
|
1183
|
+
getPanelFields,
|
|
985
1184
|
historyStateQuerySchema,
|
|
986
1185
|
humanLedgerEntrySchema,
|
|
987
1186
|
humanLockApproveRequestSchema,
|