@mizchi/vlmkit-ai 0.11.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/index.d.mts CHANGED
@@ -1,8 +1,8 @@
1
1
  import { VrtConfigError, VrtConfigErrorCode } from "./errors.mjs";
2
2
  import { CreateImageGenClientOptions, ImageGenBackground, ImageGenClient, ImageGenModel, ImageGenOutputFormat, ImageGenQuality, ImageGenRequest, ImageGenRequestBody, ImageGenResponse, ImageGenSize, ImageGenUsage, ParsedGeneration, buildGenerationBody, createImageGenClient, estimateImageGenCost, listImageGenModels, parseGenerationResponse, resolveImageGenModel } from "./image-gen-client.mjs";
3
3
  import { LLMProvider, buildIntent, buildIntentWithLLM, buildReasoningPrompt, extractDiffSemantics, parseDiff } from "./intent.mjs";
4
- import { CreateLLMProviderOptions, ImageContent, LLMClientOptions, LLMProviderName, LLMResponse, MessageContent, TextContent, UnifiedLLMClient, createLLMProvider, createUnifiedLLMClient } from "./llm-client.mjs";
4
+ import { CreateLLMProviderOptions, ImageContent, LLMClientOptions, LLMProviderName, LLMResponse, MessageContent, OPENAI_DEFAULT_MODEL, TextContent, UnifiedLLMClient, createLLMProvider, createUnifiedLLMClient } from "./llm-client.mjs";
5
5
  import { CreateVlmClientOptions, VlmClient, VlmModel, VlmResponse, createVlmClient, fetchVisionModels, isGeminiDirectModel, listGeminiModels, listModels, resolveGeminiModel, resolveModel } from "./vlm-client.mjs";
6
6
  import { AnalyzeOptions, CssFix, FixSuggestion, PipelineConfig, ReasoningPipeline, StructuredDiffReport, VisualChange, createReasoningPipeline } from "./reasoning-pipeline.mjs";
7
7
  import { ActualChange, ExpectationMapping, ReasoningChain, reasonAboutChanges } from "./reasoning.mjs";
8
- export { type ActualChange, type AnalyzeOptions, type CreateImageGenClientOptions, type CreateLLMProviderOptions, type CreateVlmClientOptions, type CssFix, type ExpectationMapping, type FixSuggestion, type ImageContent, type ImageGenBackground, type ImageGenClient, type ImageGenModel, type ImageGenOutputFormat, type ImageGenQuality, type ImageGenRequest, type ImageGenRequestBody, type ImageGenResponse, type ImageGenSize, type ImageGenUsage, type LLMClientOptions, type LLMProvider, type LLMProviderName, type LLMResponse, type MessageContent, type ParsedGeneration, type PipelineConfig, type ReasoningChain, type ReasoningPipeline, type StructuredDiffReport, type TextContent, type UnifiedLLMClient, type VisualChange, type VlmClient, type VlmModel, type VlmResponse, VrtConfigError, type VrtConfigErrorCode, buildGenerationBody, buildIntent, buildIntentWithLLM, buildReasoningPrompt, createImageGenClient, createLLMProvider, createReasoningPipeline, createUnifiedLLMClient, createVlmClient, estimateImageGenCost, extractDiffSemantics, fetchVisionModels, isGeminiDirectModel, listGeminiModels, listImageGenModels, listModels, parseDiff, parseGenerationResponse, reasonAboutChanges, resolveGeminiModel, resolveImageGenModel, resolveModel };
8
+ export { type ActualChange, type AnalyzeOptions, type CreateImageGenClientOptions, type CreateLLMProviderOptions, type CreateVlmClientOptions, type CssFix, type ExpectationMapping, type FixSuggestion, type ImageContent, type ImageGenBackground, type ImageGenClient, type ImageGenModel, type ImageGenOutputFormat, type ImageGenQuality, type ImageGenRequest, type ImageGenRequestBody, type ImageGenResponse, type ImageGenSize, type ImageGenUsage, type LLMClientOptions, type LLMProvider, type LLMProviderName, type LLMResponse, type MessageContent, OPENAI_DEFAULT_MODEL, type ParsedGeneration, type PipelineConfig, type ReasoningChain, type ReasoningPipeline, type StructuredDiffReport, type TextContent, type UnifiedLLMClient, type VisualChange, type VlmClient, type VlmModel, type VlmResponse, VrtConfigError, type VrtConfigErrorCode, buildGenerationBody, buildIntent, buildIntentWithLLM, buildReasoningPrompt, createImageGenClient, createLLMProvider, createReasoningPipeline, createUnifiedLLMClient, createVlmClient, estimateImageGenCost, extractDiffSemantics, fetchVisionModels, isGeminiDirectModel, listGeminiModels, listImageGenModels, listModels, parseDiff, parseGenerationResponse, reasonAboutChanges, resolveGeminiModel, resolveImageGenModel, resolveModel };
package/dist/index.mjs CHANGED
@@ -1,8 +1,8 @@
1
1
  import { VrtConfigError } from "./errors.mjs";
