@fenglimg/fabric-shared 2.2.0 → 2.3.0-rc.10

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.
@@ -18,6 +18,7 @@ import { z as z2 } from "zod";
18
18
  var PERSONAL_SCOPE = "personal";
19
19
  var KNOWN_SCOPE_PREFIXES = ["personal", "team", "project", "org"];
20
20
  var SCOPE_COORDINATE_PATTERN = /^[a-z0-9_-]+(:[a-z0-9_-]+)*$/u;
21
+ var SCOPE_COORDINATE_HINT = 'scope coordinate must look like "project:fabric-v2", "team", or "personal" \u2014 lowercase [a-z0-9_-] segments joined by ":"';
21
22
  var scopeCoordinateSchema = z2.string().min(1).regex(
22
23
  SCOPE_COORDINATE_PATTERN,
23
24
  "scope coordinate must be ':'-joined lowercase [a-z0-9_-] segments"
@@ -46,21 +47,25 @@ var structuredWarningSchema = z3.object({
46
47
  });
47
48
  var _knowledgeTypeEnum = z3.enum(["models", "decisions", "guidelines", "pitfalls", "processes"]);
48
49
  var _maturityEnum = z3.enum(["draft", "verified", "proven"]);
49
- var _layerEnum = z3.enum(["personal", "team"]);
50
50
  var _ruleDescriptionSchema = z3.object({
51
51
  summary: z3.string(),
52
52
  intent_clues: z3.array(z3.string()),
53
- tech_stack: z3.array(z3.string()),
54
- impact: z3.array(z3.string()),
53
+ // wire-slim (payload): fab_recall projects a LEAN description (summary +
54
+ // must_read_if + intent_clues + knowledge_type — the selection signal), leaving
55
+ // tech_stack/impact to be Read on demand via read_path (KT-DEC-0026 lean
56
+ // contract at the field level). So they are optional on the wire. plan-context
57
+ // still returns them in full — zod keeps optional-present values, only ABSENT is
58
+ // now allowed, so no plan-context consumer regresses.
59
+ tech_stack: z3.array(z3.string()).optional(),
60
+ impact: z3.array(z3.string()).optional(),
55
61
  must_read_if: z3.string(),
56
- entities: z3.array(z3.string()).optional(),
57
62
  // v2.0: optional knowledge-entry fields. Absent for v1.x rules; present for
58
- // entries that declare frontmatter `id/type/maturity/layer`.
63
+ // entries that declare frontmatter `id/type/maturity`. W4/Track1: the redundant
64
+ // `knowledge_layer` field was removed — a candidate's layer is derived from its
65
+ // stable_id prefix (KP-→personal, else team; KT-DEC-0004).
59
66
  id: z3.string().optional(),
60
67
  knowledge_type: _knowledgeTypeEnum.optional(),
61
68
  maturity: _maturityEnum.optional(),
62
- knowledge_layer: _layerEnum.optional(),
63
- layer_reason: z3.string().optional(),
64
69
  created_at: z3.string().optional(),
65
70
  // v2.0.0-rc.38 UX-3 (D-MCP fold ③): these three were previously carried ONLY
66
71
  // as top-level mirrors on the index item. With the mirrors removed,
@@ -74,7 +79,12 @@ var _ruleDescriptionSchema = z3.object({
74
79
  // schema must also carry `related`, else zod strips the graph edges on output
75
80
  // validation and they never reach the client (MC1 include_related / fabric-
76
81
  // connect would see nothing). Mirrors the agents-meta ruleDescriptionSchema.
77
- related: z3.array(z3.string()).optional()
82
+ related: z3.array(z3.string()).optional(),
83
+ // v2.2 glossary aliases FIELD (C-001): mirrors agents.ts RuleDescription.
84
+ // MUST be declared here or zod .strip() drops aliases on output validation
85
+ // before plan-context feeds them into the BM25 body — long-tail alias terms
86
+ // would never reach the lexical/vector index (KT-PIT-0018 zod-strip lesson).
87
+ aliases: z3.array(z3.string()).optional()
78
88
  });
79
89
  var _descriptionIndexItemSchema = z3.object({
80
90
  stable_id: z3.string(),
@@ -129,6 +139,7 @@ var _preflightDiagnosticSchema = z3.object({
129
139
  stable_ids: z3.array(z3.string()).optional(),
130
140
  path: z3.string().optional()
131
141
  });
142
+ var _recallDropReasonSchema = z3.enum(["retrieval_budget", "payload_budget"]);
132
143
  var planContextOutputSchema = z3.object({
133
144
  revision_hash: z3.string(),
134
145
  stale: z3.boolean(),
@@ -143,12 +154,16 @@ var planContextOutputSchema = z3.object({
143
154
  // duplicated into every entry's requirement_profile). Omitted when no intent.
144
155
  intent: z3.string().optional(),
145
156
  candidates: z3.array(_descriptionIndexItemSchema),
146
- // v2.2 A-INFRA-3 (W1-T3-TOPK) / MC4-payload-budget (W1-T4): number of
147
- // lower-ranked candidates dropped by the unified truncation chain (top_k cap
148
- // + payload-budget trim). Present and > 0 ONLY when truncation fired, so the
149
- // steady-state wire shape is unchanged. Lets the LLM know the returned set is
150
- // not exhaustive ("N more exist; narrow your intent").
151
- omitted_candidate_count: z3.number().int().nonnegative().optional(),
157
+ // v2.2 A-INFRA-3 (W1-T3-TOPK) / MC4-payload-budget (W1-T4) / K6 (W3-K):
158
+ // structured list of lower-ranked candidates dropped by the unified truncation
159
+ // chain, each tagged with WHY it was dropped (`retrieval_budget` = top_k cap +
160
+ // ratio-to-top floor; `payload_budget` = MCP payload-byte trim). Present and
161
+ // non-empty ONLY when truncation fired, so the steady-state wire shape is
162
+ // unchanged. Replaces the bare numeric omission count so the LLM sees WHICH
163
+ // candidates were dropped and can act ("these N exist; narrow your intent").
164
+ // Reuses the archive-scan {key,reason} omission convention
165
+ // (_recallDropReasonSchema, keyed on id here).
166
+ dropped: z3.array(z3.object({ id: z3.string(), reason: _recallDropReasonSchema })).optional(),
152
167
  preflight_diagnostics: z3.array(_preflightDiagnosticSchema),
153
168
  warnings: z3.array(structuredWarningSchema).optional(),
154
169
  // v2.0.0-rc.22 Scope D T-D2: optional auto-heal banner fields. Surfaced
@@ -188,7 +203,11 @@ var planContextHintNarrowEntrySchema = z3.object({
188
203
  // W2-2 (KT-DEC-0027): the entry's must_read_if trigger hook, forwarded for the
189
204
  // SessionStart REFERENCE rendering (decision/pitfall/process → title + hook).
190
205
  // Optional — omitted when the frontmatter declares none.
191
- must_read_if: z3.string().optional()
206
+ must_read_if: z3.string().optional(),
207
+ // TASK-003 (impact-map MVP): the entry's impact list, forwarded so the narrow
208
+ // PreToolUse hint can surface the consequences of ignoring this knowledge when
209
+ // editing a matching relevance path. Optional — omitted when none declared.
210
+ impact: z3.array(z3.string()).optional()
192
211
  });
193
212
  var planContextHintOutputSchema = z3.object({
194
213
  version: z3.literal(1),
@@ -236,8 +255,8 @@ var knowledgeSectionsOutputSchema = z3.object({
236
255
  diagnostics: z3.array(
237
256
  // v2.0.0-rc.23 TASK-013 (F8b): `missing_section` was removed alongside the
238
257
  // A-set enum. `missing_knowledge_metadata` stays as the warn-level signal
239
- // for un-migrated v1.x entries (no knowledge_type AND no knowledge_layer
240
- // in frontmatter). Does NOT block selection.
258
+ // for un-migrated v1.x entries (no knowledge_type in frontmatter). Does NOT
259
+ // block selection.
241
260
  z3.object({
242
261
  code: z3.enum(["missing_knowledge_metadata", "unresolved_selected_id"]),
243
262
  severity: z3.literal("warn"),
@@ -293,39 +312,66 @@ var recallInputSchema = z3.object({
293
312
  "When true, also surface the one-hop `related` graph neighbours (of the surfaced entries) that are present in the candidate set \u2014 their descriptions and read paths, NOT their bodies."
294
313
  )
295
314
  });
315
+ var _recallEntrySchema = z3.object({
316
+ stable_id: z3.string(),
317
+ // 1-based relevance rank (entries are returned best-first). The surfaced
318
+ // ranking signal — entries are already sorted, rank makes the order explicit.
319
+ rank: z3.number().int().positive(),
320
+ // The DESCRIPTION (summary / intent_clues / must_read_if / related ...). No body.
321
+ description: _ruleDescriptionSchema,
322
+ // on-disk knowledge file to Read for the full body. Omitted when the entry has
323
+ // no resolvable file (description-only discovery) or was scoped out by `ids`.
324
+ read_path: z3.string().optional(),
325
+ // originating store alias (omitted for unqualified / single-store entries).
326
+ store: z3.object({ alias: z3.string() }).optional(),
327
+ // true when this entry's body is ALSO injected at SessionStart (broad
328
+ // model/guideline "ALWAYS-ACTIVE") — skip the Read, it is already in context.
329
+ body_in_context: z3.boolean().optional(),
330
+ // P1 recall-observability: the fused relevance score this entry scored during
331
+ // the plan-context sort (was computed internally but dropped before this wave).
332
+ // Optional + additive — backward-compatible. MUST be declared here or zod
333
+ // .strip() silently drops it at the MCP boundary (KT-PIT-0005).
334
+ score: z3.number().optional(),
335
+ // P1 recall-observability: numbers-only decomposition of `score` into its
336
+ // weighted signal contributions. NEVER carries body/description text — preserves
337
+ // the lean read_path contract (KT-DEC-0019 / KT-GLD-0005). bm25_rank/vector_rank
338
+ // are reserved for a later RRF wave (declared so the wire never strips them).
339
+ score_breakdown: z3.object({
340
+ final: z3.number(),
341
+ bm25: z3.number().optional(),
342
+ bm25_rank: z3.number().optional(),
343
+ vector: z3.number().optional(),
344
+ vector_rank: z3.number().optional(),
345
+ salience: z3.number(),
346
+ recency: z3.number(),
347
+ locality: z3.number(),
348
+ // BORROW-008 proximity boost — MUST be declared or zod .strip() drops it at
349
+ // the MCP boundary (KT-PIT-0005), desyncing wire `final` from its components.
350
+ proximity: z3.number(),
351
+ // PLN-004 F1 credibility content-age decay MULTIPLIER factor — optional
352
+ // (only present once the multiplier is wired). MUST be declared or zod
353
+ // .strip() drops it at the MCP boundary (KT-PIT-0005).
354
+ credibility: z3.number().optional()
355
+ }).optional()
356
+ });
296
357
  var recallOutputSchema = z3.object({
297
358
  revision_hash: z3.string(),
298
359
  stale: z3.boolean(),
299
- // v2.0.0-rc.38 UX-1/UX-4: mirrors planContextOutputSchema fold per-path
300
- // description_index collapsed into a single top-level `candidates`, and
301
- // `preflight_diagnostics` lifted out of the removed `shared` wrapper.
302
- entries: z3.array(
303
- z3.object({
304
- path: z3.string(),
305
- requirement_profile: _requirementProfileSchema
306
- })
307
- ),
308
- // v2.2 payload de-dup: single top-level echo of the caller's `intent` (was
309
- // duplicated into every entry's requirement_profile). Omitted when no intent.
360
+ // ux-w2-4: single unified entry list (was candidates[] + paths[] + per-path
361
+ // requirement-profile entries[]). Each item carries description + read_path +
362
+ // rank + body_in_context, so the agent never joins two arrays on stable_id.
363
+ entries: z3.array(_recallEntrySchema),
364
+ // v2.2 payload de-dup: single top-level echo of the caller's `intent`.
365
+ // Omitted when no intent.
310
366
  intent: z3.string().optional(),
311
- // W1 (KT-DEC-0026): the discovery index every surfaced candidate's
312
- // DESCRIPTION (summary / intent_clues / must_read_if / related ...). No body.
313
- candidates: z3.array(_descriptionIndexItemSchema),
314
- // W1 (KT-DEC-0026): the read-path indexone entry per surfaced candidate
315
- // (scoped by `ids` when provided), in ranked order. `path` is the on-disk
316
- // knowledge file the agent Reads to load the body on demand; `store` is the
317
- // originating store alias (omitted for unqualified entries).
318
- paths: z3.array(
319
- z3.object({
320
- stable_id: z3.string(),
321
- path: z3.string(),
322
- store: z3.object({ alias: z3.string() }).optional()
323
- })
324
- ),
325
- // Number of lower-ranked candidates dropped by the retrieval budget. Present
326
- // (and > 0) ONLY when truncation fired — keeps the steady-state wire shape
327
- // unchanged while signalling "more exist; narrow your intent".
328
- omitted_candidate_count: z3.number().int().nonnegative().optional(),
367
+ // K6 (W3-K): structured list of lower-ranked candidates dropped by the
368
+ // retrieval pipeline, each tagged with WHY (`retrieval_budget` = top_k cap +
369
+ // ratio-to-top floor; `payload_budget` = MCP payload-byte trim). Present (and
370
+ // non-empty) ONLY when truncation fired keeps the steady-state wire shape
371
+ // unchanged while signalling which entries exist ("narrow your intent"), now
372
+ // with a controlled reason instead of a bare count. Reuses the archive-scan
373
+ // {key,reason} omission convention (_recallDropReasonSchema, keyed on id).
374
+ dropped: z3.array(z3.object({ id: z3.string(), reason: _recallDropReasonSchema })).optional(),
329
375
  preflight_diagnostics: z3.array(_preflightDiagnosticSchema),
330
376
  warnings: z3.array(structuredWarningSchema).optional(),
331
377
  auto_healed: z3.boolean().optional(),
@@ -366,6 +412,8 @@ var archiveScanOutputSchema = z3.object({
366
412
  // in first-seen order — ready for the Skill to load digests + stitch.
367
413
  session_ids: z3.array(z3.string()),
368
414
  // Sessions dropped by the filter, with the rule that fired (audit/debug).
415
+ // Shares the {key,reason} omission convention with recall's dropped[] above
416
+ // (keys on session_id here, on id in recall).
369
417
  dropped: z3.array(
370
418
  z3.object({
371
419
  session_id: z3.string(),
@@ -428,15 +476,19 @@ var _FabExtractKnowledgeInputBaseSchema = z3.object({
428
476
  user_messages_summary: z3.string().describe("Skill-side summary of the user's intent/messages, kept compact"),
429
477
  type: z3.enum(["decisions", "pitfalls", "guidelines", "models", "processes"]).describe("Knowledge type bucket (plural form, mirrors directory layout)"),
430
478
  slug: z3.string().describe("URL-safe short identifier proposed by the Skill; server may sanitize"),
431
- // Store-only cutover: layer is a compatibility audience hint. The server
432
- // resolves the actual write target through semantic_scope/write_routes and
433
- // writes to the selected mounted store's knowledge/pending/<type>/ tree.
434
- // Defaults to 'team' to preserve existing call sites (Skill bumps as needed).
435
- layer: z3.enum(["team", "personal"]).optional().describe(
436
- "Compatibility storage audience. 'personal' writes to the personal store; non-personal writes resolve by semantic_scope/write_routes. Defaults to 'team'."
437
- ),
438
- semantic_scope: z3.string().regex(SCOPE_COORDINATE_PATTERN).optional().describe(
439
- "Logical audience/write route coordinate for this pending entry, e.g. personal, team, project:fabric-v2, org:acme:team:platform. Server validates and resolves it through write_routes."
479
+ // v2.2 C1 (W1) — author-facing scope is now TWO fields only: `audience` +
480
+ // `paths`. Everything else (layer / visibility_store / relevance_scope /
481
+ // store) is engine-derived, never author input (C1 §一.1). The physical write
482
+ // store is the hard privacy boundary (cross-store-write R5#3); `audience` only
483
+ // subdivides WHO within that boundary.
484
+ //
485
+ // audience — the open scope coordinate describing WHO the entry is for
486
+ // (personal | team | project:x | org:y...). Replaces the old
487
+ // `layer` + `semantic_scope` pair: a `personal` coordinate routes
488
+ // to the personal store; everything else resolves via write_routes.
489
+ // Omit → engine defaults to project:<active> (bound repo) or team.
490
+ audience: z3.string().regex(SCOPE_COORDINATE_PATTERN, { message: SCOPE_COORDINATE_HINT }).optional().describe(
491
+ "WHO this entry is for \u2014 an open scope coordinate (personal | team | project:x | org:y...). The sole author-facing audience field; the engine derives layer/visibility_store/store from it + the physical write store. Omit to default to project:<active> (bound repo) or team."
440
492
  ),
441
493
  // v2.0.0-rc.7 T6: proposed_reason — required enum that drives `## Why
442
494
  // proposed` rendering. Skills (archive / import / review) infer the
@@ -462,11 +514,16 @@ var _FabExtractKnowledgeInputBaseSchema = z3.object({
462
514
  // a `knowledge_scope_degraded` event keyed by `pending:<idempotency_key>`.
463
515
  // NOTE: these fields MUST NOT be part of the idempotency hash inputs at
464
516
  // extract-knowledge.ts:78 — preserves rc.5→rc.7 collision detection.
465
- relevance_scope: z3.enum(["narrow", "broad"]).optional().describe(
466
- "Optional relevance scope. 'narrow' restricts plan-context-hint surfacing to relevance_paths; 'broad' always surfaces. Omit to let the meta-builder default to 'broad'. Personal + narrow is silently degraded to broad + []."
467
- ),
468
- relevance_paths: z3.array(z3.string()).optional().describe(
469
- "Optional path anchors for narrow scope. Workspace-relative globs or paths. Omit to let the meta-builder default to []. Ignored when scope is broad (server preserves the array for audit)."
517
+ // paths — relevance anchors (workspace-relative globs/paths). The engine
518
+ // DERIVES relevance_scope from this field's presence: non-empty
519
+ // narrow (surface only when an edit matches an anchor); empty/omitted
520
+ // → broad (always surface). This eliminates the old separate
521
+ // relevance_scope flag and its narrow+empty illegal state by
522
+ // construction (KT-MOD-0001). Glob syntax follows Copilot `applyTo`
523
+ // / Cursor `globs` (cross-client moat). Personal audience forces
524
+ // broad+[] (workspace-relative paths cross-project lose meaning).
525
+ paths: z3.array(z3.string()).optional().describe(
526
+ "Relevance anchors (workspace-relative globs/paths). Non-empty \u2192 narrow (surface only on matching edits); empty/omitted \u2192 broad (always surface). The engine derives relevance_scope from this \u2014 there is no separate scope flag."
470
527
  ),
471
528
  // v2.0.0-rc.23 TASK-006 (a-C1): four optional structured fields that the
472
529
  // skill-side LLM populates from raw observations. The same information
@@ -512,7 +569,7 @@ var _FabExtractKnowledgeInputBaseSchema = z3.object({
512
569
  // discover unclaimed slots, then propagates the chosen slot label here
513
570
  // so the resulting pending entry counts toward coverage.
514
571
  //
515
- // STRICT optionality: every non-onboard fab_extract_knowledge call MUST
572
+ // STRICT optionality: every non-onboard fab_propose call MUST
516
573
  // omit this field. The skill is the only producer; downstream consumers
517
574
  // (plan_context retrieval, doctor lints) treat missing as a steady-state
518
575
  // signal that the entry was NOT part of an onboard pass.
@@ -624,13 +681,21 @@ var _fabReviewModifyChangesSchema = z3.object({
624
681
  // edges via fab_recall and sends the merged set. Absent this field the modify
625
682
  // path silently dropped `related` via zod .strip() (KT-PIT-0005 recurrence),
626
683
  // leaving the only programmatic related-write path non-functional.
627
- related: z3.array(z3.string()).optional()
684
+ related: z3.array(z3.string()).optional(),
685
+ // rc.9 (2026-07-06): discovery-signal scalar patches — must_read_if triggers
686
+ // Reference-type entry surfacing; intent_clues drives the AI's "should I Read
687
+ // the body?" judgment; impact enumerates consequence prose surfaced in the
688
+ // BM25F body slot. Before rc.9 these three fields were undeclared here, so
689
+ // fab_review modify silently .strip()'d them (KT-PIT-0005 recurrence) and the
690
+ // only path to fix a bad-shape must_read_if / missing intent_clues was direct
691
+ // Edit — bypassing the skill audit trail. All three are REPLACE semantics
692
+ // (mirror tags/related). must_read_if is a scalar string; intent_clues +
693
+ // impact are flow-arrays.
694
+ must_read_if: z3.string().optional(),
695
+ intent_clues: z3.array(z3.string()).optional(),
696
+ impact: z3.array(z3.string()).optional()
628
697
  });
629
698
  var FabReviewInputSchema = z3.discriminatedUnion("action", [
630
- z3.object({
631
- action: z3.literal("list"),
632
- filters: _fabReviewFiltersSchema
633
- }),
634
699
  z3.object({
635
700
  action: z3.literal("approve"),
636
701
  pending_paths: z3.array(z3.string()).min(1)
@@ -663,11 +728,6 @@ var FabReviewInputSchema = z3.discriminatedUnion("action", [
663
728
  layer: z3.enum(["team", "personal"])
664
729
  })
665
730
  }),
666
- z3.object({
667
- action: z3.literal("search"),
668
- query: z3.string().min(1),
669
- filters: _fabReviewFiltersSchema
670
- }),
671
731
  z3.object({
672
732
  action: z3.literal("defer"),
673
733
  pending_paths: z3.array(z3.string()).min(1),
@@ -675,13 +735,32 @@ var FabReviewInputSchema = z3.discriminatedUnion("action", [
675
735
  reason: z3.string().optional()
676
736
  })
677
737
  ]);
678
- var FabReviewInputShape = {
679
- action: z3.enum(["list", "approve", "reject", "modify", "modify-content", "modify-layer", "search", "defer"]).describe(
680
- "Action selector. Discriminates the per-action fields below; required. modify-content edits scalars (no layer); modify-layer is the layer-flip path (changes.layer required); modify is the legacy combined alias."
738
+ var FabPendingInputSchema = z3.discriminatedUnion("action", [
739
+ z3.object({
740
+ action: z3.literal("list"),
741
+ filters: _fabReviewFiltersSchema
742
+ }),
743
+ z3.object({
744
+ action: z3.literal("search"),
745
+ query: z3.string().min(1),
746
+ filters: _fabReviewFiltersSchema
747
+ })
748
+ ]);
749
+ var FabPendingInputShape = {
750
+ action: z3.enum(["list", "search"]).describe(
751
+ "Action selector. Discriminates the per-action fields below; required. list browses pending entries; search ranges over pending + canonical knowledge."
681
752
  ),
682
753
  filters: _fabReviewFiltersSchema.describe(
683
754
  "Optional filters (type/layer/maturity/tags/created_after). Used by action=list and action=search."
684
755
  ),
756
+ query: z3.string().min(1).optional().describe(
757
+ "Substring query against title/summary/tags/path. Required (non-empty) when action=search."
758
+ )
759
+ };
760
+ var FabReviewInputShape = {
761
+ action: z3.enum(["approve", "reject", "modify", "modify-content", "modify-layer", "defer"]).describe(
762
+ "Action selector. Discriminates the per-action fields below; required. modify-content edits scalars (no layer); modify-layer is the layer-flip path (changes.layer required); modify is the legacy combined alias. (list/search moved to the read-only fab_pending tool.)"
763
+ ),
685
764
  pending_paths: z3.array(z3.string()).min(1).optional().describe(
686
765
  "Workspace-relative pending entry paths. Required when action=approve|reject|defer (non-empty array)."
687
766
  ),
@@ -694,9 +773,6 @@ var FabReviewInputShape = {
694
773
  changes: _fabReviewModifyChangesSchema.optional().describe(
695
774
  "Frontmatter scalar patches (title/summary/layer/maturity/tags/relevance_*/semantic_scope/related). Required when action=modify. semantic_scope re-scopes the entry's resolution coordinate in place (e.g. team \u2192 project:<id>) without moving stores; personal-root coordinates are rejected (use modify-layer)."
696
775
  ),
697
- query: z3.string().min(1).optional().describe(
698
- "Substring query against title/summary/tags/path. Required (non-empty) when action=search."
699
- ),
700
776
  until: z3.string().datetime().optional().describe(
701
777
  "ISO-8601 datetime upper bound for the deferral. Optional; used only when action=defer."
702
778
  )
@@ -757,11 +833,6 @@ var _fabReviewSearchItemSchema = z3.object({
757
833
  stable_id: z3.string().optional()
758
834
  });
759
835
  var FabReviewOutputSchema = z3.discriminatedUnion("action", [
760
- z3.object({
761
- action: z3.literal("list"),
762
- items: z3.array(_fabReviewListItemSchema),
763
- warnings: z3.array(structuredWarningSchema).optional()
764
- }),
765
836
  z3.object({
766
837
  action: z3.literal("approve"),
767
838
  approved: z3.array(z3.object({ pending_path: z3.string(), stable_id: z3.string() })),
@@ -781,25 +852,36 @@ var FabReviewOutputSchema = z3.discriminatedUnion("action", [
781
852
  warnings: z3.array(structuredWarningSchema).optional()
782
853
  }),
783
854
  z3.object({
784
- action: z3.literal("search"),
785
- // v2.0.0-rc.29 TASK-007 (BUG-M4): search returns the new search-item
786
- // shape with `area` discriminator + neutrally-named `path` field.
787
- items: z3.array(_fabReviewSearchItemSchema),
855
+ action: z3.literal("defer"),
856
+ deferred: z3.array(z3.string()),
857
+ warnings: z3.array(structuredWarningSchema).optional()
858
+ })
859
+ ]);
860
+ var FabPendingOutputSchema = z3.discriminatedUnion("action", [
861
+ z3.object({
862
+ action: z3.literal("list"),
863
+ items: z3.array(_fabReviewListItemSchema),
788
864
  warnings: z3.array(structuredWarningSchema).optional()
789
865
  }),
790
866
  z3.object({
791
- action: z3.literal("defer"),
792
- deferred: z3.array(z3.string()),
867
+ action: z3.literal("search"),
868
+ items: z3.array(_fabReviewSearchItemSchema),
793
869
  warnings: z3.array(structuredWarningSchema).optional()
794
870
  })
795
871
  ]);
796
- var FabReviewOutputShape = {
797
- action: z3.enum(["list", "approve", "reject", "modify", "search", "defer"]).describe(
872
+ var FabPendingOutputShape = {
873
+ action: z3.enum(["list", "search"]).describe(
798
874
  "Echoes the input action; clients can switch on it for per-variant fields below."
799
875
  ),
800
876
  items: z3.array(z3.union([_fabReviewListItemSchema, _fabReviewSearchItemSchema])).optional().describe(
801
877
  "Pending entries (action=list, `pending_path` shape) or pending+canonical entries (action=search, `area`+`path` shape)."
802
878
  ),
879
+ warnings: z3.array(structuredWarningSchema).optional()
880
+ };
881
+ var FabReviewOutputShape = {
882
+ action: z3.enum(["approve", "reject", "modify", "defer"]).describe(
883
+ "Echoes the input action; clients can switch on it for per-variant fields below. (list/search results moved to the read-only fab_pending tool.)"
884
+ ),
803
885
  approved: z3.array(z3.object({ pending_path: z3.string(), stable_id: z3.string() })).optional().describe(
804
886
  "Allocated stable ids paired with their original pending paths. Present when action=approve."
805
887
  ),
@@ -829,6 +911,13 @@ var fabReviewAnnotations = {
829
911
  openWorldHint: false,
830
912
  title: "Review pending knowledge entries"
831
913
  };
914
+ var fabPendingAnnotations = {
915
+ readOnlyHint: true,
916
+ idempotentHint: true,
917
+ destructiveHint: false,
918
+ openWorldHint: false,
919
+ title: "Browse and search pending knowledge entries"
920
+ };
832
921
  var citeContractMetricsSchema = z3.object({
833
922
  decisions_cited: z3.number().int().nonnegative(),
834
923
  pitfalls_cited: z3.number().int().nonnegative(),
@@ -1035,8 +1124,6 @@ var KnowledgeEntryFrontmatterSchema = z3.object({
1035
1124
  // draft | verified | proven
1036
1125
  layer: LayerSchema,
1037
1126
  // personal | team
1038
- layer_reason: z3.string().optional(),
1039
- // why this layer (for ambiguous cases)
1040
1127
  created_at: z3.string()
1041
1128
  // ISO 8601 timestamp
1042
1129
  // Note: 'tags' and other fields can be added later but core schema is these 6
@@ -1071,6 +1158,7 @@ export {
1071
1158
  PERSONAL_SCOPE,
1072
1159
  KNOWN_SCOPE_PREFIXES,
1073
1160
  SCOPE_COORDINATE_PATTERN,
1161
+ SCOPE_COORDINATE_HINT,
1074
1162
  scopeCoordinateSchema,
1075
1163
  scopeRoot,
1076
1164
  isPersonalScope,
@@ -1097,10 +1185,15 @@ export {
1097
1185
  FabExtractKnowledgeOutputSchema,
1098
1186
  fabExtractKnowledgeAnnotations,
1099
1187
  FabReviewInputSchema,
1188
+ FabPendingInputSchema,
1189
+ FabPendingInputShape,
1100
1190
  FabReviewInputShape,
1101
1191
  FabReviewOutputSchema,
1192
+ FabPendingOutputSchema,
1193
+ FabPendingOutputShape,
1102
1194
  FabReviewOutputShape,
1103
1195
  fabReviewAnnotations,
1196
+ fabPendingAnnotations,
1104
1197
  citeContractMetricsSchema,
1105
1198
  citeLayerTypeBreakdownSchema,
1106
1199
  citeCoverageReportSchema,