@ggui-ai/ui-gen 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/adapters/base.d.ts +7 -0
- package/dist/adapters/base.js +1 -0
- package/dist/adapters/base.js.map +1 -1
- package/dist/adapters/generation-dispatch.d.ts +17 -3
- package/dist/adapters/generation-dispatch.js +1078 -3464
- package/dist/adapters/generation-dispatch.js.map +1 -1
- package/dist/adapters/index.js +60 -3
- package/dist/adapters/index.js.map +1 -1
- package/dist/advanced/index.d.ts +4 -4
- package/dist/advanced/index.js +1346 -3557
- package/dist/advanced/index.js.map +1 -1
- package/dist/blueprint-validator.js +10 -3
- package/dist/blueprint-validator.js.map +1 -1
- package/dist/boilerplate.js +2 -2
- package/dist/boilerplate.js.map +1 -1
- package/dist/check/index.d.ts +1 -1
- package/dist/check/index.js.map +1 -1
- package/dist/{create-ui-generator-CxPvudbs.d.ts → create-ui-generator-BEkzEtNz.d.ts} +2 -2
- package/dist/{dispatch-N8wdNOX-.d.ts → dispatch-DJNpQ7DI.d.ts} +1 -1
- package/dist/evaluation/axis-checks/index.d.ts +3 -3
- package/dist/evaluation/axis-checks/index.js.map +1 -1
- package/dist/evaluation/axis-checks/registry.d.ts +1 -1
- package/dist/evaluation/index.d.ts +38 -6
- package/dist/evaluation/index.js +670 -3374
- package/dist/evaluation/index.js.map +1 -1
- package/dist/harness/check/runtime-render/index.d.ts +2 -2
- package/dist/harness/check/runtime-render/index.js +10 -3
- package/dist/harness/check/runtime-render/index.js.map +1 -1
- package/dist/harness/check/runtime-render/render-check-worker.js +5 -3
- package/dist/harness/check/runtime-render/render-check-worker.js.map +1 -1
- package/dist/harness/index.d.ts +2 -2
- package/dist/harness/index.js +587 -30
- package/dist/harness/index.js.map +1 -1
- package/dist/harness/llm-trace-sink.d.ts +7 -1
- package/dist/harness/llm-trace-sink.js.map +1 -1
- package/dist/harness/prompts.js +1 -1
- package/dist/harness/prompts.js.map +1 -1
- package/dist/harness/result-types.d.ts +15 -2
- package/dist/harness/result-types.js.map +1 -1
- package/dist/harness/runtime.d.ts +11 -2
- package/dist/harness/runtime.js +3 -3
- package/dist/harness/runtime.js.map +1 -1
- package/dist/harness/types-public.d.ts +1 -1
- package/dist/harness/types-public.js +2 -2
- package/dist/harness/types-public.js.map +1 -1
- package/dist/harness/validator-trace-sink.d.ts +1 -1
- package/dist/index.d.ts +23 -7
- package/dist/index.js +1346 -3557
- package/dist/index.js.map +1 -1
- package/dist/{llm-router-D7fjBhtr.d.ts → llm-router-DwwUK1bz.d.ts} +16 -3
- package/dist/patch.d.ts +1 -1
- package/dist/providers/index.js +5 -4
- package/dist/providers/index.js.map +1 -1
- package/dist/{render-check-WfOVO9kU.d.ts → render-check-C0CqVceF.d.ts} +17 -0
- package/dist/{types-public-DKR_h70H.d.ts → types-public-mM_-1Yk3.d.ts} +59 -1
- 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/workflows.d.ts +1 -1
- package/package.json +16 -12
- package/src/adapters/base.ts +8 -0
- package/src/adapters/claude/claude-code-login.ts +128 -0
- package/src/adapters/claude/sdk.ts +9 -1
- package/src/adapters/generation-dispatch.ts +19 -2
- package/src/adapters/openai/tokens.ts +18 -0
- package/src/adapters/provider-router.ts +28 -0
- package/src/boilerplate/generate.ts +19 -4
- package/src/boilerplate/hard-sections.ts +1 -1
- package/src/boilerplate/templates/layouts/chat-mobile.tsx.tmpl +7 -3
- package/src/boilerplate/templates/layouts/chat-universal.tsx.tmpl +7 -3
- package/src/contract-context.ts +1 -1
- package/src/create-ui-generator.ts +49 -10
- package/src/evaluation/design-identity.ts +16 -5
- package/src/evaluation/index.ts +1 -0
- package/src/evaluation/llm-evaluator.ts +40 -13
- package/src/evaluation/types-public.ts +58 -0
- package/src/evaluation/visual-evaluator.ts +240 -30
- package/src/generator-build.ts +158 -0
- package/src/harness/check/runtime-render/adapter.ts +9 -0
- package/src/harness/check/runtime-render/render-check.ts +26 -5
- package/src/harness/claude-code-login-query.ts +529 -0
- package/src/harness/coding/assemble-result.ts +18 -2
- package/src/harness/coding/generate-task-runner.ts +75 -36
- package/src/harness/coding/run-coding-turn.ts +9 -0
- package/src/harness/coding/run-eval-round.ts +338 -38
- package/src/harness/enforced-coding.ts +20 -0
- package/src/harness/llm-router.ts +390 -55
- package/src/harness/llm-trace-sink.ts +7 -1
- package/src/harness/result-types.ts +14 -0
- package/src/harness/runtime.ts +6 -0
- package/src/index.ts +2 -1
- package/src/providers/openai.ts +31 -19
- package/src/validation/primitives.ts +1 -1
package/src/index.ts
CHANGED
|
@@ -21,7 +21,8 @@ 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
|
+
export type { GenerationResult, SameExchangeBreak } from './harness/result-types.js';
|
|
25
|
+
export type { UiGenBuild } from './generator-build.js';
|
|
25
26
|
|
|
26
27
|
// Generator registry seam re-export. The interface + slug helpers live
|
|
27
28
|
// in `@ggui-ai/mcp-server-core`; the in-memory factory lives in
|
package/src/providers/openai.ts
CHANGED
|
@@ -137,19 +137,25 @@ export function createOpenAiAdapter(
|
|
|
137
137
|
*
|
|
138
138
|
* Token-cap parameter selection:
|
|
139
139
|
*
|
|
140
|
-
* - `gpt-
|
|
141
|
-
* `
|
|
142
|
-
*
|
|
143
|
-
*
|
|
144
|
-
* with this model. Use
|
|
145
|
-
*
|
|
146
|
-
*
|
|
147
|
-
*
|
|
140
|
+
* - OpenAI, `gpt-N*` with N ≥ 5 (gpt-5, gpt-6, …) and `o1*`, `o3*`,
|
|
141
|
+
* `o4*` (reasoning + new-API models) → `max_completion_tokens`. The
|
|
142
|
+
* legacy `max_tokens` field returns 400 `unsupported_parameter` on
|
|
143
|
+
* these models per the OpenAI 2024-09 deprecation: "Unsupported
|
|
144
|
+
* parameter: 'max_tokens' is not supported with this model. Use
|
|
145
|
+
* 'max_completion_tokens' instead."
|
|
146
|
+
* - OpenAI, everything else (`gpt-4*`, `gpt-3.5*`, etc.) →
|
|
147
|
+
* `max_tokens` for backwards-compat with the chat-completions field
|
|
148
|
+
* that's been stable since 2023.
|
|
149
|
+
* - OpenRouter, every model → `max_tokens`. The rule above is
|
|
150
|
+
* OpenAI's, not the gateway's: OpenRouter's catalog lists only
|
|
151
|
+
* `max_tokens` for `openai/gpt-6-luna` and `openai/gpt-6-sol`, and
|
|
152
|
+
* accepts it for every other slug. Keyed on the provider, so no
|
|
153
|
+
* model id — slugged or bare — can switch an OpenRouter body.
|
|
148
154
|
*
|
|
149
|
-
*
|
|
150
|
-
* ship continuously
|
|
151
|
-
*
|
|
152
|
-
*
|
|
155
|
+
* A generation-number rule rather than a hard model list, because new
|
|
156
|
+
* variants ship continuously and the generation is the contract OpenAI
|
|
157
|
+
* exposes (ggui#1255: the `gpt-5` prefix alone sent every gpt-6 id,
|
|
158
|
+
* the live `gpt-6-astra` included, down the legacy field).
|
|
153
159
|
*/
|
|
154
160
|
export function buildOpenAiBody(request: ProviderRequest): Record<string, unknown> {
|
|
155
161
|
const body: Record<string, unknown> = {
|
|
@@ -160,21 +166,27 @@ export function buildOpenAiBody(request: ProviderRequest): Record<string, unknow
|
|
|
160
166
|
],
|
|
161
167
|
};
|
|
162
168
|
if (request.maxTokens !== undefined) {
|
|
163
|
-
|
|
169
|
+
const field =
|
|
170
|
+
request.route.provider === 'openrouter'
|
|
171
|
+
? 'max_tokens'
|
|
172
|
+
: selectMaxTokensField(request.route.model);
|
|
173
|
+
body[field] = request.maxTokens;
|
|
164
174
|
}
|
|
165
175
|
return body;
|
|
166
176
|
}
|
|
167
177
|
|
|
168
178
|
/**
|
|
169
|
-
* Pick which token-cap field name
|
|
170
|
-
*
|
|
171
|
-
*
|
|
179
|
+
* Pick which token-cap field name an OpenAI request sends, from a BARE
|
|
180
|
+
* OpenAI model id (`gpt-6-luna`, not `openai/gpt-6-luna` — an
|
|
181
|
+
* `<author>/` slug is a gateway id and is deliberately not stripped).
|
|
182
|
+
* The gpt generation is read as a number, so `gpt-50` is not `gpt-5`.
|
|
183
|
+
* No SDK lookup, no async; runs once per request body build.
|
|
172
184
|
*/
|
|
173
185
|
export function selectMaxTokensField(model: string): 'max_tokens' | 'max_completion_tokens' {
|
|
174
186
|
const m = model.toLowerCase();
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
187
|
+
const generation = /^gpt-(\d+)/.exec(m);
|
|
188
|
+
if (generation !== null && Number(generation[1]) >= 5) return 'max_completion_tokens';
|
|
189
|
+
if (m.startsWith('o1') || m.startsWith('o3') || m.startsWith('o4')) return 'max_completion_tokens';
|
|
178
190
|
return 'max_tokens';
|
|
179
191
|
}
|
|
180
192
|
|