@ggui-ai/mcp-server-handlers 0.20.0 → 0.22.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.
- package/dist/blueprints/describe-data-contract-format.d.ts.map +1 -1
- package/dist/blueprints/describe-data-contract-format.js +4 -3
- package/dist/blueprints/search-blueprints.d.ts +6 -2
- package/dist/blueprints/search-blueprints.d.ts.map +1 -1
- package/dist/blueprints/search-blueprints.js +6 -2
- package/dist/ops-apps/set-app-theme.d.ts +10 -3
- package/dist/ops-apps/set-app-theme.d.ts.map +1 -1
- package/dist/ops-apps/set-app-theme.js +17 -7
- package/dist/ops-blueprint/generate.d.ts.map +1 -1
- package/dist/ops-blueprint/generate.js +6 -0
- package/dist/ops-blueprint/register.d.ts.map +1 -1
- package/dist/ops-blueprint/register.js +4 -0
- package/dist/renders/blueprint-matcher.d.ts +35 -17
- package/dist/renders/blueprint-matcher.d.ts.map +1 -1
- package/dist/renders/blueprint-matcher.js +49 -12
- package/dist/renders/blueprint-registry.d.ts +34 -0
- package/dist/renders/blueprint-registry.d.ts.map +1 -1
- package/dist/renders/blueprint-registry.js +7 -0
- package/dist/renders/build-seed-pool.d.ts.map +1 -1
- package/dist/renders/build-seed-pool.js +18 -7
- package/dist/renders/cache-trace-sink.d.ts +22 -0
- package/dist/renders/cache-trace-sink.d.ts.map +1 -1
- package/dist/renders/cache-trace-sink.js +92 -1
- package/dist/renders/index.d.ts +2 -2
- package/dist/renders/index.d.ts.map +1 -1
- package/dist/renders/index.js +1 -1
- package/dist/renders/install-to-cache.d.ts +26 -1
- package/dist/renders/install-to-cache.d.ts.map +1 -1
- package/dist/renders/install-to-cache.js +21 -0
- package/dist/renders/installed-blueprints-provider.d.ts +9 -3
- package/dist/renders/installed-blueprints-provider.d.ts.map +1 -1
- package/dist/renders/installed-blueprints-provider.js +1 -0
- package/dist/renders/match-precision/run-probe.js +2 -37
- package/dist/renders/probe-anthropic-judge.d.ts +18 -0
- package/dist/renders/probe-anthropic-judge.d.ts.map +1 -0
- package/dist/renders/probe-anthropic-judge.js +65 -0
- package/dist/renders/render.d.ts +26 -13
- package/dist/renders/render.d.ts.map +1 -1
- package/dist/renders/render.js +2 -0
- package/dist/renders/slice-meta-derivation.d.ts +9 -2
- package/dist/renders/slice-meta-derivation.d.ts.map +1 -1
- package/dist/renders/slice-meta-derivation.js +4 -0
- package/package.json +8 -8
|
@@ -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;
|
|
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.
|
|
63
|
-
|
|
64
|
-
|
|
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
|
|
|
@@ -53,8 +53,12 @@
|
|
|
53
53
|
import { z } from 'zod';
|
|
54
54
|
import type { BlueprintProvider, EmbeddingProvider, VectorStore } from '@ggui-ai/mcp-server-core';
|
|
55
55
|
/**
|
|
56
|
-
*
|
|
57
|
-
*
|
|
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`.
|
|
58
62
|
*/
|
|
59
63
|
export declare const MIN_SIMILARITY_SCORE = 0.3;
|
|
60
64
|
/**
|
|
@@ -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
|
|
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"}
|
|
@@ -54,8 +54,12 @@ import { z } from 'zod';
|
|
|
54
54
|
import { bundleHostScheme, DEFAULT_BUNDLE_HOST, flatToBlueprintSource, gguiSearchBlueprintsOutputSchema, searchBlueprintsInputShape, } from '@ggui-ai/protocol';
|
|
55
55
|
import { defineHandler } from '../types.js';
|
|
56
56
|
/**
|
|
57
|
-
*
|
|
58
|
-
*
|
|
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`.
|
|
59
63
|
*/
|
|
60
64
|
export const MIN_SIMILARITY_SCORE = 0.3;
|
|
61
65
|
/**
|
|
@@ -134,6 +134,11 @@ export interface SetAppThemeDeps {
|
|
|
134
134
|
export type AppThemeAdmission = {
|
|
135
135
|
readonly ok: true;
|
|
136
136
|
readonly theme: AppTheme;
|
|
137
|
+
/** ggui#1286 — keys outside the manifest, admitted (never refused, never dropped) and named by the caller. */
|
|
138
|
+
readonly unknown: {
|
|
139
|
+
readonly light: readonly string[];
|
|
140
|
+
readonly dark: readonly string[];
|
|
141
|
+
};
|
|
137
142
|
} | {
|
|
138
143
|
readonly ok: false;
|
|
139
144
|
readonly refusal: AppThemeRefusalBody;
|
|
@@ -143,9 +148,11 @@ export type AppThemeAdmission = {
|
|
|
143
148
|
};
|
|
144
149
|
/**
|
|
145
150
|
* Admit a raw theme body: shape, attestation, coverage — in that order,
|
|
146
|
-
* first failure wins
|
|
147
|
-
*
|
|
148
|
-
*
|
|
151
|
+
* first failure wins. Exported so any other in-process door runs exactly
|
|
152
|
+
* these checks. Keys outside the manifest (`unknown`) are ADMITTED and
|
|
153
|
+
* returned, never refused (ggui#1286): a door on release N cannot tell a
|
|
154
|
+
* name a newer projector emits from a bug, and refusing breaks N−1 (new →
|
|
155
|
+
* old); the caller persists the theme verbatim and names them.
|
|
149
156
|
*/
|
|
150
157
|
export declare function admitAppTheme(raw: unknown, overlayCoverage: OverlayCoverageValidator): Promise<AppThemeAdmission>;
|
|
151
158
|
export declare function createSetAppThemeHandler(deps: SetAppThemeDeps): import("../types.js").SharedHandler<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"set-app-theme.d.ts","sourceRoot":"","sources":["../../src/ops-apps/set-app-theme.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,OAAO,EAIL,KAAK,QAAQ,EACb,KAAK,mBAAmB,EAEzB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAIL,KAAK,mBAAmB,EACzB,MAAM,aAAa,CAAC;AAGrB,OAAO,KAAK,EAAE,UAAU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AC;AAY/D;;;;;;;GAOG;AACH,wBAAsB,aAAa,CACjC,GAAG,EAAE,OAAO,EACZ,eAAe,EAAE,wBAAwB,GACxC,OAAO,CAAC,iBAAiB,CAAC,CAmB5B;AAqBD,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAzF5D,mEAAmE;;IAEnE,sGAAsG;;;;;;;;;;;;;;;;;;IAEtG,yFAAyF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAmI1F"}
|
|
@@ -64,9 +64,11 @@ function isV1Shape(raw) {
|
|
|
64
64
|
}
|
|
65
65
|
/**
|
|
66
66
|
* Admit a raw theme body: shape, attestation, coverage — in that order,
|
|
67
|
-
* first failure wins
|
|
68
|
-
*
|
|
69
|
-
*
|
|
67
|
+
* first failure wins. Exported so any other in-process door runs exactly
|
|
68
|
+
* these checks. Keys outside the manifest (`unknown`) are ADMITTED and
|
|
69
|
+
* returned, never refused (ggui#1286): a door on release N cannot tell a
|
|
70
|
+
* name a newer projector emits from a bug, and refusing breaks N−1 (new →
|
|
71
|
+
* old); the caller persists the theme verbatim and names them.
|
|
70
72
|
*/
|
|
71
73
|
export async function admitAppTheme(raw, overlayCoverage) {
|
|
72
74
|
if (isV1Shape(raw))
|
|
@@ -85,13 +87,10 @@ export async function admitAppTheme(raw, overlayCoverage) {
|
|
|
85
87
|
return { ok: false, refusal: { overlayHash: 'mismatch' } };
|
|
86
88
|
const light = overlayCoverage(theme.overlays.light);
|
|
87
89
|
const dark = overlayCoverage(theme.overlays.dark);
|
|
88
|
-
if (light.unknown.length > 0 || dark.unknown.length > 0) {
|
|
89
|
-
return { ok: false, refusal: { unknown: { light: [...light.unknown], dark: [...dark.unknown] } } };
|
|
90
|
-
}
|
|
91
90
|
if (light.uncovered.length > 0 || dark.uncovered.length > 0) {
|
|
92
91
|
return { ok: false, refusal: { uncovered: { light: [...light.uncovered], dark: [...dark.uncovered] } } };
|
|
93
92
|
}
|
|
94
|
-
return { ok: true, theme };
|
|
93
|
+
return { ok: true, theme, unknown: { light: [...light.unknown], dark: [...dark.unknown] } };
|
|
95
94
|
}
|
|
96
95
|
function refusalText(admission) {
|
|
97
96
|
if ('issues' in admission)
|
|
@@ -109,6 +108,8 @@ function refusalText(admission) {
|
|
|
109
108
|
// than a verdict (founder's ruling, 2026-09-16).
|
|
110
109
|
return `invalid_app_config: ${appThemeWouldDropRefusalText(r.wouldDrop)}`;
|
|
111
110
|
}
|
|
111
|
+
// Unreachable from this door since ggui#1286 (unknown keys are admitted); kept while the
|
|
112
|
+
// protocol refusal union carries the arm — doors already serving still emit it (N−1).
|
|
112
113
|
if ('unknown' in r)
|
|
113
114
|
return `invalid_app_config: keys outside the consumed-token manifest — light: [${r.unknown.light.join(', ')}] dark: [${r.unknown.dark.join(', ')}]`;
|
|
114
115
|
return `invalid_app_config: consumed tokens left uncovered — light: [${r.uncovered.light.join(', ')}] dark: [${r.uncovered.dark.join(', ')}]`;
|
|
@@ -138,6 +139,15 @@ export function createSetAppThemeHandler(deps) {
|
|
|
138
139
|
return handlerFailure(data, refusalText(admission));
|
|
139
140
|
}
|
|
140
141
|
const written = await deps.apps.setTheme({ appId, ownerSub, theme: admission.theme });
|
|
142
|
+
if (admission.unknown.light.length > 0 || admission.unknown.dark.length > 0) {
|
|
143
|
+
// ggui#1286 — persisted verbatim, NAMED once (the N−1 watch).
|
|
144
|
+
// eslint-disable-next-line no-console -- operator-visible structured event; handlers carry no logger
|
|
145
|
+
console.info('[ggui] app_theme_unknown_overlay_names', {
|
|
146
|
+
appId,
|
|
147
|
+
light: [...admission.unknown.light],
|
|
148
|
+
dark: [...admission.unknown.dark],
|
|
149
|
+
});
|
|
150
|
+
}
|
|
141
151
|
return {
|
|
142
152
|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;;;GAsSnC"}
|
|
@@ -305,6 +305,12 @@ export function createGguiOpsGenerateBlueprintHandler(deps) {
|
|
|
305
305
|
kind: "template",
|
|
306
306
|
contract,
|
|
307
307
|
intent: intentForCache,
|
|
308
|
+
// ggui#1275 — an explicit intent or a seed prompt states the
|
|
309
|
+
// UI's task; a persona or the placeholder is a stand-in the
|
|
310
|
+
// matcher's judge never sees.
|
|
311
|
+
intentSource: parsed.intent !== undefined || parsed.seedPrompt !== undefined
|
|
312
|
+
? "authored"
|
|
313
|
+
: "fallback",
|
|
308
314
|
componentCode,
|
|
309
315
|
// The cache row MUST carry the same variance as the MVB
|
|
310
316
|
// row: `registerBlueprint` keys the exact-lookup on
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"register.d.ts","sourceRoot":"","sources":["../../src/ops-blueprint/register.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AAEH,OAAO,KAAK,EACV,gBAAgB,EAChB,cAAc,EACd,aAAa,EACd,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAEL,KAAK,SAAS,EACd,KAAK,YAAY,EAGjB,KAAK,mBAAmB,EACzB,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAqB,KAAK,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAEpF,OAAO,EAAyB,KAAK,yBAAyB,EAAE,MAAM,iBAAiB,CAAC;AACxF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAiBjD;;;;;GAKG;AACH,MAAM,WAAW,4BAA4B;IAC3C;;;OAGG;IACH,QAAQ,CAAC,cAAc,EAAE,cAAc,CAAC;IACxC;;;OAGG;IACH,QAAQ,CAAC,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,SAAS,SAAS,EAAE,CAAC,CAAC;IAC1E;;;;;;;OA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EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,SAAS,SAAS,EAAE,CAAC,CAAC;IAC1E;;;;;;;OAOG;IACH,QAAQ,CAAC,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;IAC7C;;;;;;OAMG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,WAAW,CAAC;IAC/B;;;;;;;;OAQG;IACH,QAAQ,CAAC,aAAa,CAAC,EAAE,qBAAqB,CAAC;IAC/C;;;;OAIG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,aAAa,CAAC;IACnC;;OAEG;IACH,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,MAAM,CAAC;IAC5B;;OAEG;IACH,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,MAAM,CAAC;IACxC;;;;;;;OAOG;IACH,QAAQ,CAAC,kBAAkB,CAAC,EAAE,yBAAyB,CAAC;CACzD;AAED,wBAAgB,qCAAqC,CACnD,IAAI,EAAE,4BAA4B;;;;;;;;;;;;;;;;;;;GAsMnC"}
|
|
@@ -175,6 +175,10 @@ export function createGguiOpsRegisterBlueprintHandler(deps) {
|
|
|
175
175
|
kind: "template",
|
|
176
176
|
contract,
|
|
177
177
|
intent: intentForCache,
|
|
178
|
+
// ggui#1275 — only a seed prompt states the UI's task. A
|
|
179
|
+
// persona describes the agent and the placeholder describes
|
|
180
|
+
// nothing: both are stand-ins the matcher's judge never sees.
|
|
181
|
+
intentSource: parsed.seedPrompt !== undefined ? "authored" : "fallback",
|
|
178
182
|
componentCode,
|
|
179
183
|
// Same user-arm provenance as the MVB row above — one
|
|
180
184
|
// handler call, one provenance claim across both stores.
|
|
@@ -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,
|
|
8
|
-
* call
|
|
9
|
-
*
|
|
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
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
* LLM
|
|
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
|
|
25
|
-
* `
|
|
26
|
-
*
|
|
27
|
-
*
|
|
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
|
-
/**
|
|
116
|
-
|
|
117
|
-
|
|
127
|
+
/**
|
|
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.
|
|
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
|
|
1
|
+
{"version":3,"file":"blueprint-matcher.d.ts","sourceRoot":"","sources":["../../src/renders/blueprint-matcher.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;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AQ,CAAC,QAAQ,EAAE,qBAAqB,CAAC;IACzC;;;;;;OAMG;IACH,QAAQ,CAAC,GAAG,CAAC,EAAE,SAAS,CAAC;IACzB;;;;;;;;;;;;OAYG;IACH,QAAQ,CAAC,mBAAmB,CAAC,EAAE,2BAA2B,CAAC;CAC5D;AAED,MAAM,WAAW,qBAAqB;IACpC,kEAAkE;IAClE,QAAQ,CAAC,IAAI,CAAC,EAAE,aAAa,CAAC;IAC9B,sEAAsE;IACtE,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB;;;;;;;;OAQG;IACH,QAAQ,CAAC,kBAAkB,CAAC,EAAE,MAAM,CAAC;IACrC,yFAAyF;IACzF,+EAA+E;IAC/E,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC;IACjC;;;;;;;;OAQG;IACH,QAAQ,CAAC,eAAe,CAAC,EAAE,OAAO,CAAC;CACpC;AAsBD;;;;;;;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,CAuW/B"}
|
|
@@ -4,6 +4,7 @@ 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';
|
|
7
8
|
/** An all-empty coverage gap — used for exact-key hits (canonical-key
|
|
8
9
|
* equality already implies full coverage) and for contract-less requests
|
|
9
10
|
* (nothing to cover against). */
|
|
@@ -15,15 +16,23 @@ const EMPTY_GAP = {
|
|
|
15
16
|
gadgets: [],
|
|
16
17
|
};
|
|
17
18
|
const DEFAULT_TOP_K = 20;
|
|
18
|
-
//
|
|
19
|
-
//
|
|
20
|
-
//
|
|
21
|
-
//
|
|
22
|
-
//
|
|
23
|
-
//
|
|
24
|
-
//
|
|
25
|
-
// rather than a
|
|
26
|
-
|
|
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;
|
|
29
|
+
// Loosened for Path-A: accept a semantic judge's pick more readily, so a
|
|
30
|
+
// paraphrased / similar contract is reused instead of cold-generating.
|
|
31
|
+
// Over-proposal is bounded by the agent decision step plus the COVERAGE_GAP
|
|
32
|
+
// findings on a non-covering hit (the cache proposes; the agent disposes).
|
|
33
|
+
// Not re-tuned by ggui#1275: separating right from wrong picks by
|
|
34
|
+
// confidence is a measurement for the match-precision probe, not a number
|
|
35
|
+
// to fit to eight samples.
|
|
27
36
|
const DEFAULT_JUDGE_THRESHOLD = 0.5;
|
|
28
37
|
/**
|
|
29
38
|
* Walk the matcher and return the decision.
|
|
@@ -228,11 +237,39 @@ export async function matchBlueprint(deps, scope, query, options = {}) {
|
|
|
228
237
|
});
|
|
229
238
|
return { strategy: 'no-match', reason, candidates };
|
|
230
239
|
}
|
|
240
|
+
// ggui#1275 — who the judge may see. (1) The floor is per candidate: top-1
|
|
241
|
+
// clearing it used to hand ALL top-K to the judge, which could pick any of
|
|
242
|
+
// them (observed: a reuse at cosine 0.19 under the then-0.2 floor because
|
|
243
|
+
// top-1 was 0.27). (2) A row whose intent is a stand-in
|
|
244
|
+
// (`intentSource: 'fallback'` — a placeholder, an id, a title, a persona)
|
|
245
|
+
// is never offered: semantic reuse is intent similarity, and with no
|
|
246
|
+
// intent the judge compares contract summaries and guesses (observed: both
|
|
247
|
+
// wrong reuses of the 2026-09 read picked one placeholder-intent row).
|
|
248
|
+
// Such a row stays reachable by exact key above. The trace still carries
|
|
249
|
+
// the full top-K.
|
|
250
|
+
const aboveFloor = candidates.filter((c) => c.cosine >= minCosine);
|
|
251
|
+
const eligible = aboveFloor.filter((c) => c.blueprint.intentSource !== 'fallback');
|
|
252
|
+
const floorNote = eligible.length < candidates.length
|
|
253
|
+
? ` (${eligible.length} of ${candidates.length} candidates at or above minCosine=${minCosine} with an authored intent)`
|
|
254
|
+
: '';
|
|
255
|
+
if (eligible.length === 0) {
|
|
256
|
+
// Top-1 cleared the floor, but every candidate that did carries a
|
|
257
|
+
// stand-in intent — nothing the judge could honestly compare.
|
|
258
|
+
const reason = 'no-match: no saved interface close enough has a stated intent — a new one will be generated';
|
|
259
|
+
const traceReason = `no-match: ${aboveFloor.length} candidates at or above minCosine=${minCosine}, none with an authored intent; judge skipped`;
|
|
260
|
+
emit({
|
|
261
|
+
decision: 'no-match',
|
|
262
|
+
strategy: 'semantic',
|
|
263
|
+
reason: traceReason,
|
|
264
|
+
candidates,
|
|
265
|
+
});
|
|
266
|
+
return { strategy: 'no-match', reason, candidates };
|
|
267
|
+
}
|
|
231
268
|
// Run the LLM rerank judge.
|
|
232
269
|
const decision = await rerankCandidates({ llm: deps.llm }, {
|
|
233
270
|
intent: trimmedIntent,
|
|
234
271
|
contractSummary: summarizeContract(query.contract),
|
|
235
|
-
},
|
|
272
|
+
}, eligible.map((c) => ({
|
|
236
273
|
id: c.blueprint.id,
|
|
237
274
|
cachedIntent: c.blueprint.intent,
|
|
238
275
|
cachedContractSummary: summarizeContract(c.blueprint.contract),
|
|
@@ -243,7 +280,7 @@ export async function matchBlueprint(deps, scope, query, options = {}) {
|
|
|
243
280
|
? 'no-match: judge declined all candidates — a new interface will be generated'
|
|
244
281
|
: 'no-match-low-confidence: the closest saved interface is not a confident match — a new one will be generated';
|
|
245
282
|
const traceReason = decision.matchId === null
|
|
246
|
-
? `no-match: judge declined all ${
|
|
283
|
+
? `no-match: judge declined all ${eligible.length} candidates (confidence=${decision.confidence.toFixed(2)})${floorNote}`
|
|
247
284
|
: `no-match-low-confidence: judge picked ${decision.matchId} but confidence=${decision.confidence.toFixed(2)} < threshold=${judgeThreshold}`;
|
|
248
285
|
emit({
|
|
249
286
|
decision: decision.matchId === null ? 'no-match' : 'no-match-low-confidence',
|
|
@@ -260,7 +297,7 @@ export async function matchBlueprint(deps, scope, query, options = {}) {
|
|
|
260
297
|
judgeReason: decision.reason,
|
|
261
298
|
};
|
|
262
299
|
}
|
|
263
|
-
const matched =
|
|
300
|
+
const matched = eligible.find((c) => c.blueprint.id === decision.matchId);
|
|
264
301
|
if (!matched) {
|
|
265
302
|
// Defensive — rerankCandidates already guards against unknown ids
|
|
266
303
|
// by collapsing to null, but a future change could re-introduce
|
|
@@ -39,6 +39,15 @@ export interface Blueprint {
|
|
|
39
39
|
readonly contract: DataContract;
|
|
40
40
|
/** Original intent prose that produced the blueprint. Diagnostic + RAG. */
|
|
41
41
|
readonly intent: string;
|
|
42
|
+
/**
|
|
43
|
+
* `'fallback'` when {@link intent} is a stand-in — a placeholder, an
|
|
44
|
+
* id, a title or a persona, written because the writer had no
|
|
45
|
+
* statement of the UI's task. Absent means authored. The semantic
|
|
46
|
+
* judge never sees a fallback row (it would compare contract summaries
|
|
47
|
+
* and guess); exact-key reuse still reaches it. See
|
|
48
|
+
* {@link BlueprintIntentSource}.
|
|
49
|
+
*/
|
|
50
|
+
readonly intentSource?: 'fallback';
|
|
42
51
|
/** Generated component source. Empty string when generation hasn't happened yet. */
|
|
43
52
|
readonly componentCode: string;
|
|
44
53
|
/**
|
|
@@ -145,11 +154,36 @@ export interface BlueprintRegistryDeps {
|
|
|
145
154
|
*/
|
|
146
155
|
readonly durability?: BlueprintDurabilityDeps;
|
|
147
156
|
}
|
|
157
|
+
/**
|
|
158
|
+
* Where a registry row's intent came from (ggui#1275).
|
|
159
|
+
*
|
|
160
|
+
* - `'authored'` — a statement of the UI's TASK: a render request's
|
|
161
|
+
* intent, a generation `seedPrompt`, a manifest's `intent` or
|
|
162
|
+
* `description`.
|
|
163
|
+
* - `'fallback'` — a stand-in, stored because registration refuses an
|
|
164
|
+
* empty intent: an operator placeholder, a bare id, a manifest `name`
|
|
165
|
+
* (a title names a thing; it does not describe a task), or a `persona`
|
|
166
|
+
* (it describes the agent, not the UI).
|
|
167
|
+
*
|
|
168
|
+
* Semantic reuse is intent similarity, so a fallback row never reaches
|
|
169
|
+
* the matcher's judge; it stays reachable by exact key. Only
|
|
170
|
+
* `'fallback'` is stored (`intentSource` in row metadata); an authored
|
|
171
|
+
* row writes nothing, so it is byte-identical to a row written before
|
|
172
|
+
* the field existed, and absence reads as authored.
|
|
173
|
+
*/
|
|
174
|
+
export type BlueprintIntentSource = 'authored' | 'fallback';
|
|
148
175
|
/** Input for {@link registerBlueprint}. */
|
|
149
176
|
export interface RegisterBlueprintInput {
|
|
150
177
|
readonly kind: BlueprintKind;
|
|
151
178
|
readonly contract: DataContract;
|
|
152
179
|
readonly intent: string;
|
|
180
|
+
/**
|
|
181
|
+
* Where {@link intent} came from. Default `'authored'`. A writer that
|
|
182
|
+
* substitutes a stand-in because it has no statement of the UI's task
|
|
183
|
+
* MUST pass `'fallback'` — see {@link BlueprintIntentSource} for which
|
|
184
|
+
* sources are which.
|
|
185
|
+
*/
|
|
186
|
+
readonly intentSource?: BlueprintIntentSource;
|
|
153
187
|
readonly componentCode: string;
|
|
154
188
|
/**
|
|
155
189
|
* Authored (pre-compile) source body, when the generator distinguishes
|
|
@@ -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,CAAC;IAC7B,uEAAuE;IACvE,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B;;;;;;OAMG;IACH,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B;;;;OAIG;IACH,QAAQ,CAAC,QAAQ,EAAE,iBAAiB,CAAC;IACrC,QAAQ,CAAC,QAAQ,EAAE,YAAY,CAAC;IAChC,2EAA2E;IAC3E,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,oFAAoF;IACpF,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B;;;;;;;;;;OAUG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6 +116,7 @@ const METADATA_KEYS = {
|
|
|
116
116
|
lastHitAt: 'lastHitAt',
|
|
117
117
|
installed: 'installed',
|
|
118
118
|
sourceCodeHash: 'sourceCodeHash',
|
|
119
|
+
intentSource: 'intentSource',
|
|
119
120
|
};
|
|
120
121
|
function blueprintToMetadata(bp) {
|
|
121
122
|
return {
|
|
@@ -131,6 +132,9 @@ function blueprintToMetadata(bp) {
|
|
|
131
132
|
// Flat-provenance scalars — key names owned by the protocol codec.
|
|
132
133
|
...blueprintSourceToFlat(bp.source),
|
|
133
134
|
...(bp.installed === true ? { [METADATA_KEYS.installed]: true } : {}),
|
|
135
|
+
...(bp.intentSource === 'fallback'
|
|
136
|
+
? { [METADATA_KEYS.intentSource]: 'fallback' }
|
|
137
|
+
: {}),
|
|
134
138
|
...(bp.lastHitAt !== undefined
|
|
135
139
|
? { [METADATA_KEYS.lastHitAt]: bp.lastHitAt }
|
|
136
140
|
: {}),
|
|
@@ -226,6 +230,7 @@ function rowToBlueprint(key, metadata) {
|
|
|
226
230
|
const hitCount = readScalarNumber(metadata[METADATA_KEYS.hitCount]) ?? 0;
|
|
227
231
|
const lastHitAt = readScalarString(metadata[METADATA_KEYS.lastHitAt]);
|
|
228
232
|
const installed = metadata[METADATA_KEYS.installed] === true;
|
|
233
|
+
const intentIsFallback = metadata[METADATA_KEYS.intentSource] === 'fallback';
|
|
229
234
|
const variance = readVariance(metadata[METADATA_KEYS.variance]);
|
|
230
235
|
// `variantKey` is identity-bearing — `blueprintToMetadata` always
|
|
231
236
|
// writes it, so a blueprint-shaped row without one is a legacy row
|
|
@@ -254,6 +259,7 @@ function rowToBlueprint(key, metadata) {
|
|
|
254
259
|
hitCount,
|
|
255
260
|
source,
|
|
256
261
|
...(installed ? { installed: true } : {}),
|
|
262
|
+
...(intentIsFallback ? { intentSource: 'fallback' } : {}),
|
|
257
263
|
...(lastHitAt !== undefined ? { lastHitAt } : {}),
|
|
258
264
|
...(sourceCodeHash !== undefined ? { sourceCodeHash } : {}),
|
|
259
265
|
};
|
|
@@ -368,6 +374,7 @@ export async function registerBlueprint(deps, scope, input, options = {}) {
|
|
|
368
374
|
hitCount: 0,
|
|
369
375
|
source: input.source,
|
|
370
376
|
...(input.installed === true ? { installed: true } : {}),
|
|
377
|
+
...(input.intentSource === 'fallback' ? { intentSource: 'fallback' } : {}),
|
|
371
378
|
...(warnFindings.length > 0
|
|
372
379
|
? { validationWarnings: warnFindings }
|
|
373
380
|
: {}),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-seed-pool.d.ts","sourceRoot":"","sources":["../../src/renders/build-seed-pool.ts"],"names":[],"mappings":"AAYA,OAAO,EAAyB,KAAK,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAC7E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAwB5D,MAAM,WAAW,oBAAoB;IACnC,gEAAgE;IAChE,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB;;;;;;;OAOG;IACH,QAAQ,CAAC,GAAG,CAAC,EAAE,aAAa,CAAC;CAC9B;AAED;;;;;;;;GAQG;AACH,wBAAsB,aAAa,CACjC,MAAM,EAAE,cAAc,EACtB,OAAO,EAAE,oBAAoB,GAC5B,OAAO,CAAC,aAAa,CAAC,
|
|
1
|
+
{"version":3,"file":"build-seed-pool.d.ts","sourceRoot":"","sources":["../../src/renders/build-seed-pool.ts"],"names":[],"mappings":"AAYA,OAAO,EAAyB,KAAK,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAC7E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAwB5D,MAAM,WAAW,oBAAoB;IACnC,gEAAgE;IAChE,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB;;;;;;;OAOG;IACH,QAAQ,CAAC,GAAG,CAAC,EAAE,aAAa,CAAC;CAC9B;AAED;;;;;;;;GAQG;AACH,wBAAsB,aAAa,CACjC,MAAM,EAAE,cAAc,EACtB,OAAO,EAAE,oBAAoB,GAC5B,OAAO,CAAC,aAAa,CAAC,CAuExB"}
|
|
@@ -75,13 +75,8 @@ export async function buildSeedPool(source, options) {
|
|
|
75
75
|
await registerBlueprint(registry, scope, {
|
|
76
76
|
kind: 'template',
|
|
77
77
|
contract: record.contract,
|
|
78
|
-
//
|
|
79
|
-
|
|
80
|
-
// registerBlueprint's "intent cannot be empty" guard, aborting the
|
|
81
|
-
// whole build on one bad record.
|
|
82
|
-
intent: [record.variance.seedPrompt, record.variance.persona]
|
|
83
|
-
.map((s) => s?.trim())
|
|
84
|
-
.find((s) => Boolean(s)) ?? 'shared blueprint',
|
|
78
|
+
// intent + intentSource — see seedPoolIntent below.
|
|
79
|
+
...seedPoolIntent(record.variance),
|
|
85
80
|
componentCode: record.componentCode,
|
|
86
81
|
// Provenance travels WITH the artifact (PortableBlueprint v2
|
|
87
82
|
// requires it) — an llm-minted record stays llm-sourced in
|
|
@@ -98,3 +93,19 @@ export async function buildSeedPool(source, options) {
|
|
|
98
93
|
label: source.label,
|
|
99
94
|
};
|
|
100
95
|
}
|
|
96
|
+
/**
|
|
97
|
+
* The intent a seed-pool record registers under, and where it came from
|
|
98
|
+
* (ggui#1275). Coalesces on the first NON-EMPTY hint — `??` is
|
|
99
|
+
* nullish-only, so an empty `seedPrompt`/`persona` would yield an empty
|
|
100
|
+
* intent and trip registerBlueprint's "intent cannot be empty" guard,
|
|
101
|
+
* aborting the whole build on one bad record. Only a seed prompt states
|
|
102
|
+
* the UI's task; a persona (it describes the agent) or the pool's default
|
|
103
|
+
* label is a stand-in, which the matcher's judge never sees.
|
|
104
|
+
*/
|
|
105
|
+
function seedPoolIntent(variance) {
|
|
106
|
+
const seedPrompt = variance.seedPrompt?.trim();
|
|
107
|
+
if (seedPrompt)
|
|
108
|
+
return { intent: seedPrompt, intentSource: 'authored' };
|
|
109
|
+
const persona = variance.persona?.trim();
|
|
110
|
+
return { intent: persona ? persona : 'shared blueprint', intentSource: 'fallback' };
|
|
111
|
+
}
|
|
@@ -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,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB;;;;OAIG;IACH,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB;;;;;;OAMG;IACH,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,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