@ggui-ai/mcp-server-handlers 0.20.0 → 0.21.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.
@@ -1 +1 @@
1
- {"version":3,"file":"describe-data-contract-format.d.ts","sourceRoot":"","sources":["../../src/blueprints/describe-data-contract-format.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AA2VxB,wBAAgB,uCAAuC;;;;;;;;;;;;;;GAkBtD"}
1
+ {"version":3,"file":"describe-data-contract-format.d.ts","sourceRoot":"","sources":["../../src/blueprints/describe-data-contract-format.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AA4VxB,wBAAgB,uCAAuC;;;;;;;;;;;;;;GAkBtD"}
@@ -59,9 +59,10 @@ interface DataContract {
59
59
  \`intent\` is NOT a contract field — the outer pipeline owns it
60
60
  (top-level \`intent\` on the flat \`ggui_handshake\` input). The
61
61
  four-spec surface — propsSpec / actionSpec / contextSpec / streamSpec
62
- — describes the wire exhaustively. See
63
- \`docs/principles/actions-vs-context.md\` for the placement rule on
64
- the two inbound specs.
62
+ — describes the wire exhaustively. The
63
+ placement rule for the two inbound specs — does this thing need the
64
+ agent's next-turn reasoning? Yes → actionSpec, no → contextSpec, no third
65
+ category — is stated at https://docs.ggui.ai/concepts/sessions-and-the-event-model/ .
65
66
 
66
67
  ## PropsSpec
67
68
 
@@ -4,27 +4,39 @@
4
4
  *
5
5
  * One function — `matchBlueprint(deps, scope, query)` — that selects
6
6
  * a lookup strategy by request shape and returns a structured decision
7
- * the caller can branch on. Two strategies, mutually exclusive per
8
- * call — fuzzy matching across non-equal canonical contracts is
9
- * structurally unsafe, so the matcher never cascades between them:
7
+ * the caller can branch on. Two strategies, tried IN ORDER within one
8
+ * call (the body below is the source of truth; this header describes
9
+ * it, ggui#1229):
10
10
  *
11
11
  * - **`exact-key` strategy** — agent supplied a contract.
12
12
  * Canonical-key equality lookup against the registry. Free,
13
- * deterministic, <1ms. Hit ⇒ `match-exact`. Miss ⇒ `no-match`
14
- * (cold gen against the agent's authored contract).
15
- * - **`semantic` strategy** — agent omitted a contract.
16
- * RAG (top-K cosine) + LLM rerank judge. Hit ⇒ `match-semantic`.
17
- * Miss buckets distinguish cosine-gate skip, no-LLM-wired skip,
18
- * judge declined, low-confidence, defense. ~$0.001 + ~1.5s when
19
- * LLM is wired.
13
+ * deterministic, <1ms. Hit ⇒ `match-exact`, returned at once.
14
+ * Miss ⇒ FALL THROUGH to the semantic strategy — unless
15
+ * `options.disableSemantic` (the exact-only reuse policy,
16
+ * ggui#607), in which case the miss is reported as `no-match`
17
+ * without spending retrieval or the judge.
18
+ * - **`semantic` strategy** — agent omitted a contract, or the
19
+ * exact key missed. RAG (top-K cosine) + LLM rerank judge. Hit ⇒
20
+ * `match-semantic`. Miss buckets distinguish cosine-gate skip,
21
+ * no-LLM-wired skip, judge declined, low-confidence, defense.
22
+ * ~$0.001 + ~1.5s when LLM is wired.
23
+ *
24
+ * A semantic hit for a contract-bearing request is served PROACTIVELY,
25
+ * kept safe by two properties (stated again at the branch): reuse is
26
+ * ATOMIC (the cached blueprint's own contract + code, never the
27
+ * request's contract under cached code), and coverage is INFORMATIONAL
28
+ * (`coverageGap` rides every semantic hit; the decision layer surfaces
29
+ * it as `COVERAGE_GAP` warn findings and the agent may override — the
30
+ * cache proposes, the agent disposes).
20
31
  *
21
32
  * Caller treats `match-*` as reuse and `no-match*` as cold gen; the
22
33
  * produced blueprint is registered into the scope post-gen.
23
34
  *
24
- * The matcher is the single source of truth for the decision; both
25
- * `ggui_handshake` and `ggui_render` route through it. Without
26
- * unification the two surfaces would drift, leaving "did this hit
27
- * via handshake or render?" as a debug pain point.
35
+ * The matcher is the single source of truth for the decision. Its
36
+ * callers today: `decide-handshake` (the `ggui_handshake` path), the
37
+ * cache-reuse probe and the match-precision probe. `ggui_render` does
38
+ * NOT call it (§6): render resolves the blueprint by the identity the
39
+ * handshake already decided.
28
40
  *
29
41
  * No I/O concerns leak to the caller — `BlueprintRegistryDeps`
30
42
  * captures the embedder + vector store, and an optional `LLMCaller`
@@ -112,9 +124,15 @@ export interface MatchBlueprintOptions {
112
124
  readonly kind?: BlueprintKind;
113
125
  /** RAG top-K. Default 20 — balance between recall and prompt cost. */
114
126
  readonly topK?: number;
115
- /** Minimum cosine on top-1 to even invoke the LLM judge. Default 0.2 — */
116
- /** below this the candidates are clearly unrelated; rerank cost is wasted. */
117
- /** (Loosened for Path-A; see the DEFAULT_MIN_COSINE note.) */
127
+ /**
128
+ * Minimum cosine a candidate needs to reach the LLM judge. Default 0.2 —
129
+ * below this a candidate is clearly unrelated. Applied PER CANDIDATE
130
+ * (ggui#1275): a candidate under the floor is never offered to the judge,
131
+ * so it can never become a reuse; when even top-1 is under it, the judge
132
+ * is skipped entirely and the rerank cost is saved. (Loosened for Path-A;
133
+ * see the DEFAULT_MIN_COSINE note. The VALUE is rnd's to tune; the
134
+ * per-candidate semantics are this matcher's.)
135
+ */
118
136
  readonly minCosineForRerank?: number;
119
137
  /** LLM judge confidence threshold for treating a semantic-strategy decision as a hit. */
120
138
  /** Default 0.5 — loosened for Path-A; see the DEFAULT_JUDGE_THRESHOLD note. */
@@ -1 +1 @@
1
- {"version":3,"file":"blueprint-matcher.d.ts","sourceRoot":"","sources":["../../src/renders/blueprint-matcher.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;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,aAA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AAC,EAAE,MAAM,CAAC;IACjC;;;;;;;;OAQG;IACH,QAAQ,CAAC,eAAe,CAAC,EAAE,OAAO,CAAC;CACpC;AAcD;;;;;;;GAOG;AACH,wBAAsB,cAAc,CAClC,IAAI,EAAE,kBAAkB,EACxB,KAAK,EAAE,MAAM,EACb,KAAK,EAAE;IACL,QAAQ,CAAC,MAAM,EAAE,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,CAkV/B"}
@@ -228,11 +228,20 @@ export async function matchBlueprint(deps, scope, query, options = {}) {
228
228
  });
229
229
  return { strategy: 'no-match', reason, candidates };
230
230
  }
231
+ // ggui#1275 — the floor is per candidate. Top-1 clearing it used to hand
232
+ // ALL top-K to the judge, which could pick any of them (observed: a reuse
233
+ // at cosine 0.19 under the 0.2 floor because top-1 was 0.27). Only
234
+ // candidates at or above the floor are eligible; top-1 is among them, so
235
+ // the list is never empty here. The trace still carries the full top-K.
236
+ const eligible = candidates.filter((c) => c.cosine >= minCosine);
237
+ const floorNote = eligible.length < candidates.length
238
+ ? ` (${eligible.length} of ${candidates.length} candidates at or above minCosine=${minCosine})`
239
+ : '';
231
240
  // Run the LLM rerank judge.
232
241
  const decision = await rerankCandidates({ llm: deps.llm }, {
233
242
  intent: trimmedIntent,
234
243
  contractSummary: summarizeContract(query.contract),
235
- }, candidates.map((c) => ({
244
+ }, eligible.map((c) => ({
236
245
  id: c.blueprint.id,
237
246
  cachedIntent: c.blueprint.intent,
238
247
  cachedContractSummary: summarizeContract(c.blueprint.contract),
@@ -243,7 +252,7 @@ export async function matchBlueprint(deps, scope, query, options = {}) {
243
252
  ? 'no-match: judge declined all candidates — a new interface will be generated'
244
253
  : 'no-match-low-confidence: the closest saved interface is not a confident match — a new one will be generated';
245
254
  const traceReason = decision.matchId === null
246
- ? `no-match: judge declined all ${candidates.length} candidates (confidence=${decision.confidence.toFixed(2)})`
255
+ ? `no-match: judge declined all ${eligible.length} candidates (confidence=${decision.confidence.toFixed(2)})${floorNote}`
247
256
  : `no-match-low-confidence: judge picked ${decision.matchId} but confidence=${decision.confidence.toFixed(2)} < threshold=${judgeThreshold}`;
248
257
  emit({
249
258
  decision: decision.matchId === null ? 'no-match' : 'no-match-low-confidence',
@@ -260,7 +269,7 @@ export async function matchBlueprint(deps, scope, query, options = {}) {
260
269
  judgeReason: decision.reason,
261
270
  };
262
271
  }
263
- const matched = candidates.find((c) => c.blueprint.id === decision.matchId);
272
+ const matched = eligible.find((c) => c.blueprint.id === decision.matchId);
264
273
  if (!matched) {
265
274
  // Defensive — rerankCandidates already guards against unknown ids
266
275
  // by collapsing to null, but a future change could re-introduce
@@ -335,6 +335,28 @@ export declare const CACHE_TRACE_STDOUT_SCHEMA_VERSION = 1;
335
335
  * Sync + non-throwing per the {@link CacheTraceSink} contract.
336
336
  */
337
337
  export declare function createStdoutJsonCacheTraceSink(): CacheTraceSink;
338
+ /**
339
+ * Version stamp on every scores-JSON trace line. Bump it on ANY change to
340
+ * the emitted shape, as for {@link CACHE_TRACE_STDOUT_SCHEMA_VERSION}.
341
+ */
342
+ export declare const CACHE_TRACE_SCORES_SCHEMA_VERSION = 1;
343
+ /**
344
+ * A sink that writes each {@link CacheTraceEvent} as ONE newline-delimited
345
+ * JSON record to stdout carrying the matcher's DECISIONS AND SCORES ONLY
346
+ * (ggui#1275), so a deployment can measure its reuse distribution — top
347
+ * and chosen cosine, judge confidence, the decision class — where the
348
+ * verbose `logger` projection cannot run because it carries text. Enable
349
+ * with `GGUI_CACHE_TRACE=scores`.
350
+ *
351
+ * It is an ALLOW-list ({@link CacheTraceScoresRecord}): it never writes
352
+ * `intent`, a candidate's `cachedIntent`, `judgeReason` (the judge
353
+ * paraphrases the intent), the free-text `reason`, validator hints or the
354
+ * synthesizer's reason. A field added to {@link CacheTraceEvent} later
355
+ * reaches this line only by being added here, deliberately.
356
+ *
357
+ * Sync + non-throwing per the {@link CacheTraceSink} contract.
358
+ */
359
+ export declare function createScoresJsonCacheTraceSink(): CacheTraceSink;
338
360
  /**
339
361
  * A sink that writes each event as a single-line JSON record to
340
362
  * `console.error`, prefixed `[ggui:cache-trace] `. Intended as an
@@ -1 +1 @@
1
- {"version":3,"file":"cache-trace-sink.d.ts","sourceRoot":"","sources":["../../src/renders/cache-trace-sink.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuDG;AACH,MAAM,MAAM,kBAAkB,GAC1B,aAAa,GACb,gBAAgB,GAChB,uBAAuB,GACvB,mBAAmB,GACnB,UAAU,GACV,yBAAyB,GACzB,wBAAwB,GACxB,uBAAuB,GACvB,UAAU,GACV,YAAY,GACZ,iBAAiB,GACjB,KAAK,GACL,mBAAmB,GACnB,kBAAkB,GAClB,sBAAsB,GACtB,mBAAmB,GACnB,iBAAiB,CAAC;AAEtB;;;;;;;;;;;;;;;GAeG;AACH,MAAM,MAAM,kBAAkB,GAAG,WAAW,GAAG,UAAU,CAAC;AAE1D;;;;;;GAMG;AACH,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;CAChC;AAED;;;;;GAKG;AACH,MAAM,WAAW,eAAe;IAC9B,sEAAsE;IACtE,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,0CAA0C;IAC1C,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,oEAAoE;IACpE,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,yDAAyD;IACzD,QAA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cAAc;IAC7B,IAAI,CAAC,KAAK,EAAE,eAAe,GAAG,IAAI,CAAC;CACpC;AAID;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,cAAc,GAAG,IAAI,GAAG,IAAI,CAEnE;AAED,8CAA8C;AAC9C,wBAAgB,iBAAiB,IAAI,cAAc,GAAG,IAAI,CAEzD;AAqCD,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,eAAe,GAAG,IAAI,CAwChE;AAED;;;;GAIG;AACH,eAAO,MAAM,iCAAiC,IAAI,CAAC;AAKnD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,8BAA8B,IAAI,cAAc,CA4B/D;AAED;;;GAGG;AACH,eAAO,MAAM,iCAAiC,IAAI,CAAC;AAkCnD;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,8BAA8B,IAAI,cAAc,CAsD/D;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,0BAA0B,IAAI,cAAc,CA8B3D;AAED;;;GAGG;AACH,wBAAgB,eAAe,IAAI,MAAM,CAKxC;AAED,2FAA2F;AAC3F,eAAO,MAAM,sBAAsB,IAAI,CAAC;AAExC;;;;;;GAMG;AACH,eAAO,MAAM,4BAA4B,OAAO,CAAC;AAEjD;;;;GAIG;AACH,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAG/D"}
@@ -81,6 +81,13 @@ function envStdoutSink() {
81
81
  }
82
82
  return envStdoutSinkSingleton;
83
83
  }
84
+ let envScoresSinkSingleton = null;
85
+ function envScoresSink() {
86
+ if (!envScoresSinkSingleton) {
87
+ envScoresSinkSingleton = createScoresJsonCacheTraceSink();
88
+ }
89
+ return envScoresSinkSingleton;
90
+ }
84
91
  export function emitCacheTraceEvent(event) {
85
92
  // Env-gated stdout JSON diagnostic (`GGUI_CACHE_TRACE=logger`) — like
86
93
  // the stderr gate below, it lives INSIDE this function rather than
@@ -89,7 +96,8 @@ export function emitCacheTraceEvent(event) {
89
96
  // sink proved fragile across module-instance boundaries in exactly
90
97
  // the way the registry docstring above warns (2026-08-21: an armed
91
98
  // deployment produced zero lines); the in-module gate cannot miss.
92
- if (process.env['GGUI_CACHE_TRACE'] === 'logger') {
99
+ const traceMode = process.env['GGUI_CACHE_TRACE'];
100
+ if (traceMode === 'logger') {
93
101
  try {
94
102
  envStdoutSink().emit(event);
95
103
  }
@@ -97,6 +105,15 @@ export function emitCacheTraceEvent(event) {
97
105
  // Diagnostic must never break generation.
98
106
  }
99
107
  }
108
+ else if (traceMode === 'scores') {
109
+ // ggui#1275 — the prod-safe projection: decisions, keys and scores, no text.
110
+ try {
111
+ envScoresSink().emit(event);
112
+ }
113
+ catch {
114
+ // Diagnostic must never break generation.
115
+ }
116
+ }
100
117
  // Env-gated stderr diagnostic — independent of any registered sink, so the
101
118
  // matcher's decision is visible in captured stderr regardless of whether a
102
119
  // devtools sink is wired (and regardless of module-singleton boundaries).
@@ -176,6 +193,80 @@ export function createStdoutJsonCacheTraceSink() {
176
193
  },
177
194
  };
178
195
  }
196
+ /**
197
+ * Version stamp on every scores-JSON trace line. Bump it on ANY change to
198
+ * the emitted shape, as for {@link CACHE_TRACE_STDOUT_SCHEMA_VERSION}.
199
+ */
200
+ export const CACHE_TRACE_SCORES_SCHEMA_VERSION = 1;
201
+ /**
202
+ * A sink that writes each {@link CacheTraceEvent} as ONE newline-delimited
203
+ * JSON record to stdout carrying the matcher's DECISIONS AND SCORES ONLY
204
+ * (ggui#1275), so a deployment can measure its reuse distribution — top
205
+ * and chosen cosine, judge confidence, the decision class — where the
206
+ * verbose `logger` projection cannot run because it carries text. Enable
207
+ * with `GGUI_CACHE_TRACE=scores`.
208
+ *
209
+ * It is an ALLOW-list ({@link CacheTraceScoresRecord}): it never writes
210
+ * `intent`, a candidate's `cachedIntent`, `judgeReason` (the judge
211
+ * paraphrases the intent), the free-text `reason`, validator hints or the
212
+ * synthesizer's reason. A field added to {@link CacheTraceEvent} later
213
+ * reaches this line only by being added here, deliberately.
214
+ *
215
+ * Sync + non-throwing per the {@link CacheTraceSink} contract.
216
+ */
217
+ export function createScoresJsonCacheTraceSink() {
218
+ return {
219
+ emit(event) {
220
+ try {
221
+ const top = event.candidates[0];
222
+ const chosen = event.winningBlueprintId !== undefined
223
+ ? event.candidates.find((c) => c.key === event.winningBlueprintId)
224
+ : undefined;
225
+ const record = {
226
+ level: 'info',
227
+ time: new Date(event.at).toISOString(),
228
+ msg: 'cache_trace_scores',
229
+ traceSchemaVersion: CACHE_TRACE_SCORES_SCHEMA_VERSION,
230
+ id: event.id,
231
+ durationMs: event.durationMs,
232
+ appId: event.scope,
233
+ decision: event.decision,
234
+ ...(event.strategy !== undefined ? { strategy: event.strategy } : {}),
235
+ threshold: event.threshold,
236
+ expectedKey: event.expectedKey,
237
+ ...(event.judgeConfidence !== undefined ? { judgeConfidence: event.judgeConfidence } : {}),
238
+ ...(event.winningBlueprintId !== undefined ? { matchedBlueprintId: event.winningBlueprintId } : {}),
239
+ candidateCount: event.candidates.length,
240
+ ...(top !== undefined ? { topCosine: top.score } : {}),
241
+ ...(chosen !== undefined ? { chosenCosine: chosen.score } : {}),
242
+ candidatesJson: JSON.stringify(event.candidates
243
+ .slice(0, CACHE_TRACE_STDOUT_CANDIDATES_CAP)
244
+ .map((c) => ({ key: c.key, score: c.score }))),
245
+ ...(event.cosineNoveltyDistance !== undefined
246
+ ? { cosineNoveltyDistance: event.cosineNoveltyDistance }
247
+ : {}),
248
+ ...(event.agentClassification !== undefined
249
+ ? { agentClassification: event.agentClassification }
250
+ : {}),
251
+ ...(event.synth !== undefined
252
+ ? {
253
+ synthFired: event.synth.fired,
254
+ synthSuccess: event.synth.success,
255
+ synthLatencyMs: event.synth.latencyMs,
256
+ ...(event.synth.outputContractKey !== undefined
257
+ ? { outputContractKey: event.synth.outputContractKey }
258
+ : {}),
259
+ }
260
+ : {}),
261
+ };
262
+ process.stdout.write(`${JSON.stringify(record)}\n`);
263
+ }
264
+ catch {
265
+ // A diagnostic sink must never break generation — swallow.
266
+ }
267
+ },
268
+ };
269
+ }
179
270
  /**
180
271
  * A sink that writes each event as a single-line JSON record to
181
272
  * `console.error`, prefixed `[ggui:cache-trace] `. Intended as an
@@ -38,6 +38,7 @@ import { homedir } from 'node:os';
38
38
  import { join, resolve as pathResolve } from 'node:path';
39
39
  import { InMemoryBlueprintIndex, InMemoryVectorStore, } from '@ggui-ai/mcp-server-core/in-memory';
40
40
  import { createLocalEmbeddingProvider } from '@ggui-ai/embedding-local';
41
+ import { anthropicProbeJudge } from '../probe-anthropic-judge.js';
41
42
  import { matchBlueprint } from '../blueprint-matcher.js';
42
43
  import { findBlueprintsByEmbedding, registerBlueprint, } from '../blueprint-registry.js';
43
44
  import { setCacheTraceSink, } from '../cache-trace-sink.js';
@@ -57,42 +58,6 @@ function resolveKey() {
57
58
  throw new Error(`no anthropic key (env or ${p})`);
58
59
  return k;
59
60
  }
60
- function anthropicJudge(apiKey) {
61
- return {
62
- async call() {
63
- throw new Error('text mode unused');
64
- },
65
- async callStructured(system, user, tool) {
66
- const res = await fetch('https://api.anthropic.com/v1/messages', {
67
- method: 'POST',
68
- headers: {
69
- 'content-type': 'application/json',
70
- 'x-api-key': apiKey,
71
- 'anthropic-version': '2023-06-01',
72
- },
73
- body: JSON.stringify({
74
- model: 'claude-haiku-4-5',
75
- max_tokens: 512,
76
- system,
77
- messages: [{ role: 'user', content: user }],
78
- tools: [
79
- {
80
- name: tool.name,
81
- description: tool.description,
82
- input_schema: tool.input_schema,
83
- },
84
- ],
85
- tool_choice: { type: 'tool', name: tool.name },
86
- }),
87
- });
88
- const json = (await res.json());
89
- if (!res.ok)
90
- throw new Error(`anthropic: ${json.error?.message}`);
91
- const block = json.content?.find((b) => b.type === 'tool_use');
92
- return block?.input;
93
- },
94
- };
95
- }
96
61
  // --- runner ----------------------------------------------------------------
97
62
  async function runPair(pair, llm, embedding) {
98
63
  const registry = {
@@ -219,7 +184,7 @@ async function resolveEmbedding() {
219
184
  return provider;
220
185
  }
221
186
  async function main() {
222
- const llm = anthropicJudge(resolveKey());
187
+ const llm = anthropicProbeJudge(resolveKey());
223
188
  const embedding = await resolveEmbedding();
224
189
  process.stdout.write(`embedding provider: ${embedding.id}\n`);
225
190
  mkdirSync(OUT_DIR, { recursive: true });
@@ -0,0 +1,18 @@
1
+ /**
2
+ * The Anthropic judge both live probes drive (`cache-reuse-probe.ts`,
3
+ * `match-precision/run-probe.ts`) — one implementation instead of the
4
+ * byte-identical copy each used to carry (ggui#1264).
5
+ *
6
+ * Haiku-pinned by default, like the probes' reported numbers. A model
7
+ * that refuses a forced `tool_choice` (`@ggui-ai/protocol`
8
+ * `anthropicRejectsForcedToolChoice` — the always-thinking family) gets
9
+ * `tool_choice: auto` with at most one call, the tool named in the
10
+ * system prompt, and thinking headroom on top of the 512-token answer
11
+ * budget, because its thinking counts against `max_tokens` and comes
12
+ * before the tool call. A turn that ends without the tool call THROWS
13
+ * naming the stop reason; the copies returned `undefined` as the judge's
14
+ * decision, which a probe then scored as a no-match.
15
+ */
16
+ import type { LLMCaller } from "@ggui-ai/negotiator";
17
+ export declare function anthropicProbeJudge(apiKey: string, model?: string): LLMCaller;
18
+ //# sourceMappingURL=probe-anthropic-judge.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"probe-anthropic-judge.d.ts","sourceRoot":"","sources":["../../src/renders/probe-anthropic-judge.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,KAAK,EAAE,SAAS,EAAc,MAAM,qBAAqB,CAAC;AAejE,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,MAAM,EACd,KAAK,GAAE,MAAkC,GACxC,SAAS,CA4DX"}
@@ -0,0 +1,65 @@
1
+ import { anthropicRejectsForcedToolChoice, isRecord } from "@ggui-ai/protocol";
2
+ const ANTHROPIC_MESSAGES_URL = "https://api.anthropic.com/v1/messages";
3
+ const DEFAULT_PROBE_JUDGE_MODEL = "claude-haiku-4-5";
4
+ const PROBE_ANSWER_BUDGET = 512;
5
+ /**
6
+ * Thinking budget added for a model that refuses a forced tool. Same
7
+ * value and reason as the negotiator's production caller in
8
+ * `@ggui-ai/mcp-server`; the three
9
+ * copies are consolidated under ggui#1271.
10
+ */
11
+ const ALWAYS_THINKING_HEADROOM_TOKENS = 16_000;
12
+ export function anthropicProbeJudge(apiKey, model = DEFAULT_PROBE_JUDGE_MODEL) {
13
+ return {
14
+ async call() {
15
+ throw new Error("probe judge: text mode unused — the probes use callStructured");
16
+ },
17
+ async callStructured(system, user, tool) {
18
+ const refusesForcedTool = anthropicRejectsForcedToolChoice(model);
19
+ const res = await fetch(ANTHROPIC_MESSAGES_URL, {
20
+ method: "POST",
21
+ headers: {
22
+ "content-type": "application/json",
23
+ "x-api-key": apiKey,
24
+ "anthropic-version": "2023-06-01",
25
+ },
26
+ body: JSON.stringify({
27
+ model,
28
+ max_tokens: refusesForcedTool
29
+ ? PROBE_ANSWER_BUDGET + ALWAYS_THINKING_HEADROOM_TOKENS
30
+ : PROBE_ANSWER_BUDGET,
31
+ system: refusesForcedTool
32
+ ? `${system}\n\nAnswer by calling the \`${tool.name}\` tool exactly once. Do not answer in text.`
33
+ : system,
34
+ messages: [{ role: "user", content: user }],
35
+ tools: [
36
+ {
37
+ name: tool.name,
38
+ description: tool.description,
39
+ input_schema: tool.input_schema,
40
+ },
41
+ ],
42
+ tool_choice: refusesForcedTool
43
+ ? { type: "auto", disable_parallel_tool_use: true }
44
+ : { type: "tool", name: tool.name },
45
+ }),
46
+ });
47
+ const json = await res.json();
48
+ if (!res.ok) {
49
+ const message = isRecord(json) && isRecord(json["error"]) && typeof json["error"]["message"] === "string"
50
+ ? json["error"]["message"]
51
+ : `HTTP ${res.status}`;
52
+ throw new Error(`anthropic: ${message}`);
53
+ }
54
+ const content = isRecord(json) && Array.isArray(json["content"]) ? json["content"] : [];
55
+ const block = content.find((b) => isRecord(b) && b["type"] === "tool_use" && b["name"] === tool.name);
56
+ if (block === undefined || block["input"] === undefined) {
57
+ const stopReason = isRecord(json) && typeof json["stop_reason"] === "string"
58
+ ? json["stop_reason"]
59
+ : "absent";
60
+ throw new Error(`anthropic: no "${tool.name}" tool_use block in the response (stop_reason=${stopReason})`);
61
+ }
62
+ return block["input"];
63
+ },
64
+ };
65
+ }
@@ -157,22 +157,22 @@ export interface GenerationDeps {
157
157
  */
158
158
  readonly seedPools?: readonly BlueprintPool[];
159
159
  /**
160
- * Per-call LLM resolver for Tier 2 rerank in the blueprint matcher.
161
- * When wired alongside `cache`, render routes through
162
- * `matchBlueprint` and uses the registry-based three-tier flow:
163
- * Tier 1 contract-key exact, Tier 2 RAG + LLM rerank, Tier 3 cold
164
- * gen + register. When absent, the matcher skips Tier 2 and falls
165
- * through to cold gen on cache miss — same registry storage, no
166
- * judge step.
160
+ * NOT READ by the render handler (ggui#1229). Since §6 the render
161
+ * flow does not run the blueprint matcher — it resolves the blueprint
162
+ * by the identity the handshake decided — so passing an LLM resolver
163
+ * here has no effect. The matcher's judge is wired through the
164
+ * handshake negotiator's own deps (`createLlmBackedHandshakeNegotiator`
165
+ * in `@ggui-ai/mcp-server`). The key stays on this published type
166
+ * because removing it is a breaking change for a self-hoster that
167
+ * passes it; it leaves at the next major.
167
168
  */
168
169
  readonly resolveLlmCaller?: (ctx: HandlerContext) => LLMCaller | null | Promise<LLMCaller | null>;
169
170
  /**
170
- * Optional marketplace-install bridge. When wired
171
- * alongside `cache`, the render handler threads it into
172
- * `matchBlueprint` deps so installed blueprints lazily compile
173
- * + populate the same vector store. The bridge is idempotent per
174
- * scope; the first matchBlueprint call pays the compile, every
175
- * subsequent call hits the cache directly.
171
+ * Optional marketplace-install bridge — NOT READ by the render
172
+ * handler (ggui#1229): the matcher that consumes it runs in the
173
+ * handshake path, whose deps (`decide-handshake`, the handshake
174
+ * negotiator) carry it. Passing it here has no effect; the key stays
175
+ * on this published type until the next major, as above.
176
176
  *
177
177
  * Constructed by the CLI / embedder via
178
178
  * `createInstalledBlueprintsProvider(...)` — `mcp-server-handlers`
@@ -282,6 +282,19 @@ export interface GguiSessionPostSuccessArgs {
282
282
  */
283
283
  readonly action: Required<GguiRenderOutput>['action'];
284
284
  /** Whether the render committed real componentCode. */
285
+ /**
286
+ * Which arm of the render settled this bundle — the same word the wire
287
+ * envelope carries (ggui#1227). `'rendered'` is the success assembly:
288
+ * an interface was produced or reused (`codeReady` may still be false
289
+ * for a placeholder, a probe, or a cache hit whose commit was
290
+ * rejected). `'failed'` is the generation-failure arm: no interface
291
+ * was produced, the envelope went out `outcome:'failed'`, and the hook
292
+ * still fires so downstream side-effects observe EVERY settled render.
293
+ * Metering MUST read this, not `codeReady`/`generation`: both arms can
294
+ * carry `generation:null` and `blueprintId:''`, so no other field tells
295
+ * a failed render from a legitimate `codeReady:false` one.
296
+ */
297
+ readonly outcome: 'rendered' | 'failed';
285
298
  readonly codeReady: boolean;
286
299
  /**
287
300
  * True when this render reused an existing blueprint (no LLM call);
@@ -1 +1 @@
1
- {"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../../src/renders/render.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AAGH,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAEL,KAAK,iBAAiB,EAEtB,KAAK,YAAY,EAGjB,KAAK,WAAW,EAQjB,MAAM,mBAAmB,CAAC;AAM3B,OAAO,KAAK,EACV,gBAAgB,EAChB,iBAAiB,EACjB,aAAa,EACb,YAAY,EACZ,oBAAoB,EACpB,cAAc,EACd,WAAW,EACX,mBAAmB,EACnB,gBAAgB,EAChB,cAAc,EAEd,aAAa,EAEb,WAAW,EACZ,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAIL,KAAK,cAAc,EACnB,KAAK,cAAc,EACpB,MAAM,aAAa,CAAC;AAOrB,OAAO,EAIL,KAAK,sBAAsB,EAC5B,MAAM,0BAA0B,CAAC;AAClC,OAAO,KA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AAM,CAAC;IAClB,SAAS,EAAE,OAAO,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,CAAC;AAEJ;;;;;;;GAOG;AACH,KAAK,mBAAmB,GAAG,gBAAgB,GACzC,iBAAiB,GAAG;IAClB,OAAO,EAAE,QAAQ,CAAC;IAClB,KAAK,EAAE,WAAW,CAAC;IAEnB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,KAAK,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAyEJ;;;;;;;;;;;;;;;;;;;GAmBG;AACH;;;;;;;GAOG;AACH,wBAAsB,kBAAkB,CACtC,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,IAAI,CAAC,qBAAqB,EAAE,gBAAgB,CAAC,GAClD,OAAO,CAAC,IAAI,CAAC,CAcf;AAsCD;;;;;;GAMG;AACH,qBAAa,4BAA6B,SAAQ,WAAW,CAAC,2BAA2B,CAAC;gBAC5E,MAAM,EAAE,MAAM;CAG3B;AAuBD,wBAAgB,uBAAuB,CACrC,IAAI,EAAE,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAw0D5B"}
@@ -1480,6 +1480,7 @@ export function createGguiRenderHandler(deps) {
1480
1480
  contractHash: effectiveContractKey,
1481
1481
  intent: story.intent,
1482
1482
  action,
1483
+ outcome: 'failed',
1483
1484
  codeReady: false,
1484
1485
  cacheHit: false,
1485
1486
  generation: null,
@@ -1581,6 +1582,7 @@ export function createGguiRenderHandler(deps) {
1581
1582
  contractHash: effectiveContractKey,
1582
1583
  intent: story.intent,
1583
1584
  action,
1585
+ outcome: 'rendered',
1584
1586
  codeReady: generatedCodeReady,
1585
1587
  // Always defined + accurate: `result.cache` is assigned from
1586
1588
  // `cacheMarker ?? { hit: false, … }`, set on BOTH the
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ggui-ai/mcp-server-handlers",
3
- "version": "0.20.0",
3
+ "version": "0.21.0",
4
4
  "description": "MCP tool handler logic for the ggui protocol. Pure over @ggui-ai/mcp-server-core seams and consumed by @ggui-ai/mcp-server. Never imports AWS, HTTP transports, or CLI concerns.",
5
5
  "keywords": [
6
6
  "ggui",
@@ -70,18 +70,18 @@
70
70
  "dependencies": {
71
71
  "canonicalize": "^2.0.0",
72
72
  "zod": "^4.3.6",
73
- "@ggui-ai/negotiator": "0.20.0",
74
- "@ggui-ai/mcp-server-core": "0.20.0",
75
- "@ggui-ai/ui-gen": "0.20.0",
76
- "@ggui-ai/protocol": "0.20.0",
77
- "@ggui-ai/ui-registry": "0.20.0"
73
+ "@ggui-ai/mcp-server-core": "0.21.0",
74
+ "@ggui-ai/ui-gen": "0.21.0",
75
+ "@ggui-ai/negotiator": "0.21.0",
76
+ "@ggui-ai/ui-registry": "0.21.0",
77
+ "@ggui-ai/protocol": "0.21.0"
78
78
  },
79
79
  "devDependencies": {
80
80
  "@types/node": "^22.0.0",
81
81
  "typescript": "^5.0.0",
82
82
  "vitest": "^3.2.6",
83
- "@ggui-ai/embedding-local": "0.20.0",
84
- "@ggui-ai/protocol-conformance": "0.20.0"
83
+ "@ggui-ai/embedding-local": "0.21.0",
84
+ "@ggui-ai/protocol-conformance": "0.21.0"
85
85
  },
86
86
  "repository": {
87
87
  "type": "git",