@fenglimg/fabric-shared 2.0.0-rc.23 → 2.0.0-rc.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -10,6 +10,26 @@ declare function createTranslator(locale: Locale, messages?: Record<Locale, Mess
10
10
 
11
11
  declare function detectNodeLocale(): Locale;
12
12
 
13
+ /**
14
+ * Resolve the effective runtime locale for a given project root.
15
+ *
16
+ * Resolution order (rc.26 — closes KT-DEC-9004 runtime gap):
17
+ * 1. Read `<projectRoot>/.fabric/fabric-config.json` and inspect
18
+ * `fabric_language`.
19
+ * 2. If the value is `"en"` or `"zh-CN"` (the two concrete Locale members),
20
+ * return it verbatim — this is the eager-resolved value `fab init` is
21
+ * supposed to write back per KT-DEC-9004.
22
+ * 3. If the value is `"match-existing"` or `"zh-CN-hybrid"` (placeholders
23
+ * that should NEVER survive `fab init` per KT-DEC-9004's invariant),
24
+ * emit a `console.warn` and fall through to `detectNodeLocale()`.
25
+ * 4. If the file is missing, unreadable, malformed JSON, or `fabric_language`
26
+ * is absent / has any other shape, silently fall through to
27
+ * `detectNodeLocale()` (env-driven: `FAB_LANG` → `LANG` → `"en"`).
28
+ *
29
+ * Never throws — all failure paths degrade to `detectNodeLocale()`.
30
+ */
31
+ declare function resolveFabricLocale(projectRoot: string): Locale;
32
+
13
33
  declare function normalizeLocale(raw: string | null | undefined): Locale;
14
34
 
15
35
  declare const PROTECTED_TOKENS: readonly ["fab_plan_context", "fab_get_knowledge_sections", "fab_extract_knowledge", "fab_review", "AGENTS.md", ".fabric/agents/", ".fabric/agents/_cross/", ".fabric/agents.meta.json", ".fabric/human-lock.json", ".fabric/events.jsonl", ".fabric/knowledge/", "knowledge_proposed", "relevance_scope", "relevance_paths", "narrow", "broad", "source_sessions", "proposed_reason", "session_context", "layer", "team", "personal", "pending_path", "knowledge_scope_degraded", "@HUMAN", "MUST", "NEVER"];
@@ -19,4 +39,4 @@ declare const enMessages: Messages;
19
39
 
20
40
  declare const zhCNMessages: Messages;
21
41
 
22
- export { type Locale, type Messages, PROTECTED_TOKENS, type ProtectedToken, type TranslationKey, type Translator, createTranslator, defaultMessages, detectNodeLocale, enMessages, normalizeLocale, zhCNMessages };
42
+ export { type Locale, type Messages, PROTECTED_TOKENS, type ProtectedToken, type TranslationKey, type Translator, createTranslator, defaultMessages, detectNodeLocale, enMessages, normalizeLocale, resolveFabricLocale, zhCNMessages };
@@ -5,8 +5,9 @@ import {
5
5
  detectNodeLocale,
6
6
  enMessages,
7
7
  normalizeLocale,
8
+ resolveFabricLocale,
8
9
  zhCNMessages
9
- } from "../chunk-GYIALPMW.js";
10
+ } from "../chunk-E5LHOWTN.js";
10
11
  export {
11
12
  PROTECTED_TOKENS,
12
13
  createTranslator,
@@ -14,5 +15,6 @@ export {
14
15
  detectNodeLocale,
15
16
  enMessages,
16
17
  normalizeLocale,
18
+ resolveFabricLocale,
17
19
  zhCNMessages
18
20
  };
package/dist/index.d.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  import { AgentsMetaNode, AgentsIdentitySource, AgentsLayer, AgentsTopologyType, HumanLockEntry, AgentsMeta, LedgerEntry } from './types/index.js';
2
2
  export { AgentsActivationTier, AgentsMetaCountersEnvelope, AgentsMetaKnowledgeTypeCounters, AgentsMetaNodeActivation, AiLedgerEntry, AuditMode, ClientPaths, DefaultLayerFilter, FabricConfig, FabricLanguage, HumanLedgerEntry, McpPayloadLimits, RuleDescription, RuleDescriptionIndexItem } from './types/index.js';
3
- export { Locale, Messages, PROTECTED_TOKENS, ProtectedToken, TranslationKey, Translator, createTranslator, defaultMessages, detectNodeLocale, enMessages, normalizeLocale, zhCNMessages } from './i18n/index.js';
3
+ export { Locale, Messages, PROTECTED_TOKENS, ProtectedToken, TranslationKey, Translator, createTranslator, defaultMessages, detectNodeLocale, enMessages, normalizeLocale, resolveFabricLocale, zhCNMessages } from './i18n/index.js';
4
4
  import { z } from 'zod';
5
5
  import { Layer, KnowledgeType, StableId } from './schemas/api-contracts.js';
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, historyStateQuerySchema, humanLockApproveRequestSchema, humanLockFileParamsSchema, knowledgeSectionsAnnotations, knowledgeSectionsInputSchema, knowledgeSectionsOutputSchema, ledgerQuerySchema, ledgerSourceSchema, parseKnowledgeId, planContextAnnotations, planContextHintNarrowEntrySchema, planContextHintOutputSchema, planContextInputSchema, planContextOutputSchema, structuredWarningSchema } from './schemas/api-contracts.js';
6
+ export { CiteContractMetrics, CiteCoverageReport, CiteLayerTypeBreakdown, 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, citeContractMetricsSchema, citeCoverageReportSchema, citeLayerTypeBreakdownSchema, fabExtractKnowledgeAnnotations, fabReviewAnnotations, formatKnowledgeId, historyStateQuerySchema, humanLockApproveRequestSchema, humanLockFileParamsSchema, knowledgeSectionsAnnotations, knowledgeSectionsInputSchema, knowledgeSectionsOutputSchema, ledgerQuerySchema, ledgerSourceSchema, parseKnowledgeId, planContextAnnotations, planContextHintNarrowEntrySchema, planContextHintOutputSchema, planContextInputSchema, planContextOutputSchema, structuredWarningSchema } from './schemas/api-contracts.js';
7
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';
8
8
 