2
2
  import { buildGenerationBody, createImageGenClient, estimateImageGenCost, listImageGenModels, parseGenerationResponse, resolveImageGenModel } from "./image-gen-client.mjs";
3
- import { createLLMProvider, createUnifiedLLMClient } from "./llm-client.mjs";
3
+ import { OPENAI_DEFAULT_MODEL, createLLMProvider, createUnifiedLLMClient } from "./llm-client.mjs";
4
4
  import { createVlmClient, fetchVisionModels, isGeminiDirectModel, listGeminiModels, listModels, resolveGeminiModel, resolveModel } from "./vlm-client.mjs";
5
5
  import { createReasoningPipeline } from "./reasoning-pipeline.mjs";
6
6
  import { reasonAboutChanges } from "./reasoning.mjs";
7
7
  import { buildIntent, buildIntentWithLLM, buildReasoningPrompt, extractDiffSemantics, parseDiff } from "./intent.mjs";
8
- export { VrtConfigError, buildGenerationBody, buildIntent, buildIntentWithLLM, buildReasoningPrompt, createImageGenClient, createLLMProvider, createReasoningPipeline, createUnifiedLLMClient, createVlmClient, estimateImageGenCost, extractDiffSemantics, fetchVisionModels, isGeminiDirectModel, listGeminiModels, listImageGenModels, listModels, parseDiff, parseGenerationResponse, reasonAboutChanges, resolveGeminiModel, resolveImageGenModel, resolveModel };
8
+ export { OPENAI_DEFAULT_MODEL, VrtConfigError, buildGenerationBody, buildIntent, buildIntentWithLLM, buildReasoningPrompt, createImageGenClient, createLLMProvider, createReasoningPipeline, createUnifiedLLMClient, createVlmClient, estimateImageGenCost, extractDiffSemantics, fetchVisionModels, isGeminiDirectModel, listGeminiModels, listImageGenModels, listModels, parseDiff, parseGenerationResponse, reasonAboutChanges, resolveGeminiModel, resolveImageGenModel, resolveModel };
@@ -55,6 +55,20 @@ interface UnifiedLLMClient {
55
55
  model: string;
56
56
  }
57
57
  type LLMProviderName = "gemini" | "anthropic" | "openrouter";
58
+ /**
59
+ * The OpenAI model this project reaches for by default, and the one place its id is written.
60
+ *
61
+ * OpenAI is **not** a provider name here — there is no `api.openai.com` client and no
62
+ * `OPENAI_API_KEY` anywhere in the codebase. Its models are served through OpenRouter, which is
63
+ * why the id carries the `openai/` prefix: that string is an OpenRouter catalogue id, not an
64
+ * OpenAI one.
65
+ *
66
+ * Exported so the docs can be pinned to it. `tests/agent-model-defaults.test.mjs` asserts that
67
+ * `AGENTS.md`, `.claude/CLAUDE.md` and `docs/configuration.md` all name this exact model, because
68
+ * the defect this constant came from was an agent reading a document and picking something the
69
+ * code does not accept.
70
+ */
71
+ declare const OPENAI_DEFAULT_MODEL = "openai/gpt-5.6-luna";
58
72
  /**
59
73
  * Create a unified LLM client.
60
74
  *
@@ -84,4 +98,4 @@ interface CreateLLMProviderOptions {
84
98
  */
85
99
  declare function createLLMProvider(options?: CreateLLMProviderOptions): LLMProvider | null;
86
100
  //#endregion
