@fenglimg/fabric-shared 2.0.0-rc.29 → 2.0.0-rc.33
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-225L7D4T.js → chunk-Z7UPW75I.js} +122 -32
- package/dist/i18n/index.js +1 -1
- package/dist/index-Crx0-0-9.d.ts +301 -0
- package/dist/index.d.ts +54 -210
- package/dist/index.js +98 -14
- package/dist/schemas/api-contracts.d.ts +84 -84
- package/dist/types/index.d.ts +2 -122
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,4 +1,12 @@
|
|
|
1
|
-
import
|
|
1
|
+
import {
|
|
2
|
+
BOOTSTRAP_CANONICAL,
|
|
3
|
+
BOOTSTRAP_MARKER_BEGIN,
|
|
4
|
+
BOOTSTRAP_MARKER_END,
|
|
5
|
+
BOOTSTRAP_REGEX,
|
|
6
|
+
LEGACY_KB_MARKER_BEGIN,
|
|
7
|
+
LEGACY_KB_MARKER_END,
|
|
8
|
+
LEGACY_KB_REGEX
|
|
9
|
+
} from "./chunk-4OQXR6JW.js";
|
|
2
10
|
import {
|
|
3
11
|
PROTECTED_TOKENS,
|
|
4
12
|
createTranslator,
|
|
@@ -8,7 +16,7 @@ import {
|
|
|
8
16
|
normalizeLocale,
|
|
9
17
|
resolveFabricLocale,
|
|
10
18
|
zhCNMessages
|
|
11
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-Z7UPW75I.js";
|
|
12
20
|
import {
|
|
13
21
|
FabExtractKnowledgeInputSchema,
|
|
14
22
|
FabExtractKnowledgeInputShape,
|
|
@@ -51,19 +59,18 @@ import {
|
|
|
51
59
|
planContextOutputSchema,
|
|
52
60
|
structuredWarningSchema
|
|
53
61
|
} from "./chunk-Y2YBFL2G.js";
|
|
54
|
-
import
|
|
55
|
-
BOOTSTRAP_CANONICAL,
|
|
56
|
-
BOOTSTRAP_MARKER_BEGIN,
|
|
57
|
-
BOOTSTRAP_MARKER_END,
|
|
58
|
-
BOOTSTRAP_REGEX,
|
|
59
|
-
LEGACY_KB_MARKER_BEGIN,
|
|
60
|
-
LEGACY_KB_MARKER_END,
|
|
61
|
-
LEGACY_KB_REGEX
|
|
62
|
-
} from "./chunk-4OQXR6JW.js";
|
|
62
|
+
import "./chunk-LXNCAKJZ.js";
|
|
63
63
|
|
|
64
64
|
// src/schemas/agents-meta.ts
|
|
65
65
|
import { z } from "zod";
|
|
66
66
|
var FABRIC_AGENTS_PREFIX = ".fabric/agents/";
|
|
67
|
+
var KNOWLEDGE_TYPE_SINGULAR_TO_PLURAL = {
|
|
68
|
+
model: "models",
|
|
69
|
+
decision: "decisions",
|
|
70
|
+
guideline: "guidelines",
|
|
71
|
+
pitfall: "pitfalls",
|
|
72
|
+
process: "processes"
|
|
73
|
+
};
|
|
67
74
|
var AGENTS_META_LAYERS = ["L0", "L1", "L2"];
|
|
68
75
|
var AGENTS_META_TOPOLOGY_TYPES = ["mirror", "cross-cutting", "domain", "local", "global"];
|
|
69
76
|
var AGENTS_META_IDENTITY_SOURCES = ["declared", "derived"];
|
|
@@ -79,7 +86,15 @@ var ruleDescriptionSchema = z.object({
|
|
|
79
86
|
entities: z.array(z.string()).optional(),
|
|
80
87
|
// v2.0 knowledge entry fields (TASK-002 schemas). All optional for backward compat.
|
|
81
88
|
id: z.string().optional(),
|
|
82
|
-
|
|
89
|
+
// rc.31 NEW-1: forward-compat for legacy on-disk agents.meta.json carrying
|
|
90
|
+
// singular knowledge_type values (model/decision/guideline/pitfall/process).
|
|
91
|
+
// Normalize to canonical plural form before enum validation so doctor and
|
|
92
|
+
// plan-context-hint can load pre-rc.28 meta files without aborting. Disk
|
|
93
|
+
// gets rewritten to plural on next reconcile (via knowledge-meta-builder).
|
|
94
|
+
knowledge_type: z.preprocess(
|
|
95
|
+
(value) => typeof value === "string" && value in KNOWLEDGE_TYPE_SINGULAR_TO_PLURAL ? KNOWLEDGE_TYPE_SINGULAR_TO_PLURAL[value] : value,
|
|
96
|
+
z.enum(["models", "decisions", "guidelines", "pitfalls", "processes"])
|
|
97
|
+
).optional(),
|
|
83
98
|
maturity: z.enum(["draft", "verified", "proven"]).optional(),
|
|
84
99
|
knowledge_layer: z.enum(["personal", "team"]).optional(),
|
|
85
100
|
layer_reason: z.string().optional(),
|
|
@@ -149,8 +164,7 @@ function withDerivedAgentsMetaNodeDefaults(node) {
|
|
|
149
164
|
const identitySource = isKnowledgeEntry ? "declared" : deriveAgentsMetaIdentitySource(node);
|
|
150
165
|
return {
|
|
151
166
|
...node,
|
|
152
|
-
|
|
153
|
-
level: node.level ?? node.layer ?? deriveAgentsMetaLayer(node.file),
|
|
167
|
+
level: node.level ?? deriveAgentsMetaLayer(node.file),
|
|
154
168
|
topology_type: node.topology_type ?? deriveAgentsMetaTopologyType(node.file),
|
|
155
169
|
stable_id: stableId,
|
|
156
170
|
identity_source: identitySource
|
|
@@ -486,6 +500,76 @@ var fabricConfigSchema = z5.object({
|
|
|
486
500
|
// Default `[]` keeps the field optional on existing configs — fresh
|
|
487
501
|
// installs land with no opt-outs.
|
|
488
502
|
onboard_slots_opted_out: z5.array(z5.string()).optional().default([]),
|
|
503
|
+
// v2.0.0-rc.33 W2-1 (P0-9): TopK upper bound for the broad SessionStart hint
|
|
504
|
+
// banner emitted by knowledge-hint-broad.cjs. After plan-context-hint returns
|
|
505
|
+
// its full broad-scoped index, the hook slices the entries to this many
|
|
506
|
+
// before grouping/truncation rendering — keeps the banner from scrolling off
|
|
507
|
+
// screen on well-seeded repos (Werewolf-class projects routinely surface 40+
|
|
508
|
+
// broad entries which buried the actually-relevant top hits). Default 8 is
|
|
509
|
+
// calibrated against the rc.32 eval baseline (cite-coverage 3.1%): the
|
|
510
|
+
// banner needs to fit in ~1 screenful so the agent actually reads it.
|
|
511
|
+
// Range 1..50; values above 20 effectively disable the cap because the
|
|
512
|
+
// TRUNCATION_THRESHOLD=12 grouped-render kicks in. Mirrors the rc.7 T7 +
|
|
513
|
+
// archive_max_* pattern of externalizing previously-hardcoded thresholds.
|
|
514
|
+
hint_broad_top_k: z5.number().int().min(1).max(50).optional().default(8),
|
|
515
|
+
// v2.0.0-rc.33 W2-1 (P0-9): TopK upper bound for the narrow PreToolUse hint
|
|
516
|
+
// emitted by knowledge-hint-narrow.cjs. After filtering to entries whose
|
|
517
|
+
// `relevance_scope === "narrow"` (rc.27 TASK-005 audit §2.5 fix), the hook
|
|
518
|
+
// slices to this many before the E3 emit-gate / renderSummary pipeline.
|
|
519
|
+
// Default 5 keeps each per-Edit hint terse — five lines max so the agent's
|
|
520
|
+
// working memory is not displaced by an unwieldy banner. Range 1..20.
|
|
521
|
+
hint_narrow_top_k: z5.number().int().min(1).max(20).optional().default(5),
|
|
522
|
+
// v2.0.0-rc.33 W2-1 (P0-9): per-file dedup window (in PreToolUse turns) for
|
|
523
|
+
// the narrow hint. Same (file_path, stable_id) tuple stays silent for this
|
|
524
|
+
// many turns even when the E3 cross-session cache would otherwise re-emit.
|
|
525
|
+
// Closes the rc.32 eval finding that a single hot file (e.g. werewolf
|
|
526
|
+
// GameRoom.tsx edited 30 times in a row) re-fired the same narrow hint
|
|
527
|
+
// each time, training the agent to ignore it. Default 5; range 1..50.
|
|
528
|
+
// Storage: .fabric/.cache/narrow-dedup-window.json — distinct from session-
|
|
529
|
+
// hints cache so a window-only suppression does not poison cross-session
|
|
530
|
+
// dedupe semantics.
|
|
531
|
+
hint_narrow_dedup_window_turns: z5.number().int().min(1).max(50).optional().default(5),
|
|
532
|
+
// v2.0.0-rc.33 W2-5 (P1-8): cooldown between broad SessionStart hint emits,
|
|
533
|
+
// in hours. Distinct from the archive_hint_cooldown_hours that gates the
|
|
534
|
+
// fabric-hint Stop hook — knowledge-hint-broad re-fires on every
|
|
535
|
+
// SessionStart by default (compact / clear / new-window), which on long
|
|
536
|
+
// sessions becomes redundant noise. Setting to 1 means "emit the broad
|
|
537
|
+
// menu at most once per hour"; 0 means "no cooldown, current behavior."
|
|
538
|
+
// Range 0..168 (one week). Stored alongside fabric-hint's cooldown cache
|
|
539
|
+
// under a distinct knowledge-hint-broad key.
|
|
540
|
+
hint_broad_cooldown_hours: z5.number().int().min(0).max(168).optional().default(0),
|
|
541
|
+
// v2.0.0-rc.33 W2-5 (P1-8): cooldown for the narrow PreToolUse hint.
|
|
542
|
+
// Same shape as hint_broad_cooldown_hours but applies to per-Edit hint
|
|
543
|
+
// re-emission across the cooldown window — independent of E3 session-
|
|
544
|
+
// hints dedupe. Default 0 preserves rc.32 behavior; set to e.g. 1 to
|
|
545
|
+
// throttle hint frequency during rapid-fire editing sprints. Range
|
|
546
|
+
// 0..168 (one week).
|
|
547
|
+
hint_narrow_cooldown_hours: z5.number().int().min(0).max(168).optional().default(0),
|
|
548
|
+
// v2.0.0-rc.33 W4-B3 (T5 P2): per-maturity inactivity thresholds (days)
|
|
549
|
+
// driving orphan_demote. Hardcoded at stable=90/endorsed=30/draft=14 in
|
|
550
|
+
// rc.32; chatty workspaces want them tighter, slow ones want them looser.
|
|
551
|
+
// Each field optional; absent → defaults inside doctor.ts apply. Ranges
|
|
552
|
+
// chosen so a typo can't accidentally disable the lint (min 1).
|
|
553
|
+
orphan_demote_stable_days: z5.number().int().min(1).max(3650).optional(),
|
|
554
|
+
orphan_demote_endorsed_days: z5.number().int().min(1).max(3650).optional(),
|
|
555
|
+
orphan_demote_draft_days: z5.number().int().min(1).max(3650).optional(),
|
|
556
|
+
// v2.0.0-rc.33 W4-A3 (T4 P2): per-entry summary truncation length used by
|
|
557
|
+
// knowledge-hint-{broad,narrow}.cjs. Hard-coded at 80 chars in rc.32 — too
|
|
558
|
+
// short for entries with parameterized summaries (e.g. "Use bcrypt with
|
|
559
|
+
// cost=12 for password hashing"), too long for terse pitfalls. Range 40..240;
|
|
560
|
+
// default 80 preserves rc.32 behavior. Both hooks read the same key so the
|
|
561
|
+
// banner styling stays consistent across SessionStart + PreToolUse.
|
|
562
|
+
hint_summary_max_len: z5.number().int().min(40).max(240).optional().default(80),
|
|
563
|
+
// v2.0.0-rc.33 W2-6 (P0-7 + P0-8): when true, knowledge-hint hooks emit
|
|
564
|
+
// their banners as `hookSpecificOutput.additionalContext` JSON on stdout
|
|
565
|
+
// (per Claude Code PreToolUse hook contract — see
|
|
566
|
+
// https://docs.claude.com/en/docs/claude-code/hooks#preToolUse), so the
|
|
567
|
+
// agent receives them in-context instead of as stderr breadcrumbs the
|
|
568
|
+
// user may not surface to the model. Default true reflects the rc.33 cite-
|
|
569
|
+
// coverage focus (rc.32 baseline 3.1% → primary cause: reminders never
|
|
570
|
+
// entered model context). Set false to revert to legacy stderr-only mode
|
|
571
|
+
// for hosts that don't honor the JSON contract.
|
|
572
|
+
hint_reminder_to_context: z5.boolean().optional().default(true),
|
|
489
573
|
// v2.0.0-rc.29 TASK-008 (BUG-F3): selection-token TTL override. The
|
|
490
574
|
// `fab_plan_context` MCP tool hands clients a `selection_token` whose default
|
|
491
575
|
// 5-minute lifetime (`SELECTION_TOKEN_TTL_MS` at
|