@mizchi/vlmkit-ai 0.9.0 → 0.9.1

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 CHANGED
@@ -3,7 +3,7 @@
3
3
  VLM / LLM clients and reasoning pipeline used by VRT to interpret diff
4
4
  images and natural-language intent.
5
5
 
6
- Part of the [`vlmkit`](https://github.com/mizchi/vrt) monorepo.
6
+ Part of the [`vlmkit`](https://github.com/mizchi/vlmkit) monorepo.
7
7
 
8
8
  ## Install
9
9
 
@@ -41,9 +41,9 @@ const reasoning = await runReasoning({ /* diff context */ });
41
41
 
42
42
  | Variable | Purpose |
43
43
  |---|---|
44
- | `VRT_LLM_PROVIDER` | `gemini` (default) \| `anthropic` |
45
- | `VRT_LLM_MODEL` | Override provider default model |
46
- | `VRT_VLM_MODEL` | OpenRouter VLM model id |
44
+ | `VLMKIT_LLM_PROVIDER` | `gemini` (default) \| `anthropic` |
45
+ | `VLMKIT_LLM_MODEL` | Override provider default model |
46
+ | `VLMKIT_VLM_MODEL` | OpenRouter VLM model id |
47
47
  | `OPENROUTER_API_KEY` | VLM access |
48
48
  | `GEMINI_API_KEY` | Gemini LLM access |
49
49
  | `ANTHROPIC_API_KEY` | Anthropic LLM access |
package/dist/errors.d.mts CHANGED
@@ -15,7 +15,7 @@
15
15
  * Codes are stable; new ones can only be added (never renumbered or
16
16
  * removed) in minor versions.
17
17
  */
18
- type VrtConfigErrorCode = /** Required env var (`OPENROUTER_API_KEY`, `GEMINI_API_KEY`, `ANTHROPIC_API_KEY`) not set. */"MISSING_KEY" /** Provider/model id doesn't resolve. */ | "INVALID_MODEL" /** Model substring matches more than one candidate. */ | "MULTIPLE_MATCHES" /** `VRT_LLM_PROVIDER` value is not one of the known providers. */ | "INVALID_PROVIDER" /** No provider in the fallback chain has an API key configured. */ | "NO_PROVIDER_AVAILABLE" /** An optional runtime dependency (e.g. `@google/generative-ai`) failed to import. */ | "MISSING_DEPENDENCY" /** Caller-supplied request parameters are malformed (empty prompt, out-of-range size, etc.). */ | "INVALID_REQUEST";
18
+ type VrtConfigErrorCode = /** Required env var (`OPENROUTER_API_KEY`, `GEMINI_API_KEY`, `ANTHROPIC_API_KEY`) not set. */"MISSING_KEY" /** Provider/model id doesn't resolve. */ | "INVALID_MODEL" /** Model substring matches more than one candidate. */ | "MULTIPLE_MATCHES" /** `VLMKIT_LLM_PROVIDER` value is not one of the known providers. */ | "INVALID_PROVIDER" /** No provider in the fallback chain has an API key configured. */ | "NO_PROVIDER_AVAILABLE" /** An optional runtime dependency (e.g. `@google/generative-ai`) failed to import. */ | "MISSING_DEPENDENCY" /** Caller-supplied request parameters are malformed (empty prompt, out-of-range size, etc.). */ | "INVALID_REQUEST";
19
19
  declare class VrtConfigError extends Error {
20
20
  readonly code: VrtConfigErrorCode;
21
21
  constructor(code: VrtConfigErrorCode, message: string);
@@ -58,7 +58,7 @@ type LLMProviderName = "gemini" | "anthropic" | "openrouter";
58
58
  /**
59
59
  * Create a unified LLM client.
60
60
  *
61
- * Provider is set via `VRT_LLM_PROVIDER` env var (default: `gemini`).
61
+ * Provider is set via `VLMKIT_LLM_PROVIDER` env var (default: `gemini`).
62
62
  *
63
63
  * Throws `VrtConfigError` when the resolved provider has no API key
64
64
  * (`code: "MISSING_KEY"`) or the provider value is unknown
@@ -75,7 +75,7 @@ interface CreateLLMProviderOptions {
75
75
  }
76
76
  /**
77
77
  * Backwards-compatible: returns the existing `LLMProvider` interface.
78
- * Uses the provider specified by `VRT_LLM_PROVIDER`. Falls back to
78
+ * Uses the provider specified by `VLMKIT_LLM_PROVIDER`. Falls back to
79
79
  * other providers if the requested key is missing.
80
80
  *
81
81
  * Throws `VrtConfigError` (`code: "NO_PROVIDER_AVAILABLE"`) when no
@@ -1,5 +1,5 @@
1
1
  import { VrtConfigError } from "./errors.mjs";
2
- import { readEnv } from "@mizchi/vlmkit-core/legacy-names.ts";
2
+ import { readEnv } from "@mizchi/vlmkit-core/project-config.ts";
3
3
  //#region src/llm-client.ts
4
4
  function createAnthropicClient(apiKey, model) {
5
5
  const modelId = model ?? "claude-sonnet-4-6";
@@ -219,8 +219,8 @@ const VALID_PROVIDERS = new Set([
219
219
  /**
220
220
  * Resolve provider and key from environment variables.
221
221
  *
222
- * VRT_LLM_PROVIDER: gemini (default) | anthropic | openrouter
223
- * VRT_LLM_MODEL: model ID (defaults to provider's default)
222
+ * VLMKIT_LLM_PROVIDER: gemini (default) | anthropic | openrouter
223
+ * VLMKIT_LLM_MODEL: model ID (defaults to provider's default)
224
224
  *
225
225
  * Returns a config, or describes why no config was available. The
226
226
  * factory decides whether to throw based on `throwIfMissing`.
@@ -230,7 +230,7 @@ function resolveProviderConfig(options) {
230
230
  if (!VALID_PROVIDERS.has(rawProvider)) return {
231
231
  ok: false,
232
232
  code: "INVALID_PROVIDER",
233
- message: `Unknown VRT_LLM_PROVIDER "${rawProvider}". Expected: gemini | anthropic | openrouter.`
233
+ message: `Unknown VLMKIT_LLM_PROVIDER "${rawProvider}". Expected: gemini | anthropic | openrouter.`
234
234
  };
235
235
  const provider = rawProvider;
236
236
  const model = options?.model ?? readEnv("LLM_MODEL") ?? void 0;
@@ -260,7 +260,7 @@ function resolveProviderConfig(options) {
260
260
  /**
261
261
  * Create a unified LLM client.
262
262
  *
263
- * Provider is set via `VRT_LLM_PROVIDER` env var (default: `gemini`).
263
+ * Provider is set via `VLMKIT_LLM_PROVIDER` env var (default: `gemini`).
264
264
  *
265
265
  * Throws `VrtConfigError` when the resolved provider has no API key
266
266
  * (`code: "MISSING_KEY"`) or the provider value is unknown
@@ -282,7 +282,7 @@ function createUnifiedLLMClient(options) {
282
282
  }
283
283
  /**
284
284
  * Backwards-compatible: returns the existing `LLMProvider` interface.
285
- * Uses the provider specified by `VRT_LLM_PROVIDER`. Falls back to
285
+ * Uses the provider specified by `VLMKIT_LLM_PROVIDER`. Falls back to
286
286
  * other providers if the requested key is missing.
287
287
  *
288
288
  * Throws `VrtConfigError` (`code: "NO_PROVIDER_AVAILABLE"`) when no
@@ -35,7 +35,7 @@ interface FixSuggestion {
35
35
  interface PipelineConfig {
36
36
  /** Stage 1: VLM for image analysis (default: qwen3-vl-8b via OpenRouter) */
37
37
  vlmModel?: string;
38
- /** Stage 2: LLM for code generation (default: from VRT_LLM_PROVIDER) */
38
+ /** Stage 2: LLM for code generation (default: from VLMKIT_LLM_PROVIDER) */
39
39
  llmProvider?: "gemini" | "anthropic" | "openrouter";
40
40
  llmModel?: string;
41
41
  /** Image resolution (default: medium = 400x300) */
@@ -1,7 +1,7 @@
1
1
  import { VrtConfigError } from "./errors.mjs";
2
2
  import { createUnifiedLLMClient } from "./llm-client.mjs";
3
3
  import { createVlmClient, resolveModel } from "./vlm-client.mjs";
4
- import { readEnv } from "@mizchi/vlmkit-core/legacy-names.ts";
4
+ import { readEnv } from "@mizchi/vlmkit-core/project-config.ts";
5
5
  import { resizeBase64Png } from "@mizchi/vlmkit-core/image-resize.ts";
6
6
  //#region src/reasoning-pipeline.ts
7
7
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mizchi/vlmkit-ai",
3
- "version": "0.9.0",
3
+ "version": "0.9.1",
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.9.0"
40
+ "@mizchi/vlmkit-core": "0.9.1"
41
41
  },
42
42
  "scripts": {
43
43
  "build": "pnpm --dir ../.. exec tsdown --config tsdown.packages.config.ts --filter @mizchi/vlmkit-ai",