@fenglimg/fabric-shared 2.0.0-rc.28 → 2.0.0-rc.30

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
  normalizeLocale,
17
17
  resolveFabricLocale,
18
18
  zhCNMessages
19
- } from "./chunk-DXQVLDEB.js";
19
+ } from "./chunk-225L7D4T.js";
20
20
  import {
21
21
  FabExtractKnowledgeInputSchema,
22
22
  FabExtractKnowledgeInputShape,
@@ -58,7 +58,7 @@ import {
58
58
  planContextInputSchema,
59
59
  planContextOutputSchema,
60
60
  structuredWarningSchema
61
- } from "./chunk-G32HVF7H.js";
61
+ } from "./chunk-Y2YBFL2G.js";
62
62
  import "./chunk-LXNCAKJZ.js";
63
63
 
64
64
  // src/schemas/agents-meta.ts
@@ -79,7 +79,7 @@ var ruleDescriptionSchema = z.object({
79
79
  entities: z.array(z.string()).optional(),
80
80
  // v2.0 knowledge entry fields (TASK-002 schemas). All optional for backward compat.
81
81
  id: z.string().optional(),
82
- knowledge_type: z.enum(["model", "decision", "guideline", "pitfall", "process"]).optional(),
82
+ knowledge_type: z.enum(["models", "decisions", "guidelines", "pitfalls", "processes"]).optional(),
83
83
  maturity: z.enum(["draft", "verified", "proven"]).optional(),
84
84
  knowledge_layer: z.enum(["personal", "team"]).optional(),
85
85
  layer_reason: z.string().optional(),
@@ -149,8 +149,7 @@ function withDerivedAgentsMetaNodeDefaults(node) {
149
149
  const identitySource = isKnowledgeEntry ? "declared" : deriveAgentsMetaIdentitySource(node);
150
150
  return {
151
151
  ...node,
152
- layer: node.layer ?? node.level ?? deriveAgentsMetaLayer(node.file),
153
- level: node.level ?? node.layer ?? deriveAgentsMetaLayer(node.file),
152
+ level: node.level ?? deriveAgentsMetaLayer(node.file),
154
153
  topology_type: node.topology_type ?? deriveAgentsMetaTopologyType(node.file),
155
154
  stable_id: stableId,
156
155
  identity_source: identitySource
@@ -319,6 +318,7 @@ var mcpPayloadLimitsSchema = z5.object({
319
318
  warnBytes: z5.number().int().positive().optional(),
320
319
  hardBytes: z5.number().int().positive().optional()
321
320
  }).optional();
321
+ var selectionTokenTtlMsSchema = z5.number().int().min(3e4).max(36e5);
322
322
  var fabricLanguageSchema = z5.enum([
323
323
  "match-existing",
324
324
  "zh-CN",
@@ -484,7 +484,23 @@ var fabricConfigSchema = z5.object({
484
484
  //
485
485
  // Default `[]` keeps the field optional on existing configs — fresh
486
486
  // installs land with no opt-outs.
487
- onboard_slots_opted_out: z5.array(z5.string()).optional().default([])
487
+ onboard_slots_opted_out: z5.array(z5.string()).optional().default([]),
488
+ // v2.0.0-rc.29 TASK-008 (BUG-F3): selection-token TTL override. The
489
+ // `fab_plan_context` MCP tool hands clients a `selection_token` whose default
490
+ // 5-minute lifetime (`SELECTION_TOKEN_TTL_MS` at
491
+ // packages/server/src/services/plan-context.ts:91) was hard-coded and could
492
+ // not be tuned for slow review cycles. Operators on long-running sessions
493
+ // (manual paste-and-review flows, debugger pauses, etc.) reported tokens
494
+ // expiring mid-review. Override here; absence means "use the library default
495
+ // of 5*60*1000 ms." Range 30s..1h keeps the value useful — below 30s the
496
+ // token expires before MCP round-trips finish; above 1h it stops being a
497
+ // meaningful liveness signal for the plan-context cache.
498
+ //
499
+ // The single-field schema is exported separately (`selectionTokenTtlMsSchema`)
500
+ // so the server-side per-field reader can validate without re-running the
501
+ // whole fabricConfigSchema on every plan_context call — that lets a corrupt
502
+ // unrelated field stay isolated from the hot read path.
503
+ selection_token_ttl_ms: selectionTokenTtlMsSchema.optional()
488
504
  });
489
505
 
490
506
  // src/schemas/fabric-config-introspect.ts
@@ -875,6 +891,13 @@ var reapplyCompletedEventSchema = z10.object({
875
891
  preserved_meta: z10.boolean(),
876
892
  rules_count: z10.number().int().nonnegative()
877
893
  });
894
+ var installDiffAppliedEventSchema = z10.object({
895
+ ...eventLedgerEnvelopeSchema,
896
+ event_type: z10.literal("install_diff_applied"),
897
+ applied: z10.array(z10.string()),
898
+ canonical: z10.array(z10.string()),
899
+ drifted: z10.array(z10.string())
900
+ });
878
901
  var eventLedgerTruncatedEventSchema = z10.object({
879
902
  ...eventLedgerEnvelopeSchema,
880
903
  event_type: z10.literal("event_ledger_truncated"),
@@ -919,7 +942,17 @@ var metaReconciledEventSchema = z10.object({
919
942
  // `fab_review` write-actions can flush newly-promoted entries into
920
943
  // `agents.meta.json.nodes[id]` synchronously — without this the new entry
921
944
  // remains description-less until the next plan_context auto-heal.
922
- trigger: z10.enum(["doctor", "manual", "auto-heal-description", "post-approve", "post-modify"]),
945
+ // v2.0.0-rc.29 TASK-005 (BUG-G1): `auto-heal-after-drift` added so
946
+ // `ensureKnowledgeFresh` hot-path can chain a paired reconcile (closing the
947
+ // drift→heal gap) when the caller opts in via `autoHealOnDrift: true`.
948
+ trigger: z10.enum([
949
+ "doctor",
950
+ "manual",
951
+ "auto-heal-description",
952
+ "auto-heal-after-drift",
953
+ "post-approve",
954
+ "post-modify"
955
+ ]),
923
956
  source: z10.literal("reconcileKnowledge"),
924
957
  // v2.0.0-rc.22 TASK-014 (Scope E): set when reconcileKnowledge forced a
925
958
  // writeKnowledgeMeta on revision drift alone (no per-file content drift).
@@ -1145,7 +1178,7 @@ var knowledgeEnrichedEventSchema = z10.object({
1145
1178
  event_type: z10.literal("knowledge_enriched"),
1146
1179
  path: z10.string(),
1147
1180
  added_fields: z10.array(z10.enum(["intent_clues", "tech_stack", "impact", "must_read_if"])),
1148
- mode: z10.enum(["auto", "interactive"]),
1181
+ mode: z10.enum(["auto", "preview", "readonly", "interactive"]),
1149
1182
  timestamp: z10.string().datetime()
1150
1183
  });
1151
1184
  var sessionArchiveAttemptedEventSchema = z10.object({
@@ -1164,6 +1197,7 @@ var eventLedgerEventSchema = z10.discriminatedUnion("event_type", [
1164
1197
  knowledgeDriftDetectedEventSchema,
1165
1198
  mcpEventLedgerEventSchema,
1166
1199
  reapplyCompletedEventSchema,
1200
+ installDiffAppliedEventSchema,
1167
1201
  eventLedgerTruncatedEventSchema,
1168
1202
  mcpConfigMigratedEventSchema,
1169
1203
  // v2.0.0-rc.19 TASK-004: bootstrap_marker_migrated — one-time fabric:knowledge-base
@@ -1426,6 +1460,7 @@ export {
1426
1460
  initContextSchema,
1427
1461
  initContextSourceEvidenceSchema,
1428
1462
  initScanCompletedEventSchema,
1463
+ installDiffAppliedEventSchema,
1429
1464
  isKnowledgeStableId,
1430
1465
  knowledgeArchiveAttemptedEventSchema,
1431
1466
  knowledgeArchivedEventSchema,
@@ -1480,6 +1515,7 @@ export {
1480
1515
  resolveFabricLocale,
1481
1516
  ruleDescriptionIndexItemSchema,
1482
1517
  ruleDescriptionSchema,
1518
+ selectionTokenTtlMsSchema,
1483
1519
  serveLockClearedEventSchema,
1484
1520
  sessionArchiveAttemptedEventSchema,
1485
1521
  structuredWarningSchema,
@@ -11,6 +11,8 @@ interface PayloadGuardResult {
11
11
  threshold: number;
12
12
  };
13
13
  }
14
+ declare const PAYLOAD_LIMIT_DEFAULT_WARN_BYTES = 16384;
15
+ declare const PAYLOAD_LIMIT_DEFAULT_HARD_BYTES = 65536;
14
16
  declare function enforcePayloadLimit(serializedPayload: string, opts?: PayloadGuardOptions): PayloadGuardResult;
15
17
 
16
- export { type PayloadGuardOptions, type PayloadGuardResult, enforcePayloadLimit };
18
+ export { PAYLOAD_LIMIT_DEFAULT_HARD_BYTES, PAYLOAD_LIMIT_DEFAULT_WARN_BYTES, type PayloadGuardOptions, type PayloadGuardResult, enforcePayloadLimit };
@@ -7,8 +7,10 @@ var McpPayloadTooLargeError = class extends MCPError {
7
7
  code = "MCP_PAYLOAD_TOO_LARGE";
8
8
  httpStatus = 413;
9
9
  };
10
- var DEFAULT_WARN = 16384;
11
- var DEFAULT_HARD = 65536;
10
+ var PAYLOAD_LIMIT_DEFAULT_WARN_BYTES = 16384;
11
+ var PAYLOAD_LIMIT_DEFAULT_HARD_BYTES = 65536;
12
+ var DEFAULT_WARN = PAYLOAD_LIMIT_DEFAULT_WARN_BYTES;
13
+ var DEFAULT_HARD = PAYLOAD_LIMIT_DEFAULT_HARD_BYTES;
12
14
  function enforcePayloadLimit(serializedPayload, opts) {
13
15
  const warnAt = opts?.warnBytes ?? DEFAULT_WARN;
14
16
  const hardAt = opts?.hardBytes ?? DEFAULT_HARD;
@@ -36,5 +38,7 @@ function enforcePayloadLimit(serializedPayload, opts) {
36
38
  return { bytes };
37
39
  }
38
40
  export {
41
+ PAYLOAD_LIMIT_DEFAULT_HARD_BYTES,
42
+ PAYLOAD_LIMIT_DEFAULT_WARN_BYTES,
39
43
  enforcePayloadLimit
40
44
  };