@ggui-ai/ui-gen 0.25.0 → 0.26.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/README.md +2 -2
- package/dist/{adapter-Cg_rkpGq.d.ts → adapter-BJwn74rx.d.ts} +49 -1
- package/dist/adapters/generation-dispatch.d.ts +8 -5
- package/dist/adapters/generation-dispatch.js +1118 -193
- package/dist/adapters/generation-dispatch.js.map +1 -1
- package/dist/adapters/index.js +27 -6
- package/dist/adapters/index.js.map +1 -1
- package/dist/advanced/index.d.ts +10 -9
- package/dist/advanced/index.js +1126 -202
- package/dist/advanced/index.js.map +1 -1
- package/dist/blueprint-validator.js +416 -92
- package/dist/blueprint-validator.js.map +1 -1
- package/dist/boilerplate.d.ts +2 -2
- package/dist/boilerplate.js +10 -3
- package/dist/boilerplate.js.map +1 -1
- package/dist/check/index.d.ts +3 -2
- package/dist/check/index.js +9 -2
- package/dist/check/index.js.map +1 -1
- package/dist/{create-ui-generator-DFnnArrv.d.ts → create-ui-generator-N4gRXpcL.d.ts} +3 -4
- package/dist/{design-mode-DLufhrNp.d.ts → design-mode-DGWN_Gkm.d.ts} +1 -1
- package/dist/{dispatch-CStl9eAw.d.ts → dispatch-BUoXRj_r.d.ts} +2 -2
- package/dist/evaluation/axis-checks/index.d.ts +5 -4
- package/dist/evaluation/axis-checks/index.js.map +1 -1
- package/dist/evaluation/axis-checks/registry.d.ts +4 -3
- package/dist/evaluation/index.d.ts +107 -539
- package/dist/evaluation/index.js +552 -55
- package/dist/evaluation/index.js.map +1 -1
- package/dist/evaluation/types.d.ts +17 -0
- package/dist/evaluation/types.js.map +1 -1
- package/dist/{generate-9IeNT4ZY.d.ts → generate-tSO_shQ0.d.ts} +1 -1
- package/dist/harness/check/runtime-render/index.d.ts +5 -5
- package/dist/harness/check/runtime-render/index.js +416 -92
- package/dist/harness/check/runtime-render/index.js.map +1 -1
- package/dist/harness/check/runtime-render/render-check-worker.js +393 -88
- package/dist/harness/check/runtime-render/render-check-worker.js.map +1 -1
- package/dist/harness/index.d.ts +4 -5
- package/dist/harness/index.js +36 -5
- package/dist/harness/index.js.map +1 -1
- package/dist/harness/prompts.d.ts +2 -2
- package/dist/harness/prompts.js +10 -1
- package/dist/harness/prompts.js.map +1 -1
- package/dist/harness/result-types.d.ts +17 -3
- package/dist/harness/result-types.js.map +1 -1
- package/dist/harness/runtime.d.ts +14 -6
- package/dist/harness/runtime.js +11 -4
- package/dist/harness/runtime.js.map +1 -1
- package/dist/harness/types-public.d.ts +4 -2
- package/dist/harness/types-public.js +10 -3
- package/dist/harness/types-public.js.map +1 -1
- package/dist/harness/validator-trace-sink.d.ts +4 -3
- package/dist/index.d.ts +46 -11
- package/dist/index.js +1128 -200
- package/dist/index.js.map +1 -1
- package/dist/patch.d.ts +3 -3
- package/dist/{prompts-YU9piOgs.d.ts → prompts-BhNUuRoZ.d.ts} +1 -1
- package/dist/tools/render-check-worker.js +8 -1
- package/dist/tools/render-check-worker.js.map +1 -1
- package/dist/{types-public-BJTLpzWn.d.ts → types-public-B7wn4ce5.d.ts} +384 -3
- package/dist/validation/index.d.ts +1 -1
- package/dist/validation/index.js +1 -1
- package/dist/validation/index.js.map +1 -1
- package/dist/visual-evaluator-C9L-o6ap.d.ts +639 -0
- package/dist/workflows.d.ts +3 -3
- package/package.json +12 -12
- package/src/adapters/generation-dispatch.ts +2 -0
- package/src/boilerplate/free-design-prompt.ts +3 -3
- package/src/boilerplate/hard-sections.ts +1 -1
- package/src/boilerplate/templates/layouts/chat-mobile.tsx.tmpl +3 -1
- package/src/boilerplate/templates/layouts/chat-universal.tsx.tmpl +3 -1
- package/src/boilerplate/templates/layouts/fullscreen-desktop.tsx.tmpl +3 -1
- package/src/boilerplate/templates/layouts/fullscreen-universal.tsx.tmpl +3 -1
- package/src/check/run-tier0.ts +6 -3
- package/src/contract-context.ts +1 -1
- package/src/evaluation/cost-tracker.ts +54 -6
- package/src/evaluation/criteria/edge-probe.ts +286 -0
- package/src/evaluation/criteria/edge.ts +202 -0
- package/src/evaluation/criteria/resolve.ts +55 -7
- package/src/evaluation/index.ts +5 -1
- package/src/evaluation/judge-spend.ts +48 -0
- package/src/evaluation/types-public.ts +91 -0
- package/src/evaluation/types.ts +10 -0
- package/src/evaluation/visual-evaluator.ts +236 -40
- package/src/harness/check/runtime-render/adapter.ts +18 -0
- package/src/harness/check/runtime-render/probe-pending.ts +111 -0
- package/src/harness/check/runtime-render/render-check-host.ts +10 -6
- package/src/harness/check/runtime-render/render-check-worker.ts +6 -3
- package/src/harness/check/runtime-render/render-check.ts +417 -133
- package/src/harness/check/runtime-render/walk.ts +200 -0
- package/src/harness/coding/assemble-result.ts +2 -0
- package/src/harness/coding/generate-task-runner.ts +27 -0
- package/src/harness/coding/init-session.ts +5 -3
- package/src/harness/coding/run-coding-turn.ts +5 -1
- package/src/harness/coding/run-eval-round.ts +63 -3
- package/src/harness/in-loop-evaluation.ts +39 -0
- package/src/harness/llm-router.ts +58 -1
- package/src/harness/result-types.ts +9 -0
- package/src/harness/runtime.ts +9 -0
- package/src/harness/types-public.ts +10 -1
- package/src/index.ts +5 -0
- package/src/internal/verdict-line.ts +33 -0
- package/src/taught-tokens.ts +32 -0
- package/src/tools/render-check-worker.ts +2 -1
- package/src/tools/render-check.ts +8 -7
- package/src/validation/primitives.ts +1 -1
- package/dist/llm-router-nfO7wPec.d.ts +0 -267
- package/dist/{bank-CT4eEkta.d.ts → bank-Ctdp3FUA.d.ts} +3 -3
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { A as AxisCheck, a as AxisCheckInput,
|
|
1
|
+
import { r as CriteriaSelection, h as CriteriaContext, C as CriteriaAnswerCounts, s as VisionFinishReason, k as CriteriaBlock } from '../types-public-B7wn4ce5.js';
|
|
2
|
+
export { A as AxisCheck, a as AxisCheckInput, t as CRITERIA, n as CanvasHostPresentation, j as CanvasJudgeRecord, l as CanvasPresentationOutcome, u as CanvasVisualSummary, v as ContractFeedbackRecord, w as CriterionCoverage, x as CriterionRunStatus, D as DEFAULT_QUALITY_CONFIG, y as EvalCategory, z as EvalCriterion, E as EvalIssue, B as EvalOutcome, e as EvalResult, q as EvalTier, H as HostInlineFrame, F as HostPresentationIgnoredReason, G as LLM_EVAL_STATIC_CRITERIA, I as Priority, Q as QualityConfig, K as QualityMode, o as VisualEvalSummary, M as buildCodingCriteriaSummary, N as criteriaFor, O as getActionableIssues, S as getCriteriaByPriority, T as getCriterionById, U as getLLMCriteria, W as isBlocked, m as matches, X as notApplicableCoverage, Y as priorityForIssue } from '../types-public-B7wn4ce5.js';
|
|
3
3
|
import * as _anthropic_ai_claude_agent_sdk from '@anthropic-ai/claude-agent-sdk';
|
|
4
4
|
import { McpServerConfig } from '@anthropic-ai/claude-agent-sdk';
|
|
5
5
|
import { EvaluationContext, EvaluationConfig, QualityMetadata, EvaluationResult, EvaluationIssue, CriteriaAnswer } from './types.js';
|
|
6
6
|
export { DEFAULT_EVAL_MAX_ROUNDS, DimensionScores, MAX_EVAL_ROUNDS_HARD_LIMIT } from './types.js';
|
|
7
|
-
export { R as RunAxisChecksInput, r as runAxisChecks } from '../dispatch-
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
import {
|
|
13
|
-
|
|
14
|
-
import
|
|
15
|
-
import { C as CanvasClass, g as CanvasViewport } from '../design-mode-DLufhrNp.js';
|
|
16
|
-
export { a as CANVAS_BREAKPOINTS, b as CANVAS_CLASSES, c as CANVAS_DESCRIPTORS, d as CANVAS_VIEWPORTS, e as CanvasDescriptor, f as CanvasDisplayMode, j as canvasDisplayModeForShell, k as canvasForRendering, l as canvasForViewportWidth, m as describeCanvas } from '../design-mode-DLufhrNp.js';
|
|
7
|
+
export { R as RunAxisChecksInput, r as runAxisChecks } from '../dispatch-BUoXRj_r.js';
|
|
8
|
+
import { E as EdgeVerdict, a as EdgeBlock, C as CriteriaCallTokens } from '../visual-evaluator-C9L-o6ap.js';
|
|
9
|
+
export { b as CARD_HEIGHT_EXPRESSION, c as CONTENT_HEIGHT_EXPRESSION, d as CanvasFitPolicy, e as CanvasVisualResult, f as CaptureMode, g as ChromiumProvider, h as CriteriaContextInput, i as CriteriaContextSources, j as EDGE_TOLERANCE_PX, k as EdgeOffset, H as HOST_COLOUR_PATTERN, l as HOST_FRAME_BOUNDS, J as JUDGE_GROUND_MARGIN_PX, m as JUDGE_INK_INSET_PX, n as JudgeDesignIdentity, N as NaturalCaptureOptions, S as ScreenshotAttempt, o as ScreenshotBrowser, p as ScreenshotClip, q as ScreenshotDeps, r as ScreenshotLauncher, s as ScreenshotPage, t as StoredCaptureInput, u as StoredCaptureOutcome, v as StoredCaptureVerdict, w as VISUAL_EVAL_PROMPT, x as VISUAL_JUDGE_MAX_OUTPUT_TOKENS, y as VISUAL_JUDGE_PROMPT_DIGEST, z as VISUAL_JUDGE_PROMPT_VERSION, A as VisualEvalConfig, B as VisualEvalContext, D as VisualEvalDeps, F as VisualEvalDetailed, G as VisualEvalOutcome, I as VisualEvaluationResult, V as VisualLegTokens, K as callMultimodalLLM, L as canvasBlankIssue, M as canvasFitPolicy, O as canvasOverflowIssue, P as captureScreenshot, Q as captureScreenshotDetailed, R as chromaOfCssTokens, T as criteriaContextFor, U as designTreeSha256, W as judgeDesignIdentity, X as judgeEdges, Y as judgeStoredCapture, Z as resetJudgeDesignIdentityCache, _ as resolveDesignPackageDir, $ as resolveLaunchOptions, a0 as runVisualEval, a1 as runVisualEvaluation, a2 as runVisualEvaluationDetailed, a3 as summarizeVisualResult } from '../visual-evaluator-C9L-o6ap.js';
|
|
10
|
+
export { b as CANVAS_BREAKPOINTS, c as CANVAS_CLASSES, d as CANVAS_DESCRIPTORS, e as CANVAS_VIEWPORTS, C as CanvasClass, f as CanvasDescriptor, g as CanvasDisplayMode, a as CanvasViewport, j as canvasDisplayModeForShell, k as canvasForRendering, l as canvasForViewportWidth, m as describeCanvas } from '../design-mode-DGWN_Gkm.js';
|
|
11
|
+
import { AppTheme } from '@ggui-ai/protocol';
|
|
12
|
+
import { C as CriteriaBank } from '../bank-Ctdp3FUA.js';
|
|
13
|
+
export { B as BankRow, a as CriteriaScope, b as bankRows, c as criteriaBankSchema, p as parseCriteriaBank } from '../bank-Ctdp3FUA.js';
|
|
14
|
+
import '../llm.js';
|
|
17
15
|
import '@ggui-ai/mcp-server-core';
|
|
16
|
+
import '../axes-CKVCzR_x.js';
|
|
18
17
|
import '../types-Dh1s4K9j.js';
|
|
19
|
-
import '../
|
|
18
|
+
import '../styling-profile-CxfvV48g.js';
|
|
19
|
+
import 'puppeteer-core';
|
|
20
20
|
import 'zod';
|
|
21
21
|
|
|
22
22
|
/**
|
|
@@ -189,531 +189,6 @@ declare function extractCompiledCode(messages: SdkMessage[]): string | undefined
|
|
|
189
189
|
*/
|
|
190
190
|
declare function extractSourceCode(messages: SdkMessage[]): string | undefined;
|
|
191
191
|
|
|
192
|
-
/**
|
|
193
|
-
* The selector's inputs for one card — ggui#1436. Every key here is hashed into `criteriaSetId`
|
|
194
|
-
* and STORED in the block (the CTO's A1), so a stored verdict reproduces its own set from the
|
|
195
|
-
* record alone. `canvas` is added per canvas inside the judge; the rest is the harness's.
|
|
196
|
-
*/
|
|
197
|
-
|
|
198
|
-
/** Read the theme's chroma off its tokens; `unknown` when no primary is named. */
|
|
199
|
-
declare function chromaOfCssTokens(cssTokens: string | undefined): CriteriaChroma;
|
|
200
|
-
interface CriteriaContextSources {
|
|
201
|
-
readonly classification: Classification;
|
|
202
|
-
readonly contract: DataContract | undefined;
|
|
203
|
-
readonly cssTokens: string | undefined;
|
|
204
|
-
readonly profile: GenerationProfileInput | undefined;
|
|
205
|
-
readonly shell: string;
|
|
206
|
-
readonly kind?: string;
|
|
207
|
-
}
|
|
208
|
-
/** The context minus `canvas` — the judge fills that per canvas. */
|
|
209
|
-
type CriteriaContextInput = Omit<CriteriaContext, 'canvas'>;
|
|
210
|
-
declare function criteriaContextFor(src: CriteriaContextSources): CriteriaContextInput;
|
|
211
|
-
|
|
212
|
-
interface JudgeDesignIdentity {
|
|
213
|
-
/** Absolute path of the design `src` tree the judge bundled against. */
|
|
214
|
-
readonly src: string;
|
|
215
|
-
/** sha256 over every rendering input under `src` (see {@link isDesignRenderingInput}) — sorted relative path, then contents. */
|
|
216
|
-
readonly srcSha256: string;
|
|
217
|
-
}
|
|
218
|
-
/**
|
|
219
|
-
* sha256 over every rendering input under `root` (sorted relative path +
|
|
220
|
-
* contents) — the identity of a design tree as it paints.
|
|
221
|
-
*
|
|
222
|
-
* A function of the TREE, not of the spelling of `root`: the relative keys
|
|
223
|
-
* are taken against the RESOLVED root, so `…/design/src`, `…/design/src/` and
|
|
224
|
-
* `…/ui-gen/../design/src` hash the same bytes. Before this the key was
|
|
225
|
-
* sliced by the unresolved root's length while each entry had already been
|
|
226
|
-
* resolved, so an un-normalised root produced a different hash for the same
|
|
227
|
-
* tree — a phantom design skew for any caller composing the path.
|
|
228
|
-
*/
|
|
229
|
-
declare function designTreeSha256(root: string): string;
|
|
230
|
-
/**
|
|
231
|
-
* The identity of the tree at `src`, computed once per process per path (a
|
|
232
|
-
* judge run paints hundreds of frames from one tree).
|
|
233
|
-
*
|
|
234
|
-
* `null` when the tree cannot be READ (ggui#1110): a deployed image ships the
|
|
235
|
-
* design package as built output with no `src/`, and an identity is a receipt
|
|
236
|
-
* about a judgement — never a precondition for making one. Before this,
|
|
237
|
-
* `scandir` threw ENOENT inside the evaluation round wherever the package ships
|
|
238
|
-
* built output only, the round returned no evaluation at all, and a bar refused
|
|
239
|
-
* a card that had cleared it. A row without the receipt says so; a round that cannot
|
|
240
|
-
* stamp one still runs.
|
|
241
|
-
*/
|
|
242
|
-
declare function judgeDesignIdentity(src: string): JudgeDesignIdentity | null;
|
|
243
|
-
/** Test seam: forget cached identities (a test that rewrites a tree between runs). */
|
|
244
|
-
declare function resetJudgeDesignIdentityCache(): void;
|
|
245
|
-
|
|
246
|
-
interface VisualEvalConfig {
|
|
247
|
-
/** LLM provider for multimodal evaluation */
|
|
248
|
-
provider: 'claude' | 'google';
|
|
249
|
-
/** Model ID (must support vision/multimodal) */
|
|
250
|
-
model?: string;
|
|
251
|
-
/** Pass threshold for visual score (0-100) */
|
|
252
|
-
passThreshold: number;
|
|
253
|
-
/** Sample props to render the component with */
|
|
254
|
-
sampleProps?: Record<string, unknown>;
|
|
255
|
-
/** Viewport dimensions for screenshot */
|
|
256
|
-
viewport?: {
|
|
257
|
-
width: number;
|
|
258
|
-
height: number;
|
|
259
|
-
};
|
|
260
|
-
/**
|
|
261
|
-
* Per-canvas judging — ARM-NEUTRAL (the same judge, prompt and
|
|
262
|
-
* threshold in every design mode). When set, the SAME rendered HTML
|
|
263
|
-
* shell is screenshotted once per class at `CANVAS_VIEWPORTS[class]`
|
|
264
|
-
* and judged once per class; the result carries one entry per class
|
|
265
|
-
* in `canvases`, and the single-shot fields aggregate: `finalScore` =
|
|
266
|
-
* mean of the canvas scores (rounded), `passed` = every canvas passed,
|
|
267
|
-
* `dimensions` = per-dimension means, `issues` = every canvas's issues
|
|
268
|
-
* (description prefixed `[<canvas>]`). Unset (or empty) = today's
|
|
269
|
-
* single screenshot at `viewport`; no `canvases` field on the result.
|
|
270
|
-
*/
|
|
271
|
-
canvases?: readonly CanvasClass[];
|
|
272
|
-
/**
|
|
273
|
-
* ggui#1195 — the box a canvas is COMPOSED for and CAPTURED at when the
|
|
274
|
-
* order declared one (the chat card at the visitor's real column, not the
|
|
275
|
-
* class's 400×640). Keyed by canvas; a canvas without an entry is judged
|
|
276
|
-
* at `CANVAS_VIEWPORTS[canvas]` as before. The composer's
|
|
277
|
-
* `rendering.viewport` and this entry are ONE value written once (the
|
|
278
|
-
* seam derives it), so the judge never scores a box the mint did not
|
|
279
|
-
* target. Only read in per-canvas mode. Captured at WHOLE CSS px: the
|
|
280
|
-
* browser's device-metrics override takes integers (measured — a 383.5 px
|
|
281
|
-
* width is refused by CDP), so a fractional declared box is rounded once
|
|
282
|
-
* where it enters and the capture, the ceiling and the reported
|
|
283
|
-
* `viewport` all carry that same integer box.
|
|
284
|
-
*/
|
|
285
|
-
canvasViewports?: Partial<Readonly<Record<CanvasClass, CanvasViewport>>>;
|
|
286
|
-
/**
|
|
287
|
-
* ggui#1492 — how a host presents each canvas, as data the caller supplies (a lane that knows its host). Keyed by
|
|
288
|
-
* canvas; a canvas without an entry is judged exactly as before (the generic stand-in round the inline card, the
|
|
289
|
-
* scrim under a panel). The box stays in {@link canvasViewports}. An entry this judge cannot use (a colour that is
|
|
290
|
-
* not `#rrggbb`, a number out of range, a frame on a canvas that is not the inline card) is ignored for its canvas,
|
|
291
|
-
* said once in the log, never partly applied.
|
|
292
|
-
*/
|
|
293
|
-
hostPresentations?: Partial<Readonly<Record<CanvasClass, CanvasHostPresentation>>>;
|
|
294
|
-
/**
|
|
295
|
-
* Optional provider-routing override — see
|
|
296
|
-
* `AgentConfig.routeOverride`. Threaded onto the agent this
|
|
297
|
-
* evaluator constructs so its multimodal call never falls back to
|
|
298
|
-
* `process.env` for credentials or model routing.
|
|
299
|
-
*/
|
|
300
|
-
/**
|
|
301
|
-
* Vision calls per judged canvas on the SAME captured frame, aggregated by
|
|
302
|
-
* the median (ggui#1072). Default 1 — a single judgement, byte-identical to
|
|
303
|
-
* the instrument before this option existed. K is an instrument dial: a
|
|
304
|
-
* run mixes K at its own peril.
|
|
305
|
-
*/
|
|
306
|
-
judgeK?: number;
|
|
307
|
-
/** The canvases sampled `judgeK` times; default = every judged canvas when `judgeK > 1`. */
|
|
308
|
-
judgeKCanvases?: readonly CanvasClass[];
|
|
309
|
-
/**
|
|
310
|
-
* The design `src` tree the judge bundles the component against
|
|
311
|
-
* (ggui#1042): an explicit input, so a judge-only re-judge names the tree
|
|
312
|
-
* it painted with. Default: the design package beside this one.
|
|
313
|
-
*/
|
|
314
|
-
designSrcDir?: string;
|
|
315
|
-
/** The mode the caller composed `cssTokens` in — a receipt on the row, never a switch (ggui#1076: judge and runtime must name the same mode). */
|
|
316
|
-
themeMode?: 'light' | 'dark';
|
|
317
|
-
routeOverride?: AgentConfig['routeOverride'];
|
|
318
|
-
/**
|
|
319
|
-
* Provider-429-retry observer — see `AgentConfig.onRetry`.
|
|
320
|
-
* Without it, a rate-limited retry inside the evaluation call
|
|
321
|
-
* happens (the agent's retry loop is unconditional) but never
|
|
322
|
-
* reaches the caller's structured log.
|
|
323
|
-
*/
|
|
324
|
-
onRetry?: AgentConfig['onRetry'];
|
|
325
|
-
}
|
|
326
|
-
/**
|
|
327
|
-
* ggui#1436 — what the report-only criteria call spent. Kept APART from the scoring calls' `inputTokens` /
|
|
328
|
-
* `outputTokens`: those price the judgement a caller may meter, and the criteria call is a measurement beside it.
|
|
329
|
-
*/
|
|
330
|
-
interface CriteriaCallTokens {
|
|
331
|
-
readonly inputTokens: number;
|
|
332
|
-
readonly outputTokens: number;
|
|
333
|
-
}
|
|
334
|
-
/** One canvas's verdict — screenshot + judge score at that class's viewport. */
|
|
335
|
-
interface CanvasVisualResult {
|
|
336
|
-
canvas: CanvasClass;
|
|
337
|
-
viewport: CanvasViewport;
|
|
338
|
-
/** The judge's weighted score for this canvas (0-100). */
|
|
339
|
-
score: number;
|
|
340
|
-
/** `score >= passThreshold`. */
|
|
341
|
-
passed: boolean;
|
|
342
|
-
/** The PNG the judge saw — kept for artefact persistence + the human look. */
|
|
343
|
-
screenshotPng: Buffer;
|
|
344
|
-
/**
|
|
345
|
-
* The document's scroll height at this canvas's viewport, CSS px — what
|
|
346
|
-
* the box would have to be for nothing to be hidden (ggui#1027). `null`
|
|
347
|
-
* when the page could not be measured.
|
|
348
|
-
*/
|
|
349
|
-
contentHeight: number | null;
|
|
350
|
-
/** `contentHeight > viewport.height` — a measurement; what it MEANS is {@link canvasFitPolicy}'s. */
|
|
351
|
-
overflow: boolean;
|
|
352
|
-
/** How `score` was reached — always present (ggui#1072). */
|
|
353
|
-
/**
|
|
354
|
-
* ggui#1120 — how far down the capture anything was painted (the last inked row over the measured
|
|
355
|
-
* region's height, read against the capture's dominant colour, inside a drawn panel's chrome); `0`
|
|
356
|
-
* is the blank the judge fails, `null` an unreadable capture.
|
|
357
|
-
*/
|
|
358
|
-
inkRatio: number | null;
|
|
359
|
-
judge: CanvasJudgeRecord;
|
|
360
|
-
/** How the judge composed the mount (ggui#1100): `'fill'` on every fullscreen canvas, absent on the inline card. */
|
|
361
|
-
fit?: 'fill';
|
|
362
|
-
/** ggui#1195 — `true` when the order DECLARED this canvas's box (`config.canvasViewports` carried an entry), whatever its value. */
|
|
363
|
-
declared?: true;
|
|
364
|
-
/** ggui#1436 — the typed criteria block, when a bank was configured. */
|
|
365
|
-
criteria?: CriteriaBlock;
|
|
366
|
-
/** ggui#1436 — the criteria call's own spend, when one was asked and answered; never inside the canvas's scoring tokens. */
|
|
367
|
-
criteriaTokens?: CriteriaCallTokens;
|
|
368
|
-
/** ggui#1492 — what the judge did with this canvas's host presentation (drawn, or ignored and why), when one was supplied. */
|
|
369
|
-
presentation?: CanvasPresentationOutcome;
|
|
370
|
-
}
|
|
371
|
-
/** How a canvas is captured for the judge and what an overflow means there (ggui#1027). */
|
|
372
|
-
type CaptureMode = 'viewport' | 'full-page' | 'natural';
|
|
373
|
-
interface CanvasFitPolicy {
|
|
374
|
-
/**
|
|
375
|
-
* `viewport` = the whole box; `full-page` = the whole scrolled document; `natural` (ggui#1475) = the
|
|
376
|
-
* card at its OWN height, clipped to its extent and capped at the box — the inline card a host sizes
|
|
377
|
-
* to its content, on the host's ground ({@link JUDGE_GROUND_MARGIN_PX}).
|
|
378
|
-
*/
|
|
379
|
-
readonly capture: CaptureMode;
|
|
380
|
-
/** The verdict an overflow earns on this canvas. */
|
|
381
|
-
readonly overflow: 'fail' | 'warn' | 'none';
|
|
382
|
-
}
|
|
383
|
-
/**
|
|
384
|
-
* The inline chat card takes its NATURAL height under a ceiling (ggui#1475):
|
|
385
|
-
* an MCP Apps host sizes the inline frame to the card's content
|
|
386
|
-
* (`ui/notifications/size-changed`, auto-resize) up to its maximum, so the
|
|
387
|
-
* visitor sees the card and nothing under it. The judge captures exactly
|
|
388
|
-
* that — the card's own extent on the host's ground, capped at the box — and
|
|
389
|
-
* never the box's remainder (a fixed 640 px capture scored every hello
|
|
390
|
-
* against a void no visitor sees). The box stays the ceiling: content taller
|
|
391
|
-
* than it is a critical layout issue that fails the canvas (a 1289 px hello
|
|
392
|
-
* on a 640 px card was scored 86 from a full-page capture that showed the
|
|
393
|
-
* judge what no user sees). A phone's first screen may scroll, so the
|
|
394
|
-
* overflow is reported as a major issue and the score stands. Pages
|
|
395
|
-
* (`md`/`lg`/`xl`) scroll by design: measured, never judged.
|
|
396
|
-
*/
|
|
397
|
-
declare function canvasFitPolicy(canvas: CanvasClass): CanvasFitPolicy;
|
|
398
|
-
/**
|
|
399
|
-
* How far in from a panelled page's edges the ink is read (ggui#1120): past the panel's gap, its
|
|
400
|
-
* largest rounded corner (the `round` bucket, 24 px — the scrim shows through the corner) and its
|
|
401
|
-
* 1 px hairline, so the host's chrome never counts as paint. The card's own inset is 16 px, so the
|
|
402
|
-
* band skipped inside the card is 25 px of a canvas — reported ratios are over the region.
|
|
403
|
-
*/
|
|
404
|
-
declare const JUDGE_INK_INSET_PX: number;
|
|
405
|
-
/**
|
|
406
|
-
* The host ground round a naturally-captured inline card (ggui#1475): the card is mounted this far in
|
|
407
|
-
* from the page's edges and captured with this margin, so its edge and radius are read against the
|
|
408
|
-
* host surface — the page's scrim ground, never the card's own. The design's one gap (the panel's).
|
|
409
|
-
*/
|
|
410
|
-
declare const JUDGE_GROUND_MARGIN_PX: 16;
|
|
411
|
-
/**
|
|
412
|
-
* The bounds a host frame must meet to be drawn (ggui#1492), exported so a lane's reader applies exactly the frames
|
|
413
|
-
* this judge draws: an entry the reader accepts and the judge ignores would be echoed as applied while never drawn.
|
|
414
|
-
*/
|
|
415
|
-
declare const HOST_COLOUR_PATTERN: RegExp;
|
|
416
|
-
declare const HOST_FRAME_BOUNDS: {
|
|
417
|
-
readonly ringWidthPx: {
|
|
418
|
-
readonly min: 0;
|
|
419
|
-
readonly max: 8;
|
|
420
|
-
};
|
|
421
|
-
readonly ringAlpha: {
|
|
422
|
-
readonly min: 0;
|
|
423
|
-
readonly max: 1;
|
|
424
|
-
};
|
|
425
|
-
readonly radiusPx: {
|
|
426
|
-
readonly min: 0;
|
|
427
|
-
readonly max: 64;
|
|
428
|
-
};
|
|
429
|
-
readonly minHeightPx: {
|
|
430
|
-
readonly min: 0;
|
|
431
|
-
readonly max: 2560;
|
|
432
|
-
};
|
|
433
|
-
};
|
|
434
|
-
/** The deterministic fit issue — one per overflowing canvas, in the judge's issue shape so it rides the same channel. */
|
|
435
|
-
declare function canvasOverflowIssue(canvas: CanvasClass, viewport: CanvasViewport, contentHeight: number, verdict: 'fail' | 'warn'): EvaluationIssue;
|
|
436
|
-
/** ggui#1120 — the deterministic blank: the capture is one flat colour, so the component mounted and painted nothing. */
|
|
437
|
-
declare function canvasBlankIssue(canvas: CanvasClass, viewport: CanvasViewport): EvaluationIssue;
|
|
438
|
-
/**
|
|
439
|
-
* `runVisualEvaluation`'s result. Identical to `EvaluationResult` when
|
|
440
|
-
* `config.canvases` is unset; with canvases set, `canvases` holds the
|
|
441
|
-
* per-class verdicts and the base fields aggregate them (see
|
|
442
|
-
* `VisualEvalConfig.canvases`).
|
|
443
|
-
*/
|
|
444
|
-
interface VisualEvaluationResult extends EvaluationResult {
|
|
445
|
-
canvases?: CanvasVisualResult[];
|
|
446
|
-
/**
|
|
447
|
-
* ggui#1436 — the criteria calls' spend across canvases, when any was asked and answered. `inputTokens` /
|
|
448
|
-
* `outputTokens` stay the SCORING calls' alone, so a cost read off them never includes the report-only block.
|
|
449
|
-
*/
|
|
450
|
-
criteriaTokens?: CriteriaCallTokens;
|
|
451
|
-
/** The design tree the judge painted with (ggui#1042) — present on every per-canvas judgement. */
|
|
452
|
-
design?: JudgeDesignIdentity;
|
|
453
|
-
/** The mode `cssTokens` were composed in, when the caller said (ggui#1076). */
|
|
454
|
-
themeMode?: 'light' | 'dark';
|
|
455
|
-
}
|
|
456
|
-
/** Injection points for `runVisualEvaluation` — screenshot deps plus the judge call (tests). */
|
|
457
|
-
interface VisualEvalDeps extends ScreenshotDeps {
|
|
458
|
-
/** The multimodal judge call (default: `callMultimodalLLM`). */
|
|
459
|
-
judge?: typeof callMultimodalLLM;
|
|
460
|
-
}
|
|
461
|
-
interface VisualEvalContext {
|
|
462
|
-
/** Compiled JavaScript code (ESM with imports) */
|
|
463
|
-
compiledCode: string;
|
|
464
|
-
/** Original user prompt */
|
|
465
|
-
originalPrompt: string;
|
|
466
|
-
/** Design system CSS tokens */
|
|
467
|
-
cssTokens?: string;
|
|
468
|
-
/** The app's generation profile (#991) — judged relative to, never against. */
|
|
469
|
-
profile?: GenerationProfileInput;
|
|
470
|
-
/** ggui#1436 — a criteria bank and the card's context; the judge selects per canvas and answers report-only. */
|
|
471
|
-
criteria?: {
|
|
472
|
-
readonly bank: CriteriaBank;
|
|
473
|
-
readonly context: CriteriaContextInput;
|
|
474
|
-
};
|
|
475
|
-
}
|
|
476
|
-
/**
|
|
477
|
-
* The `@ggui-ai/design` package root — resolved by MODULE ID, never by counting
|
|
478
|
-
* directories (ggui#1110).
|
|
479
|
-
*
|
|
480
|
-
* The arithmetic this replaced (`…/'..','..','..','design'`) was correct only
|
|
481
|
-
* for the layout it was written against — `node_modules/@ggui-ai/ui-gen/dist/
|
|
482
|
-
* evaluation` → `node_modules/@ggui-ai/` + `design`. Under a deploy-flattened
|
|
483
|
-
* layout it landed one level too high, at `node_modules/design`, a path that is
|
|
484
|
-
* not the design package at all: the judge then walked a directory that does not
|
|
485
|
-
* exist, threw ENOENT inside every evaluation round on that deployment, and a
|
|
486
|
-
* bar refused cards no one could judge. `@ggui-ai/design` exports `./package.json`,
|
|
487
|
-
* so the module resolver answers correctly in every layout — scoped, flattened,
|
|
488
|
-
* hoisted — and the receipt keeps working inside the image.
|
|
489
|
-
*/
|
|
490
|
-
declare function resolveDesignPackageDir(): string;
|
|
491
|
-
/** A screenshot's region in page px (puppeteer's `clip`). */
|
|
492
|
-
interface ScreenshotClip {
|
|
493
|
-
readonly x: number;
|
|
494
|
-
readonly y: number;
|
|
495
|
-
readonly width: number;
|
|
496
|
-
readonly height: number;
|
|
497
|
-
}
|
|
498
|
-
/** The page surface the capture uses — a structural subset of puppeteer's `Page`. */
|
|
499
|
-
interface ScreenshotPage {
|
|
500
|
-
setContent(html: string, options: {
|
|
501
|
-
waitUntil: 'load';
|
|
502
|
-
timeout: number;
|
|
503
|
-
}): Promise<void>;
|
|
504
|
-
waitForNetworkIdle(options: {
|
|
505
|
-
idleTime: number;
|
|
506
|
-
timeout: number;
|
|
507
|
-
}): Promise<void>;
|
|
508
|
-
waitForSelector(selector: string, options: {
|
|
509
|
-
timeout: number;
|
|
510
|
-
}): Promise<unknown>;
|
|
511
|
-
/** Evaluates a JS expression in the page and returns its serialised value — the fit measurement (ggui#1027). */
|
|
512
|
-
evaluate(expression: string): Promise<unknown>;
|
|
513
|
-
screenshot(options: {
|
|
514
|
-
type: 'png';
|
|
515
|
-
fullPage: boolean;
|
|
516
|
-
clip?: ScreenshotClip;
|
|
517
|
-
}): Promise<Uint8Array>;
|
|
518
|
-
}
|
|
519
|
-
/** The browser surface the capture uses — a structural subset of puppeteer's `Browser`. */
|
|
520
|
-
interface ScreenshotBrowser {
|
|
521
|
-
newPage(): Promise<ScreenshotPage>;
|
|
522
|
-
close(): Promise<void>;
|
|
523
|
-
}
|
|
524
|
-
type ScreenshotLauncher = (options: LaunchOptions) => Promise<ScreenshotBrowser>;
|
|
525
|
-
/** The two members of `@sparticuz/chromium` the fallback launch path reads. */
|
|
526
|
-
interface ChromiumProvider {
|
|
527
|
-
readonly args: string[];
|
|
528
|
-
executablePath(): Promise<string>;
|
|
529
|
-
}
|
|
530
|
-
/**
|
|
531
|
-
* Injection points for the capture — every default is the production
|
|
532
|
-
* path; tests replace them to pin branch selection without launching a
|
|
533
|
-
* browser.
|
|
534
|
-
*/
|
|
535
|
-
interface ScreenshotDeps {
|
|
536
|
-
/** Launches the browser (default: `puppeteer-core`'s `launch`). */
|
|
537
|
-
launch?: ScreenshotLauncher;
|
|
538
|
-
/** Environment the executable-path override is read from (default: `process.env`). */
|
|
539
|
-
env?: NodeJS.ProcessEnv;
|
|
540
|
-
/** Loads `@sparticuz/chromium` (default: dynamic import) — only consulted when no override is set. */
|
|
541
|
-
loadChromium?: () => Promise<ChromiumProvider>;
|
|
542
|
-
/** Post-load settle time before the screenshot, ms (default 1000). */
|
|
543
|
-
settleMs?: number;
|
|
544
|
-
}
|
|
545
|
-
/**
|
|
546
|
-
* Pick the browser binary. `PUPPETEER_EXECUTABLE_PATH` (a system
|
|
547
|
-
* Chromium — the bench runner image, a dev box) wins and skips the
|
|
548
|
-
* `@sparticuz/chromium` load entirely; otherwise the bundled Lambda
|
|
549
|
-
* Chromium supplies both binary and flags, as before.
|
|
550
|
-
*/
|
|
551
|
-
declare function resolveLaunchOptions(viewport: {
|
|
552
|
-
width: number;
|
|
553
|
-
height: number;
|
|
554
|
-
}, deps?: Pick<ScreenshotDeps, 'env' | 'loadChromium'>): Promise<LaunchOptions>;
|
|
555
|
-
/**
|
|
556
|
-
* Take a screenshot of the rendered component.
|
|
557
|
-
* Returns the PNG bytes, or null if no browser could be launched.
|
|
558
|
-
*/
|
|
559
|
-
/** Screenshot plus the reason when none could be taken — the judge's `unavailableReason`. */
|
|
560
|
-
interface ScreenshotAttempt {
|
|
561
|
-
readonly png: Buffer | null;
|
|
562
|
-
readonly reason?: string;
|
|
563
|
-
/** The document's scroll height at the viewport (ggui#1027); `null` when unmeasurable. */
|
|
564
|
-
readonly contentHeight: number | null;
|
|
565
|
-
/** ggui#1475 — a natural capture's horizontal overflow: how many px the card's content runs past its width; absent on every other capture. */
|
|
566
|
-
readonly overflowX?: number | null;
|
|
567
|
-
}
|
|
568
|
-
/** The expression the fit measurement evaluates in the page — the taller of the two scroll heights. */
|
|
569
|
-
declare const CONTENT_HEIGHT_EXPRESSION = "Math.max(document.documentElement.scrollHeight, document.body ? document.body.scrollHeight : 0)";
|
|
570
|
-
/** The stand-in page's card height ({@link cardHeightExpression} at the stand-in's pad). */
|
|
571
|
-
declare const CARD_HEIGHT_EXPRESSION: string;
|
|
572
|
-
/** ggui#1492 — a natural capture's geometry: the page's pad per side, and the host's floor when it has one. */
|
|
573
|
-
interface NaturalCaptureOptions {
|
|
574
|
-
readonly padPx: number;
|
|
575
|
-
readonly floorPx?: number;
|
|
576
|
-
}
|
|
577
|
-
declare function captureScreenshotDetailed(html: string, viewport?: {
|
|
578
|
-
width: number;
|
|
579
|
-
height: number;
|
|
580
|
-
}, deps?: ScreenshotDeps, capture?: CaptureMode, natural?: NaturalCaptureOptions): Promise<ScreenshotAttempt>;
|
|
581
|
-
declare function captureScreenshot(html: string, viewport?: {
|
|
582
|
-
width: number;
|
|
583
|
-
height: number;
|
|
584
|
-
}, deps?: ScreenshotDeps): Promise<Buffer | null>;
|
|
585
|
-
declare const VISUAL_EVAL_PROMPT = "You are a visual quality evaluator for ggui \u2014 a platform where AI agents generate React UI components on demand.\n\n## Context\nThe screenshot shows a generated React component built from a design system with CSS variable theming. The component was created by an LLM to fulfill a user's request. Your job is to evaluate whether the generated UI achieves the user's goal AND looks professionally designed.\n\n## Scoring Dimensions (0-100 each)\n\n1. **completeness** (25%): Does the screenshot show ALL features the user requested? Are all sections, controls, data fields, and interactive elements present? Missing features or sections = major deduction. Compare against the original request carefully.\n\n2. **layout** (25%): Is the layout well-composed? Clear sections and grouping? No overlapping elements? Proper spacing between elements? Responsive-looking? Does it look like a professional app UI, not a homework project?\n\n3. **hierarchy** (25%): Clear visual hierarchy? Headings are visually distinct from body text? Primary actions (buttons) are prominent? Information grouped logically with clear section breaks? Color and size used to guide the eye?\n\n4. **aesthetics** (25%): Professional, polished appearance? Consistent color palette? Good use of whitespace \u2014 not too sparse, not too cluttered? Cards, shadows, and borders used effectively? Does it look like something a designer would approve? Would you be comfortable showing this to a client?\n\n## Scoring Guide\n- 90-100: Production-ready. Would ship to real users. Polished layout, clear hierarchy, professional aesthetics.\n- 80-89: Good quality. Minor improvements needed (slightly tight spacing, one section could be better grouped).\n- 70-79: Acceptable but generic. Works correctly but lacks design polish or visual refinement.\n- 60-69: Below standard. Noticeable problems \u2014 cramped layout, poor hierarchy, or missing sections.\n- Below 60: Broken or fundamentally incomplete. Error messages visible, blank areas, or critical features missing.\n\n## Important\n- Check the screenshot against the \"Original Request\" \u2014 does it actually deliver what was asked for?\n- Error messages like \"Render error\" or blank white space = rendering score 0\n- A component that renders but is just a wall of text with no structure should score low on layout and hierarchy\n\nList AT MOST 6 issues, most severe first, one sentence each for \"description\" and \"fix\" \u2014 a longer list is cut off and lost.\n\nRespond with ONLY a JSON object (no markdown, no explanation):\n{\n \"completeness\": <0-100>,\n \"layout\": <0-100>,\n \"hierarchy\": <0-100>,\n \"aesthetics\": <0-100>,\n \"issues\": [\n { \"dimension\": \"<dimension>\", \"severity\": \"<critical|major|minor>\", \"description\": \"<what's wrong>\", \"fix\": \"<specific fix>\" }\n ],\n \"critique\": \"<2-3 sentences: what's good, what needs improvement, does it achieve the user's goal?>\"\n}";
|
|
586
|
-
/**
|
|
587
|
-
* Send the screenshot to the configured multimodal provider through
|
|
588
|
-
* the shared `LLMAgent` machinery. Routing through `createVisionAgent`
|
|
589
|
-
* (rather than constructing provider SDK clients inline) is what puts
|
|
590
|
-
* this call inside the same `apiCall()` choke point as every other
|
|
591
|
-
* completion: provider 429s retry with `Retry-After` honoring, the
|
|
592
|
-
* caller's `onRetry` observer sees each retry, and `routeOverride`
|
|
593
|
-
* governs credentials and model routing (including the Anthropic
|
|
594
|
-
* Bedrock path) instead of `process.env`.
|
|
595
|
-
*/
|
|
596
|
-
/**
|
|
597
|
-
* Output budget for the judge's answer. 1500 cut a board's issue list
|
|
598
|
-
* mid-array (`Expected ',' or ']' after array element`, six kanban cells
|
|
599
|
-
* on 2026-09-11) — deterministic on the content, so a same-prompt retry
|
|
600
|
-
* could never clear it. 4096 fits the bounded list the prompt now asks for
|
|
601
|
-
* with room; the salvage path covers the remainder.
|
|
602
|
-
*/
|
|
603
|
-
declare const VISUAL_JUDGE_MAX_OUTPUT_TOKENS = 4096;
|
|
604
|
-
/**
|
|
605
|
-
* The judge instrument's name and content digest, for the record a run
|
|
606
|
-
* stamps beside every visual score. The NAME is for readers; the DIGEST
|
|
607
|
-
* is computed from the prompt text at module load, so a stamped row can
|
|
608
|
-
* never claim a prompt version it did not run — change the prompt and the
|
|
609
|
-
* digest moves with it (the pin ties the name to the bounded-list text).
|
|
610
|
-
*/
|
|
611
|
-
declare const VISUAL_JUDGE_PROMPT_VERSION = "v2-bounded-issues";
|
|
612
|
-
declare const VISUAL_JUDGE_PROMPT_DIGEST: string;
|
|
613
|
-
declare function callMultimodalLLM(config: VisualEvalConfig, model: string, prompt: string, screenshot: Buffer, originalPrompt: string, profileBlock?: string, criteriaBlock?: string): Promise<LLMResponse>;
|
|
614
|
-
/**
|
|
615
|
-
* Run visual evaluation on a compiled component.
|
|
616
|
-
*
|
|
617
|
-
* 1. Builds an HTML page with the component + sample props
|
|
618
|
-
* 2. Takes a screenshot via puppeteer (if available)
|
|
619
|
-
* 3. Sends screenshot to multimodal LLM for visual scoring
|
|
620
|
-
*
|
|
621
|
-
* Returns null if puppeteer is not available (graceful fallback).
|
|
622
|
-
*/
|
|
623
|
-
/**
|
|
624
|
-
* The judge's answer WITH the reason when it could not judge: `result` is
|
|
625
|
-
* null exactly when no screenshot could be taken (no browser, a launch or
|
|
626
|
-
* in-page failure) or the component could not be bundled; `unavailableReason`
|
|
627
|
-
* names why in words and `canvas` the canvas it happened at. A production
|
|
628
|
-
* caller records the reason in its receipt — a `judge_unavailable` that only
|
|
629
|
-
* says "null" cost a log dive on 2026-09-10 (puppeteer-core missing in the
|
|
630
|
-
* deploy image).
|
|
631
|
-
*/
|
|
632
|
-
interface VisualEvalDetailed {
|
|
633
|
-
readonly result: VisualEvaluationResult | null;
|
|
634
|
-
readonly unavailableReason?: string;
|
|
635
|
-
readonly canvas?: CanvasClass;
|
|
636
|
-
}
|
|
637
|
-
declare function runVisualEvaluation(context: VisualEvalContext, config: VisualEvalConfig, deps?: VisualEvalDeps): Promise<VisualEvaluationResult | null>;
|
|
638
|
-
declare function runVisualEvaluationDetailed(context: VisualEvalContext, config: VisualEvalConfig, deps?: VisualEvalDeps): Promise<VisualEvalDetailed>;
|
|
639
|
-
/** The per-canvas verdicts without the PNGs — what the harness stamps on `EvalResult.visual`. */
|
|
640
|
-
declare function summarizeVisualResult(result: VisualEvaluationResult): VisualEvalSummary | undefined;
|
|
641
|
-
/** One stored capture to judge: the frame the judge saw at capture time, plus what the capture measured. */
|
|
642
|
-
interface StoredCaptureInput {
|
|
643
|
-
readonly canvas: CanvasClass;
|
|
644
|
-
/** The capture as saved (`canvas-<class>.png`). */
|
|
645
|
-
readonly png: Buffer;
|
|
646
|
-
/** The box the capture was taken at — the class box, or the declared one. */
|
|
647
|
-
readonly viewport: CanvasViewport;
|
|
648
|
-
/** The document's scroll height the capture recorded; `null` when it did not. */
|
|
649
|
-
readonly contentHeight: number | null;
|
|
650
|
-
readonly originalPrompt: string;
|
|
651
|
-
readonly profile?: GenerationProfileInput;
|
|
652
|
-
/** ggui#1436 — the bank and the card's context; absent = today's judge, no block. */
|
|
653
|
-
readonly criteria?: {
|
|
654
|
-
readonly bank: CriteriaBank;
|
|
655
|
-
readonly context: CriteriaContextInput;
|
|
656
|
-
};
|
|
657
|
-
/** The props the capture was rendered with — handed to the criteria block for the rows whose evidence names props. */
|
|
658
|
-
readonly sampleProps?: JsonObject;
|
|
659
|
-
}
|
|
660
|
-
interface StoredCaptureVerdict {
|
|
661
|
-
readonly canvas: CanvasClass;
|
|
662
|
-
readonly viewport: CanvasViewport;
|
|
663
|
-
readonly score: number;
|
|
664
|
-
readonly passed: boolean;
|
|
665
|
-
readonly issues: EvaluationIssue[];
|
|
666
|
-
readonly judge: CanvasJudgeRecord;
|
|
667
|
-
readonly contentHeight: number | null;
|
|
668
|
-
readonly overflow: boolean;
|
|
669
|
-
readonly inkRatio: number | null;
|
|
670
|
-
readonly criteria?: CriteriaBlock;
|
|
671
|
-
/** The scoring calls' spend. */
|
|
672
|
-
readonly inputTokens: number;
|
|
673
|
-
readonly outputTokens: number;
|
|
674
|
-
/** ggui#1436 — the report-only criteria call's spend, apart from the scoring calls'; absent when none was asked or answered. */
|
|
675
|
-
readonly criteriaTokens?: CriteriaCallTokens;
|
|
676
|
-
}
|
|
677
|
-
type StoredCaptureOutcome = {
|
|
678
|
-
readonly kind: 'ok';
|
|
679
|
-
readonly verdict: StoredCaptureVerdict;
|
|
680
|
-
} | {
|
|
681
|
-
readonly kind: 'unavailable';
|
|
682
|
-
readonly reason: string;
|
|
683
|
-
};
|
|
684
|
-
/**
|
|
685
|
-
* Judge a STORED capture exactly as the per-canvas leg judges a fresh one — the same K scoring calls on the
|
|
686
|
-
* same frame, the same median, the same fit and blank verdicts, the same report-only criteria call — without
|
|
687
|
-
* rendering.
|
|
688
|
-
* This is the calibration's path (ggui#1438): the frame his eye marks is the frame the judge saw, and a
|
|
689
|
-
* re-judge costs judge tokens only. Fit reads the capture's recorded `contentHeight`; ink is read off the
|
|
690
|
-
* PNG inside the canvas's chrome, as at capture.
|
|
691
|
-
*/
|
|
692
|
-
declare function judgeStoredCapture(input: StoredCaptureInput, config: VisualEvalConfig, deps?: Pick<VisualEvalDeps, 'judge'>): Promise<StoredCaptureOutcome>;
|
|
693
|
-
|
|
694
|
-
/** What the harness's eval round consumes from the visual leg. */
|
|
695
|
-
interface VisualEvalOutcome {
|
|
696
|
-
/** Tier-2 issues (empty when no browser is available). */
|
|
697
|
-
issues: EvalIssue[];
|
|
698
|
-
/**
|
|
699
|
-
* Per-canvas summary — present ONLY when `config.canvases` was set and
|
|
700
|
-
* the leg ran; the harness stamps it on `EvalResult.visual`. Absent on
|
|
701
|
-
* the single-shot path (byte-identical to the pre-canvas result).
|
|
702
|
-
*/
|
|
703
|
-
summary?: VisualEvalSummary;
|
|
704
|
-
/**
|
|
705
|
-
* ggui#1221 — whether the judge leg ran or was skipped (with the reason
|
|
706
|
-
* `runVisualEvaluationDetailed` names). Always present: the absence of a
|
|
707
|
-
* summary used to be indistinguishable from a clean single-shot run.
|
|
708
|
-
*/
|
|
709
|
-
coverage: VisualCoverage;
|
|
710
|
-
}
|
|
711
|
-
/**
|
|
712
|
-
* Run visual evaluation and return tier 2 EvalIssues (+ the per-canvas
|
|
713
|
-
* summary when canvases were requested).
|
|
714
|
-
*/
|
|
715
|
-
declare function runVisualEval(context: VisualEvalContext, config: VisualEvalConfig, deps?: VisualEvalDeps): Promise<VisualEvalOutcome>;
|
|
716
|
-
|
|
717
192
|
/** A channel difference at or below this is the same colour (anti-aliasing and compositing noise). */
|
|
718
193
|
declare const INK_TOLERANCE = 8;
|
|
719
194
|
interface PixelRegion {
|
|
@@ -792,11 +267,21 @@ declare function selectCriteria(bank: CriteriaBank, ctx: CriteriaContext): Crite
|
|
|
792
267
|
|
|
793
268
|
/** The instruments the capture runs today, by the bank ids they answer (v1 binding; a bank field may replace it). */
|
|
794
269
|
declare const INSTRUMENT_BY_ID: Readonly<Record<string, 'fit' | 'fill'>>;
|
|
270
|
+
/**
|
|
271
|
+
* ggui#1663 — instruments that read BESIDE a judge row, report-only: the row keeps the judge's verdict and gains the
|
|
272
|
+
* measurement as `instrument`, so the two can be compared before any verdict moves.
|
|
273
|
+
*/
|
|
274
|
+
declare const INSTRUMENT_BESIDE_JUDGE: Readonly<Record<string, 'edge'>>;
|
|
795
275
|
interface CriteriaMeasurements {
|
|
796
276
|
readonly overflow: boolean;
|
|
797
277
|
readonly contentHeight: number | null;
|
|
798
278
|
readonly viewportHeight: number;
|
|
799
279
|
readonly inkRatio: number | null;
|
|
280
|
+
/**
|
|
281
|
+
* ggui#1663 — the edge rule on the capture's DOM: absent when this capture had no page to read (a stored frame),
|
|
282
|
+
* `null` when the probe ran and failed.
|
|
283
|
+
*/
|
|
284
|
+
readonly edge?: EdgeVerdict | null;
|
|
800
285
|
}
|
|
801
286
|
declare function resolveCriteriaBlock(args: {
|
|
802
287
|
readonly bank: CriteriaBank;
|
|
@@ -804,6 +289,16 @@ declare function resolveCriteriaBlock(args: {
|
|
|
804
289
|
readonly selected: CriteriaSelectionResult;
|
|
805
290
|
readonly answers: readonly CriteriaAnswer[][];
|
|
806
291
|
readonly measurements: CriteriaMeasurements;
|
|
292
|
+
/**
|
|
293
|
+
* ggui#1127 — why a judge row has no answer, when the caller knows: a salvaged criteria answer keeps no criteria,
|
|
294
|
+
* so its rows say so instead of reading as a clean `n/a`. Absent ⇒ "not answered".
|
|
295
|
+
*/
|
|
296
|
+
readonly unansweredReason?: string;
|
|
297
|
+
/** ggui#1687 — the call that answered, as it came back: its answer's counts and its stop reason. */
|
|
298
|
+
readonly call?: {
|
|
299
|
+
readonly answer: CriteriaAnswerCounts;
|
|
300
|
+
readonly finishReason?: VisionFinishReason;
|
|
301
|
+
};
|
|
807
302
|
}): CriteriaBlock;
|
|
808
303
|
/** The judge's prompt block for the selected `judge` rows; empty when none is selected. */
|
|
809
304
|
/** The capture the judge is handed: its canvas class and the box it was taken at (the class box, or a declared one). */
|
|
@@ -823,4 +318,77 @@ interface CriteriaJudgeInputs {
|
|
|
823
318
|
/** The judge's prompt block for the selected `judge` rows; empty when none is selected. */
|
|
824
319
|
declare function buildCriteriaJudgeBlock(bank: CriteriaBank, selected: CriteriaSelectionResult, inputs?: CriteriaJudgeInputs): string;
|
|
825
320
|
|
|
826
|
-
|
|
321
|
+
/**
|
|
322
|
+
* `space.edge`'s measurement (#1663): the expression a capture evaluates in the page to produce {@link EdgeBlock}s for
|
|
323
|
+
* {@link judgeEdges}. It runs where the screenshot is taken, on the same DOM at the same width, so the rule reads what
|
|
324
|
+
* the judge's frame shows. It only reads layout; it never writes to the page.
|
|
325
|
+
*
|
|
326
|
+
* What it measures, under `#root`, in CSS px from the card's left edge:
|
|
327
|
+
*
|
|
328
|
+
* - **Text blocks.** Text is grouped by its nearest non-inline element. A block's edge is its first visible character
|
|
329
|
+
* in ink: text in a transparent colour, private-use icon-font glyphs and formatting characters are not characters of
|
|
330
|
+
* the block. Its extent is the union of its inked line boxes. A marker before the text (an icon or image that paints,
|
|
331
|
+
* or a number or bullet on the same line) makes it a hanging marker: `edge` is the marker's, `textEdge` the text's.
|
|
332
|
+
* - **Control groups.** Native and ARIA controls, and bounded boxes the visitor clicks (a pointer cursor or a tab stop,
|
|
333
|
+
* holding no control of their own), group by their parent and are measured at the first control: the border box
|
|
334
|
+
* when bounded, else its text. A control's contents are never blocks of the enclosing column.
|
|
335
|
+
* - **Surfaces.** A non-inline box with a border on at least three sides, its own fill different from what it sits on,
|
|
336
|
+
* or a shadow. A table is a surface measured at its rule and not descended into. A box with no text, control, image
|
|
337
|
+
* or icon inside (a loading bar) is a `placeholder`, which is not a block.
|
|
338
|
+
* - **Roles.** A list item is `list-item` when its list follows a paragraph; text centred in a box wider than it, or
|
|
339
|
+
* controls in a centring row, are `centred`.
|
|
340
|
+
* - **Rows, first, read by geometry.** Items set on one line, however the CSS lays them out: an item after another
|
|
341
|
+
* measured item on its line that holds one block (a text, a control, or a box holding at most one text) belongs to
|
|
342
|
+
* the row and is not measured. An item with a stack inside it is a column.
|
|
343
|
+
* - **Ornaments:** text with no letters or digits is not measured.
|
|
344
|
+
*
|
|
345
|
+
* Hidden elements (through any ancestor), zero-size ones and transparent text are skipped. What the rows and ornament
|
|
346
|
+
* rules set aside is counted. A frame with no text in ink is reported as placeholders only. The expression returns a
|
|
347
|
+
* JSON value; {@link parseEdgeProbe} is its typed read. *
|
|
348
|
+
* **Validated instrument (#1663, 2026-10-02):** this file as of `cec465319` (with `7bb4da13e`) passed a fresh sealed
|
|
349
|
+
* blind draw at the registered bar (27/30, κ 0.76), stricter than the design lead's reading on its disagreements. Any
|
|
350
|
+
* later change to what this file measures or decides is a new instrument until another fresh sealed draw.
|
|
351
|
+
*/
|
|
352
|
+
|
|
353
|
+
/** What the probe returns: the measured blocks, and whether the frame showed nothing to evaluate. */
|
|
354
|
+
interface EdgeProbe {
|
|
355
|
+
readonly blocks: readonly EdgeBlock[];
|
|
356
|
+
readonly placeholdersOnly: boolean;
|
|
357
|
+
/** What the probe saw and did not measure, by rule, so a dropped block is counted rather than silent. */
|
|
358
|
+
readonly skipped: {
|
|
359
|
+
readonly rowItems: number;
|
|
360
|
+
readonly ornaments: number;
|
|
361
|
+
};
|
|
362
|
+
}
|
|
363
|
+
declare const EDGE_BLOCKS_EXPRESSION: string;
|
|
364
|
+
/**
|
|
365
|
+
* The probe's typed read: `null` when the page had no `#root` or returned something else, so a failed measurement is
|
|
366
|
+
* reported as unmeasured and never read as "no offsets". A malformed block fails the whole read for the same reason.
|
|
367
|
+
*/
|
|
368
|
+
declare function parseEdgeProbe(value: unknown): EdgeProbe | null;
|
|
369
|
+
|
|
370
|
+
/**
|
|
371
|
+
* ggui#1640 — one judged frame's (or one visual evaluation's) spend, summed over EVERY leg the judge reports.
|
|
372
|
+
*
|
|
373
|
+
* The judge reports its legs apart: the scoring calls' `inputTokens` / `outputTokens`, and, since ggui#1436, the
|
|
374
|
+
* report-only criteria call's `criteriaTokens`. A caller that sums only the first leg under-counts, and a dollar
|
|
375
|
+
* ceiling built on that sum stops late. {@link judgedFrameTokens} is the one sum. The two `satisfies` tables below list
|
|
376
|
+
* every `*Tokens` member of the results it reads, so a leg added to either result type fails the build here until the
|
|
377
|
+
* sum counts it.
|
|
378
|
+
*/
|
|
379
|
+
|
|
380
|
+
/** A spend in tokens: input and output, over every leg. */
|
|
381
|
+
interface JudgeSpend {
|
|
382
|
+
readonly inputTokens: number;
|
|
383
|
+
readonly outputTokens: number;
|
|
384
|
+
}
|
|
385
|
+
/** The legs {@link judgedFrameTokens} reads, as both result types carry them. */
|
|
386
|
+
interface JudgedTokens {
|
|
387
|
+
readonly inputTokens?: number;
|
|
388
|
+
readonly outputTokens?: number;
|
|
389
|
+
readonly criteriaTokens?: CriteriaCallTokens;
|
|
390
|
+
}
|
|
391
|
+
/** A judged frame's spend over every leg: the scoring calls plus the report-only criteria call, when one ran. */
|
|
392
|
+
declare function judgedFrameTokens(result: JudgedTokens): JudgeSpend;
|
|
393
|
+
|
|
394
|
+
export { CRITERIA_SELECTOR_VERSION, CriteriaBank, CriteriaCallTokens, type CriteriaMeasurements, type CriteriaSelectionResult, type DecodedImage, EDGE_BLOCKS_EXPRESSION, EdgeBlock, type EdgeProbe, EdgeVerdict, type EvaluateScoreInput, EvaluationConfig, EvaluationContext, EvaluationIssue, type EvaluationLoopOptions, type EvaluationLoopResult, EvaluationResult, INK_TOLERANCE, INSTRUMENT_BESIDE_JUDGE, INSTRUMENT_BY_ID, type InkExtent, type InkUnreadable, type JudgeSpend, type JudgedTokens, type PixelRegion, QualityMetadata, type SdkMessage, buildCriteriaJudgeBlock, buildFixPrompt, canonicalCriteriaContext, computeEvaluationScore, createEvaluationToolsServer, criteriaSetIdFor, cssTokensForAppTheme, decodePng, extractCompiledCode, extractCompiledCodeFromMessage, extractEvalResult, extractSourceCode, extractSourceCodeFromMessage, extractToolResultTexts, getEvaluatorSystemPrompt, judgedFrameTokens, parseEdgeProbe, readInkExtent, resolveCriteriaBlock, runEvaluation, runEvaluationLoop, selectCriteria };
|