9
9
  declare const ONBOARD_SLOT_NAMES: readonly ["tech-stack-decision", "architecture-pattern", "code-style-tone", "build-system-idiom", "domain-vocabulary"];
@@ -1091,8 +1091,8 @@ declare const knowledgeTestIndexSchema: z.ZodObject<{
1091
1091
  previous_test_hash?: string | undefined;
1092
1092
  }>, "many">;
1093
1093
  }, "strict", z.ZodTypeAny, {
1094
- schema_version: 1;
1095
1094
  generated_at: string;
1095
+ schema_version: 1;
1096
1096
  links: {
1097
1097
  rule_stable_id: string;
1098
1098
  rule_file: string;
@@ -1113,8 +1113,8 @@ declare const knowledgeTestIndexSchema: z.ZodObject<{
1113
1113
  revision?: string | undefined;
1114
1114
  previous_revision?: string | undefined;
1115
1115
  }, {
1116
- schema_version: 1;
1117
1116
  generated_at: string;
1117
+ schema_version: 1;
1118
1118
  links: {
1119
1119
  rule_stable_id: string;
1120
1120
  rule_file: string;
@@ -1321,14 +1321,14 @@ declare const clientPathsSchema: z.ZodObject<{
1321
1321
  cursor: z.ZodOptional<z.ZodString>;
1322
1322
  codexCLI: z.ZodOptional<z.ZodString>;
1323
1323
  }, "strict", z.ZodTypeAny, {
1324
+ cursor?: string | undefined;
1324
1325
  claudeCodeCLI?: string | undefined;
1325
1326
  claudeCodeDesktop?: string | undefined;
1326
- cursor?: string | undefined;
1327
1327
  codexCLI?: string | undefined;
1328
1328
  }, {
1329
+ cursor?: string | undefined;
1329
1330
  claudeCodeCLI?: string | undefined;
1330
1331
  claudeCodeDesktop?: string | undefined;
1331
- cursor?: string | undefined;
1332
1332
  codexCLI?: string | undefined;
1333
1333
  }>;
1334
1334
  declare const mcpPayloadLimitsSchema: z.ZodOptional<z.ZodObject<{
@@ -1350,14 +1350,14 @@ declare const fabricConfigSchema: z.ZodObject<{
1350
1350
  cursor: z.ZodOptional<z.ZodString>;
1351
1351
  codexCLI: z.ZodOptional<z.ZodString>;
1352
1352
  }, "strict", z.ZodTypeAny, {
1353
+ cursor?: string | undefined;
1353
1354
  claudeCodeCLI?: string | undefined;
1354
1355
  claudeCodeDesktop?: string | undefined;
1355
- cursor?: string | undefined;
1356
1356
  codexCLI?: string | undefined;
1357
1357
  }, {
1358
+ cursor?: string | undefined;
1358
1359
  claudeCodeCLI?: string | undefined;
1359
1360
  claudeCodeDesktop?: string | undefined;
1360
- cursor?: string | undefined;
1361
1361
  codexCLI?: string | undefined;
1362
1362
  }>>;
1363
1363
  scanIgnores: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
@@ -1417,9 +1417,9 @@ declare const fabricConfigSchema: z.ZodObject<{
1417
1417
  review_stale_pending_days: number;
1418
1418
  onboard_slots_opted_out: string[];
1419
1419
  clientPaths?: {
1420
+ cursor?: string | undefined;
1420
1421
  claudeCodeCLI?: string | undefined;
1421
1422
  claudeCodeDesktop?: string | undefined;
1422
- cursor?: string | undefined;
1423
1423
  codexCLI?: string | undefined;
1424
1424
  } | undefined;
1425
1425
  scanIgnores?: string[] | undefined;
@@ -1431,9 +1431,9 @@ declare const fabricConfigSchema: z.ZodObject<{
1431
1431
  fabric_event_retention_days?: 7 | 30 | 90 | undefined;
1432
1432
  }, {
1433
1433
  clientPaths?: {
1434
+ cursor?: string | undefined;
1434
1435
  claudeCodeCLI?: string | undefined;
1435
1436
  claudeCodeDesktop?: string | undefined;
1436
- cursor?: string | undefined;
1437
1437
  codexCLI?: string | undefined;
1438
1438
  } | undefined;
1439
1439
  scanIgnores?: string[] | undefined;
@@ -6247,6 +6247,31 @@ declare const assistantTurnObservedEventSchema: z.ZodObject<{
6247
6247
  kb_line_raw: z.ZodNullable<z.ZodString>;
6248
6248
  cite_ids: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
6249
6249
  cite_tags: z.ZodDefault<z.ZodArray<z.ZodEnum<["planned", "recalled", "chained-from", "dismissed", "none"]>, "many">>;
6250
+ cite_commitments: z.ZodDefault<z.ZodArray<z.ZodObject<{
6251
+ operators: z.ZodArray<z.ZodObject<{
6252
+ kind: z.ZodEnum<["edit", "not_edit", "require", "forbid"]>;
6253
+ target: z.ZodString;
6254
+ }, "strip", z.ZodTypeAny, {
6255
+ kind: "require" | "edit" | "not_edit" | "forbid";
6256
+ target: string;
6257
+ }, {
6258
+ kind: "require" | "edit" | "not_edit" | "forbid";
6259
+ target: string;
6260
+ }>, "many">;
6261
+ skip_reason: z.ZodNullable<z.ZodString>;
6262
+ }, "strip", z.ZodTypeAny, {
6263
+ operators: {
6264
+ kind: "require" | "edit" | "not_edit" | "forbid";
6265
+ target: string;
6266
+ }[];
6267
+ skip_reason: string | null;
6268
+ }, {
6269
+ operators: {
6270
+ kind: "require" | "edit" | "not_edit" | "forbid";
6271
+ target: string;
6272
+ }[];
6273
+ skip_reason: string | null;
6274
+ }>, "many">>;
6250
6275
  client: z.ZodOptional<z.ZodEnum<["cc", "codex", "cursor"]>>;
6251
6276
  turn_id: z.ZodString;
6252
6277
  envelope_index: z.ZodOptional<z.ZodNumber>;
@@ -6267,10 +6292,17 @@ declare const assistantTurnObservedEventSchema: z.ZodObject<{
6267
6292
  kb_line_raw: string | null;
6268
6293
  cite_ids: string[];
6269
6294
  cite_tags: ("none" | "planned" | "recalled" | "chained-from" | "dismissed")[];
6295
+ cite_commitments: {
6296
+ operators: {
6297
+ kind: "require" | "edit" | "not_edit" | "forbid";
6298
+ target: string;
6299
+ }[];
6300
+ skip_reason: string | null;
6301
+ }[];
6270
6302
  turn_id: string;
6271
6303
  correlation_id?: string | undefined;
6272
6304
  session_id?: string | undefined;
6273
- client?: "cursor" | "cc" | "codex" | undefined;
6305
+ client?: "cc" | "codex" | "cursor" | undefined;
6274
6306
  envelope_index?: number | undefined;
6275
6307
  }, {
6276
6308
  id: string;
@@ -6285,7 +6317,14 @@ declare const assistantTurnObservedEventSchema: z.ZodObject<{
6285
6317
  session_id?: string | undefined;
6286
6318
  cite_ids?: string[] | undefined;
6287
6319
  cite_tags?: ("none" | "planned" | "recalled" | "chained-from" | "dismissed")[] | undefined;
6288
- client?: "cursor" | "cc" | "codex" | undefined;
6320
+ cite_commitments?: {
6321
+ operators: {
6322
+ kind: "require" | "edit" | "not_edit" | "forbid";
6323
+ target: string;
6324
+ }[];
6325
+ skip_reason: string | null;
6326
+ }[] | undefined;
6327
+ client?: "cc" | "codex" | "cursor" | undefined;
6289
6328
  envelope_index?: number | undefined;
6290
6329
  }>;
6291
6330
  declare const citePolicyActivatedEventSchema: z.ZodObject<{
@@ -6319,6 +6358,31 @@ declare const citePolicyActivatedEventSchema: z.ZodObject<{
6319
6358
  correlation_id?: string | undefined;
6320
6359
  session_id?: string | undefined;
6321
6360
  }>;
6361
+ declare const citeContractPolicyActivatedEventSchema: z.ZodObject<{
6362
+ event_type: z.ZodLiteral<"cite_contract_policy_activated">;
6363
+ kind: z.ZodLiteral<"fabric-event">;
6364
+ id: z.ZodString;
6365
+ ts: z.ZodNumber;
6366
+ schema_version: z.ZodLiteral<1>;
6367
+ correlation_id: z.ZodOptional<z.ZodString>;
6368
+ session_id: z.ZodOptional<z.ZodString>;
6369
+ }, "strip", z.ZodTypeAny, {
6370
+ id: string;
6371
+ ts: number;
6372
+ schema_version: 1;
6373
+ kind: "fabric-event";
6374
+ event_type: "cite_contract_policy_activated";
6375
+ correlation_id?: string | undefined;
6376
+ session_id?: string | undefined;
6377
+ }, {
6378
+ id: string;
6379
+ ts: number;
6380
+ schema_version: 1;
6381
+ kind: "fabric-event";
6382
+ event_type: "cite_contract_policy_activated";
6383
+ correlation_id?: string | undefined;
6384
+ session_id?: string | undefined;
6385
+ }>;
6322
6386
  declare const eventsRotatedEventSchema: z.ZodObject<{
6323
6387
  event_type: z.ZodLiteral<"events_rotated">;
6324
6388
  cutoff_ts: z.ZodString;
@@ -6464,6 +6528,43 @@ declare const knowledgeEnrichedEventSchema: z.ZodObject<{
6464
6528
  correlation_id?: string | undefined;
6465
6529
  session_id?: string | undefined;
6466
6530
  }>;
6531
+ declare const sessionArchiveAttemptedEventSchema: z.ZodObject<{
6532
+ event_type: z.ZodLiteral<"session_archive_attempted">;
6533
+ outcome: z.ZodEnum<["proposed", "viability_failed", "user_dismissed", "skipped_no_signal"]>;
6534
+ covered_through_ts: z.ZodNumber;
6535
+ candidates_proposed: z.ZodDefault<z.ZodNumber>;
6536
+ knowledge_proposed_ids: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
6537
+ kind: z.ZodLiteral<"fabric-event">;
6538
+ id: z.ZodString;
6539
+ ts: z.ZodNumber;
6540
+ schema_version: z.ZodLiteral<1>;
6541
+ correlation_id: z.ZodOptional<z.ZodString>;
6542
+ session_id: z.ZodOptional<z.ZodString>;
6543
+ }, "strip", z.ZodTypeAny, {
6544
+ id: string;
6545
+ ts: number;
6546
+ schema_version: 1;
6547
+ kind: "fabric-event";
6548
+ event_type: "session_archive_attempted";
6549
+ outcome: "proposed" | "viability_failed" | "user_dismissed" | "skipped_no_signal";
6550
+ covered_through_ts: number;
6551
+ candidates_proposed: number;
6552
+ knowledge_proposed_ids: string[];
6553
+ correlation_id?: string | undefined;
6554
+ session_id?: string | undefined;
6555
+ }, {
6556
+ id: string;
6557
+ ts: number;
6558
+ schema_version: 1;
6559
+ kind: "fabric-event";
6560
+ event_type: "session_archive_attempted";
6561
+ outcome: "proposed" | "viability_failed" | "user_dismissed" | "skipped_no_signal";
6562
+ covered_through_ts: number;
6563
+ correlation_id?: string | undefined;
6564
+ session_id?: string | undefined;
6565
+ candidates_proposed?: number | undefined;
6566
+ knowledge_proposed_ids?: string[] | undefined;
6567
+ }>;
6467
6568
  declare const eventLedgerEventSchema: z.ZodDiscriminatedUnion<"event_type", [z.ZodObject<{
6468
6569
  event_type: z.ZodLiteral<"knowledge_context_planned">;
6469
6570
  target_paths: z.ZodArray<z.ZodString, "many">;
@@ -7682,6 +7783,31 @@ declare const eventLedgerEventSchema: z.ZodDiscriminatedUnion<"event_type", [z.Z
7682
7783
  kb_line_raw: z.ZodNullable<z.ZodString>;
7683
7784
  cite_ids: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
7684
7785
  cite_tags: z.ZodDefault<z.ZodArray<z.ZodEnum<["planned", "recalled", "chained-from", "dismissed", "none"]>, "many">>;
7786
+ cite_commitments: z.ZodDefault<z.ZodArray<z.ZodObject<{
7787
+ operators: z.ZodArray<z.ZodObject<{
7788
+ kind: z.ZodEnum<["edit", "not_edit", "require", "forbid"]>;
7789
+ target: z.ZodString;
7790
+ }, "strip", z.ZodTypeAny, {
7791
+ kind: "require" | "edit" | "not_edit" | "forbid";
7792
+ target: string;
7793
+ }, {
7794
+ kind: "require" | "edit" | "not_edit" | "forbid";
7795
+ target: string;
7796
+ }>, "many">;
7797
+ skip_reason: z.ZodNullable<z.ZodString>;
7798
+ }, "strip", z.ZodTypeAny, {
7799
+ operators: {
7800
+ kind: "require" | "edit" | "not_edit" | "forbid";
7801
+ target: string;
7802
+ }[];
7803
+ skip_reason: string | null;
7804
+ }, {
7805
+ operators: {
7806
+ kind: "require" | "edit" | "not_edit" | "forbid";
7807
+ target: string;
7808
+ }[];
7809
+ skip_reason: string | null;
7810
+ }>, "many">>;
7685
7811
  client: z.ZodOptional<z.ZodEnum<["cc", "codex", "cursor"]>>;
7686
7812
  turn_id: z.ZodString;
7687
7813
  envelope_index: z.ZodOptional<z.ZodNumber>;
@@ -7702,10 +7828,17 @@ declare const eventLedgerEventSchema: z.ZodDiscriminatedUnion<"event_type", [z.Z
7702
7828
  kb_line_raw: string | null;
7703
7829
  cite_ids: string[];
7704
7830
  cite_tags: ("none" | "planned" | "recalled" | "chained-from" | "dismissed")[];
7831
+ cite_commitments: {
7832
+ operators: {
7833
+ kind: "require" | "edit" | "not_edit" | "forbid";
7834
+ target: string;
7835
+ }[];
7836
+ skip_reason: string | null;
7837
+ }[];
7705
7838
  turn_id: string;
7706
7839
  correlation_id?: string | undefined;
7707
7840
  session_id?: string | undefined;
7708
- client?: "cursor" | "cc" | "codex" | undefined;
7841
+ client?: "cc" | "codex" | "cursor" | undefined;
7709
7842
  envelope_index?: number | undefined;
7710
7843
  }, {
7711
7844
  id: string;
@@ -7720,7 +7853,14 @@ declare const eventLedgerEventSchema: z.ZodDiscriminatedUnion<"event_type", [z.Z
7720
7853
  session_id?: string | undefined;
7721
7854
  cite_ids?: string[] | undefined;
7722
7855
  cite_tags?: ("none" | "planned" | "recalled" | "chained-from" | "dismissed")[] | undefined;
7723
- client?: "cursor" | "cc" | "codex" | undefined;
7856
+ cite_commitments?: {
7857
+ operators: {
7858
+ kind: "require" | "edit" | "not_edit" | "forbid";
7859
+ target: string;
7860
+ }[];
7861
+ skip_reason: string | null;
7862
+ }[] | undefined;
7863
+ client?: "cc" | "codex" | "cursor" | undefined;
7724
7864
  envelope_index?: number | undefined;
7725
7865
  }>, z.ZodObject<{
7726
7866
  event_type: z.ZodLiteral<"cite_policy_activated">;
@@ -7752,6 +7892,30 @@ declare const eventLedgerEventSchema: z.ZodDiscriminatedUnion<"event_type", [z.Z
7752
7892
  policy_version: string;
7753
7893
  correlation_id?: string | undefined;
7754
7894
  session_id?: string | undefined;
7895
+ }>, z.ZodObject<{
7896
+ event_type: z.ZodLiteral<"cite_contract_policy_activated">;
7897
+ kind: z.ZodLiteral<"fabric-event">;
7898
+ id: z.ZodString;
7899
+ ts: z.ZodNumber;
7900
+ schema_version: z.ZodLiteral<1>;
7901
+ correlation_id: z.ZodOptional<z.ZodString>;
7902
+ session_id: z.ZodOptional<z.ZodString>;
7903
+ }, "strip", z.ZodTypeAny, {
7904
+ id: string;
7905
+ ts: number;
7906
+ schema_version: 1;
7907
+ kind: "fabric-event";
7908
+ event_type: "cite_contract_policy_activated";
7909
+ correlation_id?: string | undefined;
7910
+ session_id?: string | undefined;
7911
+ }, {
7912
+ id: string;
7913
+ ts: number;
7914
+ schema_version: 1;
7915
+ kind: "fabric-event";
7916
+ event_type: "cite_contract_policy_activated";
7917
+ correlation_id?: string | undefined;
7918
+ session_id?: string | undefined;
7755
7919
  }>, z.ZodObject<{
7756
7920
  event_type: z.ZodLiteral<"knowledge_meta_auto_healed">;
7757
7921
  previous_revision_hash: z.ZodString;
@@ -7893,6 +8057,42 @@ declare const eventLedgerEventSchema: z.ZodDiscriminatedUnion<"event_type", [z.Z
7893
8057
  added_fields: ("intent_clues" | "tech_stack" | "impact" | "must_read_if")[];
7894
8058
  correlation_id?: string | undefined;
7895
8059
  session_id?: string | undefined;
8060
+ }>, z.ZodObject<{
8061
+ event_type: z.ZodLiteral<"session_archive_attempted">;
8062
+ outcome: z.ZodEnum<["proposed", "viability_failed", "user_dismissed", "skipped_no_signal"]>;
8063
+ covered_through_ts: z.ZodNumber;
8064
+ candidates_proposed: z.ZodDefault<z.ZodNumber>;
8065
+ knowledge_proposed_ids: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
8066
+ kind: z.ZodLiteral<"fabric-event">;
8067
+ id: z.ZodString;
8068
+ ts: z.ZodNumber;
8069
+ schema_version: z.ZodLiteral<1>;
8070
+ correlation_id: z.ZodOptional<z.ZodString>;
8071
+ session_id: z.ZodOptional<z.ZodString>;
8072
+ }, "strip", z.ZodTypeAny, {
8073
+ id: string;
8074
+ ts: number;
8075
+ schema_version: 1;
8076
+ kind: "fabric-event";
8077
+ event_type: "session_archive_attempted";
8078
+ outcome: "proposed" | "viability_failed" | "user_dismissed" | "skipped_no_signal";
8079
+ covered_through_ts: number;
8080
+ candidates_proposed: number;
8081
+ knowledge_proposed_ids: string[];
8082
+ correlation_id?: string | undefined;
8083
+ session_id?: string | undefined;
8084
+ }, {
8085
+ id: string;
8086
+ ts: number;
8087
+ schema_version: 1;
8088
+ kind: "fabric-event";
8089
+ event_type: "session_archive_attempted";
8090
+ outcome: "proposed" | "viability_failed" | "user_dismissed" | "skipped_no_signal";
8091
+ covered_through_ts: number;
8092
+ correlation_id?: string | undefined;
8093
+ session_id?: string | undefined;
8094
+ candidates_proposed?: number | undefined;
8095
+ knowledge_proposed_ids?: string[] | undefined;
7896
8096
  }>]>;
7897
8097
  type KnowledgeContextPlannedEvent = z.infer<typeof knowledgeContextPlannedEventSchema>;
7898
8098
  type KnowledgeSelectionEvent = z.infer<typeof knowledgeSelectionEventSchema>;
@@ -7929,13 +8129,39 @@ type DoctorRunEvent = z.infer<typeof doctorRunEventSchema>;
7929
8129
  type RelevanceMigrationRunEvent = z.infer<typeof relevanceMigrationRunEventSchema>;
7930
8130
  type AssistantTurnObservedEvent = z.infer<typeof assistantTurnObservedEventSchema>;
7931
8131
  type CitePolicyActivatedEvent = z.infer<typeof citePolicyActivatedEventSchema>;
8132
+ type CiteContractPolicyActivatedEvent = z.infer<typeof citeContractPolicyActivatedEventSchema>;
7932
8133
  type KnowledgeMetaAutoHealedEvent = z.infer<typeof knowledgeMetaAutoHealedEventSchema>;
7933
8134
  type EventsRotatedEvent = z.infer<typeof eventsRotatedEventSchema>;
7934
8135
  type ServeLockClearedEvent = z.infer<typeof serveLockClearedEventSchema>;
7935
8136
  type KnowledgeEnrichedEvent = z.infer<typeof knowledgeEnrichedEventSchema>;
7936
- 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 | KnowledgeMetaAutoHealedEvent | EventsRotatedEvent | ServeLockClearedEvent | KnowledgeEnrichedEvent;
8137
+ type SessionArchiveAttemptedEvent = z.infer<typeof sessionArchiveAttemptedEventSchema>;
8138
+ 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 | CiteContractPolicyActivatedEvent | KnowledgeMetaAutoHealedEvent | EventsRotatedEvent | ServeLockClearedEvent | KnowledgeEnrichedEvent | SessionArchiveAttemptedEvent;
7937
8139
  type EventLedgerEventType = EventLedgerEvent["event_type"];
7938
8140
  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;
7939
8141
  type EventLedgerEventInput = EventLedgerEventInputFor<EventLedgerEvent>;
7940
8142
 
7941
- 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 EventsRotatedEvent, 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 KnowledgeEnrichedEvent, type KnowledgeLayerChangedEvent, type KnowledgeMetaAutoHealedEvent, 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, ONBOARD_SLOT_NAMES, ONBOARD_SLOT_TOTAL, type OnboardSlot, type PanelFieldGroup, type PanelFieldMeta, type PendingAutoArchivedEvent, type ReapplyCompletedEvent, type RelevanceMigrationRunEvent, type ServeLockClearedEvent, 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, eventsRotatedEventSchema, 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, knowledgeEnrichedEventSchema, knowledgeLayerChangedEventSchema, knowledgeMetaAutoHealedEventSchema, knowledgePathDangledEventSchema, knowledgePromoteFailedEventSchema, knowledgePromoteStartedEventSchema, knowledgePromotedEventSchema, knowledgeProposedEventSchema, knowledgeRejectedEventSchema, knowledgeScopeDegradedEventSchema, knowledgeSectionsFetchedEventSchema, knowledgeSelectionEventSchema, knowledgeSlugRenamedEventSchema, knowledgeTestIndexSchema, knowledgeTestLinkSchema, knowledgeTestOrphanAnnotationSchema, ledgerAppendedEventSchema, ledgerEntrySchema, lockApprovedEventSchema, lockDriftEventSchema, mcpConfigMigratedEventSchema, mcpEventLedgerEventSchema, mcpPayloadLimitsSchema, metaReconciledEventSchema, metaReconciledOnStartupEventSchema, metaUpdatedEventSchema, onboardSlotSchema, pendingAutoArchivedEventSchema, reapplyCompletedEventSchema, relevanceMigrationRunEventSchema, ruleDescriptionIndexItemSchema, ruleDescriptionSchema, serveLockClearedEventSchema, withDerivedAgentsMetaNodeDefaults };
8143
+ type CiteTag = "planned" | "recalled" | "chained-from" | "dismissed" | "none";
8144
+ type CiteCommitmentOperatorKind = "edit" | "not_edit" | "require" | "forbid";
8145
+ interface CiteCommitmentOperator {
8146
+ kind: CiteCommitmentOperatorKind;
8147
+ target: string;
8148
+ }
8149
+ interface CiteCommitment {
8150
+ operators: CiteCommitmentOperator[];
8151
+ skip_reason: string | null;
8152
+ }
8153
+ interface ParseCiteLineResult {
8154
+ cite_ids: string[];
8155
+ cite_tags: CiteTag[];
8156
+ cite_commitments: CiteCommitment[];
8157
+ }
8158
+ /**
8159
+ * Parse one or more newline-separated `KB:` cite lines into structured
8160
+ * arrays matching the assistant_turn_observed event-ledger fields.
8161
+ *
8162
+ * Tolerates whitespace, CR/LF line endings, blank lines, and non-KB
8163
+ * interleaved prose. Index contract documented above.
8164
+ */
8165
+ declare function parseCiteLine(raw: string): ParseCiteLineResult;
8166
+
8167
+ 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 CiteCommitment, type CiteCommitmentOperator, type CiteCommitmentOperatorKind, type CiteContractPolicyActivatedEvent, type CitePolicyActivatedEvent, type CiteTag, type ClaudeHookPathMigratedEvent, type ClaudeSkillPathMigratedEvent, type CodexSkillPathMigratedEvent, type DoctorRunEvent, type DriftDetectedEvent, type EditIntentCheckedEvent, type EventLedgerEvent, type EventLedgerEventInput, type EventLedgerEventType, type EventLedgerTruncatedEvent, type EventsRotatedEvent, 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 KnowledgeEnrichedEvent, type KnowledgeLayerChangedEvent, type KnowledgeMetaAutoHealedEvent, 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, ONBOARD_SLOT_NAMES, ONBOARD_SLOT_TOTAL, type OnboardSlot, type PanelFieldGroup, type PanelFieldMeta, type ParseCiteLineResult, type PendingAutoArchivedEvent, type ReapplyCompletedEvent, type RelevanceMigrationRunEvent, type ServeLockClearedEvent, type SessionArchiveAttemptedEvent, StableId, type ValidateResult, agentsIdentitySourceSchema, agentsLayerSchema, agentsMetaNodeSchema, agentsMetaSchema, agentsTopologyTypeSchema, aiLedgerEntrySchema, allocateKnowledgeId, assistantTurnObservedEventSchema, auditModeSchema, bootstrapMarkerMigratedEventSchema, candidateFileEntrySchema, citeContractPolicyActivatedEventSchema, citePolicyActivatedEventSchema, claudeHookPathMigratedEventSchema, claudeSkillPathMigratedEventSchema, clientPathsSchema, codexSkillPathMigratedEventSchema, defaultAgentsMetaCounters, defaultLayerFilterSchema, deriveAgentsMetaIdentitySource, deriveAgentsMetaLayer, deriveAgentsMetaStableId, deriveAgentsMetaTopologyType, doctorRunEventSchema, driftDetectedEventSchema, editIntentCheckedEventSchema, eventLedgerEventSchema, eventLedgerTruncatedEventSchema, eventsRotatedEventSchema, 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, knowledgeEnrichedEventSchema, knowledgeLayerChangedEventSchema, knowledgeMetaAutoHealedEventSchema, knowledgePathDangledEventSchema, knowledgePromoteFailedEventSchema, knowledgePromoteStartedEventSchema, knowledgePromotedEventSchema, knowledgeProposedEventSchema, knowledgeRejectedEventSchema, knowledgeScopeDegradedEventSchema, knowledgeSectionsFetchedEventSchema, knowledgeSelectionEventSchema, knowledgeSlugRenamedEventSchema, knowledgeTestIndexSchema, knowledgeTestLinkSchema, knowledgeTestOrphanAnnotationSchema, ledgerAppendedEventSchema, ledgerEntrySchema, lockApprovedEventSchema, lockDriftEventSchema, mcpConfigMigratedEventSchema, mcpEventLedgerEventSchema, mcpPayloadLimitsSchema, metaReconciledEventSchema, metaReconciledOnStartupEventSchema, metaUpdatedEventSchema, onboardSlotSchema, parseCiteLine, pendingAutoArchivedEventSchema, reapplyCompletedEventSchema, relevanceMigrationRunEventSchema, ruleDescriptionIndexItemSchema, ruleDescriptionSchema, serveLockClearedEventSchema, sessionArchiveAttemptedEventSchema, withDerivedAgentsMetaNodeDefaults };