@fenglimg/fabric-shared 1.5.0 → 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-3W2DKFJZ.js → chunk-KNZIX6IL.js} +78 -76
- package/dist/i18n/index.d.ts +1 -1
- package/dist/i18n/index.js +1 -1
- package/dist/index.d.ts +432 -44
- package/dist/index.js +52 -5
- package/dist/types/index.d.ts +23 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -6,28 +6,50 @@ import {
|
|
|
6
6
|
enMessages,
|
|
7
7
|
normalizeLocale,
|
|
8
8
|
zhCNMessages
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-KNZIX6IL.js";
|
|
10
10
|
import "./chunk-LXNCAKJZ.js";
|
|
11
11
|
|
|
12
12
|
// src/schemas/agents-meta.ts
|
|
13
13
|
import { z } from "zod";
|
|
14
14
|
var FABRIC_AGENTS_PREFIX = ".fabric/agents/";
|
|
15
15
|
var AGENTS_META_LAYERS = ["L0", "L1", "L2"];
|
|
16
|
-
var AGENTS_META_TOPOLOGY_TYPES = ["mirror", "cross-cutting"];
|
|
16
|
+
var AGENTS_META_TOPOLOGY_TYPES = ["mirror", "cross-cutting", "domain", "local", "global"];
|
|
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);
|
|
21
|
+
var ruleDescriptionSchema = z.object({
|
|
22
|
+
summary: z.string(),
|
|
23
|
+
intent_clues: z.array(z.string()),
|
|
24
|
+
tech_stack: z.array(z.string()),
|
|
25
|
+
impact: z.array(z.string()),
|
|
26
|
+
must_read_if: z.string(),
|
|
27
|
+
entities: z.array(z.string()).optional()
|
|
28
|
+
}).strict();
|
|
29
|
+
var ruleDescriptionIndexItemSchema = z.object({
|
|
30
|
+
stable_id: z.string(),
|
|
31
|
+
level: agentsLayerSchema,
|
|
32
|
+
required: z.boolean(),
|
|
33
|
+
selectable: z.boolean(),
|
|
34
|
+
description: ruleDescriptionSchema
|
|
35
|
+
}).strict();
|
|
19
36
|
var agentsMetaNodeBaseSchema = z.object({
|
|
20
37
|
file: z.string(),
|
|
38
|
+
content_ref: z.string().optional(),
|
|
21
39
|
scope_glob: z.string(),
|
|
22
40
|
deps: z.array(z.string()),
|
|
23
41
|
priority: z.enum(["high", "medium", "low"]),
|
|
42
|
+
level: agentsLayerSchema.optional(),
|
|
24
43
|
layer: agentsLayerSchema,
|
|
25
44
|
topology_type: agentsTopologyTypeSchema,
|
|
26
45
|
hash: z.string(),
|
|
46
|
+
stable_id: z.string().optional(),
|
|
47
|
+
identity_source: agentsIdentitySourceSchema.optional(),
|
|
27
48
|
activation: z.object({
|
|
28
49
|
tier: z.enum(["always", "path", "description"]),
|
|
29
50
|
description: z.string().optional()
|
|
30
|
-
}).optional()
|
|
51
|
+
}).optional(),
|
|
52
|
+
description: ruleDescriptionSchema.optional()
|
|
31
53
|
});
|
|
32
54
|
var agentsMetaNodeSchema = z.preprocess((value) => {
|
|
33
55
|
if (!isRecord(value) || typeof value.file !== "string") {
|
|
@@ -40,12 +62,31 @@ var agentsMetaSchema = z.object({
|
|
|
40
62
|
nodes: z.record(agentsMetaNodeSchema)
|
|
41
63
|
});
|
|
42
64
|
function withDerivedAgentsMetaNodeDefaults(node) {
|
|
65
|
+
const stableId = node.stable_id ?? deriveAgentsMetaStableId(node.file);
|
|
66
|
+
const identitySource = deriveAgentsMetaIdentitySource(node);
|
|
43
67
|
return {
|
|
44
68
|
...node,
|
|
45
|
-
layer: node.layer ?? deriveAgentsMetaLayer(node.file),
|
|
46
|
-
|
|
69
|
+
layer: node.layer ?? node.level ?? deriveAgentsMetaLayer(node.file),
|
|
70
|
+
level: node.level ?? node.layer ?? deriveAgentsMetaLayer(node.file),
|
|
71
|
+
topology_type: node.topology_type ?? deriveAgentsMetaTopologyType(node.file),
|
|
72
|
+
stable_id: stableId,
|
|
73
|
+
identity_source: identitySource
|
|
47
74
|
};
|
|
48
75
|
}
|
|
76
|
+
function deriveAgentsMetaStableId(file) {
|
|
77
|
+
const normalized = normalizePath(file);
|
|
78
|
+
if (normalized === "AGENTS.md" || normalized === ".fabric/bootstrap/README.md") {
|
|
79
|
+
return "bootstrap";
|
|
80
|
+
}
|
|
81
|
+
return getDepthSource(normalized).replace(/\.md$/u, "");
|
|
82
|
+
}
|
|
83
|
+
function deriveAgentsMetaIdentitySource(node) {
|
|
84
|
+
if (node.identity_source !== void 0) {
|
|
85
|
+
return node.identity_source;
|
|
86
|
+
}
|
|
87
|
+
const derivedStableId = deriveAgentsMetaStableId(node.file);
|
|
88
|
+
return node.stable_id !== void 0 && node.stable_id !== derivedStableId ? "declared" : "derived";
|
|
89
|
+
}
|
|
49
90
|
function deriveAgentsMetaLayer(file) {
|
|
50
91
|
const normalized = normalizePath(file);
|
|
51
92
|
if (normalized === "AGENTS.md" || normalized === ".fabric/bootstrap/README.md") {
|
|
@@ -359,9 +400,11 @@ var fabricEventSchema = z8.discriminatedUnion("type", [
|
|
|
359
400
|
driftDetectedEventSchema
|
|
360
401
|
]);
|
|
361
402
|
export {
|
|
403
|
+
AGENTS_META_IDENTITY_SOURCES,
|
|
362
404
|
AGENTS_META_LAYERS,
|
|
363
405
|
AGENTS_META_TOPOLOGY_TYPES,
|
|
364
406
|
PROTECTED_TOKENS,
|
|
407
|
+
agentsIdentitySourceSchema,
|
|
365
408
|
agentsLayerSchema,
|
|
366
409
|
agentsMetaNodeSchema,
|
|
367
410
|
agentsMetaSchema,
|
|
@@ -373,7 +416,9 @@ export {
|
|
|
373
416
|
clientPathsSchema,
|
|
374
417
|
createTranslator,
|
|
375
418
|
defaultMessages,
|
|
419
|
+
deriveAgentsMetaIdentitySource,
|
|
376
420
|
deriveAgentsMetaLayer,
|
|
421
|
+
deriveAgentsMetaStableId,
|
|
377
422
|
deriveAgentsMetaTopologyType,
|
|
378
423
|
detectNodeLocale,
|
|
379
424
|
driftDetectedEventSchema,
|
|
@@ -411,6 +456,8 @@ export {
|
|
|
411
456
|
lockDriftEventSchema,
|
|
412
457
|
metaUpdatedEventSchema,
|
|
413
458
|
normalizeLocale,
|
|
459
|
+
ruleDescriptionIndexItemSchema,
|
|
460
|
+
ruleDescriptionSchema,
|
|
414
461
|
withDerivedAgentsMetaNodeDefaults,
|
|
415
462
|
zhCNMessages
|
|
416
463
|
};
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,19 +1,40 @@
|
|
|
1
1
|
type AgentsLayer = "L0" | "L1" | "L2";
|
|
2
|
-
type AgentsTopologyType = "mirror" | "cross-cutting";
|
|
2
|
+
type AgentsTopologyType = "mirror" | "cross-cutting" | "domain" | "local" | "global";
|
|
3
3
|
type AgentsActivationTier = "always" | "path" | "description";
|
|
4
|
+
type AgentsIdentitySource = "declared" | "derived";
|
|
5
|
+
interface RuleDescription {
|
|
6
|
+
summary: string;
|
|
7
|
+
intent_clues: string[];
|
|
8
|
+
tech_stack: string[];
|
|
9
|
+
impact: string[];
|
|
10
|
+
must_read_if: string;
|
|
11
|
+
entities?: string[];
|
|
12
|
+
}
|
|
13
|
+
interface RuleDescriptionIndexItem {
|
|
14
|
+
stable_id: string;
|
|
15
|
+
level: AgentsLayer;
|
|
16
|
+
required: boolean;
|
|
17
|
+
selectable: boolean;
|
|
18
|
+
description: RuleDescription;
|
|
19
|
+
}
|
|
4
20
|
interface AgentsMetaNodeActivation {
|
|
5
21
|
tier: AgentsActivationTier;
|
|
6
22
|
description?: string;
|
|
7
23
|
}
|
|
8
24
|
interface AgentsMetaNode {
|
|
9
25
|
file: string;
|
|
26
|
+
content_ref?: string;
|
|
10
27
|
scope_glob: string;
|
|
11
28
|
deps: string[];
|
|
12
29
|
priority: "high" | "medium" | "low";
|
|
30
|
+
level?: AgentsLayer;
|
|
13
31
|
layer: AgentsLayer;
|
|
14
32
|
topology_type: AgentsTopologyType;
|
|
15
33
|
hash: string;
|
|
34
|
+
stable_id?: string;
|
|
35
|
+
identity_source?: AgentsIdentitySource;
|
|
16
36
|
activation?: AgentsMetaNodeActivation;
|
|
37
|
+
description?: RuleDescription;
|
|
17
38
|
}
|
|
18
39
|
interface AgentsMeta {
|
|
19
40
|
revision: string;
|
|
@@ -65,4 +86,4 @@ interface FabricConfig {
|
|
|
65
86
|
audit_mode?: AuditMode;
|
|
66
87
|
}
|
|
67
88
|
|
|
68
|
-
export type { AgentsActivationTier, AgentsLayer, AgentsMeta, AgentsMetaNode, AgentsMetaNodeActivation, AgentsTopologyType, AiLedgerEntry, AuditMode, ClientPaths, FabricConfig, HumanLedgerEntry, HumanLockEntry, LedgerEntry };
|
|
89
|
+
export type { AgentsActivationTier, AgentsIdentitySource, AgentsLayer, AgentsMeta, AgentsMetaNode, AgentsMetaNodeActivation, AgentsTopologyType, AiLedgerEntry, AuditMode, ClientPaths, FabricConfig, HumanLedgerEntry, HumanLockEntry, LedgerEntry, RuleDescription, RuleDescriptionIndexItem };
|