@mizchi/vlmkit-core 0.9.0 → 0.11.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.
Files changed (70) hide show
  1. package/README.md +1 -1
  2. package/dist/a11y-semantic.d.mts +1 -6
  3. package/dist/a11y-semantic.mjs +1 -6
  4. package/dist/apng.d.mts +42 -0
  5. package/dist/apng.mjs +199 -0
  6. package/dist/arg-reader.d.mts +3 -1
  7. package/dist/arg-reader.mjs +8 -1
  8. package/dist/auth-state.d.mts +14 -3
  9. package/dist/auth-state.mjs +30 -6
  10. package/dist/bitmap-font.d.mts +48 -0
  11. package/dist/bitmap-font.mjs +945 -0
  12. package/dist/browser-launch.d.mts +65 -0
  13. package/dist/browser-launch.mjs +194 -0
  14. package/dist/cli-args.d.mts +1 -6
  15. package/dist/cli-args.mjs +1 -6
  16. package/dist/cli-error.d.mts +79 -1
  17. package/dist/cli-error.mjs +188 -20
  18. package/dist/dom-equivalence.d.mts +2 -7
  19. package/dist/dom-equivalence.mjs +1 -6
  20. package/dist/element-compare.mjs +8 -11
  21. package/dist/filmstrip.d.mts +121 -0
  22. package/dist/filmstrip.mjs +181 -0
  23. package/dist/gate-config.d.mts +107 -22
  24. package/dist/gate-config.mjs +138 -9
  25. package/dist/heatmap.d.mts +48 -4
  26. package/dist/heatmap.mjs +157 -12
  27. package/dist/index.d.mts +8 -6
  28. package/dist/index.mjs +6 -4
  29. package/dist/mask.d.mts +66 -2
  30. package/dist/mask.mjs +91 -4
  31. package/dist/page-load.d.mts +83 -0
  32. package/dist/page-load.mjs +116 -0
  33. package/dist/page-open.d.mts +123 -2
  34. package/dist/page-open.mjs +176 -6
  35. package/dist/plugin/args.d.mts +86 -0
  36. package/dist/plugin/args.mjs +162 -0
  37. package/dist/plugin/browser.d.mts +6 -0
  38. package/dist/plugin/browser.mjs +6 -0
  39. package/dist/plugin/cli-entry.d.mts +11 -0
  40. package/dist/plugin/cli-entry.mjs +69 -0
  41. package/dist/plugin/contract.d.mts +270 -0
  42. package/dist/plugin/contract.mjs +51 -0
  43. package/dist/plugin/index.d.mts +82 -0
  44. package/dist/plugin/index.mjs +81 -0
  45. package/dist/plugin/load.d.mts +36 -0
  46. package/dist/plugin/load.mjs +98 -0
  47. package/dist/plugin/registry.d.mts +60 -0
  48. package/dist/plugin/registry.mjs +160 -0
  49. package/dist/plugin/rule-tier.d.mts +65 -0
  50. package/dist/plugin/rule-tier.mjs +77 -0
  51. package/dist/plugin/rules.d.mts +112 -0
  52. package/dist/plugin/rules.mjs +188 -0
  53. package/dist/plugin/runner.d.mts +198 -0
  54. package/dist/plugin/runner.mjs +440 -0
  55. package/dist/png-utils.d.mts +31 -1
  56. package/dist/png-utils.mjs +24 -1
  57. package/dist/project-config.d.mts +12 -0
  58. package/dist/project-config.mjs +28 -0
  59. package/dist/rect-overlap.d.mts +41 -0
  60. package/dist/rect-overlap.mjs +28 -0
  61. package/dist/run-ledger.d.mts +56 -2
  62. package/dist/run-ledger.mjs +102 -11
  63. package/dist/types.d.mts +60 -1
  64. package/dist/version.d.mts +20 -0
  65. package/dist/version.mjs +20 -0
  66. package/dist/webp.d.mts +31 -0
  67. package/dist/webp.mjs +105 -0
  68. package/package.json +19 -3
  69. package/dist/legacy-names.d.mts +0 -48
  70. package/dist/legacy-names.mjs +0 -134
