@fenglimg/fabric-shared 2.3.0-rc.4 → 2.3.0-rc.5

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/index.js CHANGED
@@ -16,7 +16,7 @@ import {
16
16
  enMessages,
17
17
  resolveFabricLocale,
18
18
  zhCNMessages
19
- } from "./chunk-LDFQYCY7.js";
19
+ } from "./chunk-P6INRP3A.js";
20
20
  import {
21
21
  GLOBAL_BINDINGS_DIR,
22
22
  GLOBAL_STATE_DIR,
@@ -116,7 +116,7 @@ import {
116
116
  scopeCoordinateSchema,
117
117
  scopeRoot,
118
118
  structuredWarningSchema
119
- } from "./chunk-7PS7LB5T.js";
119
+ } from "./chunk-PPV5IQGX.js";
120
120
 
121
121
  // src/schemas/agents-meta.ts
122
122
  import { z } from "zod";
@@ -138,7 +138,6 @@ var ruleDescriptionSchema = z.object({
138
138
  tech_stack: z.array(z.string()),
139
139
  impact: z.array(z.string()),
140
140
  must_read_if: z.string(),
141
- entities: z.array(z.string()).optional(),
142
141
  // v2.0 knowledge entry fields (TASK-002 schemas). All optional for backward compat.
143
142
  id: z.string().optional(),
144
143
  // rc.31 NEW-1: forward-compat for legacy on-disk agents.meta.json carrying
@@ -151,8 +150,8 @@ var ruleDescriptionSchema = z.object({
151
150
  z.enum(["models", "decisions", "guidelines", "pitfalls", "processes"])
152
151
  ).optional(),
153
152
  maturity: z.enum(["draft", "verified", "proven"]).optional(),
154
- knowledge_layer: z.enum(["personal", "team"]).optional(),
155
- layer_reason: z.string().optional(),
153
+ // W4/Track1: `knowledge_layer` removed — an entry's layer is derived from its
154
+ // stable_id prefix (KP-→personal, else team; KT-DEC-0004), never a field.
156
155
  created_at: z.string().optional(),
157
156
  // v2/rc.2: flat flow-style YAML array; populated by init-scan from forensic tech stack and editable by user. Used by rc.3 review skill for tag-filter search.
158
157
  tags: z.array(z.string()).default([]).optional(),
@@ -612,12 +611,37 @@ var fabricConfigSchema = z5.object({
612
611
  // banner silently truncates. Default 50; range 20..500 (read inline by
613
612
  // knowledge-hint-broad.cjs#readBroadIndexBackstop with the same bounds).
614
613
  broad_index_backstop: z5.number().int().min(20).max(500).optional().default(50),
615
- // v2.0.0-rc.37 NEW-16: durable per-signal dismiss for the fabric-hint Stop
616
- // hook nudges. Any signal type listed here is suppressed at emit time across
614
+ // v2.0.0-rc.37 NEW-16: durable per-signal dismiss for the fabric-hint hook
615
+ // nudges. Any signal type listed here is suppressed at emit time across
617
616
  // all sessions (the session-scoped sibling lives in a .fabric/.cache sidecar
618
617
  // written on request). Mirrors the cite_evict_interval=0 opt-out convention —
619
618
  // a knob for an existing surface, not a new feature. Unknown types ignored.
620
- hint_dismiss_signals: z5.array(z5.enum(["archive", "review", "import", "maintenance"])).optional(),
619
+ //
620
+ // TASK-005 (grill G5 / C-004 "全 nudge MUST 可 dismiss"): the enum now spans
621
+ // ALL nudge surfaces, not just the fabric-hint Stop signals:
622
+ // - Stop (fabric-hint): archive / review / import / maintenance
623
+ // - SessionStart (broad): review / import / maintenance now surface as
624
+ // the SessionStart summary line (see
625
+ // buildSessionStartSinks H4 ladder) — the same
626
+ // dismiss key silences them there too.
627
+ // - PreToolUse (per-edit): "narrow" (knowledge-hint-narrow) and
628
+ // "cite-evict" (cite-before-edit nudge).
629
+ // C-004 semantics are enforced at the trigger sites, NOT here: "narrow"
630
+ // defaults ON (impact-bearing) and "cite-evict" defaults OFF-able; listing
631
+ // either key here is the durable opt-out. Adding enum values is backward
632
+ // compatible — legacy configs that omit the new keys parse unchanged, and
633
+ // unknown on-disk values are dropped by the lenient root parser.
634
+ hint_dismiss_signals: z5.array(
635
+ z5.enum([
636
+ "archive",
637
+ "review",
638
+ "import",
639
+ "maintenance",
640
+ // per-edit (PreToolUse) nudge surfaces — TASK-005
641
+ "narrow",
642
+ "cite-evict"
643
+ ])
644
+ ).optional(),
621
645
  // v2.1 ADJ-NEWN-4: user-override escape hatches for the two strong behavioral
622
646
  // policies (cite-before-edit + self-archive). The strong policies can make an
623
647
  // agent feel like a "stubborn parrot" (D2 user-in-control red line); these
@@ -1569,6 +1593,7 @@ import { execFile } from "child_process";
1569
1593
  import { access, mkdir, readdir, readFile as readFile2, writeFile } from "fs/promises";
1570
1594
  import { join as join2 } from "path";
1571
1595
  import { promisify } from "util";
1596
+ var STORE_PROJECTS_DIR = "projects";
1572
1597
  var STORE_PENDING_DIR = "pending";
1573
1598
  var STORE_GITIGNORE = [
1574
1599
  "# v2.1 store \u2014 volatile / derived data is never committed",
@@ -1622,12 +1647,28 @@ async function listMarkdown(dir) {
1622
1647
  return entries.filter((name) => name.endsWith(".md")).sort().map((name) => join2(dir, name));
1623
1648
  }
1624
1649
  async function listStoreKnowledge(store) {
1650
+ const knowledgeDir = join2(store.dir, STORE_LAYOUT.knowledgeDir);
1625
1651
  const refs = [];
1626
1652
  for (const type of STORE_KNOWLEDGE_TYPE_DIRS) {
1627
- for (const file of await listMarkdown(join2(store.dir, STORE_LAYOUT.knowledgeDir, type))) {
1653
+ for (const file of await listMarkdown(join2(knowledgeDir, type))) {
1628
1654
  refs.push({ store_uuid: store.store_uuid, alias: store.alias, type, file });
1629
1655
  }
1630
1656
  }
1657
+ let projectEntries;
1658
+ try {
1659
+ projectEntries = await readdir(join2(knowledgeDir, STORE_PROJECTS_DIR));
1660
+ } catch {
1661
+ return refs;
1662
+ }
1663
+ const reserved = /* @__PURE__ */ new Set([STORE_PROJECTS_DIR, ...STORE_KNOWLEDGE_TYPE_DIRS]);
1664
+ const projectIds = projectEntries.filter((id) => STORE_PROJECT_ID_PATTERN.test(id) && !reserved.has(id)).sort();
1665
+ for (const project of projectIds) {
1666
+ for (const type of STORE_KNOWLEDGE_TYPE_DIRS) {
1667
+ for (const file of await listMarkdown(join2(knowledgeDir, STORE_PROJECTS_DIR, project, type))) {
1668
+ refs.push({ store_uuid: store.store_uuid, alias: store.alias, type, file, project });
1669
+ }
1670
+ }
1671
+ }
1631
1672
  return refs;
1632
1673
  }
1633
1674
  async function readKnowledgeAcrossStores(stores) {
@@ -94,12 +94,9 @@ declare const planContextOutputSchema: z.ZodObject<{
94
94
  tech_stack: z.ZodArray<z.ZodString, "many">;
95
95
  impact: z.ZodArray<z.ZodString, "many">;
96
96
  must_read_if: z.ZodString;
97
- entities: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
98
97
  id: z.ZodOptional<z.ZodString>;
99
98
  knowledge_type: z.ZodOptional<z.ZodEnum<["models", "decisions", "guidelines", "pitfalls", "processes"]>>;
100
99
  maturity: z.ZodOptional<z.ZodEnum<["draft", "verified", "proven"]>>;
101
- knowledge_layer: z.ZodOptional<z.ZodEnum<["personal", "team"]>>;
102
- layer_reason: z.ZodOptional<z.ZodString>;
103
100
  created_at: z.ZodOptional<z.ZodString>;
104
101
  tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
105
102
  relevance_scope: z.ZodOptional<z.ZodEnum<["narrow", "broad"]>>;
@@ -115,11 +112,8 @@ declare const planContextOutputSchema: z.ZodObject<{
115
112
  id?: string | undefined;
116
113
  relevance_scope?: "narrow" | "broad" | undefined;
117
114
  relevance_paths?: string[] | undefined;
118
- entities?: string[] | undefined;
119
115
  knowledge_type?: "models" | "decisions" | "guidelines" | "pitfalls" | "processes" | undefined;
120
116
  maturity?: "draft" | "verified" | "proven" | undefined;
121
- knowledge_layer?: "personal" | "team" | undefined;
122
- layer_reason?: string | undefined;
123
117
  tags?: string[] | undefined;
124
118
  related?: string[] | undefined;
125
119
  }, {
@@ -132,11 +126,8 @@ declare const planContextOutputSchema: z.ZodObject<{
132
126
  id?: string | undefined;
133
127
  relevance_scope?: "narrow" | "broad" | undefined;
134
128
  relevance_paths?: string[] | undefined;
135
- entities?: string[] | undefined;
136
129
  knowledge_type?: "models" | "decisions" | "guidelines" | "pitfalls" | "processes" | undefined;
137
130
  maturity?: "draft" | "verified" | "proven" | undefined;
138
- knowledge_layer?: "personal" | "team" | undefined;
139
- layer_reason?: string | undefined;
140
131
  tags?: string[] | undefined;
141
132
  related?: string[] | undefined;
142
133
  }>;
@@ -152,11 +143,8 @@ declare const planContextOutputSchema: z.ZodObject<{
152
143
  id?: string | undefined;
153
144
  relevance_scope?: "narrow" | "broad" | undefined;
154
145
  relevance_paths?: string[] | undefined;
155
- entities?: string[] | undefined;
156
146
  knowledge_type?: "models" | "decisions" | "guidelines" | "pitfalls" | "processes" | undefined;
157
147
  maturity?: "draft" | "verified" | "proven" | undefined;
158
- knowledge_layer?: "personal" | "team" | undefined;
159
- layer_reason?: string | undefined;
160
148
  tags?: string[] | undefined;
161
149
  related?: string[] | undefined;
162
150
  };
@@ -173,11 +161,8 @@ declare const planContextOutputSchema: z.ZodObject<{
173
161
  id?: string | undefined;
174
162
  relevance_scope?: "narrow" | "broad" | undefined;
175
163
  relevance_paths?: string[] | undefined;
176
- entities?: string[] | undefined;
177
164
  knowledge_type?: "models" | "decisions" | "guidelines" | "pitfalls" | "processes" | undefined;
178
165
  maturity?: "draft" | "verified" | "proven" | undefined;
179
- knowledge_layer?: "personal" | "team" | undefined;
180
- layer_reason?: string | undefined;
181
166
  tags?: string[] | undefined;
182
167
  related?: string[] | undefined;
183
168
  };
@@ -259,11 +244,8 @@ declare const planContextOutputSchema: z.ZodObject<{
259
244
  id?: string | undefined;
260
245
  relevance_scope?: "narrow" | "broad" | undefined;
261
246
  relevance_paths?: string[] | undefined;
262
- entities?: string[] | undefined;
263
247
  knowledge_type?: "models" | "decisions" | "guidelines" | "pitfalls" | "processes" | undefined;
264
248
  maturity?: "draft" | "verified" | "proven" | undefined;
265
- knowledge_layer?: "personal" | "team" | undefined;
266
- layer_reason?: string | undefined;
267
249
  tags?: string[] | undefined;
268
250
  related?: string[] | undefined;
269
251
  };
@@ -316,11 +298,8 @@ declare const planContextOutputSchema: z.ZodObject<{
316
298
  id?: string | undefined;
317
299
  relevance_scope?: "narrow" | "broad" | undefined;
318
300
  relevance_paths?: string[] | undefined;
319
- entities?: string[] | undefined;
320
301
  knowledge_type?: "models" | "decisions" | "guidelines" | "pitfalls" | "processes" | undefined;
321
302
  maturity?: "draft" | "verified" | "proven" | undefined;
322
- knowledge_layer?: "personal" | "team" | undefined;
323
- layer_reason?: string | undefined;
324
303
  tags?: string[] | undefined;
325
304
  related?: string[] | undefined;
326
305
  };
@@ -364,17 +343,20 @@ declare const planContextHintNarrowEntrySchema: z.ZodObject<{
364
343
  maturity: z.ZodString;
365
344
  summary: z.ZodString;
366
345
  must_read_if: z.ZodOptional<z.ZodString>;
346
+ impact: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
367
347
  }, "strip", z.ZodTypeAny, {
368
348
  type: string;
369
349
  id: string;
370
350
  summary: string;
371
351
  maturity: string;
352
+ impact?: string[] | undefined;
372
353
  must_read_if?: string | undefined;
373
354
  }, {
374
355
  type: string;
375
356
  id: string;
376
357
  summary: string;
377
358
  maturity: string;
359
+ impact?: string[] | undefined;
378
360
  must_read_if?: string | undefined;
379
361
  }>;
380
362
  declare const planContextHintOutputSchema: z.ZodObject<{
@@ -387,17 +369,20 @@ declare const planContextHintOutputSchema: z.ZodObject<{
387
369
  maturity: z.ZodString;
388
370
  summary: z.ZodString;
389
371
  must_read_if: z.ZodOptional<z.ZodString>;
372
+ impact: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
390
373
  }, "strip", z.ZodTypeAny, {
391
374
  type: string;
392
375
  id: string;
393
376
  summary: string;
394
377
  maturity: string;
378
+ impact?: string[] | undefined;
395
379
  must_read_if?: string | undefined;
396
380
  }, {
397
381
  type: string;
398
382
  id: string;
399
383
  summary: string;
400
384
  maturity: string;
385
+ impact?: string[] | undefined;
401
386
  must_read_if?: string | undefined;
402
387
  }>, "many">;
403
388
  broad_count: z.ZodNumber;
@@ -407,6 +392,7 @@ declare const planContextHintOutputSchema: z.ZodObject<{
407
392
  id: string;
408
393
  summary: string;
409
394
  maturity: string;
395
+ impact?: string[] | undefined;
410
396
  must_read_if?: string | undefined;
411
397
  }[];
412
398
  target_paths: string[];
@@ -419,6 +405,7 @@ declare const planContextHintOutputSchema: z.ZodObject<{
419
405
  id: string;
420
406
  summary: string;
421
407
  maturity: string;
408
+ impact?: string[] | undefined;
422
409
  must_read_if?: string | undefined;
423
410
  }[];
424
411
  target_paths: string[];
@@ -611,12 +598,9 @@ declare const recallOutputSchema: z.ZodObject<{
611
598
  tech_stack: z.ZodArray<z.ZodString, "many">;
612
599
  impact: z.ZodArray<z.ZodString, "many">;
613
600
  must_read_if: z.ZodString;
614
- entities: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
615
601
  id: z.ZodOptional<z.ZodString>;
616
602
  knowledge_type: z.ZodOptional<z.ZodEnum<["models", "decisions", "guidelines", "pitfalls", "processes"]>>;
617
603
  maturity: z.ZodOptional<z.ZodEnum<["draft", "verified", "proven"]>>;
618
- knowledge_layer: z.ZodOptional<z.ZodEnum<["personal", "team"]>>;
619
- layer_reason: z.ZodOptional<z.ZodString>;
620
604
  created_at: z.ZodOptional<z.ZodString>;
621
605
  tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
622
606
  relevance_scope: z.ZodOptional<z.ZodEnum<["narrow", "broad"]>>;
@@ -632,11 +616,8 @@ declare const recallOutputSchema: z.ZodObject<{
632
616
  id?: string | undefined;
633
617
  relevance_scope?: "narrow" | "broad" | undefined;
634
618
  relevance_paths?: string[] | undefined;
635
- entities?: string[] | undefined;
636
619
  knowledge_type?: "models" | "decisions" | "guidelines" | "pitfalls" | "processes" | undefined;
637
620
  maturity?: "draft" | "verified" | "proven" | undefined;
638
- knowledge_layer?: "personal" | "team" | undefined;
639
- layer_reason?: string | undefined;
640
621
  tags?: string[] | undefined;
641
622
  related?: string[] | undefined;
642
623
  }, {
@@ -649,11 +630,8 @@ declare const recallOutputSchema: z.ZodObject<{
649
630
  id?: string | undefined;
650
631
  relevance_scope?: "narrow" | "broad" | undefined;
651
632
  relevance_paths?: string[] | undefined;
652
- entities?: string[] | undefined;
653
633
  knowledge_type?: "models" | "decisions" | "guidelines" | "pitfalls" | "processes" | undefined;
654
634
  maturity?: "draft" | "verified" | "proven" | undefined;
655
- knowledge_layer?: "personal" | "team" | undefined;
656
- layer_reason?: string | undefined;
657
635
  tags?: string[] | undefined;
658
636
  related?: string[] | undefined;
659
637
  }>;
@@ -706,11 +684,8 @@ declare const recallOutputSchema: z.ZodObject<{
706
684
  id?: string | undefined;
707
685
  relevance_scope?: "narrow" | "broad" | undefined;
708
686
  relevance_paths?: string[] | undefined;
709
- entities?: string[] | undefined;
710
687
  knowledge_type?: "models" | "decisions" | "guidelines" | "pitfalls" | "processes" | undefined;
711
688
  maturity?: "draft" | "verified" | "proven" | undefined;
712
- knowledge_layer?: "personal" | "team" | undefined;
713
- layer_reason?: string | undefined;
714
689
  tags?: string[] | undefined;
715
690
  related?: string[] | undefined;
716
691
  };
@@ -743,11 +718,8 @@ declare const recallOutputSchema: z.ZodObject<{
743
718
  id?: string | undefined;
744
719
  relevance_scope?: "narrow" | "broad" | undefined;
745
720
  relevance_paths?: string[] | undefined;
746
- entities?: string[] | undefined;
747
721
  knowledge_type?: "models" | "decisions" | "guidelines" | "pitfalls" | "processes" | undefined;
748
722
  maturity?: "draft" | "verified" | "proven" | undefined;
749
- knowledge_layer?: "personal" | "team" | undefined;
750
- layer_reason?: string | undefined;
751
723
  tags?: string[] | undefined;
752
724
  related?: string[] | undefined;
753
725
  };
@@ -837,11 +809,8 @@ declare const recallOutputSchema: z.ZodObject<{
837
809
  id?: string | undefined;
838
810
  relevance_scope?: "narrow" | "broad" | undefined;
839
811
  relevance_paths?: string[] | undefined;
840
- entities?: string[] | undefined;
841
812
  knowledge_type?: "models" | "decisions" | "guidelines" | "pitfalls" | "processes" | undefined;
842
813
  maturity?: "draft" | "verified" | "proven" | undefined;
843
- knowledge_layer?: "personal" | "team" | undefined;
844
- layer_reason?: string | undefined;
845
814
  tags?: string[] | undefined;
846
815
  related?: string[] | undefined;
847
816
  };
@@ -903,11 +872,8 @@ declare const recallOutputSchema: z.ZodObject<{
903
872
  id?: string | undefined;
904
873
  relevance_scope?: "narrow" | "broad" | undefined;
905
874
  relevance_paths?: string[] | undefined;
906
- entities?: string[] | undefined;
907
875
  knowledge_type?: "models" | "decisions" | "guidelines" | "pitfalls" | "processes" | undefined;
908
876
  maturity?: "draft" | "verified" | "proven" | undefined;
909
- knowledge_layer?: "personal" | "team" | undefined;
910
- layer_reason?: string | undefined;
911
877
  tags?: string[] | undefined;
912
878
  related?: string[] | undefined;
913
879
  };
@@ -2594,7 +2560,6 @@ declare const KnowledgeEntryFrontmatterSchema: z.ZodObject<{
2594
2560
  type: z.ZodEnum<["models", "decisions", "guidelines", "pitfalls", "processes"]>;
2595
2561
  maturity: z.ZodEnum<["draft", "verified", "proven"]>;
2596
2562
  layer: z.ZodEnum<["personal", "team"]>;
2597
- layer_reason: z.ZodOptional<z.ZodString>;
2598
2563
  created_at: z.ZodString;
2599
2564
  }, "strip", z.ZodTypeAny, {
2600
2565
  created_at: string;
@@ -2602,14 +2567,12 @@ declare const KnowledgeEntryFrontmatterSchema: z.ZodObject<{
2602
2567
  id: string;
2603
2568
  layer: "personal" | "team";
2604
2569
  maturity: "draft" | "verified" | "proven";
2605
- layer_reason?: string | undefined;
2606
2570
  }, {
2607
2571
  created_at: string;
2608
2572
  type: "models" | "decisions" | "guidelines" | "pitfalls" | "processes";
2609
2573
  id: string;
2610
2574
  layer: "personal" | "team";
2611
2575
  maturity: "draft" | "verified" | "proven";
2612
- layer_reason?: string | undefined;
2613
2576
  }>;
2614
2577
  type KnowledgeEntryFrontmatter = z.infer<typeof KnowledgeEntryFrontmatterSchema>;
2615
2578
  declare const KNOWLEDGE_TYPE_CODES: {
@@ -47,7 +47,7 @@ import {
47
47
  recallInputSchema,
48
48
  recallOutputSchema,
49
49
  structuredWarningSchema
50
- } from "../chunk-7PS7LB5T.js";
50
+ } from "../chunk-PPV5IQGX.js";
51
51
  export {
52
52
  FabExtractKnowledgeInputSchema,
53
53
  FabExtractKnowledgeInputShape,
@@ -1,2 +1,2 @@
1
- export { a as AgentsIdentitySource, d as AgentsMeta, e as AgentsMetaCountersEnvelope, g as AgentsMetaKnowledgeTypeCounters, A as AgentsMetaNode, b as AgentsTopologyType, h as AiLedgerEntry, i as AuditMode, C as ClientPaths, D as DefaultLayerFilter, F as FabricConfig, j as FabricLanguage, m as HumanLedgerEntry, H as HumanLockEntry, L as LedgerEntry, n as McpPayloadLimits, o as RecallScore, p as RecallScoreBreakdown, q as RuleDescription, r as RuleDescriptionIndexItem } from '../index-C0cijMSw.js';
1
+ export { a as AgentsIdentitySource, d as AgentsMeta, e as AgentsMetaCountersEnvelope, g as AgentsMetaKnowledgeTypeCounters, A as AgentsMetaNode, b as AgentsTopologyType, h as AiLedgerEntry, i as AuditMode, C as ClientPaths, D as DefaultLayerFilter, F as FabricConfig, j as FabricLanguage, m as HumanLedgerEntry, H as HumanLockEntry, L as LedgerEntry, n as McpPayloadLimits, o as RecallScore, p as RecallScoreBreakdown, q as RuleDescription, r as RuleDescriptionIndexItem } from '../index-Ba3sXdL4.js';
2
2
  import 'zod';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fenglimg/fabric-shared",
3
- "version": "2.3.0-rc.4",
3
+ "version": "2.3.0-rc.5",
4
4
  "description": "Fabric shared types — Zod schemas, i18n, atomic-write helpers, MCP payload guard, error classes. Consumed by @fenglimg/fabric-server + @fenglimg/fabric-cli.",
5
5
  "license": "MIT",
6
6
  "author": "wangzhichao <fenglimg90@gmail.com>",