@fenglimg/fabric-shared 2.3.0-rc.1 → 2.3.0-rc.3

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.
@@ -313,7 +313,26 @@ var _recallEntrySchema = z3.object({
313
313
  store: z3.object({ alias: z3.string() }).optional(),
314
314
  // true when this entry's body is ALSO injected at SessionStart (broad
315
315
  // model/guideline "ALWAYS-ACTIVE") — skip the Read, it is already in context.
316
- body_in_context: z3.boolean().optional()
316
+ body_in_context: z3.boolean().optional(),
317
+ // P1 recall-observability: the fused relevance score this entry scored during
318
+ // the plan-context sort (was computed internally but dropped before this wave).
319
+ // Optional + additive — backward-compatible. MUST be declared here or zod
320
+ // .strip() silently drops it at the MCP boundary (KT-PIT-0005).
321
+ score: z3.number().optional(),
322
+ // P1 recall-observability: numbers-only decomposition of `score` into its
323
+ // weighted signal contributions. NEVER carries body/description text — preserves
324
+ // the lean read_path contract (KT-DEC-0019 / KT-GLD-0005). bm25_rank/vector_rank
325
+ // are reserved for a later RRF wave (declared so the wire never strips them).
326
+ score_breakdown: z3.object({
327
+ final: z3.number(),
328
+ bm25: z3.number().optional(),
329
+ bm25_rank: z3.number().optional(),
330
+ vector: z3.number().optional(),
331
+ vector_rank: z3.number().optional(),
332
+ salience: z3.number(),
333
+ recency: z3.number(),
334
+ locality: z3.number()
335
+ }).optional()
317
336
  });
318
337
  var recallOutputSchema = z3.object({
319
338
  revision_hash: z3.string(),
@@ -151,11 +151,15 @@ var mountedStoreSchema = z.object({
151
151
  // Git remote locator for this clone, if any. Absent = local-only store
152
152
  // (valid; doctor nudges to add a remote for backup — R5#5, P6).
153
153
  remote: z.string().min(1).optional(),
154
- // v2.1.0-rc.1 P3: marks the implicit personal store (the one minted by
155
- // `install --global`). Exactly one mounted store carries personal=true; it
156
- // is the write target for personal-scope entries (R5#3) and always in the
157
- // read-set (S11). Optional (no default) so the output type stays a plain
158
- // optional consumers coalesce `?? false` when building resolver input.
154
+ // v2.1.0-rc.1 P3: marks a personal store (the kind minted by
155
+ // `install --global`). 语义 A (multi-personal): MULTIPLE mounted stores may
156
+ // carry personal=true a machine can mount several personal stores and
157
+ // switch which is ACTIVE via globalConfig.active_personal_store. The ACTIVE
158
+ // personal is the write target for personal-scope entries (R5#3) and the one
159
+ // in the read-set (S11); non-active personal stores stay mounted but out of
160
+ // the read-set. Absent active pointer ⇒ resolver falls back to the first
161
+ // mounted personal (back-compat). Optional (no default) so the output type
162
+ // stays a plain optional — consumers coalesce `?? false`.
159
163
  personal: z.boolean().optional(),
160
164
  // Whether writes are accepted into this store from this machine. Optional;
161
165
  // consumers coalesce `?? true`. Shared stores cloned read-only set false.
@@ -174,15 +178,34 @@ var globalConfigSchema = z.object({
174
178
  // All stores mounted on this machine. The implicit personal store is
175
179
  // included here once initialized. Default empty so a fresh global config
176
180
  // (before `install --global`) parses cleanly.
177
- stores: z.array(mountedStoreSchema).optional().default([])
181
+ stores: z.array(mountedStoreSchema).optional().default([]),
182
+ // 语义 A (multi-personal): alias/UUID of the ACTIVE personal store among the
183
+ // possibly-many `personal:true` stores in `stores[]`. Machine-wide (personal
184
+ // is uid-scoped identity, KT-DEC-0020) — switching it in any repo takes
185
+ // effect everywhere. Set by `fabric store switch-personal <alias>` and the
186
+ // install personal slot. Absent ⇒ the resolver falls back to the first
187
+ // mounted personal, so legacy single-personal configs are unchanged.
188
+ active_personal_store: z.string().min(1).optional()
178
189
  }).passthrough();
179
190
 
180
191
  // src/store/global-config-io.ts
181
192
  import { existsSync, mkdirSync, readFileSync, writeFileSync } from "fs";
182
193
  import { homedir } from "os";
183
194
  import { join } from "path";
195
+ function isTestRuntime() {
196
+ return process.env.VITEST !== void 0 || process.env.VITEST_WORKER_ID !== void 0;
197
+ }
184
198
  function resolveGlobalRoot() {
185
- return join(process.env.FABRIC_HOME ?? homedir(), ".fabric");
199
+ const fabricHome = process.env.FABRIC_HOME;
200
+ if (fabricHome !== void 0 && fabricHome !== "") {
201
+ return join(fabricHome, ".fabric");
202
+ }
203
+ if (isTestRuntime()) {
204
+ throw new Error(
205
+ "resolveGlobalRoot(): FABRIC_HOME must be set under the test runner \u2014 refusing to fall back to the real home dir (~/.fabric). Repoint process.env.FABRIC_HOME to an isolated temp dir in beforeEach (see plan-context.test.ts for the pattern)."
206
+ );
207
+ }
208
+ return join(homedir(), ".fabric");
186
209
  }
187
210
  function globalConfigPath(globalRoot = resolveGlobalRoot()) {
188
211
  return join(globalRoot, "fabric-global.json");
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  resolveGlobalLocale
3
- } from "./chunk-2GLIAZ5M.js";
3
+ } from "./chunk-ASS2KBB7.js";
4
4
 
5
5
  // src/templates/bootstrap-canonical.ts
6
6
  var BOOTSTRAP_MARKER_BEGIN = "<!-- fabric:bootstrap:begin -->";