@@ -1,48 +0,0 @@
1
- //#region src/legacy-names.d.ts
2
- declare const STATE_DIR = ".vlmkit";
3
- declare const LEGACY_STATE_DIR = ".vrt";
4
- declare const CONFIG_FILE = "vlmkit.config.json";
5
- declare const LEGACY_CONFIG_FILE = "vrt.config.json";
6
- declare function noteLegacyName(oldName: string, newName: string, detail?: string): void;
7
- /** Reset between tests. */
8
- declare function resetLegacyNotices(): void;
9
- /**
10
- * Absolute path for a state entry, preferring `.vlmkit/<entry>` and falling back
11
- * to an existing `.vrt/<entry>`.
12
- *
13
- * Writers get the new path unless the old one is already populated, so a
14
- * project keeps appending where its history is instead of starting a second,
15
- * half-empty baseline set beside it.
16
- */
17
- declare function resolveStatePath(cwd: string, entry: string): string;
18
- /**
19
- * Config filenames in search order: new before old, JSON before TOML (JSON wins
20
- * when both exist, which was the pre-rename behaviour). `legacy: true` entries
21
- * are what `findConfigPath` reports a notice for.
22
- *
23
- * Exported as data rather than a resolver because the caller also has to name
24
- * every candidate in its "not found" error — listing only the new one would
25
- * tell a project with a working `vrt.config.json` that it has no config.
26
- */
27
- declare const CONFIG_CANDIDATES: readonly {
28
- name: string;
29
- legacy: boolean;
30
- }[];
31
- /**
32
- * `VLMKIT_FOO`, falling back to `VRT_FOO`.
33
- *
34
- * Pass the suffix, not the whole name, so a call site cannot mismatch the two
35
- * halves — `readEnv("LLM_MODEL")` reads `VLMKIT_LLM_MODEL` then `VRT_LLM_MODEL`.
36
- * An empty string counts as unset, matching how the previous `process.env.X ||`
37
- * reads behaved.
38
- */
39
- declare function readEnv(suffix: string): string | undefined;
40
- /**
41
- * `DEBUG_VLMKIT`, falling back to `DEBUG_VRT`. Separate from `readEnv` because
42
- * this one is a prefix, not a suffix — `DEBUG_VRT`, not `VRT_DEBUG`.
43
- */
44
- declare function debugEnabled(): boolean;
45
- /** Every env suffix that has both spellings, so the docs and tests can enumerate. */
46
- declare const ENV_SUFFIXES: readonly ["BASE_URL", "CAPTURE_BACKEND", "CONFIG_FILE", "CONFIG_PATH", "LLM_MODEL", "LLM_PROVIDER", "PROJECT_ROOT", "VLM_MODEL"];
47
- //#endregion
48
- export { CONFIG_CANDIDATES, CONFIG_FILE, ENV_SUFFIXES, LEGACY_CONFIG_FILE, LEGACY_STATE_DIR, STATE_DIR, debugEnabled, noteLegacyName, readEnv, resetLegacyNotices, resolveStatePath };
@@ -1,134 +0,0 @@
1
- import { existsSync } from "node:fs";
2
- import { join, resolve } from "node:path";
3
- //#region src/legacy-names.ts
4
- /**
5
- * Backward compatibility for the `vrt` → `vlmkit` rename of things that are not
6
- * text: the state directory, the config filename, and the environment
7
- * variables.
8
- *
9
- * The command-name rename was pure text — nothing on disk moved. These three
10
- * are different: rename them without a fallback and every existing project
11
- * silently loses its approved baselines, stops finding its config, and drops
12
- * whatever its CI exports. So each new name is preferred, each old name still
13
- * works, and using an old one prints one line saying so.
14
- *
15
- * ## Why per-subpath and not per-directory
16
- *
17
- * `.vlmkit/` already exists in any project that has run a gate — the run
18
- * ledger, `gates`, `markup-loop` and `copy-review` all live there, while
19
- * `baselines`, `runs` and `last-diff-for-agent.json` were still under `.vrt/`.
20
- * So "if `.vlmkit/` is missing, use `.vrt/`" would resolve to the new directory
21
- * immediately and lose the baselines anyway. The check has to be on the
22
- * specific entry: `.vlmkit/baselines` vs `.vrt/baselines`.
23
- *
24
- * ## What is deliberately NOT here
25
- *
26
- * Values that leave this process or land in someone else's file — the
27
- * `X-Title` header sent to OpenRouter, the Playwright `projectName` that
28
- * appears inside snapshot paths, the plan schema's `vrt?:` field, the published
29
- * OpenAPI title. Those are wire and data formats, not local state, and moving
30
- * them is a separate decision.
31
- */
32
- const STATE_DIR = ".vlmkit";
33
- const LEGACY_STATE_DIR = ".vrt";
34
- const CONFIG_FILE = "vlmkit.config.json";
35
- const LEGACY_CONFIG_FILE = "vrt.config.json";
36
- /** One notice per distinct old name per process — a loop must not spam. */
37
- const announced = /* @__PURE__ */ new Set();
38
- function noteLegacyName(oldName, newName, detail = "") {
39
- if (announced.has(oldName)) return;
40
- announced.add(oldName);
41
- const tag = !process.env.NO_COLOR && process.stderr.isTTY ? "\x1B[33m[vlmkit legacy]\x1B[0m" : "[vlmkit legacy]";
42
- process.stderr.write(`${tag} using ${oldName} — rename to ${newName}; support ends in 1.0.0${detail ? `. ${detail}` : ""}\n`);
43
- }
44
- /** Reset between tests. */
45
- function resetLegacyNotices() {
46
- announced.clear();
47
- }
48
- /**
49
- * Absolute path for a state entry, preferring `.vlmkit/<entry>` and falling back
50
- * to an existing `.vrt/<entry>`.
51
- *
52
- * Writers get the new path unless the old one is already populated, so a
53
- * project keeps appending where its history is instead of starting a second,
54
- * half-empty baseline set beside it.
55
- */
56
- function resolveStatePath(cwd, entry) {
57
- const next = resolve(cwd, join(STATE_DIR, entry));
58
- if (existsSync(next)) return next;
59
- const legacy = resolve(cwd, join(LEGACY_STATE_DIR, entry));
60
- if (existsSync(legacy)) {
61
- noteLegacyName(`${LEGACY_STATE_DIR}/${entry}`, `${STATE_DIR}/${entry}`, "move it to keep using one location");
62
- return legacy;
63
- }
64
- return next;
65
- }
66
- /**
67
- * Config filenames in search order: new before old, JSON before TOML (JSON wins
68
- * when both exist, which was the pre-rename behaviour). `legacy: true` entries
69
- * are what `findConfigPath` reports a notice for.
70
- *
71
- * Exported as data rather than a resolver because the caller also has to name
72
- * every candidate in its "not found" error — listing only the new one would
73
- * tell a project with a working `vrt.config.json` that it has no config.
74
- */
75
- const CONFIG_CANDIDATES = [
76
- {
77
- name: CONFIG_FILE,
78
- legacy: false
79
- },
80
- {
81
- name: "vlmkit.config.toml",
82
- legacy: false
83
- },
84
- {
85
- name: LEGACY_CONFIG_FILE,
86
- legacy: true
87
- },
88
- {
89
- name: "vrt.config.toml",
90
- legacy: true
91
- }
92
- ];
93
- /**
94
- * `VLMKIT_FOO`, falling back to `VRT_FOO`.
95
- *
96
- * Pass the suffix, not the whole name, so a call site cannot mismatch the two
97
- * halves — `readEnv("LLM_MODEL")` reads `VLMKIT_LLM_MODEL` then `VRT_LLM_MODEL`.
98
- * An empty string counts as unset, matching how the previous `process.env.X ||`
99
- * reads behaved.
100
- */
101
- function readEnv(suffix) {
102
- const next = process.env[`VLMKIT_${suffix}`];
103
- if (next) return next;
104
- const legacy = process.env[`VRT_${suffix}`];
105
- if (legacy) {
106
- noteLegacyName(`VRT_${suffix}`, `VLMKIT_${suffix}`);
107
- return legacy;
108
- }
109
- }
110
- /**
111
- * `DEBUG_VLMKIT`, falling back to `DEBUG_VRT`. Separate from `readEnv` because
112
- * this one is a prefix, not a suffix — `DEBUG_VRT`, not `VRT_DEBUG`.
113
- */
114
- function debugEnabled() {
115
- if (process.env.DEBUG_VLMKIT) return true;
116
- if (process.env.DEBUG_VRT) {
117
- noteLegacyName("DEBUG_VRT", "DEBUG_VLMKIT");
118
- return true;
119
- }
120
- return false;
121
- }
122
- /** Every env suffix that has both spellings, so the docs and tests can enumerate. */
123
- const ENV_SUFFIXES = [
124
- "BASE_URL",
125
- "CAPTURE_BACKEND",
126
- "CONFIG_FILE",
127
- "CONFIG_PATH",
128
- "LLM_MODEL",
129
- "LLM_PROVIDER",
130
- "PROJECT_ROOT",
131
- "VLM_MODEL"
132
- ];
133
- //#endregion
134
- export { CONFIG_CANDIDATES, CONFIG_FILE, ENV_SUFFIXES, LEGACY_CONFIG_FILE, LEGACY_STATE_DIR, STATE_DIR, debugEnabled, noteLegacyName, readEnv, resetLegacyNotices, resolveStatePath };