@ggui-ai/mcp-server-handlers 0.22.0 → 0.24.0

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.
Files changed (49) hide show
  1. package/dist/blueprints/search-blueprints.d.ts +10 -6
  2. package/dist/blueprints/search-blueprints.d.ts.map +1 -1
  3. package/dist/blueprints/search-blueprints.js +10 -6
  4. package/dist/ops-blueprint/generate.d.ts.map +1 -1
  5. package/dist/ops-blueprint/generate.js +5 -1
  6. package/dist/renders/blueprint-matcher.d.ts +29 -12
  7. package/dist/renders/blueprint-matcher.d.ts.map +1 -1
  8. package/dist/renders/blueprint-matcher.js +93 -82
  9. package/dist/renders/blueprint-registry.d.ts.map +1 -1
  10. package/dist/renders/blueprint-registry.js +20 -3
  11. package/dist/renders/consume.d.ts +32 -0
  12. package/dist/renders/consume.d.ts.map +1 -1
  13. package/dist/renders/decide-handshake.d.ts +13 -5
  14. package/dist/renders/decide-handshake.d.ts.map +1 -1
  15. package/dist/renders/decide-handshake.js +31 -11
  16. package/dist/renders/handshake-fallbacks.d.ts +3 -1
  17. package/dist/renders/handshake-fallbacks.d.ts.map +1 -1
  18. package/dist/renders/handshake-fallbacks.js +1 -0
  19. package/dist/renders/handshake.d.ts +37 -3
  20. package/dist/renders/handshake.d.ts.map +1 -1
  21. package/dist/renders/handshake.js +7 -2
  22. package/dist/renders/index.d.ts +3 -2
  23. package/dist/renders/index.d.ts.map +1 -1
  24. package/dist/renders/index.js +1 -0
  25. package/dist/renders/installed-blueprints-provider.d.ts +23 -1
  26. package/dist/renders/installed-blueprints-provider.d.ts.map +1 -1
  27. package/dist/renders/installed-blueprints-provider.js +45 -8
  28. package/dist/renders/match-precision/run-probe.js +197 -18
  29. package/dist/renders/probe-anthropic-judge.d.ts +1 -0
  30. package/dist/renders/probe-anthropic-judge.d.ts.map +1 -1
  31. package/dist/renders/probe-anthropic-judge.js +1 -1
  32. package/dist/renders/record-committed-one-shot.d.ts +54 -0
  33. package/dist/renders/record-committed-one-shot.d.ts.map +1 -0
  34. package/dist/renders/record-committed-one-shot.js +41 -0
  35. package/dist/renders/render.d.ts +24 -0
  36. package/dist/renders/render.d.ts.map +1 -1
  37. package/dist/renders/render.js +18 -3
  38. package/dist/renders/runtime-telemetry.d.ts +9 -0
  39. package/dist/renders/runtime-telemetry.d.ts.map +1 -1
  40. package/dist/renders/runtime-telemetry.js +9 -0
  41. package/dist/renders/slice-meta-derivation.d.ts +8 -1
  42. package/dist/renders/slice-meta-derivation.d.ts.map +1 -1
  43. package/dist/renders/slice-meta-derivation.js +11 -0
  44. package/dist/renders/submit-action.d.ts +15 -1
  45. package/dist/renders/submit-action.d.ts.map +1 -1
  46. package/dist/renders/submit-action.js +42 -1
  47. package/dist/types.d.ts +8 -0
  48. package/dist/types.d.ts.map +1 -1
  49. package/package.json +8 -8
@@ -53,12 +53,16 @@
53
53
  import { z } from 'zod';
54
54
  import type { BlueprintProvider, EmbeddingProvider, VectorStore } from '@ggui-ai/mcp-server-core';
55
55
  /**
56
- * The similarity floor for blueprint reuse, on both paths: this tool
57
- * drops a hit under it, and the handshake matcher (`matchBlueprint`)
58
- * never offers its judge a candidate under it (ggui#1275) — one number,
59
- * so the path that serves a reuse is never looser than the path that
60
- * only lists candidates. Below this is noise; callers that want stricter
61
- * matching post-filter by `score`.
56
+ * The similarity floor for this tool: a hit under it is dropped. Below
57
+ * this is noise; callers that want stricter matching post-filter by
58
+ * `score`.
59
+ *
60
+ * The handshake matcher (`matchBlueprint`) gates its judge with its own
61
+ * number (0.2), not this one, because the two are not on one scale: the
62
+ * matcher's retrieval query embeds a request's intent without its
63
+ * contract while stored vectors embed both, which depresses its cosines
64
+ * (ggui#606, ggui#1275). One shared number returns when the matcher's
65
+ * query is composed like the stored side.
62
66
  */
63
67
  export declare const MIN_SIMILARITY_SCORE = 0.3;
