@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.
@@ -6,7 +6,7 @@ import {
6
6
  enMessages,
7
7
  normalizeLocale,
8
8
  zhCNMessages
9
- } from "../chunk-WIH5HBKU.js";
9
+ } from "../chunk-VKCXD6CI.js";
10
10
  export {
11
11
  PROTECTED_TOKENS,
12
12
  createTranslator,
package/dist/index.d.ts CHANGED
@@ -4,6 +4,7 @@ export { Locale, Messages, PROTECTED_TOKENS, ProtectedToken, TranslationKey, Tra
4
4
  import { z } from 'zod';
5
5
  import { Layer, KnowledgeType, StableId } from './schemas/api-contracts.js';
6
6
  export { FabExtractKnowledgeInput, FabExtractKnowledgeInputSchema, FabExtractKnowledgeInputShape, FabExtractKnowledgeOutput, FabExtractKnowledgeOutputSchema, FabReviewInput, FabReviewInputSchema, FabReviewInputShape, FabReviewOutput, FabReviewOutputSchema, FabReviewOutputShape, KNOWLEDGE_TYPE_CODES, KnowledgeEntryFrontmatter, KnowledgeEntryFrontmatterSchema, KnowledgeTypeCode, KnowledgeTypeSchema, LayerSchema, Maturity, MaturitySchema, PROPOSED_REASON_DESCRIPTIONS, ProposedReason, ProposedReasonSchema, StableIdSchema, annotateIntentRequestSchema, fabExtractKnowledgeAnnotations, fabReviewAnnotations, formatKnowledgeId, getKnowledgeAnnotations, getKnowledgeInputSchema, getKnowledgeOutputSchema, historyStateQuerySchema, humanLockApproveRequestSchema, humanLockFileParamsSchema, knowledgeSectionsAnnotations, knowledgeSectionsInputSchema, knowledgeSectionsOutputSchema, ledgerQuerySchema, ledgerSourceSchema, parseKnowledgeId, planContextAnnotations, planContextHintNarrowEntrySchema, planContextHintOutputSchema, planContextInputSchema, planContextOutputSchema, structuredWarningSchema } from './schemas/api-contracts.js';
7
+ export { BOOTSTRAP_CANONICAL, BOOTSTRAP_MARKER_BEGIN, BOOTSTRAP_MARKER_END, BOOTSTRAP_REGEX, LEGACY_KB_MARKER_BEGIN, LEGACY_KB_MARKER_END, LEGACY_KB_REGEX } from './templates/bootstrap-canonical.js';
7
8
 
8
9
  declare const AGENTS_META_LAYERS: readonly ["L0", "L1", "L2"];
9
10
  declare const AGENTS_META_TOPOLOGY_TYPES: readonly ["mirror", "cross-cutting", "domain", "local", "global"];
@@ -1354,9 +1355,7 @@ declare const fabricConfigSchema: z.ZodObject<{
1354
1355
  cursor?: string | undefined;
1355
1356
  codexCLI?: string | undefined;
1356
1357
  }>>;
1357
- externalFixturePath: z.ZodOptional<z.ZodString>;
1358
1358
  scanIgnores: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
1359
- auditMode: z.ZodOptional<z.ZodEnum<["strict", "warn", "off"]>>;
1360
1359
  audit_mode: z.ZodOptional<z.ZodEnum<["strict", "warn", "off"]>>;
1361
1360
  mcpPayloadLimits: z.ZodOptional<z.ZodObject<{
1362
1361
  warnBytes: z.ZodOptional<z.ZodNumber>;
@@ -1415,9 +1414,7 @@ declare const fabricConfigSchema: z.ZodObject<{
1415
1414
  cursor?: string | undefined;
1416
1415
  codexCLI?: string | undefined;
1417
1416
  } | undefined;
1418
- externalFixturePath?: string | undefined;
1419
1417
  scanIgnores?: string[] | undefined;
1420
- auditMode?: "strict" | "warn" | "off" | undefined;
1421
1418
  audit_mode?: "strict" | "warn" | "off" | undefined;
1422
1419
  mcpPayloadLimits?: {
1423
1420
  warnBytes?: number | undefined;
@@ -1430,9 +1427,7 @@ declare const fabricConfigSchema: z.ZodObject<{
1430
1427
  cursor?: string | undefined;
1431
1428
  codexCLI?: string | undefined;
1432
1429
  } | undefined;
1433
- externalFixturePath?: string | undefined;
1434
1430
  scanIgnores?: string[] | undefined;
1435
- auditMode?: "strict" | "warn" | "off" | undefined;
1436
1431
  audit_mode?: "strict" | "warn" | "off" | undefined;
1437
1432
  mcpPayloadLimits?: {
1438
1433
  warnBytes?: number | undefined;
@@ -1460,6 +1455,46 @@ declare const fabricConfigSchema: z.ZodObject<{
1460
1455
  review_stale_pending_days?: number | undefined;
1461
1456
  }>;
1462
1457
 
1458
+ type FabricConfigSchemaShape = z.infer<typeof fabricConfigSchema>;
1459
+ type PanelFieldGroup = "A_locale" | "B_hint_threshold" | "C_audit";
1460
+ type ValidateResult = {
1461
+ ok: true;
1462
+ value: unknown;
1463
+ } | {
1464
+ ok: false;
1465
+ error: string;
1466
+ };
1467
+ interface PanelFieldMeta {
1468
+ /** Schema key this field edits — type-checked against the inferred config shape. */
1469
+ readonly key: keyof FabricConfigSchemaShape;
1470
+ /** Logical grouping for panel section headers. */
1471
+ readonly group: PanelFieldGroup;
1472
+ /** Clack widget hint — `select` for enums, `text` for free-form numbers. */
1473
+ readonly widget: "select" | "text";
1474
+ /** i18n key for the field label; strings landed in TASK-006. */
1475
+ readonly label_i18n_key: string;
1476
+ /** i18n key for the field's description / help text. */
1477
+ readonly description_i18n_key: string;
1478
+ /** Default value pulled from the Zod schema's `.default(...)`. */
1479
+ readonly default: string | number;
1480
+ /** Enum options for `select` widgets, derived from the Zod enum schema. */
1481
+ readonly enum_values?: readonly string[];
1482
+ /** Validates raw user input from the TUI prompt. */
1483
+ validate(raw: string): ValidateResult;
1484
+ /** Renders a stored value back to the panel display string. */
1485
+ format_for_display(value: unknown): string;
1486
+ }
1487
+ /**
1488
+ * Returns the per-field metadata array driving the `fab config` clack panel.
1489
+ * Group A (2) + Group B (8) + Group C (1) = 11 entries.
1490
+ */
1491
+ declare function getPanelFields(): readonly PanelFieldMeta[];
1492
+ /**
1493
+ * Lookup a single panel field by its config key. Returns `undefined` if the
1494
+ * key is not panel-scoped (e.g. Group D/E plumbing).
1495
+ */
1496
+ declare function getPanelFieldByKey(key: string): PanelFieldMeta | undefined;
1497
+
1463
1498
  interface ForensicCodeSample {
1464
1499
  path: string;
1465
1500
  lines: string;
@@ -2994,26 +3029,26 @@ declare const lockDriftEventSchema: z.ZodObject<{
2994
3029
  end_line: number;
2995
3030
  }>, "many">;
2996
3031
  }, "strip", z.ZodTypeAny, {
2997
- locked: {
3032
+ drifted: {
2998
3033
  file: string;
2999
3034
  hash: string;
3000
3035
  start_line: number;
3001
3036
  end_line: number;
3002
3037
  }[];
3003
- drifted: {
3038
+ locked: {
3004
3039
  file: string;
3005
3040
  hash: string;
3006
3041
  start_line: number;
3007
3042
  end_line: number;
3008
3043
  }[];
3009
3044
  }, {
3010
- locked: {
3045
+ drifted: {
3011
3046
  file: string;
3012
3047
  hash: string;
3013
3048
  start_line: number;
3014
3049
  end_line: number;
3015
3050
  }[];
3016
- drifted: {
3051
+ locked: {
3017
3052
  file: string;
3018
3053
  hash: string;
3019
3054
  start_line: number;
@@ -3023,13 +3058,13 @@ declare const lockDriftEventSchema: z.ZodObject<{
3023
3058
  }, "strip", z.ZodTypeAny, {
3024
3059
  type: "lock:drift";
3025
3060
  payload: {
3026
- locked: {
3061
+ drifted: {
3027
3062
  file: string;
3028
3063
  hash: string;
3029
3064
  start_line: number;
3030
3065
  end_line: number;
3031
3066
  }[];
3032
- drifted: {
3067
+ locked: {
3033
3068
  file: string;
3034
3069
  hash: string;
3035
3070
  start_line: number;
@@ -3039,13 +3074,13 @@ declare const lockDriftEventSchema: z.ZodObject<{
3039
3074
  }, {
3040
3075
  type: "lock:drift";
3041
3076
  payload: {
3042
- locked: {
3077
+ drifted: {
3043
3078
  file: string;
3044
3079
  hash: string;
3045
3080
  start_line: number;
3046
3081
  end_line: number;
3047
3082
  }[];
3048
- drifted: {
3083
+ locked: {
3049
3084
  file: string;
3050
3085
  hash: string;
3051
3086
  start_line: number;
@@ -4271,26 +4306,26 @@ declare const fabricEventSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
4271
4306
  end_line: number;
4272
4307
  }>, "many">;
4273
4308
  }, "strip", z.ZodTypeAny, {
4274
- locked: {
4309
+ drifted: {
4275
4310
  file: string;
4276
4311
  hash: string;
4277
4312
  start_line: number;
4278
4313
  end_line: number;
4279
4314
  }[];
4280
- drifted: {
4315
+ locked: {
4281
4316
  file: string;
4282
4317
  hash: string;
4283
4318
  start_line: number;
4284
4319
  end_line: number;
4285
4320
  }[];
4286
4321
  }, {
4287
- locked: {
4322
+ drifted: {
4288
4323
  file: string;
4289
4324
  hash: string;
4290
4325
  start_line: number;
4291
4326
  end_line: number;
4292
4327
  }[];
4293
- drifted: {
4328
+ locked: {
4294
4329
  file: string;
4295
4330
  hash: string;
4296
4331
  start_line: number;
@@ -4300,13 +4335,13 @@ declare const fabricEventSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
4300
4335
  }, "strip", z.ZodTypeAny, {
4301
4336
  type: "lock:drift";
4302
4337
  payload: {
4303
- locked: {
4338
+ drifted: {
4304
4339
  file: string;
4305
4340
  hash: string;
4306
4341
  start_line: number;
4307
4342
  end_line: number;
4308
4343
  }[];
4309
- drifted: {
4344
+ locked: {
4310
4345
  file: string;
4311
4346
  hash: string;
4312
4347
  start_line: number;
@@ -4316,13 +4351,13 @@ declare const fabricEventSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
4316
4351
  }, {
4317
4352
  type: "lock:drift";
4318
4353
  payload: {
4319
- locked: {
4354
+ drifted: {
4320
4355
  file: string;
4321
4356
  hash: string;
4322
4357
  start_line: number;
4323
4358
  end_line: number;
4324
4359
  }[];
4325
- drifted: {
4360
+ locked: {
4326
4361
  file: string;
4327
4362
  hash: string;
4328
4363
  start_line: number;
@@ -5356,6 +5391,46 @@ declare const mcpConfigMigratedEventSchema: z.ZodObject<{
5356
5391
  correlation_id?: string | undefined;
5357
5392
  session_id?: string | undefined;
5358
5393
  }>;
5394
+ declare const bootstrapMarkerMigratedEventSchema: z.ZodObject<{
5395
+ event_type: z.ZodLiteral<"bootstrap_marker_migrated">;
5396
+ path: z.ZodString;
5397
+ migrated_count: z.ZodNumber;
5398
+ legacy_marker: z.ZodLiteral<"fabric:knowledge-base">;
5399
+ new_marker: z.ZodLiteral<"fabric:bootstrap">;
5400
+ timestamp: z.ZodString;
5401
+ kind: z.ZodLiteral<"fabric-event">;
5402
+ id: z.ZodString;
5403
+ ts: z.ZodNumber;
5404
+ schema_version: z.ZodLiteral<1>;
5405
+ correlation_id: z.ZodOptional<z.ZodString>;
5406
+ session_id: z.ZodOptional<z.ZodString>;
5407
+ }, "strip", z.ZodTypeAny, {
5408
+ path: string;
5409
+ id: string;
5410
+ ts: number;
5411
+ schema_version: 1;
5412
+ kind: "fabric-event";
5413
+ event_type: "bootstrap_marker_migrated";
5414
+ migrated_count: number;
5415
+ legacy_marker: "fabric:knowledge-base";
5416
+ new_marker: "fabric:bootstrap";
5417
+ timestamp: string;
5418
+ correlation_id?: string | undefined;
5419
+ session_id?: string | undefined;
5420
+ }, {
5421
+ path: string;
5422
+ id: string;
5423
+ ts: number;
5424
+ schema_version: 1;
5425
+ kind: "fabric-event";
5426
+ event_type: "bootstrap_marker_migrated";
5427
+ migrated_count: number;
5428
+ legacy_marker: "fabric:knowledge-base";
5429
+ new_marker: "fabric:bootstrap";
5430
+ timestamp: string;
5431
+ correlation_id?: string | undefined;
5432
+ session_id?: string | undefined;
5433
+ }>;
5359
5434
  declare const metaReconciledOnStartupEventSchema: z.ZodObject<{
5360
5435
  event_type: z.ZodLiteral<"meta_reconciled_on_startup">;
5361
5436
  reconciled_files: z.ZodArray<z.ZodString, "many">;
@@ -5524,7 +5599,7 @@ declare const initScanCompletedEventSchema: z.ZodObject<{
5524
5599
  event_type: z.ZodLiteral<"init_scan_completed">;
5525
5600
  written_stable_ids: z.ZodArray<z.ZodString, "many">;
5526
5601
  duration_ms: z.ZodNumber;
5527
- source: z.ZodOptional<z.ZodEnum<["init", "scan", "doctor_fix"]>>;
5602
+ source: z.ZodOptional<z.ZodEnum<["init", "scan", "doctor_fix", "doctor-rescan"]>>;
5528
5603
  kind: z.ZodLiteral<"fabric-event">;
5529
5604
  id: z.ZodString;
5530
5605
  ts: z.ZodNumber;
@@ -5541,7 +5616,7 @@ declare const initScanCompletedEventSchema: z.ZodObject<{
5541
5616
  written_stable_ids: string[];
5542
5617
  correlation_id?: string | undefined;
5543
5618
  session_id?: string | undefined;
5544
- source?: "doctor_fix" | "init" | "scan" | undefined;
5619
+ source?: "doctor_fix" | "init" | "scan" | "doctor-rescan" | undefined;
5545
5620
  }, {
5546
5621
  id: string;
5547
5622
  ts: number;
@@ -5552,7 +5627,7 @@ declare const initScanCompletedEventSchema: z.ZodObject<{
5552
5627
  written_stable_ids: string[];
5553
5628
  correlation_id?: string | undefined;
5554
5629
  session_id?: string | undefined;
5555
- source?: "doctor_fix" | "init" | "scan" | undefined;
5630
+ source?: "doctor_fix" | "init" | "scan" | "doctor-rescan" | undefined;
5556
5631
  }>;
5557
5632
  declare const knowledgeProposedEventSchema: z.ZodObject<{
5558
5633
  event_type: z.ZodLiteral<"knowledge_proposed">;
@@ -6019,7 +6094,7 @@ declare const knowledgeScopeDegradedEventSchema: z.ZodObject<{
6019
6094
  }>;
6020
6095
  declare const doctorRunEventSchema: z.ZodObject<{
6021
6096
  event_type: z.ZodLiteral<"doctor_run">;
6022
- mode: z.ZodEnum<["lint", "apply-lint"]>;
6097
+ mode: z.ZodEnum<["lint", "fix-knowledge"]>;
6023
6098
  issues: z.ZodNumber;
6024
6099
  mutations: z.ZodOptional<z.ZodNumber>;
6025
6100
  timestamp: z.ZodString;
@@ -6037,7 +6112,7 @@ declare const doctorRunEventSchema: z.ZodObject<{
6037
6112
  kind: "fabric-event";
6038
6113
  event_type: "doctor_run";
6039
6114
  timestamp: string;
6040
- mode: "lint" | "apply-lint";
6115
+ mode: "lint" | "fix-knowledge";
6041
6116
  correlation_id?: string | undefined;
6042
6117
  session_id?: string | undefined;
6043
6118
  mutations?: number | undefined;
@@ -6049,7 +6124,7 @@ declare const doctorRunEventSchema: z.ZodObject<{
6049
6124
  kind: "fabric-event";
6050
6125
  event_type: "doctor_run";
6051
6126
  timestamp: string;
6052
- mode: "lint" | "apply-lint";
6127
+ mode: "lint" | "fix-knowledge";
6053
6128
  correlation_id?: string | undefined;
6054
6129
  session_id?: string | undefined;
6055
6130
  mutations?: number | undefined;
@@ -6153,6 +6228,83 @@ declare const pendingAutoArchivedEventSchema: z.ZodObject<{
6153
6228
  correlation_id?: string | undefined;
6154
6229
  session_id?: string | undefined;
6155
6230
  }>;
6231
+ declare const assistantTurnObservedEventSchema: z.ZodObject<{
6232
+ event_type: z.ZodLiteral<"assistant_turn_observed">;
6233
+ kb_line_raw: z.ZodNullable<z.ZodString>;
6234
+ cite_ids: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
6235
+ cite_tags: z.ZodDefault<z.ZodArray<z.ZodEnum<["planned", "recalled", "chained-from", "dismissed", "none"]>, "many">>;
6236
+ client: z.ZodOptional<z.ZodEnum<["cc", "codex", "cursor"]>>;
6237
+ turn_id: z.ZodString;
6238
+ envelope_index: z.ZodOptional<z.ZodNumber>;
6239
+ timestamp: z.ZodString;
6240
+ kind: z.ZodLiteral<"fabric-event">;
6241
+ id: z.ZodString;
6242
+ ts: z.ZodNumber;
6243
+ schema_version: z.ZodLiteral<1>;
6244
+ correlation_id: z.ZodOptional<z.ZodString>;
6245
+ session_id: z.ZodOptional<z.ZodString>;
6246
+ }, "strip", z.ZodTypeAny, {
6247
+ id: string;
6248
+ ts: number;
6249
+ schema_version: 1;
6250
+ kind: "fabric-event";
6251
+ event_type: "assistant_turn_observed";
6252
+ timestamp: string;
6253
+ kb_line_raw: string | null;
6254
+ cite_ids: string[];
6255
+ cite_tags: ("none" | "planned" | "recalled" | "chained-from" | "dismissed")[];
6256
+ turn_id: string;
6257
+ correlation_id?: string | undefined;
6258
+ session_id?: string | undefined;
6259
+ client?: "cursor" | "cc" | "codex" | undefined;
6260
+ envelope_index?: number | undefined;
6261
+ }, {
6262
+ id: string;
6263
+ ts: number;
6264
+ schema_version: 1;
6265
+ kind: "fabric-event";
6266
+ event_type: "assistant_turn_observed";
6267
+ timestamp: string;
6268
+ kb_line_raw: string | null;
6269
+ turn_id: string;
6270
+ correlation_id?: string | undefined;
6271
+ session_id?: string | undefined;
6272
+ cite_ids?: string[] | undefined;
6273
+ cite_tags?: ("none" | "planned" | "recalled" | "chained-from" | "dismissed")[] | undefined;
6274
+ client?: "cursor" | "cc" | "codex" | undefined;
6275
+ envelope_index?: number | undefined;
6276
+ }>;
6277
+ declare const citePolicyActivatedEventSchema: z.ZodObject<{
6278
+ event_type: z.ZodLiteral<"cite_policy_activated">;
6279
+ policy_version: z.ZodString;
6280
+ timestamp: z.ZodString;
6281
+ kind: z.ZodLiteral<"fabric-event">;
6282
+ id: z.ZodString;
6283
+ ts: z.ZodNumber;
6284
+ schema_version: z.ZodLiteral<1>;
6285
+ correlation_id: z.ZodOptional<z.ZodString>;
6286
+ session_id: z.ZodOptional<z.ZodString>;
6287
+ }, "strip", z.ZodTypeAny, {
6288
+ id: string;
6289
+ ts: number;
6290
+ schema_version: 1;
6291
+ kind: "fabric-event";
6292
+ event_type: "cite_policy_activated";
6293
+ timestamp: string;
6294
+ policy_version: string;
6295
+ correlation_id?: string | undefined;
6296
+ session_id?: string | undefined;
6297
+ }, {
6298
+ id: string;
6299
+ ts: number;
6300
+ schema_version: 1;
6301
+ kind: "fabric-event";
6302
+ event_type: "cite_policy_activated";
6303
+ timestamp: string;
6304
+ policy_version: string;
6305
+ correlation_id?: string | undefined;
6306
+ session_id?: string | undefined;
6307
+ }>;
6156
6308
  declare const eventLedgerEventSchema: z.ZodDiscriminatedUnion<"event_type", [z.ZodObject<{
6157
6309
  event_type: z.ZodLiteral<"knowledge_context_planned">;
6158
6310
  target_paths: z.ZodArray<z.ZodString, "many">;
@@ -6550,6 +6702,45 @@ declare const eventLedgerEventSchema: z.ZodDiscriminatedUnion<"event_type", [z.Z
6550
6702
  removed_from: string;
6551
6703
  correlation_id?: string | undefined;
6552
6704
  session_id?: string | undefined;
6705
+ }>, z.ZodObject<{
6706
+ event_type: z.ZodLiteral<"bootstrap_marker_migrated">;
6707
+ path: z.ZodString;
6708
+ migrated_count: z.ZodNumber;
6709
+ legacy_marker: z.ZodLiteral<"fabric:knowledge-base">;
6710
+ new_marker: z.ZodLiteral<"fabric:bootstrap">;
6711
+ timestamp: z.ZodString;
6712
+ kind: z.ZodLiteral<"fabric-event">;
6713
+ id: z.ZodString;
6714
+ ts: z.ZodNumber;
6715
+ schema_version: z.ZodLiteral<1>;
6716
+ correlation_id: z.ZodOptional<z.ZodString>;
6717
+ session_id: z.ZodOptional<z.ZodString>;
6718
+ }, "strip", z.ZodTypeAny, {
6719
+ path: string;
6720
+ id: string;
6721
+ ts: number;
6722
+ schema_version: 1;
6723
+ kind: "fabric-event";
6724
+ event_type: "bootstrap_marker_migrated";
6725
+ migrated_count: number;
6726
+ legacy_marker: "fabric:knowledge-base";
6727
+ new_marker: "fabric:bootstrap";
6728
+ timestamp: string;
6729
+ correlation_id?: string | undefined;
6730
+ session_id?: string | undefined;
6731
+ }, {
6732
+ path: string;
6733
+ id: string;
6734
+ ts: number;
6735
+ schema_version: 1;
6736
+ kind: "fabric-event";
6737
+ event_type: "bootstrap_marker_migrated";
6738
+ migrated_count: number;
6739
+ legacy_marker: "fabric:knowledge-base";
6740
+ new_marker: "fabric:bootstrap";
6741
+ timestamp: string;
6742
+ correlation_id?: string | undefined;
6743
+ session_id?: string | undefined;
6553
6744
  }>, z.ZodObject<{
6554
6745
  event_type: z.ZodLiteral<"meta_reconciled_on_startup">;
6555
6746
  reconciled_files: z.ZodArray<z.ZodString, "many">;
@@ -6713,7 +6904,7 @@ declare const eventLedgerEventSchema: z.ZodDiscriminatedUnion<"event_type", [z.Z
6713
6904
  event_type: z.ZodLiteral<"init_scan_completed">;
6714
6905
  written_stable_ids: z.ZodArray<z.ZodString, "many">;
6715
6906
  duration_ms: z.ZodNumber;
6716
- source: z.ZodOptional<z.ZodEnum<["init", "scan", "doctor_fix"]>>;
6907
+ source: z.ZodOptional<z.ZodEnum<["init", "scan", "doctor_fix", "doctor-rescan"]>>;
6717
6908
  kind: z.ZodLiteral<"fabric-event">;
6718
6909
  id: z.ZodString;
6719
6910
  ts: z.ZodNumber;
@@ -6730,7 +6921,7 @@ declare const eventLedgerEventSchema: z.ZodDiscriminatedUnion<"event_type", [z.Z
6730
6921
  written_stable_ids: string[];
6731
6922
  correlation_id?: string | undefined;
6732
6923
  session_id?: string | undefined;
6733
- source?: "doctor_fix" | "init" | "scan" | undefined;
6924
+ source?: "doctor_fix" | "init" | "scan" | "doctor-rescan" | undefined;
6734
6925
  }, {
6735
6926
  id: string;
6736
6927
  ts: number;
@@ -6741,7 +6932,7 @@ declare const eventLedgerEventSchema: z.ZodDiscriminatedUnion<"event_type", [z.Z
6741
6932
  written_stable_ids: string[];
6742
6933
  correlation_id?: string | undefined;
6743
6934
  session_id?: string | undefined;
6744
- source?: "doctor_fix" | "init" | "scan" | undefined;
6935
+ source?: "doctor_fix" | "init" | "scan" | "doctor-rescan" | undefined;
6745
6936
  }>, z.ZodObject<{
6746
6937
  event_type: z.ZodLiteral<"knowledge_proposed">;
6747
6938
  stable_id: z.ZodOptional<z.ZodString>;
@@ -7257,7 +7448,7 @@ declare const eventLedgerEventSchema: z.ZodDiscriminatedUnion<"event_type", [z.Z
7257
7448
  session_id?: string | undefined;
7258
7449
  }>, z.ZodObject<{
7259
7450
  event_type: z.ZodLiteral<"doctor_run">;
7260
- mode: z.ZodEnum<["lint", "apply-lint"]>;
7451
+ mode: z.ZodEnum<["lint", "fix-knowledge"]>;
7261
7452
  issues: z.ZodNumber;
7262
7453
  mutations: z.ZodOptional<z.ZodNumber>;
7263
7454
  timestamp: z.ZodString;
@@ -7275,7 +7466,7 @@ declare const eventLedgerEventSchema: z.ZodDiscriminatedUnion<"event_type", [z.Z
7275
7466
  kind: "fabric-event";
7276
7467
  event_type: "doctor_run";
7277
7468
  timestamp: string;
7278
- mode: "lint" | "apply-lint";
7469
+ mode: "lint" | "fix-knowledge";
7279
7470
  correlation_id?: string | undefined;
7280
7471
  session_id?: string | undefined;
7281
7472
  mutations?: number | undefined;
@@ -7287,7 +7478,7 @@ declare const eventLedgerEventSchema: z.ZodDiscriminatedUnion<"event_type", [z.Z
7287
7478
  kind: "fabric-event";
7288
7479
  event_type: "doctor_run";
7289
7480
  timestamp: string;
7290
- mode: "lint" | "apply-lint";
7481
+ mode: "lint" | "fix-knowledge";
7291
7482
  correlation_id?: string | undefined;
7292
7483
  session_id?: string | undefined;
7293
7484
  mutations?: number | undefined;
@@ -7324,6 +7515,81 @@ declare const eventLedgerEventSchema: z.ZodDiscriminatedUnion<"event_type", [z.Z
7324
7515
  touched_count: number;
7325
7516
  correlation_id?: string | undefined;
7326
7517
  session_id?: string | undefined;
7518
+ }>, z.ZodObject<{
7519
+ event_type: z.ZodLiteral<"assistant_turn_observed">;
7520
+ kb_line_raw: z.ZodNullable<z.ZodString>;
7521
+ cite_ids: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
7522
+ cite_tags: z.ZodDefault<z.ZodArray<z.ZodEnum<["planned", "recalled", "chained-from", "dismissed", "none"]>, "many">>;
7523
+ client: z.ZodOptional<z.ZodEnum<["cc", "codex", "cursor"]>>;
7524
+ turn_id: z.ZodString;
7525
+ envelope_index: z.ZodOptional<z.ZodNumber>;
7526
+ timestamp: z.ZodString;
7527
+ kind: z.ZodLiteral<"fabric-event">;
7528
+ id: z.ZodString;
7529
+ ts: z.ZodNumber;
7530
+ schema_version: z.ZodLiteral<1>;
7531
+ correlation_id: z.ZodOptional<z.ZodString>;
7532
+ session_id: z.ZodOptional<z.ZodString>;
7533
+ }, "strip", z.ZodTypeAny, {
7534
+ id: string;
7535
+ ts: number;
7536
+ schema_version: 1;
7537
+ kind: "fabric-event";
7538
+ event_type: "assistant_turn_observed";
7539
+ timestamp: string;
7540
+ kb_line_raw: string | null;
7541
+ cite_ids: string[];
7542
+ cite_tags: ("none" | "planned" | "recalled" | "chained-from" | "dismissed")[];
7543
+ turn_id: string;
7544
+ correlation_id?: string | undefined;
7545
+ session_id?: string | undefined;
7546
+ client?: "cursor" | "cc" | "codex" | undefined;
7547
+ envelope_index?: number | undefined;
7548
+ }, {
7549
+ id: string;
7550
+ ts: number;
7551
+ schema_version: 1;
7552
+ kind: "fabric-event";
7553
+ event_type: "assistant_turn_observed";
7554
+ timestamp: string;
7555
+ kb_line_raw: string | null;
7556
+ turn_id: string;
7557
+ correlation_id?: string | undefined;
7558
+ session_id?: string | undefined;
7559
+ cite_ids?: string[] | undefined;
7560
+ cite_tags?: ("none" | "planned" | "recalled" | "chained-from" | "dismissed")[] | undefined;
7561
+ client?: "cursor" | "cc" | "codex" | undefined;
7562
+ envelope_index?: number | undefined;
7563
+ }>, z.ZodObject<{
7564
+ event_type: z.ZodLiteral<"cite_policy_activated">;
7565
+ policy_version: z.ZodString;
7566
+ timestamp: z.ZodString;
7567
+ kind: z.ZodLiteral<"fabric-event">;
7568
+ id: z.ZodString;
7569
+ ts: z.ZodNumber;
7570
+ schema_version: z.ZodLiteral<1>;
7571
+ correlation_id: z.ZodOptional<z.ZodString>;
7572
+ session_id: z.ZodOptional<z.ZodString>;
7573
+ }, "strip", z.ZodTypeAny, {
7574
+ id: string;
7575
+ ts: number;
7576
+ schema_version: 1;
7577
+ kind: "fabric-event";
7578
+ event_type: "cite_policy_activated";
7579
+ timestamp: string;
7580
+ policy_version: string;
7581
+ correlation_id?: string | undefined;
7582
+ session_id?: string | undefined;
7583
+ }, {
7584
+ id: string;
7585
+ ts: number;
7586
+ schema_version: 1;
7587
+ kind: "fabric-event";
7588
+ event_type: "cite_policy_activated";
7589
+ timestamp: string;
7590
+ policy_version: string;
7591
+ correlation_id?: string | undefined;
7592
+ session_id?: string | undefined;
7327
7593
  }>]>;
7328
7594
  type KnowledgeContextPlannedEvent = z.infer<typeof knowledgeContextPlannedEventSchema>;
7329
7595
  type KnowledgeSelectionEvent = z.infer<typeof knowledgeSelectionEventSchema>;
@@ -7334,6 +7600,7 @@ type McpEventLedgerEvent = z.infer<typeof mcpEventLedgerEventSchema>;
7334
7600
  type ReapplyCompletedEvent = z.infer<typeof reapplyCompletedEventSchema>;
7335
7601
  type EventLedgerTruncatedEvent = z.infer<typeof eventLedgerTruncatedEventSchema>;
7336
7602
  type McpConfigMigratedEvent = z.infer<typeof mcpConfigMigratedEventSchema>;
7603
+ type BootstrapMarkerMigratedEvent = z.infer<typeof bootstrapMarkerMigratedEventSchema>;
7337
7604
  type MetaReconciledOnStartupEvent = z.infer<typeof metaReconciledOnStartupEventSchema>;
7338
7605
  type MetaReconciledEvent = z.infer<typeof metaReconciledEventSchema>;
7339
7606
  type ClaudeSkillPathMigratedEvent = z.infer<typeof claudeSkillPathMigratedEventSchema>;
@@ -7357,9 +7624,11 @@ type PendingAutoArchivedEvent = z.infer<typeof pendingAutoArchivedEventSchema>;
7357
7624
  type KnowledgePathDangledEvent = z.infer<typeof knowledgePathDangledEventSchema>;
7358
7625
  type DoctorRunEvent = z.infer<typeof doctorRunEventSchema>;
7359
7626
  type RelevanceMigrationRunEvent = z.infer<typeof relevanceMigrationRunEventSchema>;
7360
- type EventLedgerEvent = KnowledgeContextPlannedEvent | KnowledgeSelectionEvent | KnowledgeSectionsFetchedEvent | EditIntentCheckedEvent | KnowledgeDriftDetectedEvent | McpEventLedgerEvent | ReapplyCompletedEvent | EventLedgerTruncatedEvent | McpConfigMigratedEvent | MetaReconciledOnStartupEvent | MetaReconciledEvent | ClaudeSkillPathMigratedEvent | ClaudeHookPathMigratedEvent | CodexSkillPathMigratedEvent | InitScanCompletedEvent | KnowledgeProposedEvent | KnowledgePromoteStartedEvent | KnowledgePromotedEvent | KnowledgePromoteFailedEvent | KnowledgeLayerChangedEvent | KnowledgeSlugRenamedEvent | KnowledgeDemotedEvent | KnowledgeArchivedEvent | KnowledgeArchiveAttemptedEvent | KnowledgeDeferredEvent | KnowledgeRejectedEvent | KnowledgeConsumedEvent | KnowledgeScopeDegradedEvent | PendingAutoArchivedEvent | KnowledgePathDangledEvent | DoctorRunEvent | RelevanceMigrationRunEvent;
7627
+ type AssistantTurnObservedEvent = z.infer<typeof assistantTurnObservedEventSchema>;
7628
+ type CitePolicyActivatedEvent = z.infer<typeof citePolicyActivatedEventSchema>;
7629
+ type EventLedgerEvent = KnowledgeContextPlannedEvent | KnowledgeSelectionEvent | KnowledgeSectionsFetchedEvent | EditIntentCheckedEvent | KnowledgeDriftDetectedEvent | McpEventLedgerEvent | ReapplyCompletedEvent | EventLedgerTruncatedEvent | McpConfigMigratedEvent | BootstrapMarkerMigratedEvent | MetaReconciledOnStartupEvent | MetaReconciledEvent | ClaudeSkillPathMigratedEvent | ClaudeHookPathMigratedEvent | CodexSkillPathMigratedEvent | InitScanCompletedEvent | KnowledgeProposedEvent | KnowledgePromoteStartedEvent | KnowledgePromotedEvent | KnowledgePromoteFailedEvent | KnowledgeLayerChangedEvent | KnowledgeSlugRenamedEvent | KnowledgeDemotedEvent | KnowledgeArchivedEvent | KnowledgeArchiveAttemptedEvent | KnowledgeDeferredEvent | KnowledgeRejectedEvent | KnowledgeConsumedEvent | KnowledgeScopeDegradedEvent | PendingAutoArchivedEvent | KnowledgePathDangledEvent | DoctorRunEvent | RelevanceMigrationRunEvent | AssistantTurnObservedEvent | CitePolicyActivatedEvent;
7361
7630
  type EventLedgerEventType = EventLedgerEvent["event_type"];
7362
7631
  type EventLedgerEventInputFor<T extends EventLedgerEvent> = T extends EventLedgerEvent ? Omit<T, "kind" | "id" | "ts" | "schema_version" | "correlation_id" | "session_id"> & Partial<Pick<T, "id" | "ts" | "correlation_id" | "session_id">> : never;
7363
7632
  type EventLedgerEventInput = EventLedgerEventInputFor<EventLedgerEvent>;
7364
7633
 
7365
- export { AGENTS_META_IDENTITY_SOURCES, AGENTS_META_LAYERS, AGENTS_META_TOPOLOGY_TYPES, AgentsIdentitySource, AgentsLayer, AgentsMeta, type AgentsMetaCounters, AgentsMetaCountersSchema, AgentsMetaNode, AgentsTopologyType, type CandidateFileEntry, type CandidateFileFamily, type ClaudeHookPathMigratedEvent, type ClaudeSkillPathMigratedEvent, type CodexSkillPathMigratedEvent, type DoctorRunEvent, type DriftDetectedEvent, type EditIntentCheckedEvent, type EventLedgerEvent, type EventLedgerEventInput, type EventLedgerEventType, type EventLedgerTruncatedEvent, type FabricEvent, type ForensicAssertion, type ForensicAssertionConfidence, type ForensicAssertionCoverage, type ForensicAssertionType, type ForensicCodeSample, type ForensicEntryPoint, type ForensicEvidenceAnchor, type ForensicFramework, type ForensicReadme, type ForensicReport, type ForensicSamplingBudget, type ForensicTopology, HumanLockEntry, type HumanLockFile, type InitContext, type InitContextDomainGroup, type InitContextFramework, type InitContextInterviewTrailEntry, type InitContextInvariant, type InitContextInvariantConfidenceSnapshot, type InitContextSourceEvidence, type InitScanCompletedEvent, KNOWLEDGE_TEST_INDEX_SCHEMA_VERSION, type KnowledgeArchiveAttemptedEvent, type KnowledgeArchivedEvent, type KnowledgeConsumedEvent, type KnowledgeContextPlannedEvent, type KnowledgeDeferredEvent, type KnowledgeDemotedEvent, type KnowledgeDriftDetectedEvent, type KnowledgeLayerChangedEvent, type KnowledgePathDangledEvent, type KnowledgePromoteFailedEvent, type KnowledgePromoteStartedEvent, type KnowledgePromotedEvent, type KnowledgeProposedEvent, type KnowledgeRejectedEvent, type KnowledgeScopeDegradedEvent, type KnowledgeSectionsFetchedEvent, type KnowledgeSelectionEvent, type KnowledgeSlugRenamedEvent, type KnowledgeTestIndex, type KnowledgeTestLink, type KnowledgeTestOrphanAnnotation, KnowledgeType, Layer, type LedgerAppendedEvent, LedgerEntry, type LockApprovedEvent, type LockDriftEvent, type McpConfigMigratedEvent, type McpEventLedgerEvent, type MetaReconciledEvent, type MetaReconciledOnStartupEvent, type MetaUpdatedEvent, type PendingAutoArchivedEvent, type ReapplyCompletedEvent, type RelevanceMigrationRunEvent, StableId, agentsIdentitySourceSchema, agentsLayerSchema, agentsMetaNodeSchema, agentsMetaSchema, agentsTopologyTypeSchema, aiLedgerEntrySchema, allocateKnowledgeId, auditModeSchema, candidateFileEntrySchema, claudeHookPathMigratedEventSchema, claudeSkillPathMigratedEventSchema, clientPathsSchema, codexSkillPathMigratedEventSchema, defaultAgentsMetaCounters, defaultLayerFilterSchema, deriveAgentsMetaIdentitySource, deriveAgentsMetaLayer, deriveAgentsMetaStableId, deriveAgentsMetaTopologyType, doctorRunEventSchema, driftDetectedEventSchema, editIntentCheckedEventSchema, eventLedgerEventSchema, eventLedgerTruncatedEventSchema, fabricConfigSchema, fabricEventSchema, fabricLanguageSchema, forensicAssertionCoverageSchema, forensicAssertionSchema, forensicCodeSampleSchema, forensicEntryPointSchema, forensicEvidenceAnchorSchema, forensicFrameworkSchema, forensicReadmeSchema, forensicReportSchema, forensicSamplingBudgetSchema, forensicTopologySchema, humanLedgerEntrySchema, humanLockEntrySchema, humanLockFileSchema, initContextDomainGroupSchema, initContextFrameworkSchema, initContextInterviewTrailEntrySchema, initContextInvariantConfidenceSnapshotSchema, initContextInvariantSchema, initContextSchema, initContextSourceEvidenceSchema, initScanCompletedEventSchema, isKnowledgeStableId, knowledgeArchiveAttemptedEventSchema, knowledgeArchivedEventSchema, knowledgeConsumedEventSchema, knowledgeContextPlannedEventSchema, knowledgeDeferredEventSchema, knowledgeDemotedEventSchema, knowledgeDriftDetectedEventSchema, knowledgeLayerChangedEventSchema, knowledgePathDangledEventSchema, knowledgePromoteFailedEventSchema, knowledgePromoteStartedEventSchema, knowledgePromotedEventSchema, knowledgeProposedEventSchema, knowledgeRejectedEventSchema, knowledgeScopeDegradedEventSchema, knowledgeSectionsFetchedEventSchema, knowledgeSelectionEventSchema, knowledgeSlugRenamedEventSchema, knowledgeTestIndexSchema, knowledgeTestLinkSchema, knowledgeTestOrphanAnnotationSchema, ledgerAppendedEventSchema, ledgerEntrySchema, lockApprovedEventSchema, lockDriftEventSchema, mcpConfigMigratedEventSchema, mcpEventLedgerEventSchema, mcpPayloadLimitsSchema, metaReconciledEventSchema, metaReconciledOnStartupEventSchema, metaUpdatedEventSchema, pendingAutoArchivedEventSchema, reapplyCompletedEventSchema, relevanceMigrationRunEventSchema, ruleDescriptionIndexItemSchema, ruleDescriptionSchema, withDerivedAgentsMetaNodeDefaults };
7634
+ export { AGENTS_META_IDENTITY_SOURCES, AGENTS_META_LAYERS, AGENTS_META_TOPOLOGY_TYPES, AgentsIdentitySource, AgentsLayer, AgentsMeta, type AgentsMetaCounters, AgentsMetaCountersSchema, AgentsMetaNode, AgentsTopologyType, type AssistantTurnObservedEvent, type BootstrapMarkerMigratedEvent, type CandidateFileEntry, type CandidateFileFamily, type CitePolicyActivatedEvent, type ClaudeHookPathMigratedEvent, type ClaudeSkillPathMigratedEvent, type CodexSkillPathMigratedEvent, type DoctorRunEvent, type DriftDetectedEvent, type EditIntentCheckedEvent, type EventLedgerEvent, type EventLedgerEventInput, type EventLedgerEventType, type EventLedgerTruncatedEvent, type FabricConfigSchemaShape, type FabricEvent, type ForensicAssertion, type ForensicAssertionConfidence, type ForensicAssertionCoverage, type ForensicAssertionType, type ForensicCodeSample, type ForensicEntryPoint, type ForensicEvidenceAnchor, type ForensicFramework, type ForensicReadme, type ForensicReport, type ForensicSamplingBudget, type ForensicTopology, HumanLockEntry, type HumanLockFile, type InitContext, type InitContextDomainGroup, type InitContextFramework, type InitContextInterviewTrailEntry, type InitContextInvariant, type InitContextInvariantConfidenceSnapshot, type InitContextSourceEvidence, type InitScanCompletedEvent, KNOWLEDGE_TEST_INDEX_SCHEMA_VERSION, type KnowledgeArchiveAttemptedEvent, type KnowledgeArchivedEvent, type KnowledgeConsumedEvent, type KnowledgeContextPlannedEvent, type KnowledgeDeferredEvent, type KnowledgeDemotedEvent, type KnowledgeDriftDetectedEvent, type KnowledgeLayerChangedEvent, type KnowledgePathDangledEvent, type KnowledgePromoteFailedEvent, type KnowledgePromoteStartedEvent, type KnowledgePromotedEvent, type KnowledgeProposedEvent, type KnowledgeRejectedEvent, type KnowledgeScopeDegradedEvent, type KnowledgeSectionsFetchedEvent, type KnowledgeSelectionEvent, type KnowledgeSlugRenamedEvent, type KnowledgeTestIndex, type KnowledgeTestLink, type KnowledgeTestOrphanAnnotation, KnowledgeType, Layer, type LedgerAppendedEvent, LedgerEntry, type LockApprovedEvent, type LockDriftEvent, type McpConfigMigratedEvent, type McpEventLedgerEvent, type MetaReconciledEvent, type MetaReconciledOnStartupEvent, type MetaUpdatedEvent, type PanelFieldGroup, type PanelFieldMeta, type PendingAutoArchivedEvent, type ReapplyCompletedEvent, type RelevanceMigrationRunEvent, StableId, type ValidateResult, agentsIdentitySourceSchema, agentsLayerSchema, agentsMetaNodeSchema, agentsMetaSchema, agentsTopologyTypeSchema, aiLedgerEntrySchema, allocateKnowledgeId, assistantTurnObservedEventSchema, auditModeSchema, bootstrapMarkerMigratedEventSchema, candidateFileEntrySchema, citePolicyActivatedEventSchema, claudeHookPathMigratedEventSchema, claudeSkillPathMigratedEventSchema, clientPathsSchema, codexSkillPathMigratedEventSchema, defaultAgentsMetaCounters, defaultLayerFilterSchema, deriveAgentsMetaIdentitySource, deriveAgentsMetaLayer, deriveAgentsMetaStableId, deriveAgentsMetaTopologyType, doctorRunEventSchema, driftDetectedEventSchema, editIntentCheckedEventSchema, eventLedgerEventSchema, eventLedgerTruncatedEventSchema, fabricConfigSchema, fabricEventSchema, fabricLanguageSchema, forensicAssertionCoverageSchema, forensicAssertionSchema, forensicCodeSampleSchema, forensicEntryPointSchema, forensicEvidenceAnchorSchema, forensicFrameworkSchema, forensicReadmeSchema, forensicReportSchema, forensicSamplingBudgetSchema, forensicTopologySchema, getPanelFieldByKey, getPanelFields, humanLedgerEntrySchema, humanLockEntrySchema, humanLockFileSchema, initContextDomainGroupSchema, initContextFrameworkSchema, initContextInterviewTrailEntrySchema, initContextInvariantConfidenceSnapshotSchema, initContextInvariantSchema, initContextSchema, initContextSourceEvidenceSchema, initScanCompletedEventSchema, isKnowledgeStableId, knowledgeArchiveAttemptedEventSchema, knowledgeArchivedEventSchema, knowledgeConsumedEventSchema, knowledgeContextPlannedEventSchema, knowledgeDeferredEventSchema, knowledgeDemotedEventSchema, knowledgeDriftDetectedEventSchema, knowledgeLayerChangedEventSchema, knowledgePathDangledEventSchema, knowledgePromoteFailedEventSchema, knowledgePromoteStartedEventSchema, knowledgePromotedEventSchema, knowledgeProposedEventSchema, knowledgeRejectedEventSchema, knowledgeScopeDegradedEventSchema, knowledgeSectionsFetchedEventSchema, knowledgeSelectionEventSchema, knowledgeSlugRenamedEventSchema, knowledgeTestIndexSchema, knowledgeTestLinkSchema, knowledgeTestOrphanAnnotationSchema, ledgerAppendedEventSchema, ledgerEntrySchema, lockApprovedEventSchema, lockDriftEventSchema, mcpConfigMigratedEventSchema, mcpEventLedgerEventSchema, mcpPayloadLimitsSchema, metaReconciledEventSchema, metaReconciledOnStartupEventSchema, metaUpdatedEventSchema, pendingAutoArchivedEventSchema, reapplyCompletedEventSchema, relevanceMigrationRunEventSchema, ruleDescriptionIndexItemSchema, ruleDescriptionSchema, withDerivedAgentsMetaNodeDefaults };