@fenglimg/fabric-shared 2.0.0-rc.15 → 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-BKTCBFXZ.js → chunk-VKCXD6CI.js} +178 -36
- package/dist/i18n/index.js +1 -1
- package/dist/index.d.ts +277 -5
- package/dist/index.js +538 -338
- package/dist/templates/bootstrap-canonical.d.ts +56 -0
- package/dist/templates/bootstrap-canonical.js +18 -0
- package/dist/types/index.d.ts +0 -1
- 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,7 +324,13 @@ 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
335
|
audit_mode: auditModeSchema.optional(),
|
|
321
336
|
mcpPayloadLimits: mcpPayloadLimitsSchema,
|
|
@@ -438,156 +453,294 @@ var fabricConfigSchema = z5.object({
|
|
|
438
453
|
review_stale_pending_days: z5.number().int().positive().optional().default(14)
|
|
439
454
|
});
|
|
440
455
|
|
|
441
|
-
// src/schemas/
|
|
456
|
+
// src/schemas/fabric-config-introspect.ts
|
|
442
457
|
import { z as z6 } from "zod";
|
|
443
|
-
var
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
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),
|
|
465
618
|
coverage: forensicAssertionCoverageSchema,
|
|
466
|
-
proposed_rule:
|
|
467
|
-
alternatives:
|
|
468
|
-
});
|
|
469
|
-
var forensicTopologySchema =
|
|
470
|
-
total_files:
|
|
471
|
-
by_ext:
|
|
472
|
-
key_dirs:
|
|
473
|
-
max_depth:
|
|
474
|
-
});
|
|
475
|
-
var forensicEntryPointSchema =
|
|
476
|
-
path:
|
|
477
|
-
reason:
|
|
478
|
-
size_bytes:
|
|
479
|
-
});
|
|
480
|
-
var forensicFrameworkSchema =
|
|
481
|
-
kind:
|
|
482
|
-
version:
|
|
483
|
-
subkind:
|
|
484
|
-
evidence:
|
|
485
|
-
});
|
|
486
|
-
var forensicReadmeSchema =
|
|
487
|
-
quality:
|
|
488
|
-
line_count:
|
|
489
|
-
has_contributing:
|
|
490
|
-
});
|
|
491
|
-
var candidateFileEntrySchema =
|
|
492
|
-
path:
|
|
493
|
-
family:
|
|
494
|
-
rationale:
|
|
495
|
-
});
|
|
496
|
-
var forensicSamplingBudgetSchema =
|
|
497
|
-
max_files:
|
|
498
|
-
max_lines_per_file:
|
|
499
|
-
});
|
|
500
|
-
var forensicReportSchema =
|
|
501
|
-
version:
|
|
502
|
-
generated_at:
|
|
503
|
-
generated_by:
|
|
504
|
-
target:
|
|
505
|
-
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(),
|
|
506
659
|
framework: forensicFrameworkSchema,
|
|
507
660
|
topology: forensicTopologySchema,
|
|
508
|
-
entry_points:
|
|
509
|
-
code_samples:
|
|
510
|
-
assertions:
|
|
511
|
-
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),
|
|
512
665
|
sampling_budget: forensicSamplingBudgetSchema,
|
|
513
666
|
readme: forensicReadmeSchema,
|
|
514
|
-
recommendations_for_skill:
|
|
667
|
+
recommendations_for_skill: z7.array(z7.string()).optional()
|
|
515
668
|
});
|
|
516
669
|
|
|
517
670
|
// src/schemas/init-context.ts
|
|
518
|
-
import { z as
|
|
519
|
-
var initContextFrameworkSchema =
|
|
520
|
-
kind:
|
|
521
|
-
version:
|
|
522
|
-
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()
|
|
523
676
|
});
|
|
524
|
-
var initContextInvariantConfidenceSnapshotSchema =
|
|
525
|
-
confidence:
|
|
526
|
-
evidence_refs:
|
|
677
|
+
var initContextInvariantConfidenceSnapshotSchema = z8.object({
|
|
678
|
+
confidence: z8.enum(["HIGH", "MEDIUM", "LOW"]),
|
|
679
|
+
evidence_refs: z8.array(z8.string())
|
|
527
680
|
});
|
|
528
|
-
var initContextSourceEvidenceSchema =
|
|
529
|
-
file:
|
|
530
|
-
lines:
|
|
681
|
+
var initContextSourceEvidenceSchema = z8.object({
|
|
682
|
+
file: z8.string(),
|
|
683
|
+
lines: z8.string()
|
|
531
684
|
});
|
|
532
|
-
var initContextInvariantSchema =
|
|
533
|
-
type:
|
|
534
|
-
rule:
|
|
535
|
-
rationale:
|
|
685
|
+
var initContextInvariantSchema = z8.object({
|
|
686
|
+
type: z8.enum(["ban", "require", "protect"]),
|
|
687
|
+
rule: z8.string(),
|
|
688
|
+
rationale: z8.string().optional(),
|
|
536
689
|
confidence_snapshot: initContextInvariantConfidenceSnapshotSchema.optional(),
|
|
537
|
-
source_evidence:
|
|
538
|
-
});
|
|
539
|
-
var initContextDomainGroupSchema =
|
|
540
|
-
name:
|
|
541
|
-
paths:
|
|
542
|
-
summary:
|
|
543
|
-
topology_type:
|
|
544
|
-
target_path:
|
|
545
|
-
});
|
|
546
|
-
var initContextInterviewTrailEntrySchema =
|
|
547
|
-
phase:
|
|
548
|
-
question:
|
|
549
|
-
answer:
|
|
550
|
-
presentation:
|
|
551
|
-
user_corrections:
|
|
552
|
-
});
|
|
553
|
-
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({
|
|
554
707
|
framework: initContextFrameworkSchema,
|
|
555
|
-
architecture_patterns:
|
|
556
|
-
invariants:
|
|
557
|
-
domain_groups:
|
|
558
|
-
interview_trail:
|
|
559
|
-
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()
|
|
560
713
|
});
|
|
561
714
|
|
|
562
715
|
// src/schemas/events.ts
|
|
563
|
-
import { z as
|
|
564
|
-
var metaUpdatedEventSchema =
|
|
565
|
-
type:
|
|
716
|
+
import { z as z9 } from "zod";
|
|
717
|
+
var metaUpdatedEventSchema = z9.object({
|
|
718
|
+
type: z9.literal("meta:updated"),
|
|
566
719
|
payload: agentsMetaSchema
|
|
567
720
|
});
|
|
568
|
-
var lockDriftEventSchema =
|
|
569
|
-
type:
|
|
570
|
-
payload:
|
|
571
|
-
locked:
|
|
572
|
-
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)
|
|
573
726
|
})
|
|
574
727
|
});
|
|
575
|
-
var lockApprovedEventSchema =
|
|
576
|
-
type:
|
|
577
|
-
payload:
|
|
578
|
-
locked:
|
|
579
|
-
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)
|
|
580
733
|
})
|
|
581
734
|
});
|
|
582
|
-
var ledgerAppendedEventSchema =
|
|
583
|
-
type:
|
|
735
|
+
var ledgerAppendedEventSchema = z9.object({
|
|
736
|
+
type: z9.literal("ledger:appended"),
|
|
584
737
|
payload: ledgerEntrySchema
|
|
585
738
|
});
|
|
586
|
-
var driftDetectedEventSchema =
|
|
587
|
-
type:
|
|
739
|
+
var driftDetectedEventSchema = z9.object({
|
|
740
|
+
type: z9.literal("drift:detected"),
|
|
588
741
|
payload: forensicReportSchema
|
|
589
742
|
});
|
|
590
|
-
var fabricEventSchema =
|
|
743
|
+
var fabricEventSchema = z9.discriminatedUnion("type", [
|
|
591
744
|
metaUpdatedEventSchema,
|
|
592
745
|
lockDriftEventSchema,
|
|
593
746
|
lockApprovedEventSchema,
|
|
@@ -596,278 +749,304 @@ var fabricEventSchema = z8.discriminatedUnion("type", [
|
|
|
596
749
|
]);
|
|
597
750
|
|
|
598
751
|
// src/schemas/event-ledger.ts
|
|
599
|
-
import { z as
|
|
752
|
+
import { z as z10 } from "zod";
|
|
600
753
|
var eventLedgerEnvelopeSchema = {
|
|
601
|
-
kind:
|
|
602
|
-
id:
|
|
603
|
-
ts:
|
|
604
|
-
schema_version:
|
|
605
|
-
correlation_id:
|
|
606
|
-
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()
|
|
607
760
|
};
|
|
608
|
-
var stringRecordSchema =
|
|
609
|
-
var knowledgeContextPlannedEventSchema =
|
|
761
|
+
var stringRecordSchema = z10.record(z10.string());
|
|
762
|
+
var knowledgeContextPlannedEventSchema = z10.object({
|
|
610
763
|
...eventLedgerEnvelopeSchema,
|
|
611
|
-
event_type:
|
|
612
|
-
target_paths:
|
|
613
|
-
required_stable_ids:
|
|
614
|
-
ai_selectable_stable_ids:
|
|
615
|
-
final_stable_ids:
|
|
616
|
-
selection_token:
|
|
617
|
-
client_hash:
|
|
618
|
-
intent:
|
|
619
|
-
known_tech:
|
|
620
|
-
diagnostics:
|
|
621
|
-
});
|
|
622
|
-
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({
|
|
623
776
|
...eventLedgerEnvelopeSchema,
|
|
624
|
-
event_type:
|
|
625
|
-
selection_token:
|
|
626
|
-
target_paths:
|
|
627
|
-
required_stable_ids:
|
|
628
|
-
ai_selectable_stable_ids:
|
|
629
|
-
ai_selected_stable_ids:
|
|
630
|
-
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()),
|
|
631
784
|
ai_selection_reasons: stringRecordSchema,
|
|
632
|
-
rejected_stable_ids:
|
|
633
|
-
ignored_stable_ids:
|
|
785
|
+
rejected_stable_ids: z10.array(z10.string()),
|
|
786
|
+
ignored_stable_ids: z10.array(z10.string())
|
|
634
787
|
});
|
|
635
|
-
var knowledgeSectionsFetchedEventSchema =
|
|
788
|
+
var knowledgeSectionsFetchedEventSchema = z10.object({
|
|
636
789
|
...eventLedgerEnvelopeSchema,
|
|
637
|
-
event_type:
|
|
638
|
-
selection_token:
|
|
639
|
-
target_paths:
|
|
640
|
-
requested_sections:
|
|
641
|
-
final_stable_ids:
|
|
642
|
-
ai_selected_stable_ids:
|
|
643
|
-
diagnostics:
|
|
644
|
-
});
|
|
645
|
-
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({
|
|
646
799
|
...eventLedgerEnvelopeSchema,
|
|
647
|
-
event_type:
|
|
648
|
-
path:
|
|
649
|
-
compliant:
|
|
650
|
-
intent:
|
|
651
|
-
ledger_entry_id:
|
|
652
|
-
ledger_source:
|
|
653
|
-
commit_sha:
|
|
654
|
-
parent_sha:
|
|
655
|
-
parent_ledger_entry_id:
|
|
656
|
-
diff_stat:
|
|
657
|
-
annotation:
|
|
658
|
-
matched_rule_context_ts:
|
|
659
|
-
window_ms:
|
|
660
|
-
});
|
|
661
|
-
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({
|
|
662
815
|
...eventLedgerEnvelopeSchema,
|
|
663
|
-
event_type:
|
|
664
|
-
revision:
|
|
665
|
-
drifted_stable_ids:
|
|
666
|
-
missing_files:
|
|
667
|
-
stale_files:
|
|
668
|
-
details:
|
|
669
|
-
|
|
670
|
-
file:
|
|
671
|
-
stable_id:
|
|
672
|
-
expected_hash:
|
|
673
|
-
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()
|
|
674
827
|
})
|
|
675
828
|
).optional()
|
|
676
829
|
});
|
|
677
|
-
var mcpEventLedgerEventSchema =
|
|
830
|
+
var mcpEventLedgerEventSchema = z10.object({
|
|
678
831
|
...eventLedgerEnvelopeSchema,
|
|
679
|
-
event_type:
|
|
680
|
-
mcp_event_id:
|
|
681
|
-
stream_id:
|
|
682
|
-
message:
|
|
832
|
+
event_type: z10.literal("mcp_event"),
|
|
833
|
+
mcp_event_id: z10.string(),
|
|
834
|
+
stream_id: z10.string(),
|
|
835
|
+
message: z10.unknown()
|
|
683
836
|
});
|
|
684
|
-
var reapplyCompletedEventSchema =
|
|
837
|
+
var reapplyCompletedEventSchema = z10.object({
|
|
685
838
|
...eventLedgerEnvelopeSchema,
|
|
686
|
-
event_type:
|
|
687
|
-
preserved_ledger:
|
|
688
|
-
preserved_meta:
|
|
689
|
-
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()
|
|
690
843
|
});
|
|
691
|
-
var eventLedgerTruncatedEventSchema =
|
|
844
|
+
var eventLedgerTruncatedEventSchema = z10.object({
|
|
692
845
|
...eventLedgerEnvelopeSchema,
|
|
693
|
-
event_type:
|
|
694
|
-
byte_offset:
|
|
695
|
-
byte_length:
|
|
696
|
-
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()
|
|
697
850
|
});
|
|
698
|
-
var mcpConfigMigratedEventSchema =
|
|
851
|
+
var mcpConfigMigratedEventSchema = z10.object({
|
|
699
852
|
...eventLedgerEnvelopeSchema,
|
|
700
|
-
event_type:
|
|
701
|
-
source:
|
|
702
|
-
removed_from:
|
|
853
|
+
event_type: z10.literal("mcp_config_migrated"),
|
|
854
|
+
source: z10.literal("doctor_fix"),
|
|
855
|
+
removed_from: z10.string()
|
|
703
856
|
});
|
|
704
|
-
var
|
|
857
|
+
var bootstrapMarkerMigratedEventSchema = z10.object({
|
|
705
858
|
...eventLedgerEnvelopeSchema,
|
|
706
|
-
event_type:
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
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()
|
|
710
865
|
});
|
|
711
|
-
var
|
|
866
|
+
var metaReconciledOnStartupEventSchema = z10.object({
|
|
712
867
|
...eventLedgerEnvelopeSchema,
|
|
713
|
-
event_type:
|
|
714
|
-
reconciled_files:
|
|
715
|
-
duration_ms:
|
|
716
|
-
|
|
717
|
-
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")
|
|
718
872
|
});
|
|
719
|
-
var
|
|
873
|
+
var metaReconciledEventSchema = z10.object({
|
|
720
874
|
...eventLedgerEnvelopeSchema,
|
|
721
|
-
event_type:
|
|
722
|
-
|
|
723
|
-
|
|
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")
|
|
724
880
|
});
|
|
725
|
-
var
|
|
881
|
+
var claudeSkillPathMigratedEventSchema = z10.object({
|
|
726
882
|
...eventLedgerEnvelopeSchema,
|
|
727
|
-
event_type:
|
|
728
|
-
from:
|
|
729
|
-
to:
|
|
883
|
+
event_type: z10.literal("claude_skill_path_migrated"),
|
|
884
|
+
from: z10.string(),
|
|
885
|
+
to: z10.string()
|
|
730
886
|
});
|
|
731
|
-
var
|
|
887
|
+
var claudeHookPathMigratedEventSchema = z10.object({
|
|
732
888
|
...eventLedgerEnvelopeSchema,
|
|
733
|
-
event_type:
|
|
734
|
-
from:
|
|
735
|
-
to:
|
|
889
|
+
event_type: z10.literal("claude_hook_path_migrated"),
|
|
890
|
+
from: z10.string(),
|
|
891
|
+
to: z10.string()
|
|
736
892
|
});
|
|
737
|
-
var
|
|
893
|
+
var codexSkillPathMigratedEventSchema = z10.object({
|
|
738
894
|
...eventLedgerEnvelopeSchema,
|
|
739
|
-
event_type:
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
source: z9.enum(["init", "scan", "doctor_fix", "doctor-rescan"]).optional()
|
|
895
|
+
event_type: z10.literal("codex_skill_path_migrated"),
|
|
896
|
+
from: z10.string(),
|
|
897
|
+
to: z10.string()
|
|
743
898
|
});
|
|
744
|
-
var
|
|
899
|
+
var initScanCompletedEventSchema = z10.object({
|
|
745
900
|
...eventLedgerEnvelopeSchema,
|
|
746
|
-
event_type:
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
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()
|
|
750
905
|
});
|
|
751
|
-
var
|
|
906
|
+
var knowledgeProposedEventSchema = z10.object({
|
|
752
907
|
...eventLedgerEnvelopeSchema,
|
|
753
|
-
event_type:
|
|
754
|
-
stable_id:
|
|
755
|
-
timestamp:
|
|
756
|
-
reason:
|
|
908
|
+
event_type: z10.literal("knowledge_proposed"),
|
|
909
|
+
stable_id: z10.string().optional(),
|
|
910
|
+
timestamp: z10.string().datetime(),
|
|
911
|
+
reason: z10.string().optional()
|
|
757
912
|
});
|
|
758
|
-
var
|
|
913
|
+
var knowledgePromoteStartedEventSchema = z10.object({
|
|
759
914
|
...eventLedgerEnvelopeSchema,
|
|
760
|
-
event_type:
|
|
761
|
-
stable_id:
|
|
762
|
-
timestamp:
|
|
763
|
-
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()
|
|
764
919
|
});
|
|
765
|
-
var
|
|
920
|
+
var knowledgePromotedEventSchema = z10.object({
|
|
766
921
|
...eventLedgerEnvelopeSchema,
|
|
767
|
-
event_type:
|
|
768
|
-
stable_id:
|
|
769
|
-
timestamp:
|
|
770
|
-
reason:
|
|
922
|
+
event_type: z10.literal("knowledge_promoted"),
|
|
923
|
+
stable_id: z10.string().optional(),
|
|
924
|
+
timestamp: z10.string().datetime(),
|
|
925
|
+
reason: z10.string().optional()
|
|
771
926
|
});
|
|
772
|
-
var
|
|
927
|
+
var knowledgePromoteFailedEventSchema = z10.object({
|
|
773
928
|
...eventLedgerEnvelopeSchema,
|
|
774
|
-
event_type:
|
|
775
|
-
stable_id:
|
|
776
|
-
timestamp:
|
|
777
|
-
reason:
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
});
|
|
781
|
-
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({
|
|
782
935
|
...eventLedgerEnvelopeSchema,
|
|
783
|
-
event_type:
|
|
784
|
-
stable_id:
|
|
785
|
-
timestamp:
|
|
786
|
-
reason:
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
});
|
|
790
|
-
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({
|
|
791
944
|
...eventLedgerEnvelopeSchema,
|
|
792
|
-
event_type:
|
|
793
|
-
stable_id:
|
|
794
|
-
timestamp:
|
|
795
|
-
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()
|
|
796
951
|
});
|
|
797
|
-
var
|
|
952
|
+
var knowledgeDemotedEventSchema = z10.object({
|
|
798
953
|
...eventLedgerEnvelopeSchema,
|
|
799
|
-
event_type:
|
|
800
|
-
stable_id:
|
|
801
|
-
timestamp:
|
|
802
|
-
reason:
|
|
954
|
+
event_type: z10.literal("knowledge_demoted"),
|
|
955
|
+
stable_id: z10.string().optional(),
|
|
956
|
+
timestamp: z10.string().datetime(),
|
|
957
|
+
reason: z10.string().optional()
|
|
803
958
|
});
|
|
804
|
-
var
|
|
959
|
+
var knowledgeArchivedEventSchema = z10.object({
|
|
805
960
|
...eventLedgerEnvelopeSchema,
|
|
806
|
-
event_type:
|
|
807
|
-
stable_id:
|
|
808
|
-
timestamp:
|
|
809
|
-
reason:
|
|
961
|
+
event_type: z10.literal("knowledge_archived"),
|
|
962
|
+
stable_id: z10.string().optional(),
|
|
963
|
+
timestamp: z10.string().datetime(),
|
|
964
|
+
reason: z10.string().optional()
|
|
810
965
|
});
|
|
811
|
-
var
|
|
966
|
+
var knowledgeArchiveAttemptedEventSchema = z10.object({
|
|
812
967
|
...eventLedgerEnvelopeSchema,
|
|
813
|
-
event_type:
|
|
814
|
-
stable_id:
|
|
815
|
-
timestamp:
|
|
816
|
-
reason:
|
|
817
|
-
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()
|
|
818
972
|
});
|
|
819
|
-
var
|
|
973
|
+
var knowledgeDeferredEventSchema = z10.object({
|
|
820
974
|
...eventLedgerEnvelopeSchema,
|
|
821
|
-
event_type:
|
|
822
|
-
stable_id:
|
|
823
|
-
timestamp:
|
|
824
|
-
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()
|
|
825
980
|
});
|
|
826
|
-
var
|
|
981
|
+
var knowledgeRejectedEventSchema = z10.object({
|
|
827
982
|
...eventLedgerEnvelopeSchema,
|
|
828
|
-
event_type:
|
|
829
|
-
stable_id:
|
|
830
|
-
|
|
831
|
-
|
|
983
|
+
event_type: z10.literal("knowledge_rejected"),
|
|
984
|
+
stable_id: z10.string().optional(),
|
|
985
|
+
timestamp: z10.string().datetime(),
|
|
986
|
+
reason: z10.string()
|
|
832
987
|
});
|
|
833
|
-
var
|
|
988
|
+
var knowledgeConsumedEventSchema = z10.object({
|
|
834
989
|
...eventLedgerEnvelopeSchema,
|
|
835
|
-
event_type:
|
|
836
|
-
stable_id:
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
});
|
|
842
|
-
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({
|
|
843
996
|
...eventLedgerEnvelopeSchema,
|
|
844
|
-
event_type:
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
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()
|
|
849
1003
|
});
|
|
850
|
-
var
|
|
1004
|
+
var doctorRunEventSchema = z10.object({
|
|
851
1005
|
...eventLedgerEnvelopeSchema,
|
|
852
|
-
event_type:
|
|
853
|
-
|
|
854
|
-
|
|
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()
|
|
855
1011
|
});
|
|
856
|
-
var
|
|
1012
|
+
var knowledgePathDangledEventSchema = z10.object({
|
|
857
1013
|
...eventLedgerEnvelopeSchema,
|
|
858
|
-
event_type:
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
touched_count: z9.number().int().nonnegative()
|
|
1014
|
+
event_type: z10.literal("knowledge_path_dangled"),
|
|
1015
|
+
stable_id: z10.string(),
|
|
1016
|
+
removed_glob: z10.string()
|
|
862
1017
|
});
|
|
863
|
-
var
|
|
1018
|
+
var relevanceMigrationRunEventSchema = z10.object({
|
|
864
1019
|
...eventLedgerEnvelopeSchema,
|
|
865
|
-
event_type:
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
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()
|
|
869
1024
|
});
|
|
870
|
-
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", [
|
|
871
1050
|
knowledgeContextPlannedEventSchema,
|
|
872
1051
|
knowledgeSelectionEventSchema,
|
|
873
1052
|
knowledgeSectionsFetchedEventSchema,
|
|
@@ -877,6 +1056,9 @@ var eventLedgerEventSchema = z9.discriminatedUnion("event_type", [
|
|
|
877
1056
|
reapplyCompletedEventSchema,
|
|
878
1057
|
eventLedgerTruncatedEventSchema,
|
|
879
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,
|
|
880
1062
|
metaReconciledOnStartupEventSchema,
|
|
881
1063
|
metaReconciledEventSchema,
|
|
882
1064
|
claudeSkillPathMigratedEventSchema,
|
|
@@ -909,13 +1091,23 @@ var eventLedgerEventSchema = z9.discriminatedUnion("event_type", [
|
|
|
909
1091
|
doctorRunEventSchema,
|
|
910
1092
|
// v2.0.0-rc.9 TASK-003 (A3): relevance_migration_run — emitted by
|
|
911
1093
|
// `doctor --apply-lint` after the lint #26 frontmatter back-fill pass.
|
|
912
|
-
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
|
|
913
1101
|
]);
|
|
914
1102
|
export {
|
|
915
1103
|
AGENTS_META_IDENTITY_SOURCES,
|
|
916
1104
|
AGENTS_META_LAYERS,
|
|
917
1105
|
AGENTS_META_TOPOLOGY_TYPES,
|
|
918
1106
|
AgentsMetaCountersSchema,
|
|
1107
|
+
BOOTSTRAP_CANONICAL,
|
|
1108
|
+
BOOTSTRAP_MARKER_BEGIN,
|
|
1109
|
+
BOOTSTRAP_MARKER_END,
|
|
1110
|
+
BOOTSTRAP_REGEX,
|
|
919
1111
|
FabExtractKnowledgeInputSchema,
|
|
920
1112
|
FabExtractKnowledgeInputShape,
|
|
921
1113
|
FabExtractKnowledgeOutputSchema,
|
|
@@ -927,6 +1119,9 @@ export {
|
|
|
927
1119
|
KNOWLEDGE_TYPE_CODES,
|
|
928
1120
|
KnowledgeEntryFrontmatterSchema,
|
|
929
1121
|
KnowledgeTypeSchema,
|
|
1122
|
+
LEGACY_KB_MARKER_BEGIN,
|
|
1123
|
+
LEGACY_KB_MARKER_END,
|
|
1124
|
+
LEGACY_KB_REGEX,
|
|
930
1125
|
LayerSchema,
|
|
931
1126
|
MaturitySchema,
|
|
932
1127
|
PROPOSED_REASON_DESCRIPTIONS,
|
|
@@ -941,8 +1136,11 @@ export {
|
|
|
941
1136
|
aiLedgerEntrySchema,
|
|
942
1137
|
allocateKnowledgeId,
|
|
943
1138
|
annotateIntentRequestSchema,
|
|
1139
|
+
assistantTurnObservedEventSchema,
|
|
944
1140
|
auditModeSchema,
|
|
1141
|
+
bootstrapMarkerMigratedEventSchema,
|
|
945
1142
|
candidateFileEntrySchema,
|
|
1143
|
+
citePolicyActivatedEventSchema,
|
|
946
1144
|
claudeHookPathMigratedEventSchema,
|
|
947
1145
|
claudeSkillPathMigratedEventSchema,
|
|
948
1146
|
clientPathsSchema,
|
|
@@ -981,6 +1179,8 @@ export {
|
|
|
981
1179
|
getKnowledgeAnnotations,
|
|
982
1180
|
getKnowledgeInputSchema,
|
|
983
1181
|
getKnowledgeOutputSchema,
|
|
1182
|
+
getPanelFieldByKey,
|
|
1183
|
+
getPanelFields,
|
|
984
1184
|
historyStateQuerySchema,
|
|
985
1185
|
humanLedgerEntrySchema,
|
|
986
1186
|
humanLockApproveRequestSchema,
|