64
68
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"search-blueprints.d.ts","sourceRoot":"","sources":["../../src/blueprints/search-blueprints.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmDG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAEV,iBAAiB,EACjB,iBAAiB,EACjB,WAAW,EACZ,MAAM,0BAA0B,CAAC;AAUlC;;;;;;;GAOG;AACH,eAAO,MAAM,oBAAoB,MAAM,CAAC;AAExC;;;;GAIG;AACH,eAAO,MAAM,yBAAyB,IAAM,CAAC;AAE7C;;;;;;;GAOG;AACH,eAAO,MAAM,wBAAwB,MAAM,CAAC;AAE5C;;;;GAIG;AACH,eAAO,MAAM,kCAAkC,OAAO,CAAC;AAEvD;;;;GAIG;AACH,MAAM,WAAW,8BAA8B;IAC7C;;;;;OAKG;IACH,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,wEAAwE;IACxE,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,gEAAgE;IAChE,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,KAAK,CAAC;CAC/B;AAED,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,SAAS,EAAE,iBAAiB,CAAC;IACtC,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC;IAC9B;;;;;;;;;;;OAWG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,iBAAiB,CAAC;IACxC;;;;;OAKG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,8BAA8B,CAAC;CACpD;AAcD;;;;;;;;GAQG;AACH,wBAAgB,6BAA6B,CAAC,IAAI,EAAE,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyDvE"}
1
+ {"version":3,"file":"search-blueprints.d.ts","sourceRoot":"","sources":["../../src/blueprints/search-blueprints.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;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-ai/protocol';
55
55
  import { defineHandler } from '../types.js';
56
56
  /**
57
- * The similarity floor for blueprint reuse, on both paths: this tool
58
- * drops a hit under it, and the handshake matcher (`matchBlueprint`)
59
- * never offers its judge a candidate under it (ggui#1275) — one number,
60
- * so the path that serves a reuse is never looser than the path that
61
- * only lists candidates. Below this is noise; callers that want stricter
62
- * matching post-filter by `score`.
57
+ * The similarity floor for this tool: a hit under it is dropped. Below
58
+ * this is noise; callers that want stricter matching post-filter by
59
+ * `score`.
60
+ *
61
+ * The handshake matcher (`matchBlueprint`) gates its judge with its own
62
+ * number (0.2), not this one, because the two are not on one scale: the
63
+ * matcher's retrieval query embeds a request's intent without its
64
+ * contract while stored vectors embed both, which depresses its cosines
65
+ * (ggui#606, ggui#1275). One shared number returns when the matcher's
66
+ * query is composed like the stored side.
63
67
  */
64
68
  export const MIN_SIMILARITY_SCORE = 0.3;
65
69
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../../src/ops-blueprint/generate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AAEH,OAAO,KAAK,EACV,gBAAgB,EAChB,iBAAiB,EACjB,cAAc,EACd,iBAAiB,EACjB,aAAa,EAGd,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAGL,KAAK,SAAS,EACd,KAAK,YAAY,EAIlB,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAEL,KAAK,qBAAqB,EAC1B,KAAK,qBAAqB,EAC3B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAiB,KAAK,cAAc,EAAE,MAAM,aAAa,CAAC;AACjE,OAAO,EAAyB,KAAK,yBAAyB,EAAE,MAAM,iBAAiB,CAAC;AAsBxF;;;;;;GAMG;AACH,MAAM,WAAW,WAAW;IAC1B,CAAC,QAAQ,EAAE,MAAM,EAA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AAC;IACvC;;;;;;OAMG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,WAAW,CAAC;IAC/B;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,QAAQ,CAAC,aAAa,CAAC,EAAE,qBAAqB,CAAC;IAC/C;;;;OAIG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,aAAa,CAAC;IACnC;;;OAGG;IACH,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,MAAM,CAAC;IAC5B;;;OAGG;IACH,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,MAAM,CAAC;IACxC;;;;;;;OAOG;IACH,QAAQ,CAAC,kBAAkB,CAAC,EAAE,yBAAyB,CAAC;CACzD;AA2CD,wBAAgB,qCAAqC,CACnD,IAAI,EAAE,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;;GA0SnC"}
@@ -250,7 +250,11 @@ export function createGguiOpsGenerateBlueprintHandler(deps) {
250
250
  }
251
251
  // 6. Persist the blueprint + code body.
252
252
  const componentCode = result.response.componentCode;
253
- const codeHash = createHash("sha256").update(componentCode).digest("hex").slice(0, 32);
253
+ // The full sha256, the `CodeStore` key domain (`CODE_HASH_REGEX`) and
254
+ // the same key `ggui_ops_register_blueprint` computes for the same
255
+ // bytes. A 32-hex prefix here (ggui#1287) was refused by every
256
+ // conforming code store.
257
+ const codeHash = createHash("sha256").update(componentCode).digest("hex");
254
258
  // The advanced generator tunnels `validatorScore` through
255
259
  // `metadata` until the UiGenerator interface widens to carry
256
260
  // it explicitly. Read it via the typed helper so the default
@@ -45,6 +45,7 @@
45
45
  * matcher returns `match-skip-no-llm`.
46
46
  */
47
47
  import type { LLMCaller } from '@ggui-ai/negotiator';
48
+ import { type RerankJudge } from '@ggui-ai/negotiator';
48
49
  import { type DataContract, type BlueprintVariance } from '@ggui-ai/protocol';
49
50
  import { type CacheTraceStrategy } from './cache-trace-sink.js';
50
51
  import { type Blueprint, type BlueprintCandidate, type BlueprintKind, type BlueprintRegistryDeps } from './blueprint-registry.js';
@@ -105,11 +106,28 @@ export interface MatchBlueprintDeps {
105
106
  */
106
107
  readonly llm?: LLMCaller;
107
108
  /**
108
- * Optional marketplace-install bridge. When set, the
109
- * matcher calls `ensureCached(scope)` before consulting the
110
- * registry — installed blueprints lazily compile + populate the
111
- * same vector store the matcher reads, so the next lookup sees
112
- * them. Idempotent per scope; subsequent calls are cheap no-ops.
109
+ * The rerank judge as a PAIR with the confidence threshold it was
110
+ * measured on (ggui#1235). Absent → today's default, `llm` bound
111
+ * through `llmRerankJudge` at `options.judgeThreshold` (0.5). Present
112
+ * → this judge decides, its `threshold` is the cut, and
113
+ * `options.judgeThreshold` does not apply to it: a threshold never
114
+ * travels apart from the judge it was calibrated on. A judge that
115
+ * resolves its own cut internally (a decision provider with a fallback
116
+ * chain) passes `threshold: 0` and declines only with `matchId: null`.
117
+ * Wins over a bare `llm` when both are given.
118
+ */
119
+ readonly rerank?: {
120
+ readonly judge: RerankJudge;
121
+ readonly threshold: number;
122
+ };
123
+ /**
124
+ * Optional marketplace-install bridge. When set, the matcher STARTS
125
+ * `ensureCached(scope)` and reads the exact key while it runs: a hit
126
+ * the walk can never evict (not bridge-owned) is served at once; a
127
+ * bridge-owned hit, a miss and the semantic tier all wait for it
128
+ * (ggui#1370). Installed blueprints lazily compile + populate the same
129
+ * vector store the matcher reads, so the next lookup sees them.
130
+ * Idempotent per scope; subsequent calls are cheap no-ops.
113
131
  *
114
132
  * Best-effort: ensureCached failures are swallowed so a broken
115
133
  * installed-blueprint compile can't sink an otherwise-healthy
@@ -125,13 +143,12 @@ export interface MatchBlueprintOptions {
125
143
  /** RAG top-K. Default 20 — balance between recall and prompt cost. */
126
144
  readonly topK?: number;
127
145
  /**
128
- * Minimum cosine a candidate needs to reach the LLM judge. Default
129
- * {@link MIN_SIMILARITY_SCORE} (0.3) — the same floor
130
- * `ggui_search_blueprints` applies, so the path that serves a reuse is
131
- * never looser than the path that only lists candidates. Applied PER
132
- * CANDIDATE (ggui#1275): a candidate under the floor is never offered to
133
- * the judge, so it can never become a reuse; when even top-1 is under
134
- * it, the judge is skipped entirely and the rerank cost is saved.
146
+ * Minimum cosine a candidate needs to reach the LLM judge. Default 0.2
147
+ * (see the DEFAULT_MIN_COSINE note for why it is not
148
+ * `ggui_search_blueprints`' 0.3). Applied PER CANDIDATE (ggui#1275): a
149
+ * candidate under the floor is never offered to the judge, so it can
150
+ * never become a reuse; when even top-1 is under it, the judge is skipped
151
+ * entirely and the rerank cost is saved.
135
152
  */
136
153
  readonly minCosineForRerank?: number;
137
154
  /** LLM judge confidence threshold for treating a semantic-strategy decision as a hit. */
@@ -1 +1 @@
1
- {"version":3,"file":"blueprint-matcher.d.ts","sourceRoot":"","sources":["../../src/renders/blueprint-matcher.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAErD,OAAO,EAEL,KAAK,YAAY,EACjB,KAAK,iBAAiB,EACvB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAML,KAAK,kBAAkB,EACxB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAIL,KAAK,SAAS,EACd,KAAK,kBAAkB,EACvB,KAAK,aAAa,EAClB,KAAK,qBAAqB,EAC3B,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,oCAAoC,CAAC;AACtF,OAAO,EAAe,KAAK,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAcxE,yEAAyE;AACzE,MAAM,WAAW,iBAAiB;IAChC;;;OAGG;IACH,QAAQ,CAAC,QAAQ,EAAE,kBAAkB,CAAC;IACtC,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC;IAC9B,kFAAkF;IAClF,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,gEAAgE;IAChE,QAAQ,CAAC,MAAM,EAAE,MAAM,C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E,MAAM,CAAC;IACxB,QAAQ,CAAC,QAAQ,CAAC,EAAE,YAAY,CAAC;IACjC,QAAQ,CAAC,QAAQ,CAAC,EAAE,iBAAiB,CAAC;CACvC,EACD,OAAO,GAAE,qBAA0B,GAClC,OAAO,CAAC,oBAAoB,CAAC,CA4W/B"}
@@ -1,10 +1,9 @@
1
- import { rerankCandidates } from '@ggui-ai/negotiator';
1
+ import { llmRerankJudge } from '@ggui-ai/negotiator';
2
2
  import { summarizeContract, } from '@ggui-ai/protocol';
3
3
  import { blueprintKey, variantKey } from '@ggui-ai/protocol/blueprint-key';
4
4
  import { emitCacheTraceEvent, newCacheTraceId, truncateCacheTraceIntent, } from './cache-trace-sink.js';
5
5
  import { findBlueprintExact, findBlueprintsByEmbedding, recordBlueprintHit, } from './blueprint-registry.js';
6
6
  import { coverageGap } from './blueprint-coverage.js';
7
- import { MIN_SIMILARITY_SCORE } from '../blueprints/search-blueprints.js';
8
7
  /** An all-empty coverage gap — used for exact-key hits (canonical-key
9
8
  * equality already implies full coverage) and for contract-less requests
10
9
  * (nothing to cover against). */
@@ -16,16 +15,24 @@ const EMPTY_GAP = {
16
15
  gadgets: [],
17
16
  };
18
17
  const DEFAULT_TOP_K = 20;
19
- // The cosine floor is the shared similarity floor, not a matcher-local
20
- // number (ggui#1275). It was loosened to 0.2 for Path-A on the argument
21
- // that over-proposal is safe because the agent disposes of every proposal.
22
- // Measured on a development deployment, the valve is weak — calling agents
23
- // confirmed 84 % of semantic proposals, and 2 of the 8 reuses between 0.2
24
- // and 0.3 were wrong — so the floor went back to the one number both paths
25
- // share.
26
- // Cost, stated rather than hidden: a short intent that is the same task in
27
- // fewer words can embed under 0.3 and now cold-generates.
28
- const DEFAULT_MIN_COSINE = MIN_SIMILARITY_SCORE;
18
+ // The cosine gate before the judge. It is 0.2 and deliberately NOT
19
+ // `ggui_search_blueprints`' 0.3, because the two numbers are not on one
20
+ // scale: the retrieval query below embeds the request's intent ALONE
21
+ // (`ragArg = { intent }`), while every stored vector embeds its contract
22
+ // summary AND its intent (`composeEmbeddingInput(contract, intent)`). That
23
+ // asymmetry (ggui#606) depresses every cosine this matcher sees. Measured
24
+ // on a development deployment with the production embedder (ggui#1275): a
25
+ // request with the same contract and a near-identical intent scored 0.29
26
+ // here and 0.87 when the query carries the contract too. So a 0.3 gate on
27
+ // this scale turns true matches away before the judge sees them.
28
+ // 0.2 is the gate ggui#606's ranking probe ran under, with the judge
29
+ // picking correctly; what the 0.2–0.3 band admits past the judge was
30
+ // sampled once on dev and not calibrated: 8 reuses, 6 right (short
31
+ // intents at 0.27–0.30) and 2 wrong, both on a blueprint with no cached
32
+ // intent, which ggui#1275 (3) now keeps out of the judge entirely. The
33
+ // gate is recalibrated when the query is composed like the stored side
34
+ // (ggui#606, rnd's design and gate).
35
+ const DEFAULT_MIN_COSINE = 0.2;
29
36
  // Loosened for Path-A: accept a semantic judge's pick more readily, so a
30
37
  // paraphrased / similar contract is reused instead of cold-generating.
31
38
  // Over-proposal is bounded by the agent decision step plus the COVERAGE_GAP
@@ -46,7 +53,13 @@ export async function matchBlueprint(deps, scope, query, options = {}) {
46
53
  const kind = options.kind ?? 'template';
47
54
  const topK = options.topK ?? DEFAULT_TOP_K;
48
55
  const minCosine = options.minCosineForRerank ?? DEFAULT_MIN_COSINE;
49
- const judgeThreshold = options.judgeThreshold ?? DEFAULT_JUDGE_THRESHOLD;
56
+ // ggui#1235 — the pair: a supplied judge carries its own cut; the default
57
+ // is today's LLM judge at `options.judgeThreshold` (0.5).
58
+ const rerank = deps.rerank ??
59
+ (deps.llm !== undefined
60
+ ? { judge: llmRerankJudge(deps.llm), threshold: options.judgeThreshold ?? DEFAULT_JUDGE_THRESHOLD }
61
+ : undefined);
62
+ const judgeThreshold = rerank?.threshold ?? options.judgeThreshold ?? DEFAULT_JUDGE_THRESHOLD;
50
63
  const trimmedIntent = query.intent.trim();
51
64
  const startedAt = Date.now();
52
65
  const expectedKey = query.contract !== undefined ? blueprintKey(query.contract) : '';
@@ -96,82 +109,80 @@ export async function matchBlueprint(deps, scope, query, options = {}) {
96
109
  emit({ decision: 'no-match-empty-intent', reason, candidates: [] });
97
110
  return { strategy: 'no-match', reason, candidates: [] };
98
111
  }
99
- // ─── Lazy install-to-cache bridge ─────────────────────────────────
100
- //
101
- // If an installedBlueprints provider is wired, ensure marketplace-
102
- // installed entries for this scope have been compiled + cached
103
- // before we consult the registry. Every call re-runs discovery (a
104
- // metadata-only read — entry ids + contracts, never compiled code)
105
- // so install/uninstall is detected on the next match; the expensive
106
- // compile + register walk runs only when the discovered set's
107
- // signature changed since the last walk. Best-effort: a provider
108
- // error never sinks the match.
112
+ // ggui#1370 — start the installed-blueprints walk, but do NOT wait for it
113
+ // before the exact-key read. On a scope's first call per process the walk
114
+ // enumerates the scope (a whole-index walk on a store that cannot list
115
+ // by scope) before it can settle; an exact-key hit that the walk can never evict — a row
116
+ // that is not bridge-owned — is served at once while the walk finishes in
117
+ // the background (memoised per scope, errors swallowed). Everything else
118
+ // waits: a bridge-owned hit is re-read AFTER the walk because its orphan
119
+ // sweep may have evicted it (the G4 stale-cache guarantee); a miss is
120
+ // re-read because the walk may have compiled + registered an install; and
121
+ // the semantic tier never runs before the walk, since an uninstalled
122
+ // vector is servable there. No hit-count write is issued before the walk
123
+ // settles either — a bump racing the sweep's delete would re-create the
124
+ // uninstalled vector.
125
+ let ensured = Promise.resolve();
109
126
  if (deps.installedBlueprints) {
127
+ const ensureArg = query.contract !== undefined ? { contractKey: expectedKey } : undefined;
128
+ let started;
110
129
  try {
111
- const ensureArg = query.contract !== undefined
112
- ? { contractKey: expectedKey }
113
- : undefined;
114
- await deps.installedBlueprints.ensureCached(scope, ensureArg);
130
+ started = Promise.resolve(deps.installedBlueprints.ensureCached(scope, ensureArg));
115
131
  }
116
132
  catch (err) {
117
- // eslint-disable-next-line no-console -- operator-visible signal; provider should never throw
118
- console.warn(`[blueprint-matcher] installedBlueprints.ensureCached threw — ignoring: ${err instanceof Error ? err.message : String(err)}`);
133
+ started = Promise.reject(err);
119
134
  }
135
+ ensured = started.catch((err) => {
136
+ console.warn(`[blueprint-matcher] installedBlueprints.ensureCached threw — ignoring: ${err instanceof Error ? err.message : String(err)}`);
137
+ });
120
138
  }
121
- // ─── Strategy: exact-key fast-path (agent supplied a contract) ─────
122
- //
123
- // Canonical-key equality lookup — free, deterministic. Hit ⇒
124
- // guaranteed reuse, return immediately (no LLM). Miss ⇒ FALL THROUGH
125
- // to the semantic strategy below.
126
- //
127
- // A fuzzy match to a contract-bearing request is served PROACTIVELY —
128
- // proposing a similar cached UI is the whole point of the cache. Two
129
- // safety properties keep that safe + honest:
130
- // 1. ATOMIC reuse — the caller commits the cached blueprint's OWN
131
- // contract + componentCode together, never the request's contract
132
- // under cached code, so wiring is always internally coherent.
133
- // 2. INFORMATIONAL coverage — `coverageGap(candidate, request)` is
134
- // attached to every semantic hit (below). A non-empty gap (the
135
- // cached UI lacks a surface the request declares — e.g. the
136
- // 2026-05-09 missing-minus case) is NOT dropped; it is reported on
137
- // `hit.coverage` so the decision layer surfaces `COVERAGE_GAP` warn
138
- // findings and the agent can OVERRIDE. Agent override is the safety
139
- // valve, not a hard drop: the cache proposes; the agent disposes.
140
139
  if (query.contract !== undefined) {
141
- try {
142
- const exact = await findBlueprintExact({
143
- vectorStore: deps.registry.vectorStore,
144
- index: deps.registry.index,
145
- }, scope, kind, expectedKey, variantKey(query.variance));
146
- if (exact) {
147
- bumpHitBestEffort(deps.registry, scope, exact.id);
148
- const reason = 'match-exact: this contract already has a saved interface — reusing it';
149
- emit({
150
- decision: 'match-exact',
151
- strategy: 'exact-key',
152
- reason,
153
- candidates: [],
154
- winningBlueprintId: exact.id,
155
- });
156
- return {
157
- strategy: 'exact-key',
158
- blueprint: exact,
159
- cosine: 1,
160
- reason,
161
- coverage: EMPTY_GAP,
162
- };
140
+ const lookupExact = async () => {
141
+ try {
142
+ return await findBlueprintExact({
143
+ vectorStore: deps.registry.vectorStore,
144
+ index: deps.registry.index,
145
+ }, scope, kind, expectedKey, variantKey(query.variance));
146
+ }
147
+ catch (err) {
148
+ const msg = err instanceof Error ? err.message : String(err);
149
+ console.warn(`[blueprint-matcher] exact-key lookup failed: ${msg}`);
150
+ return null;
163
151
  }
152
+ };
153
+ const serveExact = (exact) => {
154
+ const reason = 'match-exact: this contract already has a saved interface — reusing it';
155
+ emit({
156
+ decision: 'match-exact',
157
+ strategy: 'exact-key',
158
+ reason,
159
+ candidates: [],
160
+ winningBlueprintId: exact.id,
161
+ });
162
+ return {
163
+ strategy: 'exact-key',
164
+ blueprint: exact,
165
+ cosine: 1,
166
+ reason,
167
+ coverage: EMPTY_GAP,
168
+ };
169
+ };
170
+ // ─── Strategy: exact-key fast-path (agent supplied a contract) ─────
171
+ const early = await lookupExact();
172
+ if (early !== null && early.installed !== true) {
173
+ const id = early.id;
174
+ void ensured.then(() => bumpHitBestEffort(deps.registry, scope, id));
175
+ return serveExact(early);
164
176
  }
165
- catch (err) {
166
- // Backend errors fall through to no-match — never crash the
167
- // handshake on a registry hiccup.
168
- const msg = err instanceof Error ? err.message : String(err);
169
- // eslint-disable-next-line no-console -- operator-visible signal; exact-key lookup should never fail
170
- console.warn(`[blueprint-matcher] exact-key lookup failed: ${msg}`);
177
+ await ensured;
178
+ const settled = await lookupExact();
179
+ if (settled !== null) {
180
+ bumpHitBestEffort(deps.registry, scope, settled.id);
181
+ return serveExact(settled);
171
182
  }
172
- // Exact-key MISS → fall through to the semantic strategy below. A
173
- // non-covering candidate is no longer dropped — the matcher proposes
174
- // it and reports the coverage gap on the hit for the decision layer.
183
+ }
184
+ else {
185
+ await ensured;
175
186
  }
176
187
  if (options.disableSemantic === true) {
177
188
  // Exact-only reuse policy (ggui#607): the semantic tier is
@@ -226,9 +237,9 @@ export async function matchBlueprint(deps, scope, query, options = {}) {
226
237
  });
227
238
  return { strategy: 'no-match', reason, candidates };
228
239
  }
229
- if (!deps.llm) {
240
+ if (rerank === undefined) {
230
241
  const reason = 'match-skip-no-llm: semantic matching unavailable — a new interface will be generated';
231
- const traceReason = `match-skip-no-llm: ${candidates.length} candidates available but no LLMCaller wired — falling through to cold generation`;
242
+ const traceReason = `match-skip-no-llm: ${candidates.length} candidates available but no judge wired (neither a rerank pair nor an LLMCaller) — falling through to cold generation`;
232
243
  emit({
233
244
  decision: 'match-skip-no-llm',
234
245
  strategy: 'semantic',
@@ -266,7 +277,7 @@ export async function matchBlueprint(deps, scope, query, options = {}) {
266
277
  return { strategy: 'no-match', reason, candidates };
267
278
  }
268
279
  // Run the LLM rerank judge.
269
- const decision = await rerankCandidates({ llm: deps.llm }, {
280
+ const decision = await rerank.judge({
270
281
  intent: trimmedIntent,
271
282
  contractSummary: summarizeContract(query.contract),
272
283
  }, eligible.map((c) => ({
@@ -1 +1 @@
1
- {"version":3,"file":"blueprint-registry.d.ts","sourceRoot":"","sources":["../../src/renders/blueprint-registry.ts"],"names":[],"mappings":"AAyCA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,KAAK,EACV,cAAc,EACd,iBAAiB,EACjB,qBAAqB,EAKrB,WAAW,EACZ,MAAM,0BAA0B,CAAC;AAKlC,YAAY,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAIL,KAAK,eAAe,EACpB,KAAK,iBAAiB,EACtB,KAAK,YAAY,EAClB,MAAM,mBAAmB,CAAC;AAK3B,OAAO,EAEL,KAAK,yBAAyB,EAC9B,KAAK,wBAAwB,EAC9B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAEL,KAAK,uBAAuB,EAC7B,MAAM,2BAA2B,CAAC;AAEnC;;;;GAIG;AACH,MAAM,MAAM,aAAa,GAAG,UAAU,GAAG,UAAU,GAAG,UAAU,GAAG,MAAM,CAAC;AAE1E,mDAAmD;AACnD,MAAM,WAAW,SAAS;IACxB;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,IAAI,EAAE,aAAa,C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AA;CAAE,GAAG,OAAO,CAAC,qBAAqB,CAAC,EACnE,KAAK,EAAE,MAAM,EACb,EAAE,EAAE,MAAM,GACT,OAAO,CAAC,IAAI,CAAC,CA8Bf;AAoBD;;;;;;;;GAQG;AACH,wBAAsB,eAAe,CACnC,IAAI,EAAE;IAAE,WAAW,EAAE,WAAW,CAAC;IAAC,KAAK,EAAE,cAAc,CAAA;CAAE,EACzD,KAAK,EAAE,MAAM,EACb,EAAE,EAAE,MAAM,GACT,OAAO,CAAC,IAAI,CAAC,CAaf"}
@@ -159,6 +159,20 @@ function warnDroppedRow(id, reason) {
159
159
  console.warn(`[ggui] blueprint registry: dropped row ${id} — ${reason} ` +
160
160
  '(legacy rows are invalidated, not migrated; the cache regenerates on next use)');
161
161
  }
162
+ /**
163
+ * Eviction fallbacks already warned this process, by reason. A fallback is
164
+ * not an error (the cap is a soft ceiling), but a silent one hid that every
165
+ * registration was paying a whole-scope walk (ggui#1371). One line per
166
+ * process per reason makes it visible without flooding the log.
167
+ */
168
+ const warnedEvictionFallbacks = new Set();
169
+ function warnEvictionFallback(event, consequence, err) {
170
+ if (warnedEvictionFallbacks.has(event))
171
+ return;
172
+ warnedEvictionFallbacks.add(event);
173
+ // eslint-disable-next-line no-console -- operator-visible degradation notice
174
+ console.warn(`[ggui] blueprint registry: ${event} — ${consequence}: ${err instanceof Error ? err.message : String(err)} (logged once per process)`);
175
+ }
162
176
  function readScalarString(value) {
163
177
  return typeof value === 'string' ? value : undefined;
164
178
  }
@@ -444,8 +458,10 @@ async function maybeEvictLowestHitBlueprint(deps, scope, kind, cap) {
444
458
  if (count < cap)
445
459
  return;
446
460
  }
447
- catch {
448
- // Fall through to the enumeration below.
461
+ catch (err) {
462
+ // Fall through to the enumeration below: counting is an optimization,
463
+ // so the walk still runs; the warn makes its cost visible.
464
+ warnEvictionFallback('blueprint_evict_count_gate_failed', 'the cap count failed, so this registration walks the whole scope instead', err);
449
465
  }
450
466
  }
451
467
  let bucket;
@@ -458,7 +474,8 @@ async function maybeEvictLowestHitBlueprint(deps, scope, kind, cap) {
458
474
  return k === kind;
459
475
  });
460
476
  }
461
- catch {
477
+ catch (err) {
478
+ warnEvictionFallback('blueprint_evict_enumeration_failed', 'the scope enumeration failed, so eviction is skipped and the bucket may exceed its cap', err);
462
479
  return;
463
480
  }
464
481
  if (bucket.length < cap)
@@ -79,6 +79,14 @@ declare const outputSchema: {
79
79
  timeZone: z.ZodOptional<z.ZodString>;
80
80
  }, z.core.$strip>>;
81
81
  }, z.core.$strip>>;
82
+ nextStep: z.ZodOptional<z.ZodObject<{
83
+ tool: z.ZodLiteral<"ggui_amend">;
84
+ description: z.ZodString;
85
+ example: z.ZodString;
86
+ args: z.ZodObject<{
87
+ sessionId: z.ZodString;
88
+ }, z.core.$strip>;
89
+ }, z.core.$strip>>;
82
90
  };
83
91
  /** The wire shape — derived from the registered fields (#817). */
84
92
  export type ConsumeOutput = ShapeOutput<typeof outputSchema>;
@@ -229,6 +237,14 @@ export declare function createGguiConsumeHandler(deps: GguiConsumeHandlerDeps):
229
237
  timeZone: z.ZodOptional<z.ZodString>;
230
238
  }, z.core.$strip>>;
231
239
  }, z.core.$strip>>;
240
+ nextStep: z.ZodOptional<z.ZodObject<{
241
+ tool: z.ZodLiteral<"ggui_amend">;
242
+ description: z.ZodString;
243
+ example: z.ZodString;
244
+ args: z.ZodObject<{
245
+ sessionId: z.ZodString;
246
+ }, z.core.$strip>;
247
+ }, z.core.$strip>>;
232
248
  }, {
233
249
  events: {
234
250
  type: "action";
@@ -259,6 +275,14 @@ export declare function createGguiConsumeHandler(deps: GguiConsumeHandlerDeps):
259
275
  timeZone?: string | undefined;
260
276
  } | undefined;
261
277
  } | undefined;
278
+ nextStep?: {
279
+ tool: "ggui_amend";
280
+ description: string;
281
+ example: string;
282
+ args: {
283
+ sessionId: string;
284
+ };
285
+ } | undefined;
262
286
  } | HandlerFailure<{
263
287
  events: {
264
288
  type: "action";
@@ -289,6 +313,14 @@ export declare function createGguiConsumeHandler(deps: GguiConsumeHandlerDeps):
289
313
  timeZone?: string | undefined;
290
314
  } | undefined;
291
315
  } | undefined;
316
+ nextStep?: {
317
+ tool: "ggui_amend";
318
+ description: string;
319
+ example: string;
320
+ args: {
321
+ sessionId: string;
322
+ };
323
+ } | undefined;
292
324
  }>>;
293
325
  export {};
294
326
  //# sourceMappingURL=consume.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"consume.d.ts","sourceRoot":"","sources":["../../src/renders/consume.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAQxB,OAAO,EACL,KAAK,sBAAsB,EAE3B,KAAK,oBAAoB,EACzB,KAAK,gBAAgB,EAEtB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAIL,KAAK,cAAc,EACnB,KAAK,WAAW,EACjB,MAAM,aAAa,CAAC;AAuBrB,QAAA,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAAgC,CAAC;AACnD,kEAAkE;AAClE,MAAM,MAAM,aAAa,GAAG,WAAW,CAAC,OAAO,YAAY,CAAC,CAAC;AAE7D;;;;;;GAMG;AACH,MAAM,WAAW,gBAAgB;IAC/B,cAAc,CAAC,IAAI,EAAE;QACnB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;QACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;QACtB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;QAC3B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QACvC,QAAQ,CAAC,MAAM,EAAE;YACf,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;YAC5B,QAAQ,CAAC,UAAU,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;YAC3C,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;SACzB,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E,MAAM,CAAC;QACzB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;KAC5B,GAAG,IAAI,CAAC;CACV;AAED;;;;;GAKG;AACH,MAAM,WAAW,aAAa;IAC5B,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;CAC5D;AAED,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,oBAAoB,EAAE,oBAAoB,CAAC;IACpD,QAAQ,CAAC,WAAW,EAAE,gBAAgB,CAAC;IACvC;;sDAEkD;IAClD,QAAQ,CAAC,uBAAuB,CAAC,EAAE,MAAM,CAAC;IAC1C,wDAAwD;IACxD,QAAQ,CAAC,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;IAC7C;;;;;;OAMG;IACH,QAAQ,CAAC,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;IAC7C;;;;OAIG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,aAAa,CAAC;IAChC;;;;;;;;;;OAUG;IACH,QAAQ,CAAC,sBAAsB,CAAC,EAAE,sBAAsB,CAAC;IACzD;;;;;;;;;;OAUG;IACH,QAAQ,CAAC,gBAAgB,CAAC,EAAE,OAAO,gBAAgB,EAAE,oBAAoB,CAAC;CAC3E;AAYD,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAyNpE"}
@@ -32,6 +32,9 @@
32
32
  * LLM loop, guaranteeing a contract the handshake backstop accepts.
33
33
  * No LLM available ⇒ a deterministic no-repair create fallback.
34
34
  *
35
+ * `forceCreate` on the input skips steps 1 and 2 outright: a caller that
36
+ * asked for a fresh build is never handed a cache suggestion.
37
+ *
35
38
  * ## Failure posture
36
39
  *
37
40
  * Operational errors (registry hiccup, provider 5xx, pre-match backend
@@ -71,9 +74,10 @@ export interface BlueprintPool {
71
74
  readonly scope?: string;
72
75
  /**
73
76
  * Optional marketplace-install bridge wired into THIS pool's store.
74
- * The matcher calls `ensureCached(scope)` before querying so installed
75
- * blueprints lazily compile + populate the same store the matcher
76
- * reads. Naturally per-pool — it populates one scope.
77
+ * The matcher starts `ensureCached(scope)` and reads the exact key while
78
+ * it runs; only a hit the walk can never evict is served before it settles
79
+ * (ggui#1370). Installed blueprints lazily compile + populate the same
80
+ * store the matcher reads. Naturally per-pool — it populates one scope.
77
81
  */
78
82
  readonly installedBlueprints?: InstalledBlueprintsProvider;
79
83
  /** Optional human label for warn/trace lines. */
@@ -189,7 +193,9 @@ export declare function buildCacheReuseResult(blueprint: {
189
193
  * `matchedBlueprint.cosine` so the paired render reports it on the
190
194
  * wire's `cacheHit.similarity` (ggui#564).
191
195
  */
192
- matchCosine: number): HandshakeNegotiatorResult;
196
+ matchCosine: number,
197
+ /** The find-similar tier that hit (ggui#1343). */
198
+ kind: 'match-exact' | 'match-semantic'): HandshakeNegotiatorResult;
193
199
  /**
194
200
  * Deterministic no-LLM create fallback (no LLM resolved, or an
195
201
  * operational error during synth). The handshake backstop
@@ -200,7 +206,9 @@ matchCosine: number): HandshakeNegotiatorResult;
200
206
  * return a raw malformed draft into the throwing backstop. A clean
201
207
  * draft is kept verbatim (`origin: 'agent'`).
202
208
  */
203
- export declare function buildCreateFallback(draftContract: unknown, reason: string, requestVariance?: BlueprintVariance): HandshakeNegotiatorResult;
209
+ export declare function buildCreateFallback(draftContract: unknown, reason: string,
210
+ /** WHY no repair ran (ggui#1343): the bounded kind beside `reason`. */
211
+ kind: 'no-creds' | 'negotiator-degraded', requestVariance?: BlueprintVariance): HandshakeNegotiatorResult;
204
212
  /**
205
213
  * Decide a handshake — the shared core. See the module docstring for the
206
214
  * decision spine. Pure orchestration over the injected adapter; never
@@ -1 +1 @@
1
- {"version":3,"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