@ggui-ai/ui-gen 0.15.0 → 0.16.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/adapters/generation-dispatch.d.ts +21 -4
- package/dist/adapters/generation-dispatch.js +913 -350
- package/dist/adapters/generation-dispatch.js.map +1 -1
- package/dist/adapters/index.js +26 -22
- package/dist/adapters/index.js.map +1 -1
- package/dist/advanced/index.d.ts +17 -12
- package/dist/advanced/index.js +966 -374
- package/dist/advanced/index.js.map +1 -1
- package/dist/boilerplate.d.ts +16 -1
- package/dist/boilerplate.js +579 -245
- package/dist/boilerplate.js.map +1 -1
- package/dist/check/index.d.ts +17 -3
- package/dist/check/index.js +32 -25
- package/dist/check/index.js.map +1 -1
- package/dist/{create-ui-generator-D6TKuv9V.d.ts → create-ui-generator-CCIeQaEe.d.ts} +77 -10
- package/dist/design-mode-BHEE7flj.d.ts +67 -0
- package/dist/{dispatch-BuZfTh9r.d.ts → dispatch-BA5dJcg-.d.ts} +4 -1
- package/dist/evaluation/axis-checks/index.d.ts +4 -3
- package/dist/evaluation/axis-checks/index.js +3 -1
- package/dist/evaluation/axis-checks/index.js.map +1 -1
- package/dist/evaluation/axis-checks/registry.d.ts +2 -1
- package/dist/evaluation/axis-checks/registry.js +1 -0
- package/dist/evaluation/axis-checks/registry.js.map +1 -1
- package/dist/evaluation/index.d.ts +143 -3
- package/dist/evaluation/index.js +3866 -92
- package/dist/evaluation/index.js.map +1 -1
- package/dist/{generate-BTfvELgl.d.ts → generate-8L_bc2iP.d.ts} +10 -1
- package/dist/harness/check/runtime-render/index.d.ts +2 -1
- package/dist/harness/index.d.ts +2 -1
- package/dist/harness/index.js +589 -248
- package/dist/harness/index.js.map +1 -1
- package/dist/harness/llm-trace-sink.d.ts +3 -3
- package/dist/harness/llm-trace-sink.js.map +1 -1
- package/dist/harness/prompts.d.ts +2 -1
- package/dist/harness/prompts.js +3 -0
- package/dist/harness/prompts.js.map +1 -1
- package/dist/harness/result-types.d.ts +17 -5
- package/dist/harness/result-types.js.map +1 -1
- package/dist/harness/runtime.d.ts +19 -3
- package/dist/harness/runtime.js +602 -261
- package/dist/harness/runtime.js.map +1 -1
- package/dist/harness/types-public.d.ts +28 -1
- package/dist/harness/types-public.js +589 -248
- package/dist/harness/types-public.js.map +1 -1
- package/dist/harness/validator-trace-sink.d.ts +2 -1
- package/dist/index.d.ts +8 -4
- package/dist/index.js +973 -372
- package/dist/index.js.map +1 -1
- package/dist/patch.d.ts +2 -1
- package/dist/{prompts-BVhtH3M1.d.ts → prompts-k6m6reqe.d.ts} +11 -1
- package/dist/providers/index.d.ts +2 -2
- package/dist/providers/index.js.map +1 -1
- package/dist/tools/get-primitives-ts.d.ts +1 -1
- package/dist/tools/get-primitives-ts.js +1 -1
- package/dist/tools/get-primitives-ts.js.map +1 -1
- package/dist/{types-public-CkNWEov9.d.ts → types-public-D24JLJgl.d.ts} +49 -5
- package/dist/validation/index.d.ts +1 -1
- package/dist/validation/index.js +4 -4
- package/dist/validation/index.js.map +1 -1
- package/dist/workflows.d.ts +2 -1
- package/package.json +12 -12
- package/src/adapters/generation-dispatch.ts +57 -4
- package/src/adapters/provider-router.ts +7 -6
- package/src/adapters/tools.ts +5 -5
- package/src/advanced/generator.ts +11 -10
- package/src/advanced/index.ts +5 -4
- package/src/boilerplate/free-design-prompt.ts +329 -0
- package/src/boilerplate/generate.ts +10 -1
- package/src/boilerplate/hard-sections.ts +242 -0
- package/src/boilerplate/render.ts +32 -8
- package/src/boilerplate/system-prompt.ts +81 -229
- package/src/boilerplate/templates/base-free.tsx.tmpl +24 -0
- package/src/check/run-tier0.ts +80 -20
- package/src/coding-agent/tools.ts +8 -2
- package/src/contract-context.ts +28 -0
- package/src/create-harness.ts +11 -0
- package/src/create-ui-generator.ts +71 -25
- package/src/design-mode.ts +182 -0
- package/src/design-system-docs.ts +17 -13
- package/src/evaluation/axis-checks/dispatch.ts +4 -0
- package/src/evaluation/axis-checks/extras.ts +5 -0
- package/src/evaluation/cost-tracker.ts +2 -3
- package/src/evaluation/index.ts +46 -2
- package/src/evaluation/llm-evaluator.ts +77 -21
- package/src/evaluation/types-public.ts +103 -8
- package/src/evaluation/visual-evaluator.ts +301 -29
- package/src/harness/coding/dupe-break.ts +0 -0
- package/src/harness/coding/init-session.ts +1 -0
- package/src/harness/coding/run-coding-turn.ts +3 -0
- package/src/harness/coding/run-eval-round.ts +15 -2
- package/src/harness/llm-trace-sink.ts +3 -3
- package/src/harness/result-types.ts +15 -3
- package/src/harness/runtime.ts +18 -0
- package/src/harness/types-public.ts +27 -0
- package/src/index.ts +26 -0
- package/src/internal/extract-call-signatures.ts +2 -2
- package/src/providers/bedrock.ts +4 -4
- package/src/run-check.ts +1 -0
- package/src/tools/get-primitives-ts.ts +1 -1
- package/src/validation/allowed-imports.ts +8 -2
- package/src/validation/primitives.ts +1 -1
|
@@ -21,9 +21,9 @@
|
|
|
21
21
|
* (createAgent → run-coding-turn → llm-evaluator → file-agent → …)
|
|
22
22
|
* touches ~5 packages for a devtools-only surface. The OSS ggui server
|
|
23
23
|
* is a single process per CLI invocation — global state has no
|
|
24
|
-
* confusion-cost there. A hosted
|
|
25
|
-
*
|
|
26
|
-
*
|
|
24
|
+
* confusion-cost there. A hosted deployment isolates per request via a
|
|
25
|
+
* process pool, so a global per-pool is also safe. If we ever serve
|
|
26
|
+
* several apps inside one process we'll thread it then.
|
|
27
27
|
*
|
|
28
28
|
* **Default = no sink.** When unset, the router emits nothing and
|
|
29
29
|
* spends no CPU formatting events. Passing `null` removes a previously
|
|
@@ -12,8 +12,8 @@
|
|
|
12
12
|
import type { DataContract, JsonObject } from "@ggui-ai/protocol";
|
|
13
13
|
import type { AdapterResult } from "../adapters/types.js";
|
|
14
14
|
import type { RenderingContext } from "../contract-context.js";
|
|
15
|
-
import type { EvaluationResult } from "../evaluation/types.js";
|
|
16
15
|
import type { EvalResult } from "../evaluation/types-public.js";
|
|
16
|
+
import type { CanvasClass, DesignMode } from "../design-mode.js";
|
|
17
17
|
|
|
18
18
|
// =============================================================================
|
|
19
19
|
// Model Roles
|
|
@@ -52,8 +52,6 @@ export type ModelRoles = Partial<Record<ModelRole, string>>;
|
|
|
52
52
|
export interface GenerationResult extends AdapterResult {
|
|
53
53
|
/** Number of generation passes the harness performed */
|
|
54
54
|
passesUsed: number;
|
|
55
|
-
/** Evaluation results per round (legacy numeric scoring — backward compat) */
|
|
56
|
-
evaluations?: EvaluationResult[];
|
|
57
55
|
/** Three-tier evaluation result (tier 0 + LLM tier 1+2 + visual) */
|
|
58
56
|
evalResult?: EvalResult;
|
|
59
57
|
/** Whether background improvement should be spawned (auto-improve mode) */
|
|
@@ -62,6 +60,20 @@ export interface GenerationResult extends AdapterResult {
|
|
|
62
60
|
selfCheckPassed?: boolean;
|
|
63
61
|
/** Which model was used for each role (for benchmark reporting) */
|
|
64
62
|
modelRolesUsed?: Record<string, string>;
|
|
63
|
+
/**
|
|
64
|
+
* The triad this generation ran under — recorded ONLY when the caller
|
|
65
|
+
* set `designMode` on the dispatch (a bench arm switch, an operator
|
|
66
|
+
* option). Absent = the constrained default path, byte-identical to
|
|
67
|
+
* the pre-`designMode` result.
|
|
68
|
+
*/
|
|
69
|
+
designMode?: DesignMode;
|
|
70
|
+
/**
|
|
71
|
+
* The canvas class the `free` prompt stated — the explicit `canvas`
|
|
72
|
+
* when the caller passed one, else the shell × screen derivation the
|
|
73
|
+
* prompt itself used. Absent in constrained mode (that prompt states
|
|
74
|
+
* no canvas) unless the caller passed one explicitly.
|
|
75
|
+
*/
|
|
76
|
+
canvas?: CanvasClass;
|
|
65
77
|
/** Phase-level timing breakdown (ms) */
|
|
66
78
|
timing?: Record<string, number>;
|
|
67
79
|
/** Per-turn/per-outcome breakdown for benchmark analysis.
|
package/src/harness/runtime.ts
CHANGED
|
@@ -32,6 +32,7 @@ import { renderPitfallsBlock } from "./pitfalls.js";
|
|
|
32
32
|
import type { GadgetDescriptor, DataContract, JsonObject } from "@ggui-ai/protocol";
|
|
33
33
|
import { buildSystemPrompt as buildSystemPromptSkeleton } from "../boilerplate.js";
|
|
34
34
|
import type { AgentConfig } from "./llm-router.js";
|
|
35
|
+
import type { CanvasClass, DesignMode } from "../design-mode.js";
|
|
35
36
|
|
|
36
37
|
// Re-export the boilerplate generator so existing internal importers
|
|
37
38
|
// (create-harness.ts, benchmarks/preview-boilerplate.ts) keep working.
|
|
@@ -82,6 +83,13 @@ export interface SingleComponentParams {
|
|
|
82
83
|
passThreshold?: number;
|
|
83
84
|
sampleProps?: JsonObject;
|
|
84
85
|
viewport?: { width: number; height: number };
|
|
86
|
+
/**
|
|
87
|
+
* Per-canvas judging — see `VisualEvalConfig.canvases`. When set, the
|
|
88
|
+
* eval round screenshots + judges once per class and the harness
|
|
89
|
+
* stamps `EvalResult.visual` with the PNG-free summary. Unset =
|
|
90
|
+
* today's single screenshot at `viewport`.
|
|
91
|
+
*/
|
|
92
|
+
canvases?: readonly CanvasClass[];
|
|
85
93
|
};
|
|
86
94
|
onProgress?: (event: unknown) => void;
|
|
87
95
|
onInitialResult?: (result: {
|
|
@@ -133,6 +141,14 @@ export function buildSystemPrompt(
|
|
|
133
141
|
* stdlib gadgets do not need one.
|
|
134
142
|
*/
|
|
135
143
|
gadgetTypes?: Readonly<Record<string, string>>,
|
|
144
|
+
/**
|
|
145
|
+
* Which triad to teach — see `SystemPromptInputs.designMode`. Omitted
|
|
146
|
+
* (every pre-existing caller) means `constrained`, byte-identical to
|
|
147
|
+
* the pre-`designMode` prompt.
|
|
148
|
+
*/
|
|
149
|
+
designMode?: DesignMode,
|
|
150
|
+
/** Rendering canvas class (`free` mode) — see `SystemPromptInputs.canvas`. */
|
|
151
|
+
canvas?: CanvasClass,
|
|
136
152
|
): string {
|
|
137
153
|
return buildSystemPromptSkeleton({
|
|
138
154
|
userRequest,
|
|
@@ -145,6 +161,8 @@ export function buildSystemPrompt(
|
|
|
145
161
|
wireDoc: WIRE_DOCUMENTATION,
|
|
146
162
|
appGadgets,
|
|
147
163
|
gadgetTypes,
|
|
164
|
+
designMode,
|
|
165
|
+
canvas,
|
|
148
166
|
// criteriaBlock left undefined — ui-gen fills default from open CRITERIA.
|
|
149
167
|
});
|
|
150
168
|
}
|
|
@@ -24,6 +24,7 @@ import type { EvalIssue, EvalTier, AxisCheck, RuntimeProbeStatus } from "../eval
|
|
|
24
24
|
import type { LLMToolDef } from "../llm.js";
|
|
25
25
|
import type { CacheTier, HarnessFragment } from "../fragments/index.js";
|
|
26
26
|
import type { HarnessPolicy, ProcessMode } from "../policy.js";
|
|
27
|
+
import type { CanvasClass, DesignMode } from "../design-mode.js";
|
|
27
28
|
|
|
28
29
|
export type { ProcessMode };
|
|
29
30
|
|
|
@@ -293,6 +294,14 @@ export interface Harness {
|
|
|
293
294
|
readonly id: HarnessId;
|
|
294
295
|
readonly name: HarnessName;
|
|
295
296
|
readonly classification: Classification;
|
|
297
|
+
/**
|
|
298
|
+
* Which triad this harness materialised — threaded from
|
|
299
|
+
* `CreateHarnessInput.designMode` into the HOW leg (prompt), the WHAT
|
|
300
|
+
* leg (boilerplate) and every CHECK consumer (tier-0 gate, axis
|
|
301
|
+
* checks, evaluator criteria). `constrained` unless the caller opted
|
|
302
|
+
* into `free`.
|
|
303
|
+
*/
|
|
304
|
+
readonly designMode: DesignMode;
|
|
296
305
|
|
|
297
306
|
readonly how: HowLeg;
|
|
298
307
|
readonly what: WhatLeg;
|
|
@@ -383,6 +392,10 @@ export type SystemPromptBuilder = (input: {
|
|
|
383
392
|
readonly shellType?: string;
|
|
384
393
|
readonly screen?: string;
|
|
385
394
|
readonly axisDelta?: string;
|
|
395
|
+
/** Which triad to teach — see `CreateHarnessInput.designMode`. */
|
|
396
|
+
readonly designMode?: DesignMode;
|
|
397
|
+
/** Rendering canvas class (`free` mode) — see `CreateHarnessInput.canvas`. */
|
|
398
|
+
readonly canvas?: CanvasClass;
|
|
386
399
|
}) => string;
|
|
387
400
|
|
|
388
401
|
export interface CreateHarnessInput {
|
|
@@ -392,6 +405,20 @@ export interface CreateHarnessInput {
|
|
|
392
405
|
readonly shellType?: "chat" | "fullscreen" | "spatial";
|
|
393
406
|
readonly screen?: "mobile" | "tablet" | "desktop" | "universal";
|
|
394
407
|
readonly overrides?: HarnessOverrides;
|
|
408
|
+
/**
|
|
409
|
+
* Which triad to materialise. `constrained` (default) is today's
|
|
410
|
+
* design-system triad, byte-identical to the pre-`designMode`
|
|
411
|
+
* harness (same prompt, boilerplate, tier-0 legs, criteria and id).
|
|
412
|
+
* `free` relaxes only the design vocabulary; every hard contract
|
|
413
|
+
* stays. See `../design-mode.ts`.
|
|
414
|
+
*/
|
|
415
|
+
readonly designMode?: DesignMode;
|
|
416
|
+
/**
|
|
417
|
+
* Rendering canvas class the `free` prompt states explicitly. When
|
|
418
|
+
* omitted the prompt derives it from `shellType` × `screen`. Ignored
|
|
419
|
+
* by the `constrained` prompt.
|
|
420
|
+
*/
|
|
421
|
+
readonly canvas?: CanvasClass;
|
|
395
422
|
/**
|
|
396
423
|
* Pre-resolved static harness policy. When omitted, `createHarness`
|
|
397
424
|
* falls back to `DEFAULT_HARNESS_POLICY` from `@ggui-ai/ui-gen/policy`.
|
package/src/index.ts
CHANGED
|
@@ -21,6 +21,7 @@ export {
|
|
|
21
21
|
} from './create-ui-generator.js';
|
|
22
22
|
export type { CreateUiGeneratorOptions } from './create-ui-generator.js';
|
|
23
23
|
export type { ProviderRetryInfo } from './harness/llm-router.js';
|
|
24
|
+
export type { GenerationResult } from './harness/result-types.js';
|
|
24
25
|
|
|
25
26
|
// Generator registry seam re-export. The interface + slug helpers live
|
|
26
27
|
// in `@ggui-ai/mcp-server-core`; the in-memory factory lives in
|
|
@@ -49,6 +50,31 @@ export {
|
|
|
49
50
|
injectVariance,
|
|
50
51
|
} from './contract-context.js';
|
|
51
52
|
export type { RenderingContext } from './contract-context.js';
|
|
53
|
+
export { canvasForRenderingContext } from './contract-context.js';
|
|
54
|
+
|
|
55
|
+
// ── Design mode ──────────────────────────────────────────────────────
|
|
56
|
+
//
|
|
57
|
+
// `createUiGenerator({ designMode })` — `constrained` (default) or
|
|
58
|
+
// `free`; the canvas vocabulary the `free` prompt states.
|
|
59
|
+
export {
|
|
60
|
+
DESIGN_MODES,
|
|
61
|
+
DEFAULT_DESIGN_MODE,
|
|
62
|
+
CANVAS_CLASSES,
|
|
63
|
+
CANVAS_VIEWPORTS,
|
|
64
|
+
CANVAS_BREAKPOINTS,
|
|
65
|
+
CANVAS_DESCRIPTORS,
|
|
66
|
+
canvasDisplayModeForShell,
|
|
67
|
+
canvasForRendering,
|
|
68
|
+
canvasForViewportWidth,
|
|
69
|
+
describeCanvas,
|
|
70
|
+
} from './design-mode.js';
|
|
71
|
+
export type {
|
|
72
|
+
DesignMode,
|
|
73
|
+
CanvasClass,
|
|
74
|
+
CanvasViewport,
|
|
75
|
+
CanvasDisplayMode,
|
|
76
|
+
CanvasDescriptor,
|
|
77
|
+
} from './design-mode.js';
|
|
52
78
|
|
|
53
79
|
// ── Anthropic SDK construction ──────────────────────────────────────
|
|
54
80
|
//
|
|
@@ -419,7 +419,7 @@ export function extractCallSignaturesFromDts(
|
|
|
419
419
|
return {};
|
|
420
420
|
}
|
|
421
421
|
|
|
422
|
-
const cacheKey = `${dtsContent}
|
|
422
|
+
const cacheKey = `${dtsContent}\u0000${[...hookNames].sort().join(',')}`;
|
|
423
423
|
const cached = callSignatureCache.get(cacheKey);
|
|
424
424
|
if (cached !== undefined) return cached;
|
|
425
425
|
|
|
@@ -470,7 +470,7 @@ export function extractComponentPropsFromDts(
|
|
|
470
470
|
return {};
|
|
471
471
|
}
|
|
472
472
|
|
|
473
|
-
const cacheKey = `${dtsContent}
|
|
473
|
+
const cacheKey = `${dtsContent}\u0000${[...componentNames].sort().join(',')}`;
|
|
474
474
|
const cached = componentPropsCache.get(cacheKey);
|
|
475
475
|
if (cached !== undefined) return cached;
|
|
476
476
|
|
package/src/providers/bedrock.ts
CHANGED
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
* Concrete AWS Bedrock `ProviderAdapter` — invokes Anthropic Claude
|
|
3
3
|
* models on Bedrock via the official `@anthropic-ai/bedrock-sdk`
|
|
4
4
|
* package. IAM-based auth (no API key in flight); the AWS credential
|
|
5
|
-
* chain (
|
|
5
|
+
* chain (a workload-identity token / `~/.aws/credentials` / env vars) supplies
|
|
6
6
|
* SigV4 signatures automatically.
|
|
7
7
|
*
|
|
8
8
|
* ## Why this adapter exists
|
|
9
9
|
*
|
|
10
10
|
* Anyone running a one-shot LLM caller on an AWS-credentialed host
|
|
11
|
-
* (EC2, ECS, Lambda
|
|
11
|
+
* (EC2, ECS, Lambda and the like) can target Bedrock without managing API keys: IAM is
|
|
12
12
|
* the auth boundary, AWS rotates host credentials automatically, and
|
|
13
13
|
* a misconfigured IAM role surfaces as a clear `AccessDeniedException`
|
|
14
14
|
* the SDK funnels through `mapError`. The alternative — parking a
|
|
@@ -165,8 +165,8 @@ export function bedrockEndpointFor(model: string): BedrockEndpoint {
|
|
|
165
165
|
* Constructor options for the Bedrock adapter.
|
|
166
166
|
*
|
|
167
167
|
* `region` is the only required option in the common case — IAM
|
|
168
|
-
* credentials come from the standard AWS chain (
|
|
169
|
-
*
|
|
168
|
+
* credentials come from the standard AWS chain (a workload-identity token in
|
|
169
|
+
* a container cluster, instance role on EC2, env vars or shared credentials file
|
|
170
170
|
* locally). Tests pass `clientFactory` to inject a mock SDK client.
|
|
171
171
|
*/
|
|
172
172
|
export interface BedrockAdapterOptions {
|
package/src/run-check.ts
CHANGED
|
@@ -113,6 +113,7 @@ export async function runCheck(input: RunCheckInput): Promise<CheckResult> {
|
|
|
113
113
|
contract: contract,
|
|
114
114
|
originalPrompt: prompt,
|
|
115
115
|
classification: harness.classification,
|
|
116
|
+
designMode: harness.designMode,
|
|
116
117
|
};
|
|
117
118
|
let axisIssueCount = 0;
|
|
118
119
|
const seenAxisIds = new Set<string>();
|