@fenglimg/fabric-shared 1.5.1 → 1.5.2

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.
@@ -51,6 +51,7 @@ var enMessages = {
51
51
  "cli.doctor.description": "Run Fabric doctor checks and optional compliance audit reporting.",
52
52
  "cli.doctor.args.target.description": "Target project path. Defaults to CLI arg, EXTERNAL_FIXTURE_PATH, fabric.config.json, then cwd.",
53
53
  "cli.doctor.args.audit.description": "Print fab_get_rules compliance violations for AI edit intents.",
54
+ "cli.doctor.args.fix.description": "Migrate the legacy root ledger into .fabric/.intent-ledger.jsonl when needed.",
54
55
  "cli.doctor.args.window-minutes.description": "Audit lookback window in minutes for matching fab_get_rules calls. Default 5.",
55
56
  "cli.doctor.errors.invalid-window": "Invalid audit window: {value}",
56
57
  "cli.doctor.audit.preview-only": "auditMode is off in fabric.config.json; running fab doctor --audit as a manual preview only.",
@@ -482,6 +483,7 @@ var zhCNMessages = {
482
483
  "cli.doctor.description": "\u8FD0\u884C Fabric doctor \u68C0\u67E5\uFF0C\u5E76\u53EF\u9009\u8F93\u51FA\u5408\u89C4\u5BA1\u8BA1\u62A5\u544A\u3002",
483
484
  "cli.doctor.args.target.description": "\u76EE\u6807\u9879\u76EE\u8DEF\u5F84\u3002\u9ED8\u8BA4\u4F9D\u6B21\u4F7F\u7528 CLI \u53C2\u6570\u3001EXTERNAL_FIXTURE_PATH\u3001fabric.config.json\u3001\u5F53\u524D\u76EE\u5F55\u3002",
484
485
  "cli.doctor.args.audit.description": "\u8F93\u51FA AI \u7F16\u8F91\u610F\u56FE\u7F3A\u5C11 fab_get_rules \u524D\u7F6E\u8C03\u7528\u7684\u8FDD\u89C4\u9879\u3002",
486
+ "cli.doctor.args.fix.description": "\u9700\u8981\u65F6\u5C06\u65E7\u7684\u6839\u76EE\u5F55 ledger \u8FC1\u79FB\u5230 .fabric/.intent-ledger.jsonl\u3002",
485
487
  "cli.doctor.args.window-minutes.description": "\u5339\u914D fab_get_rules \u8C03\u7528\u7684\u56DE\u770B\u65F6\u95F4\u7A97\u53E3\uFF0C\u5355\u4F4D\u4E3A\u5206\u949F\u3002\u9ED8\u8BA4 5 \u5206\u949F\u3002",
486
488
  "cli.doctor.errors.invalid-window": "\u65E0\u6548\u7684\u5BA1\u8BA1\u65F6\u95F4\u7A97\u53E3\uFF1A{value}",
487
489
  "cli.doctor.audit.preview-only": "fabric.config.json \u4E2D auditMode \u4E3A off\uFF1B\u5F53\u524D fab doctor --audit \u4EC5\u6267\u884C\u624B\u52A8\u9884\u89C8\uFF0C\u4E0D\u4F1A\u6539\u53D8\u9000\u51FA\u7801\u3002",
@@ -924,7 +926,7 @@ var PROTECTED_TOKENS = [
924
926
  ".fabric/human-lock.json",
925
927
  ".fabric/init-context.json",
926
928
  ".fabric/forensic.json",
927
- ".intent-ledger.jsonl",
929
+ ".fabric/.intent-ledger.jsonl",
928
930
  "@HUMAN",
929
931
  "shadow constraints",
930
932
  "Shadow Mirroring",
@@ -12,7 +12,7 @@ declare function detectNodeLocale(): Locale;
12
12
 
13
13
  declare function normalizeLocale(raw: string | null | undefined): Locale;
14
14
 
15
- declare const PROTECTED_TOKENS: readonly ["fab_get_rules", "fab_append_intent", "fab_update_registry", "fabric_rules", "ledger_entry", "ledger_entry_id", "agent_meta", "AGENTS.md", "FABRIC.md", ".fabric/agents/", ".fabric/agents/_cross/", ".fabric/agents.meta.json", ".fabric/human-lock.json", ".fabric/init-context.json", ".fabric/forensic.json", ".intent-ledger.jsonl", "@HUMAN", "shadow constraints", "Shadow Mirroring", "CORE RULES", "DO NOT TRANSLATE", "MUST", "NEVER"];
15
+ declare const PROTECTED_TOKENS: readonly ["fab_get_rules", "fab_append_intent", "fab_update_registry", "fabric_rules", "ledger_entry", "ledger_entry_id", "agent_meta", "AGENTS.md", "FABRIC.md", ".fabric/agents/", ".fabric/agents/_cross/", ".fabric/agents.meta.json", ".fabric/human-lock.json", ".fabric/init-context.json", ".fabric/forensic.json", ".fabric/.intent-ledger.jsonl", "@HUMAN", "shadow constraints", "Shadow Mirroring", "CORE RULES", "DO NOT TRANSLATE", "MUST", "NEVER"];
16
16
  type ProtectedToken = (typeof PROTECTED_TOKENS)[number];
17
17
 
18
18
  declare const enMessages: Messages;
@@ -6,7 +6,7 @@ import {
6
6
  enMessages,
7
7
  normalizeLocale,
8
8
  zhCNMessages
9
- } from "../chunk-XEVK2HU2.js";
9
+ } from "../chunk-KNZIX6IL.js";
10
10
  export {
11
11
  PROTECTED_TOKENS,
12
12
  createTranslator,
package/dist/index.d.ts CHANGED
@@ -1,12 +1,14 @@
1
- import { AgentsLayer, AgentsTopologyType, AgentsMetaNode, HumanLockEntry, AgentsMeta, LedgerEntry } from './types/index.js';
1
+ import { AgentsMetaNode, AgentsIdentitySource, AgentsLayer, AgentsTopologyType, HumanLockEntry, AgentsMeta, LedgerEntry } from './types/index.js';
2
2
  export { AgentsActivationTier, AgentsMetaNodeActivation, AiLedgerEntry, AuditMode, ClientPaths, FabricConfig, HumanLedgerEntry } from './types/index.js';
3
3
  export { Locale, Messages, PROTECTED_TOKENS, ProtectedToken, TranslationKey, Translator, createTranslator, defaultMessages, detectNodeLocale, enMessages, normalizeLocale, zhCNMessages } from './i18n/index.js';
4
4
  import { z } from 'zod';
5
5
 
6
6
  declare const AGENTS_META_LAYERS: readonly ["L0", "L1", "L2"];
7
7
  declare const AGENTS_META_TOPOLOGY_TYPES: readonly ["mirror", "cross-cutting"];
8
+ declare const AGENTS_META_IDENTITY_SOURCES: readonly ["declared", "derived"];
8
9
  declare const agentsLayerSchema: z.ZodEnum<["L0", "L1", "L2"]>;
9
10
  declare const agentsTopologyTypeSchema: z.ZodEnum<["mirror", "cross-cutting"]>;
11
+ declare const agentsIdentitySourceSchema: z.ZodEnum<["declared", "derived"]>;
10
12
  type AgentsMetaNodeInput = Omit<AgentsMetaNode, "layer" | "topology_type"> & Partial<Pick<AgentsMetaNode, "layer" | "topology_type">>;
11
13
  declare const agentsMetaNodeSchema: z.ZodEffects<z.ZodObject<{
12
14
  file: z.ZodString;
@@ -16,6 +18,8 @@ declare const agentsMetaNodeSchema: z.ZodEffects<z.ZodObject<{
16
18
  layer: z.ZodEnum<["L0", "L1", "L2"]>;
17
19
  topology_type: z.ZodEnum<["mirror", "cross-cutting"]>;
18
20
  hash: z.ZodString;
21
+ stable_id: z.ZodOptional<z.ZodString>;
22
+ identity_source: z.ZodOptional<z.ZodEnum<["declared", "derived"]>>;
19
23
  activation: z.ZodOptional<z.ZodObject<{
20
24
  tier: z.ZodEnum<["always", "path", "description"]>;
21
25
  description: z.ZodOptional<z.ZodString>;
@@ -34,6 +38,8 @@ declare const agentsMetaNodeSchema: z.ZodEffects<z.ZodObject<{
34
38
  topology_type: "mirror" | "cross-cutting";
35
39
  scope_glob: string;
36
40
  deps: string[];
41
+ stable_id?: string | undefined;
42
+ identity_source?: "declared" | "derived" | undefined;
37
43
  activation?: {
38
44
  tier: "always" | "path" | "description";
39
45
  description?: string | undefined;
@@ -46,6 +52,8 @@ declare const agentsMetaNodeSchema: z.ZodEffects<z.ZodObject<{
46
52
  topology_type: "mirror" | "cross-cutting";
47
53
  scope_glob: string;
48
54
  deps: string[];
55
+ stable_id?: string | undefined;
56
+ identity_source?: "declared" | "derived" | undefined;
49
57
  activation?: {
50
58
  tier: "always" | "path" | "description";
51
59
  description?: string | undefined;
@@ -58,6 +66,8 @@ declare const agentsMetaNodeSchema: z.ZodEffects<z.ZodObject<{
58
66
  topology_type: "mirror" | "cross-cutting";
59
67
  scope_glob: string;
60
68
  deps: string[];
69
+ stable_id?: string | undefined;
70
+ identity_source?: "declared" | "derived" | undefined;
61
71
  activation?: {
62
72
  tier: "always" | "path" | "description";
63
73
  description?: string | undefined;
@@ -73,6 +83,8 @@ declare const agentsMetaSchema: z.ZodObject<{
73
83
  layer: z.ZodEnum<["L0", "L1", "L2"]>;
74
84
  topology_type: z.ZodEnum<["mirror", "cross-cutting"]>;
75
85
  hash: z.ZodString;
86
+ stable_id: z.ZodOptional<z.ZodString>;
87
+ identity_source: z.ZodOptional<z.ZodEnum<["declared", "derived"]>>;
76
88
  activation: z.ZodOptional<z.ZodObject<{
77
89
  tier: z.ZodEnum<["always", "path", "description"]>;
78
90
  description: z.ZodOptional<z.ZodString>;
@@ -91,6 +103,8 @@ declare const agentsMetaSchema: z.ZodObject<{
91
103
  topology_type: "mirror" | "cross-cutting";
92
104
  scope_glob: string;
93
105
  deps: string[];
106
+ stable_id?: string | undefined;
107
+ identity_source?: "declared" | "derived" | undefined;
94
108
  activation?: {
95
109
  tier: "always" | "path" | "description";
96
110
  description?: string | undefined;
@@ -103,6 +117,8 @@ declare const agentsMetaSchema: z.ZodObject<{
103
117
  topology_type: "mirror" | "cross-cutting";
104
118
  scope_glob: string;
105
119
  deps: string[];
120
+ stable_id?: string | undefined;
121
+ identity_source?: "declared" | "derived" | undefined;
106
122
  activation?: {
107
123
  tier: "always" | "path" | "description";
108
124
  description?: string | undefined;
@@ -115,6 +131,8 @@ declare const agentsMetaSchema: z.ZodObject<{
115
131
  topology_type: "mirror" | "cross-cutting";
116
132
  scope_glob: string;
117
133
  deps: string[];
134
+ stable_id?: string | undefined;
135
+ identity_source?: "declared" | "derived" | undefined;
118
136
  activation?: {
119
137
  tier: "always" | "path" | "description";
120
138
  description?: string | undefined;
@@ -130,6 +148,8 @@ declare const agentsMetaSchema: z.ZodObject<{
130
148
  topology_type: "mirror" | "cross-cutting";
131
149
  scope_glob: string;
132
150
  deps: string[];
151
+ stable_id?: string | undefined;
152
+ identity_source?: "declared" | "derived" | undefined;
133
153
  activation?: {
134
154
  tier: "always" | "path" | "description";
135
155
  description?: string | undefined;
@@ -140,6 +160,8 @@ declare const agentsMetaSchema: z.ZodObject<{
140
160
  nodes: Record<string, unknown>;
141
161
  }>;
142
162
  declare function withDerivedAgentsMetaNodeDefaults(node: AgentsMetaNodeInput): AgentsMetaNode;
163
+ declare function deriveAgentsMetaStableId(file: string): string;
164
+ declare function deriveAgentsMetaIdentitySource(node: Pick<AgentsMetaNode, "file"> & Partial<Pick<AgentsMetaNode, "stable_id" | "identity_source">>): AgentsIdentitySource;
143
165
  declare function deriveAgentsMetaLayer(file: string): AgentsLayer;
144
166
  declare function deriveAgentsMetaTopologyType(file: string): AgentsTopologyType;
145
167
 
@@ -1414,6 +1436,8 @@ declare const metaUpdatedEventSchema: z.ZodObject<{
1414
1436
  layer: z.ZodEnum<["L0", "L1", "L2"]>;
1415
1437
  topology_type: z.ZodEnum<["mirror", "cross-cutting"]>;
1416
1438
  hash: z.ZodString;
1439
+ stable_id: z.ZodOptional<z.ZodString>;
1440
+ identity_source: z.ZodOptional<z.ZodEnum<["declared", "derived"]>>;
1417
1441
  activation: z.ZodOptional<z.ZodObject<{
1418
1442
  tier: z.ZodEnum<["always", "path", "description"]>;
1419
1443
  description: z.ZodOptional<z.ZodString>;
@@ -1432,6 +1456,8 @@ declare const metaUpdatedEventSchema: z.ZodObject<{
1432
1456
  topology_type: "mirror" | "cross-cutting";
1433
1457
  scope_glob: string;
1434
1458
  deps: string[];
1459
+ stable_id?: string | undefined;
1460
+ identity_source?: "declared" | "derived" | undefined;
1435
1461
  activation?: {
1436
1462
  tier: "always" | "path" | "description";
1437
1463
  description?: string | undefined;
@@ -1444,6 +1470,8 @@ declare const metaUpdatedEventSchema: z.ZodObject<{
1444
1470
  topology_type: "mirror" | "cross-cutting";
1445
1471
  scope_glob: string;
1446
1472
  deps: string[];
1473
+ stable_id?: string | undefined;
1474
+ identity_source?: "declared" | "derived" | undefined;
1447
1475
  activation?: {
1448
1476
  tier: "always" | "path" | "description";
1449
1477
  description?: string | undefined;
@@ -1456,6 +1484,8 @@ declare const metaUpdatedEventSchema: z.ZodObject<{
1456
1484
  topology_type: "mirror" | "cross-cutting";
1457
1485
  scope_glob: string;
1458
1486
  deps: string[];
1487
+ stable_id?: string | undefined;
1488
+ identity_source?: "declared" | "derived" | undefined;
1459
1489
  activation?: {
1460
1490
  tier: "always" | "path" | "description";
1461
1491
  description?: string | undefined;
@@ -1471,6 +1501,8 @@ declare const metaUpdatedEventSchema: z.ZodObject<{
1471
1501
  topology_type: "mirror" | "cross-cutting";
1472
1502
  scope_glob: string;
1473
1503
  deps: string[];
1504
+ stable_id?: string | undefined;
1505
+ identity_source?: "declared" | "derived" | undefined;
1474
1506
  activation?: {
1475
1507
  tier: "always" | "path" | "description";
1476
1508
  description?: string | undefined;
@@ -1492,6 +1524,8 @@ declare const metaUpdatedEventSchema: z.ZodObject<{
1492
1524
  topology_type: "mirror" | "cross-cutting";
1493
1525
  scope_glob: string;
1494
1526
  deps: string[];
1527
+ stable_id?: string | undefined;
1528
+ identity_source?: "declared" | "derived" | undefined;
1495
1529
  activation?: {
1496
1530
  tier: "always" | "path" | "description";
1497
1531
  description?: string | undefined;
@@ -2234,6 +2268,8 @@ declare const fabricEventSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
2234
2268
  layer: z.ZodEnum<["L0", "L1", "L2"]>;
2235
2269
  topology_type: z.ZodEnum<["mirror", "cross-cutting"]>;
2236
2270
  hash: z.ZodString;
2271
+ stable_id: z.ZodOptional<z.ZodString>;
2272
+ identity_source: z.ZodOptional<z.ZodEnum<["declared", "derived"]>>;
2237
2273
  activation: z.ZodOptional<z.ZodObject<{
2238
2274
  tier: z.ZodEnum<["always", "path", "description"]>;
2239
2275
  description: z.ZodOptional<z.ZodString>;
@@ -2252,6 +2288,8 @@ declare const fabricEventSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
2252
2288
  topology_type: "mirror" | "cross-cutting";
2253
2289
  scope_glob: string;
2254
2290
  deps: string[];
2291
+ stable_id?: string | undefined;
2292
+ identity_source?: "declared" | "derived" | undefined;
2255
2293
  activation?: {
2256
2294
  tier: "always" | "path" | "description";
2257
2295
  description?: string | undefined;
@@ -2264,6 +2302,8 @@ declare const fabricEventSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
2264
2302
  topology_type: "mirror" | "cross-cutting";
2265
2303
  scope_glob: string;
2266
2304
  deps: string[];
2305
+ stable_id?: string | undefined;
2306
+ identity_source?: "declared" | "derived" | undefined;
2267
2307
  activation?: {
2268
2308
  tier: "always" | "path" | "description";
2269
2309
  description?: string | undefined;
@@ -2276,6 +2316,8 @@ declare const fabricEventSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
2276
2316
  topology_type: "mirror" | "cross-cutting";
2277
2317
  scope_glob: string;
2278
2318
  deps: string[];
2319
+ stable_id?: string | undefined;
2320
+ identity_source?: "declared" | "derived" | undefined;
2279
2321
  activation?: {
2280
2322
  tier: "always" | "path" | "description";
2281
2323
  description?: string | undefined;
@@ -2291,6 +2333,8 @@ declare const fabricEventSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
2291
2333
  topology_type: "mirror" | "cross-cutting";
2292
2334
  scope_glob: string;
2293
2335
  deps: string[];
2336
+ stable_id?: string | undefined;
2337
+ identity_source?: "declared" | "derived" | undefined;
2294
2338
  activation?: {
2295
2339
  tier: "always" | "path" | "description";
2296
2340
  description?: string | undefined;
@@ -2312,6 +2356,8 @@ declare const fabricEventSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
2312
2356
  topology_type: "mirror" | "cross-cutting";
2313
2357
  scope_glob: string;
2314
2358
  deps: string[];
2359
+ stable_id?: string | undefined;
2360
+ identity_source?: "declared" | "derived" | undefined;
2315
2361
  activation?: {
2316
2362
  tier: "always" | "path" | "description";
2317
2363
  description?: string | undefined;
@@ -3039,4 +3085,4 @@ declare const fabricEventSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
3039
3085
  };
3040
3086
  }>]>;
3041
3087
 
3042
- export { AGENTS_META_LAYERS, AGENTS_META_TOPOLOGY_TYPES, AgentsLayer, AgentsMeta, AgentsMetaNode, AgentsTopologyType, type CandidateFileEntry, type CandidateFileFamily, type DriftDetectedEvent, 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 LedgerAppendedEvent, LedgerEntry, type LockApprovedEvent, type LockDriftEvent, type MetaUpdatedEvent, agentsLayerSchema, agentsMetaNodeSchema, agentsMetaSchema, agentsTopologyTypeSchema, aiLedgerEntrySchema, annotateIntentRequestSchema, auditModeSchema, candidateFileEntrySchema, clientPathsSchema, deriveAgentsMetaLayer, deriveAgentsMetaTopologyType, driftDetectedEventSchema, fabricConfigSchema, fabricEventSchema, forensicAssertionCoverageSchema, forensicAssertionSchema, forensicCodeSampleSchema, forensicEntryPointSchema, forensicEvidenceAnchorSchema, forensicFrameworkSchema, forensicReadmeSchema, forensicReportSchema, forensicSamplingBudgetSchema, forensicTopologySchema, historyStateQuerySchema, humanLedgerEntrySchema, humanLockApproveRequestSchema, humanLockEntrySchema, humanLockFileParamsSchema, humanLockFileSchema, initContextDomainGroupSchema, initContextFrameworkSchema, initContextInterviewTrailEntrySchema, initContextInvariantConfidenceSnapshotSchema, initContextInvariantSchema, initContextSchema, initContextSourceEvidenceSchema, ledgerAppendedEventSchema, ledgerEntrySchema, ledgerQuerySchema, ledgerSourceSchema, lockApprovedEventSchema, lockDriftEventSchema, metaUpdatedEventSchema, withDerivedAgentsMetaNodeDefaults };
3088
+ export { AGENTS_META_IDENTITY_SOURCES, AGENTS_META_LAYERS, AGENTS_META_TOPOLOGY_TYPES, AgentsIdentitySource, AgentsLayer, AgentsMeta, AgentsMetaNode, AgentsTopologyType, type CandidateFileEntry, type CandidateFileFamily, type DriftDetectedEvent, 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 LedgerAppendedEvent, LedgerEntry, type LockApprovedEvent, type LockDriftEvent, type MetaUpdatedEvent, agentsIdentitySourceSchema, agentsLayerSchema, agentsMetaNodeSchema, agentsMetaSchema, agentsTopologyTypeSchema, aiLedgerEntrySchema, annotateIntentRequestSchema, auditModeSchema, candidateFileEntrySchema, clientPathsSchema, deriveAgentsMetaIdentitySource, deriveAgentsMetaLayer, deriveAgentsMetaStableId, deriveAgentsMetaTopologyType, driftDetectedEventSchema, fabricConfigSchema, fabricEventSchema, forensicAssertionCoverageSchema, forensicAssertionSchema, forensicCodeSampleSchema, forensicEntryPointSchema, forensicEvidenceAnchorSchema, forensicFrameworkSchema, forensicReadmeSchema, forensicReportSchema, forensicSamplingBudgetSchema, forensicTopologySchema, historyStateQuerySchema, humanLedgerEntrySchema, humanLockApproveRequestSchema, humanLockEntrySchema, humanLockFileParamsSchema, humanLockFileSchema, initContextDomainGroupSchema, initContextFrameworkSchema, initContextInterviewTrailEntrySchema, initContextInvariantConfidenceSnapshotSchema, initContextInvariantSchema, initContextSchema, initContextSourceEvidenceSchema, ledgerAppendedEventSchema, ledgerEntrySchema, ledgerQuerySchema, ledgerSourceSchema, lockApprovedEventSchema, lockDriftEventSchema, metaUpdatedEventSchema, withDerivedAgentsMetaNodeDefaults };
package/dist/index.js CHANGED
@@ -6,7 +6,7 @@ import {
6
6
  enMessages,
7
7
  normalizeLocale,
8
8
  zhCNMessages
9
- } from "./chunk-XEVK2HU2.js";
9
+ } from "./chunk-KNZIX6IL.js";
10
10
  import "./chunk-LXNCAKJZ.js";
11
11
 
12
12
  // src/schemas/agents-meta.ts
@@ -14,8 +14,10 @@ import { z } from "zod";
14
14
  var FABRIC_AGENTS_PREFIX = ".fabric/agents/";
15
15
  var AGENTS_META_LAYERS = ["L0", "L1", "L2"];
16
16
  var AGENTS_META_TOPOLOGY_TYPES = ["mirror", "cross-cutting"];
17
+ var AGENTS_META_IDENTITY_SOURCES = ["declared", "derived"];
17
18
  var agentsLayerSchema = z.enum(AGENTS_META_LAYERS);
18
19
  var agentsTopologyTypeSchema = z.enum(AGENTS_META_TOPOLOGY_TYPES);
20
+ var agentsIdentitySourceSchema = z.enum(AGENTS_META_IDENTITY_SOURCES);
19
21
  var agentsMetaNodeBaseSchema = z.object({
20
22
  file: z.string(),
21
23
  scope_glob: z.string(),
@@ -24,6 +26,8 @@ var agentsMetaNodeBaseSchema = z.object({
24
26
  layer: agentsLayerSchema,
25
27
  topology_type: agentsTopologyTypeSchema,
26
28
  hash: z.string(),
29
+ stable_id: z.string().optional(),
30
+ identity_source: agentsIdentitySourceSchema.optional(),
27
31
  activation: z.object({
28
32
  tier: z.enum(["always", "path", "description"]),
29
33
  description: z.string().optional()
@@ -40,12 +44,30 @@ var agentsMetaSchema = z.object({
40
44
  nodes: z.record(agentsMetaNodeSchema)
41
45
  });
42
46
  function withDerivedAgentsMetaNodeDefaults(node) {
47
+ const stableId = node.stable_id ?? deriveAgentsMetaStableId(node.file);
48
+ const identitySource = deriveAgentsMetaIdentitySource(node);
43
49
  return {
44
50
  ...node,
45
51
  layer: node.layer ?? deriveAgentsMetaLayer(node.file),
46
- topology_type: node.topology_type ?? deriveAgentsMetaTopologyType(node.file)
52
+ topology_type: node.topology_type ?? deriveAgentsMetaTopologyType(node.file),
53
+ stable_id: stableId,
54
+ identity_source: identitySource
47
55
  };
48
56
  }
57
+ function deriveAgentsMetaStableId(file) {
58
+ const normalized = normalizePath(file);
59
+ if (normalized === "AGENTS.md" || normalized === ".fabric/bootstrap/README.md") {
60
+ return "bootstrap";
61
+ }
62
+ return getDepthSource(normalized).replace(/\.md$/u, "");
63
+ }
64
+ function deriveAgentsMetaIdentitySource(node) {
65
+ if (node.identity_source !== void 0) {
66
+ return node.identity_source;
67
+ }
68
+ const derivedStableId = deriveAgentsMetaStableId(node.file);
69
+ return node.stable_id !== void 0 && node.stable_id !== derivedStableId ? "declared" : "derived";
70
+ }
49
71
  function deriveAgentsMetaLayer(file) {
50
72
  const normalized = normalizePath(file);
51
73
  if (normalized === "AGENTS.md" || normalized === ".fabric/bootstrap/README.md") {
@@ -359,9 +381,11 @@ var fabricEventSchema = z8.discriminatedUnion("type", [
359
381
  driftDetectedEventSchema
360
382
  ]);
361
383
  export {
384
+ AGENTS_META_IDENTITY_SOURCES,
362
385
  AGENTS_META_LAYERS,
363
386
  AGENTS_META_TOPOLOGY_TYPES,
364
387
  PROTECTED_TOKENS,
388
+ agentsIdentitySourceSchema,
365
389
  agentsLayerSchema,
366
390
  agentsMetaNodeSchema,
367
391
  agentsMetaSchema,
@@ -373,7 +397,9 @@ export {
373
397
  clientPathsSchema,
374
398
  createTranslator,
375
399
  defaultMessages,
400
+ deriveAgentsMetaIdentitySource,
376
401
  deriveAgentsMetaLayer,
402
+ deriveAgentsMetaStableId,
377
403
  deriveAgentsMetaTopologyType,
378
404
  detectNodeLocale,
379
405
  driftDetectedEventSchema,
@@ -1,6 +1,7 @@
1
1
  type AgentsLayer = "L0" | "L1" | "L2";
2
2
  type AgentsTopologyType = "mirror" | "cross-cutting";
3
3
  type AgentsActivationTier = "always" | "path" | "description";
4
+ type AgentsIdentitySource = "declared" | "derived";
4
5
  interface AgentsMetaNodeActivation {
5
6
  tier: AgentsActivationTier;
6
7
  description?: string;
@@ -13,6 +14,8 @@ interface AgentsMetaNode {
13
14
  layer: AgentsLayer;
14
15
  topology_type: AgentsTopologyType;
15
16
  hash: string;
17
+ stable_id?: string;
18
+ identity_source?: AgentsIdentitySource;
16
19
  activation?: AgentsMetaNodeActivation;
17
20
  }
18
21
  interface AgentsMeta {
@@ -65,4 +68,4 @@ interface FabricConfig {
65
68
  audit_mode?: AuditMode;
66
69
  }
67
70
 
68
- export type { AgentsActivationTier, AgentsLayer, AgentsMeta, AgentsMetaNode, AgentsMetaNodeActivation, AgentsTopologyType, AiLedgerEntry, AuditMode, ClientPaths, FabricConfig, HumanLedgerEntry, HumanLockEntry, LedgerEntry };
71
+ export type { AgentsActivationTier, AgentsIdentitySource, AgentsLayer, AgentsMeta, AgentsMetaNode, AgentsMetaNodeActivation, AgentsTopologyType, AiLedgerEntry, AuditMode, ClientPaths, FabricConfig, HumanLedgerEntry, HumanLockEntry, LedgerEntry };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fenglimg/fabric-shared",
3
- "version": "1.5.1",
3
+ "version": "1.5.2",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",