87
- export { CreateLLMProviderOptions, ImageContent, LLMClientOptions, LLMProviderName, LLMResponse, MessageContent, TextContent, UnifiedLLMClient, createLLMProvider, createUnifiedLLMClient };
101
+ export { CreateLLMProviderOptions, ImageContent, LLMClientOptions, LLMProviderName, LLMResponse, MessageContent, OPENAI_DEFAULT_MODEL, TextContent, UnifiedLLMClient, createLLMProvider, createUnifiedLLMClient };
@@ -217,6 +217,29 @@ const VALID_PROVIDERS = new Set([
217
217
  "openrouter"
218
218
  ]);
219
219
  /**
220
+ * The OpenAI model this project reaches for by default, and the one place its id is written.
221
+ *
222
+ * OpenAI is **not** a provider name here — there is no `api.openai.com` client and no
223
+ * `OPENAI_API_KEY` anywhere in the codebase. Its models are served through OpenRouter, which is
224
+ * why the id carries the `openai/` prefix: that string is an OpenRouter catalogue id, not an
225
+ * OpenAI one.
226
+ *
227
+ * Exported so the docs can be pinned to it. `tests/agent-model-defaults.test.mjs` asserts that
228
+ * `AGENTS.md`, `.claude/CLAUDE.md` and `docs/configuration.md` all name this exact model, because
229
+ * the defect this constant came from was an agent reading a document and picking something the
230
+ * code does not accept.
231
+ */
232
+ const OPENAI_DEFAULT_MODEL = "openai/gpt-5.6-luna";
233
+ /**
234
+ * Names an agent reaches for when it wants OpenAI and finds no `openai` provider.
235
+ *
236
+ * Measured, not guessed: an OpenAI-based agent working in this repo set
237
+ * `VLMKIT_LLM_PROVIDER=openai`, got `Expected: gemini | anthropic | openrouter`, and stopped —
238
+ * the message listed the three valid names and said nothing about where OpenAI models live, so
239
+ * there was nothing to act on. `o\d` covers the reasoning line (`o3`, `o4-mini`).
240
+ */
241
+ const OPENAI_SHAPED_NAME = /^(openai|oai|gpt|chatgpt|codex|o\d)/i;
242
+ /**
220
243
  * Resolve provider and key from environment variables.
221
244
  *
222
245
  * VLMKIT_LLM_PROVIDER: gemini (default) | anthropic | openrouter
@@ -292,7 +315,7 @@ function resolveProviderConfig(options) {
292
315
  if (!VALID_PROVIDERS.has(requested)) return {
293
316
  ok: false,
294
317
  code: "INVALID_PROVIDER",
295
- message: `Unknown VLMKIT_LLM_PROVIDER "${requested}". Expected: gemini | anthropic | openrouter.`
318
+ message: `Unknown VLMKIT_LLM_PROVIDER "${requested}". Expected: gemini | anthropic | openrouter.${OPENAI_SHAPED_NAME.test(String(requested)) ? ` OpenAI models are served through OpenRouter, not by a provider of their own: VLMKIT_LLM_PROVIDER=openrouter VLMKIT_LLM_MODEL=${OPENAI_DEFAULT_MODEL} (needs OPENROUTER_API_KEY).` : ""}`
296
319
  };
297
320
  const provider = requested;
298
321
  const key = keyMap[provider];
@@ -359,4 +382,4 @@ function createLLMProvider(options) {
359
382
  return null;
360
383
  }
361
384
  //#endregion
362
- export { createLLMProvider, createUnifiedLLMClient };
385
+ export { OPENAI_DEFAULT_MODEL, createLLMProvider, createUnifiedLLMClient };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mizchi/vlmkit-ai",
3
- "version": "0.11.0",
3
+ "version": "0.22.0",
4
4
  "description": "VLM / LLM clients, reasoning pipeline, and NLP helpers used by VRT to interpret diff images and natural-language intent.",
5
5
  "license": "MIT",
6
6
  "author": "mizchi",
@@ -37,7 +37,7 @@
37
37
  },
38
38
  "dependencies": {
39
39
  "@google/generative-ai": "^0.24.1",
40
- "@mizchi/vlmkit-core": "0.11.0"
40
+ "@mizchi/vlmkit-core": "0.22.0"
41
41
  },
42
42
  "scripts": {
43
43
  "build": "pnpm --dir ../.. exec tsdown --config tsdown.packages.config.ts --filter @mizchi/vlmkit-ai",